streamlit-nightly 1.46.2.dev20250715__py3-none-any.whl → 1.47.1.dev20250717__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. streamlit/connections/snowflake_connection.py +2 -2
  2. streamlit/elements/graphviz_chart.py +7 -0
  3. streamlit/elements/lib/file_uploader_utils.py +21 -2
  4. streamlit/elements/plotly_chart.py +6 -2
  5. streamlit/elements/pyplot.py +5 -1
  6. streamlit/elements/widgets/chat.py +6 -0
  7. streamlit/elements/widgets/file_uploader.py +6 -0
  8. streamlit/static/index.html +1 -1
  9. streamlit/static/manifest.json +218 -218
  10. streamlit/static/static/js/{ErrorOutline.esm.CaUhmcG6.js → ErrorOutline.esm.77fHhxmf.js} +1 -1
  11. streamlit/static/static/js/{FileDownload.esm.ZEl-HfEg.js → FileDownload.esm.qBSGbtBF.js} +1 -1
  12. streamlit/static/static/js/{FileHelper.BKIVKQnB.js → FileHelper.BYzZxqTl.js} +1 -1
  13. streamlit/static/static/js/{FormClearHelper.C4W8xjEX.js → FormClearHelper.BapTKtHM.js} +1 -1
  14. streamlit/static/static/js/{Hooks.Bcs7Dqad.js → Hooks.DQUBTvpJ.js} +1 -1
  15. streamlit/static/static/js/{InputInstructions.CAp9mFM6.js → InputInstructions.DfmDQyfZ.js} +1 -1
  16. streamlit/static/static/js/{ProgressBar.DBmbQ5U6.js → ProgressBar.DH8nVA3A.js} +1 -1
  17. streamlit/static/static/js/{RenderInPortalIfExists.BGENGpwt.js → RenderInPortalIfExists.Dc3T7qg7.js} +1 -1
  18. streamlit/static/static/js/{Toolbar.CA92Moni.js → Toolbar.DoQICZLn.js} +1 -1
  19. streamlit/static/static/js/{base-input.C-H36mFE.js → base-input.DJLL2PiI.js} +1 -1
  20. streamlit/static/static/js/{checkbox.B6I7DbdE.js → checkbox.BEZCVkdu.js} +1 -1
  21. streamlit/static/static/js/{createSuper.DEaMobJa.js → createSuper.Cd0gz3ZP.js} +1 -1
  22. streamlit/static/static/js/{data-grid-overlay-editor.CxvB719M.js → data-grid-overlay-editor.DBCkAuJT.js} +1 -1
  23. streamlit/static/static/js/{downloader.CDDSxxak.js → downloader.CNEzyeJy.js} +1 -1
  24. streamlit/static/static/js/{es6.BMYexa9t.js → es6.Dj_qfQ-J.js} +2 -2
  25. streamlit/static/static/js/{iframeResizer.contentWindow.D-l9cCws.js → iframeResizer.contentWindow.DWZGbVE9.js} +1 -1
  26. streamlit/static/static/js/{index.CqALE_Sz.js → index.3629iKJ_.js} +1 -1
  27. streamlit/static/static/js/{index.1ZtAvXND.js → index.9H0CGffC.js} +1 -1
  28. streamlit/static/static/js/{index.Bb5Sxtkx.js → index.B5PCerES.js} +1 -1
  29. streamlit/static/static/js/{index.BQQ5JTaz.js → index.BCYov0Z6.js} +1 -1
  30. streamlit/static/static/js/{index.CfoE7jon.js → index.BQkb06fM.js} +1 -1
  31. streamlit/static/static/js/{index.DzH3Qe6P.js → index.BlsArqdU.js} +1 -1
  32. streamlit/static/static/js/{index.CEUhSvrW.js → index.Bnbuv9NG.js} +1 -1
  33. streamlit/static/static/js/{index.Ct2v9YN2.js → index.BqR_ah2P.js} +1 -1
  34. streamlit/static/static/js/{index.aLRZj3JI.js → index.Bwe6rc_e.js} +1 -1
  35. streamlit/static/static/js/{index.phUFaJLn.js → index.BwewuyvV.js} +1 -1
  36. streamlit/static/static/js/{index.BoTBd6Jn.js → index.CA4nGH2a.js} +1 -1
  37. streamlit/static/static/js/{index.Ch30W6NP.js → index.CHmeRQB0.js} +1 -1
  38. streamlit/static/static/js/{index.Ce906Q5W.js → index.CSEGzY5i.js} +1 -1
  39. streamlit/static/static/js/{index.CS9yBABI.js → index.CoYP8GwB.js} +1 -1
  40. streamlit/static/static/js/{index.Ou3kxN43.js → index.Co_D1bGa.js} +1 -1
  41. streamlit/static/static/js/{index.Dm8vdcs9.js → index.CtsW3eJF.js} +1 -1
  42. streamlit/static/static/js/{index.BdazK8za.js → index.D4efqxNs.js} +1 -1
  43. streamlit/static/static/js/{index.CphcnmQO.js → index.DF-6qVO2.js} +1 -1
  44. streamlit/static/static/js/{index.DNoDZbuV.js → index.DIxNMQxZ.js} +1 -1
  45. streamlit/static/static/js/{index.D9XZpDDt.js → index.DYQbjkZY.js} +1 -1
  46. streamlit/static/static/js/{index.Buz-cCdK.js → index.DaegFwX9.js} +1 -1
  47. streamlit/static/static/js/{index.DHv7KxuP.js → index.DcXKaleC.js} +1 -1
  48. streamlit/static/static/js/{index.vRRu8CJW.js → index.Dh4PSyeU.js} +1 -1
  49. streamlit/static/static/js/{index.CZbA_QY0.js → index.Dj_sBWoU.js} +1 -1
  50. streamlit/static/static/js/{index.C_f3O5DO.js → index.DkYSvvUe.js} +1 -1
  51. streamlit/static/static/js/{index.DMzpbFDn.js → index.Dxi0xeeC.js} +1 -1
  52. streamlit/static/static/js/{index.Br2RYgMU.js → index.Dy9mt1lb.js} +1 -1
  53. streamlit/static/static/js/{index.B-g_Erog.js → index.DyKNikeb.js} +72 -72
  54. streamlit/static/static/js/{index.C9PLrvrw.js → index.HTy-ykxC.js} +1 -1
  55. streamlit/static/static/js/{index.DBVPN8iJ.js → index.HcR5RThE.js} +1 -1
  56. streamlit/static/static/js/{index.EAQB8Tuq.js → index.SCzIN5SB.js} +3 -3
  57. streamlit/static/static/js/{index.DygxY7Lg.js → index.Uzv6ooYp.js} +2 -2
  58. streamlit/static/static/js/{index.DYvo87DK.js → index.gupvSUiZ.js} +1 -1
  59. streamlit/static/static/js/{index.kIS8fJE1.js → index.hExo-vs3.js} +1 -1
  60. streamlit/static/static/js/{index.DFjvmFUl.js → index.jtH7YSzj.js} +1 -1
  61. streamlit/static/static/js/{index.DJ6SMXzt.js → index.nKiB2Lb1.js} +1 -1
  62. streamlit/static/static/js/{index.BjJqANY4.js → index.r5SsG0UH.js} +1 -1
  63. streamlit/static/static/js/{input.DjnwsrgF.js → input.C4PKmVyq.js} +1 -1
  64. streamlit/static/static/js/{memory.C-fF2BpE.js → memory.BlWtC9mT.js} +1 -1
  65. streamlit/static/static/js/{mergeWith.Cjweouij.js → mergeWith.BpStvP-d.js} +1 -1
  66. streamlit/static/static/js/{number-overlay-editor.BFTlQD7x.js → number-overlay-editor.h2wH-G_L.js} +1 -1
  67. streamlit/static/static/js/{possibleConstructorReturn.Cy1PJuxU.js → possibleConstructorReturn.CU3h0WWI.js} +1 -1
  68. streamlit/static/static/js/{sandbox.DvSXZ4R-.js → sandbox.BW2Eycz9.js} +1 -1
  69. streamlit/static/static/js/{timepicker.bPCY7gSF.js → timepicker.ASDBDZeB.js} +1 -1
  70. streamlit/static/static/js/{toConsumableArray.DaNXH4b3.js → toConsumableArray.Dn5dJvBy.js} +1 -1
  71. streamlit/static/static/js/{uniqueId.CDZNs_pn.js → uniqueId.8z-ePOzb.js} +1 -1
  72. streamlit/static/static/js/{useBasicWidgetState.YAhDGDM8.js → useBasicWidgetState.Bg3DrOCg.js} +1 -1
  73. streamlit/static/static/js/{useOnInputChange.HiDk3WIa.js → useOnInputChange.SNHZF6F7.js} +1 -1
  74. streamlit/static/static/js/{useTextInputAutoExpand.CwuIWHHK.js → useTextInputAutoExpand.Dm8V44AL.js} +1 -1
  75. streamlit/static/static/js/{withFullScreenWrapper.C4lh8vGd.js → withFullScreenWrapper.Drneg2_8.js} +1 -1
  76. streamlit/user_info.py +5 -1
  77. {streamlit_nightly-1.46.2.dev20250715.dist-info → streamlit_nightly-1.47.1.dev20250717.dist-info}/METADATA +13 -1
  78. {streamlit_nightly-1.46.2.dev20250715.dist-info → streamlit_nightly-1.47.1.dev20250717.dist-info}/RECORD +82 -82
  79. {streamlit_nightly-1.46.2.dev20250715.data → streamlit_nightly-1.47.1.dev20250717.data}/scripts/streamlit.cmd +0 -0
  80. {streamlit_nightly-1.46.2.dev20250715.dist-info → streamlit_nightly-1.47.1.dev20250717.dist-info}/WHEEL +0 -0
  81. {streamlit_nightly-1.46.2.dev20250715.dist-info → streamlit_nightly-1.47.1.dev20250717.dist-info}/entry_points.txt +0 -0
  82. {streamlit_nightly-1.46.2.dev20250715.dist-info → streamlit_nightly-1.47.1.dev20250717.dist-info}/top_level.txt +0 -0
