reneco-advanced-input-module 0.0.21 → 0.0.22

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.
Files changed (44) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/voice-input-module.cjs.entry.js +274 -62
  3. package/dist/cjs/voice-input-module.cjs.entry.js.map +1 -1
  4. package/dist/cjs/voice-input-module.cjs.js +1 -1
  5. package/dist/cjs/voice-input-module.entry.cjs.js.map +1 -1
  6. package/dist/collection/components/voice-input-module/voice-input-module.js +87 -4
  7. package/dist/collection/components/voice-input-module/voice-input-module.js.map +1 -1
  8. package/dist/collection/services/audio-recorder.service.js +61 -44
  9. package/dist/collection/services/audio-recorder.service.js.map +1 -1
  10. package/dist/collection/services/llm.service.js +137 -8
  11. package/dist/collection/services/llm.service.js.map +1 -1
  12. package/dist/collection/services/speech-to-text.service.js +39 -5
  13. package/dist/collection/services/speech-to-text.service.js.map +1 -1
  14. package/dist/collection/types/service-providers.types.js +9 -1
  15. package/dist/collection/types/service-providers.types.js.map +1 -1
  16. package/dist/components/voice-input-module.js +281 -63
  17. package/dist/components/voice-input-module.js.map +1 -1
  18. package/dist/esm/loader.js +1 -1
  19. package/dist/esm/voice-input-module.entry.js +274 -62
  20. package/dist/esm/voice-input-module.entry.js.map +1 -1
  21. package/dist/esm/voice-input-module.js +1 -1
  22. package/dist/types/components/voice-input-module/voice-input-module.d.ts +3 -0
  23. package/dist/types/components.d.ts +18 -0
  24. package/dist/types/services/audio-recorder.service.d.ts +5 -0
  25. package/dist/types/services/llm.service.d.ts +22 -0
  26. package/dist/types/services/speech-to-text.service.d.ts +8 -0
  27. package/dist/types/types/service-providers.types.d.ts +6 -2
  28. package/dist/voice-input-module/p-0e2b9ca0.entry.js +3 -0
  29. package/dist/voice-input-module/p-0e2b9ca0.entry.js.map +1 -0
  30. package/dist/voice-input-module/voice-input-module.entry.esm.js.map +1 -1
  31. package/dist/voice-input-module/voice-input-module.esm.js +1 -1
  32. package/package.json +1 -1
  33. package/readme.md +81 -0
  34. package/www/build/p-0e2b9ca0.entry.js +3 -0
  35. package/www/build/p-0e2b9ca0.entry.js.map +1 -0
  36. package/www/build/p-812b92c7.js +2 -0
  37. package/www/build/voice-input-module.entry.esm.js.map +1 -1
  38. package/www/build/voice-input-module.esm.js +1 -1
  39. package/www/index.html +12 -1
  40. package/dist/voice-input-module/p-4e449895.entry.js +0 -3
  41. package/dist/voice-input-module/p-4e449895.entry.js.map +0 -1
  42. package/www/build/p-3a11e8d2.js +0 -2
  43. package/www/build/p-4e449895.entry.js +0 -3
  44. package/www/build/p-4e449895.entry.js.map +0 -1
