(self.webpackChunkforgejo=self.webpackChunkforgejo||[]).push([["pdf-object"],{"./node_modules/pdfobject/pdfobject.js":(function(F,v){var p,y,h;(function(L,a){y=[],p=a,h=typeof p=="function"?p.apply(v,y):p,h!==void 0&&(F.exports=h)})(this,function(){"use strict";if(typeof window>"u"||window.navigator===void 0||window.navigator.userAgent===void 0)return!1;let L="2.3.0",a=window,f=a.navigator,k=f.userAgent,C=!1,R=function(){let e=a.chrome!==void 0,n=a.safari!==void 0||f.vendor!==void 0&&/Apple/.test(f.vendor)&&/Safari/.test(k),i=a.Mozilla!==void 0||/irefox/.test(k);return e||n||i},M=function(e){var n=null;try{n=new ActiveXObject(e)}catch{n=null}return!!n},O=function(){return"ActiveXObject"in a&&(M("AcroPDF.PDF")||M("PDF.PdfCtrl"))},A=function(){if(f.platform!==void 0&&f.platform==="MacIntel"&&f.maxTouchPoints!==void 0&&f.maxTouchPoints>1||/Mobi|Tablet|Android|iPad|iPhone/.test(k))return!1;let i=typeof f.pdfViewerEnabled=="boolean";return i&&!f.pdfViewerEnabled?!1:i&&f.pdfViewerEnabled||R()||O()}(),I=function(e){let n="",i,l=[],t="";if((e.comment||e.viewrect||e.highlight)&&(e.page||(e.page=1,_("The comment, viewrect, and highlight parameters require a page parameter, but none was specified. Defaulting to page 1."))),e.page&&(l.push("page="+encodeURIComponent(e.page)),delete e.page),e.fdf&&(t=e.fdf,delete e.fdf),e){for(i in e)e.hasOwnProperty(i)&&l.push(encodeURIComponent(i)+"="+encodeURIComponent(e[i]));t&&l.push("fdf="+encodeURIComponent(t)),n=l.join("&"),n&&(n="#"+n)}return n},_=function(e){return C||console.log("[PDFObject]",e),!1},U=function(e){for(;e.firstChild;)e.removeChild(e.firstChild)},S=function(e){let n=document.body;return typeof e=="string"?n=document.querySelector(e):a.jQuery!==void 0&&e instanceof jQuery&&e.length?n=e.get(0):e.nodeType!==void 0&&e.nodeType===1&&(n=e),n},B=function(e,n,i,l){if(window.Blob&&window.URL&&window.URL.createObjectURL){var t=new XMLHttpRequest;t.open("GET",e,!0),t.responseType="blob",t.onload=function(){if(t.status===200){var c=t.response,s=document.createElement("a");s.innerText="Download PDF",s.href=URL.createObjectURL(c),s.setAttribute("download",n),i.innerHTML=l.replace(/\[pdflink\]/g,s.outerHTML)}},t.send()}},T=function(e,n,i,l,t,c,s,D,m,r,w){U(n);let u=i;if(e==="pdfjs"){let d=w.indexOf("?")!==-1?"&":"?";u=w+d+"file="+encodeURIComponent(i)+l}else u+=l;let o=document.createElement("iframe");if(o.className="pdfobject",o.type="application/pdf",o.title=D,o.src=u,o.allow="fullscreen",o.frameborder="0",s&&(o.id=s),!m){let d="border: none;";n!==document.body?d+="width: "+t+"; height: "+c+";":d+="position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%;",o.style.cssText=d}let g=["className","type","title","src","style","id","allow","frameborder"];return r&&r.key&&g.indexOf(r.key)===-1&&o.setAttribute(r.key,typeof r.value<"u"?r.value:""),n.classList.add("pdfobject-container"),n.appendChild(o),n.getElementsByTagName("iframe")[0]},H=function(e,n,i){let l=n||!1,t=i||{};C=typeof t.suppressConsole=="boolean"?t.suppressConsole:!1;let c=typeof t.id=="string"?t.id:"",s=t.page||!1,D=t.pdfOpenParams||{},m=typeof t.fallbackLink=="string"||typeof t.fallbackLink=="boolean"?t.fallbackLink:!0,r=t.width||"100%",w=t.height||"100%",u=t.title||"Embedded PDF",o=typeof t.forcePDFJS=="boolean"?t.forcePDFJS:!1,g=typeof t.omitInlineStyles=="boolean"?t.omitInlineStyles:!1,d=t.PDFJS_URL||!1,b=S(l),j="",E=t.customAttribute||{},P="<p>This browser does not support inline PDFs. Please download the PDF to view it: [pdflink]</p>";if(typeof e!="string")return _("URL is not valid");if(!b)return _("Target element cannot be determined");if(s&&(D.page=s),j=I(D),o&&d)return T("pdfjs",b,e,j,r,w,c,u,g,E,d);if(A)return T("iframe",b,e,j,r,w,c,u,g,E);if(d)return T("pdfjs",b,e,j,r,w,c,u,g,E,d);if(m)if(typeof m=="string")b.innerHTML=m.replace(/\[url\]/g,e);else if(e.indexOf("data:application/pdf;base64")!==-1)B(e,"file.pdf",b,P);else{let x="<a href='"+e+"'>Download PDF</a>";b.innerHTML=P.replace(/\[pdflink\]/g,x)}return _("This browser does not support embedded PDFs")};return{embed:function(e,n,i){return H(e,n,i)},pdfobjectversion:(function(){return L})(),supportsPDFs:(function(){return A})()}})}),"./web_src/js/webcomponents/pdf-object.js":(function(F,v,p){"use strict";p.r(v);var y=p("./node_modules/pdfobject/pdfobject.js");window.customElements.define("pdf-object",class extends HTMLElement{connectedCallback(){const h=this.innerHTML;y.embed(this.getAttribute("src"),this,{fallbackLink:h})}})})}]);
