/** 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([[16],{335:function(Ca,va,ba){function pa(h,y,aa){y.endsWith("/")||(y+="/");aa=aa||{};var ja=aa.disableWebsockets||!1;this.wP=aa.singleServerMode||!1;null!=aa.customQueryParameters&&Object(f.b)("wvsQueryParameters",aa.customQueryParameters);y.endsWith("blackbox/")||(y+="blackbox/");this.kl=aa.uploadData||null;this.Lt=aa.uriData||null;this.KI=aa.cacheKey||null;this.DM=aa.officeLocale||null;this.fB=Object(n.a)(y,null,ja);this.re=y;this.uB=
h;this.Fe=null;this.$h=ka();this.mk=ka();this.Wv=!1;this.pf=this.fd=this.vd=this.qe=null;this.Ke=[];this.Aw=[];this.cache={};this.timeStamp=0;this.af=[];this.eg=[];this.MB=null;this.oB=!1;this.GE=this.id=null;this.oD=this.mL=la;this.Cy=0;this.HC=!1;this.xM=1;this.Rh={};this.qn(!0)}function ka(){var h={promise:null,resolve:null,reject:null,state:0,result:null,request:null,bp:function(){return 1===(h.state&1)},g1:function(){return 2===(h.state&2)},Lg:function(){return!h.g1()&&!h.bp()},M0:function(){return 4===
(h.state&4)},QO:function(){h.state|=4}};h.promise=new Promise(function(y,aa){h.resolve=function(){if(0===h.state||4===h.state)h.state=1,h.result=arguments[0],y.apply(null,arguments)};h.reject=function(){if(0===h.state||4===h.state)h.state=2,aa.apply(null,arguments)}});return h}function la(){return!1}function fa(h,y,aa){if(!(y in w))return!0;y=w[y];for(var ja=0;ja<y.length;ja++){var ha=h;var ia=y[ja];var ea=aa;if(ia.name in ha){var oa="",sa=!1;ha=ha[ia.name];switch(ia.type){case "s":oa="String";sa=
Object(ca.isString)(ha);break;case "a":oa="Array";sa=Object(ca.isArray)(ha);break;case "n":oa="Number";sa=Object(ca.isNumber)(ha)&&Object(ca.isFinite)(ha);break;case "o":oa="Object",sa=Object(ca.isObject)(ha)&&!Object(ca.isArray)(ha)}sa||ea.reject('Expected response field "'+ia.name+'" to have type '+oa);ia=sa}else ea.reject('Response missing field "'+ia.name+'"'),ia=!1;if(!ia)return!1}return!0}ba.r(va);var ca=ba(0);ba.n(ca);var z=ba(1);Ca=ba(44);var r=ba(31),n=ba(353),b=ba(70),a=ba(283),e=ba(92),
f=ba(37),x=ba(126),w={pages:[{name:"pages",type:"a"}],pdf:[{name:"url",type:"s"}],docmod:[{name:"url",type:"s"},{name:"rID",type:"s"}],health:[],tiles:[{name:"z",type:"n"},{name:"rID",type:"n"},{name:"tiles",type:"a"},{name:"size",type:"n"}],annots:[{name:"url",type:"s"},{name:"name",type:"s"}],image:[{name:"url",type:"s"},{name:"name",type:"s"},{name:"p",type:"n"}],text:[{name:"url",type:"s"},{name:"name",type:"s"},{name:"p",type:"n"}],ApString2Xod:[{name:"url",type:"s"},{name:"rID",type:"s"}]};
pa.prototype=Object(ca.extend)(pa.prototype,{AW:function(){var h=this;return new Promise(function(y,aa){var ja=new XMLHttpRequest;ja.open("GET",h.re+"ck");ja.withCredentials=h.Yi();ja.onreadystatechange=function(){ja.readyState===XMLHttpRequest.DONE&&(200===ja.status?y():aa())};ja.send()})},u6:function(h,y){this.mL=h||la;this.oD=y||la},$I:function(){var h=this;this.mk=ka();this.$h=ka();return this.fB.CB().then(function(){h.Wv=!1;h.id=null;h.oB=!1;return h.AW()})},rE:function(){this.mL();this.VC();
this.qe&&(this.qe.Lg()?this.Ge(this.qe.request):this.qe.bp()&&this.oD(this.qe.result.url,"pdf")&&(this.qe=null,this.rO()));this.pf&&this.pf.Lg()&&this.Ge(this.pf.request);this.vd&&this.vd.Lg()?this.Ge(this.vd.request):this.fd&&this.fd.Lg()&&this.cL(this.fd.request);var h;for(h=0;h<this.af.length;h++)this.af[h]&&this.af[h]&&(this.af[h].Lg()?this.Ge(this.af[h].request):this.af[h].bp()&&this.oD(this.af[h].result.url,"image")&&(this.af[h]=null,this.zy(h)));for(h=0;h<this.eg.length;h++)this.eg[h]&&this.eg[h]&&
this.eg[h].Lg()&&!this.eg[h].M0()&&this.Ge(this.eg[h].request);for(h=0;h<this.Ke.length;h++)this.Ke[h]&&this.Ke[h].Lg()&&this.Ge(this.Ke[h].request)},VC:function(h){var y=this;this.Wv||(this.timeStamp=Date.now(),this.fB.gF(function(aa){y.z2(aa)},function(){return null},function(){return null},!0).then(function(){clearInterval(y.ry);y.ry=null},function(aa){y.Wv=!1;if(!y.ry){var ja=0;y.oB=!0;y.GE=0;y.ry=setInterval(function(){2>ja++?y.rE():(clearInterval(y.ry),h&&h.reject(e.a),Object(z.f)("WebViewerServer connection failed:"+
aa))},5E3)}}),this.Wv=!0)},u8:function(){var h=this,y=createPromiseCapability();if(this.kl){var aa=new FormData;aa.append("file",this.kl.fileHandle,this.kl.fileHandle.name);var ja=this.kl.loadCallback;var ha="upload";var ia=this.kl.extension}else if(this.Lt){aa={uri:this.Lt.uri,Hda:this.Lt.shareId};aa=Object.keys(aa).map(function(na){return na+"="+(aa[na]?encodeURIComponent(aa[na]):"")}).join("&");var ea="application/x-www-form-urlencoded; charset=UTF-8";ja=this.Lt.loadCallback;ha="url";ia=this.Lt.extension}else return Promise.resolve();
var oa=new XMLHttpRequest,sa=Object(r.h)(h.re,"AuxUpload");sa=Object(x.a)(sa)+"&type="+ha+"&ext="+ia;oa.open("POST",sa);oa.withCredentials=this.Yi();ea&&oa.setRequestHeader("Content-Type",ea);oa.addEventListener("load",function(){if(oa.readyState===oa.DONE&&200===oa.status){var na=JSON.parse(oa.response);h.uB=na.uri;ja(na);y.resolve(na)}});oa.addEventListener("error",function(){y.reject(oa.statusText+" "+JSON.stringify(oa))});this.kl&&null!=this.kl.onProgress&&(oa.upload.onprogress=function(na){h.kl.onProgress(na)});
oa.send(aa);return y.promise},k5:function(h){this.password=h||null;this.$h.bp()||(this.$h=ka(),this.Ge({t:"pages"}));return this.$h.promise},ct:function(h){this.MB=h||null;this.$h.bp()||(this.VC(this.$h),this.Ge({t:"pages"}));return this.$h.promise},dB:function(h){h=Object.assign(h,{uri:encodeURIComponent(this.uB)});this.MB&&(h.ext=this.MB);this.Fe&&(h.c=this.Fe);this.password&&(h.pswd=this.password);this.KI&&(h.cacheKey=this.KI);this.DM&&(h.locale=this.DM);return h},Ge:function(h){h=this.dB(h);this.fB.send(h)},
Mi:function(h){return h},z2:function(h){var y=this,aa=h.data,ja=h.err,ha=h.t;switch(ha){case "upload":ja?y.v8.reject(ja):y.v8.resolve("Success");break;case "pages":ja?y.$h.reject(ja):fa(aa,ha,y.$h)&&y.$h.resolve(aa);break;case "config":if(ja)y.mk.reject(ja);else if(fa(aa,ha,y.mk)){aa.id&&(y.id=aa.id);if(aa.auth){var ia=Object(f.a)("wvsQueryParameters");ia.auth=aa.auth;Object(f.b)("wvsQueryParameters",ia)}aa.serverVersion&&(y.M8=aa.serverVersion,Object(z.g)("[WebViewer Server] server version: "+y.M8));
aa.serverID?(y.Cy=aa.serverID===y.GE&&y.HC?y.Cy+1:0,y.GE=aa.serverID):y.Cy=0;y.HC=!1;y.mk.resolve(aa)}break;case "health":ja?y.mk.reject(ja):fa(aa,ha,y.mk)&&(aa=aa.unhealthy,y.wP&&aa?Object(z.i)("Server failed health check. Single server mode ignoring check."):!y.iaa&&aa&&1>=y.Cy&&(y.HC=!0,y.$I().then(function(){y.rE()},function(){y.rE()})));break;case "pdf":aa.url=Object(x.a)(y.re+"../"+encodeURI(aa.url));ja?y.qe.reject(ja):fa(aa,ha,y.qe)&&y.qe.resolve(aa);break;case "ApString2Xod":aa.url=Object(x.a)(y.re+
"../data/"+encodeURI(aa.url));ja?y.Rh[aa.rID].reject(ja):fa(aa,ha,y.Rh[aa.rID])&&y.Rh[aa.rID].resolve(aa);break;case "docmod":aa.url=Object(x.a)(y.re+"../"+encodeURI(aa.url));ja?y.Rh[aa.rID].reject(ja):fa(aa,ha,y.qe)&&y.Rh[aa.rID].resolve(aa);break;case "xod":if(ja)this.vd&&this.vd.Lg()&&this.vd.reject(ja),this.fd&&this.fd.Lg()&&this.fd.reject(ja);else if(aa.notFound)aa.noCreate||this.vd&&this.vd.Lg()&&this.vd.resolve(aa),this.fd&&this.fd.Lg()&&this.fd.resolve(aa);else{aa.url&&(aa.url=Object(x.a)(y.re+
"../"+encodeURI(aa.url)));if(!this.fd||this.fd.bp())this.fd=ka(),this.fd.request={t:"xod",noCreate:!0};this.vd||(this.vd=ka(),this.vd.request={t:"xod"});this.fd.resolve(aa);this.vd.resolve(aa)}break;case "annots":if(ja)y.pf.reject(ja);else if(fa(aa,ha,y.pf)){y.pf.QO();var ea=new XMLHttpRequest;ia=y.re+"../"+encodeURI(aa.url);var oa=aa.hasAppearance?Object(x.a)(ia+".xodapp"):null;ea.open("GET",Object(x.a)(ia));ea.responseType="text";ea.withCredentials=this.Yi();ea.addEventListener("load",function(){ea.readyState===
ea.DONE&&200===ea.status&&y.pf.resolve({FF:ea.response,zI:oa})});ea.addEventListener("error",function(){y.pf.reject(ea.statusText+" "+JSON.stringify(ea))});ea.send()}break;case "image":var sa=this.af[aa.p];ja?sa.promise.reject(ja):fa(aa,ha,sa)&&(sa.result=aa,sa.result.url=Object(x.a)(y.re+"../"+encodeURI(sa.result.url)),sa.resolve(sa.result));break;case "tiles":sa=aa.rID;ia=this.Ke[sa];this.Ke[sa]=null;this.Aw.push(sa);if(ja)ia.reject(ja);else if(fa(aa,ha,ia)){for(ja=0;ja<aa.tiles.length;ja++)aa.tiles[ja]=
Object(x.a)(y.re+"../"+encodeURI(aa.tiles[ja]));ia.resolve(aa)}break;case "text":sa=this.eg[aa.p];if(ja)sa.reject(ja);else if(fa(aa,ha,sa)){sa.QO();var na=new XMLHttpRequest;aa=Object(x.a)(y.re+"../"+encodeURI(aa.url));na.open("GET",aa);na.withCredentials=this.Yi();na.addEventListener("load",function(){na.readyState===na.DONE&&200===na.status&&(sa.result=JSON.parse(na.response),sa.resolve(sa.result))});na.addEventListener("error",function(za){sa.reject(na.statusText+" "+JSON.stringify(za))});na.send()}break;
case "progress":"loading"===aa.t&&y.trigger(b.a.Events.DOCUMENT_LOADING_PROGRESS,[aa.bytes,aa.total])}!ha&&h.echo&&h&&"apstring2xod"==h.echo.t&&(h=h.echo.reqID)&&y.Rh[h].reject("Message unhandled by server")},oK:function(){this.VC(this.mk);return this.mk.promise},cZ:function(h){var y=this,aa=new XMLHttpRequest,ja=Object(x.a)(this.re+"aul")+"&id="+this.id,ha=new FormData,ia={};h=pd(h.body);for(var ea=h.next();!ea.done;ea=h.next())ea=ea.value,ia[ea.id]=ea.JA.w+";"+ea.JA.h,ha.append(ea.id,ea.JA.dataString);
ia={t:"apstring2xod",reqID:this.xM++,parts:ia};var oa=this.dB(ia);ha.append("msg",JSON.stringify(oa));y.Rh[oa.reqID]=ka();aa.open("POST",ja);aa.withCredentials=y.Yi;ja=new Promise(function(sa,na){aa.onreadystatechange=function(){4===aa.readyState&&(200===aa.status?sa():na("An error occurred while sending down appearance strings to the server"))}});aa.send(ha);return ja.then(function(){return y.Rh[oa.reqID].promise})},bZ:function(){this.pf||(this.pf=ka(),this.pf.request={t:"annots"},this.Ge(this.pf.request));
return this.pf.promise},zy:function(h){this.af[h]||(this.af[h]=ka(),this.af[h].request={t:"image",p:h},this.Ge(this.af[h].request));return this.af[h].promise},l5:function(h){this.eg[h]||(this.eg[h]=ka(),this.eg[h].request={t:"text",p:h},this.Ge(this.eg[h].request));return this.eg[h].promise},m5:function(h,y,aa,ja){var ha=this.Ke.length;this.Aw.length&&(ha=this.Aw.pop());this.Ke[ha]=ka();this.Ke[ha].request={t:"tiles",p:h,z:y,r:aa,size:ja,rID:ha};this.Ge(this.Ke[ha].request);return this.Ke[ha].promise},
rO:function(){this.qe||(this.qe=ka(),this.qe.request={t:"pdf"},this.oB?this.qe.resolve({url:this.uB}):this.Ge(this.qe.request));return this.qe.promise},GK:function(h){var y=this,aa=new XMLHttpRequest,ja=Object(x.a)(this.re+"aul")+"&id="+this.id,ha=new FormData,ia={};h.annots&&(ia.annots="xfdf");h.watermark&&(ia.watermark="png");h.redactions&&(ia.redactions="redact");ia={t:"docmod",reqID:this.xM++,parts:ia};h.print&&(ia.print=!0);var ea=this.dB(ia);ha.append("msg",JSON.stringify(ea));return Promise.all([h.annots,
h.watermark,h.redactions].map(function(oa){return Promise.resolve(oa)})).then(function(oa){var sa=oa[0],na=oa[1],za=oa[2];sa&&ha.append("annots",sa);na&&ha.append("watermark",oa.watermark);za&&ha.append("redactions",za);y.Rh[ea.reqID]=ka();aa.open("POST",ja);aa.withCredentials=y.Yi;oa=new Promise(function(ta,ua){aa.onreadystatechange=function(){4===aa.readyState&&(200===aa.status?ta():ua("An error occurred while sending down annotation data to the server"))}});aa.send(ha);return oa.then(function(){return y.Rh[ea.reqID].promise})})},
cL:function(){this.fd||(this.fd=ka(),this.fd.request={t:"xod",noCreate:!0},this.Ge(this.fd.request));return this.fd.promise},n5:function(){this.vd||(this.vd=ka(),this.vd.request={t:"xod"},this.Ge(this.vd.request));return this.vd.promise},Xk:function(){return!0},request:function(){},MN:function(){},abort:function(){for(var h=0;h<this.Ke.length;h++)this.Ke[h]&&(this.Ke[h].resolve(null),this.Ke[h]=null,this.Aw.push(h));this.close()},Jy:function(h){this.Fe=this.Fe||{};this.Fe.headers=h},cba:function(){return this.Fe?
Object(ca.omit)(this.Fe.headers,["Cookie","cookie"]):null},qn:function(h){this.Fe=this.Fe||{};this.Fe.internal=this.Fe.internal||{};this.Fe.internal.withCredentials=h},Yi:function(){return this.Fe&&this.Fe.internal?this.Fe.internal.withCredentials:null},getFileData:function(){return Promise.reject()}});Object(Ca.a)(pa);Object(a.a)(pa);Object(a.b)(pa);va["default"]=pa},353:function(Ca,va,ba){function pa(z,r,n){function b(e,f){function x(za){h().then(function(ta){ea&&!oa?setTimeout(function(){x(za)},
1):ta.send(JSON.stringify(za))})}function w(za,ta,ua,xa){var qa=window.createPromiseCapability(),ya=!1,Aa=qa;ja=za;ha=ta;ia=ua;aa=null;xa&&(za=Object(fa.a)("wvsQueryParameters"),za.bcid=Object(la.i)(8),Object(fa.b)("wvsQueryParameters",za));try{za=sa?na+"/"+sa:na+"/ws";za=Object(ca.a)(za);var Ha=new WebSocket(za);Ha.onopen=function(){qa.resolve();ya=!0;qa=null;ea=!1;y.resolve(Ha);ha&&ha()};Ha.onerror=function(Oa){ea=oa=!0;qa&&qa.reject(Oa);aa&&aa.reject()};Ha.onclose=function(){y=window.createPromiseCapability();
ea=!0;aa||(aa=window.createPromiseCapability());aa.resolve();ia&&ia();ja&&ya&&ja({t:"health",data:{unhealthy:!0,isDead:!0}})};Ha.onmessage=function(Oa){Oa&&Oa.data&&(Oa=JSON.parse(Oa.data),Oa.hb?x({hb:!0}):Oa.end?close():ja(Oa))}}catch(Oa){qa.reject(Oa),qa=null}return Aa.promise}function h(){ea&&ja&&w(ja);return y.promise}var y=window.createPromiseCapability(),aa=null,ja,ha,ia=null,ea=!1,oa=!1,sa=f,na=function(za){var ta=za.indexOf("://"),ua="ws://";0>ta?ta=0:(5===ta&&(ua="wss://"),ta+=3);var xa=
za.lastIndexOf("/");0>xa&&(xa=za.length);return ua+za.slice(ta,xa)}(e);return{send:x,gF:w,CB:function(){return aa?aa.promise:h().then(function(za){aa=window.createPromiseCapability();ja=null;za.close();return aa.promise})}}}function a(e){var f=e.lastIndexOf("/");0>f&&(f=e.length);return e.slice(0,f)}return window.WebSocket&&!n?b(z,r):function(e,f){function x(za){(ia?ia.promise:Promise.resolve(ha)).then(function(ta){var ua=new XMLHttpRequest,xa=ja?aa+"/"+ja+"pf":aa+"/pf";xa=Object(ca.a)(xa)+"&id="+
ta;ta=new FormData;ta.append("data",JSON.stringify(za));ua.open("POST",xa);ua.withCredentials=!0;ua.send(ta)})}function w(){ha=0;ia||(ia=window.createPromiseCapability())}function h(){y=new XMLHttpRequest;var za=aa+"/pf";za+=0!==ha?"?id="+ha+"&uc="+na:"?uc="+na;na++;y.open("GET",za,!0);y.withCredentials=!0;y.setRequestHeader("Cache-Control","no-cache");y.setRequestHeader("X-Requested-With","XMLHttpRequest");var ta=y,ua=!1;y.onreadystatechange=function(){a:if(3<=ta.readyState&&!ua){try{var xa=ta.responseText.length}catch(Aa){Object(ka.g)("caught exception");
break a}if(0<xa)try{var qa=ta.responseText.split("\n");for(qa[qa.length-1]&&qa.pop();0<qa.length&&3>qa[qa.length-1].length;)"]"===qa.pop()&&w();0<qa.length&&3>qa[0].length&&qa.shift();for(xa=0;xa<qa.length;++xa)qa[xa].endsWith(",")&&(qa[xa]=qa[xa].substr(0,qa[xa].length-1));0===ha&&0<qa.length&&(ha=JSON.parse(qa.shift()).id,xa=ia,ia=null,xa.resolve(ha));var ya;for(xa=0;xa<qa.length;++xa)(ya=JSON.parse(qa[xa]))&&ya.end?close():ya&&ya.hb&&ya.id===ha?x({hb:!0}):sa(ya)}catch(Aa){}ea||(ua=!0,h())}};y.send()}
var y,aa=a(e),ja=f,ha=0,ia=window.createPromiseCapability(),ea=!1,oa=null,sa=null,na=0;return{send:x,gF:function(za,ta,ua){sa=za;oa=ua;ea=!1;w();h();ta&&ta();return Promise.resolve()},CB:function(){w();sa=null;ea=!0;oa&&oa();y.abort();return Promise.resolve()}}}(z,r)}ba.d(va,"a",function(){return pa});var ka=ba(1),la=ba(31),fa=ba(37),ca=ba(126)}}]);}).call(this || window)
