1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/document-upload-sentry-CwY_2GoS.js","assets/track-error-fzCnz4fY.js","assets/hub-CmyV34zS.js"])))=>i.map(i=>d[i]); 2import{bl as st,F as we,r as I,bT as ot,bU as at,bV as nt,G as it,y as ke,q as U,w as Ie,x as me,s as ae,j as E,v as K,M as Ce,L as W,bW as ue,bc as ut,bX as dt,A as ct,z as lt,C as O,bY as mt,bZ as ft,b_ as pt,R as ne,b9 as Y,J as Pe,ag as ht}from"./MarketingSiteLoadingFallback-DF4Bevx8.js";import{_ as yt}from"./frontend-release-DHVEZwfg.js";import{d as gt}from"./client-environment-BMTHOZAb.js";function Ir(...e){return function(...r){e.forEach(s=>s==null?void 0:s(...r))}}function Re(...e){return function(r){e.some(s=>(s==null||s(r),r==null?void 0:r.defaultPrevented))}}const bt=Object.freeze(["base","sm","md","lg","xl","2xl"]);function Fe(e,t){return Array.isArray(e)?e.map(r=>r===null?null:t(r)):st(e)?Object.keys(e).reduce((r,s)=>(r[s]=t(e[s]),r),{}):e!=null?t(e):null}function Pr(e,t=bt){const r={};return e.forEach((s,a)=>{const o=t[a];s!=null&&(r[o]=s)}),r}function Fr(e={}){const{onClose:t,onOpen:r,isOpen:s,id:a}=e,o=we(r),n=we(t),[m,i]=I.useState(e.defaultIsOpen||!1),u=s!==void 0?s:m,l=s!==void 0,c=I.useId(),d=a??`disclosure-${c}`,h=I.useCallback(()=>{l||i(!1),n==null||n()},[l,n]),y=I.useCallback(()=>{l||i(!0),o==null||o()},[l,o]),p=I.useCallback(()=>{u?h():y()},[u,y,h]);function g(R={}){return{...R,"aria-expanded":u,"aria-controls":d,onClick(f){var C;(C=R.onClick)==null||C.call(R,f),p()}}}function _(R={}){return{...R,hidden:!u,id:d}}return{isOpen:u,onOpen:y,onClose:h,onToggle:p,isControlled:l,getButtonProps:g,getDisclosureProps:_}}function _t(){!ot.current&&at();const[e]=I.useState(nt.current);return e}function wt(e){const{loading:t,src:r,srcSet:s,onLoad:a,onError:o,crossOrigin:n,sizes:m,ignoreFallback:i}=e,[u,l]=I.useState("pending");I.useEffect(()=>{l(r?"loading":"pending")},[r]);const c=I.useRef(null),d=I.useCallback(()=>{if(!r)return;h();const y=new Image;y.src=r,n&&(y.crossOrigin=n),s&&(y.srcset=s),m&&(y.sizes=m),t&&(y.loading=t),y.onload=p=>{h(),l("loaded"),a==null||a(p)},y.onerror=p=>{h(),l("failed"),o==null||o(p)},c.current=y},[r,n,s,m,a,o,t]),h=()=>{c.current&&(c.current.onload=null,c.current.onerror=null,c.current=null)};return it(()=>{if(!i)return u==="loading"&&d(),()=>{h()}},[u,d,i]),i?"loaded":u}const Ct=(e,t)=>e!=="loaded"&&t==="beforeLoadOrError"||e==="failed"&&t==="onError",[Rt,Et]=ke({name:"FormControlStylesContext",errorMessage:`useFormControlStyles returned is 'undefined'. Seems you forgot to wrap the components in "<FormControl />" `}),[xt,qe]=ke({strict:!1,name:"FormControlContext"});function Tt(e){const{id:t,isRequired:r,isInvalid:s,isDisabled:a,isReadOnly:o,...n}=e,m=I.useId(),i=t||`field-${m}`,u=`${i}-label`,l=`${i}-feedback`,c=`${i}-helptext`,[d,h]=I.useState(!1),[y,p]=I.useState(!1),[g,_]=I.useState(!1),R=I.useCallback((v={},A=null)=>({id:c,...v,ref:Ce(A,P=>{P&&p(!0)})}),[c]),f=I.useCallback((v={},A=null)=>({...v,ref:A,"data-focus":W(g),"data-disabled":W(a),"data-invalid":W(s),"data-readonly":W(o),id:v.id!==void 0?v.id:u,htmlFor:v.htmlFor!==void 0?v.htmlFor:i}),[i,a,g,s,o,u]),C=I.useCallback((v={},A=null)=>({id:l,...v,ref:Ce(A,P=>{P&&h(!0)}),"aria-live":"polite"}),[l]),b=I.useCallback((v={},A=null)=>({...v,...n,ref:A,role:"group","data-focus":W(g),"data-disabled":W(a),"data-invalid":W(s),"data-readonly":W(o)}),[n,a,g,s,o]),x=I.useCallback((v={},A=null)=>({...v,ref:A,role:"presentation","aria-hidden":!0,children:v.children||"*"}),[]);return{isRequired:!!r,isInvalid:!!s,isReadOnly:!!o,isDisabled:!!a,isFocused:!!g,onFocus:()=>_(!0),onBlur:()=>_(!1),hasFeedbackText:d,setHasFeedbackText:h,hasHelpText:y,setHasHelpText:p,id:i,labelId:u,feedbackId:l,helpTextId:c,htmlProps:n,getHelpTextProps:R,getErrorMessageProps:C,getRootProps:b,getLabelProps:f,getRequiredIndicatorProps:x}}const At=U(function(t,r){const s=Ie("Form",t),a=me(t),{getRootProps:o,htmlProps:n,...m}=Tt(a),i=ae("chakra-form-control",t.className);return E.jsx(xt,{value:m,children:E.jsx(Rt,{value:s,children:E.jsx(K.div,{...o({},r),className:i,__css:s.container})})})});At.displayName="FormControl";const vt=U(function(t,r){const s=qe(),a=Et(),o=ae("chakra-form__helper-text",t.className);return E.jsx(K.div,{...s==null?void 0:s.getHelpTextProps(t,r),__css:a.helperText,className:o})});vt.displayName="FormHelperText";function Mt(e){const{isDisabled:t,isInvalid:r,isReadOnly:s,isRequired:a,...o}=Lt(e);return{...o,disabled:t,readOnly:s,required:a,"aria-invalid":ue(r),"aria-required":ue(a),"aria-readonly":ue(s)}}function Lt(e){const t=qe(),{id:r,disabled:s,readOnly:a,required:o,isRequired:n,isInvalid:m,isReadOnly:i,isDisabled:u,onFocus:l,onBlur:c,...d}=e,h=e["aria-describedby"]?[e["aria-describedby"]]:[];return t!=null&&t.hasFeedbackText&&(t!=null&&t.isInvalid)&&h.push(t.feedbackId),t!=null&&t.hasHelpText&&h.push(t.helpTextId),{...d,"aria-describedby":h.join(" ")||void 0,id:r??(t==null?void 0:t.id),isDisabled:s??u??(t==null?void 0:t.isDisabled),isReadOnly:a??i??(t==null?void 0:t.isReadOnly),isRequired:o??n??(t==null?void 0:t.isRequired),isInvalid:m??(t==null?void 0:t.isInvalid),onFocus:Re(t==null?void 0:t.onFocus,l),onBlur:Re(t==null?void 0:t.onBlur,c)}}const kt=U(function(t,r){const{direction:s,align:a,justify:o,wrap:n,basis:m,grow:i,shrink:u,...l}=t,c={display:"flex",flexDirection:s,alignItems:a,justifyContent:o,flexWrap:n,flexBasis:m,flexGrow:i,flexShrink:u};return E.jsx(K.div,{ref:r,__css:c,...l})});kt.displayName="Flex";const Oe=U(function(t,r){const{templateAreas:s,gap:a,rowGap:o,columnGap:n,column:m,row:i,autoFlow:u,autoRows:l,templateRows:c,autoColumns:d,templateColumns:h,...y}=t,p={display:"grid",gridTemplateAreas:s,gridGap:a,gridRowGap:o,gridColumnGap:n,gridAutoColumns:d,gridColumn:m,gridRow:i,gridAutoFlow:u,gridAutoRows:l,gridTemplateRows:c,gridTemplateColumns:h};return E.jsx(K.div,{ref:r,__css:p,...y})});Oe.displayName="Grid";const It=U(function(t,r){const{columns:s,spacingX:a,spacingY:o,spacing:n,minChildWidth:m,...i}=t,u=ut(),l=m?Ft(m,u):qt(s);return E.jsx(Oe,{ref:r,gap:n,columnGap:a,rowGap:o,templateColumns:l,...i})});It.displayName="SimpleGrid";function Pt(e){return typeof e=="number"?`${e}px`:e}function Ft(e,t){return Fe(e,r=>{const s=dt("sizes",r,Pt(r))(t);return r===null?null:`repeat(auto-fit, minmax(${s}, 1fr))`})}function qt(e){return Fe(e,t=>t===null?null:`repeat(${t}, minmax(0, 1fr))`)}const de=U(function(t,r){const{htmlWidth:s,htmlHeight:a,alt:o,...n}=t;return E.jsx("img",{width:s,height:a,ref:r,alt:o,...n})});de.displayName="NativeImage";const Ot=U(function(t,r){const{fallbackSrc:s,fallback:a,src:o,srcSet:n,align:m,fit:i,loading:u,ignoreFallback:l,crossOrigin:c,fallbackStrategy:d="beforeLoadOrError",referrerPolicy:h,...y}=t,p=s!==void 0||a!==void 0,g=u!=null||l||!p,_=wt({...t,crossOrigin:c,ignoreFallback:g}),R=Ct(_,d),f={ref:r,objectFit:i,objectPosition:m,...g?y:ct(y,["onError","onLoad"])};return R?a||E.jsx(K.img,{as:de,className:"chakra-image__placeholder",src:s,...f}):E.jsx(K.img,{as:de,src:o,srcSet:n,crossOrigin:c,loading:u,referrerPolicy:h,className:"chakra-image",...f})});Ot.displayName="Image";const Ne=U(function(t,r){const{htmlSize:s,...a}=t,o=Ie("Input",a),n=me(a),m=Mt(n),i=ae("chakra-input",t.className);return E.jsx(K.input,{size:s,...m,__css:o.field,ref:r,className:i})});Ne.displayName="Input";Ne.id="Input";const Nt=U(function(t,r){const s=lt("Link",t),{className:a,isExternal:o,...n}=me(t);return E.jsx(K.a,{target:o?"_blank":void 0,rel:o?"noopener":void 0,ref:r,className:ae("chakra-link",a),...n,__css:s})});Nt.displayName="Link";const Dt=/^[A-Za-z0-9_-]{11}$/;function Q(e){return e&&Dt.test(e)?e:null}function Bt(e){const t=e.toLowerCase();return t==="youtu.be"||t.endsWith(".youtu.be")||t==="youtube.com"||t.endsWith(".youtube.com")||t==="youtube-nocookie.com"||t.endsWith(".youtube-nocookie.com")}function jt(e){var a;if(!(e!=null&&e.trim()))return null;let t;try{const o=e.trim();
2t=new URL(/^[a-z][a-z\d+.-]*:\/\//i.test(o)?o:`https://${o}`)}catch{return null}const r=t.hostname.toLowerCase();if(r==="youtu.be"||r.endsWith(".youtu.be"))return Q(t.pathname.split("/").filter(Boolean)[0]);if(Bt(r)){const o=Q(t.searchParams.get("v"));if(o)return o;const n=t.pathname.split("/").filter(Boolean);return["live","shorts","embed","v"].includes(n[0])?Q(n[1]):null}if(r==="google.com"||r.endsWith(".google.com")){const n=new URLSearchParams(t.hash.replace(/^#/,"")).get("vld"),m=(a=n==null?void 0:n.match(/(?:^|,)vid:([A-Za-z0-9_-]{11})(?:,|$)/))==null?void 0:a[1];return Q(m)}return null}const zt=new Set(["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation"]),Gt=new Set(["pdf","doc","docx","ppt","pptx"]);function qr(e,t){var n;const r=(t==null?void 0:t.toLowerCase())||"";if(r.startsWith("audio/"))return O.Audio;if(r.startsWith("video/"))return O.Video;if(r.startsWith("image/"))return O.Image;if(zt.has(r))return O.PDF;if(r==="text/plain")return O.AnkiTxt;if(!e)return O.Webpage;if(jt(e))return O.YouTubeVideo;const a=e.split(/[?#]/,1)[0].split("/").pop()||"",o=a.includes(".")&&((n=a.split(".").pop())==null?void 0:n.toLowerCase())||"";return mt.includes(o)?O.Audio:ft.includes(o)?O.Video:pt.includes(o)?O.Image:Gt.has(o)?O.PDF:o==="txt"?O.AnkiTxt:O.Webpage}const Or=e=>E.jsx("svg",{width:e.width||14,height:e.height||14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:E.jsx("path",{d:"M14 1.41L12.59 0L7 5.59L1.41 0L0 1.41L5.59 7L0 12.59L1.41 14L7 8.41L12.59 14L14 12.59L8.41 7L14 1.41Z",fill:e.color||"#525151"})}),Ee="linear-gradient(180deg, #5FCC85 0%, #3EB96D 55%, #2A8F4F 100%)",ee=142,xe=[{hue:ee,saturationPercent:70,lightnessPercent:58},{hue:ee+15,saturationPercent:60,lightnessPercent:50},{hue:ee-50,saturationPercent:60,lightnessPercent:55},{hue:ee-10,saturationPercent:75,lightnessPercent:45}],Ut="#DFE9E3",$=100,Wt="linear-gradient(to bottom, rgba(255,255,255,0.36) 0%, rgba(255,255,255,0.144) 22%, rgba(255,255,255,0) 48%, rgba(0,0,0,0) 70%, rgba(0,20,8,0.10) 100%)",Kt={type:"spring",stiffness:13,damping:7,mass:1},Ht={duration:.25,ease:"easeOut"},De="hsl(80, 100%, 72%)",$t=6,Xt=.9,Vt="hsl(80, 100%, 55%)",Yt=32,Zt=.75,St="linear-gradient(180deg, #C8FF7C 0%, #9CF45C 55%, #74E63E 100%)",Jt=.12,Qt=1.1,er=1.9,tr=3,rr=30,sr=1e3/30;function Be(e,t,r,s){I.useEffect(()=>{const a=e.current;if(!a)return;const o=a.getContext("2d");if(!o)return;const n=()=>{const c=a.getBoundingClientRect(),d=Math.min(2,window.devicePixelRatio||1),h=Math.max(1,Math.round(c.width*d)),y=Math.max(1,Math.round(c.height*d));return(a.width!==h||a.height!==y)&&(a.width=h,a.height=y),o.setTransform(d,0,0,d,0,0),{cssWidth:c.width,cssHeight:c.height}};if(r){const{cssWidth:c,cssHeight:d}=n();c>0&&d>0&&t(o,c,d,0);return}let m=0;const i=performance.now();let u=0;const l=c=>{if(m=requestAnimationFrame(l),c-u<sr)return;u=c;const{cssWidth:d,cssHeight:h}=n();d>0&&h>0&&t(o,d,h,(c-i)/1e3)};return m=requestAnimationFrame(l),()=>cancelAnimationFrame(m)},s)}const or=ne.memo(function({canvasWidthInPixels:t,prefersReducedMotion:r}){const s=I.useRef(null);return Be(s,(a,o,n,m)=>{a.clearRect(0,0,o,n),xe.forEach((i,u)=>{const c=(u+.5)/xe.length*o+Math.sin(m*.16+u*1.7)*o*.18,d=n*.5,h=Math.max(1,o*.55),y=a.createRadialGradient(c,d,0,c,d,h),p=`${i.hue},${i.saturationPercent}%,${i.lightnessPercent}%`;y.addColorStop(0,`hsla(${p},0.32)`),y.addColorStop(1,`hsla(${p},0)`),a.fillStyle=y,a.fillRect(0,0,o,n)})},r,[r]),E.jsx("canvas",{ref:s,"aria-hidden":!0,style:{position:"absolute",left:0,top:0,width:t,height:"100%",mixBlendMode:"overlay",opacity:.85,pointerEvents:"none"}})}),ar=ne.memo(function({isLargeBar:t,canvasWidthInPixels:r,prefersReducedMotion:s}){const a=I.useRef(null),o=.65,n=tr*(t?1:.6),m=`rgba(0,32,16,${Jt})`,i="rgba(0,32,16,0)";return Be(a,(u,l,c,d)=>{u.clearRect(0,0,l,c),u.filter=`blur(${n}px)`;const h=c*Qt,y=Math.min(rr,Math.max(1,Math.round(l/h)));for(let p=0;p<y;p++){const _=(p+.5)*h+Math.sin(d*.25*o+p*1.3)*l*.07,R=c/2+Math.sin(d*.18*o+p*2)*c*.36,f=Math.max(1,c*(er+.5*Math.sin(d*.3+p))),C=c*.55,b=u.createRadialGradient(_,R,0,_,R,f);b.addColorStop(0,m),b.addColorStop(1,i),u.save(),u.translate(_,R),u.scale(1,C/f),u.translate(-_,-R),u.fillStyle=b,u.fillRect(0,0,l,c*4),u.restore(
2)}u.filter="none"},s,[n,s]),E.jsx("canvas",{ref:a,"aria-hidden":!0,style:{position:"absolute",left:0,top:0,width:r,height:"100%",mixBlendMode:"multiply",pointerEvents:"none"}})}),Te=ne.memo(function({blurScale:t}){return E.jsxs(E.Fragment,{children:[E.jsx("div",{"aria-hidden":!0,style:{position:"absolute",inset:0,borderRadius:$,background:De,filter:`blur(${$t*t}px)`,opacity:Xt}}),E.jsx("div",{"aria-hidden":!0,style:{position:"absolute",inset:0,borderRadius:$,background:Vt,filter:`blur(${Yt*t}px)`,opacity:Zt}})]})}),Nr=ne.memo(function({progressPercentage:t,isIndeterminate:r=!1,initialFillPercentage:s=0,trackHeight:a=16,width:o="100%",showAnimatedTextureCanvases:n=!0,glowMode:m="full",newProgressDeltaStartPercentage:i,style:u}){const l=_t()??!1,c=Math.min(100,Math.max(0,t||0)),h=`${Math.min(100,Math.max(0,s||0))}%`,y=I.useRef(null),[p,g]=I.useState(0);I.useEffect(()=>{const D=y.current;if(!D)return;const z=new ResizeObserver(B=>{g(B[0].contentRect.width)});return z.observe(D),()=>z.disconnect()},[]);const _=c<=0?"0%":`${c}%`,R=l?Ht:Kt,f=a+10,C=a>=12,b=C?1:.6,x=typeof i=="number"?Math.min(100,Math.max(0,i)):null,v=m==="newProgressDelta"&&x!==null&&x<c,A=`${x??0}%`,P=`${c-(x??0)}%`;return E.jsx("div",{role:"progressbar","aria-valuenow":r?void 0:Math.round(c),"aria-valuemin":0,"aria-valuemax":100,style:{position:"relative",width:o,height:f,display:"flex",alignItems:"center",...u},children:E.jsxs("div",{style:{position:"relative",width:"100%",height:a},children:[!r&&m==="full"&&E.jsx(Y.div,{"aria-hidden":!0,initial:{width:h},animate:{width:_},transition:{width:R},style:{position:"absolute",top:0,left:0,height:"100%",pointerEvents:"none",zIndex:0},children:E.jsx(Te,{blurScale:b})}),!r&&v&&E.jsx(Y.div,{"aria-hidden":!0,initial:{width:"0%"},animate:{width:P},transition:{width:R},style:{position:"absolute",top:0,left:A,height:"100%",pointerEvents:"none",zIndex:0},children:E.jsx(Te,{blurScale:b})}),E.jsxs("div",{ref:y,style:{position:"absolute",inset:0,background:Ut,borderRadius:$,overflow:"hidden",zIndex:1},children:[r&&E.jsx(Y.div,{"aria-hidden":!0,initial:l?{left:"32%"}:{left:"-35%"},animate:l?{left:"32%"}:{left:"100%"},transition:l?{duration:0}:{duration:1.6,ease:"easeInOut",repeat:1/0},style:{position:"absolute",top:0,width:"35%",height:"100%",background:Ee,borderRadius:$,boxShadow:`0 0 10px ${De}`}}),!r&&E.jsxs(Y.div,{initial:{width:h},animate:{width:_},transition:{width:R},style:{position:"absolute",top:0,left:0,height:"100%",borderRadius:$,overflow:"hidden",isolation:"isolate"},children:[E.jsx("div",{style:{position:"absolute",inset:0,background:Ee}}),n&&p>0?E.jsxs(E.Fragment,{children:[E.jsx(or,{canvasWidthInPixels:p,prefersReducedMotion:l}),E.jsx(ar,{isLargeBar:C,canvasWidthInPixels:p,prefersReducedMotion:l})]}):null,E.jsx("div",{"aria-hidden":!0,style:{position:"absolute",inset:0,background:Wt,pointerEvents:"none"}})]}),!r&&v&&E.jsx(Y.div,{"aria-hidden":!0,initial:{width:"0%"},animate:{width:P},transition:{width:R},style:{position:"absolute",top:0,left:A,height:"100%",background:St,borderTopRightRadius:$,borderBottomRightRadius:$,zIndex:2,pointerEvents:"none"}})]})]})})}),Dr=e=>E.jsxs("svg",{height:e.height||52,viewBox:"0 0 1321 776",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[E.jsx("path",{d:"M490.7 360.9C489.2 358.4 488 355.6 486.9 352.6V352.5C485 347.1 483.8 341 483.3 334.3C483.3 334.3 483.7 322.5 481.4 322.8C479.1 323.2 477.5 327.4 477.5 327.4C476 329.7 455.1 409.7 428.5 411.9C381.3 415.7 387.1 328.9 388.4 293.2C389.1 275.3 390.9 257.9 392.5 245.1C392.5 245.1 393.3 236.8 395.1 226.7C395.4 225.1 395.5 224.2 395.5 224.2C395.5 224.2 395.8 220.2 397.3 215.6C399.5 205.7 402.5 196.1 406.4 191.8C415.9 181.3 445.4 194.4 446.6 204.3C447.8 214.2 437.5 272.7 437.5 272.7C433.9 303.9 431.1 337.7 437.5 338.9C444.6 340.3 462.3 274.5 476.8 226.2C476.8 226.2 487 171.8 497.8 166.7C507.9 161.9 521.4 164.6 525.7 170C526 170.3 526.2 170.7 526.4 171C526.5 171.2 526.6 171.3 526.7 171.5C528.5 174.7 532.1 182.8 530.2 193.1C529.6 218.2 521.6 291 524 313C524.4 315.6 525.8 323.4 533.4 324.6C542.2 325.9 545.5 313.6 545.5 313.6C549.4 299.1 553.2 287.7 553.2 287.7L585.2 172.1C590.3 165 599.9 155.3 614.3 155.2C634.5 155.2 633.1 160.8 633.1 163.1C633.1 165.4 622.6 200 622.6 200C622.6 200 655.7 154.6 696.7 159.1C696.7 159.1 751.5 161.8 723.6 231.2C718.3 241.9 712.2 254.9 706.5 269C706.5 269.1 679.3 341.8 730.3 364.8C721.3 366.5 699.5 369.2 676.6 361C676.6 361 683.4 369.7 716.1 372.1C655.9 389.7 634.1 360.7 634.1 360.7C623.5 346.9 629.2 327.7 633.9 311.3C640.8 287.2 681.2 213.8 681.2 213.8C681.2 213.8 696.6 182.6 669.1 196.4C650.1 206 634.8 231.9 634.8 231.9C630.5 241.1 607.8 279.5 591.7 339.8C591.7 339.8 589.3 356 580.4 363.7C571.5 371.4 546.4 379.5 539.2 370.4C537.4 368.2 536.9 363.7 537.1 358.2C537.1 358 537.1 357.7 537.1 357.5C536.8 357.7 506.1 382.2 490.7 360.9Z",fill:"#005306"}),E.jsx("path",{d:"M1206.2 309.9C1207.5 283.9 1176.3 274.5 1176.3 274.5C1173.4 273.4 1170.5 272.6 1167.5 271.9C1167.5 271.9 1113.8 254.2 1024.8 321.9C1017.7 327.1 1008.6 332.9 996.2 337.8C935.7 362 949.6 326.2 949.6 326.2C954 300.9 1012.5 236.2 1012.5 236.2C1015.9 236.2 1019.3 236 1022.7 235.8C1022.8 235.8 1022.8 235.8 1022.9 235.8C1025.4 235.6 1028 235.4 1030.5 235.2C1030.6 235.2 1030.8 235.2 1030.9 235.1C1039 234.3 1047 233 1054.9 231.2C1219.2 200.5 1279.2 122.2 1254.3 83.9C1242.5 65.8 1211.8 64.1 1211.8 64.1C1187.4 62.8 1160.1 71.4 1133.4 84.6C1125.8 88 1117.9 92 1109.8 96.7C1070.1 119.8 1030.4 152.4 997.3 185.2C950.9 172.2 937.9 133.4 937.9 133.4C937.4 131.6 937 129.8 936.7 127.9C936.7 127.9 936.4 128.6 936 129.7C936 129.7 913.6 182.2 947.3 210.3C947.3 210.3 953.1 215.4 963.4 221.1C960.2 224.7 957.1 228.3 954.1 231.9C954.1 231.9 893.2 294.7 889.8 345.3C889.8 345.3 879.1 423.6 1014.2 382.7C1013.9 410.8 1031.4 434.1 1056.6 440.7C1090.2 449.5 1130.1 424.3 1137.3 415.1C1146.6 403.3 1144.1 383.1 1139.2 384.5C1137 385.2 1117.8 396.7 1117.8 396.7C1117.8 396.7 1083.3 417.8 1065.7 399.1C1048.1 380.4 1070.4 354 1070.4 354C1140.2 393.9 1204.9 335.9 1206.2 309.9ZM1160.3 304.4C1180.1 311.6 1145.8 344 1096.6 328C1096.6 328 1140.5 297.2 1160.3 304.4ZM1176.5 113C1176.5 113 1196.4 107 1202 113.6C1208.8 121.7 1202.2 132 1189.8 138.6C1160.8 156.7 1109.8 179.3 1057.7 186.7C1077.7 170.6 1139.4 121.8 1176.5 113Z",fill:"#005306"}),E.jsx("path",{d:"M588.395 447.883C555.958 451.987 478.999 466.898 403.054 520.606C403.054 520.606 479.263 445.859 580.845 438.945C555.676 423.967 531.343 421.864 531.343 421.864L534.063 432.342L511.806 423.629C491.204 428.149 464.194 448.906 464.194 448.906C476.708 456.999 475.638 459.655 475.638 459.655C460.993 457.074 442.076 465.316 442.076 465.316C413.481 482.346 391.512 530.187 391.512 530.187C417.878 538.998 457.397 526.235 457.397 526.235L474.549 498.456L474.178 523.404C490.959 520.574 516.453 511.707 516.453 511.707L528.193 481.792L536.435 500.708C567.9 487.041 583.864 457.518 588.395 447.883Z",fill:"#005306"}),E.jsx("path",{d:"M365.6 193C363.5 163.3 347.1 169.7 347.1 169.7C319.8 174.9 306.1 189.3 299.1 202.1C299.1 202.1 291 213.4 292.7 231.3L293.8 241.8C310.8 409 286 522 286 522C275 589.7 244.4 632.3 226.2 639.9C219.8 642.6 214.4 642.7 209.8 641.4C208.8 641.1 207.9 640.8 207 640.3C166.6 624.2 151.8 560.9 166.4 505.6C166.4 505.6 173.1 479.3 189.2 473.6C189.2 473.6 205.5 464.4 216.1 478.2C218.2 48
20.9 219.4 482 221.6 482.2C223.5 482.3 225.3 481.5 226.8 479.3C228 477.9 228.8 475.4 229.2 471.3C230.2 461.7 228.3 447.8 218.5 434.2C212.3 423.2 201.9 413.7 193.4 407.1C188.6 402.8 183.8 399.8 179.6 397.7C170.9 393.4 164.5 393.2 164.5 393.2C160.7 392.9 156.8 393.3 152.7 394.8C119.8 406.7 106.6 442.5 106.6 442.5C61.4 546.5 94.9 678.7 204.1 691.9C347.4 709.2 364.3 462.9 364.3 462.9C365.9 449.5 367.1 436.4 368 423.7C369.1 413.2 369.8 402.5 370.3 391.7C374.8 337.1 367.6 222.6 365.6 193ZM128.7 471.7C128.7 471.7 143.7 416.3 183.2 418.6C186.4 418.8 190.4 419.5 194.3 421.3C193.9 421.2 193.5 421.2 193 421.1C154.5 418.1 128.7 471.7 128.7 471.7Z",fill:"#005306"}),E.jsx("path",{d:"M1162.5 549.6C1160.3 544.9 1157.3 540.4 1154 536.5C1145.5 523.4 1108.3 500.9 1108.3 500.9C1105.7 499.2 1104.1 498.2 1104.1 498.2C1050.2 463 967 438 967 438C921.8 422.9 882.2 415.8 847.1 412.1C847.5 411.2 847.9 410.3 848.4 409.5C873.9 359.4 893.3 307.6 905.4 272C911.5 255.2 916.6 239.6 919.6 226.7C919.6 226.5 919.7 226.5 919.7 226.5V226.6C920.2 224.5 920.6 222.5 921 220.6C931.8 165.8 870.1 160.2 866.4 159.9C849 157.5 833.5 159.8 833.5 159.8C747.9 168.3 687.6 296.5 724.5 343C761.4 389.5 824.5 337.8 824.5 337.8C824.5 337.8 814 364.6 794.7 407.7L766.8 465.9C756.1 488.3 712 574.2 672.8 556.6C669.7 555.2 666.9 552.8 664.5 549.3C664.5 549.3 623.1 489.9 756 466.2L783.7 409.2C742.7 411.5 711.2 420.4 688.3 430.3C677.1 434.7 666.1 440.3 653.8 449.3C644.5 455.9 640 460.6 640 460.6C640 460.6 588.7 508.5 612.8 568.4C612.8 568.4 642.4 652.2 721.5 606C732.3 599.7 743.2 589.8 754.9 576.5C778.5 549.5 800.4 504.4 821.4 462.7C915.4 468.6 989.9 488.9 1044.3 508.7L1046 496L1063.1 517C1074.7 521.3 1076.2 522 1085.6 525.8L1081.2 510L1100.9 531.1L1103.4 533.7C1103.4 533.7 1107.8 535.3 1112.5 537.1C1116.1 538.6 1119.6 540 1122.7 541.4C1122.8 541.5 1122.9 541.5 1122.9 541.5V541.4L1117.2 521.9L1133.1 544C1149.8 548.4 1162.5 549.6 1162.5 549.6ZM767.1 310.8C752.1 298.3 759.2 264.6 782.9 235.7C806.6 206.8 838.1 193.5 853 206.1C868 218.6 860.9 252.3 837.2 281.2C813.5 310.1 782.1 323.3 767.1 310.8Z",fill:"#005306"})]}),ce="jungle:anonymous-upload-claims:v1",nr=1440*60*1e3,je=20;function fe(){try{const e=JSON.parse(sessionStorage.getItem(ce)||"[]");if(!Array.isArray(e))return[];const t=Date.now();return e.filter(r=>{var n,m,i;if(!r||typeof r!="object")return!1;const s=typeof r.taskId=="string"&&typeof r.processingUrl=="string",a=Number.isFinite(r.createdAt)&&r.createdAt<=t&&t-r.createdAt<nr,o=typeof((n=r.body)==null?void 0:n.file_name)=="string"&&typeof((m=r.body)==null?void 0:m.uploaded_file_s3_object_key)=="string"&&typeof((i=r.body)==null?void 0:i.content_medium_type)=="string";return s&&a&&o}).slice(-je)}catch{return[]}}function pe(e){try{e.length?sessionStorage.setItem(ce,JSON.stringify(e)):sessionStorage.removeItem(ce)}catch{}}function ze(e,t,r){if(typeof r.file_name!="string"||typeof r.uploaded_file_s3_object_key!="string"||typeof r.content_medium_type!="string")return;const s=fe().filter(a=>a.taskId!==e);
2s.push({taskId:e,processingUrl:t,createdAt:Date.now(),body:{file_name:r.file_name,uploaded_file_s3_object_key:r.uploaded_file_s3_object_key,content_medium_type:r.content_medium_type}}),pe(s.slice(-je))}function ir(e,t){const r=fe();return pe(r),r.find(s=>s.taskId===e&&s.processingUrl===t)}function ur(e){pe(fe().filter(t=>t.taskId!==e))}const Ge=64*1024,Ue=3e4,dr=64*1024*1024,We=6e4,cr=5e3;function Ke(e){return typeof e.arrayBuffer=="function"?e.arrayBuffer():new Promise((t,r)=>{const s=new FileReader;s.onload=()=>{t(s.result instanceof ArrayBuffer?s.result:new ArrayBuffer(0))},s.onerror=()=>r(s.error??new Error("FileReader failed")),s.onabort=()=>r(s.error??new Error("FileReader aborted")),s.readAsArrayBuffer(e)})}async function He(e,t,r,s){if(s!=null&&s.aborted)return{outcome:"aborted"};let a=null,o=null;const n=new Promise(i=>{a=setTimeout(()=>i("timeout"),Math.max(1,t))}),m=new Promise(i=>{if(!s)return;const u=()=>i("aborted");s.addEventListener("abort",u,{once:!0}),o=()=>s.removeEventListener("abort",u)});try{const i=await Promise.race([r(e),n,m]);return i==="timeout"?{outcome:"timeout"}:i==="aborted"?{outcome:"aborted"}:{outcome:"bytes",bytes:i}}catch(i){return s!=null&&s.aborted?{outcome:"aborted"}:{outcome:"error",cause:i}}finally{a&&clearTimeout(a),o==null||o()}}async function lr({file:e,maximumProbeBytes:t=Ge,timeoutMs:r=Ue,readBlobBytes:s=Ke,signal:a}){if(!(e.size>0))return{isReadable:!0,probedBytes:0};let o;try{o=e.slice(0,Math.min(e.size,Math.max(1,t)))}catch(m){return{isReadable:!1,failureKind:"read-error",cause:m}}const n=await He(o,r,s,a);return n.outcome==="aborted"?{isReadable:!1,failureKind:"aborted"}:n.outcome==="timeout"?{isReadable:!1,failureKind:"timeout"}:n.outcome==="error"?{isReadable:!1,failureKind:"read-error",cause:n.cause}:n.bytes.byteLength>0?{isReadable:!0,probedBytes:n.bytes.byteLength}:{isReadable:!1,failureKind:"empty-read"}}async function mr({file:e,timeoutMs:t=We,readBlobBytes:r=Ke,signal:s}){const a=await He(e,t,r,s);return a.outcome==="aborted"?{isMaterialized:!1,failureKind:"aborted"}:a.outcome==="timeout"?{isMaterialized:!1,failureKind:"timeout"}:a.outcome==="error"?{isMaterialized:!1,failureKind:"read-error",cause:a.cause}:e.size>0&&!(a.bytes.byteLength>0)?{isMaterialized:!1,failureKind:"empty-read"}:a.bytes.byteLength!==e.size?{isMaterialized:!1,failureKind:"size-changed"}:{isMaterialized:!0,blob:new Blob([a.bytes],{type:e.type})}}function fr({fileSizeBytes:e,elapsedMs:t,uploadedBytes:r,maximumBytes:s=dr,fastFailureWindowMs:a=cr}){return e>0&&e<=s&&t<=a&&!(r>0)}function Br(e){if(!e||typeof e!="object")return null;const t=e.name;return typeof t=="string"&&t?t:null}function jr(e){if(typeof e=="string")return e.slice(0,300);if(!e||typeof e!="object")return null;const t=e.message;return typeof t=="string"&&t?t.slice(0,300):null}function zr(e){if(!Number.isFinite(e)||e<=0)return"empty";const t=1024*1024;return e<t?"under-1mb":e<5*t?"1mb-5mb":e<10*t?"5mb-10mb":e<25*t?"10mb-25mb":e<100*t?"25mb-100mb":"over-100mb"}function Gr({userAgent:e=typeof navigator>"u"?"":navigator.userAgent,hasNativeWebViewBridge:t=typeof window<"u"&&!!window.ReactNativeWebView}={}){const r=/;\s*wv\)/.test(e),{operatingSystem:s,browserFamily:a}=gt({userAgent:e,isRunningAsMobileApp:t});return`${s}-${t||r?"native-webview":a}`}var $e=(e=>(e.ValidateInput="validate-input",e.ReadLocalFile="read-local-file",e.RequestUploadUrl="request-upload-url",e.UploadToStorage="upload-to-storage",e.CreateProcessingTask="create-processing-task",e.AwaitProcessing="await-processing",e.ReadProcessedText="read-processed-text",e.RetrieveSource="retrieve-source",e))($e||{});const pr=3e4,hr=128*1024*1024,yr=99e6;var Xe=(e=>(e.Cancelled="cancelled",e.EmptyFile="empty-file",e.TooManyFiles="too-many-files",e.UnsupportedFile="unsupported-file",e.FilePreparation="file-preparation",e.FileUnreadable="file-unreadable",e.Network="network",e.RequestTimeout="request-timeout",e.Http="http",e.InvalidResponse="invalid-response",e.Listener="listener",e.MissingTask="missing-task",e.SourceUnavailable="source-unavailable",e.ProcessingTimeout="processing-timeout",e.RestorationRequired="restoration-required",e.ProcessingFailed="processing-failed",e))(Xe||{});const he=(e,t)=>t;
2class w extends Error{constructor({message:t,stage:r,code:s,retryable:a,requestAttempts:o=1,httpStatus:n,cfRayId:m,storageRequestId:i,storageExtendedRequestId:u,storageTransport:l,storageErrorCode:c,storageErrorMessage:d,responseContentType:h,responseBodyType:y,responseBodyKeys:p,fileReadFailureKind:g,bodyMaterialized:_=!1,cause:R}){super(t),this.name="FileUploadError",this.stage=r,this.code=s,this.retryable=a,this.requestAttempts=o,this.httpStatus=n,this.cfRayId=m,this.storageRequestId=i,this.storageExtendedRequestId=u,this.storageTransport=l,this.storageErrorCode=c,this.storageErrorMessage=d,this.responseContentType=h,this.responseBodyType=y,this.responseBodyKeys=p,this.fileReadFailureKind=g,this.bodyMaterialized=_,this.cause=R}}function Ae(e,t){return new w({message:e.message,stage:e.stage,code:e.code,retryable:e.retryable,requestAttempts:e.requestAttempts,httpStatus:e.httpStatus,cfRayId:e.cfRayId,storageRequestId:e.storageRequestId,storageExtendedRequestId:e.storageExtendedRequestId,storageTransport:e.storageTransport,storageErrorCode:e.storageErrorCode,storageErrorMessage:e.storageErrorMessage,responseContentType:e.responseContentType,responseBodyType:e.responseBodyType,responseBodyKeys:e.responseBodyKeys,fileReadFailureKind:e.fileReadFailureKind,bodyMaterialized:e.bodyMaterialized,cause:e.cause,...t})}const ye="uploaded-file.invalid",S=new Map;let re=null;function ge(e){e&&(re&&re!==e&&S.clear(),re=e)}function Ur(e,t){const r=t.toLowerCase().match(/\.([a-z0-9]{1,10})$/),s=r?`source.${r[1]}`:"source";return`https://${ye}/${encodeURIComponent(e)}/${s}`}function Ve(e){if(!e)return!1;try{return new URL(e).hostname===ye}catch{return!1}}function Wr(e){if(!e)return null;try{const t=new URL(e);if(t.hostname!==ye)return null;const r=t.pathname.split("/").filter(Boolean)[0];return r?decodeURIComponent(r):null}catch{return null}}function Kr(e){if(!e)return!1;try{const t=new URL(e);return t.protocol!=="https:"||!t.hostname.endsWith(".amazonaws.com")?!1:t.hostname.split(".").some(r=>r==="s3"||r.startsWith("s3-"))}catch{return!1}}function Hr(e,t){return Ve(e)?e:t}function $r(e,t,r){return Ve(e)?!!t:r}function gr(e){if(typeof e!="string"||!e)return!1;try{return new URL(e).protocol==="https:"}catch{return!1}}function Xr(e,t){var r;return((r=Ye(e,t))==null?void 0:r.url)??null}function Vr(e,t){var r;return((r=Ye(e,t))==null?void 0:r.expiresAt)??null}function Yr(e,t){!e||!t||(ge(t),S.delete(e))}function Ye(e,t){if(!e||!t)return null;ge(t);const r=S.get(e);return r?r.expiresAt<=Date.now()?(S.delete(e),null):r:null}function Zr(){var r;if((r=globalThis.crypto)!=null&&r.randomUUID)return globalThis.crypto.randomUUID();const e=new Uint8Array(16);globalThis.crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;const t=Array.from(e,s=>s.toString(16).padStart(2,"0"));return[t.slice(0,4).join(""),t.slice(4,6).join(""),t.slice(6,8).join(""),t.slice(8,10).join(""),t.slice(10,16).join("")].join("-")}function ve(e){try{const t=new URL(e.url),r=t.hostname.match(/^(.+?)\.s3(?:[.-][^.]+)?\.amazonaws\.com$/i);return r!=null&&r[1]?r[1]:t.pathname.split("/").filter(Boolean)[0]||null}catch{return null}}const J=e=>new Promise(t=>{setTimeout(t,e)});function be(e){if(e instanceof TypeError)return!0;if(e instanceof Error||typeof e=="object"&&e!==null&&"name"in e){const t=String(e.name||"");return t==="NetworkError"||t==="AbortError"}return!1}function N(e,t){return new w({message:"File upload was cancelled",stage:e,code:"cancelled",retryable:!0,cause:t})}function Z(e){return e instanceof w&&e.code==="cancelled"}function Sr({onPageExit:e,cancellationSignal:t,eventTarget:r=typeof window>"u"?null:window}){let s=!1,a=!1;const o=n=>{const m="persisted"in n&&!!n.persisted;s||a||t!=null&&t.aborted||m||(a=!0,e())};return r==null||r.addEventListener("pagehide",o),{markSettled:()=>{s=!0},dispose:()=>{s=!0,r==null||r.removeEventListener("pagehide",o)}}}function G(e,t){var r;try{return((r=e.headers)==null?void 0:r.get(t))||void 0}catch{return}}function br(e){return e===null?{responseBodyType:"empty"}:Array.isArray(e)?{responseBodyType:"array"}:typeof e=="object"?{responseBodyType:"object",responseBodyKeys:Object.keys(e).sort().slice(0,20)}:{responseBodyType:typeof e}}
2async function _e(e){try{const t=await e.text();if(!t)return null;try{return JSON.parse(t)}catch{return t}}catch{return null}}async function se({url:e,requestInit:t,stage:r,fetchImpl:s,sleepMs:a,maxAttempts:o,requestTimeoutMs:n,overallDeadlineMs:m,cancellationSignal:i,onNetworkRetry:u}){let l,c=!1,d=0;for(let y=1;y<=o;y+=1){if(i!=null&&i.aborted)throw N(r,i.reason);const p=m===void 0?n:m-Date.now();if(p<=0){c=!0;break}d=y;const g=new AbortController,_=()=>g.abort(i==null?void 0:i.reason);i==null||i.addEventListener("abort",_,{once:!0});const R=Math.min(n,p),f=globalThis.setTimeout(()=>g.abort(),R);try{const C=typeof t=="function"?t():t;return await s(e,{...C,signal:g.signal})}catch(C){if(i!=null&&i.aborted)throw N(r,i.reason||C);if(!be(C))throw C;l=C,c=g.signal.aborted;const b=400*y,x=m===void 0?b:m-Date.now();if(y<o&&x>0){try{u==null||u({error:C,failedAttemptNumber:y,maximumAttempts:o})}catch{}await a(Math.min(b,x))}}finally{globalThis.clearTimeout(f),i==null||i.removeEventListener("abort",_)}}const h=c?"Network request timed out":l instanceof Error?l.message:"Network request failed";throw new w({message:h,stage:r,code:c?"request-timeout":"network",retryable:!0,requestAttempts:d,cause:l})}function Ze(e){if(!e||typeof e!="object")throw new w({message:"Upload URL response was not an object",stage:"request-upload-url",code:"invalid-response",retryable:!0});const t=e,r=t.fields,s=r&&typeof r=="object"?r.key:null;if(typeof t.url!="string"||!t.url||!r||typeof r!="object"||typeof s!="string"||!s)throw new w({message:"Upload URL response is missing a URL, fields, or object key",stage:"request-upload-url",code:"invalid-response",retryable:!0});return t}async function _r({url:e,body:t,fetchImpl:r=fetch,sleepMs:s=J,maxAttempts:a=3,requestTimeoutMs:o=3e4,cancellationSignal:n}){const m=Math.max(1,a);let i=null;for(let u=1;u<=m;u+=1)try{const l=await se({url:e,requestInit:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)},stage:"request-upload-url",fetchImpl:r,sleepMs:s,maxAttempts:1,requestTimeoutMs:o,cancellationSignal:n}),c=await _e(l);if(!l.ok){const d=l.status===408||l.status===429||l.status>=500;throw new w({message:"The upload service rejected the request",stage:"request-upload-url",code:"http",retryable:d,requestAttempts:u,httpStatus:l.status,cfRayId:G(l,"cf-ray")})}try{return Ze(c)}catch(d){throw d instanceof w?new w({message:d.message,stage:d.stage,code:d.code,retryable:d.retryable,requestAttempts:u,cause:d}):d}}catch(l){if(Z(l)||!(l instanceof w))throw l;if(i=l.requestAttempts===u?l:new w({message:l.message,stage:l.stage,code:l.code,retryable:l.retryable,requestAttempts:u,httpStatus:l.httpStatus,cfRayId:l.cfRayId,cause:l.cause}),!i.retryable||u>=m)throw i;await s(400*u)}throw i||new w({message:"The upload service did not return a response",stage:"request-upload-url",code:"invalid-response",retryable:!0,requestAttempts:m})}function oe(e,t){const r=new FormData;for(const[s,a]of Object.entries(t.fields))r.append(s,a);return r.append("file",e),r}async function Me({file:e,failedTransportError:t,storageRequestAttempts:r,cancellationSignal:s,timeoutMs:a}){const o=await mr({file:e,signal:s,timeoutMs:a});if(s!=null&&s.aborted||o.isMaterialized===!1&&o.failureKind==="aborted")throw N("upload-to-storage",s==null?void 0:s.reason);if(o.isMaterialized===!1)throw new w({message:"The selected file could not be read into memory after the storage transport failed",stage:"read-local-file",code:"file-unreadable",retryable:!1,requestAttempts:r,storageTransport:t.storageTransport,fileReadFailureKind:o.failureKind,bodyMaterialized:!1,cause:o.cause});return o.blob}function te(e,t){var o;const r=(()=>{try{return JSON.parse(e)}catch{return null}})(),s=(r==null?void 0:r[t])??(r==null?void 0:r[t.toLowerCase()]);if(typeof s=="string"&&s.trim())return s.trim().slice(0,500);const a=e.match(new RegExp(`<${t}>([\\s\\S]*?)</${t}>`,"i"));return((o=a==null?void 0:a[1])==null?void 0:o.trim().slice(0,500))||void 0}function Se(e){return e.trim()?{storageErrorCode:te(e,"Code"),storageErrorMessage:te(e,"Message")||(e.includes("<")?void 0:e.trim().slice(0,500)),storageRequestId:te(e,"RequestId"),storageExtendedRequestId:te(e,"HostId")}:{}}async function le(e){if(e.ok)return{};try{return Se(await e.text())}catch{return{}}}async function Je({file:e,presignedPost:t,requestTimeoutMs:r,requestAttemptsBeforeFallback:s,cancellationSignal:a,onUploadProgress:o,stallTimeoutMs:n=3e4}){return await new Promise((m,i)=>{if(a!=null&&a.aborted){i(N("upload-to-storage",a.reason));return}const u=new XMLHttpRequest;u.open("POST",t.url,!0),u.timeout=r;let l=!1,c=!1,d=null;const h=()=>{d&&globalThis.clearTimeout(d),a==null||a.removeEventListener("abort",_)},y=f=>{l||(l=!0,h(),f())},p=(f,C)=>{y(()=>i(new w({message:f==="request-timeout"?"Storage upload timed out":"Storage upload failed",stage:"upload-to-storage",code:f,retryable:!0,requestAttempts:s+1,storageTransport:"xhr",cause:C})))},g=()=>{d&&globalThis.clearTimeout(d),d=globalThis.setTimeout(()=>{c=!0,p("request-timeout"),u.abort()},Math.min(n,r))};function _(){y(()=>i(N("upload-to-storage",a==null?void 0:a.reason))),u.abort()}const R=()=>{const f=Se(u.responseText||"");return{ok:u.status>=200&&u.status<300,status:u.status,transport:"xhr",requestAttempts:s+1,...f,storageRequestId:u.getResponseHeader("x-amz-request-id")||f.storageRequestId,storageExtendedRequestId:u.getResponseHeader("x-amz-id-2")||f.storageExtendedRequestId}};u.onload=()=>
2{if(u.status===0){p("network");return}y(()=>m(R()))},u.onerror=f=>p("network",f),u.onabort=f=>{if(a!=null&&a.aborted){_();return}p(c?"request-timeout":"network",f)},u.ontimeout=f=>p("request-timeout",f),u.upload&&(u.upload.onprogress=f=>{if(g(),!(!f.lengthComputable||f.total<=0))try{o==null||o({loadedBytes:f.loaded,totalBytes:f.total,progressPercent:Math.min(100,Math.max(0,f.loaded/f.total*100))})}catch{}}),a==null||a.addEventListener("abort",_,{once:!0}),g(),u.send(oe(e,t))})}async function wr({file:e,presignedPost:t,proxyUrl:r,requestTimeoutMs:s,requestAttemptsBeforeFallback:a,fetchImpl:o=fetch,sleepMs:n=J,maxAttempts:m=2,preferXhrUpload:i=!1,xhrUploadImpl:u=Je,onUploadProgress:l,stallTimeoutMs:c,cancellationSignal:d}){const h=Math.max(1,m),y=Date.now()+Math.max(1,s);let p,g=!1,_=0;if(i)try{return{...await u({file:e,presignedPost:{...t,url:r},requestTimeoutMs:s,requestAttemptsBeforeFallback:a,cancellationSignal:d,onUploadProgress:l,stallTimeoutMs:c}),transport:"cloudflare-proxy"}}catch(f){if(Z(f)||!(f instanceof w&&["network","request-timeout"].includes(f.code)))throw f;_=1,p=f,g=f.code==="request-timeout"}const R=_;for(let f=1;f<=h;f+=1){if(d!=null&&d.aborted)throw N("upload-to-storage",d.reason);const C=y-Date.now();if(C<=0){g=!0;break}_=R+f;const b=new AbortController,x=()=>b.abort(d==null?void 0:d.reason);d==null||d.addEventListener("abort",x,{once:!0});const v=globalThis.setTimeout(()=>b.abort(),C);try{const A=await o(r,{method:"POST",body:oe(e,t),signal:b.signal}),P=await le(A);return{ok:A.ok,status:A.status,transport:"cloudflare-proxy",requestAttempts:a+_,...P,storageRequestId:G(A,"x-amz-request-id")||P.storageRequestId,storageExtendedRequestId:G(A,"x-amz-id-2")||P.storageExtendedRequestId}}catch(A){if(d!=null&&d.aborted)throw N("upload-to-storage",d.reason||A);if(!be(A))throw A;if(p=A,g=b.signal.aborted,g||f>=h)break;await n(Math.min(400*f,Math.max(0,y-Date.now())))}finally{globalThis.clearTimeout(v),d==null||d.removeEventListener("abort",x)}}throw new w({message:g?"Upload fallback timed out":"Upload fallback failed",stage:"upload-to-storage",code:g?"request-timeout":"network",retryable:!0,requestAttempts:a+_,storageTransport:"cloudflare-proxy",cause:p})}async function Jr({file:e,cancellationSignal:t,maximumProbeBytes:r=Ge,timeoutMs:s=Ue,readBlobBytes:a}){if(t!=null&&t.aborted)throw N("read-local-file",t.reason);const o=await lr({file:e,maximumProbeBytes:r,timeoutMs:s,readBlobBytes:a,signal:t});if(t!=null&&t.aborted||o.isReadable===!1&&o.failureKind==="aborted")throw N("read-local-file",t==null?void 0:t.reason);if(o.isReadable===!1){const n={"read-error":"The selected file could not be read","empty-read":"The selected file returned no bytes",timeout:"Reading the selected file timed out",aborted:"Reading the selected file was cancelled","size-changed":"The selected file changed on disk while it was being read"};throw new w({message:n[o.failureKind],stage:"read-local-file",code:"file-unreadable",retryable:!1,fileReadFailureKind:o.failureKind,cause:o.cause})}return o}async function Cr({file:e,presignedPost:t,fetchImpl:r=fetch,sleepMs:s=J,maxAttempts:a=3,requestTimeoutMs:o=10*6e4,totalRequestBudgetMs:n=12*6e4,xhrUploadImpl:m,cloudflareProxyUploadImpl:i,preferXhrUpload:u=!1,xhrStallTimeoutMs:l=3e4,fetchRecoveryBudgetMs:c=45e3,minimumProxyReserveMs:d=3*6e4,cancellationSignal:h,onUploadProgress:y,onStorageTransportRecovery:p}){if(Ze(t),h!=null&&h.aborted)throw N("upload-to-storage",h.reason);const g=Math.max(1,n),_=Date.now()+g,R=!!i&&e.size<=yr,f=R?Math.min(Math.max(1,d),Math.max(1,Math.floor(g/3))):0,C=Math.min(Math.max(1,c),Math.max(1,Math.floor(g/3)));let b=null,x=0,v=null,A=!1;const D=m||(r===fetch&&typeof XMLHttpRequest<"u"&&m!==null?Je:null);let z=!1,B=e,j=!1,X=0;const V=T=>{X=Math.max(X,T.loadedBytes),y==null||y(T)},L=T=>{if(Z(T)||!(T instanceof w)||T.stage!=="upload-to-storage"||!["network","request-timeout"].includes(T.code))throw T;v=T,x=Math.max(x,T.requestAttempts)},q=async T=>{if(!(!D||T<=0)){z=!0;try{const k=await D({file:B,presignedPost:t,requestTimeoutMs:Math.min(o,T),requestAttemptsBeforeFallback:x,cancellationSignal:h,onUploadProgress:V,stallTimeoutMs:l});if(!k)throw new w({message:"Storage upload did not return a response",stage:"upload-to-storage",code:"invalid-response",retryable:!0,requestAttempts:x+1,storageTransport:"xhr"});b=k,x=k.requestAttempts??x+1}catch(k){L(k)}}};if(u&&D){const T=Date.now(),k=_-Date.now()-C-f;await q(k),!b&&!!v&&fr({fileSizeBytes:e.size,elapsedMs:Date.now()-T,uploadedBytes:X}
2)&&(B=await Me({file:e,failedTransportError:v,storageRequestAttempts:x,cancellationSignal:h}),j=!0,A=!0,await q(_-Date.now()-C-f))}if(!b){const T=u?Math.min(_-f,Date.now()+C):_;if(T>Date.now()){z&&(A=!0);const k=x;let H=0;try{const F=await se({url:t.url,requestInit:()=>(H+=1,{method:"POST",body:oe(B,t)}),stage:"upload-to-storage",fetchImpl:r,sleepMs:s,maxAttempts:a,requestTimeoutMs:Math.min(o,u?C:g),overallDeadlineMs:T,cancellationSignal:h}),ie=await le(F);b={ok:F.ok,status:F.status,transport:"fetch",...ie,storageRequestId:G(F,"x-amz-request-id")||ie.storageRequestId,storageExtendedRequestId:G(F,"x-amz-id-2")||ie.storageExtendedRequestId},x=k+H}catch(F){F instanceof w&&!Z(F)?L(new w({message:F.message,stage:F.stage,code:F.code,retryable:F.retryable,requestAttempts:k+F.requestAttempts,httpStatus:F.httpStatus,cfRayId:F.cfRayId,storageRequestId:F.storageRequestId,storageExtendedRequestId:F.storageExtendedRequestId,storageTransport:F.storageTransport,storageErrorCode:F.storageErrorCode,storageErrorMessage:F.storageErrorMessage,cause:F.cause})):L(F)}}}if(!b&&!z&&D&&(A=!0,await q(_-Date.now())),!b&&R&&i){const T=_-Date.now();if(T>0){A=!0;try{b=await i({file:B,presignedPost:t,requestTimeoutMs:Math.min(o,T),requestAttemptsBeforeFallback:x,cancellationSignal:h,onUploadProgress:V,stallTimeoutMs:l}),x=b.requestAttempts??x+1}catch(k){L(k)}}}if(!b&&v)throw j?Ae(v,{bodyMaterialized:!0}):v;if(!b)throw new w({message:"Storage upload did not return a response",stage:"upload-to-storage",code:"invalid-response",retryable:!0,requestAttempts:x,bodyMaterialized:j});if(!b.ok&&b.status===400&&b.storageErrorCode==="InvalidArgument"&&b.storageErrorMessage==="POST requires exactly one file upload per request."&&!j&&e.size>0&&e.size<=hr&&_>Date.now()){try{B=await Me({file:e,failedTransportError:new w({message:"Storage rejected the multipart file part",stage:"upload-to-storage",code:"http",retryable:!1,storageTransport:b.transport}),storageRequestAttempts:x,cancellationSignal:h,timeoutMs:Math.min(We,_-Date.now())})}catch(T){if(!(T instanceof w&&T.code==="file-unreadable"&&T.fileReadFailureKind==="timeout"&&_<=Date.now()))throw T}if(_>Date.now()){j=!0,A=!0;const T=x;try{const k=await se({url:t.url,requestInit:()=>(x+=1,{method:"POST",body:oe(B,t)}),stage:"upload-to-storage",fetchImpl:r,sleepMs:s,maxAttempts:1,requestTimeoutMs:Math.min(o,_-Date.now()),overallDeadlineMs:_,cancellationSignal:h}),H=await le(k);b={ok:k.ok,status:k.status,transport:"fetch",...H,storageRequestId:G(k,"x-amz-request-id")||H.storageRequestId,storageExtendedRequestId:G(k,"x-amz-id-2")||H.storageExtendedRequestId}}catch(k){throw k instanceof w&&!Z(k)?Ae(k,{requestAttempts:T+k.requestAttempts,storageTransport:"fetch",bodyMaterialized:!0}):k}}}if(b.ok&&A)try{p==null||p({transport:b.transport,requestAttemptsBeforeFallback:Math.max(0,x-1),storageRequestId:b.storageRequestId,storageExtendedRequestId:b.storageExtendedRequestId,bodyMaterialized:j})}catch{}if(!b.ok)throw new w({message:"File storage rejected the upload",stage:"upload-to-storage",code:"http",retryable:!1,requestAttempts:x,httpStatus:b.status,storageRequestId:b.storageRequestId,storageExtendedRequestId:b.storageExtendedRequestId,storageTransport:b.transport,storageErrorCode:b.storageErrorCode,storageErrorMessage:b.storageErrorMessage,bodyMaterialized:j})}async function Rr({url:e,body:t,requestedTaskId:r,idToken:s,fetchImpl:a=fetch,requestTimeoutMs:o=3e4,cancellationSignal:n}){if(n!=null&&n.aborted)throw N("create-processing-task",n.reason);const m=new AbortController,i=()=>m.abort(n==null?void 0:n.reason);n==null||n.addEventListener("abort",i,{once:!0});const u=globalThis.setTimeout(()=>m.abort(),o),l={"Content-Type":"application/json"};s&&(l.Authorization=`Bearer ${s}`);const c={...t};s||(delete c.user_id,ze(r,e,c));let d;try{d=await a(e,{method:"POST",headers:l,body:JSON.stringify({...c,ingestion_attempt_id:t.ingestion_attempt_id||r,task_id:r}),signal:m.signal})}catch(p){throw n!=null&&n.aborted?N("create-processing-task",n.reason||p):be(p)?new w({message:m.signal.aborted?"Document-processing request timed out":p instanceof Error?p.message:"Network request failed",stage:"create-processing-task",code:m.signal.aborted?"request-timeout":"network",retryable:!0,cause:p}):p}finally{globalThis.clearTimeout(u),n==null||n.removeEventListener("abort",i)}const h=await _e(d);if(!d.ok)throw new w({message:"The document-processing service rejected the request",stage:"create-processing-task",code:"http",retryable:d.status>=500,httpStatus:d.status,cfRayId:G(d,"cf-ray")});const y=h&&typeof h=="object"?h.task_id:null;
2if(typeof y!="string"||!y)throw new w({message:"Document-processing response did not include a task ID",stage:"create-processing-task",code:"invalid-response",retryable:!0});return y}async function Qr({url:e,taskId:t,deckId:r,idToken:s,ownerUserId:a,fetchImpl:o=fetch,sleepMs:n=J,maxAttempts:m=3,requestTimeoutMs:i=3e4,onRetry:u}){ge(a);let l=!1;const c=Math.max(1,m);for(let d=1;d<=c;d+=1){let h;try{h=await se({url:e,requestInit:{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify({task_id:t,...r?{deck_id:r}:{}})},stage:"retrieve-source",fetchImpl:o,sleepMs:n,maxAttempts:1,requestTimeoutMs:i})}catch(f){const C=f instanceof w?new w({message:f.message,stage:f.stage,code:f.code,retryable:f.retryable,requestAttempts:d,httpStatus:f.httpStatus,cfRayId:f.cfRayId,responseContentType:f.responseContentType,responseBodyType:f.responseBodyType,responseBodyKeys:f.responseBodyKeys,cause:f.cause}):f;if(!(C instanceof w&&C.retryable&&d<c))throw C;try{u==null||u({error:C,failedAttemptNumber:d,maximumAttempts:c,retryReason:"transport"})}catch{}await n(400*d);continue}if(h.status===404&&!l&&s&&a){l=!0;
2const f=new URL("create_task_to_get_file_data",e).href,C=ir(t,f);if(C){if(await Rr({url:f,requestedTaskId:t,body:{file_name:C.body.file_name,uploaded_file_s3_object_key:C.body.uploaded_file_s3_object_key,content_medium_type:C.body.content_medium_type,claim_existing_task_only:!0},idToken:s,fetchImpl:o,requestTimeoutMs:i})!==t)throw new w({message:"The upload ownership response did not match the requested task",stage:"retrieve-source",code:"invalid-response",retryable:!1});ur(t),d-=1;continue}}const y=await _e(h),p=y&&typeof y=="object"?y.download_url:null;if(h.ok&&gr(p)){const f=y&&typeof y=="object"?Number(y.expires_in_seconds):0,C=Number.isFinite(f)&&f>0?f:0;return re===a&&S.set(t,{url:p,expiresAt:Date.now()+Math.max(0,C-60)*1e3}),p}const g=h.ok||h.status===408||h.status===429||h.status>=500,_=br(y),R=new w({message:"The uploaded source is temporarily unavailable",stage:"retrieve-source",code:h.ok?"invalid-response":"http",retryable:g,requestAttempts:d,httpStatus:h.status,cfRayId:G(h,"cf-ray"),responseContentType:G(h,"content-type"),..._});if(!g||d>=c)throw R;try{u==null||u({error:R,failedAttemptNumber:d,maximumAttempts:c,retryReason:"response"})}catch{}await n(400*d)}throw new w({message:"The uploaded source is temporarily unavailable",stage:"retrieve-source",code:"invalid-response",retryable:!0,requestAttempts:c})}async function es({requestedTaskId:e,requestTask:t,waitForTask:r}){try{const s=await t();return await r(s)}catch(s){if(!(s instanceof w)||s.stage!=="create-processing-task"||!["network","request-timeout"].includes(s.code))throw s;try{return await r(e,{allowMissingDocumentGracePeriod:!0})}catch(a){throw a instanceof w&&a.code!=="missing-task"?a:s}}}function Er(e){if(!e||typeof e!="object"&&typeof e!="function")return{causeName:null,causeMessage:typeof e=="string"?e:null,causeCode:null};const t=e;return{causeName:typeof t.name=="string"?t.name:null,causeMessage:typeof t.message=="string"?t.message:null,causeCode:typeof t.code=="string"||typeof t.code=="number"?String(t.code):null}}function ts({taskId:e,subscribeToTask:t,fetchTaskSnapshot:r,onTaskSnapshotRecovery:s,fetchCombinedText:a,allowMissingDocumentGracePeriod:o=!0,missingDocumentGracePeriodMs:n=5e3,taskSnapshotRetryAttempts:m=3,taskSnapshotRetryDelayMs:i=750,processingErrorGracePeriodMs:u=pr,processingTimeoutMs:l=720*1e3,cancellationSignal:c}){return new Promise((d,h)=>{let y=!1,p=null,g=null,_=null,R=null,f=!1,C=!1,b=null;const x=()=>{if(!C){if(!R){f=!0;return}C=!0;try{R()}catch{}}},v=()=>{g&&(clearTimeout(g),g=null)},A=()=>{p&&clearTimeout(p),v(),_&&clearTimeout(_),c==null||c.removeEventListener("abort",z),x()},P=L=>{y||(y=!0,A(),h(L))},D=L=>{y||(y=!0,A(),d(L))};function z(){P(N("await-processing",c==null?void 0:c.reason))}const B=async()=>{if(!r)return{snapshot:null,error:null,attempts:0};const L=Math.max(1,m);let q;for(let M=1;M<=L;M+=1){if(y)return{snapshot:null,error:q,attempts:M-1};try{const T=await r(e);if(T)return{snapshot:T,error:null,attempts:M}}catch(T){q=T}M<L&&await J(i*M)}return{snapshot:null,error:q,attempts:L}},j=async L=>{if(y)return;if(b){await b;return}if(!L){if(!o){P(new w({message:"Task status document was not found",stage:"await-processing",code:"missing-task",retryable:!0}));return}p||(p=setTimeout(async()=>{const M=await B();if(M.snapshot){try{s==null||s(String(M.snapshot.status||"unknown"))}catch{}await j(M.snapshot);return}P(new w({message:"Task status document was not created",stage:"await-processing",code:"missing-task",retryable:!0,requestAttempts:M.attempts||1,cause:M.error}))},n));return}p&&(clearTimeout(p),p=null);const q=L.status;if(q==="processing"||q==="queued"){v();return}if(q==="restoration_required"){P(new w({message:"This document is being restored from archived storage",stage:"await-processing",code:"restoration-required",retryable:!0}));return}if(q==="error"){const M=()=>D({...L,getDataFromFileProcessingStatusDocId:e});if(typeof L.file_processing_error_code=="string"&&L.file_processing_error_code.length>0||u<=0){M();return}g||(g=setTimeout(M,u));return}if(v(),q!=="success"){P(new w({message:`Unexpected document-processing status: ${String(q)}`,stage:"await-processing",code:"invalid-response",retryable:!0}));return}b=(async()=>{try{const M=await a(e);D({...L,pdfPagesTextArray:M,getDataFromFileProcessingStatusDocId:e})}catch(M){P(new w({message:M instanceof Error?M.message:"Failed to read processed document text",stage:"read-processed-text",code:"listener",retryable:!0,cause:M}))}})(),await b},X=L=>{_=setTimeout(()=>{(async()=>{const q=!!g,M=await B();if(M.snapshot){try{s==null||s(String(M.snapshot.status||"unknown"))}catch{}if(await j(M.snapshot),y)return}if(q||g){const T=g?u+l:l;X(T);return}P(new w({message:"Document processing timed out",stage:"await-processing",code:"processing-timeout",retryable:!0,requestAttempts:M.attempts||1,cause:M.error}))})()},L)};if(X(l),c==null||c.addEventListener("abort",z,{once:!0}),c!=null&&c.aborted){z();return}const V=L=>{P(new w({message:L instanceof Error?L.message:"Document status listener failed",stage:"await-processing",code:"listener",retryable:!0,cause:L}))};try{R=t(e,j,V),f&&x()}catch(L){V(L)}})}const Qe="we couldnât read this file. save a new copy and try again.";function rs(e,t,r=he){const s=typeof e.file_processing_error_code=="string"?e.file_processing_error_code:"",a=typeof e.message=="string"?e.message:"",o=(t==null?void 0:t.toLowerCase().split(/[?#]/,1)[0])||"",n=o.endsWith(".heic")||o.endsWith(".heif"),m={image_dimensions_too_large:["document_upload_error_image_dimensions","this image is too large to read. resize it and try again."],source_download_failed:["document_upload_error_download_failed","the download didnât include your file. download it again from the original site."],not_pdf_header:["document_upload_error_not_pdf","this file isnât a PDF. download or export a new PDF and try again."],file_empty:["document_upload_error_empty","this file is empty. download a new copy and try again."]},i=Object.prototype.hasOwnProperty.call(m,s)?m[s]:void 0;return i?r(...i):s==="ppt_locked"||s==="pdf_encrypted"||s==="pdf_locked"?r("document_upload_error_password_protected","this file is password-protected. remove the password or export an unlocked copy, then try again."):a.toLowerCase()==="no text found in the image"||s==="no_text_found"?r("document_upload_error_no_text","no text was found in this file. try a clearer image or a document with selectable text."):n&&(!s||s==="file_corrupted"||s==="image_decode_failed"||/decode|empty image|unsupported image|cannot identify image/.test(a.toLowerCase()))?r("document_upload_error_heic_unreadable","we
2couldnât read this HEIC image. save it as JPG or PNG and try again."):s==="image_decode_failed"?r("document_upload_error_image_unreadable","we couldnât read this image. save a new JPG or PNG copy and try again."):s==="file_corrupted"||s==="pdf_trailer_missing"?r("document_upload_error_unreadable",Qe):r("document_upload_error_generic","we couldnât process this file. please try again.")}function ss(e,t=typeof navigator>"u"?!0:navigator.onLine,r=he){return e instanceof w?e.code==="source-unavailable"?r("question_generation_error.source_unavailable","we couldnât access this document. reopen it or upload it again."):e.code==="file-unreadable"?r("document_upload_error_file_unreadable","we couldnât read the file you selected from your device. choose it again from your deviceâs Files app, or upload it from a computer."):e.code==="network"&&!t?r("document_upload_error_offline","your internet connection was interrupted. reconnect, then try uploading the file again."):e.code==="network"?r("document_upload_error_connection","the connection was interrupted while uploading your file. please try again; switching networks or browsers may help."):e.code==="request-timeout"?r("document_upload_error_request_timeout","the upload request took too long. please try again; switching networks or browsers may help."):e.storageErrorCode==="EntityTooLarge"?r("document_upload_error_file_too_large","this file is too large for the upload service. try a smaller file or split it into multiple documents."):e.code==="http"&&e.httpStatus&&e.httpStatus>=500?r("document_upload_error_service_unavailable","the document service is temporarily unavailable. please wait a moment and try again."):e.stage==="upload-to-storage"&&e.code==="http"?r("document_upload_error_storage_rejected","the file storage service rejected this upload. please try again."):e.code==="restoration-required"?r("document_upload_error_restoration","this file is being restored. try again in 48 hours, or upload a new copy."):e.code==="processing-timeout"?r("document_upload_error_timeout","this file is taking longer than expected to process. please try again."):e.code==="empty-file"?r("document_upload_error_unreadable",Qe):r("document_upload_error_generic","we couldnât process this file. please try again."):r("document_upload_error_generic","we couldnât process this file. please try again.")}function xr(e){var s;const t=e.name.split("/").pop()||"",r=t.includes(".")&&((s=t.split(".").pop())==null?void 0:s.toLowerCase())||"";return{fileName:t,fileExtension:r,fileMimeType:e.type||"unknown",fileSizeBytes:e.size,isEmpty:e.size===0}}function os(e,t){var o;const r=t.split(",").map(n=>n.trim().toLowerCase()).filter(Boolean),s=e.type.toLowerCase(),a=e.name.includes(".")?`.${(o=e.name.split(".").pop())==null?void 0:o.toLowerCase()}`:"";return!!(s&&r.includes(s)||a&&r.includes(a))}function Tr(e){var s;const t=e.name.split("/").pop()||"";return t.includes(".")&&((s=t.split(".").pop())==null?void 0:s.toLowerCase())||""||e.type.toLowerCase()||"unknown"}function as(e,t=he){const r=Tr(e);if(r==="unknown")return t("document_upload_error_missing_extension","we do not support uploading files without a file extension. try again with a different file type.");const s=e.name.includes(".")?`.${r}`:r;return t("document_upload_error_unsupported_file_type","we do not support uploading {fileType} files. try again with a different file type.",{fileType:s}).replace("{fileType}",s)}function ns(e){return Array.from(e).some(t=>{var r,s;return t.kind==="file"&&((s=(r=t.webkitGetAsEntry)==null?void 0:r.call(t))==null?void 0:s.isDirectory)===!0})}function is(e,t=5){return e.length<=t?null:new w({message:`A maximum of ${t} files can be uploaded at once`,stage:"validate-input",code:"too-many-files",retryable:!1})}function us(e){return Array.isArray(e)&&e.some(t=>t.isBeingRead===!0)}function ds(e,t){const r=typeof e=="number"&&Number.isFinite(e)?Math.floor(e):0,s=Array.isArray(t)?t.length:0;return r>0?r:s}function cs(e){return e.forEach(t=>{t.isBeingRead=!1}),[...e]}function ls(e,t){const r=e>0&&!t;return{canCancel:r,canRetry:r&&e===1}}function ms(e,t){e.isBeingRead=!1,e.hasUploadError=!0,e.uploadErrorMessage=t}function fs({error:e,attemptId:t,inputMethod:r,file:s,contentMediumType:a,stableUploadedFileIdentifiers:o}){const n=xr(s),m=Er(e.cause),i=["create-processing-task","await-processing","read-processed-text"].includes(e.stage),u=i;return{outcome:"failed",stage:e.stage,errorCode:e.code,retryable:e.retryable,requestAttempts:e.requestAttempts,attemptId:t,inputMethod:r,fileName:n.fileName,fileExtension:n.fileExtension,fileMimeType:n.fileMimeType,fileSizeBytes:n.fileSizeBytes,contentMediumType:a,uploadedFileBucketName:(o==null?void 0:o.bucketN
2ame)||null,uploadedFileObjectKey:(o==null?void 0:o.objectKey)||null,fileProcessingTaskId:(o==null?void 0:o.taskId)||t,modalFunctionCallId:(o==null?void 0:o.modalFunctionCallId)||null,uploadedFileLocator:o!=null&&o.bucketName&&(o!=null&&o.objectKey)?`s3://${o.bucketName}/${o.objectKey}`:null,storageUploadConfirmed:i,jungleBackendRequestStarted:u,...e.httpStatus===void 0?{}:{httpStatus:e.httpStatus},cfRayId:e.cfRayId||null,storageRequestId:e.storageRequestId||null,storageExtendedRequestId:e.storageExtendedRequestId||null,storageTransport:e.storageTransport||(e.stage==="upload-to-storage"?"fetch":null),bodyMaterialized:e.bodyMaterialized,storageErrorCode:e.storageErrorCode||null,storageErrorMessage:e.storageErrorMessage||null,...e.fileReadFailureKind?{fileReadFailureKind:e.fileReadFailureKind}:{},...m.causeName||m.causeMessage||m.causeCode?m:{}}}const Le=()=>yt(()=>import("./document-upload-sentry-CwY_2GoS.js").then(e=>e.e),__vite__mapDeps([0,1,2])),Ar=async e=>new Promise((t,r)=>{const s=new FileReader;s.onload=a=>{var d;const o=(d=a.target)==null?void 0:d.result,n=new Image,m=()=>{const h=document.createElement("canvas"),y=h.getContext("2d");if(!y){r(new Error("Canvas 2D rendering is unavailable"));return}let p=n.naturalWidth||n.width,g=n.naturalHeight||n.height;if(!p||!g||p===0||g===0){const b=new DOMParser().parseFromString(o,"image/svg+xml").querySelector("svg");if(b){const x=b.getAttribute("width"),v=b.getAttribute("height");if(x&&v)p=parseFloat(x),g=parseFloat(v);else{const A=b.getAttribute("viewBox");if(A){const[,,P,D]=A.split(" ").map(Number);p=P||800,g=D||600}else p=800,g=600}}else p=800,g=600}const _=300;if(p<_||g<_){const f=_/Math.min(p,g);p*=f,g*=f}const R=4096;if(p>R||g>R){const f=R/Math.max(p,g);p*=f,g*=f}h.width=p,h.height=g,y.fillStyle="white",y.fillRect(0,0,p,g),y.drawImage(n,0,0,p,g),h.toBlob(f=>{if(f){const C=e.name.replace(/\.svg$/i,".png"),b=new File([f],C,{type:"image/png",lastModified:Date.now()});t(b)}else r(new Error("Failed to convert SVG to PNG"))},"image/png",.9)},i=()=>{r(new Error("Failed to load SVG image"))};n.onload=m,n.onerror=i;const u=new Blob([o],{type:"image/svg+xml"}),l=URL.createObjectURL(u);n.src=l;const c=()=>URL.revokeObjectURL(l);n.addEventListener("load",c,{once:!0}),n.addEventListener("error",c,{once:!0})},s.onerror=()=>{r(new Error("Failed to read SVG file"))},s.readAsText(e)}),ps=async(e,t,r,s,a)=>_r({url:`${Pe}/file_or_url/generate_url_for_file_upload_to_s3`,body:{file_name:e,user_id:t==null?void 0:t.id,content_medium_type:r,ingestion_attempt_id:s},cancellationSignal:a}),hs=async(e,t,r,s,a,o)=>{Le().catch(()=>{});let n=e;if(e instanceof File&&(e.type==="image/svg+xml"||/\.svg$/i.test(e.name)))try{n=await Ar(e)}catch(m){throw new w({message:"The SVG could not be converted to PNG",stage:$e.ValidateInput,code:Xe.FilePreparation,retryable:!1,cause:m})}return await Cr({file:n,presignedPost:t,preferXhrUpload:(o==null?void 0:o.preferProgressAwareTransport)===!0,cancellationSignal:o==null?void 0:o.cancellationSignal,onUploadProgress:o==null?void 0:o.onUploadProgress,cloudflareProxyUploadImpl:m=>{const i=new URL(`${Pe}/file_or_url/upload_file_to_s3_proxy`);return i.searchParams.set("target_url",t.url),i.searchParams.set("uploaded_file_object_key",t.fields.key),a&&i.searchParams.set("ingestion_attempt_id",a),wr({...m,proxyUrl:i.toString(),preferXhrUpload:(o==null?void 0:o.preferProgressAwareTransport)===!0})},onStorageTransportRecovery:({transport:m,requestAttemptsBeforeFallback:i,storageRequestId:u,storageExtendedRequestId:l,bodyMaterialized:c})=>{!(e instanceof File)||!a||Le().then(({reportDocumentUploadTransportRecovery:d,reportDocumentUploadBodyMaterializedRecovery:h})=>{d({file:e,contentMediumType:s,user:r,bucketName:ve(t),objectKey:t.fields.key||null,attemptId:a,requestAttemptsBeforeFallback:i,storageRequestId:u,storageExtendedRequestId:l,storageTransport:m,bodyMaterialized:c}),c&&h({file:e,contentMediumType:s,user:r,inputMethod:(o==null?void 0:o.inputMethod)??"unknown",bucketName:ve(t),objectKey:t.fields.key||null,attemptId:a,requestAttemptsBeforeFallback:i,storageTransport:m})},()=>{})}}),"success"},et="storedFileName",tt="objectKey",rt="contentMediumType",ys=["fileTaskId","fileName",et,tt,rt],vr=`${ht}/file_or_url/create_task_to_get_file_data`;function gs(e){const t=e.get("fileTaskId"),r=e.get(et),s=e.get(tt),a=e.get(rt);!t||!r||!s||!a||ze(t,vr,{file_name:r,uploaded_file_s3_object_key:s,content_medium_type:a})}export{Vr as $,Nr as A,qr as B,Jr as C,w as D,Zr as E,kt as F,Oe as G,Rr as H,Ne as I,Dr as J,rt as K,Nt as L,tt as M,et as N,_t as O,qe as P,Ve as Q,Wr as R,It as S,Xr as T,Qr as U,jt as V,Hr as W,$r as X,ss as Y,rs as Z,Yr as _,Ot as a,Kr as a0,Et as a1,Bt as a2,ir as a3,es as a4,Ur as a5,Sr as a6,ve as a7,ds as a8,Z as a9,ts as aa,Tr as ab,as as ac,ms as ad,is as ae,us as af,ls as ag,cs as ah,gs as ai,ys as aj,ns as ak,os as al,Mt as b,Re as c,Lt as d,At as e,zr as f,ps as g,Gr as h,xr as i,fs as j,Xe as k,$e as l,Fe as m,jr as n,Br as o,lr as p,mr as q,Or as r,fr as s,Ir as t,hs as u,wt as v,vt as w,Fr as x,bt as y,Pr as z}; 3//# sourceMappingURL=landingHandoffUploadClaim-ZWzmhSYt.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.