@stlite/desktop 0.47.2 → 0.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/bin/dump_artifacts.js +1 -1
  2. package/build/asset-manifest.json +20 -20
  3. package/build/index.html +1 -1
  4. package/build/static/css/8957.cd5b39ce.chunk.css +1 -0
  5. package/build/static/js/1122.cbaa29b2.chunk.js +1 -0
  6. package/build/static/js/{144.7b870b6f.chunk.js → 144.a72a0130.chunk.js} +1 -1
  7. package/build/static/js/{1740.893c6c48.chunk.js → 1740.f2cc8a49.chunk.js} +1 -1
  8. package/build/static/js/{2448.e6f85eda.chunk.js → 2448.7dff34e3.chunk.js} +1 -1
  9. package/build/static/js/2694.2ef7325a.chunk.js +2 -0
  10. package/build/static/js/4004.725eef9d.chunk.js +1 -0
  11. package/build/static/js/{4021.ec2e87b0.chunk.js → 4021.d0a55d54.chunk.js} +1 -1
  12. package/build/static/js/{4785.f0fa2d5d.chunk.js → 4785.f21e0ace.chunk.js} +1 -1
  13. package/build/static/js/5599.f94de6cb.chunk.js +1 -0
  14. package/build/static/js/5783.26aeaea5.chunk.js +1 -0
  15. package/build/static/js/6134.243d4a10.chunk.js +1 -0
  16. package/build/static/js/7125.0ba671ec.chunk.js +1 -0
  17. package/build/static/js/{7332.b2a91ff6.chunk.js → 7332.71a3c522.chunk.js} +1 -1
  18. package/build/static/js/{8050.029f3dc8.chunk.js → 8050.54afb9d0.chunk.js} +1 -1
  19. package/build/static/js/8957.ff10b5e2.chunk.js +1 -0
  20. package/build/static/js/main.b5316fd2.js +28 -0
  21. package/build/static/js/{main.99099e40.js.LICENSE.txt → main.b5316fd2.js.LICENSE.txt} +23 -25
  22. package/package.json +8 -8
  23. package/wheels/stlite_server-0.1.0-py3-none-any.whl +0 -0
  24. package/wheels/streamlit-1.32.2-cp311-none-any.whl +0 -0
  25. package/build/static/css/9699.7ce51b75.chunk.css +0 -1
  26. package/build/static/js/1122.422f58fc.chunk.js +0 -1
  27. package/build/static/js/2372.844b5190.chunk.js +0 -2
  28. package/build/static/js/4949.391c96be.chunk.js +0 -2
  29. package/build/static/js/4949.391c96be.chunk.js.LICENSE.txt +0 -45
  30. package/build/static/js/6134.20400e9e.chunk.js +0 -1
  31. package/build/static/js/7125.afecc159.chunk.js +0 -1
  32. package/build/static/js/790.4b5acd65.chunk.js +0 -1
  33. package/build/static/js/9699.fd4930f2.chunk.js +0 -1
  34. package/build/static/js/main.99099e40.js +0 -28
  35. package/build/static/media/index.294a0edb7af7d19b781b.cjs +0 -1
  36. package/build/static/media/index.c05687ef19f5bac24939.cjs +0 -1
  37. package/build/static/media/index.cf5b321a6e04bf47c12e.cjs +0 -1
  38. package/build/static/media/index.db61103fb7fdd62b9c44.cjs +0 -1
  39. package/build/static/media/index.f29488c1099d5e3883ac.cjs +0 -1
  40. package/wheels/streamlit-1.31.0-cp311-none-any.whl +0 -0
  41. /package/build/static/js/{2372.844b5190.chunk.js.LICENSE.txt → 2694.2ef7325a.chunk.js.LICENSE.txt} +0 -0
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[4004],{74004:(e,t,r)=>{r.r(t),r.d(t,{default:()=>c});var i=r(5057),n=r(53627),a=r(81726),o=r(17468),s=r(43128);const d=(0,r(77650).z)("div")({name:"DataGridOverlayEditorStyle",class:"gdg-d19meir1",propsAsIs:!1,vars:{"d19meir1-0":[e=>e.targetY,"px"],"d19meir1-1":[e=>e.targetX,"px"],"d19meir1-2":[e=>e.targetWidth,"px"],"d19meir1-3":[e=>e.targetHeight,"px"],"d19meir1-4":[e=>e.targetY+10,"px"],"d19meir1-5":[e=>Math.max(0,(e.targetHeight-28)/2),"px"]}});function l(){const[e,t]=function(){const[e,t]=i.useState();return[e??void 0,t]}(),[r,n]=i.useState(0),[a,o]=i.useState(!0);i.useLayoutEffect((()=>{if(void 0===e)return;if(!("IntersectionObserver"in window))return;const t=new IntersectionObserver((e=>{0!==e.length&&o(e[0].isIntersecting)}),{threshold:1});return t.observe(e),()=>t.disconnect()}),[e]),i.useEffect((()=>{if(a||void 0===e)return;let t;const r=()=>{const{right:i}=e.getBoundingClientRect();n((e=>Math.min(e+window.innerWidth-i-10,0))),t=requestAnimationFrame(r)};return t=requestAnimationFrame(r),()=>{void 0!==t&&cancelAnimationFrame(t)}}),[e,a]);return{ref:t,style:i.useMemo((()=>({transform:`translateX(${r}px)`})),[r])}}const c=e=>{const{target:t,content:r,onFinishEditing:c,forceEditMode:u,initialValue:g,imageEditorOverride:v,markdownDivCreateNode:m,highlight:h,className:p,theme:f,id:y,cell:b,bloom:k,validateCell:E,getCellRenderer:C,provideEditor:w,isOutsideClick:x}=e,[D,O]=i.useState(u?r:void 0),P=i.useRef(D??r);P.current=D??r;const[S,N]=i.useState((()=>void 0===E||!((0,s.T9)(r)&&!1===E?.(b,r,P.current)))),T=i.useCallback(((e,t)=>{c(S?e:void 0,t)}),[S,c]),M=i.useCallback((e=>{if(void 0!==E&&void 0!==e&&(0,s.T9)(e)){const t=E(b,e,P.current);!1===t?N(!1):"object"===typeof t?(e=t,N(!0)):N(!0)}O(e)}),[b,E]),R=i.useRef(!1),F=i.useRef(void 0),I=i.useCallback((()=>{T(D,[0,0]),R.current=!0}),[D,T]),A=i.useCallback(((e,t)=>{T(e,t??F.current??[0,0]),R.current=!0}),[T]),H=i.useCallback((async e=>{let t=!1;"Escape"===e.key?(e.stopPropagation(),e.preventDefault(),F.current=[0,0]):"Enter"!==e.key||e.shiftKey?"Tab"===e.key&&(e.stopPropagation(),e.preventDefault(),F.current=[e.shiftKey?-1:1,0],t=!0):(e.stopPropagation(),e.preventDefault(),F.current=[0,1],t=!0),window.setTimeout((()=>{R.current||void 0===F.current||(T(t?D:void 0,F.current),R.current=!0)}),0)}),[T,D]),_=D??r,[K,V]=i.useMemo((()=>{if((0,s.rs)(r))return[];const e=w?.(r);return void 0!==e?[e,!1]:[C(r)?.provideEditor?.(r),!1]}),[r,C,w]),{ref:W,style:X}=l();let Y,q,B=!0,G=!0;if(void 0!==K){B=!0!==K.disablePadding,G=!0!==K.disableStyling;const e=(0,s.DP)(K);e&&(q=K.styleOverride);const r=e?K.editor:K;Y=i.createElement(r,{isHighlighted:h,onChange:M,value:_,initialValue:g,onFinishedEditing:A,validatedSelection:(0,s.T9)(_)?_.selectionRange:void 0,forceEditMode:u,target:t,imageEditorOverride:v,markdownDivCreateNode:m,isValid:S,theme:f})}q={...q,...X};const j=document.getElementById("portal");if(null===j)return console.error('Cannot open Data Grid overlay editor, because portal not found. Please add `<div id="portal" />` as the last child of your `<body>`.'),null;let z=G?"gdg-style":"gdg-unstyle";S||(z+=" gdg-invalid"),B&&(z+=" gdg-pad");const L=k?.[0]??1,Z=k?.[1]??1;return(0,n.createPortal)(i.createElement(o.Ni.Provider,{value:f},i.createElement(a.Z,{style:(0,o.be)(f),className:p,onClickOutside:I,isOutsideClick:x},i.createElement(d,{ref:W,id:y,className:z,style:q,as:!0===V?"label":void 0,targetX:t.x-L,targetY:t.y-Z,targetWidth:t.width+2*L,targetHeight:t.height+2*Z},i.createElement("div",{className:"gdg-clip-region",onKeyDown:H},Y)))),j)}}}]);
@@ -1 +1 @@
1
- "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[4021],{94021:(e,t,o)=>{o.r(t),o.d(t,{default:()=>b});var r=o(5057),i=o(47206),n=o(54281),s=o(96601),a=o(46403),d=o(92421),l=o(85367),c=o(82160);const u=(0,c.Z)("button",{target:"elibz2u1"})((e=>{let{theme:t}=e;return{fontSize:t.fontSizes.sm,lineHeight:"1.4rem",color:t.colors.gray60,backgroundColor:t.colors.transparent,border:"none",boxShadow:"none",padding:"0px","&:hover, &:active, &:focus":{border:"none",outline:"none",boxShadow:"none"},"&:hover":{color:t.colors.primary}}}),""),h=(0,c.Z)("div",{target:"elibz2u0"})((e=>{let{theme:t,expanded:o}=e;return{maxHeight:o?"none":t.breakpoints.toast}}),"");var p=o(96266);const b=(0,i.b)((function(e){let{theme:t,body:o,icon:i,width:c}=e;const b=i?"".concat(i,"&ensp;").concat(o):o,g=function(e){if(e.length>114){let t=e.replace(/^(.{114}[^\s]*).*/,"$1");return t.length>114&&(t=t.split(" ").slice(0,-1).join(" ")),t}return e}(b),m=b!==g,[x,f]=(0,r.useState)(!m),[y,w]=(0,r.useState)(0),S=(0,r.useCallback)((()=>{f(!x)}),[x]),k=(0,r.useMemo)((()=>function(e,t){const o=(0,s.Iy)(t);return{Body:{props:{"data-testid":"stToast"},style:{width:"288px",marginTop:"8px",borderTopLeftRadius:t.radii.lg,borderTopRightRadius:t.radii.lg,borderBottomLeftRadius:t.radii.lg,borderBottomRightRadius:t.radii.lg,backgroundColor:o?t.colors.gray10:t.colors.gray90,color:t.colors.bodyText,boxShadow:o?"0px 4px 16px rgba(0, 0, 0, 0.16)":"0px 4px 16px rgba(0, 0, 0, 0.7)"}},InnerContainer:{style:{maxHeight:e?"none":"88px",overflow:"hidden",fontSize:t.fontSizes.sm,lineHeight:"1.4rem"}},CloseIcon:{style:{color:t.colors.bodyText,marginRight:"-5px",width:"1.2rem",height:"1.2rem"}}}}(x,t)),[x,t]),v=(0,r.useMemo)((()=>(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(h,{expanded:x,children:(0,p.jsx)(a.ZP,{source:x?b:g,allowHTML:!1,isToast:!0})}),m&&(0,p.jsx)(u,{className:"toastViewButton",onClick:S,children:x?"view less":"view more"})]})),[m,x,b,g,S]);(0,r.useEffect)((()=>{if(t.inSidebar)return;const e=n.Z.info(v,{overrides:{...k}});return w(e),()=>{n.Z.update(e,{overrides:{Body:{style:{transitionDuration:0}}}}),n.Z.clear(e)}}),[]),(0,r.useEffect)((()=>{n.Z.update(y,{children:v,overrides:{...k}})}),[y,v,k]);const R=(0,p.jsx)(l.Z,{kind:d.h.ERROR,body:"Streamlit API Error: `st.toast` cannot be called directly on the sidebar with `st.sidebar.toast`. See our `st.toast` API [docs](https://docs.streamlit.io/library/api-reference/status/st.toast) for more information.",width:c});return(0,p.jsx)(p.Fragment,{children:t.inSidebar&&R})}))}}]);
1
+ "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[4021],{94021:(e,t,o)=>{o.r(t),o.d(t,{default:()=>b});var r=o(5057),i=o(47206),s=o(54281),n=o(96601),a=o(46403),d=o(92421),l=o(85367),c=o(82160);const u=(0,c.Z)("button",{target:"elibz2u1"})((e=>{let{theme:t}=e;return{fontSize:t.fontSizes.sm,lineHeight:"1.4rem",color:t.colors.gray60,backgroundColor:t.colors.transparent,border:"none",boxShadow:"none",padding:"0px","&:hover, &:active, &:focus":{border:"none",outline:"none",boxShadow:"none"},"&:hover":{color:t.colors.primary}}}),""),h=(0,c.Z)("div",{target:"elibz2u0"})((e=>{let{theme:t,expanded:o}=e;return{maxHeight:o?"none":t.breakpoints.toast}}),"");var p=o(96266);const b=(0,i.b)((function(e){let{theme:t,body:o,icon:i,width:c}=e;const b=i?"".concat(i,"&ensp;").concat(o):o,g=function(e){if(e.length>114){let t=e.replace(/^(.{114}[^\s]*).*/,"$1");return t.length>114&&(t=t.split(" ").slice(0,-1).join(" ")),t}return e}(b),m=b!==g,[x,f]=(0,r.useState)(!m),[y,w]=(0,r.useState)(0),S=(0,r.useCallback)((()=>{f(!x)}),[x]),k=(0,r.useMemo)((()=>function(e,t){const o=(0,n.Iy)(t);return{Body:{props:{"data-testid":"stToast"},style:{width:"288px",marginTop:"8px",borderTopLeftRadius:t.radii.lg,borderTopRightRadius:t.radii.lg,borderBottomLeftRadius:t.radii.lg,borderBottomRightRadius:t.radii.lg,backgroundColor:o?t.colors.gray10:t.colors.gray90,color:t.colors.bodyText,boxShadow:o?"0px 4px 16px rgba(0, 0, 0, 0.16)":"0px 4px 16px rgba(0, 0, 0, 0.7)"}},InnerContainer:{style:{maxHeight:e?"none":"88px",overflow:"hidden",fontSize:t.fontSizes.sm,lineHeight:"1.4rem"}},CloseIcon:{style:{color:t.colors.bodyText,marginRight:"-5px",width:"1.2rem",height:"1.2rem"}}}}(x,t)),[x,t]),v=(0,r.useMemo)((()=>(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(h,{expanded:x,children:(0,p.jsx)(a.ZP,{source:x?b:g,allowHTML:!1,isToast:!0})}),m&&(0,p.jsx)(u,{"data-testid":"toastViewButton",className:"toastViewButton",onClick:S,children:x?"view less":"view more"})]})),[m,x,b,g,S]);(0,r.useEffect)((()=>{if(t.inSidebar)return;const e=s.Z.info(v,{overrides:{...k}});return w(e),()=>{s.Z.update(e,{overrides:{Body:{style:{transitionDuration:0}}}}),s.Z.clear(e)}}),[]),(0,r.useEffect)((()=>{s.Z.update(y,{children:v,overrides:{...k}})}),[y,v,k]);const R=(0,p.jsx)(l.Z,{kind:d.h.ERROR,body:"Streamlit API Error: `st.toast` cannot be called directly on the sidebar with `st.sidebar.toast`. See our `st.toast` API [docs](https://docs.streamlit.io/library/api-reference/status/st.toast) for more information.",width:c});return(0,p.jsx)(p.Fragment,{children:t.inSidebar&&R})}))}}]);
@@ -1 +1 @@
1
- "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[4785],{94785:(t,e,s)=>{s.r(e),s.d(e,{default:()=>d});var i=s(5057),u=s(4153),r=s(96266);function d(t){let{element:e,width:s,endpoints:d}=t;const l=(0,i.useRef)(null);(0,i.useEffect)((()=>{l.current&&(l.current.currentTime=e.startTime)}),[e.startTime]);const a=(0,u.O0)(e.url),n=d.buildMediaURL(a);return(0,r.jsx)("audio",{"data-testid":"stAudio",id:"audio",ref:l,controls:!0,src:n,className:"stAudio",style:{width:s}})}}}]);
1
+ "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[4785],{94785:(t,e,s)=>{s.r(e),s.d(e,{default:()=>d});var i=s(5057),u=s(8230),r=s(96266);function d(t){let{element:e,width:s,endpoints:d}=t;const l=(0,i.useRef)(null);(0,i.useEffect)((()=>{l.current&&(l.current.currentTime=e.startTime)}),[e.startTime]);const a=(0,u.O0)(e.url),n=d.buildMediaURL(a);return(0,r.jsx)("audio",{"data-testid":"stAudio",id:"audio",ref:l,controls:!0,src:n,className:"stAudio",style:{width:s}})}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[5599],{15532:(e,t,r)=>{r.r(t),r.d(t,{FileSystemDirectoryHandle:()=>a,default:()=>s});var i=r(80954);const n=Symbol("adapter");class a extends i.Z{[n];constructor(e){super(e),this[n]=e}async getDirectoryHandle(e,t={}){if(""===e)throw new TypeError("Name can't be an empty string.");if("."===e||".."===e||e.includes("/"))throw new TypeError("Name contains invalid characters.");t.create=!!t.create;const r=await this[n].getDirectoryHandle(e,t);return new a(r)}async*entries(){const{FileSystemFileHandle:e}=await Promise.resolve().then(r.bind(r,11445));for await(const[t,r]of this[n].entries())yield[r.name,"file"===r.kind?new e(r):new a(r)]}async*getEntries(){const{FileSystemFileHandle:e}=await Promise.resolve().then(r.bind(r,11445));console.warn("deprecated, use .entries() instead");for await(let t of this[n].entries())yield"file"===t.kind?new e(t):new a(t)}async getFileHandle(e,t={}){const{FileSystemFileHandle:i}=await Promise.resolve().then(r.bind(r,11445));if(""===e)throw new TypeError("Name can't be an empty string.");if("."===e||".."===e||e.includes("/"))throw new TypeError("Name contains invalid characters.");t.create=!!t.create;return new i(await this[n].getFileHandle(e,t))}async removeEntry(e,t={}){if(""===e)throw new TypeError("Name can't be an empty string.");if("."===e||".."===e||e.includes("/"))throw new TypeError("Name contains invalid characters.");return t.recursive=!!t.recursive,this[n].removeEntry(e,t)}async resolve(e){if(await e.isSameEntry(this))return[];const t=[{handle:this,path:[]}];for(;t.length;){let{handle:r,path:i}=t.pop();for await(const n of r.values()){if(await n.isSameEntry(e))return[...i,n.name];"directory"===n.kind&&t.push({handle:n,path:[...i,n.name]})}}return null}async*keys(){for await(const[e]of this[n].entries())yield e}async*values(){for await(const[e,t]of this)yield t}[Symbol.asyncIterator](){return this.entries()}}Object.defineProperty(a.prototype,Symbol.toStringTag,{value:"FileSystemDirectoryHandle",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(a.prototype,{getDirectoryHandle:{enumerable:!0},entries:{enumerable:!0},getFileHandle:{enumerable:!0},removeEntry:{enumerable:!0}});const s=a},11445:(e,t,r)=>{r.r(t),r.d(t,{FileSystemFileHandle:()=>s,default:()=>o});var i=r(80954),n=r(93160);const a=Symbol("adapter");class s extends i.Z{[a];constructor(e){super(e),this[a]=e}async createWritable(e={}){return new n.Z(await this[a].createWritable(e))}async getFile(){return this[a].getFile()}}Object.defineProperty(s.prototype,Symbol.toStringTag,{value:"FileSystemFileHandle",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(s.prototype,{createWritable:{enumerable:!0},getFile:{enumerable:!0}});const o=s},80954:(e,t,r)=>{r.d(t,{Z:()=>a});const i=Symbol("adapter");class n{[i];name;kind;constructor(e){this.kind=e.kind,this.name=e.name,this[i]=e}async queryPermission({mode:e="read"}={}){const t=this[i];if(t.queryPermission)return t.queryPermission({mode:e});if("read"===e)return"granted";if("readwrite"===e)return t.writable?"granted":"denied";throw new TypeError(`Mode ${e} must be 'read' or 'readwrite'`)}async requestPermission({mode:e="read"}={}){const t=this[i];if(t.requestPermission)return t.requestPermission({mode:e});if("read"===e)return"granted";if("readwrite"===e)return t.writable?"granted":"denied";throw new TypeError(`Mode ${e} must be 'read' or 'readwrite'`)}async remove(e={}){await this[i].remove(e)}async isSameEntry(e){return this===e||!(!e||"object"!==typeof e||this.kind!==e.kind||!e[i])&&this[i].isSameEntry(e[i])}}Object.defineProperty(n.prototype,Symbol.toStringTag,{value:"FileSystemHandle",writable:!1,enumerable:!1,configurable:!0});const a=n},93160:(e,t,r)=>{r.d(t,{Z:()=>s});var i=r(51059);const{WritableStream:n}=i.Z;class a extends n{constructor(...e){super(...e),Object.setPrototypeOf(this,a.prototype),this._closed=!1}close(){this._closed=!0;const e=this.getWriter(),t=e.close();return e.releaseLock(),t}seek(e){return this.write({type:"seek",position:e})}truncate(e){return this.write({type:"truncate",size:e})}write(e){if(this._closed)return Promise.reject(new TypeError("Cannot write to a CLOSED writable stream"));const t=this.getWriter(),r=t.write(e);return t.releaseLock(),r}}Object.defineProperty(a.prototype,Symbol.toStringTag,{value:"FileSystemWritableFileStream",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(a.prototype,{close:{enumerable:!0},seek:{enumerable:!0},truncate:{enumerable:!0},write:{enumerable:!0}});const s=a},51059:(e,t,r)=>{r.d(t,{Z:()=>i});const i={ReadableStream:globalThis.ReadableStream,WritableStream:globalThis.WritableStream,TransformStream:globalThis.TransformStream,DOMException:globalThis.DOMException,Blob:globalThis.Blob,File:globalThis.File}},95599:(e,t,r)=>{r.r(t),r.d(t,{FileSystemDirectoryHandle:()=>m.default,FileSystemFileHandle:()=>y.default,FileSystemHandle:()=>u.Z,FileSystemWritableFileStream:()=>p.Z,getOriginPrivateDirectory:()=>d,showDirectoryPicker:()=>n,showOpenFilePicker:()=>o,showSaveFilePicker:()=>c});const i=globalThis.showDirectoryPicker;const n=async function(e={}){if(i&&!e._preferPolyfill)return i(e);const t=document.createElement("input");if(t.type="file",!("webkitdirectory"in t))throw new Error("HTMLInputElement.webkitdirectory is not supported");t.style.position="fixed",t.style.top="-100000px",t.style.left="-100000px",document.body.appendChild(t),t.webkitdirectory=!0;const n=r.e(2753).then(r.bind(r,52753));return await new Promise((e=>{t.addEventListener("change",e),t.click()})),n.then((e=>e.getDirHandlesFromInput(t)))},a={accepts:[]},s=globalThis.showOpenFilePicker;const o=async function(e={}){const t={...a,...e};if(s&&!e._preferPolyfill)return s(t);const i=document.createElement("input");i.type="file",i.multiple=t.multiple,i.accept=(t.accepts||[]).map((e=>[...(e.extensions||[]).map((e=>"."+e)),...e.mimeTypes||[]])).flat().join(","),i.style.position="fixed",i.style.top="-100000px",i.style.left="-100000px",document.body.appendChild(i);const n=r.e(2753).then(r.bind(r,52753));return await new Promise((e=>{i.addEventListener("change",e),i.click()})),n.then((e=>e.getFileHandlesFromInput(i)))},l=globalThis.showSaveFilePicker;const c=async function(e={}){if(l&&!e._preferPolyfill)return l(e);e._name&&(console.warn("deprecated _name, spec now have `suggestedName`"),e.suggestedName=e._name);const{FileSystemFileHandle:t}=await Promise.resolve().then(r.bind(r,11445)),{FileHandle:i}=await r.e(8850).then(r.bind(r,98850));return new t(new i(e.suggestedName))};globalThis.DataTransferItem&&!DataTransferItem.prototype.getAsFileSystemHandle&&(DataTransferItem.prototype.getAsFileSystemHandle=async function(){const e=this.webkitGetAsEntry(),[{FileHandle:t,FolderHandle:i},{FileSystemDirectoryHandle:n},{FileSystemFileHandle:a}]=await Promise.all([r.e(3208).then(r.bind(r,96093)),Promise.resolve().then(r.bind(r,15532)),Promise.resolve().then(r.bind(r,11445))]);return e.isFile?new a(new t(e,!1)):new n(new i(e,!1))});const d=async function(e,t={}){if(!e)return globalThis.navigator?.storage?.getDirectory()||globalThis.getOriginPrivateDirectory();const{FileSystemDirectoryHandle:i}=await Promise.resolve().then(r.bind(r,15532)),n=await e;return new i(await(n.default?n.default(t):n(t)))};var m=r(15532),y=r(11445),u=r(80954),p=r(93160)}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[5783],{15783:(e,t,r)=>{r.r(t),r.d(t,{default:()=>B});var a=r(5057);const n=(0,r(77650).z)("div")({name:"NumberOverlayEditorStyle",class:"gdg-n15fjm3e",propsAsIs:!1});function o(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var n=0;for(a=Object.getOwnPropertySymbols(e);n<a.length;n++)t.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(e,a[n])&&(r[a[n]]=e[a[n]])}return r}var u;function i(){}function l(e){return!!(e||"").match(/\d/)}function s(e){return null===e||void 0===e}function c(e){return s(e)||function(e){return"number"===typeof e&&isNaN(e)}(e)||"number"===typeof e&&!isFinite(e)}function f(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function v(e,t){void 0===t&&(t=!0);var r="-"===e[0],a=r&&t,n=(e=e.replace("-","")).split(".");return{beforeDecimal:n[0],afterDecimal:n[1]||"",hasNegation:r,addNegation:a}}function d(e,t,r){for(var a="",n=r?"0":"",o=0;o<=t-1;o++)a+=e[o]||n;return a}function g(e,t){return Array(t+1).join(e)}function m(e){var t=e+"",r="-"===t[0]?"-":"";r&&(t=t.substring(1));var a=t.split(/[eE]/g),n=a[0],o=a[1];if(!(o=Number(o)))return r+n;var u=1+o,i=(n=n.replace(".","")).length;return u<0?n="0."+g("0",Math.abs(u))+n:u>=i?n+=g("0",u-i):n=(n.substring(0,u)||"0")+"."+n.substring(u),r+n}function p(e,t,r){if(-1!==["","-"].indexOf(e))return e;var a=(-1!==e.indexOf(".")||r)&&t,n=v(e),o=n.beforeDecimal,u=n.afterDecimal,i=n.hasNegation,l=parseFloat("0."+(u||"0")),s=(u.length<=t?"0."+u:l.toFixed(t)).split(".");return""+(i?"-":"")+o.split("").reverse().reduce((function(e,t,r){return e.length>r?(Number(e[0])+Number(t)).toString()+e.substring(1,e.length):t+e}),s[0])+(a?".":"")+d(s[1]||"",t,r)}function h(e,t){if(e.value=e.value,null!==e){if(e.createTextRange){var r=e.createTextRange();return r.move("character",t),r.select(),!0}return e.selectionStart||0===e.selectionStart?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}!function(e){e.event="event",e.props="prop"}(u||(u={}));var S=function(e){var t,r=void 0;return function(){for(var a=[],n=arguments.length;n--;)a[n]=arguments[n];return t&&a.length===t.length&&a.every((function(e,r){return e===t[r]}))?r:(t=a,r=e.apply(void 0,a))}}((function(e,t){for(var r=0,a=0,n=e.length,o=t.length;e[r]===t[r]&&r<n;)r++;for(;e[n-1-a]===t[o-1-a]&&o-a>r&&n-a>r;)a++;return{from:{start:r,end:n-a},to:{start:r,end:o-a}}}));function b(e){return Math.max(e.selectionStart,e.selectionEnd)}function y(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function V(e){var t=e.currentValue,r=e.formattedValue,a=e.currentValueIndex,n=e.formattedValueIndex;return t[a]===r[n]}function w(e,t,r,a){var n,o,u,i=e.length;if(n=t,o=0,u=i,t=Math.min(Math.max(n,o),u),"left"===a){for(;t>=0&&!r[t];)t--;-1===t&&(t=r.indexOf(!0))}else{for(;t<=i&&!r[t];)t++;t>i&&(t=r.lastIndexOf(!0))}return-1===t&&(t=i),t}function x(e){for(var t=Array.from({length:e.length+1}).map((function(){return!0})),r=0,a=t.length;r<a;r++)t[r]=Boolean(l(e[r])||l(e[r-1]));return t}function N(e,t,r,n,o,u){void 0===u&&(u=i);var l=function(e){var t=(0,a.useRef)(e);t.current=e;var r=(0,a.useRef)((function(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];return t.current.apply(t,e)}));return r.current}((function(e,t){var r,a;return c(e)?(a="",r=""):"number"===typeof e||t?(a="number"===typeof e?m(e):e,r=n(a)):(a=o(e,void 0),r=n(a)),{formattedValue:r,numAsString:a}})),f=(0,a.useState)((function(){return l(s(e)?t:e,r)})),v=f[0],d=f[1],g=e,p=r;s(e)&&(g=v.numAsString,p=!0);var h=l(g,p);return(0,a.useMemo)((function(){d(h)}),[h.formattedValue]),[v,function(e,t){e.formattedValue!==v.formattedValue&&d({formattedValue:e.formattedValue,numAsString:e.value}),u(e,t)}]}function D(e){return e.replace(/[^0-9]/g,"")}function O(e){return e}function C(e){var t=e.type;void 0===t&&(t="text");var r=e.displayType;void 0===r&&(r="input");var n=e.customInput,s=e.renderText,c=e.getInputRef,f=e.format;void 0===f&&(f=O);var v=e.removeFormatting;void 0===v&&(v=D);var d=e.defaultValue,g=e.valueIsNumericString,m=e.onValueChange,p=e.isAllowed,y=e.onChange;void 0===y&&(y=i);var C=e.onKeyDown;void 0===C&&(C=i);var E=e.onMouseUp;void 0===E&&(E=i);var I=e.onFocus;void 0===I&&(I=i);var T=e.onBlur;void 0===T&&(T=i);var A=e.value,R=e.getCaretBoundary;void 0===R&&(R=x);var j=e.isValidInputCharacter;void 0===j&&(j=l);var B=e.isCharacterSame,F=o(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),k=N(A,d,Boolean(g),f,v,m),M=k[0],P=M.formattedValue,W=M.numAsString,L=k[1],K=(0,a.useRef)({formattedValue:P,numAsString:W}),U=function(e,t){K.current={formattedValue:e.formattedValue,numAsString:e.value},L(e,t)},_=(0,a.useState)(!1),G=_[0],$=_[1],Z=(0,a.useRef)(null),z=(0,a.useRef)({setCaretTimeout:null,focusTimeout:null});(0,a.useEffect)((function(){return $(!0),function(){clearTimeout(z.current.setCaretTimeout),clearTimeout(z.current.focusTimeout)}}),[]);var q=f,H=function(e,t){var r=parseFloat(t);return{formattedValue:e,value:t,floatValue:isNaN(r)?void 0:r}},J=function(e,t,r){0===e.selectionStart&&e.selectionEnd===e.value.length||(h(e,t),z.current.setCaretTimeout=setTimeout((function(){e.value===r&&e.selectionStart!==e.selectionEnd&&h(e,t)}),0))},Q=function(e,t,r){return w(e,t,R(e),r)},X=function(e,t,r){var a=R(t),n=function(e,t,r,a,n,o,u){void 0===u&&(u=V);var i=n.findIndex((function(e){return e})),l=e.slice(0,i);t||r.startsWith(l)||(t=l,r=l+r,a+=l.length);for(var s=r.length,c=e.length,f={},v=new Array(s),d=0;d<s;d++){v[d]=-1;for(var g=0,m=c;g<m;g++)if(u({currentValue:r,lastValue:t,formattedValue:e,currentValueIndex:d,formattedValueIndex:g})&&!0!==f[g]){v[d]=g,f[g]=!0;break}}for(var p=a;p<s&&(-1===v[p]||!o(r[p]));)p++;var h=p===s||-1===v[p]?c:v[p];for(p=a-1;p>0&&-1===v[p];)p--;var S=-1===p||-1===v[p]?0:v[p]+1;return S>h?h:a-S<h-a?S:h}(t,P,e,r,a,j,B);return n=w(t,n,a)};(0,a.useEffect)((function(){var e=K.current,t=e.formattedValue,r=e.numAsString;P===t||P===W&&t===r||U(H(P,W),{event:void 0,source:u.props})}),[P,W]);var Y=Z.current?b(Z.current):void 0;("undefined"!==typeof window?a.useLayoutEffect:a.useEffect)((function(){var e=Z.current;if(P!==K.current.formattedValue&&e){var t=X(K.current.formattedValue,P,Y);e.value=P,J(e,t,P)}}),[P]);var ee=function(e,t,r){var a=S(P,e),n=Object.assign(Object.assign({},a),{lastValue:P}),o=v(e,n),u=q(o);if(o=v(u,void 0),p&&!p(H(u,o))){var i=t.target,l=b(i),s=X(e,P,l);return i.value=P,J(i,s,P),!1}return function(e){var t=e.formattedValue;void 0===t&&(t="");var r=e.input,a=e.setCaretPosition;void 0===a&&(a=!0);var n=e.source,o=e.event,u=e.numAsString,i=e.caretPos;if(r){if(void 0===i&&a){var l=e.inputValue||r.value,s=b(r);r.value=t,i=X(l,t,s)}r.value=t,a&&void 0!==i&&J(r,i,t)}t!==P&&U(H(t,u),{event:o,source:n})}({formattedValue:u,numAsString:o,inputValue:e,event:t,source:r,setCaretPosition:!0,input:t.target}),!0},te=!G||"undefined"===typeof navigator||navigator.platform&&/iPhone|iPod/.test(navigator.platform)?void 0:"numeric",re=Object.assign({inputMode:te},F,{type:t,value:P,onChange:function(e){var t=e.target.value;ee(t,e,u.event)&&y(e)},onKeyDown:function(e){var t,r=e.target,a=e.key,n=r.selectionStart,o=r.selectionEnd,u=r.value;if(void 0===u&&(u=""),"ArrowLeft"===a||"Backspace"===a?t=Math.max(n-1,0):"ArrowRight"===a?t=Math.min(n+1,u.length):"Delete"===a&&(t=n),void 0!==t&&n===o){var i=t;if("ArrowLeft"===a||"ArrowRight"===a)(i=Q(u,t,"ArrowLeft"===a?"left":"right"))!==t&&e.preventDefault();else"Delete"!==a||j(u[t])?"Backspace"!==a||j(u[t])||(i=Q(u,t,"left")):i=Q(u,t,"right");i!==t&&J(r,i,u),e.isUnitTestRun&&J(r,i,u),C(e)}else C(e)},onMouseUp:function(e){var t=e.target,r=t.selectionStart,a=t.selectionEnd,n=t.value;if(void 0===n&&(n=""),r===a){var o=Q(n,r);o!==r&&J(t,o,n)}E(e)},onFocus:function(e){e.persist&&e.persist();var t=e.target;Z.current=t,z.current.focusTimeout=setTimeout((function(){var r=t.selectionStart,a=t.selectionEnd,n=t.value;void 0===n&&(n="");var o=Q(n,r);o===r||0===r&&a===n.length||J(t,o,n),I(e)}),0)},onBlur:function(e){Z.current=null,clearTimeout(z.current.focusTimeout),clearTimeout(z.current.setCaretTimeout),T(e)}});if("text"===r)return s?a.createElement(a.Fragment,null,s(P,F)||null):a.createElement("span",Object.assign({},F,{ref:c}),P);if(n){var ae=n;return a.createElement(ae,Object.assign({},re,{ref:c}))}return a.createElement("input",Object.assign({},re,{ref:c}))}function E(e,t){var r=t.decimalScale,a=t.fixedDecimalScale,n=t.prefix;void 0===n&&(n="");var o=t.suffix;void 0===o&&(o="");var u=t.allowNegative,i=t.thousandsGroupStyle;if(void 0===i&&(i="thousand"),""===e||"-"===e)return e;var l=I(t),s=l.thousandSeparator,c=l.decimalSeparator,f=0!==r&&-1!==e.indexOf(".")||r&&a,g=v(e,u),m=g.beforeDecimal,p=g.afterDecimal,h=g.addNegation;return void 0!==r&&(p=d(p,r,!!a)),s&&(m=function(e,t,r){var a=function(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;default:return/(\d)(?=(\d{3})+(?!\d))/g}}(r),n=e.search(/[1-9]/);return n=-1===n?e.length:n,e.substring(0,n)+e.substring(n,e.length).replace(a,"$1"+t)}(m,s,i)),n&&(m=n+m),o&&(p+=o),h&&(m="-"+m),e=m+(f&&c||"")+p}function I(e){var t=e.decimalSeparator;void 0===t&&(t=".");var r=e.thousandSeparator,a=e.allowedDecimalSeparators;return!0===r&&(r=","),a||(a=[t,"."]),{decimalSeparator:t,thousandSeparator:r,allowedDecimalSeparators:a}}function T(e,t,r){var a;void 0===t&&(t=y(e));var n=r.allowNegative,o=r.prefix;void 0===o&&(o="");var u=r.suffix;void 0===u&&(u="");var i=r.decimalScale,s=t.from,c=t.to,d=c.start,g=c.end,m=I(r),p=m.allowedDecimalSeparators,h=m.decimalSeparator,S=e[g]===h;if(l(e)&&(e===o||e===u)&&""===t.lastValue)return e;if(g-d===1&&-1!==p.indexOf(e[d])){var b=0===i?"":h;e=e.substring(0,d)+b+e.substring(d+1,e.length)}var V=function(e,t,r){var a=!1,n=!1;o.startsWith("-")?a=!1:e.startsWith("--")?(a=!1,n=!0):u.startsWith("-")&&e.length===u.length?a=!1:"-"===e[0]&&(a=!0);var i=a?1:0;return n&&(i=2),i&&(e=e.substring(i),t-=i,r-=i),{value:e,start:t,end:r,hasNegation:a}},w=V(e,d,g),x=w.hasNegation;e=(a=w).value,d=a.start,g=a.end;var N=V(t.lastValue,s.start,s.end),D=N.start,O=N.end,C=N.value,E=e.substring(d,g);!(e.length&&C.length&&(D>C.length-u.length||O<o.length))||E&&u.startsWith(E)||(e=C);var T=0;e.startsWith(o)?T+=o.length:d<o.length&&(T=d),g-=T;var A=(e=e.substring(T)).length,R=e.length-u.length;e.endsWith(u)?A=R:(g>R||g>e.length-u.length)&&(A=g),e=e.substring(0,A),e=function(e,t){void 0===e&&(e="");var r=new RegExp("(-)"),a=new RegExp("(-)(.)*(-)"),n=r.test(e),o=a.test(e);return e=e.replace(/-/g,""),n&&!o&&t&&(e="-"+e),e}(x?"-"+e:e,n),e=(e.match(function(e,t){return new RegExp("(^-)|[0-9]|"+f(e),t?"g":void 0)}(h,!0))||[]).join("");var j=e.indexOf(h),B=v(e=e.replace(new RegExp(f(h),"g"),(function(e,t){return t===j?".":""})),n),F=B.beforeDecimal,k=B.afterDecimal,M=B.addNegation;return c.end-c.start<s.end-s.start&&""===F&&S&&!parseFloat(k)&&(e=M?"-":""),e}function A(e){e=function(e){var t=I(e),r=t.thousandSeparator,a=t.decimalSeparator,n=e.prefix;void 0===n&&(n="");var o=e.allowNegative;if(void 0===o&&(o=!0),r===a)throw new Error("\n Decimal separator can't be same as thousand separator.\n thousandSeparator: "+r+' (thousandSeparator = {true} is same as thousandSeparator = ",")\n decimalSeparator: '+a+" (default value for decimalSeparator is .)\n ");return n.startsWith("-")&&o&&(console.error("\n Prefix can't start with '-' when allowNegative is true.\n prefix: "+n+"\n allowNegative: "+o+"\n "),o=!1),Object.assign(Object.assign({},e),{allowNegative:o})}(e);e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,r=e.allowNegative,a=e.allowLeadingZeros,n=e.onKeyDown;void 0===n&&(n=i);var f=e.onBlur;void 0===f&&(f=i);var v=e.thousandSeparator,d=e.decimalScale,g=e.fixedDecimalScale,b=e.prefix;void 0===b&&(b="");var y=e.defaultValue,V=e.value,w=e.valueIsNumericString,x=e.onValueChange,D=o(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),O=I(e),C=O.decimalSeparator,A=O.allowedDecimalSeparators,R=function(t){return E(t,e)},j=function(t,r){return T(t,r,e)},B=s(V)?y:V,F=null!==w&&void 0!==w?w:function(e,t,r){return""===e||!(null===t||void 0===t?void 0:t.match(/\d/))&&!(null===r||void 0===r?void 0:r.match(/\d/))&&"string"===typeof e&&!isNaN(Number(e))}(B,b,t);s(V)?s(y)||(F=F||"number"===typeof y):F=F||"number"===typeof V;var k=function(e){return c(e)?e:("number"===typeof e&&(e=m(e)),F&&"number"===typeof d?p(e,d,Boolean(g)):e)},M=N(k(V),k(y),Boolean(F),R,j,x),P=M[0],W=P.numAsString,L=P.formattedValue,K=M[1];return Object.assign(Object.assign({},D),{value:L,valueIsNumericString:!1,isValidInputCharacter:function(e){return e===C||l(e)},isCharacterSame:function(e){var t=e.currentValue,r=e.lastValue,a=e.formattedValue,n=e.currentValueIndex,o=e.formattedValueIndex,u=t[n],i=a[o],l=S(r,t).to;return!!(n>=l.start&&n<l.end&&A&&A.includes(u)&&i===C)||u===i},onValueChange:K,format:R,removeFormatting:j,getCaretBoundary:function(t){return function(e,t){var r=t.prefix;void 0===r&&(r="");var a=t.suffix;void 0===a&&(a="");var n=Array.from({length:e.length+1}).map((function(){return!0})),o="-"===e[0];n.fill(!1,0,r.length+(o?1:0));var u=e.length;return n.fill(!1,u-a.length+1,u+1),n}(t,e)},onKeyDown:function(e){var t=e.target,a=e.key,o=t.selectionStart,u=t.selectionEnd,i=t.value;if(void 0===i&&(i=""),o===u){"Backspace"===a&&"-"===i[0]&&o===b.length+1&&r&&h(t,1),d&&g&&("Backspace"===a&&i[o-1]===C?(h(t,o-1),e.preventDefault()):"Delete"===a&&i[o]===C&&e.preventDefault()),(null===A||void 0===A?void 0:A.includes(a))&&i[o]===C&&h(t,o+1);var l=!0===v?",":v;"Backspace"===a&&i[o-1]===l&&h(t,o-1),"Delete"===a&&i[o]===l&&h(t,o+1),n(e)}else n(e)},onBlur:function(t){var r=W;if(r.match(/\d/g)||(r=""),a||(r=function(e){if(!e)return e;var t="-"===e[0];t&&(e=e.substring(1,e.length));var r=e.split("."),a=r[0].replace(/^0+/,"")||"0",n=r[1]||"";return(t?"-":"")+a+(n?"."+n:"")}(r)),g&&d&&(r=p(r,d,g)),r!==W){var n=E(r,e);K({formattedValue:n,value:r,floatValue:parseFloat(r)},{event:t,source:u.event})}f(t)}})}function R(e){var t=A(e);return a.createElement(C,Object.assign({},t))}function j(){const e=Intl.NumberFormat()?.formatToParts(1.1)?.find((e=>"decimal"===e.type))?.value;return e??"."}const B=e=>{const{value:t,onChange:r,disabled:o,highlight:u,validatedSelection:i,fixedDecimals:l,allowNegative:s,thousandSeparator:c,decimalSeparator:f}=e,v=a.useRef();return a.useLayoutEffect((()=>{if(void 0!==i){const e="number"===typeof i?[i,null]:i;v.current?.setSelectionRange(e[0],e[1])}}),[i]),a.createElement(n,null,a.createElement(R,{autoFocus:!0,getInputRef:v,className:"gdg-input",onFocus:e=>e.target.setSelectionRange(u?0:e.target.value.length,e.target.value.length),disabled:!0===o,decimalScale:l,allowNegative:s,thousandSeparator:c??("."===j()?",":"."),decimalSeparator:f??j(),value:Object.is(t,-0)?"-":t??"",onValueChange:r}))}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[6134],{26134:(e,t,r)=>{r.r(t),r.d(t,{default:()=>o});var s=r(5057),a=r(60913),i=r(94046),n=r(8230),l=r(96266);const d=528;function o(e){let{element:t,width:r,endpoints:o}=e;const c=(0,s.useRef)(null),{type:u,url:h,startTime:m,subtitles:f}=t,p=(0,n.O0)(h);(0,s.useEffect)((()=>{c.current&&(c.current.currentTime=m)}),[m]),(0,s.useEffect)((()=>{const e=c.current,r=()=>{e&&(e.currentTime=t.startTime)};return e&&e.addEventListener("loadedmetadata",r),()=>{e&&e.removeEventListener("loadedmetadata",r)}}),[t]);const k=e=>{const{startTime:r}=t;return r?"".concat(e,"?start=").concat(r):e};if(u===a.nk.Type.YOUTUBE_IFRAME){const e=0!==r?.75*r:d;return(0,l.jsx)("iframe",{"data-testid":"stVideo",title:p,src:k(p),width:r,height:e,style:{colorScheme:"light dark"},frameBorder:"0",allow:"autoplay; encrypted-media",allowFullScreen:!0})}return(0,l.jsx)("video",{"data-testid":"stVideo",ref:c,controls:!0,src:o.buildMediaURL(p),className:"stVideo",style:{width:r,height:0===r?d:void 0},crossOrigin:i.td&&f.length>0?"anonymous":void 0,children:f&&f.map(((e,t)=>(0,l.jsx)("track",{kind:"captions",src:o.buildMediaURL(e.url),label:e.label,default:0===t},t)))})}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[7125],{69212:(e,t,i)=>{i.d(t,{$:()=>p,Z:()=>c});var s=i(5057),l=i(47206),n=i(31808),a=i(96601),r=i(16449),o=i(80099),d=i(96266);let p=function(e){return e.EXTRASMALL="xs",e.SMALL="sm",e.MEDIUM="md",e.LARGE="lg",e.EXTRALARGE="xl",e}({});const c=function(e){let{value:t,width:i,size:c=p.SMALL,overrides:g}=e;const h=(0,l.u)(),u={xs:h.spacing.twoXS,sm:h.spacing.sm,md:h.spacing.lg,lg:h.spacing.xl,xl:h.spacing.twoXL},{activeTheme:m}=s.useContext(n.E),f=!(0,a.MJ)(m),x={BarContainer:{style:{marginTop:h.spacing.none,marginBottom:h.spacing.none,marginRight:h.spacing.none,marginLeft:h.spacing.none}},Bar:{style:e=>{let{$theme:t}=e;return{width:i?i.toString():void 0,marginTop:h.spacing.none,marginBottom:h.spacing.none,marginRight:h.spacing.none,marginLeft:h.spacing.none,height:u[c],backgroundColor:t.colors.progressbarTrackFill,borderTopLeftRadius:h.spacing.twoXS,borderTopRightRadius:h.spacing.twoXS,borderBottomLeftRadius:h.spacing.twoXS,borderBottomRightRadius:h.spacing.twoXS}}},BarProgress:{style:()=>({backgroundColor:f?h.colors.primary:h.colors.blue70,borderTopLeftRadius:h.spacing.twoXS,borderTopRightRadius:h.spacing.twoXS,borderBottomLeftRadius:h.spacing.twoXS,borderBottomRightRadius:h.spacing.twoXS})}};return(0,d.jsx)(r.Z,{value:t,overrides:(0,o.aO)(x,g)})}},61914:(e,t,i)=>{i.d(t,{R:()=>s});class s{setStatus(e){return new s(this.name,this.size,this.id,e)}constructor(e,t,i,s){this.name=void 0,this.size=void 0,this.status=void 0,this.id=void 0,this.name=e,this.size=t,this.id=i,this.status=s}}},97125:(e,t,i)=>{i.r(t),i.d(t,{default:()=>he});var s=i(51673),l=i(50482),n=i.n(l),a=i(38954),r=i.n(a),o=i(5057),d=i(60913),p=i(52955),c=i(50120);let g=function(e){return e.Gigabyte="gb",e.Megabyte="mb",e.Kilobyte="kb",e.Byte="b",e}({});const h=(0,c.rA)()?1024:1e3,u=[g.Gigabyte,g.Megabyte,g.Kilobyte,g.Byte],m=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(t||(t=g.Byte),i<0&&(i=0),e<0)throw new Error("Size must be greater than or equal to 0");const s=u.indexOf(t);return s&&e>h/2?m(e/h,u[s-1],i):"".concat(e.toFixed(i)).concat(t.toUpperCase())};var f=i(38944),x=i(93905),w=i(21034),b=i(98790),y=i(49525),F=i(38830),S=i(44088),v=i(82160);const j=(0,v.Z)("section",{target:"e1b2p2ww15"})((e=>{let{isDisabled:t,theme:i}=e;return{display:"flex",alignItems:"center",padding:i.spacing.lg,backgroundColor:i.colors.secondaryBg,borderRadius:i.radii.lg,":focus":{outline:"none"},":focus-visible":{boxShadow:"0 0 0 1px ".concat(i.colors.primary)},color:t?i.colors.gray:i.colors.bodyText}}),""),I=(0,v.Z)("div",{target:"e1b2p2ww14"})((()=>({marginRight:"auto",alignItems:"center",display:"flex"})),""),U=(0,v.Z)("span",{target:"e1b2p2ww13"})((e=>{let{theme:t}=e;return{color:t.colors.darkenedBgMix100,marginRight:t.spacing.lg}}),""),M=(0,v.Z)("span",{target:"e1b2p2ww12"})((e=>{let{theme:t}=e;return{marginBottom:t.spacing.twoXS}}),""),z=(0,v.Z)("div",{target:"e1b2p2ww11"})({name:"1fttcpj",styles:"display:flex;flex-direction:column"}),L=(0,v.Z)("div",{target:"e1b2p2ww10"})((e=>{let{theme:t}=e;return{left:0,right:0,lineHeight:t.lineHeights.tight,paddingTop:t.spacing.md,paddingLeft:t.spacing.lg,paddingRight:t.spacing.lg}}),""),C=(0,v.Z)("ul",{target:"e1b2p2ww9"})((()=>({listStyleType:"none",marginBottom:0})),""),B=(0,v.Z)("li",{target:"e1b2p2ww8"})((e=>{let{theme:t}=e;return{margin:t.spacing.none,padding:t.spacing.none}}),""),Z=(0,v.Z)("div",{target:"e1b2p2ww7"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"baseline",flex:1,paddingLeft:t.spacing.lg,overflow:"hidden"}}),""),R=(0,v.Z)("div",{target:"e1b2p2ww6"})((e=>{let{theme:t}=e;return{marginRight:t.spacing.sm,marginBottom:t.spacing.twoXS,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}),""),k=(0,v.Z)("div",{target:"e1b2p2ww5"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"center",marginBottom:t.spacing.twoXS}}),""),T=(0,v.Z)("span",{target:"e1b2p2ww4"})((e=>{let{theme:t}=e;return{marginRight:t.spacing.twoXS}}),""),D=(0,v.Z)("div",{target:"e1b2p2ww3"})((e=>{let{theme:t}=e;return{display:"flex",padding:t.spacing.twoXS,color:t.colors.darkenedBgMix100}}),""),X=(0,v.Z)("small",{target:"e1b2p2ww2"})((e=>{let{theme:t}=e;return{color:t.colors.danger,fontSize:t.fontSizes.sm,height:t.fontSizes.sm,lineHeight:t.fontSizes.sm,display:"flex",alignItems:"center",whiteSpace:"nowrap"}}),""),P=(0,v.Z)("span",{target:"e1b2p2ww1"})({name:"0",styles:""}),E=e=>({[j]:{display:"flex",flexDirection:"column",alignItems:"flex-start"},[I]:{marginBottom:e.spacing.lg},[U]:{display:"none"},[L]:{paddingRight:e.spacing.lg},[k]:{maxWidth:"inherit",flex:1,alignItems:"flex-start",marginBottom:e.spacing.sm},[R]:{width:e.sizes.full},[Z]:{flexDirection:"column"},[X]:{height:"auto",whiteSpace:"initial"},[P]:{display:"none"},[B]:{margin:e.spacing.none,padding:e.spacing.none}}),A=(0,v.Z)("div",{target:"e1b2p2ww0"})((e=>{let{theme:t}=e;return t.inSidebar?E(t):{["@media (max-width: ".concat(t.breakpoints.sm,")")]:E(t)}}),"");var V=i(44071),N=i(73401),W=i(67600),O=i(96266);const H=e=>{let{multiple:t,acceptedExtensions:i,maxSizeBytes:s}=e;return(0,O.jsxs)(I,{"data-testid":"stFileUploaderDropzoneInstructions",children:[(0,O.jsx)(U,{children:(0,O.jsx)(N.Z,{content:V.n,size:"threeXL"})}),(0,O.jsxs)(z,{children:[(0,O.jsxs)(M,{children:["Drag and drop file",t?"s":""," here"]}),(0,O.jsxs)(W.x,{children:["Limit ".concat(m(s,g.Byte,0)," per file"),i.length?" \u2022 ".concat(i.map((e=>e.replace(/^\./,"").toUpperCase())).join(", ")):null]})]})]})},_=e=>{let{onDrop:t,multiple:i,acceptedExtensions:s,maxSizeBytes:l,disabled:n,label:a}=e;return(0,O.jsx)(y.ZP,{onDrop:t,multiple:i,accept:s.length?s:void 0,maxSize:l,disabled:n,useFsAccessApi:!1,children:e=>{let{getRootProps:t,getInputProps:r}=e;return(0,O.jsxs)(j,{...t(),"data-testid":"stFileUploaderDropzone",isDisabled:n,"aria-label":a,children:[(0,O.jsx)("input",{"data-testid":"stFileUploaderDropzoneInput",...r()}),(0,O.jsx)(H,{multiple:i,acceptedExtensions:s,maxSizeBytes:l}),(0,O.jsx)(F.ZP,{kind:S.nW.SECONDARY,disabled:n,size:S.V5.SMALL,children:"Browse files"})]})}})};var G=i(56129),K=i.n(G),$=i(75427),q=i(5642);const J=(0,v.Z)("div",{target:"e16k0npc1"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:t.spacing.twoXS,marginBottom:t.spacing.twoXS}}),""),Y=(0,v.Z)("div",{target:"e16k0npc0"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"center",justifyContent:"center",color:t.colors.fadedText40}}),""),Q=e=>{let{className:t,currentPage:i,totalPages:s,onNext:l,onPrevious:n}=e;return(0,O.jsxs)(J,{className:t,"data-testid":"stPagination",children:[(0,O.jsx)(W.x,{children:"Showing page ".concat(i," of ").concat(s)}),(0,O.jsxs)(Y,{children:[(0,O.jsx)(F.ZP,{onClick:n,kind:S.nW.MINIMAL,children:(0,O.jsx)(N.Z,{content:$.s,size:"xl"})}),(0,O.jsx)(F.ZP,{onClick:l,kind:S.nW.MINIMAL,children:(0,O.jsx)(N.Z,{content:q._,size:"xl"})})]})]})};var ee=i(15717);const te=(e,t)=>Math.ceil(e.length/t),ie=e=>K()((t=>{let{pageSize:i,items:s,resetOnAdd:l,...n}=t;const[a,r]=(0,o.useState)(0),[d,p]=(0,o.useState)(te(s,i)),c=(0,ee.D)(s);(0,o.useEffect)((()=>{c&&c.length!==s.length&&p(te(s,i)),c&&c.length<s.length?l&&r(0):a+1>=d&&r(d-1)}),[s,a,i,c,l,d]);const g=s.slice(a*i,a*i+i);return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(e,{items:g,...n}),s.length>i?(0,O.jsx)(Q,{className:"streamlit-paginator",pageSize:i,totalPages:d,currentPage:a+1,onNext:()=>{r(Math.min(a+1,d-1))},onPrevious:()=>{r(Math.max(0,a-1))}}):null]})}),e);var se=i(15766),le=i(31906),ne=i(13324),ae=i(69212);const re=e=>{let{fileInfo:t}=e;return"uploading"===t.status.type?(0,O.jsx)(ae.Z,{value:t.status.progress,size:ae.$.SMALL,overrides:{Bar:{style:{marginLeft:0,marginTop:"4px"}}}}):"error"===t.status.type?(0,O.jsxs)(X,{children:[(0,O.jsx)(T,{"data-testid":"stFileUploaderFileErrorMessage",children:t.status.errorMessage}),(0,O.jsx)(P,{children:(0,O.jsx)(N.Z,{content:se.j,size:"lg"})})]}):"uploaded"===t.status.type?(0,O.jsx)(W.x,{children:m(t.size,g.Byte)}):null},oe=e=>{let{fileInfo:t,onDelete:i}=e;return(0,O.jsxs)(k,{className:"stFileUploaderFile","data-testid":"stFileUploaderFile",children:[(0,O.jsx)(D,{children:(0,O.jsx)(N.Z,{content:le.h,size:"twoXL"})}),(0,O.jsxs)(Z,{className:"stFileUploaderFileData",children:[(0,O.jsx)(R,{className:"stFileUploaderFileName","data-testid":"stFileUploaderFileName",title:t.name,children:t.name}),(0,O.jsx)(re,{fileInfo:t})]}),(0,O.jsx)("div",{"data-testid":"stFileUploaderDeleteBtn",children:(0,O.jsx)(F.ZP,{onClick:()=>i(t.id),kind:S.nW.MINIMAL,children:(0,O.jsx)(N.Z,{content:ne.U,size:"lg"})})})]})},de=ie((e=>{let{items:t,onDelete:i}=e;return(0,O.jsx)(C,{children:t.map((e=>(0,O.jsx)(B,{children:(0,O.jsx)(oe,{fileInfo:e,onDelete:i})},e.id)))})})),pe=e=>(0,O.jsx)(L,{children:(0,O.jsx)(de,{...e})});var ce=i(61914);class ge extends o.PureComponent{constructor(e){super(e),this.formClearHelper=new p.K,this.localFileIdCounter=1,this.componentDidUpdate=()=>{if("ready"!==this.status)return;const e=this.createWidgetValue(),{element:t,widgetMgr:i}=this.props,s=i.getFileUploaderStateValue(t);n()(e,s)||i.setFileUploaderStateValue(t,e,{fromUi:!0})},this.reset=()=>{this.setState({files:[]})},this.dropHandler=(e,t)=>{const{element:i}=this.props,{multipleFiles:s}=i;if(!s&&0===e.length&&t.length>1){const i=t.findIndex((e=>1===e.errors.length&&"too-many-files"===e.errors[0].code));i>=0&&(e.push(t[i].file),t.splice(i,1))}if(this.props.uploadClient.fetchFileURLs(e).then((t=>{if(!s&&e.length>0){const e=this.state.files.find((e=>"error"!==e.status.type));e&&this.deleteFile(e.id)}r()(t,e).forEach((e=>{let[t,i]=e;this.uploadFile(t,i)}))})).catch((t=>{this.addFiles(e.map((e=>new ce.R(e.name,e.size,this.nextLocalFileId(),{type:"error",errorMessage:t}))))})),t.length>0){const e=t.map((e=>{const{file:t}=e;return new ce.R(t.name,t.size,this.nextLocalFileId(),{type:"error",errorMessage:this.getErrorMessage(e.errors[0].code,e.file)})}));this.addFiles(e)}},this.uploadFile=(e,t)=>{const i=s.Z.CancelToken.source(),l=new ce.R(t.name,t.size,this.nextLocalFileId(),{type:"uploading",cancelToken:i,progress:1});this.addFile(l),this.props.uploadClient.uploadFile(this.props.element,e.uploadUrl,t,(e=>this.onUploadProgress(e,l.id)),i.token).then((()=>this.onUploadComplete(l.id,e))).catch((e=>{s.Z.isCancel(e)||this.updateFile(l.id,l.setStatus({type:"error",errorMessage:e?e.toString():"Unknown error"}))}))},this.onUploadComplete=(e,t)=>{const i=this.getFile(e);null!=i&&"uploading"===i.status.type&&this.updateFile(i.id,i.setStatus({type:"uploaded",fileId:t.fileId,fileUrls:t}))},this.getErrorMessage=(e,t)=>{switch(e){case"file-too-large":return"File must be ".concat(m(this.maxUploadSizeInBytes,g.Byte)," or smaller.");case"file-invalid-type":return"".concat(t.type," files are not allowed.");case"file-too-small":return"File size is too small.";case"too-many-files":return"Only one file is allowed.";default:return"Unexpected error. Please try again."}},this.deleteFile=e=>{const t=this.getFile(e);null!=t&&("uploading"===t.status.type&&t.status.cancelToken.cancel(),"uploaded"===t.status.type&&t.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(t.status.fileUrls.deleteUrl),this.removeFile(e))},this.addFile=e=>{this.setState((t=>({files:[...t.files,e]})))},this.addFiles=e=>{this.setState((t=>({files:[...t.files,...e]})))},this.removeFile=e=>{this.setState((t=>({files:t.files.filter((t=>t.id!==e))})))},this.getFile=e=>this.state.files.find((t=>t.id===e)),this.updateFile=(e,t)=>{this.setState((i=>({files:i.files.map((i=>i.id===e?t:i))})))},this.onUploadProgress=(e,t)=>{const i=this.getFile(t);if(null==i||"uploading"!==i.status.type)return;const s=Math.round(100*e.loaded/e.total);i.status.progress!==s&&this.updateFile(t,i.setStatus({type:"uploading",cancelToken:i.status.cancelToken,progress:s}))},this.onFormCleared=()=>{this.setState({files:[]},(()=>{const e=this.createWidgetValue();null!=e&&this.props.widgetMgr.setFileUploaderStateValue(this.props.element,e,{fromUi:!0})}))},this.state=this.initialValue}get initialValue(){const e={files:[],newestServerFileId:0},{widgetMgr:t,element:i}=this.props,s=t.getFileUploaderStateValue(i);if(null==s)return e;const{uploadedFileInfo:l}=s;return null==l||0===l.length?e:{files:l.map((e=>{const t=e.name,i=e.size,s=e.fileId,l=e.fileUrls;return new ce.R(t,i,this.nextLocalFileId(),{type:"uploaded",fileId:s,fileUrls:l})}))}}componentWillUnmount(){this.formClearHelper.disconnect()}get maxUploadSizeInBytes(){return((e,t,i)=>{if(e<0)throw Error("Size must be 0 or greater");const s=u.findIndex((e=>e===t)),l=u.findIndex((e=>e===i));if(-1===s||-1===l)throw Error("Unexpected byte unit provided");if(s===l)return e;const n=Math.abs(s-l),a=h**n;return s>l?e/a:e*a})(this.props.element.maxUploadSizeMb,g.Megabyte,g.Byte)}get status(){return this.state.files.some((e=>"uploading"===e.status.type))?"updating":"ready"}componentDidMount(){const e=this.createWidgetValue(),{element:t,widgetMgr:i}=this.props;void 0===i.getFileUploaderStateValue(t)&&i.setFileUploaderStateValue(t,e,{fromUi:!1})}createWidgetValue(){const e=this.state.files.filter((e=>"uploaded"===e.status.type)).map((e=>{const{name:t,size:i,status:s}=e,{fileId:l,fileUrls:n}=s;return new d.jM({fileId:l,fileUrls:n,name:t,size:i})}));return new d.xO({uploadedFileInfo:e})}render(){var e;const{files:t}=this.state,{element:i,disabled:s,widgetMgr:l}=this.props,n=i.type;this.formClearHelper.manageFormClearListener(l,i.formId,this.onFormCleared);const a=t.slice().reverse();return(0,O.jsxs)(A,{"data-testid":"stFileUploader",children:[(0,O.jsx)(f.O,{label:i.label,disabled:s,labelVisibility:(0,c.iF)(null===(e=i.labelVisibility)||void 0===e?void 0:e.value),children:i.help&&(0,O.jsx)(x.dT,{children:(0,O.jsx)(w.Z,{content:i.help,placement:b.u.TOP_RIGHT})})}),(0,O.jsx)(_,{onDrop:this.dropHandler,multiple:i.multipleFiles,acceptedExtensions:n,maxSizeBytes:this.maxUploadSizeInBytes,label:i.label,disabled:s}),a.length>0&&(0,O.jsx)(pe,{items:a,pageSize:3,onDelete:this.deleteFile,resetOnAdd:!0})]})}nextLocalFileId(){return this.localFileIdCounter++}}const he=ge},52955:(e,t,i)=>{i.d(t,{K:()=>l});var s=i(50120);class l{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,i){null!=this.formClearListener&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,s.bM)(t)&&(this.formClearListener=e.addFormClearedListener(t,i),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}}}]);
@@ -1 +1 @@
1
- (()=>{"use strict";var e={56977:e=>{function t(e){if("string"!==typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function r(e,t){for(var r,n="",o=0,s=-1,a=0,l=0;l<=e.length;++l){if(l<e.length)r=e.charCodeAt(l);else{if(47===r)break;r=47}if(47===r){if(s===l-1||1===a);else if(s!==l-1&&2===a){if(n.length<2||2!==o||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var i=n.lastIndexOf("/");if(i!==n.length-1){-1===i?(n="",o=0):o=(n=n.slice(0,i)).length-1-n.lastIndexOf("/"),s=l,a=0;continue}}else if(2===n.length||1===n.length){n="",o=0,s=l,a=0;continue}t&&(n.length>0?n+="/..":n="..",o=2)}else n.length>0?n+="/"+e.slice(s+1,l):n=e.slice(s+1,l),o=l-s-1;s=l,a=0}else 46===r&&-1!==a?++a:a=-1}return n}var n={resolve:function(){for(var e,n="",o=!1,s=arguments.length-1;s>=-1&&!o;s--){var a;s>=0?a=arguments[s]:(void 0===e&&(e=process.cwd()),a=e),t(a),0!==a.length&&(n=a+"/"+n,o=47===a.charCodeAt(0))}return n=r(n,!o),o?n.length>0?"/"+n:"/":n.length>0?n:"."},normalize:function(e){if(t(e),0===e.length)return".";var n=47===e.charCodeAt(0),o=47===e.charCodeAt(e.length-1);return 0!==(e=r(e,!n)).length||n||(e="."),e.length>0&&o&&(e+="/"),n?"/"+e:e},isAbsolute:function(e){return t(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,r=0;r<arguments.length;++r){var o=arguments[r];t(o),o.length>0&&(void 0===e?e=o:e+="/"+o)}return void 0===e?".":n.normalize(e)},relative:function(e,r){if(t(e),t(r),e===r)return"";if((e=n.resolve(e))===(r=n.resolve(r)))return"";for(var o=1;o<e.length&&47===e.charCodeAt(o);++o);for(var s=e.length,a=s-o,l=1;l<r.length&&47===r.charCodeAt(l);++l);for(var i=r.length-l,c=a<i?a:i,g=-1,d=0;d<=c;++d){if(d===c){if(i>c){if(47===r.charCodeAt(l+d))return r.slice(l+d+1);if(0===d)return r.slice(l+d)}else a>c&&(47===e.charCodeAt(o+d)?g=d:0===d&&(g=0));break}var p=e.charCodeAt(o+d);if(p!==r.charCodeAt(l+d))break;47===p&&(g=d)}var h="";for(d=o+g+1;d<=s;++d)d!==s&&47!==e.charCodeAt(d)||(0===h.length?h+="..":h+="/..");return h.length>0?h+r.slice(l+g):(l+=g,47===r.charCodeAt(l)&&++l,r.slice(l))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return".";for(var r=e.charCodeAt(0),n=47===r,o=-1,s=!0,a=e.length-1;a>=1;--a)if(47===(r=e.charCodeAt(a))){if(!s){o=a;break}}else s=!1;return-1===o?n?"/":".":n&&1===o?"//":e.slice(0,o)},basename:function(e,r){if(void 0!==r&&"string"!==typeof r)throw new TypeError('"ext" argument must be a string');t(e);var n,o=0,s=-1,a=!0;if(void 0!==r&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var l=r.length-1,i=-1;for(n=e.length-1;n>=0;--n){var c=e.charCodeAt(n);if(47===c){if(!a){o=n+1;break}}else-1===i&&(a=!1,i=n+1),l>=0&&(c===r.charCodeAt(l)?-1===--l&&(s=n):(l=-1,s=i))}return o===s?s=i:-1===s&&(s=e.length),e.slice(o,s)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!a){o=n+1;break}}else-1===s&&(a=!1,s=n+1);return-1===s?"":e.slice(o,s)},extname:function(e){t(e);for(var r=-1,n=0,o=-1,s=!0,a=0,l=e.length-1;l>=0;--l){var i=e.charCodeAt(l);if(47!==i)-1===o&&(s=!1,o=l+1),46===i?-1===r?r=l:1!==a&&(a=1):-1!==r&&(a=-1);else if(!s){n=l+1;break}}return-1===r||-1===o||0===a||1===a&&r===o-1&&r===n+1?"":e.slice(r,o)},format:function(e){if(null===e||"object"!==typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+e+n:n}("/",e)},parse:function(e){t(e);var r={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return r;var n,o=e.charCodeAt(0),s=47===o;s?(r.root="/",n=1):n=0;for(var a=-1,l=0,i=-1,c=!0,g=e.length-1,d=0;g>=n;--g)if(47!==(o=e.charCodeAt(g)))-1===i&&(c=!1,i=g+1),46===o?-1===a?a=g:1!==d&&(d=1):-1!==a&&(d=-1);else if(!c){l=g+1;break}return-1===a||-1===i||0===d||1===d&&a===i-1&&a===l+1?-1!==i&&(r.base=r.name=0===l&&s?e.slice(1,i):e.slice(l,i)):(0===l&&s?(r.name=e.slice(1,a),r.base=e.slice(1,i)):(r.name=e.slice(l,a),r.base=e.slice(l,i)),r.ext=e.slice(a,i)),l>0?r.dir=e.slice(0,l-1):s&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};n.posix=n,e.exports=n}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e=r(56977),t=r.n(e);function n(e,r){const n=t().normalize(r),o=t().dirname(n).split("/"),s=[];for(const t of o){s.push(t);const r=s.join("/");if(e.FS.analyzePath(r).exists){if(e.FS.isDir(r))throw new Error(`"${r}" already exists and is not a directory.`)}else try{e.FS.mkdir(r)}catch(a){throw console.error(`Failed to create a directory "${r}"`),a}}}function o(e,t,r,o){n(e,t),e.FS.writeFile(t,r,o)}function s(e){e.forEach((e=>{let t;try{t=new URL(e)}catch(r){return}if("emfs:"===t.protocol||"file:"===t.protocol)throw new Error(`"emfs:" and "file:" protocols are not allowed for the requirement (${e})`)}))}function a(e){e.runPython('\nimport micropip\nmicropip.add_mock_package(\n "pyarrow", "0.0.1",\n modules={\n "pyarrow": """\n__version__ = \'0.0.1\' # TODO: Update when releasing\n\n\nclass Table:\n @classmethod\n def from_pandas(*args, **kwargs):\n raise NotImplementedError("stlite is not supporting this method.")\n"""\n }\n)\n')}var l=function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function a(e){try{i(n.next(e))}catch(t){s(t)}}function l(e){try{i(n.throw(e))}catch(t){s(t)}}function i(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,l)}i((n=n.apply(e,t||[])).next())}))};let i,c;const g=self,d=new class{constructor(){this.promise=new Promise(((e,t)=>{this.resolveInternal=e,this.rejectInternal=t}))}resolve(e){this.resolveInternal(e)}reject(e){this.rejectInternal(e)}};function p(e){g.postMessage({type:"event:progress",data:{message:e}})}const h="https://cdn.jsdelivr.net/pyodide/v0.24.1/full/pyodide.js";const m=function(){var e,t;return l(this,void 0,void 0,(function*(){const{entrypoint:r,files:n,archives:m,requirements:u,wheels:f,mountedSitePackagesSnapshotFilePath:_,pyodideUrl:y=h,streamlitConfig:v}=yield d.promise;if(p("Loading Pyodide."),console.debug("Loading Pyodide"),i=yield function(e,t){return l(this,void 0,void 0,(function*(){const r=e.slice(0,e.lastIndexOf("/")+1);let n;return e.endsWith(".mjs")?n=(yield import(e)).loadPyodide:(importScripts(e),n=self.loadPyodide),n(Object.assign(Object.assign({},t),{indexURL:r}))}))}(y,{stdout:console.log,stderr:console.error}),console.debug("Loaded Pyodide"),p("Mounting files."),yield Promise.all(Object.keys(n).map((e=>l(this,void 0,void 0,(function*(){const t=n[e];let r;"url"in t?(console.debug(`Fetch a file from ${t.url}`),r=yield fetch(t.url).then((e=>e.arrayBuffer())).then((e=>new Uint8Array(e)))):r=t.data;const{opts:s}=n[e];console.debug(`Write a file "${e}"`),o(i,e,r,s)}))))),p("Unpacking archives."),yield Promise.all(m.map((e=>l(this,void 0,void 0,(function*(){let t;"url"in e?(console.debug(`Fetch an archive from ${e.url}`),t=yield fetch(e.url).then((e=>e.arrayBuffer()))):t=e.buffer;const{format:r,options:n}=e;console.debug("Unpack an archive",{format:r,options:n}),i.unpackArchive(t,r,n)}))))),!_&&!f)throw new Error("Neither snapshot nor wheel files are provided.");_&&(p("Restoring the snapshot."),yield i.runPythonAsync("import tarfile, shutil, site"),yield i.runPythonAsync("\n site_packages_dirs = site.getsitepackages()\n for site_packages in site_packages_dirs:\n shutil.rmtree(site_packages)\n "),console.debug(`Unarchive ${_}`),yield i.runPythonAsync(`\n with tarfile.open("${_}", "r") as tar_gz_file:\n tar_gz_file.extractall("/")\n `),console.debug("Restored the snapshot"),p("Mocking some packages."),console.debug("Mock pyarrow"),a(i),console.debug("Mocked pyarrow")),s(u),p("Installing packages."),yield i.loadPackage("micropip");const b=i.pyimport("micropip");f?(console.debug("Installing the wheels:",f,"and the requirements:",u),yield b.install.callKwargs([f.stliteServer,f.streamlit,...u],{keep_going:!0}),console.debug("Installed the wheels and the requirements"),p("Mocking some packages."),console.debug("Mock pyarrow"),a(i),console.debug("Mocked pyarrow")):(console.debug("Installing the requirements:",u),yield b.install.callKwargs(u,{keep_going:!0}),console.debug("Installed the requirements")),yield i.runPythonAsync("\n import importlib\n importlib.invalidate_caches()\n "),p("Loading streamlit package."),console.debug("Loading the Streamlit package"),yield i.runPythonAsync("\n import streamlit.runtime\n import streamlit.web\n "),console.debug("Loaded the Streamlit package"),p("Setting up the loggers."),console.debug("Setting the loggers"),yield i.runPythonAsync('\n import logging\n import streamlit.logger\n\n streamlit.logger.get_logger = logging.getLogger\n streamlit.logger.setup_formatter = None\n streamlit.logger.update_formatter = lambda *a, **k: None\n streamlit.logger.set_log_level = lambda *a, **k: None\n\n for name in streamlit.logger._loggers.keys():\n if name == "root":\n name = "streamlit"\n logger = logging.getLogger(name)\n logger.propagate = True\n logger.handlers.clear()\n logger.setLevel(logging.NOTSET)\n\n streamlit.logger._loggers = {}\n ');self.__logCallback__=(e,t)=>{e>=40?console.error(t):e>=30?console.warn(t):e>=20?console.info(t):console.debug(t)},yield i.runPythonAsync('\ndef setup_loggers(streamlit_level, streamlit_message_format):\n from js import __logCallback__\n\n\n class JsHandler(logging.Handler):\n def emit(self, record):\n msg = self.format(record)\n __logCallback__(record.levelno, msg)\n\n\n root_message_format = "%(levelname)s:%(name)s:%(message)s"\n\n root_logger = logging.getLogger()\n root_logger.handlers.clear()\n root_formatter = logging.Formatter(root_message_format)\n root_handler = JsHandler()\n root_handler.setFormatter(root_formatter)\n root_logger.addHandler(root_handler)\n root_logger.setLevel(logging.DEBUG)\n\n streamlit_logger = logging.getLogger("streamlit")\n streamlit_logger.propagate = False\n streamlit_logger.handlers.clear()\n streamlit_formatter = logging.Formatter(streamlit_message_format)\n streamlit_handler = JsHandler()\n streamlit_handler.setFormatter(streamlit_formatter)\n streamlit_logger.addHandler(streamlit_handler)\n streamlit_logger.setLevel(streamlit_level.upper())\n ');const k=(null!==(e=null===v||void 0===v?void 0:v["logger.level"])&&void 0!==e?e:"INFO").toString(),w=null!==(t=null===v||void 0===v?void 0:v["logger.messageFormat"])&&void 0!==t?t:"%(asctime)s %(message)s";i.globals.get("setup_loggers")(k,w),console.debug("Set the loggers"),p("Mocking some Streamlit functions for the browser environment."),console.debug("Mocking some Streamlit functions"),yield i.runPythonAsync("\n import streamlit\n\n def is_cacheable_msg(msg):\n return False\n\n streamlit.runtime.runtime.is_cacheable_msg = is_cacheable_msg\n "),console.debug("Mocked some Streamlit functions"),p("Booting up the Streamlit server."),console.debug("Booting up the Streamlit server"),self.__streamlitFlagOptions__=Object.assign(Object.assign({"browser.gatherUsageStats":!1},v),{"runner.fastReruns":!1}),yield i.runPythonAsync(`\n from stlite_server.bootstrap import load_config_options, prepare\n from stlite_server.server import Server\n from js import __streamlitFlagOptions__\n\n flag_options = __streamlitFlagOptions__.to_py()\n load_config_options(flag_options)\n\n main_script_path = "${r}"\n command_line = None\n args = []\n\n prepare(main_script_path, args)\n\n server = Server(main_script_path, command_line)\n server.start()\n `),console.debug("Booted up the Streamlit server"),console.debug("Setting up the HTTP server"),c=i.globals.get("server").copy(),console.debug("Set up the HTTP server"),g.postMessage({type:"event:loaded"})}))}().catch((e=>{throw g.postMessage({type:"event:error",data:{error:e}}),e}));self.onmessage=e=>l(void 0,void 0,void 0,(function*(){const t=e.data;if("initData"===t.type)return void d.resolve(t.data);yield m;const r=e.ports[0];try{switch(t.type){case"websocket:connect":{console.debug("websocket:connect",t.data);const{path:e}=t.data;c.start_websocket(e,((e,t)=>{if(t){const t=e.getBuffer("u8");e.destroy();const r=new Uint8ClampedArray(t.data.buffer,t.data.byteOffset,t.data.byteLength);g.postMessage({type:"websocket:message",data:{payload:new Uint8Array(r)}})}else g.postMessage({type:"websocket:message",data:{payload:e}})})),r.postMessage({type:"reply"});break}case"websocket:send":{console.debug("websocket:send",t.data);const{payload:e}=t.data;c.receive_websocket_from_js(e);break}case"http:request":{console.debug("http:request",t.data);const{request:e}=t.data,n=(e,t,n)=>{const o=t.toJs(),s=n.toJs();console.debug({statusCode:e,headers:o,body:s});const a={type:"http:response",data:{response:{statusCode:e,headers:o,body:s}}};r.postMessage(a)};c.receive_http_from_js(e.method,decodeURIComponent(e.path),e.headers,e.body,n);break}case"file:write":{const{path:e,data:n,opts:s}=t.data;console.debug(`Write a file "${e}"`),o(i,e,n,s),r.postMessage({type:"reply"});break}case"file:rename":{const{oldPath:e,newPath:o}=t.data;console.debug(`Rename "${e}" to ${o}`),function(e,t,r){n(e,r),e.FS.rename(t,r)}(i,e,o),r.postMessage({type:"reply"});break}case"file:unlink":{const{path:e}=t.data;console.debug(`Remove "${e}`),i.FS.unlink(e),r.postMessage({type:"reply"});break}case"install":{const{requirements:e}=t.data,n=i.pyimport("micropip");console.debug("Install the requirements:",e),s(e),yield n.install.callKwargs(e,{keep_going:!0}).then((()=>{if(e.includes("matplotlib"))return i.runPythonAsync("\n from stlite_server.bootstrap import _fix_matplotlib_crash\n _fix_matplotlib_crash()\n ")})).then((()=>{console.debug("Successfully installed"),r.postMessage({type:"reply"})}))}}}catch(a){if(console.error(a),!(a instanceof Error))throw a;const e=new Error(a.message);e.name=a.name,e.stack=a.stack,r.postMessage({type:"reply",error:e})}})),g.postMessage({type:"event:start"})})()})();
1
+ (()=>{"use strict";var e={56977:e=>{function t(e){if("string"!==typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function r(e,t){for(var r,n="",o=0,s=-1,a=0,l=0;l<=e.length;++l){if(l<e.length)r=e.charCodeAt(l);else{if(47===r)break;r=47}if(47===r){if(s===l-1||1===a);else if(s!==l-1&&2===a){if(n.length<2||2!==o||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var i=n.lastIndexOf("/");if(i!==n.length-1){-1===i?(n="",o=0):o=(n=n.slice(0,i)).length-1-n.lastIndexOf("/"),s=l,a=0;continue}}else if(2===n.length||1===n.length){n="",o=0,s=l,a=0;continue}t&&(n.length>0?n+="/..":n="..",o=2)}else n.length>0?n+="/"+e.slice(s+1,l):n=e.slice(s+1,l),o=l-s-1;s=l,a=0}else 46===r&&-1!==a?++a:a=-1}return n}var n={resolve:function(){for(var e,n="",o=!1,s=arguments.length-1;s>=-1&&!o;s--){var a;s>=0?a=arguments[s]:(void 0===e&&(e=process.cwd()),a=e),t(a),0!==a.length&&(n=a+"/"+n,o=47===a.charCodeAt(0))}return n=r(n,!o),o?n.length>0?"/"+n:"/":n.length>0?n:"."},normalize:function(e){if(t(e),0===e.length)return".";var n=47===e.charCodeAt(0),o=47===e.charCodeAt(e.length-1);return 0!==(e=r(e,!n)).length||n||(e="."),e.length>0&&o&&(e+="/"),n?"/"+e:e},isAbsolute:function(e){return t(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,r=0;r<arguments.length;++r){var o=arguments[r];t(o),o.length>0&&(void 0===e?e=o:e+="/"+o)}return void 0===e?".":n.normalize(e)},relative:function(e,r){if(t(e),t(r),e===r)return"";if((e=n.resolve(e))===(r=n.resolve(r)))return"";for(var o=1;o<e.length&&47===e.charCodeAt(o);++o);for(var s=e.length,a=s-o,l=1;l<r.length&&47===r.charCodeAt(l);++l);for(var i=r.length-l,c=a<i?a:i,g=-1,d=0;d<=c;++d){if(d===c){if(i>c){if(47===r.charCodeAt(l+d))return r.slice(l+d+1);if(0===d)return r.slice(l+d)}else a>c&&(47===e.charCodeAt(o+d)?g=d:0===d&&(g=0));break}var h=e.charCodeAt(o+d);if(h!==r.charCodeAt(l+d))break;47===h&&(g=d)}var p="";for(d=o+g+1;d<=s;++d)d!==s&&47!==e.charCodeAt(d)||(0===p.length?p+="..":p+="/..");return p.length>0?p+r.slice(l+g):(l+=g,47===r.charCodeAt(l)&&++l,r.slice(l))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return".";for(var r=e.charCodeAt(0),n=47===r,o=-1,s=!0,a=e.length-1;a>=1;--a)if(47===(r=e.charCodeAt(a))){if(!s){o=a;break}}else s=!1;return-1===o?n?"/":".":n&&1===o?"//":e.slice(0,o)},basename:function(e,r){if(void 0!==r&&"string"!==typeof r)throw new TypeError('"ext" argument must be a string');t(e);var n,o=0,s=-1,a=!0;if(void 0!==r&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var l=r.length-1,i=-1;for(n=e.length-1;n>=0;--n){var c=e.charCodeAt(n);if(47===c){if(!a){o=n+1;break}}else-1===i&&(a=!1,i=n+1),l>=0&&(c===r.charCodeAt(l)?-1===--l&&(s=n):(l=-1,s=i))}return o===s?s=i:-1===s&&(s=e.length),e.slice(o,s)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!a){o=n+1;break}}else-1===s&&(a=!1,s=n+1);return-1===s?"":e.slice(o,s)},extname:function(e){t(e);for(var r=-1,n=0,o=-1,s=!0,a=0,l=e.length-1;l>=0;--l){var i=e.charCodeAt(l);if(47!==i)-1===o&&(s=!1,o=l+1),46===i?-1===r?r=l:1!==a&&(a=1):-1!==r&&(a=-1);else if(!s){n=l+1;break}}return-1===r||-1===o||0===a||1===a&&r===o-1&&r===n+1?"":e.slice(r,o)},format:function(e){if(null===e||"object"!==typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+e+n:n}("/",e)},parse:function(e){t(e);var r={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return r;var n,o=e.charCodeAt(0),s=47===o;s?(r.root="/",n=1):n=0;for(var a=-1,l=0,i=-1,c=!0,g=e.length-1,d=0;g>=n;--g)if(47!==(o=e.charCodeAt(g)))-1===i&&(c=!1,i=g+1),46===o?-1===a?a=g:1!==d&&(d=1):-1!==a&&(d=-1);else if(!c){l=g+1;break}return-1===a||-1===i||0===d||1===d&&a===i-1&&a===l+1?-1!==i&&(r.base=r.name=0===l&&s?e.slice(1,i):e.slice(l,i)):(0===l&&s?(r.name=e.slice(1,a),r.base=e.slice(1,i)):(r.name=e.slice(l,a),r.base=e.slice(l,i)),r.ext=e.slice(a,i)),l>0?r.dir=e.slice(0,l-1):s&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};n.posix=n,e.exports=n}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e=r(56977),t=r.n(e);function n(e,r){const n=t().normalize(r),o=t().dirname(n).split("/"),s=[];for(const t of o){s.push(t);const r=s.join("/");if(e.FS.analyzePath(r).exists){if(e.FS.isDir(r))throw new Error(`"${r}" already exists and is not a directory.`)}else try{e.FS.mkdir(r)}catch(a){throw console.error(`Failed to create a directory "${r}"`),a}}}function o(e,t,r,o){n(e,t),e.FS.writeFile(t,r,o)}function s(e){e.forEach((e=>{let t;try{t=new URL(e)}catch(r){return}if("emfs:"===t.protocol||"file:"===t.protocol)throw new Error(`"emfs:" and "file:" protocols are not allowed for the requirement (${e})`)}))}function a(e){e.runPython('\nimport micropip\nmicropip.add_mock_package(\n "pyarrow", "0.0.1",\n modules={\n "pyarrow": """\n__version__ = \'0.0.1\' # TODO: Update when releasing\n\n\nclass Table:\n @classmethod\n def from_pandas(*args, **kwargs):\n raise NotImplementedError("stlite is not supporting this method.")\n"""\n }\n)\n')}var l=function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function a(e){try{i(n.next(e))}catch(t){s(t)}}function l(e){try{i(n.throw(e))}catch(t){s(t)}}function i(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,l)}i((n=n.apply(e,t||[])).next())}))};let i,c;const g=self,d=new class{constructor(){this.promise=new Promise(((e,t)=>{this.resolveInternal=e,this.rejectInternal=t}))}resolve(e){this.resolveInternal(e)}reject(e){this.rejectInternal(e)}};function h(e){g.postMessage({type:"event:progress",data:{message:e}})}const p="https://cdn.jsdelivr.net/pyodide/v0.24.1/full/pyodide.js";const u=function(){var e,t;return l(this,void 0,void 0,(function*(){const{entrypoint:r,files:n,archives:u,requirements:m,wheels:f,mountedSitePackagesSnapshotFilePath:_,pyodideUrl:y=p,streamlitConfig:v}=yield d.promise;if(h("Loading Pyodide."),console.debug("Loading Pyodide"),i=yield function(e,t){return l(this,void 0,void 0,(function*(){const r=e.slice(0,e.lastIndexOf("/")+1);let n;return e.endsWith(".mjs")?n=(yield import(e)).loadPyodide:(importScripts(e),n=self.loadPyodide),n(Object.assign(Object.assign({},t),{indexURL:r}))}))}(y,{stdout:console.log,stderr:console.error}),console.debug("Loaded Pyodide"),h("Mounting files."),yield Promise.all(Object.keys(n).map((e=>l(this,void 0,void 0,(function*(){const t=n[e];let r;"url"in t?(console.debug(`Fetch a file from ${t.url}`),r=yield fetch(t.url).then((e=>e.arrayBuffer())).then((e=>new Uint8Array(e)))):r=t.data;const{opts:s}=n[e];console.debug(`Write a file "${e}"`),o(i,e,r,s)}))))),h("Unpacking archives."),yield Promise.all(u.map((e=>l(this,void 0,void 0,(function*(){let t;"url"in e?(console.debug(`Fetch an archive from ${e.url}`),t=yield fetch(e.url).then((e=>e.arrayBuffer()))):t=e.buffer;const{format:r,options:n}=e;console.debug("Unpack an archive",{format:r,options:n}),i.unpackArchive(t,r,n)}))))),!_&&!f)throw new Error("Neither snapshot nor wheel files are provided.");_&&(h("Restoring the snapshot."),yield i.runPythonAsync("import tarfile, shutil, site"),yield i.runPythonAsync("\n site_packages_dirs = site.getsitepackages()\n for site_packages in site_packages_dirs:\n shutil.rmtree(site_packages)\n "),console.debug(`Unarchive ${_}`),yield i.runPythonAsync(`\n with tarfile.open("${_}", "r") as tar_gz_file:\n tar_gz_file.extractall("/")\n `),console.debug("Restored the snapshot"),h("Mocking some packages."),console.debug("Mock pyarrow"),a(i),console.debug("Mocked pyarrow")),s(m),h("Installing packages."),yield i.loadPackage("micropip");const b=i.pyimport("micropip");f?(console.debug("Installing the wheels:",f,"and the requirements:",m),yield b.install.callKwargs([f.stliteServer,f.streamlit,...m],{keep_going:!0}),console.debug("Installed the wheels and the requirements"),h("Mocking some packages."),console.debug("Mock pyarrow"),a(i),console.debug("Mocked pyarrow")):(console.debug("Installing the requirements:",m),yield b.install.callKwargs(m,{keep_going:!0}),console.debug("Installed the requirements")),yield i.runPythonAsync("\n import importlib\n importlib.invalidate_caches()\n "),h("Loading streamlit package."),console.debug("Loading the Streamlit package"),yield i.runPythonAsync("\n import streamlit.runtime\n "),console.debug("Loaded the Streamlit package"),h("Setting up the loggers."),console.debug("Setting the loggers"),yield i.runPythonAsync('\n import logging\n import streamlit.logger\n\n streamlit.logger.get_logger = logging.getLogger\n streamlit.logger.setup_formatter = None\n streamlit.logger.update_formatter = lambda *a, **k: None\n streamlit.logger.set_log_level = lambda *a, **k: None\n\n for name in streamlit.logger._loggers.keys():\n if name == "root":\n name = "streamlit"\n logger = logging.getLogger(name)\n logger.propagate = True\n logger.handlers.clear()\n logger.setLevel(logging.NOTSET)\n\n streamlit.logger._loggers = {}\n ');self.__logCallback__=(e,t)=>{e>=40?console.error(t):e>=30?console.warn(t):e>=20?console.info(t):console.debug(t)},yield i.runPythonAsync('\ndef setup_loggers(streamlit_level, streamlit_message_format):\n from js import __logCallback__\n\n\n class JsHandler(logging.Handler):\n def emit(self, record):\n msg = self.format(record)\n __logCallback__(record.levelno, msg)\n\n\n root_message_format = "%(levelname)s:%(name)s:%(message)s"\n\n root_logger = logging.getLogger()\n root_logger.handlers.clear()\n root_formatter = logging.Formatter(root_message_format)\n root_handler = JsHandler()\n root_handler.setFormatter(root_formatter)\n root_logger.addHandler(root_handler)\n root_logger.setLevel(logging.DEBUG)\n\n streamlit_logger = logging.getLogger("streamlit")\n streamlit_logger.propagate = False\n streamlit_logger.handlers.clear()\n streamlit_formatter = logging.Formatter(streamlit_message_format)\n streamlit_handler = JsHandler()\n streamlit_handler.setFormatter(streamlit_formatter)\n streamlit_logger.addHandler(streamlit_handler)\n streamlit_logger.setLevel(streamlit_level.upper())\n ');const k=(null!==(e=null===v||void 0===v?void 0:v["logger.level"])&&void 0!==e?e:"INFO").toString(),w=null!==(t=null===v||void 0===v?void 0:v["logger.messageFormat"])&&void 0!==t?t:"%(asctime)s %(message)s";i.globals.get("setup_loggers")(k,w),console.debug("Set the loggers"),h("Mocking some Streamlit functions for the browser environment."),console.debug("Mocking some Streamlit functions"),yield i.runPythonAsync("\n import streamlit\n\n def is_cacheable_msg(msg):\n return False\n\n streamlit.runtime.runtime.is_cacheable_msg = is_cacheable_msg\n "),console.debug("Mocked some Streamlit functions"),h("Booting up the Streamlit server."),console.debug("Booting up the Streamlit server"),self.__streamlitFlagOptions__=Object.assign(Object.assign({"browser.gatherUsageStats":!1},v),{"runner.fastReruns":!1}),yield i.runPythonAsync(`\n from stlite_server.bootstrap import load_config_options, prepare\n from stlite_server.server import Server\n from js import __streamlitFlagOptions__\n\n flag_options = __streamlitFlagOptions__.to_py()\n load_config_options(flag_options)\n\n main_script_path = "${r}"\n command_line = None\n args = []\n\n prepare(main_script_path, args)\n\n server = Server(main_script_path, command_line)\n server.start()\n `),console.debug("Booted up the Streamlit server"),console.debug("Setting up the HTTP server"),c=i.globals.get("server").copy(),console.debug("Set up the HTTP server"),g.postMessage({type:"event:loaded"})}))}().catch((e=>{throw g.postMessage({type:"event:error",data:{error:e}}),e}));self.onmessage=e=>l(void 0,void 0,void 0,(function*(){const t=e.data;if("initData"===t.type)return void d.resolve(t.data);yield u;const r=e.ports[0];try{switch(t.type){case"websocket:connect":{console.debug("websocket:connect",t.data);const{path:e}=t.data;c.start_websocket(e,((e,t)=>{if(t){const t=e.getBuffer("u8");e.destroy();const r=new Uint8ClampedArray(t.data.buffer,t.data.byteOffset,t.data.byteLength);g.postMessage({type:"websocket:message",data:{payload:new Uint8Array(r)}})}else g.postMessage({type:"websocket:message",data:{payload:e}})})),r.postMessage({type:"reply"});break}case"websocket:send":{console.debug("websocket:send",t.data);const{payload:e}=t.data;c.receive_websocket_from_js(e);break}case"http:request":{console.debug("http:request",t.data);const{request:e}=t.data,n=(e,t,n)=>{const o=t.toJs(),s=n.toJs();console.debug({statusCode:e,headers:o,body:s});const a={type:"http:response",data:{response:{statusCode:e,headers:o,body:s}}};r.postMessage(a)};c.receive_http_from_js(e.method,decodeURIComponent(e.path),e.headers,e.body,n);break}case"file:write":{const{path:e,data:n,opts:s}=t.data;console.debug(`Write a file "${e}"`),o(i,e,n,s),r.postMessage({type:"reply"});break}case"file:rename":{const{oldPath:e,newPath:o}=t.data;console.debug(`Rename "${e}" to ${o}`),function(e,t,r){n(e,r),e.FS.rename(t,r)}(i,e,o),r.postMessage({type:"reply"});break}case"file:unlink":{const{path:e}=t.data;console.debug(`Remove "${e}`),i.FS.unlink(e),r.postMessage({type:"reply"});break}case"install":{const{requirements:e}=t.data,n=i.pyimport("micropip");console.debug("Install the requirements:",e),s(e),yield n.install.callKwargs(e,{keep_going:!0}).then((()=>{if(e.includes("matplotlib"))return i.runPythonAsync("\n from stlite_server.bootstrap import _fix_matplotlib_crash\n _fix_matplotlib_crash()\n ")})).then((()=>{console.debug("Successfully installed"),r.postMessage({type:"reply"})}))}}}catch(a){if(console.error(a),!(a instanceof Error))throw a;const e=new Error(a.message);e.name=a.name,e.stack=a.stack,r.postMessage({type:"reply",error:e})}})),g.postMessage({type:"event:start"})})()})();
@@ -1 +1 @@
1
- "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[8050],{8050:(t,e,o)=>{o.r(e),o.d(e,{default:()=>V});var n=o(5057),i=o(47206),a=o(5361),s=o(1110),r=o(79220),l=o(70714),d=o(50651),c=o(64327),h=o(87241),g=o(40807),u=o.n(g),m=o(71486),f=o.n(m),p=o(96601);function b(t,e){const o={font:e.genericFonts.bodyFont,background:e.colors.bgColor,fieldTitle:"verbal",autosize:{type:"fit",contains:"padding"},title:{align:"left",anchor:"start",color:e.colors.headingColor,titleFontStyle:"normal",fontWeight:e.fontWeights.bold,fontSize:e.fontSizes.smPx+2,orient:"top",offset:26},header:{titleFontWeight:e.fontWeights.normal,titleFontSize:e.fontSizes.mdPx,titleColor:(0,p.Xy)(e),titleFontStyle:"normal",labelFontSize:e.fontSizes.twoSmPx,labelFontWeight:e.fontWeights.normal,labelColor:(0,p.Xy)(e),labelFontStyle:"normal"},axis:{labelFontSize:e.fontSizes.twoSmPx,labelFontWeight:e.fontWeights.normal,labelColor:(0,p.Xy)(e),labelFontStyle:"normal",titleFontWeight:e.fontWeights.normal,titleFontSize:e.fontSizes.smPx,titleColor:(0,p.Xy)(e),titleFontStyle:"normal",ticks:!1,gridColor:(0,p.ny)(e),domain:!1,domainWidth:1,domainColor:(0,p.ny)(e),labelFlush:!0,labelFlushOffset:1,labelBound:!1,labelLimit:100,titlePadding:e.spacing.lgPx,labelPadding:e.spacing.lgPx,labelSeparation:e.spacing.twoXSPx,labelOverlap:!0},legend:{labelFontSize:e.fontSizes.smPx,labelFontWeight:e.fontWeights.normal,labelColor:(0,p.Xy)(e),titleFontSize:e.fontSizes.smPx,titleFontWeight:e.fontWeights.normal,titleFontStyle:"normal",titleColor:(0,p.Xy)(e),titlePadding:5,labelPadding:e.spacing.lgPx,columnPadding:e.spacing.smPx,rowPadding:e.spacing.twoXSPx,padding:7,symbolStrokeWidth:4},range:{category:(0,p.iY)(e),diverging:(0,p.ru)(e),ramp:(0,p.Gy)(e),heatmap:(0,p.Gy)(e)},view:{columns:1,strokeWidth:0,stroke:"transparent",continuousHeight:350,continuousWidth:400},concat:{columns:1},facet:{columns:1},mark:{tooltip:!0,...(0,p.Iy)(e)?{color:"#0068C9"}:{color:"#83C9FF"}},bar:{binSpacing:e.spacing.twoXSPx,discreteBandSize:{band:.85}},axisDiscrete:{grid:!1},axisXPoint:{grid:!1},axisTemporal:{grid:!1},axisXBand:{grid:!1}};return t?f()({},o,t,((t,e)=>Array.isArray(e)?e:void 0)):o}const y=(0,o(82160).Z)("div",{target:"egd2k5h0"})((t=>{let{theme:e}=t;return{"&.vega-embed":{"&:hover summary, .vega-embed:focus summary":{background:"transparent"},"&.has-actions":{paddingRight:0},".vega-actions":{zIndex:e.zIndices.popupMenu,backgroundColor:e.colors.bgColor,boxShadow:"rgb(0 0 0 / 16%) 0px 4px 16px",border:"1px solid ".concat(e.colors.fadedText10),a:{fontFamily:e.genericFonts.bodyFont,fontWeight:e.fontWeights.normal,fontSize:e.fontSizes.md,margin:0,padding:"".concat(e.spacing.twoXS," ").concat(e.spacing.twoXL),color:e.colors.bodyText},"a:hover":{backgroundColor:e.colors.secondaryBg,color:e.colors.bodyText},":before":{content:"none"},":after":{content:"none"}},summary:{opacity:0,height:"auto",zIndex:e.zIndices.menuButton,border:"none",boxShadow:"none",borderRadius:e.radii.lg,color:e.colors.fadedText10,backgroundColor:"transparent",transition:"opacity 300ms 150ms,transform 300ms 150ms","&:active, &:focus-visible, &:hover":{border:"none",boxShadow:"none",color:e.colors.bodyText,opacity:"1 !important",background:e.colors.darkenedBgMix25}}}}}),"");var w=o(96266);const v={DATAFRAME_INDEX:"(index)"},x="source",S=new Set([h.GI.DatetimeIndex,h.GI.Float64Index,h.GI.Int64Index,h.GI.RangeIndex,h.GI.UInt64Index]);class F extends n.PureComponent{constructor(){super(...arguments),this.vegaView=void 0,this.vegaFinalizer=void 0,this.defaultDataName=x,this.element=null,this.state={error:void 0},this.finalizeView=()=>{this.vegaFinalizer&&this.vegaFinalizer(),this.vegaFinalizer=void 0,this.vegaView=void 0},this.generateSpec=()=>{var t;const{element:e,theme:o}=this.props,n=JSON.parse(e.spec),{useContainerWidth:i}=e;if("streamlit"===e.vegaLiteTheme?n.config=b(n.config,o):"streamlit"===(null===(t=n.usermeta)||void 0===t||null===(t=t.embedOptions)||void 0===t?void 0:t.theme)?(n.config=b(n.config,o),n.usermeta.embedOptions.theme=void 0):n.config=function(t,e){const{colors:o,fontSizes:n,genericFonts:i}=e,a={labelFont:i.bodyFont,titleFont:i.bodyFont,labelFontSize:n.twoSmPx,titleFontSize:n.twoSmPx},s={background:o.bgColor,axis:{labelColor:o.bodyText,titleColor:o.bodyText,gridColor:(0,p.ny)(e),...a},legend:{labelColor:o.bodyText,titleColor:o.bodyText,...a},title:{color:o.bodyText,subtitleColor:o.bodyText,...a},header:{labelColor:o.bodyText,titleColor:o.bodyText,...a},view:{stroke:(0,p.ny)(e),continuousHeight:350,continuousWidth:400},mark:{tooltip:!0}};return t?u()({},s,t):s}(n.config,o),this.props.height?(n.width=this.props.width,n.height=this.props.height):i&&(n.width=this.props.width),n.padding||(n.padding={}),null==n.padding.bottom&&(n.padding.bottom=20),n.datasets)throw new Error("Datasets should not be passed as part of the spec");return n}}async componentDidMount(){try{await this.createView()}catch(t){const e=(0,c.b)(t);this.setState({error:e})}}componentWillUnmount(){this.finalizeView()}async componentDidUpdate(t){const{element:e,theme:o}=t,{element:n,theme:i}=this.props,a=e.spec,{spec:s}=n;if(!this.vegaView||a!==s||o!==i||t.width!==this.props.width||t.height!==this.props.height||t.element.vegaLiteTheme!==this.props.element.vegaLiteTheme){(0,l.ji)("Vega spec changed.");try{await this.createView()}catch(u){const t=(0,c.b)(u);this.setState({error:t})}return}const r=e.data,{data:d}=n;(r||d)&&this.updateData(this.defaultDataName,r,d);const h=z(e)||{},g=z(n)||{};for(const[l,c]of Object.entries(g)){const t=l||this.defaultDataName,e=h[t];this.updateData(t,e,c)}for(const l of Object.keys(h))g.hasOwnProperty(l)||l===this.defaultDataName||this.updateData(l,null,null);this.vegaView.resize().runAsync()}updateData(t,e,o){if(!this.vegaView)throw new Error("Chart has not been drawn yet");if(!o||0===o.data.numRows){return void(this.vegaView._runtime.data.hasOwnProperty(t)&&this.vegaView.remove(t,s.truthy))}if(!e||0===e.data.numRows)return void this.vegaView.insert(t,C(o));const{dataRows:n,dataColumns:i}=e.dimensions,{dataRows:a,dataColumns:r}=o.dimensions;if(function(t,e,o,n,i,a){if(o!==a)return!1;if(e>=i)return!1;if(0===e)return!1;const s=a-1,r=e-1;if(t.getDataValue(0,s)!==n.getDataValue(0,s)||t.getDataValue(r,s)!==n.getDataValue(r,s))return!1;return!0}(e,n,i,o,a,r))n<a&&this.vegaView.insert(t,C(o,n));else{const e=s.changeset().remove(s.truthy).insert(C(o));this.vegaView.change(t,e),(0,l.ji)("Had to clear the ".concat(t," dataset before inserting data through Vega view."))}}async createView(){if((0,l.ji)("Creating a new Vega view."),!this.element)throw Error("Element missing.");this.finalizeView();const t=this.props.element,e=this.generateSpec(),o={ast:!0,expr:r.N,tooltip:{disableDefaultStyle:!0},defaultStyle:!1,forceActionsMenu:!0},{vgSpec:n,view:i,finalize:s}=await(0,a.ZP)(this.element,e,o);this.vegaView=i,this.vegaFinalizer=s;const d=function(t){const e=z(t);if(null==e)return null;const o={};for(const[n,i]of Object.entries(e))o[n]=C(i);return o}(t),c=d?Object.keys(d):[];if(1===c.length){const[t]=c;this.defaultDataName=t}else 0===c.length&&n.data&&(this.defaultDataName=x);const h=function(t){const e=t.data;if(!e||0===e.data.numRows)return null;return C(e)}(t);if(h&&i.insert(this.defaultDataName,h),d)for(const[a,r]of Object.entries(d))i.insert(a,r);await i.runAsync(),this.vegaView.resize().runAsync()}render(){if(this.state.error)throw this.state.error;return(0,w.jsx)(y,{"data-testid":"stArrowVegaLiteChart",ref:t=>{this.element=t}})}}function z(t){var e;if(0===(null===(e=t.datasets)||void 0===e?void 0:e.length))return null;const o={};return t.datasets.forEach((t=>{if(!t)return;const e=t.hasName?t.name:null;o[e]=t.data})),o}function C(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(t.isEmpty())return[];const o=[],{dataRows:n,dataColumns:i}=t.dimensions,a=h.fu.getTypeName(t.types.index[0]),s=S.has(a);for(let r=e;r<n;r++){const e={};if(s){const o=t.getIndexValue(r,0);e[v.DATAFRAME_INDEX]="bigint"===typeof o?Number(o):o}for(let o=0;o<i;o++){const n=t.getDataValue(r,o);e[t.columns[0][o]]="bigint"===typeof n?Number(n):n}o.push(e)}return o}const V=(0,i.b)((0,d.Z)(F))}}]);
1
+ "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[8050],{8050:(t,e,o)=>{o.r(e),o.d(e,{default:()=>V});var n=o(5057),i=o(47206),a=o(5361),s=o(1110),r=o(79220),l=o(70714),d=o(50651),c=o(64327),h=o(55490),g=o(40807),u=o.n(g),m=o(71486),f=o.n(m),p=o(96601);function b(t,e){const o={font:e.genericFonts.bodyFont,background:e.colors.bgColor,fieldTitle:"verbal",autosize:{type:"fit",contains:"padding"},title:{align:"left",anchor:"start",color:e.colors.headingColor,titleFontStyle:"normal",fontWeight:e.fontWeights.bold,fontSize:e.fontSizes.smPx+2,orient:"top",offset:26},header:{titleFontWeight:e.fontWeights.normal,titleFontSize:e.fontSizes.mdPx,titleColor:(0,p.Xy)(e),titleFontStyle:"normal",labelFontSize:e.fontSizes.twoSmPx,labelFontWeight:e.fontWeights.normal,labelColor:(0,p.Xy)(e),labelFontStyle:"normal"},axis:{labelFontSize:e.fontSizes.twoSmPx,labelFontWeight:e.fontWeights.normal,labelColor:(0,p.Xy)(e),labelFontStyle:"normal",titleFontWeight:e.fontWeights.normal,titleFontSize:e.fontSizes.smPx,titleColor:(0,p.Xy)(e),titleFontStyle:"normal",ticks:!1,gridColor:(0,p.ny)(e),domain:!1,domainWidth:1,domainColor:(0,p.ny)(e),labelFlush:!0,labelFlushOffset:1,labelBound:!1,labelLimit:100,titlePadding:e.spacing.lgPx,labelPadding:e.spacing.lgPx,labelSeparation:e.spacing.twoXSPx,labelOverlap:!0},legend:{labelFontSize:e.fontSizes.smPx,labelFontWeight:e.fontWeights.normal,labelColor:(0,p.Xy)(e),titleFontSize:e.fontSizes.smPx,titleFontWeight:e.fontWeights.normal,titleFontStyle:"normal",titleColor:(0,p.Xy)(e),titlePadding:5,labelPadding:e.spacing.lgPx,columnPadding:e.spacing.smPx,rowPadding:e.spacing.twoXSPx,padding:7,symbolStrokeWidth:4},range:{category:(0,p.iY)(e),diverging:(0,p.ru)(e),ramp:(0,p.Gy)(e),heatmap:(0,p.Gy)(e)},view:{columns:1,strokeWidth:0,stroke:"transparent",continuousHeight:350,continuousWidth:400},concat:{columns:1},facet:{columns:1},mark:{tooltip:!0,...(0,p.Iy)(e)?{color:"#0068C9"}:{color:"#83C9FF"}},bar:{binSpacing:e.spacing.twoXSPx,discreteBandSize:{band:.85}},axisDiscrete:{grid:!1},axisXPoint:{grid:!1},axisTemporal:{grid:!1},axisXBand:{grid:!1}};return t?f()({},o,t,((t,e)=>Array.isArray(e)?e:void 0)):o}const y=(0,o(82160).Z)("div",{target:"egd2k5h0"})((t=>{let{theme:e}=t;return{"&.vega-embed":{"&:hover summary, .vega-embed:focus summary":{background:"transparent"},"&.has-actions":{paddingRight:0},".vega-actions":{zIndex:e.zIndices.popupMenu,backgroundColor:e.colors.bgColor,boxShadow:"rgb(0 0 0 / 16%) 0px 4px 16px",border:"1px solid ".concat(e.colors.fadedText10),a:{fontFamily:e.genericFonts.bodyFont,fontWeight:e.fontWeights.normal,fontSize:e.fontSizes.md,margin:0,padding:"".concat(e.spacing.twoXS," ").concat(e.spacing.twoXL),color:e.colors.bodyText},"a:hover":{backgroundColor:e.colors.secondaryBg,color:e.colors.bodyText},":before":{content:"none"},":after":{content:"none"}},summary:{opacity:0,height:"auto",zIndex:e.zIndices.menuButton,border:"none",boxShadow:"none",borderRadius:e.radii.lg,color:e.colors.fadedText10,backgroundColor:"transparent",transition:"opacity 300ms 150ms,transform 300ms 150ms","&:active, &:focus-visible, &:hover":{border:"none",boxShadow:"none",color:e.colors.bodyText,opacity:"1 !important",background:e.colors.darkenedBgMix25}}}}}),"");var w=o(96266);const v={DATAFRAME_INDEX:"(index)"},x="source",S=new Set([h.GI.DatetimeIndex,h.GI.Float64Index,h.GI.Int64Index,h.GI.RangeIndex,h.GI.UInt64Index]);class F extends n.PureComponent{constructor(){super(...arguments),this.vegaView=void 0,this.vegaFinalizer=void 0,this.defaultDataName=x,this.element=null,this.state={error:void 0},this.finalizeView=()=>{this.vegaFinalizer&&this.vegaFinalizer(),this.vegaFinalizer=void 0,this.vegaView=void 0},this.generateSpec=()=>{var t;const{element:e,theme:o}=this.props,n=JSON.parse(e.spec),{useContainerWidth:i}=e;if("streamlit"===e.vegaLiteTheme?n.config=b(n.config,o):"streamlit"===(null===(t=n.usermeta)||void 0===t||null===(t=t.embedOptions)||void 0===t?void 0:t.theme)?(n.config=b(n.config,o),n.usermeta.embedOptions.theme=void 0):n.config=function(t,e){const{colors:o,fontSizes:n,genericFonts:i}=e,a={labelFont:i.bodyFont,titleFont:i.bodyFont,labelFontSize:n.twoSmPx,titleFontSize:n.twoSmPx},s={background:o.bgColor,axis:{labelColor:o.bodyText,titleColor:o.bodyText,gridColor:(0,p.ny)(e),...a},legend:{labelColor:o.bodyText,titleColor:o.bodyText,...a},title:{color:o.bodyText,subtitleColor:o.bodyText,...a},header:{labelColor:o.bodyText,titleColor:o.bodyText,...a},view:{stroke:(0,p.ny)(e),continuousHeight:350,continuousWidth:400},mark:{tooltip:!0}};return t?u()({},s,t):s}(n.config,o),this.props.height?(n.width=this.props.width,n.height=this.props.height):i&&(n.width=this.props.width),n.padding||(n.padding={}),null==n.padding.bottom&&(n.padding.bottom=20),n.datasets)throw new Error("Datasets should not be passed as part of the spec");return n}}async componentDidMount(){try{await this.createView()}catch(t){const e=(0,c.b)(t);this.setState({error:e})}}componentWillUnmount(){this.finalizeView()}async componentDidUpdate(t){const{element:e,theme:o}=t,{element:n,theme:i}=this.props,a=e.spec,{spec:s}=n;if(!this.vegaView||a!==s||o!==i||t.width!==this.props.width||t.height!==this.props.height||t.element.vegaLiteTheme!==this.props.element.vegaLiteTheme){(0,l.ji)("Vega spec changed.");try{await this.createView()}catch(u){const t=(0,c.b)(u);this.setState({error:t})}return}const r=e.data,{data:d}=n;(r||d)&&this.updateData(this.defaultDataName,r,d);const h=z(e)||{},g=z(n)||{};for(const[l,c]of Object.entries(g)){const t=l||this.defaultDataName,e=h[t];this.updateData(t,e,c)}for(const l of Object.keys(h))g.hasOwnProperty(l)||l===this.defaultDataName||this.updateData(l,null,null);this.vegaView.resize().runAsync()}updateData(t,e,o){if(!this.vegaView)throw new Error("Chart has not been drawn yet");if(!o||0===o.data.numRows){return void(this.vegaView._runtime.data.hasOwnProperty(t)&&this.vegaView.remove(t,s.truthy))}if(!e||0===e.data.numRows)return void this.vegaView.insert(t,C(o));const{dataRows:n,dataColumns:i}=e.dimensions,{dataRows:a,dataColumns:r}=o.dimensions;if(function(t,e,o,n,i,a){if(o!==a)return!1;if(e>=i)return!1;if(0===e)return!1;const s=a-1,r=e-1;if(t.getDataValue(0,s)!==n.getDataValue(0,s)||t.getDataValue(r,s)!==n.getDataValue(r,s))return!1;return!0}(e,n,i,o,a,r))n<a&&this.vegaView.insert(t,C(o,n));else{const e=s.changeset().remove(s.truthy).insert(C(o));this.vegaView.change(t,e),(0,l.ji)("Had to clear the ".concat(t," dataset before inserting data through Vega view."))}}async createView(){if((0,l.ji)("Creating a new Vega view."),!this.element)throw Error("Element missing.");this.finalizeView();const t=this.props.element,e=this.generateSpec(),o={ast:!0,expr:r.N,tooltip:{disableDefaultStyle:!0},defaultStyle:!1,forceActionsMenu:!0},{vgSpec:n,view:i,finalize:s}=await(0,a.ZP)(this.element,e,o);this.vegaView=i,this.vegaFinalizer=s;const d=function(t){const e=z(t);if(null==e)return null;const o={};for(const[n,i]of Object.entries(e))o[n]=C(i);return o}(t),c=d?Object.keys(d):[];if(1===c.length){const[t]=c;this.defaultDataName=t}else 0===c.length&&n.data&&(this.defaultDataName=x);const h=function(t){const e=t.data;if(!e||0===e.data.numRows)return null;return C(e)}(t);if(h&&i.insert(this.defaultDataName,h),d)for(const[a,r]of Object.entries(d))i.insert(a,r);await i.runAsync(),this.vegaView.resize().runAsync()}render(){if(this.state.error)throw this.state.error;return(0,w.jsx)(y,{"data-testid":"stArrowVegaLiteChart",ref:t=>{this.element=t}})}}function z(t){var e;if(0===(null===(e=t.datasets)||void 0===e?void 0:e.length))return null;const o={};return t.datasets.forEach((t=>{if(!t)return;const e=t.hasName?t.name:null;o[e]=t.data})),o}function C(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(t.isEmpty())return[];const o=[],{dataRows:n,dataColumns:i}=t.dimensions,a=h.fu.getTypeName(t.types.index[0]),s=S.has(a);for(let r=e;r<n;r++){const e={};if(s){const o=t.getIndexValue(r,0);e[v.DATAFRAME_INDEX]="bigint"===typeof o?Number(o):o}for(let o=0;o<i;o++){const n=t.getDataValue(r,o);e[t.columns[0][o]]="bigint"===typeof n?Number(n):n}o.push(e)}return o}const V=(0,i.b)((0,d.Z)(F))}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[8957],{96260:(e,t,n)=>{n.r(t),n.d(t,{default:()=>It});var i=n(5057),o=n(43128),a=n(77187),l=n(27179),r=n(23046),s=n(30383),d=n(61078),c=n(83221),u=n(52955),m=n(50651),h=n(60913),g=n(50120),p=n(47206),f=n(18932),b=n(93576),v=n(46403),y=n(98790),w=n(38830),x=n(44088),C=n(73401),T=n(82160),k=n(96601);const E=(0,T.Z)("div",{target:"e2wxzia1"})((e=>{let{theme:t,locked:n,target:i}=e;return{padding:"0.5rem 0 0.5rem 0.5rem",position:"absolute",top:n?"-2.4rem":"-1rem",right:t.spacing.none,transition:"none",...!n&&{opacity:0,"&:active, &:focus-visible, &:hover":{transition:"opacity 150ms 100ms, top 100ms 100ms",opacity:1,top:"-2.4rem"},...i&&{["".concat(i,":hover &, ").concat(i,":active &, ").concat(i,":focus-visible &")]:{transition:"opacity 150ms 100ms, top 100ms 100ms",opacity:1,top:"-2.4rem"}}}}}),""),M=(0,T.Z)("div",{target:"e2wxzia0"})((e=>{let{theme:t}=e;return{color:(0,k.Iy)(t)?t.colors.fadedText60:t.colors.bodyText,display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-end",boxShadow:"1px 2px 8px rgba(0, 0, 0, 0.08)",borderRadius:t.radii.lg,backgroundColor:t.colors.lightenedBg05,width:"fit-content",zIndex:t.zIndices.sidebar+1}}),"");var S=n(96266);function N(e){let{label:t,show_label:n,icon:i,onClick:o}=e;const a=(0,p.u)(),l=n?t:"";return(0,S.jsx)("div",{"data-testid":"stElementToolbarButton",children:(0,S.jsx)(y.Z,{content:(0,S.jsx)(v.ZP,{source:t,allowHTML:!1,style:{fontSize:a.fontSizes.sm}}),placement:y.u.TOP,onMouseEnterDelay:1e3,inline:!0,children:(0,S.jsxs)(w.ZP,{onClick:e=>{o&&o(),e.stopPropagation()},kind:x.nW.ELEMENT_TOOLBAR,children:[i&&(0,S.jsx)(C.Z,{content:i,size:"md",testid:"stElementToolbarButtonIcon"}),l&&(0,S.jsx)("span",{children:l})]})})})}const R=e=>{let{onExpand:t,onCollapse:n,isFullScreen:i,locked:o,children:a,target:l,disableFullscreenMode:r}=e;return(0,S.jsx)(E,{className:"stElementToolbar","data-testid":"stElementToolbar",locked:o||i,target:l,children:(0,S.jsxs)(M,{children:[a,t&&!r&&!i&&(0,S.jsx)(N,{label:"Fullscreen",icon:f.i,onClick:()=>t()}),n&&!r&&i&&(0,S.jsx)(N,{label:"Close fullscreen",icon:b.m,onClick:()=>n()})]})})};var _=n(26849),I=n.n(_),O=n(40807),D=n.n(O),F=n(61918),H=n.n(F),A=n(59500),z=n(88084),V=n.n(z);n(56719),n(21763);const j=["true","t","yes","y","on","1"],L=["false","f","no","n","off","0"];function W(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return e="\u26a0\ufe0f ".concat(e),{kind:o.p6.Text,readonly:!0,allowOverlay:!0,data:e+(t?"\n\n".concat(t,"\n"):""),displayData:e,isError:!0}}function P(e){return e.hasOwnProperty("isError")&&e.isError}function B(e){return e.hasOwnProperty("isMissingValue")&&e.isMissingValue}function Y(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?{kind:o.p6.Loading,allowOverlay:!1,isMissingValue:!0}:{kind:o.p6.Loading,allowOverlay:!1}}function Z(e,t){const n=t?"faded":"normal";return{kind:o.p6.Text,data:"",displayData:"",allowOverlay:!0,readonly:e,style:n}}function q(e){return{id:e.id,title:e.title,hasMenu:!1,themeOverride:e.themeOverride,icon:e.icon,...e.isStretched&&{grow:e.isIndex?1:3},...e.width&&{width:e.width}}}function J(e,t){return(0,g.le)(e)?t||{}:(0,g.le)(t)?e||{}:D()(e,t)}function K(e){if((0,g.le)(e))return[];if("number"===typeof e||"boolean"===typeof e)return[e];if(e instanceof Uint8Array&&(e=new TextDecoder("utf-8").decode(e)),"string"===typeof e){if(""===e)return[];if(!e.trim().startsWith("[")||!e.trim().endsWith("]"))return e.split(",");try{return JSON.parse(e)}catch(t){return[e]}}try{const t=JSON.parse(JSON.stringify(e,((e,t)=>"bigint"===typeof t?Number(t):t)));return Array.isArray(t)?t.map((e=>["string","number","boolean","null"].includes(typeof e)?e:X(e))):[X(t)]}catch(t){return[X(e)]}}function X(e){try{try{return I()(e)}catch(t){return JSON.stringify(e,((e,t)=>"bigint"===typeof t?Number(t):t))}}catch(t){return"[".concat(typeof e,"]")}}function G(e){if((0,g.le)(e))return null;if("boolean"===typeof e)return e;const t=X(e).toLowerCase().trim();return""===t?null:!!j.includes(t)||!L.includes(t)&&void 0}function U(e){if((0,g.le)(e))return null;if(Array.isArray(e))return NaN;if("string"===typeof e){if(0===e.trim().length)return null;try{const t=H().unformat(e.trim());if((0,g.bb)(t))return t}catch(t){}}else if(e instanceof Int32Array)return Number(e[0]);return Number(e)}function Q(e,t,n){return Number.isNaN(e)||!Number.isFinite(e)?"":(0,g.le)(t)||""===t?(0===n&&(e=Math.round(e)),H()(e).format((0,g.bb)(n)?"0,0.".concat("0".repeat(n)):"0,0.[0000]")):"percent"===t?new Intl.NumberFormat(void 0,{style:"percent",minimumFractionDigits:2,maximumFractionDigits:2}).format(e):["compact","scientific","engineering"].includes(t)?new Intl.NumberFormat(void 0,{notation:t}).format(e):"duration[ns]"===t?V().duration(e/1e6,"milliseconds").humanize():(0,A.sprintf)(t,e)}function $(e,t){return"locale"===t?new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"medium"}).format(e.toDate()):"distance"===t?e.fromNow():"relative"===t?e.calendar():e.format(t)}function ee(e){if((0,g.le)(e))return null;if(e instanceof Date)return isNaN(e.getTime())?void 0:e;if("string"===typeof e&&0===e.trim().length)return null;try{const t=Number(e);if(!isNaN(t)){let e=t;t>=10**18?e=t/1e3**3:t>=10**15?e=t/1e6:t>=10**12&&(e=t/1e3);const n=V().unix(e).utc();if(n.isValid())return n.toDate()}if("string"===typeof e){const t=V().utc(e);if(t.isValid())return t.toDate();const n=V().utc(e,[V().HTML5_FMT.TIME_MS,V().HTML5_FMT.TIME_SECONDS,V().HTML5_FMT.TIME]);if(n.isValid())return n.toDate()}}catch(t){return}}function te(e){if(e%1===0)return 0;let t=e.toString();return-1!==t.indexOf("e")&&(t=e.toLocaleString("fullwide",{useGrouping:!1,maximumFractionDigits:20})),-1===t.indexOf(".")?0:t.split(".")[1].length}const ne=new RegExp(/(\r\n|\n|\r)/gm);function ie(e){return-1!==e.indexOf("\n")?e.replace(ne," "):e}var oe=n(70714),ae=n(55490);function le(e){const t={kind:o.p6.Text,data:"",displayData:"",allowOverlay:!0,contentAlignment:e.contentAlignment,readonly:!0,style:e.isIndex?"faded":"normal"};return{...e,kind:"object",sortMode:"default",isEditable:!1,getCell(e){try{const n=(0,g.bb)(e)?X(e):null,i=(0,g.bb)(n)?ie(n):"";return{...t,data:n,displayData:i,isMissingValue:(0,g.le)(e)}}catch(n){return W(X(e),"The value cannot be interpreted as a string. Error: ".concat(n))}},getCellValue:e=>void 0===e.data?null:e.data}}le.isEditableType=!1;const re=le;function se(e){const t=e.columnTypeOptions||{};let n;if(t.validate)try{n=new RegExp(t.validate,"us")}catch(l){n="Invalid validate regex: ".concat(t.validate,".\nError: ").concat(l)}const i={kind:o.p6.Text,data:"",displayData:"",allowOverlay:!0,contentAlignment:e.contentAlignment,readonly:!e.isEditable,style:e.isIndex?"faded":"normal"},a=i=>{if((0,g.le)(i))return!e.isRequired;let o=X(i),a=!1;return t.max_chars&&o.length>t.max_chars&&(o=o.slice(0,t.max_chars),a=!0),!(n instanceof RegExp&&!1===n.test(o))&&(!a||o)};return{...e,kind:"text",sortMode:"default",validateInput:a,getCell(e,t){if("string"===typeof n)return W(X(e),n);if(t){const t=a(e);if(!1===t)return W(X(e),"Invalid input.");"string"===typeof t&&(e=t)}try{const t=(0,g.bb)(e)?X(e):null,n=(0,g.bb)(t)?ie(t):"";return{...i,isMissingValue:(0,g.le)(t),data:t,displayData:n}}catch(l){return W("Incompatible value","The value cannot be interpreted as string. Error: ".concat(l))}},getCellValue:e=>void 0===e.data?null:e.data}}se.isEditableType=!0;const de=se;function ce(e,t){return e=t.startsWith("+")||t.startsWith("-")?e.utcOffset(t,!1):e.tz(t)}function ue(e,t,n,i,a,l,r){var s;const d=J({format:n,step:i,timezone:r},t.columnTypeOptions);let c,u,m;if((0,g.bb)(d.timezone))try{var h;c=(null===(h=ce(V()(),d.timezone))||void 0===h?void 0:h.utcOffset())||void 0}catch(b){}(0,g.bb)(d.min_value)&&(u=ee(d.min_value)||void 0),(0,g.bb)(d.max_value)&&(m=ee(d.max_value)||void 0);const p={kind:o.p6.Custom,allowOverlay:!0,copyData:"",readonly:!t.isEditable,contentAlign:t.contentAlignment,style:t.isIndex?"faded":"normal",data:{kind:"date-picker-cell",date:void 0,displayDate:"",step:(null===(s=d.step)||void 0===s?void 0:s.toString())||"1",format:a,min:u,max:m}},f=e=>{const n=ee(e);return null===n?!t.isRequired:void 0!==n&&(!((0,g.bb)(u)&&l(n)<l(u))&&!((0,g.bb)(m)&&l(n)>l(m)))};return{...t,kind:e,sortMode:"default",validateInput:f,getCell(e,t){if(!0===t){const t=f(e);if(!1===t)return W(X(e),"Invalid input.");t instanceof Date&&(e=t)}const i=ee(e);let o="",a="",l=c;if(void 0===i)return W(X(e),"The value cannot be interpreted as a datetime object.");if(null!==i){let e=V().utc(i);if(!e.isValid())return W(X(i),"This should never happen. Please report this bug. \nError: ".concat(e.toString()));if(d.timezone){try{e=ce(e,d.timezone)}catch(b){return W(e.toISOString(),"Failed to adjust to the provided timezone: ".concat(d.timezone,". \nError: ").concat(b))}l=e.utcOffset()}try{a=$(e,d.format||n)}catch(b){return W(e.toISOString(),"Failed to format the date for rendering with: ".concat(d.format,". \nError: ").concat(b))}o=$(e,n)}return{...p,copyData:o,isMissingValue:(0,g.le)(i),data:{...p.data,date:i,displayDate:a,timezoneOffset:l}}},getCellValue(e){var t;return(0,g.le)(null===e||void 0===e||null===(t=e.data)||void 0===t?void 0:t.date)?null:l(e.data.date)}}}function me(e){var t,n,i,o;let a="YYYY-MM-DD HH:mm:ss";(null===(t=e.columnTypeOptions)||void 0===t?void 0:t.step)>=60?a="YYYY-MM-DD HH:mm":(null===(n=e.columnTypeOptions)||void 0===n?void 0:n.step)<1&&(a="YYYY-MM-DD HH:mm:ss.SSS");const l=null===(i=e.arrowType)||void 0===i||null===(i=i.meta)||void 0===i?void 0:i.timezone,r=(0,g.bb)(l)||(0,g.bb)(null===e||void 0===e||null===(o=e.columnTypeOptions)||void 0===o?void 0:o.timezone);return ue("datetime",e,r?a+"Z":a,1,"datetime-local",(e=>r?e.toISOString():e.toISOString().replace("Z","")),l)}function he(e){var t,n;let i="HH:mm:ss";return(null===(t=e.columnTypeOptions)||void 0===t?void 0:t.step)>=60?i="HH:mm":(null===(n=e.columnTypeOptions)||void 0===n?void 0:n.step)<1&&(i="HH:mm:ss.SSS"),ue("time",e,i,1,"time",(e=>e.toISOString().split("T")[1].replace("Z","")))}function ge(e){return ue("date",e,"YYYY-MM-DD",1,"date",(e=>e.toISOString().split("T")[0]))}function pe(e){const t={kind:o.p6.Boolean,data:!1,allowOverlay:!1,contentAlign:e.contentAlignment,readonly:!e.isEditable,style:e.isIndex?"faded":"normal"};return{...e,kind:"checkbox",sortMode:"default",getCell(e){let n=null;return n=G(e),void 0===n?W(X(e),"The value cannot be interpreted as boolean."):{...t,data:n,isMissingValue:(0,g.le)(n)}},getCellValue:e=>void 0===e.data?null:e.data}}me.isEditableType=!0,he.isEditableType=!0,ge.isEditableType=!0,pe.isEditableType=!0;const fe=pe;function be(e){return e.startsWith("int")&&!e.startsWith("interval")||"range"===e||e.startsWith("uint")}function ve(e){const t=ae.fu.getTypeName(e.arrowType),n=J({step:be(t)?1:void 0,min_value:t.startsWith("uint")?0:void 0,format:"timedelta64[ns]"===t?"duration[ns]":void 0},e.columnTypeOptions),i=(0,g.le)(n.min_value)||n.min_value<0,a=(0,g.bb)(n.step)&&!Number.isNaN(n.step)?te(n.step):void 0,l={kind:o.p6.Number,data:void 0,displayData:"",readonly:!e.isEditable,allowOverlay:!0,contentAlign:e.contentAlignment||"right",style:e.isIndex?"faded":"normal",allowNegative:i,fixedDecimals:a},r=t=>{let i=U(t);if((0,g.le)(i))return!e.isRequired;if(Number.isNaN(i))return!1;let o=!1;return(0,g.bb)(n.max_value)&&i>n.max_value&&(i=n.max_value,o=!0),!((0,g.bb)(n.min_value)&&i<n.min_value)&&(!o||i)};return{...e,kind:"number",sortMode:"smart",validateInput:r,getCell(e,t){if(!0===t){const t=r(e);if(!1===t)return W(X(e),"Invalid input.");"number"===typeof t&&(e=t)}let i=U(e),o="";if((0,g.bb)(i)){if(Number.isNaN(i))return W(X(e),"The value cannot be interpreted as a number.");if((0,g.bb)(a)&&(s=i,i=0===(d=a)?Math.trunc(s):Math.trunc(s*10**d)/10**d),Number.isInteger(i)&&!Number.isSafeInteger(i))return W(X(e),"The value is larger than the maximum supported integer values in number columns (2^53).");try{o=Q(i,n.format,a)}catch(c){return W(X(i),(0,g.bb)(n.format)?"Failed to format the number based on the provided format configuration: (".concat(n.format,"). Error: ").concat(c):"Failed to format the number. Error: ".concat(c))}}var s,d;return{...l,data:i,displayData:o,isMissingValue:(0,g.le)(i)}},getCellValue:e=>void 0===e.data?null:e.data}}ve.isEditableType=!0;const ye=ve;function we(e){let t="string";const n=J({options:"bool"===ae.fu.getTypeName(e.arrowType)?[!0,!1]:[]},e.columnTypeOptions),i=new Set(n.options.map((e=>typeof e)));1===i.size&&(i.has("number")||i.has("bigint")?t="number":i.has("boolean")&&(t="boolean"));const a={kind:o.p6.Custom,allowOverlay:!0,copyData:"",contentAlign:e.contentAlignment,readonly:!e.isEditable,data:{kind:"dropdown-cell",allowedValues:[...!0!==e.isRequired?[null]:[],...n.options.filter((e=>null!==e&&""!==e)).map((e=>X(e)))],value:"",readonly:!e.isEditable}};return{...e,kind:"selectbox",sortMode:"default",getCell(e,t){let n=null;return(0,g.bb)(e)&&""!==e&&(n=X(e)),t&&!a.data.allowedValues.includes(n)?W(X(n),"The value is not part of the allowed options."):{...a,isMissingValue:null===n,copyData:n||"",data:{...a.data,value:n}}},getCellValue(e){var n,i,o,a,l,r,s;return(0,g.le)(null===(n=e.data)||void 0===n?void 0:n.value)||""===(null===(i=e.data)||void 0===i?void 0:i.value)?null:"number"===t?null!==(a=U(null===(l=e.data)||void 0===l?void 0:l.value))&&void 0!==a?a:null:"boolean"===t?null!==(r=G(null===(s=e.data)||void 0===s?void 0:s.value))&&void 0!==r?r:null:null===(o=e.data)||void 0===o?void 0:o.value}}}we.isEditableType=!0;const xe=we;function Ce(e){const t={kind:o.p6.Bubble,data:[],allowOverlay:!0,contentAlign:e.contentAlignment,style:e.isIndex?"faded":"normal"};return{...e,kind:"list",sortMode:"default",isEditable:!1,getCell(e){const n=(0,g.le)(e)?[]:K(e);return{...t,data:n,isMissingValue:(0,g.le)(e),copyData:(0,g.le)(e)?"":X(n.map((e=>"string"===typeof e&&e.includes(",")?e.replace(/,/g," "):e)))}},getCellValue:e=>(0,g.le)(e.data)||B(e)?null:e.data}}Ce.isEditableType=!1;const Te=Ce;function ke(e,t,n){const i=new RegExp("".concat(e,"[,\\s].*{(?:[^}]*[\\s;]{1})?").concat(t,":\\s*([^;}]+)[;]?.*}"),"gm");n=n.replace(/{/g," {");const o=i.exec(n);if(o)return o[1].trim()}function Ee(e,t){const n=e.types.index[t],i=e.indexNames[t];let o=!0;return"range"===ae.fu.getTypeName(n)&&(o=!1),{id:"index-".concat(t),name:i,title:i,isEditable:o,arrowType:n,isIndex:!0,isHidden:!1}}function Me(e,t){const n=e.columns[0][t];let i,o=e.types.data[t];if((0,g.le)(o)&&(o={meta:null,numpy_type:"object",pandas_type:"object"}),"categorical"===ae.fu.getTypeName(o)){const n=e.getCategoricalOptions(t);(0,g.bb)(n)&&(i={options:n})}return{id:"column-".concat(n,"-").concat(t),name:n,title:n,isEditable:!0,arrowType:o,columnTypeOptions:i,isIndex:!1,isHidden:!1}}function Se(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;const i=e.arrowType?ae.fu.getTypeName(e.arrowType):null;let a;if("object"===e.kind)a=e.getCell((0,g.bb)(t.content)?ie(ae.fu.format(t.content,t.contentType,t.field)):null);else if(["time","date","datetime"].includes(e.kind)&&(0,g.bb)(t.content)&&("number"===typeof t.content||"bigint"===typeof t.content)){var l;let n;var r,s;if("time"===i&&(0,g.bb)(null===(l=t.field)||void 0===l||null===(l=l.type)||void 0===l?void 0:l.unit))n=V().unix(ae.fu.convertToSeconds(t.content,null!==(r=null===(s=t.field)||void 0===s||null===(s=s.type)||void 0===s?void 0:s.unit)&&void 0!==r?r:0)).utc().toDate();else n=V().utc(Number(t.content)).toDate();a=e.getCell(n)}else if("decimal"===i){const n=(0,g.le)(t.content)?null:ae.fu.format(t.content,t.contentType,t.field);a=e.getCell(n)}else a=e.getCell(t.content);if(P(a))return a;if(!e.isEditable){if((0,g.bb)(t.displayContent)){var d,c;const e=ie(t.displayContent);a.kind===o.p6.Text||a.kind===o.p6.Number?a={...a,displayData:e}:a.kind===o.p6.Custom&&"date-picker-cell"===(null===(d=a.data)||void 0===d?void 0:d.kind)?a={...a,data:{...a.data,displayDate:e}}:a.kind===o.p6.Custom&&"link-cell"===(null===(c=a.data)||void 0===c?void 0:c.kind)&&(a={...a,data:{...a.data,displayText:e}})}n&&t.cssId&&(a=function(e,t,n){const i={},o=ke(t,"color",n);o&&(i.textDark=o);const a=ke(t,"background-color",n);return a&&(i.bgCell=a),"yellow"===a&&void 0===o&&(i.textDark="#31333F"),i?{...e,themeOverride:i}:e}(a,t.cssId,n))}return a}function Ne(e){const t=e.columnTypeOptions||{};let n,i;if(t.validate)try{n=new RegExp(t.validate,"us")}catch(r){n="Invalid validate regex: ".concat(t.validate,".\nError: ").concat(r)}if(!(0,g.le)(t.display_text)&&t.display_text.includes("(")&&t.display_text.includes(")"))try{i=new RegExp(t.display_text,"us")}catch(r){i=void 0}const a={kind:o.p6.Custom,readonly:!e.isEditable,allowOverlay:!0,contentAlign:e.contentAlignment,style:e.isIndex?"faded":"normal",data:{kind:"link-cell",href:"",displayText:""},copyData:""},l=i=>{if((0,g.le)(i))return!e.isRequired;const o=X(i);return!(t.max_chars&&o.length>t.max_chars)&&!(n instanceof RegExp&&!1===n.test(o))};return{...e,kind:"link",sortMode:"default",validateInput:l,getCell(e,o){if((0,g.le)(e))return{...a,data:{...a.data,href:null},isMissingValue:!0};const s=e;if("string"===typeof n)return W(X(s),n);if(o){if(!1===l(s))return W(X(s),"Invalid input.")}let d="";return s&&(d=void 0!==i?function(e,t){if((0,g.le)(t))return"";try{const n=t.match(e);return n&&void 0!==n[1]?n[1]:t}catch(r){return t}}(i,s):t.display_text||s),{...a,data:{kind:"link-cell",href:s,displayText:d},copyData:s,cursor:"pointer",isMissingValue:(0,g.le)(s)}},getCellValue(e){var t;return(0,g.le)(null===(t=e.data)||void 0===t?void 0:t.href)?null:e.data.href}}}Ne.isEditableType=!0;const Re=Ne;function _e(e){const t={kind:o.p6.Image,data:[],displayData:[],readonly:!0,allowOverlay:!0,contentAlign:e.contentAlignment||"center",style:e.isIndex?"faded":"normal"};return{...e,kind:"image",sortMode:"default",isEditable:!1,getCell(e){const n=(0,g.bb)(e)?[X(e)]:[];return{...t,data:n,isMissingValue:!(0,g.bb)(e),displayData:n}},getCellValue:e=>void 0===e.data||0===e.data.length?null:e.data[0]}}_e.isEditableType=!1;const Ie=_e;function Oe(e){const t=be(ae.fu.getTypeName(e.arrowType)),n=J({min_value:0,max_value:t?100:1,step:t?1:.01,format:t?"%3d%%":"percent"},e.columnTypeOptions);let i;try{i=Q(n.max_value,n.format)}catch(r){i=X(n.max_value)}const a=(0,g.le)(n.step)||Number.isNaN(n.step)?void 0:te(n.step),l={kind:o.p6.Custom,allowOverlay:!1,copyData:"",contentAlign:e.contentAlignment,data:{kind:"range-cell",min:n.min_value,max:n.max_value,step:n.step,value:n.min_value,label:String(n.min_value),measureLabel:i,readonly:!0}};return{...e,kind:"progress",sortMode:"smart",isEditable:!1,getCell(e){if((0,g.le)(e))return Y();if((0,g.le)(n.min_value)||(0,g.le)(n.max_value)||Number.isNaN(n.min_value)||Number.isNaN(n.max_value)||n.min_value>=n.max_value)return W("Invalid min/max parameters","The min_value (".concat(n.min_value,") and max_value (").concat(n.max_value,") parameters must be valid numbers."));if((0,g.le)(n.step)||Number.isNaN(n.step))return W("Invalid step parameter","The step parameter (".concat(n.step,") must be a valid number."));const t=U(e);if(Number.isNaN(t)||(0,g.le)(t))return W(X(e),"The value cannot be interpreted as a number.");if(Number.isInteger(t)&&!Number.isSafeInteger(t))return W(X(e),"The value is larger than the maximum supported integer values in number columns (2^53).");let i="";try{i=Q(t,n.format,a)}catch(r){return W(X(t),(0,g.bb)(n.format)?"Failed to format the number based on the provided format configuration: (".concat(n.format,"). Error: ").concat(r):"Failed to format the number. Error: ".concat(r))}const o=Math.min(n.max_value,Math.max(n.min_value,t));return{...l,isMissingValue:(0,g.le)(e),copyData:String(t),data:{...l.data,value:o,label:i}}},getCellValue(e){var t,n;return e.kind===o.p6.Loading||void 0===(null===(t=e.data)||void 0===t?void 0:t.value)?null:null===(n=e.data)||void 0===n?void 0:n.value}}}Oe.isEditableType=!1;const De=Oe;function Fe(e,t,n){const i=J({y_min:0,y_max:1},t.columnTypeOptions),a={kind:o.p6.Custom,allowOverlay:!1,copyData:"",contentAlign:t.contentAlignment,data:{kind:"sparkline-cell",values:[],displayValues:[],graphKind:n,yAxis:[i.y_min,i.y_max],hideAxis:"line"===n}};return{...t,kind:e,sortMode:"default",isEditable:!1,getCell(e){if((0,g.le)(i.y_min)||(0,g.le)(i.y_max)||Number.isNaN(i.y_min)||Number.isNaN(i.y_max)||i.y_min>=i.y_max)return W("Invalid min/max y-axis configuration","The y_min (".concat(i.y_min,") and y_max (").concat(i.y_max,") configuration options must be valid numbers."));if((0,g.le)(e))return Y();const t=K(e),n=[];let o=[];if(0===t.length)return Y();let l=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER;for(let i=0;i<t.length;i++){const e=U(t[i]);if(Number.isNaN(e)||(0,g.le)(e))return W(X(t),"The value cannot be interpreted as a numeric array. ".concat(X(e)," is not a number."));e>l&&(l=e),e<r&&(r=e),n.push(e)}return o=n.length>0&&(l>i.y_max||r<i.y_min)?n.map((e=>l-r===0?l>(i.y_max||1)?i.y_max||1:i.y_min||0:((i.y_max||1)-(i.y_min||0))*((e-r)/(l-r))+(i.y_min||0))):n,{...a,copyData:n.join(","),data:{...a.data,values:o,displayValues:n.map((e=>Q(e)))},isMissingValue:(0,g.le)(e)}},getCellValue(e){var t,n;return e.kind===o.p6.Loading||void 0===(null===(t=e.data)||void 0===t?void 0:t.values)?null:null===(n=e.data)||void 0===n?void 0:n.values}}}function He(e){return Fe("line_chart",e,"area")}function Ae(e){return Fe("bar_chart",e,"bar")}He.isEditableType=!1,Ae.isEditableType=!1;var ze=n(40047),Ve=n(42462);const je=(0,T.Z)("div",{target:"ex7xuzc0"})({name:"iatp2c",styles:"display:flex;flex-grow:1;align-items:center;min-height:21px;.gdg-link-area{flex-grow:1;flex-shrink:1;cursor:pointer;margin-right:8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--gdg-link-color);text-decoration:underline!important;padding-bottom:3px;}"}),Le=e=>{const{uri:t,onChange:n,readonly:i,validatedSelection:o,preview:a}=e;return i?(0,S.jsx)(je,{children:(0,S.jsx)("a",{"data-testid":"stLinkCell",className:"gdg-link-area",href:null!==t&&void 0!==t?t:"",target:"_blank",rel:"noopener noreferrer",children:a})}):(0,S.jsx)(Ve.K,{validatedSelection:o,highlight:!0,autoFocus:!0,value:null!==t&&void 0!==t?t:"",onChange:n})};const We={draw:(e,t)=>{const{ctx:n,rect:i,theme:o,hoverX:a=-100}=e,{href:l,displayText:r}=t.data;if((0,g.le)(l))return;const s=r||l,d=o.cellHorizontalPadding,c=i.x+d,u=i.x+a,m="".concat(o.baseFontStyle," ").concat(o.fontFamily);n.font=m;const h=(0,ze.aX)(n,m),p=i.y+i.height/2+h;if(u>i.x&&u<i.x+i.width){const e=(0,ze.P7)(s,n,m);n.moveTo(c,Math.floor(p+5)+.5),n.lineTo(c+e.width,Math.floor(p+5)+.5),n.strokeStyle=o.linkColor,n.stroke()}return n.fillStyle=o.linkColor,n.fillText(s,c,p),n.closePath(),!0},isMatch:e=>"link-cell"===e.data.kind,kind:o.p6.Custom,measure:(e,t,n)=>{const{href:i,displayText:o}=t.data;return(0,g.le)(i)?0:e.measureText(o||i).width+2*n.cellHorizontalPadding},needsHover:!0,needsHoverPosition:!0,onSelect:e=>{const t=function(e){var t;const n=document.createElement("canvas").getContext("2d",{alpha:!1});if(null===n)return;const{posX:i,bounds:o,cell:a,theme:l}=e,r="".concat(l.baseFontStyle," ").concat(l.fontFamily);n.font=r;const{href:s,displayText:d}=a.data,c=o.x+i,u=n.measureText(null!==(t=d||s)&&void 0!==t?t:"").width,m=o.x+l.cellHorizontalPadding;return c>m&&c<m+u?s:void 0}(e);(0,g.le)(t)||window.open(t,"_blank","noopener,noreferrer")},onDelete:e=>({...e,data:{...e.data,displayText:"",href:""}}),provideEditor:()=>e=>{var t;const{onChange:n,value:i,validatedSelection:o}=e,{href:a,displayText:l}=i.data;return(0,S.jsx)(Le,{uri:i.data.href,preview:null!==(t=l||a)&&void 0!==t?t:"",validatedSelection:o,readonly:!0===i.readonly,onChange:e=>n({...i,copyData:e.target.value,data:{...i.data,href:e.target.value}})})},onPaste:(e,t)=>e===t.href?void 0:{...t,href:e}},Pe=new Map(Object.entries({object:re,text:de,checkbox:fe,selectbox:xe,list:Te,number:ye,link:Re,datetime:me,date:ge,time:he,line_chart:He,bar_chart:Ae,image:Ie,progress:De})),Be=[We],Ye="_index",Ze="_pos:",qe={small:75,medium:200,large:400};function Je(e){if(!(0,g.le)(e))return"number"===typeof e?e:e in qe?qe[e]:void 0}function Ke(e,t){if(!t)return e;let n;return t.has(e.name)&&e.name!==Ye?n=t.get(e.name):t.has("".concat(Ze).concat(e.indexNumber))?n=t.get("".concat(Ze).concat(e.indexNumber)):e.isIndex&&t.has(Ye)&&(n=t.get(Ye)),n?D()({...e},{title:n.label,width:Je(n.width),isEditable:(0,g.bb)(n.disabled)?!n.disabled:void 0,isHidden:n.hidden,isRequired:n.required,columnTypeOptions:n.type_config,contentAlignment:n.alignment,defaultValue:n.default,help:n.help}):e}function Xe(e){var t;const n=null===(t=e.columnTypeOptions)||void 0===t?void 0:t.type;let i;return(0,g.bb)(n)&&(Pe.has(n)?i=Pe.get(n):(0,oe.KE)("Unknown column type configured in column configuration: ".concat(n))),(0,g.le)(i)&&(i=function(e){let t=e?ae.fu.getTypeName(e):null;return t?(t=t.toLowerCase().trim(),["unicode","empty"].includes(t)?de:["datetime","datetimetz"].includes(t)?me:"time"===t?he:"date"===t?ge:["object","bytes"].includes(t)?re:["bool"].includes(t)?fe:["int8","int16","int32","int64","uint8","uint16","uint32","uint64","float16","float32","float64","float96","float128","range","decimal"].includes(t)?ye:"categorical"===t?xe:t.startsWith("list")?Te:re):re}(e.arrowType)),i}const Ge=function(e,t,n){const o=(0,p.u)(),a=i.useMemo((()=>function(e){if(!e)return new Map;try{return new Map(Object.entries(JSON.parse(e)))}catch(t){return(0,oe.H)(t),new Map}}(e.columns)),[e.columns]),l=e.useContainerWidth||(0,g.bb)(e.width)&&e.width>0;return{columns:i.useMemo((()=>{let i=function(e){const t=[],{dimensions:n}=e,i=n.headerColumns,o=n.dataColumns;if(0===i&&0===o)return t.push({id:"empty-index",title:"",indexNumber:0,isEditable:!1,isIndex:!0}),t;for(let a=0;a<i;a++){const n={...Ee(e,a),indexNumber:a};t.push(n)}for(let a=0;a<o;a++){const n={...Me(e,a),indexNumber:a+i};t.push(n)}return t}(t).map((t=>{let i={...t,...Ke(t,a),isStretched:l};const r=Xe(i);return(e.editingMode===h.Eh.EditingMode.READ_ONLY||n||!1===r.isEditableType)&&(i={...i,isEditable:!1}),e.editingMode!==h.Eh.EditingMode.READ_ONLY&&1==i.isEditable&&(i={...i,icon:"editable"},i.isRequired&&e.editingMode===h.Eh.EditingMode.DYNAMIC&&(i={...i,isHidden:!1})),r(i,o)})).filter((e=>!e.isHidden));if(e.columnOrder&&e.columnOrder.length>0){const t=[];i.forEach((e=>{e.isIndex&&t.push(e)})),e.columnOrder.forEach((e=>{const n=i.find((t=>t.name===e));n&&!n.isIndex&&t.push(n)})),i=t}return i.length>0?i:[re({id:"empty-index",title:"",indexNumber:0,isEditable:!1,isIndex:!0})]}),[t,a,l,n,e.editingMode,e.columnOrder,o])}};function Ue(e){return e.isIndex?Ye:(0,g.le)(e.name)?"":e.name}const Qe=class{constructor(e){this.editedCells=new Map,this.addedRows=[],this.deletedRows=[],this.numRows=0,this.numRows=e}toJson(e){const t=new Map;e.forEach((e=>{t.set(e.indexNumber,e)}));const n={edited_rows:{},added_rows:[],deleted_rows:[]};this.editedCells.forEach(((e,i,o)=>{const a={};e.forEach(((e,n,i)=>{const o=t.get(n);o&&(a[Ue(o)]=o.getCellValue(e))})),n.edited_rows[i]=a})),this.addedRows.forEach((e=>{const i={};let o=!1;e.forEach(((e,n,a)=>{const l=t.get(n);if(l){const t=l.getCellValue(e);l.isRequired&&l.isEditable&&B(e)&&(o=!0),(0,g.bb)(t)&&(i[Ue(l)]=t)}})),o||n.added_rows.push(i)})),n.deleted_rows=this.deletedRows;return JSON.stringify(n,((e,t)=>void 0===t?null:t))}fromJson(e,t){this.editedCells=new Map,this.addedRows=[],this.deletedRows=[];const n=JSON.parse(e),i=new Map;t.forEach((e=>{i.set(e.indexNumber,e)}));const o=new Map;t.forEach((e=>{o.set(Ue(e),e)})),Object.keys(n.edited_rows).forEach((e=>{const t=Number(e),i=n.edited_rows[e];Object.keys(i).forEach((e=>{const n=i[e],a=o.get(e);if(a){const e=a.getCell(n);var l;if(e)this.editedCells.has(t)||this.editedCells.set(t,new Map),null===(l=this.editedCells.get(t))||void 0===l||l.set(a.indexNumber,e)}}))})),n.added_rows.forEach((e=>{const t=new Map;Object.keys(e).forEach((n=>{const i=e[n],a=o.get(n);if(a){const e=a.getCell(i);e&&t.set(a.indexNumber,e)}})),this.addedRows.push(t)})),this.deletedRows=n.deleted_rows}isAddedRow(e){return e>=this.numRows}getCell(e,t){if(this.isAddedRow(t))return this.addedRows[t-this.numRows].get(e);const n=this.editedCells.get(t);return void 0!==n?n.get(e):void 0}setCell(e,t,n){if(this.isAddedRow(t)){if(t-this.numRows>=this.addedRows.length)return;this.addedRows[t-this.numRows].set(e,n)}else{void 0===this.editedCells.get(t)&&this.editedCells.set(t,new Map);this.editedCells.get(t).set(e,n)}}addRow(e){this.addedRows.push(e)}deleteRows(e){e.sort(((e,t)=>t-e)).forEach((e=>{this.deleteRow(e)}))}deleteRow(e){(0,g.le)(e)||e<0||(this.isAddedRow(e)?this.addedRows.splice(e-this.numRows,1):(this.deletedRows.includes(e)||(this.deletedRows.push(e),this.deletedRows=this.deletedRows.sort(((e,t)=>e-t))),this.editedCells.delete(e)))}getOriginalRowIndex(e){let t=e;for(let n=0;n<this.deletedRows.length&&!(this.deletedRows[n]>t);n++)t+=1;return t}getNumRows(){return this.numRows+this.addedRows.length-this.deletedRows.length}};var $e=n(59990);const et=function(){const e=(0,p.u)(),t=i.useMemo((()=>({editable:e=>'<svg xmlns="http://www.w3.org/2000/svg" height="40" viewBox="0 96 960 960" width="40" fill="'.concat(e.bgColor,'"><path d="m800.641 679.743-64.384-64.384 29-29q7.156-6.948 17.642-6.948 10.485 0 17.742 6.948l29 29q6.948 7.464 6.948 17.95 0 10.486-6.948 17.434l-29 29Zm-310.64 246.256v-64.383l210.82-210.821 64.384 64.384-210.821 210.82h-64.383Zm-360-204.872v-50.254h289.743v50.254H130.001Zm0-162.564v-50.255h454.615v50.255H130.001Zm0-162.307v-50.255h454.615v50.255H130.001Z"/></svg>')})),[]);return{theme:i.useMemo((()=>({accentColor:e.colors.primary,accentFg:e.colors.white,accentLight:(0,$e.DZ)(e.colors.primary,.9),borderColor:e.colors.fadedText05,horizontalBorderColor:e.colors.fadedText05,fontFamily:e.genericFonts.bodyFont,bgSearchResult:(0,$e.DZ)(e.colors.primary,.9),resizeIndicatorColor:e.colors.primary,bgIconHeader:e.colors.fadedText60,fgIconHeader:e.colors.white,bgHeader:e.colors.bgMix,bgHeaderHasFocus:e.colors.secondaryBg,bgHeaderHovered:e.colors.secondaryBg,textHeader:e.colors.fadedText60,textHeaderSelected:e.colors.white,textGroupHeader:e.colors.fadedText60,headerFontStyle:"".concat(e.fontSizes.sm),baseFontStyle:e.fontSizes.sm,editorFontSize:e.fontSizes.sm,textDark:e.colors.bodyText,textMedium:(0,$e.DZ)(e.colors.bodyText,.2),textLight:e.colors.fadedText40,textBubble:e.colors.fadedText60,bgCell:e.colors.bgColor,bgCellMedium:e.colors.bgColor,cellHorizontalPadding:8,cellVerticalPadding:3,bgBubble:e.colors.secondaryBg,bgBubbleSelected:e.colors.secondaryBg,linkColor:e.colors.linkText,drilldownBorder:e.colors.darkenedBgMix25})),[e]),tableBorderRadius:e.radii.lg,headerIcons:t}};const tt=function(e,t,n,o){return{getCellContent:i.useCallback((i=>{let[a,l]=i;if(a>t.length-1)return W("Column index out of bounds.","This should never happen. Please report this bug.");if(l>n-1)return W("Row index out of bounds.","This should never happen. Please report this bug.");const r=t[a],s=r.indexNumber,d=o.current.getOriginalRowIndex(l);if(r.isEditable||o.current.isAddedRow(d)){const e=o.current.getCell(s,d);if(void 0!==e)return e}try{return Se(r,e.getCell(d+1,s),e.cssStyles)}catch(c){return(0,oe.H)(c),W("Error during cell creation.","This should never happen. Please report this bug. \nError: ".concat(c))}}),[t,n,e,o])}};var nt=n(71325);const it=function(e,t,n){const[o,a]=i.useState(),{getCellContent:l,getOriginalIndex:r}=(0,nt.fF)({columns:t.map((e=>q(e))),getCellContent:n,rows:e,sort:o}),s=i.useMemo((()=>function(e,t){return void 0===t?e:e.map((e=>e.id===t.column.id?{...e,title:"asc"===t.direction?"\u2191 ".concat(e.title):"\u2193 ".concat(e.title)}:e))}(t,o)),[t,o]),d=i.useCallback((e=>{let t="asc";const n=s[e];if(o&&o.column.id===n.id){if("asc"!==o.direction)return void a(void 0);t="desc"}a({column:q(n),direction:t,mode:n.sortMode})}),[o,s]);return{columns:s,sortColumn:d,getOriginalIndex:r,getCellContent:l}},ot=",",at='"',lt='"',rt="\n",st=new RegExp("[".concat([ot,at,rt].join(""),"]"));function dt(e){return e.map((e=>function(e){if((0,g.le)(e))return"";const t=X(e);if(st.test(t))return"".concat(at).concat(t.replace(new RegExp(at,"g"),lt+at)).concat(at);return t}(e))).join(ot)+rt}const ct=function(e,t,o){return{exportToCsv:i.useCallback((async()=>{try{const i=await n.e(5599).then(n.bind(n,95599)),a=(new Date).toISOString().slice(0,16).replace(":","-"),l="".concat(a,"_export.csv"),r=await i.showSaveFilePicker({suggestedName:l,types:[{accept:{"text/csv":[".csv"]}}],excludeAcceptAllOption:!1}),s=new TextEncoder,d=await r.createWritable();await d.write(s.encode("\ufeff"));const c=t.map((e=>e.name));await d.write(s.encode(dt(c)));for(let n=0;n<o;n++){const i=[];t.forEach(((t,o,a)=>{i.push(t.getCellValue(e([o,n])))})),await d.write(s.encode(dt(i)))}await d.close()}catch(i){(0,oe.KE)("Failed to export data as CSV",i)}}),[t,o,e])}};const ut=function(e,t,n,o,a,l,r){const s=i.useCallback(((t,i)=>{let[l,s]=t;const d=e[l];if(!d.isEditable)return;const c=d.indexNumber,u=n.current.getOriginalRowIndex(a(s)),m=o([l,s]),h=d.getCellValue(m),g=d.getCellValue(i);if(!P(m)&&g===h)return;const p=d.getCell(g,!0);P(p)?(0,oe.KE)("Not applying the cell edit since it causes this error:\n ".concat(p.data)):(n.current.setCell(c,u,{...p,lastUpdated:performance.now()}),r())}),[e,n,a,o,r]),d=i.useCallback((()=>{if(t)return;const i=new Map;e.forEach((e=>{i.set(e.indexNumber,e.getCell(e.defaultValue))})),n.current.addRow(i)}),[e,n,t]),c=i.useCallback((()=>{t||(d(),r())}),[d,r,t]),u=i.useCallback((i=>{var o;if(i.rows.length>0){if(t)return!0;const e=i.rows.toArray().map((e=>n.current.getOriginalRowIndex(a(e))));return n.current.deleteRows(e),r(!0),!1}if(null!==(o=i.current)&&void 0!==o&&o.range){const t=[],n=i.current.range;for(let i=n.y;i<n.y+n.height;i++)for(let o=n.x;o<n.x+n.width;o++){const n=e[o];n.isEditable&&!n.isRequired&&(t.push({cell:[o,i]}),s([o,i],n.getCell(null)))}return t.length>0&&(r(),l(t)),!1}return!0}),[e,n,t,l,a,r,s]),m=i.useCallback(((i,s)=>{const[c,u]=i,m=[];for(let h=0;h<s.length;h++){const i=s[h];if(h+u>=n.current.getNumRows()){if(t)break;d()}for(let t=0;t<i.length;t++){const l=i[t],r=h+u,s=t+c;if(s>=e.length)break;const d=e[s];if(d.isEditable){const e=d.getCell(l,!0);if((0,g.bb)(e)&&!P(e)){const t=d.indexNumber,i=n.current.getOriginalRowIndex(a(r)),l=d.getCellValue(o([s,r]));d.getCellValue(e)!==l&&(n.current.setCell(t,i,{...e,lastUpdated:performance.now()}),m.push({cell:[s,r]}))}}}m.length>0&&(r(),l(m))}return!1}),[e,n,t,a,o,d,r,l]),h=i.useCallback(((t,n)=>{const i=t[0];if(i>=e.length)return!0;const o=e[i];if(o.validateInput){const e=o.validateInput(o.getCellValue(n));return!0===e||!1===e?e:o.getCell(e)}return!0}),[e]);return{onCellEdited:s,onPaste:m,onRowAppended:c,onDelete:u,validateCell:h}};const mt=function(e,t){const[n,o]=i.useState(),a=i.useRef(null),l=i.useCallback((n=>{if(clearTimeout(a.current),a.current=0,o(void 0),("header"===n.kind||"cell"===n.kind)&&n.location){const i=n.location[0],l=n.location[1];let r;if(i<0||i>=e.length)return;const s=e[i];if("header"===n.kind&&(0,g.bb)(s))r=s.help;else if("cell"===n.kind){const e=t([i,l]);s.isRequired&&s.isEditable&&B(e)?r="\u26a0\ufe0f Please fill out this cell.":function(e){return e.hasOwnProperty("tooltip")&&""!==e.tooltip}(e)&&(r=e.tooltip)}r&&(a.current=setTimeout((()=>{r&&o({content:r,left:n.bounds.x+n.bounds.width/2,top:n.bounds.y})}),600))}}),[e,t,o,a]);return{tooltip:n,clearTooltip:i.useCallback((()=>{o(void 0)}),[o]),onItemHovered:l}};var ht=n(35185),gt=n(60353),pt=n(74625),ft=n(23213);const bt=function(e){return{drawCell:i.useCallback(((t,n)=>{const{cell:i,theme:o,ctx:a,rect:l}=t,r=t.col;if(B(i)&&r<e.length){const i=e[r];return["checkbox","line_chart","bar_chart","progress"].includes(i.kind)?n():(e=>{const{cell:t,theme:n,ctx:i}=e;(0,ze.L6)({...e,theme:{...n,textDark:n.textLight,headerFontFull:"".concat(n.headerFontStyle," ").concat(n.fontFamily),baseFontFull:"".concat(n.baseFontStyle," ").concat(n.fontFamily),markerFontFull:"".concat(n.markerFontStyle," ").concat(n.fontFamily)},spriteManager:{},hyperWrapping:!1},"None",t.contentAlign),i.fillStyle=n.textDark})(t),void(i.isRequired&&i.isEditable&&function(e,t,n){e.save(),e.beginPath(),e.moveTo(t.x+t.width-8,t.y+1),e.lineTo(t.x+t.width,t.y+1),e.lineTo(t.x+t.width,t.y+1+8),e.fillStyle=n.accentColor,e.fill(),e.restore()}(a,l,o))}n()}),[e]),customRenderers:i.useMemo((()=>[ht.Z,gt.Z,pt.Z,ft.ZP,...Be]),[])}};const vt=function(e){const[t,n]=(0,i.useState)((()=>new Map)),o=i.useCallback(((e,i,o,a)=>{e.id&&n(new Map(t).set(e.id,a))}),[t]);return{columns:i.useMemo((()=>e.map((e=>e.id&&t.has(e.id)&&void 0!==t.get(e.id)?{...e,width:t.get(e.id),grow:0}:e))),[e,t]),onColumnResize:o}},yt=2,wt=35,xt=50+yt,Ct=2*wt+yt;const Tt=function(e,t,n,o,a){let l,r=function(e){return Math.max(e*wt+yt,Ct)}(t+1+(e.editingMode===h.Eh.EditingMode.DYNAMIC?1:0)),s=Math.min(r,400);e.height&&(s=Math.max(e.height,Ct),r=Math.max(e.height,r)),o&&(s=Math.min(s,o),r=Math.min(r,o),e.height||(s=r));let d=n;e.useContainerWidth?l=n:e.width&&(l=Math.min(Math.max(e.width,xt),n),d=Math.min(Math.max(e.width,d),n));const[c,u]=i.useState({width:l||"100%",height:s});return i.useLayoutEffect((()=>{e.useContainerWidth&&"100%"===c.width&&u({width:n,height:c.height})}),[n]),i.useLayoutEffect((()=>{u({width:c.width,height:s})}),[t]),i.useLayoutEffect((()=>{u({width:l||"100%",height:c.height})}),[l]),i.useLayoutEffect((()=>{u({width:c.width,height:s})}),[s]),i.useLayoutEffect((()=>{if(a){const t=e.useContainerWidth||(0,g.bb)(e.width)&&e.width>0;u({width:t?d:"100%",height:r})}else u({width:l||"100%",height:s})}),[a]),{minHeight:Ct,maxHeight:r,minWidth:xt,maxWidth:d,resizableSize:c,setResizableSize:u}},kt=(0,T.Z)("img",{target:"e24uaba0"})((()=>({maxWidth:"100%",maxHeight:"600px",objectFit:"scale-down"})),""),Et=e=>{let{urls:t}=e;const n=t&&t.length>0?t[0]:"";return n.startsWith("http")?(0,S.jsx)("a",{href:n,target:"_blank",rel:"noreferrer noopener",children:(0,S.jsx)(kt,{src:n})}):(0,S.jsx)(kt,{src:n})};var Mt=n(98399),St=n(73830),Nt=n(37661);const Rt=function(e){let{top:t,left:n,content:o,clearTooltip:a}=e;const[l,r]=i.useState(!0),s=(0,p.u)(),{colors:d,fontSizes:c,radii:u}=s,m=i.useCallback((()=>{r(!1),a()}),[a,r]);return(0,S.jsx)(Mt.Z,{content:(0,S.jsx)(Nt.Uo,{className:"stTooltipContent",children:(0,S.jsx)(v.ZP,{style:{fontSize:c.sm},source:o,allowHTML:!1})}),placement:St.r4.top,accessibilityType:St.SI.tooltip,showArrow:!1,popoverMargin:5,onClickOutside:m,onEsc:m,overrides:{Body:{style:{borderTopLeftRadius:u.md,borderTopRightRadius:u.md,borderBottomLeftRadius:u.md,borderBottomRightRadius:u.md,paddingTop:"0 !important",paddingBottom:"0 !important",paddingLeft:"0 !important",paddingRight:"0 !important",backgroundColor:"transparent"}},Inner:{style:{backgroundColor:(0,k.Iy)(s)?d.bgColor:d.secondaryBg,color:d.bodyText,fontSize:c.sm,fontWeight:"normal",paddingTop:"0 !important",paddingBottom:"0 !important",paddingLeft:"0 !important",paddingRight:"0 !important"}}},isOpen:l,children:(0,S.jsx)("div",{className:"stTooltipTarget","data-testid":"stTooltipTarget",style:{position:"fixed",top:t,left:n}})})},_t=(0,T.Z)("div",{target:"e1w7nams0"})((e=>{let{hasCustomizedScrollbars:t,theme:n}=e;return{position:"relative",display:"inline-block","& .glideDataEditor":{height:"100%",minWidth:"100%",borderRadius:n.radii.lg},"& .dvn-scroller":{...!t&&{scrollbarWidth:"thin"},overflowX:"auto !important",overflowY:"auto !important"}}}),"");n(27235),n(33091);const It=(0,m.Z)((function(e){let{element:t,data:n,width:m,height:p,disabled:f,widgetMgr:b,isFullScreen:v,disableFullscreenMode:y,expand:w,collapse:x}=e;const C=i.useRef(null),T=i.useRef(null),k=i.useRef(null),{theme:E,headerIcons:M,tableBorderRadius:_}=et(),[I,O]=i.useState(!0),[D,F]=i.useState(!1),[H,A]=i.useState(!1),[z,V]=i.useState(!1),j=i.useMemo((()=>window.matchMedia&&window.matchMedia("(pointer: coarse)").matches),[]),L=i.useMemo((()=>window.navigator.userAgent.includes("Mac OS")&&window.navigator.userAgent.includes("Safari")||window.navigator.userAgent.includes("Chrome")),[]),[W,P]=i.useState({columns:o.EV.empty(),rows:o.EV.empty(),current:void 0}),B=i.useCallback((()=>{P({columns:o.EV.empty(),rows:o.EV.empty(),current:void 0})}),[]),Y=i.useCallback((()=>{P({columns:W.columns,rows:W.rows,current:void 0})}),[W]),J=i.useCallback((e=>{var t;null===(t=T.current)||void 0===t||t.updateCells(e)}),[]);(0,g.le)(t.editingMode)&&(t.editingMode=h.Eh.EditingMode.READ_ONLY);const{READ_ONLY:K,DYNAMIC:X}=h.Eh.EditingMode,G=n.dimensions,U=Math.max(0,G.rows-1),Q=0===U&&!(t.editingMode===X&&G.dataColumns>0),$=U>15e4,ee=i.useRef(new Qe(U)),[te,ne]=i.useState(ee.current.getNumRows());i.useEffect((()=>{ee.current=new Qe(U),ne(ee.current.getNumRows())}),[U]);const ie=i.useCallback((()=>{ee.current=new Qe(U),ne(ee.current.getNumRows())}),[U]),{columns:oe}=Ge(t,n,f);i.useEffect((()=>{if(t.editingMode!==K){const e=b.getStringValue(t);e&&(ee.current.fromJson(e,oe),ne(ee.current.getNumRows()))}}),[]);const{getCellContent:ae}=tt(n,oe,te,ee),{columns:le,sortColumn:re,getOriginalIndex:se,getCellContent:de}=it(U,oe,ae),ce=i.useCallback((function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];te!==ee.current.getNumRows()&&ne(ee.current.getNumRows()),e&&B(),(0,g.Ds)(100,(()=>{const e=ee.current.toJson(le);let i=b.getStringValue(t);void 0===i&&(i=new Qe(0).toJson([])),e!==i&&b.setStringValue(t,e,{fromUi:n})}))()}),[b,t,te,B,le]),{exportToCsv:ue}=ct(de,le,te),{onCellEdited:me,onPaste:he,onRowAppended:ge,onDelete:pe,validateCell:fe}=ut(le,t.editingMode!==X,ee,de,se,J,ce),{tooltip:be,clearTooltip:ve,onItemHovered:ye}=mt(le,de),{drawCell:we,customRenderers:xe}=bt(le),Ce=i.useMemo((()=>le.map((e=>q(e)))),[le]),{columns:Te,onColumnResize:ke}=vt(Ce),{minHeight:Ee,maxHeight:Me,minWidth:Se,maxWidth:Ne,resizableSize:Re,setResizableSize:_e}=Tt(t,te,m,p,v),Ie=i.useCallback((e=>{let[t,n]=e;return{...Z(!0,!1),displayData:"empty",contentAlign:"center",allowOverlay:!1,themeOverride:{textDark:E.textLight},span:[0,Math.max(le.length-1,0)]}}),[le,E.textLight]);i.useEffect((()=>{const e=new u.K;return e.manageFormClearListener(b,t.formId,ie),()=>{e.disconnect()}}),[t.formId,ie,b]);const Oe=!Q&&t.editingMode===X&&!f,De=W.rows.length>0,Fe=void 0!==W.current,He=Q?0:le.filter((e=>e.isIndex)).length;return i.useEffect((()=>{setTimeout((()=>{if(k.current&&T.current){var e;const t=null===(e=k.current)||void 0===e||null===(e=e.querySelector(".dvn-stack"))||void 0===e?void 0:e.getBoundingClientRect();t&&(A(t.height>k.current.clientHeight),V(t.width>k.current.clientWidth))}}),1)}),[Re,te,Te]),i.useEffect((()=>{Y()}),[v]),(0,S.jsxs)(_t,{"data-testid":"stDataFrame",className:"stDataFrame",hasCustomizedScrollbars:L,ref:k,onMouseDown:e=>{if(k.current&&L){const t=k.current.getBoundingClientRect();z&&t.height-7<e.clientY-t.top&&e.stopPropagation(),H&&t.width-7<e.clientX-t.left&&e.stopPropagation()}},onBlur:e=>{I||j||e.currentTarget.contains(e.relatedTarget)||Y()},children:[(0,S.jsxs)(R,{isFullScreen:v,disableFullscreenMode:y,locked:De||Fe||j&&I,onExpand:w,onCollapse:x,target:_t,children:[Oe&&De&&(0,S.jsx)(N,{label:"Delete row(s)",icon:r.H,onClick:()=>{pe&&(pe(W),ve())}}),Oe&&!De&&(0,S.jsx)(N,{label:"Add row",icon:s.m,onClick:()=>{ge&&(O(!0),ge(),ve())}}),!$&&!Q&&(0,S.jsx)(N,{label:"Download as CSV",icon:d.k,onClick:()=>ue()}),!Q&&(0,S.jsx)(N,{label:"Search",icon:c.o,onClick:()=>{D?F(!1):(O(!0),F(!0)),ve()}})]}),(0,S.jsx)(l.e,{"data-testid":"stDataFrameResizable",ref:C,defaultSize:Re,style:{border:"1px solid ".concat(E.borderColor),borderRadius:"".concat(_)},minHeight:Ee,maxHeight:Me,minWidth:Se,maxWidth:Ne,size:Re,enable:{top:!1,right:!1,bottom:!1,left:!1,topRight:!1,bottomRight:!0,bottomLeft:!1,topLeft:!1},grid:[1,wt],snapGap:wt/3,onResizeStop:(e,t,n,i)=>{C.current&&_e({width:C.current.size.width,height:Me-C.current.size.height===yt?C.current.size.height+yt:C.current.size.height})},children:(0,S.jsx)(a.F,{className:"glideDataEditor",ref:T,columns:Te,rows:Q?1:te,minColumnWidth:50,maxColumnWidth:1e3,maxColumnAutoWidth:500,rowHeight:wt,headerHeight:wt,getCellContent:Q?Ie:de,onColumnResize:j?void 0:ke,resizeIndicator:"header",freezeColumns:He,smoothScrollX:!0,smoothScrollY:!0,verticalBorder:!0,getCellsForSelection:!0,rowMarkers:"none",rangeSelect:j?"cell":"rect",columnSelect:"none",rowSelect:"none",onItemHovered:ye,keybindings:{downFill:!0},onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&"f"===e.key&&(F((e=>!e)),e.stopPropagation(),e.preventDefault())},showSearch:D,onSearchClose:()=>{F(!1),ve()},onHeaderClicked:Q||$?void 0:re,gridSelection:W,onGridSelectionChange:e=>{(I||j)&&(P(e),void 0!==be&&ve())},theme:E,onMouseMove:e=>{"out-of-bounds"===e.kind&&I?O(!1):"out-of-bounds"===e.kind||I||O(!0)},fixedShadowX:!0,fixedShadowY:!0,experimental:{scrollbarWidthOverride:0,...L&&{paddingBottom:z?-6:void 0,paddingRight:H?-6:void 0}},drawCell:we,customRenderers:xe,imageEditorOverride:Et,headerIcons:M,validateCell:fe,onPaste:!1,...!Q&&t.editingMode!==K&&!f&&{fillHandle:!j,onCellEdited:me,onPaste:he,onDelete:pe},...!Q&&t.editingMode===X&&{trailingRowOptions:{sticky:!1,tint:!0},rowMarkerTheme:{bgCell:E.bgHeader,bgCellMedium:E.bgHeader},rowMarkers:"checkbox",rowSelectionMode:"multi",rowSelect:f?"none":"multi",onRowAppended:f?void 0:ge,onHeaderClicked:void 0}})}),be&&be.content&&(0,S.jsx)(Rt,{top:be.top,left:be.left,content:be.content,clearTooltip:ve})]})}),!0)},52955:(e,t,n)=>{n.d(t,{K:()=>o});var i=n(50120);class o{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,n){null!=this.formClearListener&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,i.bM)(t)&&(this.formClearListener=e.addFormClearedListener(t,n),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}}}]);