@careevolution/mydatahelps-ui 2.88.2-DocLibTest.0 → 2.88.2-DocLibTest.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/esm/index.js +1 -1
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -211,5 +211,5 @@ object-assign
|
|
|
211
211
|
*
|
|
212
212
|
* @licend The above is the entire license notice for the
|
|
213
213
|
* JavaScript code in this page
|
|
214
|
-
*/var pfe={d:(e,t)=>{for(var a in t)pfe.o(t,a)&&!pfe.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},gfe=globalThis.pdfjsLib={};pfe.d(gfe,{AbortException:()=>Cye,AnnotationEditorLayer:()=>_xe,AnnotationEditorParamsType:()=>Ofe,AnnotationEditorType:()=>Pfe,AnnotationEditorUIManager:()=>xve,AnnotationLayer:()=>hxe,AnnotationMode:()=>Tfe,ColorPicker:()=>kxe,DOMSVGFactory:()=>Nwe,DrawLayer:()=>Cxe,FeatureTest:()=>Mye,GlobalWorkerOptions:()=>vbe,ImageKind:()=>Lfe,InvalidPDFException:()=>Aye,MissingPDFException:()=>Sye,OPS:()=>cye,OutputScale:()=>hve,PDFDataRangeTransport:()=>vwe,PDFDateString:()=>ove,PDFWorker:()=>kwe,PasswordResponses:()=>uye,PermissionFlag:()=>Mfe,PixelsPerInch:()=>Kye,RenderingCancelledException:()=>Xye,TextLayer:()=>lwe,UnexpectedResponseException:()=>Eye,Util:()=>Iye,VerbosityLevel:()=>lye,XfaLayer:()=>jwe,build:()=>Pwe,createValidAbsoluteUrl:()=>vye,fetchData:()=>Zye,getDocument:()=>gwe,getFilenameFromUrl:()=>eve,getPdfFilenameFromUrl:()=>tve,getXfaPageViewport:()=>sve,isDataScheme:()=>Qye,isPdfFile:()=>Jye,noContextMenu:()=>ive,normalizeUnicode:()=>zye,setLayerDimensions:()=>dve,shadow:()=>bye,version:()=>Twe});const ffe=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type),yfe=[1,0,0,1,0,0],vfe=[.001,0,0,.001,0,0],bfe=1.35,wfe=1,xfe=2,kfe=4,Afe=16,Sfe=32,Efe=64,_fe=128,Cfe=256,Tfe={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},Pfe={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},Ofe={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35},Mfe={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},Dfe=0,Ife=1,Nfe=2,jfe=3,zfe=3,Rfe=4,Lfe={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Ffe=1,Bfe=2,Hfe=3,qfe=4,Ufe=5,Vfe=6,Wfe=7,$fe=8,Gfe=9,Kfe=10,Zfe=11,Yfe=12,Xfe=13,Qfe=14,Jfe=15,eye=16,tye=17,aye=20,nye=1,iye=2,rye=3,oye=4,sye=5,lye={ERRORS:0,WARNINGS:1,INFOS:5},cye={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93},uye={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let dye=lye.WARNINGS;function hye(e){Number.isInteger(e)&&(dye=e)}function mye(){return dye}function pye(e){dye>=lye.INFOS&&console.log(`Info: ${e}`)}function gye(e){dye>=lye.WARNINGS&&console.log(`Warning: ${e}`)}function fye(e){throw new Error(e)}function yye(e,t){e||fye(t)}function vye(e,t=null,a=null){if(!e)return null;try{if(a&&"string"==typeof e){if(a.addDefaultProtocol&&e.startsWith("www.")){const t=e.match(/\./g);t?.length>=2&&(e=`http://${e}`)}if(a.tryConvertEncoding)try{e=function(e){return decodeURIComponent(escape(e))}(e)}catch{}}const n=t?new URL(e,t):new URL(e);if(function(e){switch(e?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(n))return n}catch{}return null}function bye(e,t,a,n=!1){return Object.defineProperty(e,t,{value:a,enumerable:!n,configurable:!0,writable:!1}),a}const wye=function(){function e(e,t){this.message=e,this.name=t}return e.prototype=new Error,e.constructor=e,e}();class xye extends wye{constructor(e,t){super(e,"PasswordException"),this.code=t}}class kye extends wye{constructor(e,t){super(e,"UnknownErrorException"),this.details=t}}class Aye extends wye{constructor(e){super(e,"InvalidPDFException")}}class Sye extends wye{constructor(e){super(e,"MissingPDFException")}}class Eye extends wye{constructor(e,t){super(e,"UnexpectedResponseException"),this.status=t}}class _ye extends wye{constructor(e){super(e,"FormatError")}}class Cye extends wye{constructor(e){super(e,"AbortException")}}function Tye(e){"object"==typeof e&&void 0!==e?.length||fye("Invalid argument for bytesToString");const t=e.length,a=8192;if(t<a)return String.fromCharCode.apply(null,e);const n=[];for(let i=0;i<t;i+=a){const r=Math.min(i+a,t),o=e.subarray(i,r);n.push(String.fromCharCode.apply(null,o))}return n.join("")}function Pye(e){"string"!=typeof e&&fye("Invalid argument for stringToBytes");const t=e.length,a=new Uint8Array(t);for(let n=0;n<t;++n)a[n]=255&e.charCodeAt(n);return a}function Oye(e){const t=Object.create(null);for(const[a,n]of e)t[a]=n;return t}class Mye{static get isLittleEndian(){return bye(this,"isLittleEndian",function(){const e=new Uint8Array(4);return e[0]=1,1===new Uint32Array(e.buffer,0,1)[0]}())}static get isEvalSupported(){return bye(this,"isEvalSupported",function(){try{return new Function(""),!0}catch{return!1}}())}static get isOffscreenCanvasSupported(){return bye(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get platform(){return"undefined"!=typeof navigator&&"string"==typeof navigator?.platform?bye(this,"platform",{isMac:navigator.platform.includes("Mac"),isWindows:navigator.platform.includes("Win"),isFirefox:"string"==typeof navigator?.userAgent&&navigator.userAgent.includes("Firefox")}):bye(this,"platform",{isMac:!1,isWindows:!1,isFirefox:!1})}static get isCSSRoundSupported(){return bye(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}const Dye=Array.from(Array(256).keys(),(e=>e.toString(16).padStart(2,"0")));class Iye{static makeHexColor(e,t,a){return`#${Dye[e]}${Dye[t]}${Dye[a]}`}static scaleMinMax(e,t){let a;e[0]?(e[0]<0&&(a=t[0],t[0]=t[2],t[2]=a),t[0]*=e[0],t[2]*=e[0],e[3]<0&&(a=t[1],t[1]=t[3],t[3]=a),t[1]*=e[3],t[3]*=e[3]):(a=t[0],t[0]=t[1],t[1]=a,a=t[2],t[2]=t[3],t[3]=a,e[1]<0&&(a=t[1],t[1]=t[3],t[3]=a),t[1]*=e[1],t[3]*=e[1],e[2]<0&&(a=t[0],t[0]=t[2],t[2]=a),t[0]*=e[2],t[2]*=e[2]),t[0]+=e[4],t[1]+=e[5],t[2]+=e[4],t[3]+=e[5]}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static applyTransform(e,t){return[e[0]*t[0]+e[1]*t[2]+t[4],e[0]*t[1]+e[1]*t[3]+t[5]]}static applyInverseTransform(e,t){const a=t[0]*t[3]-t[1]*t[2];return[(e[0]*t[3]-e[1]*t[2]+t[2]*t[5]-t[4]*t[3])/a,(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/a]}static getAxialAlignedBoundingBox(e,t){const a=this.applyTransform(e,t),n=this.applyTransform(e.slice(2,4),t),i=this.applyTransform([e[0],e[3]],t),r=this.applyTransform([e[2],e[1]],t);return[Math.min(a[0],n[0],i[0],r[0]),Math.min(a[1],n[1],i[1],r[1]),Math.max(a[0],n[0],i[0],r[0]),Math.max(a[1],n[1],i[1],r[1])]}static inverseTransform(e){const t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e){const t=[e[0],e[2],e[1],e[3]],a=e[0]*t[0]+e[1]*t[2],n=e[0]*t[1]+e[1]*t[3],i=e[2]*t[0]+e[3]*t[2],r=e[2]*t[1]+e[3]*t[3],o=(a+r)/2,s=Math.sqrt((a+r)**2-4*(a*r-i*n))/2,l=o+s||1,c=o-s||1;return[Math.sqrt(l),Math.sqrt(c)]}static normalizeRect(e){const t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){const a=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),n=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(a>n)return null;const i=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),r=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return i>r?null:[a,i,n,r]}static#e(e,t,a,n,i,r,o,s,l,c){if(l<=0||l>=1)return;const u=1-l,d=l*l,h=d*l,m=u*(u*(u*e+3*l*t)+3*d*a)+h*n,p=u*(u*(u*i+3*l*r)+3*d*o)+h*s;c[0]=Math.min(c[0],m),c[1]=Math.min(c[1],p),c[2]=Math.max(c[2],m),c[3]=Math.max(c[3],p)}static#t(e,t,a,n,i,r,o,s,l,c,u,d){if(Math.abs(l)<1e-12)return void(Math.abs(c)>=1e-12&&this.#e(e,t,a,n,i,r,o,s,-u/c,d));const h=c**2-4*u*l;if(h<0)return;const m=Math.sqrt(h),p=2*l;this.#e(e,t,a,n,i,r,o,s,(-c+m)/p,d),this.#e(e,t,a,n,i,r,o,s,(-c-m)/p,d)}static bezierBoundingBox(e,t,a,n,i,r,o,s,l){return l?(l[0]=Math.min(l[0],e,o),l[1]=Math.min(l[1],t,s),l[2]=Math.max(l[2],e,o),l[3]=Math.max(l[3],t,s)):l=[Math.min(e,o),Math.min(t,s),Math.max(e,o),Math.max(t,s)],this.#t(e,a,i,o,t,n,r,s,3*(3*(a-i)-e+o),6*(e-2*a+i),3*(a-e),l),this.#t(e,a,i,o,t,n,r,s,3*(3*(n-r)-t+s),6*(t-2*n+r),3*(n-t),l),l}}let Nye=null,jye=null;function zye(e){return Nye||(Nye=/([\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,jye=new Map([["ſt","ſt"]])),e.replaceAll(Nye,((e,t,a)=>t?t.normalize("NFKC"):jye.get(a)))}const Rye="pdfjs_internal_id_",Lye=0,Fye=1,Bye=2,Hye=3,qye=4,Uye=5,Vye=6,Wye=7,$ye=8;const Gye="http://www.w3.org/2000/svg";class Kye{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}async function Zye(e,t="text"){if(nve(e,document.baseURI)){const a=await fetch(e);if(!a.ok)throw new Error(a.statusText);switch(t){case"arraybuffer":return a.arrayBuffer();case"blob":return a.blob();case"json":return a.json()}return a.text()}return new Promise(((a,n)=>{const i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType=t,i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE)if(200!==i.status&&0!==i.status)n(new Error(i.statusText));else{switch(t){case"arraybuffer":case"blob":case"json":return void a(i.response)}a(i.responseText)}},i.send(null)}))}class Yye{constructor({viewBox:e,scale:t,rotation:a,offsetX:n=0,offsetY:i=0,dontFlip:r=!1}){this.viewBox=e,this.scale=t,this.rotation=a,this.offsetX=n,this.offsetY=i;const o=(e[2]+e[0])/2,s=(e[3]+e[1])/2;let l,c,u,d,h,m,p,g;switch((a%=360)<0&&(a+=360),a){case 180:l=-1,c=0,u=0,d=1;break;case 90:l=0,c=1,u=1,d=0;break;case 270:l=0,c=-1,u=-1,d=0;break;case 0:l=1,c=0,u=0,d=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}r&&(u=-u,d=-d),0===l?(h=Math.abs(s-e[1])*t+n,m=Math.abs(o-e[0])*t+i,p=(e[3]-e[1])*t,g=(e[2]-e[0])*t):(h=Math.abs(o-e[0])*t+n,m=Math.abs(s-e[1])*t+i,p=(e[2]-e[0])*t,g=(e[3]-e[1])*t),this.transform=[l*t,c*t,u*t,d*t,h-l*t*o-u*t*s,m-c*t*o-d*t*s],this.width=p,this.height=g}get rawDims(){const{viewBox:e}=this;return bye(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:e=this.scale,rotation:t=this.rotation,offsetX:a=this.offsetX,offsetY:n=this.offsetY,dontFlip:i=!1}={}){return new Yye({viewBox:this.viewBox.slice(),scale:e,rotation:t,offsetX:a,offsetY:n,dontFlip:i})}convertToViewportPoint(e,t){return Iye.applyTransform([e,t],this.transform)}convertToViewportRectangle(e){const t=Iye.applyTransform([e[0],e[1]],this.transform),a=Iye.applyTransform([e[2],e[3]],this.transform);return[t[0],t[1],a[0],a[1]]}convertToPdfPoint(e,t){return Iye.applyInverseTransform([e,t],this.transform)}}class Xye extends wye{constructor(e,t=0){super(e,"RenderingCancelledException"),this.extraDelay=t}}function Qye(e){const t=e.length;let a=0;for(;a<t&&""===e[a].trim();)a++;return"data:"===e.substring(a,a+5).toLowerCase()}function Jye(e){return"string"==typeof e&&/\.pdf$/i.test(e)}function eve(e){return[e]=e.split(/[#?]/,1),e.substring(e.lastIndexOf("/")+1)}function tve(e,t="document.pdf"){if("string"!=typeof e)return t;if(Qye(e))return gye('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;const a=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,n=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(e);let i=a.exec(n[1])||a.exec(n[2])||a.exec(n[3]);if(i&&(i=i[0],i.includes("%")))try{i=a.exec(decodeURIComponent(i))[0]}catch{}return i||t}class ave{started=Object.create(null);times=[];time(e){e in this.started&&gye(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||gye(`Timer has not been started for ${e}`),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e]}toString(){const e=[];let t=0;for(const{name:e}of this.times)t=Math.max(e.length,t);for(const{name:a,start:n,end:i}of this.times)e.push(`${a.padEnd(t)} ${i-n}ms\n`);return e.join("")}}function nve(e,t){try{const{protocol:a}=t?new URL(e,t):new URL(e);return"http:"===a||"https:"===a}catch{return!1}}function ive(e){e.preventDefault()}function rve(e){console.log("Deprecated API usage: "+e)}class ove{static#a;static toDateObject(e){if(!e||"string"!=typeof e)return null;this.#a||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");const t=this.#a.exec(e);if(!t)return null;const a=parseInt(t[1],10);let n=parseInt(t[2],10);n=n>=1&&n<=12?n-1:0;let i=parseInt(t[3],10);i=i>=1&&i<=31?i:1;let r=parseInt(t[4],10);r=r>=0&&r<=23?r:0;let o=parseInt(t[5],10);o=o>=0&&o<=59?o:0;let s=parseInt(t[6],10);s=s>=0&&s<=59?s:0;const l=t[7]||"Z";let c=parseInt(t[8],10);c=c>=0&&c<=23?c:0;let u=parseInt(t[9],10)||0;return u=u>=0&&u<=59?u:0,"-"===l?(r+=c,o+=u):"+"===l&&(r-=c,o-=u),new Date(Date.UTC(a,n,i,r,o,s))}}function sve(e,{scale:t=1,rotation:a=0}){const{width:n,height:i}=e.attributes.style,r=[0,0,parseInt(n),parseInt(i)];return new Yye({viewBox:r,scale:t,rotation:a})}function lve(e){if(e.startsWith("#")){const t=parseInt(e.slice(1),16);return[(16711680&t)>>16,(65280&t)>>8,255&t]}return e.startsWith("rgb(")?e.slice(4,-1).split(",").map((e=>parseInt(e))):e.startsWith("rgba(")?e.slice(5,-1).split(",").map((e=>parseInt(e))).slice(0,3):(gye(`Not a valid color format: "${e}"`),[0,0,0])}function cve(e){const{a:t,b:a,c:n,d:i,e:r,f:o}=e.getTransform();return[t,a,n,i,r,o]}function uve(e){const{a:t,b:a,c:n,d:i,e:r,f:o}=e.getTransform().invertSelf();return[t,a,n,i,r,o]}function dve(e,t,a=!1,n=!0){if(t instanceof Yye){const{pageWidth:n,pageHeight:i}=t.rawDims,{style:r}=e,o=Mye.isCSSRoundSupported,s=`var(--scale-factor) * ${n}px`,l=`var(--scale-factor) * ${i}px`,c=o?`round(down, ${s}, var(--scale-round-x, 1px))`:`calc(${s})`,u=o?`round(down, ${l}, var(--scale-round-y, 1px))`:`calc(${l})`;a&&t.rotation%180!=0?(r.width=u,r.height=c):(r.width=c,r.height=u)}n&&e.setAttribute("data-main-rotation",t.rotation)}class hve{constructor(){const e=window.devicePixelRatio||1;this.sx=e,this.sy=e}get scaled(){return 1!==this.sx||1!==this.sy}get symmetric(){return this.sx===this.sy}}class mve{#n=null;#i=null;#r;#o=null;#s=null;static#l=null;constructor(e){this.#r=e,mve.#l||=Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button"})}render(){const e=this.#n=document.createElement("div");e.classList.add("editToolbar","hidden"),e.setAttribute("role","toolbar");const t=this.#r._uiManager._signal;e.addEventListener("contextmenu",ive,{signal:t}),e.addEventListener("pointerdown",mve.#c,{signal:t});const a=this.#o=document.createElement("div");a.className="buttons",e.append(a);const n=this.#r.toolbarPosition;if(n){const{style:t}=e,a="ltr"===this.#r._uiManager.direction?1-n[0]:n[0];t.insetInlineEnd=100*a+"%",t.top=`calc(${100*n[1]}% + var(--editor-toolbar-vert-offset))`}return this.#u(),e}get div(){return this.#n}static#c(e){e.stopPropagation()}#d(e){this.#r._focusEventsAllowed=!1,e.preventDefault(),e.stopPropagation()}#h(e){this.#r._focusEventsAllowed=!0,e.preventDefault(),e.stopPropagation()}#m(e){const t=this.#r._uiManager._signal;e.addEventListener("focusin",this.#d.bind(this),{capture:!0,signal:t}),e.addEventListener("focusout",this.#h.bind(this),{capture:!0,signal:t}),e.addEventListener("contextmenu",ive,{signal:t})}hide(){this.#n.classList.add("hidden"),this.#i?.hideDropdown()}show(){this.#n.classList.remove("hidden"),this.#s?.shown()}#u(){const{editorType:e,_uiManager:t}=this.#r,a=document.createElement("button");a.className="delete",a.tabIndex=0,a.setAttribute("data-l10n-id",mve.#l[e]),this.#m(a),a.addEventListener("click",(e=>{t.delete()}),{signal:t._signal}),this.#o.append(a)}get#p(){const e=document.createElement("div");return e.className="divider",e}async addAltText(e){const t=await e.render();this.#m(t),this.#o.prepend(t,this.#p),this.#s=e}addColorPicker(e){this.#i=e;const t=e.renderButton();this.#m(t),this.#o.prepend(t,this.#p)}remove(){this.#n.remove(),this.#i?.destroy(),this.#i=null}}class pve{#o=null;#n=null;#g;constructor(e){this.#g=e}#f(){const e=this.#n=document.createElement("div");e.className="editToolbar",e.setAttribute("role","toolbar"),e.addEventListener("contextmenu",ive,{signal:this.#g._signal});const t=this.#o=document.createElement("div");return t.className="buttons",e.append(t),this.#y(),e}#v(e,t){let a=0,n=0;for(const i of e){const e=i.y+i.height;if(e<a)continue;const r=i.x+(t?i.width:0);e>a?(n=r,a=e):t?r>n&&(n=r):r<n&&(n=r)}return[t?1-n:n,a]}show(e,t,a){const[n,i]=this.#v(t,a),{style:r}=this.#n||=this.#f();e.append(this.#n),r.insetInlineEnd=100*n+"%",r.top=`calc(${100*i}% + var(--editor-toolbar-vert-offset))`}hide(){this.#n.remove()}#y(){const e=document.createElement("button");e.className="highlightButton",e.tabIndex=0,e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const t=document.createElement("span");e.append(t),t.className="visuallyHidden",t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const a=this.#g._signal;e.addEventListener("contextmenu",ive,{signal:a}),e.addEventListener("click",(()=>{this.#g.highlightSelection("floating_button")}),{signal:a}),this.#o.append(e)}}function gve(e,t,a){for(const n of a)t.addEventListener(n,e[n].bind(e))}class fve{#b=0;get id(){return"pdfjs_internal_editor_"+this.#b++}}class yve{#w=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto?.randomUUID)return crypto.randomUUID();const e=new Uint8Array(32);if("undefined"!=typeof crypto&&"function"==typeof crypto?.getRandomValues)crypto.getRandomValues(e);else for(let t=0;t<32;t++)e[t]=Math.floor(255*Math.random());return Tye(e)}();#b=0;#x=null;static get _isSVGFittingCanvas(){const e=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),t=new Image;t.src='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>';return bye(this,"_isSVGFittingCanvas",t.decode().then((()=>(e.drawImage(t,0,0,1,1,0,0,1,3),0===new Uint32Array(e.getImageData(0,0,1,1).data.buffer)[0]))))}async#k(e,t){this.#x||=new Map;let a=this.#x.get(e);if(null===a)return null;if(a?.bitmap)return a.refCounter+=1,a;try{let e;if(a||={bitmap:null,id:`image_${this.#w}_${this.#b++}`,refCounter:0,isSvg:!1},"string"==typeof t?(a.url=t,e=await Zye(t,"blob")):t instanceof File?e=a.file=t:t instanceof Blob&&(e=t),"image/svg+xml"===e.type){const t=yve._isSVGFittingCanvas,n=new FileReader,i=new Image,r=new Promise(((e,r)=>{i.onload=()=>{a.bitmap=i,a.isSvg=!0,e()},n.onload=async()=>{const e=a.svgUrl=n.result;i.src=await t?`${e}#svgView(preserveAspectRatio(none))`:e},i.onerror=n.onerror=r}));n.readAsDataURL(e),await r}else a.bitmap=await createImageBitmap(e);a.refCounter=1}catch(e){console.error(e),a=null}return this.#x.set(e,a),a&&this.#x.set(a.id,a),a}async getFromFile(e){const{lastModified:t,name:a,size:n,type:i}=e;return this.#k(`${t}_${a}_${n}_${i}`,e)}async getFromUrl(e){return this.#k(e,e)}async getFromBlob(e,t){const a=await t;return this.#k(e,a)}async getFromId(e){this.#x||=new Map;const t=this.#x.get(e);if(!t)return null;if(t.bitmap)return t.refCounter+=1,t;if(t.file)return this.getFromFile(t.file);if(t.blobPromise){const{blobPromise:e}=t;return delete t.blobPromise,this.getFromBlob(t.id,e)}return this.getFromUrl(t.url)}getFromCanvas(e,t){this.#x||=new Map;let a=this.#x.get(e);if(a?.bitmap)return a.refCounter+=1,a;const n=new OffscreenCanvas(t.width,t.height);return n.getContext("2d").drawImage(t,0,0),a={bitmap:n.transferToImageBitmap(),id:`image_${this.#w}_${this.#b++}`,refCounter:1,isSvg:!1},this.#x.set(e,a),this.#x.set(a.id,a),a}getSvgUrl(e){const t=this.#x.get(e);return t?.isSvg?t.svgUrl:null}deleteId(e){this.#x||=new Map;const t=this.#x.get(e);if(!t)return;if(t.refCounter-=1,0!==t.refCounter)return;const{bitmap:a}=t;if(!t.url&&!t.file){const e=new OffscreenCanvas(a.width,a.height);e.getContext("bitmaprenderer").transferFromImageBitmap(a),t.blobPromise=e.convertToBlob()}a.close?.(),t.bitmap=null}isValidId(e){return e.startsWith(`image_${this.#w}_`)}}class vve{#A=[];#S=!1;#E;#_=-1;constructor(e=128){this.#E=e}add({cmd:e,undo:t,post:a,mustExec:n,type:i=NaN,overwriteIfSameType:r=!1,keepUndo:o=!1}){if(n&&e(),this.#S)return;const s={cmd:e,undo:t,post:a,type:i};if(-1===this.#_)return this.#A.length>0&&(this.#A.length=0),this.#_=0,void this.#A.push(s);if(r&&this.#A[this.#_].type===i)return o&&(s.undo=this.#A[this.#_].undo),void(this.#A[this.#_]=s);const l=this.#_+1;l===this.#E?this.#A.splice(0,1):(this.#_=l,l<this.#A.length&&this.#A.splice(l)),this.#A.push(s)}undo(){if(-1===this.#_)return;this.#S=!0;const{undo:e,post:t}=this.#A[this.#_];e(),t?.(),this.#S=!1,this.#_-=1}redo(){if(this.#_<this.#A.length-1){this.#_+=1,this.#S=!0;const{cmd:e,post:t}=this.#A[this.#_];e(),t?.(),this.#S=!1}}hasSomethingToUndo(){return-1!==this.#_}hasSomethingToRedo(){return this.#_<this.#A.length-1}destroy(){this.#A=null}}class bve{constructor(e){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:t}=Mye.platform;for(const[a,n,i={}]of e)for(const e of a){const a=e.startsWith("mac+");t&&a?(this.callbacks.set(e.slice(4),{callback:n,options:i}),this.allKeys.add(e.split("+").at(-1))):t||a||(this.callbacks.set(e,{callback:n,options:i}),this.allKeys.add(e.split("+").at(-1)))}}#C(e){e.altKey&&this.buffer.push("alt"),e.ctrlKey&&this.buffer.push("ctrl"),e.metaKey&&this.buffer.push("meta"),e.shiftKey&&this.buffer.push("shift"),this.buffer.push(e.key);const t=this.buffer.join("+");return this.buffer.length=0,t}exec(e,t){if(!this.allKeys.has(t.key))return;const a=this.callbacks.get(this.#C(t));if(!a)return;const{callback:n,options:{bubbles:i=!1,args:r=[],checker:o=null}}=a;o&&!o(e,t)||(n.bind(e,...r,t)(),i||(t.stopPropagation(),t.preventDefault()))}}class wve{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);return function(e){const t=document.createElement("span");t.style.visibility="hidden",document.body.append(t);for(const a of e.keys()){t.style.color=a;const n=window.getComputedStyle(t).color;e.set(a,lve(n))}t.remove()}(e),bye(this,"_colors",e)}convert(e){const t=lve(e);if(!window.matchMedia("(forced-colors: active)").matches)return t;for(const[e,a]of this._colors)if(a.every(((e,a)=>e===t[a])))return wve._colorsMapping.get(e);return t}getHexCode(e){const t=this._colors.get(e);return t?Iye.makeHexColor(...t):e}}class xve{#T=new AbortController;#P=null;#O=new Map;#M=new Map;#D=null;#I=null;#N=null;#j=new vve;#z=null;#R=0;#L=new Set;#F=null;#B=null;#H=new Set;#q=!1;#U=!1;#V=!1;#W=null;#$=null;#G=null;#K=null;#Z=!1;#Y=null;#X=new fve;#Q=!1;#J=!1;#ee=null;#te=null;#ae=null;#ne=null;#ie=Pfe.NONE;#re=new Set;#oe=null;#se=null;#le=null;#ce={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#ue=[0,0];#de=null;#he=null;#me=null;#pe=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){const e=xve.prototype,t=e=>e.#he.contains(document.activeElement)&&"BUTTON"!==document.activeElement.tagName&&e.hasSomethingToControl(),a=(e,{target:t})=>{if(t instanceof HTMLInputElement){const{type:e}=t;return"text"!==e&&"number"!==e}return!0},n=this.TRANSLATE_SMALL,i=this.TRANSLATE_BIG;return bye(this,"_keyboardManager",new bve([[["ctrl+a","mac+meta+a"],e.selectAll,{checker:a}],[["ctrl+z","mac+meta+z"],e.undo,{checker:a}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo,{checker:a}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],e.delete,{checker:a}],[["Enter","mac+Enter"],e.addNewEditorFromKeyboard,{checker:(e,{target:t})=>!(t instanceof HTMLButtonElement)&&e.#he.contains(t)&&!e.isEnterHandled}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(e,{target:t})=>!(t instanceof HTMLButtonElement)&&e.#he.contains(document.activeElement)}],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-n,0],checker:t}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-i,0],checker:t}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[n,0],checker:t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[i,0],checker:t}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-n],checker:t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-i],checker:t}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,n],checker:t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,i],checker:t}]]))}constructor(e,t,a,n,i,r,o,s,l,c,u){const d=this._signal=this.#T.signal;this.#he=e,this.#me=t,this.#D=a,this._eventBus=n,n._on("editingaction",this.onEditingAction.bind(this),{signal:d}),n._on("pagechanging",this.onPageChanging.bind(this),{signal:d}),n._on("scalechanging",this.onScaleChanging.bind(this),{signal:d}),n._on("rotationchanging",this.onRotationChanging.bind(this),{signal:d}),n._on("setpreference",this.onSetPreference.bind(this),{signal:d}),n._on("switchannotationeditorparams",(e=>this.updateParams(e.type,e.value)),{signal:d}),this.#ge(),this.#fe(),this.#ye(),this.#I=i.annotationStorage,this.#W=i.filterFactory,this.#se=r,this.#K=o||null,this.#q=s,this.#U=l,this.#V=c,this.#ne=u||null,this.viewParameters={realScale:Kye.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}destroy(){this.#pe?.resolve(),this.#pe=null,this.#T?.abort(),this.#T=null,this._signal=null;for(const e of this.#M.values())e.destroy();this.#M.clear(),this.#O.clear(),this.#H.clear(),this.#P=null,this.#re.clear(),this.#j.destroy(),this.#D?.destroy(),this.#Y?.hide(),this.#Y=null,this.#$&&(clearTimeout(this.#$),this.#$=null),this.#de&&(clearTimeout(this.#de),this.#de=null)}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return this.#ne}get useNewAltTextFlow(){return this.#U}get useNewAltTextWhenAddingImage(){return this.#V}get hcmFilter(){return bye(this,"hcmFilter",this.#se?this.#W.addHCMFilter(this.#se.foreground,this.#se.background):"none")}get direction(){return bye(this,"direction",getComputedStyle(this.#he).direction)}get highlightColors(){return bye(this,"highlightColors",this.#K?new Map(this.#K.split(",").map((e=>e.split("=").map((e=>e.trim()))))):null)}get highlightColorNames(){return bye(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,(e=>e.reverse()))):null)}setMainHighlightColorPicker(e){this.#ae=e}editAltText(e,t=!1){this.#D?.editAltText(this,e,t)}switchToMode(e,t){this._eventBus.on("annotationeditormodechanged",t,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:e})}setPreference(e,t){this._eventBus.dispatch("setpreference",{source:this,name:e,value:t})}onSetPreference({name:e,value:t}){if("enableNewAltTextWhenAddingImage"===e)this.#V=t}onPageChanging({pageNumber:e}){this.#R=e-1}focusMainContainer(){this.#he.focus()}findParent(e,t){for(const a of this.#M.values()){const{x:n,y:i,width:r,height:o}=a.div.getBoundingClientRect();if(e>=n&&e<=n+r&&t>=i&&t<=i+o)return a}return null}disableUserSelect(e=!1){this.#me.classList.toggle("noUserSelect",e)}addShouldRescale(e){this.#H.add(e)}removeShouldRescale(e){this.#H.delete(e)}onScaleChanging({scale:e}){this.commitOrRemove(),this.viewParameters.realScale=e*Kye.PDF_TO_CSS_UNITS;for(const e of this.#H)e.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}#ve({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e}#be(e){const{currentLayer:t}=this;if(t.hasTextLayer(e))return t;for(const t of this.#M.values())if(t.hasTextLayer(e))return t;return null}highlightSelection(e=""){const t=document.getSelection();if(!t||t.isCollapsed)return;const{anchorNode:a,anchorOffset:n,focusNode:i,focusOffset:r}=t,o=t.toString(),s=this.#ve(t).closest(".textLayer"),l=this.getSelectionBoxes(s);if(!l)return;t.empty();const c=this.#be(s),u=this.#ie===Pfe.NONE,d=()=>{c?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:l,anchorNode:a,anchorOffset:n,focusNode:i,focusOffset:r,text:o}),u&&this.showAllEditors("highlight",!0,!0)};u?this.switchToMode(Pfe.HIGHLIGHT,d):d()}#we(){const e=document.getSelection();if(!e||e.isCollapsed)return;const t=this.#ve(e).closest(".textLayer"),a=this.getSelectionBoxes(t);a&&(this.#Y||=new pve(this),this.#Y.show(t,a,"ltr"===this.direction))}addToAnnotationStorage(e){e.isEmpty()||!this.#I||this.#I.has(e.id)||this.#I.setValue(e.id,e)}#xe(){const e=document.getSelection();if(!e||e.isCollapsed)return void(this.#oe&&(this.#Y?.hide(),this.#oe=null,this.#ke({hasSelectedText:!1})));const{anchorNode:t}=e;if(t===this.#oe)return;const a=this.#ve(e).closest(".textLayer");if(a){if(this.#Y?.hide(),this.#oe=t,this.#ke({hasSelectedText:!0}),(this.#ie===Pfe.HIGHLIGHT||this.#ie===Pfe.NONE)&&(this.#ie===Pfe.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#Z=this.isShiftKeyDown,!this.isShiftKeyDown)){const e=this.#ie===Pfe.HIGHLIGHT?this.#be(a):null;e?.toggleDrawing();const t=new AbortController,n=this.combinedSignal(t),i=a=>{"pointerup"===a.type&&0!==a.button||(t.abort(),e?.toggleDrawing(!0),"pointerup"===a.type&&this.#Ae("main_toolbar"))};window.addEventListener("pointerup",i,{signal:n}),window.addEventListener("blur",i,{signal:n})}}else this.#oe&&(this.#Y?.hide(),this.#oe=null,this.#ke({hasSelectedText:!1}))}#Ae(e=""){this.#ie===Pfe.HIGHLIGHT?this.highlightSelection(e):this.#q&&this.#we()}#ge(){document.addEventListener("selectionchange",this.#xe.bind(this),{signal:this._signal})}#Se(){if(this.#G)return;this.#G=new AbortController;const e=this.combinedSignal(this.#G);window.addEventListener("focus",this.focus.bind(this),{signal:e}),window.addEventListener("blur",this.blur.bind(this),{signal:e})}#Ee(){this.#G?.abort(),this.#G=null}blur(){if(this.isShiftKeyDown=!1,this.#Z&&(this.#Z=!1,this.#Ae("main_toolbar")),!this.hasSelection)return;const{activeElement:e}=document;for(const t of this.#re)if(t.div.contains(e)){this.#te=[t,e],t._focusEventsAllowed=!1;break}}focus(){if(!this.#te)return;const[e,t]=this.#te;this.#te=null,t.addEventListener("focusin",(()=>{e._focusEventsAllowed=!0}),{once:!0,signal:this._signal}),t.focus()}#ye(){if(this.#ee)return;this.#ee=new AbortController;const e=this.combinedSignal(this.#ee);window.addEventListener("keydown",this.keydown.bind(this),{signal:e}),window.addEventListener("keyup",this.keyup.bind(this),{signal:e})}#_e(){this.#ee?.abort(),this.#ee=null}#Ce(){if(this.#z)return;this.#z=new AbortController;const e=this.combinedSignal(this.#z);document.addEventListener("copy",this.copy.bind(this),{signal:e}),document.addEventListener("cut",this.cut.bind(this),{signal:e}),document.addEventListener("paste",this.paste.bind(this),{signal:e})}#Te(){this.#z?.abort(),this.#z=null}#fe(){const e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e}),document.addEventListener("drop",this.drop.bind(this),{signal:e})}addEditListeners(){this.#ye(),this.#Ce()}removeEditListeners(){this.#_e(),this.#Te()}dragOver(e){for(const{type:t}of e.dataTransfer.items)for(const a of this.#B)if(a.isHandlingMimeForPasting(t))return e.dataTransfer.dropEffect="copy",void e.preventDefault()}drop(e){for(const t of e.dataTransfer.items)for(const a of this.#B)if(a.isHandlingMimeForPasting(t.type))return a.paste(t,this.currentLayer),void e.preventDefault()}copy(e){if(e.preventDefault(),this.#P?.commitOrRemove(),!this.hasSelection)return;const t=[];for(const e of this.#re){const a=e.serialize(!0);a&&t.push(a)}0!==t.length&&e.clipboardData.setData("application/pdfjs",JSON.stringify(t))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();const{clipboardData:t}=e;for(const e of t.items)for(const t of this.#B)if(t.isHandlingMimeForPasting(e.type))return void t.paste(e,this.currentLayer);let a=t.getData("application/pdfjs");if(!a)return;try{a=JSON.parse(a)}catch(e){return void gye(`paste: "${e.message}".`)}if(!Array.isArray(a))return;this.unselectAll();const n=this.currentLayer;try{const e=[];for(const t of a){const a=await n.deserialize(t);if(!a)return;e.push(a)}const t=()=>{for(const t of e)this.#Pe(t);this.#Oe(e)},i=()=>{for(const t of e)t.remove()};this.addCommands({cmd:t,undo:i,mustExec:!0})}catch(e){gye(`paste: "${e.message}".`)}}keydown(e){this.isShiftKeyDown||"Shift"!==e.key||(this.isShiftKeyDown=!0),this.#ie===Pfe.NONE||this.isEditorHandlingKeyboard||xve._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&"Shift"===e.key&&(this.isShiftKeyDown=!1,this.#Z&&(this.#Z=!1,this.#Ae("main_toolbar")))}onEditingAction({name:e}){switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu")}}#ke(e){const t=Object.entries(e).some((([e,t])=>this.#ce[e]!==t));t&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#ce,e)}),this.#ie===Pfe.HIGHLIGHT&&!1===e.hasSelectedEditor&&this.#Me([[Ofe.HIGHLIGHT_FREE,!0]]))}#Me(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})}setEditingState(e){e?(this.#Se(),this.#Ce(),this.#ke({isEditing:this.#ie!==Pfe.NONE,isEmpty:this.#De(),hasSomethingToUndo:this.#j.hasSomethingToUndo(),hasSomethingToRedo:this.#j.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#Ee(),this.#Te(),this.#ke({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!this.#B){this.#B=e;for(const e of this.#B)this.#Me(e.defaultPropertiesToUpdate)}}getId(){return this.#X.id}get currentLayer(){return this.#M.get(this.#R)}getLayer(e){return this.#M.get(e)}get currentPageIndex(){return this.#R}addLayer(e){this.#M.set(e.pageIndex,e),this.#Q?e.enable():e.disable()}removeLayer(e){this.#M.delete(e.pageIndex)}async updateMode(e,t=null,a=!1){if(this.#ie!==e&&(!this.#pe||(await this.#pe.promise,this.#pe))){if(this.#pe=Promise.withResolvers(),this.#ie=e,e===Pfe.NONE)return this.setEditingState(!1),this.#Ie(),void this.#pe.resolve();this.setEditingState(!0),await this.#Ne(),this.unselectAll();for(const t of this.#M.values())t.updateMode(e);if(!t)return a&&this.addNewEditorFromKeyboard(),void this.#pe.resolve();for(const e of this.#O.values())e.annotationElementId===t?(this.setSelected(e),e.enterInEditMode()):e.unselect();this.#pe.resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e!==this.#ie&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:e})}updateParams(e,t){if(this.#B){switch(e){case Ofe.CREATE:return void this.currentLayer.addNewEditor();case Ofe.HIGHLIGHT_DEFAULT_COLOR:this.#ae?.updateColor(t);break;case Ofe.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#le||=new Map).set(e,t),this.showAllEditors("highlight",t)}for(const a of this.#re)a.updateParams(e,t);for(const a of this.#B)a.updateDefaultParams(e,t)}}showAllEditors(e,t,a=!1){for(const a of this.#O.values())a.editorType===e&&a.show(t);(this.#le?.get(Ofe.HIGHLIGHT_SHOW_ALL)??!0)!==t&&this.#Me([[Ofe.HIGHLIGHT_SHOW_ALL,t]])}enableWaiting(e=!1){if(this.#J!==e){this.#J=e;for(const t of this.#M.values())e?t.disableClick():t.enableClick(),t.div.classList.toggle("waiting",e)}}async#Ne(){if(!this.#Q){this.#Q=!0;const e=[];for(const t of this.#M.values())e.push(t.enable());await Promise.all(e);for(const e of this.#O.values())e.enable()}}#Ie(){if(this.unselectAll(),this.#Q){this.#Q=!1;for(const e of this.#M.values())e.disable();for(const e of this.#O.values())e.disable()}}getEditors(e){const t=[];for(const a of this.#O.values())a.pageIndex===e&&t.push(a);return t}getEditor(e){return this.#O.get(e)}addEditor(e){this.#O.set(e.id,e)}removeEditor(e){e.div.contains(document.activeElement)&&(this.#$&&clearTimeout(this.#$),this.#$=setTimeout((()=>{this.focusMainContainer(),this.#$=null}),0)),this.#O.delete(e.id),this.unselect(e),e.annotationElementId&&this.#L.has(e.annotationElementId)||this.#I?.remove(e.id)}addDeletedAnnotationElement(e){this.#L.add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return this.#L.has(e)}removeDeletedAnnotationElement(e){this.#L.delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}#Pe(e){const t=this.#M.get(e.pageIndex);t?t.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))}setActiveEditor(e){this.#P!==e&&(this.#P=e,e&&this.#Me(e.propertiesToUpdate))}get#je(){let e=null;for(e of this.#re);return e}updateUI(e){this.#je===e&&this.#Me(e.propertiesToUpdate)}toggleSelected(e){if(this.#re.has(e))return this.#re.delete(e),e.unselect(),void this.#ke({hasSelectedEditor:this.hasSelection});this.#re.add(e),e.select(),this.#Me(e.propertiesToUpdate),this.#ke({hasSelectedEditor:!0})}setSelected(e){for(const t of this.#re)t!==e&&t.unselect();this.#re.clear(),this.#re.add(e),e.select(),this.#Me(e.propertiesToUpdate),this.#ke({hasSelectedEditor:!0})}isSelected(e){return this.#re.has(e)}get firstSelectedEditor(){return this.#re.values().next().value}unselect(e){e.unselect(),this.#re.delete(e),this.#ke({hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==this.#re.size}get isEnterHandled(){return 1===this.#re.size&&this.firstSelectedEditor.isEnterHandled}undo(){this.#j.undo(),this.#ke({hasSomethingToUndo:this.#j.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#De()})}redo(){this.#j.redo(),this.#ke({hasSomethingToUndo:!0,hasSomethingToRedo:this.#j.hasSomethingToRedo(),isEmpty:this.#De()})}addCommands(e){this.#j.add(e),this.#ke({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#De()})}#De(){if(0===this.#O.size)return!0;if(1===this.#O.size)for(const e of this.#O.values())return e.isEmpty();return!1}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const e=[...this.#re];this.addCommands({cmd:()=>{for(const t of e)t.remove()},undo:()=>{for(const t of e)this.#Pe(t)},mustExec:!0})}commitOrRemove(){this.#P?.commitOrRemove()}hasSomethingToControl(){return this.#P||this.hasSelection}#Oe(e){for(const e of this.#re)e.unselect();this.#re.clear();for(const t of e)t.isEmpty()||(this.#re.add(t),t.select());this.#ke({hasSelectedEditor:this.hasSelection})}selectAll(){for(const e of this.#re)e.commit();this.#Oe(this.#O.values())}unselectAll(){if((!this.#P||(this.#P.commitOrRemove(),this.#ie===Pfe.NONE))&&this.hasSelection){for(const e of this.#re)e.unselect();this.#re.clear(),this.#ke({hasSelectedEditor:!1})}}translateSelectedEditors(e,t,a=!1){if(a||this.commitOrRemove(),!this.hasSelection)return;this.#ue[0]+=e,this.#ue[1]+=t;const[n,i]=this.#ue,r=[...this.#re];this.#de&&clearTimeout(this.#de),this.#de=setTimeout((()=>{this.#de=null,this.#ue[0]=this.#ue[1]=0,this.addCommands({cmd:()=>{for(const e of r)this.#O.has(e.id)&&e.translateInPage(n,i)},undo:()=>{for(const e of r)this.#O.has(e.id)&&e.translateInPage(-n,-i)},mustExec:!1})}),1e3);for(const a of r)a.translateInPage(e,t)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#F=new Map;for(const e of this.#re)this.#F.set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#F)return!1;this.disableUserSelect(!1);const e=this.#F;this.#F=null;let t=!1;for(const[{x:a,y:n,pageIndex:i},r]of e)r.newX=a,r.newY=n,r.newPageIndex=i,t||=a!==r.savedX||n!==r.savedY||i!==r.savedPageIndex;if(!t)return!1;const a=(e,t,a,n)=>{if(this.#O.has(e.id)){const i=this.#M.get(n);i?e._setParentAndPosition(i,t,a):(e.pageIndex=n,e.x=t,e.y=a)}};return this.addCommands({cmd:()=>{for(const[t,{newX:n,newY:i,newPageIndex:r}]of e)a(t,n,i,r)},undo:()=>{for(const[t,{savedX:n,savedY:i,savedPageIndex:r}]of e)a(t,n,i,r)},mustExec:!0}),!0}dragSelectedEditors(e,t){if(this.#F)for(const a of this.#F.keys())a.drag(e,t)}rebuild(e){if(null===e.parent){const t=this.getLayer(e.pageIndex);t?(t.changeParent(e),t.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||1===this.#re.size&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return this.#P===e}getActive(){return this.#P}getMode(){return this.#ie}get imageManager(){return bye(this,"imageManager",new yve)}getSelectionBoxes(e){if(!e)return null;const t=document.getSelection();for(let a=0,n=t.rangeCount;a<n;a++)if(!e.contains(t.getRangeAt(a).commonAncestorContainer))return null;const{x:a,y:n,width:i,height:r}=e.getBoundingClientRect();let o;switch(e.getAttribute("data-main-rotation")){case"90":o=(e,t,o,s)=>({x:(t-n)/r,y:1-(e+o-a)/i,width:s/r,height:o/i});break;case"180":o=(e,t,o,s)=>({x:1-(e+o-a)/i,y:1-(t+s-n)/r,width:o/i,height:s/r});break;case"270":o=(e,t,o,s)=>({x:1-(t+s-n)/r,y:(e-a)/i,width:s/r,height:o/i});break;default:o=(e,t,o,s)=>({x:(e-a)/i,y:(t-n)/r,width:o/i,height:s/r})}const s=[];for(let e=0,a=t.rangeCount;e<a;e++){const a=t.getRangeAt(e);if(!a.collapsed)for(const{x:e,y:t,width:n,height:i}of a.getClientRects())0!==n&&0!==i&&s.push(o(e,t,n,i))}return 0===s.length?null:s}addChangedExistingAnnotation({annotationElementId:e,id:t}){(this.#N||=new Map).set(e,t)}removeChangedExistingAnnotation({annotationElementId:e}){this.#N?.delete(e)}renderAnnotationElement(e){const t=this.#N?.get(e.data.id);if(!t)return;const a=this.#I.getRawValue(t);a&&(this.#ie!==Pfe.NONE||a.hasBeenModified)&&a.renderAnnotationElement(e)}}class kve{#s=null;#ze=!1;#Re=null;#Le=null;#Fe=null;#Be=null;#He=!1;#qe=null;#r=null;#Ue=null;#Ve=null;#We=!1;static#$e=null;static _l10n=null;constructor(e){this.#r=e,this.#We=e._uiManager.useNewAltTextFlow,kve.#$e||=Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"})}static initialize(e){kve._l10n??=e}async render(){const e=this.#Re=document.createElement("button");e.className="altText",e.tabIndex="0";const t=this.#Le=document.createElement("span");e.append(t),this.#We?(e.classList.add("new"),e.setAttribute("data-l10n-id",kve.#$e.missing),t.setAttribute("data-l10n-id",kve.#$e["missing-label"])):(e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const a=this.#r._uiManager._signal;e.addEventListener("contextmenu",ive,{signal:a}),e.addEventListener("pointerdown",(e=>e.stopPropagation()),{signal:a});const n=e=>{e.preventDefault(),this.#r._uiManager.editAltText(this.#r),this.#We&&this.#r._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:this.#Ge}})};return e.addEventListener("click",n,{capture:!0,signal:a}),e.addEventListener("keydown",(t=>{t.target===e&&"Enter"===t.key&&(this.#He=!0,n(t))}),{signal:a}),await this.#Ke(),e}get#Ge(){return(this.#s?"added":null===this.#s&&this.guessedText&&"review")||"missing"}finish(){this.#Re&&(this.#Re.focus({focusVisible:this.#He}),this.#He=!1)}isEmpty(){return this.#We?null===this.#s:!this.#s&&!this.#ze}hasData(){return this.#We?null!==this.#s||!!this.#Ue:this.isEmpty()}get guessedText(){return this.#Ue}async setGuessedText(e){null===this.#s&&(this.#Ue=e,this.#Ve=await kve._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:e}),this.#Ke())}toggleAltTextBadge(e=!1){if(!this.#We||this.#s)return this.#qe?.remove(),void(this.#qe=null);if(!this.#qe){const e=this.#qe=document.createElement("div");e.className="noAltTextBadge",this.#r.div.append(e)}this.#qe.classList.toggle("hidden",!e)}serialize(e){let t=this.#s;return e||this.#Ue!==t||(t=this.#Ve),{altText:t,decorative:this.#ze,guessedText:this.#Ue,textWithDisclaimer:this.#Ve}}get data(){return{altText:this.#s,decorative:this.#ze}}set data({altText:e,decorative:t,guessedText:a,textWithDisclaimer:n,cancel:i=!1}){a&&(this.#Ue=a,this.#Ve=n),this.#s===e&&this.#ze===t||(i||(this.#s=e,this.#ze=t),this.#Ke())}toggle(e=!1){this.#Re&&(!e&&this.#Be&&(clearTimeout(this.#Be),this.#Be=null),this.#Re.disabled=!e)}shown(){this.#r._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:this.#Ge}})}destroy(){this.#Re?.remove(),this.#Re=null,this.#Le=null,this.#Fe=null,this.#qe?.remove(),this.#qe=null}async#Ke(){const e=this.#Re;if(!e)return;if(this.#We){if(e.classList.toggle("done",!!this.#s),e.setAttribute("data-l10n-id",kve.#$e[this.#Ge]),this.#Le?.setAttribute("data-l10n-id",kve.#$e[`${this.#Ge}-label`]),!this.#s)return void this.#Fe?.remove()}else{if(!this.#s&&!this.#ze)return e.classList.remove("done"),void this.#Fe?.remove();e.classList.add("done"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let t=this.#Fe;if(!t){this.#Fe=t=document.createElement("span"),t.className="tooltip",t.setAttribute("role","tooltip"),t.id=`alt-text-tooltip-${this.#r.id}`;const a=100,n=this.#r._uiManager._signal;n.addEventListener("abort",(()=>{clearTimeout(this.#Be),this.#Be=null}),{once:!0}),e.addEventListener("mouseenter",(()=>{this.#Be=setTimeout((()=>{this.#Be=null,this.#Fe.classList.add("show"),this.#r._reportTelemetry({action:"alt_text_tooltip"})}),a)}),{signal:n}),e.addEventListener("mouseleave",(()=>{this.#Be&&(clearTimeout(this.#Be),this.#Be=null),this.#Fe?.classList.remove("show")}),{signal:n})}this.#ze?t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(t.removeAttribute("data-l10n-id"),t.textContent=this.#s),t.parentNode||e.append(t);const a=this.#r.getImageForAltText();a?.setAttribute("aria-describedby",t.id)}}class Ave{#Ze=null;#Ye=null;#s=null;#Xe=!1;#Qe=!1;#Je=null;#et=null;#tt=null;#at="";#nt=!1;#it=null;#rt=!1;#ot=!1;#st=!1;#lt=null;#ct=0;#ut=0;#dt=null;_editToolbar=null;_initialOptions=Object.create(null);_initialData=null;_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;static _l10n=null;static _l10nResizer=null;#ht=!1;#mt=Ave._zIndex++;static _borderLineWidth=-1;static _colorManager=new wve;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){const e=Ave.prototype._resizeWithKeyboard,t=xve.TRANSLATE_SMALL,a=xve.TRANSLATE_BIG;return bye(this,"_resizerKeyboardManager",new bve([[["ArrowLeft","mac+ArrowLeft"],e,{args:[-t,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e,{args:[-a,0]}],[["ArrowRight","mac+ArrowRight"],e,{args:[t,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e,{args:[a,0]}],[["ArrowUp","mac+ArrowUp"],e,{args:[0,-t]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e,{args:[0,-a]}],[["ArrowDown","mac+ArrowDown"],e,{args:[0,t]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e,{args:[0,a]}],[["Escape","mac+Escape"],Ave.prototype._stopResizingWithKeyboard]]))}constructor(e){this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null,this._uiManager=e.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=e.isCentered,this._structTreeParentId=null;const{rotation:t,rawDims:{pageWidth:a,pageHeight:n,pageX:i,pageY:r}}=this.parent.viewport;this.rotation=t,this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[a,n],this.pageTranslation=[i,r];const[o,s]=this.parentDimensions;this.x=e.x/o,this.y=e.y/s,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return bye(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){const t=new Sve({id:e.parent.getNextId(),parent:e.parent,uiManager:e._uiManager});t.annotationElementId=e.annotationElementId,t.deleted=!0,t._uiManager.addToAnnotationStorage(t)}static initialize(e,t){if(Ave._l10n??=e,Ave._l10nResizer||=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"}),-1!==Ave._borderLineWidth)return;const a=getComputedStyle(document.documentElement);Ave._borderLineWidth=parseFloat(a.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,t){fye("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#ht}set _isDraggable(e){this.#ht=e,this.div?.classList.toggle("draggable",e)}get isEnterHandled(){return!0}center(){const[e,t]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*t/(2*e),this.y+=this.width*e/(2*t);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*t/(2*e),this.y-=this.width*e/(2*t);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#mt}setParent(e){null!==e?(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions):this.#pt(),this.parent=e}focusin(e){this._focusEventsAllowed&&(this.#nt?this.#nt=!1:this.parent.setSelected(this))}focusout(e){if(!this._focusEventsAllowed)return;if(!this.isAttachedToDOM)return;const t=e.relatedTarget;t?.closest(`#${this.id}`)||(e.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,t,a,n){const[i,r]=this.parentDimensions;[a,n]=this.screenToPageTranslation(a,n),this.x=(e+a)/i,this.y=(t+n)/r,this.fixAndSetPosition()}#gt([e,t],a,n){[a,n]=this.screenToPageTranslation(a,n),this.x+=a/e,this.y+=n/t,this.fixAndSetPosition()}translate(e,t){this.#gt(this.parentDimensions,e,t)}translateInPage(e,t){this.#it||=[this.x,this.y],this.#gt(this.pageDimensions,e,t),this.div.scrollIntoView({block:"nearest"})}drag(e,t){this.#it||=[this.x,this.y];const[a,n]=this.parentDimensions;if(this.x+=e/a,this.y+=t/n,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:e,y:t}=this.div.getBoundingClientRect();this.parent.findNewParent(this,e,t)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:i,y:r}=this;const[o,s]=this.getBaseTranslation();i+=o,r+=s,this.div.style.left=`${(100*i).toFixed(2)}%`,this.div.style.top=`${(100*r).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!this.#it&&(this.#it[0]!==this.x||this.#it[1]!==this.y)}getBaseTranslation(){const[e,t]=this.parentDimensions,{_borderLineWidth:a}=Ave,n=a/e,i=a/t;switch(this.rotation){case 90:return[-n,i];case 180:return[n,i];case 270:return[n,-i];default:return[-n,-i]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){const[t,a]=this.pageDimensions;let{x:n,y:i,width:r,height:o}=this;if(r*=t,o*=a,n*=t,i*=a,this._mustFixPosition)switch(e){case 0:n=Math.max(0,Math.min(t-r,n)),i=Math.max(0,Math.min(a-o,i));break;case 90:n=Math.max(0,Math.min(t-o,n)),i=Math.min(a,Math.max(r,i));break;case 180:n=Math.min(t,Math.max(r,n)),i=Math.min(a,Math.max(o,i));break;case 270:n=Math.min(t,Math.max(o,n)),i=Math.max(0,Math.min(a-r,i))}this.x=n/=t,this.y=i/=a;const[s,l]=this.getBaseTranslation();n+=s,i+=l;const{style:c}=this.div;c.left=`${(100*n).toFixed(2)}%`,c.top=`${(100*i).toFixed(2)}%`,this.moveInDOM()}static#ft(e,t,a){switch(a){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}}screenToPageTranslation(e,t){return Ave.#ft(e,t,this.parentRotation)}pageTranslationToScreen(e,t){return Ave.#ft(e,t,360-this.parentRotation)}#yt(e){switch(e){case 90:{const[e,t]=this.pageDimensions;return[0,-e/t,t/e,0]}case 180:return[-1,0,0,-1];case 270:{const[e,t]=this.pageDimensions;return[0,e/t,-t/e,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:e,pageDimensions:[t,a]}=this;return[t*e,a*e]}setDims(e,t){const[a,n]=this.parentDimensions;this.div.style.width=`${(100*e/a).toFixed(2)}%`,this.#Qe||(this.div.style.height=`${(100*t/n).toFixed(2)}%`)}fixDims(){const{style:e}=this.div,{height:t,width:a}=e,n=a.endsWith("%"),i=!this.#Qe&&t.endsWith("%");if(n&&i)return;const[r,o]=this.parentDimensions;n||(e.width=`${(100*parseFloat(a)/r).toFixed(2)}%`),this.#Qe||i||(e.height=`${(100*parseFloat(t)/o).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#vt(){if(this.#Je)return;this.#Je=document.createElement("div"),this.#Je.classList.add("resizers");const e=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],t=this._uiManager._signal;for(const a of e){const e=document.createElement("div");this.#Je.append(e),e.classList.add("resizer",a),e.setAttribute("data-resizer-name",a),e.addEventListener("pointerdown",this.#bt.bind(this,a),{signal:t}),e.addEventListener("contextmenu",ive,{signal:t}),e.tabIndex=-1}this.div.prepend(this.#Je)}#bt(e,t){t.preventDefault();const{isMac:a}=Mye.platform;if(0!==t.button||t.ctrlKey&&a)return;this.#s?.toggle(!1);const n=this._isDraggable;this._isDraggable=!1;const i=new AbortController,r=this._uiManager.combinedSignal(i);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",this.#wt.bind(this,e),{passive:!0,capture:!0,signal:r}),window.addEventListener("contextmenu",ive,{signal:r});const o=this.x,s=this.y,l=this.width,c=this.height,u=this.parent.div.style.cursor,d=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;const h=()=>{i.abort(),this.parent.togglePointerEvents(!0),this.#s?.toggle(!0),this._isDraggable=n,this.parent.div.style.cursor=u,this.div.style.cursor=d,this.#xt(o,s,l,c)};window.addEventListener("pointerup",h,{signal:r}),window.addEventListener("blur",h,{signal:r})}#xt(e,t,a,n){const i=this.x,r=this.y,o=this.width,s=this.height;i===e&&r===t&&o===a&&s===n||this.addCommands({cmd:()=>{this.width=o,this.height=s,this.x=i,this.y=r;const[e,t]=this.parentDimensions;this.setDims(e*o,t*s),this.fixAndSetPosition()},undo:()=>{this.width=a,this.height=n,this.x=e,this.y=t;const[i,r]=this.parentDimensions;this.setDims(i*a,r*n),this.fixAndSetPosition()},mustExec:!0})}#wt(e,t){const[a,n]=this.parentDimensions,i=this.x,r=this.y,o=this.width,s=this.height,l=Ave.MIN_SIZE/a,c=Ave.MIN_SIZE/n,u=e=>Math.round(1e4*e)/1e4,d=this.#yt(this.rotation),h=(e,t)=>[d[0]*e+d[2]*t,d[1]*e+d[3]*t],m=this.#yt(360-this.rotation);let p,g,f=!1,y=!1;switch(e){case"topLeft":f=!0,p=(e,t)=>[0,0],g=(e,t)=>[e,t];break;case"topMiddle":p=(e,t)=>[e/2,0],g=(e,t)=>[e/2,t];break;case"topRight":f=!0,p=(e,t)=>[e,0],g=(e,t)=>[0,t];break;case"middleRight":y=!0,p=(e,t)=>[e,t/2],g=(e,t)=>[0,t/2];break;case"bottomRight":f=!0,p=(e,t)=>[e,t],g=(e,t)=>[0,0];break;case"bottomMiddle":p=(e,t)=>[e/2,t],g=(e,t)=>[e/2,0];break;case"bottomLeft":f=!0,p=(e,t)=>[0,t],g=(e,t)=>[e,0];break;case"middleLeft":y=!0,p=(e,t)=>[0,t/2],g=(e,t)=>[e,t/2]}const v=p(o,s),b=g(o,s);let w=h(...b);const x=u(i+w[0]),k=u(r+w[1]);let A=1,S=1,[E,_]=this.screenToPageTranslation(t.movementX,t.movementY);if([E,_]=((e,t)=>[m[0]*e+m[2]*t,m[1]*e+m[3]*t])(E/a,_/n),f){const e=Math.hypot(o,s);A=S=Math.max(Math.min(Math.hypot(b[0]-v[0]-E,b[1]-v[1]-_)/e,1/o,1/s),l/o,c/s)}else y?A=Math.max(l,Math.min(1,Math.abs(b[0]-v[0]-E)))/o:S=Math.max(c,Math.min(1,Math.abs(b[1]-v[1]-_)))/s;const C=u(o*A),T=u(s*S);w=h(...g(C,T));const P=x-w[0],O=k-w[1];this.width=C,this.height=T,this.x=P,this.y=O,this.setDims(a*C,n*T),this.fixAndSetPosition()}altTextFinish(){this.#s?.finish()}async addEditToolbar(){return this._editToolbar||this.#ot||(this._editToolbar=new mve(this),this.div.append(this._editToolbar.render()),this.#s&&await this._editToolbar.addAltText(this.#s)),this._editToolbar}removeEditToolbar(){this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,this.#s?.destroy())}addContainer(e){const t=this._editToolbar?.div;t?t.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){this.#s||(kve.initialize(Ave._l10n),this.#s=new kve(this),this.#Ze&&(this.#s.data=this.#Ze,this.#Ze=null),await this.addEditToolbar())}get altTextData(){return this.#s?.data}set altTextData(e){this.#s&&(this.#s.data=e)}get guessedAltText(){return this.#s?.guessedText}async setGuessedAltText(e){await(this.#s?.setGuessedText(e))}serializeAltText(e){return this.#s?.serialize(e)}hasAltText(){return!!this.#s&&!this.#s.isEmpty()}hasAltTextData(){return this.#s?.hasData()??!1}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.tabIndex=this.#Xe?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),this.#kt();const[e,t]=this.parentDimensions;this.parentRotation%180!=0&&(this.div.style.maxWidth=`${(100*t/e).toFixed(2)}%`,this.div.style.maxHeight=`${(100*e/t).toFixed(2)}%`);const[a,n]=this.getInitialTranslation();return this.translate(a,n),gve(this,this.div,["pointerdown"]),this.div}pointerdown(e){const{isMac:t}=Mye.platform;0!==e.button||e.ctrlKey&&t?e.preventDefault():(this.#nt=!0,this._isDraggable?this.#At(e):this.#St(e))}get isSelected(){return this._uiManager.isSelected(this)}#St(e){const{isMac:t}=Mye.platform;e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this)}#At(e){const{isSelected:t}=this;this._uiManager.setUpDragSession();const a=new AbortController,n=this._uiManager.combinedSignal(a);if(t){this.div.classList.add("moving"),this.#ct=e.clientX,this.#ut=e.clientY;const t=e=>{const{clientX:t,clientY:a}=e,[n,i]=this.screenToPageTranslation(t-this.#ct,a-this.#ut);this.#ct=t,this.#ut=a,this._uiManager.dragSelectedEditors(n,i)};window.addEventListener("pointermove",t,{passive:!0,capture:!0,signal:n})}const i=()=>{a.abort(),t&&this.div.classList.remove("moving"),this.#nt=!1,this._uiManager.endDragSession()||this.#St(e)};window.addEventListener("pointerup",i,{signal:n}),window.addEventListener("blur",i,{signal:n})}moveInDOM(){this.#lt&&clearTimeout(this.#lt),this.#lt=setTimeout((()=>{this.#lt=null,this.parent?.moveEditorInDOM(this)}),0)}_setParentAndPosition(e,t,a){e.changeParent(this),this.x=t,this.y=a,this.fixAndSetPosition()}getRect(e,t,a=this.rotation){const n=this.parentScale,[i,r]=this.pageDimensions,[o,s]=this.pageTranslation,l=e/n,c=t/n,u=this.x*i,d=this.y*r,h=this.width*i,m=this.height*r;switch(a){case 0:return[u+l+o,r-d-c-m+s,u+l+h+o,r-d-c+s];case 90:return[u+c+o,r-d+l+s,u+c+m+o,r-d+l+h+s];case 180:return[u-l-h+o,r-d+c+s,u-l+o,r-d+c+m+s];case 270:return[u-c-m+o,r-d-l-h+s,u-c+o,r-d-l+s];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,t){const[a,n,i,r]=e,o=i-a,s=r-n;switch(this.rotation){case 0:return[a,t-r,o,s];case 90:return[a,t-n,s,o];case 180:return[i,t-n,o,s];case 270:return[i,t-r,s,o];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#ot=!0}disableEditMode(){this.#ot=!1}isInEditMode(){return this.#ot}shouldGetKeyboardEvents(){return this.#st}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}#kt(){if(this.#tt||!this.div)return;this.#tt=new AbortController;const e=this._uiManager.combinedSignal(this.#tt);this.div.addEventListener("focusin",this.focusin.bind(this),{signal:e}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:e})}rebuild(){this.#kt()}rotate(e){}serializeDeleted(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:this._initialData?.popupRef||""}}serialize(e=!1,t=null){fye("An editor must be serializable")}static async deserialize(e,t,a){const n=new this.prototype.constructor({parent:t,id:t.getNextId(),uiManager:a});n.rotation=e.rotation,n.#Ze=e.accessibilityData;const[i,r]=n.pageDimensions,[o,s,l,c]=n.getRectInCurrentCoords(e.rect,r);return n.x=o/i,n.y=s/r,n.width=l/i,n.height=c/r,n}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||null!==this.serialize())}remove(){if(this.#tt?.abort(),this.#tt=null,this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#lt&&(clearTimeout(this.#lt),this.#lt=null),this.#pt(),this.removeEditToolbar(),this.#dt){for(const e of this.#dt.values())clearTimeout(e);this.#dt=null}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#vt(),this.#Je.classList.remove("hidden"),gve(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(e){if(!this.isResizable||e.target!==this.div||"Enter"!==e.key)return;this._uiManager.setSelected(this),this.#et={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};const t=this.#Je.children;if(!this.#Ye){this.#Ye=Array.from(t);const e=this.#Et.bind(this),a=this.#_t.bind(this),n=this._uiManager._signal;for(const t of this.#Ye){const i=t.getAttribute("data-resizer-name");t.setAttribute("role","spinbutton"),t.addEventListener("keydown",e,{signal:n}),t.addEventListener("blur",a,{signal:n}),t.addEventListener("focus",this.#Ct.bind(this,i),{signal:n}),t.setAttribute("data-l10n-id",Ave._l10nResizer[i])}}const a=this.#Ye[0];let n=0;for(const e of t){if(e===a)break;n++}const i=(360-this.rotation+this.parentRotation)%360/90*(this.#Ye.length/4);if(i!==n){if(i<n)for(let e=0;e<n-i;e++)this.#Je.append(this.#Je.firstChild);else if(i>n)for(let e=0;e<i-n;e++)this.#Je.firstChild.before(this.#Je.lastChild);let e=0;for(const a of t){const t=this.#Ye[e++].getAttribute("data-resizer-name");a.setAttribute("data-l10n-id",Ave._l10nResizer[t])}}this.#Tt(0),this.#st=!0,this.#Je.firstChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}#Et(e){Ave._resizerKeyboardManager.exec(this,e)}#_t(e){this.#st&&e.relatedTarget?.parentNode!==this.#Je&&this.#pt()}#Ct(e){this.#at=this.#st?e:""}#Tt(e){if(this.#Ye)for(const t of this.#Ye)t.tabIndex=e}_resizeWithKeyboard(e,t){this.#st&&this.#wt(this.#at,{movementX:e,movementY:t})}#pt(){if(this.#st=!1,this.#Tt(-1),this.#et){const{savedX:e,savedY:t,savedWidth:a,savedHeight:n}=this.#et;this.#xt(e,t,a,n),this.#et=null}}_stopResizingWithKeyboard(){this.#pt(),this.div.focus()}select(){this.makeResizable(),this.div?.classList.add("selectedEditor"),this._editToolbar?(this._editToolbar?.show(),this.#s?.toggleAltTextBadge(!1)):this.addEditToolbar().then((()=>{this.div?.classList.contains("selectedEditor")&&this._editToolbar?.show()}))}unselect(){this.#Je?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this._editToolbar?.hide(),this.#s?.toggleAltTextBadge(!0)}updateParams(e,t){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return this.#rt}set isEditing(e){this.#rt=e,this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(e,t){this.#Qe=!0;const a=e/t,{style:n}=this.div;n.aspectRatio=a,n.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(e,t=!1){if(t){this.#dt||=new Map;const{action:t}=e;let a=this.#dt.get(t);return a&&clearTimeout(a),a=setTimeout((()=>{this._reportTelemetry(e),this.#dt.delete(t),0===this.#dt.size&&(this.#dt=null)}),Ave._telemetryTimeout),void this.#dt.set(t,a)}e.type||=this.editorType,this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:e}})}show(e=this._isVisible){this.div.classList.toggle("hidden",!e),this._isVisible=e}enable(){this.div&&(this.div.tabIndex=0),this.#Xe=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#Xe=!0}renderAnnotationElement(e){let t=e.container.querySelector(".annotationContent");if(t){if("CANVAS"===t.nodeName){const e=t;t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),e.before(t)}}else t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),e.container.prepend(t);return t}resetAnnotationElement(e){const{firstChild:t}=e.container;"DIV"===t?.nodeName&&t.classList.contains("annotationContent")&&t.remove()}}class Sve extends Ave{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const Eve=3285377520,_ve=4294901760,Cve=65535;class Tve{constructor(e){this.h1=e?4294967295&e:Eve,this.h2=e?4294967295&e:Eve}update(e){let t,a;if("string"==typeof e){t=new Uint8Array(2*e.length),a=0;for(let n=0,i=e.length;n<i;n++){const i=e.charCodeAt(n);i<=255?t[a++]=i:(t[a++]=i>>>8,t[a++]=255&i)}}else{if(!ArrayBuffer.isView(e))throw new Error("Invalid data format, must be a string or TypedArray.");t=e.slice(),a=t.byteLength}const n=a>>2,i=a-4*n,r=new Uint32Array(t.buffer,0,n);let o=0,s=0,l=this.h1,c=this.h2;const u=3432918353,d=461845907,h=11601,m=13715;for(let e=0;e<n;e++)1&e?(o=r[e],o=o*u&_ve|o*h&Cve,o=o<<15|o>>>17,o=o*d&_ve|o*m&Cve,l^=o,l=l<<13|l>>>19,l=5*l+3864292196):(s=r[e],s=s*u&_ve|s*h&Cve,s=s<<15|s>>>17,s=s*d&_ve|s*m&Cve,c^=s,c=c<<13|c>>>19,c=5*c+3864292196);switch(o=0,i){case 3:o^=t[4*n+2]<<16;case 2:o^=t[4*n+1]<<8;case 1:o^=t[4*n],o=o*u&_ve|o*h&Cve,o=o<<15|o>>>17,o=o*d&_ve|o*m&Cve,1&n?l^=o:c^=o}this.h1=l,this.h2=c}hexdigest(){let e=this.h1,t=this.h2;return e^=t>>>1,e=3981806797*e&_ve|36045*e&Cve,t=4283543511*t&_ve|(2950163797*(t<<16|e>>>16)&_ve)>>>16,e^=t>>>1,e=444984403*e&_ve|60499*e&Cve,t=3301882366*t&_ve|(3120437893*(t<<16|e>>>16)&_ve)>>>16,e^=t>>>1,(e>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}const Pve=Object.freeze({map:null,hash:"",transfer:void 0});class Ove{#Pt=!1;#Ot=null;#Mt=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(e,t){const a=this.#Mt.get(e);return void 0===a?t:Object.assign(t,a)}getRawValue(e){return this.#Mt.get(e)}remove(e){if(this.#Mt.delete(e),0===this.#Mt.size&&this.resetModified(),"function"==typeof this.onAnnotationEditor){for(const e of this.#Mt.values())if(e instanceof Ave)return;this.onAnnotationEditor(null)}}setValue(e,t){const a=this.#Mt.get(e);let n=!1;if(void 0!==a)for(const[e,i]of Object.entries(t))a[e]!==i&&(n=!0,a[e]=i);else n=!0,this.#Mt.set(e,t);n&&this.#Dt(),t instanceof Ave&&"function"==typeof this.onAnnotationEditor&&this.onAnnotationEditor(t.constructor._type)}has(e){return this.#Mt.has(e)}getAll(){return this.#Mt.size>0?Oye(this.#Mt):null}setAll(e){for(const[t,a]of Object.entries(e))this.setValue(t,a)}get size(){return this.#Mt.size}#Dt(){this.#Pt||(this.#Pt=!0,"function"==typeof this.onSetModified&&this.onSetModified())}resetModified(){this.#Pt&&(this.#Pt=!1,"function"==typeof this.onResetModified&&this.onResetModified())}get print(){return new Mve(this)}get serializable(){if(0===this.#Mt.size)return Pve;const e=new Map,t=new Tve,a=[],n=Object.create(null);let i=!1;for(const[a,r]of this.#Mt){const o=r instanceof Ave?r.serialize(!1,n):r;o&&(e.set(a,o),t.update(`${a}:${JSON.stringify(o)}`),i||=!!o.bitmap)}if(i)for(const t of e.values())t.bitmap&&a.push(t.bitmap);return e.size>0?{map:e,hash:t.hexdigest(),transfer:a}:Pve}get editorStats(){let e=null;const t=new Map;for(const a of this.#Mt.values()){if(!(a instanceof Ave))continue;const n=a.telemetryFinalData;if(!n)continue;const{type:i}=n;t.has(i)||t.set(i,Object.getPrototypeOf(a).constructor),e||=Object.create(null);const r=e[i]||=new Map;for(const[e,t]of Object.entries(n)){if("type"===e)continue;let a=r.get(e);a||(a=new Map,r.set(e,a));const n=a.get(t)??0;a.set(t,n+1)}}for(const[a,n]of t)e[a]=n.computeTelemetryFinalData(e[a]);return e}resetModifiedIds(){this.#Ot=null}get modifiedIds(){if(this.#Ot)return this.#Ot;const e=[];for(const t of this.#Mt.values())t instanceof Ave&&t.annotationElementId&&t.serialize()&&e.push(t.annotationElementId);return this.#Ot={ids:new Set(e),hash:e.join(",")}}}class Mve extends Ove{#It;constructor(e){super();const{map:t,hash:a,transfer:n}=e.serializable,i=structuredClone(t,n?{transfer:n}:null);this.#It={map:i,hash:a,transfer:n}}get print(){fye("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#It}get modifiedIds(){return bye(this,"modifiedIds",{ids:new Set,hash:""})}}class Dve{#Nt=new Set;constructor({ownerDocument:e=globalThis.document,styleElement:t=null}){this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.add(e),this._document.fonts.add(e)}removeNativeFontFace(e){this.nativeFontFaces.delete(e),this._document.fonts.delete(e)}insertRule(e){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const t=this.styleElement.sheet;t.insertRule(e,t.cssRules.length)}clear(){for(const e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.clear(),this.#Nt.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:e,_inspectFont:t}){if(e&&!this.#Nt.has(e.loadedName))if(yye(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:a,src:n,style:i}=e,r=new FontFace(a,n,i);this.addNativeFontFace(r);try{await r.load(),this.#Nt.add(a),t?.(e)}catch{gye(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(r)}}else fye("Not implemented: loadSystemFont without the Font Loading API.")}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo)return void await this.loadSystemFont(e);if(this.isFontLoadingAPISupported){const t=e.createNativeFontFace();if(t){this.addNativeFontFace(t);try{await t.loaded}catch(a){throw gye(`Failed to load font '${t.family}': '${a}'.`),e.disableFontFace=!0,a}}return}const t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise((t=>{const a=this._queueLoadingCallback(t);this._prepareFontLoadEvent(e,a)}))}}get isFontLoadingAPISupported(){return bye(this,"isFontLoadingAPISupported",!!this._document?.fonts)}get isSyncFontLoadingSupported(){let e=!1;return(ffe||"undefined"!=typeof navigator&&"string"==typeof navigator?.userAgent&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(e=!0),bye(this,"isSyncFontLoadingSupported",e)}_queueLoadingCallback(e){const{loadingRequests:t}=this,a={done:!1,complete:function(){for(yye(!a.done,"completeRequest() cannot be called twice."),a.done=!0;t.length>0&&t[0].done;){const e=t.shift();setTimeout(e.callback,0)}},callback:e};return t.push(a),a}get _loadTestFont(){return bye(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(e,t){function a(e,t){return e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|255&e.charCodeAt(t+3)}function n(e,t,a,n){return e.substring(0,t)+n+e.substring(t+a)}let i,r;const o=this._document.createElement("canvas");o.width=1,o.height=1;const s=o.getContext("2d");let l=0;const c=`lt${Date.now()}${this.loadTestFontId++}`;let u=this._loadTestFont;u=n(u,976,c.length,c);const d=1482184792;let h=a(u,16);for(i=0,r=c.length-3;i<r;i+=4)h=h-d+a(c,i)|0;i<c.length&&(h=h-d+a(c+"XXX",i)|0),u=n(u,16,4,function(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)}(h));const m=`@font-face {font-family:"${c}";src:${`url(data:font/opentype;base64,${btoa(u)});`}}`;this.insertRule(m);const p=this._document.createElement("div");p.style.visibility="hidden",p.style.width=p.style.height="10px",p.style.position="absolute",p.style.top=p.style.left="0px";for(const t of[e.loadedName,c]){const e=this._document.createElement("span");e.textContent="Hi",e.style.fontFamily=t,p.append(e)}this._document.body.append(p),function e(t,a){if(++l>30)return gye("Load test font never loaded."),void a();s.font="30px "+t,s.fillText(".",0,20),s.getImageData(0,0,1,1).data[3]>0?a():setTimeout(e.bind(null,t,a))}(c,(()=>{p.remove(),t.complete()}))}}class Ive{constructor(e,{disableFontFace:t=!1,inspectFont:a=null}){this.compiledGlyphs=Object.create(null);for(const t in e)this[t]=e[t];this.disableFontFace=!0===t,this._inspectFont=a}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let e;if(this.cssFontInfo){const t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,t)}else e=new FontFace(this.loadedName,this.data,{});return this._inspectFont?.(this),e}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const e=`url(data:${this.mimetype};base64,${function(e){return Uint8Array.prototype.toBase64?e.toBase64():btoa(Tye(e))}(this.data)});`;let t;if(this.cssFontInfo){let a=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(a+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),t=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${a}src:${e}}`}else t=`@font-face {font-family:"${this.loadedName}";src:${e}}`;return this._inspectFont?.(this,e),t}getPathGenerator(e,t){if(void 0!==this.compiledGlyphs[t])return this.compiledGlyphs[t];let a;try{a=e.get(this.loadedName+"_path_"+t)}catch(e){gye(`getPathGenerator - ignoring character: "${e}".`)}if(!Array.isArray(a)||0===a.length)return this.compiledGlyphs[t]=function(e,t){};const n=[];for(let e=0,t=a.length;e<t;)switch(a[e++]){case Lye:{const[t,i,r,o,s,l]=a.slice(e,e+6);n.push((e=>e.bezierCurveTo(t,i,r,o,s,l))),e+=6}break;case Fye:{const[t,i]=a.slice(e,e+2);n.push((e=>e.moveTo(t,i))),e+=2}break;case Bye:{const[t,i]=a.slice(e,e+2);n.push((e=>e.lineTo(t,i))),e+=2}break;case Hye:{const[t,i,r,o]=a.slice(e,e+4);n.push((e=>e.quadraticCurveTo(t,i,r,o))),e+=4}break;case qye:n.push((e=>e.restore()));break;case Uye:n.push((e=>e.save()));break;case Vye:yye(2===n.length,"Scale command is only valid at the third position.");break;case Wye:{const[t,i,r,o,s,l]=a.slice(e,e+6);n.push((e=>e.transform(t,i,r,o,s,l))),e+=6}break;case $ye:{const[t,i]=a.slice(e,e+2);n.push((e=>e.translate(t,i))),e+=2}}return this.compiledGlyphs[t]=function(e,t){n[0](e),n[1](e),e.scale(t,-t);for(let t=2,a=n.length;t<a;t++)n[t](e)}}}class Nve{#jt=!1;constructor({enableHWA:e=!1}){this.#jt=e}create(e,t){if(e<=0||t<=0)throw new Error("Invalid canvas size");const a=this._createCanvas(e,t);return{canvas:a,context:a.getContext("2d",{willReadFrequently:!this.#jt})}}reset(e,t,a){if(!e.canvas)throw new Error("Canvas is not specified");if(t<=0||a<=0)throw new Error("Invalid canvas size");e.canvas.width=t,e.canvas.height=a}destroy(e){if(!e.canvas)throw new Error("Canvas is not specified");e.canvas.width=0,e.canvas.height=0,e.canvas=null,e.context=null}_createCanvas(e,t){fye("Abstract method `_createCanvas` called.")}}class jve{constructor({baseUrl:e=null,isCompressed:t=!0}){this.baseUrl=e,this.isCompressed=t}async fetch({name:e}){if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!e)throw new Error("CMap name must be specified.");const t=this.baseUrl+e+(this.isCompressed?".bcmap":"");return this._fetch(t).then((e=>({cMapData:e,isCompressed:this.isCompressed}))).catch((e=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${t}`)}))}async _fetch(e){fye("Abstract method `_fetch` called.")}}class zve extends jve{async _fetch(e){const t=await Zye(e,this.isCompressed?"arraybuffer":"text");return t instanceof ArrayBuffer?new Uint8Array(t):Pye(t)}}class Rve{addFilter(e){return"none"}addHCMFilter(e,t){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addHighlightHCMFilter(e,t,a,n,i){return"none"}destroy(e=!1){}}class Lve{constructor({baseUrl:e=null}){this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!e)throw new Error("Font filename must be specified.");const t=`${this.baseUrl}${e}`;return this._fetch(t).catch((e=>{throw new Error(`Unable to load font data at: ${t}`)}))}async _fetch(e){fye("Abstract method `_fetch` called.")}}class Fve extends Lve{async _fetch(e){const t=await Zye(e,"arraybuffer");return new Uint8Array(t)}}if(ffe){var Bve=Promise.withResolvers(),Hve=null;(async()=>{const e=await import("./_node-resolve_empty-CIEyP2s7.js"),t=await import("./_node-resolve_empty-CIEyP2s7.js"),a=await import("./_node-resolve_empty-CIEyP2s7.js"),n=await import("./_node-resolve_empty-CIEyP2s7.js");return new Map(Object.entries({fs:e,http:t,https:a,url:n,canvas:undefined,path2d:undefined}))})().then((e=>{Hve=e,Bve.resolve()}),(e=>{gye(`loadPackages: ${e}`),Hve=new Map,Bve.resolve()}))}class qve{static get promise(){return Bve.promise}static get(e){return Hve?.get(e)}}async function Uve(e){const t=qve.get("fs"),a=await t.promises.readFile(e);return new Uint8Array(a)}const Vve="Fill",Wve="Stroke",$ve="Shading";function Gve(e,t){if(!t)return;const a=t[2]-t[0],n=t[3]-t[1],i=new Path2D;i.rect(t[0],t[1],a,n),e.clip(i)}class Kve{getPattern(){fye("Abstract method `getPattern` called.")}}class Zve extends Kve{constructor(e){super(),this._type=e[1],this._bbox=e[2],this._colorStops=e[3],this._p0=e[4],this._p1=e[5],this._r0=e[6],this._r1=e[7],this.matrix=null}_createGradient(e){let t;"axial"===this._type?t=e.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(t=e.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const e of this._colorStops)t.addColorStop(e[0],e[1]);return t}getPattern(e,t,a,n){let i;if(n===Wve||n===Vve){const r=t.current.getClippedPathBoundingBox(n,cve(e))||[0,0,0,0],o=Math.ceil(r[2]-r[0])||1,s=Math.ceil(r[3]-r[1])||1,l=t.cachedCanvases.getCanvas("pattern",o,s),c=l.context;c.clearRect(0,0,c.canvas.width,c.canvas.height),c.beginPath(),c.rect(0,0,c.canvas.width,c.canvas.height),c.translate(-r[0],-r[1]),a=Iye.transform(a,[1,0,0,1,r[0],r[1]]),c.transform(...t.baseTransform),this.matrix&&c.transform(...this.matrix),Gve(c,this._bbox),c.fillStyle=this._createGradient(c),c.fill(),i=e.createPattern(l.canvas,"no-repeat");const u=new DOMMatrix(a);i.setTransform(u)}else Gve(e,this._bbox),i=this._createGradient(e);return i}}function Yve(e,t,a,n,i,r,o,s){const l=t.coords,c=t.colors,u=e.data,d=4*e.width;let h;l[a+1]>l[n+1]&&(h=a,a=n,n=h,h=r,r=o,o=h),l[n+1]>l[i+1]&&(h=n,n=i,i=h,h=o,o=s,s=h),l[a+1]>l[n+1]&&(h=a,a=n,n=h,h=r,r=o,o=h);const m=(l[a]+t.offsetX)*t.scaleX,p=(l[a+1]+t.offsetY)*t.scaleY,g=(l[n]+t.offsetX)*t.scaleX,f=(l[n+1]+t.offsetY)*t.scaleY,y=(l[i]+t.offsetX)*t.scaleX,v=(l[i+1]+t.offsetY)*t.scaleY;if(p>=v)return;const b=c[r],w=c[r+1],x=c[r+2],k=c[o],A=c[o+1],S=c[o+2],E=c[s],_=c[s+1],C=c[s+2],T=Math.round(p),P=Math.round(v);let O,M,D,I,N,j,z,R;for(let e=T;e<=P;e++){if(e<f){const t=e<p?0:(p-e)/(p-f);O=m-(m-g)*t,M=b-(b-k)*t,D=w-(w-A)*t,I=x-(x-S)*t}else{let t;t=e>v?1:f===v?0:(f-e)/(f-v),O=g-(g-y)*t,M=k-(k-E)*t,D=A-(A-_)*t,I=S-(S-C)*t}let t;t=e<p?0:e>v?1:(p-e)/(p-v),N=m-(m-y)*t,j=b-(b-E)*t,z=w-(w-_)*t,R=x-(x-C)*t;const a=Math.round(Math.min(O,N)),n=Math.round(Math.max(O,N));let i=d*e+4*a;for(let e=a;e<=n;e++)t=(O-e)/(O-N),t<0?t=0:t>1&&(t=1),u[i++]=M-(M-j)*t|0,u[i++]=D-(D-z)*t|0,u[i++]=I-(I-R)*t|0,u[i++]=255}}function Xve(e,t,a){const n=t.coords,i=t.colors;let r,o;switch(t.type){case"lattice":const s=t.verticesPerRow,l=Math.floor(n.length/s)-1,c=s-1;for(r=0;r<l;r++){let t=r*s;for(let r=0;r<c;r++,t++)Yve(e,a,n[t],n[t+1],n[t+s],i[t],i[t+1],i[t+s]),Yve(e,a,n[t+s+1],n[t+1],n[t+s],i[t+s+1],i[t+1],i[t+s])}break;case"triangles":for(r=0,o=n.length;r<o;r+=3)Yve(e,a,n[r],n[r+1],n[r+2],i[r],i[r+1],i[r+2]);break;default:throw new Error("illegal figure")}}class Qve extends Kve{constructor(e){super(),this._coords=e[2],this._colors=e[3],this._figures=e[4],this._bounds=e[5],this._bbox=e[7],this._background=e[8],this.matrix=null}_createMeshCanvas(e,t,a){const n=Math.floor(this._bounds[0]),i=Math.floor(this._bounds[1]),r=Math.ceil(this._bounds[2])-n,o=Math.ceil(this._bounds[3])-i,s=Math.min(Math.ceil(Math.abs(r*e[0]*1.1)),3e3),l=Math.min(Math.ceil(Math.abs(o*e[1]*1.1)),3e3),c=r/s,u=o/l,d={coords:this._coords,colors:this._colors,offsetX:-n,offsetY:-i,scaleX:1/c,scaleY:1/u},h=s+4,m=l+4,p=a.getCanvas("mesh",h,m),g=p.context,f=g.createImageData(s,l);if(t){const e=f.data;for(let a=0,n=e.length;a<n;a+=4)e[a]=t[0],e[a+1]=t[1],e[a+2]=t[2],e[a+3]=255}for(const e of this._figures)Xve(f,e,d);g.putImageData(f,2,2);return{canvas:p.canvas,offsetX:n-2*c,offsetY:i-2*u,scaleX:c,scaleY:u}}getPattern(e,t,a,n){let i;if(Gve(e,this._bbox),n===$ve)i=Iye.singularValueDecompose2dScale(cve(e));else if(i=Iye.singularValueDecompose2dScale(t.baseTransform),this.matrix){const e=Iye.singularValueDecompose2dScale(this.matrix);i=[i[0]*e[0],i[1]*e[1]]}const r=this._createMeshCanvas(i,n===$ve?null:this._background,t.cachedCanvases);return n!==$ve&&(e.setTransform(...t.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(r.offsetX,r.offsetY),e.scale(r.scaleX,r.scaleY),e.createPattern(r.canvas,"no-repeat")}}class Jve extends Kve{getPattern(){return"hotpink"}}const ebe=1,tbe=2;class abe{static MAX_PATTERN_SIZE=3e3;constructor(e,t,a,n,i){this.operatorList=e[2],this.matrix=e[3],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.color=t,this.ctx=a,this.canvasGraphicsFactory=n,this.baseTransform=i}createPatternCanvas(e){const{bbox:t,operatorList:a,paintType:n,tilingType:i,color:r,canvasGraphicsFactory:o}=this;let{xstep:s,ystep:l}=this;s=Math.abs(s),l=Math.abs(l),pye("TilingType: "+i);const c=t[0],u=t[1],d=t[2],h=t[3],m=d-c,p=h-u,g=Iye.singularValueDecompose2dScale(this.matrix),f=Iye.singularValueDecompose2dScale(this.baseTransform),y=g[0]*f[0],v=g[1]*f[1];let b=m,w=p,x=!1,k=!1;const A=Math.ceil(s*y),S=Math.ceil(l*v);A>=Math.ceil(m*y)?b=s:x=!0,S>=Math.ceil(p*v)?w=l:k=!0;const E=this.getSizeAndScale(b,this.ctx.canvas.width,y),_=this.getSizeAndScale(w,this.ctx.canvas.height,v),C=e.cachedCanvases.getCanvas("pattern",E.size,_.size),T=C.context,P=o.createCanvasGraphics(T);if(P.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(P,n,r),T.translate(-E.scale*c,-_.scale*u),P.transform(E.scale,0,0,_.scale,0,0),T.save(),this.clipBbox(P,c,u,d,h),P.baseTransform=cve(P.ctx),P.executeOperatorList(a),P.endDrawing(),T.restore(),x||k){const t=C.canvas;x&&(b=s),k&&(w=l);const a=this.getSizeAndScale(b,this.ctx.canvas.width,y),n=this.getSizeAndScale(w,this.ctx.canvas.height,v),i=a.size,r=n.size,o=e.cachedCanvases.getCanvas("pattern-workaround",i,r),d=o.context,h=x?Math.floor(m/s):0,g=k?Math.floor(p/l):0;for(let e=0;e<=h;e++)for(let a=0;a<=g;a++)d.drawImage(t,i*e,r*a,i,r,0,0,i,r);return{canvas:o.canvas,scaleX:a.scale,scaleY:n.scale,offsetX:c,offsetY:u}}return{canvas:C.canvas,scaleX:E.scale,scaleY:_.scale,offsetX:c,offsetY:u}}getSizeAndScale(e,t,a){const n=Math.max(abe.MAX_PATTERN_SIZE,t);let i=Math.ceil(e*a);return i>=n?i=n:a=i/e,{scale:a,size:i}}clipBbox(e,t,a,n,i){const r=n-t,o=i-a;e.ctx.rect(t,a,r,o),e.current.updateRectMinMax(cve(e.ctx),[t,a,n,i]),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,t,a){const n=e.ctx,i=e.current;switch(t){case ebe:const e=this.ctx;n.fillStyle=e.fillStyle,n.strokeStyle=e.strokeStyle,i.fillColor=e.fillStyle,i.strokeColor=e.strokeStyle;break;case tbe:const r=Iye.makeHexColor(a[0],a[1],a[2]);n.fillStyle=r,n.strokeStyle=r,i.fillColor=r,i.strokeColor=r;break;default:throw new _ye(`Unsupported paint type: ${t}`)}}getPattern(e,t,a,n){let i=a;n!==$ve&&(i=Iye.transform(i,t.baseTransform),this.matrix&&(i=Iye.transform(i,this.matrix)));const r=this.createPatternCanvas(t);let o=new DOMMatrix(i);o=o.translate(r.offsetX,r.offsetY),o=o.scale(1/r.scaleX,1/r.scaleY);const s=e.createPattern(r.canvas,"repeat");return s.setTransform(o),s}}function nbe({src:e,srcPos:t=0,dest:a,width:n,height:i,nonBlackColor:r=4294967295,inverseDecode:o=!1}){const s=Mye.isLittleEndian?4278190080:255,[l,c]=o?[r,s]:[s,r],u=n>>3,d=7&n,h=e.length;a=new Uint32Array(a.buffer);let m=0;for(let n=0;n<i;n++){for(const n=t+u;t<n;t++){const n=t<h?e[t]:255;a[m++]=128&n?c:l,a[m++]=64&n?c:l,a[m++]=32&n?c:l,a[m++]=16&n?c:l,a[m++]=8&n?c:l,a[m++]=4&n?c:l,a[m++]=2&n?c:l,a[m++]=1&n?c:l}if(0===d)continue;const n=t<h?e[t++]:255;for(let e=0;e<d;e++)a[m++]=n&1<<7-e?c:l}return{srcPos:t,destPos:m}}const ibe=16;class rbe{constructor(e){this.canvasFactory=e,this.cache=Object.create(null)}getCanvas(e,t,a){let n;return void 0!==this.cache[e]?(n=this.cache[e],this.canvasFactory.reset(n,t,a)):(n=this.canvasFactory.create(t,a),this.cache[e]=n),n}delete(e){delete this.cache[e]}clear(){for(const e in this.cache){const t=this.cache[e];this.canvasFactory.destroy(t),delete this.cache[e]}}}function obe(e,t,a,n,i,r,o,s,l,c){const[u,d,h,m,p,g]=cve(e);if(0===d&&0===h){const f=o*u+p,y=Math.round(f),v=s*m+g,b=Math.round(v),w=(o+l)*u+p,x=Math.abs(Math.round(w)-y)||1,k=(s+c)*m+g,A=Math.abs(Math.round(k)-b)||1;return e.setTransform(Math.sign(u),0,0,Math.sign(m),y,b),e.drawImage(t,a,n,i,r,0,0,x,A),e.setTransform(u,d,h,m,p,g),[x,A]}if(0===u&&0===m){const f=s*h+p,y=Math.round(f),v=o*d+g,b=Math.round(v),w=(s+c)*h+p,x=Math.abs(Math.round(w)-y)||1,k=(o+l)*d+g,A=Math.abs(Math.round(k)-b)||1;return e.setTransform(0,Math.sign(d),Math.sign(h),0,y,b),e.drawImage(t,a,n,i,r,0,0,A,x),e.setTransform(u,d,h,m,p,g),[A,x]}e.drawImage(t,a,n,i,r,o,s,l,c);return[Math.hypot(u,d)*l,Math.hypot(h,m)*c]}class sbe{constructor(e,t){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=yfe,this.textMatrixScale=1,this.fontMatrix=vfe,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=Dfe,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,e,t])}clone(){const e=Object.create(this);return e.clipBox=this.clipBox.slice(),e}setCurrentPoint(e,t){this.x=e,this.y=t}updatePathMinMax(e,t,a){[t,a]=Iye.applyTransform([t,a],e),this.minX=Math.min(this.minX,t),this.minY=Math.min(this.minY,a),this.maxX=Math.max(this.maxX,t),this.maxY=Math.max(this.maxY,a)}updateRectMinMax(e,t){const a=Iye.applyTransform(t,e),n=Iye.applyTransform(t.slice(2),e),i=Iye.applyTransform([t[0],t[3]],e),r=Iye.applyTransform([t[2],t[1]],e);this.minX=Math.min(this.minX,a[0],n[0],i[0],r[0]),this.minY=Math.min(this.minY,a[1],n[1],i[1],r[1]),this.maxX=Math.max(this.maxX,a[0],n[0],i[0],r[0]),this.maxY=Math.max(this.maxY,a[1],n[1],i[1],r[1])}updateScalingPathMinMax(e,t){Iye.scaleMinMax(e,t),this.minX=Math.min(this.minX,t[0]),this.minY=Math.min(this.minY,t[1]),this.maxX=Math.max(this.maxX,t[2]),this.maxY=Math.max(this.maxY,t[3])}updateCurvePathMinMax(e,t,a,n,i,r,o,s,l,c){const u=Iye.bezierBoundingBox(t,a,n,i,r,o,s,l,c);c||this.updateRectMinMax(e,u)}getPathBoundingBox(e=Vve,t=null){const a=[this.minX,this.minY,this.maxX,this.maxY];if(e===Wve){t||fye("Stroke bounding box must include transform.");const e=Iye.singularValueDecompose2dScale(t),n=e[0]*this.lineWidth/2,i=e[1]*this.lineWidth/2;a[0]-=n,a[1]-=i,a[2]+=n,a[3]+=i}return a}updateClipFromPath(){const e=Iye.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(e){this.clipBox=e,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(e=Vve,t=null){return Iye.intersect(this.clipBox,this.getPathBoundingBox(e,t))}}function lbe(e,t){if("undefined"!=typeof ImageData&&t instanceof ImageData)return void e.putImageData(t,0,0);const a=t.height,n=t.width,i=a%ibe,r=(a-i)/ibe,o=0===i?r:r+1,s=e.createImageData(n,ibe);let l,c=0;const u=t.data,d=s.data;let h,m,p,g;if(t.kind===Lfe.GRAYSCALE_1BPP){const t=u.byteLength,a=new Uint32Array(d.buffer,0,d.byteLength>>2),g=a.length,f=n+7>>3,y=4294967295,v=Mye.isLittleEndian?4278190080:255;for(h=0;h<o;h++){for(p=h<r?ibe:i,l=0,m=0;m<p;m++){const e=t-c;let i=0;const r=e>f?n:8*e-7,o=-8&r;let s=0,d=0;for(;i<o;i+=8)d=u[c++],a[l++]=128&d?y:v,a[l++]=64&d?y:v,a[l++]=32&d?y:v,a[l++]=16&d?y:v,a[l++]=8&d?y:v,a[l++]=4&d?y:v,a[l++]=2&d?y:v,a[l++]=1&d?y:v;for(;i<r;i++)0===s&&(d=u[c++],s=128),a[l++]=d&s?y:v,s>>=1}for(;l<g;)a[l++]=0;e.putImageData(s,0,h*ibe)}}else if(t.kind===Lfe.RGBA_32BPP){for(m=0,g=n*ibe*4,h=0;h<r;h++)d.set(u.subarray(c,c+g)),c+=g,e.putImageData(s,0,m),m+=ibe;h<o&&(g=n*i*4,d.set(u.subarray(c,c+g)),e.putImageData(s,0,m))}else{if(t.kind!==Lfe.RGB_24BPP)throw new Error(`bad image kind: ${t.kind}`);for(p=ibe,g=n*p,h=0;h<o;h++){for(h>=r&&(p=i,g=n*p),l=0,m=g;m--;)d[l++]=u[c++],d[l++]=u[c++],d[l++]=u[c++],d[l++]=255;e.putImageData(s,0,h*ibe)}}}function cbe(e,t){if(t.bitmap)return void e.drawImage(t.bitmap,0,0);const a=t.height,n=t.width,i=a%ibe,r=(a-i)/ibe,o=0===i?r:r+1,s=e.createImageData(n,ibe);let l=0;const c=t.data,u=s.data;for(let t=0;t<o;t++){const a=t<r?ibe:i;({srcPos:l}=nbe({src:c,srcPos:l,dest:u,width:n,height:a,nonBlackColor:0})),e.putImageData(s,0,t*ibe)}}function ube(e,t){const a=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const n of a)void 0!==e[n]&&(t[n]=e[n]);void 0!==e.setLineDash&&(t.setLineDash(e.getLineDash()),t.lineDashOffset=e.lineDashOffset)}function dbe(e){if(e.strokeStyle=e.fillStyle="#000000",e.fillRule="nonzero",e.globalAlpha=1,e.lineWidth=1,e.lineCap="butt",e.lineJoin="miter",e.miterLimit=10,e.globalCompositeOperation="source-over",e.font="10px sans-serif",void 0!==e.setLineDash&&(e.setLineDash([]),e.lineDashOffset=0),!ffe){const{filter:t}=e;"none"!==t&&""!==t&&(e.filter="none")}}function hbe(e,t){if(t)return!0;const a=Iye.singularValueDecompose2dScale(e);a[0]=Math.fround(a[0]),a[1]=Math.fround(a[1]);const n=Math.fround((globalThis.devicePixelRatio||1)*Kye.PDF_TO_CSS_UNITS);return a[0]<=n&&a[1]<=n}const mbe=["butt","round","square"],pbe=["miter","round","bevel"],gbe={},fbe={};class ybe{constructor(e,t,a,n,i,{optionalContentConfig:r,markedContentStack:o=null},s,l){this.ctx=e,this.current=new sbe(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=t,this.objs=a,this.canvasFactory=n,this.filterFactory=i,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=o||[],this.optionalContentConfig=r,this.cachedCanvases=new rbe(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=s,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=l,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(e,t=null){return"string"==typeof e?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):t}beginDrawing({transform:e,viewport:t,transparency:a=!1,background:n=null}){const i=this.ctx.canvas.width,r=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=n||"#ffffff",this.ctx.fillRect(0,0,i,r),this.ctx.fillStyle=o,a){const e=this.cachedCanvases.getCanvas("transparent",i,r);this.compositeCtx=this.ctx,this.transparentCanvas=e.canvas,this.ctx=e.context,this.ctx.save(),this.ctx.transform(...cve(this.compositeCtx))}this.ctx.save(),dbe(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...t.transform),this.viewportScale=t.scale,this.baseTransform=cve(this.ctx)}executeOperatorList(e,t,a,n){const i=e.argsArray,r=e.fnArray;let o=t||0;const s=i.length;if(s===o)return o;const l=s-o>10&&"function"==typeof a,c=l?Date.now()+15:0;let u=0;const d=this.commonObjs,h=this.objs;let m;for(;;){if(void 0!==n&&o===n.nextBreakPoint)return n.breakIt(o,a),o;if(m=r[o],m!==cye.dependency)this[m].apply(this,i[o]);else for(const e of i[o]){const t=e.startsWith("g_")?d:h;if(!t.has(e))return t.get(e,a),o}if(o++,o===s)return o;if(l&&++u>10){if(Date.now()>c)return a(),o;u=0}}}#zt(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)}endDrawing(){this.#zt(),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const e of this._cachedBitmapsMap.values()){for(const t of e.values())"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);e.clear()}this._cachedBitmapsMap.clear(),this.#Rt()}#Rt(){if(this.pageColors){const e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if("none"!==e){const t=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=t}}}_scaleImage(e,t){const a=e.width??e.displayWidth,n=e.height??e.displayHeight;let i,r,o=Math.max(Math.hypot(t[0],t[1]),1),s=Math.max(Math.hypot(t[2],t[3]),1),l=a,c=n,u="prescale1";for(;o>2&&l>1||s>2&&c>1;){let t=l,a=c;o>2&&l>1&&(t=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l/2),o/=l/t),s>2&&c>1&&(a=c>=16384?Math.floor(c/2)-1||1:Math.ceil(c)/2,s/=c/a),i=this.cachedCanvases.getCanvas(u,t,a),r=i.context,r.clearRect(0,0,t,a),r.drawImage(e,0,0,l,c,0,0,t,a),e=i.canvas,l=t,c=a,u="prescale1"===u?"prescale2":"prescale1"}return{img:e,paintWidth:l,paintHeight:c}}_createMaskCanvas(e){const t=this.ctx,{width:a,height:n}=e,i=this.current.fillColor,r=this.current.patternFill,o=cve(t);let s,l,c,u;if((e.bitmap||e.data)&&e.count>1){const t=e.bitmap||e.data.buffer;l=JSON.stringify(r?o:[o.slice(0,4),i]),s=this._cachedBitmapsMap.get(t),s||(s=new Map,this._cachedBitmapsMap.set(t,s));const a=s.get(l);if(a&&!r){return{canvas:a,offsetX:Math.round(Math.min(o[0],o[2])+o[4]),offsetY:Math.round(Math.min(o[1],o[3])+o[5])}}c=a}c||(u=this.cachedCanvases.getCanvas("maskCanvas",a,n),cbe(u.context,e));let d=Iye.transform(o,[1/a,0,0,-1/n,0,0]);d=Iye.transform(d,[1,0,0,1,0,-n]);const[h,m,p,g]=Iye.getAxialAlignedBoundingBox([0,0,a,n],d),f=Math.round(p-h)||1,y=Math.round(g-m)||1,v=this.cachedCanvases.getCanvas("fillCanvas",f,y),b=v.context,w=h,x=m;b.translate(-w,-x),b.transform(...d),c||(c=this._scaleImage(u.canvas,uve(b)),c=c.img,s&&r&&s.set(l,c)),b.imageSmoothingEnabled=hbe(cve(b),e.interpolate),obe(b,c,0,0,c.width,c.height,0,0,a,n),b.globalCompositeOperation="source-in";const k=Iye.transform(uve(b),[1,0,0,1,-w,-x]);return b.fillStyle=r?i.getPattern(t,this,k,Vve):i,b.fillRect(0,0,a,n),s&&!r&&(this.cachedCanvases.delete("fillCanvas"),s.set(l,v.canvas)),{canvas:v.canvas,offsetX:Math.round(w),offsetY:Math.round(x)}}setLineWidth(e){e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(e){this.ctx.lineCap=mbe[e]}setLineJoin(e){this.ctx.lineJoin=pbe[e]}setMiterLimit(e){this.ctx.miterLimit=e}setDash(e,t){const a=this.ctx;void 0!==a.setLineDash&&(a.setLineDash(e),a.lineDashOffset=t)}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(const[t,a]of e)switch(t){case"LW":this.setLineWidth(a);break;case"LC":this.setLineCap(a);break;case"LJ":this.setLineJoin(a);break;case"ML":this.setMiterLimit(a);break;case"D":this.setDash(a[0],a[1]);break;case"RI":this.setRenderingIntent(a);break;case"FL":this.setFlatness(a);break;case"Font":this.setFont(a[0],a[1]);break;case"CA":this.current.strokeAlpha=a;break;case"ca":this.current.fillAlpha=a,this.ctx.globalAlpha=a;break;case"BM":this.ctx.globalCompositeOperation=a;break;case"SMask":this.current.activeSMask=a?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(a)}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const e=this.ctx.canvas.width,t=this.ctx.canvas.height,a="smaskGroupAt"+this.groupLevel,n=this.cachedCanvases.getCanvas(a,e,t);this.suspendedCtx=this.ctx,this.ctx=n.context;const i=this.ctx;i.setTransform(...cve(this.suspendedCtx)),ube(this.suspendedCtx,i),function(e,t){if(e._removeMirroring)throw new Error("Context is already forwarding operations.");e.__originalSave=e.save,e.__originalRestore=e.restore,e.__originalRotate=e.rotate,e.__originalScale=e.scale,e.__originalTranslate=e.translate,e.__originalTransform=e.transform,e.__originalSetTransform=e.setTransform,e.__originalResetTransform=e.resetTransform,e.__originalClip=e.clip,e.__originalMoveTo=e.moveTo,e.__originalLineTo=e.lineTo,e.__originalBezierCurveTo=e.bezierCurveTo,e.__originalRect=e.rect,e.__originalClosePath=e.closePath,e.__originalBeginPath=e.beginPath,e._removeMirroring=()=>{e.save=e.__originalSave,e.restore=e.__originalRestore,e.rotate=e.__originalRotate,e.scale=e.__originalScale,e.translate=e.__originalTranslate,e.transform=e.__originalTransform,e.setTransform=e.__originalSetTransform,e.resetTransform=e.__originalResetTransform,e.clip=e.__originalClip,e.moveTo=e.__originalMoveTo,e.lineTo=e.__originalLineTo,e.bezierCurveTo=e.__originalBezierCurveTo,e.rect=e.__originalRect,e.closePath=e.__originalClosePath,e.beginPath=e.__originalBeginPath,delete e._removeMirroring},e.save=function(){t.save(),this.__originalSave()},e.restore=function(){t.restore(),this.__originalRestore()},e.translate=function(e,a){t.translate(e,a),this.__originalTranslate(e,a)},e.scale=function(e,a){t.scale(e,a),this.__originalScale(e,a)},e.transform=function(e,a,n,i,r,o){t.transform(e,a,n,i,r,o),this.__originalTransform(e,a,n,i,r,o)},e.setTransform=function(e,a,n,i,r,o){t.setTransform(e,a,n,i,r,o),this.__originalSetTransform(e,a,n,i,r,o)},e.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},e.rotate=function(e){t.rotate(e),this.__originalRotate(e)},e.clip=function(e){t.clip(e),this.__originalClip(e)},e.moveTo=function(e,a){t.moveTo(e,a),this.__originalMoveTo(e,a)},e.lineTo=function(e,a){t.lineTo(e,a),this.__originalLineTo(e,a)},e.bezierCurveTo=function(e,a,n,i,r,o){t.bezierCurveTo(e,a,n,i,r,o),this.__originalBezierCurveTo(e,a,n,i,r,o)},e.rect=function(e,a,n,i){t.rect(e,a,n,i),this.__originalRect(e,a,n,i)},e.closePath=function(){t.closePath(),this.__originalClosePath()},e.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}(i,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),ube(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(e){if(!this.current.activeSMask)return;e?(e[0]=Math.floor(e[0]),e[1]=Math.floor(e[1]),e[2]=Math.ceil(e[2]),e[3]=Math.ceil(e[3])):e=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const t=this.current.activeSMask,a=this.suspendedCtx;this.composeSMask(a,t,this.ctx,e),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(e,t,a,n){const i=n[0],r=n[1],o=n[2]-i,s=n[3]-r;0!==o&&0!==s&&(this.genericComposeSMask(t.context,a,o,s,t.subtype,t.backdrop,t.transferMap,i,r,t.offsetX,t.offsetY),e.save(),e.globalAlpha=1,e.globalCompositeOperation="source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(a.canvas,0,0),e.restore())}genericComposeSMask(e,t,a,n,i,r,o,s,l,c,u){let d=e.canvas,h=s-c,m=l-u;if(r){const t=Iye.makeHexColor(...r);if(h<0||m<0||h+a>d.width||m+n>d.height){const e=this.cachedCanvases.getCanvas("maskExtension",a,n),i=e.context;i.drawImage(d,-h,-m),i.globalCompositeOperation="destination-atop",i.fillStyle=t,i.fillRect(0,0,a,n),i.globalCompositeOperation="source-over",d=e.canvas,h=m=0}else{e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);const i=new Path2D;i.rect(h,m,a,n),e.clip(i),e.globalCompositeOperation="destination-atop",e.fillStyle=t,e.fillRect(h,m,a,n),e.restore()}}t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0),"Alpha"===i&&o?t.filter=this.filterFactory.addAlphaFilter(o):"Luminosity"===i&&(t.filter=this.filterFactory.addLuminosityFilter(o));const p=new Path2D;p.rect(s,l,a,n),t.clip(p),t.globalCompositeOperation="destination-in",t.drawImage(d,h,m,a,n,s,l,a,n),t.restore()}save(){this.inSMaskMode?(ube(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const e=this.current;this.stateStack.push(e),this.current=e.clone()}restore(){0===this.stateStack.length&&this.inSMaskMode&&this.endSMaskMode(),0!==this.stateStack.length&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),ube(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(e,t,a,n,i,r){this.ctx.transform(e,t,a,n,i,r),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,t,a){const n=this.ctx,i=this.current;let r,o,s=i.x,l=i.y;const c=cve(n),u=0===c[0]&&0===c[3]||0===c[1]&&0===c[2],d=u?a.slice(0):null;for(let a=0,h=0,m=e.length;a<m;a++)switch(0|e[a]){case cye.rectangle:s=t[h++],l=t[h++];const e=t[h++],a=t[h++],m=s+e,p=l+a;n.moveTo(s,l),0===e||0===a?n.lineTo(m,p):(n.lineTo(m,l),n.lineTo(m,p),n.lineTo(s,p)),u||i.updateRectMinMax(c,[s,l,m,p]),n.closePath();break;case cye.moveTo:s=t[h++],l=t[h++],n.moveTo(s,l),u||i.updatePathMinMax(c,s,l);break;case cye.lineTo:s=t[h++],l=t[h++],n.lineTo(s,l),u||i.updatePathMinMax(c,s,l);break;case cye.curveTo:r=s,o=l,s=t[h+4],l=t[h+5],n.bezierCurveTo(t[h],t[h+1],t[h+2],t[h+3],s,l),i.updateCurvePathMinMax(c,r,o,t[h],t[h+1],t[h+2],t[h+3],s,l,d),h+=6;break;case cye.curveTo2:r=s,o=l,n.bezierCurveTo(s,l,t[h],t[h+1],t[h+2],t[h+3]),i.updateCurvePathMinMax(c,r,o,s,l,t[h],t[h+1],t[h+2],t[h+3],d),s=t[h+2],l=t[h+3],h+=4;break;case cye.curveTo3:r=s,o=l,s=t[h+2],l=t[h+3],n.bezierCurveTo(t[h],t[h+1],s,l,s,l),i.updateCurvePathMinMax(c,r,o,t[h],t[h+1],s,l,s,l,d),h+=4;break;case cye.closePath:n.closePath()}u&&i.updateScalingPathMinMax(c,d),i.setCurrentPoint(s,l)}closePath(){this.ctx.closePath()}stroke(e=!0){const t=this.ctx,a=this.current.strokeColor;t.globalAlpha=this.current.strokeAlpha,this.contentVisible&&("object"==typeof a&&a?.getPattern?(t.save(),t.strokeStyle=a.getPattern(t,this,uve(t),Wve),this.rescaleAndStroke(!1),t.restore()):this.rescaleAndStroke(!0)),e&&this.consumePath(this.current.getClippedPathBoundingBox()),t.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(e=!0){const t=this.ctx,a=this.current.fillColor;let n=!1;this.current.patternFill&&(t.save(),t.fillStyle=a.getPattern(t,this,uve(t),Vve),n=!0);const i=this.current.getClippedPathBoundingBox();this.contentVisible&&null!==i&&(this.pendingEOFill?(t.fill("evenodd"),this.pendingEOFill=!1):t.fill()),n&&t.restore(),e&&this.consumePath(i)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=gbe}eoClip(){this.pendingClip=fbe}beginText(){this.current.textMatrix=yfe,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const e=this.pendingTextPaths,t=this.ctx;if(void 0!==e){t.save(),t.beginPath();for(const a of e)t.setTransform(...a.transform),t.translate(a.x,a.y),a.addToPath(t,a.fontSize);t.restore(),t.clip(),t.beginPath(),delete this.pendingTextPaths}else t.beginPath()}setCharSpacing(e){this.current.charSpacing=e}setWordSpacing(e){this.current.wordSpacing=e}setHScale(e){this.current.textHScale=e/100}setLeading(e){this.current.leading=-e}setFont(e,t){const a=this.commonObjs.get(e),n=this.current;if(!a)throw new Error(`Can't find font for ${e}`);if(n.fontMatrix=a.fontMatrix||vfe,0!==n.fontMatrix[0]&&0!==n.fontMatrix[3]||gye("Invalid font matrix for font "+e),t<0?(t=-t,n.fontDirection=-1):n.fontDirection=1,this.current.font=a,this.current.fontSize=t,a.isType3Font)return;const i=a.loadedName||"sans-serif",r=a.systemFontInfo?.css||`"${i}", ${a.fallbackName}`;let o="normal";a.black?o="900":a.bold&&(o="bold");const s=a.italic?"italic":"normal";let l=t;t<16?l=16:t>100&&(l=100),this.current.fontSizeScale=t/l,this.ctx.font=`${s} ${o} ${l}px ${r}`}setTextRenderingMode(e){this.current.textRenderingMode=e}setTextRise(e){this.current.textRise=e}moveText(e,t){this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=t}setLeadingMoveText(e,t){this.setLeading(-t),this.moveText(e,t)}setTextMatrix(e,t,a,n,i,r){this.current.textMatrix=[e,t,a,n,i,r],this.current.textMatrixScale=Math.hypot(e,t),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(e,t,a,n){const i=this.ctx,r=this.current,o=r.font,s=r.textRenderingMode,l=r.fontSize/r.fontSizeScale,c=s&zfe,u=!!(s&Rfe),d=r.patternFill&&!o.missingFile;let h;if((o.disableFontFace||u||d)&&(h=o.getPathGenerator(this.commonObjs,e)),o.disableFontFace||d?(i.save(),i.translate(t,a),i.beginPath(),h(i,l),n&&i.setTransform(...n),c!==Dfe&&c!==Nfe||i.fill(),c!==Ife&&c!==Nfe||i.stroke(),i.restore()):(c!==Dfe&&c!==Nfe||i.fillText(e,t,a),c!==Ife&&c!==Nfe||i.strokeText(e,t,a)),u){(this.pendingTextPaths||=[]).push({transform:cve(i),x:t,y:a,fontSize:l,addToPath:h})}}get isFontSubpixelAAEnabled(){const{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1),e.fillText("I",0,10);const t=e.getImageData(0,0,10,10).data;let a=!1;for(let e=3;e<t.length;e+=4)if(t[e]>0&&t[e]<255){a=!0;break}return bye(this,"isFontSubpixelAAEnabled",a)}showText(e){const t=this.current,a=t.font;if(a.isType3Font)return this.showType3Text(e);const n=t.fontSize;if(0===n)return;const i=this.ctx,r=t.fontSizeScale,o=t.charSpacing,s=t.wordSpacing,l=t.fontDirection,c=t.textHScale*l,u=e.length,d=a.vertical,h=d?1:-1,m=a.defaultVMetrics,p=n*t.fontMatrix[0],g=t.textRenderingMode===Dfe&&!a.disableFontFace&&!t.patternFill;let f;if(i.save(),i.transform(...t.textMatrix),i.translate(t.x,t.y+t.textRise),l>0?i.scale(c,-1):i.scale(c,1),t.patternFill){i.save();const e=t.fillColor.getPattern(i,this,uve(i),Vve);f=cve(i),i.restore(),i.fillStyle=e}let y=t.lineWidth;const v=t.textMatrixScale;if(0===v||0===y){const e=t.textRenderingMode&zfe;e!==Ife&&e!==Nfe||(y=this.getSinglePixelWidth())}else y/=v;if(1!==r&&(i.scale(r,r),y/=r),i.lineWidth=y,a.isInvalidPDFjsFont){const a=[];let n=0;for(const t of e)a.push(t.unicode),n+=t.width;return i.fillText(a.join(""),0,0),t.x+=n*p*c,i.restore(),void this.compose()}let b,w=0;for(b=0;b<u;++b){const t=e[b];if("number"==typeof t){w+=h*t*n/1e3;continue}let c=!1;const u=(t.isSpace?s:0)+o,y=t.fontChar,v=t.accent;let x,k,A=t.width;if(d){const e=t.vmetric||m,a=-(t.vmetric?e[1]:.5*A)*p,n=e[2]*p;A=e?-e[0]:A,x=a/r,k=(w+n)/r}else x=w/r,k=0;if(a.remeasure&&A>0){const e=1e3*i.measureText(y).width/n*r;if(A<e&&this.isFontSubpixelAAEnabled){const t=A/e;c=!0,i.save(),i.scale(t,1),x/=t}else A!==e&&(x+=(A-e)/2e3*n/r)}if(this.contentVisible&&(t.isInFont||a.missingFile))if(g&&!v)i.fillText(y,x,k);else if(this.paintChar(y,x,k,f),v){const e=x+n*v.offset.x/r,t=k-n*v.offset.y/r;this.paintChar(v.fontChar,e,t,f)}w+=d?A*p-u*l:A*p+u*l,c&&i.restore()}d?t.y-=w:t.x+=w*c,i.restore(),this.compose()}showType3Text(e){const t=this.ctx,a=this.current,n=a.font,i=a.fontSize,r=a.fontDirection,o=n.vertical?1:-1,s=a.charSpacing,l=a.wordSpacing,c=a.textHScale*r,u=a.fontMatrix||vfe,d=e.length;let h,m,p,g;if(!(a.textRenderingMode===jfe)&&0!==i){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,t.save(),t.transform(...a.textMatrix),t.translate(a.x,a.y),t.scale(c,r),h=0;h<d;++h){if(m=e[h],"number"==typeof m){g=o*m*i/1e3,this.ctx.translate(g,0),a.x+=g*c;continue}const r=(m.isSpace?l:0)+s,d=n.charProcOperatorList[m.operatorListId];if(!d){gye(`Type3 character "${m.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=m,this.save(),t.scale(i,i),t.transform(...u),this.executeOperatorList(d),this.restore());p=Iye.applyTransform([m.width,0],u)[0]*i+r,t.translate(p,0),a.x+=p*c}t.restore(),this.processingType3=null}}setCharWidth(e,t){}setCharWidthAndBounds(e,t,a,n,i,r){this.ctx.rect(a,n,i-a,r-n),this.ctx.clip(),this.endPath()}getColorN_Pattern(e){let t;if("TilingPattern"===e[0]){const a=e[1],n=this.baseTransform||cve(this.ctx),i={createCanvasGraphics:e=>new ybe(e,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};t=new abe(e,a,this.ctx,i,n)}else t=this._getPattern(e[1],e[2]);return t}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(e,t,a){this.ctx.strokeStyle=this.current.strokeColor=Iye.makeHexColor(e,t,a)}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent"}setFillRGBColor(e,t,a){this.ctx.fillStyle=this.current.fillColor=Iye.makeHexColor(e,t,a),this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(e,t=null){let a;return this.cachedPatterns.has(e)?a=this.cachedPatterns.get(e):(a=function(e){switch(e[0]){case"RadialAxial":return new Zve(e);case"Mesh":return new Qve(e);case"Dummy":return new Jve}throw new Error(`Unknown IR type: ${e[0]}`)}(this.getObject(e)),this.cachedPatterns.set(e,a)),t&&(a.matrix=t),a}shadingFill(e){if(!this.contentVisible)return;const t=this.ctx;this.save();const a=this._getPattern(e);t.fillStyle=a.getPattern(t,this,uve(t),$ve);const n=uve(t);if(n){const{width:e,height:a}=t.canvas,[i,r,o,s]=Iye.getAxialAlignedBoundingBox([0,0,e,a],n);this.ctx.fillRect(i,r,o-i,s-r)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){fye("Should not call beginInlineImage")}beginImageData(){fye("Should not call beginImageData")}paintFormXObjectBegin(e,t){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),e&&this.transform(...e),this.baseTransform=cve(this.ctx),t)){const e=t[2]-t[0],a=t[3]-t[1];this.ctx.rect(t[0],t[1],e,a),this.current.updateRectMinMax(cve(this.ctx),t),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const t=this.ctx;e.isolated||pye("TODO: Support non-isolated groups."),e.knockout&&gye("Knockout groups not supported.");const a=cve(t);if(e.matrix&&t.transform(...e.matrix),!e.bbox)throw new Error("Bounding box is required.");let n=Iye.getAxialAlignedBoundingBox(e.bbox,cve(t));const i=[0,0,t.canvas.width,t.canvas.height];n=Iye.intersect(n,i)||[0,0,0,0];const r=Math.floor(n[0]),o=Math.floor(n[1]),s=Math.max(Math.ceil(n[2])-r,1),l=Math.max(Math.ceil(n[3])-o,1);this.current.startNewPathAndClipBox([0,0,s,l]);let c="groupAt"+this.groupLevel;e.smask&&(c+="_smask_"+this.smaskCounter++%2);const u=this.cachedCanvases.getCanvas(c,s,l),d=u.context;d.translate(-r,-o),d.transform(...a),e.smask?this.smaskStack.push({canvas:u.canvas,context:d,offsetX:r,offsetY:o,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}):(t.setTransform(1,0,0,1,0,0),t.translate(r,o),t.save()),ube(t,d),this.ctx=d,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(t),this.groupLevel++}endGroup(e){if(!this.contentVisible)return;this.groupLevel--;const t=this.ctx,a=this.groupStack.pop();if(this.ctx=a,this.ctx.imageSmoothingEnabled=!1,e.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const e=cve(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...e);const a=Iye.getAxialAlignedBoundingBox([0,0,t.canvas.width,t.canvas.height],e);this.ctx.drawImage(t.canvas,0,0),this.ctx.restore(),this.compose(a)}}beginAnnotation(e,t,a,n,i){if(this.#zt(),dbe(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),t){const n=t[2]-t[0],r=t[3]-t[1];if(i&&this.annotationCanvasMap){(a=a.slice())[4]-=t[0],a[5]-=t[1],(t=t.slice())[0]=t[1]=0,t[2]=n,t[3]=r;const[i,o]=Iye.singularValueDecompose2dScale(cve(this.ctx)),{viewportScale:s}=this,l=Math.ceil(n*this.outputScaleX*s),c=Math.ceil(r*this.outputScaleY*s);this.annotationCanvas=this.canvasFactory.create(l,c);const{canvas:u,context:d}=this.annotationCanvas;this.annotationCanvasMap.set(e,u),this.annotationCanvas.savedCtx=this.ctx,this.ctx=d,this.ctx.save(),this.ctx.setTransform(i,0,0,-o,0,r*o),dbe(this.ctx)}else dbe(this.ctx),this.endPath(),this.ctx.rect(t[0],t[1],n,r),this.ctx.clip(),this.ctx.beginPath()}this.current=new sbe(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...a),this.transform(...n)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#Rt(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(e){if(!this.contentVisible)return;const t=e.count;(e=this.getObject(e.data,e)).count=t;const a=this.ctx,n=this.processingType3;if(n&&(void 0===n.compiled&&(n.compiled=function(e){const{width:t,height:a}=e;if(t>1e3||a>1e3)return null;const n=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),i=t+1;let r,o,s,l=new Uint8Array(i*(a+1));const c=t+7&-8;let u=new Uint8Array(c*a),d=0;for(const t of e.data){let e=128;for(;e>0;)u[d++]=t&e?0:255,e>>=1}let h=0;for(d=0,0!==u[d]&&(l[0]=1,++h),o=1;o<t;o++)u[d]!==u[d+1]&&(l[o]=u[d]?2:1,++h),d++;for(0!==u[d]&&(l[o]=2,++h),r=1;r<a;r++){d=r*c,s=r*i,u[d-c]!==u[d]&&(l[s]=u[d]?1:8,++h);let e=(u[d]?4:0)+(u[d-c]?8:0);for(o=1;o<t;o++)e=(e>>2)+(u[d+1]?4:0)+(u[d-c+1]?8:0),n[e]&&(l[s+o]=n[e],++h),d++;if(u[d-c]!==u[d]&&(l[s+o]=u[d]?2:4,++h),h>1e3)return null}for(d=c*(a-1),s=r*i,0!==u[d]&&(l[s]=8,++h),o=1;o<t;o++)u[d]!==u[d+1]&&(l[s+o]=u[d]?4:8,++h),d++;if(0!==u[d]&&(l[s+o]=4,++h),h>1e3)return null;const m=new Int32Array([0,i,-1,0,-i,0,0,0,1]),p=new Path2D;for(r=0;h&&r<=a;r++){let e=r*i;const a=e+t;for(;e<a&&!l[e];)e++;if(e===a)continue;p.moveTo(e%i,r);const n=e;let o=l[e];do{const t=m[o];do{e+=t}while(!l[e]);const a=l[e];5!==a&&10!==a?(o=a,l[e]=0):(o=a&51*o>>4,l[e]&=o>>2|o<<2),p.lineTo(e%i,e/i|0),l[e]||--h}while(n!==e);--r}return u=null,l=null,function(e){e.save(),e.scale(1/t,-1/a),e.translate(0,-a),e.fill(p),e.beginPath(),e.restore()}}(e)),n.compiled))return void n.compiled(a);const i=this._createMaskCanvas(e),r=i.canvas;a.save(),a.setTransform(1,0,0,1,0,0),a.drawImage(r,i.offsetX,i.offsetY),a.restore(),this.compose()}paintImageMaskXObjectRepeat(e,t,a=0,n=0,i,r){if(!this.contentVisible)return;e=this.getObject(e.data,e);const o=this.ctx;o.save();const s=cve(o);o.transform(t,a,n,i,0,0);const l=this._createMaskCanvas(e);o.setTransform(1,0,0,1,l.offsetX-s[4],l.offsetY-s[5]);for(let e=0,c=r.length;e<c;e+=2){const c=Iye.transform(s,[t,a,n,i,r[e],r[e+1]]),[u,d]=Iye.applyTransform([0,0],c);o.drawImage(l.canvas,u,d)}o.restore(),this.compose()}paintImageMaskXObjectGroup(e){if(!this.contentVisible)return;const t=this.ctx,a=this.current.fillColor,n=this.current.patternFill;for(const i of e){const{data:e,width:r,height:o,transform:s}=i,l=this.cachedCanvases.getCanvas("maskCanvas",r,o),c=l.context;c.save();cbe(c,this.getObject(e,i)),c.globalCompositeOperation="source-in",c.fillStyle=n?a.getPattern(c,this,uve(t),Vve):a,c.fillRect(0,0,r,o),c.restore(),t.save(),t.transform(...s),t.scale(1,-1),obe(t,l.canvas,0,0,r,o,0,-1,1,1),t.restore()}this.compose()}paintImageXObject(e){if(!this.contentVisible)return;const t=this.getObject(e);t?this.paintInlineImageXObject(t):gye("Dependent image isn't ready yet")}paintImageXObjectRepeat(e,t,a,n){if(!this.contentVisible)return;const i=this.getObject(e);if(!i)return void gye("Dependent image isn't ready yet");const r=i.width,o=i.height,s=[];for(let e=0,i=n.length;e<i;e+=2)s.push({transform:[t,0,0,a,n[e],n[e+1]],x:0,y:0,w:r,h:o});this.paintInlineImageXObjectGroup(i,s)}applyTransferMapsToCanvas(e){return"none"!==this.current.transferMaps&&(e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter="none"),e.canvas}applyTransferMapsToBitmap(e){if("none"===this.current.transferMaps)return e.bitmap;const{bitmap:t,width:a,height:n}=e,i=this.cachedCanvases.getCanvas("inlineImage",a,n),r=i.context;return r.filter=this.current.transferMaps,r.drawImage(t,0,0),r.filter="none",i.canvas}paintInlineImageXObject(e){if(!this.contentVisible)return;const t=e.width,a=e.height,n=this.ctx;if(this.save(),!ffe){const{filter:e}=n;"none"!==e&&""!==e&&(n.filter="none")}let i;if(n.scale(1/t,-1/a),e.bitmap)i=this.applyTransferMapsToBitmap(e);else if("function"==typeof HTMLElement&&e instanceof HTMLElement||!e.data)i=e;else{const n=this.cachedCanvases.getCanvas("inlineImage",t,a).context;lbe(n,e),i=this.applyTransferMapsToCanvas(n)}const r=this._scaleImage(i,uve(n));n.imageSmoothingEnabled=hbe(cve(n),e.interpolate),obe(n,r.img,0,0,r.paintWidth,r.paintHeight,0,-a,t,a),this.compose(),this.restore()}paintInlineImageXObjectGroup(e,t){if(!this.contentVisible)return;const a=this.ctx;let n;if(e.bitmap)n=e.bitmap;else{const t=e.width,a=e.height,i=this.cachedCanvases.getCanvas("inlineImage",t,a).context;lbe(i,e),n=this.applyTransferMapsToCanvas(i)}for(const e of t)a.save(),a.transform(...e.transform),a.scale(1,-1),obe(a,n,e.x,e.y,e.w,e.h,0,-1,1,1),a.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(e){}markPointProps(e,t){}beginMarkedContent(e){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,t){"OC"===e?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(t)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(e){const t=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(e);const a=this.ctx;this.pendingClip&&(t||(this.pendingClip===fbe?a.clip("evenodd"):a.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),a.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=cve(this.ctx);if(0===e[1]&&0===e[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{const t=Math.abs(e[0]*e[3]-e[2]*e[1]),a=Math.hypot(e[0],e[2]),n=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(a,n)/t}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(-1===this._cachedScaleForStroking[0]){const{lineWidth:e}=this.current,{a:t,b:a,c:n,d:i}=this.ctx.getTransform();let r,o;if(0===a&&0===n){const a=Math.abs(t),n=Math.abs(i);if(a===n)if(0===e)r=o=1/a;else{const t=a*e;r=o=t<1?1/t:1}else if(0===e)r=1/a,o=1/n;else{const t=a*e,i=n*e;r=t<1?1/t:1,o=i<1?1/i:1}}else{const s=Math.abs(t*i-a*n),l=Math.hypot(t,a),c=Math.hypot(n,i);if(0===e)r=c/s,o=l/s;else{const t=e*s;r=c>t?c/t:1,o=l>t?l/t:1}}this._cachedScaleForStroking[0]=r,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(e){const{ctx:t}=this,{lineWidth:a}=this.current,[n,i]=this.getScaleForStroking();if(t.lineWidth=a||1,1===n&&1===i)return void t.stroke();const r=t.getLineDash();if(e&&t.save(),t.scale(n,i),r.length>0){const e=Math.max(n,i);t.setLineDash(r.map((t=>t/e))),t.lineDashOffset/=e}t.stroke(),e&&t.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}}for(const e in cye)void 0!==ybe.prototype[e]&&(ybe.prototype[cye[e]]=ybe.prototype[e]);class vbe{static#Lt=null;static#Ft="";static get workerPort(){return this.#Lt}static set workerPort(e){if(!("undefined"!=typeof Worker&&e instanceof Worker)&&null!==e)throw new Error("Invalid `workerPort` type.");this.#Lt=e}static get workerSrc(){return this.#Ft}static set workerSrc(e){if("string"!=typeof e)throw new Error("Invalid `workerSrc` type.");this.#Ft=e}}const bbe=1,wbe=2,xbe=1,kbe=2,Abe=3,Sbe=4,Ebe=5,_be=6,Cbe=7,Tbe=8;function Pbe(e){switch(e instanceof Error||"object"==typeof e&&null!==e||fye('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),e.name){case"AbortException":return new Cye(e.message);case"MissingPDFException":return new Sye(e.message);case"PasswordException":return new xye(e.message,e.code);case"UnexpectedResponseException":return new Eye(e.message,e.status);case"UnknownErrorException":return new kye(e.message,e.details);default:return new kye(e.message,e.toString())}}class Obe{#Bt=new AbortController;constructor(e,t,a){this.sourceName=e,this.targetName=t,this.comObj=a,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),a.addEventListener("message",this.#Ht.bind(this),{signal:this.#Bt.signal})}#Ht({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream)return void this.#qt(e);if(e.callback){const t=e.callbackId,a=this.callbackCapabilities[t];if(!a)throw new Error(`Cannot resolve callback ${t}`);if(delete this.callbackCapabilities[t],e.callback===bbe)a.resolve(e.data);else{if(e.callback!==wbe)throw new Error("Unexpected callback case");a.reject(Pbe(e.reason))}return}const t=this.actionHandler[e.action];if(!t)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const a=this.sourceName,n=e.sourceName,i=this.comObj;new Promise((function(a){a(t(e.data))})).then((function(t){i.postMessage({sourceName:a,targetName:n,callback:bbe,callbackId:e.callbackId,data:t})}),(function(t){i.postMessage({sourceName:a,targetName:n,callback:wbe,callbackId:e.callbackId,reason:Pbe(t)})}))}else e.streamId?this.#Ut(e):t(e.data)}on(e,t){const a=this.actionHandler;if(a[e])throw new Error(`There is already an actionName called "${e}"`);a[e]=t}send(e,t,a){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},a)}sendWithPromise(e,t,a){const n=this.callbackId++,i=Promise.withResolvers();this.callbackCapabilities[n]=i;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:n,data:t},a)}catch(e){i.reject(e)}return i.promise}sendWithStream(e,t,a,n){const i=this.streamId++,r=this.sourceName,o=this.targetName,s=this.comObj;return new ReadableStream({start:a=>{const l=Promise.withResolvers();return this.streamControllers[i]={controller:a,startCall:l,pullCall:null,cancelCall:null,isClosed:!1},s.postMessage({sourceName:r,targetName:o,action:e,streamId:i,data:t,desiredSize:a.desiredSize},n),l.promise},pull:e=>{const t=Promise.withResolvers();return this.streamControllers[i].pullCall=t,s.postMessage({sourceName:r,targetName:o,stream:_be,streamId:i,desiredSize:e.desiredSize}),t.promise},cancel:e=>{yye(e instanceof Error,"cancel must have a valid reason");const t=Promise.withResolvers();return this.streamControllers[i].cancelCall=t,this.streamControllers[i].isClosed=!0,s.postMessage({sourceName:r,targetName:o,stream:xbe,streamId:i,reason:Pbe(e)}),t.promise}},a)}#Ut(e){const t=e.streamId,a=this.sourceName,n=e.sourceName,i=this.comObj,r=this,o=this.actionHandler[e.action],s={enqueue(e,r=1,o){if(this.isCancelled)return;const s=this.desiredSize;this.desiredSize-=r,s>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),i.postMessage({sourceName:a,targetName:n,stream:Sbe,streamId:t,chunk:e},o)},close(){this.isCancelled||(this.isCancelled=!0,i.postMessage({sourceName:a,targetName:n,stream:Abe,streamId:t}),delete r.streamSinks[t])},error(e){yye(e instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,i.postMessage({sourceName:a,targetName:n,stream:Ebe,streamId:t,reason:Pbe(e)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};s.sinkCapability.resolve(),s.ready=s.sinkCapability.promise,this.streamSinks[t]=s,new Promise((function(t){t(o(e.data,s))})).then((function(){i.postMessage({sourceName:a,targetName:n,stream:Tbe,streamId:t,success:!0})}),(function(e){i.postMessage({sourceName:a,targetName:n,stream:Tbe,streamId:t,reason:Pbe(e)})}))}#qt(e){const t=e.streamId,a=this.sourceName,n=e.sourceName,i=this.comObj,r=this.streamControllers[t],o=this.streamSinks[t];switch(e.stream){case Tbe:e.success?r.startCall.resolve():r.startCall.reject(Pbe(e.reason));break;case Cbe:e.success?r.pullCall.resolve():r.pullCall.reject(Pbe(e.reason));break;case _be:if(!o){i.postMessage({sourceName:a,targetName:n,stream:Cbe,streamId:t,success:!0});break}o.desiredSize<=0&&e.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=e.desiredSize,new Promise((function(e){e(o.onPull?.())})).then((function(){i.postMessage({sourceName:a,targetName:n,stream:Cbe,streamId:t,success:!0})}),(function(e){i.postMessage({sourceName:a,targetName:n,stream:Cbe,streamId:t,reason:Pbe(e)})}));break;case Sbe:if(yye(r,"enqueue should have stream controller"),r.isClosed)break;r.controller.enqueue(e.chunk);break;case Abe:if(yye(r,"close should have stream controller"),r.isClosed)break;r.isClosed=!0,r.controller.close(),this.#Vt(r,t);break;case Ebe:yye(r,"error should have stream controller"),r.controller.error(Pbe(e.reason)),this.#Vt(r,t);break;case kbe:e.success?r.cancelCall.resolve():r.cancelCall.reject(Pbe(e.reason)),this.#Vt(r,t);break;case xbe:if(!o)break;new Promise((function(t){t(o.onCancel?.(Pbe(e.reason)))})).then((function(){i.postMessage({sourceName:a,targetName:n,stream:kbe,streamId:t,success:!0})}),(function(e){i.postMessage({sourceName:a,targetName:n,stream:kbe,streamId:t,reason:Pbe(e)})})),o.sinkCapability.reject(Pbe(e.reason)),o.isCancelled=!0,delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}}async#Vt(e,t){await Promise.allSettled([e.startCall?.promise,e.pullCall?.promise,e.cancelCall?.promise]),delete this.streamControllers[t]}destroy(){this.#Bt?.abort(),this.#Bt=null}}class Mbe{#Wt;#$t;constructor({parsedData:e,rawData:t}){this.#Wt=e,this.#$t=t}getRaw(){return this.#$t}get(e){return this.#Wt.get(e)??null}getAll(){return Oye(this.#Wt)}has(e){return this.#Wt.has(e)}}const Dbe=Symbol("INTERNAL");class Ibe{#Gt=!1;#Kt=!1;#Zt=!1;#Yt=!0;constructor(e,{name:t,intent:a,usage:n,rbGroups:i}){this.#Gt=!!(e&xfe),this.#Kt=!!(e&kfe),this.name=t,this.intent=a,this.usage=n,this.rbGroups=i}get visible(){if(this.#Zt)return this.#Yt;if(!this.#Yt)return!1;const{print:e,view:t}=this.usage;return this.#Gt?"OFF"!==t?.viewState:!this.#Kt||"OFF"!==e?.printState}_setVisible(e,t,a=!1){e!==Dbe&&fye("Internal method `_setVisible` called."),this.#Zt=a,this.#Yt=t}}class Nbe{#Xt=null;#Qt=new Map;#Jt=null;#ea=null;constructor(e,t=xfe){if(this.renderingIntent=t,this.name=null,this.creator=null,null!==e){this.name=e.name,this.creator=e.creator,this.#ea=e.order;for(const a of e.groups)this.#Qt.set(a.id,new Ibe(t,a));if("OFF"===e.baseState)for(const e of this.#Qt.values())e._setVisible(Dbe,!1);for(const t of e.on)this.#Qt.get(t)._setVisible(Dbe,!0);for(const t of e.off)this.#Qt.get(t)._setVisible(Dbe,!1);this.#Jt=this.getHash()}}#ta(e){const t=e.length;if(t<2)return!0;const a=e[0];for(let n=1;n<t;n++){const t=e[n];let i;if(Array.isArray(t))i=this.#ta(t);else{if(!this.#Qt.has(t))return gye(`Optional content group not found: ${t}`),!0;i=this.#Qt.get(t).visible}switch(a){case"And":if(!i)return!1;break;case"Or":if(i)return!0;break;case"Not":return!i;default:return!0}}return"And"===a}isVisible(e){if(0===this.#Qt.size)return!0;if(!e)return pye("Optional content group not defined."),!0;if("OCG"===e.type)return this.#Qt.has(e.id)?this.#Qt.get(e.id).visible:(gye(`Optional content group not found: ${e.id}`),!0);if("OCMD"===e.type){if(e.expression)return this.#ta(e.expression);if(!e.policy||"AnyOn"===e.policy){for(const t of e.ids){if(!this.#Qt.has(t))return gye(`Optional content group not found: ${t}`),!0;if(this.#Qt.get(t).visible)return!0}return!1}if("AllOn"===e.policy){for(const t of e.ids){if(!this.#Qt.has(t))return gye(`Optional content group not found: ${t}`),!0;if(!this.#Qt.get(t).visible)return!1}return!0}if("AnyOff"===e.policy){for(const t of e.ids){if(!this.#Qt.has(t))return gye(`Optional content group not found: ${t}`),!0;if(!this.#Qt.get(t).visible)return!0}return!1}if("AllOff"===e.policy){for(const t of e.ids){if(!this.#Qt.has(t))return gye(`Optional content group not found: ${t}`),!0;if(this.#Qt.get(t).visible)return!1}return!0}return gye(`Unknown optional content policy ${e.policy}.`),!0}return gye(`Unknown group type ${e.type}.`),!0}setVisibility(e,t=!0,a=!0){const n=this.#Qt.get(e);if(n){if(a&&t&&n.rbGroups.length)for(const t of n.rbGroups)for(const a of t)a!==e&&this.#Qt.get(a)?._setVisible(Dbe,!1,!0);n._setVisible(Dbe,!!t,!0),this.#Xt=null}else gye(`Optional content group not found: ${e}`)}setOCGState({state:e,preserveRB:t}){let a;for(const n of e){switch(n){case"ON":case"OFF":case"Toggle":a=n;continue}const e=this.#Qt.get(n);if(e)switch(a){case"ON":this.setVisibility(n,!0,t);break;case"OFF":this.setVisibility(n,!1,t);break;case"Toggle":this.setVisibility(n,!e.visible,t)}}this.#Xt=null}get hasInitialVisibility(){return null===this.#Jt||this.getHash()===this.#Jt}getOrder(){return this.#Qt.size?this.#ea?this.#ea.slice():[...this.#Qt.keys()]:null}getGroups(){return this.#Qt.size>0?Oye(this.#Qt):null}getGroup(e){return this.#Qt.get(e)||null}getHash(){if(null!==this.#Xt)return this.#Xt;const e=new Tve;for(const[t,a]of this.#Qt)e.update(`${t}:${a.visible}`);return this.#Xt=e.hexdigest()}}class jbe{constructor(e,{disableRange:t=!1,disableStream:a=!1}){yye(e,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:n,initialData:i,progressiveDone:r,contentDispositionFilename:o}=e;if(this._queuedChunks=[],this._progressiveDone=r,this._contentDispositionFilename=o,i?.length>0){const e=i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer;this._queuedChunks.push(e)}this._pdfDataRangeTransport=e,this._isStreamingSupported=!a,this._isRangeSupported=!t,this._contentLength=n,this._fullRequestReader=null,this._rangeReaders=[],e.addRangeListener(((e,t)=>{this._onReceiveData({begin:e,chunk:t})})),e.addProgressListener(((e,t)=>{this._onProgress({loaded:e,total:t})})),e.addProgressiveReadListener((e=>{this._onReceiveData({chunk:e})})),e.addProgressiveDoneListener((()=>{this._onProgressiveDone()})),e.transportReady()}_onReceiveData({begin:e,chunk:t}){const a=t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer;if(void 0===e)this._fullRequestReader?this._fullRequestReader._enqueue(a):this._queuedChunks.push(a);else{yye(this._rangeReaders.some((function(t){return t._begin===e&&(t._enqueue(a),!0)})),"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(e){void 0===e.total?this._rangeReaders[0]?.onProgress?.({loaded:e.loaded}):this._fullRequestReader?.onProgress?.({loaded:e.loaded,total:e.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){const t=this._rangeReaders.indexOf(e);t>=0&&this._rangeReaders.splice(t,1)}getFullReader(){yye(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;return this._queuedChunks=null,new zbe(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const a=new Rbe(this,e,t);return this._pdfDataRangeTransport.requestDataRange(e,t),this._rangeReaders.push(a),a}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeReaders.slice(0))t.cancel(e);this._pdfDataRangeTransport.abort()}}class zbe{constructor(e,t,a=!1,n=null){this._stream=e,this._done=a||!1,this._filename=Jye(n)?n:null,this._queuedChunks=t||[],this._loaded=0;for(const e of this._queuedChunks)this._loaded+=e.byteLength;this._requests=[],this._headersReady=Promise.resolve(),e._fullRequestReader=this,this.onProgress=null}_enqueue(e){if(!this._done){if(this._requests.length>0){this._requests.shift().resolve({value:e,done:!1})}else this._queuedChunks.push(e);this._loaded+=e.byteLength}}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0){return{value:this._queuedChunks.shift(),done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class Rbe{constructor(e,t,a){this._stream=e,this._begin=t,this._end=a,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(e){if(!this._done){if(0===this._requests.length)this._queuedChunk=e;else{this._requests.shift().resolve({value:e,done:!1});for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function Lbe(e,t){const a=new Headers;if(!e||!t||"object"!=typeof t)return a;for(const e in t){const n=t[e];void 0!==n&&a.append(e,n)}return a}function Fbe({responseHeaders:e,isHttp:t,rangeChunkSize:a,disableRange:n}){const i={allowRangeRequests:!1,suggestedLength:void 0},r=parseInt(e.get("Content-Length"),10);if(!Number.isInteger(r))return i;if(i.suggestedLength=r,r<=2*a)return i;if(n||!t)return i;if("bytes"!==e.get("Accept-Ranges"))return i;return"identity"!==(e.get("Content-Encoding")||"identity")||(i.allowRangeRequests=!0),i}function Bbe(e){const t=e.get("Content-Disposition");if(t){let e=function(e){let t=!0,a=n("filename\\*","i").exec(e);if(a){a=a[1];let e=o(a);return e=unescape(e),e=s(e),e=l(e),r(e)}if(a=function(e){const t=[];let a;const i=n("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(a=i.exec(e));){let[,e,n,i]=a;if(e=parseInt(e,10),e in t){if(0===e)break}else t[e]=[n,i]}const r=[];for(let e=0;e<t.length&&e in t;++e){let[a,n]=t[e];n=o(n),a&&(n=unescape(n),0===e&&(n=s(n))),r.push(n)}return r.join("")}(e),a)return r(l(a));if(a=n("filename","i").exec(e),a){a=a[1];let e=o(a);return e=l(e),r(e)}function n(e,t){return new RegExp("(?:^|;)\\s*"+e+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',t)}function i(e,a){if(e){if(!/^[\x00-\xFF]+$/.test(a))return a;try{const n=new TextDecoder(e,{fatal:!0}),i=Pye(a);a=n.decode(i),t=!1}catch{}}return a}function r(e){return t&&/[\x80-\xff]/.test(e)&&(e=i("utf-8",e),t&&(e=i("iso-8859-1",e))),e}function o(e){if(e.startsWith('"')){const t=e.slice(1).split('\\"');for(let e=0;e<t.length;++e){const a=t[e].indexOf('"');-1!==a&&(t[e]=t[e].slice(0,a),t.length=e+1),t[e]=t[e].replaceAll(/\\(.)/g,"$1")}e=t.join('"')}return e}function s(e){const t=e.indexOf("'");return-1===t?e:i(e.slice(0,t),e.slice(t+1).replace(/^[^']*'/,""))}function l(e){return!e.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(e)?e:e.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,(function(e,t,a,n){if("q"===a||"Q"===a)return n=(n=n.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,(function(e,t){return String.fromCharCode(parseInt(t,16))})),i(t,n);try{n=atob(n)}catch{}return i(t,n)}))}return""}(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if(Jye(e))return e}return null}function Hbe(e,t){return 404===e||0===e&&t.startsWith("file:")?new Sye('Missing PDF "'+t+'".'):new Eye(`Unexpected server response (${e}) while retrieving PDF "${t}".`,e)}function qbe(e){return 200===e||206===e}function Ube(e,t,a){return{method:"GET",headers:e,signal:a.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function Vbe(e){return e instanceof Uint8Array?e.buffer:e instanceof ArrayBuffer?e:(gye(`getArrayBuffer - unexpected data format: ${e}`),new Uint8Array(e).buffer)}class Wbe{constructor(e){this.source=e,this.isHttp=/^https?:/i.test(e.url),this.headers=Lbe(this.isHttp,e.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return yye(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new $be(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const a=new Gbe(this,e,t);return this._rangeRequestReaders.push(a),a}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}}class $be{constructor(e){this._stream=e,this._reader=null,this._loaded=0,this._filename=null;const t=e.source;this._withCredentials=t.withCredentials||!1,this._contentLength=t.length,this._headersCapability=Promise.withResolvers(),this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange;const a=new Headers(e.headers),n=t.url;fetch(n,Ube(a,this._withCredentials,this._abortController)).then((t=>{if(!qbe(t.status))throw Hbe(t.status,n);this._reader=t.body.getReader(),this._headersCapability.resolve();const a=t.headers,{allowRangeRequests:i,suggestedLength:r}=Fbe({responseHeaders:a,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=i,this._contentLength=r||this._contentLength,this._filename=Bbe(a),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Cye("Streaming is disabled."))})).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._headersCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:Vbe(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}class Gbe{constructor(e,t,a){this._stream=e,this._reader=null,this._loaded=0;const n=e.source;this._withCredentials=n.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!n.disableStream,this._abortController=new AbortController;const i=new Headers(e.headers);i.append("Range",`bytes=${t}-${a-1}`);const r=n.url;fetch(r,Ube(i,this._withCredentials,this._abortController)).then((e=>{if(!qbe(e.status))throw Hbe(e.status,r);this._readCapability.resolve(),this._reader=e.body.getReader()})).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded}),{value:Vbe(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}class Kbe{constructor({url:e,httpHeaders:t,withCredentials:a}){this.url=e,this.isHttp=/^https?:/i.test(e),this.headers=Lbe(this.isHttp,t),this.withCredentials=a||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(e,t,a){const n={begin:e,end:t};for(const e in a)n[e]=a[e];return this.request(n)}requestFull(e){return this.request(e)}request(e){const t=new XMLHttpRequest,a=this.currXhrId++,n=this.pendingRequests[a]={xhr:t};t.open("GET",this.url),t.withCredentials=this.withCredentials;for(const[e,a]of this.headers)t.setRequestHeader(e,a);return this.isHttp&&"begin"in e&&"end"in e?(t.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),n.expectedStatus=206):n.expectedStatus=200,t.responseType="arraybuffer",e.onError&&(t.onerror=function(a){e.onError(t.status)}),t.onreadystatechange=this.onStateChange.bind(this,a),t.onprogress=this.onProgress.bind(this,a),n.onHeadersReceived=e.onHeadersReceived,n.onDone=e.onDone,n.onError=e.onError,n.onProgress=e.onProgress,t.send(null),a}onProgress(e,t){const a=this.pendingRequests[e];a&&a.onProgress?.(t)}onStateChange(e,t){const a=this.pendingRequests[e];if(!a)return;const n=a.xhr;if(n.readyState>=2&&a.onHeadersReceived&&(a.onHeadersReceived(),delete a.onHeadersReceived),4!==n.readyState)return;if(!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],0===n.status&&this.isHttp)return void a.onError?.(n.status);const i=n.status||200;if(!(200===i&&206===a.expectedStatus)&&i!==a.expectedStatus)return void a.onError?.(n.status);const r=function(e){const t=e.response;return"string"!=typeof t?t:Pye(t).buffer}(n);if(206===i){const e=n.getResponseHeader("Content-Range"),t=/bytes (\d+)-(\d+)\/(\d+)/.exec(e);a.onDone({begin:parseInt(t[1],10),chunk:r})}else r?a.onDone({begin:0,chunk:r}):a.onError?.(n.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){const t=this.pendingRequests[e].xhr;delete this.pendingRequests[e],t.abort()}}class Zbe{constructor(e){this._source=e,this._manager=new Kbe(e),this._rangeChunkSize=e.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(e){const t=this._rangeRequestReaders.indexOf(e);t>=0&&this._rangeRequestReaders.splice(t,1)}getFullReader(){return yye(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new Ybe(this._manager,this._source),this._fullRequestReader}getRangeReader(e,t){const a=new Xbe(this._manager,e,t);return a.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(a),a}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}}class Ybe{constructor(e,t){this._manager=e;const a={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._fullRequestId=e.requestFull(a),this._headersCapability=Promise.withResolvers(),this._disableRange=t.disableRange||!1,this._contentLength=t.length,this._rangeChunkSize=t.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const e=this._fullRequestId,t=this._manager.getRequestXhr(e),a=new Headers(t.getAllResponseHeaders().trim().split(/[\r\n]+/).map((e=>{const[t,...a]=e.split(": ");return[t,a.join(": ")]}))),{allowRangeRequests:n,suggestedLength:i}=Fbe({responseHeaders:a,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});n&&(this._isRangeSupported=!0),this._contentLength=i||this._contentLength,this._filename=Bbe(a),this._isRangeSupported&&this._manager.abortRequest(e),this._headersCapability.resolve()}_onDone(e){if(e)if(this._requests.length>0){this._requests.shift().resolve({value:e.chunk,done:!1})}else this._cachedChunks.push(e.chunk);if(this._done=!0,!(this._cachedChunks.length>0)){for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(e){this._storedError=Hbe(e,this._url),this._headersCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0){return{value:this._cachedChunks.shift(),done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersCapability.reject(e);for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class Xbe{constructor(e,t,a){this._manager=e;const n={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._requestId=e.requestRange(t,a,n),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){this.onClosed?.(this)}_onDone(e){const t=e.chunk;if(this._requests.length>0){this._requests.shift().resolve({value:t,done:!1})}else this._queuedChunk=t;this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(e){this._storedError=Hbe(e,this._url);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){this.isStreamingSupported||this.onProgress?.({loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const Qbe=/^[a-z][a-z0-9\-+.]+:/i;function Jbe(e,t,a){if("http:"===e.protocol){return qve.get("http").request(e,{headers:t},a)}return qve.get("https").request(e,{headers:t},a)}class ewe{constructor(e){this.source=e,this.url=function(e){if(Qbe.test(e))return new URL(e);const t=qve.get("url");return new URL(t.pathToFileURL(e))}(e.url),this.isHttp="http:"===this.url.protocol||"https:"===this.url.protocol,this.isFsUrl="file:"===this.url.protocol,this.headers=Lbe(this.isHttp,e.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return yye(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new rwe(this):new nwe(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const a=this.isFsUrl?new owe(this,e,t):new iwe(this,e,t);return this._rangeRequestReaders.push(a),a}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}}class twe{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null;const t=e.source;this._contentLength=t.length,this._loaded=0,this._filename=null,this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers()}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();if(null===e)return this._readCapability=Promise.withResolvers(),this.read();this._loaded+=e.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength});return{value:new Uint8Array(e).buffer,done:!1}}cancel(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",(()=>{this._readCapability.resolve()})),e.on("end",(()=>{e.destroy(),this._done=!0,this._readCapability.resolve()})),e.on("error",(e=>{this._error(e)})),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new Cye("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class awe{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const t=e.source;this._isStreamingSupported=!t.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();if(null===e)return this._readCapability=Promise.withResolvers(),this.read();this._loaded+=e.length,this.onProgress?.({loaded:this._loaded});return{value:new Uint8Array(e).buffer,done:!1}}cancel(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",(()=>{this._readCapability.resolve()})),e.on("end",(()=>{e.destroy(),this._done=!0,this._readCapability.resolve()})),e.on("error",(e=>{this._error(e)})),this._storedError&&this._readableStream.destroy(this._storedError)}}class nwe extends twe{constructor(e){super(e);const t=Object.fromEntries(e.headers);this._request=Jbe(this._url,t,(t=>{if(404===t.statusCode){const e=new Sye(`Missing PDF "${this._url}".`);return this._storedError=e,void this._headersCapability.reject(e)}this._headersCapability.resolve(),this._setReadableStream(t);const a=new Headers(this._readableStream.headers),{allowRangeRequests:n,suggestedLength:i}=Fbe({responseHeaders:a,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=n,this._contentLength=i||this._contentLength,this._filename=Bbe(a)})),this._request.on("error",(e=>{this._storedError=e,this._headersCapability.reject(e)})),this._request.end()}}class iwe extends awe{constructor(e,t,a){super(e);const n=Object.fromEntries(e.headers);n.Range=`bytes=${t}-${a-1}`;this._request=Jbe(this._url,n,(e=>{if(404!==e.statusCode)this._setReadableStream(e);else{const e=new Sye(`Missing PDF "${this._url}".`);this._storedError=e}})),this._request.on("error",(e=>{this._storedError=e})),this._request.end()}}class rwe extends twe{constructor(e){super(e);const t=qve.get("fs");t.promises.lstat(this._url).then((e=>{this._contentLength=e.size,this._setReadableStream(t.createReadStream(this._url)),this._headersCapability.resolve()}),(e=>{"ENOENT"===e.code&&(e=new Sye(`Missing PDF "${this._url}".`)),this._storedError=e,this._headersCapability.reject(e)}))}}class owe extends awe{constructor(e,t,a){super(e);const n=qve.get("fs");this._setReadableStream(n.createReadStream(this._url,{start:t,end:a-1}))}}const swe=30;let lwe=class e{#aa=Promise.withResolvers();#he=null;#na=!1;#ia=!!globalThis.FontInspector?.enabled;#ra=null;#oa=null;#sa=0;#la=0;#ca=null;#ua=null;#da=0;#ha=0;#ma=Object.create(null);#pa=[];#ga=null;#fa=[];#ya=new WeakMap;#va=null;static#ba=new Map;static#wa=new Map;static#xa=new WeakMap;static#ka=null;static#Aa=new Set;constructor({textContentSource:t,container:a,viewport:n}){if(t instanceof ReadableStream)this.#ga=t;else{if("object"!=typeof t)throw new Error('No "textContentSource" parameter specified.');this.#ga=new ReadableStream({start(e){e.enqueue(t),e.close()}})}this.#he=this.#ua=a,this.#ha=n.scale*(globalThis.devicePixelRatio||1),this.#da=n.rotation,this.#oa={div:null,properties:null,ctx:null};const{pageWidth:i,pageHeight:r,pageX:o,pageY:s}=n.rawDims;this.#va=[1,0,0,-1,-o,s+r],this.#la=i,this.#sa=r,e.#Sa(),dve(a,n),this.#aa.promise.finally((()=>{e.#Aa.delete(this),this.#oa=null,this.#ma=null})).catch((()=>{}))}static get fontFamilyMap(){const{isWindows:e,isFirefox:t}=Mye.platform;return bye(this,"fontFamilyMap",new Map([["sans-serif",(e&&t?"Calibri, ":"")+"sans-serif"],["monospace",(e&&t?"Lucida Console, ":"")+"monospace"]]))}render(){const t=()=>{this.#ca.read().then((({value:e,done:a})=>{a?this.#aa.resolve():(this.#ra??=e.lang,Object.assign(this.#ma,e.styles),this.#Ea(e.items),t())}),this.#aa.reject)};return this.#ca=this.#ga.getReader(),e.#Aa.add(this),t(),this.#aa.promise}update({viewport:t,onBefore:a=null}){const n=t.scale*(globalThis.devicePixelRatio||1),i=t.rotation;if(i!==this.#da&&(a?.(),this.#da=i,dve(this.#ua,{rotation:i})),n!==this.#ha){a?.(),this.#ha=n;const t={div:null,properties:null,ctx:e.#_a(this.#ra)};for(const e of this.#fa)t.properties=this.#ya.get(e),t.div=e,this.#Ca(t)}}cancel(){const e=new Cye("TextLayer task cancelled.");this.#ca?.cancel(e).catch((()=>{})),this.#ca=null,this.#aa.reject(e)}get textDivs(){return this.#fa}get textContentItemsStr(){return this.#pa}#Ea(t){if(this.#na)return;this.#oa.ctx??=e.#_a(this.#ra);const a=this.#fa,n=this.#pa;for(const e of t){if(a.length>1e5)return gye("Ignoring additional textDivs for performance reasons."),void(this.#na=!0);if(void 0!==e.str)n.push(e.str),this.#Ta(e);else if("beginMarkedContentProps"===e.type||"beginMarkedContent"===e.type){const t=this.#he;this.#he=document.createElement("span"),this.#he.classList.add("markedContent"),null!==e.id&&this.#he.setAttribute("id",`${e.id}`),t.append(this.#he)}else"endMarkedContent"===e.type&&(this.#he=this.#he.parentNode)}}#Ta(t){const a=document.createElement("span"),n={angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,fontSize:0};this.#fa.push(a);const i=Iye.transform(this.#va,t.transform);let r=Math.atan2(i[1],i[0]);const o=this.#ma[t.fontName];o.vertical&&(r+=Math.PI/2);let s=this.#ia&&o.fontSubstitution||o.fontFamily;s=e.fontFamilyMap.get(s)||s;const l=Math.hypot(i[2],i[3]),c=l*e.#Pa(s,this.#ra);let u,d;0===r?(u=i[4],d=i[5]-c):(u=i[4]+c*Math.sin(r),d=i[5]-c*Math.cos(r));const h="calc(var(--scale-factor)*",m=a.style;this.#he===this.#ua?(m.left=`${(100*u/this.#la).toFixed(2)}%`,m.top=`${(100*d/this.#sa).toFixed(2)}%`):(m.left=`${h}${u.toFixed(2)}px)`,m.top=`${h}${d.toFixed(2)}px)`),m.fontSize=`${h}${(e.#ka*l).toFixed(2)}px)`,m.fontFamily=s,n.fontSize=l,a.setAttribute("role","presentation"),a.textContent=t.str,a.dir=t.dir,this.#ia&&(a.dataset.fontName=o.fontSubstitutionLoadedName||t.fontName),0!==r&&(n.angle=r*(180/Math.PI));let p=!1;if(t.str.length>1)p=!0;else if(" "!==t.str&&t.transform[0]!==t.transform[3]){const e=Math.abs(t.transform[0]),a=Math.abs(t.transform[3]);e!==a&&Math.max(e,a)/Math.min(e,a)>1.5&&(p=!0)}if(p&&(n.canvasWidth=o.vertical?t.height:t.width),this.#ya.set(a,n),this.#oa.div=a,this.#oa.properties=n,this.#Ca(this.#oa),n.hasText&&this.#he.append(a),n.hasEOL){const e=document.createElement("br");e.setAttribute("role","presentation"),this.#he.append(e)}}#Ca(t){const{div:a,properties:n,ctx:i}=t,{style:r}=a;let o="";if(e.#ka>1&&(o=`scale(${1/e.#ka})`),0!==n.canvasWidth&&n.hasText){const{fontFamily:t}=r,{canvasWidth:s,fontSize:l}=n;e.#Oa(i,l*this.#ha,t);const{width:c}=i.measureText(a.textContent);c>0&&(o=`scaleX(${s*this.#ha/c}) ${o}`)}0!==n.angle&&(o=`rotate(${n.angle}deg) ${o}`),o.length>0&&(r.transform=o)}static cleanup(){if(!(this.#Aa.size>0)){this.#ba.clear();for(const{canvas:e}of this.#wa.values())e.remove();this.#wa.clear()}}static#_a(e=null){let t=this.#wa.get(e||="");if(!t){const a=document.createElement("canvas");a.className="hiddenCanvasElement",a.lang=e,document.body.append(a),t=a.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.#wa.set(e,t),this.#xa.set(t,{size:0,family:""})}return t}static#Oa(e,t,a){const n=this.#xa.get(e);t===n.size&&a===n.family||(e.font=`${t}px ${a}`,n.size=t,n.family=a)}static#Sa(){if(null!==this.#ka)return;const e=document.createElement("div");e.style.opacity=0,e.style.lineHeight=1,e.style.fontSize="1px",e.style.position="absolute",e.textContent="X",document.body.append(e),this.#ka=e.getBoundingClientRect().height,e.remove()}static#Pa(e,t){const a=this.#ba.get(e);if(a)return a;const n=this.#_a(t);n.canvas.width=n.canvas.height=swe,this.#Oa(n,swe,e);const i=n.measureText("");let r=i.fontBoundingBoxAscent,o=Math.abs(i.fontBoundingBoxDescent);if(r){const t=r/(r+o);return this.#ba.set(e,t),n.canvas.width=n.canvas.height=0,t}n.strokeStyle="red",n.clearRect(0,0,swe,swe),n.strokeText("g",0,0);let s=n.getImageData(0,0,swe,swe).data;o=0;for(let e=s.length-1-3;e>=0;e-=4)if(s[e]>0){o=Math.ceil(e/4/swe);break}n.clearRect(0,0,swe,swe),n.strokeText("A",0,swe),s=n.getImageData(0,0,swe,swe).data,r=0;for(let e=0,t=s.length;e<t;e+=4)if(s[e]>0){r=swe-Math.floor(e/4/swe);break}n.canvas.width=n.canvas.height=0;const l=r?r/(r+o):.8;return this.#ba.set(e,l),l}};class cwe{static textContent(e){const t=[],a={items:t,styles:Object.create(null)};return function e(a){if(!a)return;let n=null;const i=a.name;if("#text"===i)n=a.value;else{if(!cwe.shouldBuildText(i))return;a?.attributes?.textContent?n=a.attributes.textContent:a.value&&(n=a.value)}if(null!==n&&t.push({str:n}),a.children)for(const t of a.children)e(t)}(e),a}static shouldBuildText(e){return!("textarea"===e||"input"===e||"option"===e||"select"===e)}}const uwe=65536,dwe=ffe?class extends Nve{_createCanvas(e,t){return qve.get("canvas").createCanvas(e,t)}}:class extends Nve{constructor({ownerDocument:e=globalThis.document,enableHWA:t=!1}){super({enableHWA:t}),this._document=e}_createCanvas(e,t){const a=this._document.createElement("canvas");return a.width=e,a.height=t,a}},hwe=ffe?class extends jve{async _fetch(e){return Uve(e)}}:zve,mwe=ffe?class extends Rve{}:class extends Rve{#Ma;#Da;#Ia;#Na;#ja;#za;#b=0;constructor({docId:e,ownerDocument:t=globalThis.document}){super(),this.#Na=e,this.#ja=t}get#x(){return this.#Da||=new Map}get#Ra(){return this.#za||=new Map}get#La(){if(!this.#Ia){const e=this.#ja.createElement("div"),{style:t}=e;t.visibility="hidden",t.contain="strict",t.width=t.height=0,t.position="absolute",t.top=t.left=0,t.zIndex=-1;const a=this.#ja.createElementNS(Gye,"svg");a.setAttribute("width",0),a.setAttribute("height",0),this.#Ia=this.#ja.createElementNS(Gye,"defs"),e.append(a),a.append(this.#Ia),this.#ja.body.append(e)}return this.#Ia}#Fa(e){if(1===e.length){const t=e[0],a=new Array(256);for(let e=0;e<256;e++)a[e]=t[e]/255;const n=a.join(",");return[n,n,n]}const[t,a,n]=e,i=new Array(256),r=new Array(256),o=new Array(256);for(let e=0;e<256;e++)i[e]=t[e]/255,r[e]=a[e]/255,o[e]=n[e]/255;return[i.join(","),r.join(","),o.join(",")]}#Ba(e){if(void 0===this.#Ma){this.#Ma="";const e=this.#ja.URL;e!==this.#ja.baseURI&&(Qye(e)?gye('#createUrl: ignore "data:"-URL for performance reasons.'):this.#Ma=e.split("#",1)[0])}return`url(${this.#Ma}#${e})`}addFilter(e){if(!e)return"none";let t=this.#x.get(e);if(t)return t;const[a,n,i]=this.#Fa(e),r=1===e.length?a:`${a}${n}${i}`;if(t=this.#x.get(r),t)return this.#x.set(e,t),t;const o=`g_${this.#Na}_transfer_map_${this.#b++}`,s=this.#Ba(o);this.#x.set(e,s),this.#x.set(r,s);const l=this.#Ha(o);return this.#qa(a,n,i,l),s}addHCMFilter(e,t){const a=`${e}-${t}`,n="base";let i=this.#Ra.get(n);if(i?.key===a)return i.url;if(i?(i.filter?.remove(),i.key=a,i.url="none",i.filter=null):(i={key:a,url:"none",filter:null},this.#Ra.set(n,i)),!e||!t)return i.url;const r=this.#Ua(e);e=Iye.makeHexColor(...r);const o=this.#Ua(t);if(t=Iye.makeHexColor(...o),this.#La.style.color="","#000000"===e&&"#ffffff"===t||e===t)return i.url;const s=new Array(256);for(let e=0;e<=255;e++){const t=e/255;s[e]=t<=.03928?t/12.92:((t+.055)/1.055)**2.4}const l=s.join(","),c=`g_${this.#Na}_hcm_filter`,u=i.filter=this.#Ha(c);this.#qa(l,l,l,u),this.#Va(u);const d=(e,t)=>{const a=r[e]/255,n=o[e]/255,i=new Array(t+1);for(let e=0;e<=t;e++)i[e]=a+e/t*(n-a);return i.join(",")};return this.#qa(d(0,5),d(1,5),d(2,5),u),i.url=this.#Ba(c),i.url}addAlphaFilter(e){let t=this.#x.get(e);if(t)return t;const[a]=this.#Fa([e]),n=`alpha_${a}`;if(t=this.#x.get(n),t)return this.#x.set(e,t),t;const i=`g_${this.#Na}_alpha_map_${this.#b++}`,r=this.#Ba(i);this.#x.set(e,r),this.#x.set(n,r);const o=this.#Ha(i);return this.#Wa(a,o),r}addLuminosityFilter(e){let t,a,n=this.#x.get(e||"luminosity");if(n)return n;if(e?([t]=this.#Fa([e]),a=`luminosity_${t}`):a="luminosity",n=this.#x.get(a),n)return this.#x.set(e,n),n;const i=`g_${this.#Na}_luminosity_map_${this.#b++}`,r=this.#Ba(i);this.#x.set(e,r),this.#x.set(a,r);const o=this.#Ha(i);return this.#$a(o),e&&this.#Wa(t,o),r}addHighlightHCMFilter(e,t,a,n,i){const r=`${t}-${a}-${n}-${i}`;let o=this.#Ra.get(e);if(o?.key===r)return o.url;if(o?(o.filter?.remove(),o.key=r,o.url="none",o.filter=null):(o={key:r,url:"none",filter:null},this.#Ra.set(e,o)),!t||!a)return o.url;const[s,l]=[t,a].map(this.#Ua.bind(this));let c=Math.round(.2126*s[0]+.7152*s[1]+.0722*s[2]),u=Math.round(.2126*l[0]+.7152*l[1]+.0722*l[2]),[d,h]=[n,i].map(this.#Ua.bind(this));u<c&&([c,u,d,h]=[u,c,h,d]),this.#La.style.color="";const m=(e,t,a)=>{const n=new Array(256),i=(u-c)/a,r=e/255,o=(t-e)/(255*a);let s=0;for(let e=0;e<=a;e++){const t=Math.round(c+e*i),a=r+e*o;for(let e=s;e<=t;e++)n[e]=a;s=t+1}for(let e=s;e<256;e++)n[e]=n[s-1];return n.join(",")},p=`g_${this.#Na}_hcm_${e}_filter`,g=o.filter=this.#Ha(p);return this.#Va(g),this.#qa(m(d[0],h[0],5),m(d[1],h[1],5),m(d[2],h[2],5),g),o.url=this.#Ba(p),o.url}destroy(e=!1){e&&0!==this.#Ra.size||(this.#Ia&&(this.#Ia.parentNode.parentNode.remove(),this.#Ia=null),this.#Da&&(this.#Da.clear(),this.#Da=null),this.#b=0)}#$a(e){const t=this.#ja.createElementNS(Gye,"feColorMatrix");t.setAttribute("type","matrix"),t.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),e.append(t)}#Va(e){const t=this.#ja.createElementNS(Gye,"feColorMatrix");t.setAttribute("type","matrix"),t.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),e.append(t)}#Ha(e){const t=this.#ja.createElementNS(Gye,"filter");return t.setAttribute("color-interpolation-filters","sRGB"),t.setAttribute("id",e),this.#La.append(t),t}#Ga(e,t,a){const n=this.#ja.createElementNS(Gye,t);n.setAttribute("type","discrete"),n.setAttribute("tableValues",a),e.append(n)}#qa(e,t,a,n){const i=this.#ja.createElementNS(Gye,"feComponentTransfer");n.append(i),this.#Ga(i,"feFuncR",e),this.#Ga(i,"feFuncG",t),this.#Ga(i,"feFuncB",a)}#Wa(e,t){const a=this.#ja.createElementNS(Gye,"feComponentTransfer");t.append(a),this.#Ga(a,"feFuncA",e)}#Ua(e){return this.#La.style.color=e,lve(getComputedStyle(this.#La).getPropertyValue("color"))}},pwe=ffe?class extends Lve{async _fetch(e){return Uve(e)}}:Fve;function gwe(e={}){"string"==typeof e||e instanceof URL?e={url:e}:(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});const t=new ywe,{docId:a}=t,n=e.url?function(e){if(e instanceof URL)return e.href;try{return new URL(e,window.location).href}catch{if(ffe&&"string"==typeof e)return e}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}(e.url):null,i=e.data?function(e){if(ffe&&"undefined"!=typeof Buffer&&e instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength)return e;if("string"==typeof e)return Pye(e);if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)||"object"==typeof e&&!isNaN(e?.length))return new Uint8Array(e);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}(e.data):null,r=e.httpHeaders||null,o=!0===e.withCredentials,s=e.password??null,l=e.range instanceof vwe?e.range:null,c=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:uwe;let u=e.worker instanceof kwe?e.worker:null;const d=e.verbosity,h="string"!=typeof e.docBaseUrl||Qye(e.docBaseUrl)?null:e.docBaseUrl,m="string"==typeof e.cMapUrl?e.cMapUrl:null,p=!1!==e.cMapPacked,g=e.CMapReaderFactory||hwe,f="string"==typeof e.standardFontDataUrl?e.standardFontDataUrl:null,y=e.StandardFontDataFactory||pwe,v=!0!==e.stopAtErrors,b=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,w=!1!==e.isEvalSupported,x="boolean"==typeof e.isOffscreenCanvasSupported?e.isOffscreenCanvasSupported:!ffe,k="boolean"==typeof e.isChrome?e.isChrome:!Mye.platform.isFirefox&&"undefined"!=typeof window&&!!window?.chrome,A=Number.isInteger(e.canvasMaxAreaInBytes)?e.canvasMaxAreaInBytes:-1,S="boolean"==typeof e.disableFontFace?e.disableFontFace:ffe,E=!0===e.fontExtraProperties,_=!0===e.enableXfa,C=e.ownerDocument||globalThis.document,T=!0===e.disableRange,P=!0===e.disableStream,O=!0===e.disableAutoFetch,M=!0===e.pdfBug,D=e.CanvasFactory||dwe,I=e.FilterFactory||mwe,N=!0===e.enableHWA,j=l?l.length:e.length??NaN,z="boolean"==typeof e.useSystemFonts?e.useSystemFonts:!ffe&&!S,R="boolean"==typeof e.useWorkerFetch?e.useWorkerFetch:g===zve&&y===Fve&&m&&f&&nve(m,document.baseURI)&&nve(f,document.baseURI);e.canvasFactory&&rve("`canvasFactory`-instance option, please use `CanvasFactory` instead."),e.filterFactory&&rve("`filterFactory`-instance option, please use `FilterFactory` instead.");hye(d);const L={canvasFactory:new D({ownerDocument:C,enableHWA:N}),filterFactory:new I({docId:a,ownerDocument:C}),cMapReaderFactory:R?null:new g({baseUrl:m,isCompressed:p}),standardFontDataFactory:R?null:new y({baseUrl:f})};if(!u){const e={verbosity:d,port:vbe.workerPort};u=e.port?kwe.fromPort(e):new kwe(e),t._worker=u}const F={docId:a,apiVersion:"4.8.69",data:i,password:s,disableAutoFetch:O,rangeChunkSize:c,length:j,docBaseUrl:h,enableXfa:_,evaluatorOptions:{maxImageSize:b,disableFontFace:S,ignoreErrors:v,isEvalSupported:w,isOffscreenCanvasSupported:x,isChrome:k,canvasMaxAreaInBytes:A,fontExtraProperties:E,useSystemFonts:z,cMapUrl:R?m:null,standardFontDataUrl:R?f:null}},B={disableFontFace:S,fontExtraProperties:E,ownerDocument:C,pdfBug:M,styleElement:null,loadingParams:{disableAutoFetch:O,enableXfa:_}};return u.promise.then((function(){if(t.destroyed)throw new Error("Loading aborted");if(u.destroyed)throw new Error("Worker was destroyed");const e=u.messageHandler.sendWithPromise("GetDocRequest",F,i?[i.buffer]:null);let s;if(l)s=new jbe(l,{disableRange:T,disableStream:P});else if(!i){if(!n)throw new Error("getDocument - no `url` parameter provided.");let e;if(ffe){e="undefined"!=typeof fetch&&"undefined"!=typeof Response&&"body"in Response.prototype&&nve(n)?Wbe:ewe}else e=nve(n)?Wbe:Zbe;s=new e({url:n,length:j,httpHeaders:r,withCredentials:o,rangeChunkSize:c,disableRange:T,disableStream:P})}return e.then((e=>{if(t.destroyed)throw new Error("Loading aborted");if(u.destroyed)throw new Error("Worker was destroyed");const n=new Obe(a,e,u.port),i=new Awe(n,t,s,B,L);t._transport=i,n.send("Ready",null)}))})).catch(t._capability.reject),t}function fwe(e){return"object"==typeof e&&Number.isInteger(e?.num)&&e.num>=0&&Number.isInteger(e?.gen)&&e.gen>=0}class ywe{static#Na=0;constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId="d"+ywe.#Na++,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0),await(this._transport?.destroy())}catch(e){throw this._worker?.port&&delete this._worker._pendingDestroy,e}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}}let vwe=class{constructor(e,t,a=!1,n=null){this.length=e,this.initialData=t,this.progressiveDone=a,this.contentDispositionFilename=n,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}addRangeListener(e){this._rangeListeners.push(e)}addProgressListener(e){this._progressListeners.push(e)}addProgressiveReadListener(e){this._progressiveReadListeners.push(e)}addProgressiveDoneListener(e){this._progressiveDoneListeners.push(e)}onDataRange(e,t){for(const a of this._rangeListeners)a(e,t)}onDataProgress(e,t){this._readyCapability.promise.then((()=>{for(const a of this._progressListeners)a(e,t)}))}onDataProgressiveRead(e){this._readyCapability.promise.then((()=>{for(const t of this._progressiveReadListeners)t(e)}))}onDataProgressiveDone(){this._readyCapability.promise.then((()=>{for(const e of this._progressiveDoneListeners)e()}))}transportReady(){this._readyCapability.resolve()}requestDataRange(e,t){fye("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}};class bwe{constructor(e,t){this._pdfInfo=e,this._transport=t}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return bye(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(e){return this._transport.getPage(e)}getPageIndex(e){return this._transport.getPageIndex(e)}getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:e="display"}={}){const{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getOptionalContentConfig(t)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(e){return this._transport.cachedPageNumber(e)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}class wwe{#Ka=null;#Za=!1;constructor(e,t,a,n=!1){this._pageIndex=e,this._pageInfo=t,this._transport=a,this._stats=n?new ave:null,this._pdfBug=n,this.commonObjs=a.commonObjs,this.objs=new Ewe,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:e,rotation:t=this.rotate,offsetX:a=0,offsetY:n=0,dontFlip:i=!1}={}){return new Yye({viewBox:this.view,scale:e,rotation:t,offsetX:a,offsetY:n,dontFlip:i})}getAnnotations({intent:e="display"}={}){const{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,t)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return bye(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:e,viewport:t,intent:a="display",annotationMode:n=Tfe.ENABLE,transform:i=null,background:r=null,optionalContentConfigPromise:o=null,annotationCanvasMap:s=null,pageColors:l=null,printAnnotationStorage:c=null,isEditing:u=!1}){this._stats?.time("Overall");const d=this._transport.getRenderingIntent(a,n,c,u),{renderingIntent:h,cacheKey:m}=d;this.#Za=!1,this.#Ya(),o||=this._transport.getOptionalContentConfig(h);let p=this._intentStates.get(m);p||(p=Object.create(null),this._intentStates.set(m,p)),p.streamReaderCancelTimeout&&(clearTimeout(p.streamReaderCancelTimeout),p.streamReaderCancelTimeout=null);const g=!!(h&kfe);p.displayReadyCapability||(p.displayReadyCapability=Promise.withResolvers(),p.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(d));const f=e=>{p.renderTasks.delete(y),(this._maybeCleanupAfterRender||g)&&(this.#Za=!0),this.#Xa(!g),e?(y.capability.reject(e),this._abortOperatorList({intentState:p,reason:e instanceof Error?e:new Error(e)})):y.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},y=new Cwe({callback:f,params:{canvasContext:e,viewport:t,transform:i,background:r},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:s,operatorList:p.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!g,pdfBug:this._pdfBug,pageColors:l});(p.renderTasks||=new Set).add(y);const v=y.task;return Promise.all([p.displayReadyCapability.promise,o]).then((([e,t])=>{if(this.destroyed)f();else{if(this._stats?.time("Rendering"),!(t.renderingIntent&h))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");y.initializeGraphics({transparency:e,optionalContentConfig:t}),y.operatorListChanged()}})).catch(f),v}getOperatorList({intent:e="display",annotationMode:t=Tfe.ENABLE,printAnnotationStorage:a=null,isEditing:n=!1}={}){const i=this._transport.getRenderingIntent(e,t,a,n,!0);let r,o=this._intentStates.get(i.cacheKey);return o||(o=Object.create(null),this._intentStates.set(i.cacheKey,o)),o.opListReadCapability||(r=Object.create(null),r.operatorListChanged=function(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(r))},o.opListReadCapability=Promise.withResolvers(),(o.renderTasks||=new Set).add(r),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(i)),o.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:t=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===e,disableNormalization:!0===t},{highWaterMark:100,size:e=>e.items.length})}getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then((e=>cwe.textContent(e)));const t=this.streamTextContent(e);return new Promise((function(e,a){const n=t.getReader(),i={items:[],styles:Object.create(null),lang:null};!function t(){n.read().then((function({value:a,done:n}){n?e(i):(i.lang??=a.lang,Object.assign(i.styles,a.styles),i.items.push(...a.items),t())}),a)}()}))}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const e=[];for(const t of this._intentStates.values())if(this._abortOperatorList({intentState:t,reason:new Error("Page was destroyed."),force:!0}),!t.opListReadCapability)for(const a of t.renderTasks)e.push(a.completed),a.cancel();return this.objs.clear(),this.#Za=!1,this.#Ya(),Promise.all(e)}cleanup(e=!1){this.#Za=!0;const t=this.#Xa(!1);return e&&t&&(this._stats&&=new ave),t}#Xa(e=!1){if(this.#Ya(),!this.#Za||this.destroyed)return!1;if(e)return this.#Ka=setTimeout((()=>{this.#Ka=null,this.#Xa(!1)}),5e3),!1;for(const{renderTasks:e,operatorList:t}of this._intentStates.values())if(e.size>0||!t.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#Za=!1,!0}#Ya(){this.#Ka&&(clearTimeout(this.#Ka),this.#Ka=null)}_startRenderPage(e,t){const a=this._intentStates.get(t);a&&(this._stats?.timeEnd("Page Request"),a.displayReadyCapability?.resolve(e))}_renderPageChunk(e,t){for(let a=0,n=e.length;a<n;a++)t.operatorList.fnArray.push(e.fnArray[a]),t.operatorList.argsArray.push(e.argsArray[a]);t.operatorList.lastChunk=e.lastChunk,t.operatorList.separateAnnots=e.separateAnnots;for(const e of t.renderTasks)e.operatorListChanged();e.lastChunk&&this.#Xa(!0)}_pumpOperatorList({renderingIntent:e,cacheKey:t,annotationStorageSerializable:a,modifiedIds:n}){const{map:i,transfer:r}=a,o=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:t,annotationStorage:i,modifiedIds:n},r).getReader(),s=this._intentStates.get(t);s.streamReader=o;const l=()=>{o.read().then((({value:e,done:t})=>{t?s.streamReader=null:this._transport.destroyed||(this._renderPageChunk(e,s),l())}),(e=>{if(s.streamReader=null,!this._transport.destroyed){if(s.operatorList){s.operatorList.lastChunk=!0;for(const e of s.renderTasks)e.operatorListChanged();this.#Xa(!0)}if(s.displayReadyCapability)s.displayReadyCapability.reject(e);else{if(!s.opListReadCapability)throw e;s.opListReadCapability.reject(e)}}}))};l()}_abortOperatorList({intentState:e,reason:t,force:a=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!a){if(e.renderTasks.size>0)return;if(t instanceof Xye){let a=100;return t.extraDelay>0&&t.extraDelay<1e3&&(a+=t.extraDelay),void(e.streamReaderCancelTimeout=setTimeout((()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:t,force:!0})}),a))}}if(e.streamReader.cancel(new Cye(t.message)).catch((()=>{})),e.streamReader=null,!this._transport.destroyed){for(const[t,a]of this._intentStates)if(a===e){this._intentStates.delete(t);break}this.cleanup()}}}get stats(){return this._stats}}class xwe{#Qa=new Map;#Ja=Promise.resolve();postMessage(e,t){const a={data:structuredClone(e,t?{transfer:t}:null)};this.#Ja.then((()=>{for(const[e]of this.#Qa)e.call(this,a)}))}addEventListener(e,t,a=null){let n=null;if(a?.signal instanceof AbortSignal){const{signal:i}=a;if(i.aborted)return void gye("LoopbackPort - cannot use an `aborted` signal.");const r=()=>this.removeEventListener(e,t);n=()=>i.removeEventListener("abort",r),i.addEventListener("abort",r)}this.#Qa.set(t,n)}removeEventListener(e,t){const a=this.#Qa.get(t);a?.(),this.#Qa.delete(t)}terminate(){for(const[,e]of this.#Qa)e?.();this.#Qa.clear()}}class kwe{static#en=0;static#tn=!1;static#an;static{ffe&&(this.#tn=!0,vbe.workerSrc||="./pdf.worker.mjs"),this._isSameOrigin=(e,t)=>{let a;try{if(a=new URL(e),!a.origin||"null"===a.origin)return!1}catch{return!1}const n=new URL(t,a);return a.origin===n.origin},this._createCDNWrapper=e=>{const t=`await import("${e}");`;return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))}}constructor({name:e=null,port:t=null,verbosity:a=mye()}={}){if(this.name=e,this.destroyed=!1,this.verbosity=a,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,t){if(kwe.#an?.has(t))throw new Error("Cannot use more than one PDFWorker per port.");return(kwe.#an||=new WeakMap).set(t,this),void this._initializeFromPort(t)}this._initialize()}get promise(){return ffe?Promise.all([qve.promise,this._readyCapability.promise]):this._readyCapability.promise}#nn(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(e){this._port=e,this._messageHandler=new Obe("main","worker",e),this._messageHandler.on("ready",(function(){})),this.#nn()}_initialize(){if(kwe.#tn||kwe.#in)return void this._setupFakeWorker();let{workerSrc:e}=kwe;try{kwe._isSameOrigin(window.location.href,e)||(e=kwe._createCDNWrapper(new URL(e,window.location).href));const t=new Worker(e,{type:"module"}),a=new Obe("main","worker",t),n=()=>{i.abort(),a.destroy(),t.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},i=new AbortController;t.addEventListener("error",(()=>{this._webWorker||n()}),{signal:i.signal}),a.on("test",(e=>{i.abort(),!this.destroyed&&e?(this._messageHandler=a,this._port=t,this._webWorker=t,this.#nn()):n()})),a.on("ready",(e=>{if(i.abort(),this.destroyed)n();else try{r()}catch{this._setupFakeWorker()}}));const r=()=>{const e=new Uint8Array;a.send("test",e,[e.buffer])};return void r()}catch{pye("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){kwe.#tn||(gye("Setting up fake worker."),kwe.#tn=!0),kwe._setupFakeWorkerGlobal.then((e=>{if(this.destroyed)return void this._readyCapability.reject(new Error("Worker was destroyed"));const t=new xwe;this._port=t;const a="fake"+kwe.#en++,n=new Obe(a+"_worker",a,t);e.setup(n,t),this._messageHandler=new Obe(a,a+"_worker",t),this.#nn()})).catch((e=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${e.message}".`))}))}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),kwe.#an?.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(e){if(!e?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");const t=this.#an?.get(e.port);if(t){if(t._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return t}return new kwe(e)}static get workerSrc(){if(vbe.workerSrc)return vbe.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get#in(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return bye(this,"_setupFakeWorkerGlobal",(async()=>{if(this.#in)return this.#in;return(await import(this.workerSrc)).WorkerMessageHandler})())}}class Awe{#rn=new Map;#on=new Map;#sn=new Map;#ln=new Map;#cn=null;constructor(e,t,a,n,i){this.messageHandler=e,this.loadingTask=t,this.commonObjs=new Ewe,this.fontLoader=new Dve({ownerDocument:n.ownerDocument,styleElement:n.styleElement}),this.loadingParams=n.loadingParams,this._params=n,this.canvasFactory=i.canvasFactory,this.filterFactory=i.filterFactory,this.cMapReaderFactory=i.cMapReaderFactory,this.standardFontDataFactory=i.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=a,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}#un(e,t=null){const a=this.#rn.get(e);if(a)return a;const n=this.messageHandler.sendWithPromise(e,t);return this.#rn.set(e,n),n}get annotationStorage(){return bye(this,"annotationStorage",new Ove)}getRenderingIntent(e,t=Tfe.ENABLE,a=null,n=!1,i=!1){let r=xfe,o=Pve;switch(e){case"any":r=wfe;break;case"display":break;case"print":r=kfe;break;default:gye(`getRenderingIntent - invalid intent: ${e}`)}const s=r&kfe&&a instanceof Mve?a:this.annotationStorage;switch(t){case Tfe.DISABLE:r+=Efe;break;case Tfe.ENABLE:break;case Tfe.ENABLE_FORMS:r+=Afe;break;case Tfe.ENABLE_STORAGE:r+=Sfe,o=s.serializable;break;default:gye(`getRenderingIntent - invalid annotationMode: ${t}`)}n&&(r+=_fe),i&&(r+=Cfe);const{ids:l,hash:c}=s.modifiedIds;return{renderingIntent:r,cacheKey:[r,o.hash,c].join("_"),annotationStorageSerializable:o,modifiedIds:l}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#cn?.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const t of this.#on.values())e.push(t._destroy());this.#on.clear(),this.#sn.clear(),this.#ln.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const t=this.messageHandler.sendWithPromise("Terminate",null);return e.push(t),Promise.all(e).then((()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#rn.clear(),this.filterFactory.destroy(),lwe.cleanup(),this._networkStream?.cancelAllRequests(new Cye("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()}),this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:t}=this;e.on("GetReader",((e,t)=>{yye(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=e=>{this._lastProgress={loaded:e.loaded,total:e.total}},t.onPull=()=>{this._fullReader.read().then((function({value:e,done:a}){a?t.close():(yye(e instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),t.enqueue(new Uint8Array(e),1,[e]))})).catch((e=>{t.error(e)}))},t.onCancel=e=>{this._fullReader.cancel(e),t.ready.catch((e=>{if(!this.destroyed)throw e}))}})),e.on("ReaderHeadersReady",(async e=>{await this._fullReader.headersReady;const{isStreamingSupported:a,isRangeSupported:n,contentLength:i}=this._fullReader;return a&&n||(this._lastProgress&&t.onProgress?.(this._lastProgress),this._fullReader.onProgress=e=>{t.onProgress?.({loaded:e.loaded,total:e.total})}),{isStreamingSupported:a,isRangeSupported:n,contentLength:i}})),e.on("GetRangeReader",((e,t)=>{yye(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const a=this._networkStream.getRangeReader(e.begin,e.end);a?(t.onPull=()=>{a.read().then((function({value:e,done:a}){a?t.close():(yye(e instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),t.enqueue(new Uint8Array(e),1,[e]))})).catch((e=>{t.error(e)}))},t.onCancel=e=>{a.cancel(e),t.ready.catch((e=>{if(!this.destroyed)throw e}))}):t.close()})),e.on("GetDoc",(({pdfInfo:e})=>{this._numPages=e.numPages,this._htmlForXfa=e.htmlForXfa,delete e.htmlForXfa,t._capability.resolve(new bwe(e,this))})),e.on("DocException",(function(e){let a;switch(e.name){case"PasswordException":a=new xye(e.message,e.code);break;case"InvalidPDFException":a=new Aye(e.message);break;case"MissingPDFException":a=new Sye(e.message);break;case"UnexpectedResponseException":a=new Eye(e.message,e.status);break;case"UnknownErrorException":a=new kye(e.message,e.details);break;default:fye("DocException - expected a valid Error.")}t._capability.reject(a)})),e.on("PasswordRequest",(e=>{if(this.#cn=Promise.withResolvers(),t.onPassword){const a=e=>{e instanceof Error?this.#cn.reject(e):this.#cn.resolve({password:e})};try{t.onPassword(a,e.code)}catch(e){this.#cn.reject(e)}}else this.#cn.reject(new xye(e.message,e.code));return this.#cn.promise})),e.on("DataLoaded",(e=>{t.onProgress?.({loaded:e.length,total:e.length}),this.downloadInfoCapability.resolve(e)})),e.on("StartRenderPage",(e=>{if(this.destroyed)return;this.#on.get(e.pageIndex)._startRenderPage(e.transparency,e.cacheKey)})),e.on("commonobj",(([t,a,n])=>{if(this.destroyed)return null;if(this.commonObjs.has(t))return null;switch(a){case"Font":const{disableFontFace:i,fontExtraProperties:r,pdfBug:o}=this._params;if("error"in n){const e=n.error;gye(`Error during font loading: ${e}`),this.commonObjs.resolve(t,e);break}const s=o&&globalThis.FontInspector?.enabled?(e,t)=>globalThis.FontInspector.fontAdded(e,t):null,l=new Ive(n,{disableFontFace:i,inspectFont:s});this.fontLoader.bind(l).catch((()=>e.sendWithPromise("FontFallback",{id:t}))).finally((()=>{!r&&l.data&&(l.data=null),this.commonObjs.resolve(t,l)}));break;case"CopyLocalImage":const{imageRef:c}=n;yye(c,"The imageRef must be defined.");for(const e of this.#on.values())for(const[,a]of e.objs)if(a?.ref===c)return a.dataLen?(this.commonObjs.resolve(t,structuredClone(a)),a.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(t,n);break;default:throw new Error(`Got unknown common object type ${a}`)}return null})),e.on("obj",(([e,t,a,n])=>{if(this.destroyed)return;const i=this.#on.get(t);if(!i.objs.has(e))if(0!==i._intentStates.size)switch(a){case"Image":i.objs.resolve(e,n),n?.dataLen>1e7&&(i._maybeCleanupAfterRender=!0);break;case"Pattern":i.objs.resolve(e,n);break;default:throw new Error(`Got unknown object type ${a}`)}else n?.bitmap?.close()})),e.on("DocProgress",(e=>{this.destroyed||t.onProgress?.({loaded:e.loaded,total:e.total})})),e.on("FetchBuiltInCMap",(async e=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.cMapReaderFactory)throw new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.");return this.cMapReaderFactory.fetch(e)})),e.on("FetchStandardFontData",(async e=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.standardFontDataFactory)throw new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.");return this.standardFontDataFactory.fetch(e)}))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&gye("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:e,transfer:t}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:this._fullReader?.filename??null},t).finally((()=>{this.annotationStorage.resetModified()}))}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(new Error("Invalid page request."));const t=e-1,a=this.#sn.get(t);if(a)return a;const n=this.messageHandler.sendWithPromise("GetPage",{pageIndex:t}).then((a=>{if(this.destroyed)throw new Error("Transport destroyed");a.refStr&&this.#ln.set(a.refStr,e);const n=new wwe(t,a,this,this._params.pdfBug);return this.#on.set(t,n),n}));return this.#sn.set(t,n),n}getPageIndex(e){return fwe(e)?this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(e,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:t})}getFieldObjects(){return this.#un("GetFieldObjects")}hasJSActions(){return this.#un("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(e){return"string"!=typeof e?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:e})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getDocJSActions(){return this.#un("GetDocJSActions")}getPageJSActions(e){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:e})}getStructTree(e){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:e})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(e){return this.#un("GetOptionalContentConfig").then((t=>new Nbe(t,e)))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const e="GetMetadata",t=this.#rn.get(e);if(t)return t;const a=this.messageHandler.sendWithPromise(e,null).then((e=>({info:e[0],metadata:e[1]?new Mbe(e[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null})));return this.#rn.set(e,a),a}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const e of this.#on.values()){if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`)}this.commonObjs.clear(),e||this.fontLoader.clear(),this.#rn.clear(),this.filterFactory.destroy(!0),lwe.cleanup()}}cachedPageNumber(e){if(!fwe(e))return null;const t=0===e.gen?`${e.num}R`:`${e.num}R${e.gen}`;return this.#ln.get(t)??null}}const Swe=Symbol("INITIAL_DATA");class Ewe{#dn=Object.create(null);#hn(e){return this.#dn[e]||={...Promise.withResolvers(),data:Swe}}get(e,t=null){if(t){const a=this.#hn(e);return a.promise.then((()=>t(a.data))),null}const a=this.#dn[e];if(!a||a.data===Swe)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return a.data}has(e){const t=this.#dn[e];return!!t&&t.data!==Swe}resolve(e,t=null){const a=this.#hn(e);a.data=t,a.resolve()}clear(){for(const e in this.#dn){const{data:t}=this.#dn[e];t?.bitmap?.close()}this.#dn=Object.create(null)}*[Symbol.iterator](){for(const e in this.#dn){const{data:t}=this.#dn[e];t!==Swe&&(yield[e,t])}}}class _we{#mn=null;constructor(e){this.#mn=e,this.onContinue=null}get promise(){return this.#mn.capability.promise}cancel(e=0){this.#mn.cancel(null,e)}get separateAnnots(){const{separateAnnots:e}=this.#mn.operatorList;if(!e)return!1;const{annotationCanvasMap:t}=this.#mn;return e.form||e.canvas&&t?.size>0}}class Cwe{#pn=null;static#gn=new WeakSet;constructor({callback:e,params:t,objs:a,commonObjs:n,annotationCanvasMap:i,operatorList:r,pageIndex:o,canvasFactory:s,filterFactory:l,useRequestAnimationFrame:c=!1,pdfBug:u=!1,pageColors:d=null}){this.callback=e,this.params=t,this.objs=a,this.commonObjs=n,this.annotationCanvasMap=i,this.operatorListIdx=null,this.operatorList=r,this._pageIndex=o,this.canvasFactory=s,this.filterFactory=l,this._pdfBug=u,this.pageColors=d,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===c&&"undefined"!=typeof window,this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new _we(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=t.canvasContext.canvas}get completed(){return this.capability.promise.catch((function(){}))}initializeGraphics({transparency:e=!1,optionalContentConfig:t}){if(this.cancelled)return;if(this._canvas){if(Cwe.#gn.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");Cwe.#gn.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:a,viewport:n,transform:i,background:r}=this.params;this.gfx=new ybe(a,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:t},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:i,viewport:n,transparency:e,background:r}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(e=null,t=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#pn&&(window.cancelAnimationFrame(this.#pn),this.#pn=null),Cwe.#gn.delete(this._canvas),this.callback(e||new Xye(`Rendering cancelled, page ${this._pageIndex+1}`,t))}operatorListChanged(){this.graphicsReady?(this.stepper?.updateOperatorList(this.operatorList),this.running||this._continue()):this.graphicsReadyCallback||=this._continueBound}_continue(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?this.#pn=window.requestAnimationFrame((()=>{this.#pn=null,this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),Cwe.#gn.delete(this._canvas),this.callback())))}}const Twe="4.8.69",Pwe="3634dab10";function Owe(e){return Math.floor(255*Math.max(0,Math.min(1,e))).toString(16).padStart(2,"0")}function Mwe(e){return Math.max(0,Math.min(255,255*e))}class Dwe{static CMYK_G([e,t,a,n]){return["G",1-Math.min(1,.3*e+.59*a+.11*t+n)]}static G_CMYK([e]){return["CMYK",0,0,0,1-e]}static G_RGB([e]){return["RGB",e,e,e]}static G_rgb([e]){return[e=Mwe(e),e,e]}static G_HTML([e]){const t=Owe(e);return`#${t}${t}${t}`}static RGB_G([e,t,a]){return["G",.3*e+.59*t+.11*a]}static RGB_rgb(e){return e.map(Mwe)}static RGB_HTML(e){return`#${e.map(Owe).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([e,t,a,n]){return["RGB",1-Math.min(1,e+n),1-Math.min(1,a+n),1-Math.min(1,t+n)]}static CMYK_rgb([e,t,a,n]){return[Mwe(1-Math.min(1,e+n)),Mwe(1-Math.min(1,a+n)),Mwe(1-Math.min(1,t+n))]}static CMYK_HTML(e){const t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}static RGB_CMYK([e,t,a]){const n=1-e,i=1-t,r=1-a;return["CMYK",n,i,r,Math.min(n,i,r)]}}class Iwe{create(e,t,a=!1){if(e<=0||t<=0)throw new Error("Invalid SVG dimensions");const n=this._createSVG("svg:svg");return n.setAttribute("version","1.1"),a||(n.setAttribute("width",`${e}px`),n.setAttribute("height",`${t}px`)),n.setAttribute("preserveAspectRatio","none"),n.setAttribute("viewBox",`0 0 ${e} ${t}`),n}createElement(e){if("string"!=typeof e)throw new Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){fye("Abstract method `_createSVG` called.")}}class Nwe extends Iwe{_createSVG(e){return document.createElementNS(Gye,e)}}class jwe{static setupStorage(e,t,a,n,i){const r=n.getValue(t,{value:null});switch(a.name){case"textarea":if(null!==r.value&&(e.textContent=r.value),"print"===i)break;e.addEventListener("input",(e=>{n.setValue(t,{value:e.target.value})}));break;case"input":if("radio"===a.attributes.type||"checkbox"===a.attributes.type){if(r.value===a.attributes.xfaOn?e.setAttribute("checked",!0):r.value===a.attributes.xfaOff&&e.removeAttribute("checked"),"print"===i)break;e.addEventListener("change",(e=>{n.setValue(t,{value:e.target.checked?e.target.getAttribute("xfaOn"):e.target.getAttribute("xfaOff")})}))}else{if(null!==r.value&&e.setAttribute("value",r.value),"print"===i)break;e.addEventListener("input",(e=>{n.setValue(t,{value:e.target.value})}))}break;case"select":if(null!==r.value){e.setAttribute("value",r.value);for(const e of a.children)e.attributes.value===r.value?e.attributes.selected=!0:e.attributes.hasOwnProperty("selected")&&delete e.attributes.selected}e.addEventListener("input",(e=>{const a=e.target.options,i=-1===a.selectedIndex?"":a[a.selectedIndex].value;n.setValue(t,{value:i})}))}}static setAttributes({html:e,element:t,storage:a=null,intent:n,linkService:i}){const{attributes:r}=t,o=e instanceof HTMLAnchorElement;"radio"===r.type&&(r.name=`${r.name}-${n}`);for(const[t,a]of Object.entries(r))if(null!=a)switch(t){case"class":a.length&&e.setAttribute(t,a.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",a);break;case"style":Object.assign(e.style,a);break;case"textContent":e.textContent=a;break;default:(!o||"href"!==t&&"newWindow"!==t)&&e.setAttribute(t,a)}o&&i.addLinkAttributes(e,r.href,r.newWindow),a&&r.dataId&&this.setupStorage(e,r.dataId,t,a)}static render(e){const t=e.annotationStorage,a=e.linkService,n=e.xfaHtml,i=e.intent||"display",r=document.createElement(n.name);n.attributes&&this.setAttributes({html:r,element:n,intent:i,linkService:a});const o="richText"!==i,s=e.div;if(s.append(r),e.viewport){const t=`matrix(${e.viewport.transform.join(",")})`;s.style.transform=t}o&&s.setAttribute("class","xfaLayer xfaFont");const l=[];if(0===n.children.length){if(n.value){const e=document.createTextNode(n.value);r.append(e),o&&cwe.shouldBuildText(n.name)&&l.push(e)}return{textDivs:l}}const c=[[n,-1,r]];for(;c.length>0;){const[e,n,r]=c.at(-1);if(n+1===e.children.length){c.pop();continue}const s=e.children[++c.at(-1)[1]];if(null===s)continue;const{name:u}=s;if("#text"===u){const e=document.createTextNode(s.value);l.push(e),r.append(e);continue}const d=s?.attributes?.xmlns?document.createElementNS(s.attributes.xmlns,u):document.createElement(u);if(r.append(d),s.attributes&&this.setAttributes({html:d,element:s,storage:t,intent:i,linkService:a}),s.children?.length>0)c.push([s,-1,d]);else if(s.value){const e=document.createTextNode(s.value);o&&cwe.shouldBuildText(u)&&l.push(e),d.append(e)}}for(const e of s.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))e.setAttribute("readOnly",!0);return{textDivs:l}}static update(e){const t=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=t,e.div.hidden=!1}}const zwe=1e3,Rwe=new WeakSet;function Lwe(e){return{width:e[2]-e[0],height:e[3]-e[1]}}class Fwe{static create(e){switch(e.data.annotationType){case Bfe:return new Hwe(e);case Ffe:return new qwe(e);case aye:switch(e.data.fieldType){case"Tx":return new Vwe(e);case"Btn":return e.data.radioButton?new Gwe(e):e.data.checkBox?new $we(e):new Kwe(e);case"Ch":return new Zwe(e);case"Sig":return new Wwe(e)}return new Uwe(e);case eye:return new Ywe(e);case Hfe:return new Qwe(e);case qfe:return new Jwe(e);case Ufe:return new exe(e);case Vfe:return new txe(e);case $fe:return new axe(e);case Qfe:return new ixe(e);case Jfe:return new rxe(e);case Wfe:return new nxe(e);case Gfe:return new oxe(e);case Kfe:return new sxe(e);case Zfe:return new lxe(e);case Yfe:return new cxe(e);case Xfe:return new uxe(e);case tye:return new dxe(e);default:return new Bwe(e)}}}class Bwe{#fn=null;#yn=!1;#vn=null;constructor(e,{isRenderable:t=!1,ignoreBorder:a=!1,createQuadrilaterals:n=!1}={}){this.isRenderable=t,this.data=e.data,this.layer=e.layer,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,t&&(this.container=this._createContainer(a)),n&&this._createQuadrilaterals()}static _hasPopupData({titleObj:e,contentsObj:t,richText:a}){return!!(e?.str||t?.str||a?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return Bwe._hasPopupData(this.data)}updateEdited(e){if(!this.container)return;this.#fn||={rect:this.data.rect.slice(0)};const{rect:t}=e;t&&this.#bn(t),this.#vn?.popup.updateEdited(e)}resetEdited(){this.#fn&&(this.#bn(this.#fn.rect),this.#vn?.popup.resetEdited(),this.#fn=null)}#bn(e){const{container:{style:t},data:{rect:a,rotation:n},parent:{viewport:{rawDims:{pageWidth:i,pageHeight:r,pageX:o,pageY:s}}}}=this;a?.splice(0,4,...e);const{width:l,height:c}=Lwe(e);t.left=100*(e[0]-o)/i+"%",t.top=100*(r-e[3]+s)/r+"%",0===n?(t.width=100*l/i+"%",t.height=100*c/r+"%"):this.setRotation(n)}_createContainer(e){const{data:t,parent:{page:a,viewport:n}}=this,i=document.createElement("section");i.setAttribute("data-annotation-id",t.id),this instanceof Uwe||(i.tabIndex=zwe);const{style:r}=i;if(r.zIndex=this.parent.zIndex++,t.alternativeText&&(i.title=t.alternativeText),t.noRotate&&i.classList.add("norotate"),!t.rect||this instanceof Ywe){const{rotation:e}=t;return t.hasOwnCanvas||0===e||this.setRotation(e,i),i}const{width:o,height:s}=Lwe(t.rect);if(!e&&t.borderStyle.width>0){r.borderWidth=`${t.borderStyle.width}px`;const e=t.borderStyle.horizontalCornerRadius,a=t.borderStyle.verticalCornerRadius;if(e>0||a>0){const t=`calc(${e}px * var(--scale-factor)) / calc(${a}px * var(--scale-factor))`;r.borderRadius=t}else if(this instanceof Gwe){const e=`calc(${o}px * var(--scale-factor)) / calc(${s}px * var(--scale-factor))`;r.borderRadius=e}switch(t.borderStyle.style){case nye:r.borderStyle="solid";break;case iye:r.borderStyle="dashed";break;case rye:gye("Unimplemented border style: beveled");break;case oye:gye("Unimplemented border style: inset");break;case sye:r.borderBottomStyle="solid"}const n=t.borderColor||null;n?(this.#yn=!0,r.borderColor=Iye.makeHexColor(0|n[0],0|n[1],0|n[2])):r.borderWidth=0}const l=Iye.normalizeRect([t.rect[0],a.view[3]-t.rect[1]+a.view[1],t.rect[2],a.view[3]-t.rect[3]+a.view[1]]),{pageWidth:c,pageHeight:u,pageX:d,pageY:h}=n.rawDims;r.left=100*(l[0]-d)/c+"%",r.top=100*(l[1]-h)/u+"%";const{rotation:m}=t;return t.hasOwnCanvas||0===m?(r.width=100*o/c+"%",r.height=100*s/u+"%"):this.setRotation(m,i),i}setRotation(e,t=this.container){if(!this.data.rect)return;const{pageWidth:a,pageHeight:n}=this.parent.viewport.rawDims,{width:i,height:r}=Lwe(this.data.rect);let o,s;e%180==0?(o=100*i/a,s=100*r/n):(o=100*r/a,s=100*i/n),t.style.width=`${o}%`,t.style.height=`${s}%`,t.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const e=(e,t,a)=>{const n=a.detail[e],i=n[0],r=n.slice(1);a.target.style[t]=Dwe[`${i}_HTML`](r),this.annotationStorage.setValue(this.data.id,{[t]:Dwe[`${i}_rgb`](r)})};return bye(this,"_commonActions",{display:e=>{const{display:t}=e.detail,a=t%2==1;this.container.style.visibility=a?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:a,noPrint:1===t||2===t})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{const{hidden:t}=e.detail;this.container.style.visibility=t?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:t,noView:t})},focus:e=>{setTimeout((()=>e.target.focus({preventScroll:!1})),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.target.disabled=e.detail.readonly},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:t=>{e("bgColor","backgroundColor",t)},fillColor:t=>{e("fillColor","backgroundColor",t)},fgColor:t=>{e("fgColor","color",t)},textColor:t=>{e("textColor","color",t)},borderColor:t=>{e("borderColor","borderColor",t)},strokeColor:t=>{e("strokeColor","borderColor",t)},rotation:e=>{const t=e.detail.rotation;this.setRotation(t),this.annotationStorage.setValue(this.data.id,{rotation:t})}})}_dispatchEventFromSandbox(e,t){const a=this._commonActions;for(const n of Object.keys(t.detail)){const i=e[n]||a[n];i?.(t)}}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;const t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;const a=this._commonActions;for(const[n,i]of Object.entries(t)){const r=a[n];if(r){r({detail:{[n]:i},target:e}),delete t[n]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:e}=this.data;if(!e)return;const[t,a,n,i]=this.data.rect.map((e=>Math.fround(e)));if(8===e.length){const[r,o,s,l]=e.subarray(2,6);if(n===r&&i===o&&t===s&&a===l)return}const{style:r}=this.container;let o;if(this.#yn){const{borderColor:e,borderWidth:t}=r;r.borderWidth=0,o=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${e}" stroke-width="${t}">`],this.container.classList.add("hasBorder")}const s=n-t,l=i-a,{svgFactory:c}=this,u=c.createElement("svg");u.classList.add("quadrilateralsContainer"),u.setAttribute("width",0),u.setAttribute("height",0);const d=c.createElement("defs");u.append(d);const h=c.createElement("clipPath"),m=`clippath_${this.data.id}`;h.setAttribute("id",m),h.setAttribute("clipPathUnits","objectBoundingBox"),d.append(h);for(let a=2,n=e.length;a<n;a+=8){const n=e[a],r=e[a+1],u=e[a+2],d=e[a+3],m=c.createElement("rect"),p=(u-t)/s,g=(i-r)/l,f=(n-u)/s,y=(r-d)/l;m.setAttribute("x",p),m.setAttribute("y",g),m.setAttribute("width",f),m.setAttribute("height",y),h.append(m),o?.push(`<rect vector-effect="non-scaling-stroke" x="${p}" y="${g}" width="${f}" height="${y}"/>`)}this.#yn&&(o.push("</g></svg>')"),r.backgroundImage=o.join("")),this.container.append(u),this.container.style.clipPath=`url(#${m})`}_createPopup(){const{data:e}=this,t=this.#vn=new Ywe({data:{color:e.color,titleObj:e.titleObj,modificationDate:e.modificationDate,contentsObj:e.contentsObj,richText:e.richText,parentRect:e.rect,borderStyle:0,id:`popup_${e.id}`,rotation:e.rotation},parent:this.parent,elements:[this]});this.parent.div.append(t.render())}render(){fye("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,t=null){const a=[];if(this._fieldObjects){const n=this._fieldObjects[e];if(n)for(const{page:e,id:i,exportValues:r}of n){if(-1===e)continue;if(i===t)continue;const n="string"==typeof r?r:null,o=document.querySelector(`[data-element-id="${i}"]`);!o||Rwe.has(o)?a.push({id:i,exportValue:n,domElement:o}):gye(`_getElementsByName - element not allowed: ${i}`)}return a}for(const n of document.getElementsByName(e)){const{exportValue:e}=n,i=n.getAttribute("data-element-id");i!==t&&(Rwe.has(n)&&a.push({id:i,exportValue:e,domElement:n}))}return a}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(const t of e)t.classList.add("highlightArea");else e.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:e,data:{id:t}}=this;this.container.addEventListener("dblclick",(()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:e,editId:t})}))}}class Hwe extends Bwe{constructor(e,t=null){super(e,{isRenderable:!0,ignoreBorder:!!t?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:t}=this,a=document.createElement("a");a.setAttribute("data-element-id",e.id);let n=!1;return e.url?(t.addLinkAttributes(a,e.url,e.newWindow),n=!0):e.action?(this._bindNamedAction(a,e.action),n=!0):e.attachment?(this.#wn(a,e.attachment,e.attachmentDest),n=!0):e.setOCGState?(this.#xn(a,e.setOCGState),n=!0):e.dest?(this._bindLink(a,e.dest),n=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(a,e),n=!0),e.resetForm?(this._bindResetFormAction(a,e.resetForm),n=!0):this.isTooltipOnly&&!n&&(this._bindLink(a,""),n=!0)),this.container.classList.add("linkAnnotation"),n&&this.container.append(a),this.container}#kn(){this.container.setAttribute("data-internal-link","")}_bindLink(e,t){e.href=this.linkService.getDestinationHash(t),e.onclick=()=>(t&&this.linkService.goToDestination(t),!1),(t||""===t)&&this.#kn()}_bindNamedAction(e,t){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(t),!1),this.#kn()}#wn(e,t,a=null){e.href=this.linkService.getAnchorUrl(""),t.description&&(e.title=t.description),e.onclick=()=>(this.downloadManager?.openOrDownloadData(t.content,t.filename,a),!1),this.#kn()}#xn(e,t){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(t),!1),this.#kn()}_bindJSAction(e,t){e.href=this.linkService.getAnchorUrl("");const a=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const n of Object.keys(t.actions)){const i=a.get(n);i&&(e[i]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t.id,name:n}}),!1))}e.onclick||(e.onclick=()=>!1),this.#kn()}_bindResetFormAction(e,t){const a=e.onclick;if(a||(e.href=this.linkService.getAnchorUrl("")),this.#kn(),!this._fieldObjects)return gye('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),void(a||(e.onclick=()=>!1));e.onclick=()=>{a?.();const{fields:e,refs:n,include:i}=t,r=[];if(0!==e.length||0!==n.length){const t=new Set(n);for(const a of e){const e=this._fieldObjects[a]||[];for(const{id:a}of e)t.add(a)}for(const e of Object.values(this._fieldObjects))for(const a of e)t.has(a.id)===i&&r.push(a)}else for(const e of Object.values(this._fieldObjects))r.push(...e);const o=this.annotationStorage,s=[];for(const e of r){const{id:t}=e;switch(s.push(t),e.type){case"text":{const a=e.defaultValue||"";o.setValue(t,{value:a});break}case"checkbox":case"radiobutton":{const a=e.defaultValue===e.exportValues;o.setValue(t,{value:a});break}case"combobox":case"listbox":{const a=e.defaultValue||"";o.setValue(t,{value:a});break}default:continue}const a=document.querySelector(`[data-element-id="${t}"]`);a&&(Rwe.has(a)?a.dispatchEvent(new Event("resetform")):gye(`_bindResetFormAction - element not allowed: ${t}`))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:s,name:"ResetForm"}}),!1}}}class qwe extends Bwe{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const e=document.createElement("img");return e.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",e.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),e.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(e),this.container}}class Uwe extends Bwe{render(){return this.container}showElementAndHideCanvas(e){this.data.hasOwnCanvas&&("CANVAS"===e.previousSibling?.nodeName&&(e.previousSibling.hidden=!0),e.hidden=!1)}_getKeyModifier(e){return Mye.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,t,a,n,i){a.includes("mouse")?e.addEventListener(a,(e=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:i(e),shift:e.shiftKey,modifier:this._getKeyModifier(e)}})})):e.addEventListener(a,(e=>{if("blur"===a){if(!t.focused||!e.relatedTarget)return;t.focused=!1}else if("focus"===a){if(t.focused)return;t.focused=!0}i&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:i(e)}})}))}_setEventListeners(e,t,a,n){for(const[i,r]of a)("Action"===r||this.data.actions?.[r])&&("Focus"!==r&&"Blur"!==r||(t||={focused:!1}),this._setEventListener(e,t,i,r,n),"Focus"!==r||this.data.actions?.Blur?"Blur"!==r||this.data.actions?.Focus||this._setEventListener(e,t,"focus","Focus",null):this._setEventListener(e,t,"blur","Blur",null))}_setBackgroundColor(e){const t=this.data.backgroundColor||null;e.style.backgroundColor=null===t?"transparent":Iye.makeHexColor(t[0],t[1],t[2])}_setTextStyle(e){const t=["left","center","right"],{fontColor:a}=this.data.defaultAppearanceData,n=this.data.defaultAppearanceData.fontSize||9,i=e.style;let r;const o=e=>Math.round(10*e)/10;if(this.data.multiLine){const e=Math.abs(this.data.rect[3]-this.data.rect[1]-2),t=e/(Math.round(e/(bfe*n))||1);r=Math.min(n,o(t/bfe))}else{const e=Math.abs(this.data.rect[3]-this.data.rect[1]-2);r=Math.min(n,o(e/bfe))}i.fontSize=`calc(${r}px * var(--scale-factor))`,i.color=Iye.makeHexColor(a[0],a[1],a[2]),null!==this.data.textAlignment&&(i.textAlign=t[this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",t)}}class Vwe extends Uwe{constructor(e){super(e,{isRenderable:e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue})}setPropertyOnSiblings(e,t,a,n){const i=this.annotationStorage;for(const r of this._getElementsByName(e.name,e.id))r.domElement&&(r.domElement[t]=a),i.setValue(r.id,{[n]:a})}render(){const e=this.annotationStorage,t=this.data.id;this.container.classList.add("textWidgetAnnotation");let a=null;if(this.renderForms){const n=e.getValue(t,{value:this.data.fieldValue});let i=n.value||"";const r=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;r&&i.length>r&&(i=i.slice(0,r));let o=n.formattedValue||this.data.textContent?.join("\n")||null;o&&this.data.comb&&(o=o.replaceAll(/\s+/g,""));const s={userValue:i,formattedValue:o,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(a=document.createElement("textarea"),a.textContent=o??i,this.data.doNotScroll&&(a.style.overflowY="hidden")):(a=document.createElement("input"),a.type="text",a.setAttribute("value",o??i),this.data.doNotScroll&&(a.style.overflowX="hidden")),this.data.hasOwnCanvas&&(a.hidden=!0),Rwe.add(a),a.setAttribute("data-element-id",t),a.disabled=this.data.readOnly,a.name=this.data.fieldName,a.tabIndex=zwe,this._setRequired(a,this.data.required),r&&(a.maxLength=r),a.addEventListener("input",(n=>{e.setValue(t,{value:n.target.value}),this.setPropertyOnSiblings(a,"value",n.target.value,"value"),s.formattedValue=null})),a.addEventListener("resetform",(e=>{const t=this.data.defaultFieldValue??"";a.value=s.userValue=t,s.formattedValue=null}));let l=e=>{const{formattedValue:t}=s;null!=t&&(e.target.value=t),e.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){a.addEventListener("focus",(e=>{if(s.focused)return;const{target:t}=e;s.userValue&&(t.value=s.userValue),s.lastCommittedValue=t.value,s.commitKey=1,this.data.actions?.Focus||(s.focused=!0)})),a.addEventListener("updatefromsandbox",(a=>{this.showElementAndHideCanvas(a.target);const n={value(a){s.userValue=a.detail.value??"",e.setValue(t,{value:s.userValue.toString()}),a.target.value=s.userValue},formattedValue(a){const{formattedValue:n}=a.detail;s.formattedValue=n,null!=n&&a.target!==document.activeElement&&(a.target.value=n),e.setValue(t,{formattedValue:n})},selRange(e){e.target.setSelectionRange(...e.detail.selRange)},charLimit:a=>{const{charLimit:n}=a.detail,{target:i}=a;if(0===n)return void i.removeAttribute("maxLength");i.setAttribute("maxLength",n);let r=s.userValue;!r||r.length<=n||(r=r.slice(0,n),i.value=s.userValue=r,e.setValue(t,{value:r}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:r,willCommit:!0,commitKey:1,selStart:i.selectionStart,selEnd:i.selectionEnd}}))}};this._dispatchEventFromSandbox(n,a)})),a.addEventListener("keydown",(e=>{s.commitKey=1;let a=-1;if("Escape"===e.key?a=0:"Enter"!==e.key||this.data.multiLine?"Tab"===e.key&&(s.commitKey=3):a=2,-1===a)return;const{value:n}=e.target;s.lastCommittedValue!==n&&(s.lastCommittedValue=n,s.userValue=n,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:n,willCommit:!0,commitKey:a,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}))}));const n=l;l=null,a.addEventListener("blur",(e=>{if(!s.focused||!e.relatedTarget)return;this.data.actions?.Blur||(s.focused=!1);const{value:a}=e.target;s.userValue=a,s.lastCommittedValue!==a&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:a,willCommit:!0,commitKey:s.commitKey,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}),n(e)})),this.data.actions?.Keystroke&&a.addEventListener("beforeinput",(e=>{s.lastCommittedValue=null;const{data:a,target:n}=e,{value:i,selectionStart:r,selectionEnd:o}=n;let l=r,c=o;switch(e.inputType){case"deleteWordBackward":{const e=i.substring(0,r).match(/\w*[^\w]*$/);e&&(l-=e[0].length);break}case"deleteWordForward":{const e=i.substring(r).match(/^[^\w]*\w*/);e&&(c+=e[0].length);break}case"deleteContentBackward":r===o&&(l-=1);break;case"deleteContentForward":r===o&&(c+=1)}e.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:i,change:a||"",willCommit:!1,selStart:l,selEnd:c}})})),this._setEventListeners(a,s,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.value))}if(l&&a.addEventListener("blur",l),this.data.comb){const e=(this.data.rect[2]-this.data.rect[0])/r;a.classList.add("comb"),a.style.letterSpacing=`calc(${e}px * var(--scale-factor) - 1ch)`}}else a=document.createElement("div"),a.textContent=this.data.fieldValue,a.style.verticalAlign="middle",a.style.display="table-cell",this.data.hasOwnCanvas&&(a.hidden=!0);return this._setTextStyle(a),this._setBackgroundColor(a),this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}}class Wwe extends Uwe{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class $we extends Uwe{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,t=this.data,a=t.id;let n=e.getValue(a,{value:t.exportValue===t.fieldValue}).value;"string"==typeof n&&(n="Off"!==n,e.setValue(a,{value:n})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const i=document.createElement("input");return Rwe.add(i),i.setAttribute("data-element-id",a),i.disabled=t.readOnly,this._setRequired(i,this.data.required),i.type="checkbox",i.name=t.fieldName,n&&i.setAttribute("checked",!0),i.setAttribute("exportValue",t.exportValue),i.tabIndex=zwe,i.addEventListener("change",(n=>{const{name:i,checked:r}=n.target;for(const n of this._getElementsByName(i,a)){const a=r&&n.exportValue===t.exportValue;n.domElement&&(n.domElement.checked=a),e.setValue(n.id,{value:a})}e.setValue(a,{value:r})})),i.addEventListener("resetform",(e=>{const a=t.defaultFieldValue||"Off";e.target.checked=a===t.exportValue})),this.enableScripting&&this.hasJSActions&&(i.addEventListener("updatefromsandbox",(t=>{const n={value(t){t.target.checked="Off"!==t.detail.value,e.setValue(a,{value:t.target.checked})}};this._dispatchEventFromSandbox(n,t)})),this._setEventListeners(i,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.checked))),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class Gwe extends Uwe{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const e=this.annotationStorage,t=this.data,a=t.id;let n=e.getValue(a,{value:t.fieldValue===t.buttonValue}).value;if("string"==typeof n&&(n=n!==t.buttonValue,e.setValue(a,{value:n})),n)for(const n of this._getElementsByName(t.fieldName,a))e.setValue(n.id,{value:!1});const i=document.createElement("input");if(Rwe.add(i),i.setAttribute("data-element-id",a),i.disabled=t.readOnly,this._setRequired(i,this.data.required),i.type="radio",i.name=t.fieldName,n&&i.setAttribute("checked",!0),i.tabIndex=zwe,i.addEventListener("change",(t=>{const{name:n,checked:i}=t.target;for(const t of this._getElementsByName(n,a))e.setValue(t.id,{value:!1});e.setValue(a,{value:i})})),i.addEventListener("resetform",(e=>{const a=t.defaultFieldValue;e.target.checked=null!=a&&a===t.buttonValue})),this.enableScripting&&this.hasJSActions){const n=t.buttonValue;i.addEventListener("updatefromsandbox",(t=>{const i={value:t=>{const i=n===t.detail.value;for(const n of this._getElementsByName(t.target.name)){const t=i&&n.id===a;n.domElement&&(n.domElement.checked=t),e.setValue(n.id,{value:t})}}};this._dispatchEventFromSandbox(i,t)})),this._setEventListeners(i,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.checked))}return this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class Kwe extends Hwe{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){const e=super.render();e.classList.add("buttonWidgetAnnotation","pushButton");const t=e.lastChild;return this.enableScripting&&this.hasJSActions&&t&&(this._setDefaultPropertiesFromJS(t),t.addEventListener("updatefromsandbox",(e=>{this._dispatchEventFromSandbox({},e)}))),e}}class Zwe extends Uwe{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const e=this.annotationStorage,t=this.data.id,a=e.getValue(t,{value:this.data.fieldValue}),n=document.createElement("select");Rwe.add(n),n.setAttribute("data-element-id",t),n.disabled=this.data.readOnly,this._setRequired(n,this.data.required),n.name=this.data.fieldName,n.tabIndex=zwe;let i=this.data.combo&&this.data.options.length>0;this.data.combo||(n.size=this.data.options.length,this.data.multiSelect&&(n.multiple=!0)),n.addEventListener("resetform",(e=>{const t=this.data.defaultFieldValue;for(const e of n.options)e.selected=e.value===t}));for(const e of this.data.options){const t=document.createElement("option");t.textContent=e.displayValue,t.value=e.exportValue,a.value.includes(e.exportValue)&&(t.setAttribute("selected",!0),i=!1),n.append(t)}let r=null;if(i){const e=document.createElement("option");e.value=" ",e.setAttribute("hidden",!0),e.setAttribute("selected",!0),n.prepend(e),r=()=>{e.remove(),n.removeEventListener("input",r),r=null},n.addEventListener("input",r)}const o=e=>{const t=e?"value":"textContent",{options:a,multiple:i}=n;return i?Array.prototype.filter.call(a,(e=>e.selected)).map((e=>e[t])):-1===a.selectedIndex?null:a[a.selectedIndex][t]};let s=o(!1);const l=e=>{const t=e.target.options;return Array.prototype.map.call(t,(e=>({displayValue:e.textContent,exportValue:e.value})))};return this.enableScripting&&this.hasJSActions?(n.addEventListener("updatefromsandbox",(a=>{const i={value(a){r?.();const i=a.detail.value,l=new Set(Array.isArray(i)?i:[i]);for(const e of n.options)e.selected=l.has(e.value);e.setValue(t,{value:o(!0)}),s=o(!1)},multipleSelection(e){n.multiple=!0},remove(a){const i=n.options,r=a.detail.remove;if(i[r].selected=!1,n.remove(r),i.length>0){-1===Array.prototype.findIndex.call(i,(e=>e.selected))&&(i[0].selected=!0)}e.setValue(t,{value:o(!0),items:l(a)}),s=o(!1)},clear(a){for(;0!==n.length;)n.remove(0);e.setValue(t,{value:null,items:[]}),s=o(!1)},insert(a){const{index:i,displayValue:r,exportValue:c}=a.detail.insert,u=n.children[i],d=document.createElement("option");d.textContent=r,d.value=c,u?u.before(d):n.append(d),e.setValue(t,{value:o(!0),items:l(a)}),s=o(!1)},items(a){const{items:i}=a.detail;for(;0!==n.length;)n.remove(0);for(const e of i){const{displayValue:t,exportValue:a}=e,i=document.createElement("option");i.textContent=t,i.value=a,n.append(i)}n.options.length>0&&(n.options[0].selected=!0),e.setValue(t,{value:o(!0),items:l(a)}),s=o(!1)},indices(a){const n=new Set(a.detail.indices);for(const e of a.target.options)e.selected=n.has(e.index);e.setValue(t,{value:o(!0)}),s=o(!1)},editable(e){e.target.disabled=!e.detail.editable}};this._dispatchEventFromSandbox(i,a)})),n.addEventListener("input",(a=>{const n=o(!0),i=o(!1);e.setValue(t,{value:n}),a.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:s,change:i,changeEx:n,willCommit:!1,commitKey:1,keyDown:!1}})})),this._setEventListeners(n,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],(e=>e.target.value))):n.addEventListener("input",(function(a){e.setValue(t,{value:o(!0)})})),this.data.combo&&this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class Ywe extends Bwe{constructor(e){const{data:t,elements:a}=e;super(e,{isRenderable:Bwe._hasPopupData(t)}),this.elements=a,this.popup=null}render(){this.container.classList.add("popupAnnotation");const e=this.popup=new Xwe({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open}),t=[];for(const a of this.elements)a.popup=e,a.container.ariaHasPopup="dialog",t.push(a.data.id),a.addHighlightArea();return this.container.setAttribute("aria-controls",t.map((e=>`${Rye}${e}`)).join(",")),this.container}}class Xwe{#An=this.#Sn.bind(this);#En=this.#_n.bind(this);#Cn=this.#Tn.bind(this);#Pn=this.#On.bind(this);#Mn=null;#he=null;#Dn=null;#In=null;#Nn=null;#jn=null;#zn=null;#Rn=!1;#Ln=null;#_=null;#Fn=null;#Bn=null;#Hn=null;#fn=null;#qn=!1;constructor({container:e,color:t,elements:a,titleObj:n,modificationDate:i,contentsObj:r,richText:o,parent:s,rect:l,parentRect:c,open:u}){this.#he=e,this.#Hn=n,this.#Dn=r,this.#Bn=o,this.#jn=s,this.#Mn=t,this.#Fn=l,this.#zn=c,this.#Nn=a,this.#In=ove.toDateObject(i),this.trigger=a.flatMap((e=>e.getElementsToTriggerPopup()));for(const e of this.trigger)e.addEventListener("click",this.#Pn),e.addEventListener("mouseenter",this.#Cn),e.addEventListener("mouseleave",this.#En),e.classList.add("popupTriggerArea");for(const e of a)e.container?.addEventListener("keydown",this.#An);this.#he.hidden=!0,u&&this.#On()}render(){if(this.#Ln)return;const e=this.#Ln=document.createElement("div");if(e.className="popup",this.#Mn){const t=e.style.outlineColor=Iye.makeHexColor(...this.#Mn);if(CSS.supports("background-color","color-mix(in srgb, red 30%, white)"))e.style.backgroundColor=`color-mix(in srgb, ${t} 30%, white)`;else{const t=.7;e.style.backgroundColor=Iye.makeHexColor(...this.#Mn.map((e=>Math.floor(t*(255-e)+e))))}}const t=document.createElement("span");t.className="header";const a=document.createElement("h1");if(t.append(a),({dir:a.dir,str:a.textContent}=this.#Hn),e.append(t),this.#In){const e=document.createElement("span");e.classList.add("popupDate"),e.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),e.setAttribute("data-l10n-args",JSON.stringify({dateObj:this.#In.valueOf()})),t.append(e)}const n=this.#Un;if(n)jwe.render({xfaHtml:n,intent:"richText",div:e}),e.lastChild.classList.add("richText","popupContent");else{const t=this._formatContents(this.#Dn);e.append(t)}this.#he.append(e)}get#Un(){const e=this.#Bn,t=this.#Dn;return!e?.str||t?.str&&t.str!==e.str?null:this.#Bn.html||null}get#Vn(){return this.#Un?.attributes?.style?.fontSize||0}get#Wn(){return this.#Un?.attributes?.style?.color||null}#$n(e){const t=[],a={str:e,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:t}]}},n={style:{color:this.#Wn,fontSize:this.#Vn?`calc(${this.#Vn}px * var(--scale-factor))`:""}};for(const a of e.split("\n"))t.push({name:"span",value:a,attributes:n});return a}_formatContents({str:e,dir:t}){const a=document.createElement("p");a.classList.add("popupContent"),a.dir=t;const n=e.split(/(?:\r\n?|\n)/);for(let e=0,t=n.length;e<t;++e){const i=n[e];a.append(document.createTextNode(i)),e<t-1&&a.append(document.createElement("br"))}return a}#Sn(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||("Enter"===e.key||"Escape"===e.key&&this.#Rn)&&this.#On()}updateEdited({rect:e,popupContent:t}){this.#fn||={contentsObj:this.#Dn,richText:this.#Bn},e&&(this.#_=null),t&&(this.#Bn=this.#$n(t),this.#Dn=null),this.#Ln?.remove(),this.#Ln=null}resetEdited(){this.#fn&&(({contentsObj:this.#Dn,richText:this.#Bn}=this.#fn),this.#fn=null,this.#Ln?.remove(),this.#Ln=null,this.#_=null)}#Gn(){if(null!==this.#_)return;const{page:{view:e},viewport:{rawDims:{pageWidth:t,pageHeight:a,pageX:n,pageY:i}}}=this.#jn;let r=!!this.#zn,o=r?this.#zn:this.#Fn;for(const e of this.#Nn)if(!o||null!==Iye.intersect(e.data.rect,o)){o=e.data.rect,r=!0;break}const s=Iye.normalizeRect([o[0],e[3]-o[1]+e[1],o[2],e[3]-o[3]+e[1]]),l=r?o[2]-o[0]+5:0,c=s[0]+l,u=s[1];this.#_=[100*(c-n)/t,100*(u-i)/a];const{style:d}=this.#he;d.left=`${this.#_[0]}%`,d.top=`${this.#_[1]}%`}#On(){this.#Rn=!this.#Rn,this.#Rn?(this.#Tn(),this.#he.addEventListener("click",this.#Pn),this.#he.addEventListener("keydown",this.#An)):(this.#_n(),this.#he.removeEventListener("click",this.#Pn),this.#he.removeEventListener("keydown",this.#An))}#Tn(){this.#Ln||this.render(),this.isVisible?this.#Rn&&this.#he.classList.add("focused"):(this.#Gn(),this.#he.hidden=!1,this.#he.style.zIndex=parseInt(this.#he.style.zIndex)+1e3)}#_n(){this.#he.classList.remove("focused"),!this.#Rn&&this.isVisible&&(this.#he.hidden=!0,this.#he.style.zIndex=parseInt(this.#he.style.zIndex)-1e3)}forceHide(){this.#qn=this.isVisible,this.#qn&&(this.#he.hidden=!0)}maybeShow(){this.#qn&&(this.#Ln||this.#Tn(),this.#qn=!1,this.#he.hidden=!1)}get isVisible(){return!1===this.#he.hidden}}class Qwe extends Bwe{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=Pfe.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const e=document.createElement("div");e.classList.add("annotationTextContent"),e.setAttribute("role","comment");for(const t of this.textContent){const a=document.createElement("span");a.textContent=t,e.append(a)}this.container.append(e)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}class Jwe extends Bwe{#Kn=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");const e=this.data,{width:t,height:a}=Lwe(e.rect),n=this.svgFactory.create(t,a,!0),i=this.#Kn=this.svgFactory.createElement("svg:line");return i.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),i.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),i.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),i.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),i.setAttribute("stroke-width",e.borderStyle.width||1),i.setAttribute("stroke","transparent"),i.setAttribute("fill","transparent"),n.append(i),this.container.append(n),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#Kn}addHighlightArea(){this.container.classList.add("highlightArea")}}class exe extends Bwe{#Zn=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");const e=this.data,{width:t,height:a}=Lwe(e.rect),n=this.svgFactory.create(t,a,!0),i=e.borderStyle.width,r=this.#Zn=this.svgFactory.createElement("svg:rect");return r.setAttribute("x",i/2),r.setAttribute("y",i/2),r.setAttribute("width",t-i),r.setAttribute("height",a-i),r.setAttribute("stroke-width",i||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),n.append(r),this.container.append(n),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#Zn}addHighlightArea(){this.container.classList.add("highlightArea")}}class txe extends Bwe{#Yn=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");const e=this.data,{width:t,height:a}=Lwe(e.rect),n=this.svgFactory.create(t,a,!0),i=e.borderStyle.width,r=this.#Yn=this.svgFactory.createElement("svg:ellipse");return r.setAttribute("cx",t/2),r.setAttribute("cy",a/2),r.setAttribute("rx",t/2-i/2),r.setAttribute("ry",a/2-i/2),r.setAttribute("stroke-width",i||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),n.append(r),this.container.append(n),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#Yn}addHighlightArea(){this.container.classList.add("highlightArea")}}class axe extends Bwe{#Xn=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,vertices:t,borderStyle:a,popupRef:n}}=this;if(!t)return this.container;const{width:i,height:r}=Lwe(e),o=this.svgFactory.create(i,r,!0);let s=[];for(let a=0,n=t.length;a<n;a+=2){const n=t[a]-e[0],i=e[3]-t[a+1];s.push(`${n},${i}`)}s=s.join(" ");const l=this.#Xn=this.svgFactory.createElement(this.svgElementName);return l.setAttribute("points",s),l.setAttribute("stroke-width",a.width||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),o.append(l),this.container.append(o),!n&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#Xn}addHighlightArea(){this.container.classList.add("highlightArea")}}class nxe extends axe{constructor(e){super(e),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class ixe extends Bwe{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}class rxe extends Bwe{#Qn=[];constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType="InkHighlight"===this.data.it?Pfe.HIGHLIGHT:Pfe.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,inkLists:t,borderStyle:a,popupRef:n}}=this,{width:i,height:r}=Lwe(e),o=this.svgFactory.create(i,r,!0);for(const n of t){let t=[];for(let a=0,i=n.length;a<i;a+=2){const i=n[a]-e[0],r=e[3]-n[a+1];t.push(`${i},${r}`)}t=t.join(" ");const i=this.svgFactory.createElement(this.svgElementName);this.#Qn.push(i),i.setAttribute("points",t),i.setAttribute("stroke-width",a.width||1),i.setAttribute("stroke","transparent"),i.setAttribute("fill","transparent"),o.append(i)}return!n&&this.hasPopupData&&this._createPopup(),this.container.append(o),this._editOnDoubleClick(),this.container}getElementsToTriggerPopup(){return this.#Qn}addHighlightArea(){this.container.classList.add("highlightArea")}}class oxe extends Bwe{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=Pfe.HIGHLIGHT}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),this.container}}class sxe extends Bwe{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class lxe extends Bwe{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class cxe extends Bwe{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class uxe extends Bwe{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=Pfe.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}class dxe extends Bwe{#Jn=null;constructor(e){super(e,{isRenderable:!0});const{file:t}=this.data;this.filename=t.filename,this.content=t.content,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,...t})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:e,data:t}=this;let a;t.hasAppearance||0===t.fillAlpha?a=document.createElement("div"):(a=document.createElement("img"),a.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(t.name)?"paperclip":"pushpin"}.svg`,t.fillAlpha&&t.fillAlpha<1&&(a.style=`filter: opacity(${Math.round(100*t.fillAlpha)}%);`)),a.addEventListener("dblclick",this.#ei.bind(this)),this.#Jn=a;const{isMac:n}=Mye.platform;return e.addEventListener("keydown",(e=>{"Enter"===e.key&&(n?e.metaKey:e.ctrlKey)&&this.#ei()})),!t.popupRef&&this.hasPopupData?this._createPopup():a.classList.add("popupTriggerArea"),e.append(a),e}getElementsToTriggerPopup(){return this.#Jn}addHighlightArea(){this.container.classList.add("highlightArea")}#ei(){this.downloadManager?.openOrDownloadData(this.content,this.filename)}}let hxe=class{#ti=null;#ai=null;#ni=new Map;#ii=null;constructor({div:e,accessibilityManager:t,annotationCanvasMap:a,annotationEditorUIManager:n,page:i,viewport:r,structTreeLayer:o}){this.div=e,this.#ti=t,this.#ai=a,this.#ii=o||null,this.page=i,this.viewport=r,this.zIndex=0,this._annotationEditorUIManager=n}hasEditableAnnotations(){return this.#ni.size>0}async#ri(e,t){const a=e.firstChild||e,n=a.id=`${Rye}${t}`,i=await(this.#ii?.getAriaAttributes(n));if(i)for(const[e,t]of i)a.setAttribute(e,t);this.div.append(e),this.#ti?.moveElementInDOM(this.div,e,a,!1)}async render(e){const{annotations:t}=e,a=this.div;dve(a,this.viewport);const n=new Map,i={data:null,layer:a,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:!1!==e.renderForms,svgFactory:new Nwe,annotationStorage:e.annotationStorage||new Ove,enableScripting:!0===e.enableScripting,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(const e of t){if(e.noHTML)continue;const t=e.annotationType===eye;if(t){const t=n.get(e.id);if(!t)continue;i.elements=t}else{const{width:t,height:a}=Lwe(e.rect);if(t<=0||a<=0)continue}i.data=e;const a=Fwe.create(i);if(!a.isRenderable)continue;if(!t&&e.popupRef){const t=n.get(e.popupRef);t?t.push(a):n.set(e.popupRef,[a])}const r=a.render();e.hidden&&(r.style.visibility="hidden"),await this.#ri(r,e.id),a._isEditable&&(this.#ni.set(a.data.id,a),this._annotationEditorUIManager?.renderAnnotationElement(a))}this.#oi()}update({viewport:e}){const t=this.div;this.viewport=e,dve(t,{rotation:e.rotation}),this.#oi(),t.hidden=!1}#oi(){if(!this.#ai)return;const e=this.div;for(const[t,a]of this.#ai){const n=e.querySelector(`[data-annotation-id="${t}"]`);if(!n)continue;a.className="annotationContent";const{firstChild:i}=n;i?"CANVAS"===i.nodeName?i.replaceWith(a):i.classList.contains("annotationContent")?i.after(a):i.before(a):n.append(a)}this.#ai.clear()}getEditableAnnotations(){return Array.from(this.#ni.values())}getEditableAnnotation(e){return this.#ni.get(e)}};const mxe=/\r\n?|\n/g;class pxe extends Ave{#Mn;#si="";#li=`${this.id}-editor`;#ci=null;#Vn;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){const e=pxe.prototype,t=e=>e.isEmpty(),a=xve.TRANSLATE_SMALL,n=xve.TRANSLATE_BIG;return bye(this,"_keyboardManager",new bve([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],e.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],e.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],e._translateEmpty,{args:[-a,0],checker:t}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e._translateEmpty,{args:[-n,0],checker:t}],[["ArrowRight","mac+ArrowRight"],e._translateEmpty,{args:[a,0],checker:t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[n,0],checker:t}],[["ArrowUp","mac+ArrowUp"],e._translateEmpty,{args:[0,-a],checker:t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-n],checker:t}],[["ArrowDown","mac+ArrowDown"],e._translateEmpty,{args:[0,a],checker:t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,n],checker:t}]]))}static _type="freetext";static _editorType=Pfe.FREETEXT;constructor(e){super({...e,name:"freeTextEditor"}),this.#Mn=e.color||pxe._defaultColor||Ave._defaultLineColor,this.#Vn=e.fontSize||pxe._defaultFontSize}static initialize(e,t){Ave.initialize(e,t);const a=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(a.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,t){switch(e){case Ofe.FREETEXT_SIZE:pxe._defaultFontSize=t;break;case Ofe.FREETEXT_COLOR:pxe._defaultColor=t}}updateParams(e,t){switch(e){case Ofe.FREETEXT_SIZE:this.#ui(t);break;case Ofe.FREETEXT_COLOR:this.#di(t)}}static get defaultPropertiesToUpdate(){return[[Ofe.FREETEXT_SIZE,pxe._defaultFontSize],[Ofe.FREETEXT_COLOR,pxe._defaultColor||Ave._defaultLineColor]]}get propertiesToUpdate(){return[[Ofe.FREETEXT_SIZE,this.#Vn],[Ofe.FREETEXT_COLOR,this.#Mn]]}#ui(e){const t=e=>{this.editorDiv.style.fontSize=`calc(${e}px * var(--scale-factor))`,this.translate(0,-(e-this.#Vn)*this.parentScale),this.#Vn=e,this.#hi()},a=this.#Vn;this.addCommands({cmd:t.bind(this,e),undo:t.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Ofe.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#di(e){const t=e=>{this.#Mn=this.editorDiv.style.color=e},a=this.#Mn;this.addCommands({cmd:t.bind(this,e),undo:t.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Ofe.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(e,t){this._uiManager.translateSelectedEditors(e,t,!0)}getInitialTranslation(){const e=this.parentScale;return[-pxe._internalPadding*e,-(pxe._internalPadding+this.#Vn)*e]}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(this.isInEditMode())return;this.parent.setEditingState(!1),this.parent.updateToolbar(Pfe.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),this.#ci=new AbortController;const e=this._uiManager.combinedSignal(this.#ci);this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:e}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:e}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:e}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:e}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:e})}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#li),this._isDraggable=!0,this.#ci?.abort(),this.#ci=null,this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){this.width||(this.enableEditMode(),this.editorDiv.focus(),this._initialOptions?.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||""===this.editorDiv.innerText.trim()}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}#mi(){const e=[];this.editorDiv.normalize();let t=null;for(const a of this.editorDiv.childNodes)t?.nodeType===Node.TEXT_NODE&&"BR"===a.nodeName||(e.push(pxe.#pi(a)),t=a);return e.join("\n")}#hi(){const[e,t]=this.parentDimensions;let a;if(this.isAttachedToDOM)a=this.div.getBoundingClientRect();else{const{currentLayer:e,div:t}=this,n=t.style.display,i=t.classList.contains("hidden");t.classList.remove("hidden"),t.style.display="hidden",e.div.append(this.div),a=t.getBoundingClientRect(),t.remove(),t.style.display=n,t.classList.toggle("hidden",i)}this.rotation%180==this.parentRotation%180?(this.width=a.width/e,this.height=a.height/t):(this.width=a.height/e,this.height=a.width/t),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const e=this.#si,t=this.#si=this.#mi().trimEnd();if(e===t)return;const a=e=>{this.#si=e,e?(this.#gi(),this._uiManager.rebuild(this),this.#hi()):this.remove()};this.addCommands({cmd:()=>{a(t)},undo:()=>{a(e)},mustExec:!1}),this.#hi()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(e){this.enterInEditMode()}keydown(e){e.target===this.div&&"Enter"===e.key&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(e){pxe._keyboardManager.exec(this,e)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){if(this.div)return this.div;let e,t;this.width&&(e=this.x,t=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",this.#li),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;const{style:a}=this.editorDiv;if(a.fontSize=`calc(${this.#Vn}px * var(--scale-factor))`,a.color=this.#Mn,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),gve(this,this.div,["dblclick","keydown"]),this.width){const[a,n]=this.parentDimensions;if(this.annotationElementId){const{position:i}=this._initialData;let[r,o]=this.getInitialTranslation();[r,o]=this.pageTranslationToScreen(r,o);const[s,l]=this.pageDimensions,[c,u]=this.pageTranslation;let d,h;switch(this.rotation){case 0:d=e+(i[0]-c)/s,h=t+this.height-(i[1]-u)/l;break;case 90:d=e+(i[0]-c)/s,h=t-(i[1]-u)/l,[r,o]=[o,-r];break;case 180:d=e-this.width+(i[0]-c)/s,h=t-(i[1]-u)/l,[r,o]=[-r,-o];break;case 270:d=e+(i[0]-c-this.height*l)/s,h=t+(i[1]-u-this.width*s)/l,[r,o]=[-o,r]}this.setAt(d*a,h*n,r,o)}else this.setAt(e*a,t*n,this.width*a,this.height*n);this.#gi(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}static#pi(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(mxe,"")}editorDivPaste(e){const t=e.clipboardData||window.clipboardData,{types:a}=t;if(1===a.length&&"text/plain"===a[0])return;e.preventDefault();const n=pxe.#fi(t.getData("text")||"").replaceAll(mxe,"\n");if(!n)return;const i=window.getSelection();if(!i.rangeCount)return;this.editorDiv.normalize(),i.deleteFromDocument();const r=i.getRangeAt(0);if(!n.includes("\n"))return r.insertNode(document.createTextNode(n)),this.editorDiv.normalize(),void i.collapseToStart();const{startContainer:o,startOffset:s}=r,l=[],c=[];if(o.nodeType===Node.TEXT_NODE){const e=o.parentElement;if(c.push(o.nodeValue.slice(s).replaceAll(mxe,"")),e!==this.editorDiv){let t=l;for(const a of this.editorDiv.childNodes)a!==e?t.push(pxe.#pi(a)):t=c}l.push(o.nodeValue.slice(0,s).replaceAll(mxe,""))}else if(o===this.editorDiv){let e=l,t=0;for(const a of this.editorDiv.childNodes)t++===s&&(e=c),e.push(pxe.#pi(a))}this.#si=`${l.join("\n")}${n}${c.join("\n")}`,this.#gi();const u=new Range;let d=l.reduce(((e,t)=>e+t.length),0);for(const{firstChild:e}of this.editorDiv.childNodes)if(e.nodeType===Node.TEXT_NODE){const t=e.nodeValue.length;if(d<=t){u.setStart(e,d),u.setEnd(e,d);break}d-=t}i.removeAllRanges(),i.addRange(u)}#gi(){if(this.editorDiv.replaceChildren(),this.#si)for(const e of this.#si.split("\n")){const t=document.createElement("div");t.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(t)}}#yi(){return this.#si.replaceAll(" "," ")}static#fi(e){return e.replaceAll(" "," ")}get contentDiv(){return this.editorDiv}static async deserialize(e,t,a){let n=null;if(e instanceof Qwe){const{data:{defaultAppearanceData:{fontSize:t,fontColor:a},rect:i,rotation:r,id:o,popupRef:s},textContent:l,textPosition:c,parent:{page:{pageNumber:u}}}=e;if(!l||0===l.length)return null;n=e={annotationType:Pfe.FREETEXT,color:Array.from(a),fontSize:t,value:l.join("\n"),position:c,pageIndex:u-1,rect:i.slice(0),rotation:r,id:o,deleted:!1,popupRef:s}}const i=await super.deserialize(e,t,a);return i.#Vn=e.fontSize,i.#Mn=Iye.makeHexColor(...e.color),i.#si=pxe.#fi(e.value),i.annotationElementId=e.id||null,i._initialData=n,i}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const t=pxe._internalPadding*this.parentScale,a=this.getRect(t,t),n=Ave._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.#Mn),i={annotationType:Pfe.FREETEXT,color:n,fontSize:this.#Vn,value:this.#yi(),pageIndex:this.pageIndex,rect:a,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return e?i:this.annotationElementId&&!this.#vi(i)?null:(i.id=this.annotationElementId,i)}#vi(e){const{value:t,fontSize:a,color:n,pageIndex:i}=this._initialData;return this._hasBeenMoved||e.value!==t||e.fontSize!==a||e.color.some(((e,t)=>e!==n[t]))||e.pageIndex!==i}renderAnnotationElement(e){const t=super.renderAnnotationElement(e);if(this.deleted)return t;const{style:a}=t;a.fontSize=`calc(${this.#Vn}px * var(--scale-factor))`,a.color=this.#Mn,t.replaceChildren();for(const e of this.#si.split("\n")){const a=document.createElement("div");a.append(e?document.createTextNode(e):document.createElement("br")),t.append(a)}const n=pxe._internalPadding*this.parentScale;return e.updateEdited({rect:this.getRect(n,n),popupContent:this.#si}),t}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}}class gxe{toSVGPath(){fye("Abstract method `toSVGPath` must be implemented.")}get box(){fye("Abstract getter `box` must be implemented.")}serialize(e,t){fye("Abstract method `serialize` must be implemented.")}get classNamesForDrawing(){fye("Abstract getter `classNamesForDrawing` must be implemented.")}get classNamesForOutlining(){fye("Abstract getter `classNamesForOutlining` must be implemented.")}get mustRemoveSelfIntersections(){return!1}}class fxe{#bi;#wi=[];#xi;#ki;#Ai=[];#Si=new Float64Array(18);#Ei;#_i;#Ci;#Ti;#Pi;#Oi;#Mi=[];static#Di=8;static#Ii=2;static#Ni=fxe.#Di+fxe.#Ii;constructor({x:e,y:t},a,n,i,r,o=0){this.#bi=a,this.#Oi=i*n,this.#ki=r,this.#Si.set([NaN,NaN,NaN,NaN,e,t],6),this.#xi=o,this.#Ti=fxe.#Di*n,this.#Ci=fxe.#Ni*n,this.#Pi=n,this.#Mi.push(e,t)}isEmpty(){return isNaN(this.#Si[8])}#ji(){const e=this.#Si.subarray(4,6),t=this.#Si.subarray(16,18),[a,n,i,r]=this.#bi;return[(this.#Ei+(e[0]-t[0])/2-a)/i,(this.#_i+(e[1]-t[1])/2-n)/r,(this.#Ei+(t[0]-e[0])/2-a)/i,(this.#_i+(t[1]-e[1])/2-n)/r]}add({x:e,y:t}){this.#Ei=e,this.#_i=t;const[a,n,i,r]=this.#bi;let[o,s,l,c]=this.#Si.subarray(8,12);const u=e-l,d=t-c,h=Math.hypot(u,d);if(h<this.#Ci)return!1;const m=h-this.#Ti,p=m/h,g=p*u,f=p*d;let y=o,v=s;o=l,s=c,l+=g,c+=f,this.#Mi?.push(e,t);const b=g/m,w=-f/m*this.#Oi,x=b*this.#Oi;if(this.#Si.set(this.#Si.subarray(2,8),0),this.#Si.set([l+w,c+x],4),this.#Si.set(this.#Si.subarray(14,18),12),this.#Si.set([l-w,c-x],16),isNaN(this.#Si[6]))return 0===this.#Ai.length&&(this.#Si.set([o+w,s+x],2),this.#Ai.push(NaN,NaN,NaN,NaN,(o+w-a)/i,(s+x-n)/r),this.#Si.set([o-w,s-x],14),this.#wi.push(NaN,NaN,NaN,NaN,(o-w-a)/i,(s-x-n)/r)),this.#Si.set([y,v,o,s,l,c],6),!this.isEmpty();this.#Si.set([y,v,o,s,l,c],6);return Math.abs(Math.atan2(v-s,y-o)-Math.atan2(f,g))<Math.PI/2?([o,s,l,c]=this.#Si.subarray(2,6),this.#Ai.push(NaN,NaN,NaN,NaN,((o+l)/2-a)/i,((s+c)/2-n)/r),[o,s,y,v]=this.#Si.subarray(14,18),this.#wi.push(NaN,NaN,NaN,NaN,((y+o)/2-a)/i,((v+s)/2-n)/r),!0):([y,v,o,s,l,c]=this.#Si.subarray(0,6),this.#Ai.push(((y+5*o)/6-a)/i,((v+5*s)/6-n)/r,((5*o+l)/6-a)/i,((5*s+c)/6-n)/r,((o+l)/2-a)/i,((s+c)/2-n)/r),[l,c,o,s,y,v]=this.#Si.subarray(12,18),this.#wi.push(((y+5*o)/6-a)/i,((v+5*s)/6-n)/r,((5*o+l)/6-a)/i,((5*s+c)/6-n)/r,((o+l)/2-a)/i,((s+c)/2-n)/r),!0)}toSVGPath(){if(this.isEmpty())return"";const e=this.#Ai,t=this.#wi;if(isNaN(this.#Si[6])&&!this.isEmpty())return this.#zi();const a=[];a.push(`M${e[4]} ${e[5]}`);for(let t=6;t<e.length;t+=6)isNaN(e[t])?a.push(`L${e[t+4]} ${e[t+5]}`):a.push(`C${e[t]} ${e[t+1]} ${e[t+2]} ${e[t+3]} ${e[t+4]} ${e[t+5]}`);this.#Ri(a);for(let e=t.length-6;e>=6;e-=6)isNaN(t[e])?a.push(`L${t[e+4]} ${t[e+5]}`):a.push(`C${t[e]} ${t[e+1]} ${t[e+2]} ${t[e+3]} ${t[e+4]} ${t[e+5]}`);return this.#Li(a),a.join(" ")}#zi(){const[e,t,a,n]=this.#bi,[i,r,o,s]=this.#ji();return`M${(this.#Si[2]-e)/a} ${(this.#Si[3]-t)/n} L${(this.#Si[4]-e)/a} ${(this.#Si[5]-t)/n} L${i} ${r} L${o} ${s} L${(this.#Si[16]-e)/a} ${(this.#Si[17]-t)/n} L${(this.#Si[14]-e)/a} ${(this.#Si[15]-t)/n} Z`}#Li(e){const t=this.#wi;e.push(`L${t[4]} ${t[5]} Z`)}#Ri(e){const[t,a,n,i]=this.#bi,r=this.#Si.subarray(4,6),o=this.#Si.subarray(16,18),[s,l,c,u]=this.#ji();e.push(`L${(r[0]-t)/n} ${(r[1]-a)/i} L${s} ${l} L${c} ${u} L${(o[0]-t)/n} ${(o[1]-a)/i}`)}newFreeDrawOutline(e,t,a,n,i,r){return new yxe(e,t,a,n,i,r)}getOutlines(){const e=this.#Ai,t=this.#wi,a=this.#Si,[n,i,r,o]=this.#bi,s=new Float64Array((this.#Mi?.length??0)+2);for(let e=0,t=s.length-2;e<t;e+=2)s[e]=(this.#Mi[e]-n)/r,s[e+1]=(this.#Mi[e+1]-i)/o;if(s[s.length-2]=(this.#Ei-n)/r,s[s.length-1]=(this.#_i-i)/o,isNaN(a[6])&&!this.isEmpty())return this.#Fi(s);const l=new Float64Array(this.#Ai.length+24+this.#wi.length);let c=e.length;for(let t=0;t<c;t+=2)isNaN(e[t])?l[t]=l[t+1]=NaN:(l[t]=e[t],l[t+1]=e[t+1]);c=this.#Bi(l,c);for(let e=t.length-6;e>=6;e-=6)for(let a=0;a<6;a+=2)isNaN(t[e+a])?(l[c]=l[c+1]=NaN,c+=2):(l[c]=t[e+a],l[c+1]=t[e+a+1],c+=2);return this.#Hi(l,c),this.newFreeDrawOutline(l,s,this.#bi,this.#Pi,this.#xi,this.#ki)}#Fi(e){const t=this.#Si,[a,n,i,r]=this.#bi,[o,s,l,c]=this.#ji(),u=new Float64Array(36);return u.set([NaN,NaN,NaN,NaN,(t[2]-a)/i,(t[3]-n)/r,NaN,NaN,NaN,NaN,(t[4]-a)/i,(t[5]-n)/r,NaN,NaN,NaN,NaN,o,s,NaN,NaN,NaN,NaN,l,c,NaN,NaN,NaN,NaN,(t[16]-a)/i,(t[17]-n)/r,NaN,NaN,NaN,NaN,(t[14]-a)/i,(t[15]-n)/r],0),this.newFreeDrawOutline(u,e,this.#bi,this.#Pi,this.#xi,this.#ki)}#Hi(e,t){const a=this.#wi;return e.set([NaN,NaN,NaN,NaN,a[4],a[5]],t),t+6}#Bi(e,t){const a=this.#Si.subarray(4,6),n=this.#Si.subarray(16,18),[i,r,o,s]=this.#bi,[l,c,u,d]=this.#ji();return e.set([NaN,NaN,NaN,NaN,(a[0]-i)/o,(a[1]-r)/s,NaN,NaN,NaN,NaN,l,c,NaN,NaN,NaN,NaN,u,d,NaN,NaN,NaN,NaN,(n[0]-i)/o,(n[1]-r)/s],t),t+24}}class yxe extends gxe{#bi;#qi=null;#xi;#ki;#Mi;#Pi;#Ui;constructor(e,t,a,n,i,r){super(),this.#Ui=e,this.#Mi=t,this.#bi=a,this.#Pi=n,this.#xi=i,this.#ki=r,this.#Vi(r);const{x:o,y:s,width:l,height:c}=this.#qi;for(let t=0,a=e.length;t<a;t+=2)e[t]=(e[t]-o)/l,e[t+1]=(e[t+1]-s)/c;for(let e=0,a=t.length;e<a;e+=2)t[e]=(t[e]-o)/l,t[e+1]=(t[e+1]-s)/c}toSVGPath(){const e=[`M${this.#Ui[4]} ${this.#Ui[5]}`];for(let t=6,a=this.#Ui.length;t<a;t+=6)isNaN(this.#Ui[t])?e.push(`L${this.#Ui[t+4]} ${this.#Ui[t+5]}`):e.push(`C${this.#Ui[t]} ${this.#Ui[t+1]} ${this.#Ui[t+2]} ${this.#Ui[t+3]} ${this.#Ui[t+4]} ${this.#Ui[t+5]}`);return e.push("Z"),e.join(" ")}serialize([e,t,a,n],i){const r=a-e,o=n-t;let s,l;switch(i){case 0:s=this.#Wi(this.#Ui,e,n,r,-o),l=this.#Wi(this.#Mi,e,n,r,-o);break;case 90:s=this.#$i(this.#Ui,e,t,r,o),l=this.#$i(this.#Mi,e,t,r,o);break;case 180:s=this.#Wi(this.#Ui,a,t,-r,o),l=this.#Wi(this.#Mi,a,t,-r,o);break;case 270:s=this.#$i(this.#Ui,a,n,-r,-o),l=this.#$i(this.#Mi,a,n,-r,-o)}return{outline:Array.from(s),points:[Array.from(l)]}}#Wi(e,t,a,n,i){const r=new Float64Array(e.length);for(let o=0,s=e.length;o<s;o+=2)r[o]=t+e[o]*n,r[o+1]=a+e[o+1]*i;return r}#$i(e,t,a,n,i){const r=new Float64Array(e.length);for(let o=0,s=e.length;o<s;o+=2)r[o]=t+e[o+1]*n,r[o+1]=a+e[o]*i;return r}#Vi(e){const t=this.#Ui;let a=t[4],n=t[5],i=a,r=n,o=a,s=n,l=a,c=n;const u=e?Math.max:Math.min;for(let e=6,d=t.length;e<d;e+=6){if(isNaN(t[e]))i=Math.min(i,t[e+4]),r=Math.min(r,t[e+5]),o=Math.max(o,t[e+4]),s=Math.max(s,t[e+5]),c<t[e+5]?(l=t[e+4],c=t[e+5]):c===t[e+5]&&(l=u(l,t[e+4]));else{const d=Iye.bezierBoundingBox(a,n,...t.slice(e,e+6));i=Math.min(i,d[0]),r=Math.min(r,d[1]),o=Math.max(o,d[2]),s=Math.max(s,d[3]),c<d[3]?(l=d[2],c=d[3]):c===d[3]&&(l=u(l,d[2]))}a=t[e+4],n=t[e+5]}const d=i-this.#xi,h=r-this.#xi,m=o-i+2*this.#xi,p=s-r+2*this.#xi;this.#qi={x:d,y:h,width:m,height:p,lastPoint:[l,c]}}get box(){return this.#qi}newOutliner(e,t,a,n,i,r=0){return new fxe(e,t,a,n,i,r)}getNewOutline(e,t){const{x:a,y:n,width:i,height:r}=this.#qi,[o,s,l,c]=this.#bi,u=i*l,d=r*c,h=a*l+o,m=n*c+s,p=this.newOutliner({x:this.#Mi[0]*u+h,y:this.#Mi[1]*d+m},this.#bi,this.#Pi,e,this.#ki,t??this.#xi);for(let e=2;e<this.#Mi.length;e+=2)p.add({x:this.#Mi[e]*u+h,y:this.#Mi[e+1]*d+m});return p.getOutlines()}get mustRemoveSelfIntersections(){return!0}}class vxe{#bi;#Gi=[];#Ki=[];constructor(e,t=0,a=0,n=!0){let i=1/0,r=-1/0,o=1/0,s=-1/0;const l=10**-4;for(const{x:a,y:n,width:c,height:u}of e){const e=Math.floor((a-t)/l)*l,d=Math.ceil((a+c+t)/l)*l,h=Math.floor((n-t)/l)*l,m=Math.ceil((n+u+t)/l)*l,p=[e,h,m,!0],g=[d,h,m,!1];this.#Gi.push(p,g),i=Math.min(i,e),r=Math.max(r,d),o=Math.min(o,h),s=Math.max(s,m)}const c=r-i+2*a,u=s-o+2*a,d=i-a,h=o-a,m=this.#Gi.at(n?-1:-2),p=[m[0],m[2]];for(const e of this.#Gi){const[t,a,n]=e;e[0]=(t-d)/c,e[1]=(a-h)/u,e[2]=(n-h)/u}this.#bi={x:d,y:h,width:c,height:u,lastPoint:p}}getOutlines(){this.#Gi.sort(((e,t)=>e[0]-t[0]||e[1]-t[1]||e[2]-t[2]));const e=[];for(const t of this.#Gi)t[3]?(e.push(...this.#Zi(t)),this.#Yi(t)):(this.#Xi(t),e.push(...this.#Zi(t)));return this.#Qi(e)}#Qi(e){const t=[],a=new Set;for(const a of e){const[e,n,i]=a;t.push([e,n,a],[e,i,a])}t.sort(((e,t)=>e[1]-t[1]||e[0]-t[0]));for(let e=0,n=t.length;e<n;e+=2){const n=t[e][2],i=t[e+1][2];n.push(i),i.push(n),a.add(n),a.add(i)}const n=[];let i;for(;a.size>0;){const e=a.values().next().value;let[t,r,o,s,l]=e;a.delete(e);let c=t,u=r;for(i=[t,o],n.push(i);;){let e;if(a.has(s))e=s;else{if(!a.has(l))break;e=l}a.delete(e),[t,r,o,s,l]=e,c!==t&&(i.push(c,u,t,u===r?r:o),c=t),u=u===r?o:r}i.push(c,u)}return new bxe(n,this.#bi)}#Ji(e){const t=this.#Ki;let a=0,n=t.length-1;for(;a<=n;){const i=a+n>>1,r=t[i][0];if(r===e)return i;r<e?a=i+1:n=i-1}return n+1}#Yi([,e,t]){const a=this.#Ji(e);this.#Ki.splice(a,0,[e,t])}#Xi([,e,t]){const a=this.#Ji(e);for(let n=a;n<this.#Ki.length;n++){const[a,i]=this.#Ki[n];if(a!==e)break;if(a===e&&i===t)return void this.#Ki.splice(n,1)}for(let n=a-1;n>=0;n--){const[a,i]=this.#Ki[n];if(a!==e)break;if(a===e&&i===t)return void this.#Ki.splice(n,1)}}#Zi(e){const[t,a,n]=e,i=[[t,a,n]],r=this.#Ji(n);for(let e=0;e<r;e++){const[a,n]=this.#Ki[e];for(let e=0,r=i.length;e<r;e++){const[,o,s]=i[e];if(!(n<=o||s<=a))if(o>=a)if(s>n)i[e][1]=n;else{if(1===r)return[];i.splice(e,1),e--,r--}else i[e][2]=a,s>n&&i.push([t,n,s])}}return i}}class bxe extends gxe{#bi;#er;constructor(e,t){super(),this.#er=e,this.#bi=t}toSVGPath(){const e=[];for(const t of this.#er){let[a,n]=t;e.push(`M${a} ${n}`);for(let i=2;i<t.length;i+=2){const r=t[i],o=t[i+1];r===a?(e.push(`V${o}`),n=o):o===n&&(e.push(`H${r}`),a=r)}e.push("Z")}return e.join(" ")}serialize([e,t,a,n],i){const r=[],o=a-e,s=n-t;for(const t of this.#er){const a=new Array(t.length);for(let i=0;i<t.length;i+=2)a[i]=e+t[i]*o,a[i+1]=n-t[i+1]*s;r.push(a)}return r}get box(){return this.#bi}get classNamesForDrawing(){return["highlight"]}get classNamesForOutlining(){return["highlightOutline"]}}class wxe extends fxe{newFreeDrawOutline(e,t,a,n,i,r){return new xxe(e,t,a,n,i,r)}get classNamesForDrawing(){return["highlight","free"]}}class xxe extends yxe{get classNamesForDrawing(){return["highlight","free"]}get classNamesForOutlining(){return["highlightOutline","free"]}newOutliner(e,t,a,n,i,r=0){return new wxe(e,t,a,n,i,r)}}class kxe{#tr=null;#ar=null;#nr;#ir=null;#rr=!1;#or=!1;#r=null;#sr;#lr=null;#g=null;#cr;static#ur=null;static get _keyboardManager(){return bye(this,"_keyboardManager",new bve([[["Escape","mac+Escape"],kxe.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],kxe.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],kxe.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],kxe.prototype._moveToPrevious],[["Home","mac+Home"],kxe.prototype._moveToBeginning],[["End","mac+End"],kxe.prototype._moveToEnd]]))}constructor({editor:e=null,uiManager:t=null}){e?(this.#or=!1,this.#cr=Ofe.HIGHLIGHT_COLOR,this.#r=e):(this.#or=!0,this.#cr=Ofe.HIGHLIGHT_DEFAULT_COLOR),this.#g=e?._uiManager||t,this.#sr=this.#g._eventBus,this.#nr=e?.color||this.#g?.highlightColors.values().next().value||"#FFFF98",kxe.#ur||=Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"})}renderButton(){const e=this.#tr=document.createElement("button");e.className="colorPicker",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),e.setAttribute("aria-haspopup",!0);const t=this.#g._signal;e.addEventListener("click",this.#dr.bind(this),{signal:t}),e.addEventListener("keydown",this.#Sn.bind(this),{signal:t});const a=this.#ar=document.createElement("span");return a.className="swatch",a.setAttribute("aria-hidden",!0),a.style.backgroundColor=this.#nr,e.append(a),e}renderMainDropdown(){const e=this.#ir=this.#hr();return e.setAttribute("aria-orientation","horizontal"),e.setAttribute("aria-labelledby","highlightColorPickerLabel"),e}#hr(){const e=document.createElement("div"),t=this.#g._signal;e.addEventListener("contextmenu",ive,{signal:t}),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[a,n]of this.#g.highlightColors){const i=document.createElement("button");i.tabIndex="0",i.role="option",i.setAttribute("data-color",n),i.title=a,i.setAttribute("data-l10n-id",kxe.#ur[a]);const r=document.createElement("span");i.append(r),r.className="swatch",r.style.backgroundColor=n,i.setAttribute("aria-selected",n===this.#nr),i.addEventListener("click",this.#mr.bind(this,n),{signal:t}),e.append(i)}return e.addEventListener("keydown",this.#Sn.bind(this),{signal:t}),e}#mr(e,t){t.stopPropagation(),this.#sr.dispatch("switchannotationeditorparams",{source:this,type:this.#cr,value:e})}_colorSelectFromKeyboard(e){if(e.target===this.#tr)return void this.#dr(e);const t=e.target.getAttribute("data-color");t&&this.#mr(t,e)}_moveToNext(e){this.#pr?e.target!==this.#tr?e.target.nextSibling?.focus():this.#ir.firstChild?.focus():this.#dr(e)}_moveToPrevious(e){e.target!==this.#ir?.firstChild&&e.target!==this.#tr?(this.#pr||this.#dr(e),e.target.previousSibling?.focus()):this.#pr&&this._hideDropdownFromKeyboard()}_moveToBeginning(e){this.#pr?this.#ir.firstChild?.focus():this.#dr(e)}_moveToEnd(e){this.#pr?this.#ir.lastChild?.focus():this.#dr(e)}#Sn(e){kxe._keyboardManager.exec(this,e)}#dr(e){if(this.#pr)return void this.hideDropdown();if(this.#rr=0===e.detail,this.#lr||(this.#lr=new AbortController,window.addEventListener("pointerdown",this.#c.bind(this),{signal:this.#g.combinedSignal(this.#lr)})),this.#ir)return void this.#ir.classList.remove("hidden");const t=this.#ir=this.#hr();this.#tr.append(t)}#c(e){this.#ir?.contains(e.target)||this.hideDropdown()}hideDropdown(){this.#ir?.classList.add("hidden"),this.#lr?.abort(),this.#lr=null}get#pr(){return this.#ir&&!this.#ir.classList.contains("hidden")}_hideDropdownFromKeyboard(){this.#or||(this.#pr?(this.hideDropdown(),this.#tr.focus({preventScroll:!0,focusVisible:this.#rr})):this.#r?.unselect())}updateColor(e){if(this.#ar&&(this.#ar.style.backgroundColor=e),!this.#ir)return;const t=this.#g.highlightColors.values();for(const a of this.#ir.children)a.setAttribute("aria-selected",t.next().value===e)}destroy(){this.#tr?.remove(),this.#tr=null,this.#ar=null,this.#ir?.remove(),this.#ir=null}}class Axe extends Ave{#gr=null;#fr=0;#yr;#vr=null;#i=null;#br=null;#wr=null;#xr=0;#kr=null;#Ar=null;#b=null;#Sr=!1;#Er=null;#_r;#Cr=null;#Tr="";#Oi;#Pr="";static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=12;static _type="highlight";static _editorType=Pfe.HIGHLIGHT;static _freeHighlightId=-1;static _freeHighlight=null;static _freeHighlightClipId="";static get _keyboardManager(){const e=Axe.prototype;return bye(this,"_keyboardManager",new bve([[["ArrowLeft","mac+ArrowLeft"],e._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],e._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],e._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],e._moveCaret,{args:[3]}]]))}constructor(e){super({...e,name:"highlightEditor"}),this.color=e.color||Axe._defaultColor,this.#Oi=e.thickness||Axe._defaultThickness,this.#_r=e.opacity||Axe._defaultOpacity,this.#yr=e.boxes||null,this.#Pr=e.methodOfCreation||"",this.#Tr=e.text||"",this._isDraggable=!1,e.highlightId>-1?(this.#Sr=!0,this.#Or(e),this.#Mr()):this.#yr&&(this.#gr=e.anchorNode,this.#fr=e.anchorOffset,this.#wr=e.focusNode,this.#xr=e.focusOffset,this.#Dr(),this.#Mr(),this.rotate(this.rotation))}get telemetryInitialData(){return{action:"added",type:this.#Sr?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:this.#Oi,methodOfCreation:this.#Pr}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get("color").size}}#Dr(){const e=new vxe(this.#yr,.001);this.#Ar=e.getOutlines(),({x:this.x,y:this.y,width:this.width,height:this.height}=this.#Ar.box);const t=new vxe(this.#yr,.0025,.001,"ltr"===this._uiManager.direction);this.#br=t.getOutlines();const{lastPoint:a}=this.#br.box;this.#Er=[(a[0]-this.x)/this.width,(a[1]-this.y)/this.height]}#Or({highlightOutlines:e,highlightId:t,clipPathId:a}){this.#Ar=e;if(this.#br=e.getNewOutline(this.#Oi/2+1.5,.0025),t>=0)this.#b=t,this.#vr=a,this.parent.drawLayer.finalizeLine(t,e),this.#Cr=this.parent.drawLayer.drawOutline(this.#br);else if(this.parent){const t=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(this.#b,e),this.parent.drawLayer.updateBox(this.#b,Axe.#Ir(this.#Ar.box,(t-this.rotation+360)%360)),this.parent.drawLayer.updateLine(this.#Cr,this.#br),this.parent.drawLayer.updateBox(this.#Cr,Axe.#Ir(this.#br.box,t))}const{x:n,y:i,width:r,height:o}=e.box;switch(this.rotation){case 0:this.x=n,this.y=i,this.width=r,this.height=o;break;case 90:{const[e,t]=this.parentDimensions;this.x=i,this.y=1-n,this.width=r*t/e,this.height=o*e/t;break}case 180:this.x=1-n,this.y=1-i,this.width=r,this.height=o;break;case 270:{const[e,t]=this.parentDimensions;this.x=1-i,this.y=n,this.width=r*t/e,this.height=o*e/t;break}}const{lastPoint:s}=this.#br.box;this.#Er=[(s[0]-n)/r,(s[1]-i)/o]}static initialize(e,t){Ave.initialize(e,t),Axe._defaultColor||=t.highlightColors?.values().next().value||"#fff066"}static updateDefaultParams(e,t){switch(e){case Ofe.HIGHLIGHT_DEFAULT_COLOR:Axe._defaultColor=t;break;case Ofe.HIGHLIGHT_THICKNESS:Axe._defaultThickness=t}}translateInPage(e,t){}get toolbarPosition(){return this.#Er}updateParams(e,t){switch(e){case Ofe.HIGHLIGHT_COLOR:this.#di(t);break;case Ofe.HIGHLIGHT_THICKNESS:this.#Nr(t)}}static get defaultPropertiesToUpdate(){return[[Ofe.HIGHLIGHT_DEFAULT_COLOR,Axe._defaultColor],[Ofe.HIGHLIGHT_THICKNESS,Axe._defaultThickness]]}get propertiesToUpdate(){return[[Ofe.HIGHLIGHT_COLOR,this.color||Axe._defaultColor],[Ofe.HIGHLIGHT_THICKNESS,this.#Oi||Axe._defaultThickness],[Ofe.HIGHLIGHT_FREE,this.#Sr]]}#di(e){const t=(e,t)=>{this.color=e,this.parent?.drawLayer.changeColor(this.#b,e),this.#i?.updateColor(e),this.#_r=t,this.parent?.drawLayer.changeOpacity(this.#b,t)},a=this.color,n=this.#_r;this.addCommands({cmd:t.bind(this,e,Axe._defaultOpacity),undo:t.bind(this,a,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Ofe.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(e)},!0)}#Nr(e){const t=this.#Oi,a=e=>{this.#Oi=e,this.#jr(e)};this.addCommands({cmd:a.bind(this,e),undo:a.bind(this,t),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Ofe.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:e},!0)}async addEditToolbar(){const e=await super.addEditToolbar();return e?(this._uiManager.highlightColors&&(this.#i=new kxe({editor:this}),e.addColorPicker(this.#i)),e):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(this.#zr())}getBaseTranslation(){return[0,0]}getRect(e,t){return super.getRect(e,t,this.#zr())}onceAdded(){this.annotationElementId||this.parent.addUndoableEditor(this),this.div.focus()}remove(){this.#Rr(),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.#Mr(),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let t=!1;this.parent&&!e?this.#Rr():e&&(this.#Mr(e),t=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(e),this.show(this._isVisible),t&&this.select()}#jr(e){if(!this.#Sr)return;this.#Or({highlightOutlines:this.#Ar.getNewOutline(e/2)}),this.fixAndSetPosition();const[t,a]=this.parentDimensions;this.setDims(this.width*t,this.height*a)}#Rr(){null!==this.#b&&this.parent&&(this.parent.drawLayer.remove(this.#b),this.#b=null,this.parent.drawLayer.remove(this.#Cr),this.#Cr=null)}#Mr(e=this.parent){null===this.#b&&(({id:this.#b,clipPathId:this.#vr}=e.drawLayer.draw(this.#Ar,this.color,this.#_r)),this.#Cr=e.drawLayer.drawOutline(this.#br),this.#kr&&(this.#kr.style.clipPath=this.#vr))}static#Ir({x:e,y:t,width:a,height:n},i){switch(i){case 90:return{x:1-t-n,y:e,width:n,height:a};case 180:return{x:1-e-a,y:1-t-n,width:a,height:n};case 270:return{x:t,y:1-e-a,width:n,height:a}}return{x:e,y:t,width:a,height:n}}rotate(e){const{drawLayer:t}=this.parent;let a;this.#Sr?(e=(e-this.rotation+360)%360,a=Axe.#Ir(this.#Ar.box,e)):a=Axe.#Ir(this,e),t.rotate(this.#b,e),t.rotate(this.#Cr,e),t.updateBox(this.#b,a),t.updateBox(this.#Cr,Axe.#Ir(this.#br.box,e))}render(){if(this.div)return this.div;const e=super.render();this.#Tr&&(e.setAttribute("aria-label",this.#Tr),e.setAttribute("role","mark")),this.#Sr?e.classList.add("free"):this.div.addEventListener("keydown",this.#Lr.bind(this),{signal:this._uiManager._signal});const t=this.#kr=document.createElement("div");e.append(t),t.setAttribute("aria-hidden","true"),t.className="internal",t.style.clipPath=this.#vr;const[a,n]=this.parentDimensions;return this.setDims(this.width*a,this.height*n),gve(this,this.#kr,["pointerover","pointerleave"]),this.enableEditing(),e}pointerover(){this.isSelected||this.parent.drawLayer.addClass(this.#Cr,"hovered")}pointerleave(){this.isSelected||this.parent.drawLayer.removeClass(this.#Cr,"hovered")}#Lr(e){Axe._keyboardManager.exec(this,e)}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:this.#Fr(!0);break;case 1:case 3:this.#Fr(!1)}}#Fr(e){if(!this.#gr)return;const t=window.getSelection();e?t.setPosition(this.#gr,this.#fr):t.setPosition(this.#wr,this.#xr)}select(){super.select(),this.#Cr&&(this.parent?.drawLayer.removeClass(this.#Cr,"hovered"),this.parent?.drawLayer.addClass(this.#Cr,"selected"))}unselect(){super.unselect(),this.#Cr&&(this.parent?.drawLayer.removeClass(this.#Cr,"selected"),this.#Sr||this.#Fr(!1))}get _mustFixPosition(){return!this.#Sr}show(e=this._isVisible){super.show(e),this.parent&&(this.parent.drawLayer.show(this.#b,e),this.parent.drawLayer.show(this.#Cr,e))}#zr(){return this.#Sr?this.rotation:0}#Br(){if(this.#Sr)return null;const[e,t]=this.pageDimensions,[a,n]=this.pageTranslation,i=this.#yr,r=new Float32Array(8*i.length);let o=0;for(const{x:s,y:l,width:c,height:u}of i){const i=s*e+a,d=(1-l-u)*t+n;r[o]=r[o+4]=i,r[o+1]=r[o+3]=d,r[o+2]=r[o+6]=i+c*e,r[o+5]=r[o+7]=d+u*t,o+=8}return r}#Hr(e){return this.#Ar.serialize(e,this.#zr())}static startHighlighting(e,t,{target:a,x:n,y:i}){const{x:r,y:o,width:s,height:l}=a.getBoundingClientRect(),c=new AbortController,u=e.combinedSignal(c),d=t=>{c.abort(),this.#qr(e,t)};window.addEventListener("blur",d,{signal:u}),window.addEventListener("pointerup",d,{signal:u}),window.addEventListener("pointerdown",(e=>{e.preventDefault(),e.stopPropagation()}),{capture:!0,passive:!1,signal:u}),window.addEventListener("contextmenu",ive,{signal:u}),a.addEventListener("pointermove",this.#Ur.bind(this,e),{signal:u}),this._freeHighlight=new wxe({x:n,y:i},[r,o,s,l],e.scale,this._defaultThickness/2,t,.001),({id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=e.drawLayer.draw(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0))}static#Ur(e,t){this._freeHighlight.add(t)&&e.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)}static#qr(e,t){this._freeHighlight.isEmpty()?e.drawLayer.remove(this._freeHighlightId):e.createAndAddNewEditor(t,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}static async deserialize(e,t,a){let n=null;if(e instanceof oxe){const{data:{quadPoints:t,rect:a,rotation:i,id:r,color:o,opacity:s,popupRef:l},parent:{page:{pageNumber:c}}}=e;n=e={annotationType:Pfe.HIGHLIGHT,color:Array.from(o),opacity:s,quadPoints:t,boxes:null,pageIndex:c-1,rect:a.slice(0),rotation:i,id:r,deleted:!1,popupRef:l}}else if(e instanceof rxe){const{data:{inkLists:t,rect:a,rotation:i,id:r,color:o,borderStyle:{rawWidth:s},popupRef:l},parent:{page:{pageNumber:c}}}=e;n=e={annotationType:Pfe.HIGHLIGHT,color:Array.from(o),thickness:s,inkLists:t,boxes:null,pageIndex:c-1,rect:a.slice(0),rotation:i,id:r,deleted:!1,popupRef:l}}const{color:i,quadPoints:r,inkLists:o,opacity:s}=e,l=await super.deserialize(e,t,a);l.color=Iye.makeHexColor(...i),l.#_r=s||1,o&&(l.#Oi=e.thickness),l.annotationElementId=e.id||null,l._initialData=n;const[c,u]=l.pageDimensions,[d,h]=l.pageTranslation;if(r){const e=l.#yr=[];for(let t=0;t<r.length;t+=8)e.push({x:(r[t]-d)/c,y:1-(r[t+1]-h)/u,width:(r[t+2]-r[t])/c,height:(r[t+1]-r[t+5])/u});l.#Dr(),l.#Mr(),l.rotate(l.rotation)}else if(o){l.#Sr=!0;const e=o[0],a={x:e[0]-d,y:u-(e[1]-h)},n=new wxe(a,[0,0,c,u],1,l.#Oi/2,!0,.001);for(let t=0,i=e.length;t<i;t+=2)a.x=e[t]-d,a.y=u-(e[t+1]-h),n.add(a);const{id:i,clipPathId:r}=t.drawLayer.draw(n,l.color,l._defaultOpacity,!0);l.#Or({highlightOutlines:n.getOutlines(),highlightId:i,clipPathId:r}),l.#Mr()}return l}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();const t=this.getRect(0,0),a=Ave._colorManager.convert(this.color),n={annotationType:Pfe.HIGHLIGHT,color:a,opacity:this.#_r,thickness:this.#Oi,quadPoints:this.#Br(),outlines:this.#Hr(t),pageIndex:this.pageIndex,rect:t,rotation:this.#zr(),structTreeParentId:this._structTreeParentId};return this.annotationElementId&&!this.#vi(n)?null:(n.id=this.annotationElementId,n)}#vi(e){const{color:t}=this._initialData;return e.color.some(((e,a)=>e!==t[a]))}renderAnnotationElement(e){return e.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}}class Sxe extends Ave{#Vr=0;#Wr=0;#$r=null;#Gr=new Path2D;#Kr=!1;#Zr=null;#Yr=!1;#Xr=!1;#Qr=null;#Jr=null;#eo=0;#to=0;#ao=null;static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=1;static _type="ink";static _editorType=Pfe.INK;constructor(e){super({...e,name:"inkEditor"}),this.color=e.color||null,this.thickness=e.thickness||null,this.opacity=e.opacity||null,this.paths=[],this.bezierPath2D=[],this.allRawPaths=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0,this._willKeepAspectRatio=!0}static initialize(e,t){Ave.initialize(e,t)}static updateDefaultParams(e,t){switch(e){case Ofe.INK_THICKNESS:Sxe._defaultThickness=t;break;case Ofe.INK_COLOR:Sxe._defaultColor=t;break;case Ofe.INK_OPACITY:Sxe._defaultOpacity=t/100}}updateParams(e,t){switch(e){case Ofe.INK_THICKNESS:this.#Nr(t);break;case Ofe.INK_COLOR:this.#di(t);break;case Ofe.INK_OPACITY:this.#no(t)}}static get defaultPropertiesToUpdate(){return[[Ofe.INK_THICKNESS,Sxe._defaultThickness],[Ofe.INK_COLOR,Sxe._defaultColor||Ave._defaultLineColor],[Ofe.INK_OPACITY,Math.round(100*Sxe._defaultOpacity)]]}get propertiesToUpdate(){return[[Ofe.INK_THICKNESS,this.thickness||Sxe._defaultThickness],[Ofe.INK_COLOR,this.color||Sxe._defaultColor||Ave._defaultLineColor],[Ofe.INK_OPACITY,Math.round(100*(this.opacity??Sxe._defaultOpacity))]]}#Nr(e){const t=e=>{this.thickness=e,this.#io()},a=this.thickness;this.addCommands({cmd:t.bind(this,e),undo:t.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Ofe.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}#di(e){const t=e=>{this.color=e,this.#ro()},a=this.color;this.addCommands({cmd:t.bind(this,e),undo:t.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Ofe.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}#no(e){const t=e=>{this.opacity=e,this.#ro()};e/=100;const a=this.opacity;this.addCommands({cmd:t.bind(this,e),undo:t.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Ofe.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.canvas||(this.#oo(),this.#so()),this.isAttachedToDOM||(this.parent.add(this),this.#lo()),this.#io()))}remove(){null!==this.canvas&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,this.#$r&&(clearTimeout(this.#$r),this.#$r=null),this.#Qr?.disconnect(),this.#Qr=null,super.remove())}setParent(e){!this.parent&&e?this._uiManager.removeShouldRescale(this):this.parent&&null===e&&this._uiManager.addShouldRescale(this),super.setParent(e)}onScaleChanging(){const[e,t]=this.parentDimensions,a=this.width*e,n=this.height*t;this.setDimensions(a,n)}enableEditMode(){this.#Kr||null===this.canvas||(super.enableEditMode(),this._isDraggable=!1,this.#co())}disableEditMode(){this.isInEditMode()&&null!==this.canvas&&(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),this.#uo())}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return 0===this.paths.length||1===this.paths.length&&0===this.paths[0].length}#do(){const{parentRotation:e,parentDimensions:[t,a]}=this;switch(e){case 90:return[0,a,a,t];case 180:return[t,a,t,a];case 270:return[t,0,a,t];default:return[0,0,t,a]}}#ho(){const{ctx:e,color:t,opacity:a,thickness:n,parentScale:i,scaleFactor:r}=this;e.lineWidth=n*i/r,e.lineCap="round",e.lineJoin="round",e.miterLimit=10,e.strokeStyle=`${t}${function(e){return Math.round(Math.min(255,Math.max(1,255*e))).toString(16).padStart(2,"0")}(a)}`}#mo(e,t){this.canvas.addEventListener("contextmenu",ive,{signal:this._uiManager._signal}),this.#uo(),this.#Zr=new AbortController;const a=this._uiManager.combinedSignal(this.#Zr);this.canvas.addEventListener("pointerleave",this.canvasPointerleave.bind(this),{signal:a}),this.canvas.addEventListener("pointermove",this.canvasPointermove.bind(this),{signal:a}),this.canvas.addEventListener("pointerup",this.canvasPointerup.bind(this),{signal:a}),this.isEditing=!0,this.#Xr||(this.#Xr=!0,this.#lo(),this.thickness||=Sxe._defaultThickness,this.color||=Sxe._defaultColor||Ave._defaultLineColor,this.opacity??=Sxe._defaultOpacity),this.currentPath.push([e,t]),this.#Yr=!1,this.#ho(),this.#ao=()=>{this.#po(),this.#ao&&window.requestAnimationFrame(this.#ao)},window.requestAnimationFrame(this.#ao)}#go(e,t){const[a,n]=this.currentPath.at(-1);if(this.currentPath.length>1&&e===a&&t===n)return;const i=this.currentPath;let r=this.#Gr;if(i.push([e,t]),this.#Yr=!0,i.length<=2)return r.moveTo(...i[0]),void r.lineTo(e,t);3===i.length&&(this.#Gr=r=new Path2D,r.moveTo(...i[0])),this.#fo(r,...i.at(-3),...i.at(-2),e,t)}#yo(){if(0===this.currentPath.length)return;const e=this.currentPath.at(-1);this.#Gr.lineTo(...e)}#vo(e,t){let a;if(this.#ao=null,e=Math.min(Math.max(e,0),this.canvas.width),t=Math.min(Math.max(t,0),this.canvas.height),this.#go(e,t),this.#yo(),1!==this.currentPath.length)a=this.#bo();else{const n=[e,t];a=[[n,n.slice(),n.slice(),n]]}const n=this.#Gr,i=this.currentPath;this.currentPath=[],this.#Gr=new Path2D;this.addCommands({cmd:()=>{this.allRawPaths.push(i),this.paths.push(a),this.bezierPath2D.push(n),this._uiManager.rebuild(this)},undo:()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),0===this.paths.length?this.remove():(this.canvas||(this.#oo(),this.#so()),this.#io())},mustExec:!0})}#po(){if(!this.#Yr)return;this.#Yr=!1;Math.ceil(this.thickness*this.parentScale);const e=this.currentPath.slice(-3),t=e.map((e=>e[0])),a=e.map((e=>e[1]));Math.min(...t),Math.max(...t),Math.min(...a),Math.max(...a);const{ctx:n}=this;n.save(),n.clearRect(0,0,this.canvas.width,this.canvas.height);for(const e of this.bezierPath2D)n.stroke(e);n.stroke(this.#Gr),n.restore()}#fo(e,t,a,n,i,r,o){const s=(t+n)/2,l=(a+i)/2,c=(n+r)/2,u=(i+o)/2;e.bezierCurveTo(s+2*(n-s)/3,l+2*(i-l)/3,c+2*(n-c)/3,u+2*(i-u)/3,c,u)}#bo(){const e=this.currentPath;if(e.length<=2)return[[e[0],e[0],e.at(-1),e.at(-1)]];const t=[];let a,[n,i]=e[0];for(a=1;a<e.length-2;a++){const[r,o]=e[a],[s,l]=e[a+1],c=(r+s)/2,u=(o+l)/2,d=[n+2*(r-n)/3,i+2*(o-i)/3],h=[c+2*(r-c)/3,u+2*(o-u)/3];t.push([[n,i],d,h,[c,u]]),[n,i]=[c,u]}const[r,o]=e[a],[s,l]=e[a+1],c=[n+2*(r-n)/3,i+2*(o-i)/3],u=[s+2*(r-s)/3,l+2*(o-l)/3];return t.push([[n,i],c,u,[s,l]]),t}#ro(){if(this.isEmpty())return void this.#wo();this.#ho();const{canvas:e,ctx:t}=this;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.width,e.height),this.#wo();for(const e of this.bezierPath2D)t.stroke(e)}commit(){this.#Kr||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),this.#Kr=!0,this.div.classList.add("disabled"),this.#io(!0),this.select(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(e){this._focusEventsAllowed&&(super.focusin(e),this.enableEditMode())}#co(){if(this.#Jr)return;this.#Jr=new AbortController;const e=this._uiManager.combinedSignal(this.#Jr);this.canvas.addEventListener("pointerdown",this.canvasPointerdown.bind(this),{signal:e})}#uo(){this.pointerdownAC?.abort(),this.pointerdownAC=null}canvasPointerdown(e){0===e.button&&this.isInEditMode()&&!this.#Kr&&(this.setInForeground(),e.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),this.#mo(e.offsetX,e.offsetY))}canvasPointermove(e){e.preventDefault(),this.#go(e.offsetX,e.offsetY)}canvasPointerup(e){e.preventDefault(),this.#xo(e)}canvasPointerleave(e){this.#xo(e)}#xo(e){this.#Zr?.abort(),this.#Zr=null,this.#co(),this.#$r&&clearTimeout(this.#$r),this.#$r=setTimeout((()=>{this.#$r=null,this.canvas.removeEventListener("contextmenu",ive)}),10),this.#vo(e.offsetX,e.offsetY),this.addToAnnotationStorage(),this.setInBackground()}#oo(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",this.canvas.setAttribute("data-l10n-id","pdfjs-ink-canvas"),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")}#so(){this.#Qr=new ResizeObserver((e=>{const t=e[0].contentRect;t.width&&t.height&&this.setDimensions(t.width,t.height)})),this.#Qr.observe(this.div),this._uiManager._signal.addEventListener("abort",(()=>{this.#Qr?.disconnect(),this.#Qr=null}),{once:!0})}get isResizable(){return!this.isEmpty()&&this.#Kr}render(){if(this.div)return this.div;let e,t;this.width&&(e=this.x,t=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");const[a,n,i,r]=this.#do();if(this.setAt(a,n,0,0),this.setDims(i,r),this.#oo(),this.width){const[a,n]=this.parentDimensions;this.setAspectRatio(this.width*a,this.height*n),this.setAt(e*a,t*n,this.width*a,this.height*n),this.#Xr=!0,this.#lo(),this.setDims(this.width*a,this.height*n),this.#ro(),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return this.#so(),this.div}#lo(){if(!this.#Xr)return;const[e,t]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*e),this.canvas.height=Math.ceil(this.height*t),this.#wo()}setDimensions(e,t){const a=Math.round(e),n=Math.round(t);if(this.#eo===a&&this.#to===n)return;this.#eo=a,this.#to=n,this.canvas.style.visibility="hidden";const[i,r]=this.parentDimensions;this.width=e/i,this.height=t/r,this.fixAndSetPosition(),this.#Kr&&this.#ko(e,t),this.#lo(),this.#ro(),this.canvas.style.visibility="visible",this.fixDims()}#ko(e,t){const a=this.#Ao(),n=(e-a)/this.#Wr,i=(t-a)/this.#Vr;this.scaleFactor=Math.min(n,i)}#wo(){const e=this.#Ao()/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+e,this.translationY*this.scaleFactor+e)}static#So(e){const t=new Path2D;for(let a=0,n=e.length;a<n;a++){const[n,i,r,o]=e[a];0===a&&t.moveTo(...n),t.bezierCurveTo(i[0],i[1],r[0],r[1],o[0],o[1])}return t}static#Eo(e,t,a){const[n,i,r,o]=t;switch(a){case 0:for(let t=0,a=e.length;t<a;t+=2)e[t]+=n,e[t+1]=o-e[t+1];break;case 90:for(let t=0,a=e.length;t<a;t+=2){const a=e[t];e[t]=e[t+1]+n,e[t+1]=a+i}break;case 180:for(let t=0,a=e.length;t<a;t+=2)e[t]=r-e[t],e[t+1]+=i;break;case 270:for(let t=0,a=e.length;t<a;t+=2){const a=e[t];e[t]=r-e[t+1],e[t+1]=o-a}break;default:throw new Error("Invalid rotation")}return e}static#_o(e,t,a){const[n,i,r,o]=t;switch(a){case 0:for(let t=0,a=e.length;t<a;t+=2)e[t]-=n,e[t+1]=o-e[t+1];break;case 90:for(let t=0,a=e.length;t<a;t+=2){const a=e[t];e[t]=e[t+1]-i,e[t+1]=a-n}break;case 180:for(let t=0,a=e.length;t<a;t+=2)e[t]=r-e[t],e[t+1]-=i;break;case 270:for(let t=0,a=e.length;t<a;t+=2){const a=e[t];e[t]=o-e[t+1],e[t+1]=r-a}break;default:throw new Error("Invalid rotation")}return e}#Co(e,t,a,n){const i=[],r=this.thickness/2,o=e*t+r,s=e*a+r;for(const t of this.paths){const a=[],r=[];for(let n=0,i=t.length;n<i;n++){const[l,c,u,d]=t[n];if(l[0]===d[0]&&l[1]===d[1]&&1===i){const t=e*l[0]+o,n=e*l[1]+s;a.push(t,n),r.push(t,n);break}const h=e*l[0]+o,m=e*l[1]+s,p=e*c[0]+o,g=e*c[1]+s,f=e*u[0]+o,y=e*u[1]+s,v=e*d[0]+o,b=e*d[1]+s;0===n&&(a.push(h,m),r.push(h,m)),a.push(p,g,f,y,v,b),r.push(p,g),n===i-1&&r.push(v,b)}i.push({bezier:Sxe.#Eo(a,n,this.rotation),points:Sxe.#Eo(r,n,this.rotation)})}return i}#To(){let e=1/0,t=-1/0,a=1/0,n=-1/0;for(const i of this.paths)for(const[r,o,s,l]of i){const i=Iye.bezierBoundingBox(...r,...o,...s,...l);e=Math.min(e,i[0]),a=Math.min(a,i[1]),t=Math.max(t,i[2]),n=Math.max(n,i[3])}return[e,a,t,n]}#Ao(){return this.#Kr?Math.ceil(this.thickness*this.parentScale):0}#io(e=!1){if(this.isEmpty())return;if(!this.#Kr)return void this.#ro();const t=this.#To(),a=this.#Ao();this.#Wr=Math.max(Ave.MIN_SIZE,t[2]-t[0]),this.#Vr=Math.max(Ave.MIN_SIZE,t[3]-t[1]);const n=Math.ceil(a+this.#Wr*this.scaleFactor),i=Math.ceil(a+this.#Vr*this.scaleFactor),[r,o]=this.parentDimensions;this.width=n/r,this.height=i/o,this.setAspectRatio(n,i);const s=this.translationX,l=this.translationY;this.translationX=-t[0],this.translationY=-t[1],this.#lo(),this.#ro(),this.#eo=n,this.#to=i,this.setDims(n,i);const c=e?a/this.scaleFactor/2:0;this.translate(s-this.translationX-c,l-this.translationY-c)}static async deserialize(e,t,a){if(e instanceof rxe)return null;const n=await super.deserialize(e,t,a);n.thickness=e.thickness,n.color=Iye.makeHexColor(...e.color),n.opacity=e.opacity;const[i,r]=n.pageDimensions,o=n.width*i,s=n.height*r,l=n.parentScale,c=e.thickness/2;n.#Kr=!0,n.#eo=Math.round(o),n.#to=Math.round(s);const{paths:u,rect:d,rotation:h}=e;for(let{bezier:e}of u){e=Sxe.#_o(e,d,h);const t=[];n.paths.push(t);let a=l*(e[0]-c),i=l*(e[1]-c);for(let n=2,r=e.length;n<r;n+=6){const r=l*(e[n]-c),o=l*(e[n+1]-c),s=l*(e[n+2]-c),u=l*(e[n+3]-c),d=l*(e[n+4]-c),h=l*(e[n+5]-c);t.push([[a,i],[r,o],[s,u],[d,h]]),a=d,i=h}const r=this.#So(t);n.bezierPath2D.push(r)}const m=n.#To();return n.#Wr=Math.max(Ave.MIN_SIZE,m[2]-m[0]),n.#Vr=Math.max(Ave.MIN_SIZE,m[3]-m[1]),n.#ko(o,s),n}serialize(){if(this.isEmpty())return null;const e=this.getRect(0,0),t=Ave._colorManager.convert(this.ctx.strokeStyle);return{annotationType:Pfe.INK,color:t,thickness:this.thickness,opacity:this.opacity,paths:this.#Co(this.scaleFactor/this.parentScale,this.translationX,this.translationY,e),pageIndex:this.pageIndex,rect:e,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}}class Exe extends Ave{#Po=null;#Oo=null;#Mo=null;#Do=null;#Io=null;#No="";#jo=null;#Qr=null;#zo=null;#Ro=!1;#Lo=!1;static _type="stamp";static _editorType=Pfe.STAMP;constructor(e){super({...e,name:"stampEditor"}),this.#Do=e.bitmapUrl,this.#Io=e.bitmapFile}static initialize(e,t){Ave.initialize(e,t)}static get supportedTypes(){return bye(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map((e=>`image/${e}`)))}static get supportedTypesStr(){return bye(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(e){return this.supportedTypes.includes(e)}static paste(e,t){t.pasteEditor(Pfe.STAMP,{bitmapFile:e.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){return{type:"stamp",hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(e){const t=e.get("hasAltText");return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}#Fo(e,t=!1){e?(this.#Po=e.bitmap,t||(this.#Oo=e.id,this.#Ro=e.isSvg),e.file&&(this.#No=e.file.name),this.#oo()):this.remove()}#Bo(){if(this.#Mo=null,this._uiManager.enableWaiting(!1),this.#jo){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#Po)return this._editToolbar.hide(),void this._uiManager.editAltText(this,!0);if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#Po){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}}async mlGuessAltText(e=null,t=!0){if(this.hasAltTextData())return null;const{mlManager:a}=this._uiManager;if(!a)throw new Error("No ML.");if(!await a.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:n,width:i,height:r}=e||this.copyCanvas(null,null,!0).imageData,o=await a.guess({name:"altText",request:{data:n,width:i,height:r,channels:n.length/(i*r)}});if(!o)throw new Error("No response from the AI service.");if(o.error)throw new Error("Error from the AI service.");if(o.cancel)return null;if(!o.output)throw new Error("No valid response from the AI service.");const s=o.output;return await this.setGuessedAltText(s),t&&!this.hasAltTextData()&&(this.altTextData={alt:s,decorative:!1}),s}#Ho(){if(this.#Oo)return this._uiManager.enableWaiting(!0),void this._uiManager.imageManager.getFromId(this.#Oo).then((e=>this.#Fo(e,!0))).finally((()=>this.#Bo()));if(this.#Do){const e=this.#Do;return this.#Do=null,this._uiManager.enableWaiting(!0),void(this.#Mo=this._uiManager.imageManager.getFromUrl(e).then((e=>this.#Fo(e))).finally((()=>this.#Bo())))}if(this.#Io){const e=this.#Io;return this.#Io=null,this._uiManager.enableWaiting(!0),void(this.#Mo=this._uiManager.imageManager.getFromFile(e).then((e=>this.#Fo(e))).finally((()=>this.#Bo())))}const e=document.createElement("input");e.type="file",e.accept=Exe.supportedTypesStr;const t=this._uiManager._signal;this.#Mo=new Promise((a=>{e.addEventListener("change",(async()=>{if(e.files&&0!==e.files.length){this._uiManager.enableWaiting(!0);const t=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),this.#Fo(t)}else this.remove();a()}),{signal:t}),e.addEventListener("cancel",(()=>{this.remove(),a()}),{signal:t})})).finally((()=>this.#Bo())),e.click()}remove(){this.#Oo&&(this.#Po=null,this._uiManager.imageManager.deleteId(this.#Oo),this.#jo?.remove(),this.#jo=null,this.#Qr?.disconnect(),this.#Qr=null,this.#zo&&(clearTimeout(this.#zo),this.#zo=null)),super.remove()}rebuild(){this.parent?(super.rebuild(),null!==this.div&&(this.#Oo&&null===this.#jo&&this.#Ho(),this.isAttachedToDOM||this.parent.add(this))):this.#Oo&&this.#Ho()}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(this.#Mo||this.#Po||this.#Do||this.#Io||this.#Oo)}get isResizable(){return!0}render(){if(this.div)return this.div;let e,t;if(this.width&&(e=this.x,t=this.y),super.render(),this.div.hidden=!0,this.div.setAttribute("role","figure"),this.addAltTextButton(),this.#Po?this.#oo():this.#Ho(),this.width&&!this.annotationElementId){const[a,n]=this.parentDimensions;this.setAt(e*a,t*n,this.width*a,this.height*n)}return this.div}#oo(){const{div:e}=this;let{width:t,height:a}=this.#Po;const[n,i]=this.pageDimensions,r=.75;if(this.width)t=this.width*n,a=this.height*i;else if(t>r*n||a>r*i){const e=Math.min(r*n/t,r*i/a);t*=e,a*=e}const[o,s]=this.parentDimensions;this.setDims(t*o/n,a*s/i),this._uiManager.enableWaiting(!1);const l=this.#jo=document.createElement("canvas");l.setAttribute("role","img"),this.addContainer(l),this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&!this.annotationElementId||(e.hidden=!1),this.#qo(t,a),this.#so(),this.#Lo||(this.parent.addUndoableEditor(this),this.#Lo=!0),this._reportTelemetry({action:"inserted_image"}),this.#No&&l.setAttribute("aria-label",this.#No)}copyCanvas(e,t,a=!1){e||(e=224);const{width:n,height:i}=this.#Po,r=new hve;let o=this.#Po,s=n,l=i,c=null;if(t){if(n>t||i>t){const e=Math.min(t/n,t/i);s=Math.floor(n*e),l=Math.floor(i*e)}c=document.createElement("canvas");const e=c.width=Math.ceil(s*r.sx),a=c.height=Math.ceil(l*r.sy);this.#Ro||(o=this.#Uo(e,a));const u=c.getContext("2d");u.filter=this._uiManager.hcmFilter;let d="white",h="#cfcfd8";"none"!==this._uiManager.hcmFilter?h="black":window.matchMedia?.("(prefers-color-scheme: dark)").matches&&(d="#8f8f9d",h="#42414d");const m=15,p=m*r.sx,g=m*r.sy,f=new OffscreenCanvas(2*p,2*g),y=f.getContext("2d");y.fillStyle=d,y.fillRect(0,0,2*p,2*g),y.fillStyle=h,y.fillRect(0,0,p,g),y.fillRect(p,g,p,g),u.fillStyle=u.createPattern(f,"repeat"),u.fillRect(0,0,e,a),u.drawImage(o,0,0,o.width,o.height,0,0,e,a)}let u=null;if(a){let t,a;if(r.symmetric&&o.width<e&&o.height<e)t=o.width,a=o.height;else if(o=this.#Po,n>e||i>e){const r=Math.min(e/n,e/i);t=Math.floor(n*r),a=Math.floor(i*r),this.#Ro||(o=this.#Uo(t,a))}const s=new OffscreenCanvas(t,a).getContext("2d",{willReadFrequently:!0});s.drawImage(o,0,0,o.width,o.height,0,0,t,a),u={width:t,height:a,data:s.getImageData(0,0,t,a).data}}return{canvas:c,width:s,height:l,imageData:u}}#Vo(e,t){const[a,n]=this.parentDimensions;this.width=e/a,this.height=t/n,this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,null!==this.#zo&&clearTimeout(this.#zo);this.#zo=setTimeout((()=>{this.#zo=null,this.#qo(e,t)}),200)}#Uo(e,t){const{width:a,height:n}=this.#Po;let i=a,r=n,o=this.#Po;for(;i>2*e||r>2*t;){const a=i,n=r;i>2*e&&(i=i>=16384?Math.floor(i/2)-1:Math.ceil(i/2)),r>2*t&&(r=r>=16384?Math.floor(r/2)-1:Math.ceil(r/2));const s=new OffscreenCanvas(i,r);s.getContext("2d").drawImage(o,0,0,a,n,0,0,i,r),o=s.transferToImageBitmap()}return o}#qo(e,t){const a=new hve,n=Math.ceil(e*a.sx),i=Math.ceil(t*a.sy),r=this.#jo;if(!r||r.width===n&&r.height===i)return;r.width=n,r.height=i;const o=this.#Ro?this.#Po:this.#Uo(n,i),s=r.getContext("2d");s.filter=this._uiManager.hcmFilter,s.drawImage(o,0,0,o.width,o.height,0,0,n,i)}getImageForAltText(){return this.#jo}#Wo(e){if(e){if(this.#Ro){const e=this._uiManager.imageManager.getSvgUrl(this.#Oo);if(e)return e}const e=document.createElement("canvas");({width:e.width,height:e.height}=this.#Po);return e.getContext("2d").drawImage(this.#Po,0,0),e.toDataURL()}if(this.#Ro){const[e,t]=this.pageDimensions,a=Math.round(this.width*e*Kye.PDF_TO_CSS_UNITS),n=Math.round(this.height*t*Kye.PDF_TO_CSS_UNITS),i=new OffscreenCanvas(a,n);return i.getContext("2d").drawImage(this.#Po,0,0,this.#Po.width,this.#Po.height,0,0,a,n),i.transferToImageBitmap()}return structuredClone(this.#Po)}#so(){this._uiManager._signal&&(this.#Qr=new ResizeObserver((e=>{const t=e[0].contentRect;t.width&&t.height&&this.#Vo(t.width,t.height)})),this.#Qr.observe(this.div),this._uiManager._signal.addEventListener("abort",(()=>{this.#Qr?.disconnect(),this.#Qr=null}),{once:!0}))}static async deserialize(e,t,a){let n=null;if(e instanceof uxe){const{data:{rect:i,rotation:r,id:o,structParent:s,popupRef:l},container:c,parent:{page:{pageNumber:u}}}=e,d=c.querySelector("canvas"),h=a.imageManager.getFromCanvas(c.id,d);d.remove();const m=(await t._structTree.getAriaAttributes(`${Rye}${o}`))?.get("aria-label")||"";n=e={annotationType:Pfe.STAMP,bitmapId:h.id,bitmap:h.bitmap,pageIndex:u-1,rect:i.slice(0),rotation:r,id:o,deleted:!1,accessibilityData:{decorative:!1,altText:m},isSvg:!1,structParent:s,popupRef:l}}const i=await super.deserialize(e,t,a),{rect:r,bitmap:o,bitmapUrl:s,bitmapId:l,isSvg:c,accessibilityData:u}=e;l&&a.imageManager.isValidId(l)?(i.#Oo=l,o&&(i.#Po=o)):i.#Do=s,i.#Ro=c;const[d,h]=i.pageDimensions;return i.width=(r[2]-r[0])/d,i.height=(r[3]-r[1])/h,i.annotationElementId=e.id||null,u&&(i.altTextData=u),i._initialData=n,i.#Lo=!!n,i}serialize(e=!1,t=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const a={annotationType:Pfe.STAMP,bitmapId:this.#Oo,pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:this.#Ro,structTreeParentId:this._structTreeParentId};if(e)return a.bitmapUrl=this.#Wo(!0),a.accessibilityData=this.serializeAltText(!0),a;const{decorative:n,altText:i}=this.serializeAltText(!1);if(!n&&i&&(a.accessibilityData={type:"Figure",alt:i}),this.annotationElementId){const e=this.#vi(a);if(e.isSame)return null;e.isSameAltText?delete a.accessibilityData:a.accessibilityData.structParent=this._initialData.structParent??-1}if(a.id=this.annotationElementId,null===t)return a;t.stamps||=new Map;const r=this.#Ro?(a.rect[2]-a.rect[0])*(a.rect[3]-a.rect[1]):null;if(t.stamps.has(this.#Oo)){if(this.#Ro){const e=t.stamps.get(this.#Oo);r>e.area&&(e.area=r,e.serialized.bitmap.close(),e.serialized.bitmap=this.#Wo(!1))}}else t.stamps.set(this.#Oo,{area:r,serialized:a}),a.bitmap=this.#Wo(!1);return a}#vi(e){const{rect:t,pageIndex:a,accessibilityData:{altText:n}}=this._initialData,i=e.rect.every(((e,a)=>Math.abs(e-t[a])<1)),r=e.pageIndex===a,o=(e.accessibilityData?.alt||"")===n;return{isSame:i&&r&&o,isSameAltText:o}}renderAnnotationElement(e){return e.updateEdited({rect:this.getRect(0,0)}),null}}class _xe{#ti;#$o=!1;#Go=null;#Ko=null;#Zo=null;#Yo=new Map;#Xo=!1;#Qo=!1;#Jo=!1;#es=null;#ts=null;#g;static _initialized=!1;static#B=new Map([pxe,Sxe,Exe,Axe].map((e=>[e._editorType,e])));constructor({uiManager:e,pageIndex:t,div:a,structTreeLayer:n,accessibilityManager:i,annotationLayer:r,drawLayer:o,textLayer:s,viewport:l,l10n:c}){const u=[..._xe.#B.values()];if(!_xe._initialized){_xe._initialized=!0;for(const t of u)t.initialize(c,e)}e.registerEditorTypes(u),this.#g=e,this.pageIndex=t,this.div=a,this.#ti=i,this.#Go=r,this.viewport=l,this.#es=s,this.drawLayer=o,this._structTree=n,this.#g.addLayer(this)}get isEmpty(){return 0===this.#Yo.size}get isInvisible(){return this.isEmpty&&this.#g.getMode()===Pfe.NONE}updateToolbar(e){this.#g.updateToolbar(e)}updateMode(e=this.#g.getMode()){switch(this.#as(),e){case Pfe.NONE:return this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),void this.disableClick();case Pfe.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case Pfe.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:t}=this.div;for(const a of _xe.#B.values())t.toggle(`${a._type}Editing`,e===a._editorType);this.div.hidden=!1}hasTextLayer(e){return e===this.#es?.div}addInkEditorIfNeeded(e){if(this.#g.getMode()!==Pfe.INK)return;if(!e)for(const e of this.#Yo.values())if(e.isEmpty())return void e.setInBackground();this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}setEditingState(e){this.#g.setEditingState(e)}addCommands(e){this.#g.addCommands(e)}toggleDrawing(e=!1){this.div.classList.toggle("drawing",!e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(e=!1){this.#Go?.div.classList.toggle("disabled",!e)}async enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);const e=new Set;for(const t of this.#Yo.values())t.enableEditing(),t.show(!0),t.annotationElementId&&(this.#g.removeChangedExistingAnnotation(t),e.add(t.annotationElementId));if(!this.#Go)return;const t=this.#Go.getEditableAnnotations();for(const a of t){if(a.hide(),this.#g.isDeletedAnnotationElement(a.data.id))continue;if(e.has(a.data.id))continue;const t=await this.deserialize(a);t&&(this.addOrRebuild(t),t.enableEditing())}}disable(){this.#Jo=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1);const e=new Map,t=new Map;for(const a of this.#Yo.values())a.disableEditing(),a.annotationElementId&&(null===a.serialize()?(t.set(a.annotationElementId,a),this.getEditableAnnotation(a.annotationElementId)?.show(),a.remove()):e.set(a.annotationElementId,a));if(this.#Go){const a=this.#Go.getEditableAnnotations();for(const n of a){const{id:a}=n.data;if(this.#g.isDeletedAnnotationElement(a))continue;let i=t.get(a);i?(i.resetAnnotationElement(n),i.show(!1),n.show()):(i=e.get(a),i&&(this.#g.addChangedExistingAnnotation(i),i.renderAnnotationElement(n)&&i.show(!1)),n.show())}}this.#as(),this.isEmpty&&(this.div.hidden=!0);const{classList:a}=this.div;for(const e of _xe.#B.values())a.remove(`${e._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),this.#Jo=!1}getEditableAnnotation(e){return this.#Go?.getEditableAnnotation(e)||null}setActiveEditor(e){this.#g.getActive()!==e&&this.#g.setActiveEditor(e)}enableTextSelection(){if(this.div.tabIndex=-1,this.#es?.div&&!this.#ts){this.#ts=new AbortController;const e=this.#g.combinedSignal(this.#ts);this.#es.div.addEventListener("pointerdown",this.#ns.bind(this),{signal:e}),this.#es.div.classList.add("highlighting")}}disableTextSelection(){this.div.tabIndex=0,this.#es?.div&&this.#ts&&(this.#ts.abort(),this.#ts=null,this.#es.div.classList.remove("highlighting"))}#ns(e){this.#g.unselectAll();const{target:t}=e;if(t===this.#es.div||("img"===t.getAttribute("role")||t.classList.contains("endOfContent"))&&this.#es.div.contains(t)){const{isMac:t}=Mye.platform;if(0!==e.button||e.ctrlKey&&t)return;this.#g.showAllEditors("highlight",!0,!0),this.#es.div.classList.add("free"),this.toggleDrawing(),Axe.startHighlighting(this,"ltr"===this.#g.direction,{target:this.#es.div,x:e.x,y:e.y}),this.#es.div.addEventListener("pointerup",(()=>{this.#es.div.classList.remove("free"),this.toggleDrawing(!0)}),{once:!0,signal:this.#g._signal}),e.preventDefault()}}enableClick(){if(this.#Ko)return;this.#Ko=new AbortController;const e=this.#g.combinedSignal(this.#Ko);this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:e}),this.div.addEventListener("pointerup",this.pointerup.bind(this),{signal:e})}disableClick(){this.#Ko?.abort(),this.#Ko=null}attach(e){this.#Yo.set(e.id,e);const{annotationElementId:t}=e;t&&this.#g.isDeletedAnnotationElement(t)&&this.#g.removeDeletedAnnotationElement(e)}detach(e){this.#Yo.delete(e.id),this.#ti?.removePointerInTextLayer(e.contentDiv),!this.#Jo&&e.annotationElementId&&this.#g.addDeletedAnnotationElement(e)}remove(e){this.detach(e),this.#g.removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1,this.#Qo||this.addInkEditorIfNeeded(!1)}changeParent(e){e.parent!==this&&(e.parent&&e.annotationElementId&&(this.#g.addDeletedAnnotationElement(e.annotationElementId),Ave.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),e.parent?.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(e.parent!==this||!e.isAttachedToDOM){if(this.changeParent(e),this.#g.addEditor(e),this.attach(e),!e.isAttachedToDOM){const t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(),this.#g.addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){if(!e.isAttachedToDOM)return;const{activeElement:t}=document;e.div.contains(t)&&!this.#Zo&&(e._focusEventsAllowed=!1,this.#Zo=setTimeout((()=>{this.#Zo=null,e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener("focusin",(()=>{e._focusEventsAllowed=!0}),{once:!0,signal:this.#g._signal}),t.focus())}),0)),e._structTreeParentId=this.#ti?.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||=this,e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){this.addCommands({cmd:()=>e._uiManager.rebuild(e),undo:()=>{e.remove()},mustExec:!1})}getNextId(){return this.#g.getId()}get#is(){return _xe.#B.get(this.#g.getMode())}combinedSignal(e){return this.#g.combinedSignal(e)}#rs(e){const t=this.#is;return t?new t.prototype.constructor(e):null}canCreateNewEmptyEditor(){return this.#is?.canCreateNewEmptyEditor()}pasteEditor(e,t){this.#g.updateToolbar(e),this.#g.updateMode(e);const{offsetX:a,offsetY:n}=this.#os(),i=this.getNextId(),r=this.#rs({parent:this,id:i,x:a,y:n,uiManager:this.#g,isCentered:!0,...t});r&&this.add(r)}async deserialize(e){return await(_xe.#B.get(e.annotationType??e.annotationEditorType)?.deserialize(e,this,this.#g))||null}createAndAddNewEditor(e,t,a={}){const n=this.getNextId(),i=this.#rs({parent:this,id:n,x:e.offsetX,y:e.offsetY,uiManager:this.#g,isCentered:t,...a});return i&&this.add(i),i}#os(){const{x:e,y:t,width:a,height:n}=this.div.getBoundingClientRect(),i=Math.max(0,e),r=Math.max(0,t),o=(i+Math.min(window.innerWidth,e+a))/2-e,s=(r+Math.min(window.innerHeight,t+n))/2-t,[l,c]=this.viewport.rotation%180==0?[o,s]:[s,o];return{offsetX:l,offsetY:c}}addNewEditor(){this.createAndAddNewEditor(this.#os(),!0)}setSelected(e){this.#g.setSelected(e)}toggleSelected(e){this.#g.toggleSelected(e)}unselect(e){this.#g.unselect(e)}pointerup(e){const{isMac:t}=Mye.platform;0!==e.button||e.ctrlKey&&t||e.target===this.div&&this.#Xo&&(this.#Xo=!1,this.#$o?this.#g.getMode()!==Pfe.STAMP?this.createAndAddNewEditor(e,!1):this.#g.unselectAll():this.#$o=!0)}pointerdown(e){if(this.#g.getMode()===Pfe.HIGHLIGHT&&this.enableTextSelection(),this.#Xo)return void(this.#Xo=!1);const{isMac:t}=Mye.platform;if(0!==e.button||e.ctrlKey&&t)return;if(e.target!==this.div)return;this.#Xo=!0;const a=this.#g.getActive();this.#$o=!a||a.isEmpty()}findNewParent(e,t,a){const n=this.#g.findParent(t,a);return null!==n&&n!==this&&(n.changeParent(e),!0)}destroy(){this.#g.getActive()?.parent===this&&(this.#g.commitOrRemove(),this.#g.setActiveEditor(null)),this.#Zo&&(clearTimeout(this.#Zo),this.#Zo=null);for(const e of this.#Yo.values())this.#ti?.removePointerInTextLayer(e.contentDiv),e.setParent(null),e.isAttachedToDOM=!1,e.div.remove();this.div=null,this.#Yo.clear(),this.#g.removeLayer(this)}#as(){this.#Qo=!0;for(const e of this.#Yo.values())e.isEmpty()&&e.remove();this.#Qo=!1}render({viewport:e}){this.viewport=e,dve(this.div,e);for(const e of this.#g.getEditors(this.pageIndex))this.add(e),e.rebuild();this.updateMode()}update({viewport:e}){this.#g.commitOrRemove(),this.#as();const t=this.viewport.rotation,a=e.rotation;if(this.viewport=e,dve(this.div,{rotation:a}),t!==a)for(const e of this.#Yo.values())e.rotate(a);this.addInkEditorIfNeeded(!1)}get pageDimensions(){const{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}get scale(){return this.#g.viewParameters.realScale}}class Cxe{#jn=null;#b=0;#ss=new Map;#ls=new Map;constructor({pageIndex:e}){this.pageIndex=e}setParent(e){if(this.#jn){if(this.#jn!==e){if(this.#ss.size>0)for(const t of this.#ss.values())t.remove(),e.append(t);this.#jn=e}}else this.#jn=e}static get _svgFactory(){return bye(this,"_svgFactory",new Nwe)}static#cs(e,{x:t=0,y:a=0,width:n=1,height:i=1}={}){const{style:r}=e;r.top=100*a+"%",r.left=100*t+"%",r.width=100*n+"%",r.height=100*i+"%"}#us(e){const t=Cxe._svgFactory.create(1,1,!0);return this.#jn.append(t),t.setAttribute("aria-hidden",!0),Cxe.#cs(t,e),t}#ds(e,t){const a=Cxe._svgFactory.createElement("clipPath");e.append(a);const n=`clip_${t}`;a.setAttribute("id",n),a.setAttribute("clipPathUnits","objectBoundingBox");const i=Cxe._svgFactory.createElement("use");return a.append(i),i.setAttribute("href",`#${t}`),i.classList.add("clip"),n}draw(e,t,a,n=!1){const i=this.#b++,r=this.#us(e.box);r.classList.add(...e.classNamesForDrawing);const o=Cxe._svgFactory.createElement("defs");r.append(o);const s=Cxe._svgFactory.createElement("path");o.append(s);const l=`path_p${this.pageIndex}_${i}`;s.setAttribute("id",l),s.setAttribute("d",e.toSVGPath()),n&&this.#ls.set(i,s);const c=this.#ds(o,l),u=Cxe._svgFactory.createElement("use");return r.append(u),r.setAttribute("fill",t),r.setAttribute("fill-opacity",a),u.setAttribute("href",`#${l}`),this.#ss.set(i,r),{id:i,clipPathId:`url(#${c})`}}drawOutline(e){const t=this.#b++,a=this.#us(e.box);a.classList.add(...e.classNamesForOutlining);const n=Cxe._svgFactory.createElement("defs");a.append(n);const i=Cxe._svgFactory.createElement("path");n.append(i);const r=`path_p${this.pageIndex}_${t}`;let o;if(i.setAttribute("id",r),i.setAttribute("d",e.toSVGPath()),i.setAttribute("vector-effect","non-scaling-stroke"),e.mustRemoveSelfIntersections){const e=Cxe._svgFactory.createElement("mask");n.append(e),o=`mask_p${this.pageIndex}_${t}`,e.setAttribute("id",o),e.setAttribute("maskUnits","objectBoundingBox");const a=Cxe._svgFactory.createElement("rect");e.append(a),a.setAttribute("width","1"),a.setAttribute("height","1"),a.setAttribute("fill","white");const i=Cxe._svgFactory.createElement("use");e.append(i),i.setAttribute("href",`#${r}`),i.setAttribute("stroke","none"),i.setAttribute("fill","black"),i.setAttribute("fill-rule","nonzero"),i.classList.add("mask")}const s=Cxe._svgFactory.createElement("use");a.append(s),s.setAttribute("href",`#${r}`),o&&s.setAttribute("mask",`url(#${o})`);const l=s.cloneNode();return a.append(l),s.classList.add("mainOutline"),l.classList.add("secondaryOutline"),this.#ss.set(t,a),t}finalizeLine(e,t){const a=this.#ls.get(e);this.#ls.delete(e),this.updateBox(e,t.box),a.setAttribute("d",t.toSVGPath())}updateLine(e,t){this.#ss.get(e).firstChild.firstChild.setAttribute("d",t.toSVGPath())}updatePath(e,t){this.#ls.get(e).setAttribute("d",t.toSVGPath())}updateBox(e,t){Cxe.#cs(this.#ss.get(e),t)}show(e,t){this.#ss.get(e).classList.toggle("hidden",!t)}rotate(e,t){this.#ss.get(e).setAttribute("data-main-rotation",t)}changeColor(e,t){this.#ss.get(e).setAttribute("fill",t)}changeOpacity(e,t){this.#ss.get(e).setAttribute("fill-opacity",t)}addClass(e,t){this.#ss.get(e).classList.add(t)}removeClass(e,t){this.#ss.get(e).classList.remove(t)}getSVGRoot(e){return this.#ss.get(e)}remove(e){this.#ls.delete(e),null!==this.#jn&&(this.#ss.get(e).remove(),this.#ss.delete(e))}destroy(){this.#jn=null;for(const e of this.#ss.values())e.remove();this.#ss.clear(),this.#ls.clear()}}var Txe=gfe.AbortException,Pxe=gfe.AnnotationEditorLayer,Oxe=gfe.AnnotationEditorParamsType,Mxe=gfe.AnnotationEditorType,Dxe=gfe.AnnotationEditorUIManager,Ixe=gfe.AnnotationLayer,Nxe=gfe.AnnotationMode,jxe=gfe.ColorPicker,zxe=gfe.DOMSVGFactory,Rxe=gfe.DrawLayer,Lxe=gfe.FeatureTest,Fxe=gfe.GlobalWorkerOptions,Bxe=gfe.ImageKind,Hxe=gfe.InvalidPDFException,qxe=gfe.MissingPDFException,Uxe=gfe.OPS,Vxe=gfe.OutputScale,Wxe=gfe.PDFDataRangeTransport,$xe=gfe.PDFDateString,Gxe=gfe.PDFWorker,Kxe=gfe.PasswordResponses,Zxe=gfe.PermissionFlag,Yxe=gfe.PixelsPerInch,Xxe=gfe.RenderingCancelledException,Qxe=gfe.TextLayer,Jxe=gfe.UnexpectedResponseException,eke=gfe.Util,tke=gfe.VerbosityLevel,ake=gfe.XfaLayer,nke=gfe.build,ike=gfe.createValidAbsoluteUrl,rke=gfe.fetchData,oke=gfe.getDocument,ske=gfe.getFilenameFromUrl,lke=gfe.getPdfFilenameFromUrl,cke=gfe.getXfaPageViewport,uke=gfe.isDataScheme,dke=gfe.isPdfFile,hke=gfe.noContextMenu,mke=gfe.normalizeUnicode,pke=gfe.setLayerDimensions,gke=gfe.shadow,fke=gfe.version,yke=Object.freeze({__proto__:null,AbortException:Txe,AnnotationEditorLayer:Pxe,AnnotationEditorParamsType:Oxe,AnnotationEditorType:Mxe,AnnotationEditorUIManager:Dxe,AnnotationLayer:Ixe,AnnotationMode:Nxe,ColorPicker:jxe,DOMSVGFactory:zxe,DrawLayer:Rxe,FeatureTest:Lxe,GlobalWorkerOptions:Fxe,ImageKind:Bxe,InvalidPDFException:Hxe,MissingPDFException:qxe,OPS:Uxe,OutputScale:Vxe,PDFDataRangeTransport:Wxe,PDFDateString:$xe,PDFWorker:Gxe,PasswordResponses:Kxe,PermissionFlag:Zxe,PixelsPerInch:Yxe,RenderingCancelledException:Xxe,TextLayer:Qxe,UnexpectedResponseException:Jxe,Util:eke,VerbosityLevel:tke,XfaLayer:ake,build:nke,createValidAbsoluteUrl:ike,fetchData:rke,getDocument:oke,getFilenameFromUrl:ske,getPdfFilenameFromUrl:lke,getXfaPageViewport:cke,isDataScheme:uke,isPdfFile:dke,noContextMenu:hke,normalizeUnicode:mke,setLayerDimensions:pke,shadow:gke,version:fke}),vke=function(e,t,a){if(a||2===arguments.length)for(var n,i=0,r=t.length;i<r;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))},bke=vke(vke(vke(vke(vke(vke(vke(vke(vke(vke(vke(vke(vke(vke(vke(vke(vke(vke([],["onCopy","onCut","onPaste"],!0),["onCompositionEnd","onCompositionStart","onCompositionUpdate"],!0),["onFocus","onBlur"],!0),["onInput","onInvalid","onReset","onSubmit"],!0),["onLoad","onError"],!0),["onKeyDown","onKeyPress","onKeyUp"],!0),["onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting"],!0),["onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp"],!0),["onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"],!0),["onSelect"],!0),["onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],!0),["onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut"],!0),["onScroll"],!0),["onWheel"],!0),["onAnimationStart","onAnimationEnd","onAnimationIteration"],!0),["onTransitionEnd"],!0),["onChange"],!0),["onToggle"],!0);function wke(e,t){var a={};return bke.forEach((function(n){var i=e[n];i&&(a[n]=t?function(e){return i(e,t(n))}:i)})),a}function xke(e){var t=!1,a=new Promise((function(a,n){e.then((function(e){return!t&&a(e)})).catch((function(e){return!t&&n(e)}))}));return{promise:a,cancel:function(){t=!0}}}var kke=function(){};if("production"!==process.env.NODE_ENV){var Ake=function(e,t){var a=arguments.length;t=new Array(a>1?a-1:0);for(var n=1;n<a;n++)t[n-1]=arguments[n];var i=0,r="Warning: "+e.replace(/%s/g,(function(){return t[i++]}));"undefined"!=typeof console&&console.error(r);try{throw new Error(r)}catch(e){}};kke=function(e,t,a){var n=arguments.length;a=new Array(n>2?n-2:0);for(var i=2;i<n;i++)a[i-2]=arguments[i];if(void 0===t)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");e||Ake.apply(null,[t].concat(a))}}var Ske=$t(kke),Eke=Object.prototype.hasOwnProperty;function _ke(e,t,a){for(a of e.keys())if(Cke(a,t))return a}function Cke(e,t){var a,n,i;if(e===t)return!0;if(e&&t&&(a=e.constructor)===t.constructor){if(a===Date)return e.getTime()===t.getTime();if(a===RegExp)return e.toString()===t.toString();if(a===Array){if((n=e.length)===t.length)for(;n--&&Cke(e[n],t[n]););return-1===n}if(a===Set){if(e.size!==t.size)return!1;for(n of e){if((i=n)&&"object"==typeof i&&!(i=_ke(t,i)))return!1;if(!t.has(i))return!1}return!0}if(a===Map){if(e.size!==t.size)return!1;for(n of e){if((i=n[0])&&"object"==typeof i&&!(i=_ke(t,i)))return!1;if(!Cke(n[1],t.get(i)))return!1}return!0}if(a===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(a===DataView){if((n=e.byteLength)===t.byteLength)for(;n--&&e.getInt8(n)===t.getInt8(n););return-1===n}if(ArrayBuffer.isView(e)){if((n=e.byteLength)===t.byteLength)for(;n--&&e[n]===t[n];);return-1===n}if(!a||"object"==typeof e){for(a in n=0,e){if(Eke.call(e,a)&&++n&&!Eke.call(t,a))return!1;if(!(a in t)||!Cke(e[a],t[a]))return!1}return Object.keys(t).length===n}}return e!=e&&t!=t}const Tke=o(null);function Pke({children:e,type:t}){return x("div",{className:`react-pdf__message react-pdf__message--${t}`,children:e})}class Oke{constructor(){this.externalLinkEnabled=!0,this.externalLinkRel=void 0,this.externalLinkTarget=void 0,this.isInPresentationMode=!1,this.pdfDocument=void 0,this.pdfViewer=void 0}setDocument(e){this.pdfDocument=e}setViewer(e){this.pdfViewer=e}setExternalLinkRel(e){this.externalLinkRel=e}setExternalLinkTarget(e){this.externalLinkTarget=e}setHistory(){}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return Y8(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber||0}set page(e){Y8(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber=e}get rotation(){return 0}set rotation(e){}goToDestination(e){return new Promise((t=>{Y8(this.pdfDocument,"PDF document not loaded."),Y8(e,"Destination is not specified."),"string"==typeof e?this.pdfDocument.getDestination(e).then(t):Array.isArray(e)?t(e):e.then(t)})).then((e=>{Y8(Array.isArray(e),`"${e}" is not a valid destination array.`);const t=e[0];new Promise((e=>{Y8(this.pdfDocument,"PDF document not loaded."),t instanceof Object?this.pdfDocument.getPageIndex(t).then((t=>{e(t)})).catch((()=>{Y8(!1,`"${t}" is not a valid page reference.`)})):"number"==typeof t?e(t):Y8(!1,`"${t}" is not a valid destination reference.`)})).then((t=>{const a=t+1;Y8(this.pdfViewer,"PDF viewer is not initialized."),Y8(a>=1&&a<=this.pagesCount,`"${a}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({dest:e,pageIndex:t,pageNumber:a})}))}))}navigateTo(e){this.goToDestination(e)}goToPage(e){const t=e-1;Y8(this.pdfViewer,"PDF viewer is not initialized."),Y8(e>=1&&e<=this.pagesCount,`"${e}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({pageIndex:t,pageNumber:e})}addLinkAttributes(e,t,a){e.href=t,e.rel=this.externalLinkRel||"noopener noreferrer nofollow",e.target=a?"_blank":this.externalLinkTarget||""}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}setHash(){}executeNamedAction(){}cachePageRef(){}isPageVisible(){return!0}isPageCached(){return!0}executeSetOCGState(){}}const Mke=1,Dke=2,Ike="undefined"!=typeof window,Nke=Ike&&"file:"===window.location.protocol;function jke(e){return function(e){return void 0!==e}(e)&&null!==e}function zke(e){return function(e){return"string"==typeof e}(e)&&/^data:/.test(e)}function Rke(e){Y8(zke(e),"Invalid data URI.");const[t="",a=""]=e.split(",");return-1!==t.split(";").indexOf("base64")?atob(a):unescape(a)}function Lke(){return Ike&&window.devicePixelRatio||1}const Fke="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function Bke(){Ske(!Nke,`Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ${Fke}`)}function Hke(e){(null==e?void 0:e.cancel)&&e.cancel()}function qke(e,t){return Object.defineProperty(e,"width",{get(){return this.view[2]*t},configurable:!0}),Object.defineProperty(e,"height",{get(){return this.view[3]*t},configurable:!0}),Object.defineProperty(e,"originalWidth",{get(){return this.view[2]},configurable:!0}),Object.defineProperty(e,"originalHeight",{get(){return this.view[3]},configurable:!0}),e}function Uke(e,t){switch(t.type){case"RESOLVE":return{value:t.value,error:void 0};case"REJECT":return{value:!1,error:t.error};case"RESET":return{value:void 0,error:void 0};default:return e}}function Vke(){return v(Uke,{value:void 0,error:void 0})}var Wke=function(e,t,a,n){return new(a||(a=Promise))((function(i,r){function o(e){try{l(n.next(e))}catch(e){r(e)}}function s(e){try{l(n.throw(e))}catch(e){r(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof a?e:new a((function(t){t(e)}))}(e.value).then(o,s)}l((n=n.apply(e,t||[])).next())}))},$ke=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(a[n[i]]=e[n[i]])}return a};const{PDFDataRangeTransport:Gke}=yke,Kke=(e,t)=>{switch(t){case Mke:e(prompt("Enter the password to open this PDF file."));break;case Dke:e(prompt("Invalid password. Please try again."));break}};function Zke(e){return"object"==typeof e&&null!==e&&("data"in e||"range"in e||"url"in e)}const Yke=a((function(e,t){var{children:a,className:n,error:i="Failed to load PDF file.",externalLinkRel:r,externalLinkTarget:o,file:c,inputRef:u,imageResourcesPath:d,loading:h="Loading PDF…",noData:f="No PDF file specified.",onItemClick:y,onLoadError:v,onLoadProgress:b,onLoadSuccess:w,onPassword:k=Kke,onSourceError:A,onSourceSuccess:S,options:E,renderMode:_,rotate:C}=e,T=$ke(e,["children","className","error","externalLinkRel","externalLinkTarget","file","inputRef","imageResourcesPath","loading","noData","onItemClick","onLoadError","onLoadProgress","onLoadSuccess","onPassword","onSourceError","onSourceSuccess","options","renderMode","rotate"]);const[P,O]=Vke(),{value:M,error:D}=P,[I,N]=Vke(),{value:j,error:z}=I,R=s(new Oke),L=s([]),F=s(void 0),B=s(void 0);c&&c!==F.current&&Zke(c)&&(Ske(!Cke(c,F.current),'File prop passed to <Document /> changed, but it\'s equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.'),F.current=c),E&&E!==B.current&&(Ske(!Cke(E,B.current),'Options prop passed to <Document /> changed, but it\'s equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.'),B.current=E);const H=s({scrollPageIntoView:e=>{const{dest:t,pageNumber:a,pageIndex:n=a-1}=e;if(y)return void y({dest:t,pageIndex:n,pageNumber:a});const i=L.current[n];i?i.scrollIntoView():Ske(!1,`An internal link leading to page ${a} was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document> and handle navigating by yourself or ensure that all pages are rendered within <Document>.`)}});m(t,(()=>({linkService:R,pages:L,viewer:H})),[]),l((function(){O({type:"RESET"})}),[c,O]);const q=p((()=>Wke(this,void 0,void 0,(function*(){if(!c)return null;if("string"==typeof c){if(zke(c)){return{data:Rke(c)}}return Bke(),{url:c}}if(c instanceof Gke)return{range:c};if(c instanceof ArrayBuffer)return{data:c};if(Ike&&function(e){return Y8(Ike,"isBlob can only be used in a browser environment"),e instanceof Blob}(c)){const e=yield function(e){return new Promise(((t,a)=>{const n=new FileReader;n.onload=()=>{if(!n.result)return a(new Error("Error while reading a file."));t(n.result)},n.onerror=e=>{if(!e.target)return a(new Error("Error while reading a file."));const{error:t}=e.target;if(!t)return a(new Error("Error while reading a file."));switch(t.code){case t.NOT_FOUND_ERR:return a(new Error("Error while reading a file: File not found."));case t.SECURITY_ERR:return a(new Error("Error while reading a file: Security error."));case t.ABORT_ERR:return a(new Error("Error while reading a file: Aborted."));default:return a(new Error("Error while reading a file."))}},n.readAsArrayBuffer(e)}))}(c);return{data:e}}if(Y8("object"==typeof c,"Invalid parameter in file, need either Uint8Array, string or a parameter object"),Y8(Zke(c),"Invalid parameter object: need either .data, .range or .url"),"url"in c&&"string"==typeof c.url){if(zke(c.url)){const{url:e}=c,t=$ke(c,["url"]),a=Rke(e);return Object.assign({data:a},t)}Bke()}return c}))),[c]);l((()=>{const e=xke(q());return e.promise.then((e=>{O({type:"RESOLVE",value:e})})).catch((e=>{O({type:"REJECT",error:e})})),()=>{Hke(e)}}),[q,O]),l((()=>{void 0!==M&&(!1!==M?S&&S():D&&(Ske(!1,D.toString()),A&&A(D)))}),[M]),l((function(){N({type:"RESET"})}),[N,M]),l((function(){if(!M)return;const e=E?Object.assign(Object.assign({},M),E):M,t=oke(e);b&&(t.onProgress=b),k&&(t.onPassword=k);const a=t,n=a.promise.then((e=>{N({type:"RESOLVE",value:e})})).catch((e=>{a.destroyed||N({type:"REJECT",error:e})}));return()=>{n.finally((()=>a.destroy()))}}),[E,N,M]),l((()=>{void 0!==j&&(!1!==j?j&&(w&&w(j),L.current=new Array(j.numPages),R.current.setDocument(j)):z&&(Ske(!1,z.toString()),v&&v(z)))}),[j]),l((function(){R.current.setViewer(H.current),R.current.setExternalLinkRel(r),R.current.setExternalLinkTarget(o)}),[r,o]);const U=p(((e,t)=>{L.current[e]=t}),[]),V=p((e=>{delete L.current[e]}),[]),W=g((()=>({imageResourcesPath:d,linkService:R.current,onItemClick:y,pdf:j,registerPage:U,renderMode:_,rotate:C,unregisterPage:V})),[d,y,j,U,_,C,V]),$=g((()=>wke(T,(()=>j))),[T,j]);return x("div",Object.assign({className:FU("react-pdf__Document",n),ref:u,style:{"--scale-factor":"1"}},$,{children:c?null==j?x(Pke,{type:"loading",children:"function"==typeof h?h():h}):!1===j?x(Pke,{type:"error",children:"function"==typeof i?i():i}):x(Tke.Provider,{value:W,children:a}):x(Pke,{type:"no-data",children:"function"==typeof f?f():f})}))}));function Xke(){return r(Tke)}function Qke(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var a=e.filter(Boolean);return a.length<=1?a[0]||null:function(e){a.forEach((function(t){"function"==typeof t?t(e):t&&(t.current=e)}))}}const Jke=o(null),eAe={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},tAe=/^H(\d+)$/;function aAe(e){return"children"in e}function nAe(e){return!!aAe(e)&&(1===e.children.length&&0 in e.children&&"id"in e.children[0])}function iAe(e){const t={};if(aAe(e)){const{role:a}=e,n=a.match(tAe);if(n)t.role="heading",t["aria-level"]=Number(n[1]);else if(function(e){return e in eAe}(a)){const e=eAe[a];e&&(t.role=e)}}return t}function rAe(e){const t={};if(aAe(e)){if(void 0!==e.alt&&(t["aria-label"]=e.alt),void 0!==e.lang&&(t.lang=e.lang),nAe(e)){const[a]=e.children;if(a){const e=rAe(a);return Object.assign(Object.assign({},t),e)}}}else"id"in e&&(t["aria-owns"]=e.id);return t}function oAe(e){return e?Object.assign(Object.assign({},iAe(e)),rAe(e)):null}function sAe({className:e,node:t}){const a=g((()=>oAe(t)),[t]),n=g((()=>aAe(t)?nAe(t)?null:t.children.map(((e,t)=>x(sAe,{node:e},t))):null),[t]);return x("span",Object.assign({className:e},a,{children:n}))}function lAe(){return r(Jke)}function cAe(){const e=lAe();Y8(e,"Unable to find Page context.");const{onGetStructTreeError:t,onGetStructTreeSuccess:a}=e,[n,i]=Vke(),{value:r,error:o}=n,{customTextRenderer:s,page:c}=e;return l((function(){i({type:"RESET"})}),[i,c]),l((function(){if(s)return;if(!c)return;const e=xke(c.getStructTree()),t=e;return e.promise.then((e=>{i({type:"RESOLVE",value:e})})).catch((e=>{i({type:"REJECT",error:e})})),()=>Hke(t)}),[s,c,i]),l((()=>{void 0!==r&&(!1!==r?r&&a&&a(r):o&&(Ske(!1,o.toString()),t&&t(o)))}),[r]),r?x(sAe,{className:"react-pdf__Page__structTree structTree",node:r}):null}const uAe=Nxe;function dAe(e){const t=lAe();Y8(t,"Unable to find Page context.");const a=Object.assign(Object.assign({},t),e),{_className:n,canvasBackground:i,devicePixelRatio:r=Lke(),onRenderError:o,onRenderSuccess:c,page:u,renderForms:d,renderTextLayer:h,rotate:m,scale:f}=a,{canvasRef:y}=e;Y8(u,"Attempted to render page canvas, but no page was specified.");const v=s(null);function b(e){(function(e){return"RenderingCancelledException"===e.name})(e)||(Ske(!1,e.toString()),o&&o(e))}const w=g((()=>u.getViewport({scale:f*r,rotation:m})),[r,u,m,f]),k=g((()=>u.getViewport({scale:f,rotation:m})),[u,m,f]);l((function(){if(!u)return;u.cleanup();const{current:e}=v;if(!e)return;e.width=w.width,e.height=w.height,e.style.width=`${Math.floor(k.width)}px`,e.style.height=`${Math.floor(k.height)}px`,e.style.visibility="hidden";const t={annotationMode:d?uAe.ENABLE_FORMS:uAe.ENABLE,canvasContext:e.getContext("2d",{alpha:!1}),viewport:w};i&&(t.background=i);const a=u.render(t),n=a;return a.promise.then((()=>{e.style.visibility="",u&&c&&c(qke(u,f))})).catch(b),()=>Hke(n)}),[i,u,d,w,k]);const A=p((()=>{const{current:e}=v;e&&(e.width=0,e.height=0)}),[]);return l((()=>A),[A]),x("canvas",{className:`${n}__canvas`,dir:"ltr",ref:Qke(y,v),style:{display:"block",userSelect:"none"},children:h?x(cAe,{}):null})}function hAe(){const e=lAe();Y8(e,"Unable to find Page context.");const{customTextRenderer:t,onGetTextError:a,onGetTextSuccess:n,onRenderTextLayerError:i,onRenderTextLayerSuccess:r,page:o,pageIndex:c,pageNumber:u,rotate:d,scale:h}=e;Y8(o,"Attempted to load page text content, but no page was specified.");const[m,f]=Vke(),{value:y,error:v}=m,w=s(null);Ske(1===Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10),"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer"),l((function(){f({type:"RESET"})}),[o,f]),l((function(){if(!o)return;const e=xke(o.getTextContent()),t=e;return e.promise.then((e=>{f({type:"RESOLVE",value:e})})).catch((e=>{f({type:"REJECT",error:e})})),()=>Hke(t)}),[o,f]),l((()=>{void 0!==y&&(!1!==y?y&&n&&n(y):v&&(Ske(!1,v.toString()),a&&a(v)))}),[y]);const k=p((()=>{r&&r()}),[r]),A=p((e=>{Ske(!1,e.toString()),i&&i(e)}),[i]);const S=g((()=>o.getViewport({scale:h,rotation:d})),[o,d,h]);return b((function(){if(!o||!y)return;const{current:e}=w;if(!e)return;e.innerHTML="";const a=o.streamTextContent({includeMarkedContent:!0}),n=new Qxe({container:e,textContentSource:a,viewport:S}),i=n;return n.render().then((()=>{const a=document.createElement("div");a.className="endOfContent",e.append(a);const n=e.querySelectorAll('[role="presentation"]');if(t){let e=0;y.items.forEach(((a,i)=>{if(!function(e){return"str"in e}(a))return;const r=n[e];if(!r)return;const o=t(Object.assign({pageIndex:c,pageNumber:u,itemIndex:i},a));r.innerHTML=o,e+=a.str&&a.hasEOL?2:1}))}k()})).catch(A),()=>Hke(i)}),[t,A,k,o,c,u,y,S]),x("div",{className:FU("react-pdf__Page__textContent","textLayer"),onMouseUp:function(){const e=w.current;e&&e.classList.remove("selecting")},onMouseDown:function(){const e=w.current;e&&e.classList.add("selecting")},ref:w})}function mAe(){const e=Xke(),t=lAe();Y8(t,"Unable to find Page context.");const a=Object.assign(Object.assign({},e),t),{imageResourcesPath:n,linkService:i,onGetAnnotationsError:r,onGetAnnotationsSuccess:o,onRenderAnnotationLayerError:c,onRenderAnnotationLayerSuccess:u,page:d,pdf:h,renderForms:m,rotate:p,scale:f=1}=a;Y8(h,"Attempted to load page annotations, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop."),Y8(d,"Attempted to load page annotations, but no page was specified."),Y8(i,"Attempted to load page annotations, but no linkService was specified.");const[y,v]=Vke(),{value:b,error:w}=y,k=s(null);Ske(1===Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10),"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations"),l((function(){v({type:"RESET"})}),[v,d]),l((function(){if(!d)return;const e=xke(d.getAnnotations()),t=e;return e.promise.then((e=>{v({type:"RESOLVE",value:e})})).catch((e=>{v({type:"REJECT",error:e})})),()=>{Hke(t)}}),[v,d]),l((()=>{void 0!==b&&(!1!==b?b&&o&&o(b):w&&(Ske(!1,w.toString()),r&&r(w)))}),[b]);const A=g((()=>d.getViewport({scale:f,rotation:p})),[d,p,f]);return l((function(){if(!(h&&d&&i&&b))return;const{current:e}=k;if(!e)return;const t=A.clone({dontFlip:!0}),a={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,div:e,l10n:null,page:d,structTreeLayer:null,viewport:t},r={annotations:b,annotationStorage:h.annotationStorage,div:e,imageResourcesPath:n,linkService:i,page:d,renderForms:m,viewport:t};e.innerHTML="";try{new Ixe(a).render(r),u&&u()}catch(e){!function(e){Ske(!1,`${e}`),c&&c(e)}(e)}return()=>{}}),[b,n,i,d,h,m,A]),x("div",{className:FU("react-pdf__Page__annotations","annotationLayer"),ref:k})}var pAe=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(a[n[i]]=e[n[i]])}return a};const gAe=1;function fAe(e){const t=Xke(),a=Object.assign(Object.assign({},t),e),{_className:n="react-pdf__Page",_enableRegisterUnregisterPage:i=!0,canvasBackground:r,canvasRef:o,children:c,className:u,customRenderer:d,customTextRenderer:h,devicePixelRatio:m,error:p="Failed to load the page.",height:f,inputRef:y,loading:v="Loading page…",noData:b="No page specified.",onGetAnnotationsError:w,onGetAnnotationsSuccess:A,onGetStructTreeError:S,onGetStructTreeSuccess:E,onGetTextError:_,onGetTextSuccess:C,onLoadError:T,onLoadSuccess:P,onRenderAnnotationLayerError:O,onRenderAnnotationLayerSuccess:M,onRenderError:D,onRenderSuccess:I,onRenderTextLayerError:N,onRenderTextLayerSuccess:j,pageIndex:z,pageNumber:R,pdf:L,registerPage:F,renderAnnotationLayer:B=!0,renderForms:H=!1,renderMode:q="canvas",renderTextLayer:U=!0,rotate:V,scale:W=gAe,unregisterPage:$,width:G}=a,K=pAe(a,["_className","_enableRegisterUnregisterPage","canvasBackground","canvasRef","children","className","customRenderer","customTextRenderer","devicePixelRatio","error","height","inputRef","loading","noData","onGetAnnotationsError","onGetAnnotationsSuccess","onGetStructTreeError","onGetStructTreeSuccess","onGetTextError","onGetTextSuccess","onLoadError","onLoadSuccess","onRenderAnnotationLayerError","onRenderAnnotationLayerSuccess","onRenderError","onRenderSuccess","onRenderTextLayerError","onRenderTextLayerSuccess","pageIndex","pageNumber","pdf","registerPage","renderAnnotationLayer","renderForms","renderMode","renderTextLayer","rotate","scale","unregisterPage","width"]),[Z,Y]=Vke(),{value:X,error:Q}=Z,J=s(null);Y8(L,"Attempted to load a page, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop.");const ee=jke(R)?R-1:null!=z?z:null,te=null!=R?R:jke(z)?z+1:null,ae=null!=V?V:X?X.rotate:null,ne=g((()=>{if(!X)return null;let e=1;const t=null!=W?W:gAe;if(G||f){const t=X.getViewport({scale:1,rotation:ae});G?e=G/t.width:f&&(e=f/t.height)}return t*e}),[f,X,ae,W,G]);l((function(){return()=>{jke(ee)&&i&&$&&$(ee)}}),[i,L,ee,$]),l((function(){Y({type:"RESET"})}),[Y,L,ee]),l((function(){if(!L||!te)return;const e=xke(L.getPage(te)),t=e;return e.promise.then((e=>{Y({type:"RESOLVE",value:e})})).catch((e=>{Y({type:"REJECT",error:e})})),()=>Hke(t)}),[Y,L,te]),l((()=>{void 0!==X&&(!1!==X?function(){if(P){if(!X||!ne)return;P(qke(X,ne))}if(i&&F){if(!jke(ee)||!J.current)return;F(ee,J.current)}}():Q&&(Ske(!1,Q.toString()),T&&T(Q)))}),[X,ne]);const ie=g((()=>X&&jke(ee)&&te&&jke(ae)&&jke(ne)?{_className:n,canvasBackground:r,customTextRenderer:h,devicePixelRatio:m,onGetAnnotationsError:w,onGetAnnotationsSuccess:A,onGetStructTreeError:S,onGetStructTreeSuccess:E,onGetTextError:_,onGetTextSuccess:C,onRenderAnnotationLayerError:O,onRenderAnnotationLayerSuccess:M,onRenderError:D,onRenderSuccess:I,onRenderTextLayerError:N,onRenderTextLayerSuccess:j,page:X,pageIndex:ee,pageNumber:te,renderForms:H,renderTextLayer:U,rotate:ae,scale:ne}:null),[n,r,h,m,w,A,S,E,_,C,O,M,D,I,N,j,X,ee,te,H,U,ae,ne]),re=g((()=>wke(K,(()=>X?ne?qke(X,ne):void 0:X))),[K,X,ne]),oe=`${ee}@${ne}/${ae}`;function se(){switch(q){case"custom":return Y8(d,'renderMode was set to "custom", but no customRenderer was passed.'),x(d,{},`${oe}_custom`);case"none":return null;default:return x(dAe,{canvasRef:o},`${oe}_canvas`)}}return x("div",Object.assign({className:FU(n,u),"data-page-number":te,ref:Qke(y,J),style:{"--scale-factor":`${ne}`,backgroundColor:r||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"}},re,{children:te?null===L||null==X?x(Pke,{type:"loading",children:"function"==typeof v?v():v}):!1===L||!1===X?x(Pke,{type:"error",children:"function"==typeof p?p():p}):k(Jke.Provider,{value:ie,children:[se(),U?x(hAe,{},`${oe}_text`):null,B?x(mAe,{},`${oe}_annotations`):null,c]}):x(Pke,{type:"no-data",children:"function"==typeof b?b():b})}))}Ske(!Nke,`Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ${Fke}`),Fxe.workerSrc="pdf.worker.mjs";function yAe(e){const[a,n]=c(),[i,r]=c();if(!e.url)return null;const o=a?Math.min(e.maxHeight/a,1):1,s=i?Math.min(e.maxWidth/i,1):1,l=Math.min(o,s);return t.createElement("div",{className:"mdhui-pdf-preview",style:e.style,ref:e.innerRef},t.createElement(Yke,{file:e.url},t.createElement(fAe,{pageNumber:1,scale:l,onLoadSuccess:t=>{a?e.onLoad?.():(n(t.height),r(t.width))},renderTextLayer:!1,renderAnnotationLayer:!1})))}A(".mdhui-pdf-preview .react-pdf__Page {\n display: flex;\n align-items: center;\n justify-content: center;\n}"),Fxe.workerSrc="/assets/pdf.worker.min.js";function vAe(e){const[a,n]=c(!0),[i,r]=c(null);function o(){if("Default"==e.previewState)return r({name:"My Project Name",organization:{name:"My Organization Name",color:"#0076BE",logoUrl:"https://rkstudio.careevolution.com/inv/api/researchkit/organizationbrandingimage/1e1853a2-50d3-4e26-863d-d8546bce63e3"}}),void n(!1);w.getProjectInfo().then((function(e){r(e),n(!1)}))}l((()=>(o(),w.on("applicationDidBecomeVisible",o),()=>{w.off("applicationDidBecomeVisible",o)})),[]);var s=i?.organization.logoUrl;return s&&!s?.startsWith("http")&&(s=w.baseUrl+i?.organization.logoUrl),t.createElement("div",{ref:e.innerRef,className:"mdhui-project-header"},a&&t.createElement(XA,null),!a&&i&&t.createElement("div",null,t.createElement("div",{style:{backgroundImage:"url('"+s+"')"},className:"logo"}),t.createElement("div",{className:"project-info"},t.createElement("div",{className:"project-name",style:{color:i.organization.color}},i.name),t.createElement("div",{className:"organization-name"},i.organization.name))))}A(".mdhui-project-header\n{\n padding: 16px;\n text-align: center;\n background: #FFF;\n border-bottom: solid 1px var(--mdhui-border-color-1);\n line-height: normal;\n}\n\n .mdhui-project-header .logo\n {\n display: inline-block;\n width: 48px;\n height: 48px;\n background-size: contain;\n background-position: center center;\n background-repeat: no-repeat;\n vertical-align: middle;\n }\n\n .mdhui-project-header .project-info\n {\n display: inline-block;\n text-align: left;\n padding-left: 16px;\n vertical-align: top;\n padding-right: 16px;\n max-width: calc(100% - 80px);\n }\n\n .mdhui-project-header .project-info .project-name\n {\n font-weight: bold;\n font-size: 1.5em;\n max-width: 100%;\n }\n\n .mdhui-project-header .project-info .organization-name\n {\n max-width: 100%;\n color: #333;\n }\n");function bAe(e){const[a,n]=c(!0),[i,r]=c(null);function o(){if("Default"==e.previewState)return r({supportEmail:"test@example.com",supportPhone:"555-555-1212",learnMoreLink:"https://mydatahelps.org",learnMoreTitle:"Project Home Page"}),void n(!1);w.getProjectInfo().then((function(e){r(e),n(!1)}))}return l((()=>(o(),w.on("applicationDidBecomeVisible",o),()=>{w.off("applicationDidBecomeVisible",o)})),[]),!i||i.supportEmail||i.supportPhone||i.learnMoreLink&&i.learnMoreTitle?t.createElement("div",{ref:e.innerRef,className:"mdhui-project-support"},t.createElement("div",{className:"title"},no("support")),a&&t.createElement(XA,null),i?.learnMoreLink&&i?.learnMoreTitle&&t.createElement(Za,{indicatorIcon:I,subtitle:i.learnMoreTitle,onClick:()=>w.openEmbeddedUrl(i.learnMoreLink)}),i?.supportEmail&&t.createElement(Za,{indicatorIcon:ae,subtitle:i.supportEmail,onClick:()=>w.openExternalUrl("mailto:"+i.supportEmail)}),i?.supportPhone&&t.createElement(Za,{indicatorIcon:J,subtitle:i.supportPhone,onClick:()=>w.openExternalUrl("tel:"+i.supportPhone)})):null}A(".mdhui-project-support>.title {\n font-weight: bold;\n padding: 16px;\n padding-bottom: 0;\n}\n\n.mdhui-project-support .mdhui-action {\n color: var(--mdhui-color-primary);\n border-bottom: solid 1px var(--mdhui-border-color-0);\n}\n\n.mdhui-project-support .mdhui-action .subtitle {\n color: var(--mdhui-color-primary);\n}");A(".mdhui-provider-search .search-bar-wrapper {\n text-align: left;\n box-sizing: border-box;\n font-weight: bold;\n border-bottom: solid 1px var(--mdhui-border-color-1);\n}\n\n.mdhui-provider-search .search-bar-wrapper .search-bar {\n position: relative;\n}\n\n.mdhui-provider-search .search-bar-wrapper .search-bar input {\n padding: 0;\n margin: 0;\n border: 0;\n width: 100%;\n line-height: 1.5em;\n padding-left: 40px;\n box-sizing: border-box;\n font-size: .88em;\n padding-top: 8px;\n padding-bottom: 8px;\n border: none;\n background: var(--mdhui-background-color-0);\n color: var(--mdhui-text-color-1);\n}\n\n.mdhui-provider-search .search-bar-wrapper .search-bar .fa-magnifying-glass {\n position: absolute;\n left: 16px;\n top: 12px;\n color: var(--mdhui-text-color-4);\n font-size: .8em;\n}\n\n.mdhui-provider-search .search-results .provider {\n border-bottom: solid 1px var(--mdhui-border-color-1);\n padding: 16px;\n padding-top: 8px;\n padding-bottom: 8px;\n cursor: pointer;\n font-size: .88em;\n width: 100%;\n display: flex;\n flex-direction: row;\n gap: 16px;\n align-items: center;\n min-height: 61px;\n}\n\n.mdhui-provider-search .search-results .provider .provider-info {\n flex-grow: 1;\n}\n\n\n.mdhui-provider-search .search-results .provider .provider-logo {\n height: 44px;\n width: 72px;\n background-size: contain;\n background-repeat: no-repeat;\n background-position: center center;\n background-color: #FFF;\n border-radius: 4px;\n flex-shrink: 0;\n}\n\n.mdhui-provider-search .search-results .provider .provider-status {\n font-size: .88em;\n font-weight: bold;\n}\n\n.mdhui-provider-search .search-results .provider .provider-status.error-status {\n color: var(--mdhui-color-danger);\n}\n\n.mdhui-provider-search .search-results .provider .provider-status.connected-status {\n color: var(--mdhui-color-success);\n}\n\n.mdhui-provider-search .search-results .provider.disabled {\n cursor: default;\n}");var wAe=[{id:20,name:"1upHealth sandbox",category:"Health Plan",logoUrl:"https://mdhorg.ce.dev/api/v1/delegated/externalaccountproviders/20/logo",enabled:!0},{id:2,name:"Fitbit",category:"Device Manufacturer",logoUrl:"https://mdhorg.ce.dev/api/v1/delegated/externalaccountproviders/2/logo",enabled:!0},{id:13,name:"A Woman's Place, LLC",category:"Provider",logoUrl:"https://mdhorg.ce.dev/api/v1/delegated/externalaccountproviders/13/logo",enabled:!0},{id:130,name:"Abington Jefferson Health",category:"Provider",logoUrl:"https://mdhorg.ce.dev/api/v1/delegated/externalaccountproviders/130/logo",enabled:!0},{id:41,name:"Access Community Health Network",category:"Provider",logoUrl:"https://mdhorg.ce.dev/api/v1/delegated/externalaccountproviders/41/logo",enabled:!0},{id:125,name:"Aurora Health Care - myAurora",category:"Provider",logoUrl:"https://mdhorg.ce.dev/api/v1/delegated/externalaccountproviders/125/logo",enabled:!0},{id:1,name:"CareEvolution FHIR",category:"Provider",logoUrl:"https://mdhorg.ce.dev/api/v1/delegated/externalaccountproviders/1/logo",enabled:!0},{id:37,name:"Cedars-Sinai Health System",category:"Provider",logoUrl:"https://mdhorg.ce.dev/api/v1/delegated/externalaccountproviders/37/logo",enabled:!0},{id:27,name:"Maui Medical Group",category:"Provider",logoUrl:"https://mdhorg.ce.dev/api/v1/delegated/externalaccountproviders/27/logo",enabled:!0}];const xAe="Unavailable";let kAe=0;function AAe(e){const[a,n]=c({}),[i,r]=c([]),[o,u]=c(!0),[d,h]=c(""),[m,p]=c(0),[f,y]=c(0),v=s(d),b=100;async function x(){w.getExternalAccounts().then((function(e){let t={};for(let a=0;a<e.length;a++)t[e[a].provider.id]=e[a];n(t)}))}function k(t){u(!0);let a=++kAe;if(e.publicProviderSearchApiUrl){const n=new URL(e.publicProviderSearchApiUrl);n.searchParams.append("keyword",t),n.searchParams.append("pageSize",String(b)),n.searchParams.append("pageNumber",String(m+1)),fetch(n.toString(),{method:"GET",headers:{Accept:"application/json"}}).then((e=>e.json())).then((function(e){a==kAe&&(A(e.Providers.map((e=>({id:e.ID,name:e.OrganizationName,logoUrl:e.LogoURL,category:e.Category})))||[]),y(e.TotalCount),u(!1))})).catch((function(e){console.error("Error fetching external account providers",e),u(!1)}))}else w.getExternalAccountProviders(t,1==e.providerCategories?.length?e.providerCategories[0]:null,b,m).then((function(e){a==kAe&&(A(e.externalAccountProviders),y(e.totalExternalAccountProviders),u(!1))})).catch((function(e){console.error("Error fetching external account providers",e),u(!1)}))}function A(t){let a=i;""===v.current&&e.featuredProviders&&(a=a.concat(e.featuredProviders),t=t.filter((t=>!e.featuredProviders.find((e=>e.id==t.id)))));const n=a.concat(t).filter((t=>-1!=e.providerCategories?.indexOf(t.category)&&t.message!==xAe));n.forEach((e=>{void 0===e.enabled&&(e.enabled=!0)})),r(n)}const E=(e,t=300)=>{let a;return function(...n){clearTimeout(a),a=setTimeout((()=>e.apply(this,n)),t)}},_=g((()=>E(k,300)),[]);function C(t){var a;a=t.target.value,v.current=a,h(a),r([]),p(0),e.previewState||_(t.target.value)}function T(){x().then((function(){k(v.current)}))}l((()=>(e.previewState?"Default"==e.previewState&&(A(wAe),u(!1)):x().then((function(){k("")})),w.on("applicationDidBecomeVisible",T),()=>{w.off("applicationDidBecomeVisible",T)})),[]),l((()=>{o||k(v.current)}),[m]);return t.createElement("div",{ref:e.innerRef,className:"mdhui-provider-search"},t.createElement("div",{className:"search-bar-wrapper"},t.createElement("div",{className:"search-bar"},t.createElement("input",{title:no("search"),type:"text",value:d,onChange:e=>C(e),placeholder:no("search"),spellCheck:"false",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off"}),t.createElement(Ne,{icon:fe}))),t.createElement("div",{className:"search-results"},i&&i.map((n=>t.createElement(S,{key:n.id,className:n.enabled?"provider":"provider disabled",onClick:()=>{e.onProviderSelected?e.onProviderSelected(n):function(t){const n=t.id;!t.enabled||e.previewState||a[n]&&"unauthorized"!=a[n].status||w.connectExternalAccount(n,e.connectExternalAccountOptions||{openNewWindow:!0}).then((function(){return e.onProviderConnected&&e.onProviderConnected(t),x()}))}(n)}},t.createElement("div",{className:"provider-info"},t.createElement("div",{className:"provider-name"},n.name),a[n.id]&&"unauthorized"==a[n.id].status&&t.createElement("div",{className:"provider-status error-status"},no("expired-reconnect")),a[n.id]&&"unauthorized"!=a[n.id].status&&t.createElement("div",{className:"provider-status connected-status"},no("connected")),!a[n.id]&&!n.enabled&&t.createElement("div",{className:"provider-status connected-status"},(()=>{const e={provider:n.name};n.relatedProvider&&(e.relatedProvider=n.relatedProvider),n.managingOrganization&&(e.managingOrganization=n.managingOrganization);return no(n.managingOrganization?"provider-disabled-reason-with-managing-organization":"provider-disabled-reason-without-managing-organization",void 0,e)})())),n.logoUrl&&t.createElement("div",{className:"provider-logo",style:{backgroundImage:"url('"+n.logoUrl+"')"}})))),!o&&!e.hideRequestProviderButton&&(!e.providerCategories||0==e.providerCategories.length||e.providerCategories.includes("Provider")||e.providerCategories.includes("Health Plan"))&&t.createElement(Za,{onClick:()=>{w.openEmbeddedUrl("https://help.mydatahelps.org/hc/en-us/requests/new?ticket_form_id=34288897775635")},title:(()=>{let t="";return e.providerCategories&&0!=e.providerCategories.length&&!e.providerCategories.includes("Provider")||(t+=no("external-accounts-title-providers")),e.providerCategories&&0!=e.providerCategories.length&&!e.providerCategories.includes("Health Plan")||(t.length>0&&(t+=no("external-accounts-title-divider")),t+=no("external-accounts-title-health-plans")),`${no("request-add")} ${t}`})()}),o&&t.createElement(XA,null)),t.createElement(Vue,{onTrigger:function(){p(m+1)},enabled:(m+1)*b<f}))}function SAe(e){let[a,n]=c(!0),[i,r]=c(null),o=Rr(),s=cn(o,{days:-6}),l=cn(o,{days:1});id((()=>{if(n(!0),"loading"!==e.previewState)return"loaded without data"===e.previewState?(r({}),void n(!1)):"loaded with data"===e.previewState?e.previewDataProvider?void e.previewDataProvider(s,l).then((e=>{r(e),n(!1)})):void Tc(s,l,0,2e4).then((e=>{r(e),n(!1)})):void Jc(e.dailyDataType).then((function(t){t?eu(e.dailyDataType,s,l).then((e=>{r(e),n(!1)})):(r(null),n(!1))}));r({})}),["externalAccountSyncComplete"],[e.previewState]);let u=s,d=[],h=!1;if(i)for(;u<l;){let t={daysAfterStart:_n(u,s)};d.push(t);let a=Br(u);null!=i[a]&&null!=i[a]&&(t.rawValue=i[a],t.value=e.valueConverter?e.valueConverter(i[a]):i[a],t.date=u,h=!0),u=cn(u,{days:1})}return t.createElement("div",{className:"mdhui-recent-daily-data-bar-chart",ref:e.innerRef},t.createElement(sM,{order:3,className:"mdhui-recent-daily-data-bar-chart-title"},e.title),t.createElement("div",{className:"mdhui-recent-daily-data-bar-chart-subtitle"},no("recent-daily-data-bar-chart-subtitle")),t.createElement("div",{className:"mdhui-recent-daily-data-bar-chart-container"},a&&t.createElement(XA,null),!a&&!h&&t.createElement("div",{className:"mdhui-recent-daily-data-bar-chart-no-data-label"},no("recent-daily-data-bar-chart-no-data")),t.createElement(T1,{width:"100%",height:200},t.createElement(Cue,{data:d,cx:20},(h||e.emptyDomain)&&t.createElement(nle,{vertical:!1,x:0,horizontal:({y1:e,y2:a,key:n})=>t.createElement("line",{x1:0,y1:e,x2:"100%",y2:a,stroke:"var(--mdhui-background-color-2)",key:n})}),t.createElement(Pce,{dataKey:"value",tick:({x:e,y:a,payload:n})=>t.createElement("text",{x:e-24,y:a+12,fontSize:"11",fontWeight:"bold",textAnchor:"middle",fill:"var(--mdhui-text-color-3)"},(e=>0===e?"":e>=1e4?wl(e/1e3)+"K":wl(e))(n.value)),axisLine:!1,tickLine:!1,interval:0,width:1,domain:h?e.domain:e.emptyDomain,orientation:"right"}),t.createElement(vce,{dataKey:"daysAfterStart",tick:({x:e,y:a,payload:n})=>{let i=n.value,r=cn(s,{days:i});return t.createElement("text",{x:e,y:a+8,fontSize:"11",fontWeight:"bold",textAnchor:"middle",fill:"var(--mdhui-text-color-2)"},cl(r))},axisLine:!1,minTickGap:0,tickLine:!1,interval:"preserveStartEnd",padding:{left:20,right:40}}),t.createElement(Vre,{key:"bar",type:"monotone",dataKey:"value",radius:[4,4,0,0]},t.createElement(z7,{dataKey:"value",position:"center",content:({x:a,y:n,width:i,value:r,index:o})=>{if(!r)return;let s="var(--mdhui-color-primary)";return e.highlight&&e.highlight(d[o].rawValue)&&(s="#6731AA"),t.createElement("text",{x:a+i/2,y:n-5,fontSize:10,fontWeight:"bold",textAnchor:"middle",fill:s},e.valueFormatter?e.valueFormatter(r):wl(r))}}),d.map(((a,n)=>e.highlight&&e.highlight(a.rawValue)?t.createElement(P1,{fill:"#D8BDF8",key:n}):t.createElement(P1,{fill:"#BBDEFF",key:n}))))))))}A(".mdhui-recent-daily-data-bar-chart {\n position: relative;\n margin-bottom: 48px;\n}\n\n.mdhui-recent-daily-data-bar-chart-title {\n padding: 0 16px;\n}\n\n.mdhui-recent-daily-data-bar-chart-subtitle {\n padding: 0 16px;\n margin-top: 2px;\n font-size: 0.95em;\n}\n\n.mdhui-recent-daily-data-bar-chart-container {\n position: relative;\n margin: 16px 16px 32px;\n padding: 0;\n background: var(--mdhui-background-color-1);\n border-radius: 12px;\n height: 200px;\n}\n\n.mdhui-recent-daily-data-bar-chart .recharts-surface {\n height: 270px !important;\n overflow: visible;\n}\n\n.mdhui-recent-daily-data-bar-chart-no-data-label, .mdhui-recent-daily-data-bar-chart .mdhui-loading-indicator {\n position: absolute;\n width: 120px;\n height: 20px;\n line-height: 20px;\n left: calc(50% - 68px);\n top: calc(50% - 26px);\n border: 1px solid var(--mdhui-border-color-1);\n background: var(--mdhui-background-color-0);\n border-radius: 12px;\n padding: 16px 8px;\n text-align: center;\n color: var(--mdhui-text-color-4);\n z-index: 5000;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.mdhui-recent-daily-data-bar-chart .recharts-cartesian-grid-horizontal line:first-child {\n display: none;\n}");const EAe=o(null);function _Ae(e){const[a,n]=c(),[i,r]=c();id((()=>{(()=>{if("default"===e.previewState)return void n(e.dataTypes);const t=e.dataTypes.map((e=>Jc(e.dailyDataType)));Promise.all(t).then((t=>{n(e.dataTypes.filter(((e,a)=>t[a])))}))})()}),["externalAccountSyncComplete"],[e.dataTypes,e.previewState]);return t.createElement("div",{ref:e.innerRef},!a&&t.createElement(XA,null),a&&t.createElement(EAe.Provider,{value:{dataTypes:a,data:i}},t.createElement(oM,{initialIntervalStart:Rr(),intervalType:"Day",useCustomNavigator:!0},t.createElement(CAe,{loadData:async(t,a)=>{if(!e.dataTypes.length)return Promise.resolve();r(await rd(t,a,e.dataTypes,!!e.previewState))},dayRenderer:n=>{if(!e.dataTypes.length||!a?.length)return null;let r=a.map((e=>{const t=i?.[e.dailyDataType]?.[n],a=t?.relativePercent??0;if(void 0===a)return{color:"var(--mdhui-color-primary)",barFillPercent:0};const r=t?.value??0;let o=e.color||"var(--mdhui-color-primary)";return void 0!==e.threshold&&"30DayAverage"!==e.threshold&&r>e.threshold&&e.overThresholdColor&&(o=e.overThresholdColor),{color:o,barFillPercent:a}}));return t.createElement("div",{style:{paddingTop:"8px"}},t.createElement(mSe,{averageFillPercent:.5,bars:r}))},dependencies:[e.previewState,e.dataTypes]}),i&&e.children)))}function CAe(e){const a=r(rM);return t.createElement(WAe,{selectedDate:a.intervalStart,loadData:e.loadData,dayRenderer:e.dayRenderer,dependencies:e.dependencies})}function TAe(e){let[a,n]=c(void 0),i=r(EAe),o=s(0),l=e.dataTypes||[];e.useContext&&i?.dataTypes&&(l=[...i.dataTypes]);let u=r(rM),d=e.date??u?.intervalStart??vn(new Date);if(id((()=>{!function(){function t(e){if(!e)return;let t={};return l.forEach((a=>{e[a.dailyDataType]?.[Br(d)]?.value&&(t[a.dailyDataType]=e[a.dailyDataType][Br(d)])})),t}if(n(void 0),e.useContext){if(!i?.data)return;return void n(t(i.data))}let a=++o.current;rd(d,d,l,!!e.previewState).then((e=>{a==o.current&&n(t(e))}))}()}),["externalAccountSyncComplete"],[u,i,e.date,e.dataTypes]),!a||!Object.keys(a).length)return null;function h(e,t){if(l.every((e=>void 0===e.threshold)))return;return nu(e.dailyDataType).formatter(t)}return t.createElement("div",{ref:e.innerRef,className:"mdhui-relative-activity"},e.title&&t.createElement(nS,{title:e.title}),l.map((e=>{let n=a[e.dailyDataType];if(!n||void 0===n.threshold||void 0===n.relativePercent)return null;let i=nu(e.dailyDataType),r=e.formatter||i.formatter;return t.createElement("div",{key:e.dailyDataType,className:"mdhui-relative-activity-datatype"},t.createElement(Ya,{className:"mdhui-relative-activity-meter",label:e.label||(i.labelKey?no(i.labelKey):e.dailyDataType),value:r(n.value),fillPercent:n.relativePercent,averageFillPercent:.5,icon:e.icon||i.icon,color:(o=e,s=n.relativePercent,void 0!==o.threshold&&o.overThresholdColor&&s>.5?o.overThresholdColor:o.color||"var(--mdhui-color-primary)"),thresholdLabel:h(e,n.threshold)}));var o,s})),l.every((e=>void 0===e.threshold))&&t.createElement("div",{className:"mdhui-relative-activity-average-marker"},t.createElement("div",null,t.createElement(Ne,{icon:O})),no("30-day-average")))}function PAe(e){return t.createElement(TAe,{date:vn(new Date),dataTypes:e.dataTypes,previewState:e.previewState,title:e.title,innerRef:e.innerRef})}A(".mdhui-relative-activity .mdhui-relative-activity-datatype {\n position: relative;\n}\n\n.mdhui-relative-activity .mdhui-relative-activity-meter {\n margin: 16px;\n}\n\n.mdhui-relative-activity .mdhui-relative-activity-average-marker {\n text-align: center;\n margin: 16px;\n font-size: .7em;\n margin-bottom: 16px;\n color: var(--mdhui-text-color-2);\n}");function OAe(e){const[a,n]=c(!1),[i,r]=c({});var o=new Date(e.year,e.month,1,0,0,0,0),s=cn(o,{months:1});function u(){var t,a;"NoData"!==e.showPreviewData&&("Loading"!==e.showPreviewData?(n(!0),(t=e.dataTypeSource,a=Hr.RestingHeartRate,"AppleHealth"==t&&(a=Hr.AppleHealthRestingHeartRate),"Fitbit"==t&&(a=Hr.FitbitRestingHeartRate),"Garmin"==t&&(a=Hr.GarminRestingHeartRate),"HealthConnect"==t&&(a=Hr.HealthConnectRestingHeartRate),eu(a,o,s,void 0!==e.showPreviewData).then((function(e){r(e)}))).then((()=>n(!1)))):n(!0))}return l((()=>(u(),w.on("applicationDidBecomeVisible",u),w.on("externalAccountSyncComplete",u),()=>{w.off("applicationDidBecomeVisible",u),w.off("externalAccountSyncComplete",u)})),[e]),t.createElement("div",{ref:e.innerRef},a&&t.createElement(XA,null),!a&&t.createElement(JA,{year:e.year,month:e.month,dayRenderer:function(e,a,n){const r=function(e,t,a){if(void 0!==a){var n=Br(new Date(e,t,a));return i[n]}}(e,a,n);return void 0!==n?t.createElement("div",{className:"mdhui-calendar-day-with-data-value"},t.createElement("div",{className:"calendar-value"},r),t.createElement("div",{className:"calendar-day"},n)):t.createElement("div",null)}}))}async function MAe(e,t,a,n,i){var r=await Kc(Br(e)+t);return{id:"00000000-0000-0000-0000-000000000000",surveyID:"00000000-0000-0000-0000-000000000000",surveyResultID:"00000000-0000-0000-0000-000000000000",surveyVersion:0,surveyName:a,surveyDisplayName:a,date:e.toISOString(),stepIdentifier:t,resultIdentifier:t,answers:[(r%(i-n)+n).toString()],insertedDate:e.toISOString()}}A(".mdhui-calendar-day-with-data-value .calendar-value {\n\theight: 32px;\n\twidth: 32px;\n\tfont-size: 12px;\n\tborder-radius: 17px;\n\tline-height: 34px;\n\ttext-align: center;\n\tbackground: var(--mdhui-background-color-1);\n\tfont-weight: bold;\n\tdisplay: inline-block;\n}\n\n.mdhui-calendar-day-with-data-value .calendar-day {\n\ttext-align: center;\n}");function DAe(e){let[a,n]=c(null);const i=r(rM);let o,s=e.intervalType||"Month";i?(s="Day"===i.intervalType?"Week":i.intervalType,o=i.intervalStart):o=lu(s,e.weekStartsOn);let l="Week"===s?cn(o,{days:7}):"Month"===s?cn(o,{months:1}):"6Month"===s?cn(o,{months:6}):o;const u=()=>{if(n(null),e.previewDataProvider)e.previewDataProvider(o,l).then((e=>{n(e)}));else if(e.previewState)(async(e,t,a,n)=>{const i=[];a.forEach((e=>i.push([])));let r=new Date(e);for(;r<t;){for(let e=0;e<a.length;++e){var o=await MAe(r,"TestResult"+e,"TestSurvey",10,100);i[e].push(o)}r=cn(r,n)}return i})(o,l,e.series,e.expectedDataInterval||{days:1}).then((e=>{n(e)}));else{var t=e.series.map((e=>{var t={after:o.toISOString(),before:l.toISOString()};return e.surveyName&&(t.surveyName=e.surveyName),e.resultIdentifier&&(t.resultIdentifier=e.resultIdentifier),e.stepIdentifier&&(t.stepIdentifier=e.stepIdentifier),hu(t)}));Promise.all(t).then((e=>{n(e)}))}};function d(e){return`${e.surveyName}-${e.stepIdentifier}-${e.resultIdentifier}`}id((()=>{u()}),[],[e.intervalType,e.weekStartsOn,i]);let h=function(t){for(var a={},n=0;n<e.series.length;n++)a[d(e.series[n])]=t[n]?.sort(((e,t)=>xn(Tr(e.date),Tr(t.date))))||[];return a}(a||[]);var m=void 0,p=!1;null!==h&&(m=[],e.series.forEach((e=>{var t=d(e);h[t].forEach((t=>{var a=Tr(t.date);a.setHours(0,0,0,0);var n=m.find((e=>e.timestamp===a.getTime()));n||(n={timestamp:a.getTime()},m.push(n)),n[e.dataKey]=parseFloat(t.answers[0]),p=!0}))})),m.sort(((e,t)=>e.timestamp-t.timestamp)));return t.createElement(Rue,{title:e.title,intervalType:s,intervalStart:o,data:m,expectedDataInterval:e.expectedDataInterval,series:e.series.map((e=>{const t={dataKey:e.dataKey,color:e.color};return"areaColor"in e&&(t.areaColor=e.areaColor),t})),chartHasData:p,tooltip:({active:a,payload:n})=>{function i(t,a){return t.stroke||function(t,a){var n=e.options?e.options[a]:null;return n?Array.isArray(n)?n[t]:n:"var(--mdhui-color-primary)"}(a,"barColor")}return a&&n&&n.length?1===n.length?t.createElement("div",{className:"mdhui-time-series-tooltip"},t.createElement("div",{className:"mdhui-single-value-tooltip-value"},wl(parseFloat(n[0].value),2)),t.createElement("div",{className:"mdhui-time-series-tooltip-date"},ll(new Date(n[0].payload.timestamp)))):t.createElement("div",{className:"mdhui-time-series-tooltip"},t.createElement("table",{className:"mdhui-multiple-value-tooltip"},t.createElement("tbody",null,n.map(((e,a)=>t.createElement("tr",{key:e.dataKey},t.createElement("th",{style:{color:i(e,a)}},e.dataKey),t.createElement("td",null,wl(parseFloat(e.value),2))))))),t.createElement("div",{className:"mdhui-time-series-tooltip-date"},ll(new Date(n[0].payload.timestamp)))):null},chartType:e.chartType,options:e.options,innerRef:e.innerRef})}A(".mdhui-survey-task-list .mdhui-single-survey-task {\n border-bottom: solid 1px var(--mdhui-border-color-0);\n}\n\n.mdhui-survey-task-list .mdhui-single-survey-task:last-child {\n border: none;\n}\n\n.mdhui-survey-task-list .title {\n font-weight: bold;\n padding: 16px;\n padding-bottom: 0;\n}\n\n.mdhui-survey-task-list .empty-message {\n padding: 16px;\n font-size: .88em;\n}");var IAe=[{id:"ecf8a7df-caa3-ec11-aaab-f47bb6835a10",surveyID:"53ad3e98-9777-ec11-aaa8-89aad5fbf200",surveyName:"Mood Survey",surveyDisplayName:"Mood Survey",surveyDescription:"3 minutes",status:"incomplete",hasSavedProgress:!1,dueDate:cn(new Date,{days:-1}).toISOString(),insertedDate:"2022-03-14T19:13:48.283Z",modifiedDate:"2022-03-14T19:13:48.283Z",linkIdentifier:"1"},{id:"e7f8a7df-caa3-ec11-aaab-f47bb6835a10",surveyID:"53ad3e98-9777-ec11-aaa8-89aad5fbf200",surveyName:"Pregnancy (Followup)",surveyDisplayName:"Pregnancy: Followup",surveyDescription:"3 minutes",status:"incomplete",hasSavedProgress:!0,dueDate:cn(new Date,{days:0}).toISOString(),insertedDate:"2022-03-14T19:13:48.283Z",modifiedDate:"2022-03-14T19:13:48.283Z",linkIdentifier:"1"},{id:"2c9ab4d9-80a4-ec11-aaab-f47bb6835a11",surveyID:"a7f58ba8-9777-ec11-aaa8-89aad5fbf200",surveyName:"Rating: CheckIn",surveyDisplayName:"Let us know how we're doing",surveyDescription:"10 minutes",status:"incomplete",hasSavedProgress:!1,dueDate:void 0,insertedDate:"2022-03-15T16:56:26.703Z",modifiedDate:"2022-03-15T16:56:26.703Z",linkIdentifier:"1"},{id:"b1c9bcd2-80a4-ec11-aaab-f47bb6835a10",surveyID:"cd452353-7674-ec11-aaa8-89aad5fbf200",surveyName:"Alcohol and Tobacco",surveyDisplayName:"Alcohol and Tobacco",surveyDescription:"5 minutes",status:"incomplete",hasSavedProgress:!1,dueDate:cn(new Date,{days:1}).toISOString(),insertedDate:"2022-03-15T16:56:15.007Z",modifiedDate:"2022-03-15T16:56:15.007Z",linkIdentifier:"1"},{id:"2c9ab4d9-80a4-ec11-aaab-f47bb6835a10",surveyID:"a7f58ba8-9777-ec11-aaa8-89aad5fbf200",surveyName:"SDOH: Followup",surveyDisplayName:"Social Determinants of Health: Followup",surveyDescription:"5 minutes",status:"incomplete",hasSavedProgress:!1,dueDate:cn(new Date,{days:10}).toISOString(),insertedDate:"2022-03-15T16:56:26.703Z",modifiedDate:"2022-03-15T16:56:26.703Z",linkIdentifier:"1"},{id:"2c9ab4d9-80a4-ec11-aaab-f47bb6835a12",surveyID:"a7f58ba8-9777-ec11-aaa8-89aad5fbf200",surveyName:"Rating2: CheckIn",surveyDisplayName:"Rate Later",surveyDescription:"10 minutes",status:"incomplete",hasSavedProgress:!1,dueDate:cn(new Date,{years:10}).toISOString(),insertedDate:"2022-03-15T16:56:26.703Z",modifiedDate:"2022-03-15T16:56:26.703Z",linkIdentifier:"1"}],NAe=[{id:"2c9ab4d9-80a4-ec11-aaab-f47bb6835a10",surveyID:"a7f58ba8-9777-ec11-aaa8-89aad5fbf200",surveyName:"SDOH: Followup",surveyDisplayName:"Social Determinants of Health: Followup",surveyDescription:"5 minutes",status:"complete",endDate:(new Date).toISOString(),hasSavedProgress:!1,dueDate:cn(new Date,{days:10}).toISOString(),insertedDate:"2022-03-15T16:56:26.703Z",modifiedDate:"2022-03-15T16:56:26.703Z",linkIdentifier:"1"},{id:"b1c9bcd2-80a4-ec11-aaab-f47bb6835a10",surveyID:"cd452353-7674-ec11-aaa8-89aad5fbf200",surveyName:"Alcohol and Tobacco",surveyDisplayName:"Alcohol and Tobacco",surveyDescription:"5 minutes",status:"complete",hasSavedProgress:!1,endDate:cn(new Date,{days:-1}).toISOString(),dueDate:cn(new Date,{days:10}).toISOString(),insertedDate:"2022-03-15T16:56:15.007Z",modifiedDate:"2022-03-15T16:56:15.007Z",linkIdentifier:"1"},{id:"e7f8a7df-caa3-ec11-aaab-f47bb6835a10",surveyID:"53ad3e98-9777-ec11-aaa8-89aad5fbf200",surveyName:"Pregnancy (Followup)",surveyDisplayName:"Pregnancy: Followup",surveyDescription:"3 minutes",status:"complete",hasSavedProgress:!1,endDate:cn(new Date,{days:-2}).toISOString(),dueDate:cn(new Date,{days:10}).toISOString(),insertedDate:"2022-03-14T19:13:48.283Z",modifiedDate:"2022-03-14T19:13:48.283Z",linkIdentifier:"1"}];function jAe(e){const[a,n]=c(!0),[i,o]=c(null),[s,l]=c([]),u=r(Ga),d=e=>{o(e),l([])};id((function(){var t=function(e,t){return e.dueDate?t.dueDate?Tr(e.dueDate)>Tr(t.dueDate)?1:Tr(e.dueDate)<Tr(t.dueDate)?-1:0:-1:1};if("IncompleteTasks"==e.previewState)return IAe.sort(t),void d(IAe);if("CompleteTasks"==e.previewState)return void d(NAe);if("Empty"==e.previewState)return d([]),void n(!1);a=[],i=function(r){var o={status:e.status};return e.surveys&&(o.surveyName=e.surveys),e.category&&(o.surveyCategory=e.category),r&&(o.pageID=r),w.querySurveyTasks(o).then((function(r){a=a.concat(r.surveyTasks),r.nextPageID?i(r.nextPageID):("incomplete"==e.status&&a.sort(t),"complete"==e.status&&a.sort(((e,t)=>e.endDate&&t.endDate?Tr(e.endDate)>Tr(t.endDate)?-1:Tr(e.endDate)<Tr(t.endDate)?1:0:0)),d(a),n(!1))}))},i(null);var a,i}),[],[e.previewState]);const h=e=>s.includes(e.surveyName),m=t=>e.sequential&&i[0].id!==t.id;function p(a){return t.createElement(hSe,{buttonColor:e.buttonColor,buttonVariant:e.buttonVariant,key:a.id.toString(),task:a,onClick:()=>(t=>{e.previewState||h(t)||(l([...s,t.surveyName]),w.startSurvey(t.surveyName))})(a),surveyActive:h(a),surveyBlocked:m(a)})}const{hideIfEmpty:g}=e,f="complete"==e.status?g??!0:g;if(!i?.length&&f)return null;let y=e.variant??"noCard";return t.createElement(zAe,{cardStyle:e.cardStyle,cardBackgroundColor:e.cardBackgroundColor,innerRef:e.innerRef,card:"singleCard"==y},t.createElement("div",{className:"mdhui-survey-task-list"},e.title&&t.createElement(nS,{color:e.titleColor,title:e.title,detailLinkText:e.onDetailLinkClick?no("view-all")+" ("+(i?.length??0)+")":void 0,onDetailClick:e.onDetailLinkClick}),a&&!i&&t.createElement(XA,null),!i?.length&&!a&&t.createElement("div",{className:"empty-message"},e.emptyText?.trim()||no(`empty-tasks-${e.status}`)),i?.slice(0,e.limit).map((a=>"multiCard"==y?t.createElement(aS,{style:e.cardStyle,backgroundColor:je(u.colorScheme,e.cardBackgroundColor),key:a.id},p(a)):p(a)))))}function zAe(e){const a=r(Ga);return e.card?t.createElement(aS,{style:e.cardStyle,backgroundColor:je(a.colorScheme,e.cardBackgroundColor),innerRef:e.innerRef},e.children):t.createElement("div",{ref:e.innerRef},e.children)}var RAe=new Date;const LAe=[{id:"12345",surveyResultID:"1",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityValue",answers:["severe"],insertedDate:Date.now.toString()},{id:"123456",surveyResultID:"1",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityDate",answers:[Rr().toISOString()],insertedDate:Date.now.toString()},{id:"123452",surveyResultID:"21",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityValue",answers:["severity3"],insertedDate:Date.now.toString()},{id:"12223456",surveyResultID:"21",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityDate",answers:[vn(sn(RAe,-1)).toISOString()],insertedDate:Date.now.toString()},{id:"123457",surveyResultID:"2",surveyID:"1",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityValue",answers:["moderate"],insertedDate:Date.now.toString()},{id:"123458",surveyResultID:"2",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityDate",answers:[vn(sn(RAe,-2)).toISOString()],insertedDate:Date.now.toString()},{id:"1234573",surveyResultID:"3",surveyID:"1",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityValue",answers:["severity2"],insertedDate:Date.now.toString()},{id:"1234583",surveyResultID:"3",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityDate",answers:[vn(sn(RAe,-3)).toISOString()],insertedDate:Date.now.toString()},{id:"14234573",surveyResultID:"4",surveyID:"1",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityValue",answers:["moderate"],insertedDate:Date.now.toString()},{id:"12345834",surveyResultID:"4",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityDate",answers:[vn(sn(RAe,-4)).toISOString()],insertedDate:Date.now.toString()},{id:"142345736",surveyResultID:"5",surveyID:"1",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityValue",answers:["mild"],insertedDate:Date.now.toString()},{id:"1234583466",surveyResultID:"5",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityDate",answers:[vn(sn(RAe,-5)).toISOString()],insertedDate:Date.now.toString()},{id:"1423457376",surveyResultID:"6",surveyID:"1",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityValue",answers:["severity1"],insertedDate:Date.now.toString()},{id:"1234583466",surveyResultID:"6",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityDate",answers:[vn(sn(RAe,-6)).toISOString()],insertedDate:Date.now.toString()},{id:"12374597",surveyResultID:"7",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:vn(sn(RAe,-7)).toISOString(),stepIdentifier:"1",resultIdentifier:"severityValue",answers:["mild"],insertedDate:Date.now.toString()},{id:"123874598",surveyResultID:"8",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:vn(sn(RAe,-8)).toISOString(),stepIdentifier:"1",resultIdentifier:"severityValue",answers:["severe"],insertedDate:Date.now.toString()},{id:"1238745998",surveyResultID:"9",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:Pn(sn(RAe,-8)).toISOString(),stepIdentifier:"1",resultIdentifier:"severityValue",answers:["mild"],insertedDate:Date.now.toString()},{id:"10234583466",surveyResultID:"10",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityDate",answers:[Pn(sn(RAe,-9)).toISOString()],insertedDate:Date.now.toString()},{id:"1237459710",surveyResultID:"10",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityValue",answers:["mild"],insertedDate:Date.now.toString()},{id:"10234583466",surveyResultID:"11",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityDate",answers:[vn(sn(RAe,-9)).toISOString()],insertedDate:Date.now.toString()},{id:"1237459710",surveyResultID:"11",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityValue",answers:["severe"],insertedDate:Date.now.toString()},{id:"12387459988",surveyResultID:"12",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:Pn(sn(RAe,-10)).toISOString(),stepIdentifier:"1",resultIdentifier:"severityValue",answers:["severe"],insertedDate:Date.now.toString()},{id:"102345834898",surveyResultID:"12",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:Pn(sn(RAe,-10)).toISOString(),stepIdentifier:"1",resultIdentifier:"severityDate",answers:[Pn(sn(RAe,-10)).toISOString()],insertedDate:Date.now.toString()},{id:"123745971013",surveyResultID:"13",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:vn(sn(RAe,-10)).toISOString(),stepIdentifier:"1",resultIdentifier:"severityValue",answers:["moderate"],insertedDate:Date.now.toString()},{id:"1023458346613",surveyResultID:"13",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:vn(sn(RAe,-10)).toISOString(),stepIdentifier:"1",resultIdentifier:"severityDate",answers:[Pn(sn(RAe,-10)).toISOString()],insertedDate:Date.now.toString()}];function FAe(e){const a={surveyName:e.surveyName,resultIdentifier:e.dateRecordedResultIdentifier?[e.dateRecordedResultIdentifier,e.severityResultIdentifier]:[e.severityResultIdentifier]},[n,i]=c(),o=r(rM);let s=o?.intervalStart??e.intervalStart??In(new Date);function l(t){var a=new Map,n=function(t){var a=new Map;return t.forEach((t=>{var n=a.get(t.surveyResultID)??{dateObservedAnswer:void 0,severityAnswer:void 0};t.answers&&""!==t.answers[0]&&(t.resultIdentifier===e.severityResultIdentifier?n.severityAnswer=t:t.resultIdentifier===e.dateRecordedResultIdentifier&&(n.dateObservedAnswer=t),a.set(t.surveyResultID,n))})),a}(t);const r=e.severityValueMapper??function(e){let t="";return["mild","moderate","severe"].includes(e.toLowerCase())&&(t=e.toLowerCase()),t};n.forEach((e=>{if(e.severityAnswer){var t=r(e.severityAnswer.answers[0]);if(t){let n=Tr(e.dateObservedAnswer?e.dateObservedAnswer.answers[0]:e.severityAnswer.date),i=ll(vn(n)),r=a.get(i);r?e.severityAnswer.date>r.dateEntered&&(r.dateObserved=n,r.severity=t,r.dateEntered=e.severityAnswer.date):a.set(i,{dateObserved:n,severity:t,dateEntered:e.severityAnswer.date})}}})),i(a)}const u={mild:{style:{background:"#F7DA19"},streak:!0,streakColor:"#FDEF97"},moderate:{style:{background:"var(--mdhui-color-warning)"},streak:!0,streakColor:"#FCCCC7"},severe:{style:{background:"var(--mdhui-color-danger)"},streak:!0,streakColor:"#FCCCC7"}},d=e=>{let t=ll(vn(e));return n?.get(t)?.severity??""},h=(e,a,n)=>t.createElement(eS,{year:e,month:a,day:n,stateConfiguration:u,computeStateForDay:d});return id((async function(){e.previewState?l("Default"===e.previewState?LAe:[]):hu(a).then((e=>{l(e)}))}),[],[e.previewState]),n?t.createElement(JA,{innerRef:e.innerRef,className:"mdhui-simple-calendar",year:s.getFullYear(),month:s.getMonth(),dayRenderer:h}):t.createElement(XA,{innerRef:e.innerRef})}function BAe(e){const a=r(rM),n=a?.intervalStart??Rr(),[i,o]=c(!0),[s,l]=c();id((()=>{if(o(!0),"loading"!==e.previewState)return e.previewState?(l("with data"===e.previewState?Math.floor(7*Math.random()):void 0),void o(!1)):void Nd(n).then((e=>{l(e),o(!1)}))}),[],[e.previewState,a?.intervalStart]);return t.createElement("div",{className:"mdhui-stress-level",ref:e.innerRef},t.createElement("div",{className:"mdhui-stress-level-title"},no("stress-level-title")),i&&t.createElement(XA,null),!i&&t.createElement(dM,{tickCount:7,minLabel:no("stress-level-min-label"),maxLabel:no("stress-level-max-label"),value:s,onChange:t=>(t=>{l(t),e.previewState||(t?jd(n,t):zd(n))})(t),sliderColor:"#d36540"}))}A(".mdhui-stress-level {\n padding: 16px 0 0;\n}\n\n.mdhui-stress-level-title {\n text-transform: uppercase;\n margin: 0 16px;\n font-size: 0.65em;\n}\n\n.mdhui-stress-level .mdhui-loading-indicator {\n padding: 16px 16px 32px;\n}");let HAe=[{Title:"Rapid Tests",Link:"https://medlineplus.gov/lab-tests/rapid-tests?utm_source=mplusconnect&utm_medium=service",Summary:'\n<h2>What are rapid tests?</h2>\n<p>Rapid tests, also known as rapid diagnostic tests or RDTs, are easy-to-use tests that provide quick results, usually in 20 minutes or less. Unlike most standard tests, which have to be sent to a lab, rapid tests are done and provide results at the point of care. The point of care is the place where you are getting care. It can include your provider\'s office, a clinic, or even your own home.</p>\n<p>Rapids tests usually include the following steps:</p>\n<ul>\n<li>You will provide a sample of your body fluid, such as <a data-tid="6037" href="https://medlineplus.gov/blood.html">blood</a>, urine, saliva, or nasal secretions.</li>\n<li>The sample is mixed with a special substance that will cause a chemical reaction if a disease or other condition is present.</li>\n<li>Results will show on a dipstick or rapid test cassette.\n<ul>\n<li>A dipstick is a thin, plastic strip that\'s coated with chemicals. If the test is positive, the dipstick will change colors when placed in the sample.</li>\n<li>A rapid test cassette is a small, plastic case that has a well that holds the sample. The well will show a letter or a symbol to indicate the result.</li>\n</ul>\n</li>\n</ul>\n<p>Most rapid tests are highly accurate, but the results are not always as accurate as standard lab tests. </p>\n<p>Other names: rapid diagnostic tests, RDT\'s point-of-care tests</p><h2>How are they used?</h2>\n<p>Rapid tests are most often used to diagnose <a data-tid="513" href="https://medlineplus.gov/infectiousdiseases.html">infectious diseases</a>, including:</p>\n<ul>\n<li><a data-tid="299" href="https://medlineplus.gov/flu.html">Flu</a></li>\n<li><a data-tid="421" href="https://medlineplus.gov/streptococcalinfections.html">Strep throat</a></li>\n<li><a data-tid="315" href="https://medlineplus.gov/malaria.html">Malaria</a></li>\n<li><a data-tid="1" href="https://medlineplus.gov/hivaids.html">HIV</a></li>\n<li><a data-tid="3181" href="https://medlineplus.gov/covid19coronavirusdisease2019.html">COVID 19</a>. <a data-tid="7627" href="https://medlineplus.gov/covid19testing.html">Rapid tests for COVID-19</a> usually provide results in about 30 minutes.</li>\n</ul>\n<p>Rapid tests are also used in certain <a data-pid="31381" href="https://medlineplus.gov/lab-tests/at-home-medical-tests/">home-based tests</a>, such as pregnancy tests.</p><h2>What are the advantages and disadvantages of rapid tests?</h2>\n<p>The advantages of rapid tests include:</p>\n<ul>\n<li><strong>Fast results.</strong> This may allow you to get treatment faster. Faster treatment can reduce the severity of your symptoms, and may help prevent the spread of disease</li>\n<li><strong>Easy to use.</strong> They can be done by non-medical workers and volunteers who have been trained to do the test. You may even be able to perform a rapid test on yourself.</li>\n<li><strong>Little or no special equipment required.</strong> This is especially useful in areas with limited resources or access to specialized labs.</li>\n</ul>\n<p>Disadvantages of rapid tests:</p>\n<ul>\n<li><strong>Lower sensitivity than lab tests.</strong> Sensitivity means how well a test can identify a disease or condition. Rapid tests are not as good as lab tests at finding diseases in the earliest stages of infection.</li>\n<li><strong>False negatives are more common.</strong> A false negative result means your test shows you don\'t have a disease or condition, but you actually do have it.</li>\n</ul>\n<p>Providers will often take a second sample and send it to a lab for testing to confirm or rule out the results of a rapid test. But you may be able to get treatment and help prevent the spread of disease while you wait for lab results.</p><h2>Is there anything else I need to know about rapid tests?</h2>\n<p>Home based rapid tests are available for COVID-19. Like other rapid tests, the rapid COVID-19 tests have lower sensitivity than standard lab tests. But getting fast, home-based results may help prevent the spread of disease. Talk to your health care provider to learn more about these home-based tests.</p><h2>References</h2>\n<ol>\n<li>Centers for Disease Control and Prevention [Internet]. Atlanta: U.S. Department of Health and Human Services; Influenza (Flu): Rapid Influenza Diagnostic Tests; [cited 2021 Jan 26]; [about 5 screens]. Available from: <a href="https://www.cdc.gov/flu/professionals/diagnosis/clinician_guidance_ridt.htm" target="bibliowin">https://www.cdc.gov/flu/professionals/diagnosis/clinician_guidance_ridt.htm</a></li>\n<li>Centers for Disease Control and Prevention [Internet]. Atlanta: U.S. Department of Health and Human Services; Malaria: Rapid Diagnostic Tests: How They Work; [cited 2021 Jan 26]; [about 5 screens]. Available from: <a href="https://www.cdc.gov/malaria/malaria_worldwide/reduction/dx_rdt.html" target="bibliowin">https://www.cdc.gov/malaria/malaria_worldwide/reduction/dx_rdt.html</a></li>\n<li>Emory University [Internet]. Atlanta: Emory University; c2020. What is Rapid Diagnostic Test (RDT)?; [cited 2021 Jan 26]; [about 3 screens]. Available from: <a href="http://www.globalhealthprimer.emory.edu/targets-technologies/rapid-diagnostic-test.html" target="bibliowin">http://www.globalhealthprimer.emory.edu/targets-technologies/rapid-diagnostic-test.html</a></li>\n<li>FDA: U.S. Food and Drug Administration [Internet]. Silver Spring (MD): U.S. Department of Health and Human Services; Coronavirus (COVID-19) Update: FDA Authorizes Antigen Test as First Over-the-Counter Fully At-Home Diagnostic Test for COVID-19; 2020 Dec 15 [cited 2021 Jan 26]; [about 3 screens]. Available from: <a href="https://www.fda.gov/news-events/press-announcements/coronavirus-covid-19-update-fda-authorizes-antigen-test-first-over-counter-fully-home-diagnostic" target="bibliowin">https://www.fda.gov/news-events/press-announcements/coronavirus-covid-19-update-fda-authorizes-antigen-test-first-over-counter-fully-home-diagnostic</a></li>\n<li>FDA: U.S. Food and Drug Administration [Internet]. Silver Spring (MD): U.S. Department of Health and Human Services; Coronavirus (COVID-19) Update: FDA Issued Emergency Use Authorization for Point of Care Antigen Test; 2020 Jul 6 [cited 2021 Jan 26]; [about 3 screens]. Available from: <a href="https://www.fda.gov/news-events/press-announcements/coronavirus-covid-19-update-fda-issued-emergency-use-authorization-point-care-antigen-test" target="bibliowin">https://www.fda.gov/news-events/press-announcements/coronavirus-covid-19-update-fda-issued-emergency-use-authorization-point-care-antigen-test</a></li>\n<li>GoodRx [Internet]. GoodRx, Inc., c2011–2021. COVID-19 Rapid Tests: Accuracy, Types, and Where to Find Them; 2020 Nov 10 [cited 2021 Jan 26]; [about 3 screens]. Available from: <a href="https://www.goodrx.com/blog/covid-19-rapid-test" target="bibliowin">https://www.goodrx.com/blog/covid-19-rapid-test</a></li>\n<li>Harvard Health Publishing: Harvard Medical School [Internet]. Boston: Harvard University; 2010–2021. Rapid Strep Test; 2019 Dec [cited 2021 Jan 26]; [about 4 screens]. Available from: <a href="https://www.health.harvard.edu/diseases-and-conditions/rapid-strep-test" target="bibliowin">https://www.health.harvard.edu/diseases-and-conditions/rapid-strep-test</a></li>\n<li>Mayo Clinic [Internet]. Mayo Foundation for Medical Education and Research; c1998–2021. COVID-19 Diagnostic testing: Overview; 2021 Jan 15 [cited 2021 Jan 26]; [about 3 screens]. Available from: <a href="https://www.mayoclinic.org/tests-procedures/covid-19-diagnostic-test/about/pac-20488900" target="bibliowin">https://www.mayoclinic.org/tests-procedures/covid-19-diagnostic-test/about/pac-20488900</a></li>\n<li>Mayo Clinic [Internet]. Mayo Foundation for Medical Education and Research; c1998–2021. Urinalysis: Overview; 2019 Oct 23 [cited 2021 Jan 26]; [about 3 screens]. Available from: <a href="https://www.mayoclinic.org/tests-procedures/urinalysis/about/pac-20384907" target="bibliowin">https://www.mayoclinic.org/tests-procedures/urinalysis/about/pac-20384907</a></li>\n<li>Poole S, Townsend J, Wertheim H, Kidd SP, Welte T, Schuetz P, Luyt CE, Beishuizen A, Jensen JS, Del Castillo JG, Plebani M, Saeed K. How are rapid diagnostic tests for infectious diseases used in clinical practice: a global survey by the International Society of Antimicrobial Chemotherapy (ISAC). Eur J Clin Microbiol Infect Dis [Internet]. 2021 Feb; [cited 2021 Jan 26]; 40(2):429–434. Available from: <a href="https://pubmed.ncbi.nlm.nih.gov/32902760" target="bibliowin">https://pubmed.ncbi.nlm.nih.gov/32902760</a></li>\n<li>P.vivax information hub [Internet]. Medicines for Malaria Venture; Rapid Diagnostic Tests (RDTs); [cited 2021 Jan 26]; [about 3 screens]. Available from: <a href="https://www.vivaxmalaria.org/diagnosis-treatment/diagnostic-methods/rapid-diagnostic-tests-rdts" target="bibliowin">https://www.vivaxmalaria.org/diagnosis-treatment/diagnostic-methods/rapid-diagnostic-tests-rdts</a></li>\n<li>ResearchGate [Internet]. ResearchGate GmbH; c2008–2021. Example of RDT Cassettes; [cited 2021 Jan 26]; [about 3 screens]. Available from: <a href="https://www.researchgate.net/figure/Example-of-RDT-cassettes-Most-of-the-cassettes-have-separated-wells-for-sample-and_fig2_49830148" target="bibliowin">https://www.researchgate.net/figure/Example-of-RDT-cassettes-Most-of-the-cassettes-have-separated-wells-for-sample-and_fig2_49830148</a></li>\n<li>Very Well Health [Internet]. New York: About, Inc.; c2021. An Overview of Specificity and Sensitivity; [updated 2020 Sep 27; cited 2021 Jan 26]; [about 3 screens]. Available from: <a href="https://www.verywellhealth.com/sensitivity-and-specificity-in-medical-testing-overview-4777799" target="bibliowin">https://www.verywellhealth.com/sensitivity-and-specificity-in-medical-testing-overview-4777799</a></li>\n<li>Very Well Health [Internet]. New York: About, Inc.; c2021. Why Your Rapid Flu Test Was Negative; [updated 2020 Apr 2; cited 2021 Jan 26]; [about 3 screens]. Available from: <a href="https://www.verywellhealth.com/why-was-my-flu-test-negative-770309" target="bibliowin">https://www.verywellhealth.com/why-was-my-flu-test-negative-770309</a></li>\n<li>World Health Organization [Internet]. Geneva (SUI): World Health Organization; c2021. Advice on the use of point-of-care immunodiagnostic tests for COVID-19; 2020 Apr 8 [cited 2021 Jan 26]; [about 4 screens]. Available from: <a href="https://www.who.int/news-room/commentaries/detail/advice-on-the-use-of-point-of-care-immunodiagnostic-tests-for-covid-19#" target="bibliowin">https://www.who.int/news-room/commentaries/detail/advice-on-the-use-of-point-of-care-immunodiagnostic-tests-for-covid-19#</a></li>\n<li>World Health Organization [Internet]. Geneva (SUI): World Health Organization; c2021. Simple/Rapid Tests; 2014 Jun 27 [cited 2021 Jan 26]; [about 3 screens]. Available from: <a href="https://www.who.int/news-room/q-a-detail/simple-rapid-tests" target="bibliowin">https://www.who.int/news-room/q-a-detail/simple-rapid-tests</a></li>\n</ol>\n\n'},{Title:"COVID-19 Testing",Link:"https://medlineplus.gov/covid19testing.html?utm_source=mplusconnect&utm_medium=service",Summary:'\n<p><a href="https://medlineplus.gov/covid19coronavirusdisease2019.html?utm_source=mplusconnect">COVID-19</a> (coronavirus disease 2019) is a disease caused by a virus called SARS-CoV-2. There are two types of tests for this virus:</p>\n<ul>\n<li>A <strong>viral test</strong> tells you if you have a current infection. Viral tests can either be rapid tests or laboratory tests:\n <ul>\n <li><a href="https://medlineplus.gov/lab-tests/rapid-tests/">Rapid tests</a> can be done in minutes. They are often antigen tests, which look for specific proteins from the virus. Some rapid tests are self-tests which you can do at home.</li> \n <li>Laboratory tests can take days to complete and include <a href="https://medlineplus.gov/lab-tests/pcr-tests/">PCR tests</a>.</li>\n </ul>\n</li>\n<li>An <strong>antibody (serology) test</strong> might tell you if you had a past infection.</li>\n</ul>\n\n<p>If you need a COVID-19 test, you can:</p>\n<ul>\n<li>Buy a self-test online or at a store. Make sure that the test you buy has been authorized by the U.S. Food and Drug Administration (FDA).</li>\n<li>Check your state or local health department\'s website for information on testing in your area.</li>\n<li>Contact your health care provider.</li>\n<li>Order free self-tests from <a href="https://www.covid.gov/tests">COVID.gov</a> for your household, if you live in the U.S. The tests are from the U.S. government.\n</li></ul>\n\n<p>Even if your COVID-19 viral test is negative (the test did not detect the virus), you should still take steps to <a href="https://www.cdc.gov/coronavirus/2019-ncov/prevent-getting-sick/prevention.html">protect yourself and others</a>.</p>\n\n<p class="NLMattribution"> Centers for Disease Control and Prevention</p>\n\n'}];function qAe(e){const[a,n]=c(!0),[i,r]=c(null);return id((function(){if("default"==e.previewState)return r(HAe),void n(!1);if("noData"==e.previewState)return r([]),void n(!1);let t="";return e.labObservationID?t=new URLSearchParams({LabObservationID:e.labObservationID}).toString():e.term&&(t=new URLSearchParams(e.term).toString()),w.invokeCustomApi("HealthAndWellnessApi.TermInformation","GET",t,!0).then((function(e){r(e),n(!1)}))}),[],[e.labObservationID,e.term]),a?t.createElement(XA,null):t.createElement("div",{className:"mdhui-term-information"},0==i?.length&&t.createElement(t.Fragment,null,t.createElement(sM,{order:4,defaultMargin:!0},no("term-information-not-found-header")),t.createElement($q,null,no("term-information-not-found-body"))),i&&i?.length>0&&t.createElement($q,{className:"mdhui-term-information-disclaimer"},t.createElement("div",{dangerouslySetInnerHTML:{__html:no("term-information-disclaimer")}})),i?.map(((a,n)=>t.createElement(aS,{key:n},t.createElement(sM,{order:3,defaultMargin:!0},a.Title),t.createElement($q,{className:"mdhui-term-information-html"},function(a){let n=tM(a,{replace:a=>{let n=a;if("a"===n.name){let a=function(t){e.openLinksInNewWindow||(w.openEmbeddedUrl(n.attribs.href),t.preventDefault())};return t.createElement("a",{href:n.attribs.href,target:"_blank",onClick:e=>a(e)},n.children[0].data)}return n}});return n}(a.Summary)),t.createElement($q,null,t.createElement("a",{href:a.Link,target:"_blank"},no("term-information-view-on-medline")))))))}A(".mdhui-term-information .mdhui-term-information-html h2 {\n font-size: 1.2em;\n}\n\n.mdhui-term-information .mdhui-term-information-disclaimer {\n color: var(--mdhui-text-color-2);\n font-size: .7em;\n}");function UAe(e){const[a,n]=c(null),[i,r]=c(!1);function o(e){e=e.filter((e=>"Device Manufacturer"==e.provider.category)),n(e)}if(id((function(){if(e.previewState){let t=wde.filter((e=>"Device Manufacturer"==e.provider.category));return t[0].status=e.previewState,void o(t)}w.getExternalAccounts().then((function(e){o(e)})),uc(!0).then((t=>{0!==e.dataTypes.length?Promise.any(e.dataTypes.map((e=>e.availabilityCheck(t).then((e=>e?Promise.resolve():Promise.reject()))))).then((()=>{r(!0)})).catch((()=>{r(!1)})):r(!1)}))}),["externalAccountSyncComplete"]),!(a&&a.length||i))return null;const s=t.createElement(QA,{color:e.buttonColor,variant:e.buttonVariant||"light",onClick:()=>{}},no("view"));return t.createElement(Za,{innerRef:e.innerRef,className:"mdhui-view-device-activity",renderAs:"div",onClick:()=>e.onClick(),indicator:s},t.createElement(sM,{order:3},e.title||no("device-activity")),a?.find((e=>"fetchingData"==e.status))&&t.createElement("div",{className:"mdhui-view-device-activity-status"},t.createElement(Ne,{icon:V,spin:!0})," ",no("external-account-fetching-data")))}A(".mdhui-view-device-activity .mdhui-view-device-activity-status {\n margin-top: var(--mdhui-padding-md);\n}");function VAe(e){const[a,n]=c(!1),[i,r]=c(!1);return id((()=>"notConnected"===e.previewState?(n(!1),void r(!1)):e.previewState?(n(!0),void r("fetchingData"===e.previewState)):void Promise.all([w.getExternalAccounts(),w.getDataAvailability()]).then((([e,t])=>{const a=e.filter((e=>["Provider","Health Plan"].includes(e.provider.category)));n(a.length>0||t.appleHealthRecords||t.healthConnectPhr),r(a.some((e=>"fetchingData"===e.status)))}))),["externalAccountSyncComplete"],[e.previewState]),a?t.createElement(Za,{className:"mdhui-view-ehr",renderAs:"div",indicator:t.createElement(QA,{color:e.buttonColor,variant:e.buttonVariant||"light",onClick:lM},no("view")),onClick:e.onClick,innerRef:e.innerRef},t.createElement(sM,{order:3},e.title||no("health-records")),i&&t.createElement("div",{className:"mdhui-view-ehr-status"},t.createElement(Ne,{icon:V,spin:!0})," ",no("external-account-fetching-data"))):null}function WAe(e){const a=r(rM),[n,i]=c(Rr()),[o,s]=c(cn(Rr(),{days:-6})),[l,u]=c(!0);id((()=>{if(!Sn(n,Rr()))return i(Rr()),void s(cn(Rr(),{days:-6}));u(!0),e.loadData(cn(o,{days:-7}),cn(o,{days:14})).then((()=>{u(!1)}))}),["externalAccountSyncComplete"],[o,...e.dependencies??[]]);const d=e=>{a?.update({intervalStart:e})};return t.createElement(wSe,{innerRef:e.innerRef,startDate:o,onStartDateChange:e=>{s(e),d(cn(e,{days:6}))},selectedDate:e.selectedDate,onDateSelected:d,dayRenderer:(t,a,n)=>e.dayRenderer(Br(new Date(t,a,n))),loading:l})}function $Ae(e){const a=r(rM),n=r(efe);if(!n)return t.createElement($q,{innerRef:e.innerRef},"Error: Meal Buttons must be used within a Meal Coordinator.");const i=t=>{if(e.preview)return void(e.autoLaunchEditor&&e.onEditMeal&&e.onEditMeal());let i=new Date;const r={id:vp(),timestamp:a?cn(vn(a.intervalStart),{hours:i.getHours(),minutes:i.getMinutes()}):i,type:t,created:i,lastModified:i};n.addMeal(r).then((()=>{e.autoLaunchEditor&&e.onEditMeal&&Sd(r).then(e.onEditMeal)}))};return t.createElement("div",{className:"mdhui-meal-buttons",ref:e.innerRef},t.createElement(QA,{onClick:()=>i("meal"),variant:"light",disabled:n.loading},t.createElement(Ne,{icon:Y})," ",Ld("meal")),t.createElement(QA,{onClick:()=>i("snack"),variant:"light",disabled:n.loading},t.createElement(Ne,{icon:se})," ",Ld("snack")),t.createElement(QA,{onClick:()=>i("drink"),variant:"light",disabled:n.loading},t.createElement(Ne,{icon:ge})," ",Ld("drink")))}A(".mdhui-view-ehr .mdhui-view-ehr-status {\n margin-top: var(--mdhui-padding-md);\n}");A(".mdhui-meal-log {\n padding: 16px 0 0;\n}\n\n.mdhui-meal-log .mdhui-title {\n padding: 0 16px;\n}\n\n.mdhui-meal-log .mdhui-loading-indicator {\n padding: 16px 16px 32px;\n}\n\n.mdhui-meal-log-empty-text {\n color: var(--mdhui-text-color-3);\n padding: 16px 16px 32px;\n text-align: center;\n}");function GAe(e){const a=r(Ga),[n,i]=c(!0);return l((()=>{i(!!e.mealImageUrl)}),[e.mealImageUrl]),t.createElement("div",{className:"mdhui-meal",ref:e.innerRef},t.createElement(KAe,{onClick:e.onClick},t.createElement("div",{className:"mdhui-meal-thumbnail"},!e.mealImageUrl&&t.createElement(t.Fragment,null,"meal"===e.meal.type&&t.createElement(Ne,{icon:Y}),"snack"===e.meal.type&&t.createElement(Ne,{icon:se}),"drink"===e.meal.type&&t.createElement(Ne,{icon:ge})),e.mealImageUrl&&t.createElement(t.Fragment,null,t.createElement("div",{className:"mdhui-meal-thumbnail-image",style:{display:n?"none":"block"}},t.createElement("img",{alt:"meal thumbnail",src:e.mealImageUrl,onLoad:()=>i(!1)})),n&&t.createElement(XA,{className:"mdhui-meal-loading"})),void 0!==e.number&&t.createElement("div",{className:"mdhui-meal-number",style:{background:je(a.colorScheme,e.color)}},e.number))),t.createElement(KAe,{onClick:e.onClick},t.createElement("div",{className:"mdhui-meal-info"},t.createElement("div",{className:"mdhui-meal-type"},Ld(e.meal.type)," ",e.selected&&t.createElement(Ne,{icon:B,color:"var(--mdhui-color-success)"})),t.createElement("div",{className:"mdhui-meal-time"},pl(e.meal.timestamp)),e.meal.description&&t.createElement("div",{className:"mdhui-meal-description"},e.meal.description))),e.onEdit&&t.createElement(S,{onClick:()=>e.onEdit(),style:{height:"100%"}},t.createElement("div",{className:"mdhui-meal-edit-action"},t.createElement(Ne,{icon:T}))))}function KAe(e){return e.onClick?t.createElement(S,{onClick:()=>e.onClick(),style:{height:"100%"}},e.children):t.createElement(t.Fragment,null,e.children)}function ZAe(e){const a=r(efe);if(!a)return t.createElement($q,{innerRef:e.innerRef},"Error: Meal Log must be used within a Meal Coordinator.");return t.createElement("div",{className:"mdhui-meal-log",ref:e.innerRef},t.createElement(sM,{order:3},no("meal-log-title")),a.loading&&t.createElement(XA,null),!a.loading&&0===a.meals.length&&t.createElement("div",{className:"mdhui-meal-log-empty-text"},no("meal-log-no-data")),!a.loading&&a.meals.map(((n,i)=>t.createElement(GAe,{key:`meal-${i}`,meal:n,mealImageUrl:a.imageUrls[n.id.toString()],number:e.showMealNumbers?i+1:void 0,color:Re(i),onClick:()=>a.onMealClicked(n),onEdit:()=>(t=>{e.preview?e.onEditMeal():Sd(t).then(e.onEditMeal)})(n),selected:!!e.highlightSelectedMeal&&a.selectedMeal===n}))))}A(".mdhui-meal {\n display: grid;\n grid-template-columns: max-content auto max-content;\n align-items: start;\n border-bottom: 1px solid var(--mdhui-border-color-0);\n}\n\n.mdhui-meal .mdhui-unstyled-button {\n display: inline-flex;\n}\n\n.mdhui-meal:last-child {\n border: none;\n}\n\n.mdhui-meal-thumbnail {\n position: relative;\n height: 48px;\n width: 48px;\n line-height: 48px;\n text-align: center;\n color: var(--mdhui-text-color-2);\n background: var(--mdhui-background-color-1);\n border: 1px solid var(--mdhui-border-color-2);\n border-radius: 5px;\n margin: 16px 8px 16px 16px;\n}\n\n.mdhui-meal-thumbnail-image img {\n height: 48px;\n width: 48px;\n object-fit: cover;\n}\n\n.mdhui-meal-loading.mdhui-loading-indicator {\n padding: 0;\n}\n\n.mdhui-meal-number {\n position: absolute;\n top: -6px;\n left: -6px;\n height: 20px;\n width: 20px;\n line-height: 20px;\n font-size: 0.7em;\n font-family: monospace;\n color: #fff;\n text-align: center;\n border-radius: 10px;\n}\n\n.mdhui-meal-number-old {\n font-size: 0.8em;\n height: 24px;\n line-height: 24px;\n padding: 0 8px;\n color: #fff;\n border-radius: 12px;\n margin: 24px 8px 16px 16px;\n}\n\n.mdhui-meal-info {\n margin: 16px 8px;\n color: var(--mdhui-text-color-2);\n}\n\n.mdhui-meal-type {\n font-size: 0.9em;\n font-weight: bold;\n}\n\n.mdhui-meal-time {\n color: var(--mdhui-text-color-1);\n font-size: 0.9em;\n}\n\n.mdhui-meal-description {\n margin-top: 8px;\n font-size: 0.75em;\n}\n\n.mdhui-meal-edit-action {\n margin: 24px 16px 16px;\n color: var(--mdhui-text-color-2);\n}");function YAe(e){var a=nl(e.intervalStart.getFullYear(),e.intervalStart.getMonth());const n=r(Ga);function i(e){return e.data.filter((e=>e)).length}return t.createElement("div",{ref:e.innerRef,className:"mdhui-monthly-event-matrix"},e.rows.length>0&&t.createElement("table",{cellPadding:"0",cellSpacing:"0"},t.createElement("thead",null,e.title&&t.createElement("tr",null,t.createElement("th",{colSpan:100},e.title)),t.createElement("tr",null,t.createElement("td",{className:"mdhui-monthly-event-matrix-title"}),t.createElement("td",null),a.map((e=>t.createElement("td",{key:e.toISOString(),style:{width:75/a.length+"%"}},t.createElement("div",{className:"mdhui-monthly-event-matrix-day-number"},e.getDate())))))),t.createElement("tbody",null,e.rows.map((e=>t.createElement("tr",{key:e.label},t.createElement("td",{className:"mdhui-monthly-event-matrix-row-label"},e.label," "),t.createElement("td",{className:"mdhui-monthly-event-matrix-row-total"},t.createElement("span",null,i(e)>0?i(e):t.createElement(t.Fragment,null," "))),a.map(((i,r)=>t.createElement("td",{key:i.toISOString(),style:{width:75/a.length+"%"}},t.createElement("div",{className:"mdhui-monthly-event-matrix-circle",style:{backgroundColor:e.data[r]?je(n.colorScheme,e.color):"#ddd"}}))))))))))}A(".mdhui-monthly-event-matrix {\n margin: 16px;\n}\n\n.mdhui-monthly-event-matrix table {\n width: 100%;\n page-break-inside: avoid;\n}\n\n.mdhui-monthly-event-matrix table th,\n.mdhui-monthly-event-matrix table td {\n vertical-align: top;\n}\n\n.mdhui-monthly-event-matrix table th {\n text-align: left;\n border: none;\n font-weight: normal;\n font-size: 15px;\n padding: 0;\n padding-bottom: 8px;\n padding-right: 8px;\n}\n\n.mdhui-monthly-event-matrix table thead th {\n text-align: left;\n font-weight: bold;\n font-size: 17px;\n padding-bottom: 8px;\n}\n\n.mdhui-monthly-event-matrix table thead .mdhui-monthly-event-matrix-day-number {\n width: 100%;\n min-width: 20px;\n text-align: center;\n font-size: 12px;\n color: var(--mdhui-text-color-2);\n}\n\n.mdhui-monthly-event-matrix table td {\n padding: 0;\n text-align: center;\n padding-bottom: 8px;\n}\n\n.mdhui-monthly-event-matrix table td.mdhui-monthly-event-matrix-row-label {\n text-align: left;\n border: none;\n font-weight: normal;\n font-size: 15px;\n padding: 0;\n padding-bottom: 8px;\n padding-right: 8px;\n width: 22%;\n}\n\n.mdhui-monthly-event-matrix table td .mdhui-monthly-event-matrix-circle {\n display: inline-block;\n width: 14px;\n height: 14px;\n border-radius: 8px;\n font-size: 9px;\n color: var(--mdhui-background-color-0);\n line-height: 14px;\n text-align: center;\n position: relative;\n}\n\n.mdhui-monthly-event-matrix table td.mdhui-monthly-event-matrix-total {\n padding-right: 8px;\n font-weight: bold;\n font-size: 15px;\n text-align: right;\n width: 3%;\n box-sizing: border-box;\n}");function XAe(e){const a=s(null);b((()=>{const{current:e}=a;function t(){window.scrollY>0?e?.classList.add("scroll-shadow"):e?.classList.remove("scroll-shadow")}return window.addEventListener("scroll",t),()=>{window.removeEventListener("scroll",t)}}));let n=["mdhui-navigation-bar"];e.className&&n.push(e.className),"compressed"==e.variant&&n.push("mdhui-navigation-bar-compressed"),"compressedModal"==e.variant&&n.push("mdhui-navigation-bar-compressed-modal");let i=r(Ga);return t.createElement("div",{className:n.join(" "),ref:a,style:{background:je(i?.colorScheme,e.backgroundColor)}},e.showBackButton&&t.createElement("div",{className:"button back-button",onClick:()=>{e.onBack?e.onBack():w.back()},style:{color:je(i?.colorScheme,e.buttonColor)}},t.createElement(Ne,{icon:ke}),e.backButtonText?e.backButtonText:no("back")),e.navigationBarLeft&&t.createElement("div",{className:"navigation-bar-left"},e.navigationBarLeft),e.title&&t.createElement("div",{className:"title",style:{color:je(i?.colorScheme,e.titleColor)}},t.createElement("span",null,e.title)),e.subtitle&&t.createElement("div",{className:"subtitle",style:{color:je(i?.colorScheme,e.subtitleColor),marginTop:e.title?"var(--mdhui-padding-sm)":"0"}},t.createElement("span",null,e.subtitle)),e.navigationBarRight&&t.createElement("div",{className:"navigation-bar-right"},e.navigationBarRight),e.showCloseButton&&t.createElement("div",{className:"button close-button",onClick:()=>{e.onClose?e.onClose():w.dismiss()},style:{color:je(i?.colorScheme,e.buttonColor)}},e.closeButtonText?e.closeButtonText:no("close")),e.children&&t.createElement("div",{className:"children"},e.children))}A(".mdhui-navigation-bar {\n text-align: left;\n padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px;\n min-height: calc(56px + env(safe-area-inset-top, 0px));\n margin-bottom: 8px;\n box-sizing: border-box;\n position: -webkit-sticky;\n position: sticky;\n z-index: 2;\n top: 0;\n font-weight: bold;\n background: var(--mdhui-background-color-1);\n}\n\n.mdhui-navigation-bar.mdhui-navigation-bar-compressed {\n text-align: center;\n font-size: 18px;\n}\n\n.mdhui-navigation-bar .title {\n margin-top: 44px;\n height: 32px;\n line-height: 32px;\n font-size: 1.2em;\n}\n\n.mdhui-navigation-bar.mdhui-navigation-bar-compressed .title {\n margin-top: 6px;\n}\n\n.mdhui-navigation-bar .subtitle {\n font-size: 1em;\n font-weight: 500;\n color: var(--mdhui-text-color-2);\n margin-top: 8px;\n}\n\n.mdhui-navigation-bar.scroll-shadow {\n box-shadow: var(--mdhui-box-shadow-1);\n}\n\n.mdhui-navigation-bar .icon {\n width: 32px;\n vertical-align: middle;\n}\n\n.mdhui-navigation-bar .button {\n position: absolute;\n top: calc(12px + env(safe-area-inset-top, 0px));\n height: 32px;\n line-height: 32px;\n border-radius: 16px;\n font-weight: normal;\n font-size: .88em;\n cursor: pointer;\n color: var(--mdhui-color-primary);\n}\n\n.mdhui-navigation-bar .back-button {\n left: 16px;\n}\n\n.mdhui-navigation-bar.mdhui-navigation-bar-compressed-modal {\n text-align: left;\n padding-top: calc(16px + env(safe-area-inset-top, 0px));\n font-size: 18px;\n margin-bottom: 0;\n}\n\n.mdhui-navigation-bar .close-button {\n right: 16px;\n}\n\n.mdhui-navigation-bar .children {\n padding-top: 56px;\n}\n\n.mdhui-navigation-bar.mdhui-navigation-bar-compressed .children {\n padding-top: calc(32px + env(safe-area-inset-top, 0px));\n}");function QAe(e){const[a,n]=c(!1),i=s(null);return l((()=>{i.current.style.height="1px",i.current.style.height=i.current.scrollHeight+"px"}),[e.value]),t.createElement("textarea",{title:no("add-notes"),ref:i,onClick:t=>function(t){if(!a&&e.autoTimestamp){n(!0);var r="";e.value.length&&(r=e.value+"\n\n"),r+="-- "+pl(new Date)+" --\n",e.onChange(r),t.stopPropagation(),i.current?.focus()}}(t),onChange:t=>e.onChange(t.target.value),className:"notes-input",placeholder:e.placeholder,value:e.value})}A(".notes-input {\n width: 100%;\n text-align: left;\n border: 0;\n font-size: .88em;\n border: none;\n font-family: Helvetica, Arial, sans-serif;\n padding-top: 16px;\n resize: none;\n background: var(--mdhui-background-color-2);\n border-radius: var(--mdhui-card-border-radius);\n padding: 16px;\n box-sizing: border-box;\n border: solid 1px var(--mdhui-color-primary);\n overflow: hidden;\n -webkit-appearance: none;\n box-shadow: none !important;\n color: var(--mdhui-text-color-1);\n margin-bottom: 16px;\n}");function JAe(e){let a=r(Ga),n=["mdhui-progress-bar"];return e.defaultMargin&&n.push("mdhui-progress-bar-default-margin"),t.createElement("div",{className:n.join(" "),ref:e.innerRef},t.createElement("div",{className:"mdhui-progress-bar-background",style:{background:je(a?.colorScheme,e.backgroundColor)}},t.createElement("div",{className:"mdhui-progress-bar-fill",style:{width:Math.trunc(e.fillPercent)+"%",background:je(a?.colorScheme,e.fillColor)}}),t.createElement(tS,null)),t.createElement("div",{className:"mdhui-progress-steps"},e.steps&&t.createElement(t.Fragment,null,e.steps.map(((e,a)=>t.createElement("div",{key:`${a}-step`,className:"step-icon",style:{left:Math.trunc(e.percent)+"%"}},e.icon))))))}function eSe(e){let a=r(Ga),n="calc( var(--icon_size) / 2 - "+e.height+" / 2 - 4px)";return t.createElement("span",{style:{border:"2px solid",borderColor:je(a?.colorScheme,e.borderColor),borderRadius:e.height,height:e.height,width:e.height,marginTop:n,backgroundColor:je(a?.colorScheme,e.backgroundColor),padding:"4px 4px"}},e.children)}A(".mdhui-progress-bar {\n\tdisplay: block;\n\twidth: 100%;\n\tposition: relative;\n\t--icon_size: 24px;\n\t--icon_border_width: 2px;\n}\n\n.mdhui-progress-bar.mdhui-progress-bar-default-margin {\n\tmargin: 16px;\n\twidth: calc(100% - 32px)\n}\n\n.mdhui-progress-bar .mdhui-progress-bar-background {\n\tborder-radius: 500px;\n\tborder-width: var(--icon_border_width);\n\tborder-style: none;\n\tbackground: #fff;\n\toverflow: hidden;\n\twidth: 100%;\n\tposition: relative;\n\theight: calc(var(--icon_size) + 4px);\n\tz-index: 1;\n}\n\n.mdhui-progress-bar .mdhui-progress-bar-background .mdhui-progress-bar-fill {\n\tposition: absolute;\n\tmin-height: 1px;\n\theight: calc(var(--icon_size) + 4px);\n\ttop: 0;\n\tborder-radius: var(--icon_size);\n\ttransition: width 1s ease-in-out;\n}\n\n.mdhui-progress-bar .mdhui-progress-steps {\n\ttop: 0;\n\twidth: 100%;\n\tposition: absolute;\n\tz-index: 2;\n\tdisplay: inline-block;\n}\n\n.mdhui-progress-bar .step-icon {\n\tposition: absolute;\n\ttransform: translate(-100%, 0);\n}\n\n.mdhui-progress-bar .step-icon * {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n}"),JAe.defaultProps={backgroundColor:"var(--mdhui-background-color-0)",fillColor:"var(--mdhui-color-primary)",fillPercent:0};function tSe(e){const a=r(Ga);let n=0;e.percentCompleted&&(n=630-e.percentCompleted/100*630);const i={stroke:je(a.colorScheme,e.color),strokeDashoffset:n,animation:e.animate?"mdhui-progress-ring 750ms ease-in-out":void 0,"--mdhui-progress-ring-animation-end":n},o={opacity:e.animate?0:1,animation:e.animate?"fadein 500ms ease-in-out":void 0,animationDelay:"500ms",animationFillMode:"forwards"};return t.createElement("div",{className:"mdhui-progress-ring",style:e.style},t.createElement("svg",null,t.createElement("circle",{cx:"50%",cy:"50%",r:"100"}),t.createElement("circle",{cx:"50%",cy:"50%",r:"100",style:i})),t.createElement("div",{className:"mdhui-progress-ring-content",style:o},e.children))}A("@keyframes mdhui-progress-ring {\n 0% {\n stroke-dashoffset: var(--mdhui-progress-ring-animation-start);\n }\n 100% {\n stroke-dashoffset: var(--mdhui-progress-ring-animation-end);\n }\n}\n\n.mdhui-progress-ring {\n position: relative;\n margin: 0 auto 0 auto;\n width: 220px;\n height: 220px;\n --mdhui-progress-ring-animation-start: 630;\n --mdhui-progress-ring-animation-end: 0;\n}\n\n.mdhui-progress-ring svg {\n width: 220px;\n height: 220px;\n transform: rotate(-90deg);\n}\n\n.mdhui-progress-ring circle {\n margin: 0 auto;\n fill: none;\n stroke-width: 20;\n stroke-dasharray: 630;\n stroke-linecap: round;\n}\n\n.mdhui-progress-ring circle:nth-child(2) {\n stroke: var(--mdhui-color-primary);\n animation-fill-mode: forwards;\n}\n\n.mdhui-progress-ring-content {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n}");function aSe(e){return t.createElement("div",{className:"mdhui-resource",ref:e.innerRef},t.createElement(S,{onClick:()=>e.onClick()},e.imageUrl&&t.createElement("div",{className:"mdhui-resource-image",style:{textAlign:e.imageAlignment??"left"}},t.createElement("img",{src:e.imageUrl,alt:"resource image"})),t.createElement("div",{className:"mdhui-resource-title"},e.title),t.createElement("div",{className:"mdhui-resource-subtitle"},e.subTitle),"button"===e.buttonVariant&&t.createElement("div",{className:"mdhui-button mdhui-resource-button",onClick:lM},e.buttonText||no("resource-default-button-text")),"link"===e.buttonVariant&&t.createElement("div",{className:"mdhui-resource-link"},e.buttonText||no("resource-default-button-text"))))}A(".mdhui-resource {\n background: var(--mdhui-background-color-0);\n border-radius: 12px;\n margin: 12px 16px;\n box-shadow: var(--mdhui-box-shadow-0);\n}\n\n.mdhui-resource .mdhui-unstyled-button {\n width: 100%;\n padding: 16px;\n}\n\n.mdhui-resource-image {\n width: 100%;\n margin-bottom: 16px;\n}\n\n.mdhui-resource-image img {\n max-width: 100%;\n}\n\n.mdhui-resource-title {\n font-size: 1.3em;\n font-weight: 600;\n}\n\n.mdhui-resource-subtitle {\n font-size: 0.95em;\n margin: 12px 0 0;\n}\n\n.mdhui-resource-button {\n margin: 12px 0 0;\n}\n\n.mdhui-resource-link {\n color: var(--mdhui-color-primary);\n font-weight: 500;\n margin: 16px 0 0;\n}");A(".mdhui-resource-list {\n padding: 0 16px;\n margin-bottom: 16px;\n}\n\n.mdhui-resource-list-empty-text {\n color: var(--mdhui-text-color-3);\n padding: 16px 0;\n}");const nSe={"no resources":{resources:[]},"some resources":{resources:[{title:"Resource 1 Title",subTitle:"resource 1 subtitle",imageUrl:Cge},{title:"Resource 2 Title",subTitle:"resource 2 subtitle",imageUrl:Cge},{title:"Resource 3 Title",subTitle:"resource 3 subtitle",imageUrl:Cge},{title:"Resource 4 Title",subTitle:"resource 4 subtitle",imageUrl:Cge},{title:"Resource 5 Title",subTitle:"resource 5 subtitle",imageUrl:Cge}]}};function iSe(e){let a=e.previewState?nSe[e.previewState].resources:e.resources;return t.createElement("div",{className:"mdhui-resource-list",ref:e.innerRef},t.createElement(t.Fragment,null,a.length>0&&a.map(((a,n)=>t.createElement(aSe,{key:n,title:a.title,subTitle:a.subTitle,imageUrl:a.imageUrl,onClick:()=>e.onViewResource(a),imageAlignment:e.imageAlignment,buttonVariant:e.buttonVariant,buttonText:e.buttonText}))),0===a.length&&t.createElement("div",{className:"mdhui-resource-list-empty-text"},e.emptyText||no("resource-list-empty-text"))))}function rSe(e){let a=d.toArray(e.children);if(0===a.length)return t.createElement("div",{ref:e.innerRef});let n,i=new Date,r=e.startDate;return Ci(r,i)&&(r=i),n="month"===e.interval?Mn(i,r)%a.length:"week"===e.interval?function(e,t,a){const n=_n(e,t,a)/7;return Tn(a?.roundingMethod)(n)}(i,r)%a.length:_n(i,r)%a.length,t.createElement("div",{ref:e.innerRef},a[n])}function oSe(e){if(!e.children)return null;let a=r(Ga),n=je(a?.colorScheme,e.backgroundColor);return t.createElement("div",{ref:e.innerRef,style:{...e.style,backgroundColor:n},className:"mdhui-section "+(e.className||"")+(e.noTopMargin?" mdhui-section-no-top-margin":"")},e.children)}A(".mdhui-section {\n margin-top: 16px;\n margin-bottom: 16px;\n background: var(--mdhui-background-color-0);\n box-shadow: var(--mdhui-box-shadow-0);\n animation: var(--mdhui-fadein-animation);\n -moz-animation: var(--mdhui-fadein-animation);\n -webkit-animation: var(--mdhui-fadein-animation);\n position: relative;\n display: flow-root;\n}\n\n.mdhui-section:empty {\n display: none;\n}\n\n.mdhui-section.mdhui-section-no-top-margin {\n margin-top: 0;\n}");function sSe(e){var a=100/e.segments.length;let n=["mdhui-segmented-control"];return e.className&&n.push(e.className),"optionsHorizontal"==e.variant&&n.push("mdhui-segmented-control-options-horizontal"),"optionsVertical"==e.variant&&n.push("mdhui-segmented-control-options-vertical"),t.createElement("div",{ref:e.innerRef,style:{...e.style,borderColor:e.color},className:n.join(" ")},e.segments.map((n=>t.createElement(S,{className:"mdhui-segment "+(n.key==e.selectedSegment?"mdhui-segment-selected":""),key:n.key,onClick:()=>e.onSegmentSelected(n.key),style:{width:a+"%",color:n.key==e.selectedSegment?void 0:e.color,backgroundColor:n.key==e.selectedSegment?e.color:void 0}},n.key==e.selectedSegment&&t.createElement(tS,null),n.title))))}A(".mdhui-segmented-control {\n border-radius: 32px;\n border: solid 1px var(--mdhui-color-primary);\n background: var(--mdhui-background-color-0);\n overflow: hidden;\n padding: 1px;\n}\n\n.mdhui-segmented-control .mdhui-segment {\n display: inline-block;\n font-size: .7em;\n cursor: pointer;\n text-align: center;\n padding: 8px;\n box-sizing: border-box;\n font-weight: bold;\n color: var(--mdhui-color-primary);\n position: relative;\n border-radius: 32px;\n overflow: hidden;\n vertical-align: top;\n text-overflow: ellipsis;\n white-space: nowrap;\n line-height: 1em;\n}\n\n.mdhui-segmented-control .mdhui-segment:last-child {\n border: none;\n}\n\n.mdhui-segmented-control .mdhui-segment.mdhui-segment-selected {\n background: var(--mdhui-color-primary);\n color: #FFF;\n}\n\n.mdhui-segmented-control.mdhui-segmented-control-options-horizontal,\n.mdhui-segmented-control.mdhui-segmented-control-options-vertical {\n font-size: .88em;\n padding: 0;\n border-radius: var(--mdhui-card-border-radius);\n}\n\n.mdhui-segmented-control.mdhui-segmented-control-options-horizontal .mdhui-segment,\n.mdhui-segmented-control.mdhui-segmented-control-options-vertical .mdhui-segment {\n font-size: .88em;\n border-radius: 0;\n font-weight: normal;\n}\n\n.mdhui-segmented-control.mdhui-segmented-control-options-horizontal .mdhui-segment.mdhui-segment-selected,\n.mdhui-segmented-control.mdhui-segmented-control-options-vertical .mdhui-segment.mdhui-segment-selected {\n background: var(--mdhui-color-primary);\n color: #FFF;\n}\n\n.mdhui-segmented-control.mdhui-segmented-control-options-vertical .mdhui-segment {\n width: 100% !important;\n border-bottom: solid 1px var(--mdhui-color-primary);\n}\n\n.mdhui-segmented-control.mdhui-segmented-control-options-vertical .mdhui-segment:last-child {\n border: none;\n}\n\n.mdhui-segmented-control.mdhui-segmented-control-default-margin {\n margin: 16px;\n}\n");function lSe(e){const a=()=>t.createElement(t.Fragment,null,t.createElement("div",{className:"mdhui-single-data-point-value-units"},!e.value&&t.createElement("div",{className:"mdhui-single-data-point-value"},"..."),e.value&&t.createElement("div",{className:"mdhui-single-data-point-value"},e.value),e.value&&e.units&&t.createElement("div",{className:"mdhui-single-data-point-units"},e.units)),t.createElement("div",{className:"mdhui-single-data-point-label"},e.label),e.statusText&&t.createElement("div",{className:"mdhui-single-data-point-status",style:e.statusColor?{color:e.statusColor}:void 0},e.statusText));return t.createElement("div",{ref:e.innerRef},e.onClick&&t.createElement(S,{className:"mdhui-single-data-point",onClick:()=>e.onClick()},a()),!e.onClick&&t.createElement("div",{className:"mdhui-single-data-point"},a()))}A(".mdhui-single-data-point, .mdhui-unstyled-button.mdhui-single-data-point {\n display: grid;\n grid-template-columns: 1fr;\n align-items: center;\n padding: 16px;\n border-radius: 6px;\n border: 1px solid var(--mdhui-border-color-1);\n background: var(--mdhui-background-color-0);\n min-height: 60px;\n width: 100%;\n box-sizing: border-box;\n}\n\n.mdhui-single-data-point-value-units {\n display: grid;\n grid-template-columns: max-content auto;\n align-items: baseline;\n grid-column-gap: 2px;\n}\n\n.mdhui-single-data-point-setup {\n font-size: 1.3em;\n color: var(--mdhui-color-primary);\n}\n\n.mdhui-single-data-point-value {\n font-size: 1.3em;\n font-weight: bold;\n}\n\n.mdhui-single-data-point-units {\n color: var(--mdhui-text-color-3);\n font-size: 0.8em;\n}\n\n.mdhui-single-data-point-label {\n font-size: 0.7em;\n font-weight: bold;\n}\n\n.mdhui-single-data-point-status {\n font-size: 0.7em;\n font-weight: bold;\n}");function cSe(e){const[a,n]=c("");function i(){return a||e.externalAccount.status}return t.createElement("div",{ref:e.innerRef,className:"mdhui-single-external-account"},t.createElement("div",{className:"external-account-header"},e.externalAccount.provider.logoUrl&&t.createElement("img",{alt:e.externalAccount.provider.name,src:e.externalAccount.provider.logoUrl,className:"external-account-provider-logo"}),!e.externalAccount.provider.logoUrl&&t.createElement("div",{className:"external-account-provider-name"},e.externalAccount.provider.name),"deleting"!==i()&&"fetchingData"!==i()&&t.createElement(S,{className:"delete-button",onClick:function(){n("deleting"),w.deleteExternalAccount(e.externalAccount.id).then((function(){e.onAccountRemoved(e.externalAccount)})).catch((function(){n("")}))},title:no("external-account-remove")},t.createElement(Ne,{icon:ee}))),t.createElement("div",{className:"external-account-status"},"unauthorized"===i()&&t.createElement("p",null,t.createElement("span",{className:"error"},no("external-account-authorization-expired"))),"fetchingData"===i()&&t.createElement("p",null,t.createElement(Ne,{icon:V,spin:!0})," ",no("external-account-fetching-data")),"fetchComplete"===i()&&t.createElement("p",null,no("external-account-last-updated")," ",t.createElement("strong",null,ml(e.externalAccount.lastRefreshDate,new Date))),"error"===i()&&t.createElement("p",{className:"error"},no("external-account-error")),("fetchComplete"===i()||"error"===i())&&t.createElement("p",null,t.createElement("a",{href:"javascript:{}",onClick:function(){n("fetchingData"),w.refreshExternalAccount(e.externalAccount.id).then()}},t.createElement(Ne,{icon:j})," ",no("external-account-refresh"))),"unauthorized"===i()&&t.createElement("p",null,t.createElement("a",{href:"javascript:{}",onClick:()=>e.onReconnectAccount(e.externalAccount)},t.createElement(Ne,{icon:j})," ",no("external-account-reconnect"))),"deleting"===i()&&t.createElement("p",null,t.createElement(Ne,{icon:V,spin:!0})," ",no("external-account-deleting"))))}A(".mdhui-single-external-account {\n position: relative;\n overflow: hidden;\n background: var(--mdhui-background-color-0);\n}\n\n.mdhui-single-external-account .external-account-header {\n position: relative;\n padding: 8px;\n font-weight: bold;\n border-bottom: solid 1px var(--mdhui-border-color-0);\n}\n\n.mdhui-single-external-account .external-account-header .delete-button {\n position: absolute;\n right: 0;\n top: 0;\n cursor: pointer;\n padding: 16px;\n color: var(--mdhui-text-color-4);\n width: auto;\n font-size: .88em;\n border: none;\n background: none;\n height: 100%;\n}\n\n.mdhui-single-external-account .external-account-header .external-account-provider-logo {\n height: 24px;\n display: block;\n background: #FFF;\n padding: 8px;\n border-radius: 8px;\n}\n\n.mdhui-single-external-account .external-account-header .external-account-provider-name {\n font-size: 1em;\n font-weight: bold;\n}\n\n.mdhui-single-external-account .external-account-status {\n padding: 16px;\n padding-bottom: 0;\n padding-top: 0;\n font-size: .88em;\n}\n\n.mdhui-single-external-account .external-account-status p {\n margin-bottom: 16px;\n margin-top: 16px;\n}\n\n.mdhui-single-external-account .external-account-status a {\n cursor: pointer;\n text-decoration: none;\n}\n\n.mdhui-single-external-account .external-account-status .error {\n color: var(--mdhui-color-danger);\n}");function uSe(e){return e.notification?t.createElement("div",{ref:e.innerRef,className:"mdhui-single-notification"},e.notification.content?.title&&t.createElement("div",{className:"notification-title"},e.notification.content.title),e.notification.content?.subject&&t.createElement("div",{className:"notification-title"},e.notification.content.subject),e.notification.content?.body&&t.createElement("div",{className:"notification-body"},e.notification.content.body),t.createElement("div",{className:"notification-date"},ml(e.notification.sentDate,new Date))):t.createElement("div",{ref:e.innerRef,className:"mdhui-single-notification"},t.createElement("div",{className:"notification-body"},"No notifications received"))}A(".mdhui-single-notification\n{\n padding: 16px;\n border-bottom: solid 1px var(--mdhui-border-color-0);\n position: relative;\n}\n\n .mdhui-single-notification:last-child\n {\n border: none;\n }\n\n .mdhui-single-notification > .notification-title\n {\n font-weight: bold;\n }\n\n .mdhui-single-notification > .notification-body\n {\n font-size: .88em;\n }\n\n .mdhui-single-notification > .notification-date\n {\n color: var(--mdhui-text-color-2);\n margin-top: 16px;\n font-size: .75em;\n }\n");A(".mdhui-single-survey-task {\n border-radius: inherit;\n}\n\n.mdhui-single-survey-task.incomplete-expanded {\n padding: 16px;\n width: 100%;\n box-sizing: border-box;\n}\n\n.mdhui-single-survey-task.incomplete-expanded.active {\n cursor: pointer;\n}\n\n.mdhui-single-survey-task.incomplete-expanded .header {\n display: grid;\n grid-template-columns: auto max-content;\n align-items: center;\n}\n\n.mdhui-single-survey-task .survey-name {\n font-size: .88em;\n font-weight: bold;\n}\n\n.mdhui-single-survey-task.incomplete-expanded .survey-name {\n font-size: 1.3em;\n}\n\n.mdhui-single-survey-task .survey-description {\n font-size: .88em;\n color: var(--mdhui-text-color-2);\n}\n\n.mdhui-single-survey-task.incomplete-expanded .survey-description {\n font-size: 1em;\n margin: 12px 0;\n}\n\n.mdhui-single-survey-task .completed-date {\n font-size: .88em;\n color: var(--mdhui-text-color-2);\n}\n\n.mdhui-single-survey-task .due-date {\n font-size: .88em;\n color: var(--mdhui-color-primary);\n}\n\n.mdhui-single-survey-task .due-date.warning {\n color: var(--mdhui-color-warning);\n font-weight: bold;\n}\n\n.mdhui-single-survey-task .due-date.danger {\n color: var(--mdhui-color-danger);\n font-weight: bold;\n}");var dSe="data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='21' height='24' viewBox='0 0 21 24' fill='none'%3e%3cg clip-path='url(%23clip0_881_3509)'%3e%3cpath d='M20.6718 4.82803C21.1124 5.26865 21.1124 5.98115 20.6718 6.41709L8.29678 18.7968C7.85615 19.2374 7.14365 19.2374 6.70772 18.7968L0.328027 12.4218C-0.112598 11.9812 -0.112598 11.2687 0.328027 10.8327C0.768652 10.3968 1.48115 10.3921 1.91709 10.8327L7.49521 16.4108L19.078 4.82803C19.5187 4.3874 20.2312 4.3874 20.6671 4.82803H20.6718Z' fill='%2314B856'/%3e%3c/g%3e%3cdefs%3e%3cclipPath id='clip0_881_3509'%3e%3crect width='21' height='24' fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";function hSe(e){const a=r(Ga),n=()=>{let a,n=Rr(),i=cn(new Date(n),{days:1}),r=Tr(e.task.dueDate??""),o=["due-date"];return Sn(r,i)?(a=no("due-tomorrow"),o.push("warning")):Sn(r,n)?(a=no("due-today"),o.push("warning")):Ci(n,r)?(a=no("overdue"),o.push("danger")):a=no("due-in")+" "+function(e){const t=tl(e);return t?Ei(t,{locale:vl()}):""}(r),t.createElement("div",{className:o.join(" ")},a)};return"incomplete"===e.task.status&&"expanded"===e.variant?t.createElement("div",{className:"mdhui-single-survey-task incomplete-expanded "+(e.surveyBlocked?"":"active"),onClick:e.surveyBlocked?void 0:()=>e.onClick()},t.createElement("div",{className:"header"},t.createElement("div",{className:"survey-name"},e.task.surveyDisplayName),e.task.dueDate&&n()),t.createElement("div",{className:"survey-description"},t.createElement(t.Fragment,null,e.descriptionIcon," ",e.task.surveyDescription)),e.surveyActive&&t.createElement(XA,null),!e.surveyActive&&t.createElement(QA,{color:je(a.colorScheme,e.buttonColor),variant:e.buttonVariant,onClick:lM,disabled:e.surveyBlocked},e.task.hasSavedProgress?no("resume-survey"):no("start-survey"))):"incomplete"===e.task.status?(()=>{let i;return i=e.surveyActive?t.createElement(XA,null):t.createElement(QA,{color:je(a.colorScheme,e.buttonColor),variant:e.buttonVariant??"light",onClick:lM,disabled:e.surveyBlocked},e.task.hasSavedProgress?no("resume"):no("start")),t.createElement(Za,{renderAs:"div",innerRef:e.innerRef,onClick:e.surveyBlocked?void 0:()=>e.onClick(),className:"mdhui-single-survey-task incomplete",indicator:i},t.createElement("div",{className:"survey-name"},e.task.surveyDisplayName),t.createElement("div",{className:"survey-description"},t.createElement(t.Fragment,null,e.descriptionIcon," ",e.task.surveyDescription)),e.task.dueDate&&n())})():"complete"===e.task.status?t.createElement(Za,{renderAs:"div",className:"mdhui-single-survey-task complete",indicator:t.createElement("img",{src:dSe,alt:"check mark"}),innerRef:e.innerRef},t.createElement("div",{className:"survey-name"},e.task.surveyDisplayName),e.task.endDate&&t.createElement("div",{className:"completed-date"},no("completed")," ",ml(e.task.endDate,new Date))):null}function mSe(e){let a=r(Ga);var n=100/e.bars.length;function i(t){return e.gap?`calc(${n*t}% + ${e.gap/2}px)`:n*t+"%"}let o=["mdhui-spark-bar-chart"];return"rounded"===e.variant&&o.push("mdhui-spark-bar-chart-rounded"),t.createElement("div",{ref:e.innerRef,className:o.join(" "),style:e.style},void 0!==e.averageFillPercent&&t.createElement("div",{className:"mdhui-spark-bar-chart-average",style:{bottom:100*e.averageFillPercent+"%"}}),t.createElement("div",{className:"mdhui-spark-bar-chart-bars"},e.bars.map(((r,o)=>t.createElement("div",{key:o,className:"mdhui-spark-bar-chart-bar",style:{backgroundColor:je(a.colorScheme,r.color),height:100*r.barFillPercent+"%",width:e.gap?`calc(${n}% - ${e.gap}px)`:n+"%",left:i(o),opacity:r.opacity}},t.createElement(tS,null))))))}A(".mdhui-spark-bar-chart {\n position: relative;\n height: 72px;\n}\n\n.mdhui-spark-bar-chart .mdhui-spark-bar-chart-bars {\n margin-left: 8px;\n width: calc(100% - 16px);\n position: relative;\n height: 100%;\n}\n\n.mdhui-spark-bar-chart .mdhui-spark-bar-chart-bars .mdhui-spark-bar-chart-bar {\n position: absolute;\n bottom: 0;\n z-index: 2;\n}\n\n.mdhui-spark-bar-chart.mdhui-spark-bar-chart-rounded .mdhui-spark-bar-chart-bars .mdhui-spark-bar-chart-bar {\n border-radius: 4px 4px 0 0;\n}\n\n.mdhui-spark-bar-chart .mdhui-spark-bar-chart-average {\n border-top: dashed 1px var(--mdhui-border-color-1);\n position: absolute;\n left: 0px;\n right: 0px;\n z-index: 1;\n}");function pSe(e){const a=r(Ga),n=Math.min(...e.domain),i=Math.max(...e.domain),o=e=>100-(e-n)/(i-n)*100;let s;null!=e.reference&&e.reference>=n&&e.reference<=i&&(s=o(e.reference));return t.createElement("div",{className:"mdhui-spark-range-chart",ref:e.innerRef,style:{gridTemplateColumns:Array(e.ranges.length).fill("1fr").join(" ")}},0===e.ranges.length&&null!=e.reference&&t.createElement("svg",{width:"100%",height:40,overflow:"visible"},void 0!==s&&t.createElement("line",{x1:0,y1:s+"%",x2:"100%",y2:s+"%",stroke:"var(--mdhui-background-color-2)",strokeWidth:1,strokeDasharray:3})),e.ranges.length>0&&e.ranges.map(((e,r)=>{const l=Math.max(e.min,n),c=Math.min(e.max,i),u=o(l),d=o(c);let h;if(null!=e.average){const t=Math.min(Math.max(e.average,n),i);h=o(t)}let m=je(a.colorScheme,e.color)??Re(r);return t.createElement("svg",{key:r,width:"100%",height:40,overflow:"visible"},void 0!==s&&t.createElement("line",{x1:0,y1:s+"%",x2:"100%",y2:s+"%",stroke:"var(--mdhui-background-color-2)",strokeWidth:1,strokeDasharray:3}),t.createElement("line",{x1:"calc(50% - 4px)",y1:u+"%",x2:"calc(50% + 4px)",y2:u+"%",stroke:m,strokeWidth:2}),t.createElement("line",{x1:"calc(50% - 4px)",y1:d+"%",x2:"calc(50% + 4px)",y2:d+"%",stroke:m,strokeWidth:2}),t.createElement("line",{x1:"50%",y1:u+"%",x2:"50%",y2:d+"%",stroke:m,strokeWidth:2}),void 0!==h&&t.createElement("circle",{cx:"50%",cy:h+"%",r:4,fill:m}))})))}A(".mdhui-spark-range-chart {\n display: grid;\n column-gap: 4px;\n justify-content: center;\n}");function gSe(e){return t.createElement(S,{innerRef:e.innerRef,onClick:()=>e.onValueChanged(!e.isOn),className:"mdhui-switch"+(e.isOn?" mdhui-switch-on":"")+(e.className?" "+e.className:""),style:{backgroundColor:e.isOn?e.onBackgroundColor:"var(--mdhui-background-color-2)"}},t.createElement("div",{className:"mdhui-switch-circle"}))}A(".mdhui-switch {\n border: 1px solid var(--mdhui-background-color-2);\n border-radius: 20px;\n cursor: pointer;\n display: inline-block;\n height: 30px;\n position: relative;\n vertical-align: middle;\n width: 50px;\n background: --mdhui-background-color-2;\n -webkit-box-sizing: content-box;\n -moz-box-sizing: content-box;\n box-sizing: content-box;\n -webkit-background-clip: content-box;\n background-clip: content-box;\n transition: background-color .5s;\n}\n\n.mdhui-switch.mdhui-switch-on {\n background: var(--mdhui-color-primary);\n}\n\n.mdhui-switch .mdhui-switch-circle {\n background: #fff;\n border-radius: 100%;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);\n height: 30px;\n position: absolute;\n top: 0;\n width: 30px;\n}\n\n.mdhui-switch.mdhui-switch-on .mdhui-switch-circle {\n right: 0;\n}");function fSe(e){var a=r(Ga),n={backgroundColor:a.bodyBackgroundColor};return e.color&&(n={backgroundColor:e.color}),e.color||"dark"!==a.colorScheme||w.setStatusBarStyle("lightContent"),t.createElement("div",{ref:e.innerRef,className:"mdhui-status-bar-background",style:n})}A(".mdhui-status-bar-background {\n position: sticky;\n position: -webkit-sticky;\n left: 0;\n top: 0;\n right: 0;\n height: env(safe-area-inset-top);\n width: 100%;\n z-index: 1;\n background: var(--mdhui-background-color-0);\n}");function ySe(e){var a=["mdhui-tracker-item"];e.onClick&&a.push("selectable"),e.selected?a.push("selected"):a.push("unselected"),e.bordered&&a.push("bordered"),e.className&&a.push(e.className),e.noBoxShadow&&a.push("mdhui-tracker-item-no-box-shadow");var n={borderColor:e.color,color:e.color,backgroundColor:e.color};return e.onClick?t.createElement(S,{className:a.join(" "),style:n,onClick:()=>e.onClick?e.onClick():null},e.text,e.selected&&t.createElement(tS,null),e.badge&&e.selected&&t.createElement("div",{className:"badge"},e.badge)):t.createElement("div",{className:a.join(" "),style:n,onClick:()=>e.onClick?e.onClick():null},e.text,e.selected&&t.createElement(tS,null),e.badge&&e.selected&&t.createElement("div",{className:"badge"},e.badge))}A(".mdhui-tracker-item {\n padding: 8px;\n padding-right: 16px;\n padding-left: 16px;\n color: var(--mdhui-background-color-0);\n border-radius: 32px;\n font-size: .88em;\n display: inline-block;\n margin: 8px;\n position: relative;\n border: solid 1px #000;\n user-select: none;\n line-height: 1.1em;\n}\n\n.mdhui-tracker-item.selectable {\n cursor: pointer;\n}\n\n.mdhui-tracker-item.selected {\n box-shadow: var(--mdhui-box-shadow-1);\n color: #FFF !important;\n background-color: inherit;\n}\n\n.mdhui-tracker-item.unselected {\n background-color: var(--mdhui-background-color-0) !important;\n}\n\n.mdhui-tracker-item .mdhui-shiny-overlay {\n border-radius: 32px;\n}\n\n.mdhui-tracker-item.bordered .mdhui-shiny-overlay {\n left: 1px;\n right: 1px;\n bottom: 1px;\n top: 1px;\n border: solid 2px #FFF;\n}\n\n.mdhui-tracker-item .badge {\n position: absolute;\n right: -4px;\n top: -4px;\n border-radius: 32px;\n padding: 3px;\n background: linear-gradient(to bottom, #555 0%, #888 100%);\n font-weight: bold;\n text-align: center;\n min-width: 10px;\n user-select: none;\n font-size: .62em;\n line-height: 10px;\n}\n\n.mdhui-tracker-item.mdhui-tracker-item-no-box-shadow {\n box-shadow: none;\n}");function vSe(e){const a=r(Ga),n=e.selectedValues??[],i=t=>{e.onChange&&e.onChange(t)};let o={"--mdhui-value-selector-title-color":je(a?.colorScheme,e.titleColor),"--mdhui-value-selector-subtitle-color":je(a?.colorScheme,e.subtitleColor),"--mdhui-value-selector-value-background-color":je(a?.colorScheme,e.valueBackgroundColor),"--mdhui-value-selector-value-text-color":je(a?.colorScheme,e.valueTextColor),"--mdhui-value-selector-button-value-selected-background-color":je(a?.colorScheme,e.selectedButtonBackgroundColor),"--mdhui-value-selector-button-value-selected-text-color":je(a?.colorScheme,e.selectedButtonTextColor),"--mdhui-value-selector-checkbox-color":je(a?.colorScheme,e.checkboxColor),"--mdhui-value-selector-checkbox-selected-color":je(a?.colorScheme,e.selectedCheckboxColor)};return t.createElement("div",{className:"mdhui-value-selector",style:o,ref:e.innerRef},e.title&&t.createElement("div",{className:"mdhui-value-selector-title"},e.title),e.subtitle&&t.createElement("div",{className:"mdhui-value-selector-subtitle"},e.subtitle),t.createElement("div",{className:"mdhui-value-selector-values"},e.values.map(((a,r)=>{let o=["mdhui-value-selector-value"];return n.includes(a)&&o.push("mdhui-value-selector-value-selected"),"checkboxes"===e.variant?o.push("mdhui-value-selector-value-checkbox"):o.push("mdhui-value-selector-value-button"),t.createElement(S,{key:r,onClick:()=>(t=>{n.includes(t)?(n.length>1||!e.preventEmptySelections)&&i(n.filter((e=>e!==t))):e.multiSelect?i([...n,t]):i([t])})(a)},t.createElement("div",{className:o.join(" ")},t.createElement("div",{className:"mdhui-value-selector-value-text"},a),"checkboxes"===e.variant&&n.includes(a)&&t.createElement(gge,{className:"mdhui-value-selector-value-checkbox-icon mdhui-value-selector-value-checkbox-icon-selected",icon:H}),"checkboxes"===e.variant&&!n.includes(a)&&t.createElement(gge,{className:"mdhui-value-selector-value-checkbox-icon",icon:PM})))}))))}A(".mdhui-value-selector {\n --mdhui-value-selector-title-color: var(--mdhui-text-color-1);\n --mdhui-value-selector-subtitle-color: var(--mdhui-text-color-3);\n --mdhui-value-selector-value-background-color: var(--mdhui-background-color-0);\n --mdhui-value-selector-value-text-color: var(--mdhui-text-color-1);\n --mdhui-value-selector-button-value-selected-background-color: var(--mdhui-color-primary);\n --mdhui-value-selector-button-value-selected-text-color: #fff;\n --mdhui-value-selector-checkbox-color: var(--mdhui-text-color-4);\n --mdhui-value-selector-checkbox-selected-color: var(--mdhui-color-primary);\n padding: 16px;\n}\n\n.mdhui-value-selector-title {\n font-weight: bold;\n color: var(--mdhui-value-selector-title-color);\n margin-bottom: 4px;\n}\n\n.mdhui-value-selector-subtitle {\n font-size: 0.75em;\n color: var(--mdhui-value-selector-subtitle-color);\n margin-bottom: 12px;\n}\n\n.mdhui-value-selector-values .mdhui-unstyled-button {\n width: 100%;\n margin: 8px 0;\n}\n\n.mdhui-value-selector-value {\n display: grid;\n grid-template-columns: auto max-content;\n align-items: center;\n height: 40px;\n line-height: 40px;\n border-radius: 6px;\n background: var(--mdhui-value-selector-value-background-color);\n border: 1px solid var(--mdhui-value-selector-value-background-color);\n color: var(--mdhui-value-selector-value-text-color);\n padding: 0 16px;\n font-weight: bold;\n}\n\n.mdhui-value-selector-value:last-child {\n margin-bottom: 0;\n}\n\n.mdhui-value-selector-value-text {\n font-size: 0.85em;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.mdhui-value-selector-value-button {\n text-align: center;\n}\n\n.mdhui-value-selector-value-button.mdhui-value-selector-value-selected {\n background: var(--mdhui-value-selector-button-value-selected-background-color);\n border: 1px solid var(--mdhui-value-selector-button-value-selected-background-color);\n color: var(--mdhui-value-selector-button-value-selected-text-color);\n}\n\n.mdhui-value-selector-value-checkbox {\n padding-right: 0;\n}\n\n.mdhui-value-selector-value-checkbox-icon {\n width: 48px;\n font-size: 0.95em;\n justify-self: center;\n color: var(--mdhui-value-selector-checkbox-color);\n}\n\n.mdhui-value-selector-value-checkbox-icon-selected {\n color: var(--mdhui-value-selector-checkbox-selected-color);\n}\n\n\n");function bSe(e){let a=r(Ga);return e.title||e.subtitle?t.createElement("div",{className:"mdhui-view-header"},t.createElement("div",{className:"mdhui-view-header-text"},e.title&&t.createElement("div",{style:{color:je(a.colorScheme,e.titleColor)},className:"mdhui-view-header-title"},e.title),e.subtitle&&t.createElement("div",{style:{color:je(a.colorScheme,e.subtitleColor)},className:"mdhui-view-header-subtitle"},e.subtitle)),t.createElement("div",{className:"mdhui-view-header-action"},e.action)):null}A(".mdhui-view-header {\n padding: 32px 16px;\n display: grid;\n grid-template-columns: auto max-content;\n align-content: center;\n}\n\n.mdhui-view-header .mdhui-view-header-title {\n font-weight: 700;\n font-size: 2em;\n margin-bottom: 8px;\n color: var(--mdhui-text-color-0);\n}\n\n.mdhui-view-header .mdhui-view-header-subtitle {\n font-weight: 500;\n color: var(--mdhui-text-color-2);\n font-size: 1.2em;\n}");function wSe(e){const a=s(null);l((()=>{if(e.onStartDateChange){var t=nd((function(n){0==a.current?.scrollLeft?(e.onStartDateChange(cn(e.startDate,{weeks:-1})),a.current?.removeEventListener("scroll",t)):a.current?.clientWidth&&a.current?.scrollLeft==2*a.current.clientWidth&&(e.onStartDateChange(cn(e.startDate,{weeks:1})),a.current?.removeEventListener("scroll",t))}),500);return a.current?.addEventListener("scroll",t),()=>{a.current?.removeEventListener("scroll",t)}}}),[e.startDate]);for(var n=[],i=[],r=[],o=cn(e.startDate,{days:-7}),c=0;c<21;c++)c<7?n.push(o):c<14?i.push(o):r.push(o),o=cn(o,{days:1});function u(e){return t.createElement("div",{className:"mdhui-week-calendar-date-label"},t.createElement("div",{className:"mdhui-week-calendar-day-of-week"}," ",rl(e)),t.createElement("div",{className:"mdhui-week-calendar-day-of-month"},bl(tl(e),"d")))}function d(t){var a=["mdhui-week-calendar-day"];return t>new Date?a.push("mdhui-week-calendar-day-future"):e.onDateSelected&&a.push("mdhui-week-calendar-day-selectable"),e.selectedDate&&_i(t).substr(0,10)==_i(e.selectedDate).substr(0,10)&&a.push("mdhui-week-calendar-day-selected"),a}return l((()=>{a.current&&(a.current.scrollLeft=window.innerWidth)})),a.current&&(a.current.scrollLeft=window.innerWidth),t.createElement("div",{ref:e.innerRef},t.createElement("div",{className:"mdhui-week-calendar",ref:a},e.loading&&t.createElement("div",{className:"mdhui-week-calendar-loading"},t.createElement(XA,null)),t.createElement("div",{className:"mdhui-week-calendar-week"},n.map((a=>t.createElement("div",{key:a.getTime(),className:"mdhui-week-calendar-day"},e.dayRenderer(a.getFullYear(),a.getMonth(),a.getDate(),!1),!e.hideDateLabel&&u(a))))),t.createElement("div",{className:"mdhui-week-calendar-week"},i.map((a=>t.createElement(S,{key:a.getTime(),className:d(a).join(" "),onClick:()=>function(t){t>new Date||e.onDateSelected&&e.onDateSelected(t)}(a)},e.dayRenderer(a.getFullYear(),a.getMonth(),a.getDate(),!0),!e.hideDateLabel&&u(a))))),cn(e.startDate,{days:7})<new Date&&t.createElement("div",{className:"mdhui-week-calendar-week"},r.map((a=>t.createElement("div",{key:a.getTime(),className:d(a).join(" ")},e.dayRenderer(a.getFullYear(),a.getMonth(),a.getDate(),!1),!e.hideDateLabel&&u(a)))))))}A(".mdhui-week-calendar {\n background: var(--mdhui-background-color-0);\n overflow-x: scroll;\n overflow-y: hidden;\n z-index: 0;\n position: relative;\n display: flex;\n scroll-snap-type: x mandatory;\n scrollbar-width: none;\n border-top: solid 1px var(--mdhui-border-color-1);\n border-bottom: solid 1px var(--mdhui-border-color-1);\n}\n\n.mdhui-week-calendar .mdhui-week-calendar-loading {\n position: absolute;\n width: 100%;\n left: 100%;\n top: calc(50% - 10px);\n}\n\n.mdhui-week-calendar * {\n user-select: none;\n}\n\n.mdhui-week-calendar::-webkit-scrollbar {\n display: none;\n /* Safari and Chrome */\n}\n\n.mdhui-week-calendar .mdhui-week-calendar-week {\n min-width: 100%;\n scroll-snap-align: start;\n display:flex;\n}\n\n.mdhui-week-calendar .mdhui-week-calendar-day {\n border-left: solid 1px var(--mdhui-border-color-1);\n overflow: hidden;\n position: relative;\n display: inline-block;\n vertical-align: top;\n flex: 1;\n}\n\n.mdhui-week-calendar .mdhui-week-calendar-day:first-child {\n width: 14.28%;\n border-left: none;\n}\n\n.mdhui-week-calendar .mdhui-week-calendar-date-label {\n padding-top: 4px;\n line-height: 16px;\n padding-bottom: 8px;\n text-align: center;\n}\n\n.mdhui-week-calendar .mdhui-week-calendar-date-label .mdhui-week-calendar-day-of-week {\n font-size: 10px;\n}\n\n.mdhui-week-calendar .mdhui-week-calendar-date-label .mdhui-week-calendar-day-of-month {\n font-size: 14px;\n display: inline-block;\n text-align: center;\n width: 24px;\n height: 24px;\n border-radius: 24px;\n line-height: 24px;\n margin-top: 2px;\n margin-bottom: 2px;\n}\n\n.mdhui-week-calendar .mdhui-week-calendar-day-selectable {\n cursor: pointer;\n}\n\n.mdhui-week-calendar .mdhui-week-calendar-day-selected {\n background: var(--mdhui-background-color-1);\n}\n\n.mdhui-week-calendar .mdhui-week-calendar-day-selected .mdhui-week-calendar-date-label .mdhui-week-calendar-day-of-month {\n background-color: var(--mdhui-color-primary);\n color: #FFF;\n font-weight: bold;\n}\n\n.mdhui-week-calendar .mdhui-week-calendar-day-future>* {\n opacity: .4;\n}");function xSe(e){return t.createElement("div",{className:"mdhui-inbox-completed-list-item",ref:e.innerRef},e.onClick&&t.createElement(Za,{title:e.name,subtitle:e.status,onClick:()=>e.onClick()}),!e.onClick&&t.createElement(aS,null,t.createElement("div",{className:"mdhui-inbox-completed-list-item-name"},e.name),t.createElement("div",{className:"mdhui-inbox-completed-list-item-status"},e.status)))}A(".mdhui-inbox-completed-list-item {\n background: var(--mdhui-background-color-0);\n border-radius: 12px;\n margin: 12px 16px;\n}\n\n.mdhui-inbox-completed-list-item .mdhui-action, .mdhui-inbox-completed-list-item .mdhui-card {\n border-radius: 12px;\n padding: 16px;\n margin: 12px 0;\n box-shadow: var(--mdhui-box-shadow-0);\n}\n\n.mdhui-inbox-completed-list-item .mdhui-action .title, .mdhui-inbox-completed-list-item-name {\n font-weight: bold;\n font-size: 1.05em;\n}\n\n.mdhui-inbox-completed-list-item .mdhui-action .subtitle, .mdhui-inbox-completed-list-item-status {\n color: var(--mdhui-text-color-2);\n font-size: 0.7em;\n margin-top: 4px;\n}");function kSe(e){return"incomplete"===e.message.status?t.createElement("div",{className:"mdhui-inbox-message-list-item",ref:e.innerRef},t.createElement(Za,{title:e.message.title,onClick:()=>e.onClick()})):"complete"===e.message.status?t.createElement(xSe,{name:e.message.title,status:no("inbox-message-completed-status"),onClick:()=>e.onClick(),innerRef:e.innerRef}):null}function ASe(e){return"incomplete"===e.resource.status?t.createElement("div",{className:"mdhui-inbox-resource-list-item",ref:e.innerRef},t.createElement(aSe,{imageUrl:e.resource.imageUrl,title:e.resource.title,subTitle:e.resource.subTitle,imageAlignment:e.imageAlignment,buttonVariant:e.buttonVariant,buttonText:e.buttonText,onClick:()=>e.onClick()})):"complete"===e.resource.status?t.createElement(xSe,{name:e.resource.title,status:no("inbox-resource-completed-status"),onClick:()=>e.onClick(),innerRef:e.innerRef}):null}A(".mdhui-inbox-message-list-item {\n background: var(--mdhui-background-color-0);\n border-radius: 12px;\n margin: 12px 16px;\n box-shadow: var(--mdhui-box-shadow-0);\n}\n\n.mdhui-inbox-message-list-item .mdhui-action .title {\n font-size: 1.05em;\n}\n");function SSe(e){return"incomplete"===e.survey.status?t.createElement("div",{className:"mdhui-inbox-survey-list-item",ref:e.innerRef},t.createElement(hSe,{task:{surveyName:e.survey.name,surveyDisplayName:e.survey.displayName??e.survey.name,surveyDescription:e.survey.description,endDate:e.survey.endDate,status:e.survey.status,hasSavedProgress:e.survey.hasRestorationData,dueDate:e.survey.dueDate},variant:e.variant,surveyActive:e.surveyActive,onClick:()=>e.onClick()})):"complete"===e.survey.status?t.createElement(xSe,{name:e.survey.name,status:no("inbox-survey-completed-status"),innerRef:e.innerRef}):null}A(".mdhui-inbox-survey-list-item {\n background: var(--mdhui-background-color-0);\n border-radius: 12px;\n margin: 12px 16px;\n box-shadow: var(--mdhui-box-shadow-0);\n}");class ESe{constructor(e){this.participantInfo=e}getId(){return this.participantInfo.participantID}getFirstName(){return this.participantInfo.demographics.firstName}hasPairedDevice(){return"Yes"===this.getCustomFieldValue("DevicePaired")}hasEstablishedBaseline(){return this.hasEstablishedBaselineByType("DaytimeRestingHeartRateBaseline")||this.hasEstablishedBaselineByType("NighttimeRestingHeartRateBaseline")||this.hasEstablishedBaselineByType("RespiratoryRateBaseline")||this.hasEstablishedBaselineByType("StepsBaseline")||this.hasEstablishedBaselineByType("SleepDisturbancesBaseline")||this.hasEstablishedBaselineByType("DaytimeBloodOxygenLevelBaseline")||this.hasEstablishedBaselineByType("NighttimeBloodOxygenLevelBaseline")}getHomeAirQualityZipCode(){return this.getCustomFieldValue("HomePostalCode")}getWorkAirQualityZipCode(){return this.getCustomFieldValue("WorkPostalCode")}getActionPlanTaskRunUUID(){return this.getCustomFieldValue("AAPTaskRunUUID")}getAlertTakeover(){return this.getCustomFieldValue("AlertTakeover")}getParticipantMode(){return this.getCustomFieldValue("ParticipantMode")??"Self"}getCareRecipientName(){return this.getCustomFieldValue("CareRecipientName")}getDaytimeRestingHeartRateBaseline(){return this.getBaseline("DaytimeRestingHeartRateBaseline")}getNighttimeRestingHeartRateBaseline(){return this.getBaseline("NighttimeRestingHeartRateBaseline")}getRespiratoryRateBaseline(){return this.getBaseline("RespiratoryRateBaseline")}getStepsBaseline(){return this.getBaseline("StepsBaseline")}getSleepDisturbancesBaseline(){return this.getBaseline("SleepDisturbancesBaseline")}getDaytimeBloodOxygenLevelBaseline(){return this.getBaseline("DaytimeBloodOxygenLevelBaseline")}getNighttimeBloodOxygenLevelBaseline(){return this.getBaseline("NighttimeBloodOxygenLevelBaseline")}hasEstablishedBaselineByType(e){return this.getCustomFieldValue(e).trim().length>0}getBaseline(e){let t=this.getCustomFieldValue(e);if(t&&t.trim().length>0)return Number(t.trim())}getCustomFieldValue(e){let t=this.participantInfo.customFields;return t.hasOwnProperty(e)?t[e]??"":""}}const _Se=e=>_i(e,{representation:"date"}),CSe=(e,t)=>{let a=_Se(t),n=e.find((e=>e.identifier===a));if(n){let a,n=(e=>{let t=[];for(let a=0;a<7;a++)t.push(cn(new Date(e),{days:-a}));return t})(t),i=((e,t)=>{let a=t.map(_Se);return e.filter((e=>a.includes(e.identifier)))})(e,n),r=i.reduce(((e,t)=>e+("none"!==t.symptomLevel?1:0)),0),o=i.reduce(((e,t)=>e+(t.impacts.includes("Wake up at night")?1:0)),0),s=i.reduce(((e,t)=>e+(t.impacts.includes("Limit your daily activity")?1:0)),0),l=i.reduce(((e,t)=>e+(t.impacts.includes("Use your rescue inhaler")?1:0)),0),c=i.length;return a=o>0||s>0||l>=3||r>=3?"not-controlled":c>=1&&0==o&&0==s&&0==l&&0==r||c>=3&&c-r>=2?"controlled":"not-determined",{status:a,symptomDaysPast7:r,nighttimeAwakeningDaysPast7:o,limitedActivityDaysPast7:s,inhalerUseDaysPast7:l}}return{status:"no-data"}},TSe=e=>"out-of-range"===e?no("asthma-data-status-out-of-range"):"in-range"===e?no("asthma-data-status-in-range"):"offline"===e?no("asthma-data-status-offline"):"establishing"===e?no("asthma-data-status-establishing"):"not-determined"===e?no("asthma-data-status-not-determined"):"not-found"===e?no("asthma-data-status-not-found"):"not-configured"===e?no("asthma-data-status-not-configured"):"",PSe=e=>"out-of-range"===e?"#9D5BED":"in-range"===e?"#188A83":"offline"===e?"var(--mdhui-color-warning)":"var(--mdhui-text-color-3)",OSe=e=>no("mild"===e?"asthma-symptom-level-mild":"moderate"===e?"asthma-symptom-level-moderate":"severe"===e?"asthma-symptom-level-severe":"asthma-symptom-level-none"),MSe=e=>e===no("asthma-symptom-level-mild")?"mild":e===no("asthma-symptom-level-moderate")?"moderate":e===no("asthma-symptom-level-severe")?"severe":"none",DSe=e=>e?e.map((e=>"Difficulty breathing"===e?no("asthma-symptom-difficulty-breathing"):"Wheezing"===e?no("asthma-symptom-wheezing"):"Coughing"===e?no("asthma-symptom-coughing"):"Chest tightness or pressure"===e?no("asthma-symptom-chest-tightness"):e)):[],ISe=e=>e.map((e=>e===no("asthma-symptom-difficulty-breathing")?"Difficulty breathing":e===no("asthma-symptom-wheezing")?"Wheezing":e===no("asthma-symptom-coughing")?"Coughing":e===no("asthma-symptom-chest-tightness")?"Chest tightness or pressure":e)),NSe=e=>e?e.map((e=>"Wake up at night"===e?no("asthma-impact-waking-at-night"):"Limit your daily activity"===e?no("asthma-impact-limit-daily-activity"):"Use your rescue inhaler"===e?no("asthma-impact-using-rescue-inhaler"):e)):[],jSe=e=>e.map((e=>e===no("asthma-impact-waking-at-night")?"Wake up at night":e===no("asthma-impact-limit-daily-activity")?"Limit your daily activity":e===no("asthma-impact-using-rescue-inhaler")?"Use your rescue inhaler":e)),zSe=e=>e?e.map((e=>"Cold/viral illness"===e?no("asthma-trigger-cold-illness"):"Animal exposure"===e?no("asthma-trigger-animal-exposure"):"Seasonal allergens/pollen"===e?no("asthma-trigger-seasonal-allergens"):"Exercise"===e?no("asthma-trigger-exercise"):"Smoke (tobacco or wood burning)"===e?no("asthma-trigger-smoke"):"Extreme weather changes"===e?no("asthma-trigger-weather-changes"):"Air pollution"===e?no("asthma-trigger-air-pollution"):"Strong smells"===e?no("asthma-trigger-strong-smells"):"Chemicals/cleaning supplies"===e?no("asthma-trigger-chemicals"):"Dust"===e?no("asthma-trigger-dust"):"Mold"===e?no("asthma-trigger-mold"):"Dust mites"===e?no("asthma-trigger-dust-mites"):"Rodents"===e?no("asthma-trigger-rodents"):"Cockroaches"===e?no("asthma-trigger-cockroaches"):"Taken a NSAID (non-steroidal anti-inflammatory drugs including aspirin and ibuprofen)"===e?no("asthma-trigger-nsaid"):"Taken a beta blocker"===e?no("asthma-trigger-beta-blocker"):"Had heartburn"===e?no("asthma-trigger-heartburn"):"Drank red wine"===e?no("asthma-trigger-red-wine"):"Tried any new foods"===e?no("asthma-trigger-new-foods"):"Cooked without a fan or open window"===e?no("asthma-trigger-cooked-without-ventilation"):"Had a pet sleep in your bed"===e?no("asthma-trigger-pet-in-bed"):"Burned incense or a candle"===e?no("asthma-trigger-incense-or-candle"):e)):[],RSe=e=>e.map((e=>e===no("asthma-trigger-cold-illness")?"Cold/viral illness":e===no("asthma-trigger-animal-exposure")?"Animal exposure":e===no("asthma-trigger-seasonal-allergens")?"Seasonal allergens/pollen":e===no("asthma-trigger-exercise")?"Exercise":e===no("asthma-trigger-smoke")?"Smoke (tobacco or wood burning)":e===no("asthma-trigger-weather-changes")?"Extreme weather changes":e===no("asthma-trigger-air-pollution")?"Air pollution":e===no("asthma-trigger-strong-smells")?"Strong smells":e===no("asthma-trigger-chemicals")?"Chemicals/cleaning supplies":e===no("asthma-trigger-dust")?"Dust":e===no("asthma-trigger-mold")?"Mold":e===no("asthma-trigger-dust-mites")?"Dust mites":e===no("asthma-trigger-rodents")?"Rodents":e===no("asthma-trigger-cockroaches")?"Cockroaches":e===no("asthma-trigger-nsaid")?"Taken a NSAID (non-steroidal anti-inflammatory drugs including aspirin and ibuprofen)":e===no("asthma-trigger-beta-blocker")?"Taken a beta blocker":e===no("asthma-trigger-heartburn")?"Had heartburn":e===no("asthma-trigger-red-wine")?"Drank red wine":e===no("asthma-trigger-new-foods")?"Tried any new foods":e===no("asthma-trigger-cooked-without-ventilation")?"Cooked without a fan or open window":e===no("asthma-trigger-pet-in-bed")?"Had a pet sleep in your bed":e===no("asthma-trigger-incense-or-candle")?"Burned incense or a candle":e)),LSe=e=>"unhealthy"===e?no("asthma-air-quality-description-unhealthy"):"very unhealthy"===e?no("asthma-air-quality-description-very-unhealthy"):"hazardous"===e?no("asthma-air-quality-description-hazardous"):e,FSe=(e,t)=>t<=1.2*e,BSe=(e,t)=>t<=1.15*e,HSe=(e,t)=>t<=1.15*e,qSe=(e,t)=>t>=e/2,USe=(e,t)=>t<=e+3.5,VSe=(e,t)=>{let a=100*t;return a>=95||a>=100*e-4},WSe=async(e,t,a)=>{const n=await Il({namespace:"Project",type:e,observedAfter:cn(t,{days:-1}).toISOString(),observedBefore:cn(a,{days:1}).toISOString()});let i={},r={};return n.forEach((e=>{if(!e.observationDate)return;let t=Tr(e.observationDate),a=Br(t);i[a]&&!Ci(t,r[a])||(i[a]=parseFloat(e.value),r[a]=t)})),i};var $Se;!function(e){e.Steps="Asthma.Steps",e.DaytimeRestingHeartRate="Asthma.DaytimeRestingHeartRate",e.NighttimeRestingHeartRate="Asthma.NighttimeRestingHeartRate",e.RespiratoryRate="Asthma.RespiratoryRate",e.DaytimeBloodOxygenLevel="Asthma.DaytimeBloodOxygenLevel",e.NighttimeBloodOxygenLevel="Asthma.NighttimeBloodOxygenLevel",e.SleepDisturbances="Asthma.SleepDisturbances"}($Se||($Se={})),Yc($Se.Steps,(function(e,t){return WSe("Steps",e,t)}),Oc("Project",["Steps"])),Yc($Se.DaytimeRestingHeartRate,(function(e,t){return WSe("DaytimeRestingHeartRate",e,t)}),Oc("Project",["DaytimeRestingHeartRate"])),Yc($Se.NighttimeRestingHeartRate,(function(e,t){return WSe("NighttimeRestingHeartRate",e,t)}),Oc("Project",["NighttimeRestingHeartRate"])),Yc($Se.RespiratoryRate,(function(e,t){return WSe("RespiratoryRate",e,t)}),Oc("Project",["RespiratoryRate"])),Yc($Se.DaytimeBloodOxygenLevel,(function(e,t){return WSe("DaytimeBloodOxygenLevel",e,t)}),Oc("Project",["DaytimeBloodOxygenLevel"])),Yc($Se.NighttimeBloodOxygenLevel,(function(e,t){return WSe("NighttimeBloodOxygenLevel",e,t)}),Oc("Project",["NighttimeBloodOxygenLevel"])),Yc($Se.SleepDisturbances,(function(e,t){return WSe("SleepDisturbances",e,t)}),Oc("Project",["SleepDisturbances"]));const GSe={"daytime-resting-heart-rate":"DaytimeRestingHeartRate","nighttime-resting-heart-rate":"NighttimeRestingHeartRate","respiratory-rate":"RespiratoryRate",steps:"Steps","sleep-disturbances":"SleepDisturbances","daytime-blood-oxygen-level":"DaytimeBloodOxygenLevel","nighttime-blood-oxygen-level":"NighttimeBloodOxygenLevel"},KSe={home:"HomeAirQuality",work:"WorkAirQuality"},ZSe=(e,t)=>kn(Tr(e.observationDate),Tr(t.observationDate)),YSe=e=>{let t=parseFloat(e.value);return isNaN(t)?-1:t},XSe=(e,t,a,n)=>{let i=vn(e),r=cn(i,{days:n}),o=cn(i,{days:n+1}),s=t.filter((e=>{if(e.type!==a)return!1;let t=Tr(e.observationDate);return!Ti(t,r)&&!Ci(t,o)}));if(s.length>0)return YSe(s.sort(ZSe)[0])},QSe=(e,t)=>{let a={namespace:"Project",type:["DaytimeRestingHeartRate","DaytimeRestingHeartRateBaseline","NighttimeRestingHeartRate","NighttimeRestingHeartRateBaseline","RespiratoryRate","RespiratoryRateBaseline","Steps","StepsBaseline","SleepDisturbances","SleepDisturbancesBaseline","DaytimeBloodOxygenLevel","DaytimeBloodOxygenLevelBaseline","NighttimeBloodOxygenLevel","NighttimeBloodOxygenLevelBaseline"],observedAfter:e.toISOString(),observedBefore:t.toISOString()};return w.queryDeviceData(a)},JSe=(e,t,a,n)=>t?a?e(t,a)?"in-range":"out-of-range":"offline":a?n.withValue:n.withoutValue,eEe=(e,t,a,n,i,r)=>{let o=XSe(t,a,GSe[e]+"Baseline",n-1),s=XSe(t,a,GSe[e],n);return{type:e,status:JSe(i,o,s,r),value:s}},tEe=(e,t,a,n)=>eEe("daytime-resting-heart-rate",e,t,a,FSe,n),aEe=(e,t,a,n)=>eEe("nighttime-resting-heart-rate",e,t,a,BSe,n),nEe=(e,t,a,n)=>eEe("respiratory-rate",e,t,a,HSe,n),iEe=(e,t,a,n)=>eEe("steps",e,t,a,qSe,n),rEe=(e,t,a,n)=>eEe("steps",e,t,a,((t,a)=>_r(e)&&(new Date).getHours()<19||qSe(t,a)),n),oEe=(e,t,a,n)=>eEe("sleep-disturbances",e,t,a,USe,n),sEe=(e,t,a,n)=>eEe("daytime-blood-oxygen-level",e,t,a,VSe,n),lEe=(e,t,a,n)=>eEe("nighttime-blood-oxygen-level",e,t,a,VSe,n),cEe=(e,t,a)=>{let n={namespace:"AirNowApi",type:["HomeAirQuality","WorkAirQuality"],observedAfter:e.toISOString()};return t&&(n.observedBefore=t.toISOString()),a&&(n.pageID=a),w.queryDeviceData(n)},uEe=(e,t,a,n)=>{let i,r=t.filter((t=>t.type===KSe[e]));r.length>0&&(i=a(r));let[o,s]=((e,t)=>{if(e){if(e<=100)return["in-range",void 0];if(e<=200)return["out-of-range","unhealthy"];if(e<=300)return["out-of-range","very unhealthy"];if(e<=500)return["out-of-range","hazardous"]}return[t,void 0]})(i,n);return{type:e,status:o,value:i,description:s}},dEe={loadParticipant:async function(){let e=await w.getParticipantInfo();return new ESe(e)},loadDeviceInfo:()=>w.getDeviceInfo(),loadLogEntries:async function(e,t){let a={namespace:"Project",type:["Asthma-LogEntry"]};return e&&(a.observedAfter=e.toISOString()),t&&(a.observedBefore=t.toISOString()),(await w.queryDeviceData(a)).deviceDataPoints.map((e=>JSON.parse(e.value)))},loadBiometricsForControlStatus:async function(){let e=new Date;return((e,t)=>{const a={withValue:"establishing",withoutValue:"establishing"};return[tEe(e,t,-1,a),aEe(e,t,0,a),nEe(e,t,0,a),iEe(e,t,-1,a),oEe(e,t,0,a),sEe(e,t,-1,a),lEe(e,t,0,a)]})(e,(await QSe(cn(vn(e),{days:-2}),Pn(e))).deviceDataPoints)},loadBiometricsForDate:async function(e){return((e,t)=>{const a={withValue:"not-determined",withoutValue:"not-found"};return[tEe(e,t,0,a),aEe(e,t,0,a),nEe(e,t,0,a),rEe(e,t,0,a),oEe(e,t,0,a),sEe(e,t,0,a),lEe(e,t,0,a)]})(e,(await QSe(cn(vn(e),{days:-1}),Pn(e))).deviceDataPoints)},loadAirQualitiesForControlStatus:async function(e,t){let a=await cEe(cn(new Date,{hours:-12}),Pn(Date.now(),n));var n;const i=e=>YSe(e.sort(ZSe)[0]);return[e?uEe("home",a.deviceDataPoints,i,"establishing"):{type:"home",status:"not-configured"},t?uEe("work",a.deviceDataPoints,i,"establishing"):{type:"work",status:"not-configured"}]},loadAirQualitiesForDate:async function(e){let t=await cEe(vn(e),Pn(e));const a=e=>{let t=0;return e.forEach((e=>{let a=YSe(e);a>t&&(t=a)})),t};return[uEe("home",t.deviceDataPoints,a,"not-found"),uEe("work",t.deviceDataPoints,a,"not-found")]},loadAirQualityDataPoints:async function(e){let t=[],a=await cEe(e);for(t=t.concat(a.deviceDataPoints);a.nextPageID;)a=await cEe(e,void 0,a.nextPageID),t=t.concat(a.deviceDataPoints);return t},saveLogEntry:function(e){let t={type:"Asthma-LogEntry",identifier:e.identifier,observationDate:`${e.identifier}T12:00:00-06:00`,value:JSON.stringify(e)};return w.persistDeviceData([t])},loadAlertTakeover:async function(){let e={namespace:"Project",type:["AlertTakeover"],observedAfter:Rr().toISOString()},t=(await w.queryDeviceData(e)).deviceDataPoints;if(0===t.length)return;let a=t.sort(ZSe)[0];return a.properties?.hasOwnProperty("viewed")||a.properties?.hasOwnProperty("cleared")?void 0:a},updateAlertTakeover:(e,t,a)=>(e.properties=e.properties??{},e.properties[t]=_i(new Date),a&&(e.properties.comment=a),w.persistDeviceData([e])),loadSurveyAnswers:function(e,t){let a={surveyName:e};return t&&(a.insertedAfter=_i(t)),hu(a)},checkSurveyAnswerExists:function(e){let t={surveyName:e,limit:1};return w.querySurveyAnswers(t).then((e=>!!e.surveyAnswers.length))},loadAsthmaActionPlan:async function(){let e=await w.invokeCustomApi("Asthma.ActionPlan","GET","",!0);return e?{id:e.Id,url:`data:image/jpeg;base64,${e.Content}`}:void 0}};function hEe(e,t){if("Caregiver"===e.getParticipantMode()){let a=e.getCareRecipientName();if(a)return no(t+"-caregiver",void 0,{name:a})}return no(t)}const mEe={createDataService:e=>({loadDeviceInfo:()=>Promise.resolve({}),loadParticipant:()=>Promise.resolve({getActionPlanTaskRunUUID:()=>e.includes("loading")||e.includes("loaded with action plan")?"SomeTaskRunUUID":void 0,getParticipantMode:()=>e.includes("(caregiver mode)")?"Caregiver":"Self",getCareRecipientName:()=>e.includes("(caregiver mode)")?"Leroy":void 0}),loadAsthmaActionPlan:()=>e.includes("loading")?new Promise((()=>lM)):Promise.resolve({url:"https://asthma.careevolutionapps.dev/images/sample_aap.png"})})};function pEe(e){const[a,n]=c(!0),[i,r]=c(),[o,s]=c(),[u,d]=c(),h=(e,t=0)=>{e.loadParticipant().then((a=>{s(a),a.getActionPlanTaskRunUUID()?e.loadAsthmaActionPlan().then((a=>{d(a),a||t>=5?n(!1):setTimeout((()=>h(e,t+1)),2e3)})):(d(void 0),n(!1))}))};l((()=>{n(!0);const t=e.previewState?mEe.createDataService(e.previewState):dEe;return t.loadDeviceInfo().then((e=>{r(e)})),h(t),w.on("surveyDidFinish",(()=>h(t))),()=>{w.off("surveyDidFinish",(()=>h(t)))}}),[e.previewState]);return t.createElement("div",{className:"mdhui-asthma-action-plan-manager"},t.createElement(sM,{order:2,className:"mdhui-asthma-action-plan-manager-title"},no("asthma-action-plan-manager-title")),o&&t.createElement("div",{className:"mdhui-asthma-action-plan-manager-instructions"},hEe(o,"asthma-action-plan-manager-instructions")),t.createElement(S,{className:"mdhui-asthma-action-plan-manager-learn-more",onClick:()=>{e.previewState||w.openApplication(e.learnMoreUrl,{modal:!0})}},no("asthma-action-plan-manager-learn-more")),a&&t.createElement(XA,null),!a&&u&&t.createElement("div",null,t.createElement(S,{className:"mdhui-asthma-action-plan-manager-thumbnail-wrapper",onClick:()=>(()=>{if(e.previewState)return;let t=`Authenticated/ReportViewer/ServeReport.ashx?reportId=${u.id}`;i&&["Android","iOS"].includes(i.platform)?window.webkit.messageHandlers.OpenFile.postMessage({url:t}):w.openExternalUrl("/"+t)})()},t.createElement("img",{className:"mdhui-asthma-action-plan-manager-thumbnail",alt:"thumbnail",src:u.url})),t.createElement("div",{className:"mdhui-asthma-action-plan-manager-button-panel"},t.createElement(QA,{onClick:()=>{e.previewState||(w.startSurvey(e.editActionPlanSurveyName),n(!0))}},no("asthma-action-plan-manager-edit-button-text")))),!a&&!u&&t.createElement(S,{className:"mdhui-asthma-action-plan-manager-not-found",onClick:()=>{e.previewState||(w.startSurvey(e.editActionPlanSurveyName),n(!0))}},t.createElement("div",{className:"mdhui-asthma-action-plan-manager-not-found-text"},no("asthma-action-plan-manager-not-found-text"))))}A(".mdhui-asthma-air-qualities {\n padding: 16px;\n}\n\n.mdhui-asthma-air-qualities-header {\n display: grid;\n grid-template-columns: auto max-content;\n}\n\n.mdhui-asthma-air-qualities-title {\n margin-bottom: 16px;\n}\n\n.mdhui-asthma-air-qualities-settings {\n width: 48px;\n height: 32px;\n text-align: right;\n line-height: 32px;\n font-size: 20px;\n color: var(--mdhui-color-primary);\n margin-bottom: 16px;\n}\n\n.mdhui-asthma-air-qualities-data {\n display: grid;\n grid-template-columns: 1fr 1fr;\n align-items: center;\n grid-column-gap: 16px;\n grid-row-gap: 16px;\n}\n\n.mdhui-asthma-air-qualities-setup {\n display: grid;\n grid-template-columns: 1fr;\n align-items: center;\n padding: 16px;\n border-radius: 6px;\n border: 1px solid var(--mdhui-border-color-1);\n background: var(--mdhui-background-color-0);\n min-height: 60px;\n}\n\n.mdhui-asthma-air-qualities-setup-button {\n font-size: 1.3em;\n color: var(--mdhui-color-primary);\n}\n\n.mdhui-asthma-air-qualities-setup-label {\n font-size: 0.7em;\n font-weight: bold;\n}\n");const gEe={"neither configured":{homeAirQuality:{type:"home",status:"not-configured"},workAirQuality:{type:"work",status:"not-configured"}},"one configured":{homeAirQuality:{type:"home",status:"not-configured"},workAirQuality:{type:"work",status:"establishing"}},"no data (control)":{homeAirQuality:{type:"home",status:"establishing"},workAirQuality:{type:"work",status:"establishing"}},"no data (date)":{homeAirQuality:{type:"home",status:"not-found"},workAirQuality:{type:"work",status:"not-found"}},"some data (control)":{homeAirQuality:{type:"home",status:"in-range",value:32},workAirQuality:{type:"work",status:"establishing"}},"some data (date)":{homeAirQuality:{type:"home",status:"in-range",value:32},workAirQuality:{type:"work",status:"not-found"}},"all data":{homeAirQuality:{type:"home",status:"in-range",value:32},workAirQuality:{type:"work",status:"out-of-range",value:130,description:"unhealthy"}}};function fEe(e){const[a,n]=c(!0);let[i,r]=c(),[o,s]=c();id((()=>{if(n(!0),"loading"!==e.previewState)return e.previewState?(r(gEe[e.previewState].homeAirQuality),s(gEe[e.previewState].workAirQuality),void n(!1)):void dEe.loadParticipant().then((t=>{(e.date?dEe.loadAirQualitiesForDate(e.date):dEe.loadAirQualitiesForControlStatus(t.getHomeAirQualityZipCode(),t.getWorkAirQualityZipCode())).then((e=>{r(e.find((e=>"home"===e.type))),s(e.find((e=>"work"===e.type))),n(!1)}))}))}),[],[e.previewState]);const l=()=>{!e.previewState&&e.editZipCodesSurveyName&&w.startSurvey(e.editZipCodesSurveyName)},u=e=>t.createElement(S,{onClick:()=>l()},t.createElement("div",{className:"mdhui-asthma-air-qualities-setup"},t.createElement("div",{className:"mdhui-asthma-air-qualities-setup-button"},no("asthma-air-qualities-setup-button-text")),t.createElement("div",{className:"mdhui-asthma-air-qualities-setup-label"},e))),d=t=>{e.previewState||("not-configured"===t.status&&e.editZipCodesSurveyName?w.startSurvey(e.editZipCodesSurveyName):w.openApplication(e.airQualityUrl,{modal:!0}))};return t.createElement("div",{className:"mdhui-asthma-air-qualities",ref:e.innerRef},t.createElement("div",{className:"mdhui-asthma-air-qualities-header"},t.createElement(sM,{order:2,className:"mdhui-asthma-air-qualities-title"},no("asthma-air-qualities-title")),e.editZipCodesSurveyName&&t.createElement(S,{className:"mdhui-asthma-air-qualities-settings",onClick:()=>l()},t.createElement(gge,{icon:le}))),a&&t.createElement(XA,null),!a&&t.createElement("div",{className:"mdhui-asthma-air-qualities-data"},"not-configured"===i.status&&u(no("asthma-air-qualities-home-aqi-label")),"not-configured"!==i.status&&t.createElement(lSe,{label:no("asthma-air-qualities-home-aqi-label"),statusText:LSe(i.description)??TSe(i.status),statusColor:PSe(i.status),value:wl(i.value),onClick:()=>d(i)}),"not-configured"===o.status&&u(no("asthma-air-qualities-work-aqi-label")),"not-configured"!==o.status&&t.createElement(lSe,{label:no("asthma-air-qualities-work-aqi-label"),statusText:LSe(o.description)??TSe(o.status),statusColor:PSe(o.status),value:wl(o.value),onClick:()=>d(o)})))}function yEe(e){const[a,n]=c(!0);id((()=>{n(!0),e.previewState?n("loading"===e.previewState):dEe.loadLogEntries(cn(new Date,{days:-2})).then((e=>{let t=_Se(new Date),a=e.find((e=>e.identifier===t));a?w.dismiss():n(!1)}))}),[],[e.previewState]);return t.createElement("div",{className:"mdhui-asthma-alert-takeover-notice",ref:e.innerRef},t.createElement("div",{className:"mdhui-asthma-alert-takeover-notice-message"},e.message),t.createElement("div",{className:"mdhui-asthma-alert-takeover-notice-instructions"},no("asthma-alert-takeover-notice-instructions")),t.createElement("div",{className:"mdhui-asthma-alert-takeover-notice-buttons"},a&&t.createElement(XA,null),!a&&t.createElement("div",null,t.createElement(QA,{className:"mdhui-asthma-alert-takeover-notice-button",onClick:()=>{e.previewState||(n(!0),w.startSurvey(e.logEntrySurveyName))}},no("asthma-alert-takeover-notice-add-entry-button-text")),t.createElement(QA,{className:"mdhui-asthma-alert-takeover-notice-button",variant:"light",onClick:()=>{e.previewState||w.dismiss()}},no("asthma-alert-takeover-notice-not-now-button-text")))))}function vEe(e){return id((()=>{e.previewState||dEe.loadParticipant().then((t=>{dEe.loadAlertTakeover().then((a=>{a&&(t.getAlertTakeover()?dEe.loadLogEntries(cn(new Date,{days:-2})).then((t=>{let n=_Se(new Date);t.find((e=>e.identifier===n))?dEe.updateAlertTakeover(a,"cleared","The user has already logged today.").then():dEe.updateAlertTakeover(a,"viewed").then((()=>{var t;"DaytimeRestingHeartRate"===(t=a.value)||"NighttimeRestingHeartRate"===t||"RespiratoryRate"===t||"DaytimeBloodOxygenLevel"===t||"NighttimeBloodOxygenLevel"===t?w.openApplication(e.heartAndLungsUrl+"?alert="+t,{modal:!0}):"Steps"===t?w.openApplication(e.activityUrl+"?alert="+t,{modal:!0}):"SleepDisturbances"===t?w.openApplication(e.sleepUrl+"?alert="+t,{modal:!0}):"HomeAirQuality"===t||"WorkAirQuality"===t?w.openApplication(e.airQualityUrl+"?alert="+t,{modal:!0}):t.includes(",")&&w.openApplication(e.alertTakeoverUrl,{modal:!0})}))})):dEe.updateAlertTakeover(a,"cleared","The alert is no longer valid.").then())}))}))})),null}A(".mdhui-asthma-alert-takeover-notice {\n padding: 16px;\n text-align: center;\n}\n\n.mdhui-asthma-alert-takeover-notice-message {\n font-size: 1.6em;\n font-weight: bold;\n margin: 16px 0;\n}\n\n.mdhui-asthma-alert-takeover-notice-instructions {\n font-size: 1.2em;\n}\n\n.mdhui-asthma-alert-takeover-notice-buttons {\n margin-top: 32px;\n}\n\n.mdhui-asthma-alert-takeover-notice-button {\n margin: 12px 0;\n}");A(".mdhui-asthma-biometrics {\n padding: 16px;\n}\n\n.mdhui-asthma-biometrics-title {\n margin-bottom: 16px;\n}\n\n.mdhui-asthma-biometrics-data {\n display: grid;\n grid-template-columns: 1fr 1fr;\n align-items: center;\n grid-column-gap: 16px;\n grid-row-gap: 16px;\n}\n");const bEe={"no data":{daytimeRestingHeartRate:{type:"daytime-resting-heart-rate",status:"establishing"},nighttimeRestingHeartRate:{type:"nighttime-resting-heart-rate",status:"establishing"},respiratoryRate:{type:"respiratory-rate",status:"establishing"},steps:{type:"steps",status:"establishing"},sleepDisturbances:{type:"sleep-disturbances",status:"establishing"},daytimeBloodOxygenLevel:{type:"daytime-blood-oxygen-level",status:"establishing"},nighttimeBloodOxygenLevel:{type:"nighttime-blood-oxygen-level",status:"establishing"}},"some data":{daytimeRestingHeartRate:{type:"daytime-resting-heart-rate",status:"in-range",value:64.45},nighttimeRestingHeartRate:{type:"nighttime-resting-heart-rate",status:"offline",value:60.975},respiratoryRate:{type:"respiratory-rate",status:"establishing"},steps:{type:"steps",status:"out-of-range",value:12909},sleepDisturbances:{type:"sleep-disturbances",status:"establishing"},daytimeBloodOxygenLevel:{type:"daytime-blood-oxygen-level",status:"establishing"},nighttimeBloodOxygenLevel:{type:"nighttime-blood-oxygen-level",status:"in-range",value:.969}},"all data":{daytimeRestingHeartRate:{type:"daytime-resting-heart-rate",status:"in-range",value:64.45},nighttimeRestingHeartRate:{type:"nighttime-resting-heart-rate",status:"offline",value:60.975},respiratoryRate:{type:"respiratory-rate",status:"in-range",value:20.223},steps:{type:"steps",status:"out-of-range",value:12909},sleepDisturbances:{type:"sleep-disturbances",status:"establishing",value:4},daytimeBloodOxygenLevel:{type:"daytime-blood-oxygen-level",status:"in-range",value:.954456},nighttimeBloodOxygenLevel:{type:"nighttime-blood-oxygen-level",status:"in-range",value:.969}}};function wEe(e){const[a,n]=c(!0);let[i,r]=c(),[o,s]=c(),[l,u]=c(),[d,h]=c(),[m,p]=c(),[g,f]=c(),[y,v]=c();id((()=>{if(n(!0),"loading"===e.previewState)return;if(e.previewState)return r(bEe[e.previewState].daytimeRestingHeartRate),s(bEe[e.previewState].nighttimeRestingHeartRate),u(bEe[e.previewState].respiratoryRate),h(bEe[e.previewState].steps),p(bEe[e.previewState].sleepDisturbances),f(bEe[e.previewState].daytimeBloodOxygenLevel),v(bEe[e.previewState].nighttimeBloodOxygenLevel),void n(!1);(e.date?dEe.loadBiometricsForDate(e.date):dEe.loadBiometricsForControlStatus()).then((e=>{r(e.find((e=>"daytime-resting-heart-rate"===e.type))),s(e.find((e=>"nighttime-resting-heart-rate"===e.type))),u(e.find((e=>"respiratory-rate"===e.type))),h(e.find((e=>"steps"===e.type))),p(e.find((e=>"sleep-disturbances"===e.type))),f(e.find((e=>"daytime-blood-oxygen-level"===e.type))),v(e.find((e=>"nighttime-blood-oxygen-level"===e.type))),n(!1)}))}),[],[e.previewState]);const b=t=>{e.previewState||("daytime-resting-heart-rate"===t||"nighttime-resting-heart-rate"===t||"respiratory-rate"===t||"daytime-blood-oxygen-level"===t||"nighttime-blood-oxygen-level"===t?w.openApplication(e.heartAndLungsUrl,{modal:!0}):"steps"===t?w.openApplication(e.activityUrl,{modal:!0}):"sleep-disturbances"===t&&w.openApplication(e.sleepUrl,{modal:!0}))};return t.createElement("div",{className:"mdhui-asthma-biometrics",ref:e.innerRef},t.createElement(sM,{order:2,className:"mdhui-asthma-biometrics-title"},no("asthma-biometrics-title")),a&&t.createElement(XA,null),!a&&t.createElement("div",{className:"mdhui-asthma-biometrics-data"},t.createElement(lSe,{label:no("asthma-biometrics-daytime-resting-heart-rate-label"),statusText:TSe(i.status),statusColor:PSe(i.status),value:i.value?wl(i.value):void 0,units:no("asthma-biometrics-beats-per-minute-units"),onClick:()=>b("daytime-resting-heart-rate")}),t.createElement(lSe,{label:no("asthma-biometrics-nighttime-resting-heart-rate-label"),statusText:TSe(o.status),statusColor:PSe(o.status),value:o.value?wl(o.value):void 0,units:no("asthma-biometrics-beats-per-minute-units"),onClick:()=>b("nighttime-resting-heart-rate")}),t.createElement(lSe,{label:no("asthma-biometrics-respiratory-rate-label"),statusText:TSe(l.status),statusColor:PSe(l.status),value:l.value?wl(l.value):void 0,units:no("asthma-biometrics-breaths-per-minute-units"),onClick:()=>b("respiratory-rate")}),t.createElement(lSe,{label:no("asthma-biometrics-steps-label"),statusText:TSe(d.status),statusColor:PSe(d.status),value:wl(d.value),onClick:()=>b("steps")}),t.createElement(lSe,{label:no("asthma-biometrics-daytime-blood-oxygen-level-label"),statusText:TSe(g.status),statusColor:PSe(g.status),value:g.value?wl(100*g.value):void 0,onClick:()=>b("daytime-blood-oxygen-level"),units:no("asthma-biometrics-percent-units")}),t.createElement(lSe,{label:no("asthma-biometrics-nighttime-blood-oxygen-level-label"),statusText:TSe(y.status),statusColor:PSe(y.status),value:y.value?wl(100*y.value):void 0,onClick:()=>b("nighttime-blood-oxygen-level"),units:no("asthma-biometrics-percent-units")}),t.createElement(lSe,{label:no("asthma-biometrics-sleep-disturbances-label"),statusText:TSe(m.status),statusColor:PSe(m.status),value:wl(m.value),onClick:()=>b("sleep-disturbances")})))}A(".mdhui-asthma-control-calendar-log-entries .mdhui-action .title {\n font-size: 0.8em;\n color: var(--mdhui-text-color-3);\n margin-bottom: 4px\n}\n\n.mdhui-asthma-control-calendar-log-entries .mdhui-action .subtitle {\n font-size: 1.17em;\n font-weight: 500;\n}\n\n.mdhui-asthma-control-calendar-log-entries .mdhui-unstyled-button {\n border-radius: var(--mdhui-card-border-radius);\n}\n\n.mdhui-asthma-control-calendar-log-entry-components {\n display: grid;\n grid-template-columns: max-content max-content max-content auto;\n grid-column-gap: 8px;\n align-items: center;\n padding: 0 16px 16px;\n}\n\n.mdhui-asthma-control-calendar-log-entry-component {\n display: grid;\n grid-template-columns: max-content auto;\n align-items: center;\n height: 24px;\n line-height: 24px;\n border-radius: 12px;\n font-size: 0.8em;\n padding: 0 8px;\n color: #000;\n}\n\n.mdhui-asthma-control-calendar-log-entry-component-symptoms {\n background: #f9debf;\n}\n\n.mdhui-asthma-control-calendar-log-entry-component-impacts {\n background: #e6d6fa;\n}\n\n.mdhui-asthma-control-calendar-log-entry-component-triggers {\n background: #bfbfbf;\n}\n\n.mdhui-asthma-control-calendar-log-entry-component-icon {\n width: 12px;\n height: 12px;\n border-radius: 50%;\n margin-right: 4px;\n}\n\n.mdhui-asthma-control-calendar-log-entry-component-symptoms .mdhui-asthma-control-calendar-log-entry-component-icon {\n background: #E87C00;\n}\n\n.mdhui-asthma-control-calendar-log-entry-component-impacts .mdhui-asthma-control-calendar-log-entry-component-icon {\n background: #9D5BED;\n}\n\n.mdhui-asthma-control-calendar-log-entry-component-triggers .mdhui-asthma-control-calendar-log-entry-component-icon {\n background: #000000;\n}\n");const xEe=(e,t)=>({identifier:_Se(cn(new Date,{days:-e})),symptomLevel:t,symptoms:[],impacts:[],triggers:[]}),kEe={"no logs":{logEntries:[]},"some logs":{logEntries:[xEe(20,"none"),{...xEe(19,"mild"),impacts:["Limit your daily activity"]},xEe(17,"none"),xEe(16,"none"),xEe(15,"none"),xEe(8,"mild"),xEe(8,"none"),xEe(7,"none"),xEe(6,"none"),xEe(5,"none"),xEe(4,"none"),xEe(3,"none"),xEe(2,"mild"),{...xEe(1,"mild"),symptoms:["Difficulty breathing"],impacts:["Limit your daily activity"],triggers:["Smoke (tobacco or wood burning)"]},{...xEe(0,"mild"),impacts:["Limit your daily activity"]}]}};function AEe(e){const a=r(rM),[n,i]=c([]);id((()=>{e.previewState?i(kEe[e.previewState].logEntries):dEe.loadLogEntries().then((e=>{i(e)}))}),[],[e.previewState]);const o={"not-determined":{style:{background:"var(--mdhui-background-color-0)",border:"3px dashed var(--mdhui-text-color-0)",color:"var(--mdhui-text-color-0)",fontWeight:600,marginTop:"-12px"}},"not-controlled":{style:{background:"#F86A5C",border:"3px solid #F86A5C",color:"#fff",fontWeight:600,marginTop:"-12px"}},controlled:{style:{background:"var(--mdhui-background-color-0)",border:"3px solid #35A6A0",color:"#35A6A0",fontWeight:600,marginTop:"-12px"}},today:{style:{border:"3px solid #369CFF"}},future:{style:{background:"var(--mdhui-background-color-0)",border:"3px solid var(--mdhui-background-color-0)",color:"var(--mdhui-text-color-3)",fontWeight:600,marginTop:"-12px"}},"no-data":{style:{background:"var(--mdhui-background-color-0)",border:"3px solid var(--mdhui-background-color-0)",color:"var(--mdhui-text-color-0)",fontWeight:600,marginTop:"-12px"}}},s=e=>{let t=CSe(n,e).status;return"not-determined"===t?"not-determined":"not-controlled"===t?"not-controlled":"controlled"===t?"controlled":Sn(e,new Date)?"today":Ci(e,new Date)?"future":"no-data"},l=t=>{e.previewState||Ci(t,new Date)||w.openApplication(e.dayViewUrl+"?date="+_i(t,{representation:"date"}),{modal:!0})};let u=a?.intervalStart??e.intervalStart??In(new Date);return t.createElement("div",null,t.createElement(oSe,{noTopMargin:!0,style:{boxShadow:"none",marginBottom:"0"}},t.createElement(JA,{innerRef:e.innerRef,className:"mdhui-asthma-control-calendar",year:u.getFullYear(),month:u.getMonth(),dayRenderer:(e,a,n)=>t.createElement(eS,{year:e,month:a,day:n,stateConfiguration:o,computeStateForDay:s,onClick:l})})),"verbose"===e.variant&&(()=>{if(0===n.length)return null;let e=Rr(),a={},i=[...n].sort(((e,t)=>e.identifier.localeCompare(t.identifier)))[0],r=Tr(i.identifier);for(let t=0;t<=_n(e,r);t++){let e=cn(r,{days:t});if(!Ti(e,u)&&Ti(e,cn(u,{months:1}))){let t=_Se(e);a[t]=n.find((e=>e.identifier===t))}}return t.createElement("div",{className:"mdhui-asthma-control-calendar-log-entries"},Object.keys(a).sort().reverse().map(((n,i)=>{let r=Tr(n),o=a[n];return t.createElement(aS,{key:i},t.createElement(Za,{title:sl(r),subtitle:o?OSe(o.symptomLevel):_n(e,r)>=2?no("asthma-control-calendar-daily-entry-missed"):no("asthma-control-calendar-not-logged-yet"),onClick:()=>l(r)}),o&&(o.symptoms&&o.symptoms.length>0||o.impacts&&o.impacts.length>0||o.triggers&&o.triggers.length>0)&&t.createElement("div",{className:"mdhui-asthma-control-calendar-log-entry-components"},o.symptoms&&o.symptoms.length>0&&t.createElement(SEe,{className:"mdhui-asthma-control-calendar-log-entry-component-symptoms",label:no("asthma-control-calendar-log-entries-symptoms-label")}),o.impacts&&o.impacts.length>0&&t.createElement(SEe,{className:"mdhui-asthma-control-calendar-log-entry-component-impacts",label:no("asthma-control-calendar-log-entries-impacts-label")}),o.triggers&&o.triggers.length>0&&t.createElement(SEe,{className:"mdhui-asthma-control-calendar-log-entry-component-triggers",label:no("asthma-control-calendar-log-entries-triggers-label")})))})))})())}function SEe(e){return t.createElement("div",{className:["mdhui-asthma-control-calendar-log-entry-component",e.className].join(" ")},t.createElement("div",{className:"mdhui-asthma-control-calendar-log-entry-component-icon"}),t.createElement("div",{className:"mdhui-asthma-control-calendar-log-entry-component-label"},e.label))}A(".mdhui-asthma-control-status-header {\n padding: 0 16px;\n margin-bottom: 16px;\n}\n\n.mdhui-asthma-control-status-header p:first-child {\n margin-top: 0;\n}\n\n.mdhui-asthma-control-status-header p:last-child {\n margin-bottom: 0;\n}\n\n.mdhui-asthma-control-status-header-text {\n font-size: 1.4em;\n font-weight: bold;\n}\n\n.mdhui-asthma-control-status-header-controlled {\n color: #03dbcc;\n}\n\n.mdhui-asthma-control-status-header-not-controlled {\n color: #fc6666;\n}\n\n.mdhui-asthma-control-status-header-not-controlled-stats {\n display: grid;\n grid-template-columns: 1fr 1fr;\n align-items: center;\n margin-top: 8px;\n}\n\n.mdhui-asthma-control-status-header-not-controlled-stat {\n display: grid;\n grid-template-columns: max-content max-content auto;\n align-items: center;\n grid-column-gap: 8px;\n font-size: 0.8em;\n}\n\n.mdhui-asthma-control-status-header-not-controlled-stat-value {\n padding: 2px;\n height: 20px;\n width: 20px;\n line-height: 20px;\n border-radius: 50%;\n text-align: center;\n background: #fc6666;\n}\n\n.mdhui-asthma-control-status-header-not-controlled-stat-label {\n height: 30px;\n line-height: 30px;\n text-align: center;\n}\n\n.mdhui-asthma-control-status-header-data-out-of-range {\n color: #9D5BED;\n}");const EEe=(e,a)=>{if(e.includes("|||")){const n=e.split("|||");return t.createElement(t.Fragment,null,n[0],t.createElement("span",{className:a},n[1]),n[2])}return t.createElement(t.Fragment,null,e)},_Ee={"no data":{controlState:{status:"no-data"},biometrics:[],airQualities:[]},"abnormal dhr":{controlState:{status:"no-data"},biometrics:[{type:"daytime-resting-heart-rate",status:"out-of-range"}],airQualities:[]},"abnormal nhr":{controlState:{status:"no-data"},biometrics:[{type:"nighttime-resting-heart-rate",status:"out-of-range"}],airQualities:[]},"abnormal rr":{controlState:{status:"no-data"},biometrics:[{type:"respiratory-rate",status:"out-of-range"}],airQualities:[]},"abnormal activity":{controlState:{status:"no-data"},biometrics:[{type:"steps",status:"out-of-range"}],airQualities:[]},"abnormal sleep":{controlState:{status:"no-data"},biometrics:[{type:"sleep-disturbances",status:"out-of-range"}],airQualities:[]},"abnormal dbol":{controlState:{status:"no-data"},biometrics:[{type:"daytime-blood-oxygen-level",status:"out-of-range"}],airQualities:[]},"abnormal nbol":{controlState:{status:"no-data"},biometrics:[{type:"nighttime-blood-oxygen-level",status:"out-of-range"}],airQualities:[]},"abnormal home aqi":{controlState:{status:"no-data"},biometrics:[],airQualities:[{type:"home",status:"out-of-range",description:"unhealthy"}]},"abnormal work aqi":{controlState:{status:"no-data"},biometrics:[],airQualities:[{type:"work",status:"out-of-range",description:"very unhealthy"}]},"abnormal multiple":{controlState:{status:"no-data"},biometrics:[{type:"steps",status:"out-of-range"}],airQualities:[{type:"work",status:"out-of-range",description:"hazardous"}]},"not determined":{controlState:{status:"not-determined"},biometrics:[],airQualities:[]},"not controlled":{controlState:{status:"not-controlled",symptomDaysPast7:1,nighttimeAwakeningDaysPast7:1,limitedActivityDaysPast7:1,inhalerUseDaysPast7:1},biometrics:[],airQualities:[]},controlled:{controlState:{status:"controlled"},biometrics:[],airQualities:[]}};function CEe(e){let[a,n]=c(!0),[i,r]=c(),[o,s]=c(),[l,u]=c();if(id((()=>{if(n(!0),"loading"===e.previewState)return void r(void 0);if(e.previewState)return r(_Ee[e.previewState].controlState),s(_Ee[e.previewState].biometrics),u(_Ee[e.previewState].airQualities),void n(!1);let t=new Date;dEe.loadLogEntries(cn(new Date(t),{days:-10})).then((a=>{if(e.participant.hasPairedDevice()&&e.participant.hasEstablishedBaseline()){let i=dEe.loadBiometricsForControlStatus(),o=dEe.loadAirQualitiesForControlStatus(e.participant.getHomeAirQualityZipCode(),e.participant.getWorkAirQualityZipCode());Promise.all([i,o]).then((e=>{r(CSe(a,t)),s(e[0]),u(e[1]),n(!1)}))}else r(CSe(a,t)),n(!1)}))}),[],[e.previewState]),a&&!i)return null;const d=e=>{const a=EEe(e,"mdhui-asthma-control-status-header-data-out-of-range");return t.createElement("div",{className:"mdhui-asthma-control-status-header-text"},t.createElement("p",null,a," ",no("asthma-control-status-header-complete-daily-entry")))},h=(e,a)=>a?t.createElement("div",{className:"mdhui-asthma-control-status-header-not-controlled-stat"},t.createElement("div",{className:"mdhui-asthma-control-status-header-not-controlled-stat-value"},a,"x"),t.createElement("div",{className:"mdhui-asthma-control-status-header-not-controlled-stat-label"},e)):null;return t.createElement("div",{className:"mdhui-asthma-control-status-header",ref:e.innerRef},"no-data"===i.status&&(()=>{if(e.participant.hasPairedDevice()&&e.participant.hasEstablishedBaseline()){if(o.filter((e=>"out-of-range"===e.status)).length+l.filter((e=>"out-of-range"===e.status)).length>1)return d(no("asthma-control-status-header-multiple-out-of-range"));if("out-of-range"===o.find((e=>"daytime-resting-heart-rate"===e.type||"nighttime-resting-heart-rate"===e.type))?.status)return d(no("asthma-control-status-header-abnormal-heart-rate"));if("out-of-range"===o.find((e=>"respiratory-rate"===e.type))?.status)return d(no("asthma-control-status-header-abnormal-respiratory-rate"));if("out-of-range"===o.find((e=>"steps"===e.type))?.status)return d(no("asthma-control-status-header-abnormal-steps"));if("out-of-range"===o.find((e=>"sleep-disturbances"===e.type))?.status)return d(no("asthma-control-status-header-abnormal-sleep"));if("out-of-range"===o.find((e=>"daytime-blood-oxygen-level"===e.type||"nighttime-blood-oxygen-level"===e.type))?.status)return d(no("asthma-control-status-header-abnormal-blood-oxygen"));if("out-of-range"===l.find((e=>"home"===e.type))?.status){const e=no("asthma-control-status-header-abnormal-home-aqi",void 0,{aqi:LSe(l.find((e=>"home"===e.type))?.description)||""});return d(e)}if("out-of-range"===l.find((e=>"work"===e.type))?.status){const e=no("asthma-control-status-header-abnormal-work-aqi",void 0,{aqi:LSe(l.find((e=>"work"===e.type))?.description)||""});return d(e)}}return t.createElement("div",{className:"mdhui-asthma-control-status-header-text"},t.createElement("p",null,hEe(e.participant,"asthma-control-status-header-no-data")))})(),"not-determined"===i.status&&t.createElement("div",{className:"mdhui-asthma-control-status-header-text"},t.createElement("p",null,hEe(e.participant,"asthma-control-status-header-not-determined"))),"controlled"===i.status&&t.createElement("div",{className:"mdhui-asthma-control-status-header-text"},t.createElement("p",null,EEe(hEe(e.participant,"asthma-control-status-header-controlled"),"mdhui-asthma-control-status-header-controlled"))),"not-controlled"===i.status&&t.createElement("div",null,t.createElement("div",{className:"mdhui-asthma-control-status-header-text"},t.createElement("p",null,EEe(hEe(e.participant,"asthma-control-status-header-not-controlled"),"mdhui-asthma-control-status-header-not-controlled"))),t.createElement("div",{className:"mdhui-asthma-control-status-header-not-controlled-stats"},h(no("asthma-control-status-header-not-controlled-stat-symptom-days"),i.symptomDaysPast7),h(no("asthma-control-status-header-not-controlled-stat-rescue-inhaler"),i.inhalerUseDaysPast7),h(no("asthma-control-status-header-not-controlled-stat-limited-activity"),i.limitedActivityDaysPast7),h(no("asthma-control-status-header-not-controlled-stat-awakenings"),i.nighttimeAwakeningDaysPast7))))}A(".mdhui-asthma-log-entry-details {\n padding: 16px;\n}\n\n.mdhui-asthma-log-entry-details-header {\n display: grid;\n grid-template-columns: auto max-content;\n align-items: center;\n margin-bottom: 20px;\n}\n\n.mdhui-asthma-log-entry-details-header-status {\n font-size: 1.2em;\n font-weight: bold;\n}\n\n.mdhui-asthma-log-entry-details-header-add-button {\n height: 32px;\n line-height: 32px;\n border-radius: 6px;\n font-size: 0.8em;\n padding: 0 16px;\n color: #fff;\n background: #369CFF;\n}\n\n.mdhui-asthma-log-entry-details-header-edit-button {\n height: 32px;\n line-height: 32px;\n border-radius: 6px;\n font-size: 0.8em;\n padding: 0 16px;\n color: #007FF9;\n background: #BBDEFF;\n}\n\n.mdhui-unstyled-button.mdhui-asthma-log-entry-details-header-info-button {\n width: 48px;\n height: 32px;\n text-align: right;\n line-height: 32px;\n font-size: 20px;\n color: var(--mdhui-color-primary);\n}\n\n.mdhui-asthma-log-entry-details-component {\n margin-bottom: 16px;\n}\n\n.mdhui-asthma-log-entry-details-component-symptoms .mdhui-asthma-log-entry-details-component-header-icon {\n background: #E87C00;\n}\n\n.mdhui-asthma-log-entry-details-component-symptoms .mdhui-asthma-log-entry-details-component-data {\n background: #f9debf;\n color: #E87C00;\n}\n\n.mdhui-asthma-log-entry-details-component-impacts .mdhui-asthma-log-entry-details-component-header-icon {\n background: #9D5BED;\n}\n\n.mdhui-asthma-log-entry-details-component-impacts .mdhui-asthma-log-entry-details-component-data {\n background: #e6d6fa;\n color: #9D5BED;\n}\n\n.mdhui-asthma-log-entry-details-component-triggers .mdhui-asthma-log-entry-details-component-header-icon {\n background: #000000;\n}\n\n.mdhui-asthma-log-entry-details-component-triggers .mdhui-asthma-log-entry-details-component-data {\n background: #bfbfbf;\n color: #000000;\n}\n\n.mdhui-asthma-log-entry-details-component:last-child {\n margin-bottom: 0;\n}\n\n.mdhui-asthma-log-entry-details-component-header {\n display: grid;\n grid-template-columns: max-content auto;\n grid-column-gap: 4px;\n align-items: center;\n margin-bottom: 8px;\n}\n\n.mdhui-asthma-log-entry-details-component-header-icon {\n display: inline-block;\n width: 12px;\n height: 12px;\n border-radius: 50%;\n}\n\n.mdhui-asthma-log-entry-details-component-header-label {\n font-size: 0.8em;\n font-weight: bold;\n}\n\n.mdhui-asthma-log-entry-details-component-no-data {\n font-size: 0.8em;\n color: var(--mdhui-text-color-3);\n margin-left: 16px;\n}\n\n.mdhui-asthma-log-entry-details-component-data {\n display: inline-block;\n padding: 0 8px;\n height: 24px;\n line-height: 24px;\n border-radius: 12px;\n font-size: 0.7em;\n margin-top: 4px;\n margin-right: 4px;\n}");const TEe={identifier:_Se(new Date),symptomLevel:"none",symptoms:[],impacts:[],triggers:[]},PEe={"not logged":{},"logged with no symptoms":{logEntry:TEe},"logged with mild symptoms":{logEntry:{...TEe,symptomLevel:"mild",symptoms:["Coughing"],impacts:["Wake up at night","Use your rescue inhaler"],triggers:["Cold/viral illness","Seasonal allergens/pollen","Smoke (tobacco or wood burning)","Air pollution","Dust mites","Mold"]}},"logged with moderate symptoms":{logEntry:{...TEe,symptomLevel:"moderate",symptoms:["Coughing"],triggers:["Cold/viral illness","Mold"]}},"logged with severe symptoms":{logEntry:{...TEe,symptomLevel:"severe",symptoms:["Coughing","Wheezing"],impacts:["Use your rescue inhaler"]}}};function OEe(e){const[a,n]=c(!0),[i,r]=c();let o=Rr(),s=cn(new Date(o),{days:-1}),l=cn(new Date(e.date),{days:-1}),u=cn(new Date(e.date),{days:1});id((()=>{if(n(!0),"loading"!==e.previewState)return e.previewState?(r(PEe[e.previewState].logEntry),void n(!1)):void dEe.loadLogEntries(l,u).then((t=>{let a=_Se(e.date);r(t.find((e=>e.identifier===a))),n(!1)}))}),[],[e.previewState]);const d=()=>!Ti(e.date,s);return t.createElement("div",{className:"mdhui-asthma-log-entry-details",ref:e.innerRef},a&&t.createElement(XA,null),!a&&t.createElement("div",null,t.createElement("div",{className:"mdhui-asthma-log-entry-details-header"},t.createElement("div",{className:"mdhui-asthma-log-entry-details-header-status"},i?OSe(i.symptomLevel):d()?no("asthma-log-entry-details-not-logged-yet"):no("asthma-log-entry-details-not-editable")),d()?t.createElement(S,{className:"mdhui-asthma-log-entry-details-header-action",onClick:()=>{a||e.previewState||(n(!0),i?w.openApplication(e.editLogEntryUrl+"?date="+_i(e.date,{representation:"date"}),{modal:!0}):Sn(e.date,o)?w.startSurvey(e.logTodayEntrySurveyName):Sn(e.date,s)&&w.startSurvey(e.logYesterdayEntrySurveyName))}},i?t.createElement("div",{className:"mdhui-asthma-log-entry-details-header-edit-button"},no("asthma-log-entry-details-edit-button-text")):t.createElement("div",{className:"mdhui-asthma-log-entry-details-header-add-button"},no("asthma-log-entry-details-add-button-text"))):t.createElement(S,{className:"mdhui-asthma-log-entry-details-header-info-button",onClick:()=>{a||e.previewState||w.openApplication(e.infoUrl,{modal:!0})}},t.createElement(gge,{icon:ie}))),t.createElement(MEe,{className:"mdhui-asthma-log-entry-details-component-symptoms",label:no("asthma-log-entry-details-symptoms-label"),data:DSe(i?.symptoms)}),t.createElement(MEe,{className:"mdhui-asthma-log-entry-details-component-impacts",label:no("asthma-log-entry-details-impacts-label"),data:NSe(i?.impacts)}),t.createElement(MEe,{className:"mdhui-asthma-log-entry-details-component-triggers",label:no("asthma-log-entry-details-triggers-label"),data:zSe(i?.triggers)})))}function MEe(e){return t.createElement("div",{className:["mdhui-asthma-log-entry-details-component",e.className].join(" ")},t.createElement("div",{className:"mdhui-asthma-log-entry-details-component-header"},t.createElement("div",{className:"mdhui-asthma-log-entry-details-component-header-icon"}),t.createElement("div",{className:"mdhui-asthma-log-entry-details-component-header-label"},e.label)),0===e.data.length&&t.createElement("div",{className:"mdhui-asthma-log-entry-details-component-no-data"},no("asthma-log-entry-details-component-no-data",void 0,{dataType:e.label.toLowerCase()})),e.data.length>0&&e.data.map((e=>t.createElement("div",{className:"mdhui-asthma-log-entry-details-component-data"},e))))}A(".mdhui-asthma-log-entry-header {\n padding: 0 16px;\n margin-bottom: 16px;\n}\n\n.mdhui-unstyled-button.mdhui-asthma-log-entry-summary {\n display: grid;\n grid-template-columns: auto max-content;\n align-items: center;\n border-radius: 6px;\n padding: 16px;\n margin: 8px 0;\n width: 100%;\n background: var(--mdhui-background-color-1);\n}\n\n.mdhui-asthma-log-entry-summary-details {\n font-size: 0.95em;\n}\n\n.mdhui-asthma-log-entry-summary-label {\n}\n\n.mdhui-asthma-log-entry-summary-status {\n font-weight: bold;\n}\n\n.mdhui-asthma-log-entry-summary-add-button {\n height: 32px;\n line-height: 32px;\n border-radius: 16px;\n font-size: 0.8em;\n padding: 0 16px;\n color: #fff;\n background: #369CFF;\n}\n\n.mdhui-asthma-log-entry-summary-chevron {\n color: var(--mdhui-text-color-3);\n}\n\n.mdhui-asthma-log-entry-summary .mdhui-loading-indicator {\n padding: 0;\n}");const DEe={identifier:_Se(new Date),symptomLevel:"mild",symptoms:[],impacts:[],triggers:[]},IEe={"no logs":{},"today log only":{todayLogEntry:DEe},"yesterday log only":{yesterdayLogEntry:DEe},"both logs":{yesterdayLogEntry:DEe,todayLogEntry:DEe}};function NEe(e){let[a,n]=c(!0),[i,r]=c(!0),[o,s]=c(),[l,u]=c();if(id((()=>{if(r(!0),"loading"!==e.previewState)return e.previewState?(s(IEe[e.previewState].yesterdayLogEntry),u(IEe[e.previewState].todayLogEntry),r(!1),void n(!1)):void dEe.loadLogEntries(cn(new Date,{days:-3})).then((e=>{let t=vn(new Date),a=_Se(t);u(e.find((e=>e.identifier===a)));let i=vn(cn(new Date,{days:-1})),o=_Se(i);s(e.find((e=>e.identifier===o))),r(!1),n(!1)}))}),["surveyDidFinish"],[e.previewState]),a)return null;const d=(a,n,r)=>t.createElement(S,{className:"mdhui-asthma-log-entry-summary",onClick:()=>((t,a)=>{e.previewState||i||(a?w.openApplication(e.dayViewUrl+"?date="+a.identifier,{modal:!0}):w.startSurvey(t))})(n,r)},t.createElement("div",{className:"mdhui-asthma-log-entry-summary-details"},t.createElement("div",{className:"mdhui-asthma-log-entry-summary-label"},a),t.createElement("div",{className:"mdhui-asthma-log-entry-summary-status"},(e=>e?OSe(e.symptomLevel):no("asthma-log-entry-header-not-logged-yet"))(r))),t.createElement("div",{className:"mdhui-asthma-log-entry-summary-action"},i&&t.createElement(XA,null),!i&&!r&&t.createElement("div",{className:"mdhui-asthma-log-entry-summary-add-button"},no("asthma-log-entry-header-add-button-text")),!i&&r&&t.createElement(gge,{icon:Ae,className:"mdhui-asthma-log-entry-summary-chevron"})));return t.createElement("div",{className:"mdhui-asthma-log-entry-header",ref:e.innerRef},d(no("asthma-log-entry-header-today-log-label"),e.logTodayEntrySurveyName,l),d(no("asthma-log-entry-header-yesterday-log-label"),e.logYesterdayEntrySurveyName,o))}function jEe(e){const t=()=>{dEe.checkSurveyAnswerExists(e.logTodayEntrySurveyName).then((t=>{t||w.queryDeviceData({namespace:"Project",type:"LogAutoLaunched"}).then((t=>{t.deviceDataPoints.length||w.persistDeviceData([{type:"LogAutoLaunched",value:(new Date).toISOString()}]).then((()=>{w.startSurvey(e.logTodayEntrySurveyName)}))}))}))};return id((()=>{e.previewState||dEe.loadSurveyAnswers([e.postEnrollmentSurveyName,e.postEnrollmentMobileSurveyName]).then((a=>{a.find((t=>t.surveyName===e.postEnrollmentSurveyName))?a.find((t=>t.surveyName===e.postEnrollmentMobileSurveyName))?t():Promise.all([w.getParticipantInfo(),w.getDeviceInfo()]).then((([a,n])=>{"Caregiver"!==(a.customFields.ParticipantMode??"Self")&&["iOS","Android"].includes(n.platform)?w.startSurvey(e.postEnrollmentMobileSurveyName):t()})):w.startSurvey(e.postEnrollmentSurveyName)}))})),null}const zEe={createDataService:e=>({loadParticipant:()=>"loading"===e?new Promise((()=>lM)):Promise.resolve({getId:()=>"ef698523-118a-414a-bd01-ff97c6cb31f9",getFirstName:()=>"Sally",getParticipantMode:()=>"as caregiver"===e?"Caregiver":"Self",getCareRecipientName:()=>"as caregiver"===e?"Leroy":void 0}),loadLogEntries:()=>Promise.resolve([{identifier:_Se(cn(new Date,{days:-5})),symptomLevel:"none",symptoms:[],impacts:[],triggers:[]},{identifier:_Se(cn(new Date,{days:-15})),symptomLevel:"moderate",symptoms:[],impacts:["Wake up at night"],triggers:[]},{identifier:_Se(cn(new Date,{days:-25})),symptomLevel:"moderate",symptoms:[],impacts:[],triggers:[]}]),loadSurveyAnswers:(e,t)=>Promise.resolve([{stepIdentifier:"MISSED_DOSES_REASONS",answers:["Unable to afford the medications","Medications not working"]},{stepIdentifier:"MISSED_DOSES_REASONS",answers:["None of the above"]},{stepIdentifier:"MISSED_DOSES_REASONS",answers:["Don't want to run out, so purposefully skipping doses"]},{stepIdentifier:"MISSED_DOSES_REASONS",answers:["Unable to afford the medications","Difficulty getting refills","Trouble remembering to take them","I'm confused which inhaler to take when","Don't know why I should take it","Concerns over side effects","Medications not working","Don't want to run out, so purposefully skipping doses","Never learned how to take them","None of the above"]}]),loadAirQualityDataPoints:e=>Promise.resolve([])})};function REe(e){const[a,n]=c(!0),[i,r]=c(),[o,u]=c([]),[d,h]=c([]),[m,p]=c([]),g=s(null),[f,y]=c(!1),[v,b]=c();let x=Rr(),k=cn(x,{days:-89});if(l((()=>{n(!0);const t=e.previewState?zEe.createDataService(e.previewState):dEe;let a=t.loadParticipant(),i=t.loadLogEntries(k),o=t.loadSurveyAnswers(e.logEntrySurveyName,k),s=t.loadAirQualityDataPoints(k);Promise.all([a,i,o,s]).then((e=>{r(e[0]),u(e[1]),h(e[2]),p(e[3]),n(!1)}))}),[e.previewState]),a)return t.createElement(XA,{innerRef:e.innerRef});let A=i.getFirstName();if("Caregiver"===i.getParticipantMode()){const e=i.getCareRecipientName();e&&(A=e)}let S={},E=0,_=0,C=0,T=0,P=0,O=0,M=0,D=0,I=0,N=0,j=0,z=0,R=0,L=0;o.forEach((e=>{S[e.identifier]=CSe(o,Tr(e.identifier)),"none"===e.symptomLevel?E++:"mild"===e.symptomLevel?(_++,P++):"moderate"===e.symptomLevel?(C++,P++):"severe"===e.symptomLevel&&(T++,P++),e.symptoms.includes("Coughing")&&O++,e.symptoms.includes("Wheezing")&&M++,e.impacts.includes("Use your rescue inhaler")&&D++,e.impacts.includes("Limit your daily activity")&&I++,e.impacts.includes("Wake up at night")&&N++,e.triggers.includes("Animal exposure")&&j++,e.triggers.includes("Seasonal allergens/pollen")&&z++,e.triggers.includes("Smoke (tobacco or wood burning)")&&R++,e.triggers.includes("Air pollution")&&L++}));let F=0,B=0,H=[];d.forEach((e=>{"MISSED_DOSES"===e.stepIdentifier?(e.answers.includes("1 - 2 missed doses")||e.answers.includes("3 - 6 missed doses")||e.answers.includes("7 or more missed doses"))&&F++:"MISSED_DOSES_REASONS"===e.stepIdentifier&&(e.answers.length>0&&"None of the above"!==e.answers[0]&&B++,e.answers.forEach((e=>{"None of the above"===e||H.includes(e)||H.push(e)})))}));let q=m.filter((e=>"HomeAirQuality"===e.type&&parseFloat(e.value)>100)),U=new Set(q.map((e=>_i(Tr(e.observationDate),{representation:"date"})))).size,V=m.filter((e=>"WorkAirQuality"===e.type&&parseFloat(e.value)>100)),W=new Set(V.map((e=>_i(Tr(e.observationDate),{representation:"date"})))).size;const $=(e,a,n)=>{let i=Array.from({length:a},((t,a)=>a+e));return t.createElement("div",{style:{display:"flex",flexDirection:"row",width:"100%",alignItems:"center",justifyContent:"space-evenly",margin:"4px 0"}},i.map((a=>((e,a)=>{let n=cn(k,{days:e}),i=_Se(n),r=S[i],o={fill:"transparent",stroke:"#fff",strokeWidth:2},s={fontSize:"15px",fontWeight:600,textAlign:"center",lineHeight:"40px"};return"not-controlled"===r?.status?(o.fill="#F86A5C",o.stroke="#F86A5C",s.color="#fff"):"controlled"===r?.status?(o.stroke="#35A6A0",s.color="#35A6A0"):"not-determined"===r?.status&&(o.stroke="#000",o.strokeDasharray=4),t.createElement("div",{style:{textAlign:"center",padding:"1px",flexGrow:1,flexBasis:"5%"}},t.createElement("div",{style:{width:"38px",minHeight:"22px",fontSize:"16px",margin:"2px auto"}},a||1===n.getDate()?dl(n).toLocaleUpperCase():""),t.createElement("svg",{viewBox:"0 0 40px 40px",style:{height:"40px",width:"40px"}},t.createElement("circle",{cx:"20",cy:"20",r:"18",style:o}),t.createElement("foreignObject",{x:"0",y:"0",height:"40px",width:"40px"},t.createElement("div",{style:s},n.getDate()))))})(a,!!n&&e==a))))},G=(e,a,n)=>t.createElement("div",{style:{display:"flex",flexDirection:"row",margin:"2px 0"}},t.createElement("div",{style:{flexGrow:1,marginRight:"4px",fontWeight:500}},e),t.createElement("div",{style:{flexShrink:0}},a," ",n)),K=e=>{let t=`AsthmaTool-ProviderReport-${_i(new Date,{representation:"date"})}`,a=w.baseUrl+"WebVisualization/WebVisualizationPDF?patientID="+i.getId()+"&modelType=VisualizationModel&visualizationKey=Shared.HtmlToPdf&fileName="+encodeURIComponent(t);e&&["Android","iOS"].includes(e.platform)?window.webkit.messageHandlers.OpenFile.postMessage({url:a}):w.openExternalUrl(a),setTimeout((()=>{y(!1)}),2e3)};let Z=1224,Y=(window.innerWidth-32)/Z;return t.createElement("div",{style:{display:"flex",justifyContent:"center"}},t.createElement("div",{style:{position:"absolute",width:Z,height:1575,transform:"scale("+Y+")",transformOrigin:"top"}},t.createElement("div",{style:{position:"relative",padding:"32px 48px",width:Z,height:1575,boxSizing:"border-box",backgroundColor:"#fff",fontFamily:"Inter, sans-serif"},ref:g},t.createElement("div",{style:{fontSize:"32px",fontWeight:600}},A," - Asthma Tool - Provider Report"),t.createElement("div",{style:{fontSize:"24px",color:"#3b3b3b",marginBottom:"16px"}},sl(k)," - ",sl(x)," (90 ",no("days"),")"),t.createElement("div",{style:{border:"1px solid #dbdbdb",borderRadius:"10px",overflow:"hidden",marginBottom:"16px"}},t.createElement("div",{style:{display:"flex",flexDirection:"row",width:"100%",padding:"16px",borderBottom:"1px solid #dbdbdb",boxSizing:"border-box"}},t.createElement("div",{style:{flexGrow:1}},t.createElement("div",{style:{fontSize:"18px",fontWeight:700}},"Asthma Control"),t.createElement("div",{style:{fontSize:"16px",color:"#3b3b3b",marginBottom:"16px"}},"Patient reported"),t.createElement("div",{style:{display:"flex",flexDirection:"row"}},t.createElement("div",{style:{marginRight:"24px"}},t.createElement("div",{style:{fontSize:"24px",fontWeight:700}},o.length," out of 90"),t.createElement("div",null,"Daily entries logged")),t.createElement("div",{style:{marginRight:"24px"}},t.createElement("div",{style:{fontSize:"24px",fontWeight:700,color:"#F86A5C"}},o.filter((e=>"not-controlled"===S[e.identifier].status)).length," days"),t.createElement("div",null,"Not under control")),t.createElement("div",null,t.createElement("div",{style:{fontSize:"24px",fontWeight:700,color:"#35A6A0"}},o.filter((e=>"controlled"===S[e.identifier].status)).length," days"),t.createElement("div",null,"Under control")))),t.createElement("div",{style:{fontSize:"14px",fontWeight:500,paddingTop:"8px"}},t.createElement("div",{style:{display:"flex",flexDirection:"row",marginBottom:"8px"}},t.createElement("svg",{viewBox:"0 0 20 20",style:{height:"20px",width:"20px"}},t.createElement("circle",{cx:"10",cy:"10",r:"8",style:{fill:"#fff",stroke:"#35A6A0",strokeWidth:2}})),t.createElement("div",{style:{flexGrow:1,padding:"2px 8px"}},"Under control")),t.createElement("div",{style:{display:"flex",flexDirection:"row",marginBottom:"8px"}},t.createElement("svg",{viewBox:"0 0 20 20",style:{height:"20px",width:"20px"}},t.createElement("circle",{cx:"10",cy:"10",r:"8",style:{fill:"#F86A5C",stroke:"#F86A5C",strokeWidth:2}})),t.createElement("div",{style:{flexGrow:1,padding:"2px 8px"}},"Not under control")),t.createElement("div",{style:{display:"flex",flexDirection:"row",marginBottom:"8px"}},t.createElement("svg",{viewBox:"0 0 20 20",style:{height:"20px",width:"20px"}},t.createElement("circle",{cx:"10",cy:"10",r:"8",style:{fill:"#fff",stroke:"#000",strokeWidth:2,strokeDasharray:3}})),t.createElement("div",{style:{flexGrow:1,padding:"2px 8px"}},"Not enough information")))),t.createElement("div",{style:{padding:"12px 16px"}},$(0,18,!0),$(18,18),$(36,18),$(54,18),$(72,18)),t.createElement("div",{style:{fontSize:"14px",color:"#3b3b3b",backgroundColor:"#f2f2f2",padding:"16px"}},"This patient-facing digital asthma tool allows the user to create a daily entry and self-report their symptoms, use of rescue inhaler and impact on activity and nighttime awakenings. The figure above use the self-reported answers to assess asthma control, based on the ",t.createElement("a",{href:"https://www.nhlbi.nih.gov/health-topics/guidelines-for-diagnosis-management-of-asthma",target:"_blank"},"EPR-3 guidelines"),". A day is noted as not under control if in the prior week (7 days) there are more than 2 days of symptoms or rescue inhaler use or due to asthma 1 nighttime awakening or limitation in activity was recorded.")),t.createElement("div",{style:{display:"flex",flexDirection:"row",width:"100%",fontSize:"17px",marginBottom:"16px"}},t.createElement("div",{style:{flexGrow:1,flexBasis:"30%",backgroundColor:"#f2f2f2",border:"1px solid #dbdbdb",borderRadius:"10px",padding:"12px"}},t.createElement("div",{style:{marginBottom:"8px",fontWeight:700}},"Components of control"),G("Symptoms reported",P,1===P?"day":"days"),G("Rescue inhaler use",D,1===D?"day":"days"),G("Normal activities affected",I,1===I?"day":"days"),G("Nighttime awakenings",N,1===N?"day":"days")),t.createElement("div",{style:{flexGrow:1,flexBasis:"30%",backgroundColor:"#f2f2f2",border:"1px solid #dbdbdb",borderRadius:"10px",padding:"12px",margin:"0 16px"}},t.createElement("div",{style:{marginBottom:"8px",fontWeight:700}},"Symptom severity"),G("None",E,1===E?"day":"days"),G("Mild",_,1===_?"day":"days"),G("Moderate",C,1===C?"day":"days"),G("Severe",T,1===T?"day":"days")),t.createElement("div",{style:{flexGrow:1,flexBasis:"30%",backgroundColor:"#f2f2f2",border:"1px solid #dbdbdb",borderRadius:"10px",padding:"12px"}},t.createElement("div",{style:{marginBottom:"8px",fontWeight:700}},"Common symptoms"),G("Coughing",O,1===O?"day":"days"),G("Wheezing",M,1===M?"day":"days"))),t.createElement("div",{style:{display:"flex",flexDirection:"row",width:"100%",fontSize:"16px",marginBottom:"24px"}},t.createElement("div",{style:{flexGrow:1,flexBasis:"30%",backgroundColor:"#f2f2f2",border:"1px solid #dbdbdb",borderRadius:"10px",padding:"12px"}},t.createElement("div",{style:{marginBottom:"8px",fontWeight:700}},"Top 4 triggers"),G("Animal exposure",j,1===j?"report":"reports"),G("Seasonal allergens/pollen",z,1===z?"report":"reports"),G("Smoke",R,1===R?"report":"reports"),G("Air pollution",L,1===L?"report":"reports")),t.createElement("div",{style:{flexGrow:1,flexBasis:"30%",backgroundColor:"#f2f2f2",border:"1px solid #dbdbdb",borderRadius:"10px",padding:"12px",margin:"0 16px"}},t.createElement("div",{style:{marginBottom:"8px",fontWeight:700}},"Medications"),G("Missed doses",F,1===F?"report":"reports"),0===B&&G("Reported barriers to adherence",0,"reports"),B>=1&&G("Reported barriers to adherence*",B,1===B?"report":"reports"),B>=1&&t.createElement("div",{style:{fontSize:"12px",marginTop:"12px"}},"*",H.join("; "))),t.createElement("div",{style:{flexGrow:1,flexBasis:"30%",backgroundColor:"#f2f2f2",border:"1px solid #dbdbdb",borderRadius:"10px",padding:"12px"}},t.createElement("div",{style:{marginBottom:"8px",fontWeight:700}},"Days with AQI over 100"),G("Home",U>0?U:"None",1===U?"day":U>1?"days":""),G("Work",W>0?W:"None",1===W?"day":W>1?"days":""),t.createElement("div",{style:{fontSize:"12px",marginTop:"12px"}},"Source: airnow.gov"))),t.createElement("div",{style:{position:"absolute",bottom:64,left:48,right:48,fontSize:"17px"}},t.createElement("div",{style:{fontSize:"16px",fontWeight:700,marginBottom:"16px"}},"For Providers - About this tool & report:"),t.createElement("div",{style:{marginBottom:"16px"}},"This report was generated from what is logged in the Asthma Tool, powered by ",t.createElement("a",{href:"https://careevolution.com/mydatahelps/",target:"_blank"},"MyDataHelps"),". The Asthma Tool enables patients to track daily their symptoms and triggers, provides clear summaries or what they log and surfaces relevant educational content and resource links. it summarizes the user's symptom logs. This digital tool design was based on promoting self-regulation, which ",t.createElement("a",{href:"https://pubmed.ncbi.nlm.nih.gov/26252889/",target:"_blank"},"studies")," demonstrate can improve conditions such as asthma. The Asthma Tool does not recommend any changes in management or provide diagnosis."),t.createElement("div",{style:{marginBottom:"16px"}},"To provide feedback on this report or tool, please e-mail us: ",t.createElement("a",{href:"mailto:asthma@careevolution.com",target:"_blank"},"asthma@careevolution.com")),t.createElement("div",{style:{marginBottom:"16px",height:"1px",backgroundColor:"#bdbdbd"}}),t.createElement("div",null,"If you plan to share this report with your provider, be aware that communications over email, text, and other channels may not be secure because they can be sent to the wrong address or intercepted.")),t.createElement("div",{style:{position:"absolute",bottom:32,right:48,fontSize:"16px",fontWeight:500,textAlign:"right"}},"Page 1 of 1")),t.createElement("div",{style:{textAlign:"center",margin:"64px 0",transform:"scale("+1/Y+")",transformOrigin:"top"}},f&&t.createElement(XA,null),!f&&t.createElement("button",{className:"mdhui-button",onClick:()=>(()=>{if(!e.previewState&&!f)if(y(!0),v)K(v);else{let e='<head><link href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap" rel="stylesheet"></head>';e+=g.current.outerHTML,w.persistDeviceData([{type:"ReportHtml",value:e}]).then((()=>{w.getDeviceInfo().then((function(e){b(e),K(e)}))}))}})()},t.createElement("div",null,"Generate PDF ",t.createElement(gge,{icon:te}))))))}function LEe(e){const[a,n]=c();if(id((()=>{if("none"===e.previewState)return void n(void 0);if("default"===e.previewState)return void n({number:"34",image:"medications"});let t=Rr();dEe.loadLogEntries(cn(new Date(t),{days:-10})).then((a=>{let i=_Se(t),r=a.find((e=>e.identifier===i));r&&dEe.loadSurveyAnswers(e.logTodayEntrySurveyName,t).then((e=>{((e,t,a)=>{let i=[];"controlled"===t.status?i.push({number:"21",image:"asthmacontrol"}):"not-determined"===t.status?i.push({number:"22",image:"asthmacontrol"}):"not-controlled"===t.status&&i.push({number:"25",image:"asthmacontrol"}),e.triggers.includes("Seasonal allergens/pollen")&&i.push({number:"42",image:"triggers"}),e.triggers.includes("Air pollution")&&i.push({number:"43",image:"triggers"}),e.triggers.includes("Cold/viral illness")&&i.push({number:"43a",image:"triggers"}),e.triggers.includes("Animal exposure")&&i.push({number:"43b",image:"triggers"}),e.triggers.includes("Smoke (tobacco or wood burning)")&&i.push({number:"43c",image:"triggers"}),e.triggers.includes("Extreme weather changes")&&i.push({number:"43d",image:"triggers"}),(e.triggers.includes("Strong smells")||e.triggers.includes("Chemicals/cleaning supplies"))&&i.push({number:"43e",image:"triggers"}),(e.triggers.includes("Dust")||e.triggers.includes("Dust mites"))&&i.push({number:"43f",image:"triggers"}),e.triggers.includes("Mold")&&i.push({number:"43g",image:"triggers"}),e.triggers.includes("Had heartburn")&&i.push({number:"43h",image:"triggers"});const r=["Taken a NSAID (non-steroidal anti-inflammatory drugs including aspirin and ibuprofen)","Taken a beta blocker","Had heartburn","Drank red wine","Tried any new foods","Cooked without a fan or open window","Had a pet sleep in your bed","Burned incense or a candle"];e.triggers.find((e=>r.includes(e)))&&i.push({number:"41",image:"triggers"});let o=a.find((e=>"MISSED_DOSES"===e.stepIdentifier));if(o&&(o.answers.includes("No controller med")&&i.push({number:"32",image:"medications"}),o.answers.includes("No missed doses"))){let e=a.find((e=>"MISSED_DOSES_INHALER_TYPE"===e.stepIdentifier));e&&(e.answers.includes("Metered-dose inhaler (MDI)")&&i.push({number:"37a",image:"medications"}),e.answers.includes("Dry-powder inhaler (DPI)")&&i.push({number:"37b",image:"medications"}),e.answers.includes("Soft mist inhaler")&&i.push({number:"37c",image:"medications"}),e.answers.includes("Nebulizer")&&i.push({number:"37d",image:"medications"}))}let s=a.find((e=>"MISSED_DOSES_REASONS"===e.stepIdentifier));s&&((s.answers.includes("Unable to afford the medications")||s.answers.includes("Don't want to run out, so purposefully skipping doses"))&&i.push({number:"33",image:"medications"}),s.answers.includes("Difficulty getting refills")&&i.push({number:"34",image:"medications"}),s.answers.includes("Trouble remembering to take them")&&i.push({number:"35",image:"medications"}),s.answers.includes("I'm confused which inhaler to take when")&&i.push({number:"36",image:"medications"}),s.answers.includes("Don't know why I should take it")&&i.push({number:"38",image:"medications"}),s.answers.includes("Concerns over side effects")&&i.push({number:"39",image:"medications"}),s.answers.includes("Medications not working")&&i.push({number:"39a",image:"medications"})),"severe"===e.symptomLevel&&i.push({number:"24",image:"asthmacontrol"}),i.length>0?n(i[Math.floor(Math.random()*i.length)]):n(void 0)})(r,CSe(a,t),e)}))}))}),[],[e.previewState]),!a)return null;let i=(t=>{let a=io(w.getCurrentLanguage());return{title:no(`asthma-recommended-article-${t.number}-title`),subTitle:no(`asthma-recommended-article-${t.number}-subtitle`),url:new URL(`atedu_${t.number}${"es"===a?"_es":""}.html`,e.libraryBaseUrl).href,imageUrl:new URL(`images/article_category_${t.image}${"es"===a?"_es":""}.svg`,e.libraryBaseUrl).href}})(a);return t.createElement("div",{className:"mdhui-asthma-recommended-article",style:e.style},t.createElement(aSe,{title:i.title,subTitle:i.subTitle,imageUrl:i.imageUrl,imageAlignment:e.imageAlignment,buttonVariant:e.buttonVariant,buttonText:e.buttonText,onClick:()=>{e.previewState||w.openEmbeddedUrl(i.url)},innerRef:e.innerRef}))}function FEe(e){return t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},t.createElement(XAe,{showCloseButton:!0}),t.createElement(pEe,{previewState:e.previewState,learnMoreUrl:e.learnMoreUrl,editActionPlanSurveyName:e.editActionPlanSurveyName}))}function BEe(e){const[a,n]=c();let i;return"default"===e.previewState&&(i=(e,t)=>Tc(e,t,2e3,2e4)),id((()=>{"default"!==e.previewState?dEe.loadParticipant().then((e=>{n(e.getStepsBaseline())})):n(1e4)})),t.createElement(Ka,{colorScheme:e.colorScheme??"auto",bodyBackgroundColor:"var(--mdhui-background-color-0)"},t.createElement(XAe,{variant:"compressed",showCloseButton:!0,backgroundColor:"var(--mdhui-background-color-0)"},t.createElement(sM,{order:1},no("asthma-activity-view-title"))),t.createElement(SAe,{previewState:"default"===e.previewState?"loaded with data":void 0,previewDataProvider:i,title:no("asthma-activity-view-chart-title"),dailyDataType:$Se.Steps,highlight:e=>!!a&&!qSe(a,e),emptyDomain:[0,1e4]}),"Steps"===e.alert&&t.createElement(yEe,{previewState:e.previewState?"loaded":void 0,message:no("asthma-activity-view-alert-message"),logEntrySurveyName:e.logEntrySurveyName}))}function HEe(e){let a;return"default"===e.previewState&&(a=(e,t)=>Tc(e,t,30,130)),t.createElement(Ka,{colorScheme:e.colorScheme??"auto",bodyBackgroundColor:"var(--mdhui-background-color-0)"},t.createElement(XAe,{variant:"compressed",showCloseButton:!0,backgroundColor:"var(--mdhui-background-color-0)"},t.createElement(sM,{order:1},no("asthma-air-quality-view-title"))),(!e.alert||"HomeAirQuality"===e.alert)&&t.createElement(SAe,{previewState:"default"===e.previewState?"loaded with data":void 0,previewDataProvider:a,title:no("asthma-air-quality-view-home-aqi-chart-title"),dailyDataType:Hr.HomeAirQuality,highlight:e=>e>100,emptyDomain:[0,160]}),(!e.alert||"WorkAirQuality"===e.alert)&&t.createElement(SAe,{previewState:"default"===e.previewState?"loaded with data":void 0,previewDataProvider:a,title:no("asthma-air-quality-view-work-aqi-chart-title"),dailyDataType:Hr.WorkAirQuality,highlight:e=>e>100,emptyDomain:[0,160]}),"HomeAirQuality"===e.alert&&t.createElement(yEe,{previewState:e.previewState?"loaded":void 0,message:no("asthma-air-quality-view-home-aqi-alert-message"),logEntrySurveyName:e.logEntrySurveyName}),"WorkAirQuality"===e.alert&&t.createElement(yEe,{previewState:e.previewState?"loaded":void 0,message:no("asthma-air-quality-view-work-aqi-alert-message"),logEntrySurveyName:e.logEntrySurveyName}))}function qEe(e){return t.createElement(Ka,{colorScheme:e.colorScheme??"auto",bodyBackgroundColor:"var(--mdhui-background-color-0)"},t.createElement(XAe,{showCloseButton:!0,backgroundColor:"var(--mdhui-background-color-0)"}),t.createElement("div",{style:{background:"#ccc",height:160,width:160,borderRadius:"50%",margin:"32px auto"}}),t.createElement(yEe,{previewState:e.previewState?"loaded":void 0,message:no("asthma-alert-takeover-message"),logEntrySurveyName:e.logEntrySurveyName}))}function UEe(e){const[a,n]=c(!0),[i,r]=c();return id((()=>{if(n(!0),"loading"!==e.previewState)return e.previewState?(r({getParticipantMode:()=>"as caregiver"===e.previewState?"Caregiver":"Self"}),void n(!1)):void dEe.loadParticipant().then((e=>{r(e),n(!1)}))}),[],[e.previewState]),t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},t.createElement(XAe,{variant:"compressed",showCloseButton:!0},t.createElement(sM,{order:2},sl(e.date))),a&&t.createElement(XA,null),!a&&t.createElement(t.Fragment,null,t.createElement(aS,null,t.createElement(OEe,{previewState:e.previewState?"logged with mild symptoms":void 0,date:e.date,logTodayEntrySurveyName:e.logTodayEntrySurveyName,logYesterdayEntrySurveyName:e.logYesterdayEntrySurveyName,editLogEntryUrl:e.editLogEntryUrl,infoUrl:e.logEntryInfoUrl})),"Caregiver"!==i.getParticipantMode()&&t.createElement(aS,null,t.createElement(wEe,{previewState:e.previewState?"all data":void 0,heartAndLungsUrl:e.heartAndLungsUrl,activityUrl:e.activityUrl,sleepUrl:e.sleepUrl,date:e.date})),t.createElement(aS,null,t.createElement(fEe,{previewState:e.previewState?"all data":void 0,airQualityUrl:e.airQualityUrl,date:e.date}))))}function VEe(e){const[a,n]=c(),[i,r]=c(),[o,s]=c(),[l,u]=c(),[d,h]=c();let m,p,g;return"default"===e.previewState&&(m=(e,t)=>Tc(e,t,30,150,!1),p=(e,t)=>Tc(e,t,10,50),g=(e,t)=>Tc(e,t,.85,1,!1)),id((()=>{if("default"===e.previewState)return n(90),r(90),s(30),u(.97),void h(.96);dEe.loadParticipant().then((e=>{n(e.getDaytimeRestingHeartRateBaseline()),r(e.getNighttimeRestingHeartRateBaseline()),s(e.getRespiratoryRateBaseline()),u(e.getDaytimeBloodOxygenLevelBaseline()),h(e.getNighttimeBloodOxygenLevelBaseline())}))})),t.createElement(Ka,{colorScheme:e.colorScheme??"auto",bodyBackgroundColor:"var(--mdhui-background-color-0)"},t.createElement(XAe,{variant:"compressed",showCloseButton:!0,backgroundColor:"var(--mdhui-background-color-0)"},t.createElement(sM,{order:1},no("asthma-heart-and-lungs-view-title"))),(!e.alert||"DaytimeRestingHeartRate"===e.alert)&&t.createElement(SAe,{previewState:"default"===e.previewState?"loaded with data":void 0,previewDataProvider:m,title:no("asthma-heart-and-lungs-view-dhr-chart-title"),dailyDataType:$Se.DaytimeRestingHeartRate,valueFormatter:e=>wl(e),highlight:e=>!!a&&!FSe(a,e),emptyDomain:[0,120]}),(!e.alert||"NighttimeRestingHeartRate"===e.alert)&&t.createElement(SAe,{previewState:"default"===e.previewState?"loaded with data":void 0,previewDataProvider:m,title:no("asthma-heart-and-lungs-view-nhr-chart-title"),dailyDataType:$Se.NighttimeRestingHeartRate,valueFormatter:e=>wl(e),highlight:e=>!!i&&!BSe(i,e),emptyDomain:[0,120]}),(!e.alert||"RespiratoryRate"===e.alert)&&t.createElement(SAe,{previewState:"default"===e.previewState?"loaded with data":void 0,previewDataProvider:p,title:no("asthma-heart-and-lungs-view-rr-chart-title"),dailyDataType:$Se.RespiratoryRate,highlight:e=>!!o&&!HSe(o,e),emptyDomain:[0,40]}),(!e.alert||"DaytimeBloodOxygenLevel"===e.alert)&&t.createElement(SAe,{previewState:"default"===e.previewState?"loaded with data":void 0,previewDataProvider:g,title:no("asthma-heart-and-lungs-view-dbol-chart-title"),dailyDataType:$Se.DaytimeBloodOxygenLevel,valueConverter:e=>100*e,valueFormatter:e=>wl(e),highlight:e=>!!l&&!VSe(l,e),domain:[80,100],emptyDomain:[80,100]}),(!e.alert||"NighttimeBloodOxygenLevel"===e.alert)&&t.createElement(SAe,{previewState:"default"===e.previewState?"loaded with data":void 0,previewDataProvider:g,title:no("asthma-heart-and-lungs-view-nbol-chart-title"),dailyDataType:$Se.NighttimeBloodOxygenLevel,valueConverter:e=>100*e,valueFormatter:e=>wl(e),highlight:e=>!!d&&!VSe(d,e),domain:[80,100],emptyDomain:[80,100]}),"DaytimeRestingHeartRate"===e.alert&&t.createElement(yEe,{previewState:e.previewState?"loaded":void 0,message:no("asthma-heart-and-lungs-view-dhr-alert-message"),logEntrySurveyName:e.logEntrySurveyName}),"NighttimeRestingHeartRate"===e.alert&&t.createElement(yEe,{previewState:e.previewState?"loaded":void 0,message:no("asthma-heart-and-lungs-view-nhr-alert-message"),logEntrySurveyName:e.logEntrySurveyName}),"RespiratoryRate"===e.alert&&t.createElement(yEe,{previewState:e.previewState?"loaded":void 0,message:no("asthma-heart-and-lungs-view-rr-alert-message"),logEntrySurveyName:e.logEntrySurveyName}),"DaytimeBloodOxygenLevel"===e.alert&&t.createElement(yEe,{previewState:e.previewState?"loaded":void 0,message:no("asthma-heart-and-lungs-view-dbol-alert-message"),logEntrySurveyName:e.logEntrySurveyName}),"NighttimeBloodOxygenLevel"===e.alert&&t.createElement(yEe,{previewState:e.previewState?"loaded":void 0,message:no("asthma-heart-and-lungs-view-nbol-alert-message"),logEntrySurveyName:e.logEntrySurveyName}))}A(".mdhui-asthma-recommended-article {\n padding: 0 16px;\n margin: 16px 0;\n}\n\n.mdhui-asthma-recommended-article .mdhui-resource {\n margin: 0;\n}");const WEe={identifier:_Se(new Date),symptomLevel:"none",symptoms:[],impacts:[],triggers:[]},$Ee={"no symptoms":{logEntry:WEe},"mild symptoms":{logEntry:{...WEe,symptomLevel:"mild",symptoms:["Coughing"],impacts:["Wake up at night","Use your rescue inhaler"],triggers:["Cold/viral illness","Seasonal allergens/pollen","Smoke (tobacco or wood burning)","Air pollution","Dust mites","Mold"]}},"moderate symptoms":{logEntry:{...WEe,symptomLevel:"moderate",symptoms:["Coughing"],triggers:["Cold/viral illness","Mold"]}},"severe symptoms":{logEntry:{...WEe,symptomLevel:"severe",symptoms:["Coughing","Wheezing"],impacts:["Use your rescue inhaler"]}}};function GEe(e){let a=cn(Rr(),{days:-1});if(Ti(e.date,a))return w.dismiss(),null;const[n,i]=c(!0),[r,o]=c();id((()=>{if(i(!0),"loading"===e.previewState)return;if(e.previewState)return o($Ee[e.previewState].logEntry),void i(!1);let t=cn(new Date(e.date),{days:-1}),a=cn(new Date(e.date),{days:1});dEe.loadLogEntries(t,a).then((t=>{let a=_Se(e.date),n=t.find((e=>e.identifier===a));n?o(n):w.dismiss(),i(!1)}))}),[],[e.previewState]);const s=e=>{(e=>{let t={...r,symptomLevel:e};"none"===e&&(t.symptoms=[]),o(t)})(MSe(e))},l=e=>{(e=>{let t={...r,symptoms:e};e.length>0&&"none"===t.symptomLevel&&(t.symptomLevel="mild"),o(t)})(ISe(e))},u=t.createElement(S,{className:"button",style:{left:"16px"},onClick:()=>{e.previewState||w.dismiss()}},"Cancel"),d=t.createElement(S,{className:"button",style:{color:"#fff",background:"#369cff",right:"16px",padding:"0 16px"},onClick:()=>{n||e.previewState||dEe.saveLogEntry(r).then((()=>{w.dismiss()}))}},"Save");return t.createElement(Ka,{colorScheme:e.colorScheme??"auto",bodyBackgroundColor:"var(--mdhui-background-color-0)"},t.createElement(XAe,{title:sl(e.date),navigationBarLeft:u,navigationBarRight:d,variant:"compressed",backgroundColor:"var(--mdhui-background-color-0)"}),n&&t.createElement(XA,null),!n&&r&&t.createElement("div",null,t.createElement(aS,{backgroundColor:"var(--mdhui-background-color-1)"},t.createElement(vSe,{title:no("asthma-log-entry-editor-view-symptom-level-title"),subtitle:no("asthma-log-entry-editor-view-select-one-subtitle"),values:[no("asthma-symptom-level-none"),no("asthma-symptom-level-mild"),no("asthma-symptom-level-moderate"),no("asthma-symptom-level-severe")],selectedValues:[OSe(r.symptomLevel)],preventEmptySelections:!0,onChange:e=>s(e[0])})),t.createElement(aS,{backgroundColor:"var(--mdhui-background-color-1)"},t.createElement(vSe,{title:no("asthma-log-entry-editor-view-symptoms-title"),subtitle:no("asthma-log-entry-editor-view-select-all-subtitle"),values:[no("asthma-symptom-difficulty-breathing"),no("asthma-symptom-wheezing"),no("asthma-symptom-coughing"),no("asthma-symptom-chest-tightness")],selectedValues:DSe(r.symptoms),variant:"checkboxes",multiSelect:!0,onChange:e=>l(e)})),t.createElement(aS,{backgroundColor:"var(--mdhui-background-color-1)"},t.createElement(vSe,{title:no("asthma-log-entry-editor-view-impacts-title"),subtitle:no("asthma-log-entry-editor-view-select-all-subtitle"),values:[no("asthma-impact-waking-at-night"),no("asthma-impact-limit-daily-activity"),no("asthma-impact-using-rescue-inhaler")],selectedValues:NSe(r.impacts),variant:"checkboxes",multiSelect:!0,onChange:e=>{return t=e,void o({...r,impacts:jSe(t)});var t}})),t.createElement(aS,{backgroundColor:"var(--mdhui-background-color-1)"},t.createElement(vSe,{title:no("asthma-log-entry-editor-view-triggers-title"),subtitle:no("asthma-log-entry-editor-view-select-all-subtitle"),values:[no("asthma-trigger-cold-illness"),no("asthma-trigger-animal-exposure"),no("asthma-trigger-seasonal-allergens"),no("asthma-trigger-exercise"),no("asthma-trigger-smoke"),no("asthma-trigger-weather-changes"),no("asthma-trigger-air-pollution"),no("asthma-trigger-strong-smells"),no("asthma-trigger-chemicals"),no("asthma-trigger-dust"),no("asthma-trigger-mold"),no("asthma-trigger-dust-mites"),no("asthma-trigger-rodents"),no("asthma-trigger-cockroaches"),no("asthma-trigger-nsaid"),no("asthma-trigger-beta-blocker"),no("asthma-trigger-heartburn"),no("asthma-trigger-red-wine"),no("asthma-trigger-new-foods"),no("asthma-trigger-cooked-without-ventilation"),no("asthma-trigger-pet-in-bed"),no("asthma-trigger-incense-or-candle")],selectedValues:zSe(r.triggers),variant:"checkboxes",multiSelect:!0,onChange:e=>{return t=e,void o({...r,triggers:RSe(t)});var t}}))))}function KEe(e){return t.createElement(Ka,{colorScheme:"light"},t.createElement(XAe,{variant:"compressed",showCloseButton:!0},t.createElement(sM,{order:1},"Provider Report")),t.createElement(REe,{previewState:e.previewState,logEntrySurveyName:e.logEntrySurveyName}))}function ZEe(e){const[a,n]=c();let i;return"default"===e.previewState&&(i=(e,t)=>Tc(e,t,0,15)),id((()=>{"default"!==e.previewState?dEe.loadParticipant().then((e=>{n(e.getSleepDisturbancesBaseline())})):n(5)})),t.createElement(Ka,{colorScheme:e.colorScheme??"auto",bodyBackgroundColor:"var(--mdhui-background-color-0)"},t.createElement(XAe,{variant:"compressed",showCloseButton:!0,backgroundColor:"var(--mdhui-background-color-0)"},t.createElement(sM,{order:1},no("asthma-sleep-view-title"))),t.createElement(SAe,{previewState:"default"===e.previewState?"loaded with data":void 0,previewDataProvider:i,title:no("asthma-sleep-view-chart-title"),dailyDataType:$Se.SleepDisturbances,highlight:e=>!!a&&!USe(a,e),emptyDomain:[0,16]}),"SleepDisturbances"===e.alert&&t.createElement(yEe,{previewState:e.previewState?"loaded":void 0,message:no("asthma-sleep-view-alert-message"),logEntrySurveyName:e.logEntrySurveyName}))}function YEe(e){return t.createElement(Ka,{colorScheme:"light",className:"mdhui-step-container"+(e.className?` ${e.className}`:""),bodyBackgroundColor:"#FFFFFF"},e.children)}function XEe(e){return{textAlign:e.textAlign,color:e.color,fontSize:e.fontSize?`${e.fontSize}px`:void 0,fontWeight:e.fontWeight,backgroundImage:""}}A(".mdhui-step-container {\n background-color: #FFFFFF;\n}\n\n.mdhui-step-container div,\n.mdhui-step-container dl,\n.mdhui-step-container dt,\n.mdhui-step-container dd,\n.mdhui-step-container ul,\n.mdhui-step-container ol,\n.mdhui-step-container li,\n.mdhui-step-container h1,\n.mdhui-step-container h2,\n.mdhui-step-container h3,\n.mdhui-step-container h4,\n.mdhui-step-container h5,\n.mdhui-step-container h6,\n.mdhui-step-container pre,\n.mdhui-step-container form,\n.mdhui-step-container fieldset,\n.mdhui-step-container input,\n.mdhui-step-container textarea,\n.mdhui-step-container p,\n.mdhui-step-container blockquote,\n.mdhui-step-container th,\n.mdhui-step-container td {\n margin: 0;\n padding: 0;\n}\n\n.mdhui-step-container a {\n color: var(--mdhui-color-primary);\n text-decoration: none;\n}\n\n.mdhui-step-container ol {\n list-style-type: decimal;\n white-space: normal;\n list-style-position: inside;\n}\n\n.mdhui-step-container ul {\n list-style-type: disc;\n text-align: left;\n display: block;\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n padding-inline-start: 40px;\n white-space: normal;\n}\n\n.mdhui-step-container ul ul {\n list-style-type: circle;\n}\n\n.mdhui-step-container ul ul ul {\n list-style-type: square;\n}");function QEe(e){let a,n=new K_;a=e.inline?n.renderInline(e.text??""):n.render(e.text??""),a=a?.trim();let i=tM(a,{replace:e=>{let t=e;"a"===t.name&&(t.attribs.target="_blank")}});return t.createElement(t.Fragment,null,i)}function JEe(e){return e.text?t.createElement("div",{className:"mdhui-step-title",style:XEe(e)},t.createElement(QEe,{text:e.text,inline:!0})):null}A(".mdhui-step-container .mdhui-step-title {\n text-align: center;\n font-size: 1.7em;\n line-height: 1.2em;\n font-weight: normal;\n margin-top: 20px;\n margin-bottom: 15px;\n margin-left: 20px;\n margin-right: 20px; \n position: relative;\n display: block;\n}");function e_e(e){return e.text?t.createElement("div",{className:"mdhui-step-text",style:XEe(e)},t.createElement(QEe,{text:e.text})):null}A(".mdhui-step-container .mdhui-step-text {\n font-size: 1em;\n line-height: 1.3em;\n text-align: center;\n margin-top: 15px;\n margin-bottom: 15px;\n margin-left: 20px;\n margin-right: 20px; \n white-space: pre-line;\n}");function t_e(e){return e.text?t.createElement("div",{className:"mdhui-step-detail-text",style:XEe(e)},t.createElement(QEe,{text:e.text})):null}A(".mdhui-step-container .mdhui-step-detail-text {\n font-size: 1em;\n line-height: 1.3em;\n text-align: center;\n margin-top: 15px;\n margin-bottom: 15px;\n margin-left: 20px;\n margin-right: 20px;\n white-space: pre-line;\n}");function a_e(e){const a=XEe(e);if(e.gradient){var n="LeftToRight"===e.gradient.direction?`linear-gradient(to right, ${e.gradient.startColor} 0%, ${e.gradient.endColor} 100%)`:`linear-gradient(to bottom, ${e.gradient.startColor} 0%, ${e.gradient.endColor} 100%)`;a.backgroundImage=n}a.letterSpacing=e.letterSpacing,a.textTransform=e.textTransform,a.backgroundColor=e.backgroundColor,a.borderColor=e.backgroundColor;var i=e.text?e.text:no("next-button-text");return t.createElement("button",{className:"mdhui-step-next-button",style:a,disabled:e.disabled,onClick:e.onClick},i)}A(".mdhui-step-container .mdhui-step-next-button {\n margin: 20px;\n padding: 16px;\n background: var(--mdhui-color-primary);\n font-size: 1em;\n color: #FFF;\n font-weight: bold;\n border: solid 1px var(--mdhui-color-primary);\n border-radius: 5px;\n cursor: pointer;\n width: calc(100% - 40px);\n box-sizing: border-box;\n text-align: center;\n display: inline-block;\n}\n\n.mdhui-step-container .mdhui-step-next-button:disabled,\n.mdhui-step-container .mdhui-step-next-button[disabled] {\n opacity: 0.65;\n cursor: not-allowed;\n}");var n_e=150,i_e=2,r_e=["DodgerBlue","OliveDrab","Gold","Pink","SlateBlue","LightBlue","Violet","PaleGreen","SteelBlue","SandyBrown","Chocolate","Crimson"],o_e=!1,s_e=null,l_e=[],c_e=0;function u_e(e,t,a){return e.color=r_e[Math.random()*r_e.length|0],e.x=Math.random()*t,e.y=Math.random()*a-a,e.diameter=10*Math.random()+5,e.tilt=10*Math.random()-10,e.tiltAngleIncrement=.07*Math.random()+.05,e.tiltAngle=0,e}function d_e(){var e=window.innerWidth,t=window.innerHeight,a=window.requestAnimationFrame||function(e){return window.setTimeout(e,16.6666667)},n=document.getElementById("confetti-canvas");null===n&&((n=document.createElement("canvas")).setAttribute("id","confetti-canvas"),n.setAttribute("style","display:block;z-index:999999;pointer-events:none;position:fixed;top:0"),document.body.prepend(n),n.width=e,n.height=t,window.addEventListener("resize",(function(){n.width=window.innerWidth,n.height=window.innerHeight}),!0));for(var i=n.getContext("2d");l_e.length<n_e;)l_e.push(u_e({color:"",x:0,y:0,diameter:0,tilt:0,tiltAngleIncrement:0,tiltAngle:0},e,t));o_e=!0,null===s_e&&function e(){i?.clearRect(0,0,window.innerWidth,window.innerHeight),0===l_e.length?s_e=null:(!function(){var e,t=window.innerWidth,a=window.innerHeight;c_e+=.01;for(var n=0;n<l_e.length;n++)e=l_e[n],!o_e&&e.y<-15?e.y=a+100:(e.tiltAngle+=e.tiltAngleIncrement,e.x+=Math.sin(c_e),e.y+=.5*(Math.cos(c_e)+e.diameter+i_e),e.tilt=15*Math.sin(e.tiltAngle)),(e.x>t+20||e.x<-20||e.y>a)&&(o_e&&l_e.length<=n_e?u_e(e,t,a):(l_e.splice(n,1),n--))}(),function(e){if(e)for(var t,a,n=0;n<l_e.length;n++)t=l_e[n],e.beginPath(),e.lineWidth=t.diameter,e.strokeStyle=t.color,a=t.x+t.tilt,e.moveTo(a+t.diameter/2,t.y),e.lineTo(a,t.y+t.tilt+t.diameter/2),e.stroke()}(i),s_e=a(e))}()}function h_e(){o_e=!1}function m_e(e){return e.srcUrl?t.createElement("div",{className:"mdhui-step-image-icon"},t.createElement("img",{src:e.srcUrl})):null}A(".mdhui-step-container .mdhui-step-image-icon {\n text-align: center;\n}\n\n.mdhui-step-container .mdhui-step-image-icon img {\n max-width: 100%;\n max-height: 60px;\n padding: 0;\n margin: 0;\n padding-top: 50px;\n}");function p_e(e){return e.srcUrl?t.createElement("div",{className:"mdhui-step-image"},t.createElement("img",{src:e.srcUrl})):null}function g_e(e){function a(){0!==window.innerWidth&&0!==window.innerHeight?(d_e(),window.setTimeout((function(){h_e()}),1200)):window.setTimeout(a,50)}return l((()=>{a()}),[]),t.createElement(YEe,null,t.createElement(m_e,{srcUrl:e.iconUrl}),t.createElement(JEe,{text:e.title,textAlign:e.styles.titleAlignment,color:e.styles.titleColor,fontSize:e.styles.titleFontSize,fontWeight:e.styles.titleFontWeight}),t.createElement(e_e,{text:e.text,textAlign:e.styles.textAlignment,color:e.styles.textColor,fontSize:e.styles.textFontSize,fontWeight:e.styles.textFontWeight}),t.createElement(t_e,{text:e.detailText,textAlign:e.styles.textAlignment,color:e.styles.textColor,fontSize:e.styles.textFontSize,fontWeight:e.styles.textFontWeight}),t.createElement(p_e,{srcUrl:e.imageUrl}),t.createElement(a_e,{text:e.nextButtonText,color:e.styles.nextButtonTextColor,fontWeight:e.styles.nextButtonFontWeight,backgroundColor:e.styles.nextButtonBackgroundColor,letterSpacing:e.styles.nextButtonLetterSpacing,textTransform:e.styles.nextButtonTextTransform?.toLowerCase(),gradient:e.styles.nextButtonBackgroundGradient,onClick:()=>w.completeStep("")}))}function f_e(){const[e,a]=c(),[n,i]=c(),[r,o]=c(),[s,u]=c(),[d,h]=c(),[m,p]=c(),[g,f]=c({});return l((()=>{w.getStepConfiguration().then((function(e){e&&(a(e.properties.title),i(e.properties.text),o(e.properties.detailText),u(e.properties.iconImage),h(e.properties.image),p(e.properties.nextButtonText),f(e.styles??{}))}))}),[]),t.createElement(g_e,{title:e,text:n,detailText:r,iconUrl:s,imageUrl:d,nextButtonText:m,styles:g})}function y_e(e){const a=no("connect-to-device").replace("@@DEVICE@@",e.deviceType);return t.createElement(YEe,null,t.createElement(JEe,{text:e.title,textAlign:e.styles.titleAlignment,color:e.styles.titleColor,fontSize:e.styles.titleFontSize,fontWeight:e.styles.titleFontWeight}),t.createElement(e_e,{text:e.text,textAlign:e.styles.textAlignment,color:e.styles.textColor,fontSize:e.styles.textFontSize,fontWeight:e.styles.textFontWeight}),t.createElement(a_e,{text:a,color:e.styles.nextButtonTextColor,fontWeight:e.styles.nextButtonFontWeight,backgroundColor:e.styles.nextButtonBackgroundColor,letterSpacing:e.styles.nextButtonLetterSpacing,textTransform:e.styles.nextButtonTextTransform?.toLowerCase(),gradient:e.styles.nextButtonBackgroundGradient,onClick:e.onConnect}))}function v_e(){const[e,a]=c(),[n,i]=c(),[r,o]=c({}),[s,u]=c(),[d,h]=c(!0);function m(e){switch(e){case"Fitbit":return oU();case"Omron":return cU();case"Garmin":return sU();case"Oura":return uU()}}return l((()=>{w.getStepConfiguration().then((function(e){if(a(e.properties.title),i(e.properties.text),!e.properties.deviceType)throw new Error("deviceType is required");u(e.properties.deviceType),o(e.styles??{}),async function(e){try{const t=await w.getExternalAccounts(),a=m(e);t.some((e=>e.provider.id===a))&&w.completeStep(a)}finally{h(!1)}}(e.properties.deviceType)}))}),[]),d||!s?t.createElement(t.Fragment,null):t.createElement(y_e,{title:e,text:n,deviceType:s,providerID:m(s),styles:r,onConnect:function(){const e=m(s);w.connectExternalAccount(e,{openNewWindow:!0}).then((function(){w.completeStep(e)}))}})}A(".mdhui-step-container .mdhui-step-image {\n text-align: center;\n}\n.mdhui-step-container .mdhui-step-image img {\n width: 100%;\n padding: 0;\n margin: 0;\n padding-top: 40px;\n padding-bottom: 40px;\n}");function b_e(e){return t.createElement(YEe,{className:"mdhui-connect-ehr-step"},t.createElement(JEe,{text:e.title,textAlign:e.styles.titleAlignment,color:e.styles.titleColor,fontSize:e.styles.titleFontSize,fontWeight:e.styles.titleFontWeight}),t.createElement(e_e,{text:e.text,textAlign:e.styles.textAlignment,color:e.styles.textColor,fontSize:e.styles.textFontSize,fontWeight:e.styles.textFontWeight}),t.createElement(AAe,{previewState:e.previewState,providerCategories:["Provider","Health Plan"],onProviderConnected:e.onProviderConnected}),t.createElement(a_e,{text:e.nextButtonText,disabled:e.nextButtonDisabled,color:e.styles.nextButtonTextColor,fontWeight:e.styles.nextButtonFontWeight,backgroundColor:e.styles.nextButtonBackgroundColor,letterSpacing:e.styles.nextButtonLetterSpacing,textTransform:e.styles.nextButtonTextTransform?.toLowerCase(),gradient:e.styles.nextButtonBackgroundGradient,onClick:e.onNextButtonClick}))}function w_e(){const[e,a]=c(),[n,i]=c(),[r,o]=c(),[s,u]=c(),[d,h]=c(!0),[m,p]=c({}),[g,f]=c([]);return l((()=>{w.getStepConfiguration().then((function(e){e&&(a(e.properties.title),i(e.properties.text),u(e.properties.nextButtonText),p(e.styles??{}))})),w.getSurveyContext().then((function(e){e&&o(e)}))}),[]),t.createElement(b_e,{title:e,text:n,nextButtonText:s,nextButtonDisabled:d,styles:m,onProviderConnected:function(e){f((t=>[...t,e.id])),h(!1)},previewState:"Design"===r?.surveyMode?"Default":void 0,onNextButtonClick:()=>w.completeStep(g.toString())})}function x_e(e){let a=(e.height?e.height:"225")+"px",n=w.getCurrentLanguage();return t.createElement(YEe,null,t.createElement(JEe,{text:e.title,textAlign:e.styles.titleAlignment,color:e.styles.titleColor,fontSize:e.styles.titleFontSize,fontWeight:e.styles.titleFontWeight}),t.createElement(e_e,{text:e.text,textAlign:e.styles.textAlignment,color:e.styles.textColor,fontSize:e.styles.textFontSize,fontWeight:e.styles.textFontWeight}),t.createElement("div",{style:{textAlign:"center",width:"100%"}},t.createElement("iframe",{style:{width:"100%",height:a,border:0},src:`https://www.youtube.com/embed/${e.videoId}?rel=0&cc_lang_pref=${n}&controls=1&autoplay=0&fs=1&modestbranding=1`,title:"YouTube video player",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; fullscreen",allowFullScreen:!0})),t.createElement(t_e,{text:e.transcript,textAlign:e.styles.detailTextAlignment,color:e.styles.detailTextColor,fontSize:e.styles.detailTextFontSize,fontWeight:e.styles.detailTextFontWeight}),t.createElement(a_e,{text:e.nextButtonText,color:e.styles.nextButtonTextColor,fontWeight:e.styles.nextButtonFontWeight,backgroundColor:e.styles.nextButtonBackgroundColor,letterSpacing:e.styles.nextButtonLetterSpacing,textTransform:e.styles.nextButtonTextTransform?.toLowerCase(),gradient:e.styles.nextButtonBackgroundGradient,onClick:()=>w.completeStep("")}))}function k_e(){const[e,a]=c(),[n,i]=c(),[r,o]=c(),[s,u]=c(""),[d,h]=c(),[m,p]=c(),[g,f]=c({});return l((()=>{w.getStepConfiguration().then((function(e){e&&(a(e.properties.title),i(e.properties.text),o(e.properties.transcript),u(e.properties.videoId),h(e.properties.nextButtonText),p(e.properties.height),f(e.styles??{}))}))}),[]),t.createElement(x_e,{title:e,text:n,transcript:r,nextButtonText:d,height:m,videoId:s,styles:g})}A(".mdhui-step-container.mdhui-connect-ehr-step .mdhui-provider-search {\n margin-bottom: 94px;\n}\n.mdhui-step-container.mdhui-connect-ehr-step .mdhui-step-next-button {\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n}");function A_e(e){e.customFields.Symptoms?.length||(e.customFields.Symptoms="[]"),e.customFields.Treatments?.length||(e.customFields.Treatments="[]");var t=[];try{t=JSON.parse(e.customFields.Symptoms)}catch(a){t=JSON.parse(e.customFields.Symptoms.replace(/\\/g,""))}t.sort(((e,t)=>e.name>t.name?1:t.name>e.name?-1:0)),t.forEach((e=>{e.severityTracking||(e.severityTracking="None")}));var a=[];try{a=JSON.parse(e.customFields.Treatments)}catch(t){a=JSON.parse(e.customFields.Treatments.replace(/\\/g,""))}return a.sort(((e,t)=>e.name>t.name?1:t.name>e.name?-1:0)),{participantID:e.participantID,symptoms:t,treatments:a}}A(".ss-symptom-matrix {\n background: var(--mdhui-background-color-0);\n /* Default color for PDF Rendering, since evopdf does not support CSS variables */\n border-top: solid 1px #ddd;\n border-top: solid 1px var(--mdhui-border-color-1);\n}");var S_e={getConfiguration:function(){return w.getParticipantInfo().then((function(e){return A_e(e)}))},getDailyLogEntries:function(e,t){var a={},n=function(i){var r={namespace:"Project",type:"DailyLogEntry",pageID:i};return e&&(r.observedAfter=e),t&&(r.observedBefore=t),w.queryDeviceData(r).then((function(e){for(var t=e.deviceDataPoints,i=0;i<t.length;i++){var r=JSON.parse(t[i].value),o=t[i].observationDate;o&&(a[o.substring(0,10)]=E_e(r))}return e.nextPageID?n(e.nextPageID):a}))};return n()},saveDailyLogEntry:function(e,t){return w.persistDeviceData([{type:"DailyLogEntry",observationDate:e+"T00:00:00.000Z",value:JSON.stringify(t)}])}};function E_e(e){e.starred&&(e.icon="star");var t={overallFeeling:e.overallFeeling,notes:e.notes,symptoms:e.symptoms.map((e=>"string"==typeof e?{id:e}:e)),treatments:e.treatments.map((e=>"string"==typeof e?{id:e}:e)),icon:e.icon};return t}function __e(e){return t.createElement("div",{ref:e.innerRef,className:"mdhui-ss-symptom-treatment-filters"},t.createElement(S,{className:"mdhui-ss-symptom-treatment-filter-dropdown-button",onClick:()=>"Symptoms"==e.expandedDropdown?e.onExpandedDropdownChange(null):e.onExpandedDropdownChange("Symptoms"),style:{fontWeight:e.selectedSymptoms.length>0?"bold":""}},no("select-symptoms")," ",t.createElement(gge,{icon:"Symptoms"==e.expandedDropdown?F:ce}),t.createElement(tS,null)),t.createElement(S,{className:"mdhui-ss-symptom-treatment-filter-dropdown-button",onClick:()=>"Treatments"==e.expandedDropdown?e.onExpandedDropdownChange(null):e.onExpandedDropdownChange("Treatments"),style:{fontWeight:e.selectedTreatments.length>0?"bold":""}},no("select-treatments")," ",t.createElement(gge,{icon:"Treatments"==e.expandedDropdown?F:ce}),t.createElement(tS,null)),"Symptoms"==e.expandedDropdown&&t.createElement("div",{className:"mdhui-ss-symptom-treatment-filter-items-list"},e.configuration.symptoms.filter((e=>!e.inactive)).map((a=>t.createElement(ySe,{className:"mdhui-ss-symptom-treatment-filter-item",selected:-1!=e.selectedSymptoms.indexOf(a.id),onClick:()=>{return t=a,-1!=(n=[...e.selectedSymptoms]).indexOf(t.id)?n.splice(n.indexOf(t.id),1):n.push(t.id),void e.onSymptomsSelectionChange(n);var t,n},color:a.color,key:a.id,text:a.name})))),"Treatments"==e.expandedDropdown&&t.createElement("div",{className:"mdhui-ss-symptom-treatment-filter-items-list"},e.configuration.treatments.filter((e=>!e.inactive)).map((a=>t.createElement(ySe,{className:"mdhui-ss-symptom-treatment-filter-item",selected:-1!=e.selectedTreatments.indexOf(a.id),onClick:()=>{return t=a,-1!=(n=[...e.selectedTreatments]).indexOf(t.id)?n.splice(n.indexOf(t.id),1):n.push(t.id),void e.onTreatmentsSelectionChange(n);var t,n},color:a.color,key:a.id,text:a.name})))))}A(".mdhui-ss-symptom-treatment-filters .mdhui-ss-symptom-treatment-filter-dropdown-button {\n width: 50%;\n display: inline-block;\n box-sizing: border-box;\n padding: 16px 8px;\n background: var(--mdhui-color-primary);\n text-align: center;\n font-size: .88em;\n cursor: pointer;\n color: #FFF;\n position: relative;\n white-space: nowrap;\n}\n\n.mdhui-ss-symptom-treatment-filters .mdhui-ss-symptom-treatment-filter-dropdown-button:first-child {\n border-right: solid 1px var(--mdhui-border-color-1);\n}\n\n.mdhui-ss-symptom-treatment-filters .mdhui-ss-symptom-treatment-filter-items-list {\n background: var(--mdhui-background-color-0);\n text-align: center;\n padding: 12px;\n padding-top: 8px;\n padding-bottom: 8px;\n border-bottom: solid 4px var(--ss-primary-theme-color);\n}\n\n.mdhui-ss-symptom-treatment-filters .mdhui-ss-symptom-treatment-filter-item {\n margin: 4px;\n}");var C_e=[{severityTracking:"10PointScale",color:"#c4291c",name:"Headache",id:"Headache"},{severityTracking:"3PointScale",color:"#e35c33",name:"Fatigue",id:"Fatigue"},{severityTracking:"None",color:"#5db37e",name:"Nausea",id:"Nausea"},{severityTracking:"None",color:"#429bdf",name:"Anxiety",id:"Anxiety"},{severityTracking:"None",color:"#7b88c6",name:"Brain Fog",id:"Brain Fog"},{severityTracking:"None",color:"#616161",name:"Back Pain",id:"Back Pain"},{severityTracking:"None",color:"#d98177",name:"Insomnia",id:"Insomnia"}],T_e=[{color:"#616161",id:"Tylenol",name:"Tylenol"},{color:"#429BDF",id:"Rest",name:"Rest"},{color:"#d98177",id:"Ice",name:"Ice"},{color:"#5db37e",id:"Stretching",name:"Stretching"},{color:"#e35c33",id:"Meditation",name:"Meditation"}];C_e.sort(((e,t)=>e.name>t.name?1:t.name>e.name?-1:0)),T_e.sort(((e,t)=>e.name>t.name?1:t.name>e.name?-1:0));var P_e={},O_e=cn(new Date,{days:-29});function M_e(e,t,a,n,i){P_e[Br(O_e)]={symptoms:e.map((e=>({id:e,severity:Math.floor(10*Math.random())+1}))),treatments:t.map((e=>({id:e}))),notes:i?"notes":"",icon:n,overallFeeling:a},O_e=cn(O_e,{days:1})}M_e(["Headache","Insomnia"],["Tylenol"],2,"moon-o",!0),M_e(["Brain Fog","Nausea"],["Tylenol","Ice"],4),M_e(["Headache"],["Tylenol"],3),M_e(["Headache","Insomnia"],["Tylenol"],3),M_e([],[],5),M_e(["Fatigue","Back Pain","Anxiety","Nausea"],["Stretching","Rest","Ice"],1),M_e([],[],5),M_e(["Fatigue","Back Pain","Anxiety","Nausea","Headache","Insomnia","Brain Fog"],["Stretching","Rest","Ice","Meditation","Tylenol"],1,"star-o",!0),M_e(["Fatigue","Nausea","Headache"],["Stretching"],2),M_e(["Anxiety","Brain Fog"],["Rest","Meditation"],3,void 0,!0),M_e([],[],5),M_e(["Back Pain","Headache"],["Ice","Tylenol"],4),M_e(["Fatigue","Back Pain","Nausea","Brain Fog"],["Meditation","Tylenol"],2),M_e([],[],5),M_e(["Fatigue","Insomnia","Brain Fog"],["Rest"],4,"star",!0),M_e(["Fatigue","Back Pain"],["Stretching","Rest"],3),M_e(["Fatigue","Nausea"],["Stretching","Rest","Ice","Meditation","Tylenol"],2,"flag",!0),M_e(["Headache","Insomnia","Brain Fog"],["Stretching","Tylenol"],4,"user-md",!0),M_e([],[],5),M_e([],[],5),M_e([],[],5),M_e(["Back Pain","Headache"],["Ice","Tylenol"],4),M_e(["Fatigue","Back Pain","Nausea","Brain Fog"],["Meditation","Tylenol"],2),M_e(["Fatigue","Back Pain","Anxiety","Nausea"],["Stretching","Rest","Ice"],1),M_e(["Fatigue","Insomnia","Brain Fog"],["Rest"],4,"question-circle-o",!0),M_e(["Fatigue","Back Pain","Anxiety","Nausea","Headache","Insomnia","Brain Fog"],["Stretching","Rest","Ice","Meditation","Tylenol"],1,"flask",!0),M_e([],[],5),M_e(["Headache","Insomnia"],["Tylenol"],3),M_e([],[],5),M_e(["Fatigue","Insomnia"],["Rest"],2,"trophy",!0);const D_e=o(null);function I_e(e){const[a,n]=c(null),[i,r]=c([]),[o,s]=c([]),[u,d]=c(null);let[h,m]=c(null);function p(){if("default"==e.previewState)return m({symptoms:C_e,treatments:T_e,participantID:"1"}),void n({symptoms:C_e,treatments:T_e,logEntries:P_e,hasFilteredSymptoms:!1});S_e.getConfiguration().then((function(e){S_e.getDailyLogEntries().then((function(t){m(e),h=e,n({symptoms:g(i),treatments:f(o),logEntries:t,hasFilteredSymptoms:!1})}))}))}function g(e){return h.symptoms.filter((t=>(!e.length||e.includes(t.id))&&!t.inactive))}function f(e){return h.treatments.filter((t=>(!e.length||e.includes(t.id))&&!t.inactive))}return l((()=>(p(),w.on("applicationDidBecomeVisible",p),()=>{w.off("applicationDidBecomeVisible",p)})),[]),a&&h?t.createElement("div",{ref:e.innerRef},t.createElement(D_e.Provider,{value:a},e.showFilters&&t.createElement(oSe,{noTopMargin:!0},t.createElement(__e,{configuration:h,selectedSymptoms:i,onSymptomsSelectionChange:e=>function(e){n({...a,symptoms:g(e),hasFilteredSymptoms:!!e.length}),r(e)}(e),selectedTreatments:o,onTreatmentsSelectionChange:e=>function(e){n({...a,treatments:f(e)}),s(e)}(e),expandedDropdown:u,onExpandedDropdownChange:e=>d(e)})),e.children)):t.createElement(XA,null)}function N_e(e){let a=r(D_e);if(!a)return t.createElement($q,{innerRef:e.innerRef},"Error: Symptom Matrix must be used inside a Symptom Shark Visualization Coordinator.");let n=r(rM),i=e.intervalStart||In(new Date);if(n&&(i=n.intervalStart),!a.symptoms.length&&!a.treatments.length)return null;var o=nl(i.getFullYear(),i.getMonth()),s=a.symptoms.map((e=>({label:e.name,color:e.color,data:o.map((t=>!!function(e,t){var n=Br(e);return!!a.logEntries[n]&&a.logEntries[n].symptoms.find((e=>e.id==t))}(t,e.id)))}))),l=a.treatments.map((e=>({label:e.name,color:e.color,data:o.map((t=>!!function(e,t){var n=Br(e);return!!a.logEntries[n]&&a.logEntries[n].treatments.find((e=>e.id==t))}(t,e.id)))})));return t.createElement("div",{ref:e.innerRef,className:"ss-symptom-matrix"},t.createElement(YAe,{title:no("symptoms"),rows:s,intervalStart:i}),t.createElement(YAe,{title:no("treatments"),rows:l,intervalStart:i}))}function j_e(e){let a=r(D_e);if(!a)return t.createElement($q,{innerRef:e.innerRef},"Error: Symptom Calendar must be used inside a Symptom Shark Visualization Coordinator.");let{symptoms:n,treatments:i,logEntries:o}=a,s=r(rM),l=e.intervalStart||In(new Date);return s&&(l=s.intervalStart),t.createElement(JA,{innerRef:e.innerRef,className:"mdhui-ss-calendar",month:l.getMonth(),year:l.getFullYear(),dayRenderer:function(a,r,s){if(!s)return t.createElement("div",null);var c=new Date(a,r,s),u=o[Br(c)],d=!1;return c>new Date&&(d=!0),t.createElement(z_e,{onClick:t=>function(t){var a=new Date(l.getFullYear(),l.getMonth(),t);a>new Date||e.onDaySelected(a)}(t),day:s,logEntry:u,symptomConfigurations:n,treatmentConfigurations:i,future:d})}})}function z_e(e){return t.createElement(S,{className:"mdhui-ss-calendar-day"+(e.future?" future":""),onClick:()=>e.onClick(e.day)},function(){if(!e.logEntry)return t.createElement(uM,{className:"mdhui-ss-day-tracker",primaryColors:[],secondaryColors:[]});var a=e.symptomConfigurations.filter((t=>!t.inactive&&e.logEntry.symptoms.find((e=>e.id==t.id)))).map((e=>e.color)),n=e.treatmentConfigurations.filter((t=>!t.inactive&&e.logEntry.treatments.find((e=>e.id==t.id)))).map((e=>e.color));return 0===a.length&&0===n.length?t.createElement(uM,{className:"mdhui-ss-day-tracker",primaryColors:[],secondaryColors:[]}):t.createElement(uM,{className:"mdhui-ss-day-tracker",key:Math.random(),primaryColors:a,secondaryColors:n})}(),t.createElement("div",{className:"day-label"}," ",e.day," ",e.logEntry?.notes.length>0&&t.createElement(gge,{icon:_,className:"mdhui-ss-notes-icon"})))}A(".mdhui-ss-calendar .mdhui-ss-calendar-day {\n width: 100%;\n}\n\n.mdhui-ss-calendar .mdhui-ss-calendar-day .mdhui-ss-day-label {\n font-size: 12px;\n color: var(--mdhui-text-color-2);\n}\n\n.mdhui-ss-calendar .mdhui-ss-calendar-day .mdhui-ss-day-label svg {\n font-size: 12px;\n}\n\n.mdhui-ss-calendar .mdhui-ss-calendar-day .mdhui-ss-day-label.future {\n opacity: .5;\n}\n\n.mdhui-ss-calendar .mdhui-ss-notes-icon {\n color: var(--mdhui-color-primary);\n position: absolute;\n right: calc(50% - 19px);\n bottom: 2px;\n}\n\n.mdhui-ss-calendar .mdhui-ss-calendar-day .mdhui-ss-day-tracker {\n padding-bottom: 2px;\n padding-top: 8px;\n}\n\n.mdhui-ss-calendar .mdhui-ss-calendar-day.future {\n opacity: .5;\n cursor: default;\n}");function R_e(e){let a=r(D_e);if(!a)return t.createElement($q,{innerRef:e.innerRef},"Error: Symptom Severity Chart must be used inside a Symptom Shark Visualization Coordinator.");let{logEntries:n}=a,i=r(rM),o=e.intervalStart||In(new Date);i&&(o=i.intervalStart);var s=nl(o.getFullYear(),o.getMonth());function l(e){return s.filter((t=>{if(n[Br(t)]&&n[Br(t)].overallFeeling&&(!e||n[Br(t)].overallFeeling==e))return!0}))}var c=l();if(!c.length)return null;for(var u=s.length,d=100/u,h=100/(2*u),m=[],p=0;p<c.length-1;p++){var g=c[p],f=c[p+1],y=n[Br(g)].overallFeeling,v=n[Br(f)].overallFeeling;m.push({x1:h+d*(g.getDate()-1),y1:128-24*y,x2:h+d*(f.getDate()-1),y2:128-24*v,color:"#429bdf"})}let b=function(){var e=0,t=l();if(0==t.length)return null;for(var a=0;a<t.length;a++)e+=n[Br(t[a])].overallFeeling;return e/t.length}();return t.createElement("div",{ref:e.innerRef,className:"mdhui-ss-oe-chart"+("monthReport"==e.variant?" mdhui-ss-oe-chart-month-report":"")},t.createElement("div",{className:"mdhui-ss-oe-chart-title-container"},t.createElement(nS,{title:no("daily-overall-experience")}),b&&t.createElement("div",{className:"mdhui-ss-oe-chart-average-wrapper"},no("average"),": ",t.createElement("div",{className:"mdhui-ss-oe-chart-average"},wl(b,1),t.createElement(xM,{className:"mdhui-ss-oe-chart-face",selected:!0,faceValue:parseInt(b.toFixed(0))})))),t.createElement("div",{className:"mdhui-ss-oe-chart-inner"},t.createElement("div",{className:"mdhui-ss-oe-chart-y-axis"},t.createElement("div",{className:"mdhui-ss-oe-chart-face-total"},l(5).length>0&&t.createElement("span",{className:"total"},l(5).length),t.createElement(xM,{className:"mdhui-ss-oe-chart-face",selected:!0,faceValue:5})),t.createElement("div",{className:"mdhui-ss-oe-chart-face-total"},l(4).length>0&&t.createElement("span",{className:"total"},l(4).length),t.createElement(xM,{className:"mdhui-ss-oe-chart-face",selected:!0,faceValue:4})),t.createElement("div",{className:"mdhui-ss-oe-chart-face-total"},l(3).length>0&&t.createElement("span",{className:"total"},l(3).length),t.createElement(xM,{className:"mdhui-ss-oe-chart-face",selected:!0,faceValue:3})),t.createElement("div",{className:"mdhui-ss-oe-chart-face-total"},l(2).length>0&&t.createElement("span",{className:"total"},l(2).length),t.createElement(xM,{className:"mdhui-ss-oe-chart-face",selected:!0,faceValue:2})),t.createElement("div",{className:"mdhui-ss-oe-chart-face-total"},l(1).length>0&&t.createElement("span",{className:"total"},l(1).length),t.createElement(xM,{className:"mdhui-ss-oe-chart-face",selected:!0,faceValue:1}))),t.createElement("div",{className:"mdhui-ss-oe-chart-x-axis-line"}),t.createElement("div",{className:"mdhui-ss-oe-chart-x-axis-line",style:{top:"48px"}}),t.createElement("div",{className:"mdhui-ss-oe-chart-x-axis-line",style:{top:"72px"}}),t.createElement("div",{className:"mdhui-ss-oe-chart-x-axis-line",style:{top:"96px"}}),t.createElement("div",{className:"mdhui-ss-oe-chart-x-axis-line",style:{top:"120px"}}),t.createElement("div",{style:{position:"relative",height:"100%"}},t.createElement("svg",{className:"mdhui-ss-oe-chart-lines"},m.map((e=>t.createElement("line",{key:e.x1,x1:e.x1+"%",y1:e.y1,x2:e.x2+"%",y2:e.y2,style:{stroke:e.color,strokeWidth:4,opacity:.5}})))),s.map((a=>t.createElement("div",{key:a.getDate(),className:"mdhui-ss-oe-chart-day-wrapper",style:{width:100/s.length+"%"}},(e.showAllDays||(a.getDate()-1)%2==0)&&t.createElement("div",{className:"mdhui-ss-oe-chart-day-marker"},a.getDate()),n[Br(a)]?.overallFeeling&&t.createElement("div",{className:"mdhui-ss-oe-chart-dot",style:{bottom:24*n[Br(a)].overallFeeling-16+"px"}})))))))}A(".mdhui-ss-oe-chart {\n position: relative;\n}\n\n.mdhui-ss-oe-chart .mdhui-ss-oe-chart-title-container {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n flex-wrap: wrap;\n}\n\n.mdhui-ss-oe-chart .mdhui-ss-oe-chart-face {\n width: 16px;\n height: 16px;\n margin-left: 4px;\n vertical-align: text-top;\n display: inline-block;\n border-radius: 8px;\n overflow: hidden;\n}\n\n.mdhui-ss-oe-chart-inner .mdhui-ss-oe-chart-y-axis .mdhui-ss-oe-chart-face-total {\n height: 16px;\n margin-bottom: 8px;\n display: block;\n text-align: right;\n font-weight: bold;\n width: 56px;\n font-size: 15px;\n white-space: nowrap;\n}\n\n.mdhui-ss-oe-chart .mdhui-ss-oe-chart-face-total .mdhui-ss-oe-chart-total {\n vertical-align: text-top;\n}\n\n.mdhui-ss-oe-chart .mdhui-ss-oe-chart-average-wrapper {\n font-size: 17px;\n padding: 16px;\n padding-bottom: 0;\n}\n\n.mdhui-ss-oe-chart .mdhui-ss-oe-chart-average-wrapper .mdhui-ss-oe-chart-average {\n font-weight: bold;\n display: inline;\n}\n\n.mdhui-ss-oe-chart-inner {\n position: relative;\n height: 160px;\n padding: 16px;\n box-sizing: border-box;\n padding-left: 64px;\n page-break-inside: avoid;\n}\n\n.mdhui-ss-oe-chart-inner .mdhui-ss-oe-chart-x-axis-line {\n position: absolute;\n width: calc(100% - 64px);\n height: 1px;\n /*Default color because evopdf doesn't support css variables*/\n background: #eee;\n background: var(--mdhui-background-color-1);\n left: 64px;\n top: 24px;\n}\n\n.mdhui-ss-oe-chart-inner .mdhui-ss-oe-chart-lines {\n position: absolute;\n left: 0;\n right: 0;\n top: 0.5px;\n bottom: 0;\n width: 100%;\n height: 100%;\n}\n\n.mdhui-ss-oe-chart-inner .mdhui-ss-oe-chart-y-axis {\n position: absolute;\n left: 0;\n top: 16px;\n}\n\n.mdhui-ss-oe-chart-inner .mdhui-ss-oe-chart-day-wrapper {\n position: relative;\n float: left;\n height: 116px;\n}\n\n.mdhui-ss-oe-chart-inner .mdhui-ss-oe-chart-day-wrapper .mdhui-ss-oe-chart-day-marker {\n position: absolute;\n left: 0;\n bottom: -16px;\n width: 100%;\n text-align: center;\n font-size: 12px;\n color: var(--mdhui-text-color-2);\n}\n\n.mdhui-ss-oe-chart-inner .mdhui-ss-oe-chart-day-wrapper .mdhui-ss-oe-chart-dot {\n position: absolute;\n width: 7px;\n height: 7px;\n /*Default color because evopdf doesn't support css variables*/\n background: #666;\n background: var(--mdhui-text-color-2);\n border-radius: 3.5px;\n left: calc(50% - 3px);\n}\n\n.mdhui-ss-oe-chart.mdhui-ss-oe-chart-month-report .mdhui-ss-oe-chart-inner {\n padding-left: calc(25% + 8px);\n}\n\n.mdhui-ss-oe-chart.mdhui-ss-oe-chart-month-report .mdhui-ss-oe-chart-y-axis {\n left: calc(25% - 56px);\n}\n\n.mdhui-ss-oe-chart.mdhui-ss-oe-chart-month-report .mdhui-ss-oe-chart-x-axis-line {\n width: calc(75% - 32px);\n left: calc(25% + 16px);\n}\n\n.mdhui-ss-oe-chart.mdhui-ss-oe-chart-month-report .mdhui-ss-oe-chart-average-wrapper {\n display: block;\n padding-top: 16px;\n font-size: 15px;\n text-transform: uppercase;\n font-weight: normal;\n position: absolute;\n left: 16px;\n top: 64px;\n text-align: left;\n padding: 0;\n padding-bottom: 8px;\n right: auto;\n}\n\n.mdhui-ss-oe-chart.mdhui-ss-oe-chart-month-report .mdhui-ss-oe-chart-average-wrapper .mdhui-ss-oe-chart-average {\n margin-top: 8px;\n font-size: 34px;\n font-weight: bold;\n display: block;\n line-height: 34px;\n}\n\n.mdhui-ss-oe-chart.mdhui-ss-oe-chart-month-report .mdhui-ss-oe-chart-average-wrapper .mdhui-ss-oe-chart-average .mdhui-face {\n height: 34px;\n width: 34px;\n vertical-align: top;\n border-radius: 18px;\n overflow: hidden;\n}");function L_e(e){if(!e.configuration.symptoms.length)return null;function a(){e.onClick&&e.onClick(e.date)}let n=!1;e.logEntry&&(e.logEntry.symptoms.length>0||e.logEntry.treatments.length>0||e.logEntry&&e.logEntry.notes.length>0)||(n=!0);let i=e.title??il(e.date),r=e.highlight??_r(e.date),o=e.title?void 0:e.subtitle??sl(e.date);return n?t.createElement(aS,{innerRef:e.innerRef,variant:r?"highlight":"subtle",className:"mdhui-ss-log-entry"},t.createElement(Za,{title:i,subtitle:o,onClick:()=>a(),indicatorIcon:we},!!e.noDataMessage&&t.createElement("div",{className:"mdhui-ss-log-entry-section"},e.noDataMessage),t.createElement(tS,null))):t.createElement(aS,{innerRef:e.innerRef,className:"mdhui-ss-log-entry"},t.createElement(Za,{title:i,subtitle:o,onClick:()=>a(),indicatorPosition:"topRight",indicator:t.createElement(t.Fragment,null,e.logEntry?.overallFeeling&&t.createElement(xM,{faceValue:e.logEntry?.overallFeeling,selected:!0}))},t.createElement(F_e,{configuration:e.configuration,logEntry:e.logEntry,highlightedSymptoms:e.highlightedSymptoms,highlightedTreatments:e.highlightedTreatments}),e.logEntry.notes&&t.createElement("div",{className:"mdhui-ss-log-entry-section"},t.createElement("div",{className:"mdhui-ss-section-header"},no("notes")),t.createElement("div",{className:"mdhui-ss-notes-content"},e.logEntry.notes))))}function F_e(e){var a=[],n=[];if(e.logEntry&&(e.logEntry.symptoms.forEach((t=>{var n,i=e.configuration.symptoms.find((e=>e.id==t.id));i&&("10PointScale"==i.severityTracking&&(n=t.severity?t.severity.toString():void 0),"3PointScale"==i.severityTracking&&(t.severity>7?n=no("severe-shortened"):t.severity>4?n=no("moderate-shortened"):t.severity>0&&(n=no("mild-shortened"))),a.push({id:t.id,severity:n,name:i.name,color:i.color}))})),a.sort(((e,t)=>e.name>t.name?1:t.name>e.name?-1:0)),e.logEntry.treatments.forEach((t=>{var a=e.configuration.treatments.find((e=>e.id==t.id));a&&n.push({id:t.id,name:a.name,color:a.color})})),n.sort(((e,t)=>e.name>t.name?1:t.name>e.name?-1:0))),!e.logEntry||!(a.length>0||n.length>0||e.logEntry.notes.length>0))return null;var i=[],r=[];return e.highlightedSymptoms&&(i=e.highlightedSymptoms),e.highlightedTreatments&&(r=e.highlightedTreatments),0==e.logEntry.symptoms.length&&0==e.logEntry.treatments.length?null:t.createElement("div",{className:"mdhui-ss-log-entry-section"},t.createElement("div",{className:"mdhui-ss-section-header"},no("symptoms-and-treatments")),a.filter((e=>-1!=i.indexOf(e.id))).map((e=>t.createElement(ySe,{noBoxShadow:!0,selected:!0,color:e.color,badge:e.severity,key:e.id,text:e.name}))),n.filter((e=>-1!=r.indexOf(e.id))).map((e=>t.createElement(ySe,{noBoxShadow:!0,selected:!0,color:e.color,key:e.id,text:e.name,bordered:!0}))),a.filter((e=>-1==i.indexOf(e.id))).map((e=>t.createElement("span",{key:e.id,style:{opacity:i.length>0||r.length>0?.5:1}},t.createElement(ySe,{noBoxShadow:!0,selected:!0,color:e.color,badge:e.severity,text:e.name})))),n.filter((e=>-1==r.indexOf(e.id))).map((e=>t.createElement("span",{key:e.id,style:{opacity:i.length>0||r.length>0?.5:1}},t.createElement(ySe,{noBoxShadow:!0,selected:!0,color:e.color,text:e.name,bordered:!0})))))}A(".mdhui-ss-log-entry .mdhui-face {\n height: 18px;\n width: 18px;\n border-radius: 9px;\n}\n\n.mdhui-ss-log-entry .mdhui-ss-log-entry-section {\n margin-top: 16px;\n}\n\n.mdhui-ss-log-entry .mdhui-ss-section-header {\n font-size: .88em;\n font-weight: 500;\n color: var(--mdhui-text-color-3);\n margin-bottom: 4px;\n}\n\n.mdhui-ss-log-entry .mdhui-ss-notes-preview {\n font-size: .88em;\n white-space: pre-wrap;\n margin: 16px;\n margin-top: 0;\n}\n\n.mdhui-ss-log-entry .mdhui-tracker-item {\n margin-left: 0;\n margin-top: 0;\n}\n\n.mdhui-ss-log-entry .mdhui-ss-notes-content {\n font-size: .88em;\n white-space: pre-wrap;\n}");A(".ss-month-report {\n position: relative;\n width: 100%;\n font-family: ui-rounded, -apple-system, Helvetica, Arial, sans-serif;\n /* default color for PDF rendering */\n background: #FFF;\n background: var(--mdhui-background-color-0);\n}\n\n.ss-month-report>thead>tr>th {\n text-align: left;\n font-size: 21px;\n line-height: 21px;\n width: 100%;\n background: var(--mdhui-background-color-0);\n}\n\n.ss-month-report>thead>tr>th>.header {\n display: block;\n position: relative;\n padding: 16px;\n}\n\n.ss-month-report>thead>tr>th>.header .ss-month-report-product {\n position: absolute;\n right: 16px;\n top: 10px;\n font-size: 15px;\n font-weight: bold;\n padding-left: 40px;\n height: 32px;\n line-height: 18px;\n}\n\n.ss-month-report>thead>tr>th>.header .ss-month-report-product .ss-month-report-product-url {\n font-weight: normal;\n}\n\n.ss-month-report>thead>tr>th>.header .ss-month-report-product img {\n height: 32px;\n position: absolute;\n left: 0;\n top: 0;\n vertical-align: middle;\n}\n\n.ss-month-report>tfoot>tr>td {\n padding: 16px;\n text-align: center;\n font-size: 21px;\n line-height: 21px;\n width: 100%;\n background: var(--mdhui-background-color-0);\n border-top: solid 1px var(--mdhui-border-color-1);\n}");function B_e(e){let a={...H_e[e.icon||"star-o"],className:e.className};return t.createElement(gge,{...a})}A(".ss-notes-timeline {\n padding: 16px;\n padding-top: 48px;\n\n /* Default color for PDF Rendering, since pdf renderer does not support CSS variables */\n border-top: solid 1px #ddd;\n\n border-top: solid 1px var(--mdhui-border-color-1);\n padding-left: 64px;\n position: relative;\n}\n\n.ss-notes-timeline .ss-notes-timeline-title {\n font-size: 17px;\n color: var(--mdhui-text-color-1);\n font-weight: bold;\n position: absolute;\n left: 16px;\n top: 16px;\n}\n\n.ss-notes-timeline .ss-notes-timeline-line {\n position: absolute;\n top: 48px;\n left: 32px;\n\n /* Default color for PDF Rendering, since pdf renderer does not support CSS variables */\n background: #ddd;\n\n background: var(--mdhui-background-color-2);\n bottom: 48px;\n width: 1px;\n}\n\n.ss-notes-timeline .ss-notes-timeline-day {\n margin-bottom: 32px;\n page-break-inside: avoid;\n position: relative;\n\n /* Default color for PDF Rendering, since pdf renderer does not support CSS variables */\n border: solid 1px #ddd;\n\n border: solid 1px var(--mdhui-border-color-1);\n border-radius: 5px;\n padding: 16px;\n}\n\n.ss-notes-timeline .ss-notes-timeline-day .ss-notes-timeline-day-icon {\n font-size: 21px;\n position: absolute;\n left: -51px;\n top: calc(50% - 11px);\n width: 37px;\n text-align: center;\n display: block;\n}\n\n.ss-notes-timeline .ss-notes-timeline-day .ss-notes-timeline-day-circle {\n /* Default color for PDF Rendering, since pdf renderer does not support CSS variables */\n color: #429bdf;\n\n color: var(--mdhui-color-primary);\n}\n\n.notes-timeline .ss-notes-timeline-day .ss-notes-timeline-day-title {\n font-weight: bold;\n font-size: 17px;\n}\n\n.notes-timeline .ss-notes-timeline-day .ss-notes-timeline-note {\n white-space: pre-wrap;\n}");const H_e={star:{color:"#eec04c",icon:N},"star-o":{color:"#eec04c",icon:{prefix:"far",iconName:"star",icon:[576,512,[11088,61446],"f005","M287.9 0c9.2 0 17.6 5.2 21.6 13.5l68.6 141.3 153.2 22.6c9 1.3 16.5 7.6 19.3 16.3s.5 18.1-5.9 24.5L433.6 328.4l26.2 155.6c1.5 9-2.2 18.1-9.7 23.5s-17.3 6-25.3 1.7l-137-73.2L151 509.1c-8.1 4.3-17.9 3.7-25.3-1.7s-11.2-14.5-9.7-23.5l26.2-155.6L31.1 218.2c-6.5-6.4-8.7-15.9-5.9-24.5s10.3-14.9 19.3-16.3l153.2-22.6L266.3 13.5C270.4 5.2 278.7 0 287.9 0zm0 79L235.4 187.2c-3.5 7.1-10.2 12.1-18.1 13.3L99 217.9 184.9 303c5.5 5.5 8.1 13.3 6.8 21L171.4 443.7l105.2-56.2c7.1-3.8 15.6-3.8 22.6 0l105.2 56.2L384.2 324.1c-1.3-7.7 1.2-15.5 6.8-21l85.9-85.1L358.6 200.5c-7.8-1.2-14.6-6.1-18.1-13.3L287.9 79z"]}},"user-md":{color:"#397d49",icon:ne},"hospital-o":{color:"#4154af",icon:{prefix:"fas",iconName:"hospital",icon:[640,512,[127973,62589,"hospital-alt","hospital-wide"],"f0f8","M192 48c0-26.5 21.5-48 48-48H400c26.5 0 48 21.5 48 48V512H368V432c0-26.5-21.5-48-48-48s-48 21.5-48 48v80H192V48zM48 96H160V512H48c-26.5 0-48-21.5-48-48V320H80c8.8 0 16-7.2 16-16s-7.2-16-16-16H0V224H80c8.8 0 16-7.2 16-16s-7.2-16-16-16H0V144c0-26.5 21.5-48 48-48zm544 0c26.5 0 48 21.5 48 48v48H560c-8.8 0-16 7.2-16 16s7.2 16 16 16h80v64H560c-8.8 0-16 7.2-16 16s7.2 16 16 16h80V464c0 26.5-21.5 48-48 48H480V96H592zM312 64c-8.8 0-16 7.2-16 16v24H272c-8.8 0-16 7.2-16 16v16c0 8.8 7.2 16 16 16h24v24c0 8.8 7.2 16 16 16h16c8.8 0 16-7.2 16-16V152h24c8.8 0 16-7.2 16-16V120c0-8.8-7.2-16-16-16H344V80c0-8.8-7.2-16-16-16H312z"]}},ambulance:{color:"#f2471c",icon:D},flag:{color:"#c4291c",icon:{prefix:"fas",iconName:"flag",icon:[448,512,[127988,61725],"f024","M64 32C64 14.3 49.7 0 32 0S0 14.3 0 32V64 368 480c0 17.7 14.3 32 32 32s32-14.3 32-32V352l64.3-16.1c41.1-10.3 84.6-5.5 122.5 13.4c44.2 22.1 95.5 24.8 141.7 7.4l34.7-13c12.5-4.7 20.8-16.6 20.8-30V66.1c0-23-24.2-38-44.8-27.7l-9.6 4.8c-46.3 23.2-100.8 23.2-147.1 0c-35.1-17.6-75.4-22-113.5-12.5L64 48V32z"]}},"moon-o":{color:"#9d9083",icon:{prefix:"fas",iconName:"moon",icon:[384,512,[127769,9214],"f186","M223.5 32C100 32 0 132.3 0 256S100 480 223.5 480c60.6 0 115.5-24.2 155.8-63.4c5-4.9 6.3-12.5 3.1-18.7s-10.1-9.7-17-8.5c-9.8 1.7-19.8 2.6-30.1 2.6c-96.9 0-175.5-78.8-175.5-176c0-65.8 36-123.1 89.3-153.3c6.1-3.5 9.2-10.5 7.7-17.3s-7.3-11.9-14.3-12.5c-6.3-.5-12.6-.8-19-.8z"]}},flask:{color:"#429bdf",icon:{prefix:"fas",iconName:"flask",icon:[448,512,[],"f0c3","M288 0H160 128C110.3 0 96 14.3 96 32s14.3 32 32 32V196.8c0 11.8-3.3 23.5-9.5 33.5L10.3 406.2C3.6 417.2 0 429.7 0 442.6C0 480.9 31.1 512 69.4 512H378.6c38.3 0 69.4-31.1 69.4-69.4c0-12.8-3.6-25.4-10.3-36.4L329.5 230.4c-6.2-10.1-9.5-21.7-9.5-33.5V64c17.7 0 32-14.3 32-32s-14.3-32-32-32H288zM192 196.8V64h64V196.8c0 23.7 6.6 46.9 19 67.1L309.5 320h-171L173 263.9c12.4-20.2 19-43.4 19-67.1z"]}},bolt:{color:"#f5b722",icon:{prefix:"fas",iconName:"bolt",icon:[448,512,[9889,"zap"],"f0e7","M349.4 44.6c5.9-13.7 1.5-29.7-10.6-38.5s-28.6-8-39.9 1.8l-256 224c-10 8.8-13.6 22.9-8.9 35.3S50.7 288 64 288H175.5L98.6 467.4c-5.9 13.7-1.5 29.7 10.6 38.5s28.6 8 39.9-1.8l256-224c10-8.8 13.6-22.9 8.9-35.3s-16.6-20.7-30-20.7H272.5L349.4 44.6z"]}},"question-circle-o":{color:"#71aa3a",icon:X},thermometer:{color:"#a3144d",icon:{prefix:"fas",iconName:"thermometer",icon:[512,512,[],"f491","M96 382.1V293.3c0-14.9 5.9-29.1 16.4-39.6l27.3-27.3 57 57c6.2 6.2 16.4 6.2 22.6 0s6.2-16.4 0-22.6l-57-57 41.4-41.4 57 57c6.2 6.2 16.4 6.2 22.6 0s6.2-16.4 0-22.6l-57-57 41.4-41.4 57 57c6.2 6.2 16.4 6.2 22.6 0s6.2-16.4 0-22.6l-57-57 45.5-45.5C355.2 10.9 381.4 0 408.8 0C465.8 0 512 46.2 512 103.2c0 27.4-10.9 53.6-30.2 73L258.3 399.6c-10.5 10.5-24.7 16.4-39.6 16.4H129.9L41 505c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l89-89z"]}},trophy:{color:"#e0bc39",icon:{prefix:"fas",iconName:"trophy",icon:[576,512,[127942],"f091","M400 0H176c-26.5 0-48.1 21.8-47.1 48.2c.2 5.3 .4 10.6 .7 15.8H24C10.7 64 0 74.7 0 88c0 92.6 33.5 157 78.5 200.7c44.3 43.1 98.3 64.8 138.1 75.8c23.4 6.5 39.4 26 39.4 45.6c0 20.9-17 37.9-37.9 37.9H192c-17.7 0-32 14.3-32 32s14.3 32 32 32H384c17.7 0 32-14.3 32-32s-14.3-32-32-32H357.9C337 448 320 431 320 410.1c0-19.6 15.9-39.2 39.4-45.6c39.9-11 93.9-32.7 138.2-75.8C542.5 245 576 180.6 576 88c0-13.3-10.7-24-24-24H446.4c.3-5.2 .5-10.4 .7-15.8C448.1 21.8 426.5 0 400 0zM48.9 112h84.4c9.1 90.1 29.2 150.3 51.9 190.6c-24.9-11-50.8-26.5-73.2-48.3c-32-31.1-58-76-63-142.3zM464.1 254.3c-22.4 21.8-48.3 37.3-73.2 48.3c22.7-40.3 42.8-100.5 51.9-190.6h84.4c-5.1 66.3-31.1 111.2-63 142.3z"]}},spoon:{color:"#6e4b3f",icon:{prefix:"fas",iconName:"spoon",icon:[512,512,[129348,61873,"utensil-spoon"],"f2e5","M245.8 220.9c-14.5-17.6-21.8-39.2-21.8-60.8C224 80 320 0 416 0c53 0 96 43 96 96c0 96-80 192-160.2 192c-21.6 0-43.2-7.3-60.8-21.8L54.6 502.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L245.8 220.9z"]}}};function q_e(e){let a=r(D_e);if(!a)return t.createElement($q,{innerRef:e.innerRef},"Error: Notes timeline must be used inside a Symptom Shark Visualization Coordinator.");let n=r(rM),i=n?.intervalStart??e.intervalStart??In(new Date);if(!a.symptoms.length&&!a.treatments.length)return null;var o=nl(i.getFullYear(),i.getMonth()).filter((e=>a.logEntries[Br(e)]?.notes?.length));return o.length?t.createElement("div",{ref:e.innerRef,className:"ss-notes-timeline"},t.createElement("div",{className:"ss-notes-timeline-title"},no("notes")),t.createElement("div",{className:"ss-notes-timeline-line"}),o.map((e=>t.createElement("div",{key:e.toISOString(),className:"ss-notes-timeline-day"},a.logEntries[Br(e)].icon?t.createElement(B_e,{className:"ss-notes-timeline-day-icon",icon:a.logEntries[Br(e)].icon}):t.createElement(gge,{className:"ss-notes-timeline-day-icon ss-notes-timeline-day-circle",icon:Z}),t.createElement("div",{className:"ss-notes-timeline-day-title"},sl(e)),t.createElement("div",{className:"ss-notes-timeline-note"},a.logEntries[Br(e)].notes))))):null}function U_e(e){let a=r(D_e);if(!a)return t.createElement($q,{innerRef:e.innerRef},"Error: Symptom Severity Chart must be used inside a Symptom Shark Visualization Coordinator.");let{logEntries:n}=a,i=r(rM),o=e.intervalStart||In(new Date);i&&(o=i.intervalStart);let s=nl(o.getFullYear(),o.getMonth()),l=function(t){var a=Br(t);if(n[a]){var i=n[a].symptoms.find((t=>e.symptom.id==t.id));if(i&&i.severity)return"3PointScale"==e.symptom.severityTracking?i.severity<4?1:i.severity>=4&&i.severity<8?2:3:i.severity}return 0},c=function(e){for(var t=0,a=0;a<s.length;a++){l(s[a])==e&&t++}return t},u=function(){for(var t=0,a=[],i=0;i<s.length;i++){var r=Br(s[i]);if(n[r]){var o=n[r].symptoms.find((t=>t.id==e.symptom.id));o&&o.severity&&a.push(o)}}if("3PointScale"==e.symptom.severityTracking)t+=a.filter((e=>e.severity&&e.severity<4)).length,t+=2*a.filter((e=>e.severity&&e.severity>=4&&e.severity<8)).length,t+=3*a.filter((e=>e.severity&&e.severity>=8)).length;else for(var l=0;l<a.length;l++)t+=a[l].severity??0;return t/a.length}();return isNaN(u)?null:t.createElement("div",{ref:e.innerRef,className:"mdhui-ss-severity-chart"+("monthReport"==e.variant?" mdhui-ss-severity-chart-month-report":"")},t.createElement(nS,{title:e.symptom.name+" "+no("severity")}),"3PointScale"==e.symptom.severityTracking&&t.createElement(t.Fragment,null,t.createElement("div",{className:"mdhui-ss-severity-chart-inner mdhui-ss-severity-chart-three-point-scale"},t.createElement("div",{className:"mdhui-ss-severity-chart-y-axis"},t.createElement("div",{className:"mdhui-ss-severity-chart-value"},t.createElement("span",{className:"mdhui-ss-severity-chart-total"},c(3)),no("severe-shortened")),t.createElement("div",{className:"mdhui-ss-severity-chart-value"},t.createElement("span",{className:"mdhui-ss-severity-chart-total"},c(2)),no("moderate-shortened")),t.createElement("div",{className:"mdhui-ss-severity-chart-value"},t.createElement("span",{className:"mdhui-ss-severity-chart-total"},c(1)),no("mild-shortened")),t.createElement("div",{className:"mdhui-ss-severity-chart-value"},t.createElement("span",{className:"mdhui-ss-severity-chart-total"}),"---")),t.createElement("div",{className:"mdhui-ss-severity-chart-x-axis-line"}),t.createElement("div",{className:"mdhui-ss-severity-chart-x-axis-line",style:{top:"48px"}}),t.createElement("div",{className:"mdhui-ss-severity-chart-x-axis-line",style:{top:"72px"}}),t.createElement("div",{className:"mdhui-ss-severity-chart-x-axis-line",style:{top:"96px"}}),t.createElement("div",{style:{position:"relative",height:"100%"}},s.map((a=>t.createElement("div",{key:a.toISOString(),className:"mdhui-ss-severity-chart-day-wrapper",style:{width:100/s.length+"%"}},(e.showAllDays||(a.getDate()-1)%2==0)&&t.createElement("div",{className:"mdhui-ss-severity-chart-day-marker"},a.getDate()),t.createElement("div",{className:"mdhui-ss-severity-chart-bar",style:{height:24*l(a)+"px",backgroundColor:e.symptom.color}},t.createElement(tS,null))))))),u&&t.createElement("div",{className:"mdhui-ss-severity-chart-average-wrapper"},no("average")," ",t.createElement("div",{className:"mdhui-ss-severity-chart-average"},wl(u,1)," / 3"))),"10PointScale"==e.symptom.severityTracking&&t.createElement("div",null,t.createElement("div",{className:"mdhui-ss-severity-chart-inner mdhui-ss-severity-chart-ten-point-scale"},t.createElement("div",{className:"mdhui-ss-severity-chart-y-axis"},[10,9,8,7,6,5,4,3,2,1].map((e=>t.createElement("div",{key:e,className:"mdhui-ss-severity-chart-value"},t.createElement("span",{className:"mdhui-ss-severity-chart-total"},c(e)),t.createElement("div",{className:"mdhui-ss-severity-chart-value-label"},e)))),t.createElement("div",{className:"mdhui-ss-severity-chart-value"},t.createElement("span",{className:"mdhui-ss-severity-chart-total"}),t.createElement("div",{className:"mdhui-ss-severity-chart-value-label"},"0"))),[10,9,8,7,6,5,4,3,2,1].map((e=>t.createElement("div",{key:e,className:"mdhui-ss-severity-chart-x-axis-line",style:{top:24*(11-e)+"px"}}))),t.createElement("div",{style:{position:"relative",height:"100%"}},s.map((a=>t.createElement("div",{key:a.toISOString(),className:"mdhui-ss-severity-chart-day-wrapper",style:{width:100/s.length+"%"}},(e.showAllDays||(a.getDate()-1)%2==0)&&t.createElement("div",{className:"mdhui-ss-severity-chart-day-marker"},a.getDate()),t.createElement("div",{className:"mdhui-ss-severity-chart-bar",style:{height:24*l(a)+"px",backgroundColor:e.symptom.color}},t.createElement(tS,null))))))),u&&t.createElement("div",{className:"mdhui-ss-severity-chart-average-wrapper"},no("average")," ",t.createElement("div",{className:"mdhui-ss-severity-chart-average"},wl(u,1)," / 10"))))}function V_e(e){let a=r(D_e);if(!a)return t.createElement($q,{innerRef:e.innerRef},"Error: Month report must be used inside a Symptom Shark Visualization Coordinator.");let n=r(rM),i=n?.intervalStart??e.intervalStart??In(new Date);return a.symptoms.length||a.treatments.length?t.createElement("table",{ref:e.innerRef,className:"ss-month-report",cellPadding:"0",cellSpacing:"0"},t.createElement("thead",null,t.createElement("tr",null,t.createElement("th",null,t.createElement("div",{className:"header"},ul(i.getMonth())," ",i.getFullYear(),t.createElement("div",{className:"product"},e.productLogo&&t.createElement("img",{src:e.productLogo}),e.productName&&t.createElement("div",{className:"product-name"},e.productName),e.productUrl&&t.createElement("a",{href:e.productUrl,className:"product-url"},e.productUrl)))))),t.createElement("tbody",null,t.createElement("tr",null,t.createElement("td",null,t.createElement(N_e,null),e.includeDailyOverallFeeling&&t.createElement(R_e,{variant:"monthReport",showAllDays:!0}),a.symptoms.filter((e=>!e.inactive&&e.severityTracking&&"None"!=e.severityTracking)).map((e=>t.createElement(U_e,{key:e.id,variant:"monthReport",symptom:e,showAllDays:!0}))),e.includeNotes&&t.createElement(q_e,null))))):null}A(".mdhui-ss-severity-chart {\n position: relative;\n}\n\n.mdhui-ss-severity-chart .mdhui-ss-severity-chart-average-wrapper {\n font-size: 17px;\n padding: 16px;\n position: absolute;\n right: 0;\n top: 0;\n}\n\n.mdhui-ss-severity-chart .mdhui-ss-severity-chart-average-wrapper .mdhui-ss-severity-chart-average {\n font-weight: bold;\n display: inline;\n}\n\n.mdhui-ss-severity-chart .mdhui-ss-severity-chart-inner {\n position: relative;\n height: 304px;\n padding: 16px;\n box-sizing: border-box;\n padding-left: 64px;\n page-break-inside: avoid;\n}\n\n.mdhui-ss-severity-chart .mdhui-ss-severity-chart-inner .mdhui-ss-severity-chart-x-axis-line {\n position: absolute;\n width: calc(100% - 64px);\n height: 1px;\n\n /* Default color for PDF Rendering, since evopdf does not support CSS variables */\n background: #eee;\n\n background: var(--mdhui-background-color-1);\n left: 64px;\n top: 24px;\n}\n\n.mdhui-ss-severity-chart .mdhui-ss-severity-chart-lines {\n position: absolute;\n left: 0;\n right: 0;\n top: 0.5px;\n bottom: 0;\n width: 100%;\n height: 100%;\n}\n\n.mdhui-ss-severity-chart .mdhui-ss-severity-chart-y-axis {\n position: absolute;\n left: 0;\n top: 16px;\n}\n\n.mdhui-ss-severity-chart .mdhui-ss-severity-chart-value {\n height: 16px;\n margin-bottom: 8px;\n display: block;\n text-align: right;\n font-weight: bold;\n width: 56px;\n font-size: 9px;\n white-space: nowrap;\n position: relative;\n line-height: 16px;\n}\n\n.mdhui-ss-severity-chart .mdhui-ss-severity-chart-value .mdhui-ss-severity-chart-value-label {\n border-radius: 32px;\n padding: 3px;\n font-size: 9px;\n font-weight: bold;\n text-align: center;\n min-width: 10px;\n display: inline-block;\n color: var(--mdhui-text-color-1);\n line-height: 10px;\n background: #eec04c;\n}\n\n.mdhui-ss-severity-chart .mdhui-ss-severity-chart-value .mdhui-ss-severity-chart-total {\n position: absolute;\n right: 24px;\n top: 0;\n font-size: 15px;\n}\n\n\n.mdhui-ss-severity-chart .mdhui-ss-severity-chart-day-wrapper {\n position: relative;\n float: left;\n height: 260px;\n}\n\n.mdhui-ss-severity-chart .mdhui-ss-severity-chart-day-wrapper .mdhui-ss-severity-chart-day-marker {\n position: absolute;\n left: 0;\n bottom: -16px;\n width: 100%;\n text-align: center;\n font-size: 12px;\n color: var(--mdhui-text-color-2);\n}\n\n.mdhui-ss-severity-chart .mdhui-ss-severity-chart-day-wrapper .mdhui-ss-severity-chart-day-star {\n position: absolute;\n left: 0;\n bottom: -32px;\n width: 100%;\n text-align: center;\n font-size: 9px;\n color: var(--ss-tertiary-theme-color);\n display: none;\n}\n\n.mdhui-ss-severity-chart .mdhui-ss-severity-chart-day-wrapper .mdhui-ss-severity-chart-bar {\n position: absolute;\n width: 7px;\n background: var(--ss-bar-graph-bar-color);\n left: 0;\n width: 100%;\n bottom: 12px;\n}\n\n.mdhui-ss-severity-chart .mdhui-ss-severity-chart-three-point-scale {\n height: 136px;\n}\n\n.mdhui-ss-severity-chart .mdhui-ss-severity-chart-three-point-scale .mdhui-ss-severity-chart-day-wrapper {\n height: 92px;\n}\n\n\n.mdhui-ss-severity-chart.mdhui-ss-severity-chart-month-report .mdhui-ss-severity-chart-inner {\n padding-left: calc(25% + 8px);\n}\n\n.mdhui-ss-severity-chart.mdhui-ss-severity-chart-month-report .mdhui-ss-severity-chart-y-axis {\n left: calc(25% - 56px);\n}\n\n.mdhui-ss-severity-chart.mdhui-ss-severity-chart-month-report .mdhui-ss-severity-chart-x-axis-line {\n width: calc(75% - 32px);\n left: calc(25% + 16px);\n}\n\n.mdhui-ss-severity-chart.mdhui-ss-severity-chart-month-report .mdhui-ss-severity-chart-average-wrapper {\n display: block;\n padding-top: 16px;\n font-size: 15px;\n text-transform: uppercase;\n font-weight: normal;\n position: absolute;\n left: 16px;\n top: 64px;\n text-align: left;\n padding: 0;\n padding-bottom: 8px;\n right: auto;\n}\n\n.mdhui-ss-severity-chart.mdhui-ss-severity-chart-month-report .mdhui-ss-severity-chart-average-wrapper .mdhui-ss-severity-chart-average {\n margin-top: 8px;\n font-size: 34px;\n font-weight: bold;\n display: block;\n line-height: 34px;\n}");function W_e(e){let a=r(D_e);if(!a)return t.createElement($q,{innerRef:e.innerRef},"Error: Symptom Treatment Histograms must be used inside a Symptom Shark Visualization Coordinator.");let{symptoms:n,treatments:i,logEntries:o}=a,s=r(rM),l=e.intervalStart||In(new Date);s&&(l=s.intervalStart);var c=[];n.forEach((t=>{for(var a=0,n=l;n.getMonth()==l.getMonth();){var i=o[Br(n)];i&&i.symptoms.find((e=>e.id==t.id))&&a++,n=cn(n,{days:1})}var r=t.severityTracking&&"None"!=t.severityTracking?function(){e.onSymptomSelected(t.id,l)}:void 0;a>0&&c.push({color:t.color,label:t.name,value:a,onSelect:r})}));var u=[];return i.forEach((e=>{for(var t=0,a=l;a.getMonth()==l.getMonth();){var n=o[Br(a)];n&&n.treatments.find((t=>t.id==e.id))&&t++,a=cn(a,{days:1})}t>0&&u.push({color:e.color,label:e.name,value:t})})),u.length||c.length?t.createElement("div",{ref:e.innerRef,className:"mdhui-ss-histograms"},t.createElement("div",{className:"mdhui-ss-histogram"},t.createElement(sM,{className:"mdhui-ss-histogram-title",order:4},no("symptoms")),t.createElement(_M,{className:"ss-histogram",entries:c})),t.createElement("div",{className:"mdhui-ss-histogram"},t.createElement(sM,{className:"mdhui-ss-histogram-title",order:4},no("treatments")),t.createElement(_M,{className:"ss-histogram",entries:u})),t.createElement("div",{style:{clear:"both"}})):null}A(".mdhui-ss-histograms {\n border-top: solid 1px var(--mdhui-border-color-1);\n border-bottom: solid 1px var(--mdhui-border-color-1);\n box-shadow: var(--mdhui-box-shadow-0);\n}\n\n.mdhui-ss-histograms .mdhui-ss-histogram {\n padding: 16px;\n float: left;\n width: 50%;\n box-sizing: border-box;\n position: relative;\n padding-right: 32px;\n}\n\n.mdhui-ss-histograms .mdhui-ss-histogram .mdhui-ss-histogram-title {\n color: var(--mdhui-text-color-1);\n display: block;\n padding-bottom: 8px;\n}\n\n.mdhui-ss-histograms .mdhui-ss-histogram .ss-histogram {\n padding: 0;\n}");function $_e(e){let a=r(D_e);if(!a)return t.createElement($q,{innerRef:e.innerRef},"Error: Symptom Severity Summary must be used inside a Symptom Shark Visualization Coordinator.");let{logEntries:n}=a,i=r(rM),o=e.intervalStart||In(new Date);i&&(o=i.intervalStart);var s=nl(o.getFullYear(),o.getMonth()),l=function(t){var a=Br(t);if(n[a]){var i=n[a].symptoms.find((t=>e.symptom.id==t.id));if(i&&i.severity)return i.severity}return 0},c=function(e,t){for(var a=0,n=0;n<s.length;n++){var i=l(s[n]);i>=e&&i<=t&&a++}return a};return"3PointScale"!=e.symptom.severityTracking?null:t.createElement("div",{ref:e.innerRef,className:"mdhui-ss-symptom-severity-summaries"},t.createElement("div",{className:"mdhui-ss-symptom-severity-summary"},t.createElement("div",{className:"mdhui-ss-symptom-severity-summary-label"},no("severe")),t.createElement("div",{className:"mdhui-ss-symptom-severity-summary-count"},c(8,10))),t.createElement("div",{className:"mdhui-ss-symptom-severity-summary"},t.createElement("div",{className:"mdhui-ss-symptom-severity-summary-label"},no("moderate")),t.createElement("div",{className:"mdhui-ss-symptom-severity-summary-count"},c(4,7))),t.createElement("div",{className:"mdhui-ss-symptom-severity-summary"},t.createElement("div",{className:"mdhui-ss-symptom-severity-summary-label"},no("mild")),t.createElement("div",{className:"mdhui-ss-symptom-severity-summary-count"},c(1,3))),t.createElement("div",{style:{clear:"both"}}))}A(".mdhui-ss-symptom-severity-summaries .mdhui-ss-symptom-severity-summary {\n width: 33%;\n float: left;\n text-align: center;\n padding: 16px;\n box-sizing: border-box;\n}\n\n.mdhui-ss-symptom-severity-summaries .mdhui-ss-symptom-severity-summary-label {\n padding: 8px;\n}\n\n.mdhui-ss-symptom-severity-summaries .mdhui-ss-symptom-severity-summary-count {\n font-size: 34px;\n font-weight: bold;\n}");let G_e={participantID:"123",symptoms:[{id:"1",color:"#c4291c",name:"Headache",severityTracking:"3PointScale"},{id:"2",color:"#e35c33",name:"Nausea",severityTracking:"10PointScale"},{id:"3",color:"#5db37e",name:"Dizziness",severityTracking:"None"}],treatments:[{id:"10",color:"#c4291c",name:"Tylenol"},{id:"12",color:"#e35c33",name:"Rest"}]},K_e={symptoms:[{id:"1",severity:2},{id:"2",severity:7},{id:"3"}],treatments:[{id:"10"},{id:"12"}],overallFeeling:5,notes:"I'm feeling a little better today."};function Z_e(e){const[a,n]=c({}),[i,r]=c(null),[o,s]=c([new Date]);function u(){if(Br(o[0])!=Br(new Date)&&s([new Date]),"default"!=e.previewState)S_e.getConfiguration().then((function(e){S_e.getDailyLogEntries().then((function(t){r(e),n(t)}))}));else{r(G_e);let e=Br(cn(new Date,{days:-1}));n({...a,[e]:K_e})}}return l((()=>(u(),w.on("applicationDidBecomeVisible",u),()=>{w.off("applicationDidBecomeVisible",u)})),[]),t.createElement("div",{ref:e.innerRef,className:"log-entry-list"},i&&o.map((n=>t.createElement(L_e,{noDataMessage:Br(n)==Br(new Date)?no("tap-to-log-today"):void 0,key:Br(n),date:n,configuration:i,logEntry:a[Br(n)],onClick:()=>e.onDaySelected(n)}))),t.createElement(Vue,{enabled:!!i,onTrigger:()=>function(){for(var e=[...o],t=0;t<30;t++){var a=cn(e[e.length-1],{days:-1});e.push(a)}s(e)}()}),t.createElement(XA,null))}function Y_e(e){const[a,n]=c(null),[i,r]=c(void 0);var o=new Date;function s(){if("withLog"==e.previewState)return n(G_e),void r(K_e);"noLog"!=e.previewState?Promise.all([S_e.getDailyLogEntries(Br(cn(o,{days:-1}))),S_e.getConfiguration()]).then((function([e,t]){n(t),e[Br(o)]?r(e[Br(o)]):r(void 0)})):n(G_e)}return o=new Date(o.getFullYear(),o.getMonth(),o.getDate(),0,0,0,0),l((()=>(s(),w.on("applicationDidBecomeVisible",s),()=>{w.off("applicationDidBecomeVisible",s)})),[]),a&&a.symptoms.length?t.createElement(L_e,{onClick:t=>e.onClick(t),innerRef:e.innerRef,title:no(i?"todays-log":"log-todays-symptoms"),date:o,logEntry:i,configuration:a}):null}function X_e(e){const[a,n]=c(null),[i,r]=c(!1),[o,s]=c(null),[u,d]=c(!1),[h,m]=c(null);function p(e,t){t==no("mild-shortened")?t=2:t==no("moderate-shortened")?t=5:t==no("severe-shortened")&&(t=8);var n={...a},i=[...n.symptoms];i.find((t=>t.id==e.id))&&i.splice(i.findIndex((t=>t.id==e.id)),1),t&&i.push({id:e.id,severity:t}),n.symptoms=i,f(n),m(null)}function f(t){n(t),"default"!=e.previewState&&(d(!0),S_e.saveDailyLogEntry(Br(e.date),t).then((function(){d(!1)})))}function y(e){var t={...a};t.overallFeeling==e?t.overallFeeling=void 0:t.overallFeeling=e,f(t)}l((()=>{!function(){if("default"==e.previewState)return s(G_e),void n(K_e);var t=cn(e.date,{days:-14}),a=cn(e.date,{days:1});S_e.getConfiguration().then((function(i){S_e.getDailyLogEntries(_i(t),_i(a)).then((function(t){s(i),t[Br(e.date)]?n(t[Br(e.date)]):n({symptoms:[],treatments:[],notes:""}),e.promptForReviewAfterDays&&Object.keys(t).length>e.promptForReviewAfterDays&&r(!0)}))}))}()}),[]);const v=g((()=>nd(f,300)),[]);var b,x,k,A=il(e.date);function S(e){var t=a.symptoms.find((t=>t.id==e.id));if(t){if("10PointScale"==e.severityTracking){if(!t.severity)return;return t.severity.toString()}if("3PointScale"==e.severityTracking){if(!t.severity)return;if(t.severity>0&&t.severity<=3)return no("mild-shortened");if(t.severity>3&&t.severity<=7)return no("moderate-shortened");if(t.severity>7)return no("severe-shortened")}}}return A+=", "+bl(tl(e.date),"PP"),t.createElement("div",{className:"mdhui-ss-log-entry-edit-wrapper"},t.createElement(XAe,{title:A,showBackButton:!0,variant:"compressed",backgroundColor:"var(--mdhui-background-color-0)",className:"mdhui-ss-edit-nav"}),t.createElement("div",{className:"mdhui-ss-log-entry-edit"},!a&&t.createElement(XA,null),!!a&&!!o&&t.createElement(t.Fragment,null,t.createElement("div",{style:{width:"100%",overflow:"hidden"}},(x=(b=a).symptoms.map((e=>o.symptoms.find((t=>t.id==e.id))?.color)).filter((e=>!!e)).map((e=>e)),k=b.treatments.map((e=>o.treatments.find((t=>t.id==e.id))?.color)).filter((e=>!!e)).map((e=>e)),t.createElement(uM,{size:"large",key:x.join("|")+","+k.join("|"),primaryColors:x,secondaryColors:k}))),Sn(new Date,e.date)&&t.createElement(sM,{className:"mdhui-ss-edit-title",order:3},no("symptoms-experiencing-today")),!Sn(new Date,e.date)&&t.createElement(sM,{className:"mdhui-ss-edit-title",order:3},no("symptoms-experiencing-previous")),t.createElement("div",{className:"mdhui-ss-edit-items"},o?.symptoms.filter((e=>!e.inactive)).map((e=>t.createElement(ySe,{className:"mdhui-ss-edit-item",selected:!!a.symptoms.find((t=>t.id==e.id)),color:e.color,text:e.name,key:e.id,onClick:()=>function(e){if("10PointScale"!=e.severityTracking&&"3PointScale"!=e.severityTracking){var t={...a},n=[...t.symptoms];n.find((t=>t.id==e.id))?n.splice(n.findIndex((t=>t.id==e.id)),1):n.push({id:e.id}),t.symptoms=n,f(t)}else m(e)}(e),badge:S(e)})))),o.treatments.length>0&&t.createElement("div",null,Sn(new Date,e.date)&&t.createElement(sM,{className:"mdhui-ss-edit-title",order:3},no("treatments-experiencing-today")),!Sn(new Date,e.date)&&t.createElement(sM,{className:"mdhui-ss-edit-title",order:3},no("treatments-experiencing-previous")),t.createElement("div",{className:"mdhui-ss-edit-items"},o?.treatments.filter((e=>!e.inactive)).map((e=>t.createElement(ySe,{className:"mdhui-ss-edit-item",selected:!!a.treatments.find((t=>t.id==e.id)),color:e.color,text:e.name,key:e.id,onClick:()=>{return t=e,n={...a},(i=[...n.treatments]).find((e=>e.id==t.id))?i.splice(i.findIndex((e=>e.id==t.id)),1):i.push({id:t.id}),n.treatments=i,void f(n);var t,n,i},bordered:!0}))))),Sn(new Date,e.date)&&t.createElement(sM,{className:"mdhui-ss-edit-title",order:3},no("feeling-overall-today")),!Sn(new Date,e.date)&&t.createElement(sM,{className:"mdhui-ss-edit-title",order:3},no("feeling-overall-previous")),t.createElement("div",{className:"mdhui-ss-edit-items"},t.createElement(xM,{className:"mdhui-ss-edit-face",faceValue:5,selected:5==a.overallFeeling,onClick:()=>y(5)}),t.createElement(xM,{className:"mdhui-ss-edit-face",faceValue:4,selected:4==a.overallFeeling,onClick:()=>y(4)}),t.createElement(xM,{className:"mdhui-ss-edit-face",faceValue:3,selected:3==a.overallFeeling,onClick:()=>y(3)}),t.createElement(xM,{className:"mdhui-ss-edit-face",faceValue:2,selected:2==a.overallFeeling,onClick:()=>y(2)}),t.createElement(xM,{className:"mdhui-ss-edit-face",faceValue:1,selected:1==a.overallFeeling,onClick:()=>y(1)})),t.createElement(sM,{className:"mdhui-ss-edit-title",order:3,style:{marginBottom:"16px"}},no("additional-notes")),t.createElement(QAe,{placeholder:no("add-notes"),autoTimestamp:Sn(new Date,e.date),onChange:e=>function(e){var t={...a};t.notes=e,n(t),v(t)}(e),value:a.notes}),t.createElement(QA,{onClick:()=>(i&&w.requestReview(7),void(u||w.back()))},no("done")),h&&t.createElement("div",{className:"mdhui-ss-symptom-edit-modal"},t.createElement("div",{className:"mdhui-ss-symptom-edit-padder"},t.createElement("div",{className:"mdhui-ss-symptom-edit-container"},t.createElement(sM,{className:"mdhui-ss-edit-title",order:3,style:{marginBottom:"16px"}},Sn(new Date,e.date)?no("how-severe-is"):no("how-severe-was")," ",h.name,"?"),"3PointScale"==h.severityTracking&&t.createElement(sSe,{variant:"optionsVertical",segments:[{key:no("mild-shortened"),title:no("mild")},{key:no("moderate-shortened"),title:no("moderate")},{key:no("severe-shortened"),title:no("severe")}],selectedSegment:S(h),onSegmentSelected:e=>p(h,e)}),"10PointScale"==h.severityTracking&&t.createElement(sSe,{variant:"optionsVertical",segments:[1,2,3,4,5,6,7,8,9,10].map((e=>({key:e.toString(),title:e.toString()}))),selectedSegment:S(h),onSegmentSelected:e=>p(h,parseInt(e))}),t.createElement(QA,{className:"mdhui-ss-clear-symptom",variant:"subtle",onClick:()=>p(h,null)},no("clear-symptom"))))))))}A(".mdhui-ss-log-entry-edit-wrapper {\n background: var(--mdhui-background-color-0);\n}\n\n.mdhui-ss-log-entry-edit {\n text-align: center;\n padding-left: 16px;\n padding-right: 16px;\n padding-bottom: 16px;\n padding-top: 8px;\n position: relative;\n /*Prevents keyboard from covering notes on Android devices*/\n padding-bottom: 300px;\n overflow-x: hidden;\n width: 100%;\n box-sizing: border-box;\n}\n\n\n.mdhui-ss-log-entry-edit .mdhui-ss-edit-title {\n text-align: center;\n margin-bottom: 0;\n margin-top: 16px;\n display: block;\n}\n\n.mdhui-ss-log-entry-edit .mdhui-ss-edit-items {\n padding-top: 8px;\n padding-bottom: 16px;\n text-align: center;\n}\n\n.mdhui-ss-log-entry-edit .mdhui-ss-edit-item {\n margin: 4px;\n}\n\n.mdhui-ss-log-entry-edit .mdhui-ss-edit-face {\n margin-left: 8px;\n margin-right: 8px;\n}\n\n.mdhui-ss-log-entry-edit .mdhui-ss-symptom-edit-modal {\n position: fixed;\n left: 0;\n top: 0;\n right: 0;\n bottom: 0;\n background-color: var(--mdhui-modal-overlay-color);\n overflow: auto;\n z-index: 999;\n}\n\n.mdhui-ss-log-entry-edit .mdhui-ss-symptom-edit-padder {\n padding-bottom: 16px;\n position: absolute;\n padding-top: 48px;\n top: env(safe-area-inset-top);\n left: 48px;\n right: 48px;\n}\n\n.mdhui-ss-log-entry-edit .mdhui-ss-symptom-edit-container {\n border-radius: var(--mdhui-card-border-radius);\n background: var(--mdhui-background-color-0);\n padding: 16px;\n}");function Q_e(e){var a=In(new Date);const[n,i]=c({}),[r,o]=c(null),[l,u]=c(a),[d,h]=c(!0),[m,p]=c(!1),[g,f]=c(!1),[y,v]=c(!0),[b,x]=c([]),[k,A]=c([]),[E,_]=c(!0),[C,T]=c(!1),[P,M]=c(!1),D=s(null);if(id((()=>{if("default"==e.previewState)return o({participantID:"1",symptoms:C_e,treatments:T_e}),void i(P_e);S_e.getConfiguration().then((function(e){S_e.getDailyLogEntries().then((function(t){o(e),i(t)}))}))}),[],[]),!r||!n)return t.createElement("div",{ref:e.innerRef},t.createElement(XA,null));function I(){M(!0);for(var e,t,a=document.head.getElementsByTagName("style"),n="",i=0;i<a.length;i++)n+=a[i].outerHTML;n+=D.current.innerHTML,(e=n,t=r.participantID,w.persistDeviceData([{type:"ReportHtml",observationDate:_i(new Date),value:e}]).then((function(){var e=w.baseUrl+"WebVisualization/WebVisualizationPDF?patientID="+t+"&modelType=VisualizationModel&visualizationKey=Shared.HtmlToPdf";return w.getDeviceInfo().then((function(t){t&&"Web"!=t.platform?window.webkit.messageHandlers.OpenFile.postMessage({url:e}):window.open(e)}))}))).then((function(){M(!1)}))}return t.createElement("div",{className:"ss-report-builder"},t.createElement(oSe,{className:"ss-report-builder-items",noTopMargin:!0},t.createElement("div",{className:"ss-report-builder-item ss-report-builder-month-selector"},t.createElement("div",{className:"ss-report-builder-selector-title"},no("choose-report-month")),t.createElement(iM,{className:"ss-report-date-chooser",variant:"rounded",intervalStart:l,intervalType:"Month",onIntervalChange:e=>u(e)})),t.createElement(S,{className:"ss-report-builder-item",onClick:()=>h(!d)},t.createElement("div",{className:"ss-report-builder-item-title"},no("include-symptoms")),t.createElement("div",{className:"ss-report-builder-item-status"},t.createElement(gge,{icon:d?TM:PM}))),d&&t.createElement("div",{className:"ss-report-builder-item"},t.createElement("div",{className:"ss-report-builder-item-title"},no("select-symptoms")),t.createElement(S,{className:"ss-report-builder-item-status",onClick:()=>p(!m)},0==b.length?"All":b.length+" Selected"," ",t.createElement(gge,{icon:m?O:ye})),m&&t.createElement("div",{className:"ss-report-items",style:{textAlign:"center"}},r.symptoms.filter((e=>!e.inactive)).map((e=>t.createElement(ySe,{className:"ss-report-item",key:e.id,selected:-1!=b.indexOf(e.id),color:e.color,text:e.name,onClick:()=>{return t=e,(a=[...b]).includes(t.id)?a.splice(a.indexOf(t.id),1):a.push(t.id),void x(a);var t,a}}))))),r.treatments.length>0&&t.createElement(t.Fragment,null,t.createElement(S,{className:"ss-report-builder-item",onClick:()=>v(!y)},t.createElement("div",{className:"ss-report-builder-item-title"},no("include-treatments")),t.createElement("div",{className:"ss-report-builder-item-status"},t.createElement(gge,{icon:y?TM:PM}))),y&&t.createElement("div",{className:"ss-report-builder-item"},t.createElement("div",{className:"ss-report-builder-item-title"},no("select-treatments")),t.createElement(S,{className:"ss-report-builder-item-status",onClick:()=>f(!g)},0==k.length?"All":k.length+" Selected"," ",t.createElement(gge,{icon:g?O:ye})),g&&t.createElement("div",{className:"ss-report-items",style:{textAlign:"center"}},r.treatments.filter((e=>!e.inactive)).map((e=>t.createElement(ySe,{bordered:!0,className:"ss-report-item",key:e.id,selected:-1!=k.indexOf(e.id),color:e.color,text:e.name,onClick:()=>{return t=e,(a=[...k]).includes(t.id)?a.splice(a.indexOf(t.id),1):a.push(t.id),void A(a);var t,a}})))))),t.createElement(S,{className:"ss-report-builder-item",onClick:()=>_(!E)},t.createElement("div",{className:"ss-report-builder-item-title"},no("include-overall-experience")),t.createElement("div",{className:"ss-report-builder-item-status"},t.createElement(gge,{icon:E?TM:PM}))),t.createElement(S,{className:"ss-report-builder-item",onClick:()=>T(!C)},t.createElement("div",{className:"ss-report-builder-item-title"},no("include-notes")),t.createElement("div",{className:"ss-report-builder-item-status"},t.createElement(gge,{icon:C?TM:PM})))),t.createElement("div",{style:{padding:"16px",paddingTop:"0"}},t.createElement(QA,{loading:P,disabled:P||!d&&!y&&!C&&!E,onClick:()=>I()},!P&&t.createElement("span",null,no("create-report")))),t.createElement("div",{ref:D,style:{display:"none"}},t.createElement(rM.Provider,{value:{intervalStart:l,intervalType:"Month",update:lM}},t.createElement(D_e.Provider,{value:{logEntries:n,symptoms:d?r.symptoms.filter((e=>!b.length||-1!=b.indexOf(e.id))):[],treatments:y?r.treatments.filter((e=>!k.length||-1!=k.indexOf(e.id))):[],hasFilteredSymptoms:!!b.length}},t.createElement(V_e,{includeDailyOverallFeeling:E,includeNotes:C,productLogo:e.productLogo,productUrl:e.productUrl,productName:e.productName})))))}function J_e(e){return t.createElement(Ka,{colorScheme:e.colorScheme??"light"},t.createElement(oM,{variant:"rounded",intervalType:"Month",sticky:!0},t.createElement(I_e,{showFilters:!0,previewState:e.previewState},t.createElement(oSe,null,t.createElement(j_e,{onDaySelected:e.onDaySelected})),t.createElement(oSe,null,t.createElement(W_e,{onSymptomSelected:e.onSymptomSelected})),t.createElement(oSe,null,t.createElement(R_e,null)),t.createElement(eCe,null))))}function eCe(){let e=r(D_e);if(!e)return t.createElement($q,null,"Error: Calendar severity charts must be used inside a Symptom Shark Visualization Coordinator.");let{hasFilteredSymptoms:a,symptoms:n}=e;return a?t.createElement(t.Fragment,null,n.filter((e=>"None"!=e.severityTracking)).map((e=>t.createElement(oSe,{key:e.id},t.createElement(U_e,{symptom:e}))))):null}function tCe(e){return t.createElement(Ka,{bodyBackgroundColor:"var(--mdhui-background-color-0)",colorScheme:e.colorScheme||"light"},t.createElement(X_e,{...e}))}function aCe(e){return t.createElement(Ka,{colorScheme:e.colorScheme??"light"},t.createElement(XAe,{variant:"compressed",title:no("reports")}),t.createElement(Q_e,{previewState:e.previewState}))}function nCe(e){return t.createElement(Ka,{colorScheme:e.colorScheme||"light",className:"symptom-detail-view symptom-shark-view"},t.createElement(I_e,{previewState:e.previewState},t.createElement(iCe,{...e})))}function iCe(e){let a=r(D_e);if(!a)return null;let n=a.symptoms.find((t=>t.id==e.symptomId));if(!n)return null;var i=e.initialIntervalStart||In(new Date);return t.createElement(t.Fragment,null,t.createElement(XAe,{title:n.name,showCloseButton:!0}),t.createElement(oM,{initialIntervalStart:i,intervalType:"Month",variant:"rounded"},t.createElement(oSe,{noTopMargin:!0},t.createElement($_e,{symptom:n})),t.createElement(oSe,null,t.createElement(U_e,{symptom:n}))))}function rCe(e){return t.createElement(Ka,{colorScheme:e.colorScheme},t.createElement(XAe,{showBackButton:"Push"==e.presentation,showCloseButton:"Modal"==e.presentation},t.createElement(sM,{order:2,autosizeImage:!0,image:t.createElement("img",{src:bge}),imageAlignment:"left"},no("allergies-title"))),t.createElement(aS,null,t.createElement(Vq,{previewState:e.previewState,onViewTermInfo:t=>function(t){if(e.onViewTermInfo)e.onViewTermInfo(t);else{var a=new URLSearchParams({termFamily:t.TermFamily,termNamespace:t.TermNamespace,termCode:t.TermCode,lang:w.getCurrentLanguage()}).toString();w.openApplication("https://hw.careevolutionapps.com/TermInformation.html?"+a,{modal:!0})}}(t)})))}function oCe(e){return t.createElement(Ka,{bodyBackgroundColor:e.bodyBackgroundColor,colorScheme:e.colorScheme??"auto",primaryColor:e.primaryColor,flex:e.flexLayout},(e.showBackButton||e.showCloseButton)&&t.createElement(XAe,{title:e.title,showBackButton:e.showBackButton,showCloseButton:e.showCloseButton,subtitle:e.subtitle,titleColor:e.titleColor,subtitleColor:e.subtitleColor,buttonColor:e.navigationBarButtonColor}),!(e.showBackButton||e.showCloseButton)&&t.createElement(t.Fragment,null,!e.flexLayout&&t.createElement(fSe,null),t.createElement(bSe,{title:e.title,subtitle:e.subtitle,titleColor:e.titleColor,subtitleColor:e.subtitleColor})),e.children)}function sCe(e){return t.createElement(Ka,{colorScheme:e.colorScheme},t.createElement(XAe,{showBackButton:"Push"==e.presentation,showCloseButton:"Modal"==e.presentation},t.createElement(sM,{order:2,autosizeImage:!0,image:t.createElement("img",{src:xge}),imageAlignment:"left"},no("conditions-title"))),t.createElement(aS,null,t.createElement(rU,{previewState:e.previewState,onViewTermInfo:t=>function(t){if(e.onViewTermInfo)e.onViewTermInfo(t);else{var a=new URLSearchParams({termFamily:t.TermFamily,termNamespace:t.TermNamespace,termCode:t.TermCode,lang:w.getCurrentLanguage()}).toString();w.openApplication("https://hw.careevolutionapps.com/TermInformation.html?"+a,{modal:!0})}}(t)})))}function lCe(e){return t.createElement(oCe,{showBackButton:"Push"==e.presentation,showCloseButton:"Modal"==e.presentation,colorScheme:e.colorScheme},e.deviceActivityViewUrl&&t.createElement(aS,null,t.createElement(UAe,{onClick:()=>w.openApplication(e.deviceActivityViewUrl),dataTypes:dd,previewState:e.previewState?"fetchingData":void 0})),t.createElement(aS,null,t.createElement(EU,{previewState:e.previewState?"Web":void 0,enableAppleHealthSurveyName:e.enableAppleHealthSurveyName,enableGoogleFitSurveyName:e.enableGoogleFitSurveyName,postalCodeSurveyName:e.postalCodeSurveyName})),t.createElement(aS,null,t.createElement(Cde,{previewState:e.previewState?"connected":void 0})),t.createElement(aS,null,t.createElement(Mde,{previewState:e.previewState?"connected":void 0})))}function cCe(e){let a="",n=[];return e.excludeProviders||(n.push("Provider"),a+=no("connect-ehr-title-providers")),e.excludeHealthPlans||(n.push("Health Plan"),a.length>0&&(a+=no("connect-ehr-title-divider")),a+=no("connect-ehr-title-health-plans")),a=no("connect-ehr-title-prefix")+a,t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},e.presentation&&t.createElement(XAe,{title:a,showBackButton:"Push"==e.presentation,showCloseButton:"Modal"==e.presentation}),!e.presentation&&t.createElement(fSe,null),e.onViewEhr&&t.createElement(aS,null,t.createElement(VAe,{previewState:e.preview?"fetchingData":void 0,onClick:e.onViewEhr})),t.createElement(aS,null,t.createElement(vge,null)),e.externalAccountsApplicationUrl&&t.createElement(aS,null,t.createElement(xde,{previewState:e.preview?"Default":void 0,applicationUrl:e.externalAccountsApplicationUrl,excludeProviders:e.excludeProviders,excludeHealthPlans:e.excludeHealthPlans,excludeDeviceManufacturers:!0})),t.createElement(aS,null,t.createElement($q,null,no("ehr-intro-search")),t.createElement(AAe,{previewState:e.preview?"Default":void 0,providerCategories:n})))}function uCe(e){const[a,n]=t.useState("daily"),i=dd.map((e=>({dailyDataType:e.type,color:e.color})));return t.createElement(oCe,{showBackButton:"Push"==e.presentation,showCloseButton:"Modal"==e.presentation,colorScheme:e.colorScheme},t.createElement(sSe,{style:{marginTop:e.presentation?"0px":"16px",marginLeft:"16px",marginRight:"16px",marginBottom:"daily"==a?"16px":"0px"},variant:"default",segments:[{title:no("daily"),key:"daily"},{title:no("weekly"),key:"weekly"},{title:no("monthly"),key:"monthly"}],onSegmentSelected:e=>n(e),selectedSegment:a}),"daily"==a&&t.createElement(_Ae,{dataTypes:i,previewState:e.previewState},t.createElement(aS,null,t.createElement(cM,{defaultMargin:!0}),t.createElement(TAe,{useContext:!0,previewState:e.previewState?"Default":void 0}))),("monthly"==a||"weekly"==a)&&t.createElement(oM,{intervalType:"weekly"==a?"Week":"Month",key:a,variant:"rounded"},t.createElement(oSe,{noTopMargin:!0},dd.map((a=>t.createElement(Lue,{hideIfNoData:a.type!=Hr.Steps&&a.type!=Hr.SleepMinutes,title:a.labelKey?no(a.labelKey):void 0,key:a.type,dailyDataType:a.type,chartType:"Bar",options:{barColor:a.color},previewState:e.previewState}))))))}function dCe(e){return t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},t.createElement(fSe,null),t.createElement(aS,{allowOverflow:!0},t.createElement(que,{previewState:e.preview?"Default":void 0})),t.createElement(aS,null,t.createElement(Cde,{previewState:e.preview?"connected":void 0})),t.createElement(aS,null,t.createElement(Mde,{previewState:e.preview?"connected":void 0})),t.createElement(aS,null,t.createElement(EU,{previewState:e.preview?"Web":void 0})))}A(".ss-report-builder {\n padding-bottom: env(safe-area-inset-bottom);\n position: relative;\n padding-bottom: 16px;\n}\n\n.ss-report-builder .ss-report-builder-items .ss-report-builder-item {\n border-bottom: solid 1px var(--mdhui-border-color-1);\n padding: 16px;\n background: var(--mdhui-background-color-0);\n position: relative;\n cursor: pointer;\n width: 100%;\n box-sizing: border-box;\n}\n\n.ss-report-builder .ss-report-builder-items .ss-report-builder-item .ss-report-builder-item-title {\n font-weight: normal;\n font-size: 17px;\n}\n\n.ss-report-builder .ss-report-builder-items .ss-report-builder-item .ss-report-builder-item-status {\n position: absolute;\n right: 0;\n top: 0;\n padding: 16px;\n cursor: pointer;\n text-align: right;\n width: 100%;\n font-weight: bold;\n}\n\n.ss-report-builder .ss-report-builder-items .ss-report-builder-item svg {\n color: var(--mdhui-text-color-3);\n font-size: 17px;\n top: calc(50% - 16px);\n}\n\n.ss-report-builder .ss-report-builder-items .ss-report-builder-item .fa-circle-check {\n color: var(--mdhui-color-success);\n}\n\n.ss-report-builder .ss-report-builder-items .ss-report-builder-item.ss-report-builder-month-selector {\n text-align: center;\n font-size: 17px;\n font-weight: bold;\n cursor: auto;\n padding-left: 0;\n padding-right: 0;\n padding-bottom: 0;\n}\n\n.ss-report-builder .ss-report-builder-items .ss-report-builder-item.ss-report-month-selector .ss-report-builder-selector-title {\n text-transform: uppercase;\n font-size: 12px;\n color: var(--mdhui-text-color-2);\n padding-bottom: 4px;\n}\n\n.ss-report-builder .ss-report-builder-items .ss-report-date-chooser {\n background: none;\n}\n\n.ss-report-builder .ss-report-items {\n margin-top: 12px;\n margin-bottom: -4px;\n}\n\n.ss-report-builder .ss-report-items .ss-report-item {\n margin: 4px;\n}\n\n.ss-report-builder .ss-report-report-date-chooser {\n margin: 0;\n}");function hCe(e){const[a,n]=c(),[i,r]=c(),[o,u]=c(!1),d=s();id((()=>{e.previewState?(e=>{const t=e.endsWith("mobile")?"iOS":"Web";if(a!==t)return void n(t);const o="loading"===e?void 0:function(e){return{file:"vr_05022025."+(e.startsWith("pdf")?"pdf":"png"),fileType:e.startsWith("pdf")?"pdf":"image",name:"Vaccination Records",type:"Other",date:"2025-05-02",notes:"Here are some notes about this document.",fileUrl:"https://assets.careevolutionapps.com/MDH-UI/grilled_cheese."+(e.startsWith("pdf")?"pdf":"png")}}(e);r(o),u("loading"!==e&&i?.fileUrl!==o?.fileUrl)})(e.previewState):a?WA().load(e.surveyResultId,e.surveySpecification).then((e=>{e?d.current||(r(e),u(!!e.fileUrl)):w.back()})):(async()=>{const e=await w.getDeviceInfo();n(e.platform)})()}),[],[e.previewState,a]),l((()=>{d.current=i}),[i]);const h=async()=>{!e.previewState&&i?.fileUrl&&w.openExternalUrl(i.fileUrl)};return t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},t.createElement(XAe,{showBackButton:!0,className:"mdhui-document-detail-view-nav-bar",navigationBarRight:a&&i?t.createElement("div",{className:"mdhui-document-detail-view-nav-bar-icon",onClick:h},t.createElement(Ne,{icon:"Web"===a?de:W})):void 0}),t.createElement("div",{className:"mdhui-document-detail-view"},!i&&t.createElement(XA,null),i&&t.createElement(t.Fragment,null,t.createElement("div",{className:"mdhui-document-detail-view-preview-container"},t.createElement("div",{className:"mdhui-document-detail-view-preview",onClick:h},o&&t.createElement(XA,{className:"mdhui-document-detail-view-preview-loading"}),i.fileUrl&&"image"===i.fileType&&t.createElement("img",{src:i.fileUrl,style:{display:o?"none":"inline"},onLoad:()=>u(!1),alt:no("document-detail-view-preview-image-alt")}),i.fileUrl&&"pdf"===i.fileType&&t.createElement(yAe,{url:i.fileUrl,style:{display:o?"none":"inline"},maxHeight:.5*window.innerHeight,maxWidth:.8*window.innerWidth,onLoad:()=>u(!1)}),!o&&!i.fileUrl&&t.createElement("div",{className:"mdhui-document-detail-view-preview-unavailable"},no("document-detail-view-preview-unavailable"))),t.createElement("div",{className:"mdhui-document-detail-view-preview-label"},i.file)),t.createElement("div",{className:"mdhui-document-detail-view-document-details"},t.createElement("div",{className:"mdhui-document-detail-view-document-name"},i.name),t.createElement("div",{className:"mdhui-document-detail-view-document-date-and-type"},GA(i)),t.createElement("div",{className:"mdhui-document-detail-view-document-notes-title"},no("document-detail-view-notes-title")),i.notes&&t.createElement("div",{className:"mdhui-document-detail-view-document-notes"},i.notes),!i.notes&&t.createElement("div",{className:"mdhui-document-detail-view-document-notes-none"},no("document-detail-view-notes-none"))),t.createElement("div",{className:"mdhui-document-detail-view-document-buttons"},t.createElement(QA,{variant:"light",color:"var(--mdhui-color-danger)",onClick:async()=>{if(e.previewState||!i)return;window.confirm(no("document-detail-view-delete-confirmation"))&&(i.fileKey&&await w.deleteFile(i.fileKey),await w.deleteSurveyResult(i.surveyResultId),w.back())}},no("document-detail-view-delete-button-text"))))))}A("body:has(.mdhui-document-detail-view) {\n background: var(--mdhui-background-color-0);\n}\n\n.mdhui-navigation-bar.mdhui-document-detail-view-nav-bar {\n background: var(--mdhui-background-color-0);\n margin-bottom: 0;\n}\n\n.mdhui-navigation-bar.mdhui-document-detail-view-nav-bar .mdhui-document-detail-view-nav-bar-icon {\n position: absolute;\n top: calc(0px + env(safe-area-inset-top, 0px));\n right: 8px;\n bottom: 0;\n width: 48px;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--mdhui-color-primary);\n font-size: 1.2em;\n cursor: pointer;\n}\n\n.mdhui-document-detail-view {\n border-top: 1px solid var(--mdhui-background-color-1);\n}\n\n.mdhui-document-detail-view .mdhui-document-detail-view-preview-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n background: var(--mdhui-background-color-2);\n border-top: 1px solid var(--mdhui-border-color-2);\n border-bottom: 1px solid var(--mdhui-border-color-2);\n padding: 16px;\n}\n\n.mdhui-document-detail-view .mdhui-document-detail-view-preview {\n display: flex;\n align-items: center;\n justify-content: center;\n background: var(--mdhui-background-color-1);\n padding: 16px;\n flex: 1;\n box-shadow: var(--mdhui-box-shadow-0);\n max-width: 80vw;\n cursor: pointer;\n}\n\n.mdhui-document-detail-view .mdhui-document-detail-view-preview-loading {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 20vh;\n width: 40vw;\n padding: 16px;\n}\n\n.mdhui-document-detail-view .mdhui-document-detail-view-preview img {\n max-height: 50vh;\n max-width: 100%;\n}\n\n.mdhui-document-detail-view .mdhui-document-detail-view-preview-unavailable {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 20vh;\n width: 40vw;\n padding: 16px;\n font-size: 0.8em;\n color: var(--mdhui-text-color-2);\n}\n\n.mdhui-document-detail-view .mdhui-document-detail-view-preview-label {\n margin-top: 16px;\n font-size: 0.8em;\n color: var(--mdhui-text-color-2);\n}\n\n.mdhui-document-detail-view .mdhui-document-detail-view-document-details {\n display: flex;\n flex-direction: column;\n padding: 16px;\n min-width: 0;\n}\n\n.mdhui-document-detail-view .mdhui-document-detail-view-document-name {\n font-size: 1.2em;\n font-weight: bold;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n margin-bottom: 4px;\n}\n\n.mdhui-document-detail-view .mdhui-document-detail-view-document-date-and-type {\n font-size: 0.9em;\n font-weight: bold;\n color: var(--mdhui-text-color-2);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.mdhui-document-detail-view .mdhui-document-detail-view-document-notes-title {\n font-weight: bold;\n margin-top: 16px;\n}\n\n.mdhui-document-detail-view .mdhui-document-detail-view-document-notes {\n font-size: 0.9em;\n}\n\n.mdhui-document-detail-view .mdhui-document-detail-view-document-notes-none {\n font-size: 0.9em;\n color: var(--mdhui-text-color-2);\n}\n\n.mdhui-document-detail-view .mdhui-document-detail-view-document-buttons {\n padding: 16px;\n}");function mCe(e,t,a,n){return{surveyResultId:`survey-result-id-${vp()}`,fileType:e,name:t,type:a,date:n?_i(n,{representation:"date"}):void 0,fileUrl:"https://assets.careevolutionapps.com/MDH-UI/grilled_cheese."+("pdf"===e?"pdf":"png")}}function pCe(e){const[a,n]=c(!0),[i,r]=c(),[o,u]=c(),[d,h]=c("date"),[m,p]=c("desc"),g=s(),f=e=>{n("loading"===e||"reloading"===e),r("loading"!==e?function(e){const t=[],a=new Date;return"some documents"===e&&(t.push(mCe("image","Vaccination Records","Other",cn(a,{days:-7}))),t.push(mCe("pdf","Insurance Card","Insurance / Benefits",cn(a,{days:-2}))),t.push(mCe("image","Lab result",void 0,cn(a,{days:-5}))),t.push(mCe("image","Ultrasound","Test Results",cn(a,{days:-3}))),t.push(mCe("pdf","Discharge Summary","Visit Summary",void 0)),t.push(mCe("image","Referral Letter",void 0,void 0)),t.push(mCe("image","Medication Help","Instructions",cn(a,{days:-10})))),t}("reloading"!==e?e:"some documents"):void 0),u(void 0)},y=e=>"type"===d?[...e].sort($A("type",m)):"name"===d?[...e].sort($A("name",m)):[...e].sort($A("date",m));id((()=>{e.previewState?f(e.previewState):(n(!0),VA().load(e.surveySpecification,!0).then((e=>{(e=>{const t=(g.current??[]).reduce(((e,t)=>(e[t.surveyResultId]=t,e)),{}),a=e.map((e=>t[e.surveyResultId]??e));r(y(a))})(e),n(!1),u(void 0)})))}),[],[e.previewState]),l((()=>{g.current=i}),[i]),l((()=>{i&&r(y(i))}),[d,m]);const v=e=>{const t=no(`document-library-view-sort-title-${e}`);return d===e?t+" "+("asc"===m?"▴":"▾"):t};return t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},t.createElement(XAe,{showBackButton:!0,className:"mdhui-document-library-view-nav-bar"}),t.createElement("div",{className:"mdhui-document-library-view"},t.createElement("div",{className:"mdhui-document-library-header"},t.createElement("div",{className:"mdhui-document-library-view-title"},no("document-library-view-title")),t.createElement("div",null,t.createElement(QA,{fullWidth:!1,variant:"light",onClick:()=>{e.previewState||w.startSurvey(e.surveySpecification.surveyName)}},no("document-library-view-upload-button-text")))),t.createElement("div",{className:"mdhui-document-library-subheader"},t.createElement(sSe,{segments:[{key:"date",title:v("date")},{key:"name",title:v("name")},{key:"type",title:v("type")}],onSegmentSelected:e=>{d===e?p("asc"===m?"desc":"asc"):h(e)},selectedSegment:d})),a&&!i&&t.createElement(XA,null),a&&i&&t.createElement(XA,{className:"mdhui-document-library-view-reloading-indicator"}),0===i?.length&&t.createElement("div",{className:"mdhui-document-library-view-documents-empty"},no("document-library-view-empty-text")),i&&i.length>0&&t.createElement("div",{className:"mdhui-document-library-view-documents"},i.map((a=>t.createElement(gCe,{key:a.surveyResultId,document:a,disabled:a===o,onClick:()=>(t=>{if(e.previewState)return;u(t);const a=e.documentDetailViewBaseUrl.includes("?")?"&":"?",n=new URLSearchParams({...e.surveySpecification,surveyResultId:t.surveyResultId});w.openApplication(`${e.documentDetailViewBaseUrl}${a}${n}`)})(a)}))))))}function gCe(e){const[a,n]=c(!!e.document.fileUrl),i=["mdhui-document-library-view-document"];return e.disabled&&i.push("mdhui-document-library-view-document-disabled"),t.createElement(Za,{className:i.join(" "),onClick:e.disabled?void 0:e.onClick,renderAs:e.disabled?"div":void 0,indicator:e.disabled?t.createElement(Ne,{icon:V,spin:!0}):void 0},t.createElement("div",{className:"mdhui-document-library-view-document-contents"},t.createElement("div",{className:"mdhui-document-library-view-document-thumbnail"},a&&t.createElement(XA,{className:"mdhui-document-library-view-document-thumbnail-loading"}),e.document.fileUrl&&"image"===e.document.fileType&&t.createElement("img",{src:e.document.fileUrl,style:{display:a?"none":"inline"},onLoad:()=>n(!1),alt:no("document-library-view-thumbnail-image-alt")}),e.document.fileUrl&&"pdf"===e.document.fileType&&t.createElement(yAe,{url:e.document.fileUrl,style:{display:a?"none":"inline"},maxHeight:48,maxWidth:48,onLoad:()=>n(!1)}),!a&&!e.document.fileUrl&&t.createElement(Ne,{icon:Me})),t.createElement("div",{className:"mdhui-document-library-view-document-details"},t.createElement("div",{className:"mdhui-document-library-view-document-name"},e.document.name),t.createElement("div",{className:"mdhui-document-library-view-document-date-and-type"},GA(e.document)))))}function fCe(e){let a="",n=t.createElement(t.Fragment,null);switch(e.feed){case"Procedures":a=no("procedures-title"),n=t.createElement("img",{src:Jue});break;case"Reports":a=no("reports-title"),n=t.createElement("img",{src:Que});break;case"Immunizations":a=no("immunizations-title"),n=t.createElement("img",{src:ede});break;case"LabReports":a=no("lab-results-title"),n=t.createElement("img",{src:tde})}return t.createElement(Ka,{colorScheme:e.colorScheme},t.createElement(XAe,{showBackButton:"Push"==e.presentation,showCloseButton:"Modal"==e.presentation},t.createElement(sM,{order:2,autosizeImage:!0,image:n,imageAlignment:"left"},a)),t.createElement(sde,{feed:e.feed,onEventSelected:e.onEventSelected,onReportSelected:e.onReportSelected,previewState:e.previewState}))}function yCe(e){return t.createElement(Ka,{colorScheme:e.colorScheme},t.createElement(XAe,{variant:"compressed",showBackButton:"Push"==e.presentation,showCloseButton:"Modal"==e.presentation}),t.createElement(cde,{feed:e.feed,pageId:e.pageId,pageDate:e.pageDate,previewState:e.previewState,onViewLabObservationTermInfo:e.onViewLabObservationTermInfo}))}function vCe(e){let a="",n=[];return e.excludeProviders||(n.push("Provider"),a+=no("external-accounts-title-providers")),e.excludeHealthPlans||(n.push("Health Plan"),a.length>0&&(a+=no("external-accounts-title-divider")),a+=no("external-accounts-title-health-plans")),e.excludeDeviceManufacturers||(n.push("Device Manufacturer"),a.length>0&&(a+=no("external-accounts-title-divider")),a+=no("external-accounts-title-devices")),t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},e.presentation&&t.createElement(XAe,{title:a,showBackButton:"Push"==e.presentation,showCloseButton:"Modal"==e.presentation}),!e.presentation&&t.createElement(fSe,null),t.createElement(yde,{previewState:e.previewState,externalAccountProviderCategories:n,onExternalAccountsLoaded:function(t){0===t.length&&("Modal"===e.presentation?w.dismiss():w.back())},connectExternalAccountOptions:e.connectExternalAccountOptions}))}function bCe(e){var[a,n]=c(!1);return l((()=>{w.connect().then((()=>{n(!0)}))}),[]),t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},t.createElement(fSe,null),a&&t.createElement(t.Fragment,null,t.createElement(aS,null,t.createElement(jU,{previewState:e.connectPreview,disabledBehavior:"displayError"})),t.createElement(aS,null,t.createElement(Cde,{previewState:e.devicesPreview})),t.createElement(aS,{allowOverflow:!0},t.createElement(Pde,{previewState:e.chartsPreview}))),!a&&t.createElement(XA,null))}function wCe(e){var[a,n]=c(!1);return l((()=>{w.connect().then((()=>{n(!0)}))}),[]),t.createElement(Ka,null,t.createElement(fSe,{color:"var(--main-bg-color)"}),a&&t.createElement(t.Fragment,null,t.createElement(aS,null,t.createElement(zU,{previewState:e.connectPreview,garminProviderID:e.garminProviderID,disabledBehavior:"displayError"})),t.createElement(aS,null,t.createElement(Mde,{previewState:e.devicesPreview})),t.createElement(aS,{allowOverflow:!0},t.createElement(Dde,{previewState:e.chartsPreview}))),!a&&t.createElement(XA,null))}function xCe(e){var a="Push";e.notificationType&&(a=e.notificationType);return t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},t.createElement(fSe,{color:"#FFFFFF"}),t.createElement(aS,null,t.createElement(Zq,{previewDevicePlatform:e.preview?"Web":void 0,previewProjectPlatforms:e.preview?["Web","Android","iOS"]:void 0})),t.createElement(aS,null,t.createElement(dfe,{notificationType:a,onViewMore:e.notificationsViewUrl?()=>{e.notificationsViewUrl&&w.openApplication(e.notificationsViewUrl)}:void 0,previewState:e.preview?"loaded with data":void 0,hideAfterHours:e.notificationHideAfterHours})),t.createElement(jAe,{variant:"singleCard",status:"incomplete",limit:3,title:no("tasks"),onDetailLinkClick:e.tasksViewUrl?()=>{e.tasksViewUrl&&w.openApplication(e.tasksViewUrl)}:void 0,previewState:e.preview?"IncompleteTasks":void 0}),t.createElement(aS,null,t.createElement(EU,{headerVariant:"medium",previewState:e.preview?"Web":void 0})),t.createElement(aS,null,e.ehrConnectApplicationUrl&&t.createElement(NU,{variant:"medium",previewState:e.preview?"enabled":void 0,applicationUrl:e.ehrConnectApplicationUrl})),t.createElement(aS,null,t.createElement(bAe,{previewState:e.preview?"Default":void 0})))}function kCe(e){function a(){e.onViewLabs?e.onViewLabs():w.openApplication("https://hw.careevolutionapps.com/LabReports.html?lang="+w.getCurrentLanguage())}function n(t){if(e.onViewTermInfo)e.onViewTermInfo(t);else{var a=new URLSearchParams({termFamily:t.TermFamily,termNamespace:t.TermNamespace,termCode:t.TermCode,lang:w.getCurrentLanguage()}).toString();w.openApplication("https://hw.careevolutionapps.com/TermInformation.html?"+a,{modal:!0})}}let i=e.variant??"default";function r(a){var n=function(){return t.createElement(kge,{concept:a,onClick:()=>function(t){e.onViewHealthSectionDetails?e.onViewHealthSectionDetails(t):w.openApplication("https://hw.careevolutionapps.com/"+t+".html")}(a),previewState:"default"==e.previewState?"Default":void 0,indicatorPosition:"cardBased"==i?"topRight":"default"})};return"cardBased"==e.variant?t.createElement(aS,null,n()):n()}return t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},e.presentation&&t.createElement(XAe,{showBackButton:"Push"==e.presentation,showCloseButton:"Modal"==e.presentation}),!e.presentation&&t.createElement(fSe,null),t.createElement(bde,{previewState:"default"==e.previewState?"externalAccountsLoaded":void 0,externalAccountCategories:["Provider","Health Plan"],triggerWebExternalAccountSyncComplete:!0}),"default"==i&&t.createElement(oSe,{noTopMargin:!0},t.createElement(Yge,{onViewTermInfo:e=>n(e),onClick:()=>a(),previewState:"default"==e.previewState?"ImportantLabs":void 0}),t.createElement($ge,{previewState:"default"==e.previewState?"BloodTypeLabs":void 0}),r("Medications"),r("Immunizations"),r("Reports"),r("Allergies"),r("Conditions"),r("Procedures"),t.createElement(xde,{excludeDeviceManufacturers:!0,applicationUrl:e.externalAccountsApplicationUrl,previewState:"default"==e.previewState?"Default":void 0})),"cardBased"==i&&t.createElement(t.Fragment,null,t.createElement(aS,null,t.createElement(Yge,{onViewTermInfo:e=>n(e),onClick:()=>a(),previewState:"default"==e.previewState?"ImportantLabs":void 0})),t.createElement(aS,null,t.createElement($ge,{previewState:"default"==e.previewState?"BloodTypeLabs":void 0})),r("Medications"),r("Immunizations"),r("Reports"),r("Allergies"),r("Conditions"),r("Procedures"),t.createElement(aS,null,t.createElement(xde,{excludeDeviceManufacturers:!0,applicationUrl:e.externalAccountsApplicationUrl,previewState:"default"==e.previewState?"Default":void 0}))),t.createElement(aS,null,t.createElement(NU,{bottomBorder:!0,applicationUrl:e.connectEhrApplicationUrl,previewState:"default"==e.previewState?"enabledConnected":void 0})))}function ACe(e){const a=()=>{e.previewState&&"live"!==e.previewState||w.dismiss()};return t.createElement(Ka,{colorScheme:e.colorScheme??"auto",flex:!0},t.createElement(aS,null,t.createElement(ife,{previewState:"live"!==e.previewState?e.previewState:void 0,onError:a,onDelete:a,onCancel:a,onSave:a,withImageCapture:!0})))}function SCe(e){return t.createElement(Ka,{colorScheme:e.colorScheme},t.createElement(XAe,{showBackButton:"Push"==e.presentation,showCloseButton:"Modal"==e.presentation},t.createElement(sM,{order:2,autosizeImage:!0,image:t.createElement("img",{src:wge}),imageAlignment:"left"},no("medications-title"))),t.createElement(aS,null,t.createElement(rfe,{previewState:e.previewState,onViewTermInfo:t=>function(t){if(e.onViewTermInfo)e.onViewTermInfo(t);else{var a=new URLSearchParams({termFamily:t.TermFamily,termNamespace:t.TermNamespace,termCode:t.TermCode,lang:w.getCurrentLanguage()}).toString();w.openApplication("https://hw.careevolutionapps.com/TermInformation.html?"+a,{modal:!0})}}(t)})))}function ECe(e){var a="Push";return e.notificationType&&(a=e.notificationType),t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},e.presentation&&t.createElement(XAe,{title:no("notifications"),showBackButton:"Push"==e.presentation,showCloseButton:"Modal"==e.presentation}),!e.presentation&&t.createElement(fSe,null),t.createElement(mfe,{notificationType:a,previewState:e.preview?"loaded with data":void 0}))}function _Ce(e){return t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},e.presentation&&t.createElement(XAe,{title:no("tasks"),showBackButton:"Push"==e.presentation,showCloseButton:"Modal"==e.presentation}),!e.presentation&&t.createElement(fSe,null),!e.hideIncompleteTasks&&t.createElement(jAe,{variant:"multiCard",title:no("incomplete-tasks"),status:"incomplete",previewState:e.preview?"IncompleteTasks":void 0}),!e.hideCompleteTasks&&t.createElement(jAe,{variant:"multiCard",title:no("completed-tasks"),status:"complete",previewState:e.preview?"CompleteTasks":void 0}))}A("body:has(.mdhui-document-library-view) {\n background: var(--mdhui-background-color-0);\n}\n\n.mdhui-navigation-bar.mdhui-document-library-view-nav-bar {\n background: var(--mdhui-background-color-0);\n margin-bottom: 0;\n}\n\n.mdhui-document-library-view {\n padding: 16px;\n border-top: 1px solid var(--mdhui-background-color-1);\n}\n\n.mdhui-document-library-view .mdhui-document-library-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin: 0 0 16px;\n}\n\n.mdhui-document-library-view .mdhui-document-library-view-title {\n font-size: 1.7em;\n font-weight: bold;\n}\n\n.mdhui-document-library-view .mdhui-document-library-subheader {\n padding: 2px;\n margin: 0 0 16px;\n}\n\n.mdhui-document-library-view .mdhui-document-library-subheader .mdhui-segmented-control {\n background-color: var(--mdhui-background-color-1);\n border-color: var(--mdhui-background-color-1);\n min-width: 200px;\n}\n\n.mdhui-document-library-view .mdhui-document-library-subheader .mdhui-segmented-control .mdhui-segment {\n background-color: var(--mdhui-background-color-1);\n border: 1px solid var(--mdhui-background-color-1);\n color: var(--mdhui-text-color-0);\n}\n\n.mdhui-document-library-view .mdhui-document-library-subheader .mdhui-segmented-control .mdhui-segment-selected {\n background-color: var(--mdhui-background-color-0);\n border: 1px solid var(--mdhui-border-color-1);\n color: var(--mdhui-text-color-0);\n}\n\n.mdhui-document-library-view .mdhui-document-library-view-reloading-indicator {\n font-size: 0.8em;\n padding: 0;\n}\n\n.mdhui-document-library-view .mdhui-document-library-view-documents-empty {\n color: var(--mdhui-text-color-3);\n text-align: center;\n margin: 32px 0;\n}\n\n.mdhui-document-library-view .mdhui-action.mdhui-document-library-view-document {\n background: var(--mdhui-background-color-1);\n border-radius: 10px;\n margin: 16px 0;\n min-width: 200px;\n}\n\n.mdhui-document-library-view .mdhui-action.mdhui-document-library-view-document-disabled {\n opacity: 0.5;\n}\n\n.mdhui-document-library-view .mdhui-document-library-view-document-contents {\n display: flex;\n align-items: center;\n gap: 12px;\n}\n\n.mdhui-document-library-view .mdhui-document-library-view-document-thumbnail {\n height: 48px;\n width: 48px;\n min-width: 48px;\n border-radius: 5px;\n overflow: hidden;\n}\n\n.mdhui-document-library-view .mdhui-document-library-view-document-thumbnail-loading {\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n background-color: var(--mdhui-background-color-0);\n}\n\n.mdhui-document-library-view .mdhui-document-library-view-document-thumbnail > svg {\n color: var(--mdhui-text-color-4);\n height: 100%;\n width: 100%;\n}\n\n.mdhui-document-library-view .mdhui-document-library-view-document-thumbnail > img {\n height: 100%;\n width: 100%;\n object-fit: cover;\n}\n\n\n.mdhui-document-library-view .mdhui-document-library-view-document-details {\n display: flex;\n flex-direction: column;\n min-width: 48px;\n}\n\n.mdhui-document-library-view .mdhui-document-library-view-document-name {\n font-size: 1.2em;\n font-weight: bold;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n margin-bottom: 4px;\n}\n\n.mdhui-document-library-view .mdhui-document-library-view-document-date-and-type {\n font-size: 0.7em;\n font-weight: bold;\n color: var(--mdhui-text-color-3);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}");function CCe(e){let[a,n]=t.useState(null);function i(){d_e(),window.setTimeout((function(){h_e()}),1200)}return id((()=>{if("default"==e.previewState)return n([1e3,2e3,3e3]),void i();w.getParticipantInfo().then((t=>{let a=Jq(e.customField,[],t);n(a.badges),i()}))}),[],[]),null!=a&&0===a.length?(w.dismiss(),null):t.createElement(Ka,{bodyBackgroundColor:"dark"===e.colorScheme?"":"#fff",colorScheme:e.colorScheme??"auto",primaryColor:e.primaryColor},t.createElement("div",{className:"mdhui-new-badge-view"},null==a&&t.createElement(XA,null),null!=a&&t.createElement(t.Fragment,null,t.createElement("div",{className:"mdhui-new-badge-view-badge-container"},t.createElement(ZA,{size:"xl",backgroundColor:Re(a.length-1)},t.createElement(t.Fragment,null,e.showBadgePoints&&t.createElement(t.Fragment,null,wl(Math.max(...a)),t.createElement("br",null),"points")))),t.createElement(sM,{order:2,style:{margin:"16px",marginBottom:0}},e.title||no("new-badge-title")),t.createElement($q,null,e.text||no("new-badge-text")),t.createElement(QA,{onClick:()=>w.dismiss()},no("get-badge")))))}A(".mdhui-new-badge-view {\n padding: 16px;\n text-align: center;\n height: calc(100dvh - 34px);\n display: flex;\n align-items: center;\n flex-direction: column;\n justify-content: center;\n}\n\n.mdhui-new-badge-view .mdhui-new-badge-view-badge-container {\n align-items: center;\n display: flex;\n}");function TCe(e){let a=e.entries.reduce(((e,t)=>e+(t.bonusPoints||0)),0),n=e.entries.reduce(((e,t)=>e+t.points),a);return t.createElement(Ka,{bodyBackgroundColor:"dark"===e.colorScheme?"":"#fff",colorScheme:e.colorScheme??"auto",primaryColor:e.primaryColor},t.createElement("div",{className:"mdhui-new-points"},t.createElement(tSe,{animate:!0},t.createElement("div",{className:"mdhui-new-points-total"},t.createElement("div",{className:"mdhui-new-points-total-points"},"+",n),t.createElement("div",{className:"mdhui-new-points-total-points-label"},"points"))),t.createElement("div",{className:"mdhui-new-points-content"},1==e.entries.length&&e.entries[0].message&&0===a&&t.createElement("div",null,t.createElement("div",{className:"mdhui-new-points-title"},e.entries[0].message.title),t.createElement("div",{className:"mdhui-new-points-text"},e.entries[0].message.text)),(e.entries.length>1||!e.entries[0].message||a>0)&&t.createElement("div",null,t.createElement("div",{className:"mdhui-new-points-title"},no("new-points-title")),t.createElement("div",{className:"mdhui-new-points-text"},no("new-points-text")),t.createElement("div",{className:"mdhui-new-points-entries"},e.entries.map(((e,a)=>t.createElement("div",{key:a,className:"mdhui-new-points-entry"},t.createElement("div",{className:"mdhui-new-points-entry-name"},e.name),t.createElement("div",{className:"mdhui-new-points-entry-points"},"+",e.points)))),a>0&&t.createElement("div",{className:"mdhui-new-points-entry"},t.createElement("div",{className:"mdhui-new-points-entry-name bonus"},no("bonus")),t.createElement("div",{className:"mdhui-new-points-entry-points bonus"},"+",a)))),e.pointsToNextReward&&t.createElement("div",{className:"mdhui-new-points-next-reward"},no("new-points-next-reward-prefix"),t.createElement("span",{className:"mdhui-new-points-next-reward-points"},e.pointsToNextReward),no("new-points-next-reward-suffix"))),t.createElement("div",{className:"mdhui-new-points-button-panel"},t.createElement(QA,{onClick:()=>w.dismiss()},e.doneButtonText??no("new-points-done-button-text")))))}function PCe(e,t){let a={type:"MDHUI-NewPoints",value:JSON.stringify(e)};w.persistDeviceData([a]).then((()=>{w.openApplication(t||"https://viewlibrary.careevolutionapps.com/newpoints",{modal:!0})}))}A(".mdhui-new-points {\n margin: calc(20px + env(safe-area-inset-top, 0px)) 20px 20px;\n}\n\n.mdhui-new-points-total {\n margin-top: 10px;\n text-align: center;\n}\n\n.mdhui-new-points-total-points {\n font-weight: bold;\n font-size: 40px;\n height: 50px;\n line-height: 50px;\n color: var(--mdhui-color-primary);\n}\n\n.mdhui-new-points-content {\n text-align: center;\n opacity: 0;\n animation: fadein 750ms ease-in-out;\n animation-delay: 750ms;\n animation-fill-mode: forwards;\n}\n\n.mdhui-new-points-title {\n margin: 32px 0 20px 0;\n font-size: 2em;\n font-weight: bold;\n}\n\n.mdhui-new-points-text {\n padding: 0 20px;\n}\n\n.mdhui-new-points-entries {\n margin-top: 20px;\n text-align: left;\n}\n\n.mdhui-new-points-entry {\n display: grid;\n grid-template-columns: auto max-content;\n align-items: center;\n}\n\n.mdhui-new-points-entry-name {\n font-size: 1.1em;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.mdhui-new-points-entry-points {\n width: 50px;\n color: var(--mdhui-color-primary);\n font-size: 1.1em;\n font-weight: bold;\n text-align: end;\n}\n\n.mdhui-new-points-next-reward {\n margin-top: 20px;\n padding: 0 20px;\n}\n\n.mdhui-new-points-next-reward-points {\n color: var(--mdhui-color-primary);\n font-weight: bold;\n}\n\n.mdhui-new-points-entry .bonus {\n color: #ffcc5b;\n font-weight: bold;\n}\n\n.mdhui-new-points-button-panel {\n margin: 20px 0 36px 0;\n opacity: 0;\n animation: fadein 750ms ease-in-out;\n animation-delay: 750ms;\n animation-fill-mode: forwards;\n}");function OCe(e){return t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},t.createElement(Ege,null,t.createElement(MCe,{...e})))}function MCe(e){const[a,n]=c(),[i,r]=c(),[o,s]=c();let l=!a&&!i&&!o,u=[...a??[],...i??[],...o??[]];return t.createElement("div",{className:"mdhui-inbox"},t.createElement(bSe,{title:no("inbox-view-title")}),l&&t.createElement(XA,null),!l&&0===u.length&&t.createElement("div",{className:"mdhui-inbox-empty-text"},no("inbox-view-empty-text")),t.createElement(Pge,{previewState:"default"===e.previewState?"incomplete message":"empty"===e.previewState?"no items":void 0,title:no("inbox-view-messages-title"),type:"message",status:"incomplete",sortOrder:"descending",sortColumn:"insertedDate",messageViewerUrl:e.messageViewerUrl,onItemsLoaded:n,hideLoadingIndicator:!0,category:e.itemCategory}),t.createElement(Pge,{previewState:"default"===e.previewState?"incomplete survey":"empty"===e.previewState?"no items":void 0,title:no("inbox-view-surveys-title"),type:"survey",status:"incomplete",sortOrder:"ascending",sortColumn:"dueDate",onItemsLoaded:r,hideLoadingIndicator:!0,surveyVariant:e.surveyVariant,category:e.itemCategory}),t.createElement(Pge,{previewState:"default"===e.previewState?"incomplete resource":"empty"===e.previewState?"no items":void 0,title:no("inbox-view-resources-title"),type:"resource",status:"incomplete",sortOrder:"descending",sortColumn:"insertedDate",onItemsLoaded:s,hideLoadingIndicator:!0,resourceImageAlignment:e.resourceImageAlignment,resourceButtonVariant:e.resourceButtonVariant,resourceButtonText:e.resourceButtonText,category:e.itemCategory}),t.createElement("div",{className:"mdhui-inbox-recently-completed"},t.createElement(Pge,{previewState:"default"===e.previewState?"complete items":"empty"===e.previewState?"no items":void 0,title:no("inbox-view-recently-completed-title"),status:"complete",sortOrder:"descending",sortColumn:"endDate",messageViewerUrl:e.messageViewerUrl,endsAfter:cn(new Date,{days:-3}).toISOString(),showTitleWhenEmpty:!0,emptyText:no("inbox-view-recently-completed-empty-text"),syncOnChanges:!0,category:e.itemCategory}),!l&&t.createElement(aS,{style:{margin:"12px 16px"}},t.createElement(Za,{title:no("inbox-view-history-button-text"),onClick:()=>{e.previewState||w.openApplication(e.historyViewerUrl,{modal:!0})}}))))}A(".mdhui-inbox {\n padding: calc(env(safe-area-inset-top, 0px) + 20px) 0 calc(env(safe-area-inset-bottom, 0px) + 20px);\n}\n\n.mdhui-inbox .mdhui-view-header {\n padding: 0 16px;\n}\n\n.mdhui-inbox .mdhui-view-header .mdhui-view-header-title {\n font-size: 1.8em;\n}\n\n.mdhui-inbox-empty-text {\n color: var(--mdhui-text-color-3);\n padding: 16px;\n}\n\n.mdhui-inbox-recently-completed {\n margin-top: 20px;\n}\n\n.mdhui-inbox-recently-completed .mdhui-inbox-item-list-title {\n color: var(--mdhui-text-color-0);\n margin-bottom: 12px;\n font-size: 1.4em;\n font-weight: bold;\n}\n\n.mdhui-inbox-recently-completed .mdhui-card {\n margin: 12px 0 0 0;\n}");function DCe(e){return t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},t.createElement(XAe,{showCloseButton:!0}),t.createElement("div",{className:"mdhui-inbox-history"},t.createElement(sM,{order:3},no("inbox-history-view-title")),t.createElement(Pge,{previewState:"default"===e.previewState?"complete items":void 0,status:"complete",messageViewerUrl:e.messageViewerUrl,emptyText:no("inbox-history-view-empty-text")})))}A(".mdhui-inbox-history {\n padding: calc(env(safe-area-inset-top, 0px)) 16px calc(env(safe-area-inset-bottom, 0px) + 20px);\n}");function ICe(e){return t.createElement("div",{className:"mdhui-report-content"},"text/html"==e.contentType&&t.createElement("iframe",{sandbox:"",srcDoc:e.content}),"application/pdf"==e.contentType&&t.createElement("div",{className:"mdhui-report-content-download-pdf","ng-if":"$ctrl.report.ContentType == 'application/pdf'","ng-show":"$ctrl.srcSet = true"},t.createElement("a",{href:"data:application/pdf;base64,"+e.content,download:e.type+".pdf",title:no("download-pdf-report")},t.createElement(Ne,{icon:de}),no("download-pdf-report"))))}A(".mdhui-report-content {\n min-height: 200px;\n}\n\n.mdhui-report-content iframe {\n border: none;\n padding: 0;\n margin: 0;\n width: 100%;\n height: 100%;\n background: #FFF;\n min-height: 200px;\n}\n\n.mdhui-report-content .mdhui-report-content-download-pdf a {\n padding: 16px;\n margin: 0 auto;\n background: var(--mdhui-color-primary);\n color: #FFF;\n font-weight: bold;\n border-radius: 6px;\n text-decoration: none;\n text-align: center;\n display: block;\n width: 200px;\n margin-top: var(--mdhui-padding-md);\n}\n\n.mdhui-report-content .mdhui-report-content-download-pdf svg {\n display: block;\n text-align: center;\n width: 100%;\n margin-bottom: var(--mdhui-padding-md);\n}");let NCe='<!DOCTYPE html><html xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:n3="http://www.w3.org/1999/xhtml" xmlns:n1="urn:hl7-org:v3" xmlns:n2="urn:hl7-org:v3/meta/voc" xmlns:voc="urn:hl7-org:v3/voc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:in="urn:lantana-com:inline-variable-data"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\x3c!--\r\n Do NOT edit this HTML directly, it was generated via an XSLt\r\n transformation from the original release 2 CDA Document.\r\n --\x3e<title>Encounter Summary</title><style>\r\n \r\n body { font-family:Helvetica, Arial, sans-serif; font-size: 12px; margin: 16px; text-align: left; margin-bottom:0; } \r\n .title { font-size: 21px; font-weight: bold; line-height:1.5em;}\r\n .document-info { font-size:12px; margin-bottom:16px; color:#999; line-height:1.5em; }\r\n \r\n \r\n .patient-info-table { border-spacing: 0; width:100%; }\r\n .patient-info-table th { text-align:left; font-size:11px; color:#999; font-weight:normal; vertical-align:top; padding-right:8px; border-bottom:solid 1px #eee; padding-top:4px; padding-bottom:4px; }\r\n .patient-info-table td { text-align:left; font-size:12px; color:#000; vertical-align:top; border-bottom:solid 1px #eee; padding-top:4px; padding-bottom:4px; }\r\n .patient-info-table tr:last-child th, .patient-info-table tr:last-child td { border-bottom:none; }\r\n\r\n .data-table { margin-left: -16px; margin-right:-16px; margin-bottom:16px; }\r\n .data-table table, .data-table td, .data-table th { border:none; }\r\n\r\n .data-table > span { margin-left:16px; margin-right:16px; }\r\n .data-table table { border-collapse: collapse; }\r\n .data-table th { padding-bottom:4px; padding-top:4px; padding-right:8px; padding-left:8px; text-align: left; text-transform: uppercase; font-weight: normal; color: #666; font-size: 11px; border-bottom: #ddd 1px solid; vertical-align:bottom; }\r\n .data-table tr:nth-child(even) td { background-color: #f5f5f5; }\r\n .data-table td { vertical-align: top; font-size:12px; padding-bottom:4px; padding-top:4px; padding-right:8px; padding-left:8px;}\r\n .data-table td:first-child, .data-table th:first-child { padding-left:16px;}\r\n \r\n p { margin: 0 0 4px 0em; }\r\n\r\n .wrap-collabsible { position:relative; margin-left:-16px; margin-right:-16px; }\r\n input[type=\'checkbox\'] { display: none; }\r\n .lbl-toggle { display: block; font-size: 17px; text-align: left; padding:8px; padding-left:16px; padding-right:16px; border-top: solid 1px #ddd; cursor: pointer; transition: all 0.25s ease-out; position: sticky; position: -webkit-sticky; top: 0; left: 0; background: #FFF; color: #3e6e9a; font-weight: bold; }\r\n .lbl-toggle:hover { opacity:.9; }\r\n .lbl-toggle::before { content: \' \'; display: inline-block; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 5px solid currentColor; vertical-align: middle; margin-right: .7rem; transform: translateY(-2px); transition: transform .2s ease-out; position: absolute; right: 8px; top: 16px; }\r\n .toggle:checked + .lbl-toggle::before { transform: rotate(90deg) translateX(-3px); }\r\n .collapsible-content { max-height: 0px; overflow-x: auto; overflow-y: hidden; }\r\n .toggle:checked + .lbl-toggle + .collapsible-content { max-height: 999999px; }\r\n .collapsible-content .content-inner { background: #FFF; padding:8px; padding-left:16px; padding-right:16px; }\r\n \r\n </style></head><body><div class="title">Encounter Summary</div><div class="document-info"><div class="document-date">\r\n Document Created\r\n May 29, 2023</div><div class="custodian"><div>Custodian: Cedars-Sinai Health System</div></div></div><div class="wrap-collabsible"><input id="collapsible" class="toggle" type="checkbox" /><label for="collapsible" class="lbl-toggle">Patient Information</label><div class="collapsible-content"><div class="content-inner"><table class="patient-info-table" cellpadding="0" cellspacing="0"><tr><td colspan="2" style="font-size:14px;">AmbulatorySeniorF Xxxcshs </td></tr><tr><th>Date of Birth</th><td>January 1, 1947</td></tr><tr><th>Race</th><td>Unknown</td></tr><tr><th>Patient ID</th><td>CSHJWLL1B3TGMWX</td></tr><tr><th>Sex</th><td>Female</td></tr><tr><th>Ethnicity</th><td>Unknown</td></tr><tr><th>Preferred Language</th><td>Information not available</td></tr><tr><th>Address</th><td>6500 Wilshire Blvd<br /><br />LOS ANGELES, CA, 90046<br />tel:+1-626-315-4807</td></tr><tr><th>Care Team Member(s)</th><td>Dr. Masson of Cedars-Sinai Health System<br />, , <br />tel:+1-310-248-7000<br /><br /></td></tr><tr><th>Guardian</th><td><div><br /></div></td></tr><tr><th>Next of Kin</th><td><div><br /></div></td></tr><tr><th>Other Caregivers(s)</th><td /></tr><tr><th>Emergency Contact</th><td><div><br /></div></td></tr><tr><th>Comments:</th><td /></tr></table></div></div></div><div class="wrap-collabsible"><input id="ID0EDGAC" class="toggle" type="checkbox" /><label for="ID0EDGAC" class="lbl-toggle" data-loinc-code="X-DOCCMT">Note from Cedars-Sinai Health System</label><div class="collapsible-content"><div class="content-inner">This document contains information that was shared with AmbulatorySeniorF Xxxcshs. It may not contain the entire record from Cedars-Sinai Health System.</div></div></div><div class="wrap-collabsible"><input id="ID0EVGAC" class="toggle" type="checkbox" /><label for="ID0EVGAC" class="lbl-toggle" data-loinc-code="46240-8">Encounter Details</label><div class="collapsible-content"><div class="content-inner"><div class="data-table"><table width="100%"><colgroup><col width="10%" /><col width="15%" /><col span="3" width="25%" /></colgroup><thead><tr><th>Date</th><th>Type</th><th>Department</th><th>Care Team</th><th>Description</th></tr></thead><tbody><tr ID="encounter2" style="" id="encounter2"><td>04/15/2019 9:30 AM PDT</td><td ID="encounter2type" id="encounter2type">Office Visit</td><td><p>CSMG Internal Medicine</p><p>8767 Wilshire Blvd</p><p>3rd Floor</p><p>BEVERLY HILLS, CA 90211</p><p>310-385-6031</p></td><td><p style="font-weight:bold;">Dr. Gray</p><p>8767 WILSHIRE BLVD</p><p>3RD FLOOR-SUITE 301</p><p>BEVERLY HILLS, CA 90211</p><p>310-385-6064 (Work)</p><p>424-314-8735 (Fax)</p></td><td><span id="encounter2desc" /></td></tr></tbody></table></div></div></div></div><div class="wrap-collabsible"><input id="ID0EJNAG" class="toggle" type="checkbox" /><label for="ID0EJNAG" class="lbl-toggle" data-loinc-code="29762-2">Social History</label><div class="collapsible-content"><div class="content-inner"><div class="data-table"><table width="100%" ID="sochist14" id="sochist14"><colgroup><col span="2" width="25%" /><col width="13%" /><col width="12%" /><col width="25%" /></colgroup><thead><tr><th>Tobacco Use</th><th>Types</th><th>Packs/Day</th><th>Years Used</th><th>Date</th></tr></thead><tbody><tr><td>Smoking Tobacco: Former</td><td>Cigarettes</td><td ID="sochist14packsperday" id="sochist14packsperday">0.5</td><td /><td>1999 - 06/2010</td></tr></tbody></table></div><div class="data-table"><table width="100%"><colgroup><col width="25%" /><col width="75%" /></colgroup><thead><tr><th>Alcohol Use</th><th>Standard Drinks/Week</th></tr></thead><tbody><tr><td ID="alcoholStatus" id="alcoholStatus">Yes</td><td>3 (1 standard drink = 0.6 oz pure alcohol)</td></tr></tbody></table></div><div class="data-table"><table width="100%" ID="sdohassess1" id="sdohassess1"><colgroup><col width="50%" /><col span="2" width="25%" /></colgroup><thead><tr><th>Depression</th><th>Answer</th><th>Date Recorded</th></tr></thead><tbody><tr ID="sdohassess1pair1" id="sdohassess1pair1"><td ID="sdohassess1pair1ques" id="sdohassess1pair1ques">PHQ-9 Score</td><td ID="sdohassess1pair1ans" id="sdohassess1pair1ans">23</td><td>10/24/2022</td></tr><tr ID="sdohassess1pair2" id="sdohassess1pair2"><td ID="sdohassess1pair2ques" id="sdohassess1pair2ques">Screening Completed</td><td ID="sdohassess1pair2ans" id="sdohassess1pair2ans">PHQ-9</td><td>10/24/2022</td></tr></tbody></table></div><div class="data-table"><table width="100%"><colgroup><col width="50%" /><col span="2" width="25%" /></colgroup><thead><tr><th>Sex and Gender Information</th><th>Value</th><th>Date Recorded</th></tr></thead><tbody><tr ID="BirthSex17" id="BirthSex17"><td>Sex Assigned at Birth</td><td ID="BirthSex17Value" id="BirthSex17Value">Female</td><td>11/04/2018 3:08 AM PST</td></tr><tr ID="GenderIdentity15" id="GenderIdentity15"><td>Gender Identity</td><td ID="GenderIdentity15Value" id="GenderIdentity15Value">Female</td><td>06/12/2019 2:50 PM PDT</td></tr><tr ID="SexualOrientation16" id="SexualOrientation16"><td>Sexual Orientation</td><td ID="SexualOrientation16Value" id="SexualOrientation16Value">Choose not to disclose</td><td>11/04/2018 3:08 AM PST</td></tr></tbody></table></div>documented as of this encounter</div></div></div><div class="wrap-collabsible"><input id="ID0EQHBG" class="toggle" type="checkbox" /><label for="ID0EQHBG" class="lbl-toggle" data-loinc-code="8716-3">Last Filed Vital Signs</label><div class="collapsible-content"><div class="content-inner"><div class="data-table"><table width="100%"><colgroup><col span="4" width="25%" /></colgroup><thead><tr><th>Vital Sign</th><th>Reading</th><th>Time Taken</th><th>Comments</th></tr></thead><tbody><tr style=""><td style="">Blood Pressure</td><td><span id="sysBP_5642605800">120</span>/<span id="diaBP_5642605800">80</span></td><td>10/21/2019 3:30 PM PDT</td><td /></tr><tr ID="pulse_5642605800" style="" id="pulse_5642605800"><td style="">Pulse</td><td>80</td><td>10/21/2019 3:30 PM PDT</td><td /></tr><tr ID="temp_5642605800" style="" id="temp_5642605800"><td style="">Temperature</td><td>37.1 °C (98.8 °F)</td><td>10/21/2019 3:30 PM PDT</td><td /></tr><tr ID="resp_" style="" id="resp_"><td style="">Respiratory Rate</td><td>-</td><td>-</td><td /></tr><tr ID="SpO2_" style="" id="SpO2_"><td style="">Oxygen Saturation</td><td>-</td><td>-</td><td /></tr><tr ID="inhaled_" style="" id="inhaled_"><td style="">Inhaled Oxygen Concentration</td><td>-</td><td>-</td><td /></tr><tr ID="weight_5642605800" style="" id="weight_5642605800"><td style="">Weight</td><td>238.1 kg (525 lb)</td><td>10/21/2019 3:30 PM PDT</td><td /></tr><tr ID="height_5642605800" style="" id="height_5642605800"><td style="">Height</td><td>157.5 cm (5\' 2")</td><td>10/21/2019 3:30 PM PDT</td><td /></tr><tr ID="bmi_5642605800" style="" id="bmi_5642605800"><td style="">Body Mass Index</td><td>96.02</td><td>10/21/2019 3:30 PM PDT</td><td /></tr></tbody></table></div>documented in this encounter</div></div></div><div class="wrap-collabsible"><input id="ID0EIZBG" class="toggle" type="checkbox" /><label for="ID0EIZBG" class="lbl-toggle" data-loinc-code="69730-0">Patient Instructions</label><div class="collapsible-content"><div class="content-inner"><ul style="" id="Instructions33"><li>Patient Instructions: <ul><li><p><span style="">Dr. Fazel - 04/15/2019 9:30 AM PDT</span></p><span><span style="">Formatting of this note is different from the original.</span><br /><span style="">Images from the original note were not included.</span><br />Patient Education <br /><br />Back Exercises<br />The following exercises strengthen the muscles that help to support the trunk and back. They also help to keep the lower back flexible. Doing these exercises can help to prevent back pain or lessen existing pain.<br />· If you have back pain or discomfort, try doing these exercises 2-3 times each day or as told by your health care provider.<br />· As your pain improves, do them once each day, but increase the number of times that you repeat the steps for each exercise (do more repetitions).<br />· To prevent the recurrence of back pain, continue to do these exercises once each day or as told by your health care provider.<br />Do exercises exactly as told by your health care provider and adjust them as directed. It is normal to feel mild stretching, pulling, tightness, or discomfort as you do these exercises, but you should stop right away if you feel sudden pain or your pain gets worse.<br />Exercises<br />Single knee to chest<br />Repeat these steps 3-5 times for each leg:<br />1. Lie on your back on a firm bed or the floor with your legs extended.<br />2. Bring one knee to your chest. Your other leg should stay extended and in contact with the floor.<br />3. Hold your knee in place by grabbing your knee or thigh with both hands and hold.<br />4. Pull on your knee until you feel a gentle stretch in your lower back or buttocks.<br />5. Hold the stretch for 10-30 seconds.<br />6. Slowly release and straighten your leg.<br />Pelvic tilt<br />Repeat these steps 5-10 times:<br />1. Lie on your back on a firm bed or the floor with your legs extended.<br />2. Bend your knees so they are pointing toward the ceiling and your feet are flat on the floor.<br />3. Tighten your lower abdominal muscles to press your lower back against the floor. This motion will tilt your pelvis so your tailbone points up toward the ceiling instead of pointing to your feet or the floor.<br />4. With gentle tension and even breathing, hold this position for 5-10 seconds.<br />Cat-cow<br />Repeat these steps until your lower back becomes more flexible:<br />1. Get into a hands-and-knees position on a firm surface. Keep your hands under your shoulders, and keep your knees under your hips. You may place padding under your knees for comfort.<br />2. Let your head hang down toward your chest. Contract your abdominal muscles and point your tailbone toward the floor so your lower back becomes rounded like the back of a cat.<br />3. Hold this position for 5 seconds.<br />4. Slowly lift your head, let your abdominal muscles relax and point your tailbone up toward the ceiling so your back forms a sagging arch like the back of a cow.<br />5. Hold this position for 5 seconds. <br />Press-ups<br />Repeat these steps 5-10 times:<br />1. Lie on your abdomen (face-down) on the floor.<br />2. Place your palms near your head, about shoulder-width apart.<br />3. Keeping your back as relaxed as possible and keeping your hips on the floor, slowly straighten your arms to raise the top half of your body and lift your shoulders. Do not use your back muscles to raise your upper torso. You may adjust the placement of your hands to make yourself more comfortable.<br />4. Hold this position for 5 seconds while you keep your back relaxed.<br />5. Slowly return to lying flat on the floor. <br />Bridges<br />Repeat these steps 10 times:<br />1. Lie on your back on a firm surface.<br />2. Bend your knees so they are pointing toward the ceiling and your feet are flat on the floor. Your arms should be flat at your sides, next to your body.<br />3. Tighten your buttocks muscles and lift your buttocks off the floor until your waist is at almost the same height as your knees. You should feel the muscles working in your buttocks and the back of your thighs. If you do not feel these muscles, slide your feet 1-2 inches farther away from your buttocks.<br />4. Hold this position for 3-5 seconds.<br />5. Slowly lower your hips to the starting position, and allow your buttocks muscles to relax completely.<br />If this exercise is too easy, try doing it with your arms crossed over your chest. <br />Abdominal crunches<br />Repeat these steps 5-10 times:<br />1. Lie on your back on a firm bed or the floor with your legs extended.<br />2. Bend your knees so they are pointing toward the ceiling and your feet are flat on the floor.<br />3. Cross your arms over your chest.<br />4. Tip your chin slightly toward your chest without bending your neck.<br />5. Tighten your abdominal muscles and slowly raise your trunk (torso) high enough to lift your shoulder blades a tiny bit off the floor. Avoid raising your torso higher than that because it can put too much stress on your low back and does not help to strengthen your abdominal muscles.<br />6. Slowly return to your starting position.<br />Back lifts<br />Repeat these steps 5-10 times:<br />1. Lie on your abdomen (face-down) with your arms at your sides, and rest your forehead on the floor.<br />2. Tighten the muscles in your legs and your buttocks.<br />3. Slowly lift your chest off the floor while you keep your hips pressed to the floor. Keep the back of your head in line with the curve in your back. Your eyes should be looking at the floor.<br />4. Hold this position for 3-5 seconds.<br />5. Slowly return to your starting position.<br />Contact a health care provider if:<br />· Your back pain or discomfort gets much worse when you do an exercise.<br />· Your worsening back pain or discomfort does not lessen within 2 hours after you exercise.<br />If you have any of these problems, stop doing these exercises right away. Do not do them again unless your health care provider says that you can.<br />Get help right away if:<br />· You develop sudden, severe back pain. If this happens, stop doing the exercises right away. Do not do them again unless your health care provider says that you can.<br />This information is not intended to replace advice given to you by your health care provider. Make sure you discuss any questions you have with your health care provider.<br />Document Revised: 04/23/2020 Document Reviewed: 09/19/2019<br />Elsevier Patient Education © 2021 Elsevier Inc.<br /><br /><br />Potassium <br />Date Value Ref Range Status <br />06/10/2015 5.2 (High) 3.5 - 5.0 MMOL/L Final <br /><br /></span><br /><span style="">Electronically signed by Dr. Fazel at 03/22/2022 1:35 PM PDT</span><br /><br /></li></ul></li></ul>documented in this encounter</div></div></div><div class="wrap-collabsible"><input id="ID0ET6BG" class="toggle" type="checkbox" /><label for="ID0ET6BG" class="lbl-toggle" data-loinc-code="10164-2">Progress Notes</label><div class="collapsible-content"><div class="content-inner"><ul style=""><li>Dr. Masson - 04/15/2019 9:30 AM PDT: <span id="Note30"><span><span style="">Formatting of this note is different from the original.</span><br />PHQ-2 Total Score (Scale: 0 to 3) 9/6/2013 <br />PHQ-2 Total Score 6 <br /><br />CSHS ONC PHQ9 1/19/2018 3/8/2019 7/19/2020 <br />In the last two weeks, how often have you had little interest or pleasure in doing things? 0 0 1 <br />In the last two weeks, how often have you been feeling down, depressed or hopeless? - 1 1 <br />In the last two weeks, how often have you had trouble falling asleep, staying asleep or sleeping too much? 0 - - <br />In the last two weeks, how often have you been feeling tired or having little energy? - - - <br />In the last two weeks, how often have you had poor appetite or been overeating? - - - <br />In the last two weeks, how often have you been feeling bad about yourself, or that you\'re a failure or have let yourself or family down? - - - <br />In the last two weeks, how often have you had trouble concentrating on things, such as reading the newspaper or watching television? - - - <br />In the last two weeks, how often have you been moving or speaking so slowly that other people could have noticed; Or, the opposite - being fidgety or restless that you have been moving around a lot more than usual? - - - <br />In the last two weeks, how often have you had thoughts that you would be better off dead or of hurting yourself in some way? - - - <br />PHQ-9 Score 0 1 2 <br /><br /></span><br /><span style="">Electronically signed by Dr. Masson at 07/19/2020 2:23 PM PDT</span><br /></span></li><li>Dr. Rao - 04/15/2019 9:30 AM PDT: <span id="Note29"><span><span style="">Formatting of this note might be different from the original.</span><br />Blood pressure 120/80, pulse 80, temperature 98.8 °F (37.1 °C), temperature source Oral. <br />General appearance: alert, cooperative, no distress, appears stated age<br />Head: Normocephalic, without obvious abnormality, atraumatic<br />Eyes: conjunctivae/corneas clear. PERRL, EOM\'s intact. Fundi benign<br />Ears: normal TM\'s and external ear canals AU<br />Nose: Nares normal. Septum midline. Mucosa normal. No drainage or sinus tenderness.<br />Neck: supple, symmetrical, trachea midline, no adenopathy, thyroid: not enlarged, symmetric, no tenderness/mass/nodules, no carotid bruit, and no JVD<br />Lungs: clear to auscultation bilaterally<br />Heart: regular rate and rhythm, S1, S2 normal, no murmur, click, rub or gallop , no edema<br />Abdomen: soft, non-tender. Bowel sounds normal. No masses, no organomegaly<br />Extremities: extremities normal, atraumatic, no cyanosis or edema<br />Skin: Skin color, texture, turgor normal. No rashes or lesions<br />Neurologic: Grossly normal, no inattention, alert and oriented x3<br /><br /></span><br /><span style="">Electronically signed by Dr. Rao at 08/03/2021 5:11 PM PDT</span><br /></span></li><li>Roma Yogesh Gianchandani - 04/15/2019 9:30 AM PDT: <span id="Note28"><span><span style="">Formatting of this note might be different from the original.</span><br />This is a test of dictating later this is a test of dictating later this is a test of dictating later<br /><br />No results found for: HGBA1C <br />.uma<br /><br /></span><br /><span style="">Electronically signed by Roma Yogesh Gianchandani at 01/21/2022 2:37 PM PST</span><br /></span></li><li>Dr. Merchant - 04/15/2019 9:30 AM PDT: <span id="Note27"><span><span style="">Formatting of this note is different from the original.</span><br /><span style="">Images from the original note were not included.</span><br /><br /><br /><br /> Hematology and Cellular Therapy<br /><br />Patient Information <br /><br />Patient: AmbulatorySeniorF Xxxcshs<br />DOB: 1/1/1947<br />MRN: 200270896<br />Date of Service: 4/15/2019<br /><br />History of Present Illness <br /><br />CC: <br />Referring Provider: <br /><br />AmbulatorySeniorF Xxxcshs is a 75 year old woman <br /><br />Subjective History: fever<br /><br />Review of Systems:<br />A 14-point review of systems was performed with pertinent positives/negatives noted in the interval history, all others negative.<br /><br />Hematologic History:<br /><br />Patient Active Problem List <br /> Diagnosis Date Noted <br />• Rheumatoid arthritis, seropositive (HCC) 08/30/2021 <br />• COVID-19 virus infection 04/13/2020 <br />• Sucked into jet engine 10/25/2019 <br />• Moral distress 11/28/2018 <br /> Overview Note: <br /> https://onlinelibrary.wiley.com/doi/pdf/10.1111/j.2044-8341.1926.tb00623.x<br /><br />• Sucked into jet engine 05/06/2017 <br /> Overview Note: <br /> https://www.youtube.com/watch?v=2Aldwlro4DA</CITE><br /><br />• Spacecraft collision injuring occupant 05/06/2017 <br /> Overview Note: <br /> Fell a really long way <br /><br />• Diabetes mellitus type 2, noninsulin dependent (HCC) 06/09/2016 <br /><br />Past Medical History: <br />Diagnosis Date <br />• Abnormal Pap smear of cervix <br />• Anxiety <br />• Breast asymmetry 11/05/2017 <br /> testing <br />• Depressive disorder, not elsewhere classified <br />• ERRONEOUS ENCOUNTER--DISREGARD <br />• Family history of diabetes mellitus <br />• Frail elderly <br />• Headache(784.0) <br />• Heelies colliding with stationary object 5/6/2017 <br />• History of anemia <br />• History of bilateral breast implants <br />• Known health problems: none <br />• Known health problems: none <br />• NO SIGNIFICANT MEDICAL PROBLEMS <br />• NO SIGNIFICANT MEDICAL PROBLEMS <br />• Pneumonia 4/18/2010 <br />• Rash of back <br />• Sleep apnea <br />• Type 2 diabetes mellitus with hyperosmolarity without coma (HCC) 6/9/2016 <br /><br />Past Surgical History: <br />Procedure Laterality Date <br />• HX COLOSTOMY CLOSURE <br />• HX LOW ANTERIOR RESECTION <br />• HX THYROID NODULE RESECTION <br />• HX THYROIDECTOMY <br />• HX TONSILLECTOMY <br />• PAST SURGICAL HISTORY - NONE REPORTED <br />• PAST SURGICAL HISTORY - NONE REPORTED <br />• PR CESAREAN DELIVERY ONLY <br />• PR LAP GASTRIC BYPASS/ROUX-EN-Y <br />• PR REMOVAL COLON/PROCTEC/ ILEOANAL ANAST <br />• PR REMV STOMACH,PART,DISTAL,GASTRODUOD <br />• WOUND OSTOMY EVAL AND TREAT <br /><br />Social History <br /><br />Tobacco Use <br />• Smoking status: Former Smoker <br /> Packs/day: 0.50 <br /> Types: Cigarettes <br /> Start date: 1999 <br /> Quit date: 06/2010 <br /> Years since quitting: 11.7 <br />• Smokeless tobacco: Not on file <br />Substance Use Topics <br />• Alcohol use: Yes <br /> Alcohol/week: 3.0 standard drinks <br /> Types: 3 Shots of liquor per week <br />• Drug use: Yes <br /> Types: Marijuana <br /><br />Family History <br />Problem Relation Age of Onset <br />• Frailty Mother <br />• Tuberculosis Brother <br />• Hypertension Paternal Aunt <br />• Prostate Cancer Paternal Aunt <br />• Colon Polyps Paternal Grandmother <br />• Breast Cancer Paternal Grandmother <br />• Diabetes Maternal Aunt <br />• Ovarian Cancer Paternal Uncle <br />• Heart Disease Other <br /> fathers side <br />• Coronary Artery Disease Other <br /> mothers side <br />• Obesity Other <br />• Thoracic Aneurysm Other <br />• Diverticulosis Other <br />• Degenerative Disc Disease Other <br />• Carotid Stenosis Other <br />• Other Family History Maternal Grandmother <br /> Fraility <br />• History of Fragility Fracture Sister <br /><br /><br />Medications <br /><br />Current Outpatient Medications <br />Medication Sig <br />• ibuprofen (MOTRIN) 600 mg tablet Take 600 mg by mouth 3 times daily. Take with food. <br />• PREDNISONE, BULK, MISC <br />• metFORMIN (GLUCOPHAGE) 500 mg tablet <br />• acetaminophen (TYLENOL) 325 mg oral tablet Take 1 tablet by mouth every 4 hours as needed. Do NOT exceed 3000 mg of acetaminophen from all sources per 24 hours. (Patient not taking: Reported on 11/5/2020) <br />• atorvastatin (LIPITOR) 10 mg oral tablet Take 1 tablet by mouth daily. <br />• gabapentin (NEURONTIN) 100 mg capsule Take 1 capsule by mouth nightly. May increase to three times at night as necessary and tolerated <br />• naproxen (NAPROSYN) 500 mg oral tablet Take 1 tablet by mouth 2 times daily as needed. Take with food. (Patient taking differently: Take 500 mg by mouth as needed. Take with food.) <br /><br />Objective <br /><br />Vitals: <br /> 10/21/19 1530 <br />BP: 120/80 <br />Pulse: 80 <br />Temp: 98.8 °F (37.1 °C) <br />TempSrc: Oral <br /><br />ECOG Score: <br /><br />Physical Exam:<br />Constitutional: Oriented to person, place, and time. Appears well-developed and well-nourished. <br />Head: Normocephalic, atraumatic, no visible abnormalities<br />Nose: Nares normal. Septum midline. Mucosa normal. No drainage.<br />Mouth/Throat: No oropharyngeal exudate or mucositis. <br />Eyes: EOM are normal. No scleral icterus. <br />Neck: Normal range of motion. No tracheal deviation present. <br />Cardiovascular: Normal rate and regular rhythm. No murmurs, rubs, or gallops.<br />Pulmonary: Breath sounds normal. No respiratory distress. No wheezing, rales, or rhonchi.<br />Abdominal: Soft and non-distended. Bowel sounds are normal. <br />Musculoskeletal: Normal range of motion. <br />Skin: Skin color, texture, turgor normal. No rashes or lesions<br />Extremities: No cyanosis, clubbing, or edema<br />Neurological: No focal neurologic deficits. Strength intact in all extremities<br />Psychiatric: Normal mood and affect. <br />Lymph: No palpable cervical, supraclavicular, axillary, or inguinal lymphadenopathy<br /><br />Laboratory Results <br /><br />No results found for: WBC, HGB, HCT, MCV, RDW, PLT, POLY, LYMPH, MONOS, EOS, BASO, ANC, ALC, MONOSABS, EOSABS, BASOABS, RBCMORPH, DIFFTYPE <br />Lab Results <br />Component Value Date <br /> Glucose 67 04/22/2020 <br /> Creatinine 2.8 (High) 06/10/2015 <br /> Urea Nitrogen 30 (High) 06/10/2015 <br /> Sodium 139 06/10/2015 <br /> Potassium 5.2 (High) 06/10/2015 <br /> Chloride 104 06/10/2015 <br /> Carbon Dioxide 6 (Low) 06/10/2015 <br /> ALT 50 (High) 06/10/2015 <br /> AST 76 (High) 06/10/2015 <br /> Alkaline Phosphatase 102 06/10/2015 <br /> Bilirubin, Total 1.9 (High) 06/10/2015 <br /> Total Protein 5.6 (Low) 06/10/2015 <br /> Albumin 3.5 06/10/2015 <br /> Calcium, Serum 4.6 (Low) 06/10/2015 <br /><br />Imaging Results <br /><br />Pathology <br /><br />Assessment and Plan <br /><br />Diagnoses and all orders for this visit:<br /><br />History of non-Hodgkin\'s lymphoma<br /><br />Chronic obstructive pulmonary disease, unspecified COPD type (HCC)<br /><br />Screening-pulmonary TB<br />- PPD TEST<br />- ECG<br /><br />Lower abdominal pain<br />- ECG<br />- PR ANOSCOPY DX W/COLLJ SPEC BR/WA SPX WHEN PRFRMD<br /><br />Pneumothorax, unspecified type<br /><br />Non-seasonal allergic rhinitis, unspecified trigger<br /><br /><br /><br />A total time of 44 minutes was spent on today\'s encounter which included the following: <br />Obtaining and/or reviewing separately obtained history<br />Performing a medically appropriate exam and/or evaluation <br />Counseling and educating a patient/family/caregiver as noted above <br />Referring and communicating with other healthcare professionals (not separately reported) <br />Independently interpreting results (not separately reported) and communicating results to the patient/family/caregiver<br /><br />Akil Abid Merchant, MD <br />3/7/2022<br />5:39 PM</span><br /><span style="">Electronically signed by Dr. Merchant at 03/07/2022 5:50 PM PST</span><br /></span></li><li>Alexis Rieber - 04/15/2019 9:30 AM PDT: <span id="Note26"><span><span style="">Formatting of this note might be different from the original.</span><br /><span style="">Images from the original note were not included.</span><br /><br />Physical Exam<br /><br />This is a very cute dog<br /><br />This dog is white cell then sa<br /><br />This is a 42-year-old patient with hypertension past medical 7</span><br /><span style="">Electronically signed by Alexis Rieber at 07/05/2022 1:57 PM PDT</span><br /></span></li><li>Dr. Masson - 04/15/2019 9:30 AM PDT: <span id="Note25"><span><span style="">Formatting of this note might be different from the original.</span><br />Follow up Chronic Kidney Disease <br />Symptom symptoms one day daily <br /></span><br /><span style="">Electronically signed by Dr. Masson at 07/22/2022 11:08 AM PDT</span><br /></span></li><li>Dr. Masson - 04/15/2019 9:30 AM PDT: <span id="Note24"><span><span style="">Formatting of this note might be different from the original.</span><br />In my canal I can dictate later that is not a good workflow if you doing<br /></span><br /><span style="">Electronically signed by Dr. Masson at 09/26/2022 10:59 AM PDT</span><br /></span></li><li>Dr. Masson - 04/15/2019 9:30 AM PDT: <span id="Note23"><span><span style="">Formatting of this note might be different from the original.</span><br />Diagnoses and all orders for this visit:<br /><br />History of non-Hodgkin\'s lymphoma<br /><br />Chronic obstructive pulmonary disease, unspecified COPD type (HCC)<br /><br />Screening-pulmonary TB<br />- PPD TEST<br /><br />Lower abdominal pain<br /><br />Pneumothorax, unspecified type<br /><br />Non-seasonal allergic rhinitis, unspecified trigger<br /><br />Primary hypertension<br /><br />Ace inhibitor <br /><br /></span><br /><span style="">Electronically signed by Dr. Masson at 10/08/2022 6:20 PM PDT</span><br /></span></li><li>Dr. Masson - 04/15/2019 9:30 AM PDT: <span id="Note22"><span><span style="">Formatting of this note might be different from the original.</span><br /><br />..lastim<br /><br />No results found for this or any previous visit from the past 365 days 10 hours.<br /><br /></span><br /><span style="">Electronically signed by Dr. Masson at 04/14/2023 5:33 PM PDT</span><br /></span></li></ul>documented in this encounter</div></div></div><div class="wrap-collabsible"><input id="ID0E1LBI" class="toggle" type="checkbox" /><label for="ID0E1LBI" class="lbl-toggle" data-loinc-code="18776-5">Plan of Treatment</label><div class="collapsible-content"><div class="content-inner"><p>Not on file</p>documented as of this encounter</div></div></div><div class="wrap-collabsible"><input id="ID0EJMBI" class="toggle" type="checkbox" /><label for="ID0EJMBI" class="lbl-toggle" data-loinc-code="61146-7">Goals</label><div class="collapsible-content"><div class="content-inner"><div class="data-table"><table width="100%"><colgroup><col width="30%" /><col width="10%" /><col width="15%" /><col width="20%" /><col width="12%" /><col width="13%" /></colgroup><thead><tr><th>Goal</th><th>Patient Goal Type</th><th>Associated Problems</th><th>Recent Progress</th><th>Patient-Stated?</th><th>Author</th></tr></thead><tbody><tr style=""><td><p id="goal1">Hemoglobin A1C <= 7.0</p></td><td>Result Component</td><td /><td /><td>No</td><td>Dr. Masson</td></tr><tr style=""><td><p id="goal2">Hemoglobin A1C <= 7.0</p></td><td>Result Component</td><td>Diabetes mellitus type 2, noninsulin dependent</td><td /><td>No</td><td>Jeff Oostmeyer</td></tr><tr style=""><td style="" colspan="6"><p style="">Note: </p><span id="goal2note"><span style="">Formatting of this note might be different from the original.</span><br />Test</span><br /></td></tr><tr style=""><td><p id="goal3">LDL CALC <= 100</p></td><td>Result Component</td><td>Diabetes mellitus type 2, noninsulin dependent</td><td /><td>No</td><td>Jeff Oostmeyer</td></tr><tr style=""><td style="" colspan="6"><p style="">Note: </p><span id="goal3note"><span style="">Formatting of this note might be different from the original.</span><br />Test</span><br /></td></tr></tbody></table></div>documented as of this encounter</div></div></div><div class="wrap-collabsible"><input id="ID0EQVBI" class="toggle" type="checkbox" /><label for="ID0EQVBI" class="lbl-toggle" data-loinc-code="30954-2">Results</label><div class="collapsible-content"><div class="content-inner"><ul style=""><li id="Result.1.2.840.114350.1.13.202.2.7.2.798268.326239047.Procedure">PPD TEST - Final result (04/15/2019 9:32 AM PDT): <div class="data-table"><table width="100%"><colgroup><col width="20%" /><col width="12%" /><col width="8%" /><col width="20%" /><col span="2" width="10%" /><col width="20%" /></colgroup><thead><tr><th>Component</th><th>Value</th><th>Ref Range</th><th>Test Method</th><th>Analysis Time</th><th>Performed At</th><th>Pathologist Signature</th></tr></thead><tbody><tr ID="Result.1.2.840.114350.1.13.202.2.7.2.798268.326239047.Comp1" style="" id="Result.1.2.840.114350.1.13.202.2.7.2.798268.326239047.Comp1"><td ID="Result.1.2.840.114350.1.13.202.2.7.2.798268.326239047.Comp1Name" id="Result.1.2.840.114350.1.13.202.2.7.2.798268.326239047.Comp1Name">Induration PPD</td><td>10</td><td>0 - 10 mm</td><td /><td /><td /><td ID="Result.1.2.840.114350.1.13.202.2.7.2.798268.326239047.Comp1Signature" id="Result.1.2.840.114350.1.13.202.2.7.2.798268.326239047.Comp1Signature" /></tr></tbody></table></div><div class="data-table"><table width="100%"><colgroup><col span="5" width="20%" /></colgroup><thead><tr><th>Specimen (Source)</th><th>Anatomical Location / Laterality</th><th>Collection Method / Volume</th><th>Collection Time</th><th>Received Time</th></tr></thead><tbody><tr style=""><td ID="Result.1.2.840.114350.1.13.202.2.7.2.798268.326239047.Specimen" id="Result.1.2.840.114350.1.13.202.2.7.2.798268.326239047.Specimen" /><td /><td /><td>04/15/2019 9:32 AM PDT</td><td /></tr></tbody></table></div><div class="data-table"><table width="100%"><thead><tr><th>Narrative</th></tr></thead><tbody><tr><td style=""><p /></td></tr></tbody></table></div><div class="data-table"><table width="100%"><colgroup><col width="20%" /><col width="80%" /></colgroup><thead><tr><th>Authorizing Provider</th><th>Result Type</th></tr></thead><tbody><tr><td>Dr. Gray</td><td>IMMUNIZATION ORDERABLES</td></tr></tbody></table></div></li></ul>documented in this encounter</div></div></div><div class="wrap-collabsible"><input id="ID0E36BI" class="toggle" type="checkbox" /><label for="ID0E36BI" class="lbl-toggle" data-loinc-code="51848-0">Visit Diagnoses</label><div class="collapsible-content"><div class="content-inner"><div class="data-table"><table width="100%"><colgroup><col width="100%" /></colgroup><thead><tr><th>Diagnosis</th></tr></thead><tbody><tr ID="vdx3" style="" id="vdx3"><td><p><span id="vdx3Name">History of non-Hodgkin\'s lymphoma</span><span> - Primary</span></p></td></tr><tr ID="vdx4" style="" id="vdx4"><td><p><span id="vdx4Name">Chronic obstructive pulmonary disease, unspecified COPD type (HCC)</span></p></td></tr><tr ID="vdx5" style="" id="vdx5"><td><p><span id="vdx5Name">Screening-pulmonary TB</span></p></td></tr><tr ID="vdx6" style="" id="vdx6"><td><p><span id="vdx6Name">Lower abdominal pain</span></p></td></tr><tr ID="vdx7" style="" id="vdx7"><td><p><span id="vdx7Name">Pneumothorax, unspecified type</span></p></td></tr><tr ID="vdx8" style="" id="vdx8"><td><p><span id="vdx8Name">Non-seasonal allergic rhinitis, unspecified trigger</span></p></td></tr><tr ID="vdx9" style="" id="vdx9"><td><p><span id="vdx9Name">Primary hypertension</span></p></td></tr><tr ID="vdx10" style="" id="vdx10"><td><p><span id="vdx10Name">Coronary artery disease involving native heart without angina pectoris, unspecified vessel or lesion type</span></p></td></tr><tr ID="vdx11" style="" id="vdx11"><td><p><span id="vdx11Name">Chronic sinusitis, unspecified location</span></p></td></tr></tbody></table></div>documented in this encounter</div></div></div><div class="wrap-collabsible"><input id="ID0EWCCI" class="toggle" type="checkbox" /><label for="ID0EWCCI" class="lbl-toggle" data-loinc-code="85847-2">Care Teams</label><div class="collapsible-content"><div class="content-inner"><div class="data-table"><table width="100%" ID="ct54" id="ct54"><colgroup><col span="3" width="25%" /><col width="13%" /><col width="12%" /></colgroup><thead><tr><th>Team Member</th><th>Relationship</th><th>Specialty</th><th>Start Date</th><th>End Date</th></tr></thead><tbody><tr style=""><td><p style="font-weight:bold;">Dr. Masson</p><p>NPI: 1326098302</p><p>310-248-7000 (Work)</p><p>310-248-7033 (Fax)</p></td><td>PCP - General</td><td>Family Medicine</td><td>3/15/18</td><td /></tr></tbody></table></div>documented as of this encounter</div></div></div><table class="header_table"><tbody><tr><td class="td_header_role_name"><span class="td_label"><b>Author:</b></span></td><td class="td_header_role_value">Epic - Version 10.3 - Epic - Version 10.3</td></tr><tr><td class="td_header_role_name"><span class="td_label" /></td><td class="td_header_role_value"><br /><br /></td></tr></tbody></table><table class="header_table"><tbody><tr><td class="td_header_role_name"><span class="td_label"><b>Legal Authenticator:</b></span></td><td class="td_header_role_value">Health Information Executive Director Cshs</td></tr><tr><td class="td_header_role_name"><span class="td_label" /></td><td class="td_header_role_value"><br /><br /></td></tr></tbody></table>Signed on May 29, 2023, 07:40:37</body></html>',jCe="JVBERi0xLjQKJdPr6eEKMSAwIG9iago8PC9UaXRsZSAoVW50aXRsZWQgZG9jdW1lbnQpCi9Qcm9kdWNlciAoU2tpYS9QREYgbTEyNSBHb29nbGUgRG9jcyBSZW5kZXJlcik+PgplbmRvYmoKMyAwIG9iago8PC9jYSAxCi9CTSAvTm9ybWFsPj4KZW5kb2JqCjUgMCBvYmoKPDwvRmlsdGVyIC9GbGF0ZURlY29kZQovTGVuZ3RoIDIwMT4+IHN0cmVhbQp4nI2OTWoDMQyF9zqFLhBFP5ZlQ8mi0Gad4hu0TaDQRdL7Q+wxmYEuSi1ji/fQpyfIvXbSn6iK799wBQpf1MffRcFRb0ecze0C+6Ph5QeGXySjsGe8fcIZTr8IoeN2Bi9SZ8xmYzw32L8mlER5nMB2BtlyUYpaJKxiG5CdGGmEJSvYPvCJ2eKA7QuCTHPNbn1mGqksRiFxEY6yGp7XiSLqmz5JL+3vTMZUncX/Ec0WYKUIz5x03aRzkzB5SRppC631keEEd14/VDIKZW5kc3RyZWFtCmVuZG9iagoyIDAgb2JqCjw8L1R5cGUgL1BhZ2UKL1Jlc291cmNlcyA8PC9Qcm9jU2V0IFsvUERGIC9UZXh0IC9JbWFnZUIgL0ltYWdlQyAvSW1hZ2VJXQovRXh0R1N0YXRlIDw8L0czIDMgMCBSPj4KL0ZvbnQgPDwvRjQgNCAwIFI+Pj4+Ci9NZWRpYUJveCBbMCAwIDYxMiA3OTJdCi9Db250ZW50cyA1IDAgUgovU3RydWN0UGFyZW50cyAwCi9QYXJlbnQgNiAwIFI+PgplbmRvYmoKNiAwIG9iago8PC9UeXBlIC9QYWdlcwovQ291bnQgMQovS2lkcyBbMiAwIFJdPj4KZW5kb2JqCjcgMCBvYmoKPDwvVHlwZSAvQ2F0YWxvZwovUGFnZXMgNiAwIFIKL1ZpZXdlclByZWZlcmVuY2VzIDw8L1R5cGUgL1ZpZXdlclByZWZlcmVuY2VzCi9EaXNwbGF5RG9jVGl0bGUgdHJ1ZT4+Pj4KZW5kb2JqCjggMCBvYmoKPDwvTGVuZ3RoMSAxNzk0OAovRmlsdGVyIC9GbGF0ZURlY29kZQovTGVuZ3RoIDg3MzY+PiBzdHJlYW0KeJztegl4VEXW9qm6vaXTne6EbJ100rfTSQfSYUuAsETS2QCN7IsJJpIAkbDJElRQlDAjChFFcRsZR9zFBe0sYhN1YEQddxh13AVEVJwRQUdxJfd7q7pD0qLf5F++5/99nqnKeetU1alTVeeeOre6O8SIqA9AR4PGlpWPYQvZHCKejNaRYydNnNo0+E9XESl21K8YO3V6ifnPxo1ELID6oIlTB+atHL7jKORFvXZG2fjKSZsXfEM0ZD1R7I1zFtctZQe4C/3T0F8956IV6p3Ot/5JZPgcNO38pfMWv7yqaguR1Y/6BfPqGpdSMkVBfyHk7fMWrTr/vsoz3ibqi/VYLmiYu3jlnnXfPY8FYz7Ttob6urkH45+DPnYQ8sMa0BCXH+VGHWukzIbFK1ZmbVKeJtKLNdcuWjKnrmhi4VTs50b0ty6uW7lU32ZtQt/ZqKsX1C2uT6od/AGMMQ5tZUuXNK7Qcuhm8ItE/9Ll9Uuz3hy/i8hZSRT9Z7QpZCJOscQ0DbywZSV9RYX0JzKi3U4DaQa0PQxZPeoKyaRlC52/kDDeOLpzApXa6YdHf7jELlsiUqVsMdMAZH3d8rrZpM5ZtXwRqfOW1y8ktaF+9nJSF9WtuIDUbp2kd2w58PDDY2fZCr8xpZpk810fZeeI8qVJo3b88OjJeXYyWVCNOjWjKC1hnmM3obZsZEb9kBnlIzMqQGY0Dplhr+eEx3NpG6L4sFXi4V+wKcVIexmojMbQJJpG9bQClqMe9UZN0z7qzqdZQFHWs+tgTZN+iz4fS0oNlcrf6HweZ9LzaIOOi6Sjn1lv/MQJE8mPmVboX++czPKNo1mrXzw4zK/z6p8QTxirDNm3hKpJkZbNDVlW2lTsQjw/DVK8B8968FjKwvrlkO2J4bUIOQ4LMEkWCq0xTmooQM84LY1mgIgS/q/m1+l1NuIX8nuhzKv/XVbqfj3rf2cokAY20kzxtHU4v7SAmsI8gzUvCvMcz78hzCt4Fn3DvK6HjJ5SIBXiDeCIimk5zac6WkTj4SEz4CPLqREtS0h4+VCchME0CP3jZcsSWkGraCmkVDqTFqN9HmQvAKrUH9StTaUpkJpHF4KvQ2tkrVvuAUjmYYbByCpW0CB1nz5bKWrLwQusQ3tohQPknIvC883HDA3oawzP3ih3cxFwLg0wnObs//8k/V/pdlHqPqJtvZKfEZLvShg36P90DbpGqvjfGkdUxEdQpr6DHKAU/f3k0HnxpiHtU9ARUXbO146IflHyf2BQMEyE/W5n82k77aKn2XGMepR2Ujs9T0mIJbfRarqRroKnzkTLBjzTKfDgMrqRObR2RP874cl30iuQPYcupw5KZMnaZ7SG1imvY9Q6slIGvGMSPOUadrZ2IaLOAd3vEQvOhucsZU1apXattlm7h+6lncrz2kmKxumYg/yK9oX+be19eHQ13US30gG2OeoxnKhzcO52Kn+CT21RanRMm6f9gBW46WKsQQeffYXt5j5or6dPWTJbrZRCy91aQHsGUk6qgW9uoQ42lI3lbn21Nl57hRIxx0povZVaaQdykJ6id5lFf1y7RztODsrFKVsDe7zKdiudJ9d2FomHDyv1oxHoWUJ/pr/SPuZhf+FL9BZ9nt6vv0R7AxFxME3Hau/HyE/Yt/xy5DXKc7oxWgnO/Dq6XlibnqUPWQobyCayGbwfX8JvV5YjcubKkzgXZ2kD/QHa9zMf28EtfK9yt+4h3Y+GtM6DWgyeiJf+iPfwX5gVO1VZI/sde5N9xEv5LP5Hfki5UfeA7jVjHXZ9HqLENfQQfcvi2HA2mZ3LGthqdhW7nt3KXmH72BFezKfxhfyY0qAsU57SlSBP1TXqfq+/Un+14UhnZecznX/r/FbL066kyfCHtVj9TfD+dvjJXnoH+QAdYnoWzWKQVeZm09mlyJeza9hdbBt7gLVjln3sEPuMfcW+YT9yBEpu4KnczTOQPXw5v5jfyG/je5H38c/590qSkqH4lKFKoVKlLMGqrlKuQ35M+VCXotur02DnPP3N+q36bfqH9E/rjxssxt+ZyPTyT3efzDm5v5M613fe3Nna2a59iLeDAz7lJBduLZMRt+oQu1fifnIv/Px1ZoHtUlgOG83OhmVmsQVsGVsJS17BtrB75dofYU/CSm+xY1izlTvlmgfwobyET0Q+j9fzZfw6vpm38zf5D4pRiVZsSoKSo4xVapR6ZYWySrlZCSgvKx8oh5QTyk/Ims6sc+kydF6dTzdWN0t3oe523ae6T/XV+pf0HxvMhsWGKw1Bw5fGYcbRxknGycYa4ybjDuMbplp45x56jB7vefbZQWWtUq48RtfyfJ2Dv8pfhT/PornKeA5P5dvYen4Za+eZ+pWGUXwUm0DHdV7Y+jm+lZ/go5TxrIJNpQV8cEibIV73IIpC3R46qnsSe3sVmlcaLOxyfsxgoVZcC0ZgzmeVQTqf8hK9qxxgRt2d9J7OzJLYUX6/Mgle8JRutL6S3Mpt9IiyjF1Gj/FyXDl+NG2EH09gDyIuTGN57DsFN0o+AV5UoHxEv6eF/G06inO8nm5hc3Xz6FrKZ6vpU7oPp6Kf/gJDjiGBvcDn65p5H9ZOXPcAdjeCZTJFH09XsBpli+EYfwdvt706M+1XHsbq9/JHlPG64/oprAEn4DK6kpZpa2mVvlL3GptHCptBWbqDiG6rlTydG+UaRJVqxLQdON0diAPFyni0JMNzzoZfTEeE2IL8B8QJHTxoPs74OYhir1K7YRoP0jx9DEPUQTR+qXMKzdTuo1u1eXSBtpn6Ix5cpa2Gxm30MW2ibWxd56V4j6bj5OxnZ+vH8L36MVp/3szf4VP5zZHPF9bOYsn0D+RHUBmNe1yz7i2aSkXaRu3v8O6+iLC30mw6iw5jl19ghnHKbsrvnMBbtDHKUuz3AE3W7tdczEwN2iKaSE/SvUY91Rl9eMYB9hr2eynV8ynaCqW+cz7ssAlW8MNaFyL+bPCXTp9W7C8afUbhqJEjhhcMHZKfN3jQwAH9c305/fpme7MyPRlu1ZWe5kxNcSQnJSbE94mLtdtirJZoc5TJaNDrFM4ot9wzplYNeGsDOq9n3Lj+ou6pQ0Ndj4bagIqmMZEyAbVWiqmRkn5Inv8zSX9I0n9KktnVQirsn6uWe9TAK2UeNchmTq4Ef02Zp0oNHJX8eMlfJ3kreLcbA9Ty5IYyNcBq1fLAmIsamstry6CuJdpc6imtN/fPpRZzNNhocIEkz9IWljSaSYYnlY9swQ3YikUFUjxl5QGHp0ysIKBkldfNDUyaXFlelup2V/XPDbDSOZ7ZAfKUBGw+KUKlcpqAoTRglNOo88Vu6Gq1JXd388agnWbX+ixzPXPrqisDSl2VmCPWh3nLAkmXHE7urkJ5XGnlVT17U5Xm8uT5qqg2N1+lBu6YXNmz1y2wqgo6MJZnjaltHoOpN8KIFVNVzMbXVVUG2DpMqYqdiF2F9lfvKRcttQvUQJSnxNPQvKAWjyalOUBTVrlbU1L8O7WDlFKuNk+r9LgDRameqroyZ0s8NU9Z1ebwq47Inv65LfbYkGFbYmxhxmLtydSf6pOcFBdcxZRTlmViRZ4z4RABdY6KlVR6sKfhAuqHU/Oc4RBDqmIYFZiLJzI/EFVa22wfKdrF+IA+y+5Rm78heIDn6OeRLXXhFkOW/RsSrPCTU66G/i4+4PMFcnKEixhL8UyxxtGyPrR/7kVB7vEstasoYD6aBNvWVY0cCPO73eIBXx3002xUAk2TK0N1lWantpJ/oK8qwGtFz+6unoTpoqepq+fU8FoPPLld3rgTAibvqT+bPbFPecPIAEv8b7rrQ/0VUz0Vk2dWquXNtWHbVkyLqIX6h5/qC3OBPqWVSioPczxVkb1wyupTwqJSaQnosvBnkE49N2g0wStlC1PHBOy140JYZXa7ezkoqB0Xo2TRPSy8zMBIX2R9VEQ9YnmWZgULxquyYtrM5mZzRB9cLTThmeECHk/TKt1qaYCm42Rm4S+o7R4uqCo14IfJSoUA/C/UFK5GCKaG+Sok4Z39c8cg0DU3j/GoY5prm+uCWtNsj2r3NO/kT/Onm5eW13Y5TlDruDo1MGZjFWzVwEbiUHAqafGw9ZNb/Gz91JmVO+345L9+WmUrZ7y0tqSqJRN9lTtVIr9s5aJVNIqKKipUwbDJVm6S8qk7/URNslcnG2R9TpCRbDN1tTGaE+ShNntXG0ebLtTml20iiRhTOq2yp/fII1nVX77wxHdz1dEmU+8+/BhxE+5KhjBFpMgGg0JkiYrqne6o8PdCIpnkXKdNHlGDbqvZ3Fvdph78v9eND3m26Oje6Y6m7g2aw/ojUqRtTdBtt1h+LvTLyULdG4z+Jd2RDUJ3rNX6P6a7T0xM73THUPcGrUR02nYjbWvWIzDa7b3TbaPuDcb8ku7Ihmi4ZHJcXO90x0J7V7KH9UekSNta4Dap8fG90x0P7d3zhPRHJFtELQZuk5aY2DvdCdS9wT5hikiRk9mgW01O7p3uJOreYMIv6Y6NqNnhNm6Ho3e6k3voTgzr/290x0J3ltPZO92pWHlXEstJ+rlA5HOLw2nIUdXe6U7Hp9yuJJaT8nOByMni4ZIDPJ7e6XZT9wZdYf0RKXKyJLhkntfbO92ZUmPXPNSjFk6Rkzng/8P69eud7mypsWse6lELp/SIWircfWRubu9051C38bLD+iOSGlFLg7uX5uX1Tvcg6t6geCeett2siFoG/L9i+PDe6R5GA07xeWH9ESknouaF/08dPbp3ugsp/xQvvjMf8nOBARG1HLhkdXl573SXUPcGzwCN+LlAfkRtAFxybkUvv04dJzWGUinotO1G2jYPLrmTpil927zJrn1PKv3oIIgr/Vp9aa6dSraS1jrK5Q8qnra4hDxbcX9Fxd1ooEQVuAT0KGiXIn6PmaWko90OXANqAj0K2gXaB8KbAih6VdAS0FbQQdGjpCnOVtVlL85WHBjrwF3LpiTRMZAGUsgFHAiaCJoF2gTaCjJIOdGyBLQGtAt0XPb4laTWzflYe1Lr1bJoW7AoT1brQtXqGlltO6cqVI6fHCrLzgyJjQyJDR4Sah5QEiqzc0NlXFZekyjN1rzdxYlKIjaZiIUvBTL+DNkYQwC4Q0mgAIgrhnCLX4lry/Tmbd2l6IgpXGE0l1zaboW1WmPzis1c48fwunHxL/jRUA8/2hYTm7e1+Cx+iB4F7QIp/BDyh/xDWsMPCpsDi0BbQbtAe0HHQAZ+EPkA8n6+n2z8AxoIKgLNAm0F7QIdAxn5B0A7f198jpIo+CIQ5+8D7fw9bOs9oI2/C+5d/i6W9nprwYi8nZLxDQwzrqwwk5QaZuIS84L8tdbv+8GjvHjS8KgnlAy4Zr6S0Zo12BVUklsL57uC/KM21ee6o3gQf4MCII6VvIGZ3yAVNAlUC1oKMoB7E9yb1AS6DnQHKACClwHtIJW/CHoZ9CYNAvlBk0Amvq8V0wT53lZvias4kb/K/4o3iou/wp+X5cv8OVm+xJ+V5Qso01G+yJ9rTXdRcTT6CWPsKO0oB6Jfz//Slhnn0opj+S7YzgUcCCoCTQTNAm0CGfguntE61xUHJU/Qi7gouHgrfSbL++guE/kXuPzeUjigKsA78gxwgK3qVi/3e2++FVUB3ms3gxPgvWIjOAHeS9aCE+BddBE4Ad65C8AJ8M6cBU6Ad+I0cIAgv/3xzGxXwcSFTC228YthpYthpYthpYtJxy8Wmb7XibX9sTUnBxbb4vf1y3E1dbCmJ1nTFNZ0F2uqZ02Xs6a1rKmQNZ3Hmnysycma0lmTnzU9wYbDFE3M3x5RHeFPZk0vsqbtrKmRNXlZUxZrymRNKivwB7m79cx8WZTLoq1YHDqUZ4xG9LFxNyzqhs+7ERN2AfeCNFnzQ0jNCAk70kWZ0ZZTFKoPGJm3pHgc34OBe/AY9tABkA4PaA/caA+U7IECG7AINAu0G3QMpIEMkM7AwjdJtAEHgopAs0BrQMdABrmcYyBOS8JLfFQubGB40RNFje9BFj8UuLnbn2Z32n32ccomJ7Ols4npWjovIHknjYs1xQaZdce31u++tVJUcRS/lm+iNDyI68Llptbv01xB9odW7xOu4gR2C6Xr4HVsBHlZFsrh1CjrQ8lpEuUQcvKHUOa1OmdgmK3Vm+vqYDFi1A7X987Drs+cQQ72iPMJ11tqUMdaXX9Hy0M7XG84N7heGBg0oeVJb5Ch6FCl6E7ncNf2F6XoWnRsaXVdLoodrsucY10LnbKjPtRxXiNqfptrinemaxz0lTlnu/yN0LnDVeQ8z1UYkhoqxuxwDcISfCE2B4vt55STetKlwukFQdbgzzXebKw0TjQOM+YZc41uo8uYZkw1xpviTHZTjMliMptMJoNJZ+ImMsUHtYN+n/jtPt4g/0nDoJM/7kvezkn+e4D8yZ8zE6ezKNBHqeAVU0tYRWD3HKqYrQZOTPUEmXnyzIDeU8ICcRVUMa0kMNxXETRqUwIFvoqAcdK5lS2MXVuF1gBfH2Q0rTLINNG0LlV8f7mTGItdd02qKPuuu6aqipITLypKLoobHTtiTNkvQG0Yfd0pOYJPC9xcMbUy8GBaVSBPMFpaVUXgBvEF5072FTteXraTfSmKqsqdymj2VfkU0a6MLquqqgiyGVKOVPYl5OAxX0o5E17MQo5UU3pIbktILgvjIZcpCshFRVGWlMuKipJyOibkWhozy8taMjOlTJJKjVKmMUntKfNiFmSysqRMYhO9KGVeTGwSMoHRUsTphEi6U4qwFHJKESdLkSIzukUGhkU2nBLZIGdSWLeMMyRjPdglYz0IGV9vU32Jz8faRlXNqRZfDtd6yutBtYGrL2pIDjTNVtWWOVXhb429tbPnNIiyrj5Q5akvC8zxlKkto6p/obtadI/ylLXgvjitsqXaX1/WOso/qtxTV1bVNnbSkIKIuTacmmvIpF9QNkkoGyLmGlvwC90FonusmKtAzFUg5hrrHyvnIunjkypbTFRSVVodKtt4tBn+WpvqripJtC8dLZ13lDv58tQO3Fa2UbSvKmDxlASsINHVv7h/sejCmRJdMeIXgHBX8uWj3KkdbFu4y47mWE8J+VZc2HghJZfPLwv9NSKhacWFwuAh9DX+WkJfecBfV9a4Ap8SAjlTKwJFk2dWthiNaK0VWwqM7GqLji4PartDjQPQOFI0KsopQdFWKNqiosKCpz//C8NlqTgFTfyJNuZPZyuosUoJpFdM4wgF08JftXbgLiVeD41V2GAj87HGLh3hZft8FKqT2HMXrbgwzIVtsSJchkZiSGOXSU4lYSzfKYutgEIRuUj8kK8X/8dlxEfDWHdsFkD8C9NPqrL7J7+efiRVt1v8r9ftkJyp7yAbpTGHP051sVKTMy2dMx5rT7eRKSmodbZbLCXTwXzVHh0tmRP+DIsVnFeNYi6/1cqnR6l2O9BsswGTZUtQ+9qfbbEYpkeluNLsMWKo3WzFMLtF6LOrTH5qEOMIKtvFUMmI0WB+wLSS+bZdaAHznR/jwdWkj6pO9tlPhCxQU3gSWBiu1hwVRi0qPFkoaPCg0lX+YUqqEfFfjzeAzuBITknmhmizxWw1K4aExPjEPomKIVVJcrO4GECyyelmieZYN54P8/lykNaymvxYd15SYlJiXEI8j+GeLHfesIJhw4YO8WZ7Pe7b2fcPzby8akXjhEuuf2VdZwsbcf29g8vH37JowvbOl/UdCWlnz+7c+8z9nZ0P1OVtHza4/LP7Pvk2R3wy2kakWwfbR9Fd/jMM+nSTaZORGY2k6IT9yWS8TeVqNOcp0booLmwWJa0YZRbGj/q39vNHSwNaoqOl9Tq7zHi8y4xmYcYJ9q99XYYcLy05wX6iZvxhKhIGjBsxsKbQLgwJEyS4JW1TPvjpYx44OUnfsb1z5PaT54f9SHcSe7FSMh33p9fHLoznFfaK+HPt58broi3ptpgYSkoO7Suuy6fiunwKzHc7hG/EeU3CvWIFbzKLnZjsYv0m4U39xQZMKWoKw19KslXaxCptYpU2sf6v2uSH02zi6OlaXb41wb6sRjaND3lX2DLSwVgNhdwjncM53O5Y8Kc8g/fbPH7R5qovOl/oXM8uffL2mrMHX9G5Qd8RE1e/Y/ETnSdPPqywjWuqf59gFVeOQbBhB2xopP1+h0HuzijRYBR7NEpkQe17aTOs+nt/rOAMerF5o0R0/9guGHT/6I8VnJ6n6xThTga9LirIG9tUHdPhFvW4QWV8oMIU8I8xabmgdsQfLa1nCpvuq65TeKjLhj912ayzXZpMaDTtuLXngbR/LZzmcM0n9kJ7YchcMFR30IIfDRWexPt0pumaO1P11u3bf/gXvKhCO6JL142mBESj2/1JLnIm8OlKjb4manp0vbJQvySqPtqUENQOy6ljwfinCC7NKTA77h39D/EnUnSD40Y6BjuL48anFDsnx1U7pjjr4han1DlXGlYmnOAnku2UyGzWpKRJibWJS/FR3Wm7zn6HndvtulSn2Ugd/EFi2u52YQjYc7c/xm43TLczxm7q49RFIwAePy0khtw3yW8Nau9LS4H5Qq4SzD+kyaxCVVR2zpCAlVlTXKi1ZXmHiPLxdM+QQS7mSoR1/dVCUWK+3SSjZChummTczDT6M3OGuIxFuOsqRhlFjRbRY1Sjo/l0Y7J4VEanmN0YIzzc6BTzGhPFMoyO9CEFPY+7r8Ynz/thtC3z+U4s6+HgR0/WoKPoqDz+J5cVsti4ESPiRoS8HRJs2XKWZDB4MijWTvl5FBtvdCcm5ucNY27h+BkG5byO3C92ftZ5jMW//3cWw346Ym5dN2fjyXf5ZMvwGRtWP8BmJN3dzlxMYRbWt3N/5/d29dGOBnbTlaUN94mzUKQdUVrgCYOUFn+fJGmFZIkOiX0RD+QzyO5ivF1MVheT2cV4upiMLsbdxagirqwRnC4jPmNk1FlRZZkzMuozVkddG3VF5n19Hsp9WrFGJaUkJw2qyH0zSZ/Kp3Nuz2Pm5GpTdVS1uTq62lJtXWBaELXAvCB6gWWBtd3bnm3L9mZmZ/YbljnTXBU91zu37wrPisymzBvMt1k2970l96ZB95gfsNydfU/fNu+z3kS5F/GIMroYTxeT2cWE92vo2oKha1OGrm3iEAS1/f649BEzTdlZFrMuRfUm6KIHpKUE+YP+DEeucBGXo8gx0THL8ahjr8Ngc7gcSxwHHDqXY5ODO57C6U5AKJe+748X4nbmZ9zO9iFoMzvj4iy0xScOkWfCHhM7hLEB1WmL0niaM8GoE8sQg8B80i4OjGD8fWw2cM4B0S6E7EyHv0/ykDwxfKiIL47kEAqPdSQK73WoYqRDFaMcdrErh/Re0Ytn38HPJaP21Q4ZDjNzoOgx54h9OSxHzCnGgzkio75kxPgccfyECjBf7xBaclLkCtw4ibV5u/N4UV5THs8TxzuT5FLILgObGjI+l04idyS9xSXWpkovVDNtdrFlm1y7TRXCNvGW8Yol2GLE/DaLUGYziJltGQeIFdFERDrH4PBprFk2vutEirPns6NcPsFes8wXCqfLxJn8ujt2Hl2O44my6OgynE6c4mXLfYftJ2WBU4o/HNakEfLm48/un+7Rx+d6Y+1x9j52xZBhVVMpqq8xlen7A9LjUXXHeFIpw2O1mPqZU1nf7CizwadLJZc9LZXhEiRCeAhkAM/xrV27lk6tpmYZq1m+rKa7QQj1KZCxYOiQbG/2AD50iLgr5eclJiYZvSI2JMSLq5R8X4oQ4i1qtW24dPXKoVk3PHfrxOLhOddPveypmbEBS+P81QsSEwemXrHrlhnzn7ts7zvsDOfC5fVlZ3iSs/LOXDth7Kq+Lt+4S+clT6meUuBxpvUxZ+YXr66eufWch0UEydS+4jn6WymJuXaSJXzjiO66epi6GGMXY+hizMLNPd4hUcJLpoJpcjBiFquZKZRoj/LZzIZEpxJts2dQBrPGydgcJ/0hzixvNVkWphlN5VHltcalxibjdUYdGVXjHcaAcbdxn9FgFG8G8W4xCr8SnmIUL5KYGMl8J11OMjKci0uK8D2juKREC98zGmRUFw4uA3sHX0DJbFjL+T0uLuLJfH3YfjR8Nz78NV7DR8V7OBZhPDY/3/6CiOVh0awk8Ri8Q2M9Q/NjC2LzEzyx8eIJcnvK2YWzF+VecUXbY4/18fVNv3OrfXT9XXzORmZc1HnNxpM3jM8N/TymkMJE0isKwgSjZP3n0bvpO5NGJjJpnbjhRmknyUxm+X/Q0UALHslJ3BatwBiJNooB2skGjAX+RHEUC+xDccB46gNMAP5IiRQPTKIEYDLwB3JQEvgUcoBPpRSgU2IapQLTyal9Ty6JKqUB3eQCZpAK9AC/o0xyA7MoA+gFfkvZ5AH2hR99S/3IC8yR6KNs7QTlUl9gf4kDKAc4kHzAQdQfOBj4DeXRAGA+DQQOoUHa1zRU4jAaDCygfOBwGqL9i0ZIHElDgaMkFtIw4BlUABxNw4FFNEL7ivw0ElhMo4AlVAgsBX5JZXQGsJxGA8fg7XmcxpIfOI6KgWdSCfAsiRVUCjybyoDjaYx2jCZInEhjgZNoHHAynal9QVMkTqWzgNNwNztK02k8cIbEc2gCsJImap9TFU0CzgQepXNpMvhqmgqsoWnA8yTOounaP6mWZgDr6BzgbOA/aA5VAefSTGA9nQs8n6q1z2iexAaqAc6n87QjtIBqwS+UuIjqgItpNtovoDnAJRKX0lztU1pG9cDlNA/YKHEFNWif0IU0H3gRLQBeDPyYVtJC4CpaDLyELgBeKnE1LQFeRkuBl9My7TCtkdhEjcC1tAL4O7pQE//fexHwConr6GLtEF1JK4FX0SrgeroEuIEu1T6kZloNvJouQ8tG4Id0DV0OvJbWADfRWuB1wIN0Pf0OuJl+D7yBrtAO0I0Sb6J1wJvpKuAttB69fwAeoFtpA3ALNWv76Y90NfA22gj8k8Tb6VrgVtoEvIOuA94J/IDuouuBd9Nm4D10A/BeulF7n+6jm7T36H66GbiNbgE+IPFB+gPwIboV+DD9Ebhd4iN0G/BR+hMwQLcDW4DvUittBbbRHcB2ukt7hx6ju7W3aYfEx+keYJDuBe6k+4AdEp+gbcAn6QHtLXqKHgT+WeIuegi4mx4G/oW2A5+mR4B76FHtTXqGAsBnqUX7Oz0n8a/UCnye2rQ36AVqB75IjwFfoh3Al+lx4Cv4GPMGvUo7gXsl7qMO4N/oSeBr9JT2Or0OfI3eoD8D/067gG/Sbu1v9JbEt+lp4Du0B/guPQN8T+L79CzwA3oOuJ/+qu2jAxIP0gvaXvqQXgQeopeAH0k8TC8DP6ZXgJ/Qq8BPaZ/2Kh2R+Bn9DfgPek17hf5JrwM/l3iU3gB+QW9qL9Mxegt4XOKX9DbwK3oH+C96F/i1xG/ofe0lOkEfAL+l/cDvgC/S93QA+AMdBP5IHwJ/kniSPtJeoE46DNToY+B/Yvr/fEz/8jce0//Z65j+2a/E9M9Oi+lHfiWmf3paTP+kFzH98KmYvjwipn/0KzH9IxnTPzotph+SMf1Qj5h+SMb0QzKmH+oR0z88LaYflDH9oIzpB3+DMf2d/0cx/Y3/xPT/xPTfXEz/rd/Tf7sx/dfu6f+J6f+J6b8c05//7cf0/wK993M1CmVuZHN0cmVhbQplbmRvYmoKOSAwIG9iago8PC9UeXBlIC9Gb250RGVzY3JpcHRvcgovRm9udE5hbWUgL0FBQUFBQStBcmlhbE1UCi9GbGFncyA0Ci9Bc2NlbnQgOTA1LjI3MzQ0Ci9EZXNjZW50IC0yMTEuOTE0MDYKL1N0ZW1WIDQ1Ljg5ODQzOAovQ2FwSGVpZ2h0IDcxNS44MjAzMQovSXRhbGljQW5nbGUgMAovRm9udEJCb3ggWy02NjQuNTUwNzggLTMyNC43MDcwMyAyMDAwIDEwMDUuODU5MzhdCi9Gb250RmlsZTIgOCAwIFI+PgplbmRvYmoKMTAgMCBvYmoKPDwvVHlwZSAvRm9udAovRm9udERlc2NyaXB0b3IgOSAwIFIKL0Jhc2VGb250IC9BQUFBQUErQXJpYWxNVAovU3VidHlwZSAvQ0lERm9udFR5cGUyCi9DSURUb0dJRE1hcCAvSWRlbnRpdHkKL0NJRFN5c3RlbUluZm8gPDwvUmVnaXN0cnkgKEFkb2JlKQovT3JkZXJpbmcgKElkZW50aXR5KQovU3VwcGxlbWVudCAwPj4KL1cgWzAgWzc1MF0gMzkgWzcyMi4xNjc5NyAwIDYxMC44Mzk4NF0gNTEgWzY2Ni45OTIxOSAwIDAgMCA2MTAuODM5ODRdIDcyIFs1NTYuMTUyMzRdIDg3IFsyNzcuODMyMDNdXQovRFcgNTAwPj4KZW5kb2JqCjExIDAgb2JqCjw8L0ZpbHRlciAvRmxhdGVEZWNvZGUKL0xlbmd0aCAyNjU+PiBzdHJlYW0KeJxdkctqxDAMRff+Ci2niyHvTAdCoEwpZNEHTfsBjq2khsY2jrPI39ePNIUKbDjoXlmSk1v32ElhIXkzivVoYRSSG1zUahjCgJOQJMuBC2Z3CjebqSaJM/fbYnHu5KhI0wAk7y67WLPB6YGrAe9I8mo4GiEnOH3eesf9qvU3zigtpKRtgePoKj1T/UJnhCTYzh13eWG3s/P8KT42jZAHzmI3THFcNGVoqJyQNKmLFponFy1Byf/lq+gaRvZFjVfnF6dO07JsA10j1YGKIlCVRorKKirL+0B1FV7Z62W/1Y9mqjqaovdS7OqY9+35NR6zs9UYN3bYdZjXTyokHt+hlfYuf34A/WeHbwplbmRzdHJlYW0KZW5kb2JqCjQgMCBvYmoKPDwvVHlwZSAvRm9udAovU3VidHlwZSAvVHlwZTAKL0Jhc2VGb250IC9BQUFBQUErQXJpYWxNVAovRW5jb2RpbmcgL0lkZW50aXR5LUgKL0Rlc2NlbmRhbnRGb250cyBbMTAgMCBSXQovVG9Vbmljb2RlIDExIDAgUj4+CmVuZG9iagp4cmVmCjAgMTIKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDE1IDAwMDAwIG4gCjAwMDAwMDA0MTYgMDAwMDAgbiAKMDAwMDAwMDEwOCAwMDAwMCBuIAowMDAwMDEwNDk1IDAwMDAwIG4gCjAwMDAwMDAxNDUgMDAwMDAgbiAKMDAwMDAwMDYyNCAwMDAwMCBuIAowMDAwMDAwNjc5IDAwMDAwIG4gCjAwMDAwMDA3OTYgMDAwMDAgbiAKMDAwMDAwOTYxOCAwMDAwMCBuIAowMDAwMDA5ODUyIDAwMDAwIG4gCjAwMDAwMTAxNTkgMDAwMDAgbiAKdHJhaWxlcgo8PC9TaXplIDEyCi9Sb290IDcgMCBSCi9JbmZvIDEgMCBSPj4Kc3RhcnR4cmVmCjEwNjM0CiUlRU9GCg==";function zCe(e){let[a,n]=c(null);l((()=>{if("html"!=e.previewState)if("pdf"!=e.previewState){var t=new URLSearchParams({ReportID:e.reportId}).toString();w.invokeCustomApi("HealthAndWellnessApi.DownloadReport","GET",t,!0).then((function(e){n(e)}))}else n({Type:"ResearchKitConsentDocument",Summary:no("summary"),Content:jCe,ContentType:"application/pdf"});else n({Type:no("subsequent-evaluation-note"),Summary:no("summary"),Content:NCe,ContentType:"text/html"})}),[]);let i="";return a&&(i=a.Type,a.Summary&&(i+=" • "+a.Summary)),t.createElement(Ka,{className:"mdhui-report-view",colorScheme:e.colorScheme},t.createElement(XAe,{subtitle:i,variant:"compressedModal",showCloseButton:!0}),!a&&t.createElement(XA,null),a&&t.createElement(ICe,{type:a.Type,content:a.Content,contentType:a.ContentType}))}function RCe(e){return t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},t.createElement(XAe,{variant:"compressed",showCloseButton:!0},t.createElement(sM,{order:1},e.title)),t.createElement(iSe,{previewState:e.previewState,resources:e.resources,onViewResource:t=>{e.previewState||w.openEmbeddedUrl(t.url)},emptyText:e.emptyText,imageAlignment:e.resourceImageAlignment,buttonVariant:e.resourceButtonVariant,buttonText:e.resourceButtonText}))}function LCe(e){return t.createElement(Ka,{colorScheme:e.colorScheme},t.createElement(XAe,{showBackButton:"Push"==e.presentation,showCloseButton:"Modal"==e.presentation}),t.createElement(qAe,{previewState:e.previewState,term:e.term,labObservationID:e.labObservationID,openLinksInNewWindow:e.openLinksInNewWindow}))}function FCe(e){let[a,n]=t.useState([{key:"Dashboard"}]);function i(e){n([...a,e])}function r(e){i({key:"TermInformation",properties:{term:{TermFamily:e.TermFamily,TermNamespace:e.TermNamespace,TermCode:e.TermCode}}})}function o(){i({key:"ExternalAccounts"})}function s(){n(a.slice(0,a.length-1)),2==a.length&&w.triggerEvent({type:"applicationDidBecomeVisible"})}function l(a){return t.createElement(kge,{concept:a,onClick:()=>function(e){i("Reports"==e||"Immunizations"==e||"Procedures"==e?{key:"NewsFeed",properties:{feed:e}}:{key:e})}(a),previewState:"default"==e.previewState?"Default":void 0})}function c(s){if("Dashboard"==s.key)return t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},t.createElement(bde,{previewState:"default"==e.previewState?"externalAccountsLoaded":void 0,externalAccountCategories:["Provider","Health Plan"],triggerWebExternalAccountSyncComplete:!0}),t.createElement(oSe,{noTopMargin:!0},t.createElement(gde,{previewState:"default"==e.previewState?"externalAccountWithIssue":void 0,externalAccountCategories:["Provider","Health Plan"],onClick:()=>o()}),t.createElement(xde,{excludeDeviceManufacturers:!0,onClick:()=>o(),previewState:"default"==e.previewState?"Default":void 0}),t.createElement(Yge,{onViewTermInfo:e=>r(e),onClick:()=>{i({key:"NewsFeed",properties:{feed:"LabReports"}})},previewState:"default"==e.previewState?"ImportantLabs":void 0}),t.createElement($ge,{previewState:"default"==e.previewState?"BloodTypeLabs":void 0,onClick:()=>function(){let e="https://medlineplus.gov/ency/article/003345.htm";w.getCurrentLanguage().toLowerCase().startsWith("es")&&(e="https://medlineplus.gov/spanish/ency/article/003345.htm"),window.open(e,"_blank")}()}),l("Medications"),l("Immunizations"),l("Reports"),l("Allergies"),l("Conditions"),l("Procedures")),t.createElement(aS,null,t.createElement(NU,{previewState:"default"==e.previewState?"enabled":void 0,variant:"small",hideWhenConnected:!0,onClick:()=>i({key:"ConnectEhr"})})));if("NewsFeed"==s.key)return t.createElement(fCe,{feed:s.properties?.feed,previewState:e.previewState,presentation:"Push",colorScheme:e.colorScheme,onEventSelected:e=>{n([...a,{key:"NewsFeedEventDetail",properties:{eventReference:e}}])},onReportSelected:e=>{i({key:"ReportDetail",properties:{reportID:e}})}});if("NewsFeedEventDetail"==s.key){let a,n=s.properties?.eventReference,r=n.feed;return e.previewState&&("Procedures"==r&&(a="ProcedureGroup"),"LabReports"==r&&(a="LabReport")),t.createElement(yCe,{feed:n.feed,presentation:"Push",pageDate:n.pageDate,pageId:n.pageId,onViewLabObservationTermInfo:e=>{i({key:"TermInformation",properties:{labObservationID:e}})},previewState:a})}return"TermInformation"==s.key?t.createElement(LCe,{presentation:"Modal",openLinksInNewWindow:!0,previewState:e.previewState,term:s.properties?.term,labObservationID:s.properties?.labObservationID}):"Medications"==s.key?t.createElement(SCe,{presentation:"Push",previewState:e.previewState,onViewTermInfo:e=>r(e)}):"Conditions"==s.key?t.createElement(sCe,{presentation:"Push",previewState:e.previewState,onViewTermInfo:e=>r(e)}):"Allergies"==s.key?t.createElement(rCe,{presentation:"Push",previewState:e.previewState,onViewTermInfo:e=>r(e)}):"ReportDetail"==s.key?t.createElement(zCe,{previewState:"default"==e.previewState?"html":void 0,reportId:s.properties?.reportId}):"ExternalAccounts"==s.key?t.createElement(vCe,{presentation:"Push",excludeDeviceManufacturers:!0,colorScheme:e.colorScheme,previewState:e.previewState,connectExternalAccountOptions:e.connectExternalAccountOptions}):"ConnectEhr"==s.key?t.createElement(Ka,{colorScheme:e.colorScheme},t.createElement(XAe,{showBackButton:!0}),t.createElement(oSe,null,t.createElement(AAe,{providerCategories:["Provider","Health Plan"],connectExternalAccountOptions:e.connectExternalAccountOptions}))):void 0}return w.back=s,w.dismiss=s,t.createElement(t.Fragment,null,a.map(((e,n)=>t.createElement("div",{key:e.key,style:{display:n!=a.length-1?"none":void 0}},c(e)))))}A(".mdhui-report-view {\n height: calc(100dvh - 8px);\n display: flex;\n flex-direction: column;\n}\n\n.mdhui-report-view .mdhui-report-content {\n flex-grow: 1;\n}");export{qq as AIAssistant,Za as Action,Ya as ActivityMeter,Vq as AllergiesList,rCe as AllergiesView,Zq as AppDownload,Qq as AppleHealthRecordsSync,pEe as AsthmaActionPlanManager,FEe as AsthmaActionPlanView,BEe as AsthmaActivityView,fEe as AsthmaAirQualities,HEe as AsthmaAirQualityView,yEe as AsthmaAlertTakeoverNotice,vEe as AsthmaAlertTakeoverTrigger,qEe as AsthmaAlertTakeoverView,wEe as AsthmaBiometrics,AEe as AsthmaControlCalendar,CEe as AsthmaControlStatusHeader,$Se as AsthmaDailyDataType,UEe as AsthmaDayView,VEe as AsthmaHeartAndLungsView,OEe as AsthmaLogEntryDetails,GEe as AsthmaLogEntryEditorView,NEe as AsthmaLogEntryHeader,ESe as AsthmaParticipant,jEe as AsthmaPostEnrollmentSurveyTrigger,REe as AsthmaProviderReport,KEe as AsthmaProviderReportView,LEe as AsthmaRecommendedArticle,ZEe as AsthmaSleepView,ZA as BasicBadge,tU as BasicBadges,eU as BasicPointsForBadges,oCe as BlankView,YA as BloodPressureReading,iU as BloodPressureVisualization,QA as Button,JA as Calendar,eS as CalendarDay,aS as Card,nS as CardTitle,g_e as CelebrationStep,f_e as CelebrationStepContainer,nM as Chat,rU as ConditionsList,sCe as ConditionsView,y_e as ConnectDeviceAccountStep,v_e as ConnectDeviceAccountStepContainer,EU as ConnectDevicesMenu,lCe as ConnectDevicesView,DU as ConnectDexcom,NU as ConnectEhr,b_e as ConnectEhrStep,w_e as ConnectEhrStepContainer,cCe as ConnectEhrView,jU as ConnectFitbit,zU as ConnectGarmin,RU as ConnectOura,EA as CustomFieldIntegerValueProvider,Lue as DailyDataChart,Fue as DailyDataGoal,Hr as DailyDataType,rM as DateRangeContext,oM as DateRangeCoordinator,iM as DateRangeNavigator,cM as DateRangeTitle,uM as DayTrackerSymbol,_A as DaysWithDataValueProvider,uCe as DeviceActivityView,Hue as DeviceDataMonthChart,que as DeviceDataMonthCharts,dCe as DeviceDataView,dM as DiscreteScale,hM as Divider,hCe as DocumentDetailView,Uue as DocumentLibraryPreview,pCe as DocumentLibraryView,gM as DumbbellChart,sde as EhrNewsFeed,cde as EhrNewsFeedEventDetail,yCe as EhrNewsFeedEventDetailView,fCe as EhrNewsFeedView,gde as ExternalAccountConnectionAlert,yde as ExternalAccountList,bde as ExternalAccountsLoadingIndicator,xde as ExternalAccountsPreview,vCe as ExternalAccountsView,xM as Face,Cde as FitbitDevices,Pde as FitbitMonthCharts,bCe as FitbitView,Mde as GarminDevices,Dde as GarminMonthCharts,wCe as GarminView,Ide as GlucoseChart,jde as GlucoseContext,zde as GlucoseDayCoordinator,kM as GlucoseStats,yge as Goal,EM as Grid,kCe as HealthAndWellnessView,vge as HealthConnectPhrSync,kge as HealthPreviewSection,_M as Histogram,xCe as HomeView,xSe as InboxCompletedListItem,DCe as InboxHistoryView,Pge as InboxItemList,Ege as InboxItemListCoordinator,kSe as InboxMessageListItem,_ge as InboxMessageView,ASe as InboxResourceListItem,SSe as InboxSurveyListItem,OCe as InboxView,Ige as InsightMatrix,Hge as IntradayHeartRateChart,$ge as LabResultsBloodType,Yge as LabResultsSummary,Qge as LatestBloodPressureReading,Ka as Layout,Ga as LayoutContext,XA as LoadingIndicator,$Ae as MealButtons,efe as MealContext,tfe as MealCoordinator,ife as MealEditor,ACe as MealEditorView,ZAe as MealLog,rfe as MedicationsList,SCe as MedicationsView,lfe as MicroTrend,YAe as MonthlyEventMatrix,dfe as MostRecentNotification,xA as MyDataHelpsTools,XAe as NavigationBar,CCe as NewBadgeView,TCe as NewPointsView,HA as NotEnteredThreshold,QAe as NotesInput,mfe as NotificationList,ECe as NotificationsView,yAe as PdfPreview,Wq as PlatformSpecificContent,JAe as ProgressBar,eSe as ProgressBarStep,tSe as ProgressRing,vAe as ProjectHeader,bAe as ProjectSupport,AAe as ProviderSearch,SA as RandomIntegerValueProvider,SAe as RecentDailyDataBarChart,TAe as RelativeActivity,_Ae as RelativeActivityDayCoordinator,PAe as RelativeActivityToday,zCe as ReportView,aSe as Resource,iSe as ResourceList,RCe as ResourceListView,OAe as RestingHeartRateCalendar,rSe as RotatingComponentCoordinator,oSe as Section,sSe as SegmentedControl,FAe as SeverityCalendar,tS as ShinyOverlay,lSe as SingleDataPoint,cSe as SingleExternalAccount,uSe as SingleNotification,hSe as SingleSurveyTask,kA as SingleValueProvider,mSe as SparkBarChart,pSe as SparkRangeChart,FCe as StandaloneHealthAndWellnessView,AA as StaticIntegerValueProvider,fSe as StatusBarBackground,t_e as StepDetailText,p_e as StepImage,m_e as StepImageIcon,YEe as StepLayout,QEe as StepMarkdown,a_e as StepNextButton,e_e as StepText,JEe as StepTitle,BAe as StressLevel,DAe as SurveyAnswerChart,jAe as SurveyTaskList,_Ce as SurveyTasksView,gSe as Switch,j_e as SymptomSharkCalendar,J_e as SymptomSharkCalendarView,L_e as SymptomSharkLogEntry,X_e as SymptomSharkLogEntryEdit,tCe as SymptomSharkLogEntryEditView,Z_e as SymptomSharkLogEntryList,Y_e as SymptomSharkLogToday,V_e as SymptomSharkMonthReport,q_e as SymptomSharkNotesTimeline,R_e as SymptomSharkOverallExperienceChart,Q_e as SymptomSharkReportBuilder,aCe as SymptomSharkReportBuilderView,nCe as SymptomSharkSymptomDetailView,N_e as SymptomSharkSymptomMatrix,U_e as SymptomSharkSymptomSeverityChart,$_e as SymptomSharkSymptomSeveritySummary,__e as SymptomSharkSymptomTreatmentFilters,W_e as SymptomSharkSymptomTreatmentHistograms,I_e as SymptomSharkVisualizationCoordinator,qAe as TermInformation,LCe as TermInformationView,$q as TextBlock,Rue as TimeSeriesChart,sM as Title,ySe as TrackerItem,S as UnstyledButton,vSe as ValueSelector,UAe as ViewDeviceActivity,VAe as ViewEhr,bSe as ViewHeader,wSe as WeekCalendar,WAe as WeeklyDayNavigator,x_e as YouTubeStep,k_e as YouTubeStepContainer,dEe as asthmaDataService,sd as awardPointsAndBadges,du as bloodPressureDataProvider,kl as capitalizeFirstLetterForLocale,hEe as caregiverVariableLanguage,Jc as checkDailyDataAvailability,gd as combinedIntradayHeartRateDataProvider,CSe as computeAsthmaControlState,vd as computeBestFitGlucoseValue,bd as computeGlucoseReadingRanges,wd as computeGlucoseReadingRecentAverage,qA as computeThresholdDays,A_e as convertToSymptomSharkConfiguration,VA as createAllLibraryDocumentsLoader,pd as createAreaChartDefs,md as createBarChartDefs,PA as createCustomFieldIntegerValueProvider,OA as createDaysWithDataValueProvider,BA as createIntegerInsightMatrixValueFormatter,$A as createLibraryDocumentSorter,hd as createLineChartDefs,RA as createMinMaxInsightMatrixValueEvaluator,FA as createMinutesToHoursInsightMatrixValueFormatter,jA as createNonZeroAverageValueInsightMatrixValueCalculator,zA as createPercentageOfDaysInsightMatrixValueCalculator,TA as createRandomIntegerValueProvider,LA as createShrinkThousandsInsightMatrixValueFormatter,WA as createSingleLibraryDocumentLoader,CA as createStaticIntegerValueProvider,xd as createThumbnailIfNecessary,Gc as dailyDataTypeDefinitions,_Se as dateToAsthmaLogEntryIdentifier,zd as deleteStressLevel,bl as formatDateForLocale,GA as formatLibraryDocumentDateAndType,xl as formatMinutesForLocale,wl as formatNumberForLocale,Pd as generateGlucose,MA as generateSampleData,Md as generateSleep,Od as generateSteps,su as get6MonthStart,au as getAllDailyDataTypes,LSe as getAsthmaAirQualityDescriptionText,PSe as getAsthmaDataStatusColor,TSe as getAsthmaDataStatusText,NSe as getAsthmaImpactTexts,jSe as getAsthmaImpacts,MSe as getAsthmaSymptomLevel,OSe as getAsthmaSymptomLevelText,DSe as getAsthmaSymptomTexts,ISe as getAsthmaSymptoms,zSe as getAsthmaTriggerTexts,RSe as getAsthmaTriggers,Re as getColorFromAssortment,ro as getCountryCodeFromIso,nu as getDailyDataTypeDefinition,vl as getDateLocale,Br as getDayKey,lu as getDefaultIntervalStart,yd as getGlucoseReadings,yl as getIntlLocale,io as getLanguageCodeFromIso,Cd as getMealImageUrls,Ed as getMealToEdit,Ld as getMealTypeDisplayText,kd as getMeals,ou as getMonthStart,Dd as getSleepMinutes,Id as getSteps,Nd as getStressLevel,NA as getSurveyDataProvider,ru as getWeekStart,VSe as isBloodOxygenLevelWithinRange,FSe as isDaytimeRestingHeartRateWithinRange,BSe as isNighttimeRestingHeartRateWithinRange,HSe as isRespiratoryRateWithinRange,USe as isSleepDisturbancesWithinRange,qSe as isStepsWithinRange,IA as isSurveyDataType,no as language,Kc as predictableRandomNumber,Sd as prepareMealForEditing,eu as queryDailyData,tu as queryPreviewDailyData,rd as queryRelativeActivity,Yc as registerDailyDataProvider,Xc as registerDailyDataTypeDefinition,je as resolveColor,Ad as saveMeals,jd as saveStressLevel,PCe as showNewPoints,Oc as simpleAvailabilityCheck,dd as standardDailyDataTypes,ld as sumActivityPoints,ao as supportedLocales,fd as timestampSortAsc,UA as tryParseRegex,_d as uploadMealImageFile,id as useInitializeView,Xq as useInterval};
|
|
214
|
+
*/var pfe={d:(e,t)=>{for(var a in t)pfe.o(t,a)&&!pfe.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},gfe=globalThis.pdfjsLib={};pfe.d(gfe,{AbortException:()=>Cye,AnnotationEditorLayer:()=>_xe,AnnotationEditorParamsType:()=>Ofe,AnnotationEditorType:()=>Pfe,AnnotationEditorUIManager:()=>xve,AnnotationLayer:()=>hxe,AnnotationMode:()=>Tfe,ColorPicker:()=>kxe,DOMSVGFactory:()=>Nwe,DrawLayer:()=>Cxe,FeatureTest:()=>Mye,GlobalWorkerOptions:()=>vbe,ImageKind:()=>Lfe,InvalidPDFException:()=>Aye,MissingPDFException:()=>Sye,OPS:()=>cye,OutputScale:()=>hve,PDFDataRangeTransport:()=>vwe,PDFDateString:()=>ove,PDFWorker:()=>kwe,PasswordResponses:()=>uye,PermissionFlag:()=>Mfe,PixelsPerInch:()=>Kye,RenderingCancelledException:()=>Xye,TextLayer:()=>lwe,UnexpectedResponseException:()=>Eye,Util:()=>Iye,VerbosityLevel:()=>lye,XfaLayer:()=>jwe,build:()=>Pwe,createValidAbsoluteUrl:()=>vye,fetchData:()=>Zye,getDocument:()=>gwe,getFilenameFromUrl:()=>eve,getPdfFilenameFromUrl:()=>tve,getXfaPageViewport:()=>sve,isDataScheme:()=>Qye,isPdfFile:()=>Jye,noContextMenu:()=>ive,normalizeUnicode:()=>zye,setLayerDimensions:()=>dve,shadow:()=>bye,version:()=>Twe});const ffe=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type),yfe=[1,0,0,1,0,0],vfe=[.001,0,0,.001,0,0],bfe=1.35,wfe=1,xfe=2,kfe=4,Afe=16,Sfe=32,Efe=64,_fe=128,Cfe=256,Tfe={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},Pfe={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},Ofe={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35},Mfe={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},Dfe=0,Ife=1,Nfe=2,jfe=3,zfe=3,Rfe=4,Lfe={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Ffe=1,Bfe=2,Hfe=3,qfe=4,Ufe=5,Vfe=6,Wfe=7,$fe=8,Gfe=9,Kfe=10,Zfe=11,Yfe=12,Xfe=13,Qfe=14,Jfe=15,eye=16,tye=17,aye=20,nye=1,iye=2,rye=3,oye=4,sye=5,lye={ERRORS:0,WARNINGS:1,INFOS:5},cye={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93},uye={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let dye=lye.WARNINGS;function hye(e){Number.isInteger(e)&&(dye=e)}function mye(){return dye}function pye(e){dye>=lye.INFOS&&console.log(`Info: ${e}`)}function gye(e){dye>=lye.WARNINGS&&console.log(`Warning: ${e}`)}function fye(e){throw new Error(e)}function yye(e,t){e||fye(t)}function vye(e,t=null,a=null){if(!e)return null;try{if(a&&"string"==typeof e){if(a.addDefaultProtocol&&e.startsWith("www.")){const t=e.match(/\./g);t?.length>=2&&(e=`http://${e}`)}if(a.tryConvertEncoding)try{e=function(e){return decodeURIComponent(escape(e))}(e)}catch{}}const n=t?new URL(e,t):new URL(e);if(function(e){switch(e?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(n))return n}catch{}return null}function bye(e,t,a,n=!1){return Object.defineProperty(e,t,{value:a,enumerable:!n,configurable:!0,writable:!1}),a}const wye=function(){function e(e,t){this.message=e,this.name=t}return e.prototype=new Error,e.constructor=e,e}();class xye extends wye{constructor(e,t){super(e,"PasswordException"),this.code=t}}class kye extends wye{constructor(e,t){super(e,"UnknownErrorException"),this.details=t}}class Aye extends wye{constructor(e){super(e,"InvalidPDFException")}}class Sye extends wye{constructor(e){super(e,"MissingPDFException")}}class Eye extends wye{constructor(e,t){super(e,"UnexpectedResponseException"),this.status=t}}class _ye extends wye{constructor(e){super(e,"FormatError")}}class Cye extends wye{constructor(e){super(e,"AbortException")}}function Tye(e){"object"==typeof e&&void 0!==e?.length||fye("Invalid argument for bytesToString");const t=e.length,a=8192;if(t<a)return String.fromCharCode.apply(null,e);const n=[];for(let i=0;i<t;i+=a){const r=Math.min(i+a,t),o=e.subarray(i,r);n.push(String.fromCharCode.apply(null,o))}return n.join("")}function Pye(e){"string"!=typeof e&&fye("Invalid argument for stringToBytes");const t=e.length,a=new Uint8Array(t);for(let n=0;n<t;++n)a[n]=255&e.charCodeAt(n);return a}function Oye(e){const t=Object.create(null);for(const[a,n]of e)t[a]=n;return t}class Mye{static get isLittleEndian(){return bye(this,"isLittleEndian",function(){const e=new Uint8Array(4);return e[0]=1,1===new Uint32Array(e.buffer,0,1)[0]}())}static get isEvalSupported(){return bye(this,"isEvalSupported",function(){try{return new Function(""),!0}catch{return!1}}())}static get isOffscreenCanvasSupported(){return bye(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get platform(){return"undefined"!=typeof navigator&&"string"==typeof navigator?.platform?bye(this,"platform",{isMac:navigator.platform.includes("Mac"),isWindows:navigator.platform.includes("Win"),isFirefox:"string"==typeof navigator?.userAgent&&navigator.userAgent.includes("Firefox")}):bye(this,"platform",{isMac:!1,isWindows:!1,isFirefox:!1})}static get isCSSRoundSupported(){return bye(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}const Dye=Array.from(Array(256).keys(),(e=>e.toString(16).padStart(2,"0")));class Iye{static makeHexColor(e,t,a){return`#${Dye[e]}${Dye[t]}${Dye[a]}`}static scaleMinMax(e,t){let a;e[0]?(e[0]<0&&(a=t[0],t[0]=t[2],t[2]=a),t[0]*=e[0],t[2]*=e[0],e[3]<0&&(a=t[1],t[1]=t[3],t[3]=a),t[1]*=e[3],t[3]*=e[3]):(a=t[0],t[0]=t[1],t[1]=a,a=t[2],t[2]=t[3],t[3]=a,e[1]<0&&(a=t[1],t[1]=t[3],t[3]=a),t[1]*=e[1],t[3]*=e[1],e[2]<0&&(a=t[0],t[0]=t[2],t[2]=a),t[0]*=e[2],t[2]*=e[2]),t[0]+=e[4],t[1]+=e[5],t[2]+=e[4],t[3]+=e[5]}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static applyTransform(e,t){return[e[0]*t[0]+e[1]*t[2]+t[4],e[0]*t[1]+e[1]*t[3]+t[5]]}static applyInverseTransform(e,t){const a=t[0]*t[3]-t[1]*t[2];return[(e[0]*t[3]-e[1]*t[2]+t[2]*t[5]-t[4]*t[3])/a,(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/a]}static getAxialAlignedBoundingBox(e,t){const a=this.applyTransform(e,t),n=this.applyTransform(e.slice(2,4),t),i=this.applyTransform([e[0],e[3]],t),r=this.applyTransform([e[2],e[1]],t);return[Math.min(a[0],n[0],i[0],r[0]),Math.min(a[1],n[1],i[1],r[1]),Math.max(a[0],n[0],i[0],r[0]),Math.max(a[1],n[1],i[1],r[1])]}static inverseTransform(e){const t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e){const t=[e[0],e[2],e[1],e[3]],a=e[0]*t[0]+e[1]*t[2],n=e[0]*t[1]+e[1]*t[3],i=e[2]*t[0]+e[3]*t[2],r=e[2]*t[1]+e[3]*t[3],o=(a+r)/2,s=Math.sqrt((a+r)**2-4*(a*r-i*n))/2,l=o+s||1,c=o-s||1;return[Math.sqrt(l),Math.sqrt(c)]}static normalizeRect(e){const t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){const a=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),n=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(a>n)return null;const i=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),r=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return i>r?null:[a,i,n,r]}static#e(e,t,a,n,i,r,o,s,l,c){if(l<=0||l>=1)return;const u=1-l,d=l*l,h=d*l,m=u*(u*(u*e+3*l*t)+3*d*a)+h*n,p=u*(u*(u*i+3*l*r)+3*d*o)+h*s;c[0]=Math.min(c[0],m),c[1]=Math.min(c[1],p),c[2]=Math.max(c[2],m),c[3]=Math.max(c[3],p)}static#t(e,t,a,n,i,r,o,s,l,c,u,d){if(Math.abs(l)<1e-12)return void(Math.abs(c)>=1e-12&&this.#e(e,t,a,n,i,r,o,s,-u/c,d));const h=c**2-4*u*l;if(h<0)return;const m=Math.sqrt(h),p=2*l;this.#e(e,t,a,n,i,r,o,s,(-c+m)/p,d),this.#e(e,t,a,n,i,r,o,s,(-c-m)/p,d)}static bezierBoundingBox(e,t,a,n,i,r,o,s,l){return l?(l[0]=Math.min(l[0],e,o),l[1]=Math.min(l[1],t,s),l[2]=Math.max(l[2],e,o),l[3]=Math.max(l[3],t,s)):l=[Math.min(e,o),Math.min(t,s),Math.max(e,o),Math.max(t,s)],this.#t(e,a,i,o,t,n,r,s,3*(3*(a-i)-e+o),6*(e-2*a+i),3*(a-e),l),this.#t(e,a,i,o,t,n,r,s,3*(3*(n-r)-t+s),6*(t-2*n+r),3*(n-t),l),l}}let Nye=null,jye=null;function zye(e){return Nye||(Nye=/([\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,jye=new Map([["ſt","ſt"]])),e.replaceAll(Nye,((e,t,a)=>t?t.normalize("NFKC"):jye.get(a)))}const Rye="pdfjs_internal_id_",Lye=0,Fye=1,Bye=2,Hye=3,qye=4,Uye=5,Vye=6,Wye=7,$ye=8;const Gye="http://www.w3.org/2000/svg";class Kye{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}async function Zye(e,t="text"){if(nve(e,document.baseURI)){const a=await fetch(e);if(!a.ok)throw new Error(a.statusText);switch(t){case"arraybuffer":return a.arrayBuffer();case"blob":return a.blob();case"json":return a.json()}return a.text()}return new Promise(((a,n)=>{const i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType=t,i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE)if(200!==i.status&&0!==i.status)n(new Error(i.statusText));else{switch(t){case"arraybuffer":case"blob":case"json":return void a(i.response)}a(i.responseText)}},i.send(null)}))}class Yye{constructor({viewBox:e,scale:t,rotation:a,offsetX:n=0,offsetY:i=0,dontFlip:r=!1}){this.viewBox=e,this.scale=t,this.rotation=a,this.offsetX=n,this.offsetY=i;const o=(e[2]+e[0])/2,s=(e[3]+e[1])/2;let l,c,u,d,h,m,p,g;switch((a%=360)<0&&(a+=360),a){case 180:l=-1,c=0,u=0,d=1;break;case 90:l=0,c=1,u=1,d=0;break;case 270:l=0,c=-1,u=-1,d=0;break;case 0:l=1,c=0,u=0,d=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}r&&(u=-u,d=-d),0===l?(h=Math.abs(s-e[1])*t+n,m=Math.abs(o-e[0])*t+i,p=(e[3]-e[1])*t,g=(e[2]-e[0])*t):(h=Math.abs(o-e[0])*t+n,m=Math.abs(s-e[1])*t+i,p=(e[2]-e[0])*t,g=(e[3]-e[1])*t),this.transform=[l*t,c*t,u*t,d*t,h-l*t*o-u*t*s,m-c*t*o-d*t*s],this.width=p,this.height=g}get rawDims(){const{viewBox:e}=this;return bye(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:e=this.scale,rotation:t=this.rotation,offsetX:a=this.offsetX,offsetY:n=this.offsetY,dontFlip:i=!1}={}){return new Yye({viewBox:this.viewBox.slice(),scale:e,rotation:t,offsetX:a,offsetY:n,dontFlip:i})}convertToViewportPoint(e,t){return Iye.applyTransform([e,t],this.transform)}convertToViewportRectangle(e){const t=Iye.applyTransform([e[0],e[1]],this.transform),a=Iye.applyTransform([e[2],e[3]],this.transform);return[t[0],t[1],a[0],a[1]]}convertToPdfPoint(e,t){return Iye.applyInverseTransform([e,t],this.transform)}}class Xye extends wye{constructor(e,t=0){super(e,"RenderingCancelledException"),this.extraDelay=t}}function Qye(e){const t=e.length;let a=0;for(;a<t&&""===e[a].trim();)a++;return"data:"===e.substring(a,a+5).toLowerCase()}function Jye(e){return"string"==typeof e&&/\.pdf$/i.test(e)}function eve(e){return[e]=e.split(/[#?]/,1),e.substring(e.lastIndexOf("/")+1)}function tve(e,t="document.pdf"){if("string"!=typeof e)return t;if(Qye(e))return gye('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;const a=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,n=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(e);let i=a.exec(n[1])||a.exec(n[2])||a.exec(n[3]);if(i&&(i=i[0],i.includes("%")))try{i=a.exec(decodeURIComponent(i))[0]}catch{}return i||t}class ave{started=Object.create(null);times=[];time(e){e in this.started&&gye(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||gye(`Timer has not been started for ${e}`),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e]}toString(){const e=[];let t=0;for(const{name:e}of this.times)t=Math.max(e.length,t);for(const{name:a,start:n,end:i}of this.times)e.push(`${a.padEnd(t)} ${i-n}ms\n`);return e.join("")}}function nve(e,t){try{const{protocol:a}=t?new URL(e,t):new URL(e);return"http:"===a||"https:"===a}catch{return!1}}function ive(e){e.preventDefault()}function rve(e){console.log("Deprecated API usage: "+e)}class ove{static#a;static toDateObject(e){if(!e||"string"!=typeof e)return null;this.#a||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");const t=this.#a.exec(e);if(!t)return null;const a=parseInt(t[1],10);let n=parseInt(t[2],10);n=n>=1&&n<=12?n-1:0;let i=parseInt(t[3],10);i=i>=1&&i<=31?i:1;let r=parseInt(t[4],10);r=r>=0&&r<=23?r:0;let o=parseInt(t[5],10);o=o>=0&&o<=59?o:0;let s=parseInt(t[6],10);s=s>=0&&s<=59?s:0;const l=t[7]||"Z";let c=parseInt(t[8],10);c=c>=0&&c<=23?c:0;let u=parseInt(t[9],10)||0;return u=u>=0&&u<=59?u:0,"-"===l?(r+=c,o+=u):"+"===l&&(r-=c,o-=u),new Date(Date.UTC(a,n,i,r,o,s))}}function sve(e,{scale:t=1,rotation:a=0}){const{width:n,height:i}=e.attributes.style,r=[0,0,parseInt(n),parseInt(i)];return new Yye({viewBox:r,scale:t,rotation:a})}function lve(e){if(e.startsWith("#")){const t=parseInt(e.slice(1),16);return[(16711680&t)>>16,(65280&t)>>8,255&t]}return e.startsWith("rgb(")?e.slice(4,-1).split(",").map((e=>parseInt(e))):e.startsWith("rgba(")?e.slice(5,-1).split(",").map((e=>parseInt(e))).slice(0,3):(gye(`Not a valid color format: "${e}"`),[0,0,0])}function cve(e){const{a:t,b:a,c:n,d:i,e:r,f:o}=e.getTransform();return[t,a,n,i,r,o]}function uve(e){const{a:t,b:a,c:n,d:i,e:r,f:o}=e.getTransform().invertSelf();return[t,a,n,i,r,o]}function dve(e,t,a=!1,n=!0){if(t instanceof Yye){const{pageWidth:n,pageHeight:i}=t.rawDims,{style:r}=e,o=Mye.isCSSRoundSupported,s=`var(--scale-factor) * ${n}px`,l=`var(--scale-factor) * ${i}px`,c=o?`round(down, ${s}, var(--scale-round-x, 1px))`:`calc(${s})`,u=o?`round(down, ${l}, var(--scale-round-y, 1px))`:`calc(${l})`;a&&t.rotation%180!=0?(r.width=u,r.height=c):(r.width=c,r.height=u)}n&&e.setAttribute("data-main-rotation",t.rotation)}class hve{constructor(){const e=window.devicePixelRatio||1;this.sx=e,this.sy=e}get scaled(){return 1!==this.sx||1!==this.sy}get symmetric(){return this.sx===this.sy}}class mve{#n=null;#i=null;#r;#o=null;#s=null;static#l=null;constructor(e){this.#r=e,mve.#l||=Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button"})}render(){const e=this.#n=document.createElement("div");e.classList.add("editToolbar","hidden"),e.setAttribute("role","toolbar");const t=this.#r._uiManager._signal;e.addEventListener("contextmenu",ive,{signal:t}),e.addEventListener("pointerdown",mve.#c,{signal:t});const a=this.#o=document.createElement("div");a.className="buttons",e.append(a);const n=this.#r.toolbarPosition;if(n){const{style:t}=e,a="ltr"===this.#r._uiManager.direction?1-n[0]:n[0];t.insetInlineEnd=100*a+"%",t.top=`calc(${100*n[1]}% + var(--editor-toolbar-vert-offset))`}return this.#u(),e}get div(){return this.#n}static#c(e){e.stopPropagation()}#d(e){this.#r._focusEventsAllowed=!1,e.preventDefault(),e.stopPropagation()}#h(e){this.#r._focusEventsAllowed=!0,e.preventDefault(),e.stopPropagation()}#m(e){const t=this.#r._uiManager._signal;e.addEventListener("focusin",this.#d.bind(this),{capture:!0,signal:t}),e.addEventListener("focusout",this.#h.bind(this),{capture:!0,signal:t}),e.addEventListener("contextmenu",ive,{signal:t})}hide(){this.#n.classList.add("hidden"),this.#i?.hideDropdown()}show(){this.#n.classList.remove("hidden"),this.#s?.shown()}#u(){const{editorType:e,_uiManager:t}=this.#r,a=document.createElement("button");a.className="delete",a.tabIndex=0,a.setAttribute("data-l10n-id",mve.#l[e]),this.#m(a),a.addEventListener("click",(e=>{t.delete()}),{signal:t._signal}),this.#o.append(a)}get#p(){const e=document.createElement("div");return e.className="divider",e}async addAltText(e){const t=await e.render();this.#m(t),this.#o.prepend(t,this.#p),this.#s=e}addColorPicker(e){this.#i=e;const t=e.renderButton();this.#m(t),this.#o.prepend(t,this.#p)}remove(){this.#n.remove(),this.#i?.destroy(),this.#i=null}}class pve{#o=null;#n=null;#g;constructor(e){this.#g=e}#f(){const e=this.#n=document.createElement("div");e.className="editToolbar",e.setAttribute("role","toolbar"),e.addEventListener("contextmenu",ive,{signal:this.#g._signal});const t=this.#o=document.createElement("div");return t.className="buttons",e.append(t),this.#y(),e}#v(e,t){let a=0,n=0;for(const i of e){const e=i.y+i.height;if(e<a)continue;const r=i.x+(t?i.width:0);e>a?(n=r,a=e):t?r>n&&(n=r):r<n&&(n=r)}return[t?1-n:n,a]}show(e,t,a){const[n,i]=this.#v(t,a),{style:r}=this.#n||=this.#f();e.append(this.#n),r.insetInlineEnd=100*n+"%",r.top=`calc(${100*i}% + var(--editor-toolbar-vert-offset))`}hide(){this.#n.remove()}#y(){const e=document.createElement("button");e.className="highlightButton",e.tabIndex=0,e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const t=document.createElement("span");e.append(t),t.className="visuallyHidden",t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const a=this.#g._signal;e.addEventListener("contextmenu",ive,{signal:a}),e.addEventListener("click",(()=>{this.#g.highlightSelection("floating_button")}),{signal:a}),this.#o.append(e)}}function gve(e,t,a){for(const n of a)t.addEventListener(n,e[n].bind(e))}class fve{#b=0;get id(){return"pdfjs_internal_editor_"+this.#b++}}class yve{#w=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto?.randomUUID)return crypto.randomUUID();const e=new Uint8Array(32);if("undefined"!=typeof crypto&&"function"==typeof crypto?.getRandomValues)crypto.getRandomValues(e);else for(let t=0;t<32;t++)e[t]=Math.floor(255*Math.random());return Tye(e)}();#b=0;#x=null;static get _isSVGFittingCanvas(){const e=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),t=new Image;t.src='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>';return bye(this,"_isSVGFittingCanvas",t.decode().then((()=>(e.drawImage(t,0,0,1,1,0,0,1,3),0===new Uint32Array(e.getImageData(0,0,1,1).data.buffer)[0]))))}async#k(e,t){this.#x||=new Map;let a=this.#x.get(e);if(null===a)return null;if(a?.bitmap)return a.refCounter+=1,a;try{let e;if(a||={bitmap:null,id:`image_${this.#w}_${this.#b++}`,refCounter:0,isSvg:!1},"string"==typeof t?(a.url=t,e=await Zye(t,"blob")):t instanceof File?e=a.file=t:t instanceof Blob&&(e=t),"image/svg+xml"===e.type){const t=yve._isSVGFittingCanvas,n=new FileReader,i=new Image,r=new Promise(((e,r)=>{i.onload=()=>{a.bitmap=i,a.isSvg=!0,e()},n.onload=async()=>{const e=a.svgUrl=n.result;i.src=await t?`${e}#svgView(preserveAspectRatio(none))`:e},i.onerror=n.onerror=r}));n.readAsDataURL(e),await r}else a.bitmap=await createImageBitmap(e);a.refCounter=1}catch(e){console.error(e),a=null}return this.#x.set(e,a),a&&this.#x.set(a.id,a),a}async getFromFile(e){const{lastModified:t,name:a,size:n,type:i}=e;return this.#k(`${t}_${a}_${n}_${i}`,e)}async getFromUrl(e){return this.#k(e,e)}async getFromBlob(e,t){const a=await t;return this.#k(e,a)}async getFromId(e){this.#x||=new Map;const t=this.#x.get(e);if(!t)return null;if(t.bitmap)return t.refCounter+=1,t;if(t.file)return this.getFromFile(t.file);if(t.blobPromise){const{blobPromise:e}=t;return delete t.blobPromise,this.getFromBlob(t.id,e)}return this.getFromUrl(t.url)}getFromCanvas(e,t){this.#x||=new Map;let a=this.#x.get(e);if(a?.bitmap)return a.refCounter+=1,a;const n=new OffscreenCanvas(t.width,t.height);return n.getContext("2d").drawImage(t,0,0),a={bitmap:n.transferToImageBitmap(),id:`image_${this.#w}_${this.#b++}`,refCounter:1,isSvg:!1},this.#x.set(e,a),this.#x.set(a.id,a),a}getSvgUrl(e){const t=this.#x.get(e);return t?.isSvg?t.svgUrl:null}deleteId(e){this.#x||=new Map;const t=this.#x.get(e);if(!t)return;if(t.refCounter-=1,0!==t.refCounter)return;const{bitmap:a}=t;if(!t.url&&!t.file){const e=new OffscreenCanvas(a.width,a.height);e.getContext("bitmaprenderer").transferFromImageBitmap(a),t.blobPromise=e.convertToBlob()}a.close?.(),t.bitmap=null}isValidId(e){return e.startsWith(`image_${this.#w}_`)}}class vve{#A=[];#S=!1;#E;#_=-1;constructor(e=128){this.#E=e}add({cmd:e,undo:t,post:a,mustExec:n,type:i=NaN,overwriteIfSameType:r=!1,keepUndo:o=!1}){if(n&&e(),this.#S)return;const s={cmd:e,undo:t,post:a,type:i};if(-1===this.#_)return this.#A.length>0&&(this.#A.length=0),this.#_=0,void this.#A.push(s);if(r&&this.#A[this.#_].type===i)return o&&(s.undo=this.#A[this.#_].undo),void(this.#A[this.#_]=s);const l=this.#_+1;l===this.#E?this.#A.splice(0,1):(this.#_=l,l<this.#A.length&&this.#A.splice(l)),this.#A.push(s)}undo(){if(-1===this.#_)return;this.#S=!0;const{undo:e,post:t}=this.#A[this.#_];e(),t?.(),this.#S=!1,this.#_-=1}redo(){if(this.#_<this.#A.length-1){this.#_+=1,this.#S=!0;const{cmd:e,post:t}=this.#A[this.#_];e(),t?.(),this.#S=!1}}hasSomethingToUndo(){return-1!==this.#_}hasSomethingToRedo(){return this.#_<this.#A.length-1}destroy(){this.#A=null}}class bve{constructor(e){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:t}=Mye.platform;for(const[a,n,i={}]of e)for(const e of a){const a=e.startsWith("mac+");t&&a?(this.callbacks.set(e.slice(4),{callback:n,options:i}),this.allKeys.add(e.split("+").at(-1))):t||a||(this.callbacks.set(e,{callback:n,options:i}),this.allKeys.add(e.split("+").at(-1)))}}#C(e){e.altKey&&this.buffer.push("alt"),e.ctrlKey&&this.buffer.push("ctrl"),e.metaKey&&this.buffer.push("meta"),e.shiftKey&&this.buffer.push("shift"),this.buffer.push(e.key);const t=this.buffer.join("+");return this.buffer.length=0,t}exec(e,t){if(!this.allKeys.has(t.key))return;const a=this.callbacks.get(this.#C(t));if(!a)return;const{callback:n,options:{bubbles:i=!1,args:r=[],checker:o=null}}=a;o&&!o(e,t)||(n.bind(e,...r,t)(),i||(t.stopPropagation(),t.preventDefault()))}}class wve{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);return function(e){const t=document.createElement("span");t.style.visibility="hidden",document.body.append(t);for(const a of e.keys()){t.style.color=a;const n=window.getComputedStyle(t).color;e.set(a,lve(n))}t.remove()}(e),bye(this,"_colors",e)}convert(e){const t=lve(e);if(!window.matchMedia("(forced-colors: active)").matches)return t;for(const[e,a]of this._colors)if(a.every(((e,a)=>e===t[a])))return wve._colorsMapping.get(e);return t}getHexCode(e){const t=this._colors.get(e);return t?Iye.makeHexColor(...t):e}}class xve{#T=new AbortController;#P=null;#O=new Map;#M=new Map;#D=null;#I=null;#N=null;#j=new vve;#z=null;#R=0;#L=new Set;#F=null;#B=null;#H=new Set;#q=!1;#U=!1;#V=!1;#W=null;#$=null;#G=null;#K=null;#Z=!1;#Y=null;#X=new fve;#Q=!1;#J=!1;#ee=null;#te=null;#ae=null;#ne=null;#ie=Pfe.NONE;#re=new Set;#oe=null;#se=null;#le=null;#ce={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#ue=[0,0];#de=null;#he=null;#me=null;#pe=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){const e=xve.prototype,t=e=>e.#he.contains(document.activeElement)&&"BUTTON"!==document.activeElement.tagName&&e.hasSomethingToControl(),a=(e,{target:t})=>{if(t instanceof HTMLInputElement){const{type:e}=t;return"text"!==e&&"number"!==e}return!0},n=this.TRANSLATE_SMALL,i=this.TRANSLATE_BIG;return bye(this,"_keyboardManager",new bve([[["ctrl+a","mac+meta+a"],e.selectAll,{checker:a}],[["ctrl+z","mac+meta+z"],e.undo,{checker:a}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo,{checker:a}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],e.delete,{checker:a}],[["Enter","mac+Enter"],e.addNewEditorFromKeyboard,{checker:(e,{target:t})=>!(t instanceof HTMLButtonElement)&&e.#he.contains(t)&&!e.isEnterHandled}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(e,{target:t})=>!(t instanceof HTMLButtonElement)&&e.#he.contains(document.activeElement)}],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-n,0],checker:t}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-i,0],checker:t}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[n,0],checker:t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[i,0],checker:t}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-n],checker:t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-i],checker:t}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,n],checker:t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,i],checker:t}]]))}constructor(e,t,a,n,i,r,o,s,l,c,u){const d=this._signal=this.#T.signal;this.#he=e,this.#me=t,this.#D=a,this._eventBus=n,n._on("editingaction",this.onEditingAction.bind(this),{signal:d}),n._on("pagechanging",this.onPageChanging.bind(this),{signal:d}),n._on("scalechanging",this.onScaleChanging.bind(this),{signal:d}),n._on("rotationchanging",this.onRotationChanging.bind(this),{signal:d}),n._on("setpreference",this.onSetPreference.bind(this),{signal:d}),n._on("switchannotationeditorparams",(e=>this.updateParams(e.type,e.value)),{signal:d}),this.#ge(),this.#fe(),this.#ye(),this.#I=i.annotationStorage,this.#W=i.filterFactory,this.#se=r,this.#K=o||null,this.#q=s,this.#U=l,this.#V=c,this.#ne=u||null,this.viewParameters={realScale:Kye.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}destroy(){this.#pe?.resolve(),this.#pe=null,this.#T?.abort(),this.#T=null,this._signal=null;for(const e of this.#M.values())e.destroy();this.#M.clear(),this.#O.clear(),this.#H.clear(),this.#P=null,this.#re.clear(),this.#j.destroy(),this.#D?.destroy(),this.#Y?.hide(),this.#Y=null,this.#$&&(clearTimeout(this.#$),this.#$=null),this.#de&&(clearTimeout(this.#de),this.#de=null)}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return this.#ne}get useNewAltTextFlow(){return this.#U}get useNewAltTextWhenAddingImage(){return this.#V}get hcmFilter(){return bye(this,"hcmFilter",this.#se?this.#W.addHCMFilter(this.#se.foreground,this.#se.background):"none")}get direction(){return bye(this,"direction",getComputedStyle(this.#he).direction)}get highlightColors(){return bye(this,"highlightColors",this.#K?new Map(this.#K.split(",").map((e=>e.split("=").map((e=>e.trim()))))):null)}get highlightColorNames(){return bye(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,(e=>e.reverse()))):null)}setMainHighlightColorPicker(e){this.#ae=e}editAltText(e,t=!1){this.#D?.editAltText(this,e,t)}switchToMode(e,t){this._eventBus.on("annotationeditormodechanged",t,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:e})}setPreference(e,t){this._eventBus.dispatch("setpreference",{source:this,name:e,value:t})}onSetPreference({name:e,value:t}){if("enableNewAltTextWhenAddingImage"===e)this.#V=t}onPageChanging({pageNumber:e}){this.#R=e-1}focusMainContainer(){this.#he.focus()}findParent(e,t){for(const a of this.#M.values()){const{x:n,y:i,width:r,height:o}=a.div.getBoundingClientRect();if(e>=n&&e<=n+r&&t>=i&&t<=i+o)return a}return null}disableUserSelect(e=!1){this.#me.classList.toggle("noUserSelect",e)}addShouldRescale(e){this.#H.add(e)}removeShouldRescale(e){this.#H.delete(e)}onScaleChanging({scale:e}){this.commitOrRemove(),this.viewParameters.realScale=e*Kye.PDF_TO_CSS_UNITS;for(const e of this.#H)e.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}#ve({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e}#be(e){const{currentLayer:t}=this;if(t.hasTextLayer(e))return t;for(const t of this.#M.values())if(t.hasTextLayer(e))return t;return null}highlightSelection(e=""){const t=document.getSelection();if(!t||t.isCollapsed)return;const{anchorNode:a,anchorOffset:n,focusNode:i,focusOffset:r}=t,o=t.toString(),s=this.#ve(t).closest(".textLayer"),l=this.getSelectionBoxes(s);if(!l)return;t.empty();const c=this.#be(s),u=this.#ie===Pfe.NONE,d=()=>{c?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:l,anchorNode:a,anchorOffset:n,focusNode:i,focusOffset:r,text:o}),u&&this.showAllEditors("highlight",!0,!0)};u?this.switchToMode(Pfe.HIGHLIGHT,d):d()}#we(){const e=document.getSelection();if(!e||e.isCollapsed)return;const t=this.#ve(e).closest(".textLayer"),a=this.getSelectionBoxes(t);a&&(this.#Y||=new pve(this),this.#Y.show(t,a,"ltr"===this.direction))}addToAnnotationStorage(e){e.isEmpty()||!this.#I||this.#I.has(e.id)||this.#I.setValue(e.id,e)}#xe(){const e=document.getSelection();if(!e||e.isCollapsed)return void(this.#oe&&(this.#Y?.hide(),this.#oe=null,this.#ke({hasSelectedText:!1})));const{anchorNode:t}=e;if(t===this.#oe)return;const a=this.#ve(e).closest(".textLayer");if(a){if(this.#Y?.hide(),this.#oe=t,this.#ke({hasSelectedText:!0}),(this.#ie===Pfe.HIGHLIGHT||this.#ie===Pfe.NONE)&&(this.#ie===Pfe.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#Z=this.isShiftKeyDown,!this.isShiftKeyDown)){const e=this.#ie===Pfe.HIGHLIGHT?this.#be(a):null;e?.toggleDrawing();const t=new AbortController,n=this.combinedSignal(t),i=a=>{"pointerup"===a.type&&0!==a.button||(t.abort(),e?.toggleDrawing(!0),"pointerup"===a.type&&this.#Ae("main_toolbar"))};window.addEventListener("pointerup",i,{signal:n}),window.addEventListener("blur",i,{signal:n})}}else this.#oe&&(this.#Y?.hide(),this.#oe=null,this.#ke({hasSelectedText:!1}))}#Ae(e=""){this.#ie===Pfe.HIGHLIGHT?this.highlightSelection(e):this.#q&&this.#we()}#ge(){document.addEventListener("selectionchange",this.#xe.bind(this),{signal:this._signal})}#Se(){if(this.#G)return;this.#G=new AbortController;const e=this.combinedSignal(this.#G);window.addEventListener("focus",this.focus.bind(this),{signal:e}),window.addEventListener("blur",this.blur.bind(this),{signal:e})}#Ee(){this.#G?.abort(),this.#G=null}blur(){if(this.isShiftKeyDown=!1,this.#Z&&(this.#Z=!1,this.#Ae("main_toolbar")),!this.hasSelection)return;const{activeElement:e}=document;for(const t of this.#re)if(t.div.contains(e)){this.#te=[t,e],t._focusEventsAllowed=!1;break}}focus(){if(!this.#te)return;const[e,t]=this.#te;this.#te=null,t.addEventListener("focusin",(()=>{e._focusEventsAllowed=!0}),{once:!0,signal:this._signal}),t.focus()}#ye(){if(this.#ee)return;this.#ee=new AbortController;const e=this.combinedSignal(this.#ee);window.addEventListener("keydown",this.keydown.bind(this),{signal:e}),window.addEventListener("keyup",this.keyup.bind(this),{signal:e})}#_e(){this.#ee?.abort(),this.#ee=null}#Ce(){if(this.#z)return;this.#z=new AbortController;const e=this.combinedSignal(this.#z);document.addEventListener("copy",this.copy.bind(this),{signal:e}),document.addEventListener("cut",this.cut.bind(this),{signal:e}),document.addEventListener("paste",this.paste.bind(this),{signal:e})}#Te(){this.#z?.abort(),this.#z=null}#fe(){const e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e}),document.addEventListener("drop",this.drop.bind(this),{signal:e})}addEditListeners(){this.#ye(),this.#Ce()}removeEditListeners(){this.#_e(),this.#Te()}dragOver(e){for(const{type:t}of e.dataTransfer.items)for(const a of this.#B)if(a.isHandlingMimeForPasting(t))return e.dataTransfer.dropEffect="copy",void e.preventDefault()}drop(e){for(const t of e.dataTransfer.items)for(const a of this.#B)if(a.isHandlingMimeForPasting(t.type))return a.paste(t,this.currentLayer),void e.preventDefault()}copy(e){if(e.preventDefault(),this.#P?.commitOrRemove(),!this.hasSelection)return;const t=[];for(const e of this.#re){const a=e.serialize(!0);a&&t.push(a)}0!==t.length&&e.clipboardData.setData("application/pdfjs",JSON.stringify(t))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();const{clipboardData:t}=e;for(const e of t.items)for(const t of this.#B)if(t.isHandlingMimeForPasting(e.type))return void t.paste(e,this.currentLayer);let a=t.getData("application/pdfjs");if(!a)return;try{a=JSON.parse(a)}catch(e){return void gye(`paste: "${e.message}".`)}if(!Array.isArray(a))return;this.unselectAll();const n=this.currentLayer;try{const e=[];for(const t of a){const a=await n.deserialize(t);if(!a)return;e.push(a)}const t=()=>{for(const t of e)this.#Pe(t);this.#Oe(e)},i=()=>{for(const t of e)t.remove()};this.addCommands({cmd:t,undo:i,mustExec:!0})}catch(e){gye(`paste: "${e.message}".`)}}keydown(e){this.isShiftKeyDown||"Shift"!==e.key||(this.isShiftKeyDown=!0),this.#ie===Pfe.NONE||this.isEditorHandlingKeyboard||xve._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&"Shift"===e.key&&(this.isShiftKeyDown=!1,this.#Z&&(this.#Z=!1,this.#Ae("main_toolbar")))}onEditingAction({name:e}){switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu")}}#ke(e){const t=Object.entries(e).some((([e,t])=>this.#ce[e]!==t));t&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#ce,e)}),this.#ie===Pfe.HIGHLIGHT&&!1===e.hasSelectedEditor&&this.#Me([[Ofe.HIGHLIGHT_FREE,!0]]))}#Me(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})}setEditingState(e){e?(this.#Se(),this.#Ce(),this.#ke({isEditing:this.#ie!==Pfe.NONE,isEmpty:this.#De(),hasSomethingToUndo:this.#j.hasSomethingToUndo(),hasSomethingToRedo:this.#j.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#Ee(),this.#Te(),this.#ke({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!this.#B){this.#B=e;for(const e of this.#B)this.#Me(e.defaultPropertiesToUpdate)}}getId(){return this.#X.id}get currentLayer(){return this.#M.get(this.#R)}getLayer(e){return this.#M.get(e)}get currentPageIndex(){return this.#R}addLayer(e){this.#M.set(e.pageIndex,e),this.#Q?e.enable():e.disable()}removeLayer(e){this.#M.delete(e.pageIndex)}async updateMode(e,t=null,a=!1){if(this.#ie!==e&&(!this.#pe||(await this.#pe.promise,this.#pe))){if(this.#pe=Promise.withResolvers(),this.#ie=e,e===Pfe.NONE)return this.setEditingState(!1),this.#Ie(),void this.#pe.resolve();this.setEditingState(!0),await this.#Ne(),this.unselectAll();for(const t of this.#M.values())t.updateMode(e);if(!t)return a&&this.addNewEditorFromKeyboard(),void this.#pe.resolve();for(const e of this.#O.values())e.annotationElementId===t?(this.setSelected(e),e.enterInEditMode()):e.unselect();this.#pe.resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e!==this.#ie&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:e})}updateParams(e,t){if(this.#B){switch(e){case Ofe.CREATE:return void this.currentLayer.addNewEditor();case Ofe.HIGHLIGHT_DEFAULT_COLOR:this.#ae?.updateColor(t);break;case Ofe.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#le||=new Map).set(e,t),this.showAllEditors("highlight",t)}for(const a of this.#re)a.updateParams(e,t);for(const a of this.#B)a.updateDefaultParams(e,t)}}showAllEditors(e,t,a=!1){for(const a of this.#O.values())a.editorType===e&&a.show(t);(this.#le?.get(Ofe.HIGHLIGHT_SHOW_ALL)??!0)!==t&&this.#Me([[Ofe.HIGHLIGHT_SHOW_ALL,t]])}enableWaiting(e=!1){if(this.#J!==e){this.#J=e;for(const t of this.#M.values())e?t.disableClick():t.enableClick(),t.div.classList.toggle("waiting",e)}}async#Ne(){if(!this.#Q){this.#Q=!0;const e=[];for(const t of this.#M.values())e.push(t.enable());await Promise.all(e);for(const e of this.#O.values())e.enable()}}#Ie(){if(this.unselectAll(),this.#Q){this.#Q=!1;for(const e of this.#M.values())e.disable();for(const e of this.#O.values())e.disable()}}getEditors(e){const t=[];for(const a of this.#O.values())a.pageIndex===e&&t.push(a);return t}getEditor(e){return this.#O.get(e)}addEditor(e){this.#O.set(e.id,e)}removeEditor(e){e.div.contains(document.activeElement)&&(this.#$&&clearTimeout(this.#$),this.#$=setTimeout((()=>{this.focusMainContainer(),this.#$=null}),0)),this.#O.delete(e.id),this.unselect(e),e.annotationElementId&&this.#L.has(e.annotationElementId)||this.#I?.remove(e.id)}addDeletedAnnotationElement(e){this.#L.add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return this.#L.has(e)}removeDeletedAnnotationElement(e){this.#L.delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}#Pe(e){const t=this.#M.get(e.pageIndex);t?t.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))}setActiveEditor(e){this.#P!==e&&(this.#P=e,e&&this.#Me(e.propertiesToUpdate))}get#je(){let e=null;for(e of this.#re);return e}updateUI(e){this.#je===e&&this.#Me(e.propertiesToUpdate)}toggleSelected(e){if(this.#re.has(e))return this.#re.delete(e),e.unselect(),void this.#ke({hasSelectedEditor:this.hasSelection});this.#re.add(e),e.select(),this.#Me(e.propertiesToUpdate),this.#ke({hasSelectedEditor:!0})}setSelected(e){for(const t of this.#re)t!==e&&t.unselect();this.#re.clear(),this.#re.add(e),e.select(),this.#Me(e.propertiesToUpdate),this.#ke({hasSelectedEditor:!0})}isSelected(e){return this.#re.has(e)}get firstSelectedEditor(){return this.#re.values().next().value}unselect(e){e.unselect(),this.#re.delete(e),this.#ke({hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==this.#re.size}get isEnterHandled(){return 1===this.#re.size&&this.firstSelectedEditor.isEnterHandled}undo(){this.#j.undo(),this.#ke({hasSomethingToUndo:this.#j.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#De()})}redo(){this.#j.redo(),this.#ke({hasSomethingToUndo:!0,hasSomethingToRedo:this.#j.hasSomethingToRedo(),isEmpty:this.#De()})}addCommands(e){this.#j.add(e),this.#ke({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#De()})}#De(){if(0===this.#O.size)return!0;if(1===this.#O.size)for(const e of this.#O.values())return e.isEmpty();return!1}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const e=[...this.#re];this.addCommands({cmd:()=>{for(const t of e)t.remove()},undo:()=>{for(const t of e)this.#Pe(t)},mustExec:!0})}commitOrRemove(){this.#P?.commitOrRemove()}hasSomethingToControl(){return this.#P||this.hasSelection}#Oe(e){for(const e of this.#re)e.unselect();this.#re.clear();for(const t of e)t.isEmpty()||(this.#re.add(t),t.select());this.#ke({hasSelectedEditor:this.hasSelection})}selectAll(){for(const e of this.#re)e.commit();this.#Oe(this.#O.values())}unselectAll(){if((!this.#P||(this.#P.commitOrRemove(),this.#ie===Pfe.NONE))&&this.hasSelection){for(const e of this.#re)e.unselect();this.#re.clear(),this.#ke({hasSelectedEditor:!1})}}translateSelectedEditors(e,t,a=!1){if(a||this.commitOrRemove(),!this.hasSelection)return;this.#ue[0]+=e,this.#ue[1]+=t;const[n,i]=this.#ue,r=[...this.#re];this.#de&&clearTimeout(this.#de),this.#de=setTimeout((()=>{this.#de=null,this.#ue[0]=this.#ue[1]=0,this.addCommands({cmd:()=>{for(const e of r)this.#O.has(e.id)&&e.translateInPage(n,i)},undo:()=>{for(const e of r)this.#O.has(e.id)&&e.translateInPage(-n,-i)},mustExec:!1})}),1e3);for(const a of r)a.translateInPage(e,t)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#F=new Map;for(const e of this.#re)this.#F.set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#F)return!1;this.disableUserSelect(!1);const e=this.#F;this.#F=null;let t=!1;for(const[{x:a,y:n,pageIndex:i},r]of e)r.newX=a,r.newY=n,r.newPageIndex=i,t||=a!==r.savedX||n!==r.savedY||i!==r.savedPageIndex;if(!t)return!1;const a=(e,t,a,n)=>{if(this.#O.has(e.id)){const i=this.#M.get(n);i?e._setParentAndPosition(i,t,a):(e.pageIndex=n,e.x=t,e.y=a)}};return this.addCommands({cmd:()=>{for(const[t,{newX:n,newY:i,newPageIndex:r}]of e)a(t,n,i,r)},undo:()=>{for(const[t,{savedX:n,savedY:i,savedPageIndex:r}]of e)a(t,n,i,r)},mustExec:!0}),!0}dragSelectedEditors(e,t){if(this.#F)for(const a of this.#F.keys())a.drag(e,t)}rebuild(e){if(null===e.parent){const t=this.getLayer(e.pageIndex);t?(t.changeParent(e),t.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||1===this.#re.size&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return this.#P===e}getActive(){return this.#P}getMode(){return this.#ie}get imageManager(){return bye(this,"imageManager",new yve)}getSelectionBoxes(e){if(!e)return null;const t=document.getSelection();for(let a=0,n=t.rangeCount;a<n;a++)if(!e.contains(t.getRangeAt(a).commonAncestorContainer))return null;const{x:a,y:n,width:i,height:r}=e.getBoundingClientRect();let o;switch(e.getAttribute("data-main-rotation")){case"90":o=(e,t,o,s)=>({x:(t-n)/r,y:1-(e+o-a)/i,width:s/r,height:o/i});break;case"180":o=(e,t,o,s)=>({x:1-(e+o-a)/i,y:1-(t+s-n)/r,width:o/i,height:s/r});break;case"270":o=(e,t,o,s)=>({x:1-(t+s-n)/r,y:(e-a)/i,width:s/r,height:o/i});break;default:o=(e,t,o,s)=>({x:(e-a)/i,y:(t-n)/r,width:o/i,height:s/r})}const s=[];for(let e=0,a=t.rangeCount;e<a;e++){const a=t.getRangeAt(e);if(!a.collapsed)for(const{x:e,y:t,width:n,height:i}of a.getClientRects())0!==n&&0!==i&&s.push(o(e,t,n,i))}return 0===s.length?null:s}addChangedExistingAnnotation({annotationElementId:e,id:t}){(this.#N||=new Map).set(e,t)}removeChangedExistingAnnotation({annotationElementId:e}){this.#N?.delete(e)}renderAnnotationElement(e){const t=this.#N?.get(e.data.id);if(!t)return;const a=this.#I.getRawValue(t);a&&(this.#ie!==Pfe.NONE||a.hasBeenModified)&&a.renderAnnotationElement(e)}}class kve{#s=null;#ze=!1;#Re=null;#Le=null;#Fe=null;#Be=null;#He=!1;#qe=null;#r=null;#Ue=null;#Ve=null;#We=!1;static#$e=null;static _l10n=null;constructor(e){this.#r=e,this.#We=e._uiManager.useNewAltTextFlow,kve.#$e||=Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"})}static initialize(e){kve._l10n??=e}async render(){const e=this.#Re=document.createElement("button");e.className="altText",e.tabIndex="0";const t=this.#Le=document.createElement("span");e.append(t),this.#We?(e.classList.add("new"),e.setAttribute("data-l10n-id",kve.#$e.missing),t.setAttribute("data-l10n-id",kve.#$e["missing-label"])):(e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const a=this.#r._uiManager._signal;e.addEventListener("contextmenu",ive,{signal:a}),e.addEventListener("pointerdown",(e=>e.stopPropagation()),{signal:a});const n=e=>{e.preventDefault(),this.#r._uiManager.editAltText(this.#r),this.#We&&this.#r._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:this.#Ge}})};return e.addEventListener("click",n,{capture:!0,signal:a}),e.addEventListener("keydown",(t=>{t.target===e&&"Enter"===t.key&&(this.#He=!0,n(t))}),{signal:a}),await this.#Ke(),e}get#Ge(){return(this.#s?"added":null===this.#s&&this.guessedText&&"review")||"missing"}finish(){this.#Re&&(this.#Re.focus({focusVisible:this.#He}),this.#He=!1)}isEmpty(){return this.#We?null===this.#s:!this.#s&&!this.#ze}hasData(){return this.#We?null!==this.#s||!!this.#Ue:this.isEmpty()}get guessedText(){return this.#Ue}async setGuessedText(e){null===this.#s&&(this.#Ue=e,this.#Ve=await kve._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:e}),this.#Ke())}toggleAltTextBadge(e=!1){if(!this.#We||this.#s)return this.#qe?.remove(),void(this.#qe=null);if(!this.#qe){const e=this.#qe=document.createElement("div");e.className="noAltTextBadge",this.#r.div.append(e)}this.#qe.classList.toggle("hidden",!e)}serialize(e){let t=this.#s;return e||this.#Ue!==t||(t=this.#Ve),{altText:t,decorative:this.#ze,guessedText:this.#Ue,textWithDisclaimer:this.#Ve}}get data(){return{altText:this.#s,decorative:this.#ze}}set data({altText:e,decorative:t,guessedText:a,textWithDisclaimer:n,cancel:i=!1}){a&&(this.#Ue=a,this.#Ve=n),this.#s===e&&this.#ze===t||(i||(this.#s=e,this.#ze=t),this.#Ke())}toggle(e=!1){this.#Re&&(!e&&this.#Be&&(clearTimeout(this.#Be),this.#Be=null),this.#Re.disabled=!e)}shown(){this.#r._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:this.#Ge}})}destroy(){this.#Re?.remove(),this.#Re=null,this.#Le=null,this.#Fe=null,this.#qe?.remove(),this.#qe=null}async#Ke(){const e=this.#Re;if(!e)return;if(this.#We){if(e.classList.toggle("done",!!this.#s),e.setAttribute("data-l10n-id",kve.#$e[this.#Ge]),this.#Le?.setAttribute("data-l10n-id",kve.#$e[`${this.#Ge}-label`]),!this.#s)return void this.#Fe?.remove()}else{if(!this.#s&&!this.#ze)return e.classList.remove("done"),void this.#Fe?.remove();e.classList.add("done"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let t=this.#Fe;if(!t){this.#Fe=t=document.createElement("span"),t.className="tooltip",t.setAttribute("role","tooltip"),t.id=`alt-text-tooltip-${this.#r.id}`;const a=100,n=this.#r._uiManager._signal;n.addEventListener("abort",(()=>{clearTimeout(this.#Be),this.#Be=null}),{once:!0}),e.addEventListener("mouseenter",(()=>{this.#Be=setTimeout((()=>{this.#Be=null,this.#Fe.classList.add("show"),this.#r._reportTelemetry({action:"alt_text_tooltip"})}),a)}),{signal:n}),e.addEventListener("mouseleave",(()=>{this.#Be&&(clearTimeout(this.#Be),this.#Be=null),this.#Fe?.classList.remove("show")}),{signal:n})}this.#ze?t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(t.removeAttribute("data-l10n-id"),t.textContent=this.#s),t.parentNode||e.append(t);const a=this.#r.getImageForAltText();a?.setAttribute("aria-describedby",t.id)}}class Ave{#Ze=null;#Ye=null;#s=null;#Xe=!1;#Qe=!1;#Je=null;#et=null;#tt=null;#at="";#nt=!1;#it=null;#rt=!1;#ot=!1;#st=!1;#lt=null;#ct=0;#ut=0;#dt=null;_editToolbar=null;_initialOptions=Object.create(null);_initialData=null;_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;static _l10n=null;static _l10nResizer=null;#ht=!1;#mt=Ave._zIndex++;static _borderLineWidth=-1;static _colorManager=new wve;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){const e=Ave.prototype._resizeWithKeyboard,t=xve.TRANSLATE_SMALL,a=xve.TRANSLATE_BIG;return bye(this,"_resizerKeyboardManager",new bve([[["ArrowLeft","mac+ArrowLeft"],e,{args:[-t,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e,{args:[-a,0]}],[["ArrowRight","mac+ArrowRight"],e,{args:[t,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e,{args:[a,0]}],[["ArrowUp","mac+ArrowUp"],e,{args:[0,-t]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e,{args:[0,-a]}],[["ArrowDown","mac+ArrowDown"],e,{args:[0,t]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e,{args:[0,a]}],[["Escape","mac+Escape"],Ave.prototype._stopResizingWithKeyboard]]))}constructor(e){this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null,this._uiManager=e.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=e.isCentered,this._structTreeParentId=null;const{rotation:t,rawDims:{pageWidth:a,pageHeight:n,pageX:i,pageY:r}}=this.parent.viewport;this.rotation=t,this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[a,n],this.pageTranslation=[i,r];const[o,s]=this.parentDimensions;this.x=e.x/o,this.y=e.y/s,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return bye(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){const t=new Sve({id:e.parent.getNextId(),parent:e.parent,uiManager:e._uiManager});t.annotationElementId=e.annotationElementId,t.deleted=!0,t._uiManager.addToAnnotationStorage(t)}static initialize(e,t){if(Ave._l10n??=e,Ave._l10nResizer||=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"}),-1!==Ave._borderLineWidth)return;const a=getComputedStyle(document.documentElement);Ave._borderLineWidth=parseFloat(a.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,t){fye("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#ht}set _isDraggable(e){this.#ht=e,this.div?.classList.toggle("draggable",e)}get isEnterHandled(){return!0}center(){const[e,t]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*t/(2*e),this.y+=this.width*e/(2*t);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*t/(2*e),this.y-=this.width*e/(2*t);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#mt}setParent(e){null!==e?(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions):this.#pt(),this.parent=e}focusin(e){this._focusEventsAllowed&&(this.#nt?this.#nt=!1:this.parent.setSelected(this))}focusout(e){if(!this._focusEventsAllowed)return;if(!this.isAttachedToDOM)return;const t=e.relatedTarget;t?.closest(`#${this.id}`)||(e.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,t,a,n){const[i,r]=this.parentDimensions;[a,n]=this.screenToPageTranslation(a,n),this.x=(e+a)/i,this.y=(t+n)/r,this.fixAndSetPosition()}#gt([e,t],a,n){[a,n]=this.screenToPageTranslation(a,n),this.x+=a/e,this.y+=n/t,this.fixAndSetPosition()}translate(e,t){this.#gt(this.parentDimensions,e,t)}translateInPage(e,t){this.#it||=[this.x,this.y],this.#gt(this.pageDimensions,e,t),this.div.scrollIntoView({block:"nearest"})}drag(e,t){this.#it||=[this.x,this.y];const[a,n]=this.parentDimensions;if(this.x+=e/a,this.y+=t/n,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:e,y:t}=this.div.getBoundingClientRect();this.parent.findNewParent(this,e,t)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:i,y:r}=this;const[o,s]=this.getBaseTranslation();i+=o,r+=s,this.div.style.left=`${(100*i).toFixed(2)}%`,this.div.style.top=`${(100*r).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!this.#it&&(this.#it[0]!==this.x||this.#it[1]!==this.y)}getBaseTranslation(){const[e,t]=this.parentDimensions,{_borderLineWidth:a}=Ave,n=a/e,i=a/t;switch(this.rotation){case 90:return[-n,i];case 180:return[n,i];case 270:return[n,-i];default:return[-n,-i]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){const[t,a]=this.pageDimensions;let{x:n,y:i,width:r,height:o}=this;if(r*=t,o*=a,n*=t,i*=a,this._mustFixPosition)switch(e){case 0:n=Math.max(0,Math.min(t-r,n)),i=Math.max(0,Math.min(a-o,i));break;case 90:n=Math.max(0,Math.min(t-o,n)),i=Math.min(a,Math.max(r,i));break;case 180:n=Math.min(t,Math.max(r,n)),i=Math.min(a,Math.max(o,i));break;case 270:n=Math.min(t,Math.max(o,n)),i=Math.max(0,Math.min(a-r,i))}this.x=n/=t,this.y=i/=a;const[s,l]=this.getBaseTranslation();n+=s,i+=l;const{style:c}=this.div;c.left=`${(100*n).toFixed(2)}%`,c.top=`${(100*i).toFixed(2)}%`,this.moveInDOM()}static#ft(e,t,a){switch(a){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}}screenToPageTranslation(e,t){return Ave.#ft(e,t,this.parentRotation)}pageTranslationToScreen(e,t){return Ave.#ft(e,t,360-this.parentRotation)}#yt(e){switch(e){case 90:{const[e,t]=this.pageDimensions;return[0,-e/t,t/e,0]}case 180:return[-1,0,0,-1];case 270:{const[e,t]=this.pageDimensions;return[0,e/t,-t/e,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:e,pageDimensions:[t,a]}=this;return[t*e,a*e]}setDims(e,t){const[a,n]=this.parentDimensions;this.div.style.width=`${(100*e/a).toFixed(2)}%`,this.#Qe||(this.div.style.height=`${(100*t/n).toFixed(2)}%`)}fixDims(){const{style:e}=this.div,{height:t,width:a}=e,n=a.endsWith("%"),i=!this.#Qe&&t.endsWith("%");if(n&&i)return;const[r,o]=this.parentDimensions;n||(e.width=`${(100*parseFloat(a)/r).toFixed(2)}%`),this.#Qe||i||(e.height=`${(100*parseFloat(t)/o).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#vt(){if(this.#Je)return;this.#Je=document.createElement("div"),this.#Je.classList.add("resizers");const e=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],t=this._uiManager._signal;for(const a of e){const e=document.createElement("div");this.#Je.append(e),e.classList.add("resizer",a),e.setAttribute("data-resizer-name",a),e.addEventListener("pointerdown",this.#bt.bind(this,a),{signal:t}),e.addEventListener("contextmenu",ive,{signal:t}),e.tabIndex=-1}this.div.prepend(this.#Je)}#bt(e,t){t.preventDefault();const{isMac:a}=Mye.platform;if(0!==t.button||t.ctrlKey&&a)return;this.#s?.toggle(!1);const n=this._isDraggable;this._isDraggable=!1;const i=new AbortController,r=this._uiManager.combinedSignal(i);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",this.#wt.bind(this,e),{passive:!0,capture:!0,signal:r}),window.addEventListener("contextmenu",ive,{signal:r});const o=this.x,s=this.y,l=this.width,c=this.height,u=this.parent.div.style.cursor,d=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;const h=()=>{i.abort(),this.parent.togglePointerEvents(!0),this.#s?.toggle(!0),this._isDraggable=n,this.parent.div.style.cursor=u,this.div.style.cursor=d,this.#xt(o,s,l,c)};window.addEventListener("pointerup",h,{signal:r}),window.addEventListener("blur",h,{signal:r})}#xt(e,t,a,n){const i=this.x,r=this.y,o=this.width,s=this.height;i===e&&r===t&&o===a&&s===n||this.addCommands({cmd:()=>{this.width=o,this.height=s,this.x=i,this.y=r;const[e,t]=this.parentDimensions;this.setDims(e*o,t*s),this.fixAndSetPosition()},undo:()=>{this.width=a,this.height=n,this.x=e,this.y=t;const[i,r]=this.parentDimensions;this.setDims(i*a,r*n),this.fixAndSetPosition()},mustExec:!0})}#wt(e,t){const[a,n]=this.parentDimensions,i=this.x,r=this.y,o=this.width,s=this.height,l=Ave.MIN_SIZE/a,c=Ave.MIN_SIZE/n,u=e=>Math.round(1e4*e)/1e4,d=this.#yt(this.rotation),h=(e,t)=>[d[0]*e+d[2]*t,d[1]*e+d[3]*t],m=this.#yt(360-this.rotation);let p,g,f=!1,y=!1;switch(e){case"topLeft":f=!0,p=(e,t)=>[0,0],g=(e,t)=>[e,t];break;case"topMiddle":p=(e,t)=>[e/2,0],g=(e,t)=>[e/2,t];break;case"topRight":f=!0,p=(e,t)=>[e,0],g=(e,t)=>[0,t];break;case"middleRight":y=!0,p=(e,t)=>[e,t/2],g=(e,t)=>[0,t/2];break;case"bottomRight":f=!0,p=(e,t)=>[e,t],g=(e,t)=>[0,0];break;case"bottomMiddle":p=(e,t)=>[e/2,t],g=(e,t)=>[e/2,0];break;case"bottomLeft":f=!0,p=(e,t)=>[0,t],g=(e,t)=>[e,0];break;case"middleLeft":y=!0,p=(e,t)=>[0,t/2],g=(e,t)=>[e,t/2]}const v=p(o,s),b=g(o,s);let w=h(...b);const x=u(i+w[0]),k=u(r+w[1]);let A=1,S=1,[E,_]=this.screenToPageTranslation(t.movementX,t.movementY);if([E,_]=((e,t)=>[m[0]*e+m[2]*t,m[1]*e+m[3]*t])(E/a,_/n),f){const e=Math.hypot(o,s);A=S=Math.max(Math.min(Math.hypot(b[0]-v[0]-E,b[1]-v[1]-_)/e,1/o,1/s),l/o,c/s)}else y?A=Math.max(l,Math.min(1,Math.abs(b[0]-v[0]-E)))/o:S=Math.max(c,Math.min(1,Math.abs(b[1]-v[1]-_)))/s;const C=u(o*A),T=u(s*S);w=h(...g(C,T));const P=x-w[0],O=k-w[1];this.width=C,this.height=T,this.x=P,this.y=O,this.setDims(a*C,n*T),this.fixAndSetPosition()}altTextFinish(){this.#s?.finish()}async addEditToolbar(){return this._editToolbar||this.#ot||(this._editToolbar=new mve(this),this.div.append(this._editToolbar.render()),this.#s&&await this._editToolbar.addAltText(this.#s)),this._editToolbar}removeEditToolbar(){this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,this.#s?.destroy())}addContainer(e){const t=this._editToolbar?.div;t?t.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){this.#s||(kve.initialize(Ave._l10n),this.#s=new kve(this),this.#Ze&&(this.#s.data=this.#Ze,this.#Ze=null),await this.addEditToolbar())}get altTextData(){return this.#s?.data}set altTextData(e){this.#s&&(this.#s.data=e)}get guessedAltText(){return this.#s?.guessedText}async setGuessedAltText(e){await(this.#s?.setGuessedText(e))}serializeAltText(e){return this.#s?.serialize(e)}hasAltText(){return!!this.#s&&!this.#s.isEmpty()}hasAltTextData(){return this.#s?.hasData()??!1}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.tabIndex=this.#Xe?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),this.#kt();const[e,t]=this.parentDimensions;this.parentRotation%180!=0&&(this.div.style.maxWidth=`${(100*t/e).toFixed(2)}%`,this.div.style.maxHeight=`${(100*e/t).toFixed(2)}%`);const[a,n]=this.getInitialTranslation();return this.translate(a,n),gve(this,this.div,["pointerdown"]),this.div}pointerdown(e){const{isMac:t}=Mye.platform;0!==e.button||e.ctrlKey&&t?e.preventDefault():(this.#nt=!0,this._isDraggable?this.#At(e):this.#St(e))}get isSelected(){return this._uiManager.isSelected(this)}#St(e){const{isMac:t}=Mye.platform;e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this)}#At(e){const{isSelected:t}=this;this._uiManager.setUpDragSession();const a=new AbortController,n=this._uiManager.combinedSignal(a);if(t){this.div.classList.add("moving"),this.#ct=e.clientX,this.#ut=e.clientY;const t=e=>{const{clientX:t,clientY:a}=e,[n,i]=this.screenToPageTranslation(t-this.#ct,a-this.#ut);this.#ct=t,this.#ut=a,this._uiManager.dragSelectedEditors(n,i)};window.addEventListener("pointermove",t,{passive:!0,capture:!0,signal:n})}const i=()=>{a.abort(),t&&this.div.classList.remove("moving"),this.#nt=!1,this._uiManager.endDragSession()||this.#St(e)};window.addEventListener("pointerup",i,{signal:n}),window.addEventListener("blur",i,{signal:n})}moveInDOM(){this.#lt&&clearTimeout(this.#lt),this.#lt=setTimeout((()=>{this.#lt=null,this.parent?.moveEditorInDOM(this)}),0)}_setParentAndPosition(e,t,a){e.changeParent(this),this.x=t,this.y=a,this.fixAndSetPosition()}getRect(e,t,a=this.rotation){const n=this.parentScale,[i,r]=this.pageDimensions,[o,s]=this.pageTranslation,l=e/n,c=t/n,u=this.x*i,d=this.y*r,h=this.width*i,m=this.height*r;switch(a){case 0:return[u+l+o,r-d-c-m+s,u+l+h+o,r-d-c+s];case 90:return[u+c+o,r-d+l+s,u+c+m+o,r-d+l+h+s];case 180:return[u-l-h+o,r-d+c+s,u-l+o,r-d+c+m+s];case 270:return[u-c-m+o,r-d-l-h+s,u-c+o,r-d-l+s];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,t){const[a,n,i,r]=e,o=i-a,s=r-n;switch(this.rotation){case 0:return[a,t-r,o,s];case 90:return[a,t-n,s,o];case 180:return[i,t-n,o,s];case 270:return[i,t-r,s,o];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#ot=!0}disableEditMode(){this.#ot=!1}isInEditMode(){return this.#ot}shouldGetKeyboardEvents(){return this.#st}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}#kt(){if(this.#tt||!this.div)return;this.#tt=new AbortController;const e=this._uiManager.combinedSignal(this.#tt);this.div.addEventListener("focusin",this.focusin.bind(this),{signal:e}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:e})}rebuild(){this.#kt()}rotate(e){}serializeDeleted(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:this._initialData?.popupRef||""}}serialize(e=!1,t=null){fye("An editor must be serializable")}static async deserialize(e,t,a){const n=new this.prototype.constructor({parent:t,id:t.getNextId(),uiManager:a});n.rotation=e.rotation,n.#Ze=e.accessibilityData;const[i,r]=n.pageDimensions,[o,s,l,c]=n.getRectInCurrentCoords(e.rect,r);return n.x=o/i,n.y=s/r,n.width=l/i,n.height=c/r,n}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||null!==this.serialize())}remove(){if(this.#tt?.abort(),this.#tt=null,this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#lt&&(clearTimeout(this.#lt),this.#lt=null),this.#pt(),this.removeEditToolbar(),this.#dt){for(const e of this.#dt.values())clearTimeout(e);this.#dt=null}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#vt(),this.#Je.classList.remove("hidden"),gve(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(e){if(!this.isResizable||e.target!==this.div||"Enter"!==e.key)return;this._uiManager.setSelected(this),this.#et={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};const t=this.#Je.children;if(!this.#Ye){this.#Ye=Array.from(t);const e=this.#Et.bind(this),a=this.#_t.bind(this),n=this._uiManager._signal;for(const t of this.#Ye){const i=t.getAttribute("data-resizer-name");t.setAttribute("role","spinbutton"),t.addEventListener("keydown",e,{signal:n}),t.addEventListener("blur",a,{signal:n}),t.addEventListener("focus",this.#Ct.bind(this,i),{signal:n}),t.setAttribute("data-l10n-id",Ave._l10nResizer[i])}}const a=this.#Ye[0];let n=0;for(const e of t){if(e===a)break;n++}const i=(360-this.rotation+this.parentRotation)%360/90*(this.#Ye.length/4);if(i!==n){if(i<n)for(let e=0;e<n-i;e++)this.#Je.append(this.#Je.firstChild);else if(i>n)for(let e=0;e<i-n;e++)this.#Je.firstChild.before(this.#Je.lastChild);let e=0;for(const a of t){const t=this.#Ye[e++].getAttribute("data-resizer-name");a.setAttribute("data-l10n-id",Ave._l10nResizer[t])}}this.#Tt(0),this.#st=!0,this.#Je.firstChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}#Et(e){Ave._resizerKeyboardManager.exec(this,e)}#_t(e){this.#st&&e.relatedTarget?.parentNode!==this.#Je&&this.#pt()}#Ct(e){this.#at=this.#st?e:""}#Tt(e){if(this.#Ye)for(const t of this.#Ye)t.tabIndex=e}_resizeWithKeyboard(e,t){this.#st&&this.#wt(this.#at,{movementX:e,movementY:t})}#pt(){if(this.#st=!1,this.#Tt(-1),this.#et){const{savedX:e,savedY:t,savedWidth:a,savedHeight:n}=this.#et;this.#xt(e,t,a,n),this.#et=null}}_stopResizingWithKeyboard(){this.#pt(),this.div.focus()}select(){this.makeResizable(),this.div?.classList.add("selectedEditor"),this._editToolbar?(this._editToolbar?.show(),this.#s?.toggleAltTextBadge(!1)):this.addEditToolbar().then((()=>{this.div?.classList.contains("selectedEditor")&&this._editToolbar?.show()}))}unselect(){this.#Je?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this._editToolbar?.hide(),this.#s?.toggleAltTextBadge(!0)}updateParams(e,t){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return this.#rt}set isEditing(e){this.#rt=e,this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(e,t){this.#Qe=!0;const a=e/t,{style:n}=this.div;n.aspectRatio=a,n.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(e,t=!1){if(t){this.#dt||=new Map;const{action:t}=e;let a=this.#dt.get(t);return a&&clearTimeout(a),a=setTimeout((()=>{this._reportTelemetry(e),this.#dt.delete(t),0===this.#dt.size&&(this.#dt=null)}),Ave._telemetryTimeout),void this.#dt.set(t,a)}e.type||=this.editorType,this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:e}})}show(e=this._isVisible){this.div.classList.toggle("hidden",!e),this._isVisible=e}enable(){this.div&&(this.div.tabIndex=0),this.#Xe=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#Xe=!0}renderAnnotationElement(e){let t=e.container.querySelector(".annotationContent");if(t){if("CANVAS"===t.nodeName){const e=t;t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),e.before(t)}}else t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),e.container.prepend(t);return t}resetAnnotationElement(e){const{firstChild:t}=e.container;"DIV"===t?.nodeName&&t.classList.contains("annotationContent")&&t.remove()}}class Sve extends Ave{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const Eve=3285377520,_ve=4294901760,Cve=65535;class Tve{constructor(e){this.h1=e?4294967295&e:Eve,this.h2=e?4294967295&e:Eve}update(e){let t,a;if("string"==typeof e){t=new Uint8Array(2*e.length),a=0;for(let n=0,i=e.length;n<i;n++){const i=e.charCodeAt(n);i<=255?t[a++]=i:(t[a++]=i>>>8,t[a++]=255&i)}}else{if(!ArrayBuffer.isView(e))throw new Error("Invalid data format, must be a string or TypedArray.");t=e.slice(),a=t.byteLength}const n=a>>2,i=a-4*n,r=new Uint32Array(t.buffer,0,n);let o=0,s=0,l=this.h1,c=this.h2;const u=3432918353,d=461845907,h=11601,m=13715;for(let e=0;e<n;e++)1&e?(o=r[e],o=o*u&_ve|o*h&Cve,o=o<<15|o>>>17,o=o*d&_ve|o*m&Cve,l^=o,l=l<<13|l>>>19,l=5*l+3864292196):(s=r[e],s=s*u&_ve|s*h&Cve,s=s<<15|s>>>17,s=s*d&_ve|s*m&Cve,c^=s,c=c<<13|c>>>19,c=5*c+3864292196);switch(o=0,i){case 3:o^=t[4*n+2]<<16;case 2:o^=t[4*n+1]<<8;case 1:o^=t[4*n],o=o*u&_ve|o*h&Cve,o=o<<15|o>>>17,o=o*d&_ve|o*m&Cve,1&n?l^=o:c^=o}this.h1=l,this.h2=c}hexdigest(){let e=this.h1,t=this.h2;return e^=t>>>1,e=3981806797*e&_ve|36045*e&Cve,t=4283543511*t&_ve|(2950163797*(t<<16|e>>>16)&_ve)>>>16,e^=t>>>1,e=444984403*e&_ve|60499*e&Cve,t=3301882366*t&_ve|(3120437893*(t<<16|e>>>16)&_ve)>>>16,e^=t>>>1,(e>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}const Pve=Object.freeze({map:null,hash:"",transfer:void 0});class Ove{#Pt=!1;#Ot=null;#Mt=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(e,t){const a=this.#Mt.get(e);return void 0===a?t:Object.assign(t,a)}getRawValue(e){return this.#Mt.get(e)}remove(e){if(this.#Mt.delete(e),0===this.#Mt.size&&this.resetModified(),"function"==typeof this.onAnnotationEditor){for(const e of this.#Mt.values())if(e instanceof Ave)return;this.onAnnotationEditor(null)}}setValue(e,t){const a=this.#Mt.get(e);let n=!1;if(void 0!==a)for(const[e,i]of Object.entries(t))a[e]!==i&&(n=!0,a[e]=i);else n=!0,this.#Mt.set(e,t);n&&this.#Dt(),t instanceof Ave&&"function"==typeof this.onAnnotationEditor&&this.onAnnotationEditor(t.constructor._type)}has(e){return this.#Mt.has(e)}getAll(){return this.#Mt.size>0?Oye(this.#Mt):null}setAll(e){for(const[t,a]of Object.entries(e))this.setValue(t,a)}get size(){return this.#Mt.size}#Dt(){this.#Pt||(this.#Pt=!0,"function"==typeof this.onSetModified&&this.onSetModified())}resetModified(){this.#Pt&&(this.#Pt=!1,"function"==typeof this.onResetModified&&this.onResetModified())}get print(){return new Mve(this)}get serializable(){if(0===this.#Mt.size)return Pve;const e=new Map,t=new Tve,a=[],n=Object.create(null);let i=!1;for(const[a,r]of this.#Mt){const o=r instanceof Ave?r.serialize(!1,n):r;o&&(e.set(a,o),t.update(`${a}:${JSON.stringify(o)}`),i||=!!o.bitmap)}if(i)for(const t of e.values())t.bitmap&&a.push(t.bitmap);return e.size>0?{map:e,hash:t.hexdigest(),transfer:a}:Pve}get editorStats(){let e=null;const t=new Map;for(const a of this.#Mt.values()){if(!(a instanceof Ave))continue;const n=a.telemetryFinalData;if(!n)continue;const{type:i}=n;t.has(i)||t.set(i,Object.getPrototypeOf(a).constructor),e||=Object.create(null);const r=e[i]||=new Map;for(const[e,t]of Object.entries(n)){if("type"===e)continue;let a=r.get(e);a||(a=new Map,r.set(e,a));const n=a.get(t)??0;a.set(t,n+1)}}for(const[a,n]of t)e[a]=n.computeTelemetryFinalData(e[a]);return e}resetModifiedIds(){this.#Ot=null}get modifiedIds(){if(this.#Ot)return this.#Ot;const e=[];for(const t of this.#Mt.values())t instanceof Ave&&t.annotationElementId&&t.serialize()&&e.push(t.annotationElementId);return this.#Ot={ids:new Set(e),hash:e.join(",")}}}class Mve extends Ove{#It;constructor(e){super();const{map:t,hash:a,transfer:n}=e.serializable,i=structuredClone(t,n?{transfer:n}:null);this.#It={map:i,hash:a,transfer:n}}get print(){fye("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#It}get modifiedIds(){return bye(this,"modifiedIds",{ids:new Set,hash:""})}}class Dve{#Nt=new Set;constructor({ownerDocument:e=globalThis.document,styleElement:t=null}){this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.add(e),this._document.fonts.add(e)}removeNativeFontFace(e){this.nativeFontFaces.delete(e),this._document.fonts.delete(e)}insertRule(e){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const t=this.styleElement.sheet;t.insertRule(e,t.cssRules.length)}clear(){for(const e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.clear(),this.#Nt.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:e,_inspectFont:t}){if(e&&!this.#Nt.has(e.loadedName))if(yye(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:a,src:n,style:i}=e,r=new FontFace(a,n,i);this.addNativeFontFace(r);try{await r.load(),this.#Nt.add(a),t?.(e)}catch{gye(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(r)}}else fye("Not implemented: loadSystemFont without the Font Loading API.")}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo)return void await this.loadSystemFont(e);if(this.isFontLoadingAPISupported){const t=e.createNativeFontFace();if(t){this.addNativeFontFace(t);try{await t.loaded}catch(a){throw gye(`Failed to load font '${t.family}': '${a}'.`),e.disableFontFace=!0,a}}return}const t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise((t=>{const a=this._queueLoadingCallback(t);this._prepareFontLoadEvent(e,a)}))}}get isFontLoadingAPISupported(){return bye(this,"isFontLoadingAPISupported",!!this._document?.fonts)}get isSyncFontLoadingSupported(){let e=!1;return(ffe||"undefined"!=typeof navigator&&"string"==typeof navigator?.userAgent&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(e=!0),bye(this,"isSyncFontLoadingSupported",e)}_queueLoadingCallback(e){const{loadingRequests:t}=this,a={done:!1,complete:function(){for(yye(!a.done,"completeRequest() cannot be called twice."),a.done=!0;t.length>0&&t[0].done;){const e=t.shift();setTimeout(e.callback,0)}},callback:e};return t.push(a),a}get _loadTestFont(){return bye(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(e,t){function a(e,t){return e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|255&e.charCodeAt(t+3)}function n(e,t,a,n){return e.substring(0,t)+n+e.substring(t+a)}let i,r;const o=this._document.createElement("canvas");o.width=1,o.height=1;const s=o.getContext("2d");let l=0;const c=`lt${Date.now()}${this.loadTestFontId++}`;let u=this._loadTestFont;u=n(u,976,c.length,c);const d=1482184792;let h=a(u,16);for(i=0,r=c.length-3;i<r;i+=4)h=h-d+a(c,i)|0;i<c.length&&(h=h-d+a(c+"XXX",i)|0),u=n(u,16,4,function(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)}(h));const m=`@font-face {font-family:"${c}";src:${`url(data:font/opentype;base64,${btoa(u)});`}}`;this.insertRule(m);const p=this._document.createElement("div");p.style.visibility="hidden",p.style.width=p.style.height="10px",p.style.position="absolute",p.style.top=p.style.left="0px";for(const t of[e.loadedName,c]){const e=this._document.createElement("span");e.textContent="Hi",e.style.fontFamily=t,p.append(e)}this._document.body.append(p),function e(t,a){if(++l>30)return gye("Load test font never loaded."),void a();s.font="30px "+t,s.fillText(".",0,20),s.getImageData(0,0,1,1).data[3]>0?a():setTimeout(e.bind(null,t,a))}(c,(()=>{p.remove(),t.complete()}))}}class Ive{constructor(e,{disableFontFace:t=!1,inspectFont:a=null}){this.compiledGlyphs=Object.create(null);for(const t in e)this[t]=e[t];this.disableFontFace=!0===t,this._inspectFont=a}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let e;if(this.cssFontInfo){const t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,t)}else e=new FontFace(this.loadedName,this.data,{});return this._inspectFont?.(this),e}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const e=`url(data:${this.mimetype};base64,${function(e){return Uint8Array.prototype.toBase64?e.toBase64():btoa(Tye(e))}(this.data)});`;let t;if(this.cssFontInfo){let a=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(a+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),t=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${a}src:${e}}`}else t=`@font-face {font-family:"${this.loadedName}";src:${e}}`;return this._inspectFont?.(this,e),t}getPathGenerator(e,t){if(void 0!==this.compiledGlyphs[t])return this.compiledGlyphs[t];let a;try{a=e.get(this.loadedName+"_path_"+t)}catch(e){gye(`getPathGenerator - ignoring character: "${e}".`)}if(!Array.isArray(a)||0===a.length)return this.compiledGlyphs[t]=function(e,t){};const n=[];for(let e=0,t=a.length;e<t;)switch(a[e++]){case Lye:{const[t,i,r,o,s,l]=a.slice(e,e+6);n.push((e=>e.bezierCurveTo(t,i,r,o,s,l))),e+=6}break;case Fye:{const[t,i]=a.slice(e,e+2);n.push((e=>e.moveTo(t,i))),e+=2}break;case Bye:{const[t,i]=a.slice(e,e+2);n.push((e=>e.lineTo(t,i))),e+=2}break;case Hye:{const[t,i,r,o]=a.slice(e,e+4);n.push((e=>e.quadraticCurveTo(t,i,r,o))),e+=4}break;case qye:n.push((e=>e.restore()));break;case Uye:n.push((e=>e.save()));break;case Vye:yye(2===n.length,"Scale command is only valid at the third position.");break;case Wye:{const[t,i,r,o,s,l]=a.slice(e,e+6);n.push((e=>e.transform(t,i,r,o,s,l))),e+=6}break;case $ye:{const[t,i]=a.slice(e,e+2);n.push((e=>e.translate(t,i))),e+=2}}return this.compiledGlyphs[t]=function(e,t){n[0](e),n[1](e),e.scale(t,-t);for(let t=2,a=n.length;t<a;t++)n[t](e)}}}class Nve{#jt=!1;constructor({enableHWA:e=!1}){this.#jt=e}create(e,t){if(e<=0||t<=0)throw new Error("Invalid canvas size");const a=this._createCanvas(e,t);return{canvas:a,context:a.getContext("2d",{willReadFrequently:!this.#jt})}}reset(e,t,a){if(!e.canvas)throw new Error("Canvas is not specified");if(t<=0||a<=0)throw new Error("Invalid canvas size");e.canvas.width=t,e.canvas.height=a}destroy(e){if(!e.canvas)throw new Error("Canvas is not specified");e.canvas.width=0,e.canvas.height=0,e.canvas=null,e.context=null}_createCanvas(e,t){fye("Abstract method `_createCanvas` called.")}}class jve{constructor({baseUrl:e=null,isCompressed:t=!0}){this.baseUrl=e,this.isCompressed=t}async fetch({name:e}){if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!e)throw new Error("CMap name must be specified.");const t=this.baseUrl+e+(this.isCompressed?".bcmap":"");return this._fetch(t).then((e=>({cMapData:e,isCompressed:this.isCompressed}))).catch((e=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${t}`)}))}async _fetch(e){fye("Abstract method `_fetch` called.")}}class zve extends jve{async _fetch(e){const t=await Zye(e,this.isCompressed?"arraybuffer":"text");return t instanceof ArrayBuffer?new Uint8Array(t):Pye(t)}}class Rve{addFilter(e){return"none"}addHCMFilter(e,t){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addHighlightHCMFilter(e,t,a,n,i){return"none"}destroy(e=!1){}}class Lve{constructor({baseUrl:e=null}){this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!e)throw new Error("Font filename must be specified.");const t=`${this.baseUrl}${e}`;return this._fetch(t).catch((e=>{throw new Error(`Unable to load font data at: ${t}`)}))}async _fetch(e){fye("Abstract method `_fetch` called.")}}class Fve extends Lve{async _fetch(e){const t=await Zye(e,"arraybuffer");return new Uint8Array(t)}}if(ffe){var Bve=Promise.withResolvers(),Hve=null;(async()=>{const e=await import("./_node-resolve_empty-CIEyP2s7.js"),t=await import("./_node-resolve_empty-CIEyP2s7.js"),a=await import("./_node-resolve_empty-CIEyP2s7.js"),n=await import("./_node-resolve_empty-CIEyP2s7.js");return new Map(Object.entries({fs:e,http:t,https:a,url:n,canvas:undefined,path2d:undefined}))})().then((e=>{Hve=e,Bve.resolve()}),(e=>{gye(`loadPackages: ${e}`),Hve=new Map,Bve.resolve()}))}class qve{static get promise(){return Bve.promise}static get(e){return Hve?.get(e)}}async function Uve(e){const t=qve.get("fs"),a=await t.promises.readFile(e);return new Uint8Array(a)}const Vve="Fill",Wve="Stroke",$ve="Shading";function Gve(e,t){if(!t)return;const a=t[2]-t[0],n=t[3]-t[1],i=new Path2D;i.rect(t[0],t[1],a,n),e.clip(i)}class Kve{getPattern(){fye("Abstract method `getPattern` called.")}}class Zve extends Kve{constructor(e){super(),this._type=e[1],this._bbox=e[2],this._colorStops=e[3],this._p0=e[4],this._p1=e[5],this._r0=e[6],this._r1=e[7],this.matrix=null}_createGradient(e){let t;"axial"===this._type?t=e.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(t=e.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const e of this._colorStops)t.addColorStop(e[0],e[1]);return t}getPattern(e,t,a,n){let i;if(n===Wve||n===Vve){const r=t.current.getClippedPathBoundingBox(n,cve(e))||[0,0,0,0],o=Math.ceil(r[2]-r[0])||1,s=Math.ceil(r[3]-r[1])||1,l=t.cachedCanvases.getCanvas("pattern",o,s),c=l.context;c.clearRect(0,0,c.canvas.width,c.canvas.height),c.beginPath(),c.rect(0,0,c.canvas.width,c.canvas.height),c.translate(-r[0],-r[1]),a=Iye.transform(a,[1,0,0,1,r[0],r[1]]),c.transform(...t.baseTransform),this.matrix&&c.transform(...this.matrix),Gve(c,this._bbox),c.fillStyle=this._createGradient(c),c.fill(),i=e.createPattern(l.canvas,"no-repeat");const u=new DOMMatrix(a);i.setTransform(u)}else Gve(e,this._bbox),i=this._createGradient(e);return i}}function Yve(e,t,a,n,i,r,o,s){const l=t.coords,c=t.colors,u=e.data,d=4*e.width;let h;l[a+1]>l[n+1]&&(h=a,a=n,n=h,h=r,r=o,o=h),l[n+1]>l[i+1]&&(h=n,n=i,i=h,h=o,o=s,s=h),l[a+1]>l[n+1]&&(h=a,a=n,n=h,h=r,r=o,o=h);const m=(l[a]+t.offsetX)*t.scaleX,p=(l[a+1]+t.offsetY)*t.scaleY,g=(l[n]+t.offsetX)*t.scaleX,f=(l[n+1]+t.offsetY)*t.scaleY,y=(l[i]+t.offsetX)*t.scaleX,v=(l[i+1]+t.offsetY)*t.scaleY;if(p>=v)return;const b=c[r],w=c[r+1],x=c[r+2],k=c[o],A=c[o+1],S=c[o+2],E=c[s],_=c[s+1],C=c[s+2],T=Math.round(p),P=Math.round(v);let O,M,D,I,N,j,z,R;for(let e=T;e<=P;e++){if(e<f){const t=e<p?0:(p-e)/(p-f);O=m-(m-g)*t,M=b-(b-k)*t,D=w-(w-A)*t,I=x-(x-S)*t}else{let t;t=e>v?1:f===v?0:(f-e)/(f-v),O=g-(g-y)*t,M=k-(k-E)*t,D=A-(A-_)*t,I=S-(S-C)*t}let t;t=e<p?0:e>v?1:(p-e)/(p-v),N=m-(m-y)*t,j=b-(b-E)*t,z=w-(w-_)*t,R=x-(x-C)*t;const a=Math.round(Math.min(O,N)),n=Math.round(Math.max(O,N));let i=d*e+4*a;for(let e=a;e<=n;e++)t=(O-e)/(O-N),t<0?t=0:t>1&&(t=1),u[i++]=M-(M-j)*t|0,u[i++]=D-(D-z)*t|0,u[i++]=I-(I-R)*t|0,u[i++]=255}}function Xve(e,t,a){const n=t.coords,i=t.colors;let r,o;switch(t.type){case"lattice":const s=t.verticesPerRow,l=Math.floor(n.length/s)-1,c=s-1;for(r=0;r<l;r++){let t=r*s;for(let r=0;r<c;r++,t++)Yve(e,a,n[t],n[t+1],n[t+s],i[t],i[t+1],i[t+s]),Yve(e,a,n[t+s+1],n[t+1],n[t+s],i[t+s+1],i[t+1],i[t+s])}break;case"triangles":for(r=0,o=n.length;r<o;r+=3)Yve(e,a,n[r],n[r+1],n[r+2],i[r],i[r+1],i[r+2]);break;default:throw new Error("illegal figure")}}class Qve extends Kve{constructor(e){super(),this._coords=e[2],this._colors=e[3],this._figures=e[4],this._bounds=e[5],this._bbox=e[7],this._background=e[8],this.matrix=null}_createMeshCanvas(e,t,a){const n=Math.floor(this._bounds[0]),i=Math.floor(this._bounds[1]),r=Math.ceil(this._bounds[2])-n,o=Math.ceil(this._bounds[3])-i,s=Math.min(Math.ceil(Math.abs(r*e[0]*1.1)),3e3),l=Math.min(Math.ceil(Math.abs(o*e[1]*1.1)),3e3),c=r/s,u=o/l,d={coords:this._coords,colors:this._colors,offsetX:-n,offsetY:-i,scaleX:1/c,scaleY:1/u},h=s+4,m=l+4,p=a.getCanvas("mesh",h,m),g=p.context,f=g.createImageData(s,l);if(t){const e=f.data;for(let a=0,n=e.length;a<n;a+=4)e[a]=t[0],e[a+1]=t[1],e[a+2]=t[2],e[a+3]=255}for(const e of this._figures)Xve(f,e,d);g.putImageData(f,2,2);return{canvas:p.canvas,offsetX:n-2*c,offsetY:i-2*u,scaleX:c,scaleY:u}}getPattern(e,t,a,n){let i;if(Gve(e,this._bbox),n===$ve)i=Iye.singularValueDecompose2dScale(cve(e));else if(i=Iye.singularValueDecompose2dScale(t.baseTransform),this.matrix){const e=Iye.singularValueDecompose2dScale(this.matrix);i=[i[0]*e[0],i[1]*e[1]]}const r=this._createMeshCanvas(i,n===$ve?null:this._background,t.cachedCanvases);return n!==$ve&&(e.setTransform(...t.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(r.offsetX,r.offsetY),e.scale(r.scaleX,r.scaleY),e.createPattern(r.canvas,"no-repeat")}}class Jve extends Kve{getPattern(){return"hotpink"}}const ebe=1,tbe=2;class abe{static MAX_PATTERN_SIZE=3e3;constructor(e,t,a,n,i){this.operatorList=e[2],this.matrix=e[3],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.color=t,this.ctx=a,this.canvasGraphicsFactory=n,this.baseTransform=i}createPatternCanvas(e){const{bbox:t,operatorList:a,paintType:n,tilingType:i,color:r,canvasGraphicsFactory:o}=this;let{xstep:s,ystep:l}=this;s=Math.abs(s),l=Math.abs(l),pye("TilingType: "+i);const c=t[0],u=t[1],d=t[2],h=t[3],m=d-c,p=h-u,g=Iye.singularValueDecompose2dScale(this.matrix),f=Iye.singularValueDecompose2dScale(this.baseTransform),y=g[0]*f[0],v=g[1]*f[1];let b=m,w=p,x=!1,k=!1;const A=Math.ceil(s*y),S=Math.ceil(l*v);A>=Math.ceil(m*y)?b=s:x=!0,S>=Math.ceil(p*v)?w=l:k=!0;const E=this.getSizeAndScale(b,this.ctx.canvas.width,y),_=this.getSizeAndScale(w,this.ctx.canvas.height,v),C=e.cachedCanvases.getCanvas("pattern",E.size,_.size),T=C.context,P=o.createCanvasGraphics(T);if(P.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(P,n,r),T.translate(-E.scale*c,-_.scale*u),P.transform(E.scale,0,0,_.scale,0,0),T.save(),this.clipBbox(P,c,u,d,h),P.baseTransform=cve(P.ctx),P.executeOperatorList(a),P.endDrawing(),T.restore(),x||k){const t=C.canvas;x&&(b=s),k&&(w=l);const a=this.getSizeAndScale(b,this.ctx.canvas.width,y),n=this.getSizeAndScale(w,this.ctx.canvas.height,v),i=a.size,r=n.size,o=e.cachedCanvases.getCanvas("pattern-workaround",i,r),d=o.context,h=x?Math.floor(m/s):0,g=k?Math.floor(p/l):0;for(let e=0;e<=h;e++)for(let a=0;a<=g;a++)d.drawImage(t,i*e,r*a,i,r,0,0,i,r);return{canvas:o.canvas,scaleX:a.scale,scaleY:n.scale,offsetX:c,offsetY:u}}return{canvas:C.canvas,scaleX:E.scale,scaleY:_.scale,offsetX:c,offsetY:u}}getSizeAndScale(e,t,a){const n=Math.max(abe.MAX_PATTERN_SIZE,t);let i=Math.ceil(e*a);return i>=n?i=n:a=i/e,{scale:a,size:i}}clipBbox(e,t,a,n,i){const r=n-t,o=i-a;e.ctx.rect(t,a,r,o),e.current.updateRectMinMax(cve(e.ctx),[t,a,n,i]),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,t,a){const n=e.ctx,i=e.current;switch(t){case ebe:const e=this.ctx;n.fillStyle=e.fillStyle,n.strokeStyle=e.strokeStyle,i.fillColor=e.fillStyle,i.strokeColor=e.strokeStyle;break;case tbe:const r=Iye.makeHexColor(a[0],a[1],a[2]);n.fillStyle=r,n.strokeStyle=r,i.fillColor=r,i.strokeColor=r;break;default:throw new _ye(`Unsupported paint type: ${t}`)}}getPattern(e,t,a,n){let i=a;n!==$ve&&(i=Iye.transform(i,t.baseTransform),this.matrix&&(i=Iye.transform(i,this.matrix)));const r=this.createPatternCanvas(t);let o=new DOMMatrix(i);o=o.translate(r.offsetX,r.offsetY),o=o.scale(1/r.scaleX,1/r.scaleY);const s=e.createPattern(r.canvas,"repeat");return s.setTransform(o),s}}function nbe({src:e,srcPos:t=0,dest:a,width:n,height:i,nonBlackColor:r=4294967295,inverseDecode:o=!1}){const s=Mye.isLittleEndian?4278190080:255,[l,c]=o?[r,s]:[s,r],u=n>>3,d=7&n,h=e.length;a=new Uint32Array(a.buffer);let m=0;for(let n=0;n<i;n++){for(const n=t+u;t<n;t++){const n=t<h?e[t]:255;a[m++]=128&n?c:l,a[m++]=64&n?c:l,a[m++]=32&n?c:l,a[m++]=16&n?c:l,a[m++]=8&n?c:l,a[m++]=4&n?c:l,a[m++]=2&n?c:l,a[m++]=1&n?c:l}if(0===d)continue;const n=t<h?e[t++]:255;for(let e=0;e<d;e++)a[m++]=n&1<<7-e?c:l}return{srcPos:t,destPos:m}}const ibe=16;class rbe{constructor(e){this.canvasFactory=e,this.cache=Object.create(null)}getCanvas(e,t,a){let n;return void 0!==this.cache[e]?(n=this.cache[e],this.canvasFactory.reset(n,t,a)):(n=this.canvasFactory.create(t,a),this.cache[e]=n),n}delete(e){delete this.cache[e]}clear(){for(const e in this.cache){const t=this.cache[e];this.canvasFactory.destroy(t),delete this.cache[e]}}}function obe(e,t,a,n,i,r,o,s,l,c){const[u,d,h,m,p,g]=cve(e);if(0===d&&0===h){const f=o*u+p,y=Math.round(f),v=s*m+g,b=Math.round(v),w=(o+l)*u+p,x=Math.abs(Math.round(w)-y)||1,k=(s+c)*m+g,A=Math.abs(Math.round(k)-b)||1;return e.setTransform(Math.sign(u),0,0,Math.sign(m),y,b),e.drawImage(t,a,n,i,r,0,0,x,A),e.setTransform(u,d,h,m,p,g),[x,A]}if(0===u&&0===m){const f=s*h+p,y=Math.round(f),v=o*d+g,b=Math.round(v),w=(s+c)*h+p,x=Math.abs(Math.round(w)-y)||1,k=(o+l)*d+g,A=Math.abs(Math.round(k)-b)||1;return e.setTransform(0,Math.sign(d),Math.sign(h),0,y,b),e.drawImage(t,a,n,i,r,0,0,A,x),e.setTransform(u,d,h,m,p,g),[A,x]}e.drawImage(t,a,n,i,r,o,s,l,c);return[Math.hypot(u,d)*l,Math.hypot(h,m)*c]}class sbe{constructor(e,t){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=yfe,this.textMatrixScale=1,this.fontMatrix=vfe,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=Dfe,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,e,t])}clone(){const e=Object.create(this);return e.clipBox=this.clipBox.slice(),e}setCurrentPoint(e,t){this.x=e,this.y=t}updatePathMinMax(e,t,a){[t,a]=Iye.applyTransform([t,a],e),this.minX=Math.min(this.minX,t),this.minY=Math.min(this.minY,a),this.maxX=Math.max(this.maxX,t),this.maxY=Math.max(this.maxY,a)}updateRectMinMax(e,t){const a=Iye.applyTransform(t,e),n=Iye.applyTransform(t.slice(2),e),i=Iye.applyTransform([t[0],t[3]],e),r=Iye.applyTransform([t[2],t[1]],e);this.minX=Math.min(this.minX,a[0],n[0],i[0],r[0]),this.minY=Math.min(this.minY,a[1],n[1],i[1],r[1]),this.maxX=Math.max(this.maxX,a[0],n[0],i[0],r[0]),this.maxY=Math.max(this.maxY,a[1],n[1],i[1],r[1])}updateScalingPathMinMax(e,t){Iye.scaleMinMax(e,t),this.minX=Math.min(this.minX,t[0]),this.minY=Math.min(this.minY,t[1]),this.maxX=Math.max(this.maxX,t[2]),this.maxY=Math.max(this.maxY,t[3])}updateCurvePathMinMax(e,t,a,n,i,r,o,s,l,c){const u=Iye.bezierBoundingBox(t,a,n,i,r,o,s,l,c);c||this.updateRectMinMax(e,u)}getPathBoundingBox(e=Vve,t=null){const a=[this.minX,this.minY,this.maxX,this.maxY];if(e===Wve){t||fye("Stroke bounding box must include transform.");const e=Iye.singularValueDecompose2dScale(t),n=e[0]*this.lineWidth/2,i=e[1]*this.lineWidth/2;a[0]-=n,a[1]-=i,a[2]+=n,a[3]+=i}return a}updateClipFromPath(){const e=Iye.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(e){this.clipBox=e,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(e=Vve,t=null){return Iye.intersect(this.clipBox,this.getPathBoundingBox(e,t))}}function lbe(e,t){if("undefined"!=typeof ImageData&&t instanceof ImageData)return void e.putImageData(t,0,0);const a=t.height,n=t.width,i=a%ibe,r=(a-i)/ibe,o=0===i?r:r+1,s=e.createImageData(n,ibe);let l,c=0;const u=t.data,d=s.data;let h,m,p,g;if(t.kind===Lfe.GRAYSCALE_1BPP){const t=u.byteLength,a=new Uint32Array(d.buffer,0,d.byteLength>>2),g=a.length,f=n+7>>3,y=4294967295,v=Mye.isLittleEndian?4278190080:255;for(h=0;h<o;h++){for(p=h<r?ibe:i,l=0,m=0;m<p;m++){const e=t-c;let i=0;const r=e>f?n:8*e-7,o=-8&r;let s=0,d=0;for(;i<o;i+=8)d=u[c++],a[l++]=128&d?y:v,a[l++]=64&d?y:v,a[l++]=32&d?y:v,a[l++]=16&d?y:v,a[l++]=8&d?y:v,a[l++]=4&d?y:v,a[l++]=2&d?y:v,a[l++]=1&d?y:v;for(;i<r;i++)0===s&&(d=u[c++],s=128),a[l++]=d&s?y:v,s>>=1}for(;l<g;)a[l++]=0;e.putImageData(s,0,h*ibe)}}else if(t.kind===Lfe.RGBA_32BPP){for(m=0,g=n*ibe*4,h=0;h<r;h++)d.set(u.subarray(c,c+g)),c+=g,e.putImageData(s,0,m),m+=ibe;h<o&&(g=n*i*4,d.set(u.subarray(c,c+g)),e.putImageData(s,0,m))}else{if(t.kind!==Lfe.RGB_24BPP)throw new Error(`bad image kind: ${t.kind}`);for(p=ibe,g=n*p,h=0;h<o;h++){for(h>=r&&(p=i,g=n*p),l=0,m=g;m--;)d[l++]=u[c++],d[l++]=u[c++],d[l++]=u[c++],d[l++]=255;e.putImageData(s,0,h*ibe)}}}function cbe(e,t){if(t.bitmap)return void e.drawImage(t.bitmap,0,0);const a=t.height,n=t.width,i=a%ibe,r=(a-i)/ibe,o=0===i?r:r+1,s=e.createImageData(n,ibe);let l=0;const c=t.data,u=s.data;for(let t=0;t<o;t++){const a=t<r?ibe:i;({srcPos:l}=nbe({src:c,srcPos:l,dest:u,width:n,height:a,nonBlackColor:0})),e.putImageData(s,0,t*ibe)}}function ube(e,t){const a=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const n of a)void 0!==e[n]&&(t[n]=e[n]);void 0!==e.setLineDash&&(t.setLineDash(e.getLineDash()),t.lineDashOffset=e.lineDashOffset)}function dbe(e){if(e.strokeStyle=e.fillStyle="#000000",e.fillRule="nonzero",e.globalAlpha=1,e.lineWidth=1,e.lineCap="butt",e.lineJoin="miter",e.miterLimit=10,e.globalCompositeOperation="source-over",e.font="10px sans-serif",void 0!==e.setLineDash&&(e.setLineDash([]),e.lineDashOffset=0),!ffe){const{filter:t}=e;"none"!==t&&""!==t&&(e.filter="none")}}function hbe(e,t){if(t)return!0;const a=Iye.singularValueDecompose2dScale(e);a[0]=Math.fround(a[0]),a[1]=Math.fround(a[1]);const n=Math.fround((globalThis.devicePixelRatio||1)*Kye.PDF_TO_CSS_UNITS);return a[0]<=n&&a[1]<=n}const mbe=["butt","round","square"],pbe=["miter","round","bevel"],gbe={},fbe={};class ybe{constructor(e,t,a,n,i,{optionalContentConfig:r,markedContentStack:o=null},s,l){this.ctx=e,this.current=new sbe(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=t,this.objs=a,this.canvasFactory=n,this.filterFactory=i,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=o||[],this.optionalContentConfig=r,this.cachedCanvases=new rbe(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=s,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=l,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(e,t=null){return"string"==typeof e?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):t}beginDrawing({transform:e,viewport:t,transparency:a=!1,background:n=null}){const i=this.ctx.canvas.width,r=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=n||"#ffffff",this.ctx.fillRect(0,0,i,r),this.ctx.fillStyle=o,a){const e=this.cachedCanvases.getCanvas("transparent",i,r);this.compositeCtx=this.ctx,this.transparentCanvas=e.canvas,this.ctx=e.context,this.ctx.save(),this.ctx.transform(...cve(this.compositeCtx))}this.ctx.save(),dbe(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...t.transform),this.viewportScale=t.scale,this.baseTransform=cve(this.ctx)}executeOperatorList(e,t,a,n){const i=e.argsArray,r=e.fnArray;let o=t||0;const s=i.length;if(s===o)return o;const l=s-o>10&&"function"==typeof a,c=l?Date.now()+15:0;let u=0;const d=this.commonObjs,h=this.objs;let m;for(;;){if(void 0!==n&&o===n.nextBreakPoint)return n.breakIt(o,a),o;if(m=r[o],m!==cye.dependency)this[m].apply(this,i[o]);else for(const e of i[o]){const t=e.startsWith("g_")?d:h;if(!t.has(e))return t.get(e,a),o}if(o++,o===s)return o;if(l&&++u>10){if(Date.now()>c)return a(),o;u=0}}}#zt(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)}endDrawing(){this.#zt(),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const e of this._cachedBitmapsMap.values()){for(const t of e.values())"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);e.clear()}this._cachedBitmapsMap.clear(),this.#Rt()}#Rt(){if(this.pageColors){const e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if("none"!==e){const t=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=t}}}_scaleImage(e,t){const a=e.width??e.displayWidth,n=e.height??e.displayHeight;let i,r,o=Math.max(Math.hypot(t[0],t[1]),1),s=Math.max(Math.hypot(t[2],t[3]),1),l=a,c=n,u="prescale1";for(;o>2&&l>1||s>2&&c>1;){let t=l,a=c;o>2&&l>1&&(t=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l/2),o/=l/t),s>2&&c>1&&(a=c>=16384?Math.floor(c/2)-1||1:Math.ceil(c)/2,s/=c/a),i=this.cachedCanvases.getCanvas(u,t,a),r=i.context,r.clearRect(0,0,t,a),r.drawImage(e,0,0,l,c,0,0,t,a),e=i.canvas,l=t,c=a,u="prescale1"===u?"prescale2":"prescale1"}return{img:e,paintWidth:l,paintHeight:c}}_createMaskCanvas(e){const t=this.ctx,{width:a,height:n}=e,i=this.current.fillColor,r=this.current.patternFill,o=cve(t);let s,l,c,u;if((e.bitmap||e.data)&&e.count>1){const t=e.bitmap||e.data.buffer;l=JSON.stringify(r?o:[o.slice(0,4),i]),s=this._cachedBitmapsMap.get(t),s||(s=new Map,this._cachedBitmapsMap.set(t,s));const a=s.get(l);if(a&&!r){return{canvas:a,offsetX:Math.round(Math.min(o[0],o[2])+o[4]),offsetY:Math.round(Math.min(o[1],o[3])+o[5])}}c=a}c||(u=this.cachedCanvases.getCanvas("maskCanvas",a,n),cbe(u.context,e));let d=Iye.transform(o,[1/a,0,0,-1/n,0,0]);d=Iye.transform(d,[1,0,0,1,0,-n]);const[h,m,p,g]=Iye.getAxialAlignedBoundingBox([0,0,a,n],d),f=Math.round(p-h)||1,y=Math.round(g-m)||1,v=this.cachedCanvases.getCanvas("fillCanvas",f,y),b=v.context,w=h,x=m;b.translate(-w,-x),b.transform(...d),c||(c=this._scaleImage(u.canvas,uve(b)),c=c.img,s&&r&&s.set(l,c)),b.imageSmoothingEnabled=hbe(cve(b),e.interpolate),obe(b,c,0,0,c.width,c.height,0,0,a,n),b.globalCompositeOperation="source-in";const k=Iye.transform(uve(b),[1,0,0,1,-w,-x]);return b.fillStyle=r?i.getPattern(t,this,k,Vve):i,b.fillRect(0,0,a,n),s&&!r&&(this.cachedCanvases.delete("fillCanvas"),s.set(l,v.canvas)),{canvas:v.canvas,offsetX:Math.round(w),offsetY:Math.round(x)}}setLineWidth(e){e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(e){this.ctx.lineCap=mbe[e]}setLineJoin(e){this.ctx.lineJoin=pbe[e]}setMiterLimit(e){this.ctx.miterLimit=e}setDash(e,t){const a=this.ctx;void 0!==a.setLineDash&&(a.setLineDash(e),a.lineDashOffset=t)}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(const[t,a]of e)switch(t){case"LW":this.setLineWidth(a);break;case"LC":this.setLineCap(a);break;case"LJ":this.setLineJoin(a);break;case"ML":this.setMiterLimit(a);break;case"D":this.setDash(a[0],a[1]);break;case"RI":this.setRenderingIntent(a);break;case"FL":this.setFlatness(a);break;case"Font":this.setFont(a[0],a[1]);break;case"CA":this.current.strokeAlpha=a;break;case"ca":this.current.fillAlpha=a,this.ctx.globalAlpha=a;break;case"BM":this.ctx.globalCompositeOperation=a;break;case"SMask":this.current.activeSMask=a?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(a)}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const e=this.ctx.canvas.width,t=this.ctx.canvas.height,a="smaskGroupAt"+this.groupLevel,n=this.cachedCanvases.getCanvas(a,e,t);this.suspendedCtx=this.ctx,this.ctx=n.context;const i=this.ctx;i.setTransform(...cve(this.suspendedCtx)),ube(this.suspendedCtx,i),function(e,t){if(e._removeMirroring)throw new Error("Context is already forwarding operations.");e.__originalSave=e.save,e.__originalRestore=e.restore,e.__originalRotate=e.rotate,e.__originalScale=e.scale,e.__originalTranslate=e.translate,e.__originalTransform=e.transform,e.__originalSetTransform=e.setTransform,e.__originalResetTransform=e.resetTransform,e.__originalClip=e.clip,e.__originalMoveTo=e.moveTo,e.__originalLineTo=e.lineTo,e.__originalBezierCurveTo=e.bezierCurveTo,e.__originalRect=e.rect,e.__originalClosePath=e.closePath,e.__originalBeginPath=e.beginPath,e._removeMirroring=()=>{e.save=e.__originalSave,e.restore=e.__originalRestore,e.rotate=e.__originalRotate,e.scale=e.__originalScale,e.translate=e.__originalTranslate,e.transform=e.__originalTransform,e.setTransform=e.__originalSetTransform,e.resetTransform=e.__originalResetTransform,e.clip=e.__originalClip,e.moveTo=e.__originalMoveTo,e.lineTo=e.__originalLineTo,e.bezierCurveTo=e.__originalBezierCurveTo,e.rect=e.__originalRect,e.closePath=e.__originalClosePath,e.beginPath=e.__originalBeginPath,delete e._removeMirroring},e.save=function(){t.save(),this.__originalSave()},e.restore=function(){t.restore(),this.__originalRestore()},e.translate=function(e,a){t.translate(e,a),this.__originalTranslate(e,a)},e.scale=function(e,a){t.scale(e,a),this.__originalScale(e,a)},e.transform=function(e,a,n,i,r,o){t.transform(e,a,n,i,r,o),this.__originalTransform(e,a,n,i,r,o)},e.setTransform=function(e,a,n,i,r,o){t.setTransform(e,a,n,i,r,o),this.__originalSetTransform(e,a,n,i,r,o)},e.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},e.rotate=function(e){t.rotate(e),this.__originalRotate(e)},e.clip=function(e){t.clip(e),this.__originalClip(e)},e.moveTo=function(e,a){t.moveTo(e,a),this.__originalMoveTo(e,a)},e.lineTo=function(e,a){t.lineTo(e,a),this.__originalLineTo(e,a)},e.bezierCurveTo=function(e,a,n,i,r,o){t.bezierCurveTo(e,a,n,i,r,o),this.__originalBezierCurveTo(e,a,n,i,r,o)},e.rect=function(e,a,n,i){t.rect(e,a,n,i),this.__originalRect(e,a,n,i)},e.closePath=function(){t.closePath(),this.__originalClosePath()},e.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}(i,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),ube(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(e){if(!this.current.activeSMask)return;e?(e[0]=Math.floor(e[0]),e[1]=Math.floor(e[1]),e[2]=Math.ceil(e[2]),e[3]=Math.ceil(e[3])):e=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const t=this.current.activeSMask,a=this.suspendedCtx;this.composeSMask(a,t,this.ctx,e),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(e,t,a,n){const i=n[0],r=n[1],o=n[2]-i,s=n[3]-r;0!==o&&0!==s&&(this.genericComposeSMask(t.context,a,o,s,t.subtype,t.backdrop,t.transferMap,i,r,t.offsetX,t.offsetY),e.save(),e.globalAlpha=1,e.globalCompositeOperation="source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(a.canvas,0,0),e.restore())}genericComposeSMask(e,t,a,n,i,r,o,s,l,c,u){let d=e.canvas,h=s-c,m=l-u;if(r){const t=Iye.makeHexColor(...r);if(h<0||m<0||h+a>d.width||m+n>d.height){const e=this.cachedCanvases.getCanvas("maskExtension",a,n),i=e.context;i.drawImage(d,-h,-m),i.globalCompositeOperation="destination-atop",i.fillStyle=t,i.fillRect(0,0,a,n),i.globalCompositeOperation="source-over",d=e.canvas,h=m=0}else{e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);const i=new Path2D;i.rect(h,m,a,n),e.clip(i),e.globalCompositeOperation="destination-atop",e.fillStyle=t,e.fillRect(h,m,a,n),e.restore()}}t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0),"Alpha"===i&&o?t.filter=this.filterFactory.addAlphaFilter(o):"Luminosity"===i&&(t.filter=this.filterFactory.addLuminosityFilter(o));const p=new Path2D;p.rect(s,l,a,n),t.clip(p),t.globalCompositeOperation="destination-in",t.drawImage(d,h,m,a,n,s,l,a,n),t.restore()}save(){this.inSMaskMode?(ube(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const e=this.current;this.stateStack.push(e),this.current=e.clone()}restore(){0===this.stateStack.length&&this.inSMaskMode&&this.endSMaskMode(),0!==this.stateStack.length&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),ube(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(e,t,a,n,i,r){this.ctx.transform(e,t,a,n,i,r),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,t,a){const n=this.ctx,i=this.current;let r,o,s=i.x,l=i.y;const c=cve(n),u=0===c[0]&&0===c[3]||0===c[1]&&0===c[2],d=u?a.slice(0):null;for(let a=0,h=0,m=e.length;a<m;a++)switch(0|e[a]){case cye.rectangle:s=t[h++],l=t[h++];const e=t[h++],a=t[h++],m=s+e,p=l+a;n.moveTo(s,l),0===e||0===a?n.lineTo(m,p):(n.lineTo(m,l),n.lineTo(m,p),n.lineTo(s,p)),u||i.updateRectMinMax(c,[s,l,m,p]),n.closePath();break;case cye.moveTo:s=t[h++],l=t[h++],n.moveTo(s,l),u||i.updatePathMinMax(c,s,l);break;case cye.lineTo:s=t[h++],l=t[h++],n.lineTo(s,l),u||i.updatePathMinMax(c,s,l);break;case cye.curveTo:r=s,o=l,s=t[h+4],l=t[h+5],n.bezierCurveTo(t[h],t[h+1],t[h+2],t[h+3],s,l),i.updateCurvePathMinMax(c,r,o,t[h],t[h+1],t[h+2],t[h+3],s,l,d),h+=6;break;case cye.curveTo2:r=s,o=l,n.bezierCurveTo(s,l,t[h],t[h+1],t[h+2],t[h+3]),i.updateCurvePathMinMax(c,r,o,s,l,t[h],t[h+1],t[h+2],t[h+3],d),s=t[h+2],l=t[h+3],h+=4;break;case cye.curveTo3:r=s,o=l,s=t[h+2],l=t[h+3],n.bezierCurveTo(t[h],t[h+1],s,l,s,l),i.updateCurvePathMinMax(c,r,o,t[h],t[h+1],s,l,s,l,d),h+=4;break;case cye.closePath:n.closePath()}u&&i.updateScalingPathMinMax(c,d),i.setCurrentPoint(s,l)}closePath(){this.ctx.closePath()}stroke(e=!0){const t=this.ctx,a=this.current.strokeColor;t.globalAlpha=this.current.strokeAlpha,this.contentVisible&&("object"==typeof a&&a?.getPattern?(t.save(),t.strokeStyle=a.getPattern(t,this,uve(t),Wve),this.rescaleAndStroke(!1),t.restore()):this.rescaleAndStroke(!0)),e&&this.consumePath(this.current.getClippedPathBoundingBox()),t.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(e=!0){const t=this.ctx,a=this.current.fillColor;let n=!1;this.current.patternFill&&(t.save(),t.fillStyle=a.getPattern(t,this,uve(t),Vve),n=!0);const i=this.current.getClippedPathBoundingBox();this.contentVisible&&null!==i&&(this.pendingEOFill?(t.fill("evenodd"),this.pendingEOFill=!1):t.fill()),n&&t.restore(),e&&this.consumePath(i)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=gbe}eoClip(){this.pendingClip=fbe}beginText(){this.current.textMatrix=yfe,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const e=this.pendingTextPaths,t=this.ctx;if(void 0!==e){t.save(),t.beginPath();for(const a of e)t.setTransform(...a.transform),t.translate(a.x,a.y),a.addToPath(t,a.fontSize);t.restore(),t.clip(),t.beginPath(),delete this.pendingTextPaths}else t.beginPath()}setCharSpacing(e){this.current.charSpacing=e}setWordSpacing(e){this.current.wordSpacing=e}setHScale(e){this.current.textHScale=e/100}setLeading(e){this.current.leading=-e}setFont(e,t){const a=this.commonObjs.get(e),n=this.current;if(!a)throw new Error(`Can't find font for ${e}`);if(n.fontMatrix=a.fontMatrix||vfe,0!==n.fontMatrix[0]&&0!==n.fontMatrix[3]||gye("Invalid font matrix for font "+e),t<0?(t=-t,n.fontDirection=-1):n.fontDirection=1,this.current.font=a,this.current.fontSize=t,a.isType3Font)return;const i=a.loadedName||"sans-serif",r=a.systemFontInfo?.css||`"${i}", ${a.fallbackName}`;let o="normal";a.black?o="900":a.bold&&(o="bold");const s=a.italic?"italic":"normal";let l=t;t<16?l=16:t>100&&(l=100),this.current.fontSizeScale=t/l,this.ctx.font=`${s} ${o} ${l}px ${r}`}setTextRenderingMode(e){this.current.textRenderingMode=e}setTextRise(e){this.current.textRise=e}moveText(e,t){this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=t}setLeadingMoveText(e,t){this.setLeading(-t),this.moveText(e,t)}setTextMatrix(e,t,a,n,i,r){this.current.textMatrix=[e,t,a,n,i,r],this.current.textMatrixScale=Math.hypot(e,t),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(e,t,a,n){const i=this.ctx,r=this.current,o=r.font,s=r.textRenderingMode,l=r.fontSize/r.fontSizeScale,c=s&zfe,u=!!(s&Rfe),d=r.patternFill&&!o.missingFile;let h;if((o.disableFontFace||u||d)&&(h=o.getPathGenerator(this.commonObjs,e)),o.disableFontFace||d?(i.save(),i.translate(t,a),i.beginPath(),h(i,l),n&&i.setTransform(...n),c!==Dfe&&c!==Nfe||i.fill(),c!==Ife&&c!==Nfe||i.stroke(),i.restore()):(c!==Dfe&&c!==Nfe||i.fillText(e,t,a),c!==Ife&&c!==Nfe||i.strokeText(e,t,a)),u){(this.pendingTextPaths||=[]).push({transform:cve(i),x:t,y:a,fontSize:l,addToPath:h})}}get isFontSubpixelAAEnabled(){const{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1),e.fillText("I",0,10);const t=e.getImageData(0,0,10,10).data;let a=!1;for(let e=3;e<t.length;e+=4)if(t[e]>0&&t[e]<255){a=!0;break}return bye(this,"isFontSubpixelAAEnabled",a)}showText(e){const t=this.current,a=t.font;if(a.isType3Font)return this.showType3Text(e);const n=t.fontSize;if(0===n)return;const i=this.ctx,r=t.fontSizeScale,o=t.charSpacing,s=t.wordSpacing,l=t.fontDirection,c=t.textHScale*l,u=e.length,d=a.vertical,h=d?1:-1,m=a.defaultVMetrics,p=n*t.fontMatrix[0],g=t.textRenderingMode===Dfe&&!a.disableFontFace&&!t.patternFill;let f;if(i.save(),i.transform(...t.textMatrix),i.translate(t.x,t.y+t.textRise),l>0?i.scale(c,-1):i.scale(c,1),t.patternFill){i.save();const e=t.fillColor.getPattern(i,this,uve(i),Vve);f=cve(i),i.restore(),i.fillStyle=e}let y=t.lineWidth;const v=t.textMatrixScale;if(0===v||0===y){const e=t.textRenderingMode&zfe;e!==Ife&&e!==Nfe||(y=this.getSinglePixelWidth())}else y/=v;if(1!==r&&(i.scale(r,r),y/=r),i.lineWidth=y,a.isInvalidPDFjsFont){const a=[];let n=0;for(const t of e)a.push(t.unicode),n+=t.width;return i.fillText(a.join(""),0,0),t.x+=n*p*c,i.restore(),void this.compose()}let b,w=0;for(b=0;b<u;++b){const t=e[b];if("number"==typeof t){w+=h*t*n/1e3;continue}let c=!1;const u=(t.isSpace?s:0)+o,y=t.fontChar,v=t.accent;let x,k,A=t.width;if(d){const e=t.vmetric||m,a=-(t.vmetric?e[1]:.5*A)*p,n=e[2]*p;A=e?-e[0]:A,x=a/r,k=(w+n)/r}else x=w/r,k=0;if(a.remeasure&&A>0){const e=1e3*i.measureText(y).width/n*r;if(A<e&&this.isFontSubpixelAAEnabled){const t=A/e;c=!0,i.save(),i.scale(t,1),x/=t}else A!==e&&(x+=(A-e)/2e3*n/r)}if(this.contentVisible&&(t.isInFont||a.missingFile))if(g&&!v)i.fillText(y,x,k);else if(this.paintChar(y,x,k,f),v){const e=x+n*v.offset.x/r,t=k-n*v.offset.y/r;this.paintChar(v.fontChar,e,t,f)}w+=d?A*p-u*l:A*p+u*l,c&&i.restore()}d?t.y-=w:t.x+=w*c,i.restore(),this.compose()}showType3Text(e){const t=this.ctx,a=this.current,n=a.font,i=a.fontSize,r=a.fontDirection,o=n.vertical?1:-1,s=a.charSpacing,l=a.wordSpacing,c=a.textHScale*r,u=a.fontMatrix||vfe,d=e.length;let h,m,p,g;if(!(a.textRenderingMode===jfe)&&0!==i){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,t.save(),t.transform(...a.textMatrix),t.translate(a.x,a.y),t.scale(c,r),h=0;h<d;++h){if(m=e[h],"number"==typeof m){g=o*m*i/1e3,this.ctx.translate(g,0),a.x+=g*c;continue}const r=(m.isSpace?l:0)+s,d=n.charProcOperatorList[m.operatorListId];if(!d){gye(`Type3 character "${m.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=m,this.save(),t.scale(i,i),t.transform(...u),this.executeOperatorList(d),this.restore());p=Iye.applyTransform([m.width,0],u)[0]*i+r,t.translate(p,0),a.x+=p*c}t.restore(),this.processingType3=null}}setCharWidth(e,t){}setCharWidthAndBounds(e,t,a,n,i,r){this.ctx.rect(a,n,i-a,r-n),this.ctx.clip(),this.endPath()}getColorN_Pattern(e){let t;if("TilingPattern"===e[0]){const a=e[1],n=this.baseTransform||cve(this.ctx),i={createCanvasGraphics:e=>new ybe(e,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};t=new abe(e,a,this.ctx,i,n)}else t=this._getPattern(e[1],e[2]);return t}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(e,t,a){this.ctx.strokeStyle=this.current.strokeColor=Iye.makeHexColor(e,t,a)}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent"}setFillRGBColor(e,t,a){this.ctx.fillStyle=this.current.fillColor=Iye.makeHexColor(e,t,a),this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(e,t=null){let a;return this.cachedPatterns.has(e)?a=this.cachedPatterns.get(e):(a=function(e){switch(e[0]){case"RadialAxial":return new Zve(e);case"Mesh":return new Qve(e);case"Dummy":return new Jve}throw new Error(`Unknown IR type: ${e[0]}`)}(this.getObject(e)),this.cachedPatterns.set(e,a)),t&&(a.matrix=t),a}shadingFill(e){if(!this.contentVisible)return;const t=this.ctx;this.save();const a=this._getPattern(e);t.fillStyle=a.getPattern(t,this,uve(t),$ve);const n=uve(t);if(n){const{width:e,height:a}=t.canvas,[i,r,o,s]=Iye.getAxialAlignedBoundingBox([0,0,e,a],n);this.ctx.fillRect(i,r,o-i,s-r)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){fye("Should not call beginInlineImage")}beginImageData(){fye("Should not call beginImageData")}paintFormXObjectBegin(e,t){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),e&&this.transform(...e),this.baseTransform=cve(this.ctx),t)){const e=t[2]-t[0],a=t[3]-t[1];this.ctx.rect(t[0],t[1],e,a),this.current.updateRectMinMax(cve(this.ctx),t),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const t=this.ctx;e.isolated||pye("TODO: Support non-isolated groups."),e.knockout&&gye("Knockout groups not supported.");const a=cve(t);if(e.matrix&&t.transform(...e.matrix),!e.bbox)throw new Error("Bounding box is required.");let n=Iye.getAxialAlignedBoundingBox(e.bbox,cve(t));const i=[0,0,t.canvas.width,t.canvas.height];n=Iye.intersect(n,i)||[0,0,0,0];const r=Math.floor(n[0]),o=Math.floor(n[1]),s=Math.max(Math.ceil(n[2])-r,1),l=Math.max(Math.ceil(n[3])-o,1);this.current.startNewPathAndClipBox([0,0,s,l]);let c="groupAt"+this.groupLevel;e.smask&&(c+="_smask_"+this.smaskCounter++%2);const u=this.cachedCanvases.getCanvas(c,s,l),d=u.context;d.translate(-r,-o),d.transform(...a),e.smask?this.smaskStack.push({canvas:u.canvas,context:d,offsetX:r,offsetY:o,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}):(t.setTransform(1,0,0,1,0,0),t.translate(r,o),t.save()),ube(t,d),this.ctx=d,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(t),this.groupLevel++}endGroup(e){if(!this.contentVisible)return;this.groupLevel--;const t=this.ctx,a=this.groupStack.pop();if(this.ctx=a,this.ctx.imageSmoothingEnabled=!1,e.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const e=cve(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...e);const a=Iye.getAxialAlignedBoundingBox([0,0,t.canvas.width,t.canvas.height],e);this.ctx.drawImage(t.canvas,0,0),this.ctx.restore(),this.compose(a)}}beginAnnotation(e,t,a,n,i){if(this.#zt(),dbe(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),t){const n=t[2]-t[0],r=t[3]-t[1];if(i&&this.annotationCanvasMap){(a=a.slice())[4]-=t[0],a[5]-=t[1],(t=t.slice())[0]=t[1]=0,t[2]=n,t[3]=r;const[i,o]=Iye.singularValueDecompose2dScale(cve(this.ctx)),{viewportScale:s}=this,l=Math.ceil(n*this.outputScaleX*s),c=Math.ceil(r*this.outputScaleY*s);this.annotationCanvas=this.canvasFactory.create(l,c);const{canvas:u,context:d}=this.annotationCanvas;this.annotationCanvasMap.set(e,u),this.annotationCanvas.savedCtx=this.ctx,this.ctx=d,this.ctx.save(),this.ctx.setTransform(i,0,0,-o,0,r*o),dbe(this.ctx)}else dbe(this.ctx),this.endPath(),this.ctx.rect(t[0],t[1],n,r),this.ctx.clip(),this.ctx.beginPath()}this.current=new sbe(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...a),this.transform(...n)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#Rt(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(e){if(!this.contentVisible)return;const t=e.count;(e=this.getObject(e.data,e)).count=t;const a=this.ctx,n=this.processingType3;if(n&&(void 0===n.compiled&&(n.compiled=function(e){const{width:t,height:a}=e;if(t>1e3||a>1e3)return null;const n=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),i=t+1;let r,o,s,l=new Uint8Array(i*(a+1));const c=t+7&-8;let u=new Uint8Array(c*a),d=0;for(const t of e.data){let e=128;for(;e>0;)u[d++]=t&e?0:255,e>>=1}let h=0;for(d=0,0!==u[d]&&(l[0]=1,++h),o=1;o<t;o++)u[d]!==u[d+1]&&(l[o]=u[d]?2:1,++h),d++;for(0!==u[d]&&(l[o]=2,++h),r=1;r<a;r++){d=r*c,s=r*i,u[d-c]!==u[d]&&(l[s]=u[d]?1:8,++h);let e=(u[d]?4:0)+(u[d-c]?8:0);for(o=1;o<t;o++)e=(e>>2)+(u[d+1]?4:0)+(u[d-c+1]?8:0),n[e]&&(l[s+o]=n[e],++h),d++;if(u[d-c]!==u[d]&&(l[s+o]=u[d]?2:4,++h),h>1e3)return null}for(d=c*(a-1),s=r*i,0!==u[d]&&(l[s]=8,++h),o=1;o<t;o++)u[d]!==u[d+1]&&(l[s+o]=u[d]?4:8,++h),d++;if(0!==u[d]&&(l[s+o]=4,++h),h>1e3)return null;const m=new Int32Array([0,i,-1,0,-i,0,0,0,1]),p=new Path2D;for(r=0;h&&r<=a;r++){let e=r*i;const a=e+t;for(;e<a&&!l[e];)e++;if(e===a)continue;p.moveTo(e%i,r);const n=e;let o=l[e];do{const t=m[o];do{e+=t}while(!l[e]);const a=l[e];5!==a&&10!==a?(o=a,l[e]=0):(o=a&51*o>>4,l[e]&=o>>2|o<<2),p.lineTo(e%i,e/i|0),l[e]||--h}while(n!==e);--r}return u=null,l=null,function(e){e.save(),e.scale(1/t,-1/a),e.translate(0,-a),e.fill(p),e.beginPath(),e.restore()}}(e)),n.compiled))return void n.compiled(a);const i=this._createMaskCanvas(e),r=i.canvas;a.save(),a.setTransform(1,0,0,1,0,0),a.drawImage(r,i.offsetX,i.offsetY),a.restore(),this.compose()}paintImageMaskXObjectRepeat(e,t,a=0,n=0,i,r){if(!this.contentVisible)return;e=this.getObject(e.data,e);const o=this.ctx;o.save();const s=cve(o);o.transform(t,a,n,i,0,0);const l=this._createMaskCanvas(e);o.setTransform(1,0,0,1,l.offsetX-s[4],l.offsetY-s[5]);for(let e=0,c=r.length;e<c;e+=2){const c=Iye.transform(s,[t,a,n,i,r[e],r[e+1]]),[u,d]=Iye.applyTransform([0,0],c);o.drawImage(l.canvas,u,d)}o.restore(),this.compose()}paintImageMaskXObjectGroup(e){if(!this.contentVisible)return;const t=this.ctx,a=this.current.fillColor,n=this.current.patternFill;for(const i of e){const{data:e,width:r,height:o,transform:s}=i,l=this.cachedCanvases.getCanvas("maskCanvas",r,o),c=l.context;c.save();cbe(c,this.getObject(e,i)),c.globalCompositeOperation="source-in",c.fillStyle=n?a.getPattern(c,this,uve(t),Vve):a,c.fillRect(0,0,r,o),c.restore(),t.save(),t.transform(...s),t.scale(1,-1),obe(t,l.canvas,0,0,r,o,0,-1,1,1),t.restore()}this.compose()}paintImageXObject(e){if(!this.contentVisible)return;const t=this.getObject(e);t?this.paintInlineImageXObject(t):gye("Dependent image isn't ready yet")}paintImageXObjectRepeat(e,t,a,n){if(!this.contentVisible)return;const i=this.getObject(e);if(!i)return void gye("Dependent image isn't ready yet");const r=i.width,o=i.height,s=[];for(let e=0,i=n.length;e<i;e+=2)s.push({transform:[t,0,0,a,n[e],n[e+1]],x:0,y:0,w:r,h:o});this.paintInlineImageXObjectGroup(i,s)}applyTransferMapsToCanvas(e){return"none"!==this.current.transferMaps&&(e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter="none"),e.canvas}applyTransferMapsToBitmap(e){if("none"===this.current.transferMaps)return e.bitmap;const{bitmap:t,width:a,height:n}=e,i=this.cachedCanvases.getCanvas("inlineImage",a,n),r=i.context;return r.filter=this.current.transferMaps,r.drawImage(t,0,0),r.filter="none",i.canvas}paintInlineImageXObject(e){if(!this.contentVisible)return;const t=e.width,a=e.height,n=this.ctx;if(this.save(),!ffe){const{filter:e}=n;"none"!==e&&""!==e&&(n.filter="none")}let i;if(n.scale(1/t,-1/a),e.bitmap)i=this.applyTransferMapsToBitmap(e);else if("function"==typeof HTMLElement&&e instanceof HTMLElement||!e.data)i=e;else{const n=this.cachedCanvases.getCanvas("inlineImage",t,a).context;lbe(n,e),i=this.applyTransferMapsToCanvas(n)}const r=this._scaleImage(i,uve(n));n.imageSmoothingEnabled=hbe(cve(n),e.interpolate),obe(n,r.img,0,0,r.paintWidth,r.paintHeight,0,-a,t,a),this.compose(),this.restore()}paintInlineImageXObjectGroup(e,t){if(!this.contentVisible)return;const a=this.ctx;let n;if(e.bitmap)n=e.bitmap;else{const t=e.width,a=e.height,i=this.cachedCanvases.getCanvas("inlineImage",t,a).context;lbe(i,e),n=this.applyTransferMapsToCanvas(i)}for(const e of t)a.save(),a.transform(...e.transform),a.scale(1,-1),obe(a,n,e.x,e.y,e.w,e.h,0,-1,1,1),a.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(e){}markPointProps(e,t){}beginMarkedContent(e){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,t){"OC"===e?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(t)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(e){const t=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(e);const a=this.ctx;this.pendingClip&&(t||(this.pendingClip===fbe?a.clip("evenodd"):a.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),a.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=cve(this.ctx);if(0===e[1]&&0===e[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{const t=Math.abs(e[0]*e[3]-e[2]*e[1]),a=Math.hypot(e[0],e[2]),n=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(a,n)/t}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(-1===this._cachedScaleForStroking[0]){const{lineWidth:e}=this.current,{a:t,b:a,c:n,d:i}=this.ctx.getTransform();let r,o;if(0===a&&0===n){const a=Math.abs(t),n=Math.abs(i);if(a===n)if(0===e)r=o=1/a;else{const t=a*e;r=o=t<1?1/t:1}else if(0===e)r=1/a,o=1/n;else{const t=a*e,i=n*e;r=t<1?1/t:1,o=i<1?1/i:1}}else{const s=Math.abs(t*i-a*n),l=Math.hypot(t,a),c=Math.hypot(n,i);if(0===e)r=c/s,o=l/s;else{const t=e*s;r=c>t?c/t:1,o=l>t?l/t:1}}this._cachedScaleForStroking[0]=r,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(e){const{ctx:t}=this,{lineWidth:a}=this.current,[n,i]=this.getScaleForStroking();if(t.lineWidth=a||1,1===n&&1===i)return void t.stroke();const r=t.getLineDash();if(e&&t.save(),t.scale(n,i),r.length>0){const e=Math.max(n,i);t.setLineDash(r.map((t=>t/e))),t.lineDashOffset/=e}t.stroke(),e&&t.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}}for(const e in cye)void 0!==ybe.prototype[e]&&(ybe.prototype[cye[e]]=ybe.prototype[e]);class vbe{static#Lt=null;static#Ft="";static get workerPort(){return this.#Lt}static set workerPort(e){if(!("undefined"!=typeof Worker&&e instanceof Worker)&&null!==e)throw new Error("Invalid `workerPort` type.");this.#Lt=e}static get workerSrc(){return this.#Ft}static set workerSrc(e){if("string"!=typeof e)throw new Error("Invalid `workerSrc` type.");this.#Ft=e}}const bbe=1,wbe=2,xbe=1,kbe=2,Abe=3,Sbe=4,Ebe=5,_be=6,Cbe=7,Tbe=8;function Pbe(e){switch(e instanceof Error||"object"==typeof e&&null!==e||fye('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),e.name){case"AbortException":return new Cye(e.message);case"MissingPDFException":return new Sye(e.message);case"PasswordException":return new xye(e.message,e.code);case"UnexpectedResponseException":return new Eye(e.message,e.status);case"UnknownErrorException":return new kye(e.message,e.details);default:return new kye(e.message,e.toString())}}class Obe{#Bt=new AbortController;constructor(e,t,a){this.sourceName=e,this.targetName=t,this.comObj=a,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),a.addEventListener("message",this.#Ht.bind(this),{signal:this.#Bt.signal})}#Ht({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream)return void this.#qt(e);if(e.callback){const t=e.callbackId,a=this.callbackCapabilities[t];if(!a)throw new Error(`Cannot resolve callback ${t}`);if(delete this.callbackCapabilities[t],e.callback===bbe)a.resolve(e.data);else{if(e.callback!==wbe)throw new Error("Unexpected callback case");a.reject(Pbe(e.reason))}return}const t=this.actionHandler[e.action];if(!t)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const a=this.sourceName,n=e.sourceName,i=this.comObj;new Promise((function(a){a(t(e.data))})).then((function(t){i.postMessage({sourceName:a,targetName:n,callback:bbe,callbackId:e.callbackId,data:t})}),(function(t){i.postMessage({sourceName:a,targetName:n,callback:wbe,callbackId:e.callbackId,reason:Pbe(t)})}))}else e.streamId?this.#Ut(e):t(e.data)}on(e,t){const a=this.actionHandler;if(a[e])throw new Error(`There is already an actionName called "${e}"`);a[e]=t}send(e,t,a){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},a)}sendWithPromise(e,t,a){const n=this.callbackId++,i=Promise.withResolvers();this.callbackCapabilities[n]=i;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:n,data:t},a)}catch(e){i.reject(e)}return i.promise}sendWithStream(e,t,a,n){const i=this.streamId++,r=this.sourceName,o=this.targetName,s=this.comObj;return new ReadableStream({start:a=>{const l=Promise.withResolvers();return this.streamControllers[i]={controller:a,startCall:l,pullCall:null,cancelCall:null,isClosed:!1},s.postMessage({sourceName:r,targetName:o,action:e,streamId:i,data:t,desiredSize:a.desiredSize},n),l.promise},pull:e=>{const t=Promise.withResolvers();return this.streamControllers[i].pullCall=t,s.postMessage({sourceName:r,targetName:o,stream:_be,streamId:i,desiredSize:e.desiredSize}),t.promise},cancel:e=>{yye(e instanceof Error,"cancel must have a valid reason");const t=Promise.withResolvers();return this.streamControllers[i].cancelCall=t,this.streamControllers[i].isClosed=!0,s.postMessage({sourceName:r,targetName:o,stream:xbe,streamId:i,reason:Pbe(e)}),t.promise}},a)}#Ut(e){const t=e.streamId,a=this.sourceName,n=e.sourceName,i=this.comObj,r=this,o=this.actionHandler[e.action],s={enqueue(e,r=1,o){if(this.isCancelled)return;const s=this.desiredSize;this.desiredSize-=r,s>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),i.postMessage({sourceName:a,targetName:n,stream:Sbe,streamId:t,chunk:e},o)},close(){this.isCancelled||(this.isCancelled=!0,i.postMessage({sourceName:a,targetName:n,stream:Abe,streamId:t}),delete r.streamSinks[t])},error(e){yye(e instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,i.postMessage({sourceName:a,targetName:n,stream:Ebe,streamId:t,reason:Pbe(e)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};s.sinkCapability.resolve(),s.ready=s.sinkCapability.promise,this.streamSinks[t]=s,new Promise((function(t){t(o(e.data,s))})).then((function(){i.postMessage({sourceName:a,targetName:n,stream:Tbe,streamId:t,success:!0})}),(function(e){i.postMessage({sourceName:a,targetName:n,stream:Tbe,streamId:t,reason:Pbe(e)})}))}#qt(e){const t=e.streamId,a=this.sourceName,n=e.sourceName,i=this.comObj,r=this.streamControllers[t],o=this.streamSinks[t];switch(e.stream){case Tbe:e.success?r.startCall.resolve():r.startCall.reject(Pbe(e.reason));break;case Cbe:e.success?r.pullCall.resolve():r.pullCall.reject(Pbe(e.reason));break;case _be:if(!o){i.postMessage({sourceName:a,targetName:n,stream:Cbe,streamId:t,success:!0});break}o.desiredSize<=0&&e.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=e.desiredSize,new Promise((function(e){e(o.onPull?.())})).then((function(){i.postMessage({sourceName:a,targetName:n,stream:Cbe,streamId:t,success:!0})}),(function(e){i.postMessage({sourceName:a,targetName:n,stream:Cbe,streamId:t,reason:Pbe(e)})}));break;case Sbe:if(yye(r,"enqueue should have stream controller"),r.isClosed)break;r.controller.enqueue(e.chunk);break;case Abe:if(yye(r,"close should have stream controller"),r.isClosed)break;r.isClosed=!0,r.controller.close(),this.#Vt(r,t);break;case Ebe:yye(r,"error should have stream controller"),r.controller.error(Pbe(e.reason)),this.#Vt(r,t);break;case kbe:e.success?r.cancelCall.resolve():r.cancelCall.reject(Pbe(e.reason)),this.#Vt(r,t);break;case xbe:if(!o)break;new Promise((function(t){t(o.onCancel?.(Pbe(e.reason)))})).then((function(){i.postMessage({sourceName:a,targetName:n,stream:kbe,streamId:t,success:!0})}),(function(e){i.postMessage({sourceName:a,targetName:n,stream:kbe,streamId:t,reason:Pbe(e)})})),o.sinkCapability.reject(Pbe(e.reason)),o.isCancelled=!0,delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}}async#Vt(e,t){await Promise.allSettled([e.startCall?.promise,e.pullCall?.promise,e.cancelCall?.promise]),delete this.streamControllers[t]}destroy(){this.#Bt?.abort(),this.#Bt=null}}class Mbe{#Wt;#$t;constructor({parsedData:e,rawData:t}){this.#Wt=e,this.#$t=t}getRaw(){return this.#$t}get(e){return this.#Wt.get(e)??null}getAll(){return Oye(this.#Wt)}has(e){return this.#Wt.has(e)}}const Dbe=Symbol("INTERNAL");class Ibe{#Gt=!1;#Kt=!1;#Zt=!1;#Yt=!0;constructor(e,{name:t,intent:a,usage:n,rbGroups:i}){this.#Gt=!!(e&xfe),this.#Kt=!!(e&kfe),this.name=t,this.intent=a,this.usage=n,this.rbGroups=i}get visible(){if(this.#Zt)return this.#Yt;if(!this.#Yt)return!1;const{print:e,view:t}=this.usage;return this.#Gt?"OFF"!==t?.viewState:!this.#Kt||"OFF"!==e?.printState}_setVisible(e,t,a=!1){e!==Dbe&&fye("Internal method `_setVisible` called."),this.#Zt=a,this.#Yt=t}}class Nbe{#Xt=null;#Qt=new Map;#Jt=null;#ea=null;constructor(e,t=xfe){if(this.renderingIntent=t,this.name=null,this.creator=null,null!==e){this.name=e.name,this.creator=e.creator,this.#ea=e.order;for(const a of e.groups)this.#Qt.set(a.id,new Ibe(t,a));if("OFF"===e.baseState)for(const e of this.#Qt.values())e._setVisible(Dbe,!1);for(const t of e.on)this.#Qt.get(t)._setVisible(Dbe,!0);for(const t of e.off)this.#Qt.get(t)._setVisible(Dbe,!1);this.#Jt=this.getHash()}}#ta(e){const t=e.length;if(t<2)return!0;const a=e[0];for(let n=1;n<t;n++){const t=e[n];let i;if(Array.isArray(t))i=this.#ta(t);else{if(!this.#Qt.has(t))return gye(`Optional content group not found: ${t}`),!0;i=this.#Qt.get(t).visible}switch(a){case"And":if(!i)return!1;break;case"Or":if(i)return!0;break;case"Not":return!i;default:return!0}}return"And"===a}isVisible(e){if(0===this.#Qt.size)return!0;if(!e)return pye("Optional content group not defined."),!0;if("OCG"===e.type)return this.#Qt.has(e.id)?this.#Qt.get(e.id).visible:(gye(`Optional content group not found: ${e.id}`),!0);if("OCMD"===e.type){if(e.expression)return this.#ta(e.expression);if(!e.policy||"AnyOn"===e.policy){for(const t of e.ids){if(!this.#Qt.has(t))return gye(`Optional content group not found: ${t}`),!0;if(this.#Qt.get(t).visible)return!0}return!1}if("AllOn"===e.policy){for(const t of e.ids){if(!this.#Qt.has(t))return gye(`Optional content group not found: ${t}`),!0;if(!this.#Qt.get(t).visible)return!1}return!0}if("AnyOff"===e.policy){for(const t of e.ids){if(!this.#Qt.has(t))return gye(`Optional content group not found: ${t}`),!0;if(!this.#Qt.get(t).visible)return!0}return!1}if("AllOff"===e.policy){for(const t of e.ids){if(!this.#Qt.has(t))return gye(`Optional content group not found: ${t}`),!0;if(this.#Qt.get(t).visible)return!1}return!0}return gye(`Unknown optional content policy ${e.policy}.`),!0}return gye(`Unknown group type ${e.type}.`),!0}setVisibility(e,t=!0,a=!0){const n=this.#Qt.get(e);if(n){if(a&&t&&n.rbGroups.length)for(const t of n.rbGroups)for(const a of t)a!==e&&this.#Qt.get(a)?._setVisible(Dbe,!1,!0);n._setVisible(Dbe,!!t,!0),this.#Xt=null}else gye(`Optional content group not found: ${e}`)}setOCGState({state:e,preserveRB:t}){let a;for(const n of e){switch(n){case"ON":case"OFF":case"Toggle":a=n;continue}const e=this.#Qt.get(n);if(e)switch(a){case"ON":this.setVisibility(n,!0,t);break;case"OFF":this.setVisibility(n,!1,t);break;case"Toggle":this.setVisibility(n,!e.visible,t)}}this.#Xt=null}get hasInitialVisibility(){return null===this.#Jt||this.getHash()===this.#Jt}getOrder(){return this.#Qt.size?this.#ea?this.#ea.slice():[...this.#Qt.keys()]:null}getGroups(){return this.#Qt.size>0?Oye(this.#Qt):null}getGroup(e){return this.#Qt.get(e)||null}getHash(){if(null!==this.#Xt)return this.#Xt;const e=new Tve;for(const[t,a]of this.#Qt)e.update(`${t}:${a.visible}`);return this.#Xt=e.hexdigest()}}class jbe{constructor(e,{disableRange:t=!1,disableStream:a=!1}){yye(e,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:n,initialData:i,progressiveDone:r,contentDispositionFilename:o}=e;if(this._queuedChunks=[],this._progressiveDone=r,this._contentDispositionFilename=o,i?.length>0){const e=i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer;this._queuedChunks.push(e)}this._pdfDataRangeTransport=e,this._isStreamingSupported=!a,this._isRangeSupported=!t,this._contentLength=n,this._fullRequestReader=null,this._rangeReaders=[],e.addRangeListener(((e,t)=>{this._onReceiveData({begin:e,chunk:t})})),e.addProgressListener(((e,t)=>{this._onProgress({loaded:e,total:t})})),e.addProgressiveReadListener((e=>{this._onReceiveData({chunk:e})})),e.addProgressiveDoneListener((()=>{this._onProgressiveDone()})),e.transportReady()}_onReceiveData({begin:e,chunk:t}){const a=t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer;if(void 0===e)this._fullRequestReader?this._fullRequestReader._enqueue(a):this._queuedChunks.push(a);else{yye(this._rangeReaders.some((function(t){return t._begin===e&&(t._enqueue(a),!0)})),"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(e){void 0===e.total?this._rangeReaders[0]?.onProgress?.({loaded:e.loaded}):this._fullRequestReader?.onProgress?.({loaded:e.loaded,total:e.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){const t=this._rangeReaders.indexOf(e);t>=0&&this._rangeReaders.splice(t,1)}getFullReader(){yye(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;return this._queuedChunks=null,new zbe(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const a=new Rbe(this,e,t);return this._pdfDataRangeTransport.requestDataRange(e,t),this._rangeReaders.push(a),a}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeReaders.slice(0))t.cancel(e);this._pdfDataRangeTransport.abort()}}class zbe{constructor(e,t,a=!1,n=null){this._stream=e,this._done=a||!1,this._filename=Jye(n)?n:null,this._queuedChunks=t||[],this._loaded=0;for(const e of this._queuedChunks)this._loaded+=e.byteLength;this._requests=[],this._headersReady=Promise.resolve(),e._fullRequestReader=this,this.onProgress=null}_enqueue(e){if(!this._done){if(this._requests.length>0){this._requests.shift().resolve({value:e,done:!1})}else this._queuedChunks.push(e);this._loaded+=e.byteLength}}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0){return{value:this._queuedChunks.shift(),done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class Rbe{constructor(e,t,a){this._stream=e,this._begin=t,this._end=a,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(e){if(!this._done){if(0===this._requests.length)this._queuedChunk=e;else{this._requests.shift().resolve({value:e,done:!1});for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function Lbe(e,t){const a=new Headers;if(!e||!t||"object"!=typeof t)return a;for(const e in t){const n=t[e];void 0!==n&&a.append(e,n)}return a}function Fbe({responseHeaders:e,isHttp:t,rangeChunkSize:a,disableRange:n}){const i={allowRangeRequests:!1,suggestedLength:void 0},r=parseInt(e.get("Content-Length"),10);if(!Number.isInteger(r))return i;if(i.suggestedLength=r,r<=2*a)return i;if(n||!t)return i;if("bytes"!==e.get("Accept-Ranges"))return i;return"identity"!==(e.get("Content-Encoding")||"identity")||(i.allowRangeRequests=!0),i}function Bbe(e){const t=e.get("Content-Disposition");if(t){let e=function(e){let t=!0,a=n("filename\\*","i").exec(e);if(a){a=a[1];let e=o(a);return e=unescape(e),e=s(e),e=l(e),r(e)}if(a=function(e){const t=[];let a;const i=n("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(a=i.exec(e));){let[,e,n,i]=a;if(e=parseInt(e,10),e in t){if(0===e)break}else t[e]=[n,i]}const r=[];for(let e=0;e<t.length&&e in t;++e){let[a,n]=t[e];n=o(n),a&&(n=unescape(n),0===e&&(n=s(n))),r.push(n)}return r.join("")}(e),a)return r(l(a));if(a=n("filename","i").exec(e),a){a=a[1];let e=o(a);return e=l(e),r(e)}function n(e,t){return new RegExp("(?:^|;)\\s*"+e+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',t)}function i(e,a){if(e){if(!/^[\x00-\xFF]+$/.test(a))return a;try{const n=new TextDecoder(e,{fatal:!0}),i=Pye(a);a=n.decode(i),t=!1}catch{}}return a}function r(e){return t&&/[\x80-\xff]/.test(e)&&(e=i("utf-8",e),t&&(e=i("iso-8859-1",e))),e}function o(e){if(e.startsWith('"')){const t=e.slice(1).split('\\"');for(let e=0;e<t.length;++e){const a=t[e].indexOf('"');-1!==a&&(t[e]=t[e].slice(0,a),t.length=e+1),t[e]=t[e].replaceAll(/\\(.)/g,"$1")}e=t.join('"')}return e}function s(e){const t=e.indexOf("'");return-1===t?e:i(e.slice(0,t),e.slice(t+1).replace(/^[^']*'/,""))}function l(e){return!e.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(e)?e:e.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,(function(e,t,a,n){if("q"===a||"Q"===a)return n=(n=n.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,(function(e,t){return String.fromCharCode(parseInt(t,16))})),i(t,n);try{n=atob(n)}catch{}return i(t,n)}))}return""}(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if(Jye(e))return e}return null}function Hbe(e,t){return 404===e||0===e&&t.startsWith("file:")?new Sye('Missing PDF "'+t+'".'):new Eye(`Unexpected server response (${e}) while retrieving PDF "${t}".`,e)}function qbe(e){return 200===e||206===e}function Ube(e,t,a){return{method:"GET",headers:e,signal:a.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function Vbe(e){return e instanceof Uint8Array?e.buffer:e instanceof ArrayBuffer?e:(gye(`getArrayBuffer - unexpected data format: ${e}`),new Uint8Array(e).buffer)}class Wbe{constructor(e){this.source=e,this.isHttp=/^https?:/i.test(e.url),this.headers=Lbe(this.isHttp,e.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return yye(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new $be(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const a=new Gbe(this,e,t);return this._rangeRequestReaders.push(a),a}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}}class $be{constructor(e){this._stream=e,this._reader=null,this._loaded=0,this._filename=null;const t=e.source;this._withCredentials=t.withCredentials||!1,this._contentLength=t.length,this._headersCapability=Promise.withResolvers(),this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange;const a=new Headers(e.headers),n=t.url;fetch(n,Ube(a,this._withCredentials,this._abortController)).then((t=>{if(!qbe(t.status))throw Hbe(t.status,n);this._reader=t.body.getReader(),this._headersCapability.resolve();const a=t.headers,{allowRangeRequests:i,suggestedLength:r}=Fbe({responseHeaders:a,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=i,this._contentLength=r||this._contentLength,this._filename=Bbe(a),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Cye("Streaming is disabled."))})).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._headersCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:Vbe(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}class Gbe{constructor(e,t,a){this._stream=e,this._reader=null,this._loaded=0;const n=e.source;this._withCredentials=n.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!n.disableStream,this._abortController=new AbortController;const i=new Headers(e.headers);i.append("Range",`bytes=${t}-${a-1}`);const r=n.url;fetch(r,Ube(i,this._withCredentials,this._abortController)).then((e=>{if(!qbe(e.status))throw Hbe(e.status,r);this._readCapability.resolve(),this._reader=e.body.getReader()})).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded}),{value:Vbe(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}class Kbe{constructor({url:e,httpHeaders:t,withCredentials:a}){this.url=e,this.isHttp=/^https?:/i.test(e),this.headers=Lbe(this.isHttp,t),this.withCredentials=a||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(e,t,a){const n={begin:e,end:t};for(const e in a)n[e]=a[e];return this.request(n)}requestFull(e){return this.request(e)}request(e){const t=new XMLHttpRequest,a=this.currXhrId++,n=this.pendingRequests[a]={xhr:t};t.open("GET",this.url),t.withCredentials=this.withCredentials;for(const[e,a]of this.headers)t.setRequestHeader(e,a);return this.isHttp&&"begin"in e&&"end"in e?(t.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),n.expectedStatus=206):n.expectedStatus=200,t.responseType="arraybuffer",e.onError&&(t.onerror=function(a){e.onError(t.status)}),t.onreadystatechange=this.onStateChange.bind(this,a),t.onprogress=this.onProgress.bind(this,a),n.onHeadersReceived=e.onHeadersReceived,n.onDone=e.onDone,n.onError=e.onError,n.onProgress=e.onProgress,t.send(null),a}onProgress(e,t){const a=this.pendingRequests[e];a&&a.onProgress?.(t)}onStateChange(e,t){const a=this.pendingRequests[e];if(!a)return;const n=a.xhr;if(n.readyState>=2&&a.onHeadersReceived&&(a.onHeadersReceived(),delete a.onHeadersReceived),4!==n.readyState)return;if(!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],0===n.status&&this.isHttp)return void a.onError?.(n.status);const i=n.status||200;if(!(200===i&&206===a.expectedStatus)&&i!==a.expectedStatus)return void a.onError?.(n.status);const r=function(e){const t=e.response;return"string"!=typeof t?t:Pye(t).buffer}(n);if(206===i){const e=n.getResponseHeader("Content-Range"),t=/bytes (\d+)-(\d+)\/(\d+)/.exec(e);a.onDone({begin:parseInt(t[1],10),chunk:r})}else r?a.onDone({begin:0,chunk:r}):a.onError?.(n.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){const t=this.pendingRequests[e].xhr;delete this.pendingRequests[e],t.abort()}}class Zbe{constructor(e){this._source=e,this._manager=new Kbe(e),this._rangeChunkSize=e.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(e){const t=this._rangeRequestReaders.indexOf(e);t>=0&&this._rangeRequestReaders.splice(t,1)}getFullReader(){return yye(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new Ybe(this._manager,this._source),this._fullRequestReader}getRangeReader(e,t){const a=new Xbe(this._manager,e,t);return a.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(a),a}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}}class Ybe{constructor(e,t){this._manager=e;const a={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._fullRequestId=e.requestFull(a),this._headersCapability=Promise.withResolvers(),this._disableRange=t.disableRange||!1,this._contentLength=t.length,this._rangeChunkSize=t.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const e=this._fullRequestId,t=this._manager.getRequestXhr(e),a=new Headers(t.getAllResponseHeaders().trim().split(/[\r\n]+/).map((e=>{const[t,...a]=e.split(": ");return[t,a.join(": ")]}))),{allowRangeRequests:n,suggestedLength:i}=Fbe({responseHeaders:a,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});n&&(this._isRangeSupported=!0),this._contentLength=i||this._contentLength,this._filename=Bbe(a),this._isRangeSupported&&this._manager.abortRequest(e),this._headersCapability.resolve()}_onDone(e){if(e)if(this._requests.length>0){this._requests.shift().resolve({value:e.chunk,done:!1})}else this._cachedChunks.push(e.chunk);if(this._done=!0,!(this._cachedChunks.length>0)){for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(e){this._storedError=Hbe(e,this._url),this._headersCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0){return{value:this._cachedChunks.shift(),done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersCapability.reject(e);for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class Xbe{constructor(e,t,a){this._manager=e;const n={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._requestId=e.requestRange(t,a,n),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){this.onClosed?.(this)}_onDone(e){const t=e.chunk;if(this._requests.length>0){this._requests.shift().resolve({value:t,done:!1})}else this._queuedChunk=t;this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(e){this._storedError=Hbe(e,this._url);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){this.isStreamingSupported||this.onProgress?.({loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const Qbe=/^[a-z][a-z0-9\-+.]+:/i;function Jbe(e,t,a){if("http:"===e.protocol){return qve.get("http").request(e,{headers:t},a)}return qve.get("https").request(e,{headers:t},a)}class ewe{constructor(e){this.source=e,this.url=function(e){if(Qbe.test(e))return new URL(e);const t=qve.get("url");return new URL(t.pathToFileURL(e))}(e.url),this.isHttp="http:"===this.url.protocol||"https:"===this.url.protocol,this.isFsUrl="file:"===this.url.protocol,this.headers=Lbe(this.isHttp,e.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return yye(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new rwe(this):new nwe(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const a=this.isFsUrl?new owe(this,e,t):new iwe(this,e,t);return this._rangeRequestReaders.push(a),a}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}}class twe{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null;const t=e.source;this._contentLength=t.length,this._loaded=0,this._filename=null,this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers()}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();if(null===e)return this._readCapability=Promise.withResolvers(),this.read();this._loaded+=e.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength});return{value:new Uint8Array(e).buffer,done:!1}}cancel(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",(()=>{this._readCapability.resolve()})),e.on("end",(()=>{e.destroy(),this._done=!0,this._readCapability.resolve()})),e.on("error",(e=>{this._error(e)})),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new Cye("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class awe{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const t=e.source;this._isStreamingSupported=!t.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();if(null===e)return this._readCapability=Promise.withResolvers(),this.read();this._loaded+=e.length,this.onProgress?.({loaded:this._loaded});return{value:new Uint8Array(e).buffer,done:!1}}cancel(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",(()=>{this._readCapability.resolve()})),e.on("end",(()=>{e.destroy(),this._done=!0,this._readCapability.resolve()})),e.on("error",(e=>{this._error(e)})),this._storedError&&this._readableStream.destroy(this._storedError)}}class nwe extends twe{constructor(e){super(e);const t=Object.fromEntries(e.headers);this._request=Jbe(this._url,t,(t=>{if(404===t.statusCode){const e=new Sye(`Missing PDF "${this._url}".`);return this._storedError=e,void this._headersCapability.reject(e)}this._headersCapability.resolve(),this._setReadableStream(t);const a=new Headers(this._readableStream.headers),{allowRangeRequests:n,suggestedLength:i}=Fbe({responseHeaders:a,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=n,this._contentLength=i||this._contentLength,this._filename=Bbe(a)})),this._request.on("error",(e=>{this._storedError=e,this._headersCapability.reject(e)})),this._request.end()}}class iwe extends awe{constructor(e,t,a){super(e);const n=Object.fromEntries(e.headers);n.Range=`bytes=${t}-${a-1}`;this._request=Jbe(this._url,n,(e=>{if(404!==e.statusCode)this._setReadableStream(e);else{const e=new Sye(`Missing PDF "${this._url}".`);this._storedError=e}})),this._request.on("error",(e=>{this._storedError=e})),this._request.end()}}class rwe extends twe{constructor(e){super(e);const t=qve.get("fs");t.promises.lstat(this._url).then((e=>{this._contentLength=e.size,this._setReadableStream(t.createReadStream(this._url)),this._headersCapability.resolve()}),(e=>{"ENOENT"===e.code&&(e=new Sye(`Missing PDF "${this._url}".`)),this._storedError=e,this._headersCapability.reject(e)}))}}class owe extends awe{constructor(e,t,a){super(e);const n=qve.get("fs");this._setReadableStream(n.createReadStream(this._url,{start:t,end:a-1}))}}const swe=30;let lwe=class e{#aa=Promise.withResolvers();#he=null;#na=!1;#ia=!!globalThis.FontInspector?.enabled;#ra=null;#oa=null;#sa=0;#la=0;#ca=null;#ua=null;#da=0;#ha=0;#ma=Object.create(null);#pa=[];#ga=null;#fa=[];#ya=new WeakMap;#va=null;static#ba=new Map;static#wa=new Map;static#xa=new WeakMap;static#ka=null;static#Aa=new Set;constructor({textContentSource:t,container:a,viewport:n}){if(t instanceof ReadableStream)this.#ga=t;else{if("object"!=typeof t)throw new Error('No "textContentSource" parameter specified.');this.#ga=new ReadableStream({start(e){e.enqueue(t),e.close()}})}this.#he=this.#ua=a,this.#ha=n.scale*(globalThis.devicePixelRatio||1),this.#da=n.rotation,this.#oa={div:null,properties:null,ctx:null};const{pageWidth:i,pageHeight:r,pageX:o,pageY:s}=n.rawDims;this.#va=[1,0,0,-1,-o,s+r],this.#la=i,this.#sa=r,e.#Sa(),dve(a,n),this.#aa.promise.finally((()=>{e.#Aa.delete(this),this.#oa=null,this.#ma=null})).catch((()=>{}))}static get fontFamilyMap(){const{isWindows:e,isFirefox:t}=Mye.platform;return bye(this,"fontFamilyMap",new Map([["sans-serif",(e&&t?"Calibri, ":"")+"sans-serif"],["monospace",(e&&t?"Lucida Console, ":"")+"monospace"]]))}render(){const t=()=>{this.#ca.read().then((({value:e,done:a})=>{a?this.#aa.resolve():(this.#ra??=e.lang,Object.assign(this.#ma,e.styles),this.#Ea(e.items),t())}),this.#aa.reject)};return this.#ca=this.#ga.getReader(),e.#Aa.add(this),t(),this.#aa.promise}update({viewport:t,onBefore:a=null}){const n=t.scale*(globalThis.devicePixelRatio||1),i=t.rotation;if(i!==this.#da&&(a?.(),this.#da=i,dve(this.#ua,{rotation:i})),n!==this.#ha){a?.(),this.#ha=n;const t={div:null,properties:null,ctx:e.#_a(this.#ra)};for(const e of this.#fa)t.properties=this.#ya.get(e),t.div=e,this.#Ca(t)}}cancel(){const e=new Cye("TextLayer task cancelled.");this.#ca?.cancel(e).catch((()=>{})),this.#ca=null,this.#aa.reject(e)}get textDivs(){return this.#fa}get textContentItemsStr(){return this.#pa}#Ea(t){if(this.#na)return;this.#oa.ctx??=e.#_a(this.#ra);const a=this.#fa,n=this.#pa;for(const e of t){if(a.length>1e5)return gye("Ignoring additional textDivs for performance reasons."),void(this.#na=!0);if(void 0!==e.str)n.push(e.str),this.#Ta(e);else if("beginMarkedContentProps"===e.type||"beginMarkedContent"===e.type){const t=this.#he;this.#he=document.createElement("span"),this.#he.classList.add("markedContent"),null!==e.id&&this.#he.setAttribute("id",`${e.id}`),t.append(this.#he)}else"endMarkedContent"===e.type&&(this.#he=this.#he.parentNode)}}#Ta(t){const a=document.createElement("span"),n={angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,fontSize:0};this.#fa.push(a);const i=Iye.transform(this.#va,t.transform);let r=Math.atan2(i[1],i[0]);const o=this.#ma[t.fontName];o.vertical&&(r+=Math.PI/2);let s=this.#ia&&o.fontSubstitution||o.fontFamily;s=e.fontFamilyMap.get(s)||s;const l=Math.hypot(i[2],i[3]),c=l*e.#Pa(s,this.#ra);let u,d;0===r?(u=i[4],d=i[5]-c):(u=i[4]+c*Math.sin(r),d=i[5]-c*Math.cos(r));const h="calc(var(--scale-factor)*",m=a.style;this.#he===this.#ua?(m.left=`${(100*u/this.#la).toFixed(2)}%`,m.top=`${(100*d/this.#sa).toFixed(2)}%`):(m.left=`${h}${u.toFixed(2)}px)`,m.top=`${h}${d.toFixed(2)}px)`),m.fontSize=`${h}${(e.#ka*l).toFixed(2)}px)`,m.fontFamily=s,n.fontSize=l,a.setAttribute("role","presentation"),a.textContent=t.str,a.dir=t.dir,this.#ia&&(a.dataset.fontName=o.fontSubstitutionLoadedName||t.fontName),0!==r&&(n.angle=r*(180/Math.PI));let p=!1;if(t.str.length>1)p=!0;else if(" "!==t.str&&t.transform[0]!==t.transform[3]){const e=Math.abs(t.transform[0]),a=Math.abs(t.transform[3]);e!==a&&Math.max(e,a)/Math.min(e,a)>1.5&&(p=!0)}if(p&&(n.canvasWidth=o.vertical?t.height:t.width),this.#ya.set(a,n),this.#oa.div=a,this.#oa.properties=n,this.#Ca(this.#oa),n.hasText&&this.#he.append(a),n.hasEOL){const e=document.createElement("br");e.setAttribute("role","presentation"),this.#he.append(e)}}#Ca(t){const{div:a,properties:n,ctx:i}=t,{style:r}=a;let o="";if(e.#ka>1&&(o=`scale(${1/e.#ka})`),0!==n.canvasWidth&&n.hasText){const{fontFamily:t}=r,{canvasWidth:s,fontSize:l}=n;e.#Oa(i,l*this.#ha,t);const{width:c}=i.measureText(a.textContent);c>0&&(o=`scaleX(${s*this.#ha/c}) ${o}`)}0!==n.angle&&(o=`rotate(${n.angle}deg) ${o}`),o.length>0&&(r.transform=o)}static cleanup(){if(!(this.#Aa.size>0)){this.#ba.clear();for(const{canvas:e}of this.#wa.values())e.remove();this.#wa.clear()}}static#_a(e=null){let t=this.#wa.get(e||="");if(!t){const a=document.createElement("canvas");a.className="hiddenCanvasElement",a.lang=e,document.body.append(a),t=a.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.#wa.set(e,t),this.#xa.set(t,{size:0,family:""})}return t}static#Oa(e,t,a){const n=this.#xa.get(e);t===n.size&&a===n.family||(e.font=`${t}px ${a}`,n.size=t,n.family=a)}static#Sa(){if(null!==this.#ka)return;const e=document.createElement("div");e.style.opacity=0,e.style.lineHeight=1,e.style.fontSize="1px",e.style.position="absolute",e.textContent="X",document.body.append(e),this.#ka=e.getBoundingClientRect().height,e.remove()}static#Pa(e,t){const a=this.#ba.get(e);if(a)return a;const n=this.#_a(t);n.canvas.width=n.canvas.height=swe,this.#Oa(n,swe,e);const i=n.measureText("");let r=i.fontBoundingBoxAscent,o=Math.abs(i.fontBoundingBoxDescent);if(r){const t=r/(r+o);return this.#ba.set(e,t),n.canvas.width=n.canvas.height=0,t}n.strokeStyle="red",n.clearRect(0,0,swe,swe),n.strokeText("g",0,0);let s=n.getImageData(0,0,swe,swe).data;o=0;for(let e=s.length-1-3;e>=0;e-=4)if(s[e]>0){o=Math.ceil(e/4/swe);break}n.clearRect(0,0,swe,swe),n.strokeText("A",0,swe),s=n.getImageData(0,0,swe,swe).data,r=0;for(let e=0,t=s.length;e<t;e+=4)if(s[e]>0){r=swe-Math.floor(e/4/swe);break}n.canvas.width=n.canvas.height=0;const l=r?r/(r+o):.8;return this.#ba.set(e,l),l}};class cwe{static textContent(e){const t=[],a={items:t,styles:Object.create(null)};return function e(a){if(!a)return;let n=null;const i=a.name;if("#text"===i)n=a.value;else{if(!cwe.shouldBuildText(i))return;a?.attributes?.textContent?n=a.attributes.textContent:a.value&&(n=a.value)}if(null!==n&&t.push({str:n}),a.children)for(const t of a.children)e(t)}(e),a}static shouldBuildText(e){return!("textarea"===e||"input"===e||"option"===e||"select"===e)}}const uwe=65536,dwe=ffe?class extends Nve{_createCanvas(e,t){return qve.get("canvas").createCanvas(e,t)}}:class extends Nve{constructor({ownerDocument:e=globalThis.document,enableHWA:t=!1}){super({enableHWA:t}),this._document=e}_createCanvas(e,t){const a=this._document.createElement("canvas");return a.width=e,a.height=t,a}},hwe=ffe?class extends jve{async _fetch(e){return Uve(e)}}:zve,mwe=ffe?class extends Rve{}:class extends Rve{#Ma;#Da;#Ia;#Na;#ja;#za;#b=0;constructor({docId:e,ownerDocument:t=globalThis.document}){super(),this.#Na=e,this.#ja=t}get#x(){return this.#Da||=new Map}get#Ra(){return this.#za||=new Map}get#La(){if(!this.#Ia){const e=this.#ja.createElement("div"),{style:t}=e;t.visibility="hidden",t.contain="strict",t.width=t.height=0,t.position="absolute",t.top=t.left=0,t.zIndex=-1;const a=this.#ja.createElementNS(Gye,"svg");a.setAttribute("width",0),a.setAttribute("height",0),this.#Ia=this.#ja.createElementNS(Gye,"defs"),e.append(a),a.append(this.#Ia),this.#ja.body.append(e)}return this.#Ia}#Fa(e){if(1===e.length){const t=e[0],a=new Array(256);for(let e=0;e<256;e++)a[e]=t[e]/255;const n=a.join(",");return[n,n,n]}const[t,a,n]=e,i=new Array(256),r=new Array(256),o=new Array(256);for(let e=0;e<256;e++)i[e]=t[e]/255,r[e]=a[e]/255,o[e]=n[e]/255;return[i.join(","),r.join(","),o.join(",")]}#Ba(e){if(void 0===this.#Ma){this.#Ma="";const e=this.#ja.URL;e!==this.#ja.baseURI&&(Qye(e)?gye('#createUrl: ignore "data:"-URL for performance reasons.'):this.#Ma=e.split("#",1)[0])}return`url(${this.#Ma}#${e})`}addFilter(e){if(!e)return"none";let t=this.#x.get(e);if(t)return t;const[a,n,i]=this.#Fa(e),r=1===e.length?a:`${a}${n}${i}`;if(t=this.#x.get(r),t)return this.#x.set(e,t),t;const o=`g_${this.#Na}_transfer_map_${this.#b++}`,s=this.#Ba(o);this.#x.set(e,s),this.#x.set(r,s);const l=this.#Ha(o);return this.#qa(a,n,i,l),s}addHCMFilter(e,t){const a=`${e}-${t}`,n="base";let i=this.#Ra.get(n);if(i?.key===a)return i.url;if(i?(i.filter?.remove(),i.key=a,i.url="none",i.filter=null):(i={key:a,url:"none",filter:null},this.#Ra.set(n,i)),!e||!t)return i.url;const r=this.#Ua(e);e=Iye.makeHexColor(...r);const o=this.#Ua(t);if(t=Iye.makeHexColor(...o),this.#La.style.color="","#000000"===e&&"#ffffff"===t||e===t)return i.url;const s=new Array(256);for(let e=0;e<=255;e++){const t=e/255;s[e]=t<=.03928?t/12.92:((t+.055)/1.055)**2.4}const l=s.join(","),c=`g_${this.#Na}_hcm_filter`,u=i.filter=this.#Ha(c);this.#qa(l,l,l,u),this.#Va(u);const d=(e,t)=>{const a=r[e]/255,n=o[e]/255,i=new Array(t+1);for(let e=0;e<=t;e++)i[e]=a+e/t*(n-a);return i.join(",")};return this.#qa(d(0,5),d(1,5),d(2,5),u),i.url=this.#Ba(c),i.url}addAlphaFilter(e){let t=this.#x.get(e);if(t)return t;const[a]=this.#Fa([e]),n=`alpha_${a}`;if(t=this.#x.get(n),t)return this.#x.set(e,t),t;const i=`g_${this.#Na}_alpha_map_${this.#b++}`,r=this.#Ba(i);this.#x.set(e,r),this.#x.set(n,r);const o=this.#Ha(i);return this.#Wa(a,o),r}addLuminosityFilter(e){let t,a,n=this.#x.get(e||"luminosity");if(n)return n;if(e?([t]=this.#Fa([e]),a=`luminosity_${t}`):a="luminosity",n=this.#x.get(a),n)return this.#x.set(e,n),n;const i=`g_${this.#Na}_luminosity_map_${this.#b++}`,r=this.#Ba(i);this.#x.set(e,r),this.#x.set(a,r);const o=this.#Ha(i);return this.#$a(o),e&&this.#Wa(t,o),r}addHighlightHCMFilter(e,t,a,n,i){const r=`${t}-${a}-${n}-${i}`;let o=this.#Ra.get(e);if(o?.key===r)return o.url;if(o?(o.filter?.remove(),o.key=r,o.url="none",o.filter=null):(o={key:r,url:"none",filter:null},this.#Ra.set(e,o)),!t||!a)return o.url;const[s,l]=[t,a].map(this.#Ua.bind(this));let c=Math.round(.2126*s[0]+.7152*s[1]+.0722*s[2]),u=Math.round(.2126*l[0]+.7152*l[1]+.0722*l[2]),[d,h]=[n,i].map(this.#Ua.bind(this));u<c&&([c,u,d,h]=[u,c,h,d]),this.#La.style.color="";const m=(e,t,a)=>{const n=new Array(256),i=(u-c)/a,r=e/255,o=(t-e)/(255*a);let s=0;for(let e=0;e<=a;e++){const t=Math.round(c+e*i),a=r+e*o;for(let e=s;e<=t;e++)n[e]=a;s=t+1}for(let e=s;e<256;e++)n[e]=n[s-1];return n.join(",")},p=`g_${this.#Na}_hcm_${e}_filter`,g=o.filter=this.#Ha(p);return this.#Va(g),this.#qa(m(d[0],h[0],5),m(d[1],h[1],5),m(d[2],h[2],5),g),o.url=this.#Ba(p),o.url}destroy(e=!1){e&&0!==this.#Ra.size||(this.#Ia&&(this.#Ia.parentNode.parentNode.remove(),this.#Ia=null),this.#Da&&(this.#Da.clear(),this.#Da=null),this.#b=0)}#$a(e){const t=this.#ja.createElementNS(Gye,"feColorMatrix");t.setAttribute("type","matrix"),t.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),e.append(t)}#Va(e){const t=this.#ja.createElementNS(Gye,"feColorMatrix");t.setAttribute("type","matrix"),t.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),e.append(t)}#Ha(e){const t=this.#ja.createElementNS(Gye,"filter");return t.setAttribute("color-interpolation-filters","sRGB"),t.setAttribute("id",e),this.#La.append(t),t}#Ga(e,t,a){const n=this.#ja.createElementNS(Gye,t);n.setAttribute("type","discrete"),n.setAttribute("tableValues",a),e.append(n)}#qa(e,t,a,n){const i=this.#ja.createElementNS(Gye,"feComponentTransfer");n.append(i),this.#Ga(i,"feFuncR",e),this.#Ga(i,"feFuncG",t),this.#Ga(i,"feFuncB",a)}#Wa(e,t){const a=this.#ja.createElementNS(Gye,"feComponentTransfer");t.append(a),this.#Ga(a,"feFuncA",e)}#Ua(e){return this.#La.style.color=e,lve(getComputedStyle(this.#La).getPropertyValue("color"))}},pwe=ffe?class extends Lve{async _fetch(e){return Uve(e)}}:Fve;function gwe(e={}){"string"==typeof e||e instanceof URL?e={url:e}:(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});const t=new ywe,{docId:a}=t,n=e.url?function(e){if(e instanceof URL)return e.href;try{return new URL(e,window.location).href}catch{if(ffe&&"string"==typeof e)return e}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}(e.url):null,i=e.data?function(e){if(ffe&&"undefined"!=typeof Buffer&&e instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength)return e;if("string"==typeof e)return Pye(e);if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)||"object"==typeof e&&!isNaN(e?.length))return new Uint8Array(e);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}(e.data):null,r=e.httpHeaders||null,o=!0===e.withCredentials,s=e.password??null,l=e.range instanceof vwe?e.range:null,c=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:uwe;let u=e.worker instanceof kwe?e.worker:null;const d=e.verbosity,h="string"!=typeof e.docBaseUrl||Qye(e.docBaseUrl)?null:e.docBaseUrl,m="string"==typeof e.cMapUrl?e.cMapUrl:null,p=!1!==e.cMapPacked,g=e.CMapReaderFactory||hwe,f="string"==typeof e.standardFontDataUrl?e.standardFontDataUrl:null,y=e.StandardFontDataFactory||pwe,v=!0!==e.stopAtErrors,b=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,w=!1!==e.isEvalSupported,x="boolean"==typeof e.isOffscreenCanvasSupported?e.isOffscreenCanvasSupported:!ffe,k="boolean"==typeof e.isChrome?e.isChrome:!Mye.platform.isFirefox&&"undefined"!=typeof window&&!!window?.chrome,A=Number.isInteger(e.canvasMaxAreaInBytes)?e.canvasMaxAreaInBytes:-1,S="boolean"==typeof e.disableFontFace?e.disableFontFace:ffe,E=!0===e.fontExtraProperties,_=!0===e.enableXfa,C=e.ownerDocument||globalThis.document,T=!0===e.disableRange,P=!0===e.disableStream,O=!0===e.disableAutoFetch,M=!0===e.pdfBug,D=e.CanvasFactory||dwe,I=e.FilterFactory||mwe,N=!0===e.enableHWA,j=l?l.length:e.length??NaN,z="boolean"==typeof e.useSystemFonts?e.useSystemFonts:!ffe&&!S,R="boolean"==typeof e.useWorkerFetch?e.useWorkerFetch:g===zve&&y===Fve&&m&&f&&nve(m,document.baseURI)&&nve(f,document.baseURI);e.canvasFactory&&rve("`canvasFactory`-instance option, please use `CanvasFactory` instead."),e.filterFactory&&rve("`filterFactory`-instance option, please use `FilterFactory` instead.");hye(d);const L={canvasFactory:new D({ownerDocument:C,enableHWA:N}),filterFactory:new I({docId:a,ownerDocument:C}),cMapReaderFactory:R?null:new g({baseUrl:m,isCompressed:p}),standardFontDataFactory:R?null:new y({baseUrl:f})};if(!u){const e={verbosity:d,port:vbe.workerPort};u=e.port?kwe.fromPort(e):new kwe(e),t._worker=u}const F={docId:a,apiVersion:"4.8.69",data:i,password:s,disableAutoFetch:O,rangeChunkSize:c,length:j,docBaseUrl:h,enableXfa:_,evaluatorOptions:{maxImageSize:b,disableFontFace:S,ignoreErrors:v,isEvalSupported:w,isOffscreenCanvasSupported:x,isChrome:k,canvasMaxAreaInBytes:A,fontExtraProperties:E,useSystemFonts:z,cMapUrl:R?m:null,standardFontDataUrl:R?f:null}},B={disableFontFace:S,fontExtraProperties:E,ownerDocument:C,pdfBug:M,styleElement:null,loadingParams:{disableAutoFetch:O,enableXfa:_}};return u.promise.then((function(){if(t.destroyed)throw new Error("Loading aborted");if(u.destroyed)throw new Error("Worker was destroyed");const e=u.messageHandler.sendWithPromise("GetDocRequest",F,i?[i.buffer]:null);let s;if(l)s=new jbe(l,{disableRange:T,disableStream:P});else if(!i){if(!n)throw new Error("getDocument - no `url` parameter provided.");let e;if(ffe){e="undefined"!=typeof fetch&&"undefined"!=typeof Response&&"body"in Response.prototype&&nve(n)?Wbe:ewe}else e=nve(n)?Wbe:Zbe;s=new e({url:n,length:j,httpHeaders:r,withCredentials:o,rangeChunkSize:c,disableRange:T,disableStream:P})}return e.then((e=>{if(t.destroyed)throw new Error("Loading aborted");if(u.destroyed)throw new Error("Worker was destroyed");const n=new Obe(a,e,u.port),i=new Awe(n,t,s,B,L);t._transport=i,n.send("Ready",null)}))})).catch(t._capability.reject),t}function fwe(e){return"object"==typeof e&&Number.isInteger(e?.num)&&e.num>=0&&Number.isInteger(e?.gen)&&e.gen>=0}class ywe{static#Na=0;constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId="d"+ywe.#Na++,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0),await(this._transport?.destroy())}catch(e){throw this._worker?.port&&delete this._worker._pendingDestroy,e}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}}let vwe=class{constructor(e,t,a=!1,n=null){this.length=e,this.initialData=t,this.progressiveDone=a,this.contentDispositionFilename=n,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}addRangeListener(e){this._rangeListeners.push(e)}addProgressListener(e){this._progressListeners.push(e)}addProgressiveReadListener(e){this._progressiveReadListeners.push(e)}addProgressiveDoneListener(e){this._progressiveDoneListeners.push(e)}onDataRange(e,t){for(const a of this._rangeListeners)a(e,t)}onDataProgress(e,t){this._readyCapability.promise.then((()=>{for(const a of this._progressListeners)a(e,t)}))}onDataProgressiveRead(e){this._readyCapability.promise.then((()=>{for(const t of this._progressiveReadListeners)t(e)}))}onDataProgressiveDone(){this._readyCapability.promise.then((()=>{for(const e of this._progressiveDoneListeners)e()}))}transportReady(){this._readyCapability.resolve()}requestDataRange(e,t){fye("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}};class bwe{constructor(e,t){this._pdfInfo=e,this._transport=t}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return bye(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(e){return this._transport.getPage(e)}getPageIndex(e){return this._transport.getPageIndex(e)}getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:e="display"}={}){const{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getOptionalContentConfig(t)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(e){return this._transport.cachedPageNumber(e)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}class wwe{#Ka=null;#Za=!1;constructor(e,t,a,n=!1){this._pageIndex=e,this._pageInfo=t,this._transport=a,this._stats=n?new ave:null,this._pdfBug=n,this.commonObjs=a.commonObjs,this.objs=new Ewe,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:e,rotation:t=this.rotate,offsetX:a=0,offsetY:n=0,dontFlip:i=!1}={}){return new Yye({viewBox:this.view,scale:e,rotation:t,offsetX:a,offsetY:n,dontFlip:i})}getAnnotations({intent:e="display"}={}){const{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,t)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return bye(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:e,viewport:t,intent:a="display",annotationMode:n=Tfe.ENABLE,transform:i=null,background:r=null,optionalContentConfigPromise:o=null,annotationCanvasMap:s=null,pageColors:l=null,printAnnotationStorage:c=null,isEditing:u=!1}){this._stats?.time("Overall");const d=this._transport.getRenderingIntent(a,n,c,u),{renderingIntent:h,cacheKey:m}=d;this.#Za=!1,this.#Ya(),o||=this._transport.getOptionalContentConfig(h);let p=this._intentStates.get(m);p||(p=Object.create(null),this._intentStates.set(m,p)),p.streamReaderCancelTimeout&&(clearTimeout(p.streamReaderCancelTimeout),p.streamReaderCancelTimeout=null);const g=!!(h&kfe);p.displayReadyCapability||(p.displayReadyCapability=Promise.withResolvers(),p.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(d));const f=e=>{p.renderTasks.delete(y),(this._maybeCleanupAfterRender||g)&&(this.#Za=!0),this.#Xa(!g),e?(y.capability.reject(e),this._abortOperatorList({intentState:p,reason:e instanceof Error?e:new Error(e)})):y.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},y=new Cwe({callback:f,params:{canvasContext:e,viewport:t,transform:i,background:r},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:s,operatorList:p.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!g,pdfBug:this._pdfBug,pageColors:l});(p.renderTasks||=new Set).add(y);const v=y.task;return Promise.all([p.displayReadyCapability.promise,o]).then((([e,t])=>{if(this.destroyed)f();else{if(this._stats?.time("Rendering"),!(t.renderingIntent&h))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");y.initializeGraphics({transparency:e,optionalContentConfig:t}),y.operatorListChanged()}})).catch(f),v}getOperatorList({intent:e="display",annotationMode:t=Tfe.ENABLE,printAnnotationStorage:a=null,isEditing:n=!1}={}){const i=this._transport.getRenderingIntent(e,t,a,n,!0);let r,o=this._intentStates.get(i.cacheKey);return o||(o=Object.create(null),this._intentStates.set(i.cacheKey,o)),o.opListReadCapability||(r=Object.create(null),r.operatorListChanged=function(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(r))},o.opListReadCapability=Promise.withResolvers(),(o.renderTasks||=new Set).add(r),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(i)),o.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:t=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===e,disableNormalization:!0===t},{highWaterMark:100,size:e=>e.items.length})}getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then((e=>cwe.textContent(e)));const t=this.streamTextContent(e);return new Promise((function(e,a){const n=t.getReader(),i={items:[],styles:Object.create(null),lang:null};!function t(){n.read().then((function({value:a,done:n}){n?e(i):(i.lang??=a.lang,Object.assign(i.styles,a.styles),i.items.push(...a.items),t())}),a)}()}))}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const e=[];for(const t of this._intentStates.values())if(this._abortOperatorList({intentState:t,reason:new Error("Page was destroyed."),force:!0}),!t.opListReadCapability)for(const a of t.renderTasks)e.push(a.completed),a.cancel();return this.objs.clear(),this.#Za=!1,this.#Ya(),Promise.all(e)}cleanup(e=!1){this.#Za=!0;const t=this.#Xa(!1);return e&&t&&(this._stats&&=new ave),t}#Xa(e=!1){if(this.#Ya(),!this.#Za||this.destroyed)return!1;if(e)return this.#Ka=setTimeout((()=>{this.#Ka=null,this.#Xa(!1)}),5e3),!1;for(const{renderTasks:e,operatorList:t}of this._intentStates.values())if(e.size>0||!t.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#Za=!1,!0}#Ya(){this.#Ka&&(clearTimeout(this.#Ka),this.#Ka=null)}_startRenderPage(e,t){const a=this._intentStates.get(t);a&&(this._stats?.timeEnd("Page Request"),a.displayReadyCapability?.resolve(e))}_renderPageChunk(e,t){for(let a=0,n=e.length;a<n;a++)t.operatorList.fnArray.push(e.fnArray[a]),t.operatorList.argsArray.push(e.argsArray[a]);t.operatorList.lastChunk=e.lastChunk,t.operatorList.separateAnnots=e.separateAnnots;for(const e of t.renderTasks)e.operatorListChanged();e.lastChunk&&this.#Xa(!0)}_pumpOperatorList({renderingIntent:e,cacheKey:t,annotationStorageSerializable:a,modifiedIds:n}){const{map:i,transfer:r}=a,o=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:t,annotationStorage:i,modifiedIds:n},r).getReader(),s=this._intentStates.get(t);s.streamReader=o;const l=()=>{o.read().then((({value:e,done:t})=>{t?s.streamReader=null:this._transport.destroyed||(this._renderPageChunk(e,s),l())}),(e=>{if(s.streamReader=null,!this._transport.destroyed){if(s.operatorList){s.operatorList.lastChunk=!0;for(const e of s.renderTasks)e.operatorListChanged();this.#Xa(!0)}if(s.displayReadyCapability)s.displayReadyCapability.reject(e);else{if(!s.opListReadCapability)throw e;s.opListReadCapability.reject(e)}}}))};l()}_abortOperatorList({intentState:e,reason:t,force:a=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!a){if(e.renderTasks.size>0)return;if(t instanceof Xye){let a=100;return t.extraDelay>0&&t.extraDelay<1e3&&(a+=t.extraDelay),void(e.streamReaderCancelTimeout=setTimeout((()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:t,force:!0})}),a))}}if(e.streamReader.cancel(new Cye(t.message)).catch((()=>{})),e.streamReader=null,!this._transport.destroyed){for(const[t,a]of this._intentStates)if(a===e){this._intentStates.delete(t);break}this.cleanup()}}}get stats(){return this._stats}}class xwe{#Qa=new Map;#Ja=Promise.resolve();postMessage(e,t){const a={data:structuredClone(e,t?{transfer:t}:null)};this.#Ja.then((()=>{for(const[e]of this.#Qa)e.call(this,a)}))}addEventListener(e,t,a=null){let n=null;if(a?.signal instanceof AbortSignal){const{signal:i}=a;if(i.aborted)return void gye("LoopbackPort - cannot use an `aborted` signal.");const r=()=>this.removeEventListener(e,t);n=()=>i.removeEventListener("abort",r),i.addEventListener("abort",r)}this.#Qa.set(t,n)}removeEventListener(e,t){const a=this.#Qa.get(t);a?.(),this.#Qa.delete(t)}terminate(){for(const[,e]of this.#Qa)e?.();this.#Qa.clear()}}class kwe{static#en=0;static#tn=!1;static#an;static{ffe&&(this.#tn=!0,vbe.workerSrc||="./pdf.worker.mjs"),this._isSameOrigin=(e,t)=>{let a;try{if(a=new URL(e),!a.origin||"null"===a.origin)return!1}catch{return!1}const n=new URL(t,a);return a.origin===n.origin},this._createCDNWrapper=e=>{const t=`await import("${e}");`;return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))}}constructor({name:e=null,port:t=null,verbosity:a=mye()}={}){if(this.name=e,this.destroyed=!1,this.verbosity=a,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,t){if(kwe.#an?.has(t))throw new Error("Cannot use more than one PDFWorker per port.");return(kwe.#an||=new WeakMap).set(t,this),void this._initializeFromPort(t)}this._initialize()}get promise(){return ffe?Promise.all([qve.promise,this._readyCapability.promise]):this._readyCapability.promise}#nn(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(e){this._port=e,this._messageHandler=new Obe("main","worker",e),this._messageHandler.on("ready",(function(){})),this.#nn()}_initialize(){if(kwe.#tn||kwe.#in)return void this._setupFakeWorker();let{workerSrc:e}=kwe;try{kwe._isSameOrigin(window.location.href,e)||(e=kwe._createCDNWrapper(new URL(e,window.location).href));const t=new Worker(e,{type:"module"}),a=new Obe("main","worker",t),n=()=>{i.abort(),a.destroy(),t.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},i=new AbortController;t.addEventListener("error",(()=>{this._webWorker||n()}),{signal:i.signal}),a.on("test",(e=>{i.abort(),!this.destroyed&&e?(this._messageHandler=a,this._port=t,this._webWorker=t,this.#nn()):n()})),a.on("ready",(e=>{if(i.abort(),this.destroyed)n();else try{r()}catch{this._setupFakeWorker()}}));const r=()=>{const e=new Uint8Array;a.send("test",e,[e.buffer])};return void r()}catch{pye("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){kwe.#tn||(gye("Setting up fake worker."),kwe.#tn=!0),kwe._setupFakeWorkerGlobal.then((e=>{if(this.destroyed)return void this._readyCapability.reject(new Error("Worker was destroyed"));const t=new xwe;this._port=t;const a="fake"+kwe.#en++,n=new Obe(a+"_worker",a,t);e.setup(n,t),this._messageHandler=new Obe(a,a+"_worker",t),this.#nn()})).catch((e=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${e.message}".`))}))}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),kwe.#an?.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(e){if(!e?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");const t=this.#an?.get(e.port);if(t){if(t._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return t}return new kwe(e)}static get workerSrc(){if(vbe.workerSrc)return vbe.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get#in(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return bye(this,"_setupFakeWorkerGlobal",(async()=>{if(this.#in)return this.#in;return(await import(this.workerSrc)).WorkerMessageHandler})())}}class Awe{#rn=new Map;#on=new Map;#sn=new Map;#ln=new Map;#cn=null;constructor(e,t,a,n,i){this.messageHandler=e,this.loadingTask=t,this.commonObjs=new Ewe,this.fontLoader=new Dve({ownerDocument:n.ownerDocument,styleElement:n.styleElement}),this.loadingParams=n.loadingParams,this._params=n,this.canvasFactory=i.canvasFactory,this.filterFactory=i.filterFactory,this.cMapReaderFactory=i.cMapReaderFactory,this.standardFontDataFactory=i.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=a,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}#un(e,t=null){const a=this.#rn.get(e);if(a)return a;const n=this.messageHandler.sendWithPromise(e,t);return this.#rn.set(e,n),n}get annotationStorage(){return bye(this,"annotationStorage",new Ove)}getRenderingIntent(e,t=Tfe.ENABLE,a=null,n=!1,i=!1){let r=xfe,o=Pve;switch(e){case"any":r=wfe;break;case"display":break;case"print":r=kfe;break;default:gye(`getRenderingIntent - invalid intent: ${e}`)}const s=r&kfe&&a instanceof Mve?a:this.annotationStorage;switch(t){case Tfe.DISABLE:r+=Efe;break;case Tfe.ENABLE:break;case Tfe.ENABLE_FORMS:r+=Afe;break;case Tfe.ENABLE_STORAGE:r+=Sfe,o=s.serializable;break;default:gye(`getRenderingIntent - invalid annotationMode: ${t}`)}n&&(r+=_fe),i&&(r+=Cfe);const{ids:l,hash:c}=s.modifiedIds;return{renderingIntent:r,cacheKey:[r,o.hash,c].join("_"),annotationStorageSerializable:o,modifiedIds:l}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#cn?.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const t of this.#on.values())e.push(t._destroy());this.#on.clear(),this.#sn.clear(),this.#ln.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const t=this.messageHandler.sendWithPromise("Terminate",null);return e.push(t),Promise.all(e).then((()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#rn.clear(),this.filterFactory.destroy(),lwe.cleanup(),this._networkStream?.cancelAllRequests(new Cye("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()}),this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:t}=this;e.on("GetReader",((e,t)=>{yye(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=e=>{this._lastProgress={loaded:e.loaded,total:e.total}},t.onPull=()=>{this._fullReader.read().then((function({value:e,done:a}){a?t.close():(yye(e instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),t.enqueue(new Uint8Array(e),1,[e]))})).catch((e=>{t.error(e)}))},t.onCancel=e=>{this._fullReader.cancel(e),t.ready.catch((e=>{if(!this.destroyed)throw e}))}})),e.on("ReaderHeadersReady",(async e=>{await this._fullReader.headersReady;const{isStreamingSupported:a,isRangeSupported:n,contentLength:i}=this._fullReader;return a&&n||(this._lastProgress&&t.onProgress?.(this._lastProgress),this._fullReader.onProgress=e=>{t.onProgress?.({loaded:e.loaded,total:e.total})}),{isStreamingSupported:a,isRangeSupported:n,contentLength:i}})),e.on("GetRangeReader",((e,t)=>{yye(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const a=this._networkStream.getRangeReader(e.begin,e.end);a?(t.onPull=()=>{a.read().then((function({value:e,done:a}){a?t.close():(yye(e instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),t.enqueue(new Uint8Array(e),1,[e]))})).catch((e=>{t.error(e)}))},t.onCancel=e=>{a.cancel(e),t.ready.catch((e=>{if(!this.destroyed)throw e}))}):t.close()})),e.on("GetDoc",(({pdfInfo:e})=>{this._numPages=e.numPages,this._htmlForXfa=e.htmlForXfa,delete e.htmlForXfa,t._capability.resolve(new bwe(e,this))})),e.on("DocException",(function(e){let a;switch(e.name){case"PasswordException":a=new xye(e.message,e.code);break;case"InvalidPDFException":a=new Aye(e.message);break;case"MissingPDFException":a=new Sye(e.message);break;case"UnexpectedResponseException":a=new Eye(e.message,e.status);break;case"UnknownErrorException":a=new kye(e.message,e.details);break;default:fye("DocException - expected a valid Error.")}t._capability.reject(a)})),e.on("PasswordRequest",(e=>{if(this.#cn=Promise.withResolvers(),t.onPassword){const a=e=>{e instanceof Error?this.#cn.reject(e):this.#cn.resolve({password:e})};try{t.onPassword(a,e.code)}catch(e){this.#cn.reject(e)}}else this.#cn.reject(new xye(e.message,e.code));return this.#cn.promise})),e.on("DataLoaded",(e=>{t.onProgress?.({loaded:e.length,total:e.length}),this.downloadInfoCapability.resolve(e)})),e.on("StartRenderPage",(e=>{if(this.destroyed)return;this.#on.get(e.pageIndex)._startRenderPage(e.transparency,e.cacheKey)})),e.on("commonobj",(([t,a,n])=>{if(this.destroyed)return null;if(this.commonObjs.has(t))return null;switch(a){case"Font":const{disableFontFace:i,fontExtraProperties:r,pdfBug:o}=this._params;if("error"in n){const e=n.error;gye(`Error during font loading: ${e}`),this.commonObjs.resolve(t,e);break}const s=o&&globalThis.FontInspector?.enabled?(e,t)=>globalThis.FontInspector.fontAdded(e,t):null,l=new Ive(n,{disableFontFace:i,inspectFont:s});this.fontLoader.bind(l).catch((()=>e.sendWithPromise("FontFallback",{id:t}))).finally((()=>{!r&&l.data&&(l.data=null),this.commonObjs.resolve(t,l)}));break;case"CopyLocalImage":const{imageRef:c}=n;yye(c,"The imageRef must be defined.");for(const e of this.#on.values())for(const[,a]of e.objs)if(a?.ref===c)return a.dataLen?(this.commonObjs.resolve(t,structuredClone(a)),a.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(t,n);break;default:throw new Error(`Got unknown common object type ${a}`)}return null})),e.on("obj",(([e,t,a,n])=>{if(this.destroyed)return;const i=this.#on.get(t);if(!i.objs.has(e))if(0!==i._intentStates.size)switch(a){case"Image":i.objs.resolve(e,n),n?.dataLen>1e7&&(i._maybeCleanupAfterRender=!0);break;case"Pattern":i.objs.resolve(e,n);break;default:throw new Error(`Got unknown object type ${a}`)}else n?.bitmap?.close()})),e.on("DocProgress",(e=>{this.destroyed||t.onProgress?.({loaded:e.loaded,total:e.total})})),e.on("FetchBuiltInCMap",(async e=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.cMapReaderFactory)throw new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.");return this.cMapReaderFactory.fetch(e)})),e.on("FetchStandardFontData",(async e=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.standardFontDataFactory)throw new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.");return this.standardFontDataFactory.fetch(e)}))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&gye("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:e,transfer:t}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:this._fullReader?.filename??null},t).finally((()=>{this.annotationStorage.resetModified()}))}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(new Error("Invalid page request."));const t=e-1,a=this.#sn.get(t);if(a)return a;const n=this.messageHandler.sendWithPromise("GetPage",{pageIndex:t}).then((a=>{if(this.destroyed)throw new Error("Transport destroyed");a.refStr&&this.#ln.set(a.refStr,e);const n=new wwe(t,a,this,this._params.pdfBug);return this.#on.set(t,n),n}));return this.#sn.set(t,n),n}getPageIndex(e){return fwe(e)?this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(e,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:t})}getFieldObjects(){return this.#un("GetFieldObjects")}hasJSActions(){return this.#un("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(e){return"string"!=typeof e?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:e})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getDocJSActions(){return this.#un("GetDocJSActions")}getPageJSActions(e){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:e})}getStructTree(e){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:e})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(e){return this.#un("GetOptionalContentConfig").then((t=>new Nbe(t,e)))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const e="GetMetadata",t=this.#rn.get(e);if(t)return t;const a=this.messageHandler.sendWithPromise(e,null).then((e=>({info:e[0],metadata:e[1]?new Mbe(e[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null})));return this.#rn.set(e,a),a}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const e of this.#on.values()){if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`)}this.commonObjs.clear(),e||this.fontLoader.clear(),this.#rn.clear(),this.filterFactory.destroy(!0),lwe.cleanup()}}cachedPageNumber(e){if(!fwe(e))return null;const t=0===e.gen?`${e.num}R`:`${e.num}R${e.gen}`;return this.#ln.get(t)??null}}const Swe=Symbol("INITIAL_DATA");class Ewe{#dn=Object.create(null);#hn(e){return this.#dn[e]||={...Promise.withResolvers(),data:Swe}}get(e,t=null){if(t){const a=this.#hn(e);return a.promise.then((()=>t(a.data))),null}const a=this.#dn[e];if(!a||a.data===Swe)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return a.data}has(e){const t=this.#dn[e];return!!t&&t.data!==Swe}resolve(e,t=null){const a=this.#hn(e);a.data=t,a.resolve()}clear(){for(const e in this.#dn){const{data:t}=this.#dn[e];t?.bitmap?.close()}this.#dn=Object.create(null)}*[Symbol.iterator](){for(const e in this.#dn){const{data:t}=this.#dn[e];t!==Swe&&(yield[e,t])}}}class _we{#mn=null;constructor(e){this.#mn=e,this.onContinue=null}get promise(){return this.#mn.capability.promise}cancel(e=0){this.#mn.cancel(null,e)}get separateAnnots(){const{separateAnnots:e}=this.#mn.operatorList;if(!e)return!1;const{annotationCanvasMap:t}=this.#mn;return e.form||e.canvas&&t?.size>0}}class Cwe{#pn=null;static#gn=new WeakSet;constructor({callback:e,params:t,objs:a,commonObjs:n,annotationCanvasMap:i,operatorList:r,pageIndex:o,canvasFactory:s,filterFactory:l,useRequestAnimationFrame:c=!1,pdfBug:u=!1,pageColors:d=null}){this.callback=e,this.params=t,this.objs=a,this.commonObjs=n,this.annotationCanvasMap=i,this.operatorListIdx=null,this.operatorList=r,this._pageIndex=o,this.canvasFactory=s,this.filterFactory=l,this._pdfBug=u,this.pageColors=d,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===c&&"undefined"!=typeof window,this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new _we(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=t.canvasContext.canvas}get completed(){return this.capability.promise.catch((function(){}))}initializeGraphics({transparency:e=!1,optionalContentConfig:t}){if(this.cancelled)return;if(this._canvas){if(Cwe.#gn.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");Cwe.#gn.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:a,viewport:n,transform:i,background:r}=this.params;this.gfx=new ybe(a,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:t},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:i,viewport:n,transparency:e,background:r}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(e=null,t=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#pn&&(window.cancelAnimationFrame(this.#pn),this.#pn=null),Cwe.#gn.delete(this._canvas),this.callback(e||new Xye(`Rendering cancelled, page ${this._pageIndex+1}`,t))}operatorListChanged(){this.graphicsReady?(this.stepper?.updateOperatorList(this.operatorList),this.running||this._continue()):this.graphicsReadyCallback||=this._continueBound}_continue(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?this.#pn=window.requestAnimationFrame((()=>{this.#pn=null,this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),Cwe.#gn.delete(this._canvas),this.callback())))}}const Twe="4.8.69",Pwe="3634dab10";function Owe(e){return Math.floor(255*Math.max(0,Math.min(1,e))).toString(16).padStart(2,"0")}function Mwe(e){return Math.max(0,Math.min(255,255*e))}class Dwe{static CMYK_G([e,t,a,n]){return["G",1-Math.min(1,.3*e+.59*a+.11*t+n)]}static G_CMYK([e]){return["CMYK",0,0,0,1-e]}static G_RGB([e]){return["RGB",e,e,e]}static G_rgb([e]){return[e=Mwe(e),e,e]}static G_HTML([e]){const t=Owe(e);return`#${t}${t}${t}`}static RGB_G([e,t,a]){return["G",.3*e+.59*t+.11*a]}static RGB_rgb(e){return e.map(Mwe)}static RGB_HTML(e){return`#${e.map(Owe).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([e,t,a,n]){return["RGB",1-Math.min(1,e+n),1-Math.min(1,a+n),1-Math.min(1,t+n)]}static CMYK_rgb([e,t,a,n]){return[Mwe(1-Math.min(1,e+n)),Mwe(1-Math.min(1,a+n)),Mwe(1-Math.min(1,t+n))]}static CMYK_HTML(e){const t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}static RGB_CMYK([e,t,a]){const n=1-e,i=1-t,r=1-a;return["CMYK",n,i,r,Math.min(n,i,r)]}}class Iwe{create(e,t,a=!1){if(e<=0||t<=0)throw new Error("Invalid SVG dimensions");const n=this._createSVG("svg:svg");return n.setAttribute("version","1.1"),a||(n.setAttribute("width",`${e}px`),n.setAttribute("height",`${t}px`)),n.setAttribute("preserveAspectRatio","none"),n.setAttribute("viewBox",`0 0 ${e} ${t}`),n}createElement(e){if("string"!=typeof e)throw new Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){fye("Abstract method `_createSVG` called.")}}class Nwe extends Iwe{_createSVG(e){return document.createElementNS(Gye,e)}}class jwe{static setupStorage(e,t,a,n,i){const r=n.getValue(t,{value:null});switch(a.name){case"textarea":if(null!==r.value&&(e.textContent=r.value),"print"===i)break;e.addEventListener("input",(e=>{n.setValue(t,{value:e.target.value})}));break;case"input":if("radio"===a.attributes.type||"checkbox"===a.attributes.type){if(r.value===a.attributes.xfaOn?e.setAttribute("checked",!0):r.value===a.attributes.xfaOff&&e.removeAttribute("checked"),"print"===i)break;e.addEventListener("change",(e=>{n.setValue(t,{value:e.target.checked?e.target.getAttribute("xfaOn"):e.target.getAttribute("xfaOff")})}))}else{if(null!==r.value&&e.setAttribute("value",r.value),"print"===i)break;e.addEventListener("input",(e=>{n.setValue(t,{value:e.target.value})}))}break;case"select":if(null!==r.value){e.setAttribute("value",r.value);for(const e of a.children)e.attributes.value===r.value?e.attributes.selected=!0:e.attributes.hasOwnProperty("selected")&&delete e.attributes.selected}e.addEventListener("input",(e=>{const a=e.target.options,i=-1===a.selectedIndex?"":a[a.selectedIndex].value;n.setValue(t,{value:i})}))}}static setAttributes({html:e,element:t,storage:a=null,intent:n,linkService:i}){const{attributes:r}=t,o=e instanceof HTMLAnchorElement;"radio"===r.type&&(r.name=`${r.name}-${n}`);for(const[t,a]of Object.entries(r))if(null!=a)switch(t){case"class":a.length&&e.setAttribute(t,a.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",a);break;case"style":Object.assign(e.style,a);break;case"textContent":e.textContent=a;break;default:(!o||"href"!==t&&"newWindow"!==t)&&e.setAttribute(t,a)}o&&i.addLinkAttributes(e,r.href,r.newWindow),a&&r.dataId&&this.setupStorage(e,r.dataId,t,a)}static render(e){const t=e.annotationStorage,a=e.linkService,n=e.xfaHtml,i=e.intent||"display",r=document.createElement(n.name);n.attributes&&this.setAttributes({html:r,element:n,intent:i,linkService:a});const o="richText"!==i,s=e.div;if(s.append(r),e.viewport){const t=`matrix(${e.viewport.transform.join(",")})`;s.style.transform=t}o&&s.setAttribute("class","xfaLayer xfaFont");const l=[];if(0===n.children.length){if(n.value){const e=document.createTextNode(n.value);r.append(e),o&&cwe.shouldBuildText(n.name)&&l.push(e)}return{textDivs:l}}const c=[[n,-1,r]];for(;c.length>0;){const[e,n,r]=c.at(-1);if(n+1===e.children.length){c.pop();continue}const s=e.children[++c.at(-1)[1]];if(null===s)continue;const{name:u}=s;if("#text"===u){const e=document.createTextNode(s.value);l.push(e),r.append(e);continue}const d=s?.attributes?.xmlns?document.createElementNS(s.attributes.xmlns,u):document.createElement(u);if(r.append(d),s.attributes&&this.setAttributes({html:d,element:s,storage:t,intent:i,linkService:a}),s.children?.length>0)c.push([s,-1,d]);else if(s.value){const e=document.createTextNode(s.value);o&&cwe.shouldBuildText(u)&&l.push(e),d.append(e)}}for(const e of s.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))e.setAttribute("readOnly",!0);return{textDivs:l}}static update(e){const t=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=t,e.div.hidden=!1}}const zwe=1e3,Rwe=new WeakSet;function Lwe(e){return{width:e[2]-e[0],height:e[3]-e[1]}}class Fwe{static create(e){switch(e.data.annotationType){case Bfe:return new Hwe(e);case Ffe:return new qwe(e);case aye:switch(e.data.fieldType){case"Tx":return new Vwe(e);case"Btn":return e.data.radioButton?new Gwe(e):e.data.checkBox?new $we(e):new Kwe(e);case"Ch":return new Zwe(e);case"Sig":return new Wwe(e)}return new Uwe(e);case eye:return new Ywe(e);case Hfe:return new Qwe(e);case qfe:return new Jwe(e);case Ufe:return new exe(e);case Vfe:return new txe(e);case $fe:return new axe(e);case Qfe:return new ixe(e);case Jfe:return new rxe(e);case Wfe:return new nxe(e);case Gfe:return new oxe(e);case Kfe:return new sxe(e);case Zfe:return new lxe(e);case Yfe:return new cxe(e);case Xfe:return new uxe(e);case tye:return new dxe(e);default:return new Bwe(e)}}}class Bwe{#fn=null;#yn=!1;#vn=null;constructor(e,{isRenderable:t=!1,ignoreBorder:a=!1,createQuadrilaterals:n=!1}={}){this.isRenderable=t,this.data=e.data,this.layer=e.layer,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,t&&(this.container=this._createContainer(a)),n&&this._createQuadrilaterals()}static _hasPopupData({titleObj:e,contentsObj:t,richText:a}){return!!(e?.str||t?.str||a?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return Bwe._hasPopupData(this.data)}updateEdited(e){if(!this.container)return;this.#fn||={rect:this.data.rect.slice(0)};const{rect:t}=e;t&&this.#bn(t),this.#vn?.popup.updateEdited(e)}resetEdited(){this.#fn&&(this.#bn(this.#fn.rect),this.#vn?.popup.resetEdited(),this.#fn=null)}#bn(e){const{container:{style:t},data:{rect:a,rotation:n},parent:{viewport:{rawDims:{pageWidth:i,pageHeight:r,pageX:o,pageY:s}}}}=this;a?.splice(0,4,...e);const{width:l,height:c}=Lwe(e);t.left=100*(e[0]-o)/i+"%",t.top=100*(r-e[3]+s)/r+"%",0===n?(t.width=100*l/i+"%",t.height=100*c/r+"%"):this.setRotation(n)}_createContainer(e){const{data:t,parent:{page:a,viewport:n}}=this,i=document.createElement("section");i.setAttribute("data-annotation-id",t.id),this instanceof Uwe||(i.tabIndex=zwe);const{style:r}=i;if(r.zIndex=this.parent.zIndex++,t.alternativeText&&(i.title=t.alternativeText),t.noRotate&&i.classList.add("norotate"),!t.rect||this instanceof Ywe){const{rotation:e}=t;return t.hasOwnCanvas||0===e||this.setRotation(e,i),i}const{width:o,height:s}=Lwe(t.rect);if(!e&&t.borderStyle.width>0){r.borderWidth=`${t.borderStyle.width}px`;const e=t.borderStyle.horizontalCornerRadius,a=t.borderStyle.verticalCornerRadius;if(e>0||a>0){const t=`calc(${e}px * var(--scale-factor)) / calc(${a}px * var(--scale-factor))`;r.borderRadius=t}else if(this instanceof Gwe){const e=`calc(${o}px * var(--scale-factor)) / calc(${s}px * var(--scale-factor))`;r.borderRadius=e}switch(t.borderStyle.style){case nye:r.borderStyle="solid";break;case iye:r.borderStyle="dashed";break;case rye:gye("Unimplemented border style: beveled");break;case oye:gye("Unimplemented border style: inset");break;case sye:r.borderBottomStyle="solid"}const n=t.borderColor||null;n?(this.#yn=!0,r.borderColor=Iye.makeHexColor(0|n[0],0|n[1],0|n[2])):r.borderWidth=0}const l=Iye.normalizeRect([t.rect[0],a.view[3]-t.rect[1]+a.view[1],t.rect[2],a.view[3]-t.rect[3]+a.view[1]]),{pageWidth:c,pageHeight:u,pageX:d,pageY:h}=n.rawDims;r.left=100*(l[0]-d)/c+"%",r.top=100*(l[1]-h)/u+"%";const{rotation:m}=t;return t.hasOwnCanvas||0===m?(r.width=100*o/c+"%",r.height=100*s/u+"%"):this.setRotation(m,i),i}setRotation(e,t=this.container){if(!this.data.rect)return;const{pageWidth:a,pageHeight:n}=this.parent.viewport.rawDims,{width:i,height:r}=Lwe(this.data.rect);let o,s;e%180==0?(o=100*i/a,s=100*r/n):(o=100*r/a,s=100*i/n),t.style.width=`${o}%`,t.style.height=`${s}%`,t.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const e=(e,t,a)=>{const n=a.detail[e],i=n[0],r=n.slice(1);a.target.style[t]=Dwe[`${i}_HTML`](r),this.annotationStorage.setValue(this.data.id,{[t]:Dwe[`${i}_rgb`](r)})};return bye(this,"_commonActions",{display:e=>{const{display:t}=e.detail,a=t%2==1;this.container.style.visibility=a?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:a,noPrint:1===t||2===t})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{const{hidden:t}=e.detail;this.container.style.visibility=t?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:t,noView:t})},focus:e=>{setTimeout((()=>e.target.focus({preventScroll:!1})),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.target.disabled=e.detail.readonly},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:t=>{e("bgColor","backgroundColor",t)},fillColor:t=>{e("fillColor","backgroundColor",t)},fgColor:t=>{e("fgColor","color",t)},textColor:t=>{e("textColor","color",t)},borderColor:t=>{e("borderColor","borderColor",t)},strokeColor:t=>{e("strokeColor","borderColor",t)},rotation:e=>{const t=e.detail.rotation;this.setRotation(t),this.annotationStorage.setValue(this.data.id,{rotation:t})}})}_dispatchEventFromSandbox(e,t){const a=this._commonActions;for(const n of Object.keys(t.detail)){const i=e[n]||a[n];i?.(t)}}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;const t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;const a=this._commonActions;for(const[n,i]of Object.entries(t)){const r=a[n];if(r){r({detail:{[n]:i},target:e}),delete t[n]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:e}=this.data;if(!e)return;const[t,a,n,i]=this.data.rect.map((e=>Math.fround(e)));if(8===e.length){const[r,o,s,l]=e.subarray(2,6);if(n===r&&i===o&&t===s&&a===l)return}const{style:r}=this.container;let o;if(this.#yn){const{borderColor:e,borderWidth:t}=r;r.borderWidth=0,o=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${e}" stroke-width="${t}">`],this.container.classList.add("hasBorder")}const s=n-t,l=i-a,{svgFactory:c}=this,u=c.createElement("svg");u.classList.add("quadrilateralsContainer"),u.setAttribute("width",0),u.setAttribute("height",0);const d=c.createElement("defs");u.append(d);const h=c.createElement("clipPath"),m=`clippath_${this.data.id}`;h.setAttribute("id",m),h.setAttribute("clipPathUnits","objectBoundingBox"),d.append(h);for(let a=2,n=e.length;a<n;a+=8){const n=e[a],r=e[a+1],u=e[a+2],d=e[a+3],m=c.createElement("rect"),p=(u-t)/s,g=(i-r)/l,f=(n-u)/s,y=(r-d)/l;m.setAttribute("x",p),m.setAttribute("y",g),m.setAttribute("width",f),m.setAttribute("height",y),h.append(m),o?.push(`<rect vector-effect="non-scaling-stroke" x="${p}" y="${g}" width="${f}" height="${y}"/>`)}this.#yn&&(o.push("</g></svg>')"),r.backgroundImage=o.join("")),this.container.append(u),this.container.style.clipPath=`url(#${m})`}_createPopup(){const{data:e}=this,t=this.#vn=new Ywe({data:{color:e.color,titleObj:e.titleObj,modificationDate:e.modificationDate,contentsObj:e.contentsObj,richText:e.richText,parentRect:e.rect,borderStyle:0,id:`popup_${e.id}`,rotation:e.rotation},parent:this.parent,elements:[this]});this.parent.div.append(t.render())}render(){fye("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,t=null){const a=[];if(this._fieldObjects){const n=this._fieldObjects[e];if(n)for(const{page:e,id:i,exportValues:r}of n){if(-1===e)continue;if(i===t)continue;const n="string"==typeof r?r:null,o=document.querySelector(`[data-element-id="${i}"]`);!o||Rwe.has(o)?a.push({id:i,exportValue:n,domElement:o}):gye(`_getElementsByName - element not allowed: ${i}`)}return a}for(const n of document.getElementsByName(e)){const{exportValue:e}=n,i=n.getAttribute("data-element-id");i!==t&&(Rwe.has(n)&&a.push({id:i,exportValue:e,domElement:n}))}return a}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(const t of e)t.classList.add("highlightArea");else e.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:e,data:{id:t}}=this;this.container.addEventListener("dblclick",(()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:e,editId:t})}))}}class Hwe extends Bwe{constructor(e,t=null){super(e,{isRenderable:!0,ignoreBorder:!!t?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:t}=this,a=document.createElement("a");a.setAttribute("data-element-id",e.id);let n=!1;return e.url?(t.addLinkAttributes(a,e.url,e.newWindow),n=!0):e.action?(this._bindNamedAction(a,e.action),n=!0):e.attachment?(this.#wn(a,e.attachment,e.attachmentDest),n=!0):e.setOCGState?(this.#xn(a,e.setOCGState),n=!0):e.dest?(this._bindLink(a,e.dest),n=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(a,e),n=!0),e.resetForm?(this._bindResetFormAction(a,e.resetForm),n=!0):this.isTooltipOnly&&!n&&(this._bindLink(a,""),n=!0)),this.container.classList.add("linkAnnotation"),n&&this.container.append(a),this.container}#kn(){this.container.setAttribute("data-internal-link","")}_bindLink(e,t){e.href=this.linkService.getDestinationHash(t),e.onclick=()=>(t&&this.linkService.goToDestination(t),!1),(t||""===t)&&this.#kn()}_bindNamedAction(e,t){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(t),!1),this.#kn()}#wn(e,t,a=null){e.href=this.linkService.getAnchorUrl(""),t.description&&(e.title=t.description),e.onclick=()=>(this.downloadManager?.openOrDownloadData(t.content,t.filename,a),!1),this.#kn()}#xn(e,t){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(t),!1),this.#kn()}_bindJSAction(e,t){e.href=this.linkService.getAnchorUrl("");const a=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const n of Object.keys(t.actions)){const i=a.get(n);i&&(e[i]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t.id,name:n}}),!1))}e.onclick||(e.onclick=()=>!1),this.#kn()}_bindResetFormAction(e,t){const a=e.onclick;if(a||(e.href=this.linkService.getAnchorUrl("")),this.#kn(),!this._fieldObjects)return gye('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),void(a||(e.onclick=()=>!1));e.onclick=()=>{a?.();const{fields:e,refs:n,include:i}=t,r=[];if(0!==e.length||0!==n.length){const t=new Set(n);for(const a of e){const e=this._fieldObjects[a]||[];for(const{id:a}of e)t.add(a)}for(const e of Object.values(this._fieldObjects))for(const a of e)t.has(a.id)===i&&r.push(a)}else for(const e of Object.values(this._fieldObjects))r.push(...e);const o=this.annotationStorage,s=[];for(const e of r){const{id:t}=e;switch(s.push(t),e.type){case"text":{const a=e.defaultValue||"";o.setValue(t,{value:a});break}case"checkbox":case"radiobutton":{const a=e.defaultValue===e.exportValues;o.setValue(t,{value:a});break}case"combobox":case"listbox":{const a=e.defaultValue||"";o.setValue(t,{value:a});break}default:continue}const a=document.querySelector(`[data-element-id="${t}"]`);a&&(Rwe.has(a)?a.dispatchEvent(new Event("resetform")):gye(`_bindResetFormAction - element not allowed: ${t}`))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:s,name:"ResetForm"}}),!1}}}class qwe extends Bwe{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const e=document.createElement("img");return e.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",e.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),e.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(e),this.container}}class Uwe extends Bwe{render(){return this.container}showElementAndHideCanvas(e){this.data.hasOwnCanvas&&("CANVAS"===e.previousSibling?.nodeName&&(e.previousSibling.hidden=!0),e.hidden=!1)}_getKeyModifier(e){return Mye.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,t,a,n,i){a.includes("mouse")?e.addEventListener(a,(e=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:i(e),shift:e.shiftKey,modifier:this._getKeyModifier(e)}})})):e.addEventListener(a,(e=>{if("blur"===a){if(!t.focused||!e.relatedTarget)return;t.focused=!1}else if("focus"===a){if(t.focused)return;t.focused=!0}i&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:i(e)}})}))}_setEventListeners(e,t,a,n){for(const[i,r]of a)("Action"===r||this.data.actions?.[r])&&("Focus"!==r&&"Blur"!==r||(t||={focused:!1}),this._setEventListener(e,t,i,r,n),"Focus"!==r||this.data.actions?.Blur?"Blur"!==r||this.data.actions?.Focus||this._setEventListener(e,t,"focus","Focus",null):this._setEventListener(e,t,"blur","Blur",null))}_setBackgroundColor(e){const t=this.data.backgroundColor||null;e.style.backgroundColor=null===t?"transparent":Iye.makeHexColor(t[0],t[1],t[2])}_setTextStyle(e){const t=["left","center","right"],{fontColor:a}=this.data.defaultAppearanceData,n=this.data.defaultAppearanceData.fontSize||9,i=e.style;let r;const o=e=>Math.round(10*e)/10;if(this.data.multiLine){const e=Math.abs(this.data.rect[3]-this.data.rect[1]-2),t=e/(Math.round(e/(bfe*n))||1);r=Math.min(n,o(t/bfe))}else{const e=Math.abs(this.data.rect[3]-this.data.rect[1]-2);r=Math.min(n,o(e/bfe))}i.fontSize=`calc(${r}px * var(--scale-factor))`,i.color=Iye.makeHexColor(a[0],a[1],a[2]),null!==this.data.textAlignment&&(i.textAlign=t[this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",t)}}class Vwe extends Uwe{constructor(e){super(e,{isRenderable:e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue})}setPropertyOnSiblings(e,t,a,n){const i=this.annotationStorage;for(const r of this._getElementsByName(e.name,e.id))r.domElement&&(r.domElement[t]=a),i.setValue(r.id,{[n]:a})}render(){const e=this.annotationStorage,t=this.data.id;this.container.classList.add("textWidgetAnnotation");let a=null;if(this.renderForms){const n=e.getValue(t,{value:this.data.fieldValue});let i=n.value||"";const r=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;r&&i.length>r&&(i=i.slice(0,r));let o=n.formattedValue||this.data.textContent?.join("\n")||null;o&&this.data.comb&&(o=o.replaceAll(/\s+/g,""));const s={userValue:i,formattedValue:o,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(a=document.createElement("textarea"),a.textContent=o??i,this.data.doNotScroll&&(a.style.overflowY="hidden")):(a=document.createElement("input"),a.type="text",a.setAttribute("value",o??i),this.data.doNotScroll&&(a.style.overflowX="hidden")),this.data.hasOwnCanvas&&(a.hidden=!0),Rwe.add(a),a.setAttribute("data-element-id",t),a.disabled=this.data.readOnly,a.name=this.data.fieldName,a.tabIndex=zwe,this._setRequired(a,this.data.required),r&&(a.maxLength=r),a.addEventListener("input",(n=>{e.setValue(t,{value:n.target.value}),this.setPropertyOnSiblings(a,"value",n.target.value,"value"),s.formattedValue=null})),a.addEventListener("resetform",(e=>{const t=this.data.defaultFieldValue??"";a.value=s.userValue=t,s.formattedValue=null}));let l=e=>{const{formattedValue:t}=s;null!=t&&(e.target.value=t),e.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){a.addEventListener("focus",(e=>{if(s.focused)return;const{target:t}=e;s.userValue&&(t.value=s.userValue),s.lastCommittedValue=t.value,s.commitKey=1,this.data.actions?.Focus||(s.focused=!0)})),a.addEventListener("updatefromsandbox",(a=>{this.showElementAndHideCanvas(a.target);const n={value(a){s.userValue=a.detail.value??"",e.setValue(t,{value:s.userValue.toString()}),a.target.value=s.userValue},formattedValue(a){const{formattedValue:n}=a.detail;s.formattedValue=n,null!=n&&a.target!==document.activeElement&&(a.target.value=n),e.setValue(t,{formattedValue:n})},selRange(e){e.target.setSelectionRange(...e.detail.selRange)},charLimit:a=>{const{charLimit:n}=a.detail,{target:i}=a;if(0===n)return void i.removeAttribute("maxLength");i.setAttribute("maxLength",n);let r=s.userValue;!r||r.length<=n||(r=r.slice(0,n),i.value=s.userValue=r,e.setValue(t,{value:r}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:r,willCommit:!0,commitKey:1,selStart:i.selectionStart,selEnd:i.selectionEnd}}))}};this._dispatchEventFromSandbox(n,a)})),a.addEventListener("keydown",(e=>{s.commitKey=1;let a=-1;if("Escape"===e.key?a=0:"Enter"!==e.key||this.data.multiLine?"Tab"===e.key&&(s.commitKey=3):a=2,-1===a)return;const{value:n}=e.target;s.lastCommittedValue!==n&&(s.lastCommittedValue=n,s.userValue=n,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:n,willCommit:!0,commitKey:a,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}))}));const n=l;l=null,a.addEventListener("blur",(e=>{if(!s.focused||!e.relatedTarget)return;this.data.actions?.Blur||(s.focused=!1);const{value:a}=e.target;s.userValue=a,s.lastCommittedValue!==a&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:a,willCommit:!0,commitKey:s.commitKey,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}),n(e)})),this.data.actions?.Keystroke&&a.addEventListener("beforeinput",(e=>{s.lastCommittedValue=null;const{data:a,target:n}=e,{value:i,selectionStart:r,selectionEnd:o}=n;let l=r,c=o;switch(e.inputType){case"deleteWordBackward":{const e=i.substring(0,r).match(/\w*[^\w]*$/);e&&(l-=e[0].length);break}case"deleteWordForward":{const e=i.substring(r).match(/^[^\w]*\w*/);e&&(c+=e[0].length);break}case"deleteContentBackward":r===o&&(l-=1);break;case"deleteContentForward":r===o&&(c+=1)}e.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:i,change:a||"",willCommit:!1,selStart:l,selEnd:c}})})),this._setEventListeners(a,s,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.value))}if(l&&a.addEventListener("blur",l),this.data.comb){const e=(this.data.rect[2]-this.data.rect[0])/r;a.classList.add("comb"),a.style.letterSpacing=`calc(${e}px * var(--scale-factor) - 1ch)`}}else a=document.createElement("div"),a.textContent=this.data.fieldValue,a.style.verticalAlign="middle",a.style.display="table-cell",this.data.hasOwnCanvas&&(a.hidden=!0);return this._setTextStyle(a),this._setBackgroundColor(a),this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}}class Wwe extends Uwe{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class $we extends Uwe{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,t=this.data,a=t.id;let n=e.getValue(a,{value:t.exportValue===t.fieldValue}).value;"string"==typeof n&&(n="Off"!==n,e.setValue(a,{value:n})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const i=document.createElement("input");return Rwe.add(i),i.setAttribute("data-element-id",a),i.disabled=t.readOnly,this._setRequired(i,this.data.required),i.type="checkbox",i.name=t.fieldName,n&&i.setAttribute("checked",!0),i.setAttribute("exportValue",t.exportValue),i.tabIndex=zwe,i.addEventListener("change",(n=>{const{name:i,checked:r}=n.target;for(const n of this._getElementsByName(i,a)){const a=r&&n.exportValue===t.exportValue;n.domElement&&(n.domElement.checked=a),e.setValue(n.id,{value:a})}e.setValue(a,{value:r})})),i.addEventListener("resetform",(e=>{const a=t.defaultFieldValue||"Off";e.target.checked=a===t.exportValue})),this.enableScripting&&this.hasJSActions&&(i.addEventListener("updatefromsandbox",(t=>{const n={value(t){t.target.checked="Off"!==t.detail.value,e.setValue(a,{value:t.target.checked})}};this._dispatchEventFromSandbox(n,t)})),this._setEventListeners(i,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.checked))),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class Gwe extends Uwe{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const e=this.annotationStorage,t=this.data,a=t.id;let n=e.getValue(a,{value:t.fieldValue===t.buttonValue}).value;if("string"==typeof n&&(n=n!==t.buttonValue,e.setValue(a,{value:n})),n)for(const n of this._getElementsByName(t.fieldName,a))e.setValue(n.id,{value:!1});const i=document.createElement("input");if(Rwe.add(i),i.setAttribute("data-element-id",a),i.disabled=t.readOnly,this._setRequired(i,this.data.required),i.type="radio",i.name=t.fieldName,n&&i.setAttribute("checked",!0),i.tabIndex=zwe,i.addEventListener("change",(t=>{const{name:n,checked:i}=t.target;for(const t of this._getElementsByName(n,a))e.setValue(t.id,{value:!1});e.setValue(a,{value:i})})),i.addEventListener("resetform",(e=>{const a=t.defaultFieldValue;e.target.checked=null!=a&&a===t.buttonValue})),this.enableScripting&&this.hasJSActions){const n=t.buttonValue;i.addEventListener("updatefromsandbox",(t=>{const i={value:t=>{const i=n===t.detail.value;for(const n of this._getElementsByName(t.target.name)){const t=i&&n.id===a;n.domElement&&(n.domElement.checked=t),e.setValue(n.id,{value:t})}}};this._dispatchEventFromSandbox(i,t)})),this._setEventListeners(i,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.checked))}return this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class Kwe extends Hwe{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){const e=super.render();e.classList.add("buttonWidgetAnnotation","pushButton");const t=e.lastChild;return this.enableScripting&&this.hasJSActions&&t&&(this._setDefaultPropertiesFromJS(t),t.addEventListener("updatefromsandbox",(e=>{this._dispatchEventFromSandbox({},e)}))),e}}class Zwe extends Uwe{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const e=this.annotationStorage,t=this.data.id,a=e.getValue(t,{value:this.data.fieldValue}),n=document.createElement("select");Rwe.add(n),n.setAttribute("data-element-id",t),n.disabled=this.data.readOnly,this._setRequired(n,this.data.required),n.name=this.data.fieldName,n.tabIndex=zwe;let i=this.data.combo&&this.data.options.length>0;this.data.combo||(n.size=this.data.options.length,this.data.multiSelect&&(n.multiple=!0)),n.addEventListener("resetform",(e=>{const t=this.data.defaultFieldValue;for(const e of n.options)e.selected=e.value===t}));for(const e of this.data.options){const t=document.createElement("option");t.textContent=e.displayValue,t.value=e.exportValue,a.value.includes(e.exportValue)&&(t.setAttribute("selected",!0),i=!1),n.append(t)}let r=null;if(i){const e=document.createElement("option");e.value=" ",e.setAttribute("hidden",!0),e.setAttribute("selected",!0),n.prepend(e),r=()=>{e.remove(),n.removeEventListener("input",r),r=null},n.addEventListener("input",r)}const o=e=>{const t=e?"value":"textContent",{options:a,multiple:i}=n;return i?Array.prototype.filter.call(a,(e=>e.selected)).map((e=>e[t])):-1===a.selectedIndex?null:a[a.selectedIndex][t]};let s=o(!1);const l=e=>{const t=e.target.options;return Array.prototype.map.call(t,(e=>({displayValue:e.textContent,exportValue:e.value})))};return this.enableScripting&&this.hasJSActions?(n.addEventListener("updatefromsandbox",(a=>{const i={value(a){r?.();const i=a.detail.value,l=new Set(Array.isArray(i)?i:[i]);for(const e of n.options)e.selected=l.has(e.value);e.setValue(t,{value:o(!0)}),s=o(!1)},multipleSelection(e){n.multiple=!0},remove(a){const i=n.options,r=a.detail.remove;if(i[r].selected=!1,n.remove(r),i.length>0){-1===Array.prototype.findIndex.call(i,(e=>e.selected))&&(i[0].selected=!0)}e.setValue(t,{value:o(!0),items:l(a)}),s=o(!1)},clear(a){for(;0!==n.length;)n.remove(0);e.setValue(t,{value:null,items:[]}),s=o(!1)},insert(a){const{index:i,displayValue:r,exportValue:c}=a.detail.insert,u=n.children[i],d=document.createElement("option");d.textContent=r,d.value=c,u?u.before(d):n.append(d),e.setValue(t,{value:o(!0),items:l(a)}),s=o(!1)},items(a){const{items:i}=a.detail;for(;0!==n.length;)n.remove(0);for(const e of i){const{displayValue:t,exportValue:a}=e,i=document.createElement("option");i.textContent=t,i.value=a,n.append(i)}n.options.length>0&&(n.options[0].selected=!0),e.setValue(t,{value:o(!0),items:l(a)}),s=o(!1)},indices(a){const n=new Set(a.detail.indices);for(const e of a.target.options)e.selected=n.has(e.index);e.setValue(t,{value:o(!0)}),s=o(!1)},editable(e){e.target.disabled=!e.detail.editable}};this._dispatchEventFromSandbox(i,a)})),n.addEventListener("input",(a=>{const n=o(!0),i=o(!1);e.setValue(t,{value:n}),a.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:s,change:i,changeEx:n,willCommit:!1,commitKey:1,keyDown:!1}})})),this._setEventListeners(n,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],(e=>e.target.value))):n.addEventListener("input",(function(a){e.setValue(t,{value:o(!0)})})),this.data.combo&&this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class Ywe extends Bwe{constructor(e){const{data:t,elements:a}=e;super(e,{isRenderable:Bwe._hasPopupData(t)}),this.elements=a,this.popup=null}render(){this.container.classList.add("popupAnnotation");const e=this.popup=new Xwe({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open}),t=[];for(const a of this.elements)a.popup=e,a.container.ariaHasPopup="dialog",t.push(a.data.id),a.addHighlightArea();return this.container.setAttribute("aria-controls",t.map((e=>`${Rye}${e}`)).join(",")),this.container}}class Xwe{#An=this.#Sn.bind(this);#En=this.#_n.bind(this);#Cn=this.#Tn.bind(this);#Pn=this.#On.bind(this);#Mn=null;#he=null;#Dn=null;#In=null;#Nn=null;#jn=null;#zn=null;#Rn=!1;#Ln=null;#_=null;#Fn=null;#Bn=null;#Hn=null;#fn=null;#qn=!1;constructor({container:e,color:t,elements:a,titleObj:n,modificationDate:i,contentsObj:r,richText:o,parent:s,rect:l,parentRect:c,open:u}){this.#he=e,this.#Hn=n,this.#Dn=r,this.#Bn=o,this.#jn=s,this.#Mn=t,this.#Fn=l,this.#zn=c,this.#Nn=a,this.#In=ove.toDateObject(i),this.trigger=a.flatMap((e=>e.getElementsToTriggerPopup()));for(const e of this.trigger)e.addEventListener("click",this.#Pn),e.addEventListener("mouseenter",this.#Cn),e.addEventListener("mouseleave",this.#En),e.classList.add("popupTriggerArea");for(const e of a)e.container?.addEventListener("keydown",this.#An);this.#he.hidden=!0,u&&this.#On()}render(){if(this.#Ln)return;const e=this.#Ln=document.createElement("div");if(e.className="popup",this.#Mn){const t=e.style.outlineColor=Iye.makeHexColor(...this.#Mn);if(CSS.supports("background-color","color-mix(in srgb, red 30%, white)"))e.style.backgroundColor=`color-mix(in srgb, ${t} 30%, white)`;else{const t=.7;e.style.backgroundColor=Iye.makeHexColor(...this.#Mn.map((e=>Math.floor(t*(255-e)+e))))}}const t=document.createElement("span");t.className="header";const a=document.createElement("h1");if(t.append(a),({dir:a.dir,str:a.textContent}=this.#Hn),e.append(t),this.#In){const e=document.createElement("span");e.classList.add("popupDate"),e.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),e.setAttribute("data-l10n-args",JSON.stringify({dateObj:this.#In.valueOf()})),t.append(e)}const n=this.#Un;if(n)jwe.render({xfaHtml:n,intent:"richText",div:e}),e.lastChild.classList.add("richText","popupContent");else{const t=this._formatContents(this.#Dn);e.append(t)}this.#he.append(e)}get#Un(){const e=this.#Bn,t=this.#Dn;return!e?.str||t?.str&&t.str!==e.str?null:this.#Bn.html||null}get#Vn(){return this.#Un?.attributes?.style?.fontSize||0}get#Wn(){return this.#Un?.attributes?.style?.color||null}#$n(e){const t=[],a={str:e,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:t}]}},n={style:{color:this.#Wn,fontSize:this.#Vn?`calc(${this.#Vn}px * var(--scale-factor))`:""}};for(const a of e.split("\n"))t.push({name:"span",value:a,attributes:n});return a}_formatContents({str:e,dir:t}){const a=document.createElement("p");a.classList.add("popupContent"),a.dir=t;const n=e.split(/(?:\r\n?|\n)/);for(let e=0,t=n.length;e<t;++e){const i=n[e];a.append(document.createTextNode(i)),e<t-1&&a.append(document.createElement("br"))}return a}#Sn(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||("Enter"===e.key||"Escape"===e.key&&this.#Rn)&&this.#On()}updateEdited({rect:e,popupContent:t}){this.#fn||={contentsObj:this.#Dn,richText:this.#Bn},e&&(this.#_=null),t&&(this.#Bn=this.#$n(t),this.#Dn=null),this.#Ln?.remove(),this.#Ln=null}resetEdited(){this.#fn&&(({contentsObj:this.#Dn,richText:this.#Bn}=this.#fn),this.#fn=null,this.#Ln?.remove(),this.#Ln=null,this.#_=null)}#Gn(){if(null!==this.#_)return;const{page:{view:e},viewport:{rawDims:{pageWidth:t,pageHeight:a,pageX:n,pageY:i}}}=this.#jn;let r=!!this.#zn,o=r?this.#zn:this.#Fn;for(const e of this.#Nn)if(!o||null!==Iye.intersect(e.data.rect,o)){o=e.data.rect,r=!0;break}const s=Iye.normalizeRect([o[0],e[3]-o[1]+e[1],o[2],e[3]-o[3]+e[1]]),l=r?o[2]-o[0]+5:0,c=s[0]+l,u=s[1];this.#_=[100*(c-n)/t,100*(u-i)/a];const{style:d}=this.#he;d.left=`${this.#_[0]}%`,d.top=`${this.#_[1]}%`}#On(){this.#Rn=!this.#Rn,this.#Rn?(this.#Tn(),this.#he.addEventListener("click",this.#Pn),this.#he.addEventListener("keydown",this.#An)):(this.#_n(),this.#he.removeEventListener("click",this.#Pn),this.#he.removeEventListener("keydown",this.#An))}#Tn(){this.#Ln||this.render(),this.isVisible?this.#Rn&&this.#he.classList.add("focused"):(this.#Gn(),this.#he.hidden=!1,this.#he.style.zIndex=parseInt(this.#he.style.zIndex)+1e3)}#_n(){this.#he.classList.remove("focused"),!this.#Rn&&this.isVisible&&(this.#he.hidden=!0,this.#he.style.zIndex=parseInt(this.#he.style.zIndex)-1e3)}forceHide(){this.#qn=this.isVisible,this.#qn&&(this.#he.hidden=!0)}maybeShow(){this.#qn&&(this.#Ln||this.#Tn(),this.#qn=!1,this.#he.hidden=!1)}get isVisible(){return!1===this.#he.hidden}}class Qwe extends Bwe{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=Pfe.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const e=document.createElement("div");e.classList.add("annotationTextContent"),e.setAttribute("role","comment");for(const t of this.textContent){const a=document.createElement("span");a.textContent=t,e.append(a)}this.container.append(e)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}class Jwe extends Bwe{#Kn=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");const e=this.data,{width:t,height:a}=Lwe(e.rect),n=this.svgFactory.create(t,a,!0),i=this.#Kn=this.svgFactory.createElement("svg:line");return i.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),i.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),i.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),i.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),i.setAttribute("stroke-width",e.borderStyle.width||1),i.setAttribute("stroke","transparent"),i.setAttribute("fill","transparent"),n.append(i),this.container.append(n),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#Kn}addHighlightArea(){this.container.classList.add("highlightArea")}}class exe extends Bwe{#Zn=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");const e=this.data,{width:t,height:a}=Lwe(e.rect),n=this.svgFactory.create(t,a,!0),i=e.borderStyle.width,r=this.#Zn=this.svgFactory.createElement("svg:rect");return r.setAttribute("x",i/2),r.setAttribute("y",i/2),r.setAttribute("width",t-i),r.setAttribute("height",a-i),r.setAttribute("stroke-width",i||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),n.append(r),this.container.append(n),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#Zn}addHighlightArea(){this.container.classList.add("highlightArea")}}class txe extends Bwe{#Yn=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");const e=this.data,{width:t,height:a}=Lwe(e.rect),n=this.svgFactory.create(t,a,!0),i=e.borderStyle.width,r=this.#Yn=this.svgFactory.createElement("svg:ellipse");return r.setAttribute("cx",t/2),r.setAttribute("cy",a/2),r.setAttribute("rx",t/2-i/2),r.setAttribute("ry",a/2-i/2),r.setAttribute("stroke-width",i||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),n.append(r),this.container.append(n),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#Yn}addHighlightArea(){this.container.classList.add("highlightArea")}}class axe extends Bwe{#Xn=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,vertices:t,borderStyle:a,popupRef:n}}=this;if(!t)return this.container;const{width:i,height:r}=Lwe(e),o=this.svgFactory.create(i,r,!0);let s=[];for(let a=0,n=t.length;a<n;a+=2){const n=t[a]-e[0],i=e[3]-t[a+1];s.push(`${n},${i}`)}s=s.join(" ");const l=this.#Xn=this.svgFactory.createElement(this.svgElementName);return l.setAttribute("points",s),l.setAttribute("stroke-width",a.width||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),o.append(l),this.container.append(o),!n&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#Xn}addHighlightArea(){this.container.classList.add("highlightArea")}}class nxe extends axe{constructor(e){super(e),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class ixe extends Bwe{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}class rxe extends Bwe{#Qn=[];constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType="InkHighlight"===this.data.it?Pfe.HIGHLIGHT:Pfe.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,inkLists:t,borderStyle:a,popupRef:n}}=this,{width:i,height:r}=Lwe(e),o=this.svgFactory.create(i,r,!0);for(const n of t){let t=[];for(let a=0,i=n.length;a<i;a+=2){const i=n[a]-e[0],r=e[3]-n[a+1];t.push(`${i},${r}`)}t=t.join(" ");const i=this.svgFactory.createElement(this.svgElementName);this.#Qn.push(i),i.setAttribute("points",t),i.setAttribute("stroke-width",a.width||1),i.setAttribute("stroke","transparent"),i.setAttribute("fill","transparent"),o.append(i)}return!n&&this.hasPopupData&&this._createPopup(),this.container.append(o),this._editOnDoubleClick(),this.container}getElementsToTriggerPopup(){return this.#Qn}addHighlightArea(){this.container.classList.add("highlightArea")}}class oxe extends Bwe{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=Pfe.HIGHLIGHT}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),this.container}}class sxe extends Bwe{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class lxe extends Bwe{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class cxe extends Bwe{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class uxe extends Bwe{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=Pfe.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}class dxe extends Bwe{#Jn=null;constructor(e){super(e,{isRenderable:!0});const{file:t}=this.data;this.filename=t.filename,this.content=t.content,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,...t})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:e,data:t}=this;let a;t.hasAppearance||0===t.fillAlpha?a=document.createElement("div"):(a=document.createElement("img"),a.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(t.name)?"paperclip":"pushpin"}.svg`,t.fillAlpha&&t.fillAlpha<1&&(a.style=`filter: opacity(${Math.round(100*t.fillAlpha)}%);`)),a.addEventListener("dblclick",this.#ei.bind(this)),this.#Jn=a;const{isMac:n}=Mye.platform;return e.addEventListener("keydown",(e=>{"Enter"===e.key&&(n?e.metaKey:e.ctrlKey)&&this.#ei()})),!t.popupRef&&this.hasPopupData?this._createPopup():a.classList.add("popupTriggerArea"),e.append(a),e}getElementsToTriggerPopup(){return this.#Jn}addHighlightArea(){this.container.classList.add("highlightArea")}#ei(){this.downloadManager?.openOrDownloadData(this.content,this.filename)}}let hxe=class{#ti=null;#ai=null;#ni=new Map;#ii=null;constructor({div:e,accessibilityManager:t,annotationCanvasMap:a,annotationEditorUIManager:n,page:i,viewport:r,structTreeLayer:o}){this.div=e,this.#ti=t,this.#ai=a,this.#ii=o||null,this.page=i,this.viewport=r,this.zIndex=0,this._annotationEditorUIManager=n}hasEditableAnnotations(){return this.#ni.size>0}async#ri(e,t){const a=e.firstChild||e,n=a.id=`${Rye}${t}`,i=await(this.#ii?.getAriaAttributes(n));if(i)for(const[e,t]of i)a.setAttribute(e,t);this.div.append(e),this.#ti?.moveElementInDOM(this.div,e,a,!1)}async render(e){const{annotations:t}=e,a=this.div;dve(a,this.viewport);const n=new Map,i={data:null,layer:a,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:!1!==e.renderForms,svgFactory:new Nwe,annotationStorage:e.annotationStorage||new Ove,enableScripting:!0===e.enableScripting,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(const e of t){if(e.noHTML)continue;const t=e.annotationType===eye;if(t){const t=n.get(e.id);if(!t)continue;i.elements=t}else{const{width:t,height:a}=Lwe(e.rect);if(t<=0||a<=0)continue}i.data=e;const a=Fwe.create(i);if(!a.isRenderable)continue;if(!t&&e.popupRef){const t=n.get(e.popupRef);t?t.push(a):n.set(e.popupRef,[a])}const r=a.render();e.hidden&&(r.style.visibility="hidden"),await this.#ri(r,e.id),a._isEditable&&(this.#ni.set(a.data.id,a),this._annotationEditorUIManager?.renderAnnotationElement(a))}this.#oi()}update({viewport:e}){const t=this.div;this.viewport=e,dve(t,{rotation:e.rotation}),this.#oi(),t.hidden=!1}#oi(){if(!this.#ai)return;const e=this.div;for(const[t,a]of this.#ai){const n=e.querySelector(`[data-annotation-id="${t}"]`);if(!n)continue;a.className="annotationContent";const{firstChild:i}=n;i?"CANVAS"===i.nodeName?i.replaceWith(a):i.classList.contains("annotationContent")?i.after(a):i.before(a):n.append(a)}this.#ai.clear()}getEditableAnnotations(){return Array.from(this.#ni.values())}getEditableAnnotation(e){return this.#ni.get(e)}};const mxe=/\r\n?|\n/g;class pxe extends Ave{#Mn;#si="";#li=`${this.id}-editor`;#ci=null;#Vn;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){const e=pxe.prototype,t=e=>e.isEmpty(),a=xve.TRANSLATE_SMALL,n=xve.TRANSLATE_BIG;return bye(this,"_keyboardManager",new bve([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],e.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],e.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],e._translateEmpty,{args:[-a,0],checker:t}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e._translateEmpty,{args:[-n,0],checker:t}],[["ArrowRight","mac+ArrowRight"],e._translateEmpty,{args:[a,0],checker:t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[n,0],checker:t}],[["ArrowUp","mac+ArrowUp"],e._translateEmpty,{args:[0,-a],checker:t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-n],checker:t}],[["ArrowDown","mac+ArrowDown"],e._translateEmpty,{args:[0,a],checker:t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,n],checker:t}]]))}static _type="freetext";static _editorType=Pfe.FREETEXT;constructor(e){super({...e,name:"freeTextEditor"}),this.#Mn=e.color||pxe._defaultColor||Ave._defaultLineColor,this.#Vn=e.fontSize||pxe._defaultFontSize}static initialize(e,t){Ave.initialize(e,t);const a=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(a.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,t){switch(e){case Ofe.FREETEXT_SIZE:pxe._defaultFontSize=t;break;case Ofe.FREETEXT_COLOR:pxe._defaultColor=t}}updateParams(e,t){switch(e){case Ofe.FREETEXT_SIZE:this.#ui(t);break;case Ofe.FREETEXT_COLOR:this.#di(t)}}static get defaultPropertiesToUpdate(){return[[Ofe.FREETEXT_SIZE,pxe._defaultFontSize],[Ofe.FREETEXT_COLOR,pxe._defaultColor||Ave._defaultLineColor]]}get propertiesToUpdate(){return[[Ofe.FREETEXT_SIZE,this.#Vn],[Ofe.FREETEXT_COLOR,this.#Mn]]}#ui(e){const t=e=>{this.editorDiv.style.fontSize=`calc(${e}px * var(--scale-factor))`,this.translate(0,-(e-this.#Vn)*this.parentScale),this.#Vn=e,this.#hi()},a=this.#Vn;this.addCommands({cmd:t.bind(this,e),undo:t.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Ofe.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#di(e){const t=e=>{this.#Mn=this.editorDiv.style.color=e},a=this.#Mn;this.addCommands({cmd:t.bind(this,e),undo:t.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Ofe.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(e,t){this._uiManager.translateSelectedEditors(e,t,!0)}getInitialTranslation(){const e=this.parentScale;return[-pxe._internalPadding*e,-(pxe._internalPadding+this.#Vn)*e]}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(this.isInEditMode())return;this.parent.setEditingState(!1),this.parent.updateToolbar(Pfe.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),this.#ci=new AbortController;const e=this._uiManager.combinedSignal(this.#ci);this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:e}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:e}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:e}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:e}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:e})}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#li),this._isDraggable=!0,this.#ci?.abort(),this.#ci=null,this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){this.width||(this.enableEditMode(),this.editorDiv.focus(),this._initialOptions?.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||""===this.editorDiv.innerText.trim()}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}#mi(){const e=[];this.editorDiv.normalize();let t=null;for(const a of this.editorDiv.childNodes)t?.nodeType===Node.TEXT_NODE&&"BR"===a.nodeName||(e.push(pxe.#pi(a)),t=a);return e.join("\n")}#hi(){const[e,t]=this.parentDimensions;let a;if(this.isAttachedToDOM)a=this.div.getBoundingClientRect();else{const{currentLayer:e,div:t}=this,n=t.style.display,i=t.classList.contains("hidden");t.classList.remove("hidden"),t.style.display="hidden",e.div.append(this.div),a=t.getBoundingClientRect(),t.remove(),t.style.display=n,t.classList.toggle("hidden",i)}this.rotation%180==this.parentRotation%180?(this.width=a.width/e,this.height=a.height/t):(this.width=a.height/e,this.height=a.width/t),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const e=this.#si,t=this.#si=this.#mi().trimEnd();if(e===t)return;const a=e=>{this.#si=e,e?(this.#gi(),this._uiManager.rebuild(this),this.#hi()):this.remove()};this.addCommands({cmd:()=>{a(t)},undo:()=>{a(e)},mustExec:!1}),this.#hi()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(e){this.enterInEditMode()}keydown(e){e.target===this.div&&"Enter"===e.key&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(e){pxe._keyboardManager.exec(this,e)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){if(this.div)return this.div;let e,t;this.width&&(e=this.x,t=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",this.#li),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;const{style:a}=this.editorDiv;if(a.fontSize=`calc(${this.#Vn}px * var(--scale-factor))`,a.color=this.#Mn,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),gve(this,this.div,["dblclick","keydown"]),this.width){const[a,n]=this.parentDimensions;if(this.annotationElementId){const{position:i}=this._initialData;let[r,o]=this.getInitialTranslation();[r,o]=this.pageTranslationToScreen(r,o);const[s,l]=this.pageDimensions,[c,u]=this.pageTranslation;let d,h;switch(this.rotation){case 0:d=e+(i[0]-c)/s,h=t+this.height-(i[1]-u)/l;break;case 90:d=e+(i[0]-c)/s,h=t-(i[1]-u)/l,[r,o]=[o,-r];break;case 180:d=e-this.width+(i[0]-c)/s,h=t-(i[1]-u)/l,[r,o]=[-r,-o];break;case 270:d=e+(i[0]-c-this.height*l)/s,h=t+(i[1]-u-this.width*s)/l,[r,o]=[-o,r]}this.setAt(d*a,h*n,r,o)}else this.setAt(e*a,t*n,this.width*a,this.height*n);this.#gi(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}static#pi(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(mxe,"")}editorDivPaste(e){const t=e.clipboardData||window.clipboardData,{types:a}=t;if(1===a.length&&"text/plain"===a[0])return;e.preventDefault();const n=pxe.#fi(t.getData("text")||"").replaceAll(mxe,"\n");if(!n)return;const i=window.getSelection();if(!i.rangeCount)return;this.editorDiv.normalize(),i.deleteFromDocument();const r=i.getRangeAt(0);if(!n.includes("\n"))return r.insertNode(document.createTextNode(n)),this.editorDiv.normalize(),void i.collapseToStart();const{startContainer:o,startOffset:s}=r,l=[],c=[];if(o.nodeType===Node.TEXT_NODE){const e=o.parentElement;if(c.push(o.nodeValue.slice(s).replaceAll(mxe,"")),e!==this.editorDiv){let t=l;for(const a of this.editorDiv.childNodes)a!==e?t.push(pxe.#pi(a)):t=c}l.push(o.nodeValue.slice(0,s).replaceAll(mxe,""))}else if(o===this.editorDiv){let e=l,t=0;for(const a of this.editorDiv.childNodes)t++===s&&(e=c),e.push(pxe.#pi(a))}this.#si=`${l.join("\n")}${n}${c.join("\n")}`,this.#gi();const u=new Range;let d=l.reduce(((e,t)=>e+t.length),0);for(const{firstChild:e}of this.editorDiv.childNodes)if(e.nodeType===Node.TEXT_NODE){const t=e.nodeValue.length;if(d<=t){u.setStart(e,d),u.setEnd(e,d);break}d-=t}i.removeAllRanges(),i.addRange(u)}#gi(){if(this.editorDiv.replaceChildren(),this.#si)for(const e of this.#si.split("\n")){const t=document.createElement("div");t.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(t)}}#yi(){return this.#si.replaceAll(" "," ")}static#fi(e){return e.replaceAll(" "," ")}get contentDiv(){return this.editorDiv}static async deserialize(e,t,a){let n=null;if(e instanceof Qwe){const{data:{defaultAppearanceData:{fontSize:t,fontColor:a},rect:i,rotation:r,id:o,popupRef:s},textContent:l,textPosition:c,parent:{page:{pageNumber:u}}}=e;if(!l||0===l.length)return null;n=e={annotationType:Pfe.FREETEXT,color:Array.from(a),fontSize:t,value:l.join("\n"),position:c,pageIndex:u-1,rect:i.slice(0),rotation:r,id:o,deleted:!1,popupRef:s}}const i=await super.deserialize(e,t,a);return i.#Vn=e.fontSize,i.#Mn=Iye.makeHexColor(...e.color),i.#si=pxe.#fi(e.value),i.annotationElementId=e.id||null,i._initialData=n,i}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const t=pxe._internalPadding*this.parentScale,a=this.getRect(t,t),n=Ave._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.#Mn),i={annotationType:Pfe.FREETEXT,color:n,fontSize:this.#Vn,value:this.#yi(),pageIndex:this.pageIndex,rect:a,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return e?i:this.annotationElementId&&!this.#vi(i)?null:(i.id=this.annotationElementId,i)}#vi(e){const{value:t,fontSize:a,color:n,pageIndex:i}=this._initialData;return this._hasBeenMoved||e.value!==t||e.fontSize!==a||e.color.some(((e,t)=>e!==n[t]))||e.pageIndex!==i}renderAnnotationElement(e){const t=super.renderAnnotationElement(e);if(this.deleted)return t;const{style:a}=t;a.fontSize=`calc(${this.#Vn}px * var(--scale-factor))`,a.color=this.#Mn,t.replaceChildren();for(const e of this.#si.split("\n")){const a=document.createElement("div");a.append(e?document.createTextNode(e):document.createElement("br")),t.append(a)}const n=pxe._internalPadding*this.parentScale;return e.updateEdited({rect:this.getRect(n,n),popupContent:this.#si}),t}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}}class gxe{toSVGPath(){fye("Abstract method `toSVGPath` must be implemented.")}get box(){fye("Abstract getter `box` must be implemented.")}serialize(e,t){fye("Abstract method `serialize` must be implemented.")}get classNamesForDrawing(){fye("Abstract getter `classNamesForDrawing` must be implemented.")}get classNamesForOutlining(){fye("Abstract getter `classNamesForOutlining` must be implemented.")}get mustRemoveSelfIntersections(){return!1}}class fxe{#bi;#wi=[];#xi;#ki;#Ai=[];#Si=new Float64Array(18);#Ei;#_i;#Ci;#Ti;#Pi;#Oi;#Mi=[];static#Di=8;static#Ii=2;static#Ni=fxe.#Di+fxe.#Ii;constructor({x:e,y:t},a,n,i,r,o=0){this.#bi=a,this.#Oi=i*n,this.#ki=r,this.#Si.set([NaN,NaN,NaN,NaN,e,t],6),this.#xi=o,this.#Ti=fxe.#Di*n,this.#Ci=fxe.#Ni*n,this.#Pi=n,this.#Mi.push(e,t)}isEmpty(){return isNaN(this.#Si[8])}#ji(){const e=this.#Si.subarray(4,6),t=this.#Si.subarray(16,18),[a,n,i,r]=this.#bi;return[(this.#Ei+(e[0]-t[0])/2-a)/i,(this.#_i+(e[1]-t[1])/2-n)/r,(this.#Ei+(t[0]-e[0])/2-a)/i,(this.#_i+(t[1]-e[1])/2-n)/r]}add({x:e,y:t}){this.#Ei=e,this.#_i=t;const[a,n,i,r]=this.#bi;let[o,s,l,c]=this.#Si.subarray(8,12);const u=e-l,d=t-c,h=Math.hypot(u,d);if(h<this.#Ci)return!1;const m=h-this.#Ti,p=m/h,g=p*u,f=p*d;let y=o,v=s;o=l,s=c,l+=g,c+=f,this.#Mi?.push(e,t);const b=g/m,w=-f/m*this.#Oi,x=b*this.#Oi;if(this.#Si.set(this.#Si.subarray(2,8),0),this.#Si.set([l+w,c+x],4),this.#Si.set(this.#Si.subarray(14,18),12),this.#Si.set([l-w,c-x],16),isNaN(this.#Si[6]))return 0===this.#Ai.length&&(this.#Si.set([o+w,s+x],2),this.#Ai.push(NaN,NaN,NaN,NaN,(o+w-a)/i,(s+x-n)/r),this.#Si.set([o-w,s-x],14),this.#wi.push(NaN,NaN,NaN,NaN,(o-w-a)/i,(s-x-n)/r)),this.#Si.set([y,v,o,s,l,c],6),!this.isEmpty();this.#Si.set([y,v,o,s,l,c],6);return Math.abs(Math.atan2(v-s,y-o)-Math.atan2(f,g))<Math.PI/2?([o,s,l,c]=this.#Si.subarray(2,6),this.#Ai.push(NaN,NaN,NaN,NaN,((o+l)/2-a)/i,((s+c)/2-n)/r),[o,s,y,v]=this.#Si.subarray(14,18),this.#wi.push(NaN,NaN,NaN,NaN,((y+o)/2-a)/i,((v+s)/2-n)/r),!0):([y,v,o,s,l,c]=this.#Si.subarray(0,6),this.#Ai.push(((y+5*o)/6-a)/i,((v+5*s)/6-n)/r,((5*o+l)/6-a)/i,((5*s+c)/6-n)/r,((o+l)/2-a)/i,((s+c)/2-n)/r),[l,c,o,s,y,v]=this.#Si.subarray(12,18),this.#wi.push(((y+5*o)/6-a)/i,((v+5*s)/6-n)/r,((5*o+l)/6-a)/i,((5*s+c)/6-n)/r,((o+l)/2-a)/i,((s+c)/2-n)/r),!0)}toSVGPath(){if(this.isEmpty())return"";const e=this.#Ai,t=this.#wi;if(isNaN(this.#Si[6])&&!this.isEmpty())return this.#zi();const a=[];a.push(`M${e[4]} ${e[5]}`);for(let t=6;t<e.length;t+=6)isNaN(e[t])?a.push(`L${e[t+4]} ${e[t+5]}`):a.push(`C${e[t]} ${e[t+1]} ${e[t+2]} ${e[t+3]} ${e[t+4]} ${e[t+5]}`);this.#Ri(a);for(let e=t.length-6;e>=6;e-=6)isNaN(t[e])?a.push(`L${t[e+4]} ${t[e+5]}`):a.push(`C${t[e]} ${t[e+1]} ${t[e+2]} ${t[e+3]} ${t[e+4]} ${t[e+5]}`);return this.#Li(a),a.join(" ")}#zi(){const[e,t,a,n]=this.#bi,[i,r,o,s]=this.#ji();return`M${(this.#Si[2]-e)/a} ${(this.#Si[3]-t)/n} L${(this.#Si[4]-e)/a} ${(this.#Si[5]-t)/n} L${i} ${r} L${o} ${s} L${(this.#Si[16]-e)/a} ${(this.#Si[17]-t)/n} L${(this.#Si[14]-e)/a} ${(this.#Si[15]-t)/n} Z`}#Li(e){const t=this.#wi;e.push(`L${t[4]} ${t[5]} Z`)}#Ri(e){const[t,a,n,i]=this.#bi,r=this.#Si.subarray(4,6),o=this.#Si.subarray(16,18),[s,l,c,u]=this.#ji();e.push(`L${(r[0]-t)/n} ${(r[1]-a)/i} L${s} ${l} L${c} ${u} L${(o[0]-t)/n} ${(o[1]-a)/i}`)}newFreeDrawOutline(e,t,a,n,i,r){return new yxe(e,t,a,n,i,r)}getOutlines(){const e=this.#Ai,t=this.#wi,a=this.#Si,[n,i,r,o]=this.#bi,s=new Float64Array((this.#Mi?.length??0)+2);for(let e=0,t=s.length-2;e<t;e+=2)s[e]=(this.#Mi[e]-n)/r,s[e+1]=(this.#Mi[e+1]-i)/o;if(s[s.length-2]=(this.#Ei-n)/r,s[s.length-1]=(this.#_i-i)/o,isNaN(a[6])&&!this.isEmpty())return this.#Fi(s);const l=new Float64Array(this.#Ai.length+24+this.#wi.length);let c=e.length;for(let t=0;t<c;t+=2)isNaN(e[t])?l[t]=l[t+1]=NaN:(l[t]=e[t],l[t+1]=e[t+1]);c=this.#Bi(l,c);for(let e=t.length-6;e>=6;e-=6)for(let a=0;a<6;a+=2)isNaN(t[e+a])?(l[c]=l[c+1]=NaN,c+=2):(l[c]=t[e+a],l[c+1]=t[e+a+1],c+=2);return this.#Hi(l,c),this.newFreeDrawOutline(l,s,this.#bi,this.#Pi,this.#xi,this.#ki)}#Fi(e){const t=this.#Si,[a,n,i,r]=this.#bi,[o,s,l,c]=this.#ji(),u=new Float64Array(36);return u.set([NaN,NaN,NaN,NaN,(t[2]-a)/i,(t[3]-n)/r,NaN,NaN,NaN,NaN,(t[4]-a)/i,(t[5]-n)/r,NaN,NaN,NaN,NaN,o,s,NaN,NaN,NaN,NaN,l,c,NaN,NaN,NaN,NaN,(t[16]-a)/i,(t[17]-n)/r,NaN,NaN,NaN,NaN,(t[14]-a)/i,(t[15]-n)/r],0),this.newFreeDrawOutline(u,e,this.#bi,this.#Pi,this.#xi,this.#ki)}#Hi(e,t){const a=this.#wi;return e.set([NaN,NaN,NaN,NaN,a[4],a[5]],t),t+6}#Bi(e,t){const a=this.#Si.subarray(4,6),n=this.#Si.subarray(16,18),[i,r,o,s]=this.#bi,[l,c,u,d]=this.#ji();return e.set([NaN,NaN,NaN,NaN,(a[0]-i)/o,(a[1]-r)/s,NaN,NaN,NaN,NaN,l,c,NaN,NaN,NaN,NaN,u,d,NaN,NaN,NaN,NaN,(n[0]-i)/o,(n[1]-r)/s],t),t+24}}class yxe extends gxe{#bi;#qi=null;#xi;#ki;#Mi;#Pi;#Ui;constructor(e,t,a,n,i,r){super(),this.#Ui=e,this.#Mi=t,this.#bi=a,this.#Pi=n,this.#xi=i,this.#ki=r,this.#Vi(r);const{x:o,y:s,width:l,height:c}=this.#qi;for(let t=0,a=e.length;t<a;t+=2)e[t]=(e[t]-o)/l,e[t+1]=(e[t+1]-s)/c;for(let e=0,a=t.length;e<a;e+=2)t[e]=(t[e]-o)/l,t[e+1]=(t[e+1]-s)/c}toSVGPath(){const e=[`M${this.#Ui[4]} ${this.#Ui[5]}`];for(let t=6,a=this.#Ui.length;t<a;t+=6)isNaN(this.#Ui[t])?e.push(`L${this.#Ui[t+4]} ${this.#Ui[t+5]}`):e.push(`C${this.#Ui[t]} ${this.#Ui[t+1]} ${this.#Ui[t+2]} ${this.#Ui[t+3]} ${this.#Ui[t+4]} ${this.#Ui[t+5]}`);return e.push("Z"),e.join(" ")}serialize([e,t,a,n],i){const r=a-e,o=n-t;let s,l;switch(i){case 0:s=this.#Wi(this.#Ui,e,n,r,-o),l=this.#Wi(this.#Mi,e,n,r,-o);break;case 90:s=this.#$i(this.#Ui,e,t,r,o),l=this.#$i(this.#Mi,e,t,r,o);break;case 180:s=this.#Wi(this.#Ui,a,t,-r,o),l=this.#Wi(this.#Mi,a,t,-r,o);break;case 270:s=this.#$i(this.#Ui,a,n,-r,-o),l=this.#$i(this.#Mi,a,n,-r,-o)}return{outline:Array.from(s),points:[Array.from(l)]}}#Wi(e,t,a,n,i){const r=new Float64Array(e.length);for(let o=0,s=e.length;o<s;o+=2)r[o]=t+e[o]*n,r[o+1]=a+e[o+1]*i;return r}#$i(e,t,a,n,i){const r=new Float64Array(e.length);for(let o=0,s=e.length;o<s;o+=2)r[o]=t+e[o+1]*n,r[o+1]=a+e[o]*i;return r}#Vi(e){const t=this.#Ui;let a=t[4],n=t[5],i=a,r=n,o=a,s=n,l=a,c=n;const u=e?Math.max:Math.min;for(let e=6,d=t.length;e<d;e+=6){if(isNaN(t[e]))i=Math.min(i,t[e+4]),r=Math.min(r,t[e+5]),o=Math.max(o,t[e+4]),s=Math.max(s,t[e+5]),c<t[e+5]?(l=t[e+4],c=t[e+5]):c===t[e+5]&&(l=u(l,t[e+4]));else{const d=Iye.bezierBoundingBox(a,n,...t.slice(e,e+6));i=Math.min(i,d[0]),r=Math.min(r,d[1]),o=Math.max(o,d[2]),s=Math.max(s,d[3]),c<d[3]?(l=d[2],c=d[3]):c===d[3]&&(l=u(l,d[2]))}a=t[e+4],n=t[e+5]}const d=i-this.#xi,h=r-this.#xi,m=o-i+2*this.#xi,p=s-r+2*this.#xi;this.#qi={x:d,y:h,width:m,height:p,lastPoint:[l,c]}}get box(){return this.#qi}newOutliner(e,t,a,n,i,r=0){return new fxe(e,t,a,n,i,r)}getNewOutline(e,t){const{x:a,y:n,width:i,height:r}=this.#qi,[o,s,l,c]=this.#bi,u=i*l,d=r*c,h=a*l+o,m=n*c+s,p=this.newOutliner({x:this.#Mi[0]*u+h,y:this.#Mi[1]*d+m},this.#bi,this.#Pi,e,this.#ki,t??this.#xi);for(let e=2;e<this.#Mi.length;e+=2)p.add({x:this.#Mi[e]*u+h,y:this.#Mi[e+1]*d+m});return p.getOutlines()}get mustRemoveSelfIntersections(){return!0}}class vxe{#bi;#Gi=[];#Ki=[];constructor(e,t=0,a=0,n=!0){let i=1/0,r=-1/0,o=1/0,s=-1/0;const l=10**-4;for(const{x:a,y:n,width:c,height:u}of e){const e=Math.floor((a-t)/l)*l,d=Math.ceil((a+c+t)/l)*l,h=Math.floor((n-t)/l)*l,m=Math.ceil((n+u+t)/l)*l,p=[e,h,m,!0],g=[d,h,m,!1];this.#Gi.push(p,g),i=Math.min(i,e),r=Math.max(r,d),o=Math.min(o,h),s=Math.max(s,m)}const c=r-i+2*a,u=s-o+2*a,d=i-a,h=o-a,m=this.#Gi.at(n?-1:-2),p=[m[0],m[2]];for(const e of this.#Gi){const[t,a,n]=e;e[0]=(t-d)/c,e[1]=(a-h)/u,e[2]=(n-h)/u}this.#bi={x:d,y:h,width:c,height:u,lastPoint:p}}getOutlines(){this.#Gi.sort(((e,t)=>e[0]-t[0]||e[1]-t[1]||e[2]-t[2]));const e=[];for(const t of this.#Gi)t[3]?(e.push(...this.#Zi(t)),this.#Yi(t)):(this.#Xi(t),e.push(...this.#Zi(t)));return this.#Qi(e)}#Qi(e){const t=[],a=new Set;for(const a of e){const[e,n,i]=a;t.push([e,n,a],[e,i,a])}t.sort(((e,t)=>e[1]-t[1]||e[0]-t[0]));for(let e=0,n=t.length;e<n;e+=2){const n=t[e][2],i=t[e+1][2];n.push(i),i.push(n),a.add(n),a.add(i)}const n=[];let i;for(;a.size>0;){const e=a.values().next().value;let[t,r,o,s,l]=e;a.delete(e);let c=t,u=r;for(i=[t,o],n.push(i);;){let e;if(a.has(s))e=s;else{if(!a.has(l))break;e=l}a.delete(e),[t,r,o,s,l]=e,c!==t&&(i.push(c,u,t,u===r?r:o),c=t),u=u===r?o:r}i.push(c,u)}return new bxe(n,this.#bi)}#Ji(e){const t=this.#Ki;let a=0,n=t.length-1;for(;a<=n;){const i=a+n>>1,r=t[i][0];if(r===e)return i;r<e?a=i+1:n=i-1}return n+1}#Yi([,e,t]){const a=this.#Ji(e);this.#Ki.splice(a,0,[e,t])}#Xi([,e,t]){const a=this.#Ji(e);for(let n=a;n<this.#Ki.length;n++){const[a,i]=this.#Ki[n];if(a!==e)break;if(a===e&&i===t)return void this.#Ki.splice(n,1)}for(let n=a-1;n>=0;n--){const[a,i]=this.#Ki[n];if(a!==e)break;if(a===e&&i===t)return void this.#Ki.splice(n,1)}}#Zi(e){const[t,a,n]=e,i=[[t,a,n]],r=this.#Ji(n);for(let e=0;e<r;e++){const[a,n]=this.#Ki[e];for(let e=0,r=i.length;e<r;e++){const[,o,s]=i[e];if(!(n<=o||s<=a))if(o>=a)if(s>n)i[e][1]=n;else{if(1===r)return[];i.splice(e,1),e--,r--}else i[e][2]=a,s>n&&i.push([t,n,s])}}return i}}class bxe extends gxe{#bi;#er;constructor(e,t){super(),this.#er=e,this.#bi=t}toSVGPath(){const e=[];for(const t of this.#er){let[a,n]=t;e.push(`M${a} ${n}`);for(let i=2;i<t.length;i+=2){const r=t[i],o=t[i+1];r===a?(e.push(`V${o}`),n=o):o===n&&(e.push(`H${r}`),a=r)}e.push("Z")}return e.join(" ")}serialize([e,t,a,n],i){const r=[],o=a-e,s=n-t;for(const t of this.#er){const a=new Array(t.length);for(let i=0;i<t.length;i+=2)a[i]=e+t[i]*o,a[i+1]=n-t[i+1]*s;r.push(a)}return r}get box(){return this.#bi}get classNamesForDrawing(){return["highlight"]}get classNamesForOutlining(){return["highlightOutline"]}}class wxe extends fxe{newFreeDrawOutline(e,t,a,n,i,r){return new xxe(e,t,a,n,i,r)}get classNamesForDrawing(){return["highlight","free"]}}class xxe extends yxe{get classNamesForDrawing(){return["highlight","free"]}get classNamesForOutlining(){return["highlightOutline","free"]}newOutliner(e,t,a,n,i,r=0){return new wxe(e,t,a,n,i,r)}}class kxe{#tr=null;#ar=null;#nr;#ir=null;#rr=!1;#or=!1;#r=null;#sr;#lr=null;#g=null;#cr;static#ur=null;static get _keyboardManager(){return bye(this,"_keyboardManager",new bve([[["Escape","mac+Escape"],kxe.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],kxe.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],kxe.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],kxe.prototype._moveToPrevious],[["Home","mac+Home"],kxe.prototype._moveToBeginning],[["End","mac+End"],kxe.prototype._moveToEnd]]))}constructor({editor:e=null,uiManager:t=null}){e?(this.#or=!1,this.#cr=Ofe.HIGHLIGHT_COLOR,this.#r=e):(this.#or=!0,this.#cr=Ofe.HIGHLIGHT_DEFAULT_COLOR),this.#g=e?._uiManager||t,this.#sr=this.#g._eventBus,this.#nr=e?.color||this.#g?.highlightColors.values().next().value||"#FFFF98",kxe.#ur||=Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"})}renderButton(){const e=this.#tr=document.createElement("button");e.className="colorPicker",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),e.setAttribute("aria-haspopup",!0);const t=this.#g._signal;e.addEventListener("click",this.#dr.bind(this),{signal:t}),e.addEventListener("keydown",this.#Sn.bind(this),{signal:t});const a=this.#ar=document.createElement("span");return a.className="swatch",a.setAttribute("aria-hidden",!0),a.style.backgroundColor=this.#nr,e.append(a),e}renderMainDropdown(){const e=this.#ir=this.#hr();return e.setAttribute("aria-orientation","horizontal"),e.setAttribute("aria-labelledby","highlightColorPickerLabel"),e}#hr(){const e=document.createElement("div"),t=this.#g._signal;e.addEventListener("contextmenu",ive,{signal:t}),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[a,n]of this.#g.highlightColors){const i=document.createElement("button");i.tabIndex="0",i.role="option",i.setAttribute("data-color",n),i.title=a,i.setAttribute("data-l10n-id",kxe.#ur[a]);const r=document.createElement("span");i.append(r),r.className="swatch",r.style.backgroundColor=n,i.setAttribute("aria-selected",n===this.#nr),i.addEventListener("click",this.#mr.bind(this,n),{signal:t}),e.append(i)}return e.addEventListener("keydown",this.#Sn.bind(this),{signal:t}),e}#mr(e,t){t.stopPropagation(),this.#sr.dispatch("switchannotationeditorparams",{source:this,type:this.#cr,value:e})}_colorSelectFromKeyboard(e){if(e.target===this.#tr)return void this.#dr(e);const t=e.target.getAttribute("data-color");t&&this.#mr(t,e)}_moveToNext(e){this.#pr?e.target!==this.#tr?e.target.nextSibling?.focus():this.#ir.firstChild?.focus():this.#dr(e)}_moveToPrevious(e){e.target!==this.#ir?.firstChild&&e.target!==this.#tr?(this.#pr||this.#dr(e),e.target.previousSibling?.focus()):this.#pr&&this._hideDropdownFromKeyboard()}_moveToBeginning(e){this.#pr?this.#ir.firstChild?.focus():this.#dr(e)}_moveToEnd(e){this.#pr?this.#ir.lastChild?.focus():this.#dr(e)}#Sn(e){kxe._keyboardManager.exec(this,e)}#dr(e){if(this.#pr)return void this.hideDropdown();if(this.#rr=0===e.detail,this.#lr||(this.#lr=new AbortController,window.addEventListener("pointerdown",this.#c.bind(this),{signal:this.#g.combinedSignal(this.#lr)})),this.#ir)return void this.#ir.classList.remove("hidden");const t=this.#ir=this.#hr();this.#tr.append(t)}#c(e){this.#ir?.contains(e.target)||this.hideDropdown()}hideDropdown(){this.#ir?.classList.add("hidden"),this.#lr?.abort(),this.#lr=null}get#pr(){return this.#ir&&!this.#ir.classList.contains("hidden")}_hideDropdownFromKeyboard(){this.#or||(this.#pr?(this.hideDropdown(),this.#tr.focus({preventScroll:!0,focusVisible:this.#rr})):this.#r?.unselect())}updateColor(e){if(this.#ar&&(this.#ar.style.backgroundColor=e),!this.#ir)return;const t=this.#g.highlightColors.values();for(const a of this.#ir.children)a.setAttribute("aria-selected",t.next().value===e)}destroy(){this.#tr?.remove(),this.#tr=null,this.#ar=null,this.#ir?.remove(),this.#ir=null}}class Axe extends Ave{#gr=null;#fr=0;#yr;#vr=null;#i=null;#br=null;#wr=null;#xr=0;#kr=null;#Ar=null;#b=null;#Sr=!1;#Er=null;#_r;#Cr=null;#Tr="";#Oi;#Pr="";static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=12;static _type="highlight";static _editorType=Pfe.HIGHLIGHT;static _freeHighlightId=-1;static _freeHighlight=null;static _freeHighlightClipId="";static get _keyboardManager(){const e=Axe.prototype;return bye(this,"_keyboardManager",new bve([[["ArrowLeft","mac+ArrowLeft"],e._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],e._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],e._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],e._moveCaret,{args:[3]}]]))}constructor(e){super({...e,name:"highlightEditor"}),this.color=e.color||Axe._defaultColor,this.#Oi=e.thickness||Axe._defaultThickness,this.#_r=e.opacity||Axe._defaultOpacity,this.#yr=e.boxes||null,this.#Pr=e.methodOfCreation||"",this.#Tr=e.text||"",this._isDraggable=!1,e.highlightId>-1?(this.#Sr=!0,this.#Or(e),this.#Mr()):this.#yr&&(this.#gr=e.anchorNode,this.#fr=e.anchorOffset,this.#wr=e.focusNode,this.#xr=e.focusOffset,this.#Dr(),this.#Mr(),this.rotate(this.rotation))}get telemetryInitialData(){return{action:"added",type:this.#Sr?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:this.#Oi,methodOfCreation:this.#Pr}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get("color").size}}#Dr(){const e=new vxe(this.#yr,.001);this.#Ar=e.getOutlines(),({x:this.x,y:this.y,width:this.width,height:this.height}=this.#Ar.box);const t=new vxe(this.#yr,.0025,.001,"ltr"===this._uiManager.direction);this.#br=t.getOutlines();const{lastPoint:a}=this.#br.box;this.#Er=[(a[0]-this.x)/this.width,(a[1]-this.y)/this.height]}#Or({highlightOutlines:e,highlightId:t,clipPathId:a}){this.#Ar=e;if(this.#br=e.getNewOutline(this.#Oi/2+1.5,.0025),t>=0)this.#b=t,this.#vr=a,this.parent.drawLayer.finalizeLine(t,e),this.#Cr=this.parent.drawLayer.drawOutline(this.#br);else if(this.parent){const t=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(this.#b,e),this.parent.drawLayer.updateBox(this.#b,Axe.#Ir(this.#Ar.box,(t-this.rotation+360)%360)),this.parent.drawLayer.updateLine(this.#Cr,this.#br),this.parent.drawLayer.updateBox(this.#Cr,Axe.#Ir(this.#br.box,t))}const{x:n,y:i,width:r,height:o}=e.box;switch(this.rotation){case 0:this.x=n,this.y=i,this.width=r,this.height=o;break;case 90:{const[e,t]=this.parentDimensions;this.x=i,this.y=1-n,this.width=r*t/e,this.height=o*e/t;break}case 180:this.x=1-n,this.y=1-i,this.width=r,this.height=o;break;case 270:{const[e,t]=this.parentDimensions;this.x=1-i,this.y=n,this.width=r*t/e,this.height=o*e/t;break}}const{lastPoint:s}=this.#br.box;this.#Er=[(s[0]-n)/r,(s[1]-i)/o]}static initialize(e,t){Ave.initialize(e,t),Axe._defaultColor||=t.highlightColors?.values().next().value||"#fff066"}static updateDefaultParams(e,t){switch(e){case Ofe.HIGHLIGHT_DEFAULT_COLOR:Axe._defaultColor=t;break;case Ofe.HIGHLIGHT_THICKNESS:Axe._defaultThickness=t}}translateInPage(e,t){}get toolbarPosition(){return this.#Er}updateParams(e,t){switch(e){case Ofe.HIGHLIGHT_COLOR:this.#di(t);break;case Ofe.HIGHLIGHT_THICKNESS:this.#Nr(t)}}static get defaultPropertiesToUpdate(){return[[Ofe.HIGHLIGHT_DEFAULT_COLOR,Axe._defaultColor],[Ofe.HIGHLIGHT_THICKNESS,Axe._defaultThickness]]}get propertiesToUpdate(){return[[Ofe.HIGHLIGHT_COLOR,this.color||Axe._defaultColor],[Ofe.HIGHLIGHT_THICKNESS,this.#Oi||Axe._defaultThickness],[Ofe.HIGHLIGHT_FREE,this.#Sr]]}#di(e){const t=(e,t)=>{this.color=e,this.parent?.drawLayer.changeColor(this.#b,e),this.#i?.updateColor(e),this.#_r=t,this.parent?.drawLayer.changeOpacity(this.#b,t)},a=this.color,n=this.#_r;this.addCommands({cmd:t.bind(this,e,Axe._defaultOpacity),undo:t.bind(this,a,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Ofe.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(e)},!0)}#Nr(e){const t=this.#Oi,a=e=>{this.#Oi=e,this.#jr(e)};this.addCommands({cmd:a.bind(this,e),undo:a.bind(this,t),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Ofe.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:e},!0)}async addEditToolbar(){const e=await super.addEditToolbar();return e?(this._uiManager.highlightColors&&(this.#i=new kxe({editor:this}),e.addColorPicker(this.#i)),e):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(this.#zr())}getBaseTranslation(){return[0,0]}getRect(e,t){return super.getRect(e,t,this.#zr())}onceAdded(){this.annotationElementId||this.parent.addUndoableEditor(this),this.div.focus()}remove(){this.#Rr(),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.#Mr(),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let t=!1;this.parent&&!e?this.#Rr():e&&(this.#Mr(e),t=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(e),this.show(this._isVisible),t&&this.select()}#jr(e){if(!this.#Sr)return;this.#Or({highlightOutlines:this.#Ar.getNewOutline(e/2)}),this.fixAndSetPosition();const[t,a]=this.parentDimensions;this.setDims(this.width*t,this.height*a)}#Rr(){null!==this.#b&&this.parent&&(this.parent.drawLayer.remove(this.#b),this.#b=null,this.parent.drawLayer.remove(this.#Cr),this.#Cr=null)}#Mr(e=this.parent){null===this.#b&&(({id:this.#b,clipPathId:this.#vr}=e.drawLayer.draw(this.#Ar,this.color,this.#_r)),this.#Cr=e.drawLayer.drawOutline(this.#br),this.#kr&&(this.#kr.style.clipPath=this.#vr))}static#Ir({x:e,y:t,width:a,height:n},i){switch(i){case 90:return{x:1-t-n,y:e,width:n,height:a};case 180:return{x:1-e-a,y:1-t-n,width:a,height:n};case 270:return{x:t,y:1-e-a,width:n,height:a}}return{x:e,y:t,width:a,height:n}}rotate(e){const{drawLayer:t}=this.parent;let a;this.#Sr?(e=(e-this.rotation+360)%360,a=Axe.#Ir(this.#Ar.box,e)):a=Axe.#Ir(this,e),t.rotate(this.#b,e),t.rotate(this.#Cr,e),t.updateBox(this.#b,a),t.updateBox(this.#Cr,Axe.#Ir(this.#br.box,e))}render(){if(this.div)return this.div;const e=super.render();this.#Tr&&(e.setAttribute("aria-label",this.#Tr),e.setAttribute("role","mark")),this.#Sr?e.classList.add("free"):this.div.addEventListener("keydown",this.#Lr.bind(this),{signal:this._uiManager._signal});const t=this.#kr=document.createElement("div");e.append(t),t.setAttribute("aria-hidden","true"),t.className="internal",t.style.clipPath=this.#vr;const[a,n]=this.parentDimensions;return this.setDims(this.width*a,this.height*n),gve(this,this.#kr,["pointerover","pointerleave"]),this.enableEditing(),e}pointerover(){this.isSelected||this.parent.drawLayer.addClass(this.#Cr,"hovered")}pointerleave(){this.isSelected||this.parent.drawLayer.removeClass(this.#Cr,"hovered")}#Lr(e){Axe._keyboardManager.exec(this,e)}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:this.#Fr(!0);break;case 1:case 3:this.#Fr(!1)}}#Fr(e){if(!this.#gr)return;const t=window.getSelection();e?t.setPosition(this.#gr,this.#fr):t.setPosition(this.#wr,this.#xr)}select(){super.select(),this.#Cr&&(this.parent?.drawLayer.removeClass(this.#Cr,"hovered"),this.parent?.drawLayer.addClass(this.#Cr,"selected"))}unselect(){super.unselect(),this.#Cr&&(this.parent?.drawLayer.removeClass(this.#Cr,"selected"),this.#Sr||this.#Fr(!1))}get _mustFixPosition(){return!this.#Sr}show(e=this._isVisible){super.show(e),this.parent&&(this.parent.drawLayer.show(this.#b,e),this.parent.drawLayer.show(this.#Cr,e))}#zr(){return this.#Sr?this.rotation:0}#Br(){if(this.#Sr)return null;const[e,t]=this.pageDimensions,[a,n]=this.pageTranslation,i=this.#yr,r=new Float32Array(8*i.length);let o=0;for(const{x:s,y:l,width:c,height:u}of i){const i=s*e+a,d=(1-l-u)*t+n;r[o]=r[o+4]=i,r[o+1]=r[o+3]=d,r[o+2]=r[o+6]=i+c*e,r[o+5]=r[o+7]=d+u*t,o+=8}return r}#Hr(e){return this.#Ar.serialize(e,this.#zr())}static startHighlighting(e,t,{target:a,x:n,y:i}){const{x:r,y:o,width:s,height:l}=a.getBoundingClientRect(),c=new AbortController,u=e.combinedSignal(c),d=t=>{c.abort(),this.#qr(e,t)};window.addEventListener("blur",d,{signal:u}),window.addEventListener("pointerup",d,{signal:u}),window.addEventListener("pointerdown",(e=>{e.preventDefault(),e.stopPropagation()}),{capture:!0,passive:!1,signal:u}),window.addEventListener("contextmenu",ive,{signal:u}),a.addEventListener("pointermove",this.#Ur.bind(this,e),{signal:u}),this._freeHighlight=new wxe({x:n,y:i},[r,o,s,l],e.scale,this._defaultThickness/2,t,.001),({id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=e.drawLayer.draw(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0))}static#Ur(e,t){this._freeHighlight.add(t)&&e.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)}static#qr(e,t){this._freeHighlight.isEmpty()?e.drawLayer.remove(this._freeHighlightId):e.createAndAddNewEditor(t,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}static async deserialize(e,t,a){let n=null;if(e instanceof oxe){const{data:{quadPoints:t,rect:a,rotation:i,id:r,color:o,opacity:s,popupRef:l},parent:{page:{pageNumber:c}}}=e;n=e={annotationType:Pfe.HIGHLIGHT,color:Array.from(o),opacity:s,quadPoints:t,boxes:null,pageIndex:c-1,rect:a.slice(0),rotation:i,id:r,deleted:!1,popupRef:l}}else if(e instanceof rxe){const{data:{inkLists:t,rect:a,rotation:i,id:r,color:o,borderStyle:{rawWidth:s},popupRef:l},parent:{page:{pageNumber:c}}}=e;n=e={annotationType:Pfe.HIGHLIGHT,color:Array.from(o),thickness:s,inkLists:t,boxes:null,pageIndex:c-1,rect:a.slice(0),rotation:i,id:r,deleted:!1,popupRef:l}}const{color:i,quadPoints:r,inkLists:o,opacity:s}=e,l=await super.deserialize(e,t,a);l.color=Iye.makeHexColor(...i),l.#_r=s||1,o&&(l.#Oi=e.thickness),l.annotationElementId=e.id||null,l._initialData=n;const[c,u]=l.pageDimensions,[d,h]=l.pageTranslation;if(r){const e=l.#yr=[];for(let t=0;t<r.length;t+=8)e.push({x:(r[t]-d)/c,y:1-(r[t+1]-h)/u,width:(r[t+2]-r[t])/c,height:(r[t+1]-r[t+5])/u});l.#Dr(),l.#Mr(),l.rotate(l.rotation)}else if(o){l.#Sr=!0;const e=o[0],a={x:e[0]-d,y:u-(e[1]-h)},n=new wxe(a,[0,0,c,u],1,l.#Oi/2,!0,.001);for(let t=0,i=e.length;t<i;t+=2)a.x=e[t]-d,a.y=u-(e[t+1]-h),n.add(a);const{id:i,clipPathId:r}=t.drawLayer.draw(n,l.color,l._defaultOpacity,!0);l.#Or({highlightOutlines:n.getOutlines(),highlightId:i,clipPathId:r}),l.#Mr()}return l}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();const t=this.getRect(0,0),a=Ave._colorManager.convert(this.color),n={annotationType:Pfe.HIGHLIGHT,color:a,opacity:this.#_r,thickness:this.#Oi,quadPoints:this.#Br(),outlines:this.#Hr(t),pageIndex:this.pageIndex,rect:t,rotation:this.#zr(),structTreeParentId:this._structTreeParentId};return this.annotationElementId&&!this.#vi(n)?null:(n.id=this.annotationElementId,n)}#vi(e){const{color:t}=this._initialData;return e.color.some(((e,a)=>e!==t[a]))}renderAnnotationElement(e){return e.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}}class Sxe extends Ave{#Vr=0;#Wr=0;#$r=null;#Gr=new Path2D;#Kr=!1;#Zr=null;#Yr=!1;#Xr=!1;#Qr=null;#Jr=null;#eo=0;#to=0;#ao=null;static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=1;static _type="ink";static _editorType=Pfe.INK;constructor(e){super({...e,name:"inkEditor"}),this.color=e.color||null,this.thickness=e.thickness||null,this.opacity=e.opacity||null,this.paths=[],this.bezierPath2D=[],this.allRawPaths=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0,this._willKeepAspectRatio=!0}static initialize(e,t){Ave.initialize(e,t)}static updateDefaultParams(e,t){switch(e){case Ofe.INK_THICKNESS:Sxe._defaultThickness=t;break;case Ofe.INK_COLOR:Sxe._defaultColor=t;break;case Ofe.INK_OPACITY:Sxe._defaultOpacity=t/100}}updateParams(e,t){switch(e){case Ofe.INK_THICKNESS:this.#Nr(t);break;case Ofe.INK_COLOR:this.#di(t);break;case Ofe.INK_OPACITY:this.#no(t)}}static get defaultPropertiesToUpdate(){return[[Ofe.INK_THICKNESS,Sxe._defaultThickness],[Ofe.INK_COLOR,Sxe._defaultColor||Ave._defaultLineColor],[Ofe.INK_OPACITY,Math.round(100*Sxe._defaultOpacity)]]}get propertiesToUpdate(){return[[Ofe.INK_THICKNESS,this.thickness||Sxe._defaultThickness],[Ofe.INK_COLOR,this.color||Sxe._defaultColor||Ave._defaultLineColor],[Ofe.INK_OPACITY,Math.round(100*(this.opacity??Sxe._defaultOpacity))]]}#Nr(e){const t=e=>{this.thickness=e,this.#io()},a=this.thickness;this.addCommands({cmd:t.bind(this,e),undo:t.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Ofe.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}#di(e){const t=e=>{this.color=e,this.#ro()},a=this.color;this.addCommands({cmd:t.bind(this,e),undo:t.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Ofe.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}#no(e){const t=e=>{this.opacity=e,this.#ro()};e/=100;const a=this.opacity;this.addCommands({cmd:t.bind(this,e),undo:t.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Ofe.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.canvas||(this.#oo(),this.#so()),this.isAttachedToDOM||(this.parent.add(this),this.#lo()),this.#io()))}remove(){null!==this.canvas&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,this.#$r&&(clearTimeout(this.#$r),this.#$r=null),this.#Qr?.disconnect(),this.#Qr=null,super.remove())}setParent(e){!this.parent&&e?this._uiManager.removeShouldRescale(this):this.parent&&null===e&&this._uiManager.addShouldRescale(this),super.setParent(e)}onScaleChanging(){const[e,t]=this.parentDimensions,a=this.width*e,n=this.height*t;this.setDimensions(a,n)}enableEditMode(){this.#Kr||null===this.canvas||(super.enableEditMode(),this._isDraggable=!1,this.#co())}disableEditMode(){this.isInEditMode()&&null!==this.canvas&&(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),this.#uo())}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return 0===this.paths.length||1===this.paths.length&&0===this.paths[0].length}#do(){const{parentRotation:e,parentDimensions:[t,a]}=this;switch(e){case 90:return[0,a,a,t];case 180:return[t,a,t,a];case 270:return[t,0,a,t];default:return[0,0,t,a]}}#ho(){const{ctx:e,color:t,opacity:a,thickness:n,parentScale:i,scaleFactor:r}=this;e.lineWidth=n*i/r,e.lineCap="round",e.lineJoin="round",e.miterLimit=10,e.strokeStyle=`${t}${function(e){return Math.round(Math.min(255,Math.max(1,255*e))).toString(16).padStart(2,"0")}(a)}`}#mo(e,t){this.canvas.addEventListener("contextmenu",ive,{signal:this._uiManager._signal}),this.#uo(),this.#Zr=new AbortController;const a=this._uiManager.combinedSignal(this.#Zr);this.canvas.addEventListener("pointerleave",this.canvasPointerleave.bind(this),{signal:a}),this.canvas.addEventListener("pointermove",this.canvasPointermove.bind(this),{signal:a}),this.canvas.addEventListener("pointerup",this.canvasPointerup.bind(this),{signal:a}),this.isEditing=!0,this.#Xr||(this.#Xr=!0,this.#lo(),this.thickness||=Sxe._defaultThickness,this.color||=Sxe._defaultColor||Ave._defaultLineColor,this.opacity??=Sxe._defaultOpacity),this.currentPath.push([e,t]),this.#Yr=!1,this.#ho(),this.#ao=()=>{this.#po(),this.#ao&&window.requestAnimationFrame(this.#ao)},window.requestAnimationFrame(this.#ao)}#go(e,t){const[a,n]=this.currentPath.at(-1);if(this.currentPath.length>1&&e===a&&t===n)return;const i=this.currentPath;let r=this.#Gr;if(i.push([e,t]),this.#Yr=!0,i.length<=2)return r.moveTo(...i[0]),void r.lineTo(e,t);3===i.length&&(this.#Gr=r=new Path2D,r.moveTo(...i[0])),this.#fo(r,...i.at(-3),...i.at(-2),e,t)}#yo(){if(0===this.currentPath.length)return;const e=this.currentPath.at(-1);this.#Gr.lineTo(...e)}#vo(e,t){let a;if(this.#ao=null,e=Math.min(Math.max(e,0),this.canvas.width),t=Math.min(Math.max(t,0),this.canvas.height),this.#go(e,t),this.#yo(),1!==this.currentPath.length)a=this.#bo();else{const n=[e,t];a=[[n,n.slice(),n.slice(),n]]}const n=this.#Gr,i=this.currentPath;this.currentPath=[],this.#Gr=new Path2D;this.addCommands({cmd:()=>{this.allRawPaths.push(i),this.paths.push(a),this.bezierPath2D.push(n),this._uiManager.rebuild(this)},undo:()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),0===this.paths.length?this.remove():(this.canvas||(this.#oo(),this.#so()),this.#io())},mustExec:!0})}#po(){if(!this.#Yr)return;this.#Yr=!1;Math.ceil(this.thickness*this.parentScale);const e=this.currentPath.slice(-3),t=e.map((e=>e[0])),a=e.map((e=>e[1]));Math.min(...t),Math.max(...t),Math.min(...a),Math.max(...a);const{ctx:n}=this;n.save(),n.clearRect(0,0,this.canvas.width,this.canvas.height);for(const e of this.bezierPath2D)n.stroke(e);n.stroke(this.#Gr),n.restore()}#fo(e,t,a,n,i,r,o){const s=(t+n)/2,l=(a+i)/2,c=(n+r)/2,u=(i+o)/2;e.bezierCurveTo(s+2*(n-s)/3,l+2*(i-l)/3,c+2*(n-c)/3,u+2*(i-u)/3,c,u)}#bo(){const e=this.currentPath;if(e.length<=2)return[[e[0],e[0],e.at(-1),e.at(-1)]];const t=[];let a,[n,i]=e[0];for(a=1;a<e.length-2;a++){const[r,o]=e[a],[s,l]=e[a+1],c=(r+s)/2,u=(o+l)/2,d=[n+2*(r-n)/3,i+2*(o-i)/3],h=[c+2*(r-c)/3,u+2*(o-u)/3];t.push([[n,i],d,h,[c,u]]),[n,i]=[c,u]}const[r,o]=e[a],[s,l]=e[a+1],c=[n+2*(r-n)/3,i+2*(o-i)/3],u=[s+2*(r-s)/3,l+2*(o-l)/3];return t.push([[n,i],c,u,[s,l]]),t}#ro(){if(this.isEmpty())return void this.#wo();this.#ho();const{canvas:e,ctx:t}=this;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.width,e.height),this.#wo();for(const e of this.bezierPath2D)t.stroke(e)}commit(){this.#Kr||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),this.#Kr=!0,this.div.classList.add("disabled"),this.#io(!0),this.select(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(e){this._focusEventsAllowed&&(super.focusin(e),this.enableEditMode())}#co(){if(this.#Jr)return;this.#Jr=new AbortController;const e=this._uiManager.combinedSignal(this.#Jr);this.canvas.addEventListener("pointerdown",this.canvasPointerdown.bind(this),{signal:e})}#uo(){this.pointerdownAC?.abort(),this.pointerdownAC=null}canvasPointerdown(e){0===e.button&&this.isInEditMode()&&!this.#Kr&&(this.setInForeground(),e.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),this.#mo(e.offsetX,e.offsetY))}canvasPointermove(e){e.preventDefault(),this.#go(e.offsetX,e.offsetY)}canvasPointerup(e){e.preventDefault(),this.#xo(e)}canvasPointerleave(e){this.#xo(e)}#xo(e){this.#Zr?.abort(),this.#Zr=null,this.#co(),this.#$r&&clearTimeout(this.#$r),this.#$r=setTimeout((()=>{this.#$r=null,this.canvas.removeEventListener("contextmenu",ive)}),10),this.#vo(e.offsetX,e.offsetY),this.addToAnnotationStorage(),this.setInBackground()}#oo(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",this.canvas.setAttribute("data-l10n-id","pdfjs-ink-canvas"),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")}#so(){this.#Qr=new ResizeObserver((e=>{const t=e[0].contentRect;t.width&&t.height&&this.setDimensions(t.width,t.height)})),this.#Qr.observe(this.div),this._uiManager._signal.addEventListener("abort",(()=>{this.#Qr?.disconnect(),this.#Qr=null}),{once:!0})}get isResizable(){return!this.isEmpty()&&this.#Kr}render(){if(this.div)return this.div;let e,t;this.width&&(e=this.x,t=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");const[a,n,i,r]=this.#do();if(this.setAt(a,n,0,0),this.setDims(i,r),this.#oo(),this.width){const[a,n]=this.parentDimensions;this.setAspectRatio(this.width*a,this.height*n),this.setAt(e*a,t*n,this.width*a,this.height*n),this.#Xr=!0,this.#lo(),this.setDims(this.width*a,this.height*n),this.#ro(),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return this.#so(),this.div}#lo(){if(!this.#Xr)return;const[e,t]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*e),this.canvas.height=Math.ceil(this.height*t),this.#wo()}setDimensions(e,t){const a=Math.round(e),n=Math.round(t);if(this.#eo===a&&this.#to===n)return;this.#eo=a,this.#to=n,this.canvas.style.visibility="hidden";const[i,r]=this.parentDimensions;this.width=e/i,this.height=t/r,this.fixAndSetPosition(),this.#Kr&&this.#ko(e,t),this.#lo(),this.#ro(),this.canvas.style.visibility="visible",this.fixDims()}#ko(e,t){const a=this.#Ao(),n=(e-a)/this.#Wr,i=(t-a)/this.#Vr;this.scaleFactor=Math.min(n,i)}#wo(){const e=this.#Ao()/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+e,this.translationY*this.scaleFactor+e)}static#So(e){const t=new Path2D;for(let a=0,n=e.length;a<n;a++){const[n,i,r,o]=e[a];0===a&&t.moveTo(...n),t.bezierCurveTo(i[0],i[1],r[0],r[1],o[0],o[1])}return t}static#Eo(e,t,a){const[n,i,r,o]=t;switch(a){case 0:for(let t=0,a=e.length;t<a;t+=2)e[t]+=n,e[t+1]=o-e[t+1];break;case 90:for(let t=0,a=e.length;t<a;t+=2){const a=e[t];e[t]=e[t+1]+n,e[t+1]=a+i}break;case 180:for(let t=0,a=e.length;t<a;t+=2)e[t]=r-e[t],e[t+1]+=i;break;case 270:for(let t=0,a=e.length;t<a;t+=2){const a=e[t];e[t]=r-e[t+1],e[t+1]=o-a}break;default:throw new Error("Invalid rotation")}return e}static#_o(e,t,a){const[n,i,r,o]=t;switch(a){case 0:for(let t=0,a=e.length;t<a;t+=2)e[t]-=n,e[t+1]=o-e[t+1];break;case 90:for(let t=0,a=e.length;t<a;t+=2){const a=e[t];e[t]=e[t+1]-i,e[t+1]=a-n}break;case 180:for(let t=0,a=e.length;t<a;t+=2)e[t]=r-e[t],e[t+1]-=i;break;case 270:for(let t=0,a=e.length;t<a;t+=2){const a=e[t];e[t]=o-e[t+1],e[t+1]=r-a}break;default:throw new Error("Invalid rotation")}return e}#Co(e,t,a,n){const i=[],r=this.thickness/2,o=e*t+r,s=e*a+r;for(const t of this.paths){const a=[],r=[];for(let n=0,i=t.length;n<i;n++){const[l,c,u,d]=t[n];if(l[0]===d[0]&&l[1]===d[1]&&1===i){const t=e*l[0]+o,n=e*l[1]+s;a.push(t,n),r.push(t,n);break}const h=e*l[0]+o,m=e*l[1]+s,p=e*c[0]+o,g=e*c[1]+s,f=e*u[0]+o,y=e*u[1]+s,v=e*d[0]+o,b=e*d[1]+s;0===n&&(a.push(h,m),r.push(h,m)),a.push(p,g,f,y,v,b),r.push(p,g),n===i-1&&r.push(v,b)}i.push({bezier:Sxe.#Eo(a,n,this.rotation),points:Sxe.#Eo(r,n,this.rotation)})}return i}#To(){let e=1/0,t=-1/0,a=1/0,n=-1/0;for(const i of this.paths)for(const[r,o,s,l]of i){const i=Iye.bezierBoundingBox(...r,...o,...s,...l);e=Math.min(e,i[0]),a=Math.min(a,i[1]),t=Math.max(t,i[2]),n=Math.max(n,i[3])}return[e,a,t,n]}#Ao(){return this.#Kr?Math.ceil(this.thickness*this.parentScale):0}#io(e=!1){if(this.isEmpty())return;if(!this.#Kr)return void this.#ro();const t=this.#To(),a=this.#Ao();this.#Wr=Math.max(Ave.MIN_SIZE,t[2]-t[0]),this.#Vr=Math.max(Ave.MIN_SIZE,t[3]-t[1]);const n=Math.ceil(a+this.#Wr*this.scaleFactor),i=Math.ceil(a+this.#Vr*this.scaleFactor),[r,o]=this.parentDimensions;this.width=n/r,this.height=i/o,this.setAspectRatio(n,i);const s=this.translationX,l=this.translationY;this.translationX=-t[0],this.translationY=-t[1],this.#lo(),this.#ro(),this.#eo=n,this.#to=i,this.setDims(n,i);const c=e?a/this.scaleFactor/2:0;this.translate(s-this.translationX-c,l-this.translationY-c)}static async deserialize(e,t,a){if(e instanceof rxe)return null;const n=await super.deserialize(e,t,a);n.thickness=e.thickness,n.color=Iye.makeHexColor(...e.color),n.opacity=e.opacity;const[i,r]=n.pageDimensions,o=n.width*i,s=n.height*r,l=n.parentScale,c=e.thickness/2;n.#Kr=!0,n.#eo=Math.round(o),n.#to=Math.round(s);const{paths:u,rect:d,rotation:h}=e;for(let{bezier:e}of u){e=Sxe.#_o(e,d,h);const t=[];n.paths.push(t);let a=l*(e[0]-c),i=l*(e[1]-c);for(let n=2,r=e.length;n<r;n+=6){const r=l*(e[n]-c),o=l*(e[n+1]-c),s=l*(e[n+2]-c),u=l*(e[n+3]-c),d=l*(e[n+4]-c),h=l*(e[n+5]-c);t.push([[a,i],[r,o],[s,u],[d,h]]),a=d,i=h}const r=this.#So(t);n.bezierPath2D.push(r)}const m=n.#To();return n.#Wr=Math.max(Ave.MIN_SIZE,m[2]-m[0]),n.#Vr=Math.max(Ave.MIN_SIZE,m[3]-m[1]),n.#ko(o,s),n}serialize(){if(this.isEmpty())return null;const e=this.getRect(0,0),t=Ave._colorManager.convert(this.ctx.strokeStyle);return{annotationType:Pfe.INK,color:t,thickness:this.thickness,opacity:this.opacity,paths:this.#Co(this.scaleFactor/this.parentScale,this.translationX,this.translationY,e),pageIndex:this.pageIndex,rect:e,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}}class Exe extends Ave{#Po=null;#Oo=null;#Mo=null;#Do=null;#Io=null;#No="";#jo=null;#Qr=null;#zo=null;#Ro=!1;#Lo=!1;static _type="stamp";static _editorType=Pfe.STAMP;constructor(e){super({...e,name:"stampEditor"}),this.#Do=e.bitmapUrl,this.#Io=e.bitmapFile}static initialize(e,t){Ave.initialize(e,t)}static get supportedTypes(){return bye(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map((e=>`image/${e}`)))}static get supportedTypesStr(){return bye(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(e){return this.supportedTypes.includes(e)}static paste(e,t){t.pasteEditor(Pfe.STAMP,{bitmapFile:e.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){return{type:"stamp",hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(e){const t=e.get("hasAltText");return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}#Fo(e,t=!1){e?(this.#Po=e.bitmap,t||(this.#Oo=e.id,this.#Ro=e.isSvg),e.file&&(this.#No=e.file.name),this.#oo()):this.remove()}#Bo(){if(this.#Mo=null,this._uiManager.enableWaiting(!1),this.#jo){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#Po)return this._editToolbar.hide(),void this._uiManager.editAltText(this,!0);if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#Po){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}}async mlGuessAltText(e=null,t=!0){if(this.hasAltTextData())return null;const{mlManager:a}=this._uiManager;if(!a)throw new Error("No ML.");if(!await a.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:n,width:i,height:r}=e||this.copyCanvas(null,null,!0).imageData,o=await a.guess({name:"altText",request:{data:n,width:i,height:r,channels:n.length/(i*r)}});if(!o)throw new Error("No response from the AI service.");if(o.error)throw new Error("Error from the AI service.");if(o.cancel)return null;if(!o.output)throw new Error("No valid response from the AI service.");const s=o.output;return await this.setGuessedAltText(s),t&&!this.hasAltTextData()&&(this.altTextData={alt:s,decorative:!1}),s}#Ho(){if(this.#Oo)return this._uiManager.enableWaiting(!0),void this._uiManager.imageManager.getFromId(this.#Oo).then((e=>this.#Fo(e,!0))).finally((()=>this.#Bo()));if(this.#Do){const e=this.#Do;return this.#Do=null,this._uiManager.enableWaiting(!0),void(this.#Mo=this._uiManager.imageManager.getFromUrl(e).then((e=>this.#Fo(e))).finally((()=>this.#Bo())))}if(this.#Io){const e=this.#Io;return this.#Io=null,this._uiManager.enableWaiting(!0),void(this.#Mo=this._uiManager.imageManager.getFromFile(e).then((e=>this.#Fo(e))).finally((()=>this.#Bo())))}const e=document.createElement("input");e.type="file",e.accept=Exe.supportedTypesStr;const t=this._uiManager._signal;this.#Mo=new Promise((a=>{e.addEventListener("change",(async()=>{if(e.files&&0!==e.files.length){this._uiManager.enableWaiting(!0);const t=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),this.#Fo(t)}else this.remove();a()}),{signal:t}),e.addEventListener("cancel",(()=>{this.remove(),a()}),{signal:t})})).finally((()=>this.#Bo())),e.click()}remove(){this.#Oo&&(this.#Po=null,this._uiManager.imageManager.deleteId(this.#Oo),this.#jo?.remove(),this.#jo=null,this.#Qr?.disconnect(),this.#Qr=null,this.#zo&&(clearTimeout(this.#zo),this.#zo=null)),super.remove()}rebuild(){this.parent?(super.rebuild(),null!==this.div&&(this.#Oo&&null===this.#jo&&this.#Ho(),this.isAttachedToDOM||this.parent.add(this))):this.#Oo&&this.#Ho()}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(this.#Mo||this.#Po||this.#Do||this.#Io||this.#Oo)}get isResizable(){return!0}render(){if(this.div)return this.div;let e,t;if(this.width&&(e=this.x,t=this.y),super.render(),this.div.hidden=!0,this.div.setAttribute("role","figure"),this.addAltTextButton(),this.#Po?this.#oo():this.#Ho(),this.width&&!this.annotationElementId){const[a,n]=this.parentDimensions;this.setAt(e*a,t*n,this.width*a,this.height*n)}return this.div}#oo(){const{div:e}=this;let{width:t,height:a}=this.#Po;const[n,i]=this.pageDimensions,r=.75;if(this.width)t=this.width*n,a=this.height*i;else if(t>r*n||a>r*i){const e=Math.min(r*n/t,r*i/a);t*=e,a*=e}const[o,s]=this.parentDimensions;this.setDims(t*o/n,a*s/i),this._uiManager.enableWaiting(!1);const l=this.#jo=document.createElement("canvas");l.setAttribute("role","img"),this.addContainer(l),this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&!this.annotationElementId||(e.hidden=!1),this.#qo(t,a),this.#so(),this.#Lo||(this.parent.addUndoableEditor(this),this.#Lo=!0),this._reportTelemetry({action:"inserted_image"}),this.#No&&l.setAttribute("aria-label",this.#No)}copyCanvas(e,t,a=!1){e||(e=224);const{width:n,height:i}=this.#Po,r=new hve;let o=this.#Po,s=n,l=i,c=null;if(t){if(n>t||i>t){const e=Math.min(t/n,t/i);s=Math.floor(n*e),l=Math.floor(i*e)}c=document.createElement("canvas");const e=c.width=Math.ceil(s*r.sx),a=c.height=Math.ceil(l*r.sy);this.#Ro||(o=this.#Uo(e,a));const u=c.getContext("2d");u.filter=this._uiManager.hcmFilter;let d="white",h="#cfcfd8";"none"!==this._uiManager.hcmFilter?h="black":window.matchMedia?.("(prefers-color-scheme: dark)").matches&&(d="#8f8f9d",h="#42414d");const m=15,p=m*r.sx,g=m*r.sy,f=new OffscreenCanvas(2*p,2*g),y=f.getContext("2d");y.fillStyle=d,y.fillRect(0,0,2*p,2*g),y.fillStyle=h,y.fillRect(0,0,p,g),y.fillRect(p,g,p,g),u.fillStyle=u.createPattern(f,"repeat"),u.fillRect(0,0,e,a),u.drawImage(o,0,0,o.width,o.height,0,0,e,a)}let u=null;if(a){let t,a;if(r.symmetric&&o.width<e&&o.height<e)t=o.width,a=o.height;else if(o=this.#Po,n>e||i>e){const r=Math.min(e/n,e/i);t=Math.floor(n*r),a=Math.floor(i*r),this.#Ro||(o=this.#Uo(t,a))}const s=new OffscreenCanvas(t,a).getContext("2d",{willReadFrequently:!0});s.drawImage(o,0,0,o.width,o.height,0,0,t,a),u={width:t,height:a,data:s.getImageData(0,0,t,a).data}}return{canvas:c,width:s,height:l,imageData:u}}#Vo(e,t){const[a,n]=this.parentDimensions;this.width=e/a,this.height=t/n,this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,null!==this.#zo&&clearTimeout(this.#zo);this.#zo=setTimeout((()=>{this.#zo=null,this.#qo(e,t)}),200)}#Uo(e,t){const{width:a,height:n}=this.#Po;let i=a,r=n,o=this.#Po;for(;i>2*e||r>2*t;){const a=i,n=r;i>2*e&&(i=i>=16384?Math.floor(i/2)-1:Math.ceil(i/2)),r>2*t&&(r=r>=16384?Math.floor(r/2)-1:Math.ceil(r/2));const s=new OffscreenCanvas(i,r);s.getContext("2d").drawImage(o,0,0,a,n,0,0,i,r),o=s.transferToImageBitmap()}return o}#qo(e,t){const a=new hve,n=Math.ceil(e*a.sx),i=Math.ceil(t*a.sy),r=this.#jo;if(!r||r.width===n&&r.height===i)return;r.width=n,r.height=i;const o=this.#Ro?this.#Po:this.#Uo(n,i),s=r.getContext("2d");s.filter=this._uiManager.hcmFilter,s.drawImage(o,0,0,o.width,o.height,0,0,n,i)}getImageForAltText(){return this.#jo}#Wo(e){if(e){if(this.#Ro){const e=this._uiManager.imageManager.getSvgUrl(this.#Oo);if(e)return e}const e=document.createElement("canvas");({width:e.width,height:e.height}=this.#Po);return e.getContext("2d").drawImage(this.#Po,0,0),e.toDataURL()}if(this.#Ro){const[e,t]=this.pageDimensions,a=Math.round(this.width*e*Kye.PDF_TO_CSS_UNITS),n=Math.round(this.height*t*Kye.PDF_TO_CSS_UNITS),i=new OffscreenCanvas(a,n);return i.getContext("2d").drawImage(this.#Po,0,0,this.#Po.width,this.#Po.height,0,0,a,n),i.transferToImageBitmap()}return structuredClone(this.#Po)}#so(){this._uiManager._signal&&(this.#Qr=new ResizeObserver((e=>{const t=e[0].contentRect;t.width&&t.height&&this.#Vo(t.width,t.height)})),this.#Qr.observe(this.div),this._uiManager._signal.addEventListener("abort",(()=>{this.#Qr?.disconnect(),this.#Qr=null}),{once:!0}))}static async deserialize(e,t,a){let n=null;if(e instanceof uxe){const{data:{rect:i,rotation:r,id:o,structParent:s,popupRef:l},container:c,parent:{page:{pageNumber:u}}}=e,d=c.querySelector("canvas"),h=a.imageManager.getFromCanvas(c.id,d);d.remove();const m=(await t._structTree.getAriaAttributes(`${Rye}${o}`))?.get("aria-label")||"";n=e={annotationType:Pfe.STAMP,bitmapId:h.id,bitmap:h.bitmap,pageIndex:u-1,rect:i.slice(0),rotation:r,id:o,deleted:!1,accessibilityData:{decorative:!1,altText:m},isSvg:!1,structParent:s,popupRef:l}}const i=await super.deserialize(e,t,a),{rect:r,bitmap:o,bitmapUrl:s,bitmapId:l,isSvg:c,accessibilityData:u}=e;l&&a.imageManager.isValidId(l)?(i.#Oo=l,o&&(i.#Po=o)):i.#Do=s,i.#Ro=c;const[d,h]=i.pageDimensions;return i.width=(r[2]-r[0])/d,i.height=(r[3]-r[1])/h,i.annotationElementId=e.id||null,u&&(i.altTextData=u),i._initialData=n,i.#Lo=!!n,i}serialize(e=!1,t=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const a={annotationType:Pfe.STAMP,bitmapId:this.#Oo,pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:this.#Ro,structTreeParentId:this._structTreeParentId};if(e)return a.bitmapUrl=this.#Wo(!0),a.accessibilityData=this.serializeAltText(!0),a;const{decorative:n,altText:i}=this.serializeAltText(!1);if(!n&&i&&(a.accessibilityData={type:"Figure",alt:i}),this.annotationElementId){const e=this.#vi(a);if(e.isSame)return null;e.isSameAltText?delete a.accessibilityData:a.accessibilityData.structParent=this._initialData.structParent??-1}if(a.id=this.annotationElementId,null===t)return a;t.stamps||=new Map;const r=this.#Ro?(a.rect[2]-a.rect[0])*(a.rect[3]-a.rect[1]):null;if(t.stamps.has(this.#Oo)){if(this.#Ro){const e=t.stamps.get(this.#Oo);r>e.area&&(e.area=r,e.serialized.bitmap.close(),e.serialized.bitmap=this.#Wo(!1))}}else t.stamps.set(this.#Oo,{area:r,serialized:a}),a.bitmap=this.#Wo(!1);return a}#vi(e){const{rect:t,pageIndex:a,accessibilityData:{altText:n}}=this._initialData,i=e.rect.every(((e,a)=>Math.abs(e-t[a])<1)),r=e.pageIndex===a,o=(e.accessibilityData?.alt||"")===n;return{isSame:i&&r&&o,isSameAltText:o}}renderAnnotationElement(e){return e.updateEdited({rect:this.getRect(0,0)}),null}}class _xe{#ti;#$o=!1;#Go=null;#Ko=null;#Zo=null;#Yo=new Map;#Xo=!1;#Qo=!1;#Jo=!1;#es=null;#ts=null;#g;static _initialized=!1;static#B=new Map([pxe,Sxe,Exe,Axe].map((e=>[e._editorType,e])));constructor({uiManager:e,pageIndex:t,div:a,structTreeLayer:n,accessibilityManager:i,annotationLayer:r,drawLayer:o,textLayer:s,viewport:l,l10n:c}){const u=[..._xe.#B.values()];if(!_xe._initialized){_xe._initialized=!0;for(const t of u)t.initialize(c,e)}e.registerEditorTypes(u),this.#g=e,this.pageIndex=t,this.div=a,this.#ti=i,this.#Go=r,this.viewport=l,this.#es=s,this.drawLayer=o,this._structTree=n,this.#g.addLayer(this)}get isEmpty(){return 0===this.#Yo.size}get isInvisible(){return this.isEmpty&&this.#g.getMode()===Pfe.NONE}updateToolbar(e){this.#g.updateToolbar(e)}updateMode(e=this.#g.getMode()){switch(this.#as(),e){case Pfe.NONE:return this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),void this.disableClick();case Pfe.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case Pfe.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:t}=this.div;for(const a of _xe.#B.values())t.toggle(`${a._type}Editing`,e===a._editorType);this.div.hidden=!1}hasTextLayer(e){return e===this.#es?.div}addInkEditorIfNeeded(e){if(this.#g.getMode()!==Pfe.INK)return;if(!e)for(const e of this.#Yo.values())if(e.isEmpty())return void e.setInBackground();this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}setEditingState(e){this.#g.setEditingState(e)}addCommands(e){this.#g.addCommands(e)}toggleDrawing(e=!1){this.div.classList.toggle("drawing",!e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(e=!1){this.#Go?.div.classList.toggle("disabled",!e)}async enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);const e=new Set;for(const t of this.#Yo.values())t.enableEditing(),t.show(!0),t.annotationElementId&&(this.#g.removeChangedExistingAnnotation(t),e.add(t.annotationElementId));if(!this.#Go)return;const t=this.#Go.getEditableAnnotations();for(const a of t){if(a.hide(),this.#g.isDeletedAnnotationElement(a.data.id))continue;if(e.has(a.data.id))continue;const t=await this.deserialize(a);t&&(this.addOrRebuild(t),t.enableEditing())}}disable(){this.#Jo=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1);const e=new Map,t=new Map;for(const a of this.#Yo.values())a.disableEditing(),a.annotationElementId&&(null===a.serialize()?(t.set(a.annotationElementId,a),this.getEditableAnnotation(a.annotationElementId)?.show(),a.remove()):e.set(a.annotationElementId,a));if(this.#Go){const a=this.#Go.getEditableAnnotations();for(const n of a){const{id:a}=n.data;if(this.#g.isDeletedAnnotationElement(a))continue;let i=t.get(a);i?(i.resetAnnotationElement(n),i.show(!1),n.show()):(i=e.get(a),i&&(this.#g.addChangedExistingAnnotation(i),i.renderAnnotationElement(n)&&i.show(!1)),n.show())}}this.#as(),this.isEmpty&&(this.div.hidden=!0);const{classList:a}=this.div;for(const e of _xe.#B.values())a.remove(`${e._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),this.#Jo=!1}getEditableAnnotation(e){return this.#Go?.getEditableAnnotation(e)||null}setActiveEditor(e){this.#g.getActive()!==e&&this.#g.setActiveEditor(e)}enableTextSelection(){if(this.div.tabIndex=-1,this.#es?.div&&!this.#ts){this.#ts=new AbortController;const e=this.#g.combinedSignal(this.#ts);this.#es.div.addEventListener("pointerdown",this.#ns.bind(this),{signal:e}),this.#es.div.classList.add("highlighting")}}disableTextSelection(){this.div.tabIndex=0,this.#es?.div&&this.#ts&&(this.#ts.abort(),this.#ts=null,this.#es.div.classList.remove("highlighting"))}#ns(e){this.#g.unselectAll();const{target:t}=e;if(t===this.#es.div||("img"===t.getAttribute("role")||t.classList.contains("endOfContent"))&&this.#es.div.contains(t)){const{isMac:t}=Mye.platform;if(0!==e.button||e.ctrlKey&&t)return;this.#g.showAllEditors("highlight",!0,!0),this.#es.div.classList.add("free"),this.toggleDrawing(),Axe.startHighlighting(this,"ltr"===this.#g.direction,{target:this.#es.div,x:e.x,y:e.y}),this.#es.div.addEventListener("pointerup",(()=>{this.#es.div.classList.remove("free"),this.toggleDrawing(!0)}),{once:!0,signal:this.#g._signal}),e.preventDefault()}}enableClick(){if(this.#Ko)return;this.#Ko=new AbortController;const e=this.#g.combinedSignal(this.#Ko);this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:e}),this.div.addEventListener("pointerup",this.pointerup.bind(this),{signal:e})}disableClick(){this.#Ko?.abort(),this.#Ko=null}attach(e){this.#Yo.set(e.id,e);const{annotationElementId:t}=e;t&&this.#g.isDeletedAnnotationElement(t)&&this.#g.removeDeletedAnnotationElement(e)}detach(e){this.#Yo.delete(e.id),this.#ti?.removePointerInTextLayer(e.contentDiv),!this.#Jo&&e.annotationElementId&&this.#g.addDeletedAnnotationElement(e)}remove(e){this.detach(e),this.#g.removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1,this.#Qo||this.addInkEditorIfNeeded(!1)}changeParent(e){e.parent!==this&&(e.parent&&e.annotationElementId&&(this.#g.addDeletedAnnotationElement(e.annotationElementId),Ave.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),e.parent?.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(e.parent!==this||!e.isAttachedToDOM){if(this.changeParent(e),this.#g.addEditor(e),this.attach(e),!e.isAttachedToDOM){const t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(),this.#g.addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){if(!e.isAttachedToDOM)return;const{activeElement:t}=document;e.div.contains(t)&&!this.#Zo&&(e._focusEventsAllowed=!1,this.#Zo=setTimeout((()=>{this.#Zo=null,e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener("focusin",(()=>{e._focusEventsAllowed=!0}),{once:!0,signal:this.#g._signal}),t.focus())}),0)),e._structTreeParentId=this.#ti?.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||=this,e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){this.addCommands({cmd:()=>e._uiManager.rebuild(e),undo:()=>{e.remove()},mustExec:!1})}getNextId(){return this.#g.getId()}get#is(){return _xe.#B.get(this.#g.getMode())}combinedSignal(e){return this.#g.combinedSignal(e)}#rs(e){const t=this.#is;return t?new t.prototype.constructor(e):null}canCreateNewEmptyEditor(){return this.#is?.canCreateNewEmptyEditor()}pasteEditor(e,t){this.#g.updateToolbar(e),this.#g.updateMode(e);const{offsetX:a,offsetY:n}=this.#os(),i=this.getNextId(),r=this.#rs({parent:this,id:i,x:a,y:n,uiManager:this.#g,isCentered:!0,...t});r&&this.add(r)}async deserialize(e){return await(_xe.#B.get(e.annotationType??e.annotationEditorType)?.deserialize(e,this,this.#g))||null}createAndAddNewEditor(e,t,a={}){const n=this.getNextId(),i=this.#rs({parent:this,id:n,x:e.offsetX,y:e.offsetY,uiManager:this.#g,isCentered:t,...a});return i&&this.add(i),i}#os(){const{x:e,y:t,width:a,height:n}=this.div.getBoundingClientRect(),i=Math.max(0,e),r=Math.max(0,t),o=(i+Math.min(window.innerWidth,e+a))/2-e,s=(r+Math.min(window.innerHeight,t+n))/2-t,[l,c]=this.viewport.rotation%180==0?[o,s]:[s,o];return{offsetX:l,offsetY:c}}addNewEditor(){this.createAndAddNewEditor(this.#os(),!0)}setSelected(e){this.#g.setSelected(e)}toggleSelected(e){this.#g.toggleSelected(e)}unselect(e){this.#g.unselect(e)}pointerup(e){const{isMac:t}=Mye.platform;0!==e.button||e.ctrlKey&&t||e.target===this.div&&this.#Xo&&(this.#Xo=!1,this.#$o?this.#g.getMode()!==Pfe.STAMP?this.createAndAddNewEditor(e,!1):this.#g.unselectAll():this.#$o=!0)}pointerdown(e){if(this.#g.getMode()===Pfe.HIGHLIGHT&&this.enableTextSelection(),this.#Xo)return void(this.#Xo=!1);const{isMac:t}=Mye.platform;if(0!==e.button||e.ctrlKey&&t)return;if(e.target!==this.div)return;this.#Xo=!0;const a=this.#g.getActive();this.#$o=!a||a.isEmpty()}findNewParent(e,t,a){const n=this.#g.findParent(t,a);return null!==n&&n!==this&&(n.changeParent(e),!0)}destroy(){this.#g.getActive()?.parent===this&&(this.#g.commitOrRemove(),this.#g.setActiveEditor(null)),this.#Zo&&(clearTimeout(this.#Zo),this.#Zo=null);for(const e of this.#Yo.values())this.#ti?.removePointerInTextLayer(e.contentDiv),e.setParent(null),e.isAttachedToDOM=!1,e.div.remove();this.div=null,this.#Yo.clear(),this.#g.removeLayer(this)}#as(){this.#Qo=!0;for(const e of this.#Yo.values())e.isEmpty()&&e.remove();this.#Qo=!1}render({viewport:e}){this.viewport=e,dve(this.div,e);for(const e of this.#g.getEditors(this.pageIndex))this.add(e),e.rebuild();this.updateMode()}update({viewport:e}){this.#g.commitOrRemove(),this.#as();const t=this.viewport.rotation,a=e.rotation;if(this.viewport=e,dve(this.div,{rotation:a}),t!==a)for(const e of this.#Yo.values())e.rotate(a);this.addInkEditorIfNeeded(!1)}get pageDimensions(){const{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}get scale(){return this.#g.viewParameters.realScale}}class Cxe{#jn=null;#b=0;#ss=new Map;#ls=new Map;constructor({pageIndex:e}){this.pageIndex=e}setParent(e){if(this.#jn){if(this.#jn!==e){if(this.#ss.size>0)for(const t of this.#ss.values())t.remove(),e.append(t);this.#jn=e}}else this.#jn=e}static get _svgFactory(){return bye(this,"_svgFactory",new Nwe)}static#cs(e,{x:t=0,y:a=0,width:n=1,height:i=1}={}){const{style:r}=e;r.top=100*a+"%",r.left=100*t+"%",r.width=100*n+"%",r.height=100*i+"%"}#us(e){const t=Cxe._svgFactory.create(1,1,!0);return this.#jn.append(t),t.setAttribute("aria-hidden",!0),Cxe.#cs(t,e),t}#ds(e,t){const a=Cxe._svgFactory.createElement("clipPath");e.append(a);const n=`clip_${t}`;a.setAttribute("id",n),a.setAttribute("clipPathUnits","objectBoundingBox");const i=Cxe._svgFactory.createElement("use");return a.append(i),i.setAttribute("href",`#${t}`),i.classList.add("clip"),n}draw(e,t,a,n=!1){const i=this.#b++,r=this.#us(e.box);r.classList.add(...e.classNamesForDrawing);const o=Cxe._svgFactory.createElement("defs");r.append(o);const s=Cxe._svgFactory.createElement("path");o.append(s);const l=`path_p${this.pageIndex}_${i}`;s.setAttribute("id",l),s.setAttribute("d",e.toSVGPath()),n&&this.#ls.set(i,s);const c=this.#ds(o,l),u=Cxe._svgFactory.createElement("use");return r.append(u),r.setAttribute("fill",t),r.setAttribute("fill-opacity",a),u.setAttribute("href",`#${l}`),this.#ss.set(i,r),{id:i,clipPathId:`url(#${c})`}}drawOutline(e){const t=this.#b++,a=this.#us(e.box);a.classList.add(...e.classNamesForOutlining);const n=Cxe._svgFactory.createElement("defs");a.append(n);const i=Cxe._svgFactory.createElement("path");n.append(i);const r=`path_p${this.pageIndex}_${t}`;let o;if(i.setAttribute("id",r),i.setAttribute("d",e.toSVGPath()),i.setAttribute("vector-effect","non-scaling-stroke"),e.mustRemoveSelfIntersections){const e=Cxe._svgFactory.createElement("mask");n.append(e),o=`mask_p${this.pageIndex}_${t}`,e.setAttribute("id",o),e.setAttribute("maskUnits","objectBoundingBox");const a=Cxe._svgFactory.createElement("rect");e.append(a),a.setAttribute("width","1"),a.setAttribute("height","1"),a.setAttribute("fill","white");const i=Cxe._svgFactory.createElement("use");e.append(i),i.setAttribute("href",`#${r}`),i.setAttribute("stroke","none"),i.setAttribute("fill","black"),i.setAttribute("fill-rule","nonzero"),i.classList.add("mask")}const s=Cxe._svgFactory.createElement("use");a.append(s),s.setAttribute("href",`#${r}`),o&&s.setAttribute("mask",`url(#${o})`);const l=s.cloneNode();return a.append(l),s.classList.add("mainOutline"),l.classList.add("secondaryOutline"),this.#ss.set(t,a),t}finalizeLine(e,t){const a=this.#ls.get(e);this.#ls.delete(e),this.updateBox(e,t.box),a.setAttribute("d",t.toSVGPath())}updateLine(e,t){this.#ss.get(e).firstChild.firstChild.setAttribute("d",t.toSVGPath())}updatePath(e,t){this.#ls.get(e).setAttribute("d",t.toSVGPath())}updateBox(e,t){Cxe.#cs(this.#ss.get(e),t)}show(e,t){this.#ss.get(e).classList.toggle("hidden",!t)}rotate(e,t){this.#ss.get(e).setAttribute("data-main-rotation",t)}changeColor(e,t){this.#ss.get(e).setAttribute("fill",t)}changeOpacity(e,t){this.#ss.get(e).setAttribute("fill-opacity",t)}addClass(e,t){this.#ss.get(e).classList.add(t)}removeClass(e,t){this.#ss.get(e).classList.remove(t)}getSVGRoot(e){return this.#ss.get(e)}remove(e){this.#ls.delete(e),null!==this.#jn&&(this.#ss.get(e).remove(),this.#ss.delete(e))}destroy(){this.#jn=null;for(const e of this.#ss.values())e.remove();this.#ss.clear(),this.#ls.clear()}}var Txe=gfe.AbortException,Pxe=gfe.AnnotationEditorLayer,Oxe=gfe.AnnotationEditorParamsType,Mxe=gfe.AnnotationEditorType,Dxe=gfe.AnnotationEditorUIManager,Ixe=gfe.AnnotationLayer,Nxe=gfe.AnnotationMode,jxe=gfe.ColorPicker,zxe=gfe.DOMSVGFactory,Rxe=gfe.DrawLayer,Lxe=gfe.FeatureTest,Fxe=gfe.GlobalWorkerOptions,Bxe=gfe.ImageKind,Hxe=gfe.InvalidPDFException,qxe=gfe.MissingPDFException,Uxe=gfe.OPS,Vxe=gfe.OutputScale,Wxe=gfe.PDFDataRangeTransport,$xe=gfe.PDFDateString,Gxe=gfe.PDFWorker,Kxe=gfe.PasswordResponses,Zxe=gfe.PermissionFlag,Yxe=gfe.PixelsPerInch,Xxe=gfe.RenderingCancelledException,Qxe=gfe.TextLayer,Jxe=gfe.UnexpectedResponseException,eke=gfe.Util,tke=gfe.VerbosityLevel,ake=gfe.XfaLayer,nke=gfe.build,ike=gfe.createValidAbsoluteUrl,rke=gfe.fetchData,oke=gfe.getDocument,ske=gfe.getFilenameFromUrl,lke=gfe.getPdfFilenameFromUrl,cke=gfe.getXfaPageViewport,uke=gfe.isDataScheme,dke=gfe.isPdfFile,hke=gfe.noContextMenu,mke=gfe.normalizeUnicode,pke=gfe.setLayerDimensions,gke=gfe.shadow,fke=gfe.version,yke=Object.freeze({__proto__:null,AbortException:Txe,AnnotationEditorLayer:Pxe,AnnotationEditorParamsType:Oxe,AnnotationEditorType:Mxe,AnnotationEditorUIManager:Dxe,AnnotationLayer:Ixe,AnnotationMode:Nxe,ColorPicker:jxe,DOMSVGFactory:zxe,DrawLayer:Rxe,FeatureTest:Lxe,GlobalWorkerOptions:Fxe,ImageKind:Bxe,InvalidPDFException:Hxe,MissingPDFException:qxe,OPS:Uxe,OutputScale:Vxe,PDFDataRangeTransport:Wxe,PDFDateString:$xe,PDFWorker:Gxe,PasswordResponses:Kxe,PermissionFlag:Zxe,PixelsPerInch:Yxe,RenderingCancelledException:Xxe,TextLayer:Qxe,UnexpectedResponseException:Jxe,Util:eke,VerbosityLevel:tke,XfaLayer:ake,build:nke,createValidAbsoluteUrl:ike,fetchData:rke,getDocument:oke,getFilenameFromUrl:ske,getPdfFilenameFromUrl:lke,getXfaPageViewport:cke,isDataScheme:uke,isPdfFile:dke,noContextMenu:hke,normalizeUnicode:mke,setLayerDimensions:pke,shadow:gke,version:fke}),vke=function(e,t,a){if(a||2===arguments.length)for(var n,i=0,r=t.length;i<r;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))},bke=vke(vke(vke(vke(vke(vke(vke(vke(vke(vke(vke(vke(vke(vke(vke(vke(vke(vke([],["onCopy","onCut","onPaste"],!0),["onCompositionEnd","onCompositionStart","onCompositionUpdate"],!0),["onFocus","onBlur"],!0),["onInput","onInvalid","onReset","onSubmit"],!0),["onLoad","onError"],!0),["onKeyDown","onKeyPress","onKeyUp"],!0),["onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting"],!0),["onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp"],!0),["onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"],!0),["onSelect"],!0),["onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],!0),["onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut"],!0),["onScroll"],!0),["onWheel"],!0),["onAnimationStart","onAnimationEnd","onAnimationIteration"],!0),["onTransitionEnd"],!0),["onChange"],!0),["onToggle"],!0);function wke(e,t){var a={};return bke.forEach((function(n){var i=e[n];i&&(a[n]=t?function(e){return i(e,t(n))}:i)})),a}function xke(e){var t=!1,a=new Promise((function(a,n){e.then((function(e){return!t&&a(e)})).catch((function(e){return!t&&n(e)}))}));return{promise:a,cancel:function(){t=!0}}}var kke=function(){};if("production"!==process.env.NODE_ENV){var Ake=function(e,t){var a=arguments.length;t=new Array(a>1?a-1:0);for(var n=1;n<a;n++)t[n-1]=arguments[n];var i=0,r="Warning: "+e.replace(/%s/g,(function(){return t[i++]}));"undefined"!=typeof console&&console.error(r);try{throw new Error(r)}catch(e){}};kke=function(e,t,a){var n=arguments.length;a=new Array(n>2?n-2:0);for(var i=2;i<n;i++)a[i-2]=arguments[i];if(void 0===t)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");e||Ake.apply(null,[t].concat(a))}}var Ske=$t(kke),Eke=Object.prototype.hasOwnProperty;function _ke(e,t,a){for(a of e.keys())if(Cke(a,t))return a}function Cke(e,t){var a,n,i;if(e===t)return!0;if(e&&t&&(a=e.constructor)===t.constructor){if(a===Date)return e.getTime()===t.getTime();if(a===RegExp)return e.toString()===t.toString();if(a===Array){if((n=e.length)===t.length)for(;n--&&Cke(e[n],t[n]););return-1===n}if(a===Set){if(e.size!==t.size)return!1;for(n of e){if((i=n)&&"object"==typeof i&&!(i=_ke(t,i)))return!1;if(!t.has(i))return!1}return!0}if(a===Map){if(e.size!==t.size)return!1;for(n of e){if((i=n[0])&&"object"==typeof i&&!(i=_ke(t,i)))return!1;if(!Cke(n[1],t.get(i)))return!1}return!0}if(a===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(a===DataView){if((n=e.byteLength)===t.byteLength)for(;n--&&e.getInt8(n)===t.getInt8(n););return-1===n}if(ArrayBuffer.isView(e)){if((n=e.byteLength)===t.byteLength)for(;n--&&e[n]===t[n];);return-1===n}if(!a||"object"==typeof e){for(a in n=0,e){if(Eke.call(e,a)&&++n&&!Eke.call(t,a))return!1;if(!(a in t)||!Cke(e[a],t[a]))return!1}return Object.keys(t).length===n}}return e!=e&&t!=t}const Tke=o(null);function Pke({children:e,type:t}){return x("div",{className:`react-pdf__message react-pdf__message--${t}`,children:e})}class Oke{constructor(){this.externalLinkEnabled=!0,this.externalLinkRel=void 0,this.externalLinkTarget=void 0,this.isInPresentationMode=!1,this.pdfDocument=void 0,this.pdfViewer=void 0}setDocument(e){this.pdfDocument=e}setViewer(e){this.pdfViewer=e}setExternalLinkRel(e){this.externalLinkRel=e}setExternalLinkTarget(e){this.externalLinkTarget=e}setHistory(){}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return Y8(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber||0}set page(e){Y8(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber=e}get rotation(){return 0}set rotation(e){}goToDestination(e){return new Promise((t=>{Y8(this.pdfDocument,"PDF document not loaded."),Y8(e,"Destination is not specified."),"string"==typeof e?this.pdfDocument.getDestination(e).then(t):Array.isArray(e)?t(e):e.then(t)})).then((e=>{Y8(Array.isArray(e),`"${e}" is not a valid destination array.`);const t=e[0];new Promise((e=>{Y8(this.pdfDocument,"PDF document not loaded."),t instanceof Object?this.pdfDocument.getPageIndex(t).then((t=>{e(t)})).catch((()=>{Y8(!1,`"${t}" is not a valid page reference.`)})):"number"==typeof t?e(t):Y8(!1,`"${t}" is not a valid destination reference.`)})).then((t=>{const a=t+1;Y8(this.pdfViewer,"PDF viewer is not initialized."),Y8(a>=1&&a<=this.pagesCount,`"${a}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({dest:e,pageIndex:t,pageNumber:a})}))}))}navigateTo(e){this.goToDestination(e)}goToPage(e){const t=e-1;Y8(this.pdfViewer,"PDF viewer is not initialized."),Y8(e>=1&&e<=this.pagesCount,`"${e}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({pageIndex:t,pageNumber:e})}addLinkAttributes(e,t,a){e.href=t,e.rel=this.externalLinkRel||"noopener noreferrer nofollow",e.target=a?"_blank":this.externalLinkTarget||""}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}setHash(){}executeNamedAction(){}cachePageRef(){}isPageVisible(){return!0}isPageCached(){return!0}executeSetOCGState(){}}const Mke=1,Dke=2,Ike="undefined"!=typeof window,Nke=Ike&&"file:"===window.location.protocol;function jke(e){return function(e){return void 0!==e}(e)&&null!==e}function zke(e){return function(e){return"string"==typeof e}(e)&&/^data:/.test(e)}function Rke(e){Y8(zke(e),"Invalid data URI.");const[t="",a=""]=e.split(",");return-1!==t.split(";").indexOf("base64")?atob(a):unescape(a)}function Lke(){return Ike&&window.devicePixelRatio||1}const Fke="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function Bke(){Ske(!Nke,`Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ${Fke}`)}function Hke(e){(null==e?void 0:e.cancel)&&e.cancel()}function qke(e,t){return Object.defineProperty(e,"width",{get(){return this.view[2]*t},configurable:!0}),Object.defineProperty(e,"height",{get(){return this.view[3]*t},configurable:!0}),Object.defineProperty(e,"originalWidth",{get(){return this.view[2]},configurable:!0}),Object.defineProperty(e,"originalHeight",{get(){return this.view[3]},configurable:!0}),e}function Uke(e,t){switch(t.type){case"RESOLVE":return{value:t.value,error:void 0};case"REJECT":return{value:!1,error:t.error};case"RESET":return{value:void 0,error:void 0};default:return e}}function Vke(){return v(Uke,{value:void 0,error:void 0})}var Wke=function(e,t,a,n){return new(a||(a=Promise))((function(i,r){function o(e){try{l(n.next(e))}catch(e){r(e)}}function s(e){try{l(n.throw(e))}catch(e){r(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof a?e:new a((function(t){t(e)}))}(e.value).then(o,s)}l((n=n.apply(e,t||[])).next())}))},$ke=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(a[n[i]]=e[n[i]])}return a};const{PDFDataRangeTransport:Gke}=yke,Kke=(e,t)=>{switch(t){case Mke:e(prompt("Enter the password to open this PDF file."));break;case Dke:e(prompt("Invalid password. Please try again."));break}};function Zke(e){return"object"==typeof e&&null!==e&&("data"in e||"range"in e||"url"in e)}const Yke=a((function(e,t){var{children:a,className:n,error:i="Failed to load PDF file.",externalLinkRel:r,externalLinkTarget:o,file:c,inputRef:u,imageResourcesPath:d,loading:h="Loading PDF…",noData:f="No PDF file specified.",onItemClick:y,onLoadError:v,onLoadProgress:b,onLoadSuccess:w,onPassword:k=Kke,onSourceError:A,onSourceSuccess:S,options:E,renderMode:_,rotate:C}=e,T=$ke(e,["children","className","error","externalLinkRel","externalLinkTarget","file","inputRef","imageResourcesPath","loading","noData","onItemClick","onLoadError","onLoadProgress","onLoadSuccess","onPassword","onSourceError","onSourceSuccess","options","renderMode","rotate"]);const[P,O]=Vke(),{value:M,error:D}=P,[I,N]=Vke(),{value:j,error:z}=I,R=s(new Oke),L=s([]),F=s(void 0),B=s(void 0);c&&c!==F.current&&Zke(c)&&(Ske(!Cke(c,F.current),'File prop passed to <Document /> changed, but it\'s equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.'),F.current=c),E&&E!==B.current&&(Ske(!Cke(E,B.current),'Options prop passed to <Document /> changed, but it\'s equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.'),B.current=E);const H=s({scrollPageIntoView:e=>{const{dest:t,pageNumber:a,pageIndex:n=a-1}=e;if(y)return void y({dest:t,pageIndex:n,pageNumber:a});const i=L.current[n];i?i.scrollIntoView():Ske(!1,`An internal link leading to page ${a} was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document> and handle navigating by yourself or ensure that all pages are rendered within <Document>.`)}});m(t,(()=>({linkService:R,pages:L,viewer:H})),[]),l((function(){O({type:"RESET"})}),[c,O]);const q=p((()=>Wke(this,void 0,void 0,(function*(){if(!c)return null;if("string"==typeof c){if(zke(c)){return{data:Rke(c)}}return Bke(),{url:c}}if(c instanceof Gke)return{range:c};if(c instanceof ArrayBuffer)return{data:c};if(Ike&&function(e){return Y8(Ike,"isBlob can only be used in a browser environment"),e instanceof Blob}(c)){const e=yield function(e){return new Promise(((t,a)=>{const n=new FileReader;n.onload=()=>{if(!n.result)return a(new Error("Error while reading a file."));t(n.result)},n.onerror=e=>{if(!e.target)return a(new Error("Error while reading a file."));const{error:t}=e.target;if(!t)return a(new Error("Error while reading a file."));switch(t.code){case t.NOT_FOUND_ERR:return a(new Error("Error while reading a file: File not found."));case t.SECURITY_ERR:return a(new Error("Error while reading a file: Security error."));case t.ABORT_ERR:return a(new Error("Error while reading a file: Aborted."));default:return a(new Error("Error while reading a file."))}},n.readAsArrayBuffer(e)}))}(c);return{data:e}}if(Y8("object"==typeof c,"Invalid parameter in file, need either Uint8Array, string or a parameter object"),Y8(Zke(c),"Invalid parameter object: need either .data, .range or .url"),"url"in c&&"string"==typeof c.url){if(zke(c.url)){const{url:e}=c,t=$ke(c,["url"]),a=Rke(e);return Object.assign({data:a},t)}Bke()}return c}))),[c]);l((()=>{const e=xke(q());return e.promise.then((e=>{O({type:"RESOLVE",value:e})})).catch((e=>{O({type:"REJECT",error:e})})),()=>{Hke(e)}}),[q,O]),l((()=>{void 0!==M&&(!1!==M?S&&S():D&&(Ske(!1,D.toString()),A&&A(D)))}),[M]),l((function(){N({type:"RESET"})}),[N,M]),l((function(){if(!M)return;const e=E?Object.assign(Object.assign({},M),E):M,t=oke(e);b&&(t.onProgress=b),k&&(t.onPassword=k);const a=t,n=a.promise.then((e=>{N({type:"RESOLVE",value:e})})).catch((e=>{a.destroyed||N({type:"REJECT",error:e})}));return()=>{n.finally((()=>a.destroy()))}}),[E,N,M]),l((()=>{void 0!==j&&(!1!==j?j&&(w&&w(j),L.current=new Array(j.numPages),R.current.setDocument(j)):z&&(Ske(!1,z.toString()),v&&v(z)))}),[j]),l((function(){R.current.setViewer(H.current),R.current.setExternalLinkRel(r),R.current.setExternalLinkTarget(o)}),[r,o]);const U=p(((e,t)=>{L.current[e]=t}),[]),V=p((e=>{delete L.current[e]}),[]),W=g((()=>({imageResourcesPath:d,linkService:R.current,onItemClick:y,pdf:j,registerPage:U,renderMode:_,rotate:C,unregisterPage:V})),[d,y,j,U,_,C,V]),$=g((()=>wke(T,(()=>j))),[T,j]);return x("div",Object.assign({className:FU("react-pdf__Document",n),ref:u,style:{"--scale-factor":"1"}},$,{children:c?null==j?x(Pke,{type:"loading",children:"function"==typeof h?h():h}):!1===j?x(Pke,{type:"error",children:"function"==typeof i?i():i}):x(Tke.Provider,{value:W,children:a}):x(Pke,{type:"no-data",children:"function"==typeof f?f():f})}))}));function Xke(){return r(Tke)}function Qke(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var a=e.filter(Boolean);return a.length<=1?a[0]||null:function(e){a.forEach((function(t){"function"==typeof t?t(e):t&&(t.current=e)}))}}const Jke=o(null),eAe={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},tAe=/^H(\d+)$/;function aAe(e){return"children"in e}function nAe(e){return!!aAe(e)&&(1===e.children.length&&0 in e.children&&"id"in e.children[0])}function iAe(e){const t={};if(aAe(e)){const{role:a}=e,n=a.match(tAe);if(n)t.role="heading",t["aria-level"]=Number(n[1]);else if(function(e){return e in eAe}(a)){const e=eAe[a];e&&(t.role=e)}}return t}function rAe(e){const t={};if(aAe(e)){if(void 0!==e.alt&&(t["aria-label"]=e.alt),void 0!==e.lang&&(t.lang=e.lang),nAe(e)){const[a]=e.children;if(a){const e=rAe(a);return Object.assign(Object.assign({},t),e)}}}else"id"in e&&(t["aria-owns"]=e.id);return t}function oAe(e){return e?Object.assign(Object.assign({},iAe(e)),rAe(e)):null}function sAe({className:e,node:t}){const a=g((()=>oAe(t)),[t]),n=g((()=>aAe(t)?nAe(t)?null:t.children.map(((e,t)=>x(sAe,{node:e},t))):null),[t]);return x("span",Object.assign({className:e},a,{children:n}))}function lAe(){return r(Jke)}function cAe(){const e=lAe();Y8(e,"Unable to find Page context.");const{onGetStructTreeError:t,onGetStructTreeSuccess:a}=e,[n,i]=Vke(),{value:r,error:o}=n,{customTextRenderer:s,page:c}=e;return l((function(){i({type:"RESET"})}),[i,c]),l((function(){if(s)return;if(!c)return;const e=xke(c.getStructTree()),t=e;return e.promise.then((e=>{i({type:"RESOLVE",value:e})})).catch((e=>{i({type:"REJECT",error:e})})),()=>Hke(t)}),[s,c,i]),l((()=>{void 0!==r&&(!1!==r?r&&a&&a(r):o&&(Ske(!1,o.toString()),t&&t(o)))}),[r]),r?x(sAe,{className:"react-pdf__Page__structTree structTree",node:r}):null}const uAe=Nxe;function dAe(e){const t=lAe();Y8(t,"Unable to find Page context.");const a=Object.assign(Object.assign({},t),e),{_className:n,canvasBackground:i,devicePixelRatio:r=Lke(),onRenderError:o,onRenderSuccess:c,page:u,renderForms:d,renderTextLayer:h,rotate:m,scale:f}=a,{canvasRef:y}=e;Y8(u,"Attempted to render page canvas, but no page was specified.");const v=s(null);function b(e){(function(e){return"RenderingCancelledException"===e.name})(e)||(Ske(!1,e.toString()),o&&o(e))}const w=g((()=>u.getViewport({scale:f*r,rotation:m})),[r,u,m,f]),k=g((()=>u.getViewport({scale:f,rotation:m})),[u,m,f]);l((function(){if(!u)return;u.cleanup();const{current:e}=v;if(!e)return;e.width=w.width,e.height=w.height,e.style.width=`${Math.floor(k.width)}px`,e.style.height=`${Math.floor(k.height)}px`,e.style.visibility="hidden";const t={annotationMode:d?uAe.ENABLE_FORMS:uAe.ENABLE,canvasContext:e.getContext("2d",{alpha:!1}),viewport:w};i&&(t.background=i);const a=u.render(t),n=a;return a.promise.then((()=>{e.style.visibility="",u&&c&&c(qke(u,f))})).catch(b),()=>Hke(n)}),[i,u,d,w,k]);const A=p((()=>{const{current:e}=v;e&&(e.width=0,e.height=0)}),[]);return l((()=>A),[A]),x("canvas",{className:`${n}__canvas`,dir:"ltr",ref:Qke(y,v),style:{display:"block",userSelect:"none"},children:h?x(cAe,{}):null})}function hAe(){const e=lAe();Y8(e,"Unable to find Page context.");const{customTextRenderer:t,onGetTextError:a,onGetTextSuccess:n,onRenderTextLayerError:i,onRenderTextLayerSuccess:r,page:o,pageIndex:c,pageNumber:u,rotate:d,scale:h}=e;Y8(o,"Attempted to load page text content, but no page was specified.");const[m,f]=Vke(),{value:y,error:v}=m,w=s(null);Ske(1===Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10),"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer"),l((function(){f({type:"RESET"})}),[o,f]),l((function(){if(!o)return;const e=xke(o.getTextContent()),t=e;return e.promise.then((e=>{f({type:"RESOLVE",value:e})})).catch((e=>{f({type:"REJECT",error:e})})),()=>Hke(t)}),[o,f]),l((()=>{void 0!==y&&(!1!==y?y&&n&&n(y):v&&(Ske(!1,v.toString()),a&&a(v)))}),[y]);const k=p((()=>{r&&r()}),[r]),A=p((e=>{Ske(!1,e.toString()),i&&i(e)}),[i]);const S=g((()=>o.getViewport({scale:h,rotation:d})),[o,d,h]);return b((function(){if(!o||!y)return;const{current:e}=w;if(!e)return;e.innerHTML="";const a=o.streamTextContent({includeMarkedContent:!0}),n=new Qxe({container:e,textContentSource:a,viewport:S}),i=n;return n.render().then((()=>{const a=document.createElement("div");a.className="endOfContent",e.append(a);const n=e.querySelectorAll('[role="presentation"]');if(t){let e=0;y.items.forEach(((a,i)=>{if(!function(e){return"str"in e}(a))return;const r=n[e];if(!r)return;const o=t(Object.assign({pageIndex:c,pageNumber:u,itemIndex:i},a));r.innerHTML=o,e+=a.str&&a.hasEOL?2:1}))}k()})).catch(A),()=>Hke(i)}),[t,A,k,o,c,u,y,S]),x("div",{className:FU("react-pdf__Page__textContent","textLayer"),onMouseUp:function(){const e=w.current;e&&e.classList.remove("selecting")},onMouseDown:function(){const e=w.current;e&&e.classList.add("selecting")},ref:w})}function mAe(){const e=Xke(),t=lAe();Y8(t,"Unable to find Page context.");const a=Object.assign(Object.assign({},e),t),{imageResourcesPath:n,linkService:i,onGetAnnotationsError:r,onGetAnnotationsSuccess:o,onRenderAnnotationLayerError:c,onRenderAnnotationLayerSuccess:u,page:d,pdf:h,renderForms:m,rotate:p,scale:f=1}=a;Y8(h,"Attempted to load page annotations, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop."),Y8(d,"Attempted to load page annotations, but no page was specified."),Y8(i,"Attempted to load page annotations, but no linkService was specified.");const[y,v]=Vke(),{value:b,error:w}=y,k=s(null);Ske(1===Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10),"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations"),l((function(){v({type:"RESET"})}),[v,d]),l((function(){if(!d)return;const e=xke(d.getAnnotations()),t=e;return e.promise.then((e=>{v({type:"RESOLVE",value:e})})).catch((e=>{v({type:"REJECT",error:e})})),()=>{Hke(t)}}),[v,d]),l((()=>{void 0!==b&&(!1!==b?b&&o&&o(b):w&&(Ske(!1,w.toString()),r&&r(w)))}),[b]);const A=g((()=>d.getViewport({scale:f,rotation:p})),[d,p,f]);return l((function(){if(!(h&&d&&i&&b))return;const{current:e}=k;if(!e)return;const t=A.clone({dontFlip:!0}),a={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,div:e,l10n:null,page:d,structTreeLayer:null,viewport:t},r={annotations:b,annotationStorage:h.annotationStorage,div:e,imageResourcesPath:n,linkService:i,page:d,renderForms:m,viewport:t};e.innerHTML="";try{new Ixe(a).render(r),u&&u()}catch(e){!function(e){Ske(!1,`${e}`),c&&c(e)}(e)}return()=>{}}),[b,n,i,d,h,m,A]),x("div",{className:FU("react-pdf__Page__annotations","annotationLayer"),ref:k})}var pAe=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(a[n[i]]=e[n[i]])}return a};const gAe=1;function fAe(e){const t=Xke(),a=Object.assign(Object.assign({},t),e),{_className:n="react-pdf__Page",_enableRegisterUnregisterPage:i=!0,canvasBackground:r,canvasRef:o,children:c,className:u,customRenderer:d,customTextRenderer:h,devicePixelRatio:m,error:p="Failed to load the page.",height:f,inputRef:y,loading:v="Loading page…",noData:b="No page specified.",onGetAnnotationsError:w,onGetAnnotationsSuccess:A,onGetStructTreeError:S,onGetStructTreeSuccess:E,onGetTextError:_,onGetTextSuccess:C,onLoadError:T,onLoadSuccess:P,onRenderAnnotationLayerError:O,onRenderAnnotationLayerSuccess:M,onRenderError:D,onRenderSuccess:I,onRenderTextLayerError:N,onRenderTextLayerSuccess:j,pageIndex:z,pageNumber:R,pdf:L,registerPage:F,renderAnnotationLayer:B=!0,renderForms:H=!1,renderMode:q="canvas",renderTextLayer:U=!0,rotate:V,scale:W=gAe,unregisterPage:$,width:G}=a,K=pAe(a,["_className","_enableRegisterUnregisterPage","canvasBackground","canvasRef","children","className","customRenderer","customTextRenderer","devicePixelRatio","error","height","inputRef","loading","noData","onGetAnnotationsError","onGetAnnotationsSuccess","onGetStructTreeError","onGetStructTreeSuccess","onGetTextError","onGetTextSuccess","onLoadError","onLoadSuccess","onRenderAnnotationLayerError","onRenderAnnotationLayerSuccess","onRenderError","onRenderSuccess","onRenderTextLayerError","onRenderTextLayerSuccess","pageIndex","pageNumber","pdf","registerPage","renderAnnotationLayer","renderForms","renderMode","renderTextLayer","rotate","scale","unregisterPage","width"]),[Z,Y]=Vke(),{value:X,error:Q}=Z,J=s(null);Y8(L,"Attempted to load a page, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop.");const ee=jke(R)?R-1:null!=z?z:null,te=null!=R?R:jke(z)?z+1:null,ae=null!=V?V:X?X.rotate:null,ne=g((()=>{if(!X)return null;let e=1;const t=null!=W?W:gAe;if(G||f){const t=X.getViewport({scale:1,rotation:ae});G?e=G/t.width:f&&(e=f/t.height)}return t*e}),[f,X,ae,W,G]);l((function(){return()=>{jke(ee)&&i&&$&&$(ee)}}),[i,L,ee,$]),l((function(){Y({type:"RESET"})}),[Y,L,ee]),l((function(){if(!L||!te)return;const e=xke(L.getPage(te)),t=e;return e.promise.then((e=>{Y({type:"RESOLVE",value:e})})).catch((e=>{Y({type:"REJECT",error:e})})),()=>Hke(t)}),[Y,L,te]),l((()=>{void 0!==X&&(!1!==X?function(){if(P){if(!X||!ne)return;P(qke(X,ne))}if(i&&F){if(!jke(ee)||!J.current)return;F(ee,J.current)}}():Q&&(Ske(!1,Q.toString()),T&&T(Q)))}),[X,ne]);const ie=g((()=>X&&jke(ee)&&te&&jke(ae)&&jke(ne)?{_className:n,canvasBackground:r,customTextRenderer:h,devicePixelRatio:m,onGetAnnotationsError:w,onGetAnnotationsSuccess:A,onGetStructTreeError:S,onGetStructTreeSuccess:E,onGetTextError:_,onGetTextSuccess:C,onRenderAnnotationLayerError:O,onRenderAnnotationLayerSuccess:M,onRenderError:D,onRenderSuccess:I,onRenderTextLayerError:N,onRenderTextLayerSuccess:j,page:X,pageIndex:ee,pageNumber:te,renderForms:H,renderTextLayer:U,rotate:ae,scale:ne}:null),[n,r,h,m,w,A,S,E,_,C,O,M,D,I,N,j,X,ee,te,H,U,ae,ne]),re=g((()=>wke(K,(()=>X?ne?qke(X,ne):void 0:X))),[K,X,ne]),oe=`${ee}@${ne}/${ae}`;function se(){switch(q){case"custom":return Y8(d,'renderMode was set to "custom", but no customRenderer was passed.'),x(d,{},`${oe}_custom`);case"none":return null;default:return x(dAe,{canvasRef:o},`${oe}_canvas`)}}return x("div",Object.assign({className:FU(n,u),"data-page-number":te,ref:Qke(y,J),style:{"--scale-factor":`${ne}`,backgroundColor:r||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"}},re,{children:te?null===L||null==X?x(Pke,{type:"loading",children:"function"==typeof v?v():v}):!1===L||!1===X?x(Pke,{type:"error",children:"function"==typeof p?p():p}):k(Jke.Provider,{value:ie,children:[se(),U?x(hAe,{},`${oe}_text`):null,B?x(mAe,{},`${oe}_annotations`):null,c]}):x(Pke,{type:"no-data",children:"function"==typeof b?b():b})}))}Ske(!Nke,`Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ${Fke}`),Fxe.workerSrc="pdf.worker.mjs";function yAe(e){const[a,n]=c(),[i,r]=c();if(!e.url)return null;const o=a?Math.min(e.maxHeight/a,1):1,s=i?Math.min(e.maxWidth/i,1):1,l=Math.min(o,s);return t.createElement("div",{className:"mdhui-pdf-preview",style:e.style,ref:e.innerRef},t.createElement(Yke,{file:e.url},t.createElement(fAe,{pageNumber:1,scale:l,onLoadSuccess:t=>{a?e.onLoad?.():(n(t.height),r(t.width))},renderTextLayer:!1,renderAnnotationLayer:!1})))}A(".mdhui-pdf-preview .react-pdf__Page {\n display: flex;\n align-items: center;\n justify-content: center;\n}"),Fxe.workerSrc="/assets/pdf.worker.min.js";function vAe(e){const[a,n]=c(!0),[i,r]=c(null);function o(){if("Default"==e.previewState)return r({name:"My Project Name",organization:{name:"My Organization Name",color:"#0076BE",logoUrl:"https://rkstudio.careevolution.com/inv/api/researchkit/organizationbrandingimage/1e1853a2-50d3-4e26-863d-d8546bce63e3"}}),void n(!1);w.getProjectInfo().then((function(e){r(e),n(!1)}))}l((()=>(o(),w.on("applicationDidBecomeVisible",o),()=>{w.off("applicationDidBecomeVisible",o)})),[]);var s=i?.organization.logoUrl;return s&&!s?.startsWith("http")&&(s=w.baseUrl+i?.organization.logoUrl),t.createElement("div",{ref:e.innerRef,className:"mdhui-project-header"},a&&t.createElement(XA,null),!a&&i&&t.createElement("div",null,t.createElement("div",{style:{backgroundImage:"url('"+s+"')"},className:"logo"}),t.createElement("div",{className:"project-info"},t.createElement("div",{className:"project-name",style:{color:i.organization.color}},i.name),t.createElement("div",{className:"organization-name"},i.organization.name))))}A(".mdhui-project-header\n{\n padding: 16px;\n text-align: center;\n background: #FFF;\n border-bottom: solid 1px var(--mdhui-border-color-1);\n line-height: normal;\n}\n\n .mdhui-project-header .logo\n {\n display: inline-block;\n width: 48px;\n height: 48px;\n background-size: contain;\n background-position: center center;\n background-repeat: no-repeat;\n vertical-align: middle;\n }\n\n .mdhui-project-header .project-info\n {\n display: inline-block;\n text-align: left;\n padding-left: 16px;\n vertical-align: top;\n padding-right: 16px;\n max-width: calc(100% - 80px);\n }\n\n .mdhui-project-header .project-info .project-name\n {\n font-weight: bold;\n font-size: 1.5em;\n max-width: 100%;\n }\n\n .mdhui-project-header .project-info .organization-name\n {\n max-width: 100%;\n color: #333;\n }\n");function bAe(e){const[a,n]=c(!0),[i,r]=c(null);function o(){if("Default"==e.previewState)return r({supportEmail:"test@example.com",supportPhone:"555-555-1212",learnMoreLink:"https://mydatahelps.org",learnMoreTitle:"Project Home Page"}),void n(!1);w.getProjectInfo().then((function(e){r(e),n(!1)}))}return l((()=>(o(),w.on("applicationDidBecomeVisible",o),()=>{w.off("applicationDidBecomeVisible",o)})),[]),!i||i.supportEmail||i.supportPhone||i.learnMoreLink&&i.learnMoreTitle?t.createElement("div",{ref:e.innerRef,className:"mdhui-project-support"},t.createElement("div",{className:"title"},no("support")),a&&t.createElement(XA,null),i?.learnMoreLink&&i?.learnMoreTitle&&t.createElement(Za,{indicatorIcon:I,subtitle:i.learnMoreTitle,onClick:()=>w.openEmbeddedUrl(i.learnMoreLink)}),i?.supportEmail&&t.createElement(Za,{indicatorIcon:ae,subtitle:i.supportEmail,onClick:()=>w.openExternalUrl("mailto:"+i.supportEmail)}),i?.supportPhone&&t.createElement(Za,{indicatorIcon:J,subtitle:i.supportPhone,onClick:()=>w.openExternalUrl("tel:"+i.supportPhone)})):null}A(".mdhui-project-support>.title {\n font-weight: bold;\n padding: 16px;\n padding-bottom: 0;\n}\n\n.mdhui-project-support .mdhui-action {\n color: var(--mdhui-color-primary);\n border-bottom: solid 1px var(--mdhui-border-color-0);\n}\n\n.mdhui-project-support .mdhui-action .subtitle {\n color: var(--mdhui-color-primary);\n}");A(".mdhui-provider-search .search-bar-wrapper {\n text-align: left;\n box-sizing: border-box;\n font-weight: bold;\n border-bottom: solid 1px var(--mdhui-border-color-1);\n}\n\n.mdhui-provider-search .search-bar-wrapper .search-bar {\n position: relative;\n}\n\n.mdhui-provider-search .search-bar-wrapper .search-bar input {\n padding: 0;\n margin: 0;\n border: 0;\n width: 100%;\n line-height: 1.5em;\n padding-left: 40px;\n box-sizing: border-box;\n font-size: .88em;\n padding-top: 8px;\n padding-bottom: 8px;\n border: none;\n background: var(--mdhui-background-color-0);\n color: var(--mdhui-text-color-1);\n}\n\n.mdhui-provider-search .search-bar-wrapper .search-bar .fa-magnifying-glass {\n position: absolute;\n left: 16px;\n top: 12px;\n color: var(--mdhui-text-color-4);\n font-size: .8em;\n}\n\n.mdhui-provider-search .search-results .provider {\n border-bottom: solid 1px var(--mdhui-border-color-1);\n padding: 16px;\n padding-top: 8px;\n padding-bottom: 8px;\n cursor: pointer;\n font-size: .88em;\n width: 100%;\n display: flex;\n flex-direction: row;\n gap: 16px;\n align-items: center;\n min-height: 61px;\n}\n\n.mdhui-provider-search .search-results .provider .provider-info {\n flex-grow: 1;\n}\n\n\n.mdhui-provider-search .search-results .provider .provider-logo {\n height: 44px;\n width: 72px;\n background-size: contain;\n background-repeat: no-repeat;\n background-position: center center;\n background-color: #FFF;\n border-radius: 4px;\n flex-shrink: 0;\n}\n\n.mdhui-provider-search .search-results .provider .provider-status {\n font-size: .88em;\n font-weight: bold;\n}\n\n.mdhui-provider-search .search-results .provider .provider-status.error-status {\n color: var(--mdhui-color-danger);\n}\n\n.mdhui-provider-search .search-results .provider .provider-status.connected-status {\n color: var(--mdhui-color-success);\n}\n\n.mdhui-provider-search .search-results .provider.disabled {\n cursor: default;\n}");var wAe=[{id:20,name:"1upHealth sandbox",category:"Health Plan",logoUrl:"https://mdhorg.ce.dev/api/v1/delegated/externalaccountproviders/20/logo",enabled:!0},{id:2,name:"Fitbit",category:"Device Manufacturer",logoUrl:"https://mdhorg.ce.dev/api/v1/delegated/externalaccountproviders/2/logo",enabled:!0},{id:13,name:"A Woman's Place, LLC",category:"Provider",logoUrl:"https://mdhorg.ce.dev/api/v1/delegated/externalaccountproviders/13/logo",enabled:!0},{id:130,name:"Abington Jefferson Health",category:"Provider",logoUrl:"https://mdhorg.ce.dev/api/v1/delegated/externalaccountproviders/130/logo",enabled:!0},{id:41,name:"Access Community Health Network",category:"Provider",logoUrl:"https://mdhorg.ce.dev/api/v1/delegated/externalaccountproviders/41/logo",enabled:!0},{id:125,name:"Aurora Health Care - myAurora",category:"Provider",logoUrl:"https://mdhorg.ce.dev/api/v1/delegated/externalaccountproviders/125/logo",enabled:!0},{id:1,name:"CareEvolution FHIR",category:"Provider",logoUrl:"https://mdhorg.ce.dev/api/v1/delegated/externalaccountproviders/1/logo",enabled:!0},{id:37,name:"Cedars-Sinai Health System",category:"Provider",logoUrl:"https://mdhorg.ce.dev/api/v1/delegated/externalaccountproviders/37/logo",enabled:!0},{id:27,name:"Maui Medical Group",category:"Provider",logoUrl:"https://mdhorg.ce.dev/api/v1/delegated/externalaccountproviders/27/logo",enabled:!0}];const xAe="Unavailable";let kAe=0;function AAe(e){const[a,n]=c({}),[i,r]=c([]),[o,u]=c(!0),[d,h]=c(""),[m,p]=c(0),[f,y]=c(0),v=s(d),b=100;async function x(){w.getExternalAccounts().then((function(e){let t={};for(let a=0;a<e.length;a++)t[e[a].provider.id]=e[a];n(t)}))}function k(t){u(!0);let a=++kAe;if(e.publicProviderSearchApiUrl){const n=new URL(e.publicProviderSearchApiUrl);n.searchParams.append("keyword",t),n.searchParams.append("pageSize",String(b)),n.searchParams.append("pageNumber",String(m+1)),fetch(n.toString(),{method:"GET",headers:{Accept:"application/json"}}).then((e=>e.json())).then((function(e){a==kAe&&(A(e.Providers.map((e=>({id:e.ID,name:e.OrganizationName,logoUrl:e.LogoURL,category:e.Category})))||[]),y(e.TotalCount),u(!1))})).catch((function(e){console.error("Error fetching external account providers",e),u(!1)}))}else w.getExternalAccountProviders(t,1==e.providerCategories?.length?e.providerCategories[0]:null,b,m).then((function(e){a==kAe&&(A(e.externalAccountProviders),y(e.totalExternalAccountProviders),u(!1))})).catch((function(e){console.error("Error fetching external account providers",e),u(!1)}))}function A(t){let a=i;""===v.current&&e.featuredProviders&&(a=a.concat(e.featuredProviders),t=t.filter((t=>!e.featuredProviders.find((e=>e.id==t.id)))));const n=a.concat(t).filter((t=>-1!=e.providerCategories?.indexOf(t.category)&&t.message!==xAe));n.forEach((e=>{void 0===e.enabled&&(e.enabled=!0)})),r(n)}const E=(e,t=300)=>{let a;return function(...n){clearTimeout(a),a=setTimeout((()=>e.apply(this,n)),t)}},_=g((()=>E(k,300)),[]);function C(t){var a;a=t.target.value,v.current=a,h(a),r([]),p(0),e.previewState||_(t.target.value)}function T(){x().then((function(){k(v.current)}))}l((()=>(e.previewState?"Default"==e.previewState&&(A(wAe),u(!1)):x().then((function(){k("")})),w.on("applicationDidBecomeVisible",T),()=>{w.off("applicationDidBecomeVisible",T)})),[]),l((()=>{o||k(v.current)}),[m]);return t.createElement("div",{ref:e.innerRef,className:"mdhui-provider-search"},t.createElement("div",{className:"search-bar-wrapper"},t.createElement("div",{className:"search-bar"},t.createElement("input",{title:no("search"),type:"text",value:d,onChange:e=>C(e),placeholder:no("search"),spellCheck:"false",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off"}),t.createElement(Ne,{icon:fe}))),t.createElement("div",{className:"search-results"},i&&i.map((n=>t.createElement(S,{key:n.id,className:n.enabled?"provider":"provider disabled",onClick:()=>{e.onProviderSelected?e.onProviderSelected(n):function(t){const n=t.id;!t.enabled||e.previewState||a[n]&&"unauthorized"!=a[n].status||w.connectExternalAccount(n,e.connectExternalAccountOptions||{openNewWindow:!0}).then((function(){return e.onProviderConnected&&e.onProviderConnected(t),x()}))}(n)}},t.createElement("div",{className:"provider-info"},t.createElement("div",{className:"provider-name"},n.name),a[n.id]&&"unauthorized"==a[n.id].status&&t.createElement("div",{className:"provider-status error-status"},no("expired-reconnect")),a[n.id]&&"unauthorized"!=a[n.id].status&&t.createElement("div",{className:"provider-status connected-status"},no("connected")),!a[n.id]&&!n.enabled&&t.createElement("div",{className:"provider-status connected-status"},(()=>{const e={provider:n.name};n.relatedProvider&&(e.relatedProvider=n.relatedProvider),n.managingOrganization&&(e.managingOrganization=n.managingOrganization);return no(n.managingOrganization?"provider-disabled-reason-with-managing-organization":"provider-disabled-reason-without-managing-organization",void 0,e)})())),n.logoUrl&&t.createElement("div",{className:"provider-logo",style:{backgroundImage:"url('"+n.logoUrl+"')"}})))),!o&&!e.hideRequestProviderButton&&(!e.providerCategories||0==e.providerCategories.length||e.providerCategories.includes("Provider")||e.providerCategories.includes("Health Plan"))&&t.createElement(Za,{onClick:()=>{w.openEmbeddedUrl("https://help.mydatahelps.org/hc/en-us/requests/new?ticket_form_id=34288897775635")},title:(()=>{let t="";return e.providerCategories&&0!=e.providerCategories.length&&!e.providerCategories.includes("Provider")||(t+=no("external-accounts-title-providers")),e.providerCategories&&0!=e.providerCategories.length&&!e.providerCategories.includes("Health Plan")||(t.length>0&&(t+=no("external-accounts-title-divider")),t+=no("external-accounts-title-health-plans")),`${no("request-add")} ${t}`})()}),o&&t.createElement(XA,null)),t.createElement(Vue,{onTrigger:function(){p(m+1)},enabled:(m+1)*b<f}))}function SAe(e){let[a,n]=c(!0),[i,r]=c(null),o=Rr(),s=cn(o,{days:-6}),l=cn(o,{days:1});id((()=>{if(n(!0),"loading"!==e.previewState)return"loaded without data"===e.previewState?(r({}),void n(!1)):"loaded with data"===e.previewState?e.previewDataProvider?void e.previewDataProvider(s,l).then((e=>{r(e),n(!1)})):void Tc(s,l,0,2e4).then((e=>{r(e),n(!1)})):void Jc(e.dailyDataType).then((function(t){t?eu(e.dailyDataType,s,l).then((e=>{r(e),n(!1)})):(r(null),n(!1))}));r({})}),["externalAccountSyncComplete"],[e.previewState]);let u=s,d=[],h=!1;if(i)for(;u<l;){let t={daysAfterStart:_n(u,s)};d.push(t);let a=Br(u);null!=i[a]&&null!=i[a]&&(t.rawValue=i[a],t.value=e.valueConverter?e.valueConverter(i[a]):i[a],t.date=u,h=!0),u=cn(u,{days:1})}return t.createElement("div",{className:"mdhui-recent-daily-data-bar-chart",ref:e.innerRef},t.createElement(sM,{order:3,className:"mdhui-recent-daily-data-bar-chart-title"},e.title),t.createElement("div",{className:"mdhui-recent-daily-data-bar-chart-subtitle"},no("recent-daily-data-bar-chart-subtitle")),t.createElement("div",{className:"mdhui-recent-daily-data-bar-chart-container"},a&&t.createElement(XA,null),!a&&!h&&t.createElement("div",{className:"mdhui-recent-daily-data-bar-chart-no-data-label"},no("recent-daily-data-bar-chart-no-data")),t.createElement(T1,{width:"100%",height:200},t.createElement(Cue,{data:d,cx:20},(h||e.emptyDomain)&&t.createElement(nle,{vertical:!1,x:0,horizontal:({y1:e,y2:a,key:n})=>t.createElement("line",{x1:0,y1:e,x2:"100%",y2:a,stroke:"var(--mdhui-background-color-2)",key:n})}),t.createElement(Pce,{dataKey:"value",tick:({x:e,y:a,payload:n})=>t.createElement("text",{x:e-24,y:a+12,fontSize:"11",fontWeight:"bold",textAnchor:"middle",fill:"var(--mdhui-text-color-3)"},(e=>0===e?"":e>=1e4?wl(e/1e3)+"K":wl(e))(n.value)),axisLine:!1,tickLine:!1,interval:0,width:1,domain:h?e.domain:e.emptyDomain,orientation:"right"}),t.createElement(vce,{dataKey:"daysAfterStart",tick:({x:e,y:a,payload:n})=>{let i=n.value,r=cn(s,{days:i});return t.createElement("text",{x:e,y:a+8,fontSize:"11",fontWeight:"bold",textAnchor:"middle",fill:"var(--mdhui-text-color-2)"},cl(r))},axisLine:!1,minTickGap:0,tickLine:!1,interval:"preserveStartEnd",padding:{left:20,right:40}}),t.createElement(Vre,{key:"bar",type:"monotone",dataKey:"value",radius:[4,4,0,0]},t.createElement(z7,{dataKey:"value",position:"center",content:({x:a,y:n,width:i,value:r,index:o})=>{if(!r)return;let s="var(--mdhui-color-primary)";return e.highlight&&e.highlight(d[o].rawValue)&&(s="#6731AA"),t.createElement("text",{x:a+i/2,y:n-5,fontSize:10,fontWeight:"bold",textAnchor:"middle",fill:s},e.valueFormatter?e.valueFormatter(r):wl(r))}}),d.map(((a,n)=>e.highlight&&e.highlight(a.rawValue)?t.createElement(P1,{fill:"#D8BDF8",key:n}):t.createElement(P1,{fill:"#BBDEFF",key:n}))))))))}A(".mdhui-recent-daily-data-bar-chart {\n position: relative;\n margin-bottom: 48px;\n}\n\n.mdhui-recent-daily-data-bar-chart-title {\n padding: 0 16px;\n}\n\n.mdhui-recent-daily-data-bar-chart-subtitle {\n padding: 0 16px;\n margin-top: 2px;\n font-size: 0.95em;\n}\n\n.mdhui-recent-daily-data-bar-chart-container {\n position: relative;\n margin: 16px 16px 32px;\n padding: 0;\n background: var(--mdhui-background-color-1);\n border-radius: 12px;\n height: 200px;\n}\n\n.mdhui-recent-daily-data-bar-chart .recharts-surface {\n height: 270px !important;\n overflow: visible;\n}\n\n.mdhui-recent-daily-data-bar-chart-no-data-label, .mdhui-recent-daily-data-bar-chart .mdhui-loading-indicator {\n position: absolute;\n width: 120px;\n height: 20px;\n line-height: 20px;\n left: calc(50% - 68px);\n top: calc(50% - 26px);\n border: 1px solid var(--mdhui-border-color-1);\n background: var(--mdhui-background-color-0);\n border-radius: 12px;\n padding: 16px 8px;\n text-align: center;\n color: var(--mdhui-text-color-4);\n z-index: 5000;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.mdhui-recent-daily-data-bar-chart .recharts-cartesian-grid-horizontal line:first-child {\n display: none;\n}");const EAe=o(null);function _Ae(e){const[a,n]=c(),[i,r]=c();id((()=>{(()=>{if("default"===e.previewState)return void n(e.dataTypes);const t=e.dataTypes.map((e=>Jc(e.dailyDataType)));Promise.all(t).then((t=>{n(e.dataTypes.filter(((e,a)=>t[a])))}))})()}),["externalAccountSyncComplete"],[e.dataTypes,e.previewState]);return t.createElement("div",{ref:e.innerRef},!a&&t.createElement(XA,null),a&&t.createElement(EAe.Provider,{value:{dataTypes:a,data:i}},t.createElement(oM,{initialIntervalStart:Rr(),intervalType:"Day",useCustomNavigator:!0},t.createElement(CAe,{loadData:async(t,a)=>{if(!e.dataTypes.length)return Promise.resolve();r(await rd(t,a,e.dataTypes,!!e.previewState))},dayRenderer:n=>{if(!e.dataTypes.length||!a?.length)return null;let r=a.map((e=>{const t=i?.[e.dailyDataType]?.[n],a=t?.relativePercent??0;if(void 0===a)return{color:"var(--mdhui-color-primary)",barFillPercent:0};const r=t?.value??0;let o=e.color||"var(--mdhui-color-primary)";return void 0!==e.threshold&&"30DayAverage"!==e.threshold&&r>e.threshold&&e.overThresholdColor&&(o=e.overThresholdColor),{color:o,barFillPercent:a}}));return t.createElement("div",{style:{paddingTop:"8px"}},t.createElement(mSe,{averageFillPercent:.5,bars:r}))},dependencies:[e.previewState,e.dataTypes]}),i&&e.children)))}function CAe(e){const a=r(rM);return t.createElement(WAe,{selectedDate:a.intervalStart,loadData:e.loadData,dayRenderer:e.dayRenderer,dependencies:e.dependencies})}function TAe(e){let[a,n]=c(void 0),i=r(EAe),o=s(0),l=e.dataTypes||[];e.useContext&&i?.dataTypes&&(l=[...i.dataTypes]);let u=r(rM),d=e.date??u?.intervalStart??vn(new Date);if(id((()=>{!function(){function t(e){if(!e)return;let t={};return l.forEach((a=>{e[a.dailyDataType]?.[Br(d)]?.value&&(t[a.dailyDataType]=e[a.dailyDataType][Br(d)])})),t}if(n(void 0),e.useContext){if(!i?.data)return;return void n(t(i.data))}let a=++o.current;rd(d,d,l,!!e.previewState).then((e=>{a==o.current&&n(t(e))}))}()}),["externalAccountSyncComplete"],[u,i,e.date,e.dataTypes]),!a||!Object.keys(a).length)return null;function h(e,t){if(l.every((e=>void 0===e.threshold)))return;return nu(e.dailyDataType).formatter(t)}return t.createElement("div",{ref:e.innerRef,className:"mdhui-relative-activity"},e.title&&t.createElement(nS,{title:e.title}),l.map((e=>{let n=a[e.dailyDataType];if(!n||void 0===n.threshold||void 0===n.relativePercent)return null;let i=nu(e.dailyDataType),r=e.formatter||i.formatter;return t.createElement("div",{key:e.dailyDataType,className:"mdhui-relative-activity-datatype"},t.createElement(Ya,{className:"mdhui-relative-activity-meter",label:e.label||(i.labelKey?no(i.labelKey):e.dailyDataType),value:r(n.value),fillPercent:n.relativePercent,averageFillPercent:.5,icon:e.icon||i.icon,color:(o=e,s=n.relativePercent,void 0!==o.threshold&&o.overThresholdColor&&s>.5?o.overThresholdColor:o.color||"var(--mdhui-color-primary)"),thresholdLabel:h(e,n.threshold)}));var o,s})),l.every((e=>void 0===e.threshold))&&t.createElement("div",{className:"mdhui-relative-activity-average-marker"},t.createElement("div",null,t.createElement(Ne,{icon:O})),no("30-day-average")))}function PAe(e){return t.createElement(TAe,{date:vn(new Date),dataTypes:e.dataTypes,previewState:e.previewState,title:e.title,innerRef:e.innerRef})}A(".mdhui-relative-activity .mdhui-relative-activity-datatype {\n position: relative;\n}\n\n.mdhui-relative-activity .mdhui-relative-activity-meter {\n margin: 16px;\n}\n\n.mdhui-relative-activity .mdhui-relative-activity-average-marker {\n text-align: center;\n margin: 16px;\n font-size: .7em;\n margin-bottom: 16px;\n color: var(--mdhui-text-color-2);\n}");function OAe(e){const[a,n]=c(!1),[i,r]=c({});var o=new Date(e.year,e.month,1,0,0,0,0),s=cn(o,{months:1});function u(){var t,a;"NoData"!==e.showPreviewData&&("Loading"!==e.showPreviewData?(n(!0),(t=e.dataTypeSource,a=Hr.RestingHeartRate,"AppleHealth"==t&&(a=Hr.AppleHealthRestingHeartRate),"Fitbit"==t&&(a=Hr.FitbitRestingHeartRate),"Garmin"==t&&(a=Hr.GarminRestingHeartRate),"HealthConnect"==t&&(a=Hr.HealthConnectRestingHeartRate),eu(a,o,s,void 0!==e.showPreviewData).then((function(e){r(e)}))).then((()=>n(!1)))):n(!0))}return l((()=>(u(),w.on("applicationDidBecomeVisible",u),w.on("externalAccountSyncComplete",u),()=>{w.off("applicationDidBecomeVisible",u),w.off("externalAccountSyncComplete",u)})),[e]),t.createElement("div",{ref:e.innerRef},a&&t.createElement(XA,null),!a&&t.createElement(JA,{year:e.year,month:e.month,dayRenderer:function(e,a,n){const r=function(e,t,a){if(void 0!==a){var n=Br(new Date(e,t,a));return i[n]}}(e,a,n);return void 0!==n?t.createElement("div",{className:"mdhui-calendar-day-with-data-value"},t.createElement("div",{className:"calendar-value"},r),t.createElement("div",{className:"calendar-day"},n)):t.createElement("div",null)}}))}async function MAe(e,t,a,n,i){var r=await Kc(Br(e)+t);return{id:"00000000-0000-0000-0000-000000000000",surveyID:"00000000-0000-0000-0000-000000000000",surveyResultID:"00000000-0000-0000-0000-000000000000",surveyVersion:0,surveyName:a,surveyDisplayName:a,date:e.toISOString(),stepIdentifier:t,resultIdentifier:t,answers:[(r%(i-n)+n).toString()],insertedDate:e.toISOString()}}A(".mdhui-calendar-day-with-data-value .calendar-value {\n\theight: 32px;\n\twidth: 32px;\n\tfont-size: 12px;\n\tborder-radius: 17px;\n\tline-height: 34px;\n\ttext-align: center;\n\tbackground: var(--mdhui-background-color-1);\n\tfont-weight: bold;\n\tdisplay: inline-block;\n}\n\n.mdhui-calendar-day-with-data-value .calendar-day {\n\ttext-align: center;\n}");function DAe(e){let[a,n]=c(null);const i=r(rM);let o,s=e.intervalType||"Month";i?(s="Day"===i.intervalType?"Week":i.intervalType,o=i.intervalStart):o=lu(s,e.weekStartsOn);let l="Week"===s?cn(o,{days:7}):"Month"===s?cn(o,{months:1}):"6Month"===s?cn(o,{months:6}):o;const u=()=>{if(n(null),e.previewDataProvider)e.previewDataProvider(o,l).then((e=>{n(e)}));else if(e.previewState)(async(e,t,a,n)=>{const i=[];a.forEach((e=>i.push([])));let r=new Date(e);for(;r<t;){for(let e=0;e<a.length;++e){var o=await MAe(r,"TestResult"+e,"TestSurvey",10,100);i[e].push(o)}r=cn(r,n)}return i})(o,l,e.series,e.expectedDataInterval||{days:1}).then((e=>{n(e)}));else{var t=e.series.map((e=>{var t={after:o.toISOString(),before:l.toISOString()};return e.surveyName&&(t.surveyName=e.surveyName),e.resultIdentifier&&(t.resultIdentifier=e.resultIdentifier),e.stepIdentifier&&(t.stepIdentifier=e.stepIdentifier),hu(t)}));Promise.all(t).then((e=>{n(e)}))}};function d(e){return`${e.surveyName}-${e.stepIdentifier}-${e.resultIdentifier}`}id((()=>{u()}),[],[e.intervalType,e.weekStartsOn,i]);let h=function(t){for(var a={},n=0;n<e.series.length;n++)a[d(e.series[n])]=t[n]?.sort(((e,t)=>xn(Tr(e.date),Tr(t.date))))||[];return a}(a||[]);var m=void 0,p=!1;null!==h&&(m=[],e.series.forEach((e=>{var t=d(e);h[t].forEach((t=>{var a=Tr(t.date);a.setHours(0,0,0,0);var n=m.find((e=>e.timestamp===a.getTime()));n||(n={timestamp:a.getTime()},m.push(n)),n[e.dataKey]=parseFloat(t.answers[0]),p=!0}))})),m.sort(((e,t)=>e.timestamp-t.timestamp)));return t.createElement(Rue,{title:e.title,intervalType:s,intervalStart:o,data:m,expectedDataInterval:e.expectedDataInterval,series:e.series.map((e=>{const t={dataKey:e.dataKey,color:e.color};return"areaColor"in e&&(t.areaColor=e.areaColor),t})),chartHasData:p,tooltip:({active:a,payload:n})=>{function i(t,a){return t.stroke||function(t,a){var n=e.options?e.options[a]:null;return n?Array.isArray(n)?n[t]:n:"var(--mdhui-color-primary)"}(a,"barColor")}return a&&n&&n.length?1===n.length?t.createElement("div",{className:"mdhui-time-series-tooltip"},t.createElement("div",{className:"mdhui-single-value-tooltip-value"},wl(parseFloat(n[0].value),2)),t.createElement("div",{className:"mdhui-time-series-tooltip-date"},ll(new Date(n[0].payload.timestamp)))):t.createElement("div",{className:"mdhui-time-series-tooltip"},t.createElement("table",{className:"mdhui-multiple-value-tooltip"},t.createElement("tbody",null,n.map(((e,a)=>t.createElement("tr",{key:e.dataKey},t.createElement("th",{style:{color:i(e,a)}},e.dataKey),t.createElement("td",null,wl(parseFloat(e.value),2))))))),t.createElement("div",{className:"mdhui-time-series-tooltip-date"},ll(new Date(n[0].payload.timestamp)))):null},chartType:e.chartType,options:e.options,innerRef:e.innerRef})}A(".mdhui-survey-task-list .mdhui-single-survey-task {\n border-bottom: solid 1px var(--mdhui-border-color-0);\n}\n\n.mdhui-survey-task-list .mdhui-single-survey-task:last-child {\n border: none;\n}\n\n.mdhui-survey-task-list .title {\n font-weight: bold;\n padding: 16px;\n padding-bottom: 0;\n}\n\n.mdhui-survey-task-list .empty-message {\n padding: 16px;\n font-size: .88em;\n}");var IAe=[{id:"ecf8a7df-caa3-ec11-aaab-f47bb6835a10",surveyID:"53ad3e98-9777-ec11-aaa8-89aad5fbf200",surveyName:"Mood Survey",surveyDisplayName:"Mood Survey",surveyDescription:"3 minutes",status:"incomplete",hasSavedProgress:!1,dueDate:cn(new Date,{days:-1}).toISOString(),insertedDate:"2022-03-14T19:13:48.283Z",modifiedDate:"2022-03-14T19:13:48.283Z",linkIdentifier:"1"},{id:"e7f8a7df-caa3-ec11-aaab-f47bb6835a10",surveyID:"53ad3e98-9777-ec11-aaa8-89aad5fbf200",surveyName:"Pregnancy (Followup)",surveyDisplayName:"Pregnancy: Followup",surveyDescription:"3 minutes",status:"incomplete",hasSavedProgress:!0,dueDate:cn(new Date,{days:0}).toISOString(),insertedDate:"2022-03-14T19:13:48.283Z",modifiedDate:"2022-03-14T19:13:48.283Z",linkIdentifier:"1"},{id:"2c9ab4d9-80a4-ec11-aaab-f47bb6835a11",surveyID:"a7f58ba8-9777-ec11-aaa8-89aad5fbf200",surveyName:"Rating: CheckIn",surveyDisplayName:"Let us know how we're doing",surveyDescription:"10 minutes",status:"incomplete",hasSavedProgress:!1,dueDate:void 0,insertedDate:"2022-03-15T16:56:26.703Z",modifiedDate:"2022-03-15T16:56:26.703Z",linkIdentifier:"1"},{id:"b1c9bcd2-80a4-ec11-aaab-f47bb6835a10",surveyID:"cd452353-7674-ec11-aaa8-89aad5fbf200",surveyName:"Alcohol and Tobacco",surveyDisplayName:"Alcohol and Tobacco",surveyDescription:"5 minutes",status:"incomplete",hasSavedProgress:!1,dueDate:cn(new Date,{days:1}).toISOString(),insertedDate:"2022-03-15T16:56:15.007Z",modifiedDate:"2022-03-15T16:56:15.007Z",linkIdentifier:"1"},{id:"2c9ab4d9-80a4-ec11-aaab-f47bb6835a10",surveyID:"a7f58ba8-9777-ec11-aaa8-89aad5fbf200",surveyName:"SDOH: Followup",surveyDisplayName:"Social Determinants of Health: Followup",surveyDescription:"5 minutes",status:"incomplete",hasSavedProgress:!1,dueDate:cn(new Date,{days:10}).toISOString(),insertedDate:"2022-03-15T16:56:26.703Z",modifiedDate:"2022-03-15T16:56:26.703Z",linkIdentifier:"1"},{id:"2c9ab4d9-80a4-ec11-aaab-f47bb6835a12",surveyID:"a7f58ba8-9777-ec11-aaa8-89aad5fbf200",surveyName:"Rating2: CheckIn",surveyDisplayName:"Rate Later",surveyDescription:"10 minutes",status:"incomplete",hasSavedProgress:!1,dueDate:cn(new Date,{years:10}).toISOString(),insertedDate:"2022-03-15T16:56:26.703Z",modifiedDate:"2022-03-15T16:56:26.703Z",linkIdentifier:"1"}],NAe=[{id:"2c9ab4d9-80a4-ec11-aaab-f47bb6835a10",surveyID:"a7f58ba8-9777-ec11-aaa8-89aad5fbf200",surveyName:"SDOH: Followup",surveyDisplayName:"Social Determinants of Health: Followup",surveyDescription:"5 minutes",status:"complete",endDate:(new Date).toISOString(),hasSavedProgress:!1,dueDate:cn(new Date,{days:10}).toISOString(),insertedDate:"2022-03-15T16:56:26.703Z",modifiedDate:"2022-03-15T16:56:26.703Z",linkIdentifier:"1"},{id:"b1c9bcd2-80a4-ec11-aaab-f47bb6835a10",surveyID:"cd452353-7674-ec11-aaa8-89aad5fbf200",surveyName:"Alcohol and Tobacco",surveyDisplayName:"Alcohol and Tobacco",surveyDescription:"5 minutes",status:"complete",hasSavedProgress:!1,endDate:cn(new Date,{days:-1}).toISOString(),dueDate:cn(new Date,{days:10}).toISOString(),insertedDate:"2022-03-15T16:56:15.007Z",modifiedDate:"2022-03-15T16:56:15.007Z",linkIdentifier:"1"},{id:"e7f8a7df-caa3-ec11-aaab-f47bb6835a10",surveyID:"53ad3e98-9777-ec11-aaa8-89aad5fbf200",surveyName:"Pregnancy (Followup)",surveyDisplayName:"Pregnancy: Followup",surveyDescription:"3 minutes",status:"complete",hasSavedProgress:!1,endDate:cn(new Date,{days:-2}).toISOString(),dueDate:cn(new Date,{days:10}).toISOString(),insertedDate:"2022-03-14T19:13:48.283Z",modifiedDate:"2022-03-14T19:13:48.283Z",linkIdentifier:"1"}];function jAe(e){const[a,n]=c(!0),[i,o]=c(null),[s,l]=c([]),u=r(Ga),d=e=>{o(e),l([])};id((function(){var t=function(e,t){return e.dueDate?t.dueDate?Tr(e.dueDate)>Tr(t.dueDate)?1:Tr(e.dueDate)<Tr(t.dueDate)?-1:0:-1:1};if("IncompleteTasks"==e.previewState)return IAe.sort(t),void d(IAe);if("CompleteTasks"==e.previewState)return void d(NAe);if("Empty"==e.previewState)return d([]),void n(!1);a=[],i=function(r){var o={status:e.status};return e.surveys&&(o.surveyName=e.surveys),e.category&&(o.surveyCategory=e.category),r&&(o.pageID=r),w.querySurveyTasks(o).then((function(r){a=a.concat(r.surveyTasks),r.nextPageID?i(r.nextPageID):("incomplete"==e.status&&a.sort(t),"complete"==e.status&&a.sort(((e,t)=>e.endDate&&t.endDate?Tr(e.endDate)>Tr(t.endDate)?-1:Tr(e.endDate)<Tr(t.endDate)?1:0:0)),d(a),n(!1))}))},i(null);var a,i}),[],[e.previewState]);const h=e=>s.includes(e.surveyName),m=t=>e.sequential&&i[0].id!==t.id;function p(a){return t.createElement(hSe,{buttonColor:e.buttonColor,buttonVariant:e.buttonVariant,key:a.id.toString(),task:a,onClick:()=>(t=>{e.previewState||h(t)||(l([...s,t.surveyName]),w.startSurvey(t.surveyName))})(a),surveyActive:h(a),surveyBlocked:m(a)})}const{hideIfEmpty:g}=e,f="complete"==e.status?g??!0:g;if(!i?.length&&f)return null;let y=e.variant??"noCard";return t.createElement(zAe,{cardStyle:e.cardStyle,cardBackgroundColor:e.cardBackgroundColor,innerRef:e.innerRef,card:"singleCard"==y},t.createElement("div",{className:"mdhui-survey-task-list"},e.title&&t.createElement(nS,{color:e.titleColor,title:e.title,detailLinkText:e.onDetailLinkClick?no("view-all")+" ("+(i?.length??0)+")":void 0,onDetailClick:e.onDetailLinkClick}),a&&!i&&t.createElement(XA,null),!i?.length&&!a&&t.createElement("div",{className:"empty-message"},e.emptyText?.trim()||no(`empty-tasks-${e.status}`)),i?.slice(0,e.limit).map((a=>"multiCard"==y?t.createElement(aS,{style:e.cardStyle,backgroundColor:je(u.colorScheme,e.cardBackgroundColor),key:a.id},p(a)):p(a)))))}function zAe(e){const a=r(Ga);return e.card?t.createElement(aS,{style:e.cardStyle,backgroundColor:je(a.colorScheme,e.cardBackgroundColor),innerRef:e.innerRef},e.children):t.createElement("div",{ref:e.innerRef},e.children)}var RAe=new Date;const LAe=[{id:"12345",surveyResultID:"1",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityValue",answers:["severe"],insertedDate:Date.now.toString()},{id:"123456",surveyResultID:"1",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityDate",answers:[Rr().toISOString()],insertedDate:Date.now.toString()},{id:"123452",surveyResultID:"21",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityValue",answers:["severity3"],insertedDate:Date.now.toString()},{id:"12223456",surveyResultID:"21",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityDate",answers:[vn(sn(RAe,-1)).toISOString()],insertedDate:Date.now.toString()},{id:"123457",surveyResultID:"2",surveyID:"1",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityValue",answers:["moderate"],insertedDate:Date.now.toString()},{id:"123458",surveyResultID:"2",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityDate",answers:[vn(sn(RAe,-2)).toISOString()],insertedDate:Date.now.toString()},{id:"1234573",surveyResultID:"3",surveyID:"1",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityValue",answers:["severity2"],insertedDate:Date.now.toString()},{id:"1234583",surveyResultID:"3",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityDate",answers:[vn(sn(RAe,-3)).toISOString()],insertedDate:Date.now.toString()},{id:"14234573",surveyResultID:"4",surveyID:"1",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityValue",answers:["moderate"],insertedDate:Date.now.toString()},{id:"12345834",surveyResultID:"4",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityDate",answers:[vn(sn(RAe,-4)).toISOString()],insertedDate:Date.now.toString()},{id:"142345736",surveyResultID:"5",surveyID:"1",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityValue",answers:["mild"],insertedDate:Date.now.toString()},{id:"1234583466",surveyResultID:"5",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityDate",answers:[vn(sn(RAe,-5)).toISOString()],insertedDate:Date.now.toString()},{id:"1423457376",surveyResultID:"6",surveyID:"1",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityValue",answers:["severity1"],insertedDate:Date.now.toString()},{id:"1234583466",surveyResultID:"6",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityDate",answers:[vn(sn(RAe,-6)).toISOString()],insertedDate:Date.now.toString()},{id:"12374597",surveyResultID:"7",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:vn(sn(RAe,-7)).toISOString(),stepIdentifier:"1",resultIdentifier:"severityValue",answers:["mild"],insertedDate:Date.now.toString()},{id:"123874598",surveyResultID:"8",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:vn(sn(RAe,-8)).toISOString(),stepIdentifier:"1",resultIdentifier:"severityValue",answers:["severe"],insertedDate:Date.now.toString()},{id:"1238745998",surveyResultID:"9",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:Pn(sn(RAe,-8)).toISOString(),stepIdentifier:"1",resultIdentifier:"severityValue",answers:["mild"],insertedDate:Date.now.toString()},{id:"10234583466",surveyResultID:"10",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityDate",answers:[Pn(sn(RAe,-9)).toISOString()],insertedDate:Date.now.toString()},{id:"1237459710",surveyResultID:"10",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityValue",answers:["mild"],insertedDate:Date.now.toString()},{id:"10234583466",surveyResultID:"11",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityDate",answers:[vn(sn(RAe,-9)).toISOString()],insertedDate:Date.now.toString()},{id:"1237459710",surveyResultID:"11",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:RAe.toISOString(),stepIdentifier:"1",resultIdentifier:"severityValue",answers:["severe"],insertedDate:Date.now.toString()},{id:"12387459988",surveyResultID:"12",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:Pn(sn(RAe,-10)).toISOString(),stepIdentifier:"1",resultIdentifier:"severityValue",answers:["severe"],insertedDate:Date.now.toString()},{id:"102345834898",surveyResultID:"12",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:Pn(sn(RAe,-10)).toISOString(),stepIdentifier:"1",resultIdentifier:"severityDate",answers:[Pn(sn(RAe,-10)).toISOString()],insertedDate:Date.now.toString()},{id:"123745971013",surveyResultID:"13",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:vn(sn(RAe,-10)).toISOString(),stepIdentifier:"1",resultIdentifier:"severityValue",answers:["moderate"],insertedDate:Date.now.toString()},{id:"1023458346613",surveyResultID:"13",surveyID:"2",surveyVersion:1,surveyName:"Survey 1",surveyDisplayName:"test",date:vn(sn(RAe,-10)).toISOString(),stepIdentifier:"1",resultIdentifier:"severityDate",answers:[Pn(sn(RAe,-10)).toISOString()],insertedDate:Date.now.toString()}];function FAe(e){const a={surveyName:e.surveyName,resultIdentifier:e.dateRecordedResultIdentifier?[e.dateRecordedResultIdentifier,e.severityResultIdentifier]:[e.severityResultIdentifier]},[n,i]=c(),o=r(rM);let s=o?.intervalStart??e.intervalStart??In(new Date);function l(t){var a=new Map,n=function(t){var a=new Map;return t.forEach((t=>{var n=a.get(t.surveyResultID)??{dateObservedAnswer:void 0,severityAnswer:void 0};t.answers&&""!==t.answers[0]&&(t.resultIdentifier===e.severityResultIdentifier?n.severityAnswer=t:t.resultIdentifier===e.dateRecordedResultIdentifier&&(n.dateObservedAnswer=t),a.set(t.surveyResultID,n))})),a}(t);const r=e.severityValueMapper??function(e){let t="";return["mild","moderate","severe"].includes(e.toLowerCase())&&(t=e.toLowerCase()),t};n.forEach((e=>{if(e.severityAnswer){var t=r(e.severityAnswer.answers[0]);if(t){let n=Tr(e.dateObservedAnswer?e.dateObservedAnswer.answers[0]:e.severityAnswer.date),i=ll(vn(n)),r=a.get(i);r?e.severityAnswer.date>r.dateEntered&&(r.dateObserved=n,r.severity=t,r.dateEntered=e.severityAnswer.date):a.set(i,{dateObserved:n,severity:t,dateEntered:e.severityAnswer.date})}}})),i(a)}const u={mild:{style:{background:"#F7DA19"},streak:!0,streakColor:"#FDEF97"},moderate:{style:{background:"var(--mdhui-color-warning)"},streak:!0,streakColor:"#FCCCC7"},severe:{style:{background:"var(--mdhui-color-danger)"},streak:!0,streakColor:"#FCCCC7"}},d=e=>{let t=ll(vn(e));return n?.get(t)?.severity??""},h=(e,a,n)=>t.createElement(eS,{year:e,month:a,day:n,stateConfiguration:u,computeStateForDay:d});return id((async function(){e.previewState?l("Default"===e.previewState?LAe:[]):hu(a).then((e=>{l(e)}))}),[],[e.previewState]),n?t.createElement(JA,{innerRef:e.innerRef,className:"mdhui-simple-calendar",year:s.getFullYear(),month:s.getMonth(),dayRenderer:h}):t.createElement(XA,{innerRef:e.innerRef})}function BAe(e){const a=r(rM),n=a?.intervalStart??Rr(),[i,o]=c(!0),[s,l]=c();id((()=>{if(o(!0),"loading"!==e.previewState)return e.previewState?(l("with data"===e.previewState?Math.floor(7*Math.random()):void 0),void o(!1)):void Nd(n).then((e=>{l(e),o(!1)}))}),[],[e.previewState,a?.intervalStart]);return t.createElement("div",{className:"mdhui-stress-level",ref:e.innerRef},t.createElement("div",{className:"mdhui-stress-level-title"},no("stress-level-title")),i&&t.createElement(XA,null),!i&&t.createElement(dM,{tickCount:7,minLabel:no("stress-level-min-label"),maxLabel:no("stress-level-max-label"),value:s,onChange:t=>(t=>{l(t),e.previewState||(t?jd(n,t):zd(n))})(t),sliderColor:"#d36540"}))}A(".mdhui-stress-level {\n padding: 16px 0 0;\n}\n\n.mdhui-stress-level-title {\n text-transform: uppercase;\n margin: 0 16px;\n font-size: 0.65em;\n}\n\n.mdhui-stress-level .mdhui-loading-indicator {\n padding: 16px 16px 32px;\n}");let HAe=[{Title:"Rapid Tests",Link:"https://medlineplus.gov/lab-tests/rapid-tests?utm_source=mplusconnect&utm_medium=service",Summary:'\n<h2>What are rapid tests?</h2>\n<p>Rapid tests, also known as rapid diagnostic tests or RDTs, are easy-to-use tests that provide quick results, usually in 20 minutes or less. Unlike most standard tests, which have to be sent to a lab, rapid tests are done and provide results at the point of care. The point of care is the place where you are getting care. It can include your provider\'s office, a clinic, or even your own home.</p>\n<p>Rapids tests usually include the following steps:</p>\n<ul>\n<li>You will provide a sample of your body fluid, such as <a data-tid="6037" href="https://medlineplus.gov/blood.html">blood</a>, urine, saliva, or nasal secretions.</li>\n<li>The sample is mixed with a special substance that will cause a chemical reaction if a disease or other condition is present.</li>\n<li>Results will show on a dipstick or rapid test cassette.\n<ul>\n<li>A dipstick is a thin, plastic strip that\'s coated with chemicals. If the test is positive, the dipstick will change colors when placed in the sample.</li>\n<li>A rapid test cassette is a small, plastic case that has a well that holds the sample. The well will show a letter or a symbol to indicate the result.</li>\n</ul>\n</li>\n</ul>\n<p>Most rapid tests are highly accurate, but the results are not always as accurate as standard lab tests. </p>\n<p>Other names: rapid diagnostic tests, RDT\'s point-of-care tests</p><h2>How are they used?</h2>\n<p>Rapid tests are most often used to diagnose <a data-tid="513" href="https://medlineplus.gov/infectiousdiseases.html">infectious diseases</a>, including:</p>\n<ul>\n<li><a data-tid="299" href="https://medlineplus.gov/flu.html">Flu</a></li>\n<li><a data-tid="421" href="https://medlineplus.gov/streptococcalinfections.html">Strep throat</a></li>\n<li><a data-tid="315" href="https://medlineplus.gov/malaria.html">Malaria</a></li>\n<li><a data-tid="1" href="https://medlineplus.gov/hivaids.html">HIV</a></li>\n<li><a data-tid="3181" href="https://medlineplus.gov/covid19coronavirusdisease2019.html">COVID 19</a>. <a data-tid="7627" href="https://medlineplus.gov/covid19testing.html">Rapid tests for COVID-19</a> usually provide results in about 30 minutes.</li>\n</ul>\n<p>Rapid tests are also used in certain <a data-pid="31381" href="https://medlineplus.gov/lab-tests/at-home-medical-tests/">home-based tests</a>, such as pregnancy tests.</p><h2>What are the advantages and disadvantages of rapid tests?</h2>\n<p>The advantages of rapid tests include:</p>\n<ul>\n<li><strong>Fast results.</strong> This may allow you to get treatment faster. Faster treatment can reduce the severity of your symptoms, and may help prevent the spread of disease</li>\n<li><strong>Easy to use.</strong> They can be done by non-medical workers and volunteers who have been trained to do the test. You may even be able to perform a rapid test on yourself.</li>\n<li><strong>Little or no special equipment required.</strong> This is especially useful in areas with limited resources or access to specialized labs.</li>\n</ul>\n<p>Disadvantages of rapid tests:</p>\n<ul>\n<li><strong>Lower sensitivity than lab tests.</strong> Sensitivity means how well a test can identify a disease or condition. Rapid tests are not as good as lab tests at finding diseases in the earliest stages of infection.</li>\n<li><strong>False negatives are more common.</strong> A false negative result means your test shows you don\'t have a disease or condition, but you actually do have it.</li>\n</ul>\n<p>Providers will often take a second sample and send it to a lab for testing to confirm or rule out the results of a rapid test. But you may be able to get treatment and help prevent the spread of disease while you wait for lab results.</p><h2>Is there anything else I need to know about rapid tests?</h2>\n<p>Home based rapid tests are available for COVID-19. Like other rapid tests, the rapid COVID-19 tests have lower sensitivity than standard lab tests. But getting fast, home-based results may help prevent the spread of disease. Talk to your health care provider to learn more about these home-based tests.</p><h2>References</h2>\n<ol>\n<li>Centers for Disease Control and Prevention [Internet]. Atlanta: U.S. Department of Health and Human Services; Influenza (Flu): Rapid Influenza Diagnostic Tests; [cited 2021 Jan 26]; [about 5 screens]. Available from: <a href="https://www.cdc.gov/flu/professionals/diagnosis/clinician_guidance_ridt.htm" target="bibliowin">https://www.cdc.gov/flu/professionals/diagnosis/clinician_guidance_ridt.htm</a></li>\n<li>Centers for Disease Control and Prevention [Internet]. Atlanta: U.S. Department of Health and Human Services; Malaria: Rapid Diagnostic Tests: How They Work; [cited 2021 Jan 26]; [about 5 screens]. Available from: <a href="https://www.cdc.gov/malaria/malaria_worldwide/reduction/dx_rdt.html" target="bibliowin">https://www.cdc.gov/malaria/malaria_worldwide/reduction/dx_rdt.html</a></li>\n<li>Emory University [Internet]. Atlanta: Emory University; c2020. What is Rapid Diagnostic Test (RDT)?; [cited 2021 Jan 26]; [about 3 screens]. Available from: <a href="http://www.globalhealthprimer.emory.edu/targets-technologies/rapid-diagnostic-test.html" target="bibliowin">http://www.globalhealthprimer.emory.edu/targets-technologies/rapid-diagnostic-test.html</a></li>\n<li>FDA: U.S. Food and Drug Administration [Internet]. Silver Spring (MD): U.S. Department of Health and Human Services; Coronavirus (COVID-19) Update: FDA Authorizes Antigen Test as First Over-the-Counter Fully At-Home Diagnostic Test for COVID-19; 2020 Dec 15 [cited 2021 Jan 26]; [about 3 screens]. Available from: <a href="https://www.fda.gov/news-events/press-announcements/coronavirus-covid-19-update-fda-authorizes-antigen-test-first-over-counter-fully-home-diagnostic" target="bibliowin">https://www.fda.gov/news-events/press-announcements/coronavirus-covid-19-update-fda-authorizes-antigen-test-first-over-counter-fully-home-diagnostic</a></li>\n<li>FDA: U.S. Food and Drug Administration [Internet]. Silver Spring (MD): U.S. Department of Health and Human Services; Coronavirus (COVID-19) Update: FDA Issued Emergency Use Authorization for Point of Care Antigen Test; 2020 Jul 6 [cited 2021 Jan 26]; [about 3 screens]. Available from: <a href="https://www.fda.gov/news-events/press-announcements/coronavirus-covid-19-update-fda-issued-emergency-use-authorization-point-care-antigen-test" target="bibliowin">https://www.fda.gov/news-events/press-announcements/coronavirus-covid-19-update-fda-issued-emergency-use-authorization-point-care-antigen-test</a></li>\n<li>GoodRx [Internet]. GoodRx, Inc., c2011–2021. COVID-19 Rapid Tests: Accuracy, Types, and Where to Find Them; 2020 Nov 10 [cited 2021 Jan 26]; [about 3 screens]. Available from: <a href="https://www.goodrx.com/blog/covid-19-rapid-test" target="bibliowin">https://www.goodrx.com/blog/covid-19-rapid-test</a></li>\n<li>Harvard Health Publishing: Harvard Medical School [Internet]. Boston: Harvard University; 2010–2021. Rapid Strep Test; 2019 Dec [cited 2021 Jan 26]; [about 4 screens]. Available from: <a href="https://www.health.harvard.edu/diseases-and-conditions/rapid-strep-test" target="bibliowin">https://www.health.harvard.edu/diseases-and-conditions/rapid-strep-test</a></li>\n<li>Mayo Clinic [Internet]. Mayo Foundation for Medical Education and Research; c1998–2021. COVID-19 Diagnostic testing: Overview; 2021 Jan 15 [cited 2021 Jan 26]; [about 3 screens]. Available from: <a href="https://www.mayoclinic.org/tests-procedures/covid-19-diagnostic-test/about/pac-20488900" target="bibliowin">https://www.mayoclinic.org/tests-procedures/covid-19-diagnostic-test/about/pac-20488900</a></li>\n<li>Mayo Clinic [Internet]. Mayo Foundation for Medical Education and Research; c1998–2021. Urinalysis: Overview; 2019 Oct 23 [cited 2021 Jan 26]; [about 3 screens]. Available from: <a href="https://www.mayoclinic.org/tests-procedures/urinalysis/about/pac-20384907" target="bibliowin">https://www.mayoclinic.org/tests-procedures/urinalysis/about/pac-20384907</a></li>\n<li>Poole S, Townsend J, Wertheim H, Kidd SP, Welte T, Schuetz P, Luyt CE, Beishuizen A, Jensen JS, Del Castillo JG, Plebani M, Saeed K. How are rapid diagnostic tests for infectious diseases used in clinical practice: a global survey by the International Society of Antimicrobial Chemotherapy (ISAC). Eur J Clin Microbiol Infect Dis [Internet]. 2021 Feb; [cited 2021 Jan 26]; 40(2):429–434. Available from: <a href="https://pubmed.ncbi.nlm.nih.gov/32902760" target="bibliowin">https://pubmed.ncbi.nlm.nih.gov/32902760</a></li>\n<li>P.vivax information hub [Internet]. Medicines for Malaria Venture; Rapid Diagnostic Tests (RDTs); [cited 2021 Jan 26]; [about 3 screens]. Available from: <a href="https://www.vivaxmalaria.org/diagnosis-treatment/diagnostic-methods/rapid-diagnostic-tests-rdts" target="bibliowin">https://www.vivaxmalaria.org/diagnosis-treatment/diagnostic-methods/rapid-diagnostic-tests-rdts</a></li>\n<li>ResearchGate [Internet]. ResearchGate GmbH; c2008–2021. Example of RDT Cassettes; [cited 2021 Jan 26]; [about 3 screens]. Available from: <a href="https://www.researchgate.net/figure/Example-of-RDT-cassettes-Most-of-the-cassettes-have-separated-wells-for-sample-and_fig2_49830148" target="bibliowin">https://www.researchgate.net/figure/Example-of-RDT-cassettes-Most-of-the-cassettes-have-separated-wells-for-sample-and_fig2_49830148</a></li>\n<li>Very Well Health [Internet]. New York: About, Inc.; c2021. An Overview of Specificity and Sensitivity; [updated 2020 Sep 27; cited 2021 Jan 26]; [about 3 screens]. Available from: <a href="https://www.verywellhealth.com/sensitivity-and-specificity-in-medical-testing-overview-4777799" target="bibliowin">https://www.verywellhealth.com/sensitivity-and-specificity-in-medical-testing-overview-4777799</a></li>\n<li>Very Well Health [Internet]. New York: About, Inc.; c2021. Why Your Rapid Flu Test Was Negative; [updated 2020 Apr 2; cited 2021 Jan 26]; [about 3 screens]. Available from: <a href="https://www.verywellhealth.com/why-was-my-flu-test-negative-770309" target="bibliowin">https://www.verywellhealth.com/why-was-my-flu-test-negative-770309</a></li>\n<li>World Health Organization [Internet]. Geneva (SUI): World Health Organization; c2021. Advice on the use of point-of-care immunodiagnostic tests for COVID-19; 2020 Apr 8 [cited 2021 Jan 26]; [about 4 screens]. Available from: <a href="https://www.who.int/news-room/commentaries/detail/advice-on-the-use-of-point-of-care-immunodiagnostic-tests-for-covid-19#" target="bibliowin">https://www.who.int/news-room/commentaries/detail/advice-on-the-use-of-point-of-care-immunodiagnostic-tests-for-covid-19#</a></li>\n<li>World Health Organization [Internet]. Geneva (SUI): World Health Organization; c2021. Simple/Rapid Tests; 2014 Jun 27 [cited 2021 Jan 26]; [about 3 screens]. Available from: <a href="https://www.who.int/news-room/q-a-detail/simple-rapid-tests" target="bibliowin">https://www.who.int/news-room/q-a-detail/simple-rapid-tests</a></li>\n</ol>\n\n'},{Title:"COVID-19 Testing",Link:"https://medlineplus.gov/covid19testing.html?utm_source=mplusconnect&utm_medium=service",Summary:'\n<p><a href="https://medlineplus.gov/covid19coronavirusdisease2019.html?utm_source=mplusconnect">COVID-19</a> (coronavirus disease 2019) is a disease caused by a virus called SARS-CoV-2. There are two types of tests for this virus:</p>\n<ul>\n<li>A <strong>viral test</strong> tells you if you have a current infection. Viral tests can either be rapid tests or laboratory tests:\n <ul>\n <li><a href="https://medlineplus.gov/lab-tests/rapid-tests/">Rapid tests</a> can be done in minutes. They are often antigen tests, which look for specific proteins from the virus. Some rapid tests are self-tests which you can do at home.</li> \n <li>Laboratory tests can take days to complete and include <a href="https://medlineplus.gov/lab-tests/pcr-tests/">PCR tests</a>.</li>\n </ul>\n</li>\n<li>An <strong>antibody (serology) test</strong> might tell you if you had a past infection.</li>\n</ul>\n\n<p>If you need a COVID-19 test, you can:</p>\n<ul>\n<li>Buy a self-test online or at a store. Make sure that the test you buy has been authorized by the U.S. Food and Drug Administration (FDA).</li>\n<li>Check your state or local health department\'s website for information on testing in your area.</li>\n<li>Contact your health care provider.</li>\n<li>Order free self-tests from <a href="https://www.covid.gov/tests">COVID.gov</a> for your household, if you live in the U.S. The tests are from the U.S. government.\n</li></ul>\n\n<p>Even if your COVID-19 viral test is negative (the test did not detect the virus), you should still take steps to <a href="https://www.cdc.gov/coronavirus/2019-ncov/prevent-getting-sick/prevention.html">protect yourself and others</a>.</p>\n\n<p class="NLMattribution"> Centers for Disease Control and Prevention</p>\n\n'}];function qAe(e){const[a,n]=c(!0),[i,r]=c(null);return id((function(){if("default"==e.previewState)return r(HAe),void n(!1);if("noData"==e.previewState)return r([]),void n(!1);let t="";return e.labObservationID?t=new URLSearchParams({LabObservationID:e.labObservationID}).toString():e.term&&(t=new URLSearchParams(e.term).toString()),w.invokeCustomApi("HealthAndWellnessApi.TermInformation","GET",t,!0).then((function(e){r(e),n(!1)}))}),[],[e.labObservationID,e.term]),a?t.createElement(XA,null):t.createElement("div",{className:"mdhui-term-information"},0==i?.length&&t.createElement(t.Fragment,null,t.createElement(sM,{order:4,defaultMargin:!0},no("term-information-not-found-header")),t.createElement($q,null,no("term-information-not-found-body"))),i&&i?.length>0&&t.createElement($q,{className:"mdhui-term-information-disclaimer"},t.createElement("div",{dangerouslySetInnerHTML:{__html:no("term-information-disclaimer")}})),i?.map(((a,n)=>t.createElement(aS,{key:n},t.createElement(sM,{order:3,defaultMargin:!0},a.Title),t.createElement($q,{className:"mdhui-term-information-html"},function(a){let n=tM(a,{replace:a=>{let n=a;if("a"===n.name){let a=function(t){e.openLinksInNewWindow||(w.openEmbeddedUrl(n.attribs.href),t.preventDefault())};return t.createElement("a",{href:n.attribs.href,target:"_blank",onClick:e=>a(e)},n.children[0].data)}return n}});return n}(a.Summary)),t.createElement($q,null,t.createElement("a",{href:a.Link,target:"_blank"},no("term-information-view-on-medline")))))))}A(".mdhui-term-information .mdhui-term-information-html h2 {\n font-size: 1.2em;\n}\n\n.mdhui-term-information .mdhui-term-information-disclaimer {\n color: var(--mdhui-text-color-2);\n font-size: .7em;\n}");function UAe(e){const[a,n]=c(null),[i,r]=c(!1);function o(e){e=e.filter((e=>"Device Manufacturer"==e.provider.category)),n(e)}if(id((function(){if(e.previewState){let t=wde.filter((e=>"Device Manufacturer"==e.provider.category));return t[0].status=e.previewState,void o(t)}w.getExternalAccounts().then((function(e){o(e)})),uc(!0).then((t=>{0!==e.dataTypes.length?Promise.any(e.dataTypes.map((e=>e.availabilityCheck(t).then((e=>e?Promise.resolve():Promise.reject()))))).then((()=>{r(!0)})).catch((()=>{r(!1)})):r(!1)}))}),["externalAccountSyncComplete"]),!(a&&a.length||i))return null;const s=t.createElement(QA,{color:e.buttonColor,variant:e.buttonVariant||"light",onClick:()=>{}},no("view"));return t.createElement(Za,{innerRef:e.innerRef,className:"mdhui-view-device-activity",renderAs:"div",onClick:()=>e.onClick(),indicator:s},t.createElement(sM,{order:3},e.title||no("device-activity")),a?.find((e=>"fetchingData"==e.status))&&t.createElement("div",{className:"mdhui-view-device-activity-status"},t.createElement(Ne,{icon:V,spin:!0})," ",no("external-account-fetching-data")))}A(".mdhui-view-device-activity .mdhui-view-device-activity-status {\n margin-top: var(--mdhui-padding-md);\n}");function VAe(e){const[a,n]=c(!1),[i,r]=c(!1);return id((()=>"notConnected"===e.previewState?(n(!1),void r(!1)):e.previewState?(n(!0),void r("fetchingData"===e.previewState)):void Promise.all([w.getExternalAccounts(),w.getDataAvailability()]).then((([e,t])=>{const a=e.filter((e=>["Provider","Health Plan"].includes(e.provider.category)));n(a.length>0||t.appleHealthRecords||t.healthConnectPhr),r(a.some((e=>"fetchingData"===e.status)))}))),["externalAccountSyncComplete"],[e.previewState]),a?t.createElement(Za,{className:"mdhui-view-ehr",renderAs:"div",indicator:t.createElement(QA,{color:e.buttonColor,variant:e.buttonVariant||"light",onClick:lM},no("view")),onClick:e.onClick,innerRef:e.innerRef},t.createElement(sM,{order:3},e.title||no("health-records")),i&&t.createElement("div",{className:"mdhui-view-ehr-status"},t.createElement(Ne,{icon:V,spin:!0})," ",no("external-account-fetching-data"))):null}function WAe(e){const a=r(rM),[n,i]=c(Rr()),[o,s]=c(cn(Rr(),{days:-6})),[l,u]=c(!0);id((()=>{if(!Sn(n,Rr()))return i(Rr()),void s(cn(Rr(),{days:-6}));u(!0),e.loadData(cn(o,{days:-7}),cn(o,{days:14})).then((()=>{u(!1)}))}),["externalAccountSyncComplete"],[o,...e.dependencies??[]]);const d=e=>{a?.update({intervalStart:e})};return t.createElement(wSe,{innerRef:e.innerRef,startDate:o,onStartDateChange:e=>{s(e),d(cn(e,{days:6}))},selectedDate:e.selectedDate,onDateSelected:d,dayRenderer:(t,a,n)=>e.dayRenderer(Br(new Date(t,a,n))),loading:l})}function $Ae(e){const a=r(rM),n=r(efe);if(!n)return t.createElement($q,{innerRef:e.innerRef},"Error: Meal Buttons must be used within a Meal Coordinator.");const i=t=>{if(e.preview)return void(e.autoLaunchEditor&&e.onEditMeal&&e.onEditMeal());let i=new Date;const r={id:vp(),timestamp:a?cn(vn(a.intervalStart),{hours:i.getHours(),minutes:i.getMinutes()}):i,type:t,created:i,lastModified:i};n.addMeal(r).then((()=>{e.autoLaunchEditor&&e.onEditMeal&&Sd(r).then(e.onEditMeal)}))};return t.createElement("div",{className:"mdhui-meal-buttons",ref:e.innerRef},t.createElement(QA,{onClick:()=>i("meal"),variant:"light",disabled:n.loading},t.createElement(Ne,{icon:Y})," ",Ld("meal")),t.createElement(QA,{onClick:()=>i("snack"),variant:"light",disabled:n.loading},t.createElement(Ne,{icon:se})," ",Ld("snack")),t.createElement(QA,{onClick:()=>i("drink"),variant:"light",disabled:n.loading},t.createElement(Ne,{icon:ge})," ",Ld("drink")))}A(".mdhui-view-ehr .mdhui-view-ehr-status {\n margin-top: var(--mdhui-padding-md);\n}");A(".mdhui-meal-log {\n padding: 16px 0 0;\n}\n\n.mdhui-meal-log .mdhui-title {\n padding: 0 16px;\n}\n\n.mdhui-meal-log .mdhui-loading-indicator {\n padding: 16px 16px 32px;\n}\n\n.mdhui-meal-log-empty-text {\n color: var(--mdhui-text-color-3);\n padding: 16px 16px 32px;\n text-align: center;\n}");function GAe(e){const a=r(Ga),[n,i]=c(!0);return l((()=>{i(!!e.mealImageUrl)}),[e.mealImageUrl]),t.createElement("div",{className:"mdhui-meal",ref:e.innerRef},t.createElement(KAe,{onClick:e.onClick},t.createElement("div",{className:"mdhui-meal-thumbnail"},!e.mealImageUrl&&t.createElement(t.Fragment,null,"meal"===e.meal.type&&t.createElement(Ne,{icon:Y}),"snack"===e.meal.type&&t.createElement(Ne,{icon:se}),"drink"===e.meal.type&&t.createElement(Ne,{icon:ge})),e.mealImageUrl&&t.createElement(t.Fragment,null,t.createElement("div",{className:"mdhui-meal-thumbnail-image",style:{display:n?"none":"block"}},t.createElement("img",{alt:"meal thumbnail",src:e.mealImageUrl,onLoad:()=>i(!1)})),n&&t.createElement(XA,{className:"mdhui-meal-loading"})),void 0!==e.number&&t.createElement("div",{className:"mdhui-meal-number",style:{background:je(a.colorScheme,e.color)}},e.number))),t.createElement(KAe,{onClick:e.onClick},t.createElement("div",{className:"mdhui-meal-info"},t.createElement("div",{className:"mdhui-meal-type"},Ld(e.meal.type)," ",e.selected&&t.createElement(Ne,{icon:B,color:"var(--mdhui-color-success)"})),t.createElement("div",{className:"mdhui-meal-time"},pl(e.meal.timestamp)),e.meal.description&&t.createElement("div",{className:"mdhui-meal-description"},e.meal.description))),e.onEdit&&t.createElement(S,{onClick:()=>e.onEdit(),style:{height:"100%"}},t.createElement("div",{className:"mdhui-meal-edit-action"},t.createElement(Ne,{icon:T}))))}function KAe(e){return e.onClick?t.createElement(S,{onClick:()=>e.onClick(),style:{height:"100%"}},e.children):t.createElement(t.Fragment,null,e.children)}function ZAe(e){const a=r(efe);if(!a)return t.createElement($q,{innerRef:e.innerRef},"Error: Meal Log must be used within a Meal Coordinator.");return t.createElement("div",{className:"mdhui-meal-log",ref:e.innerRef},t.createElement(sM,{order:3},no("meal-log-title")),a.loading&&t.createElement(XA,null),!a.loading&&0===a.meals.length&&t.createElement("div",{className:"mdhui-meal-log-empty-text"},no("meal-log-no-data")),!a.loading&&a.meals.map(((n,i)=>t.createElement(GAe,{key:`meal-${i}`,meal:n,mealImageUrl:a.imageUrls[n.id.toString()],number:e.showMealNumbers?i+1:void 0,color:Re(i),onClick:()=>a.onMealClicked(n),onEdit:()=>(t=>{e.preview?e.onEditMeal():Sd(t).then(e.onEditMeal)})(n),selected:!!e.highlightSelectedMeal&&a.selectedMeal===n}))))}A(".mdhui-meal {\n display: grid;\n grid-template-columns: max-content auto max-content;\n align-items: start;\n border-bottom: 1px solid var(--mdhui-border-color-0);\n}\n\n.mdhui-meal .mdhui-unstyled-button {\n display: inline-flex;\n}\n\n.mdhui-meal:last-child {\n border: none;\n}\n\n.mdhui-meal-thumbnail {\n position: relative;\n height: 48px;\n width: 48px;\n line-height: 48px;\n text-align: center;\n color: var(--mdhui-text-color-2);\n background: var(--mdhui-background-color-1);\n border: 1px solid var(--mdhui-border-color-2);\n border-radius: 5px;\n margin: 16px 8px 16px 16px;\n}\n\n.mdhui-meal-thumbnail-image img {\n height: 48px;\n width: 48px;\n object-fit: cover;\n}\n\n.mdhui-meal-loading.mdhui-loading-indicator {\n padding: 0;\n}\n\n.mdhui-meal-number {\n position: absolute;\n top: -6px;\n left: -6px;\n height: 20px;\n width: 20px;\n line-height: 20px;\n font-size: 0.7em;\n font-family: monospace;\n color: #fff;\n text-align: center;\n border-radius: 10px;\n}\n\n.mdhui-meal-number-old {\n font-size: 0.8em;\n height: 24px;\n line-height: 24px;\n padding: 0 8px;\n color: #fff;\n border-radius: 12px;\n margin: 24px 8px 16px 16px;\n}\n\n.mdhui-meal-info {\n margin: 16px 8px;\n color: var(--mdhui-text-color-2);\n}\n\n.mdhui-meal-type {\n font-size: 0.9em;\n font-weight: bold;\n}\n\n.mdhui-meal-time {\n color: var(--mdhui-text-color-1);\n font-size: 0.9em;\n}\n\n.mdhui-meal-description {\n margin-top: 8px;\n font-size: 0.75em;\n}\n\n.mdhui-meal-edit-action {\n margin: 24px 16px 16px;\n color: var(--mdhui-text-color-2);\n}");function YAe(e){var a=nl(e.intervalStart.getFullYear(),e.intervalStart.getMonth());const n=r(Ga);function i(e){return e.data.filter((e=>e)).length}return t.createElement("div",{ref:e.innerRef,className:"mdhui-monthly-event-matrix"},e.rows.length>0&&t.createElement("table",{cellPadding:"0",cellSpacing:"0"},t.createElement("thead",null,e.title&&t.createElement("tr",null,t.createElement("th",{colSpan:100},e.title)),t.createElement("tr",null,t.createElement("td",{className:"mdhui-monthly-event-matrix-title"}),t.createElement("td",null),a.map((e=>t.createElement("td",{key:e.toISOString(),style:{width:75/a.length+"%"}},t.createElement("div",{className:"mdhui-monthly-event-matrix-day-number"},e.getDate())))))),t.createElement("tbody",null,e.rows.map((e=>t.createElement("tr",{key:e.label},t.createElement("td",{className:"mdhui-monthly-event-matrix-row-label"},e.label," "),t.createElement("td",{className:"mdhui-monthly-event-matrix-row-total"},t.createElement("span",null,i(e)>0?i(e):t.createElement(t.Fragment,null," "))),a.map(((i,r)=>t.createElement("td",{key:i.toISOString(),style:{width:75/a.length+"%"}},t.createElement("div",{className:"mdhui-monthly-event-matrix-circle",style:{backgroundColor:e.data[r]?je(n.colorScheme,e.color):"#ddd"}}))))))))))}A(".mdhui-monthly-event-matrix {\n margin: 16px;\n}\n\n.mdhui-monthly-event-matrix table {\n width: 100%;\n page-break-inside: avoid;\n}\n\n.mdhui-monthly-event-matrix table th,\n.mdhui-monthly-event-matrix table td {\n vertical-align: top;\n}\n\n.mdhui-monthly-event-matrix table th {\n text-align: left;\n border: none;\n font-weight: normal;\n font-size: 15px;\n padding: 0;\n padding-bottom: 8px;\n padding-right: 8px;\n}\n\n.mdhui-monthly-event-matrix table thead th {\n text-align: left;\n font-weight: bold;\n font-size: 17px;\n padding-bottom: 8px;\n}\n\n.mdhui-monthly-event-matrix table thead .mdhui-monthly-event-matrix-day-number {\n width: 100%;\n min-width: 20px;\n text-align: center;\n font-size: 12px;\n color: var(--mdhui-text-color-2);\n}\n\n.mdhui-monthly-event-matrix table td {\n padding: 0;\n text-align: center;\n padding-bottom: 8px;\n}\n\n.mdhui-monthly-event-matrix table td.mdhui-monthly-event-matrix-row-label {\n text-align: left;\n border: none;\n font-weight: normal;\n font-size: 15px;\n padding: 0;\n padding-bottom: 8px;\n padding-right: 8px;\n width: 22%;\n}\n\n.mdhui-monthly-event-matrix table td .mdhui-monthly-event-matrix-circle {\n display: inline-block;\n width: 14px;\n height: 14px;\n border-radius: 8px;\n font-size: 9px;\n color: var(--mdhui-background-color-0);\n line-height: 14px;\n text-align: center;\n position: relative;\n}\n\n.mdhui-monthly-event-matrix table td.mdhui-monthly-event-matrix-total {\n padding-right: 8px;\n font-weight: bold;\n font-size: 15px;\n text-align: right;\n width: 3%;\n box-sizing: border-box;\n}");function XAe(e){const a=s(null);b((()=>{const{current:e}=a;function t(){window.scrollY>0?e?.classList.add("scroll-shadow"):e?.classList.remove("scroll-shadow")}return window.addEventListener("scroll",t),()=>{window.removeEventListener("scroll",t)}}));let n=["mdhui-navigation-bar"];e.className&&n.push(e.className),"compressed"==e.variant&&n.push("mdhui-navigation-bar-compressed"),"compressedModal"==e.variant&&n.push("mdhui-navigation-bar-compressed-modal");let i=r(Ga);return t.createElement("div",{className:n.join(" "),ref:a,style:{background:je(i?.colorScheme,e.backgroundColor)}},e.showBackButton&&t.createElement("div",{className:"button back-button",onClick:()=>{e.onBack?e.onBack():w.back()},style:{color:je(i?.colorScheme,e.buttonColor)}},t.createElement(Ne,{icon:ke}),e.backButtonText?e.backButtonText:no("back")),e.navigationBarLeft&&t.createElement("div",{className:"navigation-bar-left"},e.navigationBarLeft),e.title&&t.createElement("div",{className:"title",style:{color:je(i?.colorScheme,e.titleColor)}},t.createElement("span",null,e.title)),e.subtitle&&t.createElement("div",{className:"subtitle",style:{color:je(i?.colorScheme,e.subtitleColor),marginTop:e.title?"var(--mdhui-padding-sm)":"0"}},t.createElement("span",null,e.subtitle)),e.navigationBarRight&&t.createElement("div",{className:"navigation-bar-right"},e.navigationBarRight),e.showCloseButton&&t.createElement("div",{className:"button close-button",onClick:()=>{e.onClose?e.onClose():w.dismiss()},style:{color:je(i?.colorScheme,e.buttonColor)}},e.closeButtonText?e.closeButtonText:no("close")),e.children&&t.createElement("div",{className:"children"},e.children))}A(".mdhui-navigation-bar {\n text-align: left;\n padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px;\n min-height: calc(56px + env(safe-area-inset-top, 0px));\n margin-bottom: 8px;\n box-sizing: border-box;\n position: -webkit-sticky;\n position: sticky;\n z-index: 2;\n top: 0;\n font-weight: bold;\n background: var(--mdhui-background-color-1);\n}\n\n.mdhui-navigation-bar.mdhui-navigation-bar-compressed {\n text-align: center;\n font-size: 18px;\n}\n\n.mdhui-navigation-bar .title {\n margin-top: 44px;\n height: 32px;\n line-height: 32px;\n font-size: 1.2em;\n}\n\n.mdhui-navigation-bar.mdhui-navigation-bar-compressed .title {\n margin-top: 6px;\n}\n\n.mdhui-navigation-bar .subtitle {\n font-size: 1em;\n font-weight: 500;\n color: var(--mdhui-text-color-2);\n margin-top: 8px;\n}\n\n.mdhui-navigation-bar.scroll-shadow {\n box-shadow: var(--mdhui-box-shadow-1);\n}\n\n.mdhui-navigation-bar .icon {\n width: 32px;\n vertical-align: middle;\n}\n\n.mdhui-navigation-bar .button {\n position: absolute;\n top: calc(12px + env(safe-area-inset-top, 0px));\n height: 32px;\n line-height: 32px;\n border-radius: 16px;\n font-weight: normal;\n font-size: .88em;\n cursor: pointer;\n color: var(--mdhui-color-primary);\n}\n\n.mdhui-navigation-bar .back-button {\n left: 16px;\n}\n\n.mdhui-navigation-bar.mdhui-navigation-bar-compressed-modal {\n text-align: left;\n padding-top: calc(16px + env(safe-area-inset-top, 0px));\n font-size: 18px;\n margin-bottom: 0;\n}\n\n.mdhui-navigation-bar .close-button {\n right: 16px;\n}\n\n.mdhui-navigation-bar .children {\n padding-top: 56px;\n}\n\n.mdhui-navigation-bar.mdhui-navigation-bar-compressed .children {\n padding-top: calc(32px + env(safe-area-inset-top, 0px));\n}");function QAe(e){const[a,n]=c(!1),i=s(null);return l((()=>{i.current.style.height="1px",i.current.style.height=i.current.scrollHeight+"px"}),[e.value]),t.createElement("textarea",{title:no("add-notes"),ref:i,onClick:t=>function(t){if(!a&&e.autoTimestamp){n(!0);var r="";e.value.length&&(r=e.value+"\n\n"),r+="-- "+pl(new Date)+" --\n",e.onChange(r),t.stopPropagation(),i.current?.focus()}}(t),onChange:t=>e.onChange(t.target.value),className:"notes-input",placeholder:e.placeholder,value:e.value})}A(".notes-input {\n width: 100%;\n text-align: left;\n border: 0;\n font-size: .88em;\n border: none;\n font-family: Helvetica, Arial, sans-serif;\n padding-top: 16px;\n resize: none;\n background: var(--mdhui-background-color-2);\n border-radius: var(--mdhui-card-border-radius);\n padding: 16px;\n box-sizing: border-box;\n border: solid 1px var(--mdhui-color-primary);\n overflow: hidden;\n -webkit-appearance: none;\n box-shadow: none !important;\n color: var(--mdhui-text-color-1);\n margin-bottom: 16px;\n}");function JAe(e){let a=r(Ga),n=["mdhui-progress-bar"];return e.defaultMargin&&n.push("mdhui-progress-bar-default-margin"),t.createElement("div",{className:n.join(" "),ref:e.innerRef},t.createElement("div",{className:"mdhui-progress-bar-background",style:{background:je(a?.colorScheme,e.backgroundColor)}},t.createElement("div",{className:"mdhui-progress-bar-fill",style:{width:Math.trunc(e.fillPercent)+"%",background:je(a?.colorScheme,e.fillColor)}}),t.createElement(tS,null)),t.createElement("div",{className:"mdhui-progress-steps"},e.steps&&t.createElement(t.Fragment,null,e.steps.map(((e,a)=>t.createElement("div",{key:`${a}-step`,className:"step-icon",style:{left:Math.trunc(e.percent)+"%"}},e.icon))))))}function eSe(e){let a=r(Ga),n="calc( var(--icon_size) / 2 - "+e.height+" / 2 - 4px)";return t.createElement("span",{style:{border:"2px solid",borderColor:je(a?.colorScheme,e.borderColor),borderRadius:e.height,height:e.height,width:e.height,marginTop:n,backgroundColor:je(a?.colorScheme,e.backgroundColor),padding:"4px 4px"}},e.children)}A(".mdhui-progress-bar {\n\tdisplay: block;\n\twidth: 100%;\n\tposition: relative;\n\t--icon_size: 24px;\n\t--icon_border_width: 2px;\n}\n\n.mdhui-progress-bar.mdhui-progress-bar-default-margin {\n\tmargin: 16px;\n\twidth: calc(100% - 32px)\n}\n\n.mdhui-progress-bar .mdhui-progress-bar-background {\n\tborder-radius: 500px;\n\tborder-width: var(--icon_border_width);\n\tborder-style: none;\n\tbackground: #fff;\n\toverflow: hidden;\n\twidth: 100%;\n\tposition: relative;\n\theight: calc(var(--icon_size) + 4px);\n\tz-index: 1;\n}\n\n.mdhui-progress-bar .mdhui-progress-bar-background .mdhui-progress-bar-fill {\n\tposition: absolute;\n\tmin-height: 1px;\n\theight: calc(var(--icon_size) + 4px);\n\ttop: 0;\n\tborder-radius: var(--icon_size);\n\ttransition: width 1s ease-in-out;\n}\n\n.mdhui-progress-bar .mdhui-progress-steps {\n\ttop: 0;\n\twidth: 100%;\n\tposition: absolute;\n\tz-index: 2;\n\tdisplay: inline-block;\n}\n\n.mdhui-progress-bar .step-icon {\n\tposition: absolute;\n\ttransform: translate(-100%, 0);\n}\n\n.mdhui-progress-bar .step-icon * {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n}"),JAe.defaultProps={backgroundColor:"var(--mdhui-background-color-0)",fillColor:"var(--mdhui-color-primary)",fillPercent:0};function tSe(e){const a=r(Ga);let n=0;e.percentCompleted&&(n=630-e.percentCompleted/100*630);const i={stroke:je(a.colorScheme,e.color),strokeDashoffset:n,animation:e.animate?"mdhui-progress-ring 750ms ease-in-out":void 0,"--mdhui-progress-ring-animation-end":n},o={opacity:e.animate?0:1,animation:e.animate?"fadein 500ms ease-in-out":void 0,animationDelay:"500ms",animationFillMode:"forwards"};return t.createElement("div",{className:"mdhui-progress-ring",style:e.style},t.createElement("svg",null,t.createElement("circle",{cx:"50%",cy:"50%",r:"100"}),t.createElement("circle",{cx:"50%",cy:"50%",r:"100",style:i})),t.createElement("div",{className:"mdhui-progress-ring-content",style:o},e.children))}A("@keyframes mdhui-progress-ring {\n 0% {\n stroke-dashoffset: var(--mdhui-progress-ring-animation-start);\n }\n 100% {\n stroke-dashoffset: var(--mdhui-progress-ring-animation-end);\n }\n}\n\n.mdhui-progress-ring {\n position: relative;\n margin: 0 auto 0 auto;\n width: 220px;\n height: 220px;\n --mdhui-progress-ring-animation-start: 630;\n --mdhui-progress-ring-animation-end: 0;\n}\n\n.mdhui-progress-ring svg {\n width: 220px;\n height: 220px;\n transform: rotate(-90deg);\n}\n\n.mdhui-progress-ring circle {\n margin: 0 auto;\n fill: none;\n stroke-width: 20;\n stroke-dasharray: 630;\n stroke-linecap: round;\n}\n\n.mdhui-progress-ring circle:nth-child(2) {\n stroke: var(--mdhui-color-primary);\n animation-fill-mode: forwards;\n}\n\n.mdhui-progress-ring-content {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n}");function aSe(e){return t.createElement("div",{className:"mdhui-resource",ref:e.innerRef},t.createElement(S,{onClick:()=>e.onClick()},e.imageUrl&&t.createElement("div",{className:"mdhui-resource-image",style:{textAlign:e.imageAlignment??"left"}},t.createElement("img",{src:e.imageUrl,alt:"resource image"})),t.createElement("div",{className:"mdhui-resource-title"},e.title),t.createElement("div",{className:"mdhui-resource-subtitle"},e.subTitle),"button"===e.buttonVariant&&t.createElement("div",{className:"mdhui-button mdhui-resource-button",onClick:lM},e.buttonText||no("resource-default-button-text")),"link"===e.buttonVariant&&t.createElement("div",{className:"mdhui-resource-link"},e.buttonText||no("resource-default-button-text"))))}A(".mdhui-resource {\n background: var(--mdhui-background-color-0);\n border-radius: 12px;\n margin: 12px 16px;\n box-shadow: var(--mdhui-box-shadow-0);\n}\n\n.mdhui-resource .mdhui-unstyled-button {\n width: 100%;\n padding: 16px;\n}\n\n.mdhui-resource-image {\n width: 100%;\n margin-bottom: 16px;\n}\n\n.mdhui-resource-image img {\n max-width: 100%;\n}\n\n.mdhui-resource-title {\n font-size: 1.3em;\n font-weight: 600;\n}\n\n.mdhui-resource-subtitle {\n font-size: 0.95em;\n margin: 12px 0 0;\n}\n\n.mdhui-resource-button {\n margin: 12px 0 0;\n}\n\n.mdhui-resource-link {\n color: var(--mdhui-color-primary);\n font-weight: 500;\n margin: 16px 0 0;\n}");A(".mdhui-resource-list {\n padding: 0 16px;\n margin-bottom: 16px;\n}\n\n.mdhui-resource-list-empty-text {\n color: var(--mdhui-text-color-3);\n padding: 16px 0;\n}");const nSe={"no resources":{resources:[]},"some resources":{resources:[{title:"Resource 1 Title",subTitle:"resource 1 subtitle",imageUrl:Cge},{title:"Resource 2 Title",subTitle:"resource 2 subtitle",imageUrl:Cge},{title:"Resource 3 Title",subTitle:"resource 3 subtitle",imageUrl:Cge},{title:"Resource 4 Title",subTitle:"resource 4 subtitle",imageUrl:Cge},{title:"Resource 5 Title",subTitle:"resource 5 subtitle",imageUrl:Cge}]}};function iSe(e){let a=e.previewState?nSe[e.previewState].resources:e.resources;return t.createElement("div",{className:"mdhui-resource-list",ref:e.innerRef},t.createElement(t.Fragment,null,a.length>0&&a.map(((a,n)=>t.createElement(aSe,{key:n,title:a.title,subTitle:a.subTitle,imageUrl:a.imageUrl,onClick:()=>e.onViewResource(a),imageAlignment:e.imageAlignment,buttonVariant:e.buttonVariant,buttonText:e.buttonText}))),0===a.length&&t.createElement("div",{className:"mdhui-resource-list-empty-text"},e.emptyText||no("resource-list-empty-text"))))}function rSe(e){let a=d.toArray(e.children);if(0===a.length)return t.createElement("div",{ref:e.innerRef});let n,i=new Date,r=e.startDate;return Ci(r,i)&&(r=i),n="month"===e.interval?Mn(i,r)%a.length:"week"===e.interval?function(e,t,a){const n=_n(e,t,a)/7;return Tn(a?.roundingMethod)(n)}(i,r)%a.length:_n(i,r)%a.length,t.createElement("div",{ref:e.innerRef},a[n])}function oSe(e){if(!e.children)return null;let a=r(Ga),n=je(a?.colorScheme,e.backgroundColor);return t.createElement("div",{ref:e.innerRef,style:{...e.style,backgroundColor:n},className:"mdhui-section "+(e.className||"")+(e.noTopMargin?" mdhui-section-no-top-margin":"")},e.children)}A(".mdhui-section {\n margin-top: 16px;\n margin-bottom: 16px;\n background: var(--mdhui-background-color-0);\n box-shadow: var(--mdhui-box-shadow-0);\n animation: var(--mdhui-fadein-animation);\n -moz-animation: var(--mdhui-fadein-animation);\n -webkit-animation: var(--mdhui-fadein-animation);\n position: relative;\n display: flow-root;\n}\n\n.mdhui-section:empty {\n display: none;\n}\n\n.mdhui-section.mdhui-section-no-top-margin {\n margin-top: 0;\n}");function sSe(e){var a=100/e.segments.length;let n=["mdhui-segmented-control"];return e.className&&n.push(e.className),"optionsHorizontal"==e.variant&&n.push("mdhui-segmented-control-options-horizontal"),"optionsVertical"==e.variant&&n.push("mdhui-segmented-control-options-vertical"),t.createElement("div",{ref:e.innerRef,style:{...e.style,borderColor:e.color},className:n.join(" ")},e.segments.map((n=>t.createElement(S,{className:"mdhui-segment "+(n.key==e.selectedSegment?"mdhui-segment-selected":""),key:n.key,onClick:()=>e.onSegmentSelected(n.key),style:{width:a+"%",color:n.key==e.selectedSegment?void 0:e.color,backgroundColor:n.key==e.selectedSegment?e.color:void 0}},n.key==e.selectedSegment&&t.createElement(tS,null),n.title))))}A(".mdhui-segmented-control {\n border-radius: 32px;\n border: solid 1px var(--mdhui-color-primary);\n background: var(--mdhui-background-color-0);\n overflow: hidden;\n padding: 1px;\n}\n\n.mdhui-segmented-control .mdhui-segment {\n display: inline-block;\n font-size: .7em;\n cursor: pointer;\n text-align: center;\n padding: 8px;\n box-sizing: border-box;\n font-weight: bold;\n color: var(--mdhui-color-primary);\n position: relative;\n border-radius: 32px;\n overflow: hidden;\n vertical-align: top;\n text-overflow: ellipsis;\n white-space: nowrap;\n line-height: 1em;\n}\n\n.mdhui-segmented-control .mdhui-segment:last-child {\n border: none;\n}\n\n.mdhui-segmented-control .mdhui-segment.mdhui-segment-selected {\n background: var(--mdhui-color-primary);\n color: #FFF;\n}\n\n.mdhui-segmented-control.mdhui-segmented-control-options-horizontal,\n.mdhui-segmented-control.mdhui-segmented-control-options-vertical {\n font-size: .88em;\n padding: 0;\n border-radius: var(--mdhui-card-border-radius);\n}\n\n.mdhui-segmented-control.mdhui-segmented-control-options-horizontal .mdhui-segment,\n.mdhui-segmented-control.mdhui-segmented-control-options-vertical .mdhui-segment {\n font-size: .88em;\n border-radius: 0;\n font-weight: normal;\n}\n\n.mdhui-segmented-control.mdhui-segmented-control-options-horizontal .mdhui-segment.mdhui-segment-selected,\n.mdhui-segmented-control.mdhui-segmented-control-options-vertical .mdhui-segment.mdhui-segment-selected {\n background: var(--mdhui-color-primary);\n color: #FFF;\n}\n\n.mdhui-segmented-control.mdhui-segmented-control-options-vertical .mdhui-segment {\n width: 100% !important;\n border-bottom: solid 1px var(--mdhui-color-primary);\n}\n\n.mdhui-segmented-control.mdhui-segmented-control-options-vertical .mdhui-segment:last-child {\n border: none;\n}\n\n.mdhui-segmented-control.mdhui-segmented-control-default-margin {\n margin: 16px;\n}\n");function lSe(e){const a=()=>t.createElement(t.Fragment,null,t.createElement("div",{className:"mdhui-single-data-point-value-units"},!e.value&&t.createElement("div",{className:"mdhui-single-data-point-value"},"..."),e.value&&t.createElement("div",{className:"mdhui-single-data-point-value"},e.value),e.value&&e.units&&t.createElement("div",{className:"mdhui-single-data-point-units"},e.units)),t.createElement("div",{className:"mdhui-single-data-point-label"},e.label),e.statusText&&t.createElement("div",{className:"mdhui-single-data-point-status",style:e.statusColor?{color:e.statusColor}:void 0},e.statusText));return t.createElement("div",{ref:e.innerRef},e.onClick&&t.createElement(S,{className:"mdhui-single-data-point",onClick:()=>e.onClick()},a()),!e.onClick&&t.createElement("div",{className:"mdhui-single-data-point"},a()))}A(".mdhui-single-data-point, .mdhui-unstyled-button.mdhui-single-data-point {\n display: grid;\n grid-template-columns: 1fr;\n align-items: center;\n padding: 16px;\n border-radius: 6px;\n border: 1px solid var(--mdhui-border-color-1);\n background: var(--mdhui-background-color-0);\n min-height: 60px;\n width: 100%;\n box-sizing: border-box;\n}\n\n.mdhui-single-data-point-value-units {\n display: grid;\n grid-template-columns: max-content auto;\n align-items: baseline;\n grid-column-gap: 2px;\n}\n\n.mdhui-single-data-point-setup {\n font-size: 1.3em;\n color: var(--mdhui-color-primary);\n}\n\n.mdhui-single-data-point-value {\n font-size: 1.3em;\n font-weight: bold;\n}\n\n.mdhui-single-data-point-units {\n color: var(--mdhui-text-color-3);\n font-size: 0.8em;\n}\n\n.mdhui-single-data-point-label {\n font-size: 0.7em;\n font-weight: bold;\n}\n\n.mdhui-single-data-point-status {\n font-size: 0.7em;\n font-weight: bold;\n}");function cSe(e){const[a,n]=c("");function i(){return a||e.externalAccount.status}return t.createElement("div",{ref:e.innerRef,className:"mdhui-single-external-account"},t.createElement("div",{className:"external-account-header"},e.externalAccount.provider.logoUrl&&t.createElement("img",{alt:e.externalAccount.provider.name,src:e.externalAccount.provider.logoUrl,className:"external-account-provider-logo"}),!e.externalAccount.provider.logoUrl&&t.createElement("div",{className:"external-account-provider-name"},e.externalAccount.provider.name),"deleting"!==i()&&"fetchingData"!==i()&&t.createElement(S,{className:"delete-button",onClick:function(){n("deleting"),w.deleteExternalAccount(e.externalAccount.id).then((function(){e.onAccountRemoved(e.externalAccount)})).catch((function(){n("")}))},title:no("external-account-remove")},t.createElement(Ne,{icon:ee}))),t.createElement("div",{className:"external-account-status"},"unauthorized"===i()&&t.createElement("p",null,t.createElement("span",{className:"error"},no("external-account-authorization-expired"))),"fetchingData"===i()&&t.createElement("p",null,t.createElement(Ne,{icon:V,spin:!0})," ",no("external-account-fetching-data")),"fetchComplete"===i()&&t.createElement("p",null,no("external-account-last-updated")," ",t.createElement("strong",null,ml(e.externalAccount.lastRefreshDate,new Date))),"error"===i()&&t.createElement("p",{className:"error"},no("external-account-error")),("fetchComplete"===i()||"error"===i())&&t.createElement("p",null,t.createElement("a",{href:"javascript:{}",onClick:function(){n("fetchingData"),w.refreshExternalAccount(e.externalAccount.id).then()}},t.createElement(Ne,{icon:j})," ",no("external-account-refresh"))),"unauthorized"===i()&&t.createElement("p",null,t.createElement("a",{href:"javascript:{}",onClick:()=>e.onReconnectAccount(e.externalAccount)},t.createElement(Ne,{icon:j})," ",no("external-account-reconnect"))),"deleting"===i()&&t.createElement("p",null,t.createElement(Ne,{icon:V,spin:!0})," ",no("external-account-deleting"))))}A(".mdhui-single-external-account {\n position: relative;\n overflow: hidden;\n background: var(--mdhui-background-color-0);\n}\n\n.mdhui-single-external-account .external-account-header {\n position: relative;\n padding: 8px;\n font-weight: bold;\n border-bottom: solid 1px var(--mdhui-border-color-0);\n}\n\n.mdhui-single-external-account .external-account-header .delete-button {\n position: absolute;\n right: 0;\n top: 0;\n cursor: pointer;\n padding: 16px;\n color: var(--mdhui-text-color-4);\n width: auto;\n font-size: .88em;\n border: none;\n background: none;\n height: 100%;\n}\n\n.mdhui-single-external-account .external-account-header .external-account-provider-logo {\n height: 24px;\n display: block;\n background: #FFF;\n padding: 8px;\n border-radius: 8px;\n}\n\n.mdhui-single-external-account .external-account-header .external-account-provider-name {\n font-size: 1em;\n font-weight: bold;\n}\n\n.mdhui-single-external-account .external-account-status {\n padding: 16px;\n padding-bottom: 0;\n padding-top: 0;\n font-size: .88em;\n}\n\n.mdhui-single-external-account .external-account-status p {\n margin-bottom: 16px;\n margin-top: 16px;\n}\n\n.mdhui-single-external-account .external-account-status a {\n cursor: pointer;\n text-decoration: none;\n}\n\n.mdhui-single-external-account .external-account-status .error {\n color: var(--mdhui-color-danger);\n}");function uSe(e){return e.notification?t.createElement("div",{ref:e.innerRef,className:"mdhui-single-notification"},e.notification.content?.title&&t.createElement("div",{className:"notification-title"},e.notification.content.title),e.notification.content?.subject&&t.createElement("div",{className:"notification-title"},e.notification.content.subject),e.notification.content?.body&&t.createElement("div",{className:"notification-body"},e.notification.content.body),t.createElement("div",{className:"notification-date"},ml(e.notification.sentDate,new Date))):t.createElement("div",{ref:e.innerRef,className:"mdhui-single-notification"},t.createElement("div",{className:"notification-body"},"No notifications received"))}A(".mdhui-single-notification\n{\n padding: 16px;\n border-bottom: solid 1px var(--mdhui-border-color-0);\n position: relative;\n}\n\n .mdhui-single-notification:last-child\n {\n border: none;\n }\n\n .mdhui-single-notification > .notification-title\n {\n font-weight: bold;\n }\n\n .mdhui-single-notification > .notification-body\n {\n font-size: .88em;\n }\n\n .mdhui-single-notification > .notification-date\n {\n color: var(--mdhui-text-color-2);\n margin-top: 16px;\n font-size: .75em;\n }\n");A(".mdhui-single-survey-task {\n border-radius: inherit;\n}\n\n.mdhui-single-survey-task.incomplete-expanded {\n padding: 16px;\n width: 100%;\n box-sizing: border-box;\n}\n\n.mdhui-single-survey-task.incomplete-expanded.active {\n cursor: pointer;\n}\n\n.mdhui-single-survey-task.incomplete-expanded .header {\n display: grid;\n grid-template-columns: auto max-content;\n align-items: center;\n}\n\n.mdhui-single-survey-task .survey-name {\n font-size: .88em;\n font-weight: bold;\n}\n\n.mdhui-single-survey-task.incomplete-expanded .survey-name {\n font-size: 1.3em;\n}\n\n.mdhui-single-survey-task .survey-description {\n font-size: .88em;\n color: var(--mdhui-text-color-2);\n}\n\n.mdhui-single-survey-task.incomplete-expanded .survey-description {\n font-size: 1em;\n margin: 12px 0;\n}\n\n.mdhui-single-survey-task .completed-date {\n font-size: .88em;\n color: var(--mdhui-text-color-2);\n}\n\n.mdhui-single-survey-task .due-date {\n font-size: .88em;\n color: var(--mdhui-color-primary);\n}\n\n.mdhui-single-survey-task .due-date.warning {\n color: var(--mdhui-color-warning);\n font-weight: bold;\n}\n\n.mdhui-single-survey-task .due-date.danger {\n color: var(--mdhui-color-danger);\n font-weight: bold;\n}");var dSe="data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='21' height='24' viewBox='0 0 21 24' fill='none'%3e%3cg clip-path='url(%23clip0_881_3509)'%3e%3cpath d='M20.6718 4.82803C21.1124 5.26865 21.1124 5.98115 20.6718 6.41709L8.29678 18.7968C7.85615 19.2374 7.14365 19.2374 6.70772 18.7968L0.328027 12.4218C-0.112598 11.9812 -0.112598 11.2687 0.328027 10.8327C0.768652 10.3968 1.48115 10.3921 1.91709 10.8327L7.49521 16.4108L19.078 4.82803C19.5187 4.3874 20.2312 4.3874 20.6671 4.82803H20.6718Z' fill='%2314B856'/%3e%3c/g%3e%3cdefs%3e%3cclipPath id='clip0_881_3509'%3e%3crect width='21' height='24' fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";function hSe(e){const a=r(Ga),n=()=>{let a,n=Rr(),i=cn(new Date(n),{days:1}),r=Tr(e.task.dueDate??""),o=["due-date"];return Sn(r,i)?(a=no("due-tomorrow"),o.push("warning")):Sn(r,n)?(a=no("due-today"),o.push("warning")):Ci(n,r)?(a=no("overdue"),o.push("danger")):a=no("due-in")+" "+function(e){const t=tl(e);return t?Ei(t,{locale:vl()}):""}(r),t.createElement("div",{className:o.join(" ")},a)};return"incomplete"===e.task.status&&"expanded"===e.variant?t.createElement("div",{className:"mdhui-single-survey-task incomplete-expanded "+(e.surveyBlocked?"":"active"),onClick:e.surveyBlocked?void 0:()=>e.onClick()},t.createElement("div",{className:"header"},t.createElement("div",{className:"survey-name"},e.task.surveyDisplayName),e.task.dueDate&&n()),t.createElement("div",{className:"survey-description"},t.createElement(t.Fragment,null,e.descriptionIcon," ",e.task.surveyDescription)),e.surveyActive&&t.createElement(XA,null),!e.surveyActive&&t.createElement(QA,{color:je(a.colorScheme,e.buttonColor),variant:e.buttonVariant,onClick:lM,disabled:e.surveyBlocked},e.task.hasSavedProgress?no("resume-survey"):no("start-survey"))):"incomplete"===e.task.status?(()=>{let i;return i=e.surveyActive?t.createElement(XA,null):t.createElement(QA,{color:je(a.colorScheme,e.buttonColor),variant:e.buttonVariant??"light",onClick:lM,disabled:e.surveyBlocked},e.task.hasSavedProgress?no("resume"):no("start")),t.createElement(Za,{renderAs:"div",innerRef:e.innerRef,onClick:e.surveyBlocked?void 0:()=>e.onClick(),className:"mdhui-single-survey-task incomplete",indicator:i},t.createElement("div",{className:"survey-name"},e.task.surveyDisplayName),t.createElement("div",{className:"survey-description"},t.createElement(t.Fragment,null,e.descriptionIcon," ",e.task.surveyDescription)),e.task.dueDate&&n())})():"complete"===e.task.status?t.createElement(Za,{renderAs:"div",className:"mdhui-single-survey-task complete",indicator:t.createElement("img",{src:dSe,alt:"check mark"}),innerRef:e.innerRef},t.createElement("div",{className:"survey-name"},e.task.surveyDisplayName),e.task.endDate&&t.createElement("div",{className:"completed-date"},no("completed")," ",ml(e.task.endDate,new Date))):null}function mSe(e){let a=r(Ga);var n=100/e.bars.length;function i(t){return e.gap?`calc(${n*t}% + ${e.gap/2}px)`:n*t+"%"}let o=["mdhui-spark-bar-chart"];return"rounded"===e.variant&&o.push("mdhui-spark-bar-chart-rounded"),t.createElement("div",{ref:e.innerRef,className:o.join(" "),style:e.style},void 0!==e.averageFillPercent&&t.createElement("div",{className:"mdhui-spark-bar-chart-average",style:{bottom:100*e.averageFillPercent+"%"}}),t.createElement("div",{className:"mdhui-spark-bar-chart-bars"},e.bars.map(((r,o)=>t.createElement("div",{key:o,className:"mdhui-spark-bar-chart-bar",style:{backgroundColor:je(a.colorScheme,r.color),height:100*r.barFillPercent+"%",width:e.gap?`calc(${n}% - ${e.gap}px)`:n+"%",left:i(o),opacity:r.opacity}},t.createElement(tS,null))))))}A(".mdhui-spark-bar-chart {\n position: relative;\n height: 72px;\n}\n\n.mdhui-spark-bar-chart .mdhui-spark-bar-chart-bars {\n margin-left: 8px;\n width: calc(100% - 16px);\n position: relative;\n height: 100%;\n}\n\n.mdhui-spark-bar-chart .mdhui-spark-bar-chart-bars .mdhui-spark-bar-chart-bar {\n position: absolute;\n bottom: 0;\n z-index: 2;\n}\n\n.mdhui-spark-bar-chart.mdhui-spark-bar-chart-rounded .mdhui-spark-bar-chart-bars .mdhui-spark-bar-chart-bar {\n border-radius: 4px 4px 0 0;\n}\n\n.mdhui-spark-bar-chart .mdhui-spark-bar-chart-average {\n border-top: dashed 1px var(--mdhui-border-color-1);\n position: absolute;\n left: 0px;\n right: 0px;\n z-index: 1;\n}");function pSe(e){const a=r(Ga),n=Math.min(...e.domain),i=Math.max(...e.domain),o=e=>100-(e-n)/(i-n)*100;let s;null!=e.reference&&e.reference>=n&&e.reference<=i&&(s=o(e.reference));return t.createElement("div",{className:"mdhui-spark-range-chart",ref:e.innerRef,style:{gridTemplateColumns:Array(e.ranges.length).fill("1fr").join(" ")}},0===e.ranges.length&&null!=e.reference&&t.createElement("svg",{width:"100%",height:40,overflow:"visible"},void 0!==s&&t.createElement("line",{x1:0,y1:s+"%",x2:"100%",y2:s+"%",stroke:"var(--mdhui-background-color-2)",strokeWidth:1,strokeDasharray:3})),e.ranges.length>0&&e.ranges.map(((e,r)=>{const l=Math.max(e.min,n),c=Math.min(e.max,i),u=o(l),d=o(c);let h;if(null!=e.average){const t=Math.min(Math.max(e.average,n),i);h=o(t)}let m=je(a.colorScheme,e.color)??Re(r);return t.createElement("svg",{key:r,width:"100%",height:40,overflow:"visible"},void 0!==s&&t.createElement("line",{x1:0,y1:s+"%",x2:"100%",y2:s+"%",stroke:"var(--mdhui-background-color-2)",strokeWidth:1,strokeDasharray:3}),t.createElement("line",{x1:"calc(50% - 4px)",y1:u+"%",x2:"calc(50% + 4px)",y2:u+"%",stroke:m,strokeWidth:2}),t.createElement("line",{x1:"calc(50% - 4px)",y1:d+"%",x2:"calc(50% + 4px)",y2:d+"%",stroke:m,strokeWidth:2}),t.createElement("line",{x1:"50%",y1:u+"%",x2:"50%",y2:d+"%",stroke:m,strokeWidth:2}),void 0!==h&&t.createElement("circle",{cx:"50%",cy:h+"%",r:4,fill:m}))})))}A(".mdhui-spark-range-chart {\n display: grid;\n column-gap: 4px;\n justify-content: center;\n}");function gSe(e){return t.createElement(S,{innerRef:e.innerRef,onClick:()=>e.onValueChanged(!e.isOn),className:"mdhui-switch"+(e.isOn?" mdhui-switch-on":"")+(e.className?" "+e.className:""),style:{backgroundColor:e.isOn?e.onBackgroundColor:"var(--mdhui-background-color-2)"}},t.createElement("div",{className:"mdhui-switch-circle"}))}A(".mdhui-switch {\n border: 1px solid var(--mdhui-background-color-2);\n border-radius: 20px;\n cursor: pointer;\n display: inline-block;\n height: 30px;\n position: relative;\n vertical-align: middle;\n width: 50px;\n background: --mdhui-background-color-2;\n -webkit-box-sizing: content-box;\n -moz-box-sizing: content-box;\n box-sizing: content-box;\n -webkit-background-clip: content-box;\n background-clip: content-box;\n transition: background-color .5s;\n}\n\n.mdhui-switch.mdhui-switch-on {\n background: var(--mdhui-color-primary);\n}\n\n.mdhui-switch .mdhui-switch-circle {\n background: #fff;\n border-radius: 100%;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);\n height: 30px;\n position: absolute;\n top: 0;\n width: 30px;\n}\n\n.mdhui-switch.mdhui-switch-on .mdhui-switch-circle {\n right: 0;\n}");function fSe(e){var a=r(Ga),n={backgroundColor:a.bodyBackgroundColor};return e.color&&(n={backgroundColor:e.color}),e.color||"dark"!==a.colorScheme||w.setStatusBarStyle("lightContent"),t.createElement("div",{ref:e.innerRef,className:"mdhui-status-bar-background",style:n})}A(".mdhui-status-bar-background {\n position: sticky;\n position: -webkit-sticky;\n left: 0;\n top: 0;\n right: 0;\n height: env(safe-area-inset-top);\n width: 100%;\n z-index: 1;\n background: var(--mdhui-background-color-0);\n}");function ySe(e){var a=["mdhui-tracker-item"];e.onClick&&a.push("selectable"),e.selected?a.push("selected"):a.push("unselected"),e.bordered&&a.push("bordered"),e.className&&a.push(e.className),e.noBoxShadow&&a.push("mdhui-tracker-item-no-box-shadow");var n={borderColor:e.color,color:e.color,backgroundColor:e.color};return e.onClick?t.createElement(S,{className:a.join(" "),style:n,onClick:()=>e.onClick?e.onClick():null},e.text,e.selected&&t.createElement(tS,null),e.badge&&e.selected&&t.createElement("div",{className:"badge"},e.badge)):t.createElement("div",{className:a.join(" "),style:n,onClick:()=>e.onClick?e.onClick():null},e.text,e.selected&&t.createElement(tS,null),e.badge&&e.selected&&t.createElement("div",{className:"badge"},e.badge))}A(".mdhui-tracker-item {\n padding: 8px;\n padding-right: 16px;\n padding-left: 16px;\n color: var(--mdhui-background-color-0);\n border-radius: 32px;\n font-size: .88em;\n display: inline-block;\n margin: 8px;\n position: relative;\n border: solid 1px #000;\n user-select: none;\n line-height: 1.1em;\n}\n\n.mdhui-tracker-item.selectable {\n cursor: pointer;\n}\n\n.mdhui-tracker-item.selected {\n box-shadow: var(--mdhui-box-shadow-1);\n color: #FFF !important;\n background-color: inherit;\n}\n\n.mdhui-tracker-item.unselected {\n background-color: var(--mdhui-background-color-0) !important;\n}\n\n.mdhui-tracker-item .mdhui-shiny-overlay {\n border-radius: 32px;\n}\n\n.mdhui-tracker-item.bordered .mdhui-shiny-overlay {\n left: 1px;\n right: 1px;\n bottom: 1px;\n top: 1px;\n border: solid 2px #FFF;\n}\n\n.mdhui-tracker-item .badge {\n position: absolute;\n right: -4px;\n top: -4px;\n border-radius: 32px;\n padding: 3px;\n background: linear-gradient(to bottom, #555 0%, #888 100%);\n font-weight: bold;\n text-align: center;\n min-width: 10px;\n user-select: none;\n font-size: .62em;\n line-height: 10px;\n}\n\n.mdhui-tracker-item.mdhui-tracker-item-no-box-shadow {\n box-shadow: none;\n}");function vSe(e){const a=r(Ga),n=e.selectedValues??[],i=t=>{e.onChange&&e.onChange(t)};let o={"--mdhui-value-selector-title-color":je(a?.colorScheme,e.titleColor),"--mdhui-value-selector-subtitle-color":je(a?.colorScheme,e.subtitleColor),"--mdhui-value-selector-value-background-color":je(a?.colorScheme,e.valueBackgroundColor),"--mdhui-value-selector-value-text-color":je(a?.colorScheme,e.valueTextColor),"--mdhui-value-selector-button-value-selected-background-color":je(a?.colorScheme,e.selectedButtonBackgroundColor),"--mdhui-value-selector-button-value-selected-text-color":je(a?.colorScheme,e.selectedButtonTextColor),"--mdhui-value-selector-checkbox-color":je(a?.colorScheme,e.checkboxColor),"--mdhui-value-selector-checkbox-selected-color":je(a?.colorScheme,e.selectedCheckboxColor)};return t.createElement("div",{className:"mdhui-value-selector",style:o,ref:e.innerRef},e.title&&t.createElement("div",{className:"mdhui-value-selector-title"},e.title),e.subtitle&&t.createElement("div",{className:"mdhui-value-selector-subtitle"},e.subtitle),t.createElement("div",{className:"mdhui-value-selector-values"},e.values.map(((a,r)=>{let o=["mdhui-value-selector-value"];return n.includes(a)&&o.push("mdhui-value-selector-value-selected"),"checkboxes"===e.variant?o.push("mdhui-value-selector-value-checkbox"):o.push("mdhui-value-selector-value-button"),t.createElement(S,{key:r,onClick:()=>(t=>{n.includes(t)?(n.length>1||!e.preventEmptySelections)&&i(n.filter((e=>e!==t))):e.multiSelect?i([...n,t]):i([t])})(a)},t.createElement("div",{className:o.join(" ")},t.createElement("div",{className:"mdhui-value-selector-value-text"},a),"checkboxes"===e.variant&&n.includes(a)&&t.createElement(gge,{className:"mdhui-value-selector-value-checkbox-icon mdhui-value-selector-value-checkbox-icon-selected",icon:H}),"checkboxes"===e.variant&&!n.includes(a)&&t.createElement(gge,{className:"mdhui-value-selector-value-checkbox-icon",icon:PM})))}))))}A(".mdhui-value-selector {\n --mdhui-value-selector-title-color: var(--mdhui-text-color-1);\n --mdhui-value-selector-subtitle-color: var(--mdhui-text-color-3);\n --mdhui-value-selector-value-background-color: var(--mdhui-background-color-0);\n --mdhui-value-selector-value-text-color: var(--mdhui-text-color-1);\n --mdhui-value-selector-button-value-selected-background-color: var(--mdhui-color-primary);\n --mdhui-value-selector-button-value-selected-text-color: #fff;\n --mdhui-value-selector-checkbox-color: var(--mdhui-text-color-4);\n --mdhui-value-selector-checkbox-selected-color: var(--mdhui-color-primary);\n padding: 16px;\n}\n\n.mdhui-value-selector-title {\n font-weight: bold;\n color: var(--mdhui-value-selector-title-color);\n margin-bottom: 4px;\n}\n\n.mdhui-value-selector-subtitle {\n font-size: 0.75em;\n color: var(--mdhui-value-selector-subtitle-color);\n margin-bottom: 12px;\n}\n\n.mdhui-value-selector-values .mdhui-unstyled-button {\n width: 100%;\n margin: 8px 0;\n}\n\n.mdhui-value-selector-value {\n display: grid;\n grid-template-columns: auto max-content;\n align-items: center;\n height: 40px;\n line-height: 40px;\n border-radius: 6px;\n background: var(--mdhui-value-selector-value-background-color);\n border: 1px solid var(--mdhui-value-selector-value-background-color);\n color: var(--mdhui-value-selector-value-text-color);\n padding: 0 16px;\n font-weight: bold;\n}\n\n.mdhui-value-selector-value:last-child {\n margin-bottom: 0;\n}\n\n.mdhui-value-selector-value-text {\n font-size: 0.85em;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.mdhui-value-selector-value-button {\n text-align: center;\n}\n\n.mdhui-value-selector-value-button.mdhui-value-selector-value-selected {\n background: var(--mdhui-value-selector-button-value-selected-background-color);\n border: 1px solid var(--mdhui-value-selector-button-value-selected-background-color);\n color: var(--mdhui-value-selector-button-value-selected-text-color);\n}\n\n.mdhui-value-selector-value-checkbox {\n padding-right: 0;\n}\n\n.mdhui-value-selector-value-checkbox-icon {\n width: 48px;\n font-size: 0.95em;\n justify-self: center;\n color: var(--mdhui-value-selector-checkbox-color);\n}\n\n.mdhui-value-selector-value-checkbox-icon-selected {\n color: var(--mdhui-value-selector-checkbox-selected-color);\n}\n\n\n");function bSe(e){let a=r(Ga);return e.title||e.subtitle?t.createElement("div",{className:"mdhui-view-header"},t.createElement("div",{className:"mdhui-view-header-text"},e.title&&t.createElement("div",{style:{color:je(a.colorScheme,e.titleColor)},className:"mdhui-view-header-title"},e.title),e.subtitle&&t.createElement("div",{style:{color:je(a.colorScheme,e.subtitleColor)},className:"mdhui-view-header-subtitle"},e.subtitle)),t.createElement("div",{className:"mdhui-view-header-action"},e.action)):null}A(".mdhui-view-header {\n padding: 32px 16px;\n display: grid;\n grid-template-columns: auto max-content;\n align-content: center;\n}\n\n.mdhui-view-header .mdhui-view-header-title {\n font-weight: 700;\n font-size: 2em;\n margin-bottom: 8px;\n color: var(--mdhui-text-color-0);\n}\n\n.mdhui-view-header .mdhui-view-header-subtitle {\n font-weight: 500;\n color: var(--mdhui-text-color-2);\n font-size: 1.2em;\n}");function wSe(e){const a=s(null);l((()=>{if(e.onStartDateChange){var t=nd((function(n){0==a.current?.scrollLeft?(e.onStartDateChange(cn(e.startDate,{weeks:-1})),a.current?.removeEventListener("scroll",t)):a.current?.clientWidth&&a.current?.scrollLeft==2*a.current.clientWidth&&(e.onStartDateChange(cn(e.startDate,{weeks:1})),a.current?.removeEventListener("scroll",t))}),500);return a.current?.addEventListener("scroll",t),()=>{a.current?.removeEventListener("scroll",t)}}}),[e.startDate]);for(var n=[],i=[],r=[],o=cn(e.startDate,{days:-7}),c=0;c<21;c++)c<7?n.push(o):c<14?i.push(o):r.push(o),o=cn(o,{days:1});function u(e){return t.createElement("div",{className:"mdhui-week-calendar-date-label"},t.createElement("div",{className:"mdhui-week-calendar-day-of-week"}," ",rl(e)),t.createElement("div",{className:"mdhui-week-calendar-day-of-month"},bl(tl(e),"d")))}function d(t){var a=["mdhui-week-calendar-day"];return t>new Date?a.push("mdhui-week-calendar-day-future"):e.onDateSelected&&a.push("mdhui-week-calendar-day-selectable"),e.selectedDate&&_i(t).substr(0,10)==_i(e.selectedDate).substr(0,10)&&a.push("mdhui-week-calendar-day-selected"),a}return l((()=>{a.current&&(a.current.scrollLeft=window.innerWidth)})),a.current&&(a.current.scrollLeft=window.innerWidth),t.createElement("div",{ref:e.innerRef},t.createElement("div",{className:"mdhui-week-calendar",ref:a},e.loading&&t.createElement("div",{className:"mdhui-week-calendar-loading"},t.createElement(XA,null)),t.createElement("div",{className:"mdhui-week-calendar-week"},n.map((a=>t.createElement("div",{key:a.getTime(),className:"mdhui-week-calendar-day"},e.dayRenderer(a.getFullYear(),a.getMonth(),a.getDate(),!1),!e.hideDateLabel&&u(a))))),t.createElement("div",{className:"mdhui-week-calendar-week"},i.map((a=>t.createElement(S,{key:a.getTime(),className:d(a).join(" "),onClick:()=>function(t){t>new Date||e.onDateSelected&&e.onDateSelected(t)}(a)},e.dayRenderer(a.getFullYear(),a.getMonth(),a.getDate(),!0),!e.hideDateLabel&&u(a))))),cn(e.startDate,{days:7})<new Date&&t.createElement("div",{className:"mdhui-week-calendar-week"},r.map((a=>t.createElement("div",{key:a.getTime(),className:d(a).join(" ")},e.dayRenderer(a.getFullYear(),a.getMonth(),a.getDate(),!1),!e.hideDateLabel&&u(a)))))))}A(".mdhui-week-calendar {\n background: var(--mdhui-background-color-0);\n overflow-x: scroll;\n overflow-y: hidden;\n z-index: 0;\n position: relative;\n display: flex;\n scroll-snap-type: x mandatory;\n scrollbar-width: none;\n border-top: solid 1px var(--mdhui-border-color-1);\n border-bottom: solid 1px var(--mdhui-border-color-1);\n}\n\n.mdhui-week-calendar .mdhui-week-calendar-loading {\n position: absolute;\n width: 100%;\n left: 100%;\n top: calc(50% - 10px);\n}\n\n.mdhui-week-calendar * {\n user-select: none;\n}\n\n.mdhui-week-calendar::-webkit-scrollbar {\n display: none;\n /* Safari and Chrome */\n}\n\n.mdhui-week-calendar .mdhui-week-calendar-week {\n min-width: 100%;\n scroll-snap-align: start;\n display:flex;\n}\n\n.mdhui-week-calendar .mdhui-week-calendar-day {\n border-left: solid 1px var(--mdhui-border-color-1);\n overflow: hidden;\n position: relative;\n display: inline-block;\n vertical-align: top;\n flex: 1;\n}\n\n.mdhui-week-calendar .mdhui-week-calendar-day:first-child {\n width: 14.28%;\n border-left: none;\n}\n\n.mdhui-week-calendar .mdhui-week-calendar-date-label {\n padding-top: 4px;\n line-height: 16px;\n padding-bottom: 8px;\n text-align: center;\n}\n\n.mdhui-week-calendar .mdhui-week-calendar-date-label .mdhui-week-calendar-day-of-week {\n font-size: 10px;\n}\n\n.mdhui-week-calendar .mdhui-week-calendar-date-label .mdhui-week-calendar-day-of-month {\n font-size: 14px;\n display: inline-block;\n text-align: center;\n width: 24px;\n height: 24px;\n border-radius: 24px;\n line-height: 24px;\n margin-top: 2px;\n margin-bottom: 2px;\n}\n\n.mdhui-week-calendar .mdhui-week-calendar-day-selectable {\n cursor: pointer;\n}\n\n.mdhui-week-calendar .mdhui-week-calendar-day-selected {\n background: var(--mdhui-background-color-1);\n}\n\n.mdhui-week-calendar .mdhui-week-calendar-day-selected .mdhui-week-calendar-date-label .mdhui-week-calendar-day-of-month {\n background-color: var(--mdhui-color-primary);\n color: #FFF;\n font-weight: bold;\n}\n\n.mdhui-week-calendar .mdhui-week-calendar-day-future>* {\n opacity: .4;\n}");function xSe(e){return t.createElement("div",{className:"mdhui-inbox-completed-list-item",ref:e.innerRef},e.onClick&&t.createElement(Za,{title:e.name,subtitle:e.status,onClick:()=>e.onClick()}),!e.onClick&&t.createElement(aS,null,t.createElement("div",{className:"mdhui-inbox-completed-list-item-name"},e.name),t.createElement("div",{className:"mdhui-inbox-completed-list-item-status"},e.status)))}A(".mdhui-inbox-completed-list-item {\n background: var(--mdhui-background-color-0);\n border-radius: 12px;\n margin: 12px 16px;\n}\n\n.mdhui-inbox-completed-list-item .mdhui-action, .mdhui-inbox-completed-list-item .mdhui-card {\n border-radius: 12px;\n padding: 16px;\n margin: 12px 0;\n box-shadow: var(--mdhui-box-shadow-0);\n}\n\n.mdhui-inbox-completed-list-item .mdhui-action .title, .mdhui-inbox-completed-list-item-name {\n font-weight: bold;\n font-size: 1.05em;\n}\n\n.mdhui-inbox-completed-list-item .mdhui-action .subtitle, .mdhui-inbox-completed-list-item-status {\n color: var(--mdhui-text-color-2);\n font-size: 0.7em;\n margin-top: 4px;\n}");function kSe(e){return"incomplete"===e.message.status?t.createElement("div",{className:"mdhui-inbox-message-list-item",ref:e.innerRef},t.createElement(Za,{title:e.message.title,onClick:()=>e.onClick()})):"complete"===e.message.status?t.createElement(xSe,{name:e.message.title,status:no("inbox-message-completed-status"),onClick:()=>e.onClick(),innerRef:e.innerRef}):null}function ASe(e){return"incomplete"===e.resource.status?t.createElement("div",{className:"mdhui-inbox-resource-list-item",ref:e.innerRef},t.createElement(aSe,{imageUrl:e.resource.imageUrl,title:e.resource.title,subTitle:e.resource.subTitle,imageAlignment:e.imageAlignment,buttonVariant:e.buttonVariant,buttonText:e.buttonText,onClick:()=>e.onClick()})):"complete"===e.resource.status?t.createElement(xSe,{name:e.resource.title,status:no("inbox-resource-completed-status"),onClick:()=>e.onClick(),innerRef:e.innerRef}):null}A(".mdhui-inbox-message-list-item {\n background: var(--mdhui-background-color-0);\n border-radius: 12px;\n margin: 12px 16px;\n box-shadow: var(--mdhui-box-shadow-0);\n}\n\n.mdhui-inbox-message-list-item .mdhui-action .title {\n font-size: 1.05em;\n}\n");function SSe(e){return"incomplete"===e.survey.status?t.createElement("div",{className:"mdhui-inbox-survey-list-item",ref:e.innerRef},t.createElement(hSe,{task:{surveyName:e.survey.name,surveyDisplayName:e.survey.displayName??e.survey.name,surveyDescription:e.survey.description,endDate:e.survey.endDate,status:e.survey.status,hasSavedProgress:e.survey.hasRestorationData,dueDate:e.survey.dueDate},variant:e.variant,surveyActive:e.surveyActive,onClick:()=>e.onClick()})):"complete"===e.survey.status?t.createElement(xSe,{name:e.survey.name,status:no("inbox-survey-completed-status"),innerRef:e.innerRef}):null}A(".mdhui-inbox-survey-list-item {\n background: var(--mdhui-background-color-0);\n border-radius: 12px;\n margin: 12px 16px;\n box-shadow: var(--mdhui-box-shadow-0);\n}");class ESe{constructor(e){this.participantInfo=e}getId(){return this.participantInfo.participantID}getFirstName(){return this.participantInfo.demographics.firstName}hasPairedDevice(){return"Yes"===this.getCustomFieldValue("DevicePaired")}hasEstablishedBaseline(){return this.hasEstablishedBaselineByType("DaytimeRestingHeartRateBaseline")||this.hasEstablishedBaselineByType("NighttimeRestingHeartRateBaseline")||this.hasEstablishedBaselineByType("RespiratoryRateBaseline")||this.hasEstablishedBaselineByType("StepsBaseline")||this.hasEstablishedBaselineByType("SleepDisturbancesBaseline")||this.hasEstablishedBaselineByType("DaytimeBloodOxygenLevelBaseline")||this.hasEstablishedBaselineByType("NighttimeBloodOxygenLevelBaseline")}getHomeAirQualityZipCode(){return this.getCustomFieldValue("HomePostalCode")}getWorkAirQualityZipCode(){return this.getCustomFieldValue("WorkPostalCode")}getActionPlanTaskRunUUID(){return this.getCustomFieldValue("AAPTaskRunUUID")}getAlertTakeover(){return this.getCustomFieldValue("AlertTakeover")}getParticipantMode(){return this.getCustomFieldValue("ParticipantMode")??"Self"}getCareRecipientName(){return this.getCustomFieldValue("CareRecipientName")}getDaytimeRestingHeartRateBaseline(){return this.getBaseline("DaytimeRestingHeartRateBaseline")}getNighttimeRestingHeartRateBaseline(){return this.getBaseline("NighttimeRestingHeartRateBaseline")}getRespiratoryRateBaseline(){return this.getBaseline("RespiratoryRateBaseline")}getStepsBaseline(){return this.getBaseline("StepsBaseline")}getSleepDisturbancesBaseline(){return this.getBaseline("SleepDisturbancesBaseline")}getDaytimeBloodOxygenLevelBaseline(){return this.getBaseline("DaytimeBloodOxygenLevelBaseline")}getNighttimeBloodOxygenLevelBaseline(){return this.getBaseline("NighttimeBloodOxygenLevelBaseline")}hasEstablishedBaselineByType(e){return this.getCustomFieldValue(e).trim().length>0}getBaseline(e){let t=this.getCustomFieldValue(e);if(t&&t.trim().length>0)return Number(t.trim())}getCustomFieldValue(e){let t=this.participantInfo.customFields;return t.hasOwnProperty(e)?t[e]??"":""}}const _Se=e=>_i(e,{representation:"date"}),CSe=(e,t)=>{let a=_Se(t),n=e.find((e=>e.identifier===a));if(n){let a,n=(e=>{let t=[];for(let a=0;a<7;a++)t.push(cn(new Date(e),{days:-a}));return t})(t),i=((e,t)=>{let a=t.map(_Se);return e.filter((e=>a.includes(e.identifier)))})(e,n),r=i.reduce(((e,t)=>e+("none"!==t.symptomLevel?1:0)),0),o=i.reduce(((e,t)=>e+(t.impacts.includes("Wake up at night")?1:0)),0),s=i.reduce(((e,t)=>e+(t.impacts.includes("Limit your daily activity")?1:0)),0),l=i.reduce(((e,t)=>e+(t.impacts.includes("Use your rescue inhaler")?1:0)),0),c=i.length;return a=o>0||s>0||l>=3||r>=3?"not-controlled":c>=1&&0==o&&0==s&&0==l&&0==r||c>=3&&c-r>=2?"controlled":"not-determined",{status:a,symptomDaysPast7:r,nighttimeAwakeningDaysPast7:o,limitedActivityDaysPast7:s,inhalerUseDaysPast7:l}}return{status:"no-data"}},TSe=e=>"out-of-range"===e?no("asthma-data-status-out-of-range"):"in-range"===e?no("asthma-data-status-in-range"):"offline"===e?no("asthma-data-status-offline"):"establishing"===e?no("asthma-data-status-establishing"):"not-determined"===e?no("asthma-data-status-not-determined"):"not-found"===e?no("asthma-data-status-not-found"):"not-configured"===e?no("asthma-data-status-not-configured"):"",PSe=e=>"out-of-range"===e?"#9D5BED":"in-range"===e?"#188A83":"offline"===e?"var(--mdhui-color-warning)":"var(--mdhui-text-color-3)",OSe=e=>no("mild"===e?"asthma-symptom-level-mild":"moderate"===e?"asthma-symptom-level-moderate":"severe"===e?"asthma-symptom-level-severe":"asthma-symptom-level-none"),MSe=e=>e===no("asthma-symptom-level-mild")?"mild":e===no("asthma-symptom-level-moderate")?"moderate":e===no("asthma-symptom-level-severe")?"severe":"none",DSe=e=>e?e.map((e=>"Difficulty breathing"===e?no("asthma-symptom-difficulty-breathing"):"Wheezing"===e?no("asthma-symptom-wheezing"):"Coughing"===e?no("asthma-symptom-coughing"):"Chest tightness or pressure"===e?no("asthma-symptom-chest-tightness"):e)):[],ISe=e=>e.map((e=>e===no("asthma-symptom-difficulty-breathing")?"Difficulty breathing":e===no("asthma-symptom-wheezing")?"Wheezing":e===no("asthma-symptom-coughing")?"Coughing":e===no("asthma-symptom-chest-tightness")?"Chest tightness or pressure":e)),NSe=e=>e?e.map((e=>"Wake up at night"===e?no("asthma-impact-waking-at-night"):"Limit your daily activity"===e?no("asthma-impact-limit-daily-activity"):"Use your rescue inhaler"===e?no("asthma-impact-using-rescue-inhaler"):e)):[],jSe=e=>e.map((e=>e===no("asthma-impact-waking-at-night")?"Wake up at night":e===no("asthma-impact-limit-daily-activity")?"Limit your daily activity":e===no("asthma-impact-using-rescue-inhaler")?"Use your rescue inhaler":e)),zSe=e=>e?e.map((e=>"Cold/viral illness"===e?no("asthma-trigger-cold-illness"):"Animal exposure"===e?no("asthma-trigger-animal-exposure"):"Seasonal allergens/pollen"===e?no("asthma-trigger-seasonal-allergens"):"Exercise"===e?no("asthma-trigger-exercise"):"Smoke (tobacco or wood burning)"===e?no("asthma-trigger-smoke"):"Extreme weather changes"===e?no("asthma-trigger-weather-changes"):"Air pollution"===e?no("asthma-trigger-air-pollution"):"Strong smells"===e?no("asthma-trigger-strong-smells"):"Chemicals/cleaning supplies"===e?no("asthma-trigger-chemicals"):"Dust"===e?no("asthma-trigger-dust"):"Mold"===e?no("asthma-trigger-mold"):"Dust mites"===e?no("asthma-trigger-dust-mites"):"Rodents"===e?no("asthma-trigger-rodents"):"Cockroaches"===e?no("asthma-trigger-cockroaches"):"Taken a NSAID (non-steroidal anti-inflammatory drugs including aspirin and ibuprofen)"===e?no("asthma-trigger-nsaid"):"Taken a beta blocker"===e?no("asthma-trigger-beta-blocker"):"Had heartburn"===e?no("asthma-trigger-heartburn"):"Drank red wine"===e?no("asthma-trigger-red-wine"):"Tried any new foods"===e?no("asthma-trigger-new-foods"):"Cooked without a fan or open window"===e?no("asthma-trigger-cooked-without-ventilation"):"Had a pet sleep in your bed"===e?no("asthma-trigger-pet-in-bed"):"Burned incense or a candle"===e?no("asthma-trigger-incense-or-candle"):e)):[],RSe=e=>e.map((e=>e===no("asthma-trigger-cold-illness")?"Cold/viral illness":e===no("asthma-trigger-animal-exposure")?"Animal exposure":e===no("asthma-trigger-seasonal-allergens")?"Seasonal allergens/pollen":e===no("asthma-trigger-exercise")?"Exercise":e===no("asthma-trigger-smoke")?"Smoke (tobacco or wood burning)":e===no("asthma-trigger-weather-changes")?"Extreme weather changes":e===no("asthma-trigger-air-pollution")?"Air pollution":e===no("asthma-trigger-strong-smells")?"Strong smells":e===no("asthma-trigger-chemicals")?"Chemicals/cleaning supplies":e===no("asthma-trigger-dust")?"Dust":e===no("asthma-trigger-mold")?"Mold":e===no("asthma-trigger-dust-mites")?"Dust mites":e===no("asthma-trigger-rodents")?"Rodents":e===no("asthma-trigger-cockroaches")?"Cockroaches":e===no("asthma-trigger-nsaid")?"Taken a NSAID (non-steroidal anti-inflammatory drugs including aspirin and ibuprofen)":e===no("asthma-trigger-beta-blocker")?"Taken a beta blocker":e===no("asthma-trigger-heartburn")?"Had heartburn":e===no("asthma-trigger-red-wine")?"Drank red wine":e===no("asthma-trigger-new-foods")?"Tried any new foods":e===no("asthma-trigger-cooked-without-ventilation")?"Cooked without a fan or open window":e===no("asthma-trigger-pet-in-bed")?"Had a pet sleep in your bed":e===no("asthma-trigger-incense-or-candle")?"Burned incense or a candle":e)),LSe=e=>"unhealthy"===e?no("asthma-air-quality-description-unhealthy"):"very unhealthy"===e?no("asthma-air-quality-description-very-unhealthy"):"hazardous"===e?no("asthma-air-quality-description-hazardous"):e,FSe=(e,t)=>t<=1.2*e,BSe=(e,t)=>t<=1.15*e,HSe=(e,t)=>t<=1.15*e,qSe=(e,t)=>t>=e/2,USe=(e,t)=>t<=e+3.5,VSe=(e,t)=>{let a=100*t;return a>=95||a>=100*e-4},WSe=async(e,t,a)=>{const n=await Il({namespace:"Project",type:e,observedAfter:cn(t,{days:-1}).toISOString(),observedBefore:cn(a,{days:1}).toISOString()});let i={},r={};return n.forEach((e=>{if(!e.observationDate)return;let t=Tr(e.observationDate),a=Br(t);i[a]&&!Ci(t,r[a])||(i[a]=parseFloat(e.value),r[a]=t)})),i};var $Se;!function(e){e.Steps="Asthma.Steps",e.DaytimeRestingHeartRate="Asthma.DaytimeRestingHeartRate",e.NighttimeRestingHeartRate="Asthma.NighttimeRestingHeartRate",e.RespiratoryRate="Asthma.RespiratoryRate",e.DaytimeBloodOxygenLevel="Asthma.DaytimeBloodOxygenLevel",e.NighttimeBloodOxygenLevel="Asthma.NighttimeBloodOxygenLevel",e.SleepDisturbances="Asthma.SleepDisturbances"}($Se||($Se={})),Yc($Se.Steps,(function(e,t){return WSe("Steps",e,t)}),Oc("Project",["Steps"])),Yc($Se.DaytimeRestingHeartRate,(function(e,t){return WSe("DaytimeRestingHeartRate",e,t)}),Oc("Project",["DaytimeRestingHeartRate"])),Yc($Se.NighttimeRestingHeartRate,(function(e,t){return WSe("NighttimeRestingHeartRate",e,t)}),Oc("Project",["NighttimeRestingHeartRate"])),Yc($Se.RespiratoryRate,(function(e,t){return WSe("RespiratoryRate",e,t)}),Oc("Project",["RespiratoryRate"])),Yc($Se.DaytimeBloodOxygenLevel,(function(e,t){return WSe("DaytimeBloodOxygenLevel",e,t)}),Oc("Project",["DaytimeBloodOxygenLevel"])),Yc($Se.NighttimeBloodOxygenLevel,(function(e,t){return WSe("NighttimeBloodOxygenLevel",e,t)}),Oc("Project",["NighttimeBloodOxygenLevel"])),Yc($Se.SleepDisturbances,(function(e,t){return WSe("SleepDisturbances",e,t)}),Oc("Project",["SleepDisturbances"]));const GSe={"daytime-resting-heart-rate":"DaytimeRestingHeartRate","nighttime-resting-heart-rate":"NighttimeRestingHeartRate","respiratory-rate":"RespiratoryRate",steps:"Steps","sleep-disturbances":"SleepDisturbances","daytime-blood-oxygen-level":"DaytimeBloodOxygenLevel","nighttime-blood-oxygen-level":"NighttimeBloodOxygenLevel"},KSe={home:"HomeAirQuality",work:"WorkAirQuality"},ZSe=(e,t)=>kn(Tr(e.observationDate),Tr(t.observationDate)),YSe=e=>{let t=parseFloat(e.value);return isNaN(t)?-1:t},XSe=(e,t,a,n)=>{let i=vn(e),r=cn(i,{days:n}),o=cn(i,{days:n+1}),s=t.filter((e=>{if(e.type!==a)return!1;let t=Tr(e.observationDate);return!Ti(t,r)&&!Ci(t,o)}));if(s.length>0)return YSe(s.sort(ZSe)[0])},QSe=(e,t)=>{let a={namespace:"Project",type:["DaytimeRestingHeartRate","DaytimeRestingHeartRateBaseline","NighttimeRestingHeartRate","NighttimeRestingHeartRateBaseline","RespiratoryRate","RespiratoryRateBaseline","Steps","StepsBaseline","SleepDisturbances","SleepDisturbancesBaseline","DaytimeBloodOxygenLevel","DaytimeBloodOxygenLevelBaseline","NighttimeBloodOxygenLevel","NighttimeBloodOxygenLevelBaseline"],observedAfter:e.toISOString(),observedBefore:t.toISOString()};return w.queryDeviceData(a)},JSe=(e,t,a,n)=>t?a?e(t,a)?"in-range":"out-of-range":"offline":a?n.withValue:n.withoutValue,eEe=(e,t,a,n,i,r)=>{let o=XSe(t,a,GSe[e]+"Baseline",n-1),s=XSe(t,a,GSe[e],n);return{type:e,status:JSe(i,o,s,r),value:s}},tEe=(e,t,a,n)=>eEe("daytime-resting-heart-rate",e,t,a,FSe,n),aEe=(e,t,a,n)=>eEe("nighttime-resting-heart-rate",e,t,a,BSe,n),nEe=(e,t,a,n)=>eEe("respiratory-rate",e,t,a,HSe,n),iEe=(e,t,a,n)=>eEe("steps",e,t,a,qSe,n),rEe=(e,t,a,n)=>eEe("steps",e,t,a,((t,a)=>_r(e)&&(new Date).getHours()<19||qSe(t,a)),n),oEe=(e,t,a,n)=>eEe("sleep-disturbances",e,t,a,USe,n),sEe=(e,t,a,n)=>eEe("daytime-blood-oxygen-level",e,t,a,VSe,n),lEe=(e,t,a,n)=>eEe("nighttime-blood-oxygen-level",e,t,a,VSe,n),cEe=(e,t,a)=>{let n={namespace:"AirNowApi",type:["HomeAirQuality","WorkAirQuality"],observedAfter:e.toISOString()};return t&&(n.observedBefore=t.toISOString()),a&&(n.pageID=a),w.queryDeviceData(n)},uEe=(e,t,a,n)=>{let i,r=t.filter((t=>t.type===KSe[e]));r.length>0&&(i=a(r));let[o,s]=((e,t)=>{if(e){if(e<=100)return["in-range",void 0];if(e<=200)return["out-of-range","unhealthy"];if(e<=300)return["out-of-range","very unhealthy"];if(e<=500)return["out-of-range","hazardous"]}return[t,void 0]})(i,n);return{type:e,status:o,value:i,description:s}},dEe={loadParticipant:async function(){let e=await w.getParticipantInfo();return new ESe(e)},loadDeviceInfo:()=>w.getDeviceInfo(),loadLogEntries:async function(e,t){let a={namespace:"Project",type:["Asthma-LogEntry"]};return e&&(a.observedAfter=e.toISOString()),t&&(a.observedBefore=t.toISOString()),(await w.queryDeviceData(a)).deviceDataPoints.map((e=>JSON.parse(e.value)))},loadBiometricsForControlStatus:async function(){let e=new Date;return((e,t)=>{const a={withValue:"establishing",withoutValue:"establishing"};return[tEe(e,t,-1,a),aEe(e,t,0,a),nEe(e,t,0,a),iEe(e,t,-1,a),oEe(e,t,0,a),sEe(e,t,-1,a),lEe(e,t,0,a)]})(e,(await QSe(cn(vn(e),{days:-2}),Pn(e))).deviceDataPoints)},loadBiometricsForDate:async function(e){return((e,t)=>{const a={withValue:"not-determined",withoutValue:"not-found"};return[tEe(e,t,0,a),aEe(e,t,0,a),nEe(e,t,0,a),rEe(e,t,0,a),oEe(e,t,0,a),sEe(e,t,0,a),lEe(e,t,0,a)]})(e,(await QSe(cn(vn(e),{days:-1}),Pn(e))).deviceDataPoints)},loadAirQualitiesForControlStatus:async function(e,t){let a=await cEe(cn(new Date,{hours:-12}),Pn(Date.now(),n));var n;const i=e=>YSe(e.sort(ZSe)[0]);return[e?uEe("home",a.deviceDataPoints,i,"establishing"):{type:"home",status:"not-configured"},t?uEe("work",a.deviceDataPoints,i,"establishing"):{type:"work",status:"not-configured"}]},loadAirQualitiesForDate:async function(e){let t=await cEe(vn(e),Pn(e));const a=e=>{let t=0;return e.forEach((e=>{let a=YSe(e);a>t&&(t=a)})),t};return[uEe("home",t.deviceDataPoints,a,"not-found"),uEe("work",t.deviceDataPoints,a,"not-found")]},loadAirQualityDataPoints:async function(e){let t=[],a=await cEe(e);for(t=t.concat(a.deviceDataPoints);a.nextPageID;)a=await cEe(e,void 0,a.nextPageID),t=t.concat(a.deviceDataPoints);return t},saveLogEntry:function(e){let t={type:"Asthma-LogEntry",identifier:e.identifier,observationDate:`${e.identifier}T12:00:00-06:00`,value:JSON.stringify(e)};return w.persistDeviceData([t])},loadAlertTakeover:async function(){let e={namespace:"Project",type:["AlertTakeover"],observedAfter:Rr().toISOString()},t=(await w.queryDeviceData(e)).deviceDataPoints;if(0===t.length)return;let a=t.sort(ZSe)[0];return a.properties?.hasOwnProperty("viewed")||a.properties?.hasOwnProperty("cleared")?void 0:a},updateAlertTakeover:(e,t,a)=>(e.properties=e.properties??{},e.properties[t]=_i(new Date),a&&(e.properties.comment=a),w.persistDeviceData([e])),loadSurveyAnswers:function(e,t){let a={surveyName:e};return t&&(a.insertedAfter=_i(t)),hu(a)},checkSurveyAnswerExists:function(e){let t={surveyName:e,limit:1};return w.querySurveyAnswers(t).then((e=>!!e.surveyAnswers.length))},loadAsthmaActionPlan:async function(){let e=await w.invokeCustomApi("Asthma.ActionPlan","GET","",!0);return e?{id:e.Id,url:`data:image/jpeg;base64,${e.Content}`}:void 0}};function hEe(e,t){if("Caregiver"===e.getParticipantMode()){let a=e.getCareRecipientName();if(a)return no(t+"-caregiver",void 0,{name:a})}return no(t)}const mEe={createDataService:e=>({loadDeviceInfo:()=>Promise.resolve({}),loadParticipant:()=>Promise.resolve({getActionPlanTaskRunUUID:()=>e.includes("loading")||e.includes("loaded with action plan")?"SomeTaskRunUUID":void 0,getParticipantMode:()=>e.includes("(caregiver mode)")?"Caregiver":"Self",getCareRecipientName:()=>e.includes("(caregiver mode)")?"Leroy":void 0}),loadAsthmaActionPlan:()=>e.includes("loading")?new Promise((()=>lM)):Promise.resolve({url:"https://asthma.careevolutionapps.dev/images/sample_aap.png"})})};function pEe(e){const[a,n]=c(!0),[i,r]=c(),[o,s]=c(),[u,d]=c(),h=(e,t=0)=>{e.loadParticipant().then((a=>{s(a),a.getActionPlanTaskRunUUID()?e.loadAsthmaActionPlan().then((a=>{d(a),a||t>=5?n(!1):setTimeout((()=>h(e,t+1)),2e3)})):(d(void 0),n(!1))}))};l((()=>{n(!0);const t=e.previewState?mEe.createDataService(e.previewState):dEe;return t.loadDeviceInfo().then((e=>{r(e)})),h(t),w.on("surveyDidFinish",(()=>h(t))),()=>{w.off("surveyDidFinish",(()=>h(t)))}}),[e.previewState]);return t.createElement("div",{className:"mdhui-asthma-action-plan-manager"},t.createElement(sM,{order:2,className:"mdhui-asthma-action-plan-manager-title"},no("asthma-action-plan-manager-title")),o&&t.createElement("div",{className:"mdhui-asthma-action-plan-manager-instructions"},hEe(o,"asthma-action-plan-manager-instructions")),t.createElement(S,{className:"mdhui-asthma-action-plan-manager-learn-more",onClick:()=>{e.previewState||w.openApplication(e.learnMoreUrl,{modal:!0})}},no("asthma-action-plan-manager-learn-more")),a&&t.createElement(XA,null),!a&&u&&t.createElement("div",null,t.createElement(S,{className:"mdhui-asthma-action-plan-manager-thumbnail-wrapper",onClick:()=>(()=>{if(e.previewState)return;let t=`Authenticated/ReportViewer/ServeReport.ashx?reportId=${u.id}`;i&&["Android","iOS"].includes(i.platform)?window.webkit.messageHandlers.OpenFile.postMessage({url:t}):w.openExternalUrl("/"+t)})()},t.createElement("img",{className:"mdhui-asthma-action-plan-manager-thumbnail",alt:"thumbnail",src:u.url})),t.createElement("div",{className:"mdhui-asthma-action-plan-manager-button-panel"},t.createElement(QA,{onClick:()=>{e.previewState||(w.startSurvey(e.editActionPlanSurveyName),n(!0))}},no("asthma-action-plan-manager-edit-button-text")))),!a&&!u&&t.createElement(S,{className:"mdhui-asthma-action-plan-manager-not-found",onClick:()=>{e.previewState||(w.startSurvey(e.editActionPlanSurveyName),n(!0))}},t.createElement("div",{className:"mdhui-asthma-action-plan-manager-not-found-text"},no("asthma-action-plan-manager-not-found-text"))))}A(".mdhui-asthma-air-qualities {\n padding: 16px;\n}\n\n.mdhui-asthma-air-qualities-header {\n display: grid;\n grid-template-columns: auto max-content;\n}\n\n.mdhui-asthma-air-qualities-title {\n margin-bottom: 16px;\n}\n\n.mdhui-asthma-air-qualities-settings {\n width: 48px;\n height: 32px;\n text-align: right;\n line-height: 32px;\n font-size: 20px;\n color: var(--mdhui-color-primary);\n margin-bottom: 16px;\n}\n\n.mdhui-asthma-air-qualities-data {\n display: grid;\n grid-template-columns: 1fr 1fr;\n align-items: center;\n grid-column-gap: 16px;\n grid-row-gap: 16px;\n}\n\n.mdhui-asthma-air-qualities-setup {\n display: grid;\n grid-template-columns: 1fr;\n align-items: center;\n padding: 16px;\n border-radius: 6px;\n border: 1px solid var(--mdhui-border-color-1);\n background: var(--mdhui-background-color-0);\n min-height: 60px;\n}\n\n.mdhui-asthma-air-qualities-setup-button {\n font-size: 1.3em;\n color: var(--mdhui-color-primary);\n}\n\n.mdhui-asthma-air-qualities-setup-label {\n font-size: 0.7em;\n font-weight: bold;\n}\n");const gEe={"neither configured":{homeAirQuality:{type:"home",status:"not-configured"},workAirQuality:{type:"work",status:"not-configured"}},"one configured":{homeAirQuality:{type:"home",status:"not-configured"},workAirQuality:{type:"work",status:"establishing"}},"no data (control)":{homeAirQuality:{type:"home",status:"establishing"},workAirQuality:{type:"work",status:"establishing"}},"no data (date)":{homeAirQuality:{type:"home",status:"not-found"},workAirQuality:{type:"work",status:"not-found"}},"some data (control)":{homeAirQuality:{type:"home",status:"in-range",value:32},workAirQuality:{type:"work",status:"establishing"}},"some data (date)":{homeAirQuality:{type:"home",status:"in-range",value:32},workAirQuality:{type:"work",status:"not-found"}},"all data":{homeAirQuality:{type:"home",status:"in-range",value:32},workAirQuality:{type:"work",status:"out-of-range",value:130,description:"unhealthy"}}};function fEe(e){const[a,n]=c(!0);let[i,r]=c(),[o,s]=c();id((()=>{if(n(!0),"loading"!==e.previewState)return e.previewState?(r(gEe[e.previewState].homeAirQuality),s(gEe[e.previewState].workAirQuality),void n(!1)):void dEe.loadParticipant().then((t=>{(e.date?dEe.loadAirQualitiesForDate(e.date):dEe.loadAirQualitiesForControlStatus(t.getHomeAirQualityZipCode(),t.getWorkAirQualityZipCode())).then((e=>{r(e.find((e=>"home"===e.type))),s(e.find((e=>"work"===e.type))),n(!1)}))}))}),[],[e.previewState]);const l=()=>{!e.previewState&&e.editZipCodesSurveyName&&w.startSurvey(e.editZipCodesSurveyName)},u=e=>t.createElement(S,{onClick:()=>l()},t.createElement("div",{className:"mdhui-asthma-air-qualities-setup"},t.createElement("div",{className:"mdhui-asthma-air-qualities-setup-button"},no("asthma-air-qualities-setup-button-text")),t.createElement("div",{className:"mdhui-asthma-air-qualities-setup-label"},e))),d=t=>{e.previewState||("not-configured"===t.status&&e.editZipCodesSurveyName?w.startSurvey(e.editZipCodesSurveyName):w.openApplication(e.airQualityUrl,{modal:!0}))};return t.createElement("div",{className:"mdhui-asthma-air-qualities",ref:e.innerRef},t.createElement("div",{className:"mdhui-asthma-air-qualities-header"},t.createElement(sM,{order:2,className:"mdhui-asthma-air-qualities-title"},no("asthma-air-qualities-title")),e.editZipCodesSurveyName&&t.createElement(S,{className:"mdhui-asthma-air-qualities-settings",onClick:()=>l()},t.createElement(gge,{icon:le}))),a&&t.createElement(XA,null),!a&&t.createElement("div",{className:"mdhui-asthma-air-qualities-data"},"not-configured"===i.status&&u(no("asthma-air-qualities-home-aqi-label")),"not-configured"!==i.status&&t.createElement(lSe,{label:no("asthma-air-qualities-home-aqi-label"),statusText:LSe(i.description)??TSe(i.status),statusColor:PSe(i.status),value:wl(i.value),onClick:()=>d(i)}),"not-configured"===o.status&&u(no("asthma-air-qualities-work-aqi-label")),"not-configured"!==o.status&&t.createElement(lSe,{label:no("asthma-air-qualities-work-aqi-label"),statusText:LSe(o.description)??TSe(o.status),statusColor:PSe(o.status),value:wl(o.value),onClick:()=>d(o)})))}function yEe(e){const[a,n]=c(!0);id((()=>{n(!0),e.previewState?n("loading"===e.previewState):dEe.loadLogEntries(cn(new Date,{days:-2})).then((e=>{let t=_Se(new Date),a=e.find((e=>e.identifier===t));a?w.dismiss():n(!1)}))}),[],[e.previewState]);return t.createElement("div",{className:"mdhui-asthma-alert-takeover-notice",ref:e.innerRef},t.createElement("div",{className:"mdhui-asthma-alert-takeover-notice-message"},e.message),t.createElement("div",{className:"mdhui-asthma-alert-takeover-notice-instructions"},no("asthma-alert-takeover-notice-instructions")),t.createElement("div",{className:"mdhui-asthma-alert-takeover-notice-buttons"},a&&t.createElement(XA,null),!a&&t.createElement("div",null,t.createElement(QA,{className:"mdhui-asthma-alert-takeover-notice-button",onClick:()=>{e.previewState||(n(!0),w.startSurvey(e.logEntrySurveyName))}},no("asthma-alert-takeover-notice-add-entry-button-text")),t.createElement(QA,{className:"mdhui-asthma-alert-takeover-notice-button",variant:"light",onClick:()=>{e.previewState||w.dismiss()}},no("asthma-alert-takeover-notice-not-now-button-text")))))}function vEe(e){return id((()=>{e.previewState||dEe.loadParticipant().then((t=>{dEe.loadAlertTakeover().then((a=>{a&&(t.getAlertTakeover()?dEe.loadLogEntries(cn(new Date,{days:-2})).then((t=>{let n=_Se(new Date);t.find((e=>e.identifier===n))?dEe.updateAlertTakeover(a,"cleared","The user has already logged today.").then():dEe.updateAlertTakeover(a,"viewed").then((()=>{var t;"DaytimeRestingHeartRate"===(t=a.value)||"NighttimeRestingHeartRate"===t||"RespiratoryRate"===t||"DaytimeBloodOxygenLevel"===t||"NighttimeBloodOxygenLevel"===t?w.openApplication(e.heartAndLungsUrl+"?alert="+t,{modal:!0}):"Steps"===t?w.openApplication(e.activityUrl+"?alert="+t,{modal:!0}):"SleepDisturbances"===t?w.openApplication(e.sleepUrl+"?alert="+t,{modal:!0}):"HomeAirQuality"===t||"WorkAirQuality"===t?w.openApplication(e.airQualityUrl+"?alert="+t,{modal:!0}):t.includes(",")&&w.openApplication(e.alertTakeoverUrl,{modal:!0})}))})):dEe.updateAlertTakeover(a,"cleared","The alert is no longer valid.").then())}))}))})),null}A(".mdhui-asthma-alert-takeover-notice {\n padding: 16px;\n text-align: center;\n}\n\n.mdhui-asthma-alert-takeover-notice-message {\n font-size: 1.6em;\n font-weight: bold;\n margin: 16px 0;\n}\n\n.mdhui-asthma-alert-takeover-notice-instructions {\n font-size: 1.2em;\n}\n\n.mdhui-asthma-alert-takeover-notice-buttons {\n margin-top: 32px;\n}\n\n.mdhui-asthma-alert-takeover-notice-button {\n margin: 12px 0;\n}");A(".mdhui-asthma-biometrics {\n padding: 16px;\n}\n\n.mdhui-asthma-biometrics-title {\n margin-bottom: 16px;\n}\n\n.mdhui-asthma-biometrics-data {\n display: grid;\n grid-template-columns: 1fr 1fr;\n align-items: center;\n grid-column-gap: 16px;\n grid-row-gap: 16px;\n}\n");const bEe={"no data":{daytimeRestingHeartRate:{type:"daytime-resting-heart-rate",status:"establishing"},nighttimeRestingHeartRate:{type:"nighttime-resting-heart-rate",status:"establishing"},respiratoryRate:{type:"respiratory-rate",status:"establishing"},steps:{type:"steps",status:"establishing"},sleepDisturbances:{type:"sleep-disturbances",status:"establishing"},daytimeBloodOxygenLevel:{type:"daytime-blood-oxygen-level",status:"establishing"},nighttimeBloodOxygenLevel:{type:"nighttime-blood-oxygen-level",status:"establishing"}},"some data":{daytimeRestingHeartRate:{type:"daytime-resting-heart-rate",status:"in-range",value:64.45},nighttimeRestingHeartRate:{type:"nighttime-resting-heart-rate",status:"offline",value:60.975},respiratoryRate:{type:"respiratory-rate",status:"establishing"},steps:{type:"steps",status:"out-of-range",value:12909},sleepDisturbances:{type:"sleep-disturbances",status:"establishing"},daytimeBloodOxygenLevel:{type:"daytime-blood-oxygen-level",status:"establishing"},nighttimeBloodOxygenLevel:{type:"nighttime-blood-oxygen-level",status:"in-range",value:.969}},"all data":{daytimeRestingHeartRate:{type:"daytime-resting-heart-rate",status:"in-range",value:64.45},nighttimeRestingHeartRate:{type:"nighttime-resting-heart-rate",status:"offline",value:60.975},respiratoryRate:{type:"respiratory-rate",status:"in-range",value:20.223},steps:{type:"steps",status:"out-of-range",value:12909},sleepDisturbances:{type:"sleep-disturbances",status:"establishing",value:4},daytimeBloodOxygenLevel:{type:"daytime-blood-oxygen-level",status:"in-range",value:.954456},nighttimeBloodOxygenLevel:{type:"nighttime-blood-oxygen-level",status:"in-range",value:.969}}};function wEe(e){const[a,n]=c(!0);let[i,r]=c(),[o,s]=c(),[l,u]=c(),[d,h]=c(),[m,p]=c(),[g,f]=c(),[y,v]=c();id((()=>{if(n(!0),"loading"===e.previewState)return;if(e.previewState)return r(bEe[e.previewState].daytimeRestingHeartRate),s(bEe[e.previewState].nighttimeRestingHeartRate),u(bEe[e.previewState].respiratoryRate),h(bEe[e.previewState].steps),p(bEe[e.previewState].sleepDisturbances),f(bEe[e.previewState].daytimeBloodOxygenLevel),v(bEe[e.previewState].nighttimeBloodOxygenLevel),void n(!1);(e.date?dEe.loadBiometricsForDate(e.date):dEe.loadBiometricsForControlStatus()).then((e=>{r(e.find((e=>"daytime-resting-heart-rate"===e.type))),s(e.find((e=>"nighttime-resting-heart-rate"===e.type))),u(e.find((e=>"respiratory-rate"===e.type))),h(e.find((e=>"steps"===e.type))),p(e.find((e=>"sleep-disturbances"===e.type))),f(e.find((e=>"daytime-blood-oxygen-level"===e.type))),v(e.find((e=>"nighttime-blood-oxygen-level"===e.type))),n(!1)}))}),[],[e.previewState]);const b=t=>{e.previewState||("daytime-resting-heart-rate"===t||"nighttime-resting-heart-rate"===t||"respiratory-rate"===t||"daytime-blood-oxygen-level"===t||"nighttime-blood-oxygen-level"===t?w.openApplication(e.heartAndLungsUrl,{modal:!0}):"steps"===t?w.openApplication(e.activityUrl,{modal:!0}):"sleep-disturbances"===t&&w.openApplication(e.sleepUrl,{modal:!0}))};return t.createElement("div",{className:"mdhui-asthma-biometrics",ref:e.innerRef},t.createElement(sM,{order:2,className:"mdhui-asthma-biometrics-title"},no("asthma-biometrics-title")),a&&t.createElement(XA,null),!a&&t.createElement("div",{className:"mdhui-asthma-biometrics-data"},t.createElement(lSe,{label:no("asthma-biometrics-daytime-resting-heart-rate-label"),statusText:TSe(i.status),statusColor:PSe(i.status),value:i.value?wl(i.value):void 0,units:no("asthma-biometrics-beats-per-minute-units"),onClick:()=>b("daytime-resting-heart-rate")}),t.createElement(lSe,{label:no("asthma-biometrics-nighttime-resting-heart-rate-label"),statusText:TSe(o.status),statusColor:PSe(o.status),value:o.value?wl(o.value):void 0,units:no("asthma-biometrics-beats-per-minute-units"),onClick:()=>b("nighttime-resting-heart-rate")}),t.createElement(lSe,{label:no("asthma-biometrics-respiratory-rate-label"),statusText:TSe(l.status),statusColor:PSe(l.status),value:l.value?wl(l.value):void 0,units:no("asthma-biometrics-breaths-per-minute-units"),onClick:()=>b("respiratory-rate")}),t.createElement(lSe,{label:no("asthma-biometrics-steps-label"),statusText:TSe(d.status),statusColor:PSe(d.status),value:wl(d.value),onClick:()=>b("steps")}),t.createElement(lSe,{label:no("asthma-biometrics-daytime-blood-oxygen-level-label"),statusText:TSe(g.status),statusColor:PSe(g.status),value:g.value?wl(100*g.value):void 0,onClick:()=>b("daytime-blood-oxygen-level"),units:no("asthma-biometrics-percent-units")}),t.createElement(lSe,{label:no("asthma-biometrics-nighttime-blood-oxygen-level-label"),statusText:TSe(y.status),statusColor:PSe(y.status),value:y.value?wl(100*y.value):void 0,onClick:()=>b("nighttime-blood-oxygen-level"),units:no("asthma-biometrics-percent-units")}),t.createElement(lSe,{label:no("asthma-biometrics-sleep-disturbances-label"),statusText:TSe(m.status),statusColor:PSe(m.status),value:wl(m.value),onClick:()=>b("sleep-disturbances")})))}A(".mdhui-asthma-control-calendar-log-entries .mdhui-action .title {\n font-size: 0.8em;\n color: var(--mdhui-text-color-3);\n margin-bottom: 4px\n}\n\n.mdhui-asthma-control-calendar-log-entries .mdhui-action .subtitle {\n font-size: 1.17em;\n font-weight: 500;\n}\n\n.mdhui-asthma-control-calendar-log-entries .mdhui-unstyled-button {\n border-radius: var(--mdhui-card-border-radius);\n}\n\n.mdhui-asthma-control-calendar-log-entry-components {\n display: grid;\n grid-template-columns: max-content max-content max-content auto;\n grid-column-gap: 8px;\n align-items: center;\n padding: 0 16px 16px;\n}\n\n.mdhui-asthma-control-calendar-log-entry-component {\n display: grid;\n grid-template-columns: max-content auto;\n align-items: center;\n height: 24px;\n line-height: 24px;\n border-radius: 12px;\n font-size: 0.8em;\n padding: 0 8px;\n color: #000;\n}\n\n.mdhui-asthma-control-calendar-log-entry-component-symptoms {\n background: #f9debf;\n}\n\n.mdhui-asthma-control-calendar-log-entry-component-impacts {\n background: #e6d6fa;\n}\n\n.mdhui-asthma-control-calendar-log-entry-component-triggers {\n background: #bfbfbf;\n}\n\n.mdhui-asthma-control-calendar-log-entry-component-icon {\n width: 12px;\n height: 12px;\n border-radius: 50%;\n margin-right: 4px;\n}\n\n.mdhui-asthma-control-calendar-log-entry-component-symptoms .mdhui-asthma-control-calendar-log-entry-component-icon {\n background: #E87C00;\n}\n\n.mdhui-asthma-control-calendar-log-entry-component-impacts .mdhui-asthma-control-calendar-log-entry-component-icon {\n background: #9D5BED;\n}\n\n.mdhui-asthma-control-calendar-log-entry-component-triggers .mdhui-asthma-control-calendar-log-entry-component-icon {\n background: #000000;\n}\n");const xEe=(e,t)=>({identifier:_Se(cn(new Date,{days:-e})),symptomLevel:t,symptoms:[],impacts:[],triggers:[]}),kEe={"no logs":{logEntries:[]},"some logs":{logEntries:[xEe(20,"none"),{...xEe(19,"mild"),impacts:["Limit your daily activity"]},xEe(17,"none"),xEe(16,"none"),xEe(15,"none"),xEe(8,"mild"),xEe(8,"none"),xEe(7,"none"),xEe(6,"none"),xEe(5,"none"),xEe(4,"none"),xEe(3,"none"),xEe(2,"mild"),{...xEe(1,"mild"),symptoms:["Difficulty breathing"],impacts:["Limit your daily activity"],triggers:["Smoke (tobacco or wood burning)"]},{...xEe(0,"mild"),impacts:["Limit your daily activity"]}]}};function AEe(e){const a=r(rM),[n,i]=c([]);id((()=>{e.previewState?i(kEe[e.previewState].logEntries):dEe.loadLogEntries().then((e=>{i(e)}))}),[],[e.previewState]);const o={"not-determined":{style:{background:"var(--mdhui-background-color-0)",border:"3px dashed var(--mdhui-text-color-0)",color:"var(--mdhui-text-color-0)",fontWeight:600,marginTop:"-12px"}},"not-controlled":{style:{background:"#F86A5C",border:"3px solid #F86A5C",color:"#fff",fontWeight:600,marginTop:"-12px"}},controlled:{style:{background:"var(--mdhui-background-color-0)",border:"3px solid #35A6A0",color:"#35A6A0",fontWeight:600,marginTop:"-12px"}},today:{style:{border:"3px solid #369CFF"}},future:{style:{background:"var(--mdhui-background-color-0)",border:"3px solid var(--mdhui-background-color-0)",color:"var(--mdhui-text-color-3)",fontWeight:600,marginTop:"-12px"}},"no-data":{style:{background:"var(--mdhui-background-color-0)",border:"3px solid var(--mdhui-background-color-0)",color:"var(--mdhui-text-color-0)",fontWeight:600,marginTop:"-12px"}}},s=e=>{let t=CSe(n,e).status;return"not-determined"===t?"not-determined":"not-controlled"===t?"not-controlled":"controlled"===t?"controlled":Sn(e,new Date)?"today":Ci(e,new Date)?"future":"no-data"},l=t=>{e.previewState||Ci(t,new Date)||w.openApplication(e.dayViewUrl+"?date="+_i(t,{representation:"date"}),{modal:!0})};let u=a?.intervalStart??e.intervalStart??In(new Date);return t.createElement("div",null,t.createElement(oSe,{noTopMargin:!0,style:{boxShadow:"none",marginBottom:"0"}},t.createElement(JA,{innerRef:e.innerRef,className:"mdhui-asthma-control-calendar",year:u.getFullYear(),month:u.getMonth(),dayRenderer:(e,a,n)=>t.createElement(eS,{year:e,month:a,day:n,stateConfiguration:o,computeStateForDay:s,onClick:l})})),"verbose"===e.variant&&(()=>{if(0===n.length)return null;let e=Rr(),a={},i=[...n].sort(((e,t)=>e.identifier.localeCompare(t.identifier)))[0],r=Tr(i.identifier);for(let t=0;t<=_n(e,r);t++){let e=cn(r,{days:t});if(!Ti(e,u)&&Ti(e,cn(u,{months:1}))){let t=_Se(e);a[t]=n.find((e=>e.identifier===t))}}return t.createElement("div",{className:"mdhui-asthma-control-calendar-log-entries"},Object.keys(a).sort().reverse().map(((n,i)=>{let r=Tr(n),o=a[n];return t.createElement(aS,{key:i},t.createElement(Za,{title:sl(r),subtitle:o?OSe(o.symptomLevel):_n(e,r)>=2?no("asthma-control-calendar-daily-entry-missed"):no("asthma-control-calendar-not-logged-yet"),onClick:()=>l(r)}),o&&(o.symptoms&&o.symptoms.length>0||o.impacts&&o.impacts.length>0||o.triggers&&o.triggers.length>0)&&t.createElement("div",{className:"mdhui-asthma-control-calendar-log-entry-components"},o.symptoms&&o.symptoms.length>0&&t.createElement(SEe,{className:"mdhui-asthma-control-calendar-log-entry-component-symptoms",label:no("asthma-control-calendar-log-entries-symptoms-label")}),o.impacts&&o.impacts.length>0&&t.createElement(SEe,{className:"mdhui-asthma-control-calendar-log-entry-component-impacts",label:no("asthma-control-calendar-log-entries-impacts-label")}),o.triggers&&o.triggers.length>0&&t.createElement(SEe,{className:"mdhui-asthma-control-calendar-log-entry-component-triggers",label:no("asthma-control-calendar-log-entries-triggers-label")})))})))})())}function SEe(e){return t.createElement("div",{className:["mdhui-asthma-control-calendar-log-entry-component",e.className].join(" ")},t.createElement("div",{className:"mdhui-asthma-control-calendar-log-entry-component-icon"}),t.createElement("div",{className:"mdhui-asthma-control-calendar-log-entry-component-label"},e.label))}A(".mdhui-asthma-control-status-header {\n padding: 0 16px;\n margin-bottom: 16px;\n}\n\n.mdhui-asthma-control-status-header p:first-child {\n margin-top: 0;\n}\n\n.mdhui-asthma-control-status-header p:last-child {\n margin-bottom: 0;\n}\n\n.mdhui-asthma-control-status-header-text {\n font-size: 1.4em;\n font-weight: bold;\n}\n\n.mdhui-asthma-control-status-header-controlled {\n color: #03dbcc;\n}\n\n.mdhui-asthma-control-status-header-not-controlled {\n color: #fc6666;\n}\n\n.mdhui-asthma-control-status-header-not-controlled-stats {\n display: grid;\n grid-template-columns: 1fr 1fr;\n align-items: center;\n margin-top: 8px;\n}\n\n.mdhui-asthma-control-status-header-not-controlled-stat {\n display: grid;\n grid-template-columns: max-content max-content auto;\n align-items: center;\n grid-column-gap: 8px;\n font-size: 0.8em;\n}\n\n.mdhui-asthma-control-status-header-not-controlled-stat-value {\n padding: 2px;\n height: 20px;\n width: 20px;\n line-height: 20px;\n border-radius: 50%;\n text-align: center;\n background: #fc6666;\n}\n\n.mdhui-asthma-control-status-header-not-controlled-stat-label {\n height: 30px;\n line-height: 30px;\n text-align: center;\n}\n\n.mdhui-asthma-control-status-header-data-out-of-range {\n color: #9D5BED;\n}");const EEe=(e,a)=>{if(e.includes("|||")){const n=e.split("|||");return t.createElement(t.Fragment,null,n[0],t.createElement("span",{className:a},n[1]),n[2])}return t.createElement(t.Fragment,null,e)},_Ee={"no data":{controlState:{status:"no-data"},biometrics:[],airQualities:[]},"abnormal dhr":{controlState:{status:"no-data"},biometrics:[{type:"daytime-resting-heart-rate",status:"out-of-range"}],airQualities:[]},"abnormal nhr":{controlState:{status:"no-data"},biometrics:[{type:"nighttime-resting-heart-rate",status:"out-of-range"}],airQualities:[]},"abnormal rr":{controlState:{status:"no-data"},biometrics:[{type:"respiratory-rate",status:"out-of-range"}],airQualities:[]},"abnormal activity":{controlState:{status:"no-data"},biometrics:[{type:"steps",status:"out-of-range"}],airQualities:[]},"abnormal sleep":{controlState:{status:"no-data"},biometrics:[{type:"sleep-disturbances",status:"out-of-range"}],airQualities:[]},"abnormal dbol":{controlState:{status:"no-data"},biometrics:[{type:"daytime-blood-oxygen-level",status:"out-of-range"}],airQualities:[]},"abnormal nbol":{controlState:{status:"no-data"},biometrics:[{type:"nighttime-blood-oxygen-level",status:"out-of-range"}],airQualities:[]},"abnormal home aqi":{controlState:{status:"no-data"},biometrics:[],airQualities:[{type:"home",status:"out-of-range",description:"unhealthy"}]},"abnormal work aqi":{controlState:{status:"no-data"},biometrics:[],airQualities:[{type:"work",status:"out-of-range",description:"very unhealthy"}]},"abnormal multiple":{controlState:{status:"no-data"},biometrics:[{type:"steps",status:"out-of-range"}],airQualities:[{type:"work",status:"out-of-range",description:"hazardous"}]},"not determined":{controlState:{status:"not-determined"},biometrics:[],airQualities:[]},"not controlled":{controlState:{status:"not-controlled",symptomDaysPast7:1,nighttimeAwakeningDaysPast7:1,limitedActivityDaysPast7:1,inhalerUseDaysPast7:1},biometrics:[],airQualities:[]},controlled:{controlState:{status:"controlled"},biometrics:[],airQualities:[]}};function CEe(e){let[a,n]=c(!0),[i,r]=c(),[o,s]=c(),[l,u]=c();if(id((()=>{if(n(!0),"loading"===e.previewState)return void r(void 0);if(e.previewState)return r(_Ee[e.previewState].controlState),s(_Ee[e.previewState].biometrics),u(_Ee[e.previewState].airQualities),void n(!1);let t=new Date;dEe.loadLogEntries(cn(new Date(t),{days:-10})).then((a=>{if(e.participant.hasPairedDevice()&&e.participant.hasEstablishedBaseline()){let i=dEe.loadBiometricsForControlStatus(),o=dEe.loadAirQualitiesForControlStatus(e.participant.getHomeAirQualityZipCode(),e.participant.getWorkAirQualityZipCode());Promise.all([i,o]).then((e=>{r(CSe(a,t)),s(e[0]),u(e[1]),n(!1)}))}else r(CSe(a,t)),n(!1)}))}),[],[e.previewState]),a&&!i)return null;const d=e=>{const a=EEe(e,"mdhui-asthma-control-status-header-data-out-of-range");return t.createElement("div",{className:"mdhui-asthma-control-status-header-text"},t.createElement("p",null,a," ",no("asthma-control-status-header-complete-daily-entry")))},h=(e,a)=>a?t.createElement("div",{className:"mdhui-asthma-control-status-header-not-controlled-stat"},t.createElement("div",{className:"mdhui-asthma-control-status-header-not-controlled-stat-value"},a,"x"),t.createElement("div",{className:"mdhui-asthma-control-status-header-not-controlled-stat-label"},e)):null;return t.createElement("div",{className:"mdhui-asthma-control-status-header",ref:e.innerRef},"no-data"===i.status&&(()=>{if(e.participant.hasPairedDevice()&&e.participant.hasEstablishedBaseline()){if(o.filter((e=>"out-of-range"===e.status)).length+l.filter((e=>"out-of-range"===e.status)).length>1)return d(no("asthma-control-status-header-multiple-out-of-range"));if("out-of-range"===o.find((e=>"daytime-resting-heart-rate"===e.type||"nighttime-resting-heart-rate"===e.type))?.status)return d(no("asthma-control-status-header-abnormal-heart-rate"));if("out-of-range"===o.find((e=>"respiratory-rate"===e.type))?.status)return d(no("asthma-control-status-header-abnormal-respiratory-rate"));if("out-of-range"===o.find((e=>"steps"===e.type))?.status)return d(no("asthma-control-status-header-abnormal-steps"));if("out-of-range"===o.find((e=>"sleep-disturbances"===e.type))?.status)return d(no("asthma-control-status-header-abnormal-sleep"));if("out-of-range"===o.find((e=>"daytime-blood-oxygen-level"===e.type||"nighttime-blood-oxygen-level"===e.type))?.status)return d(no("asthma-control-status-header-abnormal-blood-oxygen"));if("out-of-range"===l.find((e=>"home"===e.type))?.status){const e=no("asthma-control-status-header-abnormal-home-aqi",void 0,{aqi:LSe(l.find((e=>"home"===e.type))?.description)||""});return d(e)}if("out-of-range"===l.find((e=>"work"===e.type))?.status){const e=no("asthma-control-status-header-abnormal-work-aqi",void 0,{aqi:LSe(l.find((e=>"work"===e.type))?.description)||""});return d(e)}}return t.createElement("div",{className:"mdhui-asthma-control-status-header-text"},t.createElement("p",null,hEe(e.participant,"asthma-control-status-header-no-data")))})(),"not-determined"===i.status&&t.createElement("div",{className:"mdhui-asthma-control-status-header-text"},t.createElement("p",null,hEe(e.participant,"asthma-control-status-header-not-determined"))),"controlled"===i.status&&t.createElement("div",{className:"mdhui-asthma-control-status-header-text"},t.createElement("p",null,EEe(hEe(e.participant,"asthma-control-status-header-controlled"),"mdhui-asthma-control-status-header-controlled"))),"not-controlled"===i.status&&t.createElement("div",null,t.createElement("div",{className:"mdhui-asthma-control-status-header-text"},t.createElement("p",null,EEe(hEe(e.participant,"asthma-control-status-header-not-controlled"),"mdhui-asthma-control-status-header-not-controlled"))),t.createElement("div",{className:"mdhui-asthma-control-status-header-not-controlled-stats"},h(no("asthma-control-status-header-not-controlled-stat-symptom-days"),i.symptomDaysPast7),h(no("asthma-control-status-header-not-controlled-stat-rescue-inhaler"),i.inhalerUseDaysPast7),h(no("asthma-control-status-header-not-controlled-stat-limited-activity"),i.limitedActivityDaysPast7),h(no("asthma-control-status-header-not-controlled-stat-awakenings"),i.nighttimeAwakeningDaysPast7))))}A(".mdhui-asthma-log-entry-details {\n padding: 16px;\n}\n\n.mdhui-asthma-log-entry-details-header {\n display: grid;\n grid-template-columns: auto max-content;\n align-items: center;\n margin-bottom: 20px;\n}\n\n.mdhui-asthma-log-entry-details-header-status {\n font-size: 1.2em;\n font-weight: bold;\n}\n\n.mdhui-asthma-log-entry-details-header-add-button {\n height: 32px;\n line-height: 32px;\n border-radius: 6px;\n font-size: 0.8em;\n padding: 0 16px;\n color: #fff;\n background: #369CFF;\n}\n\n.mdhui-asthma-log-entry-details-header-edit-button {\n height: 32px;\n line-height: 32px;\n border-radius: 6px;\n font-size: 0.8em;\n padding: 0 16px;\n color: #007FF9;\n background: #BBDEFF;\n}\n\n.mdhui-unstyled-button.mdhui-asthma-log-entry-details-header-info-button {\n width: 48px;\n height: 32px;\n text-align: right;\n line-height: 32px;\n font-size: 20px;\n color: var(--mdhui-color-primary);\n}\n\n.mdhui-asthma-log-entry-details-component {\n margin-bottom: 16px;\n}\n\n.mdhui-asthma-log-entry-details-component-symptoms .mdhui-asthma-log-entry-details-component-header-icon {\n background: #E87C00;\n}\n\n.mdhui-asthma-log-entry-details-component-symptoms .mdhui-asthma-log-entry-details-component-data {\n background: #f9debf;\n color: #E87C00;\n}\n\n.mdhui-asthma-log-entry-details-component-impacts .mdhui-asthma-log-entry-details-component-header-icon {\n background: #9D5BED;\n}\n\n.mdhui-asthma-log-entry-details-component-impacts .mdhui-asthma-log-entry-details-component-data {\n background: #e6d6fa;\n color: #9D5BED;\n}\n\n.mdhui-asthma-log-entry-details-component-triggers .mdhui-asthma-log-entry-details-component-header-icon {\n background: #000000;\n}\n\n.mdhui-asthma-log-entry-details-component-triggers .mdhui-asthma-log-entry-details-component-data {\n background: #bfbfbf;\n color: #000000;\n}\n\n.mdhui-asthma-log-entry-details-component:last-child {\n margin-bottom: 0;\n}\n\n.mdhui-asthma-log-entry-details-component-header {\n display: grid;\n grid-template-columns: max-content auto;\n grid-column-gap: 4px;\n align-items: center;\n margin-bottom: 8px;\n}\n\n.mdhui-asthma-log-entry-details-component-header-icon {\n display: inline-block;\n width: 12px;\n height: 12px;\n border-radius: 50%;\n}\n\n.mdhui-asthma-log-entry-details-component-header-label {\n font-size: 0.8em;\n font-weight: bold;\n}\n\n.mdhui-asthma-log-entry-details-component-no-data {\n font-size: 0.8em;\n color: var(--mdhui-text-color-3);\n margin-left: 16px;\n}\n\n.mdhui-asthma-log-entry-details-component-data {\n display: inline-block;\n padding: 0 8px;\n height: 24px;\n line-height: 24px;\n border-radius: 12px;\n font-size: 0.7em;\n margin-top: 4px;\n margin-right: 4px;\n}");const TEe={identifier:_Se(new Date),symptomLevel:"none",symptoms:[],impacts:[],triggers:[]},PEe={"not logged":{},"logged with no symptoms":{logEntry:TEe},"logged with mild symptoms":{logEntry:{...TEe,symptomLevel:"mild",symptoms:["Coughing"],impacts:["Wake up at night","Use your rescue inhaler"],triggers:["Cold/viral illness","Seasonal allergens/pollen","Smoke (tobacco or wood burning)","Air pollution","Dust mites","Mold"]}},"logged with moderate symptoms":{logEntry:{...TEe,symptomLevel:"moderate",symptoms:["Coughing"],triggers:["Cold/viral illness","Mold"]}},"logged with severe symptoms":{logEntry:{...TEe,symptomLevel:"severe",symptoms:["Coughing","Wheezing"],impacts:["Use your rescue inhaler"]}}};function OEe(e){const[a,n]=c(!0),[i,r]=c();let o=Rr(),s=cn(new Date(o),{days:-1}),l=cn(new Date(e.date),{days:-1}),u=cn(new Date(e.date),{days:1});id((()=>{if(n(!0),"loading"!==e.previewState)return e.previewState?(r(PEe[e.previewState].logEntry),void n(!1)):void dEe.loadLogEntries(l,u).then((t=>{let a=_Se(e.date);r(t.find((e=>e.identifier===a))),n(!1)}))}),[],[e.previewState]);const d=()=>!Ti(e.date,s);return t.createElement("div",{className:"mdhui-asthma-log-entry-details",ref:e.innerRef},a&&t.createElement(XA,null),!a&&t.createElement("div",null,t.createElement("div",{className:"mdhui-asthma-log-entry-details-header"},t.createElement("div",{className:"mdhui-asthma-log-entry-details-header-status"},i?OSe(i.symptomLevel):d()?no("asthma-log-entry-details-not-logged-yet"):no("asthma-log-entry-details-not-editable")),d()?t.createElement(S,{className:"mdhui-asthma-log-entry-details-header-action",onClick:()=>{a||e.previewState||(n(!0),i?w.openApplication(e.editLogEntryUrl+"?date="+_i(e.date,{representation:"date"}),{modal:!0}):Sn(e.date,o)?w.startSurvey(e.logTodayEntrySurveyName):Sn(e.date,s)&&w.startSurvey(e.logYesterdayEntrySurveyName))}},i?t.createElement("div",{className:"mdhui-asthma-log-entry-details-header-edit-button"},no("asthma-log-entry-details-edit-button-text")):t.createElement("div",{className:"mdhui-asthma-log-entry-details-header-add-button"},no("asthma-log-entry-details-add-button-text"))):t.createElement(S,{className:"mdhui-asthma-log-entry-details-header-info-button",onClick:()=>{a||e.previewState||w.openApplication(e.infoUrl,{modal:!0})}},t.createElement(gge,{icon:ie}))),t.createElement(MEe,{className:"mdhui-asthma-log-entry-details-component-symptoms",label:no("asthma-log-entry-details-symptoms-label"),data:DSe(i?.symptoms)}),t.createElement(MEe,{className:"mdhui-asthma-log-entry-details-component-impacts",label:no("asthma-log-entry-details-impacts-label"),data:NSe(i?.impacts)}),t.createElement(MEe,{className:"mdhui-asthma-log-entry-details-component-triggers",label:no("asthma-log-entry-details-triggers-label"),data:zSe(i?.triggers)})))}function MEe(e){return t.createElement("div",{className:["mdhui-asthma-log-entry-details-component",e.className].join(" ")},t.createElement("div",{className:"mdhui-asthma-log-entry-details-component-header"},t.createElement("div",{className:"mdhui-asthma-log-entry-details-component-header-icon"}),t.createElement("div",{className:"mdhui-asthma-log-entry-details-component-header-label"},e.label)),0===e.data.length&&t.createElement("div",{className:"mdhui-asthma-log-entry-details-component-no-data"},no("asthma-log-entry-details-component-no-data",void 0,{dataType:e.label.toLowerCase()})),e.data.length>0&&e.data.map((e=>t.createElement("div",{className:"mdhui-asthma-log-entry-details-component-data"},e))))}A(".mdhui-asthma-log-entry-header {\n padding: 0 16px;\n margin-bottom: 16px;\n}\n\n.mdhui-unstyled-button.mdhui-asthma-log-entry-summary {\n display: grid;\n grid-template-columns: auto max-content;\n align-items: center;\n border-radius: 6px;\n padding: 16px;\n margin: 8px 0;\n width: 100%;\n background: var(--mdhui-background-color-1);\n}\n\n.mdhui-asthma-log-entry-summary-details {\n font-size: 0.95em;\n}\n\n.mdhui-asthma-log-entry-summary-label {\n}\n\n.mdhui-asthma-log-entry-summary-status {\n font-weight: bold;\n}\n\n.mdhui-asthma-log-entry-summary-add-button {\n height: 32px;\n line-height: 32px;\n border-radius: 16px;\n font-size: 0.8em;\n padding: 0 16px;\n color: #fff;\n background: #369CFF;\n}\n\n.mdhui-asthma-log-entry-summary-chevron {\n color: var(--mdhui-text-color-3);\n}\n\n.mdhui-asthma-log-entry-summary .mdhui-loading-indicator {\n padding: 0;\n}");const DEe={identifier:_Se(new Date),symptomLevel:"mild",symptoms:[],impacts:[],triggers:[]},IEe={"no logs":{},"today log only":{todayLogEntry:DEe},"yesterday log only":{yesterdayLogEntry:DEe},"both logs":{yesterdayLogEntry:DEe,todayLogEntry:DEe}};function NEe(e){let[a,n]=c(!0),[i,r]=c(!0),[o,s]=c(),[l,u]=c();if(id((()=>{if(r(!0),"loading"!==e.previewState)return e.previewState?(s(IEe[e.previewState].yesterdayLogEntry),u(IEe[e.previewState].todayLogEntry),r(!1),void n(!1)):void dEe.loadLogEntries(cn(new Date,{days:-3})).then((e=>{let t=vn(new Date),a=_Se(t);u(e.find((e=>e.identifier===a)));let i=vn(cn(new Date,{days:-1})),o=_Se(i);s(e.find((e=>e.identifier===o))),r(!1),n(!1)}))}),["surveyDidFinish"],[e.previewState]),a)return null;const d=(a,n,r)=>t.createElement(S,{className:"mdhui-asthma-log-entry-summary",onClick:()=>((t,a)=>{e.previewState||i||(a?w.openApplication(e.dayViewUrl+"?date="+a.identifier,{modal:!0}):w.startSurvey(t))})(n,r)},t.createElement("div",{className:"mdhui-asthma-log-entry-summary-details"},t.createElement("div",{className:"mdhui-asthma-log-entry-summary-label"},a),t.createElement("div",{className:"mdhui-asthma-log-entry-summary-status"},(e=>e?OSe(e.symptomLevel):no("asthma-log-entry-header-not-logged-yet"))(r))),t.createElement("div",{className:"mdhui-asthma-log-entry-summary-action"},i&&t.createElement(XA,null),!i&&!r&&t.createElement("div",{className:"mdhui-asthma-log-entry-summary-add-button"},no("asthma-log-entry-header-add-button-text")),!i&&r&&t.createElement(gge,{icon:Ae,className:"mdhui-asthma-log-entry-summary-chevron"})));return t.createElement("div",{className:"mdhui-asthma-log-entry-header",ref:e.innerRef},d(no("asthma-log-entry-header-today-log-label"),e.logTodayEntrySurveyName,l),d(no("asthma-log-entry-header-yesterday-log-label"),e.logYesterdayEntrySurveyName,o))}function jEe(e){const t=()=>{dEe.checkSurveyAnswerExists(e.logTodayEntrySurveyName).then((t=>{t||w.queryDeviceData({namespace:"Project",type:"LogAutoLaunched"}).then((t=>{t.deviceDataPoints.length||w.persistDeviceData([{type:"LogAutoLaunched",value:(new Date).toISOString()}]).then((()=>{w.startSurvey(e.logTodayEntrySurveyName)}))}))}))};return id((()=>{e.previewState||dEe.loadSurveyAnswers([e.postEnrollmentSurveyName,e.postEnrollmentMobileSurveyName]).then((a=>{a.find((t=>t.surveyName===e.postEnrollmentSurveyName))?a.find((t=>t.surveyName===e.postEnrollmentMobileSurveyName))?t():Promise.all([w.getParticipantInfo(),w.getDeviceInfo()]).then((([a,n])=>{"Caregiver"!==(a.customFields.ParticipantMode??"Self")&&["iOS","Android"].includes(n.platform)?w.startSurvey(e.postEnrollmentMobileSurveyName):t()})):w.startSurvey(e.postEnrollmentSurveyName)}))})),null}const zEe={createDataService:e=>({loadParticipant:()=>"loading"===e?new Promise((()=>lM)):Promise.resolve({getId:()=>"ef698523-118a-414a-bd01-ff97c6cb31f9",getFirstName:()=>"Sally",getParticipantMode:()=>"as caregiver"===e?"Caregiver":"Self",getCareRecipientName:()=>"as caregiver"===e?"Leroy":void 0}),loadLogEntries:()=>Promise.resolve([{identifier:_Se(cn(new Date,{days:-5})),symptomLevel:"none",symptoms:[],impacts:[],triggers:[]},{identifier:_Se(cn(new Date,{days:-15})),symptomLevel:"moderate",symptoms:[],impacts:["Wake up at night"],triggers:[]},{identifier:_Se(cn(new Date,{days:-25})),symptomLevel:"moderate",symptoms:[],impacts:[],triggers:[]}]),loadSurveyAnswers:(e,t)=>Promise.resolve([{stepIdentifier:"MISSED_DOSES_REASONS",answers:["Unable to afford the medications","Medications not working"]},{stepIdentifier:"MISSED_DOSES_REASONS",answers:["None of the above"]},{stepIdentifier:"MISSED_DOSES_REASONS",answers:["Don't want to run out, so purposefully skipping doses"]},{stepIdentifier:"MISSED_DOSES_REASONS",answers:["Unable to afford the medications","Difficulty getting refills","Trouble remembering to take them","I'm confused which inhaler to take when","Don't know why I should take it","Concerns over side effects","Medications not working","Don't want to run out, so purposefully skipping doses","Never learned how to take them","None of the above"]}]),loadAirQualityDataPoints:e=>Promise.resolve([])})};function REe(e){const[a,n]=c(!0),[i,r]=c(),[o,u]=c([]),[d,h]=c([]),[m,p]=c([]),g=s(null),[f,y]=c(!1),[v,b]=c();let x=Rr(),k=cn(x,{days:-89});if(l((()=>{n(!0);const t=e.previewState?zEe.createDataService(e.previewState):dEe;let a=t.loadParticipant(),i=t.loadLogEntries(k),o=t.loadSurveyAnswers(e.logEntrySurveyName,k),s=t.loadAirQualityDataPoints(k);Promise.all([a,i,o,s]).then((e=>{r(e[0]),u(e[1]),h(e[2]),p(e[3]),n(!1)}))}),[e.previewState]),a)return t.createElement(XA,{innerRef:e.innerRef});let A=i.getFirstName();if("Caregiver"===i.getParticipantMode()){const e=i.getCareRecipientName();e&&(A=e)}let S={},E=0,_=0,C=0,T=0,P=0,O=0,M=0,D=0,I=0,N=0,j=0,z=0,R=0,L=0;o.forEach((e=>{S[e.identifier]=CSe(o,Tr(e.identifier)),"none"===e.symptomLevel?E++:"mild"===e.symptomLevel?(_++,P++):"moderate"===e.symptomLevel?(C++,P++):"severe"===e.symptomLevel&&(T++,P++),e.symptoms.includes("Coughing")&&O++,e.symptoms.includes("Wheezing")&&M++,e.impacts.includes("Use your rescue inhaler")&&D++,e.impacts.includes("Limit your daily activity")&&I++,e.impacts.includes("Wake up at night")&&N++,e.triggers.includes("Animal exposure")&&j++,e.triggers.includes("Seasonal allergens/pollen")&&z++,e.triggers.includes("Smoke (tobacco or wood burning)")&&R++,e.triggers.includes("Air pollution")&&L++}));let F=0,B=0,H=[];d.forEach((e=>{"MISSED_DOSES"===e.stepIdentifier?(e.answers.includes("1 - 2 missed doses")||e.answers.includes("3 - 6 missed doses")||e.answers.includes("7 or more missed doses"))&&F++:"MISSED_DOSES_REASONS"===e.stepIdentifier&&(e.answers.length>0&&"None of the above"!==e.answers[0]&&B++,e.answers.forEach((e=>{"None of the above"===e||H.includes(e)||H.push(e)})))}));let q=m.filter((e=>"HomeAirQuality"===e.type&&parseFloat(e.value)>100)),U=new Set(q.map((e=>_i(Tr(e.observationDate),{representation:"date"})))).size,V=m.filter((e=>"WorkAirQuality"===e.type&&parseFloat(e.value)>100)),W=new Set(V.map((e=>_i(Tr(e.observationDate),{representation:"date"})))).size;const $=(e,a,n)=>{let i=Array.from({length:a},((t,a)=>a+e));return t.createElement("div",{style:{display:"flex",flexDirection:"row",width:"100%",alignItems:"center",justifyContent:"space-evenly",margin:"4px 0"}},i.map((a=>((e,a)=>{let n=cn(k,{days:e}),i=_Se(n),r=S[i],o={fill:"transparent",stroke:"#fff",strokeWidth:2},s={fontSize:"15px",fontWeight:600,textAlign:"center",lineHeight:"40px"};return"not-controlled"===r?.status?(o.fill="#F86A5C",o.stroke="#F86A5C",s.color="#fff"):"controlled"===r?.status?(o.stroke="#35A6A0",s.color="#35A6A0"):"not-determined"===r?.status&&(o.stroke="#000",o.strokeDasharray=4),t.createElement("div",{style:{textAlign:"center",padding:"1px",flexGrow:1,flexBasis:"5%"}},t.createElement("div",{style:{width:"38px",minHeight:"22px",fontSize:"16px",margin:"2px auto"}},a||1===n.getDate()?dl(n).toLocaleUpperCase():""),t.createElement("svg",{viewBox:"0 0 40px 40px",style:{height:"40px",width:"40px"}},t.createElement("circle",{cx:"20",cy:"20",r:"18",style:o}),t.createElement("foreignObject",{x:"0",y:"0",height:"40px",width:"40px"},t.createElement("div",{style:s},n.getDate()))))})(a,!!n&&e==a))))},G=(e,a,n)=>t.createElement("div",{style:{display:"flex",flexDirection:"row",margin:"2px 0"}},t.createElement("div",{style:{flexGrow:1,marginRight:"4px",fontWeight:500}},e),t.createElement("div",{style:{flexShrink:0}},a," ",n)),K=e=>{let t=`AsthmaTool-ProviderReport-${_i(new Date,{representation:"date"})}`,a=w.baseUrl+"WebVisualization/WebVisualizationPDF?patientID="+i.getId()+"&modelType=VisualizationModel&visualizationKey=Shared.HtmlToPdf&fileName="+encodeURIComponent(t);e&&["Android","iOS"].includes(e.platform)?window.webkit.messageHandlers.OpenFile.postMessage({url:a}):w.openExternalUrl(a),setTimeout((()=>{y(!1)}),2e3)};let Z=1224,Y=(window.innerWidth-32)/Z;return t.createElement("div",{style:{display:"flex",justifyContent:"center"}},t.createElement("div",{style:{position:"absolute",width:Z,height:1575,transform:"scale("+Y+")",transformOrigin:"top"}},t.createElement("div",{style:{position:"relative",padding:"32px 48px",width:Z,height:1575,boxSizing:"border-box",backgroundColor:"#fff",fontFamily:"Inter, sans-serif"},ref:g},t.createElement("div",{style:{fontSize:"32px",fontWeight:600}},A," - Asthma Tool - Provider Report"),t.createElement("div",{style:{fontSize:"24px",color:"#3b3b3b",marginBottom:"16px"}},sl(k)," - ",sl(x)," (90 ",no("days"),")"),t.createElement("div",{style:{border:"1px solid #dbdbdb",borderRadius:"10px",overflow:"hidden",marginBottom:"16px"}},t.createElement("div",{style:{display:"flex",flexDirection:"row",width:"100%",padding:"16px",borderBottom:"1px solid #dbdbdb",boxSizing:"border-box"}},t.createElement("div",{style:{flexGrow:1}},t.createElement("div",{style:{fontSize:"18px",fontWeight:700}},"Asthma Control"),t.createElement("div",{style:{fontSize:"16px",color:"#3b3b3b",marginBottom:"16px"}},"Patient reported"),t.createElement("div",{style:{display:"flex",flexDirection:"row"}},t.createElement("div",{style:{marginRight:"24px"}},t.createElement("div",{style:{fontSize:"24px",fontWeight:700}},o.length," out of 90"),t.createElement("div",null,"Daily entries logged")),t.createElement("div",{style:{marginRight:"24px"}},t.createElement("div",{style:{fontSize:"24px",fontWeight:700,color:"#F86A5C"}},o.filter((e=>"not-controlled"===S[e.identifier].status)).length," days"),t.createElement("div",null,"Not under control")),t.createElement("div",null,t.createElement("div",{style:{fontSize:"24px",fontWeight:700,color:"#35A6A0"}},o.filter((e=>"controlled"===S[e.identifier].status)).length," days"),t.createElement("div",null,"Under control")))),t.createElement("div",{style:{fontSize:"14px",fontWeight:500,paddingTop:"8px"}},t.createElement("div",{style:{display:"flex",flexDirection:"row",marginBottom:"8px"}},t.createElement("svg",{viewBox:"0 0 20 20",style:{height:"20px",width:"20px"}},t.createElement("circle",{cx:"10",cy:"10",r:"8",style:{fill:"#fff",stroke:"#35A6A0",strokeWidth:2}})),t.createElement("div",{style:{flexGrow:1,padding:"2px 8px"}},"Under control")),t.createElement("div",{style:{display:"flex",flexDirection:"row",marginBottom:"8px"}},t.createElement("svg",{viewBox:"0 0 20 20",style:{height:"20px",width:"20px"}},t.createElement("circle",{cx:"10",cy:"10",r:"8",style:{fill:"#F86A5C",stroke:"#F86A5C",strokeWidth:2}})),t.createElement("div",{style:{flexGrow:1,padding:"2px 8px"}},"Not under control")),t.createElement("div",{style:{display:"flex",flexDirection:"row",marginBottom:"8px"}},t.createElement("svg",{viewBox:"0 0 20 20",style:{height:"20px",width:"20px"}},t.createElement("circle",{cx:"10",cy:"10",r:"8",style:{fill:"#fff",stroke:"#000",strokeWidth:2,strokeDasharray:3}})),t.createElement("div",{style:{flexGrow:1,padding:"2px 8px"}},"Not enough information")))),t.createElement("div",{style:{padding:"12px 16px"}},$(0,18,!0),$(18,18),$(36,18),$(54,18),$(72,18)),t.createElement("div",{style:{fontSize:"14px",color:"#3b3b3b",backgroundColor:"#f2f2f2",padding:"16px"}},"This patient-facing digital asthma tool allows the user to create a daily entry and self-report their symptoms, use of rescue inhaler and impact on activity and nighttime awakenings. The figure above use the self-reported answers to assess asthma control, based on the ",t.createElement("a",{href:"https://www.nhlbi.nih.gov/health-topics/guidelines-for-diagnosis-management-of-asthma",target:"_blank"},"EPR-3 guidelines"),". A day is noted as not under control if in the prior week (7 days) there are more than 2 days of symptoms or rescue inhaler use or due to asthma 1 nighttime awakening or limitation in activity was recorded.")),t.createElement("div",{style:{display:"flex",flexDirection:"row",width:"100%",fontSize:"17px",marginBottom:"16px"}},t.createElement("div",{style:{flexGrow:1,flexBasis:"30%",backgroundColor:"#f2f2f2",border:"1px solid #dbdbdb",borderRadius:"10px",padding:"12px"}},t.createElement("div",{style:{marginBottom:"8px",fontWeight:700}},"Components of control"),G("Symptoms reported",P,1===P?"day":"days"),G("Rescue inhaler use",D,1===D?"day":"days"),G("Normal activities affected",I,1===I?"day":"days"),G("Nighttime awakenings",N,1===N?"day":"days")),t.createElement("div",{style:{flexGrow:1,flexBasis:"30%",backgroundColor:"#f2f2f2",border:"1px solid #dbdbdb",borderRadius:"10px",padding:"12px",margin:"0 16px"}},t.createElement("div",{style:{marginBottom:"8px",fontWeight:700}},"Symptom severity"),G("None",E,1===E?"day":"days"),G("Mild",_,1===_?"day":"days"),G("Moderate",C,1===C?"day":"days"),G("Severe",T,1===T?"day":"days")),t.createElement("div",{style:{flexGrow:1,flexBasis:"30%",backgroundColor:"#f2f2f2",border:"1px solid #dbdbdb",borderRadius:"10px",padding:"12px"}},t.createElement("div",{style:{marginBottom:"8px",fontWeight:700}},"Common symptoms"),G("Coughing",O,1===O?"day":"days"),G("Wheezing",M,1===M?"day":"days"))),t.createElement("div",{style:{display:"flex",flexDirection:"row",width:"100%",fontSize:"16px",marginBottom:"24px"}},t.createElement("div",{style:{flexGrow:1,flexBasis:"30%",backgroundColor:"#f2f2f2",border:"1px solid #dbdbdb",borderRadius:"10px",padding:"12px"}},t.createElement("div",{style:{marginBottom:"8px",fontWeight:700}},"Top 4 triggers"),G("Animal exposure",j,1===j?"report":"reports"),G("Seasonal allergens/pollen",z,1===z?"report":"reports"),G("Smoke",R,1===R?"report":"reports"),G("Air pollution",L,1===L?"report":"reports")),t.createElement("div",{style:{flexGrow:1,flexBasis:"30%",backgroundColor:"#f2f2f2",border:"1px solid #dbdbdb",borderRadius:"10px",padding:"12px",margin:"0 16px"}},t.createElement("div",{style:{marginBottom:"8px",fontWeight:700}},"Medications"),G("Missed doses",F,1===F?"report":"reports"),0===B&&G("Reported barriers to adherence",0,"reports"),B>=1&&G("Reported barriers to adherence*",B,1===B?"report":"reports"),B>=1&&t.createElement("div",{style:{fontSize:"12px",marginTop:"12px"}},"*",H.join("; "))),t.createElement("div",{style:{flexGrow:1,flexBasis:"30%",backgroundColor:"#f2f2f2",border:"1px solid #dbdbdb",borderRadius:"10px",padding:"12px"}},t.createElement("div",{style:{marginBottom:"8px",fontWeight:700}},"Days with AQI over 100"),G("Home",U>0?U:"None",1===U?"day":U>1?"days":""),G("Work",W>0?W:"None",1===W?"day":W>1?"days":""),t.createElement("div",{style:{fontSize:"12px",marginTop:"12px"}},"Source: airnow.gov"))),t.createElement("div",{style:{position:"absolute",bottom:64,left:48,right:48,fontSize:"17px"}},t.createElement("div",{style:{fontSize:"16px",fontWeight:700,marginBottom:"16px"}},"For Providers - About this tool & report:"),t.createElement("div",{style:{marginBottom:"16px"}},"This report was generated from what is logged in the Asthma Tool, powered by ",t.createElement("a",{href:"https://careevolution.com/mydatahelps/",target:"_blank"},"MyDataHelps"),". The Asthma Tool enables patients to track daily their symptoms and triggers, provides clear summaries or what they log and surfaces relevant educational content and resource links. it summarizes the user's symptom logs. This digital tool design was based on promoting self-regulation, which ",t.createElement("a",{href:"https://pubmed.ncbi.nlm.nih.gov/26252889/",target:"_blank"},"studies")," demonstrate can improve conditions such as asthma. The Asthma Tool does not recommend any changes in management or provide diagnosis."),t.createElement("div",{style:{marginBottom:"16px"}},"To provide feedback on this report or tool, please e-mail us: ",t.createElement("a",{href:"mailto:asthma@careevolution.com",target:"_blank"},"asthma@careevolution.com")),t.createElement("div",{style:{marginBottom:"16px",height:"1px",backgroundColor:"#bdbdbd"}}),t.createElement("div",null,"If you plan to share this report with your provider, be aware that communications over email, text, and other channels may not be secure because they can be sent to the wrong address or intercepted.")),t.createElement("div",{style:{position:"absolute",bottom:32,right:48,fontSize:"16px",fontWeight:500,textAlign:"right"}},"Page 1 of 1")),t.createElement("div",{style:{textAlign:"center",margin:"64px 0",transform:"scale("+1/Y+")",transformOrigin:"top"}},f&&t.createElement(XA,null),!f&&t.createElement("button",{className:"mdhui-button",onClick:()=>(()=>{if(!e.previewState&&!f)if(y(!0),v)K(v);else{let e='<head><link href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap" rel="stylesheet"></head>';e+=g.current.outerHTML,w.persistDeviceData([{type:"ReportHtml",value:e}]).then((()=>{w.getDeviceInfo().then((function(e){b(e),K(e)}))}))}})()},t.createElement("div",null,"Generate PDF ",t.createElement(gge,{icon:te}))))))}function LEe(e){const[a,n]=c();if(id((()=>{if("none"===e.previewState)return void n(void 0);if("default"===e.previewState)return void n({number:"34",image:"medications"});let t=Rr();dEe.loadLogEntries(cn(new Date(t),{days:-10})).then((a=>{let i=_Se(t),r=a.find((e=>e.identifier===i));r&&dEe.loadSurveyAnswers(e.logTodayEntrySurveyName,t).then((e=>{((e,t,a)=>{let i=[];"controlled"===t.status?i.push({number:"21",image:"asthmacontrol"}):"not-determined"===t.status?i.push({number:"22",image:"asthmacontrol"}):"not-controlled"===t.status&&i.push({number:"25",image:"asthmacontrol"}),e.triggers.includes("Seasonal allergens/pollen")&&i.push({number:"42",image:"triggers"}),e.triggers.includes("Air pollution")&&i.push({number:"43",image:"triggers"}),e.triggers.includes("Cold/viral illness")&&i.push({number:"43a",image:"triggers"}),e.triggers.includes("Animal exposure")&&i.push({number:"43b",image:"triggers"}),e.triggers.includes("Smoke (tobacco or wood burning)")&&i.push({number:"43c",image:"triggers"}),e.triggers.includes("Extreme weather changes")&&i.push({number:"43d",image:"triggers"}),(e.triggers.includes("Strong smells")||e.triggers.includes("Chemicals/cleaning supplies"))&&i.push({number:"43e",image:"triggers"}),(e.triggers.includes("Dust")||e.triggers.includes("Dust mites"))&&i.push({number:"43f",image:"triggers"}),e.triggers.includes("Mold")&&i.push({number:"43g",image:"triggers"}),e.triggers.includes("Had heartburn")&&i.push({number:"43h",image:"triggers"});const r=["Taken a NSAID (non-steroidal anti-inflammatory drugs including aspirin and ibuprofen)","Taken a beta blocker","Had heartburn","Drank red wine","Tried any new foods","Cooked without a fan or open window","Had a pet sleep in your bed","Burned incense or a candle"];e.triggers.find((e=>r.includes(e)))&&i.push({number:"41",image:"triggers"});let o=a.find((e=>"MISSED_DOSES"===e.stepIdentifier));if(o&&(o.answers.includes("No controller med")&&i.push({number:"32",image:"medications"}),o.answers.includes("No missed doses"))){let e=a.find((e=>"MISSED_DOSES_INHALER_TYPE"===e.stepIdentifier));e&&(e.answers.includes("Metered-dose inhaler (MDI)")&&i.push({number:"37a",image:"medications"}),e.answers.includes("Dry-powder inhaler (DPI)")&&i.push({number:"37b",image:"medications"}),e.answers.includes("Soft mist inhaler")&&i.push({number:"37c",image:"medications"}),e.answers.includes("Nebulizer")&&i.push({number:"37d",image:"medications"}))}let s=a.find((e=>"MISSED_DOSES_REASONS"===e.stepIdentifier));s&&((s.answers.includes("Unable to afford the medications")||s.answers.includes("Don't want to run out, so purposefully skipping doses"))&&i.push({number:"33",image:"medications"}),s.answers.includes("Difficulty getting refills")&&i.push({number:"34",image:"medications"}),s.answers.includes("Trouble remembering to take them")&&i.push({number:"35",image:"medications"}),s.answers.includes("I'm confused which inhaler to take when")&&i.push({number:"36",image:"medications"}),s.answers.includes("Don't know why I should take it")&&i.push({number:"38",image:"medications"}),s.answers.includes("Concerns over side effects")&&i.push({number:"39",image:"medications"}),s.answers.includes("Medications not working")&&i.push({number:"39a",image:"medications"})),"severe"===e.symptomLevel&&i.push({number:"24",image:"asthmacontrol"}),i.length>0?n(i[Math.floor(Math.random()*i.length)]):n(void 0)})(r,CSe(a,t),e)}))}))}),[],[e.previewState]),!a)return null;let i=(t=>{let a=io(w.getCurrentLanguage());return{title:no(`asthma-recommended-article-${t.number}-title`),subTitle:no(`asthma-recommended-article-${t.number}-subtitle`),url:new URL(`atedu_${t.number}${"es"===a?"_es":""}.html`,e.libraryBaseUrl).href,imageUrl:new URL(`images/article_category_${t.image}${"es"===a?"_es":""}.svg`,e.libraryBaseUrl).href}})(a);return t.createElement("div",{className:"mdhui-asthma-recommended-article",style:e.style},t.createElement(aSe,{title:i.title,subTitle:i.subTitle,imageUrl:i.imageUrl,imageAlignment:e.imageAlignment,buttonVariant:e.buttonVariant,buttonText:e.buttonText,onClick:()=>{e.previewState||w.openEmbeddedUrl(i.url)},innerRef:e.innerRef}))}function FEe(e){return t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},t.createElement(XAe,{showCloseButton:!0}),t.createElement(pEe,{previewState:e.previewState,learnMoreUrl:e.learnMoreUrl,editActionPlanSurveyName:e.editActionPlanSurveyName}))}function BEe(e){const[a,n]=c();let i;return"default"===e.previewState&&(i=(e,t)=>Tc(e,t,2e3,2e4)),id((()=>{"default"!==e.previewState?dEe.loadParticipant().then((e=>{n(e.getStepsBaseline())})):n(1e4)})),t.createElement(Ka,{colorScheme:e.colorScheme??"auto",bodyBackgroundColor:"var(--mdhui-background-color-0)"},t.createElement(XAe,{variant:"compressed",showCloseButton:!0,backgroundColor:"var(--mdhui-background-color-0)"},t.createElement(sM,{order:1},no("asthma-activity-view-title"))),t.createElement(SAe,{previewState:"default"===e.previewState?"loaded with data":void 0,previewDataProvider:i,title:no("asthma-activity-view-chart-title"),dailyDataType:$Se.Steps,highlight:e=>!!a&&!qSe(a,e),emptyDomain:[0,1e4]}),"Steps"===e.alert&&t.createElement(yEe,{previewState:e.previewState?"loaded":void 0,message:no("asthma-activity-view-alert-message"),logEntrySurveyName:e.logEntrySurveyName}))}function HEe(e){let a;return"default"===e.previewState&&(a=(e,t)=>Tc(e,t,30,130)),t.createElement(Ka,{colorScheme:e.colorScheme??"auto",bodyBackgroundColor:"var(--mdhui-background-color-0)"},t.createElement(XAe,{variant:"compressed",showCloseButton:!0,backgroundColor:"var(--mdhui-background-color-0)"},t.createElement(sM,{order:1},no("asthma-air-quality-view-title"))),(!e.alert||"HomeAirQuality"===e.alert)&&t.createElement(SAe,{previewState:"default"===e.previewState?"loaded with data":void 0,previewDataProvider:a,title:no("asthma-air-quality-view-home-aqi-chart-title"),dailyDataType:Hr.HomeAirQuality,highlight:e=>e>100,emptyDomain:[0,160]}),(!e.alert||"WorkAirQuality"===e.alert)&&t.createElement(SAe,{previewState:"default"===e.previewState?"loaded with data":void 0,previewDataProvider:a,title:no("asthma-air-quality-view-work-aqi-chart-title"),dailyDataType:Hr.WorkAirQuality,highlight:e=>e>100,emptyDomain:[0,160]}),"HomeAirQuality"===e.alert&&t.createElement(yEe,{previewState:e.previewState?"loaded":void 0,message:no("asthma-air-quality-view-home-aqi-alert-message"),logEntrySurveyName:e.logEntrySurveyName}),"WorkAirQuality"===e.alert&&t.createElement(yEe,{previewState:e.previewState?"loaded":void 0,message:no("asthma-air-quality-view-work-aqi-alert-message"),logEntrySurveyName:e.logEntrySurveyName}))}function qEe(e){return t.createElement(Ka,{colorScheme:e.colorScheme??"auto",bodyBackgroundColor:"var(--mdhui-background-color-0)"},t.createElement(XAe,{showCloseButton:!0,backgroundColor:"var(--mdhui-background-color-0)"}),t.createElement("div",{style:{background:"#ccc",height:160,width:160,borderRadius:"50%",margin:"32px auto"}}),t.createElement(yEe,{previewState:e.previewState?"loaded":void 0,message:no("asthma-alert-takeover-message"),logEntrySurveyName:e.logEntrySurveyName}))}function UEe(e){const[a,n]=c(!0),[i,r]=c();return id((()=>{if(n(!0),"loading"!==e.previewState)return e.previewState?(r({getParticipantMode:()=>"as caregiver"===e.previewState?"Caregiver":"Self"}),void n(!1)):void dEe.loadParticipant().then((e=>{r(e),n(!1)}))}),[],[e.previewState]),t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},t.createElement(XAe,{variant:"compressed",showCloseButton:!0},t.createElement(sM,{order:2},sl(e.date))),a&&t.createElement(XA,null),!a&&t.createElement(t.Fragment,null,t.createElement(aS,null,t.createElement(OEe,{previewState:e.previewState?"logged with mild symptoms":void 0,date:e.date,logTodayEntrySurveyName:e.logTodayEntrySurveyName,logYesterdayEntrySurveyName:e.logYesterdayEntrySurveyName,editLogEntryUrl:e.editLogEntryUrl,infoUrl:e.logEntryInfoUrl})),"Caregiver"!==i.getParticipantMode()&&t.createElement(aS,null,t.createElement(wEe,{previewState:e.previewState?"all data":void 0,heartAndLungsUrl:e.heartAndLungsUrl,activityUrl:e.activityUrl,sleepUrl:e.sleepUrl,date:e.date})),t.createElement(aS,null,t.createElement(fEe,{previewState:e.previewState?"all data":void 0,airQualityUrl:e.airQualityUrl,date:e.date}))))}function VEe(e){const[a,n]=c(),[i,r]=c(),[o,s]=c(),[l,u]=c(),[d,h]=c();let m,p,g;return"default"===e.previewState&&(m=(e,t)=>Tc(e,t,30,150,!1),p=(e,t)=>Tc(e,t,10,50),g=(e,t)=>Tc(e,t,.85,1,!1)),id((()=>{if("default"===e.previewState)return n(90),r(90),s(30),u(.97),void h(.96);dEe.loadParticipant().then((e=>{n(e.getDaytimeRestingHeartRateBaseline()),r(e.getNighttimeRestingHeartRateBaseline()),s(e.getRespiratoryRateBaseline()),u(e.getDaytimeBloodOxygenLevelBaseline()),h(e.getNighttimeBloodOxygenLevelBaseline())}))})),t.createElement(Ka,{colorScheme:e.colorScheme??"auto",bodyBackgroundColor:"var(--mdhui-background-color-0)"},t.createElement(XAe,{variant:"compressed",showCloseButton:!0,backgroundColor:"var(--mdhui-background-color-0)"},t.createElement(sM,{order:1},no("asthma-heart-and-lungs-view-title"))),(!e.alert||"DaytimeRestingHeartRate"===e.alert)&&t.createElement(SAe,{previewState:"default"===e.previewState?"loaded with data":void 0,previewDataProvider:m,title:no("asthma-heart-and-lungs-view-dhr-chart-title"),dailyDataType:$Se.DaytimeRestingHeartRate,valueFormatter:e=>wl(e),highlight:e=>!!a&&!FSe(a,e),emptyDomain:[0,120]}),(!e.alert||"NighttimeRestingHeartRate"===e.alert)&&t.createElement(SAe,{previewState:"default"===e.previewState?"loaded with data":void 0,previewDataProvider:m,title:no("asthma-heart-and-lungs-view-nhr-chart-title"),dailyDataType:$Se.NighttimeRestingHeartRate,valueFormatter:e=>wl(e),highlight:e=>!!i&&!BSe(i,e),emptyDomain:[0,120]}),(!e.alert||"RespiratoryRate"===e.alert)&&t.createElement(SAe,{previewState:"default"===e.previewState?"loaded with data":void 0,previewDataProvider:p,title:no("asthma-heart-and-lungs-view-rr-chart-title"),dailyDataType:$Se.RespiratoryRate,highlight:e=>!!o&&!HSe(o,e),emptyDomain:[0,40]}),(!e.alert||"DaytimeBloodOxygenLevel"===e.alert)&&t.createElement(SAe,{previewState:"default"===e.previewState?"loaded with data":void 0,previewDataProvider:g,title:no("asthma-heart-and-lungs-view-dbol-chart-title"),dailyDataType:$Se.DaytimeBloodOxygenLevel,valueConverter:e=>100*e,valueFormatter:e=>wl(e),highlight:e=>!!l&&!VSe(l,e),domain:[80,100],emptyDomain:[80,100]}),(!e.alert||"NighttimeBloodOxygenLevel"===e.alert)&&t.createElement(SAe,{previewState:"default"===e.previewState?"loaded with data":void 0,previewDataProvider:g,title:no("asthma-heart-and-lungs-view-nbol-chart-title"),dailyDataType:$Se.NighttimeBloodOxygenLevel,valueConverter:e=>100*e,valueFormatter:e=>wl(e),highlight:e=>!!d&&!VSe(d,e),domain:[80,100],emptyDomain:[80,100]}),"DaytimeRestingHeartRate"===e.alert&&t.createElement(yEe,{previewState:e.previewState?"loaded":void 0,message:no("asthma-heart-and-lungs-view-dhr-alert-message"),logEntrySurveyName:e.logEntrySurveyName}),"NighttimeRestingHeartRate"===e.alert&&t.createElement(yEe,{previewState:e.previewState?"loaded":void 0,message:no("asthma-heart-and-lungs-view-nhr-alert-message"),logEntrySurveyName:e.logEntrySurveyName}),"RespiratoryRate"===e.alert&&t.createElement(yEe,{previewState:e.previewState?"loaded":void 0,message:no("asthma-heart-and-lungs-view-rr-alert-message"),logEntrySurveyName:e.logEntrySurveyName}),"DaytimeBloodOxygenLevel"===e.alert&&t.createElement(yEe,{previewState:e.previewState?"loaded":void 0,message:no("asthma-heart-and-lungs-view-dbol-alert-message"),logEntrySurveyName:e.logEntrySurveyName}),"NighttimeBloodOxygenLevel"===e.alert&&t.createElement(yEe,{previewState:e.previewState?"loaded":void 0,message:no("asthma-heart-and-lungs-view-nbol-alert-message"),logEntrySurveyName:e.logEntrySurveyName}))}A(".mdhui-asthma-recommended-article {\n padding: 0 16px;\n margin: 16px 0;\n}\n\n.mdhui-asthma-recommended-article .mdhui-resource {\n margin: 0;\n}");const WEe={identifier:_Se(new Date),symptomLevel:"none",symptoms:[],impacts:[],triggers:[]},$Ee={"no symptoms":{logEntry:WEe},"mild symptoms":{logEntry:{...WEe,symptomLevel:"mild",symptoms:["Coughing"],impacts:["Wake up at night","Use your rescue inhaler"],triggers:["Cold/viral illness","Seasonal allergens/pollen","Smoke (tobacco or wood burning)","Air pollution","Dust mites","Mold"]}},"moderate symptoms":{logEntry:{...WEe,symptomLevel:"moderate",symptoms:["Coughing"],triggers:["Cold/viral illness","Mold"]}},"severe symptoms":{logEntry:{...WEe,symptomLevel:"severe",symptoms:["Coughing","Wheezing"],impacts:["Use your rescue inhaler"]}}};function GEe(e){let a=cn(Rr(),{days:-1});if(Ti(e.date,a))return w.dismiss(),null;const[n,i]=c(!0),[r,o]=c();id((()=>{if(i(!0),"loading"===e.previewState)return;if(e.previewState)return o($Ee[e.previewState].logEntry),void i(!1);let t=cn(new Date(e.date),{days:-1}),a=cn(new Date(e.date),{days:1});dEe.loadLogEntries(t,a).then((t=>{let a=_Se(e.date),n=t.find((e=>e.identifier===a));n?o(n):w.dismiss(),i(!1)}))}),[],[e.previewState]);const s=e=>{(e=>{let t={...r,symptomLevel:e};"none"===e&&(t.symptoms=[]),o(t)})(MSe(e))},l=e=>{(e=>{let t={...r,symptoms:e};e.length>0&&"none"===t.symptomLevel&&(t.symptomLevel="mild"),o(t)})(ISe(e))},u=t.createElement(S,{className:"button",style:{left:"16px"},onClick:()=>{e.previewState||w.dismiss()}},"Cancel"),d=t.createElement(S,{className:"button",style:{color:"#fff",background:"#369cff",right:"16px",padding:"0 16px"},onClick:()=>{n||e.previewState||dEe.saveLogEntry(r).then((()=>{w.dismiss()}))}},"Save");return t.createElement(Ka,{colorScheme:e.colorScheme??"auto",bodyBackgroundColor:"var(--mdhui-background-color-0)"},t.createElement(XAe,{title:sl(e.date),navigationBarLeft:u,navigationBarRight:d,variant:"compressed",backgroundColor:"var(--mdhui-background-color-0)"}),n&&t.createElement(XA,null),!n&&r&&t.createElement("div",null,t.createElement(aS,{backgroundColor:"var(--mdhui-background-color-1)"},t.createElement(vSe,{title:no("asthma-log-entry-editor-view-symptom-level-title"),subtitle:no("asthma-log-entry-editor-view-select-one-subtitle"),values:[no("asthma-symptom-level-none"),no("asthma-symptom-level-mild"),no("asthma-symptom-level-moderate"),no("asthma-symptom-level-severe")],selectedValues:[OSe(r.symptomLevel)],preventEmptySelections:!0,onChange:e=>s(e[0])})),t.createElement(aS,{backgroundColor:"var(--mdhui-background-color-1)"},t.createElement(vSe,{title:no("asthma-log-entry-editor-view-symptoms-title"),subtitle:no("asthma-log-entry-editor-view-select-all-subtitle"),values:[no("asthma-symptom-difficulty-breathing"),no("asthma-symptom-wheezing"),no("asthma-symptom-coughing"),no("asthma-symptom-chest-tightness")],selectedValues:DSe(r.symptoms),variant:"checkboxes",multiSelect:!0,onChange:e=>l(e)})),t.createElement(aS,{backgroundColor:"var(--mdhui-background-color-1)"},t.createElement(vSe,{title:no("asthma-log-entry-editor-view-impacts-title"),subtitle:no("asthma-log-entry-editor-view-select-all-subtitle"),values:[no("asthma-impact-waking-at-night"),no("asthma-impact-limit-daily-activity"),no("asthma-impact-using-rescue-inhaler")],selectedValues:NSe(r.impacts),variant:"checkboxes",multiSelect:!0,onChange:e=>{return t=e,void o({...r,impacts:jSe(t)});var t}})),t.createElement(aS,{backgroundColor:"var(--mdhui-background-color-1)"},t.createElement(vSe,{title:no("asthma-log-entry-editor-view-triggers-title"),subtitle:no("asthma-log-entry-editor-view-select-all-subtitle"),values:[no("asthma-trigger-cold-illness"),no("asthma-trigger-animal-exposure"),no("asthma-trigger-seasonal-allergens"),no("asthma-trigger-exercise"),no("asthma-trigger-smoke"),no("asthma-trigger-weather-changes"),no("asthma-trigger-air-pollution"),no("asthma-trigger-strong-smells"),no("asthma-trigger-chemicals"),no("asthma-trigger-dust"),no("asthma-trigger-mold"),no("asthma-trigger-dust-mites"),no("asthma-trigger-rodents"),no("asthma-trigger-cockroaches"),no("asthma-trigger-nsaid"),no("asthma-trigger-beta-blocker"),no("asthma-trigger-heartburn"),no("asthma-trigger-red-wine"),no("asthma-trigger-new-foods"),no("asthma-trigger-cooked-without-ventilation"),no("asthma-trigger-pet-in-bed"),no("asthma-trigger-incense-or-candle")],selectedValues:zSe(r.triggers),variant:"checkboxes",multiSelect:!0,onChange:e=>{return t=e,void o({...r,triggers:RSe(t)});var t}}))))}function KEe(e){return t.createElement(Ka,{colorScheme:"light"},t.createElement(XAe,{variant:"compressed",showCloseButton:!0},t.createElement(sM,{order:1},"Provider Report")),t.createElement(REe,{previewState:e.previewState,logEntrySurveyName:e.logEntrySurveyName}))}function ZEe(e){const[a,n]=c();let i;return"default"===e.previewState&&(i=(e,t)=>Tc(e,t,0,15)),id((()=>{"default"!==e.previewState?dEe.loadParticipant().then((e=>{n(e.getSleepDisturbancesBaseline())})):n(5)})),t.createElement(Ka,{colorScheme:e.colorScheme??"auto",bodyBackgroundColor:"var(--mdhui-background-color-0)"},t.createElement(XAe,{variant:"compressed",showCloseButton:!0,backgroundColor:"var(--mdhui-background-color-0)"},t.createElement(sM,{order:1},no("asthma-sleep-view-title"))),t.createElement(SAe,{previewState:"default"===e.previewState?"loaded with data":void 0,previewDataProvider:i,title:no("asthma-sleep-view-chart-title"),dailyDataType:$Se.SleepDisturbances,highlight:e=>!!a&&!USe(a,e),emptyDomain:[0,16]}),"SleepDisturbances"===e.alert&&t.createElement(yEe,{previewState:e.previewState?"loaded":void 0,message:no("asthma-sleep-view-alert-message"),logEntrySurveyName:e.logEntrySurveyName}))}function YEe(e){return t.createElement(Ka,{colorScheme:"light",className:"mdhui-step-container"+(e.className?` ${e.className}`:""),bodyBackgroundColor:"#FFFFFF"},e.children)}function XEe(e){return{textAlign:e.textAlign,color:e.color,fontSize:e.fontSize?`${e.fontSize}px`:void 0,fontWeight:e.fontWeight,backgroundImage:""}}A(".mdhui-step-container {\n background-color: #FFFFFF;\n}\n\n.mdhui-step-container div,\n.mdhui-step-container dl,\n.mdhui-step-container dt,\n.mdhui-step-container dd,\n.mdhui-step-container ul,\n.mdhui-step-container ol,\n.mdhui-step-container li,\n.mdhui-step-container h1,\n.mdhui-step-container h2,\n.mdhui-step-container h3,\n.mdhui-step-container h4,\n.mdhui-step-container h5,\n.mdhui-step-container h6,\n.mdhui-step-container pre,\n.mdhui-step-container form,\n.mdhui-step-container fieldset,\n.mdhui-step-container input,\n.mdhui-step-container textarea,\n.mdhui-step-container p,\n.mdhui-step-container blockquote,\n.mdhui-step-container th,\n.mdhui-step-container td {\n margin: 0;\n padding: 0;\n}\n\n.mdhui-step-container a {\n color: var(--mdhui-color-primary);\n text-decoration: none;\n}\n\n.mdhui-step-container ol {\n list-style-type: decimal;\n white-space: normal;\n list-style-position: inside;\n}\n\n.mdhui-step-container ul {\n list-style-type: disc;\n text-align: left;\n display: block;\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n padding-inline-start: 40px;\n white-space: normal;\n}\n\n.mdhui-step-container ul ul {\n list-style-type: circle;\n}\n\n.mdhui-step-container ul ul ul {\n list-style-type: square;\n}");function QEe(e){let a,n=new K_;a=e.inline?n.renderInline(e.text??""):n.render(e.text??""),a=a?.trim();let i=tM(a,{replace:e=>{let t=e;"a"===t.name&&(t.attribs.target="_blank")}});return t.createElement(t.Fragment,null,i)}function JEe(e){return e.text?t.createElement("div",{className:"mdhui-step-title",style:XEe(e)},t.createElement(QEe,{text:e.text,inline:!0})):null}A(".mdhui-step-container .mdhui-step-title {\n text-align: center;\n font-size: 1.7em;\n line-height: 1.2em;\n font-weight: normal;\n margin-top: 20px;\n margin-bottom: 15px;\n margin-left: 20px;\n margin-right: 20px; \n position: relative;\n display: block;\n}");function e_e(e){return e.text?t.createElement("div",{className:"mdhui-step-text",style:XEe(e)},t.createElement(QEe,{text:e.text})):null}A(".mdhui-step-container .mdhui-step-text {\n font-size: 1em;\n line-height: 1.3em;\n text-align: center;\n margin-top: 15px;\n margin-bottom: 15px;\n margin-left: 20px;\n margin-right: 20px; \n white-space: pre-line;\n}");function t_e(e){return e.text?t.createElement("div",{className:"mdhui-step-detail-text",style:XEe(e)},t.createElement(QEe,{text:e.text})):null}A(".mdhui-step-container .mdhui-step-detail-text {\n font-size: 1em;\n line-height: 1.3em;\n text-align: center;\n margin-top: 15px;\n margin-bottom: 15px;\n margin-left: 20px;\n margin-right: 20px;\n white-space: pre-line;\n}");function a_e(e){const a=XEe(e);if(e.gradient){var n="LeftToRight"===e.gradient.direction?`linear-gradient(to right, ${e.gradient.startColor} 0%, ${e.gradient.endColor} 100%)`:`linear-gradient(to bottom, ${e.gradient.startColor} 0%, ${e.gradient.endColor} 100%)`;a.backgroundImage=n}a.letterSpacing=e.letterSpacing,a.textTransform=e.textTransform,a.backgroundColor=e.backgroundColor,a.borderColor=e.backgroundColor;var i=e.text?e.text:no("next-button-text");return t.createElement("button",{className:"mdhui-step-next-button",style:a,disabled:e.disabled,onClick:e.onClick},i)}A(".mdhui-step-container .mdhui-step-next-button {\n margin: 20px;\n padding: 16px;\n background: var(--mdhui-color-primary);\n font-size: 1em;\n color: #FFF;\n font-weight: bold;\n border: solid 1px var(--mdhui-color-primary);\n border-radius: 5px;\n cursor: pointer;\n width: calc(100% - 40px);\n box-sizing: border-box;\n text-align: center;\n display: inline-block;\n}\n\n.mdhui-step-container .mdhui-step-next-button:disabled,\n.mdhui-step-container .mdhui-step-next-button[disabled] {\n opacity: 0.65;\n cursor: not-allowed;\n}");var n_e=150,i_e=2,r_e=["DodgerBlue","OliveDrab","Gold","Pink","SlateBlue","LightBlue","Violet","PaleGreen","SteelBlue","SandyBrown","Chocolate","Crimson"],o_e=!1,s_e=null,l_e=[],c_e=0;function u_e(e,t,a){return e.color=r_e[Math.random()*r_e.length|0],e.x=Math.random()*t,e.y=Math.random()*a-a,e.diameter=10*Math.random()+5,e.tilt=10*Math.random()-10,e.tiltAngleIncrement=.07*Math.random()+.05,e.tiltAngle=0,e}function d_e(){var e=window.innerWidth,t=window.innerHeight,a=window.requestAnimationFrame||function(e){return window.setTimeout(e,16.6666667)},n=document.getElementById("confetti-canvas");null===n&&((n=document.createElement("canvas")).setAttribute("id","confetti-canvas"),n.setAttribute("style","display:block;z-index:999999;pointer-events:none;position:fixed;top:0"),document.body.prepend(n),n.width=e,n.height=t,window.addEventListener("resize",(function(){n.width=window.innerWidth,n.height=window.innerHeight}),!0));for(var i=n.getContext("2d");l_e.length<n_e;)l_e.push(u_e({color:"",x:0,y:0,diameter:0,tilt:0,tiltAngleIncrement:0,tiltAngle:0},e,t));o_e=!0,null===s_e&&function e(){i?.clearRect(0,0,window.innerWidth,window.innerHeight),0===l_e.length?s_e=null:(!function(){var e,t=window.innerWidth,a=window.innerHeight;c_e+=.01;for(var n=0;n<l_e.length;n++)e=l_e[n],!o_e&&e.y<-15?e.y=a+100:(e.tiltAngle+=e.tiltAngleIncrement,e.x+=Math.sin(c_e),e.y+=.5*(Math.cos(c_e)+e.diameter+i_e),e.tilt=15*Math.sin(e.tiltAngle)),(e.x>t+20||e.x<-20||e.y>a)&&(o_e&&l_e.length<=n_e?u_e(e,t,a):(l_e.splice(n,1),n--))}(),function(e){if(e)for(var t,a,n=0;n<l_e.length;n++)t=l_e[n],e.beginPath(),e.lineWidth=t.diameter,e.strokeStyle=t.color,a=t.x+t.tilt,e.moveTo(a+t.diameter/2,t.y),e.lineTo(a,t.y+t.tilt+t.diameter/2),e.stroke()}(i),s_e=a(e))}()}function h_e(){o_e=!1}function m_e(e){return e.srcUrl?t.createElement("div",{className:"mdhui-step-image-icon"},t.createElement("img",{src:e.srcUrl})):null}A(".mdhui-step-container .mdhui-step-image-icon {\n text-align: center;\n}\n\n.mdhui-step-container .mdhui-step-image-icon img {\n max-width: 100%;\n max-height: 60px;\n padding: 0;\n margin: 0;\n padding-top: 50px;\n}");function p_e(e){return e.srcUrl?t.createElement("div",{className:"mdhui-step-image"},t.createElement("img",{src:e.srcUrl})):null}function g_e(e){function a(){0!==window.innerWidth&&0!==window.innerHeight?(d_e(),window.setTimeout((function(){h_e()}),1200)):window.setTimeout(a,50)}return l((()=>{a()}),[]),t.createElement(YEe,null,t.createElement(m_e,{srcUrl:e.iconUrl}),t.createElement(JEe,{text:e.title,textAlign:e.styles.titleAlignment,color:e.styles.titleColor,fontSize:e.styles.titleFontSize,fontWeight:e.styles.titleFontWeight}),t.createElement(e_e,{text:e.text,textAlign:e.styles.textAlignment,color:e.styles.textColor,fontSize:e.styles.textFontSize,fontWeight:e.styles.textFontWeight}),t.createElement(t_e,{text:e.detailText,textAlign:e.styles.textAlignment,color:e.styles.textColor,fontSize:e.styles.textFontSize,fontWeight:e.styles.textFontWeight}),t.createElement(p_e,{srcUrl:e.imageUrl}),t.createElement(a_e,{text:e.nextButtonText,color:e.styles.nextButtonTextColor,fontWeight:e.styles.nextButtonFontWeight,backgroundColor:e.styles.nextButtonBackgroundColor,letterSpacing:e.styles.nextButtonLetterSpacing,textTransform:e.styles.nextButtonTextTransform?.toLowerCase(),gradient:e.styles.nextButtonBackgroundGradient,onClick:()=>w.completeStep("")}))}function f_e(){const[e,a]=c(),[n,i]=c(),[r,o]=c(),[s,u]=c(),[d,h]=c(),[m,p]=c(),[g,f]=c({});return l((()=>{w.getStepConfiguration().then((function(e){e&&(a(e.properties.title),i(e.properties.text),o(e.properties.detailText),u(e.properties.iconImage),h(e.properties.image),p(e.properties.nextButtonText),f(e.styles??{}))}))}),[]),t.createElement(g_e,{title:e,text:n,detailText:r,iconUrl:s,imageUrl:d,nextButtonText:m,styles:g})}function y_e(e){const a=no("connect-to-device").replace("@@DEVICE@@",e.deviceType);return t.createElement(YEe,null,t.createElement(JEe,{text:e.title,textAlign:e.styles.titleAlignment,color:e.styles.titleColor,fontSize:e.styles.titleFontSize,fontWeight:e.styles.titleFontWeight}),t.createElement(e_e,{text:e.text,textAlign:e.styles.textAlignment,color:e.styles.textColor,fontSize:e.styles.textFontSize,fontWeight:e.styles.textFontWeight}),t.createElement(a_e,{text:a,color:e.styles.nextButtonTextColor,fontWeight:e.styles.nextButtonFontWeight,backgroundColor:e.styles.nextButtonBackgroundColor,letterSpacing:e.styles.nextButtonLetterSpacing,textTransform:e.styles.nextButtonTextTransform?.toLowerCase(),gradient:e.styles.nextButtonBackgroundGradient,onClick:e.onConnect}))}function v_e(){const[e,a]=c(),[n,i]=c(),[r,o]=c({}),[s,u]=c(),[d,h]=c(!0);function m(e){switch(e){case"Fitbit":return oU();case"Omron":return cU();case"Garmin":return sU();case"Oura":return uU()}}return l((()=>{w.getStepConfiguration().then((function(e){if(a(e.properties.title),i(e.properties.text),!e.properties.deviceType)throw new Error("deviceType is required");u(e.properties.deviceType),o(e.styles??{}),async function(e){try{const t=await w.getExternalAccounts(),a=m(e);t.some((e=>e.provider.id===a))&&w.completeStep(a)}finally{h(!1)}}(e.properties.deviceType)}))}),[]),d||!s?t.createElement(t.Fragment,null):t.createElement(y_e,{title:e,text:n,deviceType:s,providerID:m(s),styles:r,onConnect:function(){const e=m(s);w.connectExternalAccount(e,{openNewWindow:!0}).then((function(){w.completeStep(e)}))}})}A(".mdhui-step-container .mdhui-step-image {\n text-align: center;\n}\n.mdhui-step-container .mdhui-step-image img {\n width: 100%;\n padding: 0;\n margin: 0;\n padding-top: 40px;\n padding-bottom: 40px;\n}");function b_e(e){return t.createElement(YEe,{className:"mdhui-connect-ehr-step"},t.createElement(JEe,{text:e.title,textAlign:e.styles.titleAlignment,color:e.styles.titleColor,fontSize:e.styles.titleFontSize,fontWeight:e.styles.titleFontWeight}),t.createElement(e_e,{text:e.text,textAlign:e.styles.textAlignment,color:e.styles.textColor,fontSize:e.styles.textFontSize,fontWeight:e.styles.textFontWeight}),t.createElement(AAe,{previewState:e.previewState,providerCategories:["Provider","Health Plan"],onProviderConnected:e.onProviderConnected}),t.createElement(a_e,{text:e.nextButtonText,disabled:e.nextButtonDisabled,color:e.styles.nextButtonTextColor,fontWeight:e.styles.nextButtonFontWeight,backgroundColor:e.styles.nextButtonBackgroundColor,letterSpacing:e.styles.nextButtonLetterSpacing,textTransform:e.styles.nextButtonTextTransform?.toLowerCase(),gradient:e.styles.nextButtonBackgroundGradient,onClick:e.onNextButtonClick}))}function w_e(){const[e,a]=c(),[n,i]=c(),[r,o]=c(),[s,u]=c(),[d,h]=c(!0),[m,p]=c({}),[g,f]=c([]);return l((()=>{w.getStepConfiguration().then((function(e){e&&(a(e.properties.title),i(e.properties.text),u(e.properties.nextButtonText),p(e.styles??{}))})),w.getSurveyContext().then((function(e){e&&o(e)}))}),[]),t.createElement(b_e,{title:e,text:n,nextButtonText:s,nextButtonDisabled:d,styles:m,onProviderConnected:function(e){f((t=>[...t,e.id])),h(!1)},previewState:"Design"===r?.surveyMode?"Default":void 0,onNextButtonClick:()=>w.completeStep(g.toString())})}function x_e(e){let a=(e.height?e.height:"225")+"px",n=w.getCurrentLanguage();return t.createElement(YEe,null,t.createElement(JEe,{text:e.title,textAlign:e.styles.titleAlignment,color:e.styles.titleColor,fontSize:e.styles.titleFontSize,fontWeight:e.styles.titleFontWeight}),t.createElement(e_e,{text:e.text,textAlign:e.styles.textAlignment,color:e.styles.textColor,fontSize:e.styles.textFontSize,fontWeight:e.styles.textFontWeight}),t.createElement("div",{style:{textAlign:"center",width:"100%"}},t.createElement("iframe",{style:{width:"100%",height:a,border:0},src:`https://www.youtube.com/embed/${e.videoId}?rel=0&cc_lang_pref=${n}&controls=1&autoplay=0&fs=1&modestbranding=1`,title:"YouTube video player",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; fullscreen",allowFullScreen:!0})),t.createElement(t_e,{text:e.transcript,textAlign:e.styles.detailTextAlignment,color:e.styles.detailTextColor,fontSize:e.styles.detailTextFontSize,fontWeight:e.styles.detailTextFontWeight}),t.createElement(a_e,{text:e.nextButtonText,color:e.styles.nextButtonTextColor,fontWeight:e.styles.nextButtonFontWeight,backgroundColor:e.styles.nextButtonBackgroundColor,letterSpacing:e.styles.nextButtonLetterSpacing,textTransform:e.styles.nextButtonTextTransform?.toLowerCase(),gradient:e.styles.nextButtonBackgroundGradient,onClick:()=>w.completeStep("")}))}function k_e(){const[e,a]=c(),[n,i]=c(),[r,o]=c(),[s,u]=c(""),[d,h]=c(),[m,p]=c(),[g,f]=c({});return l((()=>{w.getStepConfiguration().then((function(e){e&&(a(e.properties.title),i(e.properties.text),o(e.properties.transcript),u(e.properties.videoId),h(e.properties.nextButtonText),p(e.properties.height),f(e.styles??{}))}))}),[]),t.createElement(x_e,{title:e,text:n,transcript:r,nextButtonText:d,height:m,videoId:s,styles:g})}A(".mdhui-step-container.mdhui-connect-ehr-step .mdhui-provider-search {\n margin-bottom: 94px;\n}\n.mdhui-step-container.mdhui-connect-ehr-step .mdhui-step-next-button {\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n}");function A_e(e){e.customFields.Symptoms?.length||(e.customFields.Symptoms="[]"),e.customFields.Treatments?.length||(e.customFields.Treatments="[]");var t=[];try{t=JSON.parse(e.customFields.Symptoms)}catch(a){t=JSON.parse(e.customFields.Symptoms.replace(/\\/g,""))}t.sort(((e,t)=>e.name>t.name?1:t.name>e.name?-1:0)),t.forEach((e=>{e.severityTracking||(e.severityTracking="None")}));var a=[];try{a=JSON.parse(e.customFields.Treatments)}catch(t){a=JSON.parse(e.customFields.Treatments.replace(/\\/g,""))}return a.sort(((e,t)=>e.name>t.name?1:t.name>e.name?-1:0)),{participantID:e.participantID,symptoms:t,treatments:a}}A(".ss-symptom-matrix {\n background: var(--mdhui-background-color-0);\n /* Default color for PDF Rendering, since evopdf does not support CSS variables */\n border-top: solid 1px #ddd;\n border-top: solid 1px var(--mdhui-border-color-1);\n}");var S_e={getConfiguration:function(){return w.getParticipantInfo().then((function(e){return A_e(e)}))},getDailyLogEntries:function(e,t){var a={},n=function(i){var r={namespace:"Project",type:"DailyLogEntry",pageID:i};return e&&(r.observedAfter=e),t&&(r.observedBefore=t),w.queryDeviceData(r).then((function(e){for(var t=e.deviceDataPoints,i=0;i<t.length;i++){var r=JSON.parse(t[i].value),o=t[i].observationDate;o&&(a[o.substring(0,10)]=E_e(r))}return e.nextPageID?n(e.nextPageID):a}))};return n()},saveDailyLogEntry:function(e,t){return w.persistDeviceData([{type:"DailyLogEntry",observationDate:e+"T00:00:00.000Z",value:JSON.stringify(t)}])}};function E_e(e){e.starred&&(e.icon="star");var t={overallFeeling:e.overallFeeling,notes:e.notes,symptoms:e.symptoms.map((e=>"string"==typeof e?{id:e}:e)),treatments:e.treatments.map((e=>"string"==typeof e?{id:e}:e)),icon:e.icon};return t}function __e(e){return t.createElement("div",{ref:e.innerRef,className:"mdhui-ss-symptom-treatment-filters"},t.createElement(S,{className:"mdhui-ss-symptom-treatment-filter-dropdown-button",onClick:()=>"Symptoms"==e.expandedDropdown?e.onExpandedDropdownChange(null):e.onExpandedDropdownChange("Symptoms"),style:{fontWeight:e.selectedSymptoms.length>0?"bold":""}},no("select-symptoms")," ",t.createElement(gge,{icon:"Symptoms"==e.expandedDropdown?F:ce}),t.createElement(tS,null)),t.createElement(S,{className:"mdhui-ss-symptom-treatment-filter-dropdown-button",onClick:()=>"Treatments"==e.expandedDropdown?e.onExpandedDropdownChange(null):e.onExpandedDropdownChange("Treatments"),style:{fontWeight:e.selectedTreatments.length>0?"bold":""}},no("select-treatments")," ",t.createElement(gge,{icon:"Treatments"==e.expandedDropdown?F:ce}),t.createElement(tS,null)),"Symptoms"==e.expandedDropdown&&t.createElement("div",{className:"mdhui-ss-symptom-treatment-filter-items-list"},e.configuration.symptoms.filter((e=>!e.inactive)).map((a=>t.createElement(ySe,{className:"mdhui-ss-symptom-treatment-filter-item",selected:-1!=e.selectedSymptoms.indexOf(a.id),onClick:()=>{return t=a,-1!=(n=[...e.selectedSymptoms]).indexOf(t.id)?n.splice(n.indexOf(t.id),1):n.push(t.id),void e.onSymptomsSelectionChange(n);var t,n},color:a.color,key:a.id,text:a.name})))),"Treatments"==e.expandedDropdown&&t.createElement("div",{className:"mdhui-ss-symptom-treatment-filter-items-list"},e.configuration.treatments.filter((e=>!e.inactive)).map((a=>t.createElement(ySe,{className:"mdhui-ss-symptom-treatment-filter-item",selected:-1!=e.selectedTreatments.indexOf(a.id),onClick:()=>{return t=a,-1!=(n=[...e.selectedTreatments]).indexOf(t.id)?n.splice(n.indexOf(t.id),1):n.push(t.id),void e.onTreatmentsSelectionChange(n);var t,n},color:a.color,key:a.id,text:a.name})))))}A(".mdhui-ss-symptom-treatment-filters .mdhui-ss-symptom-treatment-filter-dropdown-button {\n width: 50%;\n display: inline-block;\n box-sizing: border-box;\n padding: 16px 8px;\n background: var(--mdhui-color-primary);\n text-align: center;\n font-size: .88em;\n cursor: pointer;\n color: #FFF;\n position: relative;\n white-space: nowrap;\n}\n\n.mdhui-ss-symptom-treatment-filters .mdhui-ss-symptom-treatment-filter-dropdown-button:first-child {\n border-right: solid 1px var(--mdhui-border-color-1);\n}\n\n.mdhui-ss-symptom-treatment-filters .mdhui-ss-symptom-treatment-filter-items-list {\n background: var(--mdhui-background-color-0);\n text-align: center;\n padding: 12px;\n padding-top: 8px;\n padding-bottom: 8px;\n border-bottom: solid 4px var(--ss-primary-theme-color);\n}\n\n.mdhui-ss-symptom-treatment-filters .mdhui-ss-symptom-treatment-filter-item {\n margin: 4px;\n}");var C_e=[{severityTracking:"10PointScale",color:"#c4291c",name:"Headache",id:"Headache"},{severityTracking:"3PointScale",color:"#e35c33",name:"Fatigue",id:"Fatigue"},{severityTracking:"None",color:"#5db37e",name:"Nausea",id:"Nausea"},{severityTracking:"None",color:"#429bdf",name:"Anxiety",id:"Anxiety"},{severityTracking:"None",color:"#7b88c6",name:"Brain Fog",id:"Brain Fog"},{severityTracking:"None",color:"#616161",name:"Back Pain",id:"Back Pain"},{severityTracking:"None",color:"#d98177",name:"Insomnia",id:"Insomnia"}],T_e=[{color:"#616161",id:"Tylenol",name:"Tylenol"},{color:"#429BDF",id:"Rest",name:"Rest"},{color:"#d98177",id:"Ice",name:"Ice"},{color:"#5db37e",id:"Stretching",name:"Stretching"},{color:"#e35c33",id:"Meditation",name:"Meditation"}];C_e.sort(((e,t)=>e.name>t.name?1:t.name>e.name?-1:0)),T_e.sort(((e,t)=>e.name>t.name?1:t.name>e.name?-1:0));var P_e={},O_e=cn(new Date,{days:-29});function M_e(e,t,a,n,i){P_e[Br(O_e)]={symptoms:e.map((e=>({id:e,severity:Math.floor(10*Math.random())+1}))),treatments:t.map((e=>({id:e}))),notes:i?"notes":"",icon:n,overallFeeling:a},O_e=cn(O_e,{days:1})}M_e(["Headache","Insomnia"],["Tylenol"],2,"moon-o",!0),M_e(["Brain Fog","Nausea"],["Tylenol","Ice"],4),M_e(["Headache"],["Tylenol"],3),M_e(["Headache","Insomnia"],["Tylenol"],3),M_e([],[],5),M_e(["Fatigue","Back Pain","Anxiety","Nausea"],["Stretching","Rest","Ice"],1),M_e([],[],5),M_e(["Fatigue","Back Pain","Anxiety","Nausea","Headache","Insomnia","Brain Fog"],["Stretching","Rest","Ice","Meditation","Tylenol"],1,"star-o",!0),M_e(["Fatigue","Nausea","Headache"],["Stretching"],2),M_e(["Anxiety","Brain Fog"],["Rest","Meditation"],3,void 0,!0),M_e([],[],5),M_e(["Back Pain","Headache"],["Ice","Tylenol"],4),M_e(["Fatigue","Back Pain","Nausea","Brain Fog"],["Meditation","Tylenol"],2),M_e([],[],5),M_e(["Fatigue","Insomnia","Brain Fog"],["Rest"],4,"star",!0),M_e(["Fatigue","Back Pain"],["Stretching","Rest"],3),M_e(["Fatigue","Nausea"],["Stretching","Rest","Ice","Meditation","Tylenol"],2,"flag",!0),M_e(["Headache","Insomnia","Brain Fog"],["Stretching","Tylenol"],4,"user-md",!0),M_e([],[],5),M_e([],[],5),M_e([],[],5),M_e(["Back Pain","Headache"],["Ice","Tylenol"],4),M_e(["Fatigue","Back Pain","Nausea","Brain Fog"],["Meditation","Tylenol"],2),M_e(["Fatigue","Back Pain","Anxiety","Nausea"],["Stretching","Rest","Ice"],1),M_e(["Fatigue","Insomnia","Brain Fog"],["Rest"],4,"question-circle-o",!0),M_e(["Fatigue","Back Pain","Anxiety","Nausea","Headache","Insomnia","Brain Fog"],["Stretching","Rest","Ice","Meditation","Tylenol"],1,"flask",!0),M_e([],[],5),M_e(["Headache","Insomnia"],["Tylenol"],3),M_e([],[],5),M_e(["Fatigue","Insomnia"],["Rest"],2,"trophy",!0);const D_e=o(null);function I_e(e){const[a,n]=c(null),[i,r]=c([]),[o,s]=c([]),[u,d]=c(null);let[h,m]=c(null);function p(){if("default"==e.previewState)return m({symptoms:C_e,treatments:T_e,participantID:"1"}),void n({symptoms:C_e,treatments:T_e,logEntries:P_e,hasFilteredSymptoms:!1});S_e.getConfiguration().then((function(e){S_e.getDailyLogEntries().then((function(t){m(e),h=e,n({symptoms:g(i),treatments:f(o),logEntries:t,hasFilteredSymptoms:!1})}))}))}function g(e){return h.symptoms.filter((t=>(!e.length||e.includes(t.id))&&!t.inactive))}function f(e){return h.treatments.filter((t=>(!e.length||e.includes(t.id))&&!t.inactive))}return l((()=>(p(),w.on("applicationDidBecomeVisible",p),()=>{w.off("applicationDidBecomeVisible",p)})),[]),a&&h?t.createElement("div",{ref:e.innerRef},t.createElement(D_e.Provider,{value:a},e.showFilters&&t.createElement(oSe,{noTopMargin:!0},t.createElement(__e,{configuration:h,selectedSymptoms:i,onSymptomsSelectionChange:e=>function(e){n({...a,symptoms:g(e),hasFilteredSymptoms:!!e.length}),r(e)}(e),selectedTreatments:o,onTreatmentsSelectionChange:e=>function(e){n({...a,treatments:f(e)}),s(e)}(e),expandedDropdown:u,onExpandedDropdownChange:e=>d(e)})),e.children)):t.createElement(XA,null)}function N_e(e){let a=r(D_e);if(!a)return t.createElement($q,{innerRef:e.innerRef},"Error: Symptom Matrix must be used inside a Symptom Shark Visualization Coordinator.");let n=r(rM),i=e.intervalStart||In(new Date);if(n&&(i=n.intervalStart),!a.symptoms.length&&!a.treatments.length)return null;var o=nl(i.getFullYear(),i.getMonth()),s=a.symptoms.map((e=>({label:e.name,color:e.color,data:o.map((t=>!!function(e,t){var n=Br(e);return!!a.logEntries[n]&&a.logEntries[n].symptoms.find((e=>e.id==t))}(t,e.id)))}))),l=a.treatments.map((e=>({label:e.name,color:e.color,data:o.map((t=>!!function(e,t){var n=Br(e);return!!a.logEntries[n]&&a.logEntries[n].treatments.find((e=>e.id==t))}(t,e.id)))})));return t.createElement("div",{ref:e.innerRef,className:"ss-symptom-matrix"},t.createElement(YAe,{title:no("symptoms"),rows:s,intervalStart:i}),t.createElement(YAe,{title:no("treatments"),rows:l,intervalStart:i}))}function j_e(e){let a=r(D_e);if(!a)return t.createElement($q,{innerRef:e.innerRef},"Error: Symptom Calendar must be used inside a Symptom Shark Visualization Coordinator.");let{symptoms:n,treatments:i,logEntries:o}=a,s=r(rM),l=e.intervalStart||In(new Date);return s&&(l=s.intervalStart),t.createElement(JA,{innerRef:e.innerRef,className:"mdhui-ss-calendar",month:l.getMonth(),year:l.getFullYear(),dayRenderer:function(a,r,s){if(!s)return t.createElement("div",null);var c=new Date(a,r,s),u=o[Br(c)],d=!1;return c>new Date&&(d=!0),t.createElement(z_e,{onClick:t=>function(t){var a=new Date(l.getFullYear(),l.getMonth(),t);a>new Date||e.onDaySelected(a)}(t),day:s,logEntry:u,symptomConfigurations:n,treatmentConfigurations:i,future:d})}})}function z_e(e){return t.createElement(S,{className:"mdhui-ss-calendar-day"+(e.future?" future":""),onClick:()=>e.onClick(e.day)},function(){if(!e.logEntry)return t.createElement(uM,{className:"mdhui-ss-day-tracker",primaryColors:[],secondaryColors:[]});var a=e.symptomConfigurations.filter((t=>!t.inactive&&e.logEntry.symptoms.find((e=>e.id==t.id)))).map((e=>e.color)),n=e.treatmentConfigurations.filter((t=>!t.inactive&&e.logEntry.treatments.find((e=>e.id==t.id)))).map((e=>e.color));return 0===a.length&&0===n.length?t.createElement(uM,{className:"mdhui-ss-day-tracker",primaryColors:[],secondaryColors:[]}):t.createElement(uM,{className:"mdhui-ss-day-tracker",key:Math.random(),primaryColors:a,secondaryColors:n})}(),t.createElement("div",{className:"day-label"}," ",e.day," ",e.logEntry?.notes.length>0&&t.createElement(gge,{icon:_,className:"mdhui-ss-notes-icon"})))}A(".mdhui-ss-calendar .mdhui-ss-calendar-day {\n width: 100%;\n}\n\n.mdhui-ss-calendar .mdhui-ss-calendar-day .mdhui-ss-day-label {\n font-size: 12px;\n color: var(--mdhui-text-color-2);\n}\n\n.mdhui-ss-calendar .mdhui-ss-calendar-day .mdhui-ss-day-label svg {\n font-size: 12px;\n}\n\n.mdhui-ss-calendar .mdhui-ss-calendar-day .mdhui-ss-day-label.future {\n opacity: .5;\n}\n\n.mdhui-ss-calendar .mdhui-ss-notes-icon {\n color: var(--mdhui-color-primary);\n position: absolute;\n right: calc(50% - 19px);\n bottom: 2px;\n}\n\n.mdhui-ss-calendar .mdhui-ss-calendar-day .mdhui-ss-day-tracker {\n padding-bottom: 2px;\n padding-top: 8px;\n}\n\n.mdhui-ss-calendar .mdhui-ss-calendar-day.future {\n opacity: .5;\n cursor: default;\n}");function R_e(e){let a=r(D_e);if(!a)return t.createElement($q,{innerRef:e.innerRef},"Error: Symptom Severity Chart must be used inside a Symptom Shark Visualization Coordinator.");let{logEntries:n}=a,i=r(rM),o=e.intervalStart||In(new Date);i&&(o=i.intervalStart);var s=nl(o.getFullYear(),o.getMonth());function l(e){return s.filter((t=>{if(n[Br(t)]&&n[Br(t)].overallFeeling&&(!e||n[Br(t)].overallFeeling==e))return!0}))}var c=l();if(!c.length)return null;for(var u=s.length,d=100/u,h=100/(2*u),m=[],p=0;p<c.length-1;p++){var g=c[p],f=c[p+1],y=n[Br(g)].overallFeeling,v=n[Br(f)].overallFeeling;m.push({x1:h+d*(g.getDate()-1),y1:128-24*y,x2:h+d*(f.getDate()-1),y2:128-24*v,color:"#429bdf"})}let b=function(){var e=0,t=l();if(0==t.length)return null;for(var a=0;a<t.length;a++)e+=n[Br(t[a])].overallFeeling;return e/t.length}();return t.createElement("div",{ref:e.innerRef,className:"mdhui-ss-oe-chart"+("monthReport"==e.variant?" mdhui-ss-oe-chart-month-report":"")},t.createElement("div",{className:"mdhui-ss-oe-chart-title-container"},t.createElement(nS,{title:no("daily-overall-experience")}),b&&t.createElement("div",{className:"mdhui-ss-oe-chart-average-wrapper"},no("average"),": ",t.createElement("div",{className:"mdhui-ss-oe-chart-average"},wl(b,1),t.createElement(xM,{className:"mdhui-ss-oe-chart-face",selected:!0,faceValue:parseInt(b.toFixed(0))})))),t.createElement("div",{className:"mdhui-ss-oe-chart-inner"},t.createElement("div",{className:"mdhui-ss-oe-chart-y-axis"},t.createElement("div",{className:"mdhui-ss-oe-chart-face-total"},l(5).length>0&&t.createElement("span",{className:"total"},l(5).length),t.createElement(xM,{className:"mdhui-ss-oe-chart-face",selected:!0,faceValue:5})),t.createElement("div",{className:"mdhui-ss-oe-chart-face-total"},l(4).length>0&&t.createElement("span",{className:"total"},l(4).length),t.createElement(xM,{className:"mdhui-ss-oe-chart-face",selected:!0,faceValue:4})),t.createElement("div",{className:"mdhui-ss-oe-chart-face-total"},l(3).length>0&&t.createElement("span",{className:"total"},l(3).length),t.createElement(xM,{className:"mdhui-ss-oe-chart-face",selected:!0,faceValue:3})),t.createElement("div",{className:"mdhui-ss-oe-chart-face-total"},l(2).length>0&&t.createElement("span",{className:"total"},l(2).length),t.createElement(xM,{className:"mdhui-ss-oe-chart-face",selected:!0,faceValue:2})),t.createElement("div",{className:"mdhui-ss-oe-chart-face-total"},l(1).length>0&&t.createElement("span",{className:"total"},l(1).length),t.createElement(xM,{className:"mdhui-ss-oe-chart-face",selected:!0,faceValue:1}))),t.createElement("div",{className:"mdhui-ss-oe-chart-x-axis-line"}),t.createElement("div",{className:"mdhui-ss-oe-chart-x-axis-line",style:{top:"48px"}}),t.createElement("div",{className:"mdhui-ss-oe-chart-x-axis-line",style:{top:"72px"}}),t.createElement("div",{className:"mdhui-ss-oe-chart-x-axis-line",style:{top:"96px"}}),t.createElement("div",{className:"mdhui-ss-oe-chart-x-axis-line",style:{top:"120px"}}),t.createElement("div",{style:{position:"relative",height:"100%"}},t.createElement("svg",{className:"mdhui-ss-oe-chart-lines"},m.map((e=>t.createElement("line",{key:e.x1,x1:e.x1+"%",y1:e.y1,x2:e.x2+"%",y2:e.y2,style:{stroke:e.color,strokeWidth:4,opacity:.5}})))),s.map((a=>t.createElement("div",{key:a.getDate(),className:"mdhui-ss-oe-chart-day-wrapper",style:{width:100/s.length+"%"}},(e.showAllDays||(a.getDate()-1)%2==0)&&t.createElement("div",{className:"mdhui-ss-oe-chart-day-marker"},a.getDate()),n[Br(a)]?.overallFeeling&&t.createElement("div",{className:"mdhui-ss-oe-chart-dot",style:{bottom:24*n[Br(a)].overallFeeling-16+"px"}})))))))}A(".mdhui-ss-oe-chart {\n position: relative;\n}\n\n.mdhui-ss-oe-chart .mdhui-ss-oe-chart-title-container {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n flex-wrap: wrap;\n}\n\n.mdhui-ss-oe-chart .mdhui-ss-oe-chart-face {\n width: 16px;\n height: 16px;\n margin-left: 4px;\n vertical-align: text-top;\n display: inline-block;\n border-radius: 8px;\n overflow: hidden;\n}\n\n.mdhui-ss-oe-chart-inner .mdhui-ss-oe-chart-y-axis .mdhui-ss-oe-chart-face-total {\n height: 16px;\n margin-bottom: 8px;\n display: block;\n text-align: right;\n font-weight: bold;\n width: 56px;\n font-size: 15px;\n white-space: nowrap;\n}\n\n.mdhui-ss-oe-chart .mdhui-ss-oe-chart-face-total .mdhui-ss-oe-chart-total {\n vertical-align: text-top;\n}\n\n.mdhui-ss-oe-chart .mdhui-ss-oe-chart-average-wrapper {\n font-size: 17px;\n padding: 16px;\n padding-bottom: 0;\n}\n\n.mdhui-ss-oe-chart .mdhui-ss-oe-chart-average-wrapper .mdhui-ss-oe-chart-average {\n font-weight: bold;\n display: inline;\n}\n\n.mdhui-ss-oe-chart-inner {\n position: relative;\n height: 160px;\n padding: 16px;\n box-sizing: border-box;\n padding-left: 64px;\n page-break-inside: avoid;\n}\n\n.mdhui-ss-oe-chart-inner .mdhui-ss-oe-chart-x-axis-line {\n position: absolute;\n width: calc(100% - 64px);\n height: 1px;\n /*Default color because evopdf doesn't support css variables*/\n background: #eee;\n background: var(--mdhui-background-color-1);\n left: 64px;\n top: 24px;\n}\n\n.mdhui-ss-oe-chart-inner .mdhui-ss-oe-chart-lines {\n position: absolute;\n left: 0;\n right: 0;\n top: 0.5px;\n bottom: 0;\n width: 100%;\n height: 100%;\n}\n\n.mdhui-ss-oe-chart-inner .mdhui-ss-oe-chart-y-axis {\n position: absolute;\n left: 0;\n top: 16px;\n}\n\n.mdhui-ss-oe-chart-inner .mdhui-ss-oe-chart-day-wrapper {\n position: relative;\n float: left;\n height: 116px;\n}\n\n.mdhui-ss-oe-chart-inner .mdhui-ss-oe-chart-day-wrapper .mdhui-ss-oe-chart-day-marker {\n position: absolute;\n left: 0;\n bottom: -16px;\n width: 100%;\n text-align: center;\n font-size: 12px;\n color: var(--mdhui-text-color-2);\n}\n\n.mdhui-ss-oe-chart-inner .mdhui-ss-oe-chart-day-wrapper .mdhui-ss-oe-chart-dot {\n position: absolute;\n width: 7px;\n height: 7px;\n /*Default color because evopdf doesn't support css variables*/\n background: #666;\n background: var(--mdhui-text-color-2);\n border-radius: 3.5px;\n left: calc(50% - 3px);\n}\n\n.mdhui-ss-oe-chart.mdhui-ss-oe-chart-month-report .mdhui-ss-oe-chart-inner {\n padding-left: calc(25% + 8px);\n}\n\n.mdhui-ss-oe-chart.mdhui-ss-oe-chart-month-report .mdhui-ss-oe-chart-y-axis {\n left: calc(25% - 56px);\n}\n\n.mdhui-ss-oe-chart.mdhui-ss-oe-chart-month-report .mdhui-ss-oe-chart-x-axis-line {\n width: calc(75% - 32px);\n left: calc(25% + 16px);\n}\n\n.mdhui-ss-oe-chart.mdhui-ss-oe-chart-month-report .mdhui-ss-oe-chart-average-wrapper {\n display: block;\n padding-top: 16px;\n font-size: 15px;\n text-transform: uppercase;\n font-weight: normal;\n position: absolute;\n left: 16px;\n top: 64px;\n text-align: left;\n padding: 0;\n padding-bottom: 8px;\n right: auto;\n}\n\n.mdhui-ss-oe-chart.mdhui-ss-oe-chart-month-report .mdhui-ss-oe-chart-average-wrapper .mdhui-ss-oe-chart-average {\n margin-top: 8px;\n font-size: 34px;\n font-weight: bold;\n display: block;\n line-height: 34px;\n}\n\n.mdhui-ss-oe-chart.mdhui-ss-oe-chart-month-report .mdhui-ss-oe-chart-average-wrapper .mdhui-ss-oe-chart-average .mdhui-face {\n height: 34px;\n width: 34px;\n vertical-align: top;\n border-radius: 18px;\n overflow: hidden;\n}");function L_e(e){if(!e.configuration.symptoms.length)return null;function a(){e.onClick&&e.onClick(e.date)}let n=!1;e.logEntry&&(e.logEntry.symptoms.length>0||e.logEntry.treatments.length>0||e.logEntry&&e.logEntry.notes.length>0)||(n=!0);let i=e.title??il(e.date),r=e.highlight??_r(e.date),o=e.title?void 0:e.subtitle??sl(e.date);return n?t.createElement(aS,{innerRef:e.innerRef,variant:r?"highlight":"subtle",className:"mdhui-ss-log-entry"},t.createElement(Za,{title:i,subtitle:o,onClick:()=>a(),indicatorIcon:we},!!e.noDataMessage&&t.createElement("div",{className:"mdhui-ss-log-entry-section"},e.noDataMessage),t.createElement(tS,null))):t.createElement(aS,{innerRef:e.innerRef,className:"mdhui-ss-log-entry"},t.createElement(Za,{title:i,subtitle:o,onClick:()=>a(),indicatorPosition:"topRight",indicator:t.createElement(t.Fragment,null,e.logEntry?.overallFeeling&&t.createElement(xM,{faceValue:e.logEntry?.overallFeeling,selected:!0}))},t.createElement(F_e,{configuration:e.configuration,logEntry:e.logEntry,highlightedSymptoms:e.highlightedSymptoms,highlightedTreatments:e.highlightedTreatments}),e.logEntry.notes&&t.createElement("div",{className:"mdhui-ss-log-entry-section"},t.createElement("div",{className:"mdhui-ss-section-header"},no("notes")),t.createElement("div",{className:"mdhui-ss-notes-content"},e.logEntry.notes))))}function F_e(e){var a=[],n=[];if(e.logEntry&&(e.logEntry.symptoms.forEach((t=>{var n,i=e.configuration.symptoms.find((e=>e.id==t.id));i&&("10PointScale"==i.severityTracking&&(n=t.severity?t.severity.toString():void 0),"3PointScale"==i.severityTracking&&(t.severity>7?n=no("severe-shortened"):t.severity>4?n=no("moderate-shortened"):t.severity>0&&(n=no("mild-shortened"))),a.push({id:t.id,severity:n,name:i.name,color:i.color}))})),a.sort(((e,t)=>e.name>t.name?1:t.name>e.name?-1:0)),e.logEntry.treatments.forEach((t=>{var a=e.configuration.treatments.find((e=>e.id==t.id));a&&n.push({id:t.id,name:a.name,color:a.color})})),n.sort(((e,t)=>e.name>t.name?1:t.name>e.name?-1:0))),!e.logEntry||!(a.length>0||n.length>0||e.logEntry.notes.length>0))return null;var i=[],r=[];return e.highlightedSymptoms&&(i=e.highlightedSymptoms),e.highlightedTreatments&&(r=e.highlightedTreatments),0==e.logEntry.symptoms.length&&0==e.logEntry.treatments.length?null:t.createElement("div",{className:"mdhui-ss-log-entry-section"},t.createElement("div",{className:"mdhui-ss-section-header"},no("symptoms-and-treatments")),a.filter((e=>-1!=i.indexOf(e.id))).map((e=>t.createElement(ySe,{noBoxShadow:!0,selected:!0,color:e.color,badge:e.severity,key:e.id,text:e.name}))),n.filter((e=>-1!=r.indexOf(e.id))).map((e=>t.createElement(ySe,{noBoxShadow:!0,selected:!0,color:e.color,key:e.id,text:e.name,bordered:!0}))),a.filter((e=>-1==i.indexOf(e.id))).map((e=>t.createElement("span",{key:e.id,style:{opacity:i.length>0||r.length>0?.5:1}},t.createElement(ySe,{noBoxShadow:!0,selected:!0,color:e.color,badge:e.severity,text:e.name})))),n.filter((e=>-1==r.indexOf(e.id))).map((e=>t.createElement("span",{key:e.id,style:{opacity:i.length>0||r.length>0?.5:1}},t.createElement(ySe,{noBoxShadow:!0,selected:!0,color:e.color,text:e.name,bordered:!0})))))}A(".mdhui-ss-log-entry .mdhui-face {\n height: 18px;\n width: 18px;\n border-radius: 9px;\n}\n\n.mdhui-ss-log-entry .mdhui-ss-log-entry-section {\n margin-top: 16px;\n}\n\n.mdhui-ss-log-entry .mdhui-ss-section-header {\n font-size: .88em;\n font-weight: 500;\n color: var(--mdhui-text-color-3);\n margin-bottom: 4px;\n}\n\n.mdhui-ss-log-entry .mdhui-ss-notes-preview {\n font-size: .88em;\n white-space: pre-wrap;\n margin: 16px;\n margin-top: 0;\n}\n\n.mdhui-ss-log-entry .mdhui-tracker-item {\n margin-left: 0;\n margin-top: 0;\n}\n\n.mdhui-ss-log-entry .mdhui-ss-notes-content {\n font-size: .88em;\n white-space: pre-wrap;\n}");A(".ss-month-report {\n position: relative;\n width: 100%;\n font-family: ui-rounded, -apple-system, Helvetica, Arial, sans-serif;\n /* default color for PDF rendering */\n background: #FFF;\n background: var(--mdhui-background-color-0);\n}\n\n.ss-month-report>thead>tr>th {\n text-align: left;\n font-size: 21px;\n line-height: 21px;\n width: 100%;\n background: var(--mdhui-background-color-0);\n}\n\n.ss-month-report>thead>tr>th>.header {\n display: block;\n position: relative;\n padding: 16px;\n}\n\n.ss-month-report>thead>tr>th>.header .ss-month-report-product {\n position: absolute;\n right: 16px;\n top: 10px;\n font-size: 15px;\n font-weight: bold;\n padding-left: 40px;\n height: 32px;\n line-height: 18px;\n}\n\n.ss-month-report>thead>tr>th>.header .ss-month-report-product .ss-month-report-product-url {\n font-weight: normal;\n}\n\n.ss-month-report>thead>tr>th>.header .ss-month-report-product img {\n height: 32px;\n position: absolute;\n left: 0;\n top: 0;\n vertical-align: middle;\n}\n\n.ss-month-report>tfoot>tr>td {\n padding: 16px;\n text-align: center;\n font-size: 21px;\n line-height: 21px;\n width: 100%;\n background: var(--mdhui-background-color-0);\n border-top: solid 1px var(--mdhui-border-color-1);\n}");function B_e(e){let a={...H_e[e.icon||"star-o"],className:e.className};return t.createElement(gge,{...a})}A(".ss-notes-timeline {\n padding: 16px;\n padding-top: 48px;\n\n /* Default color for PDF Rendering, since pdf renderer does not support CSS variables */\n border-top: solid 1px #ddd;\n\n border-top: solid 1px var(--mdhui-border-color-1);\n padding-left: 64px;\n position: relative;\n}\n\n.ss-notes-timeline .ss-notes-timeline-title {\n font-size: 17px;\n color: var(--mdhui-text-color-1);\n font-weight: bold;\n position: absolute;\n left: 16px;\n top: 16px;\n}\n\n.ss-notes-timeline .ss-notes-timeline-line {\n position: absolute;\n top: 48px;\n left: 32px;\n\n /* Default color for PDF Rendering, since pdf renderer does not support CSS variables */\n background: #ddd;\n\n background: var(--mdhui-background-color-2);\n bottom: 48px;\n width: 1px;\n}\n\n.ss-notes-timeline .ss-notes-timeline-day {\n margin-bottom: 32px;\n page-break-inside: avoid;\n position: relative;\n\n /* Default color for PDF Rendering, since pdf renderer does not support CSS variables */\n border: solid 1px #ddd;\n\n border: solid 1px var(--mdhui-border-color-1);\n border-radius: 5px;\n padding: 16px;\n}\n\n.ss-notes-timeline .ss-notes-timeline-day .ss-notes-timeline-day-icon {\n font-size: 21px;\n position: absolute;\n left: -51px;\n top: calc(50% - 11px);\n width: 37px;\n text-align: center;\n display: block;\n}\n\n.ss-notes-timeline .ss-notes-timeline-day .ss-notes-timeline-day-circle {\n /* Default color for PDF Rendering, since pdf renderer does not support CSS variables */\n color: #429bdf;\n\n color: var(--mdhui-color-primary);\n}\n\n.notes-timeline .ss-notes-timeline-day .ss-notes-timeline-day-title {\n font-weight: bold;\n font-size: 17px;\n}\n\n.notes-timeline .ss-notes-timeline-day .ss-notes-timeline-note {\n white-space: pre-wrap;\n}");const H_e={star:{color:"#eec04c",icon:N},"star-o":{color:"#eec04c",icon:{prefix:"far",iconName:"star",icon:[576,512,[11088,61446],"f005","M287.9 0c9.2 0 17.6 5.2 21.6 13.5l68.6 141.3 153.2 22.6c9 1.3 16.5 7.6 19.3 16.3s.5 18.1-5.9 24.5L433.6 328.4l26.2 155.6c1.5 9-2.2 18.1-9.7 23.5s-17.3 6-25.3 1.7l-137-73.2L151 509.1c-8.1 4.3-17.9 3.7-25.3-1.7s-11.2-14.5-9.7-23.5l26.2-155.6L31.1 218.2c-6.5-6.4-8.7-15.9-5.9-24.5s10.3-14.9 19.3-16.3l153.2-22.6L266.3 13.5C270.4 5.2 278.7 0 287.9 0zm0 79L235.4 187.2c-3.5 7.1-10.2 12.1-18.1 13.3L99 217.9 184.9 303c5.5 5.5 8.1 13.3 6.8 21L171.4 443.7l105.2-56.2c7.1-3.8 15.6-3.8 22.6 0l105.2 56.2L384.2 324.1c-1.3-7.7 1.2-15.5 6.8-21l85.9-85.1L358.6 200.5c-7.8-1.2-14.6-6.1-18.1-13.3L287.9 79z"]}},"user-md":{color:"#397d49",icon:ne},"hospital-o":{color:"#4154af",icon:{prefix:"fas",iconName:"hospital",icon:[640,512,[127973,62589,"hospital-alt","hospital-wide"],"f0f8","M192 48c0-26.5 21.5-48 48-48H400c26.5 0 48 21.5 48 48V512H368V432c0-26.5-21.5-48-48-48s-48 21.5-48 48v80H192V48zM48 96H160V512H48c-26.5 0-48-21.5-48-48V320H80c8.8 0 16-7.2 16-16s-7.2-16-16-16H0V224H80c8.8 0 16-7.2 16-16s-7.2-16-16-16H0V144c0-26.5 21.5-48 48-48zm544 0c26.5 0 48 21.5 48 48v48H560c-8.8 0-16 7.2-16 16s7.2 16 16 16h80v64H560c-8.8 0-16 7.2-16 16s7.2 16 16 16h80V464c0 26.5-21.5 48-48 48H480V96H592zM312 64c-8.8 0-16 7.2-16 16v24H272c-8.8 0-16 7.2-16 16v16c0 8.8 7.2 16 16 16h24v24c0 8.8 7.2 16 16 16h16c8.8 0 16-7.2 16-16V152h24c8.8 0 16-7.2 16-16V120c0-8.8-7.2-16-16-16H344V80c0-8.8-7.2-16-16-16H312z"]}},ambulance:{color:"#f2471c",icon:D},flag:{color:"#c4291c",icon:{prefix:"fas",iconName:"flag",icon:[448,512,[127988,61725],"f024","M64 32C64 14.3 49.7 0 32 0S0 14.3 0 32V64 368 480c0 17.7 14.3 32 32 32s32-14.3 32-32V352l64.3-16.1c41.1-10.3 84.6-5.5 122.5 13.4c44.2 22.1 95.5 24.8 141.7 7.4l34.7-13c12.5-4.7 20.8-16.6 20.8-30V66.1c0-23-24.2-38-44.8-27.7l-9.6 4.8c-46.3 23.2-100.8 23.2-147.1 0c-35.1-17.6-75.4-22-113.5-12.5L64 48V32z"]}},"moon-o":{color:"#9d9083",icon:{prefix:"fas",iconName:"moon",icon:[384,512,[127769,9214],"f186","M223.5 32C100 32 0 132.3 0 256S100 480 223.5 480c60.6 0 115.5-24.2 155.8-63.4c5-4.9 6.3-12.5 3.1-18.7s-10.1-9.7-17-8.5c-9.8 1.7-19.8 2.6-30.1 2.6c-96.9 0-175.5-78.8-175.5-176c0-65.8 36-123.1 89.3-153.3c6.1-3.5 9.2-10.5 7.7-17.3s-7.3-11.9-14.3-12.5c-6.3-.5-12.6-.8-19-.8z"]}},flask:{color:"#429bdf",icon:{prefix:"fas",iconName:"flask",icon:[448,512,[],"f0c3","M288 0H160 128C110.3 0 96 14.3 96 32s14.3 32 32 32V196.8c0 11.8-3.3 23.5-9.5 33.5L10.3 406.2C3.6 417.2 0 429.7 0 442.6C0 480.9 31.1 512 69.4 512H378.6c38.3 0 69.4-31.1 69.4-69.4c0-12.8-3.6-25.4-10.3-36.4L329.5 230.4c-6.2-10.1-9.5-21.7-9.5-33.5V64c17.7 0 32-14.3 32-32s-14.3-32-32-32H288zM192 196.8V64h64V196.8c0 23.7 6.6 46.9 19 67.1L309.5 320h-171L173 263.9c12.4-20.2 19-43.4 19-67.1z"]}},bolt:{color:"#f5b722",icon:{prefix:"fas",iconName:"bolt",icon:[448,512,[9889,"zap"],"f0e7","M349.4 44.6c5.9-13.7 1.5-29.7-10.6-38.5s-28.6-8-39.9 1.8l-256 224c-10 8.8-13.6 22.9-8.9 35.3S50.7 288 64 288H175.5L98.6 467.4c-5.9 13.7-1.5 29.7 10.6 38.5s28.6 8 39.9-1.8l256-224c10-8.8 13.6-22.9 8.9-35.3s-16.6-20.7-30-20.7H272.5L349.4 44.6z"]}},"question-circle-o":{color:"#71aa3a",icon:X},thermometer:{color:"#a3144d",icon:{prefix:"fas",iconName:"thermometer",icon:[512,512,[],"f491","M96 382.1V293.3c0-14.9 5.9-29.1 16.4-39.6l27.3-27.3 57 57c6.2 6.2 16.4 6.2 22.6 0s6.2-16.4 0-22.6l-57-57 41.4-41.4 57 57c6.2 6.2 16.4 6.2 22.6 0s6.2-16.4 0-22.6l-57-57 41.4-41.4 57 57c6.2 6.2 16.4 6.2 22.6 0s6.2-16.4 0-22.6l-57-57 45.5-45.5C355.2 10.9 381.4 0 408.8 0C465.8 0 512 46.2 512 103.2c0 27.4-10.9 53.6-30.2 73L258.3 399.6c-10.5 10.5-24.7 16.4-39.6 16.4H129.9L41 505c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l89-89z"]}},trophy:{color:"#e0bc39",icon:{prefix:"fas",iconName:"trophy",icon:[576,512,[127942],"f091","M400 0H176c-26.5 0-48.1 21.8-47.1 48.2c.2 5.3 .4 10.6 .7 15.8H24C10.7 64 0 74.7 0 88c0 92.6 33.5 157 78.5 200.7c44.3 43.1 98.3 64.8 138.1 75.8c23.4 6.5 39.4 26 39.4 45.6c0 20.9-17 37.9-37.9 37.9H192c-17.7 0-32 14.3-32 32s14.3 32 32 32H384c17.7 0 32-14.3 32-32s-14.3-32-32-32H357.9C337 448 320 431 320 410.1c0-19.6 15.9-39.2 39.4-45.6c39.9-11 93.9-32.7 138.2-75.8C542.5 245 576 180.6 576 88c0-13.3-10.7-24-24-24H446.4c.3-5.2 .5-10.4 .7-15.8C448.1 21.8 426.5 0 400 0zM48.9 112h84.4c9.1 90.1 29.2 150.3 51.9 190.6c-24.9-11-50.8-26.5-73.2-48.3c-32-31.1-58-76-63-142.3zM464.1 254.3c-22.4 21.8-48.3 37.3-73.2 48.3c22.7-40.3 42.8-100.5 51.9-190.6h84.4c-5.1 66.3-31.1 111.2-63 142.3z"]}},spoon:{color:"#6e4b3f",icon:{prefix:"fas",iconName:"spoon",icon:[512,512,[129348,61873,"utensil-spoon"],"f2e5","M245.8 220.9c-14.5-17.6-21.8-39.2-21.8-60.8C224 80 320 0 416 0c53 0 96 43 96 96c0 96-80 192-160.2 192c-21.6 0-43.2-7.3-60.8-21.8L54.6 502.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L245.8 220.9z"]}}};function q_e(e){let a=r(D_e);if(!a)return t.createElement($q,{innerRef:e.innerRef},"Error: Notes timeline must be used inside a Symptom Shark Visualization Coordinator.");let n=r(rM),i=n?.intervalStart??e.intervalStart??In(new Date);if(!a.symptoms.length&&!a.treatments.length)return null;var o=nl(i.getFullYear(),i.getMonth()).filter((e=>a.logEntries[Br(e)]?.notes?.length));return o.length?t.createElement("div",{ref:e.innerRef,className:"ss-notes-timeline"},t.createElement("div",{className:"ss-notes-timeline-title"},no("notes")),t.createElement("div",{className:"ss-notes-timeline-line"}),o.map((e=>t.createElement("div",{key:e.toISOString(),className:"ss-notes-timeline-day"},a.logEntries[Br(e)].icon?t.createElement(B_e,{className:"ss-notes-timeline-day-icon",icon:a.logEntries[Br(e)].icon}):t.createElement(gge,{className:"ss-notes-timeline-day-icon ss-notes-timeline-day-circle",icon:Z}),t.createElement("div",{className:"ss-notes-timeline-day-title"},sl(e)),t.createElement("div",{className:"ss-notes-timeline-note"},a.logEntries[Br(e)].notes))))):null}function U_e(e){let a=r(D_e);if(!a)return t.createElement($q,{innerRef:e.innerRef},"Error: Symptom Severity Chart must be used inside a Symptom Shark Visualization Coordinator.");let{logEntries:n}=a,i=r(rM),o=e.intervalStart||In(new Date);i&&(o=i.intervalStart);let s=nl(o.getFullYear(),o.getMonth()),l=function(t){var a=Br(t);if(n[a]){var i=n[a].symptoms.find((t=>e.symptom.id==t.id));if(i&&i.severity)return"3PointScale"==e.symptom.severityTracking?i.severity<4?1:i.severity>=4&&i.severity<8?2:3:i.severity}return 0},c=function(e){for(var t=0,a=0;a<s.length;a++){l(s[a])==e&&t++}return t},u=function(){for(var t=0,a=[],i=0;i<s.length;i++){var r=Br(s[i]);if(n[r]){var o=n[r].symptoms.find((t=>t.id==e.symptom.id));o&&o.severity&&a.push(o)}}if("3PointScale"==e.symptom.severityTracking)t+=a.filter((e=>e.severity&&e.severity<4)).length,t+=2*a.filter((e=>e.severity&&e.severity>=4&&e.severity<8)).length,t+=3*a.filter((e=>e.severity&&e.severity>=8)).length;else for(var l=0;l<a.length;l++)t+=a[l].severity??0;return t/a.length}();return isNaN(u)?null:t.createElement("div",{ref:e.innerRef,className:"mdhui-ss-severity-chart"+("monthReport"==e.variant?" mdhui-ss-severity-chart-month-report":"")},t.createElement(nS,{title:e.symptom.name+" "+no("severity")}),"3PointScale"==e.symptom.severityTracking&&t.createElement(t.Fragment,null,t.createElement("div",{className:"mdhui-ss-severity-chart-inner mdhui-ss-severity-chart-three-point-scale"},t.createElement("div",{className:"mdhui-ss-severity-chart-y-axis"},t.createElement("div",{className:"mdhui-ss-severity-chart-value"},t.createElement("span",{className:"mdhui-ss-severity-chart-total"},c(3)),no("severe-shortened")),t.createElement("div",{className:"mdhui-ss-severity-chart-value"},t.createElement("span",{className:"mdhui-ss-severity-chart-total"},c(2)),no("moderate-shortened")),t.createElement("div",{className:"mdhui-ss-severity-chart-value"},t.createElement("span",{className:"mdhui-ss-severity-chart-total"},c(1)),no("mild-shortened")),t.createElement("div",{className:"mdhui-ss-severity-chart-value"},t.createElement("span",{className:"mdhui-ss-severity-chart-total"}),"---")),t.createElement("div",{className:"mdhui-ss-severity-chart-x-axis-line"}),t.createElement("div",{className:"mdhui-ss-severity-chart-x-axis-line",style:{top:"48px"}}),t.createElement("div",{className:"mdhui-ss-severity-chart-x-axis-line",style:{top:"72px"}}),t.createElement("div",{className:"mdhui-ss-severity-chart-x-axis-line",style:{top:"96px"}}),t.createElement("div",{style:{position:"relative",height:"100%"}},s.map((a=>t.createElement("div",{key:a.toISOString(),className:"mdhui-ss-severity-chart-day-wrapper",style:{width:100/s.length+"%"}},(e.showAllDays||(a.getDate()-1)%2==0)&&t.createElement("div",{className:"mdhui-ss-severity-chart-day-marker"},a.getDate()),t.createElement("div",{className:"mdhui-ss-severity-chart-bar",style:{height:24*l(a)+"px",backgroundColor:e.symptom.color}},t.createElement(tS,null))))))),u&&t.createElement("div",{className:"mdhui-ss-severity-chart-average-wrapper"},no("average")," ",t.createElement("div",{className:"mdhui-ss-severity-chart-average"},wl(u,1)," / 3"))),"10PointScale"==e.symptom.severityTracking&&t.createElement("div",null,t.createElement("div",{className:"mdhui-ss-severity-chart-inner mdhui-ss-severity-chart-ten-point-scale"},t.createElement("div",{className:"mdhui-ss-severity-chart-y-axis"},[10,9,8,7,6,5,4,3,2,1].map((e=>t.createElement("div",{key:e,className:"mdhui-ss-severity-chart-value"},t.createElement("span",{className:"mdhui-ss-severity-chart-total"},c(e)),t.createElement("div",{className:"mdhui-ss-severity-chart-value-label"},e)))),t.createElement("div",{className:"mdhui-ss-severity-chart-value"},t.createElement("span",{className:"mdhui-ss-severity-chart-total"}),t.createElement("div",{className:"mdhui-ss-severity-chart-value-label"},"0"))),[10,9,8,7,6,5,4,3,2,1].map((e=>t.createElement("div",{key:e,className:"mdhui-ss-severity-chart-x-axis-line",style:{top:24*(11-e)+"px"}}))),t.createElement("div",{style:{position:"relative",height:"100%"}},s.map((a=>t.createElement("div",{key:a.toISOString(),className:"mdhui-ss-severity-chart-day-wrapper",style:{width:100/s.length+"%"}},(e.showAllDays||(a.getDate()-1)%2==0)&&t.createElement("div",{className:"mdhui-ss-severity-chart-day-marker"},a.getDate()),t.createElement("div",{className:"mdhui-ss-severity-chart-bar",style:{height:24*l(a)+"px",backgroundColor:e.symptom.color}},t.createElement(tS,null))))))),u&&t.createElement("div",{className:"mdhui-ss-severity-chart-average-wrapper"},no("average")," ",t.createElement("div",{className:"mdhui-ss-severity-chart-average"},wl(u,1)," / 10"))))}function V_e(e){let a=r(D_e);if(!a)return t.createElement($q,{innerRef:e.innerRef},"Error: Month report must be used inside a Symptom Shark Visualization Coordinator.");let n=r(rM),i=n?.intervalStart??e.intervalStart??In(new Date);return a.symptoms.length||a.treatments.length?t.createElement("table",{ref:e.innerRef,className:"ss-month-report",cellPadding:"0",cellSpacing:"0"},t.createElement("thead",null,t.createElement("tr",null,t.createElement("th",null,t.createElement("div",{className:"header"},ul(i.getMonth())," ",i.getFullYear(),t.createElement("div",{className:"product"},e.productLogo&&t.createElement("img",{src:e.productLogo}),e.productName&&t.createElement("div",{className:"product-name"},e.productName),e.productUrl&&t.createElement("a",{href:e.productUrl,className:"product-url"},e.productUrl)))))),t.createElement("tbody",null,t.createElement("tr",null,t.createElement("td",null,t.createElement(N_e,null),e.includeDailyOverallFeeling&&t.createElement(R_e,{variant:"monthReport",showAllDays:!0}),a.symptoms.filter((e=>!e.inactive&&e.severityTracking&&"None"!=e.severityTracking)).map((e=>t.createElement(U_e,{key:e.id,variant:"monthReport",symptom:e,showAllDays:!0}))),e.includeNotes&&t.createElement(q_e,null))))):null}A(".mdhui-ss-severity-chart {\n position: relative;\n}\n\n.mdhui-ss-severity-chart .mdhui-ss-severity-chart-average-wrapper {\n font-size: 17px;\n padding: 16px;\n position: absolute;\n right: 0;\n top: 0;\n}\n\n.mdhui-ss-severity-chart .mdhui-ss-severity-chart-average-wrapper .mdhui-ss-severity-chart-average {\n font-weight: bold;\n display: inline;\n}\n\n.mdhui-ss-severity-chart .mdhui-ss-severity-chart-inner {\n position: relative;\n height: 304px;\n padding: 16px;\n box-sizing: border-box;\n padding-left: 64px;\n page-break-inside: avoid;\n}\n\n.mdhui-ss-severity-chart .mdhui-ss-severity-chart-inner .mdhui-ss-severity-chart-x-axis-line {\n position: absolute;\n width: calc(100% - 64px);\n height: 1px;\n\n /* Default color for PDF Rendering, since evopdf does not support CSS variables */\n background: #eee;\n\n background: var(--mdhui-background-color-1);\n left: 64px;\n top: 24px;\n}\n\n.mdhui-ss-severity-chart .mdhui-ss-severity-chart-lines {\n position: absolute;\n left: 0;\n right: 0;\n top: 0.5px;\n bottom: 0;\n width: 100%;\n height: 100%;\n}\n\n.mdhui-ss-severity-chart .mdhui-ss-severity-chart-y-axis {\n position: absolute;\n left: 0;\n top: 16px;\n}\n\n.mdhui-ss-severity-chart .mdhui-ss-severity-chart-value {\n height: 16px;\n margin-bottom: 8px;\n display: block;\n text-align: right;\n font-weight: bold;\n width: 56px;\n font-size: 9px;\n white-space: nowrap;\n position: relative;\n line-height: 16px;\n}\n\n.mdhui-ss-severity-chart .mdhui-ss-severity-chart-value .mdhui-ss-severity-chart-value-label {\n border-radius: 32px;\n padding: 3px;\n font-size: 9px;\n font-weight: bold;\n text-align: center;\n min-width: 10px;\n display: inline-block;\n color: var(--mdhui-text-color-1);\n line-height: 10px;\n background: #eec04c;\n}\n\n.mdhui-ss-severity-chart .mdhui-ss-severity-chart-value .mdhui-ss-severity-chart-total {\n position: absolute;\n right: 24px;\n top: 0;\n font-size: 15px;\n}\n\n\n.mdhui-ss-severity-chart .mdhui-ss-severity-chart-day-wrapper {\n position: relative;\n float: left;\n height: 260px;\n}\n\n.mdhui-ss-severity-chart .mdhui-ss-severity-chart-day-wrapper .mdhui-ss-severity-chart-day-marker {\n position: absolute;\n left: 0;\n bottom: -16px;\n width: 100%;\n text-align: center;\n font-size: 12px;\n color: var(--mdhui-text-color-2);\n}\n\n.mdhui-ss-severity-chart .mdhui-ss-severity-chart-day-wrapper .mdhui-ss-severity-chart-day-star {\n position: absolute;\n left: 0;\n bottom: -32px;\n width: 100%;\n text-align: center;\n font-size: 9px;\n color: var(--ss-tertiary-theme-color);\n display: none;\n}\n\n.mdhui-ss-severity-chart .mdhui-ss-severity-chart-day-wrapper .mdhui-ss-severity-chart-bar {\n position: absolute;\n width: 7px;\n background: var(--ss-bar-graph-bar-color);\n left: 0;\n width: 100%;\n bottom: 12px;\n}\n\n.mdhui-ss-severity-chart .mdhui-ss-severity-chart-three-point-scale {\n height: 136px;\n}\n\n.mdhui-ss-severity-chart .mdhui-ss-severity-chart-three-point-scale .mdhui-ss-severity-chart-day-wrapper {\n height: 92px;\n}\n\n\n.mdhui-ss-severity-chart.mdhui-ss-severity-chart-month-report .mdhui-ss-severity-chart-inner {\n padding-left: calc(25% + 8px);\n}\n\n.mdhui-ss-severity-chart.mdhui-ss-severity-chart-month-report .mdhui-ss-severity-chart-y-axis {\n left: calc(25% - 56px);\n}\n\n.mdhui-ss-severity-chart.mdhui-ss-severity-chart-month-report .mdhui-ss-severity-chart-x-axis-line {\n width: calc(75% - 32px);\n left: calc(25% + 16px);\n}\n\n.mdhui-ss-severity-chart.mdhui-ss-severity-chart-month-report .mdhui-ss-severity-chart-average-wrapper {\n display: block;\n padding-top: 16px;\n font-size: 15px;\n text-transform: uppercase;\n font-weight: normal;\n position: absolute;\n left: 16px;\n top: 64px;\n text-align: left;\n padding: 0;\n padding-bottom: 8px;\n right: auto;\n}\n\n.mdhui-ss-severity-chart.mdhui-ss-severity-chart-month-report .mdhui-ss-severity-chart-average-wrapper .mdhui-ss-severity-chart-average {\n margin-top: 8px;\n font-size: 34px;\n font-weight: bold;\n display: block;\n line-height: 34px;\n}");function W_e(e){let a=r(D_e);if(!a)return t.createElement($q,{innerRef:e.innerRef},"Error: Symptom Treatment Histograms must be used inside a Symptom Shark Visualization Coordinator.");let{symptoms:n,treatments:i,logEntries:o}=a,s=r(rM),l=e.intervalStart||In(new Date);s&&(l=s.intervalStart);var c=[];n.forEach((t=>{for(var a=0,n=l;n.getMonth()==l.getMonth();){var i=o[Br(n)];i&&i.symptoms.find((e=>e.id==t.id))&&a++,n=cn(n,{days:1})}var r=t.severityTracking&&"None"!=t.severityTracking?function(){e.onSymptomSelected(t.id,l)}:void 0;a>0&&c.push({color:t.color,label:t.name,value:a,onSelect:r})}));var u=[];return i.forEach((e=>{for(var t=0,a=l;a.getMonth()==l.getMonth();){var n=o[Br(a)];n&&n.treatments.find((t=>t.id==e.id))&&t++,a=cn(a,{days:1})}t>0&&u.push({color:e.color,label:e.name,value:t})})),u.length||c.length?t.createElement("div",{ref:e.innerRef,className:"mdhui-ss-histograms"},t.createElement("div",{className:"mdhui-ss-histogram"},t.createElement(sM,{className:"mdhui-ss-histogram-title",order:4},no("symptoms")),t.createElement(_M,{className:"ss-histogram",entries:c})),t.createElement("div",{className:"mdhui-ss-histogram"},t.createElement(sM,{className:"mdhui-ss-histogram-title",order:4},no("treatments")),t.createElement(_M,{className:"ss-histogram",entries:u})),t.createElement("div",{style:{clear:"both"}})):null}A(".mdhui-ss-histograms {\n border-top: solid 1px var(--mdhui-border-color-1);\n border-bottom: solid 1px var(--mdhui-border-color-1);\n box-shadow: var(--mdhui-box-shadow-0);\n}\n\n.mdhui-ss-histograms .mdhui-ss-histogram {\n padding: 16px;\n float: left;\n width: 50%;\n box-sizing: border-box;\n position: relative;\n padding-right: 32px;\n}\n\n.mdhui-ss-histograms .mdhui-ss-histogram .mdhui-ss-histogram-title {\n color: var(--mdhui-text-color-1);\n display: block;\n padding-bottom: 8px;\n}\n\n.mdhui-ss-histograms .mdhui-ss-histogram .ss-histogram {\n padding: 0;\n}");function $_e(e){let a=r(D_e);if(!a)return t.createElement($q,{innerRef:e.innerRef},"Error: Symptom Severity Summary must be used inside a Symptom Shark Visualization Coordinator.");let{logEntries:n}=a,i=r(rM),o=e.intervalStart||In(new Date);i&&(o=i.intervalStart);var s=nl(o.getFullYear(),o.getMonth()),l=function(t){var a=Br(t);if(n[a]){var i=n[a].symptoms.find((t=>e.symptom.id==t.id));if(i&&i.severity)return i.severity}return 0},c=function(e,t){for(var a=0,n=0;n<s.length;n++){var i=l(s[n]);i>=e&&i<=t&&a++}return a};return"3PointScale"!=e.symptom.severityTracking?null:t.createElement("div",{ref:e.innerRef,className:"mdhui-ss-symptom-severity-summaries"},t.createElement("div",{className:"mdhui-ss-symptom-severity-summary"},t.createElement("div",{className:"mdhui-ss-symptom-severity-summary-label"},no("severe")),t.createElement("div",{className:"mdhui-ss-symptom-severity-summary-count"},c(8,10))),t.createElement("div",{className:"mdhui-ss-symptom-severity-summary"},t.createElement("div",{className:"mdhui-ss-symptom-severity-summary-label"},no("moderate")),t.createElement("div",{className:"mdhui-ss-symptom-severity-summary-count"},c(4,7))),t.createElement("div",{className:"mdhui-ss-symptom-severity-summary"},t.createElement("div",{className:"mdhui-ss-symptom-severity-summary-label"},no("mild")),t.createElement("div",{className:"mdhui-ss-symptom-severity-summary-count"},c(1,3))),t.createElement("div",{style:{clear:"both"}}))}A(".mdhui-ss-symptom-severity-summaries .mdhui-ss-symptom-severity-summary {\n width: 33%;\n float: left;\n text-align: center;\n padding: 16px;\n box-sizing: border-box;\n}\n\n.mdhui-ss-symptom-severity-summaries .mdhui-ss-symptom-severity-summary-label {\n padding: 8px;\n}\n\n.mdhui-ss-symptom-severity-summaries .mdhui-ss-symptom-severity-summary-count {\n font-size: 34px;\n font-weight: bold;\n}");let G_e={participantID:"123",symptoms:[{id:"1",color:"#c4291c",name:"Headache",severityTracking:"3PointScale"},{id:"2",color:"#e35c33",name:"Nausea",severityTracking:"10PointScale"},{id:"3",color:"#5db37e",name:"Dizziness",severityTracking:"None"}],treatments:[{id:"10",color:"#c4291c",name:"Tylenol"},{id:"12",color:"#e35c33",name:"Rest"}]},K_e={symptoms:[{id:"1",severity:2},{id:"2",severity:7},{id:"3"}],treatments:[{id:"10"},{id:"12"}],overallFeeling:5,notes:"I'm feeling a little better today."};function Z_e(e){const[a,n]=c({}),[i,r]=c(null),[o,s]=c([new Date]);function u(){if(Br(o[0])!=Br(new Date)&&s([new Date]),"default"!=e.previewState)S_e.getConfiguration().then((function(e){S_e.getDailyLogEntries().then((function(t){r(e),n(t)}))}));else{r(G_e);let e=Br(cn(new Date,{days:-1}));n({...a,[e]:K_e})}}return l((()=>(u(),w.on("applicationDidBecomeVisible",u),()=>{w.off("applicationDidBecomeVisible",u)})),[]),t.createElement("div",{ref:e.innerRef,className:"log-entry-list"},i&&o.map((n=>t.createElement(L_e,{noDataMessage:Br(n)==Br(new Date)?no("tap-to-log-today"):void 0,key:Br(n),date:n,configuration:i,logEntry:a[Br(n)],onClick:()=>e.onDaySelected(n)}))),t.createElement(Vue,{enabled:!!i,onTrigger:()=>function(){for(var e=[...o],t=0;t<30;t++){var a=cn(e[e.length-1],{days:-1});e.push(a)}s(e)}()}),t.createElement(XA,null))}function Y_e(e){const[a,n]=c(null),[i,r]=c(void 0);var o=new Date;function s(){if("withLog"==e.previewState)return n(G_e),void r(K_e);"noLog"!=e.previewState?Promise.all([S_e.getDailyLogEntries(Br(cn(o,{days:-1}))),S_e.getConfiguration()]).then((function([e,t]){n(t),e[Br(o)]?r(e[Br(o)]):r(void 0)})):n(G_e)}return o=new Date(o.getFullYear(),o.getMonth(),o.getDate(),0,0,0,0),l((()=>(s(),w.on("applicationDidBecomeVisible",s),()=>{w.off("applicationDidBecomeVisible",s)})),[]),a&&a.symptoms.length?t.createElement(L_e,{onClick:t=>e.onClick(t),innerRef:e.innerRef,title:no(i?"todays-log":"log-todays-symptoms"),date:o,logEntry:i,configuration:a}):null}function X_e(e){const[a,n]=c(null),[i,r]=c(!1),[o,s]=c(null),[u,d]=c(!1),[h,m]=c(null);function p(e,t){t==no("mild-shortened")?t=2:t==no("moderate-shortened")?t=5:t==no("severe-shortened")&&(t=8);var n={...a},i=[...n.symptoms];i.find((t=>t.id==e.id))&&i.splice(i.findIndex((t=>t.id==e.id)),1),t&&i.push({id:e.id,severity:t}),n.symptoms=i,f(n),m(null)}function f(t){n(t),"default"!=e.previewState&&(d(!0),S_e.saveDailyLogEntry(Br(e.date),t).then((function(){d(!1)})))}function y(e){var t={...a};t.overallFeeling==e?t.overallFeeling=void 0:t.overallFeeling=e,f(t)}l((()=>{!function(){if("default"==e.previewState)return s(G_e),void n(K_e);var t=cn(e.date,{days:-14}),a=cn(e.date,{days:1});S_e.getConfiguration().then((function(i){S_e.getDailyLogEntries(_i(t),_i(a)).then((function(t){s(i),t[Br(e.date)]?n(t[Br(e.date)]):n({symptoms:[],treatments:[],notes:""}),e.promptForReviewAfterDays&&Object.keys(t).length>e.promptForReviewAfterDays&&r(!0)}))}))}()}),[]);const v=g((()=>nd(f,300)),[]);var b,x,k,A=il(e.date);function S(e){var t=a.symptoms.find((t=>t.id==e.id));if(t){if("10PointScale"==e.severityTracking){if(!t.severity)return;return t.severity.toString()}if("3PointScale"==e.severityTracking){if(!t.severity)return;if(t.severity>0&&t.severity<=3)return no("mild-shortened");if(t.severity>3&&t.severity<=7)return no("moderate-shortened");if(t.severity>7)return no("severe-shortened")}}}return A+=", "+bl(tl(e.date),"PP"),t.createElement("div",{className:"mdhui-ss-log-entry-edit-wrapper"},t.createElement(XAe,{title:A,showBackButton:!0,variant:"compressed",backgroundColor:"var(--mdhui-background-color-0)",className:"mdhui-ss-edit-nav"}),t.createElement("div",{className:"mdhui-ss-log-entry-edit"},!a&&t.createElement(XA,null),!!a&&!!o&&t.createElement(t.Fragment,null,t.createElement("div",{style:{width:"100%",overflow:"hidden"}},(x=(b=a).symptoms.map((e=>o.symptoms.find((t=>t.id==e.id))?.color)).filter((e=>!!e)).map((e=>e)),k=b.treatments.map((e=>o.treatments.find((t=>t.id==e.id))?.color)).filter((e=>!!e)).map((e=>e)),t.createElement(uM,{size:"large",key:x.join("|")+","+k.join("|"),primaryColors:x,secondaryColors:k}))),Sn(new Date,e.date)&&t.createElement(sM,{className:"mdhui-ss-edit-title",order:3},no("symptoms-experiencing-today")),!Sn(new Date,e.date)&&t.createElement(sM,{className:"mdhui-ss-edit-title",order:3},no("symptoms-experiencing-previous")),t.createElement("div",{className:"mdhui-ss-edit-items"},o?.symptoms.filter((e=>!e.inactive)).map((e=>t.createElement(ySe,{className:"mdhui-ss-edit-item",selected:!!a.symptoms.find((t=>t.id==e.id)),color:e.color,text:e.name,key:e.id,onClick:()=>function(e){if("10PointScale"!=e.severityTracking&&"3PointScale"!=e.severityTracking){var t={...a},n=[...t.symptoms];n.find((t=>t.id==e.id))?n.splice(n.findIndex((t=>t.id==e.id)),1):n.push({id:e.id}),t.symptoms=n,f(t)}else m(e)}(e),badge:S(e)})))),o.treatments.length>0&&t.createElement("div",null,Sn(new Date,e.date)&&t.createElement(sM,{className:"mdhui-ss-edit-title",order:3},no("treatments-experiencing-today")),!Sn(new Date,e.date)&&t.createElement(sM,{className:"mdhui-ss-edit-title",order:3},no("treatments-experiencing-previous")),t.createElement("div",{className:"mdhui-ss-edit-items"},o?.treatments.filter((e=>!e.inactive)).map((e=>t.createElement(ySe,{className:"mdhui-ss-edit-item",selected:!!a.treatments.find((t=>t.id==e.id)),color:e.color,text:e.name,key:e.id,onClick:()=>{return t=e,n={...a},(i=[...n.treatments]).find((e=>e.id==t.id))?i.splice(i.findIndex((e=>e.id==t.id)),1):i.push({id:t.id}),n.treatments=i,void f(n);var t,n,i},bordered:!0}))))),Sn(new Date,e.date)&&t.createElement(sM,{className:"mdhui-ss-edit-title",order:3},no("feeling-overall-today")),!Sn(new Date,e.date)&&t.createElement(sM,{className:"mdhui-ss-edit-title",order:3},no("feeling-overall-previous")),t.createElement("div",{className:"mdhui-ss-edit-items"},t.createElement(xM,{className:"mdhui-ss-edit-face",faceValue:5,selected:5==a.overallFeeling,onClick:()=>y(5)}),t.createElement(xM,{className:"mdhui-ss-edit-face",faceValue:4,selected:4==a.overallFeeling,onClick:()=>y(4)}),t.createElement(xM,{className:"mdhui-ss-edit-face",faceValue:3,selected:3==a.overallFeeling,onClick:()=>y(3)}),t.createElement(xM,{className:"mdhui-ss-edit-face",faceValue:2,selected:2==a.overallFeeling,onClick:()=>y(2)}),t.createElement(xM,{className:"mdhui-ss-edit-face",faceValue:1,selected:1==a.overallFeeling,onClick:()=>y(1)})),t.createElement(sM,{className:"mdhui-ss-edit-title",order:3,style:{marginBottom:"16px"}},no("additional-notes")),t.createElement(QAe,{placeholder:no("add-notes"),autoTimestamp:Sn(new Date,e.date),onChange:e=>function(e){var t={...a};t.notes=e,n(t),v(t)}(e),value:a.notes}),t.createElement(QA,{onClick:()=>(i&&w.requestReview(7),void(u||w.back()))},no("done")),h&&t.createElement("div",{className:"mdhui-ss-symptom-edit-modal"},t.createElement("div",{className:"mdhui-ss-symptom-edit-padder"},t.createElement("div",{className:"mdhui-ss-symptom-edit-container"},t.createElement(sM,{className:"mdhui-ss-edit-title",order:3,style:{marginBottom:"16px"}},Sn(new Date,e.date)?no("how-severe-is"):no("how-severe-was")," ",h.name,"?"),"3PointScale"==h.severityTracking&&t.createElement(sSe,{variant:"optionsVertical",segments:[{key:no("mild-shortened"),title:no("mild")},{key:no("moderate-shortened"),title:no("moderate")},{key:no("severe-shortened"),title:no("severe")}],selectedSegment:S(h),onSegmentSelected:e=>p(h,e)}),"10PointScale"==h.severityTracking&&t.createElement(sSe,{variant:"optionsVertical",segments:[1,2,3,4,5,6,7,8,9,10].map((e=>({key:e.toString(),title:e.toString()}))),selectedSegment:S(h),onSegmentSelected:e=>p(h,parseInt(e))}),t.createElement(QA,{className:"mdhui-ss-clear-symptom",variant:"subtle",onClick:()=>p(h,null)},no("clear-symptom"))))))))}A(".mdhui-ss-log-entry-edit-wrapper {\n background: var(--mdhui-background-color-0);\n}\n\n.mdhui-ss-log-entry-edit {\n text-align: center;\n padding-left: 16px;\n padding-right: 16px;\n padding-bottom: 16px;\n padding-top: 8px;\n position: relative;\n /*Prevents keyboard from covering notes on Android devices*/\n padding-bottom: 300px;\n overflow-x: hidden;\n width: 100%;\n box-sizing: border-box;\n}\n\n\n.mdhui-ss-log-entry-edit .mdhui-ss-edit-title {\n text-align: center;\n margin-bottom: 0;\n margin-top: 16px;\n display: block;\n}\n\n.mdhui-ss-log-entry-edit .mdhui-ss-edit-items {\n padding-top: 8px;\n padding-bottom: 16px;\n text-align: center;\n}\n\n.mdhui-ss-log-entry-edit .mdhui-ss-edit-item {\n margin: 4px;\n}\n\n.mdhui-ss-log-entry-edit .mdhui-ss-edit-face {\n margin-left: 8px;\n margin-right: 8px;\n}\n\n.mdhui-ss-log-entry-edit .mdhui-ss-symptom-edit-modal {\n position: fixed;\n left: 0;\n top: 0;\n right: 0;\n bottom: 0;\n background-color: var(--mdhui-modal-overlay-color);\n overflow: auto;\n z-index: 999;\n}\n\n.mdhui-ss-log-entry-edit .mdhui-ss-symptom-edit-padder {\n padding-bottom: 16px;\n position: absolute;\n padding-top: 48px;\n top: env(safe-area-inset-top);\n left: 48px;\n right: 48px;\n}\n\n.mdhui-ss-log-entry-edit .mdhui-ss-symptom-edit-container {\n border-radius: var(--mdhui-card-border-radius);\n background: var(--mdhui-background-color-0);\n padding: 16px;\n}");function Q_e(e){var a=In(new Date);const[n,i]=c({}),[r,o]=c(null),[l,u]=c(a),[d,h]=c(!0),[m,p]=c(!1),[g,f]=c(!1),[y,v]=c(!0),[b,x]=c([]),[k,A]=c([]),[E,_]=c(!0),[C,T]=c(!1),[P,M]=c(!1),D=s(null);if(id((()=>{if("default"==e.previewState)return o({participantID:"1",symptoms:C_e,treatments:T_e}),void i(P_e);S_e.getConfiguration().then((function(e){S_e.getDailyLogEntries().then((function(t){o(e),i(t)}))}))}),[],[]),!r||!n)return t.createElement("div",{ref:e.innerRef},t.createElement(XA,null));function I(){M(!0);for(var e,t,a=document.head.getElementsByTagName("style"),n="",i=0;i<a.length;i++)n+=a[i].outerHTML;n+=D.current.innerHTML,(e=n,t=r.participantID,w.persistDeviceData([{type:"ReportHtml",observationDate:_i(new Date),value:e}]).then((function(){var e=w.baseUrl+"WebVisualization/WebVisualizationPDF?patientID="+t+"&modelType=VisualizationModel&visualizationKey=Shared.HtmlToPdf";return w.getDeviceInfo().then((function(t){t&&"Web"!=t.platform?window.webkit.messageHandlers.OpenFile.postMessage({url:e}):window.open(e)}))}))).then((function(){M(!1)}))}return t.createElement("div",{className:"ss-report-builder"},t.createElement(oSe,{className:"ss-report-builder-items",noTopMargin:!0},t.createElement("div",{className:"ss-report-builder-item ss-report-builder-month-selector"},t.createElement("div",{className:"ss-report-builder-selector-title"},no("choose-report-month")),t.createElement(iM,{className:"ss-report-date-chooser",variant:"rounded",intervalStart:l,intervalType:"Month",onIntervalChange:e=>u(e)})),t.createElement(S,{className:"ss-report-builder-item",onClick:()=>h(!d)},t.createElement("div",{className:"ss-report-builder-item-title"},no("include-symptoms")),t.createElement("div",{className:"ss-report-builder-item-status"},t.createElement(gge,{icon:d?TM:PM}))),d&&t.createElement("div",{className:"ss-report-builder-item"},t.createElement("div",{className:"ss-report-builder-item-title"},no("select-symptoms")),t.createElement(S,{className:"ss-report-builder-item-status",onClick:()=>p(!m)},0==b.length?"All":b.length+" Selected"," ",t.createElement(gge,{icon:m?O:ye})),m&&t.createElement("div",{className:"ss-report-items",style:{textAlign:"center"}},r.symptoms.filter((e=>!e.inactive)).map((e=>t.createElement(ySe,{className:"ss-report-item",key:e.id,selected:-1!=b.indexOf(e.id),color:e.color,text:e.name,onClick:()=>{return t=e,(a=[...b]).includes(t.id)?a.splice(a.indexOf(t.id),1):a.push(t.id),void x(a);var t,a}}))))),r.treatments.length>0&&t.createElement(t.Fragment,null,t.createElement(S,{className:"ss-report-builder-item",onClick:()=>v(!y)},t.createElement("div",{className:"ss-report-builder-item-title"},no("include-treatments")),t.createElement("div",{className:"ss-report-builder-item-status"},t.createElement(gge,{icon:y?TM:PM}))),y&&t.createElement("div",{className:"ss-report-builder-item"},t.createElement("div",{className:"ss-report-builder-item-title"},no("select-treatments")),t.createElement(S,{className:"ss-report-builder-item-status",onClick:()=>f(!g)},0==k.length?"All":k.length+" Selected"," ",t.createElement(gge,{icon:g?O:ye})),g&&t.createElement("div",{className:"ss-report-items",style:{textAlign:"center"}},r.treatments.filter((e=>!e.inactive)).map((e=>t.createElement(ySe,{bordered:!0,className:"ss-report-item",key:e.id,selected:-1!=k.indexOf(e.id),color:e.color,text:e.name,onClick:()=>{return t=e,(a=[...k]).includes(t.id)?a.splice(a.indexOf(t.id),1):a.push(t.id),void A(a);var t,a}})))))),t.createElement(S,{className:"ss-report-builder-item",onClick:()=>_(!E)},t.createElement("div",{className:"ss-report-builder-item-title"},no("include-overall-experience")),t.createElement("div",{className:"ss-report-builder-item-status"},t.createElement(gge,{icon:E?TM:PM}))),t.createElement(S,{className:"ss-report-builder-item",onClick:()=>T(!C)},t.createElement("div",{className:"ss-report-builder-item-title"},no("include-notes")),t.createElement("div",{className:"ss-report-builder-item-status"},t.createElement(gge,{icon:C?TM:PM})))),t.createElement("div",{style:{padding:"16px",paddingTop:"0"}},t.createElement(QA,{loading:P,disabled:P||!d&&!y&&!C&&!E,onClick:()=>I()},!P&&t.createElement("span",null,no("create-report")))),t.createElement("div",{ref:D,style:{display:"none"}},t.createElement(rM.Provider,{value:{intervalStart:l,intervalType:"Month",update:lM}},t.createElement(D_e.Provider,{value:{logEntries:n,symptoms:d?r.symptoms.filter((e=>!b.length||-1!=b.indexOf(e.id))):[],treatments:y?r.treatments.filter((e=>!k.length||-1!=k.indexOf(e.id))):[],hasFilteredSymptoms:!!b.length}},t.createElement(V_e,{includeDailyOverallFeeling:E,includeNotes:C,productLogo:e.productLogo,productUrl:e.productUrl,productName:e.productName})))))}function J_e(e){return t.createElement(Ka,{colorScheme:e.colorScheme??"light"},t.createElement(oM,{variant:"rounded",intervalType:"Month",sticky:!0},t.createElement(I_e,{showFilters:!0,previewState:e.previewState},t.createElement(oSe,null,t.createElement(j_e,{onDaySelected:e.onDaySelected})),t.createElement(oSe,null,t.createElement(W_e,{onSymptomSelected:e.onSymptomSelected})),t.createElement(oSe,null,t.createElement(R_e,null)),t.createElement(eCe,null))))}function eCe(){let e=r(D_e);if(!e)return t.createElement($q,null,"Error: Calendar severity charts must be used inside a Symptom Shark Visualization Coordinator.");let{hasFilteredSymptoms:a,symptoms:n}=e;return a?t.createElement(t.Fragment,null,n.filter((e=>"None"!=e.severityTracking)).map((e=>t.createElement(oSe,{key:e.id},t.createElement(U_e,{symptom:e}))))):null}function tCe(e){return t.createElement(Ka,{bodyBackgroundColor:"var(--mdhui-background-color-0)",colorScheme:e.colorScheme||"light"},t.createElement(X_e,{...e}))}function aCe(e){return t.createElement(Ka,{colorScheme:e.colorScheme??"light"},t.createElement(XAe,{variant:"compressed",title:no("reports")}),t.createElement(Q_e,{previewState:e.previewState}))}function nCe(e){return t.createElement(Ka,{colorScheme:e.colorScheme||"light",className:"symptom-detail-view symptom-shark-view"},t.createElement(I_e,{previewState:e.previewState},t.createElement(iCe,{...e})))}function iCe(e){let a=r(D_e);if(!a)return null;let n=a.symptoms.find((t=>t.id==e.symptomId));if(!n)return null;var i=e.initialIntervalStart||In(new Date);return t.createElement(t.Fragment,null,t.createElement(XAe,{title:n.name,showCloseButton:!0}),t.createElement(oM,{initialIntervalStart:i,intervalType:"Month",variant:"rounded"},t.createElement(oSe,{noTopMargin:!0},t.createElement($_e,{symptom:n})),t.createElement(oSe,null,t.createElement(U_e,{symptom:n}))))}function rCe(e){return t.createElement(Ka,{colorScheme:e.colorScheme},t.createElement(XAe,{showBackButton:"Push"==e.presentation,showCloseButton:"Modal"==e.presentation},t.createElement(sM,{order:2,autosizeImage:!0,image:t.createElement("img",{src:bge}),imageAlignment:"left"},no("allergies-title"))),t.createElement(aS,null,t.createElement(Vq,{previewState:e.previewState,onViewTermInfo:t=>function(t){if(e.onViewTermInfo)e.onViewTermInfo(t);else{var a=new URLSearchParams({termFamily:t.TermFamily,termNamespace:t.TermNamespace,termCode:t.TermCode,lang:w.getCurrentLanguage()}).toString();w.openApplication("https://hw.careevolutionapps.com/TermInformation.html?"+a,{modal:!0})}}(t)})))}function oCe(e){return t.createElement(Ka,{bodyBackgroundColor:e.bodyBackgroundColor,colorScheme:e.colorScheme??"auto",primaryColor:e.primaryColor,flex:e.flexLayout},(e.showBackButton||e.showCloseButton)&&t.createElement(XAe,{title:e.title,showBackButton:e.showBackButton,showCloseButton:e.showCloseButton,subtitle:e.subtitle,titleColor:e.titleColor,subtitleColor:e.subtitleColor,buttonColor:e.navigationBarButtonColor}),!(e.showBackButton||e.showCloseButton)&&t.createElement(t.Fragment,null,!e.flexLayout&&t.createElement(fSe,null),t.createElement(bSe,{title:e.title,subtitle:e.subtitle,titleColor:e.titleColor,subtitleColor:e.subtitleColor})),e.children)}function sCe(e){return t.createElement(Ka,{colorScheme:e.colorScheme},t.createElement(XAe,{showBackButton:"Push"==e.presentation,showCloseButton:"Modal"==e.presentation},t.createElement(sM,{order:2,autosizeImage:!0,image:t.createElement("img",{src:xge}),imageAlignment:"left"},no("conditions-title"))),t.createElement(aS,null,t.createElement(rU,{previewState:e.previewState,onViewTermInfo:t=>function(t){if(e.onViewTermInfo)e.onViewTermInfo(t);else{var a=new URLSearchParams({termFamily:t.TermFamily,termNamespace:t.TermNamespace,termCode:t.TermCode,lang:w.getCurrentLanguage()}).toString();w.openApplication("https://hw.careevolutionapps.com/TermInformation.html?"+a,{modal:!0})}}(t)})))}function lCe(e){return t.createElement(oCe,{showBackButton:"Push"==e.presentation,showCloseButton:"Modal"==e.presentation,colorScheme:e.colorScheme},e.deviceActivityViewUrl&&t.createElement(aS,null,t.createElement(UAe,{onClick:()=>w.openApplication(e.deviceActivityViewUrl),dataTypes:dd,previewState:e.previewState?"fetchingData":void 0})),t.createElement(aS,null,t.createElement(EU,{previewState:e.previewState?"Web":void 0,enableAppleHealthSurveyName:e.enableAppleHealthSurveyName,enableGoogleFitSurveyName:e.enableGoogleFitSurveyName,postalCodeSurveyName:e.postalCodeSurveyName})),t.createElement(aS,null,t.createElement(Cde,{previewState:e.previewState?"connected":void 0})),t.createElement(aS,null,t.createElement(Mde,{previewState:e.previewState?"connected":void 0})))}function cCe(e){let a="",n=[];return e.excludeProviders||(n.push("Provider"),a+=no("connect-ehr-title-providers")),e.excludeHealthPlans||(n.push("Health Plan"),a.length>0&&(a+=no("connect-ehr-title-divider")),a+=no("connect-ehr-title-health-plans")),a=no("connect-ehr-title-prefix")+a,t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},e.presentation&&t.createElement(XAe,{title:a,showBackButton:"Push"==e.presentation,showCloseButton:"Modal"==e.presentation}),!e.presentation&&t.createElement(fSe,null),e.onViewEhr&&t.createElement(aS,null,t.createElement(VAe,{previewState:e.preview?"fetchingData":void 0,onClick:e.onViewEhr})),t.createElement(aS,null,t.createElement(vge,null)),e.externalAccountsApplicationUrl&&t.createElement(aS,null,t.createElement(xde,{previewState:e.preview?"Default":void 0,applicationUrl:e.externalAccountsApplicationUrl,excludeProviders:e.excludeProviders,excludeHealthPlans:e.excludeHealthPlans,excludeDeviceManufacturers:!0})),t.createElement(aS,null,t.createElement($q,null,no("ehr-intro-search")),t.createElement(AAe,{previewState:e.preview?"Default":void 0,providerCategories:n})))}function uCe(e){const[a,n]=t.useState("daily"),i=dd.map((e=>({dailyDataType:e.type,color:e.color})));return t.createElement(oCe,{showBackButton:"Push"==e.presentation,showCloseButton:"Modal"==e.presentation,colorScheme:e.colorScheme},t.createElement(sSe,{style:{marginTop:e.presentation?"0px":"16px",marginLeft:"16px",marginRight:"16px",marginBottom:"daily"==a?"16px":"0px"},variant:"default",segments:[{title:no("daily"),key:"daily"},{title:no("weekly"),key:"weekly"},{title:no("monthly"),key:"monthly"}],onSegmentSelected:e=>n(e),selectedSegment:a}),"daily"==a&&t.createElement(_Ae,{dataTypes:i,previewState:e.previewState},t.createElement(aS,null,t.createElement(cM,{defaultMargin:!0}),t.createElement(TAe,{useContext:!0,previewState:e.previewState?"Default":void 0}))),("monthly"==a||"weekly"==a)&&t.createElement(oM,{intervalType:"weekly"==a?"Week":"Month",key:a,variant:"rounded"},t.createElement(oSe,{noTopMargin:!0},dd.map((a=>t.createElement(Lue,{hideIfNoData:a.type!=Hr.Steps&&a.type!=Hr.SleepMinutes,title:a.labelKey?no(a.labelKey):void 0,key:a.type,dailyDataType:a.type,chartType:"Bar",options:{barColor:a.color},previewState:e.previewState}))))))}function dCe(e){return t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},t.createElement(fSe,null),t.createElement(aS,{allowOverflow:!0},t.createElement(que,{previewState:e.preview?"Default":void 0})),t.createElement(aS,null,t.createElement(Cde,{previewState:e.preview?"connected":void 0})),t.createElement(aS,null,t.createElement(Mde,{previewState:e.preview?"connected":void 0})),t.createElement(aS,null,t.createElement(EU,{previewState:e.preview?"Web":void 0})))}A(".ss-report-builder {\n padding-bottom: env(safe-area-inset-bottom);\n position: relative;\n padding-bottom: 16px;\n}\n\n.ss-report-builder .ss-report-builder-items .ss-report-builder-item {\n border-bottom: solid 1px var(--mdhui-border-color-1);\n padding: 16px;\n background: var(--mdhui-background-color-0);\n position: relative;\n cursor: pointer;\n width: 100%;\n box-sizing: border-box;\n}\n\n.ss-report-builder .ss-report-builder-items .ss-report-builder-item .ss-report-builder-item-title {\n font-weight: normal;\n font-size: 17px;\n}\n\n.ss-report-builder .ss-report-builder-items .ss-report-builder-item .ss-report-builder-item-status {\n position: absolute;\n right: 0;\n top: 0;\n padding: 16px;\n cursor: pointer;\n text-align: right;\n width: 100%;\n font-weight: bold;\n}\n\n.ss-report-builder .ss-report-builder-items .ss-report-builder-item svg {\n color: var(--mdhui-text-color-3);\n font-size: 17px;\n top: calc(50% - 16px);\n}\n\n.ss-report-builder .ss-report-builder-items .ss-report-builder-item .fa-circle-check {\n color: var(--mdhui-color-success);\n}\n\n.ss-report-builder .ss-report-builder-items .ss-report-builder-item.ss-report-builder-month-selector {\n text-align: center;\n font-size: 17px;\n font-weight: bold;\n cursor: auto;\n padding-left: 0;\n padding-right: 0;\n padding-bottom: 0;\n}\n\n.ss-report-builder .ss-report-builder-items .ss-report-builder-item.ss-report-month-selector .ss-report-builder-selector-title {\n text-transform: uppercase;\n font-size: 12px;\n color: var(--mdhui-text-color-2);\n padding-bottom: 4px;\n}\n\n.ss-report-builder .ss-report-builder-items .ss-report-date-chooser {\n background: none;\n}\n\n.ss-report-builder .ss-report-items {\n margin-top: 12px;\n margin-bottom: -4px;\n}\n\n.ss-report-builder .ss-report-items .ss-report-item {\n margin: 4px;\n}\n\n.ss-report-builder .ss-report-report-date-chooser {\n margin: 0;\n}");function hCe(e){const[a,n]=c(),[i,r]=c(),[o,u]=c(!1),d=s();id((()=>{e.previewState?(e=>{const t=e.endsWith("mobile")?"iOS":"Web";if(a!==t)return void n(t);const o="loading"===e?void 0:function(e){return{file:"vr_05022025."+(e.startsWith("pdf")?"pdf":"png"),fileType:e.startsWith("pdf")?"pdf":"image",name:"Vaccination Records",type:"Other",date:"2025-05-02",notes:"Here are some notes about this document.",fileUrl:"https://assets.careevolutionapps.com/MDH-UI/grilled_cheese."+(e.startsWith("pdf")?"pdf":"png")}}(e);r(o),u("loading"!==e&&i?.fileUrl!==o?.fileUrl)})(e.previewState):a?WA().load(e.surveyResultId,e.surveySpecification).then((e=>{e?d.current||(r(e),u(!!e.fileUrl)):w.back()})):(async()=>{const e=await w.getDeviceInfo();n(e.platform)})()}),[],[e.previewState,a]),l((()=>{d.current=i}),[i]);const h=async()=>{!e.previewState&&i?.fileUrl&&w.openEmbeddedUrl(i.fileUrl)};return t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},t.createElement(XAe,{showBackButton:!0,className:"mdhui-document-detail-view-nav-bar",navigationBarRight:a&&i?t.createElement("div",{className:"mdhui-document-detail-view-nav-bar-icon",onClick:h},t.createElement(Ne,{icon:"Web"===a?de:W})):void 0}),t.createElement("div",{className:"mdhui-document-detail-view"},!i&&t.createElement(XA,null),i&&t.createElement(t.Fragment,null,t.createElement("div",{className:"mdhui-document-detail-view-preview-container"},t.createElement("div",{className:"mdhui-document-detail-view-preview",onClick:h},o&&t.createElement(XA,{className:"mdhui-document-detail-view-preview-loading"}),i.fileUrl&&"image"===i.fileType&&t.createElement("img",{src:i.fileUrl,style:{display:o?"none":"inline"},onLoad:()=>u(!1),alt:no("document-detail-view-preview-image-alt")}),i.fileUrl&&"pdf"===i.fileType&&t.createElement(yAe,{url:i.fileUrl,style:{display:o?"none":"inline"},maxHeight:.5*window.innerHeight,maxWidth:.8*window.innerWidth,onLoad:()=>u(!1)}),!o&&!i.fileUrl&&t.createElement("div",{className:"mdhui-document-detail-view-preview-unavailable"},no("document-detail-view-preview-unavailable"))),t.createElement("div",{className:"mdhui-document-detail-view-preview-label"},i.file)),t.createElement("div",{className:"mdhui-document-detail-view-document-details"},t.createElement("div",{className:"mdhui-document-detail-view-document-name"},i.name),t.createElement("div",{className:"mdhui-document-detail-view-document-date-and-type"},GA(i)),t.createElement("div",{className:"mdhui-document-detail-view-document-notes-title"},no("document-detail-view-notes-title")),i.notes&&t.createElement("div",{className:"mdhui-document-detail-view-document-notes"},i.notes),!i.notes&&t.createElement("div",{className:"mdhui-document-detail-view-document-notes-none"},no("document-detail-view-notes-none"))),t.createElement("div",{className:"mdhui-document-detail-view-document-buttons"},t.createElement(QA,{variant:"light",color:"var(--mdhui-color-danger)",onClick:async()=>{if(e.previewState||!i)return;window.confirm(no("document-detail-view-delete-confirmation"))&&(i.fileKey&&await w.deleteFile(i.fileKey),await w.deleteSurveyResult(i.surveyResultId),w.back())}},no("document-detail-view-delete-button-text"))))))}A("body:has(.mdhui-document-detail-view) {\n background: var(--mdhui-background-color-0);\n}\n\n.mdhui-navigation-bar.mdhui-document-detail-view-nav-bar {\n background: var(--mdhui-background-color-0);\n margin-bottom: 0;\n}\n\n.mdhui-navigation-bar.mdhui-document-detail-view-nav-bar .mdhui-document-detail-view-nav-bar-icon {\n position: absolute;\n top: calc(0px + env(safe-area-inset-top, 0px));\n right: 8px;\n bottom: 0;\n width: 48px;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--mdhui-color-primary);\n font-size: 1.2em;\n cursor: pointer;\n}\n\n.mdhui-document-detail-view {\n border-top: 1px solid var(--mdhui-background-color-1);\n}\n\n.mdhui-document-detail-view .mdhui-document-detail-view-preview-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n background: var(--mdhui-background-color-2);\n border-top: 1px solid var(--mdhui-border-color-2);\n border-bottom: 1px solid var(--mdhui-border-color-2);\n padding: 16px;\n}\n\n.mdhui-document-detail-view .mdhui-document-detail-view-preview {\n display: flex;\n align-items: center;\n justify-content: center;\n background: var(--mdhui-background-color-1);\n padding: 16px;\n flex: 1;\n box-shadow: var(--mdhui-box-shadow-0);\n max-width: 80vw;\n cursor: pointer;\n}\n\n.mdhui-document-detail-view .mdhui-document-detail-view-preview-loading {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 20vh;\n width: 40vw;\n padding: 16px;\n}\n\n.mdhui-document-detail-view .mdhui-document-detail-view-preview img {\n max-height: 50vh;\n max-width: 100%;\n}\n\n.mdhui-document-detail-view .mdhui-document-detail-view-preview-unavailable {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 20vh;\n width: 40vw;\n padding: 16px;\n font-size: 0.8em;\n color: var(--mdhui-text-color-2);\n}\n\n.mdhui-document-detail-view .mdhui-document-detail-view-preview-label {\n margin-top: 16px;\n font-size: 0.8em;\n color: var(--mdhui-text-color-2);\n}\n\n.mdhui-document-detail-view .mdhui-document-detail-view-document-details {\n display: flex;\n flex-direction: column;\n padding: 16px;\n min-width: 0;\n}\n\n.mdhui-document-detail-view .mdhui-document-detail-view-document-name {\n font-size: 1.2em;\n font-weight: bold;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n margin-bottom: 4px;\n}\n\n.mdhui-document-detail-view .mdhui-document-detail-view-document-date-and-type {\n font-size: 0.9em;\n font-weight: bold;\n color: var(--mdhui-text-color-2);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.mdhui-document-detail-view .mdhui-document-detail-view-document-notes-title {\n font-weight: bold;\n margin-top: 16px;\n}\n\n.mdhui-document-detail-view .mdhui-document-detail-view-document-notes {\n font-size: 0.9em;\n}\n\n.mdhui-document-detail-view .mdhui-document-detail-view-document-notes-none {\n font-size: 0.9em;\n color: var(--mdhui-text-color-2);\n}\n\n.mdhui-document-detail-view .mdhui-document-detail-view-document-buttons {\n padding: 16px;\n}");function mCe(e,t,a,n){return{surveyResultId:`survey-result-id-${vp()}`,fileType:e,name:t,type:a,date:n?_i(n,{representation:"date"}):void 0,fileUrl:"https://assets.careevolutionapps.com/MDH-UI/grilled_cheese."+("pdf"===e?"pdf":"png")}}function pCe(e){const[a,n]=c(!0),[i,r]=c(),[o,u]=c(),[d,h]=c("date"),[m,p]=c("desc"),g=s(),f=e=>{n("loading"===e||"reloading"===e),r("loading"!==e?function(e){const t=[],a=new Date;return"some documents"===e&&(t.push(mCe("image","Vaccination Records","Other",cn(a,{days:-7}))),t.push(mCe("pdf","Insurance Card","Insurance / Benefits",cn(a,{days:-2}))),t.push(mCe("image","Lab result",void 0,cn(a,{days:-5}))),t.push(mCe("image","Ultrasound","Test Results",cn(a,{days:-3}))),t.push(mCe("pdf","Discharge Summary","Visit Summary",void 0)),t.push(mCe("image","Referral Letter",void 0,void 0)),t.push(mCe("image","Medication Help","Instructions",cn(a,{days:-10})))),t}("reloading"!==e?e:"some documents"):void 0),u(void 0)},y=e=>"type"===d?[...e].sort($A("type",m)):"name"===d?[...e].sort($A("name",m)):[...e].sort($A("date",m));id((()=>{e.previewState?f(e.previewState):(n(!0),VA().load(e.surveySpecification,!0).then((e=>{(e=>{const t=(g.current??[]).reduce(((e,t)=>(e[t.surveyResultId]=t,e)),{}),a=e.map((e=>t[e.surveyResultId]??e));r(y(a))})(e),n(!1),u(void 0)})))}),[],[e.previewState]),l((()=>{g.current=i}),[i]),l((()=>{i&&r(y(i))}),[d,m]);const v=e=>{const t=no(`document-library-view-sort-title-${e}`);return d===e?t+" "+("asc"===m?"▴":"▾"):t};return t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},t.createElement(XAe,{showBackButton:!0,className:"mdhui-document-library-view-nav-bar"}),t.createElement("div",{className:"mdhui-document-library-view"},t.createElement("div",{className:"mdhui-document-library-header"},t.createElement("div",{className:"mdhui-document-library-view-title"},no("document-library-view-title")),t.createElement("div",null,t.createElement(QA,{fullWidth:!1,variant:"light",onClick:()=>{e.previewState||w.startSurvey(e.surveySpecification.surveyName)}},no("document-library-view-upload-button-text")))),t.createElement("div",{className:"mdhui-document-library-subheader"},t.createElement(sSe,{segments:[{key:"date",title:v("date")},{key:"name",title:v("name")},{key:"type",title:v("type")}],onSegmentSelected:e=>{d===e?p("asc"===m?"desc":"asc"):h(e)},selectedSegment:d})),a&&!i&&t.createElement(XA,null),a&&i&&t.createElement(XA,{className:"mdhui-document-library-view-reloading-indicator"}),0===i?.length&&t.createElement("div",{className:"mdhui-document-library-view-documents-empty"},no("document-library-view-empty-text")),i&&i.length>0&&t.createElement("div",{className:"mdhui-document-library-view-documents"},i.map((a=>t.createElement(gCe,{key:a.surveyResultId,document:a,disabled:a===o,onClick:()=>(t=>{if(e.previewState)return;u(t);const a=e.documentDetailViewBaseUrl.includes("?")?"&":"?",n=new URLSearchParams({...e.surveySpecification,surveyResultId:t.surveyResultId});w.openApplication(`${e.documentDetailViewBaseUrl}${a}${n}`)})(a)}))))))}function gCe(e){const[a,n]=c(!!e.document.fileUrl),i=["mdhui-document-library-view-document"];return e.disabled&&i.push("mdhui-document-library-view-document-disabled"),t.createElement(Za,{className:i.join(" "),onClick:e.disabled?void 0:e.onClick,renderAs:e.disabled?"div":void 0,indicator:e.disabled?t.createElement(Ne,{icon:V,spin:!0}):void 0},t.createElement("div",{className:"mdhui-document-library-view-document-contents"},t.createElement("div",{className:"mdhui-document-library-view-document-thumbnail"},a&&t.createElement(XA,{className:"mdhui-document-library-view-document-thumbnail-loading"}),e.document.fileUrl&&"image"===e.document.fileType&&t.createElement("img",{src:e.document.fileUrl,style:{display:a?"none":"inline"},onLoad:()=>n(!1),alt:no("document-library-view-thumbnail-image-alt")}),e.document.fileUrl&&"pdf"===e.document.fileType&&t.createElement(yAe,{url:e.document.fileUrl,style:{display:a?"none":"inline"},maxHeight:48,maxWidth:48,onLoad:()=>n(!1)}),!a&&!e.document.fileUrl&&t.createElement(Ne,{icon:Me})),t.createElement("div",{className:"mdhui-document-library-view-document-details"},t.createElement("div",{className:"mdhui-document-library-view-document-name"},e.document.name),t.createElement("div",{className:"mdhui-document-library-view-document-date-and-type"},GA(e.document)))))}function fCe(e){let a="",n=t.createElement(t.Fragment,null);switch(e.feed){case"Procedures":a=no("procedures-title"),n=t.createElement("img",{src:Jue});break;case"Reports":a=no("reports-title"),n=t.createElement("img",{src:Que});break;case"Immunizations":a=no("immunizations-title"),n=t.createElement("img",{src:ede});break;case"LabReports":a=no("lab-results-title"),n=t.createElement("img",{src:tde})}return t.createElement(Ka,{colorScheme:e.colorScheme},t.createElement(XAe,{showBackButton:"Push"==e.presentation,showCloseButton:"Modal"==e.presentation},t.createElement(sM,{order:2,autosizeImage:!0,image:n,imageAlignment:"left"},a)),t.createElement(sde,{feed:e.feed,onEventSelected:e.onEventSelected,onReportSelected:e.onReportSelected,previewState:e.previewState}))}function yCe(e){return t.createElement(Ka,{colorScheme:e.colorScheme},t.createElement(XAe,{variant:"compressed",showBackButton:"Push"==e.presentation,showCloseButton:"Modal"==e.presentation}),t.createElement(cde,{feed:e.feed,pageId:e.pageId,pageDate:e.pageDate,previewState:e.previewState,onViewLabObservationTermInfo:e.onViewLabObservationTermInfo}))}function vCe(e){let a="",n=[];return e.excludeProviders||(n.push("Provider"),a+=no("external-accounts-title-providers")),e.excludeHealthPlans||(n.push("Health Plan"),a.length>0&&(a+=no("external-accounts-title-divider")),a+=no("external-accounts-title-health-plans")),e.excludeDeviceManufacturers||(n.push("Device Manufacturer"),a.length>0&&(a+=no("external-accounts-title-divider")),a+=no("external-accounts-title-devices")),t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},e.presentation&&t.createElement(XAe,{title:a,showBackButton:"Push"==e.presentation,showCloseButton:"Modal"==e.presentation}),!e.presentation&&t.createElement(fSe,null),t.createElement(yde,{previewState:e.previewState,externalAccountProviderCategories:n,onExternalAccountsLoaded:function(t){0===t.length&&("Modal"===e.presentation?w.dismiss():w.back())},connectExternalAccountOptions:e.connectExternalAccountOptions}))}function bCe(e){var[a,n]=c(!1);return l((()=>{w.connect().then((()=>{n(!0)}))}),[]),t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},t.createElement(fSe,null),a&&t.createElement(t.Fragment,null,t.createElement(aS,null,t.createElement(jU,{previewState:e.connectPreview,disabledBehavior:"displayError"})),t.createElement(aS,null,t.createElement(Cde,{previewState:e.devicesPreview})),t.createElement(aS,{allowOverflow:!0},t.createElement(Pde,{previewState:e.chartsPreview}))),!a&&t.createElement(XA,null))}function wCe(e){var[a,n]=c(!1);return l((()=>{w.connect().then((()=>{n(!0)}))}),[]),t.createElement(Ka,null,t.createElement(fSe,{color:"var(--main-bg-color)"}),a&&t.createElement(t.Fragment,null,t.createElement(aS,null,t.createElement(zU,{previewState:e.connectPreview,garminProviderID:e.garminProviderID,disabledBehavior:"displayError"})),t.createElement(aS,null,t.createElement(Mde,{previewState:e.devicesPreview})),t.createElement(aS,{allowOverflow:!0},t.createElement(Dde,{previewState:e.chartsPreview}))),!a&&t.createElement(XA,null))}function xCe(e){var a="Push";e.notificationType&&(a=e.notificationType);return t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},t.createElement(fSe,{color:"#FFFFFF"}),t.createElement(aS,null,t.createElement(Zq,{previewDevicePlatform:e.preview?"Web":void 0,previewProjectPlatforms:e.preview?["Web","Android","iOS"]:void 0})),t.createElement(aS,null,t.createElement(dfe,{notificationType:a,onViewMore:e.notificationsViewUrl?()=>{e.notificationsViewUrl&&w.openApplication(e.notificationsViewUrl)}:void 0,previewState:e.preview?"loaded with data":void 0,hideAfterHours:e.notificationHideAfterHours})),t.createElement(jAe,{variant:"singleCard",status:"incomplete",limit:3,title:no("tasks"),onDetailLinkClick:e.tasksViewUrl?()=>{e.tasksViewUrl&&w.openApplication(e.tasksViewUrl)}:void 0,previewState:e.preview?"IncompleteTasks":void 0}),t.createElement(aS,null,t.createElement(EU,{headerVariant:"medium",previewState:e.preview?"Web":void 0})),t.createElement(aS,null,e.ehrConnectApplicationUrl&&t.createElement(NU,{variant:"medium",previewState:e.preview?"enabled":void 0,applicationUrl:e.ehrConnectApplicationUrl})),t.createElement(aS,null,t.createElement(bAe,{previewState:e.preview?"Default":void 0})))}function kCe(e){function a(){e.onViewLabs?e.onViewLabs():w.openApplication("https://hw.careevolutionapps.com/LabReports.html?lang="+w.getCurrentLanguage())}function n(t){if(e.onViewTermInfo)e.onViewTermInfo(t);else{var a=new URLSearchParams({termFamily:t.TermFamily,termNamespace:t.TermNamespace,termCode:t.TermCode,lang:w.getCurrentLanguage()}).toString();w.openApplication("https://hw.careevolutionapps.com/TermInformation.html?"+a,{modal:!0})}}let i=e.variant??"default";function r(a){var n=function(){return t.createElement(kge,{concept:a,onClick:()=>function(t){e.onViewHealthSectionDetails?e.onViewHealthSectionDetails(t):w.openApplication("https://hw.careevolutionapps.com/"+t+".html")}(a),previewState:"default"==e.previewState?"Default":void 0,indicatorPosition:"cardBased"==i?"topRight":"default"})};return"cardBased"==e.variant?t.createElement(aS,null,n()):n()}return t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},e.presentation&&t.createElement(XAe,{showBackButton:"Push"==e.presentation,showCloseButton:"Modal"==e.presentation}),!e.presentation&&t.createElement(fSe,null),t.createElement(bde,{previewState:"default"==e.previewState?"externalAccountsLoaded":void 0,externalAccountCategories:["Provider","Health Plan"],triggerWebExternalAccountSyncComplete:!0}),"default"==i&&t.createElement(oSe,{noTopMargin:!0},t.createElement(Yge,{onViewTermInfo:e=>n(e),onClick:()=>a(),previewState:"default"==e.previewState?"ImportantLabs":void 0}),t.createElement($ge,{previewState:"default"==e.previewState?"BloodTypeLabs":void 0}),r("Medications"),r("Immunizations"),r("Reports"),r("Allergies"),r("Conditions"),r("Procedures"),t.createElement(xde,{excludeDeviceManufacturers:!0,applicationUrl:e.externalAccountsApplicationUrl,previewState:"default"==e.previewState?"Default":void 0})),"cardBased"==i&&t.createElement(t.Fragment,null,t.createElement(aS,null,t.createElement(Yge,{onViewTermInfo:e=>n(e),onClick:()=>a(),previewState:"default"==e.previewState?"ImportantLabs":void 0})),t.createElement(aS,null,t.createElement($ge,{previewState:"default"==e.previewState?"BloodTypeLabs":void 0})),r("Medications"),r("Immunizations"),r("Reports"),r("Allergies"),r("Conditions"),r("Procedures"),t.createElement(aS,null,t.createElement(xde,{excludeDeviceManufacturers:!0,applicationUrl:e.externalAccountsApplicationUrl,previewState:"default"==e.previewState?"Default":void 0}))),t.createElement(aS,null,t.createElement(NU,{bottomBorder:!0,applicationUrl:e.connectEhrApplicationUrl,previewState:"default"==e.previewState?"enabledConnected":void 0})))}function ACe(e){const a=()=>{e.previewState&&"live"!==e.previewState||w.dismiss()};return t.createElement(Ka,{colorScheme:e.colorScheme??"auto",flex:!0},t.createElement(aS,null,t.createElement(ife,{previewState:"live"!==e.previewState?e.previewState:void 0,onError:a,onDelete:a,onCancel:a,onSave:a,withImageCapture:!0})))}function SCe(e){return t.createElement(Ka,{colorScheme:e.colorScheme},t.createElement(XAe,{showBackButton:"Push"==e.presentation,showCloseButton:"Modal"==e.presentation},t.createElement(sM,{order:2,autosizeImage:!0,image:t.createElement("img",{src:wge}),imageAlignment:"left"},no("medications-title"))),t.createElement(aS,null,t.createElement(rfe,{previewState:e.previewState,onViewTermInfo:t=>function(t){if(e.onViewTermInfo)e.onViewTermInfo(t);else{var a=new URLSearchParams({termFamily:t.TermFamily,termNamespace:t.TermNamespace,termCode:t.TermCode,lang:w.getCurrentLanguage()}).toString();w.openApplication("https://hw.careevolutionapps.com/TermInformation.html?"+a,{modal:!0})}}(t)})))}function ECe(e){var a="Push";return e.notificationType&&(a=e.notificationType),t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},e.presentation&&t.createElement(XAe,{title:no("notifications"),showBackButton:"Push"==e.presentation,showCloseButton:"Modal"==e.presentation}),!e.presentation&&t.createElement(fSe,null),t.createElement(mfe,{notificationType:a,previewState:e.preview?"loaded with data":void 0}))}function _Ce(e){return t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},e.presentation&&t.createElement(XAe,{title:no("tasks"),showBackButton:"Push"==e.presentation,showCloseButton:"Modal"==e.presentation}),!e.presentation&&t.createElement(fSe,null),!e.hideIncompleteTasks&&t.createElement(jAe,{variant:"multiCard",title:no("incomplete-tasks"),status:"incomplete",previewState:e.preview?"IncompleteTasks":void 0}),!e.hideCompleteTasks&&t.createElement(jAe,{variant:"multiCard",title:no("completed-tasks"),status:"complete",previewState:e.preview?"CompleteTasks":void 0}))}A("body:has(.mdhui-document-library-view) {\n background: var(--mdhui-background-color-0);\n}\n\n.mdhui-navigation-bar.mdhui-document-library-view-nav-bar {\n background: var(--mdhui-background-color-0);\n margin-bottom: 0;\n}\n\n.mdhui-document-library-view {\n padding: 16px;\n border-top: 1px solid var(--mdhui-background-color-1);\n}\n\n.mdhui-document-library-view .mdhui-document-library-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin: 0 0 16px;\n}\n\n.mdhui-document-library-view .mdhui-document-library-view-title {\n font-size: 1.7em;\n font-weight: bold;\n}\n\n.mdhui-document-library-view .mdhui-document-library-subheader {\n padding: 2px;\n margin: 0 0 16px;\n}\n\n.mdhui-document-library-view .mdhui-document-library-subheader .mdhui-segmented-control {\n background-color: var(--mdhui-background-color-1);\n border-color: var(--mdhui-background-color-1);\n min-width: 200px;\n}\n\n.mdhui-document-library-view .mdhui-document-library-subheader .mdhui-segmented-control .mdhui-segment {\n background-color: var(--mdhui-background-color-1);\n border: 1px solid var(--mdhui-background-color-1);\n color: var(--mdhui-text-color-0);\n}\n\n.mdhui-document-library-view .mdhui-document-library-subheader .mdhui-segmented-control .mdhui-segment-selected {\n background-color: var(--mdhui-background-color-0);\n border: 1px solid var(--mdhui-border-color-1);\n color: var(--mdhui-text-color-0);\n}\n\n.mdhui-document-library-view .mdhui-document-library-view-reloading-indicator {\n font-size: 0.8em;\n padding: 0;\n}\n\n.mdhui-document-library-view .mdhui-document-library-view-documents-empty {\n color: var(--mdhui-text-color-3);\n text-align: center;\n margin: 32px 0;\n}\n\n.mdhui-document-library-view .mdhui-action.mdhui-document-library-view-document {\n background: var(--mdhui-background-color-1);\n border-radius: 10px;\n margin: 16px 0;\n min-width: 200px;\n}\n\n.mdhui-document-library-view .mdhui-action.mdhui-document-library-view-document-disabled {\n opacity: 0.5;\n}\n\n.mdhui-document-library-view .mdhui-document-library-view-document-contents {\n display: flex;\n align-items: center;\n gap: 12px;\n}\n\n.mdhui-document-library-view .mdhui-document-library-view-document-thumbnail {\n height: 48px;\n width: 48px;\n min-width: 48px;\n border-radius: 5px;\n overflow: hidden;\n}\n\n.mdhui-document-library-view .mdhui-document-library-view-document-thumbnail-loading {\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n background-color: var(--mdhui-background-color-0);\n}\n\n.mdhui-document-library-view .mdhui-document-library-view-document-thumbnail > svg {\n color: var(--mdhui-text-color-4);\n height: 100%;\n width: 100%;\n}\n\n.mdhui-document-library-view .mdhui-document-library-view-document-thumbnail > img {\n height: 100%;\n width: 100%;\n object-fit: cover;\n}\n\n\n.mdhui-document-library-view .mdhui-document-library-view-document-details {\n display: flex;\n flex-direction: column;\n min-width: 48px;\n}\n\n.mdhui-document-library-view .mdhui-document-library-view-document-name {\n font-size: 1.2em;\n font-weight: bold;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n margin-bottom: 4px;\n}\n\n.mdhui-document-library-view .mdhui-document-library-view-document-date-and-type {\n font-size: 0.7em;\n font-weight: bold;\n color: var(--mdhui-text-color-3);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}");function CCe(e){let[a,n]=t.useState(null);function i(){d_e(),window.setTimeout((function(){h_e()}),1200)}return id((()=>{if("default"==e.previewState)return n([1e3,2e3,3e3]),void i();w.getParticipantInfo().then((t=>{let a=Jq(e.customField,[],t);n(a.badges),i()}))}),[],[]),null!=a&&0===a.length?(w.dismiss(),null):t.createElement(Ka,{bodyBackgroundColor:"dark"===e.colorScheme?"":"#fff",colorScheme:e.colorScheme??"auto",primaryColor:e.primaryColor},t.createElement("div",{className:"mdhui-new-badge-view"},null==a&&t.createElement(XA,null),null!=a&&t.createElement(t.Fragment,null,t.createElement("div",{className:"mdhui-new-badge-view-badge-container"},t.createElement(ZA,{size:"xl",backgroundColor:Re(a.length-1)},t.createElement(t.Fragment,null,e.showBadgePoints&&t.createElement(t.Fragment,null,wl(Math.max(...a)),t.createElement("br",null),"points")))),t.createElement(sM,{order:2,style:{margin:"16px",marginBottom:0}},e.title||no("new-badge-title")),t.createElement($q,null,e.text||no("new-badge-text")),t.createElement(QA,{onClick:()=>w.dismiss()},no("get-badge")))))}A(".mdhui-new-badge-view {\n padding: 16px;\n text-align: center;\n height: calc(100dvh - 34px);\n display: flex;\n align-items: center;\n flex-direction: column;\n justify-content: center;\n}\n\n.mdhui-new-badge-view .mdhui-new-badge-view-badge-container {\n align-items: center;\n display: flex;\n}");function TCe(e){let a=e.entries.reduce(((e,t)=>e+(t.bonusPoints||0)),0),n=e.entries.reduce(((e,t)=>e+t.points),a);return t.createElement(Ka,{bodyBackgroundColor:"dark"===e.colorScheme?"":"#fff",colorScheme:e.colorScheme??"auto",primaryColor:e.primaryColor},t.createElement("div",{className:"mdhui-new-points"},t.createElement(tSe,{animate:!0},t.createElement("div",{className:"mdhui-new-points-total"},t.createElement("div",{className:"mdhui-new-points-total-points"},"+",n),t.createElement("div",{className:"mdhui-new-points-total-points-label"},"points"))),t.createElement("div",{className:"mdhui-new-points-content"},1==e.entries.length&&e.entries[0].message&&0===a&&t.createElement("div",null,t.createElement("div",{className:"mdhui-new-points-title"},e.entries[0].message.title),t.createElement("div",{className:"mdhui-new-points-text"},e.entries[0].message.text)),(e.entries.length>1||!e.entries[0].message||a>0)&&t.createElement("div",null,t.createElement("div",{className:"mdhui-new-points-title"},no("new-points-title")),t.createElement("div",{className:"mdhui-new-points-text"},no("new-points-text")),t.createElement("div",{className:"mdhui-new-points-entries"},e.entries.map(((e,a)=>t.createElement("div",{key:a,className:"mdhui-new-points-entry"},t.createElement("div",{className:"mdhui-new-points-entry-name"},e.name),t.createElement("div",{className:"mdhui-new-points-entry-points"},"+",e.points)))),a>0&&t.createElement("div",{className:"mdhui-new-points-entry"},t.createElement("div",{className:"mdhui-new-points-entry-name bonus"},no("bonus")),t.createElement("div",{className:"mdhui-new-points-entry-points bonus"},"+",a)))),e.pointsToNextReward&&t.createElement("div",{className:"mdhui-new-points-next-reward"},no("new-points-next-reward-prefix"),t.createElement("span",{className:"mdhui-new-points-next-reward-points"},e.pointsToNextReward),no("new-points-next-reward-suffix"))),t.createElement("div",{className:"mdhui-new-points-button-panel"},t.createElement(QA,{onClick:()=>w.dismiss()},e.doneButtonText??no("new-points-done-button-text")))))}function PCe(e,t){let a={type:"MDHUI-NewPoints",value:JSON.stringify(e)};w.persistDeviceData([a]).then((()=>{w.openApplication(t||"https://viewlibrary.careevolutionapps.com/newpoints",{modal:!0})}))}A(".mdhui-new-points {\n margin: calc(20px + env(safe-area-inset-top, 0px)) 20px 20px;\n}\n\n.mdhui-new-points-total {\n margin-top: 10px;\n text-align: center;\n}\n\n.mdhui-new-points-total-points {\n font-weight: bold;\n font-size: 40px;\n height: 50px;\n line-height: 50px;\n color: var(--mdhui-color-primary);\n}\n\n.mdhui-new-points-content {\n text-align: center;\n opacity: 0;\n animation: fadein 750ms ease-in-out;\n animation-delay: 750ms;\n animation-fill-mode: forwards;\n}\n\n.mdhui-new-points-title {\n margin: 32px 0 20px 0;\n font-size: 2em;\n font-weight: bold;\n}\n\n.mdhui-new-points-text {\n padding: 0 20px;\n}\n\n.mdhui-new-points-entries {\n margin-top: 20px;\n text-align: left;\n}\n\n.mdhui-new-points-entry {\n display: grid;\n grid-template-columns: auto max-content;\n align-items: center;\n}\n\n.mdhui-new-points-entry-name {\n font-size: 1.1em;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.mdhui-new-points-entry-points {\n width: 50px;\n color: var(--mdhui-color-primary);\n font-size: 1.1em;\n font-weight: bold;\n text-align: end;\n}\n\n.mdhui-new-points-next-reward {\n margin-top: 20px;\n padding: 0 20px;\n}\n\n.mdhui-new-points-next-reward-points {\n color: var(--mdhui-color-primary);\n font-weight: bold;\n}\n\n.mdhui-new-points-entry .bonus {\n color: #ffcc5b;\n font-weight: bold;\n}\n\n.mdhui-new-points-button-panel {\n margin: 20px 0 36px 0;\n opacity: 0;\n animation: fadein 750ms ease-in-out;\n animation-delay: 750ms;\n animation-fill-mode: forwards;\n}");function OCe(e){return t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},t.createElement(Ege,null,t.createElement(MCe,{...e})))}function MCe(e){const[a,n]=c(),[i,r]=c(),[o,s]=c();let l=!a&&!i&&!o,u=[...a??[],...i??[],...o??[]];return t.createElement("div",{className:"mdhui-inbox"},t.createElement(bSe,{title:no("inbox-view-title")}),l&&t.createElement(XA,null),!l&&0===u.length&&t.createElement("div",{className:"mdhui-inbox-empty-text"},no("inbox-view-empty-text")),t.createElement(Pge,{previewState:"default"===e.previewState?"incomplete message":"empty"===e.previewState?"no items":void 0,title:no("inbox-view-messages-title"),type:"message",status:"incomplete",sortOrder:"descending",sortColumn:"insertedDate",messageViewerUrl:e.messageViewerUrl,onItemsLoaded:n,hideLoadingIndicator:!0,category:e.itemCategory}),t.createElement(Pge,{previewState:"default"===e.previewState?"incomplete survey":"empty"===e.previewState?"no items":void 0,title:no("inbox-view-surveys-title"),type:"survey",status:"incomplete",sortOrder:"ascending",sortColumn:"dueDate",onItemsLoaded:r,hideLoadingIndicator:!0,surveyVariant:e.surveyVariant,category:e.itemCategory}),t.createElement(Pge,{previewState:"default"===e.previewState?"incomplete resource":"empty"===e.previewState?"no items":void 0,title:no("inbox-view-resources-title"),type:"resource",status:"incomplete",sortOrder:"descending",sortColumn:"insertedDate",onItemsLoaded:s,hideLoadingIndicator:!0,resourceImageAlignment:e.resourceImageAlignment,resourceButtonVariant:e.resourceButtonVariant,resourceButtonText:e.resourceButtonText,category:e.itemCategory}),t.createElement("div",{className:"mdhui-inbox-recently-completed"},t.createElement(Pge,{previewState:"default"===e.previewState?"complete items":"empty"===e.previewState?"no items":void 0,title:no("inbox-view-recently-completed-title"),status:"complete",sortOrder:"descending",sortColumn:"endDate",messageViewerUrl:e.messageViewerUrl,endsAfter:cn(new Date,{days:-3}).toISOString(),showTitleWhenEmpty:!0,emptyText:no("inbox-view-recently-completed-empty-text"),syncOnChanges:!0,category:e.itemCategory}),!l&&t.createElement(aS,{style:{margin:"12px 16px"}},t.createElement(Za,{title:no("inbox-view-history-button-text"),onClick:()=>{e.previewState||w.openApplication(e.historyViewerUrl,{modal:!0})}}))))}A(".mdhui-inbox {\n padding: calc(env(safe-area-inset-top, 0px) + 20px) 0 calc(env(safe-area-inset-bottom, 0px) + 20px);\n}\n\n.mdhui-inbox .mdhui-view-header {\n padding: 0 16px;\n}\n\n.mdhui-inbox .mdhui-view-header .mdhui-view-header-title {\n font-size: 1.8em;\n}\n\n.mdhui-inbox-empty-text {\n color: var(--mdhui-text-color-3);\n padding: 16px;\n}\n\n.mdhui-inbox-recently-completed {\n margin-top: 20px;\n}\n\n.mdhui-inbox-recently-completed .mdhui-inbox-item-list-title {\n color: var(--mdhui-text-color-0);\n margin-bottom: 12px;\n font-size: 1.4em;\n font-weight: bold;\n}\n\n.mdhui-inbox-recently-completed .mdhui-card {\n margin: 12px 0 0 0;\n}");function DCe(e){return t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},t.createElement(XAe,{showCloseButton:!0}),t.createElement("div",{className:"mdhui-inbox-history"},t.createElement(sM,{order:3},no("inbox-history-view-title")),t.createElement(Pge,{previewState:"default"===e.previewState?"complete items":void 0,status:"complete",messageViewerUrl:e.messageViewerUrl,emptyText:no("inbox-history-view-empty-text")})))}A(".mdhui-inbox-history {\n padding: calc(env(safe-area-inset-top, 0px)) 16px calc(env(safe-area-inset-bottom, 0px) + 20px);\n}");function ICe(e){return t.createElement("div",{className:"mdhui-report-content"},"text/html"==e.contentType&&t.createElement("iframe",{sandbox:"",srcDoc:e.content}),"application/pdf"==e.contentType&&t.createElement("div",{className:"mdhui-report-content-download-pdf","ng-if":"$ctrl.report.ContentType == 'application/pdf'","ng-show":"$ctrl.srcSet = true"},t.createElement("a",{href:"data:application/pdf;base64,"+e.content,download:e.type+".pdf",title:no("download-pdf-report")},t.createElement(Ne,{icon:de}),no("download-pdf-report"))))}A(".mdhui-report-content {\n min-height: 200px;\n}\n\n.mdhui-report-content iframe {\n border: none;\n padding: 0;\n margin: 0;\n width: 100%;\n height: 100%;\n background: #FFF;\n min-height: 200px;\n}\n\n.mdhui-report-content .mdhui-report-content-download-pdf a {\n padding: 16px;\n margin: 0 auto;\n background: var(--mdhui-color-primary);\n color: #FFF;\n font-weight: bold;\n border-radius: 6px;\n text-decoration: none;\n text-align: center;\n display: block;\n width: 200px;\n margin-top: var(--mdhui-padding-md);\n}\n\n.mdhui-report-content .mdhui-report-content-download-pdf svg {\n display: block;\n text-align: center;\n width: 100%;\n margin-bottom: var(--mdhui-padding-md);\n}");let NCe='<!DOCTYPE html><html xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:n3="http://www.w3.org/1999/xhtml" xmlns:n1="urn:hl7-org:v3" xmlns:n2="urn:hl7-org:v3/meta/voc" xmlns:voc="urn:hl7-org:v3/voc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:in="urn:lantana-com:inline-variable-data"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\x3c!--\r\n Do NOT edit this HTML directly, it was generated via an XSLt\r\n transformation from the original release 2 CDA Document.\r\n --\x3e<title>Encounter Summary</title><style>\r\n \r\n body { font-family:Helvetica, Arial, sans-serif; font-size: 12px; margin: 16px; text-align: left; margin-bottom:0; } \r\n .title { font-size: 21px; font-weight: bold; line-height:1.5em;}\r\n .document-info { font-size:12px; margin-bottom:16px; color:#999; line-height:1.5em; }\r\n \r\n \r\n .patient-info-table { border-spacing: 0; width:100%; }\r\n .patient-info-table th { text-align:left; font-size:11px; color:#999; font-weight:normal; vertical-align:top; padding-right:8px; border-bottom:solid 1px #eee; padding-top:4px; padding-bottom:4px; }\r\n .patient-info-table td { text-align:left; font-size:12px; color:#000; vertical-align:top; border-bottom:solid 1px #eee; padding-top:4px; padding-bottom:4px; }\r\n .patient-info-table tr:last-child th, .patient-info-table tr:last-child td { border-bottom:none; }\r\n\r\n .data-table { margin-left: -16px; margin-right:-16px; margin-bottom:16px; }\r\n .data-table table, .data-table td, .data-table th { border:none; }\r\n\r\n .data-table > span { margin-left:16px; margin-right:16px; }\r\n .data-table table { border-collapse: collapse; }\r\n .data-table th { padding-bottom:4px; padding-top:4px; padding-right:8px; padding-left:8px; text-align: left; text-transform: uppercase; font-weight: normal; color: #666; font-size: 11px; border-bottom: #ddd 1px solid; vertical-align:bottom; }\r\n .data-table tr:nth-child(even) td { background-color: #f5f5f5; }\r\n .data-table td { vertical-align: top; font-size:12px; padding-bottom:4px; padding-top:4px; padding-right:8px; padding-left:8px;}\r\n .data-table td:first-child, .data-table th:first-child { padding-left:16px;}\r\n \r\n p { margin: 0 0 4px 0em; }\r\n\r\n .wrap-collabsible { position:relative; margin-left:-16px; margin-right:-16px; }\r\n input[type=\'checkbox\'] { display: none; }\r\n .lbl-toggle { display: block; font-size: 17px; text-align: left; padding:8px; padding-left:16px; padding-right:16px; border-top: solid 1px #ddd; cursor: pointer; transition: all 0.25s ease-out; position: sticky; position: -webkit-sticky; top: 0; left: 0; background: #FFF; color: #3e6e9a; font-weight: bold; }\r\n .lbl-toggle:hover { opacity:.9; }\r\n .lbl-toggle::before { content: \' \'; display: inline-block; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 5px solid currentColor; vertical-align: middle; margin-right: .7rem; transform: translateY(-2px); transition: transform .2s ease-out; position: absolute; right: 8px; top: 16px; }\r\n .toggle:checked + .lbl-toggle::before { transform: rotate(90deg) translateX(-3px); }\r\n .collapsible-content { max-height: 0px; overflow-x: auto; overflow-y: hidden; }\r\n .toggle:checked + .lbl-toggle + .collapsible-content { max-height: 999999px; }\r\n .collapsible-content .content-inner { background: #FFF; padding:8px; padding-left:16px; padding-right:16px; }\r\n \r\n </style></head><body><div class="title">Encounter Summary</div><div class="document-info"><div class="document-date">\r\n Document Created\r\n May 29, 2023</div><div class="custodian"><div>Custodian: Cedars-Sinai Health System</div></div></div><div class="wrap-collabsible"><input id="collapsible" class="toggle" type="checkbox" /><label for="collapsible" class="lbl-toggle">Patient Information</label><div class="collapsible-content"><div class="content-inner"><table class="patient-info-table" cellpadding="0" cellspacing="0"><tr><td colspan="2" style="font-size:14px;">AmbulatorySeniorF Xxxcshs </td></tr><tr><th>Date of Birth</th><td>January 1, 1947</td></tr><tr><th>Race</th><td>Unknown</td></tr><tr><th>Patient ID</th><td>CSHJWLL1B3TGMWX</td></tr><tr><th>Sex</th><td>Female</td></tr><tr><th>Ethnicity</th><td>Unknown</td></tr><tr><th>Preferred Language</th><td>Information not available</td></tr><tr><th>Address</th><td>6500 Wilshire Blvd<br /><br />LOS ANGELES, CA, 90046<br />tel:+1-626-315-4807</td></tr><tr><th>Care Team Member(s)</th><td>Dr. Masson of Cedars-Sinai Health System<br />, , <br />tel:+1-310-248-7000<br /><br /></td></tr><tr><th>Guardian</th><td><div><br /></div></td></tr><tr><th>Next of Kin</th><td><div><br /></div></td></tr><tr><th>Other Caregivers(s)</th><td /></tr><tr><th>Emergency Contact</th><td><div><br /></div></td></tr><tr><th>Comments:</th><td /></tr></table></div></div></div><div class="wrap-collabsible"><input id="ID0EDGAC" class="toggle" type="checkbox" /><label for="ID0EDGAC" class="lbl-toggle" data-loinc-code="X-DOCCMT">Note from Cedars-Sinai Health System</label><div class="collapsible-content"><div class="content-inner">This document contains information that was shared with AmbulatorySeniorF Xxxcshs. It may not contain the entire record from Cedars-Sinai Health System.</div></div></div><div class="wrap-collabsible"><input id="ID0EVGAC" class="toggle" type="checkbox" /><label for="ID0EVGAC" class="lbl-toggle" data-loinc-code="46240-8">Encounter Details</label><div class="collapsible-content"><div class="content-inner"><div class="data-table"><table width="100%"><colgroup><col width="10%" /><col width="15%" /><col span="3" width="25%" /></colgroup><thead><tr><th>Date</th><th>Type</th><th>Department</th><th>Care Team</th><th>Description</th></tr></thead><tbody><tr ID="encounter2" style="" id="encounter2"><td>04/15/2019 9:30 AM PDT</td><td ID="encounter2type" id="encounter2type">Office Visit</td><td><p>CSMG Internal Medicine</p><p>8767 Wilshire Blvd</p><p>3rd Floor</p><p>BEVERLY HILLS, CA 90211</p><p>310-385-6031</p></td><td><p style="font-weight:bold;">Dr. Gray</p><p>8767 WILSHIRE BLVD</p><p>3RD FLOOR-SUITE 301</p><p>BEVERLY HILLS, CA 90211</p><p>310-385-6064 (Work)</p><p>424-314-8735 (Fax)</p></td><td><span id="encounter2desc" /></td></tr></tbody></table></div></div></div></div><div class="wrap-collabsible"><input id="ID0EJNAG" class="toggle" type="checkbox" /><label for="ID0EJNAG" class="lbl-toggle" data-loinc-code="29762-2">Social History</label><div class="collapsible-content"><div class="content-inner"><div class="data-table"><table width="100%" ID="sochist14" id="sochist14"><colgroup><col span="2" width="25%" /><col width="13%" /><col width="12%" /><col width="25%" /></colgroup><thead><tr><th>Tobacco Use</th><th>Types</th><th>Packs/Day</th><th>Years Used</th><th>Date</th></tr></thead><tbody><tr><td>Smoking Tobacco: Former</td><td>Cigarettes</td><td ID="sochist14packsperday" id="sochist14packsperday">0.5</td><td /><td>1999 - 06/2010</td></tr></tbody></table></div><div class="data-table"><table width="100%"><colgroup><col width="25%" /><col width="75%" /></colgroup><thead><tr><th>Alcohol Use</th><th>Standard Drinks/Week</th></tr></thead><tbody><tr><td ID="alcoholStatus" id="alcoholStatus">Yes</td><td>3 (1 standard drink = 0.6 oz pure alcohol)</td></tr></tbody></table></div><div class="data-table"><table width="100%" ID="sdohassess1" id="sdohassess1"><colgroup><col width="50%" /><col span="2" width="25%" /></colgroup><thead><tr><th>Depression</th><th>Answer</th><th>Date Recorded</th></tr></thead><tbody><tr ID="sdohassess1pair1" id="sdohassess1pair1"><td ID="sdohassess1pair1ques" id="sdohassess1pair1ques">PHQ-9 Score</td><td ID="sdohassess1pair1ans" id="sdohassess1pair1ans">23</td><td>10/24/2022</td></tr><tr ID="sdohassess1pair2" id="sdohassess1pair2"><td ID="sdohassess1pair2ques" id="sdohassess1pair2ques">Screening Completed</td><td ID="sdohassess1pair2ans" id="sdohassess1pair2ans">PHQ-9</td><td>10/24/2022</td></tr></tbody></table></div><div class="data-table"><table width="100%"><colgroup><col width="50%" /><col span="2" width="25%" /></colgroup><thead><tr><th>Sex and Gender Information</th><th>Value</th><th>Date Recorded</th></tr></thead><tbody><tr ID="BirthSex17" id="BirthSex17"><td>Sex Assigned at Birth</td><td ID="BirthSex17Value" id="BirthSex17Value">Female</td><td>11/04/2018 3:08 AM PST</td></tr><tr ID="GenderIdentity15" id="GenderIdentity15"><td>Gender Identity</td><td ID="GenderIdentity15Value" id="GenderIdentity15Value">Female</td><td>06/12/2019 2:50 PM PDT</td></tr><tr ID="SexualOrientation16" id="SexualOrientation16"><td>Sexual Orientation</td><td ID="SexualOrientation16Value" id="SexualOrientation16Value">Choose not to disclose</td><td>11/04/2018 3:08 AM PST</td></tr></tbody></table></div>documented as of this encounter</div></div></div><div class="wrap-collabsible"><input id="ID0EQHBG" class="toggle" type="checkbox" /><label for="ID0EQHBG" class="lbl-toggle" data-loinc-code="8716-3">Last Filed Vital Signs</label><div class="collapsible-content"><div class="content-inner"><div class="data-table"><table width="100%"><colgroup><col span="4" width="25%" /></colgroup><thead><tr><th>Vital Sign</th><th>Reading</th><th>Time Taken</th><th>Comments</th></tr></thead><tbody><tr style=""><td style="">Blood Pressure</td><td><span id="sysBP_5642605800">120</span>/<span id="diaBP_5642605800">80</span></td><td>10/21/2019 3:30 PM PDT</td><td /></tr><tr ID="pulse_5642605800" style="" id="pulse_5642605800"><td style="">Pulse</td><td>80</td><td>10/21/2019 3:30 PM PDT</td><td /></tr><tr ID="temp_5642605800" style="" id="temp_5642605800"><td style="">Temperature</td><td>37.1 °C (98.8 °F)</td><td>10/21/2019 3:30 PM PDT</td><td /></tr><tr ID="resp_" style="" id="resp_"><td style="">Respiratory Rate</td><td>-</td><td>-</td><td /></tr><tr ID="SpO2_" style="" id="SpO2_"><td style="">Oxygen Saturation</td><td>-</td><td>-</td><td /></tr><tr ID="inhaled_" style="" id="inhaled_"><td style="">Inhaled Oxygen Concentration</td><td>-</td><td>-</td><td /></tr><tr ID="weight_5642605800" style="" id="weight_5642605800"><td style="">Weight</td><td>238.1 kg (525 lb)</td><td>10/21/2019 3:30 PM PDT</td><td /></tr><tr ID="height_5642605800" style="" id="height_5642605800"><td style="">Height</td><td>157.5 cm (5\' 2")</td><td>10/21/2019 3:30 PM PDT</td><td /></tr><tr ID="bmi_5642605800" style="" id="bmi_5642605800"><td style="">Body Mass Index</td><td>96.02</td><td>10/21/2019 3:30 PM PDT</td><td /></tr></tbody></table></div>documented in this encounter</div></div></div><div class="wrap-collabsible"><input id="ID0EIZBG" class="toggle" type="checkbox" /><label for="ID0EIZBG" class="lbl-toggle" data-loinc-code="69730-0">Patient Instructions</label><div class="collapsible-content"><div class="content-inner"><ul style="" id="Instructions33"><li>Patient Instructions: <ul><li><p><span style="">Dr. Fazel - 04/15/2019 9:30 AM PDT</span></p><span><span style="">Formatting of this note is different from the original.</span><br /><span style="">Images from the original note were not included.</span><br />Patient Education <br /><br />Back Exercises<br />The following exercises strengthen the muscles that help to support the trunk and back. They also help to keep the lower back flexible. Doing these exercises can help to prevent back pain or lessen existing pain.<br />· If you have back pain or discomfort, try doing these exercises 2-3 times each day or as told by your health care provider.<br />· As your pain improves, do them once each day, but increase the number of times that you repeat the steps for each exercise (do more repetitions).<br />· To prevent the recurrence of back pain, continue to do these exercises once each day or as told by your health care provider.<br />Do exercises exactly as told by your health care provider and adjust them as directed. It is normal to feel mild stretching, pulling, tightness, or discomfort as you do these exercises, but you should stop right away if you feel sudden pain or your pain gets worse.<br />Exercises<br />Single knee to chest<br />Repeat these steps 3-5 times for each leg:<br />1. Lie on your back on a firm bed or the floor with your legs extended.<br />2. Bring one knee to your chest. Your other leg should stay extended and in contact with the floor.<br />3. Hold your knee in place by grabbing your knee or thigh with both hands and hold.<br />4. Pull on your knee until you feel a gentle stretch in your lower back or buttocks.<br />5. Hold the stretch for 10-30 seconds.<br />6. Slowly release and straighten your leg.<br />Pelvic tilt<br />Repeat these steps 5-10 times:<br />1. Lie on your back on a firm bed or the floor with your legs extended.<br />2. Bend your knees so they are pointing toward the ceiling and your feet are flat on the floor.<br />3. Tighten your lower abdominal muscles to press your lower back against the floor. This motion will tilt your pelvis so your tailbone points up toward the ceiling instead of pointing to your feet or the floor.<br />4. With gentle tension and even breathing, hold this position for 5-10 seconds.<br />Cat-cow<br />Repeat these steps until your lower back becomes more flexible:<br />1. Get into a hands-and-knees position on a firm surface. Keep your hands under your shoulders, and keep your knees under your hips. You may place padding under your knees for comfort.<br />2. Let your head hang down toward your chest. Contract your abdominal muscles and point your tailbone toward the floor so your lower back becomes rounded like the back of a cat.<br />3. Hold this position for 5 seconds.<br />4. Slowly lift your head, let your abdominal muscles relax and point your tailbone up toward the ceiling so your back forms a sagging arch like the back of a cow.<br />5. Hold this position for 5 seconds. <br />Press-ups<br />Repeat these steps 5-10 times:<br />1. Lie on your abdomen (face-down) on the floor.<br />2. Place your palms near your head, about shoulder-width apart.<br />3. Keeping your back as relaxed as possible and keeping your hips on the floor, slowly straighten your arms to raise the top half of your body and lift your shoulders. Do not use your back muscles to raise your upper torso. You may adjust the placement of your hands to make yourself more comfortable.<br />4. Hold this position for 5 seconds while you keep your back relaxed.<br />5. Slowly return to lying flat on the floor. <br />Bridges<br />Repeat these steps 10 times:<br />1. Lie on your back on a firm surface.<br />2. Bend your knees so they are pointing toward the ceiling and your feet are flat on the floor. Your arms should be flat at your sides, next to your body.<br />3. Tighten your buttocks muscles and lift your buttocks off the floor until your waist is at almost the same height as your knees. You should feel the muscles working in your buttocks and the back of your thighs. If you do not feel these muscles, slide your feet 1-2 inches farther away from your buttocks.<br />4. Hold this position for 3-5 seconds.<br />5. Slowly lower your hips to the starting position, and allow your buttocks muscles to relax completely.<br />If this exercise is too easy, try doing it with your arms crossed over your chest. <br />Abdominal crunches<br />Repeat these steps 5-10 times:<br />1. Lie on your back on a firm bed or the floor with your legs extended.<br />2. Bend your knees so they are pointing toward the ceiling and your feet are flat on the floor.<br />3. Cross your arms over your chest.<br />4. Tip your chin slightly toward your chest without bending your neck.<br />5. Tighten your abdominal muscles and slowly raise your trunk (torso) high enough to lift your shoulder blades a tiny bit off the floor. Avoid raising your torso higher than that because it can put too much stress on your low back and does not help to strengthen your abdominal muscles.<br />6. Slowly return to your starting position.<br />Back lifts<br />Repeat these steps 5-10 times:<br />1. Lie on your abdomen (face-down) with your arms at your sides, and rest your forehead on the floor.<br />2. Tighten the muscles in your legs and your buttocks.<br />3. Slowly lift your chest off the floor while you keep your hips pressed to the floor. Keep the back of your head in line with the curve in your back. Your eyes should be looking at the floor.<br />4. Hold this position for 3-5 seconds.<br />5. Slowly return to your starting position.<br />Contact a health care provider if:<br />· Your back pain or discomfort gets much worse when you do an exercise.<br />· Your worsening back pain or discomfort does not lessen within 2 hours after you exercise.<br />If you have any of these problems, stop doing these exercises right away. Do not do them again unless your health care provider says that you can.<br />Get help right away if:<br />· You develop sudden, severe back pain. If this happens, stop doing the exercises right away. Do not do them again unless your health care provider says that you can.<br />This information is not intended to replace advice given to you by your health care provider. Make sure you discuss any questions you have with your health care provider.<br />Document Revised: 04/23/2020 Document Reviewed: 09/19/2019<br />Elsevier Patient Education © 2021 Elsevier Inc.<br /><br /><br />Potassium <br />Date Value Ref Range Status <br />06/10/2015 5.2 (High) 3.5 - 5.0 MMOL/L Final <br /><br /></span><br /><span style="">Electronically signed by Dr. Fazel at 03/22/2022 1:35 PM PDT</span><br /><br /></li></ul></li></ul>documented in this encounter</div></div></div><div class="wrap-collabsible"><input id="ID0ET6BG" class="toggle" type="checkbox" /><label for="ID0ET6BG" class="lbl-toggle" data-loinc-code="10164-2">Progress Notes</label><div class="collapsible-content"><div class="content-inner"><ul style=""><li>Dr. Masson - 04/15/2019 9:30 AM PDT: <span id="Note30"><span><span style="">Formatting of this note is different from the original.</span><br />PHQ-2 Total Score (Scale: 0 to 3) 9/6/2013 <br />PHQ-2 Total Score 6 <br /><br />CSHS ONC PHQ9 1/19/2018 3/8/2019 7/19/2020 <br />In the last two weeks, how often have you had little interest or pleasure in doing things? 0 0 1 <br />In the last two weeks, how often have you been feeling down, depressed or hopeless? - 1 1 <br />In the last two weeks, how often have you had trouble falling asleep, staying asleep or sleeping too much? 0 - - <br />In the last two weeks, how often have you been feeling tired or having little energy? - - - <br />In the last two weeks, how often have you had poor appetite or been overeating? - - - <br />In the last two weeks, how often have you been feeling bad about yourself, or that you\'re a failure or have let yourself or family down? - - - <br />In the last two weeks, how often have you had trouble concentrating on things, such as reading the newspaper or watching television? - - - <br />In the last two weeks, how often have you been moving or speaking so slowly that other people could have noticed; Or, the opposite - being fidgety or restless that you have been moving around a lot more than usual? - - - <br />In the last two weeks, how often have you had thoughts that you would be better off dead or of hurting yourself in some way? - - - <br />PHQ-9 Score 0 1 2 <br /><br /></span><br /><span style="">Electronically signed by Dr. Masson at 07/19/2020 2:23 PM PDT</span><br /></span></li><li>Dr. Rao - 04/15/2019 9:30 AM PDT: <span id="Note29"><span><span style="">Formatting of this note might be different from the original.</span><br />Blood pressure 120/80, pulse 80, temperature 98.8 °F (37.1 °C), temperature source Oral. <br />General appearance: alert, cooperative, no distress, appears stated age<br />Head: Normocephalic, without obvious abnormality, atraumatic<br />Eyes: conjunctivae/corneas clear. PERRL, EOM\'s intact. Fundi benign<br />Ears: normal TM\'s and external ear canals AU<br />Nose: Nares normal. Septum midline. Mucosa normal. No drainage or sinus tenderness.<br />Neck: supple, symmetrical, trachea midline, no adenopathy, thyroid: not enlarged, symmetric, no tenderness/mass/nodules, no carotid bruit, and no JVD<br />Lungs: clear to auscultation bilaterally<br />Heart: regular rate and rhythm, S1, S2 normal, no murmur, click, rub or gallop , no edema<br />Abdomen: soft, non-tender. Bowel sounds normal. No masses, no organomegaly<br />Extremities: extremities normal, atraumatic, no cyanosis or edema<br />Skin: Skin color, texture, turgor normal. No rashes or lesions<br />Neurologic: Grossly normal, no inattention, alert and oriented x3<br /><br /></span><br /><span style="">Electronically signed by Dr. Rao at 08/03/2021 5:11 PM PDT</span><br /></span></li><li>Roma Yogesh Gianchandani - 04/15/2019 9:30 AM PDT: <span id="Note28"><span><span style="">Formatting of this note might be different from the original.</span><br />This is a test of dictating later this is a test of dictating later this is a test of dictating later<br /><br />No results found for: HGBA1C <br />.uma<br /><br /></span><br /><span style="">Electronically signed by Roma Yogesh Gianchandani at 01/21/2022 2:37 PM PST</span><br /></span></li><li>Dr. Merchant - 04/15/2019 9:30 AM PDT: <span id="Note27"><span><span style="">Formatting of this note is different from the original.</span><br /><span style="">Images from the original note were not included.</span><br /><br /><br /><br /> Hematology and Cellular Therapy<br /><br />Patient Information <br /><br />Patient: AmbulatorySeniorF Xxxcshs<br />DOB: 1/1/1947<br />MRN: 200270896<br />Date of Service: 4/15/2019<br /><br />History of Present Illness <br /><br />CC: <br />Referring Provider: <br /><br />AmbulatorySeniorF Xxxcshs is a 75 year old woman <br /><br />Subjective History: fever<br /><br />Review of Systems:<br />A 14-point review of systems was performed with pertinent positives/negatives noted in the interval history, all others negative.<br /><br />Hematologic History:<br /><br />Patient Active Problem List <br /> Diagnosis Date Noted <br />• Rheumatoid arthritis, seropositive (HCC) 08/30/2021 <br />• COVID-19 virus infection 04/13/2020 <br />• Sucked into jet engine 10/25/2019 <br />• Moral distress 11/28/2018 <br /> Overview Note: <br /> https://onlinelibrary.wiley.com/doi/pdf/10.1111/j.2044-8341.1926.tb00623.x<br /><br />• Sucked into jet engine 05/06/2017 <br /> Overview Note: <br /> https://www.youtube.com/watch?v=2Aldwlro4DA</CITE><br /><br />• Spacecraft collision injuring occupant 05/06/2017 <br /> Overview Note: <br /> Fell a really long way <br /><br />• Diabetes mellitus type 2, noninsulin dependent (HCC) 06/09/2016 <br /><br />Past Medical History: <br />Diagnosis Date <br />• Abnormal Pap smear of cervix <br />• Anxiety <br />• Breast asymmetry 11/05/2017 <br /> testing <br />• Depressive disorder, not elsewhere classified <br />• ERRONEOUS ENCOUNTER--DISREGARD <br />• Family history of diabetes mellitus <br />• Frail elderly <br />• Headache(784.0) <br />• Heelies colliding with stationary object 5/6/2017 <br />• History of anemia <br />• History of bilateral breast implants <br />• Known health problems: none <br />• Known health problems: none <br />• NO SIGNIFICANT MEDICAL PROBLEMS <br />• NO SIGNIFICANT MEDICAL PROBLEMS <br />• Pneumonia 4/18/2010 <br />• Rash of back <br />• Sleep apnea <br />• Type 2 diabetes mellitus with hyperosmolarity without coma (HCC) 6/9/2016 <br /><br />Past Surgical History: <br />Procedure Laterality Date <br />• HX COLOSTOMY CLOSURE <br />• HX LOW ANTERIOR RESECTION <br />• HX THYROID NODULE RESECTION <br />• HX THYROIDECTOMY <br />• HX TONSILLECTOMY <br />• PAST SURGICAL HISTORY - NONE REPORTED <br />• PAST SURGICAL HISTORY - NONE REPORTED <br />• PR CESAREAN DELIVERY ONLY <br />• PR LAP GASTRIC BYPASS/ROUX-EN-Y <br />• PR REMOVAL COLON/PROCTEC/ ILEOANAL ANAST <br />• PR REMV STOMACH,PART,DISTAL,GASTRODUOD <br />• WOUND OSTOMY EVAL AND TREAT <br /><br />Social History <br /><br />Tobacco Use <br />• Smoking status: Former Smoker <br /> Packs/day: 0.50 <br /> Types: Cigarettes <br /> Start date: 1999 <br /> Quit date: 06/2010 <br /> Years since quitting: 11.7 <br />• Smokeless tobacco: Not on file <br />Substance Use Topics <br />• Alcohol use: Yes <br /> Alcohol/week: 3.0 standard drinks <br /> Types: 3 Shots of liquor per week <br />• Drug use: Yes <br /> Types: Marijuana <br /><br />Family History <br />Problem Relation Age of Onset <br />• Frailty Mother <br />• Tuberculosis Brother <br />• Hypertension Paternal Aunt <br />• Prostate Cancer Paternal Aunt <br />• Colon Polyps Paternal Grandmother <br />• Breast Cancer Paternal Grandmother <br />• Diabetes Maternal Aunt <br />• Ovarian Cancer Paternal Uncle <br />• Heart Disease Other <br /> fathers side <br />• Coronary Artery Disease Other <br /> mothers side <br />• Obesity Other <br />• Thoracic Aneurysm Other <br />• Diverticulosis Other <br />• Degenerative Disc Disease Other <br />• Carotid Stenosis Other <br />• Other Family History Maternal Grandmother <br /> Fraility <br />• History of Fragility Fracture Sister <br /><br /><br />Medications <br /><br />Current Outpatient Medications <br />Medication Sig <br />• ibuprofen (MOTRIN) 600 mg tablet Take 600 mg by mouth 3 times daily. Take with food. <br />• PREDNISONE, BULK, MISC <br />• metFORMIN (GLUCOPHAGE) 500 mg tablet <br />• acetaminophen (TYLENOL) 325 mg oral tablet Take 1 tablet by mouth every 4 hours as needed. Do NOT exceed 3000 mg of acetaminophen from all sources per 24 hours. (Patient not taking: Reported on 11/5/2020) <br />• atorvastatin (LIPITOR) 10 mg oral tablet Take 1 tablet by mouth daily. <br />• gabapentin (NEURONTIN) 100 mg capsule Take 1 capsule by mouth nightly. May increase to three times at night as necessary and tolerated <br />• naproxen (NAPROSYN) 500 mg oral tablet Take 1 tablet by mouth 2 times daily as needed. Take with food. (Patient taking differently: Take 500 mg by mouth as needed. Take with food.) <br /><br />Objective <br /><br />Vitals: <br /> 10/21/19 1530 <br />BP: 120/80 <br />Pulse: 80 <br />Temp: 98.8 °F (37.1 °C) <br />TempSrc: Oral <br /><br />ECOG Score: <br /><br />Physical Exam:<br />Constitutional: Oriented to person, place, and time. Appears well-developed and well-nourished. <br />Head: Normocephalic, atraumatic, no visible abnormalities<br />Nose: Nares normal. Septum midline. Mucosa normal. No drainage.<br />Mouth/Throat: No oropharyngeal exudate or mucositis. <br />Eyes: EOM are normal. No scleral icterus. <br />Neck: Normal range of motion. No tracheal deviation present. <br />Cardiovascular: Normal rate and regular rhythm. No murmurs, rubs, or gallops.<br />Pulmonary: Breath sounds normal. No respiratory distress. No wheezing, rales, or rhonchi.<br />Abdominal: Soft and non-distended. Bowel sounds are normal. <br />Musculoskeletal: Normal range of motion. <br />Skin: Skin color, texture, turgor normal. No rashes or lesions<br />Extremities: No cyanosis, clubbing, or edema<br />Neurological: No focal neurologic deficits. Strength intact in all extremities<br />Psychiatric: Normal mood and affect. <br />Lymph: No palpable cervical, supraclavicular, axillary, or inguinal lymphadenopathy<br /><br />Laboratory Results <br /><br />No results found for: WBC, HGB, HCT, MCV, RDW, PLT, POLY, LYMPH, MONOS, EOS, BASO, ANC, ALC, MONOSABS, EOSABS, BASOABS, RBCMORPH, DIFFTYPE <br />Lab Results <br />Component Value Date <br /> Glucose 67 04/22/2020 <br /> Creatinine 2.8 (High) 06/10/2015 <br /> Urea Nitrogen 30 (High) 06/10/2015 <br /> Sodium 139 06/10/2015 <br /> Potassium 5.2 (High) 06/10/2015 <br /> Chloride 104 06/10/2015 <br /> Carbon Dioxide 6 (Low) 06/10/2015 <br /> ALT 50 (High) 06/10/2015 <br /> AST 76 (High) 06/10/2015 <br /> Alkaline Phosphatase 102 06/10/2015 <br /> Bilirubin, Total 1.9 (High) 06/10/2015 <br /> Total Protein 5.6 (Low) 06/10/2015 <br /> Albumin 3.5 06/10/2015 <br /> Calcium, Serum 4.6 (Low) 06/10/2015 <br /><br />Imaging Results <br /><br />Pathology <br /><br />Assessment and Plan <br /><br />Diagnoses and all orders for this visit:<br /><br />History of non-Hodgkin\'s lymphoma<br /><br />Chronic obstructive pulmonary disease, unspecified COPD type (HCC)<br /><br />Screening-pulmonary TB<br />- PPD TEST<br />- ECG<br /><br />Lower abdominal pain<br />- ECG<br />- PR ANOSCOPY DX W/COLLJ SPEC BR/WA SPX WHEN PRFRMD<br /><br />Pneumothorax, unspecified type<br /><br />Non-seasonal allergic rhinitis, unspecified trigger<br /><br /><br /><br />A total time of 44 minutes was spent on today\'s encounter which included the following: <br />Obtaining and/or reviewing separately obtained history<br />Performing a medically appropriate exam and/or evaluation <br />Counseling and educating a patient/family/caregiver as noted above <br />Referring and communicating with other healthcare professionals (not separately reported) <br />Independently interpreting results (not separately reported) and communicating results to the patient/family/caregiver<br /><br />Akil Abid Merchant, MD <br />3/7/2022<br />5:39 PM</span><br /><span style="">Electronically signed by Dr. Merchant at 03/07/2022 5:50 PM PST</span><br /></span></li><li>Alexis Rieber - 04/15/2019 9:30 AM PDT: <span id="Note26"><span><span style="">Formatting of this note might be different from the original.</span><br /><span style="">Images from the original note were not included.</span><br /><br />Physical Exam<br /><br />This is a very cute dog<br /><br />This dog is white cell then sa<br /><br />This is a 42-year-old patient with hypertension past medical 7</span><br /><span style="">Electronically signed by Alexis Rieber at 07/05/2022 1:57 PM PDT</span><br /></span></li><li>Dr. Masson - 04/15/2019 9:30 AM PDT: <span id="Note25"><span><span style="">Formatting of this note might be different from the original.</span><br />Follow up Chronic Kidney Disease <br />Symptom symptoms one day daily <br /></span><br /><span style="">Electronically signed by Dr. Masson at 07/22/2022 11:08 AM PDT</span><br /></span></li><li>Dr. Masson - 04/15/2019 9:30 AM PDT: <span id="Note24"><span><span style="">Formatting of this note might be different from the original.</span><br />In my canal I can dictate later that is not a good workflow if you doing<br /></span><br /><span style="">Electronically signed by Dr. Masson at 09/26/2022 10:59 AM PDT</span><br /></span></li><li>Dr. Masson - 04/15/2019 9:30 AM PDT: <span id="Note23"><span><span style="">Formatting of this note might be different from the original.</span><br />Diagnoses and all orders for this visit:<br /><br />History of non-Hodgkin\'s lymphoma<br /><br />Chronic obstructive pulmonary disease, unspecified COPD type (HCC)<br /><br />Screening-pulmonary TB<br />- PPD TEST<br /><br />Lower abdominal pain<br /><br />Pneumothorax, unspecified type<br /><br />Non-seasonal allergic rhinitis, unspecified trigger<br /><br />Primary hypertension<br /><br />Ace inhibitor <br /><br /></span><br /><span style="">Electronically signed by Dr. Masson at 10/08/2022 6:20 PM PDT</span><br /></span></li><li>Dr. Masson - 04/15/2019 9:30 AM PDT: <span id="Note22"><span><span style="">Formatting of this note might be different from the original.</span><br /><br />..lastim<br /><br />No results found for this or any previous visit from the past 365 days 10 hours.<br /><br /></span><br /><span style="">Electronically signed by Dr. Masson at 04/14/2023 5:33 PM PDT</span><br /></span></li></ul>documented in this encounter</div></div></div><div class="wrap-collabsible"><input id="ID0E1LBI" class="toggle" type="checkbox" /><label for="ID0E1LBI" class="lbl-toggle" data-loinc-code="18776-5">Plan of Treatment</label><div class="collapsible-content"><div class="content-inner"><p>Not on file</p>documented as of this encounter</div></div></div><div class="wrap-collabsible"><input id="ID0EJMBI" class="toggle" type="checkbox" /><label for="ID0EJMBI" class="lbl-toggle" data-loinc-code="61146-7">Goals</label><div class="collapsible-content"><div class="content-inner"><div class="data-table"><table width="100%"><colgroup><col width="30%" /><col width="10%" /><col width="15%" /><col width="20%" /><col width="12%" /><col width="13%" /></colgroup><thead><tr><th>Goal</th><th>Patient Goal Type</th><th>Associated Problems</th><th>Recent Progress</th><th>Patient-Stated?</th><th>Author</th></tr></thead><tbody><tr style=""><td><p id="goal1">Hemoglobin A1C <= 7.0</p></td><td>Result Component</td><td /><td /><td>No</td><td>Dr. Masson</td></tr><tr style=""><td><p id="goal2">Hemoglobin A1C <= 7.0</p></td><td>Result Component</td><td>Diabetes mellitus type 2, noninsulin dependent</td><td /><td>No</td><td>Jeff Oostmeyer</td></tr><tr style=""><td style="" colspan="6"><p style="">Note: </p><span id="goal2note"><span style="">Formatting of this note might be different from the original.</span><br />Test</span><br /></td></tr><tr style=""><td><p id="goal3">LDL CALC <= 100</p></td><td>Result Component</td><td>Diabetes mellitus type 2, noninsulin dependent</td><td /><td>No</td><td>Jeff Oostmeyer</td></tr><tr style=""><td style="" colspan="6"><p style="">Note: </p><span id="goal3note"><span style="">Formatting of this note might be different from the original.</span><br />Test</span><br /></td></tr></tbody></table></div>documented as of this encounter</div></div></div><div class="wrap-collabsible"><input id="ID0EQVBI" class="toggle" type="checkbox" /><label for="ID0EQVBI" class="lbl-toggle" data-loinc-code="30954-2">Results</label><div class="collapsible-content"><div class="content-inner"><ul style=""><li id="Result.1.2.840.114350.1.13.202.2.7.2.798268.326239047.Procedure">PPD TEST - Final result (04/15/2019 9:32 AM PDT): <div class="data-table"><table width="100%"><colgroup><col width="20%" /><col width="12%" /><col width="8%" /><col width="20%" /><col span="2" width="10%" /><col width="20%" /></colgroup><thead><tr><th>Component</th><th>Value</th><th>Ref Range</th><th>Test Method</th><th>Analysis Time</th><th>Performed At</th><th>Pathologist Signature</th></tr></thead><tbody><tr ID="Result.1.2.840.114350.1.13.202.2.7.2.798268.326239047.Comp1" style="" id="Result.1.2.840.114350.1.13.202.2.7.2.798268.326239047.Comp1"><td ID="Result.1.2.840.114350.1.13.202.2.7.2.798268.326239047.Comp1Name" id="Result.1.2.840.114350.1.13.202.2.7.2.798268.326239047.Comp1Name">Induration PPD</td><td>10</td><td>0 - 10 mm</td><td /><td /><td /><td ID="Result.1.2.840.114350.1.13.202.2.7.2.798268.326239047.Comp1Signature" id="Result.1.2.840.114350.1.13.202.2.7.2.798268.326239047.Comp1Signature" /></tr></tbody></table></div><div class="data-table"><table width="100%"><colgroup><col span="5" width="20%" /></colgroup><thead><tr><th>Specimen (Source)</th><th>Anatomical Location / Laterality</th><th>Collection Method / Volume</th><th>Collection Time</th><th>Received Time</th></tr></thead><tbody><tr style=""><td ID="Result.1.2.840.114350.1.13.202.2.7.2.798268.326239047.Specimen" id="Result.1.2.840.114350.1.13.202.2.7.2.798268.326239047.Specimen" /><td /><td /><td>04/15/2019 9:32 AM PDT</td><td /></tr></tbody></table></div><div class="data-table"><table width="100%"><thead><tr><th>Narrative</th></tr></thead><tbody><tr><td style=""><p /></td></tr></tbody></table></div><div class="data-table"><table width="100%"><colgroup><col width="20%" /><col width="80%" /></colgroup><thead><tr><th>Authorizing Provider</th><th>Result Type</th></tr></thead><tbody><tr><td>Dr. Gray</td><td>IMMUNIZATION ORDERABLES</td></tr></tbody></table></div></li></ul>documented in this encounter</div></div></div><div class="wrap-collabsible"><input id="ID0E36BI" class="toggle" type="checkbox" /><label for="ID0E36BI" class="lbl-toggle" data-loinc-code="51848-0">Visit Diagnoses</label><div class="collapsible-content"><div class="content-inner"><div class="data-table"><table width="100%"><colgroup><col width="100%" /></colgroup><thead><tr><th>Diagnosis</th></tr></thead><tbody><tr ID="vdx3" style="" id="vdx3"><td><p><span id="vdx3Name">History of non-Hodgkin\'s lymphoma</span><span> - Primary</span></p></td></tr><tr ID="vdx4" style="" id="vdx4"><td><p><span id="vdx4Name">Chronic obstructive pulmonary disease, unspecified COPD type (HCC)</span></p></td></tr><tr ID="vdx5" style="" id="vdx5"><td><p><span id="vdx5Name">Screening-pulmonary TB</span></p></td></tr><tr ID="vdx6" style="" id="vdx6"><td><p><span id="vdx6Name">Lower abdominal pain</span></p></td></tr><tr ID="vdx7" style="" id="vdx7"><td><p><span id="vdx7Name">Pneumothorax, unspecified type</span></p></td></tr><tr ID="vdx8" style="" id="vdx8"><td><p><span id="vdx8Name">Non-seasonal allergic rhinitis, unspecified trigger</span></p></td></tr><tr ID="vdx9" style="" id="vdx9"><td><p><span id="vdx9Name">Primary hypertension</span></p></td></tr><tr ID="vdx10" style="" id="vdx10"><td><p><span id="vdx10Name">Coronary artery disease involving native heart without angina pectoris, unspecified vessel or lesion type</span></p></td></tr><tr ID="vdx11" style="" id="vdx11"><td><p><span id="vdx11Name">Chronic sinusitis, unspecified location</span></p></td></tr></tbody></table></div>documented in this encounter</div></div></div><div class="wrap-collabsible"><input id="ID0EWCCI" class="toggle" type="checkbox" /><label for="ID0EWCCI" class="lbl-toggle" data-loinc-code="85847-2">Care Teams</label><div class="collapsible-content"><div class="content-inner"><div class="data-table"><table width="100%" ID="ct54" id="ct54"><colgroup><col span="3" width="25%" /><col width="13%" /><col width="12%" /></colgroup><thead><tr><th>Team Member</th><th>Relationship</th><th>Specialty</th><th>Start Date</th><th>End Date</th></tr></thead><tbody><tr style=""><td><p style="font-weight:bold;">Dr. Masson</p><p>NPI: 1326098302</p><p>310-248-7000 (Work)</p><p>310-248-7033 (Fax)</p></td><td>PCP - General</td><td>Family Medicine</td><td>3/15/18</td><td /></tr></tbody></table></div>documented as of this encounter</div></div></div><table class="header_table"><tbody><tr><td class="td_header_role_name"><span class="td_label"><b>Author:</b></span></td><td class="td_header_role_value">Epic - Version 10.3 - Epic - Version 10.3</td></tr><tr><td class="td_header_role_name"><span class="td_label" /></td><td class="td_header_role_value"><br /><br /></td></tr></tbody></table><table class="header_table"><tbody><tr><td class="td_header_role_name"><span class="td_label"><b>Legal Authenticator:</b></span></td><td class="td_header_role_value">Health Information Executive Director Cshs</td></tr><tr><td class="td_header_role_name"><span class="td_label" /></td><td class="td_header_role_value"><br /><br /></td></tr></tbody></table>Signed on May 29, 2023, 07:40:37</body></html>',jCe="JVBERi0xLjQKJdPr6eEKMSAwIG9iago8PC9UaXRsZSAoVW50aXRsZWQgZG9jdW1lbnQpCi9Qcm9kdWNlciAoU2tpYS9QREYgbTEyNSBHb29nbGUgRG9jcyBSZW5kZXJlcik+PgplbmRvYmoKMyAwIG9iago8PC9jYSAxCi9CTSAvTm9ybWFsPj4KZW5kb2JqCjUgMCBvYmoKPDwvRmlsdGVyIC9GbGF0ZURlY29kZQovTGVuZ3RoIDIwMT4+IHN0cmVhbQp4nI2OTWoDMQyF9zqFLhBFP5ZlQ8mi0Gad4hu0TaDQRdL7Q+wxmYEuSi1ji/fQpyfIvXbSn6iK799wBQpf1MffRcFRb0ecze0C+6Ph5QeGXySjsGe8fcIZTr8IoeN2Bi9SZ8xmYzw32L8mlER5nMB2BtlyUYpaJKxiG5CdGGmEJSvYPvCJ2eKA7QuCTHPNbn1mGqksRiFxEY6yGp7XiSLqmz5JL+3vTMZUncX/Ec0WYKUIz5x03aRzkzB5SRppC631keEEd14/VDIKZW5kc3RyZWFtCmVuZG9iagoyIDAgb2JqCjw8L1R5cGUgL1BhZ2UKL1Jlc291cmNlcyA8PC9Qcm9jU2V0IFsvUERGIC9UZXh0IC9JbWFnZUIgL0ltYWdlQyAvSW1hZ2VJXQovRXh0R1N0YXRlIDw8L0czIDMgMCBSPj4KL0ZvbnQgPDwvRjQgNCAwIFI+Pj4+Ci9NZWRpYUJveCBbMCAwIDYxMiA3OTJdCi9Db250ZW50cyA1IDAgUgovU3RydWN0UGFyZW50cyAwCi9QYXJlbnQgNiAwIFI+PgplbmRvYmoKNiAwIG9iago8PC9UeXBlIC9QYWdlcwovQ291bnQgMQovS2lkcyBbMiAwIFJdPj4KZW5kb2JqCjcgMCBvYmoKPDwvVHlwZSAvQ2F0YWxvZwovUGFnZXMgNiAwIFIKL1ZpZXdlclByZWZlcmVuY2VzIDw8L1R5cGUgL1ZpZXdlclByZWZlcmVuY2VzCi9EaXNwbGF5RG9jVGl0bGUgdHJ1ZT4+Pj4KZW5kb2JqCjggMCBvYmoKPDwvTGVuZ3RoMSAxNzk0OAovRmlsdGVyIC9GbGF0ZURlY29kZQovTGVuZ3RoIDg3MzY+PiBzdHJlYW0KeJztegl4VEXW9qm6vaXTne6EbJ100rfTSQfSYUuAsETS2QCN7IsJJpIAkbDJElRQlDAjChFFcRsZR9zFBe0sYhN1YEQddxh13AVEVJwRQUdxJfd7q7pD0qLf5F++5/99nqnKeetU1alTVeeeOre6O8SIqA9AR4PGlpWPYQvZHCKejNaRYydNnNo0+E9XESl21K8YO3V6ifnPxo1ELID6oIlTB+atHL7jKORFvXZG2fjKSZsXfEM0ZD1R7I1zFtctZQe4C/3T0F8956IV6p3Ot/5JZPgcNO38pfMWv7yqaguR1Y/6BfPqGpdSMkVBfyHk7fMWrTr/vsoz3ibqi/VYLmiYu3jlnnXfPY8FYz7Ttob6urkH45+DPnYQ8sMa0BCXH+VGHWukzIbFK1ZmbVKeJtKLNdcuWjKnrmhi4VTs50b0ty6uW7lU32ZtQt/ZqKsX1C2uT6od/AGMMQ5tZUuXNK7Qcuhm8ItE/9Ll9Uuz3hy/i8hZSRT9Z7QpZCJOscQ0DbywZSV9RYX0JzKi3U4DaQa0PQxZPeoKyaRlC52/kDDeOLpzApXa6YdHf7jELlsiUqVsMdMAZH3d8rrZpM5ZtXwRqfOW1y8ktaF+9nJSF9WtuIDUbp2kd2w58PDDY2fZCr8xpZpk810fZeeI8qVJo3b88OjJeXYyWVCNOjWjKC1hnmM3obZsZEb9kBnlIzMqQGY0Dplhr+eEx3NpG6L4sFXi4V+wKcVIexmojMbQJJpG9bQClqMe9UZN0z7qzqdZQFHWs+tgTZN+iz4fS0oNlcrf6HweZ9LzaIOOi6Sjn1lv/MQJE8mPmVboX++czPKNo1mrXzw4zK/z6p8QTxirDNm3hKpJkZbNDVlW2lTsQjw/DVK8B8968FjKwvrlkO2J4bUIOQ4LMEkWCq0xTmooQM84LY1mgIgS/q/m1+l1NuIX8nuhzKv/XVbqfj3rf2cokAY20kzxtHU4v7SAmsI8gzUvCvMcz78hzCt4Fn3DvK6HjJ5SIBXiDeCIimk5zac6WkTj4SEz4CPLqREtS0h4+VCchME0CP3jZcsSWkGraCmkVDqTFqN9HmQvAKrUH9StTaUpkJpHF4KvQ2tkrVvuAUjmYYbByCpW0CB1nz5bKWrLwQusQ3tohQPknIvC883HDA3oawzP3ih3cxFwLg0wnObs//8k/V/pdlHqPqJtvZKfEZLvShg36P90DbpGqvjfGkdUxEdQpr6DHKAU/f3k0HnxpiHtU9ARUXbO146IflHyf2BQMEyE/W5n82k77aKn2XGMepR2Ujs9T0mIJbfRarqRroKnzkTLBjzTKfDgMrqRObR2RP874cl30iuQPYcupw5KZMnaZ7SG1imvY9Q6slIGvGMSPOUadrZ2IaLOAd3vEQvOhucsZU1apXattlm7h+6lncrz2kmKxumYg/yK9oX+be19eHQ13US30gG2OeoxnKhzcO52Kn+CT21RanRMm6f9gBW46WKsQQeffYXt5j5or6dPWTJbrZRCy91aQHsGUk6qgW9uoQ42lI3lbn21Nl57hRIxx0povZVaaQdykJ6id5lFf1y7RztODsrFKVsDe7zKdiudJ9d2FomHDyv1oxHoWUJ/pr/SPuZhf+FL9BZ9nt6vv0R7AxFxME3Hau/HyE/Yt/xy5DXKc7oxWgnO/Dq6XlibnqUPWQobyCayGbwfX8JvV5YjcubKkzgXZ2kD/QHa9zMf28EtfK9yt+4h3Y+GtM6DWgyeiJf+iPfwX5gVO1VZI/sde5N9xEv5LP5Hfki5UfeA7jVjHXZ9HqLENfQQfcvi2HA2mZ3LGthqdhW7nt3KXmH72BFezKfxhfyY0qAsU57SlSBP1TXqfq+/Un+14UhnZecznX/r/FbL066kyfCHtVj9TfD+dvjJXnoH+QAdYnoWzWKQVeZm09mlyJeza9hdbBt7gLVjln3sEPuMfcW+YT9yBEpu4KnczTOQPXw5v5jfyG/je5H38c/590qSkqH4lKFKoVKlLMGqrlKuQ35M+VCXotur02DnPP3N+q36bfqH9E/rjxssxt+ZyPTyT3efzDm5v5M613fe3Nna2a59iLeDAz7lJBduLZMRt+oQu1fifnIv/Px1ZoHtUlgOG83OhmVmsQVsGVsJS17BtrB75dofYU/CSm+xY1izlTvlmgfwobyET0Q+j9fzZfw6vpm38zf5D4pRiVZsSoKSo4xVapR6ZYWySrlZCSgvKx8oh5QTyk/Ims6sc+kydF6dTzdWN0t3oe523ae6T/XV+pf0HxvMhsWGKw1Bw5fGYcbRxknGycYa4ybjDuMbplp45x56jB7vefbZQWWtUq48RtfyfJ2Dv8pfhT/PornKeA5P5dvYen4Za+eZ+pWGUXwUm0DHdV7Y+jm+lZ/go5TxrIJNpQV8cEibIV73IIpC3R46qnsSe3sVmlcaLOxyfsxgoVZcC0ZgzmeVQTqf8hK9qxxgRt2d9J7OzJLYUX6/Mgle8JRutL6S3Mpt9IiyjF1Gj/FyXDl+NG2EH09gDyIuTGN57DsFN0o+AV5UoHxEv6eF/G06inO8nm5hc3Xz6FrKZ6vpU7oPp6Kf/gJDjiGBvcDn65p5H9ZOXPcAdjeCZTJFH09XsBpli+EYfwdvt706M+1XHsbq9/JHlPG64/oprAEn4DK6kpZpa2mVvlL3GptHCptBWbqDiG6rlTydG+UaRJVqxLQdON0diAPFyni0JMNzzoZfTEeE2IL8B8QJHTxoPs74OYhir1K7YRoP0jx9DEPUQTR+qXMKzdTuo1u1eXSBtpn6Ix5cpa2Gxm30MW2ibWxd56V4j6bj5OxnZ+vH8L36MVp/3szf4VP5zZHPF9bOYsn0D+RHUBmNe1yz7i2aSkXaRu3v8O6+iLC30mw6iw5jl19ghnHKbsrvnMBbtDHKUuz3AE3W7tdczEwN2iKaSE/SvUY91Rl9eMYB9hr2eynV8ynaCqW+cz7ssAlW8MNaFyL+bPCXTp9W7C8afUbhqJEjhhcMHZKfN3jQwAH9c305/fpme7MyPRlu1ZWe5kxNcSQnJSbE94mLtdtirJZoc5TJaNDrFM4ot9wzplYNeGsDOq9n3Lj+ou6pQ0Ndj4bagIqmMZEyAbVWiqmRkn5Inv8zSX9I0n9KktnVQirsn6uWe9TAK2UeNchmTq4Ef02Zp0oNHJX8eMlfJ3kreLcbA9Ty5IYyNcBq1fLAmIsamstry6CuJdpc6imtN/fPpRZzNNhocIEkz9IWljSaSYYnlY9swQ3YikUFUjxl5QGHp0ysIKBkldfNDUyaXFlelup2V/XPDbDSOZ7ZAfKUBGw+KUKlcpqAoTRglNOo88Vu6Gq1JXd388agnWbX+ixzPXPrqisDSl2VmCPWh3nLAkmXHE7urkJ5XGnlVT17U5Xm8uT5qqg2N1+lBu6YXNmz1y2wqgo6MJZnjaltHoOpN8KIFVNVzMbXVVUG2DpMqYqdiF2F9lfvKRcttQvUQJSnxNPQvKAWjyalOUBTVrlbU1L8O7WDlFKuNk+r9LgDRameqroyZ0s8NU9Z1ebwq47Inv65LfbYkGFbYmxhxmLtydSf6pOcFBdcxZRTlmViRZ4z4RABdY6KlVR6sKfhAuqHU/Oc4RBDqmIYFZiLJzI/EFVa22wfKdrF+IA+y+5Rm78heIDn6OeRLXXhFkOW/RsSrPCTU66G/i4+4PMFcnKEixhL8UyxxtGyPrR/7kVB7vEstasoYD6aBNvWVY0cCPO73eIBXx3002xUAk2TK0N1lWantpJ/oK8qwGtFz+6unoTpoqepq+fU8FoPPLld3rgTAibvqT+bPbFPecPIAEv8b7rrQ/0VUz0Vk2dWquXNtWHbVkyLqIX6h5/qC3OBPqWVSioPczxVkb1wyupTwqJSaQnosvBnkE49N2g0wStlC1PHBOy140JYZXa7ezkoqB0Xo2TRPSy8zMBIX2R9VEQ9YnmWZgULxquyYtrM5mZzRB9cLTThmeECHk/TKt1qaYCm42Rm4S+o7R4uqCo14IfJSoUA/C/UFK5GCKaG+Sok4Z39c8cg0DU3j/GoY5prm+uCWtNsj2r3NO/kT/Onm5eW13Y5TlDruDo1MGZjFWzVwEbiUHAqafGw9ZNb/Gz91JmVO+345L9+WmUrZ7y0tqSqJRN9lTtVIr9s5aJVNIqKKipUwbDJVm6S8qk7/URNslcnG2R9TpCRbDN1tTGaE+ShNntXG0ebLtTml20iiRhTOq2yp/fII1nVX77wxHdz1dEmU+8+/BhxE+5KhjBFpMgGg0JkiYrqne6o8PdCIpnkXKdNHlGDbqvZ3Fvdph78v9eND3m26Oje6Y6m7g2aw/ojUqRtTdBtt1h+LvTLyULdG4z+Jd2RDUJ3rNX6P6a7T0xM73THUPcGrUR02nYjbWvWIzDa7b3TbaPuDcb8ku7Ihmi4ZHJcXO90x0J7V7KH9UekSNta4Dap8fG90x0P7d3zhPRHJFtELQZuk5aY2DvdCdS9wT5hikiRk9mgW01O7p3uJOreYMIv6Y6NqNnhNm6Ho3e6k3voTgzr/290x0J3ltPZO92pWHlXEstJ+rlA5HOLw2nIUdXe6U7Hp9yuJJaT8nOByMni4ZIDPJ7e6XZT9wZdYf0RKXKyJLhkntfbO92ZUmPXPNSjFk6Rkzng/8P69eud7mypsWse6lELp/SIWircfWRubu9051C38bLD+iOSGlFLg7uX5uX1Tvcg6t6geCeett2siFoG/L9i+PDe6R5GA07xeWH9ESknouaF/08dPbp3ugsp/xQvvjMf8nOBARG1HLhkdXl573SXUPcGzwCN+LlAfkRtAFxybkUvv04dJzWGUinotO1G2jYPLrmTpil927zJrn1PKv3oIIgr/Vp9aa6dSraS1jrK5Q8qnra4hDxbcX9Fxd1ooEQVuAT0KGiXIn6PmaWko90OXANqAj0K2gXaB8KbAih6VdAS0FbQQdGjpCnOVtVlL85WHBjrwF3LpiTRMZAGUsgFHAiaCJoF2gTaCjJIOdGyBLQGtAt0XPb4laTWzflYe1Lr1bJoW7AoT1brQtXqGlltO6cqVI6fHCrLzgyJjQyJDR4Sah5QEiqzc0NlXFZekyjN1rzdxYlKIjaZiIUvBTL+DNkYQwC4Q0mgAIgrhnCLX4lry/Tmbd2l6IgpXGE0l1zaboW1WmPzis1c48fwunHxL/jRUA8/2hYTm7e1+Cx+iB4F7QIp/BDyh/xDWsMPCpsDi0BbQbtAe0HHQAZ+EPkA8n6+n2z8AxoIKgLNAm0F7QIdAxn5B0A7f198jpIo+CIQ5+8D7fw9bOs9oI2/C+5d/i6W9nprwYi8nZLxDQwzrqwwk5QaZuIS84L8tdbv+8GjvHjS8KgnlAy4Zr6S0Zo12BVUklsL57uC/KM21ee6o3gQf4MCII6VvIGZ3yAVNAlUC1oKMoB7E9yb1AS6DnQHKACClwHtIJW/CHoZ9CYNAvlBk0Amvq8V0wT53lZvias4kb/K/4o3iou/wp+X5cv8OVm+xJ+V5Qso01G+yJ9rTXdRcTT6CWPsKO0oB6Jfz//Slhnn0opj+S7YzgUcCCoCTQTNAm0CGfguntE61xUHJU/Qi7gouHgrfSbL++guE/kXuPzeUjigKsA78gxwgK3qVi/3e2++FVUB3ms3gxPgvWIjOAHeS9aCE+BddBE4Ad65C8AJ8M6cBU6Ad+I0cIAgv/3xzGxXwcSFTC228YthpYthpYthpYtJxy8Wmb7XibX9sTUnBxbb4vf1y3E1dbCmJ1nTFNZ0F2uqZ02Xs6a1rKmQNZ3Hmnysycma0lmTnzU9wYbDFE3M3x5RHeFPZk0vsqbtrKmRNXlZUxZrymRNKivwB7m79cx8WZTLoq1YHDqUZ4xG9LFxNyzqhs+7ERN2AfeCNFnzQ0jNCAk70kWZ0ZZTFKoPGJm3pHgc34OBe/AY9tABkA4PaA/caA+U7IECG7AINAu0G3QMpIEMkM7AwjdJtAEHgopAs0BrQMdABrmcYyBOS8JLfFQubGB40RNFje9BFj8UuLnbn2Z32n32ccomJ7Ols4npWjovIHknjYs1xQaZdce31u++tVJUcRS/lm+iNDyI68Llptbv01xB9odW7xOu4gR2C6Xr4HVsBHlZFsrh1CjrQ8lpEuUQcvKHUOa1OmdgmK3Vm+vqYDFi1A7X987Drs+cQQ72iPMJ11tqUMdaXX9Hy0M7XG84N7heGBg0oeVJb5Ch6FCl6E7ncNf2F6XoWnRsaXVdLoodrsucY10LnbKjPtRxXiNqfptrinemaxz0lTlnu/yN0LnDVeQ8z1UYkhoqxuxwDcISfCE2B4vt55STetKlwukFQdbgzzXebKw0TjQOM+YZc41uo8uYZkw1xpviTHZTjMliMptMJoNJZ+ImMsUHtYN+n/jtPt4g/0nDoJM/7kvezkn+e4D8yZ8zE6ezKNBHqeAVU0tYRWD3HKqYrQZOTPUEmXnyzIDeU8ICcRVUMa0kMNxXETRqUwIFvoqAcdK5lS2MXVuF1gBfH2Q0rTLINNG0LlV8f7mTGItdd02qKPuuu6aqipITLypKLoobHTtiTNkvQG0Yfd0pOYJPC9xcMbUy8GBaVSBPMFpaVUXgBvEF5072FTteXraTfSmKqsqdymj2VfkU0a6MLquqqgiyGVKOVPYl5OAxX0o5E17MQo5UU3pIbktILgvjIZcpCshFRVGWlMuKipJyOibkWhozy8taMjOlTJJKjVKmMUntKfNiFmSysqRMYhO9KGVeTGwSMoHRUsTphEi6U4qwFHJKESdLkSIzukUGhkU2nBLZIGdSWLeMMyRjPdglYz0IGV9vU32Jz8faRlXNqRZfDtd6yutBtYGrL2pIDjTNVtWWOVXhb429tbPnNIiyrj5Q5akvC8zxlKkto6p/obtadI/ylLXgvjitsqXaX1/WOso/qtxTV1bVNnbSkIKIuTacmmvIpF9QNkkoGyLmGlvwC90FonusmKtAzFUg5hrrHyvnIunjkypbTFRSVVodKtt4tBn+WpvqripJtC8dLZ13lDv58tQO3Fa2UbSvKmDxlASsINHVv7h/sejCmRJdMeIXgHBX8uWj3KkdbFu4y47mWE8J+VZc2HghJZfPLwv9NSKhacWFwuAh9DX+WkJfecBfV9a4Ap8SAjlTKwJFk2dWthiNaK0VWwqM7GqLji4PartDjQPQOFI0KsopQdFWKNqiosKCpz//C8NlqTgFTfyJNuZPZyuosUoJpFdM4wgF08JftXbgLiVeD41V2GAj87HGLh3hZft8FKqT2HMXrbgwzIVtsSJchkZiSGOXSU4lYSzfKYutgEIRuUj8kK8X/8dlxEfDWHdsFkD8C9NPqrL7J7+efiRVt1v8r9ftkJyp7yAbpTGHP051sVKTMy2dMx5rT7eRKSmodbZbLCXTwXzVHh0tmRP+DIsVnFeNYi6/1cqnR6l2O9BsswGTZUtQ+9qfbbEYpkeluNLsMWKo3WzFMLtF6LOrTH5qEOMIKtvFUMmI0WB+wLSS+bZdaAHznR/jwdWkj6pO9tlPhCxQU3gSWBiu1hwVRi0qPFkoaPCg0lX+YUqqEfFfjzeAzuBITknmhmizxWw1K4aExPjEPomKIVVJcrO4GECyyelmieZYN54P8/lykNaymvxYd15SYlJiXEI8j+GeLHfesIJhw4YO8WZ7Pe7b2fcPzby8akXjhEuuf2VdZwsbcf29g8vH37JowvbOl/UdCWlnz+7c+8z9nZ0P1OVtHza4/LP7Pvk2R3wy2kakWwfbR9Fd/jMM+nSTaZORGY2k6IT9yWS8TeVqNOcp0booLmwWJa0YZRbGj/q39vNHSwNaoqOl9Tq7zHi8y4xmYcYJ9q99XYYcLy05wX6iZvxhKhIGjBsxsKbQLgwJEyS4JW1TPvjpYx44OUnfsb1z5PaT54f9SHcSe7FSMh33p9fHLoznFfaK+HPt58broi3ptpgYSkoO7Suuy6fiunwKzHc7hG/EeU3CvWIFbzKLnZjsYv0m4U39xQZMKWoKw19KslXaxCptYpU2sf6v2uSH02zi6OlaXb41wb6sRjaND3lX2DLSwVgNhdwjncM53O5Y8Kc8g/fbPH7R5qovOl/oXM8uffL2mrMHX9G5Qd8RE1e/Y/ETnSdPPqywjWuqf59gFVeOQbBhB2xopP1+h0HuzijRYBR7NEpkQe17aTOs+nt/rOAMerF5o0R0/9guGHT/6I8VnJ6n6xThTga9LirIG9tUHdPhFvW4QWV8oMIU8I8xabmgdsQfLa1nCpvuq65TeKjLhj912ayzXZpMaDTtuLXngbR/LZzmcM0n9kJ7YchcMFR30IIfDRWexPt0pumaO1P11u3bf/gXvKhCO6JL142mBESj2/1JLnIm8OlKjb4manp0vbJQvySqPtqUENQOy6ljwfinCC7NKTA77h39D/EnUnSD40Y6BjuL48anFDsnx1U7pjjr4han1DlXGlYmnOAnku2UyGzWpKRJibWJS/FR3Wm7zn6HndvtulSn2Ugd/EFi2u52YQjYc7c/xm43TLczxm7q49RFIwAePy0khtw3yW8Nau9LS4H5Qq4SzD+kyaxCVVR2zpCAlVlTXKi1ZXmHiPLxdM+QQS7mSoR1/dVCUWK+3SSjZChummTczDT6M3OGuIxFuOsqRhlFjRbRY1Sjo/l0Y7J4VEanmN0YIzzc6BTzGhPFMoyO9CEFPY+7r8Ynz/thtC3z+U4s6+HgR0/WoKPoqDz+J5cVsti4ESPiRoS8HRJs2XKWZDB4MijWTvl5FBtvdCcm5ucNY27h+BkG5byO3C92ftZ5jMW//3cWw346Ym5dN2fjyXf5ZMvwGRtWP8BmJN3dzlxMYRbWt3N/5/d29dGOBnbTlaUN94mzUKQdUVrgCYOUFn+fJGmFZIkOiX0RD+QzyO5ivF1MVheT2cV4upiMLsbdxagirqwRnC4jPmNk1FlRZZkzMuozVkddG3VF5n19Hsp9WrFGJaUkJw2qyH0zSZ/Kp3Nuz2Pm5GpTdVS1uTq62lJtXWBaELXAvCB6gWWBtd3bnm3L9mZmZ/YbljnTXBU91zu37wrPisymzBvMt1k2970l96ZB95gfsNydfU/fNu+z3kS5F/GIMroYTxeT2cWE92vo2oKha1OGrm3iEAS1/f649BEzTdlZFrMuRfUm6KIHpKUE+YP+DEeucBGXo8gx0THL8ahjr8Ngc7gcSxwHHDqXY5ODO57C6U5AKJe+748X4nbmZ9zO9iFoMzvj4iy0xScOkWfCHhM7hLEB1WmL0niaM8GoE8sQg8B80i4OjGD8fWw2cM4B0S6E7EyHv0/ykDwxfKiIL47kEAqPdSQK73WoYqRDFaMcdrErh/Re0Ytn38HPJaP21Q4ZDjNzoOgx54h9OSxHzCnGgzkio75kxPgccfyECjBf7xBaclLkCtw4ibV5u/N4UV5THs8TxzuT5FLILgObGjI+l04idyS9xSXWpkovVDNtdrFlm1y7TRXCNvGW8Yol2GLE/DaLUGYziJltGQeIFdFERDrH4PBprFk2vutEirPns6NcPsFes8wXCqfLxJn8ujt2Hl2O44my6OgynE6c4mXLfYftJ2WBU4o/HNakEfLm48/un+7Rx+d6Y+1x9j52xZBhVVMpqq8xlen7A9LjUXXHeFIpw2O1mPqZU1nf7CizwadLJZc9LZXhEiRCeAhkAM/xrV27lk6tpmYZq1m+rKa7QQj1KZCxYOiQbG/2AD50iLgr5eclJiYZvSI2JMSLq5R8X4oQ4i1qtW24dPXKoVk3PHfrxOLhOddPveypmbEBS+P81QsSEwemXrHrlhnzn7ts7zvsDOfC5fVlZ3iSs/LOXDth7Kq+Lt+4S+clT6meUuBxpvUxZ+YXr66eufWch0UEydS+4jn6WymJuXaSJXzjiO66epi6GGMXY+hizMLNPd4hUcJLpoJpcjBiFquZKZRoj/LZzIZEpxJts2dQBrPGydgcJ/0hzixvNVkWphlN5VHltcalxibjdUYdGVXjHcaAcbdxn9FgFG8G8W4xCr8SnmIUL5KYGMl8J11OMjKci0uK8D2juKREC98zGmRUFw4uA3sHX0DJbFjL+T0uLuLJfH3YfjR8Nz78NV7DR8V7OBZhPDY/3/6CiOVh0awk8Ri8Q2M9Q/NjC2LzEzyx8eIJcnvK2YWzF+VecUXbY4/18fVNv3OrfXT9XXzORmZc1HnNxpM3jM8N/TymkMJE0isKwgSjZP3n0bvpO5NGJjJpnbjhRmknyUxm+X/Q0UALHslJ3BatwBiJNooB2skGjAX+RHEUC+xDccB46gNMAP5IiRQPTKIEYDLwB3JQEvgUcoBPpRSgU2IapQLTyal9Ty6JKqUB3eQCZpAK9AC/o0xyA7MoA+gFfkvZ5AH2hR99S/3IC8yR6KNs7QTlUl9gf4kDKAc4kHzAQdQfOBj4DeXRAGA+DQQOoUHa1zRU4jAaDCygfOBwGqL9i0ZIHElDgaMkFtIw4BlUABxNw4FFNEL7ivw0ElhMo4AlVAgsBX5JZXQGsJxGA8fg7XmcxpIfOI6KgWdSCfAsiRVUCjybyoDjaYx2jCZInEhjgZNoHHAynal9QVMkTqWzgNNwNztK02k8cIbEc2gCsJImap9TFU0CzgQepXNpMvhqmgqsoWnA8yTOounaP6mWZgDr6BzgbOA/aA5VAefSTGA9nQs8n6q1z2iexAaqAc6n87QjtIBqwS+UuIjqgItpNtovoDnAJRKX0lztU1pG9cDlNA/YKHEFNWif0IU0H3gRLQBeDPyYVtJC4CpaDLyELgBeKnE1LQFeRkuBl9My7TCtkdhEjcC1tAL4O7pQE//fexHwConr6GLtEF1JK4FX0SrgeroEuIEu1T6kZloNvJouQ8tG4Id0DV0OvJbWADfRWuB1wIN0Pf0OuJl+D7yBrtAO0I0Sb6J1wJvpKuAttB69fwAeoFtpA3ALNWv76Y90NfA22gj8k8Tb6VrgVtoEvIOuA94J/IDuouuBd9Nm4D10A/BeulF7n+6jm7T36H66GbiNbgE+IPFB+gPwIboV+DD9Ebhd4iN0G/BR+hMwQLcDW4DvUittBbbRHcB2ukt7hx6ju7W3aYfEx+keYJDuBe6k+4AdEp+gbcAn6QHtLXqKHgT+WeIuegi4mx4G/oW2A5+mR4B76FHtTXqGAsBnqUX7Oz0n8a/UCnye2rQ36AVqB75IjwFfoh3Al+lx4Cv4GPMGvUo7gXsl7qMO4N/oSeBr9JT2Or0OfI3eoD8D/067gG/Sbu1v9JbEt+lp4Du0B/guPQN8T+L79CzwA3oOuJ/+qu2jAxIP0gvaXvqQXgQeopeAH0k8TC8DP6ZXgJ/Qq8BPaZ/2Kh2R+Bn9DfgPek17hf5JrwM/l3iU3gB+QW9qL9Mxegt4XOKX9DbwK3oH+C96F/i1xG/ofe0lOkEfAL+l/cDvgC/S93QA+AMdBP5IHwJ/kniSPtJeoE46DNToY+B/Yvr/fEz/8jce0//Z65j+2a/E9M9Oi+lHfiWmf3paTP+kFzH98KmYvjwipn/0KzH9IxnTPzotph+SMf1Qj5h+SMb0QzKmH+oR0z88LaYflDH9oIzpB3+DMf2d/0cx/Y3/xPT/xPTfXEz/rd/Tf7sx/dfu6f+J6f+J6b8c05//7cf0/wK993M1CmVuZHN0cmVhbQplbmRvYmoKOSAwIG9iago8PC9UeXBlIC9Gb250RGVzY3JpcHRvcgovRm9udE5hbWUgL0FBQUFBQStBcmlhbE1UCi9GbGFncyA0Ci9Bc2NlbnQgOTA1LjI3MzQ0Ci9EZXNjZW50IC0yMTEuOTE0MDYKL1N0ZW1WIDQ1Ljg5ODQzOAovQ2FwSGVpZ2h0IDcxNS44MjAzMQovSXRhbGljQW5nbGUgMAovRm9udEJCb3ggWy02NjQuNTUwNzggLTMyNC43MDcwMyAyMDAwIDEwMDUuODU5MzhdCi9Gb250RmlsZTIgOCAwIFI+PgplbmRvYmoKMTAgMCBvYmoKPDwvVHlwZSAvRm9udAovRm9udERlc2NyaXB0b3IgOSAwIFIKL0Jhc2VGb250IC9BQUFBQUErQXJpYWxNVAovU3VidHlwZSAvQ0lERm9udFR5cGUyCi9DSURUb0dJRE1hcCAvSWRlbnRpdHkKL0NJRFN5c3RlbUluZm8gPDwvUmVnaXN0cnkgKEFkb2JlKQovT3JkZXJpbmcgKElkZW50aXR5KQovU3VwcGxlbWVudCAwPj4KL1cgWzAgWzc1MF0gMzkgWzcyMi4xNjc5NyAwIDYxMC44Mzk4NF0gNTEgWzY2Ni45OTIxOSAwIDAgMCA2MTAuODM5ODRdIDcyIFs1NTYuMTUyMzRdIDg3IFsyNzcuODMyMDNdXQovRFcgNTAwPj4KZW5kb2JqCjExIDAgb2JqCjw8L0ZpbHRlciAvRmxhdGVEZWNvZGUKL0xlbmd0aCAyNjU+PiBzdHJlYW0KeJxdkctqxDAMRff+Ci2niyHvTAdCoEwpZNEHTfsBjq2khsY2jrPI39ePNIUKbDjoXlmSk1v32ElhIXkzivVoYRSSG1zUahjCgJOQJMuBC2Z3CjebqSaJM/fbYnHu5KhI0wAk7y67WLPB6YGrAe9I8mo4GiEnOH3eesf9qvU3zigtpKRtgePoKj1T/UJnhCTYzh13eWG3s/P8KT42jZAHzmI3THFcNGVoqJyQNKmLFponFy1Byf/lq+gaRvZFjVfnF6dO07JsA10j1YGKIlCVRorKKirL+0B1FV7Z62W/1Y9mqjqaovdS7OqY9+35NR6zs9UYN3bYdZjXTyokHt+hlfYuf34A/WeHbwplbmRzdHJlYW0KZW5kb2JqCjQgMCBvYmoKPDwvVHlwZSAvRm9udAovU3VidHlwZSAvVHlwZTAKL0Jhc2VGb250IC9BQUFBQUErQXJpYWxNVAovRW5jb2RpbmcgL0lkZW50aXR5LUgKL0Rlc2NlbmRhbnRGb250cyBbMTAgMCBSXQovVG9Vbmljb2RlIDExIDAgUj4+CmVuZG9iagp4cmVmCjAgMTIKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDE1IDAwMDAwIG4gCjAwMDAwMDA0MTYgMDAwMDAgbiAKMDAwMDAwMDEwOCAwMDAwMCBuIAowMDAwMDEwNDk1IDAwMDAwIG4gCjAwMDAwMDAxNDUgMDAwMDAgbiAKMDAwMDAwMDYyNCAwMDAwMCBuIAowMDAwMDAwNjc5IDAwMDAwIG4gCjAwMDAwMDA3OTYgMDAwMDAgbiAKMDAwMDAwOTYxOCAwMDAwMCBuIAowMDAwMDA5ODUyIDAwMDAwIG4gCjAwMDAwMTAxNTkgMDAwMDAgbiAKdHJhaWxlcgo8PC9TaXplIDEyCi9Sb290IDcgMCBSCi9JbmZvIDEgMCBSPj4Kc3RhcnR4cmVmCjEwNjM0CiUlRU9GCg==";function zCe(e){let[a,n]=c(null);l((()=>{if("html"!=e.previewState)if("pdf"!=e.previewState){var t=new URLSearchParams({ReportID:e.reportId}).toString();w.invokeCustomApi("HealthAndWellnessApi.DownloadReport","GET",t,!0).then((function(e){n(e)}))}else n({Type:"ResearchKitConsentDocument",Summary:no("summary"),Content:jCe,ContentType:"application/pdf"});else n({Type:no("subsequent-evaluation-note"),Summary:no("summary"),Content:NCe,ContentType:"text/html"})}),[]);let i="";return a&&(i=a.Type,a.Summary&&(i+=" • "+a.Summary)),t.createElement(Ka,{className:"mdhui-report-view",colorScheme:e.colorScheme},t.createElement(XAe,{subtitle:i,variant:"compressedModal",showCloseButton:!0}),!a&&t.createElement(XA,null),a&&t.createElement(ICe,{type:a.Type,content:a.Content,contentType:a.ContentType}))}function RCe(e){return t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},t.createElement(XAe,{variant:"compressed",showCloseButton:!0},t.createElement(sM,{order:1},e.title)),t.createElement(iSe,{previewState:e.previewState,resources:e.resources,onViewResource:t=>{e.previewState||w.openEmbeddedUrl(t.url)},emptyText:e.emptyText,imageAlignment:e.resourceImageAlignment,buttonVariant:e.resourceButtonVariant,buttonText:e.resourceButtonText}))}function LCe(e){return t.createElement(Ka,{colorScheme:e.colorScheme},t.createElement(XAe,{showBackButton:"Push"==e.presentation,showCloseButton:"Modal"==e.presentation}),t.createElement(qAe,{previewState:e.previewState,term:e.term,labObservationID:e.labObservationID,openLinksInNewWindow:e.openLinksInNewWindow}))}function FCe(e){let[a,n]=t.useState([{key:"Dashboard"}]);function i(e){n([...a,e])}function r(e){i({key:"TermInformation",properties:{term:{TermFamily:e.TermFamily,TermNamespace:e.TermNamespace,TermCode:e.TermCode}}})}function o(){i({key:"ExternalAccounts"})}function s(){n(a.slice(0,a.length-1)),2==a.length&&w.triggerEvent({type:"applicationDidBecomeVisible"})}function l(a){return t.createElement(kge,{concept:a,onClick:()=>function(e){i("Reports"==e||"Immunizations"==e||"Procedures"==e?{key:"NewsFeed",properties:{feed:e}}:{key:e})}(a),previewState:"default"==e.previewState?"Default":void 0})}function c(s){if("Dashboard"==s.key)return t.createElement(Ka,{colorScheme:e.colorScheme??"auto"},t.createElement(bde,{previewState:"default"==e.previewState?"externalAccountsLoaded":void 0,externalAccountCategories:["Provider","Health Plan"],triggerWebExternalAccountSyncComplete:!0}),t.createElement(oSe,{noTopMargin:!0},t.createElement(gde,{previewState:"default"==e.previewState?"externalAccountWithIssue":void 0,externalAccountCategories:["Provider","Health Plan"],onClick:()=>o()}),t.createElement(xde,{excludeDeviceManufacturers:!0,onClick:()=>o(),previewState:"default"==e.previewState?"Default":void 0}),t.createElement(Yge,{onViewTermInfo:e=>r(e),onClick:()=>{i({key:"NewsFeed",properties:{feed:"LabReports"}})},previewState:"default"==e.previewState?"ImportantLabs":void 0}),t.createElement($ge,{previewState:"default"==e.previewState?"BloodTypeLabs":void 0,onClick:()=>function(){let e="https://medlineplus.gov/ency/article/003345.htm";w.getCurrentLanguage().toLowerCase().startsWith("es")&&(e="https://medlineplus.gov/spanish/ency/article/003345.htm"),window.open(e,"_blank")}()}),l("Medications"),l("Immunizations"),l("Reports"),l("Allergies"),l("Conditions"),l("Procedures")),t.createElement(aS,null,t.createElement(NU,{previewState:"default"==e.previewState?"enabled":void 0,variant:"small",hideWhenConnected:!0,onClick:()=>i({key:"ConnectEhr"})})));if("NewsFeed"==s.key)return t.createElement(fCe,{feed:s.properties?.feed,previewState:e.previewState,presentation:"Push",colorScheme:e.colorScheme,onEventSelected:e=>{n([...a,{key:"NewsFeedEventDetail",properties:{eventReference:e}}])},onReportSelected:e=>{i({key:"ReportDetail",properties:{reportID:e}})}});if("NewsFeedEventDetail"==s.key){let a,n=s.properties?.eventReference,r=n.feed;return e.previewState&&("Procedures"==r&&(a="ProcedureGroup"),"LabReports"==r&&(a="LabReport")),t.createElement(yCe,{feed:n.feed,presentation:"Push",pageDate:n.pageDate,pageId:n.pageId,onViewLabObservationTermInfo:e=>{i({key:"TermInformation",properties:{labObservationID:e}})},previewState:a})}return"TermInformation"==s.key?t.createElement(LCe,{presentation:"Modal",openLinksInNewWindow:!0,previewState:e.previewState,term:s.properties?.term,labObservationID:s.properties?.labObservationID}):"Medications"==s.key?t.createElement(SCe,{presentation:"Push",previewState:e.previewState,onViewTermInfo:e=>r(e)}):"Conditions"==s.key?t.createElement(sCe,{presentation:"Push",previewState:e.previewState,onViewTermInfo:e=>r(e)}):"Allergies"==s.key?t.createElement(rCe,{presentation:"Push",previewState:e.previewState,onViewTermInfo:e=>r(e)}):"ReportDetail"==s.key?t.createElement(zCe,{previewState:"default"==e.previewState?"html":void 0,reportId:s.properties?.reportId}):"ExternalAccounts"==s.key?t.createElement(vCe,{presentation:"Push",excludeDeviceManufacturers:!0,colorScheme:e.colorScheme,previewState:e.previewState,connectExternalAccountOptions:e.connectExternalAccountOptions}):"ConnectEhr"==s.key?t.createElement(Ka,{colorScheme:e.colorScheme},t.createElement(XAe,{showBackButton:!0}),t.createElement(oSe,null,t.createElement(AAe,{providerCategories:["Provider","Health Plan"],connectExternalAccountOptions:e.connectExternalAccountOptions}))):void 0}return w.back=s,w.dismiss=s,t.createElement(t.Fragment,null,a.map(((e,n)=>t.createElement("div",{key:e.key,style:{display:n!=a.length-1?"none":void 0}},c(e)))))}A(".mdhui-report-view {\n height: calc(100dvh - 8px);\n display: flex;\n flex-direction: column;\n}\n\n.mdhui-report-view .mdhui-report-content {\n flex-grow: 1;\n}");export{qq as AIAssistant,Za as Action,Ya as ActivityMeter,Vq as AllergiesList,rCe as AllergiesView,Zq as AppDownload,Qq as AppleHealthRecordsSync,pEe as AsthmaActionPlanManager,FEe as AsthmaActionPlanView,BEe as AsthmaActivityView,fEe as AsthmaAirQualities,HEe as AsthmaAirQualityView,yEe as AsthmaAlertTakeoverNotice,vEe as AsthmaAlertTakeoverTrigger,qEe as AsthmaAlertTakeoverView,wEe as AsthmaBiometrics,AEe as AsthmaControlCalendar,CEe as AsthmaControlStatusHeader,$Se as AsthmaDailyDataType,UEe as AsthmaDayView,VEe as AsthmaHeartAndLungsView,OEe as AsthmaLogEntryDetails,GEe as AsthmaLogEntryEditorView,NEe as AsthmaLogEntryHeader,ESe as AsthmaParticipant,jEe as AsthmaPostEnrollmentSurveyTrigger,REe as AsthmaProviderReport,KEe as AsthmaProviderReportView,LEe as AsthmaRecommendedArticle,ZEe as AsthmaSleepView,ZA as BasicBadge,tU as BasicBadges,eU as BasicPointsForBadges,oCe as BlankView,YA as BloodPressureReading,iU as BloodPressureVisualization,QA as Button,JA as Calendar,eS as CalendarDay,aS as Card,nS as CardTitle,g_e as CelebrationStep,f_e as CelebrationStepContainer,nM as Chat,rU as ConditionsList,sCe as ConditionsView,y_e as ConnectDeviceAccountStep,v_e as ConnectDeviceAccountStepContainer,EU as ConnectDevicesMenu,lCe as ConnectDevicesView,DU as ConnectDexcom,NU as ConnectEhr,b_e as ConnectEhrStep,w_e as ConnectEhrStepContainer,cCe as ConnectEhrView,jU as ConnectFitbit,zU as ConnectGarmin,RU as ConnectOura,EA as CustomFieldIntegerValueProvider,Lue as DailyDataChart,Fue as DailyDataGoal,Hr as DailyDataType,rM as DateRangeContext,oM as DateRangeCoordinator,iM as DateRangeNavigator,cM as DateRangeTitle,uM as DayTrackerSymbol,_A as DaysWithDataValueProvider,uCe as DeviceActivityView,Hue as DeviceDataMonthChart,que as DeviceDataMonthCharts,dCe as DeviceDataView,dM as DiscreteScale,hM as Divider,hCe as DocumentDetailView,Uue as DocumentLibraryPreview,pCe as DocumentLibraryView,gM as DumbbellChart,sde as EhrNewsFeed,cde as EhrNewsFeedEventDetail,yCe as EhrNewsFeedEventDetailView,fCe as EhrNewsFeedView,gde as ExternalAccountConnectionAlert,yde as ExternalAccountList,bde as ExternalAccountsLoadingIndicator,xde as ExternalAccountsPreview,vCe as ExternalAccountsView,xM as Face,Cde as FitbitDevices,Pde as FitbitMonthCharts,bCe as FitbitView,Mde as GarminDevices,Dde as GarminMonthCharts,wCe as GarminView,Ide as GlucoseChart,jde as GlucoseContext,zde as GlucoseDayCoordinator,kM as GlucoseStats,yge as Goal,EM as Grid,kCe as HealthAndWellnessView,vge as HealthConnectPhrSync,kge as HealthPreviewSection,_M as Histogram,xCe as HomeView,xSe as InboxCompletedListItem,DCe as InboxHistoryView,Pge as InboxItemList,Ege as InboxItemListCoordinator,kSe as InboxMessageListItem,_ge as InboxMessageView,ASe as InboxResourceListItem,SSe as InboxSurveyListItem,OCe as InboxView,Ige as InsightMatrix,Hge as IntradayHeartRateChart,$ge as LabResultsBloodType,Yge as LabResultsSummary,Qge as LatestBloodPressureReading,Ka as Layout,Ga as LayoutContext,XA as LoadingIndicator,$Ae as MealButtons,efe as MealContext,tfe as MealCoordinator,ife as MealEditor,ACe as MealEditorView,ZAe as MealLog,rfe as MedicationsList,SCe as MedicationsView,lfe as MicroTrend,YAe as MonthlyEventMatrix,dfe as MostRecentNotification,xA as MyDataHelpsTools,XAe as NavigationBar,CCe as NewBadgeView,TCe as NewPointsView,HA as NotEnteredThreshold,QAe as NotesInput,mfe as NotificationList,ECe as NotificationsView,yAe as PdfPreview,Wq as PlatformSpecificContent,JAe as ProgressBar,eSe as ProgressBarStep,tSe as ProgressRing,vAe as ProjectHeader,bAe as ProjectSupport,AAe as ProviderSearch,SA as RandomIntegerValueProvider,SAe as RecentDailyDataBarChart,TAe as RelativeActivity,_Ae as RelativeActivityDayCoordinator,PAe as RelativeActivityToday,zCe as ReportView,aSe as Resource,iSe as ResourceList,RCe as ResourceListView,OAe as RestingHeartRateCalendar,rSe as RotatingComponentCoordinator,oSe as Section,sSe as SegmentedControl,FAe as SeverityCalendar,tS as ShinyOverlay,lSe as SingleDataPoint,cSe as SingleExternalAccount,uSe as SingleNotification,hSe as SingleSurveyTask,kA as SingleValueProvider,mSe as SparkBarChart,pSe as SparkRangeChart,FCe as StandaloneHealthAndWellnessView,AA as StaticIntegerValueProvider,fSe as StatusBarBackground,t_e as StepDetailText,p_e as StepImage,m_e as StepImageIcon,YEe as StepLayout,QEe as StepMarkdown,a_e as StepNextButton,e_e as StepText,JEe as StepTitle,BAe as StressLevel,DAe as SurveyAnswerChart,jAe as SurveyTaskList,_Ce as SurveyTasksView,gSe as Switch,j_e as SymptomSharkCalendar,J_e as SymptomSharkCalendarView,L_e as SymptomSharkLogEntry,X_e as SymptomSharkLogEntryEdit,tCe as SymptomSharkLogEntryEditView,Z_e as SymptomSharkLogEntryList,Y_e as SymptomSharkLogToday,V_e as SymptomSharkMonthReport,q_e as SymptomSharkNotesTimeline,R_e as SymptomSharkOverallExperienceChart,Q_e as SymptomSharkReportBuilder,aCe as SymptomSharkReportBuilderView,nCe as SymptomSharkSymptomDetailView,N_e as SymptomSharkSymptomMatrix,U_e as SymptomSharkSymptomSeverityChart,$_e as SymptomSharkSymptomSeveritySummary,__e as SymptomSharkSymptomTreatmentFilters,W_e as SymptomSharkSymptomTreatmentHistograms,I_e as SymptomSharkVisualizationCoordinator,qAe as TermInformation,LCe as TermInformationView,$q as TextBlock,Rue as TimeSeriesChart,sM as Title,ySe as TrackerItem,S as UnstyledButton,vSe as ValueSelector,UAe as ViewDeviceActivity,VAe as ViewEhr,bSe as ViewHeader,wSe as WeekCalendar,WAe as WeeklyDayNavigator,x_e as YouTubeStep,k_e as YouTubeStepContainer,dEe as asthmaDataService,sd as awardPointsAndBadges,du as bloodPressureDataProvider,kl as capitalizeFirstLetterForLocale,hEe as caregiverVariableLanguage,Jc as checkDailyDataAvailability,gd as combinedIntradayHeartRateDataProvider,CSe as computeAsthmaControlState,vd as computeBestFitGlucoseValue,bd as computeGlucoseReadingRanges,wd as computeGlucoseReadingRecentAverage,qA as computeThresholdDays,A_e as convertToSymptomSharkConfiguration,VA as createAllLibraryDocumentsLoader,pd as createAreaChartDefs,md as createBarChartDefs,PA as createCustomFieldIntegerValueProvider,OA as createDaysWithDataValueProvider,BA as createIntegerInsightMatrixValueFormatter,$A as createLibraryDocumentSorter,hd as createLineChartDefs,RA as createMinMaxInsightMatrixValueEvaluator,FA as createMinutesToHoursInsightMatrixValueFormatter,jA as createNonZeroAverageValueInsightMatrixValueCalculator,zA as createPercentageOfDaysInsightMatrixValueCalculator,TA as createRandomIntegerValueProvider,LA as createShrinkThousandsInsightMatrixValueFormatter,WA as createSingleLibraryDocumentLoader,CA as createStaticIntegerValueProvider,xd as createThumbnailIfNecessary,Gc as dailyDataTypeDefinitions,_Se as dateToAsthmaLogEntryIdentifier,zd as deleteStressLevel,bl as formatDateForLocale,GA as formatLibraryDocumentDateAndType,xl as formatMinutesForLocale,wl as formatNumberForLocale,Pd as generateGlucose,MA as generateSampleData,Md as generateSleep,Od as generateSteps,su as get6MonthStart,au as getAllDailyDataTypes,LSe as getAsthmaAirQualityDescriptionText,PSe as getAsthmaDataStatusColor,TSe as getAsthmaDataStatusText,NSe as getAsthmaImpactTexts,jSe as getAsthmaImpacts,MSe as getAsthmaSymptomLevel,OSe as getAsthmaSymptomLevelText,DSe as getAsthmaSymptomTexts,ISe as getAsthmaSymptoms,zSe as getAsthmaTriggerTexts,RSe as getAsthmaTriggers,Re as getColorFromAssortment,ro as getCountryCodeFromIso,nu as getDailyDataTypeDefinition,vl as getDateLocale,Br as getDayKey,lu as getDefaultIntervalStart,yd as getGlucoseReadings,yl as getIntlLocale,io as getLanguageCodeFromIso,Cd as getMealImageUrls,Ed as getMealToEdit,Ld as getMealTypeDisplayText,kd as getMeals,ou as getMonthStart,Dd as getSleepMinutes,Id as getSteps,Nd as getStressLevel,NA as getSurveyDataProvider,ru as getWeekStart,VSe as isBloodOxygenLevelWithinRange,FSe as isDaytimeRestingHeartRateWithinRange,BSe as isNighttimeRestingHeartRateWithinRange,HSe as isRespiratoryRateWithinRange,USe as isSleepDisturbancesWithinRange,qSe as isStepsWithinRange,IA as isSurveyDataType,no as language,Kc as predictableRandomNumber,Sd as prepareMealForEditing,eu as queryDailyData,tu as queryPreviewDailyData,rd as queryRelativeActivity,Yc as registerDailyDataProvider,Xc as registerDailyDataTypeDefinition,je as resolveColor,Ad as saveMeals,jd as saveStressLevel,PCe as showNewPoints,Oc as simpleAvailabilityCheck,dd as standardDailyDataTypes,ld as sumActivityPoints,ao as supportedLocales,fd as timestampSortAsc,UA as tryParseRegex,_d as uploadMealImageFile,id as useInitializeView,Xq as useInterval};
|
|
215
215
|
//# sourceMappingURL=index.js.map
|