vendor: 8,779 bytes, lines 1-3
1import"./index-6iIxEka4.js";import{C as re}from"./Index-IVH1m3k1.js";import"./svelte/svelte.js";import"./i18n-Dub1g69U.js";import"./DownloadLink-Clun45p7.js";import"./FullscreenButton-CY3DenSN.js";import"./MarkdownCode-B_oSAavQ.js";import"./prism-python-BTLJbtOb.js";import"./StreamingBar-DwBbQPSd.js";import"./Example-Do2HGpgf.js";const{SvelteComponent:ae,add_flush_callback:de,append:f,attr:_,bind:ce,binding_callbacks:ie,check_outros:ue,create_component:fe,destroy_component:_e,destroy_each:me,detach:M,element:p,ensure_array_like:O,flush:Q,group_outros:pe,init:ve,insert:z,listen:W,mount_component:he,noop:Y,run_all:be,safe_not_equal:ge,set_data:J,set_input_value:Z,set_style:$,space:E,text:R,toggle_class:L,transition_in:X,transition_out:A}=window.__gradio__svelte__internal,{onMount:qe}=window.__gradio__svelte__internal;function x(l,e,n){const o=l.slice();return o[24]=e[n],o[26]=n,o}function ee(l){let e,n,o=l[5].lines_added>0&&te(l),s=l[5].lines_removed>0&&ne(l);return{c(){e=p("span"),o&&o.c(),n=E(),s&&s.c(),_(e,"class","diff-stats svelte-fv4qq0")},m(t,i){z(t,e,i),o&&o.m(e,null),f(e,n),s&&s.m(e,null)},p(t,i){t[5].lines_added>0?o?o.p(t,i):(o=te(t),o.c(),o.m(e,n)):o&&(o.d(1),o=null),t[5].lines_removed>0?s?s.p(t,i):(s=ne(t),s.c(),s.m(e,null)):s&&(s.d(1),s=null)},d(t){t&&M(e),o&&o.d(),s&&s.d()}}}function te(l){let e,n,o=l[5].lines_added+"",s;return{c(){e=p("span"),n=R("+"),s=R(o),_(e,"class","added svelte-fv4qq0")},m(t,i){z(t,e,i),f(e,n),f(e,s)},p(t,i){i&32&&o!==(o=t[5].lines_added+"")&&J(s,o)},d(t){t&&M(e)}}}function ne(l){let e,n,o=l[5].lines_removed+"",s;return{c(){e=p("span"),n=R("-"),s=R(o),_(e,"class","removed svelte-fv4qq0")},m(t,i){z(t,e,i),f(e,n),f(e,s)},p(t,i){i&32&&o!==(o=t[5].lines_removed+"")&&J(s,o)},d(t){t&&M(e)}}}function ke(l){let e,n,o,s,t,i,c,a,v;function k(r){l[16](r)}let m={language:"python",lines:10,dark_mode:!1,basic:!0,readonly:!1,placeholder:"Enter your code here...",wrap_lines:!0,show_line_numbers:!0,autocomplete:!1};return l[4]!==void 0&&(m.value=l[4]),o=new re({props:m}),ie.push(()=>ce(o,"value",k)),{c(){e=p("div"),n=p("div"),fe(o.$$.fragment),t=E(),i=p("button"),i.textContent="Update Code",_(n,"class","code-editor-container svelte-fv4qq0"),_(i,"class","update-code-button svelte-fv4qq0"),_(e,"class","code-content svelte-fv4qq0")},m(r,C){z(r,e,C),f(e,n),he(o,n,null),f(e,t),f(e,i),c=!0,a||(v=W(i,"click",l[10]),a=!0)},p(r,C){const b={};!s&&C&16&&(s=!0,b.value=r[4],de(()=>s=!1)),o.$set(b)},i(r){c||(X(o.$$.fragment,r),c=!0)},o(r){A(o.$$.fragment,r),c=!1},d(r){r&&M(e),_e(o),a=!1,v()}}}function we(l){let e,n,o=O(l[6]),s=[];for(let i=0;i<o.length;i+=1)s[i]=se(x(l,o,i));let t=l[6].length===0&&le();return{c(){e=p("div");for(let i=0;i<s.length;i+=1)s[i].c();n=E(),t&&t.c(),_(e,"class","message-history svelte-fv4qq0")},m(i,c){z(i,e,c);for(let a=0;a<s.length;a+=1)s[a]&&s[a].m(e,null);f(e,n),t&&t.m(e,null)},p(i,c){if(c&320){o=O(i[6]);let a;for(a=0;a<o.length;a+=1){const v=x(i,o,a);s[a]?s[a].p(v,c):(s[a]=se(v),s[a].c(),s[a].m(e,n))}for(;a<s.length;a+=1)s[a].d(1);s.length=o.length}i[6].length===0?t||(t=le(),t.c(),t.m(e,null)):t&&(t.d(1),t=null)},i:Y,o:Y,d(i){i&&M(e),me(s,i),t&&t.d()}}}function oe(l){let e,n,o;function s(){return l[15](l[24],l[26])}return{c(){e=p("button"),e.textContent="Undo",_(e,"class","undo-button svelte-fv4qq0"),_(e,"title","Undo this change")},m(t,i){z(t,e,i),n||(o=W(e,"click",s),n=!0)},p(t,i){l=t},d(t){t&&M(e),n=!1,o()}}}function se(l){let e,n,o,s=l[24].text+"",t,i,c=!l[24].isBot&&l[24].hash&&!l[24].isPending&&oe(l);return{c(){e=p("div"),n=p("div"),o=p("span"),t=R(s),i=E(),c&&c.c(),_(o,"class","message-text svelte-fv4qq0"),_(n,"class","message-content svelte-fv4qq0"),_(e,"class","message-item svelte-fv4qq0"),L(e,"bot-message",l[24].isBot),L(e,"user-message",!l[24].isBot)},m(a,v){z(a,e,v),f(e,n),f(n,o),f(o,t),f(n,i),c&&c.m(n,null)},p(a,v){v&64&&s!==(s=a[24].text+"")&&J(t,s),!a[24].isBot&&a[24].hash&&!a[24].isPending?c?c.p(a,v):(c=oe(a),c.c(),c.m(n,null)):c&&(c.d(1),c=null),v&64&&L(e,"bot-message",a[24].isBot),v&64&&L(e,"user-message",!a[24].isBot)},d(a){a&&M(e),c&&c.d()}}}function le(l){let e;return{c(){e=p("div"),e.textContent="No messages yet",_(e,"class","no-messages svelte-fv4qq0")},m(n,o){z(n,e,o)},d(n){n&&M(e)}}}function ye(l){let e,n,o,s,t,i,c,a,v,k,m,r,C,b,S,T,w,I,B,j,D,y,F,G,h=l[5]&&(l[5].lines_added>0||l[5].lines_removed>0)&&ee(l);const H=[we,ke],d=[];function g(u,q){return u[3]==="chat"?0:u[3]==="code"?1:-1}return~(m=g(l))&&(r=d[m]=H[m](l)),{c(){e=p("div"),n=p("button"),o=E(),s=p("div"),t=p("button"),t.textContent="Chat",i=E(),c=p("button"),a=R(`Code 2 `),h&&h.c(),v=E(),k=p("div"),r&&r.c(),C=E(),b=p("div"),S=p("div"),S.innerHTML="Powered by: <code>gpt-oss</code>",T=E(),w=p("textarea"),I=E(),B=p("button"),j=R("Send"),_(n,"class","resize-handle svelte-fv4qq0"),_(n,"aria-label","Resize sidebar"),_(t,"class","tab-button svelte-fv4qq0"),L(t,"active",l[3]==="chat"),_(c,"class","tab-button svelte-fv4qq0"),L(c,"active",l[3]==="code"),_(s,"class","tab-header svelte-fv4qq0"),_(k,"class","tab-content svelte-fv4qq0"),_(S,"class","powered-by svelte-fv4qq0"),_(w,"placeholder","What can I add or change?"),_(w,"class","prompt-input svelte-fv4qq0"),_(B,"class","submit-button svelte-fv4qq0"),B.disabled=D=l[0].trim()==="",_(b,"class","input-section svelte-fv4qq0"),_(e,"class","vibe-editor svelte-fv4qq0"),$(e,"width",l[1]+"px")},m(u,q){z(u,e,q),f(e,n),f(e,o),f(e,s),f(s,t),f(s,i),f(s,c),f(c,a),h&&h.m(c,null),f(e,v),f(e,k),~m&&d[m].m(k,null),f(e,C),f(e,b),f(b,S),f(b,T),f(b,w),Z(w,l[0]),f(b,I),f(b,B),f(B,j),l[19](e),y=!0,F||(G=[W(n,"mousedown",l[9]),W(t,"click",l[13]),W(c,"click",l[14]),W(w,"keydown",l[17]),W(w,"input",l[18]),W(B,"click",l[7])],F=!0)},p(u,[q]){(!y||q&8)&&L(t,"active",u[3]==="chat"),u[5]&&(u[5].lines_added>0||u[5].lines_removed>0)?h?h.p(u,q):(h=ee(u),h.c(),h.m(c,null)):h&&(h.d(1),h=null),(!y||q&8)&&L(c,"active",u[3]==="code");let U=m;m=g(u),m===U?~m&&d[m].p(u,q):(r&&(pe(),A(d[U],1,1,()=>{d[U]=null}),ue()),~m?(r=d[m],r?r.p(u,q):(r=d[m]=H[m](u),r.c()),X(r,1),r.m(k,null)):r=null),q&1&&Z(w,u[0]),(!y||q&1&&D!==(D=u[0].trim()===""))&&(B.disabled=D),(!y||q&2)&&$(e,"width",u[1]+"px")},i(u){y||(X(r),y=!0)},o(u){A(r),y=!1},d(u){u&&M(e),h&&h.d(),~m&&d[m].d(),l[19](null),F=!1,be(G)}}}function Ee(l,e,n){let{app:o}=e,{root:s}=e,t="",i=350,c=!1,a,v="chat",k="",m=null,r=[];const C=()=>{if(t.trim()==="")return;n(5,m=null);const d=r.length;n(6,r=[...r,{text:t,isBot:!1}]);const g=r.length;n(6,r=[...r,{text:"Working...",isBot:!0,isPending:!0}]);const u=t;n(0,t=""),o.post_data(`${s}/gradio_api/vibe-edit/`,{prompt:u}).then(([U,K])=>{if(K!==200)throw new Error(`Error: ${K}`);const P=U;n(5,m=P.diff_stats),n(6,r=r.map((N,V)=>(console.log(V,d,P.hash),V===d?{...N,hash:P.hash}:N))),n(6,r=r.map((N,V)=>V===g?{text:P.reasoning?P.reasoning:"Done.",isBot:!0,isPending:!1}:N))}).catch(U=>{n(6,r=r.map((K,P)=>P===g?{text:"Error occurred.",isBot:!0,isPending:!1}:K))})},b=async(d,g)=>{try{await o.post_data(`${s}/gradio_api/undo-vibe-edit/`,{hash:d}),n(5,m=null);const u=r[g];n(0,t=u.text),n(6,r=r.slice(0,g))}catch(u){console.error("Failed to undo:",u)}},S=d=>{d.preventDefault(),c=!0,document.addEventListener("mousemove",T),document.addEventListener("mouseup",w),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},T=d=>{if(!c)return;const g=250,u=Math.min(800,window.innerWidth*.5),q=window.innerWidth-d.clientX;n(1,i=Math.max(g,Math.min(u,q))),window.dispatchEvent(new CustomEvent("vibeEditorResize",{detail:{width:i}}))},w=()=>{c=!1,document.removeEventListener("mousemove",T),document.removeEventListener("mouseup",w),document.body.style.cursor="",document.body.style.userSelect=""},I=async()=>{try{const d=await fetch(`${s}/gradio_api/vibe-code/`,{method:"GET",headers:{"Content-Type":"application/json"}});if(d.ok){const g=await d.json();n(4,k=g.code)}}catch(d){console.error("Failed to fetch code:",d)}},B=async()=>{try{await o.post_data(`${s}/gradio_api/vibe-code/`,{code:k})}catch(d){console.error("Failed to update code:",d)}};qe(()=>()=>{document.removeEventListener("mousemove",T),document.removeEventListener("mouseup",w)});const j=()=>n(3,v="chat"),D=()=>n(3,v="code"),y=(d,g)=>b(d.hash||"",g);function F(d){k=d,n(4,k)}const G=d=>{d.key==="Enter"&&!d.shiftKey&&(d.preventDefault(),C())};function h(){t=this.value,n(0,t)}function H(d){ie[d?"unshift":"push"](()=>{a=d,n(2,a)})}return l.$$set=d=>{"app"in d&&n(11,o=d.app),"root"in d&&n(12,s=d.root)},l.$$.update=()=>{l.$$.dirty&2048&&I()},[t,i,a,v,k,m,r,C,b,S,B,o,s,j,D,y,F,G,h,H]}class De extends ae{constructor(e){super(),ve(this,e,Ee,ye,ge,{app:11,root:12})}get app(){return this.$$.ctx[11]}set app(e){this.$$set({app:e}),Q()}get root(){return this.$$.ctx[12]}set root(e){this.$$set({root:e}),Q()}}export{De as default}; 3//# sourceMappingURL=Index-Vq3DLFc-.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.