@stlite/desktop 0.83.0 → 0.83.1
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/bin/dump_artifacts.js +31 -31
- package/build/assets/{ErrorOutline.esm-w3SotGgg.js → ErrorOutline.esm-Cdc3NAX8.js} +1 -1
- package/build/assets/{FileDownload.esm-DNaG7mhy.js → FileDownload.esm-CbXaPbiH.js} +1 -1
- package/build/assets/{FileHelper-DoUfoupm.js → FileHelper-WDsMYNBw.js} +1 -1
- package/build/assets/{FormClearHelper-DI9KwuTl.js → FormClearHelper-CT0Jwp4X.js} +1 -1
- package/build/assets/{Hooks-BRr-mPDr.js → Hooks-BKPTn6xf.js} +1 -1
- package/build/assets/{InputInstructions-mpv25B9R.js → InputInstructions-Cyg7opie.js} +1 -1
- package/build/assets/{ProgressBar-DalMRT-4.js → ProgressBar-CA-bplbU.js} +1 -1
- package/build/assets/{RenderInPortalIfExists-CfX3LXlx.js → RenderInPortalIfExists-BozYGWdi.js} +1 -1
- package/build/assets/{Toolbar-1r13KE9d.js → Toolbar-DlGOP7h4.js} +1 -1
- package/build/assets/{base-input-BJ4WO1K3.js → base-input-BnIlcFzX.js} +1 -1
- package/build/assets/{checkbox-COr-UunX.js → checkbox-CGvNPQQ1.js} +1 -1
- package/build/assets/{createSuper-BD8Om4of.js → createSuper-B8yCxQGq.js} +1 -1
- package/build/assets/{data-grid-overlay-editor-DUKLRWRf.js → data-grid-overlay-editor-CltKX1-_.js} +1 -1
- package/build/assets/{downloader-K2yu2VBv.js → downloader-Cof1FiXt.js} +1 -1
- package/build/assets/{es6-CqFPgbyx.js → es6-Ca0BcWDW.js} +2 -2
- package/build/assets/{iframeResizer.contentWindow-CYxwXEKD.js → iframeResizer.contentWindow-3AhBUVoO.js} +1 -1
- package/build/assets/{index-DIR2fiU3.js → index--NPqZQqZ.js} +1 -1
- package/build/assets/{index-Bga7N97D.js → index-2MeZae5n.js} +1 -1
- package/build/assets/{index-Dkkplt7E.js → index-BBjBAKoV.js} +1 -1
- package/build/assets/{index-CgIf_789.js → index-BMvzOjlv.js} +1 -1
- package/build/assets/{index-CBHSzhtV.js → index-BUOOlidY.js} +1 -1
- package/build/assets/{index-CgaLKbNA.js → index-BafYTuwa.js} +1 -1
- package/build/assets/{index-CbGVTpRX.js → index-Bc7AX3-A.js} +1 -1
- package/build/assets/{index-h6PFbOmO.js → index-Bcsdrj2S.js} +5 -5
- package/build/assets/{index-DAyJZph2.js → index-C8-4FAc1.js} +1 -1
- package/build/assets/{index-CG0w2Shn.js → index-CLBVu_mK.js} +1 -1
- package/build/assets/{index-BTWAYrEA.js → index-CN5CjLsc.js} +1 -1
- package/build/assets/{index-GeTKqk0L.js → index-COAtiAK0.js} +1 -1
- package/build/assets/{index-oIFkiM-w.js → index-CS3tnJiL.js} +1 -1
- package/build/assets/{index-DAFr20lD.js → index-CVrdwKzt.js} +1 -1
- package/build/assets/{index-BY2_5dEP.js → index-CWEVeVJ6.js} +1 -1
- package/build/assets/{index-CJj5-jL6.js → index-C_kIyk9w.js} +1 -1
- package/build/assets/{index-CVPZJuoC.js → index-Cbvbjd8C.js} +4 -4
- package/build/assets/{index-DJ9ENWJ6.js → index-ChbiMLbp.js} +1 -1
- package/build/assets/{index-QxKGd3KZ.js → index-DCoy2PDE.js} +1 -1
- package/build/assets/{index-Cy3sYumn.js → index-DIBxvKdk.js} +1 -1
- package/build/assets/{index-BVYhtbL7.js → index-DSVyX96W.js} +1 -1
- package/build/assets/{index-CTKSPDuj.js → index-DfeaHlsl.js} +1 -1
- package/build/assets/{index-D4DI0i3_.js → index-Do3iUH-x.js} +1 -1
- package/build/assets/{index-DhpOSNWU.js → index-Dw5G4t9P.js} +1 -1
- package/build/assets/{index-B7nFcP4b.js → index-Dx-GFi6o.js} +1 -1
- package/build/assets/{index-TIqCq-vm.js → index-J-18FLnE.js} +1 -1
- package/build/assets/{index-BBSx627c.js → index-PRsYLT-9.js} +1 -1
- package/build/assets/{index-Chg_Z_Ai.js → index-TkDz3vqu.js} +1 -1
- package/build/assets/{index-DHvjd_NM.js → index-XyUVDWZe.js} +1 -1
- package/build/assets/{index-WJi2gbUd.js → index-Zd66ep5J.js} +1 -1
- package/build/assets/{index-D_aTbShm.js → index-ax2rbmoZ.js} +1 -1
- package/build/assets/{index-qPiigGKE.js → index-bQj3l0zc.js} +1 -1
- package/build/assets/{index-DZGNB9Z2.js → index-bfhlF0Xi.js} +1 -1
- package/build/assets/{index-dOLNZa0u.js → index-dalh9Y65.js} +1 -1
- package/build/assets/{index-FQnDjdgN.js → index-ocHxXLCt.js} +1 -1
- package/build/assets/{index-bXFpQSEH.js → index-uxEQ8qdA.js} +1 -1
- package/build/assets/{index-DbWqdg_N.js → index-wCYAC2ZH.js} +1 -1
- package/build/assets/{inherits-DtR6i4OG.js → inherits-BaopKHev.js} +1 -1
- package/build/assets/{input-9qldoJOB.js → input-BH9uqfZf.js} +1 -1
- package/build/assets/{memory-Cy3-iIgx.js → memory-DWTwf9Ch.js} +1 -1
- package/build/assets/{mergeWith-DdD-5zWL.js → mergeWith-Bt-C9xRx.js} +1 -1
- package/build/assets/{number-overlay-editor-DmP64vrs.js → number-overlay-editor-Dm8-09pg.js} +1 -1
- package/build/assets/{sandbox-DzhFXmWd.js → sandbox-DGYybjEz.js} +1 -1
- package/build/assets/{slicedToArray-CNrowD0v.js → slicedToArray-CEuyIGI5.js} +1 -1
- package/build/assets/{textarea-Bql4j-_M.js → textarea-BKB-3cBX.js} +1 -1
- package/build/assets/{timepicker-sEhIITXf.js → timepicker-B1BEcpbo.js} +1 -1
- package/build/assets/{uniqueId-DfRnwW3q.js → uniqueId-BSuwhGjw.js} +1 -1
- package/build/assets/{useBasicWidgetState-DJ8kXLgn.js → useBasicWidgetState-D3a9XYx3.js} +1 -1
- package/build/assets/{useOnInputChange-CZX_IkMh.js → useOnInputChange-BlFu2GNS.js} +1 -1
- package/build/assets/{withFullScreenWrapper-DBlEST2L.js → withFullScreenWrapper-D8NJOCKn.js} +1 -1
- package/build/assets/worker-Cy9Gj5BL.js +113 -0
- package/build/electron/worker.js +10 -112
- package/build/index.html +1 -1
- package/package.json +4 -4
- package/wheels/streamlit-1.45.1-cp312-none-any.whl +0 -0
- package/build/assets/worker-CXcujS1W.js +0 -215
package/build/assets/{data-grid-overlay-editor-DUKLRWRf.js → data-grid-overlay-editor-CltKX1-_.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,b as J}from"./index-
|
|
1
|
+
import{r,b as J}from"./index-Cbvbjd8C.js";import{s as Q,i as P,a as U,b as Z,T as _,C as ee,m as te}from"./index-Bcsdrj2S.js";import"./FormClearHelper-CT0Jwp4X.js";import"./withFullScreenWrapper-D8NJOCKn.js";import"./Toolbar-DlGOP7h4.js";import"./checkbox-CGvNPQQ1.js";import"./mergeWith-Bt-C9xRx.js";import"./sprintf-D7DtBTRn.js";import"./createDownloadLinkElement-DZMwyjvU.js";import"./slicedToArray-CEuyIGI5.js";import"./inherits-BaopKHev.js";import"./createSuper-B8yCxQGq.js";import"./FileDownload.esm-CbXaPbiH.js";const re=()=>t=>t.targetX,ie=()=>t=>t.targetY,oe=()=>t=>t.targetWidth,ne=()=>t=>t.targetHeight,ae=()=>t=>t.targetY+10,se=()=>t=>Math.max(0,(t.targetHeight-28)/2),de=Q("div")({name:"DataGridOverlayEditorStyle",class:"gdg-d19meir1",propsAsIs:!1,vars:{"d19meir1-0":[ie(),"px"],"d19meir1-1":[re(),"px"],"d19meir1-2":[oe(),"px"],"d19meir1-3":[ne(),"px"],"d19meir1-4":[ae(),"px"],"d19meir1-5":[se(),"px"]}});function le(){const[t,n]=r.useState();return[t??void 0,n]}function ce(){const[t,n]=le(),[o,p]=r.useState(0),[g,b]=r.useState(!0);r.useLayoutEffect(()=>{if(t===void 0||!("IntersectionObserver"in window))return;const a=new IntersectionObserver(s=>{s.length!==0&&b(s[0].isIntersecting)},{threshold:1});return a.observe(t),()=>a.disconnect()},[t]),r.useEffect(()=>{if(g||t===void 0)return;let a;const s=()=>{const{right:k}=t.getBoundingClientRect();p(v=>Math.min(v+window.innerWidth-k-10,0)),a=requestAnimationFrame(s)};return a=requestAnimationFrame(s),()=>{a!==void 0&&cancelAnimationFrame(a)}},[t,g]);const C=r.useMemo(()=>({transform:`translateX(${o}px)`}),[o]);return{ref:n,style:C}}const ue=t=>{const{target:n,content:o,onFinishEditing:p,forceEditMode:g,initialValue:b,imageEditorOverride:C,markdownDivCreateNode:a,highlight:s,className:k,theme:v,id:V,cell:w,bloom:f,validateCell:c,getCellRenderer:M,provideEditor:x,isOutsideClick:W,customEventTarget:X}=t,[d,Y]=r.useState(g?o:void 0),O=r.useRef(d??o);O.current=d??o;const[h,N]=r.useState(()=>c===void 0?!0:!(P(o)&&(c==null?void 0:c(w,o,O.current))===!1)),u=r.useCallback((e,i)=>{p(h?e:void 0,i)},[h,p]),q=r.useCallback(e=>{if(c!==void 0&&e!==void 0&&P(e)){const i=c(w,e,O.current);i===!1?N(!1):(typeof i=="object"&&(e=i),N(!0))}Y(e)},[w,c]),y=r.useRef(!1),m=r.useRef(void 0),B=r.useCallback(()=>{u(d,[0,0]),y.current=!0},[d,u]),G=r.useCallback((e,i)=>{u(e,i??m.current??[0,0]),y.current=!0},[u]),j=r.useCallback(async e=>{let i=!1;e.key==="Escape"?(e.stopPropagation(),e.preventDefault(),m.current=[0,0]):e.key==="Enter"&&!e.shiftKey?(e.stopPropagation(),e.preventDefault(),m.current=[0,1],i=!0):e.key==="Tab"&&(e.stopPropagation(),e.preventDefault(),m.current=[e.shiftKey?-1:1,0],i=!0),window.setTimeout(()=>{!y.current&&m.current!==void 0&&(u(i?d:void 0,m.current),y.current=!0)},0)},[u,d]),S=d??o,[l,L]=r.useMemo(()=>{var e,i;if(U(o))return[];const K=x==null?void 0:x(o);return K!==void 0?[K,!1]:[(i=(e=M(o))==null?void 0:e.provideEditor)==null?void 0:i.call(e,o),!1]},[o,M,x]),{ref:$,style:z}=ce();let R=!0,F,I=!0,E;if(l!==void 0){R=l.disablePadding!==!0,I=l.disableStyling!==!0;const e=Z(l);e&&(E=l.styleOverride);const i=e?l.editor:l;F=r.createElement(i,{isHighlighted:s,onChange:q,value:S,initialValue:b,onFinishedEditing:G,validatedSelection:P(S)?S.selectionRange:void 0,forceEditMode:g,target:n,imageEditorOverride:C,markdownDivCreateNode:a,isValid:h,theme:v})}E={...E,...z};const T=document.getElementById("portal");if(T===null)return console.error('Cannot open Data Grid overlay editor, because portal not found. Please add `<div id="portal" />` as the last child of your `<body>`.'),null;let D=I?"gdg-style":"gdg-unstyle";h||(D+=" gdg-invalid"),R&&(D+=" gdg-pad");const A=(f==null?void 0:f[0])??1,H=(f==null?void 0:f[1])??1;return J.createPortal(r.createElement(_.Provider,{value:v},r.createElement(ee,{style:te(v),className:k,onClickOutside:B,isOutsideClick:W,customEventTarget:X},r.createElement(de,{ref:$,id:V,className:D,style:E,as:L===!0?"label":void 0,targetX:n.x-A,targetY:n.y-H,targetWidth:n.width+A*2,targetHeight:n.height+H*2},r.createElement("div",{className:"gdg-clip-region",onKeyDown:j},F)))),T)};export{ue as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as f,e as v}from"./es6-
|
|
1
|
+
import{c as f,e as v}from"./es6-Ca0BcWDW.js";import"./index-Cbvbjd8C.js";const{WritableStream:_,TransformStream:m,DOMException:P,Blob:u}=f,{GONE:M}=v,E=/constructor/i.test(window.HTMLElement);class T{constructor(e="unkown"){this.name=e,this.kind="file"}async getFile(){throw new P(...M)}async isSameEntry(e){return this===e}async createWritable(e={}){var t;const s=await((t=navigator.serviceWorker)==null?void 0:t.getRegistration()),o=document.createElement("a"),n=new m,g=n.writable;if(o.download=this.name,E||!s){let a=[];n.readable.pipeTo(new _({write(r){a.push(new u([r]))},close(){const r=new u(a,{type:"application/octet-stream; charset=utf-8"});a=[],o.href=URL.createObjectURL(r),o.click(),setTimeout(()=>URL.revokeObjectURL(o.href),1e4)}}))}else{const{writable:a,readablePort:r}=new F(_),i=encodeURIComponent(this.name).replace(/['()]/g,escape).replace(/\*/g,"%2A"),w={"content-disposition":"attachment; filename*=UTF-8''"+i,"content-type":"application/octet-stream; charset=utf-8",...e.size?{"content-length":e.size}:{}},R=setTimeout(()=>s.active.postMessage(0),1e4);n.readable.pipeThrough(new m({transform(l,h){if(l instanceof Uint8Array)return h.enqueue(l);const b=new Response(l).body.getReader(),p=S=>b.read().then(y=>y.done?0:p(h.enqueue(y.value)));return p()}})).pipeTo(a).finally(()=>{clearInterval(R)}),s.active.postMessage({url:s.scope+i,headers:w,readablePort:r},[r]);const c=document.createElement("iframe");c.hidden=!0,c.src=s.scope+i,document.body.appendChild(c)}return g.getWriter()}}const U=0,j=0,k=1,L=1,O=2;class W{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:U,chunk:e};return this._port.postMessage(t,[e.buffer]),this._resetReady(),this._readyPromise}close(){this._port.postMessage({type:O}),this._port.close()}abort(e){this._port.postMessage({type:L,reason:e}),this._port.close()}_onMessage(e){e.type===j&&this._resolveReady(),e.type===k&&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 F{constructor(e){const t=new MessageChannel;this.readablePort=t.port1,this.writable=new e(new W(t.port2))}}export{T as FileHandle};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/downloader-
|
|
2
|
-
import{z as c,__tla as me}from"./index-CVPZJuoC.js";let B,A,H,pe=Promise.all([(()=>{try{return me}catch{}})()]).then(async()=>{var $=Object.defineProperty,L=r=>{throw TypeError(r)},Y=(r,e,t)=>e in r?$(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,g=(r,e,t)=>Y(r,typeof e!="symbol"?e+"":e,t),X=(r,e,t)=>e.has(r)||L("Cannot "+t),J=(r,e,t)=>e.has(r)?L("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),K=(r,e,t,n)=>(X(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t);const x=globalThis.showDirectoryPicker;async function Q(r={}){if(x&&!r._preferPolyfill)return x(r);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=c(()=>Promise.resolve().then(()=>q),void 0);return await new Promise(n=>{e.addEventListener("change",n),e.click()}),t.then(n=>n.getDirHandlesFromInput(e))}const Z={accepts:[]},R=globalThis.showOpenFilePicker;async function ee(r={}){const e={...Z,...r};if(R&&!r._preferPolyfill)return R(e);const t=document.createElement("input");t.type="file",t.multiple=e.multiple,t.accept=(e.accepts||[]).map(s=>[...(s.extensions||[]).map(i=>"."+i),...s.mimeTypes||[]]).flat().join(","),Object.assign(t.style,{position:"fixed",top:"-100000px",left:"-100000px"}),document.body.appendChild(t);const n=c(()=>Promise.resolve().then(()=>q),void 0);return await new Promise(s=>{t.addEventListener("change",s,{once:!0}),t.click()}),t.remove(),n.then(s=>s.getFileHandlesFromInput(t))}const M=globalThis.showSaveFilePicker;async function te(r={}){if(M&&!r._preferPolyfill)return M(r);r._name&&(console.warn("deprecated _name, spec now have `suggestedName`"),r.suggestedName=r._name);const{FileSystemFileHandle:e}=await c(async()=>{const{FileSystemFileHandle:n}=await Promise.resolve().then(()=>u);return{FileSystemFileHandle:n}},void 0),{FileHandle:t}=await c(async()=>{const{FileHandle:n}=await import("./downloader-K2yu2VBv.js");return{FileHandle:n}},__vite__mapDeps([0,1,2]));return new e(new t(r.suggestedName))}globalThis.DataTransferItem&&!DataTransferItem.prototype.getAsFileSystemHandle&&(DataTransferItem.prototype.getAsFileSystemHandle=async function(){const r=this.webkitGetAsEntry(),[{FileHandle:e,FolderHandle:t},{FileSystemDirectoryHandle:n},{FileSystemFileHandle:s}]=await Promise.all([c(()=>import("./sandbox-DzhFXmWd.js"),__vite__mapDeps([3,1,2])),c(()=>Promise.resolve().then(()=>T),void 0),c(()=>Promise.resolve().then(()=>u),void 0)]);return r.isFile?new s(new e(r,!1)):new n(new t(r,!1))});async function re(r,e={}){var t,n;if(!r)return((n=(t=globalThis.navigator)==null?void 0:t.storage)==null?void 0:n.getDirectory())||globalThis.getOriginPrivateDirectory();const{FileSystemDirectoryHandle:s}=await c(async()=>{const{FileSystemDirectoryHandle:y}=await Promise.resolve().then(()=>T);return{FileSystemDirectoryHandle:y}},void 0),i=await r,l=await(i.default?i.default(e):i(e));return new s(l)}let j;A={WritableStream:globalThis.WritableStream,TransformStream:globalThis.TransformStream,DOMException:globalThis.DOMException,Blob:globalThis.Blob,File:globalThis.File},{WritableStream:j}=A;var O;const ae=class G extends j{constructor(e){super(e),J(this,O),K(this,O,e),Object.setPrototypeOf(this,G.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(),n=t.write(e);return t.releaseLock(),n}};O=new WeakMap;let b=ae;Object.defineProperty(b.prototype,Symbol.toStringTag,{value:"FileSystemWritableFileStream",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(b.prototype,{close:{enumerable:!0},seek:{enumerable:!0},truncate:{enumerable:!0},write:{enumerable:!0}}),globalThis.FileSystemFileHandle&&!globalThis.FileSystemFileHandle.prototype.createWritable&&!globalThis.FileSystemWritableFileStream&&(globalThis.FileSystemWritableFileStream=b);const m=Symbol("adapter");var W;W=m;class v{constructor(e){g(this,W),g(this,"name"),g(this,"kind"),this.kind=e.kind,this.name=e.name,this[m]=e}async queryPermission(e={}){const{mode:t="read"}=e,n=this[m];if(n.queryPermission)return n.queryPermission({mode:t});if(t==="read")return"granted";if(t==="readwrite")return n.writable?"granted":"denied";throw new TypeError(`Mode ${t} must be 'read' or 'readwrite'`)}async requestPermission({mode:e="read"}={}){const t=this[m];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[m].remove(e)}async isSameEntry(e){return this===e?!0:!e||typeof e!="object"||this.kind!==e.kind||!e[m]?!1:this[m].isSameEntry(e[m])}}Object.defineProperty(v.prototype,Symbol.toStringTag,{value:"FileSystemHandle",writable:!1,enumerable:!1,configurable:!0});var N;globalThis.FileSystemHandle&&((N=globalThis.FileSystemHandle.prototype).queryPermission??(N.queryPermission=function(r){return"granted"}));let V;H={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:r=>[`Failed to execute 'write' on 'UnderlyingSinkBase': Invalid params passed. ${r}`,"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"]},V={writable:globalThis.WritableStream};async function ne(r){console.warn("deprecated fromDataTransfer - use `dt.items[0].getAsFileSystemHandle()` instead");const[e,t,n]=await Promise.all([c(()=>import("./memory-Cy3-iIgx.js"),__vite__mapDeps([4,1,2])),c(()=>import("./sandbox-DzhFXmWd.js"),__vite__mapDeps([3,1,2])),c(()=>Promise.resolve().then(()=>T),void 0)]),s=new e.FolderHandle("",!1);return s._entries=r.map(i=>i.isFile?new t.FileHandle(i,!1):new t.FolderHandle(i,!1)),new n.FileSystemDirectoryHandle(s)}async function ie(r){const{FolderHandle:e,FileHandle:t}=await c(async()=>{const{FolderHandle:y,FileHandle:o}=await import("./memory-Cy3-iIgx.js");return{FolderHandle:y,FileHandle:o}},__vite__mapDeps([4,1,2])),{FileSystemDirectoryHandle:n}=await c(async()=>{const{FileSystemDirectoryHandle:y}=await Promise.resolve().then(()=>T);return{FileSystemDirectoryHandle:y}},void 0),s=Array.from(r.files),i=s[0].webkitRelativePath.split("/",1)[0],l=new e(i,!1);return s.forEach(y=>{const o=y.webkitRelativePath.split("/");o.shift();const d=o.pop(),w=o.reduce((h,f)=>(h._entries[f]||(h._entries[f]=new e(f,!1)),h._entries[f]),l);w._entries[d]=new t(y.name,y,!1)}),new n(l)}async function se(r){const{FileHandle:e}=await c(async()=>{const{FileHandle:n}=await import("./memory-Cy3-iIgx.js");return{FileHandle:n}},__vite__mapDeps([4,1,2])),{FileSystemFileHandle:t}=await c(async()=>{const{FileSystemFileHandle:n}=await Promise.resolve().then(()=>u);return{FileSystemFileHandle:n}},void 0);return Array.from(r.files).map(n=>new t(new e(n.name,n,!1)))}const q=Object.freeze(Object.defineProperty({__proto__:null,config:V,errors:H,fromDataTransfer:ne,getDirHandlesFromInput:ie,getFileHandlesFromInput:se},Symbol.toStringTag,{value:"Module"})),{GONE:oe,MOD_ERR:le}=H,p=Symbol("adapter");var z;let _=class D extends v{constructor(e){super(e),g(this,z),this[p]=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 n=await this[p].getDirectoryHandle(e,t);return new D(n)}async*entries(){const{FileSystemFileHandle:e}=await c(async()=>{const{FileSystemFileHandle:t}=await Promise.resolve().then(()=>u);return{FileSystemFileHandle:t}},void 0);for await(const[t,n]of this[p].entries())yield[n.name,n.kind==="file"?new e(n):new D(n)]}async*getEntries(){const{FileSystemFileHandle:e}=await c(async()=>{const{FileSystemFileHandle:t}=await Promise.resolve().then(()=>u);return{FileSystemFileHandle:t}},void 0);console.warn("deprecated, use .entries() instead");for await(let t of this[p].entries())yield t.kind==="file"?new e(t):new D(t)}async getFileHandle(e,t={}){const{FileSystemFileHandle:n}=await c(async()=>{const{FileSystemFileHandle:i}=await Promise.resolve().then(()=>u);return{FileSystemFileHandle:i}},void 0);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 s=await this[p].getFileHandle(e,t);return new n(s)}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[p].removeEntry(e,t)}async resolve(e){if(await e.isSameEntry(this))return[];const t=[{handle:this,path:[]}];for(;t.length;){let{handle:n,path:s}=t.pop();for await(const i of n.values()){if(await i.isSameEntry(e))return[...s,i.name];i.kind==="directory"&&t.push({handle:i,path:[...s,i.name]})}}return null}async*keys(){for await(const[e]of this[p].entries())yield e}async*values(){for await(const[e,t]of this)yield t}[(z=p,Symbol.asyncIterator)](){return this.entries()}};if(Object.defineProperty(_.prototype,Symbol.toStringTag,{value:"FileSystemDirectoryHandle",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(_.prototype,{getDirectoryHandle:{enumerable:!0},entries:{enumerable:!0},getFileHandle:{enumerable:!0},removeEntry:{enumerable:!0}}),globalThis.FileSystemDirectoryHandle){const r=globalThis.FileSystemDirectoryHandle.prototype;r.resolve=async function(s){if(await s.isSameEntry(this))return[];const i=[{handle:this,path:[]}];for(;i.length;){let{handle:l,path:y}=i.pop();for await(const o of l.values()){if(await o.isSameEntry(s))return[...y,o.name];o.kind==="directory"&&i.push({handle:o,path:[...y,o.name]})}}return null};async function e(s){if(await(await navigator.storage.getDirectory()).resolve(s)===null)throw new DOMException(...oe)}const t=r.entries;r.entries=async function*(){await e(this),yield*t.call(this)},r[Symbol.asyncIterator]=async function*(){yield*this.entries()};const n=r.removeEntry;r.removeEntry=async function(s,i={}){return n.call(this,s,i).catch(async l=>{throw l instanceof DOMException&&l.name==="UnknownError"&&!i.recursive&&!(await t.call(this).next()).done?new DOMException(...le):l})}}const T=Object.freeze(Object.defineProperty({__proto__:null,FileSystemDirectoryHandle:_,default:_},Symbol.toStringTag,{value:"Module"})),{INVALID:ce,SYNTAX:k,GONE:ye}=H,P=Symbol("adapter");var U,C;class F extends(C=v,U=P,C){constructor(e){super(e),g(this,U),this[P]=e}async createWritable(e={}){return new b(await this[P].createWritable(e))}async getFile(){return this[P].getFile()}}if(Object.defineProperty(F.prototype,Symbol.toStringTag,{value:"FileSystemFileHandle",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(F.prototype,{createWritable:{enumerable:!0},getFile:{enumerable:!0}}),globalThis.FileSystemFileHandle&&!globalThis.FileSystemFileHandle.prototype.createWritable){const r=new WeakMap;let e;const t=()=>{let s,i;onmessage=async l=>{const y=l.ports[0],o=l.data;switch(o.type){case"open":const d=o.name;let w=await navigator.storage.getDirectory();for(const h of o.path)w=await w.getDirectoryHandle(h);s=await w.getFileHandle(d),i=await s.createSyncAccessHandle();break;case"write":i.write(o.data,{at:o.position}),i.flush();break;case"truncate":i.truncate(o.size);break;case"abort":case"close":i.close();break}y.postMessage(0)}};globalThis.FileSystemFileHandle.prototype.createWritable=async function(s){if(!e){const a=`(${t.toString()})()`,S=new Blob([a],{type:"text/javascript"});e=URL.createObjectURL(S)}const i=new Worker(e,{type:"module"});let l=0;const y=new TextEncoder;let o=await this.getFile().then(a=>a.size);const d=a=>new Promise((S,de)=>{const E=new MessageChannel;E.port1.onmessage=I=>{I.data instanceof Error?de(I.data):S(I.data),E.port1.close(),E.port2.close(),E.port1.onmessage=null},i.postMessage(a,[E.port2])}),w=await navigator.storage.getDirectory(),h=await r.get(this),f=await w.resolve(h);if(f===null)throw new DOMException(...ye);return await d({type:"open",path:f,name:this.name}),(s==null?void 0:s.keepExistingData)===!1&&(await d({type:"truncate",size:0}),o=0),new b({start:a=>{},async write(a){if((a==null?void 0: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(...k("write requires a data argument"));if(a.position??(a.position=l),typeof a.data=="string")a.data=y.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 S=await new Response(a.data).arrayBuffer();a.data=new Uint8Array(S)}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(...ce);console.log("seeking",a),l=a.position;return}else throw await d({type:"close"}),new DOMException(...k("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(...k("truncate requires a size argument"));await d(a)},async close(){await d({type:"close"}),i.terminate()},async abort(a){await d({type:"abort",reason:a}),i.terminate()}})};const n=FileSystemDirectoryHandle.prototype.getFileHandle;FileSystemDirectoryHandle.prototype.getFileHandle=async function(...s){const i=await n.call(this,...s);return r.set(i,this),i}}let u;u=Object.freeze(Object.defineProperty({__proto__:null,FileSystemFileHandle:F,default:F},Symbol.toStringTag,{value:"Module"})),B=Object.freeze(Object.defineProperty({__proto__:null,FileSystemDirectoryHandle:_,FileSystemFileHandle:F,FileSystemHandle:v,FileSystemWritableFileStream:b,getOriginPrivateDirectory:re,showDirectoryPicker:Q,showOpenFilePicker:ee,showSaveFilePicker:te},Symbol.toStringTag,{value:"Module"}))});export{pe as __tla,B as a,A as c,H as e};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/downloader-Cof1FiXt.js","assets/index-Cbvbjd8C.js","assets/index.Bqb_jNud.css","assets/sandbox-DGYybjEz.js","assets/memory-DWTwf9Ch.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{z as c,__tla as me}from"./index-Cbvbjd8C.js";let B,A,H,pe=Promise.all([(()=>{try{return me}catch{}})()]).then(async()=>{var $=Object.defineProperty,L=r=>{throw TypeError(r)},Y=(r,e,t)=>e in r?$(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,g=(r,e,t)=>Y(r,typeof e!="symbol"?e+"":e,t),X=(r,e,t)=>e.has(r)||L("Cannot "+t),J=(r,e,t)=>e.has(r)?L("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),K=(r,e,t,n)=>(X(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t);const x=globalThis.showDirectoryPicker;async function Q(r={}){if(x&&!r._preferPolyfill)return x(r);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=c(()=>Promise.resolve().then(()=>q),void 0);return await new Promise(n=>{e.addEventListener("change",n),e.click()}),t.then(n=>n.getDirHandlesFromInput(e))}const Z={accepts:[]},R=globalThis.showOpenFilePicker;async function ee(r={}){const e={...Z,...r};if(R&&!r._preferPolyfill)return R(e);const t=document.createElement("input");t.type="file",t.multiple=e.multiple,t.accept=(e.accepts||[]).map(s=>[...(s.extensions||[]).map(i=>"."+i),...s.mimeTypes||[]]).flat().join(","),Object.assign(t.style,{position:"fixed",top:"-100000px",left:"-100000px"}),document.body.appendChild(t);const n=c(()=>Promise.resolve().then(()=>q),void 0);return await new Promise(s=>{t.addEventListener("change",s,{once:!0}),t.click()}),t.remove(),n.then(s=>s.getFileHandlesFromInput(t))}const M=globalThis.showSaveFilePicker;async function te(r={}){if(M&&!r._preferPolyfill)return M(r);r._name&&(console.warn("deprecated _name, spec now have `suggestedName`"),r.suggestedName=r._name);const{FileSystemFileHandle:e}=await c(async()=>{const{FileSystemFileHandle:n}=await Promise.resolve().then(()=>u);return{FileSystemFileHandle:n}},void 0),{FileHandle:t}=await c(async()=>{const{FileHandle:n}=await import("./downloader-Cof1FiXt.js");return{FileHandle:n}},__vite__mapDeps([0,1,2]));return new e(new t(r.suggestedName))}globalThis.DataTransferItem&&!DataTransferItem.prototype.getAsFileSystemHandle&&(DataTransferItem.prototype.getAsFileSystemHandle=async function(){const r=this.webkitGetAsEntry(),[{FileHandle:e,FolderHandle:t},{FileSystemDirectoryHandle:n},{FileSystemFileHandle:s}]=await Promise.all([c(()=>import("./sandbox-DGYybjEz.js"),__vite__mapDeps([3,1,2])),c(()=>Promise.resolve().then(()=>T),void 0),c(()=>Promise.resolve().then(()=>u),void 0)]);return r.isFile?new s(new e(r,!1)):new n(new t(r,!1))});async function re(r,e={}){var t,n;if(!r)return((n=(t=globalThis.navigator)==null?void 0:t.storage)==null?void 0:n.getDirectory())||globalThis.getOriginPrivateDirectory();const{FileSystemDirectoryHandle:s}=await c(async()=>{const{FileSystemDirectoryHandle:y}=await Promise.resolve().then(()=>T);return{FileSystemDirectoryHandle:y}},void 0),i=await r,l=await(i.default?i.default(e):i(e));return new s(l)}let j;A={WritableStream:globalThis.WritableStream,TransformStream:globalThis.TransformStream,DOMException:globalThis.DOMException,Blob:globalThis.Blob,File:globalThis.File},{WritableStream:j}=A;var O;const ae=class G extends j{constructor(e){super(e),J(this,O),K(this,O,e),Object.setPrototypeOf(this,G.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(),n=t.write(e);return t.releaseLock(),n}};O=new WeakMap;let b=ae;Object.defineProperty(b.prototype,Symbol.toStringTag,{value:"FileSystemWritableFileStream",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(b.prototype,{close:{enumerable:!0},seek:{enumerable:!0},truncate:{enumerable:!0},write:{enumerable:!0}}),globalThis.FileSystemFileHandle&&!globalThis.FileSystemFileHandle.prototype.createWritable&&!globalThis.FileSystemWritableFileStream&&(globalThis.FileSystemWritableFileStream=b);const m=Symbol("adapter");var W;W=m;class v{constructor(e){g(this,W),g(this,"name"),g(this,"kind"),this.kind=e.kind,this.name=e.name,this[m]=e}async queryPermission(e={}){const{mode:t="read"}=e,n=this[m];if(n.queryPermission)return n.queryPermission({mode:t});if(t==="read")return"granted";if(t==="readwrite")return n.writable?"granted":"denied";throw new TypeError(`Mode ${t} must be 'read' or 'readwrite'`)}async requestPermission({mode:e="read"}={}){const t=this[m];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[m].remove(e)}async isSameEntry(e){return this===e?!0:!e||typeof e!="object"||this.kind!==e.kind||!e[m]?!1:this[m].isSameEntry(e[m])}}Object.defineProperty(v.prototype,Symbol.toStringTag,{value:"FileSystemHandle",writable:!1,enumerable:!1,configurable:!0});var N;globalThis.FileSystemHandle&&((N=globalThis.FileSystemHandle.prototype).queryPermission??(N.queryPermission=function(r){return"granted"}));let V;H={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:r=>[`Failed to execute 'write' on 'UnderlyingSinkBase': Invalid params passed. ${r}`,"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"]},V={writable:globalThis.WritableStream};async function ne(r){console.warn("deprecated fromDataTransfer - use `dt.items[0].getAsFileSystemHandle()` instead");const[e,t,n]=await Promise.all([c(()=>import("./memory-DWTwf9Ch.js"),__vite__mapDeps([4,1,2])),c(()=>import("./sandbox-DGYybjEz.js"),__vite__mapDeps([3,1,2])),c(()=>Promise.resolve().then(()=>T),void 0)]),s=new e.FolderHandle("",!1);return s._entries=r.map(i=>i.isFile?new t.FileHandle(i,!1):new t.FolderHandle(i,!1)),new n.FileSystemDirectoryHandle(s)}async function ie(r){const{FolderHandle:e,FileHandle:t}=await c(async()=>{const{FolderHandle:y,FileHandle:o}=await import("./memory-DWTwf9Ch.js");return{FolderHandle:y,FileHandle:o}},__vite__mapDeps([4,1,2])),{FileSystemDirectoryHandle:n}=await c(async()=>{const{FileSystemDirectoryHandle:y}=await Promise.resolve().then(()=>T);return{FileSystemDirectoryHandle:y}},void 0),s=Array.from(r.files),i=s[0].webkitRelativePath.split("/",1)[0],l=new e(i,!1);return s.forEach(y=>{const o=y.webkitRelativePath.split("/");o.shift();const d=o.pop(),w=o.reduce((h,f)=>(h._entries[f]||(h._entries[f]=new e(f,!1)),h._entries[f]),l);w._entries[d]=new t(y.name,y,!1)}),new n(l)}async function se(r){const{FileHandle:e}=await c(async()=>{const{FileHandle:n}=await import("./memory-DWTwf9Ch.js");return{FileHandle:n}},__vite__mapDeps([4,1,2])),{FileSystemFileHandle:t}=await c(async()=>{const{FileSystemFileHandle:n}=await Promise.resolve().then(()=>u);return{FileSystemFileHandle:n}},void 0);return Array.from(r.files).map(n=>new t(new e(n.name,n,!1)))}const q=Object.freeze(Object.defineProperty({__proto__:null,config:V,errors:H,fromDataTransfer:ne,getDirHandlesFromInput:ie,getFileHandlesFromInput:se},Symbol.toStringTag,{value:"Module"})),{GONE:oe,MOD_ERR:le}=H,p=Symbol("adapter");var z;let _=class D extends v{constructor(e){super(e),g(this,z),this[p]=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 n=await this[p].getDirectoryHandle(e,t);return new D(n)}async*entries(){const{FileSystemFileHandle:e}=await c(async()=>{const{FileSystemFileHandle:t}=await Promise.resolve().then(()=>u);return{FileSystemFileHandle:t}},void 0);for await(const[t,n]of this[p].entries())yield[n.name,n.kind==="file"?new e(n):new D(n)]}async*getEntries(){const{FileSystemFileHandle:e}=await c(async()=>{const{FileSystemFileHandle:t}=await Promise.resolve().then(()=>u);return{FileSystemFileHandle:t}},void 0);console.warn("deprecated, use .entries() instead");for await(let t of this[p].entries())yield t.kind==="file"?new e(t):new D(t)}async getFileHandle(e,t={}){const{FileSystemFileHandle:n}=await c(async()=>{const{FileSystemFileHandle:i}=await Promise.resolve().then(()=>u);return{FileSystemFileHandle:i}},void 0);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 s=await this[p].getFileHandle(e,t);return new n(s)}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[p].removeEntry(e,t)}async resolve(e){if(await e.isSameEntry(this))return[];const t=[{handle:this,path:[]}];for(;t.length;){let{handle:n,path:s}=t.pop();for await(const i of n.values()){if(await i.isSameEntry(e))return[...s,i.name];i.kind==="directory"&&t.push({handle:i,path:[...s,i.name]})}}return null}async*keys(){for await(const[e]of this[p].entries())yield e}async*values(){for await(const[e,t]of this)yield t}[(z=p,Symbol.asyncIterator)](){return this.entries()}};if(Object.defineProperty(_.prototype,Symbol.toStringTag,{value:"FileSystemDirectoryHandle",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(_.prototype,{getDirectoryHandle:{enumerable:!0},entries:{enumerable:!0},getFileHandle:{enumerable:!0},removeEntry:{enumerable:!0}}),globalThis.FileSystemDirectoryHandle){const r=globalThis.FileSystemDirectoryHandle.prototype;r.resolve=async function(s){if(await s.isSameEntry(this))return[];const i=[{handle:this,path:[]}];for(;i.length;){let{handle:l,path:y}=i.pop();for await(const o of l.values()){if(await o.isSameEntry(s))return[...y,o.name];o.kind==="directory"&&i.push({handle:o,path:[...y,o.name]})}}return null};async function e(s){if(await(await navigator.storage.getDirectory()).resolve(s)===null)throw new DOMException(...oe)}const t=r.entries;r.entries=async function*(){await e(this),yield*t.call(this)},r[Symbol.asyncIterator]=async function*(){yield*this.entries()};const n=r.removeEntry;r.removeEntry=async function(s,i={}){return n.call(this,s,i).catch(async l=>{throw l instanceof DOMException&&l.name==="UnknownError"&&!i.recursive&&!(await t.call(this).next()).done?new DOMException(...le):l})}}const T=Object.freeze(Object.defineProperty({__proto__:null,FileSystemDirectoryHandle:_,default:_},Symbol.toStringTag,{value:"Module"})),{INVALID:ce,SYNTAX:k,GONE:ye}=H,P=Symbol("adapter");var U,C;class F extends(C=v,U=P,C){constructor(e){super(e),g(this,U),this[P]=e}async createWritable(e={}){return new b(await this[P].createWritable(e))}async getFile(){return this[P].getFile()}}if(Object.defineProperty(F.prototype,Symbol.toStringTag,{value:"FileSystemFileHandle",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(F.prototype,{createWritable:{enumerable:!0},getFile:{enumerable:!0}}),globalThis.FileSystemFileHandle&&!globalThis.FileSystemFileHandle.prototype.createWritable){const r=new WeakMap;let e;const t=()=>{let s,i;onmessage=async l=>{const y=l.ports[0],o=l.data;switch(o.type){case"open":const d=o.name;let w=await navigator.storage.getDirectory();for(const h of o.path)w=await w.getDirectoryHandle(h);s=await w.getFileHandle(d),i=await s.createSyncAccessHandle();break;case"write":i.write(o.data,{at:o.position}),i.flush();break;case"truncate":i.truncate(o.size);break;case"abort":case"close":i.close();break}y.postMessage(0)}};globalThis.FileSystemFileHandle.prototype.createWritable=async function(s){if(!e){const a=`(${t.toString()})()`,S=new Blob([a],{type:"text/javascript"});e=URL.createObjectURL(S)}const i=new Worker(e,{type:"module"});let l=0;const y=new TextEncoder;let o=await this.getFile().then(a=>a.size);const d=a=>new Promise((S,de)=>{const E=new MessageChannel;E.port1.onmessage=I=>{I.data instanceof Error?de(I.data):S(I.data),E.port1.close(),E.port2.close(),E.port1.onmessage=null},i.postMessage(a,[E.port2])}),w=await navigator.storage.getDirectory(),h=await r.get(this),f=await w.resolve(h);if(f===null)throw new DOMException(...ye);return await d({type:"open",path:f,name:this.name}),(s==null?void 0:s.keepExistingData)===!1&&(await d({type:"truncate",size:0}),o=0),new b({start:a=>{},async write(a){if((a==null?void 0: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(...k("write requires a data argument"));if(a.position??(a.position=l),typeof a.data=="string")a.data=y.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 S=await new Response(a.data).arrayBuffer();a.data=new Uint8Array(S)}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(...ce);console.log("seeking",a),l=a.position;return}else throw await d({type:"close"}),new DOMException(...k("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(...k("truncate requires a size argument"));await d(a)},async close(){await d({type:"close"}),i.terminate()},async abort(a){await d({type:"abort",reason:a}),i.terminate()}})};const n=FileSystemDirectoryHandle.prototype.getFileHandle;FileSystemDirectoryHandle.prototype.getFileHandle=async function(...s){const i=await n.call(this,...s);return r.set(i,this),i}}let u;u=Object.freeze(Object.defineProperty({__proto__:null,FileSystemFileHandle:F,default:F},Symbol.toStringTag,{value:"Module"})),B=Object.freeze(Object.defineProperty({__proto__:null,FileSystemDirectoryHandle:_,FileSystemFileHandle:F,FileSystemHandle:v,FileSystemWritableFileStream:b,getOriginPrivateDirectory:re,showDirectoryPicker:Q,showOpenFilePicker:ee,showSaveFilePicker:te},Symbol.toStringTag,{value:"Module"}))});export{pe as __tla,B as a,A as c,H as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as it}from"./index-CVPZJuoC.js";function rt(x,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 x)){const M=Object.getOwnPropertyDescriptor(S,O);M&&Object.defineProperty(x,O,M.get?M:{enumerable:!0,get:()=>S[O]})}}}return Object.freeze(Object.defineProperty(x,Symbol.toStringTag,{value:"Module"}))}var ke={exports:{}},Le;function at(){return Le||(Le=1,function(x){(function(u){if(typeof window>"u")return;var p=!0,S=10,O="",M=0,j="",J=null,ie="",D=!1,Fe={resize:1,click:1},U=128,re=!0,R=1,_="bodyOffset",h=_,ae=!0,ce="",k={},I=32,ue=null,V=!1,X=!1,q="[iFrameSizer]",se=q.length,H="",de={max:1,min:1,bodyScroll:1,documentElementScroll:1},Y="child",le=window.parent,L="*",K=0,W=!1,fe=null,P=16,F=1,me="scroll",v=me,je=window,Q=function(){T("onMessage function not defined")},G=function(){},Z=function(){},$={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 z(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,d=0,m=function(){d=Date.now(),a=null,o=e.apply(t,n),a||(t=n=null)};return function(){var f=Date.now();d||(d=f);var c=P-(f-d);return t=this,n=arguments,c<=0||c>P?(a&&(clearTimeout(a),a=null),d=f,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){V&&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(),_e(),te("background",O),te("padding",ie),Ke(),Te(),Ee(),Ve(),Ze(),Ge(),Oe(),k=Qe(),A("init","Init message from host page"),G()}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]),V=u===t[3]?V: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],X=u===t[15]?X: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,G="onReady"in n?n.onReady:G,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"),$[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 _e(){u===j&&(j=M+"px"),te("margin",Ue("margin",j))}function Ve(){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,z(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,_,E,"height")}function Ee(){v=be(v,me,N,"width")}function Oe(){p===!0?(we("add"),et()):i("Auto Resize disabled")}function Xe(){J!==null&&J.disconnect()}function Ye(){we("remove"),Xe(),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(),l=e();return{x:parseInt(s.left,10)+parseInt(l.x,10),y:parseInt(s.top,10)+parseInt(l.y,10)}}function n(c){function s(b){var C=t(b);i("Moving to in page link (#"+l+") at x: "+C.x+" y: "+C.y),y(C.y,C.x,"scrollToOffset")}var l=c.split("#")[1]||c,r=decodeURIComponent(l),w=document.getElementById(r)||document.getElementsByName(r)[0];u===w?(i("In page link (#"+l+") not found in iFrame, so sending to parent"),y(0,0,"inPageLink","#"+l)):s(w)}function o(){var c=window.location.hash,s=window.location.href;c!==""&&c!=="#"&&n(s)}function a(){function c(s){function l(r){r.preventDefault(),n(this.getAttribute("href"))}s.getAttribute("href")!=="#"&&z(s,"click",l)}Array.prototype.forEach.call(document.querySelectorAll('a[href^="#"]'),c)}function d(){z(window,"hashchange",o)}function m(){setTimeout(o,U)}function f(){Array.prototype.forEach&&document.querySelectorAll?(i("Setting up location.hash handlers"),a(),d(),m()):T("In page linking not fully supported in this browser! (See README.md for IE8 workaround)")}return k.enable?f():i("In page linking not enabled"),{findTarget:n}}function Ge(){if(X!==!0)return;function e(n){y(0,0,n.type,n.screenY+":"+n.screenX)}function t(n,o){i("Add event listener: "+o),z(window.document,n,e)}t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave")}function Ze(){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"?(Z=e,y(0,0,"pageInfo")):(Z=function(){},y(0,0,"pageInfoStop"))},moveToAnchor:function(e){k.findTarget(e)},reset:function(){Ce("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 $e(){function e(r){function w(b){b.complete===!1&&(i("Attach listeners to "+b.src),b.addEventListener("load",a,!1),b.addEventListener("error",d,!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",d,!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 d(r){o(r,"imageLoadFailed","Image load failed")}function m(r){A("mutationObserver","mutationObserver: "+r[0].target+" "+r[0].type),r.forEach(e)}function f(){var r=document.querySelector("body"),w={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0};return l=new s(m),i("Create body MutationObserver"),l.observe(r,w),l}var c=[],s=window.MutationObserver||window.WebKitMutationObserver,l=f();return{disconnect:function(){"disconnect"in l&&(i("Disconnect body MutationObserver"),l.disconnect(),c.forEach(n))}}}function et(){var e=0>I;window.MutationObserver||window.WebKitMutationObserver?e?Se():J=$e():(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>P/2&&(P=2*e,i("Event throttle increased to "+P+"ms"))}function oe(e,t){for(var n=t.length,o=0,a=0,d=ve(e),m=Date.now(),f=0;f<n;f++)o=t[f].getBoundingClientRect()[e]+ne("margin"+d,t[f]),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 $.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 $.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=l,F=r,y(R,F,e)}function d(){function w(b,C){var ot=Math.abs(b-C)<=K;return!ot}return l=u===n?E[h]():n,r=u===o?N[v]():o,w(R,l)||D&&w(F,r)}function m(){return!(e in{init:1,interval:1,size:1})}function f(){return h in de||D&&v in de}function c(){i("No change in size detected")}function s(){m()&&f()?Ce(t):e in{interval:1}||c()}var l,r;d()||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 d(){return W&&e in Fe}d()?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(fe),fe=setTimeout(function(){W=!1,i("Trigger event lock off"),i("--")},U)}function ze(e){R=E[h](),F=N[v](),y(R,F,e)}function Ce(e){var t=h;h=_,i("Reset trigger event: "+e),Ae(),ze("reset"),h=t}function y(e,t,n,o,a){function d(){u===a?a=L:i("Message targetOrigin: "+a)}function m(){var f=e+":"+t,c=H+":"+f+":"+n+(u===o?"":":"+o);i("Sending message to host page ("+c+")"),le.postMessage(q+c,a)}d(),m()}function xe(e){var t={init:function(){ce=e.data,le=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"),ze("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),Z(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 d(){return!x.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 f(){var s=o();s in t?t[s]():!d()&&!m()&&T("Unexpected message ("+e.data+")")}function c(){re===!1?f():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){xe({data:e})},z(window,"message",xe),z(window,"readystatechange",Re),Re())})()}(ke)),ke.exports}var Pe=at();const ct=it(Pe),ut=rt({__proto__:null,default:ct},[Pe]);export{ut as i};
|
|
1
|
+
import{g as it}from"./index-Cbvbjd8C.js";function rt(x,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 x)){const M=Object.getOwnPropertyDescriptor(S,O);M&&Object.defineProperty(x,O,M.get?M:{enumerable:!0,get:()=>S[O]})}}}return Object.freeze(Object.defineProperty(x,Symbol.toStringTag,{value:"Module"}))}var ke={exports:{}},Le;function at(){return Le||(Le=1,function(x){(function(u){if(typeof window>"u")return;var p=!0,S=10,O="",M=0,j="",J=null,ie="",D=!1,Fe={resize:1,click:1},U=128,re=!0,R=1,_="bodyOffset",h=_,ae=!0,ce="",k={},I=32,ue=null,V=!1,X=!1,q="[iFrameSizer]",se=q.length,H="",de={max:1,min:1,bodyScroll:1,documentElementScroll:1},Y="child",le=window.parent,L="*",K=0,W=!1,fe=null,P=16,F=1,me="scroll",v=me,je=window,Q=function(){T("onMessage function not defined")},G=function(){},Z=function(){},$={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 z(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,d=0,m=function(){d=Date.now(),a=null,o=e.apply(t,n),a||(t=n=null)};return function(){var f=Date.now();d||(d=f);var c=P-(f-d);return t=this,n=arguments,c<=0||c>P?(a&&(clearTimeout(a),a=null),d=f,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){V&&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(),_e(),te("background",O),te("padding",ie),Ke(),Te(),Ee(),Ve(),Ze(),Ge(),Oe(),k=Qe(),A("init","Init message from host page"),G()}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]),V=u===t[3]?V: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],X=u===t[15]?X: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,G="onReady"in n?n.onReady:G,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"),$[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 _e(){u===j&&(j=M+"px"),te("margin",Ue("margin",j))}function Ve(){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,z(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,_,E,"height")}function Ee(){v=be(v,me,N,"width")}function Oe(){p===!0?(we("add"),et()):i("Auto Resize disabled")}function Xe(){J!==null&&J.disconnect()}function Ye(){we("remove"),Xe(),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(),l=e();return{x:parseInt(s.left,10)+parseInt(l.x,10),y:parseInt(s.top,10)+parseInt(l.y,10)}}function n(c){function s(b){var C=t(b);i("Moving to in page link (#"+l+") at x: "+C.x+" y: "+C.y),y(C.y,C.x,"scrollToOffset")}var l=c.split("#")[1]||c,r=decodeURIComponent(l),w=document.getElementById(r)||document.getElementsByName(r)[0];u===w?(i("In page link (#"+l+") not found in iFrame, so sending to parent"),y(0,0,"inPageLink","#"+l)):s(w)}function o(){var c=window.location.hash,s=window.location.href;c!==""&&c!=="#"&&n(s)}function a(){function c(s){function l(r){r.preventDefault(),n(this.getAttribute("href"))}s.getAttribute("href")!=="#"&&z(s,"click",l)}Array.prototype.forEach.call(document.querySelectorAll('a[href^="#"]'),c)}function d(){z(window,"hashchange",o)}function m(){setTimeout(o,U)}function f(){Array.prototype.forEach&&document.querySelectorAll?(i("Setting up location.hash handlers"),a(),d(),m()):T("In page linking not fully supported in this browser! (See README.md for IE8 workaround)")}return k.enable?f():i("In page linking not enabled"),{findTarget:n}}function Ge(){if(X!==!0)return;function e(n){y(0,0,n.type,n.screenY+":"+n.screenX)}function t(n,o){i("Add event listener: "+o),z(window.document,n,e)}t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave")}function Ze(){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"?(Z=e,y(0,0,"pageInfo")):(Z=function(){},y(0,0,"pageInfoStop"))},moveToAnchor:function(e){k.findTarget(e)},reset:function(){Ce("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 $e(){function e(r){function w(b){b.complete===!1&&(i("Attach listeners to "+b.src),b.addEventListener("load",a,!1),b.addEventListener("error",d,!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",d,!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 d(r){o(r,"imageLoadFailed","Image load failed")}function m(r){A("mutationObserver","mutationObserver: "+r[0].target+" "+r[0].type),r.forEach(e)}function f(){var r=document.querySelector("body"),w={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0};return l=new s(m),i("Create body MutationObserver"),l.observe(r,w),l}var c=[],s=window.MutationObserver||window.WebKitMutationObserver,l=f();return{disconnect:function(){"disconnect"in l&&(i("Disconnect body MutationObserver"),l.disconnect(),c.forEach(n))}}}function et(){var e=0>I;window.MutationObserver||window.WebKitMutationObserver?e?Se():J=$e():(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>P/2&&(P=2*e,i("Event throttle increased to "+P+"ms"))}function oe(e,t){for(var n=t.length,o=0,a=0,d=ve(e),m=Date.now(),f=0;f<n;f++)o=t[f].getBoundingClientRect()[e]+ne("margin"+d,t[f]),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 $.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 $.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=l,F=r,y(R,F,e)}function d(){function w(b,C){var ot=Math.abs(b-C)<=K;return!ot}return l=u===n?E[h]():n,r=u===o?N[v]():o,w(R,l)||D&&w(F,r)}function m(){return!(e in{init:1,interval:1,size:1})}function f(){return h in de||D&&v in de}function c(){i("No change in size detected")}function s(){m()&&f()?Ce(t):e in{interval:1}||c()}var l,r;d()||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 d(){return W&&e in Fe}d()?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(fe),fe=setTimeout(function(){W=!1,i("Trigger event lock off"),i("--")},U)}function ze(e){R=E[h](),F=N[v](),y(R,F,e)}function Ce(e){var t=h;h=_,i("Reset trigger event: "+e),Ae(),ze("reset"),h=t}function y(e,t,n,o,a){function d(){u===a?a=L:i("Message targetOrigin: "+a)}function m(){var f=e+":"+t,c=H+":"+f+":"+n+(u===o?"":":"+o);i("Sending message to host page ("+c+")"),le.postMessage(q+c,a)}d(),m()}function xe(e){var t={init:function(){ce=e.data,le=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"),ze("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),Z(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 d(){return!x.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 f(){var s=o();s in t?t[s]():!d()&&!m()&&T("Unexpected message ("+e.data+")")}function c(){re===!1?f():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){xe({data:e})},z(window,"message",xe),z(window,"readystatechange",Re),Re())})()}(ke)),ke.exports}var Pe=at();const ct=it(Pe),ut=rt({__proto__:null,default:ct},[Pe]);export{ut as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as l,r as n,u as T,j as m,l as y}from"./index-
|
|
1
|
+
import{c as l,r as n,u as T,j as m,l as y}from"./index-Cbvbjd8C.js";const A=l("div",{target:"exyuj7n1"})(()=>({lineHeight:0}),""),L=l("audio",{target:"exyuj7n0"})(({theme:r})=>({width:"100%",height:r.sizes.minElementHeight,margin:0,padding:0}),""),h=y.getLogger("Audio");function x({element:r,endpoints:a,elementMgr:d}){const o=n.useRef(null),{startTime:i,endTime:u,loop:s,autoplay:f}=r,E=n.useMemo(()=>{if(!r.id)return!0;const e=d.getElementState(r.id,"preventAutoplay");return e||d.setElementState(r.id,"preventAutoplay",!0),e??!1},[r.id,d]);n.useEffect(()=>{o.current&&(o.current.currentTime=i)},[i]),n.useEffect(()=>{const e=o.current,t=()=>{e&&(e.currentTime=r.startTime)};return e&&e.addEventListener("loadedmetadata",t),()=>{e&&e.removeEventListener("loadedmetadata",t)}},[r]),n.useEffect(()=>{const e=o.current;if(!e)return;let t=!1;const c=()=>{u>0&&e.currentTime>=u&&(s?(e.currentTime=i||0,e.play()):t||(t=!0,e.pause()))};return u>0&&e.addEventListener("timeupdate",c),()=>{e&&u>0&&e.removeEventListener("timeupdate",c)}},[u,s,i]),n.useEffect(()=>{const e=o.current;if(!e)return;const t=()=>{s&&(e.currentTime=i||0,e.play())};return e.addEventListener("ended",t),()=>{e&&e.removeEventListener("ended",t)}},[s,i]);const g=T(r.url),p=a.buildMediaURL(g),v=e=>{const t=e.currentTarget.src;h.error(`Client Error: Audio source error - ${t}`),a.sendClientErrorToHost("Audio","Audio source failed to load","onerror triggered",t)};return m.jsx(A,{children:m.jsx(L,{className:"stAudio","data-testid":"stAudio",ref:o,controls:!0,autoPlay:f&&!E,src:p,onError:v})})}const j=n.memo(x);export{j as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as s,bB as C,I as b,bC as i,r as p,bD as t,j as a,bE as f,bF as v,bG as x}from"./index-
|
|
1
|
+
import{c as s,bB as C,I as b,bC as i,r as p,bD as t,j as a,bE as f,bF as v,bG as x}from"./index-Cbvbjd8C.js";function k(o,r){switch(o){case i.XSMALL:return{padding:`${r.spacing.twoXS} ${r.spacing.sm}`,fontSize:r.fontSizes.sm};case i.SMALL:return{padding:`${r.spacing.twoXS} ${r.spacing.md}`};case i.LARGE:return{padding:`${r.spacing.md} ${r.spacing.md}`};default:return{padding:`${r.spacing.xs} ${r.spacing.md}`}}}const c=s("a",{target:"e16zdaao3"})(({containerWidth:o,size:r,theme:e})=>({display:"inline-flex",alignItems:"center",justifyContent:"center",fontWeight:e.fontWeights.normal,padding:`${e.spacing.xs} ${e.spacing.md}`,borderRadius:e.radii.default,minHeight:e.sizes.minElementHeight,margin:0,lineHeight:e.lineHeights.base,color:e.colors.primary,textDecoration:"none",width:o?"100%":"auto",userSelect:"none","&:visited":{color:e.colors.primary},"&:focus":{outline:"none"},"&:focus-visible":{boxShadow:`0 0 0 0.2rem ${b(e.colors.primary,.5)}`},"&:hover":{textDecoration:"none"},"&:active":{textDecoration:"none"},...k(r,e)}),""),$=s(c,{target:"e16zdaao2"})(({theme:o})=>({backgroundColor:o.colors.primary,color:o.colors.white,border:`${o.sizes.borderWidth} solid ${o.colors.primary}`,"&:hover":{backgroundColor:C(o.colors.primary,.05),color:o.colors.white},"&:active":{backgroundColor:"transparent",color:o.colors.primary},"&:visited:not(:active)":{color:o.colors.white},"&[disabled], &[disabled]:hover, &[disabled]:active, &[disabled]:visited":{borderColor:o.colors.borderColor,backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}}),""),w=s(c,{target:"e16zdaao1"})(({theme:o})=>({backgroundColor:o.colors.lightenedBg05,color:o.colors.bodyText,border:`${o.sizes.borderWidth} solid ${o.colors.borderColor}`,"&:visited":{color:o.colors.bodyText},"&:hover":{borderColor:o.colors.primary,color:o.colors.primary},"&:active":{color:o.colors.white,borderColor:o.colors.primary,backgroundColor:o.colors.primary},"&:focus:not(:active)":{borderColor:o.colors.primary,color:o.colors.primary},"&[disabled], &[disabled]:hover, &[disabled]:active":{borderColor:o.colors.borderColor,backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}}),""),z=s(c,{target:"e16zdaao0"})(({theme:o})=>({padding:o.spacing.none,backgroundColor:o.colors.transparent,color:o.colors.bodyText,border:"none","&:visited":{color:o.colors.bodyText},"&:hover":{color:o.colors.primary},"&:active":{color:o.colors.primary},"&:focus":{outline:"none"},"&:focus-visible":{color:o.colors.primary,boxShadow:`0 0 0 0.2rem ${b(o.colors.primary,.5)}`},"&[disabled], &[disabled]:hover, &[disabled]:active":{backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}}),"");function S({kind:o,size:r,disabled:e,containerWidth:l,children:n,autoFocus:u,href:h,rel:m,target:g,onClick:y}){let d=$;return o===t.SECONDARY?d=w:o===t.TERTIARY&&(d=z),a.jsx(d,{kind:o,size:r||i.MEDIUM,containerWidth:l||!1,disabled:e||!1,autoFocus:u||!1,href:h,target:g,rel:m,onClick:y,tabIndex:e?-1:0,"data-testid":`stBaseLinkButton-${o}`,children:n})}const T=p.memo(S);function L(o){const{element:r}=o;let e=t.SECONDARY;r.type==="primary"?e=t.PRIMARY:r.type==="tertiary"&&(e=t.TERTIARY);const l=n=>{r.disabled&&n.preventDefault()};return a.jsx(f,{className:"stLinkButton","data-testid":"stLinkButton",children:a.jsx(v,{help:r.help,containerWidth:r.useContainerWidth,children:a.jsx(T,{kind:e,size:i.SMALL,disabled:r.disabled,onClick:l,containerWidth:r.useContainerWidth,href:r.url,target:"_blank",rel:"noreferrer","aria-disabled":r.disabled,children:a.jsx(x,{icon:r.icon,label:r.label})})})})}const R=p.memo(L);export{R as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as i,k as r,r as l,j as t}from"./index-
|
|
1
|
+
import{c as i,k as r,r as l,j as t}from"./index-Cbvbjd8C.js";import{R as m,P as p}from"./RenderInPortalIfExists-BozYGWdi.js";const c="/assets/balloon-0.Czj7AKwE.png",g="/assets/balloon-1.CNvFFrND.png",d="/assets/balloon-2.DTvC6B1t.png",x="/assets/balloon-3.CgSk4tbL.png",f="/assets/balloon-4.mbtFrzxf.png",b="/assets/balloon-5.CSwkUfRA.png",n=300,h=121,s=20,u=80,C=1e3,N=r`
|
|
2
2
|
from {
|
|
3
3
|
transform: translateY(calc(100vh + ${n}px));
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var aG=Object.defineProperty,lG=(e,t,i)=>t in e?aG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,z=(e,t,i)=>lG(e,typeof t!="symbol"?t+"":t,i);import{r as Ie,as as wi,bm as ge,g as Jh,bn as Nu,_ as BB,b0 as cG,j as ir,bo as Kv,bp as Qv,bq as uG,br as hG,bs as TB,b7 as fG,bt as dG,c as SB,D as IB,b6 as MB,S as Zv,bu as PB,b3 as pG,A as AG,bv as gG,bw as RB}from"./index-
|
|
1
|
+
var aG=Object.defineProperty,lG=(e,t,i)=>t in e?aG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,z=(e,t,i)=>lG(e,typeof t!="symbol"?t+"":t,i);import{r as Ie,as as wi,bm as ge,g as Jh,bn as Nu,_ as BB,b0 as cG,j as ir,bo as Kv,bp as Qv,bq as uG,br as hG,bs as TB,b7 as fG,bt as dG,c as SB,D as IB,b6 as MB,S as Zv,bu as PB,b3 as pG,A as AG,bv as gG,bw as RB}from"./index-Cbvbjd8C.js";import{_ as po,C as mG}from"./slicedToArray-CEuyIGI5.js";import{a as Uu,b as Gu,_ as Yv,c as _d,d as $v}from"./inherits-BaopKHev.js";import{T as yG,a as _G}from"./Toolbar-DlGOP7h4.js";import{E as FB,w as vG}from"./withFullScreenWrapper-D8NJOCKn.js";import{u as bG}from"./useBasicWidgetState-D3a9XYx3.js";import{u as xG,s as wG}from"./threshold-CqET7LYC.js";import{a as CG}from"./index-xsH4HHeE.js";import"./FormClearHelper-CT0Jwp4X.js";import"./value-CgPGBV_l.js";function EG(e,t){for(var i=0;i<t.length;i++){const n=t[i];if(typeof n!="string"&&!Array.isArray(n)){for(const r in n)if(r!=="default"&&!(r in e)){const s=Object.getOwnPropertyDescriptor(n,r);s&&Object.defineProperty(e,r,s.get?s:{enumerable:!0,get:()=>n[r]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const zu={};function Jm(e,t){if(!e)throw new Error(t||"loader assertion failed.")}const qv=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),OB=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);OB&&parseFloat(OB[1]);const t1=globalThis,Xm=globalThis.process||{};function BG(e){var t,i;if(typeof window<"u"&&((t=window.process)==null?void 0:t.type)==="renderer"||typeof process<"u"&&(i=process.versions)!=null&&i.electron)return!0;const n=typeof navigator<"u"&&navigator.userAgent;return!!(n&&n.indexOf("Electron")>=0)}function e1(){return!(typeof process=="object"&&String(process)==="[object process]"&&!(process!=null&&process.browser))||BG()}const LB="4.0.7";function TG(e){try{const t=window[e],i="__storage_test__";return t.setItem(i,i),t.removeItem(i),t}catch{return null}}let SG=class{constructor(e,t,i="sessionStorage"){this.storage=TG(i),this.id=e,this.config=t,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){const t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}}_loadConfiguration(){let e={};if(this.storage){const t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}};function IG(e){let t;return e<10?t=`${e.toFixed(2)}ms`:e<100?t=`${e.toFixed(1)}ms`:e<1e3?t=`${e.toFixed(0)}ms`:t=`${(e/1e3).toFixed(2)}s`,t}function MG(e,t=8){const i=Math.max(t-e.length,0);return`${" ".repeat(i)}${e}`}var Km;(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Km||(Km={}));const PG=10;function DB(e){return typeof e!="string"?e:(e=e.toUpperCase(),Km[e]||Km.WHITE)}function RG(e,t,i){return!e1&&typeof e=="string"&&(t&&(e=`\x1B[${DB(t)}m${e}\x1B[39m`),i&&(e=`\x1B[${DB(i)+PG}m${e}\x1B[49m`)),e}function FG(e,t=["constructor"]){const i=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(i),r=e;for(const s of n){const o=r[s];typeof o=="function"&&(t.find(l=>s===l)||(r[s]=o.bind(e)))}}function i1(e,t){if(!e)throw new Error("Assertion failed")}function vd(){var e,t,i;let n;if(e1()&&t1.performance)n=(t=(e=t1==null?void 0:t1.performance)==null?void 0:e.now)==null?void 0:t.call(e);else if("hrtime"in Xm){const r=(i=Xm==null?void 0:Xm.hrtime)==null?void 0:i.call(Xm);n=r[0]*1e3+r[1]/1e6}else n=Date.now();return n}const bd={debug:e1()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},OG={enabled:!0,level:0};function xd(){}const kB={},NB={once:!0};let UB=class{constructor({id:e}={id:""}){this.VERSION=LB,this._startTs=vd(),this._deltaTs=vd(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new SG(`__probe-${this.id}__`,OG),this.timeStamp(`${this.id} started`),FG(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((vd()-this._startTs).toPrecision(10))}getDelta(){return Number((vd()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._storage.setConfiguration({enabled:e}),this}setLevel(e){return this._storage.setConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,t){this._storage.setConfiguration({[e]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,t){if(!e)throw new Error(t||"Assertion failed")}warn(e){return this._getLogFunction(0,e,bd.warn,arguments,NB)}error(e){return this._getLogFunction(0,e,bd.error,arguments)}deprecated(e,t){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${t}\` instead`)}removed(e,t){return this.error(`\`${e}\` has been removed. Use \`${t}\` instead`)}probe(e,t){return this._getLogFunction(e,t,bd.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,bd.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){return this._getLogFunction(e,t,bd.debug||bd.info,arguments,NB)}table(e,t,i){return t?this._getLogFunction(e,t,console.table||xd,i&&[i],{tag:DG(t)}):xd}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||xd)}group(e,t,i={collapsed:!1}){const n=zB({logLevel:e,message:t,opts:i}),{collapsed:r}=i;return n.method=(r?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(e,t,i={}){return this.group(e,t,Object.assign({},i,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||xd)}withGroup(e,t,i){this.group(e,t)();try{i()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=GB(e)}_getLogFunction(e,t,i,n,r){if(this._shouldLog(e)){r=zB({logLevel:e,message:t,args:n,opts:r}),i=i||r.method,i1(i),r.total=this.getTotal(),r.delta=this.getDelta(),this._deltaTs=vd();const s=r.tag||r.message;if(r.once&&s)if(!kB[s])kB[s]=vd();else return xd;return t=LG(this.id,r.message,r),i.bind(console,t,...r.args)}return xd}};UB.VERSION=LB;function GB(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return i1(Number.isFinite(t)&&t>=0),t}function zB(e){const{logLevel:t,message:i}=e;e.logLevel=GB(t);const n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==i;);switch(typeof t){case"string":case"function":i!==void 0&&n.unshift(i),e.message=t;break;case"object":Object.assign(e,t);break}typeof e.message=="function"&&(e.message=e.message());const r=typeof e.message;return i1(r==="string"||r==="object"),Object.assign(e,{args:n},e.opts)}function LG(e,t,i){if(typeof t=="string"){const n=i.time?MG(IG(i.total)):"";t=i.time?`${e}: ${n} ${t}`:`${e}: ${t}`,t=RG(t,i.color,i.background)}return t}function DG(e){for(const t in e)for(const i in e[t])return i||"untitled";return"empty"}const n1="4.3.1",kG=n1[0]>="0"&&n1[0]<="9"?`v${n1}`:"";function NG(){const e=new UB({id:"loaders.gl"});return globalThis.loaders=globalThis.loaders||{},globalThis.loaders.log=e,globalThis.loaders.version=kG,globalThis.probe=globalThis.probe||{},globalThis.probe.loaders=e,e}const UG=NG();function GG(e,t){return VB(e||{},t)}function VB(e,t,i=0){if(i>3)return t;const n={...e};for(const[r,s]of Object.entries(t))s&&typeof s=="object"&&!Array.isArray(s)?n[r]=VB(n[r]||{},t[r],i+1):n[r]=t[r];return n}const zG="latest";function VG(){var e;return(e=globalThis._loadersgl_)!=null&&e.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.3.1"),globalThis._loadersgl_.version}const jG=VG();function Vu(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}const Xh=typeof process!="object"||String(process)!=="[object process]"||process.browser,HG=typeof window<"u"&&typeof window.orientation<"u",jB=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);jB&&parseFloat(jB[1]);let WG=class{constructor(e,t){z(this,"name"),z(this,"workerThread"),z(this,"isRunning",!0),z(this,"result"),z(this,"_resolve",()=>{}),z(this,"_reject",()=>{}),this.name=e,this.workerThread=t,this.result=new Promise((i,n)=>{this._resolve=i,this._reject=n})}postMessage(e,t){this.workerThread.postMessage({source:"loaders.gl",type:e,payload:t})}done(e){Vu(this.isRunning),this.isRunning=!1,this._resolve(e)}error(e){Vu(this.isRunning),this.isRunning=!1,this._reject(e)}},r1=class{terminate(){}};const o1=new Map;function JG(e){Vu(e.source&&!e.url||!e.source&&e.url);let t=o1.get(e.source||e.url);return t||(e.url&&(t=XG(e.url),o1.set(e.url,t)),e.source&&(t=HB(e.source),o1.set(e.source,t))),Vu(t),t}function XG(e){if(!e.startsWith("http"))return e;const t=KG(e);return HB(t)}function HB(e){const t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}function KG(e){return`try {
|
|
2
2
|
importScripts('${e}');
|
|
3
3
|
} catch (error) {
|
|
4
4
|
console.error(error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,bP as w,A as H,c_ as x,j as s,bZ as _,b_ as A,cc as D,b$ as E,bI as P}from"./index-
|
|
1
|
+
import{r,bP as w,A as H,c_ as x,j as s,bZ as _,b_ as A,cc as D,b$ as E,bI as P}from"./index-Cbvbjd8C.js";import{u as U}from"./uniqueId-BSuwhGjw.js";import{u as B,a as L,b as M}from"./useOnInputChange-BlFu2GNS.js";import{I as $}from"./InputInstructions-Cyg7opie.js";import{a as G}from"./useBasicWidgetState-D3a9XYx3.js";import{T as K}from"./textarea-BKB-3cBX.js";import"./inputUtils-CQWz5UKz.js";import"./FormClearHelper-CT0Jwp4X.js";import"./base-input-BnIlcFzX.js";const W=(a,e)=>a.getStringValue(e)??e.default??null,N=a=>a.default??null,O=a=>a.value??null,Z=(a,e,i,d)=>{e.setStringValue(a,i.value,{fromUi:i.fromUi},d)},q=({disabled:a,element:e,widgetMgr:i,fragmentId:d})=>{var h;const b=r.useRef(U("text_area_")).current,[I,S]=w(),[l,m]=r.useState(!1),[v,c]=r.useState(!1),[o,n]=r.useState(()=>W(i,e)??null),C=r.useCallback(()=>{n(e.default??null),m(!0)},[e]),[T,u]=G({getStateFromWidgetMgr:W,getDefaultStateFromProto:N,getCurrStateFromProto:O,updateWidgetMgrState:Z,element:e,widgetMgr:i,fragmentId:d,onFormCleared:C});B(T,o,n,l);const t=H(),g=r.useCallback(()=>{m(!1),u({value:o,fromUi:!0})},[o,u]),y=r.useCallback(()=>{l&&g(),c(!1)},[l,g]),F=r.useCallback(()=>{c(!0)},[]),j=L({formId:e.formId,maxChars:e.maxChars,setDirty:m,setUiValue:n,setValueWithSource:u}),z=M(e.formId,g,l,i,d,!0),{height:f,placeholder:R,formId:p}=e,V=x({formId:p})?i.allowFormEnterToSubmit(p):l,k=v&&I>t.breakpoints.hideWidgetDetails;return s.jsxs("div",{className:"stTextArea","data-testid":"stTextArea",ref:S,children:[s.jsx(_,{label:e.label,disabled:a,labelVisibility:A((h=e.labelVisibility)==null?void 0:h.value),htmlFor:b,children:e.help&&s.jsx(D,{children:s.jsx(E,{content:e.help,placement:P.TOP_RIGHT})})}),s.jsx(K,{value:o??"",placeholder:R,onBlur:y,onFocus:F,onChange:j,onKeyDown:z,"aria-label":e.label,disabled:a,id:b,overrides:{Input:{style:{lineHeight:t.lineHeights.inputWidget,height:f?`${f}px`:"",minHeight:t.sizes.largestElementHeight,resize:"vertical","::placeholder":{opacity:"0.7"},paddingRight:t.spacing.md,paddingLeft:t.spacing.md,paddingBottom:t.spacing.md,paddingTop:t.spacing.md}},Root:{props:{"data-testid":"stTextAreaRootElement"},style:{borderLeftWidth:t.sizes.borderWidth,borderRightWidth:t.sizes.borderWidth,borderTopWidth:t.sizes.borderWidth,borderBottomWidth:t.sizes.borderWidth}}}}),k&&s.jsx($,{dirty:l,value:o??"",maxLength:e.maxChars,type:"multiline",inForm:x({formId:p}),allowEnterToSubmit:V})]})},J=r.memo(q);export{J as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as S,E as R,_ as E,c as x,I as q,j as h,c0 as Q,bI as z,bW as J,bD as Z,bX as O,c8 as _,e as K,g as Y,bf as ee,A as te,c9 as re,ca as ie,cb as se,R as oe,l as ae,b3 as ne,L as P,bT as le,bS as de,bZ as ce,b_ as ue,cc as he,b$ as pe}from"./index-CVPZJuoC.js";import{a as V}from"./index-xsH4HHeE.js";import{F as ge}from"./FormClearHelper-DI9KwuTl.js";import{U as L}from"./UploadFileInfo-C-jY39rj.js";import{P as fe,S as me}from"./ProgressBar-DalMRT-4.js";var D=S.forwardRef(function(i,l){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return S.createElement(R,E({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},i,{ref:l}),S.createElement("path",{d:"M.5 1c-.28 0-.5.23-.5.5v4c0 .28.23.5.5.5h5c.28 0 .5-.22.5-.5V4l1 1h1V2H7L6 3V1.5c0-.28-.22-.5-.5-.5h-5z"}))});D.displayName="Video";var W=S.forwardRef(function(i,l){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return S.createElement(R,E({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},i,{ref:l}),S.createElement("path",{d:"M1.41 0L0 1.41l.72.72L2.5 3.94.72 5.72 0 6.41l1.41 1.44.72-.72 1.81-1.81 1.78 1.81.69.72 1.44-1.44-.72-.69-1.81-1.78 1.81-1.81.72-.72L6.41 0l-.69.72L3.94 2.5 2.13.72 1.41 0z"}))});W.displayName="X";var $=S.forwardRef(function(i,l){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return S.createElement(R,E({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},i,{ref:l}),S.createElement("rect",{width:24,height:24,fill:"none"}),S.createElement("path",{d:"M20 5h-3.17l-1.24-1.35A1.99 1.99 0 0014.12 3H9.88c-.56 0-1.1.24-1.48.65L7.17 5H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm-1.35 8.35l-2.79 2.79c-.32.32-.86.1-.86-.35v-1.75H9v1.75c0 .45-.54.67-.85.35l-2.79-2.79c-.2-.2-.2-.51 0-.71l2.79-2.79a.5.5 0 01.85.36v1.83h6v-1.83c0-.45.54-.67.85-.35l2.79 2.79c.2.19.2.51.01.7z"}))});$.displayName="SwitchCamera";function ve(i,l){switch(i){case"xsmall":return{padding:`${l.spacing.twoXS} ${l.spacing.sm}`,fontSize:l.fontSizes.sm};case"small":return{padding:`${l.spacing.twoXS} ${l.spacing.md}`};case"large":return{padding:`${l.spacing.md} ${l.spacing.md}`};default:return{padding:`${l.spacing.xs} ${l.spacing.md}`}}}const H=x("div",{target:"etz5kuj9"})({name:"b6gpc",styles:"position:relative;overflow:hidden;width:100%;object-fit:contain"}),T=x("div",{target:"etz5kuj8"})(({theme:i,width:l})=>({backgroundColor:i.colors.secondaryBg,borderRadius:`${i.radii.default} ${i.radii.default} 0 0`,width:"100%",height:l*9/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}),""),ye=x("p",{target:"etz5kuj7"})(({theme:i})=>({marginTop:i.spacing.sm,textAlign:"center"}),""),Se=x("img",{target:"etz5kuj6"})(({theme:i,opacity:l})=>({borderRadius:`${i.radii.default} ${i.radii.default} 0 0`,objectFit:"contain",opacity:l}),""),be=x("a",{target:"etz5kuj5"})(({theme:i})=>({color:i.colors.primary,display:"block",textDecoration:"none"}),""),we=x("span",{target:"etz5kuj4"})({name:"s5xdrg",styles:"display:flex;align-items:center"}),Me=x("div",{target:"etz5kuj3"})(({theme:i})=>({position:"absolute",top:i.spacing.lg,right:i.spacing.lg,zIndex:i.zIndices.priority,color:i.colors.fadedText40,mixBlendMode:"difference",opacity:.6}),""),Ue=x("div",{target:"etz5kuj1"})({name:"1yoks5w",styles:"height:fit-content;width:100%;position:absolute;bottom:0"}),Ce=x("button",{target:"etz5kuj0"})(({theme:i})=>({position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:i.colors.lightenedBg05,border:`${i.sizes.borderWidth} solid ${i.colors.borderColor}`,borderRadius:`0 0 ${i.radii.default} ${i.radii.default}`,"&:hover":{borderColor:i.colors.primary,color:i.colors.primary},"&:active":{color:i.colors.white,borderColor:i.colors.primary,backgroundColor:i.colors.primary},"&:focus:not(:active)":{borderColor:i.colors.primary,color:i.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:i.colors.fadedText40,borderColor:i.colors.borderColor,backgroundColor:i.colors.lightenedBg05,cursor:"not-allowed"},fontWeight:i.fontWeights.normal,padding:`${i.spacing.xs} ${i.spacing.md}`,margin:i.spacing.none,lineHeight:i.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{outline:"none"},"&:focus-visible":{boxShadow:`0 0 0 0.2rem ${q(i.colors.primary,.5)}`},...ve("medium",i)}),"");function xe({disabled:i,onClick:l,children:e,progress:o}){return h.jsxs(Ce,{disabled:i||!1,onClick:l||(()=>{}),progress:o||null,"data-testid":"stCameraInputButton",children:[e,o?h.jsx(Ue,{children:h.jsx(fe,{value:o,size:me.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarProgress:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarContainer:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}}}})}):null]})}const A=S.memo(xe);var F=(i=>(i.USER="user",i.ENVIRONMENT="environment",i))(F||{});const Ie=({switchFacingMode:i})=>h.jsx(Me,{"data-testid":"stCameraInputSwitchButton",children:h.jsx(Q,{content:"Switch camera",placement:z.TOP_RIGHT,children:h.jsx(J,{kind:Z.MINIMAL,onClick:i,children:h.jsx(O,{content:$,size:"twoXL",color:_.white})})})}),je=S.memo(Ie);var k={exports:{}},Pe=k.exports,N;function Fe(){return N||(N=1,function(i,l){(function(e,o){i.exports=o(K())})(Pe,function(e){return function(o){var a={};function s(n){if(a[n])return a[n].exports;var p=a[n]={i:n,l:!1,exports:{}};return o[n].call(p.exports,p,p.exports,s),p.l=!0,p.exports}return s.m=o,s.c=a,s.d=function(n,p,y){s.o(n,p)||Object.defineProperty(n,p,{enumerable:!0,get:y})},s.r=function(n){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},s.t=function(n,p){if(p&1&&(n=s(n)),p&8||p&4&&typeof n=="object"&&n&&n.__esModule)return n;var y=Object.create(null);if(s.r(y),Object.defineProperty(y,"default",{enumerable:!0,value:n}),p&2&&typeof n!="string")for(var C in n)s.d(y,C,(function(U){return n[U]}).bind(null,C));return y},s.n=function(n){var p=n&&n.__esModule?function(){return n.default}:function(){return n};return s.d(p,"a",p),p},s.o=function(n,p){return Object.prototype.hasOwnProperty.call(n,p)},s.p="",s(s.s="./src/react-webcam.tsx")}({"./src/react-webcam.tsx":function(o,a,s){s.r(a);var n=s("react"),p=function(){var g=function(u,t){return g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,c){r.__proto__=c}||function(r,c){for(var d in c)c.hasOwnProperty(d)&&(r[d]=c[d])},g(u,t)};return function(u,t){g(u,t);function r(){this.constructor=u}u.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),y=function(){return y=Object.assign||function(g){for(var u,t=1,r=arguments.length;t<r;t++){u=arguments[t];for(var c in u)Object.prototype.hasOwnProperty.call(u,c)&&(g[c]=u[c])}return g},y.apply(this,arguments)},C=function(g,u){var t={};for(var r in g)Object.prototype.hasOwnProperty.call(g,r)&&u.indexOf(r)<0&&(t[r]=g[r]);if(g!=null&&typeof Object.getOwnPropertySymbols=="function")for(var c=0,r=Object.getOwnPropertySymbols(g);c<r.length;c++)u.indexOf(r[c])<0&&Object.prototype.propertyIsEnumerable.call(g,r[c])&&(t[r[c]]=g[r[c]]);return t};(function(){typeof window>"u"||(navigator.mediaDevices===void 0&&(navigator.mediaDevices={}),navigator.mediaDevices.getUserMedia===void 0&&(navigator.mediaDevices.getUserMedia=function(g){var u=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return u?new Promise(function(t,r){u.call(navigator,g,t,r)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}))})();function U(){return!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)}var I=function(g){p(u,g);function u(t){var r=g.call(this,t)||this;return r.canvas=null,r.ctx=null,r.requestUserMediaId=0,r.unmounted=!1,r.state={hasUserMedia:!1},r}return u.prototype.componentDidMount=function(){var t=this,r=t.state,c=t.props;if(this.unmounted=!1,!U()){c.onUserMediaError("getUserMedia not supported");return}r.hasUserMedia||this.requestUserMedia(),c.children&&typeof c.children!="function"&&console.warn("children must be a function")},u.prototype.componentDidUpdate=function(t){var r=this.props;if(!U()){r.onUserMediaError("getUserMedia not supported");return}var c=JSON.stringify(t.audioConstraints)!==JSON.stringify(r.audioConstraints),d=JSON.stringify(t.videoConstraints)!==JSON.stringify(r.videoConstraints),w=t.minScreenshotWidth!==r.minScreenshotWidth,v=t.minScreenshotHeight!==r.minScreenshotHeight;(d||w||v)&&(this.canvas=null,this.ctx=null),(c||d)&&(this.stopAndCleanup(),this.requestUserMedia())},u.prototype.componentWillUnmount=function(){this.unmounted=!0,this.stopAndCleanup()},u.stopMediaStream=function(t){t&&(t.getVideoTracks&&t.getAudioTracks?(t.getVideoTracks().map(function(r){t.removeTrack(r),r.stop()}),t.getAudioTracks().map(function(r){t.removeTrack(r),r.stop()})):t.stop())},u.prototype.stopAndCleanup=function(){var t=this.state;t.hasUserMedia&&(u.stopMediaStream(this.stream),t.src&&window.URL.revokeObjectURL(t.src))},u.prototype.getScreenshot=function(t){var r=this,c=r.state,d=r.props;if(!c.hasUserMedia)return null;var w=this.getCanvas(t);return w&&w.toDataURL(d.screenshotFormat,d.screenshotQuality)},u.prototype.getCanvas=function(t){var r=this,c=r.state,d=r.props;if(!this.video||!c.hasUserMedia||!this.video.videoHeight)return null;if(!this.ctx){var w=this.video.videoWidth,v=this.video.videoHeight;if(!this.props.forceScreenshotSourceSize){var m=w/v;w=d.minScreenshotWidth||this.video.clientWidth,v=w/m,d.minScreenshotHeight&&v<d.minScreenshotHeight&&(v=d.minScreenshotHeight,w=v*m)}this.canvas=document.createElement("canvas"),this.canvas.width=(t==null?void 0:t.width)||w,this.canvas.height=(t==null?void 0:t.height)||v,this.ctx=this.canvas.getContext("2d")}var M=this,b=M.ctx,f=M.canvas;return b&&f&&(f.width=(t==null?void 0:t.width)||f.width,f.height=(t==null?void 0:t.height)||f.height,d.mirrored&&(b.translate(f.width,0),b.scale(-1,1)),b.imageSmoothingEnabled=d.imageSmoothing,b.drawImage(this.video,0,0,(t==null?void 0:t.width)||f.width,(t==null?void 0:t.height)||f.height),d.mirrored&&(b.scale(-1,1),b.translate(-f.width,0))),f},u.prototype.requestUserMedia=function(){var t=this,r=this.props,c=function(v,m){var M={video:typeof m<"u"?m:!0};r.audio&&(M.audio=typeof v<"u"?v:!0),t.requestUserMediaId++;var b=t.requestUserMediaId;navigator.mediaDevices.getUserMedia(M).then(function(f){t.unmounted||b!==t.requestUserMediaId?u.stopMediaStream(f):t.handleUserMedia(null,f)}).catch(function(f){t.handleUserMedia(f)})};if("mediaDevices"in navigator)c(r.audioConstraints,r.videoConstraints);else{var d=function(v){return{optional:[{sourceId:v}]}},w=function(v){var m=v.deviceId;return typeof m=="string"?m:Array.isArray(m)&&m.length>0?m[0]:typeof m=="object"&&m.ideal?m.ideal:null};MediaStreamTrack.getSources(function(v){var m=null,M=null;v.forEach(function(j){j.kind==="audio"?m=j.id:j.kind==="video"&&(M=j.id)});var b=w(r.audioConstraints);b&&(m=b);var f=w(r.videoConstraints);f&&(M=f),c(d(m),d(M))})}},u.prototype.handleUserMedia=function(t,r){var c=this.props;if(t||!r){this.setState({hasUserMedia:!1}),c.onUserMediaError(t);return}this.stream=r;try{this.video&&(this.video.srcObject=r),this.setState({hasUserMedia:!0})}catch{this.setState({hasUserMedia:!0,src:window.URL.createObjectURL(r)})}c.onUserMedia(r)},u.prototype.render=function(){var t=this,r=this,c=r.state,d=r.props,w=d.audio;d.forceScreenshotSourceSize;var v=d.disablePictureInPicture;d.onUserMedia,d.onUserMediaError,d.screenshotFormat,d.screenshotQuality,d.minScreenshotWidth,d.minScreenshotHeight,d.audioConstraints,d.videoConstraints,d.imageSmoothing;var m=d.mirrored,M=d.style,b=M===void 0?{}:M,f=d.children,j=C(d,["audio","forceScreenshotSourceSize","disablePictureInPicture","onUserMedia","onUserMediaError","screenshotFormat","screenshotQuality","minScreenshotWidth","minScreenshotHeight","audioConstraints","videoConstraints","imageSmoothing","mirrored","style","children"]),B=m?y(y({},b),{transform:(b.transform||"")+" scaleX(-1)"}):b,G={getScreenshot:this.getScreenshot.bind(this)};return n.createElement(n.Fragment,null,n.createElement("video",y({autoPlay:!0,disablePictureInPicture:v,src:c.src,muted:!w,playsInline:!0,ref:function(X){t.video=X},style:B},j)),f&&f(G))},u.defaultProps={audio:!1,disablePictureInPicture:!1,forceScreenshotSourceSize:!1,imageSmoothing:!0,mirrored:!1,onUserMedia:function(){},onUserMediaError:function(){},screenshotFormat:"image/webp",screenshotQuality:.92},u}(n.Component);a.default=I},react:function(o,a){o.exports=e}}).default})}(k)),k.exports}var Re=Fe();const Ee=Y(Re),Oe=({width:i})=>h.jsxs(T,{width:i,children:[h.jsx(O,{size:"threeXL",color:_.gray60,content:D}),h.jsxs(ye,{children:["This app would like to use your camera.",h.jsx(be,{href:ie,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),Te=({handleCapture:i,width:l,disabled:e,clearPhotoInProgress:o,setClearPhotoInProgress:a,facingMode:s,setFacingMode:n,testOverride:p})=>{const[y,C]=S.useState(p||"pending"),U=S.useRef(null),[I,g]=S.useState(l),u=S.useCallback(ee(1e3,g),[]);S.useEffect(()=>{u(l)},[l,u]);function t(){if(U.current!==null){const c=U.current.getScreenshot();i(c)}}const r=te();return h.jsxs(H,{"data-testid":"stCameraInputWebcamComponent",children:[y!=="success"&&!e&&!o?h.jsx(Oe,{width:I}):re.isMobile&&h.jsx(je,{switchFacingMode:n}),h.jsx(T,{"data-testid":"stCameraInputWebcamStyledBox",hidden:y!=="success"&&!e&&!o,width:I,children:!e&&h.jsx(Ee,{audio:!1,ref:U,screenshotFormat:"image/jpeg",screenshotQuality:1,width:I,height:I*9/16,style:{borderRadius:`${r.radii.default} ${r.radii.default} 0 0`},onUserMediaError:()=>{C("error")},onUserMedia:()=>{C("success"),a(!1)},videoConstraints:{width:{ideal:I},facingMode:s}})}),h.jsx(A,{onClick:t,disabled:y!=="success"||e||o,children:"Take Photo"})]})},ke=S.memo(Te),ze=150,_e=ae.getLogger("CameraInput");class Ve extends oe.PureComponent{constructor(l){super(l),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new ge,this.getProgress=()=>{if(this.state.files.length>0&&this.state.files[this.state.files.length-1].status.type==="uploading")return this.state.files[this.state.files.length-1].status.progress},this.setClearPhotoInProgress=e=>{this.setState({clearPhotoInProgress:e})},this.setFacingMode=()=>{this.setState(e=>({facingMode:e.facingMode===F.USER?F.ENVIRONMENT:F.USER}))},this.handleCapture=e=>{if(e===null)return Promise.resolve();this.setState({imgSrc:e,shutter:!0,minShutterEffectPassed:!1});const o=a=>new Promise(s=>setTimeout(s,a));return Le(e,`camera-input-${new Date().toISOString().replace(/:/g,"_")}.jpg`).then(a=>this.props.uploadClient.fetchFileURLs([a]).then(s=>({file:a,fileUrls:s[0]}))).then(({file:a,fileUrls:s})=>this.uploadFile(s,a)).then(()=>o(ze)).then(()=>{this.setState((a,s)=>({imgSrc:e,shutter:a.shutter,minShutterEffectPassed:!0}))}).catch(a=>{_e.error(a)})},this.removeCapture=()=>{this.state.files.length!==0&&(this.state.files.forEach(e=>this.deleteFile(e.id)),this.setState({imgSrc:null,clearPhotoInProgress:!0}))},this.componentDidUpdate=()=>{if(this.status!=="ready")return;const e=this.createWidgetValue(),{element:o,widgetMgr:a,fragmentId:s}=this.props,n=a.getFileUploaderStateValue(o);ne(e,n)||a.setFileUploaderStateValue(o,e,{fromUi:!0},s)},this.onFormCleared=()=>{this.setState({files:[]},()=>{const e=this.createWidgetValue();if(P(e))return;this.setState({imgSrc:null});const{widgetMgr:o,element:a,fragmentId:s}=this.props;o.setFileUploaderStateValue(a,e,{fromUi:!0},s)})},this.deleteFile=e=>{const o=this.getFile(e);P(o)||(o.status.type==="uploading"&&o.status.cancelToken.cancel(),o.status.type==="uploaded"&&o.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(o.status.fileUrls.deleteUrl),this.removeFile(e))},this.addFile=e=>{this.setState(o=>({files:[...o.files,e]}))},this.removeFile=e=>{this.setState(o=>({files:o.files.filter(a=>a.id!==e)}))},this.getFile=e=>this.state.files.find(o=>o.id===e),this.updateFile=(e,o)=>{this.setState(a=>({files:a.files.map(s=>s.id===e?o:s)}))},this.onUploadComplete=(e,o)=>{this.setState(()=>({shutter:!1}));const a=this.getFile(e);P(a)||a.status.type!=="uploading"||this.updateFile(a.id,a.setStatus({type:"uploaded",fileId:o.fileId,fileUrls:o}))},this.onUploadProgress=(e,o)=>{const a=this.getFile(o);if(P(a)||a.status.type!=="uploading")return;const s=Math.round(e.loaded*100/e.total);a.status.progress!==s&&this.updateFile(o,a.setStatus({type:"uploading",cancelToken:a.status.cancelToken,progress:s}))},this.reset=()=>{this.setState({files:[],imgSrc:null})},this.uploadFile=(e,o)=>{const a=V.CancelToken.source(),s=new L(o.name,o.size,this.nextLocalFileId(),{type:"uploading",cancelToken:a,progress:1});this.addFile(s),this.props.uploadClient.uploadFile(this.props.element,e.uploadUrl,o,n=>this.onUploadProgress(n,s.id),a.token).then(()=>this.onUploadComplete(s.id,e)).catch(n=>{V.isCancel(n)||this.updateFile(s.id,s.setStatus({type:"error",errorMessage:n?n.toString():"Unknown error"}))})},this.state=this.initialValue}get initialValue(){const l={files:[],imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:F.USER},{widgetMgr:e,element:o}=this.props,a=e.getFileUploaderStateValue(o);if(P(a))return l;const{uploadedFileInfo:s}=a;return P(s)||s.length===0?l:{files:s.map(n=>{const p=n.name,y=n.size,C=n.fileId,U=n.fileUrls;return new L(p,y,this.nextLocalFileId(),{type:"uploaded",fileId:C,fileUrls:U})}),imgSrc:s.length===0?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:F.USER}}componentWillUnmount(){this.formClearHelper.disconnect()}get status(){const l=e=>e.status.type==="uploading";return this.state.files.some(l)?"updating":"ready"}componentDidMount(){const l=this.createWidgetValue(),{element:e,widgetMgr:o,fragmentId:a}=this.props;o.getFileUploaderStateValue(e)===void 0&&o.setFileUploaderStateValue(e,l,{fromUi:!1},a)}createWidgetValue(){const l=this.state.files.filter(e=>e.status.type==="uploaded").map(e=>{const{name:o,size:a,status:s}=e;return new le({fileId:s.fileId,fileUrls:s.fileUrls,name:o,size:a})});return new de({uploadedFileInfo:l})}render(){var l;const{element:e,widgetMgr:o,disabled:a,width:s}=this.props;return this.formClearHelper.manageFormClearListener(o,e.formId,this.onFormCleared),h.jsxs(H,{className:"stCameraInput","data-testid":"stCameraInput",children:[h.jsx(ce,{label:e.label,disabled:a,labelVisibility:ue((l=e.labelVisibility)==null?void 0:l.value),children:e.help&&h.jsx(he,{children:h.jsx(pe,{content:e.help,placement:z.TOP_RIGHT})})}),this.state.imgSrc?h.jsxs(h.Fragment,{children:[h.jsx(T,{width:s,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&h.jsx(Se,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:s,height:s*9/16})}),h.jsx(A,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||a,children:this.getProgress()?"Uploading...":h.jsxs(we,{children:[h.jsx(O,{content:W,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):h.jsx(ke,{handleCapture:this.handleCapture,width:s,disabled:a,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode,testOverride:this.props.testOverride})]})}nextLocalFileId(){return this.localFileIdCounter++}}function Le(i,l){return fetch(i).then(e=>e.arrayBuffer()).then(e=>new File([e],l,{type:"image/jpeg"}))}const De=se(Ve);export{De as default};
|
|
1
|
+
import{r as S,E as R,_ as E,c as x,I as q,j as h,c0 as Q,bI as z,bW as J,bD as Z,bX as O,c8 as _,e as K,g as Y,bf as ee,A as te,c9 as re,ca as ie,cb as se,R as oe,l as ae,b3 as ne,L as P,bT as le,bS as de,bZ as ce,b_ as ue,cc as he,b$ as pe}from"./index-Cbvbjd8C.js";import{a as V}from"./index-xsH4HHeE.js";import{F as ge}from"./FormClearHelper-CT0Jwp4X.js";import{U as L}from"./UploadFileInfo-C-jY39rj.js";import{P as fe,S as me}from"./ProgressBar-CA-bplbU.js";var D=S.forwardRef(function(i,l){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return S.createElement(R,E({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},i,{ref:l}),S.createElement("path",{d:"M.5 1c-.28 0-.5.23-.5.5v4c0 .28.23.5.5.5h5c.28 0 .5-.22.5-.5V4l1 1h1V2H7L6 3V1.5c0-.28-.22-.5-.5-.5h-5z"}))});D.displayName="Video";var W=S.forwardRef(function(i,l){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return S.createElement(R,E({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},i,{ref:l}),S.createElement("path",{d:"M1.41 0L0 1.41l.72.72L2.5 3.94.72 5.72 0 6.41l1.41 1.44.72-.72 1.81-1.81 1.78 1.81.69.72 1.44-1.44-.72-.69-1.81-1.78 1.81-1.81.72-.72L6.41 0l-.69.72L3.94 2.5 2.13.72 1.41 0z"}))});W.displayName="X";var $=S.forwardRef(function(i,l){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return S.createElement(R,E({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},i,{ref:l}),S.createElement("rect",{width:24,height:24,fill:"none"}),S.createElement("path",{d:"M20 5h-3.17l-1.24-1.35A1.99 1.99 0 0014.12 3H9.88c-.56 0-1.1.24-1.48.65L7.17 5H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm-1.35 8.35l-2.79 2.79c-.32.32-.86.1-.86-.35v-1.75H9v1.75c0 .45-.54.67-.85.35l-2.79-2.79c-.2-.2-.2-.51 0-.71l2.79-2.79a.5.5 0 01.85.36v1.83h6v-1.83c0-.45.54-.67.85-.35l2.79 2.79c.2.19.2.51.01.7z"}))});$.displayName="SwitchCamera";function ve(i,l){switch(i){case"xsmall":return{padding:`${l.spacing.twoXS} ${l.spacing.sm}`,fontSize:l.fontSizes.sm};case"small":return{padding:`${l.spacing.twoXS} ${l.spacing.md}`};case"large":return{padding:`${l.spacing.md} ${l.spacing.md}`};default:return{padding:`${l.spacing.xs} ${l.spacing.md}`}}}const H=x("div",{target:"etz5kuj9"})({name:"b6gpc",styles:"position:relative;overflow:hidden;width:100%;object-fit:contain"}),T=x("div",{target:"etz5kuj8"})(({theme:i,width:l})=>({backgroundColor:i.colors.secondaryBg,borderRadius:`${i.radii.default} ${i.radii.default} 0 0`,width:"100%",height:l*9/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}),""),ye=x("p",{target:"etz5kuj7"})(({theme:i})=>({marginTop:i.spacing.sm,textAlign:"center"}),""),Se=x("img",{target:"etz5kuj6"})(({theme:i,opacity:l})=>({borderRadius:`${i.radii.default} ${i.radii.default} 0 0`,objectFit:"contain",opacity:l}),""),be=x("a",{target:"etz5kuj5"})(({theme:i})=>({color:i.colors.primary,display:"block",textDecoration:"none"}),""),we=x("span",{target:"etz5kuj4"})({name:"s5xdrg",styles:"display:flex;align-items:center"}),Me=x("div",{target:"etz5kuj3"})(({theme:i})=>({position:"absolute",top:i.spacing.lg,right:i.spacing.lg,zIndex:i.zIndices.priority,color:i.colors.fadedText40,mixBlendMode:"difference",opacity:.6}),""),Ue=x("div",{target:"etz5kuj1"})({name:"1yoks5w",styles:"height:fit-content;width:100%;position:absolute;bottom:0"}),Ce=x("button",{target:"etz5kuj0"})(({theme:i})=>({position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:i.colors.lightenedBg05,border:`${i.sizes.borderWidth} solid ${i.colors.borderColor}`,borderRadius:`0 0 ${i.radii.default} ${i.radii.default}`,"&:hover":{borderColor:i.colors.primary,color:i.colors.primary},"&:active":{color:i.colors.white,borderColor:i.colors.primary,backgroundColor:i.colors.primary},"&:focus:not(:active)":{borderColor:i.colors.primary,color:i.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:i.colors.fadedText40,borderColor:i.colors.borderColor,backgroundColor:i.colors.lightenedBg05,cursor:"not-allowed"},fontWeight:i.fontWeights.normal,padding:`${i.spacing.xs} ${i.spacing.md}`,margin:i.spacing.none,lineHeight:i.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{outline:"none"},"&:focus-visible":{boxShadow:`0 0 0 0.2rem ${q(i.colors.primary,.5)}`},...ve("medium",i)}),"");function xe({disabled:i,onClick:l,children:e,progress:o}){return h.jsxs(Ce,{disabled:i||!1,onClick:l||(()=>{}),progress:o||null,"data-testid":"stCameraInputButton",children:[e,o?h.jsx(Ue,{children:h.jsx(fe,{value:o,size:me.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarProgress:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarContainer:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}}}})}):null]})}const A=S.memo(xe);var F=(i=>(i.USER="user",i.ENVIRONMENT="environment",i))(F||{});const Ie=({switchFacingMode:i})=>h.jsx(Me,{"data-testid":"stCameraInputSwitchButton",children:h.jsx(Q,{content:"Switch camera",placement:z.TOP_RIGHT,children:h.jsx(J,{kind:Z.MINIMAL,onClick:i,children:h.jsx(O,{content:$,size:"twoXL",color:_.white})})})}),je=S.memo(Ie);var k={exports:{}},Pe=k.exports,N;function Fe(){return N||(N=1,function(i,l){(function(e,o){i.exports=o(K())})(Pe,function(e){return function(o){var a={};function s(n){if(a[n])return a[n].exports;var p=a[n]={i:n,l:!1,exports:{}};return o[n].call(p.exports,p,p.exports,s),p.l=!0,p.exports}return s.m=o,s.c=a,s.d=function(n,p,y){s.o(n,p)||Object.defineProperty(n,p,{enumerable:!0,get:y})},s.r=function(n){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},s.t=function(n,p){if(p&1&&(n=s(n)),p&8||p&4&&typeof n=="object"&&n&&n.__esModule)return n;var y=Object.create(null);if(s.r(y),Object.defineProperty(y,"default",{enumerable:!0,value:n}),p&2&&typeof n!="string")for(var C in n)s.d(y,C,(function(U){return n[U]}).bind(null,C));return y},s.n=function(n){var p=n&&n.__esModule?function(){return n.default}:function(){return n};return s.d(p,"a",p),p},s.o=function(n,p){return Object.prototype.hasOwnProperty.call(n,p)},s.p="",s(s.s="./src/react-webcam.tsx")}({"./src/react-webcam.tsx":function(o,a,s){s.r(a);var n=s("react"),p=function(){var g=function(u,t){return g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,c){r.__proto__=c}||function(r,c){for(var d in c)c.hasOwnProperty(d)&&(r[d]=c[d])},g(u,t)};return function(u,t){g(u,t);function r(){this.constructor=u}u.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),y=function(){return y=Object.assign||function(g){for(var u,t=1,r=arguments.length;t<r;t++){u=arguments[t];for(var c in u)Object.prototype.hasOwnProperty.call(u,c)&&(g[c]=u[c])}return g},y.apply(this,arguments)},C=function(g,u){var t={};for(var r in g)Object.prototype.hasOwnProperty.call(g,r)&&u.indexOf(r)<0&&(t[r]=g[r]);if(g!=null&&typeof Object.getOwnPropertySymbols=="function")for(var c=0,r=Object.getOwnPropertySymbols(g);c<r.length;c++)u.indexOf(r[c])<0&&Object.prototype.propertyIsEnumerable.call(g,r[c])&&(t[r[c]]=g[r[c]]);return t};(function(){typeof window>"u"||(navigator.mediaDevices===void 0&&(navigator.mediaDevices={}),navigator.mediaDevices.getUserMedia===void 0&&(navigator.mediaDevices.getUserMedia=function(g){var u=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return u?new Promise(function(t,r){u.call(navigator,g,t,r)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}))})();function U(){return!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)}var I=function(g){p(u,g);function u(t){var r=g.call(this,t)||this;return r.canvas=null,r.ctx=null,r.requestUserMediaId=0,r.unmounted=!1,r.state={hasUserMedia:!1},r}return u.prototype.componentDidMount=function(){var t=this,r=t.state,c=t.props;if(this.unmounted=!1,!U()){c.onUserMediaError("getUserMedia not supported");return}r.hasUserMedia||this.requestUserMedia(),c.children&&typeof c.children!="function"&&console.warn("children must be a function")},u.prototype.componentDidUpdate=function(t){var r=this.props;if(!U()){r.onUserMediaError("getUserMedia not supported");return}var c=JSON.stringify(t.audioConstraints)!==JSON.stringify(r.audioConstraints),d=JSON.stringify(t.videoConstraints)!==JSON.stringify(r.videoConstraints),w=t.minScreenshotWidth!==r.minScreenshotWidth,v=t.minScreenshotHeight!==r.minScreenshotHeight;(d||w||v)&&(this.canvas=null,this.ctx=null),(c||d)&&(this.stopAndCleanup(),this.requestUserMedia())},u.prototype.componentWillUnmount=function(){this.unmounted=!0,this.stopAndCleanup()},u.stopMediaStream=function(t){t&&(t.getVideoTracks&&t.getAudioTracks?(t.getVideoTracks().map(function(r){t.removeTrack(r),r.stop()}),t.getAudioTracks().map(function(r){t.removeTrack(r),r.stop()})):t.stop())},u.prototype.stopAndCleanup=function(){var t=this.state;t.hasUserMedia&&(u.stopMediaStream(this.stream),t.src&&window.URL.revokeObjectURL(t.src))},u.prototype.getScreenshot=function(t){var r=this,c=r.state,d=r.props;if(!c.hasUserMedia)return null;var w=this.getCanvas(t);return w&&w.toDataURL(d.screenshotFormat,d.screenshotQuality)},u.prototype.getCanvas=function(t){var r=this,c=r.state,d=r.props;if(!this.video||!c.hasUserMedia||!this.video.videoHeight)return null;if(!this.ctx){var w=this.video.videoWidth,v=this.video.videoHeight;if(!this.props.forceScreenshotSourceSize){var m=w/v;w=d.minScreenshotWidth||this.video.clientWidth,v=w/m,d.minScreenshotHeight&&v<d.minScreenshotHeight&&(v=d.minScreenshotHeight,w=v*m)}this.canvas=document.createElement("canvas"),this.canvas.width=(t==null?void 0:t.width)||w,this.canvas.height=(t==null?void 0:t.height)||v,this.ctx=this.canvas.getContext("2d")}var M=this,b=M.ctx,f=M.canvas;return b&&f&&(f.width=(t==null?void 0:t.width)||f.width,f.height=(t==null?void 0:t.height)||f.height,d.mirrored&&(b.translate(f.width,0),b.scale(-1,1)),b.imageSmoothingEnabled=d.imageSmoothing,b.drawImage(this.video,0,0,(t==null?void 0:t.width)||f.width,(t==null?void 0:t.height)||f.height),d.mirrored&&(b.scale(-1,1),b.translate(-f.width,0))),f},u.prototype.requestUserMedia=function(){var t=this,r=this.props,c=function(v,m){var M={video:typeof m<"u"?m:!0};r.audio&&(M.audio=typeof v<"u"?v:!0),t.requestUserMediaId++;var b=t.requestUserMediaId;navigator.mediaDevices.getUserMedia(M).then(function(f){t.unmounted||b!==t.requestUserMediaId?u.stopMediaStream(f):t.handleUserMedia(null,f)}).catch(function(f){t.handleUserMedia(f)})};if("mediaDevices"in navigator)c(r.audioConstraints,r.videoConstraints);else{var d=function(v){return{optional:[{sourceId:v}]}},w=function(v){var m=v.deviceId;return typeof m=="string"?m:Array.isArray(m)&&m.length>0?m[0]:typeof m=="object"&&m.ideal?m.ideal:null};MediaStreamTrack.getSources(function(v){var m=null,M=null;v.forEach(function(j){j.kind==="audio"?m=j.id:j.kind==="video"&&(M=j.id)});var b=w(r.audioConstraints);b&&(m=b);var f=w(r.videoConstraints);f&&(M=f),c(d(m),d(M))})}},u.prototype.handleUserMedia=function(t,r){var c=this.props;if(t||!r){this.setState({hasUserMedia:!1}),c.onUserMediaError(t);return}this.stream=r;try{this.video&&(this.video.srcObject=r),this.setState({hasUserMedia:!0})}catch{this.setState({hasUserMedia:!0,src:window.URL.createObjectURL(r)})}c.onUserMedia(r)},u.prototype.render=function(){var t=this,r=this,c=r.state,d=r.props,w=d.audio;d.forceScreenshotSourceSize;var v=d.disablePictureInPicture;d.onUserMedia,d.onUserMediaError,d.screenshotFormat,d.screenshotQuality,d.minScreenshotWidth,d.minScreenshotHeight,d.audioConstraints,d.videoConstraints,d.imageSmoothing;var m=d.mirrored,M=d.style,b=M===void 0?{}:M,f=d.children,j=C(d,["audio","forceScreenshotSourceSize","disablePictureInPicture","onUserMedia","onUserMediaError","screenshotFormat","screenshotQuality","minScreenshotWidth","minScreenshotHeight","audioConstraints","videoConstraints","imageSmoothing","mirrored","style","children"]),B=m?y(y({},b),{transform:(b.transform||"")+" scaleX(-1)"}):b,G={getScreenshot:this.getScreenshot.bind(this)};return n.createElement(n.Fragment,null,n.createElement("video",y({autoPlay:!0,disablePictureInPicture:v,src:c.src,muted:!w,playsInline:!0,ref:function(X){t.video=X},style:B},j)),f&&f(G))},u.defaultProps={audio:!1,disablePictureInPicture:!1,forceScreenshotSourceSize:!1,imageSmoothing:!0,mirrored:!1,onUserMedia:function(){},onUserMediaError:function(){},screenshotFormat:"image/webp",screenshotQuality:.92},u}(n.Component);a.default=I},react:function(o,a){o.exports=e}}).default})}(k)),k.exports}var Re=Fe();const Ee=Y(Re),Oe=({width:i})=>h.jsxs(T,{width:i,children:[h.jsx(O,{size:"threeXL",color:_.gray60,content:D}),h.jsxs(ye,{children:["This app would like to use your camera.",h.jsx(be,{href:ie,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),Te=({handleCapture:i,width:l,disabled:e,clearPhotoInProgress:o,setClearPhotoInProgress:a,facingMode:s,setFacingMode:n,testOverride:p})=>{const[y,C]=S.useState(p||"pending"),U=S.useRef(null),[I,g]=S.useState(l),u=S.useCallback(ee(1e3,g),[]);S.useEffect(()=>{u(l)},[l,u]);function t(){if(U.current!==null){const c=U.current.getScreenshot();i(c)}}const r=te();return h.jsxs(H,{"data-testid":"stCameraInputWebcamComponent",children:[y!=="success"&&!e&&!o?h.jsx(Oe,{width:I}):re.isMobile&&h.jsx(je,{switchFacingMode:n}),h.jsx(T,{"data-testid":"stCameraInputWebcamStyledBox",hidden:y!=="success"&&!e&&!o,width:I,children:!e&&h.jsx(Ee,{audio:!1,ref:U,screenshotFormat:"image/jpeg",screenshotQuality:1,width:I,height:I*9/16,style:{borderRadius:`${r.radii.default} ${r.radii.default} 0 0`},onUserMediaError:()=>{C("error")},onUserMedia:()=>{C("success"),a(!1)},videoConstraints:{width:{ideal:I},facingMode:s}})}),h.jsx(A,{onClick:t,disabled:y!=="success"||e||o,children:"Take Photo"})]})},ke=S.memo(Te),ze=150,_e=ae.getLogger("CameraInput");class Ve extends oe.PureComponent{constructor(l){super(l),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new ge,this.getProgress=()=>{if(this.state.files.length>0&&this.state.files[this.state.files.length-1].status.type==="uploading")return this.state.files[this.state.files.length-1].status.progress},this.setClearPhotoInProgress=e=>{this.setState({clearPhotoInProgress:e})},this.setFacingMode=()=>{this.setState(e=>({facingMode:e.facingMode===F.USER?F.ENVIRONMENT:F.USER}))},this.handleCapture=e=>{if(e===null)return Promise.resolve();this.setState({imgSrc:e,shutter:!0,minShutterEffectPassed:!1});const o=a=>new Promise(s=>setTimeout(s,a));return Le(e,`camera-input-${new Date().toISOString().replace(/:/g,"_")}.jpg`).then(a=>this.props.uploadClient.fetchFileURLs([a]).then(s=>({file:a,fileUrls:s[0]}))).then(({file:a,fileUrls:s})=>this.uploadFile(s,a)).then(()=>o(ze)).then(()=>{this.setState((a,s)=>({imgSrc:e,shutter:a.shutter,minShutterEffectPassed:!0}))}).catch(a=>{_e.error(a)})},this.removeCapture=()=>{this.state.files.length!==0&&(this.state.files.forEach(e=>this.deleteFile(e.id)),this.setState({imgSrc:null,clearPhotoInProgress:!0}))},this.componentDidUpdate=()=>{if(this.status!=="ready")return;const e=this.createWidgetValue(),{element:o,widgetMgr:a,fragmentId:s}=this.props,n=a.getFileUploaderStateValue(o);ne(e,n)||a.setFileUploaderStateValue(o,e,{fromUi:!0},s)},this.onFormCleared=()=>{this.setState({files:[]},()=>{const e=this.createWidgetValue();if(P(e))return;this.setState({imgSrc:null});const{widgetMgr:o,element:a,fragmentId:s}=this.props;o.setFileUploaderStateValue(a,e,{fromUi:!0},s)})},this.deleteFile=e=>{const o=this.getFile(e);P(o)||(o.status.type==="uploading"&&o.status.cancelToken.cancel(),o.status.type==="uploaded"&&o.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(o.status.fileUrls.deleteUrl),this.removeFile(e))},this.addFile=e=>{this.setState(o=>({files:[...o.files,e]}))},this.removeFile=e=>{this.setState(o=>({files:o.files.filter(a=>a.id!==e)}))},this.getFile=e=>this.state.files.find(o=>o.id===e),this.updateFile=(e,o)=>{this.setState(a=>({files:a.files.map(s=>s.id===e?o:s)}))},this.onUploadComplete=(e,o)=>{this.setState(()=>({shutter:!1}));const a=this.getFile(e);P(a)||a.status.type!=="uploading"||this.updateFile(a.id,a.setStatus({type:"uploaded",fileId:o.fileId,fileUrls:o}))},this.onUploadProgress=(e,o)=>{const a=this.getFile(o);if(P(a)||a.status.type!=="uploading")return;const s=Math.round(e.loaded*100/e.total);a.status.progress!==s&&this.updateFile(o,a.setStatus({type:"uploading",cancelToken:a.status.cancelToken,progress:s}))},this.reset=()=>{this.setState({files:[],imgSrc:null})},this.uploadFile=(e,o)=>{const a=V.CancelToken.source(),s=new L(o.name,o.size,this.nextLocalFileId(),{type:"uploading",cancelToken:a,progress:1});this.addFile(s),this.props.uploadClient.uploadFile(this.props.element,e.uploadUrl,o,n=>this.onUploadProgress(n,s.id),a.token).then(()=>this.onUploadComplete(s.id,e)).catch(n=>{V.isCancel(n)||this.updateFile(s.id,s.setStatus({type:"error",errorMessage:n?n.toString():"Unknown error"}))})},this.state=this.initialValue}get initialValue(){const l={files:[],imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:F.USER},{widgetMgr:e,element:o}=this.props,a=e.getFileUploaderStateValue(o);if(P(a))return l;const{uploadedFileInfo:s}=a;return P(s)||s.length===0?l:{files:s.map(n=>{const p=n.name,y=n.size,C=n.fileId,U=n.fileUrls;return new L(p,y,this.nextLocalFileId(),{type:"uploaded",fileId:C,fileUrls:U})}),imgSrc:s.length===0?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:F.USER}}componentWillUnmount(){this.formClearHelper.disconnect()}get status(){const l=e=>e.status.type==="uploading";return this.state.files.some(l)?"updating":"ready"}componentDidMount(){const l=this.createWidgetValue(),{element:e,widgetMgr:o,fragmentId:a}=this.props;o.getFileUploaderStateValue(e)===void 0&&o.setFileUploaderStateValue(e,l,{fromUi:!1},a)}createWidgetValue(){const l=this.state.files.filter(e=>e.status.type==="uploaded").map(e=>{const{name:o,size:a,status:s}=e;return new le({fileId:s.fileId,fileUrls:s.fileUrls,name:o,size:a})});return new de({uploadedFileInfo:l})}render(){var l;const{element:e,widgetMgr:o,disabled:a,width:s}=this.props;return this.formClearHelper.manageFormClearListener(o,e.formId,this.onFormCleared),h.jsxs(H,{className:"stCameraInput","data-testid":"stCameraInput",children:[h.jsx(ce,{label:e.label,disabled:a,labelVisibility:ue((l=e.labelVisibility)==null?void 0:l.value),children:e.help&&h.jsx(he,{children:h.jsx(pe,{content:e.help,placement:z.TOP_RIGHT})})}),this.state.imgSrc?h.jsxs(h.Fragment,{children:[h.jsx(T,{width:s,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&h.jsx(Se,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:s,height:s*9/16})}),h.jsx(A,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||a,children:this.getProgress()?"Uploading...":h.jsxs(we,{children:[h.jsx(O,{content:W,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):h.jsx(ke,{handleCapture:this.handleCapture,width:s,disabled:a,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode,testOverride:this.props.testOverride})]})}nextLocalFileId(){return this.localFileIdCounter++}}function Le(i,l){return fetch(i).then(e=>e.arrayBuffer()).then(e=>new File([e],l,{type:"image/jpeg"}))}const De=se(Ve);export{De as default};
|