diff --git a/dist/assessment/core.js b/dist/assessment/core.js
index aef7ca9..789b568 100644
--- a/dist/assessment/core.js
+++ b/dist/assessment/core.js
@@ -1 +1 @@
-var t={7738:(t,e,n)=>{n.r(e),n.d(e,{activity:()=>r,activityId:()=>a,activitySubTitle:()=>f,activityTags:()=>p,activityTemplateId:()=>c,activityTitle:()=>u,adaptiveType:()=>l,annotationsConfig:()=>d,autoSaveConfig:()=>m,elapsedTime:()=>g,hasActivityTemplate:()=>v,hasAnnotations:()=>h,hasAutoSave:()=>y,hasEvents:()=>b,hasItemPool:()=>I,hasResourceItems:()=>A,hasSections:()=>w,hasShuffledItems:()=>_,hasTryAgain:()=>S,isAdaptive:()=>k,isResuming:()=>q,itemBank:()=>P,itemPool:()=>T,maxTime:()=>x,region:()=>O,resourceItems:()=>R,sessionId:()=>B,state:()=>E,timeRemaining:()=>C,totalItems:()=>F,userId:()=>W});var i=n(2844),o=n(8511),s=n(7484);function r(){return i.appInstance().getActivity()}function a(){return r().activity_id}function c(){return r().activity_template_id}function u(){return r().config.title}function f(){return r().config.subtitle}function p(){return i.appInstance().getTags()}function l(){return k()&&r().adaptive.hasOwnProperty("type")?r().adaptive.type:""}function d(){return h()&&r()?.config?.annotations_api_init_options?r().config.annotations_api_init_options:{}}function m(){const t=r();return t?.config?.navigation?.auto_save?t.config.navigation.auto_save:{}}function g(){return i.appInstance().getTime()}function v(){return r().hasOwnProperty("activity_template_id")}function h(){const t=r();return Boolean(!0===t?.config?.annotations||t?.config?.annotations_api_init_options)}function y(){const t=r();return t.hasOwnProperty("config")&&t.config.hasOwnProperty("navigation")&&t.config.navigation.hasOwnProperty("auto_save")&&!1!==t.config.navigation.auto_save}function _(){return Boolean(r()?.config?.configuration?.shuffle_items)}function b(){const t=r();return t.hasOwnProperty("events")&&!1!==t.events}function I(){return r().hasOwnProperty("item_pool_id")}function A(){return Boolean(r()?.config?.navigation?.resource_items)}function w(){return r().hasOwnProperty("sections")}function S(){return r()?.dynamic_items.hasOwnProperty("try_again")}function k(){return r().hasOwnProperty("adaptive")}function q(){return r().existing_session}function P(){return r()?.organisation_id}function T(){return r()?.item_pool_id}function x(){return r()?.config?.time?.max_time?r().config.time.max_time:0}function O(){return r()?.config?.regions}function R(){return r()?.config?.navigation?.resource_items}function B(){return r()?.session_id}function E(){let t;return t=void 0===r()?.state?"initial":r().state,t}function C(){return 0===x()?null:x()-g()}function F(){if(w()){let t=0,e=o.sections();for(let n=0;n{var e=[];function n(t){for(var n=-1,r=0;r
0){const t=1e3*o.measureText(s).width/a*l;if(A {this.resolve=e=>{this.#Qi=!0,t(e)},this.reject=t=>{this.#Qi=!0,e(t)}}))}get settled(){return this.#Qi}}let X=null,K=null;function Q(t){return X||(X=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,K=new Map([["ſt","ſt"]])),t.replaceAll(X,((t,e,n)=>e?e.normalize("NFKC"):K.get(n)))}function Y(){if("undefined"!=typeof crypto&&"function"==typeof crypto?.randomUUID)return crypto.randomUUID();const t=new Uint8Array(32);if("undefined"!=typeof crypto&&"function"==typeof crypto?.getRandomValues)crypto.getRandomValues(t);else for(let e=0;e<32;e++)t[e]=Math.floor(255*Math.random());return q(t)}const J="pdfjs_internal_id_"}},r={};function c(t){var e=r[t];if(void 0!==e)return e.exports;var i=r[t]={exports:{}};return n[t].call(i.exports,i,i.exports,c),i.exports}s="function"==typeof Symbol?Symbol("webpack queues"):"__webpack_queues__",a="function"==typeof Symbol?Symbol("webpack exports"):"__webpack_exports__",o="function"==typeof Symbol?Symbol("webpack error"):"__webpack_error__",l=t=>{t&&t.d<1&&(t.d=1,t.forEach((t=>t.r--)),t.forEach((t=>t.r--?t.r++:t())))},c.a=(t,e,n)=>{var r;n&&((r=[]).d=-1);var i,c,d,u=new Set,h=t.exports,p=new Promise(((t,e)=>{d=e,c=t}));p[a]=h,p[s]=t=>(r&&t(r),u.forEach(t),p.catch((t=>{}))),t.exports=p,e((t=>{var e;i=(t=>t.map((t=>{if(null!==t&&"object"==typeof t){if(t[s])return t;if(t.then){var e=[];e.d=0,t.then((t=>{n[a]=t,l(e)}),(t=>{n[o]=t,l(e)}));var n={};return n[s]=t=>t(e),n}}var r={};return r[s]=t=>{},r[a]=t,r})))(t);var n=()=>i.map((t=>{if(t[o])throw t[o];return t[a]})),c=new Promise((t=>{(e=()=>t(n)).r=0;var a=t=>t!==r&&!u.has(t)&&(u.add(t),t&&!t.d&&(e.r++,t.push(e)));i.map((t=>t[s](a)))}));return e.r?c:n()}),(t=>(t?d(p[o]=t):c(h),l(r)))),r&&r.d<0&&(r.d=0)},c.d=(t,e)=>{for(var n in e)c.o(e,n)&&!c.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},c.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var i=c(9907);(i=globalThis.pdfjsLib=await(globalThis.pdfjsLibPromise=i)).AbortException,i.AnnotationEditorLayer,i.AnnotationEditorParamsType,i.AnnotationEditorType,i.AnnotationEditorUIManager,i.AnnotationLayer,i.AnnotationMode,i.CMapCompressionType,i.ColorPicker,i.DOMSVGFactory,i.DrawLayer,i.FeatureTest,i.GlobalWorkerOptions,i.ImageKind,i.InvalidPDFException,i.MissingPDFException,i.OPS,i.Outliner,i.PDFDataRangeTransport,i.PDFDateString,i.PDFWorker,i.PasswordResponses,i.PermissionFlag,i.PixelsPerInch,i.PromiseCapability,i.RenderingCancelledException,i.UnexpectedResponseException,i.Util,i.VerbosityLevel,i.XfaLayer,i.build,i.createValidAbsoluteUrl,i.fetchData,i.getDocument,i.getFilenameFromUrl,i.getPdfFilenameFromUrl,i.getXfaPageViewport,i.isDataScheme,i.isPdfFile,i.noContextMenu,i.normalizeUnicode,i.renderTextLayer,i.setLayerDimensions,i.shadow,i.updateTextLayer,i.version,e()}catch(d){e(d)}var s,a,o,l}),1)}},s={};function a(t){var e=s[t];if(void 0!==e)return e.exports;var n=s[t]={id:t,loaded:!1,exports:{}};return i[t].call(n.exports,n,n.exports,a),n.loaded=!0,n.exports}a.amdD=function(){throw new Error("define cannot be used indirect")},a.amdO={},t="function"==typeof Symbol?Symbol("webpack queues"):"__webpack_queues__",e="function"==typeof Symbol?Symbol("webpack exports"):"__webpack_exports__",n="function"==typeof Symbol?Symbol("webpack error"):"__webpack_error__",r=t=>{t&&t.d<1&&(t.d=1,t.forEach((t=>t.r--)),t.forEach((t=>t.r--?t.r++:t())))},a.a=(i,s,a)=>{var o;a&&((o=[]).d=-1);var l,c,d,u=new Set,h=i.exports,p=new Promise(((t,e)=>{d=e,c=t}));p[e]=h,p[t]=t=>(o&&t(o),u.forEach(t),p.catch((t=>{}))),i.exports=p,s((i=>{var s;l=(i=>i.map((i=>{if(null!==i&&"object"==typeof i){if(i[t])return i;if(i.then){var s=[];s.d=0,i.then((t=>{a[e]=t,r(s)}),(t=>{a[n]=t,r(s)}));var a={};return a[t]=t=>t(s),a}}var o={};return o[t]=t=>{},o[e]=i,o})))(i);var a=()=>l.map((t=>{if(t[n])throw t[n];return t[e]})),c=new Promise((e=>{(s=()=>e(a)).r=0;var n=t=>t!==o&&!u.has(t)&&(u.add(t),t&&!t.d&&(s.r++,t.push(s)));l.map((e=>e[t](n)))}));return s.r?c:a()}),(t=>(t?d(p[n]=t):c(h),r(o)))),o&&o.d<0&&(o.d=0)},a.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},a.d=(t,e)=>{for(var n in e)a.o(e,n)&&!a.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),a.nc=void 0;var o=a(6975),l=(o=await o).LT;export{l as LT};
\ No newline at end of file
+var t,e,n,r,i={9601:(t,e,n)=>{n.d(e,{A:()=>o});var r=n(1601),i=n.n(r),s=n(6314),a=n.n(s)()(i());a.push([t.id,"@import url(https://fonts.googleapis.com/css2?family=Comic+Neue:ital,wght@0,300;0,400;0,700;1,300;1,400;1,700&display=swap);"]),a.push([t.id,'.lrn:not(.lrn_absolute_keyboard_parent),.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest,.lrn.lrn-assess.lt__theme-juniorQuest{font-family:"LearnosityMath","Comic Neue","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:400;font-style:normal;font-size:30px;color:#333;background-color:#e6f2ff;padding:1em}.lrn:not(.lrn_absolute_keyboard_parent) .lrn-region .top-right-wrapper,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn-region .top-right-wrapper,.lrn.lrn-assess.lt__theme-juniorQuest .lrn-region .top-right-wrapper{font-size:.8em}.lrn:not(.lrn_absolute_keyboard_parent) .lrn-region .top-right-wrapper .lrn_btn,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn-region .top-right-wrapper .lrn_btn,.lrn.lrn-assess.lt__theme-juniorQuest .lrn-region .top-right-wrapper .lrn_btn{vertical-align:bottom}.lrn:not(.lrn_absolute_keyboard_parent) .test-title-text,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .test-title-text,.lrn.lrn-assess.lt__theme-juniorQuest .test-title-text{font-size:1.8em;font-weight:bold;color:#2b63c7}.lrn:not(.lrn_absolute_keyboard_parent) .subtitle,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .subtitle,.lrn.lrn-assess.lt__theme-juniorQuest .subtitle{font-size:1.4em;color:#2b63c7;font-weight:bold}.lrn:not(.lrn_absolute_keyboard_parent) .items .progress span,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .items .progress span,.lrn.lrn-assess.lt__theme-juniorQuest .items .progress span{background:#2b63c7}.lrn:not(.lrn_absolute_keyboard_parent) .learnosity-item,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .learnosity-item,.lrn.lrn-assess.lt__theme-juniorQuest .learnosity-item{container-name:learnosity-item;container-type:inline-size}@container learnosity-item (width < 800px){.lrn:not(.lrn_absolute_keyboard_parent) .lrn .col-xs-12,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn .col-xs-12,.lrn.lrn-assess.lt__theme-juniorQuest .lrn .col-xs-12{width:100%}}@container learnosity-item (width > 800px){.lrn:not(.lrn_absolute_keyboard_parent) .lrn .col-xs-12,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn .col-xs-12,.lrn.lrn-assess.lt__theme-juniorQuest .lrn .col-xs-12{width:80%;margin:0 auto}}@container learnosity-item (width > 1000px){.lrn:not(.lrn_absolute_keyboard_parent) .lrn .col-xs-12,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn .col-xs-12,.lrn.lrn-assess.lt__theme-juniorQuest .lrn .col-xs-12{width:60%}}@container learnosity-item (width > 1200px){.lrn:not(.lrn_absolute_keyboard_parent) .lrn .col-xs-12,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn .col-xs-12,.lrn.lrn-assess.lt__theme-juniorQuest .lrn .col-xs-12{width:50%}}.lrn:not(.lrn_absolute_keyboard_parent) .lrn-region:not(.lrn-items-region) .lrn_btn_blue,.lrn:not(.lrn_absolute_keyboard_parent) .lrn.lrn-assess .dialogs .lrn_btn_blue,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn-region:not(.lrn-items-region) .lrn_btn_blue,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn.lrn-assess .dialogs .lrn_btn_blue,.lrn.lrn-assess.lt__theme-juniorQuest .lrn-region:not(.lrn-items-region) .lrn_btn_blue,.lrn.lrn-assess.lt__theme-juniorQuest .lrn.lrn-assess .dialogs .lrn_btn_blue{background-color:#2b63c7;color:#fff;font-size:.8em;font-weight:bold}.lrn:not(.lrn_absolute_keyboard_parent) .lrn-region:not(.lrn-items-region) .lrn_btn_blue:hover:not(:disabled),.lrn:not(.lrn_absolute_keyboard_parent) .lrn.lrn-assess .dialogs .lrn_btn_blue:hover:not(:disabled),.lrn:not(.lrn_absolute_keyboard_parent) .lrn-region:not(.lrn-items-region) .lrn_btn_blue:active,.lrn:not(.lrn_absolute_keyboard_parent) .lrn-region:not(.lrn-items-region) .lrn_btn_blue:focus,.lrn:not(.lrn_absolute_keyboard_parent) .lrn-region:not(.lrn-items-region) .lrn_btn_blue:disabled,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn-region:not(.lrn-items-region) .lrn_btn_blue:hover:not(:disabled),.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn.lrn-assess .dialogs .lrn_btn_blue:hover:not(:disabled),.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn-region:not(.lrn-items-region) .lrn_btn_blue:active,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn-region:not(.lrn-items-region) .lrn_btn_blue:focus,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn-region:not(.lrn-items-region) .lrn_btn_blue:disabled,.lrn.lrn-assess.lt__theme-juniorQuest .lrn-region:not(.lrn-items-region) .lrn_btn_blue:hover:not(:disabled),.lrn.lrn-assess.lt__theme-juniorQuest .lrn.lrn-assess .dialogs .lrn_btn_blue:hover:not(:disabled),.lrn.lrn-assess.lt__theme-juniorQuest .lrn-region:not(.lrn-items-region) .lrn_btn_blue:active,.lrn.lrn-assess.lt__theme-juniorQuest .lrn-region:not(.lrn-items-region) .lrn_btn_blue:focus,.lrn.lrn-assess.lt__theme-juniorQuest .lrn-region:not(.lrn-items-region) .lrn_btn_blue:disabled{background-color:#5384da}.lrn:not(.lrn_absolute_keyboard_parent) .lrn-region:not(.lrn-items-region) .lrn_btn,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn-region:not(.lrn-items-region) .lrn_btn,.lrn.lrn-assess.lt__theme-juniorQuest .lrn-region:not(.lrn-items-region) .lrn_btn{font-size:.8em}.lrn:not(.lrn_absolute_keyboard_parent) .lrn-region:not(.lrn-items-region) .lrn_btn.item-prev,.lrn:not(.lrn_absolute_keyboard_parent) .lrn.lrn-assess .dialogs .lrn_btn.item-prev,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn-region:not(.lrn-items-region) .lrn_btn.item-prev,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn.lrn-assess .dialogs .lrn_btn.item-prev,.lrn.lrn-assess.lt__theme-juniorQuest .lrn-region:not(.lrn-items-region) .lrn_btn.item-prev,.lrn.lrn-assess.lt__theme-juniorQuest .lrn.lrn-assess .dialogs .lrn_btn.item-prev{background-color:#2b63c7;color:#fff;font-size:.8em;border:1px solid #d9d9d9;font-weight:bold}.lrn:not(.lrn_absolute_keyboard_parent) .toc,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .toc,.lrn.lrn-assess.lt__theme-juniorQuest .toc{font-size:.8em}.lrn:not(.lrn_absolute_keyboard_parent) .lrn-vertical-toc .slides-vertical-pagination li,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn-vertical-toc .slides-vertical-pagination li,.lrn.lrn-assess.lt__theme-juniorQuest .lrn-vertical-toc .slides-vertical-pagination li{margin:7px 0}.lrn:not(.lrn_absolute_keyboard_parent) .toc .lrn-pager li.pagination-active a,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .toc .lrn-pager li.pagination-active a,.lrn.lrn-assess.lt__theme-juniorQuest .toc .lrn-pager li.pagination-active a{background:#f6c70a}.lrn:not(.lrn_absolute_keyboard_parent) .lrn-vertical-toc .pagination-active:before,.lrn:not(.lrn_absolute_keyboard_parent) .lrn-vertical-toc .pagination-active a:before,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn-vertical-toc .pagination-active:before,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn-vertical-toc .pagination-active a:before,.lrn.lrn-assess.lt__theme-juniorQuest .lrn-vertical-toc .pagination-active:before,.lrn.lrn-assess.lt__theme-juniorQuest .lrn-vertical-toc .pagination-active a:before{background-color:#f6c70a}.lrn:not(.lrn_absolute_keyboard_parent) .lrn-vertical-toc .pagination-active:after,.lrn:not(.lrn_absolute_keyboard_parent) .lrn-vertical-toc .pagination-active a:after,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn-vertical-toc .pagination-active:after,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn-vertical-toc .pagination-active a:after,.lrn.lrn-assess.lt__theme-juniorQuest .lrn-vertical-toc .pagination-active:after,.lrn.lrn-assess.lt__theme-juniorQuest .lrn-vertical-toc .pagination-active a:after{border-color:rgba(0,0,0,0) rgba(0,0,0,0) rgba(0,0,0,0) #f6c70a}.lrn:not(.lrn_absolute_keyboard_parent) .lrn-vertical-toc .pagination-item a:focus,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn-vertical-toc .pagination-item a:focus,.lrn.lrn-assess.lt__theme-juniorQuest .lrn-vertical-toc .pagination-item a:focus{-webkit-box-shadow:inset 0 0 0 2px #f6c70a;box-shadow:inset 0 0 0 2px #f6c70a}.lrn:not(.lrn_absolute_keyboard_parent) .lrn-vertical-toc .slides-vertical-pagination li:first-child,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn-vertical-toc .slides-vertical-pagination li:first-child,.lrn.lrn-assess.lt__theme-juniorQuest .lrn-vertical-toc .slides-vertical-pagination li:first-child{margin:0}.lrn:not(.lrn_absolute_keyboard_parent) .has-vertical-toc-region .lrn-right-region,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .has-vertical-toc-region .lrn-right-region,.lrn.lrn-assess.lt__theme-juniorQuest .has-vertical-toc-region .lrn-right-region{width:150px}.lrn:not(.lrn_absolute_keyboard_parent) .lrn-vertical-toc .pagination-item.pagination-item[data-attempted=partially_attempted]:not(.pagination-active) a,.lrn:not(.lrn_absolute_keyboard_parent) .lrn-vertical-toc .pagination-item.pagination-item[data-attempted=fully_attempted]:not(.pagination-active) a,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn-vertical-toc .pagination-item.pagination-item[data-attempted=partially_attempted]:not(.pagination-active) a,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn-vertical-toc .pagination-item.pagination-item[data-attempted=fully_attempted]:not(.pagination-active) a,.lrn.lrn-assess.lt__theme-juniorQuest .lrn-vertical-toc .pagination-item.pagination-item[data-attempted=partially_attempted]:not(.pagination-active) a,.lrn.lrn-assess.lt__theme-juniorQuest .lrn-vertical-toc .pagination-item.pagination-item[data-attempted=fully_attempted]:not(.pagination-active) a{background-color:#f7f7f7}.lrn:not(.lrn_absolute_keyboard_parent) .lrn-vertical-toc .pagination-item.pagination-item[data-attempted=partially_attempted]:not(.pagination-active):before,.lrn:not(.lrn_absolute_keyboard_parent) .lrn-vertical-toc .pagination-item.pagination-item[data-attempted=fully_attempted]:not(.pagination-active):before,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn-vertical-toc .pagination-item.pagination-item[data-attempted=partially_attempted]:not(.pagination-active):before,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn-vertical-toc .pagination-item.pagination-item[data-attempted=fully_attempted]:not(.pagination-active):before,.lrn.lrn-assess.lt__theme-juniorQuest .lrn-vertical-toc .pagination-item.pagination-item[data-attempted=partially_attempted]:not(.pagination-active):before,.lrn.lrn-assess.lt__theme-juniorQuest .lrn-vertical-toc .pagination-item.pagination-item[data-attempted=fully_attempted]:not(.pagination-active):before{height:47px}.lrn:not(.lrn_absolute_keyboard_parent) .lrn-bottom-right-region.lrn-align-top,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn-bottom-right-region.lrn-align-top,.lrn.lrn-assess.lt__theme-juniorQuest .lrn-bottom-right-region.lrn-align-top{margin-top:0px}.lrn:not(.lrn_absolute_keyboard_parent) .lrn-right-region .right-wrapper:not(.menu-with-scroll),.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn-right-region .right-wrapper:not(.menu-with-scroll),.lrn.lrn-assess.lt__theme-juniorQuest .lrn-right-region .right-wrapper:not(.menu-with-scroll){height:auto;background-color:#eaeaea}.lrn:not(.lrn_absolute_keyboard_parent) .lrn-vertical-toc .lrn-pager .slides-vertical-pagination,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn-vertical-toc .lrn-pager .slides-vertical-pagination,.lrn.lrn-assess.lt__theme-juniorQuest .lrn-vertical-toc .lrn-pager .slides-vertical-pagination{padding-bottom:1px}.lrn:not(.lrn_absolute_keyboard_parent) .lrn-vertical-toc .slides-vertical-pagination,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn-vertical-toc .slides-vertical-pagination,.lrn.lrn-assess.lt__theme-juniorQuest .lrn-vertical-toc .slides-vertical-pagination{height:auto}.lrn:not(.lrn_absolute_keyboard_parent) .lrn-region:not(.lrn-items-region) .menu-buttons .lrn_btn,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn-region:not(.lrn-items-region) .menu-buttons .lrn_btn,.lrn.lrn-assess.lt__theme-juniorQuest .lrn-region:not(.lrn-items-region) .menu-buttons .lrn_btn{font-size:.55em}.lrn:not(.lrn_absolute_keyboard_parent) .lrn-horizontal-toc .pagination,.lrn:not(.lrn_absolute_keyboard_parent) .lrn.lrn-assess .lrn-horizontal-toc .lrn-assess-pagination,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn-horizontal-toc .pagination,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn.lrn-assess .lrn-horizontal-toc .lrn-assess-pagination,.lrn.lrn-assess.lt__theme-juniorQuest .lrn-horizontal-toc .pagination,.lrn.lrn-assess.lt__theme-juniorQuest .lrn.lrn-assess .lrn-horizontal-toc .lrn-assess-pagination{font-size:1.03em}.lrn:not(.lrn_absolute_keyboard_parent) .lrn_widget.lrn_mcq .lrn_mcqgroup,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn_widget.lrn_mcq .lrn_mcqgroup,.lrn.lrn-assess.lt__theme-juniorQuest .lrn_widget.lrn_mcq .lrn_mcqgroup{overflow-x:visible}.lrn:not(.lrn_absolute_keyboard_parent) input[type=radio],.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest input[type=radio],.lrn.lrn-assess.lt__theme-juniorQuest input[type=radio]{transform:scale(1.5)}.lrn:not(.lrn_absolute_keyboard_parent) .lrn_response_wrapper,.lrn:not(.lrn_absolute_keyboard_parent) .lrn_texteditor,.lrn:not(.lrn_absolute_keyboard_parent) .lrn_toolbar,.lrn:not(.lrn_absolute_keyboard_parent) .lrn-toolbar,.lrn:not(.lrn_absolute_keyboard_parent) .lrn-toolbar-footer,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn_response_wrapper,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn_texteditor,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn_toolbar,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn-toolbar,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn-toolbar-footer,.lrn.lrn-assess.lt__theme-juniorQuest .lrn_response_wrapper,.lrn.lrn-assess.lt__theme-juniorQuest .lrn_texteditor,.lrn.lrn-assess.lt__theme-juniorQuest .lrn_toolbar,.lrn.lrn-assess.lt__theme-juniorQuest .lrn-toolbar,.lrn.lrn-assess.lt__theme-juniorQuest .lrn-toolbar-footer{font-size:.8em}.lrn:not(.lrn_absolute_keyboard_parent) .lrn_widget .lrn_texteditor_editable,.lrn.lrn-assess.lrn-md.lt__theme-juniorQuest .lrn_widget .lrn_texteditor_editable,.lrn.lrn-assess.lt__theme-juniorQuest .lrn_widget .lrn_texteditor_editable{padding:.5em}',""]);const o=a},6314:t=>{t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",r=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),r&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),r&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,r,i,s){"string"==typeof t&&(t=[[null,t,void 0]]);var a={};if(r)for(var o=0;o 0){const t=1e3*o.measureText(s).width/a*l;if(A {this.resolve=e=>{this.#Qi=!0,t(e)},this.reject=t=>{this.#Qi=!0,e(t)}}))}get settled(){return this.#Qi}}let X=null,K=null;function Q(t){return X||(X=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,K=new Map([["ſt","ſt"]])),t.replaceAll(X,((t,e,n)=>e?e.normalize("NFKC"):K.get(n)))}function Y(){if("undefined"!=typeof crypto&&"function"==typeof crypto?.randomUUID)return crypto.randomUUID();const t=new Uint8Array(32);if("undefined"!=typeof crypto&&"function"==typeof crypto?.getRandomValues)crypto.getRandomValues(t);else for(let e=0;e<32;e++)t[e]=Math.floor(255*Math.random());return q(t)}const J="pdfjs_internal_id_"}},r={};function c(t){var e=r[t];if(void 0!==e)return e.exports;var i=r[t]={exports:{}};return n[t].call(i.exports,i,i.exports,c),i.exports}s="function"==typeof Symbol?Symbol("webpack queues"):"__webpack_queues__",a="function"==typeof Symbol?Symbol("webpack exports"):"__webpack_exports__",o="function"==typeof Symbol?Symbol("webpack error"):"__webpack_error__",l=t=>{t&&t.d<1&&(t.d=1,t.forEach((t=>t.r--)),t.forEach((t=>t.r--?t.r++:t())))},c.a=(t,e,n)=>{var r;n&&((r=[]).d=-1);var i,c,d,u=new Set,h=t.exports,p=new Promise(((t,e)=>{d=e,c=t}));p[a]=h,p[s]=t=>(r&&t(r),u.forEach(t),p.catch((t=>{}))),t.exports=p,e((t=>{var e;i=(t=>t.map((t=>{if(null!==t&&"object"==typeof t){if(t[s])return t;if(t.then){var e=[];e.d=0,t.then((t=>{n[a]=t,l(e)}),(t=>{n[o]=t,l(e)}));var n={};return n[s]=t=>t(e),n}}var r={};return r[s]=t=>{},r[a]=t,r})))(t);var n=()=>i.map((t=>{if(t[o])throw t[o];return t[a]})),c=new Promise((t=>{(e=()=>t(n)).r=0;var a=t=>t!==r&&!u.has(t)&&(u.add(t),t&&!t.d&&(e.r++,t.push(e)));i.map((t=>t[s](a)))}));return e.r?c:n()}),(t=>(t?d(p[o]=t):c(h),l(r)))),r&&r.d<0&&(r.d=0)},c.d=(t,e)=>{for(var n in e)c.o(e,n)&&!c.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},c.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var i=c(9907);(i=globalThis.pdfjsLib=await(globalThis.pdfjsLibPromise=i)).AbortException,i.AnnotationEditorLayer,i.AnnotationEditorParamsType,i.AnnotationEditorType,i.AnnotationEditorUIManager,i.AnnotationLayer,i.AnnotationMode,i.CMapCompressionType,i.ColorPicker,i.DOMSVGFactory,i.DrawLayer,i.FeatureTest,i.GlobalWorkerOptions,i.ImageKind,i.InvalidPDFException,i.MissingPDFException,i.OPS,i.Outliner,i.PDFDataRangeTransport,i.PDFDateString,i.PDFWorker,i.PasswordResponses,i.PermissionFlag,i.PixelsPerInch,i.PromiseCapability,i.RenderingCancelledException,i.UnexpectedResponseException,i.Util,i.VerbosityLevel,i.XfaLayer,i.build,i.createValidAbsoluteUrl,i.fetchData,i.getDocument,i.getFilenameFromUrl,i.getPdfFilenameFromUrl,i.getXfaPageViewport,i.isDataScheme,i.isPdfFile,i.noContextMenu,i.normalizeUnicode,i.renderTextLayer,i.setLayerDimensions,i.shadow,i.updateTextLayer,i.version,e()}catch(d){e(d)}var s,a,o,l}),1)}},s={};function a(t){var e=s[t];if(void 0!==e)return e.exports;var n=s[t]={id:t,loaded:!1,exports:{}};return i[t].call(n.exports,n,n.exports,a),n.loaded=!0,n.exports}a.amdD=function(){throw new Error("define cannot be used indirect")},a.amdO={},t="function"==typeof Symbol?Symbol("webpack queues"):"__webpack_queues__",e="function"==typeof Symbol?Symbol("webpack exports"):"__webpack_exports__",n="function"==typeof Symbol?Symbol("webpack error"):"__webpack_error__",r=t=>{t&&t.d<1&&(t.d=1,t.forEach((t=>t.r--)),t.forEach((t=>t.r--?t.r++:t())))},a.a=(i,s,a)=>{var o;a&&((o=[]).d=-1);var l,c,d,u=new Set,h=i.exports,p=new Promise(((t,e)=>{d=e,c=t}));p[e]=h,p[t]=t=>(o&&t(o),u.forEach(t),p.catch((t=>{}))),i.exports=p,s((i=>{var s;l=(i=>i.map((i=>{if(null!==i&&"object"==typeof i){if(i[t])return i;if(i.then){var s=[];s.d=0,i.then((t=>{a[e]=t,r(s)}),(t=>{a[n]=t,r(s)}));var a={};return a[t]=t=>t(s),a}}var o={};return o[t]=t=>{},o[e]=i,o})))(i);var a=()=>l.map((t=>{if(t[n])throw t[n];return t[e]})),c=new Promise((e=>{(s=()=>e(a)).r=0;var n=t=>t!==o&&!u.has(t)&&(u.add(t),t&&!t.d&&(s.r++,t.push(s)));l.map((e=>e[t](n)))}));return s.r?c:a()}),(t=>(t?d(p[n]=t):c(h),r(o)))),o&&o.d<0&&(o.d=0)},a.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},a.d=(t,e)=>{for(var n in e)a.o(e,n)&&!a.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),a.nc=void 0;var o=a(6975),l=(o=await o).LT;export{l as LT};
\ No newline at end of file
diff --git a/dist/authoring/core.js b/dist/authoring/core.js
index 1a88306..1ab8d78 100644
--- a/dist/authoring/core.js
+++ b/dist/authoring/core.js
@@ -1 +1 @@
-var n={7307:(n,e,t)=>{t.r(e),t.d(e,{appInstance:()=>a,init:()=>r,questionEditorApp:()=>d});var o=t(9103);const i={};function r(n){i.app=n,i.app.on("all",(n=>{(0,o.handleEvent)(n)})),i.app.on("widgetedit:editor:ready",(n=>{(0,o.handleEvent)("widgetedit:editor:ready")})),i.app.on("widgetedit:widget:ready",(n=>{(0,o.handleEvent)("widgetedit:widget:ready")})),i.app.on("widgetedit:preview:changed",(n=>{(0,o.handleEvent)("widgetedit:preview:changed")})),i.app.on("widgetedit:widget:changed",(n=>{(0,o.handleEvent)("widgetedit:widget:changed")}))}function a(){return i.app}function d(){return void 0!==a().editorApp()?a().editorApp():null}},9103:(n,e,t)=>{t.r(e),t.d(e,{diagnostics:()=>a,filterEvent:()=>d,handleEvent:()=>l,listen:()=>s});var o=t(7484);const i={rE:"2.13.2"},r={events:{broadcast:!1,listenFor:"all"}};function a(){let n=window.LearnosityApp?LearnosityApp.versions:{};return{apps:{},LT:{version:i.rE},versions:n}}function d(n){/^[a-zA-Z:*]*$/.test(n)?r.events.listenFor=n:o.A.warn("Invalid event type")}function l(n){if(r.events.broadcast){const e=r.events.listenFor,t=e.replaceAll("*","");1===e.length&&"*"===e||"all"===e?o.A.info(n):e.startsWith("*")&&!e.endsWith("*")?n.endsWith(t)&&o.A.info(n):e.endsWith("*")&&!e.startsWith("*")?n.startsWith(t)&&o.A.info(n):e.startsWith("*")&&e.endsWith("*")?n.includes(t)&&o.A.info(n):n.startsWith(t)&&o.A.info(n)}}function s(n=!0){r.events.broadcast=Boolean(n),Boolean(n)?o.A.info(`👂 listening for '${r.events.listenFor}'`):o.A.info("🚫👂 not listening")}},8709:(n,e,t)=>{t.r(e),t.d(e,{type:()=>i});var o=t(7307);function i(){return o.appInstance().getWidget()?.type}},7484:(n,e,t)=>{t.d(e,{A:()=>o});const o={debug:function(n,e){"DEBUG"===e&&console.log(n)},error:function(n){console.error("%cError:%c "+n,"display:inline-block;background-color:#e0005a;color:#fff;font-weight:bold;padding:3px 7px;border-radius:3px","")},info:function(n){console.info("%cInfo:%c "+n,"display:inline-block;background-color:#46C0FF;color:#000;font-weight:bold;padding:3px 7px;border-radius:3px","")},log:function(n){console.log(n)},warn:function(n,e="log"){console.warn("%cWarning:%c "+n,"display:inline-block;background-color:gold;color:#000;font-weight:bold;padding:3px 7px;border-radius:3px","")}}}},e={};function t(o){var i=e[o];if(void 0!==i)return i.exports;var r=e[o]={exports:{}};return n[o](r,r.exports,t),r.exports}t.d=(n,e)=>{for(var o in e)t.o(e,o)&&!t.o(n,o)&&Object.defineProperty(n,o,{enumerable:!0,get:e[o]})},t.o=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),t.r=n=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})};var o={};t.d(o,{LT:()=>c});var i={};t.r(i),t.d(i,{routingHash:()=>d});var r=t(7307),a=t(9103);function d(){r.appInstance().on("navigate",(n=>{window.location.hash="#"+n.data.locationEncoded})),r.appInstance().navigate(window.location.hash.replace(/^#/,"")),window.onhashchange=()=>{r.appInstance().navigate(window.location.hash.replace(/^#/,""))}}var l=t(8709);const s={utils:{logger:t(7484).A}},c={...r,...a,...i,...l,...s};var p=o.LT;export{p as LT};
\ No newline at end of file
+var n={7307:(n,e,t)=>{t.r(e),t.d(e,{appInstance:()=>a,init:()=>r,questionEditorApp:()=>d});var o=t(9103);const i={};function r(n){i.app=n,i.app.on("all",(n=>{(0,o.handleEvent)(n)})),i.app.on("widgetedit:editor:ready",(n=>{(0,o.handleEvent)("widgetedit:editor:ready")})),i.app.on("widgetedit:widget:ready",(n=>{(0,o.handleEvent)("widgetedit:widget:ready")})),i.app.on("widgetedit:preview:changed",(n=>{(0,o.handleEvent)("widgetedit:preview:changed")})),i.app.on("widgetedit:widget:changed",(n=>{(0,o.handleEvent)("widgetedit:widget:changed")}))}function a(){return i.app}function d(){return void 0!==a().editorApp()?a().editorApp():null}},9103:(n,e,t)=>{t.r(e),t.d(e,{diagnostics:()=>a,filterEvent:()=>d,handleEvent:()=>l,listen:()=>s});var o=t(7484);const i={rE:"2.13.3"},r={events:{broadcast:!1,listenFor:"all"}};function a(){let n=window.LearnosityApp?LearnosityApp.versions:{};return{apps:{},LT:{version:i.rE},versions:n}}function d(n){/^[a-zA-Z:*]*$/.test(n)?r.events.listenFor=n:o.A.warn("Invalid event type")}function l(n){if(r.events.broadcast){const e=r.events.listenFor,t=e.replaceAll("*","");1===e.length&&"*"===e||"all"===e?o.A.info(n):e.startsWith("*")&&!e.endsWith("*")?n.endsWith(t)&&o.A.info(n):e.endsWith("*")&&!e.startsWith("*")?n.startsWith(t)&&o.A.info(n):e.startsWith("*")&&e.endsWith("*")?n.includes(t)&&o.A.info(n):n.startsWith(t)&&o.A.info(n)}}function s(n=!0){r.events.broadcast=Boolean(n),Boolean(n)?o.A.info(`👂 listening for '${r.events.listenFor}'`):o.A.info("🚫👂 not listening")}},8709:(n,e,t)=>{t.r(e),t.d(e,{type:()=>i});var o=t(7307);function i(){return o.appInstance().getWidget()?.type}},7484:(n,e,t)=>{t.d(e,{A:()=>o});const o={debug:function(n,e){"DEBUG"===e&&console.log(n)},error:function(n){console.error("%cError:%c "+n,"display:inline-block;background-color:#e0005a;color:#fff;font-weight:bold;padding:3px 7px;border-radius:3px","")},info:function(n){console.info("%cInfo:%c "+n,"display:inline-block;background-color:#46C0FF;color:#000;font-weight:bold;padding:3px 7px;border-radius:3px","")},log:function(n){console.log(n)},warn:function(n,e="log"){console.warn("%cWarning:%c "+n,"display:inline-block;background-color:gold;color:#000;font-weight:bold;padding:3px 7px;border-radius:3px","")}}}},e={};function t(o){var i=e[o];if(void 0!==i)return i.exports;var r=e[o]={exports:{}};return n[o](r,r.exports,t),r.exports}t.d=(n,e)=>{for(var o in e)t.o(e,o)&&!t.o(n,o)&&Object.defineProperty(n,o,{enumerable:!0,get:e[o]})},t.o=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),t.r=n=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})};var o={};t.d(o,{LT:()=>c});var i={};t.r(i),t.d(i,{routingHash:()=>d});var r=t(7307),a=t(9103);function d(){r.appInstance().on("navigate",(n=>{window.location.hash="#"+n.data.locationEncoded})),r.appInstance().navigate(window.location.hash.replace(/^#/,"")),window.onhashchange=()=>{r.appInstance().navigate(window.location.hash.replace(/^#/,""))}}var l=t(8709);const s={utils:{logger:t(7484).A}},c={...r,...a,...i,...l,...s};var p=o.LT;export{p as LT};
\ No newline at end of file
diff --git a/dist/authoring/index.js b/dist/authoring/index.js
index 4a9d928..96d5404 100644
--- a/dist/authoring/index.js
+++ b/dist/authoring/index.js
@@ -1,2 +1,2 @@
/*! For license information please see index.js.LICENSE.txt */
-var e={8505:e=>{e.exports=function(e){if("number"!=typeof e||Number.isNaN(e))throw new TypeError("Expected a number, got "+typeof e);const t=e<0,i=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(t&&(e=-e),e<1)return(t?"-":"")+e+" B";const r=Math.min(Math.floor(Math.log(e)/Math.log(1024)),i.length-1);e=Number(e/1024**r);const n=i[r];return e>=10||e%1==0?`${(t?"-":"")+e.toFixed(0)} ${n}`:`${(t?"-":"")+e.toFixed(1)} ${n}`}},7526:(e,t)=>{t.byteLength=function(e){var t=a(e),i=t[0],r=t[1];return 3*(i+r)/4-r},t.toByteArray=function(e){var t,i,o=a(e),s=o[0],l=o[1],u=new n(function(e,t,i){return 3*(t+i)/4-i}(0,s,l)),c=0,d=l>0?s-4:s;for(i=0;i`image/${t}`)))}static get supportedTypesStr(){return(0,r.shadow)(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(t){return this.supportedTypes.includes(t)}static paste(t,e){e.pasteEditor(r.AnnotationEditorType.STAMP,{bitmapFile:t.getAsFile()})}#en(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t?(this.#Ge=t.bitmap,e||(this.#We=t.id,this.#Ze=t.isSvg),t.file&&(this.#Qe=t.file.name),this.#Ee()):this.remove()}#nn(){this.#$e=null,this._uiManager.enableWaiting(!1),this.#Ye&&this.div.focus()}#rn(){if(this.#We)return this._uiManager.enableWaiting(!0),void this._uiManager.imageManager.getFromId(this.#We).then((t=>this.#en(t,!0))).finally((()=>this.#nn()));if(this.#Xe){const t=this.#Xe;return this.#Xe=null,this._uiManager.enableWaiting(!0),void(this.#$e=this._uiManager.imageManager.getFromUrl(t).then((t=>this.#en(t))).finally((()=>this.#nn())))}if(this.#Ke){const t=this.#Ke;return this.#Ke=null,this._uiManager.enableWaiting(!0),void(this.#$e=this._uiManager.imageManager.getFromFile(t).then((t=>this.#en(t))).finally((()=>this.#nn())))}const t=document.createElement("input");t.type="file",t.accept=p.supportedTypesStr,this.#$e=new Promise((e=>{t.addEventListener("change",(async()=>{if(t.files&&0!==t.files.length){this._uiManager.enableWaiting(!0);const e=await this._uiManager.imageManager.getFromFile(t.files[0]);this.#en(e)}else this.remove();e()})),t.addEventListener("cancel",(()=>{this.remove(),e()}))})).finally((()=>this.#nn())),t.click()}remove(){this.#We&&(this.#Ge=null,this._uiManager.imageManager.deleteId(this.#We),this.#Ye?.remove(),this.#Ye=null,this.#ge?.disconnect(),this.#ge=null,this.#Je&&(clearTimeout(this.#Je),this.#Je=null)),super.remove()}rebuild(){this.parent?(super.rebuild(),null!==this.div&&(this.#We&&this.#rn(),this.isAttachedToDOM||this.parent.add(this))):this.#We&&this.#rn()}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(this.#$e||this.#Ge||this.#Xe||this.#Ke)}get isResizable(){return!0}render(){if(this.div)return this.div;let t,e;if(this.width&&(t=this.x,e=this.y),super.render(),this.div.hidden=!0,this.#Ge?this.#Ee():this.#rn(),this.width){const[n,r]=this.parentDimensions;this.setAt(t*n,e*r,this.width*n,this.height*r)}return this.div}#Ee(){const{div:t}=this;let{width:e,height:n}=this.#Ge;const[r,i]=this.pageDimensions,s=.75;if(this.width)e=this.width*r,n=this.height*i;else if(e>s*r||n>s*i){const t=Math.min(s*r/e,s*i/n);e*=t,n*=t}const[a,o]=this.parentDimensions;this.setDims(e*a/r,n*o/i),this._uiManager.enableWaiting(!1);const l=this.#Ye=document.createElement("canvas");t.append(l),t.hidden=!1,this.#in(e,n),this.#Se(),this.#tn||(this.parent.addUndoableEditor(this),this.#tn=!0),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",subtype:this.editorType,data:{action:"inserted_image"}}}),this.addAltTextButton(),this.#Qe&&l.setAttribute("aria-label",this.#Qe)}#sn(t,e){const[n,r]=this.parentDimensions;this.width=t/n,this.height=e/r,this.setDims(t,e),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,null!==this.#Je&&clearTimeout(this.#Je),this.#Je=setTimeout((()=>{this.#Je=null,this.#in(t,e)}),200)}#an(t,e){const{width:n,height:r}=this.#Ge;let i=n,s=r,a=this.#Ge;for(;i>2*t||s>2*e;){const n=i,r=s;i>2*t&&(i=i>=16384?Math.floor(i/2)-1:Math.ceil(i/2)),s>2*e&&(s=s>=16384?Math.floor(s/2)-1:Math.ceil(s/2));const o=new OffscreenCanvas(i,s);o.getContext("2d").drawImage(a,0,0,n,r,0,0,i,s),a=o.transferToImageBitmap()}return a}#in(t,e){t=Math.ceil(t),e=Math.ceil(e);const n=this.#Ye;if(!n||n.width===t&&n.height===e)return;n.width=t,n.height=e;const r=this.#Ze?this.#Ge:this.#an(t,e),i=n.getContext("2d");i.filter=this._uiManager.hcmFilter,i.drawImage(r,0,0,r.width,r.height,0,0,t,e)}getImageForAltText(){return this.#Ye}#on(t){if(t){if(this.#Ze){const t=this._uiManager.imageManager.getSvgUrl(this.#We);if(t)return t}const t=document.createElement("canvas");return({width:t.width,height:t.height}=this.#Ge),t.getContext("2d").drawImage(this.#Ge,0,0),t.toDataURL()}if(this.#Ze){const[t,e]=this.pageDimensions,n=Math.round(this.width*t*u.PixelsPerInch.PDF_TO_CSS_UNITS),r=Math.round(this.height*e*u.PixelsPerInch.PDF_TO_CSS_UNITS),i=new OffscreenCanvas(n,r);return i.getContext("2d").drawImage(this.#Ge,0,0,this.#Ge.width,this.#Ge.height,0,0,n,r),i.transferToImageBitmap()}return structuredClone(this.#Ge)}#Se(){this.#ge=new ResizeObserver((t=>{const e=t[0].contentRect;e.width&&e.height&&this.#sn(e.width,e.height)})),this.#ge.observe(this.div)}static deserialize(t,e,n){if(t instanceof a.StampAnnotationElement)return null;const r=super.deserialize(t,e,n),{rect:i,bitmapUrl:s,bitmapId:o,isSvg:l,accessibilityData:c}=t;o&&n.imageManager.isValidId(o)?r.#We=o:r.#Xe=s,r.#Ze=l;const[d,u]=r.pageDimensions;return r.width=(i[2]-i[0])/d,r.height=(i[3]-i[1])/u,c&&(r.altTextData=c),r}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.isEmpty())return null;const n={annotationType:r.AnnotationEditorType.STAMP,bitmapId:this.#We,pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:this.#Ze,structTreeParentId:this._structTreeParentId};if(t)return n.bitmapUrl=this.#on(!0),n.accessibilityData=this.altTextData,n;const{decorative:i,altText:s}=this.altTextData;if(!i&&s&&(n.accessibilityData={type:"Figure",alt:s}),null===e)return n;e.stamps||=new Map;const a=this.#Ze?(n.rect[2]-n.rect[0])*(n.rect[3]-n.rect[1]):null;if(e.stamps.has(this.#We)){if(this.#Ze){const t=e.stamps.get(this.#We);a>t.area&&(t.area=a,t.serialized.bitmap.close(),t.serialized.bitmap=this.#on(!1))}}else e.stamps.set(this.#We,{area:a,serialized:n}),n.bitmap=this.#on(!1);return n}}class f{#P;#ln=!1;#cn=null;#dn=this.pointerup.bind(this);#un=this.pointerUpAfterSelection.bind(this);#hn=this.pointerdown.bind(this);#pn=null;#fn=this.selectionStart.bind(this);#mn=new Map;#gn=!1;#vn=!1;#bn=!1;#_n=null;#yn;static _initialized=!1;static#An=new Map([o,h,p,d].map((t=>[t._editorType,t])));constructor(t){let{uiManager:e,pageIndex:n,div:r,accessibilityManager:i,annotationLayer:s,drawLayer:a,textLayer:o,viewport:l,l10n:c}=t;const d=[...f.#An.values()];if(!f._initialized){f._initialized=!0;for(const t of d)t.initialize(c)}e.registerEditorTypes(d),this.#yn=e,this.pageIndex=n,this.div=r,this.#P=i,this.#cn=s,this.viewport=l,this.#_n=o,this.drawLayer=a,this.#yn.addLayer(this)}get isEmpty(){return 0===this.#mn.size}updateToolbar(t){this.#yn.updateToolbar(t)}updateMode(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.#yn.getMode();switch(this.#wn(),t){case r.AnnotationEditorType.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;case r.AnnotationEditorType.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case r.AnnotationEditorType.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}if(t!==r.AnnotationEditorType.NONE){const{classList:e}=this.div;for(const n of f.#An.values())e.toggle(`${n._type}Editing`,t===n._editorType);this.div.hidden=!1}}addInkEditorIfNeeded(t){if(this.#yn.getMode()===r.AnnotationEditorType.INK){if(!t)for(const t of this.#mn.values())if(t.isEmpty())return void t.setInBackground();this.#xn({offsetX:0,offsetY:0},!1).setInBackground()}}setEditingState(t){this.#yn.setEditingState(t)}addCommands(t){this.#yn.addCommands(t)}togglePointerEvents(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.div.classList.toggle("disabled",!t)}enable(){this.togglePointerEvents(!0);const t=new Set;for(const e of this.#mn.values())e.enableEditing(),e.annotationElementId&&t.add(e.annotationElementId);if(!this.#cn)return;const e=this.#cn.getEditableAnnotations();for(const n of e){if(n.hide(),this.#yn.isDeletedAnnotationElement(n.data.id))continue;if(t.has(n.data.id))continue;const e=this.deserialize(n);e&&(this.addOrRebuild(e),e.enableEditing())}}disable(){this.#bn=!0,this.togglePointerEvents(!1);const t=new Set;for(const e of this.#mn.values())e.disableEditing(),e.annotationElementId&&null===e.serialize()?(this.getEditableAnnotation(e.annotationElementId)?.show(),e.remove()):t.add(e.annotationElementId);if(this.#cn){const e=this.#cn.getEditableAnnotations();for(const n of e){const{id:e}=n.data;t.has(e)||this.#yn.isDeletedAnnotationElement(e)||n.show()}}this.#wn(),this.isEmpty&&(this.div.hidden=!0);const{classList:e}=this.div;for(const t of f.#An.values())e.remove(`${t._type}Editing`);this.disableTextSelection(),this.#bn=!1}getEditableAnnotation(t){return this.#cn?.getEditableAnnotation(t)||null}setActiveEditor(t){this.#yn.getActive()!==t&&this.#yn.setActiveEditor(t)}enableTextSelection(){this.#_n?.div&&document.addEventListener("selectstart",this.#fn)}disableTextSelection(){this.#_n?.div&&document.removeEventListener("selectstart",this.#fn)}enableClick(){this.div.addEventListener("pointerdown",this.#hn),this.div.addEventListener("pointerup",this.#dn)}disableClick(){this.div.removeEventListener("pointerdown",this.#hn),this.div.removeEventListener("pointerup",this.#dn)}attach(t){this.#mn.set(t.id,t);const{annotationElementId:e}=t;e&&this.#yn.isDeletedAnnotationElement(e)&&this.#yn.removeDeletedAnnotationElement(t)}detach(t){this.#mn.delete(t.id),this.#P?.removePointerInTextLayer(t.contentDiv),!this.#bn&&t.annotationElementId&&this.#yn.addDeletedAnnotationElement(t)}remove(t){this.detach(t),this.#yn.removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1,this.#vn||this.addInkEditorIfNeeded(!1)}changeParent(t){t.parent!==this&&(t.annotationElementId&&(this.#yn.addDeletedAnnotationElement(t.annotationElementId),i.AnnotationEditor.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),t.parent?.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(this.changeParent(t),this.#yn.addEditor(t),this.attach(t),!t.isAttachedToDOM){const e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(),this.#yn.addToAnnotationStorage(t)}moveEditorInDOM(t){if(!t.isAttachedToDOM)return;const{activeElement:e}=document;t.div.contains(e)&&!this.#pn&&(t._focusEventsAllowed=!1,this.#pn=setTimeout((()=>{this.#pn=null,t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",(()=>{t._focusEventsAllowed=!0}),{once:!0}),e.focus())}),0)),t._structTreeParentId=this.#P?.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||=this,t.rebuild()):this.add(t)}addUndoableEditor(t){this.addCommands({cmd:()=>t._uiManager.rebuild(t),undo:()=>{t.remove()},mustExec:!1})}getNextId(){return this.#yn.getId()}get#En(){return f.#An.get(this.#yn.getMode())}#Sn(t){const e=this.#En;return e?new e.prototype.constructor(t):null}canCreateNewEmptyEditor(){return this.#En?.canCreateNewEmptyEditor()}pasteEditor(t,e){this.#yn.updateToolbar(t),this.#yn.updateMode(t);const{offsetX:n,offsetY:r}=this.#Tn(),i=this.getNextId(),s=this.#Sn({parent:this,id:i,x:n,y:r,uiManager:this.#yn,isCentered:!0,...e});s&&this.add(s)}deserialize(t){return f.#An.get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,this.#yn)||null}#xn(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=this.getNextId(),i=this.#Sn({parent:this,id:r,x:t.offsetX,y:t.offsetY,uiManager:this.#yn,isCentered:e,...n});return i&&this.add(i),i}#Tn(){const{x:t,y:e,width:n,height:r}=this.div.getBoundingClientRect(),i=Math.max(0,t),s=Math.max(0,e),a=(i+Math.min(window.innerWidth,t+n))/2-t,o=(s+Math.min(window.innerHeight,e+r))/2-e,[l,c]=this.viewport.rotation%180==0?[a,o]:[o,a];return{offsetX:l,offsetY:c}}addNewEditor(){this.#xn(this.#Tn(),!0)}setSelected(t){this.#yn.setSelected(t)}toggleSelected(t){this.#yn.toggleSelected(t)}isSelected(t){return this.#yn.isSelected(t)}unselect(t){this.#yn.unselect(t)}selectionStart(t){this.#_n?.div.addEventListener("pointerup",this.#un,{once:!0})}pointerUpAfterSelection(t){const e=document.getSelection();if(0===e.rangeCount)return;const n=e.getRangeAt(0);if(n.collapsed)return;if(!this.#_n?.div.contains(n.commonAncestorContainer))return;const{x:r,y:i,width:s,height:a}=this.#_n.div.getBoundingClientRect(),o=n.getClientRects();let l;switch(this.viewport.rotation){case 90:l=(t,e,n,o)=>({x:(e-i)/a,y:1-(t+n-r)/s,width:o/a,height:n/s});break;case 180:l=(t,e,n,o)=>({x:1-(t+n-r)/s,y:1-(e+o-i)/a,width:n/s,height:o/a});break;case 270:l=(t,e,n,o)=>({x:1-(e+o-i)/a,y:(t-r)/s,width:o/a,height:n/s});break;default:l=(t,e,n,o)=>({x:(t-r)/s,y:(e-i)/a,width:n/s,height:o/a})}const c=[];for(const{x:t,y:e,width:n,height:r}of o)0!==n&&0!==r&&c.push(l(t,e,n,r));0!==c.length&&this.#xn(t,!1,{boxes:c}),e.empty()}pointerup(t){const{isMac:e}=r.FeatureTest.platform;0!==t.button||t.ctrlKey&&e||t.target===this.div&&this.#gn&&(this.#gn=!1,this.#ln?this.#yn.getMode()!==r.AnnotationEditorType.STAMP?this.#xn(t,!1):this.#yn.unselectAll():this.#ln=!0)}pointerdown(t){if(this.#yn.getMode()===r.AnnotationEditorType.HIGHLIGHT&&this.enableTextSelection(),this.#gn)return void(this.#gn=!1);const{isMac:e}=r.FeatureTest.platform;if(0!==t.button||t.ctrlKey&&e)return;if(t.target!==this.div)return;this.#gn=!0;const n=this.#yn.getActive();this.#ln=!n||n.isEmpty()}findNewParent(t,e,n){const r=this.#yn.findParent(e,n);return null!==r&&r!==this&&(r.changeParent(t),!0)}destroy(){this.#yn.getActive()?.parent===this&&(this.#yn.commitOrRemove(),this.#yn.setActiveEditor(null)),this.#pn&&(clearTimeout(this.#pn),this.#pn=null);for(const t of this.#mn.values())this.#P?.removePointerInTextLayer(t.contentDiv),t.setParent(null),t.isAttachedToDOM=!1,t.div.remove();this.div=null,this.#mn.clear(),this.#yn.removeLayer(this)}#wn(){this.#vn=!0;for(const t of this.#mn.values())t.isEmpty()&&t.remove();this.#vn=!1}render(t){let{viewport:e}=t;this.viewport=e,(0,u.setLayerDimensions)(this.div,e);for(const t of this.#yn.getEditors(this.pageIndex))this.add(t);this.updateMode()}update(t){let{viewport:e}=t;this.#yn.commitOrRemove();const n=this.viewport.rotation,r=e.rotation;if(this.viewport=e,(0,u.setLayerDimensions)(this.div,{rotation:r}),n!==r)for(const t of this.#mn.values())t.rotate(r);this.updateMode()}get pageDimensions(){const{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}}},5097:(t,e,n)=>{n.d(e,{ColorPicker:()=>a});var r=n(3266),i=n(4812),s=n(473);class a{#i=this.#s.bind(this);#Cn=null;#kn=null;#Mn;#In=null;#Rn=!1;#Pn=!1;#Dn;#yn=null;static get _keyboardManager(){return(0,r.shadow)(this,"_keyboardManager",new i.KeyboardManager([[["Escape","mac+Escape"],a.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],a.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],a.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],a.prototype._moveToPrevious],[["Home","mac+Home"],a.prototype._moveToBeginning],[["End","mac+End"],a.prototype._moveToEnd]]))}constructor(t){let{editor:e=null,uiManager:n=null}=t;this.#Pn=!e,this.#yn=e?._uiManager||n,this.#Dn=this.#yn._eventBus,this.#Mn=e?.color||this.#yn?.highlightColors.values().next().value||"#FFFF98"}renderButton(){const t=this.#Cn=document.createElement("button");t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.setAttribute("aria-haspopup",!0),t.addEventListener("click",this.#Ln.bind(this));const e=this.#kn=document.createElement("span");return e.className="swatch",e.style.backgroundColor=this.#Mn,t.append(e),t}renderMainDropdown(){const t=this.#In=this.#Fn(r.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR);return t.setAttribute("aria-orientation","horizontal"),t.setAttribute("aria-labelledby","highlightColorPickerLabel"),t}#Fn(t){const e=document.createElement("div");e.addEventListener("contextmenu",s.noContextMenu),e.className="dropdown",e.role="listbox",e.setAttribute("aria-multiselectable",!1),e.setAttribute("aria-orientation","vertical"),e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown");for(const[n,r]of this.#yn.highlightColors){const i=document.createElement("button");i.tabIndex="0",i.role="option",i.setAttribute("data-color",r),i.title=n,i.setAttribute("data-l10n-id",`pdfjs-editor-colorpicker-${n}`);const s=document.createElement("span");i.append(s),s.className="swatch",s.style.backgroundColor=r,i.setAttribute("aria-selected",r===this.#Mn),i.addEventListener("click",this.#On.bind(this,t,r)),e.append(i)}return e.addEventListener("keydown",this.#i),e}#On(t,e,n){n.stopPropagation(),this.#Dn.dispatch("switchannotationeditorparams",{source:this,type:t,value:e})}_colorSelectFromKeyboard(t){const e=t.target.getAttribute("data-color");e&&this.#On(e,t)}_moveToNext(t){t.target!==this.#Cn?t.target.nextSibling?.focus():this.#In.firstChild?.focus()}_moveToPrevious(t){t.target.previousSibling?.focus()}_moveToBeginning(){this.#In.firstChild?.focus()}_moveToEnd(){this.#In.lastChild?.focus()}#s(t){a._keyboardManager.exec(this,t)}#Ln(t){if(this.#In&&!this.#In.classList.contains("hidden"))return void this.hideDropdown();if(this.#Cn.addEventListener("keydown",this.#i),this.#Rn=0===t.detail,this.#In)return void this.#In.classList.remove("hidden");const e=this.#In=this.#Fn(r.AnnotationEditorParamsType.HIGHLIGHT_COLOR);this.#Cn.append(e)}hideDropdown(){this.#In?.classList.add("hidden")}_hideDropdownFromKeyboard(){this.#Pn||!this.#In||this.#In.classList.contains("hidden")||(this.hideDropdown(),this.#Cn.removeEventListener("keydown",this.#i),this.#Cn.focus({preventScroll:!0,focusVisible:this.#Rn}))}updateColor(t){if(this.#kn&&(this.#kn.style.backgroundColor=t),!this.#In)return;const e=this.#yn.highlightColors.values();for(const n of this.#In.children)n.setAttribute("aria-selected",e.next().value===t)}destroy(){this.#Cn?.remove(),this.#Cn=null,this.#kn=null,this.#In?.remove(),this.#In=null}}},9115:(t,e,n)=>{n.d(e,{AnnotationEditor:()=>l}),n(3352);var r=n(4812),i=n(3266),s=n(473);class a{#Bn="";#Nn=!1;#qn=null;#jn=null;#Hn=null;#zn=!1;#Un=null;static _l10nPromise=null;constructor(t){this.#Un=t}static initialize(t){a._l10nPromise||=t}async render(){const t=this.#qn=document.createElement("button");t.className="altText";const e=await a._l10nPromise.get("pdfjs-editor-alt-text-button-label");t.textContent=e,t.setAttribute("aria-label",e),t.tabIndex="0",t.addEventListener("contextmenu",s.noContextMenu),t.addEventListener("pointerdown",(t=>t.stopPropagation()));const n=t=>{t.preventDefault(),this.#Un._uiManager.editAltText(this.#Un)};return t.addEventListener("click",n,{capture:!0}),t.addEventListener("keydown",(e=>{e.target===t&&"Enter"===e.key&&(this.#zn=!0,n(e))})),await this.#Vn(),t}finish(){this.#qn&&(this.#qn.focus({focusVisible:this.#zn}),this.#zn=!1)}get data(){return{altText:this.#Bn,decorative:this.#Nn}}set data(t){let{altText:e,decorative:n}=t;this.#Bn===e&&this.#Nn===n||(this.#Bn=e,this.#Nn=n,this.#Vn())}toggle(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.#qn&&(!t&&this.#Hn&&(clearTimeout(this.#Hn),this.#Hn=null),this.#qn.disabled=!t)}destroy(){this.#qn?.remove(),this.#qn=null,this.#jn=null}async#Vn(){const t=this.#qn;if(!t)return;if(!this.#Bn&&!this.#Nn)return t.classList.remove("done"),void this.#jn?.remove();t.classList.add("done"),a._l10nPromise.get("pdfjs-editor-alt-text-edit-button-label").then((e=>{t.setAttribute("aria-label",e)}));let e=this.#jn;if(!e){this.#jn=e=document.createElement("span"),e.className="tooltip",e.setAttribute("role","tooltip");const n=e.id=`alt-text-tooltip-${this.#Un.id}`;t.setAttribute("aria-describedby",n);const r=100;t.addEventListener("mouseenter",(()=>{this.#Hn=setTimeout((()=>{this.#Hn=null,this.#jn.classList.add("show"),this.#Un._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",subtype:this.#Un.editorType,data:{action:"alt_text_tooltip"}}})}),r)})),t.addEventListener("mouseleave",(()=>{this.#Hn&&(clearTimeout(this.#Hn),this.#Hn=null),this.#jn?.classList.remove("show")}))}e.innerText=this.#Nn?await a._l10nPromise.get("pdfjs-editor-alt-text-decorative-tooltip"):this.#Bn,e.parentNode||t.append(e);const n=this.#Un.getImageForAltText();n?.setAttribute("aria-describedby",e.id)}}class o{#Gn=null;#Wt=null;#Un;#Wn=null;constructor(t){this.#Un=t}render(){const t=this.#Gn=document.createElement("div");t.className="editToolbar",t.addEventListener("contextmenu",s.noContextMenu),t.addEventListener("pointerdown",o.#$n);const e=this.#Wn=document.createElement("div");e.className="buttons",t.append(e);const n=this.#Un.toolbarPosition;if(n){const{style:e}=t,r="ltr"===this.#Un._uiManager.direction?1-n[0]:n[0];e.insetInlineEnd=100*r+"%",e.top=`calc(${100*n[1]}% + var(--editor-toolbar-vert-offset))`}return this.#Xn(),t}static#$n(t){t.stopPropagation()}#Kn(t){this.#Un._focusEventsAllowed=!1,t.preventDefault(),t.stopPropagation()}#Qn(t){this.#Un._focusEventsAllowed=!0,t.preventDefault(),t.stopPropagation()}#Yn(t){t.addEventListener("focusin",this.#Kn.bind(this),{capture:!0}),t.addEventListener("focusout",this.#Qn.bind(this),{capture:!0}),t.addEventListener("contextmenu",s.noContextMenu)}hide(){this.#Gn.classList.add("hidden"),this.#Wt?.hideDropdown()}show(){this.#Gn.classList.remove("hidden")}#Xn(){const t=document.createElement("button");t.className="delete",t.tabIndex=0,t.setAttribute("data-l10n-id",`pdfjs-editor-remove-${this.#Un.editorType}-button`),this.#Yn(t),t.addEventListener("click",(t=>{this.#Un._uiManager.delete()})),this.#Wn.append(t)}get#Jn(){const t=document.createElement("div");return t.className="divider",t}addAltTextButton(t){this.#Yn(t),this.#Wn.prepend(t,this.#Jn)}addColorPicker(t){this.#Wt=t;const e=t.renderButton();this.#Yn(e),this.#Wn.prepend(e,this.#Jn)}remove(){this.#Gn.remove(),this.#Wt?.destroy(),this.#Wt=null}}class l{#Zn=null;#Bn=null;#tr=!1;#er=null;#nr=null;#rr=this.focusin.bind(this);#ir=this.focusout.bind(this);#sr=null;#ar="";#or=!1;#lr=!1;#cr=!1;#dr=!1;#ur=null;_initialOptions=Object.create(null);_uiManager=null;_focusEventsAllowed=!0;_l10nPromise=null;#hr=!1;#pr=l._zIndex++;static _borderLineWidth=-1;static _colorManager=new r.ColorManager;static _zIndex=1;static get _resizerKeyboardManager(){const t=l.prototype._resizeWithKeyboard,e=r.AnnotationEditorUIManager.TRANSLATE_SMALL,n=r.AnnotationEditorUIManager.TRANSLATE_BIG;return(0,i.shadow)(this,"_resizerKeyboardManager",new r.KeyboardManager([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-n,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[n,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-n]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,n]}],[["Escape","mac+Escape"],l.prototype._stopResizingWithKeyboard]]))}constructor(t){this.constructor===l&&(0,i.unreachable)("Cannot initialize AnnotationEditor."),this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null;const{rotation:e,rawDims:{pageWidth:n,pageHeight:r,pageX:s,pageY:a}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,r],this.pageTranslation=[s,a];const[o,c]=this.parentDimensions;this.x=t.x/o,this.y=t.y/c,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return(0,i.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const e=new c({id:t.parent.getNextId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(l._l10nPromise||=new Map(["pdfjs-editor-alt-text-button-label","pdfjs-editor-alt-text-edit-button-label","pdfjs-editor-alt-text-decorative-tooltip","pdfjs-editor-resizer-label-topLeft","pdfjs-editor-resizer-label-topMiddle","pdfjs-editor-resizer-label-topRight","pdfjs-editor-resizer-label-middleRight","pdfjs-editor-resizer-label-bottomRight","pdfjs-editor-resizer-label-bottomMiddle","pdfjs-editor-resizer-label-bottomLeft","pdfjs-editor-resizer-label-middleLeft"].map((e=>[e,t.get(e.replaceAll(/([A-Z])/g,(t=>`-${t.toLowerCase()}`)))]))),e?.strings)for(const n of e.strings)l._l10nPromise.set(n,t.get(n));if(-1!==l._borderLineWidth)return;const n=getComputedStyle(document.documentElement);l._borderLineWidth=parseFloat(n.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){(0,i.unreachable)("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#hr}set _isDraggable(t){this.#hr=t,this.div?.classList.toggle("draggable",t)}get isEnterHandled(){return!0}center(){const[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(2*t),this.y+=this.width*t/(2*e);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(2*t),this.y-=this.width*t/(2*e);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#pr}setParent(t){null!==t?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):this.#fr(),this.parent=t}focusin(t){this._focusEventsAllowed&&(this.#or?this.#or=!1:this.parent.setSelected(this))}focusout(t){if(!this._focusEventsAllowed)return;if(!this.isAttachedToDOM)return;const e=t.relatedTarget;e?.closest(`#${this.id}`)||(t.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,n,r){const[i,s]=this.parentDimensions;[n,r]=this.screenToPageTranslation(n,r),this.x=(t+n)/i,this.y=(e+r)/s,this.fixAndSetPosition()}#mr(t,e,n){let[r,i]=t;[e,n]=this.screenToPageTranslation(e,n),this.x+=e/r,this.y+=n/i,this.fixAndSetPosition()}translate(t,e){this.#mr(this.parentDimensions,t,e)}translateInPage(t,e){this.#mr(this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}drag(t,e){const[n,r]=this.parentDimensions;if(this.x+=t/n,this.y+=e/r,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:t,y:e}=this.div.getBoundingClientRect();this.parent.findNewParent(this,t,e)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:i,y:s}=this;const[a,o]=this.#gr();i+=a,s+=o,this.div.style.left=`${(100*i).toFixed(2)}%`,this.div.style.top=`${(100*s).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}#gr(){const[t,e]=this.parentDimensions,{_borderLineWidth:n}=l,r=n/t,i=n/e;switch(this.rotation){case 90:return[-r,i];case 180:return[r,i];case 270:return[r,-i];default:return[-r,-i]}}fixAndSetPosition(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.rotation;const[e,n]=this.pageDimensions;let{x:r,y:i,width:s,height:a}=this;switch(s*=e,a*=n,r*=e,i*=n,t){case 0:r=Math.max(0,Math.min(e-s,r)),i=Math.max(0,Math.min(n-a,i));break;case 90:r=Math.max(0,Math.min(e-a,r)),i=Math.min(n,Math.max(s,i));break;case 180:r=Math.min(e,Math.max(s,r)),i=Math.min(n,Math.max(a,i));break;case 270:r=Math.min(e,Math.max(a,r)),i=Math.max(0,Math.min(n-s,i))}this.x=r/=e,this.y=i/=n;const[o,l]=this.#gr();r+=o,i+=l;const{style:c}=this.div;c.left=`${(100*r).toFixed(2)}%`,c.top=`${(100*i).toFixed(2)}%`,this.moveInDOM()}static#vr(t,e,n){switch(n){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}}screenToPageTranslation(t,e){return l.#vr(t,e,this.parentRotation)}pageTranslationToScreen(t,e){return l.#vr(t,e,360-this.parentRotation)}#br(t){switch(t){case 90:{const[t,e]=this.pageDimensions;return[0,-t/e,e/t,0]}case 180:return[-1,0,0,-1];case 270:{const[t,e]=this.pageDimensions;return[0,t/e,-e/t,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:t,pageDimensions:[e,n]}=this,r=e*t,s=n*t;return i.FeatureTest.isCSSRoundSupported?[Math.round(r),Math.round(s)]:[r,s]}setDims(t,e){const[n,r]=this.parentDimensions;this.div.style.width=`${(100*t/n).toFixed(2)}%`,this.#tr||(this.div.style.height=`${(100*e/r).toFixed(2)}%`)}fixDims(){const{style:t}=this.div,{height:e,width:n}=t,r=n.endsWith("%"),i=!this.#tr&&e.endsWith("%");if(r&&i)return;const[s,a]=this.parentDimensions;r||(t.width=`${(100*parseFloat(n)/s).toFixed(2)}%`),this.#tr||i||(t.height=`${(100*parseFloat(e)/a).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#_r(){if(this.#er)return;this.#er=document.createElement("div"),this.#er.classList.add("resizers");const t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"];for(const e of t){const t=document.createElement("div");this.#er.append(t),t.classList.add("resizer",e),t.setAttribute("data-resizer-name",e),t.addEventListener("pointerdown",this.#yr.bind(this,e)),t.addEventListener("contextmenu",s.noContextMenu),t.tabIndex=-1}this.div.prepend(this.#er)}#yr(t,e){e.preventDefault();const{isMac:n}=i.FeatureTest.platform;if(0!==e.button||e.ctrlKey&&n)return;this.#Bn?.toggle(!1);const r=this.#Ar.bind(this,t),s=this._isDraggable;this._isDraggable=!1;const a={passive:!0,capture:!0};this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",r,a);const o=this.x,l=this.y,c=this.width,d=this.height,u=this.parent.div.style.cursor,h=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;const p=()=>{this.parent.togglePointerEvents(!0),this.#Bn?.toggle(!0),this._isDraggable=s,window.removeEventListener("pointerup",p),window.removeEventListener("blur",p),window.removeEventListener("pointermove",r,a),this.parent.div.style.cursor=u,this.div.style.cursor=h,this.#wr(o,l,c,d)};window.addEventListener("pointerup",p),window.addEventListener("blur",p)}#wr(t,e,n,r){const i=this.x,s=this.y,a=this.width,o=this.height;i===t&&s===e&&a===n&&o===r||this.addCommands({cmd:()=>{this.width=a,this.height=o,this.x=i,this.y=s;const[t,e]=this.parentDimensions;this.setDims(t*a,e*o),this.fixAndSetPosition()},undo:()=>{this.width=n,this.height=r,this.x=t,this.y=e;const[i,s]=this.parentDimensions;this.setDims(i*n,s*r),this.fixAndSetPosition()},mustExec:!0})}#Ar(t,e){const[n,r]=this.parentDimensions,i=this.x,s=this.y,a=this.width,o=this.height,c=l.MIN_SIZE/n,d=l.MIN_SIZE/r,u=t=>Math.round(1e4*t)/1e4,h=this.#br(this.rotation),p=(t,e)=>[h[0]*t+h[2]*e,h[1]*t+h[3]*e],f=this.#br(360-this.rotation);let m,g,v=!1,b=!1;switch(t){case"topLeft":v=!0,m=(t,e)=>[0,0],g=(t,e)=>[t,e];break;case"topMiddle":m=(t,e)=>[t/2,0],g=(t,e)=>[t/2,e];break;case"topRight":v=!0,m=(t,e)=>[t,0],g=(t,e)=>[0,e];break;case"middleRight":b=!0,m=(t,e)=>[t,e/2],g=(t,e)=>[0,e/2];break;case"bottomRight":v=!0,m=(t,e)=>[t,e],g=(t,e)=>[0,0];break;case"bottomMiddle":m=(t,e)=>[t/2,e],g=(t,e)=>[t/2,0];break;case"bottomLeft":v=!0,m=(t,e)=>[0,e],g=(t,e)=>[t,0];break;case"middleLeft":b=!0,m=(t,e)=>[0,e/2],g=(t,e)=>[t,e/2]}const _=m(a,o),y=g(a,o);let A=p(...y);const w=u(i+A[0]),x=u(s+A[1]);let E=1,S=1,[T,C]=this.screenToPageTranslation(e.movementX,e.movementY);var k,M;if([T,C]=(k=T/n,M=C/r,[f[0]*k+f[2]*M,f[1]*k+f[3]*M]),v){const t=Math.hypot(a,o);E=S=Math.max(Math.min(Math.hypot(y[0]-_[0]-T,y[1]-_[1]-C)/t,1/a,1/o),c/a,d/o)}else b?E=Math.max(c,Math.min(1,Math.abs(y[0]-_[0]-T)))/a:S=Math.max(d,Math.min(1,Math.abs(y[1]-_[1]-C)))/o;const I=u(a*E),R=u(o*S);A=p(...g(I,R));const P=w-A[0],D=x-A[1];this.width=I,this.height=R,this.x=P,this.y=D,this.setDims(n*I,r*R),this.fixAndSetPosition()}altTextFinish(){this.#Bn?.finish()}async addEditToolbar(){return this.#sr||this.#cr||(this.#sr=new o(this),this.div.append(this.#sr.render()),this.#Bn&&this.#sr.addAltTextButton(await this.#Bn.render())),this.#sr}removeEditToolbar(){this.#sr&&(this.#sr.remove(),this.#sr=null,this.#Bn?.destroy())}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){this.#Bn||(a.initialize(l._l10nPromise),this.#Bn=new a(this),await this.addEditToolbar())}get altTextData(){return this.#Bn?.data}set altTextData(t){this.#Bn&&(this.#Bn.data=t)}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.setAttribute("tabIndex",0),this.setInForeground(),this.div.addEventListener("focusin",this.#rr),this.div.addEventListener("focusout",this.#ir);const[t,e]=this.parentDimensions;this.parentRotation%180!=0&&(this.div.style.maxWidth=`${(100*e/t).toFixed(2)}%`,this.div.style.maxHeight=`${(100*t/e).toFixed(2)}%`);const[n,i]=this.getInitialTranslation();return this.translate(n,i),(0,r.bindEvents)(this,this.div,["pointerdown"]),this.div}pointerdown(t){const{isMac:e}=i.FeatureTest.platform;0!==t.button||t.ctrlKey&&e?t.preventDefault():(this.#or=!0,this._isDraggable?this.#xr(t):this.#Er(t))}#Er(t){const{isMac:e}=i.FeatureTest.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)}#xr(t){const e=this._uiManager.isSelected(this);let n,r;this._uiManager.setUpDragSession(),e&&(n={passive:!0,capture:!0},r=t=>{const[e,n]=this.screenToPageTranslation(t.movementX,t.movementY);this._uiManager.dragSelectedEditors(e,n)},window.addEventListener("pointermove",r,n));const i=()=>{window.removeEventListener("pointerup",i),window.removeEventListener("blur",i),e&&window.removeEventListener("pointermove",r,n),this.#or=!1,this._uiManager.endDragSession()||this.#Er(t)};window.addEventListener("pointerup",i),window.addEventListener("blur",i)}moveInDOM(){this.#ur&&clearTimeout(this.#ur),this.#ur=setTimeout((()=>{this.#ur=null,this.parent?.moveEditorInDOM(this)}),0)}_setParentAndPosition(t,e,n){t.changeParent(this),this.x=e,this.y=n,this.fixAndSetPosition()}getRect(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.rotation;const r=this.parentScale,[i,s]=this.pageDimensions,[a,o]=this.pageTranslation,l=t/r,c=e/r,d=this.x*i,u=this.y*s,h=this.width*i,p=this.height*s;switch(n){case 0:return[d+l+a,s-u-c-p+o,d+l+h+a,s-u-c+o];case 90:return[d+c+a,s-u+l+o,d+c+p+a,s-u+l+h+o];case 180:return[d-l-h+a,s-u+c+o,d-l+a,s-u+c+p+o];case 270:return[d-c-p+a,s-u-l-h+o,d-c+a,s-u-l+o];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[n,r,i,s]=t,a=i-n,o=s-r;switch(this.rotation){case 0:return[n,e-s,a,o];case 90:return[n,e-r,o,a];case 180:return[i,e-r,a,o];case 270:return[i,e-s,o,a];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#cr=!0}disableEditMode(){this.#cr=!1}isInEditMode(){return this.#cr}shouldGetKeyboardEvents(){return this.#dr}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){this.div?.addEventListener("focusin",this.#rr),this.div?.addEventListener("focusout",this.#ir)}rotate(t){}serialize(){(0,i.unreachable)("An editor must be serializable")}static deserialize(t,e,n){const r=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:n});r.rotation=t.rotation;const[i,s]=r.pageDimensions,[a,o,l,c]=r.getRectInCurrentCoords(t.rect,s);return r.x=a/i,r.y=o/s,r.width=l/i,r.height=c/s,r}remove(){this.div.removeEventListener("focusin",this.#rr),this.div.removeEventListener("focusout",this.#ir),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#ur&&(clearTimeout(this.#ur),this.#ur=null),this.#fr(),this.removeEditToolbar()}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#_r(),this.#er.classList.remove("hidden"),(0,r.bindEvents)(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(t){if(!this.isResizable||t.target!==this.div||"Enter"!==t.key)return;this._uiManager.setSelected(this),this.#nr={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};const e=this.#er.children;if(!this.#Zn){this.#Zn=Array.from(e);const t=this.#Sr.bind(this),n=this.#Tr.bind(this);for(const e of this.#Zn){const r=e.getAttribute("data-resizer-name");e.setAttribute("role","spinbutton"),e.addEventListener("keydown",t),e.addEventListener("blur",n),e.addEventListener("focus",this.#Cr.bind(this,r)),l._l10nPromise.get(`pdfjs-editor-resizer-label-${r}`).then((t=>e.setAttribute("aria-label",t)))}}const n=this.#Zn[0];let r=0;for(const t of e){if(t===n)break;r++}const i=(360-this.rotation+this.parentRotation)%360/90*(this.#Zn.length/4);if(i!==r){if(i=n)if(o>r)i[t][1]=r;else{if(1===s)return[];i.splice(t,1),t--,s--}else i[t][2]=n,o>r&&i.push([e,r,o])}}return i}}},4812:(t,e,n)=>{n.d(e,{AnnotationEditorUIManager:()=>h,ColorManager:()=>u,KeyboardManager:()=>d,bindEvents:()=>s,opacityToHex:()=>a}),n(8837),n(9803),n(8347),n(7995),n(62),n(4602),n(344),n(4305),n(7583),n(4226),n(5561),n(8587),n(3247),n(3302),n(9490),n(5438),n(7914),n(7121),n(385),n(7944),n(2808),n(8518);var r=n(3266),i=n(473);function s(t,e,n){for(const r of n)e.addEventListener(r,t[r].bind(t))}function a(t){return Math.round(Math.min(255,Math.max(1,255*t))).toString(16).padStart(2,"0")}class o{#vt=0;getId(){return`${r.AnnotationEditorPrefix}${this.#vt++}`}}class l{#Br=(0,r.getUuid)();#vt=0;#bt=null;static get _isSVGFittingCanvas(){const t=new OffscreenCanvas(1,3).getContext("2d"),e=new Image;e.src='data:image/svg+xml;charset=UTF-8,';const n=e.decode().then((()=>(t.drawImage(e,0,0,1,1,0,0,1,3),0===new Uint32Array(t.getImageData(0,0,1,1).data.buffer)[0])));return(0,r.shadow)(this,"_isSVGFittingCanvas",n)}async#Nr(t,e){this.#bt||=new Map;let n=this.#bt.get(t);if(null===n)return null;if(n?.bitmap)return n.refCounter+=1,n;try{let t;if(n||={bitmap:null,id:`image_${this.#Br}_${this.#vt++}`,refCounter:0,isSvg:!1},"string"==typeof e?(n.url=e,t=await(0,i.fetchData)(e,"blob")):t=n.file=e,"image/svg+xml"===t.type){const e=l._isSVGFittingCanvas,r=new FileReader,i=new Image,s=new Promise(((t,s)=>{i.onload=()=>{n.bitmap=i,n.isSvg=!0,t()},r.onload=async()=>{const t=n.svgUrl=r.result;i.src=await e?`${t}#svgView(preserveAspectRatio(none))`:t},i.onerror=r.onerror=s}));r.readAsDataURL(t),await s}else n.bitmap=await createImageBitmap(t);n.refCounter=1}catch(t){console.error(t),n=null}return this.#bt.set(t,n),n&&this.#bt.set(n.id,n),n}async getFromFile(t){const{lastModified:e,name:n,size:r,type:i}=t;return this.#Nr(`${e}_${n}_${r}_${i}`,t)}async getFromUrl(t){return this.#Nr(t,t)}async getFromId(t){this.#bt||=new Map;const e=this.#bt.get(t);return e?e.bitmap?(e.refCounter+=1,e):e.file?this.getFromFile(e.file):this.getFromUrl(e.url):null}getSvgUrl(t){const e=this.#bt.get(t);return e?.isSvg?e.svgUrl:null}deleteId(t){this.#bt||=new Map;const e=this.#bt.get(t);e&&(e.refCounter-=1,0===e.refCounter&&(e.bitmap=null))}isValidId(t){return t.startsWith(`image_${this.#Br}_`)}}class c{#qr=[];#jr=!1;#Hr;#zr=-1;constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:128;this.#Hr=t}add(t){let{cmd:e,undo:n,mustExec:r,type:i=NaN,overwriteIfSameType:s=!1,keepUndo:a=!1}=t;if(r&&e(),this.#jr)return;const o={cmd:e,undo:n,type:i};if(-1===this.#zr)return this.#qr.length>0&&(this.#qr.length=0),this.#zr=0,void this.#qr.push(o);if(s&&this.#qr[this.#zr].type===i)return a&&(o.undo=this.#qr[this.#zr].undo),void(this.#qr[this.#zr]=o);const l=this.#zr+1;l===this.#Hr?this.#qr.splice(0,1):(this.#zr=l,l{var e=[];function n(t){for(var n=-1,r=0;r\n `;for(let r=0;r
",r.assessApp().on("button:btn_essay_character_limit_cancel:clicked",(()=>{a.hideDialog()})),r.appInstance().on("test:panel:show",(()=>{setTimeout((()=>{const t=document.querySelectorAll(".essay-limit-character-item");t&&t.forEach((t=>{let e=t.getAttribute("data-item-reference");t.addEventListener("click",(()=>{r.appInstance().items().goto(e),a.hideDialog()}))}))}),500)})),a.dialog({header:e.submitTest,body:n,buttons:[{button_id:"btn_essay_character_limit_cancel",label:e.decline,is_primary:!0}]})}(e)}else!function(){const t=document.getElementById("lrn_assess_next_btn");if(t)t.click();else{const t={show_submit_confirmation:!0,show_submit_ui:!0,success:function(t){i.A.info("Submit was successful",t)},error:function(t){i.A.error("Submit has failed",t)}};r.appInstance().submit(t)}}()}function L(t){return t.replace(/<[^>]*>/g,"").trim()}function F(t){return t.replace(/\s+/g,"")}},6975:(t,e,n)=>{n.a(t,(async(t,r)=>{try{n.d(e,{LT:()=>x});var i=n(4648),s=n(4029),a=n(9161),o=n(8421),l=n(2519),c=n(1017),d=n(1499),u=n(4163),h=n(3835),p=n(5220),f=n(4358),m=n(8286),g=n(5588),v=n(2447),b=n(3753),_=n(1978),y=n(2333),A=t([g]);g=(A.then?(await A)():A)[0];const w={extensions:{ariaCountOnNav:{...s},blockGrammarChecks:{...a},checkAnswerValidation:{...o},columnResizer:{...l},essayLimitByCharacter:{...c},hideAlternatives:{...d},keyboardShortcuts:{...u},magnifier:{...h},mcqLabelPrefix:{...p},networkStatus:{...f},pageOverlay:{...m},renderPDF:{...g},resetResponse:{...v},themes:{...b},toggleTimer:{..._},whiteNoise:{...y}}},x={...i.LT,...w};r()}catch(t){r(t)}}))},7484:(t,e,n)=>{n.d(e,{A:()=>r});const r={debug:function(t,e){"DEBUG"===e&&console.log(t)},error:function(t){console.error("%cError:%c "+t,"display:inline-block;background-color:#e0005a;color:#fff;font-weight:bold;padding:3px 7px;border-radius:3px","")},info:function(t){console.info("%cInfo:%c "+t,"display:inline-block;background-color:#46C0FF;color:#000;font-weight:bold;padding:3px 7px;border-radius:3px","")},log:function(t){console.log(t)},warn:function(t,e="log"){console.warn("%cWarning:%c "+t,"display:inline-block;background-color:gold;color:#000;font-weight:bold;padding:3px 7px;border-radius:3px","")}}},1234:()=>{},9091:(t,e,n)=>{n.a(t,(async(t,e)=>{try{var n={1782:(t,e,n)=>{var r=n(7316),i=n(9762),s=TypeError;t.exports=function(t){if(r(t))return t;throw new s(i(t)+" is not a function")}},4958:(t,e,n)=>{var r=n(7316),i=String,s=TypeError;t.exports=function(t){if("object"==typeof t||r(t))return t;throw new s("Can't set "+i(t)+" as a prototype")}},5690:(t,e,n)=>{var r=n(23).has;t.exports=function(t){return r(t),t}},5834:(t,e,n)=>{var r=n(2658),i=TypeError;t.exports=function(t,e){if(r(e,t))return t;throw new i("Incorrect invocation")}},4719:(t,e,n)=>{var r=n(7633),i=String,s=TypeError;t.exports=function(t){if(r(t))return t;throw new s(i(t)+" is not an object")}},5115:t=>{t.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView},7585:(t,e,n)=>{var r=n(1299),i=n(8374),s=TypeError;t.exports=r(ArrayBuffer.prototype,"byteLength","get")||function(t){if("ArrayBuffer"!==i(t))throw new s("ArrayBuffer expected");return t.byteLength}},582:(t,e,n)=>{var r=n(8403),i=n(7585),s=r(ArrayBuffer.prototype.slice);t.exports=function(t){if(0!==i(t))return!1;try{return s(t,0,0),!1}catch(t){return!0}}},4358:(t,e,n)=>{var r=n(9298),i=n(8403),s=n(1299),a=n(9548),o=n(582),l=n(7585),c=n(8126),d=n(4837),u=r.structuredClone,h=r.ArrayBuffer,p=r.DataView,f=r.TypeError,m=Math.min,g=h.prototype,v=p.prototype,b=i(g.slice),_=s(g,"resizable","get"),y=s(g,"maxByteLength","get"),A=i(v.getInt8),w=i(v.setInt8);t.exports=(d||c)&&function(t,e,n){var r,i=l(t),s=void 0===e?i:a(e),g=!_||!_(t);if(o(t))throw new f("ArrayBuffer is detached");if(d&&(t=u(t,{transfer:[t]}),i===s&&(n||g)))return t;if(i>=s&&(!n||g))r=b(t,0,s);else{var v=n&&!g&&y?{maxByteLength:y(t)}:void 0;r=new h(s,v);for(var x=new p(t),E=new p(r),S=m(s,i),T=0;T{var r,i,s,a=n(5115),o=n(940),l=n(9298),c=n(7316),d=n(7633),u=n(936),h=n(8329),p=n(9762),f=n(9293),m=n(7041),g=n(9691),v=n(2658),b=n(2176),_=n(9763),y=n(2292),A=n(7561),w=n(1649),x=w.enforce,E=w.get,S=l.Int8Array,T=S&&S.prototype,C=l.Uint8ClampedArray,k=C&&C.prototype,M=S&&b(S),I=T&&b(T),R=Object.prototype,P=l.TypeError,D=y("toStringTag"),L=A("TYPED_ARRAY_TAG"),F="TypedArrayConstructor",O=a&&!!_&&"Opera"!==h(l.opera),B=!1,N={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},q={BigInt64Array:8,BigUint64Array:8},j=function(t){var e=b(t);if(d(e)){var n=E(e);return n&&u(n,F)?n[F]:j(e)}},H=function(t){if(!d(t))return!1;var e=h(t);return u(N,e)||u(q,e)};for(r in N)(s=(i=l[r])&&i.prototype)?x(s)[F]=i:O=!1;for(r in q)(s=(i=l[r])&&i.prototype)&&(x(s)[F]=i);if((!O||!c(M)||M===Function.prototype)&&(M=function(){throw new P("Incorrect invocation")},O))for(r in N)l[r]&&_(l[r],M);if((!O||!I||I===R)&&(I=M.prototype,O))for(r in N)l[r]&&_(l[r].prototype,I);if(O&&b(k)!==I&&_(k,I),o&&!u(I,D))for(r in B=!0,g(I,D,{configurable:!0,get:function(){return d(this)?this[L]:void 0}}),N)l[r]&&f(l[r],L,r);t.exports={NATIVE_ARRAY_BUFFER_VIEWS:O,TYPED_ARRAY_TAG:B&&L,aTypedArray:function(t){if(H(t))return t;throw new P("Target is not a typed array")},aTypedArrayConstructor:function(t){if(c(t)&&(!_||v(M,t)))return t;throw new P(p(t)+" is not a typed array constructor")},exportTypedArrayMethod:function(t,e,n,r){if(o){if(n)for(var i in N){var s=l[i];if(s&&u(s.prototype,t))try{delete s.prototype[t]}catch(n){try{s.prototype[t]=e}catch(t){}}}I[t]&&!n||m(I,t,n?e:O&&T[t]||e,r)}},exportTypedArrayStaticMethod:function(t,e,n){var r,i;if(o){if(_){if(n)for(r in N)if((i=l[r])&&u(i,t))try{delete i[t]}catch(t){}if(M[t]&&!n)return;try{return m(M,t,n?e:O&&M[t]||e)}catch(t){}}for(r in N)!(i=l[r])||i[t]&&!n||m(i,t,e)}},getTypedArrayConstructor:j,isView:function(t){if(!d(t))return!1;var e=h(t);return"DataView"===e||u(N,e)||u(q,e)},isTypedArray:H,TypedArray:M,TypedArrayPrototype:I}},7003:(t,e,n)=>{var r=n(451);t.exports=function(t,e,n){for(var i=0,s=arguments.length>2?n:r(e),a=new t(s);s>i;)a[i]=e[i++];return a}},9773:(t,e,n)=>{var r=n(4115),i=n(6985),s=n(451),a=function(t){return function(e,n,a){var o,l=r(e),c=s(l),d=i(a,c);if(t&&n!=n){for(;c>d;)if((o=l[d++])!=o)return!0}else for(;c>d;d++)if((t||d in l)&&l[d]===n)return t||d||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},4026:(t,e,n)=>{var r=n(7789),i=n(3622),s=n(2007),a=n(451),o=function(t){var e=1===t;return function(n,o,l){for(var c,d=s(n),u=i(d),h=a(u),p=r(o,l);h-- >0;)if(p(c=u[h],h,d))switch(t){case 0:return c;case 1:return h}return e?-1:void 0}};t.exports={findLast:o(0),findLastIndex:o(1)}},6661:(t,e,n)=>{var r=n(940),i=n(6998),s=TypeError,a=Object.getOwnPropertyDescriptor,o=r&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}();t.exports=o?function(t,e){if(i(t)&&!a(t,"length").writable)throw new s("Cannot set read only .length");return t.length=e}:function(t,e){return t.length=e}},2304:(t,e,n)=>{var r=n(451);t.exports=function(t,e){for(var n=r(t),i=new e(n),s=0;s{var r=n(2304),i=n(5861),s=i.aTypedArray,a=i.exportTypedArrayMethod,o=i.getTypedArrayConstructor;a("toReversed",(function(){return r(s(this),o(this))}))},62:(t,e,n)=>{var r=n(5861),i=n(8403),s=n(1782),a=n(7003),o=r.aTypedArray,l=r.getTypedArrayConstructor,c=r.exportTypedArrayMethod,d=i(r.TypedArrayPrototype.sort);c("toSorted",(function(t){void 0!==t&&s(t);var e=o(this),n=a(l(e),e);return d(n,t)}))},4602:(t,e,n)=>{var r=n(5886),i=n(5861),s=n(5986),a=n(1003),o=n(212),l=i.aTypedArray,c=i.getTypedArrayConstructor,d=i.exportTypedArrayMethod,u=!!function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(t){return 8===t}}();d("with",{with:function(t,e){var n=l(this),i=a(t),d=s(n)?o(e):+e;return r(n,c(n),i,d)}}.with,!u)},344:(t,e,n)=>{var r=n(940),i=n(9691),s=n(582),a=ArrayBuffer.prototype;r&&!("detached"in a)&&i(a,"detached",{configurable:!0,get:function(){return s(this)}})},7583:(t,e,n)=>{var r=n(4978),i=n(4358);i&&r({target:"ArrayBuffer",proto:!0},{transferToFixedLength:function(){return i(this,arguments.length?arguments[0]:void 0,!1)}})},4305:(t,e,n)=>{var r=n(4978),i=n(4358);i&&r({target:"ArrayBuffer",proto:!0},{transfer:function(){return i(this,arguments.length?arguments[0]:void 0,!0)}})},7121:(t,e,n)=>{var r=n(4978),i=n(9298),s=n(5834),a=n(4719),o=n(7316),l=n(2176),c=n(9691),d=n(8947),u=n(8154),h=n(936),p=n(2292),f=n(5238).IteratorPrototype,m=n(940),g=n(2554),v="constructor",b="Iterator",_=p("toStringTag"),y=TypeError,A=i[b],w=g||!o(A)||A.prototype!==f||!u((function(){A({})})),x=function(){if(s(this,f),l(this)===f)throw new y("Abstract class Iterator not directly constructable")},E=function(t,e){m?c(f,t,{configurable:!0,get:function(){return e},set:function(e){if(a(this),this===f)throw new y("You can't redefine this property");h(this,t)?this[t]=e:d(this,t,e)}}):f[t]=e};h(f,_)||E(_,b),!w&&h(f,v)&&f[v]!==Object||E(v,x),x.prototype=f,r({global:!0,constructor:!0,forced:w},{Iterator:x})},385:(t,e,n)=>{var r=n(4978),i=n(6837),s=n(1782),a=n(4719),o=n(9235);r({target:"Iterator",proto:!0,real:!0},{every:function(t){a(this),s(t);var e=o(this),n=0;return!i(e,(function(e,r){if(!t(e,n++))return r()}),{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},2993:(t,e,n)=>{var r=n(4978),i=n(2026),s=n(1782),a=n(4719),o=n(9235),l=n(375),c=n(5723),d=n(2554),u=l((function(){for(var t,e,n=this.iterator,r=this.predicate,s=this.next;;){if(t=a(i(s,n)),this.done=!!t.done)return;if(e=t.value,c(n,r,[e,this.counter++],!0))return e}}));r({target:"Iterator",proto:!0,real:!0,forced:d},{filter:function(t){return a(this),s(t),new u(o(this),{predicate:t})}})},8497:(t,e,n)=>{var r=n(4978),i=n(2026),s=n(1782),a=n(4719),o=n(9235),l=n(907),c=n(375),d=n(3316),u=n(2554),h=c((function(){for(var t,e,n=this.iterator,r=this.mapper;;){if(e=this.inner)try{if(!(t=a(i(e.next,e.iterator))).done)return t.value;this.inner=null}catch(t){d(n,"throw",t)}if(t=a(i(this.next,n)),this.done=!!t.done)return;try{this.inner=l(r(t.value,this.counter++),!1)}catch(t){d(n,"throw",t)}}}));r({target:"Iterator",proto:!0,real:!0,forced:u},{flatMap:function(t){return a(this),s(t),new h(o(this),{mapper:t,inner:null})}})},7944:(t,e,n)=>{var r=n(4978),i=n(8142);r({target:"Iterator",proto:!0,real:!0,forced:n(2554)},{map:i})},8518:(t,e,n)=>{var r=n(4978),i=n(6837),s=n(1782),a=n(4719),o=n(9235);r({target:"Iterator",proto:!0,real:!0},{some:function(t){a(this),s(t);var e=o(this),n=0;return i(e,(function(e,r){if(t(e,n++))return r()}),{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},2808:(t,e,n)=>{var r=n(4978),i=n(940),s=n(9298),a=n(7187),o=n(8403),l=n(2026),c=n(7316),d=n(7633),u=n(6998),h=n(936),p=n(5730),f=n(451),m=n(8947),g=n(8154),v=n(3713),b=n(3663),_=s.JSON,y=s.Number,A=s.SyntaxError,w=_&&_.parse,x=a("Object","keys"),E=Object.getOwnPropertyDescriptor,S=o("".charAt),T=o("".slice),C=o(/./.exec),k=o([].push),M=/^\d$/,I=/^[1-9]$/,R=/^(?:-|\d)$/,P=/^[\t\n\r ]$/,D=function(t,e,n,r){var i,s,a,o,c,p=t[e],m=r&&p===r.value,g=m&&"string"==typeof r.source?{source:r.source}:{};if(d(p)){var v=u(p),b=m?r.nodes:v?[]:{};if(v)for(i=b.length,a=f(p),o=0;o{var r=n(4978),i=n(5656);r({target:"Set",proto:!0,real:!0,forced:!n(507)("difference")},{difference:i})},8587:(t,e,n)=>{var r=n(4978),i=n(8154),s=n(8461);r({target:"Set",proto:!0,real:!0,forced:!n(507)("intersection")||i((function(){return"3,2"!==Array.from(new Set([1,2,3]).intersection(new Set([3,2])))}))},{intersection:s})},3247:(t,e,n)=>{var r=n(4978),i=n(8550);r({target:"Set",proto:!0,real:!0,forced:!n(507)("isDisjointFrom")},{isDisjointFrom:i})},3302:(t,e,n)=>{var r=n(4978),i=n(990);r({target:"Set",proto:!0,real:!0,forced:!n(507)("isSubsetOf")},{isSubsetOf:i})},9490:(t,e,n)=>{var r=n(4978),i=n(194);r({target:"Set",proto:!0,real:!0,forced:!n(507)("isSupersetOf")},{isSupersetOf:i})},5438:(t,e,n)=>{var r=n(4978),i=n(3194);r({target:"Set",proto:!0,real:!0,forced:!n(507)("symmetricDifference")},{symmetricDifference:i})},7914:(t,e,n)=>{var r=n(4978),i=n(5703);r({target:"Set",proto:!0,real:!0,forced:!n(507)("union")},{union:i})},9709:(t,e,n)=>{var r=n(4978),i=n(9298),s=n(7187),a=n(1198),o=n(7744).f,l=n(936),c=n(5834),d=n(7523),u=n(1264),h=n(5050),p=n(34),f=n(940),m=n(2554),g="DOMException",v=s("Error"),b=s(g),_=function(){c(this,y);var t=arguments.length,e=u(t<1?void 0:arguments[0]),n=u(t<2?void 0:arguments[1],"Error"),r=new b(e,n),i=new v(e);return i.name=g,o(r,"stack",a(1,p(i.stack,1))),d(r,this,_),r},y=_.prototype=b.prototype,A="stack"in new v(g),w="stack"in new b(1,2),x=b&&f&&Object.getOwnPropertyDescriptor(i,g),E=!(!x||x.writable&&x.configurable),S=A&&!E&&!w;r({global:!0,constructor:!0,forced:m||S},{DOMException:S?_:b});var T=s(g),C=T.prototype;if(C.constructor!==T)for(var k in m||o(C,"constructor",a(1,T)),h)if(l(h,k)){var M=h[k],I=M.s;l(T,I)||o(T,I,a(6,M.c))}},3655:(t,e,n)=>{var r=n(7041),i=n(8403),s=n(5730),a=n(2743),o=URLSearchParams,l=o.prototype,c=i(l.append),d=i(l.delete),u=i(l.forEach),h=i([].push),p=new o("a=1&a=2&b=3");p.delete("a",1),p.delete("b",void 0),p+""!="a=2"&&r(l,"delete",(function(t){var e=arguments.length,n=e<2?void 0:arguments[1];if(e&&void 0===n)return d(this,t);var r=[];u(this,(function(t,e){h(r,{key:e,value:t})})),a(e,1);for(var i,o=s(t),l=s(n),p=0,f=0,m=!1,g=r.length;p`image/${t}`)))}static get supportedTypesStr(){return(0,r.shadow)(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(t){return this.supportedTypes.includes(t)}static paste(t,e){e.pasteEditor(r.AnnotationEditorType.STAMP,{bitmapFile:t.getAsFile()})}#en(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t?(this.#Ge=t.bitmap,e||(this.#We=t.id,this.#Ze=t.isSvg),t.file&&(this.#Qe=t.file.name),this.#Ee()):this.remove()}#nn(){this.#$e=null,this._uiManager.enableWaiting(!1),this.#Ye&&this.div.focus()}#rn(){if(this.#We)return this._uiManager.enableWaiting(!0),void this._uiManager.imageManager.getFromId(this.#We).then((t=>this.#en(t,!0))).finally((()=>this.#nn()));if(this.#Xe){const t=this.#Xe;return this.#Xe=null,this._uiManager.enableWaiting(!0),void(this.#$e=this._uiManager.imageManager.getFromUrl(t).then((t=>this.#en(t))).finally((()=>this.#nn())))}if(this.#Ke){const t=this.#Ke;return this.#Ke=null,this._uiManager.enableWaiting(!0),void(this.#$e=this._uiManager.imageManager.getFromFile(t).then((t=>this.#en(t))).finally((()=>this.#nn())))}const t=document.createElement("input");t.type="file",t.accept=p.supportedTypesStr,this.#$e=new Promise((e=>{t.addEventListener("change",(async()=>{if(t.files&&0!==t.files.length){this._uiManager.enableWaiting(!0);const e=await this._uiManager.imageManager.getFromFile(t.files[0]);this.#en(e)}else this.remove();e()})),t.addEventListener("cancel",(()=>{this.remove(),e()}))})).finally((()=>this.#nn())),t.click()}remove(){this.#We&&(this.#Ge=null,this._uiManager.imageManager.deleteId(this.#We),this.#Ye?.remove(),this.#Ye=null,this.#ge?.disconnect(),this.#ge=null,this.#Je&&(clearTimeout(this.#Je),this.#Je=null)),super.remove()}rebuild(){this.parent?(super.rebuild(),null!==this.div&&(this.#We&&this.#rn(),this.isAttachedToDOM||this.parent.add(this))):this.#We&&this.#rn()}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(this.#$e||this.#Ge||this.#Xe||this.#Ke)}get isResizable(){return!0}render(){if(this.div)return this.div;let t,e;if(this.width&&(t=this.x,e=this.y),super.render(),this.div.hidden=!0,this.#Ge?this.#Ee():this.#rn(),this.width){const[n,r]=this.parentDimensions;this.setAt(t*n,e*r,this.width*n,this.height*r)}return this.div}#Ee(){const{div:t}=this;let{width:e,height:n}=this.#Ge;const[r,i]=this.pageDimensions,s=.75;if(this.width)e=this.width*r,n=this.height*i;else if(e>s*r||n>s*i){const t=Math.min(s*r/e,s*i/n);e*=t,n*=t}const[a,o]=this.parentDimensions;this.setDims(e*a/r,n*o/i),this._uiManager.enableWaiting(!1);const l=this.#Ye=document.createElement("canvas");t.append(l),t.hidden=!1,this.#in(e,n),this.#Se(),this.#tn||(this.parent.addUndoableEditor(this),this.#tn=!0),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",subtype:this.editorType,data:{action:"inserted_image"}}}),this.addAltTextButton(),this.#Qe&&l.setAttribute("aria-label",this.#Qe)}#sn(t,e){const[n,r]=this.parentDimensions;this.width=t/n,this.height=e/r,this.setDims(t,e),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,null!==this.#Je&&clearTimeout(this.#Je),this.#Je=setTimeout((()=>{this.#Je=null,this.#in(t,e)}),200)}#an(t,e){const{width:n,height:r}=this.#Ge;let i=n,s=r,a=this.#Ge;for(;i>2*t||s>2*e;){const n=i,r=s;i>2*t&&(i=i>=16384?Math.floor(i/2)-1:Math.ceil(i/2)),s>2*e&&(s=s>=16384?Math.floor(s/2)-1:Math.ceil(s/2));const o=new OffscreenCanvas(i,s);o.getContext("2d").drawImage(a,0,0,n,r,0,0,i,s),a=o.transferToImageBitmap()}return a}#in(t,e){t=Math.ceil(t),e=Math.ceil(e);const n=this.#Ye;if(!n||n.width===t&&n.height===e)return;n.width=t,n.height=e;const r=this.#Ze?this.#Ge:this.#an(t,e),i=n.getContext("2d");i.filter=this._uiManager.hcmFilter,i.drawImage(r,0,0,r.width,r.height,0,0,t,e)}getImageForAltText(){return this.#Ye}#on(t){if(t){if(this.#Ze){const t=this._uiManager.imageManager.getSvgUrl(this.#We);if(t)return t}const t=document.createElement("canvas");return({width:t.width,height:t.height}=this.#Ge),t.getContext("2d").drawImage(this.#Ge,0,0),t.toDataURL()}if(this.#Ze){const[t,e]=this.pageDimensions,n=Math.round(this.width*t*u.PixelsPerInch.PDF_TO_CSS_UNITS),r=Math.round(this.height*e*u.PixelsPerInch.PDF_TO_CSS_UNITS),i=new OffscreenCanvas(n,r);return i.getContext("2d").drawImage(this.#Ge,0,0,this.#Ge.width,this.#Ge.height,0,0,n,r),i.transferToImageBitmap()}return structuredClone(this.#Ge)}#Se(){this.#ge=new ResizeObserver((t=>{const e=t[0].contentRect;e.width&&e.height&&this.#sn(e.width,e.height)})),this.#ge.observe(this.div)}static deserialize(t,e,n){if(t instanceof a.StampAnnotationElement)return null;const r=super.deserialize(t,e,n),{rect:i,bitmapUrl:s,bitmapId:o,isSvg:l,accessibilityData:c}=t;o&&n.imageManager.isValidId(o)?r.#We=o:r.#Xe=s,r.#Ze=l;const[d,u]=r.pageDimensions;return r.width=(i[2]-i[0])/d,r.height=(i[3]-i[1])/u,c&&(r.altTextData=c),r}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.isEmpty())return null;const n={annotationType:r.AnnotationEditorType.STAMP,bitmapId:this.#We,pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:this.#Ze,structTreeParentId:this._structTreeParentId};if(t)return n.bitmapUrl=this.#on(!0),n.accessibilityData=this.altTextData,n;const{decorative:i,altText:s}=this.altTextData;if(!i&&s&&(n.accessibilityData={type:"Figure",alt:s}),null===e)return n;e.stamps||=new Map;const a=this.#Ze?(n.rect[2]-n.rect[0])*(n.rect[3]-n.rect[1]):null;if(e.stamps.has(this.#We)){if(this.#Ze){const t=e.stamps.get(this.#We);a>t.area&&(t.area=a,t.serialized.bitmap.close(),t.serialized.bitmap=this.#on(!1))}}else e.stamps.set(this.#We,{area:a,serialized:n}),n.bitmap=this.#on(!1);return n}}class f{#P;#ln=!1;#cn=null;#dn=this.pointerup.bind(this);#un=this.pointerUpAfterSelection.bind(this);#hn=this.pointerdown.bind(this);#pn=null;#fn=this.selectionStart.bind(this);#mn=new Map;#gn=!1;#vn=!1;#bn=!1;#_n=null;#yn;static _initialized=!1;static#An=new Map([o,h,p,d].map((t=>[t._editorType,t])));constructor(t){let{uiManager:e,pageIndex:n,div:r,accessibilityManager:i,annotationLayer:s,drawLayer:a,textLayer:o,viewport:l,l10n:c}=t;const d=[...f.#An.values()];if(!f._initialized){f._initialized=!0;for(const t of d)t.initialize(c)}e.registerEditorTypes(d),this.#yn=e,this.pageIndex=n,this.div=r,this.#P=i,this.#cn=s,this.viewport=l,this.#_n=o,this.drawLayer=a,this.#yn.addLayer(this)}get isEmpty(){return 0===this.#mn.size}updateToolbar(t){this.#yn.updateToolbar(t)}updateMode(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.#yn.getMode();switch(this.#wn(),t){case r.AnnotationEditorType.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;case r.AnnotationEditorType.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case r.AnnotationEditorType.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}if(t!==r.AnnotationEditorType.NONE){const{classList:e}=this.div;for(const n of f.#An.values())e.toggle(`${n._type}Editing`,t===n._editorType);this.div.hidden=!1}}addInkEditorIfNeeded(t){if(this.#yn.getMode()===r.AnnotationEditorType.INK){if(!t)for(const t of this.#mn.values())if(t.isEmpty())return void t.setInBackground();this.#xn({offsetX:0,offsetY:0},!1).setInBackground()}}setEditingState(t){this.#yn.setEditingState(t)}addCommands(t){this.#yn.addCommands(t)}togglePointerEvents(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.div.classList.toggle("disabled",!t)}enable(){this.togglePointerEvents(!0);const t=new Set;for(const e of this.#mn.values())e.enableEditing(),e.annotationElementId&&t.add(e.annotationElementId);if(!this.#cn)return;const e=this.#cn.getEditableAnnotations();for(const n of e){if(n.hide(),this.#yn.isDeletedAnnotationElement(n.data.id))continue;if(t.has(n.data.id))continue;const e=this.deserialize(n);e&&(this.addOrRebuild(e),e.enableEditing())}}disable(){this.#bn=!0,this.togglePointerEvents(!1);const t=new Set;for(const e of this.#mn.values())e.disableEditing(),e.annotationElementId&&null===e.serialize()?(this.getEditableAnnotation(e.annotationElementId)?.show(),e.remove()):t.add(e.annotationElementId);if(this.#cn){const e=this.#cn.getEditableAnnotations();for(const n of e){const{id:e}=n.data;t.has(e)||this.#yn.isDeletedAnnotationElement(e)||n.show()}}this.#wn(),this.isEmpty&&(this.div.hidden=!0);const{classList:e}=this.div;for(const t of f.#An.values())e.remove(`${t._type}Editing`);this.disableTextSelection(),this.#bn=!1}getEditableAnnotation(t){return this.#cn?.getEditableAnnotation(t)||null}setActiveEditor(t){this.#yn.getActive()!==t&&this.#yn.setActiveEditor(t)}enableTextSelection(){this.#_n?.div&&document.addEventListener("selectstart",this.#fn)}disableTextSelection(){this.#_n?.div&&document.removeEventListener("selectstart",this.#fn)}enableClick(){this.div.addEventListener("pointerdown",this.#hn),this.div.addEventListener("pointerup",this.#dn)}disableClick(){this.div.removeEventListener("pointerdown",this.#hn),this.div.removeEventListener("pointerup",this.#dn)}attach(t){this.#mn.set(t.id,t);const{annotationElementId:e}=t;e&&this.#yn.isDeletedAnnotationElement(e)&&this.#yn.removeDeletedAnnotationElement(t)}detach(t){this.#mn.delete(t.id),this.#P?.removePointerInTextLayer(t.contentDiv),!this.#bn&&t.annotationElementId&&this.#yn.addDeletedAnnotationElement(t)}remove(t){this.detach(t),this.#yn.removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1,this.#vn||this.addInkEditorIfNeeded(!1)}changeParent(t){t.parent!==this&&(t.annotationElementId&&(this.#yn.addDeletedAnnotationElement(t.annotationElementId),i.AnnotationEditor.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),t.parent?.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(this.changeParent(t),this.#yn.addEditor(t),this.attach(t),!t.isAttachedToDOM){const e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(),this.#yn.addToAnnotationStorage(t)}moveEditorInDOM(t){if(!t.isAttachedToDOM)return;const{activeElement:e}=document;t.div.contains(e)&&!this.#pn&&(t._focusEventsAllowed=!1,this.#pn=setTimeout((()=>{this.#pn=null,t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",(()=>{t._focusEventsAllowed=!0}),{once:!0}),e.focus())}),0)),t._structTreeParentId=this.#P?.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||=this,t.rebuild()):this.add(t)}addUndoableEditor(t){this.addCommands({cmd:()=>t._uiManager.rebuild(t),undo:()=>{t.remove()},mustExec:!1})}getNextId(){return this.#yn.getId()}get#En(){return f.#An.get(this.#yn.getMode())}#Sn(t){const e=this.#En;return e?new e.prototype.constructor(t):null}canCreateNewEmptyEditor(){return this.#En?.canCreateNewEmptyEditor()}pasteEditor(t,e){this.#yn.updateToolbar(t),this.#yn.updateMode(t);const{offsetX:n,offsetY:r}=this.#Tn(),i=this.getNextId(),s=this.#Sn({parent:this,id:i,x:n,y:r,uiManager:this.#yn,isCentered:!0,...e});s&&this.add(s)}deserialize(t){return f.#An.get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,this.#yn)||null}#xn(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=this.getNextId(),i=this.#Sn({parent:this,id:r,x:t.offsetX,y:t.offsetY,uiManager:this.#yn,isCentered:e,...n});return i&&this.add(i),i}#Tn(){const{x:t,y:e,width:n,height:r}=this.div.getBoundingClientRect(),i=Math.max(0,t),s=Math.max(0,e),a=(i+Math.min(window.innerWidth,t+n))/2-t,o=(s+Math.min(window.innerHeight,e+r))/2-e,[l,c]=this.viewport.rotation%180==0?[a,o]:[o,a];return{offsetX:l,offsetY:c}}addNewEditor(){this.#xn(this.#Tn(),!0)}setSelected(t){this.#yn.setSelected(t)}toggleSelected(t){this.#yn.toggleSelected(t)}isSelected(t){return this.#yn.isSelected(t)}unselect(t){this.#yn.unselect(t)}selectionStart(t){this.#_n?.div.addEventListener("pointerup",this.#un,{once:!0})}pointerUpAfterSelection(t){const e=document.getSelection();if(0===e.rangeCount)return;const n=e.getRangeAt(0);if(n.collapsed)return;if(!this.#_n?.div.contains(n.commonAncestorContainer))return;const{x:r,y:i,width:s,height:a}=this.#_n.div.getBoundingClientRect(),o=n.getClientRects();let l;switch(this.viewport.rotation){case 90:l=(t,e,n,o)=>({x:(e-i)/a,y:1-(t+n-r)/s,width:o/a,height:n/s});break;case 180:l=(t,e,n,o)=>({x:1-(t+n-r)/s,y:1-(e+o-i)/a,width:n/s,height:o/a});break;case 270:l=(t,e,n,o)=>({x:1-(e+o-i)/a,y:(t-r)/s,width:o/a,height:n/s});break;default:l=(t,e,n,o)=>({x:(t-r)/s,y:(e-i)/a,width:n/s,height:o/a})}const c=[];for(const{x:t,y:e,width:n,height:r}of o)0!==n&&0!==r&&c.push(l(t,e,n,r));0!==c.length&&this.#xn(t,!1,{boxes:c}),e.empty()}pointerup(t){const{isMac:e}=r.FeatureTest.platform;0!==t.button||t.ctrlKey&&e||t.target===this.div&&this.#gn&&(this.#gn=!1,this.#ln?this.#yn.getMode()!==r.AnnotationEditorType.STAMP?this.#xn(t,!1):this.#yn.unselectAll():this.#ln=!0)}pointerdown(t){if(this.#yn.getMode()===r.AnnotationEditorType.HIGHLIGHT&&this.enableTextSelection(),this.#gn)return void(this.#gn=!1);const{isMac:e}=r.FeatureTest.platform;if(0!==t.button||t.ctrlKey&&e)return;if(t.target!==this.div)return;this.#gn=!0;const n=this.#yn.getActive();this.#ln=!n||n.isEmpty()}findNewParent(t,e,n){const r=this.#yn.findParent(e,n);return null!==r&&r!==this&&(r.changeParent(t),!0)}destroy(){this.#yn.getActive()?.parent===this&&(this.#yn.commitOrRemove(),this.#yn.setActiveEditor(null)),this.#pn&&(clearTimeout(this.#pn),this.#pn=null);for(const t of this.#mn.values())this.#P?.removePointerInTextLayer(t.contentDiv),t.setParent(null),t.isAttachedToDOM=!1,t.div.remove();this.div=null,this.#mn.clear(),this.#yn.removeLayer(this)}#wn(){this.#vn=!0;for(const t of this.#mn.values())t.isEmpty()&&t.remove();this.#vn=!1}render(t){let{viewport:e}=t;this.viewport=e,(0,u.setLayerDimensions)(this.div,e);for(const t of this.#yn.getEditors(this.pageIndex))this.add(t);this.updateMode()}update(t){let{viewport:e}=t;this.#yn.commitOrRemove();const n=this.viewport.rotation,r=e.rotation;if(this.viewport=e,(0,u.setLayerDimensions)(this.div,{rotation:r}),n!==r)for(const t of this.#mn.values())t.rotate(r);this.updateMode()}get pageDimensions(){const{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}}},5097:(t,e,n)=>{n.d(e,{ColorPicker:()=>a});var r=n(3266),i=n(4812),s=n(473);class a{#i=this.#s.bind(this);#Cn=null;#kn=null;#Mn;#In=null;#Rn=!1;#Pn=!1;#Dn;#yn=null;static get _keyboardManager(){return(0,r.shadow)(this,"_keyboardManager",new i.KeyboardManager([[["Escape","mac+Escape"],a.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],a.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],a.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],a.prototype._moveToPrevious],[["Home","mac+Home"],a.prototype._moveToBeginning],[["End","mac+End"],a.prototype._moveToEnd]]))}constructor(t){let{editor:e=null,uiManager:n=null}=t;this.#Pn=!e,this.#yn=e?._uiManager||n,this.#Dn=this.#yn._eventBus,this.#Mn=e?.color||this.#yn?.highlightColors.values().next().value||"#FFFF98"}renderButton(){const t=this.#Cn=document.createElement("button");t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.setAttribute("aria-haspopup",!0),t.addEventListener("click",this.#Ln.bind(this));const e=this.#kn=document.createElement("span");return e.className="swatch",e.style.backgroundColor=this.#Mn,t.append(e),t}renderMainDropdown(){const t=this.#In=this.#Fn(r.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR);return t.setAttribute("aria-orientation","horizontal"),t.setAttribute("aria-labelledby","highlightColorPickerLabel"),t}#Fn(t){const e=document.createElement("div");e.addEventListener("contextmenu",s.noContextMenu),e.className="dropdown",e.role="listbox",e.setAttribute("aria-multiselectable",!1),e.setAttribute("aria-orientation","vertical"),e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown");for(const[n,r]of this.#yn.highlightColors){const i=document.createElement("button");i.tabIndex="0",i.role="option",i.setAttribute("data-color",r),i.title=n,i.setAttribute("data-l10n-id",`pdfjs-editor-colorpicker-${n}`);const s=document.createElement("span");i.append(s),s.className="swatch",s.style.backgroundColor=r,i.setAttribute("aria-selected",r===this.#Mn),i.addEventListener("click",this.#On.bind(this,t,r)),e.append(i)}return e.addEventListener("keydown",this.#i),e}#On(t,e,n){n.stopPropagation(),this.#Dn.dispatch("switchannotationeditorparams",{source:this,type:t,value:e})}_colorSelectFromKeyboard(t){const e=t.target.getAttribute("data-color");e&&this.#On(e,t)}_moveToNext(t){t.target!==this.#Cn?t.target.nextSibling?.focus():this.#In.firstChild?.focus()}_moveToPrevious(t){t.target.previousSibling?.focus()}_moveToBeginning(){this.#In.firstChild?.focus()}_moveToEnd(){this.#In.lastChild?.focus()}#s(t){a._keyboardManager.exec(this,t)}#Ln(t){if(this.#In&&!this.#In.classList.contains("hidden"))return void this.hideDropdown();if(this.#Cn.addEventListener("keydown",this.#i),this.#Rn=0===t.detail,this.#In)return void this.#In.classList.remove("hidden");const e=this.#In=this.#Fn(r.AnnotationEditorParamsType.HIGHLIGHT_COLOR);this.#Cn.append(e)}hideDropdown(){this.#In?.classList.add("hidden")}_hideDropdownFromKeyboard(){this.#Pn||!this.#In||this.#In.classList.contains("hidden")||(this.hideDropdown(),this.#Cn.removeEventListener("keydown",this.#i),this.#Cn.focus({preventScroll:!0,focusVisible:this.#Rn}))}updateColor(t){if(this.#kn&&(this.#kn.style.backgroundColor=t),!this.#In)return;const e=this.#yn.highlightColors.values();for(const n of this.#In.children)n.setAttribute("aria-selected",e.next().value===t)}destroy(){this.#Cn?.remove(),this.#Cn=null,this.#kn=null,this.#In?.remove(),this.#In=null}}},9115:(t,e,n)=>{n.d(e,{AnnotationEditor:()=>l}),n(3352);var r=n(4812),i=n(3266),s=n(473);class a{#Bn="";#Nn=!1;#qn=null;#jn=null;#Hn=null;#zn=!1;#Un=null;static _l10nPromise=null;constructor(t){this.#Un=t}static initialize(t){a._l10nPromise||=t}async render(){const t=this.#qn=document.createElement("button");t.className="altText";const e=await a._l10nPromise.get("pdfjs-editor-alt-text-button-label");t.textContent=e,t.setAttribute("aria-label",e),t.tabIndex="0",t.addEventListener("contextmenu",s.noContextMenu),t.addEventListener("pointerdown",(t=>t.stopPropagation()));const n=t=>{t.preventDefault(),this.#Un._uiManager.editAltText(this.#Un)};return t.addEventListener("click",n,{capture:!0}),t.addEventListener("keydown",(e=>{e.target===t&&"Enter"===e.key&&(this.#zn=!0,n(e))})),await this.#Vn(),t}finish(){this.#qn&&(this.#qn.focus({focusVisible:this.#zn}),this.#zn=!1)}get data(){return{altText:this.#Bn,decorative:this.#Nn}}set data(t){let{altText:e,decorative:n}=t;this.#Bn===e&&this.#Nn===n||(this.#Bn=e,this.#Nn=n,this.#Vn())}toggle(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.#qn&&(!t&&this.#Hn&&(clearTimeout(this.#Hn),this.#Hn=null),this.#qn.disabled=!t)}destroy(){this.#qn?.remove(),this.#qn=null,this.#jn=null}async#Vn(){const t=this.#qn;if(!t)return;if(!this.#Bn&&!this.#Nn)return t.classList.remove("done"),void this.#jn?.remove();t.classList.add("done"),a._l10nPromise.get("pdfjs-editor-alt-text-edit-button-label").then((e=>{t.setAttribute("aria-label",e)}));let e=this.#jn;if(!e){this.#jn=e=document.createElement("span"),e.className="tooltip",e.setAttribute("role","tooltip");const n=e.id=`alt-text-tooltip-${this.#Un.id}`;t.setAttribute("aria-describedby",n);const r=100;t.addEventListener("mouseenter",(()=>{this.#Hn=setTimeout((()=>{this.#Hn=null,this.#jn.classList.add("show"),this.#Un._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",subtype:this.#Un.editorType,data:{action:"alt_text_tooltip"}}})}),r)})),t.addEventListener("mouseleave",(()=>{this.#Hn&&(clearTimeout(this.#Hn),this.#Hn=null),this.#jn?.classList.remove("show")}))}e.innerText=this.#Nn?await a._l10nPromise.get("pdfjs-editor-alt-text-decorative-tooltip"):this.#Bn,e.parentNode||t.append(e);const n=this.#Un.getImageForAltText();n?.setAttribute("aria-describedby",e.id)}}class o{#Gn=null;#Wt=null;#Un;#Wn=null;constructor(t){this.#Un=t}render(){const t=this.#Gn=document.createElement("div");t.className="editToolbar",t.addEventListener("contextmenu",s.noContextMenu),t.addEventListener("pointerdown",o.#$n);const e=this.#Wn=document.createElement("div");e.className="buttons",t.append(e);const n=this.#Un.toolbarPosition;if(n){const{style:e}=t,r="ltr"===this.#Un._uiManager.direction?1-n[0]:n[0];e.insetInlineEnd=100*r+"%",e.top=`calc(${100*n[1]}% + var(--editor-toolbar-vert-offset))`}return this.#Xn(),t}static#$n(t){t.stopPropagation()}#Kn(t){this.#Un._focusEventsAllowed=!1,t.preventDefault(),t.stopPropagation()}#Qn(t){this.#Un._focusEventsAllowed=!0,t.preventDefault(),t.stopPropagation()}#Yn(t){t.addEventListener("focusin",this.#Kn.bind(this),{capture:!0}),t.addEventListener("focusout",this.#Qn.bind(this),{capture:!0}),t.addEventListener("contextmenu",s.noContextMenu)}hide(){this.#Gn.classList.add("hidden"),this.#Wt?.hideDropdown()}show(){this.#Gn.classList.remove("hidden")}#Xn(){const t=document.createElement("button");t.className="delete",t.tabIndex=0,t.setAttribute("data-l10n-id",`pdfjs-editor-remove-${this.#Un.editorType}-button`),this.#Yn(t),t.addEventListener("click",(t=>{this.#Un._uiManager.delete()})),this.#Wn.append(t)}get#Jn(){const t=document.createElement("div");return t.className="divider",t}addAltTextButton(t){this.#Yn(t),this.#Wn.prepend(t,this.#Jn)}addColorPicker(t){this.#Wt=t;const e=t.renderButton();this.#Yn(e),this.#Wn.prepend(e,this.#Jn)}remove(){this.#Gn.remove(),this.#Wt?.destroy(),this.#Wt=null}}class l{#Zn=null;#Bn=null;#tr=!1;#er=null;#nr=null;#rr=this.focusin.bind(this);#ir=this.focusout.bind(this);#sr=null;#ar="";#or=!1;#lr=!1;#cr=!1;#dr=!1;#ur=null;_initialOptions=Object.create(null);_uiManager=null;_focusEventsAllowed=!0;_l10nPromise=null;#hr=!1;#pr=l._zIndex++;static _borderLineWidth=-1;static _colorManager=new r.ColorManager;static _zIndex=1;static get _resizerKeyboardManager(){const t=l.prototype._resizeWithKeyboard,e=r.AnnotationEditorUIManager.TRANSLATE_SMALL,n=r.AnnotationEditorUIManager.TRANSLATE_BIG;return(0,i.shadow)(this,"_resizerKeyboardManager",new r.KeyboardManager([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-n,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[n,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-n]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,n]}],[["Escape","mac+Escape"],l.prototype._stopResizingWithKeyboard]]))}constructor(t){this.constructor===l&&(0,i.unreachable)("Cannot initialize AnnotationEditor."),this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null;const{rotation:e,rawDims:{pageWidth:n,pageHeight:r,pageX:s,pageY:a}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,r],this.pageTranslation=[s,a];const[o,c]=this.parentDimensions;this.x=t.x/o,this.y=t.y/c,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return(0,i.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const e=new c({id:t.parent.getNextId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(l._l10nPromise||=new Map(["pdfjs-editor-alt-text-button-label","pdfjs-editor-alt-text-edit-button-label","pdfjs-editor-alt-text-decorative-tooltip","pdfjs-editor-resizer-label-topLeft","pdfjs-editor-resizer-label-topMiddle","pdfjs-editor-resizer-label-topRight","pdfjs-editor-resizer-label-middleRight","pdfjs-editor-resizer-label-bottomRight","pdfjs-editor-resizer-label-bottomMiddle","pdfjs-editor-resizer-label-bottomLeft","pdfjs-editor-resizer-label-middleLeft"].map((e=>[e,t.get(e.replaceAll(/([A-Z])/g,(t=>`-${t.toLowerCase()}`)))]))),e?.strings)for(const n of e.strings)l._l10nPromise.set(n,t.get(n));if(-1!==l._borderLineWidth)return;const n=getComputedStyle(document.documentElement);l._borderLineWidth=parseFloat(n.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){(0,i.unreachable)("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#hr}set _isDraggable(t){this.#hr=t,this.div?.classList.toggle("draggable",t)}get isEnterHandled(){return!0}center(){const[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(2*t),this.y+=this.width*t/(2*e);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(2*t),this.y-=this.width*t/(2*e);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#pr}setParent(t){null!==t?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):this.#fr(),this.parent=t}focusin(t){this._focusEventsAllowed&&(this.#or?this.#or=!1:this.parent.setSelected(this))}focusout(t){if(!this._focusEventsAllowed)return;if(!this.isAttachedToDOM)return;const e=t.relatedTarget;e?.closest(`#${this.id}`)||(t.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,n,r){const[i,s]=this.parentDimensions;[n,r]=this.screenToPageTranslation(n,r),this.x=(t+n)/i,this.y=(e+r)/s,this.fixAndSetPosition()}#mr(t,e,n){let[r,i]=t;[e,n]=this.screenToPageTranslation(e,n),this.x+=e/r,this.y+=n/i,this.fixAndSetPosition()}translate(t,e){this.#mr(this.parentDimensions,t,e)}translateInPage(t,e){this.#mr(this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}drag(t,e){const[n,r]=this.parentDimensions;if(this.x+=t/n,this.y+=e/r,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:t,y:e}=this.div.getBoundingClientRect();this.parent.findNewParent(this,t,e)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:i,y:s}=this;const[a,o]=this.#gr();i+=a,s+=o,this.div.style.left=`${(100*i).toFixed(2)}%`,this.div.style.top=`${(100*s).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}#gr(){const[t,e]=this.parentDimensions,{_borderLineWidth:n}=l,r=n/t,i=n/e;switch(this.rotation){case 90:return[-r,i];case 180:return[r,i];case 270:return[r,-i];default:return[-r,-i]}}fixAndSetPosition(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.rotation;const[e,n]=this.pageDimensions;let{x:r,y:i,width:s,height:a}=this;switch(s*=e,a*=n,r*=e,i*=n,t){case 0:r=Math.max(0,Math.min(e-s,r)),i=Math.max(0,Math.min(n-a,i));break;case 90:r=Math.max(0,Math.min(e-a,r)),i=Math.min(n,Math.max(s,i));break;case 180:r=Math.min(e,Math.max(s,r)),i=Math.min(n,Math.max(a,i));break;case 270:r=Math.min(e,Math.max(a,r)),i=Math.max(0,Math.min(n-s,i))}this.x=r/=e,this.y=i/=n;const[o,l]=this.#gr();r+=o,i+=l;const{style:c}=this.div;c.left=`${(100*r).toFixed(2)}%`,c.top=`${(100*i).toFixed(2)}%`,this.moveInDOM()}static#vr(t,e,n){switch(n){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}}screenToPageTranslation(t,e){return l.#vr(t,e,this.parentRotation)}pageTranslationToScreen(t,e){return l.#vr(t,e,360-this.parentRotation)}#br(t){switch(t){case 90:{const[t,e]=this.pageDimensions;return[0,-t/e,e/t,0]}case 180:return[-1,0,0,-1];case 270:{const[t,e]=this.pageDimensions;return[0,t/e,-e/t,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:t,pageDimensions:[e,n]}=this,r=e*t,s=n*t;return i.FeatureTest.isCSSRoundSupported?[Math.round(r),Math.round(s)]:[r,s]}setDims(t,e){const[n,r]=this.parentDimensions;this.div.style.width=`${(100*t/n).toFixed(2)}%`,this.#tr||(this.div.style.height=`${(100*e/r).toFixed(2)}%`)}fixDims(){const{style:t}=this.div,{height:e,width:n}=t,r=n.endsWith("%"),i=!this.#tr&&e.endsWith("%");if(r&&i)return;const[s,a]=this.parentDimensions;r||(t.width=`${(100*parseFloat(n)/s).toFixed(2)}%`),this.#tr||i||(t.height=`${(100*parseFloat(e)/a).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#_r(){if(this.#er)return;this.#er=document.createElement("div"),this.#er.classList.add("resizers");const t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"];for(const e of t){const t=document.createElement("div");this.#er.append(t),t.classList.add("resizer",e),t.setAttribute("data-resizer-name",e),t.addEventListener("pointerdown",this.#yr.bind(this,e)),t.addEventListener("contextmenu",s.noContextMenu),t.tabIndex=-1}this.div.prepend(this.#er)}#yr(t,e){e.preventDefault();const{isMac:n}=i.FeatureTest.platform;if(0!==e.button||e.ctrlKey&&n)return;this.#Bn?.toggle(!1);const r=this.#Ar.bind(this,t),s=this._isDraggable;this._isDraggable=!1;const a={passive:!0,capture:!0};this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",r,a);const o=this.x,l=this.y,c=this.width,d=this.height,u=this.parent.div.style.cursor,h=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;const p=()=>{this.parent.togglePointerEvents(!0),this.#Bn?.toggle(!0),this._isDraggable=s,window.removeEventListener("pointerup",p),window.removeEventListener("blur",p),window.removeEventListener("pointermove",r,a),this.parent.div.style.cursor=u,this.div.style.cursor=h,this.#wr(o,l,c,d)};window.addEventListener("pointerup",p),window.addEventListener("blur",p)}#wr(t,e,n,r){const i=this.x,s=this.y,a=this.width,o=this.height;i===t&&s===e&&a===n&&o===r||this.addCommands({cmd:()=>{this.width=a,this.height=o,this.x=i,this.y=s;const[t,e]=this.parentDimensions;this.setDims(t*a,e*o),this.fixAndSetPosition()},undo:()=>{this.width=n,this.height=r,this.x=t,this.y=e;const[i,s]=this.parentDimensions;this.setDims(i*n,s*r),this.fixAndSetPosition()},mustExec:!0})}#Ar(t,e){const[n,r]=this.parentDimensions,i=this.x,s=this.y,a=this.width,o=this.height,c=l.MIN_SIZE/n,d=l.MIN_SIZE/r,u=t=>Math.round(1e4*t)/1e4,h=this.#br(this.rotation),p=(t,e)=>[h[0]*t+h[2]*e,h[1]*t+h[3]*e],f=this.#br(360-this.rotation);let m,g,v=!1,b=!1;switch(t){case"topLeft":v=!0,m=(t,e)=>[0,0],g=(t,e)=>[t,e];break;case"topMiddle":m=(t,e)=>[t/2,0],g=(t,e)=>[t/2,e];break;case"topRight":v=!0,m=(t,e)=>[t,0],g=(t,e)=>[0,e];break;case"middleRight":b=!0,m=(t,e)=>[t,e/2],g=(t,e)=>[0,e/2];break;case"bottomRight":v=!0,m=(t,e)=>[t,e],g=(t,e)=>[0,0];break;case"bottomMiddle":m=(t,e)=>[t/2,e],g=(t,e)=>[t/2,0];break;case"bottomLeft":v=!0,m=(t,e)=>[0,e],g=(t,e)=>[t,0];break;case"middleLeft":b=!0,m=(t,e)=>[0,e/2],g=(t,e)=>[t,e/2]}const _=m(a,o),y=g(a,o);let A=p(...y);const w=u(i+A[0]),x=u(s+A[1]);let E=1,S=1,[T,C]=this.screenToPageTranslation(e.movementX,e.movementY);var k,M;if([T,C]=(k=T/n,M=C/r,[f[0]*k+f[2]*M,f[1]*k+f[3]*M]),v){const t=Math.hypot(a,o);E=S=Math.max(Math.min(Math.hypot(y[0]-_[0]-T,y[1]-_[1]-C)/t,1/a,1/o),c/a,d/o)}else b?E=Math.max(c,Math.min(1,Math.abs(y[0]-_[0]-T)))/a:S=Math.max(d,Math.min(1,Math.abs(y[1]-_[1]-C)))/o;const I=u(a*E),R=u(o*S);A=p(...g(I,R));const P=w-A[0],D=x-A[1];this.width=I,this.height=R,this.x=P,this.y=D,this.setDims(n*I,r*R),this.fixAndSetPosition()}altTextFinish(){this.#Bn?.finish()}async addEditToolbar(){return this.#sr||this.#cr||(this.#sr=new o(this),this.div.append(this.#sr.render()),this.#Bn&&this.#sr.addAltTextButton(await this.#Bn.render())),this.#sr}removeEditToolbar(){this.#sr&&(this.#sr.remove(),this.#sr=null,this.#Bn?.destroy())}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){this.#Bn||(a.initialize(l._l10nPromise),this.#Bn=new a(this),await this.addEditToolbar())}get altTextData(){return this.#Bn?.data}set altTextData(t){this.#Bn&&(this.#Bn.data=t)}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.setAttribute("tabIndex",0),this.setInForeground(),this.div.addEventListener("focusin",this.#rr),this.div.addEventListener("focusout",this.#ir);const[t,e]=this.parentDimensions;this.parentRotation%180!=0&&(this.div.style.maxWidth=`${(100*e/t).toFixed(2)}%`,this.div.style.maxHeight=`${(100*t/e).toFixed(2)}%`);const[n,i]=this.getInitialTranslation();return this.translate(n,i),(0,r.bindEvents)(this,this.div,["pointerdown"]),this.div}pointerdown(t){const{isMac:e}=i.FeatureTest.platform;0!==t.button||t.ctrlKey&&e?t.preventDefault():(this.#or=!0,this._isDraggable?this.#xr(t):this.#Er(t))}#Er(t){const{isMac:e}=i.FeatureTest.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)}#xr(t){const e=this._uiManager.isSelected(this);let n,r;this._uiManager.setUpDragSession(),e&&(n={passive:!0,capture:!0},r=t=>{const[e,n]=this.screenToPageTranslation(t.movementX,t.movementY);this._uiManager.dragSelectedEditors(e,n)},window.addEventListener("pointermove",r,n));const i=()=>{window.removeEventListener("pointerup",i),window.removeEventListener("blur",i),e&&window.removeEventListener("pointermove",r,n),this.#or=!1,this._uiManager.endDragSession()||this.#Er(t)};window.addEventListener("pointerup",i),window.addEventListener("blur",i)}moveInDOM(){this.#ur&&clearTimeout(this.#ur),this.#ur=setTimeout((()=>{this.#ur=null,this.parent?.moveEditorInDOM(this)}),0)}_setParentAndPosition(t,e,n){t.changeParent(this),this.x=e,this.y=n,this.fixAndSetPosition()}getRect(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.rotation;const r=this.parentScale,[i,s]=this.pageDimensions,[a,o]=this.pageTranslation,l=t/r,c=e/r,d=this.x*i,u=this.y*s,h=this.width*i,p=this.height*s;switch(n){case 0:return[d+l+a,s-u-c-p+o,d+l+h+a,s-u-c+o];case 90:return[d+c+a,s-u+l+o,d+c+p+a,s-u+l+h+o];case 180:return[d-l-h+a,s-u+c+o,d-l+a,s-u+c+p+o];case 270:return[d-c-p+a,s-u-l-h+o,d-c+a,s-u-l+o];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[n,r,i,s]=t,a=i-n,o=s-r;switch(this.rotation){case 0:return[n,e-s,a,o];case 90:return[n,e-r,o,a];case 180:return[i,e-r,a,o];case 270:return[i,e-s,o,a];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#cr=!0}disableEditMode(){this.#cr=!1}isInEditMode(){return this.#cr}shouldGetKeyboardEvents(){return this.#dr}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){this.div?.addEventListener("focusin",this.#rr),this.div?.addEventListener("focusout",this.#ir)}rotate(t){}serialize(){(0,i.unreachable)("An editor must be serializable")}static deserialize(t,e,n){const r=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:n});r.rotation=t.rotation;const[i,s]=r.pageDimensions,[a,o,l,c]=r.getRectInCurrentCoords(t.rect,s);return r.x=a/i,r.y=o/s,r.width=l/i,r.height=c/s,r}remove(){this.div.removeEventListener("focusin",this.#rr),this.div.removeEventListener("focusout",this.#ir),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#ur&&(clearTimeout(this.#ur),this.#ur=null),this.#fr(),this.removeEditToolbar()}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#_r(),this.#er.classList.remove("hidden"),(0,r.bindEvents)(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(t){if(!this.isResizable||t.target!==this.div||"Enter"!==t.key)return;this._uiManager.setSelected(this),this.#nr={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};const e=this.#er.children;if(!this.#Zn){this.#Zn=Array.from(e);const t=this.#Sr.bind(this),n=this.#Tr.bind(this);for(const e of this.#Zn){const r=e.getAttribute("data-resizer-name");e.setAttribute("role","spinbutton"),e.addEventListener("keydown",t),e.addEventListener("blur",n),e.addEventListener("focus",this.#Cr.bind(this,r)),l._l10nPromise.get(`pdfjs-editor-resizer-label-${r}`).then((t=>e.setAttribute("aria-label",t)))}}const n=this.#Zn[0];let r=0;for(const t of e){if(t===n)break;r++}const i=(360-this.rotation+this.parentRotation)%360/90*(this.#Zn.length/4);if(i!==r){if(i=n)if(o>r)i[t][1]=r;else{if(1===s)return[];i.splice(t,1),t--,s--}else i[t][2]=n,o>r&&i.push([e,r,o])}}return i}}},4812:(t,e,n)=>{n.d(e,{AnnotationEditorUIManager:()=>h,ColorManager:()=>u,KeyboardManager:()=>d,bindEvents:()=>s,opacityToHex:()=>a}),n(8837),n(9803),n(8347),n(7995),n(62),n(4602),n(344),n(4305),n(7583),n(4226),n(5561),n(8587),n(3247),n(3302),n(9490),n(5438),n(7914),n(7121),n(385),n(7944),n(2808),n(8518);var r=n(3266),i=n(473);function s(t,e,n){for(const r of n)e.addEventListener(r,t[r].bind(t))}function a(t){return Math.round(Math.min(255,Math.max(1,255*t))).toString(16).padStart(2,"0")}class o{#vt=0;getId(){return`${r.AnnotationEditorPrefix}${this.#vt++}`}}class l{#Br=(0,r.getUuid)();#vt=0;#bt=null;static get _isSVGFittingCanvas(){const t=new OffscreenCanvas(1,3).getContext("2d"),e=new Image;e.src='data:image/svg+xml;charset=UTF-8,';const n=e.decode().then((()=>(t.drawImage(e,0,0,1,1,0,0,1,3),0===new Uint32Array(t.getImageData(0,0,1,1).data.buffer)[0])));return(0,r.shadow)(this,"_isSVGFittingCanvas",n)}async#Nr(t,e){this.#bt||=new Map;let n=this.#bt.get(t);if(null===n)return null;if(n?.bitmap)return n.refCounter+=1,n;try{let t;if(n||={bitmap:null,id:`image_${this.#Br}_${this.#vt++}`,refCounter:0,isSvg:!1},"string"==typeof e?(n.url=e,t=await(0,i.fetchData)(e,"blob")):t=n.file=e,"image/svg+xml"===t.type){const e=l._isSVGFittingCanvas,r=new FileReader,i=new Image,s=new Promise(((t,s)=>{i.onload=()=>{n.bitmap=i,n.isSvg=!0,t()},r.onload=async()=>{const t=n.svgUrl=r.result;i.src=await e?`${t}#svgView(preserveAspectRatio(none))`:t},i.onerror=r.onerror=s}));r.readAsDataURL(t),await s}else n.bitmap=await createImageBitmap(t);n.refCounter=1}catch(t){console.error(t),n=null}return this.#bt.set(t,n),n&&this.#bt.set(n.id,n),n}async getFromFile(t){const{lastModified:e,name:n,size:r,type:i}=t;return this.#Nr(`${e}_${n}_${r}_${i}`,t)}async getFromUrl(t){return this.#Nr(t,t)}async getFromId(t){this.#bt||=new Map;const e=this.#bt.get(t);return e?e.bitmap?(e.refCounter+=1,e):e.file?this.getFromFile(e.file):this.getFromUrl(e.url):null}getSvgUrl(t){const e=this.#bt.get(t);return e?.isSvg?e.svgUrl:null}deleteId(t){this.#bt||=new Map;const e=this.#bt.get(t);e&&(e.refCounter-=1,0===e.refCounter&&(e.bitmap=null))}isValidId(t){return t.startsWith(`image_${this.#Br}_`)}}class c{#qr=[];#jr=!1;#Hr;#zr=-1;constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:128;this.#Hr=t}add(t){let{cmd:e,undo:n,mustExec:r,type:i=NaN,overwriteIfSameType:s=!1,keepUndo:a=!1}=t;if(r&&e(),this.#jr)return;const o={cmd:e,undo:n,type:i};if(-1===this.#zr)return this.#qr.length>0&&(this.#qr.length=0),this.#zr=0,void this.#qr.push(o);if(s&&this.#qr[this.#zr].type===i)return a&&(o.undo=this.#qr[this.#zr].undo),void(this.#qr[this.#zr]=o);const l=this.#zr+1;l===this.#Hr?this.#qr.splice(0,1):(this.#zr=l,l=8&&(o=l+c)}}}if(o){var d,p,h=i.getUint16(o,r);for(p=0;p or
(null==l||131072&l.__u?0:1))for(;s>=0||a