PageSourceSearch

https://teachers.legendsoflearning.com/_next/static/chunks/pages/custom-assessment/dropbox-6509f117ca82cfb2.js

js legendsoflearning.com collected 2026-09-24 09:15:32 UTC 7,485 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9647],{4140:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},22441:(e,r,o)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/custom-assessment/dropbox",function(){return o(94631)}])},56121:(e,r,o)=>{e.exports=o(61847)()},61847:(e,r,o)=>{"use strict";var t=o(4140);function n(){}function a(){}a.resetWarningCache=n,e.exports=function(){function e(e,r,o,n,a,s){if(s!==t){var i=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw i.name="Invariant Violation",i}}function r(){return e}e.isRequired=e;var o={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:r,element:e,elementType:e,instanceOf:r,node:e,objectOf:r,oneOf:r,oneOfType:r,shape:r,exact:r,checkPropTypes:a,resetWarningCache:n};return o.PropTypes=o,o}},91840:(e,r,o)=>{"use strict";o.d(r,{R:()=>l});var t=o(43559),n=o(61614),a=o(52541),s=o(61643),i=o(10945);function l(e,r){var o=n.useRef(!1),l=(0,i.m)(null==r?void 0:r.client);(0,s.D$)(e,s.KG.Subscription);var u=n.useState({loading:!(null==r?void 0:r.skip),error:void 0,data:void 0,variables:null==r?void 0:r.variables}),c=u[0],d=u[1];!o.current&&(o.current=!0,(null==r?void 0:r.onSubscriptionData)&&!1!==globalThis.__DEV__&&t.V1.warn(r.onData?52:53),(null==r?void 0:r.onSubscriptionComplete)&&!1!==globalThis.__DEV__&&t.V1.warn(r.onComplete?54:55));var p=n.useState(function(){return(null==r?void 0:r.skip)?null:l.subscribe({query:e,variables:null==r?void 0:r.variables,fetchPolicy:null==r?void 0:r.fetchPolicy,context:null==r?void 0:r.context})}),m=p[0],v=p[1],f=n.useRef(!1);n.useEffect(function(){return function(){f.current=!0}},[]);var b=n.useRef({client:l,subscription:e,options:r});return n.useEffect(function(){var o,t,n,s,i=null==r?void 0:r.shouldResubscribe;"function"==typeof i&&(i=!!i(r)),(null==r?void 0:r.skip)?(!(null==r?void 0:r.skip)!=!(null==(o=b.current.options)?void 0:o.skip)||f.current)&&(d({loading:!1,data:void 0,error:void 0,variables:null==r?void 0:r.variables}),v(null),f.current=!1):(!1!==i&&(l!==b.current.client||e!==b.current.subscription||(null==r?void 0:r.fetchPolicy)!==(null==(t=b.current.options)?void 0:t.fetchPolicy)||!(null==r?void 0:r.skip)!=!(null==(n=b.current.options)?void 0:n.skip)||!(0,a.L)(null==r?void 0:r.variables,null==(s=b.current.options)?void 0:s.variables))||f.current)&&(d({loading:!0,data:void 0,error:void 0,variables:null==r?void 0:r.variables}),v(l.subscribe({query:e,variables:null==r?void 0:r.variables,fetchPolicy:null==r?void 0:r.fetchPolicy,context:null==r?void 0:r.context})),f.current=!1),Object.assign(b.current,{client:l,subscription:e,options:r})},[l,e,r,f.current]),n.useEffect(function(){if(m){var e=!1,o=m.subscribe({next:function(o){if(!e){var t,n,a={loading:!1,data:o.data,error:void 0,variables:null==r?void 0:r.variables};d(a),(null==(t=b.current.options)?void 0:t.onData)?b.current.options.onData({client:l,data:a}):(null==(n=b.current.options)?void 0:n.onSubscriptionData)&&b.current.options.onSubscriptionData({client:l,subscriptionData:a})}},error:function(o){var t,n;e||(d({loading:!1,data:void 0,error:o,variables:null==r?void 0:r.variables}),null==(n=null==(t=b.current.options)?void 0:t.onError)||n.call(t,o))},complete:function(){var r,o;!e&&((null==(r=b.current.options)?void 0:r.onComplete)?b.current.options.onComplete():(null==(o=b.current.options)?void 0:o.onSubscriptionComplete)&&b.current.options.onSubscriptionComplete())}});return function(){e=!0,setTimeout(function(){o.unsubscribe()})}}},[m]),c}},94631:(e,r,o)=>{"use strict";o.r(r),o.d(r,{default:()=>g,uploadErrorMessage:()=>v});var t=o(9329),n=o(6029),a=o(37197),s=o(91840),i=o(45031),l=o(26751),u=o(55729),c=o(53761),d=o(69961);function p(){let e=(0,t._)(["\n  subscription {\n    imageProcessed {\n      id\n      url\n      status\n      errorCode\n    }\n  }\n"]);return p=function(){return e},e}let m={"file-too-large":"fileTooLarge","file-invalid-type":"fileInvalidType","too-many-files":"tooManyFiles"},v=(e,r)=>
1{let o={fileTooLarge:e("customAssessment.upload.errors.fileTooLarge","That image is too large. Please choose one under {maxSizeMb} MB.",{maxSizeMb:5}),fileInvalidType:e("customAssessment.upload.errors.fileInvalidType","That file type is not supported. Please choose a JPG or PNG image."),tooManyFiles:e("customAssessment.upload.errors.tooManyFiles","Please upload one image at a time.")},t=r?m[r]:void 0;return t?o[t]:e("customAssessment.upload.errors.unknown","Something went wrong uploading that image. Please try again.")},f=(0,a.J1)(p()),b=async e=>{let{data:{fields:r,url:o}}=await i.A.post("".concat(d.H$,"/api/uploads/upload_url"),{},{withCredentials:!0}),t=new FormData;Object.entries(r).forEach(e=>{let[r,o]=e;return t.append(r,o)}),t.append("Content-Type",e.type),t.append("file",e),await i.A.post(o,t,{withCredentials:!1}),i.A.defaults.withCredentials=!0;let{data:n}=await i.A.post("".concat(d.H$,"/api/uploads/proccess_upload"),{upload_path:r.key},{withCredentials:!0});return n},g=e=>{let{setImageId:r,setImageUrl:o}=e,{t}=(0,l.Bd)("teachers"),[a,i]=(0,u.useState)(!1),[d,p]=(0,u.useState)(null);(0,s.R)(f,{onSubscriptionData:async e=>{var r;let{subscriptionData:o}=e,t=null==o||null==(r=o.data)?void 0:r.imageProcessed;t?m(t.url):console.error("No imageProcessed data")}});let m=e=>{if(i(!1),"rejected"===e.status){console.error("Image upload rejected:",e.errorCode),p(e.errorCode);return}o(e)},g=async(e,o)=>{if(o.length>0){let e=o[0].errors[0].code;console.error("Image rejected before upload:",e),p(e);return}i(!0);try{let o=await b(e[0]);console.debug("image uploaded"),r(o.id)}catch(r){let e=r.response&&r.response.data&&r.response.data.error_code||"unknown";console.error("Image upload failed:",e,r),i(!1),p(e)}},{getRootProps:y,getInputProps:x,open:h}=(0,c.VB)({noClick:!0,noKeyboard:!0,accept:{"image/*":[".jpg",".jpeg",".png"]},maxFiles:1,multiple:!1,maxSize:5e6,onDrop:g});return(0,n.jsxs)("div",{...y({className:"flex"}),children:[(0,n.jsx)("input",{...x()}),(0,n.jsx)("div",{className:"mx-auto my-8",children:d?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"m-8 mb-4 text-dark-grey main-sm text-center",children:v(t,d)}),(0,n.jsx)("p",{className:"text-center mb-8 main-sm hover:underline text-secondary cursor-pointer",onClick:()=>{p(null),i(!1)},children:t("customAssessment.upload.tryAgain","Try again?")})]}):a?(0,n.jsxs)("div",{className:"border border-dashed border-medium-grey bg-main-grey flex flex-col max-w-xs rounded-lg",children:[(0,n.jsx)("i",{className:"fas fa-spinner fa-spin text-[3rem] text-secondary mx-auto mt-12"}),(0,n.jsx)("p",{className:"m-8 mb-12 text-dark-grey main-sm text-center",children:t("customAssessment.upload.uploading","Image is uploading...")})]}):(0,n.jsxs)("div",{className:"border border-dashed border-medium-grey bg-main-grey flex flex-col max-w-xs rounded-lg",children:[(0,n.jsx)("i",{className:"fas fa-upload text-[3rem] text-secondary mx-auto mt-12"}),(0,n.jsx)("p",{className:"m-8 mb-12 text-dark-grey main-sm text-center",children:(0,n.jsx)(l.x6,{t:t,i18nKey:"customAssessment.upload.dropPrompt",defaults:"Drag and drop an image here to upload or <0>select a file</0>",components:[(0,n.jsx)("button",{type:"button",onClick:h,className:"hover:underline text-secondary cursor-pointer"},"0")]})})]})})]})}}},e=>{e.O(0,[5031,3761,636,6593,8792],()=>e(e.s=22441)),_N_E=e.O()}]);

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.