@@ -1,4 +1,4 @@
1
- import{r as h,E as $,_ as H,ba as ut,bj as zt,bk as _t,bl as $t,M as X,O as q,aI as Ht,s as x,bm as Vt,C as N,j as v,bn as jt,b4 as Gt,bo as Xt,bp as qt,l as Yt,z as Kt,bq as tt,H as Jt,aE as Qt,br as Zt,bs as te,b9 as ee,bt as ie}from"./index.EAQB8Tuq.js";import{u as se,F as ne}from"./FormClearHelper.C4W8xjEX.js";import{T as re,a as pt}from"./Toolbar.CA92Moni.js";import{u as oe}from"./Hooks.Bcs7Dqad.js";import{c as ae}from"./createDownloadLinkElement.DZMwyjvU.js";import{F as le,D as ce}from"./FileDownload.esm.ZEl-HfEg.js";var vt=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),h.createElement("g",{fill:"none"},h.createElement("rect",{width:24,height:24}),h.createElement("rect",{width:24,height:24}),h.createElement("rect",{width:24,height:24})),h.createElement("path",{d:"M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"}),h.createElement("path",{d:"M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"}))});vt.displayName="Mic";var bt=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),h.createElement("rect",{width:24,height:24,fill:"none"}),h.createElement("path",{d:"M8 19c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2v10c0 1.1.9 2 2 2zm6-12v10c0 1.1.9 2 2 2s2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2z"}))});bt.displayName="Pause";var yt=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),h.createElement("rect",{width:24,height:24,fill:"none"}),h.createElement("path",{d:"M8 6.82v10.36c0 .79.87 1.27 1.54.84l8.14-5.18a1 1 0 000-1.69L9.54 5.98A.998.998 0 008 6.82z"}))});yt.displayName="PlayArrow";var wt=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),h.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),h.createElement("path",{d:"M17.65 6.35a7.95 7.95 0 00-6.48-2.31c-3.67.37-6.69 3.35-7.1 7.02C3.52 15.91 7.27 20 12 20a7.98 7.98 0 007.21-4.56c.32-.67-.16-1.44-.9-1.44-.37 0-.72.2-.88.53a5.994 5.994 0 01-6.8 3.31c-2.22-.49-4.01-2.3-4.48-4.52A6.002 6.002 0 0112 6c1.66 0 3.14.69 4.22 1.78l-1.51 1.51c-.63.63-.19 1.71.7 1.71H19c.55 0 1-.45 1-1V6.41c0-.89-1.08-1.34-1.71-.71l-.64.65z"}))});wt.displayName="Refresh";var St=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),h.createElement("g",{fill:"none"},h.createElement("rect",{width:24,height:24}),h.createElement("rect",{width:24,height:24})),h.createElement("path",{fillRule:"evenodd",d:"M9 16h6c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1H9c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1zm3-14C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z"}))});St.displayName="StopCircle";function P(s,t,e,i){return new(e||(e=Promise))(function(n,r){function o(c){try{d(i.next(c))}catch(l){r(l)}}function a(c){try{d(i.throw(c))}catch(l){r(l)}}function d(c){var l;c.done?n(c.value):(l=c.value,l instanceof e?l:new e(function(p){p(l)})).then(o,a)}d((i=i.apply(s,t||[])).next())})}let V=class{constructor(){this.listeners={}}on(t,e,i){if(this.listeners[t]||(this.listeners[t]=new Set),this.listeners[t].add(e),i?.once){const n=()=>{this.un(t,n),this.un(t,e)};return this.on(t,n),n}return()=>this.un(t,e)}un(t,e){var i;(i=this.listeners[t])===null||i===void 0||i.delete(e)}once(t,e){return this.on(t,e,{once:!0})}unAll(){this.listeners={}}emit(t,...e){this.listeners[t]&&this.listeners[t].forEach(i=>i(...e))}};const j={decode:function(s,t){return P(this,void 0,void 0,function*(){const e=new AudioContext({sampleRate:t});return e.decodeAudioData(s).finally(()=>e.close())})},createBuffer:function(s,t){return typeof s[0]=="number"&&(s=[s]),function(e){const i=e[0];if(i.some(n=>n>1||n<-1)){const n=i.length;let r=0;for(let o=0;o<n;o++){const a=Math.abs(i[o]);a>r&&(r=a)}for(const o of e)for(let a=0;a<n;a++)o[a]/=r}}(s),{duration:t,length:s[0].length,sampleRate:s[0].length/t,numberOfChannels:s.length,getChannelData:e=>s?.[e],copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};function Ct(s,t){const e=t.xmlns?document.createElementNS(t.xmlns,s):document.createElement(s);for(const[i,n]of Object.entries(t))if(i==="children"&&n)for(const[r,o]of Object.entries(n))o instanceof Node?e.appendChild(o):typeof o=="string"?e.appendChild(document.createTextNode(o)):e.appendChild(Ct(r,o));else i==="style"?Object.assign(e.style,n):i==="textContent"?e.textContent=n:e.setAttribute(i,n.toString());return e}function mt(s,t,e){const i=Ct(s,t||{});return e?.appendChild(i),i}var de=Object.freeze({__proto__:null,createElement:mt,default:mt});const he={fetchBlob:function(s,t,e){return P(this,void 0,void 0,function*(){const i=yield fetch(s,e);if(i.status>=400)throw new Error(`Failed to fetch ${s}: ${i.status} (${i.statusText})`);return function(n,r){P(this,void 0,void 0,function*(){if(!n.body||!n.headers)return;const o=n.body.getReader(),a=Number(n.headers.get("Content-Length"))||0;let d=0;const c=p=>P(this,void 0,void 0,function*(){d+=p?.length||0;const u=Math.round(d/a*100);r(u)}),l=()=>P(this,void 0,void 0,function*(){let p;try{p=yield o.read()}catch{return}p.done||(c(p.value),yield l())});l()})}(i.clone(),t),i.blob()})}};class ue extends V{constructor(t){super(),this.isExternalMedia=!1,t.media?(this.media=t.media,this.isExternalMedia=!0):this.media=document.createElement("audio"),t.mediaControls&&(this.media.controls=!0),t.autoplay&&(this.media.autoplay=!0),t.playbackRate!=null&&this.onMediaEvent("canplay",()=>{t.playbackRate!=null&&(this.media.playbackRate=t.playbackRate)},{once:!0})}onMediaEvent(t,e,i){return this.media.addEventListener(t,e,i),()=>this.media.removeEventListener(t,e,i)}getSrc(){return this.media.currentSrc||this.media.src||""}revokeSrc(){const t=this.getSrc();t.startsWith("blob:")&&URL.revokeObjectURL(t)}canPlayType(t){return this.media.canPlayType(t)!==""}setSrc(t,e){const i=this.getSrc();if(t&&i===t)return;this.revokeSrc();const n=e instanceof Blob&&(this.canPlayType(e.type)||!t)?URL.createObjectURL(e):t;if(i&&this.media.removeAttribute("src"),n||t)try{this.media.src=n}catch{this.media.src=t}}destroy(){this.isExternalMedia||(this.media.pause(),this.media.remove(),this.revokeSrc(),this.media.removeAttribute("src"),this.media.load())}setMediaElement(t){this.media=t}play(){return P(this,void 0,void 0,function*(){return this.media.play()})}pause(){this.media.pause()}isPlaying(){return!this.media.paused&&!this.media.ended}setTime(t){this.media.currentTime=Math.max(0,Math.min(t,this.getDuration()))}getDuration(){return this.media.duration}getCurrentTime(){return this.media.currentTime}getVolume(){return this.media.volume}setVolume(t){this.media.volume=t}getMuted(){return this.media.muted}setMuted(t){this.media.muted=t}getPlaybackRate(){return this.media.playbackRate}isSeeking(){return this.media.seeking}setPlaybackRate(t,e){e!=null&&(this.media.preservesPitch=e),this.media.playbackRate=t}getMediaElement(){return this.media}setSinkId(t){return this.media.setSinkId(t)}}class U extends V{constructor(t,e){super(),this.timeouts=[],this.isScrollable=!1,this.audioData=null,this.resizeObserver=null,this.lastContainerWidth=0,this.isDragging=!1,this.subscriptions=[],this.unsubscribeOnScroll=[],this.subscriptions=[],this.options=t;const i=this.parentFromOptionsContainer(t.container);this.parent=i;const[n,r]=this.initHtml();i.appendChild(n),this.container=n,this.scrollContainer=r.querySelector(".scroll"),this.wrapper=r.querySelector(".wrapper"),this.canvasWrapper=r.querySelector(".canvases"),this.progressWrapper=r.querySelector(".progress"),this.cursor=r.querySelector(".cursor"),e&&r.appendChild(e),this.initEvents()}parentFromOptionsContainer(t){let e;if(typeof t=="string"?e=document.querySelector(t):t instanceof HTMLElement&&(e=t),!e)throw new Error("Container not found");return e}initEvents(){const t=e=>{const i=this.wrapper.getBoundingClientRect(),n=e.clientX-i.left,r=e.clientY-i.top;return[n/i.width,r/i.height]};if(this.wrapper.addEventListener("click",e=>{const[i,n]=t(e);this.emit("click",i,n)}),this.wrapper.addEventListener("dblclick",e=>{const[i,n]=t(e);this.emit("dblclick",i,n)}),this.options.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.scrollContainer.addEventListener("scroll",()=>{const{scrollLeft:e,scrollWidth:i,clientWidth:n}=this.scrollContainer,r=e/i,o=(e+n)/i;this.emit("scroll",r,o,e,e+n)}),typeof ResizeObserver=="function"){const e=this.createDelay(100);this.resizeObserver=new ResizeObserver(()=>{e().then(()=>this.onContainerResize()).catch(()=>{})}),this.resizeObserver.observe(this.scrollContainer)}}onContainerResize(){const t=this.parent.clientWidth;t===this.lastContainerWidth&&this.options.height!=="auto"||(this.lastContainerWidth=t,this.reRender())}initDrag(){this.subscriptions.push(function(t,e,i,n,r=3,o=0,a=100){if(!t)return()=>{};const d=matchMedia("(pointer: coarse)").matches;let c=()=>{};const l=p=>{if(p.button!==o)return;p.preventDefault(),p.stopPropagation();let u=p.clientX,m=p.clientY,f=!1;const y=Date.now(),g=w=>{if(w.preventDefault(),w.stopPropagation(),d&&Date.now()-y<a)return;const T=w.clientX,D=w.clientY,k=T-u,W=D-m;if(f||Math.abs(k)>r||Math.abs(W)>r){const O=t.getBoundingClientRect(),{left:F,top:L}=O;f||(i?.(u-F,m-L),f=!0),e(k,W,T-F,D-L),u=T,m=D}},S=w=>{if(f){const T=w.clientX,D=w.clientY,k=t.getBoundingClientRect(),{left:W,top:O}=k;n?.(T-W,D-O)}c()},b=w=>{w.relatedTarget&&w.relatedTarget!==document.documentElement||S(w)},A=w=>{f&&(w.stopPropagation(),w.preventDefault())},R=w=>{f&&w.preventDefault()};document.addEventListener("pointermove",g),document.addEventListener("pointerup",S),document.addEventListener("pointerout",b),document.addEventListener("pointercancel",b),document.addEventListener("touchmove",R,{passive:!1}),document.addEventListener("click",A,{capture:!0}),c=()=>{document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",S),document.removeEventListener("pointerout",b),document.removeEventListener("pointercancel",b),document.removeEventListener("touchmove",R),setTimeout(()=>{document.removeEventListener("click",A,{capture:!0})},10)}};return t.addEventListener("pointerdown",l),()=>{c(),t.removeEventListener("pointerdown",l)}}(this.wrapper,(t,e,i)=>{this.emit("drag",Math.max(0,Math.min(1,i/this.wrapper.getBoundingClientRect().width)))},t=>{this.isDragging=!0,this.emit("dragstart",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))},t=>{this.isDragging=!1,this.emit("dragend",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))}))}getHeight(t,e){var i;const n=((i=this.audioData)===null||i===void 0?void 0:i.numberOfChannels)||1;if(t==null)return 128;if(!isNaN(Number(t)))return Number(t);if(t==="auto"){const r=this.parent.clientHeight||128;return e?.every(o=>!o.overlay)?r/n:r}return 128}initHtml(){const t=document.createElement("div"),e=t.attachShadow({mode:"open"}),i=this.options.cspNonce&&typeof this.options.cspNonce=="string"?this.options.cspNonce.replace(/"/g,""):"";return e.innerHTML=`
1
+ import{r as h,E as $,_ as H,ba as ut,bj as zt,bk as _t,bl as $t,M as X,O as q,aI as Ht,s as D,bm as Vt,C as N,j as v,bn as jt,b4 as Gt,bo as Xt,bp as qt,l as Yt,z as Kt,bq as tt,H as Jt,aE as Qt,br as Zt,bs as te,b9 as ee,bt as ie}from"./index.SCzIN5SB.js";import{u as se,F as ne}from"./FormClearHelper.BapTKtHM.js";import{T as re,a as pt}from"./Toolbar.DoQICZLn.js";import{u as oe}from"./Hooks.DQUBTvpJ.js";import{c as ae}from"./createDownloadLinkElement.DZMwyjvU.js";import{F as le,D as ce}from"./FileDownload.esm.qBSGbtBF.js";var vt=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),h.createElement("g",{fill:"none"},h.createElement("rect",{width:24,height:24}),h.createElement("rect",{width:24,height:24}),h.createElement("rect",{width:24,height:24})),h.createElement("path",{d:"M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"}),h.createElement("path",{d:"M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"}))});vt.displayName="Mic";var yt=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),h.createElement("rect",{width:24,height:24,fill:"none"}),h.createElement("path",{d:"M8 19c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2v10c0 1.1.9 2 2 2zm6-12v10c0 1.1.9 2 2 2s2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2z"}))});yt.displayName="Pause";var bt=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),h.createElement("rect",{width:24,height:24,fill:"none"}),h.createElement("path",{d:"M8 6.82v10.36c0 .79.87 1.27 1.54.84l8.14-5.18a1 1 0 000-1.69L9.54 5.98A.998.998 0 008 6.82z"}))});bt.displayName="PlayArrow";var wt=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),h.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),h.createElement("path",{d:"M17.65 6.35a7.95 7.95 0 00-6.48-2.31c-3.67.37-6.69 3.35-7.1 7.02C3.52 15.91 7.27 20 12 20a7.98 7.98 0 007.21-4.56c.32-.67-.16-1.44-.9-1.44-.37 0-.72.2-.88.53a5.994 5.994 0 01-6.8 3.31c-2.22-.49-4.01-2.3-4.48-4.52A6.002 6.002 0 0112 6c1.66 0 3.14.69 4.22 1.78l-1.51 1.51c-.63.63-.19 1.71.7 1.71H19c.55 0 1-.45 1-1V6.41c0-.89-1.08-1.34-1.71-.71l-.64.65z"}))});wt.displayName="Refresh";var St=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),h.createElement("g",{fill:"none"},h.createElement("rect",{width:24,height:24}),h.createElement("rect",{width:24,height:24})),h.createElement("path",{fillRule:"evenodd",d:"M9 16h6c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1H9c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1zm3-14C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z"}))});St.displayName="StopCircle";function P(s,t,e,i){return new(e||(e=Promise))(function(n,r){function o(c){try{d(i.next(c))}catch(l){r(l)}}function a(c){try{d(i.throw(c))}catch(l){r(l)}}function d(c){var l;c.done?n(c.value):(l=c.value,l instanceof e?l:new e(function(p){p(l)})).then(o,a)}d((i=i.apply(s,t||[])).next())})}let V=class{constructor(){this.listeners={}}on(t,e,i){if(this.listeners[t]||(this.listeners[t]=new Set),this.listeners[t].add(e),i?.once){const n=()=>{this.un(t,n),this.un(t,e)};return this.on(t,n),n}return()=>this.un(t,e)}un(t,e){var i;(i=this.listeners[t])===null||i===void 0||i.delete(e)}once(t,e){return this.on(t,e,{once:!0})}unAll(){this.listeners={}}emit(t,...e){this.listeners[t]&&this.listeners[t].forEach(i=>i(...e))}};const j={decode:function(s,t){return P(this,void 0,void 0,function*(){const e=new AudioContext({sampleRate:t});return e.decodeAudioData(s).finally(()=>e.close())})},createBuffer:function(s,t){return typeof s[0]=="number"&&(s=[s]),function(e){const i=e[0];if(i.some(n=>n>1||n<-1)){const n=i.length;let r=0;for(let o=0;o<n;o++){const a=Math.abs(i[o]);a>r&&(r=a)}for(const o of e)for(let a=0;a<n;a++)o[a]/=r}}(s),{duration:t,length:s[0].length,sampleRate:s[0].length/t,numberOfChannels:s.length,getChannelData:e=>s?.[e],copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};function Ct(s,t){const e=t.xmlns?document.createElementNS(t.xmlns,s):document.createElement(s);for(const[i,n]of Object.entries(t))if(i==="children"&&n)for(const[r,o]of Object.entries(n))o instanceof Node?e.appendChild(o):typeof o=="string"?e.appendChild(document.createTextNode(o)):e.appendChild(Ct(r,o));else i==="style"?Object.assign(e.style,n):i==="textContent"?e.textContent=n:e.setAttribute(i,n.toString());return e}function mt(s,t,e){const i=Ct(s,t||{});return e?.appendChild(i),i}var de=Object.freeze({__proto__:null,createElement:mt,default:mt});const he={fetchBlob:function(s,t,e){return P(this,void 0,void 0,function*(){const i=yield fetch(s,e);if(i.status>=400)throw new Error(`Failed to fetch ${s}: ${i.status} (${i.statusText})`);return function(n,r){P(this,void 0,void 0,function*(){if(!n.body||!n.headers)return;const o=n.body.getReader(),a=Number(n.headers.get("Content-Length"))||0;let d=0;const c=p=>P(this,void 0,void 0,function*(){d+=p?.length||0;const u=Math.round(d/a*100);r(u)}),l=()=>P(this,void 0,void 0,function*(){let p;try{p=yield o.read()}catch{return}p.done||(c(p.value),yield l())});l()})}(i.clone(),t),i.blob()})}};class ue extends V{constructor(t){super(),this.isExternalMedia=!1,t.media?(this.media=t.media,this.isExternalMedia=!0):this.media=document.createElement("audio"),t.mediaControls&&(this.media.controls=!0),t.autoplay&&(this.media.autoplay=!0),t.playbackRate!=null&&this.onMediaEvent("canplay",()=>{t.playbackRate!=null&&(this.media.playbackRate=t.playbackRate)},{once:!0})}onMediaEvent(t,e,i){return this.media.addEventListener(t,e,i),()=>this.media.removeEventListener(t,e,i)}getSrc(){return this.media.currentSrc||this.media.src||""}revokeSrc(){const t=this.getSrc();t.startsWith("blob:")&&URL.revokeObjectURL(t)}canPlayType(t){return this.media.canPlayType(t)!==""}setSrc(t,e){const i=this.getSrc();if(t&&i===t)return;this.revokeSrc();const n=e instanceof Blob&&(this.canPlayType(e.type)||!t)?URL.createObjectURL(e):t;if(i&&this.media.removeAttribute("src"),n||t)try{this.media.src=n}catch{this.media.src=t}}destroy(){this.isExternalMedia||(this.media.pause(),this.media.remove(),this.revokeSrc(),this.media.removeAttribute("src"),this.media.load())}setMediaElement(t){this.media=t}play(){return P(this,void 0,void 0,function*(){return this.media.play()})}pause(){this.media.pause()}isPlaying(){return!this.media.paused&&!this.media.ended}setTime(t){this.media.currentTime=Math.max(0,Math.min(t,this.getDuration()))}getDuration(){return this.media.duration}getCurrentTime(){return this.media.currentTime}getVolume(){return this.media.volume}setVolume(t){this.media.volume=t}getMuted(){return this.media.muted}setMuted(t){this.media.muted=t}getPlaybackRate(){return this.media.playbackRate}isSeeking(){return this.media.seeking}setPlaybackRate(t,e){e!=null&&(this.media.preservesPitch=e),this.media.playbackRate=t}getMediaElement(){return this.media}setSinkId(t){return this.media.setSinkId(t)}}class U extends V{constructor(t,e){super(),this.timeouts=[],this.isScrollable=!1,this.audioData=null,this.resizeObserver=null,this.lastContainerWidth=0,this.isDragging=!1,this.subscriptions=[],this.unsubscribeOnScroll=[],this.subscriptions=[],this.options=t;const i=this.parentFromOptionsContainer(t.container);this.parent=i;const[n,r]=this.initHtml();i.appendChild(n),this.container=n,this.scrollContainer=r.querySelector(".scroll"),this.wrapper=r.querySelector(".wrapper"),this.canvasWrapper=r.querySelector(".canvases"),this.progressWrapper=r.querySelector(".progress"),this.cursor=r.querySelector(".cursor"),e&&r.appendChild(e),this.initEvents()}parentFromOptionsContainer(t){let e;if(typeof t=="string"?e=document.querySelector(t):t instanceof HTMLElement&&(e=t),!e)throw new Error("Container not found");return e}initEvents(){const t=e=>{const i=this.wrapper.getBoundingClientRect(),n=e.clientX-i.left,r=e.clientY-i.top;return[n/i.width,r/i.height]};if(this.wrapper.addEventListener("click",e=>{const[i,n]=t(e);this.emit("click",i,n)}),this.wrapper.addEventListener("dblclick",e=>{const[i,n]=t(e);this.emit("dblclick",i,n)}),this.options.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.scrollContainer.addEventListener("scroll",()=>{const{scrollLeft:e,scrollWidth:i,clientWidth:n}=this.scrollContainer,r=e/i,o=(e+n)/i;this.emit("scroll",r,o,e,e+n)}),typeof ResizeObserver=="function"){const e=this.createDelay(100);this.resizeObserver=new ResizeObserver(()=>{e().then(()=>this.onContainerResize()).catch(()=>{})}),this.resizeObserver.observe(this.scrollContainer)}}onContainerResize(){const t=this.parent.clientWidth;t===this.lastContainerWidth&&this.options.height!=="auto"||(this.lastContainerWidth=t,this.reRender())}initDrag(){this.subscriptions.push(function(t,e,i,n,r=3,o=0,a=100){if(!t)return()=>{};const d=matchMedia("(pointer: coarse)").matches;let c=()=>{};const l=p=>{if(p.button!==o)return;p.preventDefault(),p.stopPropagation();let u=p.clientX,m=p.clientY,f=!1;const b=Date.now(),g=w=>{if(w.preventDefault(),w.stopPropagation(),d&&Date.now()-b<a)return;const A=w.clientX,T=w.clientY,k=A-u,W=T-m;if(f||Math.abs(k)>r||Math.abs(W)>r){const O=t.getBoundingClientRect(),{left:F,top:L}=O;f||(i?.(u-F,m-L),f=!0),e(k,W,A-F,T-L),u=A,m=T}},S=w=>{if(f){const A=w.clientX,T=w.clientY,k=t.getBoundingClientRect(),{left:W,top:O}=k;n?.(A-W,T-O)}c()},y=w=>{w.relatedTarget&&w.relatedTarget!==document.documentElement||S(w)},x=w=>{f&&(w.stopPropagation(),w.preventDefault())},R=w=>{f&&w.preventDefault()};document.addEventListener("pointermove",g),document.addEventListener("pointerup",S),document.addEventListener("pointerout",y),document.addEventListener("pointercancel",y),document.addEventListener("touchmove",R,{passive:!1}),document.addEventListener("click",x,{capture:!0}),c=()=>{document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",S),document.removeEventListener("pointerout",y),document.removeEventListener("pointercancel",y),document.removeEventListener("touchmove",R),setTimeout(()=>{document.removeEventListener("click",x,{capture:!0})},10)}};return t.addEventListener("pointerdown",l),()=>{c(),t.removeEventListener("pointerdown",l)}}(this.wrapper,(t,e,i)=>{this.emit("drag",Math.max(0,Math.min(1,i/this.wrapper.getBoundingClientRect().width)))},t=>{this.isDragging=!0,this.emit("dragstart",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))},t=>{this.isDragging=!1,this.emit("dragend",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))}))}getHeight(t,e){var i;const n=((i=this.audioData)===null||i===void 0?void 0:i.numberOfChannels)||1;if(t==null)return 128;if(!isNaN(Number(t)))return Number(t);if(t==="auto"){const r=this.parent.clientHeight||128;return e?.every(o=>!o.overlay)?r/n:r}return 128}initHtml(){const t=document.createElement("div"),e=t.attachShadow({mode:"open"}),i=this.options.cspNonce&&typeof this.options.cspNonce=="string"?this.options.cspNonce.replace(/"/g,""):"";return e.innerHTML=`
2
2
  <style${i?` nonce="${i}"`:""}>
3
3
  :host {
4
4
  user-select: none;
@@ -70,4 +70,4 @@ import{r as h,E as $,_ as H,ba as ut,bj as zt,bk as _t,bl as $t,M as X,O as q,aI
70
70
  <div class="cursor" part="cursor"></div>
71
71
  </div>
72
72
  </div>
73
- `,[t,e]}setOptions(t){if(this.options.container!==t.container){const e=this.parentFromOptionsContainer(t.container);e.appendChild(this.container),this.parent=e}t.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.options=t,this.reRender()}getWrapper(){return this.wrapper}getWidth(){return this.scrollContainer.clientWidth}getScroll(){return this.scrollContainer.scrollLeft}setScroll(t){this.scrollContainer.scrollLeft=t}setScrollPercentage(t){const{scrollWidth:e}=this.scrollContainer,i=e*t;this.setScroll(i)}destroy(){var t,e;this.subscriptions.forEach(i=>i()),this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(e=this.unsubscribeOnScroll)===null||e===void 0||e.forEach(i=>i()),this.unsubscribeOnScroll=[]}createDelay(t=10){let e,i;const n=()=>{e&&clearTimeout(e),i&&i()};return this.timeouts.push(n),()=>new Promise((r,o)=>{n(),i=o,e=setTimeout(()=>{e=void 0,i=void 0,r()},t)})}convertColorValues(t){if(!Array.isArray(t))return t||"";if(t.length<2)return t[0]||"";const e=document.createElement("canvas"),i=e.getContext("2d"),n=e.height*(window.devicePixelRatio||1),r=i.createLinearGradient(0,0,0,n),o=1/(t.length-1);return t.forEach((a,d)=>{const c=d*o;r.addColorStop(c,a)}),r}getPixelRatio(){return Math.max(1,window.devicePixelRatio||1)}renderBarWaveform(t,e,i,n){const r=t[0],o=t[1]||t[0],a=r.length,{width:d,height:c}=i.canvas,l=c/2,p=this.getPixelRatio(),u=e.barWidth?e.barWidth*p:1,m=e.barGap?e.barGap*p:e.barWidth?u/2:0,f=e.barRadius||0,y=d/(u+m)/a,g=f&&"roundRect"in i?"roundRect":"rect";i.beginPath();let S=0,b=0,A=0;for(let R=0;R<=a;R++){const w=Math.round(R*y);if(w>S){const k=Math.round(b*l*n),W=k+Math.round(A*l*n)||1;let O=l-k;e.barAlign==="top"?O=0:e.barAlign==="bottom"&&(O=c-W),i[g](S*(u+m),O,u,W,f),S=w,b=0,A=0}const T=Math.abs(r[R]||0),D=Math.abs(o[R]||0);T>b&&(b=T),D>A&&(A=D)}i.fill(),i.closePath()}renderLineWaveform(t,e,i,n){const r=o=>{const a=t[o]||t[0],d=a.length,{height:c}=i.canvas,l=c/2,p=i.canvas.width/d;i.moveTo(0,l);let u=0,m=0;for(let f=0;f<=d;f++){const y=Math.round(f*p);if(y>u){const S=l+(Math.round(m*l*n)||1)*(o===0?-1:1);i.lineTo(u,S),u=y,m=0}const g=Math.abs(a[f]||0);g>m&&(m=g)}i.lineTo(u,l)};i.beginPath(),r(0),r(1),i.fill(),i.closePath()}renderWaveform(t,e,i){if(i.fillStyle=this.convertColorValues(e.waveColor),e.renderFunction)return void e.renderFunction(t,i);let n=e.barHeight||1;if(e.normalize){const r=Array.from(t[0]).reduce((o,a)=>Math.max(o,Math.abs(a)),0);n=r?1/r:1}e.barWidth||e.barGap||e.barAlign?this.renderBarWaveform(t,e,i,n):this.renderLineWaveform(t,e,i,n)}renderSingleCanvas(t,e,i,n,r,o,a){const d=this.getPixelRatio(),c=document.createElement("canvas");c.width=Math.round(i*d),c.height=Math.round(n*d),c.style.width=`${i}px`,c.style.height=`${n}px`,c.style.left=`${Math.round(r)}px`,o.appendChild(c);const l=c.getContext("2d");if(this.renderWaveform(t,e,l),c.width>0&&c.height>0){const p=c.cloneNode(),u=p.getContext("2d");u.drawImage(c,0,0),u.globalCompositeOperation="source-in",u.fillStyle=this.convertColorValues(e.progressColor),u.fillRect(0,0,c.width,c.height),a.appendChild(p)}}renderMultiCanvas(t,e,i,n,r,o){const a=this.getPixelRatio(),{clientWidth:d}=this.scrollContainer,c=i/a;let l=Math.min(U.MAX_CANVAS_WIDTH,d,c),p={};if(e.barWidth||e.barGap){const g=e.barWidth||.5,S=g+(e.barGap||g/2);l%S!=0&&(l=Math.floor(l/S)*S)}if(l===0)return;const u=g=>{if(g<0||g>=m||p[g])return;p[g]=!0;const S=g*l;let b=Math.min(c-S,l);if(e.barWidth||e.barGap){const R=e.barWidth||.5,w=R+(e.barGap||R/2);b=Math.floor(b/w)*w}if(b<=0)return;const A=t.map(R=>{const w=Math.floor(S/c*R.length),T=Math.floor((S+b)/c*R.length);return R.slice(w,T)});this.renderSingleCanvas(A,e,b,n,S,r,o)},m=Math.ceil(c/l);if(!this.isScrollable){for(let g=0;g<m;g++)u(g);return}const f=this.scrollContainer.scrollLeft/c,y=Math.floor(f*m);if(u(y-1),u(y),u(y+1),m>1){const g=this.on("scroll",()=>{const{scrollLeft:S}=this.scrollContainer,b=Math.floor(S/c*m);Object.keys(p).length>U.MAX_NODES&&(r.innerHTML="",o.innerHTML="",p={}),u(b-1),u(b),u(b+1)});this.unsubscribeOnScroll.push(g)}}renderChannel(t,e,i,n){var{overlay:r}=e,o=function(l,p){var u={};for(var m in l)Object.prototype.hasOwnProperty.call(l,m)&&p.indexOf(m)<0&&(u[m]=l[m]);if(l!=null&&typeof Object.getOwnPropertySymbols=="function"){var f=0;for(m=Object.getOwnPropertySymbols(l);f<m.length;f++)p.indexOf(m[f])<0&&Object.prototype.propertyIsEnumerable.call(l,m[f])&&(u[m[f]]=l[m[f]])}return u}(e,["overlay"]);const a=document.createElement("div"),d=this.getHeight(o.height,o.splitChannels);a.style.height=`${d}px`,r&&n>0&&(a.style.marginTop=`-${d}px`),this.canvasWrapper.style.minHeight=`${d}px`,this.canvasWrapper.appendChild(a);const c=a.cloneNode();this.progressWrapper.appendChild(c),this.renderMultiCanvas(t,o,i,d,a,c)}render(t){return P(this,void 0,void 0,function*(){var e;this.timeouts.forEach(d=>d()),this.timeouts=[],this.canvasWrapper.innerHTML="",this.progressWrapper.innerHTML="",this.options.width!=null&&(this.scrollContainer.style.width=typeof this.options.width=="number"?`${this.options.width}px`:this.options.width);const i=this.getPixelRatio(),n=this.scrollContainer.clientWidth,r=Math.ceil(t.duration*(this.options.minPxPerSec||0));this.isScrollable=r>n;const o=this.options.fillParent&&!this.isScrollable,a=(o?n:r)*i;if(this.wrapper.style.width=o?"100%":`${r}px`,this.scrollContainer.style.overflowX=this.isScrollable?"auto":"hidden",this.scrollContainer.classList.toggle("noScrollbar",!!this.options.hideScrollbar),this.cursor.style.backgroundColor=`${this.options.cursorColor||this.options.progressColor}`,this.cursor.style.width=`${this.options.cursorWidth}px`,this.audioData=t,this.emit("render"),this.options.splitChannels)for(let d=0;d<t.numberOfChannels;d++){const c=Object.assign(Object.assign({},this.options),(e=this.options.splitChannels)===null||e===void 0?void 0:e[d]);this.renderChannel([t.getChannelData(d)],c,a,d)}else{const d=[t.getChannelData(0)];t.numberOfChannels>1&&d.push(t.getChannelData(1)),this.renderChannel(d,this.options,a,0)}Promise.resolve().then(()=>this.emit("rendered"))})}reRender(){if(this.unsubscribeOnScroll.forEach(i=>i()),this.unsubscribeOnScroll=[],!this.audioData)return;const{scrollWidth:t}=this.scrollContainer,{right:e}=this.progressWrapper.getBoundingClientRect();if(this.render(this.audioData),this.isScrollable&&t!==this.scrollContainer.scrollWidth){const{right:i}=this.progressWrapper.getBoundingClientRect();let n=i-e;n*=2,n=n<0?Math.floor(n):Math.ceil(n),n/=2,this.scrollContainer.scrollLeft+=n}}zoom(t){this.options.minPxPerSec=t,this.reRender()}scrollIntoView(t,e=!1){const{scrollLeft:i,scrollWidth:n,clientWidth:r}=this.scrollContainer,o=t*n,a=i,d=i+r,c=r/2;if(this.isDragging)o+30>d?this.scrollContainer.scrollLeft+=30:o-30<a&&(this.scrollContainer.scrollLeft-=30);else{(o<a||o>d)&&(this.scrollContainer.scrollLeft=o-(this.options.autoCenter?c:0));const l=o-i-c;e&&this.options.autoCenter&&l>0&&(this.scrollContainer.scrollLeft+=Math.min(l,10))}{const l=this.scrollContainer.scrollLeft,p=l/n,u=(l+r)/n;this.emit("scroll",p,u,l,l+r)}}renderProgress(t,e){if(isNaN(t))return;const i=100*t;this.canvasWrapper.style.clipPath=`polygon(${i}% 0%, 100% 0%, 100% 100%, ${i}% 100%)`,this.progressWrapper.style.width=`${i}%`,this.cursor.style.left=`${i}%`,this.cursor.style.transform=`translateX(-${Math.round(i)===100?this.options.cursorWidth:0}px)`,this.isScrollable&&this.options.autoScroll&&this.scrollIntoView(t,e)}exportImage(t,e,i){return P(this,void 0,void 0,function*(){const n=this.canvasWrapper.querySelectorAll("canvas");if(!n.length)throw new Error("No waveform data");if(i==="dataURL"){const r=Array.from(n).map(o=>o.toDataURL(t,e));return Promise.resolve(r)}return Promise.all(Array.from(n).map(r=>new Promise((o,a)=>{r.toBlob(d=>{d?o(d):a(new Error("Could not export image"))},t,e)})))})}}U.MAX_CANVAS_WIDTH=8e3,U.MAX_NODES=10;class pe extends V{constructor(){super(...arguments),this.unsubscribe=()=>{}}start(){this.unsubscribe=this.on("tick",()=>{requestAnimationFrame(()=>{this.emit("tick")})}),this.emit("tick")}stop(){this.unsubscribe()}destroy(){this.unsubscribe()}}class et extends V{constructor(t=new AudioContext){super(),this.bufferNode=null,this.playStartTime=0,this.playedDuration=0,this._muted=!1,this._playbackRate=1,this._duration=void 0,this.buffer=null,this.currentSrc="",this.paused=!0,this.crossOrigin=null,this.seeking=!1,this.autoplay=!1,this.addEventListener=this.on,this.removeEventListener=this.un,this.audioContext=t,this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioContext.destination)}load(){return P(this,void 0,void 0,function*(){})}get src(){return this.currentSrc}set src(t){if(this.currentSrc=t,this._duration=void 0,!t)return this.buffer=null,void this.emit("emptied");fetch(t).then(e=>{if(e.status>=400)throw new Error(`Failed to fetch ${t}: ${e.status} (${e.statusText})`);return e.arrayBuffer()}).then(e=>this.currentSrc!==t?null:this.audioContext.decodeAudioData(e)).then(e=>{this.currentSrc===t&&(this.buffer=e,this.emit("loadedmetadata"),this.emit("canplay"),this.autoplay&&this.play())})}_play(){var t;if(!this.paused)return;this.paused=!1,(t=this.bufferNode)===null||t===void 0||t.disconnect(),this.bufferNode=this.audioContext.createBufferSource(),this.buffer&&(this.bufferNode.buffer=this.buffer),this.bufferNode.playbackRate.value=this._playbackRate,this.bufferNode.connect(this.gainNode);let e=this.playedDuration*this._playbackRate;(e>=this.duration||e<0)&&(e=0,this.playedDuration=0),this.bufferNode.start(this.audioContext.currentTime,e),this.playStartTime=this.audioContext.currentTime,this.bufferNode.onended=()=>{this.currentTime>=this.duration&&(this.pause(),this.emit("ended"))}}_pause(){var t;this.paused=!0,(t=this.bufferNode)===null||t===void 0||t.stop(),this.playedDuration+=this.audioContext.currentTime-this.playStartTime}play(){return P(this,void 0,void 0,function*(){this.paused&&(this._play(),this.emit("play"))})}pause(){this.paused||(this._pause(),this.emit("pause"))}stopAt(t){const e=t-this.currentTime,i=this.bufferNode;i?.stop(this.audioContext.currentTime+e),i?.addEventListener("ended",()=>{i===this.bufferNode&&(this.bufferNode=null,this.pause())},{once:!0})}setSinkId(t){return P(this,void 0,void 0,function*(){return this.audioContext.setSinkId(t)})}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this.bufferNode&&(this.bufferNode.playbackRate.value=t)}get currentTime(){return(this.paused?this.playedDuration:this.playedDuration+(this.audioContext.currentTime-this.playStartTime))*this._playbackRate}set currentTime(t){const e=!this.paused;e&&this._pause(),this.playedDuration=t/this._playbackRate,e&&this._play(),this.emit("seeking"),this.emit("timeupdate")}get duration(){var t,e;return(t=this._duration)!==null&&t!==void 0?t:((e=this.buffer)===null||e===void 0?void 0:e.duration)||0}set duration(t){this._duration=t}get volume(){return this.gainNode.gain.value}set volume(t){this.gainNode.gain.value=t,this.emit("volumechange")}get muted(){return this._muted}set muted(t){this._muted!==t&&(this._muted=t,this._muted?this.gainNode.disconnect():this.gainNode.connect(this.audioContext.destination))}canPlayType(t){return/^(audio|video)\//.test(t)}getGainNode(){return this.gainNode}getChannelData(){const t=[];if(!this.buffer)return t;const e=this.buffer.numberOfChannels;for(let i=0;i<e;i++)t.push(this.buffer.getChannelData(i));return t}}const me={waveColor:"#999",progressColor:"#555",cursorWidth:1,minPxPerSec:0,fillParent:!0,interact:!0,dragToSeek:!1,autoScroll:!0,autoCenter:!0,sampleRate:8e3};class z extends ue{static create(t){return new z(t)}constructor(t){const e=t.media||(t.backend==="WebAudio"?new et:void 0);super({media:e,mediaControls:t.mediaControls,autoplay:t.autoplay,playbackRate:t.audioRate}),this.plugins=[],this.decodedData=null,this.stopAtPosition=null,this.subscriptions=[],this.mediaSubscriptions=[],this.abortController=null,this.options=Object.assign({},me,t),this.timer=new pe;const i=e?void 0:this.getMediaElement();this.renderer=new U(this.options,i),this.initPlayerEvents(),this.initRendererEvents(),this.initTimerEvents(),this.initPlugins();const n=this.options.url||this.getSrc()||"";Promise.resolve().then(()=>{this.emit("init");const{peaks:r,duration:o}=this.options;(n||r&&o)&&this.load(n,r,o).catch(()=>null)})}updateProgress(t=this.getCurrentTime()){return this.renderer.renderProgress(t/this.getDuration(),this.isPlaying()),t}initTimerEvents(){this.subscriptions.push(this.timer.on("tick",()=>{if(!this.isSeeking()){const t=this.updateProgress();this.emit("timeupdate",t),this.emit("audioprocess",t),this.stopAtPosition!=null&&this.isPlaying()&&t>=this.stopAtPosition&&this.pause()}}))}initPlayerEvents(){this.isPlaying()&&(this.emit("play"),this.timer.start()),this.mediaSubscriptions.push(this.onMediaEvent("timeupdate",()=>{const t=this.updateProgress();this.emit("timeupdate",t)}),this.onMediaEvent("play",()=>{this.emit("play"),this.timer.start()}),this.onMediaEvent("pause",()=>{this.emit("pause"),this.timer.stop(),this.stopAtPosition=null}),this.onMediaEvent("emptied",()=>{this.timer.stop(),this.stopAtPosition=null}),this.onMediaEvent("ended",()=>{this.emit("timeupdate",this.getDuration()),this.emit("finish"),this.stopAtPosition=null}),this.onMediaEvent("seeking",()=>{this.emit("seeking",this.getCurrentTime())}),this.onMediaEvent("error",()=>{var t;this.emit("error",(t=this.getMediaElement().error)!==null&&t!==void 0?t:new Error("Media error")),this.stopAtPosition=null}))}initRendererEvents(){this.subscriptions.push(this.renderer.on("click",(t,e)=>{this.options.interact&&(this.seekTo(t),this.emit("interaction",t*this.getDuration()),this.emit("click",t,e))}),this.renderer.on("dblclick",(t,e)=>{this.emit("dblclick",t,e)}),this.renderer.on("scroll",(t,e,i,n)=>{const r=this.getDuration();this.emit("scroll",t*r,e*r,i,n)}),this.renderer.on("render",()=>{this.emit("redraw")}),this.renderer.on("rendered",()=>{this.emit("redrawcomplete")}),this.renderer.on("dragstart",t=>{this.emit("dragstart",t)}),this.renderer.on("dragend",t=>{this.emit("dragend",t)}));{let t;this.subscriptions.push(this.renderer.on("drag",e=>{if(!this.options.interact)return;let i;this.renderer.renderProgress(e),clearTimeout(t),this.isPlaying()?i=0:this.options.dragToSeek===!0?i=200:typeof this.options.dragToSeek=="object"&&this.options.dragToSeek!==void 0&&(i=this.options.dragToSeek.debounceTime),t=setTimeout(()=>{this.seekTo(e)},i),this.emit("interaction",e*this.getDuration()),this.emit("drag",e)}))}}initPlugins(){var t;!((t=this.options.plugins)===null||t===void 0)&&t.length&&this.options.plugins.forEach(e=>{this.registerPlugin(e)})}unsubscribePlayerEvents(){this.mediaSubscriptions.forEach(t=>t()),this.mediaSubscriptions=[]}setOptions(t){this.options=Object.assign({},this.options,t),t.duration&&!t.peaks&&(this.decodedData=j.createBuffer(this.exportPeaks(),t.duration)),t.peaks&&t.duration&&(this.decodedData=j.createBuffer(t.peaks,t.duration)),this.renderer.setOptions(this.options),t.audioRate&&this.setPlaybackRate(t.audioRate),t.mediaControls!=null&&(this.getMediaElement().controls=t.mediaControls)}registerPlugin(t){t._init(this),this.plugins.push(t);const e=t.once("destroy",()=>{this.plugins=this.plugins.filter(i=>i!==t),this.subscriptions=this.subscriptions.filter(i=>i!==e)});return this.subscriptions.push(e),t}getWrapper(){return this.renderer.getWrapper()}getWidth(){return this.renderer.getWidth()}getScroll(){return this.renderer.getScroll()}setScroll(t){return this.renderer.setScroll(t)}setScrollTime(t){const e=t/this.getDuration();this.renderer.setScrollPercentage(e)}getActivePlugins(){return this.plugins}loadAudio(t,e,i,n){return P(this,void 0,void 0,function*(){var r;if(this.emit("load",t),!this.options.media&&this.isPlaying()&&this.pause(),this.decodedData=null,this.stopAtPosition=null,!e&&!i){const a=this.options.fetchParams||{};window.AbortController&&!a.signal&&(this.abortController=new AbortController,a.signal=(r=this.abortController)===null||r===void 0?void 0:r.signal);const d=l=>this.emit("loading",l);e=yield he.fetchBlob(t,d,a);const c=this.options.blobMimeType;c&&(e=new Blob([e],{type:c}))}this.setSrc(t,e);const o=yield new Promise(a=>{const d=n||this.getDuration();d?a(d):this.mediaSubscriptions.push(this.onMediaEvent("loadedmetadata",()=>a(this.getDuration()),{once:!0}))});if(!t&&!e){const a=this.getMediaElement();a instanceof et&&(a.duration=o)}if(i)this.decodedData=j.createBuffer(i,o||0);else if(e){const a=yield e.arrayBuffer();this.decodedData=yield j.decode(a,this.options.sampleRate)}this.decodedData&&(this.emit("decode",this.getDuration()),this.renderer.render(this.decodedData)),this.emit("ready",this.getDuration())})}load(t,e,i){return P(this,void 0,void 0,function*(){try{return yield this.loadAudio(t,void 0,e,i)}catch(n){throw this.emit("error",n),n}})}loadBlob(t,e,i){return P(this,void 0,void 0,function*(){try{return yield this.loadAudio("",t,e,i)}catch(n){throw this.emit("error",n),n}})}zoom(t){if(!this.decodedData)throw new Error("No audio loaded");this.renderer.zoom(t),this.emit("zoom",t)}getDecodedData(){return this.decodedData}exportPeaks({channels:t=2,maxLength:e=8e3,precision:i=1e4}={}){if(!this.decodedData)throw new Error("The audio has not been decoded yet");const n=Math.min(t,this.decodedData.numberOfChannels),r=[];for(let o=0;o<n;o++){const a=this.decodedData.getChannelData(o),d=[],c=a.length/e;for(let l=0;l<e;l++){const p=a.slice(Math.floor(l*c),Math.ceil((l+1)*c));let u=0;for(let m=0;m<p.length;m++){const f=p[m];Math.abs(f)>Math.abs(u)&&(u=f)}d.push(Math.round(u*i)/i)}r.push(d)}return r}getDuration(){let t=super.getDuration()||0;return t!==0&&t!==1/0||!this.decodedData||(t=this.decodedData.duration),t}toggleInteraction(t){this.options.interact=t}setTime(t){this.stopAtPosition=null,super.setTime(t),this.updateProgress(t),this.emit("timeupdate",t)}seekTo(t){const e=this.getDuration()*t;this.setTime(e)}play(t,e){const i=Object.create(null,{play:{get:()=>super.play}});return P(this,void 0,void 0,function*(){t!=null&&this.setTime(t);const n=yield i.play.call(this);return e!=null&&(this.media instanceof et?this.media.stopAt(e):this.stopAtPosition=e),n})}playPause(){return P(this,void 0,void 0,function*(){return this.isPlaying()?this.pause():this.play()})}stop(){this.pause(),this.setTime(0)}skip(t){this.setTime(this.getCurrentTime()+t)}empty(){this.load("",[[0]],.001)}setMediaElement(t){this.unsubscribePlayerEvents(),super.setMediaElement(t),this.initPlayerEvents()}exportImage(){return P(this,arguments,void 0,function*(t="image/png",e=1,i="dataURL"){return this.renderer.exportImage(t,e,i)})}destroy(){var t;this.emit("destroy"),(t=this.abortController)===null||t===void 0||t.abort(),this.plugins.forEach(e=>e.destroy()),this.subscriptions.forEach(e=>e()),this.unsubscribePlayerEvents(),this.timer.destroy(),this.renderer.destroy(),super.destroy()}}z.BasePlugin=class extends V{constructor(s){super(),this.subscriptions=[],this.options=s}onInit(){}_init(s){this.wavesurfer=s,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach(s=>s())}},z.dom=de;function it(s,t,e,i){return new(e||(e=Promise))(function(n,r){function o(c){try{d(i.next(c))}catch(l){r(l)}}function a(c){try{d(i.throw(c))}catch(l){r(l)}}function d(c){var l;c.done?n(c.value):(l=c.value,l instanceof e?l:new e(function(p){p(l)})).then(o,a)}d((i=i.apply(s,[])).next())})}class Et{constructor(){this.listeners={}}on(t,e,i){if(this.listeners[t]||(this.listeners[t]=new Set),this.listeners[t].add(e),i?.once){const n=()=>{this.un(t,n),this.un(t,e)};return this.on(t,n),n}return()=>this.un(t,e)}un(t,e){var i;(i=this.listeners[t])===null||i===void 0||i.delete(e)}once(t,e){return this.on(t,e,{once:!0})}unAll(){this.listeners={}}emit(t,...e){this.listeners[t]&&this.listeners[t].forEach(i=>i(...e))}}class fe extends Et{constructor(t){super(),this.subscriptions=[],this.options=t}onInit(){}_init(t){this.wavesurfer=t,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach(t=>t())}}class ge extends Et{constructor(){super(...arguments),this.unsubscribe=()=>{}}start(){this.unsubscribe=this.on("tick",()=>{requestAnimationFrame(()=>{this.emit("tick")})}),this.emit("tick")}stop(){this.unsubscribe()}destroy(){this.unsubscribe()}}const ve=["audio/webm","audio/wav","audio/mpeg","audio/mp4","audio/mp3"];class Y extends fe{constructor(t){var e,i,n,r,o,a;super(Object.assign(Object.assign({},t),{audioBitsPerSecond:(e=t.audioBitsPerSecond)!==null&&e!==void 0?e:128e3,scrollingWaveform:(i=t.scrollingWaveform)!==null&&i!==void 0&&i,scrollingWaveformWindow:(n=t.scrollingWaveformWindow)!==null&&n!==void 0?n:5,continuousWaveform:(r=t.continuousWaveform)!==null&&r!==void 0&&r,renderRecordedAudio:(o=t.renderRecordedAudio)===null||o===void 0||o,mediaRecorderTimeslice:(a=t.mediaRecorderTimeslice)!==null&&a!==void 0?a:void 0})),this.stream=null,this.mediaRecorder=null,this.dataWindow=null,this.isWaveformPaused=!1,this.lastStartTime=0,this.lastDuration=0,this.duration=0,this.timer=new ge,this.subscriptions.push(this.timer.on("tick",()=>{const d=performance.now()-this.lastStartTime;this.duration=this.isPaused()?this.duration:this.lastDuration+d,this.emit("record-progress",this.duration)}))}static create(t){return new Y(t||{})}renderMicStream(t){var e;const i=new AudioContext,n=i.createMediaStreamSource(t),r=i.createAnalyser();n.connect(r),this.options.continuousWaveform&&(r.fftSize=32);const o=r.frequencyBinCount,a=new Float32Array(o);let d=0;this.wavesurfer&&((e=this.originalOptions)!==null&&e!==void 0||(this.originalOptions=Object.assign({},this.wavesurfer.options)),this.wavesurfer.options.interact=!1,this.options.scrollingWaveform&&(this.wavesurfer.options.cursorWidth=0));const c=setInterval(()=>{var l,p,u,m;if(!this.isWaveformPaused){if(r.getFloatTimeDomainData(a),this.options.scrollingWaveform){const f=Math.floor((this.options.scrollingWaveformWindow||0)*i.sampleRate),y=Math.min(f,this.dataWindow?this.dataWindow.length+o:o),g=new Float32Array(f);if(this.dataWindow){const S=Math.max(0,f-this.dataWindow.length);g.set(this.dataWindow.slice(-y+o),S)}g.set(a,f-o),this.dataWindow=g}else if(this.options.continuousWaveform){if(!this.dataWindow){const y=this.options.continuousWaveformDuration?Math.round(100*this.options.continuousWaveformDuration):((p=(l=this.wavesurfer)===null||l===void 0?void 0:l.getWidth())!==null&&p!==void 0?p:0)*window.devicePixelRatio;this.dataWindow=new Float32Array(y)}let f=0;for(let y=0;y<o;y++){const g=Math.abs(a[y]);g>f&&(f=g)}if(d+1>this.dataWindow.length){const y=new Float32Array(2*this.dataWindow.length);y.set(this.dataWindow,0),this.dataWindow=y}this.dataWindow[d]=f,d++}else this.dataWindow=a;if(this.wavesurfer){const f=((m=(u=this.dataWindow)===null||u===void 0?void 0:u.length)!==null&&m!==void 0?m:0)/100;this.wavesurfer.load("",[this.dataWindow],this.options.scrollingWaveform?this.options.scrollingWaveformWindow:f).then(()=>{this.wavesurfer&&this.options.continuousWaveform&&(this.wavesurfer.setTime(this.getDuration()/1e3),this.wavesurfer.options.minPxPerSec||this.wavesurfer.setOptions({minPxPerSec:this.wavesurfer.getWidth()/this.wavesurfer.getDuration()}))}).catch(y=>{console.error("Error rendering real-time recording data:",y)})}}},10);return{onDestroy:()=>{clearInterval(c),n?.disconnect(),i?.close()},onEnd:()=>{this.isWaveformPaused=!0,clearInterval(c),this.stopMic()}}}startMic(t){return it(this,void 0,void 0,function*(){let e;try{e=yield navigator.mediaDevices.getUserMedia({audio:t==null||t})}catch(r){throw new Error("Error accessing the microphone: "+r.message)}const{onDestroy:i,onEnd:n}=this.renderMicStream(e);return this.subscriptions.push(this.once("destroy",i)),this.subscriptions.push(this.once("record-end",n)),this.stream=e,e})}stopMic(){this.stream&&(this.stream.getTracks().forEach(t=>t.stop()),this.stream=null,this.mediaRecorder=null)}startRecording(t){return it(this,void 0,void 0,function*(){const e=this.stream||(yield this.startMic(t));this.dataWindow=null;const i=this.mediaRecorder||new MediaRecorder(e,{mimeType:this.options.mimeType||ve.find(o=>MediaRecorder.isTypeSupported(o)),audioBitsPerSecond:this.options.audioBitsPerSecond});this.mediaRecorder=i,this.stopRecording();const n=[];i.ondataavailable=o=>{o.data.size>0&&n.push(o.data),this.emit("record-data-available",o.data)};const r=o=>{var a;const d=new Blob(n,{type:i.mimeType});this.emit(o,d),this.options.renderRecordedAudio&&(this.applyOriginalOptionsIfNeeded(),(a=this.wavesurfer)===null||a===void 0||a.load(URL.createObjectURL(d)))};i.onpause=()=>r("record-pause"),i.onstop=()=>r("record-end"),i.start(this.options.mediaRecorderTimeslice),this.lastStartTime=performance.now(),this.lastDuration=0,this.duration=0,this.isWaveformPaused=!1,this.timer.start(),this.emit("record-start")})}getDuration(){return this.duration}isRecording(){var t;return((t=this.mediaRecorder)===null||t===void 0?void 0:t.state)==="recording"}isPaused(){var t;return((t=this.mediaRecorder)===null||t===void 0?void 0:t.state)==="paused"}isActive(){var t;return((t=this.mediaRecorder)===null||t===void 0?void 0:t.state)!=="inactive"}stopRecording(){var t;this.isActive()&&((t=this.mediaRecorder)===null||t===void 0||t.stop(),this.timer.stop())}pauseRecording(){var t,e;this.isRecording()&&(this.isWaveformPaused=!0,(t=this.mediaRecorder)===null||t===void 0||t.requestData(),(e=this.mediaRecorder)===null||e===void 0||e.pause(),this.timer.stop(),this.lastDuration=this.duration)}resumeRecording(){var t;this.isPaused()&&(this.isWaveformPaused=!1,(t=this.mediaRecorder)===null||t===void 0||t.resume(),this.timer.start(),this.lastStartTime=performance.now(),this.emit("record-resume"))}static getAvailableAudioDevices(){return it(this,void 0,void 0,function*(){return navigator.mediaDevices.enumerateDevices().then(t=>t.filter(e=>e.kind==="audioinput"))})}destroy(){this.applyOriginalOptionsIfNeeded(),super.destroy(),this.stopRecording(),this.stopMic()}applyOriginalOptionsIfNeeded(){this.wavesurfer&&this.originalOptions&&(this.wavesurfer.setOptions(this.originalOptions),delete this.originalOptions)}}const be=async({files:s,uploadClient:t,widgetMgr:e,widgetInfo:i,fragmentId:n})=>{let r=[];try{r=await t.fetchFileURLs(s)}catch(c){return{successfulUploads:[],failedUploads:s.map(l=>({file:l,error:ut(c)}))}}const o=zt(s,r),a=[],d=[];return await Promise.all(o.map(async([c,l])=>{if(!c||!l||!l.uploadUrl||!l.fileId)return{file:c,fileUrl:l,error:new Error("No upload URL found")};try{await t.uploadFile({id:l.fileId,formId:i.formId||""},l.uploadUrl,c),a.push({fileUrl:l,file:c})}catch(p){const u=ut(p);d.push({file:c,error:u})}})),e.setFileUploaderStateValue(i,new _t({uploadedFileInfo:a.map(({file:c,fileUrl:l})=>new $t({fileId:l.fileId,fileUrls:l,name:c.name,size:c.size}))}),{fromUi:!0},n),{successfulUploads:a,failedUploads:d}},st=({widgetMgr:s,id:t,formId:e,key:i,defaultValue:n})=>{h.useEffect(()=>{const l=s.getElementState(t,i);X(l)&&q(n)&&s.setElementState(t,i,n)},[s,t,i,n]);const[r,o]=h.useState(s.getElementState(t,i)??n),a=h.useCallback(l=>{s.setElementState(t,i,l),o(l)},[s,t,i]),d=h.useMemo(()=>({formId:e||""}),[e]),c=h.useCallback(()=>a(n),[n,a]);return se({element:d,widgetMgr:s,onFormCleared:c}),[r,a]},ye=(s,t)=>{const{libConfig:{enforceDownloadInNewTab:e=!1}}=h.useContext(Ht);return h.useCallback(()=>{if(!s)return;const n=ae({enforceDownloadInNewTab:e,url:s,filename:t});n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n)},[s,e,t])},we=x("div",{target:"e45nyo0"})(),ft=x("div",{target:"e45nyo1"})(({theme:s})=>({height:s.sizes.largestElementHeight,width:"100%",background:s.colors.secondaryBg,borderRadius:s.radii.default,marginBottom:s.spacing.twoXS,display:"flex",alignItems:"center",position:"relative",paddingLeft:s.spacing.xs,paddingRight:s.spacing.sm,border:s.colors.widgetBorderColor?`${s.sizes.borderWidth} solid ${s.colors.widgetBorderColor}`:void 0})),Se=x("div",{target:"e45nyo2"})({flex:1}),Ce=x("div",{target:"e45nyo3"})(({show:s})=>({display:s?"block":"none"})),Ee=x("span",{target:"e45nyo4"})(({theme:s,isPlayingOrRecording:t})=>({margin:s.spacing.sm,fontFamily:s.fonts.monospace,color:t?s.colors.bodyText:s.colors.fadedText60,backgroundColor:s.colors.secondaryBg,fontSize:s.fontSizes.sm})),Rt=x("div",{target:"e45nyo5"})({width:"100%",textAlign:"center",overflow:"hidden"}),Pt=x("span",{target:"e45nyo6"})(({theme:s})=>({color:s.colors.bodyText})),Re=x("a",{target:"e45nyo7"})(({theme:s})=>({color:s.colors.link,textDecoration:s.linkUnderline?"underline":"none"})),Pe=x("div",{target:"e45nyo8"})(({theme:s})=>({height:s.sizes.largestElementHeight,display:"flex",justifyContent:"center",alignItems:"center"})),xe=x("div",{target:"e45nyo9"})(({theme:s})=>{const t="0.625em";return{opacity:.2,width:"100%",height:t,backgroundSize:t,backgroundImage:`radial-gradient(${s.colors.fadedText10} 40%, transparent 40%)`,backgroundRepeat:"repeat"}}),Ae=x("span",{target:"e45nyo10"})(({theme:s})=>({"& > button":{color:s.colors.primary,padding:s.spacing.threeXS},"& > button:hover, & > button:focus":{color:s.colors.red}})),Te=x("span",{target:"e45nyo11"})(({theme:s})=>({"& > button":{padding:s.spacing.threeXS,color:s.colors.fadedText60},"& > button:hover, & > button:focus":{color:s.colors.bodyText}})),xt=x("span",{target:"e45nyo12"})(({theme:s})=>({"& > button":{padding:s.spacing.threeXS,color:s.colors.fadedText60},"& > button:hover, & > button:focus":{color:s.colors.bodyText}})),nt=x("div",{target:"e45nyo13"})(({theme:s})=>({display:"flex",justifyContent:"center",alignItems:"center",flexGrow:0,flexShrink:1,padding:s.spacing.xs,gap:s.spacing.twoXS,marginRight:s.spacing.twoXS})),De=x("div",{target:"e45nyo14"})(({theme:s})=>({marginLeft:s.spacing.sm})),We=x(Vt,{target:"e45nyo15"})(({theme:s})=>({fontSize:s.fontSizes.sm,width:s.sizes.spinnerSize,height:s.sizes.spinnerSize,borderWidth:s.sizes.spinnerThickness,justifyContents:"center",padding:s.spacing.none,margin:s.spacing.none,borderColor:s.colors.borderColor,borderTopColor:s.colors.secondary,flexGrow:0,flexShrink:0})),Me=()=>N(Rt,{children:[v(Pt,{children:"This app would like to use your microphone."})," ",v(Re,{href:jt,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]}),ke=h.memo(Me),Oe=()=>v(Pe,{children:v(xe,{})}),Ie=h.memo(Oe),Le=4,Be=4,Ne=4,Ue=8,Fe=0,G="00:00",gt=s=>{const t=Math.floor(s/1e3),e=Math.floor(t/60),i=Math.floor(e/60),n=t%60,r=e%60,o=n.toString().padStart(2,"0"),a=r.toString().padStart(2,"0"),d=i.toString().padStart(2,"0");return e<60?`${a}:${o}`:`${d}:${a}:${o}`},_=({onClick:s,disabled:t,ariaLabel:e,iconContent:i})=>v(qt,{kind:Gt.BORDERLESS_ICON,onClick:s,disabled:t,"aria-label":e,containerWidth:!0,"data-testid":"stAudioInputActionButton",children:v(Xt,{content:i,size:"lg",color:"inherit"})}),ze=({disabled:s,stopRecording:t})=>v(Ae,{children:v(_,{onClick:t,disabled:s,ariaLabel:"Stop recording",iconContent:St})}),_e=({disabled:s,isPlaying:t,onClickPlayPause:e})=>v(xt,{children:t?v(_,{onClick:e,disabled:s,ariaLabel:"Pause",iconContent:bt}):v(_,{onClick:e,disabled:s,ariaLabel:"Play",iconContent:yt})}),$e=({disabled:s,startRecording:t})=>v(Te,{children:v(_,{onClick:t,disabled:s,ariaLabel:"Record",iconContent:vt})}),He=({onClick:s})=>v(xt,{children:v(_,{disabled:!1,onClick:s,ariaLabel:"Reset",iconContent:wt})}),Ve=({disabled:s,isRecording:t,isPlaying:e,isUploading:i,isError:n,recordingUrlExists:r,startRecording:o,stopRecording:a,onClickPlayPause:d,onClear:c})=>n?v(nt,{children:v(He,{onClick:c})}):i?v(nt,{children:v(We,{"aria-label":"Uploading"})}):N(nt,{children:[t?v(ze,{disabled:s,stopRecording:a}):v($e,{disabled:s,startRecording:o}),r&&v(_e,{disabled:s,isPlaying:e,onClickPlayPause:d})]}),je=h.memo(Ve),Ge=Yt.getLogger("convertAudioToWav");async function Xe(s){const t=new window.AudioContext,e=await s.arrayBuffer();let i;try{i=await t.decodeAudioData(e)}catch(m){Ge.error(m);return}const n=44,r=i.numberOfChannels,o=i.sampleRate,a=i.length*r*2+n,d=new ArrayBuffer(a),c=new DataView(d),l={0:{type:"string",value:"RIFF"},4:{type:"uint32",value:a-8},8:{type:"string",value:"WAVE"},12:{type:"string",value:"fmt "},16:{type:"uint32",value:16},20:{type:"uint16",value:1},22:{type:"uint16",value:r},24:{type:"uint32",value:o},28:{type:"uint32",value:o*r*2},32:{type:"uint16",value:r*2},34:{type:"uint16",value:16},36:{type:"string",value:"data"},40:{type:"uint32",value:i.length*r*2}};Object.entries(l).forEach(([m,{type:f,value:y}])=>{const g=parseInt(m,10);f==="string"?qe(c,g,y):f==="uint32"?c.setUint32(g,y,!0):f==="uint16"&&c.setUint16(g,y,!0)});let p=n;for(let m=0;m<i.length;m++)for(let f=0;f<r;f++){const y=Math.max(-1,Math.min(1,i.getChannelData(f)[m]));c.setInt16(p,y*32767,!0),p+=2}const u=new Uint8Array(d);return new Blob([u],{type:"audio/wav"})}function qe(s,t,e){for(let i=0;i<e.length;i++)s.setUint8(t+i,e.charCodeAt(i))}const Ye=()=>v(Rt,{children:v(Pt,{children:"An error has occurred, please try again."})}),Ke=h.memo(Ye),Je=({element:s,uploadClient:t,widgetMgr:e,fragmentId:i,disabled:n})=>{const r=Kt(),o=oe(r),[a,d]=h.useState(null),c=h.useRef(null),[l,p]=st({widgetMgr:e,id:s.id,key:"deleteFileUrl",defaultValue:null}),[u,m]=h.useState(null),[f,y]=h.useState([]),[g,S]=h.useState(null),[b,A]=st({widgetMgr:e,id:s.id,key:"recordingUrl",defaultValue:null}),[,R]=h.useState(0),w=()=>{R(C=>C+1)},[T,D]=h.useState(G),[k,W]=st({widgetMgr:e,id:s.id,formId:s.formId,key:"recordingTime",defaultValue:G}),[O,F]=h.useState(!1),[L,At]=h.useState(!1),[rt,Tt]=h.useState(!1),[Dt,ot]=h.useState(!1),[K,J]=h.useState(!1),at=s.id,I=s.formId,lt=h.useCallback(async C=>{ot(!0),q(I)&&e.setFormsWithUploadsInProgress(new Set([I]));let E;if(C.type==="audio/wav"?E=C:E=await Xe(C),!E){J(!0);return}const M=URL.createObjectURL(E),Bt=new Date().toISOString().slice(0,16).replace(":","-"),Nt=new File([E],`${Bt}_audio.wav`,{type:E.type});A(M),be({files:[Nt],uploadClient:t,widgetMgr:e,widgetInfo:{id:at,formId:I},fragmentId:i}).then(({successfulUploads:Ut,failedUploads:Ft})=>{if(Ft.length>0){J(!0);return}const Z=Ut[0];Z&&Z.fileUrl.deleteUrl&&p(Z.fileUrl.deleteUrl)}).finally(()=>{q(I)&&e.setFormsWithUploadsInProgress(new Set),ot(!1)})},[A,t,e,at,I,i,p]),B=h.useCallback(({updateWidgetManager:C,deleteFile:E})=>{X(a)||X(l)||(A(null),a.empty(),E&&t.deleteFile(l),p(null),D(G),W(G),C&&e.setFileUploaderStateValue(s,{},{fromUi:!0},i),F(!1),q(b)&&URL.revokeObjectURL(b))},[l,b,t,a,s,e,i,W,A,p]);h.useEffect(()=>{if(X(I))return;const C=new ne;return C.manageFormClearListener(e,I,()=>B({updateWidgetManager:!0,deleteFile:!1})),()=>C.disconnect()},[I,B,e]);const ct=h.useCallback(()=>{if(c.current===null)return;const C=z.create({container:c.current,waveColor:b?tt(r.colors.fadedText40,r.colors.secondaryBg):r.colors.primary,progressColor:r.colors.bodyText,height:Jt(r.sizes.largestElementHeight)-2*Le,barWidth:Be,barGap:Ne,barRadius:Ue,cursorWidth:Fe,url:b??void 0});C.on("timeupdate",M=>{D(gt(M*1e3))}),C.on("pause",()=>{w()});const E=C.registerPlugin(Y.create({scrollingWaveform:!1,renderRecordedAudio:!0}));return E.on("record-end",M=>{lt(M)}),E.on("record-progress",M=>{W(gt(M))}),d(C),m(E),()=>{C&&C.destroy(),E&&E.destroy()}},[lt]);h.useEffect(()=>ct(),[ct]),h.useEffect(()=>{Qt(o,r)||a?.setOptions({waveColor:b?tt(r.colors.fadedText40,r.colors.secondaryBg):r.colors.primary,progressColor:r.colors.bodyText})},[r,o,b,a]);const Wt=h.useCallback(()=>{a&&(a.playPause(),F(!0),w())},[a]),Mt=h.useCallback(async()=>{let C=g;rt||(await navigator.mediaDevices.getUserMedia({audio:!0}).then(()=>Y.getAvailableAudioDevices().then(E=>{if(y(E),E.length>0){const{deviceId:M}=E[0];S(M),C=M}})).catch(E=>{At(!0)}),Tt(!0)),!(!u||!C||!a)&&(a.setOptions({waveColor:r.colors.primary}),b&&B({updateWidgetManager:!1,deleteFile:!0}),u.startRecording({deviceId:C}).then(()=>{w()}))},[g,u,r,a,b,B,rt]),kt=h.useCallback(()=>{u&&(u.stopRecording(),a?.setOptions({waveColor:tt(r.colors.fadedText40,r.colors.secondaryBg)}))},[u,a,r]),Ot=ye(b,"recording.wav"),Q=!!u?.isRecording(),dt=!!a?.isPlaying(),It=Q||dt,ht=!Q&&!b&&!L,Lt=L||ht||K;return N(we,{className:"stAudioInput","data-testid":"stAudioInput",children:[v(ie,{label:s.label,disabled:n,labelVisibility:Zt(s.labelVisibility?.value),children:s.help&&v(De,{children:v(te,{content:s.help,placement:ee.TOP})})}),N(ft,{children:[N(re,{isFullScreen:!1,disableFullscreenMode:!0,target:ft,children:[b&&v(pt,{label:"Download as WAV",icon:le,onClick:()=>Ot()}),l&&v(pt,{label:"Clear recording",icon:ce,onClick:()=>B({updateWidgetManager:!0,deleteFile:!0})})]}),v(je,{isRecording:Q,isPlaying:dt,isUploading:Dt,isError:K,recordingUrlExists:!!b,startRecording:Mt,stopRecording:kt,onClickPlayPause:Wt,onClear:()=>{B({updateWidgetManager:!1,deleteFile:!0}),J(!1)},disabled:n||L}),N(Se,{children:[K&&v(Ke,{}),ht&&v(Ie,{}),L&&v(ke,{}),v(Ce,{"data-testid":"stAudioInputWaveSurfer",ref:c,show:!Lt})]}),v(Ee,{isPlayingOrRecording:It,"data-testid":"stAudioInputWaveformTimeCode",children:O?T:k})]})]})},ri=h.memo(Je);export{ri as default};
73
+ `,[t,e]}setOptions(t){if(this.options.container!==t.container){const e=this.parentFromOptionsContainer(t.container);e.appendChild(this.container),this.parent=e}t.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.options=t,this.reRender()}getWrapper(){return this.wrapper}getWidth(){return this.scrollContainer.clientWidth}getScroll(){return this.scrollContainer.scrollLeft}setScroll(t){this.scrollContainer.scrollLeft=t}setScrollPercentage(t){const{scrollWidth:e}=this.scrollContainer,i=e*t;this.setScroll(i)}destroy(){var t,e;this.subscriptions.forEach(i=>i()),this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(e=this.unsubscribeOnScroll)===null||e===void 0||e.forEach(i=>i()),this.unsubscribeOnScroll=[]}createDelay(t=10){let e,i;const n=()=>{e&&clearTimeout(e),i&&i()};return this.timeouts.push(n),()=>new Promise((r,o)=>{n(),i=o,e=setTimeout(()=>{e=void 0,i=void 0,r()},t)})}convertColorValues(t){if(!Array.isArray(t))return t||"";if(t.length<2)return t[0]||"";const e=document.createElement("canvas"),i=e.getContext("2d"),n=e.height*(window.devicePixelRatio||1),r=i.createLinearGradient(0,0,0,n),o=1/(t.length-1);return t.forEach((a,d)=>{const c=d*o;r.addColorStop(c,a)}),r}getPixelRatio(){return Math.max(1,window.devicePixelRatio||1)}renderBarWaveform(t,e,i,n){const r=t[0],o=t[1]||t[0],a=r.length,{width:d,height:c}=i.canvas,l=c/2,p=this.getPixelRatio(),u=e.barWidth?e.barWidth*p:1,m=e.barGap?e.barGap*p:e.barWidth?u/2:0,f=e.barRadius||0,b=d/(u+m)/a,g=f&&"roundRect"in i?"roundRect":"rect";i.beginPath();let S=0,y=0,x=0;for(let R=0;R<=a;R++){const w=Math.round(R*b);if(w>S){const k=Math.round(y*l*n),W=k+Math.round(x*l*n)||1;let O=l-k;e.barAlign==="top"?O=0:e.barAlign==="bottom"&&(O=c-W),i[g](S*(u+m),O,u,W,f),S=w,y=0,x=0}const A=Math.abs(r[R]||0),T=Math.abs(o[R]||0);A>y&&(y=A),T>x&&(x=T)}i.fill(),i.closePath()}renderLineWaveform(t,e,i,n){const r=o=>{const a=t[o]||t[0],d=a.length,{height:c}=i.canvas,l=c/2,p=i.canvas.width/d;i.moveTo(0,l);let u=0,m=0;for(let f=0;f<=d;f++){const b=Math.round(f*p);if(b>u){const S=l+(Math.round(m*l*n)||1)*(o===0?-1:1);i.lineTo(u,S),u=b,m=0}const g=Math.abs(a[f]||0);g>m&&(m=g)}i.lineTo(u,l)};i.beginPath(),r(0),r(1),i.fill(),i.closePath()}renderWaveform(t,e,i){if(i.fillStyle=this.convertColorValues(e.waveColor),e.renderFunction)return void e.renderFunction(t,i);let n=e.barHeight||1;if(e.normalize){const r=Array.from(t[0]).reduce((o,a)=>Math.max(o,Math.abs(a)),0);n=r?1/r:1}e.barWidth||e.barGap||e.barAlign?this.renderBarWaveform(t,e,i,n):this.renderLineWaveform(t,e,i,n)}renderSingleCanvas(t,e,i,n,r,o,a){const d=this.getPixelRatio(),c=document.createElement("canvas");c.width=Math.round(i*d),c.height=Math.round(n*d),c.style.width=`${i}px`,c.style.height=`${n}px`,c.style.left=`${Math.round(r)}px`,o.appendChild(c);const l=c.getContext("2d");if(this.renderWaveform(t,e,l),c.width>0&&c.height>0){const p=c.cloneNode(),u=p.getContext("2d");u.drawImage(c,0,0),u.globalCompositeOperation="source-in",u.fillStyle=this.convertColorValues(e.progressColor),u.fillRect(0,0,c.width,c.height),a.appendChild(p)}}renderMultiCanvas(t,e,i,n,r,o){const a=this.getPixelRatio(),{clientWidth:d}=this.scrollContainer,c=i/a;let l=Math.min(U.MAX_CANVAS_WIDTH,d,c),p={};if(e.barWidth||e.barGap){const g=e.barWidth||.5,S=g+(e.barGap||g/2);l%S!=0&&(l=Math.floor(l/S)*S)}if(l===0)return;const u=g=>{if(g<0||g>=m||p[g])return;p[g]=!0;const S=g*l;let y=Math.min(c-S,l);if(e.barWidth||e.barGap){const R=e.barWidth||.5,w=R+(e.barGap||R/2);y=Math.floor(y/w)*w}if(y<=0)return;const x=t.map(R=>{const w=Math.floor(S/c*R.length),A=Math.floor((S+y)/c*R.length);return R.slice(w,A)});this.renderSingleCanvas(x,e,y,n,S,r,o)},m=Math.ceil(c/l);if(!this.isScrollable){for(let g=0;g<m;g++)u(g);return}const f=this.scrollContainer.scrollLeft/c,b=Math.floor(f*m);if(u(b-1),u(b),u(b+1),m>1){const g=this.on("scroll",()=>{const{scrollLeft:S}=this.scrollContainer,y=Math.floor(S/c*m);Object.keys(p).length>U.MAX_NODES&&(r.innerHTML="",o.innerHTML="",p={}),u(y-1),u(y),u(y+1)});this.unsubscribeOnScroll.push(g)}}renderChannel(t,e,i,n){var{overlay:r}=e,o=function(l,p){var u={};for(var m in l)Object.prototype.hasOwnProperty.call(l,m)&&p.indexOf(m)<0&&(u[m]=l[m]);if(l!=null&&typeof Object.getOwnPropertySymbols=="function"){var f=0;for(m=Object.getOwnPropertySymbols(l);f<m.length;f++)p.indexOf(m[f])<0&&Object.prototype.propertyIsEnumerable.call(l,m[f])&&(u[m[f]]=l[m[f]])}return u}(e,["overlay"]);const a=document.createElement("div"),d=this.getHeight(o.height,o.splitChannels);a.style.height=`${d}px`,r&&n>0&&(a.style.marginTop=`-${d}px`),this.canvasWrapper.style.minHeight=`${d}px`,this.canvasWrapper.appendChild(a);const c=a.cloneNode();this.progressWrapper.appendChild(c),this.renderMultiCanvas(t,o,i,d,a,c)}render(t){return P(this,void 0,void 0,function*(){var e;this.timeouts.forEach(d=>d()),this.timeouts=[],this.canvasWrapper.innerHTML="",this.progressWrapper.innerHTML="",this.options.width!=null&&(this.scrollContainer.style.width=typeof this.options.width=="number"?`${this.options.width}px`:this.options.width);const i=this.getPixelRatio(),n=this.scrollContainer.clientWidth,r=Math.ceil(t.duration*(this.options.minPxPerSec||0));this.isScrollable=r>n;const o=this.options.fillParent&&!this.isScrollable,a=(o?n:r)*i;if(this.wrapper.style.width=o?"100%":`${r}px`,this.scrollContainer.style.overflowX=this.isScrollable?"auto":"hidden",this.scrollContainer.classList.toggle("noScrollbar",!!this.options.hideScrollbar),this.cursor.style.backgroundColor=`${this.options.cursorColor||this.options.progressColor}`,this.cursor.style.width=`${this.options.cursorWidth}px`,this.audioData=t,this.emit("render"),this.options.splitChannels)for(let d=0;d<t.numberOfChannels;d++){const c=Object.assign(Object.assign({},this.options),(e=this.options.splitChannels)===null||e===void 0?void 0:e[d]);this.renderChannel([t.getChannelData(d)],c,a,d)}else{const d=[t.getChannelData(0)];t.numberOfChannels>1&&d.push(t.getChannelData(1)),this.renderChannel(d,this.options,a,0)}Promise.resolve().then(()=>this.emit("rendered"))})}reRender(){if(this.unsubscribeOnScroll.forEach(i=>i()),this.unsubscribeOnScroll=[],!this.audioData)return;const{scrollWidth:t}=this.scrollContainer,{right:e}=this.progressWrapper.getBoundingClientRect();if(this.render(this.audioData),this.isScrollable&&t!==this.scrollContainer.scrollWidth){const{right:i}=this.progressWrapper.getBoundingClientRect();let n=i-e;n*=2,n=n<0?Math.floor(n):Math.ceil(n),n/=2,this.scrollContainer.scrollLeft+=n}}zoom(t){this.options.minPxPerSec=t,this.reRender()}scrollIntoView(t,e=!1){const{scrollLeft:i,scrollWidth:n,clientWidth:r}=this.scrollContainer,o=t*n,a=i,d=i+r,c=r/2;if(this.isDragging)o+30>d?this.scrollContainer.scrollLeft+=30:o-30<a&&(this.scrollContainer.scrollLeft-=30);else{(o<a||o>d)&&(this.scrollContainer.scrollLeft=o-(this.options.autoCenter?c:0));const l=o-i-c;e&&this.options.autoCenter&&l>0&&(this.scrollContainer.scrollLeft+=Math.min(l,10))}{const l=this.scrollContainer.scrollLeft,p=l/n,u=(l+r)/n;this.emit("scroll",p,u,l,l+r)}}renderProgress(t,e){if(isNaN(t))return;const i=100*t;this.canvasWrapper.style.clipPath=`polygon(${i}% 0%, 100% 0%, 100% 100%, ${i}% 100%)`,this.progressWrapper.style.width=`${i}%`,this.cursor.style.left=`${i}%`,this.cursor.style.transform=`translateX(-${Math.round(i)===100?this.options.cursorWidth:0}px)`,this.isScrollable&&this.options.autoScroll&&this.scrollIntoView(t,e)}exportImage(t,e,i){return P(this,void 0,void 0,function*(){const n=this.canvasWrapper.querySelectorAll("canvas");if(!n.length)throw new Error("No waveform data");if(i==="dataURL"){const r=Array.from(n).map(o=>o.toDataURL(t,e));return Promise.resolve(r)}return Promise.all(Array.from(n).map(r=>new Promise((o,a)=>{r.toBlob(d=>{d?o(d):a(new Error("Could not export image"))},t,e)})))})}}U.MAX_CANVAS_WIDTH=8e3,U.MAX_NODES=10;class pe extends V{constructor(){super(...arguments),this.unsubscribe=()=>{}}start(){this.unsubscribe=this.on("tick",()=>{requestAnimationFrame(()=>{this.emit("tick")})}),this.emit("tick")}stop(){this.unsubscribe()}destroy(){this.unsubscribe()}}class et extends V{constructor(t=new AudioContext){super(),this.bufferNode=null,this.playStartTime=0,this.playedDuration=0,this._muted=!1,this._playbackRate=1,this._duration=void 0,this.buffer=null,this.currentSrc="",this.paused=!0,this.crossOrigin=null,this.seeking=!1,this.autoplay=!1,this.addEventListener=this.on,this.removeEventListener=this.un,this.audioContext=t,this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioContext.destination)}load(){return P(this,void 0,void 0,function*(){})}get src(){return this.currentSrc}set src(t){if(this.currentSrc=t,this._duration=void 0,!t)return this.buffer=null,void this.emit("emptied");fetch(t).then(e=>{if(e.status>=400)throw new Error(`Failed to fetch ${t}: ${e.status} (${e.statusText})`);return e.arrayBuffer()}).then(e=>this.currentSrc!==t?null:this.audioContext.decodeAudioData(e)).then(e=>{this.currentSrc===t&&(this.buffer=e,this.emit("loadedmetadata"),this.emit("canplay"),this.autoplay&&this.play())})}_play(){var t;if(!this.paused)return;this.paused=!1,(t=this.bufferNode)===null||t===void 0||t.disconnect(),this.bufferNode=this.audioContext.createBufferSource(),this.buffer&&(this.bufferNode.buffer=this.buffer),this.bufferNode.playbackRate.value=this._playbackRate,this.bufferNode.connect(this.gainNode);let e=this.playedDuration*this._playbackRate;(e>=this.duration||e<0)&&(e=0,this.playedDuration=0),this.bufferNode.start(this.audioContext.currentTime,e),this.playStartTime=this.audioContext.currentTime,this.bufferNode.onended=()=>{this.currentTime>=this.duration&&(this.pause(),this.emit("ended"))}}_pause(){var t;this.paused=!0,(t=this.bufferNode)===null||t===void 0||t.stop(),this.playedDuration+=this.audioContext.currentTime-this.playStartTime}play(){return P(this,void 0,void 0,function*(){this.paused&&(this._play(),this.emit("play"))})}pause(){this.paused||(this._pause(),this.emit("pause"))}stopAt(t){const e=t-this.currentTime,i=this.bufferNode;i?.stop(this.audioContext.currentTime+e),i?.addEventListener("ended",()=>{i===this.bufferNode&&(this.bufferNode=null,this.pause())},{once:!0})}setSinkId(t){return P(this,void 0,void 0,function*(){return this.audioContext.setSinkId(t)})}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this.bufferNode&&(this.bufferNode.playbackRate.value=t)}get currentTime(){return(this.paused?this.playedDuration:this.playedDuration+(this.audioContext.currentTime-this.playStartTime))*this._playbackRate}set currentTime(t){const e=!this.paused;e&&this._pause(),this.playedDuration=t/this._playbackRate,e&&this._play(),this.emit("seeking"),this.emit("timeupdate")}get duration(){var t,e;return(t=this._duration)!==null&&t!==void 0?t:((e=this.buffer)===null||e===void 0?void 0:e.duration)||0}set duration(t){this._duration=t}get volume(){return this.gainNode.gain.value}set volume(t){this.gainNode.gain.value=t,this.emit("volumechange")}get muted(){return this._muted}set muted(t){this._muted!==t&&(this._muted=t,this._muted?this.gainNode.disconnect():this.gainNode.connect(this.audioContext.destination))}canPlayType(t){return/^(audio|video)\//.test(t)}getGainNode(){return this.gainNode}getChannelData(){const t=[];if(!this.buffer)return t;const e=this.buffer.numberOfChannels;for(let i=0;i<e;i++)t.push(this.buffer.getChannelData(i));return t}}const me={waveColor:"#999",progressColor:"#555",cursorWidth:1,minPxPerSec:0,fillParent:!0,interact:!0,dragToSeek:!1,autoScroll:!0,autoCenter:!0,sampleRate:8e3};class z extends ue{static create(t){return new z(t)}constructor(t){const e=t.media||(t.backend==="WebAudio"?new et:void 0);super({media:e,mediaControls:t.mediaControls,autoplay:t.autoplay,playbackRate:t.audioRate}),this.plugins=[],this.decodedData=null,this.stopAtPosition=null,this.subscriptions=[],this.mediaSubscriptions=[],this.abortController=null,this.options=Object.assign({},me,t),this.timer=new pe;const i=e?void 0:this.getMediaElement();this.renderer=new U(this.options,i),this.initPlayerEvents(),this.initRendererEvents(),this.initTimerEvents(),this.initPlugins();const n=this.options.url||this.getSrc()||"";Promise.resolve().then(()=>{this.emit("init");const{peaks:r,duration:o}=this.options;(n||r&&o)&&this.load(n,r,o).catch(()=>null)})}updateProgress(t=this.getCurrentTime()){return this.renderer.renderProgress(t/this.getDuration(),this.isPlaying()),t}initTimerEvents(){this.subscriptions.push(this.timer.on("tick",()=>{if(!this.isSeeking()){const t=this.updateProgress();this.emit("timeupdate",t),this.emit("audioprocess",t),this.stopAtPosition!=null&&this.isPlaying()&&t>=this.stopAtPosition&&this.pause()}}))}initPlayerEvents(){this.isPlaying()&&(this.emit("play"),this.timer.start()),this.mediaSubscriptions.push(this.onMediaEvent("timeupdate",()=>{const t=this.updateProgress();this.emit("timeupdate",t)}),this.onMediaEvent("play",()=>{this.emit("play"),this.timer.start()}),this.onMediaEvent("pause",()=>{this.emit("pause"),this.timer.stop(),this.stopAtPosition=null}),this.onMediaEvent("emptied",()=>{this.timer.stop(),this.stopAtPosition=null}),this.onMediaEvent("ended",()=>{this.emit("timeupdate",this.getDuration()),this.emit("finish"),this.stopAtPosition=null}),this.onMediaEvent("seeking",()=>{this.emit("seeking",this.getCurrentTime())}),this.onMediaEvent("error",()=>{var t;this.emit("error",(t=this.getMediaElement().error)!==null&&t!==void 0?t:new Error("Media error")),this.stopAtPosition=null}))}initRendererEvents(){this.subscriptions.push(this.renderer.on("click",(t,e)=>{this.options.interact&&(this.seekTo(t),this.emit("interaction",t*this.getDuration()),this.emit("click",t,e))}),this.renderer.on("dblclick",(t,e)=>{this.emit("dblclick",t,e)}),this.renderer.on("scroll",(t,e,i,n)=>{const r=this.getDuration();this.emit("scroll",t*r,e*r,i,n)}),this.renderer.on("render",()=>{this.emit("redraw")}),this.renderer.on("rendered",()=>{this.emit("redrawcomplete")}),this.renderer.on("dragstart",t=>{this.emit("dragstart",t)}),this.renderer.on("dragend",t=>{this.emit("dragend",t)}));{let t;this.subscriptions.push(this.renderer.on("drag",e=>{if(!this.options.interact)return;let i;this.renderer.renderProgress(e),clearTimeout(t),this.isPlaying()?i=0:this.options.dragToSeek===!0?i=200:typeof this.options.dragToSeek=="object"&&this.options.dragToSeek!==void 0&&(i=this.options.dragToSeek.debounceTime),t=setTimeout(()=>{this.seekTo(e)},i),this.emit("interaction",e*this.getDuration()),this.emit("drag",e)}))}}initPlugins(){var t;!((t=this.options.plugins)===null||t===void 0)&&t.length&&this.options.plugins.forEach(e=>{this.registerPlugin(e)})}unsubscribePlayerEvents(){this.mediaSubscriptions.forEach(t=>t()),this.mediaSubscriptions=[]}setOptions(t){this.options=Object.assign({},this.options,t),t.duration&&!t.peaks&&(this.decodedData=j.createBuffer(this.exportPeaks(),t.duration)),t.peaks&&t.duration&&(this.decodedData=j.createBuffer(t.peaks,t.duration)),this.renderer.setOptions(this.options),t.audioRate&&this.setPlaybackRate(t.audioRate),t.mediaControls!=null&&(this.getMediaElement().controls=t.mediaControls)}registerPlugin(t){if(this.plugins.includes(t))return t;t._init(this),this.plugins.push(t);const e=t.once("destroy",()=>{this.plugins=this.plugins.filter(i=>i!==t),this.subscriptions=this.subscriptions.filter(i=>i!==e)});return this.subscriptions.push(e),t}unregisterPlugin(t){this.plugins=this.plugins.filter(e=>e!==t),t.destroy()}getWrapper(){return this.renderer.getWrapper()}getWidth(){return this.renderer.getWidth()}getScroll(){return this.renderer.getScroll()}setScroll(t){return this.renderer.setScroll(t)}setScrollTime(t){const e=t/this.getDuration();this.renderer.setScrollPercentage(e)}getActivePlugins(){return this.plugins}loadAudio(t,e,i,n){return P(this,void 0,void 0,function*(){var r;if(this.emit("load",t),!this.options.media&&this.isPlaying()&&this.pause(),this.decodedData=null,this.stopAtPosition=null,!e&&!i){const a=this.options.fetchParams||{};window.AbortController&&!a.signal&&(this.abortController=new AbortController,a.signal=(r=this.abortController)===null||r===void 0?void 0:r.signal);const d=l=>this.emit("loading",l);e=yield he.fetchBlob(t,d,a);const c=this.options.blobMimeType;c&&(e=new Blob([e],{type:c}))}this.setSrc(t,e);const o=yield new Promise(a=>{const d=n||this.getDuration();d?a(d):this.mediaSubscriptions.push(this.onMediaEvent("loadedmetadata",()=>a(this.getDuration()),{once:!0}))});if(!t&&!e){const a=this.getMediaElement();a instanceof et&&(a.duration=o)}if(i)this.decodedData=j.createBuffer(i,o||0);else if(e){const a=yield e.arrayBuffer();this.decodedData=yield j.decode(a,this.options.sampleRate)}this.decodedData&&(this.emit("decode",this.getDuration()),this.renderer.render(this.decodedData)),this.emit("ready",this.getDuration())})}load(t,e,i){return P(this,void 0,void 0,function*(){try{return yield this.loadAudio(t,void 0,e,i)}catch(n){throw this.emit("error",n),n}})}loadBlob(t,e,i){return P(this,void 0,void 0,function*(){try{return yield this.loadAudio("",t,e,i)}catch(n){throw this.emit("error",n),n}})}zoom(t){if(!this.decodedData)throw new Error("No audio loaded");this.renderer.zoom(t),this.emit("zoom",t)}getDecodedData(){return this.decodedData}exportPeaks({channels:t=2,maxLength:e=8e3,precision:i=1e4}={}){if(!this.decodedData)throw new Error("The audio has not been decoded yet");const n=Math.min(t,this.decodedData.numberOfChannels),r=[];for(let o=0;o<n;o++){const a=this.decodedData.getChannelData(o),d=[],c=a.length/e;for(let l=0;l<e;l++){const p=a.slice(Math.floor(l*c),Math.ceil((l+1)*c));let u=0;for(let m=0;m<p.length;m++){const f=p[m];Math.abs(f)>Math.abs(u)&&(u=f)}d.push(Math.round(u*i)/i)}r.push(d)}return r}getDuration(){let t=super.getDuration()||0;return t!==0&&t!==1/0||!this.decodedData||(t=this.decodedData.duration),t}toggleInteraction(t){this.options.interact=t}setTime(t){this.stopAtPosition=null,super.setTime(t),this.updateProgress(t),this.emit("timeupdate",t)}seekTo(t){const e=this.getDuration()*t;this.setTime(e)}play(t,e){const i=Object.create(null,{play:{get:()=>super.play}});return P(this,void 0,void 0,function*(){t!=null&&this.setTime(t);const n=yield i.play.call(this);return e!=null&&(this.media instanceof et?this.media.stopAt(e):this.stopAtPosition=e),n})}playPause(){return P(this,void 0,void 0,function*(){return this.isPlaying()?this.pause():this.play()})}stop(){this.pause(),this.setTime(0)}skip(t){this.setTime(this.getCurrentTime()+t)}empty(){this.load("",[[0]],.001)}setMediaElement(t){this.unsubscribePlayerEvents(),super.setMediaElement(t),this.initPlayerEvents()}exportImage(){return P(this,arguments,void 0,function*(t="image/png",e=1,i="dataURL"){return this.renderer.exportImage(t,e,i)})}destroy(){var t;this.emit("destroy"),(t=this.abortController)===null||t===void 0||t.abort(),this.plugins.forEach(e=>e.destroy()),this.subscriptions.forEach(e=>e()),this.unsubscribePlayerEvents(),this.timer.destroy(),this.renderer.destroy(),super.destroy()}}z.BasePlugin=class extends V{constructor(s){super(),this.subscriptions=[],this.isDestroyed=!1,this.options=s}onInit(){}_init(s){this.isDestroyed&&(this.subscriptions=[],this.isDestroyed=!1),this.wavesurfer=s,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach(s=>s()),this.subscriptions=[],this.isDestroyed=!0,this.wavesurfer=void 0}},z.dom=de;function it(s,t,e,i){return new(e||(e=Promise))(function(n,r){function o(c){try{d(i.next(c))}catch(l){r(l)}}function a(c){try{d(i.throw(c))}catch(l){r(l)}}function d(c){var l;c.done?n(c.value):(l=c.value,l instanceof e?l:new e(function(p){p(l)})).then(o,a)}d((i=i.apply(s,[])).next())})}class Et{constructor(){this.listeners={}}on(t,e,i){if(this.listeners[t]||(this.listeners[t]=new Set),this.listeners[t].add(e),i?.once){const n=()=>{this.un(t,n),this.un(t,e)};return this.on(t,n),n}return()=>this.un(t,e)}un(t,e){var i;(i=this.listeners[t])===null||i===void 0||i.delete(e)}once(t,e){return this.on(t,e,{once:!0})}unAll(){this.listeners={}}emit(t,...e){this.listeners[t]&&this.listeners[t].forEach(i=>i(...e))}}class fe extends Et{constructor(t){super(),this.subscriptions=[],this.isDestroyed=!1,this.options=t}onInit(){}_init(t){this.isDestroyed&&(this.subscriptions=[],this.isDestroyed=!1),this.wavesurfer=t,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach(t=>t()),this.subscriptions=[],this.isDestroyed=!0,this.wavesurfer=void 0}}class ge extends Et{constructor(){super(...arguments),this.unsubscribe=()=>{}}start(){this.unsubscribe=this.on("tick",()=>{requestAnimationFrame(()=>{this.emit("tick")})}),this.emit("tick")}stop(){this.unsubscribe()}destroy(){this.unsubscribe()}}const ve=["audio/webm","audio/wav","audio/mpeg","audio/mp4","audio/mp3"];class Y extends fe{constructor(t){var e,i,n,r,o,a;super(Object.assign(Object.assign({},t),{audioBitsPerSecond:(e=t.audioBitsPerSecond)!==null&&e!==void 0?e:128e3,scrollingWaveform:(i=t.scrollingWaveform)!==null&&i!==void 0&&i,scrollingWaveformWindow:(n=t.scrollingWaveformWindow)!==null&&n!==void 0?n:5,continuousWaveform:(r=t.continuousWaveform)!==null&&r!==void 0&&r,renderRecordedAudio:(o=t.renderRecordedAudio)===null||o===void 0||o,mediaRecorderTimeslice:(a=t.mediaRecorderTimeslice)!==null&&a!==void 0?a:void 0})),this.stream=null,this.mediaRecorder=null,this.dataWindow=null,this.isWaveformPaused=!1,this.lastStartTime=0,this.lastDuration=0,this.duration=0,this.timer=new ge,this.subscriptions.push(this.timer.on("tick",()=>{const d=performance.now()-this.lastStartTime;this.duration=this.isPaused()?this.duration:this.lastDuration+d,this.emit("record-progress",this.duration)}))}static create(t){return new Y(t||{})}renderMicStream(t){var e;const i=new AudioContext,n=i.createMediaStreamSource(t),r=i.createAnalyser();n.connect(r),this.options.continuousWaveform&&(r.fftSize=32);const o=r.frequencyBinCount,a=new Float32Array(o);let d=0;this.wavesurfer&&((e=this.originalOptions)!==null&&e!==void 0||(this.originalOptions=Object.assign({},this.wavesurfer.options)),this.wavesurfer.options.interact=!1,this.options.scrollingWaveform&&(this.wavesurfer.options.cursorWidth=0));const c=setInterval(()=>{var l,p,u,m;if(!this.isWaveformPaused){if(r.getFloatTimeDomainData(a),this.options.scrollingWaveform){const f=Math.floor((this.options.scrollingWaveformWindow||0)*i.sampleRate),b=Math.min(f,this.dataWindow?this.dataWindow.length+o:o),g=new Float32Array(f);if(this.dataWindow){const S=Math.max(0,f-this.dataWindow.length);g.set(this.dataWindow.slice(-b+o),S)}g.set(a,f-o),this.dataWindow=g}else if(this.options.continuousWaveform){if(!this.dataWindow){const b=this.options.continuousWaveformDuration?Math.round(100*this.options.continuousWaveformDuration):((p=(l=this.wavesurfer)===null||l===void 0?void 0:l.getWidth())!==null&&p!==void 0?p:0)*window.devicePixelRatio;this.dataWindow=new Float32Array(b)}let f=0;for(let b=0;b<o;b++){const g=Math.abs(a[b]);g>f&&(f=g)}if(d+1>this.dataWindow.length){const b=new Float32Array(2*this.dataWindow.length);b.set(this.dataWindow,0),this.dataWindow=b}this.dataWindow[d]=f,d++}else this.dataWindow=a;if(this.wavesurfer){const f=((m=(u=this.dataWindow)===null||u===void 0?void 0:u.length)!==null&&m!==void 0?m:0)/100;this.wavesurfer.load("",[this.dataWindow],this.options.scrollingWaveform?this.options.scrollingWaveformWindow:f).then(()=>{this.wavesurfer&&this.options.continuousWaveform&&(this.wavesurfer.setTime(this.getDuration()/1e3),this.wavesurfer.options.minPxPerSec||this.wavesurfer.setOptions({minPxPerSec:this.wavesurfer.getWidth()/this.wavesurfer.getDuration()}))}).catch(b=>{console.error("Error rendering real-time recording data:",b)})}}},10);return{onDestroy:()=>{clearInterval(c),n?.disconnect(),i?.close()},onEnd:()=>{this.isWaveformPaused=!0,clearInterval(c),this.stopMic()}}}startMic(t){return it(this,void 0,void 0,function*(){let e;try{e=yield navigator.mediaDevices.getUserMedia({audio:t==null||t})}catch(r){throw new Error("Error accessing the microphone: "+r.message)}const{onDestroy:i,onEnd:n}=this.renderMicStream(e);return this.subscriptions.push(this.once("destroy",i)),this.subscriptions.push(this.once("record-end",n)),this.stream=e,e})}stopMic(){this.stream&&(this.stream.getTracks().forEach(t=>t.stop()),this.stream=null,this.mediaRecorder=null)}startRecording(t){return it(this,void 0,void 0,function*(){const e=this.stream||(yield this.startMic(t));this.dataWindow=null;const i=this.mediaRecorder||new MediaRecorder(e,{mimeType:this.options.mimeType||ve.find(o=>MediaRecorder.isTypeSupported(o)),audioBitsPerSecond:this.options.audioBitsPerSecond});this.mediaRecorder=i,this.stopRecording();const n=[];i.ondataavailable=o=>{o.data.size>0&&n.push(o.data),this.emit("record-data-available",o.data)};const r=o=>{var a;const d=new Blob(n,{type:i.mimeType});this.emit(o,d),this.options.renderRecordedAudio&&(this.applyOriginalOptionsIfNeeded(),(a=this.wavesurfer)===null||a===void 0||a.load(URL.createObjectURL(d)))};i.onpause=()=>r("record-pause"),i.onstop=()=>r("record-end"),i.start(this.options.mediaRecorderTimeslice),this.lastStartTime=performance.now(),this.lastDuration=0,this.duration=0,this.isWaveformPaused=!1,this.timer.start(),this.emit("record-start")})}getDuration(){return this.duration}isRecording(){var t;return((t=this.mediaRecorder)===null||t===void 0?void 0:t.state)==="recording"}isPaused(){var t;return((t=this.mediaRecorder)===null||t===void 0?void 0:t.state)==="paused"}isActive(){var t;return((t=this.mediaRecorder)===null||t===void 0?void 0:t.state)!=="inactive"}stopRecording(){var t;this.isActive()&&((t=this.mediaRecorder)===null||t===void 0||t.stop(),this.timer.stop())}pauseRecording(){var t,e;this.isRecording()&&(this.isWaveformPaused=!0,(t=this.mediaRecorder)===null||t===void 0||t.requestData(),(e=this.mediaRecorder)===null||e===void 0||e.pause(),this.timer.stop(),this.lastDuration=this.duration)}resumeRecording(){var t;this.isPaused()&&(this.isWaveformPaused=!1,(t=this.mediaRecorder)===null||t===void 0||t.resume(),this.timer.start(),this.lastStartTime=performance.now(),this.emit("record-resume"))}static getAvailableAudioDevices(){return it(this,void 0,void 0,function*(){return navigator.mediaDevices.enumerateDevices().then(t=>t.filter(e=>e.kind==="audioinput"))})}destroy(){this.applyOriginalOptionsIfNeeded(),super.destroy(),this.stopRecording(),this.stopMic()}applyOriginalOptionsIfNeeded(){this.wavesurfer&&this.originalOptions&&(this.wavesurfer.setOptions(this.originalOptions),delete this.originalOptions)}}const ye=async({files:s,uploadClient:t,widgetMgr:e,widgetInfo:i,fragmentId:n})=>{let r=[];try{r=await t.fetchFileURLs(s)}catch(c){return{successfulUploads:[],failedUploads:s.map(l=>({file:l,error:ut(c)}))}}const o=zt(s,r),a=[],d=[];return await Promise.all(o.map(async([c,l])=>{if(!c||!l||!l.uploadUrl||!l.fileId)return{file:c,fileUrl:l,error:new Error("No upload URL found")};try{await t.uploadFile({id:l.fileId,formId:i.formId||""},l.uploadUrl,c),a.push({fileUrl:l,file:c})}catch(p){const u=ut(p);d.push({file:c,error:u})}})),e.setFileUploaderStateValue(i,new _t({uploadedFileInfo:a.map(({file:c,fileUrl:l})=>new $t({fileId:l.fileId,fileUrls:l,name:c.name,size:c.size}))}),{fromUi:!0},n),{successfulUploads:a,failedUploads:d}},st=({widgetMgr:s,id:t,formId:e,key:i,defaultValue:n})=>{h.useEffect(()=>{const l=s.getElementState(t,i);X(l)&&q(n)&&s.setElementState(t,i,n)},[s,t,i,n]);const[r,o]=h.useState(s.getElementState(t,i)??n),a=h.useCallback(l=>{s.setElementState(t,i,l),o(l)},[s,t,i]),d=h.useMemo(()=>({formId:e||""}),[e]),c=h.useCallback(()=>a(n),[n,a]);return se({element:d,widgetMgr:s,onFormCleared:c}),[r,a]},be=(s,t)=>{const{libConfig:{enforceDownloadInNewTab:e=!1}}=h.useContext(Ht);return h.useCallback(()=>{if(!s)return;const n=ae({enforceDownloadInNewTab:e,url:s,filename:t});n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n)},[s,e,t])},we=D("div",{target:"e45nyo0"})(),ft=D("div",{target:"e45nyo1"})(({theme:s})=>({height:s.sizes.largestElementHeight,width:"100%",background:s.colors.secondaryBg,borderRadius:s.radii.default,marginBottom:s.spacing.twoXS,display:"flex",alignItems:"center",position:"relative",paddingLeft:s.spacing.xs,paddingRight:s.spacing.sm,border:s.colors.widgetBorderColor?`${s.sizes.borderWidth} solid ${s.colors.widgetBorderColor}`:void 0})),Se=D("div",{target:"e45nyo2"})({flex:1}),Ce=D("div",{target:"e45nyo3"})(({show:s})=>({display:s?"block":"none"})),Ee=D("span",{target:"e45nyo4"})(({theme:s,isPlayingOrRecording:t})=>({margin:s.spacing.sm,fontFamily:s.fonts.monospace,color:t?s.colors.bodyText:s.colors.fadedText60,backgroundColor:s.colors.secondaryBg,fontSize:s.fontSizes.sm})),Rt=D("div",{target:"e45nyo5"})({width:"100%",textAlign:"center",overflow:"hidden"}),Pt=D("span",{target:"e45nyo6"})(({theme:s})=>({color:s.colors.bodyText})),Re=D("a",{target:"e45nyo7"})(({theme:s})=>({color:s.colors.link,textDecoration:s.linkUnderline?"underline":"none"})),Pe=D("div",{target:"e45nyo8"})(({theme:s})=>({height:s.sizes.largestElementHeight,display:"flex",justifyContent:"center",alignItems:"center"})),De=D("div",{target:"e45nyo9"})(({theme:s})=>{const t="0.625em";return{opacity:.2,width:"100%",height:t,backgroundSize:t,backgroundImage:`radial-gradient(${s.colors.fadedText10} 40%, transparent 40%)`,backgroundRepeat:"repeat"}}),xe=D("span",{target:"e45nyo10"})(({theme:s})=>({"& > button":{color:s.colors.primary,padding:s.spacing.threeXS},"& > button:hover, & > button:focus":{color:s.colors.red}})),Ae=D("span",{target:"e45nyo11"})(({theme:s})=>({"& > button":{padding:s.spacing.threeXS,color:s.colors.fadedText60},"& > button:hover, & > button:focus":{color:s.colors.bodyText}})),Dt=D("span",{target:"e45nyo12"})(({theme:s})=>({"& > button":{padding:s.spacing.threeXS,color:s.colors.fadedText60},"& > button:hover, & > button:focus":{color:s.colors.bodyText}})),nt=D("div",{target:"e45nyo13"})(({theme:s})=>({display:"flex",justifyContent:"center",alignItems:"center",flexGrow:0,flexShrink:1,padding:s.spacing.xs,gap:s.spacing.twoXS,marginRight:s.spacing.twoXS})),Te=D("div",{target:"e45nyo14"})(({theme:s})=>({marginLeft:s.spacing.sm})),We=D(Vt,{target:"e45nyo15"})(({theme:s})=>({fontSize:s.fontSizes.sm,width:s.sizes.spinnerSize,height:s.sizes.spinnerSize,borderWidth:s.sizes.spinnerThickness,justifyContents:"center",padding:s.spacing.none,margin:s.spacing.none,borderColor:s.colors.borderColor,borderTopColor:s.colors.secondary,flexGrow:0,flexShrink:0})),Me=()=>N(Rt,{children:[v(Pt,{children:"This app would like to use your microphone."})," ",v(Re,{href:jt,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]}),ke=h.memo(Me),Oe=()=>v(Pe,{children:v(De,{})}),Ie=h.memo(Oe),Le=4,Be=4,Ne=4,Ue=8,Fe=0,G="00:00",gt=s=>{const t=Math.floor(s/1e3),e=Math.floor(t/60),i=Math.floor(e/60),n=t%60,r=e%60,o=n.toString().padStart(2,"0"),a=r.toString().padStart(2,"0"),d=i.toString().padStart(2,"0");return e<60?`${a}:${o}`:`${d}:${a}:${o}`},_=({onClick:s,disabled:t,ariaLabel:e,iconContent:i})=>v(qt,{kind:Gt.BORDERLESS_ICON,onClick:s,disabled:t,"aria-label":e,containerWidth:!0,"data-testid":"stAudioInputActionButton",children:v(Xt,{content:i,size:"lg",color:"inherit"})}),ze=({disabled:s,stopRecording:t})=>v(xe,{children:v(_,{onClick:t,disabled:s,ariaLabel:"Stop recording",iconContent:St})}),_e=({disabled:s,isPlaying:t,onClickPlayPause:e})=>v(Dt,{children:t?v(_,{onClick:e,disabled:s,ariaLabel:"Pause",iconContent:yt}):v(_,{onClick:e,disabled:s,ariaLabel:"Play",iconContent:bt})}),$e=({disabled:s,startRecording:t})=>v(Ae,{children:v(_,{onClick:t,disabled:s,ariaLabel:"Record",iconContent:vt})}),He=({onClick:s})=>v(Dt,{children:v(_,{disabled:!1,onClick:s,ariaLabel:"Reset",iconContent:wt})}),Ve=({disabled:s,isRecording:t,isPlaying:e,isUploading:i,isError:n,recordingUrlExists:r,startRecording:o,stopRecording:a,onClickPlayPause:d,onClear:c})=>n?v(nt,{children:v(He,{onClick:c})}):i?v(nt,{children:v(We,{"aria-label":"Uploading"})}):N(nt,{children:[t?v(ze,{disabled:s,stopRecording:a}):v($e,{disabled:s,startRecording:o}),r&&v(_e,{disabled:s,isPlaying:e,onClickPlayPause:d})]}),je=h.memo(Ve),Ge=Yt.getLogger("convertAudioToWav");async function Xe(s){const t=new window.AudioContext,e=await s.arrayBuffer();let i;try{i=await t.decodeAudioData(e)}catch(m){Ge.error(m);return}const n=44,r=i.numberOfChannels,o=i.sampleRate,a=i.length*r*2+n,d=new ArrayBuffer(a),c=new DataView(d),l={0:{type:"string",value:"RIFF"},4:{type:"uint32",value:a-8},8:{type:"string",value:"WAVE"},12:{type:"string",value:"fmt "},16:{type:"uint32",value:16},20:{type:"uint16",value:1},22:{type:"uint16",value:r},24:{type:"uint32",value:o},28:{type:"uint32",value:o*r*2},32:{type:"uint16",value:r*2},34:{type:"uint16",value:16},36:{type:"string",value:"data"},40:{type:"uint32",value:i.length*r*2}};Object.entries(l).forEach(([m,{type:f,value:b}])=>{const g=parseInt(m,10);f==="string"?qe(c,g,b):f==="uint32"?c.setUint32(g,b,!0):f==="uint16"&&c.setUint16(g,b,!0)});let p=n;for(let m=0;m<i.length;m++)for(let f=0;f<r;f++){const b=Math.max(-1,Math.min(1,i.getChannelData(f)[m]));c.setInt16(p,b*32767,!0),p+=2}const u=new Uint8Array(d);return new Blob([u],{type:"audio/wav"})}function qe(s,t,e){for(let i=0;i<e.length;i++)s.setUint8(t+i,e.charCodeAt(i))}const Ye=()=>v(Rt,{children:v(Pt,{children:"An error has occurred, please try again."})}),Ke=h.memo(Ye),Je=({element:s,uploadClient:t,widgetMgr:e,fragmentId:i,disabled:n})=>{const r=Kt(),o=oe(r),[a,d]=h.useState(null),c=h.useRef(null),[l,p]=st({widgetMgr:e,id:s.id,key:"deleteFileUrl",defaultValue:null}),[u,m]=h.useState(null),[f,b]=h.useState([]),[g,S]=h.useState(null),[y,x]=st({widgetMgr:e,id:s.id,key:"recordingUrl",defaultValue:null}),[,R]=h.useState(0),w=()=>{R(C=>C+1)},[A,T]=h.useState(G),[k,W]=st({widgetMgr:e,id:s.id,formId:s.formId,key:"recordingTime",defaultValue:G}),[O,F]=h.useState(!1),[L,xt]=h.useState(!1),[rt,At]=h.useState(!1),[Tt,ot]=h.useState(!1),[K,J]=h.useState(!1),at=s.id,I=s.formId,lt=h.useCallback(async C=>{ot(!0),q(I)&&e.setFormsWithUploadsInProgress(new Set([I]));let E;if(C.type==="audio/wav"?E=C:E=await Xe(C),!E){J(!0);return}const M=URL.createObjectURL(E),Bt=new Date().toISOString().slice(0,16).replace(":","-"),Nt=new File([E],`${Bt}_audio.wav`,{type:E.type});x(M),ye({files:[Nt],uploadClient:t,widgetMgr:e,widgetInfo:{id:at,formId:I},fragmentId:i}).then(({successfulUploads:Ut,failedUploads:Ft})=>{if(Ft.length>0){J(!0);return}const Z=Ut[0];Z&&Z.fileUrl.deleteUrl&&p(Z.fileUrl.deleteUrl)}).finally(()=>{q(I)&&e.setFormsWithUploadsInProgress(new Set),ot(!1)})},[x,t,e,at,I,i,p]),B=h.useCallback(({updateWidgetManager:C,deleteFile:E})=>{X(a)||X(l)||(x(null),a.empty(),E&&t.deleteFile(l),p(null),T(G),W(G),C&&e.setFileUploaderStateValue(s,{},{fromUi:!0},i),F(!1),q(y)&&URL.revokeObjectURL(y))},[l,y,t,a,s,e,i,W,x,p]);h.useEffect(()=>{if(X(I))return;const C=new ne;return C.manageFormClearListener(e,I,()=>B({updateWidgetManager:!0,deleteFile:!1})),()=>C.disconnect()},[I,B,e]);const ct=h.useCallback(()=>{if(c.current===null)return;const C=z.create({container:c.current,waveColor:y?tt(r.colors.fadedText40,r.colors.secondaryBg):r.colors.primary,progressColor:r.colors.bodyText,height:Jt(r.sizes.largestElementHeight)-2*Le,barWidth:Be,barGap:Ne,barRadius:Ue,cursorWidth:Fe,url:y??void 0});C.on("timeupdate",M=>{T(gt(M*1e3))}),C.on("pause",()=>{w()});const E=C.registerPlugin(Y.create({scrollingWaveform:!1,renderRecordedAudio:!0}));return E.on("record-end",M=>{lt(M)}),E.on("record-progress",M=>{W(gt(M))}),d(C),m(E),()=>{C&&C.destroy(),E&&E.destroy()}},[lt]);h.useEffect(()=>ct(),[ct]),h.useEffect(()=>{Qt(o,r)||a?.setOptions({waveColor:y?tt(r.colors.fadedText40,r.colors.secondaryBg):r.colors.primary,progressColor:r.colors.bodyText})},[r,o,y,a]);const Wt=h.useCallback(()=>{a&&(a.playPause(),F(!0),w())},[a]),Mt=h.useCallback(async()=>{let C=g;rt||(await navigator.mediaDevices.getUserMedia({audio:!0}).then(()=>Y.getAvailableAudioDevices().then(E=>{if(b(E),E.length>0){const{deviceId:M}=E[0];S(M),C=M}})).catch(E=>{xt(!0)}),At(!0)),!(!u||!C||!a)&&(a.setOptions({waveColor:r.colors.primary}),y&&B({updateWidgetManager:!1,deleteFile:!0}),u.startRecording({deviceId:C}).then(()=>{w()}))},[g,u,r,a,y,B,rt]),kt=h.useCallback(()=>{u&&(u.stopRecording(),a?.setOptions({waveColor:tt(r.colors.fadedText40,r.colors.secondaryBg)}))},[u,a,r]),Ot=be(y,"recording.wav"),Q=!!u?.isRecording(),dt=!!a?.isPlaying(),It=Q||dt,ht=!Q&&!y&&!L,Lt=L||ht||K;return N(we,{className:"stAudioInput","data-testid":"stAudioInput",children:[v(ie,{label:s.label,disabled:n,labelVisibility:Zt(s.labelVisibility?.value),children:s.help&&v(Te,{children:v(te,{content:s.help,placement:ee.TOP})})}),N(ft,{children:[N(re,{isFullScreen:!1,disableFullscreenMode:!0,target:ft,children:[y&&v(pt,{label:"Download as WAV",icon:le,onClick:()=>Ot()}),l&&v(pt,{label:"Clear recording",icon:ce,onClick:()=>B({updateWidgetManager:!0,deleteFile:!0})})]}),v(je,{isRecording:Q,isPlaying:dt,isUploading:Tt,isError:K,recordingUrlExists:!!y,startRecording:Mt,stopRecording:kt,onClickPlayPause:Wt,onClear:()=>{B({updateWidgetManager:!1,deleteFile:!0}),J(!1)},disabled:n||L}),N(Se,{children:[K&&v(Ke,{}),ht&&v(Ie,{}),L&&v(ke,{}),v(Ce,{"data-testid":"stAudioInputWaveSurfer",ref:c,show:!Lt})]}),v(Ee,{isPlayingOrRecording:It,"data-testid":"stAudioInputWaveformTimeCode",children:O?A:k})]})]})},ri=h.memo(Je);export{ri as default};
@@ -1 +1 @@
1
- import{r as l,E as _,_ as G,s as p,B as dt,z as $,j as o,b9 as Y,bu as ct,C as S,bp as J,b4 as q,bo as E,a_ as pt,bI as ut,bG as j,bj as gt,bJ as v,bs as ht,F as Q,aP as ft,bg as mt,bK as yt,M as H,bl as Ct,bk as bt}from"./index.EAQB8Tuq.js";import{g as vt,C as It,I as xt,F as M,E as wt,a as St,s as Ft,u as Ut,b as zt}from"./FileHelper.BKIVKQnB.js";import{I as Et}from"./InputInstructions.CAp9mFM6.js";import{i as Tt}from"./inputUtils.CptNuJwn.js";import{u as Bt,T as Dt}from"./useTextInputAutoExpand.CwuIWHHK.js";import{E as Rt}from"./ErrorOutline.esm.CaUhmcG6.js";import{U as Z}from"./UploadFileInfo.C-jY39rj.js";import"./base-input.C-H36mFE.js";var tt=l.forwardRef(function(t,e){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return l.createElement(_,G({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),l.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),l.createElement("path",{d:"M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5a2.5 2.5 0 015 0v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5a2.5 2.5 0 005 0V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z"}))});tt.displayName="AttachFile";var et=l.forwardRef(function(t,e){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return l.createElement(_,G({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),l.createElement("rect",{width:24,height:24,fill:"none"}),l.createElement("path",{d:"M3 5.51v3.71c0 .46.31.86.76.97L11 12l-7.24 1.81c-.45.11-.76.51-.76.97v3.71c0 .72.73 1.2 1.39.92l15.42-6.49c.82-.34.82-1.5 0-1.84L4.39 4.58C3.73 4.31 3 4.79 3 5.51z"}))});et.displayName="Send";const Ht=p("div",{target:"e1togvvn0"})("border:none;position:relative;display:flex;"),Lt=p("div",{target:"e1togvvn1"})(({theme:t,extended:e})=>({border:`${t.sizes.borderWidth} solid`,borderColor:t.colors.widgetBorderColor??t.colors.transparent,borderRadius:t.radii.chatInput,backgroundColor:t.colors.secondaryBg,position:"relative",flexGrow:1,display:"flex",alignItems:"center",paddingLeft:t.spacing.lg,maxHeight:e?"none":t.sizes.minElementHeight,gap:t.spacing.sm,overflow:"hidden",":focus-within":{borderColor:t.colors.primary}})),kt=p("button",{target:"e1togvvn2"})(({theme:t,disabled:e,extended:r})=>{const d=dt(t),[f,c]=d?[t.colors.gray60,t.colors.gray80]:[t.colors.gray80,t.colors.gray40];return{border:"none",backgroundColor:t.colors.transparent,borderTopRightRadius:r?"0":t.radii.chatInput,borderTopLeftRadius:r?t.radii.default:"0",borderBottomRightRadius:t.radii.chatInput,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:t.lineHeights.none,margin:t.spacing.none,padding:t.spacing.sm,color:e?f:c,pointerEvents:"auto","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{backgroundColor:d?t.colors.gray10:t.colors.gray90},"&:hover":{color:t.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{backgroundColor:t.colors.transparent,borderColor:t.colors.transparent,color:t.colors.gray,cursor:"not-allowed"}}}),Mt=p("div",{target:"e1togvvn3"})(({theme:t})=>({display:"flex",alignItems:"flex-end",height:"100%",position:"absolute",right:0,marginBottom:`-${t.sizes.borderWidth}`,pointerEvents:"none"})),$t=p("div",{target:"e1togvvn4"})(({theme:t})=>({position:"absolute",bottom:"0px",right:`calc(${t.iconSizes.xl} + 2 * ${t.spacing.sm} + ${t.spacing.sm})`})),Vt=p("div",{target:"e15560op0"})(({theme:t,height:e})=>({backgroundColor:t.colors.transparent,position:"absolute",left:0,bottom:0,minHeight:`max(${t.sizes.emptyDropdownHeight}, ${e})`,width:"100%",zIndex:t.zIndices.priority})),Wt=p("div",{target:"e15560op1"})(({theme:t,height:e})=>({border:`${t.sizes.borderWidth} solid`,borderColor:t.colors.primary,borderRadius:t.radii.chatInput,backgroundColor:t.colors.secondaryBg,color:t.colors.primary,display:"flex",alignItems:"center",justifyContent:"center",height:e,width:"100%",fontWeight:t.fontWeights.bold})),Nt=p("div",{target:"e15560op2"})(({theme:t,disabled:e})=>({display:"flex",alignItems:"top",height:"100%",marginTop:`-${t.sizes.borderWidth}`,cursor:e?"not-allowed":"auto"})),At=p("div",{target:"e15560op3"})(({disabled:t})=>({pointerEvents:t?"none":"auto"})),Pt=p("div",{target:"e15560op4"})(({theme:t})=>({marginTop:"0.625em",marginLeft:t.spacing.sm,height:t.spacing.xl,width:t.sizes.borderWidth,backgroundColor:t.colors.fadedText20})),Kt=p("div",{target:"e15560op5"})(({theme:t})=>({left:0,right:0,lineHeight:t.lineHeights.tight,paddingLeft:t.spacing.sm,paddingRight:t.spacing.sm,overflowX:"auto"})),Ot=p("div",{target:"e15560op6"})({display:"flex"}),Xt=p("div",{target:"e15560op7"})({flex:"0 0 auto"}),jt=p("div",{target:"e15560op8"})(({theme:t})=>({display:"flex",alignItems:"center",padding:t.spacing.sm,gap:t.spacing.twoXS})),_t=p("div",{target:"e15560op9"})(({theme:t})=>({color:t.colors.fadedText60})),Gt=p("div",{target:"e15560op10"})(({theme:t,fileStatus:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:e.type==="uploaded"?t.colors.bodyText:t.colors.fadedText60})),Yt=p("div",{target:"e15560op11"})(({theme:t})=>({marginRight:t.spacing.md,color:t.colors.fadedText60})),Jt=p("small",{target:"e15560op12"})(({theme:t})=>({display:"flex",alignItems:"center",maxHeight:t.sizes.smallElementHeight,color:t.colors.fadedText60,"& :hover":{color:t.colors.bodyText}}));function qt({children:t,content:e}){const r=$();return o(ct,{content:e,placement:Y.TOP,overrides:{Body:{style:{top:`-${r.sizes.minElementHeight}`}}},children:t})}const Qt=({fileInfo:t})=>{const e=$(),{type:r}=t.status;switch(r){case"uploading":return o(ut,{usingCustomTheme:!1,"data-testid":"stChatInputFileIconSpinner",size:"lg",margin:"0",padding:"0"});case"error":return o(qt,{content:t.status.errorMessage,children:o(E,{color:e.colors.red,content:Rt,size:"lg"})});case"uploaded":return o(E,{content:xt,size:"lg"});default:return pt(r),null}},Zt=({fileInfo:t,onDelete:e})=>S(jt,{className:"stChatInputFile","data-testid":"stChatInputFile",children:[o(_t,{children:o(Qt,{fileInfo:t})}),o(Gt,{className:"stChatInputFileName","data-testid":"stChatInputFileName",title:t.name,fileStatus:t.status,children:t.name}),o(Yt,{children:vt(t.size,M.Byte)}),o(Jt,{"data-testid":"stChatInputDeleteBtn",children:o(J,{onClick:()=>e(t.id),kind:q.MINIMAL,children:o(E,{content:It,size:"lg"})})})]}),te=l.memo(Zt),ee=({items:t,onDelete:e})=>o(Kt,{"data-testid":"stChatUploadedFiles",children:o(Ot,{children:t.map(r=>o(Xt,{children:o(te,{fileInfo:r,onDelete:e})},r.id))})}),oe=l.memo(ee),ne=({getNextLocalFileId:t,addFiles:e,updateFile:r,uploadClient:d,element:f,onUploadProgress:c,onUploadComplete:C})=>(y,m)=>{const g=j.CancelToken.source(),u=new Z(m.name,m.size,t(),{type:"uploading",cancelToken:g,progress:1});e([u]),d.uploadFile({formId:"",...f},y.uploadUrl,m,h=>c(h,u.id),g.token).then(()=>C(u.id,y)).catch(h=>{j.isCancel(h)||r(u.id,u.setStatus({type:"error",errorMessage:h?h.toString():"Unknown error"}))})},ae=({acceptMultipleFiles:t,maxFileSize:e,uploadClient:r,uploadFile:d,addFiles:f,getNextLocalFileId:c,deleteExistingFiles:C,onUploadComplete:y})=>(m,g)=>{if(!t&&m.length===0&&g.length>1){const u=g.findIndex(h=>h.errors?.[0].code===wt.TooManyFiles);u>=0&&(m.push(g[u].file),g.splice(u,1))}if(!t&&m.length>0&&C(),r.fetchFileURLs(m).then(u=>{gt(u,m).forEach(([h,T])=>{d(h,T)})}).catch(u=>{f(m.map(h=>new Z(h.name,h.size,c(),{type:"error",errorMessage:u})))}),g.length>0){const u=g.map(h=>St(h,c(),e));f(u)}y()},re=({getRootProps:t,getInputProps:e,acceptFile:r,disabled:d,theme:f})=>S(Nt,{disabled:d,children:[S(At,{"data-testid":"stChatInputFileUploadButton",disabled:d,...t(),children:[o("input",{...e()}),o(ht,{content:`Upload or drag and drop ${r===v.Multiple?"files":"a file"}`,placement:Y.TOP,onMouseEnterDelay:500,children:o(J,{kind:q.MINIMAL,disabled:d,children:o(E,{content:tt,size:"lg",color:d?f.colors.fadedText40:f.colors.fadedText60})})})]}),o(Pt,{})]}),ie=l.memo(re),se=({getRootProps:t,getInputProps:e,acceptFile:r,inputHeight:d})=>S(Q,{children:[o(Vt,{height:d,...t(),children:o("input",{...e()})}),o(Wt,{height:d,children:`Drag and drop ${r===v.Multiple?"files":"a file"} here`})]}),le=l.memo(se),L=(t,e,r)=>r.map(d=>d.id===t?e:d),k=(t,e)=>e.find(r=>r.id===t);function de({disabled:t,element:e,widgetMgr:r,fragmentId:d,uploadClient:f}){const c=$(),{placeholder:C,maxChars:y}=e,m=l.useRef(0),g=l.useRef(null),[u,h]=ft(),{innerWidth:T,innerHeight:V}=mt(),[F,B]=l.useState(e.default),[I,x]=l.useState([]),[U,D]=l.useState(!1),w=Bt({textareaRef:g,dependencies:[C]}),R=l.useMemo(()=>I.some(n=>n.status.type==="uploading")?!1:F!==""||I.length>0,[I,F]),b=yt(e.acceptFile),W=Ft(e.maxUploadSizeMb,M.Megabyte,M.Byte),N=l.useCallback(n=>x(i=>[...i,...n]),[]),A=l.useCallback(n=>{x(i=>{const s=k(n,i);return H(s)?i:(s.status.type==="uploading"&&s.status.cancelToken.cancel(),s.status.type==="uploaded"&&s.status.fileUrls.deleteUrl&&f.deleteFile(s.status.fileUrls.deleteUrl),i.filter(a=>a.id!==n))})},[f]),ot=()=>{const n=I.filter(i=>i.status.type==="uploaded").map(i=>{const{name:s,size:a,status:z}=i,{fileId:st,fileUrls:lt}=z;return new Ct({fileId:st,fileUrls:lt,name:s,size:a})});return new bt({uploadedFileInfo:n})},P=()=>m.current++,nt=ae({acceptMultipleFiles:b===v.Multiple,maxFileSize:W,uploadClient:f,uploadFile:ne({getNextLocalFileId:P,addFiles:N,updateFile:(n,i)=>{x(s=>L(n,i,s))},uploadClient:f,element:e,onUploadProgress:(n,i)=>{x(s=>{const a=k(i,s);if(H(a)||a.status.type!=="uploading")return s;const z=Math.round(n.loaded*100/n.total);return a.status.progress===z?s:L(i,a.setStatus({type:"uploading",cancelToken:a.status.cancelToken,progress:z}),s)})},onUploadComplete:(n,i)=>{x(s=>{const a=k(n,s);return H(a)||a.status.type!=="uploading"?s:L(a.id,a.setStatus({type:"uploaded",fileId:i.fileId,fileUrls:i}),s)})}}),addFiles:N,getNextLocalFileId:P,deleteExistingFiles:()=>I.forEach(n=>A(n.id)),onUploadComplete:()=>{g.current&&g.current.focus()}}),{getRootProps:K,getInputProps:O}=Ut({onDrop:nt,multiple:b===v.Multiple,accept:zt(e.fileType),maxSize:W}),X=()=>{if(g.current&&g.current.focus(),!R||t)return;const n={data:F,fileUploaderState:ot()};r.setChatInputValue(e,n,{fromUi:!0},d),x([]),B("")},at=n=>{const{metaKey:i,ctrlKey:s,shiftKey:a}=n;Tt(n)&&!a&&!s&&!i&&(n.preventDefault(),X())},rt=n=>{const{value:i}=n.target;y!==0&&i.length>y||(B(i),w.updateScrollHeight())};l.useEffect(()=>{if(e.setValue){e.setValue=!1;const n=e.value||"";B(n)}},[e]),l.useEffect(()=>{const n=a=>{a.preventDefault(),a.stopPropagation(),!U&&a.dataTransfer?.types.includes("Files")&&D(!0)},i=a=>{a.preventDefault(),a.stopPropagation(),U&&(a.clientX<=0&&a.clientY<=0||a.clientX>=T&&a.clientY>=V)&&D(!1)},s=a=>{a.preventDefault(),a.stopPropagation(),U&&D(!1)};return window.addEventListener("dragover",n),window.addEventListener("drop",s),window.addEventListener("dragleave",i),()=>{window.removeEventListener("dragover",n),window.removeEventListener("drop",s),window.removeEventListener("dragleave",i)}},[U,T,V]);const it=b!==v.None&&U;return S(Q,{children:[b===v.None?null:o(oe,{items:[...I],onDelete:A}),o(Ht,{className:"stChatInput","data-testid":"stChatInput",ref:h,children:it?o(le,{getRootProps:K,getInputProps:O,acceptFile:b,inputHeight:w.height}):S(Lt,{extended:w.isExtended,children:[b===v.None?null:o(ie,{getRootProps:K,getInputProps:O,acceptFile:b,disabled:t,theme:c}),o(Dt,{inputRef:g,value:F,placeholder:C,onChange:rt,onKeyDown:at,"aria-label":C,disabled:t,rows:1,overrides:{Root:{style:{minHeight:c.sizes.minElementHeight,outline:"none",borderLeftWidth:"0",borderRightWidth:"0",borderTopWidth:"0",borderBottomWidth:"0",borderTopLeftRadius:"0",borderTopRightRadius:"0",borderBottomRightRadius:"0",borderBottomLeftRadius:"0"}},Input:{props:{"data-testid":"stChatInputTextArea"},style:{fontWeight:c.fontWeights.normal,lineHeight:c.lineHeights.inputWidget,"::placeholder":{color:c.colors.fadedText60},height:w.height,maxHeight:w.maxHeight,paddingLeft:c.spacing.none,paddingBottom:c.spacing.sm,paddingTop:c.spacing.sm,paddingRight:`calc(${c.iconSizes.xl} + 2 * ${c.spacing.sm} + ${c.spacing.sm})`}}}}),u>c.breakpoints.hideWidgetDetails&&o($t,{children:o(Et,{dirty:R,value:F,maxLength:y,type:"chat",inForm:!1})}),o(Mt,{children:o(kt,{onClick:X,disabled:!R||t,extended:w.isExtended,"data-testid":"stChatInputSubmitButton",children:o(E,{content:et,size:"xl",color:"inherit"})})})]})})]})}const Ce=l.memo(de);export{Ce as default};
1
+ import{r as l,E as _,_ as G,s as p,B as dt,z as $,j as o,b9 as Y,bu as ct,C as S,bp as J,b4 as q,bo as E,a_ as pt,bI as ut,bG as j,bj as gt,bJ as v,bs as ht,F as Q,aP as ft,bg as mt,bK as yt,M as H,bl as Ct,bk as bt}from"./index.SCzIN5SB.js";import{g as vt,C as It,I as xt,F as M,E as wt,a as St,s as Ft,u as Ut,b as zt}from"./FileHelper.BYzZxqTl.js";import{I as Et}from"./InputInstructions.DfmDQyfZ.js";import{i as Tt}from"./inputUtils.CptNuJwn.js";import{u as Bt,T as Dt}from"./useTextInputAutoExpand.Dm8V44AL.js";import{E as Rt}from"./ErrorOutline.esm.77fHhxmf.js";import{U as Z}from"./UploadFileInfo.C-jY39rj.js";import"./base-input.DJLL2PiI.js";var tt=l.forwardRef(function(t,e){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return l.createElement(_,G({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),l.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),l.createElement("path",{d:"M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5a2.5 2.5 0 015 0v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5a2.5 2.5 0 005 0V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z"}))});tt.displayName="AttachFile";var et=l.forwardRef(function(t,e){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return l.createElement(_,G({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),l.createElement("rect",{width:24,height:24,fill:"none"}),l.createElement("path",{d:"M3 5.51v3.71c0 .46.31.86.76.97L11 12l-7.24 1.81c-.45.11-.76.51-.76.97v3.71c0 .72.73 1.2 1.39.92l15.42-6.49c.82-.34.82-1.5 0-1.84L4.39 4.58C3.73 4.31 3 4.79 3 5.51z"}))});et.displayName="Send";const Ht=p("div",{target:"e1togvvn0"})("border:none;position:relative;display:flex;"),Lt=p("div",{target:"e1togvvn1"})(({theme:t,extended:e})=>({border:`${t.sizes.borderWidth} solid`,borderColor:t.colors.widgetBorderColor??t.colors.transparent,borderRadius:t.radii.chatInput,backgroundColor:t.colors.secondaryBg,position:"relative",flexGrow:1,display:"flex",alignItems:"center",paddingLeft:t.spacing.lg,maxHeight:e?"none":t.sizes.minElementHeight,gap:t.spacing.sm,overflow:"hidden",":focus-within":{borderColor:t.colors.primary}})),kt=p("button",{target:"e1togvvn2"})(({theme:t,disabled:e,extended:r})=>{const d=dt(t),[f,c]=d?[t.colors.gray60,t.colors.gray80]:[t.colors.gray80,t.colors.gray40];return{border:"none",backgroundColor:t.colors.transparent,borderTopRightRadius:r?"0":t.radii.chatInput,borderTopLeftRadius:r?t.radii.default:"0",borderBottomRightRadius:t.radii.chatInput,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:t.lineHeights.none,margin:t.spacing.none,padding:t.spacing.sm,color:e?f:c,pointerEvents:"auto","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{backgroundColor:d?t.colors.gray10:t.colors.gray90},"&:hover":{color:t.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{backgroundColor:t.colors.transparent,borderColor:t.colors.transparent,color:t.colors.gray,cursor:"not-allowed"}}}),Mt=p("div",{target:"e1togvvn3"})(({theme:t})=>({display:"flex",alignItems:"flex-end",height:"100%",position:"absolute",right:0,marginBottom:`-${t.sizes.borderWidth}`,pointerEvents:"none"})),$t=p("div",{target:"e1togvvn4"})(({theme:t})=>({position:"absolute",bottom:"0px",right:`calc(${t.iconSizes.xl} + 2 * ${t.spacing.sm} + ${t.spacing.sm})`})),Vt=p("div",{target:"e15560op0"})(({theme:t,height:e})=>({backgroundColor:t.colors.transparent,position:"absolute",left:0,bottom:0,minHeight:`max(${t.sizes.emptyDropdownHeight}, ${e})`,width:"100%",zIndex:t.zIndices.priority})),Wt=p("div",{target:"e15560op1"})(({theme:t,height:e})=>({border:`${t.sizes.borderWidth} solid`,borderColor:t.colors.primary,borderRadius:t.radii.chatInput,backgroundColor:t.colors.secondaryBg,color:t.colors.primary,display:"flex",alignItems:"center",justifyContent:"center",height:e,width:"100%",fontWeight:t.fontWeights.bold})),Nt=p("div",{target:"e15560op2"})(({theme:t,disabled:e})=>({display:"flex",alignItems:"top",height:"100%",marginTop:`-${t.sizes.borderWidth}`,cursor:e?"not-allowed":"auto"})),At=p("div",{target:"e15560op3"})(({disabled:t})=>({pointerEvents:t?"none":"auto"})),Pt=p("div",{target:"e15560op4"})(({theme:t})=>({marginTop:"0.625em",marginLeft:t.spacing.sm,height:t.spacing.xl,width:t.sizes.borderWidth,backgroundColor:t.colors.fadedText20})),Kt=p("div",{target:"e15560op5"})(({theme:t})=>({left:0,right:0,lineHeight:t.lineHeights.tight,paddingLeft:t.spacing.sm,paddingRight:t.spacing.sm,overflowX:"auto"})),Ot=p("div",{target:"e15560op6"})({display:"flex"}),Xt=p("div",{target:"e15560op7"})({flex:"0 0 auto"}),jt=p("div",{target:"e15560op8"})(({theme:t})=>({display:"flex",alignItems:"center",padding:t.spacing.sm,gap:t.spacing.twoXS})),_t=p("div",{target:"e15560op9"})(({theme:t})=>({color:t.colors.fadedText60})),Gt=p("div",{target:"e15560op10"})(({theme:t,fileStatus:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:e.type==="uploaded"?t.colors.bodyText:t.colors.fadedText60})),Yt=p("div",{target:"e15560op11"})(({theme:t})=>({marginRight:t.spacing.md,color:t.colors.fadedText60})),Jt=p("small",{target:"e15560op12"})(({theme:t})=>({display:"flex",alignItems:"center",maxHeight:t.sizes.smallElementHeight,color:t.colors.fadedText60,"& :hover":{color:t.colors.bodyText}}));function qt({children:t,content:e}){const r=$();return o(ct,{content:e,placement:Y.TOP,overrides:{Body:{style:{top:`-${r.sizes.minElementHeight}`}}},children:t})}const Qt=({fileInfo:t})=>{const e=$(),{type:r}=t.status;switch(r){case"uploading":return o(ut,{usingCustomTheme:!1,"data-testid":"stChatInputFileIconSpinner",size:"lg",margin:"0",padding:"0"});case"error":return o(qt,{content:t.status.errorMessage,children:o(E,{color:e.colors.red,content:Rt,size:"lg"})});case"uploaded":return o(E,{content:xt,size:"lg"});default:return pt(r),null}},Zt=({fileInfo:t,onDelete:e})=>S(jt,{className:"stChatInputFile","data-testid":"stChatInputFile",children:[o(_t,{children:o(Qt,{fileInfo:t})}),o(Gt,{className:"stChatInputFileName","data-testid":"stChatInputFileName",title:t.name,fileStatus:t.status,children:t.name}),o(Yt,{children:vt(t.size,M.Byte)}),o(Jt,{"data-testid":"stChatInputDeleteBtn",children:o(J,{onClick:()=>e(t.id),kind:q.MINIMAL,children:o(E,{content:It,size:"lg"})})})]}),te=l.memo(Zt),ee=({items:t,onDelete:e})=>o(Kt,{"data-testid":"stChatUploadedFiles",children:o(Ot,{children:t.map(r=>o(Xt,{children:o(te,{fileInfo:r,onDelete:e})},r.id))})}),oe=l.memo(ee),ne=({getNextLocalFileId:t,addFiles:e,updateFile:r,uploadClient:d,element:f,onUploadProgress:c,onUploadComplete:C})=>(y,m)=>{const g=j.CancelToken.source(),u=new Z(m.name,m.size,t(),{type:"uploading",cancelToken:g,progress:1});e([u]),d.uploadFile({formId:"",...f},y.uploadUrl,m,h=>c(h,u.id),g.token).then(()=>C(u.id,y)).catch(h=>{j.isCancel(h)||r(u.id,u.setStatus({type:"error",errorMessage:h?h.toString():"Unknown error"}))})},ae=({acceptMultipleFiles:t,maxFileSize:e,uploadClient:r,uploadFile:d,addFiles:f,getNextLocalFileId:c,deleteExistingFiles:C,onUploadComplete:y})=>(m,g)=>{if(!t&&m.length===0&&g.length>1){const u=g.findIndex(h=>h.errors?.[0].code===wt.TooManyFiles);u>=0&&(m.push(g[u].file),g.splice(u,1))}if(!t&&m.length>0&&C(),r.fetchFileURLs(m).then(u=>{gt(u,m).forEach(([h,T])=>{d(h,T)})}).catch(u=>{f(m.map(h=>new Z(h.name,h.size,c(),{type:"error",errorMessage:u})))}),g.length>0){const u=g.map(h=>St(h,c(),e));f(u)}y()},re=({getRootProps:t,getInputProps:e,acceptFile:r,disabled:d,theme:f})=>S(Nt,{disabled:d,children:[S(At,{"data-testid":"stChatInputFileUploadButton",disabled:d,...t(),children:[o("input",{...e()}),o(ht,{content:`Upload or drag and drop ${r===v.Multiple?"files":"a file"}`,placement:Y.TOP,onMouseEnterDelay:500,children:o(J,{kind:q.MINIMAL,disabled:d,children:o(E,{content:tt,size:"lg",color:d?f.colors.fadedText40:f.colors.fadedText60})})})]}),o(Pt,{})]}),ie=l.memo(re),se=({getRootProps:t,getInputProps:e,acceptFile:r,inputHeight:d})=>S(Q,{children:[o(Vt,{height:d,...t(),children:o("input",{...e()})}),o(Wt,{height:d,children:`Drag and drop ${r===v.Multiple?"files":"a file"} here`})]}),le=l.memo(se),L=(t,e,r)=>r.map(d=>d.id===t?e:d),k=(t,e)=>e.find(r=>r.id===t);function de({disabled:t,element:e,widgetMgr:r,fragmentId:d,uploadClient:f}){const c=$(),{placeholder:C,maxChars:y}=e,m=l.useRef(0),g=l.useRef(null),[u,h]=ft(),{innerWidth:T,innerHeight:V}=mt(),[F,B]=l.useState(e.default),[I,x]=l.useState([]),[U,D]=l.useState(!1),w=Bt({textareaRef:g,dependencies:[C]}),R=l.useMemo(()=>I.some(n=>n.status.type==="uploading")?!1:F!==""||I.length>0,[I,F]),b=yt(e.acceptFile),W=Ft(e.maxUploadSizeMb,M.Megabyte,M.Byte),N=l.useCallback(n=>x(i=>[...i,...n]),[]),A=l.useCallback(n=>{x(i=>{const s=k(n,i);return H(s)?i:(s.status.type==="uploading"&&s.status.cancelToken.cancel(),s.status.type==="uploaded"&&s.status.fileUrls.deleteUrl&&f.deleteFile(s.status.fileUrls.deleteUrl),i.filter(a=>a.id!==n))})},[f]),ot=()=>{const n=I.filter(i=>i.status.type==="uploaded").map(i=>{const{name:s,size:a,status:z}=i,{fileId:st,fileUrls:lt}=z;return new Ct({fileId:st,fileUrls:lt,name:s,size:a})});return new bt({uploadedFileInfo:n})},P=()=>m.current++,nt=ae({acceptMultipleFiles:b===v.Multiple,maxFileSize:W,uploadClient:f,uploadFile:ne({getNextLocalFileId:P,addFiles:N,updateFile:(n,i)=>{x(s=>L(n,i,s))},uploadClient:f,element:e,onUploadProgress:(n,i)=>{x(s=>{const a=k(i,s);if(H(a)||a.status.type!=="uploading")return s;const z=Math.round(n.loaded*100/n.total);return a.status.progress===z?s:L(i,a.setStatus({type:"uploading",cancelToken:a.status.cancelToken,progress:z}),s)})},onUploadComplete:(n,i)=>{x(s=>{const a=k(n,s);return H(a)||a.status.type!=="uploading"?s:L(a.id,a.setStatus({type:"uploaded",fileId:i.fileId,fileUrls:i}),s)})}}),addFiles:N,getNextLocalFileId:P,deleteExistingFiles:()=>I.forEach(n=>A(n.id)),onUploadComplete:()=>{g.current&&g.current.focus()}}),{getRootProps:K,getInputProps:O}=Ut({onDrop:nt,multiple:b===v.Multiple,accept:zt(e.fileType),maxSize:W}),X=()=>{if(g.current&&g.current.focus(),!R||t)return;const n={data:F,fileUploaderState:ot()};r.setChatInputValue(e,n,{fromUi:!0},d),x([]),B("")},at=n=>{const{metaKey:i,ctrlKey:s,shiftKey:a}=n;Tt(n)&&!a&&!s&&!i&&(n.preventDefault(),X())},rt=n=>{const{value:i}=n.target;y!==0&&i.length>y||(B(i),w.updateScrollHeight())};l.useEffect(()=>{if(e.setValue){e.setValue=!1;const n=e.value||"";B(n)}},[e]),l.useEffect(()=>{const n=a=>{a.preventDefault(),a.stopPropagation(),!U&&a.dataTransfer?.types.includes("Files")&&D(!0)},i=a=>{a.preventDefault(),a.stopPropagation(),U&&(a.clientX<=0&&a.clientY<=0||a.clientX>=T&&a.clientY>=V)&&D(!1)},s=a=>{a.preventDefault(),a.stopPropagation(),U&&D(!1)};return window.addEventListener("dragover",n),window.addEventListener("drop",s),window.addEventListener("dragleave",i),()=>{window.removeEventListener("dragover",n),window.removeEventListener("drop",s),window.removeEventListener("dragleave",i)}},[U,T,V]);const it=b!==v.None&&U;return S(Q,{children:[b===v.None?null:o(oe,{items:[...I],onDelete:A}),o(Ht,{className:"stChatInput","data-testid":"stChatInput",ref:h,children:it?o(le,{getRootProps:K,getInputProps:O,acceptFile:b,inputHeight:w.height}):S(Lt,{extended:w.isExtended,children:[b===v.None?null:o(ie,{getRootProps:K,getInputProps:O,acceptFile:b,disabled:t,theme:c}),o(Dt,{inputRef:g,value:F,placeholder:C,onChange:rt,onKeyDown:at,"aria-label":C,disabled:t,rows:1,overrides:{Root:{style:{minHeight:c.sizes.minElementHeight,outline:"none",borderLeftWidth:"0",borderRightWidth:"0",borderTopWidth:"0",borderBottomWidth:"0",borderTopLeftRadius:"0",borderTopRightRadius:"0",borderBottomRightRadius:"0",borderBottomLeftRadius:"0"}},Input:{props:{"data-testid":"stChatInputTextArea"},style:{fontWeight:c.fontWeights.normal,lineHeight:c.lineHeights.inputWidget,"::placeholder":{color:c.colors.fadedText60},height:w.height,maxHeight:w.maxHeight,paddingLeft:c.spacing.none,paddingBottom:c.spacing.sm,paddingTop:c.spacing.sm,paddingRight:`calc(${c.iconSizes.xl} + 2 * ${c.spacing.sm} + ${c.spacing.sm})`}}}}),u>c.breakpoints.hideWidgetDetails&&o($t,{children:o(Et,{dirty:R,value:F,maxLength:y,type:"chat",inForm:!1})}),o(Mt,{children:o(kt,{onClick:X,disabled:!R||t,extended:w.isExtended,"data-testid":"stChatInputSubmitButton",children:o(E,{content:et,size:"xl",color:"inherit"})})})]})})]})}const Ce=l.memo(de);export{Ce as default};
@@ -1 +1 @@
1
- import{r,aI as f,b4 as l,j as t,b5 as m,bp as B,b3 as b,b6 as p}from"./index.EAQB8Tuq.js";import{c as h}from"./createDownloadLinkElement.DZMwyjvU.js";function w(n,o,e){return h({enforceDownloadInNewTab:e,url:n.buildMediaURL(o),filename:""})}function D(n){const{disabled:o,element:e,widgetMgr:s,endpoints:a,fragmentId:d}=n,{libConfig:{enforceDownloadInNewTab:c=!1}}=r.useContext(f);let i=l.SECONDARY;e.type==="primary"?i=l.PRIMARY:e.type==="tertiary"&&(i=l.TERTIARY),r.useEffect(()=>{a.checkSourceUrlResponse(e.url,"Download Button")},[e.url,a]);const u=()=>{e.ignoreRerun||s.setTriggerValue(e,{fromUi:!0},d),w(a,e.url,c).click()};return t("div",{className:"stDownloadButton","data-testid":"stDownloadButton",children:t(m,{help:e.help,containerWidth:e.useContainerWidth,children:t(B,{kind:i,size:b.SMALL,disabled:o,onClick:u,containerWidth:e.useContainerWidth,children:t(p,{icon:e.icon,label:e.label})})})})}const g=r.memo(D);export{g as default};
1
+ import{r,aI as f,b4 as l,j as t,b5 as m,bp as B,b3 as b,b6 as p}from"./index.SCzIN5SB.js";import{c as h}from"./createDownloadLinkElement.DZMwyjvU.js";function w(n,o,e){return h({enforceDownloadInNewTab:e,url:n.buildMediaURL(o),filename:""})}function D(n){const{disabled:o,element:e,widgetMgr:s,endpoints:a,fragmentId:d}=n,{libConfig:{enforceDownloadInNewTab:c=!1}}=r.useContext(f);let i=l.SECONDARY;e.type==="primary"?i=l.PRIMARY:e.type==="tertiary"&&(i=l.TERTIARY),r.useEffect(()=>{a.checkSourceUrlResponse(e.url,"Download Button")},[e.url,a]);const u=()=>{e.ignoreRerun||s.setTriggerValue(e,{fromUi:!0},d),w(a,e.url,c).click()};return t("div",{className:"stDownloadButton","data-testid":"stDownloadButton",children:t(m,{help:e.help,containerWidth:e.useContainerWidth,children:t(B,{kind:i,size:b.SMALL,disabled:o,onClick:u,containerWidth:e.useContainerWidth,children:t(p,{icon:e.icon,label:e.label})})})})}const g=r.memo(D);export{g as default};
@@ -1,4 +1,4 @@
1
- import{r as Et,ax as vr,aW as ht,g as Kf,aX as lU,aY as yu,_ as oD,s as aD,B as cD,aH as lD,U as T1,aZ as IE,aE as uU,j as Cf,F as fU,aI as hU,z as dU,C as ME,a_ as AU,a$ as PE}from"./index.EAQB8Tuq.js";import{_ as os,a as pU,C as gU}from"./toConsumableArray.DaNXH4b3.js";import{a as Lu,b as Nu,_ as cx,c as sA,d as lx}from"./possibleConstructorReturn.Cy1PJuxU.js";import{a as mU,T as _U}from"./Toolbar.CA92Moni.js";import{E as uD,w as yU}from"./withFullScreenWrapper.C4lh8vGd.js";import{u as vU}from"./useBasicWidgetState.YAhDGDM8.js";import{u as bU,s as xU}from"./threshold.DjX0wlsa.js";import"./FormClearHelper.C4W8xjEX.js";import"./value.CgPGBV_l.js";function wU(t,e){for(var r=0;r<e.length;r++){const n=e[r];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in t)){const o=Object.getOwnPropertyDescriptor(n,i);o&&Object.defineProperty(t,i,o.get?o:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}function Fm(t,e){if(!t)throw new Error(e||"loader assertion failed.")}const ux=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),RE=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);RE&&parseFloat(RE[1]);const Dm=globalThis,Om=globalThis.process||{},CU=globalThis.navigator||{};function fD(t){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&process.versions?.electron)return!0;const r=typeof navigator<"u"&&navigator.userAgent;return!!(r&&r.indexOf("Electron")>=0)}function Kc(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||fD()}function TU(t){return Kc()?fD()?"Electron":(CU.userAgent||"").indexOf("Edge")>-1?"Edge":globalThis.chrome?"Chrome":globalThis.safari?"Safari":globalThis.mozInnerScreenX?"Firefox":"Unknown":"Node"}const S_="4.1.0";function EU(t){try{const e=window[t],r="__storage_test__";return e.setItem(r,r),e.removeItem(r),e}catch{return null}}let BU=class{constructor(e,r,n="sessionStorage"){this.storage=EU(n),this.id=e,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){const r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let e={};if(this.storage){const r=this.storage.getItem(this.id);e=r?JSON.parse(r):{}}return Object.assign(this.config,e),this}};function SU(t){let e;return t<10?e=`${t.toFixed(2)}ms`:t<100?e=`${t.toFixed(1)}ms`:t<1e3?e=`${t.toFixed(0)}ms`:e=`${(t/1e3).toFixed(2)}s`,e}function IU(t,e=8){const r=Math.max(e-t.length,0);return`${" ".repeat(r)}${t}`}var Lm;(function(t){t[t.BLACK=30]="BLACK",t[t.RED=31]="RED",t[t.GREEN=32]="GREEN",t[t.YELLOW=33]="YELLOW",t[t.BLUE=34]="BLUE",t[t.MAGENTA=35]="MAGENTA",t[t.CYAN=36]="CYAN",t[t.WHITE=37]="WHITE",t[t.BRIGHT_BLACK=90]="BRIGHT_BLACK",t[t.BRIGHT_RED=91]="BRIGHT_RED",t[t.BRIGHT_GREEN=92]="BRIGHT_GREEN",t[t.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",t[t.BRIGHT_BLUE=94]="BRIGHT_BLUE",t[t.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",t[t.BRIGHT_CYAN=96]="BRIGHT_CYAN",t[t.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Lm||(Lm={}));const MU=10;function FE(t){return typeof t!="string"?t:(t=t.toUpperCase(),Lm[t]||Lm.WHITE)}function PU(t,e,r){return!Kc&&typeof t=="string"&&(e&&(t=`\x1B[${FE(e)}m${t}\x1B[39m`),r&&(t=`\x1B[${FE(r)+MU}m${t}\x1B[49m`)),t}function RU(t,e=["constructor"]){const r=Object.getPrototypeOf(t),n=Object.getOwnPropertyNames(r),i=t;for(const o of n){const s=i[o];typeof s=="function"&&(e.find(u=>o===u)||(i[o]=s.bind(t)))}}function fx(t,e){if(!t)throw new Error("Assertion failed")}function Kh(){let t;if(Kc()&&Dm.performance)t=Dm?.performance?.now?.();else if("hrtime"in Om){const e=Om?.hrtime?.();t=e[0]*1e3+e[1]/1e6}else t=Date.now();return t}const qh={debug:Kc()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},FU={enabled:!0,level:0};function Yh(){}const DE={},OE={once:!0};let hD=class{constructor({id:e}={id:""}){this.VERSION=S_,this._startTs=Kh(),this._deltaTs=Kh(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new BU(`__probe-${this.id}__`,FU),this.timeStamp(`${this.id} started`),RU(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((Kh()-this._startTs).toPrecision(10))}getDelta(){return Number((Kh()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._storage.setConfiguration({enabled:e}),this}setLevel(e){return this._storage.setConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,r){this._storage.setConfiguration({[e]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,r){if(!e)throw new Error(r||"Assertion failed")}warn(e){return this._getLogFunction(0,e,qh.warn,arguments,OE)}error(e){return this._getLogFunction(0,e,qh.error,arguments)}deprecated(e,r){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(e,r){return this.error(`\`${e}\` has been removed. Use \`${r}\` instead`)}probe(e,r){return this._getLogFunction(e,r,qh.log,arguments,{time:!0,once:!0})}log(e,r){return this._getLogFunction(e,r,qh.debug,arguments)}info(e,r){return this._getLogFunction(e,r,console.info,arguments)}once(e,r){return this._getLogFunction(e,r,qh.debug||qh.info,arguments,OE)}table(e,r,n){return r?this._getLogFunction(e,r,console.table||Yh,n&&[n],{tag:OU(r)}):Yh}time(e,r){return this._getLogFunction(e,r,console.time?console.time:console.info)}timeEnd(e,r){return this._getLogFunction(e,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,r){return this._getLogFunction(e,r,console.timeStamp||Yh)}group(e,r,n={collapsed:!1}){const i=LE({logLevel:e,message:r,opts:n}),{collapsed:o}=n;return i.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(e,r,n={}){return this.group(e,r,Object.assign({},n,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||Yh)}withGroup(e,r,n){this.group(e,r)();try{n()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=dD(e)}_getLogFunction(e,r,n,i,o){if(this._shouldLog(e)){o=LE({logLevel:e,message:r,args:i,opts:o}),n=n||o.method,fx(n),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=Kh();const s=o.tag||o.message;if(o.once&&s)if(!DE[s])DE[s]=Kh();else return Yh;return r=DU(this.id,o.message,o),n.bind(console,r,...o.args)}return Yh}};hD.VERSION=S_;function dD(t){if(!t)return 0;let e;switch(typeof t){case"number":e=t;break;case"object":e=t.logLevel||t.priority||0;break;default:return 0}return fx(Number.isFinite(e)&&e>=0),e}function LE(t){const{logLevel:e,message:r}=t;t.logLevel=dD(e);const n=t.args?Array.from(t.args):[];for(;n.length&&n.shift()!==r;);switch(typeof e){case"string":case"function":r!==void 0&&n.unshift(r),t.message=e;break;case"object":Object.assign(t,e);break}typeof t.message=="function"&&(t.message=t.message());const i=typeof t.message;return fx(i==="string"||i==="object"),Object.assign(t,{args:n},t.opts)}function DU(t,e,r){if(typeof e=="string"){const n=r.time?IU(SU(r.total)):"";e=r.time?`${t}: ${n} ${e}`:`${t}: ${e}`,e=PU(e,r.color,r.background)}return e}function OU(t){for(const e in t)for(const r in t[e])return r||"untitled";return"empty"}function LU(t,e){return AD(t||{},e)}function AD(t,e,r=0){if(r>3)return e;const n={...t};for(const[i,o]of Object.entries(e))o&&typeof o=="object"&&!Array.isArray(o)?n[i]=AD(n[i]||{},e[i],r+1):n[i]=e[i];return n}const NU="latest";function kU(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.2.4"),globalThis._loadersgl_.version}const UU=kU();function Su(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}const Of=typeof process!="object"||String(process)!=="[object process]"||process.browser,zU=typeof window<"u"&&typeof window.orientation<"u",NE=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);NE&&parseFloat(NE[1]);let GU=class{name;workerThread;isRunning=!0;result;_resolve=()=>{};_reject=()=>{};constructor(e,r){this.name=e,this.workerThread=r,this.result=new Promise((n,i)=>{this._resolve=n,this._reject=i})}postMessage(e,r){this.workerThread.postMessage({source:"loaders.gl",type:e,payload:r})}done(e){Su(this.isRunning),this.isRunning=!1,this._resolve(e)}error(e){Su(this.isRunning),this.isRunning=!1,this._reject(e)}},cv=class{terminate(){}};const lv=new Map;function VU(t){Su(t.source&&!t.url||!t.source&&t.url);let e=lv.get(t.source||t.url);return e||(t.url&&(e=HU(t.url),lv.set(t.url,e)),t.source&&(e=pD(t.source),lv.set(t.source,e))),Su(e),e}function HU(t){if(!t.startsWith("http"))return t;const e=jU(t);return pD(e)}function pD(t){const e=new Blob([t],{type:"application/javascript"});return URL.createObjectURL(e)}function jU(t){return`try {
1
+ import{r as Et,ax as vr,aW as ht,g as Kf,aX as lU,aY as yu,_ as oD,s as aD,B as cD,aH as lD,U as T1,aZ as IE,aE as uU,j as Cf,F as fU,aI as hU,z as dU,C as ME,a_ as AU,a$ as PE}from"./index.SCzIN5SB.js";import{_ as os,a as pU,C as gU}from"./toConsumableArray.Dn5dJvBy.js";import{a as Lu,b as Nu,_ as cx,c as sA,d as lx}from"./possibleConstructorReturn.CU3h0WWI.js";import{a as mU,T as _U}from"./Toolbar.DoQICZLn.js";import{E as uD,w as yU}from"./withFullScreenWrapper.Drneg2_8.js";import{u as vU}from"./useBasicWidgetState.Bg3DrOCg.js";import{u as bU,s as xU}from"./threshold.DjX0wlsa.js";import"./FormClearHelper.BapTKtHM.js";import"./value.CgPGBV_l.js";function wU(t,e){for(var r=0;r<e.length;r++){const n=e[r];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in t)){const o=Object.getOwnPropertyDescriptor(n,i);o&&Object.defineProperty(t,i,o.get?o:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}function Fm(t,e){if(!t)throw new Error(e||"loader assertion failed.")}const ux=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),RE=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);RE&&parseFloat(RE[1]);const Dm=globalThis,Om=globalThis.process||{},CU=globalThis.navigator||{};function fD(t){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&process.versions?.electron)return!0;const r=typeof navigator<"u"&&navigator.userAgent;return!!(r&&r.indexOf("Electron")>=0)}function Kc(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||fD()}function TU(t){return Kc()?fD()?"Electron":(CU.userAgent||"").indexOf("Edge")>-1?"Edge":globalThis.chrome?"Chrome":globalThis.safari?"Safari":globalThis.mozInnerScreenX?"Firefox":"Unknown":"Node"}const S_="4.1.0";function EU(t){try{const e=window[t],r="__storage_test__";return e.setItem(r,r),e.removeItem(r),e}catch{return null}}let BU=class{constructor(e,r,n="sessionStorage"){this.storage=EU(n),this.id=e,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){const r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let e={};if(this.storage){const r=this.storage.getItem(this.id);e=r?JSON.parse(r):{}}return Object.assign(this.config,e),this}};function SU(t){let e;return t<10?e=`${t.toFixed(2)}ms`:t<100?e=`${t.toFixed(1)}ms`:t<1e3?e=`${t.toFixed(0)}ms`:e=`${(t/1e3).toFixed(2)}s`,e}function IU(t,e=8){const r=Math.max(e-t.length,0);return`${" ".repeat(r)}${t}`}var Lm;(function(t){t[t.BLACK=30]="BLACK",t[t.RED=31]="RED",t[t.GREEN=32]="GREEN",t[t.YELLOW=33]="YELLOW",t[t.BLUE=34]="BLUE",t[t.MAGENTA=35]="MAGENTA",t[t.CYAN=36]="CYAN",t[t.WHITE=37]="WHITE",t[t.BRIGHT_BLACK=90]="BRIGHT_BLACK",t[t.BRIGHT_RED=91]="BRIGHT_RED",t[t.BRIGHT_GREEN=92]="BRIGHT_GREEN",t[t.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",t[t.BRIGHT_BLUE=94]="BRIGHT_BLUE",t[t.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",t[t.BRIGHT_CYAN=96]="BRIGHT_CYAN",t[t.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Lm||(Lm={}));const MU=10;function FE(t){return typeof t!="string"?t:(t=t.toUpperCase(),Lm[t]||Lm.WHITE)}function PU(t,e,r){return!Kc&&typeof t=="string"&&(e&&(t=`\x1B[${FE(e)}m${t}\x1B[39m`),r&&(t=`\x1B[${FE(r)+MU}m${t}\x1B[49m`)),t}function RU(t,e=["constructor"]){const r=Object.getPrototypeOf(t),n=Object.getOwnPropertyNames(r),i=t;for(const o of n){const s=i[o];typeof s=="function"&&(e.find(u=>o===u)||(i[o]=s.bind(t)))}}function fx(t,e){if(!t)throw new Error("Assertion failed")}function Kh(){let t;if(Kc()&&Dm.performance)t=Dm?.performance?.now?.();else if("hrtime"in Om){const e=Om?.hrtime?.();t=e[0]*1e3+e[1]/1e6}else t=Date.now();return t}const qh={debug:Kc()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},FU={enabled:!0,level:0};function Yh(){}const DE={},OE={once:!0};let hD=class{constructor({id:e}={id:""}){this.VERSION=S_,this._startTs=Kh(),this._deltaTs=Kh(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new BU(`__probe-${this.id}__`,FU),this.timeStamp(`${this.id} started`),RU(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((Kh()-this._startTs).toPrecision(10))}getDelta(){return Number((Kh()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._storage.setConfiguration({enabled:e}),this}setLevel(e){return this._storage.setConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,r){this._storage.setConfiguration({[e]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,r){if(!e)throw new Error(r||"Assertion failed")}warn(e){return this._getLogFunction(0,e,qh.warn,arguments,OE)}error(e){return this._getLogFunction(0,e,qh.error,arguments)}deprecated(e,r){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(e,r){return this.error(`\`${e}\` has been removed. Use \`${r}\` instead`)}probe(e,r){return this._getLogFunction(e,r,qh.log,arguments,{time:!0,once:!0})}log(e,r){return this._getLogFunction(e,r,qh.debug,arguments)}info(e,r){return this._getLogFunction(e,r,console.info,arguments)}once(e,r){return this._getLogFunction(e,r,qh.debug||qh.info,arguments,OE)}table(e,r,n){return r?this._getLogFunction(e,r,console.table||Yh,n&&[n],{tag:OU(r)}):Yh}time(e,r){return this._getLogFunction(e,r,console.time?console.time:console.info)}timeEnd(e,r){return this._getLogFunction(e,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,r){return this._getLogFunction(e,r,console.timeStamp||Yh)}group(e,r,n={collapsed:!1}){const i=LE({logLevel:e,message:r,opts:n}),{collapsed:o}=n;return i.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(e,r,n={}){return this.group(e,r,Object.assign({},n,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||Yh)}withGroup(e,r,n){this.group(e,r)();try{n()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=dD(e)}_getLogFunction(e,r,n,i,o){if(this._shouldLog(e)){o=LE({logLevel:e,message:r,args:i,opts:o}),n=n||o.method,fx(n),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=Kh();const s=o.tag||o.message;if(o.once&&s)if(!DE[s])DE[s]=Kh();else return Yh;return r=DU(this.id,o.message,o),n.bind(console,r,...o.args)}return Yh}};hD.VERSION=S_;function dD(t){if(!t)return 0;let e;switch(typeof t){case"number":e=t;break;case"object":e=t.logLevel||t.priority||0;break;default:return 0}return fx(Number.isFinite(e)&&e>=0),e}function LE(t){const{logLevel:e,message:r}=t;t.logLevel=dD(e);const n=t.args?Array.from(t.args):[];for(;n.length&&n.shift()!==r;);switch(typeof e){case"string":case"function":r!==void 0&&n.unshift(r),t.message=e;break;case"object":Object.assign(t,e);break}typeof t.message=="function"&&(t.message=t.message());const i=typeof t.message;return fx(i==="string"||i==="object"),Object.assign(t,{args:n},t.opts)}function DU(t,e,r){if(typeof e=="string"){const n=r.time?IU(SU(r.total)):"";e=r.time?`${t}: ${n} ${e}`:`${t}: ${e}`,e=PU(e,r.color,r.background)}return e}function OU(t){for(const e in t)for(const r in t[e])return r||"untitled";return"empty"}function LU(t,e){return AD(t||{},e)}function AD(t,e,r=0){if(r>3)return e;const n={...t};for(const[i,o]of Object.entries(e))o&&typeof o=="object"&&!Array.isArray(o)?n[i]=AD(n[i]||{},e[i],r+1):n[i]=e[i];return n}const NU="latest";function kU(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.2.4"),globalThis._loadersgl_.version}const UU=kU();function Su(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}const Of=typeof process!="object"||String(process)!=="[object process]"||process.browser,zU=typeof window<"u"&&typeof window.orientation<"u",NE=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);NE&&parseFloat(NE[1]);let GU=class{name;workerThread;isRunning=!0;result;_resolve=()=>{};_reject=()=>{};constructor(e,r){this.name=e,this.workerThread=r,this.result=new Promise((n,i)=>{this._resolve=n,this._reject=i})}postMessage(e,r){this.workerThread.postMessage({source:"loaders.gl",type:e,payload:r})}done(e){Su(this.isRunning),this.isRunning=!1,this._resolve(e)}error(e){Su(this.isRunning),this.isRunning=!1,this._reject(e)}},cv=class{terminate(){}};const lv=new Map;function VU(t){Su(t.source&&!t.url||!t.source&&t.url);let e=lv.get(t.source||t.url);return e||(t.url&&(e=HU(t.url),lv.set(t.url,e)),t.source&&(e=pD(t.source),lv.set(t.source,e))),Su(e),e}function HU(t){if(!t.startsWith("http"))return t;const e=jU(t);return pD(e)}function pD(t){const e=new Blob([t],{type:"application/javascript"});return URL.createObjectURL(e)}function jU(t){return`try {
2
2
  importScripts('${t}');
3
3
  } catch (error) {
4
4
  console.error(error);
@@ -1,2 +1,2 @@
1
- import{s as Vt,r as gt,j as lt,F as $t}from"./index.EAQB8Tuq.js";/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:At,setPrototypeOf:ct,isFrozen:qt,getPrototypeOf:Kt,getOwnPropertyDescriptor:Zt}=Object;let{freeze:S,seal:y,create:ht}=Object,{apply:we,construct:xe}=typeof Reflect<"u"&&Reflect;S||(S=function(n){return n});y||(y=function(n){return n});we||(we=function(n,s,l){return n.apply(s,l)});xe||(xe=function(n,s){return new n(...s)});const le=R(Array.prototype.forEach),Jt=R(Array.prototype.lastIndexOf),ft=R(Array.prototype.pop),$=R(Array.prototype.push),Qt=R(Array.prototype.splice),fe=R(String.prototype.toLowerCase),De=R(String.prototype.toString),ut=R(String.prototype.match),q=R(String.prototype.replace),en=R(String.prototype.indexOf),tn=R(String.prototype.trim),L=R(Object.prototype.hasOwnProperty),h=R(RegExp.prototype.test),K=nn(TypeError);function R(a){return function(n){n instanceof RegExp&&(n.lastIndex=0);for(var s=arguments.length,l=new Array(s>1?s-1:0),T=1;T<s;T++)l[T-1]=arguments[T];return we(a,n,l)}}function nn(a){return function(){for(var n=arguments.length,s=new Array(n),l=0;l<n;l++)s[l]=arguments[l];return xe(a,s)}}function r(a,n){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:fe;ct&&ct(a,null);let l=n.length;for(;l--;){let T=n[l];if(typeof T=="string"){const D=s(T);D!==T&&(qt(n)||(n[l]=D),T=D)}a[T]=!0}return a}function on(a){for(let n=0;n<a.length;n++)L(a,n)||(a[n]=null);return a}function C(a){const n=ht(null);for(const[s,l]of At(a))L(a,s)&&(Array.isArray(l)?n[s]=on(l):l&&typeof l=="object"&&l.constructor===Object?n[s]=C(l):n[s]=l);return n}function Z(a,n){for(;a!==null;){const l=Zt(a,n);if(l){if(l.get)return R(l.get);if(typeof l.value=="function")return R(l.value)}a=Kt(a)}function s(){return null}return s}const mt=S(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Ne=S(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ie=S(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),an=S(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Me=S(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),rn=S(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),pt=S(["#text"]),dt=S(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Ce=S(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Tt=S(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ce=S(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),sn=y(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ln=y(/<%[\w\W]*|[\w\W]*%>/gm),cn=y(/\$\{[\w\W]*/gm),fn=y(/^data-[\-\w.\u00B7-\uFFFF]+$/),un=y(/^aria-[\-\w]+$/),St=y(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),mn=y(/^(?:\w+script|data):/i),pn=y(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Rt=y(/^html$/i),dn=y(/^[a-z][.\w]*(-[.\w]+)+$/i);var _t=Object.freeze({__proto__:null,ARIA_ATTR:un,ATTR_WHITESPACE:pn,CUSTOM_ELEMENT:dn,DATA_ATTR:fn,DOCTYPE_NAME:Rt,ERB_EXPR:ln,IS_ALLOWED_URI:St,IS_SCRIPT_OR_DATA:mn,MUSTACHE_EXPR:sn,TMPLIT_EXPR:cn});const J={element:1,text:3,progressingInstruction:7,comment:8,document:9},Tn=function(){return typeof window>"u"?null:window},_n=function(n,s){if(typeof n!="object"||typeof n.createPolicy!="function")return null;let l=null;const T="data-tt-policy-suffix";s&&s.hasAttribute(T)&&(l=s.getAttribute(T));const D="dompurify"+(l?"#"+l:"");try{return n.createPolicy(D,{createHTML(x){return x},createScriptURL(x){return x}})}catch{return console.warn("TrustedTypes policy "+D+" could not be created."),null}},Et=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Ot(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Tn();const n=i=>Ot(i);if(n.version="3.2.6",n.removed=[],!a||!a.document||a.document.nodeType!==J.document||!a.Element)return n.isSupported=!1,n;let{document:s}=a;const l=s,T=l.currentScript,{DocumentFragment:D,HTMLTemplateElement:x,Node:ue,Element:ve,NodeFilter:G,NamedNodeMap:yt=a.NamedNodeMap||a.MozNamedAttrMap,HTMLFormElement:Lt,DOMParser:bt,trustedTypes:Q}=a,W=ve.prototype,Dt=Z(W,"cloneNode"),Nt=Z(W,"remove"),It=Z(W,"nextSibling"),Mt=Z(W,"childNodes"),ee=Z(W,"parentNode");if(typeof x=="function"){const i=s.createElement("template");i.content&&i.content.ownerDocument&&(s=i.content.ownerDocument)}let g,B="";const{implementation:me,createNodeIterator:Ct,createDocumentFragment:wt,getElementsByTagName:xt}=s,{importNode:Pt}=l;let A=Et();n.isSupported=typeof At=="function"&&typeof ee=="function"&&me&&me.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:pe,ERB_EXPR:de,TMPLIT_EXPR:Te,DATA_ATTR:kt,ARIA_ATTR:vt,IS_SCRIPT_OR_DATA:Ut,ATTR_WHITESPACE:Ue,CUSTOM_ELEMENT:Ft}=_t;let{IS_ALLOWED_URI:Fe}=_t,m=null;const He=r({},[...mt,...Ne,...Ie,...Me,...pt]);let d=null;const ze=r({},[...dt,...Ce,...Tt,...ce]);let f=Object.seal(ht(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Y=null,_e=null,Ge=!0,Ee=!0,We=!1,Be=!0,P=!1,te=!0,w=!1,ge=!1,Ae=!1,k=!1,ne=!1,oe=!1,Ye=!0,Xe=!1;const Ht="user-content-";let he=!0,X=!1,v={},U=null;const je=r({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ve=null;const $e=r({},["audio","video","img","source","image","track"]);let Se=null;const qe=r({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ie="http://www.w3.org/1998/Math/MathML",ae="http://www.w3.org/2000/svg",N="http://www.w3.org/1999/xhtml";let F=N,Re=!1,Oe=null;const zt=r({},[ie,ae,N],De);let re=r({},["mi","mo","mn","ms","mtext"]),se=r({},["annotation-xml"]);const Gt=r({},["title","style","font","a","script"]);let j=null;const Wt=["application/xhtml+xml","text/html"],Bt="text/html";let p=null,H=null;const Yt=s.createElement("form"),Ke=function(e){return e instanceof RegExp||e instanceof Function},ye=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(H&&H===e)){if((!e||typeof e!="object")&&(e={}),e=C(e),j=Wt.indexOf(e.PARSER_MEDIA_TYPE)===-1?Bt:e.PARSER_MEDIA_TYPE,p=j==="application/xhtml+xml"?De:fe,m=L(e,"ALLOWED_TAGS")?r({},e.ALLOWED_TAGS,p):He,d=L(e,"ALLOWED_ATTR")?r({},e.ALLOWED_ATTR,p):ze,Oe=L(e,"ALLOWED_NAMESPACES")?r({},e.ALLOWED_NAMESPACES,De):zt,Se=L(e,"ADD_URI_SAFE_ATTR")?r(C(qe),e.ADD_URI_SAFE_ATTR,p):qe,Ve=L(e,"ADD_DATA_URI_TAGS")?r(C($e),e.ADD_DATA_URI_TAGS,p):$e,U=L(e,"FORBID_CONTENTS")?r({},e.FORBID_CONTENTS,p):je,Y=L(e,"FORBID_TAGS")?r({},e.FORBID_TAGS,p):C({}),_e=L(e,"FORBID_ATTR")?r({},e.FORBID_ATTR,p):C({}),v=L(e,"USE_PROFILES")?e.USE_PROFILES:!1,Ge=e.ALLOW_ARIA_ATTR!==!1,Ee=e.ALLOW_DATA_ATTR!==!1,We=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Be=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,P=e.SAFE_FOR_TEMPLATES||!1,te=e.SAFE_FOR_XML!==!1,w=e.WHOLE_DOCUMENT||!1,k=e.RETURN_DOM||!1,ne=e.RETURN_DOM_FRAGMENT||!1,oe=e.RETURN_TRUSTED_TYPE||!1,Ae=e.FORCE_BODY||!1,Ye=e.SANITIZE_DOM!==!1,Xe=e.SANITIZE_NAMED_PROPS||!1,he=e.KEEP_CONTENT!==!1,X=e.IN_PLACE||!1,Fe=e.ALLOWED_URI_REGEXP||St,F=e.NAMESPACE||N,re=e.MATHML_TEXT_INTEGRATION_POINTS||re,se=e.HTML_INTEGRATION_POINTS||se,f=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Ke(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(f.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Ke(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(f.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(f.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),P&&(Ee=!1),ne&&(k=!0),v&&(m=r({},pt),d=[],v.html===!0&&(r(m,mt),r(d,dt)),v.svg===!0&&(r(m,Ne),r(d,Ce),r(d,ce)),v.svgFilters===!0&&(r(m,Ie),r(d,Ce),r(d,ce)),v.mathMl===!0&&(r(m,Me),r(d,Tt),r(d,ce))),e.ADD_TAGS&&(m===He&&(m=C(m)),r(m,e.ADD_TAGS,p)),e.ADD_ATTR&&(d===ze&&(d=C(d)),r(d,e.ADD_ATTR,p)),e.ADD_URI_SAFE_ATTR&&r(Se,e.ADD_URI_SAFE_ATTR,p),e.FORBID_CONTENTS&&(U===je&&(U=C(U)),r(U,e.FORBID_CONTENTS,p)),he&&(m["#text"]=!0),w&&r(m,["html","head","body"]),m.table&&(r(m,["tbody"]),delete Y.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw K('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw K('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');g=e.TRUSTED_TYPES_POLICY,B=g.createHTML("")}else g===void 0&&(g=_n(Q,T)),g!==null&&typeof B=="string"&&(B=g.createHTML(""));S&&S(e),H=e}},Ze=r({},[...Ne,...Ie,...an]),Je=r({},[...Me,...rn]),Xt=function(e){let t=ee(e);(!t||!t.tagName)&&(t={namespaceURI:F,tagName:"template"});const o=fe(e.tagName),c=fe(t.tagName);return Oe[e.namespaceURI]?e.namespaceURI===ae?t.namespaceURI===N?o==="svg":t.namespaceURI===ie?o==="svg"&&(c==="annotation-xml"||re[c]):!!Ze[o]:e.namespaceURI===ie?t.namespaceURI===N?o==="math":t.namespaceURI===ae?o==="math"&&se[c]:!!Je[o]:e.namespaceURI===N?t.namespaceURI===ae&&!se[c]||t.namespaceURI===ie&&!re[c]?!1:!Je[o]&&(Gt[o]||!Ze[o]):!!(j==="application/xhtml+xml"&&Oe[e.namespaceURI]):!1},b=function(e){$(n.removed,{element:e});try{ee(e).removeChild(e)}catch{Nt(e)}},z=function(e,t){try{$(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch{$(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),e==="is")if(k||ne)try{b(t)}catch{}else try{t.setAttribute(e,"")}catch{}},Qe=function(e){let t=null,o=null;if(Ae)e="<remove></remove>"+e;else{const u=ut(e,/^[\r\n\t ]+/);o=u&&u[0]}j==="application/xhtml+xml"&&F===N&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const c=g?g.createHTML(e):e;if(F===N)try{t=new bt().parseFromString(c,j)}catch{}if(!t||!t.documentElement){t=me.createDocument(F,"template",null);try{t.documentElement.innerHTML=Re?B:c}catch{}}const _=t.body||t.documentElement;return e&&o&&_.insertBefore(s.createTextNode(o),_.childNodes[0]||null),F===N?xt.call(t,w?"html":"body")[0]:w?t.documentElement:_},et=function(e){return Ct.call(e.ownerDocument||e,e,G.SHOW_ELEMENT|G.SHOW_COMMENT|G.SHOW_TEXT|G.SHOW_PROCESSING_INSTRUCTION|G.SHOW_CDATA_SECTION,null)},Le=function(e){return e instanceof Lt&&(typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||!(e.attributes instanceof yt)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function")},tt=function(e){return typeof ue=="function"&&e instanceof ue};function I(i,e,t){le(i,o=>{o.call(n,e,t,H)})}const nt=function(e){let t=null;if(I(A.beforeSanitizeElements,e,null),Le(e))return b(e),!0;const o=p(e.nodeName);if(I(A.uponSanitizeElement,e,{tagName:o,allowedTags:m}),te&&e.hasChildNodes()&&!tt(e.firstElementChild)&&h(/<[/\w!]/g,e.innerHTML)&&h(/<[/\w!]/g,e.textContent)||e.nodeType===J.progressingInstruction||te&&e.nodeType===J.comment&&h(/<[/\w]/g,e.data))return b(e),!0;if(!m[o]||Y[o]){if(!Y[o]&&it(o)&&(f.tagNameCheck instanceof RegExp&&h(f.tagNameCheck,o)||f.tagNameCheck instanceof Function&&f.tagNameCheck(o)))return!1;if(he&&!U[o]){const c=ee(e)||e.parentNode,_=Mt(e)||e.childNodes;if(_&&c){const u=_.length;for(let O=u-1;O>=0;--O){const M=Dt(_[O],!0);M.__removalCount=(e.__removalCount||0)+1,c.insertBefore(M,It(e))}}}return b(e),!0}return e instanceof ve&&!Xt(e)||(o==="noscript"||o==="noembed"||o==="noframes")&&h(/<\/no(script|embed|frames)/i,e.innerHTML)?(b(e),!0):(P&&e.nodeType===J.text&&(t=e.textContent,le([pe,de,Te],c=>{t=q(t,c," ")}),e.textContent!==t&&($(n.removed,{element:e.cloneNode()}),e.textContent=t)),I(A.afterSanitizeElements,e,null),!1)},ot=function(e,t,o){if(Ye&&(t==="id"||t==="name")&&(o in s||o in Yt))return!1;if(!(Ee&&!_e[t]&&h(kt,t))){if(!(Ge&&h(vt,t))){if(!d[t]||_e[t]){if(!(it(e)&&(f.tagNameCheck instanceof RegExp&&h(f.tagNameCheck,e)||f.tagNameCheck instanceof Function&&f.tagNameCheck(e))&&(f.attributeNameCheck instanceof RegExp&&h(f.attributeNameCheck,t)||f.attributeNameCheck instanceof Function&&f.attributeNameCheck(t))||t==="is"&&f.allowCustomizedBuiltInElements&&(f.tagNameCheck instanceof RegExp&&h(f.tagNameCheck,o)||f.tagNameCheck instanceof Function&&f.tagNameCheck(o))))return!1}else if(!Se[t]){if(!h(Fe,q(o,Ue,""))){if(!((t==="src"||t==="xlink:href"||t==="href")&&e!=="script"&&en(o,"data:")===0&&Ve[e])){if(!(We&&!h(Ut,q(o,Ue,"")))){if(o)return!1}}}}}}return!0},it=function(e){return e!=="annotation-xml"&&ut(e,Ft)},at=function(e){I(A.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||Le(e))return;const o={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:d,forceKeepAttr:void 0};let c=t.length;for(;c--;){const _=t[c],{name:u,namespaceURI:O,value:M}=_,V=p(u),be=M;let E=u==="value"?be:tn(be);if(o.attrName=V,o.attrValue=E,o.keepAttr=!0,o.forceKeepAttr=void 0,I(A.uponSanitizeAttribute,e,o),E=o.attrValue,Xe&&(V==="id"||V==="name")&&(z(u,e),E=Ht+E),te&&h(/((--!?|])>)|<\/(style|title)/i,E)){z(u,e);continue}if(o.forceKeepAttr)continue;if(!o.keepAttr){z(u,e);continue}if(!Be&&h(/\/>/i,E)){z(u,e);continue}P&&le([pe,de,Te],st=>{E=q(E,st," ")});const rt=p(e.nodeName);if(!ot(rt,V,E)){z(u,e);continue}if(g&&typeof Q=="object"&&typeof Q.getAttributeType=="function"&&!O)switch(Q.getAttributeType(rt,V)){case"TrustedHTML":{E=g.createHTML(E);break}case"TrustedScriptURL":{E=g.createScriptURL(E);break}}if(E!==be)try{O?e.setAttributeNS(O,u,E):e.setAttribute(u,E),Le(e)?b(e):ft(n.removed)}catch{z(u,e)}}I(A.afterSanitizeAttributes,e,null)},jt=function i(e){let t=null;const o=et(e);for(I(A.beforeSanitizeShadowDOM,e,null);t=o.nextNode();)I(A.uponSanitizeShadowNode,t,null),nt(t),at(t),t.content instanceof D&&i(t.content);I(A.afterSanitizeShadowDOM,e,null)};return n.sanitize=function(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=null,o=null,c=null,_=null;if(Re=!i,Re&&(i="<!-->"),typeof i!="string"&&!tt(i))if(typeof i.toString=="function"){if(i=i.toString(),typeof i!="string")throw K("dirty is not a string, aborting")}else throw K("toString is not a function");if(!n.isSupported)return i;if(ge||ye(e),n.removed=[],typeof i=="string"&&(X=!1),X){if(i.nodeName){const M=p(i.nodeName);if(!m[M]||Y[M])throw K("root node is forbidden and cannot be sanitized in-place")}}else if(i instanceof ue)t=Qe("<!---->"),o=t.ownerDocument.importNode(i,!0),o.nodeType===J.element&&o.nodeName==="BODY"||o.nodeName==="HTML"?t=o:t.appendChild(o);else{if(!k&&!P&&!w&&i.indexOf("<")===-1)return g&&oe?g.createHTML(i):i;if(t=Qe(i),!t)return k?null:oe?B:""}t&&Ae&&b(t.firstChild);const u=et(X?i:t);for(;c=u.nextNode();)nt(c),at(c),c.content instanceof D&&jt(c.content);if(X)return i;if(k){if(ne)for(_=wt.call(t.ownerDocument);t.firstChild;)_.appendChild(t.firstChild);else _=t;return(d.shadowroot||d.shadowrootmode)&&(_=Pt.call(l,_,!0)),_}let O=w?t.outerHTML:t.innerHTML;return w&&m["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&h(Rt,t.ownerDocument.doctype.name)&&(O="<!DOCTYPE "+t.ownerDocument.doctype.name+`>
1
+ import{s as Vt,r as gt,j as lt,F as $t}from"./index.SCzIN5SB.js";/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:At,setPrototypeOf:ct,isFrozen:qt,getPrototypeOf:Kt,getOwnPropertyDescriptor:Zt}=Object;let{freeze:S,seal:y,create:ht}=Object,{apply:we,construct:xe}=typeof Reflect<"u"&&Reflect;S||(S=function(n){return n});y||(y=function(n){return n});we||(we=function(n,s,l){return n.apply(s,l)});xe||(xe=function(n,s){return new n(...s)});const le=R(Array.prototype.forEach),Jt=R(Array.prototype.lastIndexOf),ft=R(Array.prototype.pop),$=R(Array.prototype.push),Qt=R(Array.prototype.splice),fe=R(String.prototype.toLowerCase),De=R(String.prototype.toString),ut=R(String.prototype.match),q=R(String.prototype.replace),en=R(String.prototype.indexOf),tn=R(String.prototype.trim),L=R(Object.prototype.hasOwnProperty),h=R(RegExp.prototype.test),K=nn(TypeError);function R(a){return function(n){n instanceof RegExp&&(n.lastIndex=0);for(var s=arguments.length,l=new Array(s>1?s-1:0),T=1;T<s;T++)l[T-1]=arguments[T];return we(a,n,l)}}function nn(a){return function(){for(var n=arguments.length,s=new Array(n),l=0;l<n;l++)s[l]=arguments[l];return xe(a,s)}}function r(a,n){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:fe;ct&&ct(a,null);let l=n.length;for(;l--;){let T=n[l];if(typeof T=="string"){const D=s(T);D!==T&&(qt(n)||(n[l]=D),T=D)}a[T]=!0}return a}function on(a){for(let n=0;n<a.length;n++)L(a,n)||(a[n]=null);return a}function C(a){const n=ht(null);for(const[s,l]of At(a))L(a,s)&&(Array.isArray(l)?n[s]=on(l):l&&typeof l=="object"&&l.constructor===Object?n[s]=C(l):n[s]=l);return n}function Z(a,n){for(;a!==null;){const l=Zt(a,n);if(l){if(l.get)return R(l.get);if(typeof l.value=="function")return R(l.value)}a=Kt(a)}function s(){return null}return s}const mt=S(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Ne=S(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ie=S(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),an=S(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Me=S(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),rn=S(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),pt=S(["#text"]),dt=S(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Ce=S(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Tt=S(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ce=S(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),sn=y(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ln=y(/<%[\w\W]*|[\w\W]*%>/gm),cn=y(/\$\{[\w\W]*/gm),fn=y(/^data-[\-\w.\u00B7-\uFFFF]+$/),un=y(/^aria-[\-\w]+$/),St=y(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),mn=y(/^(?:\w+script|data):/i),pn=y(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Rt=y(/^html$/i),dn=y(/^[a-z][.\w]*(-[.\w]+)+$/i);var _t=Object.freeze({__proto__:null,ARIA_ATTR:un,ATTR_WHITESPACE:pn,CUSTOM_ELEMENT:dn,DATA_ATTR:fn,DOCTYPE_NAME:Rt,ERB_EXPR:ln,IS_ALLOWED_URI:St,IS_SCRIPT_OR_DATA:mn,MUSTACHE_EXPR:sn,TMPLIT_EXPR:cn});const J={element:1,text:3,progressingInstruction:7,comment:8,document:9},Tn=function(){return typeof window>"u"?null:window},_n=function(n,s){if(typeof n!="object"||typeof n.createPolicy!="function")return null;let l=null;const T="data-tt-policy-suffix";s&&s.hasAttribute(T)&&(l=s.getAttribute(T));const D="dompurify"+(l?"#"+l:"");try{return n.createPolicy(D,{createHTML(x){return x},createScriptURL(x){return x}})}catch{return console.warn("TrustedTypes policy "+D+" could not be created."),null}},Et=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Ot(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Tn();const n=i=>Ot(i);if(n.version="3.2.6",n.removed=[],!a||!a.document||a.document.nodeType!==J.document||!a.Element)return n.isSupported=!1,n;let{document:s}=a;const l=s,T=l.currentScript,{DocumentFragment:D,HTMLTemplateElement:x,Node:ue,Element:ve,NodeFilter:G,NamedNodeMap:yt=a.NamedNodeMap||a.MozNamedAttrMap,HTMLFormElement:Lt,DOMParser:bt,trustedTypes:Q}=a,W=ve.prototype,Dt=Z(W,"cloneNode"),Nt=Z(W,"remove"),It=Z(W,"nextSibling"),Mt=Z(W,"childNodes"),ee=Z(W,"parentNode");if(typeof x=="function"){const i=s.createElement("template");i.content&&i.content.ownerDocument&&(s=i.content.ownerDocument)}let g,B="";const{implementation:me,createNodeIterator:Ct,createDocumentFragment:wt,getElementsByTagName:xt}=s,{importNode:Pt}=l;let A=Et();n.isSupported=typeof At=="function"&&typeof ee=="function"&&me&&me.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:pe,ERB_EXPR:de,TMPLIT_EXPR:Te,DATA_ATTR:kt,ARIA_ATTR:vt,IS_SCRIPT_OR_DATA:Ut,ATTR_WHITESPACE:Ue,CUSTOM_ELEMENT:Ft}=_t;let{IS_ALLOWED_URI:Fe}=_t,m=null;const He=r({},[...mt,...Ne,...Ie,...Me,...pt]);let d=null;const ze=r({},[...dt,...Ce,...Tt,...ce]);let f=Object.seal(ht(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Y=null,_e=null,Ge=!0,Ee=!0,We=!1,Be=!0,P=!1,te=!0,w=!1,ge=!1,Ae=!1,k=!1,ne=!1,oe=!1,Ye=!0,Xe=!1;const Ht="user-content-";let he=!0,X=!1,v={},U=null;const je=r({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ve=null;const $e=r({},["audio","video","img","source","image","track"]);let Se=null;const qe=r({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ie="http://www.w3.org/1998/Math/MathML",ae="http://www.w3.org/2000/svg",N="http://www.w3.org/1999/xhtml";let F=N,Re=!1,Oe=null;const zt=r({},[ie,ae,N],De);let re=r({},["mi","mo","mn","ms","mtext"]),se=r({},["annotation-xml"]);const Gt=r({},["title","style","font","a","script"]);let j=null;const Wt=["application/xhtml+xml","text/html"],Bt="text/html";let p=null,H=null;const Yt=s.createElement("form"),Ke=function(e){return e instanceof RegExp||e instanceof Function},ye=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(H&&H===e)){if((!e||typeof e!="object")&&(e={}),e=C(e),j=Wt.indexOf(e.PARSER_MEDIA_TYPE)===-1?Bt:e.PARSER_MEDIA_TYPE,p=j==="application/xhtml+xml"?De:fe,m=L(e,"ALLOWED_TAGS")?r({},e.ALLOWED_TAGS,p):He,d=L(e,"ALLOWED_ATTR")?r({},e.ALLOWED_ATTR,p):ze,Oe=L(e,"ALLOWED_NAMESPACES")?r({},e.ALLOWED_NAMESPACES,De):zt,Se=L(e,"ADD_URI_SAFE_ATTR")?r(C(qe),e.ADD_URI_SAFE_ATTR,p):qe,Ve=L(e,"ADD_DATA_URI_TAGS")?r(C($e),e.ADD_DATA_URI_TAGS,p):$e,U=L(e,"FORBID_CONTENTS")?r({},e.FORBID_CONTENTS,p):je,Y=L(e,"FORBID_TAGS")?r({},e.FORBID_TAGS,p):C({}),_e=L(e,"FORBID_ATTR")?r({},e.FORBID_ATTR,p):C({}),v=L(e,"USE_PROFILES")?e.USE_PROFILES:!1,Ge=e.ALLOW_ARIA_ATTR!==!1,Ee=e.ALLOW_DATA_ATTR!==!1,We=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Be=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,P=e.SAFE_FOR_TEMPLATES||!1,te=e.SAFE_FOR_XML!==!1,w=e.WHOLE_DOCUMENT||!1,k=e.RETURN_DOM||!1,ne=e.RETURN_DOM_FRAGMENT||!1,oe=e.RETURN_TRUSTED_TYPE||!1,Ae=e.FORCE_BODY||!1,Ye=e.SANITIZE_DOM!==!1,Xe=e.SANITIZE_NAMED_PROPS||!1,he=e.KEEP_CONTENT!==!1,X=e.IN_PLACE||!1,Fe=e.ALLOWED_URI_REGEXP||St,F=e.NAMESPACE||N,re=e.MATHML_TEXT_INTEGRATION_POINTS||re,se=e.HTML_INTEGRATION_POINTS||se,f=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Ke(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(f.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Ke(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(f.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(f.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),P&&(Ee=!1),ne&&(k=!0),v&&(m=r({},pt),d=[],v.html===!0&&(r(m,mt),r(d,dt)),v.svg===!0&&(r(m,Ne),r(d,Ce),r(d,ce)),v.svgFilters===!0&&(r(m,Ie),r(d,Ce),r(d,ce)),v.mathMl===!0&&(r(m,Me),r(d,Tt),r(d,ce))),e.ADD_TAGS&&(m===He&&(m=C(m)),r(m,e.ADD_TAGS,p)),e.ADD_ATTR&&(d===ze&&(d=C(d)),r(d,e.ADD_ATTR,p)),e.ADD_URI_SAFE_ATTR&&r(Se,e.ADD_URI_SAFE_ATTR,p),e.FORBID_CONTENTS&&(U===je&&(U=C(U)),r(U,e.FORBID_CONTENTS,p)),he&&(m["#text"]=!0),w&&r(m,["html","head","body"]),m.table&&(r(m,["tbody"]),delete Y.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw K('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw K('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');g=e.TRUSTED_TYPES_POLICY,B=g.createHTML("")}else g===void 0&&(g=_n(Q,T)),g!==null&&typeof B=="string"&&(B=g.createHTML(""));S&&S(e),H=e}},Ze=r({},[...Ne,...Ie,...an]),Je=r({},[...Me,...rn]),Xt=function(e){let t=ee(e);(!t||!t.tagName)&&(t={namespaceURI:F,tagName:"template"});const o=fe(e.tagName),c=fe(t.tagName);return Oe[e.namespaceURI]?e.namespaceURI===ae?t.namespaceURI===N?o==="svg":t.namespaceURI===ie?o==="svg"&&(c==="annotation-xml"||re[c]):!!Ze[o]:e.namespaceURI===ie?t.namespaceURI===N?o==="math":t.namespaceURI===ae?o==="math"&&se[c]:!!Je[o]:e.namespaceURI===N?t.namespaceURI===ae&&!se[c]||t.namespaceURI===ie&&!re[c]?!1:!Je[o]&&(Gt[o]||!Ze[o]):!!(j==="application/xhtml+xml"&&Oe[e.namespaceURI]):!1},b=function(e){$(n.removed,{element:e});try{ee(e).removeChild(e)}catch{Nt(e)}},z=function(e,t){try{$(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch{$(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),e==="is")if(k||ne)try{b(t)}catch{}else try{t.setAttribute(e,"")}catch{}},Qe=function(e){let t=null,o=null;if(Ae)e="<remove></remove>"+e;else{const u=ut(e,/^[\r\n\t ]+/);o=u&&u[0]}j==="application/xhtml+xml"&&F===N&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const c=g?g.createHTML(e):e;if(F===N)try{t=new bt().parseFromString(c,j)}catch{}if(!t||!t.documentElement){t=me.createDocument(F,"template",null);try{t.documentElement.innerHTML=Re?B:c}catch{}}const _=t.body||t.documentElement;return e&&o&&_.insertBefore(s.createTextNode(o),_.childNodes[0]||null),F===N?xt.call(t,w?"html":"body")[0]:w?t.documentElement:_},et=function(e){return Ct.call(e.ownerDocument||e,e,G.SHOW_ELEMENT|G.SHOW_COMMENT|G.SHOW_TEXT|G.SHOW_PROCESSING_INSTRUCTION|G.SHOW_CDATA_SECTION,null)},Le=function(e){return e instanceof Lt&&(typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||!(e.attributes instanceof yt)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function")},tt=function(e){return typeof ue=="function"&&e instanceof ue};function I(i,e,t){le(i,o=>{o.call(n,e,t,H)})}const nt=function(e){let t=null;if(I(A.beforeSanitizeElements,e,null),Le(e))return b(e),!0;const o=p(e.nodeName);if(I(A.uponSanitizeElement,e,{tagName:o,allowedTags:m}),te&&e.hasChildNodes()&&!tt(e.firstElementChild)&&h(/<[/\w!]/g,e.innerHTML)&&h(/<[/\w!]/g,e.textContent)||e.nodeType===J.progressingInstruction||te&&e.nodeType===J.comment&&h(/<[/\w]/g,e.data))return b(e),!0;if(!m[o]||Y[o]){if(!Y[o]&&it(o)&&(f.tagNameCheck instanceof RegExp&&h(f.tagNameCheck,o)||f.tagNameCheck instanceof Function&&f.tagNameCheck(o)))return!1;if(he&&!U[o]){const c=ee(e)||e.parentNode,_=Mt(e)||e.childNodes;if(_&&c){const u=_.length;for(let O=u-1;O>=0;--O){const M=Dt(_[O],!0);M.__removalCount=(e.__removalCount||0)+1,c.insertBefore(M,It(e))}}}return b(e),!0}return e instanceof ve&&!Xt(e)||(o==="noscript"||o==="noembed"||o==="noframes")&&h(/<\/no(script|embed|frames)/i,e.innerHTML)?(b(e),!0):(P&&e.nodeType===J.text&&(t=e.textContent,le([pe,de,Te],c=>{t=q(t,c," ")}),e.textContent!==t&&($(n.removed,{element:e.cloneNode()}),e.textContent=t)),I(A.afterSanitizeElements,e,null),!1)},ot=function(e,t,o){if(Ye&&(t==="id"||t==="name")&&(o in s||o in Yt))return!1;if(!(Ee&&!_e[t]&&h(kt,t))){if(!(Ge&&h(vt,t))){if(!d[t]||_e[t]){if(!(it(e)&&(f.tagNameCheck instanceof RegExp&&h(f.tagNameCheck,e)||f.tagNameCheck instanceof Function&&f.tagNameCheck(e))&&(f.attributeNameCheck instanceof RegExp&&h(f.attributeNameCheck,t)||f.attributeNameCheck instanceof Function&&f.attributeNameCheck(t))||t==="is"&&f.allowCustomizedBuiltInElements&&(f.tagNameCheck instanceof RegExp&&h(f.tagNameCheck,o)||f.tagNameCheck instanceof Function&&f.tagNameCheck(o))))return!1}else if(!Se[t]){if(!h(Fe,q(o,Ue,""))){if(!((t==="src"||t==="xlink:href"||t==="href")&&e!=="script"&&en(o,"data:")===0&&Ve[e])){if(!(We&&!h(Ut,q(o,Ue,"")))){if(o)return!1}}}}}}return!0},it=function(e){return e!=="annotation-xml"&&ut(e,Ft)},at=function(e){I(A.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||Le(e))return;const o={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:d,forceKeepAttr:void 0};let c=t.length;for(;c--;){const _=t[c],{name:u,namespaceURI:O,value:M}=_,V=p(u),be=M;let E=u==="value"?be:tn(be);if(o.attrName=V,o.attrValue=E,o.keepAttr=!0,o.forceKeepAttr=void 0,I(A.uponSanitizeAttribute,e,o),E=o.attrValue,Xe&&(V==="id"||V==="name")&&(z(u,e),E=Ht+E),te&&h(/((--!?|])>)|<\/(style|title)/i,E)){z(u,e);continue}if(o.forceKeepAttr)continue;if(!o.keepAttr){z(u,e);continue}if(!Be&&h(/\/>/i,E)){z(u,e);continue}P&&le([pe,de,Te],st=>{E=q(E,st," ")});const rt=p(e.nodeName);if(!ot(rt,V,E)){z(u,e);continue}if(g&&typeof Q=="object"&&typeof Q.getAttributeType=="function"&&!O)switch(Q.getAttributeType(rt,V)){case"TrustedHTML":{E=g.createHTML(E);break}case"TrustedScriptURL":{E=g.createScriptURL(E);break}}if(E!==be)try{O?e.setAttributeNS(O,u,E):e.setAttribute(u,E),Le(e)?b(e):ft(n.removed)}catch{z(u,e)}}I(A.afterSanitizeAttributes,e,null)},jt=function i(e){let t=null;const o=et(e);for(I(A.beforeSanitizeShadowDOM,e,null);t=o.nextNode();)I(A.uponSanitizeShadowNode,t,null),nt(t),at(t),t.content instanceof D&&i(t.content);I(A.afterSanitizeShadowDOM,e,null)};return n.sanitize=function(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=null,o=null,c=null,_=null;if(Re=!i,Re&&(i="<!-->"),typeof i!="string"&&!tt(i))if(typeof i.toString=="function"){if(i=i.toString(),typeof i!="string")throw K("dirty is not a string, aborting")}else throw K("toString is not a function");if(!n.isSupported)return i;if(ge||ye(e),n.removed=[],typeof i=="string"&&(X=!1),X){if(i.nodeName){const M=p(i.nodeName);if(!m[M]||Y[M])throw K("root node is forbidden and cannot be sanitized in-place")}}else if(i instanceof ue)t=Qe("<!---->"),o=t.ownerDocument.importNode(i,!0),o.nodeType===J.element&&o.nodeName==="BODY"||o.nodeName==="HTML"?t=o:t.appendChild(o);else{if(!k&&!P&&!w&&i.indexOf("<")===-1)return g&&oe?g.createHTML(i):i;if(t=Qe(i),!t)return k?null:oe?B:""}t&&Ae&&b(t.firstChild);const u=et(X?i:t);for(;c=u.nextNode();)nt(c),at(c),c.content instanceof D&&jt(c.content);if(X)return i;if(k){if(ne)for(_=wt.call(t.ownerDocument);t.firstChild;)_.appendChild(t.firstChild);else _=t;return(d.shadowroot||d.shadowrootmode)&&(_=Pt.call(l,_,!0)),_}let O=w?t.outerHTML:t.innerHTML;return w&&m["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&h(Rt,t.ownerDocument.doctype.name)&&(O="<!DOCTYPE "+t.ownerDocument.doctype.name+`>
2
2
  `+O),P&&le([pe,de,Te],M=>{O=q(O,M," ")}),g&&oe?g.createHTML(O):O},n.setConfig=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ye(i),ge=!0},n.clearConfig=function(){H=null,ge=!1},n.isValidAttribute=function(i,e,t){H||ye({});const o=p(i),c=p(e);return ot(o,c,t)},n.addHook=function(i,e){typeof e=="function"&&$(A[i],e)},n.removeHook=function(i,e){if(e!==void 0){const t=Jt(A[i],e);return t===-1?void 0:Qt(A[i],t,1)[0]}return ft(A[i])},n.removeHooks=function(i){A[i]=[]},n.removeAllHooks=function(){A=Et()},n}var ke=Ot();const En=Vt("div",{target:"ez8s6cm0"})({width:"100%"}),Pe="data-temp-href-target";ke.addHook("beforeSanitizeAttributes",function(a){a instanceof HTMLElement&&a.hasAttribute("target")&&a.getAttribute("target")==="_blank"&&a.setAttribute(Pe,"_blank")});ke.addHook("afterSanitizeAttributes",function(a){a instanceof HTMLElement&&a.hasAttribute(Pe)&&(a.setAttribute("target","_blank"),a.setAttribute("rel","noopener noreferrer"),a.removeAttribute(Pe))});const gn=a=>{const n={USE_PROFILES:{html:!0},FORCE_BODY:!0};return ke.sanitize(a,n)};function An({element:a}){const{body:n}=a,s=gt.useMemo(()=>gn(n),[n]);return lt($t,{children:s&&lt(En,{className:"stHtml","data-testid":"stHtml",dangerouslySetInnerHTML:{__html:s}})})}const Sn=gt.memo(An);export{Sn as default};
@@ -1 +1 @@
1
- import{s as a,r as t,O as i,j as d,b0 as c,b1 as e,M as l}from"./index.EAQB8Tuq.js";const g=a("iframe",{target:"e3tg43n0"})(({theme:o,disableScrolling:r})=>({width:"100%",colorScheme:"normal",border:"none",padding:o.spacing.none,margin:o.spacing.none,overflow:r?"hidden":void 0}));function s(o){return l(o)||o===""?void 0:o}function I({element:o}){const r=s(o.src),n=i(r)?void 0:s(o.srcdoc);return d(g,{className:"stIFrame","data-testid":"stIFrame",allow:e,disableScrolling:!o.scrolling,src:r,srcDoc:n,height:o.height,scrolling:o.scrolling?"auto":"no",sandbox:c,title:"st.iframe",tabIndex:o.tabIndex??void 0})}const m=t.memo(I);export{m as default};
1
+ import{s as a,r as t,O as i,j as d,b0 as c,b1 as e,M as l}from"./index.SCzIN5SB.js";const g=a("iframe",{target:"e3tg43n0"})(({theme:o,disableScrolling:r})=>({width:"100%",colorScheme:"normal",border:"none",padding:o.spacing.none,margin:o.spacing.none,overflow:r?"hidden":void 0}));function s(o){return l(o)||o===""?void 0:o}function I({element:o}){const r=s(o.src),n=i(r)?void 0:s(o.srcdoc);return d(g,{className:"stIFrame","data-testid":"stIFrame",allow:e,disableScrolling:!o.scrolling,src:r,srcDoc:n,height:o.height,scrolling:o.scrolling?"auto":"no",sandbox:c,title:"st.iframe",tabIndex:o.tabIndex??void 0})}const m=t.memo(I);export{m as default};
@@ -1,2 +1,2 @@
1
- import{bw as v,r as l,cl as k,cq as w,cn as p}from"./index.EAQB8Tuq.js";import{R as C,c as S,d as J,B as M}from"./base-input.C-H36mFE.js";function _(e){"@babel/helpers - typeof";return _=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_(e)}var U=["Root","StartEnhancer","EndEnhancer"],Z=["startEnhancer","endEnhancer","overrides"];function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},f.apply(this,arguments)}function O(e,t){return V(e)||Q(e,t)||K(e,t)||G()}function G(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ import{bw as v,r as l,cl as k,cq as w,cn as p}from"./index.SCzIN5SB.js";import{R as C,c as S,d as J,B as M}from"./base-input.DJLL2PiI.js";function _(e){"@babel/helpers - typeof";return _=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_(e)}var U=["Root","StartEnhancer","EndEnhancer"],Z=["startEnhancer","endEnhancer","overrides"];function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},f.apply(this,arguments)}function O(e,t){return V(e)||Q(e,t)||K(e,t)||G()}function G(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function K(e,t){if(e){if(typeof e=="string")return j(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return j(e,t)}}function j(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Q(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,a=!1,i,u;try{for(r=r.call(e);!(o=(i=r.next()).done)&&(n.push(i.value),!(t&&n.length===t));o=!0);}catch(b){a=!0,u=b}finally{try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}return n}}function V(e){if(Array.isArray(e))return e}function I(e,t){if(e==null)return{};var r=X(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function X(e,t){if(e==null)return{};var r={},n=Object.keys(e),o,a;for(a=0;a<n.length;a++)o=n[a],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}function Y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ee(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function te(e,t,r){return t&&ee(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function re(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&m(e,t)}function m(e,t){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},m(e,t)}function ne(e){var t=ae();return function(){var n=h(e),o;if(t){var a=h(this).constructor;o=Reflect.construct(n,arguments,a)}else o=n.apply(this,arguments);return oe(this,o)}}function oe(e,t){if(t&&(_(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return y(e)}function y(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ae(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},h(e)}function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ie=function(e){re(r,e);var t=ne(r);function r(){var n;Y(this,r);for(var o=arguments.length,a=new Array(o),i=0;i<o;i++)a[i]=arguments[i];return n=t.call.apply(t,[this].concat(a)),d(y(n),"state",{isFocused:n.props.autoFocus||!1}),d(y(n),"onFocus",function(u){n.setState({isFocused:!0}),n.props.onFocus(u)}),d(y(n),"onBlur",function(u){n.setState({isFocused:!1}),n.props.onBlur(u)}),n}return te(r,[{key:"render",value:function(){var o=this.props,a=o.startEnhancer,i=o.endEnhancer,u=o.overrides,b=u.Root,A=u.StartEnhancer,B=u.EndEnhancer,F=I(u,U),T=I(o,Z),x=v(b,C),g=O(x,2),$=g[0],N=g[1],D=v(A,S),E=O(D,2),W=E[0],q=E[1],z=v(B,S),P=O(z,2),H=P[0],L=P[1],s=J(this.props,this.state);return l.createElement($,f({"data-baseweb":"input"},s,N,{$adjoined:R(a,i),$hasIconTrailing:this.props.clearable||this.props.type=="password"}),c(a)&&l.createElement(W,f({},s,q,{$position:w.start}),typeof a=="function"?a(s):a),l.createElement(M,f({},T,{overrides:F,adjoined:R(a,i),onFocus:this.onFocus,onBlur:this.onBlur})),c(i)&&l.createElement(H,f({},s,L,{$position:w.end}),typeof i=="function"?i(s):i))}}]),r}(l.Component);d(ie,"defaultProps",{autoComplete:"on",autoFocus:!1,disabled:!1,name:"",onBlur:function(){},onFocus:function(){},overrides:{},required:!1,size:k.default,startEnhancer:null,endEnhancer:null,clearable:!1,type:"text",readOnly:!1});function R(e,t){return c(e)&&c(t)?p.both:c(e)?p.left:c(t)?p.right:p.none}function c(e){return!!(e||e===0)}export{ie as I};
@@ -1 +1 @@
1
- import{c as p,e as c}from"./es6.BMYexa9t.js";import"./index.EAQB8Tuq.js";const{File:n,Blob:_,DOMException:s}=p,{INVALID:z,GONE:r,MISMATCH:w,MOD_ERR:b,SYNTAX:a,SECURITY:I,DISALLOWED:m}=c;class g{constructor(e,i){this.fileHandle=e,this.file=i,this.size=i.size,this.position=0}write(e){let i=this.file;if(typeof e=="object"){if(e.type==="write"){if(Number.isInteger(e.position)&&e.position>=0&&(this.position=e.position,this.size<e.position&&(this.file=new n([this.file,new ArrayBuffer(e.position-this.size)],this.file.name,this.file))),!("data"in e))throw new s(...a("write requires a data argument"));e=e.data}else if(e.type==="seek")if(Number.isInteger(e.position)&&e.position>=0){if(this.size<e.position)throw new s(...z);this.position=e.position;return}else throw new s(...a("seek requires a position argument"));else if(e.type==="truncate")if(Number.isInteger(e.size)&&e.size>=0){i=e.size<this.size?new n([i.slice(0,e.size)],i.name,i):new n([i,new Uint8Array(e.size-this.size)],i.name),this.size=i.size,this.position>i.size&&(this.position=i.size),this.file=i;return}else throw new s(...a("truncate requires a size argument"))}e=new _([e]);let t=this.file;const o=t.slice(0,this.position),y=t.slice(this.position+e.size);let l=this.position-o.size;l<0&&(l=0),t=new n([o,new Uint8Array(l),e,y],t.name),this.size=t.size,this.position+=e.size,this.file=t}close(){if(this.fileHandle._deleted)throw new s(...r);this.fileHandle._file=this.file,this.file=this.position=this.size=null,this.fileHandle.onclose&&this.fileHandle.onclose(this.fileHandle)}}class f{constructor(e="",i=new n([],e),t=!0){this._file=i,this.name=e,this.kind="file",this._deleted=!1,this.writable=t,this.readable=!0}async getFile(){if(this._deleted)throw new s(...r);return this._file}async createWritable(e){if(!this.writable)throw new s(...m);if(this._deleted)throw new s(...r);const i=e.keepExistingData?await this.getFile():new n([],this.name);return new g(this,i)}async isSameEntry(e){return this===e}async _destroy(){this._deleted=!0,this._file=null}}class h{constructor(e,i=!0){this.name=e,this.kind="directory",this._deleted=!1,this._entries={},this.writable=i,this.readable=!0}async*entries(){if(this._deleted)throw new s(...r);yield*Object.entries(this._entries)}async isSameEntry(e){return this===e}async getDirectoryHandle(e,i){if(this._deleted)throw new s(...r);const t=this._entries[e];if(t){if(t instanceof f)throw new s(...w);return t}else{if(i.create)return this._entries[e]=new h(e);throw new s(...r)}}async getFileHandle(e,i){const t=this._entries[e],o=t instanceof f;if(t&&o)return t;if(t&&!o)throw new s(...w);if(!t&&!i.create)throw new s(...r);if(!t&&i.create)return this._entries[e]=new f(e)}async removeEntry(e,i){const t=this._entries[e];if(!t)throw new s(...r);await t._destroy(i.recursive),delete this._entries[e]}async _destroy(e){for(let i of Object.values(this._entries)){if(!e)throw new s(...b);await i._destroy(e)}this._entries={},this._deleted=!0}}const u=new h(""),A=()=>u;export{f as FileHandle,h as FolderHandle,g as Sink,A as default};
1
+ import{c as p,e as c}from"./es6.Dj_qfQ-J.js";import"./index.SCzIN5SB.js";const{File:n,Blob:_,DOMException:s}=p,{INVALID:z,GONE:r,MISMATCH:w,MOD_ERR:b,SYNTAX:a,SECURITY:I,DISALLOWED:m}=c;class g{constructor(e,i){this.fileHandle=e,this.file=i,this.size=i.size,this.position=0}write(e){let i=this.file;if(typeof e=="object"){if(e.type==="write"){if(Number.isInteger(e.position)&&e.position>=0&&(this.position=e.position,this.size<e.position&&(this.file=new n([this.file,new ArrayBuffer(e.position-this.size)],this.file.name,this.file))),!("data"in e))throw new s(...a("write requires a data argument"));e=e.data}else if(e.type==="seek")if(Number.isInteger(e.position)&&e.position>=0){if(this.size<e.position)throw new s(...z);this.position=e.position;return}else throw new s(...a("seek requires a position argument"));else if(e.type==="truncate")if(Number.isInteger(e.size)&&e.size>=0){i=e.size<this.size?new n([i.slice(0,e.size)],i.name,i):new n([i,new Uint8Array(e.size-this.size)],i.name),this.size=i.size,this.position>i.size&&(this.position=i.size),this.file=i;return}else throw new s(...a("truncate requires a size argument"))}e=new _([e]);let t=this.file;const o=t.slice(0,this.position),y=t.slice(this.position+e.size);let l=this.position-o.size;l<0&&(l=0),t=new n([o,new Uint8Array(l),e,y],t.name),this.size=t.size,this.position+=e.size,this.file=t}close(){if(this.fileHandle._deleted)throw new s(...r);this.fileHandle._file=this.file,this.file=this.position=this.size=null,this.fileHandle.onclose&&this.fileHandle.onclose(this.fileHandle)}}class f{constructor(e="",i=new n([],e),t=!0){this._file=i,this.name=e,this.kind="file",this._deleted=!1,this.writable=t,this.readable=!0}async getFile(){if(this._deleted)throw new s(...r);return this._file}async createWritable(e){if(!this.writable)throw new s(...m);if(this._deleted)throw new s(...r);const i=e.keepExistingData?await this.getFile():new n([],this.name);return new g(this,i)}async isSameEntry(e){return this===e}async _destroy(){this._deleted=!0,this._file=null}}class h{constructor(e,i=!0){this.name=e,this.kind="directory",this._deleted=!1,this._entries={},this.writable=i,this.readable=!0}async*entries(){if(this._deleted)throw new s(...r);yield*Object.entries(this._entries)}async isSameEntry(e){return this===e}async getDirectoryHandle(e,i){if(this._deleted)throw new s(...r);const t=this._entries[e];if(t){if(t instanceof f)throw new s(...w);return t}else{if(i.create)return this._entries[e]=new h(e);throw new s(...r)}}async getFileHandle(e,i){const t=this._entries[e],o=t instanceof f;if(t&&o)return t;if(t&&!o)throw new s(...w);if(!t&&!i.create)throw new s(...r);if(!t&&i.create)return this._entries[e]=new f(e)}async removeEntry(e,i){const t=this._entries[e];if(!t)throw new s(...r);await t._destroy(i.recursive),delete this._entries[e]}async _destroy(e){for(let i of Object.values(this._entries)){if(!e)throw new s(...b);await i._destroy(e)}this._entries={},this._deleted=!0}}const u=new h(""),A=()=>u;export{f as FileHandle,h as FolderHandle,g as Sink,A as default};