ehristoforu commited on
Commit
2980219
1 Parent(s): 77d1ce0

Update assets/index-22f9acf0.js

Browse files
Files changed (1) hide show
  1. assets/index-22f9acf0.js +1 -1
assets/index-22f9acf0.js CHANGED
@@ -44,4 +44,4 @@ Error generating stack: `+i.message+`
44
  `)].join(`
45
  `));let p=a.props,m=typeof(p==null?void 0:p.className)=="function"?(...h)=>wu(p==null?void 0:p.className(...h),u.className):wu(p==null?void 0:p.className,u.className),v=m?{className:m}:{};return w.cloneElement(a,Object.assign({},Vf(a.props,Ja(fl(u,["ref"]))),d,s,uy(a.ref,s.ref),v))}return w.createElement(o,Object.assign({},fl(u,["ref"]),o!==w.Fragment&&s,o!==w.Fragment&&d),a)}function uy(...e){return{ref:e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}}function Vf(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map(r=>[r,void 0])));for(let r in n)Object.assign(t,{[r](o,...i){let l=n[r];for(let u of l){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;u(o,...i)}}});return t}function Fe(e){var t;return Object.assign(w.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function Ja(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function fl(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function sy(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&ay(n)?!1:r}function ay(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}let cy="div";var oi=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(oi||{});function dy(e,t){let{features:n=1,...r}=e,o={ref:t,"aria-hidden":(n&2)===2?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(n&4)===4&&(n&2)!==2&&{display:"none"}}};return je({ourProps:o,theirProps:r,slot:{},defaultTag:cy,name:"Hidden"})}let Su=Fe(dy),Ns=w.createContext(null);Ns.displayName="OpenClosedContext";var Pe=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Pe||{});function Ps(){return w.useContext(Ns)}function fy({value:e,children:t}){return M.createElement(Ns.Provider,{value:e},t)}var bf=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(bf||{});function Rs(e,t){let n=w.useRef([]),r=ue(e);w.useEffect(()=>{let o=[...n.current];for(let[i,l]of t.entries())if(n.current[i]!==l){let u=r(t,o);return n.current=t,u}},[r,...t])}function py(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function my(e,t,n){let r=wt(t);w.useEffect(()=>{function o(i){r.current(i)}return window.addEventListener(e,o,n),()=>window.removeEventListener(e,o,n)},[e,n])}var dr=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(dr||{});function hy(){let e=w.useRef(0);return my("keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}function Kr(){let e=w.useRef(!1);return lt(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Li(...e){return w.useMemo(()=>zf(...e),[...e])}function Wf(e,t,n,r){let o=wt(n);w.useEffect(()=>{e=e??window;function i(l){o.current(l)}return e.addEventListener(t,i,r),()=>e.removeEventListener(t,i,r)},[e,t,r])}function yy(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}function Qf(e){if(!e)return new Set;if(typeof e=="function")return new Set(e());let t=new Set;for(let n of e.current)n.current instanceof HTMLElement&&t.add(n.current);return t}let gy="div";var Kf=(e=>(e[e.None=1]="None",e[e.InitialFocus=2]="InitialFocus",e[e.TabLock=4]="TabLock",e[e.FocusLock=8]="FocusLock",e[e.RestoreFocus=16]="RestoreFocus",e[e.All=30]="All",e))(Kf||{});function vy(e,t){let n=w.useRef(null),r=Ye(n,t),{initialFocus:o,containers:i,features:l=30,...u}=e;Kn()||(l=1);let s=Li(n);ky({ownerDocument:s},!!(l&16));let a=Ey({ownerDocument:s,container:n,initialFocus:o},!!(l&2));Cy({ownerDocument:s,container:n,containers:i,previousActiveElement:a},!!(l&8));let d=hy(),p=ue(g=>{let T=n.current;T&&(f=>f())(()=>{he(d.current,{[dr.Forwards]:()=>{Uo(T,Jt.First,{skipElements:[g.relatedTarget]})},[dr.Backwards]:()=>{Uo(T,Jt.Last,{skipElements:[g.relatedTarget]})}})})}),m=Ts(),v=w.useRef(!1),h={ref:r,onKeyDown(g){g.key=="Tab"&&(v.current=!0,m.requestAnimationFrame(()=>{v.current=!1}))},onBlur(g){let T=Qf(i);n.current instanceof HTMLElement&&T.add(n.current);let f=g.relatedTarget;f instanceof HTMLElement&&f.dataset.headlessuiFocusGuard!=="true"&&(Gf(T,f)||(v.current?Uo(n.current,he(d.current,{[dr.Forwards]:()=>Jt.Next,[dr.Backwards]:()=>Jt.Previous})|Jt.WrapAround,{relativeTo:g.target}):g.target instanceof HTMLElement&&ln(g.target)))}};return M.createElement(M.Fragment,null,!!(l&4)&&M.createElement(Su,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:p,features:oi.Focusable}),je({ourProps:h,theirProps:u,defaultTag:gy,name:"FocusTrap"}),!!(l&4)&&M.createElement(Su,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:p,features:oi.Focusable}))}let wy=Fe(vy),ir=Object.assign(wy,{features:Kf}),Ut=[];yy(()=>{function e(t){t.target instanceof HTMLElement&&t.target!==document.body&&Ut[0]!==t.target&&(Ut.unshift(t.target),Ut=Ut.filter(n=>n!=null&&n.isConnected),Ut.splice(10))}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});function Sy(e=!0){let t=w.useRef(Ut.slice());return Rs(([n],[r])=>{r===!0&&n===!1&&Qr(()=>{t.current.splice(0)}),r===!1&&n===!0&&(t.current=Ut.slice())},[e,Ut,t]),ue(()=>{var n;return(n=t.current.find(r=>r!=null&&r.isConnected))!=null?n:null})}function ky({ownerDocument:e},t){let n=Sy(t);Rs(()=>{t||(e==null?void 0:e.activeElement)===(e==null?void 0:e.body)&&ln(n())},[t]);let r=w.useRef(!1);w.useEffect(()=>(r.current=!1,()=>{r.current=!0,Qr(()=>{r.current&&ln(n())})}),[])}function Ey({ownerDocument:e,container:t,initialFocus:n},r){let o=w.useRef(null),i=Kr();return Rs(()=>{if(!r)return;let l=t.current;l&&Qr(()=>{if(!i.current)return;let u=e==null?void 0:e.activeElement;if(n!=null&&n.current){if((n==null?void 0:n.current)===u){o.current=u;return}}else if(l.contains(u)){o.current=u;return}n!=null&&n.current?ln(n.current):Uo(l,Jt.First)===Bf.Error&&console.warn("There are no focusable elements inside the <FocusTrap />"),o.current=e==null?void 0:e.activeElement})},[r]),o}function Cy({ownerDocument:e,container:t,containers:n,previousActiveElement:r},o){let i=Kr();Wf(e==null?void 0:e.defaultView,"focus",l=>{if(!o||!i.current)return;let u=Qf(n);t.current instanceof HTMLElement&&u.add(t.current);let s=r.current;if(!s)return;let a=l.target;a&&a instanceof HTMLElement?Gf(u,a)?(r.current=a,ln(a)):(l.preventDefault(),l.stopPropagation(),ln(s)):ln(r.current)},!0)}function Gf(e,t){for(let n of e)if(n.contains(t))return!0;return!1}let qf=w.createContext(!1);function xy(){return w.useContext(qf)}function ku(e){return M.createElement(qf.Provider,{value:e.force},e.children)}function Ty(e){let t=xy(),n=w.useContext(Xf),r=Li(e),[o,i]=w.useState(()=>{if(!t&&n!==null||vt.isServer)return null;let l=r==null?void 0:r.getElementById("headlessui-portal-root");if(l)return l;if(r===null)return null;let u=r.createElement("div");return u.setAttribute("id","headlessui-portal-root"),r.body.appendChild(u)});return w.useEffect(()=>{o!==null&&(r!=null&&r.body.contains(o)||r==null||r.body.appendChild(o))},[o,r]),w.useEffect(()=>{t||n!==null&&i(n.current)},[n,i,t]),o}let Ny=w.Fragment;function Py(e,t){let n=e,r=w.useRef(null),o=Ye(ly(d=>{r.current=d}),t),i=Li(r),l=Ty(r),[u]=w.useState(()=>{var d;return vt.isServer?null:(d=i==null?void 0:i.createElement("div"))!=null?d:null}),s=Kn(),a=w.useRef(!1);return lt(()=>{if(a.current=!1,!(!l||!u))return l.contains(u)||(u.setAttribute("data-headlessui-portal",""),l.appendChild(u)),()=>{a.current=!0,Qr(()=>{var d;a.current&&(!l||!u||(u instanceof Node&&l.contains(u)&&l.removeChild(u),l.childNodes.length<=0&&((d=l.parentElement)==null||d.removeChild(l))))})}},[l,u]),s?!l||!u?null:wf.createPortal(je({ourProps:{ref:o},theirProps:n,defaultTag:Ny,name:"Portal"}),u):null}let Ry=w.Fragment,Xf=w.createContext(null);function Ly(e,t){let{target:n,...r}=e,o={ref:Ye(t)};return M.createElement(Xf.Provider,{value:n},je({ourProps:o,theirProps:r,defaultTag:Ry,name:"Popover.Group"}))}let _y=Fe(Py),Uy=Fe(Ly),Eu=Object.assign(_y,{Group:Uy}),Yf=w.createContext(null);function Jf(){let e=w.useContext(Yf);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Jf),t}return e}function Oy(){let[e,t]=w.useState([]);return[e.length>0?e.join(" "):void 0,w.useMemo(()=>function(n){let r=ue(i=>(t(l=>[...l,i]),()=>t(l=>{let u=l.slice(),s=u.indexOf(i);return s!==-1&&u.splice(s,1),u}))),o=w.useMemo(()=>({register:r,slot:n.slot,name:n.name,props:n.props}),[r,n.slot,n.name,n.props]);return M.createElement(Yf.Provider,{value:o},n.children)},[t])]}let Fy="p";function Dy(e,t){let n=Gn(),{id:r=`headlessui-description-${n}`,...o}=e,i=Jf(),l=Ye(t);lt(()=>i.register(r),[r,i.register]);let u={ref:l,...i.props,id:r};return je({ourProps:u,theirProps:o,slot:i.slot||{},defaultTag:Fy,name:i.name||"Description"})}let Ay=Fe(Dy),My=Object.assign(Ay,{}),Ls=w.createContext(()=>{});Ls.displayName="StackContext";var Cu=(e=>(e[e.Add=0]="Add",e[e.Remove=1]="Remove",e))(Cu||{});function $y(){return w.useContext(Ls)}function Iy({children:e,onUpdate:t,type:n,element:r,enabled:o}){let i=$y(),l=ue((...u)=>{t==null||t(...u),i(...u)});return lt(()=>{let u=o===void 0||o===!0;return u&&l(0,n,r),()=>{u&&l(1,n,r)}},[l,n,r,o]),M.createElement(Ls.Provider,{value:l},e)}function zy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}const By=typeof Object.is=="function"?Object.is:zy,{useState:jy,useEffect:Hy,useLayoutEffect:Vy,useDebugValue:by}=Sl;function Wy(e,t,n){const r=t(),[{inst:o},i]=jy({inst:{value:r,getSnapshot:t}});return Vy(()=>{o.value=r,o.getSnapshot=t,pl(o)&&i({inst:o})},[e,r,t]),Hy(()=>(pl(o)&&i({inst:o}),e(()=>{pl(o)&&i({inst:o})})),[e]),by(r),r}function pl(e){const t=e.getSnapshot,n=e.value;try{const r=t();return!By(n,r)}catch{return!0}}function Qy(e,t,n){return t()}const Ky=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Gy=!Ky,qy=Gy?Qy:Wy,Xy="useSyncExternalStore"in Sl?(e=>e.useSyncExternalStore)(Sl):qy;function Yy(e){return Xy(e.subscribe,e.getSnapshot,e.getSnapshot)}function Jy(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(o){return r.add(o),()=>r.delete(o)},dispatch(o,...i){let l=t[o].call(n,...i);l&&(n=l,r.forEach(u=>u()))}}}function Zy(){let e;return{before({doc:t}){var n;let r=t.documentElement;e=((n=t.defaultView)!=null?n:window).innerWidth-r.clientWidth},after({doc:t,d:n}){let r=t.documentElement,o=r.clientWidth-r.offsetWidth,i=e-o;n.style(r,"paddingRight",`${i}px`)}}}function e1(){if(!py())return{};let e;return{before(){e=window.pageYOffset},after({doc:t,d:n,meta:r}){function o(l){return r.containers.flatMap(u=>u()).some(u=>u.contains(l))}n.style(t.body,"marginTop",`-${e}px`),window.scrollTo(0,0);let i=null;n.addEventListener(t,"click",l=>{if(l.target instanceof HTMLElement)try{let u=l.target.closest("a");if(!u)return;let{hash:s}=new URL(u.href),a=t.querySelector(s);a&&!o(a)&&(i=a)}catch{}},!0),n.addEventListener(t,"touchmove",l=>{l.target instanceof HTMLElement&&!o(l.target)&&l.preventDefault()},{passive:!1}),n.add(()=>{window.scrollTo(0,window.pageYOffset+e),i&&i.isConnected&&(i.scrollIntoView({block:"nearest"}),i=null)})}}}function t1(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function n1(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let nn=Jy(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:Qn(),meta:new Set};return r.count++,r.meta.add(t),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:n}){let r={doc:e,d:t,meta:n1(n)},o=[e1(),Zy(),t1()];o.forEach(({before:i})=>i==null?void 0:i(r)),o.forEach(({after:i})=>i==null?void 0:i(r))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});nn.subscribe(()=>{let e=nn.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let r=t.get(n.doc)==="hidden",o=n.count!==0;(o&&!r||!o&&r)&&nn.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&nn.dispatch("TEARDOWN",n)}});function r1(e,t,n){let r=Yy(nn),o=e?r.get(e):void 0,i=o?o.count>0:!1;return lt(()=>{if(!(!e||!t))return nn.dispatch("PUSH",e,n),()=>nn.dispatch("POP",e,n)},[t,e]),i}let ml=new Map,lr=new Map;function Za(e,t=!0){lt(()=>{var n;if(!t)return;let r=typeof e=="function"?e():e.current;if(!r)return;function o(){var l;if(!r)return;let u=(l=lr.get(r))!=null?l:1;if(u===1?lr.delete(r):lr.set(r,u-1),u!==1)return;let s=ml.get(r);s&&(s["aria-hidden"]===null?r.removeAttribute("aria-hidden"):r.setAttribute("aria-hidden",s["aria-hidden"]),r.inert=s.inert,ml.delete(r))}let i=(n=lr.get(r))!=null?n:0;return lr.set(r,i+1),i!==0||(ml.set(r,{"aria-hidden":r.getAttribute("aria-hidden"),inert:r.inert}),r.setAttribute("aria-hidden","true"),r.inert=!0),o},[e,t])}var o1=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(o1||{}),i1=(e=>(e[e.SetTitleId=0]="SetTitleId",e))(i1||{});let l1={[0](e,t){return e.titleId===t.id?e:{...e,titleId:t.id}}},ii=w.createContext(null);ii.displayName="DialogContext";function Gr(e){let t=w.useContext(ii);if(t===null){let n=new Error(`<${e} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Gr),n}return t}function u1(e,t,n=()=>[document.body]){r1(e,t,r=>{var o;return{containers:[...(o=r.containers)!=null?o:[],n]}})}function s1(e,t){return he(t.type,l1,e,t)}let a1="div",c1=ri.RenderStrategy|ri.Static;function d1(e,t){let n=Gn(),{id:r=`headlessui-dialog-${n}`,open:o,onClose:i,initialFocus:l,__demoMode:u=!1,...s}=e,[a,d]=w.useState(0),p=Ps();o===void 0&&p!==null&&(o=(p&Pe.Open)===Pe.Open);let m=w.useRef(null),v=Ye(m,t),h=w.useRef(null),g=Li(m),T=e.hasOwnProperty("open")||p!==null,f=e.hasOwnProperty("onClose");if(!T&&!f)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!T)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!f)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(typeof o!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${o}`);if(typeof i!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${i}`);let c=o?0:1,[y,k]=w.useReducer(s1,{titleId:null,descriptionId:null,panelRef:w.createRef()}),N=ue(()=>i(!1)),P=ue(Q=>k({type:0,id:Q})),x=Kn()?u?!1:c===0:!1,L=a>1,A=w.useContext(ii)!==null,U=L?"parent":"leaf",j=p!==null?(p&Pe.Closing)===Pe.Closing:!1,He=(()=>A||j?!1:x)(),Ve=w.useCallback(()=>{var Q,te;return(te=Array.from((Q=g==null?void 0:g.querySelectorAll("body > *"))!=null?Q:[]).find(G=>G.id==="headlessui-portal-root"?!1:G.contains(h.current)&&G instanceof HTMLElement))!=null?te:null},[h]);Za(Ve,He);let mn=(()=>L?!0:x)(),ut=w.useCallback(()=>{var Q,te;return(te=Array.from((Q=g==null?void 0:g.querySelectorAll("[data-headlessui-portal]"))!=null?Q:[]).find(G=>G.contains(h.current)&&G instanceof HTMLElement))!=null?te:null},[h]);Za(ut,mn);let st=ue(()=>{var Q,te;return[...Array.from((Q=g==null?void 0:g.querySelectorAll("html > *, body > *, [data-headlessui-portal]"))!=null?Q:[]).filter(G=>!(G===document.body||G===document.head||!(G instanceof HTMLElement)||G.contains(h.current)||y.panelRef.current&&G.contains(y.panelRef.current))),(te=y.panelRef.current)!=null?te:m.current]}),Kt=(()=>!(!x||L))();iy(()=>st(),N,Kt);let R=(()=>!(L||c!==0))();Wf(g==null?void 0:g.defaultView,"keydown",Q=>{R&&(Q.defaultPrevented||Q.key===bf.Escape&&(Q.preventDefault(),Q.stopPropagation(),N()))});let O=(()=>!(j||c!==0||A))();u1(g,O,st),w.useEffect(()=>{if(c!==0||!m.current)return;let Q=new ResizeObserver(te=>{for(let G of te){let qr=G.target.getBoundingClientRect();qr.x===0&&qr.y===0&&qr.width===0&&qr.height===0&&N()}});return Q.observe(m.current),()=>Q.disconnect()},[c,m,N]);let[F,B]=Oy(),ee=w.useMemo(()=>[{dialogState:c,close:N,setTitleId:P},y],[c,y,N,P]),Gt=w.useMemo(()=>({open:c===0}),[c]),at={ref:v,id:r,role:"dialog","aria-modal":c===0?!0:void 0,"aria-labelledby":y.titleId,"aria-describedby":F};return M.createElement(Iy,{type:"Dialog",enabled:c===0,element:m,onUpdate:ue((Q,te)=>{te==="Dialog"&&he(Q,{[Cu.Add]:()=>d(G=>G+1),[Cu.Remove]:()=>d(G=>G-1)})})},M.createElement(ku,{force:!0},M.createElement(Eu,null,M.createElement(ii.Provider,{value:ee},M.createElement(Eu.Group,{target:m},M.createElement(ku,{force:!1},M.createElement(B,{slot:Gt,name:"Dialog.Description"},M.createElement(ir,{initialFocus:l,containers:st,features:x?he(U,{parent:ir.features.RestoreFocus,leaf:ir.features.All&~ir.features.FocusLock}):ir.features.None},je({ourProps:at,theirProps:s,slot:Gt,defaultTag:a1,features:c1,visible:c===0,name:"Dialog"})))))))),M.createElement(Su,{features:oi.Hidden,ref:h}))}let f1="div";function p1(e,t){let n=Gn(),{id:r=`headlessui-dialog-overlay-${n}`,...o}=e,[{dialogState:i,close:l}]=Gr("Dialog.Overlay"),u=Ye(t),s=ue(d=>{if(d.target===d.currentTarget){if(sy(d.currentTarget))return d.preventDefault();d.preventDefault(),d.stopPropagation(),l()}}),a=w.useMemo(()=>({open:i===0}),[i]);return je({ourProps:{ref:u,id:r,"aria-hidden":!0,onClick:s},theirProps:o,slot:a,defaultTag:f1,name:"Dialog.Overlay"})}let m1="div";function h1(e,t){let n=Gn(),{id:r=`headlessui-dialog-backdrop-${n}`,...o}=e,[{dialogState:i},l]=Gr("Dialog.Backdrop"),u=Ye(t);w.useEffect(()=>{if(l.panelRef.current===null)throw new Error("A <Dialog.Backdrop /> component is being used, but a <Dialog.Panel /> component is missing.")},[l.panelRef]);let s=w.useMemo(()=>({open:i===0}),[i]);return M.createElement(ku,{force:!0},M.createElement(Eu,null,je({ourProps:{ref:u,id:r,"aria-hidden":!0},theirProps:o,slot:s,defaultTag:m1,name:"Dialog.Backdrop"})))}let y1="div";function g1(e,t){let n=Gn(),{id:r=`headlessui-dialog-panel-${n}`,...o}=e,[{dialogState:i},l]=Gr("Dialog.Panel"),u=Ye(t,l.panelRef),s=w.useMemo(()=>({open:i===0}),[i]),a=ue(d=>{d.stopPropagation()});return je({ourProps:{ref:u,id:r,onClick:a},theirProps:o,slot:s,defaultTag:y1,name:"Dialog.Panel"})}let v1="h2";function w1(e,t){let n=Gn(),{id:r=`headlessui-dialog-title-${n}`,...o}=e,[{dialogState:i,setTitleId:l}]=Gr("Dialog.Title"),u=Ye(t);w.useEffect(()=>(l(r),()=>l(null)),[r,l]);let s=w.useMemo(()=>({open:i===0}),[i]);return je({ourProps:{ref:u,id:r},theirProps:o,slot:s,defaultTag:v1,name:"Dialog.Title"})}let S1=Fe(d1),k1=Fe(h1),E1=Fe(g1),C1=Fe(p1),x1=Fe(w1),hl=Object.assign(S1,{Backdrop:k1,Panel:E1,Overlay:C1,Title:x1,Description:My});function T1(e=0){let[t,n]=w.useState(e),r=Kr(),o=w.useCallback(s=>{r.current&&n(a=>a|s)},[t,r]),i=w.useCallback(s=>!!(t&s),[t]),l=w.useCallback(s=>{r.current&&n(a=>a&~s)},[n,r]),u=w.useCallback(s=>{r.current&&n(a=>a^s)},[n]);return{flags:t,addFlag:o,hasFlag:i,removeFlag:l,toggleFlag:u}}function N1(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}function yl(e,...t){e&&t.length>0&&e.classList.add(...t)}function gl(e,...t){e&&t.length>0&&e.classList.remove(...t)}function P1(e,t){let n=Qn();if(!e)return n.dispose;let{transitionDuration:r,transitionDelay:o}=getComputedStyle(e),[i,l]=[r,o].map(s=>{let[a=0]=s.split(",").filter(Boolean).map(d=>d.includes("ms")?parseFloat(d):parseFloat(d)*1e3).sort((d,p)=>p-d);return a}),u=i+l;if(u!==0){n.group(a=>{a.setTimeout(()=>{t(),a.dispose()},u),a.addEventListener(e,"transitionrun",d=>{d.target===d.currentTarget&&a.dispose()})});let s=n.addEventListener(e,"transitionend",a=>{a.target===a.currentTarget&&(t(),s())})}else t();return n.add(()=>t()),n.dispose}function R1(e,t,n,r){let o=n?"enter":"leave",i=Qn(),l=r!==void 0?N1(r):()=>{};o==="enter"&&(e.removeAttribute("hidden"),e.style.display="");let u=he(o,{enter:()=>t.enter,leave:()=>t.leave}),s=he(o,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),a=he(o,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return gl(e,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),yl(e,...u,...a),i.nextFrame(()=>{gl(e,...a),yl(e,...s),P1(e,()=>(gl(e,...u),yl(e,...t.entered),l()))}),i.dispose}function L1({container:e,direction:t,classes:n,onStart:r,onStop:o}){let i=Kr(),l=Ts(),u=wt(t);lt(()=>{let s=Qn();l.add(s.dispose);let a=e.current;if(a&&u.current!=="idle"&&i.current)return s.dispose(),r.current(u.current),s.add(R1(a,n.current,u.current==="enter",()=>{s.dispose(),o.current(u.current)})),s.dispose},[t])}function qt(e=""){return e.split(" ").filter(t=>t.trim().length>1)}let _i=w.createContext(null);_i.displayName="TransitionContext";var _1=(e=>(e.Visible="visible",e.Hidden="hidden",e))(_1||{});function U1(){let e=w.useContext(_i);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function O1(){let e=w.useContext(Ui);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let Ui=w.createContext(null);Ui.displayName="NestingContext";function Oi(e){return"children"in e?Oi(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function Zf(e,t){let n=wt(e),r=w.useRef([]),o=Kr(),i=Ts(),l=ue((v,h=ht.Hidden)=>{let g=r.current.findIndex(({el:T})=>T===v);g!==-1&&(he(h,{[ht.Unmount](){r.current.splice(g,1)},[ht.Hidden](){r.current[g].state="hidden"}}),i.microTask(()=>{var T;!Oi(r)&&o.current&&((T=n.current)==null||T.call(n))}))}),u=ue(v=>{let h=r.current.find(({el:g})=>g===v);return h?h.state!=="visible"&&(h.state="visible"):r.current.push({el:v,state:"visible"}),()=>l(v,ht.Unmount)}),s=w.useRef([]),a=w.useRef(Promise.resolve()),d=w.useRef({enter:[],leave:[],idle:[]}),p=ue((v,h,g)=>{s.current.splice(0),t&&(t.chains.current[h]=t.chains.current[h].filter(([T])=>T!==v)),t==null||t.chains.current[h].push([v,new Promise(T=>{s.current.push(T)})]),t==null||t.chains.current[h].push([v,new Promise(T=>{Promise.all(d.current[h].map(([f,c])=>c)).then(()=>T())})]),h==="enter"?a.current=a.current.then(()=>t==null?void 0:t.wait.current).then(()=>g(h)):g(h)}),m=ue((v,h,g)=>{Promise.all(d.current[h].splice(0).map(([T,f])=>f)).then(()=>{var T;(T=s.current.shift())==null||T()}).then(()=>g(h))});return w.useMemo(()=>({children:r,register:u,unregister:l,onStart:p,onStop:m,wait:a,chains:d}),[u,l,r,p,m,d,a])}function F1(){}let D1=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function ec(e){var t;let n={};for(let r of D1)n[r]=(t=e[r])!=null?t:F1;return n}function A1(e){let t=w.useRef(ec(e));return w.useEffect(()=>{t.current=ec(e)},[e]),t}let M1="div",ep=ri.RenderStrategy;function $1(e,t){let{beforeEnter:n,afterEnter:r,beforeLeave:o,afterLeave:i,enter:l,enterFrom:u,enterTo:s,entered:a,leave:d,leaveFrom:p,leaveTo:m,...v}=e,h=w.useRef(null),g=Ye(h,t),T=v.unmount?ht.Unmount:ht.Hidden,{show:f,appear:c,initial:y}=U1(),[k,N]=w.useState(f?"visible":"hidden"),P=O1(),{register:x,unregister:L}=P,A=w.useRef(null);w.useEffect(()=>x(h),[x,h]),w.useEffect(()=>{if(T===ht.Hidden&&h.current){if(f&&k!=="visible"){N("visible");return}return he(k,{hidden:()=>L(h),visible:()=>x(h)})}},[k,h,x,L,f,T]);let U=wt({enter:qt(l),enterFrom:qt(u),enterTo:qt(s),entered:qt(a),leave:qt(d),leaveFrom:qt(p),leaveTo:qt(m)}),j=A1({beforeEnter:n,afterEnter:r,beforeLeave:o,afterLeave:i}),He=Kn();w.useEffect(()=>{if(He&&k==="visible"&&h.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[h,k,He]);let Ve=y&&!c,mn=(()=>!He||Ve||A.current===f?"idle":f?"enter":"leave")(),ut=T1(0),st=ue(B=>he(B,{enter:()=>{ut.addFlag(Pe.Opening),j.current.beforeEnter()},leave:()=>{ut.addFlag(Pe.Closing),j.current.beforeLeave()},idle:()=>{}})),Kt=ue(B=>he(B,{enter:()=>{ut.removeFlag(Pe.Opening),j.current.afterEnter()},leave:()=>{ut.removeFlag(Pe.Closing),j.current.afterLeave()},idle:()=>{}})),R=Zf(()=>{N("hidden"),L(h)},P);L1({container:h,classes:U,direction:mn,onStart:wt(B=>{R.onStart(h,B,st)}),onStop:wt(B=>{R.onStop(h,B,Kt),B==="leave"&&!Oi(R)&&(N("hidden"),L(h))})}),w.useEffect(()=>{Ve&&(T===ht.Hidden?A.current=null:A.current=f)},[f,Ve,k]);let O=v,F={ref:g};return c&&f&&(O={...O,className:wu(v.className,...U.current.enter,...U.current.enterFrom)}),M.createElement(Ui.Provider,{value:R},M.createElement(fy,{value:he(k,{visible:Pe.Open,hidden:Pe.Closed})|ut.flags},je({ourProps:F,theirProps:O,defaultTag:M1,features:ep,visible:k==="visible",name:"Transition.Child"})))}function I1(e,t){let{show:n,appear:r=!1,unmount:o,...i}=e,l=w.useRef(null),u=Ye(l,t);Kn();let s=Ps();if(n===void 0&&s!==null&&(n=(s&Pe.Open)===Pe.Open),![!0,!1].includes(n))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[a,d]=w.useState(n?"visible":"hidden"),p=Zf(()=>{d("hidden")}),[m,v]=w.useState(!0),h=w.useRef([n]);lt(()=>{m!==!1&&h.current[h.current.length-1]!==n&&(h.current.push(n),v(!1))},[h,n]);let g=w.useMemo(()=>({show:n,appear:r,initial:m}),[n,r,m]);w.useEffect(()=>{if(n)d("visible");else if(!Oi(p))d("hidden");else{let f=l.current;if(!f)return;let c=f.getBoundingClientRect();c.x===0&&c.y===0&&c.width===0&&c.height===0&&d("hidden")}},[n,p]);let T={unmount:o};return M.createElement(Ui.Provider,{value:p},M.createElement(_i.Provider,{value:g},je({ourProps:{...T,as:w.Fragment,children:M.createElement(tp,{ref:u,...T,...i})},theirProps:{},defaultTag:w.Fragment,features:ep,visible:a==="visible",name:"Transition"})))}function z1(e,t){let n=w.useContext(_i)!==null,r=Ps()!==null;return M.createElement(M.Fragment,null,!n&&r?M.createElement(xu,{ref:t,...e}):M.createElement(tp,{ref:t,...e}))}let xu=Fe(I1),tp=Fe($1),B1=Fe(z1),vl=Object.assign(xu,{Child:B1,Root:xu});function _s({show:e,onClose:t,onSubmit:n,title:r,content:o,submitText:i,submitEnabled:l=!0}){return C(vl,{appear:!0,show:e,as:w.Fragment,children:I(hl,{as:"div",className:"relative z-10",onClose:t,children:[C(vl.Child,{as:w.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:C("div",{className:"fixed inset-0 bg-black bg-opacity-25"})}),C("div",{className:"fixed inset-0 overflow-y-auto",children:C("div",{className:"flex min-h-full items-center justify-center p-4 text-center",children:C(vl.Child,{as:w.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",children:I(hl.Panel,{className:"w-full max-w-md transform overflow-hidden rounded-2xl bg-white p-6 text-left align-middle shadow-xl transition-all",children:[C(hl.Title,{as:"h3",className:"text-lg font-medium leading-6 text-gray-900",children:r}),C("div",{className:"mt-3 text-sm text-gray-500",children:o}),I("div",{className:"mt-4 flex flex-row-reverse",children:[i&&C("button",{type:"button",disabled:!l,className:`inline-flex ml-4 justify-center rounded-md border border-transparent ${l?"bg-indigo-600":"bg-grey-300"} px-4 py-2 text-sm font-medium text-indigo-100 ${l?"hover:bg-indigo-500 focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2":""} transition-all duration-300`,onClick:n,children:i}),C("button",{type:"button",className:"inline-flex justify-center rounded-md border border-transparent bg-indigo-100 px-4 py-2 text-sm font-medium text-indigo-900 hover:bg-indigo-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2 transition-all duration-300",onClick:t,children:"Close"})]})]})})})})]})})}function j1(e){return C("div",{children:C("input",{...e,type:"url",className:"my-2 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"www.example.com",required:!0})})}function H1(e){const t=w.useRef(null),n=w.useRef(null);return w.useEffect(()=>{t.current&&n.current&&(n.current.src=e.audioUrl,t.current.load())},[e.audioUrl]),C("div",{className:"flex relative z-10 p-4 w-full",children:C("audio",{ref:t,controls:!0,className:"w-full h-14 rounded-lg bg-white shadow-xl shadow-black/5 ring-1 ring-slate-700/10",children:C("source",{ref:n,type:e.mimeType})})})}function V1(e){const{isModelLoading:t,isTranscribing:n,onClick:r,...o}=e;return C("button",{...o,onClick:i=>{r&&!n&&!t&&r(i)},disabled:n,className:"text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center mr-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800 inline-flex items-center",children:t?C(tc,{text:"Loading model..."}):n?C(tc,{text:"Transcribing..."}):"Transcribe Audio"})}function tc(e){return I("div",{role:"status",children:[I("svg",{"aria-hidden":"true",role:"status",className:"inline w-4 h-4 mr-3 text-white animate-spin",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[C("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"#E5E7EB"}),C("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentColor"})]}),e.text]})}function b1(){let e=!1;return function(t){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(e=!0)}(navigator.userAgent||navigator.vendor||("opera"in window&&typeof window.opera=="string"?window.opera:"")),e}const W1=b1(),ft={SAMPLING_RATE:16e3,DEFAULT_AUDIO_URL:`https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/${W1?"jfk":"ted_60_16k"}.wav`,DEFAULT_MODEL:"distil-whisper/distil-medium.en",DEFAULT_SUBTASK:"transcribe",DEFAULT_LANGUAGE:"english",DEFAULT_QUANTIZED:!0,DEFAULT_MULTILINGUAL:!1};function Q1({text:e,percentage:t}){return t=t??0,C("div",{className:"mt-0.5 w-full relative text-sm text-white background-bg-cyan-400 bg-gray-200 border-1 border-gray-400 rounded-lg text-left overflow-hidden",children:I("div",{className:"top-0 h-full bg-blue-500 whitespace-nowrap px-2",style:{width:`${t}%`},children:[e," (",`${t.toFixed(2)}%`,")"]})})}function wl(e){return String(e).padStart(2,"0")}function np(e){const t=e/3600|0;e-=t*(60*60);const n=e/60|0;e-=n*60;const r=e|0;return`${t?wl(t)+":":""}${wl(n)}:${wl(r)}`}const K1={172351395:{name:"EBML",type:"Container"},646:{name:"EBMLVersion",type:"Uint"},759:{name:"EBMLReadVersion",type:"Uint"},754:{name:"EBMLMaxIDLength",type:"Uint"},755:{name:"EBMLMaxSizeLength",type:"Uint"},642:{name:"DocType",type:"String"},647:{name:"DocTypeVersion",type:"Uint"},645:{name:"DocTypeReadVersion",type:"Uint"},108:{name:"Void",type:"Binary"},63:{name:"CRC-32",type:"Binary"},190023271:{name:"SignatureSlot",type:"Container"},16010:{name:"SignatureAlgo",type:"Uint"},16026:{name:"SignatureHash",type:"Uint"},16037:{name:"SignaturePublicKey",type:"Binary"},16053:{name:"Signature",type:"Binary"},15963:{name:"SignatureElements",type:"Container"},15995:{name:"SignatureElementList",type:"Container"},9522:{name:"SignedElement",type:"Binary"},139690087:{name:"Segment",type:"Container"},21863284:{name:"SeekHead",type:"Container"},3515:{name:"Seek",type:"Container"},5035:{name:"SeekID",type:"Binary"},5036:{name:"SeekPosition",type:"Uint"},88713574:{name:"Info",type:"Container"},13220:{name:"SegmentUID",type:"Binary"},13188:{name:"SegmentFilename",type:"String"},1882403:{name:"PrevUID",type:"Binary"},1868715:{name:"PrevFilename",type:"String"},2013475:{name:"NextUID",type:"Binary"},1999803:{name:"NextFilename",type:"String"},1092:{name:"SegmentFamily",type:"Binary"},10532:{name:"ChapterTranslate",type:"Container"},10748:{name:"ChapterTranslateEditionUID",type:"Uint"},10687:{name:"ChapterTranslateCodec",type:"Uint"},10661:{name:"ChapterTranslateID",type:"Binary"},710577:{name:"TimecodeScale",type:"Uint"},1161:{name:"Duration",type:"Float"},1121:{name:"DateUTC",type:"Date"},15273:{name:"Title",type:"String"},3456:{name:"MuxingApp",type:"String"},5953:{name:"WritingApp",type:"String"},103:{name:"Timecode",type:"Uint"},6228:{name:"SilentTracks",type:"Container"},6359:{name:"SilentTrackNumber",type:"Uint"},39:{name:"Position",type:"Uint"},43:{name:"PrevSize",type:"Uint"},35:{name:"SimpleBlock",type:"Binary"},32:{name:"BlockGroup",type:"Container"},33:{name:"Block",type:"Binary"},34:{name:"BlockVirtual",type:"Binary"},13729:{name:"BlockAdditions",type:"Container"},38:{name:"BlockMore",type:"Container"},110:{name:"BlockAddID",type:"Uint"},37:{name:"BlockAdditional",type:"Binary"},27:{name:"BlockDuration",type:"Uint"},122:{name:"ReferencePriority",type:"Uint"},123:{name:"ReferenceBlock",type:"Int"},125:{name:"ReferenceVirtual",type:"Int"},36:{name:"CodecState",type:"Binary"},13730:{name:"DiscardPadding",type:"Int"},14:{name:"Slices",type:"Container"},104:{name:"TimeSlice",type:"Container"},76:{name:"LaceNumber",type:"Uint"},77:{name:"FrameNumber",type:"Uint"},75:{name:"BlockAdditionID",type:"Uint"},78:{name:"Delay",type:"Uint"},79:{name:"SliceDuration",type:"Uint"},72:{name:"ReferenceFrame",type:"Container"},73:{name:"ReferenceOffset",type:"Uint"},74:{name:"ReferenceTimeCode",type:"Uint"},47:{name:"EncryptedBlock",type:"Binary"},106212971:{name:"Tracks",type:"Container"},46:{name:"TrackEntry",type:"Container"},87:{name:"TrackNumber",type:"Uint"},13253:{name:"TrackUID",type:"Uint"},3:{name:"TrackType",type:"Uint"},57:{name:"FlagEnabled",type:"Uint"},8:{name:"FlagDefault",type:"Uint"},5546:{name:"FlagForced",type:"Uint"},28:{name:"FlagLacing",type:"Uint"},11751:{name:"MinCache",type:"Uint"},11768:{name:"MaxCache",type:"Uint"},254851:{name:"DefaultDuration",type:"Uint"},216698:{name:"DefaultDecodedFieldDuration",type:"Uint"},209231:{name:"TrackTimecodeScale",type:"Float"},4991:{name:"TrackOffset",type:"Int"},5614:{name:"MaxBlockAdditionID",type:"Uint"},4974:{name:"Name",type:"String"},177564:{name:"Language",type:"String"},6:{name:"CodecID",type:"String"},9122:{name:"CodecPrivate",type:"Binary"},362120:{name:"CodecName",type:"String"},13382:{name:"AttachmentLink",type:"Uint"},1742487:{name:"CodecSettings",type:"String"},1785920:{name:"CodecInfoURL",type:"String"},438848:{name:"CodecDownloadURL",type:"String"},42:{name:"CodecDecodeAll",type:"Uint"},12203:{name:"TrackOverlay",type:"Uint"},5802:{name:"CodecDelay",type:"Uint"},5819:{name:"SeekPreRoll",type:"Uint"},9764:{name:"TrackTranslate",type:"Container"},9980:{name:"TrackTranslateEditionUID",type:"Uint"},9919:{name:"TrackTranslateCodec",type:"Uint"},9893:{name:"TrackTranslateTrackID",type:"Binary"},96:{name:"Video",type:"Container"},26:{name:"FlagInterlaced",type:"Uint"},5048:{name:"StereoMode",type:"Uint"},5056:{name:"AlphaMode",type:"Uint"},5049:{name:"OldStereoMode",type:"Uint"},48:{name:"PixelWidth",type:"Uint"},58:{name:"PixelHeight",type:"Uint"},5290:{name:"PixelCropBottom",type:"Uint"},5307:{name:"PixelCropTop",type:"Uint"},5324:{name:"PixelCropLeft",type:"Uint"},5341:{name:"PixelCropRight",type:"Uint"},5296:{name:"DisplayWidth",type:"Uint"},5306:{name:"DisplayHeight",type:"Uint"},5298:{name:"DisplayUnit",type:"Uint"},5299:{name:"AspectRatioType",type:"Uint"},963876:{name:"ColourSpace",type:"Binary"},1029411:{name:"GammaValue",type:"Float"},230371:{name:"FrameRate",type:"Float"},97:{name:"Audio",type:"Container"},53:{name:"SamplingFrequency",type:"Float"},14517:{name:"OutputSamplingFrequency",type:"Float"},31:{name:"Channels",type:"Uint"},15739:{name:"ChannelPositions",type:"Binary"},8804:{name:"BitDepth",type:"Uint"},98:{name:"TrackOperation",type:"Container"},99:{name:"TrackCombinePlanes",type:"Container"},100:{name:"TrackPlane",type:"Container"},101:{name:"TrackPlaneUID",type:"Uint"},102:{name:"TrackPlaneType",type:"Uint"},105:{name:"TrackJoinBlocks",type:"Container"},109:{name:"TrackJoinUID",type:"Uint"},64:{name:"TrickTrackUID",type:"Uint"},65:{name:"TrickTrackSegmentUID",type:"Binary"},70:{name:"TrickTrackFlag",type:"Uint"},71:{name:"TrickMasterTrackUID",type:"Uint"},68:{name:"TrickMasterTrackSegmentUID",type:"Binary"},11648:{name:"ContentEncodings",type:"Container"},8768:{name:"ContentEncoding",type:"Container"},4145:{name:"ContentEncodingOrder",type:"Uint"},4146:{name:"ContentEncodingScope",type:"Uint"},4147:{name:"ContentEncodingType",type:"Uint"},4148:{name:"ContentCompression",type:"Container"},596:{name:"ContentCompAlgo",type:"Uint"},597:{name:"ContentCompSettings",type:"Binary"},4149:{name:"ContentEncryption",type:"Container"},2017:{name:"ContentEncAlgo",type:"Uint"},2018:{name:"ContentEncKeyID",type:"Binary"},2019:{name:"ContentSignature",type:"Binary"},2020:{name:"ContentSigKeyID",type:"Binary"},2021:{name:"ContentSigAlgo",type:"Uint"},2022:{name:"ContentSigHashAlgo",type:"Uint"},206814059:{name:"Cues",type:"Container"},59:{name:"CuePoint",type:"Container"},51:{name:"CueTime",type:"Uint"},55:{name:"CueTrackPositions",type:"Container"},119:{name:"CueTrack",type:"Uint"},113:{name:"CueClusterPosition",type:"Uint"},112:{name:"CueRelativePosition",type:"Uint"},50:{name:"CueDuration",type:"Uint"},4984:{name:"CueBlockNumber",type:"Uint"},106:{name:"CueCodecState",type:"Uint"},91:{name:"CueReference",type:"Container"},22:{name:"CueRefTime",type:"Uint"},23:{name:"CueRefCluster",type:"Uint"},4959:{name:"CueRefNumber",type:"Uint"},107:{name:"CueRefCodecState",type:"Uint"},155296873:{name:"Attachments",type:"Container"},8615:{name:"AttachedFile",type:"Container"},1662:{name:"FileDescription",type:"String"},1646:{name:"FileName",type:"String"},1632:{name:"FileMimeType",type:"String"},1628:{name:"FileData",type:"Binary"},1710:{name:"FileUID",type:"Uint"},1653:{name:"FileReferral",type:"Binary"},1633:{name:"FileUsedStartTime",type:"Uint"},1634:{name:"FileUsedEndTime",type:"Uint"},4433776:{name:"Chapters",type:"Container"},1465:{name:"EditionEntry",type:"Container"},1468:{name:"EditionUID",type:"Uint"},1469:{name:"EditionFlagHidden",type:"Uint"},1499:{name:"EditionFlagDefault",type:"Uint"},1501:{name:"EditionFlagOrdered",type:"Uint"},54:{name:"ChapterAtom",type:"Container"},13252:{name:"ChapterUID",type:"Uint"},5716:{name:"ChapterStringUID",type:"String"},17:{name:"ChapterTimeStart",type:"Uint"},18:{name:"ChapterTimeEnd",type:"Uint"},24:{name:"ChapterFlagHidden",type:"Uint"},1432:{name:"ChapterFlagEnabled",type:"Uint"},11879:{name:"ChapterSegmentUID",type:"Binary"},11964:{name:"ChapterSegmentEditionUID",type:"Uint"},9155:{name:"ChapterPhysicalEquiv",type:"Uint"},15:{name:"ChapterTrack",type:"Container"},9:{name:"ChapterTrackNumber",type:"Uint"},0:{name:"ChapterDisplay",type:"Container"},5:{name:"ChapString",type:"String"},892:{name:"ChapLanguage",type:"String"},894:{name:"ChapCountry",type:"String"},10564:{name:"ChapProcess",type:"Container"},10581:{name:"ChapProcessCodecID",type:"Uint"},1293:{name:"ChapProcessPrivate",type:"Binary"},10513:{name:"ChapProcessCommand",type:"Container"},10530:{name:"ChapProcessTime",type:"Uint"},10547:{name:"ChapProcessData",type:"Binary"},39109479:{name:"Tags",type:"Container"},13171:{name:"Tag",type:"Container"},9152:{name:"Targets",type:"Container"},10442:{name:"TargetTypeValue",type:"Uint"},9162:{name:"TargetType",type:"String"},9157:{name:"TagTrackUID",type:"Uint"},9161:{name:"TagEditionUID",type:"Uint"},9156:{name:"TagChapterUID",type:"Uint"},9158:{name:"TagAttachmentUID",type:"Uint"},10184:{name:"SimpleTag",type:"Container"},1443:{name:"TagName",type:"String"},1146:{name:"TagLanguage",type:"String"},1156:{name:"TagDefault",type:"Uint"},1159:{name:"TagString",type:"String"},1157:{name:"TagBinary",type:"Binary"}};class li{constructor(t="Unknown",n="Unknown"){qn(this,"source");qn(this,"data");this.name=t,this.type=n}updateBySource(){}setSource(t){this.source=t,this.updateBySource()}updateByData(){}setData(t){this.data=t,this.updateByData()}}class G1 extends li{constructor(t,n){super(t,n||"Uint")}updateBySource(){this.data="";for(let t=0;t<this.source.length;t++){const n=this.source[t].toString(16);this.data+=nc(n)}}updateByData(){const t=this.data.length/2;this.source=new Uint8Array(t);for(let n=0;n<t;n++){const r=this.data.substr(n*2,2);this.source[n]=parseInt(r,16)}}getValue(){return parseInt(this.data,16)}setValue(t){this.setData(nc(t.toString(16)))}}function nc(e){return e.length%2===1?"0"+e:e}class rp extends li{constructor(t,n){super(t,n||"Float")}getFloatArrayType(){return this.source&&this.source.length===4?Float32Array:Float64Array}updateBySource(){const t=this.source.reverse(),n=this.getFloatArrayType(),r=new n(t.buffer);this.data=r[0]}updateByData(){const t=this.getFloatArrayType(),n=new t([this.data]),r=new Uint8Array(n.buffer);this.source=r.reverse()}getValue(){return this.data}setValue(t){this.setData(t)}}class Us extends li{constructor(n,r){super(n,r||"Container");qn(this,"offset",0);qn(this,"data",[])}readByte(){return this.source[this.offset++]}readUint(){const n=this.readByte(),r=8-n.toString(2).length;let o=n-(1<<7-r);for(let i=0;i<r;i++)o*=256,o+=this.readByte();return o}updateBySource(){let n;for(this.data=[],this.offset=0;this.offset<this.source.length;this.offset=n){const r=this.readUint(),o=this.readUint();n=Math.min(this.offset+o,this.source.length);const i=this.source.slice(this.offset,n),l=K1[r]||{name:"Unknown",type:"Unknown"};let u=li;switch(l.type){case"Container":u=Us;break;case"Uint":u=G1;break;case"Float":u=rp;break}const s=new u(l.name,l.type);s.setSource(i),this.data.push({id:r,idHex:r.toString(16),data:s})}}writeUint(n,r=!1){for(var o=1,i=128;n>=i&&o<8;o++,i*=128);if(!r){let l=i+n;for(let u=o-1;u>=0;u--){const s=l%256;this.source[this.offset+u]=s,l=(l-s)/256}}this.offset+=o}writeSections(n=!1){this.offset=0;for(let r=0;r<this.data.length;r++){const o=this.data[r],i=o.data.source,l=i.length;this.writeUint(o.id,n),this.writeUint(l,n),n||this.source.set(i,this.offset),this.offset+=l}return this.offset}updateByData(){const n=this.writeSections(!0);this.source=new Uint8Array(n),this.writeSections()}getSectionById(n){for(let r=0;r<this.data.length;r++){const o=this.data[r];if(o.id===n)return o.data}}}class q1 extends Us{constructor(t){super("File","File"),this.setSource(t)}fixDuration(t){const n=this.getSectionById(139690087);if(!n)return!1;const r=n.getSectionById(88713574);if(!r)return!1;const o=r.getSectionById(710577);if(!o)return!1;let i=r.getSectionById(1161);if(i)if(i.getValue()<=0)i.setValue(t);else return!1;else i=new rp("Duration","Float"),i.setValue(t),r.data.push({id:1161,data:i});return o.setValue(1e6),r.updateByData(),n.updateByData(),this.updateByData(),!0}toBlob(t="video/webm"){return new Blob([this.source.buffer],{type:t})}}const X1=(e,t,n="video/webm")=>new Promise((r,o)=>{try{const i=new FileReader;i.addEventListener("loadend",()=>{try{const l=i.result,u=new q1(new Uint8Array(l));u.fixDuration(t)?r(u.toBlob(n)):r(e)}catch(l){o(l)}}),i.addEventListener("error",()=>o()),i.readAsArrayBuffer(e)}catch(i){o(i)}});function Y1(){const e=["audio/webm","audio/mp4","audio/ogg","audio/wav","audio/aac"];for(let t=0;t<e.length;t++)if(MediaRecorder.isTypeSupported(e[t]))return e[t]}function J1(e){const[t,n]=w.useState(!1),[r,o]=w.useState(0),[i,l]=w.useState(null),u=w.useRef(null),s=w.useRef(null),a=w.useRef([]),d=w.useRef(null),p=async()=>{l(null);let h=Date.now();try{u.current||(u.current=await navigator.mediaDevices.getUserMedia({audio:!0}));const g=Y1(),T=new MediaRecorder(u.current,{mimeType:g});s.current=T,T.addEventListener("dataavailable",async f=>{if(f.data.size>0&&a.current.push(f.data),T.state==="inactive"){const c=Date.now()-h;let y=new Blob(a.current,{type:g});g==="audio/webm"&&(y=await X1(y,c,y.type)),l(y),e.onRecordingComplete(y),a.current=[]}}),T.start(),n(!0)}catch(g){console.error("Error accessing microphone:",g)}},m=()=>{s.current&&s.current.state==="recording"&&(s.current.stop(),o(0),n(!1))};return w.useEffect(()=>{if(t){const h=setInterval(()=>{o(g=>g+1)},1e3);return()=>{clearInterval(h)}}return()=>{}},[t]),I("div",{className:"flex flex-col justify-center items-center",children:[C("button",{type:"button",className:`m-2 inline-flex justify-center rounded-md border border-transparent px-4 py-2 text-sm font-medium text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2 transition-all duration-200 ${t?"bg-red-500 hover:bg-red-600":"bg-green-500 hover:bg-green-600"}`,onClick:()=>{t?m():p()},children:t?`Stop Recording (${np(r)})`:"Start Recording"}),i&&C("audio",{className:"w-full",ref:d,controls:!0,children:C("source",{src:URL.createObjectURL(i),type:i.type})})]})}function Z1(e){return e=e.toLowerCase(),(e.match(/\w+.?/g)||[]).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}const rc={en:"english",zh:"chinese",de:"german",es:"spanish/castilian",ru:"russian",ko:"korean",fr:"french",ja:"japanese",pt:"portuguese",tr:"turkish",pl:"polish",ca:"catalan/valencian",nl:"dutch/flemish",ar:"arabic",sv:"swedish",it:"italian",id:"indonesian",hi:"hindi",fi:"finnish",vi:"vietnamese",he:"hebrew",uk:"ukrainian",el:"greek",ms:"malay",cs:"czech",ro:"romanian/moldavian/moldovan",da:"danish",hu:"hungarian",ta:"tamil",no:"norwegian",th:"thai",ur:"urdu",hr:"croatian",bg:"bulgarian",lt:"lithuanian",la:"latin",mi:"maori",ml:"malayalam",cy:"welsh",sk:"slovak",te:"telugu",fa:"persian",lv:"latvian",bn:"bengali",sr:"serbian",az:"azerbaijani",sl:"slovenian",kn:"kannada",et:"estonian",mk:"macedonian",br:"breton",eu:"basque",is:"icelandic",hy:"armenian",ne:"nepali",mn:"mongolian",bs:"bosnian",kk:"kazakh",sq:"albanian",sw:"swahili",gl:"galician",mr:"marathi",pa:"punjabi/panjabi",si:"sinhala/sinhalese",km:"khmer",sn:"shona",yo:"yoruba",so:"somali",af:"afrikaans",oc:"occitan",ka:"georgian",be:"belarusian",tg:"tajik",sd:"sindhi",gu:"gujarati",am:"amharic",yi:"yiddish",lo:"lao",uz:"uzbek",fo:"faroese",ht:"haitian creole/haitian",ps:"pashto/pushto",tk:"turkmen",nn:"nynorsk",mt:"maltese",sa:"sanskrit",lb:"luxembourgish/letzeburgesch",my:"myanmar/burmese",bo:"tibetan",tl:"tagalog",mg:"malagasy",as:"assamese",tt:"tatar",haw:"hawaiian",ln:"lingala",ha:"hausa",ba:"bashkir",jw:"javanese",su:"sundanese"};function eg(e){const[t,n]=w.useState(void 0),[r,o]=w.useState(void 0),[i,l]=w.useState(void 0),u=t!==void 0,s=()=>{o(void 0),l(void 0)},a=async(m,v)=>{const h=new AudioContext({sampleRate:ft.SAMPLING_RATE}),g=URL.createObjectURL(new Blob([m],{type:"audio/*"})),T=await h.decodeAudioData(m);o({buffer:T,url:g,source:"URL",mimeType:v})},d=async m=>{s(),n(0);const v=URL.createObjectURL(m),h=new FileReader;h.onprogress=g=>{n(g.loaded/g.total||0)},h.onloadend=async()=>{const g=new AudioContext({sampleRate:ft.SAMPLING_RATE}),T=h.result,f=await g.decodeAudioData(T);n(void 0),o({buffer:f,url:v,source:"RECORDING",mimeType:m.type})},h.readAsArrayBuffer(m)},p=async m=>{if(i)try{o(void 0),n(0);const{data:v,headers:h}=await G0.get(i,{signal:m.signal,responseType:"arraybuffer",onDownloadProgress(T){n(T.progress||0)}});let g=h["content-type"];(!g||g==="audio/wave")&&(g="audio/wav"),a(v,g)}catch(v){console.log("Request failed or aborted",v)}finally{n(void 0)}};return w.useEffect(()=>{if(i){const m=new AbortController;return p(m),()=>{m.abort()}}},[i]),I(nt,{children:[I("div",{className:"flex flex-col justify-center items-center rounded-lg bg-white shadow-xl shadow-black/5 ring-1 ring-slate-700/10",children:[I("div",{className:"flex flex-row space-x-2 py-2 w-full px-2",children:[C(ig,{icon:C(cg,{}),text:"From URL",onUrlUpdate:m=>{e.transcriber.onInputChange(),l(m)}}),C(oc,{}),C(ug,{icon:C(dg,{}),text:"From file",onFileUpdate:(m,v,h)=>{e.transcriber.onInputChange(),o({buffer:m,url:v,source:"FILE",mimeType:h})}}),navigator.mediaDevices&&I(nt,{children:[C(oc,{}),C(sg,{icon:C(pg,{}),text:"Record",setAudioData:m=>{e.transcriber.onInputChange(),d(m)}})]})]}),C(rg,{progress:u?t:+!!r})]}),r&&I(nt,{children:[C(H1,{audioUrl:r.url,mimeType:r.mimeType}),I("div",{className:"relative w-full flex justify-center items-center",children:[C(V1,{onClick:()=>{e.transcriber.start(r.buffer)},isModelLoading:e.transcriber.isModelLoading,isTranscribing:e.transcriber.isBusy}),C(tg,{className:"absolute right-4",transcriber:e.transcriber,icon:C(fg,{})})]}),e.transcriber.progressItems.length>0&&I("div",{className:"relative z-10 p-4 w-full",children:[C("label",{children:"Loading model files... (only run once)"}),e.transcriber.progressItems.map(m=>C("div",{children:C(Q1,{text:m.file,percentage:m.progress})},m.file))]})]})]})}function tg(e){const[t,n]=w.useState(!1),r=()=>{n(!0)},o=()=>{n(!1)},i=l=>{o()};return I("div",{className:e.className,children:[C(Fi,{icon:e.icon,onClick:r}),C(ng,{show:t,onSubmit:i,onClose:o,transcriber:e.transcriber})]})}function ng(e){const t=Object.values(rc).map(Z1),n={"distil-whisper/distil-medium.en":[402],"distil-whisper/distil-large-v2":[767]};return C(_s,{show:e.show,title:"Settings",content:I(nt,{children:[C("label",{children:"Select the model to use."}),C("select",{className:"mt-1 mb-1 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",defaultValue:e.transcriber.model,onChange:r=>{e.transcriber.setModel(r.target.value)},children:Object.keys(n).map(r=>C("option",{value:r,children:`${r} (${n[r][0]}MB)`},r))}),I("div",{className:"flex justify-between items-center mb-3 px-1",children:[I("div",{className:"flex",children:[C("input",{id:"multilingual",type:"checkbox",disabled:!0,checked:e.transcriber.multilingual,onChange:r=>{e.transcriber.setMultilingual(r.target.checked)}}),C("label",{htmlFor:"multilingual",className:"ms-1",children:"Multilingual (coming soon)"})]}),I("div",{className:"flex",children:[C("input",{id:"quantize",type:"checkbox",disabled:!0,checked:e.transcriber.quantized,onChange:r=>{e.transcriber.setQuantized(r.target.checked)}}),C("label",{htmlFor:"quantize",className:"ms-1",children:"Quantized"})]})]}),e.transcriber.multilingual&&I(nt,{children:[C("label",{children:"Select the source language."}),C("select",{className:"mt-1 mb-3 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",defaultValue:e.transcriber.language,onChange:r=>{e.transcriber.setLanguage(r.target.value)},children:Object.keys(rc).map((r,o)=>C("option",{value:r,children:t[o]},r))}),C("label",{children:"Select the task to perform."}),I("select",{className:"mt-1 mb-3 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",defaultValue:e.transcriber.subtask,onChange:r=>{e.transcriber.setSubtask(r.target.value)},children:[C("option",{value:"transcribe",children:"Transcribe"}),C("option",{value:"translate",children:"Translate (to English)"})]})]})]}),onClose:e.onClose,onSubmit:()=>{}})}function oc(){return C("div",{className:"w-[1px] bg-slate-200"})}function rg(e){return C(og,{progress:`${Math.round(e.progress*100)}%`})}function og(e){return C("div",{className:"w-full bg-gray-200 rounded-full h-1 dark:bg-gray-700",children:C("div",{className:"bg-blue-600 h-1 rounded-full transition-all duration-100",style:{width:e.progress}})})}function ig(e){const[t,n]=w.useState(!1),r=()=>{n(!0)},o=()=>{n(!1)},i=l=>{e.onUrlUpdate(l),o()};return I(nt,{children:[C(Fi,{icon:e.icon,text:e.text,onClick:r}),C(lg,{show:t,onSubmit:i,onClose:o})]})}function lg(e){const[t,n]=w.useState(ft.DEFAULT_AUDIO_URL),r=i=>{n(i.target.value)},o=()=>{e.onSubmit(t)};return C(_s,{show:e.show,title:"From URL",content:I(nt,{children:["Enter the URL of the audio file you want to load.",C(j1,{onChange:r,value:t})]}),onClose:e.onClose,submitText:"Load",onSubmit:o})}function ug(e){let t=document.createElement("input");return t.type="file",t.oninput=n=>{let r=n.target.files;if(!r)return;const o=URL.createObjectURL(r[0]),i=r[0].type,l=new FileReader;l.addEventListener("load",async u=>{var p;const s=(p=u.target)==null?void 0:p.result;if(!s)return;const d=await new AudioContext({sampleRate:ft.SAMPLING_RATE}).decodeAudioData(s);e.onFileUpdate(d,o,i)}),l.readAsArrayBuffer(r[0]),t.value=""},C(nt,{children:C(Fi,{icon:e.icon,text:e.text,onClick:()=>t.click()})})}function sg(e){const[t,n]=w.useState(!1),r=()=>{n(!0)},o=()=>{n(!1)},i=l=>{l&&(e.setAudioData(l),o())};return I(nt,{children:[C(Fi,{icon:e.icon,text:e.text,onClick:r}),C(ag,{show:t,onSubmit:i,onClose:o})]})}function ag(e){const[t,n]=w.useState(),r=l=>{n(l)},o=()=>{e.onSubmit(t),n(void 0)},i=()=>{e.onClose(),n(void 0)};return C(_s,{show:e.show,title:"From Recording",content:I(nt,{children:["Record audio using your microphone",C(J1,{onRecordingComplete:r})]}),onClose:i,submitText:"Load",submitEnabled:t!==void 0,onSubmit:o})}function Fi(e){return I("button",{onClick:e.onClick,className:"flex items-center justify-center rounded-lg p-2 bg-blue text-slate-500 hover:text-indigo-600 hover:bg-indigo-50 transition-all duration-200",children:[C("div",{className:"w-7 h-7",children:e.icon}),e.text&&C("div",{className:"ml-2 break-text text-center text-md w-30",children:e.text})]})}function cg(){return C("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",children:C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.19 8.688a4.5 4.5 0 011.242 7.244l-4.5 4.5a4.5 4.5 0 01-6.364-6.364l1.757-1.757m13.35-.622l1.757-1.757a4.5 4.5 0 00-6.364-6.364l-4.5 4.5a4.5 4.5 0 001.242 7.244"})})}function dg(){return C("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",children:C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 9.776c.112-.017.227-.026.344-.026h15.812c.117 0 .232.009.344.026m-16.5 0a2.25 2.25 0 00-1.883 2.542l.857 6a2.25 2.25 0 002.227 1.932H19.05a2.25 2.25 0 002.227-1.932l.857-6a2.25 2.25 0 00-1.883-2.542m-16.5 0V6A2.25 2.25 0 016 3.75h3.879a1.5 1.5 0 011.06.44l2.122 2.12a1.5 1.5 0 001.06.44H18A2.25 2.25 0 0120.25 9v.776"})})}function fg(){return I("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.25",stroke:"currentColor",children:[C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.324.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 011.37.49l1.296 2.247a1.125 1.125 0 01-.26 1.431l-1.003.827c-.293.24-.438.613-.431.992a6.759 6.759 0 010 .255c-.007.378.138.75.43.99l1.005.828c.424.35.534.954.26 1.43l-1.298 2.247a1.125 1.125 0 01-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.57 6.57 0 01-.22.128c-.331.183-.581.495-.644.869l-.213 1.28c-.09.543-.56.941-1.11.941h-2.594c-.55 0-1.02-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 01-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 01-1.369-.49l-1.297-2.247a1.125 1.125 0 01.26-1.431l1.004-.827c.292-.24.437-.613.43-.992a6.932 6.932 0 010-.255c.007-.378-.138-.75-.43-.99l-1.004-.828a1.125 1.125 0 01-.26-1.43l1.297-2.247a1.125 1.125 0 011.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281z"}),C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}function pg(){return C("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})})}function mg({transcribedData:e}){const t=w.useRef(null),n=(i,l)=>{const u=URL.createObjectURL(i),s=document.createElement("a");s.href=u,s.download=l,s.click(),URL.revokeObjectURL(u)},r=()=>{let l=((e==null?void 0:e.chunks)??[]).map(s=>s.text).join("").trim();const u=new Blob([l],{type:"text/plain"});n(u,"transcript.txt")},o=()=>{let i=JSON.stringify((e==null?void 0:e.chunks)??[],null,2);const l=/( "timestamp": )\[\s+(\S+)\s+(\S+)\s+\]/gm;i=i.replace(l,"$1[$2 $3]");const u=new Blob([i],{type:"application/json"});n(u,"transcript.json")};return w.useEffect(()=>{t.current&&Math.abs(t.current.offsetHeight+t.current.scrollTop-t.current.scrollHeight)<=64&&(t.current.scrollTop=t.current.scrollHeight)}),I("div",{ref:t,className:"w-full flex flex-col my-2 p-4 max-h-[20rem] overflow-y-auto",children:[(e==null?void 0:e.chunks)&&e.chunks.map((i,l)=>I("div",{className:"w-full flex flex-row mb-2 bg-white rounded-lg p-4 shadow-xl shadow-black/5 ring-1 ring-slate-700/10",children:[C("div",{className:"mr-5",children:np(i.timestamp[0])}),i.text]},`${l}-${i.text}`)),e&&!e.isBusy&&I("div",{className:"w-full text-right",children:[C("button",{onClick:r,className:"text-white bg-green-500 hover:bg-green-600 focus:ring-4 focus:ring-green-300 font-medium rounded-lg text-sm px-4 py-2 text-center mr-2 dark:bg-green-600 dark:hover:bg-green-700 dark:focus:ring-green-800 inline-flex items-center",children:"Export TXT"}),C("button",{onClick:o,className:"text-white bg-green-500 hover:bg-green-600 focus:ring-4 focus:ring-green-300 font-medium rounded-lg text-sm px-4 py-2 text-center mr-2 dark:bg-green-600 dark:hover:bg-green-700 dark:focus:ring-green-800 inline-flex items-center",children:"Export JSON"})]})]})}function hg(e){const[t]=w.useState(()=>yg(e));return t}function yg(e){const t=new Worker(new URL("/assets/worker-437c363b.js",self.location),{type:"module"});return t.addEventListener("message",e),t}function gg(){const[e,t]=w.useState(void 0),[n,r]=w.useState(!1),[o,i]=w.useState(!1),[l,u]=w.useState([]),s=hg(P=>{const x=P.data;switch(x.status){case"progress":u(U=>U.map(j=>j.file===x.file?{...j,progress:x.progress}:j));break;case"update":const L=x;t({isBusy:!0,text:L.data[0],chunks:L.data[1].chunks});break;case"complete":const A=x;t({isBusy:!1,text:A.data.text,chunks:A.data.chunks}),r(!1);break;case"initiate":i(!0),u(U=>[...U,x]);break;case"ready":i(!1);break;case"error":r(!1),alert(`${x.data.message} This is most likely because you are using Safari on an M1/M2 Mac. Please try again from Chrome, Firefox, or Edge.
46
 
47
- If this is not the case, please file a bug report.`);break;case"done":u(U=>U.filter(j=>j.file!==x.file));break}}),[a,d]=w.useState(ft.DEFAULT_MODEL),[p,m]=w.useState(ft.DEFAULT_SUBTASK),[v,h]=w.useState(ft.DEFAULT_QUANTIZED),[g,T]=w.useState(ft.DEFAULT_MULTILINGUAL),[f,c]=w.useState(ft.DEFAULT_LANGUAGE),y=w.useCallback(()=>{t(void 0)},[]),k=w.useCallback(async P=>{if(P){t(void 0),r(!0);let x;if(P.numberOfChannels===2){const L=Math.sqrt(2);let A=P.getChannelData(0),U=P.getChannelData(1);x=new Float32Array(A.length);for(let j=0;j<P.length;++j)x[j]=L*(A[j]+U[j])/2}else x=P.getChannelData(0);s.postMessage({audio:x,model:a,multilingual:g,quantized:v,subtask:g?p:null,language:g&&f!=="auto"?f:null})}},[s,a,g,v,p,f]);return w.useMemo(()=>({onInputChange:y,isBusy:n,isModelLoading:o,progressItems:l,start:k,output:e,model:a,setModel:d,multilingual:g,setMultilingual:T,quantized:v,setQuantized:h,subtask:p,setSubtask:m,language:f,setLanguage:c}),[n,o,l,k,e,a,g,v,p,f])}function vg(){const e=gg();return I("div",{className:"flex justify-center items-center min-h-screen",children:[I("div",{className:"container flex flex-col justify-center items-center",children:[C("h1",{className:"text-5xl font-extrabold tracking-tight text-slate-900 sm:text-6xl text-center",children:"Distil-Whisper Web"}),C("h2",{className:"mt-3 mb-5 px-4 text-center text-1xl font-semibold tracking-tight text-slate-900 sm:text-2xl",children:"ML-powered speech recognition directly in your browser"}),C(eg,{transcriber:e}),C(mg,{transcribedData:e.output})]}),I("div",{className:"absolute bottom-4",children:["Made with"," ",C("a",{className:"underline",href:"https://github.com/xenova/transformers.js",children:"🤗 Transformers.js"})]})]})}kl.createRoot(document.getElementById("root")).render(C(M.StrictMode,{children:C(vg,{})}));
 
44
  `)].join(`
45
  `));let p=a.props,m=typeof(p==null?void 0:p.className)=="function"?(...h)=>wu(p==null?void 0:p.className(...h),u.className):wu(p==null?void 0:p.className,u.className),v=m?{className:m}:{};return w.cloneElement(a,Object.assign({},Vf(a.props,Ja(fl(u,["ref"]))),d,s,uy(a.ref,s.ref),v))}return w.createElement(o,Object.assign({},fl(u,["ref"]),o!==w.Fragment&&s,o!==w.Fragment&&d),a)}function uy(...e){return{ref:e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}}function Vf(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map(r=>[r,void 0])));for(let r in n)Object.assign(t,{[r](o,...i){let l=n[r];for(let u of l){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;u(o,...i)}}});return t}function Fe(e){var t;return Object.assign(w.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function Ja(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function fl(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function sy(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&ay(n)?!1:r}function ay(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}let cy="div";var oi=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(oi||{});function dy(e,t){let{features:n=1,...r}=e,o={ref:t,"aria-hidden":(n&2)===2?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(n&4)===4&&(n&2)!==2&&{display:"none"}}};return je({ourProps:o,theirProps:r,slot:{},defaultTag:cy,name:"Hidden"})}let Su=Fe(dy),Ns=w.createContext(null);Ns.displayName="OpenClosedContext";var Pe=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Pe||{});function Ps(){return w.useContext(Ns)}function fy({value:e,children:t}){return M.createElement(Ns.Provider,{value:e},t)}var bf=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(bf||{});function Rs(e,t){let n=w.useRef([]),r=ue(e);w.useEffect(()=>{let o=[...n.current];for(let[i,l]of t.entries())if(n.current[i]!==l){let u=r(t,o);return n.current=t,u}},[r,...t])}function py(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function my(e,t,n){let r=wt(t);w.useEffect(()=>{function o(i){r.current(i)}return window.addEventListener(e,o,n),()=>window.removeEventListener(e,o,n)},[e,n])}var dr=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(dr||{});function hy(){let e=w.useRef(0);return my("keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}function Kr(){let e=w.useRef(!1);return lt(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Li(...e){return w.useMemo(()=>zf(...e),[...e])}function Wf(e,t,n,r){let o=wt(n);w.useEffect(()=>{e=e??window;function i(l){o.current(l)}return e.addEventListener(t,i,r),()=>e.removeEventListener(t,i,r)},[e,t,r])}function yy(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}function Qf(e){if(!e)return new Set;if(typeof e=="function")return new Set(e());let t=new Set;for(let n of e.current)n.current instanceof HTMLElement&&t.add(n.current);return t}let gy="div";var Kf=(e=>(e[e.None=1]="None",e[e.InitialFocus=2]="InitialFocus",e[e.TabLock=4]="TabLock",e[e.FocusLock=8]="FocusLock",e[e.RestoreFocus=16]="RestoreFocus",e[e.All=30]="All",e))(Kf||{});function vy(e,t){let n=w.useRef(null),r=Ye(n,t),{initialFocus:o,containers:i,features:l=30,...u}=e;Kn()||(l=1);let s=Li(n);ky({ownerDocument:s},!!(l&16));let a=Ey({ownerDocument:s,container:n,initialFocus:o},!!(l&2));Cy({ownerDocument:s,container:n,containers:i,previousActiveElement:a},!!(l&8));let d=hy(),p=ue(g=>{let T=n.current;T&&(f=>f())(()=>{he(d.current,{[dr.Forwards]:()=>{Uo(T,Jt.First,{skipElements:[g.relatedTarget]})},[dr.Backwards]:()=>{Uo(T,Jt.Last,{skipElements:[g.relatedTarget]})}})})}),m=Ts(),v=w.useRef(!1),h={ref:r,onKeyDown(g){g.key=="Tab"&&(v.current=!0,m.requestAnimationFrame(()=>{v.current=!1}))},onBlur(g){let T=Qf(i);n.current instanceof HTMLElement&&T.add(n.current);let f=g.relatedTarget;f instanceof HTMLElement&&f.dataset.headlessuiFocusGuard!=="true"&&(Gf(T,f)||(v.current?Uo(n.current,he(d.current,{[dr.Forwards]:()=>Jt.Next,[dr.Backwards]:()=>Jt.Previous})|Jt.WrapAround,{relativeTo:g.target}):g.target instanceof HTMLElement&&ln(g.target)))}};return M.createElement(M.Fragment,null,!!(l&4)&&M.createElement(Su,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:p,features:oi.Focusable}),je({ourProps:h,theirProps:u,defaultTag:gy,name:"FocusTrap"}),!!(l&4)&&M.createElement(Su,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:p,features:oi.Focusable}))}let wy=Fe(vy),ir=Object.assign(wy,{features:Kf}),Ut=[];yy(()=>{function e(t){t.target instanceof HTMLElement&&t.target!==document.body&&Ut[0]!==t.target&&(Ut.unshift(t.target),Ut=Ut.filter(n=>n!=null&&n.isConnected),Ut.splice(10))}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});function Sy(e=!0){let t=w.useRef(Ut.slice());return Rs(([n],[r])=>{r===!0&&n===!1&&Qr(()=>{t.current.splice(0)}),r===!1&&n===!0&&(t.current=Ut.slice())},[e,Ut,t]),ue(()=>{var n;return(n=t.current.find(r=>r!=null&&r.isConnected))!=null?n:null})}function ky({ownerDocument:e},t){let n=Sy(t);Rs(()=>{t||(e==null?void 0:e.activeElement)===(e==null?void 0:e.body)&&ln(n())},[t]);let r=w.useRef(!1);w.useEffect(()=>(r.current=!1,()=>{r.current=!0,Qr(()=>{r.current&&ln(n())})}),[])}function Ey({ownerDocument:e,container:t,initialFocus:n},r){let o=w.useRef(null),i=Kr();return Rs(()=>{if(!r)return;let l=t.current;l&&Qr(()=>{if(!i.current)return;let u=e==null?void 0:e.activeElement;if(n!=null&&n.current){if((n==null?void 0:n.current)===u){o.current=u;return}}else if(l.contains(u)){o.current=u;return}n!=null&&n.current?ln(n.current):Uo(l,Jt.First)===Bf.Error&&console.warn("There are no focusable elements inside the <FocusTrap />"),o.current=e==null?void 0:e.activeElement})},[r]),o}function Cy({ownerDocument:e,container:t,containers:n,previousActiveElement:r},o){let i=Kr();Wf(e==null?void 0:e.defaultView,"focus",l=>{if(!o||!i.current)return;let u=Qf(n);t.current instanceof HTMLElement&&u.add(t.current);let s=r.current;if(!s)return;let a=l.target;a&&a instanceof HTMLElement?Gf(u,a)?(r.current=a,ln(a)):(l.preventDefault(),l.stopPropagation(),ln(s)):ln(r.current)},!0)}function Gf(e,t){for(let n of e)if(n.contains(t))return!0;return!1}let qf=w.createContext(!1);function xy(){return w.useContext(qf)}function ku(e){return M.createElement(qf.Provider,{value:e.force},e.children)}function Ty(e){let t=xy(),n=w.useContext(Xf),r=Li(e),[o,i]=w.useState(()=>{if(!t&&n!==null||vt.isServer)return null;let l=r==null?void 0:r.getElementById("headlessui-portal-root");if(l)return l;if(r===null)return null;let u=r.createElement("div");return u.setAttribute("id","headlessui-portal-root"),r.body.appendChild(u)});return w.useEffect(()=>{o!==null&&(r!=null&&r.body.contains(o)||r==null||r.body.appendChild(o))},[o,r]),w.useEffect(()=>{t||n!==null&&i(n.current)},[n,i,t]),o}let Ny=w.Fragment;function Py(e,t){let n=e,r=w.useRef(null),o=Ye(ly(d=>{r.current=d}),t),i=Li(r),l=Ty(r),[u]=w.useState(()=>{var d;return vt.isServer?null:(d=i==null?void 0:i.createElement("div"))!=null?d:null}),s=Kn(),a=w.useRef(!1);return lt(()=>{if(a.current=!1,!(!l||!u))return l.contains(u)||(u.setAttribute("data-headlessui-portal",""),l.appendChild(u)),()=>{a.current=!0,Qr(()=>{var d;a.current&&(!l||!u||(u instanceof Node&&l.contains(u)&&l.removeChild(u),l.childNodes.length<=0&&((d=l.parentElement)==null||d.removeChild(l))))})}},[l,u]),s?!l||!u?null:wf.createPortal(je({ourProps:{ref:o},theirProps:n,defaultTag:Ny,name:"Portal"}),u):null}let Ry=w.Fragment,Xf=w.createContext(null);function Ly(e,t){let{target:n,...r}=e,o={ref:Ye(t)};return M.createElement(Xf.Provider,{value:n},je({ourProps:o,theirProps:r,defaultTag:Ry,name:"Popover.Group"}))}let _y=Fe(Py),Uy=Fe(Ly),Eu=Object.assign(_y,{Group:Uy}),Yf=w.createContext(null);function Jf(){let e=w.useContext(Yf);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Jf),t}return e}function Oy(){let[e,t]=w.useState([]);return[e.length>0?e.join(" "):void 0,w.useMemo(()=>function(n){let r=ue(i=>(t(l=>[...l,i]),()=>t(l=>{let u=l.slice(),s=u.indexOf(i);return s!==-1&&u.splice(s,1),u}))),o=w.useMemo(()=>({register:r,slot:n.slot,name:n.name,props:n.props}),[r,n.slot,n.name,n.props]);return M.createElement(Yf.Provider,{value:o},n.children)},[t])]}let Fy="p";function Dy(e,t){let n=Gn(),{id:r=`headlessui-description-${n}`,...o}=e,i=Jf(),l=Ye(t);lt(()=>i.register(r),[r,i.register]);let u={ref:l,...i.props,id:r};return je({ourProps:u,theirProps:o,slot:i.slot||{},defaultTag:Fy,name:i.name||"Description"})}let Ay=Fe(Dy),My=Object.assign(Ay,{}),Ls=w.createContext(()=>{});Ls.displayName="StackContext";var Cu=(e=>(e[e.Add=0]="Add",e[e.Remove=1]="Remove",e))(Cu||{});function $y(){return w.useContext(Ls)}function Iy({children:e,onUpdate:t,type:n,element:r,enabled:o}){let i=$y(),l=ue((...u)=>{t==null||t(...u),i(...u)});return lt(()=>{let u=o===void 0||o===!0;return u&&l(0,n,r),()=>{u&&l(1,n,r)}},[l,n,r,o]),M.createElement(Ls.Provider,{value:l},e)}function zy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}const By=typeof Object.is=="function"?Object.is:zy,{useState:jy,useEffect:Hy,useLayoutEffect:Vy,useDebugValue:by}=Sl;function Wy(e,t,n){const r=t(),[{inst:o},i]=jy({inst:{value:r,getSnapshot:t}});return Vy(()=>{o.value=r,o.getSnapshot=t,pl(o)&&i({inst:o})},[e,r,t]),Hy(()=>(pl(o)&&i({inst:o}),e(()=>{pl(o)&&i({inst:o})})),[e]),by(r),r}function pl(e){const t=e.getSnapshot,n=e.value;try{const r=t();return!By(n,r)}catch{return!0}}function Qy(e,t,n){return t()}const Ky=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Gy=!Ky,qy=Gy?Qy:Wy,Xy="useSyncExternalStore"in Sl?(e=>e.useSyncExternalStore)(Sl):qy;function Yy(e){return Xy(e.subscribe,e.getSnapshot,e.getSnapshot)}function Jy(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(o){return r.add(o),()=>r.delete(o)},dispatch(o,...i){let l=t[o].call(n,...i);l&&(n=l,r.forEach(u=>u()))}}}function Zy(){let e;return{before({doc:t}){var n;let r=t.documentElement;e=((n=t.defaultView)!=null?n:window).innerWidth-r.clientWidth},after({doc:t,d:n}){let r=t.documentElement,o=r.clientWidth-r.offsetWidth,i=e-o;n.style(r,"paddingRight",`${i}px`)}}}function e1(){if(!py())return{};let e;return{before(){e=window.pageYOffset},after({doc:t,d:n,meta:r}){function o(l){return r.containers.flatMap(u=>u()).some(u=>u.contains(l))}n.style(t.body,"marginTop",`-${e}px`),window.scrollTo(0,0);let i=null;n.addEventListener(t,"click",l=>{if(l.target instanceof HTMLElement)try{let u=l.target.closest("a");if(!u)return;let{hash:s}=new URL(u.href),a=t.querySelector(s);a&&!o(a)&&(i=a)}catch{}},!0),n.addEventListener(t,"touchmove",l=>{l.target instanceof HTMLElement&&!o(l.target)&&l.preventDefault()},{passive:!1}),n.add(()=>{window.scrollTo(0,window.pageYOffset+e),i&&i.isConnected&&(i.scrollIntoView({block:"nearest"}),i=null)})}}}function t1(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function n1(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let nn=Jy(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:Qn(),meta:new Set};return r.count++,r.meta.add(t),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:n}){let r={doc:e,d:t,meta:n1(n)},o=[e1(),Zy(),t1()];o.forEach(({before:i})=>i==null?void 0:i(r)),o.forEach(({after:i})=>i==null?void 0:i(r))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});nn.subscribe(()=>{let e=nn.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let r=t.get(n.doc)==="hidden",o=n.count!==0;(o&&!r||!o&&r)&&nn.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&nn.dispatch("TEARDOWN",n)}});function r1(e,t,n){let r=Yy(nn),o=e?r.get(e):void 0,i=o?o.count>0:!1;return lt(()=>{if(!(!e||!t))return nn.dispatch("PUSH",e,n),()=>nn.dispatch("POP",e,n)},[t,e]),i}let ml=new Map,lr=new Map;function Za(e,t=!0){lt(()=>{var n;if(!t)return;let r=typeof e=="function"?e():e.current;if(!r)return;function o(){var l;if(!r)return;let u=(l=lr.get(r))!=null?l:1;if(u===1?lr.delete(r):lr.set(r,u-1),u!==1)return;let s=ml.get(r);s&&(s["aria-hidden"]===null?r.removeAttribute("aria-hidden"):r.setAttribute("aria-hidden",s["aria-hidden"]),r.inert=s.inert,ml.delete(r))}let i=(n=lr.get(r))!=null?n:0;return lr.set(r,i+1),i!==0||(ml.set(r,{"aria-hidden":r.getAttribute("aria-hidden"),inert:r.inert}),r.setAttribute("aria-hidden","true"),r.inert=!0),o},[e,t])}var o1=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(o1||{}),i1=(e=>(e[e.SetTitleId=0]="SetTitleId",e))(i1||{});let l1={[0](e,t){return e.titleId===t.id?e:{...e,titleId:t.id}}},ii=w.createContext(null);ii.displayName="DialogContext";function Gr(e){let t=w.useContext(ii);if(t===null){let n=new Error(`<${e} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Gr),n}return t}function u1(e,t,n=()=>[document.body]){r1(e,t,r=>{var o;return{containers:[...(o=r.containers)!=null?o:[],n]}})}function s1(e,t){return he(t.type,l1,e,t)}let a1="div",c1=ri.RenderStrategy|ri.Static;function d1(e,t){let n=Gn(),{id:r=`headlessui-dialog-${n}`,open:o,onClose:i,initialFocus:l,__demoMode:u=!1,...s}=e,[a,d]=w.useState(0),p=Ps();o===void 0&&p!==null&&(o=(p&Pe.Open)===Pe.Open);let m=w.useRef(null),v=Ye(m,t),h=w.useRef(null),g=Li(m),T=e.hasOwnProperty("open")||p!==null,f=e.hasOwnProperty("onClose");if(!T&&!f)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!T)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!f)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(typeof o!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${o}`);if(typeof i!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${i}`);let c=o?0:1,[y,k]=w.useReducer(s1,{titleId:null,descriptionId:null,panelRef:w.createRef()}),N=ue(()=>i(!1)),P=ue(Q=>k({type:0,id:Q})),x=Kn()?u?!1:c===0:!1,L=a>1,A=w.useContext(ii)!==null,U=L?"parent":"leaf",j=p!==null?(p&Pe.Closing)===Pe.Closing:!1,He=(()=>A||j?!1:x)(),Ve=w.useCallback(()=>{var Q,te;return(te=Array.from((Q=g==null?void 0:g.querySelectorAll("body > *"))!=null?Q:[]).find(G=>G.id==="headlessui-portal-root"?!1:G.contains(h.current)&&G instanceof HTMLElement))!=null?te:null},[h]);Za(Ve,He);let mn=(()=>L?!0:x)(),ut=w.useCallback(()=>{var Q,te;return(te=Array.from((Q=g==null?void 0:g.querySelectorAll("[data-headlessui-portal]"))!=null?Q:[]).find(G=>G.contains(h.current)&&G instanceof HTMLElement))!=null?te:null},[h]);Za(ut,mn);let st=ue(()=>{var Q,te;return[...Array.from((Q=g==null?void 0:g.querySelectorAll("html > *, body > *, [data-headlessui-portal]"))!=null?Q:[]).filter(G=>!(G===document.body||G===document.head||!(G instanceof HTMLElement)||G.contains(h.current)||y.panelRef.current&&G.contains(y.panelRef.current))),(te=y.panelRef.current)!=null?te:m.current]}),Kt=(()=>!(!x||L))();iy(()=>st(),N,Kt);let R=(()=>!(L||c!==0))();Wf(g==null?void 0:g.defaultView,"keydown",Q=>{R&&(Q.defaultPrevented||Q.key===bf.Escape&&(Q.preventDefault(),Q.stopPropagation(),N()))});let O=(()=>!(j||c!==0||A))();u1(g,O,st),w.useEffect(()=>{if(c!==0||!m.current)return;let Q=new ResizeObserver(te=>{for(let G of te){let qr=G.target.getBoundingClientRect();qr.x===0&&qr.y===0&&qr.width===0&&qr.height===0&&N()}});return Q.observe(m.current),()=>Q.disconnect()},[c,m,N]);let[F,B]=Oy(),ee=w.useMemo(()=>[{dialogState:c,close:N,setTitleId:P},y],[c,y,N,P]),Gt=w.useMemo(()=>({open:c===0}),[c]),at={ref:v,id:r,role:"dialog","aria-modal":c===0?!0:void 0,"aria-labelledby":y.titleId,"aria-describedby":F};return M.createElement(Iy,{type:"Dialog",enabled:c===0,element:m,onUpdate:ue((Q,te)=>{te==="Dialog"&&he(Q,{[Cu.Add]:()=>d(G=>G+1),[Cu.Remove]:()=>d(G=>G-1)})})},M.createElement(ku,{force:!0},M.createElement(Eu,null,M.createElement(ii.Provider,{value:ee},M.createElement(Eu.Group,{target:m},M.createElement(ku,{force:!1},M.createElement(B,{slot:Gt,name:"Dialog.Description"},M.createElement(ir,{initialFocus:l,containers:st,features:x?he(U,{parent:ir.features.RestoreFocus,leaf:ir.features.All&~ir.features.FocusLock}):ir.features.None},je({ourProps:at,theirProps:s,slot:Gt,defaultTag:a1,features:c1,visible:c===0,name:"Dialog"})))))))),M.createElement(Su,{features:oi.Hidden,ref:h}))}let f1="div";function p1(e,t){let n=Gn(),{id:r=`headlessui-dialog-overlay-${n}`,...o}=e,[{dialogState:i,close:l}]=Gr("Dialog.Overlay"),u=Ye(t),s=ue(d=>{if(d.target===d.currentTarget){if(sy(d.currentTarget))return d.preventDefault();d.preventDefault(),d.stopPropagation(),l()}}),a=w.useMemo(()=>({open:i===0}),[i]);return je({ourProps:{ref:u,id:r,"aria-hidden":!0,onClick:s},theirProps:o,slot:a,defaultTag:f1,name:"Dialog.Overlay"})}let m1="div";function h1(e,t){let n=Gn(),{id:r=`headlessui-dialog-backdrop-${n}`,...o}=e,[{dialogState:i},l]=Gr("Dialog.Backdrop"),u=Ye(t);w.useEffect(()=>{if(l.panelRef.current===null)throw new Error("A <Dialog.Backdrop /> component is being used, but a <Dialog.Panel /> component is missing.")},[l.panelRef]);let s=w.useMemo(()=>({open:i===0}),[i]);return M.createElement(ku,{force:!0},M.createElement(Eu,null,je({ourProps:{ref:u,id:r,"aria-hidden":!0},theirProps:o,slot:s,defaultTag:m1,name:"Dialog.Backdrop"})))}let y1="div";function g1(e,t){let n=Gn(),{id:r=`headlessui-dialog-panel-${n}`,...o}=e,[{dialogState:i},l]=Gr("Dialog.Panel"),u=Ye(t,l.panelRef),s=w.useMemo(()=>({open:i===0}),[i]),a=ue(d=>{d.stopPropagation()});return je({ourProps:{ref:u,id:r,onClick:a},theirProps:o,slot:s,defaultTag:y1,name:"Dialog.Panel"})}let v1="h2";function w1(e,t){let n=Gn(),{id:r=`headlessui-dialog-title-${n}`,...o}=e,[{dialogState:i,setTitleId:l}]=Gr("Dialog.Title"),u=Ye(t);w.useEffect(()=>(l(r),()=>l(null)),[r,l]);let s=w.useMemo(()=>({open:i===0}),[i]);return je({ourProps:{ref:u,id:r},theirProps:o,slot:s,defaultTag:v1,name:"Dialog.Title"})}let S1=Fe(d1),k1=Fe(h1),E1=Fe(g1),C1=Fe(p1),x1=Fe(w1),hl=Object.assign(S1,{Backdrop:k1,Panel:E1,Overlay:C1,Title:x1,Description:My});function T1(e=0){let[t,n]=w.useState(e),r=Kr(),o=w.useCallback(s=>{r.current&&n(a=>a|s)},[t,r]),i=w.useCallback(s=>!!(t&s),[t]),l=w.useCallback(s=>{r.current&&n(a=>a&~s)},[n,r]),u=w.useCallback(s=>{r.current&&n(a=>a^s)},[n]);return{flags:t,addFlag:o,hasFlag:i,removeFlag:l,toggleFlag:u}}function N1(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}function yl(e,...t){e&&t.length>0&&e.classList.add(...t)}function gl(e,...t){e&&t.length>0&&e.classList.remove(...t)}function P1(e,t){let n=Qn();if(!e)return n.dispose;let{transitionDuration:r,transitionDelay:o}=getComputedStyle(e),[i,l]=[r,o].map(s=>{let[a=0]=s.split(",").filter(Boolean).map(d=>d.includes("ms")?parseFloat(d):parseFloat(d)*1e3).sort((d,p)=>p-d);return a}),u=i+l;if(u!==0){n.group(a=>{a.setTimeout(()=>{t(),a.dispose()},u),a.addEventListener(e,"transitionrun",d=>{d.target===d.currentTarget&&a.dispose()})});let s=n.addEventListener(e,"transitionend",a=>{a.target===a.currentTarget&&(t(),s())})}else t();return n.add(()=>t()),n.dispose}function R1(e,t,n,r){let o=n?"enter":"leave",i=Qn(),l=r!==void 0?N1(r):()=>{};o==="enter"&&(e.removeAttribute("hidden"),e.style.display="");let u=he(o,{enter:()=>t.enter,leave:()=>t.leave}),s=he(o,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),a=he(o,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return gl(e,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),yl(e,...u,...a),i.nextFrame(()=>{gl(e,...a),yl(e,...s),P1(e,()=>(gl(e,...u),yl(e,...t.entered),l()))}),i.dispose}function L1({container:e,direction:t,classes:n,onStart:r,onStop:o}){let i=Kr(),l=Ts(),u=wt(t);lt(()=>{let s=Qn();l.add(s.dispose);let a=e.current;if(a&&u.current!=="idle"&&i.current)return s.dispose(),r.current(u.current),s.add(R1(a,n.current,u.current==="enter",()=>{s.dispose(),o.current(u.current)})),s.dispose},[t])}function qt(e=""){return e.split(" ").filter(t=>t.trim().length>1)}let _i=w.createContext(null);_i.displayName="TransitionContext";var _1=(e=>(e.Visible="visible",e.Hidden="hidden",e))(_1||{});function U1(){let e=w.useContext(_i);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function O1(){let e=w.useContext(Ui);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let Ui=w.createContext(null);Ui.displayName="NestingContext";function Oi(e){return"children"in e?Oi(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function Zf(e,t){let n=wt(e),r=w.useRef([]),o=Kr(),i=Ts(),l=ue((v,h=ht.Hidden)=>{let g=r.current.findIndex(({el:T})=>T===v);g!==-1&&(he(h,{[ht.Unmount](){r.current.splice(g,1)},[ht.Hidden](){r.current[g].state="hidden"}}),i.microTask(()=>{var T;!Oi(r)&&o.current&&((T=n.current)==null||T.call(n))}))}),u=ue(v=>{let h=r.current.find(({el:g})=>g===v);return h?h.state!=="visible"&&(h.state="visible"):r.current.push({el:v,state:"visible"}),()=>l(v,ht.Unmount)}),s=w.useRef([]),a=w.useRef(Promise.resolve()),d=w.useRef({enter:[],leave:[],idle:[]}),p=ue((v,h,g)=>{s.current.splice(0),t&&(t.chains.current[h]=t.chains.current[h].filter(([T])=>T!==v)),t==null||t.chains.current[h].push([v,new Promise(T=>{s.current.push(T)})]),t==null||t.chains.current[h].push([v,new Promise(T=>{Promise.all(d.current[h].map(([f,c])=>c)).then(()=>T())})]),h==="enter"?a.current=a.current.then(()=>t==null?void 0:t.wait.current).then(()=>g(h)):g(h)}),m=ue((v,h,g)=>{Promise.all(d.current[h].splice(0).map(([T,f])=>f)).then(()=>{var T;(T=s.current.shift())==null||T()}).then(()=>g(h))});return w.useMemo(()=>({children:r,register:u,unregister:l,onStart:p,onStop:m,wait:a,chains:d}),[u,l,r,p,m,d,a])}function F1(){}let D1=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function ec(e){var t;let n={};for(let r of D1)n[r]=(t=e[r])!=null?t:F1;return n}function A1(e){let t=w.useRef(ec(e));return w.useEffect(()=>{t.current=ec(e)},[e]),t}let M1="div",ep=ri.RenderStrategy;function $1(e,t){let{beforeEnter:n,afterEnter:r,beforeLeave:o,afterLeave:i,enter:l,enterFrom:u,enterTo:s,entered:a,leave:d,leaveFrom:p,leaveTo:m,...v}=e,h=w.useRef(null),g=Ye(h,t),T=v.unmount?ht.Unmount:ht.Hidden,{show:f,appear:c,initial:y}=U1(),[k,N]=w.useState(f?"visible":"hidden"),P=O1(),{register:x,unregister:L}=P,A=w.useRef(null);w.useEffect(()=>x(h),[x,h]),w.useEffect(()=>{if(T===ht.Hidden&&h.current){if(f&&k!=="visible"){N("visible");return}return he(k,{hidden:()=>L(h),visible:()=>x(h)})}},[k,h,x,L,f,T]);let U=wt({enter:qt(l),enterFrom:qt(u),enterTo:qt(s),entered:qt(a),leave:qt(d),leaveFrom:qt(p),leaveTo:qt(m)}),j=A1({beforeEnter:n,afterEnter:r,beforeLeave:o,afterLeave:i}),He=Kn();w.useEffect(()=>{if(He&&k==="visible"&&h.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[h,k,He]);let Ve=y&&!c,mn=(()=>!He||Ve||A.current===f?"idle":f?"enter":"leave")(),ut=T1(0),st=ue(B=>he(B,{enter:()=>{ut.addFlag(Pe.Opening),j.current.beforeEnter()},leave:()=>{ut.addFlag(Pe.Closing),j.current.beforeLeave()},idle:()=>{}})),Kt=ue(B=>he(B,{enter:()=>{ut.removeFlag(Pe.Opening),j.current.afterEnter()},leave:()=>{ut.removeFlag(Pe.Closing),j.current.afterLeave()},idle:()=>{}})),R=Zf(()=>{N("hidden"),L(h)},P);L1({container:h,classes:U,direction:mn,onStart:wt(B=>{R.onStart(h,B,st)}),onStop:wt(B=>{R.onStop(h,B,Kt),B==="leave"&&!Oi(R)&&(N("hidden"),L(h))})}),w.useEffect(()=>{Ve&&(T===ht.Hidden?A.current=null:A.current=f)},[f,Ve,k]);let O=v,F={ref:g};return c&&f&&(O={...O,className:wu(v.className,...U.current.enter,...U.current.enterFrom)}),M.createElement(Ui.Provider,{value:R},M.createElement(fy,{value:he(k,{visible:Pe.Open,hidden:Pe.Closed})|ut.flags},je({ourProps:F,theirProps:O,defaultTag:M1,features:ep,visible:k==="visible",name:"Transition.Child"})))}function I1(e,t){let{show:n,appear:r=!1,unmount:o,...i}=e,l=w.useRef(null),u=Ye(l,t);Kn();let s=Ps();if(n===void 0&&s!==null&&(n=(s&Pe.Open)===Pe.Open),![!0,!1].includes(n))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[a,d]=w.useState(n?"visible":"hidden"),p=Zf(()=>{d("hidden")}),[m,v]=w.useState(!0),h=w.useRef([n]);lt(()=>{m!==!1&&h.current[h.current.length-1]!==n&&(h.current.push(n),v(!1))},[h,n]);let g=w.useMemo(()=>({show:n,appear:r,initial:m}),[n,r,m]);w.useEffect(()=>{if(n)d("visible");else if(!Oi(p))d("hidden");else{let f=l.current;if(!f)return;let c=f.getBoundingClientRect();c.x===0&&c.y===0&&c.width===0&&c.height===0&&d("hidden")}},[n,p]);let T={unmount:o};return M.createElement(Ui.Provider,{value:p},M.createElement(_i.Provider,{value:g},je({ourProps:{...T,as:w.Fragment,children:M.createElement(tp,{ref:u,...T,...i})},theirProps:{},defaultTag:w.Fragment,features:ep,visible:a==="visible",name:"Transition"})))}function z1(e,t){let n=w.useContext(_i)!==null,r=Ps()!==null;return M.createElement(M.Fragment,null,!n&&r?M.createElement(xu,{ref:t,...e}):M.createElement(tp,{ref:t,...e}))}let xu=Fe(I1),tp=Fe($1),B1=Fe(z1),vl=Object.assign(xu,{Child:B1,Root:xu});function _s({show:e,onClose:t,onSubmit:n,title:r,content:o,submitText:i,submitEnabled:l=!0}){return C(vl,{appear:!0,show:e,as:w.Fragment,children:I(hl,{as:"div",className:"relative z-10",onClose:t,children:[C(vl.Child,{as:w.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:C("div",{className:"fixed inset-0 bg-black bg-opacity-25"})}),C("div",{className:"fixed inset-0 overflow-y-auto",children:C("div",{className:"flex min-h-full items-center justify-center p-4 text-center",children:C(vl.Child,{as:w.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",children:I(hl.Panel,{className:"w-full max-w-md transform overflow-hidden rounded-2xl bg-white p-6 text-left align-middle shadow-xl transition-all",children:[C(hl.Title,{as:"h3",className:"text-lg font-medium leading-6 text-gray-900",children:r}),C("div",{className:"mt-3 text-sm text-gray-500",children:o}),I("div",{className:"mt-4 flex flex-row-reverse",children:[i&&C("button",{type:"button",disabled:!l,className:`inline-flex ml-4 justify-center rounded-md border border-transparent ${l?"bg-indigo-600":"bg-grey-300"} px-4 py-2 text-sm font-medium text-indigo-100 ${l?"hover:bg-indigo-500 focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2":""} transition-all duration-300`,onClick:n,children:i}),C("button",{type:"button",className:"inline-flex justify-center rounded-md border border-transparent bg-indigo-100 px-4 py-2 text-sm font-medium text-indigo-900 hover:bg-indigo-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2 transition-all duration-300",onClick:t,children:"Close"})]})]})})})})]})})}function j1(e){return C("div",{children:C("input",{...e,type:"url",className:"my-2 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"www.example.com",required:!0})})}function H1(e){const t=w.useRef(null),n=w.useRef(null);return w.useEffect(()=>{t.current&&n.current&&(n.current.src=e.audioUrl,t.current.load())},[e.audioUrl]),C("div",{className:"flex relative z-10 p-4 w-full",children:C("audio",{ref:t,controls:!0,className:"w-full h-14 rounded-lg bg-white shadow-xl shadow-black/5 ring-1 ring-slate-700/10",children:C("source",{ref:n,type:e.mimeType})})})}function V1(e){const{isModelLoading:t,isTranscribing:n,onClick:r,...o}=e;return C("button",{...o,onClick:i=>{r&&!n&&!t&&r(i)},disabled:n,className:"text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center mr-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800 inline-flex items-center",children:t?C(tc,{text:"Loading model..."}):n?C(tc,{text:"Transcribing..."}):"Transcribe Audio"})}function tc(e){return I("div",{role:"status",children:[I("svg",{"aria-hidden":"true",role:"status",className:"inline w-4 h-4 mr-3 text-white animate-spin",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[C("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"#E5E7EB"}),C("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentColor"})]}),e.text]})}function b1(){let e=!1;return function(t){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(e=!0)}(navigator.userAgent||navigator.vendor||("opera"in window&&typeof window.opera=="string"?window.opera:"")),e}const W1=b1(),ft={SAMPLING_RATE:16e3,DEFAULT_AUDIO_URL:`https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/${W1?"jfk":"ted_60_16k"}.wav`,DEFAULT_MODEL:"distil-whisper/distil-medium.en",DEFAULT_SUBTASK:"transcribe",DEFAULT_LANGUAGE:"english",DEFAULT_QUANTIZED:!0,DEFAULT_MULTILINGUAL:!1};function Q1({text:e,percentage:t}){return t=t??0,C("div",{className:"mt-0.5 w-full relative text-sm text-white background-bg-cyan-400 bg-gray-200 border-1 border-gray-400 rounded-lg text-left overflow-hidden",children:I("div",{className:"top-0 h-full bg-blue-500 whitespace-nowrap px-2",style:{width:`${t}%`},children:[e," (",`${t.toFixed(2)}%`,")"]})})}function wl(e){return String(e).padStart(2,"0")}function np(e){const t=e/3600|0;e-=t*(60*60);const n=e/60|0;e-=n*60;const r=e|0;return`${t?wl(t)+":":""}${wl(n)}:${wl(r)}`}const K1={172351395:{name:"EBML",type:"Container"},646:{name:"EBMLVersion",type:"Uint"},759:{name:"EBMLReadVersion",type:"Uint"},754:{name:"EBMLMaxIDLength",type:"Uint"},755:{name:"EBMLMaxSizeLength",type:"Uint"},642:{name:"DocType",type:"String"},647:{name:"DocTypeVersion",type:"Uint"},645:{name:"DocTypeReadVersion",type:"Uint"},108:{name:"Void",type:"Binary"},63:{name:"CRC-32",type:"Binary"},190023271:{name:"SignatureSlot",type:"Container"},16010:{name:"SignatureAlgo",type:"Uint"},16026:{name:"SignatureHash",type:"Uint"},16037:{name:"SignaturePublicKey",type:"Binary"},16053:{name:"Signature",type:"Binary"},15963:{name:"SignatureElements",type:"Container"},15995:{name:"SignatureElementList",type:"Container"},9522:{name:"SignedElement",type:"Binary"},139690087:{name:"Segment",type:"Container"},21863284:{name:"SeekHead",type:"Container"},3515:{name:"Seek",type:"Container"},5035:{name:"SeekID",type:"Binary"},5036:{name:"SeekPosition",type:"Uint"},88713574:{name:"Info",type:"Container"},13220:{name:"SegmentUID",type:"Binary"},13188:{name:"SegmentFilename",type:"String"},1882403:{name:"PrevUID",type:"Binary"},1868715:{name:"PrevFilename",type:"String"},2013475:{name:"NextUID",type:"Binary"},1999803:{name:"NextFilename",type:"String"},1092:{name:"SegmentFamily",type:"Binary"},10532:{name:"ChapterTranslate",type:"Container"},10748:{name:"ChapterTranslateEditionUID",type:"Uint"},10687:{name:"ChapterTranslateCodec",type:"Uint"},10661:{name:"ChapterTranslateID",type:"Binary"},710577:{name:"TimecodeScale",type:"Uint"},1161:{name:"Duration",type:"Float"},1121:{name:"DateUTC",type:"Date"},15273:{name:"Title",type:"String"},3456:{name:"MuxingApp",type:"String"},5953:{name:"WritingApp",type:"String"},103:{name:"Timecode",type:"Uint"},6228:{name:"SilentTracks",type:"Container"},6359:{name:"SilentTrackNumber",type:"Uint"},39:{name:"Position",type:"Uint"},43:{name:"PrevSize",type:"Uint"},35:{name:"SimpleBlock",type:"Binary"},32:{name:"BlockGroup",type:"Container"},33:{name:"Block",type:"Binary"},34:{name:"BlockVirtual",type:"Binary"},13729:{name:"BlockAdditions",type:"Container"},38:{name:"BlockMore",type:"Container"},110:{name:"BlockAddID",type:"Uint"},37:{name:"BlockAdditional",type:"Binary"},27:{name:"BlockDuration",type:"Uint"},122:{name:"ReferencePriority",type:"Uint"},123:{name:"ReferenceBlock",type:"Int"},125:{name:"ReferenceVirtual",type:"Int"},36:{name:"CodecState",type:"Binary"},13730:{name:"DiscardPadding",type:"Int"},14:{name:"Slices",type:"Container"},104:{name:"TimeSlice",type:"Container"},76:{name:"LaceNumber",type:"Uint"},77:{name:"FrameNumber",type:"Uint"},75:{name:"BlockAdditionID",type:"Uint"},78:{name:"Delay",type:"Uint"},79:{name:"SliceDuration",type:"Uint"},72:{name:"ReferenceFrame",type:"Container"},73:{name:"ReferenceOffset",type:"Uint"},74:{name:"ReferenceTimeCode",type:"Uint"},47:{name:"EncryptedBlock",type:"Binary"},106212971:{name:"Tracks",type:"Container"},46:{name:"TrackEntry",type:"Container"},87:{name:"TrackNumber",type:"Uint"},13253:{name:"TrackUID",type:"Uint"},3:{name:"TrackType",type:"Uint"},57:{name:"FlagEnabled",type:"Uint"},8:{name:"FlagDefault",type:"Uint"},5546:{name:"FlagForced",type:"Uint"},28:{name:"FlagLacing",type:"Uint"},11751:{name:"MinCache",type:"Uint"},11768:{name:"MaxCache",type:"Uint"},254851:{name:"DefaultDuration",type:"Uint"},216698:{name:"DefaultDecodedFieldDuration",type:"Uint"},209231:{name:"TrackTimecodeScale",type:"Float"},4991:{name:"TrackOffset",type:"Int"},5614:{name:"MaxBlockAdditionID",type:"Uint"},4974:{name:"Name",type:"String"},177564:{name:"Language",type:"String"},6:{name:"CodecID",type:"String"},9122:{name:"CodecPrivate",type:"Binary"},362120:{name:"CodecName",type:"String"},13382:{name:"AttachmentLink",type:"Uint"},1742487:{name:"CodecSettings",type:"String"},1785920:{name:"CodecInfoURL",type:"String"},438848:{name:"CodecDownloadURL",type:"String"},42:{name:"CodecDecodeAll",type:"Uint"},12203:{name:"TrackOverlay",type:"Uint"},5802:{name:"CodecDelay",type:"Uint"},5819:{name:"SeekPreRoll",type:"Uint"},9764:{name:"TrackTranslate",type:"Container"},9980:{name:"TrackTranslateEditionUID",type:"Uint"},9919:{name:"TrackTranslateCodec",type:"Uint"},9893:{name:"TrackTranslateTrackID",type:"Binary"},96:{name:"Video",type:"Container"},26:{name:"FlagInterlaced",type:"Uint"},5048:{name:"StereoMode",type:"Uint"},5056:{name:"AlphaMode",type:"Uint"},5049:{name:"OldStereoMode",type:"Uint"},48:{name:"PixelWidth",type:"Uint"},58:{name:"PixelHeight",type:"Uint"},5290:{name:"PixelCropBottom",type:"Uint"},5307:{name:"PixelCropTop",type:"Uint"},5324:{name:"PixelCropLeft",type:"Uint"},5341:{name:"PixelCropRight",type:"Uint"},5296:{name:"DisplayWidth",type:"Uint"},5306:{name:"DisplayHeight",type:"Uint"},5298:{name:"DisplayUnit",type:"Uint"},5299:{name:"AspectRatioType",type:"Uint"},963876:{name:"ColourSpace",type:"Binary"},1029411:{name:"GammaValue",type:"Float"},230371:{name:"FrameRate",type:"Float"},97:{name:"Audio",type:"Container"},53:{name:"SamplingFrequency",type:"Float"},14517:{name:"OutputSamplingFrequency",type:"Float"},31:{name:"Channels",type:"Uint"},15739:{name:"ChannelPositions",type:"Binary"},8804:{name:"BitDepth",type:"Uint"},98:{name:"TrackOperation",type:"Container"},99:{name:"TrackCombinePlanes",type:"Container"},100:{name:"TrackPlane",type:"Container"},101:{name:"TrackPlaneUID",type:"Uint"},102:{name:"TrackPlaneType",type:"Uint"},105:{name:"TrackJoinBlocks",type:"Container"},109:{name:"TrackJoinUID",type:"Uint"},64:{name:"TrickTrackUID",type:"Uint"},65:{name:"TrickTrackSegmentUID",type:"Binary"},70:{name:"TrickTrackFlag",type:"Uint"},71:{name:"TrickMasterTrackUID",type:"Uint"},68:{name:"TrickMasterTrackSegmentUID",type:"Binary"},11648:{name:"ContentEncodings",type:"Container"},8768:{name:"ContentEncoding",type:"Container"},4145:{name:"ContentEncodingOrder",type:"Uint"},4146:{name:"ContentEncodingScope",type:"Uint"},4147:{name:"ContentEncodingType",type:"Uint"},4148:{name:"ContentCompression",type:"Container"},596:{name:"ContentCompAlgo",type:"Uint"},597:{name:"ContentCompSettings",type:"Binary"},4149:{name:"ContentEncryption",type:"Container"},2017:{name:"ContentEncAlgo",type:"Uint"},2018:{name:"ContentEncKeyID",type:"Binary"},2019:{name:"ContentSignature",type:"Binary"},2020:{name:"ContentSigKeyID",type:"Binary"},2021:{name:"ContentSigAlgo",type:"Uint"},2022:{name:"ContentSigHashAlgo",type:"Uint"},206814059:{name:"Cues",type:"Container"},59:{name:"CuePoint",type:"Container"},51:{name:"CueTime",type:"Uint"},55:{name:"CueTrackPositions",type:"Container"},119:{name:"CueTrack",type:"Uint"},113:{name:"CueClusterPosition",type:"Uint"},112:{name:"CueRelativePosition",type:"Uint"},50:{name:"CueDuration",type:"Uint"},4984:{name:"CueBlockNumber",type:"Uint"},106:{name:"CueCodecState",type:"Uint"},91:{name:"CueReference",type:"Container"},22:{name:"CueRefTime",type:"Uint"},23:{name:"CueRefCluster",type:"Uint"},4959:{name:"CueRefNumber",type:"Uint"},107:{name:"CueRefCodecState",type:"Uint"},155296873:{name:"Attachments",type:"Container"},8615:{name:"AttachedFile",type:"Container"},1662:{name:"FileDescription",type:"String"},1646:{name:"FileName",type:"String"},1632:{name:"FileMimeType",type:"String"},1628:{name:"FileData",type:"Binary"},1710:{name:"FileUID",type:"Uint"},1653:{name:"FileReferral",type:"Binary"},1633:{name:"FileUsedStartTime",type:"Uint"},1634:{name:"FileUsedEndTime",type:"Uint"},4433776:{name:"Chapters",type:"Container"},1465:{name:"EditionEntry",type:"Container"},1468:{name:"EditionUID",type:"Uint"},1469:{name:"EditionFlagHidden",type:"Uint"},1499:{name:"EditionFlagDefault",type:"Uint"},1501:{name:"EditionFlagOrdered",type:"Uint"},54:{name:"ChapterAtom",type:"Container"},13252:{name:"ChapterUID",type:"Uint"},5716:{name:"ChapterStringUID",type:"String"},17:{name:"ChapterTimeStart",type:"Uint"},18:{name:"ChapterTimeEnd",type:"Uint"},24:{name:"ChapterFlagHidden",type:"Uint"},1432:{name:"ChapterFlagEnabled",type:"Uint"},11879:{name:"ChapterSegmentUID",type:"Binary"},11964:{name:"ChapterSegmentEditionUID",type:"Uint"},9155:{name:"ChapterPhysicalEquiv",type:"Uint"},15:{name:"ChapterTrack",type:"Container"},9:{name:"ChapterTrackNumber",type:"Uint"},0:{name:"ChapterDisplay",type:"Container"},5:{name:"ChapString",type:"String"},892:{name:"ChapLanguage",type:"String"},894:{name:"ChapCountry",type:"String"},10564:{name:"ChapProcess",type:"Container"},10581:{name:"ChapProcessCodecID",type:"Uint"},1293:{name:"ChapProcessPrivate",type:"Binary"},10513:{name:"ChapProcessCommand",type:"Container"},10530:{name:"ChapProcessTime",type:"Uint"},10547:{name:"ChapProcessData",type:"Binary"},39109479:{name:"Tags",type:"Container"},13171:{name:"Tag",type:"Container"},9152:{name:"Targets",type:"Container"},10442:{name:"TargetTypeValue",type:"Uint"},9162:{name:"TargetType",type:"String"},9157:{name:"TagTrackUID",type:"Uint"},9161:{name:"TagEditionUID",type:"Uint"},9156:{name:"TagChapterUID",type:"Uint"},9158:{name:"TagAttachmentUID",type:"Uint"},10184:{name:"SimpleTag",type:"Container"},1443:{name:"TagName",type:"String"},1146:{name:"TagLanguage",type:"String"},1156:{name:"TagDefault",type:"Uint"},1159:{name:"TagString",type:"String"},1157:{name:"TagBinary",type:"Binary"}};class li{constructor(t="Unknown",n="Unknown"){qn(this,"source");qn(this,"data");this.name=t,this.type=n}updateBySource(){}setSource(t){this.source=t,this.updateBySource()}updateByData(){}setData(t){this.data=t,this.updateByData()}}class G1 extends li{constructor(t,n){super(t,n||"Uint")}updateBySource(){this.data="";for(let t=0;t<this.source.length;t++){const n=this.source[t].toString(16);this.data+=nc(n)}}updateByData(){const t=this.data.length/2;this.source=new Uint8Array(t);for(let n=0;n<t;n++){const r=this.data.substr(n*2,2);this.source[n]=parseInt(r,16)}}getValue(){return parseInt(this.data,16)}setValue(t){this.setData(nc(t.toString(16)))}}function nc(e){return e.length%2===1?"0"+e:e}class rp extends li{constructor(t,n){super(t,n||"Float")}getFloatArrayType(){return this.source&&this.source.length===4?Float32Array:Float64Array}updateBySource(){const t=this.source.reverse(),n=this.getFloatArrayType(),r=new n(t.buffer);this.data=r[0]}updateByData(){const t=this.getFloatArrayType(),n=new t([this.data]),r=new Uint8Array(n.buffer);this.source=r.reverse()}getValue(){return this.data}setValue(t){this.setData(t)}}class Us extends li{constructor(n,r){super(n,r||"Container");qn(this,"offset",0);qn(this,"data",[])}readByte(){return this.source[this.offset++]}readUint(){const n=this.readByte(),r=8-n.toString(2).length;let o=n-(1<<7-r);for(let i=0;i<r;i++)o*=256,o+=this.readByte();return o}updateBySource(){let n;for(this.data=[],this.offset=0;this.offset<this.source.length;this.offset=n){const r=this.readUint(),o=this.readUint();n=Math.min(this.offset+o,this.source.length);const i=this.source.slice(this.offset,n),l=K1[r]||{name:"Unknown",type:"Unknown"};let u=li;switch(l.type){case"Container":u=Us;break;case"Uint":u=G1;break;case"Float":u=rp;break}const s=new u(l.name,l.type);s.setSource(i),this.data.push({id:r,idHex:r.toString(16),data:s})}}writeUint(n,r=!1){for(var o=1,i=128;n>=i&&o<8;o++,i*=128);if(!r){let l=i+n;for(let u=o-1;u>=0;u--){const s=l%256;this.source[this.offset+u]=s,l=(l-s)/256}}this.offset+=o}writeSections(n=!1){this.offset=0;for(let r=0;r<this.data.length;r++){const o=this.data[r],i=o.data.source,l=i.length;this.writeUint(o.id,n),this.writeUint(l,n),n||this.source.set(i,this.offset),this.offset+=l}return this.offset}updateByData(){const n=this.writeSections(!0);this.source=new Uint8Array(n),this.writeSections()}getSectionById(n){for(let r=0;r<this.data.length;r++){const o=this.data[r];if(o.id===n)return o.data}}}class q1 extends Us{constructor(t){super("File","File"),this.setSource(t)}fixDuration(t){const n=this.getSectionById(139690087);if(!n)return!1;const r=n.getSectionById(88713574);if(!r)return!1;const o=r.getSectionById(710577);if(!o)return!1;let i=r.getSectionById(1161);if(i)if(i.getValue()<=0)i.setValue(t);else return!1;else i=new rp("Duration","Float"),i.setValue(t),r.data.push({id:1161,data:i});return o.setValue(1e6),r.updateByData(),n.updateByData(),this.updateByData(),!0}toBlob(t="video/webm"){return new Blob([this.source.buffer],{type:t})}}const X1=(e,t,n="video/webm")=>new Promise((r,o)=>{try{const i=new FileReader;i.addEventListener("loadend",()=>{try{const l=i.result,u=new q1(new Uint8Array(l));u.fixDuration(t)?r(u.toBlob(n)):r(e)}catch(l){o(l)}}),i.addEventListener("error",()=>o()),i.readAsArrayBuffer(e)}catch(i){o(i)}});function Y1(){const e=["audio/webm","audio/mp4","audio/ogg","audio/wav","audio/aac"];for(let t=0;t<e.length;t++)if(MediaRecorder.isTypeSupported(e[t]))return e[t]}function J1(e){const[t,n]=w.useState(!1),[r,o]=w.useState(0),[i,l]=w.useState(null),u=w.useRef(null),s=w.useRef(null),a=w.useRef([]),d=w.useRef(null),p=async()=>{l(null);let h=Date.now();try{u.current||(u.current=await navigator.mediaDevices.getUserMedia({audio:!0}));const g=Y1(),T=new MediaRecorder(u.current,{mimeType:g});s.current=T,T.addEventListener("dataavailable",async f=>{if(f.data.size>0&&a.current.push(f.data),T.state==="inactive"){const c=Date.now()-h;let y=new Blob(a.current,{type:g});g==="audio/webm"&&(y=await X1(y,c,y.type)),l(y),e.onRecordingComplete(y),a.current=[]}}),T.start(),n(!0)}catch(g){console.error("Error accessing microphone:",g)}},m=()=>{s.current&&s.current.state==="recording"&&(s.current.stop(),o(0),n(!1))};return w.useEffect(()=>{if(t){const h=setInterval(()=>{o(g=>g+1)},1e3);return()=>{clearInterval(h)}}return()=>{}},[t]),I("div",{className:"flex flex-col justify-center items-center",children:[C("button",{type:"button",className:`m-2 inline-flex justify-center rounded-md border border-transparent px-4 py-2 text-sm font-medium text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2 transition-all duration-200 ${t?"bg-red-500 hover:bg-red-600":"bg-green-500 hover:bg-green-600"}`,onClick:()=>{t?m():p()},children:t?`Stop Recording (${np(r)})`:"Start Recording"}),i&&C("audio",{className:"w-full",ref:d,controls:!0,children:C("source",{src:URL.createObjectURL(i),type:i.type})})]})}function Z1(e){return e=e.toLowerCase(),(e.match(/\w+.?/g)||[]).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}const rc={en:"english",zh:"chinese",de:"german",es:"spanish/castilian",ru:"russian",ko:"korean",fr:"french",ja:"japanese",pt:"portuguese",tr:"turkish",pl:"polish",ca:"catalan/valencian",nl:"dutch/flemish",ar:"arabic",sv:"swedish",it:"italian",id:"indonesian",hi:"hindi",fi:"finnish",vi:"vietnamese",he:"hebrew",uk:"ukrainian",el:"greek",ms:"malay",cs:"czech",ro:"romanian/moldavian/moldovan",da:"danish",hu:"hungarian",ta:"tamil",no:"norwegian",th:"thai",ur:"urdu",hr:"croatian",bg:"bulgarian",lt:"lithuanian",la:"latin",mi:"maori",ml:"malayalam",cy:"welsh",sk:"slovak",te:"telugu",fa:"persian",lv:"latvian",bn:"bengali",sr:"serbian",az:"azerbaijani",sl:"slovenian",kn:"kannada",et:"estonian",mk:"macedonian",br:"breton",eu:"basque",is:"icelandic",hy:"armenian",ne:"nepali",mn:"mongolian",bs:"bosnian",kk:"kazakh",sq:"albanian",sw:"swahili",gl:"galician",mr:"marathi",pa:"punjabi/panjabi",si:"sinhala/sinhalese",km:"khmer",sn:"shona",yo:"yoruba",so:"somali",af:"afrikaans",oc:"occitan",ka:"georgian",be:"belarusian",tg:"tajik",sd:"sindhi",gu:"gujarati",am:"amharic",yi:"yiddish",lo:"lao",uz:"uzbek",fo:"faroese",ht:"haitian creole/haitian",ps:"pashto/pushto",tk:"turkmen",nn:"nynorsk",mt:"maltese",sa:"sanskrit",lb:"luxembourgish/letzeburgesch",my:"myanmar/burmese",bo:"tibetan",tl:"tagalog",mg:"malagasy",as:"assamese",tt:"tatar",haw:"hawaiian",ln:"lingala",ha:"hausa",ba:"bashkir",jw:"javanese",su:"sundanese"};function eg(e){const[t,n]=w.useState(void 0),[r,o]=w.useState(void 0),[i,l]=w.useState(void 0),u=t!==void 0,s=()=>{o(void 0),l(void 0)},a=async(m,v)=>{const h=new AudioContext({sampleRate:ft.SAMPLING_RATE}),g=URL.createObjectURL(new Blob([m],{type:"audio/*"})),T=await h.decodeAudioData(m);o({buffer:T,url:g,source:"URL",mimeType:v})},d=async m=>{s(),n(0);const v=URL.createObjectURL(m),h=new FileReader;h.onprogress=g=>{n(g.loaded/g.total||0)},h.onloadend=async()=>{const g=new AudioContext({sampleRate:ft.SAMPLING_RATE}),T=h.result,f=await g.decodeAudioData(T);n(void 0),o({buffer:f,url:v,source:"RECORDING",mimeType:m.type})},h.readAsArrayBuffer(m)},p=async m=>{if(i)try{o(void 0),n(0);const{data:v,headers:h}=await G0.get(i,{signal:m.signal,responseType:"arraybuffer",onDownloadProgress(T){n(T.progress||0)}});let g=h["content-type"];(!g||g==="audio/wave")&&(g="audio/wav"),a(v,g)}catch(v){console.log("Request failed or aborted",v)}finally{n(void 0)}};return w.useEffect(()=>{if(i){const m=new AbortController;return p(m),()=>{m.abort()}}},[i]),I(nt,{children:[I("div",{className:"flex flex-col justify-center items-center rounded-lg bg-white shadow-xl shadow-black/5 ring-1 ring-slate-700/10",children:[I("div",{className:"flex flex-row space-x-2 py-2 w-full px-2",children:[C(ig,{icon:C(cg,{}),text:"From URL",onUrlUpdate:m=>{e.transcriber.onInputChange(),l(m)}}),C(oc,{}),C(ug,{icon:C(dg,{}),text:"From file",onFileUpdate:(m,v,h)=>{e.transcriber.onInputChange(),o({buffer:m,url:v,source:"FILE",mimeType:h})}}),navigator.mediaDevices&&I(nt,{children:[C(oc,{}),C(sg,{icon:C(pg,{}),text:"Record",setAudioData:m=>{e.transcriber.onInputChange(),d(m)}})]})]}),C(rg,{progress:u?t:+!!r})]}),r&&I(nt,{children:[C(H1,{audioUrl:r.url,mimeType:r.mimeType}),I("div",{className:"relative w-full flex justify-center items-center",children:[C(V1,{onClick:()=>{e.transcriber.start(r.buffer)},isModelLoading:e.transcriber.isModelLoading,isTranscribing:e.transcriber.isBusy}),C(tg,{className:"absolute right-4",transcriber:e.transcriber,icon:C(fg,{})})]}),e.transcriber.progressItems.length>0&&I("div",{className:"relative z-10 p-4 w-full",children:[C("label",{children:"Loading model files... (only run once)"}),e.transcriber.progressItems.map(m=>C("div",{children:C(Q1,{text:m.file,percentage:m.progress})},m.file))]})]})]})}function tg(e){const[t,n]=w.useState(!1),r=()=>{n(!0)},o=()=>{n(!1)},i=l=>{o()};return I("div",{className:e.className,children:[C(Fi,{icon:e.icon,onClick:r}),C(ng,{show:t,onSubmit:i,onClose:o,transcriber:e.transcriber})]})}function ng(e){const t=Object.values(rc).map(Z1),n={"distil-whisper/distil-medium.en":[402],"distil-whisper/distil-large-v2":[767]};return C(_s,{show:e.show,title:"Settings",content:I(nt,{children:[C("label",{children:"Select the model to use."}),C("select",{className:"mt-1 mb-1 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",defaultValue:e.transcriber.model,onChange:r=>{e.transcriber.setModel(r.target.value)},children:Object.keys(n).map(r=>C("option",{value:r,children:`${r} (${n[r][0]}MB)`},r))}),I("div",{className:"flex justify-between items-center mb-3 px-1",children:[I("div",{className:"flex",children:[C("input",{id:"multilingual",type:"checkbox",disabled:!0,checked:e.transcriber.multilingual,onChange:r=>{e.transcriber.setMultilingual(r.target.checked)}}),C("label",{htmlFor:"multilingual",className:"ms-1",children:"Multilingual (coming soon)"})]}),I("div",{className:"flex",children:[C("input",{id:"quantize",type:"checkbox",disabled:!0,checked:e.transcriber.quantized,onChange:r=>{e.transcriber.setQuantized(r.target.checked)}}),C("label",{htmlFor:"quantize",className:"ms-1",children:"Quantized"})]})]}),e.transcriber.multilingual&&I(nt,{children:[C("label",{children:"Select the source language."}),C("select",{className:"mt-1 mb-3 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",defaultValue:e.transcriber.language,onChange:r=>{e.transcriber.setLanguage(r.target.value)},children:Object.keys(rc).map((r,o)=>C("option",{value:r,children:t[o]},r))}),C("label",{children:"Select the task to perform."}),I("select",{className:"mt-1 mb-3 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",defaultValue:e.transcriber.subtask,onChange:r=>{e.transcriber.setSubtask(r.target.value)},children:[C("option",{value:"transcribe",children:"Transcribe"}),C("option",{value:"translate",children:"Translate (to English)"})]})]})]}),onClose:e.onClose,onSubmit:()=>{}})}function oc(){return C("div",{className:"w-[1px] bg-slate-200"})}function rg(e){return C(og,{progress:`${Math.round(e.progress*100)}%`})}function og(e){return C("div",{className:"w-full bg-gray-200 rounded-full h-1 dark:bg-gray-700",children:C("div",{className:"bg-blue-600 h-1 rounded-full transition-all duration-100",style:{width:e.progress}})})}function ig(e){const[t,n]=w.useState(!1),r=()=>{n(!0)},o=()=>{n(!1)},i=l=>{e.onUrlUpdate(l),o()};return I(nt,{children:[C(Fi,{icon:e.icon,text:e.text,onClick:r}),C(lg,{show:t,onSubmit:i,onClose:o})]})}function lg(e){const[t,n]=w.useState(ft.DEFAULT_AUDIO_URL),r=i=>{n(i.target.value)},o=()=>{e.onSubmit(t)};return C(_s,{show:e.show,title:"From URL",content:I(nt,{children:["Enter the URL of the audio file you want to load.",C(j1,{onChange:r,value:t})]}),onClose:e.onClose,submitText:"Load",onSubmit:o})}function ug(e){let t=document.createElement("input");return t.type="file",t.oninput=n=>{let r=n.target.files;if(!r)return;const o=URL.createObjectURL(r[0]),i=r[0].type,l=new FileReader;l.addEventListener("load",async u=>{var p;const s=(p=u.target)==null?void 0:p.result;if(!s)return;const d=await new AudioContext({sampleRate:ft.SAMPLING_RATE}).decodeAudioData(s);e.onFileUpdate(d,o,i)}),l.readAsArrayBuffer(r[0]),t.value=""},C(nt,{children:C(Fi,{icon:e.icon,text:e.text,onClick:()=>t.click()})})}function sg(e){const[t,n]=w.useState(!1),r=()=>{n(!0)},o=()=>{n(!1)},i=l=>{l&&(e.setAudioData(l),o())};return I(nt,{children:[C(Fi,{icon:e.icon,text:e.text,onClick:r}),C(ag,{show:t,onSubmit:i,onClose:o})]})}function ag(e){const[t,n]=w.useState(),r=l=>{n(l)},o=()=>{e.onSubmit(t),n(void 0)},i=()=>{e.onClose(),n(void 0)};return C(_s,{show:e.show,title:"From Recording",content:I(nt,{children:["Record audio using your microphone",C(J1,{onRecordingComplete:r})]}),onClose:i,submitText:"Load",submitEnabled:t!==void 0,onSubmit:o})}function Fi(e){return I("button",{onClick:e.onClick,className:"flex items-center justify-center rounded-lg p-2 bg-blue text-slate-500 hover:text-indigo-600 hover:bg-indigo-50 transition-all duration-200",children:[C("div",{className:"w-7 h-7",children:e.icon}),e.text&&C("div",{className:"ml-2 break-text text-center text-md w-30",children:e.text})]})}function cg(){return C("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",children:C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.19 8.688a4.5 4.5 0 011.242 7.244l-4.5 4.5a4.5 4.5 0 01-6.364-6.364l1.757-1.757m13.35-.622l1.757-1.757a4.5 4.5 0 00-6.364-6.364l-4.5 4.5a4.5 4.5 0 001.242 7.244"})})}function dg(){return C("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",children:C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 9.776c.112-.017.227-.026.344-.026h15.812c.117 0 .232.009.344.026m-16.5 0a2.25 2.25 0 00-1.883 2.542l.857 6a2.25 2.25 0 002.227 1.932H19.05a2.25 2.25 0 002.227-1.932l.857-6a2.25 2.25 0 00-1.883-2.542m-16.5 0V6A2.25 2.25 0 016 3.75h3.879a1.5 1.5 0 011.06.44l2.122 2.12a1.5 1.5 0 001.06.44H18A2.25 2.25 0 0120.25 9v.776"})})}function fg(){return I("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.25",stroke:"currentColor",children:[C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.324.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 011.37.49l1.296 2.247a1.125 1.125 0 01-.26 1.431l-1.003.827c-.293.24-.438.613-.431.992a6.759 6.759 0 010 .255c-.007.378.138.75.43.99l1.005.828c.424.35.534.954.26 1.43l-1.298 2.247a1.125 1.125 0 01-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.57 6.57 0 01-.22.128c-.331.183-.581.495-.644.869l-.213 1.28c-.09.543-.56.941-1.11.941h-2.594c-.55 0-1.02-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 01-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 01-1.369-.49l-1.297-2.247a1.125 1.125 0 01.26-1.431l1.004-.827c.292-.24.437-.613.43-.992a6.932 6.932 0 010-.255c.007-.378-.138-.75-.43-.99l-1.004-.828a1.125 1.125 0 01-.26-1.43l1.297-2.247a1.125 1.125 0 011.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281z"}),C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}function pg(){return C("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})})}function mg({transcribedData:e}){const t=w.useRef(null),n=(i,l)=>{const u=URL.createObjectURL(i),s=document.createElement("a");s.href=u,s.download=l,s.click(),URL.revokeObjectURL(u)},r=()=>{let l=((e==null?void 0:e.chunks)??[]).map(s=>s.text).join("").trim();const u=new Blob([l],{type:"text/plain"});n(u,"transcript.txt")},o=()=>{let i=JSON.stringify((e==null?void 0:e.chunks)??[],null,2);const l=/( "timestamp": )\[\s+(\S+)\s+(\S+)\s+\]/gm;i=i.replace(l,"$1[$2 $3]");const u=new Blob([i],{type:"application/json"});n(u,"transcript.json")};return w.useEffect(()=>{t.current&&Math.abs(t.current.offsetHeight+t.current.scrollTop-t.current.scrollHeight)<=64&&(t.current.scrollTop=t.current.scrollHeight)}),I("div",{ref:t,className:"w-full flex flex-col my-2 p-4 max-h-[20rem] overflow-y-auto",children:[(e==null?void 0:e.chunks)&&e.chunks.map((i,l)=>I("div",{className:"w-full flex flex-row mb-2 bg-white rounded-lg p-4 shadow-xl shadow-black/5 ring-1 ring-slate-700/10",children:[C("div",{className:"mr-5",children:np(i.timestamp[0])}),i.text]},`${l}-${i.text}`)),e&&!e.isBusy&&I("div",{className:"w-full text-right",children:[C("button",{onClick:r,className:"text-white bg-green-500 hover:bg-green-600 focus:ring-4 focus:ring-green-300 font-medium rounded-lg text-sm px-4 py-2 text-center mr-2 dark:bg-green-600 dark:hover:bg-green-700 dark:focus:ring-green-800 inline-flex items-center",children:"Export TXT"}),C("button",{onClick:o,className:"text-white bg-green-500 hover:bg-green-600 focus:ring-4 focus:ring-green-300 font-medium rounded-lg text-sm px-4 py-2 text-center mr-2 dark:bg-green-600 dark:hover:bg-green-700 dark:focus:ring-green-800 inline-flex items-center",children:"Export JSON"})]})]})}function hg(e){const[t]=w.useState(()=>yg(e));return t}function yg(e){const t=new Worker(new URL("/assets/worker-437c363b.js",self.location),{type:"module"});return t.addEventListener("message",e),t}function gg(){const[e,t]=w.useState(void 0),[n,r]=w.useState(!1),[o,i]=w.useState(!1),[l,u]=w.useState([]),s=hg(P=>{const x=P.data;switch(x.status){case"progress":u(U=>U.map(j=>j.file===x.file?{...j,progress:x.progress}:j));break;case"update":const L=x;t({isBusy:!0,text:L.data[0],chunks:L.data[1].chunks});break;case"complete":const A=x;t({isBusy:!1,text:A.data.text,chunks:A.data.chunks}),r(!1);break;case"initiate":i(!0),u(U=>[...U,x]);break;case"ready":i(!1);break;case"error":r(!1),alert(`${x.data.message} This is most likely because you are using Safari on an M1/M2 Mac. Please try again from Chrome, Firefox, or Edge.
46
 
47
+ If this is not the case, please file a bug report.`);break;case"done":u(U=>U.filter(j=>j.file!==x.file));break}}),[a,d]=w.useState(ft.DEFAULT_MODEL),[p,m]=w.useState(ft.DEFAULT_SUBTASK),[v,h]=w.useState(ft.DEFAULT_QUANTIZED),[g,T]=w.useState(ft.DEFAULT_MULTILINGUAL),[f,c]=w.useState(ft.DEFAULT_LANGUAGE),y=w.useCallback(()=>{t(void 0)},[]),k=w.useCallback(async P=>{if(P){t(void 0),r(!0);let x;if(P.numberOfChannels===2){const L=Math.sqrt(2);let A=P.getChannelData(0),U=P.getChannelData(1);x=new Float32Array(A.length);for(let j=0;j<P.length;++j)x[j]=L*(A[j]+U[j])/2}else x=P.getChannelData(0);s.postMessage({audio:x,model:a,multilingual:g,quantized:v,subtask:g?p:null,language:g&&f!=="auto"?f:null})}},[s,a,g,v,p,f]);return w.useMemo(()=>({onInputChange:y,isBusy:n,isModelLoading:o,progressItems:l,start:k,output:e,model:a,setModel:d,multilingual:g,setMultilingual:T,quantized:v,setQuantized:h,subtask:p,setSubtask:m,language:f,setLanguage:c}),[n,o,l,k,e,a,g,v,p,f])}function vg(){const e=gg();return I("div",{className:"flex justify-center items-center min-h-screen",children:[I("div",{className:"container flex flex-col justify-center items-center",children:[C("h1",{className:"text-5xl font-extrabold tracking-tight text-slate-900 sm:text-6xl text-center",children:"Whisper"}),C("h2",{className:"mt-3 mb-5 px-4 text-center text-1xl font-semibold tracking-tight text-slate-900 sm:text-2xl",children:"by OpenSkyML"}),C(eg,{transcriber:e}),C(mg,{transcribedData:e.output})]}),I("div",{className:"absolute bottom-4",children:["Made with"," ",C("a",{className:"underline",href:"https://github.com/xenova/transformers.js",children:"🤗 Transformers.js"})]})]})}kl.createRoot(document.getElementById("root")).render(C(M.StrictMode,{children:C(vg,{})}));