PageSourceSearch

https://safie.link/app/chunk-_kEJwVaa.js

js safie.link collected 2026-10-03 23:56:59 UTC 4,749 bytes, 1 lines download raw bytes

1import {Z,C as C$1,aJ as mr,aK as Xi,G as xi,M as M$1,b2 as b,g as E,b0 as G,cT as vi,bJ as Oe,b1 as ct,N as Ne,aG as IV,dj as LP}from'./main-LEFCVYTE.js';var L=1,C=32,N=86400*1e3,q=(()=>{let m=class m{constructor(){this._httpClient=C$1(mr),this._apiErrorHandler=C$1(Xi),this._dateFormat=new xi,this.STATUS_VALUE_MAP={unset:null,need_confirmation:1,completed:2};}queryEvents(i){return M$1(this,arguments,function*({deviceId:t,fromDate:o,toDate:a,filters:e,reverse:d=false,limit:h,offset:n}){if(t==null)throw {code:b.INVALID_PARAMETER,message:"deviceId is not set"};if(o==null)throw {code:b.INVALID_PARAMETER,message:"fromDate is not set"};if(a==null)throw {code:b.INVALID_PARAMETER,message:"toDate is not set"};if(a-o>L*N)throw {code:b.INVALID_PARAMETER,message:`the range between fromDate and toDate should be less than or equal to ${L} day`};let u=E.apiEndPoint+"api/device/event_check",s=new G;s.add("device_id",t),s.add("from",new Date(o).toISOString()),s.add("to",new Date(a).toISOString()),(e==null?void 0:e.types)!=null&&e.types.forEach(c=>{s.add("type",c);}),(e==null?void 0:e.status)!=null&&e.status.forEach(c=>{s.add("status",this.toApiStatusValue(c));}),(e==null?void 0:e.onlyUnread)!=null&&s.add("only_unread",e.onlyUnread),(e==null?void 0:e.onlyCommented)!=null&&s.add("only_commented",e.onlyCommented),d&&s.add("sort","-timestamp"),h=h??20,n=n??0,s.add("limit",h),s.add("offset",n),s.add("tz",vi());try{let c=yield this._httpClient.get({url:u,parameters:s});return {total:c.total,events:c.list.map(l=>this.toCheckedMediaEvent(l,t))}}catch(c){this._apiErrorHandler.handlerError(c);let l=this._apiErrorHandler.parseErrorResponse(c);throw {code:l.code,message:l.message}}})}updateEventCheckStatus(h){return M$1(this,arguments,function*({deviceId:t,eventDataId:o,isRead:a,comment:e,status:d}){if(t==null)throw {code:b.INVALID_PARAMETER,message:"deviceId is not set"};if(o==null)throw {code:b.INVALID_PARAMETER,message:"eventDataId is not set"};if(a==null&&e==null&&d==null)throw {code:b.INVALID_PARAMETER,message:"at least one of isRead, comment or status must be set"};let n=E.apiEndPoint+`api/device/${t}/event_check/${o}`,i=new Oe({is_read:a,comment:e,status:d!=null?this.toApiStatusValue(d):void 0});try{let u=yield this._httpClient.patch({url:n,parameters:i});return this.toCheckedMediaEvent(u.event_check,t)}catch(u){this._apiErrorHandler.handlerError(u);let s=this._apiErrorHandler.parseErrorResponse(u);throw {code:s.code,message:s.message}}})}queryEventExistDates(d){return M$1(this,arguments,function*({deviceId:t,fromDate:o,toDate:a,filters:e}){if(t==null)throw {code:b.INVALID_PARAMETER,message:"deviceId is not set"};if(o==null)throw {code:b.INVALID_PARAMETER,message:"fromDate is not set"};if(a==null)throw {code:b.INVALID_PARAMETER,message:"toDate is not set"};if(a-o>C*N)throw {code:b.INVALID_PARAMETER,message:`the range between fromDate and toDate should be less than or equal to ${C} days`};let h=E.apiEndPoint+"api/device/event_exist_dates",n=new G;n.add("device_id",t),n.add("from",new Date(o).toISOString()),n.add("to",new Date(a).toISOString()),(e==null?void 0:e.types)!=null&&e.types.forEach(i=>{n.add("type",i);}),(e==null?void 0:e.status)!=null&&e.status.forEach(i=>{n.add("status",this.toApiStatusValue(i));}),(e==null?void 0:e.onlyUnread)!=null&&n.add("only_unread",e.onlyUnread),(e==null?void 0:e.onlyCommented)!=null&&n.add("only_commented",e.onlyCommented),n.add("tz",vi());try{return (yield this._httpClient.get({url:h,parameters:n})).dates}catch(i){this._apiErrorHandler.handlerError(i);let u=this._apiErrorHandler.parseErrorResponse(i);throw {code:u.code,message:u.message}}})}toCheckedMediaEvent(t,o){let a=ct(t.timestamp).getTime(),e=this._dateFormat.transform(a,"yyyy-MM-dd HH:mm:ss"),d;return t.datafile!=null&&t.datafile!=="NULL"?Ne.run(()=>IV())?d=`${E.apiEndPoint}api/event/${t.datafile}?deviceid=${o}`:d=`${t.url}?deviceid=${o}`:d=`${E.apiEndPoint}api/device/snapshot?deviceid=${o}&time=${encodeURIComponent(LP(a,true))}&tz=${encodeURIComponent(vi())}&cacheable=true`,{id:String(t.id),timestamp:a,name:e,deviceId:o,type:"media",subType:t.type,imageURL:d,isRead:t.is_read,status:this.fromApiStatusValue(t.status),readBy:t.read_by,readAt:t.read_at?ct(t.read_at).getTime():null,updatedBy:t.updated_by,updatedAt:t.updated_at?ct(t.updated_at).getTime():null,comment:t.comment}}toApiStatusValue(t){return this.STATUS_VALUE_MAP[t]}fromApiStatusValue(t){let[o,a]=Object.entries(this.STATUS_VALUE_MAP).find(([,e])=>e===t)??["unset",null];return o}};m.\u0275fac=function(o){return new(o||m)},m.\u0275prov=Z({token:m,factory:m.\u0275fac,providedIn:"root"});let R=m;return R})();export{q as EventCheckService,L as MAX_DAYS_PER_QUERY_EVENTS,C as MAX_DAYS_PER_QUERY_EVENT_EXIST_DATES,N as MILLISECONDS_PER_DAY};

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.