1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="7a12eaca-9c7e-4a9a-96ab-d0fefb26086d",e._sentryDebugIdIdentifier="sentry-dbid-7a12eaca-9c7e-4a9a-96ab-d0fefb26086d")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[51051],{264840:(e,t,a)=>{a.d(t,{E5:()=>r,a9:()=>o,gq:()=>s,q2:()=>n});var l=a(576375);let r=e=>"image/heic"===e.type||"image/heif"===e.type||/\.(heic|heif)$/i.test(e.name),i=(e,t)=>new Promise((a,l)=>{e.toBlob(e=>{if(!e)return void l(Error("Failed to create JPEG blob"));a(new File([e],t.replace(/\.heic$/i,".jpg").replace(/\.heif$/i,".jpg"),{type:"image/jpeg"}))},"image/jpeg",.85)}),n=async e=>{try{let t=await createImageBitmap(e),a=document.createElement("canvas");a.width=t.width,a.height=t.height;let l=a.getContext("2d");if(!l)throw Error("Failed to get canvas 2d context");return l.drawImage(t,0,0),t.close(),await i(a,e.name)}catch(e){}let{default:t}=await Promise.all([a.e(74418),a.e(73798)]).then(a.t.bind(a,516735,23)),l=new Uint8Array(await e.arrayBuffer()),r=new t.HeifDecoder().decode(l);if(!(null==r?void 0:r.length))throw Error("No images found in HEIC file");let n=r[0],o=n.get_width(),s=n.get_height(),d=document.createElement("canvas");d.width=o,d.height=s;let u=d.getContext("2d");if(!u)throw Error("Failed to get canvas 2d context");let c=u.createImageData(o,s);return await new Promise((e,t)=>{n.display(c,a=>{if(!a)return void t(Error("HEIC decode failed"));e()})}),u.putImageData(c,0,0),await i(d,e.name)},o=e=>new Promise(t=>{let a=new FileReader;a.onload=async()=>{let e=await (0,l.BI)(a.result);e&&"gif"===e.ext?t(!1):t(!0)},a.readAsArrayBuffer(e)}),s=(e,t)=>(e.includes(".")?e.slice(0,e.lastIndexOf(".")):e)+t},335275:(e,t,a)=>{a.d(t,{d:()=>n});var l=a(919629),r=a(166251),i=a.n(r);let n=e=>{let{evaluatedDefaultValue:t,setValue:a,unevaluatedDefaultValue:r,currentValue:n,widgetId:o,widgetType:s}=e;(0,l.OA)({evaluatedDefaultValue:t,setValue:e=>{!(n.length>0)&&Array.isArray(e)&&e.length>0&&i()(e[0])&&a(e.filter(e=>i()(e)&&"url"in e&&"filename"in e).map(e=>({url:e.url,filename:e.filename})))},unevaluatedDefaultValue:r,currentValue:n,widgetId:o,widgetType:s})}},435472:(e,t,a)=>{a.d(t,{q:()=>s});var l=a(67059),r=a(694264),i=a(543599),n=a(448516),o=a(253185);let s=()=>{let e=(0,i.GV)(n.ep),t=(0,i.GV)(n.RK),a=(0,o.getPlanFileSizeLimitBytes)(t),s={mb:a/o.BYTES_PER_MB,text:(0,o.formatFileSizeLimit)(a)};if(a>=o.ENTERPRISE_FILE_SIZE_LIMIT_BYTES)return s;if(a>=o.BUSINESS_FILE_SIZE_LIMIT_BYTES){let t=(0,o.formatFileSizeLimit)(o.ENTERPRISE_FILE_SIZE_LIMIT_BYTES);return(0,r._)((0,l._)({},s),{upsell:{plan:"enterprise",upgradeReason:e?"Contact [email protected] to increase the limit on your enterprise plan":"Maximum file size can be increased to ".concat(t," on enterprise plans"),upsellText:"Upgrade to ".concat(t)}})}let d=(0,o.formatFileSizeLimit)(o.BUSINESS_FILE_SIZE_LIMIT_BYTES);return(0,r._)((0,l._)({},s),{upsell:{plan:"standard",upgradeReason:"Maximum file size can be increased to ".concat(d," starting on the business plan"),upsellText:"Upgrade to ".concat(d)}})}},651051:(e,t,a)=>{a.r(t),a.d(t,{default:()=>_});var l=a(626514),r=a(75834),i=a(67059),n=a(822569),o=a(448516),s=a(95221),d=a(987180),u=a(901169),c=a(543599),p=a(832429),f=a(656646),m=a(595245),g=a(757098),y=a(805008),w=a(204516),h=a(335275),b=a(239066),v=a(661784),E=a(435472),T=a(659332),I=a(264840);let x=e=>{if("m4a"===e)return"audio/x-m4a";if("wav"===e)return"audio/wav";if("avi"===e)return"video/avi";if("step"===e)return"model/step";if("afdesign"===e)return"application/octet-stream";else if("csv"===e)return"text/csv";else if("zip"===e)return"application/zip";else if("rtf"===e)return"text/rtf";return p.lookup(e)},F=e=>e.map(e=>({source:e.url,options:(0,i._)({type:"local"},(0,f.r)(e.filename)?{}:{file:{name:e.filename}})})),S=e=>{var t;let{modelFiles:a,setModelFiles:f,evaluatedTemplate:S,widgetId:_,unevaluatedTemplate:C,dontRenderLabel:V}=e,L=(0,c.jL)(),U=(0,c.GV)(d.VC),z=(0,c.GV)(d.wC),R=(0,c.GV)(w.c5),A=(0,c.GV)(s.hiL),B=(0,E.q)(),M=Math.min(null!=(t=S.maxFileSize)?t:B.mb,B.mb),G=(0,c.GV)(o.cM),D=(0,c.GV)(d.md),P=F(a),[N,j]=(0,r.useState)(P),q=(0,c.GV)(s.stg),k=(0,c.GV)(o.Dl),H=(0,T.X)(),{t:O}=(0,g.c)(),Y=(0,r.useCallback)((e,t)=>{if(null==t?void 0:t.serverId){let e=JSON.parse(t.serverId);f(t=>[{url:e.url,filename:e.name},...t])}},[f]);(0,h.d)({evaluatedDefaultValue:S.defaultValue,setValue:e=>{f(e),j(F(e))},unevaluatedDefaultValue:C.defaultValue,currentValue:a,widgetId:_,widgetType:"FileUpload"});let J=(0,r.useMemo)(()=>
1{if("string"==typeof S.acceptedFileTypes&&""!==S.acceptedFileTypes.trim())return S.acceptedFileTypes.split(",").map(e=>x((0,u.replaceAll)(e.trim(),".",""))).filter(e=>!!e)},[S.acceptedFileTypes]),{acceptedMimeTypes:X}=S,Z=""===S.maxFiles||null==S.maxFiles?1:Number(S.maxFiles),$=(0,r.useMemo)(()=>N.filter(e=>{var t;return e&&(null==(t=e.options)?void 0:t.type)!=="local"}).length>a.length,[N,a]);(0,r.useEffect)(()=>{U&&L((0,d.Td)({stepId:U,pending:$,widgetId:_}))},[$,U,_,L]),(0,r.useEffect)(()=>()=>{U&&L((0,d.Td)({stepId:U,pending:!1,widgetId:_}))},[]);let K=(0,r.useMemo)(()=>{if(X)return X.map(e=>p.extension(e)||e).join(", ")},[X]);return(0,l.jsx)(y.Ay,{dontRenderLabel:V,unevaluatedTemplate:C,widgetType:"FileUpload",evaluatedTemplate:S,modelValue:a,widgetId:_,children:(0,l.jsx)(n.A,{"aria-describedby":"".concat(_,"-description"),additionalAriaLabel:S.label,acceptedFileTypes:J||X||void 0,fileValidateTypeDetectType:(e,t)=>new Promise(a=>{if(!t){let a=e.name.split(".").at(-1);a&&(t=x(a)||"")}a(t)}),allowFileTypeValidation:!0,labelFileTypeNotAllowed:O("Invalid file type"),fileValidateTypeLabelExpectedTypes:"Expected ".concat(S.acceptedFileTypes||K),backgroundColor:R.questionsBackgroundColor,borderColor:R.borderColor,primaryColor:R.primaryColor,maxFileSizeText:O("File is too large"),maxFileSizeSubText:M>=1e3?"Max file size is ".concat(M/1e3," GB"):O("Max file size is {size} MB")(M),maxFileSizeOverride:M>=1?M+"MB":1e3*M+"KB",textColor:R.slightlyFadedAnswersColor,dragAndDropText:O("Drag & drop a file or browse"),showMaxFileSizeSubText:S.showUploadLimits,maxParallelUploads:20,server:{revert:async(e,t,a)=>{try{let a=JSON.parse(e).url;await H(a),t()}catch(e){(0,v.A)(e),a("".concat(e))}},remove:async(e,t,a)=>{try{await H(e),t()}catch(e){a("".concat(e))}},process:G?async(e,t,a,l,r,i)=>{let n=new XMLHttpRequest,o=()=>{let e=n.responseText;return 0===n.status&&(e+=" Possible CORS error. Ensure the server allows cross-origin requests."),"XHR Error: Could not upload file. Status: ".concat(n.status,".\n StatusText: ").concat(n.statusText,".\n Response: ").concat(e,"\n File size: ").concat(t.size,"\n File name: ").concat(t.name)};try{let e=await (0,b.Ho)(k,"/v1/flow/requestFileUploadSession","POST",{fileName:t.name,uploadLength:t.size,flowPublicIdentifier:q,userId:null==A?void 0:A.ownerUserId,mode:z,sessionUuid:D});if(!e.presignedUrl){(0,v.A)(Error("Presigned URL unsuccessfully fetched for flow: ".concat(q))),r("Could not get presigned URL to upload");return}n.open("PUT",e.presignedUrl,!0),n.setRequestHeader("Content-Type",t.type),n.setRequestHeader("Cache-Control","no-cache"),n.upload.onprogress=e=>{i(e.lengthComputable,e.loaded,e.total)},n.onload=()=>{if(n.status>=200&&n.status<300)l(JSON.stringify({url:e.destinationUrl,name:e.fileName}));else{let e=o();(0,v.A)(Error(e)),r("Could not upload file.")}},n.onerror=()=>{let e=o();(0,v.A)(Error(e)),r("Could not upload file.")},n.send(t)}catch(e){(0,v.A)(e),r("".concat(e))}return{abort:()=>{let e=o();(0,v.A)(Error(e)),n.abort(),r("Upload aborted due to error. Try again?")}}}:{url:"".concat((0,m.BU)(k),"/v1/flow/fileupload"),headers:(0,i._)({mode:z,"organization-id":null==A?void 0:A.organizationId,"user-id":null==A?void 0:A.ownerUserId,"flow-public-id":q},D?{"session-uuid":D}:{})},load:(e,t,l)=>{var r;let i=null==(r=a.find(t=>t.url===e))?void 0:r.filename;fetch(e).then(e=>e.blob()).then(e=>{e.name=i,t(e)}).catch(()=>{l("Unable to load file.")})}},maxFiles:Z,allowReorder:!1,onremovefile:(e,t)=>{if(e)return;let a=t.source;j(e=>e.filter(e=>e.source!==a)),f(e=>{if("object"==typeof a){let l=a.name,r="image/jpeg"===t.fileType?(0,I.gq)(l,".jpg"):l;return e.filter(e=>e.filename!==r&&e.filename!==l)}return e.filter(e=>e.url!==a)})},files:N,onprocessfile:Y,onaddfile:(e,t)=>{e||j(e=>[t,...e])}})})},_=e=>{let{value:t,setValue:a,evaluatedTemplate:i,unevaluatedTemplate:n,dontRenderLabel:o,widgetId:s}=e,[d,u]=(0,r.useState)(t||[]);return(0,r.useEffect)(()=>{a(d)},[d,a]),(0,l.jsx)(S,{dontRenderLabel:o,modelFiles:d,setModelFiles:u,evaluatedTemplate:i,widgetId:s,unevaluatedTemplate:n})}},659332:(e,t,a)=>{a.d(t,{X:()=>u});var l=a(67059),r=a(239066),i=a(448516),n=a(543599),o=a(95221),s=a(987180),d=a(661784);let u=()=>{let e=(0,n.GV)(i.Dl),t=(0,n.GV)(o.stg),a=(0,n.GV)(s.md),u=(0,n.GV)(s.W1),c=(0,n.GV)(o.hiL),p=(0,n.GV)(s.wC);return async i=>{try{if(!(await (0,r.Ho)(e,"/v1/flow/".concat(t,"/deleteFile?url=").concat(encodeURIComponent(i),"&mode=").concat(p),"DELET
1E",{},(0,l._)({},a?{"session-uuid":a}:{},(null==c?void 0:c.ownerUserId)!==void 0?{"user-id":String(c.ownerUserId)}:{},u?{"session-token":u}:{}))).success)throw Error("Had trouble deleting file: ".concat(i))}catch(e){(0,d.A)(e)}}}}}]);
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.