Spaces:
Runtime error
Runtime error
StoryDiffusion
/
myenv
/Lib
/site-packages
/gradio
/templates
/frontend
/assets
/AltairPlot-8mCFudrM.js
import{c as k}from"./IconButtonWrapper.svelte_svelte_type_style_lang-BiUMvbOz.js";import{g as N}from"./color-Nc2yzdX8.js";import R from"./vega-embed.module-D4dWBgq8.js";import"./index-CP09mL-w.js";import"./svelte/svelte.js";import"./dsv-DB8NKgIY.js";function B(i,t,o,a){let e=t.getPropertyValue("--color-accent"),n=t.getPropertyValue("--body-text-color"),c=t.getPropertyValue("--border-color-primary"),f=t.fontFamily,w=t.getPropertyValue("--block-title-text-weight");const h=s=>s.endsWith("px")?parseFloat(s.slice(0,-2)):12;let _=h(t.getPropertyValue("--text-md")),d=h(t.getPropertyValue("--text-sm")),u={autosize:{type:"fit",contains:"padding"},axis:{labelFont:f,labelColor:n,titleFont:f,titleColor:n,tickColor:c,labelFontSize:d,gridColor:c,titleFontWeight:"normal",titleFontSize:d,labelFontWeight:"normal",domain:!1,labelAngle:0},legend:{labelColor:n,labelFont:f,titleColor:n,titleFont:f,titleFontWeight:"normal",titleFontSize:d,labelFontWeight:"normal",offset:2},title:{color:n,font:f,fontSize:_,fontWeight:w,anchor:"middle"},view:{stroke:c}};i.config=u;let r=i.encoding,m=i.layer;switch(o){case"scatter":i.config.mark={stroke:e},r.color&&r.color.type=="nominal"?r.color.scale.range=r.color.scale.range.map((s,g)=>v(a,g)):r.color&&r.color.type=="quantitative"&&(r.color.scale.range=["#eff6ff","#1e3a8a"],r.color.scale.range.interpolate="hsl");break;case"line":i.config.mark={stroke:e,cursor:"crosshair"},m.forEach(s=>{s.encoding.color&&(s.encoding.color.scale.range=s.encoding.color.scale.range.map((g,p)=>v(a,p)))});break;case"bar":i.config.mark={opacity:.8,fill:e},r.color&&(r.color.scale.range=r.color.scale.range.map((s,g)=>v(a,g)));break}return i}function v(i,t){let o=i[t%i.length];return o&&o in k?k[o]?.primary:o||k[N(t)].primary}const{SvelteComponent:G,append:x,attr:F,binding_callbacks:V,detach:E,element:C,flush:b,init:H,insert:M,noop:q,safe_not_equal:I,set_data:K,space:Q,text:U}=window.__gradio__svelte__internal,{onMount:X,onDestroy:Y}=window.__gradio__svelte__internal;function O(i){let t,o;return{c(){t=C("div"),o=U(i[0]),F(t,"class","caption layout svelte-1qhqpn7")},m(a,e){M(a,t,e),x(t,o)},p(a,e){e&1&&K(o,a[0])},d(a){a&&E(t)}}}function Z(i){let t,o,a,e=i[0]&&O(i);return{c(){t=C("div"),o=C("div"),a=Q(),e&&e.c(),F(t,"data-testid","altair"),F(t,"class","altair layout svelte-1qhqpn7")},m(n,c){M(n,t,c),x(t,o),i[11](o),x(t,a),e&&e.m(t,null),i[12](t)},p(n,[c]){n[0]?e?e.p(n,c):(e=O(n),e.c(),e.m(t,null)):e&&(e.d(1),e=null)},i:q,o:q,d(n){n&&E(t),i[11](null),e&&e.d(),i[12](null)}}}function $(i,t,o){let a,e,n,{value:c}=t,{colors:f=[]}=t,{caption:w}=t,{show_actions_button:h}=t,{gradio:_}=t,d,u,r,{_selectable:m}=t,s=window.getComputedStyle(document.body),g,p;const z=()=>Math.min(u.offsetWidth,p||u.offsetWidth);let P=()=>{};const j=()=>{n&&o(9,e.width=z(),e),R(d,e,{actions:h}).then(function(l){if(r=l.view,P=()=>{r.signal("width",z()).run()},!m)return;const W=(tt,et)=>{const y=r.signal("brush");if(y)if(Object.keys(y).length===0)_.dispatch("select",{value:null,index:null,selected:!1});else{const T=Object.keys(y)[0];let D=y[T].map(J=>J/1e3);_.dispatch("select",{value:y,index:D,selected:!0})}};r.addEventListener("mouseup",W),r.addEventListener("touchup",W)})};let S=new ResizeObserver(()=>{n&&e.width!==u.offsetWidth&&P()});X(()=>{j(),S.observe(u)}),Y(()=>{S.disconnect()});function A(l){V[l?"unshift":"push"](()=>{d=l,o(1,d)})}function L(l){V[l?"unshift":"push"](()=>{u=l,o(2,u)})}return i.$$set=l=>{"value"in l&&o(3,c=l.value),"colors"in l&&o(4,f=l.colors),"caption"in l&&o(0,w=l.caption),"show_actions_button"in l&&o(5,h=l.show_actions_button),"gradio"in l&&o(6,_=l.gradio),"_selectable"in l&&o(7,m=l._selectable)},i.$$.update=()=>{i.$$.dirty&8&&o(10,a=c?.plot),i.$$.dirty&1024&&o(9,e=JSON.parse(a)),i.$$.dirty&640&&e&&e.params&&!m&&o(9,e.params=e.params.filter(l=>l.name!=="brush"),e),i.$$.dirty&536&&c.chart&&o(9,e=B(e,s,c.chart,f)),i.$$.dirty&768&&g!==e&&(o(8,g=e),p=e.width),i.$$.dirty&520&&(n=!(e.encoding?.column?.field||e.encoding?.row?.field||c.chart===void 0))},[w,d,u,c,f,h,_,m,g,e,a,A,L]}class ct extends G{constructor(t){super(),H(this,t,$,Z,I,{value:3,colors:4,caption:0,show_actions_button:5,gradio:6,_selectable:7})}get value(){return this.$$.ctx[3]}set value(t){this.$$set({value:t}),b()}get colors(){return this.$$.ctx[4]}set colors(t){this.$$set({colors:t}),b()}get caption(){return this.$$.ctx[0]}set caption(t){this.$$set({caption:t}),b()}get show_actions_button(){return this.$$.ctx[5]}set show_actions_button(t){this.$$set({show_actions_button:t}),b()}get gradio(){return this.$$.ctx[6]}set gradio(t){this.$$set({gradio:t}),b()}get _selectable(){return this.$$.ctx[7]}set _selectable(t){this.$$set({_selectable:t}),b()}}export{ct as default}; | |
//# sourceMappingURL=AltairPlot-8mCFudrM.js.map | |