@stlite/desktop 0.94.0 → 0.95.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/build/assets/{ErrorOutline.esm-DLUMN1rT-DJlX61n8.js → ErrorOutline.esm-C-dv9Xq1-skkXNqDc.js} +1 -1
- package/build/assets/{FileDownload.esm-DF2iWLBX-wR0Sqyar.js → FileDownload.esm-ORp-UC-S-BrsUfuH5.js} +1 -1
- package/build/assets/{FileHelper-e3Y3t9SK-CvhzeiBH.js → FileHelper-DQKV3o5U-qFf0CL_R.js} +1 -1
- package/build/assets/{FormClearHelper-Bzgvbizg-C4nYH9Ah.js → FormClearHelper-DtwjWakY-CxfcniD6.js} +1 -1
- package/build/assets/{InputInstructions-CVvsIG30-CnawSQ9T.js → InputInstructions-CshBE9XZ-BbegIdTI.js} +1 -1
- package/build/assets/{Particles-Be2s8q_d-CqrCI_Wv.js → Particles-DbEEaBdi-Cslh0fnd.js} +1 -1
- package/build/assets/{ProgressBar-D9RZaREA-RHxbZJ2h.js → ProgressBar-ohpf-YR2-PWD0xacp.js} +1 -1
- package/build/assets/{Toolbar-JQglDlYw-BVoZAoJb.js → Toolbar-Cc8tCeKL-JHIp2NvW.js} +1 -1
- package/build/assets/{base-input-BKMf8bDw-CV7al27L.js → base-input-DbV2D5sF-DJkpBRM1.js} +1 -1
- package/build/assets/{checkbox-COWlDD7C-C4FcqJsu.js → checkbox-CG80fxUD-CavQvTtP.js} +1 -1
- package/build/assets/{createSuper-A2N3ZqeL-BLFmYQPg.js → createSuper-BlgWzn8_-h1vcwEzv.js} +1 -1
- package/build/assets/{data-grid-overlay-editor-ChccEKqe-B1le2p6v.js → data-grid-overlay-editor-DsmOmCoE-DU0EvyVM.js} +1 -1
- package/build/assets/{downloader-DcCTL3Wz-aWEH86Cm.js → downloader-DcCTL3Wz-CqotLrf1.js} +1 -1
- package/build/assets/{es6--XPcqeHG-DGncAuJb.js → es6--XPcqeHG-DdkxL8eW.js} +2 -2
- package/build/assets/{iframeResizer.contentWindow-DzFYQyDX-YYXCMpzY.js → iframeResizer.contentWindow-DEXh82Lp-CG3rnwWO.js} +1 -1
- package/build/assets/{index-DB9qsR4f-yf6MH9_3.js → index-3Q8l-56I-Bp9UZWPZ.js} +1 -1
- package/build/assets/{index-DothqwZV-C1n5_0yC.js → index-8FM--PX3-C2rsm2es.js} +1 -1
- package/build/assets/{index-DdGOyljS-CORoEvmn.js → index-B1y_Hrx0-DDwLQ3XW.js} +1 -1
- package/build/assets/{index-BAyifI5P-D0GyG_F4.js → index-BECG__WC-DerPiN--.js} +1 -1
- package/build/assets/{index-DnbVdm9s-Bf01xwYR.js → index-BQn4Faen-CVQ5ESXY.js} +1 -1
- package/build/assets/{index-DsC6gg9e-403VlLJ7.js → index-BReUOw2L-emeACiGh.js} +1 -1
- package/build/assets/{index-0kGpkeFl-CpoyiVYL.js → index-BiS_E3zu-CwIGZcqG.js} +1 -1
- package/build/assets/{index-CC5fS38J-4gUNHnsm.js → index-BmlZuG1z-BtaDcb9o.js} +1 -1
- package/build/assets/{index-UzH0BZ2O-DQwgk0Tm.js → index-BqCY3Zlk-mm_Bt8ZF.js} +1 -1
- package/build/assets/{index-Cx-F6ZGn.js → index-BvblFOYP.js} +4 -4
- package/build/assets/{index-DkMzG46X-DNODCduO.js → index-Bzy7yu67-C3L4ShMk.js} +1 -1
- package/build/assets/{index-C6xbAbU4-x8N_u5fg.js → index-C7cG_aL6-BWm5S1-m.js} +1 -1
- package/build/assets/{index-CfIBVPGp-BnLIrYvE.js → index-CNKtyIol-BPke8suV.js} +1 -1
- package/build/assets/{index-TR6pX8nH-B5Qwf3Y2.js → index-CO05R5cS-DHfFy15g.js} +1 -1
- package/build/assets/{index-vsSnzLDF-CYwXIqdH.js → index-CQfw52g6-BJ-a84bb.js} +1 -1
- package/build/assets/{index-C7M-Z8_R-DqgCTsJ0.js → index-CTvmRzFN-By1zFrdQ.js} +1 -1
- package/build/assets/{index-BUdRujoV-Bfg81rAj.js → index-Cb_C2vCk-DrzTyNQF.js} +5 -5
- package/build/assets/{index-CN9bcWEZ-BbIMtkvi.js → index-CiBn_-AR-CMINgD7R.js} +1 -1
- package/build/assets/{index-DSDCNpbF-BVgtNOEo.js → index-CnMc0ayy-CKIU12h5.js} +1 -1
- package/build/assets/{index-C3BOWUoD-BYG7HL0F.js → index-D0Ry9mHz-DBJluHQV.js} +1 -1
- package/build/assets/{index-CsE-EDrH-CJOeZcb2.js → index-D2j0kQLw-67iH-2yA.js} +1 -1
- package/build/assets/{index-C-JP28SD-iteBg9_9.js → index-D42P77wj-jZCT0fQL.js} +1 -1
- package/build/assets/{index-BJ2kpCS_-BaQee2_8.js → index-D7LfqMh3-DvKIa3UK.js} +1 -1
- package/build/assets/{index-BOFZKg22-C4O3MBH4.js → index-DD64_I3e-Cxdt0Oji.js} +1 -1
- package/build/assets/{index-5-cNs0Gx-CuJiW0Wp.js → index-DEYeMrzr-DP5rSRot.js} +1 -1
- package/build/assets/{index-BlgXRUCL-DT54Wcnn.js → index-DTog-cZN-vTBq72Ci.js} +1 -1
- package/build/assets/{index-DylhRo5T-jKp1cHw_.js → index-DU0kTHM_-CInhbPr8.js} +1 -1
- package/build/assets/{index-CjoF8x6G-rOfzi3h2.js → index-DeKEPgyN-DF3OyxuW.js} +1 -1
- package/build/assets/{index-D_tjqFri-C10O4DkQ.js → index-DrS8S2M--C4mGh6T8.js} +1 -1
- package/build/assets/{index-CCKLeb7c-DiCL-qAt.js → index-DxTzjSNF-B-v_CQEN.js} +1 -1
- package/build/assets/{index-BwItsjk1-BBFXlpwo.js → index-IXLMpVV4-D8dPiMEz.js} +1 -1
- package/build/assets/{index-drbPV9RO-BZ_2tUOv.js → index-Ray843Xd-CpBr9wfH.js} +1 -1
- package/build/assets/{index-CALVxRWk-OXCn3_Zb.js → index-S-A7KecP-DJ0BKtLt.js} +1 -1
- package/build/assets/{index-De80aB3n-Dk7-6mgY.js → index-SbKh1OIB-BjfuWdcF.js} +1 -1
- package/build/assets/{index-BCD3qYZm-3dUep6KP.js → index-Uvv6so0Q-Lbl8GAad.js} +1 -1
- package/build/assets/{index-dPJN2mSF-BQ3y95nd.js → index-YbT2v6Cb-CoC81Jcm.js} +1 -1
- package/build/assets/{index-BsMCHX15-DTBgOE8y.js → index-vRM8HrbM-CZbE9IiJ.js} +1 -1
- package/build/assets/{index-D2QnP1M_-DM8257jJ.js → index-y3ITDERN-Ccy-wRE2.js} +1 -1
- package/build/assets/{inherits-DfAVxMSJ-CZIIOQ8k.js → inherits-CYghrBFU-Cf4k8aUQ.js} +1 -1
- package/build/assets/{input-CbOz0FnA-Klb21A9f.js → input-DNUwcYWK-C9eVW6-S.js} +1 -1
- package/build/assets/{memory-B3L1Fctl-DKiYdOg0.js → memory-B3L1Fctl-CQ-Y_gc6.js} +1 -1
- package/build/assets/{number-overlay-editor-DNRSxPnE-BE7Xr_c1.js → number-overlay-editor-C2e7pY6x-BnC-vP7l.js} +1 -1
- package/build/assets/{sandbox-ChAzL-i--CagQkIrB.js → sandbox-ChAzL-i--DqMwo4R7.js} +1 -1
- package/build/assets/{slicedToArray-DPtlZZHF-C_Rx2ODv.js → slicedToArray-D4uL3Bzl-95JmZlNK.js} +1 -1
- package/build/assets/{timepicker-Bl5n1Hs_-CMvacYKJ.js → timepicker-CkLW19xP-CTuglWU6.js} +1 -1
- package/build/assets/{uniqueId-CY-CvtXB-CPhRY98h.js → uniqueId-C6wp_e1D-D_RnWRJW.js} +1 -1
- package/build/assets/{useBasicWidgetState-CcvdwkOI-DOgmtoFM.js → useBasicWidgetState-BTyLgyXa-DI96f9E0.js} +1 -1
- package/build/assets/{useTextInputAutoExpand-CKzlRc94-C2SJR99z.js → useTextInputAutoExpand-YLx_K1sh-DhWKaGOV.js} +1 -1
- package/build/assets/{useUpdateUiValue-BfDOTwv7-DRnzNkty.js → useUpdateUiValue-B9j1K8e5-CIeTAxHC.js} +1 -1
- package/build/assets/{withFullScreenWrapper-mCnTzCqV-DFYwNHzE.js → withFullScreenWrapper-DqrJMIkm-BwrYir6f.js} +1 -1
- package/build/assets/{worker-B65uO5d3-CuVvmm9s.js → worker-DAN7Os1o-BP8Vk1l7.js} +8 -8
- package/build/electron/worker.js +7 -7
- package/build/index.html +1 -1
- package/build/pyodide/pyodide-lock.json +1 -1
- package/build/pyodide/pyodide.asm.js +1 -1
- package/build/pyodide/pyodide.asm.wasm +0 -0
- package/build/pyodide/pyodide.mjs +3 -3
- package/build/pyodide/python_stdlib.zip +0 -0
- package/package.json +4 -4
- package/wheels/stlite_lib-0.1.0-py3-none-any.whl +0 -0
- package/wheels/streamlit-1.51.0-cp313-none-any.whl +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,b as J}from"./index-
|
|
1
|
+
import{r,b as J}from"./index-BvblFOYP.js";import{k as R,E as Q,V as U,M as Z,a as ee,u as te,f as re}from"./index-Cb_C2vCk-DrzTyNQF.js";import"./withFullScreenWrapper-DqrJMIkm-BwrYir6f.js";import"./Toolbar-Cc8tCeKL-JHIp2NvW.js";import"./FormClearHelper-DtwjWakY-CxfcniD6.js";import"./sprintf-D5E86llw-6tzWM3a-.js";import"./checkbox-CG80fxUD-CavQvTtP.js";import"./createDownloadLinkElement-CbRjLJ8e-NbV49OP9.js";import"./slicedToArray-D4uL3Bzl-95JmZlNK.js";import"./inherits-CYghrBFU-Cf4k8aUQ.js";import"./createSuper-BlgWzn8_-h1vcwEzv.js";import"./FileDownload.esm-ORp-UC-S-BrsUfuH5.js";const ie=()=>t=>t.targetX,ae=()=>t=>t.targetY,oe=()=>t=>t.targetWidth,ne=()=>t=>t.targetHeight,se=()=>t=>t.targetY+10,le=()=>t=>Math.max(0,(t.targetHeight-28)/2),de=re("div")({name:"DataGridOverlayEditorStyle",class:"gdg-d19meir1",propsAsIs:!1,vars:{"d19meir1-0":[ae(),"px"],"d19meir1-1":[ie(),"px"],"d19meir1-2":[oe(),"px"],"d19meir1-3":[ne(),"px"],"d19meir1-4":[se(),"px"],"d19meir1-5":[le(),"px"]}});function ce(){const[t,o]=r.useState();return[t??void 0,o]}function ue(){const[t,o]=ce(),[a,v]=r.useState(0),[m,b]=r.useState(!0);r.useLayoutEffect(()=>{if(t===void 0||!("IntersectionObserver"in window))return;const n=new IntersectionObserver(s=>{s.length!==0&&b(s[0].isIntersecting)},{threshold:1});return n.observe(t),()=>n.disconnect()},[t]),r.useEffect(()=>{if(m||t===void 0)return;let n;const s=()=>{const{right:k}=t.getBoundingClientRect();v(g=>Math.min(g+window.innerWidth-k-10,0)),n=requestAnimationFrame(s)};return n=requestAnimationFrame(s),()=>{n!==void 0&&cancelAnimationFrame(n)}},[t,m]);const C=r.useMemo(()=>({transform:`translateX(${a}px)`}),[a]);return{ref:o,style:C}}const we=t=>{const{target:o,content:a,onFinishEditing:v,forceEditMode:m,initialValue:b,imageEditorOverride:C,markdownDivCreateNode:n,highlight:s,className:k,theme:g,id:K,cell:f,bloom:M,portalElementRef:S,validateCell:p,getCellRenderer:P,provideEditor:N,isOutsideClick:W,customEventTarget:X,activation:x}=t,[l,q]=r.useState(m?a:void 0),w=r.useRef(l??a);w.current=l??a;const[h,F]=r.useState(()=>p===void 0?!0:!(R(a)&&p?.(f,a,w.current)===!1)),c=r.useCallback((e,i)=>{v(h?e:void 0,i)},[h,v]),B=r.useCallback(e=>{if(p!==void 0&&e!==void 0&&R(e)){const i=p(f,e,w.current);i===!1?F(!1):(typeof i=="object"&&(e=i),F(!0))}q(e)},[f,p]),E=r.useRef(!1),u=r.useRef(void 0),G=r.useCallback(()=>{c(l,[0,0]),E.current=!0},[l,c]),j=r.useCallback((e,i)=>{c(e,i??u.current??[0,0]),E.current=!0},[c]),L=r.useCallback(async e=>{let i=!1;e.key==="Escape"?(e.stopPropagation(),e.preventDefault(),u.current=[0,0]):e.key==="Enter"&&!e.shiftKey?(e.stopPropagation(),e.preventDefault(),u.current=[0,1],i=!0):e.key==="Tab"&&(e.stopPropagation(),e.preventDefault(),u.current=[e.shiftKey?-1:1,0],i=!0),window.setTimeout(()=>{!E.current&&u.current!==void 0&&(c(i?l:void 0,u.current),E.current=!0)},0)},[c,l]),O=l??a,[d,$]=r.useMemo(()=>{if(Q(a))return[];const e={...a,location:f,activation:x},i=N?.(e);return i!==void 0?[i,!1]:[P(a)?.provideEditor?.(e),!1]},[f,a,P,N,x]),{ref:z,style:_}=ue();let I=!0,V,A=!0,y;if(d!==void 0){I=d.disablePadding!==!0,A=d.disableStyling!==!0;const e=U(d);e&&(y=d.styleOverride);const i=e?d.editor:d;V=r.createElement(i,{portalElementRef:S,isHighlighted:s,activation:x,onChange:B,value:O,initialValue:b,onFinishedEditing:j,validatedSelection:R(O)?O.selectionRange:void 0,forceEditMode:m,target:o,imageEditorOverride:C,markdownDivCreateNode:n,isValid:h,theme:g})}y={...y,..._};const H=S?.current??document.getElementById("portal");if(H===null)return console.error('Cannot open Data Grid overlay editor, because portal not found. Please, either provide a portalElementRef or add `<div id="portal" />` as the last child of your `<body>`.'),null;let D=A?"gdg-style":"gdg-unstyle";h||(D+=" gdg-invalid"),I&&(D+=" gdg-pad");const T=M?.[0]??1,Y=M?.[1]??1;return J.createPortal(r.createElement(Z.Provider,{value:g},r.createElement(ee,{style:te(g),className:k,onClickOutside:G,isOutsideClick:W,customEventTarget:X},r.createElement(de,{ref:z,id:K,className:D,style:y,as:$===!0?"label":void 0,targetX:o.x-T,targetY:o.y-Y,targetWidth:o.width+T*2,targetHeight:o.height+Y*2},r.createElement("div",{className:"gdg-clip-region",onKeyDown:L},V)))),H)};export{we as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as f,e as b}from"./es6--XPcqeHG-
|
|
1
|
+
import{c as f,e as b}from"./es6--XPcqeHG-DdkxL8eW.js";import"./index-BvblFOYP.js";const{WritableStream:y,TransformStream:_,DOMException:P,Blob:m}=f,{GONE:v}=b,M=/constructor/i.test(window.HTMLElement);class A{constructor(e="unkown"){this.name=e,this.kind="file"}async getFile(){throw new P(...v)}async isSameEntry(e){return this===e}async createWritable(e={}){const t=await navigator.serviceWorker?.getRegistration(),a=document.createElement("a"),o=new _,u=o.writable;if(a.download=this.name,M||!t){let s=[];o.readable.pipeTo(new y({write(r){s.push(new m([r]))},close(){const r=new m(s,{type:"application/octet-stream; charset=utf-8"});s=[],a.href=URL.createObjectURL(r),a.click(),setTimeout(()=>URL.revokeObjectURL(a.href),1e4)}}))}else{const{writable:s,readablePort:r}=new O(y),n=encodeURIComponent(this.name).replace(/['()]/g,escape).replace(/\*/g,"%2A"),g={"content-disposition":"attachment; filename*=UTF-8''"+n,"content-type":"application/octet-stream; charset=utf-8",...e.size?{"content-length":e.size}:{}},w=setTimeout(()=>t.active.postMessage(0),1e4);o.readable.pipeThrough(new _({transform(c,h){if(c instanceof Uint8Array)return h.enqueue(c);const R=new Response(c).body.getReader(),d=S=>R.read().then(p=>p.done?0:d(h.enqueue(p.value)));return d()}})).pipeTo(s).finally(()=>{clearInterval(w)}),t.active.postMessage({url:t.scope+n,headers:g,readablePort:r},[r]);const i=document.createElement("iframe");i.hidden=!0,i.src=t.scope+n,document.body.appendChild(i)}return u.getWriter()}}const E=0,T=0,U=1,j=1,k=2;class L{constructor(e){e.onmessage=t=>this._onMessage(t.data),this._port=e,this._resetReady()}start(e){return this._controller=e,this._readyPromise}write(e){const t={type:E,chunk:e};return this._port.postMessage(t,[e.buffer]),this._resetReady(),this._readyPromise}close(){this._port.postMessage({type:k}),this._port.close()}abort(e){this._port.postMessage({type:j,reason:e}),this._port.close()}_onMessage(e){e.type===T&&this._resolveReady(),e.type===U&&this._onError(e.reason)}_onError(e){this._controller.error(e),this._rejectReady(e),this._port.close()}_resetReady(){this._readyPromise=new Promise((e,t)=>{this._readyResolve=e,this._readyReject=t}),this._readyPending=!0}_resolveReady(){this._readyResolve(),this._readyPending=!1}_rejectReady(e){this._readyPending||this._resetReady(),this._readyPromise.catch(()=>{}),this._readyReject(e),this._readyPending=!1}}class O{constructor(e){const t=new MessageChannel;this.readablePort=t.port1,this.writable=new e(new L(t.port2))}}export{A as FileHandle};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/downloader-DcCTL3Wz-
|
|
2
|
-
import{aK as b}from"./index-Cx-F6ZGn.js";const k=globalThis.showDirectoryPicker;async function j(i={}){if(k&&!i._preferPolyfill)return k(i);const e=document.createElement("input");e.type="file",e.webkitdirectory=!0,e.multiple=!0,e.style.position="fixed",e.style.top="-100000px",e.style.left="-100000px",document.body.appendChild(e);const t=Promise.resolve().then(()=>A);return await new Promise(r=>{e.addEventListener("change",r),e.click()}),t.then(r=>r.getDirHandlesFromInput(e))}const N={accepts:[]},x=globalThis.showOpenFilePicker;async function L(i={}){const e={...N,...i};if(x&&!i._preferPolyfill)return x(e);const t=document.createElement("input");t.type="file",t.multiple=e.multiple,t.accept=(e.accepts||[]).map(n=>[...(n.extensions||[]).map(s=>"."+s),...n.mimeTypes||[]]).flat().join(","),Object.assign(t.style,{position:"fixed",top:"-100000px",left:"-100000px"}),document.body.appendChild(t);const r=Promise.resolve().then(()=>A);return await new Promise(n=>{t.addEventListener("change",n,{once:!0}),t.click()}),t.remove(),r.then(n=>n.getFileHandlesFromInput(t))}const I=globalThis.showSaveFilePicker;async function W(i={}){if(I&&!i._preferPolyfill)return I(i);i._name&&(console.warn("deprecated _name, spec now have `suggestedName`"),i.suggestedName=i._name);const{FileSystemFileHandle:e}=await Promise.resolve().then(()=>h),{FileHandle:t}=await b(async()=>{const{FileHandle:r}=await import("./downloader-DcCTL3Wz-aWEH86Cm.js");return{FileHandle:r}},__vite__mapDeps([0,1,2]));return new e(new t(i.suggestedName))}globalThis.DataTransferItem&&!DataTransferItem.prototype.getAsFileSystemHandle&&(DataTransferItem.prototype.getAsFileSystemHandle=async function(){const i=this.webkitGetAsEntry(),[{FileHandle:e,FolderHandle:t},{FileSystemDirectoryHandle:r},{FileSystemFileHandle:n}]=await Promise.all([b(()=>import("./sandbox-ChAzL-i--CagQkIrB.js"),__vite__mapDeps([3,1,2])),Promise.resolve().then(()=>_),Promise.resolve().then(()=>h)]);return i.isFile?new n(new e(i,!1)):new r(new t(i,!1))});async function R(i,e={}){if(!i)return globalThis.navigator?.storage?.getDirectory()||globalThis.getOriginPrivateDirectory();const{FileSystemDirectoryHandle:t}=await Promise.resolve().then(()=>_),r=await i,n=await(r.default?r.default(e):r(e));return new t(n)}const q={WritableStream:globalThis.WritableStream,TransformStream:globalThis.TransformStream,DOMException:globalThis.DOMException,Blob:globalThis.Blob,File:globalThis.File},{WritableStream:z}=q;class m extends z{#e;constructor(e){super(e),this.#e=e,Object.setPrototypeOf(this,m.prototype),this._closed=!1}async close(){this._closed=!0;const e=this.getWriter(),t=e.close();return e.releaseLock(),t}seek(e){return this.write({type:"seek",position:e})}truncate(e){return this.write({type:"truncate",size:e})}write(e){if(this._closed)return Promise.reject(new TypeError("Cannot write to a CLOSED writable stream"));const t=this.getWriter(),r=t.write(e);return t.releaseLock(),r}}Object.defineProperty(m.prototype,Symbol.toStringTag,{value:"FileSystemWritableFileStream",writable:!1,enumerable:!1,configurable:!0});Object.defineProperties(m.prototype,{close:{enumerable:!0},seek:{enumerable:!0},truncate:{enumerable:!0},write:{enumerable:!0}});globalThis.FileSystemFileHandle&&!globalThis.FileSystemFileHandle.prototype.createWritable&&!globalThis.FileSystemWritableFileStream&&(globalThis.FileSystemWritableFileStream=m);const y=Symbol("adapter");class T{[y];name;kind;constructor(e){this.kind=e.kind,this.name=e.name,this[y]=e}async queryPermission(e={}){const{mode:t="read"}=e,r=this[y];if(r.queryPermission)return r.queryPermission({mode:t});if(t==="read")return"granted";if(t==="readwrite")return r.writable?"granted":"denied";throw new TypeError(`Mode ${t} must be 'read' or 'readwrite'`)}async requestPermission({mode:e="read"}={}){const t=this[y];if(t.requestPermission)return t.requestPermission({mode:e});if(e==="read")return"granted";if(e==="readwrite")return t.writable?"granted":"denied";throw new TypeError(`Mode ${e} must be 'read' or 'readwrite'`)}async remove(e={}){await this[y].remove(e)}async isSameEntry(e){return this===e?!0:!e||typeof e!="object"||this.kind!==e.kind||!e[y]?!1:this[y].isSameEntry(e[y])}}Object.defineProperty(T.prototype,Symbol.toStringTag,{value:"FileSystemHandle",writable:!1,enumerable:!1,configurable:!0});globalThis.FileSystemHandle&&(globalThis.FileSystemHandle.prototype.queryPermission??=function(i){return"granted"});const O={INVALID:["seeking position failed.","InvalidStateError"],GONE:["A requested file or directory could not be found at the time an operation was processed.","NotFoundError"],MISMATCH:["The path supplied exists, but was not an entry of requested type.","TypeMismatchError"],MOD_ERR:["The object can not be modified in this way.","InvalidModificationError"],SYNTAX:i=>[`Failed to execute 'write' on 'UnderlyingSinkBase': Invalid params passed. ${i}`,"SyntaxError"],SECURITY:["It was determined that certain files are unsafe for access within a Web application, or that too many calls are being made on file resources.","SecurityError"],DISALLOWED:["The request is not allowed by the user agent or the platform in the current context.","NotAllowedError"]},U={writable:globalThis.WritableStream};async function V(i){console.warn("deprecated fromDataTransfer - use `dt.items[0].getAsFileSystemHandle()` instead");const[e,t,r]=await Promise.all([b(()=>import("./memory-B3L1Fctl-DKiYdOg0.js"),__vite__mapDeps([4,1,2])),b(()=>import("./sandbox-ChAzL-i--CagQkIrB.js"),__vite__mapDeps([3,1,2])),Promise.resolve().then(()=>_)]),n=new e.FolderHandle("",!1);return n._entries=i.map(s=>s.isFile?new t.FileHandle(s,!1):new t.FolderHandle(s,!1)),new r.FileSystemDirectoryHandle(n)}async function B(i){const{FolderHandle:e,FileHandle:t}=await b(async()=>{const{FolderHandle:c,FileHandle:o}=await import("./memory-B3L1Fctl-DKiYdOg0.js");return{FolderHandle:c,FileHandle:o}},__vite__mapDeps([4,1,2])),{FileSystemDirectoryHandle:r}=await Promise.resolve().then(()=>_),n=Array.from(i.files),s=n[0].webkitRelativePath.split("/",1)[0],l=new e(s,!1);return n.forEach(c=>{const o=c.webkitRelativePath.split("/");o.shift();const d=o.pop(),p=o.reduce((f,w)=>(f._entries[w]||(f._entries[w]=new e(w,!1)),f._entries[w]),l);p._entries[d]=new t(c.name,c,!1)}),new r(l)}async function C(i){const{FileHandle:e}=await b(async()=>{const{FileHandle:r}=await import("./memory-B3L1Fctl-DKiYdOg0.js");return{FileHandle:r}},__vite__mapDeps([4,1,2])),{FileSystemFileHandle:t}=await Promise.resolve().then(()=>h);return Array.from(i.files).map(r=>new t(new e(r.name,r,!1)))}const A=Object.freeze(Object.defineProperty({__proto__:null,config:U,errors:O,fromDataTransfer:V,getDirHandlesFromInput:B,getFileHandlesFromInput:C},Symbol.toStringTag,{value:"Module"})),{GONE:G,MOD_ERR:$}=O,u=Symbol("adapter");let S=class H extends T{[u];constructor(e){super(e),this[u]=e}async getDirectoryHandle(e,t={}){if(e==="")throw new TypeError("Name can't be an empty string.");if(e==="."||e===".."||e.includes("/"))throw new TypeError("Name contains invalid characters.");t.create=!!t.create;const r=await this[u].getDirectoryHandle(e,t);return new H(r)}async*entries(){const{FileSystemFileHandle:e}=await Promise.resolve().then(()=>h);for await(const[t,r]of this[u].entries())yield[r.name,r.kind==="file"?new e(r):new H(r)]}async*getEntries(){const{FileSystemFileHandle:e}=await Promise.resolve().then(()=>h);console.warn("deprecated, use .entries() instead");for await(let t of this[u].entries())yield t.kind==="file"?new e(t):new H(t)}async getFileHandle(e,t={}){const{FileSystemFileHandle:r}=await Promise.resolve().then(()=>h);if(e==="")throw new TypeError("Name can't be an empty string.");if(e==="."||e===".."||e.includes("/"))throw new TypeError("Name contains invalid characters.");t.create=!!t.create;const n=await this[u].getFileHandle(e,t);return new r(n)}async removeEntry(e,t={}){if(e==="")throw new TypeError("Name can't be an empty string.");if(e==="."||e===".."||e.includes("/"))throw new TypeError("Name contains invalid characters.");return t.recursive=!!t.recursive,this[u].removeEntry(e,t)}async resolve(e){if(await e.isSameEntry(this))return[];const t=[{handle:this,path:[]}];for(;t.length;){let{handle:r,path:n}=t.pop();for await(const s of r.values()){if(await s.isSameEntry(e))return[...n,s.name];s.kind==="directory"&&t.push({handle:s,path:[...n,s.name]})}}return null}async*keys(){for await(const[e]of this[u].entries())yield e}async*values(){for await(const[e,t]of this)yield t}[Symbol.asyncIterator](){return this.entries()}};Object.defineProperty(S.prototype,Symbol.toStringTag,{value:"FileSystemDirectoryHandle",writable:!1,enumerable:!1,configurable:!0});Object.defineProperties(S.prototype,{getDirectoryHandle:{enumerable:!0},entries:{enumerable:!0},getFileHandle:{enumerable:!0},removeEntry:{enumerable:!0}});if(globalThis.FileSystemDirectoryHandle){const i=globalThis.FileSystemDirectoryHandle.prototype;i.resolve=async function(n){if(await n.isSameEntry(this))return[];const s=[{handle:this,path:[]}];for(;s.length;){let{handle:l,path:c}=s.pop();for await(const o of l.values()){if(await o.isSameEntry(n))return[...c,o.name];o.kind==="directory"&&s.push({handle:o,path:[...c,o.name]})}}return null};async function e(n){if(await(await navigator.storage.getDirectory()).resolve(n)===null)throw new DOMException(...G)}const t=i.entries;i.entries=async function*(){await e(this),yield*t.call(this)},i[Symbol.asyncIterator]=async function*(){yield*this.entries()};const r=i.removeEntry;i.removeEntry=async function(n,s={}){return r.call(this,n,s).catch(async l=>{throw l instanceof DOMException&&l.name==="UnknownError"&&!s.recursive&&!(await t.call(this).next()).done?new DOMException(...$):l})}}const _=Object.freeze(Object.defineProperty({__proto__:null,FileSystemDirectoryHandle:S,default:S},Symbol.toStringTag,{value:"Module"})),{INVALID:Y,SYNTAX:D,GONE:X}=O,v=Symbol("adapter");class E extends T{[v];constructor(e){super(e),this[v]=e}async createWritable(e={}){return new m(await this[v].createWritable(e))}async getFile(){return this[v].getFile()}}Object.defineProperty(E.prototype,Symbol.toStringTag,{value:"FileSystemFileHandle",writable:!1,enumerable:!1,configurable:!0});Object.defineProperties(E.prototype,{createWritable:{enumerable:!0},getFile:{enumerable:!0}});if(globalThis.FileSystemFileHandle&&!globalThis.FileSystemFileHandle.prototype.createWritable){const i=new WeakMap;let e;const t=()=>{let n,s;onmessage=async l=>{const c=l.ports[0],o=l.data;switch(o.type){case"open":const d=o.name;let p=await navigator.storage.getDirectory();for(const f of o.path)p=await p.getDirectoryHandle(f);n=await p.getFileHandle(d),s=await n.createSyncAccessHandle();break;case"write":s.write(o.data,{at:o.position}),s.flush();break;case"truncate":s.truncate(o.size);break;case"abort":case"close":s.close();break}c.postMessage(0)}};globalThis.FileSystemFileHandle.prototype.createWritable=async function(n){if(!e){const a=`(${t.toString()})()`,g=new Blob([a],{type:"text/javascript"});e=URL.createObjectURL(g)}const s=new Worker(e,{type:"module"});let l=0;const c=new TextEncoder;let o=await this.getFile().then(a=>a.size);const d=a=>new Promise((g,M)=>{const F=new MessageChannel;F.port1.onmessage=P=>{P.data instanceof Error?M(P.data):g(P.data),F.port1.close(),F.port2.close(),F.port1.onmessage=null},s.postMessage(a,[F.port2])}),p=await navigator.storage.getDirectory(),f=await i.get(this),w=await p.resolve(f);if(w===null)throw new DOMException(...X);return await d({type:"open",path:w,name:this.name}),n?.keepExistingData===!1&&(await d({type:"truncate",size:0}),o=0),new m({start:a=>{},async write(a){if(a?.constructor===Object?a={...a}:a={type:"write",data:a,position:l},a.type==="write"){if(!("data"in a))throw await d({type:"close"}),new DOMException(...D("write requires a data argument"));if(a.position??=l,typeof a.data=="string")a.data=c.encode(a.data);else if(a.data instanceof ArrayBuffer)a.data=new Uint8Array(a.data);else if(!(a.data instanceof Uint8Array)&&ArrayBuffer.isView(a.data))a.data=new Uint8Array(a.data.buffer,a.data.byteOffset,a.data.byteLength);else if(!(a.data instanceof Uint8Array)){const g=await new Response(a.data).arrayBuffer();a.data=new Uint8Array(g)}Number.isInteger(a.position)&&a.position>=0&&(l=a.position),l+=a.data.byteLength,o+=a.data.byteLength}else if(a.type==="seek")if(Number.isInteger(a.position)&&a.position>=0){if(o<a.position)throw new DOMException(...Y);console.log("seeking",a),l=a.position;return}else throw await d({type:"close"}),new DOMException(...D("seek requires a position argument"));else if(a.type==="truncate")if(Number.isInteger(a.size)&&a.size>=0)o=a.size,l>o&&(l=o);else throw await d({type:"close"}),new DOMException(...D("truncate requires a size argument"));await d(a)},async close(){await d({type:"close"}),s.terminate()},async abort(a){await d({type:"abort",reason:a}),s.terminate()}})};const r=FileSystemDirectoryHandle.prototype.getFileHandle;FileSystemDirectoryHandle.prototype.getFileHandle=async function(...n){const s=await r.call(this,...n);return i.set(s,this),s}}const h=Object.freeze(Object.defineProperty({__proto__:null,FileSystemFileHandle:E,default:E},Symbol.toStringTag,{value:"Module"})),K=Object.freeze(Object.defineProperty({__proto__:null,FileSystemDirectoryHandle:S,FileSystemFileHandle:E,FileSystemHandle:T,FileSystemWritableFileStream:m,getOriginPrivateDirectory:R,showDirectoryPicker:j,showOpenFilePicker:L,showSaveFilePicker:W},Symbol.toStringTag,{value:"Module"}));export{K as a,q as c,O as e};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/downloader-DcCTL3Wz-CqotLrf1.js","assets/index-BvblFOYP.js","assets/index-DnTjZ9IR.css","assets/sandbox-ChAzL-i--DqMwo4R7.js","assets/memory-B3L1Fctl-CQ-Y_gc6.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{aK as b}from"./index-BvblFOYP.js";const k=globalThis.showDirectoryPicker;async function j(i={}){if(k&&!i._preferPolyfill)return k(i);const e=document.createElement("input");e.type="file",e.webkitdirectory=!0,e.multiple=!0,e.style.position="fixed",e.style.top="-100000px",e.style.left="-100000px",document.body.appendChild(e);const t=Promise.resolve().then(()=>A);return await new Promise(r=>{e.addEventListener("change",r),e.click()}),t.then(r=>r.getDirHandlesFromInput(e))}const N={accepts:[]},x=globalThis.showOpenFilePicker;async function L(i={}){const e={...N,...i};if(x&&!i._preferPolyfill)return x(e);const t=document.createElement("input");t.type="file",t.multiple=e.multiple,t.accept=(e.accepts||[]).map(n=>[...(n.extensions||[]).map(s=>"."+s),...n.mimeTypes||[]]).flat().join(","),Object.assign(t.style,{position:"fixed",top:"-100000px",left:"-100000px"}),document.body.appendChild(t);const r=Promise.resolve().then(()=>A);return await new Promise(n=>{t.addEventListener("change",n,{once:!0}),t.click()}),t.remove(),r.then(n=>n.getFileHandlesFromInput(t))}const I=globalThis.showSaveFilePicker;async function W(i={}){if(I&&!i._preferPolyfill)return I(i);i._name&&(console.warn("deprecated _name, spec now have `suggestedName`"),i.suggestedName=i._name);const{FileSystemFileHandle:e}=await Promise.resolve().then(()=>h),{FileHandle:t}=await b(async()=>{const{FileHandle:r}=await import("./downloader-DcCTL3Wz-CqotLrf1.js");return{FileHandle:r}},__vite__mapDeps([0,1,2]));return new e(new t(i.suggestedName))}globalThis.DataTransferItem&&!DataTransferItem.prototype.getAsFileSystemHandle&&(DataTransferItem.prototype.getAsFileSystemHandle=async function(){const i=this.webkitGetAsEntry(),[{FileHandle:e,FolderHandle:t},{FileSystemDirectoryHandle:r},{FileSystemFileHandle:n}]=await Promise.all([b(()=>import("./sandbox-ChAzL-i--DqMwo4R7.js"),__vite__mapDeps([3,1,2])),Promise.resolve().then(()=>_),Promise.resolve().then(()=>h)]);return i.isFile?new n(new e(i,!1)):new r(new t(i,!1))});async function R(i,e={}){if(!i)return globalThis.navigator?.storage?.getDirectory()||globalThis.getOriginPrivateDirectory();const{FileSystemDirectoryHandle:t}=await Promise.resolve().then(()=>_),r=await i,n=await(r.default?r.default(e):r(e));return new t(n)}const q={WritableStream:globalThis.WritableStream,TransformStream:globalThis.TransformStream,DOMException:globalThis.DOMException,Blob:globalThis.Blob,File:globalThis.File},{WritableStream:z}=q;class m extends z{#e;constructor(e){super(e),this.#e=e,Object.setPrototypeOf(this,m.prototype),this._closed=!1}async close(){this._closed=!0;const e=this.getWriter(),t=e.close();return e.releaseLock(),t}seek(e){return this.write({type:"seek",position:e})}truncate(e){return this.write({type:"truncate",size:e})}write(e){if(this._closed)return Promise.reject(new TypeError("Cannot write to a CLOSED writable stream"));const t=this.getWriter(),r=t.write(e);return t.releaseLock(),r}}Object.defineProperty(m.prototype,Symbol.toStringTag,{value:"FileSystemWritableFileStream",writable:!1,enumerable:!1,configurable:!0});Object.defineProperties(m.prototype,{close:{enumerable:!0},seek:{enumerable:!0},truncate:{enumerable:!0},write:{enumerable:!0}});globalThis.FileSystemFileHandle&&!globalThis.FileSystemFileHandle.prototype.createWritable&&!globalThis.FileSystemWritableFileStream&&(globalThis.FileSystemWritableFileStream=m);const y=Symbol("adapter");class T{[y];name;kind;constructor(e){this.kind=e.kind,this.name=e.name,this[y]=e}async queryPermission(e={}){const{mode:t="read"}=e,r=this[y];if(r.queryPermission)return r.queryPermission({mode:t});if(t==="read")return"granted";if(t==="readwrite")return r.writable?"granted":"denied";throw new TypeError(`Mode ${t} must be 'read' or 'readwrite'`)}async requestPermission({mode:e="read"}={}){const t=this[y];if(t.requestPermission)return t.requestPermission({mode:e});if(e==="read")return"granted";if(e==="readwrite")return t.writable?"granted":"denied";throw new TypeError(`Mode ${e} must be 'read' or 'readwrite'`)}async remove(e={}){await this[y].remove(e)}async isSameEntry(e){return this===e?!0:!e||typeof e!="object"||this.kind!==e.kind||!e[y]?!1:this[y].isSameEntry(e[y])}}Object.defineProperty(T.prototype,Symbol.toStringTag,{value:"FileSystemHandle",writable:!1,enumerable:!1,configurable:!0});globalThis.FileSystemHandle&&(globalThis.FileSystemHandle.prototype.queryPermission??=function(i){return"granted"});const O={INVALID:["seeking position failed.","InvalidStateError"],GONE:["A requested file or directory could not be found at the time an operation was processed.","NotFoundError"],MISMATCH:["The path supplied exists, but was not an entry of requested type.","TypeMismatchError"],MOD_ERR:["The object can not be modified in this way.","InvalidModificationError"],SYNTAX:i=>[`Failed to execute 'write' on 'UnderlyingSinkBase': Invalid params passed. ${i}`,"SyntaxError"],SECURITY:["It was determined that certain files are unsafe for access within a Web application, or that too many calls are being made on file resources.","SecurityError"],DISALLOWED:["The request is not allowed by the user agent or the platform in the current context.","NotAllowedError"]},U={writable:globalThis.WritableStream};async function V(i){console.warn("deprecated fromDataTransfer - use `dt.items[0].getAsFileSystemHandle()` instead");const[e,t,r]=await Promise.all([b(()=>import("./memory-B3L1Fctl-CQ-Y_gc6.js"),__vite__mapDeps([4,1,2])),b(()=>import("./sandbox-ChAzL-i--DqMwo4R7.js"),__vite__mapDeps([3,1,2])),Promise.resolve().then(()=>_)]),n=new e.FolderHandle("",!1);return n._entries=i.map(s=>s.isFile?new t.FileHandle(s,!1):new t.FolderHandle(s,!1)),new r.FileSystemDirectoryHandle(n)}async function B(i){const{FolderHandle:e,FileHandle:t}=await b(async()=>{const{FolderHandle:c,FileHandle:o}=await import("./memory-B3L1Fctl-CQ-Y_gc6.js");return{FolderHandle:c,FileHandle:o}},__vite__mapDeps([4,1,2])),{FileSystemDirectoryHandle:r}=await Promise.resolve().then(()=>_),n=Array.from(i.files),s=n[0].webkitRelativePath.split("/",1)[0],l=new e(s,!1);return n.forEach(c=>{const o=c.webkitRelativePath.split("/");o.shift();const d=o.pop(),p=o.reduce((f,w)=>(f._entries[w]||(f._entries[w]=new e(w,!1)),f._entries[w]),l);p._entries[d]=new t(c.name,c,!1)}),new r(l)}async function C(i){const{FileHandle:e}=await b(async()=>{const{FileHandle:r}=await import("./memory-B3L1Fctl-CQ-Y_gc6.js");return{FileHandle:r}},__vite__mapDeps([4,1,2])),{FileSystemFileHandle:t}=await Promise.resolve().then(()=>h);return Array.from(i.files).map(r=>new t(new e(r.name,r,!1)))}const A=Object.freeze(Object.defineProperty({__proto__:null,config:U,errors:O,fromDataTransfer:V,getDirHandlesFromInput:B,getFileHandlesFromInput:C},Symbol.toStringTag,{value:"Module"})),{GONE:G,MOD_ERR:$}=O,u=Symbol("adapter");let S=class H extends T{[u];constructor(e){super(e),this[u]=e}async getDirectoryHandle(e,t={}){if(e==="")throw new TypeError("Name can't be an empty string.");if(e==="."||e===".."||e.includes("/"))throw new TypeError("Name contains invalid characters.");t.create=!!t.create;const r=await this[u].getDirectoryHandle(e,t);return new H(r)}async*entries(){const{FileSystemFileHandle:e}=await Promise.resolve().then(()=>h);for await(const[t,r]of this[u].entries())yield[r.name,r.kind==="file"?new e(r):new H(r)]}async*getEntries(){const{FileSystemFileHandle:e}=await Promise.resolve().then(()=>h);console.warn("deprecated, use .entries() instead");for await(let t of this[u].entries())yield t.kind==="file"?new e(t):new H(t)}async getFileHandle(e,t={}){const{FileSystemFileHandle:r}=await Promise.resolve().then(()=>h);if(e==="")throw new TypeError("Name can't be an empty string.");if(e==="."||e===".."||e.includes("/"))throw new TypeError("Name contains invalid characters.");t.create=!!t.create;const n=await this[u].getFileHandle(e,t);return new r(n)}async removeEntry(e,t={}){if(e==="")throw new TypeError("Name can't be an empty string.");if(e==="."||e===".."||e.includes("/"))throw new TypeError("Name contains invalid characters.");return t.recursive=!!t.recursive,this[u].removeEntry(e,t)}async resolve(e){if(await e.isSameEntry(this))return[];const t=[{handle:this,path:[]}];for(;t.length;){let{handle:r,path:n}=t.pop();for await(const s of r.values()){if(await s.isSameEntry(e))return[...n,s.name];s.kind==="directory"&&t.push({handle:s,path:[...n,s.name]})}}return null}async*keys(){for await(const[e]of this[u].entries())yield e}async*values(){for await(const[e,t]of this)yield t}[Symbol.asyncIterator](){return this.entries()}};Object.defineProperty(S.prototype,Symbol.toStringTag,{value:"FileSystemDirectoryHandle",writable:!1,enumerable:!1,configurable:!0});Object.defineProperties(S.prototype,{getDirectoryHandle:{enumerable:!0},entries:{enumerable:!0},getFileHandle:{enumerable:!0},removeEntry:{enumerable:!0}});if(globalThis.FileSystemDirectoryHandle){const i=globalThis.FileSystemDirectoryHandle.prototype;i.resolve=async function(n){if(await n.isSameEntry(this))return[];const s=[{handle:this,path:[]}];for(;s.length;){let{handle:l,path:c}=s.pop();for await(const o of l.values()){if(await o.isSameEntry(n))return[...c,o.name];o.kind==="directory"&&s.push({handle:o,path:[...c,o.name]})}}return null};async function e(n){if(await(await navigator.storage.getDirectory()).resolve(n)===null)throw new DOMException(...G)}const t=i.entries;i.entries=async function*(){await e(this),yield*t.call(this)},i[Symbol.asyncIterator]=async function*(){yield*this.entries()};const r=i.removeEntry;i.removeEntry=async function(n,s={}){return r.call(this,n,s).catch(async l=>{throw l instanceof DOMException&&l.name==="UnknownError"&&!s.recursive&&!(await t.call(this).next()).done?new DOMException(...$):l})}}const _=Object.freeze(Object.defineProperty({__proto__:null,FileSystemDirectoryHandle:S,default:S},Symbol.toStringTag,{value:"Module"})),{INVALID:Y,SYNTAX:D,GONE:X}=O,v=Symbol("adapter");class E extends T{[v];constructor(e){super(e),this[v]=e}async createWritable(e={}){return new m(await this[v].createWritable(e))}async getFile(){return this[v].getFile()}}Object.defineProperty(E.prototype,Symbol.toStringTag,{value:"FileSystemFileHandle",writable:!1,enumerable:!1,configurable:!0});Object.defineProperties(E.prototype,{createWritable:{enumerable:!0},getFile:{enumerable:!0}});if(globalThis.FileSystemFileHandle&&!globalThis.FileSystemFileHandle.prototype.createWritable){const i=new WeakMap;let e;const t=()=>{let n,s;onmessage=async l=>{const c=l.ports[0],o=l.data;switch(o.type){case"open":const d=o.name;let p=await navigator.storage.getDirectory();for(const f of o.path)p=await p.getDirectoryHandle(f);n=await p.getFileHandle(d),s=await n.createSyncAccessHandle();break;case"write":s.write(o.data,{at:o.position}),s.flush();break;case"truncate":s.truncate(o.size);break;case"abort":case"close":s.close();break}c.postMessage(0)}};globalThis.FileSystemFileHandle.prototype.createWritable=async function(n){if(!e){const a=`(${t.toString()})()`,g=new Blob([a],{type:"text/javascript"});e=URL.createObjectURL(g)}const s=new Worker(e,{type:"module"});let l=0;const c=new TextEncoder;let o=await this.getFile().then(a=>a.size);const d=a=>new Promise((g,M)=>{const F=new MessageChannel;F.port1.onmessage=P=>{P.data instanceof Error?M(P.data):g(P.data),F.port1.close(),F.port2.close(),F.port1.onmessage=null},s.postMessage(a,[F.port2])}),p=await navigator.storage.getDirectory(),f=await i.get(this),w=await p.resolve(f);if(w===null)throw new DOMException(...X);return await d({type:"open",path:w,name:this.name}),n?.keepExistingData===!1&&(await d({type:"truncate",size:0}),o=0),new m({start:a=>{},async write(a){if(a?.constructor===Object?a={...a}:a={type:"write",data:a,position:l},a.type==="write"){if(!("data"in a))throw await d({type:"close"}),new DOMException(...D("write requires a data argument"));if(a.position??=l,typeof a.data=="string")a.data=c.encode(a.data);else if(a.data instanceof ArrayBuffer)a.data=new Uint8Array(a.data);else if(!(a.data instanceof Uint8Array)&&ArrayBuffer.isView(a.data))a.data=new Uint8Array(a.data.buffer,a.data.byteOffset,a.data.byteLength);else if(!(a.data instanceof Uint8Array)){const g=await new Response(a.data).arrayBuffer();a.data=new Uint8Array(g)}Number.isInteger(a.position)&&a.position>=0&&(l=a.position),l+=a.data.byteLength,o+=a.data.byteLength}else if(a.type==="seek")if(Number.isInteger(a.position)&&a.position>=0){if(o<a.position)throw new DOMException(...Y);console.log("seeking",a),l=a.position;return}else throw await d({type:"close"}),new DOMException(...D("seek requires a position argument"));else if(a.type==="truncate")if(Number.isInteger(a.size)&&a.size>=0)o=a.size,l>o&&(l=o);else throw await d({type:"close"}),new DOMException(...D("truncate requires a size argument"));await d(a)},async close(){await d({type:"close"}),s.terminate()},async abort(a){await d({type:"abort",reason:a}),s.terminate()}})};const r=FileSystemDirectoryHandle.prototype.getFileHandle;FileSystemDirectoryHandle.prototype.getFileHandle=async function(...n){const s=await r.call(this,...n);return i.set(s,this),s}}const h=Object.freeze(Object.defineProperty({__proto__:null,FileSystemFileHandle:E,default:E},Symbol.toStringTag,{value:"Module"})),K=Object.freeze(Object.defineProperty({__proto__:null,FileSystemDirectoryHandle:S,FileSystemFileHandle:E,FileSystemHandle:T,FileSystemWritableFileStream:m,getOriginPrivateDirectory:R,showDirectoryPicker:j,showOpenFilePicker:L,showSaveFilePicker:W},Symbol.toStringTag,{value:"Module"}));export{K as a,q as c,O as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{X as it}from"./index-Cx-F6ZGn.js";function rt(z,u){for(var p=0;p<u.length;p++){const S=u[p];if(typeof S!="string"&&!Array.isArray(S)){for(const O in S)if(O!=="default"&&!(O in z)){const M=Object.getOwnPropertyDescriptor(S,O);M&&Object.defineProperty(z,O,M.get?M:{enumerable:!0,get:()=>S[O]})}}}return Object.freeze(Object.defineProperty(z,Symbol.toStringTag,{value:"Module"}))}var ke={exports:{}},Le;function at(){return Le||(Le=1,(function(z){(function(u){if(typeof window>"u")return;var p=!0,S=10,O="",M=0,j="",J=null,ie="",D=!1,Pe={resize:1,click:1},U=128,re=!0,R=1,X="bodyOffset",h=X,ae=!0,ce="",k={},I=32,ue=null,_=!1,V=!1,q="[iFrameSizer]",se=q.length,H="",le={max:1,min:1,bodyScroll:1,documentElementScroll:1},Y="child",fe=window.parent,L="*",K=0,W=!1,de=null,F=16,P=1,me="scroll",v=me,je=window,Q=function(){T("onMessage function not defined")},$=function(){},G=function(){},Z={height:function(){return T("Custom height calculation function not defined"),document.documentElement.offsetHeight},width:function(){return T("Custom width calculation function not defined"),document.body.scrollWidth}},ee={},ge=!1;function he(){}try{var pe=Object.create({},{passive:{get:function(){ge=!0}}});window.addEventListener("test",he,pe),window.removeEventListener("test",he,pe)}catch{}function C(e,t,n,o){e.addEventListener(t,n,ge?o||{}:!1)}function De(e,t,n){e.removeEventListener(t,n,!1)}function ve(e){return e.charAt(0).toUpperCase()+e.slice(1)}function qe(e){var t,n,o,a=null,l=0,m=function(){l=Date.now(),a=null,o=e.apply(t,n),a||(t=n=null)};return function(){var d=Date.now();l||(l=d);var c=F-(d-l);return t=this,n=arguments,c<=0||c>F?(a&&(clearTimeout(a),a=null),l=d,o=e.apply(t,n),a||(t=n=null)):a||(a=setTimeout(m,c)),o}}function ye(e){return q+"["+H+"] "+e}function i(e){_&&typeof window.console=="object"&&console.log(ye(e))}function T(e){typeof window.console=="object"&&console.warn(ye(e))}function He(){We(),i("Initialising iFrame ("+window.location.href+")"),Je(),Xe(),te("background",O),te("padding",ie),Ke(),Te(),Ee(),_e(),Ge(),$e(),Oe(),k=Qe(),A("init","Init message from host page"),$()}function We(){function e(n){return n==="true"}var t=ce.slice(se).split(":");H=t[0],M=u===t[1]?M:Number(t[1]),D=u===t[2]?D:e(t[2]),_=u===t[3]?_:e(t[3]),I=u===t[4]?I:Number(t[4]),p=u===t[6]?p:e(t[6]),j=t[7],h=u===t[8]?h:t[8],O=t[9],ie=t[10],K=u===t[11]?K:Number(t[11]),k.enable=u===t[12]?!1:e(t[12]),Y=u===t[13]?Y:t[13],v=u===t[14]?v:t[14],V=u===t[15]?V:e(t[15])}function Be(e){var t=e.split("Callback");if(t.length===2){var n="on"+t[0].charAt(0).toUpperCase()+t[0].slice(1);this[n]=this[e],delete this[e],T("Deprecated: '"+e+"' has been renamed '"+n+"'. The old method will be removed in the next major version.")}}function Je(){function e(){var n=window.iFrameResizer;i("Reading data from page: "+JSON.stringify(n)),Object.keys(n).forEach(Be,n),Q="onMessage"in n?n.onMessage:Q,$="onReady"in n?n.onReady:$,L="targetOrigin"in n?n.targetOrigin:L,h="heightCalculationMethod"in n?n.heightCalculationMethod:h,v="widthCalculationMethod"in n?n.widthCalculationMethod:v}function t(n,o){return typeof n=="function"&&(i("Setup custom "+o+"CalcMethod"),Z[o]=n,n="custom"),n}"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),h=t(h,"height"),v=t(v,"width")),i("TargetOrigin for parent set to: "+L)}function Ue(e,t){return t.indexOf("-")!==-1&&(T("Negative CSS value ignored for "+e),t=""),t}function te(e,t){u!==t&&t!==""&&t!=="null"&&(document.body.style[e]=t,i("Body "+e+' set to "'+t+'"'))}function Xe(){u===j&&(j=M+"px"),te("margin",Ue("margin",j))}function _e(){document.documentElement.style.height="",document.body.style.height="",i('HTML & body height set to "auto"')}function g(e){var t={add:function(n){function o(){A(e.eventName,e.eventType)}ee[n]=o,C(window,n,o,{passive:!0})},remove:function(n){var o=ee[n];delete ee[n],De(window,n,o)}};e.eventNames&&Array.prototype.map?(e.eventName=e.eventNames[0],e.eventNames.map(t[e.method])):t[e.method](e.eventName),i(ve(e.method)+" event listener: "+e.eventType)}function we(e){g({method:e,eventType:"Animation Start",eventNames:["animationstart","webkitAnimationStart"]}),g({method:e,eventType:"Animation Iteration",eventNames:["animationiteration","webkitAnimationIteration"]}),g({method:e,eventType:"Animation End",eventNames:["animationend","webkitAnimationEnd"]}),g({method:e,eventType:"Input",eventName:"input"}),g({method:e,eventType:"Mouse Up",eventName:"mouseup"}),g({method:e,eventType:"Mouse Down",eventName:"mousedown"}),g({method:e,eventType:"Orientation Change",eventName:"orientationchange"}),g({method:e,eventType:"Print",eventNames:["afterprint","beforeprint"]}),g({method:e,eventType:"Ready State Change",eventName:"readystatechange"}),g({method:e,eventType:"Touch Start",eventName:"touchstart"}),g({method:e,eventType:"Touch End",eventName:"touchend"}),g({method:e,eventType:"Touch Cancel",eventName:"touchcancel"}),g({method:e,eventType:"Transition Start",eventNames:["transitionstart","webkitTransitionStart","MSTransitionStart","oTransitionStart","otransitionstart"]}),g({method:e,eventType:"Transition Iteration",eventNames:["transitioniteration","webkitTransitionIteration","MSTransitionIteration","oTransitionIteration","otransitioniteration"]}),g({method:e,eventType:"Transition End",eventNames:["transitionend","webkitTransitionEnd","MSTransitionEnd","oTransitionEnd","otransitionend"]}),Y==="child"&&g({method:e,eventType:"IFrame Resized",eventName:"resize"})}function be(e,t,n,o){return t!==e&&(e in n||(T(e+" is not a valid option for "+o+"CalculationMethod."),e=t),i(o+' calculation method set to "'+e+'"')),e}function Te(){h=be(h,X,E,"height")}function Ee(){v=be(v,me,N,"width")}function Oe(){p===!0?(we("add"),et()):i("Auto Resize disabled")}function Ve(){J!==null&&J.disconnect()}function Ye(){we("remove"),Ve(),clearInterval(ue)}function Ke(){var e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.appendChild(e)}function Qe(){function e(){return{x:window.pageXOffset===u?document.documentElement.scrollLeft:window.pageXOffset,y:window.pageYOffset===u?document.documentElement.scrollTop:window.pageYOffset}}function t(c){var s=c.getBoundingClientRect(),f=e();return{x:parseInt(s.left,10)+parseInt(f.x,10),y:parseInt(s.top,10)+parseInt(f.y,10)}}function n(c){function s(b){var x=t(b);i("Moving to in page link (#"+f+") at x: "+x.x+" y: "+x.y),y(x.y,x.x,"scrollToOffset")}var f=c.split("#")[1]||c,r=decodeURIComponent(f),w=document.getElementById(r)||document.getElementsByName(r)[0];u===w?(i("In page link (#"+f+") not found in iFrame, so sending to parent"),y(0,0,"inPageLink","#"+f)):s(w)}function o(){var c=window.location.hash,s=window.location.href;c!==""&&c!=="#"&&n(s)}function a(){function c(s){function f(r){r.preventDefault(),n(this.getAttribute("href"))}s.getAttribute("href")!=="#"&&C(s,"click",f)}Array.prototype.forEach.call(document.querySelectorAll('a[href^="#"]'),c)}function l(){C(window,"hashchange",o)}function m(){setTimeout(o,U)}function d(){Array.prototype.forEach&&document.querySelectorAll?(i("Setting up location.hash handlers"),a(),l(),m()):T("In page linking not fully supported in this browser! (See README.md for IE8 workaround)")}return k.enable?d():i("In page linking not enabled"),{findTarget:n}}function $e(){if(V!==!0)return;function e(n){y(0,0,n.type,n.screenY+":"+n.screenX)}function t(n,o){i("Add event listener: "+o),C(window.document,n,e)}t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave")}function Ge(){i("Enable public methods"),je.parentIFrame={autoResize:function(e){return e===!0&&p===!1?(p=!0,Oe()):e===!1&&p===!0&&(p=!1,Ye()),y(0,0,"autoResize",JSON.stringify(p)),p},close:function(){y(0,0,"close")},getId:function(){return H},getPageInfo:function(e){typeof e=="function"?(G=e,y(0,0,"pageInfo")):(G=function(){},y(0,0,"pageInfoStop"))},moveToAnchor:function(e){k.findTarget(e)},reset:function(){xe("parentIFrame.reset")},scrollTo:function(e,t){y(t,e,"scrollTo")},scrollToOffset:function(e,t){y(t,e,"scrollToOffset")},sendMessage:function(e,t){y(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod:function(e){h=e,Te()},setWidthCalculationMethod:function(e){v=e,Ee()},setTargetOrigin:function(e){i("Set targetOrigin: "+e),L=e},size:function(e,t){var n=""+(e||"")+(t?","+t:"");A("size","parentIFrame.size("+n+")",e,t)}}}function Se(){I!==0&&(i("setInterval: "+I+"ms"),ue=setInterval(function(){A("interval","setInterval: "+I)},Math.abs(I)))}function Ze(){function e(r){function w(b){b.complete===!1&&(i("Attach listeners to "+b.src),b.addEventListener("load",a,!1),b.addEventListener("error",l,!1),c.push(b))}r.type==="attributes"&&r.attributeName==="src"?w(r.target):r.type==="childList"&&Array.prototype.forEach.call(r.target.querySelectorAll("img"),w)}function t(r){c.splice(c.indexOf(r),1)}function n(r){i("Remove listeners from "+r.src),r.removeEventListener("load",a,!1),r.removeEventListener("error",l,!1),t(r)}function o(r,w,b){n(r.target),A(w,b+": "+r.target.src)}function a(r){o(r,"imageLoad","Image loaded")}function l(r){o(r,"imageLoadFailed","Image load failed")}function m(r){A("mutationObserver","mutationObserver: "+r[0].target+" "+r[0].type),r.forEach(e)}function d(){var r=document.querySelector("body"),w={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0};return f=new s(m),i("Create body MutationObserver"),f.observe(r,w),f}var c=[],s=window.MutationObserver||window.WebKitMutationObserver,f=d();return{disconnect:function(){"disconnect"in f&&(i("Disconnect body MutationObserver"),f.disconnect(),c.forEach(n))}}}function et(){var e=0>I;window.MutationObserver||window.WebKitMutationObserver?e?Se():J=Ze():(i("MutationObserver not supported in this browser!"),Se())}function ne(e,t){var n=0;return t=t||document.body,n=document.defaultView.getComputedStyle(t,null),n=n===null?0:n[e],parseInt(n,S)}function tt(e){e>F/2&&(F=2*e,i("Event throttle increased to "+F+"ms"))}function oe(e,t){for(var n=t.length,o=0,a=0,l=ve(e),m=Date.now(),d=0;d<n;d++)o=t[d].getBoundingClientRect()[e]+ne("margin"+l,t[d]),o>a&&(a=o);return m=Date.now()-m,i("Parsed "+n+" HTML elements"),i("Element position calculated in "+m+"ms"),tt(m),a}function B(e){return[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll()]}function Me(e,t){function n(){return T("No tagged elements ("+t+") found on page"),document.querySelectorAll("body *")}var o=document.querySelectorAll("["+t+"]");return o.length===0&&n(),oe(e,o)}function Ie(){return document.querySelectorAll("body *")}var E={bodyOffset:function(){return document.body.offsetHeight+ne("marginTop")+ne("marginBottom")},offset:function(){return E.bodyOffset()},bodyScroll:function(){return document.body.scrollHeight},custom:function(){return Z.height()},documentElementOffset:function(){return document.documentElement.offsetHeight},documentElementScroll:function(){return document.documentElement.scrollHeight},max:function(){return Math.max.apply(null,B(E))},min:function(){return Math.min.apply(null,B(E))},grow:function(){return E.max()},lowestElement:function(){return Math.max(E.bodyOffset()||E.documentElementOffset(),oe("bottom",Ie()))},taggedElement:function(){return Me("bottom","data-iframe-height")}},N={bodyScroll:function(){return document.body.scrollWidth},bodyOffset:function(){return document.body.offsetWidth},custom:function(){return Z.width()},documentElementScroll:function(){return document.documentElement.scrollWidth},documentElementOffset:function(){return document.documentElement.offsetWidth},scroll:function(){return Math.max(N.bodyScroll(),N.documentElementScroll())},max:function(){return Math.max.apply(null,B(N))},min:function(){return Math.min.apply(null,B(N))},rightMostElement:function(){return oe("right",Ie())},taggedElement:function(){return Me("right","data-iframe-width")}};function Ne(e,t,n,o){function a(){R=f,P=r,y(R,P,e)}function l(){function w(b,x){var ot=Math.abs(b-x)<=K;return!ot}return f=u===n?E[h]():n,r=u===o?N[v]():o,w(R,f)||D&&w(P,r)}function m(){return!(e in{init:1,interval:1,size:1})}function d(){return h in le||D&&v in le}function c(){i("No change in size detected")}function s(){m()&&d()?xe(t):e in{interval:1}||c()}var f,r;l()||e==="init"?(Ae(),a()):s()}var nt=qe(Ne);function A(e,t,n,o){function a(){e in{reset:1,resetPage:1,init:1}||i("Trigger event: "+t)}function l(){return W&&e in Pe}l()?i("Trigger event cancelled: "+e):(a(),e==="init"?Ne(e,t,n,o):nt(e,t,n,o))}function Ae(){W||(W=!0,i("Trigger event lock on")),clearTimeout(de),de=setTimeout(function(){W=!1,i("Trigger event lock off"),i("--")},U)}function Ce(e){R=E[h](),P=N[v](),y(R,P,e)}function xe(e){var t=h;h=X,i("Reset trigger event: "+e),Ae(),Ce("reset"),h=t}function y(e,t,n,o,a){function l(){u===a?a=L:i("Message targetOrigin: "+a)}function m(){var d=e+":"+t,c=H+":"+d+":"+n+(u===o?"":":"+o);i("Sending message to host page ("+c+")"),fe.postMessage(q+c,a)}l(),m()}function ze(e){var t={init:function(){ce=e.data,fe=e.source,He(),re=!1,setTimeout(function(){ae=!1},U)},reset:function(){ae?i("Page reset ignored by init"):(i("Page size reset by host page"),Ce("resetPage"))},resize:function(){A("resizeParent","Parent window requested size check")},moveToAnchor:function(){k.findTarget(a())},inPageLink:function(){this.moveToAnchor()},pageInfo:function(){var s=a();i("PageInfoFromParent called from parent: "+s),G(JSON.parse(s)),i(" --")},message:function(){var s=a();i("onMessage called from parent: "+s),Q(JSON.parse(s)),i(" --")}};function n(){return q===(""+e.data).slice(0,se)}function o(){return e.data.split("]")[1].split(":")[0]}function a(){return e.data.slice(e.data.indexOf(":")+1)}function l(){return!z.exports&&"iFrameResize"in window||window.jQuery!==u&&"iFrameResize"in window.jQuery.prototype}function m(){return e.data.split(":")[2]in{true:1,false:1}}function d(){var s=o();s in t?t[s]():!l()&&!m()&&T("Unexpected message ("+e.data+")")}function c(){re===!1?d():m()?t.init():i('Ignored message of type "'+o()+'". Received before initialization.')}n()&&c()}function Re(){document.readyState!=="loading"&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeResizer"in window||(window.iframeChildListener=function(e){ze({data:e})},C(window,"message",ze),C(window,"readystatechange",Re),Re())})()})(ke)),ke.exports}var Fe=at();const ct=it(Fe),st=rt({__proto__:null,default:ct},[Fe]);export{st as i};
|
|
1
|
+
import{X as it}from"./index-BvblFOYP.js";function rt(z,u){for(var p=0;p<u.length;p++){const S=u[p];if(typeof S!="string"&&!Array.isArray(S)){for(const O in S)if(O!=="default"&&!(O in z)){const M=Object.getOwnPropertyDescriptor(S,O);M&&Object.defineProperty(z,O,M.get?M:{enumerable:!0,get:()=>S[O]})}}}return Object.freeze(Object.defineProperty(z,Symbol.toStringTag,{value:"Module"}))}var ke={exports:{}},Le;function at(){return Le||(Le=1,(function(z){(function(u){if(typeof window>"u")return;var p=!0,S=10,O="",M=0,j="",J=null,ie="",D=!1,Pe={resize:1,click:1},U=128,re=!0,R=1,X="bodyOffset",h=X,ae=!0,ce="",k={},I=32,ue=null,_=!1,V=!1,q="[iFrameSizer]",se=q.length,H="",le={max:1,min:1,bodyScroll:1,documentElementScroll:1},Y="child",fe=window.parent,L="*",K=0,W=!1,de=null,F=16,P=1,me="scroll",v=me,je=window,Q=function(){T("onMessage function not defined")},$=function(){},G=function(){},Z={height:function(){return T("Custom height calculation function not defined"),document.documentElement.offsetHeight},width:function(){return T("Custom width calculation function not defined"),document.body.scrollWidth}},ee={},ge=!1;function he(){}try{var pe=Object.create({},{passive:{get:function(){ge=!0}}});window.addEventListener("test",he,pe),window.removeEventListener("test",he,pe)}catch{}function C(e,t,n,o){e.addEventListener(t,n,ge?o||{}:!1)}function De(e,t,n){e.removeEventListener(t,n,!1)}function ve(e){return e.charAt(0).toUpperCase()+e.slice(1)}function qe(e){var t,n,o,a=null,l=0,m=function(){l=Date.now(),a=null,o=e.apply(t,n),a||(t=n=null)};return function(){var d=Date.now();l||(l=d);var c=F-(d-l);return t=this,n=arguments,c<=0||c>F?(a&&(clearTimeout(a),a=null),l=d,o=e.apply(t,n),a||(t=n=null)):a||(a=setTimeout(m,c)),o}}function ye(e){return q+"["+H+"] "+e}function i(e){_&&typeof window.console=="object"&&console.log(ye(e))}function T(e){typeof window.console=="object"&&console.warn(ye(e))}function He(){We(),i("Initialising iFrame ("+window.location.href+")"),Je(),Xe(),te("background",O),te("padding",ie),Ke(),Te(),Ee(),_e(),Ge(),$e(),Oe(),k=Qe(),A("init","Init message from host page"),$()}function We(){function e(n){return n==="true"}var t=ce.slice(se).split(":");H=t[0],M=u===t[1]?M:Number(t[1]),D=u===t[2]?D:e(t[2]),_=u===t[3]?_:e(t[3]),I=u===t[4]?I:Number(t[4]),p=u===t[6]?p:e(t[6]),j=t[7],h=u===t[8]?h:t[8],O=t[9],ie=t[10],K=u===t[11]?K:Number(t[11]),k.enable=u===t[12]?!1:e(t[12]),Y=u===t[13]?Y:t[13],v=u===t[14]?v:t[14],V=u===t[15]?V:e(t[15])}function Be(e){var t=e.split("Callback");if(t.length===2){var n="on"+t[0].charAt(0).toUpperCase()+t[0].slice(1);this[n]=this[e],delete this[e],T("Deprecated: '"+e+"' has been renamed '"+n+"'. The old method will be removed in the next major version.")}}function Je(){function e(){var n=window.iFrameResizer;i("Reading data from page: "+JSON.stringify(n)),Object.keys(n).forEach(Be,n),Q="onMessage"in n?n.onMessage:Q,$="onReady"in n?n.onReady:$,L="targetOrigin"in n?n.targetOrigin:L,h="heightCalculationMethod"in n?n.heightCalculationMethod:h,v="widthCalculationMethod"in n?n.widthCalculationMethod:v}function t(n,o){return typeof n=="function"&&(i("Setup custom "+o+"CalcMethod"),Z[o]=n,n="custom"),n}"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),h=t(h,"height"),v=t(v,"width")),i("TargetOrigin for parent set to: "+L)}function Ue(e,t){return t.indexOf("-")!==-1&&(T("Negative CSS value ignored for "+e),t=""),t}function te(e,t){u!==t&&t!==""&&t!=="null"&&(document.body.style[e]=t,i("Body "+e+' set to "'+t+'"'))}function Xe(){u===j&&(j=M+"px"),te("margin",Ue("margin",j))}function _e(){document.documentElement.style.height="",document.body.style.height="",i('HTML & body height set to "auto"')}function g(e){var t={add:function(n){function o(){A(e.eventName,e.eventType)}ee[n]=o,C(window,n,o,{passive:!0})},remove:function(n){var o=ee[n];delete ee[n],De(window,n,o)}};e.eventNames&&Array.prototype.map?(e.eventName=e.eventNames[0],e.eventNames.map(t[e.method])):t[e.method](e.eventName),i(ve(e.method)+" event listener: "+e.eventType)}function we(e){g({method:e,eventType:"Animation Start",eventNames:["animationstart","webkitAnimationStart"]}),g({method:e,eventType:"Animation Iteration",eventNames:["animationiteration","webkitAnimationIteration"]}),g({method:e,eventType:"Animation End",eventNames:["animationend","webkitAnimationEnd"]}),g({method:e,eventType:"Input",eventName:"input"}),g({method:e,eventType:"Mouse Up",eventName:"mouseup"}),g({method:e,eventType:"Mouse Down",eventName:"mousedown"}),g({method:e,eventType:"Orientation Change",eventName:"orientationchange"}),g({method:e,eventType:"Print",eventNames:["afterprint","beforeprint"]}),g({method:e,eventType:"Ready State Change",eventName:"readystatechange"}),g({method:e,eventType:"Touch Start",eventName:"touchstart"}),g({method:e,eventType:"Touch End",eventName:"touchend"}),g({method:e,eventType:"Touch Cancel",eventName:"touchcancel"}),g({method:e,eventType:"Transition Start",eventNames:["transitionstart","webkitTransitionStart","MSTransitionStart","oTransitionStart","otransitionstart"]}),g({method:e,eventType:"Transition Iteration",eventNames:["transitioniteration","webkitTransitionIteration","MSTransitionIteration","oTransitionIteration","otransitioniteration"]}),g({method:e,eventType:"Transition End",eventNames:["transitionend","webkitTransitionEnd","MSTransitionEnd","oTransitionEnd","otransitionend"]}),Y==="child"&&g({method:e,eventType:"IFrame Resized",eventName:"resize"})}function be(e,t,n,o){return t!==e&&(e in n||(T(e+" is not a valid option for "+o+"CalculationMethod."),e=t),i(o+' calculation method set to "'+e+'"')),e}function Te(){h=be(h,X,E,"height")}function Ee(){v=be(v,me,N,"width")}function Oe(){p===!0?(we("add"),et()):i("Auto Resize disabled")}function Ve(){J!==null&&J.disconnect()}function Ye(){we("remove"),Ve(),clearInterval(ue)}function Ke(){var e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.appendChild(e)}function Qe(){function e(){return{x:window.pageXOffset===u?document.documentElement.scrollLeft:window.pageXOffset,y:window.pageYOffset===u?document.documentElement.scrollTop:window.pageYOffset}}function t(c){var s=c.getBoundingClientRect(),f=e();return{x:parseInt(s.left,10)+parseInt(f.x,10),y:parseInt(s.top,10)+parseInt(f.y,10)}}function n(c){function s(b){var x=t(b);i("Moving to in page link (#"+f+") at x: "+x.x+" y: "+x.y),y(x.y,x.x,"scrollToOffset")}var f=c.split("#")[1]||c,r=decodeURIComponent(f),w=document.getElementById(r)||document.getElementsByName(r)[0];u===w?(i("In page link (#"+f+") not found in iFrame, so sending to parent"),y(0,0,"inPageLink","#"+f)):s(w)}function o(){var c=window.location.hash,s=window.location.href;c!==""&&c!=="#"&&n(s)}function a(){function c(s){function f(r){r.preventDefault(),n(this.getAttribute("href"))}s.getAttribute("href")!=="#"&&C(s,"click",f)}Array.prototype.forEach.call(document.querySelectorAll('a[href^="#"]'),c)}function l(){C(window,"hashchange",o)}function m(){setTimeout(o,U)}function d(){Array.prototype.forEach&&document.querySelectorAll?(i("Setting up location.hash handlers"),a(),l(),m()):T("In page linking not fully supported in this browser! (See README.md for IE8 workaround)")}return k.enable?d():i("In page linking not enabled"),{findTarget:n}}function $e(){if(V!==!0)return;function e(n){y(0,0,n.type,n.screenY+":"+n.screenX)}function t(n,o){i("Add event listener: "+o),C(window.document,n,e)}t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave")}function Ge(){i("Enable public methods"),je.parentIFrame={autoResize:function(e){return e===!0&&p===!1?(p=!0,Oe()):e===!1&&p===!0&&(p=!1,Ye()),y(0,0,"autoResize",JSON.stringify(p)),p},close:function(){y(0,0,"close")},getId:function(){return H},getPageInfo:function(e){typeof e=="function"?(G=e,y(0,0,"pageInfo")):(G=function(){},y(0,0,"pageInfoStop"))},moveToAnchor:function(e){k.findTarget(e)},reset:function(){xe("parentIFrame.reset")},scrollTo:function(e,t){y(t,e,"scrollTo")},scrollToOffset:function(e,t){y(t,e,"scrollToOffset")},sendMessage:function(e,t){y(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod:function(e){h=e,Te()},setWidthCalculationMethod:function(e){v=e,Ee()},setTargetOrigin:function(e){i("Set targetOrigin: "+e),L=e},size:function(e,t){var n=""+(e||"")+(t?","+t:"");A("size","parentIFrame.size("+n+")",e,t)}}}function Se(){I!==0&&(i("setInterval: "+I+"ms"),ue=setInterval(function(){A("interval","setInterval: "+I)},Math.abs(I)))}function Ze(){function e(r){function w(b){b.complete===!1&&(i("Attach listeners to "+b.src),b.addEventListener("load",a,!1),b.addEventListener("error",l,!1),c.push(b))}r.type==="attributes"&&r.attributeName==="src"?w(r.target):r.type==="childList"&&Array.prototype.forEach.call(r.target.querySelectorAll("img"),w)}function t(r){c.splice(c.indexOf(r),1)}function n(r){i("Remove listeners from "+r.src),r.removeEventListener("load",a,!1),r.removeEventListener("error",l,!1),t(r)}function o(r,w,b){n(r.target),A(w,b+": "+r.target.src)}function a(r){o(r,"imageLoad","Image loaded")}function l(r){o(r,"imageLoadFailed","Image load failed")}function m(r){A("mutationObserver","mutationObserver: "+r[0].target+" "+r[0].type),r.forEach(e)}function d(){var r=document.querySelector("body"),w={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0};return f=new s(m),i("Create body MutationObserver"),f.observe(r,w),f}var c=[],s=window.MutationObserver||window.WebKitMutationObserver,f=d();return{disconnect:function(){"disconnect"in f&&(i("Disconnect body MutationObserver"),f.disconnect(),c.forEach(n))}}}function et(){var e=0>I;window.MutationObserver||window.WebKitMutationObserver?e?Se():J=Ze():(i("MutationObserver not supported in this browser!"),Se())}function ne(e,t){var n=0;return t=t||document.body,n=document.defaultView.getComputedStyle(t,null),n=n===null?0:n[e],parseInt(n,S)}function tt(e){e>F/2&&(F=2*e,i("Event throttle increased to "+F+"ms"))}function oe(e,t){for(var n=t.length,o=0,a=0,l=ve(e),m=Date.now(),d=0;d<n;d++)o=t[d].getBoundingClientRect()[e]+ne("margin"+l,t[d]),o>a&&(a=o);return m=Date.now()-m,i("Parsed "+n+" HTML elements"),i("Element position calculated in "+m+"ms"),tt(m),a}function B(e){return[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll()]}function Me(e,t){function n(){return T("No tagged elements ("+t+") found on page"),document.querySelectorAll("body *")}var o=document.querySelectorAll("["+t+"]");return o.length===0&&n(),oe(e,o)}function Ie(){return document.querySelectorAll("body *")}var E={bodyOffset:function(){return document.body.offsetHeight+ne("marginTop")+ne("marginBottom")},offset:function(){return E.bodyOffset()},bodyScroll:function(){return document.body.scrollHeight},custom:function(){return Z.height()},documentElementOffset:function(){return document.documentElement.offsetHeight},documentElementScroll:function(){return document.documentElement.scrollHeight},max:function(){return Math.max.apply(null,B(E))},min:function(){return Math.min.apply(null,B(E))},grow:function(){return E.max()},lowestElement:function(){return Math.max(E.bodyOffset()||E.documentElementOffset(),oe("bottom",Ie()))},taggedElement:function(){return Me("bottom","data-iframe-height")}},N={bodyScroll:function(){return document.body.scrollWidth},bodyOffset:function(){return document.body.offsetWidth},custom:function(){return Z.width()},documentElementScroll:function(){return document.documentElement.scrollWidth},documentElementOffset:function(){return document.documentElement.offsetWidth},scroll:function(){return Math.max(N.bodyScroll(),N.documentElementScroll())},max:function(){return Math.max.apply(null,B(N))},min:function(){return Math.min.apply(null,B(N))},rightMostElement:function(){return oe("right",Ie())},taggedElement:function(){return Me("right","data-iframe-width")}};function Ne(e,t,n,o){function a(){R=f,P=r,y(R,P,e)}function l(){function w(b,x){var ot=Math.abs(b-x)<=K;return!ot}return f=u===n?E[h]():n,r=u===o?N[v]():o,w(R,f)||D&&w(P,r)}function m(){return!(e in{init:1,interval:1,size:1})}function d(){return h in le||D&&v in le}function c(){i("No change in size detected")}function s(){m()&&d()?xe(t):e in{interval:1}||c()}var f,r;l()||e==="init"?(Ae(),a()):s()}var nt=qe(Ne);function A(e,t,n,o){function a(){e in{reset:1,resetPage:1,init:1}||i("Trigger event: "+t)}function l(){return W&&e in Pe}l()?i("Trigger event cancelled: "+e):(a(),e==="init"?Ne(e,t,n,o):nt(e,t,n,o))}function Ae(){W||(W=!0,i("Trigger event lock on")),clearTimeout(de),de=setTimeout(function(){W=!1,i("Trigger event lock off"),i("--")},U)}function Ce(e){R=E[h](),P=N[v](),y(R,P,e)}function xe(e){var t=h;h=X,i("Reset trigger event: "+e),Ae(),Ce("reset"),h=t}function y(e,t,n,o,a){function l(){u===a?a=L:i("Message targetOrigin: "+a)}function m(){var d=e+":"+t,c=H+":"+d+":"+n+(u===o?"":":"+o);i("Sending message to host page ("+c+")"),fe.postMessage(q+c,a)}l(),m()}function ze(e){var t={init:function(){ce=e.data,fe=e.source,He(),re=!1,setTimeout(function(){ae=!1},U)},reset:function(){ae?i("Page reset ignored by init"):(i("Page size reset by host page"),Ce("resetPage"))},resize:function(){A("resizeParent","Parent window requested size check")},moveToAnchor:function(){k.findTarget(a())},inPageLink:function(){this.moveToAnchor()},pageInfo:function(){var s=a();i("PageInfoFromParent called from parent: "+s),G(JSON.parse(s)),i(" --")},message:function(){var s=a();i("onMessage called from parent: "+s),Q(JSON.parse(s)),i(" --")}};function n(){return q===(""+e.data).slice(0,se)}function o(){return e.data.split("]")[1].split(":")[0]}function a(){return e.data.slice(e.data.indexOf(":")+1)}function l(){return!z.exports&&"iFrameResize"in window||window.jQuery!==u&&"iFrameResize"in window.jQuery.prototype}function m(){return e.data.split(":")[2]in{true:1,false:1}}function d(){var s=o();s in t?t[s]():!l()&&!m()&&T("Unexpected message ("+e.data+")")}function c(){re===!1?d():m()?t.init():i('Ignored message of type "'+o()+'". Received before initialization.')}n()&&c()}function Re(){document.readyState!=="loading"&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeResizer"in window||(window.iframeChildListener=function(e){ze({data:e})},C(window,"message",ze),C(window,"readystatechange",Re),Re())})()})(ke)),ke.exports}var Fe=at();const ct=it(Fe),st=rt({__proto__:null,default:ct},[Fe]);export{st as i};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as O,j as T,aI as On,m as jn,c as ze,aH as Mn,aW as Rn,aJ as Fn,ap as An,bd as Bn,aC as u,X as yt,be as g,bf as Tn,bg as Pn,bh as Hn,bi as Kr,bj as zn,bk as Ln,bl as Dn,bm as Nn,bn as Gn,bo as Un}from"./index-Cx-F6ZGn.js";import{B as Wn}from"./useBasicWidgetState-CcvdwkOI-DOgmtoFM.js";import"./FormClearHelper-Bzgvbizg-C4nYH9Ah.js";var j={},re={},nt,Kt;function $n(){if(Kt)return nt;Kt=1;var e=Hn(),t=Kr(),r=zn(),n="[object String]";function a(o){return typeof o=="string"||!t(o)&&r(o)&&e(o)==n}return nt=a,nt}var at,Zt;function Xn(){if(Zt)return at;Zt=1;var e=Un();function t(r){return typeof r=="function"?r:e}return at=t,at}var ot,Qt;function wt(){if(Qt)return ot;Qt=1;var e=Ln(),t=Xn();function r(n,a){return n&&e(n,t(a))}return ot=r,ot}var it,Jt;function Vn(){if(Jt)return it;Jt=1;var e=Dn(),t=Nn(),r=Gn(),n=Kr();function a(o,i){var l=n(o)?e:r;return l(o,t(i,3))}return it=a,it}var er;function In(){if(er)return re;er=1,Object.defineProperty(re,"__esModule",{value:!0}),re.flattenNames=void 0;var e=$n(),t=s(e),r=wt(),n=s(r),a=Tn(),o=s(a),i=Vn(),l=s(i);function s(p){return p&&p.__esModule?p:{default:p}}var c=re.flattenNames=function p(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],h=[];return(0,l.default)(f,function(b){Array.isArray(b)?p(b).map(function(d){return h.push(d)}):(0,o.default)(b)?(0,n.default)(b,function(d,x){d===!0&&h.push(x),h.push(x+"-"+d)}):(0,t.default)(b)&&h.push(b)}),h};return re.default=c,re}var ne={},tr;function qn(){if(tr)return ne;tr=1,Object.defineProperty(ne,"__esModule",{value:!0}),ne.mergeClasses=void 0;var e=wt(),t=o(e),r=Pn(),n=o(r),a=Object.assign||function(l){for(var s=1;s<arguments.length;s++){var c=arguments[s];for(var p in c)Object.prototype.hasOwnProperty.call(c,p)&&(l[p]=c[p])}return l};function o(l){return l&&l.__esModule?l:{default:l}}var i=ne.mergeClasses=function(l){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],c=l.default&&(0,n.default)(l.default)||{};return s.map(function(p){var f=l[p];return f&&(0,t.default)(f,function(h,b){c[b]||(c[b]={}),c[b]=a({},c[b],f[b])}),p}),c};return ne.default=i,ne}var ae={},rr;function Yn(){if(rr)return ae;rr=1,Object.defineProperty(ae,"__esModule",{value:!0}),ae.autoprefix=void 0;var e=wt(),t=n(e),r=Object.assign||function(i){for(var l=1;l<arguments.length;l++){var s=arguments[l];for(var c in s)Object.prototype.hasOwnProperty.call(s,c)&&(i[c]=s[c])}return i};function n(i){return i&&i.__esModule?i:{default:i}}var a={borderRadius:function(i){return{msBorderRadius:i,MozBorderRadius:i,OBorderRadius:i,WebkitBorderRadius:i,borderRadius:i}},boxShadow:function(i){return{msBoxShadow:i,MozBoxShadow:i,OBoxShadow:i,WebkitBoxShadow:i,boxShadow:i}},userSelect:function(i){return{WebkitTouchCallout:i,KhtmlUserSelect:i,MozUserSelect:i,msUserSelect:i,WebkitUserSelect:i,userSelect:i}},flex:function(i){return{WebkitBoxFlex:i,MozBoxFlex:i,WebkitFlex:i,msFlex:i,flex:i}},flexBasis:function(i){return{WebkitFlexBasis:i,flexBasis:i}},justifyContent:function(i){return{WebkitJustifyContent:i,justifyContent:i}},transition:function(i){return{msTransition:i,MozTransition:i,OTransition:i,WebkitTransition:i,transition:i}},transform:function(i){return{msTransform:i,MozTransform:i,OTransform:i,WebkitTransform:i,transform:i}},absolute:function(i){var l=i&&i.split(" ");return{position:"absolute",top:l&&l[0],right:l&&l[1],bottom:l&&l[2],left:l&&l[3]}},extend:function(i,l){var s=l[i];return s||{extend:i}}},o=ae.autoprefix=function(i){var l={};return(0,t.default)(i,function(s,c){var p={};(0,t.default)(s,function(f,h){var b=a[h];b?p=r({},p,b(f)):p[h]=f}),l[c]=p}),l};return ae.default=o,ae}var oe={},nr;function Kn(){if(nr)return oe;nr=1,Object.defineProperty(oe,"__esModule",{value:!0}),oe.hover=void 0;var e=Object.assign||function(s){for(var c=1;c<arguments.length;c++){var p=arguments[c];for(var f in p)Object.prototype.hasOwnProperty.call(p,f)&&(s[f]=p[f])}return s},t=u,r=n(t);function n(s){return s&&s.__esModule?s:{default:s}}function a(s,c){if(!(s instanceof c))throw new TypeError("Cannot call a class as a function")}function o(s,c){if(!s)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c&&(typeof c=="object"||typeof c=="function")?c:s}function i(s,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof c);s.prototype=Object.create(c&&c.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),c&&(Object.setPrototypeOf?Object.setPrototypeOf(s,c):s.__proto__=c)}var l=oe.hover=function(s){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"span";return(function(p){i(f,p);function f(){var h,b,d,x;a(this,f);for(var S=arguments.length,E=Array(S),w=0;w<S;w++)E[w]=arguments[w];return x=(b=(d=o(this,(h=f.__proto__||Object.getPrototypeOf(f)).call.apply(h,[this].concat(E))),d),d.state={hover:!1},d.handleMouseOver=function(){return d.setState({hover:!0})},d.handleMouseOut=function(){return d.setState({hover:!1})},d.render=function(){return r.default.createElement(c,{onMouseOver:d.handleMouseOver,onMouseOut:d.handleMouseOut},r.default.createElement(s,e({},d.props,d.state)))},b),o(d,x)}return f})(r.default.Component)};return oe.default=l,oe}var ie={},ar;function Zn(){if(ar)return ie;ar=1,Object.defineProperty(ie,"__esModule",{value:!0}),ie.active=void 0;var e=Object.assign||function(s){for(var c=1;c<arguments.length;c++){var p=arguments[c];for(var f in p)Object.prototype.hasOwnProperty.call(p,f)&&(s[f]=p[f])}return s},t=u,r=n(t);function n(s){return s&&s.__esModule?s:{default:s}}function a(s,c){if(!(s instanceof c))throw new TypeError("Cannot call a class as a function")}function o(s,c){if(!s)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c&&(typeof c=="object"||typeof c=="function")?c:s}function i(s,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof c);s.prototype=Object.create(c&&c.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),c&&(Object.setPrototypeOf?Object.setPrototypeOf(s,c):s.__proto__=c)}var l=ie.active=function(s){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"span";return(function(p){i(f,p);function f(){var h,b,d,x;a(this,f);for(var S=arguments.length,E=Array(S),w=0;w<S;w++)E[w]=arguments[w];return x=(b=(d=o(this,(h=f.__proto__||Object.getPrototypeOf(f)).call.apply(h,[this].concat(E))),d),d.state={active:!1},d.handleMouseDown=function(){return d.setState({active:!0})},d.handleMouseUp=function(){return d.setState({active:!1})},d.render=function(){return r.default.createElement(c,{onMouseDown:d.handleMouseDown,onMouseUp:d.handleMouseUp},r.default.createElement(s,e({},d.props,d.state)))},b),o(d,x)}return f})(r.default.Component)};return ie.default=l,ie}var Ge={},or;function Qn(){if(or)return Ge;or=1,Object.defineProperty(Ge,"__esModule",{value:!0});var e=function(t,r){var n={},a=function(o){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;n[o]=i};return t===0&&a("first-child"),t===r-1&&a("last-child"),(t===0||t%2===0)&&a("even"),Math.abs(t%2)===1&&a("odd"),a("nth-child",t),n};return Ge.default=e,Ge}var ir;function Jn(){if(ir)return j;ir=1,Object.defineProperty(j,"__esModule",{value:!0}),j.ReactCSS=j.loop=j.handleActive=j.handleHover=j.hover=void 0;var e=In(),t=h(e),r=qn(),n=h(r),a=Yn(),o=h(a),i=Kn(),l=h(i),s=Zn(),c=h(s),p=Qn(),f=h(p);function h(d){return d&&d.__esModule?d:{default:d}}j.hover=l.default,j.handleHover=l.default,j.handleActive=c.default,j.loop=f.default;var b=j.ReactCSS=function(d){for(var x=arguments.length,S=Array(x>1?x-1:0),E=1;E<x;E++)S[E-1]=arguments[E];var w=(0,t.default)(S),ee=(0,n.default)(d,w);return(0,o.default)(ee)};return j.default=b,j}var Et=Jn();const m=yt(Et);var ea=function(e,t,r,n,a){var o=a.clientWidth,i=a.clientHeight,l=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,s=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,c=l-(a.getBoundingClientRect().left+window.pageXOffset),p=s-(a.getBoundingClientRect().top+window.pageYOffset);if(r==="vertical"){var f=void 0;if(p<0?f=0:p>i?f=1:f=Math.round(p*100/i)/100,t.a!==f)return{h:t.h,s:t.s,l:t.l,a:f,source:"rgb"}}else{var h=void 0;if(c<0?h=0:c>o?h=1:h=Math.round(c*100/o)/100,n!==h)return{h:t.h,s:t.s,l:t.l,a:h,source:"rgb"}}return null},lt={},ta=function(e,t,r,n){if(typeof document>"u"&&!n)return null;var a=n?new n:document.createElement("canvas");a.width=r*2,a.height=r*2;var o=a.getContext("2d");return o?(o.fillStyle=e,o.fillRect(0,0,a.width,a.height),o.fillStyle=t,o.fillRect(0,0,r,r),o.translate(r,r),o.fillRect(0,0,r,r),a.toDataURL()):null},ra=function(e,t,r,n){var a=e+"-"+t+"-"+r+(n?"-server":"");if(lt[a])return lt[a];var o=ta(e,t,r,n);return lt[a]=o,o},lr=Object.assign||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},Ce=function(e){var t=e.white,r=e.grey,n=e.size,a=e.renderers,o=e.borderRadius,i=e.boxShadow,l=e.children,s=m({default:{grid:{borderRadius:o,boxShadow:i,absolute:"0px 0px 0px 0px",background:"url("+ra(t,r,n,a.canvas)+") center left"}}});return O.isValidElement(l)?u.cloneElement(l,lr({},l.props,{style:lr({},l.props.style,s.grid)})):u.createElement("div",{style:s.grid})};Ce.defaultProps={size:8,white:"transparent",grey:"rgba(0,0,0,.08)",renderers:{}};var na=Object.assign||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},aa=(function(){function e(t,r){for(var n=0;n<r.length;n++){var a=r[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}})();function oa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sr(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function ia(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var _t=(function(e){ia(t,e);function t(){var r,n,a,o;oa(this,t);for(var i=arguments.length,l=Array(i),s=0;s<i;s++)l[s]=arguments[s];return o=(n=(a=sr(this,(r=t.__proto__||Object.getPrototypeOf(t)).call.apply(r,[this].concat(l))),a),a.handleChange=function(c){var p=ea(c,a.props.hsl,a.props.direction,a.props.a,a.container);p&&typeof a.props.onChange=="function"&&a.props.onChange(p,c)},a.handleMouseDown=function(c){a.handleChange(c),window.addEventListener("mousemove",a.handleChange),window.addEventListener("mouseup",a.handleMouseUp)},a.handleMouseUp=function(){a.unbindEventListeners()},a.unbindEventListeners=function(){window.removeEventListener("mousemove",a.handleChange),window.removeEventListener("mouseup",a.handleMouseUp)},n),sr(a,o)}return aa(t,[{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"render",value:function(){var r=this,n=this.props.rgb,a=m({default:{alpha:{absolute:"0px 0px 0px 0px",borderRadius:this.props.radius},checkboard:{absolute:"0px 0px 0px 0px",overflow:"hidden",borderRadius:this.props.radius},gradient:{absolute:"0px 0px 0px 0px",background:"linear-gradient(to right, rgba("+n.r+","+n.g+","+n.b+`, 0) 0%,
|
|
1
|
+
import{r as O,j as T,aI as On,m as jn,c as ze,aH as Mn,aW as Rn,aJ as Fn,ap as An,bd as Bn,aC as u,X as yt,be as g,bf as Tn,bg as Pn,bh as Hn,bi as Kr,bj as zn,bk as Ln,bl as Dn,bm as Nn,bn as Gn,bo as Un}from"./index-BvblFOYP.js";import{B as Wn}from"./useBasicWidgetState-BTyLgyXa-DI96f9E0.js";import"./FormClearHelper-DtwjWakY-CxfcniD6.js";var j={},re={},nt,Kt;function $n(){if(Kt)return nt;Kt=1;var e=Hn(),t=Kr(),r=zn(),n="[object String]";function a(o){return typeof o=="string"||!t(o)&&r(o)&&e(o)==n}return nt=a,nt}var at,Zt;function Xn(){if(Zt)return at;Zt=1;var e=Un();function t(r){return typeof r=="function"?r:e}return at=t,at}var ot,Qt;function wt(){if(Qt)return ot;Qt=1;var e=Ln(),t=Xn();function r(n,a){return n&&e(n,t(a))}return ot=r,ot}var it,Jt;function Vn(){if(Jt)return it;Jt=1;var e=Dn(),t=Nn(),r=Gn(),n=Kr();function a(o,i){var l=n(o)?e:r;return l(o,t(i,3))}return it=a,it}var er;function In(){if(er)return re;er=1,Object.defineProperty(re,"__esModule",{value:!0}),re.flattenNames=void 0;var e=$n(),t=s(e),r=wt(),n=s(r),a=Tn(),o=s(a),i=Vn(),l=s(i);function s(p){return p&&p.__esModule?p:{default:p}}var c=re.flattenNames=function p(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],h=[];return(0,l.default)(f,function(b){Array.isArray(b)?p(b).map(function(d){return h.push(d)}):(0,o.default)(b)?(0,n.default)(b,function(d,x){d===!0&&h.push(x),h.push(x+"-"+d)}):(0,t.default)(b)&&h.push(b)}),h};return re.default=c,re}var ne={},tr;function qn(){if(tr)return ne;tr=1,Object.defineProperty(ne,"__esModule",{value:!0}),ne.mergeClasses=void 0;var e=wt(),t=o(e),r=Pn(),n=o(r),a=Object.assign||function(l){for(var s=1;s<arguments.length;s++){var c=arguments[s];for(var p in c)Object.prototype.hasOwnProperty.call(c,p)&&(l[p]=c[p])}return l};function o(l){return l&&l.__esModule?l:{default:l}}var i=ne.mergeClasses=function(l){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],c=l.default&&(0,n.default)(l.default)||{};return s.map(function(p){var f=l[p];return f&&(0,t.default)(f,function(h,b){c[b]||(c[b]={}),c[b]=a({},c[b],f[b])}),p}),c};return ne.default=i,ne}var ae={},rr;function Yn(){if(rr)return ae;rr=1,Object.defineProperty(ae,"__esModule",{value:!0}),ae.autoprefix=void 0;var e=wt(),t=n(e),r=Object.assign||function(i){for(var l=1;l<arguments.length;l++){var s=arguments[l];for(var c in s)Object.prototype.hasOwnProperty.call(s,c)&&(i[c]=s[c])}return i};function n(i){return i&&i.__esModule?i:{default:i}}var a={borderRadius:function(i){return{msBorderRadius:i,MozBorderRadius:i,OBorderRadius:i,WebkitBorderRadius:i,borderRadius:i}},boxShadow:function(i){return{msBoxShadow:i,MozBoxShadow:i,OBoxShadow:i,WebkitBoxShadow:i,boxShadow:i}},userSelect:function(i){return{WebkitTouchCallout:i,KhtmlUserSelect:i,MozUserSelect:i,msUserSelect:i,WebkitUserSelect:i,userSelect:i}},flex:function(i){return{WebkitBoxFlex:i,MozBoxFlex:i,WebkitFlex:i,msFlex:i,flex:i}},flexBasis:function(i){return{WebkitFlexBasis:i,flexBasis:i}},justifyContent:function(i){return{WebkitJustifyContent:i,justifyContent:i}},transition:function(i){return{msTransition:i,MozTransition:i,OTransition:i,WebkitTransition:i,transition:i}},transform:function(i){return{msTransform:i,MozTransform:i,OTransform:i,WebkitTransform:i,transform:i}},absolute:function(i){var l=i&&i.split(" ");return{position:"absolute",top:l&&l[0],right:l&&l[1],bottom:l&&l[2],left:l&&l[3]}},extend:function(i,l){var s=l[i];return s||{extend:i}}},o=ae.autoprefix=function(i){var l={};return(0,t.default)(i,function(s,c){var p={};(0,t.default)(s,function(f,h){var b=a[h];b?p=r({},p,b(f)):p[h]=f}),l[c]=p}),l};return ae.default=o,ae}var oe={},nr;function Kn(){if(nr)return oe;nr=1,Object.defineProperty(oe,"__esModule",{value:!0}),oe.hover=void 0;var e=Object.assign||function(s){for(var c=1;c<arguments.length;c++){var p=arguments[c];for(var f in p)Object.prototype.hasOwnProperty.call(p,f)&&(s[f]=p[f])}return s},t=u,r=n(t);function n(s){return s&&s.__esModule?s:{default:s}}function a(s,c){if(!(s instanceof c))throw new TypeError("Cannot call a class as a function")}function o(s,c){if(!s)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c&&(typeof c=="object"||typeof c=="function")?c:s}function i(s,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof c);s.prototype=Object.create(c&&c.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),c&&(Object.setPrototypeOf?Object.setPrototypeOf(s,c):s.__proto__=c)}var l=oe.hover=function(s){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"span";return(function(p){i(f,p);function f(){var h,b,d,x;a(this,f);for(var S=arguments.length,E=Array(S),w=0;w<S;w++)E[w]=arguments[w];return x=(b=(d=o(this,(h=f.__proto__||Object.getPrototypeOf(f)).call.apply(h,[this].concat(E))),d),d.state={hover:!1},d.handleMouseOver=function(){return d.setState({hover:!0})},d.handleMouseOut=function(){return d.setState({hover:!1})},d.render=function(){return r.default.createElement(c,{onMouseOver:d.handleMouseOver,onMouseOut:d.handleMouseOut},r.default.createElement(s,e({},d.props,d.state)))},b),o(d,x)}return f})(r.default.Component)};return oe.default=l,oe}var ie={},ar;function Zn(){if(ar)return ie;ar=1,Object.defineProperty(ie,"__esModule",{value:!0}),ie.active=void 0;var e=Object.assign||function(s){for(var c=1;c<arguments.length;c++){var p=arguments[c];for(var f in p)Object.prototype.hasOwnProperty.call(p,f)&&(s[f]=p[f])}return s},t=u,r=n(t);function n(s){return s&&s.__esModule?s:{default:s}}function a(s,c){if(!(s instanceof c))throw new TypeError("Cannot call a class as a function")}function o(s,c){if(!s)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c&&(typeof c=="object"||typeof c=="function")?c:s}function i(s,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof c);s.prototype=Object.create(c&&c.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),c&&(Object.setPrototypeOf?Object.setPrototypeOf(s,c):s.__proto__=c)}var l=ie.active=function(s){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"span";return(function(p){i(f,p);function f(){var h,b,d,x;a(this,f);for(var S=arguments.length,E=Array(S),w=0;w<S;w++)E[w]=arguments[w];return x=(b=(d=o(this,(h=f.__proto__||Object.getPrototypeOf(f)).call.apply(h,[this].concat(E))),d),d.state={active:!1},d.handleMouseDown=function(){return d.setState({active:!0})},d.handleMouseUp=function(){return d.setState({active:!1})},d.render=function(){return r.default.createElement(c,{onMouseDown:d.handleMouseDown,onMouseUp:d.handleMouseUp},r.default.createElement(s,e({},d.props,d.state)))},b),o(d,x)}return f})(r.default.Component)};return ie.default=l,ie}var Ge={},or;function Qn(){if(or)return Ge;or=1,Object.defineProperty(Ge,"__esModule",{value:!0});var e=function(t,r){var n={},a=function(o){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;n[o]=i};return t===0&&a("first-child"),t===r-1&&a("last-child"),(t===0||t%2===0)&&a("even"),Math.abs(t%2)===1&&a("odd"),a("nth-child",t),n};return Ge.default=e,Ge}var ir;function Jn(){if(ir)return j;ir=1,Object.defineProperty(j,"__esModule",{value:!0}),j.ReactCSS=j.loop=j.handleActive=j.handleHover=j.hover=void 0;var e=In(),t=h(e),r=qn(),n=h(r),a=Yn(),o=h(a),i=Kn(),l=h(i),s=Zn(),c=h(s),p=Qn(),f=h(p);function h(d){return d&&d.__esModule?d:{default:d}}j.hover=l.default,j.handleHover=l.default,j.handleActive=c.default,j.loop=f.default;var b=j.ReactCSS=function(d){for(var x=arguments.length,S=Array(x>1?x-1:0),E=1;E<x;E++)S[E-1]=arguments[E];var w=(0,t.default)(S),ee=(0,n.default)(d,w);return(0,o.default)(ee)};return j.default=b,j}var Et=Jn();const m=yt(Et);var ea=function(e,t,r,n,a){var o=a.clientWidth,i=a.clientHeight,l=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,s=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,c=l-(a.getBoundingClientRect().left+window.pageXOffset),p=s-(a.getBoundingClientRect().top+window.pageYOffset);if(r==="vertical"){var f=void 0;if(p<0?f=0:p>i?f=1:f=Math.round(p*100/i)/100,t.a!==f)return{h:t.h,s:t.s,l:t.l,a:f,source:"rgb"}}else{var h=void 0;if(c<0?h=0:c>o?h=1:h=Math.round(c*100/o)/100,n!==h)return{h:t.h,s:t.s,l:t.l,a:h,source:"rgb"}}return null},lt={},ta=function(e,t,r,n){if(typeof document>"u"&&!n)return null;var a=n?new n:document.createElement("canvas");a.width=r*2,a.height=r*2;var o=a.getContext("2d");return o?(o.fillStyle=e,o.fillRect(0,0,a.width,a.height),o.fillStyle=t,o.fillRect(0,0,r,r),o.translate(r,r),o.fillRect(0,0,r,r),a.toDataURL()):null},ra=function(e,t,r,n){var a=e+"-"+t+"-"+r+(n?"-server":"");if(lt[a])return lt[a];var o=ta(e,t,r,n);return lt[a]=o,o},lr=Object.assign||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},Ce=function(e){var t=e.white,r=e.grey,n=e.size,a=e.renderers,o=e.borderRadius,i=e.boxShadow,l=e.children,s=m({default:{grid:{borderRadius:o,boxShadow:i,absolute:"0px 0px 0px 0px",background:"url("+ra(t,r,n,a.canvas)+") center left"}}});return O.isValidElement(l)?u.cloneElement(l,lr({},l.props,{style:lr({},l.props.style,s.grid)})):u.createElement("div",{style:s.grid})};Ce.defaultProps={size:8,white:"transparent",grey:"rgba(0,0,0,.08)",renderers:{}};var na=Object.assign||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},aa=(function(){function e(t,r){for(var n=0;n<r.length;n++){var a=r[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}})();function oa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sr(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function ia(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var _t=(function(e){ia(t,e);function t(){var r,n,a,o;oa(this,t);for(var i=arguments.length,l=Array(i),s=0;s<i;s++)l[s]=arguments[s];return o=(n=(a=sr(this,(r=t.__proto__||Object.getPrototypeOf(t)).call.apply(r,[this].concat(l))),a),a.handleChange=function(c){var p=ea(c,a.props.hsl,a.props.direction,a.props.a,a.container);p&&typeof a.props.onChange=="function"&&a.props.onChange(p,c)},a.handleMouseDown=function(c){a.handleChange(c),window.addEventListener("mousemove",a.handleChange),window.addEventListener("mouseup",a.handleMouseUp)},a.handleMouseUp=function(){a.unbindEventListeners()},a.unbindEventListeners=function(){window.removeEventListener("mousemove",a.handleChange),window.removeEventListener("mouseup",a.handleMouseUp)},n),sr(a,o)}return aa(t,[{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"render",value:function(){var r=this,n=this.props.rgb,a=m({default:{alpha:{absolute:"0px 0px 0px 0px",borderRadius:this.props.radius},checkboard:{absolute:"0px 0px 0px 0px",overflow:"hidden",borderRadius:this.props.radius},gradient:{absolute:"0px 0px 0px 0px",background:"linear-gradient(to right, rgba("+n.r+","+n.g+","+n.b+`, 0) 0%,
|
|
2
2
|
rgba(`+n.r+","+n.g+","+n.b+", 1) 100%)",boxShadow:this.props.shadow,borderRadius:this.props.radius},container:{position:"relative",height:"100%",margin:"0 3px"},pointer:{position:"absolute",left:n.a*100+"%"},slider:{width:"4px",borderRadius:"1px",height:"8px",boxShadow:"0 0 2px rgba(0, 0, 0, .6)",background:"#fff",marginTop:"1px",transform:"translateX(-2px)"}},vertical:{gradient:{background:"linear-gradient(to bottom, rgba("+n.r+","+n.g+","+n.b+`, 0) 0%,
|
|
3
3
|
rgba(`+n.r+","+n.g+","+n.b+", 1) 100%)"},pointer:{left:0,top:n.a*100+"%"}},overwrite:na({},this.props.style)},{vertical:this.props.direction==="vertical",overwrite:!0});return u.createElement("div",{style:a.alpha},u.createElement("div",{style:a.checkboard},u.createElement(Ce,{renderers:this.props.renderers})),u.createElement("div",{style:a.gradient}),u.createElement("div",{style:a.container,ref:function(o){return r.container=o},onMouseDown:this.handleMouseDown,onTouchMove:this.handleChange,onTouchStart:this.handleChange},u.createElement("div",{style:a.pointer},this.props.pointer?u.createElement(this.props.pointer,this.props):u.createElement("div",{style:a.slider}))))}}]),t})(O.PureComponent||O.Component),la=(function(){function e(t,r){for(var n=0;n<r.length;n++){var a=r[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}})();function sa(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ua(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ca(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function pa(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var fa=1,Zr=38,ha=40,da=[Zr,ha],ba=function(e){return da.indexOf(e)>-1},ga=function(e){return Number(String(e).replace(/%/g,""))},va=1,y=(function(e){pa(t,e);function t(r){ua(this,t);var n=ca(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.handleBlur=function(){n.state.blurValue&&n.setState({value:n.state.blurValue,blurValue:null})},n.handleChange=function(a){n.setUpdatedValue(a.target.value,a)},n.handleKeyDown=function(a){var o=ga(a.target.value);if(!isNaN(o)&&ba(a.keyCode)){var i=n.getArrowOffset(),l=a.keyCode===Zr?o+i:o-i;n.setUpdatedValue(l,a)}},n.handleDrag=function(a){if(n.props.dragLabel){var o=Math.round(n.props.value+a.movementX);o>=0&&o<=n.props.dragMax&&n.props.onChange&&n.props.onChange(n.getValueObjectWithLabel(o),a)}},n.handleMouseDown=function(a){n.props.dragLabel&&(a.preventDefault(),n.handleDrag(a),window.addEventListener("mousemove",n.handleDrag),window.addEventListener("mouseup",n.handleMouseUp))},n.handleMouseUp=function(){n.unbindEventListeners()},n.unbindEventListeners=function(){window.removeEventListener("mousemove",n.handleDrag),window.removeEventListener("mouseup",n.handleMouseUp)},n.state={value:String(r.value).toUpperCase(),blurValue:String(r.value).toUpperCase()},n.inputId="rc-editable-input-"+va++,n}return la(t,[{key:"componentDidUpdate",value:function(r,n){this.props.value!==this.state.value&&(r.value!==this.props.value||n.value!==this.state.value)&&(this.input===document.activeElement?this.setState({blurValue:String(this.props.value).toUpperCase()}):this.setState({value:String(this.props.value).toUpperCase(),blurValue:!this.state.blurValue&&String(this.props.value).toUpperCase()}))}},{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"getValueObjectWithLabel",value:function(r){return sa({},this.props.label,r)}},{key:"getArrowOffset",value:function(){return this.props.arrowOffset||fa}},{key:"setUpdatedValue",value:function(r,n){var a=this.props.label?this.getValueObjectWithLabel(r):r;this.props.onChange&&this.props.onChange(a,n),this.setState({value:r})}},{key:"render",value:function(){var r=this,n=m({default:{wrap:{position:"relative"}},"user-override":{wrap:this.props.style&&this.props.style.wrap?this.props.style.wrap:{},input:this.props.style&&this.props.style.input?this.props.style.input:{},label:this.props.style&&this.props.style.label?this.props.style.label:{}},"dragLabel-true":{label:{cursor:"ew-resize"}}},{"user-override":!0},this.props);return u.createElement("div",{style:n.wrap},u.createElement("input",{id:this.inputId,style:n.input,ref:function(a){return r.input=a},value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,onBlur:this.handleBlur,placeholder:this.props.placeholder,spellCheck:"false"}),this.props.label&&!this.props.hideLabel?u.createElement("label",{htmlFor:this.inputId,style:n.label,onMouseDown:this.handleMouseDown},this.props.label):null)}}]),t})(O.PureComponent||O.Component),xa=function(e,t,r,n){var a=n.clientWidth,o=n.clientHeight,i=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,l=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,s=i-(n.getBoundingClientRect().left+window.pageXOffset),c=l-(n.getBoundingClientRect().top+window.pageYOffset);if(t==="vertical"){var p=void 0;if(c<0)p=359;else if(c>o)p=0;else{var f=-(c*100/o)+100;p=360*f/100}if(r.h!==p)return{h:p,s:r.s,l:r.l,a:r.a,source:"hsl"}}else{var h=void 0;if(s<0)h=0;else if(s>a)h=359;else{var b=s*100/a;h=360*b/100}if(r.h!==h)return{h,s:r.s,l:r.l,a:r.a,source:"hsl"}}return null},ma=(function(){function e(t,r){for(var n=0;n<r.length;n++){var a=r[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}})();function ya(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ur(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function wa(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var Se=(function(e){wa(t,e);function t(){var r,n,a,o;ya(this,t);for(var i=arguments.length,l=Array(i),s=0;s<i;s++)l[s]=arguments[s];return o=(n=(a=ur(this,(r=t.__proto__||Object.getPrototypeOf(t)).call.apply(r,[this].concat(l))),a),a.handleChange=function(c){var p=xa(c,a.props.direction,a.props.hsl,a.container);p&&typeof a.props.onChange=="function"&&a.props.onChange(p,c)},a.handleMouseDown=function(c){a.handleChange(c),window.addEventListener("mousemove",a.handleChange),window.addEventListener("mouseup",a.handleMouseUp)},a.handleMouseUp=function(){a.unbindEventListeners()},n),ur(a,o)}return ma(t,[{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"unbindEventListeners",value:function(){window.removeEventListener("mousemove",this.handleChange),window.removeEventListener("mouseup",this.handleMouseUp)}},{key:"render",value:function(){var r=this,n=this.props.direction,a=n===void 0?"horizontal":n,o=m({default:{hue:{absolute:"0px 0px 0px 0px",borderRadius:this.props.radius,boxShadow:this.props.shadow},container:{padding:"0 2px",position:"relative",height:"100%",borderRadius:this.props.radius},pointer:{position:"absolute",left:this.props.hsl.h*100/360+"%"},slider:{marginTop:"1px",width:"4px",borderRadius:"1px",height:"8px",boxShadow:"0 0 2px rgba(0, 0, 0, .6)",background:"#fff",transform:"translateX(-2px)"}},vertical:{pointer:{left:"0px",top:-(this.props.hsl.h*100/360)+100+"%"}}},{vertical:a==="vertical"});return u.createElement("div",{style:o.hue},u.createElement("div",{className:"hue-"+a,style:o.container,ref:function(i){return r.container=i},onMouseDown:this.handleMouseDown,onTouchMove:this.handleChange,onTouchStart:this.handleChange},u.createElement("style",null,`
|
|
4
4
|
.hue-horizontal {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,m as pe,f as me,c4 as fe,x as K,ci as w,v as b,aB as O,j as l,aH as ge,aI as he,b1 as be,aJ as ye,ap as ve,c as R,F as we,aS as _,l as xe,E as J,_ as q}from"./index-
|
|
1
|
+
import{r as a,m as pe,f as me,c4 as fe,x as K,ci as w,v as b,aB as O,j as l,aH as ge,aI as he,b1 as be,aJ as ye,ap as ve,c as R,F as we,aS as _,l as xe,E as J,_ as q}from"./index-BvblFOYP.js";import{I as Te}from"./uniqueId-C6wp_e1D-D_RnWRJW.js";import{e as Ie}from"./InputInstructions-CshBE9XZ-BbegIdTI.js";import{m as Ce}from"./FormClearHelper-DtwjWakY-CxfcniD6.js";import{_ as ke}from"./sprintf-D5E86llw-6tzWM3a-.js";import{a as Se}from"./input-DNUwcYWK-C9eVW6-S.js";import"./base-input-DbV2D5sF-DJkpBRM1.js";var Q=a.forwardRef(function(e,t){var n={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return a.createElement(J,q({iconAttrs:n,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},e,{ref:t}),a.createElement("path",{d:"M0 3v2h8V3H0z"}))});Q.displayName="Minus";var Y=a.forwardRef(function(e,t){var n={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return a.createElement(J,q({iconAttrs:n,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},e,{ref:t}),a.createElement("path",{d:"M3 0v3H0v2h3v3h2V5h3V3H5V0H3z"}))});Y.displayName="Plus";const Ee=R("div",{target:"e116k4er3"})(({theme:e})=>({display:"flex",flexDirection:"row",flexWrap:"nowrap",alignItems:"center",height:e.sizes.minElementHeight,borderWidth:e.sizes.borderWidth,borderStyle:"solid",borderColor:e.colors.widgetBorderColor??e.colors.secondaryBg,transitionDuration:"200ms",transitionProperty:"border",transitionTimingFunction:"cubic-bezier(0.2, 0.8, 0.4, 1)",borderRadius:e.radii.default,overflow:"hidden","&.focused":{borderColor:e.colors.primary},input:{MozAppearance:"textfield","&::-webkit-inner-spin-button, &::-webkit-outer-spin-button":{WebkitAppearance:"none",margin:e.spacing.none}}}),""),Re=R("div",{target:"e116k4er2"})({name:"76z9jo",styles:"display:flex;flex-direction:row;align-self:stretch"}),X=R("button",{target:"e116k4er1"})(({theme:e})=>({margin:e.spacing.none,border:"none",height:e.sizes.full,display:"flex",alignItems:"center",width:e.sizes.numberInputControlsWidth,justifyContent:"center",color:e.colors.bodyText,transition:"color 300ms, backgroundColor 300ms",backgroundColor:e.colors.secondaryBg,"&:hover:enabled, &:focus:enabled":{color:e.colors.white,backgroundColor:e.colors.primary,transition:"none",outline:"none"},"&:active":{outline:"none",border:"none"},"&:disabled":{cursor:"not-allowed",color:e.colors.fadedText40}}),""),Ne=R("div",{target:"e116k4er0"})(({theme:e,clearable:t})=>({position:"absolute",marginRight:e.spacing.twoXS,left:0,right:`calc(${e.sizes.numberInputControlsWidth} * 2 + ${t?"1em":"0em"})`}),""),Ve=xe.getLogger("NumberInput");function ze(e){return b(e)||e===""?void 0:e}const E=({value:e,format:t,step:n,dataType:f})=>{if(b(e))return null;let r=ze(t);if(b(r)&&K(n)){const i=n.toString();f===w.DataType.FLOAT&&n!==0&&i.includes(".")&&(r=`%0.${i.split(".")[1].length}f`)}if(b(r))return e.toString();try{return ke.sprintf(r,e)}catch(i){return Ve.warn(`Error in sprintf(${r}, ${e}): ${i}`),String(e)}},je=(e,t,n)=>b(e)?!1:e-t>=n,De=(e,t,n)=>b(e)?!1:e+t<=n,We=e=>(e.element.dataType===w.DataType.INT?e.widgetMgr.getIntValue(e.element):e.widgetMgr.getDoubleValue(e.element))??e.element.default??null,G=({step:e,dataType:t})=>e||(t===w.DataType.INT?1:.01),Fe=({disabled:e,element:t,widgetMgr:n,fragmentId:f})=>{const r=pe(),{dataType:i,id:N,formId:m,default:W,format:g,icon:V,min:y,max:v}=t,{width:F,elementRef:Z}=me(),[s,ee]=a.useState(()=>G(t)),L=We({element:t,widgetMgr:n}),[h,x]=a.useState(!1),[d,T]=a.useState(L),[B,U]=a.useState(!1),C=a.useRef(null),H=a.useRef(Te("number_input_")),[A,I]=a.useState(()=>E({value:L,dataType:i,format:g,step:s})),k=je(d,s,y),S=De(d,s,v),M=fe({formId:m}),te=M?n.allowFormEnterToSubmit(m):h,re=B&&F>r.breakpoints.hideWidgetDetails;a.useEffect(()=>{ee(G({step:t.step,dataType:t.dataType}))},[t.dataType,t.step]),a.useEffect(()=>{h||I(E({value:d,dataType:i,format:g,step:s}))},[i,g,s]);const c=a.useCallback(({value:o,source:u})=>{if(K(o)&&(y>o||o>v))C.current?.reportValidity();else{const p=o??W??null;switch(i){case w.DataType.INT:n.setIntValue({id:N,formId:m},p,u,f);break;case w.DataType.FLOAT:n.setDoubleValue({id:N,formId:m},p,u,f);break;default:throw new Error("Invalid data type")}x(!1),T(p),I(E({value:p,dataType:i,format:g,step:s}))}},[y,v,C,n,f,s,i,N,m,W,g]),ae=a.useCallback(()=>{h&&c({value:d,source:{fromUi:!0}}),U(!1)},[h,d,c]),oe=a.useCallback(()=>{U(!0)},[]),$=a.useCallback(()=>{const{value:o}=t;t.setValue=!1,T(o??null),I(E({value:o??null,dataType:i,format:g,step:s})),c({value:o??null,source:{fromUi:!1}})},[t,s,c,i,g]);a.useEffect(()=>{t.setValue?$():c({value:d,source:{fromUi:!1}});const o=C.current;if(o){const u=p=>{p.preventDefault()};return o.addEventListener("wheel",u),()=>{o.removeEventListener("wheel",u)}}},[]),t.setValue&&$();const z=b(t.default)&&!e,ne=a.useCallback(()=>{const o=t.default??null;T(o),c({value:o,source:{fromUi:!0}})},[t]);Ce({element:t,widgetMgr:n,onFormCleared:ne});const se=o=>{const{value:u}=o.target;if(u==="")x(!0),T(null),I(null);else{let p;t.dataType===w.DataType.INT?p=parseInt(u,10):p=parseFloat(u),x(!0),T(p),I(u)}},j=a.useCallback(()=>{S&&(x(!0),c({value:(d??y)+s,source:{fromUi:!0}}))},[d,y,s,S]),D=a.useCallback(()=>{k&&(x(!0),c({value:(d??v)-s,source:{fromUi:!0}}))},[d,v,s,k]),le=a.useCallback(o=>{const{key:u}=o;switch(u){case"ArrowUp":o.preventDefault(),j();break;case"ArrowDown":o.preventDefault(),D();break}},[j,D]),ie=a.useCallback(o=>{o.key==="Enter"&&(h&&c({value:d,source:{fromUi:!0}}),n.allowFormEnterToSubmit(m)&&n.submitForm(m,f))},[h,d,c,n,m,f]),P=V?.startsWith(":material"),de=P?"lg":"base",ue=O(r.iconSizes.lg)+2*O(r.spacing.twoXS),ce=V?r.breakpoints.hideNumberInputControls+ue:r.breakpoints.hideNumberInputControls;return l.jsxs("div",{className:"stNumberInput","data-testid":"stNumberInput",ref:Z,children:[l.jsx(ge,{label:t.label,disabled:e,labelVisibility:he(t.labelVisibility?.value),htmlFor:H.current,children:t.help&&l.jsx(be,{children:l.jsx(ye,{content:t.help,placement:ve.TOP_RIGHT})})}),l.jsxs(Ee,{className:B?"focused":"","data-testid":"stNumberInputContainer",children:[l.jsx(Se,{type:"number",inputRef:C,value:A??"",placeholder:t.placeholder,onBlur:ae,onFocus:oe,onChange:se,onKeyPress:ie,onKeyDown:le,clearable:z,clearOnEscape:z,disabled:e,"aria-label":t.label,startEnhancer:t.icon&&l.jsx(we,{"data-testid":"stNumberInputIcon",iconValue:t.icon,size:de}),id:H.current,overrides:{ClearIconContainer:{style:{padding:0}},ClearIcon:{props:{overrides:{Svg:{style:{color:r.colors.grayTextColor,padding:r.spacing.threeXS,height:r.sizes.clearIconSize,width:r.sizes.clearIconSize,":hover":{fill:r.colors.bodyText}}}}}},Input:{props:{"data-testid":"stNumberInputField",step:s,min:y,max:v,type:"number",inputMode:""},style:{fontWeight:r.fontWeights.normal,lineHeight:r.lineHeights.inputWidget,paddingRight:r.spacing.sm,paddingLeft:r.spacing.md,paddingBottom:r.spacing.sm,paddingTop:r.spacing.sm,"::placeholder":{color:r.colors.fadedText60}}},InputContainer:{style:()=>({borderTopRightRadius:0,borderBottomRightRadius:0})},Root:{style:{borderTopRightRadius:0,borderBottomRightRadius:0,borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeftWidth:0,borderRightWidth:0,borderTopWidth:0,borderBottomWidth:0,paddingRight:0,paddingLeft:V?r.spacing.sm:0}},StartEnhancer:{style:{paddingLeft:0,paddingRight:0,minWidth:r.iconSizes.lg,color:P?r.colors.fadedText60:"inherit"}}}}),F>ce&&l.jsxs(Re,{children:[l.jsx(X,{"data-testid":"stNumberInputStepDown",onClick:D,disabled:!k||e,tabIndex:-1,children:l.jsx(_,{content:Q,size:"xs",color:k?"inherit":r.colors.fadedText40})}),l.jsx(X,{"data-testid":"stNumberInputStepUp",onClick:j,disabled:!S||e,tabIndex:-1,children:l.jsx(_,{content:Y,size:"xs",color:S?"inherit":r.colors.fadedText40})})]})]}),re&&l.jsx(Ne,{clearable:z,children:l.jsx(Ie,{dirty:h,value:A??"",inForm:M,allowEnterToSubmit:te})})]})},Pe=a.memo(Fe);export{Pe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,L as A,ai as h,j as u,ak as C,aR as R,al as E,am as T,a$ as B}from"./index-
|
|
1
|
+
import{r as c,L as A,ai as h,j as u,ak as C,aR as R,al as E,am as T,a$ as B}from"./index-BvblFOYP.js";import{a as $}from"./createDownloadLinkElement-CbRjLJ8e-NbV49OP9.js";const v=/%([0-9A-Fa-f]{2})/g,L=/[^\x20-\x7e\xa0-\xff]/g,k=/\\([\u0000-\u007f])/g,w=/;[\x09\x20]*([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*=[\x09\x20]*("(?:[\x20!\x23-\x5b\x5d-\x7e\x80-\xff]|\\[\x20-\x7e])*"|[!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*/g,z=/^([A-Za-z0-9!#$%&+\-^_`{}~]+)'(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}|[A-Za-z]{4,8}|)'((?:%[0-9A-Fa-f]{2}|[A-Za-z0-9!#$&+.^_`|~-])+)$/,I=/^([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*(?:$|;)/,U=r=>String(r).replace(L,"?");class j{constructor(e,t){this.type=e,this.parameters=t}}const D=(r,e)=>String.fromCharCode(Number.parseInt(e,16));function Z(r){const e=z.exec(r);if(!e)throw new TypeError("invalid extended field value");const t=e[1].toLowerCase(),a=e[2];let n;switch(t){case"iso-8859-1":n=U(a.replace(v,D));break;case"utf-8":try{n=decodeURIComponent(a)}catch{throw new TypeError("invalid encoded utf-8")}break;default:throw new TypeError("unsupported charset in extended field")}return n}function S(r){let e=I.exec(r);if(!e)throw new TypeError("invalid type format");let t=e[0].length;const a=e[1].toLowerCase();let n;const l=[],i={};let o;for(t=w.lastIndex=e[0].slice(-1)===";"?t-1:t;e=w.exec(r);){if(e.index!==t)throw new TypeError("invalid parameter format");if(t+=e[0].length,n=e[1].toLowerCase(),o=e[2],l.indexOf(n)!==-1)throw new TypeError("invalid duplicate parameter");if(l.push(n),n.indexOf("*")+1===n.length){n=n.slice(0,-1),o=Z(o),i[n]=o;continue}typeof i[n]!="string"&&(o[0]==='"'&&(o=o.slice(1,o.length-1).replace(k,"$1")),i[n]=o)}if(t!==-1&&t!==r.length)throw new TypeError("invalid parameter format");return new j(a,i)}function N(r){const e=S(r);if(e.type!=="attachment")return;const t=e.parameters.filename;if(typeof t=="string")return t}function O(r,e){return r.sendHttpRequest({method:"GET",path:`${e}?title=${encodeURIComponent(document.title)}`,headers:{},body:""}).then(({statusCode:t,headers:a,body:n})=>{if(t!==200)return;const l=a.get("Content-Disposition"),i=(l&&N(l))??"",o=a.get("Content-Type"),f=new Blob([n],o?{type:o}:void 0),d=URL.createObjectURL(f),s=document.createElement("a");s.setAttribute("href",d),s.setAttribute("target","_blank"),s.setAttribute("download",i),s.click(),URL.revokeObjectURL(d),s.remove()})}function _(){const r=B();return c.useCallback(e=>O(r,e),[r])}function M(r){const{disabled:e,element:t,widgetMgr:a,endpoints:n,fragmentId:l}=r,{help:i,label:o,icon:f,ignoreRerun:d,type:s,url:m}=t,{libConfig:{enforceDownloadInNewTab:b=!1}}=c.useContext(A);let p=h.SECONDARY;s==="primary"?p=h.PRIMARY:s==="tertiary"&&(p=h.TERTIARY);const x=c.useMemo(()=>n.buildDownloadUrl(m),[n,m]);c.useEffect(()=>{n.checkSourceUrlResponse(x,"Download Button")},[x,n]);const g=_(),y=()=>{if(d||a.setTriggerValue(t,{fromUi:!0},l),t.url.startsWith("/media")){g(t.url);return}$({filename:"",url:x,enforceDownloadInNewTab:b}).click()};return u.jsx("div",{className:"stDownloadButton","data-testid":"stDownloadButton",children:u.jsx(C,{help:i,containerWidth:!0,children:u.jsx(R,{kind:p,size:E.SMALL,disabled:e,onClick:y,containerWidth:!0,children:u.jsx(T,{icon:f,label:o})})})})}const Y=c.memo(M);export{Y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,x as H,v as he,j as l,c as C,aH as Fe,aI as Me,aJ as ze,ap as Be,m as Ve,aK as se,aB as We,aL as oe,as as le,aM as Oe,aN as De,aO as Ne,L as $e,aP as _e,aQ as He,aR as Xe,ai as Ge,aS as Je,E as J,_ as K}from"./index-Cx-F6ZGn.js";import{y as Ke,X as ce}from"./Toolbar-JQglDlYw-BVoZAoJb.js";import{d as Ye,m as qe}from"./FormClearHelper-Bzgvbizg-C4nYH9Ah.js";import{a as Qe}from"./createDownloadLinkElement-CbRjLJ8e-NbV49OP9.js";import{i as Ze,o as er}from"./FileDownload.esm-DF2iWLBX-wR0Sqyar.js";var fe=t.forwardRef(function(e,r){var i={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(J,K({iconAttrs:i,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("g",{fill:"none"},t.createElement("rect",{width:24,height:24}),t.createElement("rect",{width:24,height:24}),t.createElement("rect",{width:24,height:24})),t.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"}),t.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"}))});fe.displayName="Mic";var ge=t.forwardRef(function(e,r){var i={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(J,K({iconAttrs:i,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("rect",{width:24,height:24,fill:"none"}),t.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"}))});ge.displayName="Pause";var we=t.forwardRef(function(e,r){var i={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(J,K({iconAttrs:i,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("rect",{width:24,height:24,fill:"none"}),t.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"}))});we.displayName="PlayArrow";var pe=t.forwardRef(function(e,r){var i={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(J,K({iconAttrs:i,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),t.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"}))});pe.displayName="Refresh";var me=t.forwardRef(function(e,r){var i={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(J,K({iconAttrs:i,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("g",{fill:"none"},t.createElement("rect",{width:24,height:24}),t.createElement("rect",{width:24,height:24})),t.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"}))});me.displayName="StopCircle";async function rr(e,r=16e3){if(!e||e.size===0)throw new Error("Invalid or empty blob provided");if(!window.AudioContext)throw new Error("AudioContext not supported in this browser");const i=new AudioContext;try{const n=await e.arrayBuffer(),a=await i.decodeAudioData(n),d=r??a.sampleRate,f=await tr(a,d);return nr(f,d)}finally{i.close()}}async function tr(e,r){const{duration:i,numberOfChannels:n,sampleRate:a}=e,d=Math.ceil(i*r);if(!window.OfflineAudioContext)throw new Error("OfflineAudioContext not supported");const f=new OfflineAudioContext(1,d,r),g=f.createBufferSource();if(g.buffer=e,n>1){const m=f.createChannelSplitter(n),u=f.createChannelMerger(1);g.connect(m);for(let s=0;s<n;s++){const o=f.createGain();o.gain.value=1/n,m.connect(o,s),o.connect(u,0,0)}u.connect(f.destination)}else g.connect(f.destination);g.start(0);try{return await f.startRendering()}catch(m){throw new Error(`Failed to resample audio from ${a}Hz to ${r}Hz: ${m instanceof Error?m.message:String(m)}`)}}function nr(e,r){const i=e.length,n=i*2+44,a=new ArrayBuffer(n),d=new DataView(a),f=e.getChannelData(0),g=(u,s)=>{for(let o=0;o<s.length;o++)d.setUint8(u+o,s.charCodeAt(o))};g(0,"RIFF"),d.setUint32(4,n-8,!0),g(8,"WAVE"),g(12,"fmt "),d.setUint32(16,16,!0),d.setUint16(20,1,!0),d.setUint16(22,1,!0),d.setUint32(24,r,!0),d.setUint32(28,r*2,!0),d.setUint16(32,2,!0),d.setUint16(34,16,!0),g(36,"data"),d.setUint32(40,i*2,!0);let m=44;for(let u=0;u<i;u++){const s=Math.max(-1,Math.min(1,f[u]));d.setInt16(m,s*32767,!0),m+=2}return new Blob([a],{type:"audio/wav"})}class de{constructor(){this.wavesurfer=null,this.currentBlobUrl=null,this.events={},this.isPlaying=!1}initialize(r){this.wavesurfer=r,this.setupEventListeners()}setupEventListeners(){this.wavesurfer&&(this.teardownEventListeners(),this.handleTimeUpdate=r=>{this.events.onTimeUpdate?.(r*1e3)},this.handlePause=()=>{this.isPlaying=!1,this.events.onPause?.()},this.handlePlay=()=>{this.isPlaying=!0,this.events.onPlay?.()},this.handleFinish=()=>{this.isPlaying=!1,this.events.onFinish?.()},this.handleReady=()=>{this.events.onReady?.()},this.handleError=r=>{const i=r instanceof Error?r:new Error(String(r));this.events.onError?.(i)},this.wavesurfer.on("timeupdate",this.handleTimeUpdate),this.wavesurfer.on("pause",this.handlePause),this.wavesurfer.on("play",this.handlePlay),this.wavesurfer.on("finish",this.handleFinish),this.wavesurfer.on("ready",this.handleReady),this.wavesurfer.on("error",this.handleError))}setEventHandlers(r){this.events=r}async load(r){if(!this.wavesurfer)throw new Error("WaveSurfer not initialized");this.cleanupPreviousUrl();let i,n=null;try{if(r instanceof Blob)n=URL.createObjectURL(r),i=n;else if(r instanceof ArrayBuffer){const a=new Blob([r]);n=URL.createObjectURL(a),i=n}else i=r;this.currentBlobUrl=n,await this.wavesurfer.load(i)}catch(a){throw this.cleanupPreviousUrl(),a}}async play(){if(!this.wavesurfer)throw new Error("WaveSurfer not initialized");await this.wavesurfer.play()}pause(){this.wavesurfer&&this.wavesurfer.pause()}getDuration(){return this.wavesurfer?this.wavesurfer.getDuration()*1e3:0}getCurrentTime(){return this.wavesurfer?this.wavesurfer.getCurrentTime()*1e3:0}getIsPlaying(){return this.isPlaying}seekToStart(){this.wavesurfer&&this.wavesurfer.seekTo(0)}cleanupPreviousUrl(){this.currentBlobUrl&&(URL.revokeObjectURL(this.currentBlobUrl),this.currentBlobUrl=null)}destroy(){this.pause(),this.cleanupPreviousUrl(),this.wavesurfer&&(this.teardownEventListeners(),this.wavesurfer.empty(),this.wavesurfer=null),this.events={},this.isPlaying=!1,this.handleTimeUpdate=void 0,this.handlePause=void 0,this.handlePlay=void 0,this.handleFinish=void 0,this.handleReady=void 0,this.handleError=void 0}teardownEventListeners(){this.wavesurfer&&(this.handleTimeUpdate&&(this.wavesurfer.un("timeupdate",this.handleTimeUpdate),this.handleTimeUpdate=void 0),this.handlePause&&(this.wavesurfer.un("pause",this.handlePause),this.handlePause=void 0),this.handlePlay&&(this.wavesurfer.un("play",this.handlePlay),this.handlePlay=void 0),this.handleFinish&&(this.wavesurfer.un("finish",this.handleFinish),this.handleFinish=void 0),this.handleReady&&(this.wavesurfer.un("ready",this.handleReady),this.handleReady=void 0),this.handleError&&(this.wavesurfer.un("error",this.handleError),this.handleError=void 0))}}class ir{constructor(r={}){this.wavesurfer=null,this.recordPlugin=null,this.isRecording=!1,this.recordEndResolve=null,this.recordEndReject=null,this.events={},this.options=r}initialize(r,i){this.wavesurfer=r;try{const n={renderRecordedAudio:!1,mimeType:"audio/webm"};this.recordPlugin=r.registerPlugin(i.create(n)),this.setupEventListeners()}catch(n){const a=n instanceof Error?n:new Error(String(n));throw a.name==="NotAllowedError"||a.name==="PermissionDeniedError"?(this.events.onPermissionDenied?.(),new Error("Microphone permission denied")):(this.events.onError?.(a),a)}}setupEventListeners(){this.recordPlugin&&(this.recordPlugin.on("record-start",()=>{this.isRecording=!0,this.events.onRecordStart?.()}),this.recordPlugin.on("record-end",r=>{this.isRecording=!1,this.events.onRecordEnd?.(r),this.recordEndResolve&&r&&r.size>0?(this.recordEndResolve(r),this.recordEndResolve=null,this.recordEndReject=null):this.recordEndReject?(this.recordEndReject(new Error("Invalid or empty recording")),this.recordEndResolve=null,this.recordEndReject=null):(this.recordEndResolve=null,this.recordEndReject=null)}),this.recordPlugin.on("record-progress",r=>{this.events.onRecordProgress?.(r)}))}setEventHandlers(r){this.events=r}async startRecording(){if(!this.recordPlugin)throw new Error("Record plugin not initialized");if(this.isRecording)return;const r=typeof this.options.sampleRate=="number"?this.options.sampleRate:void 0,i={};r!==void 0&&(i.sampleRate={ideal:r}),await this.startRecordingWithConstraints(i,r!==void 0)}async startRecordingWithConstraints(r,i){if(!this.recordPlugin)throw new Error("Record plugin not initialized");try{const n=Object.keys(r).length?r:void 0;await this.recordPlugin.startRecording(n)}catch(n){const a=n instanceof Error?n:new Error(String(n));if(a.name==="NotAllowedError"||a.name==="PermissionDeniedError")throw this.events.onPermissionDenied?.(),new Error("Microphone permission denied");if(i&&(a.name==="OverconstrainedError"||a.name==="NotReadableError")){this.options.sampleRate=void 0,await this.startRecordingWithConstraints({},!1);return}throw this.events.onError?.(a),a}}async stopRecording(){if(!this.recordPlugin||!this.isRecording)throw new Error("Not currently recording");try{return new Promise((r,i)=>{this.recordEndResolve=r,this.recordEndReject=i,this.recordPlugin?.stopRecording()})}catch(r){const i=r instanceof Error?r:new Error(String(r));throw this.events.onError?.(i),i}}cancelRecording(){this.recordPlugin&&this.isRecording&&(this.recordPlugin.stopRecording(),this.isRecording=!1,this.recordEndResolve=null,this.recordEndReject=null)}destroy(){this.cancelRecording(),this.recordPlugin&&(this.recordPlugin.destroy(),this.recordPlugin=null),this.wavesurfer=null,this.events={}}}const ar=4,sr=4,or=8,lr=0,cr=4,dr=16e3;function ur({containerRef:e,sampleRate:r,events:i}){const n=Ve(),[a,d]=t.useState("idle"),[f,g]=t.useState(null),[m,u]=t.useState(!1),s=t.useRef(null),o=t.useRef(null),p=t.useRef(null),h=t.useRef(i||{}),A=t.useRef(!1),R=t.useRef(new Set),y=t.useRef(!1),L=r===void 0?dr:r;t.useEffect(()=>{h.current=i||{}},[i]);const O=t.useCallback(()=>{const c=Array.from(R.current);R.current.clear(),c.forEach(v=>{v.resolve()})},[]),F=t.useCallback(c=>{u(!1);const v=Array.from(R.current);R.current.clear(),v.forEach(b=>{b.reject(c)})},[]),S=t.useCallback(c=>{const v={onPlay:()=>{u(!0),h.current.onPlaybackPlay?.()},onPause:()=>{u(!1),h.current.onPlaybackPause?.()},onFinish:()=>{u(!1),h.current.onPlaybackFinish?.()},onReady:()=>{O()},onError:b=>{u(!1),F(b),h.current.onError?.(b)}};c.setEventHandlers(v)},[O,F]),P=t.useCallback(async()=>{if(!(A.current||!e.current))try{const[c,v]=await Promise.all([se(()=>import("./wavesurfer.esm-CzjpjtNs-CtBzisOM.js"),[]),se(()=>import("./record-DJsfODTt-CK8X1liM.js"),[])]),b=c.default,U=v.default,j=b.create({container:e.current,waveColor:n.colors.primary,progressColor:n.colors.bodyText,height:We(n.sizes.largestElementHeight)-2*cr,barWidth:ar,barGap:sr,barRadius:or,cursorWidth:lr,interact:!0});s.current=j,y.current=!1;const $=new ir({sampleRate:L});$.initialize(j,U),$.setEventHandlers({onRecordProgress:_=>{h.current.onProgressMs?.(_)},onPermissionDenied:()=>{h.current.onPermissionDenied?.(),d("idle")},onError:_=>{h.current.onError?.(_),d("idle")}}),o.current=$;const M=new de;M.initialize(j),p.current=M,S(M),A.current=!0}catch(c){const v=c instanceof Error?c:new Error(String(c));h.current.onError?.(v)}},[e,n,L,S]);t.useEffect(()=>{P();const c=R.current;return()=>{c.clear(),u(!1),o.current&&(o.current.destroy(),o.current=null),p.current&&(p.current.destroy(),p.current=null),s.current&&(s.current.destroy(),s.current=null),A.current=!1,y.current=!1}},[P]),t.useEffect(()=>{const c=s.current;if(c){if(a==="recording"){c.setOptions({waveColor:n.colors.primary,progressColor:n.colors.primary});return}if(y.current){c.setOptions({interact:!0,waveColor:oe(n.colors.fadedText40,n.colors.secondaryBg),progressColor:n.colors.bodyText});return}c.setOptions({waveColor:n.colors.primary,progressColor:n.colors.bodyText})}},[a,n.colors.bodyText,n.colors.fadedText40,n.colors.primary,n.colors.secondaryBg]);const E=t.useCallback(async()=>{if(a!=="recording"){if(A.current||await P(),!o.current)throw new Error("Record backend not initialized");s.current&&s.current.setOptions({waveColor:n.colors.primary,progressColor:n.colors.primary}),y.current=!1,await o.current.startRecording(),d("recording"),g(null),u(!1),h.current.onRecordStart?.()}},[a,P,n.colors.primary]),X=t.useCallback(()=>{p.current&&s.current&&(p.current.destroy(),p.current=new de,p.current.initialize(s.current),R.current.clear(),u(!1),S(p.current)),y.current=!1},[S]),V=t.useCallback(()=>{p.current?.seekToStart(),u(!1),y.current=!0,s.current&&s.current.setOptions({interact:!0,waveColor:oe(n.colors.fadedText40,n.colors.secondaryBg),progressColor:n.colors.bodyText})},[n.colors.bodyText,n.colors.fadedText40,n.colors.secondaryBg]),k=t.useCallback(async()=>{if(a!=="recording")throw new Error("Not currently recording");if(!o.current||!p.current)throw new Error("Backends not initialized");try{const c=await o.current.stopRecording();return g(c),await new Promise((v,b)=>{if(!p.current){b(new Error("Player not initialized"));return}const U={resolve:()=>{R.current.delete(U),v()},reject:j=>{R.current.delete(U),b(j)}};R.current.add(U),p.current.load(c).catch(j=>{R.current.delete(U),b(j instanceof Error?j:new Error(String(j)))})}),d("idle"),u(!1),V(),h.current.onRecordReady?.(c),c}catch(c){const v=c instanceof Error?c:new Error(String(c));throw u(!1),v}},[a,V]),D=t.useCallback(async c=>{const v=c??f;if(!v)throw new Error("No recorded audio to approve");try{const b=await rr(v,L);h.current.onApprove?.(b),g(null),d("idle")}catch(b){const U=b instanceof Error?b:new Error(String(b));throw h.current.onError?.(U),U}},[f,L]),N=t.useCallback(()=>{a==="recording"&&o.current?.cancelRecording(),X(),g(null),d("idle"),u(!1),y.current=!1,h.current.onCancel?.()},[a,X]),z={isPlaying:t.useCallback(()=>p.current?.getIsPlaying()??!1,[]),play:t.useCallback(async()=>{if(!p.current)throw new Error("Player not initialized");await p.current.play()},[]),pause:t.useCallback(()=>{p.current?.pause()},[]),load:t.useCallback(async c=>{if(A.current||await P(),!p.current)throw new Error("Player not initialized");await p.current.load(c),V()},[V,P]),getCurrentTimeMs:t.useCallback(()=>p.current?.getCurrentTime()??0,[]),getDurationMs:t.useCallback(()=>p.current?.getDuration()??0,[])},Y=t.useCallback(c=>{h.current=c},[]);return{state:a,isPlaybackPlaying:m,start:E,stop:k,approve:D,cancel:N,playback:z,setEventHandlers:Y}}const hr=(e,r)=>{const{libConfig:{enforceDownloadInNewTab:i=!1}}=t.useContext($e);return t.useCallback(()=>{if(!e)return;const n=Qe({enforceDownloadInNewTab:i,url:e,filename:r});n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n)},[e,i,r])},Q=({widgetMgr:e,id:r,formId:i,key:n,defaultValue:a})=>{t.useEffect(()=>{const s=e.getElementState(r,n);he(s)&&H(a)&&e.setElementState(r,n,a)},[e,r,n,a]);const[d,f]=t.useState(e.getElementState(r,n)??a),g=t.useCallback(s=>{e.setElementState(r,n,s),f(s)},[e,r,n]),m=t.useMemo(()=>({formId:i||""}),[i]),u=t.useCallback(()=>g(a),[a,g]);return qe({element:m,widgetMgr:e,onFormCleared:u}),[d,g]},fr=async({files:e,uploadClient:r,widgetMgr:i,widgetInfo:n,fragmentId:a,signal:d})=>{let f=[];try{f=await r.fetchFileURLs(e)}catch(s){return{successfulUploads:[],failedUploads:e.map(o=>({file:o,error:le(s)}))}}const g=Oe(e,f),m=[],u=[];return await Promise.all(g.map(async([s,o])=>{if(!s||!o?.uploadUrl||!o.fileId)return{file:s,fileUrl:o,error:new Error("No upload URL found")};try{await r.uploadFile({id:o.fileId,formId:n.formId||""},o.uploadUrl,s,void 0,d),m.push({fileUrl:o,file:s})}catch(p){const h=le(p);u.push({file:s,error:h})}})),i.setFileUploaderStateValue(n,new De({uploadedFileInfo:m.map(({file:s,fileUrl:o})=>new Ne({fileId:o.fileId,fileUrls:o,name:s.webkitRelativePath||s.name,size:s.size}))}),{fromUi:!0},a),{successfulUploads:m,failedUploads:u}},gr=C("div",{target:"e12wn80j14"})(""),ue=C("div",{target:"e12wn80j13"})(({theme:e,disabled:r})=>({height:e.sizes.largestElementHeight,width:"100%",background:e.colors.secondaryBg,borderRadius:e.radii.default,marginBottom:e.spacing.twoXS,display:"flex",alignItems:"center",position:"relative",paddingLeft:e.spacing.xs,paddingRight:e.spacing.sm,border:e.colors.widgetBorderColor?`${e.sizes.borderWidth} solid ${e.colors.widgetBorderColor}`:void 0,cursor:r?"not-allowed":"auto",overflow:"hidden"}),""),wr=C("div",{target:"e12wn80j12"})({name:"82a6rk",styles:"flex:1"}),pr=C("div",{target:"e12wn80j11"})(({show:e,theme:r})=>({display:e?"block":"none",position:"relative",height:r.sizes.largestElementHeight,"& > div":{position:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",alignItems:"center"}}),""),mr=C("span",{target:"e12wn80j10"})(({theme:e,isPlayingOrRecording:r,disabled:i})=>({margin:e.spacing.sm,fontFamily:e.fonts.monospace,color:i?e.colors.fadedText40:r?e.colors.bodyText:e.colors.fadedText60,backgroundColor:e.colors.secondaryBg,fontSize:e.fontSizes.sm}),""),ye=C("div",{target:"e12wn80j9"})({name:"1kyw74z",styles:"width:100%;text-align:center;overflow:hidden"}),ve=C("span",{target:"e12wn80j8"})(({theme:e})=>({color:e.colors.bodyText}),""),yr=C("a",{target:"e12wn80j7"})(({theme:e})=>({color:e.colors.link,textDecoration:e.linkUnderline?"underline":"none"}),""),vr=C("div",{target:"e12wn80j6"})(({theme:e})=>({flex:1,height:e.sizes.largestElementHeight,display:"flex",justifyContent:"center",alignItems:"center"}),""),br=C("div",{target:"e12wn80j5"})(({theme:e})=>{const r="0.625em";return{opacity:.2,width:"100%",height:r,backgroundSize:r,backgroundImage:`radial-gradient(${e.colors.fadedText10} 40%, transparent 40%)`,backgroundRepeat:"repeat"}},""),Er=C("span",{target:"e12wn80j4"})(({theme:e})=>({"& > button":{color:e.colors.primary,padding:e.spacing.threeXS},"& > button:hover, & > button:focus":{color:e.colors.redColor}}),""),Rr=C("span",{target:"e12wn80j3"})(({theme:e})=>({"& > button":{padding:e.spacing.threeXS,color:e.colors.fadedText60},"& > button:hover, & > button:focus":{color:e.colors.bodyText}}),""),be=C("span",{target:"e12wn80j2"})(({theme:e})=>({"& > button":{padding:e.spacing.threeXS,color:e.colors.fadedText60},"& > button:hover, & > button:focus":{color:e.colors.bodyText}}),""),Z=C("div",{target:"e12wn80j1"})(({theme:e})=>({display:"flex",justifyContent:"center",alignItems:"center",flexGrow:0,flexShrink:1,padding:e.spacing.xs,gap:e.spacing.twoXS,marginRight:e.spacing.twoXS}),""),Cr=C("div",{target:"e12wn80j0"})(({theme:e})=>({marginLeft:e.spacing.sm}),""),G=({onClick:e,disabled:r,ariaLabel:i,iconContent:n})=>l.jsx(Xe,{kind:Ge.BORDERLESS_ICON,onClick:e,disabled:r,"aria-label":i,containerWidth:!0,"data-testid":"stAudioInputActionButton",children:l.jsx(Je,{content:n,size:"lg",color:"inherit"})}),Pr=({disabled:e,stopRecording:r})=>l.jsx(Er,{children:l.jsx(G,{onClick:r,disabled:e,ariaLabel:"Stop recording",iconContent:me})}),xr=({disabled:e,isPlaying:r,onClickPlayPause:i})=>l.jsx(be,{children:r?l.jsx(G,{onClick:i,disabled:e,ariaLabel:"Pause",iconContent:ge}):l.jsx(G,{onClick:i,disabled:e,ariaLabel:"Play",iconContent:we})}),kr=({disabled:e,startRecording:r})=>l.jsx(Rr,{children:l.jsx(G,{onClick:r,disabled:e,ariaLabel:"Record",iconContent:fe})}),Ur=({onClick:e})=>l.jsx(be,{children:l.jsx(G,{disabled:!1,onClick:e,ariaLabel:"Reset",iconContent:pe})}),jr=({disabled:e,isRecording:r,isPlaying:i,isUploading:n,isError:a,recordingUrlExists:d,startRecording:f,stopRecording:g,onClickPlayPause:m,onClear:u})=>a?l.jsx(Z,{children:l.jsx(Ur,{onClick:u})}):n?l.jsx(Z,{children:l.jsx(_e,{"aria-label":"Uploading",size:"base",margin:"0",padding:"0"})}):l.jsxs(Z,{children:[r?l.jsx(Pr,{disabled:e,stopRecording:g}):l.jsx(kr,{disabled:e,startRecording:f}),d&&l.jsx(xr,{disabled:e,isPlaying:i,onClickPlayPause:m})]}),Sr=t.memo(jr),Ir=()=>l.jsx(ye,{children:l.jsx(ve,{children:"An error has occurred, please try again."})}),Ar=t.memo(Ir),T="00:00",W=e=>{const r=Math.floor(e/1e3),i=Math.floor(r/60),n=Math.floor(i/60),a=r%60,d=i%60,f=a.toString().padStart(2,"0"),g=d.toString().padStart(2,"0"),m=n.toString().padStart(2,"0");return i<60?`${g}:${f}`:`${m}:${g}:${f}`},Tr=()=>l.jsxs(ye,{children:[l.jsx(ve,{children:"This app would like to use your microphone."})," ",l.jsx(yr,{href:He,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]}),Lr=t.memo(Tr),Fr=()=>l.jsx(vr,{children:l.jsx(br,{})}),Mr=t.memo(Fr),zr=({element:e,uploadClient:r,widgetMgr:i,fragmentId:n,disabled:a})=>{const d=t.useRef(null),[f,g]=t.useState(!1),[m,u]=t.useState(!1),[s,o]=t.useState(!1),[p,h]=t.useState(T),[A,R]=Q({widgetMgr:i,id:e.id,key:"deleteFileUrl",defaultValue:null}),[y,L]=Q({widgetMgr:i,id:e.id,key:"recordingUrl",defaultValue:null}),[O,F]=Q({widgetMgr:i,id:e.id,formId:e.formId,key:"recordingTime",defaultValue:T}),S=t.useRef(null),P=t.useRef(null),E=t.useRef(null),X=t.useRef(),V=e.id,k=e.formId,D=ur({containerRef:d,sampleRate:e.sampleRate??void 0,events:{onPermissionDenied:()=>{g(!0)},onError:()=>{o(!0)},onRecordStart:()=>{F(T),h(T)},onRecordReady:()=>{const w=W(D.playback.getDurationMs());F(w),h(w)},onApprove:w=>{X.current?.(w)},onCancel:()=>{F(T),h(T)},onProgressMs:w=>{F(W(w))},onPlaybackPause:()=>{h(W(D.playback.getCurrentTimeMs()))},onPlaybackFinish:()=>{h(W(D.playback.getDurationMs()))}}}),{state:N,isPlaybackPlaying:z,start:Y,stop:c,approve:v,cancel:b,playback:{play:U,pause:j,load:$,getCurrentTimeMs:M,getDurationMs:_}}=D,Ee=t.useCallback(async w=>{S.current&&S.current.abort();const x=new AbortController;S.current=x;try{if(u(!0),H(k)&&i.setFormsWithUploadsInProgress(new Set([k])),x.signal.aborted)return;let I;try{I=URL.createObjectURL(w),P.current&&P.current!==I&&URL.revokeObjectURL(P.current),P.current=I}catch{o(!0),u(!1),H(k)&&i.setFormsWithUploadsInProgress(new Set);return}if(x.signal.aborted){URL.revokeObjectURL(I),P.current=null;return}L(I);const Ie=new Date().toISOString().slice(0,16).replace(/:/g,"-"),Ae=new File([w],`${Ie}_audio.wav`,{type:w.type});try{const{successfulUploads:Te,failedUploads:Le}=await fr({files:[Ae],uploadClient:r,widgetMgr:i,widgetInfo:{id:V,formId:k},fragmentId:n,signal:x.signal});if(x.signal.aborted)return;if(Le.length>0){o(!0);return}o(!1);const ae=Te[0];ae?.fileUrl?.deleteUrl&&R(ae.fileUrl.deleteUrl)}catch{x.signal.aborted||o(!0)}finally{H(k)&&i.setFormsWithUploadsInProgress(new Set),x.signal.aborted||u(!1)}}catch{x.signal.aborted||(o(!0),u(!1)),H(k)&&i.setFormsWithUploadsInProgress(new Set)}},[r,i,V,k,n,R,L]);X.current=Ee;const B=t.useCallback(async({updateWidgetManager:w,deleteFile:x})=>{const I=y;if(I&&P.current===I&&(URL.revokeObjectURL(I),P.current=null),E.current&&(cancelAnimationFrame(E.current),E.current=null),L(null),R(null),h(T),F(T),b(),w&&i.setFileUploaderStateValue(e,{},{fromUi:!0},n),x&&A)try{await r.deleteFile(A)}catch{}H(I)&&URL.revokeObjectURL(I)},[A,y,r,b,e,i,n,F,R,L]);t.useEffect(()=>{const w=()=>{z&&(h(W(M())),E.current=requestAnimationFrame(w))};return z?E.current=requestAnimationFrame(w):E.current&&(cancelAnimationFrame(E.current),E.current=null),()=>{E.current&&(cancelAnimationFrame(E.current),E.current=null)}},[z,M]),t.useEffect(()=>{if(!y)return;let w=!1;return h(O),(async()=>{try{if(await $(y),w)return;const x=_();x>0&&h(W(x))}catch{w||o(!0)}})(),()=>{w=!0}},[y,O,$,_]),t.useEffect(()=>{if(he(k))return;const w=new Ye;return w.manageFormClearListener(i,k,()=>{B({updateWidgetManager:!0,deleteFile:!1})}),()=>w.disconnect()},[k,B,i]),t.useEffect(()=>()=>{S.current&&(S.current.abort(),S.current=null),E.current&&(cancelAnimationFrame(E.current),E.current=null)},[]);const Re=t.useCallback(async()=>{try{if(z){const w=M();j(),h(W(w))}else N==="idle"&&y&&(M()<=100&&h(T),await U())}catch{o(!0)}},[z,M,j,U,y,N]),ee=t.useCallback(async()=>{y&&await B({updateWidgetManager:!1,deleteFile:!0});try{h(T),await Y()}catch{}},[B,y,Y]),re=t.useCallback(async()=>{try{const w=await c();await v(w)}catch{o(!0)}},[v,c]),te=hr(y,"recording.wav"),Ce=t.useCallback(()=>{ee()},[ee]),Pe=t.useCallback(()=>{re()},[re]),xe=t.useCallback(()=>{B({updateWidgetManager:!1,deleteFile:!0}),o(!1)},[B]),ke=t.useCallback(()=>{te()},[te]),Ue=t.useCallback(()=>{B({updateWidgetManager:!0,deleteFile:!0})},[B]),q=N==="recording",ne=z,je=q?O:p,ie=N==="idle"&&!f&&!y,Se=f||ie||s;return l.jsxs(gr,{className:"stAudioInput","data-testid":"stAudioInput",children:[l.jsx(Fe,{label:e.label,disabled:a,labelVisibility:Me(e.labelVisibility?.value),children:e.help&&l.jsx(Cr,{children:l.jsx(ze,{content:e.help,placement:Be.TOP})})}),l.jsxs(ue,{disabled:a,children:[l.jsxs(Ke,{isFullScreen:!1,disableFullscreenMode:!0,target:ue,children:[y&&l.jsx(ce,{label:"Download as WAV",icon:Ze,onClick:ke}),A&&l.jsx(ce,{label:"Clear recording",icon:er,onClick:Ue})]}),l.jsx(Sr,{isRecording:q,isPlaying:ne,isUploading:m,isError:s,recordingUrlExists:!!y,startRecording:Ce,stopRecording:Pe,onClickPlayPause:()=>void Re(),onClear:xe,disabled:a||f}),l.jsxs(wr,{children:[s&&l.jsx(Ar,{}),ie&&l.jsx(Mr,{}),f&&l.jsx(Lr,{}),l.jsx(pr,{"data-testid":"stAudioInputWaveSurfer",ref:d,show:!Se})]}),l.jsx(mr,{isPlayingOrRecording:q||ne,disabled:a,"data-testid":"stAudioInputWaveformTimeCode",children:je})]})]})},Nr=t.memo(zr);export{Nr as default};
|
|
1
|
+
import{r as t,x as H,v as he,j as l,c as C,aH as Fe,aI as Me,aJ as ze,ap as Be,m as Ve,aK as se,aB as We,aL as oe,as as le,aM as Oe,aN as De,aO as Ne,L as $e,aP as _e,aQ as He,aR as Xe,ai as Ge,aS as Je,E as J,_ as K}from"./index-BvblFOYP.js";import{y as Ke,X as ce}from"./Toolbar-Cc8tCeKL-JHIp2NvW.js";import{d as Ye,m as qe}from"./FormClearHelper-DtwjWakY-CxfcniD6.js";import{a as Qe}from"./createDownloadLinkElement-CbRjLJ8e-NbV49OP9.js";import{i as Ze,o as er}from"./FileDownload.esm-ORp-UC-S-BrsUfuH5.js";var fe=t.forwardRef(function(e,r){var i={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(J,K({iconAttrs:i,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("g",{fill:"none"},t.createElement("rect",{width:24,height:24}),t.createElement("rect",{width:24,height:24}),t.createElement("rect",{width:24,height:24})),t.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"}),t.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"}))});fe.displayName="Mic";var ge=t.forwardRef(function(e,r){var i={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(J,K({iconAttrs:i,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("rect",{width:24,height:24,fill:"none"}),t.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"}))});ge.displayName="Pause";var we=t.forwardRef(function(e,r){var i={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(J,K({iconAttrs:i,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("rect",{width:24,height:24,fill:"none"}),t.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"}))});we.displayName="PlayArrow";var pe=t.forwardRef(function(e,r){var i={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(J,K({iconAttrs:i,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),t.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"}))});pe.displayName="Refresh";var me=t.forwardRef(function(e,r){var i={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(J,K({iconAttrs:i,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("g",{fill:"none"},t.createElement("rect",{width:24,height:24}),t.createElement("rect",{width:24,height:24})),t.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"}))});me.displayName="StopCircle";async function rr(e,r=16e3){if(!e||e.size===0)throw new Error("Invalid or empty blob provided");if(!window.AudioContext)throw new Error("AudioContext not supported in this browser");const i=new AudioContext;try{const n=await e.arrayBuffer(),a=await i.decodeAudioData(n),d=r??a.sampleRate,f=await tr(a,d);return nr(f,d)}finally{i.close()}}async function tr(e,r){const{duration:i,numberOfChannels:n,sampleRate:a}=e,d=Math.ceil(i*r);if(!window.OfflineAudioContext)throw new Error("OfflineAudioContext not supported");const f=new OfflineAudioContext(1,d,r),g=f.createBufferSource();if(g.buffer=e,n>1){const m=f.createChannelSplitter(n),u=f.createChannelMerger(1);g.connect(m);for(let s=0;s<n;s++){const o=f.createGain();o.gain.value=1/n,m.connect(o,s),o.connect(u,0,0)}u.connect(f.destination)}else g.connect(f.destination);g.start(0);try{return await f.startRendering()}catch(m){throw new Error(`Failed to resample audio from ${a}Hz to ${r}Hz: ${m instanceof Error?m.message:String(m)}`)}}function nr(e,r){const i=e.length,n=i*2+44,a=new ArrayBuffer(n),d=new DataView(a),f=e.getChannelData(0),g=(u,s)=>{for(let o=0;o<s.length;o++)d.setUint8(u+o,s.charCodeAt(o))};g(0,"RIFF"),d.setUint32(4,n-8,!0),g(8,"WAVE"),g(12,"fmt "),d.setUint32(16,16,!0),d.setUint16(20,1,!0),d.setUint16(22,1,!0),d.setUint32(24,r,!0),d.setUint32(28,r*2,!0),d.setUint16(32,2,!0),d.setUint16(34,16,!0),g(36,"data"),d.setUint32(40,i*2,!0);let m=44;for(let u=0;u<i;u++){const s=Math.max(-1,Math.min(1,f[u]));d.setInt16(m,s*32767,!0),m+=2}return new Blob([a],{type:"audio/wav"})}class de{constructor(){this.wavesurfer=null,this.currentBlobUrl=null,this.events={},this.isPlaying=!1}initialize(r){this.wavesurfer=r,this.setupEventListeners()}setupEventListeners(){this.wavesurfer&&(this.teardownEventListeners(),this.handleTimeUpdate=r=>{this.events.onTimeUpdate?.(r*1e3)},this.handlePause=()=>{this.isPlaying=!1,this.events.onPause?.()},this.handlePlay=()=>{this.isPlaying=!0,this.events.onPlay?.()},this.handleFinish=()=>{this.isPlaying=!1,this.events.onFinish?.()},this.handleReady=()=>{this.events.onReady?.()},this.handleError=r=>{const i=r instanceof Error?r:new Error(String(r));this.events.onError?.(i)},this.wavesurfer.on("timeupdate",this.handleTimeUpdate),this.wavesurfer.on("pause",this.handlePause),this.wavesurfer.on("play",this.handlePlay),this.wavesurfer.on("finish",this.handleFinish),this.wavesurfer.on("ready",this.handleReady),this.wavesurfer.on("error",this.handleError))}setEventHandlers(r){this.events=r}async load(r){if(!this.wavesurfer)throw new Error("WaveSurfer not initialized");this.cleanupPreviousUrl();let i,n=null;try{if(r instanceof Blob)n=URL.createObjectURL(r),i=n;else if(r instanceof ArrayBuffer){const a=new Blob([r]);n=URL.createObjectURL(a),i=n}else i=r;this.currentBlobUrl=n,await this.wavesurfer.load(i)}catch(a){throw this.cleanupPreviousUrl(),a}}async play(){if(!this.wavesurfer)throw new Error("WaveSurfer not initialized");await this.wavesurfer.play()}pause(){this.wavesurfer&&this.wavesurfer.pause()}getDuration(){return this.wavesurfer?this.wavesurfer.getDuration()*1e3:0}getCurrentTime(){return this.wavesurfer?this.wavesurfer.getCurrentTime()*1e3:0}getIsPlaying(){return this.isPlaying}seekToStart(){this.wavesurfer&&this.wavesurfer.seekTo(0)}cleanupPreviousUrl(){this.currentBlobUrl&&(URL.revokeObjectURL(this.currentBlobUrl),this.currentBlobUrl=null)}destroy(){this.pause(),this.cleanupPreviousUrl(),this.wavesurfer&&(this.teardownEventListeners(),this.wavesurfer.empty(),this.wavesurfer=null),this.events={},this.isPlaying=!1,this.handleTimeUpdate=void 0,this.handlePause=void 0,this.handlePlay=void 0,this.handleFinish=void 0,this.handleReady=void 0,this.handleError=void 0}teardownEventListeners(){this.wavesurfer&&(this.handleTimeUpdate&&(this.wavesurfer.un("timeupdate",this.handleTimeUpdate),this.handleTimeUpdate=void 0),this.handlePause&&(this.wavesurfer.un("pause",this.handlePause),this.handlePause=void 0),this.handlePlay&&(this.wavesurfer.un("play",this.handlePlay),this.handlePlay=void 0),this.handleFinish&&(this.wavesurfer.un("finish",this.handleFinish),this.handleFinish=void 0),this.handleReady&&(this.wavesurfer.un("ready",this.handleReady),this.handleReady=void 0),this.handleError&&(this.wavesurfer.un("error",this.handleError),this.handleError=void 0))}}class ir{constructor(r={}){this.wavesurfer=null,this.recordPlugin=null,this.isRecording=!1,this.recordEndResolve=null,this.recordEndReject=null,this.events={},this.options=r}initialize(r,i){this.wavesurfer=r;try{const n={renderRecordedAudio:!1,mimeType:"audio/webm"};this.recordPlugin=r.registerPlugin(i.create(n)),this.setupEventListeners()}catch(n){const a=n instanceof Error?n:new Error(String(n));throw a.name==="NotAllowedError"||a.name==="PermissionDeniedError"?(this.events.onPermissionDenied?.(),new Error("Microphone permission denied")):(this.events.onError?.(a),a)}}setupEventListeners(){this.recordPlugin&&(this.recordPlugin.on("record-start",()=>{this.isRecording=!0,this.events.onRecordStart?.()}),this.recordPlugin.on("record-end",r=>{this.isRecording=!1,this.events.onRecordEnd?.(r),this.recordEndResolve&&r&&r.size>0?(this.recordEndResolve(r),this.recordEndResolve=null,this.recordEndReject=null):this.recordEndReject?(this.recordEndReject(new Error("Invalid or empty recording")),this.recordEndResolve=null,this.recordEndReject=null):(this.recordEndResolve=null,this.recordEndReject=null)}),this.recordPlugin.on("record-progress",r=>{this.events.onRecordProgress?.(r)}))}setEventHandlers(r){this.events=r}async startRecording(){if(!this.recordPlugin)throw new Error("Record plugin not initialized");if(this.isRecording)return;const r=typeof this.options.sampleRate=="number"?this.options.sampleRate:void 0,i={};r!==void 0&&(i.sampleRate={ideal:r}),await this.startRecordingWithConstraints(i,r!==void 0)}async startRecordingWithConstraints(r,i){if(!this.recordPlugin)throw new Error("Record plugin not initialized");try{const n=Object.keys(r).length?r:void 0;await this.recordPlugin.startRecording(n)}catch(n){const a=n instanceof Error?n:new Error(String(n));if(a.name==="NotAllowedError"||a.name==="PermissionDeniedError")throw this.events.onPermissionDenied?.(),new Error("Microphone permission denied");if(i&&(a.name==="OverconstrainedError"||a.name==="NotReadableError")){this.options.sampleRate=void 0,await this.startRecordingWithConstraints({},!1);return}throw this.events.onError?.(a),a}}async stopRecording(){if(!this.recordPlugin||!this.isRecording)throw new Error("Not currently recording");try{return new Promise((r,i)=>{this.recordEndResolve=r,this.recordEndReject=i,this.recordPlugin?.stopRecording()})}catch(r){const i=r instanceof Error?r:new Error(String(r));throw this.events.onError?.(i),i}}cancelRecording(){this.recordPlugin&&this.isRecording&&(this.recordPlugin.stopRecording(),this.isRecording=!1,this.recordEndResolve=null,this.recordEndReject=null)}destroy(){this.cancelRecording(),this.recordPlugin&&(this.recordPlugin.destroy(),this.recordPlugin=null),this.wavesurfer=null,this.events={}}}const ar=4,sr=4,or=8,lr=0,cr=4,dr=16e3;function ur({containerRef:e,sampleRate:r,events:i}){const n=Ve(),[a,d]=t.useState("idle"),[f,g]=t.useState(null),[m,u]=t.useState(!1),s=t.useRef(null),o=t.useRef(null),p=t.useRef(null),h=t.useRef(i||{}),A=t.useRef(!1),R=t.useRef(new Set),y=t.useRef(!1),L=r===void 0?dr:r;t.useEffect(()=>{h.current=i||{}},[i]);const O=t.useCallback(()=>{const c=Array.from(R.current);R.current.clear(),c.forEach(v=>{v.resolve()})},[]),F=t.useCallback(c=>{u(!1);const v=Array.from(R.current);R.current.clear(),v.forEach(b=>{b.reject(c)})},[]),S=t.useCallback(c=>{const v={onPlay:()=>{u(!0),h.current.onPlaybackPlay?.()},onPause:()=>{u(!1),h.current.onPlaybackPause?.()},onFinish:()=>{u(!1),h.current.onPlaybackFinish?.()},onReady:()=>{O()},onError:b=>{u(!1),F(b),h.current.onError?.(b)}};c.setEventHandlers(v)},[O,F]),P=t.useCallback(async()=>{if(!(A.current||!e.current))try{const[c,v]=await Promise.all([se(()=>import("./wavesurfer.esm-CzjpjtNs-CtBzisOM.js"),[]),se(()=>import("./record-DJsfODTt-CK8X1liM.js"),[])]),b=c.default,U=v.default,j=b.create({container:e.current,waveColor:n.colors.primary,progressColor:n.colors.bodyText,height:We(n.sizes.largestElementHeight)-2*cr,barWidth:ar,barGap:sr,barRadius:or,cursorWidth:lr,interact:!0});s.current=j,y.current=!1;const $=new ir({sampleRate:L});$.initialize(j,U),$.setEventHandlers({onRecordProgress:_=>{h.current.onProgressMs?.(_)},onPermissionDenied:()=>{h.current.onPermissionDenied?.(),d("idle")},onError:_=>{h.current.onError?.(_),d("idle")}}),o.current=$;const M=new de;M.initialize(j),p.current=M,S(M),A.current=!0}catch(c){const v=c instanceof Error?c:new Error(String(c));h.current.onError?.(v)}},[e,n,L,S]);t.useEffect(()=>{P();const c=R.current;return()=>{c.clear(),u(!1),o.current&&(o.current.destroy(),o.current=null),p.current&&(p.current.destroy(),p.current=null),s.current&&(s.current.destroy(),s.current=null),A.current=!1,y.current=!1}},[P]),t.useEffect(()=>{const c=s.current;if(c){if(a==="recording"){c.setOptions({waveColor:n.colors.primary,progressColor:n.colors.primary});return}if(y.current){c.setOptions({interact:!0,waveColor:oe(n.colors.fadedText40,n.colors.secondaryBg),progressColor:n.colors.bodyText});return}c.setOptions({waveColor:n.colors.primary,progressColor:n.colors.bodyText})}},[a,n.colors.bodyText,n.colors.fadedText40,n.colors.primary,n.colors.secondaryBg]);const E=t.useCallback(async()=>{if(a!=="recording"){if(A.current||await P(),!o.current)throw new Error("Record backend not initialized");s.current&&s.current.setOptions({waveColor:n.colors.primary,progressColor:n.colors.primary}),y.current=!1,await o.current.startRecording(),d("recording"),g(null),u(!1),h.current.onRecordStart?.()}},[a,P,n.colors.primary]),X=t.useCallback(()=>{p.current&&s.current&&(p.current.destroy(),p.current=new de,p.current.initialize(s.current),R.current.clear(),u(!1),S(p.current)),y.current=!1},[S]),V=t.useCallback(()=>{p.current?.seekToStart(),u(!1),y.current=!0,s.current&&s.current.setOptions({interact:!0,waveColor:oe(n.colors.fadedText40,n.colors.secondaryBg),progressColor:n.colors.bodyText})},[n.colors.bodyText,n.colors.fadedText40,n.colors.secondaryBg]),k=t.useCallback(async()=>{if(a!=="recording")throw new Error("Not currently recording");if(!o.current||!p.current)throw new Error("Backends not initialized");try{const c=await o.current.stopRecording();return g(c),await new Promise((v,b)=>{if(!p.current){b(new Error("Player not initialized"));return}const U={resolve:()=>{R.current.delete(U),v()},reject:j=>{R.current.delete(U),b(j)}};R.current.add(U),p.current.load(c).catch(j=>{R.current.delete(U),b(j instanceof Error?j:new Error(String(j)))})}),d("idle"),u(!1),V(),h.current.onRecordReady?.(c),c}catch(c){const v=c instanceof Error?c:new Error(String(c));throw u(!1),v}},[a,V]),D=t.useCallback(async c=>{const v=c??f;if(!v)throw new Error("No recorded audio to approve");try{const b=await rr(v,L);h.current.onApprove?.(b),g(null),d("idle")}catch(b){const U=b instanceof Error?b:new Error(String(b));throw h.current.onError?.(U),U}},[f,L]),N=t.useCallback(()=>{a==="recording"&&o.current?.cancelRecording(),X(),g(null),d("idle"),u(!1),y.current=!1,h.current.onCancel?.()},[a,X]),z={isPlaying:t.useCallback(()=>p.current?.getIsPlaying()??!1,[]),play:t.useCallback(async()=>{if(!p.current)throw new Error("Player not initialized");await p.current.play()},[]),pause:t.useCallback(()=>{p.current?.pause()},[]),load:t.useCallback(async c=>{if(A.current||await P(),!p.current)throw new Error("Player not initialized");await p.current.load(c),V()},[V,P]),getCurrentTimeMs:t.useCallback(()=>p.current?.getCurrentTime()??0,[]),getDurationMs:t.useCallback(()=>p.current?.getDuration()??0,[])},Y=t.useCallback(c=>{h.current=c},[]);return{state:a,isPlaybackPlaying:m,start:E,stop:k,approve:D,cancel:N,playback:z,setEventHandlers:Y}}const hr=(e,r)=>{const{libConfig:{enforceDownloadInNewTab:i=!1}}=t.useContext($e);return t.useCallback(()=>{if(!e)return;const n=Qe({enforceDownloadInNewTab:i,url:e,filename:r});n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n)},[e,i,r])},Q=({widgetMgr:e,id:r,formId:i,key:n,defaultValue:a})=>{t.useEffect(()=>{const s=e.getElementState(r,n);he(s)&&H(a)&&e.setElementState(r,n,a)},[e,r,n,a]);const[d,f]=t.useState(e.getElementState(r,n)??a),g=t.useCallback(s=>{e.setElementState(r,n,s),f(s)},[e,r,n]),m=t.useMemo(()=>({formId:i||""}),[i]),u=t.useCallback(()=>g(a),[a,g]);return qe({element:m,widgetMgr:e,onFormCleared:u}),[d,g]},fr=async({files:e,uploadClient:r,widgetMgr:i,widgetInfo:n,fragmentId:a,signal:d})=>{let f=[];try{f=await r.fetchFileURLs(e)}catch(s){return{successfulUploads:[],failedUploads:e.map(o=>({file:o,error:le(s)}))}}const g=Oe(e,f),m=[],u=[];return await Promise.all(g.map(async([s,o])=>{if(!s||!o?.uploadUrl||!o.fileId)return{file:s,fileUrl:o,error:new Error("No upload URL found")};try{await r.uploadFile({id:o.fileId,formId:n.formId||""},o.uploadUrl,s,void 0,d),m.push({fileUrl:o,file:s})}catch(p){const h=le(p);u.push({file:s,error:h})}})),i.setFileUploaderStateValue(n,new De({uploadedFileInfo:m.map(({file:s,fileUrl:o})=>new Ne({fileId:o.fileId,fileUrls:o,name:s.webkitRelativePath||s.name,size:s.size}))}),{fromUi:!0},a),{successfulUploads:m,failedUploads:u}},gr=C("div",{target:"e12wn80j14"})(""),ue=C("div",{target:"e12wn80j13"})(({theme:e,disabled:r})=>({height:e.sizes.largestElementHeight,width:"100%",background:e.colors.secondaryBg,borderRadius:e.radii.default,marginBottom:e.spacing.twoXS,display:"flex",alignItems:"center",position:"relative",paddingLeft:e.spacing.xs,paddingRight:e.spacing.sm,border:e.colors.widgetBorderColor?`${e.sizes.borderWidth} solid ${e.colors.widgetBorderColor}`:void 0,cursor:r?"not-allowed":"auto",overflow:"hidden"}),""),wr=C("div",{target:"e12wn80j12"})({name:"82a6rk",styles:"flex:1"}),pr=C("div",{target:"e12wn80j11"})(({show:e,theme:r})=>({display:e?"block":"none",position:"relative",height:r.sizes.largestElementHeight,"& > div":{position:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",alignItems:"center"}}),""),mr=C("span",{target:"e12wn80j10"})(({theme:e,isPlayingOrRecording:r,disabled:i})=>({margin:e.spacing.sm,fontFamily:e.fonts.monospace,color:i?e.colors.fadedText40:r?e.colors.bodyText:e.colors.fadedText60,backgroundColor:e.colors.secondaryBg,fontSize:e.fontSizes.sm}),""),ye=C("div",{target:"e12wn80j9"})({name:"1kyw74z",styles:"width:100%;text-align:center;overflow:hidden"}),ve=C("span",{target:"e12wn80j8"})(({theme:e})=>({color:e.colors.bodyText}),""),yr=C("a",{target:"e12wn80j7"})(({theme:e})=>({color:e.colors.link,textDecoration:e.linkUnderline?"underline":"none"}),""),vr=C("div",{target:"e12wn80j6"})(({theme:e})=>({flex:1,height:e.sizes.largestElementHeight,display:"flex",justifyContent:"center",alignItems:"center"}),""),br=C("div",{target:"e12wn80j5"})(({theme:e})=>{const r="0.625em";return{opacity:.2,width:"100%",height:r,backgroundSize:r,backgroundImage:`radial-gradient(${e.colors.fadedText10} 40%, transparent 40%)`,backgroundRepeat:"repeat"}},""),Er=C("span",{target:"e12wn80j4"})(({theme:e})=>({"& > button":{color:e.colors.primary,padding:e.spacing.threeXS},"& > button:hover, & > button:focus":{color:e.colors.redColor}}),""),Rr=C("span",{target:"e12wn80j3"})(({theme:e})=>({"& > button":{padding:e.spacing.threeXS,color:e.colors.fadedText60},"& > button:hover, & > button:focus":{color:e.colors.bodyText}}),""),be=C("span",{target:"e12wn80j2"})(({theme:e})=>({"& > button":{padding:e.spacing.threeXS,color:e.colors.fadedText60},"& > button:hover, & > button:focus":{color:e.colors.bodyText}}),""),Z=C("div",{target:"e12wn80j1"})(({theme:e})=>({display:"flex",justifyContent:"center",alignItems:"center",flexGrow:0,flexShrink:1,padding:e.spacing.xs,gap:e.spacing.twoXS,marginRight:e.spacing.twoXS}),""),Cr=C("div",{target:"e12wn80j0"})(({theme:e})=>({marginLeft:e.spacing.sm}),""),G=({onClick:e,disabled:r,ariaLabel:i,iconContent:n})=>l.jsx(Xe,{kind:Ge.BORDERLESS_ICON,onClick:e,disabled:r,"aria-label":i,containerWidth:!0,"data-testid":"stAudioInputActionButton",children:l.jsx(Je,{content:n,size:"lg",color:"inherit"})}),Pr=({disabled:e,stopRecording:r})=>l.jsx(Er,{children:l.jsx(G,{onClick:r,disabled:e,ariaLabel:"Stop recording",iconContent:me})}),xr=({disabled:e,isPlaying:r,onClickPlayPause:i})=>l.jsx(be,{children:r?l.jsx(G,{onClick:i,disabled:e,ariaLabel:"Pause",iconContent:ge}):l.jsx(G,{onClick:i,disabled:e,ariaLabel:"Play",iconContent:we})}),kr=({disabled:e,startRecording:r})=>l.jsx(Rr,{children:l.jsx(G,{onClick:r,disabled:e,ariaLabel:"Record",iconContent:fe})}),Ur=({onClick:e})=>l.jsx(be,{children:l.jsx(G,{disabled:!1,onClick:e,ariaLabel:"Reset",iconContent:pe})}),jr=({disabled:e,isRecording:r,isPlaying:i,isUploading:n,isError:a,recordingUrlExists:d,startRecording:f,stopRecording:g,onClickPlayPause:m,onClear:u})=>a?l.jsx(Z,{children:l.jsx(Ur,{onClick:u})}):n?l.jsx(Z,{children:l.jsx(_e,{"aria-label":"Uploading",size:"base",margin:"0",padding:"0"})}):l.jsxs(Z,{children:[r?l.jsx(Pr,{disabled:e,stopRecording:g}):l.jsx(kr,{disabled:e,startRecording:f}),d&&l.jsx(xr,{disabled:e,isPlaying:i,onClickPlayPause:m})]}),Sr=t.memo(jr),Ir=()=>l.jsx(ye,{children:l.jsx(ve,{children:"An error has occurred, please try again."})}),Ar=t.memo(Ir),T="00:00",W=e=>{const r=Math.floor(e/1e3),i=Math.floor(r/60),n=Math.floor(i/60),a=r%60,d=i%60,f=a.toString().padStart(2,"0"),g=d.toString().padStart(2,"0"),m=n.toString().padStart(2,"0");return i<60?`${g}:${f}`:`${m}:${g}:${f}`},Tr=()=>l.jsxs(ye,{children:[l.jsx(ve,{children:"This app would like to use your microphone."})," ",l.jsx(yr,{href:He,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]}),Lr=t.memo(Tr),Fr=()=>l.jsx(vr,{children:l.jsx(br,{})}),Mr=t.memo(Fr),zr=({element:e,uploadClient:r,widgetMgr:i,fragmentId:n,disabled:a})=>{const d=t.useRef(null),[f,g]=t.useState(!1),[m,u]=t.useState(!1),[s,o]=t.useState(!1),[p,h]=t.useState(T),[A,R]=Q({widgetMgr:i,id:e.id,key:"deleteFileUrl",defaultValue:null}),[y,L]=Q({widgetMgr:i,id:e.id,key:"recordingUrl",defaultValue:null}),[O,F]=Q({widgetMgr:i,id:e.id,formId:e.formId,key:"recordingTime",defaultValue:T}),S=t.useRef(null),P=t.useRef(null),E=t.useRef(null),X=t.useRef(),V=e.id,k=e.formId,D=ur({containerRef:d,sampleRate:e.sampleRate??void 0,events:{onPermissionDenied:()=>{g(!0)},onError:()=>{o(!0)},onRecordStart:()=>{F(T),h(T)},onRecordReady:()=>{const w=W(D.playback.getDurationMs());F(w),h(w)},onApprove:w=>{X.current?.(w)},onCancel:()=>{F(T),h(T)},onProgressMs:w=>{F(W(w))},onPlaybackPause:()=>{h(W(D.playback.getCurrentTimeMs()))},onPlaybackFinish:()=>{h(W(D.playback.getDurationMs()))}}}),{state:N,isPlaybackPlaying:z,start:Y,stop:c,approve:v,cancel:b,playback:{play:U,pause:j,load:$,getCurrentTimeMs:M,getDurationMs:_}}=D,Ee=t.useCallback(async w=>{S.current&&S.current.abort();const x=new AbortController;S.current=x;try{if(u(!0),H(k)&&i.setFormsWithUploadsInProgress(new Set([k])),x.signal.aborted)return;let I;try{I=URL.createObjectURL(w),P.current&&P.current!==I&&URL.revokeObjectURL(P.current),P.current=I}catch{o(!0),u(!1),H(k)&&i.setFormsWithUploadsInProgress(new Set);return}if(x.signal.aborted){URL.revokeObjectURL(I),P.current=null;return}L(I);const Ie=new Date().toISOString().slice(0,16).replace(/:/g,"-"),Ae=new File([w],`${Ie}_audio.wav`,{type:w.type});try{const{successfulUploads:Te,failedUploads:Le}=await fr({files:[Ae],uploadClient:r,widgetMgr:i,widgetInfo:{id:V,formId:k},fragmentId:n,signal:x.signal});if(x.signal.aborted)return;if(Le.length>0){o(!0);return}o(!1);const ae=Te[0];ae?.fileUrl?.deleteUrl&&R(ae.fileUrl.deleteUrl)}catch{x.signal.aborted||o(!0)}finally{H(k)&&i.setFormsWithUploadsInProgress(new Set),x.signal.aborted||u(!1)}}catch{x.signal.aborted||(o(!0),u(!1)),H(k)&&i.setFormsWithUploadsInProgress(new Set)}},[r,i,V,k,n,R,L]);X.current=Ee;const B=t.useCallback(async({updateWidgetManager:w,deleteFile:x})=>{const I=y;if(I&&P.current===I&&(URL.revokeObjectURL(I),P.current=null),E.current&&(cancelAnimationFrame(E.current),E.current=null),L(null),R(null),h(T),F(T),b(),w&&i.setFileUploaderStateValue(e,{},{fromUi:!0},n),x&&A)try{await r.deleteFile(A)}catch{}H(I)&&URL.revokeObjectURL(I)},[A,y,r,b,e,i,n,F,R,L]);t.useEffect(()=>{const w=()=>{z&&(h(W(M())),E.current=requestAnimationFrame(w))};return z?E.current=requestAnimationFrame(w):E.current&&(cancelAnimationFrame(E.current),E.current=null),()=>{E.current&&(cancelAnimationFrame(E.current),E.current=null)}},[z,M]),t.useEffect(()=>{if(!y)return;let w=!1;return h(O),(async()=>{try{if(await $(y),w)return;const x=_();x>0&&h(W(x))}catch{w||o(!0)}})(),()=>{w=!0}},[y,O,$,_]),t.useEffect(()=>{if(he(k))return;const w=new Ye;return w.manageFormClearListener(i,k,()=>{B({updateWidgetManager:!0,deleteFile:!1})}),()=>w.disconnect()},[k,B,i]),t.useEffect(()=>()=>{S.current&&(S.current.abort(),S.current=null),E.current&&(cancelAnimationFrame(E.current),E.current=null)},[]);const Re=t.useCallback(async()=>{try{if(z){const w=M();j(),h(W(w))}else N==="idle"&&y&&(M()<=100&&h(T),await U())}catch{o(!0)}},[z,M,j,U,y,N]),ee=t.useCallback(async()=>{y&&await B({updateWidgetManager:!1,deleteFile:!0});try{h(T),await Y()}catch{}},[B,y,Y]),re=t.useCallback(async()=>{try{const w=await c();await v(w)}catch{o(!0)}},[v,c]),te=hr(y,"recording.wav"),Ce=t.useCallback(()=>{ee()},[ee]),Pe=t.useCallback(()=>{re()},[re]),xe=t.useCallback(()=>{B({updateWidgetManager:!1,deleteFile:!0}),o(!1)},[B]),ke=t.useCallback(()=>{te()},[te]),Ue=t.useCallback(()=>{B({updateWidgetManager:!0,deleteFile:!0})},[B]),q=N==="recording",ne=z,je=q?O:p,ie=N==="idle"&&!f&&!y,Se=f||ie||s;return l.jsxs(gr,{className:"stAudioInput","data-testid":"stAudioInput",children:[l.jsx(Fe,{label:e.label,disabled:a,labelVisibility:Me(e.labelVisibility?.value),children:e.help&&l.jsx(Cr,{children:l.jsx(ze,{content:e.help,placement:Be.TOP})})}),l.jsxs(ue,{disabled:a,children:[l.jsxs(Ke,{isFullScreen:!1,disableFullscreenMode:!0,target:ue,children:[y&&l.jsx(ce,{label:"Download as WAV",icon:Ze,onClick:ke}),A&&l.jsx(ce,{label:"Clear recording",icon:er,onClick:Ue})]}),l.jsx(Sr,{isRecording:q,isPlaying:ne,isUploading:m,isError:s,recordingUrlExists:!!y,startRecording:Ce,stopRecording:Pe,onClickPlayPause:()=>void Re(),onClear:xe,disabled:a||f}),l.jsxs(wr,{children:[s&&l.jsx(Ar,{}),ie&&l.jsx(Mr,{}),f&&l.jsx(Lr,{}),l.jsx(pr,{"data-testid":"stAudioInputWaveSurfer",ref:d,show:!Se})]}),l.jsx(mr,{isPlayingOrRecording:q||ne,disabled:a,"data-testid":"stAudioInputWaveformTimeCode",children:je})]})]})},Nr=t.memo(zr);export{Nr as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as U,bp as ce,v as J,m as de,j as L,aH as pe,aI as fe,b1 as ge,aJ as ye,ap as be,bx as me,c as ie,c8 as ve,c9 as he,ca as Se,bV as Oe,cb as je,by as Pe,aY as Ce,bU as Ie,cc as we,cd as Te,ce as Ee,cf as xe,cg as De,bD as Re,aC as Y,ch as $e}from"./index-
|
|
1
|
+
import{r as U,bp as ce,v as J,m as de,j as L,aH as pe,aI as fe,b1 as ge,aJ as ye,ap as be,bx as me,c as ie,c8 as ve,c9 as he,ca as Se,bV as Oe,cb as je,by as Pe,aY as Ce,bU as Ie,cc as we,cd as Te,ce as Ee,cf as xe,cg as De,bD as Re,aC as Y,ch as $e}from"./index-BvblFOYP.js";import{B as Be}from"./useBasicWidgetState-BTyLgyXa-DI96f9E0.js";import{w as _e}from"./timepicker-CkLW19xP-CTuglWU6.js";import"./FormClearHelper-DtwjWakY-CxfcniD6.js";import"./inherits-CYghrBFU-Cf4k8aUQ.js";import"./createSuper-BlgWzn8_-h1vcwEzv.js";var ke=Re.Consumer;const Ne=Object.freeze(Object.defineProperty({__proto__:null,ThemeConsumer:ke,ThemeProvider:De,createThemedStyled:xe,createThemedUseStyletron:Ee,createThemedWithStyle:Te,expandBorderStyles:we,hexToRgb:Ie,styled:Ce,useStyletron:Pe,withStyle:je,withWrapper:Oe},Symbol.toStringTag,{value:"Module"}));var P={};const G=Se(Ne);var x={},X;function ze(){if(X)return x;X=1,Object.defineProperty(x,"__esModule",{value:!0}),x.STATE_CHANGE_TYPE=x.SIZE=x.ENHANCER_POSITION=x.CUSTOM_INPUT_TYPE=x.ADJOINED=void 0;var f={change:"change"};x.STATE_CHANGE_TYPE=f;var d={textarea:"textarea"};x.CUSTOM_INPUT_TYPE=d;var h={none:"none",left:"left",right:"right",both:"both"};x.ADJOINED=h;var b={mini:"mini",default:"default",compact:"compact",large:"large"};x.SIZE=b;var v={start:"start",end:"end"};return x.ENHANCER_POSITION=v,x}var F={},$={},H={},K;function Me(){if(K)return H;K=1,Object.defineProperty(H,"__esModule",{value:!0}),H.default=d;function f(b){"@babel/helpers - typeof";return f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(v){return typeof v}:function(v){return v&&typeof Symbol=="function"&&v.constructor===Symbol&&v!==Symbol.prototype?"symbol":typeof v},f(b)}function d(b){b=b||{};for(var v=arguments.length<=1?0:arguments.length-1,m,y,O=0;O<v;O++){m=(O+1<1||arguments.length<=O+1?void 0:arguments[O+1])||{};for(var g in m)f(m[g])!==void 0&&(y=m[g],h(y)?b[g]=d(b[g]||Array.isArray(y)&&[]||{},y):b[g]=y)}return b}function h(b){return Array.isArray(b)||{}.toString.call(b)=="[object Object]"}return H}var Q;function ae(){if(Q)return $;Q=1,Object.defineProperty($,"__esModule",{value:!0}),$.getOverride=E,$.getOverrideProps=w,$.getOverrides=z,$.mergeConfigurationOverrides=k,$.mergeOverride=R,$.mergeOverrides=_,$.toObjectOverride=D,$.useOverrides=M;var f=m(Y),d=$e(),h=b(Me());function b(i){return i&&i.__esModule?i:{default:i}}function v(i){if(typeof WeakMap!="function")return null;var r=new WeakMap,u=new WeakMap;return(v=function(s){return s?u:r})(i)}function m(i,r){if(i&&i.__esModule)return i;if(i===null||C(i)!=="object"&&typeof i!="function")return{default:i};var u=v(r);if(u&&u.has(i))return u.get(i);var s={},t=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in i)if(a!=="default"&&Object.prototype.hasOwnProperty.call(i,a)){var l=t?Object.getOwnPropertyDescriptor(i,a):null;l&&(l.get||l.set)?Object.defineProperty(s,a,l):s[a]=i[a]}return s.default=i,u&&u.set(i,s),s}function y(){return y=Object.assign?Object.assign.bind():function(i){for(var r=1;r<arguments.length;r++){var u=arguments[r];for(var s in u)Object.prototype.hasOwnProperty.call(u,s)&&(i[s]=u[s])}return i},y.apply(this,arguments)}function O(i,r){var u=Object.keys(i);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);r&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(i,t).enumerable})),u.push.apply(u,s)}return u}function g(i){for(var r=1;r<arguments.length;r++){var u=arguments[r]!=null?arguments[r]:{};r%2?O(Object(u),!0).forEach(function(s){I(i,s,u[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(u)):O(Object(u)).forEach(function(s){Object.defineProperty(i,s,Object.getOwnPropertyDescriptor(u,s))})}return i}function I(i,r,u){return r in i?Object.defineProperty(i,r,{value:u,enumerable:!0,configurable:!0,writable:!0}):i[r]=u,i}function C(i){"@babel/helpers - typeof";return C=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},C(i)}function E(i){return(0,d.isValidElementType)(i)?i:i&&C(i)==="object"?i.component:i}function w(i){return i&&C(i)==="object"?C(i.props)==="object"?g(g({},i.props),{},{$style:i.style}):{$style:i.style}:{}}function D(i){return(0,d.isValidElementType)(i)?{component:i}:i||{}}function z(i,r){var u=E(i)||r;if(i&&C(i)==="object"&&typeof i.props=="function"){var s=f.forwardRef(function(a,l){var e=i.props(a),n=w(g(g({},i),{},{props:e}));return f.createElement(u,y({ref:l},n))});return s.displayName=u.displayName,[s,{}]}var t=w(i);return[u,t]}function _(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},u=Object.assign({},i,r),s=Object.keys(u);return s.reduce(function(t,a){return t[a]=R(D(i[a]),D(r[a])),t},{})}function R(i,r){var u=g(g({},i),r);return i.props&&r.props&&(u.props=k(i.props,r.props)),i.style&&r.style&&(u.style=k(i.style,r.style)),u}function k(i,r){return C(i)==="object"&&C(r)==="object"?(0,h.default)({},i,r):function(){return(0,h.default)({},typeof i=="function"?i.apply(void 0,arguments):i,typeof r=="function"?r.apply(void 0,arguments):r)}}function M(i){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return f.useMemo(function(){return Object.keys(i).reduce(function(u,s){return u[s]=z(r[s],i[s]),u},{})},[r])}return $}var Z={},A={},ee;function Le(){if(ee)return A;ee=1,Object.defineProperty(A,"__esModule",{value:!0}),A.Svg=void 0,A.getSvgStyles=d;var f=G;function d(b){var v=b.$theme,m=b.$size,y=b.$color,O=v.sizing.scale600;m&&(v.sizing[m]?O=v.sizing[m]:typeof m=="number"?O="".concat(m,"px"):O=m);var g="currentColor";return y&&(v.colors[y]?g=v.colors[y]:g=y),{display:"inline-block",fill:g,color:g,height:O,width:O}}var h=(0,f.styled)("svg",d);return A.Svg=h,h.displayName="Svg",h.displayName="Svg",A}var V={},te;function We(){if(te)return V;te=1,Object.defineProperty(V,"__esModule",{value:!0}),V.default=f;function f(d){var h={};for(var b in d)b[0]!=="$"&&(h[b]=d[b]);return h}return V}var re;function Ae(){if(re)return Z;re=1;function f(t){"@babel/helpers - typeof";return f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},f(t)}Object.defineProperty(Z,"__esModule",{value:!0}),Z.default=void 0;var d=g(Y),h=ae(),b=Le(),v=y(We()),m=["children","title","size","color","overrides"];function y(t){return t&&t.__esModule?t:{default:t}}function O(t){if(typeof WeakMap!="function")return null;var a=new WeakMap,l=new WeakMap;return(O=function(e){return e?l:a})(t)}function g(t,a){if(t&&t.__esModule)return t;if(t===null||f(t)!=="object"&&typeof t!="function")return{default:t};var l=O(a);if(l&&l.has(t))return l.get(t);var e={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in t)if(o!=="default"&&Object.prototype.hasOwnProperty.call(t,o)){var p=n?Object.getOwnPropertyDescriptor(t,o):null;p&&(p.get||p.set)?Object.defineProperty(e,o,p):e[o]=t[o]}return e.default=t,l&&l.set(t,e),e}function I(){return I=Object.assign?Object.assign.bind():function(t){for(var a=1;a<arguments.length;a++){var l=arguments[a];for(var e in l)Object.prototype.hasOwnProperty.call(l,e)&&(t[e]=l[e])}return t},I.apply(this,arguments)}function C(t,a){var l=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);a&&(e=e.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),l.push.apply(l,e)}return l}function E(t){for(var a=1;a<arguments.length;a++){var l=arguments[a]!=null?arguments[a]:{};a%2?C(Object(l),!0).forEach(function(e){w(t,e,l[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(l)):C(Object(l)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(l,e))})}return t}function w(t,a,l){return a in t?Object.defineProperty(t,a,{value:l,enumerable:!0,configurable:!0,writable:!0}):t[a]=l,t}function D(t,a){return M(t)||k(t,a)||_(t,a)||z()}function z(){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 _(t,a){if(t){if(typeof t=="string")return R(t,a);var l=Object.prototype.toString.call(t).slice(8,-1);if(l==="Object"&&t.constructor&&(l=t.constructor.name),l==="Map"||l==="Set")return Array.from(t);if(l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return R(t,a)}}function R(t,a){(a==null||a>t.length)&&(a=t.length);for(var l=0,e=new Array(a);l<a;l++)e[l]=t[l];return e}function k(t,a){var l=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(l!=null){var e=[],n=!0,o=!1,p,c;try{for(l=l.call(t);!(n=(p=l.next()).done)&&(e.push(p.value),!(a&&e.length===a));n=!0);}catch(S){o=!0,c=S}finally{try{!n&&l.return!=null&&l.return()}finally{if(o)throw c}}return e}}function M(t){if(Array.isArray(t))return t}function i(t,a){if(t==null)return{};var l=r(t,a),e,n;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)e=o[n],!(a.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(l[e]=t[e])}return l}function r(t,a){if(t==null)return{};var l={},e=Object.keys(t),n,o;for(o=0;o<e.length;o++)n=e[o],!(a.indexOf(n)>=0)&&(l[n]=t[n]);return l}var u=function(t,a){var l=t.children,e=t.title,n=t.size,o=t.color,p=t.overrides,c=p===void 0?{}:p,S=i(t,m),j=(0,h.getOverrides)(c.Svg,b.Svg),B=D(j,2),T=B[0],N=B[1],W=T.__STYLETRON__?E(E({title:e,$color:o,$size:n},S),N):E(E({title:e,color:o,size:n},(0,v.default)(S)),(0,v.default)(N));return d.createElement(T,I({"data-baseweb":"icon",ref:a},W),e?d.createElement("title",null,e):null,l)},s=d.forwardRef(u);return Z.default=s,Z}var ne;function Fe(){if(ne)return F;ne=1;function f(r){"@babel/helpers - typeof";return f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(u){return typeof u}:function(u){return u&&typeof Symbol=="function"&&u.constructor===Symbol&&u!==Symbol.prototype?"symbol":typeof u},f(r)}Object.defineProperty(F,"__esModule",{value:!0}),F.default=void 0;var d=g(Y),h=G,b=ae(),v=y(Ae()),m=["title","size","color","overrides"];function y(r){return r&&r.__esModule?r:{default:r}}function O(r){if(typeof WeakMap!="function")return null;var u=new WeakMap,s=new WeakMap;return(O=function(t){return t?s:u})(r)}function g(r,u){if(r&&r.__esModule)return r;if(r===null||f(r)!=="object"&&typeof r!="function")return{default:r};var s=O(u);if(s&&s.has(r))return s.get(r);var t={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in r)if(l!=="default"&&Object.prototype.hasOwnProperty.call(r,l)){var e=a?Object.getOwnPropertyDescriptor(r,l):null;e&&(e.get||e.set)?Object.defineProperty(t,l,e):t[l]=r[l]}return t.default=r,s&&s.set(r,t),t}function I(){return I=Object.assign?Object.assign.bind():function(r){for(var u=1;u<arguments.length;u++){var s=arguments[u];for(var t in s)Object.prototype.hasOwnProperty.call(s,t)&&(r[t]=s[t])}return r},I.apply(this,arguments)}function C(r,u){if(r==null)return{};var s=E(r,u),t,a;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(r);for(a=0;a<l.length;a++)t=l[a],!(u.indexOf(t)>=0)&&Object.prototype.propertyIsEnumerable.call(r,t)&&(s[t]=r[t])}return s}function E(r,u){if(r==null)return{};var s={},t=Object.keys(r),a,l;for(l=0;l<t.length;l++)a=t[l],!(u.indexOf(a)>=0)&&(s[a]=r[a]);return s}function w(r,u){return k(r)||R(r,u)||z(r,u)||D()}function D(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
3
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function z(r,u){if(r){if(typeof r=="string")return _(r,u);var s=Object.prototype.toString.call(r).slice(8,-1);if(s==="Object"&&r.constructor&&(s=r.constructor.name),s==="Map"||s==="Set")return Array.from(r);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return _(r,u)}}function _(r,u){(u==null||u>r.length)&&(u=r.length);for(var s=0,t=new Array(u);s<u;s++)t[s]=r[s];return t}function R(r,u){var s=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(s!=null){var t=[],a=!0,l=!1,e,n;try{for(s=s.call(r);!(a=(e=s.next()).done)&&(t.push(e.value),!(u&&t.length===u));a=!0);}catch(o){l=!0,n=o}finally{try{!a&&s.return!=null&&s.return()}finally{if(l)throw n}}return t}}function k(r){if(Array.isArray(r))return r}function M(r,u){var s=(0,h.useStyletron)(),t=w(s,2),a=t[1],l=r.title,e=l===void 0?"Delete Alt":l,n=r.size,o=r.color,p=r.overrides,c=p===void 0?{}:p,S=C(r,m),j=(0,b.mergeOverride)({component:a.icons&&a.icons.DeleteAlt?a.icons.DeleteAlt:null},c&&c.Svg?(0,b.toObjectOverride)(c.Svg):{});return d.createElement(v.default,I({viewBox:"0 0 24 24",ref:u,title:e,size:n,color:o,overrides:{Svg:j}},S),d.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 20C16.4183 20 20 16.4183 20 12C20 7.58173 16.4183 4 12 4C7.58173 4 4 7.58173 4 12C4 16.4183 7.58173 20 12 20ZM10.0303 8.96967C9.73743 8.67679 9.26257 8.67679 8.96967 8.96967C8.67676 9.26257 8.67676 9.73743 8.96967 10.0303L10.9393 12L8.96967 13.9697C8.67676 14.2626 8.67676 14.7374 8.96967 15.0303C9.26257 15.3232 9.73743 15.3232 10.0303 15.0303L12 13.0607L13.9697 15.0303C14.2626 15.3232 14.7374 15.3232 15.0303 15.0303C15.3232 14.7374 15.3232 14.2626 15.0303 13.9697L13.0607 12L15.0303 10.0303C15.3232 9.73743 15.3232 9.26257 15.0303 8.96967C14.7374 8.67679 14.2626 8.67679 13.9697 8.96967L12 10.9393L10.0303 8.96967Z"}))}var i=d.forwardRef(M);return F.default=i,F}var oe;function Ze(){if(oe)return P;oe=1,Object.defineProperty(P,"__esModule",{value:!0}),P.getRootStyles=P.getInputStyles=P.getInputContainerStyles=P.StyledMaskToggleButton=P.StyledClearIconContainer=P.StyledClearIcon=P.Root=P.InputEnhancer=P.InputContainer=P.Input=void 0;var f=G,d=ze(),h=b(Fe());function b(e){return e&&e.__esModule?e:{default:e}}function v(e,n){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);n&&(p=p.filter(function(c){return Object.getOwnPropertyDescriptor(e,c).enumerable})),o.push.apply(o,p)}return o}function m(e){for(var n=1;n<arguments.length;n++){var o=arguments[n]!=null?arguments[n]:{};n%2?v(Object(o),!0).forEach(function(p){y(e,p,o[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):v(Object(o)).forEach(function(p){Object.defineProperty(e,p,Object.getOwnPropertyDescriptor(o,p))})}return e}function y(e,n,o){return n in e?Object.defineProperty(e,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[n]=o,e}var O=(0,f.styled)("button",function(e){var n,o=e.$theme,p=e.$size,c=e.$isFocusVisible,S=(n={},y(n,d.SIZE.mini,o.sizing.scale400),y(n,d.SIZE.compact,o.sizing.scale400),y(n,d.SIZE.default,o.sizing.scale300),y(n,d.SIZE.large,o.sizing.scale200),n)[p];return{display:"flex",alignItems:"center",borderTopStyle:"none",borderBottomStyle:"none",borderLeftStyle:"none",borderRightStyle:"none",background:"none",paddingLeft:S,paddingRight:S,outline:c?"solid 3px ".concat(o.colors.accent):"none",color:o.colors.contentPrimary}});P.StyledMaskToggleButton=O,O.displayName="StyledMaskToggleButton",O.displayName="StyledMaskToggleButton";var g=(0,f.styled)("div",function(e){var n,o=e.$alignTop,p=o===void 0?!1:o,c=e.$size,S=e.$theme,j=(n={},y(n,d.SIZE.mini,S.sizing.scale200),y(n,d.SIZE.compact,S.sizing.scale200),y(n,d.SIZE.default,S.sizing.scale100),y(n,d.SIZE.large,S.sizing.scale0),n)[c];return{display:"flex",alignItems:p?"flex-start":"center",paddingLeft:j,paddingRight:j,paddingTop:p?S.sizing.scale500:"0px",color:S.colors.contentPrimary}});P.StyledClearIconContainer=g,g.displayName="StyledClearIconContainer",g.displayName="StyledClearIconContainer";var I=(0,f.styled)(h.default,function(e){var n=e.$theme,o=e.$isFocusVisible;return{cursor:"pointer",outline:o?"solid 3px ".concat(n.colors.accent):"none"}});P.StyledClearIcon=I,I.displayName="StyledClearIcon",I.displayName="StyledClearIcon";function C(e,n){var o;return(o={},y(o,d.SIZE.mini,{paddingTop:n.scale100,paddingBottom:n.scale100,paddingLeft:n.scale550,paddingRight:n.scale550}),y(o,d.SIZE.compact,{paddingTop:n.scale200,paddingBottom:n.scale200,paddingLeft:n.scale550,paddingRight:n.scale550}),y(o,d.SIZE.default,{paddingTop:n.scale400,paddingBottom:n.scale400,paddingLeft:n.scale550,paddingRight:n.scale550}),y(o,d.SIZE.large,{paddingTop:n.scale550,paddingBottom:n.scale550,paddingLeft:n.scale550,paddingRight:n.scale550}),o)[e]}function E(e,n,o,p,c){var S=e===d.ADJOINED.both||e===d.ADJOINED.left&&p!=="rtl"||e===d.ADJOINED.right&&p==="rtl"||c&&p==="rtl",j=e===d.ADJOINED.both||e===d.ADJOINED.right&&p!=="rtl"||e===d.ADJOINED.left&&p==="rtl"||c&&p!=="rtl";return{paddingLeft:S?o.scale550:"0px",paddingRight:j?o.scale550:"0px"}}function w(e,n){var o;return(o={},y(o,d.SIZE.mini,n.font100),y(o,d.SIZE.compact,n.font200),y(o,d.SIZE.default,n.font300),y(o,d.SIZE.large,n.font400),o)[e]}function D(e,n,o){var p=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,c=arguments.length>4?arguments[4]:void 0;return e?{borderLeftColor:c.inputFillDisabled,borderRightColor:c.inputFillDisabled,borderTopColor:c.inputFillDisabled,borderBottomColor:c.inputFillDisabled,backgroundColor:c.inputFillDisabled}:n?{borderLeftColor:c.borderSelected,borderRightColor:c.borderSelected,borderTopColor:c.borderSelected,borderBottomColor:c.borderSelected,backgroundColor:c.inputFillActive}:o?{borderLeftColor:c.inputBorderError,borderRightColor:c.inputBorderError,borderTopColor:c.inputBorderError,borderBottomColor:c.inputBorderError,backgroundColor:c.inputFillError}:p?{borderLeftColor:c.inputBorderPositive,borderRightColor:c.inputBorderPositive,borderTopColor:c.inputBorderPositive,borderBottomColor:c.inputBorderPositive,backgroundColor:c.inputFillPositive}:{borderLeftColor:c.inputBorder,borderRightColor:c.inputBorder,borderTopColor:c.inputBorder,borderBottomColor:c.inputBorder,backgroundColor:c.inputFill}}function z(e,n){var o=n.inputBorderRadius;return e===d.SIZE.mini&&(o=n.inputBorderRadiusMini),{borderTopLeftRadius:o,borderBottomLeftRadius:o,borderTopRightRadius:o,borderBottomRightRadius:o}}var _=function(e){var n=e.$isFocused,o=e.$adjoined,p=e.$error,c=e.$disabled,S=e.$positive,j=e.$size,B=e.$theme,T=e.$theme,N=T.borders,W=T.colors,le=T.sizing,ue=T.typography,q=T.animation,se=e.$hasIconTrailing;return m(m(m(m({boxSizing:"border-box",display:"flex",overflow:"hidden",width:"100%",borderLeftWidth:"2px",borderRightWidth:"2px",borderTopWidth:"2px",borderBottomWidth:"2px",borderLeftStyle:"solid",borderRightStyle:"solid",borderTopStyle:"solid",borderBottomStyle:"solid",transitionProperty:"border",transitionDuration:q.timing200,transitionTimingFunction:q.easeOutCurve},z(j,N)),w(j,ue)),D(c,n,p,S,W)),E(o,j,le,B.direction,se))};P.getRootStyles=_;var R=(0,f.styled)("div",_);P.Root=R,R.displayName="Root",R.displayName="Root";function k(e,n){var o;return(o={},y(o,d.SIZE.mini,{paddingRight:n.scale400,paddingLeft:n.scale400}),y(o,d.SIZE.compact,{paddingRight:n.scale400,paddingLeft:n.scale400}),y(o,d.SIZE.default,{paddingRight:n.scale300,paddingLeft:n.scale300}),y(o,d.SIZE.large,{paddingRight:n.scale200,paddingLeft:n.scale200}),o)[e]}function M(e,n,o,p,c){return e?{color:c.inputEnhancerTextDisabled,backgroundColor:c.inputFillDisabled}:n?{color:c.contentPrimary,backgroundColor:c.inputFillActive}:o?{color:c.contentPrimary,backgroundColor:c.inputFillError}:p?{color:c.contentPrimary,backgroundColor:c.inputFillPositive}:{color:c.contentPrimary,backgroundColor:c.inputFill}}var i=(0,f.styled)("div",function(e){var n=e.$size,o=e.$disabled,p=e.$isFocused,c=e.$error,S=e.$positive,j=e.$theme,B=j.colors,T=j.sizing,N=j.typography,W=j.animation;return m(m(m({display:"flex",alignItems:"center",justifyContent:"center",transitionProperty:"color, background-color",transitionDuration:W.timing200,transitionTimingFunction:W.easeOutCurve},w(n,N)),k(n,T)),M(o,p,c,S,B))});P.InputEnhancer=i,i.displayName="InputEnhancer",i.displayName="InputEnhancer";function r(e,n,o,p,c){return e?{color:c.inputTextDisabled,backgroundColor:c.inputFillDisabled}:n?{color:c.contentPrimary,backgroundColor:c.inputFillActive}:o?{color:c.contentPrimary,backgroundColor:c.inputFillError}:p?{color:c.contentPrimary,backgroundColor:c.inputFillPositive}:{color:c.contentPrimary,backgroundColor:c.inputFill}}var u=function(e){var n=e.$isFocused,o=e.$error,p=e.$disabled,c=e.$positive,S=e.$size,j=e.$theme,B=j.colors,T=j.typography,N=j.animation;return m(m({display:"flex",width:"100%",transitionProperty:"background-color",transitionDuration:N.timing200,transitionTimingFunction:N.easeOutCurve},w(S,T)),r(p,n,o,c,B))};P.getInputContainerStyles=u;var s=(0,f.styled)("div",u);P.InputContainer=s,s.displayName="InputContainer",s.displayName="InputContainer";function t(e,n,o,p){return e?{color:p.inputTextDisabled,"-webkit-text-fill-color":p.inputTextDisabled,caretColor:p.contentPrimary,"::placeholder":{color:p.inputPlaceholderDisabled}}:{color:p.contentPrimary,caretColor:p.contentPrimary,"::placeholder":{color:p.inputPlaceholder}}}var a=function(e){var n=e.$disabled,o=e.$isFocused,p=e.$error,c=e.$size,S=e.$theme,j=S.colors,B=S.sizing,T=S.typography;return m(m(m({boxSizing:"border-box",backgroundColor:"transparent",borderLeftWidth:0,borderRightWidth:0,borderTopWidth:0,borderBottomWidth:0,borderLeftStyle:"none",borderRightStyle:"none",borderTopStyle:"none",borderBottomStyle:"none",outline:"none",width:"100%",minWidth:0,maxWidth:"100%",cursor:n?"not-allowed":"text",margin:"0",paddingTop:"0",paddingBottom:"0",paddingLeft:"0",paddingRight:"0"},w(c,T)),C(c,B)),t(n,o,p,j))};P.getInputStyles=a;var l=(0,f.styled)("input",a);return P.Input=l,l.displayName="Input",l.displayName="Input",P}var He=Ze();const Ve=ie("div",{target:"e1ipygm11"})({name:"1ucqwki",styles:"position:absolute;top:50%;right:2.05em"}),Ue=ie(he,{shouldForwardProp:ve,target:"e1ipygm10"})(({theme:f,$isHighlighted:d})=>({paddingRight:f.spacing.lg,paddingLeft:f.spacing.lg,paddingTop:f.spacing.sm,paddingBottom:f.spacing.sm,background:d?f.colors.darkenedBgMix15:void 0,"&:hover, &:active, &:focus-visible":{background:f.colors.darkenedBgMix15}}),"");function Je({disabled:f,element:d,widgetMgr:h,fragmentId:b}){const[v,m]=Be({getStateFromWidgetMgr:Ye,getDefaultStateFromProto:Ge,getCurrStateFromProto:qe,updateWidgetMgrState:Xe,element:d,widgetMgr:h,fragmentId:b}),y=U.useContext(ce),O=J(d.default)&&!f,g=de(),I={Select:{props:{disabled:f,overrides:{ControlContainer:{style:{height:g.sizes.minElementHeight,borderLeftWidth:g.sizes.borderWidth,borderRightWidth:g.sizes.borderWidth,borderTopWidth:g.sizes.borderWidth,borderBottomWidth:g.sizes.borderWidth}},IconsContainer:{style:()=>({paddingRight:g.spacing.sm})},ValueContainer:{style:()=>({lineHeight:g.lineHeights.inputWidget,paddingRight:g.spacing.sm,paddingLeft:g.spacing.md,paddingBottom:g.spacing.sm,paddingTop:g.spacing.sm})},SingleValue:{style:{fontWeight:g.fontWeights.normal},props:{"data-testid":"stTimeInputTimeDisplay"}},Dropdown:{style:()=>({paddingTop:g.spacing.none,paddingBottom:g.spacing.none,boxShadow:"none",maxHeight:g.sizes.maxDropdownHeight})},DropdownListItem:{component:Ue},Popover:{props:{ignoreBoundary:y,overrides:{Body:{style:()=>({marginTop:g.spacing.px})}}}},Placeholder:{style:()=>({color:g.colors.fadedText60})},SelectArrow:{component:me,props:{overrides:{Svg:{style:()=>({width:g.iconSizes.xl,height:g.iconSizes.xl})}}}}}}}},C=U.useCallback(w=>{const D=w===null?null:Ke(w);m({value:D,fromUi:!0})},[m]),E=U.useCallback(()=>{C(null)},[C]);return L.jsxs("div",{className:"stTimeInput","data-testid":"stTimeInput",children:[L.jsx(pe,{label:d.label,disabled:f,labelVisibility:fe(d.labelVisibility?.value),children:d.help&&L.jsx(ge,{children:L.jsx(ye,{content:d.help,placement:be.TOP_RIGHT})})}),L.jsx(_e,{format:"24",step:d.step?Number(d.step):900,value:J(v)?void 0:Qe(v),onChange:C,overrides:I,nullable:O,creatable:!0,"aria-label":d.label}),O&&!J(v)&&L.jsx(Ve,{onClick:E,"data-testid":"stTimeInputClearButton",children:L.jsx(He.StyledClearIcon,{overrides:{Svg:{style:{color:g.colors.grayTextColor,padding:g.spacing.threeXS,height:g.sizes.clearIconSize,width:g.sizes.clearIconSize,":hover":{fill:g.colors.bodyText}}}},$isFocusVisible:!1})})]})}function Ye(f,d){return f.getStringValue(d)??null}function Ge(f){return f.default??null}function qe(f){return f.value??null}function Xe(f,d,h,b){d.setStringValue(f,h.value,{fromUi:h.fromUi},b)}function Ke(f){const d=f.getHours().toString().padStart(2,"0"),h=f.getMinutes().toString().padStart(2,"0");return`${d}:${h}`}function Qe(f){if(f===null)return null;const[d,h]=f.split(":").map(Number),b=new Date;return b.setHours(d),b.setMinutes(h),b}const at=U.memo(Je);export{at as default};
|