{"version":3,"file":"fundamental-ngx-ui5-webcomponents-ai-prompt-input.mjs","sources":["../../../../libs/ui5-webcomponents-ai/prompt-input/index.ts","../../../../libs/ui5-webcomponents-ai/prompt-input/fundamental-ngx-ui5-webcomponents-ai-prompt-input.ts"],"sourcesContent":["\nimport {\n  ChangeDetectionStrategy,\n  Component,\n  ElementRef,\n  input,\n  output,\n  AfterViewInit,\n  effect,\n  runInInjectionContext,\n  inject,\n  Injector,\n  booleanAttribute,\n  computed,\n  signal,\n  DestroyRef\n} from '@angular/core';\nimport '@ui5/webcomponents-ai/dist/PromptInput.js';\nimport { default as _PromptInput } from '@ui5/webcomponents-ai/dist/PromptInput.js';\nimport { UI5CustomEvent } from '@ui5/webcomponents-base';\nimport {\n  ContentDensityObserver,\n  contentDensityObserverProviders,\n  ContentDensityMode\n} from '@fundamental-ngx/core/content-density';\n\n\nimport { default as ValueState } from '@ui5/webcomponents-base/dist/types/ValueState.js';\n\n@Component({\n  standalone: true,\n  selector: 'ui5-ai-prompt-input, [ui5-ai-prompt-input]',\n  template: '<ng-content></ng-content>',\n  exportAs: 'ui5PromptInput',\n  providers: [\n    contentDensityObserverProviders({\n      supportedContentDensity: [ContentDensityMode.COMPACT, ContentDensityMode.COZY]\n    })\n  ],\n  changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class PromptInput implements AfterViewInit {\n\n  /**\n   * Defines whether the component is in disabled state.\n\n**Note:** A disabled component is completely noninteractive.\n   */\n  disabled = input(false, { transform: booleanAttribute });\n\n  /**\n   * Defines the label of the input field.\n   */\n  label = input<typeof _PromptInput.prototype.label | undefined>();\n\n  /**\n   * Sets the maximum number of characters available in the input field.\n   */\n  maxlength = input<typeof _PromptInput.prototype.maxlength | undefined>();\n\n  /**\n   * Defines a short hint intended to aid the user with data entry when the\ncomponent has no value.\n   */\n  placeholder = input<typeof _PromptInput.prototype.placeholder | undefined>();\n\n  /**\n   * Defines whether the component is read-only.\n\n**Note:** A read-only component is not editable,\nbut still provides visual feedback upon user interaction.\n   */\n  readonly = input(false, { transform: booleanAttribute });\n\n  /**\n   * Defines whether the clear icon of the input will be shown.\n   */\n  showClearIcon = input(false, { transform: booleanAttribute });\n\n  /**\n   * Determines whether the characters exceeding the maximum allowed character count are visible\nin the component.\n\nIf set to `false`, the user is not allowed to enter more characters than what is set in the\n`maxlength` property.\nIf set to `true` the characters exceeding the `maxlength` value are selected on\npaste and the counter below the component displays their number.\n   */\n  showExceededText = input(false, { transform: booleanAttribute });\n\n  /**\n   * Defines whether the component should show suggestions, if such are present.\n   */\n  showSuggestions = input(false, { transform: booleanAttribute });\n\n  /**\n   * Defines the value of the component.\n   */\n  value = input<typeof _PromptInput.prototype.value | undefined>(\"\");\n\n  /**\n   * Defines the value state of the component.\n   */\n  valueState = input<typeof _PromptInput.prototype.valueState | undefined>(\"None\"); // className is now passed\n\n\n\n  /**\n   * Fired when the input operation has finished by pressing Enter\nor on focusout.\n   */\n  ui5Change = output<UI5CustomEvent<_PromptInput, 'change'>>();\n\n  /**\n   * Fired when the value of the component changes at each keystroke,\nand when a suggestion item has been selected.\n   */\n  ui5Input = output<UI5CustomEvent<_PromptInput, 'input'>>();\n\n  /**\n   * Fired when the input operation has finished by pressing Enter\nor AI button is clicked.\n   */\n  ui5Submit = output<UI5CustomEvent<_PromptInput, 'submit'>>();\n\n  /**\n   * Available slots for content projection in this component.\n   *\n   * Slots allow you to insert custom content into predefined areas of the web component.\n   * Use the `slot` attribute on child elements to target specific slots.\n   *\n   * - **(default)**: Defines the suggestion items.\n\n**Note:** The suggestions would be displayed only if the `showSuggestions`\nproperty is set to `true`.\n\n**Note:** The `<ui5-suggestion-item>`, `<ui5-suggestion-item-group>` and `ui5-suggestion-item-custom` are recommended to be used as suggestion items.\n   * - **valueStateMessage**: Defines the value state message that will be displayed as pop up under the component.\nThe value state message slot should contain only one root element.\n\n**Note:** If not specified, a default text (in the respective language) will be displayed.\n\n**Note:** The `valueStateMessage` would be displayed,\nwhen the component is in `Information`, `Critical` or `Negative` value state.\n   *\n   * @example\n   * ```html\n   * <ui5-ai-prompt-input>\n   *   <div slot=\"header\">Custom header content</div>\n   *   <p>Default slot content</p>\n   * </ui5-ai-prompt-input>\n   * ```\n   *\n   * @readonly\n   * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_templates_and_slots | MDN Web Components Slots}\n   */\n  readonly slots = [\n      {\n          \"name\": \"default\",\n          \"description\": \"Defines the suggestion items.\\n\\n**Note:** The suggestions would be displayed only if the `showSuggestions`\\nproperty is set to `true`.\\n\\n**Note:** The `<ui5-suggestion-item>`, `<ui5-suggestion-item-group>` and `ui5-suggestion-item-custom` are recommended to be used as suggestion items.\"\n      },\n      {\n          \"name\": \"valueStateMessage\",\n          \"description\": \"Defines the value state message that will be displayed as pop up under the component.\\nThe value state message slot should contain only one root element.\\n\\n**Note:** If not specified, a default text (in the respective language) will be displayed.\\n\\n**Note:** The `valueStateMessage` would be displayed,\\nwhen the component is in `Information`, `Critical` or `Negative` value state.\",\n          \"since\": \"2.0.0\"\n      }\n  ];\n\n\n  public elementRef: ElementRef<_PromptInput> = inject(ElementRef);\n  public injector = inject(Injector);\n\n  /**\n   * Content density observer is injected to activate automatic CSS class and\n   * UI5 attribute application. The observer self-initializes, no explicit subscribe() needed.\n   * @private\n   */\n  private readonly _contentDensityObserver = inject(ContentDensityObserver);\n  private readonly _destroyRef = inject(DestroyRef);\n\n  get element(): _PromptInput {\n    return this.elementRef.nativeElement;\n  }\n\n  ngAfterViewInit(): void {\n    const wcElement = this.element;\n    \n    const inputsToSync = [\n      'disabled',\n      'label',\n      'maxlength',\n      'placeholder',\n      'readonly',\n      'showClearIcon',\n      'showExceededText',\n      'showSuggestions',\n      'value',\n      'valueState',\n    ];\n    \n    // Synchronize inputs (properties)\n    for (const inputName of inputsToSync) {\n      // Find the corresponding camelCase signal property on the Angular component\n      const signalName = inputName.replace(/-./g, (x: string) => x[1].toUpperCase());\n\n      // Use the Injector to run the effect in the correct context\n      if (this[signalName] && typeof this[signalName] === 'function') {\n        runInInjectionContext(this.injector, (): void => {\n          effect((): void => {\n            // Read the signal value\n            const value = this[signalName]();\n            if (wcElement) {\n              // Skip writes when the signal is undefined and the property is already truthy\n              // This prevents clobbering imperatively-set values (e.g., from RouterLink)\n              if (value === undefined && wcElement[inputName]) {\n                return;\n              }\n              // Write the value to the Web Component's property\n              wcElement[inputName] = value;\n            }\n          });\n        });\n      }\n    }\n  \n    \n    const outputsToSync = [\n      'ui5Change',\n      'ui5Input',\n      'ui5Submit',\n    ];\n    \n    // Synchronize outputs (events)\n    const _listeners: Array<() => void> = [];\n    for (const outputName of outputsToSync) {\n      // Map Angular output name to UI5 web component event name\n      const eventName = outputName.replace('ui5', '').replace(/([A-Z])/g, '-$1').toLowerCase().substring(1);\n      // Ensure the output property exists and has an emit function before adding listener\n      if (this[outputName] && typeof this[outputName].emit === 'function' && wcElement.addEventListener) {\n        // Cast the listener to the correct type to satisfy TypeScript\n        const listener = (e: Event): void => {\n\n          this[outputName].emit(e as CustomEvent<any>);\n        };\n        wcElement.addEventListener(eventName, listener);\n        _listeners.push(() => wcElement.removeEventListener(eventName, listener));\n      }\n    }\n    this._destroyRef.onDestroy(() => _listeners.forEach((fn) => fn()));\n  \n\n  }\n}\n\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAyCa,WAAW,CAAA;AAZxB,IAAA,WAAA,GAAA;AAcE;;;;AAIG;QACH,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAC,KAAK,gFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;AAExD;;AAEG;AACH,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK;6FAAmD;AAEhE;;AAEG;AACH,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK;iGAAuD;AAExE;;;AAGG;AACH,QAAA,IAAA,CAAA,WAAW,GAAG,KAAK;mGAAyD;AAE5E;;;;;AAKG;QACH,IAAA,CAAA,QAAQ,GAAG,KAAK,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