{"version":3,"file":"llm-ClK3eTHJ.mjs","names":["circuit: CircuitState","issues: ValidationIssue[]","schema: ComponentSchema","componentId: string","query: string","results: ComponentSearchResult[]","matchedFields: string[]","circuit: CircuitState","errors: string[]","warnings: string[]","suggestions: string[]","component: ComponentInstance","wire: Wire","components: ComponentInstance[]"],"sources":["../../src/utils/circuitValidation.ts","../../src/llm/componentDiscovery.ts","../../src/llm/getAllSchemas.ts","../../src/llm/validation.ts","../../src/llm/index.ts"],"sourcesContent":["/**\n * Circuit validation utilities\n *\n * Functions to validate circuit connections and integrity.\n */\n\nimport { CircuitState, ComponentInstance, Wire } from '../schemas/componentSchema';\nimport { getComponentSchema } from '../registry';\nimport { validateCircuitState } from './zodValidation';\nimport { ValidationIssue } from '../schemas/componentSchema';\n\n/**\n * Validate a circuit for common issues\n *\n * @param circuit - The circuit state to validate\n * @returns Array of validation issues\n */\nexport function validateCircuit(circuit: CircuitState): ValidationIssue[] {\n  // First validate the circuit structure using ZOD\n  const validationResult = validateCircuitState(circuit);\n\n  if (!validationResult.success) {\n    return [{\n      type: 'error',\n      message: `Invalid circuit structure: ${validationResult.error}`\n    }];\n  }\n\n  const issues: ValidationIssue[] = [];\n\n  // Check for missing components in wire connections\n  issues.push(...validateWireConnections(circuit));\n\n  // Check for floating inputs/outputs\n  issues.push(...validateFloatingPorts(circuit));\n\n  // Check for short circuits\n  issues.push(...validateShortCircuits(circuit));\n\n  return issues;\n}\n\n/**\n * Validate wire connections to ensure they reference valid components\n */\nfunction validateWireConnections(circuit: CircuitState): ValidationIssue[] {\n  const issues: ValidationIssue[] = [];\n  const componentIds = new Set(circuit.components.map(c => c.id));\n\n  for (const wire of circuit.wires) {\n    // Check source component exists\n    if (!componentIds.has(wire.from.componentId)) {\n      issues.push({\n        type: 'error',\n        message: `Wire connected to non-existent component ID: ${wire.from.componentId}`,\n        wireId: wire.id\n      });\n    }\n\n    // Check destination component exists\n    if (!componentIds.has(wire.to.componentId)) {\n      issues.push({\n        type: 'error',\n        message: `Wire connected to non-existent component ID: ${wire.to.componentId}`,\n        wireId: wire.id\n      });\n    }\n\n    // Validate port IDs\n    const sourceComponent = circuit.components.find(c => c.id === wire.from.componentId);\n    const destComponent = circuit.components.find(c => c.id === wire.to.componentId);\n\n    if (sourceComponent) {\n      const schema = getComponentSchema(sourceComponent.type);\n      if (schema && !schema.ports.some(p => p.id === wire.from.portId)) {\n        issues.push({\n          type: 'error',\n          message: `Wire connected to non-existent port: ${wire.from.portId} on component ${sourceComponent.type}`,\n          wireId: wire.id\n        });\n      }\n    }\n\n    if (destComponent) {\n      const schema = getComponentSchema(destComponent.type);\n      if (schema && !schema.ports.some(p => p.id === wire.to.portId)) {\n        issues.push({\n          type: 'error',\n          message: `Wire connected to non-existent port: ${wire.to.portId} on component ${destComponent.type}`,\n          wireId: wire.id\n        });\n      }\n    }\n  }\n\n  return issues;\n}\n\n/**\n * Check for floating input/output ports that should be connected\n */\nfunction validateFloatingPorts(circuit: CircuitState): ValidationIssue[] {\n  const issues: ValidationIssue[] = [];\n  const connectedPorts = new Map<string, Set<string>>();\n\n  // Build a map of all connected ports\n  for (const wire of circuit.wires) {\n    if (!connectedPorts.has(wire.from.componentId)) {\n      connectedPorts.set(wire.from.componentId, new Set());\n    }\n    if (!connectedPorts.has(wire.to.componentId)) {\n      connectedPorts.set(wire.to.componentId, new Set());\n    }\n\n    connectedPorts.get(wire.from.componentId)!.add(wire.from.portId);\n    connectedPorts.get(wire.to.componentId)!.add(wire.to.portId);\n  }\n\n  // Check each component for floating ports\n  for (const component of circuit.components) {\n    const schema = getComponentSchema(component.type);\n    if (!schema) continue;\n\n    const componentConnectedPorts = connectedPorts.get(component.id) || new Set();\n\n    for (const port of schema.ports) {\n      if (port.type === 'input' && !componentConnectedPorts.has(port.id)) {\n        issues.push({\n          type: 'warning',\n          message: `Floating input port: ${port.id} on ${schema.name} (${component.id})`,\n          componentId: component.id\n        });\n      }\n\n      if (port.type === 'output' && !componentConnectedPorts.has(port.id)) {\n        issues.push({\n          type: 'warning',\n          message: `Floating output port: ${port.id} on ${schema.name} (${component.id})`,\n          componentId: component.id\n        });\n      }\n    }\n  }\n\n  return issues;\n}\n\n/**\n * Check for short circuits (multiple outputs connected together)\n */\nfunction validateShortCircuits(circuit: CircuitState): ValidationIssue[] {\n  const issues: ValidationIssue[] = [];\n  const connectionGraph = new Map<string, Set<string>>();\n\n  // Build a connection graph\n  for (const wire of circuit.wires) {\n    const fromKey = `${wire.from.componentId}-${wire.from.portId}`;\n    const toKey = `${wire.to.componentId}-${wire.to.portId}`;\n\n    if (!connectionGraph.has(fromKey)) {\n      connectionGraph.set(fromKey, new Set());\n    }\n    if (!connectionGraph.has(toKey)) {\n      connectionGraph.set(toKey, new Set());\n    }\n\n    connectionGraph.get(fromKey)!.add(toKey);\n    connectionGraph.get(toKey)!.add(fromKey);\n  }\n\n  // Create a map of port types\n  const portTypes = new Map<string, string>();\n  for (const component of circuit.components) {\n    const schema = getComponentSchema(component.type);\n    if (!schema) continue;\n\n    for (const port of schema.ports) {\n      portTypes.set(`${component.id}-${port.id}`, port.type);\n    }\n  }\n\n  // Find connected output ports\n  const visited = new Set<string>();\n  const connectedComponents = [];\n\n  // For each port\n  for (const [port, connections] of connectionGraph.entries()) {\n    if (visited.has(port)) continue;\n\n    // Do a BFS to find all connected ports\n    const connectedPorts = new Set<string>();\n    const queue = [port];\n    visited.add(port);\n\n    while (queue.length > 0) {\n      const currentPort = queue.shift()!;\n      connectedPorts.add(currentPort);\n\n      for (const connectedPort of connectionGraph.get(currentPort) || []) {\n        if (!visited.has(connectedPort)) {\n          queue.push(connectedPort);\n          visited.add(connectedPort);\n        }\n      }\n    }\n\n    // Count output ports in this connected component\n    const outputPorts = [...connectedPorts].filter(p =>\n      portTypes.get(p) === 'output'\n    );\n\n    if (outputPorts.length > 1) {\n      issues.push({\n        type: 'error',\n        message: `Short circuit detected: ${outputPorts.length} output ports connected together`,\n      });\n    }\n  }\n\n  return issues;\n}\n\nexport default validateCircuit;\n","/**\n * Component Discovery API for LLM Integration\n *\n * This module provides functions that allow LLMs to discover and understand\n * what components are available in the circuit-bricks registry.\n */\n\nimport {\n  getAllComponents,\n  getComponentSchema\n} from '../registry';\nimport { ComponentSchema } from '../schemas/componentSchema';\nimport {\n  ComponentInfo,\n  ComponentSearchResult\n} from './types';\n\n/**\n * Convert a ComponentSchema to simplified ComponentInfo for LLM consumption\n */\nfunction schemaToComponentInfo(schema: ComponentSchema): ComponentInfo {\n  return {\n    id: schema.id,\n    name: schema.name,\n    category: schema.category,\n    description: schema.description,\n    ports: schema.ports.map(port => ({\n      id: port.id,\n      type: port.type,\n      label: port.label\n    })),\n    properties: schema.properties.map(prop => ({\n      key: prop.key,\n      label: prop.label,\n      type: prop.type,\n      default: prop.default,\n      unit: prop.unit,\n      options: prop.options?.map(option => ({\n        value: option.value,\n        label: option.label\n      }))\n    }))\n  };\n}\n\n/**\n * List all available components in a format optimized for LLM consumption\n *\n * @returns Array of simplified component information\n */\nexport function listAvailableComponents(): ComponentInfo[] {\n  const allComponents = getAllComponents();\n  return allComponents.map(schemaToComponentInfo);\n}\n\n\n\n/**\n * Get detailed information about a specific component\n *\n * @param componentId - The ID of the component to get details for\n * @returns Detailed component information or null if not found\n */\nexport function getComponentDetails(componentId: string): ComponentInfo | null {\n  const schema = getComponentSchema(componentId);\n  if (!schema) {\n    return null;\n  }\n  return schemaToComponentInfo(schema);\n}\n\n\n\n/**\n * Search components by name, description, or category\n *\n * @param query - Search query string\n * @returns Array of search results with relevance scores\n */\nexport function searchComponents(query: string): ComponentSearchResult[] {\n  const allComponents = getAllComponents();\n  const searchTerm = query.toLowerCase();\n\n  const results: ComponentSearchResult[] = [];\n\n  for (const schema of allComponents) {\n    const matchedFields: string[] = [];\n    let relevanceScore = 0;\n\n    // Check name match (highest priority)\n    if (schema.name.toLowerCase().includes(searchTerm)) {\n      matchedFields.push('name');\n      relevanceScore += 10;\n    }\n\n    // Check ID match\n    if (schema.id.toLowerCase().includes(searchTerm)) {\n      matchedFields.push('id');\n      relevanceScore += 8;\n    }\n\n    // Check category match\n    if (schema.category.toLowerCase().includes(searchTerm)) {\n      matchedFields.push('category');\n      relevanceScore += 5;\n    }\n\n    // Check description match\n    if (schema.description.toLowerCase().includes(searchTerm)) {\n      matchedFields.push('description');\n      relevanceScore += 3;\n    }\n\n    // Check property names\n    for (const prop of schema.properties) {\n      if (prop.label.toLowerCase().includes(searchTerm) ||\n          prop.key.toLowerCase().includes(searchTerm)) {\n        matchedFields.push('properties');\n        relevanceScore += 1;\n        break;\n      }\n    }\n\n    if (relevanceScore > 0) {\n      results.push({\n        component: schemaToComponentInfo(schema),\n        relevanceScore,\n        matchedFields\n      });\n    }\n  }\n\n  // Sort by relevance score (highest first)\n  return results.sort((a, b) => b.relevanceScore - a.relevanceScore);\n}\n","/**\n * Simple tool to get all component schema information for LLM\n * \n * This tool returns all the schema definitions from componentSchema.ts\n */\n\nimport {\n  portTypeSchema,\n  pointSchema,\n  sizeSchema,\n  portSchema,\n  propertySchema,\n  componentSchema,\n  componentInstanceSchema,\n  wireSchema,\n  circuitStateSchema,\n  validationIssueSchema\n} from '../schemas/componentSchema';\n\n/**\n * Get all component schema information\n * \n * Returns all the Zod schemas and their structure from componentSchema.ts\n * \n * @returns Object containing all schema definitions\n */\nexport function getAllComponentSchemas() {\n  return {\n    portTypeSchema,\n    pointSchema,\n    sizeSchema,\n    portSchema,\n    propertySchema,\n    componentSchema,\n    componentInstanceSchema,\n    wireSchema,\n    circuitStateSchema,\n    validationIssueSchema,\n    \n    // Schema descriptions for LLM understanding\n    descriptions: {\n      portTypeSchema: \"Enum of all available port types: input, output, inout, positive, negative, anode, cathode, collector, base, emitter, drain, gate, source, vcc, vdd, vss, gnd, clock, reset, enable\",\n      pointSchema: \"2D point with x and y coordinates (numbers)\",\n      sizeSchema: \"Size dimensions with width and height (numbers)\",\n      portSchema: \"Component port with id (string), x (number), y (number), type (portType), optional label (string)\",\n      propertySchema: \"Component property with key (string), label (string), type (number|boolean|select|text|color), optional unit (string), optional options array, default value, optional min/max (numbers)\",\n      componentSchema: \"Complete component definition with id (string), name (string), category (string), description (string), defaultWidth (number), defaultHeight (number), ports array, properties array, svgPath (string)\",\n      componentInstanceSchema: \"Component instance with id (string), type (string), position (point), optional size, props (record), optional rotation (number)\",\n      wireSchema: \"Wire connection with id (string), from (componentId, portId), to (componentId, portId), optional style (color, strokeWidth, dashArray)\",\n      circuitStateSchema: \"Complete circuit with components array, wires array, selectedComponentIds array, selectedWireIds array\",\n      validationIssueSchema: \"Validation issue with type (error|warning), message (string), optional componentId, optional wireId\"\n    }\n  };\n}\n","/**\n * LLM-Friendly Validation Functions\n *\n * This module provides validation functions optimized for LLM consumption\n * with clear, human-readable error messages and suggestions.\n */\n\nimport { CircuitState, ComponentInstance, Wire } from '../schemas/componentSchema';\nimport { getComponentSchema } from '../registry';\nimport { validateCircuit } from '../utils/circuitValidation';\nimport { LLMValidationResult } from './types';\n\n/**\n * Validate a circuit design with LLM-friendly output\n *\n * @param circuit - The circuit state to validate\n * @returns Validation result with clear messages\n */\nexport function validateCircuitDesign(circuit: CircuitState): LLMValidationResult {\n  const errors: string[] = [];\n  const warnings: string[] = [];\n  const suggestions: string[] = [];\n\n  // Validate component existence and schemas\n  for (const component of circuit.components) {\n    const schema = getComponentSchema(component.type);\n\n    if (!schema) {\n      errors.push(`Component type \"${component.type}\" (ID: ${component.id}) is not registered in the component registry.`);\n      continue;\n    }\n\n    // Validate component properties\n    for (const prop of schema.properties) {\n      const value = component.props[prop.key];\n\n      if (value === undefined && prop.default === undefined) {\n        warnings.push(`Component \"${component.id}\" is missing required property \"${prop.label}\" (${prop.key}).`);\n      }\n\n      // Type validation\n      if (value !== undefined) {\n        switch (prop.type) {\n          case 'number':\n            if (typeof value !== 'number') {\n              errors.push(`Property \"${prop.label}\" of component \"${component.id}\" must be a number, got ${typeof value}.`);\n            } else {\n              if (prop.min !== undefined && value < prop.min) {\n                errors.push(`Property \"${prop.label}\" of component \"${component.id}\" must be at least ${prop.min}, got ${value}.`);\n              }\n              if (prop.max !== undefined && value > prop.max) {\n                errors.push(`Property \"${prop.label}\" of component \"${component.id}\" must be at most ${prop.max}, got ${value}.`);\n              }\n            }\n            break;\n          case 'boolean':\n            if (typeof value !== 'boolean') {\n              errors.push(`Property \"${prop.label}\" of component \"${component.id}\" must be a boolean, got ${typeof value}.`);\n            }\n            break;\n          case 'select':\n            if (prop.options && !prop.options.some(opt => opt.value === value)) {\n              const validOptions = prop.options.map(opt => opt.value).join(', ');\n              errors.push(`Property \"${prop.label}\" of component \"${component.id}\" must be one of: ${validOptions}, got ${value}.`);\n            }\n            break;\n        }\n      }\n    }\n  }\n\n  // Validate wire connections\n  for (const wire of circuit.wires) {\n    const fromComponent = circuit.components.find(c => c.id === wire.from.componentId);\n    const toComponent = circuit.components.find(c => c.id === wire.to.componentId);\n\n    if (!fromComponent) {\n      errors.push(`Wire \"${wire.id}\" references non-existent source component \"${wire.from.componentId}\".`);\n      continue;\n    }\n\n    if (!toComponent) {\n      errors.push(`Wire \"${wire.id}\" references non-existent destination component \"${wire.to.componentId}\".`);\n      continue;\n    }\n\n    const fromSchema = getComponentSchema(fromComponent.type);\n    const toSchema = getComponentSchema(toComponent.type);\n\n    if (!fromSchema || !toSchema) {\n      continue; // Already reported above\n    }\n\n    // Validate port existence\n    const fromPort = fromSchema.ports.find(p => p.id === wire.from.portId);\n    const toPort = toSchema.ports.find(p => p.id === wire.to.portId);\n\n    if (!fromPort) {\n      errors.push(`Wire \"${wire.id}\" references non-existent port \"${wire.from.portId}\" on component \"${fromComponent.id}\" (${fromSchema.name}).`);\n    }\n\n    if (!toPort) {\n      errors.push(`Wire \"${wire.id}\" references non-existent port \"${wire.to.portId}\" on component \"${toComponent.id}\" (${toSchema.name}).`);\n    }\n\n    // Validate port compatibility\n    if (fromPort && toPort) {\n      if (fromPort.type === 'input' && toPort.type === 'input') {\n        warnings.push(`Wire \"${wire.id}\" connects two input ports, which may not be electrically valid.`);\n      }\n\n      if (fromPort.type === 'output' && toPort.type === 'output') {\n        warnings.push(`Wire \"${wire.id}\" connects two output ports, which may cause conflicts.`);\n      }\n    }\n  }\n\n  // Circuit-level validation\n  const powerSources = circuit.components.filter(comp => {\n    const schema = getComponentSchema(comp.type);\n    return schema?.category === 'power' ||\n           schema?.id === 'battery' ||\n           schema?.id === 'voltage-source';\n  });\n\n  const grounds = circuit.components.filter(comp => {\n    const schema = getComponentSchema(comp.type);\n    return schema?.id === 'ground';\n  });\n\n  if (powerSources.length === 0) {\n    warnings.push('Circuit has no power sources. Consider adding a battery or voltage source.');\n  }\n\n  if (grounds.length === 0) {\n    warnings.push('Circuit has no ground connection. This may cause issues in real circuits.');\n  }\n\n  if (powerSources.length > 1) {\n    warnings.push(`Circuit has ${powerSources.length} power sources. Ensure they are properly isolated or connected.`);\n  }\n\n  // Check for isolated components\n  const connectedComponents = new Set<string>();\n  for (const wire of circuit.wires) {\n    connectedComponents.add(wire.from.componentId);\n    connectedComponents.add(wire.to.componentId);\n  }\n\n  for (const component of circuit.components) {\n    if (!connectedComponents.has(component.id)) {\n      warnings.push(`Component \"${component.id}\" is not connected to any other components.`);\n    }\n  }\n\n  // Generate suggestions\n  if (powerSources.length > 0 && grounds.length === 0) {\n    suggestions.push('Add a ground component to complete the circuit.');\n  }\n\n  if (circuit.components.length > 0 && circuit.wires.length === 0) {\n    suggestions.push('Add wire connections between components to create a functional circuit.');\n  }\n\n  // Check for common circuit patterns and suggest improvements dynamically\n  const componentsByCategory = circuit.components.reduce((acc, comp) => {\n    const schema = getComponentSchema(comp.type);\n    if (schema) {\n      if (!acc[schema.category]) acc[schema.category] = [];\n      acc[schema.category].push(comp);\n    }\n    return acc;\n  }, {} as Record<string, ComponentInstance[]>);\n\n  // Dynamic LED + resistor check\n  const outputComponents = componentsByCategory['output'] || [];\n  const passiveComponents = componentsByCategory['passive'] || [];\n\n  const hasLEDLikeComponent = outputComponents.some(comp => {\n    const schema = getComponentSchema(comp.type);\n    return schema?.name.toLowerCase().includes('led') ||\n           schema?.description.toLowerCase().includes('light') ||\n           schema?.description.toLowerCase().includes('diode');\n  });\n\n  const hasCurrentLimitingComponent = passiveComponents.some(comp => {\n    const schema = getComponentSchema(comp.type);\n    return schema?.name.toLowerCase().includes('resistor') ||\n           schema?.description.toLowerCase().includes('resistance') ||\n           schema?.description.toLowerCase().includes('current limiting');\n  });\n\n  if (hasLEDLikeComponent && !hasCurrentLimitingComponent && powerSources.length > 0) {\n    suggestions.push('Consider adding a current-limiting component (like a resistor) in series with light-emitting components to prevent damage.');\n  }\n\n  // Use existing circuit validation for additional checks\n  try {\n    const existingValidation = validateCircuit(circuit);\n    for (const issue of existingValidation) {\n      if (issue.type === 'error') {\n        errors.push(issue.message);\n      } else if (issue.type === 'warning') {\n        warnings.push(issue.message);\n      }\n    }\n  } catch (error) {\n    // If existing validation fails, add it as an error\n    errors.push(`Circuit validation failed: ${error instanceof Error ? error.message : 'Unknown error'}`);\n  }\n\n  return {\n    isValid: errors.length === 0,\n    errors,\n    warnings,\n    suggestions\n  };\n}\n\n/**\n * Validate a single component instance\n *\n * @param component - The component instance to validate\n * @returns Validation result\n */\nexport function validateComponentInstance(component: ComponentInstance): LLMValidationResult {\n  const errors: string[] = [];\n  const warnings: string[] = [];\n  const suggestions: string[] = [];\n\n  const schema = getComponentSchema(component.type);\n\n  if (!schema) {\n    errors.push(`Component type \"${component.type}\" is not registered.`);\n    return { isValid: false, errors, warnings, suggestions };\n  }\n\n  // Validate required properties\n  for (const prop of schema.properties) {\n    const value = component.props[prop.key];\n\n    if (value === undefined && prop.default === undefined) {\n      warnings.push(`Missing property \"${prop.label}\" (${prop.key}).`);\n    }\n  }\n\n  // Validate position\n  if (typeof component.position.x !== 'number' || typeof component.position.y !== 'number') {\n    errors.push('Component position must have numeric x and y coordinates.');\n  }\n\n  // Validate ID\n  if (!component.id || typeof component.id !== 'string') {\n    errors.push('Component must have a valid string ID.');\n  }\n\n  return {\n    isValid: errors.length === 0,\n    errors,\n    warnings,\n    suggestions\n  };\n}\n\n/**\n * Validate a wire connection\n *\n * @param wire - The wire to validate\n * @param components - Array of components in the circuit\n * @returns Validation result\n */\nexport function validateWireConnection(wire: Wire, components: ComponentInstance[]): LLMValidationResult {\n  const errors: string[] = [];\n  const warnings: string[] = [];\n  const suggestions: string[] = [];\n\n  const fromComponent = components.find(c => c.id === wire.from.componentId);\n  const toComponent = components.find(c => c.id === wire.to.componentId);\n\n  if (!fromComponent) {\n    errors.push(`Source component \"${wire.from.componentId}\" not found.`);\n  }\n\n  if (!toComponent) {\n    errors.push(`Destination component \"${wire.to.componentId}\" not found.`);\n  }\n\n  if (fromComponent && toComponent) {\n    const fromSchema = getComponentSchema(fromComponent.type);\n    const toSchema = getComponentSchema(toComponent.type);\n\n    if (fromSchema && toSchema) {\n      const fromPort = fromSchema.ports.find(p => p.id === wire.from.portId);\n      const toPort = toSchema.ports.find(p => p.id === wire.to.portId);\n\n      if (!fromPort) {\n        errors.push(`Port \"${wire.from.portId}\" not found on ${fromSchema.name}.`);\n      }\n\n      if (!toPort) {\n        errors.push(`Port \"${wire.to.portId}\" not found on ${toSchema.name}.`);\n      }\n\n      if (fromPort && toPort) {\n        if (fromPort.type === 'input' && toPort.type === 'input') {\n          warnings.push('Connecting two input ports may not be electrically valid.');\n        }\n      }\n    }\n  }\n\n  return {\n    isValid: errors.length === 0,\n    errors,\n    warnings,\n    suggestions\n  };\n}\n","/**\n * Circuit-Bricks LLM Integration API\n *\n * This module provides a comprehensive API for Large Language Models (LLMs)\n * to interact with the Circuit-Bricks component registry and generate circuits.\n *\n * The API is designed to be intuitive and provide clear, structured responses\n * that LLMs can easily understand and work with.\n */\n\n// Export all types\nexport * from './types';\n\n// Component Discovery API\nexport {\n  listAvailableComponents,\n  getComponentDetails,\n  searchComponents\n} from './componentDiscovery';\n\n// Schema API\nexport {\n  getAllComponentSchemas\n} from './getAllSchemas';\n\n// Validation API\nexport {\n  validateCircuitDesign,\n  validateComponentInstance,\n  validateWireConnection\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