@@ -17,7 +17,7 @@ var patchBrowser = () => {
17
17
 
18
18
  patchBrowser().then(async (options) => {
19
19
  await globalScripts();
20
- return bootstrapLazy([["ocr-file-uploader",[[257,"ocr-file-uploader",{"batch":[4],"callback":[16],"jsonSchema":[1,"json-schema"],"theme":[1],"parsedTheme":[32]},null,{"theme":["parseTheme"]}]]],["voice-input-module",[[257,"voice-input-module",{"formJson":[1,"form-json"],"serviceConfig":[1,"service-config"],"apiKey":[1,"api-key"],"apiProxyUrl":[1,"api-proxy-url"],"transcriptionModel":[1,"transcription-model"],"completionModel":[1,"completion-model"],"context":[1],"classificationRootUrl":[1,"classification-root-url"],"language":[1],"inputTypes":[1,"input-types"],"theme":[1],"debug":[4],"renderForm":[4,"render-form"],"displayStatus":[4,"display-status"],"isRecording":[32],"isProcessing":[32],"statusMessage":[32],"hasError":[32],"transcription":[32],"filledData":[32],"debugInfo":[32],"isReadonlyMode":[32],"convertXmlToJson":[64],"convertJsonToXml":[64],"convertXmlToJsonLegacy":[64],"convertJsonToXmlLegacy":[64]},null,{"formJson":["initializeServices"],"serviceConfig":["initializeServices"],"theme":["initializeServices"]}]]]], options);
20
+ return bootstrapLazy([["ocr-file-uploader",[[257,"ocr-file-uploader",{"batch":[4],"callback":[16],"jsonSchema":[1,"json-schema"],"theme":[1],"parsedTheme":[32]},null,{"theme":["parseTheme"]}]]],["voice-input-module",[[257,"voice-input-module",{"formJson":[1,"form-json"],"serviceConfig":[1,"service-config"],"apiKey":[1,"api-key"],"apiProxyUrl":[1,"api-proxy-url"],"transcriptionModel":[1,"transcription-model"],"completionModel":[1,"completion-model"],"transcriptionProvider":[1,"transcription-provider"],"completionProvider":[1,"completion-provider"],"context":[1],"classificationRootUrl":[1,"classification-root-url"],"language":[1],"inputTypes":[1,"input-types"],"theme":[1],"debug":[4],"renderForm":[4,"render-form"],"displayStatus":[4,"display-status"],"isRecording":[32],"isProcessing":[32],"statusMessage":[32],"hasError":[32],"transcription":[32],"filledData":[32],"debugInfo":[32],"isReadonlyMode":[32],"convertXmlToJson":[64],"convertJsonToXml":[64],"convertXmlToJsonLegacy":[64],"convertJsonToXmlLegacy":[64]},null,{"formJson":["initializeServices"],"serviceConfig":["initializeServices"],"theme":["initializeServices"],"transcriptionProvider":["initializeServices"],"completionProvider":["initializeServices"],"transcriptionModel":["initializeServices"],"completionModel":["initializeServices"]}]]]], options);
21
21
  });
22
22
  //# sourceMappingURL=voice-input-module.js.map
23
23
 
@@ -1,5 +1,6 @@
1
1
  import { EventEmitter } from '../../stencil-public-runtime';
2
2
  import { FormSchema, VoiceFormRecorderResult, FilledFormData, FormSchemaFieldsOnly, FormSchemaFieldsOnlyExtended } from '../../types/form-schema.types';
3
+ import { TranscriptionProvider, CompletionProvider } from '../../types/service-providers.types';
3
4
  export declare class VoiceFormRecorder {
4
5
  formJson: string;
5
6
  serviceConfig: string;
@@ -7,6 +8,8 @@ export declare class VoiceFormRecorder {
7
8
  apiProxyUrl: string;
8
9
  transcriptionModel: string;
9
10
  completionModel: string;
11
+ transcriptionProvider: TranscriptionProvider;
12
+ completionProvider: CompletionProvider;
10
13
  context: 'track' | 'ng' | 'ecoll-veto' | 'ecoteka';
11
14
  classificationRootUrl: string;
12
15
  language: 'fr' | 'en';
@@ -5,7 +5,9 @@
5
5
  * It contains typing information for all components that exist in this project.
6
6
  */
7
7
  import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
8
+ import { CompletionProvider, TranscriptionProvider } from "./types/service-providers.types";
8
9
  import { FormSchema, FormSchemaFieldsOnly, FormSchemaFieldsOnlyExtended, VoiceFormRecorderResult } from "./types/form-schema.types";
10
+ export { CompletionProvider, TranscriptionProvider } from "./types/service-providers.types";
9
11
  export { FormSchema, FormSchemaFieldsOnly, FormSchemaFieldsOnlyExtended, VoiceFormRecorderResult } from "./types/form-schema.types";
10
12
  export namespace Components {
11
13
  interface VoiceInputModule {
@@ -22,6 +24,10 @@ export namespace Components {
22
24
  * @default 'gpt-5-mini'
23
25
  */
24
26
  "completionModel": string;
27
+ /**
28
+ * @default 'openai'
29
+ */
30
+ "completionProvider": CompletionProvider;
25
31
  /**
26
32
  * @default undefined
27
33
  */
@@ -66,6 +72,10 @@ export namespace Components {
66
72
  * @default 'gpt-4o-transcribe'
67
73
  */
68
74
  "transcriptionModel": string;
75
+ /**
76
+ * @default 'openai'
77
+ */
78
+ "transcriptionProvider": TranscriptionProvider;
69
79
  }
70
80
  }
71
81
  export interface VoiceInputModuleCustomEvent<T> extends CustomEvent<T> {
@@ -110,6 +120,10 @@ declare namespace LocalJSX {
110
120
  * @default 'gpt-5-mini'
111
121
  */
112
122
  "completionModel"?: string;
123
+ /**
124
+ * @default 'openai'
125
+ */
126
+ "completionProvider"?: CompletionProvider;
113
127
  /**
114
128
  * @default undefined
115
129
  */
@@ -152,6 +166,10 @@ declare namespace LocalJSX {
152
166
  * @default 'gpt-4o-transcribe'
153
167
  */
154
168
  "transcriptionModel"?: string;
169
+ /**
170
+ * @default 'openai'
171
+ */
172
+ "transcriptionProvider"?: TranscriptionProvider;
155
173
  }
156
174
  interface IntrinsicElements {
157
175
  "voice-input-module": VoiceInputModule;
@@ -2,8 +2,13 @@ export declare class AudioRecorderService {
2
2
  private mediaRecorder;
3
3
  private audioChunks;
4
4
  private stream;
5
+ private audioContext;
6
+ private scriptProcessor;
7
+ private pcmChunks;
8
+ private sampleRate;
5
9
  startRecording(): Promise<void>;
6
10
  stopRecording(): Promise<Blob>;
11
+ private encodeWav;
7
12
  isRecording(): boolean;
8
13
  private cleanup;
9
14
  }
@@ -13,6 +13,28 @@ export declare class OpenAILLMService implements LLMProvider {
13
13
  fillFormFromJson(json: string, schema: any): Promise<any>;
14
14
  private fillForm;
15
15
  }
16
+ export declare class AnthropicLLMService implements LLMProvider {
17
+ private apiKey;
18
+ private model;
19
+ private useProxy;
20
+ private proxyUrl;
21
+ constructor(config: ServiceProviderConfig['llm']);
22
+ fillFormFromTranscription(transcription: string, schema: any): Promise<any>;
23
+ fillFormFromJson(json: string, schema: any): Promise<any>;
24
+ private fillForm;
25
+ private buildSystemPrompt;
26
+ }
27
+ export declare class MistralLLMService implements LLMProvider {
28
+ private apiKey;
29
+ private model;
30
+ private useProxy;
31
+ private proxyUrl;
32
+ constructor(config: ServiceProviderConfig['llm']);
33
+ fillFormFromTranscription(transcription: string, schema: any): Promise<any>;
34
+ fillFormFromJson(json: string, schema: any): Promise<any>;
35
+ private fillForm;
36
+ private buildSystemPrompt;
37
+ }
16
38
  export declare class LLMServiceFactory {
17
39
  static create(config: ServiceProviderConfig): LLMProvider;
18
40
  }
@@ -9,6 +9,14 @@ export declare class WhisperSpeechToTextService implements SpeechToTextProvider
9
9
  private getEnvironmentVariable;
10
10
  transcribe(audioContent: File, lang?: string): Promise<string>;
11
11
  }
12
+ export declare class MistralSpeechToTextService implements SpeechToTextProvider {
13
+ private apiKey;
14
+ private model;
15
+ private useProxy;
16
+ private proxyUrl;
17
+ constructor(config: ServiceProviderConfig['speechToText']);
18
+ transcribe(audioContent: File, lang?: string): Promise<string>;
19
+ }
12
20
  export declare class SpeechToTextServiceFactory {
13
21
  static create(config: ServiceProviderConfig): SpeechToTextProvider;
14
22
  }
@@ -1,3 +1,7 @@
1
+ export type TranscriptionProvider = 'openai' | 'mistral';
2
+ export type CompletionProvider = 'openai' | 'anthropic' | 'mistral';
3
+ export declare const TRANSCRIPTION_MODELS: Record<TranscriptionProvider, string[]>;
4
+ export declare const COMPLETION_MODELS: Record<CompletionProvider, string[]>;
1
5
  export interface SpeechToTextProvider {
2
6
  transcribe(audioBlob: Blob, lang: string): Promise<string>;
3
7
  }
@@ -7,7 +11,7 @@ export interface LLMProvider {
7
11
  }
8
12
  export interface ServiceProviderConfig {
9
13
  speechToText?: {
10
- provider: 'whisper' | 'custom';
14
+ provider: TranscriptionProvider;
11
15
  apiKey?: string;
12
16
  baseUrl?: string;
13
17
  useProxy?: boolean;
@@ -15,7 +19,7 @@ export interface ServiceProviderConfig {
15
19
  model?: string;
16
20
  };
17
21
  llm?: {
18
- provider: 'openai' | 'custom';
22
+ provider: CompletionProvider;
19
23
  apiKey?: string;
20
24
  model?: string;
21
25
  baseUrl?: string;
@@ -0,0 +1,3 @@
1
+ import{r as e,c as t,h as i}from"./p-jmc2yzBp.js";const r={openai:["gpt-4o-transcribe","gpt-4o-mini-transcribe","whisper-1"],mistral:["voxtral-mini-latest","voxtral-mini-transcribe-realtime-latest"]};const s={openai:["gpt-5","gpt-5-mini","gpt-5.5","gpt-4.1","gpt-4.1-mini","gpt-4o","gpt-4o-mini","o4-mini","gpt-5.2","gpt-5.3","gpt-5.4","gpt-5.4-mini","gpt-5.4-pro","gpt-5.4-nano"],anthropic:["claude-opus-4","claude-sonnet-4","claude-haiku-4","claude-3.7-sonnet","claude-3.5-sonnet","claude-opus-4.7","claude-opus-4.6","claude-opus-4.5","claude-sonnet-4.6","claude-sonnet-4.5"],mistral:["mistral-large-latest","mistral-medium-latest","mistral-small-latest","ministral","mistral-nemo"]};class n{constructor(){this.mediaRecorder=null;this.audioChunks=[];this.stream=null;this.audioContext=null;this.scriptProcessor=null;this.pcmChunks=[];this.sampleRate=16e3}async startRecording(){if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){throw new Error("Microphone access is not supported in this browser or the page is not served over HTTPS/localhost.")}this.stream=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:true,noiseSuppression:true,autoGainControl:true}});this.audioContext=new AudioContext({sampleRate:this.sampleRate});const e=this.audioContext.createMediaStreamSource(this.stream);this.scriptProcessor=this.audioContext.createScriptProcessor(4096,1,1);this.pcmChunks=[];this.scriptProcessor.onaudioprocess=e=>{const t=e.inputBuffer.getChannelData(0);this.pcmChunks.push(new Float32Array(t))};e.connect(this.scriptProcessor);this.scriptProcessor.connect(this.audioContext.destination)}async stopRecording(){if(!this.audioContext||!this.scriptProcessor){throw new Error("No active recording found")}this.scriptProcessor.disconnect();await this.audioContext.close();const e=this.encodeWav(this.pcmChunks,this.sampleRate);this.cleanup();return e}encodeWav(e,t){const i=e.reduce(((e,t)=>e+t.length),0);const r=new ArrayBuffer(44+i*2);const s=new DataView(r);const n=(e,t)=>{for(let i=0;i<t.length;i++)s.setUint8(e+i,t.charCodeAt(i))};n(0,"RIFF");s.setUint32(4,36+i*2,true);n(8,"WAVE");n(12,"fmt ");s.setUint32(16,16,true);s.setUint16(20,1,true);s.setUint16(22,1,true);s.setUint32(24,t,true);s.setUint32(28,t*2,true);s.setUint16(32,2,true);s.setUint16(34,16,true);n(36,"data");s.setUint32(40,i*2,true);let o=44;for(const t of e){for(let e=0;e<t.length;e++){const i=Math.max(-1,Math.min(1,t[e]));s.setInt16(o,i<0?i*32768:i*32767,true);o+=2}}return new Blob([r],{type:"audio/wav"})}isRecording(){return this.scriptProcessor!==null}cleanup(){if(this.stream){this.stream.getTracks().forEach((e=>e.stop()));this.stream=null}this.audioContext=null;this.scriptProcessor=null;this.pcmChunks=[]}}class o{constructor(e){this.useProxy=(e===null||e===void 0?void 0:e.useProxy)||false;this.proxyUrl=(e===null||e===void 0?void 0:e.proxyUrl)||"http://localhost:8492";this.model=(e===null||e===void 0?void 0:e.model)||"gpt-4o-transcribe";if(this.useProxy){this.apiKey="";this.baseUrl=this.proxyUrl}else{this.apiKey=(e===null||e===void 0?void 0:e.apiKey)||this.getEnvironmentVariable("OPENAI_API_KEY")||"";this.baseUrl=(e===null||e===void 0?void 0:e.baseUrl)||"https://api.openai.com/v1";if(!this.apiKey){throw new Error("OpenAI API key is required for Whisper service")}}}getEnvironmentVariable(e){if(typeof process!=="undefined"&&process.env){return process.env[e]}return window[e]||undefined}async transcribe(e,t="en"){var i;try{const r=new FormData;r.append("file",e);r.append("model",this.model);r.append("language",t);r.append("response_format","json");r.append("max_output_tokens","2000");const s=this.useProxy?`${this.baseUrl}/transcribe`:`${this.baseUrl}/audio/transcriptions`;const n={};if(!this.useProxy){n["Authorization"]=`Bearer ${this.apiKey}`}const o=await fetch(s,{method:"POST",headers:n,body:r});if(!o.ok){const e=await o.json().catch((()=>({error:"Unknown error"})));throw new Error(`Transcription failed: ${((i=e.error)===null||i===void 0?void 0:i.message)||o.statusText}`)}const a=await o.json();return a.text||""}catch(e){throw new Error(`Speech-to-text transcription failed: ${e.message}`)}}}class a{constructor(e){this.useProxy=(e===null||e===void 0?void 0:e.useProxy)||false;this.proxyUrl=(e===null||e===void 0?void 0:e.proxyUrl)||"http://localhost:8492";this.model=(e===null||e===void 0?void 0:e.model)||"voxtral-mini-latest";this.apiKey=this.useProxy?"":(e===null||e===void 0?void 0:e.apiKey)||"";if(!this.useProxy&&!this.apiKey){throw new Error("Mistral API key is required for speech-to-text service")}}async transcribe(e,t="en"){var i;try{const r=new FormData;r.append("file",e);r.append("model",this.model);r.append("language",t);const s=this.useProxy?`${this.proxyUrl}/transcribe-mistral`:"https://api.mistral.ai/v1/audio/transcriptions";const n={};if(!this.useProxy){n["Authorization"]=`Bearer ${this.apiKey}`}const o=await fetch(s,{method:"POST",headers:n,body:r});if(!o.ok){const e=await o.json().catch((()=>({error:"Unknown error"})));throw new Error(`Transcription failed: ${((i=e.error)===null||i===void 0?void 0:i.message)||o.statusText}`)}const a=await o.json();return a.text||""}catch(e){throw new Error(`Mistral speech-to-text failed: ${e.message}`)}}}class l{static create(e){var t;const i=((t=e.speechToText)===null||t===void 0?void 0:t.provider)||"openai";switch(i){case"openai":return new o(e.speechToText);case"mistral":return new a(e.speechToText);default:throw new Error(`Unsupported speech-to-text provider: ${i}`)}}}function c(e,t){try{if(typeof e!=="string"||typeof t!=="string"){console.error("[fuzzy-match] levenshteinDistance: Invalid input types",{str1Type:typeof e,str2Type:typeof t,str1:e,str2:t});throw new Error(`Invalid input types: str1=${typeof e}, str2=${typeof t}`)}const i=e.length;const r=t.length;const s=[];for(let e=0;e<=i;e++){s[e]=[e]}for(let e=0;e<=r;e++){s[0][e]=e}for(let n=1;n<=i;n++){for(let i=1;i<=r;i++){const r=e[n-1]===t[i-1]?0:1;s[n][i]=Math.min(s[n-1][i]+1,s[n][i-1]+1,s[n-1][i-1]+r)}}return s[i][r]}catch(i){console.error("[fuzzy-match] levenshteinDistance error:",i,{str1:e,str2:t});throw i}}function u(e){try{if(e===null||e===undefined){console.error("[fuzzy-match] normalizeString: Input is null or undefined",{str:e});return""}if(typeof e!=="string"){console.error("[fuzzy-match] normalizeString: Input is not a string",{type:typeof e,value:e});e=String(e)}const t=e.toLowerCase().trim().replace(/\s+/g," ");return t}catch(t){console.error("[fuzzy-match] normalizeString error:",t,{str:e});return""}}function f(e,t,i=.3){try{if(!e||!t||t.length===0){console.warn("[fuzzy-match] fuzzyMatchOption: Invalid input",{value:e,optionsLength:t===null||t===void 0?void 0:t.length});return null}const r=u(e);const s=r.split(" ");let n=null;let o=0;let a=0;for(let e=0;e<t.length;e++){try{const l=t[e];const f=u(l);const h=f.split(" ");if(r===f){return{match:l,confidence:1}}if(f.includes(r)){const e=.95-(f.length-r.length)*.01;if(e>o){n=l;o=e;a=1}else if(e===o){a++}}if(r.includes(f)){const e=.9-(r.length-f.length)*.01;if(e>o){n=l;o=e;a=1}else if(e===o){a++}}const d=h.every((e=>s.includes(e)));if(d){const e=.85;if(e>o){n=l;o=e;a=1}else if(e===o){a++}}const p=c(r,f);const v=Math.max(r.length,f.length);const m=p/v;const w=1-m;if(m<=i&&w>o){n=l;o=w;a=1}else if(m<=i&&w===o){a++}}catch(i){console.error(`[fuzzy-match] Error processing option at index ${e}:`,i,{option:t[e]});continue}}if(n===null){console.warn("[fuzzy-match] No match found");return null}if(a>1){console.warn("[fuzzy-match] Multiple matches with same confidence, returning null",{matchCount:a,bestConfidence:o});return null}return{match:n,confidence:o}}catch(r){console.error("[fuzzy-match] fuzzyMatchOption error:",r,{value:e,optionsCount:t===null||t===void 0?void 0:t.length,threshold:i});return null}}class h{constructor(e){this.useProxy=(e===null||e===void 0?void 0:e.useProxy)||false;this.proxyUrl=(e===null||e===void 0?void 0:e.proxyUrl)||"http://localhost:8492";if(this.useProxy){this.apiKey="";this.baseUrl=this.proxyUrl}else{this.apiKey=(e===null||e===void 0?void 0:e.apiKey)||this.getEnvironmentVariable("OPENAI_API_KEY")||"";this.baseUrl=(e===null||e===void 0?void 0:e.baseUrl)||"https://api.openai.com/v1";if(!this.apiKey){throw new Error("OpenAI API key is required for LLM service")}}this.model=(e===null||e===void 0?void 0:e.model)||"gpt-5-mini"}getEnvironmentVariable(e){if(typeof process!=="undefined"&&process.env){return process.env[e]}return window[e]||undefined}getOptimizeFieldsDescription(e){if(Array.isArray(e)){return e.map((e=>{let t=`- ID:${e.id||e.name} | ${e.name||e.title} `+`(${e.type}`+`${e.required?", required":""}`+`${e.readonly?", readonly":""}`+`${e.default!==undefined&&e.default!==null&&e.default!==""?", default="+e.default:""}`+`${e.min&&e.min!==""?", min="+e.min:""}`+`${e.max&&e.max!==""?", max="+e.max:""}`+`${e.pattern&&e.pattern!==""?", pattern="+e.pattern:""}`;if(e.options&&e.options.length>0){if(e.options.length<50){t+=`) - options: ${e.options.join(", ")}`}else{t+=`, many options: ${e.options.length} total) - extract raw value, will be matched locally`}}else{t+=")"}return t})).join("\n")}return Object.entries(e).map((([e,t])=>{let i=`- ID:${t.id||e} | ${t.title||e} `+`(${t.type}`+`${t.required?", required":""}`+`${t.readonly?", readonly":""}`+`${t.default!==undefined&&t.default!==null&&t.default!==""?", default="+t.default:""}`+`${t.min&&t.min!==""?", min="+t.min:""}`+`${t.max&&t.max!==""?", max="+t.max:""}`+`${t.pattern&&t.pattern!==""?", pattern="+t.pattern:""}`;if(t.options&&t.options.length>0){if(t.options.length<50){i+=`) - options: ${t.options.join(", ")}`}else{i+=`, many options: ${t.options.length} total) - extract raw value, will be matched locally`}}else{i+=")"}return i})).join("\n")}async fillFormFromTranscription(e,t){return this.fillForm(e,t,true)}applyFuzzyMatching(e,t){if((t===null||t===void 0?void 0:t.fields)||(t===null||t===void 0?void 0:t.schema)){const i=(t===null||t===void 0?void 0:t.fields)||(t===null||t===void 0?void 0:t.schema);const r=[];if(e.fields&&Array.isArray(e.fields)){e.fields=e.fields.map((e=>{const t=Object.values(i).find((t=>t.name===e.name||t.title===e.name));if(t&&t.options&&t.options.length>=50&&e.value){const i=t.type==="multiselect";if(i&&Array.isArray(e.value)){const i=[];const s=[];e.value.forEach((e=>{const r=f(e,t.options);if(r){i.push(r.match)}else{s.push(e)}}));if(s.length>0){r.push(e.name);e.error=`Could not match values: ${s.join(", ")}`}e.value=i.length>0?i:null;e.fuzzyMatchConfidence=i.length/(i.length+s.length)}else if(!i){const i=Array.isArray(e.value)?e.value[0]:e.value;const s=f(i,t.options);if(s){e.value=s.match;e.fuzzyMatchConfidence=s.confidence}else{r.push(e.name);e.value=null;e.error=`Could not match "${i}" to available options`}}}return e}))}if(r.length>0){e.matchingErrors=r}return e}if(t===null||t===void 0?void 0:t.schema){const i=[];Object.entries(t.schema).forEach((([t,r])=>{var s,n;if(r.options&&r.options.length>=50){const o=(n=(s=e.schema)===null||s===void 0?void 0:s[t])===null||n===void 0?void 0:n.default;if(o){const s=r.type==="multiselect";if(s&&Array.isArray(o)){const s=[];const n=[];o.forEach((e=>{const t=f(e,r.options);if(t){s.push(t.match)}else{n.push(e)}}));if(n.length>0){i.push(t);e.schema[t].error=`Could not match values: ${n.join(", ")}`}e.schema[t].default=s.length>0?s:null;e.schema[t].fuzzyMatchConfidence=s.length/(s.length+n.length)}else if(!s){const s=Array.isArray(o)?o[0]:o;const n=f(s,r.options);if(n){e.schema[t].default=n.match;e.schema[t].fuzzyMatchConfidence=n.confidence}else{i.push(t);e.schema[t].default=null;e.schema[t].error=`Could not match "${s}" to available options`}}}}}));if(i.length>0){e.matchingErrors=i}}return e}async fillFormFromJson(e,t){return this.fillForm(e,t,false)}async fillForm(e,t,i=true){var r,s;try{if((t===null||t===void 0?void 0:t.fields)||(t===null||t===void 0?void 0:t.schema)){const i=(t===null||t===void 0?void 0:t.fields)||(t===null||t===void 0?void 0:t.schema);const s=`You are an expert form-filling assistant. You will receive a voice transcription and form field definitions. Your task is to extract values from the spoken content.\n Rules:\n 1. Only extract values that can be confidently determined from the transcription\n 2. Respect field types (string, number, datetime, boolean, select)\n 3. For datetime fields, use ISO format (YYYY-MM-DDTHH:MM)\n 4. For date fields, use the following format: DD/MM/YYYY\n 5. For boolean fields, interpret yes/no, true/false, positive/negative responses\n 6. For select fields, use exact option values from the provided choices\n 7. Only include fields where relevant information is found\n 8. The current GMT datetime is ${(new Date).toGMTString()}\n 9. Respect the constraints written between parenthesis for readonly status (readonly fields MUST NOT be filled with values), min and max values, whatever the transcription says\n 9b. CRITICAL - DATE/DATETIME OUT OF RANGE: For date and datetime fields with min and/or max constraints, if the value from the transcription falls outside the allowed range, leave the field EMPTY. NEVER clamp, adjust, or substitute a boundary date - either the date is valid and within range, or the field is left empty\n 10. IMPORTANT: Fields marked as "readonly" are presentation elements (headers, labels) that provide context but MUST NOT receive values\n 11. CRITICAL - DUPLICATE FIELDS: When you see multiple fields with the same name but different IDs (e.g., "ID:field1 | Event date" and "ID:field2 | Event date"), these are DIFFERENT fields in DIFFERENT sections. The user may explicitly say which section they are filling (e.g., "for the first/second sub-form"). Listen VERY CAREFULLY to these contextual clues. Use the readonly headers to understand which section each field belongs to. If the user says "for the clinical sign, the event date is X", you must fill the Event date field that comes AFTER the "MC Clinical sign" header, NOT the first Event date you see\n 12. Use readonly fields as contextual hints to understand form structure and field grouping, but never fill them\n 13. CRITICAL - UNKNOWN/NO/N-A VALUES: The interpretation of words like "Unknown", "Inconnu", "No", "Non", "N/A", "Non applicable" depends ENTIRELY on whether the field has those words as explicit options. Rule: if the user says "field X is Unknown" (or any similar phrasing) AND "Unknown" (or a close variant) exists in the options list for that field, then SELECT that option - it is a valid value. If the user says such words for a field that does NOT have them as options (string, number, date, etc.), then it means the user has no value to provide - leave the field empty, do NOT fill it with the literal text\n 14. CRITICAL: Each field has a unique ID shown as "ID:xxx" at the start of its description. You MUST include this exact ID in your response for each field you fill. The ID is the ONLY way to distinguish between fields with the same name\n 15. CRITICAL - DEFAULT VALUES: Some fields have default values shown as "default=xxx". If the user does NOT mention a specific value for that field in the transcription, you MUST return the default value. Default values should be preserved unless explicitly overridden by the user\n 16. CRITICAL - PATTERN VALIDATION: Some fields have a regex pattern shown as "pattern=xxx". The value you extract MUST match this pattern exactly. If the transcription is too ambiguous to produce a value that matches the pattern, leave the field EMPTY\n\n Respond with JSON in this exact format: {"fields": [{"id": "field_id", "name": "field_name", "value": "extracted_value"}]}`;let n=`\n Voice transcription: "${e}"\n\n Form fields:\n ${this.getOptimizeFieldsDescription(i)}\n\n Please extract values from the Transcription for these fields.\n `;const o=this.useProxy?`${this.baseUrl}/complete`:`${this.baseUrl}/chat/completions`;const a={"Content-Type":"application/json"};if(!this.useProxy){a["Authorization"]=`Bearer ${this.apiKey}`}const l=await fetch(o,{method:"POST",headers:a,body:JSON.stringify({model:this.model,messages:[{role:"system",content:s},{role:"user",content:n}],response_format:{type:"json_object"},temperature:1})});if(!l.ok){const e=await l.json().catch((()=>({error:"Unknown error"})));throw new Error(`LLM API failed: ${((r=e.error)===null||r===void 0?void 0:r.message)||l.statusText}`)}const c=await l.json();const u=JSON.parse(c.choices[0].message.content);return this.applyFuzzyMatching(u,t)}const i=`You are an expert form-filling assistant. You will receive a voice transcription and a JSON form schema. Your task is to intelligently fill the form fields based on the spoken content.\n Rules:\n 1. Only fill fields that can be confidently determined from the transcription\n 2. Respect field types (string, number, date, boolean, select)\n 3. For datetime fields, use ISO format (YYYY-MM-DDTHH:MM)\n 4. For date fields, use the following format: DD/MM/YYYY\n 5. For boolean fields, interpret yes/no, true/false, positive/negative responses\n 6. For select fields, match the closest option from the provided choices\n 7. Leave fields empty if no relevant information is found\n 8. Return the same schema structure with 'default' values filled\n 9. The current GMT datetime is ${(new Date).toGMTString()}\n 10. Respect the constraints written between parenthesis for readonly status (readonly fields MUST NOT be filled with values), min and max values, whatever the transcription says\n 10b. CRITICAL - DATE/DATETIME OUT OF RANGE: For date and datetime fields with min and/or max constraints, if the value from the transcription falls outside the allowed range, leave the field EMPTY. NEVER clamp, adjust, or substitute a boundary date - either the date is valid and within range, or the field is left empty\n 11. IMPORTANT: Fields marked as "readonly" are presentation elements (headers, labels) that provide context but MUST NOT receive values\n 12. CRITICAL - DUPLICATE FIELDS: When you see multiple fields with the same name but different IDs (e.g., "ID:field1 | Event date" and "ID:field2 | Event date"), these are DIFFERENT fields in DIFFERENT sections. The user will explicitly say which section they are filling (e.g., "for the first/second sub-form", "in the anamnesis section", "for the clinical sign"). Listen VERY CAREFULLY to these contextual clues. Use the readonly headers to understand which section each field belongs to. If the user says "for the clinical sign, the event date is X", you must fill the Event date field that comes AFTER the "MC Clinical sign" header, NOT the first Event date you see\n 13. Use readonly fields as contextual hints to understand form structure and field grouping, but never fill them\n 14. CRITICAL - UNKNOWN/NO/N-A VALUES: The interpretation of words like "Unknown", "Inconnu", "No", "Non", "N/A", "Non applicable" depends ENTIRELY on whether the field has those words as explicit options. Rule: if the user says "field X is Unknown" (or any similar phrasing) AND "Unknown" (or a close variant) exists in the options list for that field, then SELECT that option - it is a valid value. If the user says such words for a field that does NOT have them as options (string, number, date, etc.), then it means the user has no value to provide - leave the field empty, do NOT fill it with the literal text\n 15. CRITICAL - PATTERN VALIDATION: Some fields have a regex pattern shown as "pattern=xxx". The value you extract MUST match this pattern exactly. If the transcription is too ambiguous to produce a value that matches the pattern, leave the field EMPTY\n\n Respond with JSON in this exact format: {"schema": {...}}`;let n=`\n Voice transcription: "${e}"\n\n Form schema to fill:\n ${JSON.stringify(t,null,2)}\n\n Please fill the form fields based on the Transcription and return the schema with default values populated.\n `;const o=this.useProxy?`${this.baseUrl}/complete`:`${this.baseUrl}/chat/completions`;const a={"Content-Type":"application/json"};if(!this.useProxy){a["Authorization"]=`Bearer ${this.apiKey}`}const l=await fetch(o,{method:"POST",headers:a,body:JSON.stringify({model:this.model,messages:[{role:"system",content:i},{role:"user",content:n}],response_format:{type:"json_object"},temperature:1})});if(!l.ok){const e=await l.json().catch((()=>({error:"Unknown error"})));throw new Error(`LLM API failed: ${((s=e.error)===null||s===void 0?void 0:s.message)||l.statusText}`)}const c=await l.json();const u=JSON.parse(c.choices[0].message.content);if(!u.schema){throw new Error("Invalid response format from LLM service")}return this.applyFuzzyMatching(u,t)}catch(e){throw new Error(`Form filling failed: ${e.message}`)}}}class d{constructor(e){this.useProxy=(e===null||e===void 0?void 0:e.useProxy)||false;this.proxyUrl=(e===null||e===void 0?void 0:e.proxyUrl)||"http://localhost:8492";this.model=(e===null||e===void 0?void 0:e.model)||"claude-sonnet-4.5";this.apiKey=this.useProxy?"":(e===null||e===void 0?void 0:e.apiKey)||"";if(!this.useProxy&&!this.apiKey){throw new Error("Anthropic API key is required")}}async fillFormFromTranscription(e,t){return this.fillForm(e,t)}async fillFormFromJson(e,t){return this.fillForm(e,t)}async fillForm(e,t){var i;const r=this.useProxy?`${this.proxyUrl}/complete-anthropic`:"https://api.anthropic.com/v1/messages";const s={"Content-Type":"application/json"};if(!this.useProxy){s["x-api-key"]=this.apiKey;s["anthropic-version"]="2023-06-01"}const n=(t===null||t===void 0?void 0:t.fields)||(t===null||t===void 0?void 0:t.schema)||t;const o=this.buildSystemPrompt();const a=`Data: "${e}"\n\nForm fields:\n${JSON.stringify(n,null,2)}\n\nRespond with JSON: {"fields": [{"id": "field_id", "name": "field_name", "value": "extracted_value"}]}`;const l=this.useProxy?{model:this.model,messages:[{role:"user",content:a}],system:o}:{model:this.model,max_tokens:4096,system:o,messages:[{role:"user",content:a}]};const c=await fetch(r,{method:"POST",headers:s,body:JSON.stringify(l)});if(!c.ok){const e=await c.json().catch((()=>({error:"Unknown error"})));throw new Error(`Anthropic API failed: ${((i=e.error)===null||i===void 0?void 0:i.message)||c.statusText}`)}const u=await c.json();const f=this.useProxy?u.choices[0].message.content:u.content[0].text;return JSON.parse(f)}buildSystemPrompt(){return`You are an expert form-filling assistant. Extract values from the input data and fill form fields.\nRules:\n1. Only extract values that can be confidently determined\n2. Respect field types (string, number, datetime, boolean, select)\n3. For datetime fields, use ISO format (YYYY-MM-DDTHH:MM)\n4. For date fields, use DD/MM/YYYY format\n5. For select fields, use exact option values from the provided choices\n6. Leave fields empty if no relevant information is found\n7. Fields marked readonly MUST NOT receive values\n8. DATE/DATETIME OUT OF RANGE: if a date falls outside min/max constraints, leave the field EMPTY\n9. PATTERN VALIDATION: if a field has a pattern, the value MUST match it exactly, otherwise leave empty\n10. UNKNOWN VALUES: if the user says "Unknown" and it exists as an option, select it; otherwise leave empty\nRespond ONLY with valid JSON.`}}class p{constructor(e){this.useProxy=(e===null||e===void 0?void 0:e.useProxy)||false;this.proxyUrl=(e===null||e===void 0?void 0:e.proxyUrl)||"http://localhost:8492";this.model=(e===null||e===void 0?void 0:e.model)||"mistral-medium-latest";this.apiKey=this.useProxy?"":(e===null||e===void 0?void 0:e.apiKey)||"";if(!this.useProxy&&!this.apiKey){throw new Error("Mistral API key is required")}}async fillFormFromTranscription(e,t){return this.fillForm(e,t)}async fillFormFromJson(e,t){return this.fillForm(e,t)}async fillForm(e,t){var i;const r=this.useProxy?`${this.proxyUrl}/complete-mistral`:"https://api.mistral.ai/v1/chat/completions";const s={"Content-Type":"application/json"};if(!this.useProxy){s["Authorization"]=`Bearer ${this.apiKey}`}const n=(t===null||t===void 0?void 0:t.fields)||(t===null||t===void 0?void 0:t.schema)||t;const o=this.buildSystemPrompt();const a=`Data: "${e}"\n\nForm fields:\n${JSON.stringify(n,null,2)}\n\nRespond with JSON: {"fields": [{"id": "field_id", "name": "field_name", "value": "extracted_value"}]}`;const l=await fetch(r,{method:"POST",headers:s,body:JSON.stringify({model:this.model,messages:[{role:"system",content:o},{role:"user",content:a}],response_format:{type:"json_object"}})});if(!l.ok){const e=await l.json().catch((()=>({error:"Unknown error"})));throw new Error(`Mistral API failed: ${((i=e.error)===null||i===void 0?void 0:i.message)||l.statusText}`)}const c=await l.json();return JSON.parse(c.choices[0].message.content)}buildSystemPrompt(){return`You are an expert form-filling assistant. Extract values from the input data and fill form fields.\nRules:\n1. Only extract values that can be confidently determined\n2. Respect field types (string, number, datetime, boolean, select)\n3. For datetime fields, use ISO format (YYYY-MM-DDTHH:MM)\n4. For date fields, use DD/MM/YYYY format\n5. For select fields, use exact option values from the provided choices\n6. Leave fields empty if no relevant information is found\n7. Fields marked readonly MUST NOT receive values\n8. DATE/DATETIME OUT OF RANGE: if a date falls outside min/max constraints, leave the field EMPTY\n9. PATTERN VALIDATION: if a field has a pattern, the value MUST match it exactly, otherwise leave empty\n10. UNKNOWN VALUES: if the user says "Unknown" and it exists as an option, select it; otherwise leave empty\nRespond ONLY with valid JSON.`}}class v{static create(e){var t;const i=((t=e.llm)===null||t===void 0?void 0:t.provider)||"openai";switch(i){case"openai":return new h(e.llm);case"anthropic":return new d(e.llm);case"mistral":return new p(e.llm);default:throw new Error(`Unsupported LLM provider: ${i}`)}}}class m{static convertXmlToJsonLegacy(e){try{const t=new DOMParser;const i=t.parseFromString(e,"text/xml");if(i.querySelector("parsererror")){throw new Error("Invalid XML format")}const r={schema:{}};const s=i.querySelector("form");if(s){r.title=s.getAttribute("title")||undefined;r.description=s.getAttribute("description")||undefined}const n=i.querySelectorAll("input, select, textarea");n.forEach((e=>{const t=e.getAttribute("name");if(!t)return;const i={type:this.mapXmlTypeToJsonTypeLegacy(e.tagName.toLowerCase(),e.getAttribute("type")),title:e.getAttribute("title")||e.getAttribute("placeholder")||t,description:e.getAttribute("description")||undefined,required:e.hasAttribute("required"),default:e.getAttribute("value")||undefined};if(e.tagName.toLowerCase()==="select"){const t=Array.from(e.querySelectorAll("option")).map((e=>e.textContent||e.getAttribute("value")||""));if(t.length>0){i.options=t}}const s=e.getAttribute("min");const n=e.getAttribute("max");const o=e.getAttribute("pattern");if(s)i.min=parseFloat(s);if(n)i.max=parseFloat(n);if(o)i.pattern=o;r.schema[t]=i}));return r}catch(e){throw new Error(`XML to JSON conversion failed: ${e.message}`)}}static convertJsonToXmlLegacy(e){try{const t=document.implementation.createDocument("","",null);const i=t.createElement("form");if(e.title){i.setAttribute("title",e.title)}if(e.description){i.setAttribute("description",e.description)}Object.entries(e.schema).forEach((([r,s])=>{var n;const o=e[r];const a=Object.assign(Object.assign({},s),{default:(n=s.default)!==null&&n!==void 0?n:o});const l=this.createXmlElementLegacy(t,r,a);if(l){i.appendChild(l)}}));t.appendChild(i);const r=new XMLSerializer;return r.serializeToString(t)}catch(e){throw new Error(`JSON to XML conversion failed: ${e.message}`)}}static mapXmlTypeToJsonTypeLegacy(e,t){switch(e){case"select":return"select";case"textarea":return"string";case"input":switch(t){case"number":case"range":return"number";case"date":case"datetime-local":case"time":return"date";case"checkbox":return"boolean";default:return"string"}default:return"string"}}static createXmlElementLegacy(e,t,i){let r;switch(i.type){case"select":r=e.createElement("select");if(i.options){i.options.forEach((t=>{const s=e.createElement("option");s.setAttribute("value",t);s.textContent=t;if(i.default!==undefined&&i.default===t){s.setAttribute("selected","true")}r.appendChild(s)}))}break;case"boolean":r=e.createElement("input");r.setAttribute("type","checkbox");if(i.default===true||i.default==="true"){r.setAttribute("checked","true")}break;case"number":r=e.createElement("input");r.setAttribute("type","number");if(i.min!==undefined)r.setAttribute("min",i.min.toString());if(i.max!==undefined)r.setAttribute("max",i.max.toString());if(i.default!==undefined)r.setAttribute("value",i.default.toString());break;case"date":r=e.createElement("input");r.setAttribute("type","date");if(i.default!==undefined)r.setAttribute("value",i.default.toString());break;default:r=e.createElement("input");r.setAttribute("type","text");if(i.default!==undefined)r.setAttribute("value",i.default.toString())}r.setAttribute("name",t);r.setAttribute("title",i.title);if(i.description){r.setAttribute("description",i.description)}if(i.required){r.setAttribute("required","true")}if(i.pattern){r.setAttribute("pattern",i.pattern)}return r}static async convertXmlToJson(e,t="http://localhost",i="en"){var r,s,n,o,a,l,c,u,f,h,d,p,v,m,w,g,b,y,x,T,$,S,E,C,O;try{const k=new DOMParser;const M=k.parseFromString(e,"text/xml");if(M.querySelector("parsererror")){throw new Error("Invalid XML format")}const I=M.querySelector("Xforms");if(!I)throw new Error("No Xforms root element found");const F=I.querySelectorAll("Fields");if(F.length===0)throw new Error("No Fields elements found");const N={fields:{}};for(const e of Array.from(F)){const k=(s=(r=e.querySelector("LabelTextFr"))===null||r===void 0?void 0:r.textContent)===null||s===void 0?void 0:s.trim();if(!k)return;const M=(o=(n=e.querySelector("HelpText"))===null||n===void 0?void 0:n.textContent)===null||o===void 0?void 0:o.trim();const I=(a=e.querySelector("DefaultValue"))===null||a===void 0?void 0:a.textContent;const F=((c=(l=e.querySelector("Enabled"))===null||l===void 0?void 0:l.textContent)===null||c===void 0?void 0:c.trim().toLowerCase())||"true";const A=F==="true";const R=(u=e.querySelector("ID"))===null||u===void 0?void 0:u.textContent;const j=(f=e.querySelector("TFie_PK_ID"))===null||f===void 0?void 0:f.textContent;const L=(h=e.querySelector("TVal_PK_ID"))===null||h===void 0?void 0:h.textContent;const D=(d=e.querySelector("TFIn_PK_ID"))===null||d===void 0?void 0:d.textContent;const P=(p=e.querySelector("isForm"))===null||p===void 0?void 0:p.textContent;const z=(v=e.querySelector("LabelText"))===null||v===void 0?void 0:v.textContent;const U=(m=e.querySelector("LabelTextFr"))===null||m===void 0?void 0:m.textContent;const _=(w=e.querySelector("SystemName"))===null||w===void 0?void 0:w.textContent;const Y=(g=e.querySelector("CssStyle"))===null||g===void 0?void 0:g.textContent;const J=((b=e.querySelector("ControlType"))===null||b===void 0?void 0:b.textContent)||"TextBox";const V=(y=e.querySelector("ValidationRequired"))===null||y===void 0?void 0:y.textContent;const q=(x=e.querySelector("ValidationMin"))===null||x===void 0?void 0:x.textContent;const W=(T=e.querySelector("ValidationMax"))===null||T===void 0?void 0:T.textContent;const X=($=e.querySelector("Mask"))===null||$===void 0?void 0:$.textContent;const H=(S=e.querySelector("TypeId"))===null||S===void 0?void 0:S.textContent;const B=(E=e.querySelector("Unit"))===null||E===void 0?void 0:E.textContent;const K=(C=e.querySelector("TFie_Fullpath"))===null||C===void 0?void 0:C.textContent;const G=(O=e.querySelector("TVal_FK_Parent_ID"))===null||O===void 0?void 0:O.textContent;const Z={type:this.mapControlTypeToJsonType(J),title:z,description:M,required:(V===null||V===void 0?void 0:V.toLowerCase())==="required",default:I||undefined,realType:J,Enabled:A,ID:R,TFie_PK_ID:j,TVal_PK_ID:L,TFIn_PK_ID:D,isForm:P,LabelText:z,LabelTextFr:U,SystemName:_,CssStyle:Y,ControlType:J,ValidationRequired:V,ValidationMin:q,ValidationMax:W,Mask:X,TypeId:H,Unit:B,TFie_Fullpath:K,TVal_FK_Parent_ID:G};if(Z.type.toLowerCase()==="select"){try{const e=await fetch(`${t}/ng/api/v1/classification/getList/${Z.ControlType.toLowerCase()=="termpicker"?"Position":"Thesaurus"}/?StartNodeID=${H}`);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);const r=await e.json();if(Array.isArray(r)){const e=r.map((e=>i==="fr"&&e.Name_Fr?e.Name_Fr:e.System_Name));if(e.length>0){Z.options=e}}else{console.error("Unexpected API response format:",r)}}catch(e){console.error("Error fetching classification data:",e)}}if(q)Z.min=parseFloat(q);if(W)Z.max=parseFloat(W);if(X)Z.pattern=X;N.fields[R]=Z}return N}catch(e){throw new Error(`XML to JSON conversion failed: ${e.message}`)}}static convertJsonToXml(e){try{const t=document.implementation.createDocument("","",null);const i=t.createElement("Xforms");Object.entries(e.schema?e.schema:e.fields).forEach((([r,s])=>{const n=t.createElement("Fields");const o=s;const a=t.createElement("SystemName");a.textContent=o.SystemName;n.appendChild(a);const l=t.createElement("LabelText");l.textContent=o.LabelText||o.title||r;n.appendChild(l);const c=t.createElement("LabelTextFr");c.textContent=o.LabelTextFr;n.appendChild(c);const u=t.createElement("HelpText");u.textContent=o.description;n.appendChild(u);const f=t.createElement("ControlType");f.textContent=o.realType;n.appendChild(f);const h=t.createElement("ValidationRequired");h.textContent=o.required?"Required":"Not Required";n.appendChild(h);const d=t.createElement("DefaultValue");const p=t.createElement("Value");if(e[r]!==undefined){d.textContent=e[r].toString();p.textContent=e[r].toString()}else{d.textContent=o.default||o.value;p.textContent=o.value||o.default}n.appendChild(d);n.appendChild(p);const v=t.createElement("Enabled");v.textContent=o.Enabled===false?"False":"True";n.appendChild(v);const m=t.createElement("isForm");m.textContent=o.isForm;n.appendChild(m);if(o.type==="header"){const e=t.createElement("Header");e.textContent=o.title;n.appendChild(e)}const w=t.createElement("ID");w.textContent=o.ID;n.appendChild(w);const g=t.createElement("TFie_PK_ID");g.textContent=o.TFie_PK_ID;n.appendChild(g);const b=t.createElement("TVal_PK_ID");b.textContent=o.TVal_PK_ID;n.appendChild(b);const y=t.createElement("TFIn_PK_ID");y.textContent=o.TFIn_PK_ID;n.appendChild(y);const x=t.createElement("CssStyle");x.textContent=o.CssStyle;n.appendChild(x);const T=t.createElement("TypeId");T.textContent=o.TypeId;n.appendChild(T);const $=t.createElement("Unit");$.textContent=o.Unit;n.appendChild($);const S=t.createElement("TFie_Fullpath");S.textContent=o.TFie_Fullpath;n.appendChild(S);const E=t.createElement("TVal_FK_Parent_ID");E.textContent=o.TVal_FK_Parent_ID;n.appendChild(E);const C=t.createElement("ValidationMin");C.textContent=o.ValidationMin;n.appendChild(C);const O=t.createElement("ValidationMax");O.textContent=o.ValidationMax;n.appendChild(O);const k=t.createElement("Mask");k.textContent=o.Mask;n.appendChild(k);i.appendChild(n)}));t.appendChild(i);const r=new XMLSerializer;return r.serializeToString(t)}catch(e){throw new Error(`JSON to XML conversion failed: ${e.message}`)}}static mapControlTypeToJsonType(e){switch(e.toLowerCase()){case"textbox":case"text":return"string";case"datepicker":return"date";case"thesauruspicker":case"thesauruspicker-ddl":case"termpicker":return"select";case"dbpicker":return"dbpicker";case"header":case"biglabel":return"header";case"checkbox":return"boolean";case"realpicker":case"numberpicker":return"number";default:return"string"}}}const w="ocr-file-uploader";const g={hotModuleReplacement:false,hydratedSelectorName:"hydrated",lazyLoad:true,propChangeCallback:true,updatable:true};var b=Object.create;var y=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var $=Object.getPrototypeOf;var S=Object.prototype.hasOwnProperty;var E=e=>{throw TypeError(e)};var C=(e,t,i)=>t in e?y(e,t,{enumerable:true,configurable:true,writable:true,value:i}):e[t]=i;var O=(e,t)=>function i(){return t||(0,e[T(e)[0]])((t={exports:{}}).exports,t),t.exports};var k=(e,t)=>{for(var i in t)y(e,i,{get:t[i],enumerable:true})};var M=(e,t,i,r)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let s of T(t))if(!S.call(e,s)&&s!==i)y(e,s,{get:()=>t[s],enumerable:!(r=x(t,s))||r.enumerable})}return e};var I=(e,t,i)=>(i=e!=null?b($(e)):{},M(y(i,"default",{value:e,enumerable:true}),e));var F=(e,t,i)=>C(e,t+"",i);var N=(e,t,i)=>t.has(e)||E("Cannot "+i);var A=(e,t,i)=>(N(e,t,"read from private field"),i?i.call(e):t.get(e));var R=(e,t,i)=>t.has(e)?E("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i);var j=(e,t,i,r)=>(N(e,t,"write to private field"),t.set(e,i),i);var L=(e,t,i)=>(N(e,t,"access private method"),i);var D=O({"node_modules/balanced-match/index.js"(e,t){t.exports=i;function i(e,t,i){if(e instanceof RegExp)e=r(e,i);if(t instanceof RegExp)t=r(t,i);var n=s(e,t,i);return n&&{start:n[0],end:n[1],pre:i.slice(0,n[0]),body:i.slice(n[0]+e.length,n[1]),post:i.slice(n[1]+t.length)}}function r(e,t){var i=t.match(e);return i?i[0]:null}i.range=s;function s(e,t,i){var r,s,n,o,a;var l=i.indexOf(e);var c=i.indexOf(t,l+1);var u=l;if(l>=0&&c>0){if(e===t){return[l,c]}r=[];n=i.length;while(u>=0&&!a){if(u==l){r.push(u);l=i.indexOf(e,u+1)}else if(r.length==1){a=[r.pop(),c]}else{s=r.pop();if(s<n){n=s;o=c}c=i.indexOf(t,u+1)}u=l<c&&l>=0?l:c}if(r.length){a=[n,o]}}return a}}});var P=O({"node_modules/brace-expansion/index.js"(e,t){var i=D();t.exports=h;var r="\0SLASH"+Math.random()+"\0";var s="\0OPEN"+Math.random()+"\0";var n="\0CLOSE"+Math.random()+"\0";var o="\0COMMA"+Math.random()+"\0";var a="\0PERIOD"+Math.random()+"\0";function l(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function c(e){return e.split("\\\\").join(r).split("\\{").join(s).split("\\}").join(n).split("\\,").join(o).split("\\.").join(a)}function u(e){return e.split(r).join("\\").split(s).join("{").split(n).join("}").split(o).join(",").split(a).join(".")}function f(e){if(!e)return[""];var t=[];var r=i("{","}",e);if(!r)return e.split(",");var s=r.pre;var n=r.body;var o=r.post;var a=s.split(",");a[a.length-1]+="{"+n+"}";var l=f(o);if(o.length){a[a.length-1]+=l.shift();a.push.apply(a,l)}t.push.apply(t,a);return t}function h(e){if(!e)return[];if(e.substr(0,2)==="{}"){e="\\{\\}"+e.substr(2)}return w(c(e),true).map(u)}function d(e){return"{"+e+"}"}function p(e){return/^-?0\d/.test(e)}function v(e,t){return e<=t}function m(e,t){return e>=t}function w(e,t){var r=[];var s=i("{","}",e);if(!s)return[e];var o=s.pre;var a=s.post.length?w(s.post,false):[""];if(/\$$/.test(s.pre)){for(var c=0;c<a.length;c++){var u=o+"{"+s.body+"}"+a[c];r.push(u)}}else{var h=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body);var g=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body);var b=h||g;var y=s.body.indexOf(",")>=0;if(!b&&!y){if(s.post.match(/,(?!,).*\}/)){e=s.pre+"{"+s.body+n+s.post;return w(e)}return[e]}var x;if(b){x=s.body.split(/\.\./)}else{x=f(s.body);if(x.length===1){x=w(x[0],false).map(d);if(x.length===1){return a.map((function(e){return s.pre+x[0]+e}))}}}var T;if(b){var $=l(x[0]);var S=l(x[1]);var E=Math.max(x[0].length,x[1].length);var C=x.length==3?Math.abs(l(x[2])):1;var O=v;var k=S<$;if(k){C*=-1;O=m}var M=x.some(p);T=[];for(var I=$;O(I,S);I+=C){var F;if(g){F=String.fromCharCode(I);if(F==="\\")F=""}else{F=String(I);if(M){var N=E-F.length;if(N>0){var A=new Array(N+1).join("0");if(I<0)F="-"+A+F.slice(1);else F=A+F}}}T.push(F)}}else{T=[];for(var R=0;R<x.length;R++){T.push.apply(T,w(x[R],false))}}for(var R=0;R<T.length;R++){for(var c=0;c<a.length;c++){var u=o+T[R]+a[c];if(!t||b||u)r.push(u)}}}return r}}});var z="http://www.w3.org/2000/svg";var U="http://www.w3.org/1999/xhtml";var _=e=>{if(e.__stencil__getHostRef){return e.__stencil__getHostRef()}return void 0};var Y=(e,t)=>{const i={t:0,$hostElement$:e,i:t,o:new Map,l:new Map};{i.u=new Promise((e=>i.h=e));e["s-p"]=[];e["s-rc"]=[]}{i.p=[]}const r=i;e.__stencil__getHostRef=()=>r;return r};var J=(e,t)=>t in e;var V=(e,t)=>(0,console.error)(e,t);var q=new Map;var W=(e,t,i)=>{const r=e.v.replace(/-/g,"_");const s=e.m;if(!s){return void 0}const n=q.get(s);if(n){return n[r]}
2
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/return import(`./${s}.entry.js${""}`).then((e=>{{q.set(s,e)}return e[r]}),(e=>{V(e,t.$hostElement$)}))};var X=new Map;var H="{visibility:hidden}.hydrated{visibility:inherit}";var B="slot-fb{display:contents}slot-fb[hidden]{display:none}";var K=typeof window!=="undefined"?window:{};var G={t:0,T:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,i,r)=>e.addEventListener(t,i,r),rel:(e,t,i,r)=>e.removeEventListener(t,i,r),ce:(e,t)=>new CustomEvent(e,t)};var Z=e=>Promise.resolve(e);var Q=(()=>{try{if(!K.document.adoptedStyleSheets){return false}new CSSStyleSheet;return typeof(new CSSStyleSheet).replaceSync==="function"}catch(e){}return false})();var ee=Q?(()=>!!K.document&&Object.getOwnPropertyDescriptor(K.document.adoptedStyleSheets,"length").writable)():false;var te=false;var ie=[];var re=[];var se=(e,t)=>t=>{e.push(t);if(!te){te=true;if(G.t&4){ae(oe)}else{G.raf(oe)}}};var ne=e=>{for(let t=0;t<e.length;t++){try{e[t](performance.now())}catch(e){V(e)}}e.length=0};var oe=()=>{ne(ie);{ne(re);if(te=ie.length>0){G.raf(oe)}}};var ae=e=>Z().then(e);var le=se(re);var ce=e=>{e=typeof e;return e==="object"||e==="function"};var ue=I(P());var fe=1024*64;var he=e=>{if(typeof e!=="string"){throw new TypeError("invalid pattern")}if(e.length>fe){throw new TypeError("pattern is too long")}};var de={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",true],"[:alpha:]":["\\p{L}\\p{Nl}",true],"[:ascii:]":["\\x00-\\x7f",false],"[:blank:]":["\\p{Zs}\\t",true],"[:cntrl:]":["\\p{Cc}",true],"[:digit:]":["\\p{Nd}",true],"[:graph:]":["\\p{Z}\\p{C}",true,true],"[:lower:]":["\\p{Ll}",true],"[:print:]":["\\p{C}",true],"[:punct:]":["\\p{P}",true],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",true],"[:upper:]":["\\p{Lu}",true],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",true],"[:xdigit:]":["A-Fa-f0-9",false]};var pe=e=>e.replace(/[[\]\\-]/g,"\\$&");var ve=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");var me=e=>e.join("");var we=(e,t)=>{const i=t;if(e.charAt(i)!=="["){throw new Error("not in a brace expression")}const r=[];const s=[];let n=i+1;let o=false;let a=false;let l=false;let c=false;let u=i;let f="";e:while(n<e.length){const t=e.charAt(n);if((t==="!"||t==="^")&&n===i+1){c=true;n++;continue}if(t==="]"&&o&&!l){u=n+1;break}o=true;if(t==="\\"){if(!l){l=true;n++;continue}}if(t==="["&&!l){for(const[t,[o,l,c]]of Object.entries(de)){if(e.startsWith(t,n)){if(f){return["$.",false,e.length-i,true]}n+=t.length;if(c)s.push(o);else r.push(o);a=a||l;continue e}}}l=false;if(f){if(t>f){r.push(pe(f)+"-"+pe(t))}else if(t===f){r.push(pe(t))}f="";n++;continue}if(e.startsWith("-]",n+1)){r.push(pe(t+"-"));n+=2;continue}if(e.startsWith("-",n+1)){f=t;n+=2;continue}r.push(pe(t));n++}if(u<n){return["",false,0,false]}if(!r.length&&!s.length){return["$.",false,e.length-i,true]}if(s.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!c){const e=r[0].length===2?r[0].slice(-1):r[0];return[ve(e),false,u-i,false]}const h="["+(c?"^":"")+me(r)+"]";const d="["+(c?"":"^")+me(s)+"]";const p=r.length&&s.length?"("+h+"|"+d+")":r.length?h:d;return[p,a,u-i,true]};var ge=(e,{windowsPathsNoEscape:t=false}={})=>t?e.replace(/\[([^\/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");var be=new Set(["!","?","+","*","@"]);var ye=e=>be.has(e);var xe="(?!(?:^|/)\\.\\.?(?:$|/))";var Te="(?!\\.)";var $e=new Set(["[","."]);var Se=new Set(["..","."]);var Ee=new Set("().*{}+?[]^$\\!");var Ce=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");var Oe="[^/]";var ke=Oe+"*?";var Me=Oe+"+?";var Ie,Fe,Ne,Ae,Re,je,Le,De,Pe,ze,Ue,_e,Ye,Je,Ve,qe,We;var Xe=class e{constructor(e,t,i={}){R(this,_e);F(this,"type");R(this,Ie);R(this,Fe);R(this,Ne,false);R(this,Ae,[]);R(this,Re);R(this,je);R(this,Le);R(this,De,false);R(this,Pe);R(this,ze);R(this,Ue,false);this.type=e;if(e)j(this,Fe,true);j(this,Re,t);j(this,Ie,A(this,Re)?A(A(this,Re),Ie):this);j(this,Pe,A(this,Ie)===this?i:A(A(this,Ie),Pe));j(this,Le,A(this,Ie)===this?[]:A(A(this,Ie),Le));if(e==="!"&&!A(A(this,Ie),De))A(this,Le).push(this);j(this,je,A(this,Re)?A(A(this,Re),Ae).length:0)}get hasMagic(){if(A(this,Fe)!==void 0)return A(this,Fe);for(const e of A(this,Ae)){if(typeof e==="string")continue;if(e.type||e.hasMagic)return j(this,Fe,true)}return A(this,Fe)}toString(){if(A(this,ze)!==void 0)return A(this,ze);if(!this.type){return j(this,ze,A(this,Ae).map((e=>String(e))).join(""))}else{return j(this,ze,this.type+"("+A(this,Ae).map((e=>String(e))).join("|")+")")}}push(...t){for(const i of t){if(i==="")continue;if(typeof i!=="string"&&!(i instanceof e&&A(i,Re)===this)){throw new Error("invalid part: "+i)}A(this,Ae).push(i)}}toJSON(){var e;const t=this.type===null?A(this,Ae).slice().map((e=>typeof e==="string"?e:e.toJSON())):[this.type,...A(this,Ae).map((e=>e.toJSON()))];if(this.isStart()&&!this.type)t.unshift([]);if(this.isEnd()&&(this===A(this,Ie)||A(A(this,Ie),De)&&((e=A(this,Re))==null?void 0:e.type)==="!")){t.push({})}return t}isStart(){var t;if(A(this,Ie)===this)return true;if(!((t=A(this,Re))==null?void 0:t.isStart()))return false;if(A(this,je)===0)return true;const i=A(this,Re);for(let t=0;t<A(this,je);t++){const r=A(i,Ae)[t];if(!(r instanceof e&&r.type==="!")){return false}}return true}isEnd(){var e,t,i;if(A(this,Ie)===this)return true;if(((e=A(this,Re))==null?void 0:e.type)==="!")return true;if(!((t=A(this,Re))==null?void 0:t.isEnd()))return false;if(!this.type)return(i=A(this,Re))==null?void 0:i.isEnd();const r=A(this,Re)?A(A(this,Re),Ae).length:0;return A(this,je)===r-1}copyIn(e){if(typeof e==="string")this.push(e);else this.push(e.clone(this))}clone(t){const i=new e(this.type,t);for(const e of A(this,Ae)){i.copyIn(e)}return i}static fromGlob(t,i={}){var r;const s=new e(null,void 0,i);L(r=e,Je,Ve).call(r,t,s,0,i);return s}toMMPattern(){if(this!==A(this,Ie))return A(this,Ie).toMMPattern();const e=this.toString();const[t,i,r,s]=this.toRegExpSource();const n=r||A(this,Fe)||A(this,Pe).nocase&&!A(this,Pe).nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase();if(!n){return i}const o=(A(this,Pe).nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${t}$`,o),{_src:t,_glob:e})}get options(){return A(this,Pe)}toRegExpSource(t){var i;const r=t!=null?t:!!A(this,Pe).dot;if(A(this,Ie)===this)L(this,_e,Ye).call(this);if(!this.type){const s=this.isStart()&&this.isEnd();const n=A(this,Ae).map((i=>{var r;const[n,o,a,l]=typeof i==="string"?L(r=e,Je,We).call(r,i,A(this,Fe),s):i.toRegExpSource(t);j(this,Fe,A(this,Fe)||a);j(this,Ne,A(this,Ne)||l);return n})).join("");let o="";if(this.isStart()){if(typeof A(this,Ae)[0]==="string"){const e=A(this,Ae).length===1&&Se.has(A(this,Ae)[0]);if(!e){const e=$e;const i=r&&e.has(n.charAt(0))||n.startsWith("\\.")&&e.has(n.charAt(2))||n.startsWith("\\.\\.")&&e.has(n.charAt(4));const s=!r&&!t&&e.has(n.charAt(0));o=i?xe:s?Te:""}}}let a="";if(this.isEnd()&&A(A(this,Ie),De)&&((i=A(this,Re))==null?void 0:i.type)==="!"){a="(?:$|\\/)"}const l=o+n+a;return[l,ge(n),j(this,Fe,!!A(this,Fe)),A(this,Ne)]}const s=this.type==="*"||this.type==="+";const n=this.type==="!"?"(?:(?!(?:":"(?:";let o=L(this,_e,qe).call(this,r);if(this.isStart()&&this.isEnd()&&!o&&this.type!=="!"){const e=this.toString();j(this,Ae,[e]);this.type=null;j(this,Fe,void 0);return[e,ge(this.toString()),false,false]}let a=!s||t||r||false?"":L(this,_e,qe).call(this,true);if(a===o){a=""}if(a){o=`(?:${o})(?:${a})*?`}let l="";if(this.type==="!"&&A(this,Ue)){l=(this.isStart()&&!r?Te:"")+Me}else{const e=this.type==="!"?"))"+(this.isStart()&&!r&&!t?Te:"")+ke+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&a?")":this.type==="*"&&a?`)?`:`)${this.type}`;l=n+o+e}return[l,ge(o),j(this,Fe,!!A(this,Fe)),A(this,Ne)]}};Ie=new WeakMap;Fe=new WeakMap;Ne=new WeakMap;Ae=new WeakMap;Re=new WeakMap;je=new WeakMap;Le=new WeakMap;De=new WeakMap;Pe=new WeakMap;ze=new WeakMap;Ue=new WeakMap;_e=new WeakSet;Ye=function(){if(this!==A(this,Ie))throw new Error("should only call on root");if(A(this,De))return this;this.toString();j(this,De,true);let e;while(e=A(this,Le).pop()){if(e.type!=="!")continue;let t=e;let i=A(t,Re);while(i){for(let r=A(t,je)+1;!i.type&&r<A(i,Ae).length;r++){for(const t of A(e,Ae)){if(typeof t==="string"){throw new Error("string part in extglob AST??")}t.copyIn(A(i,Ae)[r])}}t=i;i=A(t,Re)}}return this};Je=new WeakSet;Ve=function(e,t,i,r){var s,n;let o=false;let a=false;let l=-1;let c=false;if(t.type===null){let n=i;let u="";while(n<e.length){const i=e.charAt(n++);if(o||i==="\\"){o=!o;u+=i;continue}if(a){if(n===l+1){if(i==="^"||i==="!"){c=true}}else if(i==="]"&&!(n===l+2&&c)){a=false}u+=i;continue}else if(i==="["){a=true;l=n;c=false;u+=i;continue}if(!r.noext&&ye(i)&&e.charAt(n)==="("){t.push(u);u="";const o=new Xe(i,t);n=L(s=Xe,Je,Ve).call(s,e,o,n,r);t.push(o);continue}u+=i}t.push(u);return n}let u=i+1;let f=new Xe(null,t);const h=[];let d="";while(u<e.length){const i=e.charAt(u++);if(o||i==="\\"){o=!o;d+=i;continue}if(a){if(u===l+1){if(i==="^"||i==="!"){c=true}}else if(i==="]"&&!(u===l+2&&c)){a=false}d+=i;continue}else if(i==="["){a=true;l=u;c=false;d+=i;continue}if(ye(i)&&e.charAt(u)==="("){f.push(d);d="";const t=new Xe(i,f);f.push(t);u=L(n=Xe,Je,Ve).call(n,e,t,u,r);continue}if(i==="|"){f.push(d);d="";h.push(f);f=new Xe(null,t);continue}if(i===")"){if(d===""&&A(t,Ae).length===0){j(t,Ue,true)}f.push(d);d="";t.push(...h,f);return u}d+=i}t.type=null;j(t,Fe,void 0);j(t,Ae,[e.substring(i-1)]);return u};qe=function(e){return A(this,Ae).map((t=>{if(typeof t==="string"){throw new Error("string type in extglob ast??")}const[i,r,s,n]=t.toRegExpSource(e);j(this,Ne,A(this,Ne)||n);return i})).filter((e=>!(this.isStart()&&this.isEnd())||!!e)).join("|")};We=function(e,t,i=false){let r=false;let s="";let n=false;for(let o=0;o<e.length;o++){const a=e.charAt(o);if(r){r=false;s+=(Ee.has(a)?"\\":"")+a;continue}if(a==="\\"){if(o===e.length-1){s+="\\\\"}else{r=true}continue}if(a==="["){const[i,r,a,l]=we(e,o);if(a){s+=i;n=n||r;o+=a-1;t=t||l;continue}}if(a==="*"){if(i&&e==="*")s+=Me;else s+=ke;t=true;continue}if(a==="?"){s+=Oe;t=true;continue}s+=Ce(a)}return[s,ge(e),!!t,n]};R(Xe,Je);var He=Xe;var Be=(e,{windowsPathsNoEscape:t=false}={})=>t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&");var Ke=(e,t,i={})=>{he(t);if(!i.nocomment&&t.charAt(0)==="#"){return false}return new At(t,i).match(e)};var Ge=/^\*+([^+@!?\*\[\(]*)$/;var Ze=e=>t=>!t.startsWith(".")&&t.endsWith(e);var Qe=e=>t=>t.endsWith(e);var et=e=>{e=e.toLowerCase();return t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)};var tt=e=>{e=e.toLowerCase();return t=>t.toLowerCase().endsWith(e)};var it=/^\*+\.\*+$/;var rt=e=>!e.startsWith(".")&&e.includes(".");var st=e=>e!=="."&&e!==".."&&e.includes(".");var nt=/^\.\*+$/;var ot=e=>e!=="."&&e!==".."&&e.startsWith(".");var at=/^\*+$/;var lt=e=>e.length!==0&&!e.startsWith(".");var ct=e=>e.length!==0&&e!=="."&&e!=="..";var ut=/^\?+([^+@!?\*\[\(]*)?$/;var ft=([e,t=""])=>{const i=vt([e]);if(!t)return i;t=t.toLowerCase();return e=>i(e)&&e.toLowerCase().endsWith(t)};var ht=([e,t=""])=>{const i=mt([e]);if(!t)return i;t=t.toLowerCase();return e=>i(e)&&e.toLowerCase().endsWith(t)};var dt=([e,t=""])=>{const i=mt([e]);return!t?i:e=>i(e)&&e.endsWith(t)};var pt=([e,t=""])=>{const i=vt([e]);return!t?i:e=>i(e)&&e.endsWith(t)};var vt=([e])=>{const t=e.length;return e=>e.length===t&&!e.startsWith(".")};var mt=([e])=>{const t=e.length;return e=>e.length===t&&e!=="."&&e!==".."};var wt=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix";var gt={win32:{sep:"\\"},posix:{sep:"/"}};var bt=wt==="win32"?gt.win32.sep:gt.posix.sep;Ke.sep=bt;var yt=Symbol("globstar **");Ke.GLOBSTAR=yt;var xt="[^/]";var Tt=xt+"*?";var $t="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";var St="(?:(?!(?:\\/|^)\\.).)*?";var Et=(e,t={})=>i=>Ke(i,e,t);Ke.filter=Et;var Ct=(e,t={})=>Object.assign({},e,t);var Ot=e=>{if(!e||typeof e!=="object"||!Object.keys(e).length){return Ke}const t=Ke;const i=(i,r,s={})=>t(i,r,Ct(e,s));return Object.assign(i,{Minimatch:class i extends t.Minimatch{constructor(t,i={}){super(t,Ct(e,i))}static defaults(i){return t.defaults(Ct(e,i)).Minimatch}},AST:class i extends t.AST{constructor(t,i,r={}){super(t,i,Ct(e,r))}static fromGlob(i,r={}){return t.AST.fromGlob(i,Ct(e,r))}},unescape:(i,r={})=>t.unescape(i,Ct(e,r)),escape:(i,r={})=>t.escape(i,Ct(e,r)),filter:(i,r={})=>t.filter(i,Ct(e,r)),defaults:i=>t.defaults(Ct(e,i)),makeRe:(i,r={})=>t.makeRe(i,Ct(e,r)),braceExpand:(i,r={})=>t.braceExpand(i,Ct(e,r)),match:(i,r,s={})=>t.match(i,r,Ct(e,s)),sep:t.sep,GLOBSTAR:yt})};Ke.defaults=Ot;var kt=(e,t={})=>{he(e);if(t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)){return[e]}return(0,ue.default)(e)};Ke.braceExpand=kt;var Mt=(e,t={})=>new At(e,t).makeRe();Ke.makeRe=Mt;var It=(e,t,i={})=>{const r=new At(t,i);e=e.filter((e=>r.match(e)));if(r.options.nonull&&!e.length){e.push(t)}return e};Ke.match=It;var Ft=/[?*]|[+@!]\(.*?\)|\[|\]/;var Nt=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");var At=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(e,t={}){he(e);t=t||{};this.options=t;this.pattern=e;this.platform=t.platform||wt;this.isWindows=this.platform==="win32";this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===false;if(this.windowsPathsNoEscape){this.pattern=this.pattern.replace(/\\/g,"/")}this.preserveMultipleSlashes=!!t.preserveMultipleSlashes;this.regexp=null;this.negate=false;this.nonegate=!!t.nonegate;this.comment=false;this.empty=false;this.partial=!!t.partial;this.nocase=!!this.options.nocase;this.windowsNoMagicRoot=t.windowsNoMagicRoot!==void 0?t.windowsNoMagicRoot:!!(this.isWindows&&this.nocase);this.globSet=[];this.globParts=[];this.set=[];this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1){return true}for(const e of this.set){for(const t of e){if(typeof t!=="string")return true}}return false}debug(...e){}make(){const e=this.pattern;const t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=true;return}if(!e){this.empty=true;return}this.parseNegate();this.globSet=[...new Set(this.braceExpand())];if(t.debug){this.debug=(...e)=>console.error(...e)}this.debug(this.pattern,this.globSet);const i=this.globSet.map((e=>this.slashSplit(e)));this.globParts=this.preprocess(i);this.debug(this.pattern,this.globParts);let r=this.globParts.map(((e,t,i)=>{if(this.isWindows&&this.windowsNoMagicRoot){const t=e[0]===""&&e[1]===""&&(e[2]==="?"||!Ft.test(e[2]))&&!Ft.test(e[3]);const i=/^[a-z]:/i.test(e[0]);if(t){return[...e.slice(0,4),...e.slice(4).map((e=>this.parse(e)))]}else if(i){return[e[0],...e.slice(1).map((e=>this.parse(e)))]}}return e.map((e=>this.parse(e)))}));this.debug(this.pattern,r);this.set=r.filter((e=>e.indexOf(false)===-1));if(this.isWindows){for(let e=0;e<this.set.length;e++){const t=this.set[e];if(t[0]===""&&t[1]===""&&this.globParts[e][2]==="?"&&typeof t[3]==="string"&&/^[a-z]:$/i.test(t[3])){t[2]="?"}}}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar){for(let t=0;t<e.length;t++){for(let i=0;i<e[t].length;i++){if(e[t][i]==="**"){e[t][i]="*"}}}}const{optimizationLevel:t=1}=this.options;if(t>=2){e=this.firstPhasePreProcess(e);e=this.secondPhasePreProcess(e)}else if(t>=1){e=this.levelOneOptimize(e)}else{e=this.adjascentGlobstarOptimize(e)}return e}adjascentGlobstarOptimize(e){return e.map((e=>{let t=-1;while(-1!==(t=e.indexOf("**",t+1))){let i=t;while(e[i+1]==="**"){i++}if(i!==t){e.splice(t,i-t)}}return e}))}levelOneOptimize(e){return e.map((e=>{e=e.reduce(((e,t)=>{const i=e[e.length-1];if(t==="**"&&i==="**"){return e}if(t===".."){if(i&&i!==".."&&i!=="."&&i!=="**"){e.pop();return e}}e.push(t);return e}),[]);return e.length===0?[""]:e}))}levelTwoFileOptimize(e){if(!Array.isArray(e)){e=this.slashSplit(e)}let t=false;do{t=false;if(!this.preserveMultipleSlashes){for(let i=1;i<e.length-1;i++){const r=e[i];if(i===1&&r===""&&e[0]==="")continue;if(r==="."||r===""){t=true;e.splice(i,1);i--}}if(e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")){t=true;e.pop()}}let i=0;while(-1!==(i=e.indexOf("..",i+1))){const r=e[i-1];if(r&&r!=="."&&r!==".."&&r!=="**"){t=true;e.splice(i-1,2);i-=2}}}while(t);return e.length===0?[""]:e}firstPhasePreProcess(e){let t=false;do{t=false;for(let i of e){let r=-1;while(-1!==(r=i.indexOf("**",r+1))){let s=r;while(i[s+1]==="**"){s++}if(s>r){i.splice(r+1,s-r)}let n=i[r+1];const o=i[r+2];const a=i[r+3];if(n!=="..")continue;if(!o||o==="."||o===".."||!a||a==="."||a===".."){continue}t=true;i.splice(r,1);const l=i.slice(0);l[r]="**";e.push(l);r--}if(!this.preserveMultipleSlashes){for(let e=1;e<i.length-1;e++){const r=i[e];if(e===1&&r===""&&i[0]==="")continue;if(r==="."||r===""){t=true;i.splice(e,1);e--}}if(i[0]==="."&&i.length===2&&(i[1]==="."||i[1]==="")){t=true;i.pop()}}let s=0;while(-1!==(s=i.indexOf("..",s+1))){const e=i[s-1];if(e&&e!=="."&&e!==".."&&e!=="**"){t=true;const e=s===1&&i[s+1]==="**";const r=e?["."]:[];i.splice(s-1,2,...r);if(i.length===0)i.push("");s-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++){for(let i=t+1;i<e.length;i++){const r=this.partsMatch(e[t],e[i],!this.preserveMultipleSlashes);if(!r)continue;e[t]=r;e[i]=[]}}return e.filter((e=>e.length))}partsMatch(e,t,i=false){let r=0;let s=0;let n=[];let o="";while(r<e.length&&s<t.length){if(e[r]===t[s]){n.push(o==="b"?t[s]:e[r]);r++;s++}else if(i&&e[r]==="**"&&t[s]===e[r+1]){n.push(e[r]);r++}else if(i&&t[s]==="**"&&e[r]===t[s+1]){n.push(t[s]);s++}else if(e[r]==="*"&&t[s]&&(this.options.dot||!t[s].startsWith("."))&&t[s]!=="**"){if(o==="b")return false;o="a";n.push(e[r]);r++;s++}else if(t[s]==="*"&&e[r]&&(this.options.dot||!e[r].startsWith("."))&&e[r]!=="**"){if(o==="a")return false;o="b";n.push(t[s]);r++;s++}else{return false}}return e.length===t.length&&n}parseNegate(){if(this.nonegate)return;const e=this.pattern;let t=false;let i=0;for(let r=0;r<e.length&&e.charAt(r)==="!";r++){t=!t;i++}if(i)this.pattern=e.slice(i);this.negate=t}matchOne(e,t,i=false){const r=this.options;if(this.isWindows){const i=typeof e[0]==="string"&&/^[a-z]:$/i.test(e[0]);const r=!i&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]);const s=typeof t[0]==="string"&&/^[a-z]:$/i.test(t[0]);const n=!s&&t[0]===""&&t[1]===""&&t[2]==="?"&&typeof t[3]==="string"&&/^[a-z]:$/i.test(t[3]);const o=r?3:i?0:void 0;const a=n?3:s?0:void 0;if(typeof o==="number"&&typeof a==="number"){const[i,r]=[e[o],t[a]];if(i.toLowerCase()===r.toLowerCase()){t[a]=i;if(a>o){t=t.slice(a)}else if(o>a){e=e.slice(o)}}}}const{optimizationLevel:s=1}=this.options;if(s>=2){e=this.levelTwoFileOptimize(e)}this.debug("matchOne",this,{file:e,pattern:t});this.debug("matchOne",e.length,t.length);for(var n=0,o=0,a=e.length,l=t.length;n<a&&o<l;n++,o++){this.debug("matchOne loop");var c=t[o];var u=e[n];this.debug(t,c,u);if(c===false){return false}if(c===yt){this.debug("GLOBSTAR",[t,c,u]);var f=n;var h=o+1;if(h===l){this.debug("** at the end");for(;n<a;n++){if(e[n]==="."||e[n]===".."||!r.dot&&e[n].charAt(0)===".")return false}return true}while(f<a){var d=e[f];this.debug("\nglobstar while",e,f,t,h,d);if(this.matchOne(e.slice(f),t.slice(h),i)){this.debug("globstar found match!",f,a,d);return true}else{if(d==="."||d===".."||!r.dot&&d.charAt(0)==="."){this.debug("dot detected!",e,f,t,h);break}this.debug("globstar swallow a segment, and continue");f++}}if(i){this.debug("\n>>> no match, partial?",e,f,t,h);if(f===a){return true}}return false}let s;if(typeof c==="string"){s=u===c;this.debug("string match",c,u,s)}else{s=c.test(u);this.debug("pattern match",c,u,s)}if(!s)return false}if(n===a&&o===l){return true}else if(n===a){return i}else if(o===l){return n===a-1&&e[n]===""}else{throw new Error("wtf?")}}braceExpand(){return kt(this.pattern,this.options)}parse(e){he(e);const t=this.options;if(e==="**")return yt;if(e==="")return"";let i;let r=null;if(i=e.match(at)){r=t.dot?ct:lt}else if(i=e.match(Ge)){r=(t.nocase?t.dot?tt:et:t.dot?Qe:Ze)(i[1])}else if(i=e.match(ut)){r=(t.nocase?t.dot?ht:ft:t.dot?dt:pt)(i)}else if(i=e.match(it)){r=t.dot?st:rt}else if(i=e.match(nt)){r=ot}const s=He.fromGlob(e,this.options).toMMPattern();if(r&&typeof s==="object"){Reflect.defineProperty(s,"test",{value:r})}return s}makeRe(){if(this.regexp||this.regexp===false)return this.regexp;const e=this.set;if(!e.length){this.regexp=false;return this.regexp}const t=this.options;const i=t.noglobstar?Tt:t.dot?$t:St;const r=new Set(t.nocase?["i"]:[]);let s=e.map((e=>{const t=e.map((e=>{if(e instanceof RegExp){for(const t of e.flags.split(""))r.add(t)}return typeof e==="string"?Nt(e):e===yt?yt:e._src}));t.forEach(((e,r)=>{const s=t[r+1];const n=t[r-1];if(e!==yt||n===yt){return}if(n===void 0){if(s!==void 0&&s!==yt){t[r+1]="(?:\\/|"+i+"\\/)?"+s}else{t[r]=i}}else if(s===void 0){t[r-1]=n+"(?:\\/|"+i+")?"}else if(s!==yt){t[r-1]=n+"(?:\\/|\\/"+i+"\\/)"+s;t[r+1]=yt}}));return t.filter((e=>e!==yt)).join("/")})).join("|");const[n,o]=e.length>1?["(?:",")"]:["",""];s="^"+n+s+o+"$";if(this.negate)s="^(?!"+s+").+$";try{this.regexp=new RegExp(s,[...r].join(""))}catch(e){this.regexp=false}return this.regexp}slashSplit(e){if(this.preserveMultipleSlashes){return e.split("/")}else if(this.isWindows&&/^\/\/[^\/]+/.test(e)){return["",...e.split(/\/+/)]}else{return e.split(/\/+/)}}match(e,t=this.partial){this.debug("match",e,this.pattern);if(this.comment){return false}if(this.empty){return e===""}if(e==="/"&&t){return true}const i=this.options;if(this.isWindows){e=e.split("\\").join("/")}const r=this.slashSplit(e);this.debug(this.pattern,"split",r);const s=this.set;this.debug(this.pattern,"set",s);let n=r[r.length-1];if(!n){for(let e=r.length-2;!n&&e>=0;e--){n=r[e]}}for(let e=0;e<s.length;e++){const o=s[e];let a=r;if(i.matchBase&&o.length===1){a=[n]}const l=this.matchOne(a,o,t);if(l){if(i.flipNegate){return true}return!this.negate}}if(i.flipNegate){return false}return this.negate}static defaults(e){return Ke.defaults(e).Minimatch}};Ke.AST=He;Ke.Minimatch=At;Ke.escape=Be;Ke.unescape=ge;function Rt(e){var t,i,r;return(r=(i=(t=e.head)==null?void 0:t.querySelector('meta[name="csp-nonce"]'))==null?void 0:i.getAttribute("content"))!=null?r:void 0}var jt=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");var Lt={};k(Lt,{err:()=>Pt,map:()=>zt,ok:()=>Dt,unwrap:()=>Ut,unwrapErr:()=>_t});var Dt=e=>({isOk:true,isErr:false,value:e});var Pt=e=>({isOk:false,isErr:true,value:e});function zt(e,t){if(e.isOk){const i=t(e.value);if(i instanceof Promise){return i.then((e=>Dt(e)))}else{return Dt(i)}}if(e.isErr){const t=e.value;return Pt(t)}throw"should never get here"}var Ut=e=>{if(e.isOk){return e.value}else{throw e.value}};var _t=e=>{if(e.isErr){return e.value}else{throw e.value}};function Yt(e){return void 0}var Jt;function Vt(e){var t;const i={mode:"open"};const r=this.attachShadow(i);if(Jt===void 0)Jt=(t=Yt())!=null?t:null;if(Jt){if(ee){r.adoptedStyleSheets.push(Jt)}else{r.adoptedStyleSheets=[...r.adoptedStyleSheets,Jt]}}}var qt=(e,t="")=>{{return()=>{}}};var Wt=(e,t)=>{{return()=>{}}};var Xt=new WeakMap;var Ht=(e,t,i)=>{let r=X.get(e);if(Q&&i){r=r||new CSSStyleSheet;if(typeof r==="string"){r=t}else{r.replaceSync(t)}}else{r=t}X.set(e,r)};var Bt=(e,t,i)=>{var r,s,n;const o=Gt(t);const a=X.get(o);if(!K.document){return o}e=e.nodeType===11?e:K.document;if(a){if(typeof a==="string"){e=e.head||e;let i=Xt.get(e);let n;if(!i){Xt.set(e,i=new Set)}if(!i.has(o)){n=K.document.createElement("style");n.innerHTML=a;const l=(r=G.$)!=null?r:Rt(K.document);if(l!=null){n.setAttribute("nonce",l)}if(!(t.t&1)){if(e.nodeName==="HEAD"){const t=e.querySelectorAll("link[rel=preconnect]");const i=t.length>0?t[t.length-1].nextSibling:e.querySelector("style");e.insertBefore(n,(i==null?void 0:i.parentNode)===e?i:null)}else if("host"in e){if(Q){const t=(s=e.defaultView)!=null?s:e.ownerDocument.defaultView;const i=new t.CSSStyleSheet;i.replaceSync(a);if(ee){e.adoptedStyleSheets.unshift(i)}else{e.adoptedStyleSheets=[i,...e.adoptedStyleSheets]}}else{const t=e.querySelector("style");if(t){t.innerHTML=a+t.innerHTML}else{e.prepend(n)}}}else{e.append(n)}}if(t.t&1){e.insertBefore(n,null)}if(t.t&4){n.innerHTML+=B}if(i){i.add(o)}}}else{let t=Xt.get(e);if(!t){Xt.set(e,t=new Set)}if(!t.has(o)){const i=(n=e.defaultView)!=null?n:e.ownerDocument.defaultView;let r;if(a.constructor===i.CSSStyleSheet){r=a}else{r=new i.CSSStyleSheet;for(let e=0;e<a.cssRules.length;e++){r.insertRule(a.cssRules[e].cssText,e)}}if(ee){e.adoptedStyleSheets.push(r)}else{e.adoptedStyleSheets=[...e.adoptedStyleSheets,r]}t.add(o)}}}return o};var Kt=e=>{const t=e.i;const i=e.$hostElement$;const r=t.t;const s=qt("attachStyles",t.v);const n=Bt(i.shadowRoot?i.shadowRoot:i.getRootNode(),t);if(r&10){i["s-sc"]=n;i.classList.add(n+"-h")}s()};var Gt=(e,t)=>"sc-"+e.v;var Zt=(e,t,...i)=>{let r=null;let s=null;let n=false;let o=false;const a=[];const l=e=>{for(let t=0;t<e.length;t++){r=e[t];if(Array.isArray(r)){l(r)}else if(r!=null&&typeof r!=="boolean"){if(n=!ce(r)){r=String(r)}if(n&&o){a[a.length-1].S+=r}else{a.push(n?Qt(null,r):r)}o=n}}};l(i);const c=Qt(e,null);c.C=t;if(a.length>0){c.O=a}{c.k=s}return c};var Qt=(e,t)=>{const i={t:0,M:e,S:t,I:null,O:null};{i.C=null}{i.k=null}return i};var ei={};var ti=e=>e&&e.M===ei;var ii=e=>{const t=jt(e);return new RegExp(`(^|[^@]|@(?!supports\\s+selector\\s*\\([^{]*?${t}))(${t}\\b)`,"g")};ii("::slotted");ii(":host");ii(":host-context");var ri=(e,t,i)=>{if(e!=null&&!ce(e)){if(t&4){{return e==="false"?false:e===""||!!e}}if(t&1){return String(e)}return e}return e};var si=(e,t,i)=>{const r=G.ce(t,i);e.dispatchEvent(r);return r};var ni=(e,t,i,r,s,n,o)=>{if(i===r){return}let a=J(e,t);let l=t.toLowerCase();if(t==="class"){const t=e.classList;const s=ai(i);let n=ai(r);{t.remove(...s.filter((e=>e&&!n.includes(e))));t.add(...n.filter((e=>e&&!s.includes(e))))}}else if(t==="style"){{for(const t in i){if(!r||r[t]==null){if(t.includes("-")){e.style.removeProperty(t)}else{e.style[t]=""}}}}for(const t in r){if(!i||r[t]!==i[t]){if(t.includes("-")){e.style.setProperty(t,r[t])}else{e.style[t]=r[t]}}}}else if(t==="key");else if(t==="ref"){if(r){r(e)}}else if(!a&&t[0]==="o"&&t[1]==="n"){if(t[2]==="-"){t=t.slice(3)}else if(J(K,l)){t=l.slice(2)}else{t=l[2]+t.slice(3)}if(i||r){const s=t.endsWith(li);t=t.replace(ci,"");if(i){G.rel(e,t,i,s)}if(r){G.ael(e,t,r,s)}}}else{const o=ce(r);if((a||o&&r!==null)&&!s){try{if(!e.tagName.includes("-")){const s=r==null?"":r;if(t==="list"){a=false}else if(i==null||e[t]!=s){if(typeof e.__lookupSetter__(t)==="function"){e[t]=s}else{e.setAttribute(t,s)}}}else if(e[t]!==r){e[t]=r}}catch(e){}}if(r==null||r===false){if(r!==false||e.getAttribute(t)===""){{e.removeAttribute(t)}}}else if((!a||n&4||s)&&!o&&e.nodeType===1){r=r===true?"":r;{e.setAttribute(t,r)}}}};var oi=/\s/;var ai=e=>{if(typeof e==="object"&&e&&"baseVal"in e){e=e.baseVal}if(!e||typeof e!=="string"){return[]}return e.split(oi)};var li="Capture";var ci=new RegExp(li+"$");var ui=(e,t,i,r)=>{const s=t.I.nodeType===11&&t.I.host?t.I.host:t.I;const n=e&&e.C||{};const o=t.C||{};{for(const e of fi(Object.keys(n))){if(!(e in o)){ni(s,e,n[e],void 0,i,t.t)}}}for(const e of fi(Object.keys(o))){ni(s,e,n[e],o[e],i,t.t)}};function fi(e){return e.includes("ref")?[...e.filter((e=>e!=="ref")),"ref"]:e}var hi;var di=false;var pi=(e,t,i)=>{const r=t.O[i];let s=0;let n;let o;{if(!di){di=r.M==="svg"}if(!K.document){throw new Error("You are trying to render a Stencil component in an environment that doesn't support the DOM. Make sure to populate the [`window`](https://developer.mozilla.org/en-US/docs/Web/API/Window/window) object before rendering a component.")}n=r.I=K.document.createElementNS(di?z:U,r.M);if(di&&r.M==="foreignObject"){di=false}{ui(null,r,di)}if(r.O){const t=r.M==="template"?n.content:n;for(s=0;s<r.O.length;++s){o=pi(e,r,s);if(o){t.appendChild(o)}}}{if(r.M==="svg"){di=false}else if(n.tagName==="foreignObject"){di=true}}}n["s-hn"]=hi;return n};var vi=(e,t,i,r,s,n)=>{let o=e;let a;if(o.shadowRoot&&o.tagName===hi){o=o.shadowRoot}if(i.M==="template"){o=o.content}for(;s<=n;++s){if(r[s]){a=pi(null,i,s);if(a){r[s].I=a;xi(o,a,t)}}}};var mi=(e,t,i)=>{for(let r=t;r<=i;++r){const t=e[r];if(t){const e=t.I;yi(t);if(e){e.remove()}}}};var wi=(e,t,i,r,s=false)=>{let n=0;let o=0;let a=0;let l=0;let c=t.length-1;let u=t[0];let f=t[c];let h=r.length-1;let d=r[0];let p=r[h];let v;let m;const w=i.M==="template"?e.content:e;while(n<=c&&o<=h){if(u==null){u=t[++n]}else if(f==null){f=t[--c]}else if(d==null){d=r[++o]}else if(p==null){p=r[--h]}else if(gi(u,d,s)){bi(u,d,s);u=t[++n];d=r[++o]}else if(gi(f,p,s)){bi(f,p,s);f=t[--c];p=r[--h]}else if(gi(u,p,s)){bi(u,p,s);xi(w,u.I,f.I.nextSibling);u=t[++n];p=r[--h]}else if(gi(f,d,s)){bi(f,d,s);xi(w,f.I,u.I);f=t[--c];d=r[++o]}else{a=-1;{for(l=n;l<=c;++l){if(t[l]&&t[l].k!==null&&t[l].k===d.k){a=l;break}}}if(a>=0){m=t[a];if(m.M!==d.M){v=pi(t&&t[o],i,a)}else{bi(m,d,s);t[a]=void 0;v=m.I}d=r[++o]}else{v=pi(t&&t[o],i,o);d=r[++o]}if(v){{xi(u.I.parentNode,v,u.I)}}}}if(n>c){vi(e,r[h+1]==null?null:r[h+1].I,i,r,o,h)}else if(o>h){mi(t,n,c)}};var gi=(e,t,i=false)=>{if(e.M===t.M){if(!i){return e.k===t.k}if(i&&!e.k&&t.k){e.k=t.k}return true}return false};var bi=(e,t,i=false)=>{const r=t.I=e.I;const s=e.O;const n=t.O;const o=t.M;{{di=o==="svg"?true:o==="foreignObject"?false:di}{ui(e,t,di)}if(s!==null&&n!==null){wi(r,s,t,n,i)}else if(n!==null){vi(r,null,t,n,0,n.length-1)}else if(!i&&g.updatable&&s!==null){mi(s,0,s.length-1)}else;if(di&&o==="svg"){di=false}}};var yi=e=>{{e.C&&e.C.ref&&e.C.ref(null);e.O&&e.O.map(yi)}};var xi=(e,t,i)=>{{return e==null?void 0:e.insertBefore(t,i)}};var Ti=(e,t,i=false)=>{const r=e.$hostElement$;const s=e.F||Qt(null,null);const n=ti(t);const o=n?t:Zt(null,null,t);hi=r.tagName;if(i&&o.C){for(const e of Object.keys(o.C)){if(r.hasAttribute(e)&&!["key","ref","style","class"].includes(e)){o.C[e]=r[e]}}}o.M=null;o.t|=4;e.F=o;o.I=s.I=r.shadowRoot||r;bi(s,o,i)};var $i=(e,t)=>{if(t&&!e.N&&t["s-p"]){const i=t["s-p"].push(new Promise((r=>e.N=()=>{t["s-p"].splice(i-1,1);r()})))}};var Si=(e,t)=>{{e.t|=16}if(e.t&4){e.t|=512;return}$i(e,e.A);const i=()=>Ei(e,t);if(t){queueMicrotask((()=>{i()}));return}return le(i)};var Ei=(e,t)=>{const i=e.$hostElement$;const r=qt("scheduleUpdate",e.i.v);const s=e.R;if(!s){throw new Error(`Can't render component <${i.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`)}let n;if(t){{if(e.p.length){e.p.forEach((e=>e(i)))}}n=Ni(s,"componentWillLoad",void 0,i)}else{n=Ni(s,"componentWillUpdate",void 0,i)}n=Ci(n,(()=>Ni(s,"componentWillRender",void 0,i)));r();return Ci(n,(()=>ki(e,s,t)))};var Ci=(e,t)=>Oi(e)?e.then(t).catch((e=>{console.error(e);t()})):t();var Oi=e=>e instanceof Promise||e&&e.then&&typeof e.then==="function";var ki=async(e,t,i)=>{var r;const s=e.$hostElement$;const n=qt("update",e.i.v);const o=s["s-rc"];if(i){Kt(e)}const a=qt("render",e.i.v);{Mi(e,t,s,i)}if(o){o.map((e=>e()));s["s-rc"]=void 0}a();n();{const t=(r=s["s-p"])!=null?r:[];const i=()=>Ii(e);if(t.length===0){i()}else{Promise.all(t).then(i);e.t|=4;t.length=0}}};var Mi=(e,t,i,r)=>{try{t=t.render();{e.t&=-17}{e.t|=2}{{{Ti(e,t,r)}}}}catch(t){V(t,e.$hostElement$)}return null};var Ii=e=>{const t=e.i.v;const i=e.$hostElement$;const r=qt("postUpdate",t);const s=e.R;const n=e.A;Ni(s,"componentDidRender",void 0,i);if(!(e.t&64)){e.t|=64;{Ai(i)}Ni(s,"componentDidLoad",void 0,i);r();{e.h(i);if(!n){Fi()}}}else{Ni(s,"componentDidUpdate",void 0,i);r()}{if(e.N){e.N();e.N=void 0}if(e.t&512){ae((()=>Si(e,false)))}e.t&=-517}};var Fi=e=>{ae((()=>si(K,"appload",{detail:{namespace:w}})))};var Ni=(e,t,i,r)=>{if(e&&e[t]){try{return e[t](i)}catch(e){V(e,r)}}return void 0};var Ai=e=>{var t;return e.classList.add((t=g.hydratedSelectorName)!=null?t:"hydrated")};var Ri=(e,t)=>_(e).o.get(t);var ji=(e,t,i,r)=>{const s=_(e);if(!s){return}if(!s){throw new Error(`Couldn't find host element for "${r.v}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/stenciljs/core/issues/5457).`)}const n=s.$hostElement$;const o=s.o.get(t);const a=s.t;const l=s.R;i=ri(i,r.j[t][0]);const c=Number.isNaN(o)&&Number.isNaN(i);const u=i!==o&&!c;if((!(a&8)||o===void 0)&&u){s.o.set(t,i);if(r.L){const e=r.L[t];if(e){e.map((e=>{try{const[[r,n]]=Object.entries(e);if(a&128||n&1){if(!l){s.p.push((()=>{s.R[r](i,o,t)}))}else{l[r](i,o,t)}}}catch(e){V(e,n)}}))}}if((a&(2|16))===2){if(l.componentShouldUpdate){if(l.componentShouldUpdate(i,o,t)===false){return}}Si(s,false)}}};var Li=(e,t,i)=>{var r,s;const n=e.prototype;if(t.j||g.propChangeCallback){{if(e.watchers&&!t.L){t.L=e.watchers}if(e.deserializers&&!t.D){t.D=e.deserializers}if(e.serializers&&!t.P){t.P=e.serializers}}const o=Object.entries((r=t.j)!=null?r:{});o.map((([e,[r]])=>{if(r&31||i&2&&r&32){const{get:s,set:o}=Object.getOwnPropertyDescriptor(n,e)||{};if(s)t.j[e][0]|=2048;if(o)t.j[e][0]|=4096;if(i&1||!s){Object.defineProperty(n,e,{get(){{if((t.j[e][0]&2048)===0){return Ri(this,e)}const i=_(this);const r=i?i.R:n;if(!r)return;return r[e]}},configurable:true,enumerable:true})}Object.defineProperty(n,e,{set(s){const n=_(this);if(!n){return}if(o){const i=r&32?this[e]:n.$hostElement$[e];if(typeof i==="undefined"&&n.o.get(e)){s=n.o.get(e)}o.apply(this,[ri(s,r)]);s=r&32?this[e]:n.$hostElement$[e];ji(this,e,s,t);return}{if((i&1)===0||(t.j[e][0]&4096)===0){ji(this,e,s,t);if(i&1&&!n.R){n.p.push((()=>{if(t.j[e][0]&4096&&n.R[e]!==n.o.get(e)){n.R[e]=s}}))}return}const o=()=>{const i=n.R[e];if(!n.o.get(e)&&i){n.o.set(e,i)}n.R[e]=ri(s,r);ji(this,e,n.R[e],t)};if(n.R){o()}else{n.p.push((()=>{o()}))}}}})}}));if(i&1){const i=new Map;n.attributeChangedCallback=function(e,r,s){G.jmp((()=>{var a;const l=i.get(e);const c=_(this);if(this.hasOwnProperty(l)&&g.lazyLoad){s=this[l];delete this[l]}if(n.hasOwnProperty(l)&&typeof this[l]==="number"&&this[l]==s){return}else if(l==null){const i=c==null?void 0:c.t;if(c&&i&&!(i&8)&&s!==r){const n=c.R;const o=(a=t.L)==null?void 0:a[e];o==null?void 0:o.forEach((t=>{const[[o,a]]=Object.entries(t);if(n[o]!=null&&(i&128||a&1)){n[o].call(n,s,r,e)}}))}return}const u=o.find((([e])=>e===l));if(u&&u[1][0]&4){s=s===null||s==="false"?false:true}const f=Object.getOwnPropertyDescriptor(n,l);if(s!=this[l]&&(!f.get||!!f.set)){this[l]=s}}))};e.observedAttributes=Array.from(new Set([...Object.keys((s=t.L)!=null?s:{}),...o.filter((([e,t])=>t[0]&31)).map((([e,t])=>{const r=t[1]||e;i.set(r,e);return r}))]))}}return e};var Di=async(e,t,i,r)=>{let s;if((t.t&32)===0){t.t|=32;const r=i.m;if(r){const r=W(i,t);if(r&&"then"in r){const e=Wt();s=await r;e()}else{s=r}if(!s){throw new Error(`Constructor for "${i.v}#${t.U}" was not found`)}if(!s.isProxied){{i.L=s.watchers;i.P=s.serializers;i.D=s.deserializers}Li(s,i,2);s.isProxied=true}const n=qt("createInstance",i.v);{t.t|=8}try{new s(t)}catch(t){V(t,e)}{t.t&=-9}{t.t|=128}n();Pi(t.R,e)}else{s=e.constructor;const i=e.localName;customElements.whenDefined(i).then((()=>t.t|=128))}if(s&&s.style){let e;if(typeof s.style==="string"){e=s.style}const t=Gt(i);if(!X.has(t)||g.hotModuleReplacement){const r=qt("registerStyles",i.v);Ht(t,e,!!(i.t&1));r()}}}const n=t.A;const o=()=>Si(t,true);if(n&&n["s-rc"]){n["s-rc"].push(o)}else{o()}};var Pi=(e,t)=>{{Ni(e,"connectedCallback",void 0,t)}};var zi=e=>{if((G.t&1)===0){const t=_(e);if(!t){return}const i=t.i;const r=qt("connectedCallback",i.v);if(!(t.t&1)){t.t|=1;{let i=e;while(i=i.parentNode||i.host){if(i["s-p"]){$i(t,t.A=i);break}}}if(i.j){Object.entries(i.j).map((([t,[i]])=>{if(i&31&&t in e&&e[t]!==Object.prototype[t]){const i=e[t];delete e[t];e[t]=i}}))}{Di(e,t,i)}}else{if(t==null?void 0:t.R){Pi(t.R,e)}else if(t==null?void 0:t.u){t.u.then((()=>Pi(t.R,e)))}}r()}};var Ui=(e,t)=>{{Ni(e,"disconnectedCallback",void 0,t||e)}};var _i=async e=>{if((G.t&1)===0){const t=_(e);if(t==null?void 0:t.R){Ui(t.R,e)}else if(t==null?void 0:t.u){t.u.then((()=>Ui(t.R,e)))}}if(Xt.has(e)){Xt.delete(e)}if(e.shadowRoot&&Xt.has(e.shadowRoot)){Xt.delete(e.shadowRoot)}};var Yi=(e,t={})=>{var i;if(!K.document){console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");return}const r=qt();const s=[];const n=t.exclude||[];const o=K.customElements;const a=K.document.head;const l=a.querySelector("meta[charset]");const c=K.document.createElement("style");const u=[];let f;let h=true;Object.assign(G,t);G.T=new URL(t.resourcesUrl||"./",K.document.baseURI).href;let d=false;e.map((e=>{e[1].map((t=>{var i,r,a;const l={t:t[0],v:t[1],j:t[2],_:t[3]};if(l.t&4){d=true}{l.j=t[2]}{l.L=(i=t[4])!=null?i:{};l.P=(r=t[5])!=null?r:{};l.D=(a=t[6])!=null?a:{}}const c=Ji(l.v);const p=class extends HTMLElement{constructor(e){super(e);this.hasRegisteredEventListeners=false;e=this;Y(e,l);if(l.t&1){{if(!e.shadowRoot){Vt.call(e,l)}else{if(e.shadowRoot.mode!=="open"){throw new Error(`Unable to re-use existing shadow root for ${l.v}! Mode is set to ${e.shadowRoot.mode} but Stencil only supports open shadow roots.`)}}}}}connectedCallback(){const e=_(this);if(!e){return}if(!this.hasRegisteredEventListeners){this.hasRegisteredEventListeners=true}if(f){clearTimeout(f);f=null}if(h){u.push(this)}else{G.jmp((()=>zi(this)))}}disconnectedCallback(){G.jmp((()=>_i(this)));G.raf((()=>{var e;const t=_(this);if(!t){return}const i=u.findIndex((e=>e===this));if(i>-1){u.splice(i,1)}if(((e=t==null?void 0:t.F)==null?void 0:e.I)instanceof Node&&!t.F.I.isConnected){delete t.F.I}}))}componentOnReady(){var e;return(e=_(this))==null?void 0:e.u}};l.m=e[0];if(!n.includes(c)&&!o.get(c)){s.push(c);o.define(c,Li(p,l,1))}}))}));if(s.length>0){if(d){c.textContent+=B}{c.textContent+=s.sort()+H}if(c.innerHTML.length){c.setAttribute("data-styles","");const e=(i=G.$)!=null?i:Rt(K.document);if(e!=null){c.setAttribute("nonce",e)}a.insertBefore(c,l?l.nextSibling:a.firstChild)}}h=false;if(u.length){u.map((e=>e.connectedCallback()))}else{{G.jmp((()=>f=setTimeout(Fi,30)))}}r()};function Ji(e){return e}const Vi=()=>{};const qi=async(e,t)=>{if(typeof window==="undefined")return undefined;await Vi();return Yi([["ocr-file-uploader",[[1,"ocr-file-uploader",{batch:[4],callback:[16],jsonSchema:[1,"json-schema"],theme:[1],parsedTheme:[32]},null,{theme:[{parseTheme:0}]}]]]],t)};(function(){if("undefined"!==typeof window&&void 0!==window.Reflect&&void 0!==window.customElements){var e=HTMLElement;window.HTMLElement=function(){return Reflect.construct(e,[],this.constructor)};HTMLElement.prototype=e.prototype;HTMLElement.prototype.constructor=HTMLElement;Object.setPrototypeOf(HTMLElement,e)}})();const Wi=":host{display:block;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif}.row-audio-area{display:flex;flex-direction:row;align-items:center;gap:8px;flex-wrap:wrap;justify-content:center}.voice-recorder-container{display:flex;flex-direction:column;align-items:center;gap:1rem;padding:1rem;border:1px solid #e5e7eb;border-radius:0.5rem;background:#ffffff;margin:0 auto}.voice-recorder-container-debug{display:flex;flex-direction:column;align-items:center;gap:1rem;padding:1rem;border:1px solid #e5e7eb;border-radius:0.5rem;background:#ffffff;margin:0 auto}.upload-record-container{display:inline-flex;cursor:pointer}.upload-record-button{display:flex;align-items:center;justify-content:center;transition:transform 0.2s ease, box-shadow 0.2s ease;user-select:none}.upload-record-button svg{width:100%;height:100%;transition:transform 0.2s ease}.upload-record-container:hover .upload-record-button svg{transform:scale(1.05)}.upload-record-button svg path{}.record-button{display:flex;align-items:center;justify-content:center;border:none;border-radius:50%;background:#ee4444;color:white;cursor:pointer;transition:all 0.2s ease;position:relative;overflow:hidden;flex-shrink:0}.record-button:hover:not(:disabled){background:#dd3333;transform:scale(1.05)}.record-button:disabled{opacity:0.6;cursor:not-allowed}.record-button.recording{background:#dd3333;animation:pulse 1.5s infinite}.record-button.processing{background:#3b82f6}@keyframes pulse{0%{box-shadow:0 0 0 0 rgba(239, 68, 68, 0.7)}70%{box-shadow:0 0 0 10px rgba(239, 68, 68, 0)}100%{box-shadow:0 0 0 0 rgba(239, 68, 68, 0)}}.record-icon{width:24px;height:24px;fill:currentColor}.status-text{font-size:0.875rem;color:#6b7280;text-align:center;min-height:1.25rem}.status-text.error{color:#ee4444}.status-text.success{color:#10b981}.debug-panel{width:100%;margin-top:1rem;padding:1rem;background:#f9fafb;border:1px solid #e5e7eb;border-radius:0.375rem;font-family:'Monaco', 'Menlo', 'Ubuntu Mono', monospace;font-size:0.75rem}.debug-title{font-weight:600;margin-bottom:0.5rem;color:#374151}.debug-content{white-space:pre-wrap;word-break:break-word;color:#6b7280;max-height:200px;overflow-y:auto}.permissions-warning{padding:0.75rem;background:#fef3c7;border:1px solid #f59e0b;border-radius:0.375rem;color:#92400e;font-size:0.875rem;text-align:center}.form-preview{width:100%;margin-top:1rem;padding:1rem;background:#f8fafc;border:1px solid #e2e8f0;border-radius:0.375rem}.form-preview-title{font-weight:600;margin-bottom:0.5rem;color:#1e293b}.form-field{margin-bottom:0.5rem;font-size:0.875rem}.field-name{font-weight:500;color:#475569}.field-value{color:#64748b;margin-left:0.5rem}.field-value.filled{color:#059669;font-weight:500}.voice-filled-form{display:grid;grid-template-columns:repeat(auto-fit, minmax(250px, 1fr));gap:0.5rem;margin-top:1rem}.form-group{display:flex;flex-direction:column;gap:0.15rem}.form-group.full-width{grid-column:1 / -1}.form-header{grid-column:1 / -1;font-weight:600;font-size:1rem;color:#1e293b;margin-top:0.75rem;margin-bottom:0.25rem;padding-bottom:0.25rem;border-bottom:2px solid #e2e8f0}.form-label{font-weight:500;color:#374151;font-size:0.8rem}.required{color:#ee4444;margin-left:0.125rem}.form-input{padding:0.4rem;border:1px solid #d1d5db;border-radius:0.375rem;font-size:0.8rem;transition:border-color 0.2s ease}.form-input:focus{outline:none;border-color:#3b82f6;box-shadow:0 0 0 3px rgba(59, 130, 246, 0.1)}.form-checkbox{width:auto;padding:0;margin:0}select.form-input{background-color:white;cursor:pointer}input[type=\"date\"].form-input{cursor:pointer}.readonly-select{background:#f9fafb;border:1px solid #d1d5db;border-radius:0.375rem;padding:0.5rem}.select-placeholder{font-size:0.875rem;color:#6b7280;margin-bottom:0.5rem}.select-options-list{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;gap:0.25rem;max-height:150px;overflow-y:auto}.select-option{background:#e5e7eb;padding:0.25rem 0.5rem;border-radius:0.25rem;font-size:0.875rem;color:#374151}.multiselect-container{display:grid;grid-template-columns:repeat(2, 1fr);gap:0.25rem;padding:0.5rem;border:1px solid #d1d5db;border-radius:0.375rem;background:white}.multiselect-option{display:flex;align-items:center;gap:0.5rem;padding:0.5rem;border-radius:0.25rem;cursor:pointer;transition:background 0.2s ease}.multiselect-option:hover{background:#f3f4f6}.multiselect-option input[type=\"checkbox\"]{width:18px;height:18px;cursor:pointer}.multiselect-option input[type=\"checkbox\"]:checked+.multiselect-label{font-weight:600;color:#059669}.multiselect-label{font-size:0.875rem;color:#374151;user-select:none}ocr-file-uploader{display:block;width:100% !important;height:100% !important;max-width:100% !important;max-height:100% !important}ocr-file-uploader *{max-width:100% !important;max-height:100% !important}";qi();const Xi=class{get parsedInputTypes(){if(!this.inputTypes)return[];try{return JSON.parse(this.inputTypes.replace(/'/g,'"'))}catch(e){return this.inputTypes.split(",").map((e=>e.trim()))}}constructor(i){e(this,i);this.formFilled=t(this,"formFilled");this.recordingStateChanged=t(this,"recordingStateChanged");this.formJson="{}";this.serviceConfig="{}";this.apiProxyUrl="http://localhost:8492";this.transcriptionModel="gpt-4o-transcribe";this.completionModel="gpt-5-mini";this.transcriptionProvider="openai";this.completionProvider="openai";this.context=undefined;this.classificationRootUrl="http://localhost";this.language="en";this.inputTypes="";this.theme="";this.debug=false;this.renderForm=false;this.displayStatus=false;this.isRecording=false;this.isProcessing=false;this.hasError=false;this.transcription="";this.filledData=null;this.debugInfo={};this.isReadonlyMode=true;this.triggerAudioRecordUpload=()=>{this.fileInputAudioRecord.click()};this.handleAudioRecordChange=async e=>{const t=e.target;if(!t.files||t.files.length===0)return;const i=t.files[0];this.processAudioContent(i)};this.audioRecorder=new n}componentWillLoad(){this.initializeServices()}initializeServices(){var e;try{this.parsedTheme=this.theme?JSON.parse(this.theme):this.getDefaultTheme()}catch(e){this.parsedTheme=this.getDefaultTheme()}try{if(!this.context){this.hasError=true;const e=this.language=="en"?`Initialization error: context is '${this.context}'`:`Erreur d'initialisation: le contexte est '${this.context}'`;this.statusMessage=e;this.updateDebugInfo(e,{error:e})}else{const t=r[this.transcriptionProvider];if(!t){throw new Error(`Unsupported transcription provider: '${this.transcriptionProvider}'. Allowed: openai, mistral`)}if(!t.includes(this.transcriptionModel)){throw new Error(`Model '${this.transcriptionModel}' is not allowed for transcription provider '${this.transcriptionProvider}'. Allowed: ${t.join(", ")}`)}const i=s[this.completionProvider];if(!i){throw new Error(`Unsupported completion provider: '${this.completionProvider}'. Allowed: openai, anthropic, mistral`)}if(!i.includes(this.completionModel)){throw new Error(`Model '${this.completionModel}' is not allowed for completion provider '${this.completionProvider}'. Allowed: ${i.join(", ")}`)}this.parsedSchema=JSON.parse(this.formJson||"{}");this.parsedConfig=JSON.parse(this.serviceConfig||"{}");if(this.apiKey){this.parsedConfig=Object.assign(Object.assign({},this.parsedConfig),{speechToText:Object.assign(Object.assign({},this.parsedConfig.speechToText),{provider:this.transcriptionProvider,apiKey:this.apiKey,model:this.transcriptionModel}),llm:Object.assign(Object.assign({},this.parsedConfig.llm),{provider:this.completionProvider,apiKey:this.apiKey,model:this.completionModel})})}else{this.parsedConfig=Object.assign(Object.assign({},this.parsedConfig),{speechToText:Object.assign(Object.assign({},this.parsedConfig.speechToText),{provider:this.transcriptionProvider,useProxy:true,proxyUrl:this.apiProxyUrl,model:this.transcriptionModel}),llm:Object.assign(Object.assign({},this.parsedConfig.llm),{provider:this.completionProvider,useProxy:true,proxyUrl:this.apiProxyUrl,model:this.completionModel})})}this.speechToTextService=l.create(this.parsedConfig);this.llmService=v.create(this.parsedConfig);this.updateDebugInfo("Initialized",{schema:this.parsedSchema,config:this.parsedConfig});this.hasError=false;this.statusMessage=((e=this.parsedTheme.texts)===null||e===void 0?void 0:e.idle)||(this.language=="en"?"Select an input method":"Sélectionner une méthode de saisie");if(this.parsedInputTypes.length===0){this.inputTypes="voice"}}}catch(e){this.hasError=true;this.statusMessage=this.language=="en"?`Initialization error: ${e.message}`:`Erreur d'initialisation: ${e.message}`;this.updateDebugInfo("Initialization Error",{error:e.message})}}updateDebugInfo(e,t){if(this.debug){this.debugInfo=Object.assign(Object.assign({},this.debugInfo),{[e]:{timestamp:(new Date).toISOString(),data:t}})}}async handleRecordClick(){if(this.isProcessing)return;if(this.isRecording){await this.stopRecordingAndProcess()}else{await this.startRecording()}}async startRecording(){var e;try{this.hasError=false;this.statusMessage=this.language=="en"?"Starting recording...":`Enregistrement ...`;this.updateDebugInfo("Start Recording Attempt",{});await this.audioRecorder.startRecording();this.isRecording=true;this.statusMessage=((e=this.parsedTheme.texts)===null||e===void 0?void 0:e.recording)||(this.language=="en"?"Recording... Click to stop":"Enregistrement ... Cliquer pour stopper");this.updateDebugInfo("Recording Started",{});this.recordingStateChanged.emit({isRecording:true,state:"recording"})}catch(e){this.hasError=true;this.statusMessage=this.language=="en"?`Recording failed: ${e.message}`:`Echec de l'enregistrement : ${e.message}`;this.updateDebugInfo("Recording Error",{error:e.message});this.formFilled.emit({success:false,error:e.message})}}async processJsonForm(e){var t,i,r;try{this.isProcessing=true;this.statusMessage=((t=this.parsedTheme.texts)===null||t===void 0?void 0:t.processing)||(this.language=="en"?"Processing json...":`Traitement du json ...`);const s=(e===null||e===void 0?void 0:e.content)||e;const n=JSON.stringify(s);this.statusMessage=((i=this.parsedTheme.texts)===null||i===void 0?void 0:i.filling)||(this.language=="en"?"Filling form fields...":"Remplissage du formulaire ...");const o=await this.trimSchemaForAI(this.parsedSchema);const a=await this.llmService.fillFormFromJson(n,o);this.filledData=this.extractFilledData(a);this.updateDebugInfo("Form Filled",{filledSchema:a,extractedData:this.filledData});this.parsedSchema=this.filledData;this.statusMessage=((r=this.parsedTheme.texts)===null||r===void 0?void 0:r.completed)||(this.language=="en"?"Form completed!":"Formulaire remplis !");this.hasError=false;this.formFilled.emit({success:true,data:this.filledData,jsonForm:n})}catch(t){this.hasError=true;this.statusMessage=this.language=="en"?`Processing failed: ${t.message}`:`Erreur de traitement : ${t.message}`;this.formFilled.emit({success:false,error:t.message,jsonForm:JSON.stringify(e)})}finally{this.isProcessing=false}}async processAudioContent(e){var t,i,r;this.updateDebugInfo("Audio Captured",{size:e.size,type:e.type});try{this.statusMessage=((t=this.parsedTheme.texts)===null||t===void 0?void 0:t.transcribing)||(this.language=="en"?"Transcribing speech...":"Transcription du texte ...");const s=await this.speechToTextService.transcribe(e,this.language);this.transcription=s;this.updateDebugInfo("Transcription Complete",{transcription:s});if(!s.trim()){throw new Error("No speech detected in the recording")}this.statusMessage=((i=this.parsedTheme.texts)===null||i===void 0?void 0:i.filling)||(this.language=="en"?"Filling form fields...":"Remplissage du formulaire ...");const n=await this.trimSchemaForAI(this.parsedSchema);const o=await this.llmService.fillFormFromTranscription(s,n);this.filledData=this.extractFilledData(o);this.updateDebugInfo("Form Filled",{filledSchema:o,extractedData:this.filledData});this.parsedSchema=this.filledData;this.statusMessage=((r=this.parsedTheme.texts)===null||r===void 0?void 0:r.completed)||(this.language=="en"?"Form completed!":"Formulaire remplis !");this.hasError=false;this.formFilled.emit({success:true,data:this.filledData,transcription:s})}catch(e){console.error("Transcription error:",e);this.hasError=true;this.statusMessage=this.language=="en"?"Audio processing failed.":"Échec du traitement audio.";this.updateDebugInfo("Transcription Error",{error:e.message});this.formFilled.emit({success:false,error:e.message,transcription:this.transcription})}}async stopRecordingAndProcess(){var e;try{this.isRecording=false;this.isProcessing=true;this.statusMessage=((e=this.parsedTheme.texts)===null||e===void 0?void 0:e.processing)||(this.language=="en"?"Processing audio...":`Traitement de l'audio ...`);this.updateDebugInfo("Stop Recording",{});this.recordingStateChanged.emit({isRecording:false,state:"processing"});const t=await this.audioRecorder.stopRecording();const i=new File([t],"audio.wav",{type:"audio/wav"});this.processAudioContent(i)}catch(e){this.hasError=true;this.statusMessage=this.language=="en"?`Processing failed: ${e.message}`:`Erreur de traitement : ${e.message}`;this.updateDebugInfo("Processing Error",{error:e.message});this.formFilled.emit({success:false,error:e.message,transcription:this.transcription})}finally{this.isProcessing=false;this.recordingStateChanged.emit({isRecording:false,state:"idle"})}}extractFilledData(e){const t=JSON.parse(JSON.stringify(this.parsedSchema));switch(this.context){case"ecoteka":case"ng":if(e===null||e===void 0?void 0:e.fields){e.fields.forEach((e=>{const i=t.Children.find((t=>{var i;return t.System_Name===e.name||((i=t.Settings)===null||i===void 0?void 0:i.Label)===e.name}));if(i&&e.value!==undefined&&e.value!==null&&e.value!==""){if(!i.Settings)i.Settings={};i.Settings.Default_Value=e.value}}))}break;case"ecoll-veto":if(e===null||e===void 0?void 0:e.fields){e.fields.forEach((e=>{let i=t[0].items.find((t=>t.label===e.name));if(!i)i=t[1].items.find((t=>t.label===e.name));if(i&&e.value!==undefined&&e.value!==null&&e.value!==""){t[2][i.name]=e.value}}))}break;case"track":default:if(e===null||e===void 0?void 0:e.fields){Object.entries(e.fields).forEach((([e,i])=>{if(i.value!==undefined&&i.value!==null&&i.value!==""){if(i.id){const e=t.fields[i.id];if(e){e.value=i.value;e.default=i.value}}else{const e=i.name;for(const r in t.fields){const s=t.fields[r];if(s.title===e){s.value=i.value;s.default=i.value;break}}}}}))}break}return t}async trimSchemaForAI(e){var t,i;switch(this.context){case"ecoteka":case"ng":const r={fields:[]};e.Children.forEach((e=>{var t,i;if(!e.System_Name||!e.Type)return;const s={name:e.Label||((t=e.Settings)===null||t===void 0?void 0:t.Label)||e.System_Name,type:this.mapFieldType(e.Type),default:(i=e.Settings)===null||i===void 0?void 0:i.Default_Value};const n=["InputClassification","select","multiselect","InputMultiSelect"];if(n.includes(e.Type)&&e.Children&&e.Children.length>0){s.options=e.Children.map((e=>e.System_Name||e.Label||e.toString()))}r.fields.push(s)}));return r;case"ecoll-veto":const s=this.parsedSchema[0].items.concat(this.parsedSchema[1].items);if(s){const e={title:"Form Name",description:"Form Description",schema:{}};Object.entries(s).forEach((async([t,i])=>{const r=i.name;const s=this.mapFieldType(i.type);const n=i.label||r;if(["position","thesaurus"].includes(s)){try{const e=await fetch(`${this.classificationRootUrl}/ng/api/v1/classification/getList/${s.toLowerCase()=="position"?"Position":"Thesaurus"}/?StartNodeID=${i.config.options.options.startNode}`);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);const t=await e.json();if(Array.isArray(t)){const e=t.map((e=>({value:e.ID,label:e.System_Name})));if(e.length>0){i.pickerOptions=e;i.options=e.map((e=>e.label.replace("'","")))}}else{console.error("Unexpected API response format:",t)}}catch(e){console.error("Error fetching classification data:",e)}}e.schema[r]={type:s,title:n,options:i.options,readonly:i.readonly===true,default:""}}));return e}case"track":default:if((t=e===null||e===void 0?void 0:e.schema)!==null&&t!==void 0?t:e===null||e===void 0?void 0:e.fields){const t={title:e.title,description:e.description,schema:{}};const r=(i=e===null||e===void 0?void 0:e.schema)!==null&&i!==void 0?i:e===null||e===void 0?void 0:e.fields;Object.entries(r).forEach((([e,i])=>{t.schema[e]={id:e,type:i.type,title:i.title,options:i.options,readonly:i.type==="header"||i.Enabled===false,default:i.default||i.DefaultValue,pattern:i.Mask,min:i.ValidationMin,max:i.ValidationMax}}));return t}break}return e}mapFieldType(e){const t={InputAutocomplete:"string",InputInteger:"number",InputTextArea:"string",InputDateTimePicker:"datetime",InputDecimal:"number",InputClassification:"classification",InputCheckbox:"boolean",InputTextTranslation:"string",InputMultiSelect:"multiselect",thesaurus:"thesaurus",position:"position",text:"string",textarea:"string",number:"number",date:"date",datetime:"datetime",select:"select",multiselect:"multiselect",checkbox:"checkbox"};return t[e]||"string"}async convertXmlToJson(e){return m.convertXmlToJson(e,this.classificationRootUrl,this.language)}async convertJsonToXml(e){return m.convertJsonToXml(e)}async convertXmlToJsonLegacy(e){return m.convertXmlToJsonLegacy(e)}async convertJsonToXmlLegacy(e){return m.convertJsonToXmlLegacy(e)}renderUploadButton(){var e;if(!this.parsedInputTypes.includes("ocr"))return;const t=((e=this.parsedTheme.buttons)===null||e===void 0?void 0:e.ocr)||{};const r=t.size||"50px";const s={button:{size:r,backgroundColor:t.backgroundColor||"#10b981",hoverColor:t.hoverColor||"#059669",textColor:t.textColor||"#ffffff"}};const n=this.isProcessing||this.hasError;return i("div",{style:{width:r,height:r,flexShrink:"0",opacity:n?"0.6":"1",pointerEvents:n?"none":"auto"}},i("ocr-file-uploader",{batch:false,"json-schema":this.convertSchemaToOcrFormat(this.parsedSchema),callback:e=>{this.processJsonForm(e)},theme:JSON.stringify(s),style:{width:"100%",height:"100%"}}))}convertSchemaToOcrFormat(e){const t={type:"object",additionalProperties:false,properties:{meta:{type:"object",additionalProperties:false,properties:{page:{type:"integer"},confiance_global:{type:"number"}},required:["page","confiance_global"]},content:{type:"object",additionalProperties:false,properties:{},required:[]}},required:["meta","content"]};if(e===null||e===void 0?void 0:e.Children){e.Children.forEach((e=>{var i;if(e.System_Name&&e.Type){const r=((i=e.Settings)===null||i===void 0?void 0:i.Label)||e.System_Name;const s=this.mapOcrFieldType(e.Type);t.properties.content.properties[r]={anyOf:[{type:s},{type:"null"}]}}}))}return JSON.stringify(t)}mapOcrFieldType(e){const t={InputInteger:"number",InputDecimal:"number",InputDateTimePicker:"string",InputCheckbox:"boolean"};return t[e]||"string"}renderUploadRecordButton(){var e;if(!this.parsedInputTypes.includes("audio"))return;const t=((e=this.parsedTheme.buttons)===null||e===void 0?void 0:e.audio)||{};const r=t.size||"50px";const s=this.isProcessing||this.hasError;const n={stroke:t.backgroundColor||"#3b82f6",fill:t.backgroundColor||"#3b82f6",width:r,height:r,opacity:s?"0.6":"1"};return i("div",{class:"upload-record-container",onClick:s?null:this.triggerAudioRecordUpload,style:{width:r,height:r,cursor:s?"not-allowed":"pointer"}},i("input",{type:"file",ref:e=>this.fileInputAudioRecord=e,onChange:this.handleAudioRecordChange,style:{display:"none"}}),i("div",{class:"upload-record-button"},i("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:n},i("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12 2.75C6.89137 2.75 2.75 6.89137 2.75 12C2.75 17.1086 6.89137 21.25 12 21.25C12.6345 21.25 13.2534 21.1862 13.8508 21.065C14.2567 20.9826 14.6526 21.2448 14.735 21.6508C14.8174 22.0567 14.5551 22.4526 14.1492 22.535C13.4541 22.6761 12.7353 22.75 12 22.75C6.06294 22.75 1.25 17.9371 1.25 12C1.25 6.06294 6.06294 1.25 12 1.25C17.9371 1.25 22.75 6.06294 22.75 12C22.75 12.7353 22.6761 13.4541 22.535 14.1492C22.4526 14.5551 22.0567 14.8174 21.6508 14.735C21.2448 14.6526 20.9826 14.2567 21.065 13.8508C21.1862 13.2534 21.25 12.6345 21.25 12C21.25 6.89137 17.1086 2.75 12 2.75ZM12.7676 8.52584C12.7661 8.53409 12.7604 8.56729 12.7564 8.64336C12.7502 8.76101 12.75 8.91982 12.75 9.17082C12.75 9.27795 12.7501 9.33904 12.7518 9.38529C12.7528 9.41425 12.7542 9.42649 12.7546 9.42955C12.7662 9.48945 12.7993 9.54303 12.8477 9.58021C12.8502 9.58194 12.8606 9.58864 12.886 9.60252C12.9266 9.62468 12.9812 9.65209 13.0771 9.7L14.3938 10.3584C14.6183 10.4706 14.7604 10.5414 14.8684 10.5885C14.9382 10.6189 14.9705 10.6287 14.9785 10.631C15.0885 10.6405 15.1917 10.5767 15.2324 10.4742C15.2339 10.4659 15.2396 10.4327 15.2436 10.3566C15.2498 10.239 15.25 10.0802 15.25 9.82918C15.25 9.72205 15.2499 9.66096 15.2482 9.61471C15.2472 9.58575 15.2458 9.57351 15.2454 9.57045C15.2338 9.51055 15.2007 9.45697 15.1523 9.41979C15.1498 9.41805 15.1394 9.41136 15.114 9.39748C15.0734 9.37533 15.0188 9.34791 14.9229 9.3L13.6062 8.64164C13.3817 8.52939 13.2396 8.45859 13.1316 8.41151C13.0617 8.38107 13.0295 8.37131 13.0215 8.36896C12.9115 8.35945 12.8083 8.42327 12.7676 8.52584ZM12.75 11.2135L13.7396 11.7083C13.9425 11.8098 14.1204 11.8987 14.269 11.9635C14.4199 12.0293 14.5988 12.097 14.7972 12.1202C15.6037 12.2142 16.3689 11.7413 16.6454 10.978C16.7134 10.7901 16.7328 10.5998 16.7415 10.4355C16.75 10.2735 16.75 10.0747 16.75 9.8479V9.82918C16.75 9.81565 16.75 9.80205 16.75 9.78837C16.7503 9.62647 16.7505 9.45474 16.7188 9.28904C16.638 8.86674 16.4045 8.48898 16.0629 8.22783C15.9289 8.12535 15.7752 8.04877 15.6303 7.97658C15.618 7.97048 15.6059 7.96441 15.5938 7.95836L14.2603 7.29164C14.0575 7.19022 13.8796 7.10128 13.731 7.03647C13.5801 6.97071 13.4012 6.90297 13.2028 6.87982C12.3963 6.78575 11.6311 7.25868 11.3546 8.02203C11.2866 8.20986 11.2672 8.40019 11.2585 8.56454C11.2519 8.68919 11.2504 8.83571 11.2501 9L11.25 9.11944C11.25 9.13026 11.25 9.14115 11.25 9.1521V9.17082C11.25 9.18435 11.25 9.19795 11.25 9.21163C11.2499 9.23918 11.2499 9.26701 11.25 9.29505V12.5499C10.875 12.3581 10.4501 12.25 10 12.25C8.48122 12.25 7.25 13.4812 7.25 15C7.25 16.5188 8.48122 17.75 10 17.75C11.5188 17.75 12.75 16.5188 12.75 15V11.2135ZM11.25 15C11.25 14.3096 10.6904 13.75 10 13.75C9.30964 13.75 8.75 14.3096 8.75 15C8.75 15.6904 9.30964 16.25 10 16.25C10.6904 16.25 11.25 15.6904 11.25 15ZM17.4697 14.4697C17.7626 14.1768 18.2374 14.1768 18.5303 14.4697L21.0303 16.9697C21.3232 17.2626 21.3232 17.7374 21.0303 18.0303C20.7374 18.3232 20.2626 18.3232 19.9697 18.0303L18.75 16.8107V22C18.75 22.4142 18.4142 22.75 18 22.75C17.5858 22.75 17.25 22.4142 17.25 22V16.8107L16.0303 18.0303C15.7374 18.3232 15.2626 18.3232 14.9697 18.0303C14.6768 17.7374 14.6768 17.2626 14.9697 16.9697L17.4697 14.4697Z"}))))}renderRecordButton(){var e;if(!this.parsedInputTypes.includes("voice"))return;const t=["record-button",this.isRecording&&"recording",this.isProcessing&&"processing"].filter(Boolean).join(" ");const r=this.isProcessing||this.hasError;const s=((e=this.parsedTheme.buttons)===null||e===void 0?void 0:e.voice)||{};const n=s.size||"50px";const o={background:s.backgroundColor||"#ee4444",width:n,height:n};return i("button",{class:t,style:o,onClick:()=>this.handleRecordClick(),disabled:r,"aria-label":this.isRecording?"Stop recording":"Start recording"},this.isProcessing?i("svg",{class:"record-icon",viewBox:"0 0 24 24"},i("circle",{cx:"12",cy:"12",r:"3"},i("animate",{attributeName:"r",values:"3;6;3",dur:"1s",repeatCount:"indefinite"}),i("animate",{attributeName:"opacity",values:"1;0.3;1",dur:"1s",repeatCount:"indefinite"}))):this.isRecording?i("svg",{class:"record-icon",viewBox:"0 0 24 24"},i("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})):i("svg",{class:"record-icon",viewBox:"0 0 24 24"},i("circle",{cx:"12",cy:"12",r:"8"})))}renderStatusMessage(){const e=["status-text",this.hasError&&"error",this.filledData&&!this.hasError&&"success"].filter(Boolean).join(" ");return i("div",{class:e},this.statusMessage)}renderFormPreview(){if(!this.parsedSchema)return null;const e=this.isReadonlyMode&&!this.filledData;const t=e?"Form Preview (Voice input to fill)":"Voice-Filled Form:";return i("div",{class:"form-preview"},i("div",{class:"form-preview-title"},t),i("form",{class:"voice-filled-form"},this.renderFormFields()))}renderFormFields(){if(!this.parsedSchema)return null;const e=["select","multiselect","classification","thesaurus","position"];switch(this.context){case"ecoteka":case"ng":return this.parsedSchema.Children.map((t=>{var r,s,n;if(!t.System_Name||!t.Type)return null;const o=t.System_Name;const a=this.mapFieldType(t.Type);const l=((r=t.Settings)===null||r===void 0?void 0:r.Label)||t.System_Name;const c=t.Required||false;const u=(s=t.Settings)===null||s===void 0?void 0:s.Default_Value;const f=e.includes(a)||t.Children&&t.Children.length>5;return i("div",{class:f?"form-group full-width":"form-group",key:o},i("label",{htmlFor:o,class:"form-label"},l,c&&i("span",{class:"required"},"*")),this.renderFormField(o,{type:a,title:l,required:c,options:(n=t.Children)===null||n===void 0?void 0:n.map((e=>e.System_Name||e.Label||e.toString()))},u))})).filter(Boolean);case"ecoll-veto":const t=this.parsedSchema[0].items.concat(this.parsedSchema[1].items);return Object.entries(t).map((([e,t])=>{var r,s;const n=t.name;t.type=this.mapFieldType(t.type);const o=t.label||n;const a=t.required||false;const l=this.parsedSchema[2][n];return i("div",{class:"form-group",key:n},i("label",{htmlFor:n,class:"form-label"},o,a&&i("span",{class:"required"},"*")),this.renderFormField(n,t,(s=(r=this.filledData)===null||r===void 0?void 0:r[n])!==null&&s!==void 0?s:l))}));case"track":default:return Object.entries(this.parsedSchema.fields).map((([e,t])=>{var r,s;if(t.type==="header"){return i("div",{class:"form-header",key:e},t.title||e)}return i("div",{class:"form-group",key:e},i("label",{htmlFor:e,class:"form-label"},t.title||e,t.required&&i("span",{class:"required"},"*")),this.renderFormField(e,t,(s=(r=this.filledData)===null||r===void 0?void 0:r[e])!==null&&s!==void 0?s:t.value))}))}}renderFormField(e,t,r){var s,n,o,a;const l=this.isReadonlyMode&&!this.filledData;const c={id:e,name:e,class:"form-input",required:t.required,disabled:l};switch(t.type){case"multiselect":if(l){return i("div",{class:"readonly-select"},i("div",{class:"select-placeholder"},"Available options:"),i("ul",{class:"select-options-list"},(s=t.options)===null||s===void 0?void 0:s.map((e=>i("li",{class:"select-option"},e)))))}const u=Array.isArray(r)?r:r?[r]:[];return i("div",{class:"multiselect-container"},(n=t.options)===null||n===void 0?void 0:n.map((t=>{const r=u.some((e=>(e===null||e===void 0?void 0:e.toString().toLowerCase())===(t===null||t===void 0?void 0:t.toString().toLowerCase())));return i("label",{class:"multiselect-option"},i("input",{type:"checkbox",name:e,value:t,checked:r,disabled:l}),i("span",{class:"multiselect-label"},t))})));case"select":if(l){return i("div",{class:"readonly-select"},i("div",{class:"select-placeholder"},"Available options:"),i("ul",{class:"select-options-list"},(o=t.options)===null||o===void 0?void 0:o.map((e=>i("li",{class:"select-option"},e)))))}return i("select",{id:e,name:e,class:"form-input",required:t.required},i("option",{value:""},"-- Select --"),(a=t.options)===null||a===void 0?void 0:a.map((e=>i("option",{value:e,selected:r===e},e))));case"boolean":return i("input",Object.assign({},c,{type:"checkbox",class:"form-checkbox",checked:r===true||r==="true"}));case"number":return i("input",Object.assign({},c,{type:"number",min:t.min,max:t.max,step:"any",value:r||""}));case"date":return i("input",Object.assign({},c,{type:"date",value:r?(([e,t,i])=>`${i}-${t}-${e}`)(r.split("/")):""}));case"datetime":return i("input",Object.assign({},c,{type:"datetime-local",value:r||""}));default:return i("input",Object.assign({},c,{type:"text",pattern:t.pattern,placeholder:t.description,value:r||""}))}}renderDebugPanel(){if(!this.debug)return null;return i("div",{class:"debug-panel"},i("div",{class:"debug-title"},"Debug Information:"),i("div",{class:"debug-content"},JSON.stringify(this.debugInfo,null,2)))}getDefaultTheme(){return{texts:{idle:this.language==="en"?"Select an input method":"Sélectionner une méthode de saisie",recording:this.language==="en"?"Recording... Click to stop":"Enregistrement ... Cliquer pour stopper",processing:this.language==="en"?"Processing...":"Traitement en cours...",transcribing:this.language==="en"?"Transcribing speech...":"Transcription du texte...",filling:this.language==="en"?"Filling form fields...":"Remplissage du formulaire...",completed:this.language==="en"?"Form completed!":"Formulaire rempli !"},container:{width:"auto",height:"auto",backgroundColor:"#ffffff",borderColor:"#e2e8f0",borderRadius:"8px",padding:"20px",gap:"8px"},buttons:{voice:{backgroundColor:"#ee4444",textColor:"#ffffff",hoverColor:"#dd3333",size:"50px"},audio:{backgroundColor:"#3b82f6",textColor:"#ffffff",hoverColor:"#2563eb",size:"50px"},ocr:{backgroundColor:"#10b981",textColor:"#ffffff",hoverColor:"#059669",size:"50px"}},statusText:{color:"#1e293b",fontSize:"14px"}}}getContainerStyle(){const e=this.parsedTheme.container||{};return{width:e.width||"auto",height:e.height||"auto",backgroundColor:e.backgroundColor||"#ffffff",border:`1px solid ${e.borderColor||"#e2e8f0"}`,borderRadius:e.borderRadius||"8px",padding:e.padding||"20px",gap:e.gap||"8px"}}getStatusStyle(){const e=this.parsedTheme.statusText||{};return{color:e.color||"#1e293b",fontSize:e.fontSize||"14px"}}render(){const e=this.getContainerStyle();const t=this.getStatusStyle();return i("div",{key:"8378e98f02e5b7482929d255c5ec12ff8c2731e4"},i("div",{key:"b8a0d873bd4e1b4c8936747c0919ac8c4c15301b",class:"voice-recorder-container"+(this.debug||this.renderForm?"-debug":""),style:e},i("div",{key:"86e7783e3686db378ee16aa91a640f33c3255923",class:"row-audio-area"},this.renderRecordButton(),this.renderUploadRecordButton(),this.renderUploadButton()),this.displayStatus?i("div",{class:"status-text",style:t},this.statusMessage):"",this.renderForm?this.renderFormPreview():"",this.debug?this.renderDebugPanel():""))}static get watchers(){return{formJson:["initializeServices"],serviceConfig:["initializeServices"],theme:["initializeServices"],transcriptionProvider:["initializeServices"],completionProvider:["initializeServices"],transcriptionModel:["initializeServices"],completionModel:["initializeServices"]}}};Xi.style=Wi;export{Xi as voice_input_module};
3
+ //# sourceMappingURL=p-0e2b9ca0.entry.js.map