var XpraImageDecoderLoader={hasNativeDecoder:function(){return"undefined"!=typeof ImageDecoder}};function XpraImageDecoder(){this.on_frame_decoded=null,this.on_frame_error=(packet,error)=>{console.error("ImageDecoder error on packet ",packet,": ",error)}}XpraImageDecoder.prototype.queue_frame=function(packet){var data,paint_coding,decoder,width=packet[4],height=packet[5],coding=packet[6];coding.startsWith("rgb")?(data=decode_rgb(packet),createImageBitmap(new ImageData(new Uint8ClampedArray(data.buffer),width,height),0,0,width,height).then(bitmap=>{packet[6]="bitmap:"+coding,packet[7]=bitmap,this.on_frame_decoded(packet)}).catch(e=>this.on_frame_error(packet,e))):(paint_coding=coding.split("/")[0],(decoder=new ImageDecoder({type:"image/"+paint_coding,data:packet[7]})).decode({frameIndex:0}).then(result=>{packet[6]="image:"+paint_coding,packet[7]=result,decoder.close(),this.on_frame_decoded(packet)}).catch(e=>this.on_frame_error(packet,e)))};