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.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/voice-input-module.cjs.entry.js +274 -62
- package/dist/cjs/voice-input-module.cjs.entry.js.map +1 -1
- package/dist/cjs/voice-input-module.cjs.js +1 -1
- package/dist/cjs/voice-input-module.entry.cjs.js.map +1 -1
- package/dist/collection/components/voice-input-module/voice-input-module.js +87 -4
- package/dist/collection/components/voice-input-module/voice-input-module.js.map +1 -1
- package/dist/collection/services/audio-recorder.service.js +61 -44
- package/dist/collection/services/audio-recorder.service.js.map +1 -1
- package/dist/collection/services/llm.service.js +137 -8
- package/dist/collection/services/llm.service.js.map +1 -1
- package/dist/collection/services/speech-to-text.service.js +39 -5
- package/dist/collection/services/speech-to-text.service.js.map +1 -1
- package/dist/collection/types/service-providers.types.js +9 -1
- package/dist/collection/types/service-providers.types.js.map +1 -1
- package/dist/components/voice-input-module.js +281 -63
- package/dist/components/voice-input-module.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/voice-input-module.entry.js +274 -62
- package/dist/esm/voice-input-module.entry.js.map +1 -1
- package/dist/esm/voice-input-module.js +1 -1
- package/dist/types/components/voice-input-module/voice-input-module.d.ts +3 -0
- package/dist/types/components.d.ts +18 -0
- package/dist/types/services/audio-recorder.service.d.ts +5 -0
- package/dist/types/services/llm.service.d.ts +22 -0
- package/dist/types/services/speech-to-text.service.d.ts +8 -0
- package/dist/types/types/service-providers.types.d.ts +6 -2
- package/dist/voice-input-module/p-0e2b9ca0.entry.js +3 -0
- package/dist/voice-input-module/p-0e2b9ca0.entry.js.map +1 -0
- package/dist/voice-input-module/voice-input-module.entry.esm.js.map +1 -1
- package/dist/voice-input-module/voice-input-module.esm.js +1 -1
- package/package.json +1 -1
- package/readme.md +81 -0
- package/www/build/p-0e2b9ca0.entry.js +3 -0
- package/www/build/p-0e2b9ca0.entry.js.map +1 -0
- package/www/build/p-812b92c7.js +2 -0
- package/www/build/voice-input-module.entry.esm.js.map +1 -1
- package/www/build/voice-input-module.esm.js +1 -1
- package/www/index.html +12 -1
- package/dist/voice-input-module/p-4e449895.entry.js +0 -3
- package/dist/voice-input-module/p-4e449895.entry.js.map +0 -1
- package/www/build/p-3a11e8d2.js +0 -2
- package/www/build/p-4e449895.entry.js +0 -3
- package/www/build/p-4e449895.entry.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as e,b as
|
|
1
|
+
import{p as e,b as i}from"./p-jmc2yzBp.js";export{s as setNonce}from"./p-jmc2yzBp.js";import{g as o}from"./p-DQuL1Twl.js";var r=()=>{const i=import.meta.url;const o={};if(i!==""){o.resourcesUrl=new URL(".",i).href}return e(o)};r().then((async e=>{await o();return i([["p-a5eeaf1c",[[257,"ocr-file-uploader",{batch:[4],callback:[16],jsonSchema:[1,"json-schema"],theme:[1],parsedTheme:[32]},null,{theme:["parseTheme"]}]]],["p-0e2b9ca0",[[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"]}]]]],e)}));
|
|
2
2
|
//# sourceMappingURL=voice-input-module.esm.js.map
|
package/www/index.html
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!doctype html><html dir="ltr" lang="en"><head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0"> <title>Voice Input Module Demo</title> <link rel="modulepreload" href="/build/p-
|
|
1
|
+
<!doctype html><html dir="ltr" lang="en"><head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0"> <title>Voice Input Module Demo</title> <link rel="modulepreload" href="/build/p-812b92c7.js"><script type="module" src="/build/p-812b92c7.js" data-stencil data-resources-url="/build/" data-stencil-namespace="voice-input-module"></script> <script nomodule="" src="/build/voice-input-module.js" data-stencil></script> <script type="module">
|
|
2
2
|
import { config } from '/config.js';
|
|
3
3
|
window.APP_CONFIG = config;
|
|
4
4
|
|
|
@@ -27,6 +27,12 @@
|
|
|
27
27
|
component.setAttribute('context', 'ng');
|
|
28
28
|
component.setAttribute('classification-root-url', 'http://localhost:8888');
|
|
29
29
|
component.setAttribute('input-types', "['voice', 'ocr', 'audio']");
|
|
30
|
+
|
|
31
|
+
component.setAttribute('transcription-provider', "mistral");
|
|
32
|
+
component.setAttribute('completion-provider', "mistral");
|
|
33
|
+
component.setAttribute('transcription-model', "voxtral-mini-latest");
|
|
34
|
+
component.setAttribute('completion-model', "mistral-large-latest");
|
|
35
|
+
|
|
30
36
|
// Pas de thème = couleurs par défaut (rouge/bleu/vert)
|
|
31
37
|
|
|
32
38
|
container.appendChild(component);
|
|
@@ -49,6 +55,11 @@
|
|
|
49
55
|
componentFr.setAttribute('language', 'fr');
|
|
50
56
|
componentFr.setAttribute('classification-root-url', 'http://localhost:8888');
|
|
51
57
|
componentFr.setAttribute('input-types', "['voice', 'ocr', 'audio']");
|
|
58
|
+
|
|
59
|
+
componentFr.setAttribute('transcription-provider', "mistral");
|
|
60
|
+
componentFr.setAttribute('completion-provider', "mistral");
|
|
61
|
+
componentFr.setAttribute('transcription-model', "voxtral-mini-latest");
|
|
62
|
+
componentFr.setAttribute('completion-model', "mistral-large-latest");
|
|
52
63
|
|
|
53
64
|
containerFr.appendChild(componentFr);
|
|
54
65
|
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{r as e,c as t,h as i}from"./p-jmc2yzBp.js";class r{constructor(){this.mediaRecorder=null;this.audioChunks=[];this.stream=null}async startRecording(){try{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){console.error("Failed to start recording:","Microphone access is not supported in this browser or the page is not served over HTTPS/localhost.");return}this.stream=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:true,noiseSuppression:true,autoGainControl:true}});this.audioChunks=[];this.mediaRecorder=new MediaRecorder(this.stream,{mimeType:"audio/webm;codecs=opus"});this.mediaRecorder.ondataavailable=e=>{if(e.data&&e.data.size>0){this.audioChunks.push(e.data)}};this.mediaRecorder.start(100)}catch(e){console.error("Failed to start recording:",e)}}async stopRecording(){return new Promise(((e,t)=>{if(!this.mediaRecorder){t(new Error("No active recording found"));return}this.mediaRecorder.onstop=()=>{const t=new Blob(this.audioChunks,{type:"audio/webm"});this.cleanup();e(t)};this.mediaRecorder.onerror=e=>{t(new Error(`Recording error: ${e}`))};this.mediaRecorder.stop()}))}isRecording(){var e;return((e=this.mediaRecorder)===null||e===void 0?void 0:e.state)==="recording"}cleanup(){if(this.stream){this.stream.getTracks().forEach((e=>e.stop()));this.stream=null}this.mediaRecorder=null;this.audioChunks=[]}}class n{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 n=this.useProxy?`${this.baseUrl}/transcribe`:`${this.baseUrl}/audio/transcriptions`;const s={};if(!this.useProxy){s["Authorization"]=`Bearer ${this.apiKey}`}const o=await fetch(n,{method:"POST",headers:s,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 l=await o.json();return l.text||""}catch(e){throw new Error(`Speech-to-text transcription failed: ${e.message}`)}}}class s{static create(e){var t;const i=((t=e.speechToText)===null||t===void 0?void 0:t.provider)||"whisper";switch(i){case"whisper":return new n(e.speechToText);default:throw new Error(`Unsupported speech-to-text provider: ${i}`)}}}function o(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 n=[];for(let e=0;e<=i;e++){n[e]=[e]}for(let e=0;e<=r;e++){n[0][e]=e}for(let s=1;s<=i;s++){for(let i=1;i<=r;i++){const r=e[s-1]===t[i-1]?0:1;n[s][i]=Math.min(n[s-1][i]+1,n[s][i-1]+1,n[s-1][i-1]+r)}}return n[i][r]}catch(i){console.error("[fuzzy-match] levenshteinDistance error:",i,{str1:e,str2:t});throw i}}function l(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 a(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=l(e);const n=r.split(" ");let s=null;let a=0;let c=0;for(let e=0;e<t.length;e++){try{const u=t[e];const f=l(u);const h=f.split(" ");if(r===f){return{match:u,confidence:1}}if(f.includes(r)){const e=.95-(f.length-r.length)*.01;if(e>a){s=u;a=e;c=1}else if(e===a){c++}}if(r.includes(f)){const e=.9-(r.length-f.length)*.01;if(e>a){s=u;a=e;c=1}else if(e===a){c++}}const d=h.every((e=>n.includes(e)));if(d){const e=.85;if(e>a){s=u;a=e;c=1}else if(e===a){c++}}const p=o(r,f);const v=Math.max(r.length,f.length);const m=p/v;const b=1-m;if(m<=i&&b>a){s=u;a=b;c=1}else if(m<=i&&b===a){c++}}catch(i){console.error(`[fuzzy-match] Error processing option at index ${e}:`,i,{option:t[e]});continue}}if(s===null){console.warn("[fuzzy-match] No match found");return null}if(c>1){console.warn("[fuzzy-match] Multiple matches with same confidence, returning null",{matchCount:c,bestConfidence:a});return null}return{match:s,confidence:a}}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 c{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:""}`;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:""}`;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 n=[];e.value.forEach((e=>{const r=a(e,t.options);if(r){i.push(r.match)}else{n.push(e)}}));if(n.length>0){r.push(e.name);e.error=`Could not match values: ${n.join(", ")}`}e.value=i.length>0?i:null;e.fuzzyMatchConfidence=i.length/(i.length+n.length)}else if(!i){const i=Array.isArray(e.value)?e.value[0]:e.value;const n=a(i,t.options);if(n){e.value=n.match;e.fuzzyMatchConfidence=n.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 n,s;if(r.options&&r.options.length>=50){const o=(s=(n=e.schema)===null||n===void 0?void 0:n[t])===null||s===void 0?void 0:s.default;if(o){const n=r.type==="multiselect";if(n&&Array.isArray(o)){const n=[];const s=[];o.forEach((e=>{const t=a(e,r.options);if(t){n.push(t.match)}else{s.push(e)}}));if(s.length>0){i.push(t);e.schema[t].error=`Could not match values: ${s.join(", ")}`}e.schema[t].default=n.length>0?n:null;e.schema[t].fuzzyMatchConfidence=n.length/(n.length+s.length)}else if(!n){const n=Array.isArray(o)?o[0]:o;const s=a(n,r.options);if(s){e.schema[t].default=s.match;e.schema[t].fuzzyMatchConfidence=s.confidence}else{i.push(t);e.schema[t].default=null;e.schema[t].error=`Could not match "${n}" 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,n;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 n=`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 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: For select fields, options like "No", "Non", "Non applicable", "Inconnu", "Unknown", "N/A" are VALID VALUES that can be selected. When the user says these words, treat them as legitimate option choices, NOT always as negations or refusals to answer. HOWEVER, for non-select fields (string, number, date, etc.), if the user says "I don't know", "unknown", "not known", "inconnu", "je ne sais pas", this usually means they have NO VALUE to provide, unless explicitely precised - leave the field empty, do NOT fill it with the literal text "unknown" or "I don't know"\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\n Respond with JSON in this exact format: {"fields": [{"id": "field_id", "name": "field_name", "value": "extracted_value"}]}`;let s=`\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 l={"Content-Type":"application/json"};if(!this.useProxy){l["Authorization"]=`Bearer ${this.apiKey}`}const a=await fetch(o,{method:"POST",headers:l,body:JSON.stringify({model:this.model,messages:[{role:"system",content:n},{role:"user",content:s}],response_format:{type:"json_object"},temperature:1})});if(!a.ok){const e=await a.json().catch((()=>({error:"Unknown error"})));throw new Error(`LLM API failed: ${((r=e.error)===null||r===void 0?void 0:r.message)||a.statusText}`)}const c=await a.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 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: For select fields, options like "No", "Non", "Non applicable", "Inconnu", "Unknown", "N/A" are VALID VALUES that can be selected. When the user says these words, treat them as legitimate option choices, NOT always as negations or refusals to answer. HOWEVER, for non-select fields (string, number, date, etc.), if the user says "I don't know", "unknown", "not known", "inconnu", "je ne sais pas", this usually means they have NO VALUE to provide, unless explicitely precised - leave the field empty, do NOT fill it with the literal text "unknown" or "I don't know"\n\n Respond with JSON in this exact format: {"schema": {...}}`;let s=`\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 l={"Content-Type":"application/json"};if(!this.useProxy){l["Authorization"]=`Bearer ${this.apiKey}`}const a=await fetch(o,{method:"POST",headers:l,body:JSON.stringify({model:this.model,messages:[{role:"system",content:i},{role:"user",content:s}],response_format:{type:"json_object"},temperature:1})});if(!a.ok){const e=await a.json().catch((()=>({error:"Unknown error"})));throw new Error(`LLM API failed: ${((n=e.error)===null||n===void 0?void 0:n.message)||a.statusText}`)}const c=await a.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 u{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 c(e.llm);default:throw new Error(`Unsupported LLM provider: ${i}`)}}}class f{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 n=i.querySelector("form");if(n){r.title=n.getAttribute("title")||undefined;r.description=n.getAttribute("description")||undefined}const s=i.querySelectorAll("input, select, textarea");s.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 n=e.getAttribute("min");const s=e.getAttribute("max");const o=e.getAttribute("pattern");if(n)i.min=parseFloat(n);if(s)i.max=parseFloat(s);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,n])=>{var s;const o=e[r];const l=Object.assign(Object.assign({},n),{default:(s=n.default)!==null&&s!==void 0?s:o});const a=this.createXmlElementLegacy(t,r,l);if(a){i.appendChild(a)}}));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 n=e.createElement("option");n.setAttribute("value",t);n.textContent=t;if(i.default!==undefined&&i.default===t){n.setAttribute("selected","true")}r.appendChild(n)}))}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,n,s,o,l,a,c,u,f,h,d,p,v,m,b,g,w,y,x,C,$,k,T,S,O;try{const E=new DOMParser;const I=E.parseFromString(e,"text/xml");if(I.querySelector("parsererror")){throw new Error("Invalid XML format")}const M=I.querySelector("Xforms");if(!M)throw new Error("No Xforms root element found");const F=M.querySelectorAll("Fields");if(F.length===0)throw new Error("No Fields elements found");const j={fields:{}};for(const e of Array.from(F)){const E=(n=(r=e.querySelector("LabelTextFr"))===null||r===void 0?void 0:r.textContent)===null||n===void 0?void 0:n.trim();if(!E)return;const I=(o=(s=e.querySelector("HelpText"))===null||s===void 0?void 0:s.textContent)===null||o===void 0?void 0:o.trim();const M=(l=e.querySelector("DefaultValue"))===null||l===void 0?void 0:l.textContent;const F=((c=(a=e.querySelector("Enabled"))===null||a===void 0?void 0:a.textContent)===null||c===void 0?void 0:c.trim().toLowerCase())||"true";const L=F==="true";const N=(u=e.querySelector("ID"))===null||u===void 0?void 0:u.textContent;const R=(f=e.querySelector("TFie_PK_ID"))===null||f===void 0?void 0:f.textContent;const D=(h=e.querySelector("TVal_PK_ID"))===null||h===void 0?void 0:h.textContent;const P=(d=e.querySelector("TFIn_PK_ID"))===null||d===void 0?void 0:d.textContent;const z=(p=e.querySelector("isForm"))===null||p===void 0?void 0:p.textContent;const A=(v=e.querySelector("LabelText"))===null||v===void 0?void 0:v.textContent;const _=(m=e.querySelector("LabelTextFr"))===null||m===void 0?void 0:m.textContent;const U=(b=e.querySelector("SystemName"))===null||b===void 0?void 0:b.textContent;const V=(g=e.querySelector("CssStyle"))===null||g===void 0?void 0:g.textContent;const J=((w=e.querySelector("ControlType"))===null||w===void 0?void 0:w.textContent)||"TextBox";const Y=(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=(C=e.querySelector("ValidationMax"))===null||C===void 0?void 0:C.textContent;const X=($=e.querySelector("Mask"))===null||$===void 0?void 0:$.textContent;const H=(k=e.querySelector("TypeId"))===null||k===void 0?void 0:k.textContent;const B=(T=e.querySelector("Unit"))===null||T===void 0?void 0:T.textContent;const K=(S=e.querySelector("TFie_Fullpath"))===null||S===void 0?void 0:S.textContent;const Z=(O=e.querySelector("TVal_FK_Parent_ID"))===null||O===void 0?void 0:O.textContent;const G={type:this.mapControlTypeToJsonType(J),title:A,description:I,required:(Y===null||Y===void 0?void 0:Y.toLowerCase())==="required",default:M||undefined,realType:J,Enabled:L,ID:N,TFie_PK_ID:R,TVal_PK_ID:D,TFIn_PK_ID:P,isForm:z,LabelText:A,LabelTextFr:_,SystemName:U,CssStyle:V,ControlType:J,ValidationRequired:Y,ValidationMin:q,ValidationMax:W,Mask:X,TypeId:H,Unit:B,TFie_Fullpath:K,TVal_FK_Parent_ID:Z};if(G.type.toLowerCase()==="select"){try{const e=await fetch(`${t}/ng/api/v1/classification/getList/${G.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){G.options=e}}else{console.error("Unexpected API response format:",r)}}catch(e){console.error("Error fetching classification data:",e)}}if(q)G.min=parseFloat(q);if(W)G.max=parseFloat(W);if(X)G.pattern=X;j.fields[N]=G}return j}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,n])=>{const s=t.createElement("Fields");const o=n;const l=t.createElement("SystemName");l.textContent=o.SystemName;s.appendChild(l);const a=t.createElement("LabelText");a.textContent=o.LabelText||o.title||r;s.appendChild(a);const c=t.createElement("LabelTextFr");c.textContent=o.LabelTextFr;s.appendChild(c);const u=t.createElement("HelpText");u.textContent=o.description;s.appendChild(u);const f=t.createElement("ControlType");f.textContent=o.realType;s.appendChild(f);const h=t.createElement("ValidationRequired");h.textContent=o.required?"Required":"Not Required";s.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}s.appendChild(d);s.appendChild(p);const v=t.createElement("Enabled");v.textContent=o.Enabled===false?"False":"True";s.appendChild(v);const m=t.createElement("isForm");m.textContent=o.isForm;s.appendChild(m);if(o.type==="header"){const e=t.createElement("Header");e.textContent=o.title;s.appendChild(e)}const b=t.createElement("ID");b.textContent=o.ID;s.appendChild(b);const g=t.createElement("TFie_PK_ID");g.textContent=o.TFie_PK_ID;s.appendChild(g);const w=t.createElement("TVal_PK_ID");w.textContent=o.TVal_PK_ID;s.appendChild(w);const y=t.createElement("TFIn_PK_ID");y.textContent=o.TFIn_PK_ID;s.appendChild(y);const x=t.createElement("CssStyle");x.textContent=o.CssStyle;s.appendChild(x);const C=t.createElement("TypeId");C.textContent=o.TypeId;s.appendChild(C);const $=t.createElement("Unit");$.textContent=o.Unit;s.appendChild($);const k=t.createElement("TFie_Fullpath");k.textContent=o.TFie_Fullpath;s.appendChild(k);const T=t.createElement("TVal_FK_Parent_ID");T.textContent=o.TVal_FK_Parent_ID;s.appendChild(T);const S=t.createElement("ValidationMin");S.textContent=o.ValidationMin;s.appendChild(S);const O=t.createElement("ValidationMax");O.textContent=o.ValidationMax;s.appendChild(O);const E=t.createElement("Mask");E.textContent=o.Mask;s.appendChild(E);i.appendChild(s)}));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 h="ocr-file-uploader";const d={hotModuleReplacement:false,hydratedSelectorName:"hydrated",lazyLoad:true,propChangeCallback:true,updatable:true};var p=Object.create;var v=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var g=Object.getPrototypeOf;var w=Object.prototype.hasOwnProperty;var y=e=>{throw TypeError(e)};var x=(e,t,i)=>t in e?v(e,t,{enumerable:true,configurable:true,writable:true,value:i}):e[t]=i;var C=(e,t)=>function i(){return t||(0,e[b(e)[0]])((t={exports:{}}).exports,t),t.exports};var $=(e,t)=>{for(var i in t)v(e,i,{get:t[i],enumerable:true})};var k=(e,t,i,r)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let n of b(t))if(!w.call(e,n)&&n!==i)v(e,n,{get:()=>t[n],enumerable:!(r=m(t,n))||r.enumerable})}return e};var T=(e,t,i)=>(i=e!=null?p(g(e)):{},k(v(i,"default",{value:e,enumerable:true}),e));var S=(e,t,i)=>x(e,t+"",i);var O=(e,t,i)=>t.has(e)||y("Cannot "+i);var E=(e,t,i)=>(O(e,t,"read from private field"),i?i.call(e):t.get(e));var I=(e,t,i)=>t.has(e)?y("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i);var M=(e,t,i,r)=>(O(e,t,"write to private field"),t.set(e,i),i);var F=(e,t,i)=>(O(e,t,"access private method"),i);var j=C({"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 s=n(e,t,i);return s&&{start:s[0],end:s[1],pre:i.slice(0,s[0]),body:i.slice(s[0]+e.length,s[1]),post:i.slice(s[1]+t.length)}}function r(e,t){var i=t.match(e);return i?i[0]:null}i.range=n;function n(e,t,i){var r,n,s,o,l;var a=i.indexOf(e);var c=i.indexOf(t,a+1);var u=a;if(a>=0&&c>0){if(e===t){return[a,c]}r=[];s=i.length;while(u>=0&&!l){if(u==a){r.push(u);a=i.indexOf(e,u+1)}else if(r.length==1){l=[r.pop(),c]}else{n=r.pop();if(n<s){s=n;o=c}c=i.indexOf(t,u+1)}u=a<c&&a>=0?a:c}if(r.length){l=[s,o]}}return l}}});var L=C({"node_modules/brace-expansion/index.js"(e,t){var i=j();t.exports=h;var r="\0SLASH"+Math.random()+"\0";var n="\0OPEN"+Math.random()+"\0";var s="\0CLOSE"+Math.random()+"\0";var o="\0COMMA"+Math.random()+"\0";var l="\0PERIOD"+Math.random()+"\0";function a(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function c(e){return e.split("\\\\").join(r).split("\\{").join(n).split("\\}").join(s).split("\\,").join(o).split("\\.").join(l)}function u(e){return e.split(r).join("\\").split(n).join("{").split(s).join("}").split(o).join(",").split(l).join(".")}function f(e){if(!e)return[""];var t=[];var r=i("{","}",e);if(!r)return e.split(",");var n=r.pre;var s=r.body;var o=r.post;var l=n.split(",");l[l.length-1]+="{"+s+"}";var a=f(o);if(o.length){l[l.length-1]+=a.shift();l.push.apply(l,a)}t.push.apply(t,l);return t}function h(e){if(!e)return[];if(e.substr(0,2)==="{}"){e="\\{\\}"+e.substr(2)}return b(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 b(e,t){var r=[];var n=i("{","}",e);if(!n)return[e];var o=n.pre;var l=n.post.length?b(n.post,false):[""];if(/\$$/.test(n.pre)){for(var c=0;c<l.length;c++){var u=o+"{"+n.body+"}"+l[c];r.push(u)}}else{var h=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body);var g=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body);var w=h||g;var y=n.body.indexOf(",")>=0;if(!w&&!y){if(n.post.match(/,(?!,).*\}/)){e=n.pre+"{"+n.body+s+n.post;return b(e)}return[e]}var x;if(w){x=n.body.split(/\.\./)}else{x=f(n.body);if(x.length===1){x=b(x[0],false).map(d);if(x.length===1){return l.map((function(e){return n.pre+x[0]+e}))}}}var C;if(w){var $=a(x[0]);var k=a(x[1]);var T=Math.max(x[0].length,x[1].length);var S=x.length==3?Math.abs(a(x[2])):1;var O=v;var E=k<$;if(E){S*=-1;O=m}var I=x.some(p);C=[];for(var M=$;O(M,k);M+=S){var F;if(g){F=String.fromCharCode(M);if(F==="\\")F=""}else{F=String(M);if(I){var j=T-F.length;if(j>0){var L=new Array(j+1).join("0");if(M<0)F="-"+L+F.slice(1);else F=L+F}}}C.push(F)}}else{C=[];for(var N=0;N<x.length;N++){C.push.apply(C,b(x[N],false))}}for(var N=0;N<C.length;N++){for(var c=0;c<l.length;c++){var u=o+C[N]+l[c];if(!t||w||u)r.push(u)}}}return r}}});var N="http://www.w3.org/2000/svg";var R="http://www.w3.org/1999/xhtml";var D=e=>{if(e.__stencil__getHostRef){return e.__stencil__getHostRef()}return void 0};var P=(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 z=(e,t)=>t in e;var A=(e,t)=>(0,console.error)(e,t);var _=new Map;var U=(e,t,i)=>{const r=e.v.replace(/-/g,"_");const n=e.m;if(!n){return void 0}const s=_.get(n);if(s){return s[r]}
|
|
2
|
-
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/return import(`./${n}.entry.js${""}`).then((e=>{{_.set(n,e)}return e[r]}),(e=>{A(e,t.$hostElement$)}))};var V=new Map;var J="{visibility:hidden}.hydrated{visibility:inherit}";var Y="slot-fb{display:contents}slot-fb[hidden]{display:none}";var q=typeof window!=="undefined"?window:{};var W={t:0,C:"",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 X=e=>Promise.resolve(e);var H=(()=>{try{if(!q.document.adoptedStyleSheets){return false}new CSSStyleSheet;return typeof(new CSSStyleSheet).replaceSync==="function"}catch(e){}return false})();var B=H?(()=>!!q.document&&Object.getOwnPropertyDescriptor(q.document.adoptedStyleSheets,"length").writable)():false;var K=false;var Z=[];var G=[];var Q=(e,t)=>t=>{e.push(t);if(!K){K=true;if(W.t&4){ie(te)}else{W.raf(te)}}};var ee=e=>{for(let t=0;t<e.length;t++){try{e[t](performance.now())}catch(e){A(e)}}e.length=0};var te=()=>{ee(Z);{ee(G);if(K=Z.length>0){W.raf(te)}}};var ie=e=>X().then(e);var re=Q(G);var ne=e=>{e=typeof e;return e==="object"||e==="function"};var se=T(L());var oe=1024*64;var le=e=>{if(typeof e!=="string"){throw new TypeError("invalid pattern")}if(e.length>oe){throw new TypeError("pattern is too long")}};var ae={"[: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 ce=e=>e.replace(/[[\]\\-]/g,"\\$&");var ue=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");var fe=e=>e.join("");var he=(e,t)=>{const i=t;if(e.charAt(i)!=="["){throw new Error("not in a brace expression")}const r=[];const n=[];let s=i+1;let o=false;let l=false;let a=false;let c=false;let u=i;let f="";e:while(s<e.length){const t=e.charAt(s);if((t==="!"||t==="^")&&s===i+1){c=true;s++;continue}if(t==="]"&&o&&!a){u=s+1;break}o=true;if(t==="\\"){if(!a){a=true;s++;continue}}if(t==="["&&!a){for(const[t,[o,a,c]]of Object.entries(ae)){if(e.startsWith(t,s)){if(f){return["$.",false,e.length-i,true]}s+=t.length;if(c)n.push(o);else r.push(o);l=l||a;continue e}}}a=false;if(f){if(t>f){r.push(ce(f)+"-"+ce(t))}else if(t===f){r.push(ce(t))}f="";s++;continue}if(e.startsWith("-]",s+1)){r.push(ce(t+"-"));s+=2;continue}if(e.startsWith("-",s+1)){f=t;s+=2;continue}r.push(ce(t));s++}if(u<s){return["",false,0,false]}if(!r.length&&!n.length){return["$.",false,e.length-i,true]}if(n.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!c){const e=r[0].length===2?r[0].slice(-1):r[0];return[ue(e),false,u-i,false]}const h="["+(c?"^":"")+fe(r)+"]";const d="["+(c?"":"^")+fe(n)+"]";const p=r.length&&n.length?"("+h+"|"+d+")":r.length?h:d;return[p,l,u-i,true]};var de=(e,{windowsPathsNoEscape:t=false}={})=>t?e.replace(/\[([^\/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");var pe=new Set(["!","?","+","*","@"]);var ve=e=>pe.has(e);var me="(?!(?:^|/)\\.\\.?(?:$|/))";var be="(?!\\.)";var ge=new Set(["[","."]);var we=new Set(["..","."]);var ye=new Set("().*{}+?[]^$\\!");var xe=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");var Ce="[^/]";var $e=Ce+"*?";var ke=Ce+"+?";var Te,Se,Oe,Ee,Ie,Me,Fe,je,Le,Ne,Re,De,Pe,ze,Ae,_e,Ue;var Ve=class e{constructor(e,t,i={}){I(this,De);S(this,"type");I(this,Te);I(this,Se);I(this,Oe,false);I(this,Ee,[]);I(this,Ie);I(this,Me);I(this,Fe);I(this,je,false);I(this,Le);I(this,Ne);I(this,Re,false);this.type=e;if(e)M(this,Se,true);M(this,Ie,t);M(this,Te,E(this,Ie)?E(E(this,Ie),Te):this);M(this,Le,E(this,Te)===this?i:E(E(this,Te),Le));M(this,Fe,E(this,Te)===this?[]:E(E(this,Te),Fe));if(e==="!"&&!E(E(this,Te),je))E(this,Fe).push(this);M(this,Me,E(this,Ie)?E(E(this,Ie),Ee).length:0)}get hasMagic(){if(E(this,Se)!==void 0)return E(this,Se);for(const e of E(this,Ee)){if(typeof e==="string")continue;if(e.type||e.hasMagic)return M(this,Se,true)}return E(this,Se)}toString(){if(E(this,Ne)!==void 0)return E(this,Ne);if(!this.type){return M(this,Ne,E(this,Ee).map((e=>String(e))).join(""))}else{return M(this,Ne,this.type+"("+E(this,Ee).map((e=>String(e))).join("|")+")")}}push(...t){for(const i of t){if(i==="")continue;if(typeof i!=="string"&&!(i instanceof e&&E(i,Ie)===this)){throw new Error("invalid part: "+i)}E(this,Ee).push(i)}}toJSON(){var e;const t=this.type===null?E(this,Ee).slice().map((e=>typeof e==="string"?e:e.toJSON())):[this.type,...E(this,Ee).map((e=>e.toJSON()))];if(this.isStart()&&!this.type)t.unshift([]);if(this.isEnd()&&(this===E(this,Te)||E(E(this,Te),je)&&((e=E(this,Ie))==null?void 0:e.type)==="!")){t.push({})}return t}isStart(){var t;if(E(this,Te)===this)return true;if(!((t=E(this,Ie))==null?void 0:t.isStart()))return false;if(E(this,Me)===0)return true;const i=E(this,Ie);for(let t=0;t<E(this,Me);t++){const r=E(i,Ee)[t];if(!(r instanceof e&&r.type==="!")){return false}}return true}isEnd(){var e,t,i;if(E(this,Te)===this)return true;if(((e=E(this,Ie))==null?void 0:e.type)==="!")return true;if(!((t=E(this,Ie))==null?void 0:t.isEnd()))return false;if(!this.type)return(i=E(this,Ie))==null?void 0:i.isEnd();const r=E(this,Ie)?E(E(this,Ie),Ee).length:0;return E(this,Me)===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 E(this,Ee)){i.copyIn(e)}return i}static fromGlob(t,i={}){var r;const n=new e(null,void 0,i);F(r=e,ze,Ae).call(r,t,n,0,i);return n}toMMPattern(){if(this!==E(this,Te))return E(this,Te).toMMPattern();const e=this.toString();const[t,i,r,n]=this.toRegExpSource();const s=r||E(this,Se)||E(this,Le).nocase&&!E(this,Le).nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase();if(!s){return i}const o=(E(this,Le).nocase?"i":"")+(n?"u":"");return Object.assign(new RegExp(`^${t}$`,o),{_src:t,_glob:e})}get options(){return E(this,Le)}toRegExpSource(t){var i;const r=t!=null?t:!!E(this,Le).dot;if(E(this,Te)===this)F(this,De,Pe).call(this);if(!this.type){const n=this.isStart()&&this.isEnd();const s=E(this,Ee).map((i=>{var r;const[s,o,l,a]=typeof i==="string"?F(r=e,ze,Ue).call(r,i,E(this,Se),n):i.toRegExpSource(t);M(this,Se,E(this,Se)||l);M(this,Oe,E(this,Oe)||a);return s})).join("");let o="";if(this.isStart()){if(typeof E(this,Ee)[0]==="string"){const e=E(this,Ee).length===1&&we.has(E(this,Ee)[0]);if(!e){const e=ge;const i=r&&e.has(s.charAt(0))||s.startsWith("\\.")&&e.has(s.charAt(2))||s.startsWith("\\.\\.")&&e.has(s.charAt(4));const n=!r&&!t&&e.has(s.charAt(0));o=i?me:n?be:""}}}let l="";if(this.isEnd()&&E(E(this,Te),je)&&((i=E(this,Ie))==null?void 0:i.type)==="!"){l="(?:$|\\/)"}const a=o+s+l;return[a,de(s),M(this,Se,!!E(this,Se)),E(this,Oe)]}const n=this.type==="*"||this.type==="+";const s=this.type==="!"?"(?:(?!(?:":"(?:";let o=F(this,De,_e).call(this,r);if(this.isStart()&&this.isEnd()&&!o&&this.type!=="!"){const e=this.toString();M(this,Ee,[e]);this.type=null;M(this,Se,void 0);return[e,de(this.toString()),false,false]}let l=!n||t||r||false?"":F(this,De,_e).call(this,true);if(l===o){l=""}if(l){o=`(?:${o})(?:${l})*?`}let a="";if(this.type==="!"&&E(this,Re)){a=(this.isStart()&&!r?be:"")+ke}else{const e=this.type==="!"?"))"+(this.isStart()&&!r&&!t?be:"")+$e+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&l?")":this.type==="*"&&l?`)?`:`)${this.type}`;a=s+o+e}return[a,de(o),M(this,Se,!!E(this,Se)),E(this,Oe)]}};Te=new WeakMap;Se=new WeakMap;Oe=new WeakMap;Ee=new WeakMap;Ie=new WeakMap;Me=new WeakMap;Fe=new WeakMap;je=new WeakMap;Le=new WeakMap;Ne=new WeakMap;Re=new WeakMap;De=new WeakSet;Pe=function(){if(this!==E(this,Te))throw new Error("should only call on root");if(E(this,je))return this;this.toString();M(this,je,true);let e;while(e=E(this,Fe).pop()){if(e.type!=="!")continue;let t=e;let i=E(t,Ie);while(i){for(let r=E(t,Me)+1;!i.type&&r<E(i,Ee).length;r++){for(const t of E(e,Ee)){if(typeof t==="string"){throw new Error("string part in extglob AST??")}t.copyIn(E(i,Ee)[r])}}t=i;i=E(t,Ie)}}return this};ze=new WeakSet;Ae=function(e,t,i,r){var n,s;let o=false;let l=false;let a=-1;let c=false;if(t.type===null){let s=i;let u="";while(s<e.length){const i=e.charAt(s++);if(o||i==="\\"){o=!o;u+=i;continue}if(l){if(s===a+1){if(i==="^"||i==="!"){c=true}}else if(i==="]"&&!(s===a+2&&c)){l=false}u+=i;continue}else if(i==="["){l=true;a=s;c=false;u+=i;continue}if(!r.noext&&ve(i)&&e.charAt(s)==="("){t.push(u);u="";const o=new Ve(i,t);s=F(n=Ve,ze,Ae).call(n,e,o,s,r);t.push(o);continue}u+=i}t.push(u);return s}let u=i+1;let f=new Ve(null,t);const h=[];let d="";while(u<e.length){const i=e.charAt(u++);if(o||i==="\\"){o=!o;d+=i;continue}if(l){if(u===a+1){if(i==="^"||i==="!"){c=true}}else if(i==="]"&&!(u===a+2&&c)){l=false}d+=i;continue}else if(i==="["){l=true;a=u;c=false;d+=i;continue}if(ve(i)&&e.charAt(u)==="("){f.push(d);d="";const t=new Ve(i,f);f.push(t);u=F(s=Ve,ze,Ae).call(s,e,t,u,r);continue}if(i==="|"){f.push(d);d="";h.push(f);f=new Ve(null,t);continue}if(i===")"){if(d===""&&E(t,Ee).length===0){M(t,Re,true)}f.push(d);d="";t.push(...h,f);return u}d+=i}t.type=null;M(t,Se,void 0);M(t,Ee,[e.substring(i-1)]);return u};_e=function(e){return E(this,Ee).map((t=>{if(typeof t==="string"){throw new Error("string type in extglob ast??")}const[i,r,n,s]=t.toRegExpSource(e);M(this,Oe,E(this,Oe)||s);return i})).filter((e=>!(this.isStart()&&this.isEnd())||!!e)).join("|")};Ue=function(e,t,i=false){let r=false;let n="";let s=false;for(let o=0;o<e.length;o++){const l=e.charAt(o);if(r){r=false;n+=(ye.has(l)?"\\":"")+l;continue}if(l==="\\"){if(o===e.length-1){n+="\\\\"}else{r=true}continue}if(l==="["){const[i,r,l,a]=he(e,o);if(l){n+=i;s=s||r;o+=l-1;t=t||a;continue}}if(l==="*"){if(i&&e==="*")n+=ke;else n+=$e;t=true;continue}if(l==="?"){n+=Ce;t=true;continue}n+=xe(l)}return[n,de(e),!!t,s]};I(Ve,ze);var Je=Ve;var Ye=(e,{windowsPathsNoEscape:t=false}={})=>t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&");var qe=(e,t,i={})=>{le(t);if(!i.nocomment&&t.charAt(0)==="#"){return false}return new Et(t,i).match(e)};var We=/^\*+([^+@!?\*\[\(]*)$/;var Xe=e=>t=>!t.startsWith(".")&&t.endsWith(e);var He=e=>t=>t.endsWith(e);var Be=e=>{e=e.toLowerCase();return t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)};var Ke=e=>{e=e.toLowerCase();return t=>t.toLowerCase().endsWith(e)};var Ze=/^\*+\.\*+$/;var Ge=e=>!e.startsWith(".")&&e.includes(".");var Qe=e=>e!=="."&&e!==".."&&e.includes(".");var et=/^\.\*+$/;var tt=e=>e!=="."&&e!==".."&&e.startsWith(".");var it=/^\*+$/;var rt=e=>e.length!==0&&!e.startsWith(".");var nt=e=>e.length!==0&&e!=="."&&e!=="..";var st=/^\?+([^+@!?\*\[\(]*)?$/;var ot=([e,t=""])=>{const i=ut([e]);if(!t)return i;t=t.toLowerCase();return e=>i(e)&&e.toLowerCase().endsWith(t)};var lt=([e,t=""])=>{const i=ft([e]);if(!t)return i;t=t.toLowerCase();return e=>i(e)&&e.toLowerCase().endsWith(t)};var at=([e,t=""])=>{const i=ft([e]);return!t?i:e=>i(e)&&e.endsWith(t)};var ct=([e,t=""])=>{const i=ut([e]);return!t?i:e=>i(e)&&e.endsWith(t)};var ut=([e])=>{const t=e.length;return e=>e.length===t&&!e.startsWith(".")};var ft=([e])=>{const t=e.length;return e=>e.length===t&&e!=="."&&e!==".."};var ht=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix";var dt={win32:{sep:"\\"},posix:{sep:"/"}};var pt=ht==="win32"?dt.win32.sep:dt.posix.sep;qe.sep=pt;var vt=Symbol("globstar **");qe.GLOBSTAR=vt;var mt="[^/]";var bt=mt+"*?";var gt="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";var wt="(?:(?!(?:\\/|^)\\.).)*?";var yt=(e,t={})=>i=>qe(i,e,t);qe.filter=yt;var xt=(e,t={})=>Object.assign({},e,t);var Ct=e=>{if(!e||typeof e!=="object"||!Object.keys(e).length){return qe}const t=qe;const i=(i,r,n={})=>t(i,r,xt(e,n));return Object.assign(i,{Minimatch:class i extends t.Minimatch{constructor(t,i={}){super(t,xt(e,i))}static defaults(i){return t.defaults(xt(e,i)).Minimatch}},AST:class i extends t.AST{constructor(t,i,r={}){super(t,i,xt(e,r))}static fromGlob(i,r={}){return t.AST.fromGlob(i,xt(e,r))}},unescape:(i,r={})=>t.unescape(i,xt(e,r)),escape:(i,r={})=>t.escape(i,xt(e,r)),filter:(i,r={})=>t.filter(i,xt(e,r)),defaults:i=>t.defaults(xt(e,i)),makeRe:(i,r={})=>t.makeRe(i,xt(e,r)),braceExpand:(i,r={})=>t.braceExpand(i,xt(e,r)),match:(i,r,n={})=>t.match(i,r,xt(e,n)),sep:t.sep,GLOBSTAR:vt})};qe.defaults=Ct;var $t=(e,t={})=>{le(e);if(t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)){return[e]}return(0,se.default)(e)};qe.braceExpand=$t;var kt=(e,t={})=>new Et(e,t).makeRe();qe.makeRe=kt;var Tt=(e,t,i={})=>{const r=new Et(t,i);e=e.filter((e=>r.match(e)));if(r.options.nonull&&!e.length){e.push(t)}return e};qe.match=Tt;var St=/[?*]|[+@!]\(.*?\)|\[|\]/;var Ot=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");var Et=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(e,t={}){le(e);t=t||{};this.options=t;this.pattern=e;this.platform=t.platform||ht;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]==="?"||!St.test(e[2]))&&!St.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 n=r;while(i[n+1]==="**"){n++}if(n>r){i.splice(r+1,n-r)}let s=i[r+1];const o=i[r+2];const l=i[r+3];if(s!=="..")continue;if(!o||o==="."||o===".."||!l||l==="."||l===".."){continue}t=true;i.splice(r,1);const a=i.slice(0);a[r]="**";e.push(a);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 n=0;while(-1!==(n=i.indexOf("..",n+1))){const e=i[n-1];if(e&&e!=="."&&e!==".."&&e!=="**"){t=true;const e=n===1&&i[n+1]==="**";const r=e?["."]:[];i.splice(n-1,2,...r);if(i.length===0)i.push("");n-=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 n=0;let s=[];let o="";while(r<e.length&&n<t.length){if(e[r]===t[n]){s.push(o==="b"?t[n]:e[r]);r++;n++}else if(i&&e[r]==="**"&&t[n]===e[r+1]){s.push(e[r]);r++}else if(i&&t[n]==="**"&&e[r]===t[n+1]){s.push(t[n]);n++}else if(e[r]==="*"&&t[n]&&(this.options.dot||!t[n].startsWith("."))&&t[n]!=="**"){if(o==="b")return false;o="a";s.push(e[r]);r++;n++}else if(t[n]==="*"&&e[r]&&(this.options.dot||!e[r].startsWith("."))&&e[r]!=="**"){if(o==="a")return false;o="b";s.push(t[n]);r++;n++}else{return false}}return e.length===t.length&&s}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 n=typeof t[0]==="string"&&/^[a-z]:$/i.test(t[0]);const s=!n&&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 l=s?3:n?0:void 0;if(typeof o==="number"&&typeof l==="number"){const[i,r]=[e[o],t[l]];if(i.toLowerCase()===r.toLowerCase()){t[l]=i;if(l>o){t=t.slice(l)}else if(o>l){e=e.slice(o)}}}}const{optimizationLevel:n=1}=this.options;if(n>=2){e=this.levelTwoFileOptimize(e)}this.debug("matchOne",this,{file:e,pattern:t});this.debug("matchOne",e.length,t.length);for(var s=0,o=0,l=e.length,a=t.length;s<l&&o<a;s++,o++){this.debug("matchOne loop");var c=t[o];var u=e[s];this.debug(t,c,u);if(c===false){return false}if(c===vt){this.debug("GLOBSTAR",[t,c,u]);var f=s;var h=o+1;if(h===a){this.debug("** at the end");for(;s<l;s++){if(e[s]==="."||e[s]===".."||!r.dot&&e[s].charAt(0)===".")return false}return true}while(f<l){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,l,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===l){return true}}return false}let n;if(typeof c==="string"){n=u===c;this.debug("string match",c,u,n)}else{n=c.test(u);this.debug("pattern match",c,u,n)}if(!n)return false}if(s===l&&o===a){return true}else if(s===l){return i}else if(o===a){return s===l-1&&e[s]===""}else{throw new Error("wtf?")}}braceExpand(){return $t(this.pattern,this.options)}parse(e){le(e);const t=this.options;if(e==="**")return vt;if(e==="")return"";let i;let r=null;if(i=e.match(it)){r=t.dot?nt:rt}else if(i=e.match(We)){r=(t.nocase?t.dot?Ke:Be:t.dot?He:Xe)(i[1])}else if(i=e.match(st)){r=(t.nocase?t.dot?lt:ot:t.dot?at:ct)(i)}else if(i=e.match(Ze)){r=t.dot?Qe:Ge}else if(i=e.match(et)){r=tt}const n=Je.fromGlob(e,this.options).toMMPattern();if(r&&typeof n==="object"){Reflect.defineProperty(n,"test",{value:r})}return n}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?bt:t.dot?gt:wt;const r=new Set(t.nocase?["i"]:[]);let n=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"?Ot(e):e===vt?vt:e._src}));t.forEach(((e,r)=>{const n=t[r+1];const s=t[r-1];if(e!==vt||s===vt){return}if(s===void 0){if(n!==void 0&&n!==vt){t[r+1]="(?:\\/|"+i+"\\/)?"+n}else{t[r]=i}}else if(n===void 0){t[r-1]=s+"(?:\\/|"+i+")?"}else if(n!==vt){t[r-1]=s+"(?:\\/|\\/"+i+"\\/)"+n;t[r+1]=vt}}));return t.filter((e=>e!==vt)).join("/")})).join("|");const[s,o]=e.length>1?["(?:",")"]:["",""];n="^"+s+n+o+"$";if(this.negate)n="^(?!"+n+").+$";try{this.regexp=new RegExp(n,[...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 n=this.set;this.debug(this.pattern,"set",n);let s=r[r.length-1];if(!s){for(let e=r.length-2;!s&&e>=0;e--){s=r[e]}}for(let e=0;e<n.length;e++){const o=n[e];let l=r;if(i.matchBase&&o.length===1){l=[s]}const a=this.matchOne(l,o,t);if(a){if(i.flipNegate){return true}return!this.negate}}if(i.flipNegate){return false}return this.negate}static defaults(e){return qe.defaults(e).Minimatch}};qe.AST=Je;qe.Minimatch=Et;qe.escape=Ye;qe.unescape=de;function It(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 Mt=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");var Ft={};$(Ft,{err:()=>Lt,map:()=>Nt,ok:()=>jt,unwrap:()=>Rt,unwrapErr:()=>Dt});var jt=e=>({isOk:true,isErr:false,value:e});var Lt=e=>({isOk:false,isErr:true,value:e});function Nt(e,t){if(e.isOk){const i=t(e.value);if(i instanceof Promise){return i.then((e=>jt(e)))}else{return jt(i)}}if(e.isErr){const t=e.value;return Lt(t)}throw"should never get here"}var Rt=e=>{if(e.isOk){return e.value}else{throw e.value}};var Dt=e=>{if(e.isErr){return e.value}else{throw e.value}};function Pt(e){return void 0}var zt;function At(e){var t;const i={mode:"open"};const r=this.attachShadow(i);if(zt===void 0)zt=(t=Pt())!=null?t:null;if(zt){if(B){r.adoptedStyleSheets.push(zt)}else{r.adoptedStyleSheets=[...r.adoptedStyleSheets,zt]}}}var _t=(e,t="")=>{{return()=>{}}};var Ut=(e,t)=>{{return()=>{}}};var Vt=new WeakMap;var Jt=(e,t,i)=>{let r=V.get(e);if(H&&i){r=r||new CSSStyleSheet;if(typeof r==="string"){r=t}else{r.replaceSync(t)}}else{r=t}V.set(e,r)};var Yt=(e,t,i)=>{var r,n,s;const o=Wt(t);const l=V.get(o);if(!q.document){return o}e=e.nodeType===11?e:q.document;if(l){if(typeof l==="string"){e=e.head||e;let i=Vt.get(e);let s;if(!i){Vt.set(e,i=new Set)}if(!i.has(o)){s=q.document.createElement("style");s.innerHTML=l;const a=(r=W.$)!=null?r:It(q.document);if(a!=null){s.setAttribute("nonce",a)}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(s,(i==null?void 0:i.parentNode)===e?i:null)}else if("host"in e){if(H){const t=(n=e.defaultView)!=null?n:e.ownerDocument.defaultView;const i=new t.CSSStyleSheet;i.replaceSync(l);if(B){e.adoptedStyleSheets.unshift(i)}else{e.adoptedStyleSheets=[i,...e.adoptedStyleSheets]}}else{const t=e.querySelector("style");if(t){t.innerHTML=l+t.innerHTML}else{e.prepend(s)}}}else{e.append(s)}}if(t.t&1){e.insertBefore(s,null)}if(t.t&4){s.innerHTML+=Y}if(i){i.add(o)}}}else{let t=Vt.get(e);if(!t){Vt.set(e,t=new Set)}if(!t.has(o)){const i=(s=e.defaultView)!=null?s:e.ownerDocument.defaultView;let r;if(l.constructor===i.CSSStyleSheet){r=l}else{r=new i.CSSStyleSheet;for(let e=0;e<l.cssRules.length;e++){r.insertRule(l.cssRules[e].cssText,e)}}if(B){e.adoptedStyleSheets.push(r)}else{e.adoptedStyleSheets=[...e.adoptedStyleSheets,r]}t.add(o)}}}return o};var qt=e=>{const t=e.i;const i=e.$hostElement$;const r=t.t;const n=_t("attachStyles",t.v);const s=Yt(i.shadowRoot?i.shadowRoot:i.getRootNode(),t);if(r&10){i["s-sc"]=s;i.classList.add(s+"-h")}n()};var Wt=(e,t)=>"sc-"+e.v;var Xt=(e,t,...i)=>{let r=null;let n=null;let s=false;let o=false;const l=[];const a=e=>{for(let t=0;t<e.length;t++){r=e[t];if(Array.isArray(r)){a(r)}else if(r!=null&&typeof r!=="boolean"){if(s=!ne(r)){r=String(r)}if(s&&o){l[l.length-1].k+=r}else{l.push(s?Ht(null,r):r)}o=s}}};a(i);const c=Ht(e,null);c.T=t;if(l.length>0){c.S=l}{c.O=n}return c};var Ht=(e,t)=>{const i={t:0,I:e,k:t,M:null,S:null};{i.T=null}{i.O=null}return i};var Bt={};var Kt=e=>e&&e.I===Bt;var Zt=e=>{const t=Mt(e);return new RegExp(`(^|[^@]|@(?!supports\\s+selector\\s*\\([^{]*?${t}))(${t}\\b)`,"g")};Zt("::slotted");Zt(":host");Zt(":host-context");var Gt=(e,t,i)=>{if(e!=null&&!ne(e)){if(t&4){{return e==="false"?false:e===""||!!e}}if(t&1){return String(e)}return e}return e};var Qt=(e,t,i)=>{const r=W.ce(t,i);e.dispatchEvent(r);return r};var ei=(e,t,i,r,n,s,o)=>{if(i===r){return}let l=z(e,t);let a=t.toLowerCase();if(t==="class"){const t=e.classList;const n=ii(i);let s=ii(r);{t.remove(...n.filter((e=>e&&!s.includes(e))));t.add(...s.filter((e=>e&&!n.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(!l&&t[0]==="o"&&t[1]==="n"){if(t[2]==="-"){t=t.slice(3)}else if(z(q,a)){t=a.slice(2)}else{t=a[2]+t.slice(3)}if(i||r){const n=t.endsWith(ri);t=t.replace(ni,"");if(i){W.rel(e,t,i,n)}if(r){W.ael(e,t,r,n)}}}else{const o=ne(r);if((l||o&&r!==null)&&!n){try{if(!e.tagName.includes("-")){const n=r==null?"":r;if(t==="list"){l=false}else if(i==null||e[t]!=n){if(typeof e.__lookupSetter__(t)==="function"){e[t]=n}else{e.setAttribute(t,n)}}}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((!l||s&4||n)&&!o&&e.nodeType===1){r=r===true?"":r;{e.setAttribute(t,r)}}}};var ti=/\s/;var ii=e=>{if(typeof e==="object"&&e&&"baseVal"in e){e=e.baseVal}if(!e||typeof e!=="string"){return[]}return e.split(ti)};var ri="Capture";var ni=new RegExp(ri+"$");var si=(e,t,i,r)=>{const n=t.M.nodeType===11&&t.M.host?t.M.host:t.M;const s=e&&e.T||{};const o=t.T||{};{for(const e of oi(Object.keys(s))){if(!(e in o)){ei(n,e,s[e],void 0,i,t.t)}}}for(const e of oi(Object.keys(o))){ei(n,e,s[e],o[e],i,t.t)}};function oi(e){return e.includes("ref")?[...e.filter((e=>e!=="ref")),"ref"]:e}var li;var ai=false;var ci=(e,t,i)=>{const r=t.S[i];let n=0;let s;let o;{if(!ai){ai=r.I==="svg"}if(!q.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.")}s=r.M=q.document.createElementNS(ai?N:R,r.I);if(ai&&r.I==="foreignObject"){ai=false}{si(null,r,ai)}if(r.S){const t=r.I==="template"?s.content:s;for(n=0;n<r.S.length;++n){o=ci(e,r,n);if(o){t.appendChild(o)}}}{if(r.I==="svg"){ai=false}else if(s.tagName==="foreignObject"){ai=true}}}s["s-hn"]=li;return s};var ui=(e,t,i,r,n,s)=>{let o=e;let l;if(o.shadowRoot&&o.tagName===li){o=o.shadowRoot}if(i.I==="template"){o=o.content}for(;n<=s;++n){if(r[n]){l=ci(null,i,n);if(l){r[n].M=l;mi(o,l,t)}}}};var fi=(e,t,i)=>{for(let r=t;r<=i;++r){const t=e[r];if(t){const e=t.M;vi(t);if(e){e.remove()}}}};var hi=(e,t,i,r,n=false)=>{let s=0;let o=0;let l=0;let a=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 b=i.I==="template"?e.content:e;while(s<=c&&o<=h){if(u==null){u=t[++s]}else if(f==null){f=t[--c]}else if(d==null){d=r[++o]}else if(p==null){p=r[--h]}else if(di(u,d,n)){pi(u,d,n);u=t[++s];d=r[++o]}else if(di(f,p,n)){pi(f,p,n);f=t[--c];p=r[--h]}else if(di(u,p,n)){pi(u,p,n);mi(b,u.M,f.M.nextSibling);u=t[++s];p=r[--h]}else if(di(f,d,n)){pi(f,d,n);mi(b,f.M,u.M);f=t[--c];d=r[++o]}else{l=-1;{for(a=s;a<=c;++a){if(t[a]&&t[a].O!==null&&t[a].O===d.O){l=a;break}}}if(l>=0){m=t[l];if(m.I!==d.I){v=ci(t&&t[o],i,l)}else{pi(m,d,n);t[l]=void 0;v=m.M}d=r[++o]}else{v=ci(t&&t[o],i,o);d=r[++o]}if(v){{mi(u.M.parentNode,v,u.M)}}}}if(s>c){ui(e,r[h+1]==null?null:r[h+1].M,i,r,o,h)}else if(o>h){fi(t,s,c)}};var di=(e,t,i=false)=>{if(e.I===t.I){if(!i){return e.O===t.O}if(i&&!e.O&&t.O){e.O=t.O}return true}return false};var pi=(e,t,i=false)=>{const r=t.M=e.M;const n=e.S;const s=t.S;const o=t.I;{{ai=o==="svg"?true:o==="foreignObject"?false:ai}{si(e,t,ai)}if(n!==null&&s!==null){hi(r,n,t,s,i)}else if(s!==null){ui(r,null,t,s,0,s.length-1)}else if(!i&&d.updatable&&n!==null){fi(n,0,n.length-1)}else;if(ai&&o==="svg"){ai=false}}};var vi=e=>{{e.T&&e.T.ref&&e.T.ref(null);e.S&&e.S.map(vi)}};var mi=(e,t,i)=>{{return e==null?void 0:e.insertBefore(t,i)}};var bi=(e,t,i=false)=>{const r=e.$hostElement$;const n=e.F||Ht(null,null);const s=Kt(t);const o=s?t:Xt(null,null,t);li=r.tagName;if(i&&o.T){for(const e of Object.keys(o.T)){if(r.hasAttribute(e)&&!["key","ref","style","class"].includes(e)){o.T[e]=r[e]}}}o.I=null;o.t|=4;e.F=o;o.M=n.M=r.shadowRoot||r;pi(n,o,i)};var gi=(e,t)=>{if(t&&!e.j&&t["s-p"]){const i=t["s-p"].push(new Promise((r=>e.j=()=>{t["s-p"].splice(i-1,1);r()})))}};var wi=(e,t)=>{{e.t|=16}if(e.t&4){e.t|=512;return}gi(e,e.L);const i=()=>yi(e,t);if(t){queueMicrotask((()=>{i()}));return}return re(i)};var yi=(e,t)=>{const i=e.$hostElement$;const r=_t("scheduleUpdate",e.i.v);const n=e.N;if(!n){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 s;if(t){{if(e.p.length){e.p.forEach((e=>e(i)))}}s=Oi(n,"componentWillLoad",void 0,i)}else{s=Oi(n,"componentWillUpdate",void 0,i)}s=xi(s,(()=>Oi(n,"componentWillRender",void 0,i)));r();return xi(s,(()=>$i(e,n,t)))};var xi=(e,t)=>Ci(e)?e.then(t).catch((e=>{console.error(e);t()})):t();var Ci=e=>e instanceof Promise||e&&e.then&&typeof e.then==="function";var $i=async(e,t,i)=>{var r;const n=e.$hostElement$;const s=_t("update",e.i.v);const o=n["s-rc"];if(i){qt(e)}const l=_t("render",e.i.v);{ki(e,t,n,i)}if(o){o.map((e=>e()));n["s-rc"]=void 0}l();s();{const t=(r=n["s-p"])!=null?r:[];const i=()=>Ti(e);if(t.length===0){i()}else{Promise.all(t).then(i);e.t|=4;t.length=0}}};var ki=(e,t,i,r)=>{try{t=t.render();{e.t&=-17}{e.t|=2}{{{bi(e,t,r)}}}}catch(t){A(t,e.$hostElement$)}return null};var Ti=e=>{const t=e.i.v;const i=e.$hostElement$;const r=_t("postUpdate",t);const n=e.N;const s=e.L;Oi(n,"componentDidRender",void 0,i);if(!(e.t&64)){e.t|=64;{Ei(i)}Oi(n,"componentDidLoad",void 0,i);r();{e.h(i);if(!s){Si()}}}else{Oi(n,"componentDidUpdate",void 0,i);r()}{if(e.j){e.j();e.j=void 0}if(e.t&512){ie((()=>wi(e,false)))}e.t&=-517}};var Si=e=>{ie((()=>Qt(q,"appload",{detail:{namespace:h}})))};var Oi=(e,t,i,r)=>{if(e&&e[t]){try{return e[t](i)}catch(e){A(e,r)}}return void 0};var Ei=e=>{var t;return e.classList.add((t=d.hydratedSelectorName)!=null?t:"hydrated")};var Ii=(e,t)=>D(e).o.get(t);var Mi=(e,t,i,r)=>{const n=D(e);if(!n){return}if(!n){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 s=n.$hostElement$;const o=n.o.get(t);const l=n.t;const a=n.N;i=Gt(i,r.R[t][0]);const c=Number.isNaN(o)&&Number.isNaN(i);const u=i!==o&&!c;if((!(l&8)||o===void 0)&&u){n.o.set(t,i);if(r.D){const e=r.D[t];if(e){e.map((e=>{try{const[[r,s]]=Object.entries(e);if(l&128||s&1){if(!a){n.p.push((()=>{n.N[r](i,o,t)}))}else{a[r](i,o,t)}}}catch(e){A(e,s)}}))}}if((l&(2|16))===2){if(a.componentShouldUpdate){if(a.componentShouldUpdate(i,o,t)===false){return}}wi(n,false)}}};var Fi=(e,t,i)=>{var r,n;const s=e.prototype;if(t.R||d.propChangeCallback){{if(e.watchers&&!t.D){t.D=e.watchers}if(e.deserializers&&!t.P){t.P=e.deserializers}if(e.serializers&&!t.A){t.A=e.serializers}}const o=Object.entries((r=t.R)!=null?r:{});o.map((([e,[r]])=>{if(r&31||i&2&&r&32){const{get:n,set:o}=Object.getOwnPropertyDescriptor(s,e)||{};if(n)t.R[e][0]|=2048;if(o)t.R[e][0]|=4096;if(i&1||!n){Object.defineProperty(s,e,{get(){{if((t.R[e][0]&2048)===0){return Ii(this,e)}const i=D(this);const r=i?i.N:s;if(!r)return;return r[e]}},configurable:true,enumerable:true})}Object.defineProperty(s,e,{set(n){const s=D(this);if(!s){return}if(o){const i=r&32?this[e]:s.$hostElement$[e];if(typeof i==="undefined"&&s.o.get(e)){n=s.o.get(e)}o.apply(this,[Gt(n,r)]);n=r&32?this[e]:s.$hostElement$[e];Mi(this,e,n,t);return}{if((i&1)===0||(t.R[e][0]&4096)===0){Mi(this,e,n,t);if(i&1&&!s.N){s.p.push((()=>{if(t.R[e][0]&4096&&s.N[e]!==s.o.get(e)){s.N[e]=n}}))}return}const o=()=>{const i=s.N[e];if(!s.o.get(e)&&i){s.o.set(e,i)}s.N[e]=Gt(n,r);Mi(this,e,s.N[e],t)};if(s.N){o()}else{s.p.push((()=>{o()}))}}}})}}));if(i&1){const i=new Map;s.attributeChangedCallback=function(e,r,n){W.jmp((()=>{var l;const a=i.get(e);const c=D(this);if(this.hasOwnProperty(a)&&d.lazyLoad){n=this[a];delete this[a]}if(s.hasOwnProperty(a)&&typeof this[a]==="number"&&this[a]==n){return}else if(a==null){const i=c==null?void 0:c.t;if(c&&i&&!(i&8)&&n!==r){const s=c.N;const o=(l=t.D)==null?void 0:l[e];o==null?void 0:o.forEach((t=>{const[[o,l]]=Object.entries(t);if(s[o]!=null&&(i&128||l&1)){s[o].call(s,n,r,e)}}))}return}const u=o.find((([e])=>e===a));if(u&&u[1][0]&4){n=n===null||n==="false"?false:true}const f=Object.getOwnPropertyDescriptor(s,a);if(n!=this[a]&&(!f.get||!!f.set)){this[a]=n}}))};e.observedAttributes=Array.from(new Set([...Object.keys((n=t.D)!=null?n:{}),...o.filter((([e,t])=>t[0]&31)).map((([e,t])=>{const r=t[1]||e;i.set(r,e);return r}))]))}}return e};var ji=async(e,t,i,r)=>{let n;if((t.t&32)===0){t.t|=32;const r=i.m;if(r){const r=U(i,t);if(r&&"then"in r){const e=Ut();n=await r;e()}else{n=r}if(!n){throw new Error(`Constructor for "${i.v}#${t._}" was not found`)}if(!n.isProxied){{i.D=n.watchers;i.A=n.serializers;i.P=n.deserializers}Fi(n,i,2);n.isProxied=true}const s=_t("createInstance",i.v);{t.t|=8}try{new n(t)}catch(t){A(t,e)}{t.t&=-9}{t.t|=128}s();Li(t.N,e)}else{n=e.constructor;const i=e.localName;customElements.whenDefined(i).then((()=>t.t|=128))}if(n&&n.style){let e;if(typeof n.style==="string"){e=n.style}const t=Wt(i);if(!V.has(t)||d.hotModuleReplacement){const r=_t("registerStyles",i.v);Jt(t,e,!!(i.t&1));r()}}}const s=t.L;const o=()=>wi(t,true);if(s&&s["s-rc"]){s["s-rc"].push(o)}else{o()}};var Li=(e,t)=>{{Oi(e,"connectedCallback",void 0,t)}};var Ni=e=>{if((W.t&1)===0){const t=D(e);if(!t){return}const i=t.i;const r=_t("connectedCallback",i.v);if(!(t.t&1)){t.t|=1;{let i=e;while(i=i.parentNode||i.host){if(i["s-p"]){gi(t,t.L=i);break}}}if(i.R){Object.entries(i.R).map((([t,[i]])=>{if(i&31&&t in e&&e[t]!==Object.prototype[t]){const i=e[t];delete e[t];e[t]=i}}))}{ji(e,t,i)}}else{if(t==null?void 0:t.N){Li(t.N,e)}else if(t==null?void 0:t.u){t.u.then((()=>Li(t.N,e)))}}r()}};var Ri=(e,t)=>{{Oi(e,"disconnectedCallback",void 0,t||e)}};var Di=async e=>{if((W.t&1)===0){const t=D(e);if(t==null?void 0:t.N){Ri(t.N,e)}else if(t==null?void 0:t.u){t.u.then((()=>Ri(t.N,e)))}}if(Vt.has(e)){Vt.delete(e)}if(e.shadowRoot&&Vt.has(e.shadowRoot)){Vt.delete(e.shadowRoot)}};var Pi=(e,t={})=>{var i;if(!q.document){console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");return}const r=_t();const n=[];const s=t.exclude||[];const o=q.customElements;const l=q.document.head;const a=l.querySelector("meta[charset]");const c=q.document.createElement("style");const u=[];let f;let h=true;Object.assign(W,t);W.C=new URL(t.resourcesUrl||"./",q.document.baseURI).href;let d=false;e.map((e=>{e[1].map((t=>{var i,r,l;const a={t:t[0],v:t[1],R:t[2],U:t[3]};if(a.t&4){d=true}{a.R=t[2]}{a.D=(i=t[4])!=null?i:{};a.A=(r=t[5])!=null?r:{};a.P=(l=t[6])!=null?l:{}}const c=zi(a.v);const p=class extends HTMLElement{constructor(e){super(e);this.hasRegisteredEventListeners=false;e=this;P(e,a);if(a.t&1){{if(!e.shadowRoot){At.call(e,a)}else{if(e.shadowRoot.mode!=="open"){throw new Error(`Unable to re-use existing shadow root for ${a.v}! Mode is set to ${e.shadowRoot.mode} but Stencil only supports open shadow roots.`)}}}}}connectedCallback(){const e=D(this);if(!e){return}if(!this.hasRegisteredEventListeners){this.hasRegisteredEventListeners=true}if(f){clearTimeout(f);f=null}if(h){u.push(this)}else{W.jmp((()=>Ni(this)))}}disconnectedCallback(){W.jmp((()=>Di(this)));W.raf((()=>{var e;const t=D(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.M)instanceof Node&&!t.F.M.isConnected){delete t.F.M}}))}componentOnReady(){var e;return(e=D(this))==null?void 0:e.u}};a.m=e[0];if(!s.includes(c)&&!o.get(c)){n.push(c);o.define(c,Fi(p,a,1))}}))}));if(n.length>0){if(d){c.textContent+=Y}{c.textContent+=n.sort()+J}if(c.innerHTML.length){c.setAttribute("data-styles","");const e=(i=W.$)!=null?i:It(q.document);if(e!=null){c.setAttribute("nonce",e)}l.insertBefore(c,a?a.nextSibling:l.firstChild)}}h=false;if(u.length){u.map((e=>e.connectedCallback()))}else{{W.jmp((()=>f=setTimeout(Si,30)))}}r()};function zi(e){return e}const Ai=()=>{};const _i=async(e,t)=>{if(typeof window==="undefined")return undefined;await Ai();return Pi([["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 Ui=":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}";_i();const Vi=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.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 r}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{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),{apiKey:this.apiKey,model:this.transcriptionModel}),llm:Object.assign(Object.assign({},this.parsedConfig.llm),{apiKey:this.apiKey,model:this.completionModel})})}else{this.parsedConfig=Object.assign(Object.assign({},this.parsedConfig),{speechToText:Object.assign(Object.assign({},this.parsedConfig.speechToText),{useProxy:true,proxyUrl:this.apiProxyUrl,model:this.transcriptionModel}),llm:Object.assign(Object.assign({},this.parsedConfig.llm),{useProxy:true,proxyUrl:this.apiProxyUrl,model:this.completionModel})})}this.speechToTextService=s.create(this.parsedConfig);this.llmService=u.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 n=(e===null||e===void 0?void 0:e.content)||e;const s=JSON.stringify(n);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 l=await this.llmService.fillFormFromJson(s,o);this.filledData=this.extractFilledData(l);this.updateDebugInfo("Form Filled",{filledSchema:l,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:s})}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 n=await this.speechToTextService.transcribe(e,this.language);this.transcription=n;this.updateDebugInfo("Transcription Complete",{transcription:n});if(!n.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 s=await this.trimSchemaForAI(this.parsedSchema);const o=await this.llmService.fillFormFromTranscription(n,s);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:n})}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.webm",{type:"audio/webm"});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 n=t.fields[r];if(n.title===e){n.value=i.value;n.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 n={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 s=["InputClassification","select","multiselect","InputMultiSelect"];if(s.includes(e.Type)&&e.Children&&e.Children.length>0){n.options=e.Children.map((e=>e.System_Name||e.Label||e.toString()))}r.fields.push(n)}));return r;case"ecoll-veto":const n=this.parsedSchema[0].items.concat(this.parsedSchema[1].items);if(n){const e={title:"Form Name",description:"Form Description",schema:{}};Object.entries(n).forEach((async([t,i])=>{const r=i.name;const n=this.mapFieldType(i.type);const s=i.label||r;if(["position","thesaurus"].includes(n)){try{const e=await fetch(`${this.classificationRootUrl}/ng/api/v1/classification/getList/${n.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:n,title:s,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 f.convertXmlToJson(e,this.classificationRootUrl,this.language)}async convertJsonToXml(e){return f.convertJsonToXml(e)}async convertXmlToJsonLegacy(e){return f.convertXmlToJsonLegacy(e)}async convertJsonToXmlLegacy(e){return f.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 n={button:{size:r,backgroundColor:t.backgroundColor||"#10b981",hoverColor:t.hoverColor||"#059669",textColor:t.textColor||"#ffffff"}};const s=this.isProcessing||this.hasError;return i("div",{style:{width:r,height:r,flexShrink:"0",opacity:s?"0.6":"1",pointerEvents:s?"none":"auto"}},i("ocr-file-uploader",{batch:false,"json-schema":this.convertSchemaToOcrFormat(this.parsedSchema),callback:e=>{this.processJsonForm(e)},theme:JSON.stringify(n),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 n=this.mapOcrFieldType(e.Type);t.properties.content.properties[r]={anyOf:[{type:n},{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 n=this.isProcessing||this.hasError;const s={stroke:t.backgroundColor||"#3b82f6",fill:t.backgroundColor||"#3b82f6",width:r,height:r,opacity:n?"0.6":"1"};return i("div",{class:"upload-record-container",onClick:n?null:this.triggerAudioRecordUpload,style:{width:r,height:r,cursor:n?"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:s},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 n=((e=this.parsedTheme.buttons)===null||e===void 0?void 0:e.voice)||{};const s=n.size||"50px";const o={background:n.backgroundColor||"#ee4444",width:s,height:s};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,n,s;if(!t.System_Name||!t.Type)return null;const o=t.System_Name;const l=this.mapFieldType(t.Type);const a=((r=t.Settings)===null||r===void 0?void 0:r.Label)||t.System_Name;const c=t.Required||false;const u=(n=t.Settings)===null||n===void 0?void 0:n.Default_Value;const f=e.includes(l)||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"},a,c&&i("span",{class:"required"},"*")),this.renderFormField(o,{type:l,title:a,required:c,options:(s=t.Children)===null||s===void 0?void 0:s.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,n;const s=t.name;t.type=this.mapFieldType(t.type);const o=t.label||s;const l=t.required||false;const a=this.parsedSchema[2][s];return i("div",{class:"form-group",key:s},i("label",{htmlFor:s,class:"form-label"},o,l&&i("span",{class:"required"},"*")),this.renderFormField(s,t,(n=(r=this.filledData)===null||r===void 0?void 0:r[s])!==null&&n!==void 0?n:a))}));case"track":default:return Object.entries(this.parsedSchema.fields).map((([e,t])=>{var r,n;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,(n=(r=this.filledData)===null||r===void 0?void 0:r[e])!==null&&n!==void 0?n:t.value))}))}}renderFormField(e,t,r){var n,s,o,l;const a=this.isReadonlyMode&&!this.filledData;const c={id:e,name:e,class:"form-input",required:t.required,disabled:a};switch(t.type){case"multiselect":if(a){return i("div",{class:"readonly-select"},i("div",{class:"select-placeholder"},"Available options:"),i("ul",{class:"select-options-list"},(n=t.options)===null||n===void 0?void 0:n.map((e=>i("li",{class:"select-option"},e)))))}const u=Array.isArray(r)?r:r?[r]:[];return i("div",{class:"multiselect-container"},(s=t.options)===null||s===void 0?void 0:s.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:a}),i("span",{class:"multiselect-label"},t))})));case"select":if(a){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 --"),(l=t.options)===null||l===void 0?void 0:l.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:"8503450dbd4de2cb91172bd2bdbdf16a0c4cdce0"},i("div",{key:"8b3f553574a64754312f68f2abe0d64f57c56d3e",class:"voice-recorder-container"+(this.debug||this.renderForm?"-debug":""),style:e},i("div",{key:"3d08a37d611bc91dbe11c065c633f0d36c8b362e",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"]}}};Vi.style=Ui;export{Vi as voice_input_module};
|
|
3
|
-
//# sourceMappingURL=p-4e449895.entry.js.map
|