mirror of
https://github.com/Ladebeze66/projetcbaollm.git
synced 2025-12-18 21:37:51 +01:00
3 lines
32 KiB
JavaScript
3 lines
32 KiB
JavaScript
import"./IconButtonWrapper.svelte_svelte_type_style_lang-BOpxTcdu.js";import{B as zt}from"./BlockTitle-BIcnzvtg.js";import"./MarkdownCode.svelte_svelte_type_style_lang-3tofWDHK.js";import{C as Mt}from"./Clear-By3xiIwg.js";import{F as Tt}from"./File-BQ_9P3Ye.js";import{M as Dt}from"./SelectSource-B90qmKix.js";import{M as Bt}from"./Music-CDm0RGMk.js";import{S as Et}from"./Send-DyoOovnk.js";import{S as Ht}from"./Square-oAGqOwsh.js";import{V as Ft}from"./Video-fsmLZWjA.js";import{U as qt}from"./Upload-DeO6qHmq.js";/* empty css */import{I as Rt}from"./Image-CsmDAdIf.js";/* empty css */import{I as Vt}from"./InteractiveAudio-BkFfk1o9.js";import{B as At}from"./Block-DZqtZLFP.js";import{S as Pt}from"./index-B1gfMDT9.js";import"./StreamingBar.svelte_svelte_type_style_lang-CDNxkBIr.js";import{default as zi}from"./Example-D9euSj1o.js";import"./Info-DcCn6tHi.js";import"./MarkdownCode-DJM7o_VY.js";import"./prism-python-qapVsvY8.js";import"./index-C7PS0jJm.js";import"./svelte/svelte.js";import"./Upload-DXgDHKDd.js";/* empty css */import"./file-url-DgijyRSD.js";import"./context-TgWPFwN2.js";import"./ModifyUpload-CMNONuNr.js";import"./IconButton-B-aAVSzy.js";import"./Download-DVtk-Jv3.js";import"./Edit-BpRIf5rU.js";import"./Undo-DCjBnnSO.js";import"./IconButtonWrapper-Cg16aIPK.js";import"./DownloadLink-IzUam-rM.js";import"./BlockLabel-DqHge3FF.js";import"./StreamingBar-BU9S4hA7.js";import"./AudioPlayer-k2pQKAn1.js";import"./utils-BsGrhMNe.js";import"./Trim-JQYgj7Jd.js";import"./Play-B0Q0U1Qz.js";import"./Empty-CxRQfWXb.js";import"./hls-CnVhpNcu.js";import"./Video-DiLYgEjl.js";const{SvelteComponent:Ut,append:ke,attr:N,detach:It,init:jt,insert:Gt,noop:Ie,safe_not_equal:Lt,svg_element:he}=window.__gradio__svelte__internal;function Wt(l){let e,t,i,o,s;return{c(){e=he("svg"),t=he("g"),i=he("g"),o=he("g"),s=he("path"),N(t,"id","SVGRepo_bgCarrier"),N(t,"stroke-width","0"),N(i,"id","SVGRepo_tracerCarrier"),N(i,"stroke-linecap","round"),N(i,"stroke-linejoin","round"),N(s,"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"),N(s,"fill-rule","evenodd"),N(o,"id","SVGRepo_iconCarrier"),N(e,"fill","currentColor"),N(e,"width","100%"),N(e,"height","100%"),N(e,"viewBox","0 0 1920 1920"),N(e,"xmlns","http://www.w3.org/2000/svg")},m(g,_){Gt(g,e,_),ke(e,t),ke(e,i),ke(e,o),ke(o,s)},p:Ie,i:Ie,o:Ie,d(g){g&&It(e)}}}class Kt extends Ut{constructor(e){super(),jt(this,e,null,Wt,Lt,{})}}const{tick:Yt}=window.__gradio__svelte__internal;async function Le(l,e,t){if(await Yt(),e===t)return;const i=window.getComputedStyle(l),o=parseFloat(i.paddingTop),s=parseFloat(i.paddingBottom),g=parseFloat(i.lineHeight);let _=t===void 0?!1:o+s+g*t,r=o+s+e*g;l.style.height="1px";let b;_&&l.scrollHeight>_?b=_:l.scrollHeight<r?b=r:b=l.scrollHeight,l.style.height=`${b}px`}function Nt(l,e){if(e.lines===e.max_lines)return;l.style.overflowY="scroll";function t(i){Le(i.target,e.lines,e.max_lines)}if(l.addEventListener("input",t),!!e.text.trim())return Le(l,e.lines,e.max_lines),{destroy:()=>l.removeEventListener("input",t)}}const{SvelteComponent:Xt,action_destroyer:Jt,add_flush_callback:je,append:X,attr:S,bind:Ge,binding_callbacks:ce,bubble:ve,check_outros:ne,create_component:O,destroy_component:Q,destroy_each:Ot,detach:Z,element:J,ensure_array_like:Je,flush:z,group_outros:se,init:Qt,insert:y,is_function:Zt,listen:W,mount_component:x,noop:oe,prevent_default:yt,run_all:xt,safe_not_equal:$t,set_data:We,set_input_value:Oe,set_style:Qe,space:ie,text:Ke,toggle_class:ee,transition_in:k,transition_out:C}=window.__gradio__svelte__internal,{onMount:el,beforeUpdate:tl,afterUpdate:ll,createEventDispatcher:il,tick:Ze}=window.__gradio__svelte__internal;function ye(l,e,t){const i=l.slice();return i[71]=e[t],i[73]=t,i}function nl(l){let e;return{c(){e=Ke(l[7])},m(t,i){y(t,e,i)},p(t,i){i[0]&128&&We(e,t[7])},d(t){t&&Z(e)}}}function xe(l){let e,t,i,o=Je(l[0].files),s=[];for(let r=0;r<o.length;r+=1)s[r]=$e(ye(l,o,r));const g=r=>C(s[r],1,1,()=>{s[r]=null});let _=l[28]&&et();return{c(){e=J("div");for(let r=0;r<s.length;r+=1)s[r].c();t=ie(),_&&_.c(),S(e,"class","thumbnails scroll-hide svelte-d47mdf"),S(e,"aria-label","Uploaded files"),S(e,"data-testid","container_el"),Qe(e,"display",l[0].files.length>0||l[28]?"flex":"none")},m(r,b){y(r,e,b);for(let f=0;f<s.length;f+=1)s[f]&&s[f].m(e,null);X(e,t),_&&_.m(e,null),i=!0},p(r,b){if(b[0]&65|b[1]&32){o=Je(r[0].files);let f;for(f=0;f<o.length;f+=1){const v=ye(r,o,f);s[f]?(s[f].p(v,b),k(s[f],1)):(s[f]=$e(v),s[f].c(),k(s[f],1),s[f].m(e,t))}for(se(),f=o.length;f<s.length;f+=1)g(f);ne()}r[28]?_||(_=et(),_.c(),_.m(e,null)):_&&(_.d(1),_=null),(!i||b[0]&268435457)&&Qe(e,"display",r[0].files.length>0||r[28]?"flex":"none")},i(r){if(!i){for(let b=0;b<o.length;b+=1)k(s[b]);i=!0}},o(r){s=s.filter(Boolean);for(let b=0;b<s.length;b+=1)C(s[b]);i=!1},d(r){r&&Z(e),Ot(s,r),_&&_.d()}}}function sl(l){let e,t;return e=new Tt({}),{c(){O(e.$$.fragment)},m(i,o){x(e,i,o),t=!0},p:oe,i(i){t||(k(e.$$.fragment,i),t=!0)},o(i){C(e.$$.fragment,i),t=!1},d(i){Q(e,i)}}}function ol(l){let e,t;return e=new Ft({}),{c(){O(e.$$.fragment)},m(i,o){x(e,i,o),t=!0},p:oe,i(i){t||(k(e.$$.fragment,i),t=!0)},o(i){C(e.$$.fragment,i),t=!1},d(i){Q(e,i)}}}function rl(l){let e,t;return e=new Bt({}),{c(){O(e.$$.fragment)},m(i,o){x(e,i,o),t=!0},p:oe,i(i){t||(k(e.$$.fragment,i),t=!0)},o(i){C(e.$$.fragment,i),t=!1},d(i){Q(e,i)}}}function ul(l){let e,t;return e=new Rt({props:{src:l[71].url,title:null,alt:"",loading:"lazy",class:"thumbnail-image"}}),{c(){O(e.$$.fragment)},m(i,o){x(e,i,o),t=!0},p(i,o){const s={};o[0]&1&&(s.src=i[71].url),e.$set(s)},i(i){t||(k(e.$$.fragment,i),t=!0)},o(i){C(e.$$.fragment,i),t=!1},d(i){Q(e,i)}}}function $e(l){let e,t,i,o,s,g,_,r,b,f,v,h,V;o=new Mt({});function c(...p){return l[51](l[73],...p)}const u=[ul,rl,ol,sl],m=[];function R(p,A){return A[0]&1&&(g=null),A[0]&1&&(_=null),A[0]&1&&(r=null),g==null&&(g=!!(p[71].mime_type&&p[71].mime_type.includes("image"))),g?0:(_==null&&(_=!!(p[71].mime_type&&p[71].mime_type.includes("audio"))),_?1:(r==null&&(r=!!(p[71].mime_type&&p[71].mime_type.includes("video"))),r?2:3))}return b=R(l,[-1,-1,-1]),f=m[b]=u[b](l),{c(){e=J("span"),t=J("button"),i=J("button"),O(o.$$.fragment),s=ie(),f.c(),S(i,"class","delete-button svelte-d47mdf"),ee(i,"disabled",l[6]),S(t,"class","thumbnail-item thumbnail-small svelte-d47mdf"),S(e,"role","listitem"),S(e,"aria-label","File thumbnail")},m(p,A){y(p,e,A),X(e,t),X(t,i),x(o,i,null),X(t,s),m[b].m(t,null),v=!0,h||(V=W(i,"click",c),h=!0)},p(p,A){l=p,(!v||A[0]&64)&&ee(i,"disabled",l[6]);let U=b;b=R(l,A),b===U?m[b].p(l,A):(se(),C(m[U],1,1,()=>{m[U]=null}),ne(),f=m[b],f?f.p(l,A):(f=m[b]=u[b](l),f.c()),k(f,1),f.m(t,null))},i(p){v||(k(o.$$.fragment,p),k(f),v=!0)},o(p){C(o.$$.fragment,p),C(f),v=!1},d(p){p&&Z(e),Q(o),m[b].d(),h=!1,V()}}}function et(l){let e;return{c(){e=J("div"),S(e,"class","loader svelte-d47mdf"),S(e,"role","status"),S(e,"aria-label","Uploading")},m(t,i){y(t,e,i)},d(t){t&&Z(e)}}}function tt(l){let e,t;return e=new Vt({props:{sources:["microphone"],class_name:"compact-audio",recording:rt,waveform_settings:l[22],waveform_options:l[23],i18n:l[4],active_source:l[2],upload:l[19],stream_handler:l[20],stream_every:1,editable:!0,label:l[7],root:l[16],loop:!1,show_label:!1,show_download_button:!1,dragging:!1}}),e.$on("change",l[52]),e.$on("clear",l[53]),e.$on("start_recording",l[54]),e.$on("pause_recording",l[55]),e.$on("stop_recording",l[56]),{c(){O(e.$$.fragment)},m(i,o){x(e,i,o),t=!0},p(i,o){const s={};o[0]&4194304&&(s.waveform_settings=i[22]),o[0]&8388608&&(s.waveform_options=i[23]),o[0]&16&&(s.i18n=i[4]),o[0]&4&&(s.active_source=i[2]),o[0]&524288&&(s.upload=i[19]),o[0]&1048576&&(s.stream_handler=i[20]),o[0]&128&&(s.label=i[7]),o[0]&65536&&(s.root=i[16]),e.$set(s)},i(i){t||(k(e.$$.fragment,i),t=!0)},o(i){C(e.$$.fragment,i),t=!1},d(i){Q(e,i)}}}function lt(l){let e,t,i,o,s,g,_,r,b,f;function v(u){l[58](u)}function h(u){l[59](u)}function V(u){l[60](u)}let c={file_count:l[21],filetype:l[17],root:l[16],max_file_size:l[18],show_progress:!1,disable_click:!0,hidden:!0,upload:l[19],stream_handler:l[20]};return l[1]!==void 0&&(c.dragging=l[1]),l[28]!==void 0&&(c.uploading=l[28]),l[27]!==void 0&&(c.hidden_upload=l[27]),e=new qt({props:c}),l[57](e),ce.push(()=>Ge(e,"dragging",v)),ce.push(()=>Ge(e,"uploading",h)),ce.push(()=>Ge(e,"hidden_upload",V)),e.$on("load",l[35]),e.$on("error",l[61]),_=new Kt({}),{c(){O(e.$$.fragment),s=ie(),g=J("button"),O(_.$$.fragment),S(g,"data-testid","upload-button"),S(g,"class","upload-button svelte-d47mdf")},m(u,m){x(e,u,m),y(u,s,m),y(u,g,m),x(_,g,null),r=!0,b||(f=W(g,"click",l[37]),b=!0)},p(u,m){const R={};m[0]&2097152&&(R.file_count=u[21]),m[0]&131072&&(R.filetype=u[17]),m[0]&65536&&(R.root=u[16]),m[0]&262144&&(R.max_file_size=u[18]),m[0]&524288&&(R.upload=u[19]),m[0]&1048576&&(R.stream_handler=u[20]),!t&&m[0]&2&&(t=!0,R.dragging=u[1],je(()=>t=!1)),!i&&m[0]&268435456&&(i=!0,R.uploading=u[28],je(()=>i=!1)),!o&&m[0]&134217728&&(o=!0,R.hidden_upload=u[27],je(()=>o=!1)),e.$set(R)},i(u){r||(k(e.$$.fragment,u),k(_.$$.fragment,u),r=!0)},o(u){C(e.$$.fragment,u),C(_.$$.fragment,u),r=!1},d(u){u&&(Z(s),Z(g)),l[57](null),Q(e,u),Q(_),b=!1,f()}}}function it(l){let e,t,i,o,s;return t=new Dt({}),{c(){e=J("button"),O(t.$$.fragment),S(e,"data-testid","microphone-button"),S(e,"class","microphone-button svelte-d47mdf"),ee(e,"recording",rt)},m(g,_){y(g,e,_),x(t,e,null),i=!0,o||(s=W(e,"click",l[62]),o=!0)},p:oe,i(g){i||(k(t.$$.fragment,g),i=!0)},o(g){C(t.$$.fragment,g),i=!1},d(g){g&&Z(e),Q(t),o=!1,s()}}}function nt(l){let e,t,i,o,s,g;const _=[fl,al],r=[];function b(f,v){return f[11]===!0?0:1}return t=b(l),i=r[t]=_[t](l),{c(){e=J("button"),i.c(),S(e,"class","submit-button svelte-d47mdf"),ee(e,"padded-button",l[11]!==!0)},m(f,v){y(f,e,v),r[t].m(e,null),o=!0,s||(g=W(e,"click",l[39]),s=!0)},p(f,v){let h=t;t=b(f),t===h?r[t].p(f,v):(se(),C(r[h],1,1,()=>{r[h]=null}),ne(),i=r[t],i?i.p(f,v):(i=r[t]=_[t](f),i.c()),k(i,1),i.m(e,null)),(!o||v[0]&2048)&&ee(e,"padded-button",f[11]!==!0)},i(f){o||(k(i),o=!0)},o(f){C(i),o=!1},d(f){f&&Z(e),r[t].d(),s=!1,g()}}}function al(l){let e;return{c(){e=Ke(l[11])},m(t,i){y(t,e,i)},p(t,i){i[0]&2048&&We(e,t[11])},i:oe,o:oe,d(t){t&&Z(e)}}}function fl(l){let e,t;return e=new Et({}),{c(){O(e.$$.fragment)},m(i,o){x(e,i,o),t=!0},p:oe,i(i){t||(k(e.$$.fragment,i),t=!0)},o(i){C(e.$$.fragment,i),t=!1},d(i){Q(e,i)}}}function st(l){let e,t,i,o,s,g;const _=[cl,_l],r=[];function b(f,v){return f[12]===!0?0:1}return t=b(l),i=r[t]=_[t](l),{c(){e=J("button"),i.c(),S(e,"class","stop-button svelte-d47mdf"),ee(e,"padded-button",l[12]!==!0)},m(f,v){y(f,e,v),r[t].m(e,null),o=!0,s||(g=W(e,"click",l[38]),s=!0)},p(f,v){let h=t;t=b(f),t===h?r[t].p(f,v):(se(),C(r[h],1,1,()=>{r[h]=null}),ne(),i=r[t],i?i.p(f,v):(i=r[t]=_[t](f),i.c()),k(i,1),i.m(e,null)),(!o||v[0]&4096)&&ee(e,"padded-button",f[12]!==!0)},i(f){o||(k(i),o=!0)},o(f){C(i),o=!1},d(f){f&&Z(e),r[t].d(),s=!1,g()}}}function _l(l){let e;return{c(){e=Ke(l[12])},m(t,i){y(t,e,i)},p(t,i){i[0]&4096&&We(e,t[12])},i:oe,o:oe,d(t){t&&Z(e)}}}function cl(l){let e,t;return e=new Ht({props:{fill:"none",stroke_width:2.5}}),{c(){O(e.$$.fragment)},m(i,o){x(e,i,o),t=!0},p:oe,i(i){t||(k(e.$$.fragment,i),t=!0)},o(i){C(e.$$.fragment,i),t=!1},d(i){Q(e,i)}}}function ml(l){let e,t,i,o,s=l[24]&&l[24].includes("microphone")&&l[2]==="microphone",g,_,r=l[24]&&l[24].includes("upload")&&!l[6]&&!(l[21]==="single"&&l[0].files.length>0),b,f=l[24]&&l[24].includes("microphone"),v,h,V,c,u,m,R,p,A,U;t=new zt({props:{root:l[16],show_label:l[9],info:l[8],$$slots:{default:[nl]},$$scope:{ctx:l}}});let B=(l[0].files.length>0||l[28])&&xe(l),E=s&&tt(l),H=r&<(l),F=f&&it(l),T=l[11]&&nt(l),q=l[12]&&st(l);return{c(){e=J("div"),O(t.$$.fragment),i=ie(),B&&B.c(),o=ie(),E&&E.c(),g=ie(),_=J("div"),H&&H.c(),b=ie(),F&&F.c(),v=ie(),h=J("textarea"),m=ie(),T&&T.c(),R=ie(),q&&q.c(),S(h,"data-testid","textbox"),S(h,"class","scroll-hide svelte-d47mdf"),S(h,"dir",V=l[13]?"rtl":"ltr"),S(h,"placeholder",l[5]),S(h,"rows",l[3]),h.disabled=l[6],h.autofocus=l[14],S(h,"style",c=l[15]?"text-align: "+l[15]:""),ee(h,"no-label",!l[9]),S(_,"class","input-container svelte-d47mdf"),S(e,"class","full-container svelte-d47mdf"),S(e,"role","group"),S(e,"aria-label","Multimedia input field"),ee(e,"dragging",l[1])},m(d,w){y(d,e,w),x(t,e,null),X(e,i),B&&B.m(e,null),X(e,o),E&&E.m(e,null),X(e,g),X(e,_),H&&H.m(_,null),X(_,b),F&&F.m(_,null),X(_,v),X(_,h),Oe(h,l[0].text),l[64](h),X(_,m),T&&T.m(_,null),X(_,R),q&&q.m(_,null),l[65](e),p=!0,l[14]&&h.focus(),A||(U=[Jt(u=Nt.call(null,h,{text:l[0].text,lines:l[3],max_lines:l[10]})),W(h,"input",l[63]),W(h,"keypress",l[33]),W(h,"blur",l[49]),W(h,"select",l[32]),W(h,"focus",l[50]),W(h,"scroll",l[34]),W(h,"paste",l[40]),W(e,"dragenter",l[41]),W(e,"dragleave",l[42]),W(e,"dragover",yt(l[48])),W(e,"drop",l[43])],A=!0)},p(d,w){const j={};w[0]&65536&&(j.root=d[16]),w[0]&512&&(j.show_label=d[9]),w[0]&256&&(j.info=d[8]),w[0]&128|w[2]&4096&&(j.$$scope={dirty:w,ctx:d}),t.$set(j),d[0].files.length>0||d[28]?B?(B.p(d,w),w[0]&268435457&&k(B,1)):(B=xe(d),B.c(),k(B,1),B.m(e,o)):B&&(se(),C(B,1,1,()=>{B=null}),ne()),w[0]&16777220&&(s=d[24]&&d[24].includes("microphone")&&d[2]==="microphone"),s?E?(E.p(d,w),w[0]&16777220&&k(E,1)):(E=tt(d),E.c(),k(E,1),E.m(e,g)):E&&(se(),C(E,1,1,()=>{E=null}),ne()),w[0]&18874433&&(r=d[24]&&d[24].includes("upload")&&!d[6]&&!(d[21]==="single"&&d[0].files.length>0)),r?H?(H.p(d,w),w[0]&18874433&&k(H,1)):(H=lt(d),H.c(),k(H,1),H.m(_,b)):H&&(se(),C(H,1,1,()=>{H=null}),ne()),w[0]&16777216&&(f=d[24]&&d[24].includes("microphone")),f?F?(F.p(d,w),w[0]&16777216&&k(F,1)):(F=it(d),F.c(),k(F,1),F.m(_,v)):F&&(se(),C(F,1,1,()=>{F=null}),ne()),(!p||w[0]&8192&&V!==(V=d[13]?"rtl":"ltr"))&&S(h,"dir",V),(!p||w[0]&32)&&S(h,"placeholder",d[5]),(!p||w[0]&8)&&S(h,"rows",d[3]),(!p||w[0]&64)&&(h.disabled=d[6]),(!p||w[0]&16384)&&(h.autofocus=d[14]),(!p||w[0]&32768&&c!==(c=d[15]?"text-align: "+d[15]:""))&&S(h,"style",c),u&&Zt(u.update)&&w[0]&1033&&u.update.call(null,{text:d[0].text,lines:d[3],max_lines:d[10]}),w[0]&1&&Oe(h,d[0].text),(!p||w[0]&512)&&ee(h,"no-label",!d[9]),d[11]?T?(T.p(d,w),w[0]&2048&&k(T,1)):(T=nt(d),T.c(),k(T,1),T.m(_,R)):T&&(se(),C(T,1,1,()=>{T=null}),ne()),d[12]?q?(q.p(d,w),w[0]&4096&&k(q,1)):(q=st(d),q.c(),k(q,1),q.m(_,null)):q&&(se(),C(q,1,1,()=>{q=null}),ne()),(!p||w[0]&2)&&ee(e,"dragging",d[1])},i(d){p||(k(t.$$.fragment,d),k(B),k(E),k(H),k(F),k(T),k(q),p=!0)},o(d){C(t.$$.fragment,d),C(B),C(E),C(H),C(F),C(T),C(q),p=!1},d(d){d&&Z(e),Q(t),B&&B.d(),E&&E.d(),H&&H.d(),F&&F.d(),l[64](null),T&&T.d(),q&&q.d(),l[65](null),A=!1,xt(U)}}}let rt=!1;function dl(l,e,t){let{value:i={text:"",files:[]}}=e,{value_is_output:o=!1}=e,{lines:s=1}=e,{i18n:g}=e,{placeholder:_="Type here..."}=e,{disabled:r=!1}=e,{label:b}=e,{info:f=void 0}=e,{show_label:v=!0}=e,{max_lines:h}=e,{submit_btn:V=null}=e,{stop_btn:c=null}=e,{rtl:u=!1}=e,{autofocus:m=!1}=e,{text_align:R=void 0}=e,{autoscroll:p=!0}=e,{root:A}=e,{file_types:U=null}=e,{max_file_size:B=null}=e,{upload:E}=e,{stream_handler:H}=e,{file_count:F="multiple"}=e,{max_plain_text_length:T=1e3}=e,{waveform_settings:q}=e,{waveform_options:d={show_recording_waveform:!0}}=e,{sources:w=["upload"]}=e,{active_source:j=null}=e,G,$,I,K,ue=0,me=!1,{dragging:te=!1}=e,de=!1,ge=i.text,le=null,ae;const P=il();tl(()=>{K=I&&I.offsetHeight+I.scrollTop>I.scrollHeight-100});const Me=()=>{K&&p&&!me&&I.scrollTo(0,I.scrollHeight)};async function pe(){P("change",i),o||P("input")}el(()=>{m&&I!==null&&I.focus()}),ll(()=>{K&&p&&Me(),t(44,o=!1)});function Te(n){const D=n.target,L=D.value,Y=[D.selectionStart,D.selectionEnd];P("select",{value:L.substring(...Y),index:Y})}async function De(n){await Ze(),n.key==="Enter"&&n.shiftKey&&s>1?(n.preventDefault(),P("submit")):n.key==="Enter"&&!n.shiftKey&&s===1&&h>=1&&(n.preventDefault(),P("submit"),t(2,j=null),le&&(i.files.push(le),t(0,i),t(29,le=null)))}function Be(n){const D=n.target,L=D.scrollTop;L<ue&&(me=!0),ue=L;const Y=D.scrollHeight-D.clientHeight;L>=Y&&(me=!1)}async function Ee({detail:n}){if(pe(),Array.isArray(n)){for(let D of n)i.files.push(D);t(0,i)}else i.files.push(n),t(0,i);await Ze(),P("change",i),P("upload",n)}function we(n,D){pe(),n.stopPropagation(),i.files.splice(D,1),t(0,i)}function He(){$&&(t(27,$.value="",$),$.click())}function Fe(){P("stop")}function qe(){P("submit"),t(2,j=null),le&&(i.files.push(le),t(0,i),t(29,le=null))}async function Re(n){if(!n.clipboardData)return;const D=n.clipboardData.items,L=n.clipboardData.getData("text");if(L&&L.length>T){n.preventDefault();const Y=new window.File([L],"pasted_text.txt",{type:"text/plain",lastModified:Date.now()});G&&G.load_files([Y]);return}for(let Y in D){const re=D[Y];if(re.kind==="file"&&re.type.includes("image")){const fe=re.getAsFile();fe&&G.load_files([fe])}}}function Ve(n){n.preventDefault(),t(1,te=!0)}function Ae(n){n.preventDefault();const D=ae.getBoundingClientRect(),{clientX:L,clientY:Y}=n;(L<=D.left||L>=D.right||Y<=D.top||Y>=D.bottom)&&t(1,te=!1)}function Pe(n){if(n.preventDefault(),t(1,te=!1),n.dataTransfer&&n.dataTransfer.files){const D=Array.from(n.dataTransfer.files);if(U){const L=D.filter(re=>U.some(fe=>fe.startsWith(".")?re.name.toLowerCase().endsWith(fe.toLowerCase()):re.type.match(new RegExp(fe.replace("*",".*"))))),Y=D.length-L.length;Y>0&&P("error",`${Y} file(s) were rejected. Accepted formats: ${U.join(", ")}`),L.length>0&&G.load_files(L)}else G.load_files(D)}}function Ue(n){ve.call(this,l,n)}function a(n){ve.call(this,l,n)}function ut(n){ve.call(this,l,n)}const at=(n,D)=>we(D,n),ft=({detail:n})=>{n!==null&&t(29,le=n)},_t=()=>{t(2,j=null)},ct=()=>P("start_recording"),mt=()=>P("pause_recording"),dt=()=>P("stop_recording");function gt(n){ce[n?"unshift":"push"](()=>{G=n,t(26,G)})}function ht(n){te=n,t(1,te)}function bt(n){de=n,t(28,de)}function pt(n){$=n,t(27,$)}function wt(n){ve.call(this,l,n)}const kt=()=>{t(2,j=j!=="microphone"?"microphone":null)};function vt(){i.text=this.value,t(0,i)}function Ct(n){ce[n?"unshift":"push"](()=>{I=n,t(25,I)})}function St(n){ce[n?"unshift":"push"](()=>{ae=n,t(30,ae)})}return l.$$set=n=>{"value"in n&&t(0,i=n.value),"value_is_output"in n&&t(44,o=n.value_is_output),"lines"in n&&t(3,s=n.lines),"i18n"in n&&t(4,g=n.i18n),"placeholder"in n&&t(5,_=n.placeholder),"disabled"in n&&t(6,r=n.disabled),"label"in n&&t(7,b=n.label),"info"in n&&t(8,f=n.info),"show_label"in n&&t(9,v=n.show_label),"max_lines"in n&&t(10,h=n.max_lines),"submit_btn"in n&&t(11,V=n.submit_btn),"stop_btn"in n&&t(12,c=n.stop_btn),"rtl"in n&&t(13,u=n.rtl),"autofocus"in n&&t(14,m=n.autofocus),"text_align"in n&&t(15,R=n.text_align),"autoscroll"in n&&t(45,p=n.autoscroll),"root"in n&&t(16,A=n.root),"file_types"in n&&t(17,U=n.file_types),"max_file_size"in n&&t(18,B=n.max_file_size),"upload"in n&&t(19,E=n.upload),"stream_handler"in n&&t(20,H=n.stream_handler),"file_count"in n&&t(21,F=n.file_count),"max_plain_text_length"in n&&t(46,T=n.max_plain_text_length),"waveform_settings"in n&&t(22,q=n.waveform_settings),"waveform_options"in n&&t(23,d=n.waveform_options),"sources"in n&&t(24,w=n.sources),"active_source"in n&&t(2,j=n.active_source),"dragging"in n&&t(1,te=n.dragging)},l.$$.update=()=>{l.$$.dirty[0]&2&&P("drag",te),l.$$.dirty[0]&1&&i===null&&t(0,i={text:"",files:[]}),l.$$.dirty[0]&1|l.$$.dirty[1]&65536&&ge!==i.text&&(P("change",i),t(47,ge=i.text)),l.$$.dirty[0]&33555465&&I&&s!==h&&Le(I,s,h)},[i,te,j,s,g,_,r,b,f,v,h,V,c,u,m,R,A,U,B,E,H,F,q,d,w,I,G,$,de,le,ae,P,Te,De,Be,Ee,we,He,Fe,qe,Re,Ve,Ae,Pe,o,p,T,ge,Ue,a,ut,at,ft,_t,ct,mt,dt,gt,ht,bt,pt,wt,kt,vt,Ct,St]}class gl extends Xt{constructor(e){super(),Qt(this,e,dl,ml,$t,{value:0,value_is_output:44,lines:3,i18n:4,placeholder:5,disabled:6,label:7,info:8,show_label:9,max_lines:10,submit_btn:11,stop_btn:12,rtl:13,autofocus:14,text_align:15,autoscroll:45,root:16,file_types:17,max_file_size:18,upload:19,stream_handler:20,file_count:21,max_plain_text_length:46,waveform_settings:22,waveform_options:23,sources:24,active_source:2,dragging:1},null,[-1,-1,-1])}get value(){return this.$$.ctx[0]}set value(e){this.$$set({value:e}),z()}get value_is_output(){return this.$$.ctx[44]}set value_is_output(e){this.$$set({value_is_output:e}),z()}get lines(){return this.$$.ctx[3]}set lines(e){this.$$set({lines:e}),z()}get i18n(){return this.$$.ctx[4]}set i18n(e){this.$$set({i18n:e}),z()}get placeholder(){return this.$$.ctx[5]}set placeholder(e){this.$$set({placeholder:e}),z()}get disabled(){return this.$$.ctx[6]}set disabled(e){this.$$set({disabled:e}),z()}get label(){return this.$$.ctx[7]}set label(e){this.$$set({label:e}),z()}get info(){return this.$$.ctx[8]}set info(e){this.$$set({info:e}),z()}get show_label(){return this.$$.ctx[9]}set show_label(e){this.$$set({show_label:e}),z()}get max_lines(){return this.$$.ctx[10]}set max_lines(e){this.$$set({max_lines:e}),z()}get submit_btn(){return this.$$.ctx[11]}set submit_btn(e){this.$$set({submit_btn:e}),z()}get stop_btn(){return this.$$.ctx[12]}set stop_btn(e){this.$$set({stop_btn:e}),z()}get rtl(){return this.$$.ctx[13]}set rtl(e){this.$$set({rtl:e}),z()}get autofocus(){return this.$$.ctx[14]}set autofocus(e){this.$$set({autofocus:e}),z()}get text_align(){return this.$$.ctx[15]}set text_align(e){this.$$set({text_align:e}),z()}get autoscroll(){return this.$$.ctx[45]}set autoscroll(e){this.$$set({autoscroll:e}),z()}get root(){return this.$$.ctx[16]}set root(e){this.$$set({root:e}),z()}get file_types(){return this.$$.ctx[17]}set file_types(e){this.$$set({file_types:e}),z()}get max_file_size(){return this.$$.ctx[18]}set max_file_size(e){this.$$set({max_file_size:e}),z()}get upload(){return this.$$.ctx[19]}set upload(e){this.$$set({upload:e}),z()}get stream_handler(){return this.$$.ctx[20]}set stream_handler(e){this.$$set({stream_handler:e}),z()}get file_count(){return this.$$.ctx[21]}set file_count(e){this.$$set({file_count:e}),z()}get max_plain_text_length(){return this.$$.ctx[46]}set max_plain_text_length(e){this.$$set({max_plain_text_length:e}),z()}get waveform_settings(){return this.$$.ctx[22]}set waveform_settings(e){this.$$set({waveform_settings:e}),z()}get waveform_options(){return this.$$.ctx[23]}set waveform_options(e){this.$$set({waveform_options:e}),z()}get sources(){return this.$$.ctx[24]}set sources(e){this.$$set({sources:e}),z()}get active_source(){return this.$$.ctx[2]}set active_source(e){this.$$set({active_source:e}),z()}get dragging(){return this.$$.ctx[1]}set dragging(e){this.$$set({dragging:e}),z()}}const hl=gl,{SvelteComponent:bl,add_flush_callback:Ce,assign:pl,bind:Se,binding_callbacks:ze,check_outros:wl,create_component:Ye,destroy_component:Ne,detach:kl,flush:M,get_spread_object:vl,get_spread_update:Cl,group_outros:Sl,init:zl,insert:Ml,mount_component:Xe,safe_not_equal:Tl,space:Dl,transition_in:_e,transition_out:be}=window.__gradio__svelte__internal,{onMount:Bl}=window.__gradio__svelte__internal;function ot(l){let e,t;const i=[{autoscroll:l[2].autoscroll},{i18n:l[2].i18n},l[17]];let o={};for(let s=0;s<i.length;s+=1)o=pl(o,i[s]);return e=new Pt({props:o}),e.$on("clear_status",l[31]),{c(){Ye(e.$$.fragment)},m(s,g){Xe(e,s,g),t=!0},p(s,g){const _=g[0]&131076?Cl(i,[g[0]&4&&{autoscroll:s[2].autoscroll},g[0]&4&&{i18n:s[2].i18n},g[0]&131072&&vl(s[17])]):{};e.$set(_)},i(s){t||(_e(e.$$.fragment,s),t=!0)},o(s){be(e.$$.fragment,s),t=!1},d(s){Ne(e,s)}}}function El(l){let e,t,i,o,s,g,_,r=l[17]&&ot(l);function b(c){l[34](c)}function f(c){l[35](c)}function v(c){l[36](c)}function h(c){l[37](c)}let V={file_types:l[6],root:l[23],label:l[9],info:l[10],show_label:l[11],lines:l[7],rtl:l[18],text_align:l[19],waveform_settings:l[29],i18n:l[2].i18n,max_lines:l[12]?l[12]:l[7]+1,placeholder:l[8],submit_btn:l[15],stop_btn:l[16],autofocus:l[20],autoscroll:l[21],file_count:l[24],sources:l[26],max_file_size:l[2].max_file_size,disabled:!l[22],upload:l[32],stream_handler:l[33],max_plain_text_length:l[25]};return l[0]!==void 0&&(V.value=l[0]),l[1]!==void 0&&(V.value_is_output=l[1]),l[27]!==void 0&&(V.dragging=l[27]),l[28]!==void 0&&(V.active_source=l[28]),t=new hl({props:V}),ze.push(()=>Se(t,"value",b)),ze.push(()=>Se(t,"value_is_output",f)),ze.push(()=>Se(t,"dragging",v)),ze.push(()=>Se(t,"active_source",h)),t.$on("change",l[38]),t.$on("input",l[39]),t.$on("submit",l[40]),t.$on("stop",l[41]),t.$on("blur",l[42]),t.$on("select",l[43]),t.$on("focus",l[44]),t.$on("error",l[45]),t.$on("start_recording",l[46]),t.$on("pause_recording",l[47]),t.$on("stop_recording",l[48]),t.$on("upload",l[49]),t.$on("clear",l[50]),{c(){r&&r.c(),e=Dl(),Ye(t.$$.fragment)},m(c,u){r&&r.m(c,u),Ml(c,e,u),Xe(t,c,u),_=!0},p(c,u){c[17]?r?(r.p(c,u),u[0]&131072&&_e(r,1)):(r=ot(c),r.c(),_e(r,1),r.m(e.parentNode,e)):r&&(Sl(),be(r,1,1,()=>{r=null}),wl());const m={};u[0]&64&&(m.file_types=c[6]),u[0]&8388608&&(m.root=c[23]),u[0]&512&&(m.label=c[9]),u[0]&1024&&(m.info=c[10]),u[0]&2048&&(m.show_label=c[11]),u[0]&128&&(m.lines=c[7]),u[0]&262144&&(m.rtl=c[18]),u[0]&524288&&(m.text_align=c[19]),u[0]&536870912&&(m.waveform_settings=c[29]),u[0]&4&&(m.i18n=c[2].i18n),u[0]&4224&&(m.max_lines=c[12]?c[12]:c[7]+1),u[0]&256&&(m.placeholder=c[8]),u[0]&32768&&(m.submit_btn=c[15]),u[0]&65536&&(m.stop_btn=c[16]),u[0]&1048576&&(m.autofocus=c[20]),u[0]&2097152&&(m.autoscroll=c[21]),u[0]&16777216&&(m.file_count=c[24]),u[0]&67108864&&(m.sources=c[26]),u[0]&4&&(m.max_file_size=c[2].max_file_size),u[0]&4194304&&(m.disabled=!c[22]),u[0]&4&&(m.upload=c[32]),u[0]&4&&(m.stream_handler=c[33]),u[0]&33554432&&(m.max_plain_text_length=c[25]),!i&&u[0]&1&&(i=!0,m.value=c[0],Ce(()=>i=!1)),!o&&u[0]&2&&(o=!0,m.value_is_output=c[1],Ce(()=>o=!1)),!s&&u[0]&134217728&&(s=!0,m.dragging=c[27],Ce(()=>s=!1)),!g&&u[0]&268435456&&(g=!0,m.active_source=c[28],Ce(()=>g=!1)),t.$set(m)},i(c){_||(_e(r),_e(t.$$.fragment,c),_=!0)},o(c){be(r),be(t.$$.fragment,c),_=!1},d(c){c&&kl(e),r&&r.d(c),Ne(t,c)}}}function Hl(l){let e,t;return e=new At({props:{visible:l[5],elem_id:l[3],elem_classes:[...l[4],"multimodal-textbox"],scale:l[13],min_width:l[14],allow_overflow:!1,padding:!1,border_mode:l[27]?"focus":"base",$$slots:{default:[El]},$$scope:{ctx:l}}}),{c(){Ye(e.$$.fragment)},m(i,o){Xe(e,i,o),t=!0},p(i,o){const s={};o[0]&32&&(s.visible=i[5]),o[0]&8&&(s.elem_id=i[3]),o[0]&16&&(s.elem_classes=[...i[4],"multimodal-textbox"]),o[0]&8192&&(s.scale=i[13]),o[0]&16384&&(s.min_width=i[14]),o[0]&134217728&&(s.border_mode=i[27]?"focus":"base"),o[0]&1073717191|o[1]&8388608&&(s.$$scope={dirty:o,ctx:i}),e.$set(s)},i(i){t||(_e(e.$$.fragment,i),t=!0)},o(i){be(e.$$.fragment,i),t=!1},d(i){Ne(e,i)}}}function Fl(l,e,t){let{gradio:i}=e,{elem_id:o=""}=e,{elem_classes:s=[]}=e,{visible:g=!0}=e,{value:_={text:"",files:[]}}=e,{file_types:r=null}=e,{lines:b}=e,{placeholder:f=""}=e,{label:v="MultimodalTextbox"}=e,{info:h=void 0}=e,{show_label:V}=e,{max_lines:c}=e,{scale:u=null}=e,{min_width:m=void 0}=e,{submit_btn:R=null}=e,{stop_btn:p=null}=e,{loading_status:A=void 0}=e,{value_is_output:U=!1}=e,{rtl:B=!1}=e,{text_align:E=void 0}=e,{autofocus:H=!1}=e,{autoscroll:F=!0}=e,{interactive:T}=e,{root:q}=e,{file_count:d}=e,{max_plain_text_length:w}=e,{sources:j=["upload"]}=e,{waveform_options:G={}}=e,$,I=null,K,ue="darkorange";Bl(()=>{ue=getComputedStyle(document?.documentElement).getPropertyValue("--color-accent"),te(),t(29,K.waveColor=G.waveform_color||"#9ca3af",K),t(29,K.progressColor=G.waveform_progress_color||ue,K),t(29,K.mediaControls=G.show_controls,K),t(29,K.sampleRate=G.sample_rate||44100,K)});const me={color:G.trim_region_color,drag:!0,resize:!0};function te(){document.documentElement.style.setProperty("--trim-region-color",me.color||ue)}const de=()=>i.dispatch("clear_status",A),ge=(...a)=>i.client.upload(...a),le=(...a)=>i.client.stream(...a);function ae(a){_=a,t(0,_)}function P(a){U=a,t(1,U)}function Me(a){$=a,t(27,$)}function pe(a){I=a,t(28,I)}const Te=()=>i.dispatch("change",_),De=()=>i.dispatch("input"),Be=()=>i.dispatch("submit"),Ee=()=>i.dispatch("stop"),we=()=>i.dispatch("blur"),He=a=>i.dispatch("select",a.detail),Fe=()=>i.dispatch("focus"),qe=({detail:a})=>{i.dispatch("error",a)},Re=()=>i.dispatch("start_recording"),Ve=()=>i.dispatch("pause_recording"),Ae=()=>i.dispatch("stop_recording"),Pe=a=>i.dispatch("upload",a.detail),Ue=()=>i.dispatch("clear");return l.$$set=a=>{"gradio"in a&&t(2,i=a.gradio),"elem_id"in a&&t(3,o=a.elem_id),"elem_classes"in a&&t(4,s=a.elem_classes),"visible"in a&&t(5,g=a.visible),"value"in a&&t(0,_=a.value),"file_types"in a&&t(6,r=a.file_types),"lines"in a&&t(7,b=a.lines),"placeholder"in a&&t(8,f=a.placeholder),"label"in a&&t(9,v=a.label),"info"in a&&t(10,h=a.info),"show_label"in a&&t(11,V=a.show_label),"max_lines"in a&&t(12,c=a.max_lines),"scale"in a&&t(13,u=a.scale),"min_width"in a&&t(14,m=a.min_width),"submit_btn"in a&&t(15,R=a.submit_btn),"stop_btn"in a&&t(16,p=a.stop_btn),"loading_status"in a&&t(17,A=a.loading_status),"value_is_output"in a&&t(1,U=a.value_is_output),"rtl"in a&&t(18,B=a.rtl),"text_align"in a&&t(19,E=a.text_align),"autofocus"in a&&t(20,H=a.autofocus),"autoscroll"in a&&t(21,F=a.autoscroll),"interactive"in a&&t(22,T=a.interactive),"root"in a&&t(23,q=a.root),"file_count"in a&&t(24,d=a.file_count),"max_plain_text_length"in a&&t(25,w=a.max_plain_text_length),"sources"in a&&t(26,j=a.sources),"waveform_options"in a&&t(30,G=a.waveform_options)},t(29,K={height:50,barWidth:2,barGap:3,cursorWidth:2,cursorColor:"#ddd5e9",autoplay:!1,barRadius:10,dragToSeek:!0,normalize:!0,minPxPerSec:20}),[_,U,i,o,s,g,r,b,f,v,h,V,c,u,m,R,p,A,B,E,H,F,T,q,d,w,j,$,I,K,G,de,ge,le,ae,P,Me,pe,Te,De,Be,Ee,we,He,Fe,qe,Re,Ve,Ae,Pe,Ue]}class vi extends bl{constructor(e){super(),zl(this,e,Fl,Hl,Tl,{gradio:2,elem_id:3,elem_classes:4,visible:5,value:0,file_types:6,lines:7,placeholder:8,label:9,info:10,show_label:11,max_lines:12,scale:13,min_width:14,submit_btn:15,stop_btn:16,loading_status:17,value_is_output:1,rtl:18,text_align:19,autofocus:20,autoscroll:21,interactive:22,root:23,file_count:24,max_plain_text_length:25,sources:26,waveform_options:30},null,[-1,-1])}get gradio(){return this.$$.ctx[2]}set gradio(e){this.$$set({gradio:e}),M()}get elem_id(){return this.$$.ctx[3]}set elem_id(e){this.$$set({elem_id:e}),M()}get elem_classes(){return this.$$.ctx[4]}set elem_classes(e){this.$$set({elem_classes:e}),M()}get visible(){return this.$$.ctx[5]}set visible(e){this.$$set({visible:e}),M()}get value(){return this.$$.ctx[0]}set value(e){this.$$set({value:e}),M()}get file_types(){return this.$$.ctx[6]}set file_types(e){this.$$set({file_types:e}),M()}get lines(){return this.$$.ctx[7]}set lines(e){this.$$set({lines:e}),M()}get placeholder(){return this.$$.ctx[8]}set placeholder(e){this.$$set({placeholder:e}),M()}get label(){return this.$$.ctx[9]}set label(e){this.$$set({label:e}),M()}get info(){return this.$$.ctx[10]}set info(e){this.$$set({info:e}),M()}get show_label(){return this.$$.ctx[11]}set show_label(e){this.$$set({show_label:e}),M()}get max_lines(){return this.$$.ctx[12]}set max_lines(e){this.$$set({max_lines:e}),M()}get scale(){return this.$$.ctx[13]}set scale(e){this.$$set({scale:e}),M()}get min_width(){return this.$$.ctx[14]}set min_width(e){this.$$set({min_width:e}),M()}get submit_btn(){return this.$$.ctx[15]}set submit_btn(e){this.$$set({submit_btn:e}),M()}get stop_btn(){return this.$$.ctx[16]}set stop_btn(e){this.$$set({stop_btn:e}),M()}get loading_status(){return this.$$.ctx[17]}set loading_status(e){this.$$set({loading_status:e}),M()}get value_is_output(){return this.$$.ctx[1]}set value_is_output(e){this.$$set({value_is_output:e}),M()}get rtl(){return this.$$.ctx[18]}set rtl(e){this.$$set({rtl:e}),M()}get text_align(){return this.$$.ctx[19]}set text_align(e){this.$$set({text_align:e}),M()}get autofocus(){return this.$$.ctx[20]}set autofocus(e){this.$$set({autofocus:e}),M()}get autoscroll(){return this.$$.ctx[21]}set autoscroll(e){this.$$set({autoscroll:e}),M()}get interactive(){return this.$$.ctx[22]}set interactive(e){this.$$set({interactive:e}),M()}get root(){return this.$$.ctx[23]}set root(e){this.$$set({root:e}),M()}get file_count(){return this.$$.ctx[24]}set file_count(e){this.$$set({file_count:e}),M()}get max_plain_text_length(){return this.$$.ctx[25]}set max_plain_text_length(e){this.$$set({max_plain_text_length:e}),M()}get sources(){return this.$$.ctx[26]}set sources(e){this.$$set({sources:e}),M()}get waveform_options(){return this.$$.ctx[30]}set waveform_options(e){this.$$set({waveform_options:e}),M()}}export{zi as BaseExample,hl as BaseMultimodalTextbox,vi as default};
|
|
//# sourceMappingURL=Index-Cnah0Zag.js.map
|