Files
citrus-cms/assets/pdf-js-express/lib/core/StreamingPartRetriever.chunk.js
T
2026-04-28 21:15:09 +03:00

11 lines
4.5 KiB
JavaScript

/** Notice * This file contains works from many authors under various (but compatible) licenses. Please see core.txt for more information. **/
(function(){(window.wpCoreControlsBundle=window.wpCoreControlsBundle||[]).push([[14],{443:function(ia,ba,e){e.r(ba);var ea=e(1),x=e(0);e.n(x);var ha=e(2),ca=e(147);ia=e(51);var da=e(94),aa=e(246),w=e(71),y=e(245);e=e(376);var n=window,h=function(){function e(e,f,h){var n=-1===e.indexOf("?")?"?":"&";switch(f){case w.a.NEVER_CACHE:this.url=e+n+"_="+Object(x.uniqueId)();break;default:this.url=e}this.jf=h;this.request=new XMLHttpRequest;this.request.open("GET",this.url,!0);this.request.setRequestHeader("X-Requested-With",
"XMLHttpRequest");this.request.overrideMimeType?this.request.overrideMimeType("text/plain; charset=x-user-defined"):this.request.setRequestHeader("Accept-Charset","x-user-defined");this.status=y.a.NOT_STARTED}e.prototype.start=function(f,h){var n=this,r=this,w=this.request,x;r.lx=0;f&&Object.keys(f).forEach(function(e){n.request.setRequestHeader(e,f[e])});h&&(this.request.withCredentials=h);this.XD=setInterval(function(){var f=0===window.document.URL.indexOf("file:///");f=200===w.status||f&&0===w.status;
if(w.readyState!==y.b.DONE||f){try{w.responseText}catch(ra){return}r.lx<w.responseText.length&&(x=r.Iga())&&r.trigger(e.Events.DATA,[x]);0===w.readyState&&(clearInterval(r.XD),r.trigger(e.Events.DONE))}else clearInterval(r.XD),r.trigger(e.Events.DONE,["Error received return status "+w.status])},1E3);this.request.send(null);this.status=y.a.STARTED};e.prototype.Iga=function(){var f=this.request,h=f.responseText;if(0!==h.length)if(this.lx===h.length)clearInterval(this.XD),this.trigger(e.Events.DONE);
else return h=Math.min(this.lx+3E6,h.length),f=n.QT(f,this.lx,!0,h),this.lx=h,f};e.prototype.abort=function(){clearInterval(this.XD);var f=this;this.request.onreadystatechange=function(){Object(ha.j)("StreamingRequest aborted");f.status=y.a.ABORTED;return f.trigger(e.Events.ABORTED)};this.request.abort()};e.prototype.finish=function(){var f=this;this.request.onreadystatechange=function(){f.status=y.a.SUCCESS;return f.trigger(e.Events.DONE)};this.request.abort()};e.Events={DONE:"done",DATA:"data",
ABORTED:"aborted"};return e}();Object(ia.a)(h);var f;(function(e){e[e.LOCAL_HEADER=0]="LOCAL_HEADER";e[e.FILE=1]="FILE";e[e.CENTRAL_DIR=2]="CENTRAL_DIR"})(f||(f={}));var r=function(e){function h(){var h=e.call(this)||this;h.buffer="";h.state=f.LOCAL_HEADER;h.IM=4;h.em=null;h.ut=ca.c;h.Ln={};return h}Object(ea.c)(h,e);h.prototype.Bga=function(e){var n;for(e=this.buffer+e;e.length>=this.ut;)switch(this.state){case f.LOCAL_HEADER:this.em=n=this.Mga(e.slice(0,this.ut));if(n.cu!==ca.g)throw Error("Wrong signature in local header: "+
n.cu);e=e.slice(this.ut);this.state=f.FILE;this.ut=n.lH+n.Bq+n.jw+this.IM;this.trigger(h.Events.HEADER,[n]);break;case f.FILE:this.em.name=e.slice(0,this.em.Bq);this.Ln[this.em.name]=this.em;n=this.ut-this.IM;var r=e.slice(this.em.Bq+this.em.jw,n);this.trigger(h.Events.FILE,[this.em.name,r,this.em.CH]);e=e.slice(n);if(e.slice(0,this.IM)===ca.h)this.state=f.LOCAL_HEADER,this.ut=ca.c;else return this.state=f.CENTRAL_DIR,!0}this.buffer=e;return!1};h.Events={HEADER:"header",FILE:"file"};return h}(aa.a);
Object(ia.a)(r);ia=function(e){function f(f,n,w,x,y){w=e.call(this,f,w,x)||this;w.url=f;w.stream=new h(f,n);w.de=new r;w.RW=window.createPromiseCapability();w.sX={};w.jf=y;return w}Object(ea.c)(f,e);f.prototype.Zx=function(e){var f=this;this.request([this.Aj,this.Sk,this.zj]);this.stream.addEventListener(h.Events.DATA,function(h){try{if(f.de.Bga(h))return f.stream.finish()}catch(ma){throw f.stream.abort(),f.fw(ma),e(ma),ma;}});this.stream.addEventListener(h.Events.DONE,function(h){f.gga=!0;f.RW.resolve();
h&&(f.fw(h),e(h))});this.de.addEventListener(r.Events.HEADER,Object(x.bind)(this.rX,this));this.de.addEventListener(r.Events.FILE,Object(x.bind)(this.bha,this));return this.stream.start(this.jf,this.withCredentials)};f.prototype.MT=function(e){var f=this;this.RW.promise.then(function(){e(Object.keys(f.de.Ln))})};f.prototype.yo=function(){return!0};f.prototype.request=function(e){var f=this;this.gga&&e.forEach(function(e){f.sX[e]||f.Dla(e)})};f.prototype.rX=function(){};f.prototype.abort=function(){this.stream&&
this.stream.abort()};f.prototype.Dla=function(e){this.trigger(da.a.Events.PART_READY,[{cb:e,error:"Requested part not found",Ki:!1,cg:!1}])};f.prototype.bha=function(e,f,h){this.sX[e]=!0;this.trigger(da.a.Events.PART_READY,[{cb:e,data:f,Ki:!1,cg:!1,error:null,gd:h}])};return f}(da.a);Object(e.a)(ia);Object(e.b)(ia);ba["default"]=ia}}]);}).call(this || window)