import { f as fallback, e as escape_html } from './async-Mo2Ia14K.js';
import { c as bind_props, f as attr_class, a as attr, e as ensure_array_like, d as attr_style, b as spread_props } from './index-D1Ptw7Az.js';
import { C as c, q as c$1, z as o, Q as s, g, c as G, a as U, m as y, t as e$1 } from './2-B89dC7Mi.js';
import { o as onDestroy, t as tick, c as createEventDispatcher } from './spring-DE8vsW2o.js';
import { i } from './File-BPgKwfYm.js';
import { i as i$1 } from './Microphone-C7JgPGGY.js';
import { t } from './Music-Cx9Jdb4f.js';
import { r } from './Video-DAthbxcF.js';
import { u } from './ScrollFade-xiLIc92r.js';
import { e as ee } from './Upload2-oakrmUYI.js';
import { m as ml } from './MinimalAudioPlayer-DgOOOAbH.js';
export { default as BaseExample } from './Example23-tcbzMCSz.js';
import './index5-BoOEKc6P.js';
import './dev-fallback-Bc5Ork7Y.js';
import 'path';
import 'url';
import 'fs';
import './Video2-BcnuCSWl.js';

function e(o){o.push('<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="19" x2="12" y2="5"></line><polyline points="5 12 12 5 19 12"></polyline></svg>');}

