@linuxcnc-node/eden-bridge 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/backend.js +5102 -0
- package/dist/backend.js.map +1 -0
- package/manifest.json +38 -0
- package/package.json +45 -0
- package/scripts/copy-addons.js +54 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../packages/core/dist/constants.js","../../../../node_modules/.pnpm/dlv@1.1.3/node_modules/dlv/index.js","../../../../node_modules/.pnpm/dset@3.1.4/node_modules/dset/dist/index.js","../../../../packages/core/dist/statChannel.js","../../../../packages/types/src/constants.ts","../../../../packages/types/src/core.ts","../../../../packages/types/dist/command.js","../../../../packages/types/src/gcode.ts","../../../../packages/types/src/index.ts","../../../../packages/core/dist/commandChannel.js","../../../../packages/core/dist/commandTransport/statusCoordinator.js","../../../../packages/core/dist/commandTransport/index.js","../../../../packages/core/dist/errorChannel.js","../../../../packages/core/dist/positionLogger.js","../../../../packages/core/dist/index.js","../../../../packages/gcode/src/ts/parser.ts","../../../../packages/gcode/src/ts/index.ts","../../../../packages/hal/dist/constants.js","../../../../packages/hal/dist/item.js","../../../../packages/hal/dist/component.js","../../../../packages/hal/dist/functions.js","../../../../packages/hal/dist/index.js","../../../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js","../../../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js","../../../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js","../../../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js","../../../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js","../../../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/index.js","../src/services/linuxcnc.ts","../src/services/gcode.ts","../src/services/hal.ts","../src/services/position-logger.ts","../src/backend.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.addon = void 0;\n// Native addon - loaded immediately on module import\nfunction loadAddon() {\n const paths = [\n \"../build/Release/nml_addon.node\",\n \"../../build/Release/nml_addon.node\", // Fallback for debug builds\n ];\n const errors = [];\n for (const path of paths) {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n return require(path);\n }\n catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n errors.push(`${path}: ${message}`);\n // Try next path\n }\n }\n throw new Error(`Failed to load linuxcnc-node nml native addon. Please ensure it's built correctly and that LinuxCNC is in your PATH/LD_LIBRARY_PATH.\\n${errors.join(\"\\n\")}`);\n}\nexports.addon = loadAddon();\n","export default function dlv(obj, key, def, p, undef) {\n\tkey = key.split ? key.split('.') : key;\n\tfor (p = 0; p < key.length; p++) {\n\t\tobj = obj ? obj[key[p]] : undef;\n\t}\n\treturn obj === undef ? def : obj;\n}\n","function dset(obj, keys, val) {\n\tkeys.split && (keys=keys.split('.'));\n\tvar i=0, l=keys.length, t=obj, x, k;\n\twhile (i < l) {\n\t\tk = ''+keys[i++];\n\t\tif (k === '__proto__' || k === 'constructor' || k === 'prototype') break;\n\t\tt = t[k] = (i === l) ? val : (typeof(x=t[k])===typeof(keys)) ? x : (keys[i]*0 !== 0 || !!~(''+keys[i]).indexOf('.')) ? {} : [];\n\t}\n}\n\nexports.dset = dset;","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StatChannel = exports.DEFAULT_STAT_POLL_INTERVAL = void 0;\nconst node_events_1 = require(\"node:events\");\nconst constants_1 = require(\"./constants\");\nconst dlv_1 = __importDefault(require(\"dlv\"));\nconst dset_1 = require(\"dset\");\nexports.DEFAULT_STAT_POLL_INTERVAL = 50; // ms\nclass StatChannel extends node_events_1.EventEmitter {\n constructor(options) {\n super();\n this.poller = null;\n this.isPolling = false;\n this.cursor = 0;\n this.currentStat = null;\n this.watchedProperties = new Map();\n this.nativeInstance = new constants_1.addon.NativeStatChannel();\n this.pollInterval = options?.pollInterval ?? exports.DEFAULT_STAT_POLL_INTERVAL;\n // Initial full sync to populate currentStat\n this.currentStat = {};\n const initialResult = this.nativeInstance.poll(true); // force=true gets all fields\n for (const change of initialResult.changes) {\n (0, dset_1.dset)(this.currentStat, change.path, change.value);\n }\n this.cursor = initialResult.cursor;\n this.startPolling();\n }\n startPolling() {\n if (this.poller || !this.nativeInstance)\n return;\n this.poller = setInterval(() => this.performPoll(), this.pollInterval);\n }\n stopPolling() {\n if (this.poller) {\n clearInterval(this.poller);\n this.poller = null;\n }\n }\n performPoll() {\n if (this.isPolling)\n return; // Prevent re-entrancy\n this.isPolling = true;\n try {\n const result = this.nativeInstance.poll();\n this.cursor = result.cursor;\n if (result.changes.length > 0 && this.currentStat) {\n // Apply deltas incrementally to local state (no full stat fetch)\n for (const change of result.changes) {\n (0, dset_1.dset)(this.currentStat, change.path, change.value);\n }\n // Emit raw deltas for listeners who want the batch\n this.emit(\"delta\", result.changes);\n // Notify individual property watchers via EventEmitter\n // Only check properties that actually changed (from C++)\n for (const change of result.changes) {\n const path = change.path;\n const watched = this.watchedProperties.get(path);\n if (watched) {\n const oldValue = watched.lastValue;\n const newValue = change.value;\n // Update lastValue\n watched.lastValue =\n typeof newValue === \"object\" && newValue !== null\n ? JSON.parse(JSON.stringify(newValue))\n : newValue;\n // Emit to listeners\n const listeners = this.rawListeners(path);\n for (const listener of listeners) {\n try {\n listener(newValue, oldValue, path);\n }\n catch (e) {\n console.error(`Error in StatChannel watch callback for ${path}:`, e);\n }\n }\n }\n }\n }\n }\n catch (e) {\n console.error(\"Error during StatChannel poll:\", e);\n }\n finally {\n this.isPolling = false;\n }\n }\n /**\n * Ensures that a property path is being tracked for changes.\n * This initializes the lastValue for comparing changes.\n */\n ensureWatched(propertyPath) {\n if (!this.watchedProperties.has(propertyPath)) {\n const initialValue = this.currentStat\n ? (0, dlv_1.default)(this.currentStat, propertyPath)\n : null;\n this.watchedProperties.set(propertyPath, {\n lastValue: typeof initialValue === \"object\" && initialValue !== null\n ? JSON.parse(JSON.stringify(initialValue))\n : initialValue,\n });\n }\n }\n on(event, listener) {\n if (event === \"delta\") {\n return super.on(event, listener);\n }\n this.ensureWatched(event);\n return super.on(event, listener);\n }\n /**\n * Registers a one-time listener for changes to a specific property path.\n * The listener will be removed after it fires once.\n * @param propertyPath A dot-separated path to the property.\n * @param listener The function to call when the property's value changes.\n * @returns this (for chaining)\n */\n once(propertyPath, listener) {\n this.ensureWatched(propertyPath);\n return super.once(propertyPath, listener);\n }\n off(event, listener) {\n if (event === \"delta\") {\n return super.off(event, listener);\n }\n const result = super.off(event, listener);\n // Clean up the watched property if no more listeners\n if (this.listenerCount(event) === 0) {\n this.watchedProperties.delete(event);\n }\n return result;\n }\n /**\n * Removes a listener for a specific property path.\n * Alias for off().\n * @param propertyPath The property path.\n * @param listener The listener function to remove.\n * @returns this (for chaining)\n */\n removeListener(propertyPath, listener) {\n return this.off(propertyPath, listener);\n }\n /**\n * Sets the polling interval for status updates.\n * @param interval The new interval in milliseconds.\n */\n setPollInterval(interval) {\n this.pollInterval = Math.max(10, interval); // Ensure a minimum interval\n this.stopPolling();\n this.startPolling();\n }\n /**\n * Gets the current polling interval.\n * @returns The interval in milliseconds.\n */\n getPollInterval() {\n return this.pollInterval;\n }\n /**\n * Retrieves the most recent full status object.\n * @returns The current LinuxCNCStat object, or null if not yet available.\n */\n get() {\n return this.currentStat;\n }\n /**\n * Forces a full resync of the stat object from native.\n * Use this if cursor gaps are detected or for initial sync scenarios.\n */\n sync() {\n this.currentStat = {};\n const result = this.nativeInstance.poll(true); // force=true gets all fields\n for (const change of result.changes) {\n (0, dset_1.dset)(this.currentStat, change.path, change.value);\n }\n this.cursor = result.cursor;\n // Update all watched property lastValues\n this.watchedProperties.forEach((watched, path) => {\n watched.lastValue = this.currentStat\n ? (0, dlv_1.default)(this.currentStat, path)\n : null;\n });\n }\n /**\n * Gets the current cursor value for sync verification.\n * The cursor increments each time the native layer detects changes.\n * @returns The current cursor value.\n */\n getCursor() {\n return this.cursor;\n }\n /**\n * Cleans up resources, stopping the polling timer.\n */\n destroy() {\n this.stopPolling();\n this.watchedProperties.clear();\n this.removeAllListeners();\n // Properly disconnect from the native NML channel\n if (this.nativeInstance) {\n this.nativeInstance.disconnect();\n }\n }\n // --- Convenience Getters for common properties ---\n // These access the locally cached `this.currentStat`\n get task() {\n return this.currentStat?.task;\n }\n get motion() {\n return this.currentStat?.motion;\n }\n get io() {\n return this.currentStat?.io;\n }\n get toolTable() {\n return this.currentStat?.toolTable;\n }\n}\nexports.StatChannel = StatChannel;\n","export enum TaskMode {\n MANUAL = 1,\n AUTO = 2,\n MDI = 3,\n}\n\nexport enum TaskState {\n ESTOP = 1,\n ESTOP_RESET = 2,\n OFF = 3,\n ON = 4,\n}\n\nexport enum ExecState {\n ERROR = 1,\n DONE = 2,\n WAITING_FOR_MOTION = 3,\n WAITING_FOR_MOTION_QUEUE = 4,\n WAITING_FOR_IO = 5,\n WAITING_FOR_MOTION_AND_IO = 7,\n WAITING_FOR_DELAY = 8,\n WAITING_FOR_SYSTEM_CMD = 9,\n WAITING_FOR_SPINDLE_ORIENTED = 10,\n}\n\nexport enum InterpState {\n IDLE = 1,\n READING = 2,\n PAUSED = 3,\n WAITING = 4,\n}\n\nexport enum StopState {\n IDLE = 0,\n STOPPING = 1,\n STOPPED = 2,\n STARTING = 3,\n}\n\nexport enum TrajMode {\n FREE = 1,\n COORD = 2,\n TELEOP = 3,\n}\n\nexport enum MotionType {\n NONE = 0,\n TRAVERSE = 1,\n FEED = 2,\n ARC = 3,\n TOOLCHANGE = 4,\n PROBING = 5,\n INDEXROTARY = 6,\n}\n\nexport enum KinematicsType {\n IDENTITY = 1,\n FORWARD_ONLY = 2,\n INVERSE_ONLY = 3,\n BOTH = 4,\n}\n\nexport enum RcsStatus {\n UNINITIALIZED = -1,\n DONE = 1,\n EXEC = 2,\n ERROR = 3,\n}\n\nexport enum ProgramUnits {\n INCH = 1,\n MM = 2,\n CM = 3,\n}\n\nexport enum NmlMessageType {\n EMC_OPERATOR_ERROR = 11,\n EMC_OPERATOR_TEXT = 12,\n EMC_OPERATOR_DISPLAY = 13,\n NML_ERROR = 1,\n NML_TEXT = 2,\n NML_DISPLAY = 3,\n}\n\nexport enum JointType {\n LINEAR = 1,\n ANGULAR = 2,\n}\n\nexport enum OrientState {\n NONE = 0,\n COMPLETE = 1,\n IN_PROGRESS = 2,\n FAULTED = 3,\n}\n\nexport enum EmcDebug {\n CONFIG = 0x00000002,\n VERSIONS = 0x00000008,\n TASK_ISSUE = 0x00000010,\n NML = 0x00000040,\n MOTION_TIME = 0x00000080,\n INTERP = 0x00000100,\n RCS = 0x00000200,\n INTERP_LIST = 0x00000800,\n IOCONTROL = 0x00001000,\n OWORD = 0x00002000,\n REMAP = 0x00004000,\n PYTHON = 0x00008000,\n NAMEDPARAM = 0x00010000,\n GDBONSIGNAL = 0x00020000,\n STATE_TAGS = 0x00080000,\n}\n","import {\n TaskMode,\n TaskState,\n ExecState,\n InterpState,\n StopState,\n TrajMode,\n MotionType,\n KinematicsType,\n ProgramUnits,\n RcsStatus,\n NmlMessageType,\n JointType,\n OrientState,\n EmcDebug,\n} from \"./constants\";\n\n/** Stride for position data in Float64Array: x, y, z, a, b, c, u, v, w, motionType */\nexport const POSITION_STRIDE = 10;\n\n/** Index constants for position logger data in Float64Array (10 elements with MotionType) */\nexport enum PositionLoggerIndex {\n X = 0,\n Y = 1,\n Z = 2,\n A = 3,\n B = 4,\n C = 5,\n U = 6,\n V = 7,\n W = 8,\n /** Motion type (used in position logging) */\n MotionType = 9,\n}\n\n/** Position array indices for readable access (9 elements) */\nexport enum PositionIndex {\n X = 0,\n Y = 1,\n Z = 2,\n A = 3,\n B = 4,\n C = 5,\n U = 6,\n V = 7,\n W = 8,\n}\n\n/**\n * Position and orientation in the LinuxCNC coordinate system.\n * Represents a pose with 9 degrees of freedom (3 linear + 3 rotational + 3 auxiliary).\n * All values are in machine units.\n *\n * This is a Float64Array with 9 elements - use PositionIndex enum for access:\n * - [0] x: X-axis position\n * - [1] y: Y-axis position\n * - [2] z: Z-axis position\n * - [3] a: A-axis rotation around X-axis in degrees\n * - [4] b: B-axis rotation around Y-axis in degrees\n * - [5] c: C-axis rotation around Z-axis in degrees\n * - [6] u: U-axis auxiliary linear position\n * - [7] v: V-axis auxiliary linear position\n * - [8] w: W-axis auxiliary linear position\n */\nexport type Position = Float64Array;\n\n/**\n * 3D position in the LinuxCNC coordinate system.\n * Represents a point with 3 degrees of freedom (x, y, z).\n *\n * This is a Float64Array with 3 elements:\n * - [0] x: X-axis position\n * - [1] y: Y-axis position\n * - [2] z: Z-axis position\n */\nexport type Position3 = Float64Array;\n\n/**\n * Tool table entry representing a cutting tool in the LinuxCNC system.\n * Each tool has physical properties, position offset, and is assigned to a specific pocket.\n */\nexport interface ToolEntry {\n /**\n * Tool number identifier.\n * Use 0 to indicate no tool (notool).\n */\n toolNo: number;\n\n /**\n * Pocket number in the tool carousel, ranging from 0 to CANON_POCKETS_MAX-1 (default LinuxCNC build: 0-1000).\n * Pocket 0 represents the spindle position.\n */\n pocketNo: number;\n\n /** Position offset for the tool relative to the machine coordinate system. */\n offset: Position;\n\n /** Tool diameter in machine units. Used for cutter compensation calculations. */\n diameter: number;\n\n /** Front angle of the tool in degrees. Used for lathe tooling geometry. */\n frontAngle: number;\n\n /** Back angle of the tool in degrees. Used for lathe tooling geometry. */\n backAngle: number;\n\n /** Tool orientation code. Integer value defining the tool's cutting orientation. Used for lathe tooling geometry */\n orientation: number;\n\n /**\n * Comment for the tool.\n * In default LinuxCNC build, maximum length is 39 characters (CANON_TOOL_COMMENT_SIZE - 1 for null terminator).\n */\n comment: string;\n}\n\n/**\n * Active G-codes for each modal group in the LinuxCNC interpreter.\n * Each property represents the currently active G-code from its respective modal group.\n * Integer values reflect the nominal G-code numbers multiplied by 10.\n * (Examples: 10 = G1, 430 = G43, 923 = G92.3)\n */\nexport interface ActiveGCodes {\n /**\n * Modal Group 0 - Non-modal codes.\n * G4 (dwell), G10 (coordinate system), G28/G30 (reference return),\n * G52 (local coordinate system), G53 (machine coordinates),\n * G92/G92.1/G92.2/G92.3 (coordinate system offset).\n * Note: Group 0 codes are not modal and taken from the current block.\n */\n\n gMode0: number;\n /**\n * Modal Group 1 - Motion commands.\n * G0 (rapid), G1 (linear), G2 (CW arc), G3 (CCW arc), G33 (spindle synchronized),\n * G38.n (probe variations), G73 (drilling with chip break), G76 (threading),\n * G80 (cancel canned cycle), G81-G89 (canned cycles).\n */\n motionMode: number;\n\n /**\n * Modal Group 2 - Plane selection.\n * G17 (XY plane), G18 (XZ plane), G19 (YZ plane),\n * G17.1 (UV plane), G18.1 (UW plane), G19.1 (VW plane).\n */\n plane: number;\n\n /**\n * Modal Group 3 - Distance mode.\n * G90 (absolute distance), G91 (incremental distance).\n */\n distanceMode: number;\n\n /**\n * Modal Group 4 - Arc IJK distance mode.\n * G90.1 (absolute IJK), G91.1 (incremental IJK).\n */\n ijkDistanceMode: number;\n\n /**\n * Modal Group 5 - Feed rate mode.\n * G93 (inverse time), G94 (units per minute), G95 (units per revolution).\n */\n feedRateMode: number;\n\n /**\n * Modal Group 6 - Units.\n * G20 (inches), G21 (millimeters).\n */\n units: number;\n\n /**\n * Modal Group 7 - Cutter compensation.\n * G40 (cancel compensation), G41 (left compensation), G42 (right compensation),\n * G41.1 (dynamic left compensation), G42.1 (dynamic right compensation).\n */\n cutterComp: number;\n\n /**\n * Modal Group 8 - Tool length offset.\n * G43 (tool length offset), G43.1 (dynamic tool length offset), G49 (cancel tool length offset).\n */\n toolLengthOffset: number;\n\n /**\n * Modal Group 10 - Canned cycles return mode.\n * G98 (return to initial level), G99 (return to R level).\n */\n retractMode: number;\n\n /**\n * Modal Group 12 - Coordinate system selection.\n * G54-G59, G59.1-G59.3 (coordinate system origins).\n */\n origin: number;\n\n /**\n * Modal Group 13 - Path control mode.\n * G61 (exact path), G61.1 (exact stop), G64 (continuous path with optional tolerance).\n */\n pathControl: number;\n\n /**\n * Modal Group 14 - Spindle speed mode.\n * G96 (constant surface speed), G97 (constant RPM).\n */\n spindleSpeedMode: number;\n\n /**\n * Modal Group 15 - Lathe diameter mode.\n * G7 (lathe diameter mode), G8 (lathe radius mode).\n */\n latheDiameterMode: number;\n\n /**\n * G92 coordinate system offset applied state.\n * G92.2 (suspend G92 offsets), G92.3 (restore suspended G92 offsets).\n */\n g92Applied: number;\n}\n\n/**\n * Active M-codes for each modal group in the LinuxCNC interpreter.\n * Each property represents the currently active M-code from its respective modal group.\n * Integer values reflect the nominal M-code numbers.\n */\nexport interface ActiveMCodes {\n /**\n * Modal Group 4 - Stopping commands.\n * M0 (program pause), M1 (optional pause), M2 (program end),\n * M30 (program end with rewind), M60 (pallet change pause).\n */\n stopping: number;\n\n /**\n * Modal Group 6 - Tool change.\n * M6 (tool change), optionally followed by Tn (tool number).\n */\n toolChange: number;\n\n /**\n * Modal Group 7 - Spindle control.\n * M3 (spindle clockwise), M4 (spindle counterclockwise), M5 (spindle stop).\n */\n spindleControl: number;\n\n /**\n * Modal Group 8 - Coolant control (mist).\n * M7 (mist coolant on), M9 (all coolant off).\n * Note: M7 and M8 can both be active simultaneously.\n */\n mistCoolant: number;\n\n /**\n * Modal Group 8 - Coolant control (flood).\n * M8 (flood coolant on), M9 (all coolant off).\n * Note: M7 and M8 can both be active simultaneously.\n */\n floodCoolant: number;\n\n /**\n * Modal Group 9 - Override switches.\n * M48 (enable speed and feed overrides), M49 (disable speed and feed overrides).\n */\n overrideControl: number;\n\n /**\n * Adaptive feed control.\n * M52 (adaptive feed control).\n */\n adaptiveFeedControl: number;\n\n /**\n * Feed hold control.\n * M53 (feed hold control).\n */\n feedHoldControl: number;\n}\n\n/**\n * Current interpreter settings from the LinuxCNC system.\n * These values correspond to the settings tuple returned by the interpreter.\n */\nexport interface ActiveSettings {\n /**\n * Current feed rate setting.\n * Corresponds to settings[1] in the interpreter settings tuple.\n */\n feedRate: number;\n\n /**\n * Current spindle speed setting.\n * Corresponds to settings[2] in the interpreter settings tuple.\n */\n speed: number;\n\n /**\n * G64 P blend tolerance setting.\n * Controls path blending tolerance for continuous path mode (G64).\n * Corresponds to settings[3] in the interpreter settings tuple.\n */\n blendTolerance: number;\n\n /**\n * G64 Q naive CAM tolerance setting.\n * Controls naive CAM tolerance for continuous path mode (G64).\n * Corresponds to settings[4] in the interpreter settings tuple.\n */\n naiveCAMTolerance: number;\n}\n\n/**\n * Task status information from the LinuxCNC system.\n * Contains information about the current state of task execution, interpreter state, and active program.\n */\nexport interface TaskStat {\n /** Current task mode. One of MDI, AUTO, MANUAL. */\n mode: TaskMode;\n\n /** Current task state. One of ESTOP, ESTOP_RESET, ON, OFF. */\n state: TaskState;\n\n /** Task execution state. One of ERROR, DONE, WAITING_FOR_MOTION, etc. */\n execState: ExecState;\n\n /** Current state of RS274NGC interpreter. One of IDLE, READING, PAUSED, WAITING. */\n interpState: InterpState;\n\n /** State of the resumable Stop operation. */\n stopState: StopState;\n\n /** Current subroutine depth. 0 if not in a subroutine. */\n callLevel: number;\n\n /** Source line number motion is currently executing. */\n motionLine: number;\n\n /** Currently executing line number. */\n currentLine: number;\n\n /** Line the RS274NGC interpreter is currently reading. */\n readLine: number;\n\n /** Optional stop current status flag. */\n optionalStopState: boolean;\n\n /** Block delete current status flag. */\n blockDeleteState: boolean;\n\n /** Flag indicating M66 timer is in progress. */\n inputTimeout: boolean;\n\n /** Currently loaded G-code filename with path. */\n file: string;\n\n /** Currently executing command. */\n command: string;\n\n /** Path to the INI file passed to LinuxCNC. */\n iniFilename: string;\n\n /** Offset of the currently active coordinate system (G54-G59, etc.). */\n g5xOffset: Position;\n\n /** Currently active coordinate system index. G54=1, G55=2, etc. */\n g5xIndex: number;\n\n /**\n * Offsets of all nine G5x coordinate systems (G54-G59.3) from the interpreter.\n * Index 0 is G54, index 8 is G59.3. Values are in user units.\n */\n g5xOffsets: Position[];\n\n /**\n * XY rotation angles of all nine G5x coordinate systems (G54-G59.3) in degrees.\n * Index 0 is G54, index 8 is G59.3.\n */\n g5xRotations: number[];\n\n /** Pose of the current G92 offset. */\n g92Offset: Position;\n\n /** G28 home position in user units. */\n g28Position: Position;\n\n /** G30 home position in user units. */\n g30Position: Position;\n\n /** Current XY rotation angle around Z axis in degrees. */\n rotationXY: number;\n\n /** Offset values of the current tool. */\n toolOffset: Position;\n\n /** Currently active G-codes for each modal group. */\n activeGCodes: ActiveGCodes;\n\n /** Currently active M-codes for each modal group. */\n activeMCodes: ActiveMCodes;\n\n /** Current interpreter settings (feed rate, speed, tolerances). */\n activeSettings: ActiveSettings;\n\n /** Current program units. One of INCH, MM, CM. */\n programUnits: ProgramUnits;\n\n /** Current RS274NGC interpreter error code. */\n interpreterErrorCode: number;\n\n /** Task paused flag. */\n taskPaused: boolean;\n\n /** Remaining time on dwell (G4) command in seconds. */\n delayLeft: number;\n\n /** Number of queued MDI commands. */\n queuedMdiCommands: number;\n\n}\n\n/**\n * Joint status information for a single joint in the LinuxCNC system.\n * Each joint has various properties related to position, limits, errors, and state.\n */\nexport interface JointStat {\n /** Type of axis configuration. LINEAR=1, ANGULAR=2. Reflects [JOINT_n]TYPE configuration parameter. */\n jointType: JointType;\n\n /** Joint units per mm, or per degree for angular joints. Joint units are the same as machine units, unless set otherwise by [JOINT_n]UNITS configuration parameter. */\n units: number;\n\n /** Backlash in machine units. Configuration parameter, reflects [JOINT_n]BACKLASH. */\n backlash: number;\n\n /** Minimum limit (soft limit) for joint motion, in machine units. Configuration parameter, reflects [JOINT_n]MIN_LIMIT. */\n minPositionLimit: number;\n\n /** Maximum limit (soft limit) for joint motion, in machine units. Configuration parameter, reflects [JOINT_n]MAX_LIMIT. */\n maxPositionLimit: number;\n\n /** Minimum following error. Configuration parameter, reflects [JOINT_n]MIN_FERROR. */\n minFerror: number;\n\n /** Maximum following error. Configuration parameter, reflects [JOINT_n]FERROR. */\n maxFerror: number;\n\n /** Current following error. */\n ferrorCurrent: number;\n\n /** Magnitude of maximum following error encountered. */\n ferrorHighMark: number;\n\n /** Commanded output position. */\n output: number; // commanded position\n\n /** Current input position (actual position). */\n input: number; // actual position\n\n /** Current velocity. */\n velocity: number;\n\n /** True when joint is in position. */\n inPosition: boolean;\n\n /** True when homing is in progress. */\n homing: boolean;\n\n /** True when joint has been homed. */\n homed: boolean;\n\n /** True when axis amplifier fault is present. */\n fault: boolean;\n\n /** True when joint is enabled. */\n enabled: boolean;\n\n /** True when minimum soft limit was exceeded. */\n minSoftLimit: boolean;\n\n /** True when maximum soft limit was exceeded. */\n maxSoftLimit: boolean;\n\n /** True when minimum hard limit is exceeded. */\n minHardLimit: boolean;\n\n /** True when maximum hard limit is exceeded. */\n maxHardLimit: boolean;\n\n /** True when limits are overridden. */\n overrideLimits: boolean;\n}\n\n/**\n * Axis status information for a single axis in the LinuxCNC system.\n * Note: Many properties that were formerly in the axis dictionary are now in the joint dictionary,\n * because on nontrivial kinematics machines these items (such as backlash) are properties of joints, not axes.\n */\nexport interface AxisStat {\n /**\n * Minimum limit (soft limit) for axis motion, in machine units.\n * Configuration parameter, reflects [JOINT_n]MIN_LIMIT.\n */\n minPositionLimit: number;\n\n /**\n * Maximum limit (soft limit) for axis motion, in machine units.\n * Configuration parameter, reflects [JOINT_n]MAX_LIMIT.\n */\n maxPositionLimit: number;\n\n /** Current velocity of the axis. */\n velocity: number;\n}\n\n/**\n * Spindle status information for a spindle in the LinuxCNC system.\n * Contains information about spindle speed, direction, state, and control parameters.\n */\nexport interface SpindleStat {\n /**\n * Spindle speed value in RPM.\n * Positive values indicate clockwise rotation, negative values indicate counterclockwise.\n * With G96 active, this reflects the maximum speed set by the optional G96 D-word\n * or, if the D-word was missing, the default values +/-1e30.\n */\n speed: number;\n\n /**\n * Signed spindle speed feedback from `spindle.N.speed-in`, converted to RPM.\n */\n feedback: number;\n\n /** Spindle speed override scale as a floating point value. 1.0 for 100% override */\n override: number;\n\n /**\n * Maximum spindle speed in RPM used by Constant Surface Speed (CSS / G96).\n * Set by the G96 D-word.\n */\n cssMaximum: number;\n\n /**\n * CSS factor used to convert surface speed to spindle RPM.\n */\n cssFactor: number;\n\n /**\n * Rotational direction of the spindle.\n * - `1`: Forward (clockwise)\n * - `0`: Off (stopped)\n * - `-1`: Reverse (counterclockwise)\n */\n direction: -1 | 0 | 1;\n\n /** Value of the spindle brake flag. True when brake is engaged. */\n brake: boolean;\n\n /**\n * Spindle speed change state.\n * - `1`: Increasing\n * - `0`: None (steady)\n * - `-1`: Decreasing\n */\n increasing: -1 | 0 | 1;\n\n /** Value of the spindle enabled flag. True when spindle is enabled. */\n enabled: boolean;\n\n /** Current spindle orientation state. */\n orientState: OrientState;\n\n /** Fault code from motion.spindle-orient-fault. */\n orientFault: number;\n\n /** Value of the spindle override enabled flag. True when override is enabled. */\n spindleOverrideEnabled: boolean;\n\n /** Spindle homed status (not currently implemented). */\n homed: boolean;\n}\n\n/**\n * Trajectory status information from the LinuxCNC motion controller.\n * Contains information about motion planning, current position, velocity, and trajectory execution state.\n */\nexport interface TrajectoryStat {\n /** Machine linear units per mm. Reflects [TRAJ]LINEAR_UNITS INI value. */\n linearUnits: number;\n\n /** Machine angular units per degree. Reflects [TRAJ]ANGULAR_UNITS INI value. */\n angularUnits: number;\n\n /** Thread period in seconds. */\n cycleTime: number;\n\n /** Number of joints configured. Reflects [KINS]JOINTS INI value. */\n joints: number;\n\n /** Number of spindles configured. Reflects [TRAJ]SPINDLES INI value. */\n spindles: number;\n\n /** Available axes as defined by [TRAJ]COORDINATES in the INI file. */\n availableAxes: (\"X\" | \"Y\" | \"Z\" | \"A\" | \"B\" | \"C\" | \"U\" | \"V\" | \"W\")[];\n\n /** Mode of the Motion controller. One of COORD, FREE, TELEOP. */\n mode: TrajMode;\n\n /** Trajectory planner enabled flag. */\n enabled: boolean;\n\n /** Machine-in-position flag. */\n inPosition: boolean;\n\n /** Current size of the trajectory planner queue. */\n queue: number;\n\n /** Number of motions blending. */\n activeQueue: number;\n\n /** Flag indicating if the trajectory planner queue is full. */\n queueFull: boolean;\n\n /** Currently executing motion ID. */\n id: number;\n\n /** Motion paused flag. */\n paused: boolean;\n\n /** True while motion is single stepping. */\n singleStepping: boolean;\n\n /** Current feedrate override scale (1.0 = 100%). */\n feedRateOverride: number;\n\n /** Current rapid override scale (1.0 = 100%). */\n rapidRateOverride: number;\n\n /** Commanded trajectory position in machine units. */\n position: Position;\n\n /** Current actual trajectory position in machine units. */\n actualPosition: Position;\n\n /** Default acceleration. Reflects [TRAJ]DEFAULT_ACCELERATION INI entry. */\n acceleration: number;\n\n /** Maximum velocity. Reflects [TRAJ]MAX_VELOCITY or current limit set by halui.max-velocity. */\n maxVelocity: number;\n\n /** Maximum acceleration. Reflects [TRAJ]MAX_ACCELERATION. */\n maxAcceleration: number;\n\n /** Position where probe tripped in machine units. */\n probedPosition: Position;\n\n /** Flag indicating if probe has tripped (latch). */\n probeTripped: boolean;\n\n /** Flag indicating if a probe operation is in progress. */\n probing: boolean;\n\n /** Value of the motion.probe-input pin (typically 0 or 1). */\n probeVal: number;\n\n /** Type of kinematics. One of IDENTITY, FORWARD_ONLY, INVERSE_ONLY, BOTH. */\n kinematicsType: KinematicsType;\n\n /** Type of currently executing motion. One of TRAVERSE, FEED, ARC, etc., or NONE if no motion. */\n motionType: MotionType;\n\n /** Remaining distance of current move as reported by trajectory planner. */\n distanceToGo: number;\n\n /** Remaining distance of current move for each axis as reported by trajectory planner. */\n dtg: Position;\n\n /** Current velocity in user units per second. */\n currentVelocity: number;\n\n /** Enable flag for feed override. */\n feedOverrideEnabled: boolean;\n\n /** Status of adaptive feedrate override. */\n adaptiveFeedEnabled: boolean;\n\n /** Enable flag for feed hold. */\n feedHoldEnabled: boolean;\n}\n\n/**\n * Tool-related I/O status information.\n * Contains information about tool changes and current tool state.\n */\nexport interface ToolIoStat {\n /** Pocket number that is prepared for tool change. -1 if no prepared pocket. */\n pocketPrepped: number;\n\n /** Current tool number loaded in spindle. 0 if no tool loaded. */\n toolInSpindle: number;\n\n /** Pocket number for the currently loaded tool. 0 if no tool loaded. */\n toolFromPocket: number;\n // toolTable is part of the root LinuxCNCStat for direct access\n}\n\n/**\n * Coolant system status information.\n * Contains the state of mist and flood coolant systems.\n */\nexport interface CoolantIoStat {\n /** Mist coolant status. True when mist is on (M7). */\n mist: boolean;\n\n /** Flood coolant status. True when flood is on (M8). */\n flood: boolean;\n}\n\n/**\n * Motion system status information.\n * Contains comprehensive status of trajectory planning, joints, axes, spindles, and I/O.\n */\nexport interface MotionStat {\n /** Trajectory planner status and motion execution information. */\n traj: TrajectoryStat;\n\n /** Array of joint status information. Length matches EMCMOT_MAX_JOINTS. */\n joint: JointStat[];\n\n /** Array of axis status information. Length matches EMCMOT_MAX_AXIS. */\n axis: AxisStat[];\n\n /** Array of spindle status information. Length matches EMCMOT_MAX_SPINDLES. */\n spindle: SpindleStat[];\n\n /** Current state of digital input pins. */\n digitalInput: number[];\n\n /** Current state of digital output pins. */\n digitalOutput: number[];\n\n /** Current values of analog input pins. */\n analogInput: number[];\n\n /** Current values of analog output pins. */\n analogOutput: number[];\n}\n\n/**\n * I/O system status information.\n * Contains status of tools, coolant, and emergency stop systems.\n */\nexport interface IoStat {\n /** Tool-related I/O status. */\n tool: ToolIoStat;\n\n /** Coolant system status. */\n coolant: CoolantIoStat;\n\n /** Emergency stop status. True when in E-stop state. */\n estop: boolean;\n}\n\n/**\n * Complete LinuxCNC system status.\n * This is the main status structure containing all subsystem states and information.\n */\nexport interface LinuxCNCStat {\n /** Serial number of the last completed command sent by UI to task. */\n echoSerialNumber: number;\n\n /** Overall status of the NML update. One of DONE, EXEC, ERROR. */\n state: RcsStatus;\n\n /** Task subsystem status including interpreter and program execution state. */\n task: TaskStat;\n\n /** Motion subsystem status including trajectory, joints, axes, and spindles. */\n motion: MotionStat;\n\n /** I/O subsystem status including tools, coolant, and emergency stop. */\n io: IoStat;\n\n /** Top-level debug flags from the INI file. */\n debug: number;\n\n /** Complete tool table with all tool entries and their properties. */\n toolTable: ToolEntry[];\n}\n\n/**\n * LinuxCNC error message structure.\n * Contains error information from the LinuxCNC system.\n */\nexport interface LinuxCNCError {\n /** Type of NML message that generated this error. */\n type: NmlMessageType;\n\n /** Human-readable error message text. */\n message: string;\n}\n\nexport type DebugFlags = EmcDebug;\n\n// utility type to generate string paths for nested objects\ntype NestedPaths<T, K extends keyof T = keyof T> = K extends string\n ? T[K] extends object\n ? T[K] extends readonly (infer U)[]\n ? U extends object\n ? `${K}` | `${K}.${number}` | `${K}.${number}.${NestedPaths<U>}`\n : `${K}` | `${K}.${number}`\n : `${K}` | `${K}.${NestedPaths<T[K]>}`\n : `${K}`\n : never;\n\n// Type-safe property paths for LinuxCNCStat (dot-separated string paths)\nexport type LinuxCNCStatPaths = NestedPaths<LinuxCNCStat>;\n\n// Utility type to get the type of a property from a dot-separated path\ntype GetPropertyType<T, P extends string> = P extends keyof T\n ? T[P]\n : P extends `${infer K}.${infer R}`\n ? K extends keyof T\n ? T[K] extends readonly (infer U)[]\n ? R extends `${number}`\n ? U\n : R extends `${number}.${infer Rest}`\n ? GetPropertyType<U, Rest>\n : never\n : GetPropertyType<T[K], R>\n : never\n : never;\n\n// Utility type for recursively making all properties optional\nexport type RecursivePartial<T> = {\n [P in keyof T]?: T[P] extends (infer U)[]\n ? RecursivePartial<U>[]\n : T[P] extends object\n ? RecursivePartial<T[P]>\n : T[P];\n};\n\n// Callback types\nexport type StatPropertyWatchCallback<P extends LinuxCNCStatPaths> = (\n newValue: GetPropertyType<LinuxCNCStat, P>,\n oldValue: GetPropertyType<LinuxCNCStat, P> | null,\n propertyPath: P\n) => void;\n\nexport type ErrorCallback = (error: LinuxCNCError) => void;\n\n/**\n * A single stat change entry with the path and its correctly typed value.\n * This is a discriminated union that maps each path to its proper value type.\n */\nexport type StatChange = {\n [P in LinuxCNCStatPaths]: {\n /** Dot-separated path to the changed property */\n path: P;\n /** New value of the property */\n value: GetPropertyType<LinuxCNCStat, P>;\n };\n}[LinuxCNCStatPaths];\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n//# sourceMappingURL=command.js.map","/**\n * G-Code Parser Types\n *\n * Defines all TypeScript interfaces for G-code operations parsed by the\n * LinuxCNC rs274ngc interpreter.\n */\n\nimport { ProgramUnits } from \"./constants\";\nimport { Position, Position3 } from \"./core\";\n\n// ============================================================================\n// Enums\n// ============================================================================\n\n/**\n * Types of operations that can be parsed from G-code.\n */\nexport enum OperationType {\n // Motion operations\n TRAVERSE = 1,\n FEED = 2,\n ARC = 3,\n PROBE = 4,\n RIGID_TAP = 5,\n DWELL = 6,\n NURBS_G5 = 7,\n NURBS_G6 = 8,\n\n // State change operations\n UNITS_CHANGE = 10,\n PLANE_CHANGE = 11,\n G5X_OFFSET = 12,\n G92_OFFSET = 13,\n XY_ROTATION = 14,\n TOOL_OFFSET = 15,\n TOOL_CHANGE = 16,\n FEED_RATE_CHANGE = 17,\n}\n\n/**\n * Plane selection for arc and NURBS operations.\n */\nexport enum Plane {\n XY = 1,\n YZ = 2,\n XZ = 3,\n UV = 4,\n VW = 5,\n UW = 6,\n}\n\n// ============================================================================\n// Motion Operations\n// ============================================================================\n\n/**\n * G0 rapid traverse motion.\n */\nexport interface TraverseOperation {\n type: OperationType.TRAVERSE;\n /** Source G-code line number */\n lineNumber: number;\n /** Target position */\n pos: Position;\n}\n\n/**\n * G1 linear feed motion.\n */\nexport interface FeedOperation {\n type: OperationType.FEED;\n /** Source G-code line number */\n lineNumber: number;\n /** Target position */\n pos: Position;\n}\n\n/**\n * G2/G3 arc motion.\n * Arc data is provided for reconstruction without tessellation.\n */\nexport interface ArcOperation {\n type: OperationType.ARC;\n /** Source G-code line number */\n lineNumber: number;\n /** Target position */\n pos: Position;\n /** Plane in which the arc lies */\n plane: Plane;\n /** Arc geometry data for reconstruction */\n arcData: {\n /** Center coordinate on the first axis of the plane (e.g., X for XY plane) */\n centerFirst: number;\n /** Center coordinate on the second axis of the plane (e.g., Y for XY plane) */\n centerSecond: number;\n /**\n * Rotation direction and count.\n * Positive = CCW (G3), Negative = CW (G2).\n * Magnitude > 1 indicates multiple full turns.\n */\n rotation: number;\n /** End point on the axis perpendicular to the plane (helix axis) */\n axisEndPoint: number;\n };\n}\n\n/**\n * G38.x probe motion.\n */\nexport interface ProbeOperation {\n type: OperationType.PROBE;\n /** Source G-code line number */\n lineNumber: number;\n /** Target probe position */\n pos: Position;\n}\n\n/**\n * G33.1 rigid tapping motion.\n */\nexport interface RigidTapOperation {\n type: OperationType.RIGID_TAP;\n /** Source G-code line number */\n lineNumber: number;\n /** Target tap position as Position3: [x, y, z] */\n pos: Position3;\n /** Tap scale factor */\n scale: number;\n}\n\n/**\n * G4 dwell (pause) operation.\n */\nexport interface DwellOperation {\n type: OperationType.DWELL;\n /** Position where dwell occurs */\n pos: Position;\n /** Dwell duration in seconds */\n duration: number;\n /** Current plane at time of dwell */\n plane: Plane;\n}\n\n/**\n * G5 NURBS (non-rational B-spline) feed motion.\n */\nexport interface NurbsG5Operation {\n type: OperationType.NURBS_G5;\n /** Source G-code line number */\n lineNumber: number;\n /** Target position */\n pos: Position;\n /** Plane in which the NURBS curve lies */\n plane: Plane;\n /** NURBS curve data */\n nurbsData: {\n /** B-spline order */\n order: number;\n /** Control points with weights */\n controlPoints: Array<{\n x: number;\n y: number;\n weight: number;\n }>;\n };\n}\n\n/**\n * G6 NURBS (rational B-spline with knots) feed motion.\n */\nexport interface NurbsG6Operation {\n type: OperationType.NURBS_G6;\n /** Source G-code line number */\n lineNumber: number;\n /** Target position */\n pos: Position;\n /** Plane in which the NURBS curve lies */\n plane: Plane;\n /** NURBS curve data */\n nurbsData: {\n /** B-spline order */\n order: number;\n /** Control points with R and K values */\n controlPoints: Array<{\n x: number;\n y: number;\n /** R value from G-code */\n r: number;\n /** Knot parameter */\n k: number;\n }>;\n };\n}\n\n// ============================================================================\n// State Change Operations\n// ============================================================================\n\n/**\n * G20/G21 units change operation.\n */\nexport interface UnitsChangeOperation {\n type: OperationType.UNITS_CHANGE;\n /** New active units */\n units: ProgramUnits;\n}\n\n/**\n * G17/G18/G19 plane change operation.\n */\nexport interface PlaneChangeOperation {\n type: OperationType.PLANE_CHANGE;\n /** New active plane */\n plane: Plane;\n}\n\n/**\n * G54-G59.3 coordinate system offset change.\n */\nexport interface G5xOffsetOperation {\n type: OperationType.G5X_OFFSET;\n /** Coordinate system origin index (1=G54, 2=G55, ..., 9=G59.3) */\n origin: number;\n /** Offset values */\n offset: Position;\n}\n\n/**\n * G92 coordinate offset change.\n */\nexport interface G92OffsetOperation {\n type: OperationType.G92_OFFSET;\n /** Offset values */\n offset: Position;\n}\n\n/**\n * XY plane rotation change (from G10 L2 R...).\n */\nexport interface XYRotationOperation {\n type: OperationType.XY_ROTATION;\n /** Rotation angle in degrees */\n rotation: number;\n}\n\n/**\n * G43/G49 tool length offset change.\n */\nexport interface ToolOffsetOperation {\n type: OperationType.TOOL_OFFSET;\n /** Tool offset values */\n offset: Position;\n}\n\n/**\n * M6 tool change operation with complete tool data.\n */\nexport interface ToolChangeOperation {\n type: OperationType.TOOL_CHANGE;\n /** Tool number to change to */\n toolNumber: number;\n}\n\n/**\n * Feed rate change (F word).\n */\nexport interface FeedRateChangeOperation {\n type: OperationType.FEED_RATE_CHANGE;\n /** New feed rate in current units per minute */\n feedRate: number;\n}\n\n// ============================================================================\n// Union Types\n// ============================================================================\n\n/**\n * Union of all possible G-code operations.\n */\nexport type GCodeOperation =\n | TraverseOperation\n | FeedOperation\n | ArcOperation\n | ProbeOperation\n | RigidTapOperation\n | DwellOperation\n | NurbsG5Operation\n | NurbsG6Operation\n | UnitsChangeOperation\n | PlaneChangeOperation\n | G5xOffsetOperation\n | G92OffsetOperation\n | XYRotationOperation\n | ToolOffsetOperation\n | ToolChangeOperation\n | FeedRateChangeOperation;\n\n// ============================================================================\n// Result Types\n// ============================================================================\n\n/**\n * Bounding box extents of the parsed G-code program.\n * Min/max stored as Float64Array(3): [x, y, z]\n */\nexport interface Extents {\n /** Minimum coordinates encountered as Position3: [x, y, z] */\n min: Position3;\n /** Maximum coordinates encountered as Position3: [x, y, z] */\n max: Position3;\n}\n\n/**\n * Complete result from parsing a G-code file.\n */\nexport interface GCodeParseResult {\n /** Sequential list of operations in execution order */\n operations: GCodeOperation[];\n /** Bounding box of all motion operations */\n extents: Extents;\n}\n\n/**\n * Progress information reported during parsing.\n */\nexport interface ParseProgress {\n /** Number of bytes read from the file */\n bytesRead: number;\n /** Total file size in bytes */\n totalBytes: number;\n /** Percentage complete (0-100) */\n percent: number;\n /** Number of operations parsed so far */\n operationCount: number;\n}\n\n/**\n * Options for parsing a G-code file.\n */\nexport interface ParseOptions {\n /** Path to LinuxCNC INI file (required) */\n iniPath: string;\n /** Progress callback, called periodically during parsing */\n onProgress?: (progress: ParseProgress) => void;\n /**\n * Target number of progress updates during parsing.\n * The actual interval is calculated based on file size to achieve\n * approximately this many updates. Default is 40.\n * Set to 0 to disable progress callbacks entirely.\n * @default 40\n */\n progressUpdates?: number;\n}\n","// LinuxCNC Node.js bindings type definitions\n\nexport * from \"./constants\";\nexport * from \"./core\";\nexport * from \"./command\";\nexport * from \"./hal\";\nexport * from \"./gcode\";\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CommandChannel = void 0;\nconst constants_1 = require(\"./constants\");\nconst types_1 = require(\"@linuxcnc-node/types\");\n/**\n * Command API that resolves each async command after LinuxCNC reports\n * completion. Use CommandTransport when you need raw sent-command acceptance\n * and optional completion tracking.\n */\nclass CommandChannel {\n constructor() {\n this.nativeInstance = new constants_1.addon.NativeCommandChannel();\n }\n async exec(cmdFunc, ...args) {\n try {\n const status = await cmdFunc.apply(this.nativeInstance, args);\n if (status !== types_1.RcsStatus.DONE && status !== types_1.RcsStatus.EXEC) {\n // EXEC can be ok for some commands that take time\n // Consider if specific commands expect EXEC or only DONE\n // For now, any non-DONE/non-EXEC is potentially an issue to warn about or handle\n throw new Error(`Command failed with RCS status: ${types_1.RcsStatus[status] || status}`);\n }\n return status;\n }\n catch (e) {\n // Native NAPI methods reject promises for async errors\n throw new Error(`Command native execution failed: ${e.message || e}`);\n }\n }\n // --- Task Commands ---\n /**\n * Sets the task execution mode for LinuxCNC\n *\n * @param mode - The task mode to set (MDI, MANUAL, or AUTO)\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Switch to MDI mode for manual data input\n * await commandChannel.setTaskMode(TaskMode.MDI);\n *\n * // Switch to manual mode for jogging\n * await commandChannel.setTaskMode(TaskMode.MANUAL);\n *\n * // Switch to auto mode for program execution\n * await commandChannel.setTaskMode(TaskMode.AUTO);\n * ```\n */\n async setTaskMode(mode) {\n return this.exec(this.nativeInstance.setTaskMode, mode);\n }\n /**\n * Sets the task state for LinuxCNC\n *\n * @param state - The task state to set (ESTOP, ESTOP_RESET, OFF, or ON)\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Enable E-stop\n * await commandChannel.setState(TaskState.ESTOP);\n *\n * // Reset E-stop\n * await commandChannel.setState(TaskState.ESTOP_RESET);\n *\n * // Turn machine on\n * await commandChannel.setState(TaskState.ON);\n * ```\n */\n async setState(state) {\n return this.exec(this.nativeInstance.setState, state);\n }\n /**\n * On completion of this call, the VAR file on disk is updated with live values from the interpreter.\n *\n * @returns Promise resolving to RcsStatus indicating command completion\n */\n async taskPlanSynch() {\n return this.exec(this.nativeInstance.taskPlanSynch);\n }\n /**\n * Resets the G-code interpreter\n *\n * @returns Promise resolving to RcsStatus indicating command completion\n */\n async resetInterpreter() {\n return this.exec(this.nativeInstance.resetInterpreter);\n }\n /**\n * Opens a G-code program file for execution\n *\n * @param filePath - Absolute path to the G-code file to open\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Open a G-code program\n * await commandChannel.programOpen('/home/user/programs/part.ngc');\n * ```\n */\n async programOpen(filePath) {\n return this.exec(this.nativeInstance.programOpen, filePath);\n }\n /**\n * Closes the currently loaded G-code program\n *\n * @returns Promise resolving to RcsStatus indicating command completion\n */\n async programClose() {\n return this.exec(this.nativeInstance.programClose);\n }\n /**\n * Runs the currently loaded G-code program\n *\n * @param startLine - Line number to start execution from (default: 0 for beginning)\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Run program from the beginning\n * await commandChannel.runProgram();\n *\n * // Run program starting from line 100\n * await commandChannel.runProgram(100);\n * ```\n */\n async runProgram(startLine = 0) {\n return this.exec(this.nativeInstance.runProgram, startLine);\n }\n /**\n * Pauses the currently running G-code program\n * Program can be resumed with resumeProgram()\n *\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Pause the running program\n * await commandChannel.pauseProgram();\n * ```\n */\n async pauseProgram() {\n return this.exec(this.nativeInstance.pauseProgram);\n }\n /**\n * Resumes a paused G-code program\n *\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Resume the paused program\n * await commandChannel.resumeProgram();\n * ```\n */\n async resumeProgram() {\n return this.exec(this.nativeInstance.resumeProgram);\n }\n /**\n * Executes a single step of the G-code program\n * Advances program execution by one line/block\n *\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Step through program one line at a time\n * await commandChannel.stepProgram();\n * ```\n */\n async stepProgram() {\n return this.exec(this.nativeInstance.stepProgram);\n }\n /**\n * Reverses program execution direction\n * Used for backing up through a program\n *\n * @returns Promise resolving to RcsStatus indicating command completion\n */\n async reverseProgram() {\n return this.exec(this.nativeInstance.reverseProgram);\n }\n /**\n * Sets program execution direction to forward\n * Used after reversing to resume normal forward execution\n *\n * @returns Promise resolving to RcsStatus indicating command completion\n */\n async forwardProgram() {\n return this.exec(this.nativeInstance.forwardProgram);\n }\n /**\n * Stops an active AUTO program while preserving it for RUN or RESUME.\n * Outside active AUTO execution this has the same destructive behavior as abortTask().\n */\n async stop() {\n return this.exec(this.nativeInstance.stop);\n }\n /**\n * Aborts the currently running task/program\n * Immediately stops all motion and task execution\n *\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Emergency stop of current program\n * await commandChannel.abortTask();\n * ```\n */\n async abortTask() {\n return this.exec(this.nativeInstance.abortTask);\n }\n /**\n * Enables or disables optional stop (M1) functionality\n * When enabled, M1 codes in programs will pause execution\n *\n * @param enable - true to enable optional stops, false to disable\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Enable optional stops\n * await commandChannel.setOptionalStop(true);\n *\n * // Disable optional stops\n * await commandChannel.setOptionalStop(false);\n * ```\n */\n async setOptionalStop(enable) {\n return this.exec(this.nativeInstance.setOptionalStop, enable);\n }\n /**\n * Enables or disables block delete functionality\n * When enabled, lines beginning with \"/\" are skipped during execution\n *\n * @param enable - true to enable block delete, false to disable\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Enable block delete - skip lines starting with \"/\"\n * await commandChannel.setBlockDelete(true);\n *\n * // Disable block delete - execute all lines\n * await commandChannel.setBlockDelete(false);\n * ```\n */\n async setBlockDelete(enable) {\n return this.exec(this.nativeInstance.setBlockDelete, enable);\n }\n /**\n * Executes a Manual Data Input (MDI) command\n * Allows direct execution of G-code commands without a program file\n *\n * @param command - G-code command string to execute\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Move to position\n * await commandChannel.mdi('G0 X10 Y20 Z5');\n *\n * // Set spindle speed\n * await commandChannel.mdi('S1000 M3');\n * ```\n */\n async mdi(command) {\n return this.exec(this.nativeInstance.mdi, command);\n }\n // --- Trajectory Commands ---\n /**\n * Sets the trajectory mode for coordinated motion\n *\n * @param mode - The trajectory mode (FREE, COORD, or TELEOP)\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Set to coordinated mode for normal G-code execution\n * await commandChannel.setTrajMode(TrajMode.COORD);\n *\n * // Set to free mode for individual joint control\n * await commandChannel.setTrajMode(TrajMode.FREE);\n * ```\n */\n async setTrajMode(mode) {\n return this.exec(this.nativeInstance.setTrajMode, mode);\n }\n /**\n * Sets the maximum velocity for trajectory planning\n *\n * @param velocity - Maximum velocity in machine units per second\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Set maximum velocity to 200 units/second\n * await commandChannel.setMaxVelocity(200);\n * ```\n */\n async setMaxVelocity(velocity) {\n return this.exec(this.nativeInstance.setMaxVelocity, velocity);\n }\n /**\n * Sets the feedrate override scale factor\n *\n * @param scale - Feedrate scale factor (1.0 = 100%, 0.5 = 50%, 2.0 = 200%)\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Set feedrate to 50% of programmed values\n * await commandChannel.setFeedRate(0.5);\n *\n * // Set feedrate to 120% of programmed values\n * await commandChannel.setFeedRate(1.2);\n * ```\n */\n async setFeedRate(scale) {\n return this.exec(this.nativeInstance.setFeedRate, scale);\n }\n /**\n * Sets the rapid traverse override scale factor\n *\n * @param scale - Rapid rate scale factor (1.0 = 100%, 0.25 = 25%)\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Set rapid rate to 50%\n * await commandChannel.setRapidRate(0.5);\n * ```\n */\n async setRapidRate(scale) {\n return this.exec(this.nativeInstance.setRapidRate, scale);\n }\n /**\n * Sets the spindle speed override scale factor\n *\n * @param scale - Spindle override scale factor (1.0 = 100%)\n * @param spindleIndex - Index of the spindle to control (default: 0)\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Set spindle speed to 80% of programmed values\n * await commandChannel.setSpindleOverride(0.8);\n *\n * // Set spindle 1 speed to 110%\n * await commandChannel.setSpindleOverride(1.1, 1);\n * ```\n */\n async setSpindleOverride(scale, spindleIndex = 0) {\n return this.exec(this.nativeInstance.setSpindleOverride, scale, spindleIndex);\n }\n /**\n * Overrides axis limits to allow motion beyond normal soft limits\n *\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Override limits for recovery from limit switch activation\n * await commandChannel.overrideLimits();\n * ```\n */\n async overrideLimits() {\n return this.exec(this.nativeInstance.overrideLimits);\n }\n /**\n * Enables or disables teleop mode\n *\n * @param enable - true to enable teleop mode, false for joint mode\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Enable teleop mode for Cartesian jogging\n * await commandChannel.teleopEnable(true);\n *\n * // Disable teleop mode for joint jogging\n * await commandChannel.teleopEnable(false);\n * ```\n */\n async teleopEnable(enable) {\n return this.exec(this.nativeInstance.teleopEnable, enable);\n }\n /**\n * Enables or disables feedrate override functionality\n *\n * @param enable - true to enable feedrate override, false to disable\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Enable feedrate override control\n * await commandChannel.setFeedOverrideEnable(true);\n * ```\n */\n async setFeedOverrideEnable(enable) {\n return this.exec(this.nativeInstance.setFeedOverrideEnable, enable);\n }\n /**\n * Enables or disables spindle speed override functionality\n *\n * @param enable - true to enable spindle override, false to disable\n * @param spindleIndex - Index of the spindle to control (default: 0)\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Enable spindle override control\n * await commandChannel.setSpindleOverrideEnable(true);\n * ```\n */\n async setSpindleOverrideEnable(enable, spindleIndex = 0) {\n return this.exec(this.nativeInstance.setSpindleOverrideEnable, enable, spindleIndex);\n }\n /**\n * Enables or disables feed hold functionality\n * When enabled, allows pausing motion without stopping the program\n *\n * @param enable - true to enable feed hold, false to disable\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Enable feed hold capability\n * await commandChannel.setFeedHoldEnable(true);\n * ```\n */\n async setFeedHoldEnable(enable) {\n return this.exec(this.nativeInstance.setFeedHoldEnable, enable);\n }\n /**\n * Enables or disables adaptive feed functionality\n * Allows external signals to modulate feedrate in real-time\n *\n * @param enable - true to enable adaptive feed, false to disable\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Enable adaptive feed for force-sensitive machining\n * await commandChannel.setAdaptiveFeedEnable(true);\n * ```\n */\n async setAdaptiveFeedEnable(enable) {\n return this.exec(this.nativeInstance.setAdaptiveFeedEnable, enable);\n }\n // --- Joint Commands ---\n /**\n * Homes a specific joint by moving it to its home position\n *\n * @param jointIndex - Zero-based index of the joint to home, -1 to home all joints\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Home joint 0 (typically X-axis)\n * await commandChannel.homeJoint(0);\n *\n * // Home joint 2 (typically Z-axis)\n * await commandChannel.homeJoint(2);\n *\n * // Home all joints\n * await commandChannel.homeJoint(-1);\n * ```\n */\n async homeJoint(jointIndex) {\n return this.exec(this.nativeInstance.homeJoint, jointIndex);\n }\n /**\n * Unhomes a specific joint, clearing its homed status\n *\n * @param jointIndex - Zero-based index of the joint to unhome, -1 to unhome all joints\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Unhome joint 1 (typically Y-axis)\n * await commandChannel.unhomeJoint(1);\n *\n * // Unhome all joints\n * await commandChannel.unhomeJoint(-1);\n * ```\n */\n async unhomeJoint(jointIndex) {\n return this.exec(this.nativeInstance.unhomeJoint, jointIndex);\n }\n /**\n * Stops jogging motion for a specific axis or joint\n *\n * @param axisOrJointIndex - Index of the axis (0=X,1=Y,2=Z...) or joint to stop\n * @param isJointJog - true for joint jogging, false for axis jogging\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Stop axis X jogging\n * await commandChannel.jogStop(0, false);\n *\n * // Stop joint 1 jogging\n * await commandChannel.jogStop(1, true);\n * ```\n */\n async jogStop(axisOrJointIndex, isJointJog) {\n return this.exec(this.nativeInstance.jogStop, axisOrJointIndex, isJointJog);\n }\n /**\n * Starts continuous jogging motion for a specific axis or joint\n *\n * @param axisOrJointIndex - Index of the axis (0=X,1=Y,2=Z...) or joint to jog\n * @param isJointJog - true for joint jogging, false for axis jogging\n * @param speed - Jogging speed in machine units per second\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Jog X axis continuously at 10 units/sec\n * await commandChannel.jogContinuous(0, false, 10);\n *\n * // Jog joint 2 continuously at -5 units/sec (negative direction)\n * await commandChannel.jogContinuous(2, true, -5);\n * ```\n */\n async jogContinuous(axisOrJointIndex, isJointJog, speed) {\n return this.exec(this.nativeInstance.jogContinuous, axisOrJointIndex, isJointJog, speed);\n }\n /**\n * Jogs a specific distance at a given speed for an axis or joint\n *\n * @param axisOrJointIndex - Index of the axis (0=X,1=Y,2=Z...) or joint to jog\n * @param isJointJog - true for joint jogging, false for axis jogging\n * @param speed - Jogging speed in machine units per second\n * @param increment - Distance to jog in machine units\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Jog Y axis 1.0 unit at 5 units/sec\n * await commandChannel.jogIncrement(1, false, 5, 1.0);\n *\n * // Jog joint 0 back 0.1 units at 2 units/sec\n * await commandChannel.jogIncrement(0, true, 2, -0.1);\n * ```\n */\n async jogIncrement(axisOrJointIndex, isJointJog, speed, increment) {\n return this.exec(this.nativeInstance.jogIncrement, axisOrJointIndex, isJointJog, speed, increment);\n }\n /**\n * Sets the minimum position limit for a joint\n *\n * @param jointIndex - Zero-based index of the joint\n * @param limit - Minimum position limit in machine units\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Set minimum limit for joint 0 to -100 units\n * await commandChannel.setMinPositionLimit(0, -100);\n * ```\n */\n async setMinPositionLimit(jointIndex, limit) {\n return this.exec(this.nativeInstance.setMinPositionLimit, jointIndex, limit);\n }\n /**\n * Sets the maximum position limit for a joint\n *\n * @param jointIndex - Zero-based index of the joint\n * @param limit - Maximum position limit in machine units\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Set maximum limit for joint 0 to 200 units\n * await commandChannel.setMaxPositionLimit(0, 200);\n * ```\n */\n async setMaxPositionLimit(jointIndex, limit) {\n return this.exec(this.nativeInstance.setMaxPositionLimit, jointIndex, limit);\n }\n // --- Spindle Commands ---\n /**\n * Turns on the spindle at a specified speed\n *\n * @param speed - Spindle speed in RPM (positive = clockwise, negative = counterclockwise)\n * @param spindleIndex - Index of the spindle to control (default: 0)\n * @param waitForSpeed - Whether to wait for spindle to reach speed before continuing (default: true)\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Turn on spindle at 1000 RPM clockwise\n * await commandChannel.spindleOn(1000);\n *\n * // Turn on spindle 1 at 500 RPM counterclockwise\n * await commandChannel.spindleOn(-500, 1);\n *\n * // Start spindle without waiting for speed\n * await commandChannel.spindleOn(800, 0, false);\n * ```\n */\n async spindleOn(speed, spindleIndex = 0, waitForSpeed = true) {\n return this.exec(this.nativeInstance.spindleOn, speed, spindleIndex, waitForSpeed);\n }\n /**\n * Increases spindle speed by a predefined increment\n * Spindle must already be running\n *\n * @param spindleIndex - Index of the spindle to control (default: 0)\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Increase speed of main spindle\n * await commandChannel.spindleIncrease();\n *\n * // Increase speed of spindle 1\n * await commandChannel.spindleIncrease(1);\n * ```\n */\n async spindleIncrease(spindleIndex = 0) {\n return this.exec(this.nativeInstance.spindleIncrease, spindleIndex);\n }\n /**\n * Decreases spindle speed by a predefined increment\n * Spindle must already be running\n *\n * @param spindleIndex - Index of the spindle to control (default: 0)\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Decrease speed of main spindle\n * await commandChannel.spindleDecrease();\n *\n * // Decrease speed of spindle 1\n * await commandChannel.spindleDecrease(1);\n * ```\n */\n async spindleDecrease(spindleIndex = 0) {\n return this.exec(this.nativeInstance.spindleDecrease, spindleIndex);\n }\n /**\n * Turns off the spindle\n *\n * @param spindleIndex - Index of the spindle to control (default: 0)\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Turn off main spindle\n * await commandChannel.spindleOff();\n *\n * // Turn off spindle 1\n * await commandChannel.spindleOff(1);\n * ```\n */\n async spindleOff(spindleIndex = 0) {\n return this.exec(this.nativeInstance.spindleOff, spindleIndex);\n }\n /**\n * Engages or releases the spindle brake\n *\n * @param engage - true to engage brake, false to release brake\n * @param spindleIndex - Index of the spindle to control (default: 0)\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Engage spindle brake\n * await commandChannel.spindleBrake(true);\n *\n * // Release brake on spindle 1\n * await commandChannel.spindleBrake(false, 1);\n * ```\n */\n async spindleBrake(engage, spindleIndex = 0) {\n return this.exec(this.nativeInstance.spindleBrake, engage, spindleIndex);\n }\n // --- Coolant Commands ---\n /**\n * Turns mist coolant on or off\n *\n * @param on - true to turn mist on, false to turn off\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Turn on mist coolant\n * await commandChannel.setMist(true);\n *\n * // Turn off mist coolant\n * await commandChannel.setMist(false);\n * ```\n */\n async setMist(on) {\n return this.exec(this.nativeInstance.setMist, on);\n }\n /**\n * Turns flood coolant on or off\n *\n * @param on - true to turn flood on, false to turn off\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Turn on flood coolant\n * await commandChannel.setFlood(true);\n *\n * // Turn off flood coolant\n * await commandChannel.setFlood(false);\n * ```\n */\n async setFlood(on) {\n return this.exec(this.nativeInstance.setFlood, on);\n }\n // --- Tool Commands ---\n /**\n * Reloads the tool table from disk\n * Updates the in-memory tool table with changes made to the tool table file\n *\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Reload tool table after editing the .tbl file\n * await commandChannel.loadToolTable();\n * ```\n */\n async loadToolTable() {\n return this.exec(this.nativeInstance.loadToolTable);\n }\n /**\n * Sets tool data for a specific tool number\n * Updates tool geometry and parameters in the tool table\n *\n * @param toolEntry - Tool entry containing tool number and optional geometry data\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Set basic tool data\n * await commandChannel.setTool({\n * toolNo: 3,\n * pocketNo: 3\n * });\n *\n * // Set tool with geometry data\n * await commandChannel.setTool({\n * toolNo: 1,\n * pocketNo: 1,\n * diameter: 6.35,\n * offset: {\n * x: 0,\n * y: 0,\n * z: 25.4\n * }\n * });\n * ```\n */\n async setTool(toolEntry) {\n return this.exec(this.nativeInstance.setTool, toolEntry);\n }\n // --- IO Commands ---\n /**\n * Sets the state of a digital output pin\n *\n * @param index - Index of the digital output pin\n * @param value - true to set high, false to set low\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Set digital output 0 high\n * await commandChannel.setDigitalOutput(0, true);\n *\n * // Set digital output 3 low\n * await commandChannel.setDigitalOutput(3, false);\n * ```\n */\n async setDigitalOutput(index, value) {\n return this.exec(this.nativeInstance.setDigitalOutput, index, value);\n }\n /**\n * Sets the value of an analog output pin\n *\n * @param index - Index of the analog output pin\n * @param value - Analog value to set\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Set analog output 0 to 13.3\n * await commandChannel.setAnalogOutput(0, 13.3);\n * ```\n */\n async setAnalogOutput(index, value) {\n return this.exec(this.nativeInstance.setAnalogOutput, index, value);\n }\n // --- Debug & Message Commands ---\n /**\n * Sets debug flags for LinuxCNC components using OR-ed EmcDebug flags\n * Multiple debug categories can be enabled simultaneously by combining flags\n *\n * @param level - Debug flags from EmcDebug enum, can be OR-ed together\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Disable all debugging\n * await commandChannel.setDebugLevel(0);\n *\n * // Enable interpreter debugging only\n * await commandChannel.setDebugLevel(EmcDebug.INTERP);\n *\n * // Enable multiple debug categories\n * await commandChannel.setDebugLevel(EmcDebug.INTERP | EmcDebug.MOTION_TIME);\n *\n * // Enable task and NML debugging\n * await commandChannel.setDebugLevel(EmcDebug.TASK_ISSUE | EmcDebug.NML);\n *\n * // Enable Python and remap debugging for custom components\n * await commandChannel.setDebugLevel(EmcDebug.PYTHON | EmcDebug.REMAP);\n * ```\n */\n async setDebugLevel(level) {\n return this.exec(this.nativeInstance.setDebugLevel, level);\n }\n /**\n * Sends an error message to the operator display\n *\n * @param message - Error message to display (max 254 characters)\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Send error message\n * await commandChannel.sendOperatorError('Tool change required');\n * ```\n */\n async sendOperatorError(message) {\n return this.exec(this.nativeInstance.sendOperatorError, message);\n }\n /**\n * Sends a text message to the operator display\n *\n * @param message - Text message to display (max 254 characters)\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Send informational message\n * await commandChannel.sendOperatorText('Setup complete');\n * ```\n */\n async sendOperatorText(message) {\n return this.exec(this.nativeInstance.sendOperatorText, message);\n }\n /**\n * Sends a display message to the operator\n *\n * @param message - Display message (max 254 characters)\n * @returns Promise resolving to RcsStatus indicating command completion\n *\n * @example\n * ```typescript\n * // Send display message\n * await commandChannel.sendOperatorDisplay('Insert tool T1 M6');\n * ```\n */\n async sendOperatorDisplay(message) {\n return this.exec(this.nativeInstance.sendOperatorDisplay, message);\n }\n // --- Misc ---\n /**\n * Synchronously waits for the last command to complete\n * This does the same as await but provides a synchronous way to wait for command completion\n *\n * @param timeout - Maximum time to wait in seconds (default: 5 seconds)\n * @returns RcsStatus indicating completion status (RCS_DONE, RCS_ERROR, or -1 for timeout)\n *\n * @example\n * ```typescript\n * // These two approaches are equivalent:\n *\n * // Approach 1: Using await (asynchronous)\n * await commandChannel.runProgram();\n * console.log('Program completed');\n *\n * // Approach 2: Using waitComplete (synchronous)\n * commandChannel.runProgram(); // Fire and forget - don't await\n * const status = commandChannel.waitComplete(); // Synchronously wait for completion\n * if (status === RcsStatus.DONE) {\n * console.log('Program completed');\n * }\n * ```\n */\n waitComplete(timeout) {\n if (!this.nativeInstance)\n throw new Error(\"CommandChannel native instance not available.\");\n return this.nativeInstance.waitComplete(timeout);\n }\n /**\n * Gets the serial number of the current command\n * Each command sent has a unique serial number for tracking\n *\n * @returns The current command serial number\n *\n * @example\n * ```typescript\n * // Get current command serial number\n * const serial = commandChannel.getSerial();\n * console.log(`Current command serial: ${serial}`);\n * ```\n */\n getSerial() {\n if (!this.nativeInstance)\n throw new Error(\"CommandChannel native instance not available.\");\n return this.nativeInstance.serial;\n }\n /**\n * Destroys the command channel and cleans up resources\n * Call this when done using the command channel\n */\n destroy() {\n if (this.nativeInstance) {\n this.nativeInstance.disconnect();\n }\n }\n}\nexports.CommandChannel = CommandChannel;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StatusCoordinator = void 0;\nconst types_1 = require(\"@linuxcnc-node/types\");\nclass Deferred {\n constructor() {\n this.promise = new Promise((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n void this.promise.catch(() => undefined);\n }\n}\nconst DEFAULT_ACCEPTANCE_TIMEOUT = 1000;\nconst DEFAULT_POLL_INTERVAL = 10;\nclass StatusCoordinator {\n constructor(native, acceptanceTimeout = DEFAULT_ACCEPTANCE_TIMEOUT, pollInterval = DEFAULT_POLL_INTERVAL) {\n this.native = native;\n this.acceptanceTimeout = acceptanceTimeout;\n this.pollInterval = pollInterval;\n this.tracked = new Map();\n this.nextId = 1;\n }\n track(serial, completionSensitive, completionTimeout) {\n if (this.stopped) {\n const rejected = Promise.reject(this.stopped);\n void rejected.catch(() => undefined);\n return {\n accepted: rejected,\n completed: completionSensitive ? rejected : undefined,\n cancel: () => undefined,\n };\n }\n if (!Number.isInteger(serial) || serial <= 0) {\n throw new Error(`Native command returned invalid serial: ${serial}`);\n }\n const accepted = new Deferred();\n const completed = completionSensitive\n ? new Deferred()\n : undefined;\n const command = {\n id: this.nextId++,\n serial,\n acceptanceDeadline: Date.now() + this.acceptanceTimeout,\n completionTimeout,\n acceptanceObserved: false,\n accepted,\n completed,\n };\n this.tracked.set(command.id, command);\n this.schedule(0);\n return {\n accepted: accepted.promise,\n completed: completed?.promise,\n cancel: (reason) => this.cancel(command.id, reason),\n };\n }\n stop(reason = new Error(\"Command transport disconnected.\")) {\n if (this.stopped)\n return;\n this.stopped = reason;\n if (this.timer) {\n clearTimeout(this.timer);\n this.timer = undefined;\n }\n for (const command of this.tracked.values()) {\n command.accepted.reject(reason);\n command.completed?.reject(reason);\n }\n this.tracked.clear();\n }\n cancel(id, reason) {\n const command = this.tracked.get(id);\n if (!command)\n return;\n this.tracked.delete(id);\n command.accepted.reject(reason);\n command.completed?.reject(reason);\n }\n schedule(delay) {\n if (this.timer || this.stopped || this.tracked.size === 0)\n return;\n this.timer = setTimeout(() => {\n this.timer = undefined;\n this.poll();\n }, delay);\n }\n poll() {\n if (this.stopped || this.tracked.size === 0)\n return;\n let snapshot;\n try {\n snapshot = this.native.getStatusSnapshot();\n }\n catch {\n // A transient NML read failure is handled by the existing deadlines.\n }\n const now = Date.now();\n for (const command of [...this.tracked.values()]) {\n if (!command.acceptanceObserved &&\n snapshot &&\n snapshot.echoSerial >= command.serial) {\n command.acceptanceObserved = true;\n command.accepted.resolve({\n status: types_1.RcsStatus.DONE,\n serial: command.serial,\n });\n if (!command.completed) {\n this.tracked.delete(command.id);\n continue;\n }\n if (command.completionTimeout !== undefined) {\n command.completionDeadline = now + command.completionTimeout;\n }\n }\n if (!command.acceptanceObserved && now >= command.acceptanceDeadline) {\n const error = new Error(`Command acceptance timed out for serial ${command.serial}.`);\n this.tracked.delete(command.id);\n command.accepted.reject(error);\n command.completed?.reject(error);\n continue;\n }\n if (command.acceptanceObserved &&\n command.completed &&\n snapshot &&\n (snapshot.status === types_1.RcsStatus.DONE ||\n snapshot.status === types_1.RcsStatus.ERROR)) {\n this.tracked.delete(command.id);\n command.completed.resolve(snapshot.status);\n continue;\n }\n if (command.acceptanceObserved &&\n command.completed &&\n command.completionDeadline !== undefined &&\n now >= command.completionDeadline) {\n const error = new Error(`Command completion timed out for serial ${command.serial}.`);\n this.tracked.delete(command.id);\n command.completed.reject(error);\n }\n }\n this.schedule(this.pollInterval);\n }\n}\nexports.StatusCoordinator = StatusCoordinator;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CommandTransport = void 0;\nconst types_1 = require(\"@linuxcnc-node/types\");\nconst constants_1 = require(\"../constants\");\nconst statusCoordinator_1 = require(\"./statusCoordinator\");\nconst LOCAL_COMMANDS = new Set([\"setTool\"]);\nclass CommandTransport {\n constructor() {\n this.disconnected = false;\n this.nativeInstance = new constants_1.addon.NativeCommandChannel({\n waitMode: \"sent\",\n });\n this.coordinator = new statusCoordinator_1.StatusCoordinator(this.nativeInstance);\n }\n getSerial() {\n return this.nativeInstance.serial;\n }\n send(name, args = [], options = {}) {\n if (this.disconnected) {\n return rejectedHandle(new Error(\"Command transport disconnected.\"));\n }\n if (LOCAL_COMMANDS.has(name)) {\n return this.sendLocal(name, args, options);\n }\n const tracking = options.tracking ?? \"acceptance\";\n const nativeResult = this.dispatchNative(name, args);\n if (nativeResult instanceof Error) {\n return rejectedHandle(nativeResult);\n }\n let ticket;\n let canceled;\n const accepted = Promise.resolve(nativeResult).then((result) => {\n const serial = extractSerial(result);\n ticket = this.coordinator.track(serial, tracking === \"completion\", options.completionTimeout);\n if (canceled)\n ticket.cancel(canceled);\n return ticket.accepted;\n }).then((value) => value);\n const completed = tracking === \"completion\"\n ? Promise.resolve(nativeResult)\n .then(() => ticket?.completed)\n .then((completion) => {\n if (!completion) {\n throw new Error(\"Command completion tracking was not created.\");\n }\n return completion;\n })\n .then((value) => value)\n : undefined;\n const handle = {\n accepted,\n serial: accepted.then((result) => result.serial),\n completed,\n cancel: (reason) => {\n canceled = reason;\n ticket?.cancel(reason);\n },\n };\n void handle.serial.catch(() => undefined);\n void handle.completed?.catch(() => undefined);\n return handle;\n }\n destroy() {\n this.disconnect();\n }\n disconnect() {\n if (this.disconnected)\n return;\n this.disconnected = true;\n const error = new Error(\"Command transport disconnected.\");\n this.coordinator.stop(error);\n this.nativeInstance.disconnect();\n }\n sendLocal(name, args, options) {\n const nativeResult = this.dispatchNative(name, args);\n if (nativeResult instanceof Error) {\n return rejectedHandle(nativeResult);\n }\n let timeoutHandle;\n const nativeCompletion = Promise.resolve(nativeResult).then((status) => {\n if (status !== types_1.RcsStatus.DONE) {\n throw new Error(`Local command failed with RCS status: ${types_1.RcsStatus[status] || String(status)}`);\n }\n return types_1.RcsStatus.DONE;\n });\n const timeoutPromise = options.completionTimeout === undefined\n ? new Promise(() => undefined)\n : new Promise((_, reject) => {\n timeoutHandle = setTimeout(() => reject(new Error(\"Local command completion timed out.\")), options.completionTimeout);\n timeoutHandle.unref?.();\n });\n const completed = Promise.race([nativeCompletion, timeoutPromise]).finally(() => {\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n });\n const accepted = completed.then(() => ({\n status: types_1.RcsStatus.DONE,\n serial: null,\n }));\n const handle = {\n accepted,\n serial: accepted.then((result) => result.serial),\n completed: options.tracking === \"completion\" ? completed : undefined,\n cancel: () => undefined,\n };\n void handle.serial.catch(() => undefined);\n void handle.completed?.catch(() => undefined);\n return handle;\n }\n dispatchNative(name, args) {\n const nativeMethod = this.nativeInstance[name];\n if (typeof nativeMethod !== \"function\") {\n return new Error(`Unknown native command: ${String(name)}`);\n }\n try {\n return nativeMethod.apply(this.nativeInstance, [...args]);\n }\n catch (error) {\n return nativeDispatchError(error);\n }\n }\n}\nexports.CommandTransport = CommandTransport;\nfunction rejectedHandle(error) {\n const rejected = Promise.reject(error);\n void rejected.catch(() => undefined);\n return {\n accepted: rejected,\n serial: rejected,\n completed: rejected,\n cancel: () => undefined,\n };\n}\nfunction extractSerial(result) {\n if (typeof result === \"number\")\n return result;\n if (typeof result === \"object\" &&\n result !== null &&\n \"serial\" in result &&\n typeof result.serial === \"number\") {\n return result.serial;\n }\n return NaN;\n}\nfunction nativeDispatchError(error) {\n return new Error(`Command native dispatch failed: ${error instanceof Error ? error.message : String(error)}`);\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ErrorChannel = exports.DEFAULT_ERROR_POLL_INTERVAL = void 0;\nconst events_1 = require(\"events\");\nconst constants_1 = require(\"./constants\");\nconst types_1 = require(\"@linuxcnc-node/types\");\nexports.DEFAULT_ERROR_POLL_INTERVAL = 100; // ms\nclass ErrorChannel extends events_1.EventEmitter {\n constructor(options) {\n super();\n this.poller = null;\n this.isPolling = false;\n this.nativeInstance = new constants_1.addon.NativeErrorChannel();\n const pollInterval = options?.pollInterval ?? exports.DEFAULT_ERROR_POLL_INTERVAL;\n this.poller = setInterval(() => this.poll(), pollInterval);\n }\n poll() {\n if (this.isPolling)\n return;\n this.isPolling = true;\n try {\n const error = this.nativeInstance.poll();\n if (error) {\n this.emit(\"message\", error);\n // Emit specific event based on message type\n switch (error.type) {\n case types_1.NmlMessageType.EMC_OPERATOR_ERROR:\n this.emit(\"operatorError\", error);\n break;\n case types_1.NmlMessageType.EMC_OPERATOR_TEXT:\n this.emit(\"operatorText\", error);\n break;\n case types_1.NmlMessageType.EMC_OPERATOR_DISPLAY:\n this.emit(\"operatorDisplay\", error);\n break;\n case types_1.NmlMessageType.NML_ERROR:\n this.emit(\"nmlError\", error);\n break;\n case types_1.NmlMessageType.NML_TEXT:\n this.emit(\"nmlText\", error);\n break;\n case types_1.NmlMessageType.NML_DISPLAY:\n this.emit(\"nmlDisplay\", error);\n break;\n }\n }\n }\n catch (e) {\n console.error(\"Error during ErrorChannel poll:\", e);\n }\n finally {\n this.isPolling = false;\n }\n }\n destroy() {\n if (this.poller) {\n clearInterval(this.poller);\n this.poller = null;\n }\n this.removeAllListeners();\n this.nativeInstance.disconnect();\n }\n}\nexports.ErrorChannel = ErrorChannel;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PositionLogger = void 0;\nconst constants_1 = require(\"./constants\");\n/**\n * Position Logger for tracking machine tool path\n *\n * This class provides functionality to log the position of a LinuxCNC machine tool\n * over time. All positions are returned as Float64Array with 10 elements per point:\n * [x, y, z, a, b, c, u, v, w, motionType]\n *\n * Use PositionLoggerIndex enum (or destructure it for shorter access like data[X]) and POSITION_STRIDE constant for array access.\n */\nclass PositionLogger {\n constructor() {\n this.nativeLogger = new constants_1.addon.NativePositionLogger();\n }\n /**\n * Start position logging\n * @param options Logging options\n */\n start(options = {}) {\n const interval = options.interval || 0.01;\n const maxHistorySize = options.maxHistorySize || 10000;\n this.nativeLogger.start(interval, maxHistorySize);\n }\n /**\n * Stop position logging\n */\n stop() {\n this.nativeLogger.stop();\n }\n /**\n * Clear the position history (invalidates all previous cursors)\n */\n clear() {\n this.nativeLogger.clear();\n }\n /**\n * Get the current position as a Float64Array\n * Layout: [x, y, z, a, b, c, u, v, w, motionType]\n * @returns Float64Array with 10 values, or null if no position available\n */\n getCurrentPosition() {\n return this.nativeLogger.getCurrentPosition();\n }\n /**\n * Get the motion history as a Float64Array\n * Layout: [x, y, z, a, b, c, u, v, w, motionType] repeated for each point\n * Use POSITION_STRIDE (10) to iterate through points\n * @param startIndex Starting index (default: 0)\n * @param count Number of points to retrieve (default: all)\n * @returns Float64Array with 10 values per point\n */\n getMotionHistory(startIndex, count) {\n if (startIndex !== undefined && count !== undefined) {\n return this.nativeLogger.getMotionHistory(startIndex, count);\n }\n else if (startIndex !== undefined) {\n return this.nativeLogger.getMotionHistory(startIndex);\n }\n else {\n return this.nativeLogger.getMotionHistory();\n }\n }\n /**\n * Get the number of points in the motion history\n * @returns Number of logged points\n */\n getHistoryCount() {\n return this.nativeLogger.getHistoryCount();\n }\n /**\n * Get the most recent points from the history\n * @param count Number of recent points to get (default: 10)\n * @returns Float64Array with 10 values per point\n */\n getRecentHistory(count = 10) {\n const totalCount = this.getHistoryCount();\n if (totalCount === 0)\n return new Float64Array(0);\n const startIndex = Math.max(0, totalCount - count);\n const actualCount = Math.min(count, totalCount);\n return this.getMotionHistory(startIndex, actualCount);\n }\n /**\n * Get the current cursor position (monotonic counter of points ever added)\n * @returns Current cursor value\n */\n getCurrentCursor() {\n return this.nativeLogger.getCurrentCursor();\n }\n /**\n * Get delta points since a given cursor position\n * Use this for efficient incremental updates instead of fetching full history.\n * @param cursor Last known cursor (0 for full history)\n * @returns Delta result with points, count, new cursor, and wasReset flag\n */\n getDeltaSince(cursor) {\n return this.nativeLogger.getDeltaSince(cursor);\n }\n}\nexports.PositionLogger = PositionLogger;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PositionLogger = exports.ErrorChannel = exports.CommandTransport = exports.CommandChannel = exports.StatChannel = void 0;\nexports.setNmlFilePath = setNmlFilePath;\nexports.getNmlFilePath = getNmlFilePath;\nconst statChannel_1 = require(\"./statChannel\");\nObject.defineProperty(exports, \"StatChannel\", { enumerable: true, get: function () { return statChannel_1.StatChannel; } });\nconst commandChannel_1 = require(\"./commandChannel\");\nObject.defineProperty(exports, \"CommandChannel\", { enumerable: true, get: function () { return commandChannel_1.CommandChannel; } });\nconst commandTransport_1 = require(\"./commandTransport\");\nObject.defineProperty(exports, \"CommandTransport\", { enumerable: true, get: function () { return commandTransport_1.CommandTransport; } });\nconst errorChannel_1 = require(\"./errorChannel\");\nObject.defineProperty(exports, \"ErrorChannel\", { enumerable: true, get: function () { return errorChannel_1.ErrorChannel; } });\nconst positionLogger_1 = require(\"./positionLogger\");\nObject.defineProperty(exports, \"PositionLogger\", { enumerable: true, get: function () { return positionLogger_1.PositionLogger; } });\nconst constants_1 = require(\"./constants\");\nlet nmlFilePath = constants_1.addon.NMLFILE_DEFAULT;\n/**\n * Sets the NML file path for communication with LinuxCNC.\n * This must be called before creating any channel instances if using a non-default path.\n * @param filePath Absolute path to the .nml file.\n */\nfunction setNmlFilePath(filePath) {\n constants_1.addon.setNmlFilePath(filePath);\n nmlFilePath = filePath;\n}\n/**\n * Gets the current NML file path.\n * @returns The NML file path being used.\n */\nfunction getNmlFilePath() {\n return constants_1.addon.getNmlFilePath();\n}\n","/**\n * G-Code Parser Module\n *\n * Provides async G-code file parsing using LinuxCNC's rs274ngc interpreter.\n */\n\nimport { GCodeParseResult, ParseOptions, ParseProgress } from \"@linuxcnc-node/types\";\n\n// Native addon - loaded immediately on module import\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction loadAddon(): any {\n const paths = [\n \"../build/Release/gcode_addon.node\", // Installed in node_modules (path relative to dist/)\n \"../../build/Release/gcode_addon.node\", // Local development (path relative to src/ts/)\n ];\n\n for (const path of paths) {\n try {\n return require(path);\n } catch {\n // Try next path\n }\n }\n\n throw new Error(\n `Failed to load gcode_addon.node. Tried paths:\\n` +\n paths.map((p) => ` - ${p}`).join(\"\\n\")\n );\n}\n\nconst addon = loadAddon();\n\n/**\n * Parse a G-code file asynchronously.\n *\n * Uses LinuxCNC's rs274ngc interpreter to parse the G-code file and extract\n * a sequential list of operations suitable for graphics visualization.\n *\n * @param filepath - Path to the G-code file to parse (.ngc, .nc, .gcode, etc.)\n * @param options - Parse options including required INI path and optional progress callback\n * @returns Promise resolving to parse result with operations and extents\n * @throws Error if parsing fails (invalid G-code, file not found, etc.)\n *\n * @example\n * ```typescript\n * import { parseGCode } from \"@linuxcnc-node/gcode\";\n * import { OperationType, PositionIndex } from \"@linuxcnc-node/types\";\n *\n * const result = await parseGCode(\"/path/to/program.ngc\", {\n * iniPath: \"/path/to/machine.ini\",\n * onProgress: (progress) => {\n * console.log(`${progress.percent}% complete`);\n * }\n * });\n *\n * const { X, Y } = PositionIndex;\n * for (const op of result.operations) {\n * if (op.type === OperationType.FEED) {\n * console.log(`Feed from (${op.pos[X]}, ${op.pos[Y]})`);\n * }\n * }\n *\n * console.log(`Extents: X ${result.extents.min[X]} to ${result.extents.max[X]}`);\n * ```\n */\nexport async function parseGCode(\n filepath: string,\n options: ParseOptions\n): Promise<GCodeParseResult> {\n if (!options.iniPath) {\n throw new Error(\"iniPath is required in ParseOptions\");\n }\n\n return new Promise<GCodeParseResult>((resolve, reject) => {\n const progressCallback =\n options.onProgress || ((_progress: ParseProgress) => {});\n const progressUpdates = options.progressUpdates ?? 40;\n\n addon.parseGCode(\n filepath,\n options.iniPath,\n progressUpdates,\n progressCallback,\n (error: Error | null, result: GCodeParseResult) => {\n if (error) {\n reject(error);\n } else {\n resolve(result);\n }\n }\n );\n });\n}\n","/**\n * @linuxcnc-node/gcode\n *\n * Node.js G-code parser using LinuxCNC rs274ngc interpreter.\n * Parses G-code files and returns a sequential list of operations\n * tagged with motion types for graphics visualization.\n */\n\n// Export parser function\nexport { parseGCode } from \"./parser\";\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.RtapiMsgLevelFromValue = exports.HalParamDirFromValue = exports.HalPinDirFromValue = exports.HalTypeFromValue = exports.RtapiMsgLevelValue = exports.HalParamDirValue = exports.HalPinDirValue = exports.HalTypeValue = exports.halNative = void 0;\n// Native addon - loaded once on module import\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction loadAddon() {\n const paths = [\n \"../build/Release/hal_addon.node\",\n \"../../build/Release/hal_addon.node\",\n ];\n for (const path of paths) {\n try {\n return require(path);\n }\n catch {\n // Try next path\n }\n }\n throw new Error(\"Failed to load linuxcnc-node hal native addon. Please ensure it's built correctly and that LinuxCNC is in your PATH.\");\n}\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexports.halNative = loadAddon();\n// Numeric value mappings for native interop\nexports.HalTypeValue = {\n bit: 1,\n float: 2,\n s32: 3,\n u32: 4,\n s64: 6,\n u64: 7,\n};\nexports.HalPinDirValue = {\n in: 16,\n out: 32,\n io: 48,\n};\nexports.HalParamDirValue = {\n ro: 64,\n rw: 192,\n};\nexports.RtapiMsgLevelValue = {\n none: 0,\n err: 1,\n warn: 2,\n info: 3,\n dbg: 4,\n all: 5,\n};\n// Helper to generate reverse mapping\nfunction createReverseMap(map) {\n const reverse = {};\n for (const [key, value] of Object.entries(map)) {\n reverse[value] = key;\n }\n return reverse;\n}\n// Reverse mappings for native -> TS conversion\nexports.HalTypeFromValue = createReverseMap(exports.HalTypeValue);\nexports.HalPinDirFromValue = createReverseMap(exports.HalPinDirValue);\nexports.HalParamDirFromValue = createReverseMap(exports.HalParamDirValue);\nexports.RtapiMsgLevelFromValue = createReverseMap(exports.RtapiMsgLevelValue);\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Param = exports.Pin = exports.HalItem = void 0;\nconst events_1 = require(\"events\");\nclass HalItem extends events_1.EventEmitter {\n constructor(component, nameSuffix, type, direction) {\n super();\n this.component = component;\n this.name = nameSuffix;\n this.type = type;\n this.direction = direction;\n }\n /**\n * Retrieves the current value of this item.\n *\n * @returns The item's value (number or boolean depending on type).\n */\n getValue() {\n return this.component.getValue(this.name);\n }\n /**\n * Sets the value of this item.\n *\n * For pins, only applicable to `HAL_OUT` or `HAL_IO` pins.\n * For parameters, only applicable to `HAL_RW` parameters.\n *\n * @param value - The new value for the item.\n * @returns The value that was set.\n * @throws Error if trying to set an `HAL_IN` pin or `HAL_RO` parameter.\n */\n setValue(value) {\n return this.component.setValue(this.name, value);\n }\n}\nexports.HalItem = HalItem;\n/**\n * Represents a HAL pin. Instances are returned by `component.newPin()`.\n *\n * @example\n * ```typescript\n * const pin = comp.newPin(\"output\", \"float\", \"out\");\n * pin.setValue(123.45);\n * pin.on('change', (newVal, oldVal) => console.log(newVal));\n * ```\n */\nclass Pin extends HalItem {\n}\nexports.Pin = Pin;\n/**\n * Represents a HAL parameter. Instances are returned by `component.newParam()`.\n *\n * @example\n * ```typescript\n * const param = comp.newParam(\"speed\", \"float\", \"rw\");\n * param.setValue(100.0);\n * param.on('change', (newVal, oldVal) => console.log(newVal));\n * ```\n */\nclass Param extends HalItem {\n}\nexports.Param = Param;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.HalComponent = exports.DEFAULT_POLL_INTERVAL = void 0;\nconst events_1 = require(\"events\");\nconst constants_1 = require(\"./constants\");\nconst item_1 = require(\"./item\");\n/** Default polling interval in milliseconds for monitoring value changes */\nexports.DEFAULT_POLL_INTERVAL = 10;\n/**\n * Represents a HAL component.\n *\n * This class provides functionality to create HAL components, pins, parameters,\n * and interact with the HAL environment.\n *\n * @example\n * ```typescript\n * const comp = new HalComponent(\"my-component\");\n * const pin = comp.newPin(\"output\", \"float\", \"out\");\n * comp.ready();\n * pin.setValue(123.45);\n *\n * // Listen for value changes\n * pin.on('change', (newVal, oldVal) => {\n * console.log(`Changed: ${oldVal} -> ${newVal}`);\n * });\n *\n * // Listen for batch delta updates\n * comp.on('delta', (delta) => {\n * console.log(`${delta.changes.length} items changed at cursor ${delta.cursor}`);\n * });\n * ```\n */\nclass HalComponent extends events_1.EventEmitter {\n /**\n * Creates a new HAL component.\n *\n * @param name - The name of the component (e.g., \"my-component\").\n * This will be registered with LinuxCNC HAL.\n * @param prefix - Optional prefix for pins and parameters created by this component.\n * If not provided, defaults to `name`.\n */\n constructor(name, prefix) {\n super();\n this.pins = {};\n this.params = {};\n // Monitoring system\n this.watchedItems = new Map();\n this.monitoringTimer = null;\n this.monitoringOptions = {\n pollInterval: exports.DEFAULT_POLL_INTERVAL,\n };\n /** Monotonic cursor incremented on each batch update */\n this.cursor = 0;\n this.nativeInstance = new constants_1.halNative.HalComponent(name, prefix);\n this.name = name;\n this.prefix = prefix || name;\n }\n /**\n * Checks if a HAL component with the given name exists in the system.\n *\n * @param name - The component name (e.g., \"halui\", \"my-custom-comp\").\n * @returns `true` if the component exists, `false` otherwise.\n */\n static exists(name) {\n return constants_1.halNative.component_exists(name);\n }\n /**\n * Checks if the HAL component with the given name has been marked as ready.\n *\n * @param name - The component name.\n * @returns `true` if the component exists and is ready, `false` otherwise.\n */\n static isReady(name) {\n return constants_1.halNative.component_is_ready(name);\n }\n /**\n * Gets the value of a pin or parameter by name.\n *\n * @param name - The nameSuffix of the pin or parameter.\n * @returns The current value.\n */\n getValue(name) {\n return this.nativeInstance.getProperty(name);\n }\n /**\n * Sets the value of a pin or parameter by name.\n *\n * @param name - The nameSuffix of the pin or parameter.\n * @param value - The value to set.\n * @returns The value that was set.\n */\n setValue(name, value) {\n if (typeof value !== \"number\" && typeof value !== \"boolean\") {\n throw new TypeError(\"Value must be a number or boolean\");\n }\n return this.nativeInstance.setProperty(name, value);\n }\n /**\n * Creates a new HAL pin associated with this component.\n *\n * This method can only be called before `ready()` or after `unready()`.\n *\n * @param nameSuffix - The suffix for the pin name (e.g., \"in1\", \"motor.0.pos\").\n * The full HAL name will be `this.prefix + \".\" + nameSuffix`.\n * @param type - The data type of the pin (e.g., `\"float\"`, `\"bit\"`).\n * See {@link HalType} for available types.\n * @param direction - The direction of the pin (e.g., `\"in\"`, `\"out\"`, `\"io\"`).\n * See {@link HalPinDir} for available directions.\n * @returns A new `Pin` object instance.\n * @throws Error if component is ready or if pin creation fails.\n */\n newPin(nameSuffix, type, direction) {\n const success = this.nativeInstance.newPin(nameSuffix, constants_1.HalTypeValue[type], constants_1.HalPinDirValue[direction]);\n if (!success) {\n console.error(`Failed to create pin '${nameSuffix}'`);\n }\n const pin = new item_1.Pin(this, nameSuffix, type, direction);\n this.pins[nameSuffix] = pin;\n this.setupItemListeners(pin, nameSuffix);\n return pin;\n }\n /**\n * Creates a new HAL parameter associated with this component.\n *\n * This method can only be called before `ready()` or after `unready()`.\n *\n * @param nameSuffix - The suffix for the parameter name.\n * The full HAL name will be `this.prefix + \".\" + nameSuffix`.\n * @param type - The data type of the parameter. See {@link HalType} for available types.\n * @param direction - The writability of the parameter (`\"ro\"` for read-only,\n * `\"rw\"` for read-write). See {@link HalParamDir}.\n * @returns A new `Param` object instance.\n * @throws Error if component is ready or if parameter creation fails.\n */\n newParam(nameSuffix, type, direction) {\n const success = this.nativeInstance.newParam(nameSuffix, constants_1.HalTypeValue[type], constants_1.HalParamDirValue[direction]);\n if (!success) {\n console.error(`Failed to create param '${nameSuffix}'`);\n }\n const param = new item_1.Param(this, nameSuffix, type, direction);\n this.params[nameSuffix] = param;\n this.setupItemListeners(param, nameSuffix);\n return param;\n }\n /**\n * Sets up auto-watch listeners for a pin or param.\n * @private\n */\n setupItemListeners(item, name) {\n item.on(\"newListener\", (event) => {\n if (event === \"change\" && !this.watchedItems.has(name)) {\n this.watchedItems.set(name, {\n item,\n lastValue: this.getValue(name),\n });\n this.ensureMonitoring();\n }\n });\n item.on(\"removeListener\", (event) => {\n if (event === \"change\" && item.listenerCount(\"change\") === 0) {\n this.watchedItems.delete(name);\n this.checkStopMonitoring();\n }\n });\n }\n /**\n * Marks this component as ready and available to the HAL system.\n *\n * Once ready, pins can be linked, and parameters can be accessed by other\n * HAL components or tools. Pins and parameters cannot be added after `ready()`\n * is called, unless `unready()` is called first.\n */\n ready() {\n this.nativeInstance.ready();\n }\n /**\n * Marks this component as not ready, allowing addition of more pins or parameters.\n *\n * `ready()` must be called again to make the component (and any new items)\n * available to HAL.\n */\n unready() {\n this.nativeInstance.unready();\n }\n /**\n * Retrieves a map of all `Pin` objects created for this component.\n *\n * @returns An object where keys are the `nameSuffix` of the pins and values\n * are the corresponding `Pin` instances.\n */\n getPins() {\n return this.pins;\n }\n /**\n * Retrieves a map of all `Param` objects created for this component.\n *\n * @returns An object where keys are the `nameSuffix` of the parameters and\n * values are the corresponding `Param` instances.\n */\n getParams() {\n return this.params;\n }\n /**\n * Gets a pin by name.\n *\n * @param name - The nameSuffix of the pin.\n * @returns The Pin instance, or undefined if not found.\n */\n getPin(name) {\n return this.pins[name];\n }\n /**\n * Gets a param by name.\n *\n * @param name - The nameSuffix of the param.\n * @returns The Param instance, or undefined if not found.\n */\n getParam(name) {\n return this.params[name];\n }\n /**\n * Gets the current cursor value for sync operations.\n *\n * The cursor is monotonically increasing and increments with each delta emit.\n *\n * @returns The current cursor value.\n */\n getCursor() {\n return this.cursor;\n }\n /**\n * Gets a snapshot of all current item values.\n *\n * Useful for initial sync or resync after cursor mismatch.\n *\n * @returns Object with items map, current cursor, and timestamp.\n */\n getSnapshot() {\n const items = {};\n for (const [name] of this.watchedItems.entries()) {\n items[name] = this.getValue(name);\n }\n return {\n items,\n cursor: this.cursor,\n timestamp: Date.now(),\n };\n }\n /**\n * Configures the monitoring system settings.\n *\n * The monitoring system will check for value changes at the specified interval.\n *\n * @param options - Configuration object with `pollInterval` property (in milliseconds).\n * Default polling interval is 10ms.\n */\n setMonitoringOptions(options) {\n this.monitoringOptions = { ...this.monitoringOptions, ...options };\n // Restart monitoring with new options if it's currently running\n if (this.monitoringTimer && this.watchedItems.size > 0) {\n this.stopMonitoring();\n this.startMonitoring();\n }\n }\n /**\n * Retrieves the current monitoring configuration.\n *\n * @returns A copy of the current monitoring options.\n */\n getMonitoringOptions() {\n return { ...this.monitoringOptions };\n }\n /**\n * Starts the monitoring timer if not already running.\n * @private\n */\n ensureMonitoring() {\n if (!this.monitoringTimer && this.watchedItems.size > 0) {\n this.startMonitoring();\n }\n }\n /**\n * Stops monitoring if no items are being watched.\n * @private\n */\n checkStopMonitoring() {\n if (this.watchedItems.size === 0) {\n this.stopMonitoring();\n }\n }\n /**\n * Starts the monitoring timer.\n * @private\n */\n startMonitoring() {\n if (this.monitoringTimer) {\n return;\n }\n this.monitoringTimer = setInterval(() => {\n this.checkForChanges();\n }, this.monitoringOptions.pollInterval || exports.DEFAULT_POLL_INTERVAL);\n }\n /**\n * Stops the monitoring timer.\n * @private\n */\n stopMonitoring() {\n if (this.monitoringTimer) {\n clearInterval(this.monitoringTimer);\n this.monitoringTimer = null;\n }\n }\n /**\n * Checks all watched items for value changes and emits events.\n *\n * Emits individual 'change' events on each HalItem, plus a batch 'delta'\n * event on the component with all changes aggregated.\n * @private\n */\n checkForChanges() {\n const changes = [];\n for (const [name, watched] of this.watchedItems.entries()) {\n try {\n const currentValue = this.getValue(name);\n if (currentValue !== watched.lastValue) {\n const oldValue = watched.lastValue;\n watched.lastValue = currentValue;\n watched.item.emit(\"change\", currentValue, oldValue);\n changes.push({ name, value: currentValue });\n }\n }\n catch (error) {\n console.error(`Error checking value for ${name}:`, error);\n }\n }\n // Emit batch delta if any changes occurred\n if (changes.length > 0) {\n this.cursor++;\n const delta = {\n changes,\n cursor: this.cursor,\n timestamp: Date.now(),\n };\n this.emit(\"delta\", delta);\n }\n }\n /**\n * Cleans up the component, stops monitoring and removes all listeners.\n *\n * Should be called when the component is no longer needed to prevent memory leaks.\n */\n dispose() {\n this.stopMonitoring();\n this.watchedItems.clear();\n // Remove all listeners from pins and params\n for (const pin of Object.values(this.pins)) {\n pin.removeAllListeners();\n }\n for (const param of Object.values(this.params)) {\n param.removeAllListeners();\n }\n }\n}\nexports.HalComponent = HalComponent;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.setSignalValue = exports.setPinParamValue = exports.pinHasWriter = exports.newSignal = exports.getInfoParams = exports.getInfoSignals = exports.getInfoPins = exports.getValue = exports.disconnect = exports.connect = exports.setMsgLevel = exports.getMsgLevel = void 0;\nconst constants_1 = require(\"./constants\");\n/**\n * Gets the current RTAPI message verbosity level used by HAL.\n *\n * @returns The current message level (e.g., `hal.MSG_INFO`).\n * See {@link RtapiMsgLevel} for available levels.\n */\nconst getMsgLevel = () => {\n const nativeValue = constants_1.halNative.get_msg_level();\n return constants_1.RtapiMsgLevelFromValue[nativeValue] ?? \"none\";\n};\nexports.getMsgLevel = getMsgLevel;\n/**\n * Sets the RTAPI message verbosity level.\n *\n * @param level - The new message level to set. See {@link RtapiMsgLevel} for available levels.\n */\nconst setMsgLevel = (level) => {\n constants_1.halNative.set_msg_level(constants_1.RtapiMsgLevelValue[level]);\n};\nexports.setMsgLevel = setMsgLevel;\n/**\n * Links a HAL pin to a HAL signal.\n *\n * @param pinName - The full name of the pin (e.g., \"my-comp.out1\").\n * @param signalName - The name of the signal to connect to.\n * @returns `true` on success, `false` on failure (error is thrown by native layer).\n * @throws Error if pin or signal doesn't exist, or if connection fails.\n */\nconst connect = (pinName, signalName) => {\n return constants_1.halNative.connect(pinName, signalName);\n};\nexports.connect = connect;\n/**\n * Unlinks a HAL pin from any signal it's currently connected to.\n *\n * @param pinName - The full name of the pin.\n * @returns `true` on success, `false` on failure (error is thrown).\n * @throws Error if pin doesn't exist or disconnect fails.\n */\nconst disconnect = (pinName) => {\n return constants_1.halNative.disconnect(pinName);\n};\nexports.disconnect = disconnect;\n/**\n * Gets the current value of any HAL item (pin, parameter, or signal) identified by its full name.\n *\n * @param name - The full name of the pin, parameter, or signal.\n * @returns The value of the item (number or boolean).\n * @throws Error if the item is not found.\n */\nconst getValue = (name) => {\n return constants_1.halNative.get_value(name);\n};\nexports.getValue = getValue;\n/**\n * Retrieves a list of all HAL pins currently in the system.\n *\n * @returns An array of `HalPinInfo` objects. See {@link HalPinInfo} for structure.\n */\nconst getInfoPins = () => {\n const nativePins = constants_1.halNative.get_info_pins();\n return nativePins.map((pin) => ({\n ...pin,\n type: constants_1.HalTypeFromValue[pin.type] ?? \"bit\",\n direction: constants_1.HalPinDirFromValue[pin.direction] ?? \"in\",\n }));\n};\nexports.getInfoPins = getInfoPins;\n/**\n * Retrieves a list of all HAL signals currently in the system.\n *\n * @returns An array of `HalSignalInfo` objects. See {@link HalSignalInfo} for structure.\n */\nconst getInfoSignals = () => {\n const nativeSignals = constants_1.halNative.get_info_signals();\n return nativeSignals.map((signal) => ({\n ...signal,\n type: constants_1.HalTypeFromValue[signal.type] ?? \"bit\",\n }));\n};\nexports.getInfoSignals = getInfoSignals;\n/**\n * Retrieves a list of all HAL parameters currently in the system.\n *\n * @returns An array of `HalParamInfo` objects. See {@link HalParamInfo} for structure.\n */\nconst getInfoParams = () => {\n const nativeParams = constants_1.halNative.get_info_params();\n return nativeParams.map((param) => ({\n ...param,\n type: constants_1.HalTypeFromValue[param.type] ?? \"bit\",\n direction: constants_1.HalParamDirFromValue[param.direction] ?? \"ro\",\n }));\n};\nexports.getInfoParams = getInfoParams;\n/**\n * Creates a new HAL signal.\n *\n * @param signalName - The desired name for the new signal.\n * @param type - The data type for the new signal. See {@link HalType} for available types.\n * @returns `true` on success, `false` on failure (error is thrown).\n * @throws Error if signal name already exists or creation fails.\n */\nconst newSignal = (signalName, type) => {\n return constants_1.halNative.new_sig(signalName, constants_1.HalTypeValue[type]);\n};\nexports.newSignal = newSignal;\n/**\n * Checks if the signal connected to an IN pin has at least one writer (another pin driving it).\n *\n * @param pinName - The full name of the IN pin.\n * @returns `true` if the pin is connected to a signal and that signal has one or more writers,\n * `false` otherwise.\n * @throws Error if the pin does not exist.\n */\nconst pinHasWriter = (pinName) => {\n return constants_1.halNative.pin_has_writer(pinName);\n};\nexports.pinHasWriter = pinHasWriter;\n/**\n * Sets the value of a HAL pin or parameter identified by its full name.\n *\n * The `value` is converted from its JavaScript type to a string and then parsed by\n * the C++ layer, similar to `halcmd setp`. This can set unconnected IN pins\n * (modifying their internal `dummysig`) or RW parameters.\n *\n * @param name - The full name of the pin or parameter.\n * @param value - The value to set (string, number, or boolean).\n * @returns `true` on success, `false` on failure (error is thrown).\n * @throws Error if item not found, if trying to set OUT pin or connected IN pin,\n * or if value conversion fails.\n *\n * @remarks Cannot set OUT pins or connected IN pins with this function.\n * Use direct signal manipulation or component proxy access for connected items.\n */\nconst setPinParamValue = (name, value) => {\n return constants_1.halNative.set_p(name, String(value));\n};\nexports.setPinParamValue = setPinParamValue;\n/**\n * Sets the value of an unconnected HAL signal identified by its name.\n *\n * The `value` is converted and parsed similarly to `setPinParamValue`.\n *\n * @param name - The full name of the signal.\n * @param value - The value to set (string, number, or boolean).\n * @returns `true` on success, `false` on failure (error is thrown).\n * @throws Error if signal not found, if signal has writers, or if value conversion fails.\n */\nconst setSignalValue = (name, value) => {\n return constants_1.halNative.set_s(name, String(value));\n};\nexports.setSignalValue = setSignalValue;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.setSignalValue = exports.setPinParamValue = exports.pinHasWriter = exports.newSignal = exports.getInfoParams = exports.getInfoSignals = exports.getInfoPins = exports.getValue = exports.disconnect = exports.connect = exports.setMsgLevel = exports.getMsgLevel = exports.Param = exports.Pin = exports.HalItem = exports.HalComponent = void 0;\n// --- Exported classes ---\nvar component_1 = require(\"./component\");\nObject.defineProperty(exports, \"HalComponent\", { enumerable: true, get: function () { return component_1.HalComponent; } });\nvar item_1 = require(\"./item\");\nObject.defineProperty(exports, \"HalItem\", { enumerable: true, get: function () { return item_1.HalItem; } });\nObject.defineProperty(exports, \"Pin\", { enumerable: true, get: function () { return item_1.Pin; } });\nObject.defineProperty(exports, \"Param\", { enumerable: true, get: function () { return item_1.Param; } });\n// --- Global functions ---\nvar functions_1 = require(\"./functions\");\nObject.defineProperty(exports, \"getMsgLevel\", { enumerable: true, get: function () { return functions_1.getMsgLevel; } });\nObject.defineProperty(exports, \"setMsgLevel\", { enumerable: true, get: function () { return functions_1.setMsgLevel; } });\nObject.defineProperty(exports, \"connect\", { enumerable: true, get: function () { return functions_1.connect; } });\nObject.defineProperty(exports, \"disconnect\", { enumerable: true, get: function () { return functions_1.disconnect; } });\nObject.defineProperty(exports, \"getValue\", { enumerable: true, get: function () { return functions_1.getValue; } });\nObject.defineProperty(exports, \"getInfoPins\", { enumerable: true, get: function () { return functions_1.getInfoPins; } });\nObject.defineProperty(exports, \"getInfoSignals\", { enumerable: true, get: function () { return functions_1.getInfoSignals; } });\nObject.defineProperty(exports, \"getInfoParams\", { enumerable: true, get: function () { return functions_1.getInfoParams; } });\nObject.defineProperty(exports, \"newSignal\", { enumerable: true, get: function () { return functions_1.newSignal; } });\nObject.defineProperty(exports, \"pinHasWriter\", { enumerable: true, get: function () { return functions_1.pinHasWriter; } });\nObject.defineProperty(exports, \"setPinParamValue\", { enumerable: true, get: function () { return functions_1.setPinParamValue; } });\nObject.defineProperty(exports, \"setSignalValue\", { enumerable: true, get: function () { return functions_1.setSignalValue; } });\n","'use strict';\n\nconst WIN_SLASH = '\\\\\\\\/';\nconst WIN_NO_SLASH = `[^${WIN_SLASH}]`;\n\nconst DEFAULT_MAX_EXTGLOB_RECURSION = 0;\n\n/**\n * Posix glob regex\n */\n\nconst DOT_LITERAL = '\\\\.';\nconst PLUS_LITERAL = '\\\\+';\nconst QMARK_LITERAL = '\\\\?';\nconst SLASH_LITERAL = '\\\\/';\nconst ONE_CHAR = '(?=.)';\nconst QMARK = '[^/]';\nconst END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;\nconst START_ANCHOR = `(?:^|${SLASH_LITERAL})`;\nconst DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;\nconst NO_DOT = `(?!${DOT_LITERAL})`;\nconst NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;\nconst NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;\nconst NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;\nconst QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;\nconst STAR = `${QMARK}*?`;\nconst SEP = '/';\n\nconst POSIX_CHARS = {\n DOT_LITERAL,\n PLUS_LITERAL,\n QMARK_LITERAL,\n SLASH_LITERAL,\n ONE_CHAR,\n QMARK,\n END_ANCHOR,\n DOTS_SLASH,\n NO_DOT,\n NO_DOTS,\n NO_DOT_SLASH,\n NO_DOTS_SLASH,\n QMARK_NO_DOT,\n STAR,\n START_ANCHOR,\n SEP\n};\n\n/**\n * Windows glob regex\n */\n\nconst WINDOWS_CHARS = {\n ...POSIX_CHARS,\n\n SLASH_LITERAL: `[${WIN_SLASH}]`,\n QMARK: WIN_NO_SLASH,\n STAR: `${WIN_NO_SLASH}*?`,\n DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,\n NO_DOT: `(?!${DOT_LITERAL})`,\n NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,\n NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,\n NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,\n QMARK_NO_DOT: `[^.${WIN_SLASH}]`,\n START_ANCHOR: `(?:^|[${WIN_SLASH}])`,\n END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,\n SEP: '\\\\'\n};\n\n/**\n * POSIX Bracket Regex\n */\n\nconst POSIX_REGEX_SOURCE = {\n __proto__: null,\n alnum: 'a-zA-Z0-9',\n alpha: 'a-zA-Z',\n ascii: '\\\\x00-\\\\x7F',\n blank: ' \\\\t',\n cntrl: '\\\\x00-\\\\x1F\\\\x7F',\n digit: '0-9',\n graph: '\\\\x21-\\\\x7E',\n lower: 'a-z',\n print: '\\\\x20-\\\\x7E ',\n punct: '\\\\-!\"#$%&\\'()\\\\*+,./:;<=>?@[\\\\]^_`{|}~',\n space: ' \\\\t\\\\r\\\\n\\\\v\\\\f',\n upper: 'A-Z',\n word: 'A-Za-z0-9_',\n xdigit: 'A-Fa-f0-9'\n};\n\nmodule.exports = {\n DEFAULT_MAX_EXTGLOB_RECURSION,\n MAX_LENGTH: 1024 * 64,\n POSIX_REGEX_SOURCE,\n\n // regular expressions\n REGEX_BACKSLASH: /\\\\(?![*+?^${}(|)[\\]])/g,\n REGEX_NON_SPECIAL_CHARS: /^[^@![\\].,$*+?^{}()|\\\\/]+/,\n REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\\]]/,\n REGEX_SPECIAL_CHARS_BACKREF: /(\\\\?)((\\W)(\\3*))/g,\n REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\\]])/g,\n REGEX_REMOVE_BACKSLASH: /(?:\\[.*?[^\\\\]\\]|\\\\(?=.))/g,\n\n // Replace globs with equivalent patterns to reduce parsing time.\n REPLACEMENTS: {\n __proto__: null,\n '***': '*',\n '**/**': '**',\n '**/**/**': '**'\n },\n\n // Digits\n CHAR_0: 48, /* 0 */\n CHAR_9: 57, /* 9 */\n\n // Alphabet chars.\n CHAR_UPPERCASE_A: 65, /* A */\n CHAR_LOWERCASE_A: 97, /* a */\n CHAR_UPPERCASE_Z: 90, /* Z */\n CHAR_LOWERCASE_Z: 122, /* z */\n\n CHAR_LEFT_PARENTHESES: 40, /* ( */\n CHAR_RIGHT_PARENTHESES: 41, /* ) */\n\n CHAR_ASTERISK: 42, /* * */\n\n // Non-alphabetic chars.\n CHAR_AMPERSAND: 38, /* & */\n CHAR_AT: 64, /* @ */\n CHAR_BACKWARD_SLASH: 92, /* \\ */\n CHAR_CARRIAGE_RETURN: 13, /* \\r */\n CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */\n CHAR_COLON: 58, /* : */\n CHAR_COMMA: 44, /* , */\n CHAR_DOT: 46, /* . */\n CHAR_DOUBLE_QUOTE: 34, /* \" */\n CHAR_EQUAL: 61, /* = */\n CHAR_EXCLAMATION_MARK: 33, /* ! */\n CHAR_FORM_FEED: 12, /* \\f */\n CHAR_FORWARD_SLASH: 47, /* / */\n CHAR_GRAVE_ACCENT: 96, /* ` */\n CHAR_HASH: 35, /* # */\n CHAR_HYPHEN_MINUS: 45, /* - */\n CHAR_LEFT_ANGLE_BRACKET: 60, /* < */\n CHAR_LEFT_CURLY_BRACE: 123, /* { */\n CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */\n CHAR_LINE_FEED: 10, /* \\n */\n CHAR_NO_BREAK_SPACE: 160, /* \\u00A0 */\n CHAR_PERCENT: 37, /* % */\n CHAR_PLUS: 43, /* + */\n CHAR_QUESTION_MARK: 63, /* ? */\n CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */\n CHAR_RIGHT_CURLY_BRACE: 125, /* } */\n CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */\n CHAR_SEMICOLON: 59, /* ; */\n CHAR_SINGLE_QUOTE: 39, /* ' */\n CHAR_SPACE: 32, /* */\n CHAR_TAB: 9, /* \\t */\n CHAR_UNDERSCORE: 95, /* _ */\n CHAR_VERTICAL_LINE: 124, /* | */\n CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \\uFEFF */\n\n /**\n * Create EXTGLOB_CHARS\n */\n\n extglobChars(chars) {\n return {\n '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` },\n '?': { type: 'qmark', open: '(?:', close: ')?' },\n '+': { type: 'plus', open: '(?:', close: ')+' },\n '*': { type: 'star', open: '(?:', close: ')*' },\n '@': { type: 'at', open: '(?:', close: ')' }\n };\n },\n\n /**\n * Create GLOB_CHARS\n */\n\n globChars(win32) {\n return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;\n }\n};\n","/*global navigator*/\n'use strict';\n\nconst {\n REGEX_BACKSLASH,\n REGEX_REMOVE_BACKSLASH,\n REGEX_SPECIAL_CHARS,\n REGEX_SPECIAL_CHARS_GLOBAL\n} = require('./constants');\n\nexports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);\nexports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);\nexports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);\nexports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\\\$1');\nexports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');\n\nexports.isWindows = () => {\n if (typeof navigator !== 'undefined' && navigator.platform) {\n const platform = navigator.platform.toLowerCase();\n return platform === 'win32' || platform === 'windows';\n }\n\n if (typeof process !== 'undefined' && process.platform) {\n return process.platform === 'win32';\n }\n\n return false;\n};\n\nexports.removeBackslashes = str => {\n return str.replace(REGEX_REMOVE_BACKSLASH, match => {\n return match === '\\\\' ? '' : match;\n });\n};\n\nexports.escapeLast = (input, char, lastIdx) => {\n const idx = input.lastIndexOf(char, lastIdx);\n if (idx === -1) return input;\n if (input[idx - 1] === '\\\\') return exports.escapeLast(input, char, idx - 1);\n return `${input.slice(0, idx)}\\\\${input.slice(idx)}`;\n};\n\nexports.removePrefix = (input, state = {}) => {\n let output = input;\n if (output.startsWith('./')) {\n output = output.slice(2);\n state.prefix = './';\n }\n return output;\n};\n\nexports.wrapOutput = (input, state = {}, options = {}) => {\n const prepend = options.contains ? '' : '^';\n const append = options.contains ? '' : '$';\n\n let output = `${prepend}(?:${input})${append}`;\n if (state.negated === true) {\n output = `(?:^(?!${output}).*$)`;\n }\n return output;\n};\n\nexports.basename = (path, { windows } = {}) => {\n const segs = path.split(windows ? /[\\\\/]/ : '/');\n const last = segs[segs.length - 1];\n\n if (last === '') {\n return segs[segs.length - 2];\n }\n\n return last;\n};\n","'use strict';\n\nconst utils = require('./utils');\nconst {\n CHAR_ASTERISK, /* * */\n CHAR_AT, /* @ */\n CHAR_BACKWARD_SLASH, /* \\ */\n CHAR_COMMA, /* , */\n CHAR_DOT, /* . */\n CHAR_EXCLAMATION_MARK, /* ! */\n CHAR_FORWARD_SLASH, /* / */\n CHAR_LEFT_CURLY_BRACE, /* { */\n CHAR_LEFT_PARENTHESES, /* ( */\n CHAR_LEFT_SQUARE_BRACKET, /* [ */\n CHAR_PLUS, /* + */\n CHAR_QUESTION_MARK, /* ? */\n CHAR_RIGHT_CURLY_BRACE, /* } */\n CHAR_RIGHT_PARENTHESES, /* ) */\n CHAR_RIGHT_SQUARE_BRACKET /* ] */\n} = require('./constants');\n\nconst isPathSeparator = code => {\n return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;\n};\n\nconst depth = token => {\n if (token.isPrefix !== true) {\n token.depth = token.isGlobstar ? Infinity : 1;\n }\n};\n\n/**\n * Quickly scans a glob pattern and returns an object with a handful of\n * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),\n * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not\n * with `!(`) and `negatedExtglob` (true if the path starts with `!(`).\n *\n * ```js\n * const pm = require('picomatch');\n * console.log(pm.scan('foo/bar/*.js'));\n * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }\n * ```\n * @param {String} `str`\n * @param {Object} `options`\n * @return {Object} Returns an object with tokens and regex source string.\n * @api public\n */\n\nconst scan = (input, options) => {\n const opts = options || {};\n\n const length = input.length - 1;\n const scanToEnd = opts.parts === true || opts.scanToEnd === true;\n const slashes = [];\n const tokens = [];\n const parts = [];\n\n let str = input;\n let index = -1;\n let start = 0;\n let lastIndex = 0;\n let isBrace = false;\n let isBracket = false;\n let isGlob = false;\n let isExtglob = false;\n let isGlobstar = false;\n let braceEscaped = false;\n let backslashes = false;\n let negated = false;\n let negatedExtglob = false;\n let finished = false;\n let braces = 0;\n let prev;\n let code;\n let token = { value: '', depth: 0, isGlob: false };\n\n const eos = () => index >= length;\n const peek = () => str.charCodeAt(index + 1);\n const advance = () => {\n prev = code;\n return str.charCodeAt(++index);\n };\n\n while (index < length) {\n code = advance();\n let next;\n\n if (code === CHAR_BACKWARD_SLASH) {\n backslashes = token.backslashes = true;\n code = advance();\n\n if (code === CHAR_LEFT_CURLY_BRACE) {\n braceEscaped = true;\n }\n continue;\n }\n\n if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {\n braces++;\n\n while (eos() !== true && (code = advance())) {\n if (code === CHAR_BACKWARD_SLASH) {\n backslashes = token.backslashes = true;\n advance();\n continue;\n }\n\n if (code === CHAR_LEFT_CURLY_BRACE) {\n braces++;\n continue;\n }\n\n if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {\n isBrace = token.isBrace = true;\n isGlob = token.isGlob = true;\n finished = true;\n\n if (scanToEnd === true) {\n continue;\n }\n\n break;\n }\n\n if (braceEscaped !== true && code === CHAR_COMMA) {\n isBrace = token.isBrace = true;\n isGlob = token.isGlob = true;\n finished = true;\n\n if (scanToEnd === true) {\n continue;\n }\n\n break;\n }\n\n if (code === CHAR_RIGHT_CURLY_BRACE) {\n braces--;\n\n if (braces === 0) {\n braceEscaped = false;\n isBrace = token.isBrace = true;\n finished = true;\n break;\n }\n }\n }\n\n if (scanToEnd === true) {\n continue;\n }\n\n break;\n }\n\n if (code === CHAR_FORWARD_SLASH) {\n slashes.push(index);\n tokens.push(token);\n token = { value: '', depth: 0, isGlob: false };\n\n if (finished === true) continue;\n if (prev === CHAR_DOT && index === (start + 1)) {\n start += 2;\n continue;\n }\n\n lastIndex = index + 1;\n continue;\n }\n\n if (opts.noext !== true) {\n const isExtglobChar = code === CHAR_PLUS\n || code === CHAR_AT\n || code === CHAR_ASTERISK\n || code === CHAR_QUESTION_MARK\n || code === CHAR_EXCLAMATION_MARK;\n\n if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {\n isGlob = token.isGlob = true;\n isExtglob = token.isExtglob = true;\n finished = true;\n if (code === CHAR_EXCLAMATION_MARK && index === start) {\n negatedExtglob = true;\n }\n\n if (scanToEnd === true) {\n while (eos() !== true && (code = advance())) {\n if (code === CHAR_BACKWARD_SLASH) {\n backslashes = token.backslashes = true;\n code = advance();\n continue;\n }\n\n if (code === CHAR_RIGHT_PARENTHESES) {\n isGlob = token.isGlob = true;\n finished = true;\n break;\n }\n }\n continue;\n }\n break;\n }\n }\n\n if (code === CHAR_ASTERISK) {\n if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;\n isGlob = token.isGlob = true;\n finished = true;\n\n if (scanToEnd === true) {\n continue;\n }\n break;\n }\n\n if (code === CHAR_QUESTION_MARK) {\n isGlob = token.isGlob = true;\n finished = true;\n\n if (scanToEnd === true) {\n continue;\n }\n break;\n }\n\n if (code === CHAR_LEFT_SQUARE_BRACKET) {\n while (eos() !== true && (next = advance())) {\n if (next === CHAR_BACKWARD_SLASH) {\n backslashes = token.backslashes = true;\n advance();\n continue;\n }\n\n if (next === CHAR_RIGHT_SQUARE_BRACKET) {\n isBracket = token.isBracket = true;\n isGlob = token.isGlob = true;\n finished = true;\n break;\n }\n }\n\n if (scanToEnd === true) {\n continue;\n }\n\n break;\n }\n\n if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {\n negated = token.negated = true;\n start++;\n continue;\n }\n\n if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {\n isGlob = token.isGlob = true;\n\n if (scanToEnd === true) {\n while (eos() !== true && (code = advance())) {\n if (code === CHAR_LEFT_PARENTHESES) {\n backslashes = token.backslashes = true;\n code = advance();\n continue;\n }\n\n if (code === CHAR_RIGHT_PARENTHESES) {\n finished = true;\n break;\n }\n }\n continue;\n }\n break;\n }\n\n if (isGlob === true) {\n finished = true;\n\n if (scanToEnd === true) {\n continue;\n }\n\n break;\n }\n }\n\n if (opts.noext === true) {\n isExtglob = false;\n isGlob = false;\n }\n\n let base = str;\n let prefix = '';\n let glob = '';\n\n if (start > 0) {\n prefix = str.slice(0, start);\n str = str.slice(start);\n lastIndex -= start;\n }\n\n if (base && isGlob === true && lastIndex > 0) {\n base = str.slice(0, lastIndex);\n glob = str.slice(lastIndex);\n } else if (isGlob === true) {\n base = '';\n glob = str;\n } else {\n base = str;\n }\n\n if (base && base !== '' && base !== '/' && base !== str) {\n if (isPathSeparator(base.charCodeAt(base.length - 1))) {\n base = base.slice(0, -1);\n }\n }\n\n if (opts.unescape === true) {\n if (glob) glob = utils.removeBackslashes(glob);\n\n if (base && backslashes === true) {\n base = utils.removeBackslashes(base);\n }\n }\n\n const state = {\n prefix,\n input,\n start,\n base,\n glob,\n isBrace,\n isBracket,\n isGlob,\n isExtglob,\n isGlobstar,\n negated,\n negatedExtglob\n };\n\n if (opts.tokens === true) {\n state.maxDepth = 0;\n if (!isPathSeparator(code)) {\n tokens.push(token);\n }\n state.tokens = tokens;\n }\n\n if (opts.parts === true || opts.tokens === true) {\n let prevIndex;\n\n for (let idx = 0; idx < slashes.length; idx++) {\n const n = prevIndex ? prevIndex + 1 : start;\n const i = slashes[idx];\n const value = input.slice(n, i);\n if (opts.tokens) {\n if (idx === 0 && start !== 0) {\n tokens[idx].isPrefix = true;\n tokens[idx].value = prefix;\n } else {\n tokens[idx].value = value;\n }\n depth(tokens[idx]);\n state.maxDepth += tokens[idx].depth;\n }\n if (idx !== 0 || value !== '') {\n parts.push(value);\n }\n prevIndex = i;\n }\n\n if (prevIndex && prevIndex + 1 < input.length) {\n const value = input.slice(prevIndex + 1);\n parts.push(value);\n\n if (opts.tokens) {\n tokens[tokens.length - 1].value = value;\n depth(tokens[tokens.length - 1]);\n state.maxDepth += tokens[tokens.length - 1].depth;\n }\n }\n\n state.slashes = slashes;\n state.parts = parts;\n }\n\n return state;\n};\n\nmodule.exports = scan;\n","'use strict';\n\nconst constants = require('./constants');\nconst utils = require('./utils');\n\n/**\n * Constants\n */\n\nconst {\n MAX_LENGTH,\n POSIX_REGEX_SOURCE,\n REGEX_NON_SPECIAL_CHARS,\n REGEX_SPECIAL_CHARS_BACKREF,\n REPLACEMENTS\n} = constants;\n\n/**\n * Helpers\n */\n\nconst expandRange = (args, options) => {\n if (typeof options.expandRange === 'function') {\n return options.expandRange(...args, options);\n }\n\n args.sort();\n const value = `[${args.join('-')}]`;\n\n try {\n /* eslint-disable-next-line no-new */\n new RegExp(value);\n } catch (ex) {\n return args.map(v => utils.escapeRegex(v)).join('..');\n }\n\n return value;\n};\n\n/**\n * Create the message for a syntax error\n */\n\nconst syntaxError = (type, char) => {\n return `Missing ${type}: \"${char}\" - use \"\\\\\\\\${char}\" to match literal characters`;\n};\n\nconst splitTopLevel = input => {\n const parts = [];\n let bracket = 0;\n let paren = 0;\n let quote = 0;\n let value = '';\n let escaped = false;\n\n for (const ch of input) {\n if (escaped === true) {\n value += ch;\n escaped = false;\n continue;\n }\n\n if (ch === '\\\\') {\n value += ch;\n escaped = true;\n continue;\n }\n\n if (ch === '\"') {\n quote = quote === 1 ? 0 : 1;\n value += ch;\n continue;\n }\n\n if (quote === 0) {\n if (ch === '[') {\n bracket++;\n } else if (ch === ']' && bracket > 0) {\n bracket--;\n } else if (bracket === 0) {\n if (ch === '(') {\n paren++;\n } else if (ch === ')' && paren > 0) {\n paren--;\n } else if (ch === '|' && paren === 0) {\n parts.push(value);\n value = '';\n continue;\n }\n }\n }\n\n value += ch;\n }\n\n parts.push(value);\n return parts;\n};\n\nconst isPlainBranch = branch => {\n let escaped = false;\n\n for (const ch of branch) {\n if (escaped === true) {\n escaped = false;\n continue;\n }\n\n if (ch === '\\\\') {\n escaped = true;\n continue;\n }\n\n if (/[?*+@!()[\\]{}]/.test(ch)) {\n return false;\n }\n }\n\n return true;\n};\n\nconst normalizeSimpleBranch = branch => {\n let value = branch.trim();\n let changed = true;\n\n while (changed === true) {\n changed = false;\n\n if (/^@\\([^\\\\()[\\]{}|]+\\)$/.test(value)) {\n value = value.slice(2, -1);\n changed = true;\n }\n }\n\n if (!isPlainBranch(value)) {\n return;\n }\n\n return value.replace(/\\\\(.)/g, '$1');\n};\n\nconst hasRepeatedCharPrefixOverlap = branches => {\n const values = branches.map(normalizeSimpleBranch).filter(Boolean);\n\n for (let i = 0; i < values.length; i++) {\n for (let j = i + 1; j < values.length; j++) {\n const a = values[i];\n const b = values[j];\n const char = a[0];\n\n if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) {\n continue;\n }\n\n if (a === b || a.startsWith(b) || b.startsWith(a)) {\n return true;\n }\n }\n }\n\n return false;\n};\n\nconst parseRepeatedExtglob = (pattern, requireEnd = true) => {\n if ((pattern[0] !== '+' && pattern[0] !== '*') || pattern[1] !== '(') {\n return;\n }\n\n let bracket = 0;\n let paren = 0;\n let quote = 0;\n let escaped = false;\n\n for (let i = 1; i < pattern.length; i++) {\n const ch = pattern[i];\n\n if (escaped === true) {\n escaped = false;\n continue;\n }\n\n if (ch === '\\\\') {\n escaped = true;\n continue;\n }\n\n if (ch === '\"') {\n quote = quote === 1 ? 0 : 1;\n continue;\n }\n\n if (quote === 1) {\n continue;\n }\n\n if (ch === '[') {\n bracket++;\n continue;\n }\n\n if (ch === ']' && bracket > 0) {\n bracket--;\n continue;\n }\n\n if (bracket > 0) {\n continue;\n }\n\n if (ch === '(') {\n paren++;\n continue;\n }\n\n if (ch === ')') {\n paren--;\n\n if (paren === 0) {\n if (requireEnd === true && i !== pattern.length - 1) {\n return;\n }\n\n return {\n type: pattern[0],\n body: pattern.slice(2, i),\n end: i\n };\n }\n }\n }\n};\n\nconst getStarExtglobSequenceOutput = pattern => {\n let index = 0;\n const chars = [];\n\n while (index < pattern.length) {\n const match = parseRepeatedExtglob(pattern.slice(index), false);\n\n if (!match || match.type !== '*') {\n return;\n }\n\n const branches = splitTopLevel(match.body).map(branch => branch.trim());\n if (branches.length !== 1) {\n return;\n }\n\n const branch = normalizeSimpleBranch(branches[0]);\n if (!branch || branch.length !== 1) {\n return;\n }\n\n chars.push(branch);\n index += match.end + 1;\n }\n\n if (chars.length < 1) {\n return;\n }\n\n const source = chars.length === 1\n ? utils.escapeRegex(chars[0])\n : `[${chars.map(ch => utils.escapeRegex(ch)).join('')}]`;\n\n return `${source}*`;\n};\n\nconst repeatedExtglobRecursion = pattern => {\n let depth = 0;\n let value = pattern.trim();\n let match = parseRepeatedExtglob(value);\n\n while (match) {\n depth++;\n value = match.body.trim();\n match = parseRepeatedExtglob(value);\n }\n\n return depth;\n};\n\nconst analyzeRepeatedExtglob = (body, options) => {\n if (options.maxExtglobRecursion === false) {\n return { risky: false };\n }\n\n const max =\n typeof options.maxExtglobRecursion === 'number'\n ? options.maxExtglobRecursion\n : constants.DEFAULT_MAX_EXTGLOB_RECURSION;\n\n const branches = splitTopLevel(body).map(branch => branch.trim());\n\n if (branches.length > 1) {\n if (\n branches.some(branch => branch === '') ||\n branches.some(branch => /^[*?]+$/.test(branch)) ||\n hasRepeatedCharPrefixOverlap(branches)\n ) {\n return { risky: true };\n }\n }\n\n for (const branch of branches) {\n const safeOutput = getStarExtglobSequenceOutput(branch);\n if (safeOutput) {\n return { risky: true, safeOutput };\n }\n\n if (repeatedExtglobRecursion(branch) > max) {\n return { risky: true };\n }\n }\n\n return { risky: false };\n};\n\n/**\n * Parse the given input string.\n * @param {String} input\n * @param {Object} options\n * @return {Object}\n */\n\nconst parse = (input, options) => {\n if (typeof input !== 'string') {\n throw new TypeError('Expected a string');\n }\n\n input = REPLACEMENTS[input] || input;\n\n const opts = { ...options };\n const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;\n\n let len = input.length;\n if (len > max) {\n throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);\n }\n\n const bos = { type: 'bos', value: '', output: opts.prepend || '' };\n const tokens = [bos];\n\n const capture = opts.capture ? '' : '?:';\n\n // create constants based on platform, for windows or posix\n const PLATFORM_CHARS = constants.globChars(opts.windows);\n const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);\n\n const {\n DOT_LITERAL,\n PLUS_LITERAL,\n SLASH_LITERAL,\n ONE_CHAR,\n DOTS_SLASH,\n NO_DOT,\n NO_DOT_SLASH,\n NO_DOTS_SLASH,\n QMARK,\n QMARK_NO_DOT,\n STAR,\n START_ANCHOR\n } = PLATFORM_CHARS;\n\n const globstar = opts => {\n return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;\n };\n\n const nodot = opts.dot ? '' : NO_DOT;\n const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;\n let star = opts.bash === true ? globstar(opts) : STAR;\n\n if (opts.capture) {\n star = `(${star})`;\n }\n\n // minimatch options support\n if (typeof opts.noext === 'boolean') {\n opts.noextglob = opts.noext;\n }\n\n const state = {\n input,\n index: -1,\n start: 0,\n dot: opts.dot === true,\n consumed: '',\n output: '',\n prefix: '',\n backtrack: false,\n negated: false,\n brackets: 0,\n braces: 0,\n parens: 0,\n quotes: 0,\n globstar: false,\n tokens\n };\n\n input = utils.removePrefix(input, state);\n len = input.length;\n\n const extglobs = [];\n const braces = [];\n const stack = [];\n let prev = bos;\n let value;\n\n /**\n * Tokenizing helpers\n */\n\n const eos = () => state.index === len - 1;\n const peek = state.peek = (n = 1) => input[state.index + n];\n const advance = state.advance = () => input[++state.index] || '';\n const remaining = () => input.slice(state.index + 1);\n const consume = (value = '', num = 0) => {\n state.consumed += value;\n state.index += num;\n };\n\n const append = token => {\n state.output += token.output != null ? token.output : token.value;\n consume(token.value);\n };\n\n const negate = () => {\n let count = 1;\n\n while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) {\n advance();\n state.start++;\n count++;\n }\n\n if (count % 2 === 0) {\n return false;\n }\n\n state.negated = true;\n state.start++;\n return true;\n };\n\n const increment = type => {\n state[type]++;\n stack.push(type);\n };\n\n const decrement = type => {\n state[type]--;\n stack.pop();\n };\n\n /**\n * Push tokens onto the tokens array. This helper speeds up\n * tokenizing by 1) helping us avoid backtracking as much as possible,\n * and 2) helping us avoid creating extra tokens when consecutive\n * characters are plain text. This improves performance and simplifies\n * lookbehinds.\n */\n\n const push = tok => {\n if (prev.type === 'globstar') {\n const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace');\n const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren'));\n\n if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) {\n state.output = state.output.slice(0, -prev.output.length);\n prev.type = 'star';\n prev.value = '*';\n prev.output = star;\n state.output += prev.output;\n }\n }\n\n if (extglobs.length && tok.type !== 'paren') {\n extglobs[extglobs.length - 1].inner += tok.value;\n }\n\n if (tok.value || tok.output) append(tok);\n if (prev && prev.type === 'text' && tok.type === 'text') {\n prev.output = (prev.output || prev.value) + tok.value;\n prev.value += tok.value;\n return;\n }\n\n tok.prev = prev;\n tokens.push(tok);\n prev = tok;\n };\n\n const extglobOpen = (type, value) => {\n const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' };\n\n token.prev = prev;\n token.parens = state.parens;\n token.output = state.output;\n token.startIndex = state.index;\n token.tokensIndex = tokens.length;\n const output = (opts.capture ? '(' : '') + token.open;\n\n increment('parens');\n push({ type, value, output: state.output ? '' : ONE_CHAR });\n push({ type: 'paren', extglob: true, value: advance(), output });\n extglobs.push(token);\n };\n\n const extglobClose = token => {\n const literal = input.slice(token.startIndex, state.index + 1);\n const body = input.slice(token.startIndex + 2, state.index);\n const analysis = analyzeRepeatedExtglob(body, opts);\n\n if ((token.type === 'plus' || token.type === 'star') && analysis.risky) {\n const safeOutput = analysis.safeOutput\n ? (token.output ? '' : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput)\n : undefined;\n const open = tokens[token.tokensIndex];\n\n open.type = 'text';\n open.value = literal;\n open.output = safeOutput || utils.escapeRegex(literal);\n\n for (let i = token.tokensIndex + 1; i < tokens.length; i++) {\n tokens[i].value = '';\n tokens[i].output = '';\n delete tokens[i].suffix;\n }\n\n state.output = token.output + open.output;\n state.backtrack = true;\n\n push({ type: 'paren', extglob: true, value, output: '' });\n decrement('parens');\n return;\n }\n\n let output = token.close + (opts.capture ? ')' : '');\n let rest;\n\n if (token.type === 'negate') {\n let extglobStar = star;\n\n if (token.inner && token.inner.length > 1 && token.inner.includes('/')) {\n extglobStar = globstar(opts);\n }\n\n if (extglobStar !== star || eos() || /^\\)+$/.test(remaining())) {\n output = token.close = `)$))${extglobStar}`;\n }\n\n if (token.inner.includes('*') && (rest = remaining()) && /^\\.[^\\\\/.]+$/.test(rest)) {\n // Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis.\n // In this case, we need to parse the string and use it in the output of the original pattern.\n // Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`.\n //\n // Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`.\n const expression = parse(rest, { ...options, fastpaths: false }).output;\n\n output = token.close = `)${expression})${extglobStar})`;\n }\n\n if (token.prev.type === 'bos') {\n state.negatedExtglob = true;\n }\n }\n\n push({ type: 'paren', extglob: true, value, output });\n decrement('parens');\n };\n\n /**\n * Fast paths\n */\n\n if (opts.fastpaths !== false && !/(^[*!]|[/()[\\]{}\"])/.test(input)) {\n let backslashes = false;\n\n let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {\n if (first === '\\\\') {\n backslashes = true;\n return m;\n }\n\n if (first === '?') {\n if (esc) {\n return esc + first + (rest ? QMARK.repeat(rest.length) : '');\n }\n if (index === 0) {\n return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');\n }\n return QMARK.repeat(chars.length);\n }\n\n if (first === '.') {\n return DOT_LITERAL.repeat(chars.length);\n }\n\n if (first === '*') {\n if (esc) {\n return esc + first + (rest ? star : '');\n }\n return star;\n }\n return esc ? m : `\\\\${m}`;\n });\n\n if (backslashes === true) {\n if (opts.unescape === true) {\n output = output.replace(/\\\\/g, '');\n } else {\n output = output.replace(/\\\\+/g, m => {\n return m.length % 2 === 0 ? '\\\\\\\\' : (m ? '\\\\' : '');\n });\n }\n }\n\n if (output === input && opts.contains === true) {\n state.output = input;\n return state;\n }\n\n state.output = utils.wrapOutput(output, state, options);\n return state;\n }\n\n /**\n * Tokenize input until we reach end-of-string\n */\n\n while (!eos()) {\n value = advance();\n\n if (value === '\\u0000') {\n continue;\n }\n\n /**\n * Escaped characters\n */\n\n if (value === '\\\\') {\n const next = peek();\n\n if (next === '/' && opts.bash !== true) {\n continue;\n }\n\n if (next === '.' || next === ';') {\n continue;\n }\n\n if (!next) {\n value += '\\\\';\n push({ type: 'text', value });\n continue;\n }\n\n // collapse slashes to reduce potential for exploits\n const match = /^\\\\+/.exec(remaining());\n let slashes = 0;\n\n if (match && match[0].length > 2) {\n slashes = match[0].length;\n state.index += slashes;\n if (slashes % 2 !== 0) {\n value += '\\\\';\n }\n }\n\n if (opts.unescape === true) {\n value = advance();\n } else {\n value += advance();\n }\n\n if (state.brackets === 0) {\n push({ type: 'text', value });\n continue;\n }\n }\n\n /**\n * If we're inside a regex character class, continue\n * until we reach the closing bracket.\n */\n\n if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) {\n if (opts.posix !== false && value === ':') {\n const inner = prev.value.slice(1);\n if (inner.includes('[')) {\n prev.posix = true;\n\n if (inner.includes(':')) {\n const idx = prev.value.lastIndexOf('[');\n const pre = prev.value.slice(0, idx);\n const rest = prev.value.slice(idx + 2);\n const posix = POSIX_REGEX_SOURCE[rest];\n if (posix) {\n prev.value = pre + posix;\n state.backtrack = true;\n advance();\n\n if (!bos.output && tokens.indexOf(prev) === 1) {\n bos.output = ONE_CHAR;\n }\n continue;\n }\n }\n }\n }\n\n if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) {\n value = `\\\\${value}`;\n }\n\n if (value === ']' && (prev.value === '[' || prev.value === '[^')) {\n value = `\\\\${value}`;\n }\n\n if (opts.posix === true && value === '!' && prev.value === '[') {\n value = '^';\n }\n\n prev.value += value;\n append({ value });\n continue;\n }\n\n /**\n * If we're inside a quoted string, continue\n * until we reach the closing double quote.\n */\n\n if (state.quotes === 1 && value !== '\"') {\n value = utils.escapeRegex(value);\n prev.value += value;\n append({ value });\n continue;\n }\n\n /**\n * Double quotes\n */\n\n if (value === '\"') {\n state.quotes = state.quotes === 1 ? 0 : 1;\n if (opts.keepQuotes === true) {\n push({ type: 'text', value });\n }\n continue;\n }\n\n /**\n * Parentheses\n */\n\n if (value === '(') {\n increment('parens');\n push({ type: 'paren', value });\n continue;\n }\n\n if (value === ')') {\n if (state.parens === 0 && opts.strictBrackets === true) {\n throw new SyntaxError(syntaxError('opening', '('));\n }\n\n const extglob = extglobs[extglobs.length - 1];\n if (extglob && state.parens === extglob.parens + 1) {\n extglobClose(extglobs.pop());\n continue;\n }\n\n push({ type: 'paren', value, output: state.parens ? ')' : '\\\\)' });\n decrement('parens');\n continue;\n }\n\n /**\n * Square brackets\n */\n\n if (value === '[') {\n if (opts.nobracket === true || !remaining().includes(']')) {\n if (opts.nobracket !== true && opts.strictBrackets === true) {\n throw new SyntaxError(syntaxError('closing', ']'));\n }\n\n value = `\\\\${value}`;\n } else {\n increment('brackets');\n }\n\n push({ type: 'bracket', value });\n continue;\n }\n\n if (value === ']') {\n if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) {\n push({ type: 'text', value, output: `\\\\${value}` });\n continue;\n }\n\n if (state.brackets === 0) {\n if (opts.strictBrackets === true) {\n throw new SyntaxError(syntaxError('opening', '['));\n }\n\n push({ type: 'text', value, output: `\\\\${value}` });\n continue;\n }\n\n decrement('brackets');\n\n const prevValue = prev.value.slice(1);\n if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) {\n value = `/${value}`;\n }\n\n prev.value += value;\n append({ value });\n\n // when literal brackets are explicitly disabled\n // assume we should match with a regex character class\n if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {\n continue;\n }\n\n const escaped = utils.escapeRegex(prev.value);\n state.output = state.output.slice(0, -prev.value.length);\n\n // when literal brackets are explicitly enabled\n // assume we should escape the brackets to match literal characters\n if (opts.literalBrackets === true) {\n state.output += escaped;\n prev.value = escaped;\n continue;\n }\n\n // when the user specifies nothing, try to match both\n prev.value = `(${capture}${escaped}|${prev.value})`;\n state.output += prev.value;\n continue;\n }\n\n /**\n * Braces\n */\n\n if (value === '{' && opts.nobrace !== true) {\n increment('braces');\n\n const open = {\n type: 'brace',\n value,\n output: '(',\n outputIndex: state.output.length,\n tokensIndex: state.tokens.length\n };\n\n braces.push(open);\n push(open);\n continue;\n }\n\n if (value === '}') {\n const brace = braces[braces.length - 1];\n\n if (opts.nobrace === true || !brace) {\n push({ type: 'text', value, output: value });\n continue;\n }\n\n let output = ')';\n\n if (brace.dots === true) {\n const arr = tokens.slice();\n const range = [];\n\n for (let i = arr.length - 1; i >= 0; i--) {\n tokens.pop();\n if (arr[i].type === 'brace') {\n break;\n }\n if (arr[i].type !== 'dots') {\n range.unshift(arr[i].value);\n }\n }\n\n output = expandRange(range, opts);\n state.backtrack = true;\n }\n\n if (brace.comma !== true && brace.dots !== true) {\n const out = state.output.slice(0, brace.outputIndex);\n const toks = state.tokens.slice(brace.tokensIndex);\n brace.value = brace.output = '\\\\{';\n value = output = '\\\\}';\n state.output = out;\n for (const t of toks) {\n state.output += (t.output || t.value);\n }\n }\n\n push({ type: 'brace', value, output });\n decrement('braces');\n braces.pop();\n continue;\n }\n\n /**\n * Pipes\n */\n\n if (value === '|') {\n if (extglobs.length > 0) {\n extglobs[extglobs.length - 1].conditions++;\n }\n push({ type: 'text', value });\n continue;\n }\n\n /**\n * Commas\n */\n\n if (value === ',') {\n let output = value;\n\n const brace = braces[braces.length - 1];\n if (brace && stack[stack.length - 1] === 'braces') {\n brace.comma = true;\n output = '|';\n }\n\n push({ type: 'comma', value, output });\n continue;\n }\n\n /**\n * Slashes\n */\n\n if (value === '/') {\n // if the beginning of the glob is \"./\", advance the start\n // to the current index, and don't add the \"./\" characters\n // to the state. This greatly simplifies lookbehinds when\n // checking for BOS characters like \"!\" and \".\" (not \"./\")\n if (prev.type === 'dot' && state.index === state.start + 1) {\n state.start = state.index + 1;\n state.consumed = '';\n state.output = '';\n tokens.pop();\n prev = bos; // reset \"prev\" to the first token\n continue;\n }\n\n push({ type: 'slash', value, output: SLASH_LITERAL });\n continue;\n }\n\n /**\n * Dots\n */\n\n if (value === '.') {\n if (state.braces > 0 && prev.type === 'dot') {\n if (prev.value === '.') prev.output = DOT_LITERAL;\n const brace = braces[braces.length - 1];\n prev.type = 'dots';\n prev.output += value;\n prev.value += value;\n brace.dots = true;\n continue;\n }\n\n if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') {\n push({ type: 'text', value, output: DOT_LITERAL });\n continue;\n }\n\n push({ type: 'dot', value, output: DOT_LITERAL });\n continue;\n }\n\n /**\n * Question marks\n */\n\n if (value === '?') {\n const isGroup = prev && prev.value === '(';\n if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {\n extglobOpen('qmark', value);\n continue;\n }\n\n if (prev && prev.type === 'paren') {\n const next = peek();\n let output = value;\n\n if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\\w+>)/.test(remaining()))) {\n output = `\\\\${value}`;\n }\n\n push({ type: 'text', value, output });\n continue;\n }\n\n if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) {\n push({ type: 'qmark', value, output: QMARK_NO_DOT });\n continue;\n }\n\n push({ type: 'qmark', value, output: QMARK });\n continue;\n }\n\n /**\n * Exclamation\n */\n\n if (value === '!') {\n if (opts.noextglob !== true && peek() === '(') {\n if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) {\n extglobOpen('negate', value);\n continue;\n }\n }\n\n if (opts.nonegate !== true && state.index === 0) {\n negate();\n continue;\n }\n }\n\n /**\n * Plus\n */\n\n if (value === '+') {\n if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {\n extglobOpen('plus', value);\n continue;\n }\n\n if ((prev && prev.value === '(') || opts.regex === false) {\n push({ type: 'plus', value, output: PLUS_LITERAL });\n continue;\n }\n\n if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) {\n push({ type: 'plus', value });\n continue;\n }\n\n push({ type: 'plus', value: PLUS_LITERAL });\n continue;\n }\n\n /**\n * Plain text\n */\n\n if (value === '@') {\n if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {\n push({ type: 'at', extglob: true, value, output: '' });\n continue;\n }\n\n push({ type: 'text', value });\n continue;\n }\n\n /**\n * Plain text\n */\n\n if (value !== '*') {\n if (value === '$' || value === '^') {\n value = `\\\\${value}`;\n }\n\n const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());\n if (match) {\n value += match[0];\n state.index += match[0].length;\n }\n\n push({ type: 'text', value });\n continue;\n }\n\n /**\n * Stars\n */\n\n if (prev && (prev.type === 'globstar' || prev.star === true)) {\n prev.type = 'star';\n prev.star = true;\n prev.value += value;\n prev.output = star;\n state.backtrack = true;\n state.globstar = true;\n consume(value);\n continue;\n }\n\n let rest = remaining();\n if (opts.noextglob !== true && /^\\([^?]/.test(rest)) {\n extglobOpen('star', value);\n continue;\n }\n\n if (prev.type === 'star') {\n if (opts.noglobstar === true) {\n consume(value);\n continue;\n }\n\n const prior = prev.prev;\n const before = prior.prev;\n const isStart = prior.type === 'slash' || prior.type === 'bos';\n const afterStar = before && (before.type === 'star' || before.type === 'globstar');\n\n if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) {\n push({ type: 'star', value, output: '' });\n continue;\n }\n\n const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace');\n const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren');\n if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) {\n push({ type: 'star', value, output: '' });\n continue;\n }\n\n // strip consecutive `/**/`\n while (rest.slice(0, 3) === '/**') {\n const after = input[state.index + 4];\n if (after && after !== '/') {\n break;\n }\n rest = rest.slice(3);\n consume('/**', 3);\n }\n\n if (prior.type === 'bos' && eos()) {\n prev.type = 'globstar';\n prev.value += value;\n prev.output = globstar(opts);\n state.output = prev.output;\n state.globstar = true;\n consume(value);\n continue;\n }\n\n if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) {\n state.output = state.output.slice(0, -(prior.output + prev.output).length);\n prior.output = `(?:${prior.output}`;\n\n prev.type = 'globstar';\n prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');\n prev.value += value;\n state.globstar = true;\n state.output += prior.output + prev.output;\n consume(value);\n continue;\n }\n\n if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') {\n const end = rest[1] !== void 0 ? '|$' : '';\n\n state.output = state.output.slice(0, -(prior.output + prev.output).length);\n prior.output = `(?:${prior.output}`;\n\n prev.type = 'globstar';\n prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;\n prev.value += value;\n\n state.output += prior.output + prev.output;\n state.globstar = true;\n\n consume(value + advance());\n\n push({ type: 'slash', value: '/', output: '' });\n continue;\n }\n\n if (prior.type === 'bos' && rest[0] === '/') {\n prev.type = 'globstar';\n prev.value += value;\n prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;\n state.output = prev.output;\n state.globstar = true;\n consume(value + advance());\n push({ type: 'slash', value: '/', output: '' });\n continue;\n }\n\n // remove single star from output\n state.output = state.output.slice(0, -prev.output.length);\n\n // reset previous token to globstar\n prev.type = 'globstar';\n prev.output = globstar(opts);\n prev.value += value;\n\n // reset output with globstar\n state.output += prev.output;\n state.globstar = true;\n consume(value);\n continue;\n }\n\n const token = { type: 'star', value, output: star };\n\n if (opts.bash === true) {\n token.output = '.*?';\n if (prev.type === 'bos' || prev.type === 'slash') {\n token.output = nodot + token.output;\n }\n push(token);\n continue;\n }\n\n if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) {\n token.output = value;\n push(token);\n continue;\n }\n\n if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') {\n if (prev.type === 'dot') {\n state.output += NO_DOT_SLASH;\n prev.output += NO_DOT_SLASH;\n\n } else if (opts.dot === true) {\n state.output += NO_DOTS_SLASH;\n prev.output += NO_DOTS_SLASH;\n\n } else {\n state.output += nodot;\n prev.output += nodot;\n }\n\n if (peek() !== '*') {\n state.output += ONE_CHAR;\n prev.output += ONE_CHAR;\n }\n }\n\n push(token);\n }\n\n while (state.brackets > 0) {\n if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']'));\n state.output = utils.escapeLast(state.output, '[');\n decrement('brackets');\n }\n\n while (state.parens > 0) {\n if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')'));\n state.output = utils.escapeLast(state.output, '(');\n decrement('parens');\n }\n\n while (state.braces > 0) {\n if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}'));\n state.output = utils.escapeLast(state.output, '{');\n decrement('braces');\n }\n\n if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) {\n push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` });\n }\n\n // rebuild the output if we had to backtrack at any point\n if (state.backtrack === true) {\n state.output = '';\n\n for (const token of state.tokens) {\n state.output += token.output != null ? token.output : token.value;\n\n if (token.suffix) {\n state.output += token.suffix;\n }\n }\n }\n\n return state;\n};\n\n/**\n * Fast paths for creating regular expressions for common glob patterns.\n * This can significantly speed up processing and has very little downside\n * impact when none of the fast paths match.\n */\n\nparse.fastpaths = (input, options) => {\n const opts = { ...options };\n const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;\n const len = input.length;\n if (len > max) {\n throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);\n }\n\n input = REPLACEMENTS[input] || input;\n\n // create constants based on platform, for windows or posix\n const {\n DOT_LITERAL,\n SLASH_LITERAL,\n ONE_CHAR,\n DOTS_SLASH,\n NO_DOT,\n NO_DOTS,\n NO_DOTS_SLASH,\n STAR,\n START_ANCHOR\n } = constants.globChars(opts.windows);\n\n const nodot = opts.dot ? NO_DOTS : NO_DOT;\n const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;\n const capture = opts.capture ? '' : '?:';\n const state = { negated: false, prefix: '' };\n let star = opts.bash === true ? '.*?' : STAR;\n\n if (opts.capture) {\n star = `(${star})`;\n }\n\n const globstar = opts => {\n if (opts.noglobstar === true) return star;\n return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;\n };\n\n const create = str => {\n switch (str) {\n case '*':\n return `${nodot}${ONE_CHAR}${star}`;\n\n case '.*':\n return `${DOT_LITERAL}${ONE_CHAR}${star}`;\n\n case '*.*':\n return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;\n\n case '*/*':\n return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;\n\n case '**':\n return nodot + globstar(opts);\n\n case '**/*':\n return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;\n\n case '**/*.*':\n return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;\n\n case '**/.*':\n return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;\n\n default: {\n const match = /^(.*?)\\.(\\w+)$/.exec(str);\n if (!match) return;\n\n const source = create(match[1]);\n if (!source) return;\n\n return source + DOT_LITERAL + match[2];\n }\n }\n };\n\n const output = utils.removePrefix(input, state);\n let source = create(output);\n\n if (source && opts.strictSlashes !== true) {\n source += `${SLASH_LITERAL}?`;\n }\n\n return source;\n};\n\nmodule.exports = parse;\n","'use strict';\n\nconst scan = require('./scan');\nconst parse = require('./parse');\nconst utils = require('./utils');\nconst constants = require('./constants');\nconst isObject = val => val && typeof val === 'object' && !Array.isArray(val);\n\n/**\n * Creates a matcher function from one or more glob patterns. The\n * returned function takes a string to match as its first argument,\n * and returns true if the string is a match. The returned matcher\n * function also takes a boolean as the second argument that, when true,\n * returns an object with additional information.\n *\n * ```js\n * const picomatch = require('picomatch');\n * // picomatch(glob[, options]);\n *\n * const isMatch = picomatch('*.!(*a)');\n * console.log(isMatch('a.a')); //=> false\n * console.log(isMatch('a.b')); //=> true\n * ```\n * @name picomatch\n * @param {String|Array} `globs` One or more glob patterns.\n * @param {Object=} `options`\n * @return {Function=} Returns a matcher function.\n * @api public\n */\n\nconst picomatch = (glob, options, returnState = false) => {\n if (Array.isArray(glob)) {\n const fns = glob.map(input => picomatch(input, options, returnState));\n const arrayMatcher = str => {\n for (const isMatch of fns) {\n const state = isMatch(str);\n if (state) return state;\n }\n return false;\n };\n return arrayMatcher;\n }\n\n const isState = isObject(glob) && glob.tokens && glob.input;\n\n if (glob === '' || (typeof glob !== 'string' && !isState)) {\n throw new TypeError('Expected pattern to be a non-empty string');\n }\n\n const opts = options || {};\n const posix = opts.windows;\n const regex = isState\n ? picomatch.compileRe(glob, options)\n : picomatch.makeRe(glob, options, false, true);\n\n const state = regex.state;\n delete regex.state;\n\n let isIgnored = () => false;\n if (opts.ignore) {\n const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };\n isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);\n }\n\n const matcher = (input, returnObject = false) => {\n const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });\n const result = { glob, state, regex, posix, input, output, match, isMatch };\n\n if (typeof opts.onResult === 'function') {\n opts.onResult(result);\n }\n\n if (isMatch === false) {\n result.isMatch = false;\n return returnObject ? result : false;\n }\n\n if (isIgnored(input)) {\n if (typeof opts.onIgnore === 'function') {\n opts.onIgnore(result);\n }\n result.isMatch = false;\n return returnObject ? result : false;\n }\n\n if (typeof opts.onMatch === 'function') {\n opts.onMatch(result);\n }\n return returnObject ? result : true;\n };\n\n if (returnState) {\n matcher.state = state;\n }\n\n return matcher;\n};\n\n/**\n * Test `input` with the given `regex`. This is used by the main\n * `picomatch()` function to test the input string.\n *\n * ```js\n * const picomatch = require('picomatch');\n * // picomatch.test(input, regex[, options]);\n *\n * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\\/([^/]*?))$/));\n * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }\n * ```\n * @param {String} `input` String to test.\n * @param {RegExp} `regex`\n * @return {Object} Returns an object with matching info.\n * @api public\n */\n\npicomatch.test = (input, regex, options, { glob, posix } = {}) => {\n if (typeof input !== 'string') {\n throw new TypeError('Expected input to be a string');\n }\n\n if (input === '') {\n return { isMatch: false, output: '' };\n }\n\n const opts = options || {};\n const format = opts.format || (posix ? utils.toPosixSlashes : null);\n let match = input === glob;\n let output = (match && format) ? format(input) : input;\n\n if (match === false) {\n output = format ? format(input) : input;\n match = output === glob;\n }\n\n if (match === false || opts.capture === true) {\n if (opts.matchBase === true || opts.basename === true) {\n match = picomatch.matchBase(input, regex, options, posix);\n } else {\n match = regex.exec(output);\n }\n }\n\n return { isMatch: Boolean(match), match, output };\n};\n\n/**\n * Match the basename of a filepath.\n *\n * ```js\n * const picomatch = require('picomatch');\n * // picomatch.matchBase(input, glob[, options]);\n * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true\n * ```\n * @param {String} `input` String to test.\n * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).\n * @return {Boolean}\n * @api public\n */\n\npicomatch.matchBase = (input, glob, options) => {\n const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);\n return regex.test(utils.basename(input));\n};\n\n/**\n * Returns true if **any** of the given glob `patterns` match the specified `string`.\n *\n * ```js\n * const picomatch = require('picomatch');\n * // picomatch.isMatch(string, patterns[, options]);\n *\n * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true\n * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false\n * ```\n * @param {String|Array} str The string to test.\n * @param {String|Array} patterns One or more glob patterns to use for matching.\n * @param {Object} [options] See available [options](#options).\n * @return {Boolean} Returns true if any patterns match `str`\n * @api public\n */\n\npicomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);\n\n/**\n * Parse a glob pattern to create the source string for a regular\n * expression.\n *\n * ```js\n * const picomatch = require('picomatch');\n * const result = picomatch.parse(pattern[, options]);\n * ```\n * @param {String} `pattern`\n * @param {Object} `options`\n * @return {Object} Returns an object with useful properties and output to be used as a regex source string.\n * @api public\n */\n\npicomatch.parse = (pattern, options) => {\n if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options));\n return parse(pattern, { ...options, fastpaths: false });\n};\n\n/**\n * Scan a glob pattern to separate the pattern into segments.\n *\n * ```js\n * const picomatch = require('picomatch');\n * // picomatch.scan(input[, options]);\n *\n * const result = picomatch.scan('!./foo/*.js');\n * console.log(result);\n * { prefix: '!./',\n * input: '!./foo/*.js',\n * start: 3,\n * base: 'foo',\n * glob: '*.js',\n * isBrace: false,\n * isBracket: false,\n * isGlob: true,\n * isExtglob: false,\n * isGlobstar: false,\n * negated: true }\n * ```\n * @param {String} `input` Glob pattern to scan.\n * @param {Object} `options`\n * @return {Object} Returns an object with\n * @api public\n */\n\npicomatch.scan = (input, options) => scan(input, options);\n\n/**\n * Compile a regular expression from the `state` object returned by the\n * [parse()](#parse) method.\n *\n * ```js\n * const picomatch = require('picomatch');\n * const state = picomatch.parse('*.js');\n * // picomatch.compileRe(state[, options]);\n *\n * console.log(picomatch.compileRe(state));\n * //=> /^(?:(?!\\.)(?=.)[^/]*?\\.js)$/\n * ```\n * @param {Object} `state`\n * @param {Object} `options`\n * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.\n * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.\n * @return {RegExp}\n * @api public\n */\n\npicomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {\n if (returnOutput === true) {\n return state.output;\n }\n\n const opts = options || {};\n const prepend = opts.contains ? '' : '^';\n const append = opts.contains ? '' : '$';\n\n let source = `${prepend}(?:${state.output})${append}`;\n if (state && state.negated === true) {\n source = `^(?!${source}).*$`;\n }\n\n const regex = picomatch.toRegex(source, options);\n if (returnState === true) {\n regex.state = state;\n }\n\n return regex;\n};\n\n/**\n * Create a regular expression from a parsed glob pattern.\n *\n * ```js\n * const picomatch = require('picomatch');\n * // picomatch.makeRe(state[, options]);\n *\n * const result = picomatch.makeRe('*.js');\n * console.log(result);\n * //=> /^(?:(?!\\.)(?=.)[^/]*?\\.js)$/\n * ```\n * @param {String} `state` The object returned from the `.parse` method.\n * @param {Object} `options`\n * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.\n * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.\n * @return {RegExp} Returns a regex created from the given pattern.\n * @api public\n */\n\npicomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {\n if (!input || typeof input !== 'string') {\n throw new TypeError('Expected a non-empty string');\n }\n\n let parsed = { negated: false, fastpaths: true };\n\n if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {\n parsed.output = parse.fastpaths(input, options);\n }\n\n if (!parsed.output) {\n parsed = parse(input, options);\n }\n\n return picomatch.compileRe(parsed, options, returnOutput, returnState);\n};\n\n/**\n * Create a regular expression from the given regex source string.\n *\n * ```js\n * const picomatch = require('picomatch');\n * // picomatch.toRegex(source[, options]);\n *\n * const { output } = picomatch.parse('*.js');\n * console.log(picomatch.toRegex(output));\n * //=> /^(?:(?!\\.)(?=.)[^/]*?\\.js)$/\n * ```\n * @param {String} `source` Regular expression source string.\n * @param {Object} `options`\n * @return {RegExp}\n * @api public\n */\n\npicomatch.toRegex = (source, options) => {\n try {\n const opts = options || {};\n return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));\n } catch (err) {\n if (options && options.debug === true) throw err;\n return /$^/;\n }\n};\n\n/**\n * Picomatch constants.\n * @return {Object}\n */\n\npicomatch.constants = constants;\n\n/**\n * Expose \"picomatch\"\n */\n\nmodule.exports = picomatch;\n","'use strict';\n\nconst pico = require('./lib/picomatch');\nconst utils = require('./lib/utils');\n\nfunction picomatch(glob, options, returnState = false) {\n // default to os.platform()\n if (options && (options.windows === null || options.windows === undefined)) {\n // don't mutate the original options object\n options = { ...options, windows: utils.isWindows() };\n }\n\n return pico(glob, options, returnState);\n}\n\nObject.assign(picomatch, pico);\nmodule.exports = picomatch;\n","/**\n * LinuxCNC Service\n *\n * Exposes LinuxCNC status monitoring and command execution via AppBus.\n * Implements LinuxCNCProtocol from @linuxcnc-node/eden-protocol.\n */\n\nimport {\n StatChannel,\n CommandChannel,\n CommandTransport,\n ErrorChannel,\n} from \"@linuxcnc-node/core\";\nimport { StatChange } from \"@linuxcnc-node/types\";\nimport type { NativeCommandName } from \"@linuxcnc-node/types\";\nimport type { LinuxCNCProtocol } from \"@linuxcnc-node/eden-protocol\";\nimport type { HostConnection } from \"@edenapp/types\";\nimport delve from \"dlv\";\nconst SERVICE_NAME = \"linuxcnc\";\n\n// Shared state across all connections\nlet statChannel: StatChannel | null = null;\nlet commandChannel: CommandChannel | null = null;\nlet commandTransport: CommandTransport | null = null;\nlet errorChannel: ErrorChannel | null = null;\n\n// Connected clients\nconst connections = new Map<string, HostConnection<LinuxCNCProtocol>>();\n\n/**\n * Broadcast stat delta to all connected clients\n */\nfunction broadcastDelta(changes: StatChange[]): void {\n if (changes.length === 0 || !statChannel) return;\n\n const message = {\n changes,\n cursor: statChannel.getCursor(),\n timestamp: Date.now(),\n };\n\n for (const conn of connections.values()) {\n try {\n conn.send(\"stat-delta\", message);\n } catch (err) {\n console.error(\"[LinuxCNC] Error sending delta:\", err);\n }\n }\n}\n\n/**\n * Initialize the LinuxCNC service\n */\nexport function initLinuxCNCService(): void {\n // Create channels (shared across all connections)\n statChannel = new StatChannel({ pollInterval: 50 });\n commandChannel = new CommandChannel();\n commandTransport = new CommandTransport();\n errorChannel = new ErrorChannel({ pollInterval: 100 });\n\n // Listen to native delta updates from StatChannel\n statChannel.on(\"delta\", broadcastDelta);\n\n // Forward error channel events\n errorChannel.on(\"message\", (error) => {\n for (const conn of connections.values()) {\n try {\n conn.send(\"error-channel-event\", error);\n } catch (err) {\n console.error(\"[LinuxCNC] Error forwarding error event:\", err);\n }\n }\n });\n\n // Expose the service\n worker!.appBus.exposeService(\n SERVICE_NAME,\n (connection, { appId: clientAppId }) => {\n console.log(`[LinuxCNC] Client connected: ${clientAppId}`);\n\n const typedConn = connection as HostConnection<LinuxCNCProtocol>;\n connections.set(clientAppId, typedConn);\n\n // Handle disconnect\n connection.onClose(() => {\n console.log(`[LinuxCNC] Client disconnected: ${clientAppId}`);\n connections.delete(clientAppId);\n });\n\n // === STAT HANDLERS ===\n\n typedConn.handle(\"stat/sync\", () => {\n const stat = statChannel!.get();\n if (!stat) {\n throw new Error(\"StatChannel not ready\");\n }\n\n return {\n stat,\n cursor: statChannel!.getCursor(),\n };\n });\n\n typedConn.handle(\"stat/get-value\", ({ path }) => {\n const stat = statChannel!.get();\n if (!stat) {\n throw new Error(\"StatChannel not ready\");\n }\n return { value: delve(stat, path) };\n });\n\n // === COMMAND HANDLERS ===\n\n typedConn.handle(\n \"cmd-v2/send\",\n async ({ operationId, name, args, tracking, completionTimeout }) => {\n const handle = commandTransport!.send(\n name as NativeCommandName,\n args ?? [],\n { tracking, completionTimeout }\n );\n const accepted = await handle.accepted;\n\n if (handle.completed) {\n void handle.completed.then(\n (status) => {\n typedConn.send(\"cmd-v2/completed\", {\n operationId,\n status,\n serial: accepted.serial,\n });\n },\n (error: unknown) => {\n typedConn.send(\"cmd-v2/error\", {\n operationId,\n message: errorMessage(error),\n serial: accepted.serial,\n });\n }\n );\n }\n\n return accepted;\n }\n );\n\n typedConn.handle(\"cmd/set-task-mode\", async ({ mode }) => {\n return commandChannel!.setTaskMode(mode);\n });\n\n typedConn.handle(\"cmd/set-state\", async ({ state }) => {\n return commandChannel!.setState(state);\n });\n\n typedConn.handle(\"cmd/mdi\", async ({ command }) => {\n return commandChannel!.mdi(command);\n });\n\n typedConn.handle(\"cmd/stop\", async () => {\n return commandChannel!.stop();\n });\n\n typedConn.handle(\"cmd/abort\", async () => {\n return commandChannel!.abortTask();\n });\n\n typedConn.handle(\"cmd/task-plan-synch\", async () => {\n return commandChannel!.taskPlanSynch();\n });\n\n typedConn.handle(\"cmd/reset-interpreter\", async () => {\n return commandChannel!.resetInterpreter();\n });\n\n // Program control\n typedConn.handle(\"cmd/program-open\", async ({ filePath }) => {\n return commandChannel!.programOpen(filePath);\n });\n\n typedConn.handle(\"cmd/program-close\", async () => {\n return commandChannel!.programClose();\n });\n\n typedConn.handle(\"cmd/program-run\", async ({ startLine }) => {\n return commandChannel!.runProgram(startLine ?? 0);\n });\n\n typedConn.handle(\"cmd/program-pause\", async () => {\n return commandChannel!.pauseProgram();\n });\n\n typedConn.handle(\"cmd/program-resume\", async () => {\n return commandChannel!.resumeProgram();\n });\n\n typedConn.handle(\"cmd/program-step\", async () => {\n return commandChannel!.stepProgram();\n });\n\n typedConn.handle(\"cmd/program-reverse\", async () => {\n return commandChannel!.reverseProgram();\n });\n\n typedConn.handle(\"cmd/program-forward\", async () => {\n return commandChannel!.forwardProgram();\n });\n\n // Motion control\n typedConn.handle(\"cmd/set-feed-rate\", async ({ scale }) => {\n return commandChannel!.setFeedRate(scale);\n });\n\n typedConn.handle(\"cmd/set-rapid-rate\", async ({ scale }) => {\n return commandChannel!.setRapidRate(scale);\n });\n\n typedConn.handle(\"cmd/set-max-velocity\", async ({ velocity }) => {\n return commandChannel!.setMaxVelocity(velocity);\n });\n\n typedConn.handle(\"cmd/set-traj-mode\", async ({ mode }) => {\n return commandChannel!.setTrajMode(mode);\n });\n\n typedConn.handle(\"cmd/teleop-enable\", async ({ enable }) => {\n return commandChannel!.teleopEnable(enable);\n });\n\n typedConn.handle(\"cmd/set-feed-override-enable\", async ({ enable }) => {\n return commandChannel!.setFeedOverrideEnable(enable);\n });\n\n typedConn.handle(\"cmd/set-feed-hold-enable\", async ({ enable }) => {\n return commandChannel!.setFeedHoldEnable(enable);\n });\n\n typedConn.handle(\"cmd/set-adaptive-feed-enable\", async ({ enable }) => {\n return commandChannel!.setAdaptiveFeedEnable(enable);\n });\n\n // Jogging - note: CommandChannel uses (axis, isJoint, speed) order\n typedConn.handle(\n \"cmd/jog-continuous\",\n async ({ axis, speed, isJoint }) => {\n return commandChannel!.jogContinuous(axis, isJoint ?? false, speed);\n }\n );\n\n typedConn.handle(\n \"cmd/jog-increment\",\n async ({ axis, speed, increment, isJoint }) => {\n return commandChannel!.jogIncrement(\n axis,\n isJoint ?? false,\n speed,\n increment\n );\n }\n );\n\n typedConn.handle(\"cmd/jog-stop\", async ({ axis, isJoint }) => {\n return commandChannel!.jogStop(axis, isJoint ?? false);\n });\n\n // Homing\n typedConn.handle(\"cmd/home\", async ({ joint }) => {\n return commandChannel!.homeJoint(joint);\n });\n\n typedConn.handle(\"cmd/unhome\", async ({ joint }) => {\n return commandChannel!.unhomeJoint(joint);\n });\n\n typedConn.handle(\n \"cmd/set-min-position-limit\",\n async ({ joint, limit }) => {\n return commandChannel!.setMinPositionLimit(joint, limit);\n }\n );\n\n typedConn.handle(\n \"cmd/set-max-position-limit\",\n async ({ joint, limit }) => {\n return commandChannel!.setMaxPositionLimit(joint, limit);\n }\n );\n\n // Spindle\n typedConn.handle(\"cmd/spindle-on\", async ({ speed, spindle, wait }) => {\n return commandChannel!.spindleOn(speed, spindle ?? 0, wait ?? false);\n });\n\n typedConn.handle(\"cmd/spindle-off\", async ({ spindle }) => {\n return commandChannel!.spindleOff(spindle ?? 0);\n });\n\n typedConn.handle(\"cmd/spindle-override\", async ({ scale, spindle }) => {\n return commandChannel!.setSpindleOverride(scale, spindle ?? 0);\n });\n\n typedConn.handle(\"cmd/spindle-brake\", async ({ engage, spindle }) => {\n return commandChannel!.spindleBrake(engage, spindle ?? 0);\n });\n\n typedConn.handle(\"cmd/spindle-increase\", async ({ spindle }) => {\n return commandChannel!.spindleIncrease(spindle ?? 0);\n });\n\n typedConn.handle(\"cmd/spindle-decrease\", async ({ spindle }) => {\n return commandChannel!.spindleDecrease(spindle ?? 0);\n });\n\n typedConn.handle(\n \"cmd/set-spindle-override-enable\",\n async ({ enable, spindle }) => {\n return commandChannel!.setSpindleOverrideEnable(enable, spindle ?? 0);\n }\n );\n\n // Coolant\n typedConn.handle(\"cmd/set-mist\", async ({ on }) => {\n return commandChannel!.setMist(on);\n });\n\n typedConn.handle(\"cmd/set-flood\", async ({ on }) => {\n return commandChannel!.setFlood(on);\n });\n\n // Tool\n typedConn.handle(\"cmd/load-tool-table\", async () => {\n return commandChannel!.loadToolTable();\n });\n\n typedConn.handle(\"cmd/set-tool\", async ({ tool }) => {\n return commandChannel!.setTool(tool);\n });\n\n // I/O\n typedConn.handle(\"cmd/set-digital-output\", async ({ index, value }) => {\n return commandChannel!.setDigitalOutput(index, value);\n });\n\n typedConn.handle(\"cmd/set-analog-output\", async ({ index, value }) => {\n return commandChannel!.setAnalogOutput(index, value);\n });\n\n // Misc\n typedConn.handle(\"cmd/override-limits\", async () => {\n return commandChannel!.overrideLimits();\n });\n\n typedConn.handle(\"cmd/set-optional-stop\", async ({ enable }) => {\n return commandChannel!.setOptionalStop(enable);\n });\n\n typedConn.handle(\"cmd/set-block-delete\", async ({ enable }) => {\n return commandChannel!.setBlockDelete(enable);\n });\n\n typedConn.handle(\"cmd/set-debug-level\", async ({ level }) => {\n return commandChannel!.setDebugLevel(level);\n });\n\n typedConn.handle(\"cmd/send-operator-error\", async ({ message }) => {\n return commandChannel!.sendOperatorError(message);\n });\n\n typedConn.handle(\"cmd/send-operator-text\", async ({ message }) => {\n return commandChannel!.sendOperatorText(message);\n });\n\n typedConn.handle(\"cmd/send-operator-display\", async ({ message }) => {\n return commandChannel!.sendOperatorDisplay(message);\n });\n\n // Connection\n typedConn.handle(\"ping\", () => {\n return { timestamp: Date.now() };\n });\n },\n { description: \"LinuxCNC status monitoring and command execution\" }\n );\n\n console.log(`[LinuxCNC] Service exposed as '${SERVICE_NAME}'`);\n}\n\nfunction errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n","/**\n * G-Code Service\n *\n * Exposes G-code parsing via AppBus using LinuxCNC's rs274ngc interpreter.\n * Implements GCodeProtocol from @linuxcnc-node/eden-protocol.\n */\n\nimport { parseGCode } from \"@linuxcnc-node/gcode\";\nimport type { GCodeProtocol } from \"@linuxcnc-node/eden-protocol\";\nimport type { HostConnection } from \"@edenapp/types\";\n\nconst SERVICE_NAME = \"gcode\";\n\n/**\n * Initialize the G-code service\n */\nexport function initGCodeService(): void {\n worker!.appBus.exposeService(\n SERVICE_NAME,\n (connection, { appId: clientAppId }) => {\n console.log(`[GCode] Client connected: ${clientAppId}`);\n\n const typedConn = connection as HostConnection<GCodeProtocol>;\n\n // Handle disconnect\n connection.onClose(() => {\n console.log(`[GCode] Client disconnected: ${clientAppId}`);\n });\n\n // Parse handler\n typedConn.handle(\n \"parse\",\n async ({ filepath, iniPath, progressUpdates }) => {\n try {\n const result = await parseGCode(filepath, {\n iniPath,\n progressUpdates: progressUpdates ?? 40,\n onProgress: (progress) => {\n // Stream progress updates to the client\n try {\n typedConn.send(\"parse-progress\", progress);\n } catch (err) {\n // Client may have disconnected\n console.error(\"[GCode] Error sending progress:\", err);\n }\n },\n });\n\n return result;\n } catch (err) {\n // Send error message\n typedConn.send(\"error\", {\n code: \"PARSE_ERROR\",\n message: err instanceof Error ? err.message : String(err),\n });\n throw err;\n }\n }\n );\n\n // Ping handler\n typedConn.handle(\"ping\", () => {\n return { timestamp: Date.now() };\n });\n },\n { description: \"G-code file parsing using LinuxCNC interpreter\" }\n );\n\n console.log(`[GCode] Service exposed as '${SERVICE_NAME}'`);\n}\n","/**\n * HAL Service\n *\n * Exposes HAL component management and I/O access via AppBus.\n * Each connection gets its own HalComponent lifecycle.\n * Implements HalProtocol from @linuxcnc-node/eden-protocol.\n */\n\nimport {\n HalComponent,\n Pin,\n Param,\n getMsgLevel,\n setMsgLevel,\n getValue,\n getInfoPins,\n getInfoSignals,\n getInfoParams,\n newSignal,\n pinHasWriter,\n setSignalValue,\n} from \"@linuxcnc-node/hal\";\nimport type { HalType, HalPinDir, HalParamDir } from \"@linuxcnc-node/types\";\nimport type { HalProtocol, HalValue, HalDelta } from \"@linuxcnc-node/eden-protocol\";\nimport type { HostConnection } from \"@edenapp/types\";\nimport picomatch from \"picomatch\";\n\nconst SERVICE_NAME = \"hal\";\n\ninterface ConnectionState {\n component: HalComponent | null;\n pins: Map<string, Pin>;\n params: Map<string, Param>;\n lastValues: Map<string, HalValue>;\n cursor: number;\n pollInterval: NodeJS.Timeout | null;\n}\n\n/**\n * Initialize the HAL service\n */\nexport function initHalService(): void {\n worker!.appBus.exposeService(\n SERVICE_NAME,\n (connection, { appId: clientAppId }) => {\n console.log(`[HAL] Client connected: ${clientAppId}`);\n\n const typedConn = connection as HostConnection<HalProtocol>;\n\n // Per-connection state\n const state: ConnectionState = {\n component: null,\n pins: new Map(),\n params: new Map(),\n lastValues: new Map(),\n cursor: 0,\n pollInterval: null,\n };\n\n // Clean up on disconnect\n connection.onClose(() => {\n console.log(`[HAL] Client disconnected: ${clientAppId}`);\n if (state.pollInterval) {\n clearInterval(state.pollInterval);\n }\n if (state.component) {\n state.component.dispose();\n }\n });\n\n // Start polling for value changes\n function startPolling(): void {\n if (state.pollInterval) return;\n\n state.pollInterval = setInterval(() => {\n if (!state.component) return;\n\n const changes: Array<{ name: string; value: HalValue }> = [];\n\n // Check all pins and params for changes\n for (const [name, pin] of state.pins) {\n const value = pin.getValue();\n const lastValue = state.lastValues.get(name);\n if (value !== lastValue) {\n changes.push({ name, value });\n state.lastValues.set(name, value);\n }\n }\n\n for (const [name, param] of state.params) {\n const value = param.getValue();\n const lastValue = state.lastValues.get(name);\n if (value !== lastValue) {\n changes.push({ name, value });\n state.lastValues.set(name, value);\n }\n }\n\n if (changes.length > 0) {\n state.cursor++;\n const delta: HalDelta = {\n changes,\n cursor: state.cursor,\n timestamp: Date.now(),\n };\n try {\n typedConn.send(\"items-delta\", delta);\n } catch (err) {\n console.error(\"[HAL] Error sending delta:\", err);\n }\n }\n }, 10); // 10ms polling interval\n }\n\n // === COMPONENT HANDLERS ===\n\n typedConn.handle(\"component/init\", ({ name, prefix }) => {\n if (state.component) {\n return {\n success: false,\n componentName: \"\",\n error: \"Component already initialized for this connection\",\n };\n }\n\n try {\n state.component = new HalComponent(name, prefix);\n return {\n success: true,\n componentName: state.component.name,\n };\n } catch (err) {\n return {\n success: false,\n componentName: \"\",\n error: err instanceof Error ? err.message : String(err),\n };\n }\n });\n\n typedConn.handle(\"component/ready\", () => {\n if (!state.component) {\n return { success: false, error: \"Component not initialized\" };\n }\n\n try {\n state.component.ready();\n startPolling();\n\n typedConn.send(\"hal-ready\", {\n componentName: state.component.name,\n prefix: state.component.prefix,\n });\n\n return { success: true };\n } catch (err) {\n return {\n success: false,\n error: err instanceof Error ? err.message : String(err),\n };\n }\n });\n\n typedConn.handle(\"component/unready\", () => {\n if (!state.component) {\n return { success: false, error: \"Component not initialized\" };\n }\n\n try {\n state.component.unready();\n return { success: true };\n } catch (err) {\n return {\n success: false,\n error: err instanceof Error ? err.message : String(err),\n };\n }\n });\n\n // === PIN/PARAM HANDLERS ===\n\n typedConn.handle(\"pin/create\", ({ name, type, direction }) => {\n if (!state.component) {\n return {\n success: false,\n fullName: \"\",\n error: \"Component not initialized\",\n };\n }\n\n try {\n const pin = state.component.newPin(name, type, direction);\n state.pins.set(name, pin);\n state.lastValues.set(name, pin.getValue());\n\n return {\n success: true,\n fullName: `${state.component!.prefix}.${pin.name}`,\n };\n } catch (err) {\n return {\n success: false,\n fullName: \"\",\n error: err instanceof Error ? err.message : String(err),\n };\n }\n });\n\n typedConn.handle(\"param/create\", ({ name, type, direction }) => {\n if (!state.component) {\n return {\n success: false,\n fullName: \"\",\n error: \"Component not initialized\",\n };\n }\n\n try {\n const param = state.component.newParam(name, type, direction);\n state.params.set(name, param);\n state.lastValues.set(name, param.getValue());\n\n return {\n success: true,\n fullName: `${state.component!.prefix}.${param.name}`,\n };\n } catch (err) {\n return {\n success: false,\n fullName: \"\",\n error: err instanceof Error ? err.message : String(err),\n };\n }\n });\n\n typedConn.handle(\"item/get-value\", ({ name }) => {\n if (!state.component) {\n throw new Error(\"Component not initialized\");\n }\n\n const value = state.component.getValue(name);\n return { value };\n });\n\n typedConn.handle(\"item/set-value\", ({ name, value }) => {\n if (!state.component) {\n return { success: false, error: \"Component not initialized\" };\n }\n\n try {\n state.component.setValue(name, value);\n state.lastValues.set(name, value);\n return { success: true };\n } catch (err) {\n return {\n success: false,\n error: err instanceof Error ? err.message : String(err),\n };\n }\n });\n\n typedConn.handle(\"items/sync\", () => {\n if (!state.component) {\n throw new Error(\"Component not initialized\");\n }\n\n // Build current items snapshot\n const items: Record<string, HalValue> = {};\n for (const [name, pin] of state.pins) {\n items[name] = pin.getValue();\n }\n for (const [name, param] of state.params) {\n items[name] = param.getValue();\n }\n\n return {\n items,\n cursor: state.cursor,\n };\n });\n\n // === GLOBAL HANDLERS ===\n\n typedConn.handle(\"global/component-exists\", ({ componentName }) => {\n return { exists: HalComponent.exists(componentName) };\n });\n\n typedConn.handle(\"global/component-is-ready\", ({ componentName }) => {\n return { ready: HalComponent.isReady(componentName) };\n });\n\n typedConn.handle(\"global/signal-create\", ({ name, type }) => {\n try {\n newSignal(name, type);\n return { success: true };\n } catch (err) {\n return {\n success: false,\n error: err instanceof Error ? err.message : String(err),\n };\n }\n });\n\n typedConn.handle(\"global/signal-get-value\", ({ signalName }) => {\n const value = getValue(signalName);\n return { value };\n });\n\n typedConn.handle(\"global/signal-set-value\", ({ signalName, value }) => {\n try {\n setSignalValue(signalName, value);\n return { success: true };\n } catch (err) {\n return {\n success: false,\n error: err instanceof Error ? err.message : String(err),\n };\n }\n });\n\n typedConn.handle(\"global/signal-connect\", ({ pinName, signalName }) => {\n // This would need net/connect functionality from hal\n // For now, return not implemented\n return { success: false, error: \"Not implemented - use halcmd net\" };\n });\n\n typedConn.handle(\"global/signal-disconnect\", ({ pinName }) => {\n // This would need disconnect functionality from hal\n return {\n success: false,\n error: \"Not implemented - use halcmd unlinkp\",\n };\n });\n\n typedConn.handle(\"global/pin-has-writer\", ({ pinName }) => {\n return { hasWriter: pinHasWriter(pinName) };\n });\n\n typedConn.handle(\"global/get-value\", ({ name }) => {\n const value = getValue(name);\n // Determine type based on whether it's a pin, param, or signal\n // For simplicity, return \"pin\" - could be enhanced with proper detection\n return { value, type: \"pin\" as const };\n });\n\n typedConn.handle(\"global/list-pins\", ({ filter }) => {\n let pins = getInfoPins();\n if (filter) {\n const isMatch = picomatch(filter);\n pins = pins.filter((p) => isMatch(p.name));\n }\n return { pins };\n });\n\n typedConn.handle(\"global/list-params\", ({ filter }) => {\n let params = getInfoParams();\n if (filter) {\n const isMatch = picomatch(filter);\n params = params.filter((p) => isMatch(p.name));\n }\n return { params };\n });\n\n typedConn.handle(\"global/list-signals\", ({ filter }) => {\n let signals = getInfoSignals();\n if (filter) {\n const isMatch = picomatch(filter);\n signals = signals.filter((s) => isMatch(s.name));\n }\n return { signals };\n });\n\n typedConn.handle(\"global/list-all\", () => {\n return {\n pins: getInfoPins(),\n params: getInfoParams(),\n signals: getInfoSignals(),\n };\n });\n\n typedConn.handle(\"global/msg-level-get\", () => {\n return { level: getMsgLevel() };\n });\n\n typedConn.handle(\"global/msg-level-set\", ({ level }) => {\n const previousLevel = getMsgLevel();\n setMsgLevel(level);\n return { success: true, previousLevel };\n });\n\n // === CONNECTION HANDLERS ===\n\n typedConn.handle(\"ping\", () => {\n return { timestamp: Date.now() };\n });\n\n typedConn.handle(\"get-status\", () => {\n return {\n connected: true,\n componentName: state.component?.name ?? \"\",\n componentReady: state.component\n ? HalComponent.isReady(state.component.name)\n : false,\n pinCount: state.pins.size,\n paramCount: state.params.size,\n uptime: process.uptime(),\n };\n });\n },\n { description: \"HAL component management and I/O access\" }\n );\n\n console.log(`[HAL] Service exposed as '${SERVICE_NAME}'`);\n}\n","/**\n * Position Logger Service\n *\n * Exposes machine position logging and history streaming via AppBus.\n * Implements PositionLoggerProtocol from @linuxcnc-node/eden-protocol.\n */\n\nimport { PositionLogger } from \"@linuxcnc-node/core\";\nimport { POSITION_STRIDE } from \"@linuxcnc-node/types\";\nimport type { PositionLoggerProtocol } from \"@linuxcnc-node/eden-protocol\";\nimport type { HostConnection } from \"@edenapp/types\";\n\nconst SERVICE_NAME = \"position-logger\";\nconst UPDATE_INTERVAL_MS = 50;\n\n// Shared position logger instance\nlet logger: PositionLogger | null = null;\n\n// Cursor tracking\nlet cursor = 0;\nlet lastHistoryCount = 0;\n\n// Connected clients\nconst connections = new Map<string, HostConnection<PositionLoggerProtocol>>();\n\n// Update interval for pushing position updates\nlet updateInterval: NodeJS.Timeout | null = null;\n\n/**\n * Start the update loop for pushing position deltas to clients\n */\nfunction startUpdateLoop(): void {\n if (updateInterval) return;\n\n updateInterval = setInterval(() => {\n if (!logger || connections.size === 0) return;\n\n const currentCount = logger.getHistoryCount();\n if (currentCount <= lastHistoryCount) return;\n\n // Get new points since last update\n const newPointCount = currentCount - lastHistoryCount;\n const newPoints = logger.getMotionHistory(lastHistoryCount, newPointCount);\n\n cursor++;\n lastHistoryCount = currentCount;\n\n // Push to all connected clients - cast to any to handle type conflicts\n const message = {\n points: newPoints,\n count: newPointCount,\n cursor,\n };\n\n for (const conn of connections.values()) {\n try {\n conn.send(\"position-update\", message);\n } catch (err) {\n console.error(\"[PositionLogger] Error sending update:\", err);\n }\n }\n }, UPDATE_INTERVAL_MS);\n}\n\n/**\n * Stop the update loop\n */\nfunction stopUpdateLoop(): void {\n if (updateInterval) {\n clearInterval(updateInterval);\n updateInterval = null;\n }\n}\n\n/**\n * Initialize the Position Logger service\n */\nexport function initPositionLoggerService(): void {\n // Create shared logger instance\n logger = new PositionLogger();\n\n worker!.appBus.exposeService(\n SERVICE_NAME,\n (connection, { appId: clientAppId }) => {\n console.log(`[PositionLogger] Client connected: ${clientAppId}`);\n\n const typedConn = connection as HostConnection<PositionLoggerProtocol>;\n connections.set(clientAppId, typedConn);\n\n // Handle disconnect\n connection.onClose(() => {\n console.log(`[PositionLogger] Client disconnected: ${clientAppId}`);\n connections.delete(clientAppId);\n\n // Stop update loop if no clients\n if (connections.size === 0) {\n stopUpdateLoop();\n }\n });\n\n // Start handler\n typedConn.handle(\"start\", ({ interval, maxHistory }) => {\n if (!logger) {\n return { success: false, cursor: 0 };\n }\n\n logger.start({\n interval: interval ?? 0.01,\n maxHistorySize: maxHistory ?? 10000,\n });\n\n lastHistoryCount = 0;\n cursor++;\n\n // Start update loop if not running\n startUpdateLoop();\n\n return { success: true, cursor };\n });\n\n // Stop handler\n typedConn.handle(\"stop\", () => {\n if (!logger) {\n return { success: false };\n }\n\n logger.stop();\n return { success: true };\n });\n\n // Clear handler\n typedConn.handle(\"clear\", () => {\n if (!logger) {\n return { success: false };\n }\n\n logger.clear();\n lastHistoryCount = 0;\n cursor++;\n\n return { success: true };\n });\n\n typedConn.handle(\"sync\", () => {\n if (!logger) {\n return {\n history: new Float64Array(0),\n count: 0,\n cursor: 0,\n };\n }\n\n const currentCount = logger.getHistoryCount();\n const history = logger.getMotionHistory(0, currentCount);\n\n return {\n history,\n count: history.length / POSITION_STRIDE,\n cursor,\n };\n });\n\n typedConn.handle(\"get-current\", () => {\n if (!logger) {\n return { position: null };\n }\n\n const position = logger.getCurrentPosition();\n return { position };\n });\n\n // Get cursor\n typedConn.handle(\"get-cursor\", () => {\n return { cursor };\n });\n\n // Ping\n typedConn.handle(\"ping\", () => {\n return { timestamp: Date.now() };\n });\n },\n { description: \"Machine position logging and history streaming\" }\n );\n\n console.log(`[PositionLogger] Service exposed as '${SERVICE_NAME}'`);\n}\n","/**\n * LinuxCNC Node Eden Bridge Backend\n *\n * Main entry point for the LinuxCNC-Eden bridge.\n * Initializes and exposes all AppBus services.\n */\n\nimport { initLinuxCNCService } from \"./services/linuxcnc\";\nimport { initGCodeService } from \"./services/gcode\";\nimport { initHalService } from \"./services/hal\";\nimport { initPositionLoggerService } from \"./services/position-logger\";\n\nconst appId = process.env.EDEN_APP_ID;\nconsole.log(`[LinuxCNC Node Eden Bridge] Starting for ${appId}`);\n\n// Initialize all services\ninitLinuxCNCService();\ninitGCodeService();\ninitHalService();\ninitPositionLoggerService();\n\nconsole.log(\"[LinuxCNC Node Eden Bridge] All services initialized\");\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,6CAAAA,UAAA;AAAA;AACA,WAAO,eAAeA,UAAS,cAAc,EAAE,OAAO,KAAK,CAAC;AAC5D,IAAAA,SAAQ,QAAQ;AAEhB,aAAS,YAAY;AACjB,YAAM,QAAQ;AAAA,QACV;AAAA,QACA;AAAA;AAAA,MACJ;AACA,YAAM,SAAS,CAAC;AAChB,iBAAW,QAAQ,OAAO;AACtB,YAAI;AAEA,iBAAO,QAAQ,IAAI;AAAA,QACvB,SACO,OAAO;AACV,gBAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AACrE,iBAAO,KAAK,GAAG,IAAI,KAAK,OAAO,EAAE;AAAA,QAErC;AAAA,MACJ;AACA,YAAM,IAAI,MAAM;AAAA,EAAyI,OAAO,KAAK,IAAI,CAAC,EAAE;AAAA,IAChL;AACA,IAAAA,SAAQ,QAAQ,UAAU;AAAA;AAAA;;;;;;;ACvBX,wBAAaC,GAAKC,GAAKC,GA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QACF;AAEA,cAAM,eAAe,OAAO,gBAAgB;AAC5C,cAAM,UAAU,OAAO,iBAAiB,GAAG,YAAY;AAEvD,eAAO;AAAA,UACL;AAAA,UACA,OAAO,QAAQ,SAAS;AAAA,UACxB;AAAA,QACF;AAAA,MACF,CAAC;AAED,gBAAU,OAAO,eAAe,MAAM;AACpC,YAAI,CAAC,QAAQ;AACX,iBAAO,EAAE,UAAU,KAAK;AAAA,QAC1B;AAEA,cAAM,WAAW,OAAO,mBAAmB;AAC3C,eAAO,EAAE,SAAS;AAAA,MACpB,CAAC;AAGD,gBAAU,OAAO,cAAc,MAAM;AACnC,eAAO,EAAE,OAAO;AAAA,MAClB,CAAC;AAGD,gBAAU,OAAO,QAAQ,MAAM;AAC7B,eAAO,EAAE,WAAW,KAAK,IAAI,EAAE;AAAA,MACjC,CAAC;AAAA,IACH;AAAA,IACA,EAAE,aAAa,iDAAiD;AAAA,EAClE;AAEA,UAAQ,IAAI,wCAAwCD,aAAY,GAAG;AACrE;;;AC7KA,IAAM,QAAQ,QAAQ,IAAI;AAC1B,QAAQ,IAAI,4CAA4C,KAAK,EAAE;AAG/D,oBAAoB;AACpB,iBAAiB;AACjB,eAAe;AACf,0BAA0B;AAE1B,QAAQ,IAAI,sDAAsD;","names":["exports","obj","key","def","p","undef","split","length","exports","exports","StatChannel","TaskMode","exports","TaskState","ExecState","InterpState","StopState","TrajMode","MotionType","KinematicsType","RcsStatus","ProgramUnits","NmlMessageType","JointType","OrientState","EmcDebug","exports","PositionLoggerIndex","PositionIndex","exports","OperationType","exports","Plane","exports","exports","CommandChannel","exports","exports","CommandTransport","exports","ErrorChannel","exports","PositionLogger","cursor","require_dist","exports","exports","parseGCode","exports","require_constants","exports","exports","Pin","Param","exports","HalComponent","exports","getMsgLevel","setMsgLevel","getValue","getInfoPins","getInfoSignals","getInfoParams","newSignal","pinHasWriter","setSignalValue","require_dist","exports","require_constants","exports","module","exports","exports","module","exports","module","branch","opts","value","rest","source","exports","module","picomatch","state","require_picomatch","exports","module","picomatch","SERVICE_NAME","SERVICE_NAME","picomatch","import_core","SERVICE_NAME","connections"]}
|