1import{z as R}from"./chunk-36WVUEIZ.js";import{a as O}from"./chunk-VK27PNQX.js";import{Gd as a}from"./chunk-L6QVANHB.js";import{M as u,Pd as g,Sd as D,Ud as m,Yd as S,Zd as h,ea as y,oa as P,r as l,ra as d,v as c}from"./chunk-CUJEUYRS.js";var b=(()=>{let n=class n{constructor(t,e,r,o){this.http=t,this.auth=e,this.packagesService=r,this.httpBackend=o,this.customHttpClient=new h(o)}getMediaList(t){if(this.packagesService.getActiveSubscriptionValue()?.package?.is_free)return[];let r=this.auth.getUser()?.center_info?.audio_length_limit,o=this.auth.getUser()?.center_info?.video_length_limit;return t.map(p=>{switch(p){case a.LINK:return{type:a.LINK};case a.AUDIO:return{type:a.AUDIO,limit:r*1e3};case a.FILE:return{type:a.FILE,limit:20*1024*1024,accept:"application/pdf"};case a.IMAGE:return{type:a.IMAGE,limit:20*1024*1024,accept:"image/png, image/jpeg"};case a.VIDEO:return{type:a.VIDEO,limit:Math.min(o*6.5*1024*1024,200*1024*1024),accept:"video/mp4, video/quicktime"};default:break}})}upload(t,e){let r=new FormData;return r.append("file",e),this.http.post("v1/child/upload-media",r,{params:{id:t.toString()}})}uploadWithProgress(t,e){let r=new FormData;return r.append("file",e),this.http.post("v1/child/upload-media",r,{headers:new g({enctype:"multipart/form-data"}),params:{id:t.toString()},observe:"events",reportProgress:!0}).pipe(c(o=>this.getEventMessage(o,e)),u(this.handleError(e)))}getEventMessage(t,e){switch(t.type){case m.Sent:return{status:i.SENT};case m.UploadProgress:return{status:i.PROGRESS,progress:Math.round(100*t.loaded/(t.total||1))};case m.ResponseHeader:return{status:i.RESPONSE_HEADER};case m.Response:return{status:i.COMPLETED,response:t.body};default:return{status:i.ERROR,message:`File "${e.name}" surprising upload event: ${t.type}.`}}}handleError(t){return e=>{console.error(`Upload failed for file "${t?.name}":`,e);let r={status:i.ERROR,message:`${t?.name} upload failed.`};return l(()=>r)}}uploadToUser(t){let e=new FormData;return e.append("file",t),this.http.post("v3/user/upload-media",e)}uploadToUserWithProgress(t){let e=new FormData;return e.append("file",t),this.http.post("v3/user/upload-media",e,{headers:new g({enctype:"multipart/form-data"}),observe:"events",reportProgress:!0}).pipe(c(r=>this.getEventMessage(r,t)),u(this.handleError(t)))}uploadWithPresignedUrl(t,e,r){let o=new D().set("id",t.toString()).set("file_name",e.name??"record.mp3").set("mimeType",e.type);return this.http.get("v1/child/generate-upload-media-url",{params:o}).pipe(y(p=>{let{upload_url:E,media_provider:w,url:M,expired_at:H}=p.data,v={child_id:t,name:e?.name,size:e.size,type:e?.type,url:M,media_provider:w,expired_at:H};return r?this.customHttpClient.put(E,e,{headers:{"Content-Type":e?.type},observe:"events",reportProgress:!0}).pipe(c(T=>{let f=this.getEventMessage(T,e);return f.status===i.COMPLETED?{status:i.COMPLETED,response:v}:f}),u(this.handleError(e))):this.customHttpClient.put(E,e,{headers:{"Content-Type":e?.type},observe:"response"}).pipe(c(()=>v))}),u(p=>l(()=>new Error("Upload failed: "+(p?.message||p)))))}};n.\u0275fac=function(e){return new(e||n)(d(h),d(R),d(O),d(S))},n.\u0275prov=P({token:n,factory:n.\u0275fac,providedIn:"root"});let s=n;return s})(),i=(function(s){return s.SENT="sent",s.PROGRESS="progress",s.RESPONSE_HEADER="response_header",s.COMPLETED="completed",s.ERROR="error",s})(i||{});export{b as a,i as b};
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.