function Y(C){C.push('<svg fill="currentColor" width="100%" height="100%" viewBox="0 0 1920 1920" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"><path d="M1752.768 221.109C1532.646.986 1174.283.986 954.161 221.109l-838.588 838.588c-154.052 154.165-154.052 404.894 0 558.946 149.534 149.421 409.976 149.308 559.059 0l758.738-758.626c87.982-88.094 87.982-231.417 0-319.51-88.32-88.208-231.642-87.982-319.51 0l-638.796 638.908 79.85 79.849 638.795-638.908c43.934-43.821 115.539-43.934 159.812 0 43.934 44.047 43.934 115.877 0 159.812l-758.739 758.625c-110.23 110.118-289.355 110.005-399.36 0-110.118-110.117-110.005-289.242 0-399.247l838.588-838.588c175.963-175.962 462.382-176.188 638.909 0 176.075 176.188 176.075 462.833 0 638.908l-798.607 798.72 79.849 79.85 798.607-798.72c220.01-220.123 220.01-578.485 0-798.607" fill-rule="evenodd"></path></g></svg>');}function At(C,s$1){C.component(e=>{let {label:u,waveform_settings:B={},recording:S=void 0,upload:o,root:G,max_file_size:a=null,upload_promise:I=void 0,onchange:M,onstoprecording:h,onclear:v}=s$1,d=0,A;onDestroy(()=>{clearInterval(A);}),e.push(`<div class="minimal-audio-recorder svelte-doy9oc"${attr("aria-label",u||"Audio Recorder")} data-testid="minimal-audio-recorder">`),(e.push("<!--[!-->"),e.push(`<div class="waveform-wrapper svelte-doy9oc"></div> <div class="timestamp svelte-doy9oc">${escape_html(y(d))}</div> <button class="stop-button svelte-doy9oc" aria-label="Stop recording">`),s(e,{}),e.push("<!----></button>")),e.push("<!--]--></div>"),bind_props(s$1,{recording:S,upload_promise:I});});}function Rt(C,s$1){C.component(e$2=>{let u$1,B,S,o$1=fallback(s$1.value,()=>({text:"",files:[]}),true),G=fallback(s$1.value_is_output,false),a=fallback(s$1.lines,1),I=s$1.i18n,M=fallback(s$1.placeholder,""),h=fallback(s$1.disabled,false),v=s$1.label,d=fallback(s$1.info,void 0),A=fallback(s$1.show_label,true),m=s$1.max_lines,f=fallback(s$1.submit_btn,null),_=fallback(s$1.stop_btn,null),w=fallback(s$1.rtl,false),b=fallback(s$1.autofocus,false),r$1=fallback(s$1.text_align,void 0),p=fallback(s$1.autoscroll,true),g=s$1.root,x=fallback(s$1.file_types_string,null),c$2=fallback(s$1.max_file_size,null),n=s$1.upload,y=s$1.stream_handler,D=fallback(s$1.file_count,"multiple"),tt=fallback(s$1.max_plain_text_length,1e3),N=s$1.waveform_settings,lt=fallback(s$1.waveform_options,()=>({show_recording_waveform:true}),true),O=fallback(s$1.sources_string,"upload"),W=fallback(s$1.active_source,null),k=fallback(s$1.html_attributes,null),P=fallback(s$1.upload_promise,null),at=false,V=fallback(s$1.dragging,false),z=false,Q=o$1?.text??"",F=false,E=null;const q=createEventDispatcher();async function ot(){}async function et(t){if(ot(),Array.isArray(t)){for(let j of t)o$1.files.push(j);o$1=o$1;}else o$1.files.push(t),o$1=o$1;await tick();}u$1=O.split(",").map(t=>t.trim()).filter(t=>t==="upload"||t==="microphone"),B=x?x.split(",").map(t=>t.trim()):null,o$1===null&&(o$1={text:"",files:[]}),S=u$1&&u$1.includes("upload")&&!(D==="single"&&o$1.files.length>0),Q!==o$1.text&&(Q=o$1.text);let U=true,J;function it(t$1){if(t$1.push(`<div${attr_class("full-container svelte-1qn0337",void 0,{dragging:V})} role="group" aria-label="Multimedia input field">`),c(t$1,{show_label:A,info:d,rtl:w,children:i=>{i.push(`<!---->${escape_html(v)}`);},$$slots:{default:true}}),t$1.push('<!----> <div class="input-container svelte-1qn0337">'),u$1&&u$1.includes("microphone")&&W==="microphone"?(t$1.push("<!--[-->"),t$1.push(`<div${attr_class("recording-overlay svelte-1qn0337",void 0,{"has-audio":E!==null})}>`),E?(t$1.push("<!--[!-->"),t$1.push('<div class="recording-content svelte-1qn0337">'),ml(t$1,{value:E,label:v||"Audio",loop:false}),t$1.push('<!----> <div class="action-buttons svelte-1qn0337"><button class="confirm-button svelte-1qn0337" aria-label="Attach audio">'),e$1(t$1),t$1.push('<!----></button> <button class="cancel-button svelte-1qn0337" aria-label="Clear audio">'),o(t$1),t$1.push("<!----></button></div></div>")):(t$1.push("<!--[-->"),t$1.push('<div class="recording-content svelte-1qn0337">'),At(t$1,{label:v||"Audio",waveform_settings:N,recording:F,upload:n,root:g,max_file_size:c$2,onchange:i=>{E=i;},onstoprecording:()=>{F=false;},onclear:()=>{W=null,F=false,E=null;},get upload_promise(){return P},set upload_promise(i){P=i,U=false;}}),t$1.push("<!----></div>")),t$1.push("<!--]--></div>")):t$1.push("<!--[!-->"),t$1.push("<!--]--> "),S?(t$1.push("<!--[-->"),ee(t$1,{onload:et,file_count:D,filetype:B,root:g,max_file_size:c$2,show_progress:false,disable_click:true,onerror:i=>q("error",i),hidden:true,upload:n,stream_handler:y,get upload_promise(){return P},set upload_promise(i){P=i,U=false;},get dragging(){return V},set dragging(i){V=i,U=false;},get uploading(){return z},set uploading(i){z=i,U=false;}})):t$1.push("<!--[!-->"),t$1.push(`<!--]--> <div${attr_class("input-wrapper svelte-1qn0337",void 0,{"has-files":o$1.files.length>0||z})}>`),o$1.files.length>0||z){t$1.push("<!--[-->"),t$1.push('<div class="thumbnails svelte-1qn0337" aria-label="Uploaded files" data-testid="container_el">'),S?(t$1.push("<!--[-->"),t$1.push(`<button data-testid="upload-button" class="upload-button thumbnail-add svelte-1qn0337"${attr("disabled",h,true)} aria-label="Upload a file">`),Y(t$1),t$1.push("<!----></button>")):t$1.push("<!--[!-->"),t$1.push("<!--]--> <!--[-->");const i$1=ensure_array_like(o$1.files);for(let K=0,ut=i$1.length;K<ut;K++){let R=i$1[K];t$1.push('<span class="thumbnail-wrapper svelte-1qn0337" role="listitem" aria-label="File thumbnail"><div class="thumbnail-item thumbnail-small svelte-1qn0337">'),R.mime_type&&R.mime_type.includes("image")?(t$1.push("<!--[-->"),c$1(t$1,{src:R.url,restProps:{title:null,alt:"",loading:"lazy",class:"thumbnail-image"}})):(t$1.push("<!--[!-->"),R.mime_type&&R.mime_type.includes("audio")?(t$1.push("<!--[-->"),t(t$1)):(t$1.push("<!--[!-->"),R.mime_type&&R.mime_type.includes("video")?(t$1.push("<!--[-->"),r(t$1)):(t$1.push("<!--[!-->"),i(t$1)),t$1.push("<!--]-->")),t$1.push("<!--]-->")),t$1.push('<!--]--> <button class="delete-button svelte-1qn0337" aria-label="Remove file">'),o(t$1),t$1.push("<!----></button></div></span>");}t$1.push("<!--]--> "),z?(t$1.push("<!--[-->"),t$1.push('<div class="loader svelte-1qn0337" role="status" aria-label="Uploading"></div>')):t$1.push("<!--[!-->"),t$1.push("<!--]--></div>");}else t$1.push("<!--[!-->");t$1.push('<!--]--> <div class="input-row svelte-1qn0337">'),S&&o$1.files.length===0&&!z?(t$1.push("<!--[-->"),t$1.push(`<button data-testid="upload-button" class="upload-button icon-button svelte-1qn0337"${attr("disabled",h,true)} aria-label="Upload a file">`),Y(t$1),t$1.push("<!----></button>")):t$1.push("<!--[!-->"),t$1.push(`<!--]--> <div class="textarea-wrapper svelte-1qn0337"><textarea data-testid="textbox"${attr("dir",w?"rtl":"ltr")}${attr("placeholder",M)}${attr("rows",a)}${attr("disabled",h,true)}${attr_style(r$1?"text-align: "+r$1:"")}${attr("autocapitalize",k?.autocapitalize)}${attr("autocorrect",k?.autocorrect)}${attr("spellcheck",k?.spellcheck)}${attr("autocomplete",k?.autocomplete)}${attr("tabindex",k?.tabindex)}${attr("enterkeyhint",k?.enterkeyhint)}${attr("lang",k?.lang)}${attr_class("svelte-1qn0337",void 0,{"no-label":!A})}>`);const j=escape_html(o$1.text);j&&t$1.push(`${j}`),t$1.push("</textarea> "),u(t$1,{visible:at,position:"absolute"}),t$1.push("<!----></div> "),u$1&&u$1.includes("microphone")?(t$1.push("<!--[-->"),t$1.push(`<button data-testid="microphone-button"${attr_class("microphone-button svelte-1qn0337",void 0,{recording:F})}${attr("disabled",h,true)} aria-label="Record audio">`),i$1(t$1),t$1.push("<!----></button>")):t$1.push("<!--[!-->"),t$1.push("<!--]--> "),f?(t$1.push("<!--[-->"),t$1.push(`<button${attr_class("submit-button svelte-1qn0337",void 0,{"padded-button":f!==true})} data-testid="submit-button"${attr("disabled",h,true)} aria-label="Submit">`),f===true?(t$1.push("<!--[-->"),e(t$1)):(t$1.push("<!--[!-->"),t$1.push(`${escape_html(f)}`)),t$1.push("<!--]--></button>")):t$1.push("<!--[!-->"),t$1.push("<!--]--> "),_?(t$1.push("<!--[-->"),t$1.push(`<button${attr_class("stop-button svelte-1qn0337",void 0,{"padded-button":_!==true})} aria-label="Stop">`),_===true?(t$1.push("<!--[-->"),s(t$1,{fill:"none",stroke_width:2.5})):(t$1.push("<!--[!-->"),t$1.push(`${escape_html(_)}`)),t$1.push("<!--]--></button>")):t$1.push("<!--[!-->"),t$1.push("<!--]--></div></div></div></div>");}do U=true,J=e$2.copy(),it(J);while(!U);e$2.subsume(J),bind_props(s$1,{value:o$1,value_is_output:G,lines:a,i18n:I,placeholder:M,disabled:h,label:v,info:d,show_label:A,max_lines:m,submit_btn:f,stop_btn:_,rtl:w,autofocus:b,text_align:r$1,autoscroll:p,root:g,file_types_string:x,max_file_size:c$2,upload:n,stream_handler:y,file_count:D,max_plain_text_length:tt,waveform_settings:N,waveform_options:lt,sources_string:O,active_source:W,html_attributes:k,upload_promise:P,dragging:V});});}function el(C,s$1){C.component(e=>{let u;class B extends g{async get_data(){return u&&(await u,await tick()),await super.get_data()}}let{$$slots:S,$$events:o,...G$1}=s$1;const a=new B(G$1),I=a.props.value||{text:"",files:[]};let M=false,h=null;const d={height:50,barWidth:2,barGap:3,cursorWidth:2,cursorColor:"#ddd5e9",autoplay:false,barRadius:10,dragToSeek:true,normalize:true,minPxPerSec:20,waveColor:"",progressColor:"",mediaControls:false,sampleRate:44100};({color:a.props?.waveform_options?.trim_region_color});const f=(...c)=>a.shared.client.upload(...c),_=c=>a.i18n(c),w=(...c)=>a.shared.client.stream(...c);let b=a.props.sources.join(","),r=(a.props.file_types||[]).join(",")||null,p=true,g$1;function x(c){G(c,{visible:a.shared.visible,elem_id:a.shared.elem_id,elem_classes:[...a.shared.elem_classes||[],"multimodal-textbox"],scale:a.shared.scale,min_width:a.shared.min_width,allow_overflow:false,padding:false,border_mode:M?"focus":"base",rtl:a.props.rtl,children:n=>{a.shared.loading_status?(n.push("<!--[-->"),U(n,spread_props([{autoscroll:a.shared.autoscroll,i18n:a.i18n},a.shared.loading_status,{on_clear_status:()=>a.dispatch("clear_status",a.shared.loading_status)}]))):n.push("<!--[!-->"),n.push("<!--]--> "),Rt(n,{value:I,value_is_output:true,file_types_string:r,root:a.shared.root,label:a.shared.label||"MultimodalTextbox",info:a.props.info,show_label:a.shared.show_label,lines:a.props.lines,rtl:a.props.rtl,text_align:a.props.text_align,waveform_settings:d,i18n:_,max_lines:a.props.max_lines?a.props.max_lines:a.props.lines+1,placeholder:a.props.placeholder,submit_btn:a.props.submit_btn,stop_btn:a.props.stop_btn,autofocus:a.props.autofocus,autoscroll:a.shared.autoscroll,file_count:a.props.file_count,sources_string:b,max_file_size:a.shared.max_file_size,disabled:!a.shared.interactive,upload:f,stream_handler:w,max_plain_text_length:a.props.max_plain_text_length,html_attributes:a.props.html_attributes,get upload_promise(){return u},set upload_promise(y){u=y,p=false;},get dragging(){return M},set dragging(y){M=y,p=false;},get active_source(){return h},set active_source(y){h=y,p=false;}}),n.push("<!---->");},$$slots:{default:true}});}do p=true,g$1=e.copy(),x(g$1);while(!p);e.subsume(g$1);});}

export { Rt as BaseMultimodalTextbox, el as default };
//# sourceMappingURL=Index59-DMZvSVOM.js.map
