diff --git a/.env b/.env index bcd20d3..d77491e 100644 --- a/.env +++ b/.env @@ -1,4 +1,6 @@ BASE_URL="" # Middleware Path - eg : "https://middleware.prathamdigital.org" AUTH_API_TOKEN="" # User Auth Access Token -TENANT_ID="" # Tenant Id of User -CLOUD_STORAGE_URL="" #Use environment variable for S3 Cloud Storage URL \ No newline at end of file +NEXT_PUBLIC_TENANT_ID="" # Tenant Id of User +NEXT_PUBLIC_CLOUD_STORAGE_URL="" # Use environment variable for S3 Cloud Storage URL - should have / at the end. +NEXT_PUBLIC_CHANNEL_ID="" # Channel Id of knowlg-inQuiry setup +NEXT_PUBLIC_FRAMEWORK_ID="" # Framework Id of knowlg-inQuiry setup \ No newline at end of file diff --git a/.github/workflows/dev-deployment.yaml b/.github/workflows/dev-deployment.yaml index 6e2c684..939250a 100644 --- a/.github/workflows/dev-deployment.yaml +++ b/.github/workflows/dev-deployment.yaml @@ -6,8 +6,7 @@ env: EKS_CLUSTER_NAME: ${{ secrets.EKS_CLUSTER_NAME_DEV }} AWS_REGION: ${{ secrets.AWS_REGION_NAME }} jobs: - build: - + build_dev: name: Deployment runs-on: ubuntu-latest steps: @@ -32,7 +31,8 @@ jobs: - name: Copy .env file env: ENV_FILE_CONTENT: ${{ secrets.ENV_FILE_CONTENT_DEV }} - run: printf "%s" "$ENV_FILE_CONTENT" > manifest/configmap.yaml + run: printf "%s" "$ENV_FILE_CONTENT" > manifest/configmap.yaml + # run: echo "$ENV_FILE_CONTENT" > manifest/configmap.yaml - name: Copy .env file in the code env: DEV_ENV: ${{ secrets.DEV_ENV }} @@ -89,4 +89,4 @@ jobs: sleep 10 kubectl get pods kubectl get services - kubectl get deployment + kubectl get deployment \ No newline at end of file diff --git a/.github/workflows/qa-deployment.yaml b/.github/workflows/qa-deployment.yaml index e1600ae..baea75b 100644 --- a/.github/workflows/qa-deployment.yaml +++ b/.github/workflows/qa-deployment.yaml @@ -2,7 +2,7 @@ name: Deploy to Tekdi-QA-Server on: push: branches: - - main + - release-1.0.0 jobs: deploy: runs-on: ubuntu-latest diff --git a/next.config.js b/next.config.js index 63e1e37..6d03bcb 100644 --- a/next.config.js +++ b/next.config.js @@ -31,6 +31,10 @@ const nextConfig = { source: "/action/asset/v1/upload/:identifier*", // Match asset upload routes destination: "/api/fileUpload", // Forward asset uploads to fileUpload.js }, + { + source: "/assets/pdfjs/:path*", // Match any URL starting with /workspace/content/assets/ + destination: "/assets/:path*", // Serve the assets from the public folder + }, { source: "/action/content/v3/upload/url/:identifier*", // Match content upload with 'url' in the path destination: @@ -58,7 +62,7 @@ const nextConfig = { }, { source: "/assets/public/:path*", // Match any URL starting with /assets/public/ - destination: `${process.env.CLOUD_STORAGE_URL}/:path*`, // Forward to S3, stripping "/assets/public" + destination: `${process.env.NEXT_PUBLIC_CLOUD_STORAGE_URL}/:path*`, // Forward to S3, stripping "/assets/public" }, { source: "/workspace/content/assets/:path*", // Match any URL starting with /workspace/content/assets/ @@ -125,6 +129,11 @@ const nextConfig = { "./UploadEditor": "/src/pages/upload-editor.tsx", "./Collection": "/src/pages/collection.tsx", "./SunbirdPlayers": "/src/pages/sunbirdPlayers.tsx", + "./Review": "/src/pages/workspace/content/review/index.tsx", + "./UpReview": "/src/pages/workspace/content/up-review/index.tsx", + "./DiscoverContent": "/src/pages/workspace/content/discover-contents/index.tsx", + + }, }) ); diff --git a/package-lock.json b/package-lock.json index beabc90..b5cbe86 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,12 +8,12 @@ "name": "adminpoc", "version": "0.1.0", "dependencies": { - "@emotion/react": "11.11.4", - "@emotion/styled": "11.11.5", + "@emotion/react": "^11.11.4", + "@emotion/styled": "^11.11.5", "@module-federation/nextjs-mf": "^8.5.5", "@module-federation/utilities": "3.0.11", - "@mui/icons-material": "^5.15.20", - "@mui/material": "^5.16.0", + "@mui/icons-material": "^5.15.15", + "@mui/material": "^5.15.21", "@project-sunbird/sunbird-collection-editor-web-component": "^1.6.0", "async": "^3.2.5", "body-parser": "^1.20.2", @@ -29,6 +29,7 @@ "jquery": "^3.7.1", "jquery-ui-dist": "^1.13.3", "jquery.fancytree": "^2.38.3", + "ka-table": "^11.3.0", "lodash": "^4.17.21", "mathjax-full": "^3.2.2", "multer": "^1.4.5-lts.1", @@ -39,7 +40,8 @@ "reflect-metadata": "^0.1.13", "svg2img": "^1.0.0-beta.2", "url": "^0.11.3", - "uuid": "^10.0.0" + "uuid": "^10.0.0", + "zustand": "^5.0.1" }, "devDependencies": { "@types/jquery": "^3.5.31", @@ -6166,6 +6168,14 @@ "node": ">=4.0" } }, + "node_modules/ka-table": { + "version": "11.3.0", + "resolved": "https://registry.npmjs.org/ka-table/-/ka-table-11.3.0.tgz", + "integrity": "sha512-kXBxpPqK05MHWgBMNL07v1jmLxFdkSOlNO7iCyF3YVVPuA9SqyiE1EarzyMrazFgrvhOR0OPOpMpYmL6mVrI5g==", + "peerDependencies": { + "react": "^16.8.3 || ^17.0.0-0 || ^18.0.0-0" + } + }, "node_modules/keygrip": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/keygrip/-/keygrip-1.1.0.tgz", @@ -9091,6 +9101,34 @@ "funding": { "url": "https://github.com/sponsors/sindresorhus" } + }, + "node_modules/zustand": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/zustand/-/zustand-5.0.1.tgz", + "integrity": "sha512-pRET7Lao2z+n5R/HduXMio35TncTlSW68WsYBq2Lg1ASspsNGjpwLAsij3RpouyV6+kHMwwwzP0bZPD70/Jx/w==", + "engines": { + "node": ">=12.20.0" + }, + "peerDependencies": { + "@types/react": ">=18.0.0", + "immer": ">=9.0.6", + "react": ">=18.0.0", + "use-sync-external-store": ">=1.2.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "immer": { + "optional": true + }, + "react": { + "optional": true + }, + "use-sync-external-store": { + "optional": true + } + } } } } diff --git a/package.json b/package.json index d741681..d61f7fc 100644 --- a/package.json +++ b/package.json @@ -9,12 +9,12 @@ "lint": "next lint" }, "dependencies": { - "@emotion/react": "11.11.4", - "@emotion/styled": "11.11.5", + "@emotion/react": "^11.11.4", + "@emotion/styled": "^11.11.5", "@module-federation/nextjs-mf": "^8.5.5", "@module-federation/utilities": "3.0.11", - "@mui/icons-material": "^5.15.20", - "@mui/material": "^5.16.0", + "@mui/icons-material": "^5.15.15", + "@mui/material": "^5.15.21", "@project-sunbird/sunbird-collection-editor-web-component": "^1.6.0", "async": "^3.2.5", "body-parser": "^1.20.2", @@ -30,6 +30,7 @@ "jquery": "^3.7.1", "jquery-ui-dist": "^1.13.3", "jquery.fancytree": "^2.38.3", + "ka-table": "^11.3.0", "lodash": "^4.17.21", "mathjax-full": "^3.2.2", "multer": "^1.4.5-lts.1", @@ -40,7 +41,8 @@ "reflect-metadata": "^0.1.13", "svg2img": "^1.0.0-beta.2", "url": "^0.11.3", - "uuid": "^10.0.0" + "uuid": "^10.0.0", + "zustand": "^5.0.1" }, "devDependencies": { "@types/jquery": "^3.5.31", diff --git a/public/150+.png b/public/150+.png new file mode 100644 index 0000000..576ddee Binary files /dev/null and b/public/150+.png differ diff --git a/public/delete.png b/public/delete.png new file mode 100644 index 0000000..51d6875 Binary files /dev/null and b/public/delete.png differ diff --git a/public/favicon.ico b/public/favicon.ico index 718d6fe..ba528a4 100644 Binary files a/public/favicon.ico and b/public/favicon.ico differ diff --git a/public/logo.png b/public/logo.png new file mode 100644 index 0000000..453e617 Binary files /dev/null and b/public/logo.png differ diff --git a/public/workspace/content/assets/add.svg b/public/workspace/content/assets/add.svg deleted file mode 100644 index 82ebf20..0000000 --- a/public/workspace/content/assets/add.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/public/workspace/content/assets/arrow-right.svg b/public/workspace/content/assets/arrow-right.svg deleted file mode 100644 index a80ef79..0000000 --- a/public/workspace/content/assets/arrow-right.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/public/workspace/content/assets/badge-2.svg b/public/workspace/content/assets/badge-2.svg deleted file mode 100644 index ade49b6..0000000 --- a/public/workspace/content/assets/badge-2.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/public/workspace/content/assets/exit_to_app.svg b/public/workspace/content/assets/exit_to_app.svg deleted file mode 100644 index c1a6a64..0000000 --- a/public/workspace/content/assets/exit_to_app.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/public/workspace/content/assets/iconclosedownload.svg b/public/workspace/content/assets/iconclosedownload.svg deleted file mode 100644 index c3d947d..0000000 --- a/public/workspace/content/assets/iconclosedownload.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/public/workspace/content/assets/minus.svg b/public/workspace/content/assets/minus.svg deleted file mode 100644 index e8a0452..0000000 --- a/public/workspace/content/assets/minus.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/public/workspace/content/assets/next-arrow.svg b/public/workspace/content/assets/next-arrow.svg deleted file mode 100644 index b0a8787..0000000 --- a/public/workspace/content/assets/next-arrow.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/public/workspace/content/assets/pdfjs/build/pdf.js b/public/workspace/content/assets/pdfjs/build/pdf.js deleted file mode 100644 index e054491..0000000 --- a/public/workspace/content/assets/pdfjs/build/pdf.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("pdfjs-dist/build/pdf",[],t):"object"==typeof exports?exports["pdfjs-dist/build/pdf"]=t():e["pdfjs-dist/build/pdf"]=e.pdfjsLib=t()}(this,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"addLinkAttributes",{enumerable:!0,get:function(){return n.addLinkAttributes}}),Object.defineProperty(t,"getFilenameFromUrl",{enumerable:!0,get:function(){return n.getFilenameFromUrl}}),Object.defineProperty(t,"LinkTarget",{enumerable:!0,get:function(){return n.LinkTarget}}),Object.defineProperty(t,"loadScript",{enumerable:!0,get:function(){return n.loadScript}}),Object.defineProperty(t,"PDFDateString",{enumerable:!0,get:function(){return n.PDFDateString}}),Object.defineProperty(t,"RenderingCancelledException",{enumerable:!0,get:function(){return n.RenderingCancelledException}}),Object.defineProperty(t,"build",{enumerable:!0,get:function(){return i.build}}),Object.defineProperty(t,"getDocument",{enumerable:!0,get:function(){return i.getDocument}}),Object.defineProperty(t,"LoopbackPort",{enumerable:!0,get:function(){return i.LoopbackPort}}),Object.defineProperty(t,"PDFDataRangeTransport",{enumerable:!0,get:function(){return i.PDFDataRangeTransport}}),Object.defineProperty(t,"PDFWorker",{enumerable:!0,get:function(){return i.PDFWorker}}),Object.defineProperty(t,"version",{enumerable:!0,get:function(){return i.version}}),Object.defineProperty(t,"CMapCompressionType",{enumerable:!0,get:function(){return a.CMapCompressionType}}),Object.defineProperty(t,"createObjectURL",{enumerable:!0,get:function(){return a.createObjectURL}}),Object.defineProperty(t,"createPromiseCapability",{enumerable:!0,get:function(){return a.createPromiseCapability}}),Object.defineProperty(t,"createValidAbsoluteUrl",{enumerable:!0,get:function(){return a.createValidAbsoluteUrl}}),Object.defineProperty(t,"InvalidPDFException",{enumerable:!0,get:function(){return a.InvalidPDFException}}),Object.defineProperty(t,"MissingPDFException",{enumerable:!0,get:function(){return a.MissingPDFException}}),Object.defineProperty(t,"OPS",{enumerable:!0,get:function(){return a.OPS}}),Object.defineProperty(t,"PasswordResponses",{enumerable:!0,get:function(){return a.PasswordResponses}}),Object.defineProperty(t,"PermissionFlag",{enumerable:!0,get:function(){return a.PermissionFlag}}),Object.defineProperty(t,"removeNullCharacters",{enumerable:!0,get:function(){return a.removeNullCharacters}}),Object.defineProperty(t,"shadow",{enumerable:!0,get:function(){return a.shadow}}),Object.defineProperty(t,"UnexpectedResponseException",{enumerable:!0,get:function(){return a.UnexpectedResponseException}}),Object.defineProperty(t,"UNSUPPORTED_FEATURES",{enumerable:!0,get:function(){return a.UNSUPPORTED_FEATURES}}),Object.defineProperty(t,"Util",{enumerable:!0,get:function(){return a.Util}}),Object.defineProperty(t,"VerbosityLevel",{enumerable:!0,get:function(){return a.VerbosityLevel}}),Object.defineProperty(t,"AnnotationLayer",{enumerable:!0,get:function(){return o.AnnotationLayer}}),Object.defineProperty(t,"apiCompatibilityParams",{enumerable:!0,get:function(){return s.apiCompatibilityParams}}),Object.defineProperty(t,"GlobalWorkerOptions",{enumerable:!0,get:function(){return u.GlobalWorkerOptions}}),Object.defineProperty(t,"renderTextLayer",{enumerable:!0,get:function(){return c.renderTextLayer}}),Object.defineProperty(t,"SVGGraphics",{enumerable:!0,get:function(){return l.SVGGraphics}});var n=r(1),i=r(198),a=r(5),o=r(209),s=r(200),u=r(203),c=r(210),l=r(211);if(r(7).isNodeJS){var f=r(212).PDFNodeStream;(0,i.setPDFNetworkStreamFactory)(function(e){return new f(e)})}else{var h,d=r(215).PDFNetworkStream;(0,n.isFetchSupported)()&&(h=r(216).PDFFetchStream),(0,i.setPDFNetworkStreamFactory)(function(e){return h&&(0,n.isValidFetchUrl)(e.url)?new h(e):new d(e)})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addLinkAttributes=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.url,n=t.target,i=t.rel,o=t.enabled,s=void 0===o||o;(0,a.assert)(r&&"string"==typeof r,'addLinkAttributes: A valid "url" parameter must provided.');var u=(0,a.removeNullCharacters)(r);s?e.href=e.title=u:(e.href="",e.title="Disabled: ".concat(u),e.onclick=function(){return!1});var c="";switch(n){case k.NONE:break;case k.SELF:c="_self";break;case k.BLANK:c="_blank";break;case k.PARENT:c="_parent";break;case k.TOP:c="_top"}e.target=c,e.rel="string"==typeof i?i:g},t.getFilenameFromUrl=function(e){var t=e.indexOf("#"),r=e.indexOf("?"),n=Math.min(t>0?t:e.length,r>0?r:e.length);return e.substring(e.lastIndexOf("/",n)+1,n)},t.isFetchSupported=R,t.isValidFetchUrl=P,t.loadScript=function(e){return new Promise(function(t,r){var n=document.createElement("script");n.src=e,n.onload=t,n.onerror=function(){r(new Error("Cannot load script at: ".concat(n.src)))},(document.head||document.documentElement).appendChild(n)})},t.deprecated=function(e){console.log("Deprecated API usage: "+e)},t.PDFDateString=t.StatTimer=t.DOMSVGFactory=t.DOMCMapReaderFactory=t.DOMCanvasFactory=t.DEFAULT_LINK_REL=t.LinkTarget=t.RenderingCancelledException=t.PageViewport=void 0;var n,i=(n=r(2))&&n.__esModule?n:{default:n},a=r(5);function o(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return s(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return s(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&t>0,"Invalid SVG dimensions");var r=document.createElementNS(m,"svg:svg");return r.setAttribute("version","1.1"),r.setAttribute("width",e+"px"),r.setAttribute("height",t+"px"),r.setAttribute("preserveAspectRatio","none"),r.setAttribute("viewBox","0 0 "+e+" "+t),r}},{key:"createElement",value:function(e){return(0,a.assert)("string"==typeof e,"Invalid SVG element type"),document.createElementNS(m,e)}}]),e}();t.DOMSVGFactory=A;var S=function(){function e(t){var r=t.viewBox,n=t.scale,i=t.rotation,a=t.offsetX,o=void 0===a?0:a,s=t.offsetY,u=void 0===s?0:s,c=t.dontFlip,l=void 0!==c&&c;p(this,e),this.viewBox=r,this.scale=n,this.rotation=i,this.offsetX=o,this.offsetY=u;var f,h,d,v,y,g,m,b,_=(r[2]+r[0])/2,A=(r[3]+r[1])/2;switch(i=(i%=360)<0?i+360:i){case 180:f=-1,h=0,d=0,v=1;break;case 90:f=0,h=1,d=1,v=0;break;case 270:f=0,h=-1,d=-1,v=0;break;case 0:f=1,h=0,d=0,v=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}l&&(d=-d,v=-v),0===f?(y=Math.abs(A-r[1])*n+o,g=Math.abs(_-r[0])*n+u,m=Math.abs(r[3]-r[1])*n,b=Math.abs(r[2]-r[0])*n):(y=Math.abs(_-r[0])*n+o,g=Math.abs(A-r[1])*n+u,m=Math.abs(r[2]-r[0])*n,b=Math.abs(r[3]-r[1])*n),this.transform=[f*n,h*n,d*n,v*n,y-f*n*_-d*n*A,g-h*n*_-v*n*A],this.width=m,this.height=b}return y(e,[{key:"clone",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.scale,n=void 0===r?this.scale:r,i=t.rotation,a=void 0===i?this.rotation:i,o=t.offsetX,s=void 0===o?this.offsetX:o,u=t.offsetY,c=void 0===u?this.offsetY:u,l=t.dontFlip,f=void 0!==l&&l;return new e({viewBox:this.viewBox.slice(),scale:n,rotation:a,offsetX:s,offsetY:c,dontFlip:f})}},{key:"convertToViewportPoint",value:function(e,t){return a.Util.applyTransform([e,t],this.transform)}},{key:"convertToViewportRectangle",value:function(e){var t=a.Util.applyTransform([e[0],e[1]],this.transform),r=a.Util.applyTransform([e[2],e[3]],this.transform);return[t[0],t[1],r[0],r[1]]}},{key:"convertToPdfPoint",value:function(e,t){return a.Util.applyInverseTransform([e,t],this.transform)}}]),e}();t.PageViewport=S;var w=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}(r,a.BaseException);var t=l(r);function r(e,n){var i;return p(this,r),(i=t.call(this,e)).type=n,i}return r}();t.RenderingCancelledException=w;var k={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};t.LinkTarget=k;var x,C=function(){function e(){p(this,e),this.started=Object.create(null),this.times=[]}return y(e,[{key:"time",value:function(e){e in this.started&&(0,a.warn)("Timer is already running for ".concat(e)),this.started[e]=Date.now()}},{key:"timeEnd",value:function(e){e in this.started||(0,a.warn)("Timer has not been started for ".concat(e)),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e]}},{key:"toString",value:function(){var e,t=[],r=0,n=o(this.times);try{for(n.s();!(e=n.n()).done;){var i=e.value.name;i.length>r&&(r=i.length)}}catch(e){n.e(e)}finally{n.f()}var a,s=o(this.times);try{for(s.s();!(a=s.n()).done;){var u=a.value,c=u.end-u.start;t.push("".concat(u.name.padEnd(r)," ").concat(c,"ms\n"))}}catch(e){s.e(e)}finally{s.f()}return t.join("")}}]),e}();function R(){return"undefined"!=typeof fetch&&"undefined"!=typeof Response&&"body"in Response.prototype&&"undefined"!=typeof ReadableStream}function P(e,t){try{var r=(t?new URL(e,t):new URL(e)).protocol;return"http:"===r||"https:"===r}catch(e){return!1}}t.StatTimer=C;var T=function(){function e(){p(this,e)}return y(e,null,[{key:"toDateObject",value:function(e){if(!e||!(0,a.isString)(e))return null;x||(x=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));var t=x.exec(e);if(!t)return null;var r=parseInt(t[1],10),n=parseInt(t[2],10);n=n>=1&&n<=12?n-1:0;var i=parseInt(t[3],10);i=i>=1&&i<=31?i:1;var o=parseInt(t[4],10);o=o>=0&&o<=23?o:0;var s=parseInt(t[5],10);s=s>=0&&s<=59?s:0;var u=parseInt(t[6],10);u=u>=0&&u<=59?u:0;var c=t[7]||"Z",l=parseInt(t[8],10);l=l>=0&&l<=23?l:0;var f=parseInt(t[9],10)||0;return f=f>=0&&f<=59?f:0,"-"===c?(o+=l,s+=f):"+"===c&&(o-=l,s-=f),new Date(Date.UTC(r,n,i,o,s,u))}}]),e}();t.PDFDateString=T},function(e,t,r){"use strict";e.exports=r(3)},function(e,t,r){"use strict";(function(e){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r=function(e){var r,n=Object.prototype,i=n.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",u=a.toStringTag||"@@toStringTag";function c(e,t,r,n){var i=t&&t.prototype instanceof y?t:y,a=Object.create(i.prototype),o=new P(n||[]);return a._invoke=function(e,t,r){var n=f;return function(i,a){if(n===d)throw new Error("Generator is already running");if(n===p){if("throw"===i)throw a;return E()}for(r.method=i,r.arg=a;;){var o=r.delegate;if(o){var s=x(o,r);if(s){if(s===v)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===f)throw n=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var u=l(e,t,r);if("normal"===u.type){if(n=r.done?p:h,u.arg===v)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=p,r.method="throw",r.arg=u.arg)}}}(e,r,o),a}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var f="suspendedStart",h="suspendedYield",d="executing",p="completed",v={};function y(){}function g(){}function m(){}var b={};b[o]=function(){return this};var _=Object.getPrototypeOf,A=_&&_(_(T([])));A&&A!==n&&i.call(A,o)&&(b=A);var S=m.prototype=y.prototype=Object.create(b);function w(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function k(e,r){var n;this._invoke=function(a,o){function s(){return new r(function(n,s){!function n(a,o,s,u){var c=l(e[a],e,o);if("throw"!==c.type){var f=c.arg,h=f.value;return h&&"object"===t(h)&&i.call(h,"__await")?r.resolve(h.__await).then(function(e){n("next",e,s,u)},function(e){n("throw",e,s,u)}):r.resolve(h).then(function(e){f.value=e,s(f)},function(e){return n("throw",e,s,u)})}u(c.arg)}(a,o,n,s)})}return n=n?n.then(s,s):s()}}function x(e,t){var n=e.iterator[t.method];if(n===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=r,x(e,t),"throw"===t.method))return v;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var i=l(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,v;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=r),t.delegate=null,v):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,v)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function R(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function T(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function t(){for(;++n=0;--a){var o=this.tryEntries[a],s=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var u=i.call(o,"catchLoc"),c=i.call(o,"finallyLoc");if(u&&c){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),R(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;R(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:T(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=r),v}},e}("object"===t(e)?e.exports:{});try{regeneratorRuntime=r}catch(e){Function("r","regeneratorRuntime = r")(r)}}).call(this,r(4)(e))},function(e,t,r){"use strict";e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";function n(e,t){for(var r=0;r=l.INFOS&&console.log("Info: ".concat(e))},t.isArrayBuffer=function(e){return"object"===i(e)&&null!==e&&void 0!==e.byteLength},t.isArrayEqual=function(e,t){if(e.length!==t.length)return!1;return e.every(function(e,r){return e===t[r]})},t.isBool=function(e){return"boolean"==typeof e},t.isEmptyObj=function(e){for(var t in e)return!1;return!0},t.isNum=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSameOrigin=function(e,t){var r;try{if(!(r=new URL(e)).origin||"null"===r.origin)return!1}catch(e){return!1}var n=new URL(t,r);return r.origin===n.origin},t.createValidAbsoluteUrl=function(e,t){if(!e)return null;try{var r=t?new URL(e,t):new URL(e);if(function(e){if(!e)return!1;switch(e.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(r))return r}catch(e){}return null},t.removeNullCharacters=function(e){if("string"!=typeof e)return h("The argument for removeNullCharacters must be a string."),e;return e.replace(k,"")},t.setVerbosityLevel=function(e){Number.isInteger(e)&&(f=e)},t.shadow=v,t.string32=function(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)},t.stringToBytes=x,t.stringToPDFString=function(e){var t=e.length,r=[];if("þ"===e[0]&&"ÿ"===e[1])for(var n=2;n=l.WARNINGS&&console.log("Warning: ".concat(e))}function d(e){throw new Error(e)}function p(e,t){e||d(t)}function v(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!1}),r}var y=function(){function e(t){this.constructor===e&&d("Cannot initialize BaseException."),this.message=t,this.name=this.constructor.name}return e.prototype=new Error,e.constructor=e,e}();t.BaseException=y;var g=function(e){o(r,y);var t=u(r);function r(e,n){var i;return a(this,r),(i=t.call(this,e)).code=n,i}return r}();t.PasswordException=g;var m=function(e){o(r,y);var t=u(r);function r(e,n){var i;return a(this,r),(i=t.call(this,e)).details=n,i}return r}();t.UnknownErrorException=m;var b=function(e){o(r,y);var t=u(r);function r(){return a(this,r),t.apply(this,arguments)}return r}();t.InvalidPDFException=b;var _=function(e){o(r,y);var t=u(r);function r(){return a(this,r),t.apply(this,arguments)}return r}();t.MissingPDFException=_;var A=function(e){o(r,y);var t=u(r);function r(e,n){var i;return a(this,r),(i=t.call(this,e)).status=n,i}return r}();t.UnexpectedResponseException=A;var S=function(e){o(r,y);var t=u(r);function r(){return a(this,r),t.apply(this,arguments)}return r}();t.FormatError=S;var w=function(e){o(r,y);var t=u(r);function r(){return a(this,r),t.apply(this,arguments)}return r}();t.AbortException=w;var k=/\x00/g;function x(e){p("string"==typeof e,"Invalid argument for stringToBytes");for(var t=e.length,r=new Uint8Array(t),n=0;ne[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}},{key:"intersect",value:function(t,r){function n(e,t){return e-t}var i=[t[0],t[2],r[0],r[2]].sort(n),a=[t[1],t[3],r[1],r[3]].sort(n),o=[];return t=e.normalizeRect(t),r=e.normalizeRect(r),i[0]===t[0]&&i[1]===r[0]||i[0]===r[0]&&i[1]===t[0]?(o[0]=i[1],o[2]=i[2],a[0]===t[1]&&a[1]===r[1]||a[0]===r[1]&&a[1]===t[1]?(o[1]=a[1],o[3]=a[2],o):null):null}}],(r=null)&&n(t.prototype,r),i&&n(t,i),e}();t.Util=E;var O=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];var F,L=(F="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",function(e,t){if(!(arguments.length>2&&void 0!==arguments[2]&&arguments[2])&&URL.createObjectURL){var r=new Blob([e],{type:t});return URL.createObjectURL(r)}for(var n="data:".concat(t,";base64,"),i=0,a=e.length;i>2]+F[(3&o)<<4|s>>4]+F[i+1>6:64]+F[i+21?!!arguments[1]:!this.contains(e);return this[t?"add":"remove"](e),t}),function(){if(a&&s){var e=window.history.pushState,t=window.history.replaceState;window.history.pushState=function(t,r,n){var i=void 0===n?[t,r]:[t,r,n];e.apply(this,i)},window.history.replaceState=function(e,r,n){var i=void 0===n?[e,r]:[e,r,n];t.apply(this,i)}}}(),String.prototype.startsWith||r(53),String.prototype.endsWith||r(64),String.prototype.includes||r(66),Array.prototype.includes||r(68),Array.from||r(76),Object.assign||r(98),Math.log2||(Math.log2=r(101)),Number.isNaN||(Number.isNaN=r(103)),Number.isInteger||(Number.isInteger=r(105)),Uint8Array.prototype.slice||r(108),globalThis.Promise&&globalThis.Promise.allSettled||(globalThis.Promise=r(113)),globalThis.URL=r(136),function(){var e=!1;if("undefined"!=typeof ReadableStream)try{new ReadableStream({start:function(e){e.close()}}),e=!0}catch(e){}e||(globalThis.ReadableStream=r(143).ReadableStream)}(),globalThis.Map&&globalThis.Map.prototype.entries||(globalThis.Map=r(144)),globalThis.Set&&globalThis.Set.prototype.entries||(globalThis.Set=r(151)),globalThis.WeakMap||(globalThis.WeakMap=r(153)),globalThis.WeakSet||(globalThis.WeakSet=r(159)),String.prototype.codePointAt||r(161),String.fromCodePoint||(String.fromCodePoint=r(163)),globalThis.Symbol||r(165),String.prototype.padStart||r(188),String.prototype.padEnd||r(193),Object.values||(Object.values=r(195))}},function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.isNodeJS=void 0;var i="object"===("undefined"==typeof process?"undefined":n(process))&&process+""=="[object process]"&&!process.versions.nw&&!process.versions.electron;t.isNodeJS=i},function(e,t,r){r(9),e.exports=r(11)},function(e,t,r){r(10)({global:!0},{globalThis:r(11)})},function(e,t,r){var n=r(11),i=r(12).f,a=r(26),o=r(29),s=r(30),u=r(40),c=r(52);e.exports=function(e,t){var r,l,f,h,d,p=e.target,v=e.global,y=e.stat;if(r=v?n:y?n[p]||s(p,{}):(n[p]||{}).prototype)for(l in t){if(h=t[l],f=e.noTargetGet?(d=i(r,l))&&d.value:r[l],!c(v?l:p+(y?".":"#")+l,e.forced)&&void 0!==f){if(typeof h==typeof f)continue;u(h,f)}(e.sham||f&&f.sham)&&a(h,"sham",!0),o(r,l,h,e)}}},function(e,t){var r=function(e){return e&&e.Math==Math&&e};e.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof global&&global)||Function("return this")()},function(e,t,r){var n=r(13),i=r(15),a=r(16),o=r(17),s=r(21),u=r(23),c=r(24),l=Object.getOwnPropertyDescriptor;t.f=n?l:function(e,t){if(e=o(e),t=s(t,!0),c)try{return l(e,t)}catch(e){}if(u(e,t))return a(!i.f.call(e,t),e[t])}},function(e,t,r){var n=r(14);e.exports=!n(function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,r){"use strict";var n={}.propertyIsEnumerable,i=Object.getOwnPropertyDescriptor,a=i&&!n.call({1:2},1);t.f=a?function(e){var t=i(this,e);return!!t&&t.enumerable}:n},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,r){var n=r(18),i=r(20);e.exports=function(e){return n(i(e))}},function(e,t,r){var n=r(14),i=r(19),a="".split;e.exports=n(function(){return!Object("z").propertyIsEnumerable(0)})?function(e){return"String"==i(e)?a.call(e,""):Object(e)}:Object},function(e,t){var r={}.toString;e.exports=function(e){return r.call(e).slice(8,-1)}},function(e,t){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,r){var n=r(22);e.exports=function(e,t){if(!n(e))return e;var r,i;if(t&&"function"==typeof(r=e.toString)&&!n(i=r.call(e)))return i;if("function"==typeof(r=e.valueOf)&&!n(i=r.call(e)))return i;if(!t&&"function"==typeof(r=e.toString)&&!n(i=r.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t){var r={}.hasOwnProperty;e.exports=function(e,t){return r.call(e,t)}},function(e,t,r){var n=r(13),i=r(14),a=r(25);e.exports=!n&&!i(function(){return 7!=Object.defineProperty(a("div"),"a",{get:function(){return 7}}).a})},function(e,t,r){var n=r(11),i=r(22),a=n.document,o=i(a)&&i(a.createElement);e.exports=function(e){return o?a.createElement(e):{}}},function(e,t,r){var n=r(13),i=r(27),a=r(16);e.exports=n?function(e,t,r){return i.f(e,t,a(1,r))}:function(e,t,r){return e[t]=r,e}},function(e,t,r){var n=r(13),i=r(24),a=r(28),o=r(21),s=Object.defineProperty;t.f=n?s:function(e,t,r){if(a(e),t=o(t,!0),a(r),i)try{return s(e,t,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(e[t]=r.value),e}},function(e,t,r){var n=r(22);e.exports=function(e){if(!n(e))throw TypeError(String(e)+" is not an object");return e}},function(e,t,r){var n=r(11),i=r(26),a=r(23),o=r(30),s=r(31),u=r(33),c=u.get,l=u.enforce,f=String(String).split("String");(e.exports=function(e,t,r,s){var u=!!s&&!!s.unsafe,c=!!s&&!!s.enumerable,h=!!s&&!!s.noTargetGet;"function"==typeof r&&("string"!=typeof t||a(r,"name")||i(r,"name",t),l(r).source=f.join("string"==typeof t?t:"")),e!==n?(u?!h&&e[t]&&(c=!0):delete e[t],c?e[t]=r:i(e,t,r)):c?e[t]=r:o(t,r)})(Function.prototype,"toString",function(){return"function"==typeof this&&c(this).source||s(this)})},function(e,t,r){var n=r(11),i=r(26);e.exports=function(e,t){try{i(n,e,t)}catch(r){n[e]=t}return t}},function(e,t,r){var n=r(32),i=Function.toString;"function"!=typeof n.inspectSource&&(n.inspectSource=function(e){return i.call(e)}),e.exports=n.inspectSource},function(e,t,r){var n=r(11),i=r(30),a=n["__core-js_shared__"]||i("__core-js_shared__",{});e.exports=a},function(e,t,r){var n,i,a,o=r(34),s=r(11),u=r(22),c=r(26),l=r(23),f=r(35),h=r(39),d=s.WeakMap;if(o){var p=new d,v=p.get,y=p.has,g=p.set;n=function(e,t){return g.call(p,e,t),t},i=function(e){return v.call(p,e)||{}},a=function(e){return y.call(p,e)}}else{var m=f("state");h[m]=!0,n=function(e,t){return c(e,m,t),t},i=function(e){return l(e,m)?e[m]:{}},a=function(e){return l(e,m)}}e.exports={set:n,get:i,has:a,enforce:function(e){return a(e)?i(e):n(e,{})},getterFor:function(e){return function(t){var r;if(!u(t)||(r=i(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return r}}}},function(e,t,r){var n=r(11),i=r(31),a=n.WeakMap;e.exports="function"==typeof a&&/native code/.test(i(a))},function(e,t,r){var n=r(36),i=r(38),a=n("keys");e.exports=function(e){return a[e]||(a[e]=i(e))}},function(e,t,r){var n=r(37),i=r(32);(e.exports=function(e,t){return i[e]||(i[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.6.5",mode:n?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(e,t){e.exports=!1},function(e,t){var r=0,n=Math.random();e.exports=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++r+n).toString(36)}},function(e,t){e.exports={}},function(e,t,r){var n=r(23),i=r(41),a=r(12),o=r(27);e.exports=function(e,t){for(var r=i(t),s=o.f,u=a.f,c=0;cu;)n(s,r=t[u++])&&(~a(c,r)||c.push(r));return c}},function(e,t,r){var n=r(17),i=r(47),a=r(49),o=function(e){return function(t,r,o){var s,u=n(t),c=i(u.length),l=a(o,c);if(e&&r!=r){for(;c>l;)if((s=u[l++])!=s)return!0}else for(;c>l;l++)if((e||l in u)&&u[l]===r)return e||l||0;return!e&&-1}};e.exports={includes:o(!0),indexOf:o(!1)}},function(e,t,r){var n=r(48),i=Math.min;e.exports=function(e){return e>0?i(n(e),9007199254740991):0}},function(e,t){var r=Math.ceil,n=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?n:r)(e)}},function(e,t,r){var n=r(48),i=Math.max,a=Math.min;e.exports=function(e,t){var r=n(e);return r<0?i(r+t,0):a(r,t)}},function(e,t){e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,r){var n=r(14),i=/#|\.prototype\./,a=function(e,t){var r=s[o(e)];return r==c||r!=u&&("function"==typeof t?n(t):!!t)},o=a.normalize=function(e){return String(e).replace(i,".").toLowerCase()},s=a.data={},u=a.NATIVE="N",c=a.POLYFILL="P";e.exports=a},function(e,t,r){r(54);var n=r(61);e.exports=n("String","startsWith")},function(e,t,r){"use strict";var n,i=r(10),a=r(12).f,o=r(47),s=r(55),u=r(20),c=r(60),l=r(37),f="".startsWith,h=Math.min,d=c("startsWith");i({target:"String",proto:!0,forced:!!(l||d||(n=a(String.prototype,"startsWith"),!n||n.writable))&&!d},{startsWith:function(e){var t=String(u(this));s(e);var r=o(h(arguments.length>1?arguments[1]:void 0,t.length)),n=String(e);return f?f.call(t,n,r):t.slice(r,r+n.length)===n}})},function(e,t,r){var n=r(56);e.exports=function(e){if(n(e))throw TypeError("The method doesn't accept regular expressions");return e}},function(e,t,r){var n=r(22),i=r(19),a=r(57)("match");e.exports=function(e){var t;return n(e)&&(void 0!==(t=e[a])?!!t:"RegExp"==i(e))}},function(e,t,r){var n=r(11),i=r(36),a=r(23),o=r(38),s=r(58),u=r(59),c=i("wks"),l=n.Symbol,f=u?l:l&&l.withoutSetter||o;e.exports=function(e){return a(c,e)||(s&&a(l,e)?c[e]=l[e]:c[e]=f("Symbol."+e)),c[e]}},function(e,t,r){var n=r(14);e.exports=!!Object.getOwnPropertySymbols&&!n(function(){return!String(Symbol())})},function(e,t,r){var n=r(58);e.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(e,t,r){var n=r(57)("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[n]=!1,"/./"[e](t)}catch(e){}}return!1}},function(e,t,r){var n=r(11),i=r(62),a=Function.call;e.exports=function(e,t,r){return i(a,n[e].prototype[t],r)}},function(e,t,r){var n=r(63);e.exports=function(e,t,r){if(n(e),void 0===t)return e;switch(r){case 0:return function(){return e.call(t)};case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,i){return e.call(t,r,n,i)}}return function(){return e.apply(t,arguments)}}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e}},function(e,t,r){r(65);var n=r(61);e.exports=n("String","endsWith")},function(e,t,r){"use strict";var n,i=r(10),a=r(12).f,o=r(47),s=r(55),u=r(20),c=r(60),l=r(37),f="".endsWith,h=Math.min,d=c("endsWith");i({target:"String",proto:!0,forced:!!(l||d||(n=a(String.prototype,"endsWith"),!n||n.writable))&&!d},{endsWith:function(e){var t=String(u(this));s(e);var r=arguments.length>1?arguments[1]:void 0,n=o(t.length),i=void 0===r?n:h(o(r),n),a=String(e);return f?f.call(t,a,i):t.slice(i-a.length,i)===a}})},function(e,t,r){r(67);var n=r(61);e.exports=n("String","includes")},function(e,t,r){"use strict";var n=r(10),i=r(55),a=r(20);n({target:"String",proto:!0,forced:!r(60)("includes")},{includes:function(e){return!!~String(a(this)).indexOf(i(e),arguments.length>1?arguments[1]:void 0)}})},function(e,t,r){r(69);var n=r(61);e.exports=n("Array","includes")},function(e,t,r){"use strict";var n=r(10),i=r(46).includes,a=r(70);n({target:"Array",proto:!0,forced:!r(75)("indexOf",{ACCESSORS:!0,1:0})},{includes:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}}),a("includes")},function(e,t,r){var n=r(57),i=r(71),a=r(27),o=n("unscopables"),s=Array.prototype;null==s[o]&&a.f(s,o,{configurable:!0,value:i(null)}),e.exports=function(e){s[o][e]=!0}},function(e,t,r){var n,i=r(28),a=r(72),o=r(50),s=r(39),u=r(74),c=r(25),l=r(35),f=l("IE_PROTO"),h=function(){},d=function(e){return" - - - - - -
- -
-
-
- - - -
-
-
-
-
- - -
- -
- -
- - - - - - - - - - - - - - - - - -
-
-
- - -
- - - -
-
- - - - \ No newline at end of file diff --git a/public/workspace/content/assets/pdfjs/web/viewer.js b/public/workspace/content/assets/pdfjs/web/viewer.js deleted file mode 100644 index 07bc5f0..0000000 --- a/public/workspace/content/assets/pdfjs/web/viewer.js +++ /dev/null @@ -1 +0,0 @@ -!function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";var i,r;function a(){var e={appContainer:document.body,mainContainer:document.getElementById("viewerContainer"),viewerContainer:document.getElementById("viewer"),eventBus:null,toolbar:{container:document.getElementById("toolbarViewer"),numPages:document.getElementById("numPages"),pageNumber:document.getElementById("pageNumber"),scaleSelectContainer:document.getElementById("scaleSelectContainer"),scaleSelect:document.getElementById("scaleSelect"),customScaleOption:document.getElementById("customScaleOption"),previous:document.getElementById("previous"),next:document.getElementById("next"),zoomIn:document.getElementById("zoomIn"),zoomOut:document.getElementById("zoomOut"),viewFind:document.getElementById("viewFind"),openFile:document.getElementById("openFile"),print:document.getElementById("print"),presentationModeButton:document.getElementById("presentationMode"),download:document.getElementById("download"),viewBookmark:document.getElementById("viewBookmark")},secondaryToolbar:{toolbar:document.getElementById("secondaryToolbar"),toggleButton:document.getElementById("secondaryToolbarToggle"),toolbarButtonContainer:document.getElementById("secondaryToolbarButtonContainer"),presentationModeButton:document.getElementById("secondaryPresentationMode"),openFileButton:document.getElementById("secondaryOpenFile"),printButton:document.getElementById("secondaryPrint"),downloadButton:document.getElementById("secondaryDownload"),viewBookmarkButton:document.getElementById("secondaryViewBookmark"),firstPageButton:document.getElementById("firstPage"),lastPageButton:document.getElementById("lastPage"),pageRotateCwButton:document.getElementById("pageRotateCw"),pageRotateCcwButton:document.getElementById("pageRotateCcw"),cursorSelectToolButton:document.getElementById("cursorSelectTool"),cursorHandToolButton:document.getElementById("cursorHandTool"),scrollVerticalButton:document.getElementById("scrollVertical"),scrollHorizontalButton:document.getElementById("scrollHorizontal"),scrollWrappedButton:document.getElementById("scrollWrapped"),spreadNoneButton:document.getElementById("spreadNone"),spreadOddButton:document.getElementById("spreadOdd"),spreadEvenButton:document.getElementById("spreadEven"),documentPropertiesButton:document.getElementById("documentProperties")},fullscreen:{contextFirstPage:document.getElementById("contextFirstPage"),contextLastPage:document.getElementById("contextLastPage"),contextPageRotateCw:document.getElementById("contextPageRotateCw"),contextPageRotateCcw:document.getElementById("contextPageRotateCcw")},sidebar:{outerContainer:document.getElementById("outerContainer"),viewerContainer:document.getElementById("viewerContainer"),toggleButton:document.getElementById("sidebarToggle"),thumbnailButton:document.getElementById("viewThumbnail"),outlineButton:document.getElementById("viewOutline"),attachmentsButton:document.getElementById("viewAttachments"),thumbnailView:document.getElementById("thumbnailView"),outlineView:document.getElementById("outlineView"),attachmentsView:document.getElementById("attachmentsView")},sidebarResizer:{outerContainer:document.getElementById("outerContainer"),resizer:document.getElementById("sidebarResizer")},findBar:{bar:document.getElementById("findbar"),toggleButton:document.getElementById("viewFind"),findField:document.getElementById("findInput"),highlightAllCheckbox:document.getElementById("findHighlightAll"),caseSensitiveCheckbox:document.getElementById("findMatchCase"),entireWordCheckbox:document.getElementById("findEntireWord"),findMsg:document.getElementById("findMsg"),findResultsCount:document.getElementById("findResultsCount"),findPreviousButton:document.getElementById("findPrevious"),findNextButton:document.getElementById("findNext")},passwordOverlay:{overlayName:"passwordOverlay",container:document.getElementById("passwordOverlay"),label:document.getElementById("passwordText"),input:document.getElementById("password"),submitButton:document.getElementById("passwordSubmit"),cancelButton:document.getElementById("passwordCancel")},documentProperties:{overlayName:"documentPropertiesOverlay",container:document.getElementById("documentPropertiesOverlay"),closeButton:document.getElementById("documentPropertiesClose"),fields:{fileName:document.getElementById("fileNameField"),fileSize:document.getElementById("fileSizeField"),title:document.getElementById("titleField"),author:document.getElementById("authorField"),subject:document.getElementById("subjectField"),keywords:document.getElementById("keywordsField"),creationDate:document.getElementById("creationDateField"),modificationDate:document.getElementById("modificationDateField"),creator:document.getElementById("creatorField"),producer:document.getElementById("producerField"),version:document.getElementById("versionField"),pageCount:document.getElementById("pageCountField"),pageSize:document.getElementById("pageSizeField"),linearized:document.getElementById("linearizedField")}},errorWrapper:{container:document.getElementById("errorWrapper"),errorMessage:document.getElementById("errorMessage"),closeButton:document.getElementById("errorClose"),errorMoreInfo:document.getElementById("errorMoreInfo"),moreInfoButton:document.getElementById("errorShowMore"),lessInfoButton:document.getElementById("errorShowLess")},printContainer:document.getElementById("printContainer"),openFileInputName:"fileInput",debuggerScriptPath:"./debugger.js"};window.PDFViewerApplication=i.PDFViewerApplication,window.PDFViewerApplicationOptions=r.AppOptions;var t=document.createEvent("CustomEvent");t.initCustomEvent("webviewerloaded",!0,!0,{source:window});try{parent.document.dispatchEvent(t)}catch(e){console.error("webviewerloaded: ".concat(e)),document.dispatchEvent(t)}i.PDFViewerApplication.run(e)}i=n(1),r=n(6),n(36),n(41),"interactive"===document.readyState||"complete"===document.readyState?a():document.addEventListener("DOMContentLoaded",a,!0)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PDFPrintServiceFactory=t.DefaultExternalServices=t.PDFViewerApplication=void 0;var i,r=(i=n(2))&&i.__esModule?i:{default:i},a=n(5),o=n(6),s=n(8),u=n(9),l=n(11),c=n(12),d=n(13),h=n(14),f=n(15),p=n(16),v=n(17),g=n(18),m=n(20),y=n(21),b=n(22),w=n(23),_=n(24),P=n(25),S=n(27),k=n(32),E=n(34),L=n(35);function C(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=I(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function x(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],i=!0,r=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(i=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);i=!0);}catch(e){r=!0,a=e}finally{try{i||null==s.return||s.return()}finally{if(r)throw a}}return n}(e,t)||I(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function I(e,t){if(e){if("string"==typeof e)return T(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?T(e,t):void 0}}function T(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n0&&t0&&t>a.MIN_SCALE);this.pdfViewer.currentScaleValue=t}},zoomReset:function(){this.pdfViewer.isInPresentationMode||(this.pdfViewer.currentScaleValue=a.DEFAULT_SCALE_VALUE)},get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0},get page(){return this.pdfViewer.currentPageNumber},set page(e){this.pdfViewer.currentPageNumber=e},get printing(){return!!this.printService},get supportsPrinting(){return Ve.instance.supportsPrinting},get supportsFullscreen(){var e,t=document.documentElement;return e=!!(t.requestFullscreen||t.mozRequestFullScreen||t.webkitRequestFullScreen||t.msRequestFullscreen),!1!==document.fullscreenEnabled&&!1!==document.mozFullScreenEnabled&&!1!==document.webkitFullscreenEnabled&&!1!==document.msFullscreenEnabled||(e=!1),(0,s.shadow)(this,"supportsFullscreen",e)},get supportsIntegratedFind(){return this.externalServices.supportsIntegratedFind},get supportsDocumentFonts(){return this.externalServices.supportsDocumentFonts},get loadingBar(){var e=new a.ProgressBar("#loadingBar");return(0,s.shadow)(this,"loadingBar",e)},get supportedMouseWheelZoomModifierKeys(){return this.externalServices.supportedMouseWheelZoomModifierKeys},initPassiveLoading:function(){throw new Error("Not implemented: initPassiveLoading")},setTitleUsingUrl:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.url=e,this.baseUrl=e.split("#")[0];var t=(0,a.getPDFFileNameFromURL)(e,"");if(!t)try{t=decodeURIComponent((0,s.getFilenameFromUrl)(e))||e}catch(n){t=e}this.setTitle(t)},setTitle:function(e){this.isViewerEmbedded||(document.title=e)},close:function(){var e=this;return M(r.default.mark(function t(){var n;return r.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e.appConfig.errorWrapper.container.setAttribute("hidden","true"),e.pdfLoadingTask){t.next=4;break}return t.abrupt("return",void 0);case 4:return n=e.pdfLoadingTask.destroy(),e.pdfLoadingTask=null,e.pdfDocument&&(e.pdfDocument=null,e.pdfThumbnailViewer.setDocument(null),e.pdfViewer.setDocument(null),e.pdfLinkService.setDocument(null),e.pdfDocumentProperties.setDocument(null)),Z(),e.store=null,e.isInitialViewSet=!1,e.downloadComplete=!1,e.url="",e.baseUrl="",e.contentDispositionFilename=null,e.pdfSidebar.reset(),e.pdfOutlineViewer.reset(),e.pdfAttachmentViewer.reset(),e.pdfHistory&&e.pdfHistory.reset(),e.findBar&&e.findBar.reset(),e.toolbar.reset(),e.secondaryToolbar.reset(),"undefined"!=typeof PDFBug&&PDFBug.cleanup(),t.abrupt("return",n);case 23:case"end":return t.stop()}},t)}))()},open:function(e,t){var n=this;return M(r.default.mark(function i(){var a,u,l,c,d,h,f,p,v;return r.default.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(!n.pdfLoadingTask){i.next=3;break}return i.next=3,n.close();case 3:for(u in a=o.AppOptions.getAll(o.OptionKind.WORKER))s.GlobalWorkerOptions[u]=a[u];for(d in l=Object.create(null),"string"==typeof e?(n.setTitleUsingUrl(e),l.url=e):e&&"byteLength"in e?l.data=e:e.url&&e.originalUrl&&(n.setTitleUsingUrl(e.originalUrl),l.url=e.url),c=o.AppOptions.getAll(o.OptionKind.API))h=c[d],l[d]=h;if(t)for(f in t)p=t[f],"length"===f&&n.pdfDocumentProperties.setFileSize(p),l[f]=p;return v=(0,s.getDocument)(l),n.pdfLoadingTask=v,v.onPassword=function(e,t){n.pdfLinkService.externalLinkEnabled=!1,n.passwordPrompt.setUpdateCallback(e,t),n.passwordPrompt.open()},v.onProgress=function(e){var t=e.loaded,i=e.total;n.progress(t/i)},v.onUnsupportedFeature=n.fallback.bind(n),i.abrupt("return",v.promise.then(function(e){n.load(e)},function(e){if(v===n.pdfLoadingTask){var t=e&&e.message;return(e instanceof s.InvalidPDFException?n.l10n.get("invalid_file_error",null,"Invalid or corrupted PDF file."):e instanceof s.MissingPDFException?n.l10n.get("missing_file_error",null,"Missing PDF file."):e instanceof s.UnexpectedResponseException?n.l10n.get("unexpected_response_error",null,"Unexpected server response."):n.l10n.get("loading_error",null,"An error occurred while loading the PDF.")).then(function(i){throw n.error(i,{message:t}),e})}}));case 16:case"end":return i.stop()}},i)}))()},download:function(){var e=this;function t(){r.downloadUrl(n,i)}var n=this.baseUrl,i=this.contentDispositionFilename||(0,a.getPDFFileNameFromURL)(this.url),r=this.downloadManager;r.onerror=function(t){e.error("PDF failed to download: ".concat(t))},this.pdfDocument&&this.downloadComplete?this.pdfDocument.getData().then(function(e){var t=new Blob([e],{type:"application/pdf"});r.download(t,n,i)}).catch(t):t()},fallback:function(e){this.fellback||(this.fellback=!0,this.externalServices.fallback({featureId:e,url:this.baseUrl},function(e){e&&U.download()}))},error:function(e,t){var n=[this.l10n.get("error_version_info",{version:s.version||"?",build:s.build||"?"},"PDF.js v{{version}} (build: {{build}})")];t&&(n.push(this.l10n.get("error_message",{message:t.message},"Message: {{message}}")),t.stack?n.push(this.l10n.get("error_stack",{stack:t.stack},"Stack: {{stack}}")):(t.filename&&n.push(this.l10n.get("error_file",{file:t.filename},"File: {{file}}")),t.lineNumber&&n.push(this.l10n.get("error_line",{line:t.lineNumber},"Line: {{line}}"))));var i=this.appConfig.errorWrapper,r=i.container;r.removeAttribute("hidden"),i.errorMessage.textContent=e;var o=i.closeButton;o.onclick=function(){r.setAttribute("hidden","true")};var u=i.errorMoreInfo,l=i.moreInfoButton,c=i.lessInfoButton;l.onclick=function(){u.removeAttribute("hidden"),l.setAttribute("hidden","true"),c.removeAttribute("hidden"),u.style.height=u.scrollHeight+"px"},c.onclick=function(){u.setAttribute("hidden","true"),l.removeAttribute("hidden"),c.setAttribute("hidden","true")},l.oncontextmenu=a.noContextMenuHandler,c.oncontextmenu=a.noContextMenuHandler,o.oncontextmenu=a.noContextMenuHandler,l.removeAttribute("hidden"),c.setAttribute("hidden","true"),Promise.all(n).then(function(e){u.value=e.join("\n")})},progress:function(e){var t=this;if(!this.downloadComplete){var n=Math.round(100*e);if(n>this.loadingBar.percent||isNaN(n))this.loadingBar.percent=n,(this.pdfDocument?this.pdfDocument.loadingParams.disableAutoFetch:o.AppOptions.get("disableAutoFetch"))&&n&&(this.disableAutoFetchLoadingBarTimeout&&(clearTimeout(this.disableAutoFetchLoadingBarTimeout),this.disableAutoFetchLoadingBarTimeout=null),this.loadingBar.show(),this.disableAutoFetchLoadingBarTimeout=setTimeout(function(){t.loadingBar.hide(),t.disableAutoFetchLoadingBarTimeout=null},5e3))}},load:function(e){var t=this;this.pdfDocument=e,e.getDownloadInfo().then(function(){t.downloadComplete=!0,t.loadingBar.hide(),l.then(function(){t.eventBus.dispatch("documentloaded",{source:t})})});var n=e.getPageLayout().catch(function(){}),i=e.getPageMode().catch(function(){}),s=e.getOpenAction().catch(function(){});this.toolbar.setPagesCount(e.numPages,!1),this.secondaryToolbar.setPagesCount(e.numPages),this.pdfLinkService.setDocument(e,null),this.pdfDocumentProperties.setDocument(e,this.url);var u=this.pdfViewer;u.setDocument(e);var l=u.firstPagePromise,d=u.onePageRendered,h=u.pagesPromise;this.pdfThumbnailViewer.setDocument(e);var f=(this.store=new L.ViewHistory(e.fingerprint)).getMultiple({page:null,zoom:a.DEFAULT_SCALE_VALUE,scrollLeft:"0",scrollTop:"0",rotation:null,sidebarView:c.SidebarView.UNKNOWN,scrollMode:a.ScrollMode.UNKNOWN,spreadMode:a.SpreadMode.UNKNOWN}).catch(function(){return Object.create(null)});l.then(function(l){t.loadingBar.setWidth(t.appConfig.viewerContainer),Promise.all([a.animationStarted,f,n,i,s]).then(function(){var n=M(r.default.mark(function n(i){var s,l,d,f,p,v,g,m,y,b,w,_,P;return r.default.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return s=x(i,5),s[0],l=s[1],d=s[2],f=s[3],p=s[4],v=o.AppOptions.get("viewOnLoad"),t._initializePdfHistory({fingerprint:e.fingerprint,viewOnLoad:v,initialDest:p&&p.dest}),g=t.initialBookmark,m=o.AppOptions.get("defaultZoomValue"),y=m?"zoom=".concat(m):null,b=null,w=o.AppOptions.get("sidebarViewOnLoad"),_=o.AppOptions.get("scrollModeOnLoad"),P=o.AppOptions.get("spreadModeOnLoad"),l.page&&v!==D&&(y="page=".concat(l.page,"&zoom=").concat(m||l.zoom,",")+"".concat(l.scrollLeft,",").concat(l.scrollTop),b=parseInt(l.rotation,10),w===c.SidebarView.UNKNOWN&&(w=0|l.sidebarView),_===a.ScrollMode.UNKNOWN&&(_=0|l.scrollMode),P===a.SpreadMode.UNKNOWN&&(P=0|l.spreadMode)),f&&w===c.SidebarView.UNKNOWN&&(w=De(f)),d&&P===a.SpreadMode.UNKNOWN&&(P=Re(d)),t.setInitialView(y,{rotation:b,sidebarView:w,scrollMode:_,spreadMode:P}),t.eventBus.dispatch("documentinit",{source:t}),t.isViewerEmbedded||u.focus(),t._initializePermissions(e),n.next=19,Promise.race([h,new Promise(function(e){setTimeout(e,1e4)})]);case 19:if(g||y){n.next=21;break}return n.abrupt("return");case 21:if(!u.hasEqualPageSizes){n.next=23;break}return n.abrupt("return");case 23:t.initialBookmark=g,u.currentScaleValue=u.currentScaleValue,t.setInitialView(y);case 26:case"end":return n.stop()}},n)}));return function(e){return n.apply(this,arguments)}}()).catch(function(){t.setInitialView()}).then(function(){u.update()})}),h.then(function(){t._initializeAutoPrint(e,s)}),d.then(function(){e.getOutline().then(function(e){t.pdfOutlineViewer.render({outline:e})}),e.getAttachments().then(function(e){t.pdfAttachmentViewer.render({attachments:e})})}),this._initializePageLabels(e),this._initializeMetadata(e)},_initializeAutoPrint:function(e,t){var n=this;return M(r.default.mark(function i(){var o,u,l,c,d,h,f,p;return r.default.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,Promise.all([t,e.getJavaScript()]);case 2:if(o=i.sent,u=x(o,2),l=u[0],c=u[1],e===n.pdfDocument){i.next=8;break}return i.abrupt("return");case 8:if(d=!1,l&&"Print"===l.action&&(d=!0),!c){i.next=31;break}if(c.some(function(e){return!!e&&(console.warn("Warning: JavaScript is not supported"),n.fallback(s.UNSUPPORTED_FEATURES.javaScript),!0)}),d){i.next=31;break}h=C(c),i.prev=14,h.s();case 16:if((f=h.n()).done){i.next=23;break}if(!(p=f.value)||!a.AutoPrintRegExp.test(p)){i.next=21;break}return d=!0,i.abrupt("break",23);case 21:i.next=16;break;case 23:i.next=28;break;case 25:i.prev=25,i.t0=i.catch(14),h.e(i.t0);case 28:return i.prev=28,h.f(),i.finish(28);case 31:if(n.supportsPrinting){i.next=33;break}return i.abrupt("return");case 33:d&&setTimeout(function(){window.print()});case 34:case"end":return i.stop()}},i,null,[[14,25,28,31]])}))()},_initializeMetadata:function(e){var t=this;return M(r.default.mark(function n(){var i,a,o,u,l,c,d,h,f,p,v,g;return r.default.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,e.getMetadata();case 2:if(i=n.sent,a=i.info,o=i.metadata,u=i.contentDispositionFilename,e===t.pdfDocument){n.next=8;break}return n.abrupt("return");case 8:t.documentInfo=a,t.metadata=o,t.contentDispositionFilename=u,console.log("PDF ".concat(e.fingerprint," [").concat(a.PDFFormatVersion," ")+"".concat((a.Producer||"-").trim()," / ").concat((a.Creator||"-").trim(),"] ")+"(PDF.js: ".concat(s.version||"-")+"".concat(t.pdfViewer.enableWebGL?" [WebGL]":"",")")),(c=a&&a.Title)&&(l=c),(d=o&&o.get("dc:title"))&&("Untitled"===d||/[\uFFF0-\uFFFF]/g.test(d)||(l=d)),l?t.setTitle("".concat(l," - ").concat(u||document.title)):u&&t.setTitle(u),a.IsAcroFormPresent&&(console.warn("Warning: AcroForm/XFA is not supported"),t.fallback(s.UNSUPPORTED_FEATURES.forms)),h="other",["1.0","1.1","1.2","1.3","1.4","1.5","1.6","1.7","1.8","1.9","2.0","2.1","2.2","2.3"].includes(a.PDFFormatVersion)&&(h="v".concat(a.PDFFormatVersion.replace(".","_"))),f="other",p=["acrobat distiller","acrobat pdfwriter","adobe livecycle","adobe pdf library","adobe photoshop","ghostscript","tcpdf","cairo","dvipdfm","dvips","pdftex","pdfkit","itext","prince","quarkxpress","mac os x","microsoft","openoffice","oracle","luradocument","pdf-xchange","antenna house","aspose.cells","fpdf"],a.Producer&&(v=a.Producer.toLowerCase(),p.some(function(e){return!!v.includes(e)&&(f=e.replace(/[ .\-]/g,"_"),!0)})),g=null,a.IsAcroFormPresent&&(g=a.IsXFAPresent?"xfa":"acroform"),t.externalServices.reportTelemetry({type:"documentInfo",version:h,generator:f,formType:g});case 27:case"end":return n.stop()}},n)}))()},_initializePageLabels:function(e){var t=this;return M(r.default.mark(function n(){var i,a,s,u,l,c;return r.default.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,e.getPageLabels();case 2:if(i=n.sent,e===t.pdfDocument){n.next=5;break}return n.abrupt("return");case 5:if(i&&!o.AppOptions.get("disablePageLabels")){n.next=7;break}return n.abrupt("return");case 7:if((a=i.length)===t.pagesCount){n.next=11;break}return console.error("The number of Page Labels does not match the number of pages in the document."),n.abrupt("return");case 11:for(s=0;s1&&void 0!==arguments[1]?arguments[1]:{},o=r.rotation,s=r.sidebarView,u=r.scrollMode,l=r.spreadMode,c=function(e){(0,a.isValidRotation)(e)&&(i.pdfViewer.pagesRotation=e)};this.isInitialViewSet=!0,this.pdfSidebar.setInitialView(s),t=u,n=l,(0,a.isValidScrollMode)(t)&&(i.pdfViewer.scrollMode=t),(0,a.isValidSpreadMode)(n)&&(i.pdfViewer.spreadMode=n),this.initialBookmark?(c(this.initialRotation),delete this.initialRotation,this.pdfLinkService.setHash(this.initialBookmark),this.initialBookmark=null):e&&(c(o),this.pdfLinkService.setHash(e)),this.toolbar.setPageNumber(this.pdfViewer.currentPageNumber,this.pdfViewer.currentPageLabel),this.secondaryToolbar.setPageNumber(this.pdfViewer.currentPageNumber),this.pdfViewer.currentScaleValue||(this.pdfViewer.currentScaleValue=a.DEFAULT_SCALE_VALUE)},cleanup:function(){this.pdfDocument&&(this.pdfViewer.cleanup(),this.pdfThumbnailViewer.cleanup(),this.pdfViewer.renderer!==a.RendererType.SVG&&this.pdfDocument.cleanup())},forceRendering:function(){this.pdfRenderingQueue.printing=this.printing,this.pdfRenderingQueue.isThumbnailViewEnabled=this.pdfSidebar.isThumbnailViewVisible,this.pdfRenderingQueue.renderHighestPriority()},beforePrint:function(){var e=this;if(!this.printService)if(this.supportsPrinting)if(this.pdfViewer.pageViewsReady){var t=this.pdfViewer.getPagesOverview(),n=this.appConfig.printContainer,i=Ve.instance.createPrintService(this.pdfDocument,t,n,this.l10n);this.printService=i,this.forceRendering(),i.layout(),this.externalServices.reportTelemetry({type:"print"})}else this.l10n.get("printing_not_ready",null,"Warning: The PDF is not fully loaded for printing.").then(function(e){window.alert(e)});else this.l10n.get("printing_not_supported",null,"Warning: Printing is not fully supported by this browser.").then(function(t){e.error(t)})},afterPrint:function(){this.printService&&(this.printService.destroy(),this.printService=null),this.forceRendering()},rotatePages:function(e){if(this.pdfDocument){var t=(this.pdfViewer.pagesRotation+360+e)%360;this.pdfViewer.pagesRotation=t}},requestPresentationMode:function(){this.pdfPresentationMode&&this.pdfPresentationMode.request()},bindEvents:function(){var e=this.eventBus,t=this._boundEvents;t.beforePrint=this.beforePrint.bind(this),t.afterPrint=this.afterPrint.bind(this),e._on("resize",re),e._on("hashchange",ae),e._on("beforeprint",t.beforePrint),e._on("afterprint",t.afterPrint),e._on("pagerendered",X),e._on("updateviewarea",te),e._on("pagechanging",Ie),e._on("scalechanging",Ce),e._on("rotationchanging",xe),e._on("sidebarviewchanged",ee),e._on("pagemode",Y),e._on("namedaction",$),e._on("presentationmodechanged",J),e._on("presentationmode",oe),e._on("print",se),e._on("download",ue),e._on("firstpage",le),e._on("lastpage",ce),e._on("nextpage",de),e._on("previouspage",he),e._on("zoomin",fe),e._on("zoomout",pe),e._on("zoomreset",ve),e._on("pagenumberchanged",ge),e._on("scalechanged",me),e._on("rotatecw",ye),e._on("rotateccw",be),e._on("switchscrollmode",we),e._on("scrollmodechanged",ne),e._on("switchspreadmode",_e),e._on("spreadmodechanged",ie),e._on("documentproperties",Pe),e._on("find",Se),e._on("findfromurlhash",ke),e._on("updatefindmatchescount",Ee),e._on("updatefindcontrolstate",Le),e._on("fileinputchange",j),e._on("openfile",H)},bindWindowEvents:function(){var e=this.eventBus,t=this._boundEvents;t.windowResize=function(){e.dispatch("resize",{source:window})},t.windowHashChange=function(){e.dispatch("hashchange",{source:window,hash:document.location.hash.substring(1)})},t.windowBeforePrint=function(){e.dispatch("beforeprint",{source:window})},t.windowAfterPrint=function(){e.dispatch("afterprint",{source:window})},window.addEventListener("visibilitychange",Te),window.addEventListener("wheel",Be,{passive:!1}),window.addEventListener("click",Oe),window.addEventListener("keydown",Ae),window.addEventListener("resize",t.windowResize),window.addEventListener("hashchange",t.windowHashChange),window.addEventListener("beforeprint",t.windowBeforePrint),window.addEventListener("afterprint",t.windowAfterPrint)},unbindEvents:function(){var e=this.eventBus,t=this._boundEvents;e._off("resize",re),e._off("hashchange",ae),e._off("beforeprint",t.beforePrint),e._off("afterprint",t.afterPrint),e._off("pagerendered",X),e._off("updateviewarea",te),e._off("pagechanging",Ie),e._off("scalechanging",Ce),e._off("rotationchanging",xe),e._off("sidebarviewchanged",ee),e._off("pagemode",Y),e._off("namedaction",$),e._off("presentationmodechanged",J),e._off("presentationmode",oe),e._off("print",se),e._off("download",ue),e._off("firstpage",le),e._off("lastpage",ce),e._off("nextpage",de),e._off("previouspage",he),e._off("zoomin",fe),e._off("zoomout",pe),e._off("zoomreset",ve),e._off("pagenumberchanged",ge),e._off("scalechanged",me),e._off("rotatecw",ye),e._off("rotateccw",be),e._off("switchscrollmode",we),e._off("scrollmodechanged",ne),e._off("switchspreadmode",_e),e._off("spreadmodechanged",ie),e._off("documentproperties",Pe),e._off("find",Se),e._off("findfromurlhash",ke),e._off("updatefindmatchescount",Ee),e._off("updatefindcontrolstate",Le),e._off("fileinputchange",j),e._off("openfile",H),t.beforePrint=null,t.afterPrint=null},unbindWindowEvents:function(){var e=this._boundEvents;window.removeEventListener("visibilitychange",Te),window.removeEventListener("wheel",Be,{passive:!1}),window.removeEventListener("click",Oe),window.removeEventListener("keydown",Ae),window.removeEventListener("resize",e.windowResize),window.removeEventListener("hashchange",e.windowHashChange),window.removeEventListener("beforeprint",e.windowBeforePrint),window.removeEventListener("afterprint",e.windowAfterPrint),e.windowResize=null,e.windowHashChange=null,e.windowBeforePrint=null,e.windowAfterPrint=null}};t.PDFViewerApplication=U;var z,j,H,W=["null","http://mozilla.github.io","https://mozilla.github.io"];function q(){return G.apply(this,arguments)}function G(){return(G=M(r.default.mark(function e(){return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return s.GlobalWorkerOptions.workerSrc||(s.GlobalWorkerOptions.workerSrc=o.AppOptions.get("workerSrc")),e.abrupt("return",(0,s.loadScript)(s.PDFWorker.getWorkerSrc()));case 2:case"end":return e.stop()}},e)}))).apply(this,arguments)}function K(e){var t=U.appConfig;return(0,s.loadScript)(t.debuggerScriptPath).then(function(){PDFBug.enable(e),PDFBug.init({OPS:s.OPS},t.mainContainer)})}function Q(){var e,t=U.appConfig,n=document.location.search.substring(1),i=(0,a.parseQueryString)(n);e="file"in i?i.file:o.AppOptions.get("defaultUrl"),F(e);var r=document.createElement("input");r.id=t.openFileInputName,r.className="fileInput",r.setAttribute("type","file"),r.oncontextmenu=a.noContextMenuHandler,document.body.appendChild(r),window.File&&window.FileReader&&window.FileList&&window.Blob?r.value=null:(t.toolbar.openFile.setAttribute("hidden","true"),t.secondaryToolbar.openFileButton.setAttribute("hidden","true")),r.addEventListener("change",function(e){var t=e.target.files;t&&0!==t.length&&U.eventBus.dispatch("fileinputchange",{source:this,fileInput:e.target})}),t.mainContainer.addEventListener("dragover",function(e){e.preventDefault(),e.dataTransfer.dropEffect="move"}),t.mainContainer.addEventListener("drop",function(e){e.preventDefault();var t=e.dataTransfer.files;t&&0!==t.length&&U.eventBus.dispatch("fileinputchange",{source:this,fileInput:e.dataTransfer})}),U.supportsDocumentFonts||(o.AppOptions.set("disableFontFace",!0),U.l10n.get("web_fonts_disabled",null,"Web fonts are disabled: unable to use embedded PDF fonts.").then(function(e){console.warn(e)})),U.supportsPrinting||(t.toolbar.print.classList.add("hidden"),t.secondaryToolbar.printButton.classList.add("hidden")),U.supportsFullscreen||(t.toolbar.presentationModeButton.classList.add("hidden"),t.secondaryToolbar.presentationModeButton.classList.add("hidden")),U.supportsIntegratedFind&&t.toolbar.viewFind.classList.add("hidden"),t.mainContainer.addEventListener("transitionend",function(e){e.target===this&&U.eventBus.dispatch("resize",{source:this})},!0);try{z(e)}catch(e){U.l10n.get("loading_error",null,"An error occurred while loading the PDF.").then(function(t){U.error(t,e)})}}function Z(){var e=U.appConfig;e&&e.viewerContainer.classList.remove(A)}function X(e){var t=e.pageNumber,n=t-1,i=U.pdfViewer.getPageView(n);if(t===U.page&&U.toolbar.updateLoadingIndicatorState(!1),i){if(U.pdfSidebar.isThumbnailViewVisible)U.pdfThumbnailViewer.getThumbnail(n).setImage(i);"undefined"!=typeof Stats&&Stats.enabled&&i.stats&&Stats.add(t,i.stats),i.error&&U.l10n.get("rendering_error",null,"An error occurred while rendering the page.").then(function(e){U.error(e,i.error)}),U.externalServices.reportTelemetry({type:"pageInfo",timestamp:e.timestamp}),U.pdfDocument.getStats().then(function(e){U.externalServices.reportTelemetry({type:"documentStats",stats:e})})}}function Y(e){var t,n=e.mode;switch(n){case"thumbs":t=c.SidebarView.THUMBS;break;case"bookmarks":case"outline":t=c.SidebarView.OUTLINE;break;case"attachments":t=c.SidebarView.ATTACHMENTS;break;case"none":t=c.SidebarView.NONE;break;default:return void console.error('Invalid "pagemode" hash parameter: '+n)}U.pdfSidebar.switchView(t,!0)}function $(e){switch(e.action){case"GoToPage":U.appConfig.toolbar.pageNumber.select();break;case"Find":U.supportsIntegratedFind||U.findBar.toggle()}}function J(e){var t=e.active,n=e.switchInProgress,i=a.PresentationModeState.NORMAL;n?i=a.PresentationModeState.CHANGING:t&&(i=a.PresentationModeState.FULLSCREEN),U.pdfViewer.presentationModeState=i}function ee(e){U.pdfRenderingQueue.isThumbnailViewEnabled=U.pdfSidebar.isThumbnailViewVisible;var t=U.store;t&&U.isInitialViewSet&&t.set("sidebarView",e.view).catch(function(){})}function te(e){var t=e.location,n=U.store;n&&U.isInitialViewSet&&n.setMultiple({page:t.pageNumber,zoom:t.scale,scrollLeft:t.left,scrollTop:t.top,rotation:t.rotation}).catch(function(){});var i=U.pdfLinkService.getAnchorUrl(t.pdfOpenParams);U.appConfig.toolbar.viewBookmark.href=i,U.appConfig.secondaryToolbar.viewBookmarkButton.href=i;var r=U.pdfViewer.getPageView(U.page-1).renderingState!==l.RenderingStates.FINISHED;U.toolbar.updateLoadingIndicatorState(r)}function ne(e){var t=U.store;t&&U.isInitialViewSet&&t.set("scrollMode",e.mode).catch(function(){})}function ie(e){var t=U.store;t&&U.isInitialViewSet&&t.set("spreadMode",e.mode).catch(function(){})}function re(){var e=U.pdfDocument,t=U.pdfViewer;if(e){var n=t.currentScaleValue;"auto"!==n&&"page-fit"!==n&&"page-width"!==n||(t.currentScaleValue=n),t.update()}}function ae(e){var t=e.hash;t&&(U.isInitialViewSet?U.pdfHistory.popStateInProgress||U.pdfLinkService.setHash(t):U.initialBookmark=t)}function oe(){U.requestPresentationMode()}function se(){window.print()}function ue(){U.download()}function le(){U.pdfDocument&&(U.page=1)}function ce(){U.pdfDocument&&(U.page=U.pagesCount)}function de(){U.page++}function he(){U.page--}function fe(){U.zoomIn()}function pe(){U.zoomOut()}function ve(){U.zoomReset()}function ge(e){var t=U.pdfViewer;""!==e.value&&(t.currentPageLabel=e.value),e.value!==t.currentPageNumber.toString()&&e.value!==t.currentPageLabel&&U.toolbar.setPageNumber(t.currentPageNumber,t.currentPageLabel)}function me(e){U.pdfViewer.currentScaleValue=e.value}function ye(){U.rotatePages(90)}function be(){U.rotatePages(-90)}function we(e){U.pdfViewer.scrollMode=e.mode}function _e(e){U.pdfViewer.spreadMode=e.mode}function Pe(){U.pdfDocumentProperties.open()}function Se(e){U.findController.executeCommand("find"+e.type,{query:e.query,phraseSearch:e.phraseSearch,caseSensitive:e.caseSensitive,entireWord:e.entireWord,highlightAll:e.highlightAll,findPrevious:e.findPrevious})}function ke(e){U.findController.executeCommand("find",{query:e.query,phraseSearch:e.phraseSearch,caseSensitive:!1,entireWord:!1,highlightAll:!0,findPrevious:!1})}function Ee(e){var t=e.matchesCount;U.supportsIntegratedFind?U.externalServices.updateFindMatchesCount(t):U.findBar.updateResultsCount(t)}function Le(e){var t=e.state,n=e.previous,i=e.matchesCount;U.supportsIntegratedFind?U.externalServices.updateFindControlState({result:t,findPrevious:n,matchesCount:i}):U.findBar.updateUIState(t,n,i)}function Ce(e){U.toolbar.setPageScale(e.presetValue,e.scale),U.pdfViewer.update()}function xe(e){U.pdfThumbnailViewer.pagesRotation=e.pagesRotation,U.forceRendering(),U.pdfViewer.currentPageNumber=e.pageNumber}function Ie(e){var t=e.pageNumber;if(U.toolbar.setPageNumber(t,e.pageLabel||null),U.secondaryToolbar.setPageNumber(t),U.pdfSidebar.isThumbnailViewVisible&&U.pdfThumbnailViewer.scrollThumbnailIntoView(t),"undefined"!=typeof Stats&&Stats.enabled){var n=U.pdfViewer.getPageView(t-1);n&&n.stats&&Stats.add(t,n.stats)}}function Te(e){"visible"===document.visibilityState&&Me()}F=function(e){if(void 0!==e)try{var t=new URL(window.location.href).origin||"null";if(W.includes(t))return;var n=new URL(e,window.location.href);n.origin,n.protocol}catch(e){var i=e&&e.message;throw U.l10n.get("loading_error",null,"An error occurred while loading the PDF.").then(function(e){U.error(e,{message:i})}),e}},z=function(e){if(e&&0===e.lastIndexOf("file:",0)){U.setTitleUsingUrl(e);var t=new XMLHttpRequest;return t.onload=function(){U.open(new Uint8Array(t.response))},t.open("GET",e),t.responseType="arraybuffer",void t.send()}e&&U.open(e)},j=function(e){if(!U.pdfViewer||!U.pdfViewer.isInPresentationMode){var t=e.fileInput.files[0];if(o.AppOptions.get("disableCreateObjectURL")){U.setTitleUsingUrl(t.name);var n=new FileReader;n.onload=function(e){var t=e.target.result;U.open(new Uint8Array(t))},n.readAsArrayBuffer(t)}else{var i=URL.createObjectURL(t);t.name&&(i={url:i,originalUrl:t.name}),U.open(i)}var r=U.appConfig;r.toolbar.viewBookmark.setAttribute("hidden","true"),r.secondaryToolbar.viewBookmarkButton.setAttribute("hidden","true"),r.toolbar.download.setAttribute("hidden","true"),r.secondaryToolbar.downloadButton.setAttribute("hidden","true")}},H=function(e){var t=U.appConfig.openFileInputName;document.getElementById(t).click()};var Ne=null;function Me(){Ne&&clearTimeout(Ne),Ne=setTimeout(function(){Ne=null},O)}function Be(e){var t=U.pdfViewer,n=U.supportedMouseWheelZoomModifierKeys;if(!t.isInPresentationMode)if(e.ctrlKey&&n.ctrlKey||e.metaKey&&n.metaKey){if(e.preventDefault(),Ne||"hidden"===document.visibilityState)return;var i=t.currentScale,r=3*(0,a.normalizeWheelEventDelta)(e);r<0?U.zoomOut(-r):U.zoomIn(r);var o=t.currentScale;if(i!==o){var s=o/i-1,u=t.container.getBoundingClientRect(),l=e.clientX-u.left,c=e.clientY-u.top;t.container.scrollLeft+=l*s,t.container.scrollTop+=c*s}}else Me()}function Oe(e){if(U.secondaryToolbar.isOpen){var t=U.appConfig;(U.pdfViewer.containsElement(e.target)||t.toolbar.container.contains(e.target)&&e.target!==t.secondaryToolbar.toggleButton)&&U.secondaryToolbar.close()}}function Ae(e){if(!U.overlayManager.active){var t=!1,n=!1,i=(e.ctrlKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.metaKey?8:0),r=U.pdfViewer,a=r&&r.isInPresentationMode;if(1===i||8===i||5===i||12===i)switch(e.keyCode){case 70:U.supportsIntegratedFind||(U.findBar.open(),t=!0);break;case 71:if(!U.supportsIntegratedFind){var o=U.findController.state;o&&U.findController.executeCommand("findagain",{query:o.query,phraseSearch:o.phraseSearch,caseSensitive:o.caseSensitive,entireWord:o.entireWord,highlightAll:o.highlightAll,findPrevious:5===i||12===i}),t=!0}break;case 61:case 107:case 187:case 171:a||U.zoomIn(),t=!0;break;case 173:case 109:case 189:a||U.zoomOut(),t=!0;break;case 48:case 96:a||(setTimeout(function(){U.zoomReset()}),t=!1);break;case 38:(a||U.page>1)&&(U.page=1,t=!0,n=!0);break;case 40:(a||U.page1)&&(U.page=1,t=!0,n=!0);break;case 35:(a||U.page0?U.page1&&U.page--,t=!0)}if(4===i)switch(e.keyCode){case 13:case 32:if(!a&&"page-fit"!==r.currentScaleValue)break;U.page>1&&U.page--,t=!0;break;case 82:U.rotatePages(-90)}t||a||(e.keyCode>=33&&e.keyCode<=40||32===e.keyCode&&"BUTTON"!==c)&&(n=!0),n&&!r.containsElement(l)&&r.focus(),t&&e.preventDefault()}}}function Re(e){switch(e){case"SinglePage":case"OneColumn":return a.SpreadMode.NONE;case"TwoColumnLeft":case"TwoPageLeft":return a.SpreadMode.ODD;case"TwoColumnRight":case"TwoPageRight":return a.SpreadMode.EVEN}return a.SpreadMode.NONE}function De(e){switch(e){case"UseNone":return c.SidebarView.NONE;case"UseThumbs":return c.SidebarView.THUMBS;case"UseOutlines":return c.SidebarView.OUTLINE;case"UseAttachments":return c.SidebarView.ATTACHMENTS}return c.SidebarView.NONE}var Ve={instance:{supportsPrinting:!1,createPrintService:function(){throw new Error("Not implemented: createPrintService")}}};t.PDFPrintServiceFactory=Ve},function(e,t,n){"use strict";e.exports=n(3)},function(e,t,n){"use strict";(function(e){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var n=function(e){var n,i=Object.prototype,r=i.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",u=a.toStringTag||"@@toStringTag";function l(e,t,n,i){var r=t&&t.prototype instanceof g?t:g,a=Object.create(r.prototype),o=new x(i||[]);return a._invoke=function(e,t,n){var i=d;return function(r,a){if(i===f)throw new Error("Generator is already running");if(i===p){if("throw"===r)throw a;return T()}for(n.method=r,n.arg=a;;){var o=n.delegate;if(o){var s=E(o,n);if(s){if(s===v)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===d)throw i=p,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=f;var u=c(e,t,n);if("normal"===u.type){if(i=n.done?p:h,u.arg===v)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(i=p,n.method="throw",n.arg=u.arg)}}}(e,n,o),a}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var d="suspendedStart",h="suspendedYield",f="executing",p="completed",v={};function g(){}function m(){}function y(){}var b={};b[o]=function(){return this};var w=Object.getPrototypeOf,_=w&&w(w(I([])));_&&_!==i&&r.call(_,o)&&(b=_);var P=y.prototype=g.prototype=Object.create(b);function S(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function k(e,n){var i;this._invoke=function(a,o){function s(){return new n(function(i,s){!function i(a,o,s,u){var l=c(e[a],e,o);if("throw"!==l.type){var d=l.arg,h=d.value;return h&&"object"===t(h)&&r.call(h,"__await")?n.resolve(h.__await).then(function(e){i("next",e,s,u)},function(e){i("throw",e,s,u)}):n.resolve(h).then(function(e){d.value=e,s(d)},function(e){return i("throw",e,s,u)})}u(l.arg)}(a,o,i,s)})}return i=i?i.then(s,s):s()}}function E(e,t){var i=e.iterator[t.method];if(i===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=n,E(e,t),"throw"===t.method))return v;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var r=c(i,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,v;var a=r.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=n),t.delegate=null,v):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,v)}function L(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function I(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function t(){for(;++i=0;--a){var o=this.tryEntries[a],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var u=r.call(o,"catchLoc"),l=r.call(o,"finallyLoc");if(u&&l){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),C(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var r=i.arg;C(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,i){return this.delegate={iterator:I(e),resultName:t,nextLoc:i},"next"===this.method&&(this.arg=n),v}},e}("object"===t(e)?e.exports:{});try{regeneratorRuntime=n}catch(e){Function("r","regeneratorRuntime = r")(n)}}).call(this,n(4)(e))},function(e,t,n){"use strict";e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isValidRotation=function(e){return Number.isInteger(e)&&e%90==0},t.isValidScrollMode=function(e){return Number.isInteger(e)&&Object.values(h).includes(e)&&e!==h.UNKNOWN},t.isValidSpreadMode=function(e){return Number.isInteger(e)&&Object.values(f).includes(e)&&e!==f.UNKNOWN},t.isPortraitOrientation=function(e){return e.width<=e.height},t.clamp=_,t.getPDFFileNameFromURL=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"document.pdf";if("string"!=typeof e)return t;if(function(e){var t=0,n=e.length;for(;t1?a[1]:null;n[decodeURIComponent(o)]=decodeURIComponent(s)}return n},t.backtrackBeforeAllVisibleElements=m,t.getVisibleElements=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=e.scrollTop,a=r+e.clientHeight,o=e.scrollLeft,s=o+e.clientWidth;var u=[],l=t.length,c=0===l?0:g(t,i?function(e){var t=e.div;return t.offsetLeft+t.clientLeft+t.clientWidth>o}:function(e){var t=e.div;return t.offsetTop+t.clientTop+t.clientHeight>r});c>0&&c=a&&(d=P);else if((i?v:y)>d)break;if(!(P<=r||y>=a||_<=o||v>=s)){var S=Math.max(0,r-y)+Math.max(0,P-a),k=Math.max(0,o-v)+Math.max(0,_-s),E=(w-S)*(b-k)*100/w/b|0;u.push({id:f.id,x:v,y:y,view:f,percent:E})}}var L=u[0],C=u[u.length-1];n&&u.sort(function(e,t){var n=e.percent-t.percent;return Math.abs(n)>.001?-n:e.id-t.id});return{first:L,last:C,views:u}},t.roundToDivide=function(e,t){var n=e%t;return 0===n?e:Math.round(e-n+t)},t.getPageSizeInches=function(e){var t=e.view,n=e.userUnit,i=e.rotate,r=(f=t,p=4,function(e){if(Array.isArray(e))return e}(f)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],i=!0,r=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(i=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);i=!0);}catch(e){r=!0,a=e}finally{try{i||null==s.return||s.return()}finally{if(r)throw a}}return n}}(f,p)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}(f,p)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=r[0],o=r[1],s=r[2],u=r[3],c=i%180!=0,d=(s-a)/72*n,h=(u-o)/72*n;var f,p;return{width:c?h:d,height:c?d:h}},t.approximateFraction=function(e){if(Math.floor(e)===e)return[e,1];var t=1/e;if(t>8)return[1,8];if(Math.floor(t)===t)return[1,t];var n,i=e>1?t:e,r=0,a=1,o=1,s=1;for(;;){var u=r+o,l=a+s;if(l>8)break;i<=u/l?(o=u,s=l):(r=u,a=l)}n=i-r/a2&&void 0!==arguments[2]&&arguments[2],i=e.offsetParent;if(!i)return void console.error("offsetParent is not set -- cannot scroll");var r=e.offsetTop+e.clientTop,a=e.offsetLeft+e.clientLeft;for(;i.clientHeight===i.scrollHeight&&i.clientWidth===i.scrollWidth||n&&"hidden"===getComputedStyle(i).overflow;)if(i.dataset._scaleY&&(r/=i.dataset._scaleY,a/=i.dataset._scaleX),r+=i.offsetTop,a+=i.offsetLeft,!(i=i.offsetParent))return;t&&(void 0!==t.top&&(r+=t.top),void 0!==t.left&&(a+=t.left,i.scrollLeft=a));i.scrollTop=r},t.watchScroll=function(e,t){var n=function(n){r||(r=window.requestAnimationFrame(function(){r=null;var n=e.scrollLeft,a=i.lastX;n!==a&&(i.right=n>a),i.lastX=n;var o=e.scrollTop,s=i.lastY;o!==s&&(i.down=o>s),i.lastY=o,t(i)}))},i={right:!0,down:!0,lastX:e.scrollLeft,lastY:e.scrollTop,_eventHandler:n},r=null;return e.addEventListener("scroll",n,!0),i},t.binarySearchFirstItem=g,t.normalizeWheelEventDelta=function(e){var t=Math.sqrt(e.deltaX*e.deltaX+e.deltaY*e.deltaY),n=Math.atan2(e.deltaY,e.deltaX);-.25*Math.PI=0))throw new Error("waitOnEventOrTimeout - invalid parameters.");function a(i){t instanceof w?t._off(n,o):t.removeEventListener(n,o),l&&clearTimeout(l),e(i)}var o=a.bind(null,y.EVENT);t instanceof w?t._on(n,o):t.addEventListener(n,o);var s=a.bind(null,y.TIMEOUT),l=setTimeout(s,r)})},t.moveToEndOfArray=function(e,t){for(var n=[],i=e.length,r=0,a=0;ae.length)&&(t=e.length);for(var n=0,i=new Array(t);n>1;t(e[r])?i=r:n=r+1}return n}function m(e,t,n){if(e<2)return e;var i=t[e].div,r=i.offsetTop+i.clientTop;r>=n&&(r=(i=t[e-1].div).offsetTop+i.clientTop);for(var a=e-2;a>=0&&!((i=t[a].div).offsetTop+i.clientTop+i.clientHeight<=r);--a)e=a;return e}t.NullL10n=v;var y={EVENT:"event",TIMEOUT:"timeout"};t.WaitOnType=y;var b=new Promise(function(e){window.requestAnimationFrame(e)});t.animationStarted=b;var w=function(){function e(t){a(this,e),this._listeners=Object.create(null)}return s(e,[{key:"on",value:function(e,t){this._on(e,t,{external:!0})}},{key:"off",value:function(e,t){this._off(e,t,{external:!0})}},{key:"dispatch",value:function(e){var t=this._listeners[e];if(t&&0!==t.length){var n,i=Array.prototype.slice.call(arguments,1);t.slice(0).forEach(function(e){var t=e.listener;if(e.external)return n||(n=[]),void n.push(t);t.apply(null,i)}),n&&(n.forEach(function(e){e.apply(null,i)}),n=null)}}},{key:"_on",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=this._listeners[e];i||(this._listeners[e]=i=[]),i.push({listener:t,external:!0===(n&&n.external)})}},{key:"_off",value:function(e,t){arguments.length>2&&void 0!==arguments[2]&&arguments[2];var n=this._listeners[e];if(n)for(var i=0,r=n.length;i1&&void 0!==arguments[1]?arguments[1]:{},i=n.height,r=n.width,o=n.units;a(this,e),this.visible=!0,this.div=document.querySelector(t+" .progress"),this.bar=this.div.parentNode,this.height=i||100,this.width=r||100,this.units=o||"%",this.div.style.height=this.height+this.units,this.percent=0}return s(e,[{key:"_updateBar",value:function(){if(this._indeterminate)return this.div.classList.add("indeterminate"),void(this.div.style.width=this.width+this.units);this.div.classList.remove("indeterminate");var e=this.width*this._percent/100;this.div.style.width=e+this.units}},{key:"setWidth",value:function(e){if(e){var t=e.parentNode.offsetWidth-e.offsetWidth;t>0&&(this.bar.style.width="calc(100% - ".concat(t,"px)"))}}},{key:"hide",value:function(){this.visible&&(this.visible=!1,this.bar.classList.add("hidden"),document.body.classList.remove("loadingInProgress"))}},{key:"show",value:function(){this.visible||(this.visible=!0,document.body.classList.add("loadingInProgress"),this.bar.classList.remove("hidden"))}},{key:"percent",get:function(){return this._percent},set:function(e){this._indeterminate=isNaN(e),this._percent=_(e,0,100),this._updateBar()}}]),e}();t.ProgressBar=P},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OptionKind=t.AppOptions=void 0;var i=n(7);function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:null,t=Object.create(null);for(var n in s){var i=s[n];if(e){if(0==(e&i.kind))continue;if(e===o.PREFERENCE){var a=i.value,l=r(a);if("boolean"===l||"string"===l||"number"===l&&Number.isInteger(a)){t[n]=a;continue}throw new Error("Invalid type for preference: ".concat(n))}}var c=u[n];t[n]=void 0!==c?c:i.compatibility||i.value}return t}},{key:"set",value:function(e,t){u[e]=t}},{key:"remove",value:function(e){delete u[e]}}],(n=null)&&a(t.prototype,n),i&&a(t,i),e}();t.AppOptions=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.viewerCompatibilityParams=void 0;var i=Object.create(null),r="undefined"!=typeof navigator&&navigator.userAgent||"",a="undefined"!=typeof navigator&&navigator.platform||"",o="undefined"!=typeof navigator&&navigator.maxTouchPoints||1,s=/Android/.test(r),u=/Trident/.test(r),l=/\b(iPad|iPhone|iPod)(?=;)/.test(r)||"MacIntel"===a&&o>1,c=/CriOS/.test(r);(u||c)&&(i.disableCreateObjectURL=!0),(l||s)&&(i.maxCanvasPixels=5242880);var d=Object.freeze(i);t.viewerCompatibilityParams=d},function(e,t,n){"use strict";var i;i="undefined"!=typeof window&&window["pdfjs-dist/build/pdf"]?window["pdfjs-dist/build/pdf"]:require("../build/pdf.js"),e.exports=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PDFCursorTools=t.CursorTool=void 0;var i=n(10);function r(e,t){for(var n=0;n9,o=window.chrome,s=o&&(o.webstore||o.app),u=/Apple/.test(navigator.vendor)&&/Version\/([6-9]\d*|[1-5]\d+)/.test(navigator.userAgent)},function(e,t,n){"use strict";function i(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:o.NONE;this.isInitialViewSet||(this.isInitialViewSet=!0,e!==o.NONE&&e!==o.UNKNOWN&&this._switchView(e,!0)||this._dispatchEvent())}},{key:"switchView",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._switchView(e,t)}},{key:"_switchView",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e!==this.active,i=!1;switch(e){case o.NONE:return!!this.isOpen&&(this.close(),!0);case o.THUMBS:this.isOpen&&n&&(i=!0);break;case o.OUTLINE:if(this.outlineButton.disabled)return!1;break;case o.ATTACHMENTS:if(this.attachmentsButton.disabled)return!1;break;default:return console.error('PDFSidebar._switchView: "'.concat(e,'" is not a valid view.')),!1}return this.active=e,this.thumbnailButton.classList.toggle("toggled",e===o.THUMBS),this.outlineButton.classList.toggle("toggled",e===o.OUTLINE),this.attachmentsButton.classList.toggle("toggled",e===o.ATTACHMENTS),this.thumbnailView.classList.toggle("hidden",e!==o.THUMBS),this.outlineView.classList.toggle("hidden",e!==o.OUTLINE),this.attachmentsView.classList.toggle("hidden",e!==o.ATTACHMENTS),t&&!this.isOpen?(this.open(),!0):(i&&(this._updateThumbnailViewer(),this._forceRendering()),n&&this._dispatchEvent(),this._hideUINotification(this.active),n)}},{key:"open",value:function(){this.isOpen||(this.isOpen=!0,this.toggleButton.classList.add("toggled"),this.outerContainer.classList.add("sidebarMoving","sidebarOpen"),this.active===o.THUMBS&&this._updateThumbnailViewer(),this._forceRendering(),this._dispatchEvent(),this._hideUINotification(this.active))}},{key:"close",value:function(){this.isOpen&&(this.isOpen=!1,this.toggleButton.classList.remove("toggled"),this.outerContainer.classList.add("sidebarMoving"),this.outerContainer.classList.remove("sidebarOpen"),this._forceRendering(),this._dispatchEvent())}},{key:"toggle",value:function(){this.isOpen?this.close():this.open()}},{key:"_dispatchEvent",value:function(){this.eventBus.dispatch("sidebarviewchanged",{source:this,view:this.visibleView})}},{key:"_forceRendering",value:function(){this.onToggled?this.onToggled():(this.pdfViewer.forceRendering(),this.pdfThumbnailViewer.forceRendering())}},{key:"_updateThumbnailViewer",value:function(){for(var e=this.pdfViewer,t=this.pdfThumbnailViewer,n=e.pagesCount,i=0;i2&&void 0!==s[2]?s[2]:null,a=s.length>3&&void 0!==s[3]&&s[3],t&&n&&(o=n.parentNode)){e.next=6;break}throw new Error("Not enough parameters.");case 6:if(!this._overlays[t]){e.next=8;break}throw new Error("The overlay is already registered.");case 8:this._overlays[t]={element:n,container:o,callerCloseMethod:i,canForceClose:a};case 9:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}()},{key:"unregister",value:function(){var e=o(r.default.mark(function e(t){return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._overlays[t]){e.next=4;break}throw new Error("The overlay does not exist.");case 4:if(this._active!==t){e.next=6;break}throw new Error("The overlay cannot be removed while it is active.");case 6:delete this._overlays[t];case 7:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"open",value:function(){var e=o(r.default.mark(function e(t){return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._overlays[t]){e.next=4;break}throw new Error("The overlay does not exist.");case 4:if(!this._active){e.next=14;break}if(!this._overlays[t].canForceClose){e.next=9;break}this._closeThroughCaller(),e.next=14;break;case 9:if(this._active!==t){e.next=13;break}throw new Error("The overlay is already active.");case 13:throw new Error("Another overlay is currently active.");case 14:this._active=t,this._overlays[this._active].element.classList.remove("hidden"),this._overlays[this._active].container.classList.remove("hidden"),window.addEventListener("keydown",this._keyDownBound);case 18:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"close",value:function(){var e=o(r.default.mark(function e(t){return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._overlays[t]){e.next=4;break}throw new Error("The overlay does not exist.");case 4:if(this._active){e.next=8;break}throw new Error("The overlay is currently not active.");case 8:if(this._active===t){e.next=10;break}throw new Error("Another overlay is currently active.");case 10:this._overlays[this._active].container.classList.add("hidden"),this._overlays[this._active].element.classList.add("hidden"),this._active=null,window.removeEventListener("keydown",this._keyDownBound);case 14:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"_keyDown",value:function(e){this._active&&27===e.keyCode&&(this._closeThroughCaller(),e.preventDefault())}},{key:"_closeThroughCaller",value:function(){this._overlays[this._active].callerCloseMethod&&this._overlays[this._active].callerCloseMethod(),this._active&&this.close(this._active)}},{key:"active",get:function(){return this._active}}])&&s(t.prototype,n),i&&s(t,i),e}();t.OverlayManager=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PasswordPrompt=void 0;var i=n(5),r=n(8);function a(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:i.NullL10n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.overlayName=t.overlayName,this.container=t.container,this.label=t.label,this.input=t.input,this.submitButton=t.submitButton,this.cancelButton=t.cancelButton,this.overlayManager=n,this.l10n=a,this.updateCallback=null,this.reason=null,this.submitButton.addEventListener("click",this.verify.bind(this)),this.cancelButton.addEventListener("click",this.close.bind(this)),this.input.addEventListener("keydown",function(e){13===e.keyCode&&r.verify()}),this.overlayManager.register(this.overlayName,this.container,this.close.bind(this),!0)}var t,n,o;return t=e,(n=[{key:"open",value:function(){var e=this;this.overlayManager.open(this.overlayName).then(function(){e.input.focus(),(e.reason===r.PasswordResponses.INCORRECT_PASSWORD?e.l10n.get("password_invalid",null,"Invalid password. Please try again."):e.l10n.get("password_label",null,"Enter the password to open this PDF file.")).then(function(t){e.label.textContent=t})})}},{key:"close",value:function(){var e=this;this.overlayManager.close(this.overlayName).then(function(){e.input.value=""})}},{key:"verify",value:function(){var e=this.input.value;e&&e.length>0&&(this.close(),this.updateCallback(e))}},{key:"setUpdateCallback",value:function(e,t){this.updateCallback=e,this.reason=t}}])&&a(t.prototype,n),o&&a(t,o),e}();t.PasswordPrompt=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PDFAttachmentViewer=void 0;var i=n(8);function r(e,t){for(var n=0;n0&&void 0!==arguments[0]&&arguments[0];this.attachments=null,this.container.textContent="",e||(this._renderedCapability=(0,i.createPromiseCapability)())}},{key:"_dispatchEvent",value:function(e){this._renderedCapability.resolve(),this.eventBus.dispatch("attachmentsloaded",{source:this,attachmentsCount:e})}},{key:"_bindPdfLink",value:function(e,t,n){var i,r=this;e.onclick=function(){var e;i||(i=URL.createObjectURL(new Blob([t],{type:"application/pdf"}))),e="?file="+encodeURIComponent(i+"#"+n);try{window.open(e)}catch(e){console.error("_bindPdfLink: ".concat(e)),URL.revokeObjectURL(i),i=null,r.downloadManager.downloadData(t,n,"application/pdf")}return!1}}},{key:"_bindLink",value:function(e,t,n){var i=this;e.onclick=function(){return i.downloadManager.downloadData(t,n,""),!1}}},{key:"render",value:function(e){var t=e.attachments,n=e.keepRenderedCapability,r=void 0!==n&&n,a=0;if(this.attachments&&this.reset(!0===r),this.attachments=t||null,t){var o=Object.keys(t).sort(function(e,t){return e.toLowerCase().localeCompare(t.toLowerCase())});a=o.length;for(var s=0;se.length)&&(t=e.length);for(var n=0,i=new Array(t);n3&&void 0!==arguments[3]?arguments[3]:o.NullL10n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.overlayName=a,this.fields=s,this.container=u,this.overlayManager=n,this.l10n=c,this._reset(),l.addEventListener("click",this.close.bind(this)),this.overlayManager.register(this.overlayName,this.container,this.close.bind(this)),i._on("pagechanging",function(e){r._currentPageNumber=e.pageNumber}),i._on("rotationchanging",function(e){r._pagesRotation=e.pagesRotation}),this._isNonMetricLocale=!0,c.getLanguage().then(function(e){r._isNonMetricLocale=h.includes(e)})}var t,n,i;return t=e,(n=[{key:"open",value:function(){var e=this,t=function(t){Object.defineProperty(e,"fieldData",{value:Object.freeze(t),writable:!1,enumerable:!0,configurable:!0})};Promise.all([this.overlayManager.open(this.overlayName),this._dataAvailableCapability.promise]).then(function(){var n=e._currentPageNumber,i=e._pagesRotation;e.fieldData&&n===e.fieldData._currentPageNumber&&i===e.fieldData._pagesRotation?e._updateUI():e.pdfDocument.getMetadata().then(function(t){var r=t.info,a=t.metadata,s=t.contentDispositionFilename;return Promise.all([r,a,s||(0,o.getPDFFileNameFromURL)(e.url),e._parseFileSize(e.maybeFileSize),e._parseDate(r.CreationDate),e._parseDate(r.ModDate),e.pdfDocument.getPage(n).then(function(t){return e._parsePageSize((0,o.getPageSizeInches)(t),i)}),e._parseLinearization(r.IsLinearized)])}).then(function(r){var a=l(r,8),o=a[0],s=(a[1],a[2]),u=a[3],c=a[4],d=a[5],h=a[6],f=a[7];return t({fileName:s,fileSize:u,title:o.Title,author:o.Author,subject:o.Subject,keywords:o.Keywords,creationDate:c,modificationDate:d,creator:o.Creator,producer:o.Producer,version:o.PDFFormatVersion,pageCount:e.pdfDocument.numPages,pageSize:h,linearized:f,_currentPageNumber:n,_pagesRotation:i}),e._updateUI(),e.pdfDocument.getDownloadInfo()}).then(function(t){var n=t.length;return e.maybeFileSize=n,e._parseFileSize(n)}).then(function(n){if(n!==e.fieldData.fileSize){var i=Object.assign(Object.create(null),e.fieldData);i.fileSize=n,t(i),e._updateUI()}})})}},{key:"close",value:function(){this.overlayManager.close(this.overlayName)}},{key:"setDocument",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.pdfDocument&&(this._reset(),this._updateUI(!0)),e&&(this.pdfDocument=e,this.url=t,this._dataAvailableCapability.resolve())}},{key:"setFileSize",value:function(e){Number.isInteger(e)&&e>0&&(this.maybeFileSize=e)}},{key:"_reset",value:function(){this.pdfDocument=null,this.url=null,this.maybeFileSize=0,delete this.fieldData,this._dataAvailableCapability=(0,a.createPromiseCapability)(),this._currentPageNumber=1,this._pagesRotation=0}},{key:"_updateUI",value:function(){if(!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.fieldData){if(this.overlayManager.active===this.overlayName)for(var e in this.fields){var t=this.fieldData[e];this.fields[e].textContent=t||0===t?t:"-"}}else for(var n in this.fields)this.fields[n].textContent="-"}},{key:"_parseFileSize",value:function(){var e=u(r.default.mark(function e(){var t,n,i=arguments;return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]?i[0]:0,n=t/1024){e.next=6;break}return e.abrupt("return",void 0);case 6:if(!(n<1024)){e.next=8;break}return e.abrupt("return",this.l10n.get("document_properties_kb",{size_kb:(+n.toPrecision(3)).toLocaleString(),size_b:t.toLocaleString()},"{{size_kb}} KB ({{size_b}} bytes)"));case 8:return e.abrupt("return",this.l10n.get("document_properties_mb",{size_mb:(+(n/1024).toPrecision(3)).toLocaleString(),size_b:t.toLocaleString()},"{{size_mb}} MB ({{size_b}} bytes)"));case 9:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"_parsePageSize",value:function(){var e=u(r.default.mark(function e(t,n){var i,a,s,u,c,d,h,g=this;return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return",void 0);case 2:return n%180!=0&&(t={width:t.height,height:t.width}),i=(0,o.isPortraitOrientation)(t),a={width:Math.round(100*t.width)/100,height:Math.round(100*t.height)/100},s={width:Math.round(25.4*t.width*10)/10,height:Math.round(25.4*t.height*10)/10},u=null,(c=v(a,i,f)||v(s,i,p))||Number.isInteger(s.width)&&Number.isInteger(s.height)||(d={width:25.4*t.width,height:25.4*t.height},h={width:Math.round(s.width),height:Math.round(s.height)},Math.abs(d.width-h.width)<.1&&Math.abs(d.height-h.height)<.1&&(c=v(h,i,p))&&(a={width:Math.round(h.width/25.4*100)/100,height:Math.round(h.height/25.4*100)/100},s=h)),c&&(u=this.l10n.get("document_properties_page_size_name_"+c.toLowerCase(),null,c)),e.abrupt("return",Promise.all([this._isNonMetricLocale?a:s,this.l10n.get("document_properties_page_size_unit_"+(this._isNonMetricLocale?"inches":"millimeters"),null,this._isNonMetricLocale?"in":"mm"),u,this.l10n.get("document_properties_page_size_orientation_"+(i?"portrait":"landscape"),null,i?"portrait":"landscape")]).then(function(e){var t=l(e,4),n=t[0],i=n.width,r=n.height,a=t[1],o=t[2],s=t[3];return g.l10n.get("document_properties_page_size_dimension_"+(o?"name_":"")+"string",{width:i.toLocaleString(),height:r.toLocaleString(),unit:a,name:o,orientation:s},"{{width}} × {{height}} {{unit}} ("+(o?"{{name}}, ":"")+"{{orientation}})")}));case 11:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}()},{key:"_parseDate",value:function(){var e=u(r.default.mark(function e(t){var n;return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=a.PDFDateString.toDateObject(t)){e.next=3;break}return e.abrupt("return",void 0);case 3:return e.abrupt("return",this.l10n.get("document_properties_date_string",{date:n.toLocaleDateString(),time:n.toLocaleTimeString()},"{{date}}, {{time}}"));case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"_parseLinearization",value:function(e){return this.l10n.get("document_properties_linearized_"+(e?"yes":"no"),null,e?"Yes":"No")}}])&&d(t.prototype,n),i&&d(t,i),e}();t.PDFDocumentProperties=g},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PDFFindBar=void 0;var i=n(18),r=n(5);function a(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:r.NullL10n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.opened=!1,this.bar=t.bar||null,this.toggleButton=t.toggleButton||null,this.findField=t.findField||null,this.highlightAll=t.highlightAllCheckbox||null,this.caseSensitive=t.caseSensitiveCheckbox||null,this.entireWord=t.entireWordCheckbox||null,this.findMsg=t.findMsg||null,this.findResultsCount=t.findResultsCount||null,this.findPreviousButton=t.findPreviousButton||null,this.findNextButton=t.findNextButton||null,this.eventBus=n,this.l10n=a,this.toggleButton.addEventListener("click",function(){i.toggle()}),this.findField.addEventListener("input",function(){i.dispatchEvent("")}),this.bar.addEventListener("keydown",function(e){switch(e.keyCode){case 13:e.target===i.findField&&i.dispatchEvent("again",e.shiftKey);break;case 27:i.close()}}),this.findPreviousButton.addEventListener("click",function(){i.dispatchEvent("again",!0)}),this.findNextButton.addEventListener("click",function(){i.dispatchEvent("again",!1)}),this.highlightAll.addEventListener("click",function(){i.dispatchEvent("highlightallchange")}),this.caseSensitive.addEventListener("click",function(){i.dispatchEvent("casesensitivitychange")}),this.entireWord.addEventListener("click",function(){i.dispatchEvent("entirewordchange")}),this.eventBus._on("resize",this._adjustWidth.bind(this))}var t,n,o;return t=e,(n=[{key:"reset",value:function(){this.updateUIState()}},{key:"dispatchEvent",value:function(e,t){this.eventBus.dispatch("find",{source:this,type:e,query:this.findField.value,phraseSearch:!0,caseSensitive:this.caseSensitive.checked,entireWord:this.entireWord.checked,highlightAll:this.highlightAll.checked,findPrevious:t})}},{key:"updateUIState",value:function(e,t,n){var r=this,a=!1,o="",s="";switch(e){case i.FindState.FOUND:break;case i.FindState.PENDING:s="pending";break;case i.FindState.NOT_FOUND:o=this.l10n.get("find_not_found",null,"Phrase not found"),a=!0;break;case i.FindState.WRAPPED:o=t?this.l10n.get("find_reached_top",null,"Reached top of document, continued from bottom"):this.l10n.get("find_reached_bottom",null,"Reached end of document, continued from top")}this.findField.classList.toggle("notFound",a),this.findField.setAttribute("data-status",s),Promise.resolve(o).then(function(e){r.findMsg.textContent=e,r._adjustWidth()}),this.updateResultsCount(n)}},{key:"updateResultsCount",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.current,i=void 0===n?0:n,r=t.total,a=void 0===r?0:r;if(this.findResultsCount){var o="";a>0&&(o=a>1e3?this.l10n.get("find_match_count_limit",{limit:1e3},"More than {{limit}} matches"):this.l10n.get("find_match_count",{current:i,total:a},"{{current}} of {{total}} match"+(1!==a?"es":""))),Promise.resolve(o).then(function(t){e.findResultsCount.textContent=t,e.findResultsCount.classList.toggle("hidden",!a),e._adjustWidth()})}}},{key:"open",value:function(){this.opened||(this.opened=!0,this.toggleButton.classList.add("toggled"),this.bar.classList.remove("hidden")),this.findField.select(),this.findField.focus(),this._adjustWidth()}},{key:"close",value:function(){this.opened&&(this.opened=!1,this.toggleButton.classList.remove("toggled"),this.bar.classList.add("hidden"),this.eventBus.dispatch("findbarclose",{source:this}))}},{key:"toggle",value:function(){this.opened?this.close():this.open()}},{key:"_adjustWidth",value:function(){this.opened&&(this.bar.classList.remove("wrapContainers"),this.bar.clientHeight>this.bar.firstElementChild.clientHeight&&this.bar.classList.add("wrapContainers"))}}])&&a(t.prototype,n),o&&a(t,o),e}();t.PDFFindBar=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PDFFindController=t.FindState=void 0;var i=n(8),r=n(19),a=n(5);function o(e,t){for(var n=0;n=1&&n<=i.pagesCount&&n!==i.page&&!i.isPageVisible(n);case"findhighlightallchange":return!1}return!0}},{key:"_prepareMatches",value:function(e,t,n){function i(t){var n=e[t],i=e[t+1];if(t=0;r--){var a=e[r];if(!a.skipped){if(a.match+a.matchLength=n.match+n.matchLength)return n.skipped=!0,!0}}return!1}e.sort(function(e,t){return e.match===t.match?e.matchLength-t.matchLength:e.match-t.match});for(var r=0,a=e.length;r0){var i=e.charCodeAt(t),a=e.charCodeAt(t-1);if((0,r.getCharacterType)(i)===(0,r.getCharacterType)(a))return!1}var o=t+n-1;if(o0&&(this._matchesCountTotal+=s,this._updateUIResultsCount())}}},{key:"_extractText",value:function(){var e=this;if(!(this._extractTextPromises.length>0))for(var t=Promise.resolve(),n=function(n,r){var a=(0,i.createPromiseCapability)();e._extractTextPromises[n]=a.promise,t=t.then(function(){return e._pdfDocument.getPage(n+1).then(function(e){return e.getTextContent({normalizeWhitespace:!0})}).then(function(t){for(var i=t.items,r=[],o=0,s=i.length;o0)return a.matchIdx=t?a.matchIdx-1:a.matchIdx+1,void this._updateMatch(!0);this._advanceOffsetPage(t)}this._nextPageMatch()}}else this._updateUIState(s.FOUND)}},{key:"_matchesReady",value:function(e){var t=this._offset,n=e.length,i=this._state.findPrevious;return n?(t.matchIdx=i?n-1:0,this._updateMatch(!0),!0):(this._advanceOffsetPage(i),!!(t.wrapped&&(t.matchIdx=null,this._pagesToSearch<0))&&(this._updateMatch(!1),!0))}},{key:"_nextPageMatch",value:function(){null!==this._resumePageIdx&&console.error("There can only be one pending page.");var e=null;do{var t=this._offset.pageIdx;if(!(e=this._pageMatches[t])){this._resumePageIdx=t;break}}while(!this._matchesReady(e))}},{key:"_advanceOffsetPage",value:function(e){var t=this._offset,n=this._linkService.pagesCount;t.pageIdx=e?t.pageIdx-1:t.pageIdx+1,t.matchIdx=null,this._pagesToSearch--,(t.pageIdx>=n||t.pageIdx<0)&&(t.pageIdx=e?n-1:0,t.wrapped=!0)}},{key:"_updateMatch",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=s.NOT_FOUND,n=this._offset.wrapped;if(this._offset.wrapped=!1,e){var i=this._selected.pageIdx;this._selected.pageIdx=this._offset.pageIdx,this._selected.matchIdx=this._offset.matchIdx,t=n?s.WRAPPED:s.FOUND,-1!==i&&i!==this._selected.pageIdx&&this._updatePage(i)}this._updateUIState(t,this._state.findPrevious),-1!==this._selected.pageIdx&&(this._scrollMatches=!0,this._updatePage(this._selected.pageIdx))}},{key:"_onFindBarClose",value:function(e){var t=this,n=this._pdfDocument;this._firstPageCapability.promise.then(function(){!t._pdfDocument||n&&t._pdfDocument!==n||(t._findTimeout&&(clearTimeout(t._findTimeout),t._findTimeout=null),t._resumePageIdx&&(t._resumePageIdx=null,t._dirtyMatch=!0),t._updateUIState(s.FOUND),t._highlightMatches=!1,t._updateAllPages())})}},{key:"_requestMatchesCount",value:function(){var e=this._selected,t=e.pageIdx,n=e.matchIdx,i=0,r=this._matchesCountTotal;if(-1!==n){for(var a=0;ar)&&(i=r=0),{current:i,total:r}}},{key:"_updateUIResultsCount",value:function(){this._eventBus.dispatch("updatefindmatchescount",{source:this,matchesCount:this._requestMatchesCount()})}},{key:"_updateUIState",value:function(e,t){this._eventBus.dispatch("updatefindcontrolstate",{source:this,state:e,previous:t,matchesCount:this._requestMatchesCount()})}},{key:"highlightMatches",get:function(){return this._highlightMatches}},{key:"pageMatches",get:function(){return this._pageMatches}},{key:"pageMatchesLength",get:function(){return this._pageMatchesLength}},{key:"selected",get:function(){return this._selected}},{key:"state",get:function(){return this._state}},{key:"_query",get:function(){return this._state.query!==this._rawQuery&&(this._rawQuery=this._state.query,this._normalizedQuery=c(this._state.query)),this._normalizedQuery}}])&&o(t.prototype,n),u&&o(t,u),e}();t.PDFFindController=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getCharacterType=function(e){if(function(e){return e<11904}(e))return function(e){return 0==(65408&e)}(e)?function(e){return 32===e||9===e||13===e||10===e}(e)?i.SPACE:function(e){return e>=97&&e<=122||e>=65&&e<=90}(e)||function(e){return e>=48&&e<=57}(e)||95===e?i.ALPHA_LETTER:i.PUNCT:function(e){return 3584==(65408&e)}(e)?i.THAI_LETTER:160===e?i.SPACE:i.ALPHA_LETTER;if(function(e){return e>=13312&&e<=40959||e>=63744&&e<=64255}(e))return i.HAN_LETTER;if(function(e){return e>=12448&&e<=12543}(e))return i.KATAKANA_LETTER;if(function(e){return e>=12352&&e<=12447}(e))return i.HIRAGANA_LETTER;if(function(e){return e>=65376&&e<=65439}(e))return i.HALFWIDTH_KATAKANA_LETTER;return i.ALPHA_LETTER},t.CharacterType=void 0;var i={SPACE:0,ALPHA_LETTER:1,PUNCT:2,HAN_LETTER:3,KATAKANA_LETTER:4,HIRAGANA_LETTER:5,HALFWIDTH_KATAKANA_LETTER:6,THAI_LETTER:7};t.CharacterType=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isDestHashesEqual=c,t.isDestArraysEqual=d,t.PDFHistory=void 0;var i=n(5);function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],i=!0,r=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(i=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);i=!0);}catch(e){r=!0,a=e}finally{try{i||null==s.return||s.return()}finally{if(r)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);nthis._maxUid&&(this._maxUid=this._uid),void 0!==f.rotation&&(this._initialRotation=f.rotation),f.dest?(this._initialBookmark=JSON.stringify(f.dest),this._destination.page=null):f.hash?this._initialBookmark=f.hash:f.page&&(this._initialBookmark="page=".concat(f.page))}else console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.')}},{key:"reset",value:function(){this._initialized&&(this._pageHide(),this._initialized=!1,this._unbindEvents()),this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._initialBookmark=null,this._initialRotation=null}},{key:"push",value:function(e){var t=this,n=e.namedDest,i=void 0===n?null:n,r=e.explicitDest,a=e.pageNumber;if(this._initialized)if(i&&"string"!=typeof i)console.error("PDFHistory.push: "+'"'.concat(i,'" is not a valid namedDest parameter.'));else if(Array.isArray(r))if(Number.isInteger(a)&&a>0&&a<=this.linkService.pagesCount||null===a&&!this._destination){var o=i||JSON.stringify(r);if(o){var s=!1;if(this._destination&&(c(this._destination.hash,o)||d(this._destination.dest,r))){if(this._destination.page)return;s=!0}this._popStateInProgress&&!s||(this._pushOrReplaceState({dest:r,hash:o,page:a,rotation:this.linkService.rotation},s),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then(function(){t._popStateInProgress=!1})))}}else console.error("PDFHistory.push: "+'"'.concat(a,'" is not a valid pageNumber parameter.'));else console.error("PDFHistory.push: "+'"'.concat(r,'" is not a valid explicitDest parameter.'))}},{key:"pushCurrentPosition",value:function(){this._initialized&&!this._popStateInProgress&&this._tryPushCurrentPosition()}},{key:"back",value:function(){if(this._initialized&&!this._popStateInProgress){var e=window.history.state;this._isValidState(e)&&e.uid>0&&window.history.back()}}},{key:"forward",value:function(){if(this._initialized&&!this._popStateInProgress){var e=window.history.state;this._isValidState(e)&&e.uid1&&void 0!==arguments[1]&&arguments[1]||!this._destination,i={fingerprint:this._fingerprint,uid:n?this._uid:this._uid+1,destination:e};if(this._updateInternalState(e,i.uid),this._updateUrl&&e&&e.hash){var r=document.location.href.split("#")[0];r.startsWith("file://")||(t="".concat(r,"#").concat(e.hash))}n?window.history.replaceState(i,"",t):(this._maxUid=this._uid,window.history.pushState(i,"",t))}},{key:"_tryPushCurrentPosition",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this._position){var t=this._position;if(e&&((t=Object.assign(Object.create(null),this._position)).temporary=!0),this._destination){if(this._destination.temporary)this._pushOrReplaceState(t,!0);else if(this._destination.hash!==t.hash&&(this._destination.page||!(this._numPositionUpdates<=50))){var n=!1;if(this._destination.page>=t.first&&this._destination.page<=t.page){if(this._destination.dest||!this._destination.first)return;n=!0}this._pushOrReplaceState(t,n)}}else this._pushOrReplaceState(t)}}},{key:"_isValidState",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return!1;if(e.fingerprint!==this._fingerprint){if(!t)return!1;if("string"!=typeof e.fingerprint||e.fingerprint.length!==this._fingerprint.length)return!1;var n=a(performance.getEntriesByType("navigation"),1)[0];if(!n||"reload"!==n.type)return!1}return!(!Number.isInteger(e.uid)||e.uid<0)&&(null!==e.destination&&"object"===r(e.destination))}},{key:"_updateInternalState",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),n&&e&&e.temporary&&delete e.temporary,this._destination=e,this._uid=t,this._numPositionUpdates=0}},{key:"_parseCurrentHash",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=unescape(u()).substring(1),n=(0,i.parseQueryString)(t),r=n.nameddest||"",a=0|n.page;return Number.isInteger(a)&&a>0&&a<=this.linkService.pagesCount&&!(e&&r.length>0)||(a=null),{hash:t,page:a,rotation:this.linkService.rotation}}},{key:"_updateViewarea",value:function(e){var t=this,n=e.location;this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._position={hash:this._isViewerInPresentationMode?"page=".concat(n.pageNumber):n.pdfOpenParams.substring(1),page:this.linkService.page,first:n.pageNumber,rotation:n.rotation},this._popStateInProgress||(this._isPagesLoaded&&this._destination&&!this._destination.page&&this._numPositionUpdates++,this._updateViewareaTimeout=setTimeout(function(){t._popStateInProgress||t._tryPushCurrentPosition(!0),t._updateViewareaTimeout=null},1e3))}},{key:"_popState",value:function(e){var t=this,n=e.state,r=u(),a=this._currentHash!==r;if(this._currentHash=r,n){if(this._isValidState(n)){this._popStateInProgress=!0,a&&(this._blockHashChange++,(0,i.waitOnEventOrTimeout)({target:window,name:"hashchange",delay:1e3}).then(function(){t._blockHashChange--}));var o=n.destination;this._updateInternalState(o,n.uid,!0),this._uid>this._maxUid&&(this._maxUid=this._uid),(0,i.isValidRotation)(o.rotation)&&(this.linkService.rotation=o.rotation),o.dest?this.linkService.navigateTo(o.dest):o.hash?this.linkService.setHash(o.hash):o.page&&(this.linkService.page=o.page),Promise.resolve().then(function(){t._popStateInProgress=!1})}}else{this._uid++;var s=this._parseCurrentHash(),l=s.hash,c=s.page,d=s.rotation;this._pushOrReplaceState({hash:l,page:c,rotation:d},!0)}}},{key:"_pageHide",value:function(){this._destination&&!this._destination.temporary||this._tryPushCurrentPosition()}},{key:"_bindEvents",value:function(){this._boundEvents||(this._boundEvents={updateViewarea:this._updateViewarea.bind(this),popState:this._popState.bind(this),pageHide:this._pageHide.bind(this)},this.eventBus._on("updateviewarea",this._boundEvents.updateViewarea),window.addEventListener("popstate",this._boundEvents.popState),window.addEventListener("pagehide",this._boundEvents.pageHide))}},{key:"_unbindEvents",value:function(){this._boundEvents&&(this.eventBus._off("updateviewarea",this._boundEvents.updateViewarea),window.removeEventListener("popstate",this._boundEvents.popState),window.removeEventListener("pagehide",this._boundEvents.pageHide),this._boundEvents=null)}},{key:"popStateInProgress",get:function(){return this._initialized&&(this._popStateInProgress||this._blockHashChange>0)}},{key:"initialBookmark",get:function(){return this._initialized?this._initialBookmark:null}},{key:"initialRotation",get:function(){return this._initialized?this._initialRotation:null}}])&&s(t.prototype,n),o&&s(t,o),e}();function c(e,t){return"string"==typeof e&&"string"==typeof t&&(e===t||(0,i.parseQueryString)(e).nameddest===t)}function d(e,t){function n(e,t){if(r(e)!==r(t))return!1;if(Array.isArray(e)||Array.isArray(t))return!1;if(null!==e&&"object"===r(e)&&null!==t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var i in e)if(!n(e[i],t[i]))return!1;return!0}return e===t||Number.isNaN(e)&&Number.isNaN(t)}if(!Array.isArray(e)||!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(var i=0,a=e.length;i0&&void 0!==arguments[0]?arguments[0]:{},n=t.eventBus,i=t.externalLinkTarget,r=void 0===i?null:i,o=t.externalLinkRel,s=void 0===o?null:o,u=t.externalLinkEnabled,l=void 0===u||u,c=t.ignoreDestinationZoom,d=void 0!==c&&c;a(this,e),this.eventBus=n,this.externalLinkTarget=r,this.externalLinkRel=s,this.externalLinkEnabled=l,this._ignoreDestinationZoom=d,this.baseUrl=null,this.pdfDocument=null,this.pdfViewer=null,this.pdfHistory=null,this._pagesRefCache=null}return s(e,[{key:"setDocument",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.baseUrl=t,this.pdfDocument=e,this._pagesRefCache=Object.create(null)}},{key:"setViewer",value:function(e){this.pdfViewer=e}},{key:"setHistory",value:function(e){this.pdfHistory=e}},{key:"navigateTo",value:function(e){var t=this;new Promise(function(n,i){"string"!=typeof e?n({namedDest:"",explicitDest:e}):t.pdfDocument.getDestination(e).then(function(t){n({namedDest:e,explicitDest:t})})}).then(function(n){Array.isArray(n.explicitDest)?function n(i){var r,a=i.namedDest,o=i.explicitDest,s=o[0];if(s instanceof Object){if(null===(r=t._cachedPageNumber(s)))return void t.pdfDocument.getPageIndex(s).then(function(e){t.cachePageRef(e+1,s),n({namedDest:a,explicitDest:o})}).catch(function(){console.error('PDFLinkService.navigateTo: "'.concat(s,'" is not ')+'a valid page reference, for dest="'.concat(e,'".'))})}else{if(!Number.isInteger(s))return void console.error('PDFLinkService.navigateTo: "'.concat(s,'" is not ')+'a valid destination reference, for dest="'.concat(e,'".'));r=s+1}!r||r<1||r>t.pagesCount?console.error('PDFLinkService.navigateTo: "'.concat(r,'" is not ')+'a valid page number, for dest="'.concat(e,'".')):(t.pdfHistory&&(t.pdfHistory.pushCurrentPosition(),t.pdfHistory.push({namedDest:a,explicitDest:o,pageNumber:r})),t.pdfViewer.scrollPageIntoView({pageNumber:r,destArray:o,ignoreDestinationZoom:t._ignoreDestinationZoom}))}(n):console.error('PDFLinkService.navigateTo: "'.concat(n.explicitDest,'" is')+' not a valid destination array, for dest="'.concat(e,'".'))})}},{key:"getDestinationHash",value:function(e){if("string"==typeof e)return this.getAnchorUrl("#"+escape(e));if(Array.isArray(e)){var t=JSON.stringify(e);return this.getAnchorUrl("#"+escape(t))}return this.getAnchorUrl("")}},{key:"getAnchorUrl",value:function(e){return(this.baseUrl||"")+e}},{key:"setHash",value:function(e){var t,n;if(e.includes("=")){var a=(0,i.parseQueryString)(e);if("search"in a&&this.eventBus.dispatch("findfromurlhash",{source:this,query:a.search.replace(/"/g,""),phraseSearch:"true"===a.phrase}),"page"in a&&(t=0|a.page||1),"zoom"in a){var o=a.zoom.split(","),s=o[0],u=parseFloat(s);s.includes("Fit")?"Fit"===s||"FitB"===s?n=[null,{name:s}]:"FitH"===s||"FitBH"===s||"FitV"===s||"FitBV"===s?n=[null,{name:s},o.length>1?0|o[1]:null]:"FitR"===s?5!==o.length?console.error('PDFLinkService.setHash: Not enough parameters for "FitR".'):n=[null,{name:s},0|o[1],0|o[2],0|o[3],0|o[4]]:console.error('PDFLinkService.setHash: "'.concat(s,'" is not ')+"a valid zoom value."):n=[null,{name:"XYZ"},o.length>1?0|o[1]:null,o.length>2?0|o[2]:null,u?u/100:s]}n?this.pdfViewer.scrollPageIntoView({pageNumber:t||this.page,destArray:n,allowNegativeOffset:!0}):t&&(this.page=t),"pagemode"in a&&this.eventBus.dispatch("pagemode",{source:this,mode:a.pagemode}),"nameddest"in a&&this.navigateTo(a.nameddest)}else{n=unescape(e);try{n=JSON.parse(n),Array.isArray(n)||(n=n.toString())}catch(e){}if("string"==typeof n||function(e){if(!Array.isArray(e))return!1;var t=e.length;if(t<2)return!1;var n=e[0];if(!("object"===r(n)&&Number.isInteger(n.num)&&Number.isInteger(n.gen)||Number.isInteger(n)&&n>=0))return!1;var i=e[1];if("object"!==r(i)||"string"!=typeof i.name)return!1;var a=!0;switch(i.name){case"XYZ":if(5!==t)return!1;break;case"Fit":case"FitB":return 2===t;case"FitH":case"FitBH":case"FitV":case"FitBV":if(3!==t)return!1;break;case"FitR":if(6!==t)return!1;a=!1;break;default:return!1}for(var o=2;o1&&this.page--;break;case"LastPage":this.page=this.pagesCount;break;case"FirstPage":this.page=1}this.eventBus.dispatch("namedaction",{source:this,action:e})}},{key:"cachePageRef",value:function(e,t){if(t){var n=0===t.gen?"".concat(t.num,"R"):"".concat(t.num,"R").concat(t.gen);this._pagesRefCache[n]=e}}},{key:"_cachedPageNumber",value:function(e){var t=0===e.gen?"".concat(e.num,"R"):"".concat(e.num,"R").concat(e.gen);return this._pagesRefCache&&this._pagesRefCache[t]||null}},{key:"isPageVisible",value:function(e){return this.pdfViewer.isPageVisible(e)}},{key:"pagesCount",get:function(){return this.pdfDocument?this.pdfDocument.numPages:0}},{key:"page",get:function(){return this.pdfViewer.currentPageNumber},set:function(e){this.pdfViewer.currentPageNumber=e}},{key:"rotation",get:function(){return this.pdfViewer.pagesRotation},set:function(e){this.pdfViewer.pagesRotation=e}}]),e}();t.PDFLinkService=u;var l=function(){function e(){a(this,e),this.externalLinkTarget=null,this.externalLinkRel=null,this.externalLinkEnabled=!0,this._ignoreDestinationZoom=!1}return s(e,[{key:"navigateTo",value:function(e){}},{key:"getDestinationHash",value:function(e){return"#"}},{key:"getAnchorUrl",value:function(e){return"#"}},{key:"setHash",value:function(e){}},{key:"executeNamedAction",value:function(e){}},{key:"cachePageRef",value:function(e,t){}},{key:"isPageVisible",value:function(e){return!0}},{key:"pagesCount",get:function(){return 0}},{key:"page",get:function(){return 0},set:function(e){}},{key:"rotation",get:function(){return 0},set:function(e){}}]),e}();t.SimpleLinkService=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PDFOutlineViewer=void 0;var i=n(8);function r(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,u=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return s=e.done,e},e:function(e){u=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(u)throw o}}}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n1&&void 0!==arguments[1]&&arguments[1];this.lastToggleIsShow=t;var n,i=r(e.querySelectorAll(".outlineItemToggler"));try{for(i.s();!(n=i.n()).done;){n.value.classList.toggle("outlineItemsHidden",!t)}}catch(e){i.e(e)}finally{i.f()}}},{key:"toggleOutlineTree",value:function(){this.outline&&this._toggleOutlineItem(this.container,!this.lastToggleIsShow)}},{key:"render",value:function(e){var t=e.outline,n=0;if(this.outline&&this.reset(),this.outline=t||null,t){for(var a=document.createDocumentFragment(),o=[{parent:a,items:this.outline}],s=!1;o.length>0;){var u,l=o.shift(),c=r(l.items);try{for(c.s();!(u=c.n()).done;){var d=u.value,h=document.createElement("div");h.className="outlineItem";var f=document.createElement("a");if(this._bindLink(f,d),this._setStyles(f,d),f.textContent=(0,i.removeNullCharacters)(d.title)||"–",h.appendChild(f),d.items.length>0){s=!0,this._addToggleButton(h,d);var p=document.createElement("div");p.className="outlineItems",h.appendChild(p),o.push({parent:p,items:d.items})}l.parent.appendChild(h),n++}}catch(e){c.e(e)}finally{c.f()}}s&&(this.container.classList.add("outlineWithDeepNesting"),this.lastToggleIsShow=0===a.querySelectorAll(".outlineItemsHidden").length),this.container.appendChild(a),this._dispatchEvent(n)}else this._dispatchEvent(n)}}])&&o(t.prototype,n),a&&o(t,a),e}();t.PDFOutlineViewer=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PDFPresentationMode=void 0;var i=n(5);function r(e,t){for(var n=0;nr&&n-r<50)&&((this.mouseScrollDelta>0&&t<0||this.mouseScrollDelta<0&&t>0)&&this._resetMouseScrollState(),this.mouseScrollDelta+=t,Math.abs(this.mouseScrollDelta)>=.1)){var a=this.mouseScrollDelta;this._resetMouseScrollState(),(a>0?this._goToPreviousPage():this._goToNextPage())&&(this.mouseScrollTimeStamp=n)}}}},{key:"_goToPreviousPage",value:function(){var e=this.pdfViewer.currentPageNumber;return!(e<=1)&&(this.pdfViewer.currentPageNumber=e-1,!0)}},{key:"_goToNextPage",value:function(){var e=this.pdfViewer.currentPageNumber;return!(e>=this.pdfViewer.pagesCount)&&(this.pdfViewer.currentPageNumber=e+1,!0)}},{key:"_notifyStateChange",value:function(){this.eventBus.dispatch("presentationmodechanged",{source:this,active:this.active,switchInProgress:!!this.switchInProgress})}},{key:"_setSwitchInProgress",value:function(){var e=this;this.switchInProgress&&clearTimeout(this.switchInProgress),this.switchInProgress=setTimeout(function(){e._removeFullscreenChangeListeners(),delete e.switchInProgress,e._notifyStateChange()},1500)}},{key:"_resetSwitchInProgress",value:function(){this.switchInProgress&&(clearTimeout(this.switchInProgress),delete this.switchInProgress)}},{key:"_enter",value:function(){var e=this;this.active=!0,this._resetSwitchInProgress(),this._notifyStateChange(),this.container.classList.add("pdfPresentationMode"),setTimeout(function(){e.pdfViewer.currentPageNumber=e.args.page,e.pdfViewer.currentScaleValue="page-fit"},0),this._addWindowListeners(),this._showControls(),this.contextMenuOpen=!1,this.container.setAttribute("contextmenu","viewerContextMenu"),window.getSelection().removeAllRanges()}},{key:"_exit",value:function(){var e=this,t=this.pdfViewer.currentPageNumber;this.container.classList.remove("pdfPresentationMode"),setTimeout(function(){e.active=!1,e._removeFullscreenChangeListeners(),e._notifyStateChange(),e.pdfViewer.currentScaleValue=e.args.previousScale,e.pdfViewer.currentPageNumber=t,e.args=null},0),this._removeWindowListeners(),this._hideControls(),this._resetMouseScrollState(),this.container.removeAttribute("contextmenu"),this.contextMenuOpen=!1}},{key:"_mouseDown",value:function(e){if(this.contextMenuOpen)return this.contextMenuOpen=!1,void e.preventDefault();0===e.button&&(e.target.href&&e.target.classList.contains("internalLink")||(e.preventDefault(),e.shiftKey?this._goToPreviousPage():this._goToNextPage()))}},{key:"_contextMenu",value:function(){this.contextMenuOpen=!0}},{key:"_showControls",value:function(){var e=this;this.controlsTimeout?clearTimeout(this.controlsTimeout):this.container.classList.add("pdfPresentationModeControls"),this.controlsTimeout=setTimeout(function(){e.container.classList.remove("pdfPresentationModeControls"),delete e.controlsTimeout},3e3)}},{key:"_hideControls",value:function(){this.controlsTimeout&&(clearTimeout(this.controlsTimeout),this.container.classList.remove("pdfPresentationModeControls"),delete this.controlsTimeout)}},{key:"_resetMouseScrollState",value:function(){this.mouseScrollTimeStamp=0,this.mouseScrollDelta=0}},{key:"_touchSwipe",value:function(e){if(this.active)if(e.touches.length>1)this.touchSwipeState=null;else switch(e.type){case"touchstart":this.touchSwipeState={startX:e.touches[0].pageX,startY:e.touches[0].pageY,endX:e.touches[0].pageX,endY:e.touches[0].pageY};break;case"touchmove":if(null===this.touchSwipeState)return;this.touchSwipeState.endX=e.touches[0].pageX,this.touchSwipeState.endY=e.touches[0].pageY,e.preventDefault();break;case"touchend":if(null===this.touchSwipeState)return;var t=0,n=this.touchSwipeState.endX-this.touchSwipeState.startX,i=this.touchSwipeState.endY-this.touchSwipeState.startY,r=Math.abs(Math.atan2(i,n));Math.abs(n)>50&&(r<=a||r>=Math.PI-a)?t=n:Math.abs(i)>50&&Math.abs(r-Math.PI/2)<=a&&(t=i),t>0?this._goToPreviousPage():t<0&&this._goToNextPage()}}},{key:"_addWindowListeners",value:function(){this.showControlsBind=this._showControls.bind(this),this.mouseDownBind=this._mouseDown.bind(this),this.mouseWheelBind=this._mouseWheel.bind(this),this.resetMouseScrollStateBind=this._resetMouseScrollState.bind(this),this.contextMenuBind=this._contextMenu.bind(this),this.touchSwipeBind=this._touchSwipe.bind(this),window.addEventListener("mousemove",this.showControlsBind),window.addEventListener("mousedown",this.mouseDownBind),window.addEventListener("wheel",this.mouseWheelBind,{passive:!1}),window.addEventListener("keydown",this.resetMouseScrollStateBind),window.addEventListener("contextmenu",this.contextMenuBind),window.addEventListener("touchstart",this.touchSwipeBind),window.addEventListener("touchmove",this.touchSwipeBind),window.addEventListener("touchend",this.touchSwipeBind)}},{key:"_removeWindowListeners",value:function(){window.removeEventListener("mousemove",this.showControlsBind),window.removeEventListener("mousedown",this.mouseDownBind),window.removeEventListener("wheel",this.mouseWheelBind,{passive:!1}),window.removeEventListener("keydown",this.resetMouseScrollStateBind),window.removeEventListener("contextmenu",this.contextMenuBind),window.removeEventListener("touchstart",this.touchSwipeBind),window.removeEventListener("touchmove",this.touchSwipeBind),window.removeEventListener("touchend",this.touchSwipeBind),delete this.showControlsBind,delete this.mouseDownBind,delete this.mouseWheelBind,delete this.resetMouseScrollStateBind,delete this.contextMenuBind,delete this.touchSwipeBind}},{key:"_fullscreenChange",value:function(){this.isFullscreen?this._enter():this._exit()}},{key:"_addFullscreenChangeListeners",value:function(){this.fullscreenChangeBind=this._fullscreenChange.bind(this),window.addEventListener("fullscreenchange",this.fullscreenChangeBind),window.addEventListener("mozfullscreenchange",this.fullscreenChangeBind),window.addEventListener("webkitfullscreenchange",this.fullscreenChangeBind),window.addEventListener("MSFullscreenChange",this.fullscreenChangeBind)}},{key:"_removeFullscreenChangeListeners",value:function(){window.removeEventListener("fullscreenchange",this.fullscreenChangeBind),window.removeEventListener("mozfullscreenchange",this.fullscreenChangeBind),window.removeEventListener("webkitfullscreenchange",this.fullscreenChangeBind),window.removeEventListener("MSFullscreenChange",this.fullscreenChangeBind),delete this.fullscreenChangeBind}},{key:"isFullscreen",get:function(){return!!(document.fullscreenElement||document.mozFullScreen||document.webkitIsFullScreen||document.msFullscreenElement)}}])&&r(t.prototype,n),o&&r(t,o),e}();t.PDFPresentationMode=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PDFSidebarResizer=void 0;var i=n(5);function r(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:i.NullL10n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.enabled=!1,this.isRTL=!1,this.sidebarOpen=!1,this.doc=document.documentElement,this._width=null,this._outerContainerWidth=null,this._boundEvents=Object.create(null),this.outerContainer=t.outerContainer,this.resizer=t.resizer,this.eventBus=n,this.l10n=s,"undefined"!=typeof CSS&&"function"==typeof CSS.supports&&CSS.supports(a,"calc(-1 * ".concat(o,"px)"))?(this.enabled=!0,this.resizer.classList.remove("hidden"),this.l10n.getDirection().then(function(e){r.isRTL="rtl"===e}),this._addEventListeners()):console.warn("PDFSidebarResizer: The browser does not support resizing of the sidebar.")}var t,n,s;return t=e,(n=[{key:"_updateWidth",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(!this.enabled)return!1;var t=(0,i.clamp)(e,o,Math.floor(this.outerContainerWidth/2));return t!==this._width&&(this._width=t,this.doc.style.setProperty(a,"".concat(t,"px")),!0)}},{key:"_mouseMove",value:function(e){var t=e.clientX;this.isRTL&&(t=this.outerContainerWidth-t),this._updateWidth(t)}},{key:"_mouseUp",value:function(e){this.outerContainer.classList.remove("sidebarResizing"),this.eventBus.dispatch("resize",{source:this});var t=this._boundEvents;window.removeEventListener("mousemove",t.mouseMove),window.removeEventListener("mouseup",t.mouseUp)}},{key:"_addEventListeners",value:function(){var e=this;if(this.enabled){var t=this._boundEvents;t.mouseMove=this._mouseMove.bind(this),t.mouseUp=this._mouseUp.bind(this),this.resizer.addEventListener("mousedown",function(n){0===n.button&&(e.outerContainer.classList.add("sidebarResizing"),window.addEventListener("mousemove",t.mouseMove),window.addEventListener("mouseup",t.mouseUp))}),this.eventBus._on("sidebarviewchanged",function(t){e.sidebarOpen=!(!t||!t.view)}),this.eventBus._on("resize",function(t){if(t&&t.source===window&&(e._outerContainerWidth=null,e._width))if(e.sidebarOpen){e.outerContainer.classList.add("sidebarResizing");var n=e._updateWidth(e._width);Promise.resolve().then(function(){e.outerContainer.classList.remove("sidebarResizing"),n&&e.eventBus.dispatch("resize",{source:e})})}else e._updateWidth(e._width)})}}},{key:"outerContainerWidth",get:function(){return this._outerContainerWidth||(this._outerContainerWidth=this.outerContainer.clientWidth),this._outerContainerWidth}}])&&r(t.prototype,n),s&&r(t,s),e}();t.PDFSidebarResizer=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PDFThumbnailViewer=void 0;var i=n(5),r=n(26);function a(e,t){for(var n=0;n0){var a=n.first.id,o=r>1?n.last.id:a,s=!1;e<=a||e>=o?s=!0:n.views.some(function(t){return t.id===e&&(s=t.percent<100,!0)}),s&&(0,i.scrollIntoView)(t.div,{top:-19})}this._currentPageNumber=e}else console.error('scrollThumbnailIntoView: Invalid "pageNumber" parameter.')}}},{key:"cleanup",value:function(){r.PDFThumbnailView.cleanup()}},{key:"_resetView",value:function(){this._thumbnails=[],this._currentPageNumber=1,this._pageLabels=null,this._pagesRotation=0,this._pagesRequests=new WeakMap,this.container.textContent=""}},{key:"setDocument",value:function(e){var t=this;this.pdfDocument&&(this._cancelRendering(),this._resetView()),this.pdfDocument=e,e&&e.getPage(1).then(function(n){for(var i=e.numPages,a=n.getViewport({scale:1}),o=1;o<=i;++o){var s=new r.PDFThumbnailView({container:t.container,id:o,defaultViewport:a.clone(),linkService:t.linkService,renderingQueue:t.renderingQueue,disableCanvasToImageConversion:!1,l10n:t.l10n});t._thumbnails.push(s)}var u=t._thumbnails[0];u&&u.setPdfPage(n),t._thumbnails[t._currentPageNumber-1].div.classList.add("selected")}).catch(function(e){console.error("Unable to initialize thumbnail viewer",e)})}},{key:"_cancelRendering",value:function(){for(var e=0,t=this._thumbnails.length;e=0;n--)e.removeChild(t[n]);var i=2*u;e.style.width=this.canvasWidth+i+"px",e.style.height=this.canvasHeight+i+"px",this.canvas&&(this.canvas.width=0,this.canvas.height=0,delete this.canvas),this.image&&(this.image.removeAttribute("src"),delete this.image)}},{key:"update",value:function(e){void 0!==e&&(this.rotation=e);var t=(this.rotation+this.pdfPageRotate)%360;this.viewport=this.viewport.clone({scale:1,rotation:t}),this.reset()}},{key:"cancelRendering",value:function(){this.renderTask&&(this.renderTask.cancel(),this.renderTask=null),this.resume=null}},{key:"_getPageDrawContext",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=document.createElement("canvas");this.canvas=t,t.mozOpaque=!0;var n=t.getContext("2d",{alpha:!1}),i=(0,r.getOutputScale)(n);return t.width=this.canvasWidth*i.sx|0,t.height=this.canvasHeight*i.sy|0,t.style.width=this.canvasWidth+"px",t.style.height=this.canvasHeight+"px",!e&&i.scaled&&n.scale(i.sx,i.sy),n}},{key:"_convertCanvasToImage",value:function(){var e=this;if(this.canvas&&this.renderingState===a.RenderingStates.FINISHED){if(this.disableCanvasToImageConversion)return this.canvas.className="thumbnailImage",this._thumbPageCanvas.then(function(t){e.canvas.setAttribute("aria-label",t)}),this.div.setAttribute("data-loaded",!0),void this.ring.appendChild(this.canvas);var t=document.createElement("img");t.className="thumbnailImage",this._thumbPageCanvas.then(function(e){t.setAttribute("aria-label",e)}),t.style.width=this.canvasWidth+"px",t.style.height=this.canvasHeight+"px",t.src=this.canvas.toDataURL(),this.image=t,this.div.setAttribute("data-loaded",!0),this.ring.appendChild(t),this.canvas.width=0,this.canvas.height=0,delete this.canvas}}},{key:"draw",value:function(){var e=this;if(this.renderingState!==a.RenderingStates.INITIAL)return console.error("Must be in new state before drawing"),Promise.resolve(void 0);var t=this.pdfPage;if(!t)return this.renderingState=a.RenderingStates.FINISHED,Promise.reject(new Error("pdfPage is not loaded"));this.renderingState=a.RenderingStates.RUNNING;var n=(0,i.createPromiseCapability)(),r=function(t){s===e.renderTask&&(e.renderTask=null),t instanceof i.RenderingCancelledException?n.resolve(void 0):(e.renderingState=a.RenderingStates.FINISHED,e._convertCanvasToImage(),t?n.reject(t):n.resolve(void 0))},o={canvasContext:this._getPageDrawContext(),viewport:this.viewport.clone({scale:this.scale})},s=this.renderTask=t.render(o);return s.onContinue=function(t){if(!e.renderingQueue.isHighestPriority(e))return e.renderingState=a.RenderingStates.PAUSED,void(e.resume=function(){e.renderingState=a.RenderingStates.RUNNING,t()});t()},s.promise.then(function(){r(null)},function(e){r(e)}),n.promise}},{key:"setImage",value:function(e){if(this.renderingState===a.RenderingStates.INITIAL){var t=e.canvas;if(t){this.pdfPage||this.setPdfPage(e.pdfPage),this.renderingState=a.RenderingStates.FINISHED;var n=this._getPageDrawContext(!0),i=n.canvas;if(t.width<=2*i.width)return n.drawImage(t,0,0,t.width,t.height,0,0,i.width,i.height),void this._convertCanvasToImage();for(var r=i.width<<3,o=i.height<<3,s=c.getCanvas(r,o),u=s.getContext("2d");r>t.width||o>t.height;)r>>=1,o>>=1;for(u.drawImage(t,0,0,t.width,t.height,0,0,r,o);r>2*i.width;)u.drawImage(s,0,0,r,o,0,0,r>>1,o>>1),r>>=1,o>>=1;n.drawImage(s,0,0,r,o,0,0,i.width,i.height),this._convertCanvasToImage()}}}},{key:"setPageLabel",value:function(e){var t=this;this.pageLabel="string"==typeof e?e:null,this._thumbPageTitle.then(function(e){t.anchor.title=e}),this.renderingState===a.RenderingStates.FINISHED&&this._thumbPageCanvas.then(function(e){t.image?t.image.setAttribute("aria-label",e):t.disableCanvasToImageConversion&&t.canvas&&t.canvas.setAttribute("aria-label",e)})}},{key:"_thumbPageTitle",get:function(){return this.l10n.get("thumb_page_title",{page:null!==this.pageLabel?this.pageLabel:this.id},"Page {{page}}")}},{key:"_thumbPageCanvas",get:function(){return this.l10n.get("thumb_page_canvas",{page:null!==this.pageLabel?this.pageLabel:this.id},"Thumbnail of Page {{page}}")}}])&&o(t.prototype,n),s&&o(t,s),e}();t.PDFThumbnailView=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PDFViewer=void 0;var i=n(28),r=n(8);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(u)throw a}}}}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);nc+d)&&(i={left:0,top:0})}l(h(f.prototype),"_scrollIntoView",this).call(this,{pageDiv:t,pageSpot:i,pageNumber:a})}},{key:"_getVisiblePages",value:function(){return this.isInPresentationMode?this._getCurrentVisiblePage():l(h(f.prototype),"_getVisiblePages",this).call(this)}},{key:"_updateHelper",value:function(e){if(!this.isInPresentationMode){var t,n=this._currentPageNumber,i=!1,r=o(e);try{for(r.s();!(t=r.n()).done;){var a=t.value;if(a.percent<100)break;if(a.id===n){i=!0;break}}}catch(e){r.e(e)}finally{r.f()}i||(n=e[0].id),this._setCurrentPageNumber(n)}}},{key:"_viewerElement",get:function(){return(0,r.shadow)(this,"_viewerElement",this.viewer)}}])&&u(t.prototype,n),a&&u(t,a),f}();t.PDFViewer=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseViewer=void 0;var i=n(5),r=n(11),a=n(29),o=n(8),s=n(30),u=n(21),l=n(31);function c(e,t){for(var n=0;n=0&&t.splice(i,1),t.push(n),t.length>e&&t.shift().destroy()},this.resize=function(n,r){if(e=n,r){for(var a=new Set,o=0,s=r.length;oe;)t.shift().destroy()}}var h=function(){function e(t){var n=this;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.constructor===e)throw new Error("Cannot initialize BaseViewer.");this._name=this.constructor.name,this.container=t.container,this.viewer=t.viewer||t.container.firstElementChild,this.eventBus=t.eventBus,this.linkService=t.linkService||new u.SimpleLinkService,this.downloadManager=t.downloadManager||null,this.findController=t.findController||null,this.removePageBorders=t.removePageBorders||!1,this.textLayerMode=Number.isInteger(t.textLayerMode)?t.textLayerMode:i.TextLayerMode.ENABLE,this.imageResourcesPath=t.imageResourcesPath||"",this.renderInteractiveForms=t.renderInteractiveForms||!1,this.enablePrintAutoRotate=t.enablePrintAutoRotate||!1,this.renderer=t.renderer||i.RendererType.CANVAS,this.enableWebGL=t.enableWebGL||!1,this.useOnlyCssZoom=t.useOnlyCssZoom||!1,this.maxCanvasPixels=t.maxCanvasPixels,this.l10n=t.l10n||i.NullL10n,this.defaultRenderingQueue=!t.renderingQueue,this.defaultRenderingQueue?(this.renderingQueue=new r.PDFRenderingQueue,this.renderingQueue.setViewer(this)):this.renderingQueue=t.renderingQueue,this.scroll=(0,i.watchScroll)(this.container,this._scrollUpdate.bind(this)),this.presentationModeState=i.PresentationModeState.UNKNOWN,this._onBeforeDraw=this._onAfterDraw=null,this._resetView(),this.removePageBorders&&this.viewer.classList.add("removePageBorders"),Promise.resolve().then(function(){n.eventBus.dispatch("baseviewerinit",{source:n})})}var t,n,h;return t=e,(n=[{key:"getPageView",value:function(e){return this._pages[e]}},{key:"_setCurrentPageNumber",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._currentPageNumber===e?(t&&this._resetCurrentPageView(),!0):07500)t._pagesCapability.resolve();else{var i=n-1;if(i<=0)t._pagesCapability.resolve();else for(var r=function(n){e.getPage(n).then(function(e){var r=t._pages[n-1];r.pdfPage||r.setPdfPage(e),t.linkService.cachePageRef(n,e.ref),0==--i&&t._pagesCapability.resolve()},function(e){console.error("Unable to get page ".concat(n," to initialize viewer"),e),0==--i&&t._pagesCapability.resolve()})},a=2;a<=n;++a)r(a)}}),t.eventBus.dispatch("pagesinit",{source:t}),t.defaultRenderingQueue&&t.update()}).catch(function(e){console.error("Unable to initialize viewer",e)})}}},{key:"setPageLabels",value:function(e){if(this.pdfDocument){e?Array.isArray(e)&&this.pdfDocument.numPages===e.length?this._pageLabels=e:(this._pageLabels=null,console.error("".concat(this._name,".setPageLabels: Invalid page labels."))):this._pageLabels=null;for(var t=0,n=this._pages.length;t2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(this._currentScaleValue=t.toString(),function(e,t){return t===e||Math.abs(t-e)<1e-15}(this._currentScale,e))i&&this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:t});else{for(var r=0,a=this._pages.length;r1&&void 0!==arguments[1]&&arguments[1],n=parseFloat(e);if(n>0)this._setScaleUpdatePages(n,e,t,!1);else{var r=this._pages[this._currentPageNumber-1];if(!r)return;var a=this.isInPresentationMode||this.removePageBorders,o=a?0:i.SCROLLBAR_PADDING,s=a?0:i.VERTICAL_PADDING;if(!a&&this._isScrollModeHorizontal){var u=[s,o];o=u[0],s=u[1]}var l=(this.container.clientWidth-o)/r.width*r.scale,c=(this.container.clientHeight-s)/r.height*r.scale;switch(e){case"page-actual":n=1;break;case"page-width":n=l;break;case"page-height":n=c;break;case"page-fit":n=Math.min(l,c);break;case"auto":var d=(0,i.isPortraitOrientation)(r)?l:Math.min(c,l);n=Math.min(i.MAX_AUTO_SCALE,d);break;default:return void console.error("".concat(this._name,'._setScale: "').concat(e,'" is an unknown zoom value.'))}this._setScaleUpdatePages(n,e,t,!0)}}},{key:"_resetCurrentPageView",value:function(){this.isInPresentationMode&&this._setScale(this._currentScaleValue,!0);var e=this._pages[this._currentPageNumber-1];this._scrollIntoView({pageDiv:e.div})}},{key:"scrollPageIntoView",value:function(e){var t=e.pageNumber,n=e.destArray,r=void 0===n?null:n,a=e.allowNegativeOffset,o=void 0!==a&&a,s=e.ignoreDestinationZoom,u=void 0!==s&&s;if(this.pdfDocument){var l=Number.isInteger(t)&&this._pages[t-1];if(l)if(!this.isInPresentationMode&&r){var c,d,h=0,f=0,p=0,v=0,g=l.rotation%180!=0,m=(g?l.height:l.width)/l.scale/i.CSS_UNITS,y=(g?l.width:l.height)/l.scale/i.CSS_UNITS,b=0;switch(r[1].name){case"XYZ":h=r[2],f=r[3],b=r[4],h=null!==h?h:0,f=null!==f?f:y;break;case"Fit":case"FitB":b="page-fit";break;case"FitH":case"FitBH":b="page-width",null===(f=r[2])&&this._location&&(h=this._location.left,f=this._location.top);break;case"FitV":case"FitBV":h=r[2],p=m,v=y,b="page-height";break;case"FitR":h=r[2],f=r[3],p=r[4]-h,v=r[5]-f;var w=this.removePageBorders?0:i.SCROLLBAR_PADDING,_=this.removePageBorders?0:i.VERTICAL_PADDING;c=(this.container.clientWidth-w)/p/i.CSS_UNITS,d=(this.container.clientHeight-_)/v/i.CSS_UNITS,b=Math.min(Math.abs(c),Math.abs(d));break;default:return void console.error("".concat(this._name,".scrollPageIntoView: ")+'"'.concat(r[1].name,'" is not a valid destination type.'))}if(u||(b&&b!==this._currentScale?this.currentScaleValue=b:this._currentScale===i.UNKNOWN_SCALE&&(this.currentScaleValue=i.DEFAULT_SCALE_VALUE)),"page-fit"!==b||r[4]){var P=[l.viewport.convertToViewportPoint(h,f),l.viewport.convertToViewportPoint(h+p,f+v)],S=Math.min(P[0][0],P[1][0]),k=Math.min(P[0][1],P[1][1]);o||(S=Math.max(S,0),k=Math.max(k,0)),this._scrollIntoView({pageDiv:l.div,pageSpot:{left:S,top:k},pageNumber:t})}else this._scrollIntoView({pageDiv:l.div,pageNumber:t})}else this._setCurrentPageNumber(t,!0);else console.error("".concat(this._name,".scrollPageIntoView: ")+'"'.concat(t,'" is not a valid pageNumber parameter.'))}}},{key:"_updateLocation",value:function(e){var t=this._currentScale,n=this._currentScaleValue,i=parseFloat(n)===t?Math.round(1e4*t)/100:n,r=e.id,a="#page="+r;a+="&zoom="+i;var o=this._pages[r-1],s=this.container,u=o.getPagePoint(s.scrollLeft-e.x,s.scrollTop-e.y),l=Math.round(u[0]),c=Math.round(u[1]);a+=","+l+","+c,this._location={pageNumber:r,scale:i,top:c,left:l,rotation:this._pagesRotation,pdfOpenParams:a}}},{key:"_updateHelper",value:function(e){throw new Error("Not implemented: _updateHelper")}},{key:"update",value:function(){var e=this._getVisiblePages(),t=e.views,n=t.length;if(0!==n){var i=Math.max(10,2*n+1);this._buffer.resize(i,t),this.renderingQueue.renderHighestPriority(e),this._updateHelper(t),this._updateLocation(e.first),this.eventBus.dispatch("updateviewarea",{source:this,location:this._location})}}},{key:"containsElement",value:function(e){return this.container.contains(e)}},{key:"focus",value:function(){this.container.focus()}},{key:"_getCurrentVisiblePage",value:function(){if(!this.pagesCount)return{views:[]};var e=this._pages[this._currentPageNumber-1],t=e.div,n={id:e.id,x:t.offsetLeft+t.clientLeft,y:t.offsetTop+t.clientTop,view:e};return{first:n,last:n,views:[n]}}},{key:"_getVisiblePages",value:function(){return(0,i.getVisibleElements)(this.container,this._pages,!0,this._isScrollModeHorizontal)}},{key:"isPageVisible",value:function(e){return!!this.pdfDocument&&(e<1||e>this.pagesCount?(console.error("".concat(this._name,'.isPageVisible: "').concat(e,'" is out of bounds.')),!1):this._getVisiblePages().views.some(function(t){return t.id===e}))}},{key:"cleanup",value:function(){for(var e=0,t=this._pages.length;e3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4?arguments[4]:void 0;return new l.TextLayerBuilder({textLayerDiv:e,eventBus:r,pageIndex:t,viewport:n,findController:this.isInPresentationMode?null:this.findController,enhanceTextSelection:!this.isInPresentationMode&&i})}},{key:"createAnnotationLayerBuilder",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:i.NullL10n;return new a.AnnotationLayerBuilder({pageDiv:e,pdfPage:t,imageResourcesPath:n,renderInteractiveForms:r,linkService:this.linkService,downloadManager:this.downloadManager,l10n:o})}},{key:"getPagesOverview",value:function(){var e=this._pages.map(function(e){var t=e.pdfPage.getViewport({scale:1});return{width:t.width,height:t.height,rotation:t.rotation}});if(!this.enablePrintAutoRotate)return e;var t=(0,i.isPortraitOrientation)(e[0]);return e.map(function(e){return t===(0,i.isPortraitOrientation)(e)?e:{width:e.height,height:e.width,rotation:(e.rotation+90)%360}})}},{key:"_updateScrollMode",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=this._scrollMode,n=this.viewer;n.classList.toggle("scrollHorizontal",t===i.ScrollMode.HORIZONTAL),n.classList.toggle("scrollWrapped",t===i.ScrollMode.WRAPPED),this.pdfDocument&&e&&(this._currentScaleValue&&isNaN(this._currentScaleValue)&&this._setScale(this._currentScaleValue,!0),this._setCurrentPageNumber(e,!0),this.update())}},{key:"_updateSpreadMode",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(this.pdfDocument){var t=this.viewer,n=this._pages;if(t.textContent="",this._spreadMode===i.SpreadMode.NONE)for(var r=0,a=n.length;r=0&&(t=n+1)}this._setCurrentPageNumber(t,!0)||console.error("".concat(this._name,'.currentPageLabel: "').concat(e,'" is not a valid page.'))}}},{key:"currentScale",get:function(){return this._currentScale!==i.UNKNOWN_SCALE?this._currentScale:i.DEFAULT_SCALE},set:function(e){if(isNaN(e))throw new Error("Invalid numeric scale.");this.pdfDocument&&this._setScale(e,!1)}},{key:"currentScaleValue",get:function(){return this._currentScaleValue},set:function(e){this.pdfDocument&&this._setScale(e,!1)}},{key:"pagesRotation",get:function(){return this._pagesRotation},set:function(e){if(!(0,i.isValidRotation)(e))throw new Error("Invalid pages rotation angle.");if(this.pdfDocument&&this._pagesRotation!==e){this._pagesRotation=e;for(var t=this._currentPageNumber,n=0,r=this._pages.length;nthis.container.clientWidth}},{key:"isVerticalScrollbarEnabled",get:function(){return!this.isInPresentationMode&&this.container.scrollHeight>this.container.clientHeight}},{key:"hasEqualPageSizes",get:function(){for(var e=this._pages[0],t=1,n=this._pages.length;t1&&void 0!==arguments[1]?arguments[1]:"display";this.pdfPage.getAnnotations({intent:n}).then(function(n){if(!t._cancelled){var r={viewport:e.clone({dontFlip:!0}),div:t.div,annotations:n,page:t.pdfPage,imageResourcesPath:t.imageResourcesPath,renderInteractiveForms:t.renderInteractiveForms,linkService:t.linkService,downloadManager:t.downloadManager};if(t.div)i.AnnotationLayer.update(r);else{if(0===n.length)return;t.div=document.createElement("div"),t.div.className="annotationLayer",t.pageDiv.appendChild(t.div),r.div=t.div,i.AnnotationLayer.render(r),t.l10n.translate(t.div)}}})}},{key:"cancel",value:function(){this._cancelled=!0}},{key:"hide",value:function(){this.div&&this.div.setAttribute("hidden","true")}}]),e}();t.AnnotationLayerBuilder=l;var c=function(){function e(){o(this,e)}return u(e,[{key:"createAnnotationLayerBuilder",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:r.NullL10n;return new l({pageDiv:e,pdfPage:t,imageResourcesPath:n,renderInteractiveForms:i,linkService:new a.SimpleLinkService,l10n:o})}}]),e}();t.DefaultAnnotationLayerFactory=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PDFPageView=void 0;var i,r=(i=n(2))&&i.__esModule?i:{default:i},a=n(5),o=n(8),s=n(11);function u(e,t,n,i,r,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(i,r)}function l(e,t){for(var n=0;n0&&void 0!==arguments[0]&&arguments[0];if(this.zoomLayer){var t=this.zoomLayer.firstChild;this.paintedViewportMap.delete(t),t.width=0,t.height=0,e&&this.zoomLayer.remove(),this.zoomLayer=null}}},{key:"reset",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.cancelRendering(t),this.renderingState=s.RenderingStates.INITIAL;var n=this.div;n.style.width=Math.floor(this.viewport.width)+"px",n.style.height=Math.floor(this.viewport.height)+"px";for(var i=n.childNodes,r=e&&this.zoomLayer||null,a=t&&this.annotationLayer&&this.annotationLayer.div||null,o=i.length-1;o>=0;o--){var u=i[o];r!==u&&a!==u&&n.removeChild(u)}n.removeAttribute("data-loaded"),a?this.annotationLayer.hide():this.annotationLayer&&(this.annotationLayer.cancel(),this.annotationLayer=null),r||(this.canvas&&(this.paintedViewportMap.delete(this.canvas),this.canvas.width=0,this.canvas.height=0,delete this.canvas),this._resetZoomLayer()),this.svg&&(this.paintedViewportMap.delete(this.svg),delete this.svg),this.loadingIconDiv=document.createElement("div"),this.loadingIconDiv.className="loadingIcon",n.appendChild(this.loadingIconDiv)}},{key:"update",value:function(e,t){this.scale=e||this.scale,void 0!==t&&(this.rotation=t);var n=(this.rotation+this.pdfPageRotate)%360;if(this.viewport=this.viewport.clone({scale:this.scale*a.CSS_UNITS,rotation:n}),this.svg)return this.cssTransform(this.svg,!0),void this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now()});var i=!1;if(this.canvas&&this.maxCanvasPixels>0){var r=this.outputScale;(Math.floor(this.viewport.width)*r.sx|0)*(Math.floor(this.viewport.height)*r.sy|0)>this.maxCanvasPixels&&(i=!0)}if(this.canvas){if(this.useOnlyCssZoom||this.hasRestrictedScaling&&i)return this.cssTransform(this.canvas,!0),void this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now()});this.zoomLayer||this.canvas.hasAttribute("hidden")||(this.zoomLayer=this.canvas.parentNode,this.zoomLayer.style.position="absolute")}this.zoomLayer&&this.cssTransform(this.zoomLayer.firstChild),this.reset(!0,!0)}},{key:"cancelRendering",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.paintTask&&(this.paintTask.cancel(),this.paintTask=null),this.resume=null,this.textLayer&&(this.textLayer.cancel(),this.textLayer=null),!e&&this.annotationLayer&&(this.annotationLayer.cancel(),this.annotationLayer=null)}},{key:"cssTransform",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.viewport.width,i=this.viewport.height,r=this.div;e.style.width=e.parentNode.style.width=r.style.width=Math.floor(n)+"px",e.style.height=e.parentNode.style.height=r.style.height=Math.floor(i)+"px";var a=this.viewport.rotation-this.paintedViewportMap.get(e).rotation,o=Math.abs(a),s=1,u=1;90!==o&&270!==o||(s=i/n,u=n/i);var l="rotate("+a+"deg) scale("+s+","+u+")";if(e.style.transform=l,this.textLayer){var c=this.textLayer.viewport,d=this.viewport.rotation-c.rotation,h=Math.abs(d),f=n/c.width;90!==h&&270!==h||(f=n/c.height);var p,v,g=this.textLayer.textLayerDiv;switch(h){case 0:p=v=0;break;case 90:p=0,v="-"+g.style.height;break;case 180:p="-"+g.style.width,v="-"+g.style.height;break;case 270:p="-"+g.style.width,v=0;break;default:console.error("Bad rotation value.")}g.style.transform="rotate("+h+"deg) scale("+f+", "+f+") translate("+p+", "+v+")",g.style.transformOrigin="0% 0%"}t&&this.annotationLayer&&this.annotationLayer.render(this.viewport,"display")}},{key:"getPagePoint",value:function(e,t){return this.viewport.convertToPdfPoint(e,t)}},{key:"draw",value:function(){var e=this;this.renderingState!==s.RenderingStates.INITIAL&&(console.error("Must be in new state before drawing"),this.reset());var t=this.div,n=this.pdfPage;if(!n)return this.renderingState=s.RenderingStates.FINISHED,this.loadingIconDiv&&(t.removeChild(this.loadingIconDiv),delete this.loadingIconDiv),Promise.reject(new Error("pdfPage is not loaded"));this.renderingState=s.RenderingStates.RUNNING;var i=document.createElement("div");i.style.width=t.style.width,i.style.height=t.style.height,i.classList.add("canvasWrapper"),this.annotationLayer&&this.annotationLayer.div?t.insertBefore(i,this.annotationLayer.div):t.appendChild(i);var l=null;if(this.textLayerMode!==a.TextLayerMode.DISABLE&&this.textLayerFactory){var c=document.createElement("div");c.className="textLayer",c.style.width=i.style.width,c.style.height=i.style.height,this.annotationLayer&&this.annotationLayer.div?t.insertBefore(c,this.annotationLayer.div):t.appendChild(c),l=this.textLayerFactory.createTextLayerBuilder(c,this.id-1,this.viewport,this.textLayerMode===a.TextLayerMode.ENABLE_ENHANCE,this.eventBus)}this.textLayer=l;var d=null;this.renderingQueue&&(d=function(t){if(!e.renderingQueue.isHighestPriority(e))return e.renderingState=s.RenderingStates.PAUSED,void(e.resume=function(){e.renderingState=s.RenderingStates.RUNNING,t()});t()});var h=function(){var i,a=(i=r.default.mark(function i(a){return r.default.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(f===e.paintTask&&(e.paintTask=null),!(a instanceof o.RenderingCancelledException)){i.next=4;break}return e.error=null,i.abrupt("return");case 4:if(e.renderingState=s.RenderingStates.FINISHED,e.loadingIconDiv&&(t.removeChild(e.loadingIconDiv),delete e.loadingIconDiv),e._resetZoomLayer(!0),e.error=a,e.stats=n.stats,e.eventBus.dispatch("pagerendered",{source:e,pageNumber:e.id,cssTransform:!1,timestamp:performance.now()}),!a){i.next=12;break}throw a;case 12:case"end":return i.stop()}},i)}),function(){var e=this,t=arguments;return new Promise(function(n,r){var a=i.apply(e,t);function o(e){u(a,n,r,o,s,"next",e)}function s(e){u(a,n,r,o,s,"throw",e)}o(void 0)})});return function(e){return a.apply(this,arguments)}}(),f=this.renderer===a.RendererType.SVG?this.paintOnSvg(i):this.paintOnCanvas(i);f.onRenderContinue=d,this.paintTask=f;var p=f.promise.then(function(){return h(null).then(function(){if(l){var e=n.streamTextContent({normalizeWhitespace:!0});l.setTextContentStream(e),l.render()}})},function(e){return h(e)});return this.annotationLayerFactory&&(this.annotationLayer||(this.annotationLayer=this.annotationLayerFactory.createAnnotationLayerBuilder(t,n,this.imageResourcesPath,this.renderInteractiveForms,this.l10n)),this.annotationLayer.render(this.viewport,"display")),t.setAttribute("data-loaded",!0),this.eventBus.dispatch("pagerender",{source:this,pageNumber:this.id}),p}},{key:"paintOnCanvas",value:function(e){var t=(0,o.createPromiseCapability)(),n={promise:t.promise,onRenderContinue:function(e){e()},cancel:function(){m.cancel()}},i=this.viewport,r=document.createElement("canvas");this.l10n.get("page_canvas",{page:this.id},"Page {{page}}").then(function(e){r.setAttribute("aria-label",e)}),r.setAttribute("hidden","hidden");var s=!0,u=function(){s&&(r.removeAttribute("hidden"),s=!1)};e.appendChild(r),this.canvas=r,r.mozOpaque=!0;var l=r.getContext("2d",{alpha:!1}),c=(0,a.getOutputScale)(l);if(this.outputScale=c,this.useOnlyCssZoom){var d=i.clone({scale:a.CSS_UNITS});c.sx*=d.width/i.width,c.sy*=d.height/i.height,c.scaled=!0}if(this.maxCanvasPixels>0){var h=i.width*i.height,f=Math.sqrt(this.maxCanvasPixels/h);c.sx>f||c.sy>f?(c.sx=f,c.sy=f,c.scaled=!0,this.hasRestrictedScaling=!0):this.hasRestrictedScaling=!1}var p=(0,a.approximateFraction)(c.sx),v=(0,a.approximateFraction)(c.sy);r.width=(0,a.roundToDivide)(i.width*c.sx,p[0]),r.height=(0,a.roundToDivide)(i.height*c.sy,v[0]),r.style.width=(0,a.roundToDivide)(i.width,p[1])+"px",r.style.height=(0,a.roundToDivide)(i.height,v[1])+"px",this.paintedViewportMap.set(r,i);var g={canvasContext:l,transform:c.scaled?[c.sx,0,0,c.sy,0,0]:null,viewport:this.viewport,enableWebGL:this.enableWebGL,renderInteractiveForms:this.renderInteractiveForms},m=this.pdfPage.render(g);return m.onContinue=function(e){u(),n.onRenderContinue?n.onRenderContinue(e):e()},m.promise.then(function(){u(),t.resolve(void 0)},function(e){u(),t.reject(e)}),n}},{key:"paintOnSvg",value:function(e){var t=this,n=!1,i=function(){if(n)throw new o.RenderingCancelledException("Rendering cancelled, page ".concat(t.id),"svg")},r=this.pdfPage,u=this.viewport.clone({scale:a.CSS_UNITS});return{promise:r.getOperatorList().then(function(n){return i(),new o.SVGGraphics(r.commonObjs,r.objs).getSVG(n,u).then(function(n){i(),t.svg=n,t.paintedViewportMap.set(n,u),n.style.width=e.style.width,n.style.height=e.style.height,t.renderingState=s.RenderingStates.FINISHED,e.appendChild(n)})}),onRenderContinue:function(e){e()},cancel:function(){n=!0}}}},{key:"setPageLabel",value:function(e){this.pageLabel="string"==typeof e?e:null,null!==this.pageLabel?this.div.setAttribute("data-page-label",this.pageLabel):this.div.removeAttribute("data-page-label")}},{key:"width",get:function(){return this.viewport.width}},{key:"height",get:function(){return this.viewport.height}}])&&l(t.prototype,n),i&&l(t,i),e}();t.PDFPageView=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultTextLayerFactory=t.TextLayerBuilder=void 0;var i=n(8);function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:0;if((this.textContent||this.textContentStream)&&!this.renderingDone){this.cancel(),this.textDivs=[];var n=document.createDocumentFragment();this.textLayerRenderTask=(0,i.renderTextLayer)({textContent:this.textContent,textContentStream:this.textContentStream,container:n,viewport:this.viewport,textDivs:this.textDivs,textContentItemsStr:this.textContentItemsStr,timeout:t,enhanceTextSelection:this.enhanceTextSelection}),this.textLayerRenderTask.promise.then(function(){e.textLayerDiv.appendChild(n),e._finishRendering(),e._updateMatches()},function(e){}),this._onUpdateTextLayerMatches||(this._onUpdateTextLayerMatches=function(t){t.pageIndex!==e.pageIdx&&-1!==t.pageIndex||e._updateMatches()},this.eventBus._on("updatetextlayermatches",this._onUpdateTextLayerMatches))}}},{key:"cancel",value:function(){this.textLayerRenderTask&&(this.textLayerRenderTask.cancel(),this.textLayerRenderTask=null),this._onUpdateTextLayerMatches&&(this.eventBus._off("updatetextlayermatches",this._onUpdateTextLayerMatches),this._onUpdateTextLayerMatches=null)}},{key:"setTextContentStream",value:function(e){this.cancel(),this.textContentStream=e}},{key:"setTextContent",value:function(e){this.cancel(),this.textContent=e}},{key:"_convertMatches",value:function(e,t){if(!e)return[];for(var n=this.findController,i=this.textContentItemsStr,r=0,a=0,o=i.length-1,s=n.state.query.length,u=[],l=0,c=e.length;l=a+i[r].length;)a+=i[r].length,r++;r===i.length&&console.error("Could not find a matching mapping");var h={begin:{divIdx:r,offset:d-a}};for(d+=t?t[l]:s;r!==o&&d>a+i[r].length;)a+=i[r].length,r++;h.end={divIdx:r,offset:d-a},u.push(h)}return u}},{key:"_renderMatches",value:function(e){if(0!==e.length){var t=this.findController,n=this.pageIdx,i=this.textContentItemsStr,r=this.textDivs,a=n===t.selected.pageIdx,o=t.selected.matchIdx,s=null,u={divIdx:-1,offset:void 0},l=o,c=l+1;if(t.state.highlightAll)l=0,c=e.length;else if(!a)return;for(var d=l;d3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4?arguments[4]:void 0;return new s({textLayerDiv:e,pageIndex:t,viewport:n,enhanceTextSelection:i,eventBus:r})}}]),e}();t.DefaultTextLayerFactory=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SecondaryToolbar=void 0;var i=n(5),r=n(9),a=n(33);function o(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(u)throw a}}}}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n=this.pagesCount,this.items.pageRotateCw.disabled=0===this.pagesCount,this.items.pageRotateCcw.disabled=0===this.pagesCount}},{key:"_bindClickListeners",value:function(){var e=this;this.toggleButton.addEventListener("click",this.toggle.bind(this));var t,n=o(this.buttons);try{var i=function(){var n=t.value,i=n.element,r=n.eventName,a=n.close,o=n.eventDetails;i.addEventListener("click",function(t){if(null!==r){var n={source:e};for(var i in o)n[i]=o[i];e.eventBus.dispatch(r,n)}a&&e.close()})};for(n.s();!(t=n.n()).done;)i()}catch(e){n.e(e)}finally{n.f()}}},{key:"_bindCursorToolsListener",value:function(e){this.eventBus._on("cursortoolchanged",function(t){var n=t.tool;e.cursorSelectToolButton.classList.toggle("toggled",n===r.CursorTool.SELECT),e.cursorHandToolButton.classList.toggle("toggled",n===r.CursorTool.HAND)})}},{key:"_bindScrollModeListener",value:function(e){var t=this;function n(t){var n=t.mode;e.scrollVerticalButton.classList.toggle("toggled",n===i.ScrollMode.VERTICAL),e.scrollHorizontalButton.classList.toggle("toggled",n===i.ScrollMode.HORIZONTAL),e.scrollWrappedButton.classList.toggle("toggled",n===i.ScrollMode.WRAPPED);var r=n===i.ScrollMode.HORIZONTAL;e.spreadNoneButton.disabled=r,e.spreadOddButton.disabled=r,e.spreadEvenButton.disabled=r}this.eventBus._on("scrollmodechanged",n),this.eventBus._on("secondarytoolbarreset",function(e){e.source===t&&n({mode:i.ScrollMode.VERTICAL})})}},{key:"_bindSpreadModeListener",value:function(e){var t=this;function n(t){var n=t.mode;e.spreadNoneButton.classList.toggle("toggled",n===i.SpreadMode.NONE),e.spreadOddButton.classList.toggle("toggled",n===i.SpreadMode.ODD),e.spreadEvenButton.classList.toggle("toggled",n===i.SpreadMode.EVEN)}this.eventBus._on("spreadmodechanged",n),this.eventBus._on("secondarytoolbarreset",function(e){e.source===t&&n({mode:i.SpreadMode.NONE})})}},{key:"open",value:function(){this.opened||(this.opened=!0,this._setMaxHeight(),this.toggleButton.classList.add("toggled"),this.toolbar.classList.remove("hidden"))}},{key:"close",value:function(){this.opened&&(this.opened=!1,this.toolbar.classList.add("hidden"),this.toggleButton.classList.remove("toggled"))}},{key:"toggle",value:function(){this.opened?this.close():this.open()}},{key:"_setMaxHeight",value:function(){this.opened&&(this.containerHeight=this.mainContainer.clientHeight,this.containerHeight!==this.previousContainerHeight&&(this.toolbarButtonContainer.style.maxHeight="".concat(this.containerHeight-i.SCROLLBAR_PADDING,"px"),this.previousContainerHeight=this.containerHeight))}},{key:"isOpen",get:function(){return this.opened}}])&&u(t.prototype,n),s&&u(t,s),e}();t.SecondaryToolbar=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PDFSinglePageViewer=void 0;var i=n(28),r=n(8);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n=this._previousPageNumber;this._ensurePageViewVisible(),this.update(),s(c(h.prototype),"_scrollIntoView",this).call(this,{pageDiv:n,pageSpot:r,pageNumber:o}),this._updateScrollDown=function(){t.scroll.down=u,t._updateScrollDown=null}}},{key:"_getVisiblePages",value:function(){return this._getCurrentVisiblePage()}},{key:"_updateHelper",value:function(e){}},{key:"_updateScrollMode",value:function(){}},{key:"_updateSpreadMode",value:function(){}},{key:"_viewerElement",get:function(){return(0,r.shadow)(this,"_viewerElement",this._shadowViewer)}},{key:"_isScrollModeHorizontal",get:function(){return(0,r.shadow)(this,"_isScrollModeHorizontal",!1)}}])&&o(t.prototype,n),a&&o(t,a),h}();t.PDFSinglePageViewer=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Toolbar=void 0;var i,r=(i=n(2))&&i.__esModule?i:{default:i},a=n(5);function o(e,t,n,i,r,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(i,r)}function s(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n2&&void 0!==arguments[2]?arguments[2]:a.NullL10n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.toolbar=t.container,this.eventBus=n,this.l10n=i,this.buttons=[{element:t.previous,eventName:"previouspage"},{element:t.next,eventName:"nextpage"},{element:t.zoomIn,eventName:"zoomin"},{element:t.zoomOut,eventName:"zoomout"},{element:t.openFile,eventName:"openfile"},{element:t.print,eventName:"print"},{element:t.presentationModeButton,eventName:"presentationmode"},{element:t.download,eventName:"download"},{element:t.viewBookmark,eventName:null}],this.items={numPages:t.numPages,pageNumber:t.pageNumber,scaleSelectContainer:t.scaleSelectContainer,scaleSelect:t.scaleSelect,customScaleOption:t.customScaleOption,previous:t.previous,next:t.next,zoomIn:t.zoomIn,zoomOut:t.zoomOut},this._wasLocalized=!1,this.reset(),this._bindListeners()}var t,n,i;return t=e,(n=[{key:"setPageNumber",value:function(e,t){this.pageNumber=e,this.pageLabel=t,this._updateUIState(!1)}},{key:"setPagesCount",value:function(e,t){this.pagesCount=e,this.hasPageLabels=t,this._updateUIState(!0)}},{key:"setPageScale",value:function(e,t){this.pageScaleValue=(e||t).toString(),this.pageScale=t,this._updateUIState(!1)}},{key:"reset",value:function(){this.pageNumber=0,this.pageLabel=null,this.hasPageLabels=!1,this.pagesCount=0,this.pageScaleValue=a.DEFAULT_SCALE_VALUE,this.pageScale=a.DEFAULT_SCALE,this._updateUIState(!0),this.updateLoadingIndicatorState()}},{key:"_bindListeners",value:function(){var e,t=this,n=this.items,i=n.pageNumber,r=n.scaleSelect,o=this,u=s(this.buttons);try{var l=function(){var n=e.value,i=n.element,r=n.eventName;i.addEventListener("click",function(e){null!==r&&t.eventBus.dispatch(r,{source:t})})};for(u.s();!(e=u.n()).done;)l()}catch(e){u.e(e)}finally{u.f()}i.addEventListener("click",function(){this.select()}),i.addEventListener("change",function(){o.eventBus.dispatch("pagenumberchanged",{source:o,value:this.value})}),r.addEventListener("change",function(){"custom"!==this.value&&o.eventBus.dispatch("scalechanged",{source:o,value:this.value})}),r.oncontextmenu=a.noContextMenuHandler,this.eventBus._on("localized",function(){t._wasLocalized=!0,t._adjustScaleWidth(),t._updateUIState(!0)})}},{key:"_updateUIState",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this._wasLocalized){var t=this.pageNumber,n=this.pagesCount,i=this.pageScaleValue,r=this.pageScale,o=this.items;e&&(this.hasPageLabels?o.pageNumber.type="text":(o.pageNumber.type="number",this.l10n.get("of_pages",{pagesCount:n},"of {{pagesCount}}").then(function(e){o.numPages.textContent=e})),o.pageNumber.max=n),this.hasPageLabels?(o.pageNumber.value=this.pageLabel,this.l10n.get("page_of_pages",{pageNumber:t,pagesCount:n},"({{pageNumber}} of {{pagesCount}})").then(function(e){o.numPages.textContent=e})):o.pageNumber.value=t,o.previous.disabled=t<=1,o.next.disabled=t>=n,o.zoomOut.disabled=r<=a.MIN_SCALE,o.zoomIn.disabled=r>=a.MAX_SCALE;var u=Math.round(1e4*r)/100;this.l10n.get("page_scale_percent",{scale:u},"{{scale}}%").then(function(e){var t,n=!1,r=s(o.scaleSelect.options);try{for(r.s();!(t=r.n()).done;){var a=t.value;a.value===i?(a.selected=!0,n=!0):a.selected=!1}}catch(e){r.e(e)}finally{r.f()}n||(o.customScaleOption.textContent=e,o.customScaleOption.selected=!0)})}}},{key:"updateLoadingIndicatorState",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.items.pageNumber.classList.toggle("visiblePageIsLoading",e)}},{key:"_adjustScaleWidth",value:function(){var e,t=(e=r.default.mark(function e(){var t,n,i,o,u,l,c,d,h,f,p,v,g,m;return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.items,n=this.l10n,i=Promise.all([n.get("page_scale_auto",null,"Automatic Zoom"),n.get("page_scale_actual",null,"Actual Size"),n.get("page_scale_fit",null,"Page Fit"),n.get("page_scale_width",null,"Page Width")]),(o=document.createElement("canvas")).mozOpaque=!0,u=o.getContext("2d",{alpha:!1}),e.next=7,a.animationStarted;case 7:return l=getComputedStyle(t.scaleSelect),c=l.fontSize,d=l.fontFamily,u.font="".concat(c," ").concat(d),h=0,e.t0=s,e.next=13,i;case 13:e.t1=e.sent,f=(0,e.t0)(e.t1);try{for(f.s();!(p=f.n()).done;)v=p.value,g=u.measureText(v),(m=g.width)>h&&(h=m)}catch(e){f.e(e)}finally{f.f()}22,(h+=33)>140&&(t.scaleSelect.style.width="".concat(h+22,"px"),t.scaleSelectContainer.style.width="".concat(h,"px")),o.width=0,o.height=0,o=u=null;case 22:case"end":return e.stop()}},e,this)}),function(){var t=this,n=arguments;return new Promise(function(i,r){var a=e.apply(t,n);function s(e){o(a,i,r,s,u,"next",e)}function u(e){o(a,i,r,s,u,"throw",e)}s(void 0)})});return function(){return t.apply(this,arguments)}}()}])&&l(t.prototype,n),i&&l(t,i),e}();t.Toolbar=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ViewHistory=void 0;var i,r=(i=n(2))&&i.__esModule?i:{default:i};function a(e,t,n,i,r,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(i,r)}function o(e){return function(){var t=this,n=arguments;return new Promise(function(i,r){var o=e.apply(t,n);function s(e){a(o,i,r,s,u,"next",e)}function u(e){a(o,i,r,s,u,"throw",e)}s(void 0)})}}function s(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:u;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.fingerprint=t,this.cacheSize=i,this._initializedPromise=this._readFromStorage().then(function(e){var t=JSON.parse(e||"{}"),i=-1;if(Array.isArray(t.files)){for(;t.files.length>=n.cacheSize;)t.files.shift();for(var r=0,a=t.files.length;r0?(r=t.substring(0,s),o=t.substring(s+1)):(r=t,o=a),i[r]||(i[r]={}),i[r][o]=e[t]}n&&n()})},o)}function h(e,n){e&&(e=e.toLowerCase()),n=n||function(){},i={},r="",o="",o=e;var a=t.querySelectorAll('link[type="application/l10n"]'),s=a.length;if(0!==s){var l,c,h=0;c=function(){++h>=s&&(n(),u="complete")};for(var f=0;f0&&(o=e.substring(r+1),e=e.substring(0,r)),n&&((i={})[o]=n);var s=f(e,t,i);return s&&o in s?s[o]:"{{"+e+"}}"},getData:function(){return i},getText:function(){return r},getLanguage:function(){return o},setLanguage:function(e,t){h(e,function(){t&&t()})},getDirection:function(){var e=o.split("-",1)[0];return["ar","he","fa","ps","ur"].indexOf(e)>=0?"rtl":"ltr"},translate:function(e){for(var n=function(e){return e?e.querySelectorAll("*[data-l10n-id]"):[]}(e=e||t.documentElement),i=n.length,r=0;r=t)return f(t,t,e.l10n),void r();var u=e.currentPage;f(u,t,e.l10n),function(e,t,n,r){var s=o.scratchCanvas,u=(a.AppOptions.get("printResolution")||150)/72;s.width=Math.floor(r.width*u),s.height=Math.floor(r.height*u);var l=Math.floor(r.width*i.CSS_UNITS)+"px",c=Math.floor(r.height*i.CSS_UNITS)+"px",d=s.getContext("2d");return d.save(),d.fillStyle="rgb(255, 255, 255)",d.fillRect(0,0,s.width,s.height),d.restore(),t.getPage(n).then(function(e){var t={canvasContext:d,transform:[u,0,0,u,0,0],viewport:e.getViewport({scale:1,rotation:r.rotation}),intent:"print"};return e.render(t).promise}).then(function(){return{width:l,height:c}})}(0,e.pdfDocument,u+1,e.pagesOverview[u]).then(e.useRenderedPage.bind(e)).then(function(){n(r,s)},s)})},useRenderedPage:function(e){this.throwIfInactive();var t=document.createElement("img");t.style.width=e.width,t.style.height=e.height;var n=this.scratchCanvas;"toBlob"in n&&!this.disableCreateObjectURL?n.toBlob(function(e){t.src=URL.createObjectURL(e)}):t.src=n.toDataURL();var i=document.createElement("div");return i.appendChild(t),this.printContainer.appendChild(i),new Promise(function(e,n){t.onload=e,t.onerror=n})},performPrint:function(){var e=this;return this.throwIfInactive(),new Promise(function(t){setTimeout(function(){e.active?(c.call(window),setTimeout(t,20)):t()},0)})},get active(){return this===o},throwIfInactive:function(){if(!this.active)throw new Error("This print request was cancelled or completed.")}};var l,c=window.print;function d(e){var t=document.createEvent("CustomEvent");t.initCustomEvent(e,!1,!1,"custom"),window.dispatchEvent(t)}function h(){o&&(o.destroy(),d("afterprint"))}function f(e,t,n){var i=document.getElementById("printServiceOverlay"),r=Math.round(100*e/t),a=i.querySelector("progress"),o=i.querySelector(".relative-progress");a.value=r,n.get("print_progress_percent",{progress:r},r+"%").then(function(e){o.textContent=e})}if(window.print=function(){if(o)console.warn("Ignored window.print() because of a pending print job.");else{v().then(function(){o&&s.open("printServiceOverlay")});try{d("beforeprint")}finally{if(!o)return console.error("Expected print service to be initialized."),void v().then(function(){"printServiceOverlay"===s.active&&s.close("printServiceOverlay")});var e=o;o.renderPages().then(function(){return e.performPrint()}).catch(function(){}).then(function(){e.active&&h()})}}},window.addEventListener("keydown",function(e){80!==e.keyCode||!e.ctrlKey&&!e.metaKey||e.altKey||e.shiftKey&&!window.chrome&&!window.opera||(window.print(),e.preventDefault(),e.stopImmediatePropagation?e.stopImmediatePropagation():e.stopPropagation())},!0),"onbeforeprint"in window){var p=function(e){"custom"!==e.detail&&e.stopImmediatePropagation&&e.stopImmediatePropagation()};window.addEventListener("beforeprint",p),window.addEventListener("afterprint",p)}function v(){if(!l){if(!(s=r.PDFViewerApplication.overlayManager))throw new Error("The overlay manager has not yet been initialized.");l=s.register("printServiceOverlay",document.getElementById("printServiceOverlay"),h,!0),document.getElementById("printCancel").onclick=h}return l}r.PDFPrintServiceFactory.instance={supportsPrinting:!0,createPrintService:function(e,t,n,i){if(o)throw new Error("The print service is created and active.");return o=new u(e,t,n,i)}}}]); \ No newline at end of file diff --git a/public/workspace/content/assets/replay.svg b/public/workspace/content/assets/replay.svg deleted file mode 100644 index e8145a0..0000000 --- a/public/workspace/content/assets/replay.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/public/workspace/content/assets/rotate-icon.svg b/public/workspace/content/assets/rotate-icon.svg deleted file mode 100644 index b57d511..0000000 --- a/public/workspace/content/assets/rotate-icon.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/public/workspace/content/assets/timer.svg b/public/workspace/content/assets/timer.svg deleted file mode 100644 index 244b941..0000000 --- a/public/workspace/content/assets/timer.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/public/workspace/content/assets/user.svg b/public/workspace/content/assets/user.svg deleted file mode 100644 index 4d6dafd..0000000 --- a/public/workspace/content/assets/user.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/components/ActionIcon.tsx b/src/components/ActionIcon.tsx new file mode 100644 index 0000000..a244b20 --- /dev/null +++ b/src/components/ActionIcon.tsx @@ -0,0 +1,60 @@ +import React, { useState } from "react"; +import { Box, Typography, Tooltip, useTheme } from "@mui/material"; +import DeleteConfirmation from "./DeleteConfirmation"; + +interface ActionCellProps { + rowData?: any; +} + +const ActionIcon: React.FC = ({ + rowData, + // onEdit, +}) => { + const theme = useTheme(); + const [open, setOpen] = useState(false); + + const handleClose = () => { + setOpen(false); + }; + const handleOpen = () => { + setOpen(true); + }; + return ( + + + { + console.log(rowData); + + handleOpen(); + }} + sx={{ + display: "flex", + flexDirection: "column", + alignItems: "center", + cursor: "pointer", + backgroundColor: "#F8EFE7", + p: "10px", + }} + > + Image + + + + + + ); +}; + +export default ActionIcon; diff --git a/src/components/CollectionEditor.tsx b/src/components/CollectionEditor.tsx index 22828e2..d657565 100644 --- a/src/components/CollectionEditor.tsx +++ b/src/components/CollectionEditor.tsx @@ -1,72 +1,77 @@ import React, { useEffect, useRef, useState } from "react"; import { useRouter } from "next/router"; - +import { v4 as uuidv4 } from "uuid"; +import { + TENANT_ID, + CHANNEL_ID, + FRAMEWORK_ID, + CLOUD_STORAGE_URL, +} from "@/utils/app.config"; +import { + getLocalStoredUserName, + getLocalStoredUserId, +} from "@/services/LocalStorageService"; const CollectionEditor: React.FC = () => { const router = useRouter(); - const { identifier } = router.query; + const { identifier, mode } = router.query; + + const [fullName, setFullName] = useState("Anonymous User"); + const [userId, setUserId] = useState(TENANT_ID); + const [deviceId, setDeviceId] = useState(""); + + const [firstName, lastName] = fullName.split(" "); + + useEffect(() => { + const storedFullName = getLocalStoredUserName(); + const storedUserId = getLocalStoredUserId() || TENANT_ID; + setFullName(storedFullName ?? "Anonymous User"); + setUserId(storedUserId); + + const generatedDeviceId = uuidv4(); + setDeviceId(generatedDeviceId); + }, []); const editorConfig = { context: { user: { - id: "ef99949b-7f3a-4a5f-806a-e67e683e38f3", - fullName: "Rahul", - firstName: "Tekdi", - lastName: "Rahul Tekdi", - orgIds: ["01309282781705830427"], + id: userId, + fullName: fullName, + firstName: firstName || "Anonymous", + lastName: lastName || "User", + orgIds: [CHANNEL_ID], }, identifier: identifier, - channel: "test-k12-channel", - framework: "test_k12_framework", - authToken: " ", - sid: "iYO2K6dOSdA0rwq7NeT1TDzS-dbqduvV", - did: "7e85b4967aebd6704ba1f604f20056b6", - uid: "bf020396-0d7b-436f-ae9f-869c6780fc45", - additionalCategories: [ - { - value: "Textbook", - label: "Textbook", - }, - { - value: "Lesson Plan", - label: "Lesson Plan", - }, - ], + channel: CHANNEL_ID, + framework: FRAMEWORK_ID, + sid: uuidv4(), + did: deviceId, + uid: getLocalStoredUserId() || TENANT_ID, + additionalCategories: [], pdata: { - id: "dev.dock.portal", - ver: "2.8.0", - pid: "creation-portal", + id: "pratham.admin.portal", + ver: "1.0.0", + pid: "pratham-portal", }, contextRollup: { - l1: "01307938306521497658", + l1: CHANNEL_ID, }, - tags: ["01307938306521497658"], + tags: [CHANNEL_ID], cdata: [ { - id: "01307938306521497658", - type: "sourcing_organization", - }, - { - type: "project", - id: "ec5cc850-3f71-11eb-aae1-fb99d9fb6737", - }, - { - type: "linked_collection", - id: "do_113140468925825024117", + id: CHANNEL_ID, + type: "pratham-portal", }, ], timeDiff: 5, - objectRollup: { - l1: "do_113140468925825024117", - l2: "do_113140468926914560125", - }, + objectRollup: {}, host: "", defaultLicense: "CC BY 4.0", endpoint: "/data/v3/telemetry", env: "collection_editor", - cloudStorageUrls: ["https://knowlg-public.s3-ap-south-1.amazonaws.com/"], + cloudStorageUrls: [CLOUD_STORAGE_URL], }, config: { - mode: "edit", // edit / review / read / sourcingReview + mode: mode || "edit", // edit / review / read / sourcingReview maxDepth: 4, objectType: "Collection", primaryCategory: "Course", // Professional Development Course, Curriculum Course @@ -166,6 +171,7 @@ const CollectionEditor: React.FC = () => { // Load Collection Editor CSS if not already loaded if (!document.getElementById("collection-editor-css")) { const link = document.createElement("link"); + console.log("PDF Player loaded"); link.id = "collection-editor-css"; link.rel = "stylesheet"; link.href = @@ -190,6 +196,21 @@ const CollectionEditor: React.FC = () => { "https://cdn.jsdelivr.net/npm/@project-sunbird/sunbird-pdf-player-web-component@1.4.0/styles.css"; document.head.appendChild(pdfLink); } + + const videoScript = document.createElement("script"); + console.log("Video Player loaded"); + videoScript.id = "sunbird-video-player.js"; + videoScript.src = + "https://cdn.jsdelivr.net/npm/@project-sunbird/sunbird-video-player-web-component@1.2.5/sunbird-video-player.js"; + videoScript.async = true; + document.body.appendChild(videoScript); + + const videoLink = document.createElement("link"); + videoLink.id = "sunbird-video-player-css"; + videoLink.rel = "stylesheet"; + videoLink.href = + "https://cdn.jsdelivr.net/npm/@project-sunbird/sunbird-video-player-web-component@1.2.5/styles.css"; + document.head.appendChild(videoLink); }; loadAssets(); @@ -218,7 +239,12 @@ const CollectionEditor: React.FC = () => { "editorEmitter", (event: any) => { console.log("Editor event:", event); - if (event.detail?.action === "backContent") { + if ( + event.detail?.action === "backContent" || + event.detail?.action === "submitContent" || + event.detail?.action === "publishContent" || + event.detail?.action === "rejectContent" + ) { window.history.back(); window.addEventListener( "popstate", diff --git a/src/components/ContentCard.tsx b/src/components/ContentCard.tsx index 6a0a05b..ad9b384 100644 --- a/src/components/ContentCard.tsx +++ b/src/components/ContentCard.tsx @@ -45,9 +45,7 @@ const ContentCard: React.FC = ({ {icon} - - {title} - + {title} {/* diff --git a/src/components/CourseCard.tsx b/src/components/CourseCard.tsx index 86a7a6b..b4e7a29 100644 --- a/src/components/CourseCard.tsx +++ b/src/components/CourseCard.tsx @@ -50,6 +50,7 @@ const CourseCard: React.FC = ({ MIME_TYPE.GENERIC_MIME_TYPE.includes(mimeType) && mode === "review" ) { + sessionStorage.setItem("previousPage", window.location.href); router.push({ pathname: `/workspace/content/review`, query: { identifier, mode }, @@ -90,6 +91,7 @@ const CourseCard: React.FC = ({ display: "flex", flexDirection: "column", width: "250px", + borderRight: 'unset !important' }} > diff --git a/src/components/DeleteConfirmation.tsx b/src/components/DeleteConfirmation.tsx new file mode 100644 index 0000000..aaa050c --- /dev/null +++ b/src/components/DeleteConfirmation.tsx @@ -0,0 +1,109 @@ +import React from "react"; +import { + Dialog, + DialogActions, + DialogContent, + DialogContentText, + DialogTitle, + Button, + IconButton, + Typography, + Box, + Divider, +} from "@mui/material"; +import CloseIcon from "@mui/icons-material/Close"; +import { deleteContent } from "@/services/ContentService"; +import useSharedStore from "@/utils/useSharedState"; + +interface DeleteConfirmationProps { + open: boolean; + handleClose: any; + rowData?: any; +} + +const DeleteConfirmation: React.FC = ({ + open, + rowData, + handleClose, +}) => { + const delay = (ms: number) => new Promise(resolve => setTimeout(resolve, ms)); + + const fetchContentAPI = useSharedStore( + (state: any) => state.fetchContentAPI + ); + const setFetchContentAPI = useSharedStore( + (state: any) => state.setFetchContentAPI + ); + const handleDelete = async (content?: any) => { + console.log(`Deleting item at index`, rowData); + + if (rowData?.identifier && rowData?.mimeType) { + try { + await deleteContent(rowData?.identifier, rowData?.mimeType); + console.log(`Deleted item with identifier - ${rowData?.identifier}`); + await delay(2000); + + // Update the fetchContentAPI state after the delay + setFetchContentAPI(!fetchContentAPI); + } catch (error) { + console.error("Failed to delete content:", error); + } + // setFetchContentAPI(!fetchContentAPI) + + + } + handleClose(); + }; + return ( + + + + Are you sure you want to delete this Resource? + + {/* theme.palette.grey[500], + }} + > + + */} + + + + + + No, go back + + + + + ); +}; + +export default DeleteConfirmation; diff --git a/src/components/GenericEditor.tsx b/src/components/GenericEditor.tsx index 30b92c6..84e9869 100644 --- a/src/components/GenericEditor.tsx +++ b/src/components/GenericEditor.tsx @@ -5,7 +5,8 @@ import _ from 'lodash'; import 'izimodal/css/iziModal.css'; import 'izimodal/js/iziModal.js'; import editorConfig from './editor.config.json'; -import { getLocalStoredUserData } from "@/services/LocalStorageService"; +import { getLocalStoredUserId, getLocalStoredUserName } from "@/services/LocalStorageService"; +import { CHANNEL_ID, FRAMEWORK_ID, TENANT_ID } from "@/utils/app.config"; const GenericEditor: React.FC = () => { const router = useRouter(); @@ -44,6 +45,21 @@ const GenericEditor: React.FC = () => { console.error('Error:', error); closeModal(); }); + + const popstateListener = (event: PopStateEvent) => { + window.location.hash = 'no'; + if (event.state) { + console.log('popstate', event.state); + alert('To close this resource, save and click the X icon'); + window.location.hash = 'no'; + } + }; + window.addEventListener('popstate', popstateListener); + + // Cleanup function + return () => { + window.removeEventListener('popstate', popstateListener); + }; } }, [identifier]); @@ -96,9 +112,19 @@ const GenericEditor: React.FC = () => { if (identifier) { window['context'].contentId = identifier; } - window['context'].user.id = getLocalStoredUserData(); - window['context'].uid = getLocalStoredUserData(); - + window['context'].user = { + id: getLocalStoredUserId() || TENANT_ID, + name: getLocalStoredUserName() || "Anonymous User", + orgIds: [CHANNEL_ID], + organisations: { + [CHANNEL_ID]: CHANNEL_ID + " Channel" + } + } + window['context'].uid = getLocalStoredUserId() || TENANT_ID; + window['context'].contextRollUp.l1 = CHANNEL_ID; + window['context'].tags = [CHANNEL_ID]; + window['context'].channel = CHANNEL_ID; + window['context'].framework = FRAMEWORK_ID; if (isLargeFileUpload || (_.get(data, 'contentDisposition') === 'online-only')) { window.context['uploadInfo'] = { isLargeFileUpload: true @@ -112,7 +138,7 @@ const GenericEditor: React.FC = () => { if (typeof window !== 'undefined') { window['config'] = _.cloneDeep(editorConfig.GENERIC_EDITOR.WINDOW_CONFIG); window['config'].build_number = buildNumber; - window['config'].headerLogo = 'https://staging.sunbirded.org/assets/images/sunbird_logo.png'; + window['config'].headerLogo = '/logo.png'; window['config'].lock = {}; window['config'].extContWhitelistedDomains = extContWhitelistedDomains; window['config'].enableTelemetryValidation = false; diff --git a/src/components/KaTableComponent.tsx b/src/components/KaTableComponent.tsx new file mode 100644 index 0000000..a1e696d --- /dev/null +++ b/src/components/KaTableComponent.tsx @@ -0,0 +1,294 @@ +import React, { useState } from 'react'; +import { Table as KaTable } from 'ka-table'; +import { DataType, EditingMode, SortingMode } from 'ka-table/enums'; +import { Typography, useTheme, IconButton, Box, Grid } from '@mui/material'; +import UpReviewTinyImage from '@mui/icons-material/LibraryBooks'; +import "ka-table/style.css"; +import DeleteIcon from "@mui/icons-material/Delete"; +import router from "next/router"; +import { MIME_TYPE } from "@/utils/app.config"; +import Image from "next/image"; +import ActionIcon from './ActionIcon'; +import { Padding } from '@mui/icons-material'; +interface CustomTableProps { + data: any[]; // Define a more specific type for your data if needed + columns: Array<{ + key: string; + title: string; + dataType: DataType; + }>; + handleDelete?: any; + tableTitle?: string +} + +const KaTableComponent: React.FC = ({ data, columns, tableTitle }) => { + const theme = useTheme(); + const [open, setOpen] = useState(false); + + const handleClose = () => { + setOpen(false); + }; + const handleOpen = () => setOpen(true); + + const openEditor = (content: any) => { + console.log("content", content) + const identifier = content?.identifier; + let mode = content?.mode; // default mode from content, can be overwritten by tableTitle + switch (tableTitle) { + case 'draft': + mode = !mode ? "edit" : mode; + + + // Use draft-specific routing + if (content?.mimeType === MIME_TYPE.QUESTIONSET_MIME_TYPE) { + router.push({ pathname: `/editor`, query: { identifier, mode } }); + } else if ( + content?.mimeType && + MIME_TYPE.GENERIC_MIME_TYPE.includes(content?.mimeType) + ) { + router.push({ pathname: `/upload-editor`, query: { identifier } }); + } else if ( + content?.mimeType && + MIME_TYPE.COLLECTION_MIME_TYPE.includes(content?.mimeType) + ) { + router.push({ pathname: `/collection`, query: { identifier, mode } }); + } + return; // Exit early since draft has specific routing logic + + case 'publish': + mode = "read"; + break; + case 'discover-contents': + mode = "read"; + break; + case 'submitted': + mode = "read"; + break; + case 'upForReview': + mode = "review"; + break; + case 'all-content': + mode=content?.status==="Draft"|| content?.status==="Live" ?"edit":"review" + break; + // Default case for "all-content" or any other values if mode is already defined in content + default: + mode = mode ||"read" ; + break; + } + + // Generic routing for cases other than 'draft' + + if (content?.mimeType === MIME_TYPE.QUESTIONSET_MIME_TYPE ) { + router.push({ pathname: `/editor`, query: { identifier, mode } }); + } + else if ( tableTitle==='submitted') { + router.push({ pathname: `/workspace/content/review`, query: { identifier, mode } }); + } + else if ( tableTitle==='all-content' && mode==="review") { + router.push({ pathname: `/workspace/content/review`, query: { identifier, mode, isReadOnly: true } }); + } + else if ( tableTitle==='discover-contents') { + router.push({ pathname: `/workspace/content/review`, query: { identifier, mode, isDiscoverContent: true } }); + } + else if (content?.mimeType && MIME_TYPE.GENERIC_MIME_TYPE.includes(content?.mimeType)) { + localStorage.setItem('contentCreatedBy', content?.createdBy); + console.log(content) + const pathname = tableTitle === 'upForReview' ? `/workspace/content/review` : `/upload-editor`; + router.push({ pathname, query: { identifier, mode } }); + } else if (content?.mimeType && MIME_TYPE.COLLECTION_MIME_TYPE.includes(content?.mimeType)) { + router.push({ pathname: `/collection`, query: { identifier, mode } }); + } + }; + return ( + <> + { + if (props.column.key === 'name' || props.column.key === "title_and_description") { + return ( +
openEditor(props.rowData)} > + + + {props.rowData.image ? ( + + Image + + ) : props.column.key === 'name' ? ( + + Image + + ) : ( + + Image + + )} + + +
+
+ {props.rowData.name} +
+
+ + {props.column.key === 'name' ? props.rowData.primaryCategory : props.rowData.description} + +
+
+
+
+ + +
+ ); + } + else if (props.column.key === "status") { + if (props.rowData.status === "Draft") { + return ( + + {props.rowData.status} + + ) + } + if (props.rowData.status === "Review") { + return ( + + {props.rowData.status} + + ) + } + if (props.rowData.status === "Live") { + return ( + + {props.rowData.status} + + ) + } + } + else if(props.column.key === "create-by") + { + if(props.rowData.creator) + return ( + + {props.rowData.creator} + + ) + else + return ( + + - + + ) + + } + else if (props.column.key === 'contentAction') { + { + return ( + <> + + + + + + ); + } + } + else if (props.column.key === 'action') { + + + return ( + + + + + + ); + } + return props.children; + }, + }, + }} + noData={{ + text: "No data found", + }} + /> + + + ); +}; + +export default KaTableComponent; diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index e8d7c84..913ac02 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -10,11 +10,13 @@ interface LayoutProps { const Layout: React.FC = ({ children, selectedKey, onSelect }) => { return ( - - - {children} + + + + + {children} - ); + ) }; export default Layout; diff --git a/src/components/Loader.tsx b/src/components/Loader.tsx index f000169..82af67a 100644 --- a/src/components/Loader.tsx +++ b/src/components/Loader.tsx @@ -8,7 +8,7 @@ const Loader: React.FC<{ showBackdrop: boolean; loadingText: string }> = ({ const Spinner = () => { return ( <> - +
{loadingText}... diff --git a/src/components/PaginationComponent.tsx b/src/components/PaginationComponent.tsx index 0e8377f..7a0a70b 100644 --- a/src/components/PaginationComponent.tsx +++ b/src/components/PaginationComponent.tsx @@ -13,12 +13,18 @@ const PaginationComponent: React.FC = ({ onPageChange, }) => { return ( - + ); diff --git a/src/components/QuestionSetEditor.tsx b/src/components/QuestionSetEditor.tsx index 3d5dc8f..0b63c18 100644 --- a/src/components/QuestionSetEditor.tsx +++ b/src/components/QuestionSetEditor.tsx @@ -1,61 +1,65 @@ import React, { useEffect, useRef, useState } from "react"; import { useRouter } from "next/router"; - +import { v4 as uuidv4 } from "uuid"; +import { TENANT_ID, CHANNEL_ID, FRAMEWORK_ID, CLOUD_STORAGE_URL } from "@/utils/app.config"; +import { getLocalStoredUserId, getLocalStoredUserName } from "@/services/LocalStorageService"; const QuestionSetEditor: React.FC = () => { const router = useRouter(); const { identifier, mode } = router.query; + const [fullName, setFullName] = useState("Anonymous User"); + const [userId, setUserId] = useState(TENANT_ID); + const [deviceId, setDeviceId] = useState("7e85b4967aebd6704ba1f604f20056b6"); + + const [firstName, lastName] = fullName.split(" "); + + useEffect(() => { + const storedFullName = getLocalStoredUserName(); + const storedUserId = getLocalStoredUserId() || TENANT_ID; + setFullName(storedFullName ?? "Anonymous User"); + setUserId(storedUserId); + + const generatedDeviceId = uuidv4(); + setDeviceId(generatedDeviceId); + }, []); + const questionSetEditorConfig = { context: { - programId: "", - contributionOrgId: "", user: { - id: "ef99949b-7f3a-4a5f-806a-e67e683e38f3", - fullName: "Rahul Tekdi", - firstName: "Rahul ", - lastName: "Tekdi", - orgIds: ["test-k12-channel"], + id: userId, + fullName: fullName, + firstName: firstName || "Anonymous", + lastName: lastName || "Anonymous", + orgIds: [CHANNEL_ID], }, identifier: identifier, - authToken: " ", - sid: "iYO2K6dOSdA0rwq7NeT1TDzS-dbqduvV", - did: "7e85b4967aebd6704ba1f604f20056b6", - uid: "bf020396-0d7b-436f-ae9f-869c6780fc45", - channel: "test-k12-channel", + sid: uuidv4(), + did: deviceId, + uid: userId, + channel: CHANNEL_ID, pdata: { - id: "dev.dock.portal", - ver: "2.8.0", - pid: "creation-portal", + id: "pratham.admin.portal", + ver: "1.0.0", + pid: "pratham-portal", }, contextRollup: { - l1: "01307938306521497658", + l1: CHANNEL_ID, }, - tags: ["01307938306521497658"], + tags: [CHANNEL_ID], cdata: [ { - id: "01307938306521497658", - type: "sourcing_organization", - }, - { - type: "project", - id: "ec5cc850-3f71-11eb-aae1-fb99d9fb6737", - }, - { - type: "linked_collection", - id: "do_113140468925825024117", - }, + id: CHANNEL_ID, + type: "pratham-portal", + } ], timeDiff: 5, - objectRollup: { - l1: "do_113140468925825024117", - l2: "do_113140468926914560125", - }, + objectRollup: {}, host: "", defaultLicense: "CC BY 4.0", endpoint: "/data/v3/telemetry", env: "questionset_editor", - framework: "test_k12_framework", - cloudStorageUrls: ["https://knowlg-public.s3-ap-south-1.amazonaws.com/"], + framework: FRAMEWORK_ID, + cloudStorageUrls: [CLOUD_STORAGE_URL], labels: { save_collection_btn_label: "Save as Draft", }, @@ -64,7 +68,7 @@ const QuestionSetEditor: React.FC = () => { cloudStorage: { provider: "aws", presigned_headers: {}, - }, + } }, config: { mode: mode || "edit", @@ -140,8 +144,6 @@ const QuestionSetEditor: React.FC = () => { if (!document.getElementById("sunbird-editor-js")) { const script = document.createElement("script"); - console.log("QUESTIONSET EDITOR"); - script.id = "sunbird-editor-js"; script.src = "https://cdn.jsdelivr.net/npm/@tekdi/sunbird-questionset-editor-web-component@3.0.1/sunbird-questionset-editor.js"; @@ -164,7 +166,6 @@ const QuestionSetEditor: React.FC = () => { }; }, []); - // Initialize the editor only after assets are loaded useEffect(() => { if (assetsLoaded && editorRef.current && !isAppendedRef.current) { const questionsetEditorElement = document.createElement( @@ -180,7 +181,8 @@ const QuestionSetEditor: React.FC = () => { "editorEmitter", (event: any) => { console.log("Editor event:", event); - if (event.detail?.action === "backContent") { + if (event.detail?.action === "backContent" || event.detail?.action === "submitContent" || + event.detail?.action === "publishContent" || event.detail?.action === "rejectContent") { window.history.back(); window.addEventListener( "popstate", diff --git a/src/components/SearchBox.tsx b/src/components/SearchBox.tsx index 1cf4c62..9b1cde1 100644 --- a/src/components/SearchBox.tsx +++ b/src/components/SearchBox.tsx @@ -1,30 +1,75 @@ -import React, { useCallback, useState } from "react"; +import React, { useCallback, useEffect, useState } from "react"; import { Box, + Checkbox, + FormControl, Grid, IconButton, InputBase, + InputLabel, + ListItemText, + MenuItem, + OutlinedInput, Paper, + Select, useTheme, + SelectChangeEvent, } from "@mui/material"; import SearchIcon from "@mui/icons-material/Search"; import ClearIcon from "@mui/icons-material/Clear"; import { debounce } from "@/utils/Helper"; +import { getPrimaryCategory } from "@/services/ContentService"; +import { SortOptions , StatusOptions} from "@/utils/app.constant"; export interface SearchBarProps { onSearch: (value: string) => void; value?: string; onClear?: () => void; placeholder: string; + onFilterChange?: (selectedFilters: string[]) => void; + onSortChange?: (sortBy: string) => void; + onStatusChange?: (status: string) => void; + allContents?: boolean } +const sortOptions = SortOptions; + const SearchBox: React.FC = ({ onSearch, value = "", placeholder = "Search...", + onFilterChange, + onSortChange, + onStatusChange, + allContents=false }) => { const theme = useTheme(); const [searchTerm, setSearchTerm] = useState(value); + const [selectedFilters, setSelectedFilters] = useState([]); + const [sortBy, setSortBy] = useState("Modified On"); + const [status, setStatus] = useState("All"); + + const [primaryCategory, setPrimaryCategory] = useState(); + + useEffect(() => { + const PrimaryCategoryData = async () => { + const response = await getPrimaryCategory(); + const collectionPrimaryCategories = + response?.channel?.collectionPrimaryCategories; + const contentPrimaryCategories = + response?.channel?.contentPrimaryCategories; + + const PrimaryCategory = [ + ...collectionPrimaryCategories, + ...contentPrimaryCategories, + ]; + setPrimaryCategory(PrimaryCategory); + localStorage.setItem("PrimaryCategory", JSON.stringify(PrimaryCategory)); + }; + PrimaryCategoryData(); + }, []); + + const filterOptions = primaryCategory; const handleSearchClear = () => { onSearch(""); @@ -41,42 +86,164 @@ const SearchBox: React.FC = ({ const handleChange = (event: React.ChangeEvent) => { const searchTerm = event.target.value; setSearchTerm(searchTerm); - handleSearch(searchTerm); + + if(searchTerm.length>=3) + { + handleSearch(searchTerm); + } + else if(searchTerm.length===0|| searchTerm==="") + { + + handleSearchClear() + handleSearch(searchTerm) + } + + }; + + const handleFilterChange = (event: SelectChangeEvent) => { + const value = event.target.value as string[]; + setSelectedFilters(value); + onFilterChange && onFilterChange(value); }; + const handleSortChange = (event: SelectChangeEvent) => { + const value = event.target.value as string; + setSortBy(value); + onSortChange && onSortChange(value); + }; + + const handleStatusChange = (event: SelectChangeEvent) => { + const value = event.target.value as string; + setStatus(value); + onStatusChange && onStatusChange(value); + }; return ( - - - - - - + + + + e.preventDefault()} + sx={{ + display: "flex", + alignItems: "center", + backgroundColor: theme.palette.warning["A700"], + borderRadius: "8px", + "& .MuiOutlinedInput-root fieldset": { border: "none" }, + "& .MuiOutlinedInput-input": { borderRadius: 8 }, + }} + > + + + {searchTerm ? : } + + + + + + + + Filter By + + + + + + + Sort By + + + + + {allContents && ( + + + Filter By Status + + + + )} - + + ); }; diff --git a/src/components/SideBar.tsx b/src/components/SideBar.tsx index b282a67..a561981 100644 --- a/src/components/SideBar.tsx +++ b/src/components/SideBar.tsx @@ -1,28 +1,47 @@ -import React, { useState } from "react"; -import { useRouter } from "next/router"; +import AddOutlinedIcon from "@mui/icons-material/AddOutlined"; +import AppsOutlinedIcon from "@mui/icons-material/AppsOutlined"; +import ArrowBackIcon from "@mui/icons-material/ArrowBack"; +import CloseIcon from "@mui/icons-material/Close"; +import CreateOutlinedIcon from "@mui/icons-material/CreateOutlined"; +import MenuIcon from "@mui/icons-material/Menu"; +import OutlinedFlagOutlinedIcon from "@mui/icons-material/OutlinedFlagOutlined"; +import PreviewOutlinedIcon from "@mui/icons-material/PreviewOutlined"; import { Box, + Drawer, + IconButton, List, ListItemButton, ListItemIcon, ListItemText, Typography, - IconButton, - Drawer, - useTheme, useMediaQuery, + useTheme, } from "@mui/material"; -import MenuIcon from "@mui/icons-material/Menu"; -import DatabaseIcon from "@mui/icons-material/Storage"; -import CloseIcon from "@mui/icons-material/Close"; -import ArrowBackIcon from "@mui/icons-material/ArrowBack"; +import Image from "next/image"; +import { useRouter } from "next/router"; +import React, { useState } from "react"; +import ManageSearchIcon from '@mui/icons-material/ManageSearch'; +import logo from "/public/logo.png"; +import { Role } from "@/utils/app.constant"; +import { getLocalStoredUserRole } from "@/services/LocalStorageService"; +const userRole = getLocalStoredUserRole(); +// Updated menu items with icons const menuItems = [ - { text: "Create", key: "create" }, - { text: "All My Contents", key: "allContents" }, - { text: "Draft", key: "draft" }, - { text: "Submitted for Review", key: "submitted" }, - { text: "Publish", key: "publish" }, + { text: "Create", key: "create", icon: }, + { text: "Drafts", key: "draft", icon: }, + ...(userRole !== Role.CCTA + ? [{ text: "Submitted for Review", key: "submitted", icon: }, + ] + : []), + ...(userRole === Role.CCTA + ? [{ text: "Up for Review", key: "up-review", icon: }] + : []), + { text: "My Published Contents", key: "publish", icon: }, + { text: "All My Contents", key: "allContents", icon: }, + { text: "Discover Contents", key: "discover-contents", icon: }, + ]; interface SidebarProps { @@ -34,7 +53,7 @@ const Sidebar: React.FC = ({ selectedKey, onSelect }) => { const [drawerOpen, setDrawerOpen] = useState(false); const router = useRouter(); const theme = useTheme(); - const isMobile = useMediaQuery(theme.breakpoints.down("sm")); + const isMobile = useMediaQuery(theme.breakpoints.down("md")); const handleNavigation = (key: string) => { console.log(key); @@ -49,18 +68,43 @@ const Sidebar: React.FC = ({ selectedKey, onSelect }) => { setDrawerOpen(!drawerOpen); }; + const goBack = () => { + if (typeof window !== "undefined" && window.localStorage) { + const userInfo = JSON.parse(localStorage.getItem("adminInfo") || "{}"); + console.log("userInfo", userInfo); + if (userInfo?.role === Role.SCTA || userInfo?.role === Role.CCTA) { + router.push("/course-planner"); + + } + else router.push("/"); - }; + }}; const drawerContent = ( - + + + logo + + @@ -70,9 +114,9 @@ const Sidebar: React.FC = ({ selectedKey, onSelect }) => { - Workspace + Back to Main Page {isMobile && ( @@ -85,7 +129,7 @@ const Sidebar: React.FC = ({ selectedKey, onSelect }) => { {menuItems.map((item) => ( = ({ selectedKey, onSelect }) => { selectedKey === item.key ? "var(--mui-palette-primary-main)" : "transparent", - color: - selectedKey === item.key - ? "#2E1500" - : theme.palette.warning.A200, + color: "#000", + + fontSize: '16px !important' , "&:hover": { background: @@ -105,11 +148,25 @@ const Sidebar: React.FC = ({ selectedKey, onSelect }) => { ? "var(--mui-palette-primary-main)" : "transparent", }, + margin: selectedKey === item.key ? "10px 0" : "0", }} - key={item.key} - onClick={() => handleNavigation(item.key)} + key={item?.key} + onClick={() => handleNavigation(item?.key)} > - + + {item?.icon} + + ))} @@ -120,17 +177,15 @@ const Sidebar: React.FC = ({ selectedKey, onSelect }) => { <> {isMobile ? ( <> - - - + + + = ({ selectedKey, onSelect }) => { sx={{ display: "flex", justifyContent: "flex-start", - width: 250, - height: "100vh", - bgcolor: theme.palette.background.paper, - borderRight: 1, - borderColor: theme.palette.divider, + width: 284, + }} > {drawerContent} @@ -159,4 +211,4 @@ const Sidebar: React.FC = ({ selectedKey, onSelect }) => { ); }; -export default Sidebar; +export default Sidebar; \ No newline at end of file diff --git a/src/components/V1-Player/V1Player.tsx b/src/components/V1-Player/V1Player.tsx new file mode 100644 index 0000000..03a8758 --- /dev/null +++ b/src/components/V1-Player/V1Player.tsx @@ -0,0 +1,50 @@ +import React, { useRef, useEffect } from 'react'; + +interface PlayerProps { + playerConfig: any; +} + +const V1Player = ({ playerConfig }: PlayerProps) => { + const previewRef = useRef(null); + + useEffect(() => { + const preview: any = previewRef.current; + if (preview) { + const originalSrc = preview.src; + preview.src = ''; + preview.src = originalSrc; + + const handleLoad = () => { + setTimeout(() => { + if (preview.contentWindow && preview.contentWindow.initializePreview) { + preview.contentWindow.initializePreview(playerConfig); + } + preview.contentWindow.addEventListener('message', (event: any) => { // NOSONAR + console.log('V1 player event', event); + }); + }, 100); + }; + + preview.addEventListener('load', handleLoad); + + return () => { + preview.removeEventListener('load', handleLoad); + }; + } + }, [playerConfig]); + + return ( +
+ +
+ ); +}; + +export default V1Player; diff --git a/src/components/WorkspaceText.tsx b/src/components/WorkspaceText.tsx new file mode 100644 index 0000000..86bbcea --- /dev/null +++ b/src/components/WorkspaceText.tsx @@ -0,0 +1,48 @@ +import { Box, Typography, useTheme } from "@mui/material" +import React from "react"; + + +const WorkspaceText: React.FC = () => { + const theme = useTheme(); + + return ( + + Workspace + + + + Create, organize, and manage all types of content in one place. + Whether it's courses, assessments, or any other type of content. + + ) +} + +export default WorkspaceText; \ No newline at end of file diff --git a/src/components/editor.config.json b/src/components/editor.config.json index dd4178c..31a5d33 100644 --- a/src/components/editor.config.json +++ b/src/components/editor.config.json @@ -78,12 +78,12 @@ "WINDOW_CONTEXT": { "user": { "id": "", - "name": "Rahul Tekdi", + "name": "", "orgIds": [ - "test-k12-channel" + "" ], "organisations": { - "test-k12-channel": "Test Channel" + "channel-id": "channel Name" } }, "did": "", @@ -95,14 +95,14 @@ "pid": "admin-portal.genericEditor" }, "contextRollUp": { - "l1": "test-k12-channel" + "l1": "" }, "tags": [ - "test-k12-channel" + "" ], - "channel": "test-k12-channel", + "channel": "", "env": "generic-editor", - "framework": "test_k12_framework", + "framework": "", "ownershipType": [ "createdBy", "createdFor" diff --git a/src/components/players/PlayerConfig.js b/src/components/players/PlayerConfig.js index 8ff2090..6c2409e 100644 --- a/src/components/players/PlayerConfig.js +++ b/src/components/players/PlayerConfig.js @@ -3,20 +3,20 @@ export const playerConfig = { mode: "play", partner: [], pdata: { - id: "dev.sunbird.portal", - ver: "5.2.0", - pid: "sunbird-portal", + id: "pratham.admin.portal", + ver: "1.0.0", + pid: "admin-portal", }, - contentId: "do_21374910251798528014586", - sid: "6d1898db-d783-4f83-8b92-4a36636e0d2f", - uid: "fb6b2e58-0f14-4d4f-90e4-bae092e7a235", + contentId: "do_12345", + sid: "", + uid: "", timeDiff: -0.089, - channel: "01269878797503692810", - tags: ["01269878797503692810"], - did: "3ca74a4c5fbce6b7b7f5cd12cebb1682", - contextRollup: { l1: "01269878797503692810" }, + channel: "", + tags: [""], + did: "", + contextRollup: {}, objectRollup: {}, - userData: { firstName: "Guest", lastName: "" }, + userData: { firstName: "Guest", lastName: "User"}, //telemetry host: "https://telemetry.prathamdigital.org", @@ -41,13 +41,92 @@ export const playerConfig = { { id: "org.sunbird.player.endpage", ver: 1.1, type: "plugin" }, ], sideMenu: { - showShare: true, + showShare: false, showDownload: true, showExit: true, - showPrint: true, + showPrint: false, showReplay: true, }, }, metadata: {}, data: {}, }; + +export const V1PlayerConfig = { + config: { + whiteListUrl: [], + showEndPage: false, + endPage: [ + { + template: "assessment", + contentType: ["SelfAssess"], + }, + ], + showStartPage: true, + host: "", + overlay: { + enableUserSwitcher: true, + showOverlay: true, + showNext: true, + showPrevious: true, + showSubmit: false, + showReload: false, + showUser: false, + menu: { + showTeachersInstruction: false, + }, + }, + splash: { + text: "", + icon: "", + bgImage: "assets/icons/splacebackground_1.png", + webLink: "", + }, + apislug: "/action", + repos: ["/sunbird-plugins/renderer"], + plugins: [ + { + id: "org.sunbird.iframeEvent", + ver: 1, + type: "plugin", + }, + { + id: "org.sunbird.player.endpage", + ver: 1.1, + type: "plugin", + }, + ], + sideMenu: { + showShare: true, + showDownload: true, + showExit: false, + }, + enableTelemetryValidation: false, + }, + context: { + mode: "play", + partner: [], + pdata: { + id: "pratham.admin.portal", + ver: "1.0.0", + pid: "admin-portal", + }, + contentId: "do_12345", + sid: "", + uid: "", + timeDiff: -1.129, + contextRollup: {}, + channel: "", + did: "", + dims: [], + tags: [""], + app: [""], + cdata: [], + userData: { + firstName: "Guest", + lastName: "User", + }, + }, + data: {}, + metadata: {} +}; diff --git a/src/components/players/Players.tsx b/src/components/players/Players.tsx index f974fe8..7c365a4 100644 --- a/src/components/players/Players.tsx +++ b/src/components/players/Players.tsx @@ -33,10 +33,12 @@ interface PlayerProps { } const Players = ({ playerConfig }: PlayerProps) => { - const mimeType = playerConfig.metadata.mimeType; + const mimeType = playerConfig?.metadata?.mimeType; switch (mimeType) { case "application/pdf": return ; + case "video/webm": + return ; case "video/mp4": return ; case "application/vnd.sunbird.questionset": diff --git a/src/components/players/SunbirdEpubPlayer.tsx b/src/components/players/SunbirdEpubPlayer.tsx index 80a1894..77cbf25 100644 --- a/src/components/players/SunbirdEpubPlayer.tsx +++ b/src/components/players/SunbirdEpubPlayer.tsx @@ -1,6 +1,7 @@ import "reflect-metadata"; import React, { useEffect } from "react"; import { useRef } from "react"; +import { handleExitEvent } from "@/utils/Helper"; interface PlayerConfigProps { playerConfig: any; @@ -27,6 +28,9 @@ const SunbirdEpubPlayer = ({ playerConfig }: PlayerConfigProps) => { const handlePlayerEvent = (event: any) => { console.log("Player Event", event.detail); + if (event?.detail?.edata?.type === "EXIT") { + handleExitEvent(); + } }; const handleTelemetryEvent = (event: any) => { console.log("Telemetry Event", event.detail); diff --git a/src/components/players/SunbirdPdfPlayer.tsx b/src/components/players/SunbirdPdfPlayer.tsx index 38cb4dc..8e8fa4f 100644 --- a/src/components/players/SunbirdPdfPlayer.tsx +++ b/src/components/players/SunbirdPdfPlayer.tsx @@ -1,6 +1,7 @@ import "reflect-metadata"; import React, { useEffect } from "react"; import { useRef } from "react"; +import { handleExitEvent } from "@/utils/Helper"; interface PlayerConfigProps { playerConfig: any; @@ -17,16 +18,21 @@ const SunbirdPdfPlayer = ({ playerConfig }: PlayerConfigProps) => { script.async = true; document.body.appendChild(script); - const link = document.createElement("link"); - link.rel = "stylesheet"; - link.href = - "https://cdn.jsdelivr.net/npm/@project-sunbird/sunbird-pdf-player-web-component@1.4.0/styles.css"; - document.head.appendChild(link); - + if (!document.getElementById("sunbird-pdf-player-css")) { + const link = document.createElement("link"); + link.id = "sunbird-pdf-player-css"; + link.rel = "stylesheet"; + link.href = + "https://cdn.jsdelivr.net/npm/@project-sunbird/sunbird-pdf-player-web-component@1.4.0/styles.css"; + document.head.appendChild(link); + } const playerElement = sunbirdPdfPlayerRef.current; const handlePlayerEvent = (event: any) => { console.log("Player Event", event.detail); + if (event?.detail?.edata?.type === "EXIT") { + handleExitEvent(); + } }; const handleTelemetryEvent = (event: any) => { console.log("Telemetry Event", event.detail); @@ -45,6 +51,8 @@ const SunbirdPdfPlayer = ({ playerConfig }: PlayerConfigProps) => { handleTelemetryEvent ); document.body.removeChild(script); + const pdfPlayerCss = document.getElementById("sunbird-pdf-player-css"); + if (pdfPlayerCss) document.head.removeChild(pdfPlayerCss); }; }, []); @@ -58,4 +66,4 @@ const SunbirdPdfPlayer = ({ playerConfig }: PlayerConfigProps) => { ); }; -export default SunbirdPdfPlayer; +export default SunbirdPdfPlayer; \ No newline at end of file diff --git a/src/components/players/SunbirdQuMLPlayer.tsx b/src/components/players/SunbirdQuMLPlayer.tsx index ecbd7ae..e93cad3 100644 --- a/src/components/players/SunbirdQuMLPlayer.tsx +++ b/src/components/players/SunbirdQuMLPlayer.tsx @@ -1,65 +1,69 @@ import "reflect-metadata"; import React, { useEffect } from "react"; import { useRef } from "react"; -import $ from 'jquery'; +import $ from "jquery"; +import { handleExitEvent } from "@/utils/Helper"; interface PlayerConfigProps { - playerConfig: any; + playerConfig: any; } const SunbirdQuMLPlayer = ({ playerConfig }: PlayerConfigProps) => { - const SunbirdQuMLPlayerRef = useRef(null); + const SunbirdQuMLPlayerRef = useRef(null); - useEffect(() => { - if (typeof window !== 'undefined') { - window.$ = window.jQuery = $; - window.questionListUrl = "/action/question/v2/list"; - } + useEffect(() => { + if (typeof window !== "undefined") { + window.$ = window.jQuery = $; + window.questionListUrl = "/api/question/v2/list"; + } - const script = document.createElement("script"); - script.src = - "https://cdn.jsdelivr.net/npm/@project-sunbird/sunbird-quml-player-web-component@3.0.0/sunbird-quml-player.js"; - script.async = true; - document.body.appendChild(script); + const script = document.createElement("script"); + script.src = + "https://cdn.jsdelivr.net/npm/@project-sunbird/sunbird-quml-player-web-component@3.0.0/sunbird-quml-player.js"; + script.async = true; + document.body.appendChild(script); - const link = document.createElement("link"); - link.rel = "stylesheet"; - link.href = - "https://cdn.jsdelivr.net/npm/@project-sunbird/sunbird-quml-player-web-component@3.0.0/styles.css"; - document.head.appendChild(link); + const link = document.createElement("link"); + link.rel = "stylesheet"; + link.href = + "https://cdn.jsdelivr.net/npm/@project-sunbird/sunbird-quml-player-web-component@3.0.0/styles.css"; + document.head.appendChild(link); - const playerElement = SunbirdQuMLPlayerRef.current; + const playerElement = SunbirdQuMLPlayerRef.current; - const handlePlayerEvent = (event: any) => { - console.log("Player Event", event.detail); - }; - const handleTelemetryEvent = (event: any) => { - console.log("Telemetry Event", event.detail); - }; + const handlePlayerEvent = (event: any) => { + console.log("Player Event", event.detail); + if (event?.detail?.edata?.type === "EXIT") { + handleExitEvent(); + } + }; + const handleTelemetryEvent = (event: any) => { + console.log("Telemetry Event", event.detail); + }; - // Ensure the script has loaded before adding event listeners - script.onload = () => { - playerElement?.addEventListener("playerEvent", handlePlayerEvent); - playerElement?.addEventListener("telemetryEvent", handleTelemetryEvent); - }; + // Ensure the script has loaded before adding event listeners + script.onload = () => { + playerElement?.addEventListener("playerEvent", handlePlayerEvent); + playerElement?.addEventListener("telemetryEvent", handleTelemetryEvent); + }; - return () => { - playerElement?.removeEventListener("playerEvent", handlePlayerEvent); - playerElement?.removeEventListener( - "telemetryEvent", - handleTelemetryEvent - ); - document.body.removeChild(script); - }; - }, []); + return () => { + playerElement?.removeEventListener("playerEvent", handlePlayerEvent); + playerElement?.removeEventListener( + "telemetryEvent", + handleTelemetryEvent + ); + document.body.removeChild(script); + }; + }, []); - return ( -
- -
- ); + return ( +
+ +
+ ); }; export default SunbirdQuMLPlayer; diff --git a/src/components/players/SunbirdVideoPlayer.tsx b/src/components/players/SunbirdVideoPlayer.tsx index d856265..618e155 100644 --- a/src/components/players/SunbirdVideoPlayer.tsx +++ b/src/components/players/SunbirdVideoPlayer.tsx @@ -1,3 +1,4 @@ +import { handleExitEvent } from "@/utils/Helper"; import { Height } from "@mui/icons-material"; import React, { useEffect, useRef } from "react"; @@ -26,7 +27,11 @@ const SunbirdVideoPlayer = ({ playerConfig }: PlayerConfigProps) => { const handlePlayerEvent = (event: any) => { console.log("Player Event", event.detail); + if (event?.detail?.type === "EXIT") { + handleExitEvent(); + } }; + const handleTelemetryEvent = (event: any) => { console.log("Telemetry Event", event.detail); }; diff --git a/src/pages/api/fileUpload.ts b/src/pages/api/fileUpload.ts index 153c605..66f82f1 100644 --- a/src/pages/api/fileUpload.ts +++ b/src/pages/api/fileUpload.ts @@ -2,6 +2,7 @@ import multer, { MulterError } from 'multer'; import FormData from 'form-data'; import axios from 'axios'; import type { NextApiRequest, NextApiResponse } from 'next'; +const cookie = require("cookie"); const upload = multer({ limits: { @@ -46,6 +47,7 @@ const uploadPromise = (req: NextApiRequest, res: NextApiResponse) => { // Main handler function for Next.js API route export default async function handler(req: NextApiRequest, res: NextApiResponse) { + // Handle only POST requests if (req.method !== 'POST') { return res.status(405).json({ message: 'Method not allowed' }); @@ -79,10 +81,14 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) } } + const cookies = cookie.parse(req.headers.cookie || ""); + // Set your base URL const baseURL = process.env.BASE_URL as string; - const authApiToken = process.env.AUTH_API_TOKEN as string; - const tenantId = process.env.TENANT_ID as string; + const authApiToken = cookies?.authToken || process.env.AUTH_API_TOKEN; + const tenantId = process.env.NEXT_PUBLIC_TENANT_ID as string; + + console.log("Using token for file upload:", authApiToken); // Extract the relative URL from the incoming request (after /action) const relativePath = req.url?.replace('/api/fileUpload', '') ?? ''; diff --git a/src/pages/api/mocked-response.ts b/src/pages/api/mocked-response.ts index e08c3b4..aa3f958 100644 --- a/src/pages/api/mocked-response.ts +++ b/src/pages/api/mocked-response.ts @@ -70,26 +70,12 @@ export const genericEditorSaveFormResponse = { "required": false, "visible": true }, - { - "code": "medium", - "dataType": "List", - "description": "Language", - "editable": true, - "index": 8, - "inputType": "select", - "label": "Language", - "name": "Langauge", - "placeholder": "Select Language", - "renderingHints": {}, - "required": false, - "visible": true - }, { "code": "audience", "dataType": "list", "description": "Audience", "editable": true, - "index": 8, + "index": 5, "inputType": "multiselect", "label": "Audience", "name": "Audience", @@ -106,10 +92,6 @@ export const genericEditorSaveFormResponse = { "key": "Administrator", "name": "Administrator" }, - { - "key": "Teacher", - "name": "Teacher" - }, { "key": "Other", "name": "Other" @@ -119,20 +101,6 @@ export const genericEditorSaveFormResponse = { "renderingHints": {}, "required": false, "visible": true - }, - { - "code": "attributions", - "dataType": "list", - "description": "Attributions", - "editable": true, - "index": 8, - "inputType": "text", - "label": "Attributions", - "name": "attribution", - "placeholder": "", - "renderingHints": {}, - "required": false, - "visible": true } ] }, @@ -186,7 +154,7 @@ export const genericEditorReviewFormResponse = { "inputType": "text", "label": "Title", "name": "Title", - "placeholder": "Enter Title For Book", + "placeholder": "Enter Title", "renderingHints": {}, "required": false, "visible": true @@ -219,19 +187,41 @@ export const genericEditorReviewFormResponse = { "visible": true }, { - "code": "board", + "code": "state", "visible": true, "depends": [ + "board", "medium", "gradeLevel", + "courseType", "subject", "topic" ], "editable": true, "dataType": "text", "renderingHints": {}, + "description": "State", + "index": 5, + "label": "State", + "required": true, + "name": "State", + "inputType": "select", + "placeholder": "State" + }, + { + "code": "board", + "visible": true, + "depends": [ + "medium", + "gradeLevel", + "courseType", + "subject" + ], + "editable": true, + "dataType": "text", + "renderingHints": {}, "description": "Board", - "index": 7, + "index": 6, "label": "Board/Syllabus", "required": true, "name": "Board/Syllabus", @@ -243,14 +233,14 @@ export const genericEditorReviewFormResponse = { "visible": true, "depends": [ "gradeLevel", - "subject", - "topic" + "courseType", + "subject" ], "editable": true, "dataType": "list", "renderingHints": {}, "description": "", - "index": 8, + "index": 7, "label": "Medium", "required": true, "name": "medium", @@ -261,14 +251,14 @@ export const genericEditorReviewFormResponse = { "code": "gradeLevel", "visible": true, "depends": [ - "subject", - "topic" + "courseType", + "subject" ], "editable": true, "dataType": "list", "renderingHints": {}, "description": "Class", - "index": 9, + "index": 8, "label": "Class", "required": true, "name": "Class", @@ -276,42 +266,43 @@ export const genericEditorReviewFormResponse = { "placeholder": "Select Class" }, { - "code": "subject", + "code": "courseType", "visible": true, "depends": [ - "topic" + "subject" ], "editable": true, "dataType": "list", "renderingHints": {}, "description": "", - "index": 10, - "label": "Subject", + "index": 9, + "label": "Course Type", "required": true, - "name": "Subject", + "name": "Course Type", "inputType": "multiselect", - "placeholder": "Select Subject" + "placeholder": "Course Type" }, { - "code": "medium", - "dataType": "list", - "description": "Language", + "code": "subject", + "visible": true, + "depends": [], "editable": true, - "index": 8, - "inputType": "select", - "label": "Language", - "name": "Langauge", - "placeholder": "Select Language", + "dataType": "list", "renderingHints": {}, - "required": false, - "visible": true + "description": "", + "index": 10, + "label": "Subject", + "required": true, + "name": "Subject", + "inputType": "multiselect", + "placeholder": "Select Subject" }, { "code": "audience", "dataType": "list", "description": "Audience", "editable": true, - "index": 8, + "index": 11, "inputType": "multiselect", "label": "Audience", "name": "Audience", @@ -337,20 +328,6 @@ export const genericEditorReviewFormResponse = { "renderingHints": {}, "required": false, "visible": true - }, - { - "code": "attributions", - "dataType": "list", - "description": "Attributions", - "editable": true, - "index": 8, - "inputType": "text", - "label": "Attributions", - "name": "attribution", - "placeholder": "", - "renderingHints": {}, - "required": false, - "visible": true } ] }, diff --git a/src/pages/api/proxy.ts b/src/pages/api/proxy.ts index 5465e7d..7b5d2d0 100644 --- a/src/pages/api/proxy.ts +++ b/src/pages/api/proxy.ts @@ -4,11 +4,9 @@ import { telemetryResponse, creatLockResponse, genericEditorReviewFormResponse, - genericEditorRequestForChangesFormResponse + genericEditorRequestForChangesFormResponse, } from "./mocked-response"; -const cookie = require("cookie"); - -let storedToken: string | null = null; +import * as cookie from "cookie"; export default async function handler( req: NextApiRequest, @@ -18,13 +16,15 @@ export default async function handler( const { path } = query; const BASE_URL = process.env.BASE_URL as string; - const TENANT_ID = process.env.TENANT_ID as string; const API_KEY = process.env.AUTH_API_TOKEN as string; + const NEXT_PUBLIC_TENANT_ID = process.env.NEXT_PUBLIC_TENANT_ID as string; + const NEXT_PUBLIC_CHANNEL_ID = process.env.NEXT_PUBLIC_CHANNEL_ID as string; const cookies = cookie.parse(req.headers.cookie || ""); - const tokenFromCookie = cookies.authToken; - const token = API_KEY; + console.log(cookies?.authToken); + + const token = cookies?.authToken || API_KEY; if (!token) { console.error("No valid token available"); @@ -34,6 +34,7 @@ export default async function handler( console.log("Using token:", token); let pathString = Array.isArray(path) ? path.join("/") : (path as string); + // Handle mocked responses if (pathString === "/action/data/v3/telemetry") { return res.status(200).json(telemetryResponse); @@ -68,24 +69,27 @@ export default async function handler( queryString ? `?${queryString}` : "" }`; - console.log('targetUrl =====>', targetUrl); + console.log("targetUrl =====>", targetUrl); try { const options: RequestInit = { method, headers: { "Content-Type": "application/json", - Authorization: `Bearer ${token}`, - tenantId: TENANT_ID, - "X-Channel-Id": "test-k12-channel", + "Authorization": `Bearer ${token}`, + "tenantId": NEXT_PUBLIC_TENANT_ID, + "X-Channel-Id": NEXT_PUBLIC_CHANNEL_ID, }, ...(method === "POST" || method === "PATCH" ? { body: JSON.stringify(body) } : {}), }; + console.log("options =====>", options); const response = await fetch(targetUrl, options); + console.log("response =====>", response); const data = await response.json(); + console.log("data =====>", data); res.status(response.status).json(data); } catch (error: any) { console.error("Error in proxy:", error.message); diff --git a/src/pages/sunbirdPlayers.tsx b/src/pages/sunbirdPlayers.tsx index 8348f8d..4e3809a 100644 --- a/src/pages/sunbirdPlayers.tsx +++ b/src/pages/sunbirdPlayers.tsx @@ -28,15 +28,22 @@ const SunbirdQuMLPlayer = dynamic( } ); +const SunbirdV1Player = dynamic( + () => import("@/components/V1-Player/V1Player"), + { + ssr: false, + } +); + interface PlayerProps { - playerConfig: any; + "player-config": any; identifier: string; } -const SunbirdPlayers = ({ playerConfig }: PlayerProps) => { +const SunbirdPlayers = ({ "player-config": playerConfig }: PlayerProps) => { console.log("workspace playerconfig", playerConfig); - const mimeType = playerConfig.metadata.mimeType; + const mimeType = playerConfig?.metadata?.mimeType; switch (mimeType) { case "application/pdf": return ; @@ -46,6 +53,12 @@ const SunbirdPlayers = ({ playerConfig }: PlayerProps) => { return ; case "application/epub": return ; + case "application/vnd.ekstep.h5p-archive": + case "application/vnd.ekstep.html-archive": + case "video/youtube": + case "video/x-youtube": + // return ; + return ; default: return
Unsupported media type
; } diff --git a/src/pages/workspace/content/allContents/index.tsx b/src/pages/workspace/content/allContents/index.tsx index b71cb76..9b9ff70 100644 --- a/src/pages/workspace/content/allContents/index.tsx +++ b/src/pages/workspace/content/allContents/index.tsx @@ -23,7 +23,28 @@ import { MIME_TYPE } from "@/utils/app.config"; import router from "next/router"; import PaginationComponent from "@/components/PaginationComponent"; import { LIMIT } from "@/utils/app.constant"; +import WorkspaceText from "@/components/WorkspaceText"; +import { Table as KaTable } from 'ka-table'; +import { DataType } from 'ka-table/enums'; +import "ka-table/style.css"; +import KaTableComponent from "@/components/KaTableComponent"; +import useSharedStore from "@/utils/useSharedState"; +// const columns = [ +// { key: 'name', title: 'Content', dataType: DataType.String, width: "450px" }, +// { key: 'lastUpdatedOn', title: 'Last Updated', dataType: DataType.String, width: "300px" }, +// { key: 'status', title: 'Status', dataType: DataType.String, width: "300px" }, +// { key: 'contentAction', title: 'Action', dataType: DataType.String, width: "200px" }, +// ] +const columns = [ + { key: 'title_and_description', title: 'TITLE & DESCRIPTION', dataType: DataType.String, width: "450px" }, + { key: 'contentType', title: 'CONTENT TYPE', dataType: DataType.String, width: "200px" }, + { key: 'status', title: 'STATUS', dataType: DataType.String, width: "100px" }, + { key: 'lastUpdatedOn', title: 'LAST MODIFIED', dataType: DataType.String, width: "180px" }, + { key: 'contentAction', title: 'ACTION', dataType: DataType.String, width: "100px" }, + + +] const AllContentsPage = () => { const theme = useTheme(); @@ -31,15 +52,22 @@ const AllContentsPage = () => { const [page, setPage] = useState(0); const [rowsPerPage, setRowsPerPage] = useState(10); const [searchTerm, setSearchTerm] = useState(""); - const [filter, setFilter] = useState("all"); - const [sortBy, setSortBy] = useState("updated"); - const [contentList, setContentList] = React.useState([]); + const [filter, setFilter] = useState([]); + const [sortBy, setSortBy] = useState("Modified On"); + const [statusBy, setStatusBy] = useState("All"); + + const [contentList, setContentList] = React.useState([]); + const [data, setData] = React.useState([]); + const [loading, setLoading] = useState(false); const [contentDeleted, setContentDeleted] = React.useState(false); + const fetchContentAPI = useSharedStore( + (state: any) => state.fetchContentAPI + ); const [debouncedSearchTerm, setDebouncedSearchTerm] = useState(searchTerm); const [totalCount, setTotalCount] = useState(0); - + const handleChangePage = (event: unknown, newPage: number) => { setPage(newPage - 1); }; @@ -65,32 +93,24 @@ const AllContentsPage = () => { setSearchTerm(term); }; - const handleFilterChange = (filter: string) => { + const handleFilterChange = (filter: string[]) => { setFilter(filter); }; const handleSortChange = (sortBy: string) => { + console.log("sortBy", sortBy) setSortBy(sortBy); }; - - const openEditor = (content: any) => { - const identifier = content?.identifier; - const mode = content?.mode; - if (content?.mimeType === MIME_TYPE.QUESTIONSET_MIME_TYPE) { - router.push({ pathname: `/editor`, query: { identifier, mode } }); - } else if ( - content?.mimeType && - MIME_TYPE.GENERIC_MIME_TYPE.includes(content?.mimeType) - ) { - router.push({ pathname: `/upload-editor`, query: { identifier } }); - } + const handleStatusChange = (statusBy: string) => { + setStatusBy(statusBy); }; + useEffect(() => { const getContentList = async () => { try { setLoading(true); - const status = [ + let status=[ "Draft", "FlagDraft", "Review", @@ -99,9 +119,48 @@ const AllContentsPage = () => { "Unlisted", "FlagReview", ]; + if (statusBy === "" || statusBy === "All") { + status = [ + "Draft", + "FlagDraft", + "Review", + "Processing", + "Live", + "Unlisted", + "FlagReview", + ]; + } + else if (statusBy === "Live") { + status = ["Live"]; + } + else if (statusBy === "Review") { + status = ["Review"]; + } + else if (statusBy === "Draft") { + status = ["Draft"]; + } + else if (statusBy === "Unlisted") { + status = ["Unlisted"]; + } + else if (statusBy === "FlagReview") { + status = ["FlagReview"]; + } + const query = debouncedSearchTerm || ""; + const primaryCategory = filter.length ? filter : []; + const order = sortBy === "Created On" ? "asc" : "desc"; + const sort_by = { + lastUpdatedOn: order, + }; const offset = page * LIMIT; - const response = await getContent(status, query, LIMIT, offset); + const response = await getContent( + status, + query, + LIMIT, + offset, + primaryCategory, + sort_by + ); const contentList = (response?.content || []).concat( response?.QuestionSet || [] ); @@ -113,21 +172,27 @@ const AllContentsPage = () => { } }; getContentList(); - }, [debouncedSearchTerm, contentDeleted, page]); + }, [debouncedSearchTerm, filter,fetchContentAPI, sortBy, statusBy, page]); - const handleDeleteClick = async (content: any) => { - if (content?.identifier && content?.mimeType) { - try { - await deleteContent(content?.identifier, content?.mimeType); - console.log(`Deleted item with identifier - ${content?.identifier}`); - setTimeout(() => { - setContentDeleted((prev) => !prev); - }, 1000); - } catch (error) { - console.error("Failed to delete content:", error); - } - } - }; + useEffect(() => { + const filteredArray = contentList.map(item => ({ + image: item?.appIcon, + contentType: item.primaryCategory, + name: item.name, + primaryCategory: item.primaryCategory, + lastUpdatedOn: timeAgo(item.lastUpdatedOn), + status: item.status, + identifier: item.identifier, + mimeType: item.mimeType, + mode: item.mode, + description: item?.description + + })); + setData(filteredArray) + console.log(filteredArray) + }, [contentList]); + + const filteredData = useMemo( () => @@ -137,92 +202,55 @@ const AllContentsPage = () => { [debouncedSearchTerm, contentList] ); + const displayedRows = filteredData.slice( page * rowsPerPage, page * rowsPerPage + rowsPerPage - ); - + ); + + console.log("contentList", contentList) return ( + + - Show all Content - Here you see all your content. + LIMIT ? '15px' : '0px' }}> + + All My Contents + + {/* Here you see all your content. */} - - - - {loading ? ( - - ) : contentList && contentList.length > 0 ? ( - contentList && - contentList.length > 0 && ( + + + + {loading ? ( + + ) : ( <> - - - - Content - Last Updated - Status - - - - - {contentList?.map((content, index) => ( - - openEditor(content)}> - - {content?.appIcon ? ( - - ) : ( - - )} - - - {content?.name} - - - {content?.primaryCategory} - - - - - {timeAgo(content?.lastUpdatedOn)} - {content?.status} - - {content?.status === "Draft" && ( - handleDeleteClick(content)} - > - - - )} - - - ))} - -
- - ) - ) : ( - - )} - - {totalCount > LIMIT && ( - - )} + + + + + )} + {totalCount > LIMIT && ( + setPage(newPage - 1)} + /> + )} +
+ +
+
); }; diff --git a/src/pages/workspace/content/create/index.tsx b/src/pages/workspace/content/create/index.tsx index 42da9d4..6ade2af 100644 --- a/src/pages/workspace/content/create/index.tsx +++ b/src/pages/workspace/content/create/index.tsx @@ -1,26 +1,37 @@ import React, { useEffect, useState } from "react"; import Layout from "../../../../components/Layout"; -import { Typography, Box, useTheme } from "@mui/material"; +import { Typography, Box, useTheme, Paper, Grid } from "@mui/material"; import ContentCard from "../../../../components/ContentCard"; import DescriptionIcon from "@mui/icons-material/Description"; import DescriptionOutlinedIcon from "@mui/icons-material/DescriptionOutlined"; import UploadIcon from "@mui/icons-material/Upload"; import { useRouter } from "next/router"; import { createCourse, createQuestionSet } from "@/services/ContentService"; -import axios from "axios"; +import QuizOutlinedIcon from "@mui/icons-material/QuizOutlined"; +import SchoolOutlinedIcon from "@mui/icons-material/SchoolOutlined"; +import VideoLibraryOutlinedIcon from "@mui/icons-material/VideoLibraryOutlined"; +import largeVideoIcon from '/public/150+.png'; +import Image from "next/image"; +import WorkspaceText from '../../../../components/WorkspaceText'; +import { getLocalStoredUserId } from "@/services/LocalStorageService"; const CreatePage = () => { - const theme = useTheme(); + const theme = useTheme(); const [selectedKey, setSelectedKey] = useState("create"); const router = useRouter(); + useEffect(() => { + const token = localStorage.getItem("token"); + const userId = getLocalStoredUserId() + + if (token && userId) { + document.cookie = `authToken=${token}; path=/; secure; SameSite=Strict`; + document.cookie = `userId=${userId}; path=/; secure; SameSite=Strict`; + } + }, []); + const fetchData = async () => { try { - const token = localStorage.getItem("token"); - if (token) { - document.cookie = `authToken=${token}; path=/; secure; SameSite=Strict`; - } - const response = await createQuestionSet(); console.log("Question set created successfully:", response); @@ -40,7 +51,7 @@ const CreatePage = () => { const fetchCollectionData = async () => { try { - const userId = "5afb0c71-5e85-46f6-8780-3059cbb7bbf9"; + const userId = getLocalStoredUserId(); const response = await createCourse(userId); console.log("Course set created successfully:", response); @@ -50,7 +61,7 @@ const CreatePage = () => { query: { identifier }, }); } catch (error) { - console.error("Error creating question set:", error); + console.error("Error creating course:", error); } }; @@ -60,62 +71,96 @@ const CreatePage = () => { const cardData = [ { - title: "Upload Content", - description: "You can upload content here.", - icon: , + title: "New Question Set", + description: "Create assessments, question banks, quizzes, etc.", + icon: , + onClick: openEditor, + }, + { + title: "New Course", + description: + " Create courses by defining content, assessments, etc", + icon: , + onClick: openCollectionEditor, + }, + { + title: "New Content", + description: "Create new documents, PDF, video, QML, HTML, etc.", + icon: , onClick: () => router.push("/upload-editor"), }, { - title: "Upload Large Videos(>50 MB)", - description: "You can upload content here.", - icon: , + title: "New Large Content", + description: "Create videos and documents larger than 150mb ---- Create word needs to be added", + icon: large-video, onClick: () => router.push({ pathname: "/upload-editor", query: { editorforlargecontent: "true" }, }), }, - { - title: "Question Set", - description: "Create Questionsets", - icon: , - onClick: openEditor, - }, - { - title: "Course", - description: "Design courses using collections and resources.", - icon: , - onClick: openCollectionEditor, - }, ]; return ( - - - Here you can create new content. - - + + {/* Outer box for "Create new content" heading and cards */} - {cardData.map((card, index) => ( - - ))} + + Create new content + + + + + {cardData.map((card, index) => ( + + + {card?.icon} + + {card?.title} + + + {card?.description} + + + + ))} + + + ); diff --git a/src/pages/workspace/content/discover-contents/index.tsx b/src/pages/workspace/content/discover-contents/index.tsx new file mode 100644 index 0000000..a05fc99 --- /dev/null +++ b/src/pages/workspace/content/discover-contents/index.tsx @@ -0,0 +1,230 @@ +import React, { useEffect, useMemo, useState, useCallback } from "react"; +import Layout from "../../../../components/Layout"; +import { + Typography, + Box, + Table, + TableHead, + TableBody, + TableRow, + TableCell, + TablePagination, + IconButton, + useTheme, +} from "@mui/material"; +import DeleteIcon from "@mui/icons-material/Delete"; +import UpReviewTinyImage from "@mui/icons-material/LibraryBooks"; +import SearchBox from "../../../../components/SearchBox"; +import { deleteContent, getContent } from "../../../../services/ContentService"; +import { timeAgo } from "@/utils/Helper"; +import Loader from "@/components/Loader"; +import NoDataFound from "@/components/NoDataFound"; +import { MIME_TYPE } from "@/utils/app.config"; +import router from "next/router"; +import PaginationComponent from "@/components/PaginationComponent"; +import { LIMIT } from "@/utils/app.constant"; +import WorkspaceText from "@/components/WorkspaceText"; +import { Table as KaTable } from 'ka-table'; +import { DataType } from 'ka-table/enums'; +import "ka-table/style.css"; +import KaTableComponent from "@/components/KaTableComponent"; +import useSharedStore from "@/utils/useSharedState"; +// const columns = [ +// { key: 'name', title: 'Content', dataType: DataType.String, width: "450px" }, +// { key: 'lastUpdatedOn', title: 'Last Updated', dataType: DataType.String, width: "300px" }, +// { key: 'status', title: 'Status', dataType: DataType.String, width: "300px" }, +// { key: 'contentAction', title: 'Action', dataType: DataType.String, width: "200px" }, + +// ] +const columns = [ + { key: 'title_and_description', title: 'TITLE & DESCRIPTION', dataType: DataType.String, width: "350px" }, + { key: 'create-by', title: 'CREATED BY', dataType: DataType.String, width: "100px" }, + + { key: 'contentType', title: 'CONTENT TYPE', dataType: DataType.String, width: "100px" }, + { key: 'status', title: 'STATUS', dataType: DataType.String, width: "100px" }, + { key: 'lastUpdatedOn', title: 'LAST MODIFIED', dataType: DataType.String, width: "100px" }, + + +] +const ContentsPage = () => { + const theme = useTheme(); + + const [selectedKey, setSelectedKey] = useState("discover-contents"); + const [page, setPage] = useState(0); + const [rowsPerPage, setRowsPerPage] = useState(10); + const [searchTerm, setSearchTerm] = useState(""); + const [filter, setFilter] = useState([]); + const [sortBy, setSortBy] = useState("Modified On"); + const [contentList, setContentList] = React.useState([]); + const [data, setData] = React.useState([]); + + const [loading, setLoading] = useState(false); + const [contentDeleted, setContentDeleted] = React.useState(false); + const fetchContentAPI = useSharedStore( + (state: any) => state.fetchContentAPI + ); + const [debouncedSearchTerm, setDebouncedSearchTerm] = + useState(searchTerm); + const [totalCount, setTotalCount] = useState(0); + + const handleChangePage = (event: unknown, newPage: number) => { + setPage(newPage - 1); + }; + + const handleChangeRowsPerPage = ( + event: React.ChangeEvent + ) => { + setRowsPerPage(parseInt(event.target.value, 10)); + setPage(0); + }; + + useEffect(() => { + const handler = setTimeout(() => { + setDebouncedSearchTerm(searchTerm); + }, 300); + + return () => { + clearTimeout(handler); + }; + }, [searchTerm]); + + const handleSearch = (term: string) => { + setSearchTerm(term); + }; + + const handleFilterChange = (filter: string[]) => { + setFilter(filter); + }; + + const handleSortChange = (sortBy: string) => { + console.log("sortBy", sortBy) + setSortBy(sortBy); + }; + + + useEffect(() => { + const getContentList = async () => { + try { + setLoading(true); + const status = [ + // "Draft", + // "FlagDraft", + // "Review", + // "Processing", + "Live", + // "Unlisted", + // "FlagReview", + ]; + const query = debouncedSearchTerm || ""; + const primaryCategory = filter.length ? filter : []; + const order = sortBy === "Created On" ? "asc" : "desc"; + const sort_by = { + lastUpdatedOn: order, + }; + const offset = page * LIMIT; + const contentType="discover-contents" + + const response = await getContent( + status, + query, + LIMIT, + offset, + primaryCategory, + sort_by, + contentType + ); + const contentList = (response?.content || []).concat( + response?.QuestionSet || [] + ); + setContentList(contentList); + setTotalCount(response?.count); + setLoading(false); + } catch (error) { + console.log(error); + } + }; + getContentList(); + }, [debouncedSearchTerm, filter,fetchContentAPI, sortBy, page]); + + useEffect(() => { + const filteredArray = contentList.map(item => ({ + image: item?.appIcon, + contentType: item.primaryCategory, + name: item.name, + primaryCategory: item.primaryCategory, + lastUpdatedOn: timeAgo(item.lastUpdatedOn), + status: item.status, + identifier: item.identifier, + mimeType: item.mimeType, + mode: item.mode, + creator: item.creator, + description: item?.description + + + })); + setData(filteredArray) + console.log(filteredArray) + }, [contentList]); + + + + const filteredData = useMemo( + () => + contentList?.filter((content) => + content?.name.toLowerCase().includes(debouncedSearchTerm.toLowerCase()) + ), + [debouncedSearchTerm, contentList] + ); + + + const displayedRows = filteredData.slice( + page * rowsPerPage, + page * rowsPerPage + rowsPerPage + ); + + console.log("contentList", contentList) + return ( + + + + + LIMIT ? '15px' : '0px' }}> + + Discover Contents + + {/* Here you see all your content. */} + + + + + {loading ? ( + + ) : ( + <> + + + + + )} + {totalCount > LIMIT && ( + setPage(newPage - 1)} + /> + )} + + + + + + + ); +}; + +export default ContentsPage; diff --git a/src/pages/workspace/content/draft/index.tsx b/src/pages/workspace/content/draft/index.tsx index 14e87a4..ce07968 100644 --- a/src/pages/workspace/content/draft/index.tsx +++ b/src/pages/workspace/content/draft/index.tsx @@ -1,39 +1,59 @@ import React, { useEffect, useMemo, useState } from "react"; import Layout from "../../../../components/Layout"; -import { Typography, Box, TablePagination } from "@mui/material"; -import CourseCard from "../../../../components/CourseCard"; -import SearchBox from "../../../../components/SearchBox"; +import { + Typography, + Box, + Table, + TableBody, + TableCell, + TableContainer, + TableHead, + TableRow, + IconButton, + CircularProgress, +} from "@mui/material"; +import DeleteIcon from "@mui/icons-material/Delete"; import { getContent } from "@/services/ContentService"; -import Loader from "@/components/Loader"; -import NoDataFound from "@/components/NoDataFound"; +import SearchBox from "../../../../components/SearchBox"; import PaginationComponent from "@/components/PaginationComponent"; +import NoDataFound from "@/components/NoDataFound"; import { LIMIT } from "@/utils/app.constant"; - +import { useRouter } from "next/router"; +import { MIME_TYPE } from "@/utils/app.config"; +import WorkspaceText from "@/components/WorkspaceText"; +import { DataType } from 'ka-table/enums'; +import KaTableComponent from "@/components/KaTableComponent"; +import Paper from '@mui/material/Paper'; +import { timeAgo } from "@/utils/Helper"; +import useSharedStore from "@/utils/useSharedState"; + +const columns = [ + { key: 'title_and_description', title: 'TITLE & DESCRIPTION', dataType: DataType.String, width: "450px" }, + { key: 'contentType', title: 'CONTENT TYPE', dataType: DataType.String, width: "200px" }, + { key: 'lastUpdatedOn', title: 'LAST MODIFIED', dataType: DataType.String, width: "180px" }, + { key: 'action', title: 'ACTION', dataType: DataType.String, width: "100px" }, + + +] const DraftPage = () => { const [selectedKey, setSelectedKey] = useState("draft"); const [page, setPage] = useState(0); - const [rowsPerPage, setRowsPerPage] = useState(4); + const [rowsPerPage, setRowsPerPage] = useState(5); const [searchTerm, setSearchTerm] = useState(""); - const [filter, setFilter] = useState("all"); - const [sortBy, setSortBy] = useState("updated"); - const [contentList, setContentList] = React.useState([]); + const [filter, setFilter] = useState([]); + const [sortBy, setSortBy] = useState("Modified On"); + const [contentList, setContentList] = React.useState([]); const [contentDeleted, setContentDeleted] = React.useState(false); const [loading, setLoading] = useState(false); const [totalCount, setTotalCount] = useState(0); + const [data, setData] = React.useState([]); + const fetchContentAPI = useSharedStore( + (state: any) => state.fetchContentAPI + ); + const [debouncedSearchTerm, setDebouncedSearchTerm] = useState(searchTerm); - const handleChangePage = (event: unknown, newPage: number) => { - setPage(newPage - 1); - }; - - const handleChangeRowsPerPage = ( - event: React.ChangeEvent - ) => { - setRowsPerPage(parseInt(event.target.value, 10)); - setPage(0); - }; - useEffect(() => { const handler = setTimeout(() => { setDebouncedSearchTerm(searchTerm); @@ -44,11 +64,29 @@ const DraftPage = () => { }; }, [searchTerm]); + useEffect(() => { + const filteredArray = contentList.map((item: any) => ({ + image: item?.appIcon, + + name: item?.name, + description: item?.description, + + contentType: item.primaryCategory, + lastUpdatedOn: timeAgo(item.lastUpdatedOn), + status: item.status, + identifier: item.identifier, + mimeType: item.mimeType, + mode: item.mode + })); + setData(filteredArray) + console.log(filteredArray) + }, [contentList]); + const handleSearch = (search: string) => { setSearchTerm(search.toLowerCase()); }; - const handleFilterChange = (filter: string) => { + const handleFilterChange = (filter: string[]) => { setFilter(filter); }; @@ -56,104 +94,92 @@ const DraftPage = () => { setSortBy(sortBy); }; - const filteredData = useMemo( - () => - contentList?.filter((content) => - content.name.toLowerCase().includes(searchTerm) - ), - [searchTerm] - ); - - // const displayedCards = filteredData?.slice( - // page * rowsPerPage, - // page * rowsPerPage + rowsPerPage - // ); - const handleDelete = (index: number) => { console.log(`Deleting item at index ${index}`); - setTimeout(() => { - setContentDeleted((prev) => !prev); - }, 1000); + setContentDeleted((prev) => !prev); }; + const router = useRouter(); + + + useEffect(() => { const getDraftContentList = async () => { try { setLoading(true); const query = debouncedSearchTerm || ""; const offset = page * LIMIT; + const primaryCategory = filter.length ? filter : []; + const order = sortBy === "Created On" ? "asc" : "desc"; + const sort_by = { lastUpdatedOn: order }; const response = await getContent( ["Draft", "FlagDraft"], query, LIMIT, - offset + offset, + primaryCategory, + sort_by ); const contentList = (response?.content || []).concat( response?.QuestionSet || [] ); setContentList(contentList); setTotalCount(response?.count); - setLoading(false); } catch (error) { - console.log(error); + console.error(error); + } finally { + setLoading(false); } }; getDraftContentList(); - }, [debouncedSearchTerm, contentDeleted, page]); + }, [debouncedSearchTerm, filter, sortBy, contentDeleted, fetchContentAPI,page]); + return ( - - Draft Content - Here you see all your draft content. - - - - - - - {loading ? ( - - ) : contentList && contentList.length > 0 ? ( - contentList?.map((content, index) => ( - - handleDelete(index)} - /> - - )) - ) : ( - + + + LIMIT ? '15px' : '0px' }}> + + + Drafts + + + {/* + Create, organize, and manage all types of content in one place. + */} + + + + + {loading ? ( + + + + ) :(<> + + + + + )} + {totalCount > LIMIT && ( + setPage(newPage - 1)} + /> )} - {totalCount > LIMIT && ( - - )} + ); }; diff --git a/src/pages/workspace/content/publish/index.tsx b/src/pages/workspace/content/publish/index.tsx index 4d5e26c..265bbad 100644 --- a/src/pages/workspace/content/publish/index.tsx +++ b/src/pages/workspace/content/publish/index.tsx @@ -1,30 +1,59 @@ import React, { useEffect, useMemo, useState } from "react"; import Layout from "../../../../components/Layout"; -import { Typography, Box } from "@mui/material"; -import CourseCard from "../../../../components/CourseCard"; -import SearchBox from "../../../../components/SearchBox"; +import { + Typography, + Box, + Table, + TableBody, + TableCell, + TableContainer, + TableHead, + TableRow, + IconButton, + CircularProgress, +} from "@mui/material"; +import DeleteIcon from "@mui/icons-material/Delete"; import { getContent } from "@/services/ContentService"; -import Loader from "@/components/Loader"; -import NoDataFound from "@/components/NoDataFound"; +import SearchBox from "../../../../components/SearchBox"; import PaginationComponent from "@/components/PaginationComponent"; +import NoDataFound from "@/components/NoDataFound"; import { LIMIT } from "@/utils/app.constant"; +import { useRouter } from "next/router"; +import { MIME_TYPE } from "@/utils/app.config"; +import WorkspaceText from "@/components/WorkspaceText"; +import { DataType } from 'ka-table/enums'; +import KaTableComponent from "@/components/KaTableComponent"; +import { timeAgo } from "@/utils/Helper"; +import useSharedStore from "@/utils/useSharedState"; + +const columns = [ + { key: 'title_and_description', title: 'TITLE & DESCRIPTION', dataType: DataType.String, width: "450px" }, + { key: 'contentType', title: 'CONTENT TYPE', dataType: DataType.String, width: "200px" }, + // { key: 'status', title: 'STATUS', dataType: DataType.String, width: "100px" }, + { key: 'lastUpdatedOn', title: 'LAST MODIFIED', dataType: DataType.String, width: "180px" }, + { key: 'action', title: 'ACTION', dataType: DataType.String, width: "100px" }, + +] const PublishPage = () => { const [selectedKey, setSelectedKey] = useState("publish"); + const [page, setPage] = useState(0); + const [rowsPerPage, setRowsPerPage] = useState(5); const [searchTerm, setSearchTerm] = useState(""); - const [filter, setFilter] = useState("all"); - const [sortBy, setSortBy] = useState("updated"); - const [contentList, setContentList] = React.useState([]); - const [loading, setLoading] = useState(false); + const [filter, setFilter] = useState([]); + const [sortBy, setSortBy] = useState("Modified On"); + const [contentList, setContentList] = React.useState([]); const [contentDeleted, setContentDeleted] = React.useState(false); + const [loading, setLoading] = useState(false); + const [totalCount, setTotalCount] = useState(0); + const [data, setData] = React.useState([]); + const fetchContentAPI = useSharedStore( + (state: any) => state.fetchContentAPI + ); const [debouncedSearchTerm, setDebouncedSearchTerm] = useState(searchTerm); - const [page, setPage] = useState(0); - const [totalCount, setTotalCount] = useState(0); - const handleChangePage = (event: unknown, newPage: number) => { - setPage(newPage - 1); - }; + const router = useRouter(); useEffect(() => { const handler = setTimeout(() => { @@ -35,12 +64,28 @@ const PublishPage = () => { clearTimeout(handler); }; }, [searchTerm]); + useEffect(() => { + const filteredArray = contentList.map((item: any) => ({ + image: item?.appIcon, + + name: item?.name, + description: item?.description, + contentType: item.primaryCategory, + lastUpdatedOn: timeAgo(item.lastUpdatedOn), + status: item.status, + identifier: item.identifier, + mimeType: item.mimeType, + mode: item.mode + })); + setData(filteredArray) + console.log(filteredArray) + }, [contentList]); const handleSearch = (search: string) => { setSearchTerm(search.toLowerCase()); }; - const handleFilterChange = (filter: string) => { + const handleFilterChange = (filter: string[]) => { setFilter(filter); }; @@ -48,25 +93,24 @@ const PublishPage = () => { setSortBy(sortBy); }; - const filteredData = useMemo( - () => - contentList?.filter((content) => - content.name.toLowerCase().includes(searchTerm) - ), - [searchTerm] - ); + - const displayedCards = filteredData - ?.slice - // page * rowsPerPage, - // page * rowsPerPage + rowsPerPage - (); - - const handleDelete = (index: number) => { - console.log(`Deleting item at index ${index}`); - setTimeout(() => { - setContentDeleted((prev) => !prev); - }, 1000); + const openEditor = (content: any) => { + const identifier = content?.identifier; + const mode = "read"; + if (content?.mimeType === MIME_TYPE.QUESTIONSET_MIME_TYPE) { + router.push({ pathname: `/editor`, query: { identifier, mode } }); + } else if ( + content?.mimeType && + MIME_TYPE.GENERIC_MIME_TYPE.includes(content?.mimeType) + ) { + router.push({ pathname: `/upload-editor`, query: { identifier } }); + } else if ( + content?.mimeType && + MIME_TYPE.COLLECTION_MIME_TYPE.includes(content?.mimeType) + ) { + router.push({ pathname: `/collection`, query: { identifier, mode } }); + } }; useEffect(() => { @@ -75,73 +119,73 @@ const PublishPage = () => { setLoading(true); const query = debouncedSearchTerm || ""; const offset = page * LIMIT; - const response = await getContent(["Live"], query, LIMIT, offset); + const primaryCategory = filter.length ? filter : []; + const order = sortBy === "Created On" ? "asc" : "desc"; + const sort_by = { lastUpdatedOn: order }; + const response = await getContent( + ["Live"], + query, + LIMIT, + offset, + primaryCategory, + sort_by + ); const contentList = (response?.content || []).concat( response?.QuestionSet || [] ); setContentList(contentList); setTotalCount(response?.count); - setLoading(false); } catch (error) { - console.log(error); + console.error(error); + } finally { + setLoading(false); } }; getPublishContentList(); - }, [debouncedSearchTerm, contentDeleted, page]); + }, [debouncedSearchTerm, filter, sortBy,fetchContentAPI, contentDeleted, page]); + return ( + - Content Publish - Here you see all your Publish content. - - - - + LIMIT ? '15px' : '0px' }} > + + + Published + - - {loading ? ( - - ) : contentList && contentList.length > 0 ? ( - contentList?.map((content, index) => ( - - handleDelete(index)} - /> - - )) - ) : ( - + + + + + {/* Here you see all your published content. */} +{loading ? ( + + + + ) : (<> + + + + )} + {totalCount > LIMIT && ( + setPage(newPage - 1)} + /> )} - {totalCount > LIMIT && ( - - )} + ); diff --git a/src/pages/workspace/content/review/index.tsx b/src/pages/workspace/content/review/index.tsx index 36c2ab1..abc7f37 100644 --- a/src/pages/workspace/content/review/index.tsx +++ b/src/pages/workspace/content/review/index.tsx @@ -16,7 +16,12 @@ import ConfirmActionPopup from "../../../../components/ConfirmActionPopup"; import ReviewCommentPopup from "../../../../components/ReviewCommentPopup"; import { publishContent, submitComment } from "@/services/ContentService"; import Players from "@/components/players/Players"; -import { playerConfig } from "../../../../components/players/PlayerConfig"; +import V1Player from "@/components/V1-Player/V1Player"; +import ArrowBackIcon from "@mui/icons-material/ArrowBack"; +import { + playerConfig, + V1PlayerConfig, +} from "../../../../components/players/PlayerConfig"; import { pdfMetadata, videoMetadata, @@ -24,11 +29,21 @@ import { epubMetadata, } from "../../../../components/players/playerMetadata"; import $ from "jquery"; +import { MIME_TYPE, CHANNEL_ID } from "@/utils/app.config"; +import { getLocalStoredUserName , getLocalStoredUserRole} from "@/services/LocalStorageService"; +import { Role } from "@/utils/app.constant"; + +const userFullName = getLocalStoredUserName() || "Anonymous User"; +const [firstName, lastName] = userFullName.split(" "); const ReviewContentSubmissions = () => { + const [isContentInteractiveType, setIsContentInteractiveType] = + useState(false); const router = useRouter(); const { identifier } = router.query; - // const identifier = "do_2141610327664312321258"; + const { isDiscoverContent } = router.query; + const { isReadOnly } = router.query; + const delay = (ms: number) => new Promise(resolve => setTimeout(resolve, ms)); const [contentDetails, setContentDetails] = useState(undefined); const [openConfirmationPopup, setOpenConfirmationPopup] = useState(false); @@ -51,8 +66,24 @@ const ReviewContentSubmissions = () => { // playerConfig.metadata = quMLMetadata; // playerConfig.metadata = epubMetadata; console.log("data ==>", data); - playerConfig.metadata = data; - console.log('playerConfig ==>', playerConfig); + if (MIME_TYPE.INTERACTIVE_MIME_TYPE.includes(data?.mimeType)) { + V1PlayerConfig.metadata = data; + V1PlayerConfig.context.contentId = data.identifier; + V1PlayerConfig.context.channel = CHANNEL_ID; + V1PlayerConfig.context.tags = [CHANNEL_ID]; + V1PlayerConfig.context.app = [CHANNEL_ID]; + V1PlayerConfig.context.userData.firstName = firstName; + V1PlayerConfig.context.userData.lastName = lastName; + setIsContentInteractiveType(true); + } else { + setIsContentInteractiveType(false); + playerConfig.metadata = data; + playerConfig.context.contentId = data.identifier; + playerConfig.context.channel = CHANNEL_ID; + playerConfig.context.tags = [CHANNEL_ID]; + playerConfig.context.userData.firstName = firstName; + playerConfig.context.userData.lastName = lastName; + } setContentDetails(data); } } catch (error) { @@ -66,6 +97,15 @@ const ReviewContentSubmissions = () => { }, [identifier]); const redirectToReviewPage = () => { + if(isDiscoverContent === "true"){ + router.push({ pathname: `/workspace/content/discover-contents` }); + + } + else if(getLocalStoredUserRole() === Role.CCTA){ + router.push({ pathname: `/workspace/content/up-review` }); + + } + else router.push({ pathname: `/workspace/content/submitted` }); }; @@ -94,6 +134,13 @@ const ReviewContentSubmissions = () => { console.log("Published successfully:", response); // Add toaster success message here setOpenConfirmationPopup(false); + await delay(2000); + + if(getLocalStoredUserRole() === Role.CCTA){ + router.push({ pathname: `/workspace/content/up-review` }); + + } + else router.push({ pathname: `/workspace/content/submitted` }); } catch (error) { console.error("Error during publishing:", error); @@ -107,6 +154,11 @@ const ReviewContentSubmissions = () => { console.log("Comment submitted successfully:", response); // Add toaster success message here setOpenCommentPopup(false); + if(getLocalStoredUserRole() === Role.CCTA){ + router.push({ pathname: `/workspace/content/up-review` }); + + } + else router.push({ pathname: `/workspace/content/submitted` }); } catch (error) { console.error("Error submitting comment:", error); @@ -122,7 +174,9 @@ const ReviewContentSubmissions = () => { year: "numeric", }); }; - + const handleBackClick = () => { + router.back(); + }; return ( { alignItems="center" mb={2} > + + + { borderRadius: "16px", padding: 2, backgroundColor: "white", - mb: 2, + }} > { { }} >
- + {isContentInteractiveType ? ( + + ) : ( + + )}
- Content Details - + { - + { - + { - + { - + { - + { {formatDate(contentDetails.lastUpdatedOn)} - +
- - - +
)} ) : ( No content details available diff --git a/src/pages/workspace/content/submitted/index.tsx b/src/pages/workspace/content/submitted/index.tsx index 64e340d..a06a5da 100644 --- a/src/pages/workspace/content/submitted/index.tsx +++ b/src/pages/workspace/content/submitted/index.tsx @@ -1,32 +1,54 @@ -import React, { useEffect, useMemo, useState } from "react"; +import React, { useEffect, useState } from "react"; import Layout from "../../../../components/Layout"; -import { Typography, Box } from "@mui/material"; -import CourseCard from "../../../../components/CourseCard"; -import SearchBox from "../../../../components/SearchBox"; +import { + Typography, + Box, + Table, + TableBody, + TableCell, + TableContainer, + TableHead, + TableRow, + IconButton, + CircularProgress, +} from "@mui/material"; +import DeleteIcon from "@mui/icons-material/Delete"; import { getContent } from "@/services/ContentService"; -import Loader from "@/components/Loader"; -import NoDataFound from "@/components/NoDataFound"; -import { setTimeout } from "timers"; +import SearchBox from "../../../../components/SearchBox"; import PaginationComponent from "@/components/PaginationComponent"; +import NoDataFound from "@/components/NoDataFound"; import { LIMIT } from "@/utils/app.constant"; +import { MIME_TYPE } from "@/utils/app.config"; +import router from "next/router"; +import WorkspaceText from "@/components/WorkspaceText"; +import { DataType } from 'ka-table/enums'; +import KaTableComponent from "@/components/KaTableComponent"; +import { timeAgo } from "@/utils/Helper"; +import useSharedStore from "@/utils/useSharedState"; +const columns = [ + { key: 'title_and_description', title: 'TITLE & DESCRIPTION', dataType: DataType.String, width: "450px" }, + { key: 'contentType', title: 'CONTENT TYPE', dataType: DataType.String, width: "200px" }, + // { key: 'status', title: 'STATUS', dataType: DataType.String, width: "100px" }, + { key: 'lastUpdatedOn', title: 'LAST MODIFIED', dataType: DataType.String, width: "180px" }, + { key: 'action', title: 'ACTION', dataType: DataType.String, width: "100px" }, + +] const SubmittedForReviewPage = () => { const [selectedKey, setSelectedKey] = useState("submitted"); - const [filter, setFilter] = useState("all"); - const [sortBy, setSortBy] = useState("updated"); + const [filter, setFilter] = useState([]); + const [sortBy, setSortBy] = useState("Modified On"); const [searchTerm, setSearchTerm] = useState(""); - const [contentList, setContentList] = React.useState([]); + const [contentList, setContentList] = useState([]); const [loading, setLoading] = useState(false); - const [contentDeleted, setContentDeleted] = React.useState(false); - const [debouncedSearchTerm, setDebouncedSearchTerm] = - useState(searchTerm); + const [contentDeleted, setContentDeleted] = useState(false); + const [debouncedSearchTerm, setDebouncedSearchTerm] = useState(searchTerm); const [page, setPage] = useState(0); const [totalCount, setTotalCount] = useState(0); - - const handleChangePage = (event: unknown, newPage: number) => { - setPage(newPage - 1); - }; - + const [data, setData] = React.useState([]); + const fetchContentAPI = useSharedStore( + (state: any) => state.fetchContentAPI + ); useEffect(() => { const handler = setTimeout(() => { setDebouncedSearchTerm(searchTerm); @@ -36,11 +58,28 @@ const SubmittedForReviewPage = () => { clearTimeout(handler); }; }, [searchTerm]); + useEffect(() => { + const filteredArray = contentList.map((item: any) => ({ + image: item?.appIcon, + + name: item?.name, + description: item?.description, + + contentType: item.primaryCategory, + lastUpdatedOn: timeAgo(item.lastUpdatedOn), + status: item.status, + identifier: item.identifier, + mimeType: item.mimeType, + mode: item.mode + })); + setData(filteredArray) + console.log(filteredArray) + }, [contentList]); const handleSearch = (search: string) => { setSearchTerm(search.toLowerCase()); }; - const handleFilterChange = (filter: string) => { + const handleFilterChange = (filter: string[]) => { setFilter(filter); }; @@ -48,26 +87,7 @@ const SubmittedForReviewPage = () => { setSortBy(sortBy); }; - const filteredData = useMemo( - () => - contentList?.filter((content) => - content?.name.toLowerCase().includes(searchTerm) - ), - [searchTerm] - ); - - const displayedCards = filteredData - ?.slice - // page * rowsPerPage, - // page * rowsPerPage + rowsPerPage - (); - - const handleDelete = (index: number) => { - console.log(`Deleting item at index ${index}`); - setTimeout(() => { - setContentDeleted((prev) => !prev); - }, 1000); - }; + useEffect(() => { const getReviewContentList = async () => { @@ -75,80 +95,87 @@ const SubmittedForReviewPage = () => { setLoading(true); const query = debouncedSearchTerm || ""; const offset = page * LIMIT; + const primaryCategory = filter.length ? filter : []; + const order = sortBy === "Created On" ? "asc" : "desc"; + const sort_by = { lastUpdatedOn: order }; const response = await getContent( ["Review", "FlagReview"], query, LIMIT, - offset + offset, + primaryCategory, + sort_by ); const contentList = (response?.content || []).concat( response?.QuestionSet || [] ); setContentList(contentList); setTotalCount(response?.count); - setLoading(false); } catch (error) { - console.log(error); + console.error(error); + } finally { + setLoading(false); } }; getReviewContentList(); - }, [debouncedSearchTerm, contentDeleted, page]); + }, [debouncedSearchTerm, filter, sortBy, fetchContentAPI,contentDeleted, page]); + return ( + - Content Submitted For ReviewPage - - Here you see all your content Submitted For ReviewPage. - + LIMIT ? '15px' : '0px' }}> + + + Submitted For Review + + + {/* + Here you can see all your content submitted for review. + */} + + + + - - - - - {loading ? ( - + {/* {loading ? ( + + + ) : contentList && contentList.length > 0 ? ( - contentList?.map((content, index) => ( - - handleDelete(index)} - /> - - )) + + + ) : ( + )} */} + {loading ? ( + + + + ) : ( + + + )} - {totalCount > LIMIT && ( - - )} + setPage(newPage - 1)} + /> + )} + ); diff --git a/src/pages/workspace/content/up-review/index.tsx b/src/pages/workspace/content/up-review/index.tsx new file mode 100644 index 0000000..5ffae53 --- /dev/null +++ b/src/pages/workspace/content/up-review/index.tsx @@ -0,0 +1,192 @@ +import React, { useEffect, useState } from "react"; +import Layout from "../../../../components/Layout"; +import { + Typography, + Box, + Table, + TableBody, + TableCell, + TableContainer, + TableHead, + TableRow, + IconButton, + CircularProgress, +} from "@mui/material"; +import DeleteIcon from "@mui/icons-material/Delete"; +import { getContent } from "@/services/ContentService"; +import SearchBox from "../../../../components/SearchBox"; +import PaginationComponent from "@/components/PaginationComponent"; +import NoDataFound from "@/components/NoDataFound"; +import { LIMIT } from "@/utils/app.constant"; +import { MIME_TYPE } from "@/utils/app.config"; +import router from "next/router"; +import WorkspaceText from "@/components/WorkspaceText"; +import { DataType } from 'ka-table/enums'; +import KaTableComponent from "@/components/KaTableComponent"; +import { timeAgo } from "@/utils/Helper"; +import useSharedStore from "@/utils/useSharedState"; +const columns = [ + { key: 'title_and_description', title: 'TITLE & DESCRIPTION', dataType: DataType.String, width: "300px" }, + + { key: 'contentType', title: 'CONTENT TYPE', dataType: DataType.String, width: "250px" }, + // { key: 'status', title: 'STATUS', dataType: DataType.String, width: "100px" }, + { key: 'lastUpdatedOn', title: 'LAST MODIFIED', dataType: DataType.String, width: "180px" }, + { key: 'create-by', title: 'CREATED BY', dataType: DataType.String, width: "100px" }, + { key: 'action', title: 'ACTION', dataType: DataType.String, width: "100px" }, + + +] +const UpForReviewPage = () => { + const [selectedKey, setSelectedKey] = useState("up-review"); + const [filter, setFilter] = useState([]); + const [sortBy, setSortBy] = useState("Modified On"); + const [searchTerm, setSearchTerm] = useState(""); + const [contentList, setContentList] = useState([]); + const [loading, setLoading] = useState(false); + const [contentDeleted, setContentDeleted] = useState(false); + const [debouncedSearchTerm, setDebouncedSearchTerm] = useState(searchTerm); + const [page, setPage] = useState(0); + const [totalCount, setTotalCount] = useState(0); + const [data, setData] = React.useState([]); + const fetchContentAPI = useSharedStore( + (state: any) => state.fetchContentAPI + ); + useEffect(() => { + const handler = setTimeout(() => { + setDebouncedSearchTerm(searchTerm); + }, 300); + + return () => { + clearTimeout(handler); + }; + }, [searchTerm]); + useEffect(() => { + const filteredArray = contentList.map((item: any) => ({ + image: item?.appIcon, + + name: item?.name, + description: item?.description, + + contentType: item.primaryCategory, + lastUpdatedOn: timeAgo(item.lastUpdatedOn), + status: item.status, + identifier: item.identifier, + mimeType: item.mimeType, + mode: item.mode, + createdBy: item.createdBy, + creator: item.creator + + + })); + setData(filteredArray) + console.log(filteredArray) + }, [contentList]); + const handleSearch = (search: string) => { + setSearchTerm(search.toLowerCase()); + }; + + const handleFilterChange = (filter: string[]) => { + setFilter(filter); + }; + + const handleSortChange = (sortBy: string) => { + setSortBy(sortBy); + }; + + + + useEffect(() => { + const getReviewContentList = async () => { + try { + setLoading(true); + const query = debouncedSearchTerm || ""; + const offset = page * LIMIT; + const primaryCategory = filter.length ? filter : []; + const order = sortBy === "Created On" ? "asc" : "desc"; + const sort_by = { lastUpdatedOn: order }; + const contentType="upReview" + const response = await getContent( + ["Review", "FlagReview"], + query, + LIMIT, + offset, + primaryCategory, + sort_by, + contentType + ); + const contentList = (response?.content || []).concat( + response?.QuestionSet || [] + ); + setContentList(contentList); + setTotalCount(response?.count); + } catch (error) { + console.error(error); + } finally { + setLoading(false); + } + }; + getReviewContentList(); + }, [debouncedSearchTerm, filter, sortBy, fetchContentAPI,contentDeleted, page]); + + + return ( + + + + LIMIT ? '15px' : '0px' }}> + + + Up For Review + + + {/* + Here you can see all your content submitted for review. + */} + + + + + + + {/* {loading ? ( + + + + ) : contentList && contentList.length > 0 ? ( + + + + ) : ( + + )} */} + {loading ? ( + + + + ) : ( + + + + )} + {totalCount > LIMIT && ( + setPage(newPage - 1)} + /> + )} + + + + ); +}; + +export default UpForReviewPage; diff --git a/src/services/ContentService.ts b/src/services/ContentService.ts index b5ce76f..eb79b8c 100644 --- a/src/services/ContentService.ts +++ b/src/services/ContentService.ts @@ -1,46 +1,137 @@ -import { stringify } from "json5"; -import { getLocalStoredUserData } from "./LocalStorageService"; -import { delApi, deleteApi, post } from "./RestClient"; +import { getLocalStoredUserId , getLocalStoredUserRole} from "./LocalStorageService"; +import { delApi, get, post } from "./RestClient"; import axios from "axios"; -import { MIME_TYPE } from "@/utils/app.config"; -const authToken = process.env.NEXT_PUBLIC_AUTH_API_TOKEN; -const baseUrl = process.env.NEXT_PUBLIC_BASE_URL; +import { MIME_TYPE, CHANNEL_ID, TENANT_ID } from "@/utils/app.config"; import { v4 as uuidv4 } from "uuid"; +import { PrimaryCategoryValue, Role } from "@/utils/app.constant"; -const userId = getLocalStoredUserData(); +const userId = getLocalStoredUserId(); console.log("userId ==>", userId); +export const getPrimaryCategory = async () => { + const apiURL = `/api/channel/v1/read/${CHANNEL_ID}`; + try { + const response = await get(apiURL); + return response?.data?.result; + } catch (error) { + throw error; + } +}; + +// const PrimaryCategoryData = async () => { +// const response = await getPrimaryCategory(); +// const collectionPrimaryCategories = +// response?.channel?.collectionPrimaryCategories; +// const contentPrimaryCategories = response?.channel?.contentPrimaryCategories; + +// const PrimaryCategory = [ +// ...collectionPrimaryCategories, +// ...contentPrimaryCategories, +// ]; +// return PrimaryCategory; +// }; + const defaultReqBody = { request: { filters: { createdBy: userId, - primaryCategory: [ - "Course Assessment", - "eTextbook", - "Explanation Content", - "Learning Resource", - "Practice Question Set", - "Teacher Resource", - "Exam Question", - "Content Playlist", - "Course", - "Digital Textbook", - "Question paper", - ], }, - // query: "", sort_by: { lastUpdatedOn: "desc", }, }, }; - +const upForReviewReqBody = { + request: { + filters: { + // createdBy: { userId}, + }, + sort_by: { + lastUpdatedOn: "desc", + }, + }, +} const getReqBodyWithStatus = ( status: string[], query: string, limit: number, - offset: number + offset: number, + primaryCategory: any, + sort_by: any, + contentType?: string ) => { + if (typeof window !== "undefined" && typeof localStorage !== "undefined") { + var PrimaryCategory = + JSON.parse(localStorage.getItem("PrimaryCategory") as string) || + PrimaryCategoryValue; + } + primaryCategory = + primaryCategory.length === 0 ? PrimaryCategory : primaryCategory; + if(contentType==="discover-contents") +{ + const userRole = getLocalStoredUserRole(); + + if(userRole===Role.SCTA && localStorage.getItem("stateName")) + { + return { + ...upForReviewReqBody, + request: { + ...upForReviewReqBody.request, + filters: { + ...upForReviewReqBody.request.filters, + status, + primaryCategory, + createdBy:{"!=":localStorage.getItem("userId")}, + state:localStorage.getItem("stateName"), + + }, + + query, + limit, + offset, + sort_by, + }, + }; + } + + return { + ...upForReviewReqBody, + request: { + ...upForReviewReqBody.request, + filters: { + ...upForReviewReqBody.request.filters, + status, + primaryCategory, + createdBy:{"!=":localStorage.getItem("userId")} + + }, + + query, + limit, + offset, + sort_by, + }, + }; +} +else if(contentType==="upReview") +{ + return { + ...upForReviewReqBody, + request: { + ...upForReviewReqBody.request, + filters: { + ...upForReviewReqBody.request.filters, + status, + primaryCategory, + }, + query, + limit, + offset, + sort_by, + }, + }; +} + return { ...defaultReqBody, request: { @@ -48,10 +139,12 @@ const getReqBodyWithStatus = ( filters: { ...defaultReqBody.request.filters, status, + primaryCategory, }, query, limit, offset, + sort_by, }, }; }; @@ -60,11 +153,22 @@ export const getContent = async ( status: string[], query: string, limit: number, - offset: number + offset: number, + primaryCategory: string[], + sort_by: any, + contentType?: string ) => { const apiURL = "/action/composite/v3/search"; try { - const reqBody = getReqBodyWithStatus(status, query, limit, offset); + const reqBody = getReqBodyWithStatus( + status, + query, + limit, + offset, + primaryCategory, + sort_by, + contentType + ); const response = await post(apiURL, reqBody); return response?.data?.result; } catch (error) { @@ -80,7 +184,7 @@ export const createQuestionSet = async () => { name: "Untitled QuestionSet", mimeType: "application/vnd.sunbird.questionset", primaryCategory: "Practice Question Set", - code: "de1508e3-cd30-48ba-b4de-25a98d8cfdd2", + code: uuidv4(), createdBy: userId, }, }, @@ -90,7 +194,7 @@ export const createQuestionSet = async () => { const response = await axios.post(apiURL, reqBody, { headers: { "Content-Type": "application/json", - tenantId: "ef99949b-7f3a-4a5f-806a-e67e683e38f3", + "tenantId": TENANT_ID, }, }); return response?.data; @@ -106,8 +210,8 @@ export const deleteContent = async (identifier: string, mimeType: string) => { if (mimeType === MIME_TYPE.QUESTIONSET_MIME_TYPE) { apiURL = questionsetRetireURL; } else if ( - mimeType !== MIME_TYPE.QUESTIONSET_MIME_TYPE && - mimeType !== MIME_TYPE.COLLECTION_MIME_TYPE + mimeType !== MIME_TYPE.QUESTIONSET_MIME_TYPE + // mimeType !== MIME_TYPE.COLLECTION_MIME_TYPE ) { apiURL = contentRetireURL; } @@ -129,9 +233,8 @@ export const createCourse = async (userId: any) => { name: "Untitled Course", description: "Enter description for Course", createdBy: userId, - createdFor: ["test-k12-channel"], + createdFor: [CHANNEL_ID], mimeType: MIME_TYPE.COURSE_MIME_TYPE, - resourceType: "Course", primaryCategory: "Course", contentType: "Course", @@ -152,13 +255,16 @@ export const publishContent = async (identifier: any) => { const requestBody = { request: { content: { - lastPublishedBy: userId - } - } + lastPublishedBy: userId, + }, + }, }; try { - const response = await axios.post(`/action/content/v3/publish/${identifier}`, requestBody); + const response = await axios.post( + `/action/content/v3/publish/${identifier}`, + requestBody + ); return response.data; } catch (error) { console.error("Error during publishing:", error); @@ -170,13 +276,16 @@ export const submitComment = async (identifier: any, comment: any) => { const requestBody = { request: { content: { - rejectComment: comment - } - } + rejectComment: comment, + }, + }, }; try { - const response = await axios.post(`/action/content/v3/reject/${identifier}`, requestBody); + const response = await axios.post( + `/action/content/v3/reject/${identifier}`, + requestBody + ); return response.data; } catch (error) { console.error("Error submitting comment:", error); diff --git a/src/services/LocalStorageService.ts b/src/services/LocalStorageService.ts index b68c1a5..9fc2f66 100644 --- a/src/services/LocalStorageService.ts +++ b/src/services/LocalStorageService.ts @@ -1,4 +1,4 @@ -export const getLocalStoredUserData = () => { +export const getLocalStoredUserId = () => { if (typeof window !== 'undefined' && typeof localStorage !== 'undefined') { try { const userId = localStorage.getItem("userId"); @@ -13,3 +13,34 @@ export const getLocalStoredUserData = () => { return null; } }; + +export const getLocalStoredUserName = () => { + if (typeof window !== 'undefined' && typeof localStorage !== 'undefined') { + try { + const username = localStorage.getItem("name"); + return username ?? "Anonymous User"; + } catch (error) { + console.error("Error retrieving user name from local storage:", error); + return "Anonymous User"; + } + } else { + // Running in SSR, return null + console.warn("Local storage is not available (SSR)"); + return null; + } +}; +export const getLocalStoredUserRole = () => { + if (typeof window !== 'undefined' && typeof localStorage !== 'undefined') { + try { + const userInfo = JSON.parse(localStorage.getItem("adminInfo") || "{}"); + return userInfo?.role; + } catch (error) { + console.error("Error retrieving user name from local storage:", error); + return "Anonymous User"; + } + } else { + // Running in SSR, return null + console.warn("Local storage is not available (SSR)"); + return null; + } +}; diff --git a/src/styles/global.css b/src/styles/global.css index ce9e039..777abf6 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -1,3 +1,5 @@ +@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap"); + .player-grid { height: 100%; width: 100%; @@ -11,3 +13,69 @@ gap: 0px; } } + + +html, +body { + margin: 0; + padding: 0; + background: 'red'; + font-family: Poppins, sans-serif !important; +} + +.ka-thead-cell { + font-weight: 600; +} + +.ka-thead-cell-content { + font-weight: normal !important; +} + + +.ka-thead-background { + z-index: 1; + color: white; + background: #a8a6a6; + background-color: #F8EFE7 !important; + ; +} + +.ka-table-wrapper { + height: 50vh !important; +} + +.css-1bxxajt-MuiInputBase-root-MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline { + border-color: #FDBE16 !important; +} + +/* .delete-icon { + background-image: url('../Assets/image/delete.png') !important; + height: 18px; + width: 18px; +} */ + +div h1, +h2, +h3, +h4, +h5, +h6, +p .css-1ydl6z0-MuiTypography-root { + font-family: Poppins, sans-serif !important; +} + +.two-line-text { + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + overflow: hidden; + text-overflow: ellipsis; +} + +.one-line-text { + display: -webkit-box; + -webkit-line-clamp: 1; + -webkit-box-orient: vertical; + overflow: hidden; + text-overflow: ellipsis; +} \ No newline at end of file diff --git a/src/utils/Helper.ts b/src/utils/Helper.ts index 0027337..fd6a8a2 100644 --- a/src/utils/Helper.ts +++ b/src/utils/Helper.ts @@ -39,3 +39,12 @@ export const debounce = any>( }, wait); }; }; + +export const handleExitEvent = () => { + const previousPage = sessionStorage.getItem("previousPage"); + if (previousPage) { + window.location.href = previousPage; + } else { + window.history.go(-1); + } +}; diff --git a/src/utils/app.config.ts b/src/utils/app.config.ts index 1c77764..8876abf 100644 --- a/src/utils/app.config.ts +++ b/src/utils/app.config.ts @@ -4,14 +4,39 @@ export const MIME_TYPE = { GENERIC_MIME_TYPE: [ "application/pdf", "video/mp4", - "video/x-youtube", - "video/youtube", "application/vnd.ekstep.html-archive", "application/epub", "application/vnd.ekstep.h5p-archive", "video/webm", "text/x-url", + "video/x-youtube", + "video/youtube" ], QUESTIONSET_MIME_TYPE: "application/vnd.sunbird.questionset", COURSE_MIME_TYPE: "application/vnd.ekstep.content-collection", + INTERACTIVE_MIME_TYPE: [ + "application/vnd.ekstep.h5p-archive", + "application/vnd.ekstep.html-archive", + "video/x-youtube", + "video/youtube"] }; + +export const TENANT_ID = process.env.NEXT_PUBLIC_TENANT_ID || ""; +if (!TENANT_ID) { + console.warn('NEXT_PUBLIC_TENANT_ID is not set in the environment variables.'); +} + +export const CHANNEL_ID = process.env.NEXT_PUBLIC_CHANNEL_ID || ""; +if (!CHANNEL_ID) { + console.warn('NEXT_PUBLIC_CHANNEL_ID is not set in the environment variables.'); +} + +export const FRAMEWORK_ID = process.env.NEXT_PUBLIC_FRAMEWORK_ID || ""; +if (!FRAMEWORK_ID) { + console.warn('NEXT_PUBLIC_FRAMEWORK_ID is not set in the environment variables.'); +} + +export const CLOUD_STORAGE_URL = process.env.NEXT_PUBLIC_CLOUD_STORAGE_URL || ""; +if (!CLOUD_STORAGE_URL) { + console.warn('NEXT_PUBLIC_CLOUD_STORAGE_URL is not set in the environment variables.'); +} \ No newline at end of file diff --git a/src/utils/app.constant.ts b/src/utils/app.constant.ts index 4eed0f3..9dae7d7 100644 --- a/src/utils/app.constant.ts +++ b/src/utils/app.constant.ts @@ -7,5 +7,21 @@ export enum Status { export enum ContentType { QUESTION_SET = "QuestionSet", } +export enum Role { + SCTA = "State Admin SCTA", + CCTA="Central Admin CCTA" +} +export const SortOptions = ["Modified On", "Created On"]; +export const StatusOptions = ["Live", "Review" , "Draft", "All"]; + + +export const LIMIT = 10; -export const LIMIT = 6; +export const PrimaryCategoryValue = [ + "Course", + "eTextbook", + "Explanation Content", + "Learning Resource", + "Practice Question Set", + "Teacher Resource" +]; diff --git a/src/utils/interfaces.ts b/src/utils/interfaces.ts index 605e023..fa338fd 100644 --- a/src/utils/interfaces.ts +++ b/src/utils/interfaces.ts @@ -8,6 +8,7 @@ interface DashboardContentProps { } interface content { + creator?: any; name: string; status: string; lastUpdatedOn: string; @@ -17,4 +18,5 @@ interface content { identifier?: string; mimeType?: string; primaryCategory: string; + mode?: string; } diff --git a/src/utils/useSharedState.ts b/src/utils/useSharedState.ts new file mode 100644 index 0000000..70a8247 --- /dev/null +++ b/src/utils/useSharedState.ts @@ -0,0 +1,9 @@ +import { create } from "zustand"; + +const useSharedStore = create((set) => ({ + fetchContentAPI: false, + setFetchContentAPI: (status: boolean) => + set({ fetchContentAPI: status }), +})); + +export default useSharedStore;