Team Ai
Apppublic

gbehem/Data_Visualization_Project_RQ2

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes
switch-CVKxYu_0.js2 linesDownload Raw Back to assets
1import{s as z}from"./chunk-LvLJmgfZ.js";import{d as ne,n as E,p as T,u as U}from"./useEvent-O0nX5vok.js";import{t as ie}from"./react-Bj1aDYRI.js";import{q as _}from"./cells-fq1RMGX_.js";import{t as le}from"./react-dom-CSu739Rf.js";import{t as D}from"./compiler-runtime-B3qBwwSJ.js";import{c as ce,f as I,h as ue,m as $,r as H,t as M}from"./useEventListener-Dy81QR4n.js";import{p as de}from"./utils-tNbLd14P.js";import{r as W}from"./config-3Aq84phF.js";import{t as fe}from"./jsx-runtime-icT_Ltz2.js";import{n as L,t as G}from"./cn-BoaCR37F.js";import{E as pe,S as he,_ as F,w as me}from"./Combination-Cs9nbinQ.js";import{m as ye}from"./select-CxT2Geqr.js";import{l as be}from"./dist-DJBpXGro.js";function we(){try{return window.__MARIMO_MOUNT_CONFIG__.version}catch{return $.warn("Failed to get version from mount config"),null}}const ge=T(we()||"latest"),ve=T(!0),xe=T(null);le();var m=z(ie(),1),je=(0,m.createContext)(null);function Re(a){let t=(0,m.useRef)({});return m.createElement(je.Provider,{value:t},a.children)}var ke=(0,m.createContext)({isSelected:!1}),Se={"Content-Type":"application/json"},Ee=/\{[^{}]+\}/g,Te=class extends Request{constructor(a,t){for(let e in super(a,t),t)e in this||(this[e]=t[e])}};function $e(a){let{baseUrl:t="",fetch:e=globalThis.fetch,querySerializer:s,bodySerializer:r,headers:o,...n}={...a};t.endsWith("/")&&(t=t.substring(0,t.length-1)),o=X(Se,o);let i=[];async function u(l,c){let{fetch:f=e,headers:h,params:d={},parseAs:v="json",querySerializer:b,bodySerializer:k=r??Ce,...R}=c||{},S=typeof s=="function"?s:B(s);b&&(S=typeof b=="function"?b:B({...typeof s=="object"?s:{},...b}));let y={redirect:"follow",...n,...R,headers:X(o,h,d.header)};y.body&&(y.body=k(y.body)),y.body instanceof FormData&&y.headers.delete("Content-Type");let x=new Te(Oe(l,{baseUrl:t,params:d,querySerializer:S}),y),N={baseUrl:t,fetch:f,parseAs:v,querySerializer:S,bodySerializer:k};for(let w of i)if(w&&typeof w=="object"&&typeof w.onRequest=="function"){x.schemaPath=l,x.params=d;let g=await w.onRequest(x,N);if(g){if(!(g instanceof Request))throw Error("Middleware must return new Request() when modifying the request");x=g}}let p=await f(x);for(let w=i.length-1;w>=0;w--){let g=i[w];if(g&&typeof g=="object"&&typeof g.onResponse=="function"){let q=await g.onResponse(p,N);if(q){if(!(q instanceof Response))throw Error("Middleware must return new Response() when modifying the response");p=q}}}if(p.status===204||p.headers.get("Content-Length")==="0")return p.ok?{data:{},response:p}:{error:{},response:p};if(p.ok)return v==="stream"?{data:p.body,response:p}:{data:await p[v](),response:p};let O=await p.text();try{O=JSON.parse(O)}catch{}return{error:O,response:p}}return{async GET(l,c){return u(l,{...c,method:"GET"})},async PUT(l,c){return u(l,{...c,method:"PUT"})},async POST(l,c){return u(l,{...c,method:"POST"})},async DELETE(l,c){return u(l,{...c,method:"DELETE"})},async OPTIONS(l,c){return u(l,{...c,method:"OPTIONS"})},async HEAD(l,c){return u(l,{...c,method:"HEAD"})},async PATCH(l,c){return u(l,{...c,method:"PATCH"})},async TRACE(l,c){return u(l,{...c,method:"TRACE"})},use(...l){for(let c of l)if(c){if(typeof c!="object"||!("onRequest"in c||"onResponse"in c))throw Error("Middleware must be an object with one of `onRequest()` or `onResponse()`");i.push(c)}},eject(...l){for(let c of l){let f=i.indexOf(c);f!==-1&&i.splice(f,1)}}}}function P(a,t,e){if(t==null)return"";if(typeof t=="object")throw Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return`${a}=${(e==null?void 0:e.allowReserved)===!0?t:encodeURIComponent(t)}`}function J(a,t,e){if(!t||typeof t!="object")return"";let s=[],r={simple:",",label:".",matrix:";"}[e.style]||"&";if(e.style!=="deepObject"&&e.explode===!1){for(let i in t)s.push(i,e.allowReserved===!0?t[i]:encodeURIComponent(t[i]));let n=s.join(",");switch(e.style){case"form":return`${a}=${n}`;case"label":return`.${n}`;case"matrix":return`;${a}=${n}`;default:return n}}for(let n in t){let i=e.style==="deepObject"?`${a}[${n}]`:n;s.push(P(i,t[n],e))}let o=s.join(r);return e.style==="label"||e.style==="matrix"?`${r}${o}`:o}function V(a,t,e){if(!Array.isArray(t))return"";if(e.explode===!1){let o={form:",",spaceDelimited:"%20",pipeDelimited:"|"}[e.style]||",",n=(e.allowReserved===!0?t:t.map(i=>encodeURIComponent(i))).join(o);switch(e.style){case"simple":return n;case"label":return`.${n}`;case"matrix":return`;${a}=${n}`;default:return`${a}=${n}`}}let s={simple:",",label:".",matrix:";"}[e.style]||"&",r=[];for(let o of t)e.style==="simple"||e.style==="label"?r.push(e.allowReserved===!0?o:encodeURIComponent(o)):r.push(P(a,o,e));return e.style==="label"||e.style==="matrix"?`${s}${r.join(s)}`:r.join(s)}function B(a){return function(t){let e=[];if(t&&typeof t=="object")for(let s in t){let r=t[s];if(r!=null){if(Array.isArray(r)){e.push(V(s,r,{style:"form",explode:!0,...a==null?void 0:a.array,allowReserved:(a==null?void 0:a.allowReserved)||!1}));continue}if(typeof r=="object"){e.push(J(s,r,{style:"deepObject",explode:!0,...a==null?void 0:a.object,allowReserved:(a==null?void 0:a.allowReserved)||!1}));continue}e.push(P(s,r,a))}}return e.join("&")}}function Pe(a,t){let e=a;for(let s of a.match(Ee)??[]){let r=s.substring(1,s.length-1),o=!1,n="simple";if(r.endsWith("*")&&(o=!0,r=r.substring(0,r.length-1)),r.startsWith(".")?(n="label",r=r.substring(1)):r.startsWith(";")&&(n="matrix",r=r.substring(1)),!t||t[r]===void 0||t[r]===null)continue;let i=t[r];if(Array.isArray(i)){e=e.replace(s,V(r,i,{style:n,explode:o}));continue}if(typeof i=="object"){e=e.replace(s,J(r,i,{style:n,explode:o}));continue}if(n==="matrix"){e=e.replace(s,`;${P(r,i)}`);continue}e=e.replace(s,n==="label"?`.${i}`:i)}return e}function Ce(a){return JSON.stringify(a)}function Oe(a,t){var r;let e=`${t.baseUrl}${a}`;(r=t.params)!=null&&r.path&&(e=Pe(e,t.params.path));let s=t.querySerializer(t.params.query??{});return s.startsWith("?")&&(s=s.substring(1)),s&&(e+=`?${s}`),e}function X(...a){let t=new Headers;for(let e of a){if(!e||typeof e!="object")continue;let s=e instanceof Headers?e.entries():Object.entries(e);for(let[r,o]of s)if(o===null)t.delete(r);else if(Array.isArray(o))for(let n of o)t.append(r,n);else o!==void 0&&t.set(r,o)}return t}function qe(a){return $e(a)}function K(){let a=W().httpURL;return a.search="",a.hash="",a.toString()}const A={post(a,t,e={}){let s=`${_.withTrailingSlash(e.baseUrl??K())}api${a}`;return fetch(s,{method:"POST",headers:{"Content-Type":"application/json",...A.headers(),...e.headers},body:JSON.stringify(t),signal:e.signal}).then(async r=>{var n;let o=(n=r.headers.get("Content-Type"))==null?void 0:n.startsWith("application/json");if(!r.ok){let i=o?await r.json():await r.text();throw Error(r.statusText,{cause:i})}return o?r.json():r.text()}).catch(r=>{throw $.error(`Error requesting ${s}`,r),r})},get(a,t={}){let e=`${_.withTrailingSlash(t.baseUrl??K())}api${a}`;return fetch(e,{method:"GET",headers:{...A.headers(),...t.headers}}).then(s=>{var r;if(!s.ok)throw Error(s.statusText);return(r=s.headers.get("Content-Type"))!=null&&r.startsWith("application/json")?s.json():null}).catch(s=>{throw $.error(`Error requesting ${e}`,s),s})},headers(){return W().headers()},handleResponse:a=>a.error?Promise.reject(a.error):Promise.resolve(a.data),handleResponseReturnNull:a=>a.error?Promise.reject(a.error):Promise.resolve(null)};function Ae(a){let t=qe({baseUrl:a.httpURL.toString()});return t.use({onRequest:e=>{let s=a.headers();for(let[r,o]of Object.entries(s))e.headers.set(r,o);return e}}),t}var Q=T({});function Ne(){return U(Q)}function ze(){let a=ne(Q);return{registerAction:E((t,e)=>{a(s=>({...s,[t]:e}))}),unregisterAction:E(t=>{a(e=>{let{[t]:s,...r}=e;return r})})}}var Y=D();function Ue(a,t){let e=(0,Y.c)(13),{registerAction:s,unregisterAction:r}=ze(),o=U(de),n=t===ue.NOOP,i;e[0]===t?i=e[1]:(i=d=>t(d),e[0]=t,e[1]=i);let u=E(i),l;e[2]!==t||e[3]!==o||e[4]!==a?(l=d=>{if(d.defaultPrevented)return;let v=o.getHotkey(a).key;I(v)(d)&&t(d)!==!1&&(d.preventDefault(),d.stopPropagation())},e[2]=t,e[3]=o,e[4]=a,e[5]=l):l=e[5];let c=E(l);M(document,"keydown",c);let f,h;e[6]!==n||e[7]!==u||e[8]!==s||e[9]!==a||e[10]!==r?(f=()=>{if(!n)return s(a,u),()=>r(a)},h=[u,a,n,s,r],e[6]=n,e[7]=u,e[8]=s,e[9]=a,e[10]=r,e[11]=f,e[12]=h):(f=e[11],h=e[12]),(0,m.useEffect)(f,h)}function _e(a,t){let e=(0,Y.c)(2),s;e[0]===t?s=e[1]:(s=r=>{if(!r.defaultPrevented)for(let[o,n]of ce.entries(t))I(o)(r)&&($.debug("Satisfied",o,r),n(r)!==!1&&(r.preventDefault(),r.stopPropagation()))},e[0]=t,e[1]=s),M(a,"keydown",s)}var j=z(fe(),1),C="Switch",[De,nt]=pe(C),[Ie,He]=De(C),Z=m.forwardRef((a,t)=>{let{__scopeSwitch:e,name:s,checked:r,defaultChecked:o,required:n,disabled:i,value:u="on",onCheckedChange:l,form:c,...f}=a,[h,d]=m.useState(null),v=H(t,y=>d(y)),b=m.useRef(!1),k=h?c||!!h.closest("form"):!0,[R,S]=he({prop:r,defaultProp:o??!1,onChange:l,caller:C});return(0,j.jsxs)(Ie,{scope:e,checked:R,disabled:i,children:[(0,j.jsx)(F.button,{type:"button",role:"switch","aria-checked":R,"aria-required":n,"data-state":ae(R),"data-disabled":i?"":void 0,disabled:i,value:u,...f,ref:v,onClick:me(a.onClick,y=>{S(x=>!x),k&&(b.current=y.isPropagationStopped(),b.current||y.stopPropagation())})}),k&&(0,j.jsx)(re,{control:h,bubbles:!b.current,name:s,value:u,checked:R,required:n,disabled:i,form:c,style:{transform:"translateX(-100%)"}})]})});Z.displayName=C;var ee="SwitchThumb",te=m.forwardRef((a,t)=>{let{__scopeSwitch:e,...s}=a,r=He(ee,e);return(0,j.jsx)(F.span,{"data-state":ae(r.checked),"data-disabled":r.disabled?"":void 0,...s,ref:t})});te.displayName=ee;var Me="SwitchBubbleInput",re=m.forwardRef(({__scopeSwitch:a,control:t,checked:e,bubbles:s=!0,...r},o)=>{let n=m.useRef(null),i=H(n,o),u=ye(e),l=be(t);return m.useEffect(()=>{let c=n.current;if(!c)return;let f=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(f,"checked").set;if(u!==e&&h){let d=new Event("click",{bubbles:s});h.call(c,e),c.dispatchEvent(d)}},[u,e,s]),(0,j.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:e,...r,tabIndex:-1,ref:i,style:{...r.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});re.displayName=Me;function ae(a){return a?"checked":"unchecked"}var se=Z,We=te,Le=D(),Ge=L("peer inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",{variants:{size:{default:"h-6 w-11 mb-1",sm:"h-4.5 w-8.5",xs:"h-4 w-7"}},defaultVariants:{size:"default"}}),Fe=L("pointer-events-none block rounded-full bg-background shadow-xs ring-0 transition-transform",{variants:{size:{default:"h-5 w-5 data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0",sm:"h-3.5 w-3.5 data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0",xs:"h-3 w-3 data-[state=checked]:translate-x-3 data-[state=unchecked]:translate-x-0"}},defaultVariants:{size:"default"}}),oe=m.forwardRef((a,t)=>{let e=(0,Le.c)(16),s,r,o;e[0]===a?(s=e[1],r=e[2],o=e[3]):({className:s,size:o,...r}=a,e[0]=a,e[1]=s,e[2]=r,e[3]=o);let n;e[4]!==s||e[5]!==o?(n=G(Ge({size:o}),s),e[4]=s,e[5]=o,e[6]=n):n=e[6];let i;e[7]===o?i=e[8]:(i=G(Fe({size:o})),e[7]=o,e[8]=i);let u;e[9]===i?u=e[10]:(u=(0,j.jsx)(We,{className:i}),e[9]=i,e[10]=u);let l;return e[11]!==r||e[12]!==t||e[13]!==n||e[14]!==u?(l=(0,j.jsx)(se,{className:n,...r,ref:t,children:u}),e[11]=r,e[12]=t,e[13]=n,e[14]=u,e[15]=l):l=e[15],l});oe.displayName=se.displayName;export{A as a,Re as c,ve as d,Ne as i,ge as l,Ue as n,Ae as o,_e as r,ke as s,oe as t,xe as u};2