@llamaindex/workflow-debugger 0.2.33 → 0.2.34
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/app.css +1 -1
- package/dist/app.js +12 -12
- package/package.json +4 -4
package/dist/app.js
CHANGED
|
@@ -284,16 +284,16 @@ Completed after ${f} checks`),h;if(n(h)){const b=r(h);throw new kve(b)}const E=(
|
|
|
284
284
|
*
|
|
285
285
|
* @license MIT
|
|
286
286
|
*/var Kq=N.createContext(null);function sye({children:t,clients:e,project:n}){const r=N.useMemo(()=>({clients:e,project:n}),[e,n]);return A.jsx(Kq.Provider,{value:r,children:t})}function lye(){const t=N.useContext(Kq);if(!t)throw new Error("useApiContext must be used within an ApiProvider. Please wrap your component tree with <ApiProvider>.");return t}function pd(){const{clients:t}=lye();if(!t.workflowsClient)throw new Error("No workflows client configured. Please ensure workflowsClient is configured in ApiProvider.");return t.workflowsClient}var cye=t=>{switch(t){case"success":return pye;case"info":return mye;case"warning":return fye;case"error":return hye;default:return null}},uye=Array(12).fill(0),dye=({visible:t,className:e})=>Oe.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},Oe.createElement("div",{className:"sonner-spinner"},uye.map((n,r)=>Oe.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),pye=Oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Oe.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),fye=Oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},Oe.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),mye=Oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Oe.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),hye=Oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Oe.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),gye=Oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},Oe.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Oe.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),_ye=()=>{let[t,e]=Oe.useState(document.hidden);return Oe.useEffect(()=>{let n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t},Wx=1,bye=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let e=this.subscribers.indexOf(t);this.subscribers.splice(e,1)}),this.publish=t=>{this.subscribers.forEach(e=>e(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var e;let{message:n,...r}=t,a=typeof(t==null?void 0:t.id)=="number"||((e=t.id)==null?void 0:e.length)>0?t.id:Wx++,i=this.toasts.find(s=>s.id===a),o=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),i?this.toasts=this.toasts.map(s=>s.id===a?(this.publish({...s,...t,id:a,title:n}),{...s,...t,id:a,dismissible:o,title:n}):s):this.addToast({title:n,...r,dismissible:o,id:a}),a},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(e=>{this.subscribers.forEach(n=>n({id:e.id,dismiss:!0}))}),this.subscribers.forEach(e=>e({id:t,dismiss:!0})),t),this.message=(t,e)=>this.create({...e,message:t}),this.error=(t,e)=>this.create({...e,message:t,type:"error"}),this.success=(t,e)=>this.create({...e,type:"success",message:t}),this.info=(t,e)=>this.create({...e,type:"info",message:t}),this.warning=(t,e)=>this.create({...e,type:"warning",message:t}),this.loading=(t,e)=>this.create({...e,type:"loading",message:t}),this.promise=(t,e)=>{if(!e)return;let n;e.loading!==void 0&&(n=this.create({...e,promise:t,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));let r=t instanceof Promise?t:t(),a=n!==void 0,i,o=r.then(async l=>{if(i=["resolve",l],Oe.isValidElement(l))a=!1,this.create({id:n,type:"default",message:l});else if(Sye(l)&&!l.ok){a=!1;let u=typeof e.error=="function"?await e.error(`HTTP error! status: ${l.status}`):e.error,d=typeof e.description=="function"?await e.description(`HTTP error! status: ${l.status}`):e.description;this.create({id:n,type:"error",message:u,description:d})}else if(e.success!==void 0){a=!1;let u=typeof e.success=="function"?await e.success(l):e.success,d=typeof e.description=="function"?await e.description(l):e.description;this.create({id:n,type:"success",message:u,description:d})}}).catch(async l=>{if(i=["reject",l],e.error!==void 0){a=!1;let u=typeof e.error=="function"?await e.error(l):e.error,d=typeof e.description=="function"?await e.description(l):e.description;this.create({id:n,type:"error",message:u,description:d})}}).finally(()=>{var l;a&&(this.dismiss(n),n=void 0),(l=e.finally)==null||l.call(e)}),s=()=>new Promise((l,u)=>o.then(()=>i[0]==="reject"?u(i[1]):l(i[1])).catch(u));return typeof n!="string"&&typeof n!="number"?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(t,e)=>{let n=(e==null?void 0:e.id)||Wx++;return this.create({jsx:t(n),id:n,...e}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Ii=new bye,Eye=(t,e)=>{let n=(e==null?void 0:e.id)||Wx++;return Ii.addToast({title:t,...e,id:n}),n},Sye=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",vye=Eye,yye=()=>Ii.toasts,Tye=()=>Ii.getActiveToasts();Object.assign(vye,{success:Ii.success,info:Ii.info,warning:Ii.warning,error:Ii.error,custom:Ii.custom,message:Ii.message,promise:Ii.promise,dismiss:Ii.dismiss,loading:Ii.loading},{getHistory:yye,getToasts:Tye});function Cye(t,{insertAt:e}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",e==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}Cye(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
|
|
287
|
-
`);function UT(t){return t.label!==void 0}var Aye=3,Rye="32px",wye="16px",Xq=4e3,xye=356,Nye=14,Oye=20,Iye=200;function Gs(...t){return t.filter(Boolean).join(" ")}function Dye(t){let[e,n]=t.split("-"),r=[];return e&&r.push(e),n&&r.push(n),r}var kye=t=>{var e,n,r,a,i,o,s,l,u,d,f;let{invert:m,toast:h,unstyled:E,interacting:b,setHeights:v,visibleToasts:y,heights:C,index:T,toasts:w,expanded:O,removeToast:x,defaultRichColors:D,closeButton:M,style:F,cancelButtonStyle:P,actionButtonStyle:q,className:j="",descriptionClassName:Q="",duration:U,position:K,gap:G,loadingIcon:Y,expandByDefault:W,classNames:J,icons:$,closeButtonAriaLabel:Z="Close toast",pauseWhenPageIsHidden:te}=t,[B,ae]=Oe.useState(null),[se,de]=Oe.useState(null),[ie,ce]=Oe.useState(!1),[me,be]=Oe.useState(!1),[Ae,we]=Oe.useState(!1),[Te,De]=Oe.useState(!1),[We,Ye]=Oe.useState(!1),[Tt,_t]=Oe.useState(0),[Jt,Ge]=Oe.useState(0),Ve=Oe.useRef(h.duration||U||Xq),Xe=Oe.useRef(null),mt=Oe.useRef(null),yt=T===0,Dt=T+1<=y,ge=h.type,xe=h.dismissible!==!1,He=h.className||"",ot=h.descriptionClassName||"",Ct=Oe.useMemo(()=>C.findIndex(Ee=>Ee.toastId===h.id)||0,[C,h.id]),pr=Oe.useMemo(()=>{var Ee;return(Ee=h.closeButton)!=null?Ee:M},[h.closeButton,M]),Yn=Oe.useMemo(()=>h.duration||U||Xq,[h.duration,U]),Tn=Oe.useRef(0),zt=Oe.useRef(0),hn=Oe.useRef(0),Bt=Oe.useRef(null),[Mr,ir]=K.split("-"),Lr=Oe.useMemo(()=>C.reduce((Ee,Me,Je)=>Je>=Ct?Ee:Ee+Me.height,0),[C,Ct]),Et=_ye(),Hr=h.invert||m,$r=ge==="loading";zt.current=Oe.useMemo(()=>Ct*G+Lr,[Ct,Lr]),Oe.useEffect(()=>{Ve.current=Yn},[Yn]),Oe.useEffect(()=>{ce(!0)},[]),Oe.useEffect(()=>{let Ee=mt.current;if(Ee){let Me=Ee.getBoundingClientRect().height;return Ge(Me),v(Je=>[{toastId:h.id,height:Me,position:h.position},...Je]),()=>v(Je=>Je.filter(en=>en.toastId!==h.id))}},[v,h.id]),Oe.useLayoutEffect(()=>{if(!ie)return;let Ee=mt.current,Me=Ee.style.height;Ee.style.height="auto";let Je=Ee.getBoundingClientRect().height;Ee.style.height=Me,Ge(Je),v(en=>en.find(qt=>qt.toastId===h.id)?en.map(qt=>qt.toastId===h.id?{...qt,height:Je}:qt):[{toastId:h.id,height:Je,position:h.position},...en])},[ie,h.title,h.description,v,h.id]);let Nn=Oe.useCallback(()=>{be(!0),_t(zt.current),v(Ee=>Ee.filter(Me=>Me.toastId!==h.id)),setTimeout(()=>{x(h)},Iye)},[h,x,v,zt]);Oe.useEffect(()=>{if(h.promise&&ge==="loading"||h.duration===1/0||h.type==="loading")return;let Ee;return O||b||te&&Et?(()=>{if(hn.current<Tn.current){let Me=new Date().getTime()-Tn.current;Ve.current=Ve.current-Me}hn.current=new Date().getTime()})():Ve.current!==1/0&&(Tn.current=new Date().getTime(),Ee=setTimeout(()=>{var Me;(Me=h.onAutoClose)==null||Me.call(h,h),Nn()},Ve.current)),()=>clearTimeout(Ee)},[O,b,h,ge,te,Et,Nn]),Oe.useEffect(()=>{h.delete&&Nn()},[Nn,h.delete]);function ue(){var Ee,Me,Je;return $!=null&&$.loading?Oe.createElement("div",{className:Gs(J==null?void 0:J.loader,(Ee=h==null?void 0:h.classNames)==null?void 0:Ee.loader,"sonner-loader"),"data-visible":ge==="loading"},$.loading):Y?Oe.createElement("div",{className:Gs(J==null?void 0:J.loader,(Me=h==null?void 0:h.classNames)==null?void 0:Me.loader,"sonner-loader"),"data-visible":ge==="loading"},Y):Oe.createElement(dye,{className:Gs(J==null?void 0:J.loader,(Je=h==null?void 0:h.classNames)==null?void 0:Je.loader),visible:ge==="loading"})}return Oe.createElement("li",{tabIndex:0,ref:mt,className:Gs(j,He,J==null?void 0:J.toast,(e=h==null?void 0:h.classNames)==null?void 0:e.toast,J==null?void 0:J.default,J==null?void 0:J[ge],(n=h==null?void 0:h.classNames)==null?void 0:n[ge]),"data-sonner-toast":"","data-rich-colors":(r=h.richColors)!=null?r:D,"data-styled":!(h.jsx||h.unstyled||E),"data-mounted":ie,"data-promise":!!h.promise,"data-swiped":We,"data-removed":me,"data-visible":Dt,"data-y-position":Mr,"data-x-position":ir,"data-index":T,"data-front":yt,"data-swiping":Ae,"data-dismissible":xe,"data-type":ge,"data-invert":Hr,"data-swipe-out":Te,"data-swipe-direction":se,"data-expanded":!!(O||W&&ie),style:{"--index":T,"--toasts-before":T,"--z-index":w.length-T,"--offset":`${me?Tt:zt.current}px`,"--initial-height":W?"auto":`${Jt}px`,...F,...h.style},onDragEnd:()=>{we(!1),ae(null),Bt.current=null},onPointerDown:Ee=>{$r||!xe||(Xe.current=new Date,_t(zt.current),Ee.target.setPointerCapture(Ee.pointerId),Ee.target.tagName!=="BUTTON"&&(we(!0),Bt.current={x:Ee.clientX,y:Ee.clientY}))},onPointerUp:()=>{var Ee,Me,Je,en;if(Te||!xe)return;Bt.current=null;let qt=Number(((Ee=mt.current)==null?void 0:Ee.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),et=Number(((Me=mt.current)==null?void 0:Me.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Qe=new Date().getTime()-((Je=Xe.current)==null?void 0:Je.getTime()),pt=B==="x"?qt:et,Sn=Math.abs(pt)/Qe;if(Math.abs(pt)>=Oye||Sn>.11){_t(zt.current),(en=h.onDismiss)==null||en.call(h,h),de(B==="x"?qt>0?"right":"left":et>0?"down":"up"),Nn(),De(!0),Ye(!1);return}we(!1),ae(null)},onPointerMove:Ee=>{var Me,Je,en,qt;if(!Bt.current||!xe||((Me=window.getSelection())==null?void 0:Me.toString().length)>0)return;let et=Ee.clientY-Bt.current.y,Qe=Ee.clientX-Bt.current.x,pt=(Je=t.swipeDirections)!=null?Je:Dye(K);!B&&(Math.abs(Qe)>1||Math.abs(et)>1)&&ae(Math.abs(Qe)>Math.abs(et)?"x":"y");let Sn={x:0,y:0};B==="y"?(pt.includes("top")||pt.includes("bottom"))&&(pt.includes("top")&&et<0||pt.includes("bottom")&&et>0)&&(Sn.y=et):B==="x"&&(pt.includes("left")||pt.includes("right"))&&(pt.includes("left")&&Qe<0||pt.includes("right")&&Qe>0)&&(Sn.x=Qe),(Math.abs(Sn.x)>0||Math.abs(Sn.y)>0)&&Ye(!0),(en=mt.current)==null||en.style.setProperty("--swipe-amount-x",`${Sn.x}px`),(qt=mt.current)==null||qt.style.setProperty("--swipe-amount-y",`${Sn.y}px`)}},pr&&!h.jsx?Oe.createElement("button",{"aria-label":Z,"data-disabled":$r,"data-close-button":!0,onClick:$r||!xe?()=>{}:()=>{var Ee;Nn(),(Ee=h.onDismiss)==null||Ee.call(h,h)},className:Gs(J==null?void 0:J.closeButton,(a=h==null?void 0:h.classNames)==null?void 0:a.closeButton)},(i=$==null?void 0:$.close)!=null?i:gye):null,h.jsx||N.isValidElement(h.title)?h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title:Oe.createElement(Oe.Fragment,null,ge||h.icon||h.promise?Oe.createElement("div",{"data-icon":"",className:Gs(J==null?void 0:J.icon,(o=h==null?void 0:h.classNames)==null?void 0:o.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||ue():null,h.type!=="loading"?h.icon||($==null?void 0:$[ge])||cye(ge):null):null,Oe.createElement("div",{"data-content":"",className:Gs(J==null?void 0:J.content,(s=h==null?void 0:h.classNames)==null?void 0:s.content)},Oe.createElement("div",{"data-title":"",className:Gs(J==null?void 0:J.title,(l=h==null?void 0:h.classNames)==null?void 0:l.title)},typeof h.title=="function"?h.title():h.title),h.description?Oe.createElement("div",{"data-description":"",className:Gs(Q,ot,J==null?void 0:J.description,(u=h==null?void 0:h.classNames)==null?void 0:u.description)},typeof h.description=="function"?h.description():h.description):null),N.isValidElement(h.cancel)?h.cancel:h.cancel&&UT(h.cancel)?Oe.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||P,onClick:Ee=>{var Me,Je;UT(h.cancel)&&xe&&((Je=(Me=h.cancel).onClick)==null||Je.call(Me,Ee),Nn())},className:Gs(J==null?void 0:J.cancelButton,(d=h==null?void 0:h.classNames)==null?void 0:d.cancelButton)},h.cancel.label):null,N.isValidElement(h.action)?h.action:h.action&&UT(h.action)?Oe.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||q,onClick:Ee=>{var Me,Je;UT(h.action)&&((Je=(Me=h.action).onClick)==null||Je.call(Me,Ee),!Ee.defaultPrevented&&Nn())},className:Gs(J==null?void 0:J.actionButton,(f=h==null?void 0:h.classNames)==null?void 0:f.actionButton)},h.action.label):null))};function Qq(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function Mye(t,e){let n={};return[t,e].forEach((r,a)=>{let i=a===1,o=i?"--mobile-offset":"--offset",s=i?wye:Rye;function l(u){["top","right","bottom","left"].forEach(d=>{n[`${o}-${d}`]=typeof u=="number"?`${u}px`:u})}typeof r=="number"||typeof r=="string"?l(r):typeof r=="object"?["top","right","bottom","left"].forEach(u=>{r[u]===void 0?n[`${o}-${u}`]=s:n[`${o}-${u}`]=typeof r[u]=="number"?`${r[u]}px`:r[u]}):l(s)}),n}N.forwardRef(function(t,e){let{invert:n,position:r="bottom-right",hotkey:a=["altKey","KeyT"],expand:i,closeButton:o,className:s,offset:l,mobileOffset:u,theme:d="light",richColors:f,duration:m,style:h,visibleToasts:E=Aye,toastOptions:b,dir:v=Qq(),gap:y=Nye,loadingIcon:C,icons:T,containerAriaLabel:w="Notifications",pauseWhenPageIsHidden:O}=t,[x,D]=Oe.useState([]),M=Oe.useMemo(()=>Array.from(new Set([r].concat(x.filter(te=>te.position).map(te=>te.position)))),[x,r]),[F,P]=Oe.useState([]),[q,j]=Oe.useState(!1),[Q,U]=Oe.useState(!1),[K,G]=Oe.useState(d!=="system"?d:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Y=Oe.useRef(null),W=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),J=Oe.useRef(null),$=Oe.useRef(!1),Z=Oe.useCallback(te=>{D(B=>{var ae;return(ae=B.find(se=>se.id===te.id))!=null&&ae.delete||Ii.dismiss(te.id),B.filter(({id:se})=>se!==te.id)})},[]);return Oe.useEffect(()=>Ii.subscribe(te=>{if(te.dismiss){D(B=>B.map(ae=>ae.id===te.id?{...ae,delete:!0}:ae));return}setTimeout(()=>{H8.flushSync(()=>{D(B=>{let ae=B.findIndex(se=>se.id===te.id);return ae!==-1?[...B.slice(0,ae),{...B[ae],...te},...B.slice(ae+1)]:[te,...B]})})})}),[]),Oe.useEffect(()=>{if(d!=="system"){G(d);return}if(d==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?G("dark"):G("light")),typeof window>"u")return;let te=window.matchMedia("(prefers-color-scheme: dark)");try{te.addEventListener("change",({matches:B})=>{G(B?"dark":"light")})}catch{te.addListener(({matches:ae})=>{try{G(ae?"dark":"light")}catch(se){console.error(se)}})}},[d]),Oe.useEffect(()=>{x.length<=1&&j(!1)},[x]),Oe.useEffect(()=>{let te=B=>{var ae,se;a.every(de=>B[de]||B.code===de)&&(j(!0),(ae=Y.current)==null||ae.focus()),B.code==="Escape"&&(document.activeElement===Y.current||(se=Y.current)!=null&&se.contains(document.activeElement))&&j(!1)};return document.addEventListener("keydown",te),()=>document.removeEventListener("keydown",te)},[a]),Oe.useEffect(()=>{if(Y.current)return()=>{J.current&&(J.current.focus({preventScroll:!0}),J.current=null,$.current=!1)}},[Y.current]),Oe.createElement("section",{ref:e,"aria-label":`${w} ${W}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},M.map((te,B)=>{var ae;let[se,de]=te.split("-");return x.length?Oe.createElement("ol",{key:te,dir:v==="auto"?Qq():v,tabIndex:-1,ref:Y,className:s,"data-sonner-toaster":!0,"data-theme":K,"data-y-position":se,"data-lifted":q&&x.length>1&&!i,"data-x-position":de,style:{"--front-toast-height":`${((ae=F[0])==null?void 0:ae.height)||0}px`,"--width":`${xye}px`,"--gap":`${y}px`,...h,...Mye(l,u)},onBlur:ie=>{$.current&&!ie.currentTarget.contains(ie.relatedTarget)&&($.current=!1,J.current&&(J.current.focus({preventScroll:!0}),J.current=null))},onFocus:ie=>{ie.target instanceof HTMLElement&&ie.target.dataset.dismissible==="false"||$.current||($.current=!0,J.current=ie.relatedTarget)},onMouseEnter:()=>j(!0),onMouseMove:()=>j(!0),onMouseLeave:()=>{Q||j(!1)},onDragEnd:()=>j(!1),onPointerDown:ie=>{ie.target instanceof HTMLElement&&ie.target.dataset.dismissible==="false"||U(!0)},onPointerUp:()=>U(!1)},x.filter(ie=>!ie.position&&B===0||ie.position===te).map((ie,ce)=>{var me,be;return Oe.createElement(kye,{key:ie.id,icons:T,index:ce,toast:ie,defaultRichColors:f,duration:(me=b==null?void 0:b.duration)!=null?me:m,className:b==null?void 0:b.className,descriptionClassName:b==null?void 0:b.descriptionClassName,invert:n,visibleToasts:E,closeButton:(be=b==null?void 0:b.closeButton)!=null?be:o,interacting:Q,position:te,style:b==null?void 0:b.style,unstyled:b==null?void 0:b.unstyled,classNames:b==null?void 0:b.classNames,cancelButtonStyle:b==null?void 0:b.cancelButtonStyle,actionButtonStyle:b==null?void 0:b.actionButtonStyle,removeToast:Z,toasts:x.filter(Ae=>Ae.position==ie.position),heights:F.filter(Ae=>Ae.position==ie.position),setHeights:P,expandByDefault:i,gap:y,loadingIcon:C,expanded:q,pauseWhenPageIsHidden:O,swipeDirections:t.swipeDirections})})):null}))});function Lye({boundingBoxes:t,zoom:e,containerWidth:n,containerHeight:r,onBoundingBoxClick:a}){return n===0||r===0?null:A.jsx("svg",{style:{position:"absolute",top:0,left:0,width:n*e,height:r*e,pointerEvents:"none"},viewBox:`0 0 ${n} ${r}`,children:t.map(i=>A.jsxs("g",{children:[A.jsx("rect",{x:i.x,y:i.y,width:i.width,height:i.height,fill:i.color||"rgba(255, 0, 0, 0.2)",stroke:i.color||"red",strokeWidth:2/e,style:{pointerEvents:"auto",cursor:a?"pointer":"default"},onClick:()=>a==null?void 0:a(i)}),i.label&&A.jsx("text",{x:i.x,y:i.y-5,fill:i.color||"red",fontSize:12/e,fontWeight:"bold",children:i.label})]},i.id))})}var Kx=({fileName:t,onFullscreen:e,scale:n,onScaleChange:r,onReset:a,onRemove:i,onDownload:o,currentPage:s,totalPages:l,minPage:u,maxPage:d,onPageChange:f,className:m})=>{var h;const E=u??1,b=d??l,[v,y]=N.useState((h=s==null?void 0:s.toString())!=null?h:"1"),[C,T]=N.useState(!1),w=typeof n=="number"&&typeof r=="function",O=typeof s=="number"&&typeof l=="number"&&typeof f=="function";N.useEffect(()=>{!C&&typeof s=="number"&&y(s.toString())},[s,C]);const x=W=>{y(W),T(!0)},D=()=>{if(!O||!l||!s||!f)return;const W=parseInt(v);W>=E&&W<=(b??l)?f(W):y(s.toString()),T(!1)},M=W=>{W.key==="Enter"&&D()},F=()=>{T(!0)},P=()=>{O&&s!==void 0&&l!==void 0&&f&&s>E&&f(s-1)},q=()=>{O&&s!==void 0&&l!==void 0&&f&&s<(b??l)&&f(s+1)},j=()=>{w&&n!==void 0&&r&&r(Math.min(n+.25,3))},Q=()=>{w&&n!==void 0&&r&&r(Math.max(n-.25,.5))},U=()=>{w&&r&&r(1),a&&a()},K=O||w||o||e||a,G=t&&A.jsxs("div",{className:"flex items-center gap-2",children:[A.jsx(WG,{className:"size-4 text-muted-foreground"}),A.jsx("span",{className:"text-xs text-muted-foreground",children:t})]}),Y=i&&A.jsx(Al,{trigger:A.jsx(Xn,{variant:"ghost",size:"icon-sm",onClick:i,startIcon:A.jsx(BEe,{})}),content:"Remove file"});return A.jsxs("div",{className:Zt("flex h-12 items-center justify-between gap-3 px-6 border-b bg-white",m),children:[O?A.jsxs("div",{className:"flex items-center gap-1",children:[A.jsx(Al,{trigger:A.jsx(Xn,{variant:"ghost",size:"icon-sm",onClick:P,disabled:s===void 0||s<=E,startIcon:A.jsx(EEe,{})}),content:"Previous page"}),A.jsxs("div",{className:"flex items-center justify-center gap-1",children:[A.jsx("div",{className:"text-sm w-12 [&_input]:h-8 [&_input]:w-full [&_input]:text-center [&_input::-webkit-outer-spin-button]:appearance-none [&_input::-webkit-inner-spin-button]:appearance-none [&_input]:[-moz-appearance:textfield]",children:A.jsx(OT,{type:"number",value:v,onChange:W=>x(W.target.value),onFocus:F,onBlur:D,onKeyDown:M,min:E,max:b??l})}),A.jsx("span",{className:"text-sm text-muted-foreground",children:"of"}),A.jsx("span",{className:"flex items-center text-sm text-muted-foreground h-7 ml-1 whitespace-nowrap",children:u!=null&&d!=null?`${u}–${d}`:l})]}),A.jsx(Al,{trigger:A.jsx(Xn,{variant:"ghost",size:"icon-sm",onClick:q,disabled:s===void 0||l===void 0||s>=(b??l),startIcon:A.jsx(YG,{})}),content:"Next page"})]}):A.jsxs("div",{className:"flex items-center gap-2",children:[G,Y]}),A.jsxs("div",{className:"flex items-center gap-3 ml-auto",children:[K&&A.jsxs(A.Fragment,{children:[O&&(w||o||e||a)&&A.jsx("div",{className:"h-6 w-px bg-border"}),w&&A.jsxs(A.Fragment,{children:[A.jsxs("div",{className:"flex items-center gap-1",children:[A.jsx(Al,{trigger:A.jsx(Xn,{variant:"ghost",size:"icon-sm",onClick:Q,disabled:n!==void 0&&n<=.5,startIcon:A.jsx(NEe,{}),"aria-label":"Zoom Out"}),content:"Zoom out"}),A.jsxs("span",{className:"text-center text-sm text-muted-foreground",children:[n!==void 0?Math.round(n*100):0,"%"]}),A.jsx(Al,{trigger:A.jsx(Xn,{variant:"ghost",size:"icon-sm",onClick:j,disabled:n!==void 0&&n>=3,startIcon:A.jsx(kEe,{}),"aria-label":"Zoom In"}),content:"Zoom in"}),A.jsx(Al,{trigger:A.jsx(Xn,{variant:"ghost",size:"icon-sm",onClick:U,startIcon:A.jsx(LEe,{}),"aria-label":"Reset Zoom"}),content:"Reset zoom"})]}),(o||e)&&A.jsx("div",{className:"h-6 w-px bg-border"})]}),o&&A.jsxs(A.Fragment,{children:[A.jsx(Al,{trigger:A.jsx(Xn,{variant:"ghost",size:"icon-sm",onClick:o,startIcon:A.jsx(jG,{}),"aria-label":"Download PDF"}),content:"Download"}),e&&A.jsx("div",{className:"h-6 w-px bg-border"})]}),e&&A.jsx(Al,{trigger:A.jsx(Xn,{variant:"ghost",size:"icon-sm",onClick:e,startIcon:A.jsx(xEe,{}),"aria-label":"Fullscreen"}),content:"Fullscreen"})]}),O&&A.jsxs(A.Fragment,{children:[G,Y]})]})]})},Pye=N.lazy(()=>Promise.resolve().then(()=>dWe).then(t=>({default:t.PdfPreviewImpl})));N.memo(({url:t,highlights:e,fileName:n,toolbarClassName:r,onRemove:a,fitMode:i,pageRange:o})=>typeof window>"u"?null:A.jsx(N.Suspense,{fallback:A.jsxs("div",{className:"flex items-center justify-center p-8",children:[A.jsx(TEe,{className:"h-6 w-6 animate-pulse text-gray-400"}),A.jsx("span",{className:"ml-2 text-gray-600",children:"Loading PDF viewer..."})]}),children:A.jsx(Pye,{url:t,highlights:e,fileName:n,toolbarClassName:r,onRemove:a,fitMode:i,pageRange:o})}));function uf(t){var e=t,{className:n}=e,r=Mn(e,["className"]);return A.jsx("div",Qt({className:Zt("animate-pulse rounded-md bg-muted",n)},r))}function Fye(t,e){return N.useReducer((n,r)=>e[n][r]??n,t)}var Xx="ScrollArea",[Zq]=pa(Xx),[Bye,Qo]=Zq(Xx),Jq=N.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:a,scrollHideDelay:i=600,...o}=t,[s,l]=N.useState(null),[u,d]=N.useState(null),[f,m]=N.useState(null),[h,E]=N.useState(null),[b,v]=N.useState(null),[y,C]=N.useState(0),[T,w]=N.useState(0),[O,x]=N.useState(!1),[D,M]=N.useState(!1),F=It(e,q=>l(q)),P=g0(a);return A.jsx(Bye,{scope:n,type:r,dir:P,scrollHideDelay:i,scrollArea:s,viewport:u,onViewportChange:d,content:f,onContentChange:m,scrollbarX:h,onScrollbarXChange:E,scrollbarXEnabled:O,onScrollbarXEnabledChange:x,scrollbarY:b,onScrollbarYChange:v,scrollbarYEnabled:D,onScrollbarYEnabledChange:M,onCornerWidthChange:C,onCornerHeightChange:w,children:A.jsx(ft.div,{dir:P,...o,ref:F,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":T+"px",...t.style}})})});Jq.displayName=Xx;var eH="ScrollAreaViewport",Uye=N.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:a,...i}=t,o=Qo(eH,n),s=N.useRef(null),l=It(e,s,o.onViewportChange);return A.jsxs(A.Fragment,{children:[A.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),A.jsx(ft.div,{"data-radix-scroll-area-viewport":"",...i,ref:l,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...t.style},children:A.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});Uye.displayName=eH;var wl="ScrollAreaScrollbar",tH=N.forwardRef((t,e)=>{const{forceMount:n,...r}=t,a=Qo(wl,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:o}=a,s=t.orientation==="horizontal";return N.useEffect(()=>(s?i(!0):o(!0),()=>{s?i(!1):o(!1)}),[s,i,o]),a.type==="hover"?A.jsx(Gye,{...r,ref:e,forceMount:n}):a.type==="scroll"?A.jsx(zye,{...r,ref:e,forceMount:n}):a.type==="auto"?A.jsx(nH,{...r,ref:e,forceMount:n}):a.type==="always"?A.jsx(Qx,{...r,ref:e}):null});tH.displayName=wl;var Gye=N.forwardRef((t,e)=>{const{forceMount:n,...r}=t,a=Qo(wl,t.__scopeScrollArea),[i,o]=N.useState(!1);return N.useEffect(()=>{const s=a.scrollArea;let l=0;if(s){const u=()=>{window.clearTimeout(l),o(!0)},d=()=>{l=window.setTimeout(()=>o(!1),a.scrollHideDelay)};return s.addEventListener("pointerenter",u),s.addEventListener("pointerleave",d),()=>{window.clearTimeout(l),s.removeEventListener("pointerenter",u),s.removeEventListener("pointerleave",d)}}},[a.scrollArea,a.scrollHideDelay]),A.jsx(Fa,{present:n||i,children:A.jsx(nH,{"data-state":i?"visible":"hidden",...r,ref:e})})}),zye=N.forwardRef((t,e)=>{const{forceMount:n,...r}=t,a=Qo(wl,t.__scopeScrollArea),i=t.orientation==="horizontal",o=HT(()=>l("SCROLL_END"),100),[s,l]=Fye("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return N.useEffect(()=>{if(s==="idle"){const u=window.setTimeout(()=>l("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(u)}},[s,a.scrollHideDelay,l]),N.useEffect(()=>{const u=a.viewport,d=i?"scrollLeft":"scrollTop";if(u){let f=u[d];const m=()=>{const h=u[d];f!==h&&(l("SCROLL"),o()),f=h};return u.addEventListener("scroll",m),()=>u.removeEventListener("scroll",m)}},[a.viewport,i,l,o]),A.jsx(Fa,{present:n||s!=="hidden",children:A.jsx(Qx,{"data-state":s==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:Le(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:Le(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),nH=N.forwardRef((t,e)=>{const n=Qo(wl,t.__scopeScrollArea),{forceMount:r,...a}=t,[i,o]=N.useState(!1),s=t.orientation==="horizontal",l=HT(()=>{if(n.viewport){const u=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?u:d)}},10);return Vh(n.viewport,l),Vh(n.content,l),A.jsx(Fa,{present:r||i,children:A.jsx(Qx,{"data-state":i?"visible":"hidden",...a,ref:e})})}),Qx=N.forwardRef((t,e)=>{const{orientation:n="vertical",...r}=t,a=Qo(wl,t.__scopeScrollArea),i=N.useRef(null),o=N.useRef(0),[s,l]=N.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=iH(s.viewport,s.content),d={...r,sizes:s,onSizesChange:l,hasThumb:u>0&&u<1,onThumbChange:m=>i.current=m,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:m=>o.current=m};function f(m,h){return Kye(m,o.current,s,h)}return n==="horizontal"?A.jsx(qye,{...d,ref:e,onThumbPositionChange:()=>{if(a.viewport&&i.current){const m=a.viewport.scrollLeft,h=oH(m,s,a.dir);i.current.style.transform=`translate3d(${h}px, 0, 0)`}},onWheelScroll:m=>{a.viewport&&(a.viewport.scrollLeft=m)},onDragScroll:m=>{a.viewport&&(a.viewport.scrollLeft=f(m,a.dir))}}):n==="vertical"?A.jsx(Hye,{...d,ref:e,onThumbPositionChange:()=>{if(a.viewport&&i.current){const m=a.viewport.scrollTop,h=oH(m,s);i.current.style.transform=`translate3d(0, ${h}px, 0)`}},onWheelScroll:m=>{a.viewport&&(a.viewport.scrollTop=m)},onDragScroll:m=>{a.viewport&&(a.viewport.scrollTop=f(m))}}):null}),qye=N.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...a}=t,i=Qo(wl,t.__scopeScrollArea),[o,s]=N.useState(),l=N.useRef(null),u=It(e,l,i.onScrollbarXChange);return N.useEffect(()=>{l.current&&s(getComputedStyle(l.current))},[l]),A.jsx(aH,{"data-orientation":"horizontal",...a,ref:u,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":qT(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.x),onDragScroll:d=>t.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(i.viewport){const m=i.viewport.scrollLeft+d.deltaX;t.onWheelScroll(m),lH(m,f)&&d.preventDefault()}},onResize:()=>{l.current&&i.viewport&&o&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:zT(o.paddingLeft),paddingEnd:zT(o.paddingRight)}})}})}),Hye=N.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...a}=t,i=Qo(wl,t.__scopeScrollArea),[o,s]=N.useState(),l=N.useRef(null),u=It(e,l,i.onScrollbarYChange);return N.useEffect(()=>{l.current&&s(getComputedStyle(l.current))},[l]),A.jsx(aH,{"data-orientation":"vertical",...a,ref:u,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":qT(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.y),onDragScroll:d=>t.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(i.viewport){const m=i.viewport.scrollTop+d.deltaY;t.onWheelScroll(m),lH(m,f)&&d.preventDefault()}},onResize:()=>{l.current&&i.viewport&&o&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:zT(o.paddingTop),paddingEnd:zT(o.paddingBottom)}})}})}),[$ye,rH]=Zq(wl),aH=N.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:a,onThumbChange:i,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:l,onDragScroll:u,onWheelScroll:d,onResize:f,...m}=t,h=Qo(wl,n),[E,b]=N.useState(null),v=It(e,F=>b(F)),y=N.useRef(null),C=N.useRef(""),T=h.viewport,w=r.content-r.viewport,O=Pa(d),x=Pa(l),D=HT(f,10);function M(F){if(y.current){const P=F.clientX-y.current.left,q=F.clientY-y.current.top;u({x:P,y:q})}}return N.useEffect(()=>{const F=P=>{const q=P.target;(E==null?void 0:E.contains(q))&&O(P,w)};return document.addEventListener("wheel",F,{passive:!1}),()=>document.removeEventListener("wheel",F,{passive:!1})},[T,E,w,O]),N.useEffect(x,[r,x]),Vh(E,D),Vh(h.content,D),A.jsx($ye,{scope:n,scrollbar:E,hasThumb:a,onThumbChange:Pa(i),onThumbPointerUp:Pa(o),onThumbPositionChange:x,onThumbPointerDown:Pa(s),children:A.jsx(ft.div,{...m,ref:v,style:{position:"absolute",...m.style},onPointerDown:Le(t.onPointerDown,F=>{F.button===0&&(F.target.setPointerCapture(F.pointerId),y.current=E.getBoundingClientRect(),C.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),M(F))}),onPointerMove:Le(t.onPointerMove,M),onPointerUp:Le(t.onPointerUp,F=>{const P=F.target;P.hasPointerCapture(F.pointerId)&&P.releasePointerCapture(F.pointerId),document.body.style.webkitUserSelect=C.current,h.viewport&&(h.viewport.style.scrollBehavior=""),y.current=null})})})}),GT="ScrollAreaThumb",Yye=N.forwardRef((t,e)=>{const{forceMount:n,...r}=t,a=rH(GT,t.__scopeScrollArea);return A.jsx(Fa,{present:n||a.hasThumb,children:A.jsx(Vye,{ref:e,...r})})}),Vye=N.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...a}=t,i=Qo(GT,n),o=rH(GT,n),{onThumbPositionChange:s}=o,l=It(e,f=>o.onThumbChange(f)),u=N.useRef(void 0),d=HT(()=>{u.current&&(u.current(),u.current=void 0)},100);return N.useEffect(()=>{const f=i.viewport;if(f){const m=()=>{if(d(),!u.current){const h=Xye(f,s);u.current=h,s()}};return s(),f.addEventListener("scroll",m),()=>f.removeEventListener("scroll",m)}},[i.viewport,d,s]),A.jsx(ft.div,{"data-state":o.hasThumb?"visible":"hidden",...a,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Le(t.onPointerDownCapture,f=>{const h=f.target.getBoundingClientRect(),E=f.clientX-h.left,b=f.clientY-h.top;o.onThumbPointerDown({x:E,y:b})}),onPointerUp:Le(t.onPointerUp,o.onThumbPointerUp)})});Yye.displayName=GT;var Zx="ScrollAreaCorner",jye=N.forwardRef((t,e)=>{const n=Qo(Zx,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?A.jsx(Wye,{...t,ref:e}):null});jye.displayName=Zx;var Wye=N.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,a=Qo(Zx,n),[i,o]=N.useState(0),[s,l]=N.useState(0),u=!!(i&&s);return Vh(a.scrollbarX,()=>{var f;const d=((f=a.scrollbarX)==null?void 0:f.offsetHeight)||0;a.onCornerHeightChange(d),l(d)}),Vh(a.scrollbarY,()=>{var f;const d=((f=a.scrollbarY)==null?void 0:f.offsetWidth)||0;a.onCornerWidthChange(d),o(d)}),u?A.jsx(ft.div,{...r,ref:e,style:{width:i,height:s,position:"absolute",right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function zT(t){return t?parseInt(t,10):0}function iH(t,e){const n=t/e;return isNaN(n)?0:n}function qT(t){const e=iH(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function Kye(t,e,n,r="ltr"){const a=qT(n),i=a/2,o=e||i,s=a-o,l=n.scrollbar.paddingStart+o,u=n.scrollbar.size-n.scrollbar.paddingEnd-s,d=n.content-n.viewport,f=r==="ltr"?[0,d]:[d*-1,0];return sH([l,u],f)(t)}function oH(t,e,n="ltr"){const r=qT(e),a=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-a,o=e.content-e.viewport,s=i-r,l=n==="ltr"?[0,o]:[o*-1,0],u=m0(t,l);return sH([0,o],[0,s])(u)}function sH(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function lH(t,e){return t>0&&t<e}var Xye=(t,e=()=>{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return(function a(){const i={left:t.scrollLeft,top:t.scrollTop},o=n.left!==i.left,s=n.top!==i.top;(o||s)&&e(),n=i,r=window.requestAnimationFrame(a)})(),()=>window.cancelAnimationFrame(r)};function HT(t,e){const n=Pa(t),r=N.useRef(0);return N.useEffect(()=>()=>window.clearTimeout(r.current),[]),N.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function Vh(t,e){const n=Pa(e);Wr(()=>{let r=0;if(t){const a=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return a.observe(t),()=>{window.cancelAnimationFrame(r),a.unobserve(t)}}},[t,n])}var Qye=Jq;Qye.displayName,tH.displayName;var Jx="rovingFocusGroup.onEntryFocus",Zye={bubbles:!1,cancelable:!0},w0="RovingFocusGroup",[eN,cH,Jye]=h0(w0),[eTe,$T]=pa(w0,[Jye]),[tTe,nTe]=eTe(w0),uH=N.forwardRef((t,e)=>A.jsx(eN.Provider,{scope:t.__scopeRovingFocusGroup,children:A.jsx(eN.Slot,{scope:t.__scopeRovingFocusGroup,children:A.jsx(rTe,{...t,ref:e})})}));uH.displayName=w0;var rTe=N.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=t,m=N.useRef(null),h=It(e,m),E=g0(i),[b,v]=Xo({prop:o,defaultProp:s??null,onChange:l,caller:w0}),[y,C]=N.useState(!1),T=Pa(u),w=cH(n),O=N.useRef(!1),[x,D]=N.useState(0);return N.useEffect(()=>{const M=m.current;if(M)return M.addEventListener(Jx,T),()=>M.removeEventListener(Jx,T)},[T]),A.jsx(tTe,{scope:n,orientation:r,dir:E,loop:a,currentTabStopId:b,onItemFocus:N.useCallback(M=>v(M),[v]),onItemShiftTab:N.useCallback(()=>C(!0),[]),onFocusableItemAdd:N.useCallback(()=>D(M=>M+1),[]),onFocusableItemRemove:N.useCallback(()=>D(M=>M-1),[]),children:A.jsx(ft.div,{tabIndex:y||x===0?-1:0,"data-orientation":r,...f,ref:h,style:{outline:"none",...t.style},onMouseDown:Le(t.onMouseDown,()=>{O.current=!0}),onFocus:Le(t.onFocus,M=>{const F=!O.current;if(M.target===M.currentTarget&&F&&!y){const P=new CustomEvent(Jx,Zye);if(M.currentTarget.dispatchEvent(P),!P.defaultPrevented){const q=w().filter(G=>G.focusable),j=q.find(G=>G.active),Q=q.find(G=>G.id===b),K=[j,Q,...q].filter(Boolean).map(G=>G.ref.current);fH(K,d)}}O.current=!1}),onBlur:Le(t.onBlur,()=>C(!1))})})}),dH="RovingFocusGroupItem",pH=N.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:i,children:o,...s}=t,l=bl(),u=i||l,d=nTe(dH,n),f=d.currentTabStopId===u,m=cH(n),{onFocusableItemAdd:h,onFocusableItemRemove:E,currentTabStopId:b}=d;return N.useEffect(()=>{if(r)return h(),()=>E()},[r,h,E]),A.jsx(eN.ItemSlot,{scope:n,id:u,focusable:r,active:a,children:A.jsx(ft.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...s,ref:e,onMouseDown:Le(t.onMouseDown,v=>{r?d.onItemFocus(u):v.preventDefault()}),onFocus:Le(t.onFocus,()=>d.onItemFocus(u)),onKeyDown:Le(t.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){d.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const y=oTe(v,d.orientation,d.dir);if(y!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let T=m().filter(w=>w.focusable).map(w=>w.ref.current);if(y==="last")T.reverse();else if(y==="prev"||y==="next"){y==="prev"&&T.reverse();const w=T.indexOf(v.currentTarget);T=d.loop?sTe(T,w+1):T.slice(w+1)}setTimeout(()=>fH(T))}}),children:typeof o=="function"?o({isCurrentTabStop:f,hasTabStop:b!=null}):o})})});pH.displayName=dH;var aTe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function iTe(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function oTe(t,e,n){const r=iTe(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return aTe[r]}function fH(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function sTe(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var mH=uH,hH=pH;N.createContext({variant:"default"});var YT="Collapsible",[lTe]=pa(YT),[cTe,tN]=lTe(YT),gH=N.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:a,disabled:i,onOpenChange:o,...s}=t,[l,u]=Xo({prop:r,defaultProp:a??!1,onChange:o,caller:YT});return A.jsx(cTe,{scope:n,disabled:i,contentId:bl(),open:l,onOpenToggle:N.useCallback(()=>u(d=>!d),[u]),children:A.jsx(ft.div,{"data-state":rN(l),"data-disabled":i?"":void 0,...s,ref:e})})});gH.displayName=YT;var _H="CollapsibleTrigger",bH=N.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,a=tN(_H,n);return A.jsx(ft.button,{type:"button","aria-controls":a.contentId,"aria-expanded":a.open||!1,"data-state":rN(a.open),"data-disabled":a.disabled?"":void 0,disabled:a.disabled,...r,ref:e,onClick:Le(t.onClick,a.onOpenToggle)})});bH.displayName=_H;var nN="CollapsibleContent",EH=N.forwardRef((t,e)=>{const{forceMount:n,...r}=t,a=tN(nN,t.__scopeCollapsible);return A.jsx(Fa,{present:n||a.open,children:({present:i})=>A.jsx(uTe,{...r,ref:e,present:i})})});EH.displayName=nN;var uTe=N.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:a,...i}=t,o=tN(nN,n),[s,l]=N.useState(r),u=N.useRef(null),d=It(e,u),f=N.useRef(0),m=f.current,h=N.useRef(0),E=h.current,b=o.open||s,v=N.useRef(b),y=N.useRef(void 0);return N.useEffect(()=>{const C=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(C)},[]),Wr(()=>{const C=u.current;if(C){y.current=y.current||{transitionDuration:C.style.transitionDuration,animationName:C.style.animationName},C.style.transitionDuration="0s",C.style.animationName="none";const T=C.getBoundingClientRect();f.current=T.height,h.current=T.width,v.current||(C.style.transitionDuration=y.current.transitionDuration,C.style.animationName=y.current.animationName),l(r)}},[o.open,r]),A.jsx(ft.div,{"data-state":rN(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!b,...i,ref:d,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":E?`${E}px`:void 0,...t.style},children:b&&a})});function rN(t){return t?"open":"closed"}var dTe=gH,pTe=dTe,fTe=bH,mTe=EH,aN,VT="HoverCard",[SH]=pa(VT,[Tl]),jT=Tl(),[hTe,iN]=SH(VT),vH=t=>{const{__scopeHoverCard:e,children:n,open:r,defaultOpen:a,onOpenChange:i,openDelay:o=700,closeDelay:s=300}=t,l=jT(e),u=N.useRef(0),d=N.useRef(0),f=N.useRef(!1),m=N.useRef(!1),[h,E]=Xo({prop:r,defaultProp:a??!1,onChange:i,caller:VT}),b=N.useCallback(()=>{clearTimeout(d.current),u.current=window.setTimeout(()=>E(!0),o)},[o,E]),v=N.useCallback(()=>{clearTimeout(u.current),!f.current&&!m.current&&(d.current=window.setTimeout(()=>E(!1),s))},[s,E]),y=N.useCallback(()=>E(!1),[E]);return N.useEffect(()=>()=>{clearTimeout(u.current),clearTimeout(d.current)},[]),A.jsx(hTe,{scope:e,open:h,onOpenChange:E,onOpen:b,onClose:v,onDismiss:y,hasSelectionRef:f,isPointerDownOnContentRef:m,children:A.jsx(oT,{...l,children:n})})};vH.displayName=VT;var yH="HoverCardTrigger",TH=N.forwardRef((t,e)=>{const{__scopeHoverCard:n,...r}=t,a=iN(yH,n),i=jT(n);return A.jsx(kh,{asChild:!0,...i,children:A.jsx(ft.a,{"data-state":a.open?"open":"closed",...r,ref:e,onPointerEnter:Le(t.onPointerEnter,KT(a.onOpen)),onPointerLeave:Le(t.onPointerLeave,KT(a.onClose)),onFocus:Le(t.onFocus,a.onOpen),onBlur:Le(t.onBlur,a.onClose),onTouchStart:Le(t.onTouchStart,o=>o.preventDefault())})})});TH.displayName=yH;var gTe="HoverCardPortal",[ZXe,_Te]=SH(gTe,{forceMount:void 0}),WT="HoverCardContent",CH=N.forwardRef((t,e)=>{const n=_Te(WT,t.__scopeHoverCard),{forceMount:r=n.forceMount,...a}=t,i=iN(WT,t.__scopeHoverCard);return A.jsx(Fa,{present:r||i.open,children:A.jsx(bTe,{"data-state":i.open?"open":"closed",...a,onPointerEnter:Le(t.onPointerEnter,KT(i.onOpen)),onPointerLeave:Le(t.onPointerLeave,KT(i.onClose)),ref:e})})});CH.displayName=WT;var bTe=N.forwardRef((t,e)=>{const{__scopeHoverCard:n,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:o,...s}=t,l=iN(WT,n),u=jT(n),d=N.useRef(null),f=It(e,d),[m,h]=N.useState(!1);return N.useEffect(()=>{if(m){const E=document.body;return aN=E.style.userSelect||E.style.webkitUserSelect,E.style.userSelect="none",E.style.webkitUserSelect="none",()=>{E.style.userSelect=aN,E.style.webkitUserSelect=aN}}},[m]),N.useEffect(()=>{if(d.current){const E=()=>{h(!1),l.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var v;((v=document.getSelection())==null?void 0:v.toString())!==""&&(l.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",E),()=>{document.removeEventListener("pointerup",E),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!1}}},[l.isPointerDownOnContentRef,l.hasSelectionRef]),N.useEffect(()=>{d.current&&vTe(d.current).forEach(b=>b.setAttribute("tabindex","-1"))}),A.jsx(nf,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:o,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:Le(i,E=>{E.preventDefault()}),onDismiss:l.onDismiss,children:A.jsx(c0,{...u,...s,onPointerDown:Le(s.onPointerDown,E=>{E.currentTarget.contains(E.target)&&h(!0),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!0}),ref:f,style:{...s.style,userSelect:m?"text":void 0,WebkitUserSelect:m?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),ETe="HoverCardArrow",STe=N.forwardRef((t,e)=>{const{__scopeHoverCard:n,...r}=t,a=jT(n);return A.jsx(u0,{...a,...r,ref:e})});STe.displayName=ETe;function KT(t){return e=>e.pointerType==="touch"?void 0:t()}function vTe(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)e.push(n.currentNode);return e}var yTe=vH,TTe=TH,AH=CH,CTe=yTe,ATe=TTe,RH=t=>{var e=t,{ref:n,className:r,align:a="center",sideOffset:i=4}=e,o=Mn(e,["ref","className","align","sideOffset"]);return A.jsx(AH,Qt({ref:n,align:a,sideOffset:i,className:Zt("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none",r)},o))};RH.displayName=AH.displayName;var RTe=["StartEvent","StopEvent","InputRequiredEvent","HumanResponseEvent","ChatDeltaEvent","InternalDispatchEvent","StepStateChanged","EventsQueueChanged"],Aa=class mme{constructor(e,n,r){Ch(this,"type"),Ch(this,"types"),Ch(this,"data"),Ch(this,"timestamp"),this.type=e,this.data=n,this.timestamp=new Date,this.types=r}static fromRawEvent(e){return wTe(e)?new OH(e.type,e.value,e.types):MH(e)?new oN(e.type,e.value,e.types):xTe(e)?new wH(e.type,e.value,e.types):NTe(e)?new xH(e.type,e.value,e.types):OTe(e)?new NH(e.type,e.value,e.types):ITe(e)?new IH(e.type,e.value,e.types):kTe(e)?new DH(e.type,e.value,e.types):DTe(e)?new kH(e.type,e.value,e.types):new mme(e.type,e.value,e.types)}toRawEvent(){var e,n;return{value:(e=this.data)!=null?e:{},qualified_name:this.type,types:(n=this.types)!=null?n:[],type:this.type}}},oN=class extends Aa{constructor(t,e,n){super(t,e,n)}},wH=class extends Aa{constructor(t,e,n){super(t,e,n)}},xH=class extends Aa{constructor(t,e,n){super(t,e,n)}},NH=class extends Aa{constructor(t,e,n){super(t,e,n)}},OH=class extends Aa{constructor(t,e,n){super(t,e,n)}},IH=class extends Aa{constructor(t,e,n){super(t,e,n)}},DH=class extends Aa{constructor(t,e,n){super(t,e,n)}},kH=class extends Aa{constructor(t,e,n){super(t,e,n)}};function wTe(t){var e,n;return t instanceof Aa?t instanceof OH:t.type==="StartEvent"?!0:(n=(e=t.types)==null?void 0:e.includes("StartEvent"))!=null?n:!1}function MH(t){var e,n;return t instanceof Aa?t instanceof oN:t.type==="StopEvent"?!0:(n=(e=t.types)==null?void 0:e.includes("StopEvent"))!=null?n:!1}function xTe(t){var e,n;return t instanceof Aa?t instanceof wH:t.type==="InputRequiredEvent"?!0:(n=(e=t.types)==null?void 0:e.includes("InputRequiredEvent"))!=null?n:!1}function NTe(t){var e,n;return t instanceof Aa?t instanceof xH:t.type==="HumanResponseEvent"?!0:(n=(e=t.types)==null?void 0:e.includes("HumanResponseEvent"))!=null?n:!1}function OTe(t){var e,n;return t instanceof Aa?t instanceof NH:t.type==="ChatDeltaEvent"?!0:(n=(e=t.types)==null?void 0:e.includes("ChatDeltaEvent"))!=null?n:!1}function ITe(t){var e,n;return t instanceof Aa?t instanceof IH:t.type==="InternalDispatchEvent"?!0:(n=(e=t.types)==null?void 0:e.includes("InternalDispatchEvent"))!=null?n:!1}function DTe(t){var e,n;return t instanceof Aa?t instanceof kH:t.type==="StepStateChanged"?!0:(n=(e=t.types)==null?void 0:e.includes("StepStateChanged"))!=null?n:!1}function kTe(t){var e,n;return t instanceof Aa?t instanceof DH:t.type==="EventsQueueChanged"?!0:(n=(e=t.types)==null?void 0:e.includes("EventsQueueChanged"))!=null?n:!1}function MTe(t){return RTe.includes(t.type)}var XT="Dialog",[LH,PH]=pa(XT),[LTe,zs]=LH(XT),FH=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:o=!0}=t,s=N.useRef(null),l=N.useRef(null),[u,d]=Xo({prop:r,defaultProp:a??!1,onChange:i,caller:XT});return A.jsx(LTe,{scope:e,triggerRef:s,contentRef:l,contentId:bl(),titleId:bl(),descriptionId:bl(),open:u,onOpenChange:d,onOpenToggle:N.useCallback(()=>d(f=>!f),[d]),modal:o,children:n})};FH.displayName=XT;var BH="DialogTrigger",UH=N.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=zs(BH,n),i=It(e,a.triggerRef);return A.jsx(ft.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":cN(a.open),...r,ref:i,onClick:Le(t.onClick,a.onOpenToggle)})});UH.displayName=BH;var sN="DialogPortal",[PTe,GH]=LH(sN,{forceMount:void 0}),zH=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:a}=t,i=zs(sN,e);return A.jsx(PTe,{scope:e,forceMount:n,children:N.Children.map(r,o=>A.jsx(Fa,{present:n||i.open,children:A.jsx(d0,{asChild:!0,container:a,children:o})}))})};zH.displayName=sN;var QT="DialogOverlay",qH=N.forwardRef((t,e)=>{const n=GH(QT,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,i=zs(QT,t.__scopeDialog);return i.modal?A.jsx(Fa,{present:r||i.open,children:A.jsx(BTe,{...a,ref:e})}):null});qH.displayName=QT;var FTe=rd("DialogOverlay.RemoveScroll"),BTe=N.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=zs(QT,n);return A.jsx(p0,{as:FTe,allowPinchZoom:!0,shards:[a.contentRef],children:A.jsx(ft.div,{"data-state":cN(a.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),df="DialogContent",HH=N.forwardRef((t,e)=>{const n=GH(df,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,i=zs(df,t.__scopeDialog);return A.jsx(Fa,{present:r||i.open,children:i.modal?A.jsx(UTe,{...a,ref:e}):A.jsx(GTe,{...a,ref:e})})});HH.displayName=df;var UTe=N.forwardRef((t,e)=>{const n=zs(df,t.__scopeDialog),r=N.useRef(null),a=It(e,n.contentRef,r);return N.useEffect(()=>{const i=r.current;if(i)return uT(i)},[]),A.jsx($H,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Le(t.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Le(t.onPointerDownOutside,i=>{const o=i.detail.originalEvent,s=o.button===0&&o.ctrlKey===!0;(o.button===2||s)&&i.preventDefault()}),onFocusOutside:Le(t.onFocusOutside,i=>i.preventDefault())})}),GTe=N.forwardRef((t,e)=>{const n=zs(df,t.__scopeDialog),r=N.useRef(!1),a=N.useRef(!1);return A.jsx($H,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,s;(o=t.onCloseAutoFocus)==null||o.call(t,i),i.defaultPrevented||(r.current||(s=n.triggerRef.current)==null||s.focus(),i.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:i=>{var l,u;(l=t.onInteractOutside)==null||l.call(t,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const o=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),$H=N.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,...o}=t,s=zs(df,n),l=N.useRef(null),u=It(e,l);return Ky(),A.jsxs(A.Fragment,{children:[A.jsx(i0,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:A.jsx(nf,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":cN(s.open),...o,ref:u,onDismiss:()=>s.onOpenChange(!1)})}),A.jsxs(A.Fragment,{children:[A.jsx(qTe,{titleId:s.titleId}),A.jsx($Te,{contentRef:l,descriptionId:s.descriptionId})]})]})}),lN="DialogTitle",YH=N.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=zs(lN,n);return A.jsx(ft.h2,{id:a.titleId,...r,ref:e})});YH.displayName=lN;var VH="DialogDescription",jH=N.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=zs(VH,n);return A.jsx(ft.p,{id:a.descriptionId,...r,ref:e})});jH.displayName=VH;var WH="DialogClose",KH=N.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=zs(WH,n);return A.jsx(ft.button,{type:"button",...r,ref:e,onClick:Le(t.onClick,()=>a.onOpenChange(!1))})});KH.displayName=WH;function cN(t){return t?"open":"closed"}var XH="DialogTitleWarning",[zTe,QH]=Fge(XH,{contentName:df,titleName:lN,docsSlug:"dialog"}),qTe=({titleId:t})=>{const e=QH(XH),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
|
|
288
|
-
|
|
289
|
-
If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
290
|
-
|
|
291
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return N.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},HTe="DialogDescriptionWarning",$Te=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${QH(HTe).contentName}}.`;return N.useEffect(()=>{var i;const a=(i=t.current)==null?void 0:i.getAttribute("aria-describedby");e&&a&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},YTe=FH,ZH=UH,VTe=zH,x0=qH,N0=HH,ZT=YH,JT=jH,eC=KH,jTe=YTe,WTe=ZH,KTe=VTe,XTe=eC,JH=t=>{var e=t,{ref:n,className:r}=e,a=Mn(e,["ref","className"]);return A.jsx(x0,Qt({ref:n,className:Zt("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80",r)},a))};JH.displayName=x0.displayName;var e$=t=>{var e=t,{ref:n,className:r,children:a,breakpoint:i="lg"}=e,o=Mn(e,["ref","className","children","breakpoint"]);return A.jsxs(KTe,{children:[A.jsx(JH,{}),A.jsxs(N0,Rr(Qt({ref:n,className:Zt("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] fixed left-1/2 top-1/2 z-50 flex w-full max-w-[425px] -translate-x-1/2 -translate-y-1/2 flex-col gap-4 rounded-lg border bg-background p-6 shadow-[0_10px_15px_-3px_rgba(0,0,0,0.1),0_4px_6px_-4px_rgba(0,0,0,0.1)]",r),"data-breakpoint":i},o),{children:[a,A.jsxs(eC,{className:"rounded-xs absolute right-[15px] top-[15px] opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[A.jsx(QG,{className:"size-4"}),A.jsx("span",{className:"sr-only",children:"Close"})]})]}))]})};e$.displayName=N0.displayName;var t$=({title:t,description:e,icon:n,breakpoint:r="lg","da-cid":a})=>!t&&!e&&!n?null:A.jsxs("div",{className:Zt("flex flex-col gap-4",r==="sm"&&"text-center"),"da-cid":a,children:[n&&A.jsx("div",{className:Zt("shadow-xs flex size-8 items-center justify-center rounded-sm border bg-background p-2 [&_svg]:size-4",r==="sm"&&"mx-auto"),children:n}),(t||e)&&A.jsxs("div",{className:"flex flex-col gap-1.5",children:[t&&A.jsx(ZT,{className:"text-lg font-semibold leading-none text-foreground",children:t}),e&&A.jsx(JT,{className:"text-sm leading-5 text-muted-foreground",children:e})]})]});t$.displayName="DialogHeader";var jh=(t,e,n)=>{const r=A.jsx(Xn,{fullWidth:n,variant:t.isDestructive?"destructive":e,onClick:t.onClick,disabled:t.disabled||t.loading,label:t.label,startIcon:t.icon,type:t.type,form:t.form,isLoading:t.loading});return t.asDialogClose?A.jsx(XTe,{asChild:!0,children:r}):r},n$=({primary:t,secondary:e,tertiary:n,breakpoint:r="lg",children:a,"da-cid":i})=>!t&&!e&&!n&&!a?null:r==="lg"?A.jsxs("div",{className:"flex flex-col gap-6","da-cid":i,children:[a,(t||e||n)&&A.jsxs("div",{className:"flex items-center gap-6",children:[n&&jh(n,"ghost"),A.jsxs("div",{className:"flex flex-1 items-center justify-end gap-2",children:[e&&jh(e,"outline"),t&&jh(t,"default")]})]})]}):A.jsxs("div",{className:"flex flex-col gap-6","da-cid":i,children:[a,(t||e||n)&&A.jsxs("div",{className:"flex flex-col items-center gap-2",children:[A.jsxs("div",{className:"flex w-full items-center gap-2",children:[e&&A.jsx("div",{className:"flex-1",children:jh(e,"outline",!0)}),t&&A.jsx("div",{className:"flex-1",children:jh(t,"default",!0)})]}),n&&jh(n,"ghost")]})]});n$.displayName="DialogFooter";var uN="Progress",dN=100,[QTe]=pa(uN),[ZTe,JTe]=QTe(uN),r$=N.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:a,getValueLabel:i=tCe,...o}=t;(a||a===0)&&!o$(a)&&console.error(nCe(`${a}`,"Progress"));const s=o$(a)?a:dN;r!==null&&!s$(r,s)&&console.error(rCe(`${r}`,"Progress"));const l=s$(r,s)?r:null,u=tC(l)?i(l,s):void 0;return A.jsx(ZTe,{scope:n,value:l,max:s,children:A.jsx(ft.div,{"aria-valuemax":s,"aria-valuemin":0,"aria-valuenow":tC(l)?l:void 0,"aria-valuetext":u,role:"progressbar","data-state":i$(l,s),"data-value":l??void 0,"data-max":s,...o,ref:e})})});r$.displayName=uN;var a$="ProgressIndicator",eCe=N.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,a=JTe(a$,n);return A.jsx(ft.div,{"data-state":i$(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...r,ref:e})});eCe.displayName=a$;function tCe(t,e){return`${Math.round(t/e*100)}%`}function i$(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function tC(t){return typeof t=="number"}function o$(t){return tC(t)&&!isNaN(t)&&t>0}function s$(t,e){return tC(t)&&!isNaN(t)&&t<=e&&t>=0}function nCe(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${dN}\`.`}function rCe(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be:
|
|
287
|
+
`);function UT(t){return t.label!==void 0}var Aye=3,Rye="32px",wye="16px",Xq=4e3,xye=356,Nye=14,Oye=20,Iye=200;function Gs(...t){return t.filter(Boolean).join(" ")}function Dye(t){let[e,n]=t.split("-"),r=[];return e&&r.push(e),n&&r.push(n),r}var kye=t=>{var e,n,r,a,i,o,s,l,u,d,f;let{invert:m,toast:h,unstyled:E,interacting:b,setHeights:v,visibleToasts:y,heights:C,index:T,toasts:w,expanded:O,removeToast:x,defaultRichColors:D,closeButton:M,style:F,cancelButtonStyle:P,actionButtonStyle:q,className:j="",descriptionClassName:Q="",duration:U,position:K,gap:G,loadingIcon:Y,expandByDefault:W,classNames:J,icons:$,closeButtonAriaLabel:Z="Close toast",pauseWhenPageIsHidden:te}=t,[B,ae]=Oe.useState(null),[se,de]=Oe.useState(null),[ie,ce]=Oe.useState(!1),[me,be]=Oe.useState(!1),[Ae,we]=Oe.useState(!1),[Te,De]=Oe.useState(!1),[We,Ye]=Oe.useState(!1),[Tt,_t]=Oe.useState(0),[Jt,Ge]=Oe.useState(0),Ve=Oe.useRef(h.duration||U||Xq),Xe=Oe.useRef(null),mt=Oe.useRef(null),yt=T===0,Dt=T+1<=y,ge=h.type,xe=h.dismissible!==!1,He=h.className||"",ot=h.descriptionClassName||"",Ct=Oe.useMemo(()=>C.findIndex(Ee=>Ee.toastId===h.id)||0,[C,h.id]),pr=Oe.useMemo(()=>{var Ee;return(Ee=h.closeButton)!=null?Ee:M},[h.closeButton,M]),Yn=Oe.useMemo(()=>h.duration||U||Xq,[h.duration,U]),Tn=Oe.useRef(0),zt=Oe.useRef(0),hn=Oe.useRef(0),Bt=Oe.useRef(null),[Mr,ir]=K.split("-"),Lr=Oe.useMemo(()=>C.reduce((Ee,Me,Je)=>Je>=Ct?Ee:Ee+Me.height,0),[C,Ct]),Et=_ye(),Hr=h.invert||m,$r=ge==="loading";zt.current=Oe.useMemo(()=>Ct*G+Lr,[Ct,Lr]),Oe.useEffect(()=>{Ve.current=Yn},[Yn]),Oe.useEffect(()=>{ce(!0)},[]),Oe.useEffect(()=>{let Ee=mt.current;if(Ee){let Me=Ee.getBoundingClientRect().height;return Ge(Me),v(Je=>[{toastId:h.id,height:Me,position:h.position},...Je]),()=>v(Je=>Je.filter(en=>en.toastId!==h.id))}},[v,h.id]),Oe.useLayoutEffect(()=>{if(!ie)return;let Ee=mt.current,Me=Ee.style.height;Ee.style.height="auto";let Je=Ee.getBoundingClientRect().height;Ee.style.height=Me,Ge(Je),v(en=>en.find(qt=>qt.toastId===h.id)?en.map(qt=>qt.toastId===h.id?{...qt,height:Je}:qt):[{toastId:h.id,height:Je,position:h.position},...en])},[ie,h.title,h.description,v,h.id]);let Nn=Oe.useCallback(()=>{be(!0),_t(zt.current),v(Ee=>Ee.filter(Me=>Me.toastId!==h.id)),setTimeout(()=>{x(h)},Iye)},[h,x,v,zt]);Oe.useEffect(()=>{if(h.promise&&ge==="loading"||h.duration===1/0||h.type==="loading")return;let Ee;return O||b||te&&Et?(()=>{if(hn.current<Tn.current){let Me=new Date().getTime()-Tn.current;Ve.current=Ve.current-Me}hn.current=new Date().getTime()})():Ve.current!==1/0&&(Tn.current=new Date().getTime(),Ee=setTimeout(()=>{var Me;(Me=h.onAutoClose)==null||Me.call(h,h),Nn()},Ve.current)),()=>clearTimeout(Ee)},[O,b,h,ge,te,Et,Nn]),Oe.useEffect(()=>{h.delete&&Nn()},[Nn,h.delete]);function ue(){var Ee,Me,Je;return $!=null&&$.loading?Oe.createElement("div",{className:Gs(J==null?void 0:J.loader,(Ee=h==null?void 0:h.classNames)==null?void 0:Ee.loader,"sonner-loader"),"data-visible":ge==="loading"},$.loading):Y?Oe.createElement("div",{className:Gs(J==null?void 0:J.loader,(Me=h==null?void 0:h.classNames)==null?void 0:Me.loader,"sonner-loader"),"data-visible":ge==="loading"},Y):Oe.createElement(dye,{className:Gs(J==null?void 0:J.loader,(Je=h==null?void 0:h.classNames)==null?void 0:Je.loader),visible:ge==="loading"})}return Oe.createElement("li",{tabIndex:0,ref:mt,className:Gs(j,He,J==null?void 0:J.toast,(e=h==null?void 0:h.classNames)==null?void 0:e.toast,J==null?void 0:J.default,J==null?void 0:J[ge],(n=h==null?void 0:h.classNames)==null?void 0:n[ge]),"data-sonner-toast":"","data-rich-colors":(r=h.richColors)!=null?r:D,"data-styled":!(h.jsx||h.unstyled||E),"data-mounted":ie,"data-promise":!!h.promise,"data-swiped":We,"data-removed":me,"data-visible":Dt,"data-y-position":Mr,"data-x-position":ir,"data-index":T,"data-front":yt,"data-swiping":Ae,"data-dismissible":xe,"data-type":ge,"data-invert":Hr,"data-swipe-out":Te,"data-swipe-direction":se,"data-expanded":!!(O||W&&ie),style:{"--index":T,"--toasts-before":T,"--z-index":w.length-T,"--offset":`${me?Tt:zt.current}px`,"--initial-height":W?"auto":`${Jt}px`,...F,...h.style},onDragEnd:()=>{we(!1),ae(null),Bt.current=null},onPointerDown:Ee=>{$r||!xe||(Xe.current=new Date,_t(zt.current),Ee.target.setPointerCapture(Ee.pointerId),Ee.target.tagName!=="BUTTON"&&(we(!0),Bt.current={x:Ee.clientX,y:Ee.clientY}))},onPointerUp:()=>{var Ee,Me,Je,en;if(Te||!xe)return;Bt.current=null;let qt=Number(((Ee=mt.current)==null?void 0:Ee.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),et=Number(((Me=mt.current)==null?void 0:Me.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Qe=new Date().getTime()-((Je=Xe.current)==null?void 0:Je.getTime()),pt=B==="x"?qt:et,Sn=Math.abs(pt)/Qe;if(Math.abs(pt)>=Oye||Sn>.11){_t(zt.current),(en=h.onDismiss)==null||en.call(h,h),de(B==="x"?qt>0?"right":"left":et>0?"down":"up"),Nn(),De(!0),Ye(!1);return}we(!1),ae(null)},onPointerMove:Ee=>{var Me,Je,en,qt;if(!Bt.current||!xe||((Me=window.getSelection())==null?void 0:Me.toString().length)>0)return;let et=Ee.clientY-Bt.current.y,Qe=Ee.clientX-Bt.current.x,pt=(Je=t.swipeDirections)!=null?Je:Dye(K);!B&&(Math.abs(Qe)>1||Math.abs(et)>1)&&ae(Math.abs(Qe)>Math.abs(et)?"x":"y");let Sn={x:0,y:0};B==="y"?(pt.includes("top")||pt.includes("bottom"))&&(pt.includes("top")&&et<0||pt.includes("bottom")&&et>0)&&(Sn.y=et):B==="x"&&(pt.includes("left")||pt.includes("right"))&&(pt.includes("left")&&Qe<0||pt.includes("right")&&Qe>0)&&(Sn.x=Qe),(Math.abs(Sn.x)>0||Math.abs(Sn.y)>0)&&Ye(!0),(en=mt.current)==null||en.style.setProperty("--swipe-amount-x",`${Sn.x}px`),(qt=mt.current)==null||qt.style.setProperty("--swipe-amount-y",`${Sn.y}px`)}},pr&&!h.jsx?Oe.createElement("button",{"aria-label":Z,"data-disabled":$r,"data-close-button":!0,onClick:$r||!xe?()=>{}:()=>{var Ee;Nn(),(Ee=h.onDismiss)==null||Ee.call(h,h)},className:Gs(J==null?void 0:J.closeButton,(a=h==null?void 0:h.classNames)==null?void 0:a.closeButton)},(i=$==null?void 0:$.close)!=null?i:gye):null,h.jsx||N.isValidElement(h.title)?h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title:Oe.createElement(Oe.Fragment,null,ge||h.icon||h.promise?Oe.createElement("div",{"data-icon":"",className:Gs(J==null?void 0:J.icon,(o=h==null?void 0:h.classNames)==null?void 0:o.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||ue():null,h.type!=="loading"?h.icon||($==null?void 0:$[ge])||cye(ge):null):null,Oe.createElement("div",{"data-content":"",className:Gs(J==null?void 0:J.content,(s=h==null?void 0:h.classNames)==null?void 0:s.content)},Oe.createElement("div",{"data-title":"",className:Gs(J==null?void 0:J.title,(l=h==null?void 0:h.classNames)==null?void 0:l.title)},typeof h.title=="function"?h.title():h.title),h.description?Oe.createElement("div",{"data-description":"",className:Gs(Q,ot,J==null?void 0:J.description,(u=h==null?void 0:h.classNames)==null?void 0:u.description)},typeof h.description=="function"?h.description():h.description):null),N.isValidElement(h.cancel)?h.cancel:h.cancel&&UT(h.cancel)?Oe.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||P,onClick:Ee=>{var Me,Je;UT(h.cancel)&&xe&&((Je=(Me=h.cancel).onClick)==null||Je.call(Me,Ee),Nn())},className:Gs(J==null?void 0:J.cancelButton,(d=h==null?void 0:h.classNames)==null?void 0:d.cancelButton)},h.cancel.label):null,N.isValidElement(h.action)?h.action:h.action&&UT(h.action)?Oe.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||q,onClick:Ee=>{var Me,Je;UT(h.action)&&((Je=(Me=h.action).onClick)==null||Je.call(Me,Ee),!Ee.defaultPrevented&&Nn())},className:Gs(J==null?void 0:J.actionButton,(f=h==null?void 0:h.classNames)==null?void 0:f.actionButton)},h.action.label):null))};function Qq(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function Mye(t,e){let n={};return[t,e].forEach((r,a)=>{let i=a===1,o=i?"--mobile-offset":"--offset",s=i?wye:Rye;function l(u){["top","right","bottom","left"].forEach(d=>{n[`${o}-${d}`]=typeof u=="number"?`${u}px`:u})}typeof r=="number"||typeof r=="string"?l(r):typeof r=="object"?["top","right","bottom","left"].forEach(u=>{r[u]===void 0?n[`${o}-${u}`]=s:n[`${o}-${u}`]=typeof r[u]=="number"?`${r[u]}px`:r[u]}):l(s)}),n}N.forwardRef(function(t,e){let{invert:n,position:r="bottom-right",hotkey:a=["altKey","KeyT"],expand:i,closeButton:o,className:s,offset:l,mobileOffset:u,theme:d="light",richColors:f,duration:m,style:h,visibleToasts:E=Aye,toastOptions:b,dir:v=Qq(),gap:y=Nye,loadingIcon:C,icons:T,containerAriaLabel:w="Notifications",pauseWhenPageIsHidden:O}=t,[x,D]=Oe.useState([]),M=Oe.useMemo(()=>Array.from(new Set([r].concat(x.filter(te=>te.position).map(te=>te.position)))),[x,r]),[F,P]=Oe.useState([]),[q,j]=Oe.useState(!1),[Q,U]=Oe.useState(!1),[K,G]=Oe.useState(d!=="system"?d:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Y=Oe.useRef(null),W=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),J=Oe.useRef(null),$=Oe.useRef(!1),Z=Oe.useCallback(te=>{D(B=>{var ae;return(ae=B.find(se=>se.id===te.id))!=null&&ae.delete||Ii.dismiss(te.id),B.filter(({id:se})=>se!==te.id)})},[]);return Oe.useEffect(()=>Ii.subscribe(te=>{if(te.dismiss){D(B=>B.map(ae=>ae.id===te.id?{...ae,delete:!0}:ae));return}setTimeout(()=>{H8.flushSync(()=>{D(B=>{let ae=B.findIndex(se=>se.id===te.id);return ae!==-1?[...B.slice(0,ae),{...B[ae],...te},...B.slice(ae+1)]:[te,...B]})})})}),[]),Oe.useEffect(()=>{if(d!=="system"){G(d);return}if(d==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?G("dark"):G("light")),typeof window>"u")return;let te=window.matchMedia("(prefers-color-scheme: dark)");try{te.addEventListener("change",({matches:B})=>{G(B?"dark":"light")})}catch{te.addListener(({matches:ae})=>{try{G(ae?"dark":"light")}catch(se){console.error(se)}})}},[d]),Oe.useEffect(()=>{x.length<=1&&j(!1)},[x]),Oe.useEffect(()=>{let te=B=>{var ae,se;a.every(de=>B[de]||B.code===de)&&(j(!0),(ae=Y.current)==null||ae.focus()),B.code==="Escape"&&(document.activeElement===Y.current||(se=Y.current)!=null&&se.contains(document.activeElement))&&j(!1)};return document.addEventListener("keydown",te),()=>document.removeEventListener("keydown",te)},[a]),Oe.useEffect(()=>{if(Y.current)return()=>{J.current&&(J.current.focus({preventScroll:!0}),J.current=null,$.current=!1)}},[Y.current]),Oe.createElement("section",{ref:e,"aria-label":`${w} ${W}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},M.map((te,B)=>{var ae;let[se,de]=te.split("-");return x.length?Oe.createElement("ol",{key:te,dir:v==="auto"?Qq():v,tabIndex:-1,ref:Y,className:s,"data-sonner-toaster":!0,"data-theme":K,"data-y-position":se,"data-lifted":q&&x.length>1&&!i,"data-x-position":de,style:{"--front-toast-height":`${((ae=F[0])==null?void 0:ae.height)||0}px`,"--width":`${xye}px`,"--gap":`${y}px`,...h,...Mye(l,u)},onBlur:ie=>{$.current&&!ie.currentTarget.contains(ie.relatedTarget)&&($.current=!1,J.current&&(J.current.focus({preventScroll:!0}),J.current=null))},onFocus:ie=>{ie.target instanceof HTMLElement&&ie.target.dataset.dismissible==="false"||$.current||($.current=!0,J.current=ie.relatedTarget)},onMouseEnter:()=>j(!0),onMouseMove:()=>j(!0),onMouseLeave:()=>{Q||j(!1)},onDragEnd:()=>j(!1),onPointerDown:ie=>{ie.target instanceof HTMLElement&&ie.target.dataset.dismissible==="false"||U(!0)},onPointerUp:()=>U(!1)},x.filter(ie=>!ie.position&&B===0||ie.position===te).map((ie,ce)=>{var me,be;return Oe.createElement(kye,{key:ie.id,icons:T,index:ce,toast:ie,defaultRichColors:f,duration:(me=b==null?void 0:b.duration)!=null?me:m,className:b==null?void 0:b.className,descriptionClassName:b==null?void 0:b.descriptionClassName,invert:n,visibleToasts:E,closeButton:(be=b==null?void 0:b.closeButton)!=null?be:o,interacting:Q,position:te,style:b==null?void 0:b.style,unstyled:b==null?void 0:b.unstyled,classNames:b==null?void 0:b.classNames,cancelButtonStyle:b==null?void 0:b.cancelButtonStyle,actionButtonStyle:b==null?void 0:b.actionButtonStyle,removeToast:Z,toasts:x.filter(Ae=>Ae.position==ie.position),heights:F.filter(Ae=>Ae.position==ie.position),setHeights:P,expandByDefault:i,gap:y,loadingIcon:C,expanded:q,pauseWhenPageIsHidden:O,swipeDirections:t.swipeDirections})})):null}))});function Lye({boundingBoxes:t,zoom:e,containerWidth:n,containerHeight:r,onBoundingBoxClick:a}){return n===0||r===0?null:A.jsx("svg",{style:{position:"absolute",top:0,left:0,width:n*e,height:r*e,pointerEvents:"none"},viewBox:`0 0 ${n} ${r}`,children:t.map(i=>A.jsxs("g",{children:[A.jsx("rect",{x:i.x,y:i.y,width:i.width,height:i.height,fill:i.color||"rgba(255, 0, 0, 0.2)",stroke:i.color||"red",strokeWidth:2/e,style:{pointerEvents:"auto",cursor:a?"pointer":"default"},onClick:()=>a==null?void 0:a(i)}),i.label&&A.jsx("text",{x:i.x,y:i.y-5,fill:i.color||"red",fontSize:12/e,fontWeight:"bold",children:i.label})]},i.id))})}var Kx=({fileName:t,onFullscreen:e,scale:n,onScaleChange:r,onReset:a,onRemove:i,onDownload:o,currentPage:s,totalPages:l,minPage:u,maxPage:d,onPageChange:f,className:m})=>{var h;const E=u??1,b=d??l,[v,y]=N.useState((h=s==null?void 0:s.toString())!=null?h:"1"),[C,T]=N.useState(!1),w=typeof n=="number"&&typeof r=="function",O=typeof s=="number"&&typeof l=="number"&&typeof f=="function";N.useEffect(()=>{!C&&typeof s=="number"&&y(s.toString())},[s,C]);const x=W=>{y(W),T(!0)},D=()=>{if(!O||!l||!s||!f)return;const W=parseInt(v);W>=E&&W<=(b??l)?f(W):y(s.toString()),T(!1)},M=W=>{W.key==="Enter"&&D()},F=()=>{T(!0)},P=()=>{O&&s!==void 0&&l!==void 0&&f&&s>E&&f(s-1)},q=()=>{O&&s!==void 0&&l!==void 0&&f&&s<(b??l)&&f(s+1)},j=()=>{w&&n!==void 0&&r&&r(Math.min(n+.25,3))},Q=()=>{w&&n!==void 0&&r&&r(Math.max(n-.25,.5))},U=()=>{w&&r&&r(1),a&&a()},K=O||w||o||e||a,G=t&&A.jsxs("div",{className:"flex items-center gap-2",children:[A.jsx(WG,{className:"size-4 text-muted-foreground"}),A.jsx("span",{className:"text-xs text-muted-foreground",children:t})]}),Y=i&&A.jsx(Al,{trigger:A.jsx(Xn,{variant:"ghost",size:"icon-sm",onClick:i,startIcon:A.jsx(BEe,{})}),content:"Remove file"});return A.jsxs("div",{className:Zt("flex h-12 items-center justify-between gap-3 px-6 border-b bg-white",m),children:[O?A.jsxs("div",{className:"flex items-center gap-1",children:[A.jsx(Al,{trigger:A.jsx(Xn,{variant:"ghost",size:"icon-sm",onClick:P,disabled:s===void 0||s<=E,startIcon:A.jsx(EEe,{})}),content:"Previous page"}),A.jsxs("div",{className:"flex items-center justify-center gap-1",children:[A.jsx("div",{className:"text-sm w-12 [&_input]:h-8 [&_input]:w-full [&_input]:text-center [&_input::-webkit-outer-spin-button]:appearance-none [&_input::-webkit-inner-spin-button]:appearance-none [&_input]:[-moz-appearance:textfield]",children:A.jsx(OT,{type:"number",value:v,onChange:W=>x(W.target.value),onFocus:F,onBlur:D,onKeyDown:M,min:E,max:b??l})}),A.jsx("span",{className:"text-sm text-muted-foreground",children:"of"}),A.jsx("span",{className:"flex items-center text-sm text-muted-foreground h-7 ml-1 whitespace-nowrap",children:u!=null&&d!=null?`${u}–${d}`:l})]}),A.jsx(Al,{trigger:A.jsx(Xn,{variant:"ghost",size:"icon-sm",onClick:q,disabled:s===void 0||l===void 0||s>=(b??l),startIcon:A.jsx(YG,{})}),content:"Next page"})]}):A.jsxs("div",{className:"flex items-center gap-2",children:[G,Y]}),A.jsxs("div",{className:"flex items-center gap-3 ml-auto",children:[K&&A.jsxs(A.Fragment,{children:[O&&(w||o||e||a)&&A.jsx("div",{className:"h-6 w-px bg-border"}),w&&A.jsxs(A.Fragment,{children:[A.jsxs("div",{className:"flex items-center gap-1",children:[A.jsx(Al,{trigger:A.jsx(Xn,{variant:"ghost",size:"icon-sm",onClick:Q,disabled:n!==void 0&&n<=.5,startIcon:A.jsx(NEe,{}),"aria-label":"Zoom Out"}),content:"Zoom out"}),A.jsxs("span",{className:"text-center text-sm text-muted-foreground",children:[n!==void 0?Math.round(n*100):0,"%"]}),A.jsx(Al,{trigger:A.jsx(Xn,{variant:"ghost",size:"icon-sm",onClick:j,disabled:n!==void 0&&n>=3,startIcon:A.jsx(kEe,{}),"aria-label":"Zoom In"}),content:"Zoom in"}),A.jsx(Al,{trigger:A.jsx(Xn,{variant:"ghost",size:"icon-sm",onClick:U,startIcon:A.jsx(LEe,{}),"aria-label":"Reset Zoom"}),content:"Reset zoom"})]}),(o||e)&&A.jsx("div",{className:"h-6 w-px bg-border"})]}),o&&A.jsxs(A.Fragment,{children:[A.jsx(Al,{trigger:A.jsx(Xn,{variant:"ghost",size:"icon-sm",onClick:o,startIcon:A.jsx(jG,{}),"aria-label":"Download PDF"}),content:"Download"}),e&&A.jsx("div",{className:"h-6 w-px bg-border"})]}),e&&A.jsx(Al,{trigger:A.jsx(Xn,{variant:"ghost",size:"icon-sm",onClick:e,startIcon:A.jsx(xEe,{}),"aria-label":"Fullscreen"}),content:"Fullscreen"})]}),O&&A.jsxs(A.Fragment,{children:[G,Y]})]})]})},Pye=N.lazy(()=>Promise.resolve().then(()=>dWe).then(t=>({default:t.PdfPreviewImpl})));N.memo(({url:t,highlights:e,fileName:n,toolbarClassName:r,onRemove:a,fitMode:i,pageRange:o})=>typeof window>"u"?null:A.jsx(N.Suspense,{fallback:A.jsxs("div",{className:"flex items-center justify-center p-8",children:[A.jsx(TEe,{className:"h-6 w-6 animate-pulse text-gray-400"}),A.jsx("span",{className:"ml-2 text-gray-600",children:"Loading PDF viewer..."})]}),children:A.jsx(Pye,{url:t,highlights:e,fileName:n,toolbarClassName:r,onRemove:a,fitMode:i,pageRange:o})}));function uf(t){var e=t,{className:n}=e,r=Mn(e,["className"]);return A.jsx("div",Qt({className:Zt("animate-pulse rounded-md bg-muted",n)},r))}function Fye(t,e){return N.useReducer((n,r)=>e[n][r]??n,t)}var Xx="ScrollArea",[Zq]=pa(Xx),[Bye,Qo]=Zq(Xx),Jq=N.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:a,scrollHideDelay:i=600,...o}=t,[s,l]=N.useState(null),[u,d]=N.useState(null),[f,m]=N.useState(null),[h,E]=N.useState(null),[b,v]=N.useState(null),[y,C]=N.useState(0),[T,w]=N.useState(0),[O,x]=N.useState(!1),[D,M]=N.useState(!1),F=It(e,q=>l(q)),P=g0(a);return A.jsx(Bye,{scope:n,type:r,dir:P,scrollHideDelay:i,scrollArea:s,viewport:u,onViewportChange:d,content:f,onContentChange:m,scrollbarX:h,onScrollbarXChange:E,scrollbarXEnabled:O,onScrollbarXEnabledChange:x,scrollbarY:b,onScrollbarYChange:v,scrollbarYEnabled:D,onScrollbarYEnabledChange:M,onCornerWidthChange:C,onCornerHeightChange:w,children:A.jsx(ft.div,{dir:P,...o,ref:F,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":T+"px",...t.style}})})});Jq.displayName=Xx;var eH="ScrollAreaViewport",Uye=N.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:a,...i}=t,o=Qo(eH,n),s=N.useRef(null),l=It(e,s,o.onViewportChange);return A.jsxs(A.Fragment,{children:[A.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),A.jsx(ft.div,{"data-radix-scroll-area-viewport":"",...i,ref:l,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...t.style},children:A.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});Uye.displayName=eH;var wl="ScrollAreaScrollbar",tH=N.forwardRef((t,e)=>{const{forceMount:n,...r}=t,a=Qo(wl,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:o}=a,s=t.orientation==="horizontal";return N.useEffect(()=>(s?i(!0):o(!0),()=>{s?i(!1):o(!1)}),[s,i,o]),a.type==="hover"?A.jsx(Gye,{...r,ref:e,forceMount:n}):a.type==="scroll"?A.jsx(zye,{...r,ref:e,forceMount:n}):a.type==="auto"?A.jsx(nH,{...r,ref:e,forceMount:n}):a.type==="always"?A.jsx(Qx,{...r,ref:e}):null});tH.displayName=wl;var Gye=N.forwardRef((t,e)=>{const{forceMount:n,...r}=t,a=Qo(wl,t.__scopeScrollArea),[i,o]=N.useState(!1);return N.useEffect(()=>{const s=a.scrollArea;let l=0;if(s){const u=()=>{window.clearTimeout(l),o(!0)},d=()=>{l=window.setTimeout(()=>o(!1),a.scrollHideDelay)};return s.addEventListener("pointerenter",u),s.addEventListener("pointerleave",d),()=>{window.clearTimeout(l),s.removeEventListener("pointerenter",u),s.removeEventListener("pointerleave",d)}}},[a.scrollArea,a.scrollHideDelay]),A.jsx(Fa,{present:n||i,children:A.jsx(nH,{"data-state":i?"visible":"hidden",...r,ref:e})})}),zye=N.forwardRef((t,e)=>{const{forceMount:n,...r}=t,a=Qo(wl,t.__scopeScrollArea),i=t.orientation==="horizontal",o=HT(()=>l("SCROLL_END"),100),[s,l]=Fye("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return N.useEffect(()=>{if(s==="idle"){const u=window.setTimeout(()=>l("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(u)}},[s,a.scrollHideDelay,l]),N.useEffect(()=>{const u=a.viewport,d=i?"scrollLeft":"scrollTop";if(u){let f=u[d];const m=()=>{const h=u[d];f!==h&&(l("SCROLL"),o()),f=h};return u.addEventListener("scroll",m),()=>u.removeEventListener("scroll",m)}},[a.viewport,i,l,o]),A.jsx(Fa,{present:n||s!=="hidden",children:A.jsx(Qx,{"data-state":s==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:Le(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:Le(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),nH=N.forwardRef((t,e)=>{const n=Qo(wl,t.__scopeScrollArea),{forceMount:r,...a}=t,[i,o]=N.useState(!1),s=t.orientation==="horizontal",l=HT(()=>{if(n.viewport){const u=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?u:d)}},10);return Vh(n.viewport,l),Vh(n.content,l),A.jsx(Fa,{present:r||i,children:A.jsx(Qx,{"data-state":i?"visible":"hidden",...a,ref:e})})}),Qx=N.forwardRef((t,e)=>{const{orientation:n="vertical",...r}=t,a=Qo(wl,t.__scopeScrollArea),i=N.useRef(null),o=N.useRef(0),[s,l]=N.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=iH(s.viewport,s.content),d={...r,sizes:s,onSizesChange:l,hasThumb:u>0&&u<1,onThumbChange:m=>i.current=m,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:m=>o.current=m};function f(m,h){return Kye(m,o.current,s,h)}return n==="horizontal"?A.jsx(qye,{...d,ref:e,onThumbPositionChange:()=>{if(a.viewport&&i.current){const m=a.viewport.scrollLeft,h=oH(m,s,a.dir);i.current.style.transform=`translate3d(${h}px, 0, 0)`}},onWheelScroll:m=>{a.viewport&&(a.viewport.scrollLeft=m)},onDragScroll:m=>{a.viewport&&(a.viewport.scrollLeft=f(m,a.dir))}}):n==="vertical"?A.jsx(Hye,{...d,ref:e,onThumbPositionChange:()=>{if(a.viewport&&i.current){const m=a.viewport.scrollTop,h=oH(m,s);i.current.style.transform=`translate3d(0, ${h}px, 0)`}},onWheelScroll:m=>{a.viewport&&(a.viewport.scrollTop=m)},onDragScroll:m=>{a.viewport&&(a.viewport.scrollTop=f(m))}}):null}),qye=N.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...a}=t,i=Qo(wl,t.__scopeScrollArea),[o,s]=N.useState(),l=N.useRef(null),u=It(e,l,i.onScrollbarXChange);return N.useEffect(()=>{l.current&&s(getComputedStyle(l.current))},[l]),A.jsx(aH,{"data-orientation":"horizontal",...a,ref:u,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":qT(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.x),onDragScroll:d=>t.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(i.viewport){const m=i.viewport.scrollLeft+d.deltaX;t.onWheelScroll(m),lH(m,f)&&d.preventDefault()}},onResize:()=>{l.current&&i.viewport&&o&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:zT(o.paddingLeft),paddingEnd:zT(o.paddingRight)}})}})}),Hye=N.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...a}=t,i=Qo(wl,t.__scopeScrollArea),[o,s]=N.useState(),l=N.useRef(null),u=It(e,l,i.onScrollbarYChange);return N.useEffect(()=>{l.current&&s(getComputedStyle(l.current))},[l]),A.jsx(aH,{"data-orientation":"vertical",...a,ref:u,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":qT(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.y),onDragScroll:d=>t.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(i.viewport){const m=i.viewport.scrollTop+d.deltaY;t.onWheelScroll(m),lH(m,f)&&d.preventDefault()}},onResize:()=>{l.current&&i.viewport&&o&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:zT(o.paddingTop),paddingEnd:zT(o.paddingBottom)}})}})}),[$ye,rH]=Zq(wl),aH=N.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:a,onThumbChange:i,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:l,onDragScroll:u,onWheelScroll:d,onResize:f,...m}=t,h=Qo(wl,n),[E,b]=N.useState(null),v=It(e,F=>b(F)),y=N.useRef(null),C=N.useRef(""),T=h.viewport,w=r.content-r.viewport,O=Pa(d),x=Pa(l),D=HT(f,10);function M(F){if(y.current){const P=F.clientX-y.current.left,q=F.clientY-y.current.top;u({x:P,y:q})}}return N.useEffect(()=>{const F=P=>{const q=P.target;(E==null?void 0:E.contains(q))&&O(P,w)};return document.addEventListener("wheel",F,{passive:!1}),()=>document.removeEventListener("wheel",F,{passive:!1})},[T,E,w,O]),N.useEffect(x,[r,x]),Vh(E,D),Vh(h.content,D),A.jsx($ye,{scope:n,scrollbar:E,hasThumb:a,onThumbChange:Pa(i),onThumbPointerUp:Pa(o),onThumbPositionChange:x,onThumbPointerDown:Pa(s),children:A.jsx(ft.div,{...m,ref:v,style:{position:"absolute",...m.style},onPointerDown:Le(t.onPointerDown,F=>{F.button===0&&(F.target.setPointerCapture(F.pointerId),y.current=E.getBoundingClientRect(),C.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),M(F))}),onPointerMove:Le(t.onPointerMove,M),onPointerUp:Le(t.onPointerUp,F=>{const P=F.target;P.hasPointerCapture(F.pointerId)&&P.releasePointerCapture(F.pointerId),document.body.style.webkitUserSelect=C.current,h.viewport&&(h.viewport.style.scrollBehavior=""),y.current=null})})})}),GT="ScrollAreaThumb",Yye=N.forwardRef((t,e)=>{const{forceMount:n,...r}=t,a=rH(GT,t.__scopeScrollArea);return A.jsx(Fa,{present:n||a.hasThumb,children:A.jsx(Vye,{ref:e,...r})})}),Vye=N.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...a}=t,i=Qo(GT,n),o=rH(GT,n),{onThumbPositionChange:s}=o,l=It(e,f=>o.onThumbChange(f)),u=N.useRef(void 0),d=HT(()=>{u.current&&(u.current(),u.current=void 0)},100);return N.useEffect(()=>{const f=i.viewport;if(f){const m=()=>{if(d(),!u.current){const h=Xye(f,s);u.current=h,s()}};return s(),f.addEventListener("scroll",m),()=>f.removeEventListener("scroll",m)}},[i.viewport,d,s]),A.jsx(ft.div,{"data-state":o.hasThumb?"visible":"hidden",...a,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Le(t.onPointerDownCapture,f=>{const h=f.target.getBoundingClientRect(),E=f.clientX-h.left,b=f.clientY-h.top;o.onThumbPointerDown({x:E,y:b})}),onPointerUp:Le(t.onPointerUp,o.onThumbPointerUp)})});Yye.displayName=GT;var Zx="ScrollAreaCorner",jye=N.forwardRef((t,e)=>{const n=Qo(Zx,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?A.jsx(Wye,{...t,ref:e}):null});jye.displayName=Zx;var Wye=N.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,a=Qo(Zx,n),[i,o]=N.useState(0),[s,l]=N.useState(0),u=!!(i&&s);return Vh(a.scrollbarX,()=>{var f;const d=((f=a.scrollbarX)==null?void 0:f.offsetHeight)||0;a.onCornerHeightChange(d),l(d)}),Vh(a.scrollbarY,()=>{var f;const d=((f=a.scrollbarY)==null?void 0:f.offsetWidth)||0;a.onCornerWidthChange(d),o(d)}),u?A.jsx(ft.div,{...r,ref:e,style:{width:i,height:s,position:"absolute",right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function zT(t){return t?parseInt(t,10):0}function iH(t,e){const n=t/e;return isNaN(n)?0:n}function qT(t){const e=iH(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function Kye(t,e,n,r="ltr"){const a=qT(n),i=a/2,o=e||i,s=a-o,l=n.scrollbar.paddingStart+o,u=n.scrollbar.size-n.scrollbar.paddingEnd-s,d=n.content-n.viewport,f=r==="ltr"?[0,d]:[d*-1,0];return sH([l,u],f)(t)}function oH(t,e,n="ltr"){const r=qT(e),a=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-a,o=e.content-e.viewport,s=i-r,l=n==="ltr"?[0,o]:[o*-1,0],u=m0(t,l);return sH([0,o],[0,s])(u)}function sH(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function lH(t,e){return t>0&&t<e}var Xye=(t,e=()=>{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return(function a(){const i={left:t.scrollLeft,top:t.scrollTop},o=n.left!==i.left,s=n.top!==i.top;(o||s)&&e(),n=i,r=window.requestAnimationFrame(a)})(),()=>window.cancelAnimationFrame(r)};function HT(t,e){const n=Pa(t),r=N.useRef(0);return N.useEffect(()=>()=>window.clearTimeout(r.current),[]),N.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function Vh(t,e){const n=Pa(e);Wr(()=>{let r=0;if(t){const a=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return a.observe(t),()=>{window.cancelAnimationFrame(r),a.unobserve(t)}}},[t,n])}var Qye=Jq;Qye.displayName,tH.displayName;var Jx="rovingFocusGroup.onEntryFocus",Zye={bubbles:!1,cancelable:!0},w0="RovingFocusGroup",[eN,cH,Jye]=h0(w0),[eTe,$T]=pa(w0,[Jye]),[tTe,nTe]=eTe(w0),uH=N.forwardRef((t,e)=>A.jsx(eN.Provider,{scope:t.__scopeRovingFocusGroup,children:A.jsx(eN.Slot,{scope:t.__scopeRovingFocusGroup,children:A.jsx(rTe,{...t,ref:e})})}));uH.displayName=w0;var rTe=N.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=t,m=N.useRef(null),h=It(e,m),E=g0(i),[b,v]=Xo({prop:o,defaultProp:s??null,onChange:l,caller:w0}),[y,C]=N.useState(!1),T=Pa(u),w=cH(n),O=N.useRef(!1),[x,D]=N.useState(0);return N.useEffect(()=>{const M=m.current;if(M)return M.addEventListener(Jx,T),()=>M.removeEventListener(Jx,T)},[T]),A.jsx(tTe,{scope:n,orientation:r,dir:E,loop:a,currentTabStopId:b,onItemFocus:N.useCallback(M=>v(M),[v]),onItemShiftTab:N.useCallback(()=>C(!0),[]),onFocusableItemAdd:N.useCallback(()=>D(M=>M+1),[]),onFocusableItemRemove:N.useCallback(()=>D(M=>M-1),[]),children:A.jsx(ft.div,{tabIndex:y||x===0?-1:0,"data-orientation":r,...f,ref:h,style:{outline:"none",...t.style},onMouseDown:Le(t.onMouseDown,()=>{O.current=!0}),onFocus:Le(t.onFocus,M=>{const F=!O.current;if(M.target===M.currentTarget&&F&&!y){const P=new CustomEvent(Jx,Zye);if(M.currentTarget.dispatchEvent(P),!P.defaultPrevented){const q=w().filter(G=>G.focusable),j=q.find(G=>G.active),Q=q.find(G=>G.id===b),K=[j,Q,...q].filter(Boolean).map(G=>G.ref.current);fH(K,d)}}O.current=!1}),onBlur:Le(t.onBlur,()=>C(!1))})})}),dH="RovingFocusGroupItem",pH=N.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:i,children:o,...s}=t,l=bl(),u=i||l,d=nTe(dH,n),f=d.currentTabStopId===u,m=cH(n),{onFocusableItemAdd:h,onFocusableItemRemove:E,currentTabStopId:b}=d;return N.useEffect(()=>{if(r)return h(),()=>E()},[r,h,E]),A.jsx(eN.ItemSlot,{scope:n,id:u,focusable:r,active:a,children:A.jsx(ft.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...s,ref:e,onMouseDown:Le(t.onMouseDown,v=>{r?d.onItemFocus(u):v.preventDefault()}),onFocus:Le(t.onFocus,()=>d.onItemFocus(u)),onKeyDown:Le(t.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){d.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const y=oTe(v,d.orientation,d.dir);if(y!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let T=m().filter(w=>w.focusable).map(w=>w.ref.current);if(y==="last")T.reverse();else if(y==="prev"||y==="next"){y==="prev"&&T.reverse();const w=T.indexOf(v.currentTarget);T=d.loop?sTe(T,w+1):T.slice(w+1)}setTimeout(()=>fH(T))}}),children:typeof o=="function"?o({isCurrentTabStop:f,hasTabStop:b!=null}):o})})});pH.displayName=dH;var aTe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function iTe(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function oTe(t,e,n){const r=iTe(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return aTe[r]}function fH(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function sTe(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var mH=uH,hH=pH;N.createContext({variant:"default"});var YT="Collapsible",[lTe]=pa(YT),[cTe,tN]=lTe(YT),gH=N.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:a,disabled:i,onOpenChange:o,...s}=t,[l,u]=Xo({prop:r,defaultProp:a??!1,onChange:o,caller:YT});return A.jsx(cTe,{scope:n,disabled:i,contentId:bl(),open:l,onOpenToggle:N.useCallback(()=>u(d=>!d),[u]),children:A.jsx(ft.div,{"data-state":rN(l),"data-disabled":i?"":void 0,...s,ref:e})})});gH.displayName=YT;var _H="CollapsibleTrigger",bH=N.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,a=tN(_H,n);return A.jsx(ft.button,{type:"button","aria-controls":a.contentId,"aria-expanded":a.open||!1,"data-state":rN(a.open),"data-disabled":a.disabled?"":void 0,disabled:a.disabled,...r,ref:e,onClick:Le(t.onClick,a.onOpenToggle)})});bH.displayName=_H;var nN="CollapsibleContent",EH=N.forwardRef((t,e)=>{const{forceMount:n,...r}=t,a=tN(nN,t.__scopeCollapsible);return A.jsx(Fa,{present:n||a.open,children:({present:i})=>A.jsx(uTe,{...r,ref:e,present:i})})});EH.displayName=nN;var uTe=N.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:a,...i}=t,o=tN(nN,n),[s,l]=N.useState(r),u=N.useRef(null),d=It(e,u),f=N.useRef(0),m=f.current,h=N.useRef(0),E=h.current,b=o.open||s,v=N.useRef(b),y=N.useRef(void 0);return N.useEffect(()=>{const C=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(C)},[]),Wr(()=>{const C=u.current;if(C){y.current=y.current||{transitionDuration:C.style.transitionDuration,animationName:C.style.animationName},C.style.transitionDuration="0s",C.style.animationName="none";const T=C.getBoundingClientRect();f.current=T.height,h.current=T.width,v.current||(C.style.transitionDuration=y.current.transitionDuration,C.style.animationName=y.current.animationName),l(r)}},[o.open,r]),A.jsx(ft.div,{"data-state":rN(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!b,...i,ref:d,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":E?`${E}px`:void 0,...t.style},children:b&&a})});function rN(t){return t?"open":"closed"}var dTe=gH,pTe=dTe,fTe=bH,mTe=EH,aN,VT="HoverCard",[SH]=pa(VT,[Tl]),jT=Tl(),[hTe,iN]=SH(VT),vH=t=>{const{__scopeHoverCard:e,children:n,open:r,defaultOpen:a,onOpenChange:i,openDelay:o=700,closeDelay:s=300}=t,l=jT(e),u=N.useRef(0),d=N.useRef(0),f=N.useRef(!1),m=N.useRef(!1),[h,E]=Xo({prop:r,defaultProp:a??!1,onChange:i,caller:VT}),b=N.useCallback(()=>{clearTimeout(d.current),u.current=window.setTimeout(()=>E(!0),o)},[o,E]),v=N.useCallback(()=>{clearTimeout(u.current),!f.current&&!m.current&&(d.current=window.setTimeout(()=>E(!1),s))},[s,E]),y=N.useCallback(()=>E(!1),[E]);return N.useEffect(()=>()=>{clearTimeout(u.current),clearTimeout(d.current)},[]),A.jsx(hTe,{scope:e,open:h,onOpenChange:E,onOpen:b,onClose:v,onDismiss:y,hasSelectionRef:f,isPointerDownOnContentRef:m,children:A.jsx(oT,{...l,children:n})})};vH.displayName=VT;var yH="HoverCardTrigger",TH=N.forwardRef((t,e)=>{const{__scopeHoverCard:n,...r}=t,a=iN(yH,n),i=jT(n);return A.jsx(kh,{asChild:!0,...i,children:A.jsx(ft.a,{"data-state":a.open?"open":"closed",...r,ref:e,onPointerEnter:Le(t.onPointerEnter,KT(a.onOpen)),onPointerLeave:Le(t.onPointerLeave,KT(a.onClose)),onFocus:Le(t.onFocus,a.onOpen),onBlur:Le(t.onBlur,a.onClose),onTouchStart:Le(t.onTouchStart,o=>o.preventDefault())})})});TH.displayName=yH;var gTe="HoverCardPortal",[ZXe,_Te]=SH(gTe,{forceMount:void 0}),WT="HoverCardContent",CH=N.forwardRef((t,e)=>{const n=_Te(WT,t.__scopeHoverCard),{forceMount:r=n.forceMount,...a}=t,i=iN(WT,t.__scopeHoverCard);return A.jsx(Fa,{present:r||i.open,children:A.jsx(bTe,{"data-state":i.open?"open":"closed",...a,onPointerEnter:Le(t.onPointerEnter,KT(i.onOpen)),onPointerLeave:Le(t.onPointerLeave,KT(i.onClose)),ref:e})})});CH.displayName=WT;var bTe=N.forwardRef((t,e)=>{const{__scopeHoverCard:n,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:o,...s}=t,l=iN(WT,n),u=jT(n),d=N.useRef(null),f=It(e,d),[m,h]=N.useState(!1);return N.useEffect(()=>{if(m){const E=document.body;return aN=E.style.userSelect||E.style.webkitUserSelect,E.style.userSelect="none",E.style.webkitUserSelect="none",()=>{E.style.userSelect=aN,E.style.webkitUserSelect=aN}}},[m]),N.useEffect(()=>{if(d.current){const E=()=>{h(!1),l.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var v;((v=document.getSelection())==null?void 0:v.toString())!==""&&(l.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",E),()=>{document.removeEventListener("pointerup",E),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!1}}},[l.isPointerDownOnContentRef,l.hasSelectionRef]),N.useEffect(()=>{d.current&&vTe(d.current).forEach(b=>b.setAttribute("tabindex","-1"))}),A.jsx(nf,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:o,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:Le(i,E=>{E.preventDefault()}),onDismiss:l.onDismiss,children:A.jsx(c0,{...u,...s,onPointerDown:Le(s.onPointerDown,E=>{E.currentTarget.contains(E.target)&&h(!0),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!0}),ref:f,style:{...s.style,userSelect:m?"text":void 0,WebkitUserSelect:m?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),ETe="HoverCardArrow",STe=N.forwardRef((t,e)=>{const{__scopeHoverCard:n,...r}=t,a=jT(n);return A.jsx(u0,{...a,...r,ref:e})});STe.displayName=ETe;function KT(t){return e=>e.pointerType==="touch"?void 0:t()}function vTe(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)e.push(n.currentNode);return e}var yTe=vH,TTe=TH,AH=CH,CTe=yTe,ATe=TTe,RH=t=>{var e=t,{ref:n,className:r,align:a="center",sideOffset:i=4}=e,o=Mn(e,["ref","className","align","sideOffset"]);return A.jsx(AH,Qt({ref:n,align:a,sideOffset:i,className:Zt("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none",r)},o))};RH.displayName=AH.displayName;var RTe=["StartEvent","StopEvent","InputRequiredEvent","HumanResponseEvent","ChatDeltaEvent","InternalDispatchEvent","StepStateChanged","EventsQueueChanged"],Aa=class mme{constructor(e,n,r){Ch(this,"type"),Ch(this,"types"),Ch(this,"data"),Ch(this,"timestamp"),this.type=e,this.data=n,this.timestamp=new Date,this.types=r}static fromRawEvent(e){return wTe(e)?new OH(e.type,e.value,e.types):MH(e)?new oN(e.type,e.value,e.types):xTe(e)?new wH(e.type,e.value,e.types):NTe(e)?new xH(e.type,e.value,e.types):OTe(e)?new NH(e.type,e.value,e.types):ITe(e)?new IH(e.type,e.value,e.types):kTe(e)?new DH(e.type,e.value,e.types):DTe(e)?new kH(e.type,e.value,e.types):new mme(e.type,e.value,e.types)}toRawEvent(){var e,n;return{value:(e=this.data)!=null?e:{},qualified_name:this.type,types:(n=this.types)!=null?n:[],type:this.type}}},oN=class extends Aa{constructor(t,e,n){super(t,e,n)}},wH=class extends Aa{constructor(t,e,n){super(t,e,n)}},xH=class extends Aa{constructor(t,e,n){super(t,e,n)}},NH=class extends Aa{constructor(t,e,n){super(t,e,n)}},OH=class extends Aa{constructor(t,e,n){super(t,e,n)}},IH=class extends Aa{constructor(t,e,n){super(t,e,n)}},DH=class extends Aa{constructor(t,e,n){super(t,e,n)}},kH=class extends Aa{constructor(t,e,n){super(t,e,n)}};function wTe(t){var e,n;return t instanceof Aa?t instanceof OH:t.type==="StartEvent"?!0:(n=(e=t.types)==null?void 0:e.includes("StartEvent"))!=null?n:!1}function MH(t){var e,n;return t instanceof Aa?t instanceof oN:t.type==="StopEvent"?!0:(n=(e=t.types)==null?void 0:e.includes("StopEvent"))!=null?n:!1}function xTe(t){var e,n;return t instanceof Aa?t instanceof wH:t.type==="InputRequiredEvent"?!0:(n=(e=t.types)==null?void 0:e.includes("InputRequiredEvent"))!=null?n:!1}function NTe(t){var e,n;return t instanceof Aa?t instanceof xH:t.type==="HumanResponseEvent"?!0:(n=(e=t.types)==null?void 0:e.includes("HumanResponseEvent"))!=null?n:!1}function OTe(t){var e,n;return t instanceof Aa?t instanceof NH:t.type==="ChatDeltaEvent"?!0:(n=(e=t.types)==null?void 0:e.includes("ChatDeltaEvent"))!=null?n:!1}function ITe(t){var e,n;return t instanceof Aa?t instanceof IH:t.type==="InternalDispatchEvent"?!0:(n=(e=t.types)==null?void 0:e.includes("InternalDispatchEvent"))!=null?n:!1}function DTe(t){var e,n;return t instanceof Aa?t instanceof kH:t.type==="StepStateChanged"?!0:(n=(e=t.types)==null?void 0:e.includes("StepStateChanged"))!=null?n:!1}function kTe(t){var e,n;return t instanceof Aa?t instanceof DH:t.type==="EventsQueueChanged"?!0:(n=(e=t.types)==null?void 0:e.includes("EventsQueueChanged"))!=null?n:!1}function MTe(t){return RTe.includes(t.type)}var sN="Progress",lN=100,[LTe]=pa(sN),[PTe,FTe]=LTe(sN),LH=N.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:a,getValueLabel:i=UTe,...o}=t;(a||a===0)&&!BH(a)&&console.error(GTe(`${a}`,"Progress"));const s=BH(a)?a:lN;r!==null&&!UH(r,s)&&console.error(zTe(`${r}`,"Progress"));const l=UH(r,s)?r:null,u=XT(l)?i(l,s):void 0;return A.jsx(PTe,{scope:n,value:l,max:s,children:A.jsx(ft.div,{"aria-valuemax":s,"aria-valuemin":0,"aria-valuenow":XT(l)?l:void 0,"aria-valuetext":u,role:"progressbar","data-state":FH(l,s),"data-value":l??void 0,"data-max":s,...o,ref:e})})});LH.displayName=sN;var PH="ProgressIndicator",BTe=N.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,a=FTe(PH,n);return A.jsx(ft.div,{"data-state":FH(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...r,ref:e})});BTe.displayName=PH;function UTe(t,e){return`${Math.round(t/e*100)}%`}function FH(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function XT(t){return typeof t=="number"}function BH(t){return XT(t)&&!isNaN(t)&&t>0}function UH(t,e){return XT(t)&&!isNaN(t)&&t<=e&&t>=0}function GTe(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${lN}\`.`}function zTe(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be:
|
|
292
288
|
- a positive number
|
|
293
|
-
- less than the value passed to \`max\` (or ${
|
|
289
|
+
- less than the value passed to \`max\` (or ${lN} if no \`max\` prop is set)
|
|
294
290
|
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
295
291
|
|
|
296
|
-
Defaulting to \`null\`.`}var aCe=r$;aCe.displayName;var l$={};function iCe(){var t;try{const e=l$==null?void 0:l$.env;if((e==null?void 0:e.DEV)===!0||(e==null?void 0:e.MODE)==="development"||(e==null?void 0:e.PROD)===!1)return!0}catch{}return typeof process<"u"&&((t=process==null?void 0:process.env)!=null&&t.NODE_ENV),!1}var oCe=class{constructor(t){Ch(this,"name"),this.name=t}debug(t,...e){console.debug(`[${this.name}] ${t}`,...e)}info(t,...e){console.info(`[${this.name}] ${t}`,...e)}warn(t,...e){console.warn(`[${this.name}] ${t}`,...e)}error(t,...e){console.error(`[${this.name}] ${t}`,...e)}},sCe=class{debug(t,...e){}info(t,...e){}warn(t,...e){}error(t,...e){}},pf=iCe()?new oCe("llama-ui"):new sCe;const Ba=[];for(let t=0;t<256;++t)Ba.push((t+256).toString(16).slice(1));function lCe(t,e=0){return(Ba[t[e+0]]+Ba[t[e+1]]+Ba[t[e+2]]+Ba[t[e+3]]+"-"+Ba[t[e+4]]+Ba[t[e+5]]+"-"+Ba[t[e+6]]+Ba[t[e+7]]+"-"+Ba[t[e+8]]+Ba[t[e+9]]+"-"+Ba[t[e+10]]+Ba[t[e+11]]+Ba[t[e+12]]+Ba[t[e+13]]+Ba[t[e+14]]+Ba[t[e+15]]).toLowerCase()}let pN;const cCe=new Uint8Array(16);function uCe(){if(!pN){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");pN=crypto.getRandomValues.bind(crypto)}return pN(cCe)}const c$={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function dCe(t,e,n){var a;t=t||{};const r=t.random??((a=t.rng)==null?void 0:a.call(t))??uCe();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,lCe(r)}function pCe(t,e,n){return c$.randomUUID&&!t?c$.randomUUID():dCe(t)}function eQe(){}function tQe(){}function u$(t){const e=[],n=String(t||"");let r=n.indexOf(","),a=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const o=n.slice(a,r).trim();(o||!i)&&e.push(o),a=r+1,r=n.indexOf(",",a)}return e}function fCe(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const mCe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,hCe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,gCe={};function d$(t,e){return(gCe.jsx?hCe:mCe).test(t)}const _Ce=/[ \t\n\f\r]/g;function bCe(t){return typeof t=="object"?t.type==="text"?p$(t.value):!1:p$(t)}function p$(t){return t.replace(_Ce,"")===""}class O0{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}O0.prototype.normal={},O0.prototype.property={},O0.prototype.space=void 0;function f$(t,e){const n={},r={};for(const a of t)Object.assign(n,a.property),Object.assign(r,a.normal);return new O0(n,r,e)}function I0(t){return t.toLowerCase()}class Di{constructor(e,n){this.attribute=n,this.property=e}}Di.prototype.attribute="",Di.prototype.booleanish=!1,Di.prototype.boolean=!1,Di.prototype.commaOrSpaceSeparated=!1,Di.prototype.commaSeparated=!1,Di.prototype.defined=!1,Di.prototype.mustUseProperty=!1,Di.prototype.number=!1,Di.prototype.overloadedBoolean=!1,Di.prototype.property="",Di.prototype.spaceSeparated=!1,Di.prototype.space=void 0;let ECe=0;const Yt=ff(),ta=ff(),fN=ff(),qe=ff(),lr=ff(),Wh=ff(),oo=ff();function ff(){return 2**++ECe}const mN=Object.freeze(Object.defineProperty({__proto__:null,boolean:Yt,booleanish:ta,commaOrSpaceSeparated:oo,commaSeparated:Wh,number:qe,overloadedBoolean:fN,spaceSeparated:lr},Symbol.toStringTag,{value:"Module"})),hN=Object.keys(mN);class gN extends Di{constructor(e,n,r,a){let i=-1;if(super(e,n),m$(this,"space",a),typeof r=="number")for(;++i<hN.length;){const o=hN[i];m$(this,hN[i],(r&mN[o])===mN[o])}}}gN.prototype.defined=!0;function m$(t,e,n){n&&(t[e]=n)}function Kh(t){const e={},n={};for(const[r,a]of Object.entries(t.properties)){const i=new gN(r,t.transform(t.attributes||{},r),a,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),e[r]=i,n[I0(r)]=r,n[I0(i.attribute)]=r}return new O0(e,n,t.space)}const h$=Kh({properties:{ariaActiveDescendant:null,ariaAtomic:ta,ariaAutoComplete:null,ariaBusy:ta,ariaChecked:ta,ariaColCount:qe,ariaColIndex:qe,ariaColSpan:qe,ariaControls:lr,ariaCurrent:null,ariaDescribedBy:lr,ariaDetails:null,ariaDisabled:ta,ariaDropEffect:lr,ariaErrorMessage:null,ariaExpanded:ta,ariaFlowTo:lr,ariaGrabbed:ta,ariaHasPopup:null,ariaHidden:ta,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:lr,ariaLevel:qe,ariaLive:null,ariaModal:ta,ariaMultiLine:ta,ariaMultiSelectable:ta,ariaOrientation:null,ariaOwns:lr,ariaPlaceholder:null,ariaPosInSet:qe,ariaPressed:ta,ariaReadOnly:ta,ariaRelevant:null,ariaRequired:ta,ariaRoleDescription:lr,ariaRowCount:qe,ariaRowIndex:qe,ariaRowSpan:qe,ariaSelected:ta,ariaSetSize:qe,ariaSort:null,ariaValueMax:qe,ariaValueMin:qe,ariaValueNow:qe,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function g$(t,e){return e in t?t[e]:e}function _$(t,e){return g$(t,e.toLowerCase())}const SCe=Kh({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Wh,acceptCharset:lr,accessKey:lr,action:null,allow:null,allowFullScreen:Yt,allowPaymentRequest:Yt,allowUserMedia:Yt,alt:null,as:null,async:Yt,autoCapitalize:null,autoComplete:lr,autoFocus:Yt,autoPlay:Yt,blocking:lr,capture:null,charSet:null,checked:Yt,cite:null,className:lr,cols:qe,colSpan:null,content:null,contentEditable:ta,controls:Yt,controlsList:lr,coords:qe|Wh,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Yt,defer:Yt,dir:null,dirName:null,disabled:Yt,download:fN,draggable:ta,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Yt,formTarget:null,headers:lr,height:qe,hidden:fN,high:qe,href:null,hrefLang:null,htmlFor:lr,httpEquiv:lr,id:null,imageSizes:null,imageSrcSet:null,inert:Yt,inputMode:null,integrity:null,is:null,isMap:Yt,itemId:null,itemProp:lr,itemRef:lr,itemScope:Yt,itemType:lr,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Yt,low:qe,manifest:null,max:null,maxLength:qe,media:null,method:null,min:null,minLength:qe,multiple:Yt,muted:Yt,name:null,nonce:null,noModule:Yt,noValidate:Yt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Yt,optimum:qe,pattern:null,ping:lr,placeholder:null,playsInline:Yt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Yt,referrerPolicy:null,rel:lr,required:Yt,reversed:Yt,rows:qe,rowSpan:qe,sandbox:lr,scope:null,scoped:Yt,seamless:Yt,selected:Yt,shadowRootClonable:Yt,shadowRootDelegatesFocus:Yt,shadowRootMode:null,shape:null,size:qe,sizes:null,slot:null,span:qe,spellCheck:ta,src:null,srcDoc:null,srcLang:null,srcSet:null,start:qe,step:null,style:null,tabIndex:qe,target:null,title:null,translate:null,type:null,typeMustMatch:Yt,useMap:null,value:ta,width:qe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:lr,axis:null,background:null,bgColor:null,border:qe,borderColor:null,bottomMargin:qe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Yt,declare:Yt,event:null,face:null,frame:null,frameBorder:null,hSpace:qe,leftMargin:qe,link:null,longDesc:null,lowSrc:null,marginHeight:qe,marginWidth:qe,noResize:Yt,noHref:Yt,noShade:Yt,noWrap:Yt,object:null,profile:null,prompt:null,rev:null,rightMargin:qe,rules:null,scheme:null,scrolling:ta,standby:null,summary:null,text:null,topMargin:qe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:qe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Yt,disableRemotePlayback:Yt,prefix:null,property:null,results:qe,security:null,unselectable:null},space:"html",transform:_$}),vCe=Kh({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:oo,accentHeight:qe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:qe,amplitude:qe,arabicForm:null,ascent:qe,attributeName:null,attributeType:null,azimuth:qe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:qe,by:null,calcMode:null,capHeight:qe,className:lr,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:qe,diffuseConstant:qe,direction:null,display:null,dur:null,divisor:qe,dominantBaseline:null,download:Yt,dx:null,dy:null,edgeMode:null,editable:null,elevation:qe,enableBackground:null,end:null,event:null,exponent:qe,externalResourcesRequired:null,fill:null,fillOpacity:qe,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Wh,g2:Wh,glyphName:Wh,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:qe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:qe,horizOriginX:qe,horizOriginY:qe,id:null,ideographic:qe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:qe,k:qe,k1:qe,k2:qe,k3:qe,k4:qe,kernelMatrix:oo,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:qe,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:qe,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:qe,overlineThickness:qe,paintOrder:null,panose1:null,path:null,pathLength:qe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:lr,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:qe,pointsAtY:qe,pointsAtZ:qe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:oo,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:oo,rev:oo,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:oo,requiredFeatures:oo,requiredFonts:oo,requiredFormats:oo,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:qe,specularExponent:qe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:qe,strikethroughThickness:qe,string:null,stroke:null,strokeDashArray:oo,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:qe,strokeOpacity:qe,strokeWidth:null,style:null,surfaceScale:qe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:oo,tabIndex:qe,tableValues:null,target:null,targetX:qe,targetY:qe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:oo,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:qe,underlineThickness:qe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:qe,values:null,vAlphabetic:qe,vMathematical:qe,vectorEffect:null,vHanging:qe,vIdeographic:qe,version:null,vertAdvY:qe,vertOriginX:qe,vertOriginY:qe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:qe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:g$}),b$=Kh({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),E$=Kh({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:_$}),S$=Kh({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),yCe={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},TCe=/[A-Z]/g,v$=/-[a-z]/g,CCe=/^data[-\w.:]+$/i;function y$(t,e){const n=I0(e);let r=e,a=Di;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&CCe.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(v$,RCe);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!v$.test(i)){let o=i.replace(TCe,ACe);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}a=gN}return new a(r,e)}function ACe(t){return"-"+t.toLowerCase()}function RCe(t){return t.charAt(1).toUpperCase()}const T$=f$([h$,SCe,b$,E$,S$],"html"),nC=f$([h$,vCe,b$,E$,S$],"svg");function C$(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function wCe(t){return t.join(" ").trim()}var Xh={},_N,A$;function xCe(){if(A$)return _N;A$=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,s=/^\s+|\s+$/g,l=`
|
|
292
|
+
Defaulting to \`null\`.`}var qTe=LH;qTe.displayName;var QT="Dialog",[GH,zH]=pa(QT),[HTe,zs]=GH(QT),qH=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:o=!0}=t,s=N.useRef(null),l=N.useRef(null),[u,d]=Xo({prop:r,defaultProp:a??!1,onChange:i,caller:QT});return A.jsx(HTe,{scope:e,triggerRef:s,contentRef:l,contentId:bl(),titleId:bl(),descriptionId:bl(),open:u,onOpenChange:d,onOpenToggle:N.useCallback(()=>d(f=>!f),[d]),modal:o,children:n})};qH.displayName=QT;var HH="DialogTrigger",$H=N.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=zs(HH,n),i=It(e,a.triggerRef);return A.jsx(ft.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":dN(a.open),...r,ref:i,onClick:Le(t.onClick,a.onOpenToggle)})});$H.displayName=HH;var cN="DialogPortal",[$Te,YH]=GH(cN,{forceMount:void 0}),VH=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:a}=t,i=zs(cN,e);return A.jsx($Te,{scope:e,forceMount:n,children:N.Children.map(r,o=>A.jsx(Fa,{present:n||i.open,children:A.jsx(d0,{asChild:!0,container:a,children:o})}))})};VH.displayName=cN;var ZT="DialogOverlay",jH=N.forwardRef((t,e)=>{const n=YH(ZT,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,i=zs(ZT,t.__scopeDialog);return i.modal?A.jsx(Fa,{present:r||i.open,children:A.jsx(VTe,{...a,ref:e})}):null});jH.displayName=ZT;var YTe=rd("DialogOverlay.RemoveScroll"),VTe=N.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=zs(ZT,n);return A.jsx(p0,{as:YTe,allowPinchZoom:!0,shards:[a.contentRef],children:A.jsx(ft.div,{"data-state":dN(a.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),df="DialogContent",WH=N.forwardRef((t,e)=>{const n=YH(df,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,i=zs(df,t.__scopeDialog);return A.jsx(Fa,{present:r||i.open,children:i.modal?A.jsx(jTe,{...a,ref:e}):A.jsx(WTe,{...a,ref:e})})});WH.displayName=df;var jTe=N.forwardRef((t,e)=>{const n=zs(df,t.__scopeDialog),r=N.useRef(null),a=It(e,n.contentRef,r);return N.useEffect(()=>{const i=r.current;if(i)return uT(i)},[]),A.jsx(KH,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Le(t.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Le(t.onPointerDownOutside,i=>{const o=i.detail.originalEvent,s=o.button===0&&o.ctrlKey===!0;(o.button===2||s)&&i.preventDefault()}),onFocusOutside:Le(t.onFocusOutside,i=>i.preventDefault())})}),WTe=N.forwardRef((t,e)=>{const n=zs(df,t.__scopeDialog),r=N.useRef(!1),a=N.useRef(!1);return A.jsx(KH,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,s;(o=t.onCloseAutoFocus)==null||o.call(t,i),i.defaultPrevented||(r.current||(s=n.triggerRef.current)==null||s.focus(),i.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:i=>{var l,u;(l=t.onInteractOutside)==null||l.call(t,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const o=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),KH=N.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,...o}=t,s=zs(df,n),l=N.useRef(null),u=It(e,l);return Ky(),A.jsxs(A.Fragment,{children:[A.jsx(i0,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:A.jsx(nf,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":dN(s.open),...o,ref:u,onDismiss:()=>s.onOpenChange(!1)})}),A.jsxs(A.Fragment,{children:[A.jsx(XTe,{titleId:s.titleId}),A.jsx(ZTe,{contentRef:l,descriptionId:s.descriptionId})]})]})}),uN="DialogTitle",XH=N.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=zs(uN,n);return A.jsx(ft.h2,{id:a.titleId,...r,ref:e})});XH.displayName=uN;var QH="DialogDescription",ZH=N.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=zs(QH,n);return A.jsx(ft.p,{id:a.descriptionId,...r,ref:e})});ZH.displayName=QH;var JH="DialogClose",e$=N.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=zs(JH,n);return A.jsx(ft.button,{type:"button",...r,ref:e,onClick:Le(t.onClick,()=>a.onOpenChange(!1))})});e$.displayName=JH;function dN(t){return t?"open":"closed"}var t$="DialogTitleWarning",[KTe,n$]=Fge(t$,{contentName:df,titleName:uN,docsSlug:"dialog"}),XTe=({titleId:t})=>{const e=n$(t$),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
|
|
293
|
+
|
|
294
|
+
If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
295
|
+
|
|
296
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return N.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},QTe="DialogDescriptionWarning",ZTe=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${n$(QTe).contentName}}.`;return N.useEffect(()=>{var i;const a=(i=t.current)==null?void 0:i.getAttribute("aria-describedby");e&&a&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},JTe=qH,r$=$H,eCe=VH,x0=jH,N0=WH,JT=XH,eC=ZH,tC=e$,tCe=JTe,nCe=r$,rCe=eCe,aCe=tC,a$=t=>{var e=t,{ref:n,className:r}=e,a=Mn(e,["ref","className"]);return A.jsx(x0,Qt({ref:n,className:Zt("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80",r)},a))};a$.displayName=x0.displayName;var i$=t=>{var e=t,{ref:n,className:r,children:a,breakpoint:i="lg"}=e,o=Mn(e,["ref","className","children","breakpoint"]);return A.jsxs(rCe,{children:[A.jsx(a$,{}),A.jsxs(N0,Rr(Qt({ref:n,className:Zt("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] fixed left-1/2 top-1/2 z-50 flex w-full max-w-[425px] -translate-x-1/2 -translate-y-1/2 flex-col gap-4 rounded-lg border bg-background p-6 shadow-[0_10px_15px_-3px_rgba(0,0,0,0.1),0_4px_6px_-4px_rgba(0,0,0,0.1)]",r),"data-breakpoint":i},o),{children:[a,A.jsxs(tC,{className:"rounded-xs absolute right-[15px] top-[15px] opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[A.jsx(QG,{className:"size-4"}),A.jsx("span",{className:"sr-only",children:"Close"})]})]}))]})};i$.displayName=N0.displayName;var o$=({title:t,description:e,icon:n,breakpoint:r="lg","da-cid":a})=>!t&&!e&&!n?null:A.jsxs("div",{className:Zt("flex flex-col gap-4",r==="sm"&&"text-center"),"da-cid":a,children:[n&&A.jsx("div",{className:Zt("shadow-xs flex size-8 items-center justify-center rounded-sm border bg-background p-2 [&_svg]:size-4",r==="sm"&&"mx-auto"),children:n}),(t||e)&&A.jsxs("div",{className:"flex flex-col gap-1.5",children:[t&&A.jsx(JT,{className:"text-lg font-semibold leading-none text-foreground",children:t}),e&&A.jsx(eC,{className:"text-sm leading-5 text-muted-foreground",children:e})]})]});o$.displayName="DialogHeader";var jh=(t,e,n)=>{const r=A.jsx(Xn,{fullWidth:n,variant:t.isDestructive?"destructive":e,onClick:t.onClick,disabled:t.disabled||t.loading,label:t.label,startIcon:t.icon,type:t.type,form:t.form,isLoading:t.loading});return t.asDialogClose?A.jsx(aCe,{asChild:!0,children:r}):r},s$=({primary:t,secondary:e,tertiary:n,breakpoint:r="lg",children:a,"da-cid":i})=>!t&&!e&&!n&&!a?null:r==="lg"?A.jsxs("div",{className:"flex flex-col gap-6","da-cid":i,children:[a,(t||e||n)&&A.jsxs("div",{className:"flex items-center gap-6",children:[n&&jh(n,"ghost"),A.jsxs("div",{className:"flex flex-1 items-center justify-end gap-2",children:[e&&jh(e,"outline"),t&&jh(t,"default")]})]})]}):A.jsxs("div",{className:"flex flex-col gap-6","da-cid":i,children:[a,(t||e||n)&&A.jsxs("div",{className:"flex flex-col items-center gap-2",children:[A.jsxs("div",{className:"flex w-full items-center gap-2",children:[e&&A.jsx("div",{className:"flex-1",children:jh(e,"outline",!0)}),t&&A.jsx("div",{className:"flex-1",children:jh(t,"default",!0)})]}),n&&jh(n,"ghost")]})]});s$.displayName="DialogFooter";var l$={};function iCe(){var t;try{const e=l$==null?void 0:l$.env;if((e==null?void 0:e.DEV)===!0||(e==null?void 0:e.MODE)==="development"||(e==null?void 0:e.PROD)===!1)return!0}catch{}return typeof process<"u"&&((t=process==null?void 0:process.env)!=null&&t.NODE_ENV),!1}var oCe=class{constructor(t){Ch(this,"name"),this.name=t}debug(t,...e){console.debug(`[${this.name}] ${t}`,...e)}info(t,...e){console.info(`[${this.name}] ${t}`,...e)}warn(t,...e){console.warn(`[${this.name}] ${t}`,...e)}error(t,...e){console.error(`[${this.name}] ${t}`,...e)}},sCe=class{debug(t,...e){}info(t,...e){}warn(t,...e){}error(t,...e){}},pf=iCe()?new oCe("llama-ui"):new sCe;const Ba=[];for(let t=0;t<256;++t)Ba.push((t+256).toString(16).slice(1));function lCe(t,e=0){return(Ba[t[e+0]]+Ba[t[e+1]]+Ba[t[e+2]]+Ba[t[e+3]]+"-"+Ba[t[e+4]]+Ba[t[e+5]]+"-"+Ba[t[e+6]]+Ba[t[e+7]]+"-"+Ba[t[e+8]]+Ba[t[e+9]]+"-"+Ba[t[e+10]]+Ba[t[e+11]]+Ba[t[e+12]]+Ba[t[e+13]]+Ba[t[e+14]]+Ba[t[e+15]]).toLowerCase()}let pN;const cCe=new Uint8Array(16);function uCe(){if(!pN){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");pN=crypto.getRandomValues.bind(crypto)}return pN(cCe)}const c$={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function dCe(t,e,n){var a;t=t||{};const r=t.random??((a=t.rng)==null?void 0:a.call(t))??uCe();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,lCe(r)}function pCe(t,e,n){return c$.randomUUID&&!t?c$.randomUUID():dCe(t)}function eQe(){}function tQe(){}function u$(t){const e=[],n=String(t||"");let r=n.indexOf(","),a=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const o=n.slice(a,r).trim();(o||!i)&&e.push(o),a=r+1,r=n.indexOf(",",a)}return e}function fCe(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const mCe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,hCe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,gCe={};function d$(t,e){return(gCe.jsx?hCe:mCe).test(t)}const _Ce=/[ \t\n\f\r]/g;function bCe(t){return typeof t=="object"?t.type==="text"?p$(t.value):!1:p$(t)}function p$(t){return t.replace(_Ce,"")===""}class O0{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}O0.prototype.normal={},O0.prototype.property={},O0.prototype.space=void 0;function f$(t,e){const n={},r={};for(const a of t)Object.assign(n,a.property),Object.assign(r,a.normal);return new O0(n,r,e)}function I0(t){return t.toLowerCase()}class Di{constructor(e,n){this.attribute=n,this.property=e}}Di.prototype.attribute="",Di.prototype.booleanish=!1,Di.prototype.boolean=!1,Di.prototype.commaOrSpaceSeparated=!1,Di.prototype.commaSeparated=!1,Di.prototype.defined=!1,Di.prototype.mustUseProperty=!1,Di.prototype.number=!1,Di.prototype.overloadedBoolean=!1,Di.prototype.property="",Di.prototype.spaceSeparated=!1,Di.prototype.space=void 0;let ECe=0;const Yt=ff(),ta=ff(),fN=ff(),qe=ff(),lr=ff(),Wh=ff(),oo=ff();function ff(){return 2**++ECe}const mN=Object.freeze(Object.defineProperty({__proto__:null,boolean:Yt,booleanish:ta,commaOrSpaceSeparated:oo,commaSeparated:Wh,number:qe,overloadedBoolean:fN,spaceSeparated:lr},Symbol.toStringTag,{value:"Module"})),hN=Object.keys(mN);class gN extends Di{constructor(e,n,r,a){let i=-1;if(super(e,n),m$(this,"space",a),typeof r=="number")for(;++i<hN.length;){const o=hN[i];m$(this,hN[i],(r&mN[o])===mN[o])}}}gN.prototype.defined=!0;function m$(t,e,n){n&&(t[e]=n)}function Kh(t){const e={},n={};for(const[r,a]of Object.entries(t.properties)){const i=new gN(r,t.transform(t.attributes||{},r),a,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),e[r]=i,n[I0(r)]=r,n[I0(i.attribute)]=r}return new O0(e,n,t.space)}const h$=Kh({properties:{ariaActiveDescendant:null,ariaAtomic:ta,ariaAutoComplete:null,ariaBusy:ta,ariaChecked:ta,ariaColCount:qe,ariaColIndex:qe,ariaColSpan:qe,ariaControls:lr,ariaCurrent:null,ariaDescribedBy:lr,ariaDetails:null,ariaDisabled:ta,ariaDropEffect:lr,ariaErrorMessage:null,ariaExpanded:ta,ariaFlowTo:lr,ariaGrabbed:ta,ariaHasPopup:null,ariaHidden:ta,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:lr,ariaLevel:qe,ariaLive:null,ariaModal:ta,ariaMultiLine:ta,ariaMultiSelectable:ta,ariaOrientation:null,ariaOwns:lr,ariaPlaceholder:null,ariaPosInSet:qe,ariaPressed:ta,ariaReadOnly:ta,ariaRelevant:null,ariaRequired:ta,ariaRoleDescription:lr,ariaRowCount:qe,ariaRowIndex:qe,ariaRowSpan:qe,ariaSelected:ta,ariaSetSize:qe,ariaSort:null,ariaValueMax:qe,ariaValueMin:qe,ariaValueNow:qe,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function g$(t,e){return e in t?t[e]:e}function _$(t,e){return g$(t,e.toLowerCase())}const SCe=Kh({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Wh,acceptCharset:lr,accessKey:lr,action:null,allow:null,allowFullScreen:Yt,allowPaymentRequest:Yt,allowUserMedia:Yt,alt:null,as:null,async:Yt,autoCapitalize:null,autoComplete:lr,autoFocus:Yt,autoPlay:Yt,blocking:lr,capture:null,charSet:null,checked:Yt,cite:null,className:lr,cols:qe,colSpan:null,content:null,contentEditable:ta,controls:Yt,controlsList:lr,coords:qe|Wh,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Yt,defer:Yt,dir:null,dirName:null,disabled:Yt,download:fN,draggable:ta,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Yt,formTarget:null,headers:lr,height:qe,hidden:fN,high:qe,href:null,hrefLang:null,htmlFor:lr,httpEquiv:lr,id:null,imageSizes:null,imageSrcSet:null,inert:Yt,inputMode:null,integrity:null,is:null,isMap:Yt,itemId:null,itemProp:lr,itemRef:lr,itemScope:Yt,itemType:lr,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Yt,low:qe,manifest:null,max:null,maxLength:qe,media:null,method:null,min:null,minLength:qe,multiple:Yt,muted:Yt,name:null,nonce:null,noModule:Yt,noValidate:Yt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Yt,optimum:qe,pattern:null,ping:lr,placeholder:null,playsInline:Yt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Yt,referrerPolicy:null,rel:lr,required:Yt,reversed:Yt,rows:qe,rowSpan:qe,sandbox:lr,scope:null,scoped:Yt,seamless:Yt,selected:Yt,shadowRootClonable:Yt,shadowRootDelegatesFocus:Yt,shadowRootMode:null,shape:null,size:qe,sizes:null,slot:null,span:qe,spellCheck:ta,src:null,srcDoc:null,srcLang:null,srcSet:null,start:qe,step:null,style:null,tabIndex:qe,target:null,title:null,translate:null,type:null,typeMustMatch:Yt,useMap:null,value:ta,width:qe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:lr,axis:null,background:null,bgColor:null,border:qe,borderColor:null,bottomMargin:qe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Yt,declare:Yt,event:null,face:null,frame:null,frameBorder:null,hSpace:qe,leftMargin:qe,link:null,longDesc:null,lowSrc:null,marginHeight:qe,marginWidth:qe,noResize:Yt,noHref:Yt,noShade:Yt,noWrap:Yt,object:null,profile:null,prompt:null,rev:null,rightMargin:qe,rules:null,scheme:null,scrolling:ta,standby:null,summary:null,text:null,topMargin:qe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:qe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Yt,disableRemotePlayback:Yt,prefix:null,property:null,results:qe,security:null,unselectable:null},space:"html",transform:_$}),vCe=Kh({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:oo,accentHeight:qe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:qe,amplitude:qe,arabicForm:null,ascent:qe,attributeName:null,attributeType:null,azimuth:qe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:qe,by:null,calcMode:null,capHeight:qe,className:lr,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:qe,diffuseConstant:qe,direction:null,display:null,dur:null,divisor:qe,dominantBaseline:null,download:Yt,dx:null,dy:null,edgeMode:null,editable:null,elevation:qe,enableBackground:null,end:null,event:null,exponent:qe,externalResourcesRequired:null,fill:null,fillOpacity:qe,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Wh,g2:Wh,glyphName:Wh,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:qe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:qe,horizOriginX:qe,horizOriginY:qe,id:null,ideographic:qe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:qe,k:qe,k1:qe,k2:qe,k3:qe,k4:qe,kernelMatrix:oo,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:qe,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:qe,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:qe,overlineThickness:qe,paintOrder:null,panose1:null,path:null,pathLength:qe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:lr,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:qe,pointsAtY:qe,pointsAtZ:qe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:oo,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:oo,rev:oo,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:oo,requiredFeatures:oo,requiredFonts:oo,requiredFormats:oo,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:qe,specularExponent:qe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:qe,strikethroughThickness:qe,string:null,stroke:null,strokeDashArray:oo,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:qe,strokeOpacity:qe,strokeWidth:null,style:null,surfaceScale:qe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:oo,tabIndex:qe,tableValues:null,target:null,targetX:qe,targetY:qe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:oo,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:qe,underlineThickness:qe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:qe,values:null,vAlphabetic:qe,vMathematical:qe,vectorEffect:null,vHanging:qe,vIdeographic:qe,version:null,vertAdvY:qe,vertOriginX:qe,vertOriginY:qe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:qe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:g$}),b$=Kh({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),E$=Kh({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:_$}),S$=Kh({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),yCe={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},TCe=/[A-Z]/g,v$=/-[a-z]/g,CCe=/^data[-\w.:]+$/i;function y$(t,e){const n=I0(e);let r=e,a=Di;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&CCe.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(v$,RCe);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!v$.test(i)){let o=i.replace(TCe,ACe);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}a=gN}return new a(r,e)}function ACe(t){return"-"+t.toLowerCase()}function RCe(t){return t.charAt(1).toUpperCase()}const T$=f$([h$,SCe,b$,E$,S$],"html"),nC=f$([h$,vCe,b$,E$,S$],"svg");function C$(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function wCe(t){return t.join(" ").trim()}var Xh={},_N,A$;function xCe(){if(A$)return _N;A$=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,s=/^\s+|\s+$/g,l=`
|
|
297
297
|
`,u="/",d="*",f="",m="comment",h="declaration";_N=function(b,v){if(typeof b!="string")throw new TypeError("First argument must be a string");if(!b)return[];v=v||{};var y=1,C=1;function T(Q){var U=Q.match(e);U&&(y+=U.length);var K=Q.lastIndexOf(l);C=~K?Q.length-K:C+Q.length}function w(){var Q={line:y,column:C};return function(U){return U.position=new O(Q),M(),U}}function O(Q){this.start=Q,this.end={line:y,column:C},this.source=v.source}O.prototype.content=b;function x(Q){var U=new Error(v.source+":"+y+":"+C+": "+Q);if(U.reason=Q,U.filename=v.source,U.line=y,U.column=C,U.source=b,!v.silent)throw U}function D(Q){var U=Q.exec(b);if(U){var K=U[0];return T(K),b=b.slice(K.length),U}}function M(){D(n)}function F(Q){var U;for(Q=Q||[];U=P();)U!==!1&&Q.push(U);return Q}function P(){var Q=w();if(!(u!=b.charAt(0)||d!=b.charAt(1))){for(var U=2;f!=b.charAt(U)&&(d!=b.charAt(U)||u!=b.charAt(U+1));)++U;if(U+=2,f===b.charAt(U-1))return x("End of comment missing");var K=b.slice(2,U-2);return C+=2,T(K),b=b.slice(U),C+=2,Q({type:m,comment:K})}}function q(){var Q=w(),U=D(r);if(U){if(P(),!D(a))return x("property missing ':'");var K=D(i),G=Q({type:h,property:E(U[0].replace(t,f)),value:K?E(K[0].replace(t,f)):f});return D(o),G}}function j(){var Q=[];F(Q);for(var U;U=q();)U!==!1&&(Q.push(U),F(Q));return Q}return M(),j()};function E(b){return b?b.replace(s,f):f}return _N}var R$;function NCe(){if(R$)return Xh;R$=1;var t=Xh&&Xh.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Xh,"__esModule",{value:!0}),Xh.default=n;const e=t(xCe());function n(r,a){let i=null;if(!r||typeof r!="string")return i;const o=(0,e.default)(r),s=typeof a=="function";return o.forEach(l=>{if(l.type!=="declaration")return;const{property:u,value:d}=l;s?a(u,d,l):d&&(i=i||{},i[u]=d)}),i}return Xh}var D0={},w$;function OCe(){if(w$)return D0;w$=1,Object.defineProperty(D0,"__esModule",{value:!0}),D0.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,i=function(u){return!u||n.test(u)||t.test(u)},o=function(u,d){return d.toUpperCase()},s=function(u,d){return"".concat(d,"-")},l=function(u,d){return d===void 0&&(d={}),i(u)?u:(u=u.toLowerCase(),d.reactCompat?u=u.replace(a,s):u=u.replace(r,s),u.replace(e,o))};return D0.camelCase=l,D0}var k0,x$;function ICe(){if(x$)return k0;x$=1;var t=k0&&k0.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},e=t(NCe()),n=OCe();function r(a,i){var o={};return!a||typeof a!="string"||(0,e.default)(a,function(s,l){s&&l&&(o[(0,n.camelCase)(s,i)]=l)}),o}return r.default=r,k0=r,k0}var DCe=ICe();const kCe=no(DCe),N$=O$("end"),bN=O$("start");function O$(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function MCe(t){const e=bN(t),n=N$(t);if(e&&n)return{start:e,end:n}}function M0(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?I$(t.position):"start"in t||"end"in t?I$(t):"line"in t||"column"in t?EN(t):""}function EN(t){return D$(t&&t.line)+":"+D$(t&&t.column)}function I$(t){return EN(t&&t.start)+"-"+EN(t&&t.end)}function D$(t){return t&&typeof t=="number"?t:1}class ti extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof e=="string"?a=e:!i.cause&&e&&(o=!0,a=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const s=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=s?s.line:void 0,this.name=M0(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}ti.prototype.file="",ti.prototype.name="",ti.prototype.reason="",ti.prototype.message="",ti.prototype.stack="",ti.prototype.column=void 0,ti.prototype.line=void 0,ti.prototype.ancestors=void 0,ti.prototype.cause=void 0,ti.prototype.fatal=void 0,ti.prototype.place=void 0,ti.prototype.ruleId=void 0,ti.prototype.source=void 0;const SN={}.hasOwnProperty,LCe=new Map,PCe=/[A-Z]/g,FCe=new Set(["table","tbody","thead","tfoot","tr"]),BCe=new Set(["td","th"]),k$="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function UCe(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=jCe(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=VCe(n,e.jsx,e.jsxs)}const a={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?nC:T$,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},i=M$(a,t,void 0);return i&&typeof i!="string"?i:a.create(t,a.Fragment,{children:i||void 0},void 0)}function M$(t,e,n){if(e.type==="element")return GCe(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return zCe(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return HCe(t,e,n);if(e.type==="mdxjsEsm")return qCe(t,e);if(e.type==="root")return $Ce(t,e,n);if(e.type==="text")return YCe(t,e)}function GCe(t,e,n){const r=t.schema;let a=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=nC,t.schema=a),t.ancestors.push(e);const i=P$(t,e.tagName,!1),o=WCe(t,e);let s=yN(t,e);return FCe.has(e.tagName)&&(s=s.filter(function(l){return typeof l=="string"?!bCe(l):!0})),L$(t,o,i,e),vN(o,s),t.ancestors.pop(),t.schema=r,t.create(e,i,o,n)}function zCe(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}L0(t,e.position)}function qCe(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);L0(t,e.position)}function HCe(t,e,n){const r=t.schema;let a=r;e.name==="svg"&&r.space==="html"&&(a=nC,t.schema=a),t.ancestors.push(e);const i=e.name===null?t.Fragment:P$(t,e.name,!0),o=KCe(t,e),s=yN(t,e);return L$(t,o,i,e),vN(o,s),t.ancestors.pop(),t.schema=r,t.create(e,i,o,n)}function $Ce(t,e,n){const r={};return vN(r,yN(t,e)),t.create(e,t.Fragment,r,n)}function YCe(t,e){return e.value}function L$(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function vN(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function VCe(t,e,n){return r;function r(a,i,o,s){const u=Array.isArray(o.children)?n:e;return s?u(i,o,s):u(i,o)}}function jCe(t,e){return n;function n(r,a,i,o){const s=Array.isArray(i.children),l=bN(r);return e(a,i,o,s,{columnNumber:l?l.column-1:void 0,fileName:t,lineNumber:l?l.line:void 0},void 0)}}function WCe(t,e){const n={};let r,a;for(a in e.properties)if(a!=="children"&&SN.call(e.properties,a)){const i=XCe(t,a,e.properties[a]);if(i){const[o,s]=i;t.tableCellAlignToStyle&&o==="align"&&typeof s=="string"&&BCe.has(e.tagName)?r=s:n[o]=s}}if(r){const i=n.style||(n.style={});i[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function KCe(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const i=r.data.estree.body[0];i.type;const o=i.expression;o.type;const s=o.properties[0];s.type,Object.assign(n,t.evaluater.evaluateExpression(s.argument))}else L0(t,e.position);else{const a=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const s=r.value.data.estree.body[0];s.type,i=t.evaluater.evaluateExpression(s.expression)}else L0(t,e.position);else i=r.value===null?!0:r.value;n[a]=i}return n}function yN(t,e){const n=[];let r=-1;const a=t.passKeys?new Map:LCe;for(;++r<e.children.length;){const i=e.children[r];let o;if(t.passKeys){const l=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(l){const u=a.get(l)||0;o=l+"-"+u,a.set(l,u+1)}}const s=M$(t,i,o);s!==void 0&&n.push(s)}return n}function XCe(t,e,n){const r=y$(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?fCe(n):wCe(n)),r.property==="style"){let a=typeof n=="object"?n:QCe(t,String(n));return t.stylePropertyNameCase==="css"&&(a=ZCe(a)),["style",a]}return[t.elementAttributeNameCase==="react"&&r.space?yCe[r.property]||r.property:r.attribute,n]}}function QCe(t,e){try{return kCe(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const r=n,a=new ti("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=t.filePath||void 0,a.url=k$+"#cannot-parse-style-attribute",a}}function P$(t,e,n){let r;if(!n)r={type:"Literal",value:e};else if(e.includes(".")){const a=e.split(".");let i=-1,o;for(;++i<a.length;){const s=d$(a[i])?{type:"Identifier",name:a[i]}:{type:"Literal",value:a[i]};o=o?{type:"MemberExpression",object:o,property:s,computed:!!(i&&s.type==="Literal"),optional:!1}:s}r=o}else r=d$(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(r.type==="Literal"){const a=r.value;return SN.call(t.components,a)?t.components[a]:a}if(t.evaluater)return t.evaluater.evaluateExpression(r);L0(t)}function L0(t,e){const n=new ti("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=k$+"#cannot-handle-mdx-estrees-without-createevaluater",n}function ZCe(t){const e={};let n;for(n in t)SN.call(t,n)&&(e[JCe(n)]=t[n]);return e}function JCe(t){let e=t.replace(PCe,eAe);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function eAe(t){return"-"+t.toLowerCase()}const TN={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},tAe={};function CN(t,e){const n=tAe,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return F$(t,r,a)}function F$(t,e,n){if(nAe(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return B$(t.children,e,n)}return Array.isArray(t)?B$(t,e,n):""}function B$(t,e,n){const r=[];let a=-1;for(;++a<t.length;)r[a]=F$(t[a],e,n);return r.join("")}function nAe(t){return!!(t&&typeof t=="object")}const U$=document.createElement("i");function AN(t){const e="&"+t+";";U$.innerHTML=e;const n=U$.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function so(t,e,n,r){const a=t.length;let i=0,o;if(e<0?e=-e>a?0:a+e:e=e>a?a:e,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(e,n),t.splice(...o);else for(n&&t.splice(e,n);i<r.length;)o=r.slice(i,i+1e4),o.unshift(e,0),t.splice(...o),i+=1e4,e+=1e4}function Zo(t,e){return t.length>0?(so(t,t.length,0,e),t):e}const G$={}.hasOwnProperty;function z$(t){const e={};let n=-1;for(;++n<t.length;)rAe(e,t[n]);return e}function rAe(t,e){let n;for(n in e){const a=(G$.call(t,n)?t[n]:void 0)||(t[n]={}),i=e[n];let o;if(i)for(o in i){G$.call(a,o)||(a[o]=[]);const s=i[o];aAe(a[o],Array.isArray(s)?s:s?[s]:[])}}}function aAe(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);so(t,0,0,r)}function q$(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function qs(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const gi=fd(/[A-Za-z]/),ni=fd(/[\dA-Za-z]/),iAe=fd(/[#-'*+\--9=?A-Z^-~]/);function rC(t){return t!==null&&(t<32||t===127)}const RN=fd(/\d/),oAe=fd(/[\dA-Fa-f]/),sAe=fd(/[!-/:-@[-`{-~]/);function bt(t){return t!==null&&t<-2}function Zn(t){return t!==null&&(t<0||t===32)}function on(t){return t===-2||t===-1||t===32}const aC=fd(new RegExp("\\p{P}|\\p{S}","u")),mf=fd(/\s/);function fd(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Qh(t){const e=[];let n=-1,r=0,a=0;for(;++n<t.length;){const i=t.charCodeAt(n);let o="";if(i===37&&ni(t.charCodeAt(n+1))&&ni(t.charCodeAt(n+2)))a=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const s=t.charCodeAt(n+1);i<56320&&s>56319&&s<57344?(o=String.fromCharCode(i,s),a=1):o="�"}else o=String.fromCharCode(i);o&&(e.push(t.slice(r,n),encodeURIComponent(o)),r=n+a+1,o=""),a&&(n+=a,a=0)}return e.join("")+t.slice(r)}function rn(t,e,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(l){return on(l)?(t.enter(n),s(l)):e(l)}function s(l){return on(l)&&i++<a?(t.consume(l),s):(t.exit(n),e(l))}}const lAe={tokenize:cAe};function cAe(t){const e=t.attempt(this.parser.constructs.contentInitial,r,a);let n;return e;function r(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),rn(t,e,"linePrefix")}function a(s){return t.enter("paragraph"),i(s)}function i(s){const l=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(s)}function o(s){if(s===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(s);return}return bt(s)?(t.consume(s),t.exit("chunkText"),i):(t.consume(s),o)}}const uAe={tokenize:dAe},H$={tokenize:pAe};function dAe(t){const e=this,n=[];let r=0,a,i,o;return s;function s(T){if(r<n.length){const w=n[r];return e.containerState=w[1],t.attempt(w[0].continuation,l,u)(T)}return u(T)}function l(T){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,a&&C();const w=e.events.length;let O=w,x;for(;O--;)if(e.events[O][0]==="exit"&&e.events[O][1].type==="chunkFlow"){x=e.events[O][1].end;break}y(r);let D=w;for(;D<e.events.length;)e.events[D][1].end={...x},D++;return so(e.events,O+1,0,e.events.slice(w)),e.events.length=D,u(T)}return s(T)}function u(T){if(r===n.length){if(!a)return m(T);if(a.currentConstruct&&a.currentConstruct.concrete)return E(T);e.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(H$,d,f)(T)}function d(T){return a&&C(),y(r),m(T)}function f(T){return e.parser.lazy[e.now().line]=r!==n.length,o=e.now().offset,E(T)}function m(T){return e.containerState={},t.attempt(H$,h,E)(T)}function h(T){return r++,n.push([e.currentConstruct,e.containerState]),m(T)}function E(T){if(T===null){a&&C(),y(0),t.consume(T);return}return a=a||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:i}),b(T)}function b(T){if(T===null){v(t.exit("chunkFlow"),!0),y(0),t.consume(T);return}return bt(T)?(t.consume(T),v(t.exit("chunkFlow")),r=0,e.interrupt=void 0,s):(t.consume(T),b)}function v(T,w){const O=e.sliceStream(T);if(w&&O.push(null),T.previous=i,i&&(i.next=T),i=T,a.defineSkip(T.start),a.write(O),e.parser.lazy[T.start.line]){let x=a.events.length;for(;x--;)if(a.events[x][1].start.offset<o&&(!a.events[x][1].end||a.events[x][1].end.offset>o))return;const D=e.events.length;let M=D,F,P;for(;M--;)if(e.events[M][0]==="exit"&&e.events[M][1].type==="chunkFlow"){if(F){P=e.events[M][1].end;break}F=!0}for(y(r),x=D;x<e.events.length;)e.events[x][1].end={...P},x++;so(e.events,M+1,0,e.events.slice(D)),e.events.length=x}}function y(T){let w=n.length;for(;w-- >T;){const O=n[w];e.containerState=O[1],O[0].exit.call(e,t)}n.length=T}function C(){a.write([null]),i=void 0,a=void 0,e.containerState._closeFlow=void 0}}function pAe(t,e,n){return rn(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Zh(t){if(t===null||Zn(t)||mf(t))return 1;if(aC(t))return 2}function iC(t,e,n){const r=[];let a=-1;for(;++a<t.length;){const i=t[a].resolveAll;i&&!r.includes(i)&&(e=i(e,n),r.push(i))}return e}const wN={name:"attention",resolveAll:fAe,tokenize:mAe};function fAe(t,e){let n=-1,r,a,i,o,s,l,u,d;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;l=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const f={...t[r][1].end},m={...t[n][1].start};$$(f,-l),$$(m,l),o={type:l>1?"strongSequence":"emphasisSequence",start:f,end:{...t[r][1].end}},s={type:l>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:m},i={type:l>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},a={type:l>1?"strong":"emphasis",start:{...o.start},end:{...s.end}},t[r][1].end={...o.start},t[n][1].start={...s.end},u=[],t[r][1].end.offset-t[r][1].start.offset&&(u=Zo(u,[["enter",t[r][1],e],["exit",t[r][1],e]])),u=Zo(u,[["enter",a,e],["enter",o,e],["exit",o,e],["enter",i,e]]),u=Zo(u,iC(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),u=Zo(u,[["exit",i,e],["enter",s,e],["exit",s,e],["exit",a,e]]),t[n][1].end.offset-t[n][1].start.offset?(d=2,u=Zo(u,[["enter",t[n][1],e],["exit",t[n][1],e]])):d=0,so(t,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function mAe(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Zh(r);let i;return o;function o(l){return i=l,t.enter("attentionSequence"),s(l)}function s(l){if(l===i)return t.consume(l),s;const u=t.exit("attentionSequence"),d=Zh(l),f=!d||d===2&&a||n.includes(l),m=!a||a===2&&d||n.includes(r);return u._open=!!(i===42?f:f&&(a||!m)),u._close=!!(i===42?m:m&&(d||!f)),e(l)}}function $$(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const hAe={name:"autolink",tokenize:gAe};function gAe(t,e,n){let r=0;return a;function a(h){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(h),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),i}function i(h){return gi(h)?(t.consume(h),o):h===64?n(h):u(h)}function o(h){return h===43||h===45||h===46||ni(h)?(r=1,s(h)):u(h)}function s(h){return h===58?(t.consume(h),r=0,l):(h===43||h===45||h===46||ni(h))&&r++<32?(t.consume(h),s):(r=0,u(h))}function l(h){return h===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(h),t.exit("autolinkMarker"),t.exit("autolink"),e):h===null||h===32||h===60||rC(h)?n(h):(t.consume(h),l)}function u(h){return h===64?(t.consume(h),d):iAe(h)?(t.consume(h),u):n(h)}function d(h){return ni(h)?f(h):n(h)}function f(h){return h===46?(t.consume(h),r=0,d):h===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(h),t.exit("autolinkMarker"),t.exit("autolink"),e):m(h)}function m(h){if((h===45||ni(h))&&r++<63){const E=h===45?m:f;return t.consume(h),E}return n(h)}}const P0={partial:!0,tokenize:_Ae};function _Ae(t,e,n){return r;function r(i){return on(i)?rn(t,a,"linePrefix")(i):a(i)}function a(i){return i===null||bt(i)?e(i):n(i)}}const Y$={continuation:{tokenize:EAe},exit:SAe,name:"blockQuote",tokenize:bAe};function bAe(t,e,n){const r=this;return a;function a(o){if(o===62){const s=r.containerState;return s.open||(t.enter("blockQuote",{_container:!0}),s.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(o),t.exit("blockQuoteMarker"),i}return n(o)}function i(o){return on(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function EAe(t,e,n){const r=this;return a;function a(o){return on(o)?rn(t,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return t.attempt(Y$,e,n)(o)}}function SAe(t){t.exit("blockQuote")}const V$={name:"characterEscape",tokenize:vAe};function vAe(t,e,n){return r;function r(i){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(i),t.exit("escapeMarker"),a}function a(i){return sAe(i)?(t.enter("characterEscapeValue"),t.consume(i),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(i)}}const j$={name:"characterReference",tokenize:yAe};function yAe(t,e,n){const r=this;let a=0,i,o;return s;function s(f){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(f),t.exit("characterReferenceMarker"),l}function l(f){return f===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(f),t.exit("characterReferenceMarkerNumeric"),u):(t.enter("characterReferenceValue"),i=31,o=ni,d(f))}function u(f){return f===88||f===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(f),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),i=6,o=oAe,d):(t.enter("characterReferenceValue"),i=7,o=RN,d(f))}function d(f){if(f===59&&a){const m=t.exit("characterReferenceValue");return o===ni&&!AN(r.sliceSerialize(m))?n(f):(t.enter("characterReferenceMarker"),t.consume(f),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return o(f)&&a++<i?(t.consume(f),d):n(f)}}const W$={partial:!0,tokenize:CAe},K$={concrete:!0,name:"codeFenced",tokenize:TAe};function TAe(t,e,n){const r=this,a={partial:!0,tokenize:O};let i=0,o=0,s;return l;function l(x){return u(x)}function u(x){const D=r.events[r.events.length-1];return i=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,s=x,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),d(x)}function d(x){return x===s?(o++,t.consume(x),d):o<3?n(x):(t.exit("codeFencedFenceSequence"),on(x)?rn(t,f,"whitespace")(x):f(x))}function f(x){return x===null||bt(x)?(t.exit("codeFencedFence"),r.interrupt?e(x):t.check(W$,b,w)(x)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===null||bt(x)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),f(x)):on(x)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),rn(t,h,"whitespace")(x)):x===96&&x===s?n(x):(t.consume(x),m)}function h(x){return x===null||bt(x)?f(x):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),E(x))}function E(x){return x===null||bt(x)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),f(x)):x===96&&x===s?n(x):(t.consume(x),E)}function b(x){return t.attempt(a,w,v)(x)}function v(x){return t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),y}function y(x){return i>0&&on(x)?rn(t,C,"linePrefix",i+1)(x):C(x)}function C(x){return x===null||bt(x)?t.check(W$,b,w)(x):(t.enter("codeFlowValue"),T(x))}function T(x){return x===null||bt(x)?(t.exit("codeFlowValue"),C(x)):(t.consume(x),T)}function w(x){return t.exit("codeFenced"),e(x)}function O(x,D,M){let F=0;return P;function P(K){return x.enter("lineEnding"),x.consume(K),x.exit("lineEnding"),q}function q(K){return x.enter("codeFencedFence"),on(K)?rn(x,j,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(K):j(K)}function j(K){return K===s?(x.enter("codeFencedFenceSequence"),Q(K)):M(K)}function Q(K){return K===s?(F++,x.consume(K),Q):F>=o?(x.exit("codeFencedFenceSequence"),on(K)?rn(x,U,"whitespace")(K):U(K)):M(K)}function U(K){return K===null||bt(K)?(x.exit("codeFencedFence"),D(K)):M(K)}}}function CAe(t,e,n){const r=this;return a;function a(o){return o===null?n(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}const xN={name:"codeIndented",tokenize:RAe},AAe={partial:!0,tokenize:wAe};function RAe(t,e,n){const r=this;return a;function a(u){return t.enter("codeIndented"),rn(t,i,"linePrefix",5)(u)}function i(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?l(u):bt(u)?t.attempt(AAe,o,l)(u):(t.enter("codeFlowValue"),s(u))}function s(u){return u===null||bt(u)?(t.exit("codeFlowValue"),o(u)):(t.consume(u),s)}function l(u){return t.exit("codeIndented"),e(u)}}function wAe(t,e,n){const r=this;return a;function a(o){return r.parser.lazy[r.now().line]?n(o):bt(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),a):rn(t,i,"linePrefix",5)(o)}function i(o){const s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?e(o):bt(o)?a(o):n(o)}}const xAe={name:"codeText",previous:OAe,resolve:NAe,tokenize:IAe};function NAe(t){let e=t.length-4,n=3,r,a;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r<e;)if(t[r][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)a===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(a=r):(r===e||t[r][1].type==="lineEnding")&&(t[a][1].type="codeTextData",r!==a+2&&(t[a][1].end=t[r-1][1].end,t.splice(a+2,r-a-2),e-=r-a-2,r=a+2),a=void 0);return t}function OAe(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function IAe(t,e,n){let r=0,a,i;return o;function o(f){return t.enter("codeText"),t.enter("codeTextSequence"),s(f)}function s(f){return f===96?(t.consume(f),r++,s):(t.exit("codeTextSequence"),l(f))}function l(f){return f===null?n(f):f===32?(t.enter("space"),t.consume(f),t.exit("space"),l):f===96?(i=t.enter("codeTextSequence"),a=0,d(f)):bt(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),l):(t.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||bt(f)?(t.exit("codeTextData"),l(f)):(t.consume(f),u)}function d(f){return f===96?(t.consume(f),a++,d):a===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(f)):(i.type="codeTextData",u(f))}}class DAe{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const a=n||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&F0(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),F0(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),F0(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);F0(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);F0(this.left,n.reverse())}}}function F0(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function X$(t){const e={};let n=-1,r,a,i,o,s,l,u;const d=new DAe(t);for(;++n<d.length;){for(;n in e;)n=e[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,kAe(d,n)),n=e[n],u=!0);else if(r[1]._container){for(i=n,a=void 0;i--;)if(o=d.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(a&&(d.get(a)[1].type="lineEndingBlank"),o[1].type="lineEnding",a=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;a&&(r[1].end={...d.get(a)[1].start},s=d.slice(a,n),s.unshift(r),d.splice(a,n-a+1,s))}}return so(t,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function kAe(t,e){const n=t.get(e)[1],r=t.get(e)[2];let a=e-1;const i=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const s=o.events,l=[],u={};let d,f,m=-1,h=n,E=0,b=0;const v=[b];for(;h;){for(;t.get(++a)[1]!==h;);i.push(a),h._tokenizer||(d=r.sliceStream(h),h.next||d.push(null),f&&o.defineSkip(h.start),h._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),h._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),f=h,h=h.next}for(h=n;++m<s.length;)s[m][0]==="exit"&&s[m-1][0]==="enter"&&s[m][1].type===s[m-1][1].type&&s[m][1].start.line!==s[m][1].end.line&&(b=m+1,v.push(b),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(o.events=[],h?(h._tokenizer=void 0,h.previous=void 0):v.pop(),m=v.length;m--;){const y=s.slice(v[m],v[m+1]),C=i.pop();l.push([C,C+y.length-1]),t.splice(C,2,y)}for(l.reverse(),m=-1;++m<l.length;)u[E+l[m][0]]=E+l[m][1],E+=l[m][1]-l[m][0]-1;return u}const MAe={resolve:PAe,tokenize:FAe},LAe={partial:!0,tokenize:BAe};function PAe(t){return X$(t),t}function FAe(t,e){let n;return r;function r(s){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),a(s)}function a(s){return s===null?i(s):bt(s)?t.check(LAe,o,i)(s):(t.consume(s),a)}function i(s){return t.exit("chunkContent"),t.exit("content"),e(s)}function o(s){return t.consume(s),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function BAe(t,e,n){const r=this;return a;function a(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),rn(t,i,"linePrefix")}function i(o){if(o===null||bt(o))return n(o);const s=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?e(o):t.interrupt(r.parser.constructs.flow,n,e)(o)}}function Q$(t,e,n,r,a,i,o,s,l){const u=l||Number.POSITIVE_INFINITY;let d=0;return f;function f(y){return y===60?(t.enter(r),t.enter(a),t.enter(i),t.consume(y),t.exit(i),m):y===null||y===32||y===41||rC(y)?n(y):(t.enter(r),t.enter(o),t.enter(s),t.enter("chunkString",{contentType:"string"}),b(y))}function m(y){return y===62?(t.enter(i),t.consume(y),t.exit(i),t.exit(a),t.exit(r),e):(t.enter(s),t.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===62?(t.exit("chunkString"),t.exit(s),m(y)):y===null||y===60||bt(y)?n(y):(t.consume(y),y===92?E:h)}function E(y){return y===60||y===62||y===92?(t.consume(y),h):h(y)}function b(y){return!d&&(y===null||y===41||Zn(y))?(t.exit("chunkString"),t.exit(s),t.exit(o),t.exit(r),e(y)):d<u&&y===40?(t.consume(y),d++,b):y===41?(t.consume(y),d--,b):y===null||y===32||y===40||rC(y)?n(y):(t.consume(y),y===92?v:b)}function v(y){return y===40||y===41||y===92?(t.consume(y),b):b(y)}}function Z$(t,e,n,r,a,i){const o=this;let s=0,l;return u;function u(h){return t.enter(r),t.enter(a),t.consume(h),t.exit(a),t.enter(i),d}function d(h){return s>999||h===null||h===91||h===93&&!l||h===94&&!s&&"_hiddenFootnoteSupport"in o.parser.constructs?n(h):h===93?(t.exit(i),t.enter(a),t.consume(h),t.exit(a),t.exit(r),e):bt(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),d):(t.enter("chunkString",{contentType:"string"}),f(h))}function f(h){return h===null||h===91||h===93||bt(h)||s++>999?(t.exit("chunkString"),d(h)):(t.consume(h),l||(l=!on(h)),h===92?m:f)}function m(h){return h===91||h===92||h===93?(t.consume(h),s++,f):f(h)}}function J$(t,e,n,r,a,i){let o;return s;function s(m){return m===34||m===39||m===40?(t.enter(r),t.enter(a),t.consume(m),t.exit(a),o=m===40?41:m,l):n(m)}function l(m){return m===o?(t.enter(a),t.consume(m),t.exit(a),t.exit(r),e):(t.enter(i),u(m))}function u(m){return m===o?(t.exit(i),l(o)):m===null?n(m):bt(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),rn(t,u,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===o||m===null||bt(m)?(t.exit("chunkString"),u(m)):(t.consume(m),m===92?f:d)}function f(m){return m===o||m===92?(t.consume(m),d):d(m)}}function B0(t,e){let n;return r;function r(a){return bt(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),n=!0,r):on(a)?rn(t,r,n?"linePrefix":"lineSuffix")(a):e(a)}}const UAe={name:"definition",tokenize:zAe},GAe={partial:!0,tokenize:qAe};function zAe(t,e,n){const r=this;let a;return i;function i(h){return t.enter("definition"),o(h)}function o(h){return Z$.call(r,t,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function s(h){return a=qs(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(t.enter("definitionMarker"),t.consume(h),t.exit("definitionMarker"),l):n(h)}function l(h){return Zn(h)?B0(t,u)(h):u(h)}function u(h){return Q$(t,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function d(h){return t.attempt(GAe,f,f)(h)}function f(h){return on(h)?rn(t,m,"whitespace")(h):m(h)}function m(h){return h===null||bt(h)?(t.exit("definition"),r.parser.defined.push(a),e(h)):n(h)}}function qAe(t,e,n){return r;function r(s){return Zn(s)?B0(t,a)(s):n(s)}function a(s){return J$(t,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function i(s){return on(s)?rn(t,o,"whitespace")(s):o(s)}function o(s){return s===null||bt(s)?e(s):n(s)}}const HAe={name:"hardBreakEscape",tokenize:$Ae};function $Ae(t,e,n){return r;function r(i){return t.enter("hardBreakEscape"),t.consume(i),a}function a(i){return bt(i)?(t.exit("hardBreakEscape"),e(i)):n(i)}}const YAe={name:"headingAtx",resolve:VAe,tokenize:jAe};function VAe(t,e){let n=t.length-2,r=3,a,i;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},i={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},so(t,r,n-r+1,[["enter",a,e],["enter",i,e],["exit",i,e],["exit",a,e]])),t}function jAe(t,e,n){let r=0;return a;function a(d){return t.enter("atxHeading"),i(d)}function i(d){return t.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&r++<6?(t.consume(d),o):d===null||Zn(d)?(t.exit("atxHeadingSequence"),s(d)):n(d)}function s(d){return d===35?(t.enter("atxHeadingSequence"),l(d)):d===null||bt(d)?(t.exit("atxHeading"),e(d)):on(d)?rn(t,s,"whitespace")(d):(t.enter("atxHeadingText"),u(d))}function l(d){return d===35?(t.consume(d),l):(t.exit("atxHeadingSequence"),s(d))}function u(d){return d===null||d===35||Zn(d)?(t.exit("atxHeadingText"),s(d)):(t.consume(d),u)}}const WAe=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],eY=["pre","script","style","textarea"],KAe={concrete:!0,name:"htmlFlow",resolveTo:ZAe,tokenize:JAe},XAe={partial:!0,tokenize:tRe},QAe={partial:!0,tokenize:eRe};function ZAe(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function JAe(t,e,n){const r=this;let a,i,o,s,l;return u;function u(B){return d(B)}function d(B){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(B),f}function f(B){return B===33?(t.consume(B),m):B===47?(t.consume(B),i=!0,b):B===63?(t.consume(B),a=3,r.interrupt?e:$):gi(B)?(t.consume(B),o=String.fromCharCode(B),v):n(B)}function m(B){return B===45?(t.consume(B),a=2,h):B===91?(t.consume(B),a=5,s=0,E):gi(B)?(t.consume(B),a=4,r.interrupt?e:$):n(B)}function h(B){return B===45?(t.consume(B),r.interrupt?e:$):n(B)}function E(B){const ae="CDATA[";return B===ae.charCodeAt(s++)?(t.consume(B),s===ae.length?r.interrupt?e:j:E):n(B)}function b(B){return gi(B)?(t.consume(B),o=String.fromCharCode(B),v):n(B)}function v(B){if(B===null||B===47||B===62||Zn(B)){const ae=B===47,se=o.toLowerCase();return!ae&&!i&&eY.includes(se)?(a=1,r.interrupt?e(B):j(B)):WAe.includes(o.toLowerCase())?(a=6,ae?(t.consume(B),y):r.interrupt?e(B):j(B)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(B):i?C(B):T(B))}return B===45||ni(B)?(t.consume(B),o+=String.fromCharCode(B),v):n(B)}function y(B){return B===62?(t.consume(B),r.interrupt?e:j):n(B)}function C(B){return on(B)?(t.consume(B),C):P(B)}function T(B){return B===47?(t.consume(B),P):B===58||B===95||gi(B)?(t.consume(B),w):on(B)?(t.consume(B),T):P(B)}function w(B){return B===45||B===46||B===58||B===95||ni(B)?(t.consume(B),w):O(B)}function O(B){return B===61?(t.consume(B),x):on(B)?(t.consume(B),O):T(B)}function x(B){return B===null||B===60||B===61||B===62||B===96?n(B):B===34||B===39?(t.consume(B),l=B,D):on(B)?(t.consume(B),x):M(B)}function D(B){return B===l?(t.consume(B),l=null,F):B===null||bt(B)?n(B):(t.consume(B),D)}function M(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||Zn(B)?O(B):(t.consume(B),M)}function F(B){return B===47||B===62||on(B)?T(B):n(B)}function P(B){return B===62?(t.consume(B),q):n(B)}function q(B){return B===null||bt(B)?j(B):on(B)?(t.consume(B),q):n(B)}function j(B){return B===45&&a===2?(t.consume(B),G):B===60&&a===1?(t.consume(B),Y):B===62&&a===4?(t.consume(B),Z):B===63&&a===3?(t.consume(B),$):B===93&&a===5?(t.consume(B),J):bt(B)&&(a===6||a===7)?(t.exit("htmlFlowData"),t.check(XAe,te,Q)(B)):B===null||bt(B)?(t.exit("htmlFlowData"),Q(B)):(t.consume(B),j)}function Q(B){return t.check(QAe,U,te)(B)}function U(B){return t.enter("lineEnding"),t.consume(B),t.exit("lineEnding"),K}function K(B){return B===null||bt(B)?Q(B):(t.enter("htmlFlowData"),j(B))}function G(B){return B===45?(t.consume(B),$):j(B)}function Y(B){return B===47?(t.consume(B),o="",W):j(B)}function W(B){if(B===62){const ae=o.toLowerCase();return eY.includes(ae)?(t.consume(B),Z):j(B)}return gi(B)&&o.length<8?(t.consume(B),o+=String.fromCharCode(B),W):j(B)}function J(B){return B===93?(t.consume(B),$):j(B)}function $(B){return B===62?(t.consume(B),Z):B===45&&a===2?(t.consume(B),$):j(B)}function Z(B){return B===null||bt(B)?(t.exit("htmlFlowData"),te(B)):(t.consume(B),Z)}function te(B){return t.exit("htmlFlow"),e(B)}}function eRe(t,e,n){const r=this;return a;function a(o){return bt(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):n(o)}function i(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}function tRe(t,e,n){return r;function r(a){return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),t.attempt(P0,e,n)}}const nRe={name:"htmlText",tokenize:rRe};function rRe(t,e,n){const r=this;let a,i,o;return s;function s($){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume($),l}function l($){return $===33?(t.consume($),u):$===47?(t.consume($),O):$===63?(t.consume($),T):gi($)?(t.consume($),M):n($)}function u($){return $===45?(t.consume($),d):$===91?(t.consume($),i=0,E):gi($)?(t.consume($),C):n($)}function d($){return $===45?(t.consume($),h):n($)}function f($){return $===null?n($):$===45?(t.consume($),m):bt($)?(o=f,Y($)):(t.consume($),f)}function m($){return $===45?(t.consume($),h):f($)}function h($){return $===62?G($):$===45?m($):f($)}function E($){const Z="CDATA[";return $===Z.charCodeAt(i++)?(t.consume($),i===Z.length?b:E):n($)}function b($){return $===null?n($):$===93?(t.consume($),v):bt($)?(o=b,Y($)):(t.consume($),b)}function v($){return $===93?(t.consume($),y):b($)}function y($){return $===62?G($):$===93?(t.consume($),y):b($)}function C($){return $===null||$===62?G($):bt($)?(o=C,Y($)):(t.consume($),C)}function T($){return $===null?n($):$===63?(t.consume($),w):bt($)?(o=T,Y($)):(t.consume($),T)}function w($){return $===62?G($):T($)}function O($){return gi($)?(t.consume($),x):n($)}function x($){return $===45||ni($)?(t.consume($),x):D($)}function D($){return bt($)?(o=D,Y($)):on($)?(t.consume($),D):G($)}function M($){return $===45||ni($)?(t.consume($),M):$===47||$===62||Zn($)?F($):n($)}function F($){return $===47?(t.consume($),G):$===58||$===95||gi($)?(t.consume($),P):bt($)?(o=F,Y($)):on($)?(t.consume($),F):G($)}function P($){return $===45||$===46||$===58||$===95||ni($)?(t.consume($),P):q($)}function q($){return $===61?(t.consume($),j):bt($)?(o=q,Y($)):on($)?(t.consume($),q):F($)}function j($){return $===null||$===60||$===61||$===62||$===96?n($):$===34||$===39?(t.consume($),a=$,Q):bt($)?(o=j,Y($)):on($)?(t.consume($),j):(t.consume($),U)}function Q($){return $===a?(t.consume($),a=void 0,K):$===null?n($):bt($)?(o=Q,Y($)):(t.consume($),Q)}function U($){return $===null||$===34||$===39||$===60||$===61||$===96?n($):$===47||$===62||Zn($)?F($):(t.consume($),U)}function K($){return $===47||$===62||Zn($)?F($):n($)}function G($){return $===62?(t.consume($),t.exit("htmlTextData"),t.exit("htmlText"),e):n($)}function Y($){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume($),t.exit("lineEnding"),W}function W($){return on($)?rn(t,J,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):J($)}function J($){return t.enter("htmlTextData"),o($)}}const NN={name:"labelEnd",resolveAll:sRe,resolveTo:lRe,tokenize:cRe},aRe={tokenize:uRe},iRe={tokenize:dRe},oRe={tokenize:pRe};function sRe(t){let e=-1;const n=[];for(;++e<t.length;){const r=t[e][1];if(n.push(t[e]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const a=r.type==="labelImage"?4:2;r.type="data",e+=a}}return t.length!==n.length&&so(t,0,t.length,n),t}function lRe(t,e){let n=t.length,r=0,a,i,o,s;for(;n--;)if(a=t[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;t[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(o){if(t[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(o=n);const l={type:t[i][1].type==="labelLink"?"link":"image",start:{...t[i][1].start},end:{...t[t.length-1][1].end}},u={type:"label",start:{...t[i][1].start},end:{...t[o][1].end}},d={type:"labelText",start:{...t[i+r+2][1].end},end:{...t[o-2][1].start}};return s=[["enter",l,e],["enter",u,e]],s=Zo(s,t.slice(i+1,i+r+3)),s=Zo(s,[["enter",d,e]]),s=Zo(s,iC(e.parser.constructs.insideSpan.null,t.slice(i+r+4,o-3),e)),s=Zo(s,[["exit",d,e],t[o-2],t[o-1],["exit",u,e]]),s=Zo(s,t.slice(o+1)),s=Zo(s,[["exit",l,e]]),so(t,i,t.length,s),t}function cRe(t,e,n){const r=this;let a=r.events.length,i,o;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return s;function s(m){return i?i._inactive?f(m):(o=r.parser.defined.includes(qs(r.sliceSerialize({start:i.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(m),t.exit("labelMarker"),t.exit("labelEnd"),l):n(m)}function l(m){return m===40?t.attempt(aRe,d,o?d:f)(m):m===91?t.attempt(iRe,d,o?u:f)(m):o?d(m):f(m)}function u(m){return t.attempt(oRe,d,f)(m)}function d(m){return e(m)}function f(m){return i._balanced=!0,n(m)}}function uRe(t,e,n){return r;function r(f){return t.enter("resource"),t.enter("resourceMarker"),t.consume(f),t.exit("resourceMarker"),a}function a(f){return Zn(f)?B0(t,i)(f):i(f)}function i(f){return f===41?d(f):Q$(t,o,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function o(f){return Zn(f)?B0(t,l)(f):d(f)}function s(f){return n(f)}function l(f){return f===34||f===39||f===40?J$(t,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):d(f)}function u(f){return Zn(f)?B0(t,d)(f):d(f)}function d(f){return f===41?(t.enter("resourceMarker"),t.consume(f),t.exit("resourceMarker"),t.exit("resource"),e):n(f)}}function dRe(t,e,n){const r=this;return a;function a(s){return Z$.call(r,t,i,o,"reference","referenceMarker","referenceString")(s)}function i(s){return r.parser.defined.includes(qs(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(s):n(s)}function o(s){return n(s)}}function pRe(t,e,n){return r;function r(i){return t.enter("reference"),t.enter("referenceMarker"),t.consume(i),t.exit("referenceMarker"),a}function a(i){return i===93?(t.enter("referenceMarker"),t.consume(i),t.exit("referenceMarker"),t.exit("reference"),e):n(i)}}const fRe={name:"labelStartImage",resolveAll:NN.resolveAll,tokenize:mRe};function mRe(t,e,n){const r=this;return a;function a(s){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(s),t.exit("labelImageMarker"),i}function i(s){return s===91?(t.enter("labelMarker"),t.consume(s),t.exit("labelMarker"),t.exit("labelImage"),o):n(s)}function o(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):e(s)}}const hRe={name:"labelStartLink",resolveAll:NN.resolveAll,tokenize:gRe};function gRe(t,e,n){const r=this;return a;function a(o){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):e(o)}}const ON={name:"lineEnding",tokenize:_Re};function _Re(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),rn(t,e,"linePrefix")}}const oC={name:"thematicBreak",tokenize:bRe};function bRe(t,e,n){let r=0,a;return i;function i(u){return t.enter("thematicBreak"),o(u)}function o(u){return a=u,s(u)}function s(u){return u===a?(t.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||bt(u))?(t.exit("thematicBreak"),e(u)):n(u)}function l(u){return u===a?(t.consume(u),r++,l):(t.exit("thematicBreakSequence"),on(u)?rn(t,s,"whitespace")(u):s(u))}}const ki={continuation:{tokenize:yRe},exit:CRe,name:"list",tokenize:vRe},ERe={partial:!0,tokenize:ARe},SRe={partial:!0,tokenize:TRe};function vRe(t,e,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,o=0;return s;function s(h){const E=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(E==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:RN(h)){if(r.containerState.type||(r.containerState.type=E,t.enter(E,{_container:!0})),E==="listUnordered")return t.enter("listItemPrefix"),h===42||h===45?t.check(oC,n,u)(h):u(h);if(!r.interrupt||h===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(h)}return n(h)}function l(h){return RN(h)&&++o<10?(t.consume(h),l):(!r.interrupt||o<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(t.exit("listItemValue"),u(h)):n(h)}function u(h){return t.enter("listItemMarker"),t.consume(h),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,t.check(P0,r.interrupt?n:d,t.attempt(ERe,m,f))}function d(h){return r.containerState.initialBlankLine=!0,i++,m(h)}function f(h){return on(h)?(t.enter("listItemPrefixWhitespace"),t.consume(h),t.exit("listItemPrefixWhitespace"),m):n(h)}function m(h){return r.containerState.size=i+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(h)}}function yRe(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(P0,a,i);function a(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,rn(t,e,"listItemIndent",r.containerState.size+1)(s)}function i(s){return r.containerState.furtherBlankLines||!on(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(SRe,e,o)(s))}function o(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,rn(t,t.attempt(ki,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function TRe(t,e,n){const r=this;return rn(t,a,"listItemIndent",r.containerState.size+1);function a(i){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?e(i):n(i)}}function CRe(t){t.exit(this.containerState.type)}function ARe(t,e,n){const r=this;return rn(t,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(i){const o=r.events[r.events.length-1];return!on(i)&&o&&o[1].type==="listItemPrefixWhitespace"?e(i):n(i)}}const tY={name:"setextUnderline",resolveTo:RRe,tokenize:wRe};function RRe(t,e){let n=t.length,r,a,i;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(a=n)}else t[n][1].type==="content"&&t.splice(n,1),!i&&t[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[a][1].type="setextHeadingText",i?(t.splice(a,0,["enter",o,e]),t.splice(i+1,0,["exit",t[r][1],e]),t[r][1].end={...t[i][1].end}):t[r][1]=o,t.push(["exit",o,e]),t}function wRe(t,e,n){const r=this;let a;return i;function i(u){let d=r.events.length,f;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){f=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(t.enter("setextHeadingLine"),a=u,o(u)):n(u)}function o(u){return t.enter("setextHeadingLineSequence"),s(u)}function s(u){return u===a?(t.consume(u),s):(t.exit("setextHeadingLineSequence"),on(u)?rn(t,l,"lineSuffix")(u):l(u))}function l(u){return u===null||bt(u)?(t.exit("setextHeadingLine"),e(u)):n(u)}}const xRe={tokenize:NRe};function NRe(t){const e=this,n=t.attempt(P0,r,t.attempt(this.parser.constructs.flowInitial,a,rn(t,t.attempt(this.parser.constructs.flow,a,t.attempt(MAe,a)),"linePrefix")));return n;function r(i){if(i===null){t.consume(i);return}return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function a(i){if(i===null){t.consume(i);return}return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const ORe={resolveAll:rY()},IRe=nY("string"),DRe=nY("text");function nY(t){return{resolveAll:rY(t==="text"?kRe:void 0),tokenize:e};function e(n){const r=this,a=this.parser.constructs[t],i=n.attempt(a,o,s);return o;function o(d){return u(d)?i(d):s(d)}function s(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),l)}function u(d){if(d===null)return!0;const f=a[d];let m=-1;if(f)for(;++m<f.length;){const h=f[m];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function rY(t){return e;function e(n,r){let a=-1,i;for(;++a<=n.length;)i===void 0?n[a]&&n[a][1].type==="data"&&(i=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==i+2&&(n[i][1].end=n[a-1][1].end,n.splice(i+2,a-i-2),a=i+2),i=void 0);return t?t(n,r):n}}function kRe(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const r=t[n-1][1],a=e.sliceStream(r);let i=a.length,o=-1,s=0,l;for(;i--;){const u=a[i];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(u===-2)l=!0,s++;else if(u!==-1){i++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(s=0),s){const u={type:n===t.length||l||s<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:r.start._bufferIndex+o,_index:r.start._index+i,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(t.splice(n,0,["enter",u,e],["exit",u,e]),n+=2)}n++}return t}const MRe=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:{91:UAe},disable:{null:[]},document:{42:ki,43:ki,45:ki,48:ki,49:ki,50:ki,51:ki,52:ki,53:ki,54:ki,55:ki,56:ki,57:ki,62:Y$},flow:{35:YAe,42:oC,45:[tY,oC],60:KAe,61:tY,95:oC,96:K$,126:K$},flowInitial:{[-2]:xN,[-1]:xN,32:xN},insideSpan:{null:[wN,ORe]},string:{38:j$,92:V$},text:{[-5]:ON,[-4]:ON,[-3]:ON,33:fRe,38:j$,42:wN,60:[hAe,nRe],91:hRe,92:[HAe,V$],93:NN,95:wN,96:xAe}},Symbol.toStringTag,{value:"Module"}));function LRe(t,e,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},i=[];let o=[],s=[];const l={attempt:D(O),check:D(x),consume:C,enter:T,exit:w,interrupt:D(x,{interrupt:!0})},u={code:null,containerState:{},defineSkip:b,events:[],now:E,parser:t,previous:null,sliceSerialize:m,sliceStream:h,write:f};let d=e.tokenize.call(u,l);return e.resolveAll&&i.push(e),u;function f(q){return o=Zo(o,q),v(),o[o.length-1]!==null?[]:(M(e,0),u.events=iC(i,u.events,u),u.events)}function m(q,j){return FRe(h(q),j)}function h(q){return PRe(o,q)}function E(){const{_bufferIndex:q,_index:j,line:Q,column:U,offset:K}=r;return{_bufferIndex:q,_index:j,line:Q,column:U,offset:K}}function b(q){a[q.line]=q.column,P()}function v(){let q;for(;r._index<o.length;){const j=o[r._index];if(typeof j=="string")for(q=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===q&&r._bufferIndex<j.length;)y(j.charCodeAt(r._bufferIndex));else y(j)}}function y(q){d=d(q)}function C(q){bt(q)?(r.line++,r.column=1,r.offset+=q===-3?2:1,P()):q!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=q}function T(q,j){const Q=j||{};return Q.type=q,Q.start=E(),u.events.push(["enter",Q,u]),s.push(Q),Q}function w(q){const j=s.pop();return j.end=E(),u.events.push(["exit",j,u]),j}function O(q,j){M(q,j.from)}function x(q,j){j.restore()}function D(q,j){return Q;function Q(U,K,G){let Y,W,J,$;return Array.isArray(U)?te(U):"tokenize"in U?te([U]):Z(U);function Z(de){return ie;function ie(ce){const me=ce!==null&&de[ce],be=ce!==null&&de.null,Ae=[...Array.isArray(me)?me:me?[me]:[],...Array.isArray(be)?be:be?[be]:[]];return te(Ae)(ce)}}function te(de){return Y=de,W=0,de.length===0?G:B(de[W])}function B(de){return ie;function ie(ce){return $=F(),J=de,de.partial||(u.currentConstruct=de),de.name&&u.parser.constructs.disable.null.includes(de.name)?se():de.tokenize.call(j?Object.assign(Object.create(u),j):u,l,ae,se)(ce)}}function ae(de){return q(J,$),K}function se(de){return $.restore(),++W<Y.length?B(Y[W]):G}}}function M(q,j){q.resolveAll&&!i.includes(q)&&i.push(q),q.resolve&&so(u.events,j,u.events.length-j,q.resolve(u.events.slice(j),u)),q.resolveTo&&(u.events=q.resolveTo(u.events,u))}function F(){const q=E(),j=u.previous,Q=u.currentConstruct,U=u.events.length,K=Array.from(s);return{from:U,restore:G};function G(){r=q,u.previous=j,u.currentConstruct=Q,u.events.length=U,s=K,P()}}function P(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function PRe(t,e){const n=e.start._index,r=e.start._bufferIndex,a=e.end._index,i=e.end._bufferIndex;let o;if(n===a)o=[t[n].slice(r,i)];else{if(o=t.slice(n,a),r>-1){const s=o[0];typeof s=="string"?o[0]=s.slice(r):o.shift()}i>0&&o.push(t[a].slice(0,i))}return o}function FRe(t,e){let n=-1;const r=[];let a;for(;++n<t.length;){const i=t[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
|
|
298
298
|
`;break}case-3:{o=`\r
|
|
299
299
|
`;break}case-2:{o=e?" ":" ";break}case-1:{if(!e&&a)continue;o=" ";break}default:o=String.fromCharCode(i)}a=i===-2,r.push(o)}return r.join("")}function BRe(t){const r={constructs:z$([MRe,...(t||{}).extensions||[]]),content:a(lAe),defined:[],document:a(uAe),flow:a(xRe),lazy:{},string:a(IRe),text:a(DRe)};return r;function a(i){return o;function o(s){return LRe(r,i,s)}}}function URe(t){for(;!X$(t););return t}const aY=/[\0\t\n\r]/g;function GRe(){let t=1,e="",n=!0,r;return a;function a(i,o,s){const l=[];let u,d,f,m,h;for(i=e+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),f=0,e="",n&&(i.charCodeAt(0)===65279&&f++,n=void 0);f<i.length;){if(aY.lastIndex=f,u=aY.exec(i),m=u&&u.index!==void 0?u.index:i.length,h=i.charCodeAt(m),!u){e=i.slice(f);break}if(h===10&&f===m&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),f<m&&(l.push(i.slice(f,m)),t+=m-f),h){case 0:{l.push(65533),t++;break}case 9:{for(d=Math.ceil(t/4)*4,l.push(-2);t++<d;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:r=!0,t=1}f=m+1}return s&&(r&&l.push(-5),e&&l.push(e),l.push(null)),l}}const zRe=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function qRe(t){return t.replace(zRe,HRe)}function HRe(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return q$(n.slice(i?2:1),i?16:10)}return AN(n)||t}const iY={}.hasOwnProperty;function $Re(t,e,n){return typeof e!="string"&&(n=e,e=void 0),YRe(n)(URe(BRe(n).document().write(GRe()(t,e,!0))))}function YRe(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Jt),autolinkProtocol:F,autolinkEmail:F,atxHeading:i(We),blockQuote:i(be),characterEscape:F,characterReference:F,codeFenced:i(Ae),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(Ae,o),codeText:i(we,o),codeTextData:F,data:F,codeFlowValue:F,definition:i(Te),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(De),hardBreakEscape:i(Ye),hardBreakTrailing:i(Ye),htmlFlow:i(Tt,o),htmlFlowData:F,htmlText:i(Tt,o),htmlTextData:F,image:i(_t),label:o,link:i(Jt),listItem:i(Ve),listItemValue:m,listOrdered:i(Ge,f),listUnordered:i(Ge),paragraph:i(Xe),reference:B,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(We),strong:i(mt),thematicBreak:i(Dt)},exit:{atxHeading:l(),atxHeadingSequence:O,autolink:l(),autolinkEmail:me,autolinkProtocol:ce,blockQuote:l(),characterEscapeValue:P,characterReferenceMarkerHexadecimal:se,characterReferenceMarkerNumeric:se,characterReferenceValue:de,characterReference:ie,codeFenced:l(v),codeFencedFence:b,codeFencedFenceInfo:h,codeFencedFenceMeta:E,codeFlowValue:P,codeIndented:l(y),codeText:l(K),codeTextData:P,data:P,definition:l(),definitionDestinationString:w,definitionLabelString:C,definitionTitleString:T,emphasis:l(),hardBreakEscape:l(j),hardBreakTrailing:l(j),htmlFlow:l(Q),htmlFlowData:P,htmlText:l(U),htmlTextData:P,image:l(Y),label:J,labelText:W,lineEnding:q,link:l(G),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ae,resourceDestinationString:$,resourceTitleString:Z,resource:te,setextHeading:l(M),setextHeadingLineSequence:D,setextHeadingText:x,strong:l(),thematicBreak:l()}};oY(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(ge){let xe={type:"root",children:[]};const He={stack:[xe],tokenStack:[],config:e,enter:s,exit:u,buffer:o,resume:d,data:n},ot=[];let Ct=-1;for(;++Ct<ge.length;)if(ge[Ct][1].type==="listOrdered"||ge[Ct][1].type==="listUnordered")if(ge[Ct][0]==="enter")ot.push(Ct);else{const pr=ot.pop();Ct=a(ge,pr,Ct)}for(Ct=-1;++Ct<ge.length;){const pr=e[ge[Ct][0]];iY.call(pr,ge[Ct][1].type)&&pr[ge[Ct][1].type].call(Object.assign({sliceSerialize:ge[Ct][2].sliceSerialize},He),ge[Ct][1])}if(He.tokenStack.length>0){const pr=He.tokenStack[He.tokenStack.length-1];(pr[1]||sY).call(He,void 0,pr[0])}for(xe.position={start:md(ge.length>0?ge[0][1].start:{line:1,column:1,offset:0}),end:md(ge.length>0?ge[ge.length-2][1].end:{line:1,column:1,offset:0})},Ct=-1;++Ct<e.transforms.length;)xe=e.transforms[Ct](xe)||xe;return xe}function a(ge,xe,He){let ot=xe-1,Ct=-1,pr=!1,Yn,Tn,zt,hn;for(;++ot<=He;){const Bt=ge[ot];switch(Bt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Bt[0]==="enter"?Ct++:Ct--,hn=void 0;break}case"lineEndingBlank":{Bt[0]==="enter"&&(Yn&&!hn&&!Ct&&!zt&&(zt=ot),hn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:hn=void 0}if(!Ct&&Bt[0]==="enter"&&Bt[1].type==="listItemPrefix"||Ct===-1&&Bt[0]==="exit"&&(Bt[1].type==="listUnordered"||Bt[1].type==="listOrdered")){if(Yn){let Mr=ot;for(Tn=void 0;Mr--;){const ir=ge[Mr];if(ir[1].type==="lineEnding"||ir[1].type==="lineEndingBlank"){if(ir[0]==="exit")continue;Tn&&(ge[Tn][1].type="lineEndingBlank",pr=!0),ir[1].type="lineEnding",Tn=Mr}else if(!(ir[1].type==="linePrefix"||ir[1].type==="blockQuotePrefix"||ir[1].type==="blockQuotePrefixWhitespace"||ir[1].type==="blockQuoteMarker"||ir[1].type==="listItemIndent"))break}zt&&(!Tn||zt<Tn)&&(Yn._spread=!0),Yn.end=Object.assign({},Tn?ge[Tn][1].start:Bt[1].end),ge.splice(Tn||ot,0,["exit",Yn,Bt[2]]),ot++,He++}if(Bt[1].type==="listItemPrefix"){const Mr={type:"listItem",_spread:!1,start:Object.assign({},Bt[1].start),end:void 0};Yn=Mr,ge.splice(ot,0,["enter",Mr,Bt[2]]),ot++,He++,zt=void 0,hn=!0}}}return ge[xe][1]._spread=pr,He}function i(ge,xe){return He;function He(ot){s.call(this,ge(ot),ot),xe&&xe.call(this,ot)}}function o(){this.stack.push({type:"fragment",children:[]})}function s(ge,xe,He){this.stack[this.stack.length-1].children.push(ge),this.stack.push(ge),this.tokenStack.push([xe,He||void 0]),ge.position={start:md(xe.start),end:void 0}}function l(ge){return xe;function xe(He){ge&&ge.call(this,He),u.call(this,He)}}function u(ge,xe){const He=this.stack.pop(),ot=this.tokenStack.pop();if(ot)ot[0].type!==ge.type&&(xe?xe.call(this,ge,ot[0]):(ot[1]||sY).call(this,ge,ot[0]));else throw new Error("Cannot close `"+ge.type+"` ("+M0({start:ge.start,end:ge.end})+"): it’s not open");He.position.end=md(ge.end)}function d(){return CN(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function m(ge){if(this.data.expectingFirstListItemValue){const xe=this.stack[this.stack.length-2];xe.start=Number.parseInt(this.sliceSerialize(ge),10),this.data.expectingFirstListItemValue=void 0}}function h(){const ge=this.resume(),xe=this.stack[this.stack.length-1];xe.lang=ge}function E(){const ge=this.resume(),xe=this.stack[this.stack.length-1];xe.meta=ge}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const ge=this.resume(),xe=this.stack[this.stack.length-1];xe.value=ge.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const ge=this.resume(),xe=this.stack[this.stack.length-1];xe.value=ge.replace(/(\r?\n|\r)$/g,"")}function C(ge){const xe=this.resume(),He=this.stack[this.stack.length-1];He.label=xe,He.identifier=qs(this.sliceSerialize(ge)).toLowerCase()}function T(){const ge=this.resume(),xe=this.stack[this.stack.length-1];xe.title=ge}function w(){const ge=this.resume(),xe=this.stack[this.stack.length-1];xe.url=ge}function O(ge){const xe=this.stack[this.stack.length-1];if(!xe.depth){const He=this.sliceSerialize(ge).length;xe.depth=He}}function x(){this.data.setextHeadingSlurpLineEnding=!0}function D(ge){const xe=this.stack[this.stack.length-1];xe.depth=this.sliceSerialize(ge).codePointAt(0)===61?1:2}function M(){this.data.setextHeadingSlurpLineEnding=void 0}function F(ge){const He=this.stack[this.stack.length-1].children;let ot=He[He.length-1];(!ot||ot.type!=="text")&&(ot=yt(),ot.position={start:md(ge.start),end:void 0},He.push(ot)),this.stack.push(ot)}function P(ge){const xe=this.stack.pop();xe.value+=this.sliceSerialize(ge),xe.position.end=md(ge.end)}function q(ge){const xe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const He=xe.children[xe.children.length-1];He.position.end=md(ge.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(xe.type)&&(F.call(this,ge),P.call(this,ge))}function j(){this.data.atHardBreak=!0}function Q(){const ge=this.resume(),xe=this.stack[this.stack.length-1];xe.value=ge}function U(){const ge=this.resume(),xe=this.stack[this.stack.length-1];xe.value=ge}function K(){const ge=this.resume(),xe=this.stack[this.stack.length-1];xe.value=ge}function G(){const ge=this.stack[this.stack.length-1];if(this.data.inReference){const xe=this.data.referenceType||"shortcut";ge.type+="Reference",ge.referenceType=xe,delete ge.url,delete ge.title}else delete ge.identifier,delete ge.label;this.data.referenceType=void 0}function Y(){const ge=this.stack[this.stack.length-1];if(this.data.inReference){const xe=this.data.referenceType||"shortcut";ge.type+="Reference",ge.referenceType=xe,delete ge.url,delete ge.title}else delete ge.identifier,delete ge.label;this.data.referenceType=void 0}function W(ge){const xe=this.sliceSerialize(ge),He=this.stack[this.stack.length-2];He.label=qRe(xe),He.identifier=qs(xe).toLowerCase()}function J(){const ge=this.stack[this.stack.length-1],xe=this.resume(),He=this.stack[this.stack.length-1];if(this.data.inReference=!0,He.type==="link"){const ot=ge.children;He.children=ot}else He.alt=xe}function $(){const ge=this.resume(),xe=this.stack[this.stack.length-1];xe.url=ge}function Z(){const ge=this.resume(),xe=this.stack[this.stack.length-1];xe.title=ge}function te(){this.data.inReference=void 0}function B(){this.data.referenceType="collapsed"}function ae(ge){const xe=this.resume(),He=this.stack[this.stack.length-1];He.label=xe,He.identifier=qs(this.sliceSerialize(ge)).toLowerCase(),this.data.referenceType="full"}function se(ge){this.data.characterReferenceType=ge.type}function de(ge){const xe=this.sliceSerialize(ge),He=this.data.characterReferenceType;let ot;He?(ot=q$(xe,He==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ot=AN(xe);const Ct=this.stack[this.stack.length-1];Ct.value+=ot}function ie(ge){const xe=this.stack.pop();xe.position.end=md(ge.end)}function ce(ge){P.call(this,ge);const xe=this.stack[this.stack.length-1];xe.url=this.sliceSerialize(ge)}function me(ge){P.call(this,ge);const xe=this.stack[this.stack.length-1];xe.url="mailto:"+this.sliceSerialize(ge)}function be(){return{type:"blockquote",children:[]}}function Ae(){return{type:"code",lang:null,meta:null,value:""}}function we(){return{type:"inlineCode",value:""}}function Te(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function De(){return{type:"emphasis",children:[]}}function We(){return{type:"heading",depth:0,children:[]}}function Ye(){return{type:"break"}}function Tt(){return{type:"html",value:""}}function _t(){return{type:"image",title:null,url:"",alt:null}}function Jt(){return{type:"link",title:null,url:"",children:[]}}function Ge(ge){return{type:"list",ordered:ge.type==="listOrdered",start:null,spread:ge._spread,children:[]}}function Ve(ge){return{type:"listItem",spread:ge._spread,checked:null,children:[]}}function Xe(){return{type:"paragraph",children:[]}}function mt(){return{type:"strong",children:[]}}function yt(){return{type:"text",value:""}}function Dt(){return{type:"thematicBreak"}}}function md(t){return{line:t.line,column:t.column,offset:t.offset}}function oY(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?oY(t,r):VRe(t,r)}}function VRe(t,e){let n;for(n in e)if(iY.call(e,n))switch(n){case"canContainEols":{const r=e[n];r&&t[n].push(...r);break}case"transforms":{const r=e[n];r&&t[n].push(...r);break}case"enter":case"exit":{const r=e[n];r&&Object.assign(t[n],r);break}}}function sY(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+M0({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+M0({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+M0({start:e.start,end:e.end})+") is still open")}function jRe(t){const e=this;e.parser=n;function n(r){return $Re(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function WRe(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)}function KRe(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
|
|
@@ -607,7 +607,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),Cr=Be,Cn=St),Ht===void
|
|
|
607
607
|
c10.341,0,18.875-7.326,18.875-19.107C125.659,143.152,117.425,135.42,106.33,135.42z M106.108,163.158h-7.703v-17.097h7.703
|
|
608
608
|
c4.755,0,7.78,3.711,7.78,8.553C113.878,159.447,110.863,163.158,106.108,163.158z`})]})}),n2e=()=>A.jsxs("svg",{width:"49px",height:"67px",viewBox:"0 0 49 67",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",children:[A.jsx("title",{children:"Sheets-icon"}),A.jsx("desc",{children:"Created with Sketch."}),A.jsxs("defs",{children:[A.jsx("path",{d:"M29.5833333,0 L4.4375,0 C1.996875,0 0,1.996875 0,4.4375 L0,60.6458333 C0,63.0864583 1.996875,65.0833333 4.4375,65.0833333 L42.8958333,65.0833333 C45.3364583,65.0833333 47.3333333,63.0864583 47.3333333,60.6458333 L47.3333333,17.75 L29.5833333,0 Z",id:"path-1"}),A.jsxs("linearGradient",{x1:"50.0053945%",y1:"8.58610612%",x2:"50.0053945%",y2:"100.013939%",id:"linearGradient-7",children:[A.jsx("stop",{stopColor:"#263238",stopOpacity:"0.2",offset:"0%"}),A.jsx("stop",{stopColor:"#263238",stopOpacity:"0.02",offset:"100%"})]}),A.jsxs("radialGradient",{cx:"3.16804688%",cy:"2.71744318%",fx:"3.16804688%",fy:"2.71744318%",r:"161.248516%",gradientTransform:"translate(0.031680,0.027174),scale(1.000000,0.727273),translate(-0.031680,-0.027174)",id:"radialGradient-16",children:[A.jsx("stop",{stopColor:"#FFFFFF",stopOpacity:"0.1",offset:"0%"}),A.jsx("stop",{stopColor:"#FFFFFF",stopOpacity:"0",offset:"100%"})]})]}),A.jsx("g",{id:"Page-1",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:A.jsx("g",{id:"Consumer-Apps-Sheets-Large-VD-R8-",transform:"translate(-451.000000, -451.000000)",children:A.jsx("g",{id:"Hero",transform:"translate(0.000000, 63.000000)",children:A.jsx("g",{id:"Personal",transform:"translate(277.000000, 299.000000)",children:A.jsx("g",{id:"Sheets-icon",transform:"translate(174.833333, 89.958333)",children:A.jsxs("g",{id:"Group",children:[A.jsxs("g",{id:"Clipped",children:[A.jsx("mask",{id:"mask-2",fill:"white",children:A.jsx("use",{xlinkHref:"#path-1"})}),A.jsx("path",{d:"M29.5833333,0 L4.4375,0 C1.996875,0 0,1.996875 0,4.4375 L0,60.6458333 C0,63.0864583 1.996875,65.0833333 4.4375,65.0833333 L42.8958333,65.0833333 C45.3364583,65.0833333 47.3333333,63.0864583 47.3333333,60.6458333 L47.3333333,17.75 L36.9791667,10.3541667 L29.5833333,0 Z",id:"Path",fill:"#0F9D58",fillRule:"nonzero",mask:"url(#mask-2)"})]}),A.jsxs("g",{id:"Clipped",children:[A.jsx("mask",{id:"mask-4",fill:"white",children:A.jsx("use",{xlinkHref:"#path-1"})}),A.jsx("path",{d:"M11.8333333,31.8020833 L11.8333333,53.25 L35.5,53.25 L35.5,31.8020833 L11.8333333,31.8020833 Z M22.1875,50.2916667 L14.7916667,50.2916667 L14.7916667,46.59375 L22.1875,46.59375 L22.1875,50.2916667 Z M22.1875,44.375 L14.7916667,44.375 L14.7916667,40.6770833 L22.1875,40.6770833 L22.1875,44.375 Z M22.1875,38.4583333 L14.7916667,38.4583333 L14.7916667,34.7604167 L22.1875,34.7604167 L22.1875,38.4583333 Z M32.5416667,50.2916667 L25.1458333,50.2916667 L25.1458333,46.59375 L32.5416667,46.59375 L32.5416667,50.2916667 Z M32.5416667,44.375 L25.1458333,44.375 L25.1458333,40.6770833 L32.5416667,40.6770833 L32.5416667,44.375 Z M32.5416667,38.4583333 L25.1458333,38.4583333 L25.1458333,34.7604167 L32.5416667,34.7604167 L32.5416667,38.4583333 Z",id:"Shape",fill:"#F1F1F1",fillRule:"nonzero",mask:"url(#mask-4)"})]}),A.jsxs("g",{id:"Clipped",children:[A.jsx("mask",{id:"mask-6",fill:"white",children:A.jsx("use",{xlinkHref:"#path-1"})}),A.jsx("polygon",{id:"Path",fill:"url(#linearGradient-7)",fillRule:"nonzero",mask:"url(#mask-6)",points:"30.8813021 16.4520313 47.3333333 32.9003646 47.3333333 17.75"})]}),A.jsxs("g",{id:"Clipped",children:[A.jsx("mask",{id:"mask-9",fill:"white",children:A.jsx("use",{xlinkHref:"#path-1"})}),A.jsx("g",{id:"Group",mask:"url(#mask-9)",children:A.jsx("g",{transform:"translate(26.625000, -2.958333)",children:A.jsx("path",{d:"M2.95833333,2.95833333 L2.95833333,16.2708333 C2.95833333,18.7225521 4.94411458,20.7083333 7.39583333,20.7083333 L20.7083333,20.7083333 L2.95833333,2.95833333 Z",id:"Path",fill:"#87CEAC",fillRule:"nonzero"})})})]}),A.jsxs("g",{id:"Clipped",children:[A.jsx("mask",{id:"mask-11",fill:"white",children:A.jsx("use",{xlinkHref:"#path-1"})}),A.jsx("path",{d:"M4.4375,0 C1.996875,0 0,1.996875 0,4.4375 L0,4.80729167 C0,2.36666667 1.996875,0.369791667 4.4375,0.369791667 L29.5833333,0.369791667 L29.5833333,0 L4.4375,0 Z",id:"Path",fillOpacity:"0.2",fill:"#FFFFFF",fillRule:"nonzero",mask:"url(#mask-11)"})]}),A.jsxs("g",{id:"Clipped",children:[A.jsx("mask",{id:"mask-13",fill:"white",children:A.jsx("use",{xlinkHref:"#path-1"})}),A.jsx("path",{d:"M42.8958333,64.7135417 L4.4375,64.7135417 C1.996875,64.7135417 0,62.7166667 0,60.2760417 L0,60.6458333 C0,63.0864583 1.996875,65.0833333 4.4375,65.0833333 L42.8958333,65.0833333 C45.3364583,65.0833333 47.3333333,63.0864583 47.3333333,60.6458333 L47.3333333,25.1666667 L42.8958333,21.0208333 L42.8958333,64.7135417 Z",id:"Path",fill:"url(#radialGradient-16)",fillRule:"nonzero",mask:"url(#mask-13)"})]})]})})})})})})]}),r2e=({className:t,width:e=40,height:n=40})=>A.jsxs("svg",{width:e,height:n,version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512",className:t,children:[A.jsx("path",{style:{fill:"#E2E5E7"},d:"M128,0c-17.6,0-32,14.4-32,32v448c0,17.6,14.4,32,32,32h320c17.6,0,32-14.4,32-32V128L352,0H128z"}),A.jsx("path",{style:{fill:"#B0B7BD"},d:"M384,128h96L352,0v96C352,113.6,366.4,128,384,128z"}),A.jsx("polygon",{style:{fill:"#CAD1D8"},points:"480,224 384,128 480,128 "}),A.jsx("path",{style:{fill:"#576D7E"},d:"M416,416c0,8.8-7.2,16-16,16H48c-8.8,0-16-7.2-16-16V256c0-8.8,7.2-16,16-16h352c8.8,0,16,7.2,16,16V416z"}),A.jsxs("g",{children:[A.jsx("path",{style:{fill:"#FFFFFF"},d:"M132.784,311.472H110.4c-11.136,0-11.136-16.368,0-16.368h60.512c11.392,0,11.392,16.368,0,16.368h-21.248v64.592c0,11.12-16.896,11.392-16.896,0v-64.592H132.784z"}),A.jsx("path",{style:{fill:"#FFFFFF"},d:"M224.416,326.176l22.272-27.888c6.656-8.688,19.568,2.432,12.288,10.752c-7.68,9.088-15.728,18.944-23.424,29.024l26.112,32.496c7.024,9.6-7.04,18.816-13.952,9.344l-23.536-30.192l-23.152,30.832c-6.528,9.328-20.992-1.152-13.68-9.856l25.696-32.624c-8.048-10.096-15.856-19.936-23.664-29.024c-8.064-9.6,6.912-19.44,12.784-10.48L224.416,326.176z"}),A.jsx("path",{style:{fill:"#FFFFFF"},d:"M298.288,311.472H275.92c-11.136,0-11.136-16.368,0-16.368h60.496c11.392,0,11.392,16.368,0,16.368h-21.232v64.592c0,11.12-16.896,11.392-16.896,0V311.472z"})]}),A.jsx("path",{style:{fill:"#CAD1D8"},d:"M400,432H96v16h304c8.8,0,16-7.2,16-16v-16C416,424.8,408.8,432,400,432z"})]});function FQ({document:t,className:e,onRemove:n,startIndex:r=0}){var a;const{openArtifactInCanvas:i}=LQ(),{url:o,sources:s}=t,l=o.split("/"),u=l.length>0?l[l.length-1]:o,d=(a=u==null?void 0:u.split(".").pop())!=null?a:"",f={name:u,type:d},m=A.jsxs("div",{className:`bg-secondary rounded-lg p-2 ${e}`,children:[A.jsx(s2e,{className:"cursor-pointer",file:f,onRemove:n}),A.jsx("div",{className:"flex max-w-60 flex-wrap space-x-2 px-2",children:s.map((h,E)=>A.jsx("div",{children:A.jsx(a2e,{node:h,index:r+E})},h.id))})]});return o.endsWith(".pdf")?A.jsx("div",{onClick:h=>{h.preventDefault(),h.stopPropagation(),i({type:"document",created_at:Date.now(),data:{url:o}})},children:m}):A.jsx("div",{onClick:()=>window.open(o,"_blank"),children:m})}function a2e({node:t,index:e}){return t?A.jsxs(CTe,{openDelay:100,closeDelay:100,children:[A.jsx(ATe,{className:"cursor-default",onClick:n=>{n.preventDefault(),n.stopPropagation()},children:A.jsx(DM,{index:e,className:"hover:bg-primary hover:text-white"})}),A.jsx(RH,{className:"w-[400px]",onClick:n=>n.stopPropagation(),children:A.jsx(i2e,{nodeInfo:t})})]}):A.jsx(DM,{index:e})}function i2e({nodeInfo:t}){var e,n,r,a;const{isCopied:i,copyToClipboard:o}=IM({timeout:1e3}),s=(a=(r=(e=t.metadata)==null?void 0:e.page_number)!=null?r:(n=t.metadata)==null?void 0:n.page_label)!=null?a:null;return A.jsxs("div",{className:"space-y-2",children:[A.jsxs("div",{className:"flex items-center justify-between",children:[A.jsx("span",{className:"font-semibold",children:s?`On page ${s}:`:"Node content:"}),t.text&&A.jsx(Xn,{onClick:l=>{l.stopPropagation(),o(t.text)},size:"icon-sm",variant:"ghost",startIcon:i?A.jsx(yT,{}):A.jsx(Ex,{})})]}),t.text&&A.jsxs("pre",{className:"max-h-[200px] overflow-auto whitespace-pre-line",children:["“",t.text,"”"]})]})}var o2e={csv:A.jsx(n2e,{}),pdf:A.jsx(t2e,{}),docx:A.jsx(e2e,{}),txt:A.jsx(r2e,{})};function s2e(t){var e;const{onRemove:n,file:r,className:a}=t;return A.jsxs("div",{className:Zt("bg-secondary relative w-60 max-w-60 rounded-lg p-2 text-sm",a),children:[A.jsxs("div",{className:"flex flex-row items-center gap-2",children:[A.jsx("div",{className:"relative flex h-8 w-8 shrink-0 items-center justify-center overflow-hidden rounded-md",children:(e=o2e[r.type])!=null?e:A.jsx(WG,{})}),A.jsxs("div",{className:"overflow-hidden",children:[A.jsxs("div",{className:"truncate font-semibold",children:[r.name," ",r.size?`(${l2e(r.size)} KB)`:""]}),r.type&&A.jsx("div",{className:"text-token-text-tertiary flex items-center gap-2 truncate",children:A.jsxs("span",{children:[r.type.toUpperCase()," File"]})})]})]}),n&&A.jsx("div",{className:Zt("absolute -right-2 -top-2 z-10 h-6 w-6 rounded-full bg-gray-500 text-white"),children:A.jsx(VG,{className:"h-6 w-6 rounded-full bg-gray-500 text-white",onClick:i=>{i.stopPropagation(),n()}})})]})}function l2e(t){return Math.round(t/1024*10)/10}function BQ(t){return t.map(n=>(n.url&&(n.url=n.url.replace(/\/$/,"")),n))}function c2e({data:t,className:e}){const n=N.useMemo(()=>{const r={};return t.nodes.filter(a=>a.url).forEach(a=>{var i,o;const s=(i=a.url)!=null?i:"";(o=r[s])!=null||(r[s]=[]),r[s].push(a)}),Object.entries(r).map(([a,i])=>({url:a,sources:i}))},[t.nodes]);return n.length===0?null:A.jsxs("div",{className:Zt("space-y-2 text-sm",e),children:[A.jsx("div",{className:"text-lg font-semibold",children:"Sources:"}),A.jsx("div",{className:"flex flex-wrap gap-3",children:n.map((r,a)=>{const i=n.slice(0,a).reduce((o,s)=>o+s.sources.length,0);return A.jsx(FQ,{document:r,startIndex:i},r.url)})})]})}function u2e({index:t}){return A.jsx(DM,{index:t})}var d2e={javascript:".js",python:".py",java:".java",c:".c",cpp:".cpp","c++":".cpp","c#":".cs",ruby:".rb",php:".php",swift:".swift","objective-c":".m",kotlin:".kt",typescript:".ts",go:".go",perl:".pl",rust:".rs",scala:".scala",haskell:".hs",lua:".lua",shell:".sh",sql:".sql",html:".html",css:".css"},p2e=(t,e=!1)=>{const n="ABCDEFGHJKLMNPQRSTUVWXY3456789";let r="";for(let a=0;a<t;a++)r+=n.charAt(Math.floor(Math.random()*n.length));return e?r.toLowerCase():r},f2e={ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",py:"python",sh:"shell",bash:"shell",md:"markdown",yml:"yaml"},UQ=N.memo(t=>{var e;const{language:n,value:r,className:a,headerClassName:i,codeClassName:o,showHeader:s=!0}=t,{isCopied:l,copyToClipboard:u}=IM({timeout:2e3}),d=N.useRef(null);N.useEffect(()=>{d.current&&d.current.dataset.highlighted!=="yes"&&YLe.highlightElement(d.current)},[n,r]);const f=()=>{if(typeof window>"u")return;const h=d2e[n]||".file",E=`file-${p2e(3,!0)}${h}`,b=window.prompt("Enter file name",E);if(!b)return;const v=new Blob([r],{type:"text/plain"}),y=URL.createObjectURL(v),C=document.createElement("a");C.download=b,C.href=y,C.style.display="none",document.body.appendChild(C),C.click(),document.body.removeChild(C),URL.revokeObjectURL(y)},m=()=>{l||u(r)};return A.jsxs("div",{className:Zt("codeblock border-border relative w-full rounded-lg border bg-secondary pt-2",a),children:[s&&A.jsxs("div",{className:Zt("flex w-full items-center justify-between px-3",i),children:[A.jsx("span",{className:"text-xs lowercase",children:n}),A.jsxs("div",{className:"flex items-center space-x-1",children:[A.jsx(Xn,{variant:"ghost",onClick:f,size:"icon",startIcon:A.jsx(jG,{})}),A.jsx(Xn,{variant:"ghost",size:"sm",onClick:m,startIcon:l?A.jsx(yT,{}):A.jsx(Ex,{}),label:"Copy code"})]})]}),A.jsx("pre",{className:"m-0 max-w-full overflow-x-auto rounded-b-lg text-[13px] leading-6",children:A.jsx("code",{ref:d,className:Zt(`language-${(e=f2e[n])!=null?e:n} font-mono`,o),children:r})})]})});UQ.displayName="CodeBlock";var m2e=N.memo(dwe,(t,e)=>t.children===e.children),h2e=t=>{const e=[],n=[];let r=t.replace(/```[\s\S]*?```/g,o=>{const s=`__CODE_BLOCK_${e.length}__`;return e.push(o),s});r=r.replace(/`[^`\n]+`/g,o=>{const s=`__INLINE_CODE_${n.length}__`;return n.push(o),s});let i=r.replace(/\\\[([\s\S]*?)\\\]/g,(o,s)=>`$$${s}$$`).replace(/\\\(([\s\S]*?)\\\)/g,(o,s)=>`$${s}$`);return e.forEach((o,s)=>{i=i.replace(`__CODE_BLOCK_${s}__`,o)}),n.forEach((o,s)=>{i=i.replace(`__INLINE_CODE_${s}__`,o)}),i},g2e=t=>t.replace(/(sandbox|attachment|snt):/g,""),_2e=t=>{let e=t;const n=/\[citation:([^\]]+)\]/g;e=e.replace(n,(a,i)=>`[citation:${i.trim()}](javascript:void(0))`);const r=/\[citation:[^\]]*$/g;return e=e.replace(r,""),e},b2e=t=>_2e(h2e(g2e(t)));function Fi(t,e){return n=>(t==null?void 0:t(n))||e(n)}function E2e({content:t,sources:e,backend:n,citationComponent:r,className:a,components:i,languageRenderers:o}){const s=b2e(t);return A.jsx("div",{className:Zt("prose dark:prose-invert prose-p:leading-relaxed prose-pre:p-0 custom-markdown break-words",a),children:A.jsx(m2e,{remarkPlugins:[eDe,dDe],rehypePlugins:[VNe],components:Rr(Qt({},i),{h1:Fi(i==null?void 0:i.h1,({children:l})=>A.jsx("h1",{className:"mt-0 mb-3 text-xl font-semibold",children:l})),h2:Fi(i==null?void 0:i.h2,({children:l})=>A.jsx("h2",{className:"mt-4 mb-2 text-lg font-semibold",children:l})),h3:Fi(i==null?void 0:i.h3,({children:l})=>A.jsx("h3",{className:"mt-3 mb-2 text-base font-semibold",children:l})),h4:Fi(i==null?void 0:i.h4,({children:l})=>A.jsx("h4",{className:"mt-3 mb-1 text-base font-medium",children:l})),h5:Fi(i==null?void 0:i.h5,({children:l})=>A.jsx("h5",{className:"mt-2 mb-1 text-sm font-medium",children:l})),h6:Fi(i==null?void 0:i.h6,({children:l})=>A.jsx("h6",{className:"mt-2 mb-1 text-sm",children:l})),p:Fi(i==null?void 0:i.p,({children:l})=>A.jsx("p",{className:"mb-2 last:mb-0 leading-7",children:l})),ul:l=>{var u=l,{children:d,className:f}=u,m=Mn(u,["children","className"]);const h=f==null?void 0:f.includes("contains-task-list");return A.jsx("ul",Rr(Qt({},m),{className:Zt("my-2 space-y-1",h?"ml-0 list-none":"ml-5 list-disc"),children:d}))},ol:l=>{var u=l,{children:d}=u,f=Mn(u,["children"]);return A.jsx("ol",Rr(Qt({},f),{className:"my-2 ml-5 list-decimal space-y-1",children:d}))},li:l=>{var u=l,{children:d,className:f}=u,m=Mn(u,["children","className"]);const h=f==null?void 0:f.includes("task-list-item");return A.jsx("li",Rr(Qt({},m),{className:Zt("leading-7",h&&"ml-0 list-none"),children:d}))},input:l=>{var u;return A.jsx("input",Rr(Qt({},l),{className:Zt("mr-2 align-middle",(u=l.className)!=null?u:"")}))},blockquote:Fi(i==null?void 0:i.blockquote,({children:l})=>A.jsx("blockquote",{className:"my-3 border-l-2 pl-3 text-sm text-muted-foreground",children:l})),hr:Fi(i==null?void 0:i.hr,()=>A.jsx("hr",{className:"my-4 border-border"})),table:Fi(i==null?void 0:i.table,({children:l})=>A.jsx("div",{className:"my-3 overflow-x-auto",children:A.jsx("table",{className:"w-full border-collapse text-sm",children:l})})),th:Fi(i==null?void 0:i.th,({children:l})=>A.jsx("th",{className:"border border-border bg-secondary px-2 py-1 text-left font-medium",children:l})),td:Fi(i==null?void 0:i.td,({children:l})=>A.jsx("td",{className:"border border-border px-2 py-1 align-top",children:l})),code:Fi(i==null?void 0:i.code,l=>{var u=l,{className:d,children:f}=u,m=Mn(u,["className","children"]);return A.jsx("code",Rr(Qt({className:Zt("rounded bg-secondary px-1 py-0.5 font-mono text-[0.85em]",d)},m),{children:f}))}),pre:l=>{var u=l,{children:d}=u,f=Mn(u,["children"]),m,h,E,b;const y=Array.isArray(d)?d[0]:d,C=(h=(m=y==null?void 0:y.props)==null?void 0:m.className)!=null?h:"",T=/language-(\w+)/.exec(C),w=(E=T==null?void 0:T[1])!=null?E:"",O=(b=y==null?void 0:y.props)==null?void 0:b.children,x=typeof O=="string"?O:String(O??"");if(o!=null&&o[w]){const D=o[w];return A.jsx(D,{code:x.replace(/\n$/,""),className:"mb-2"})}return A.jsx(UQ,Qt({language:w,value:x.replace(/\n$/,""),className:"mb-2"},f))},a:Fi(i==null?void 0:i.a,({href:l,children:u})=>{var d;if(l!=null&&l.startsWith(`${n}/api/files`)&&((d=l.split(".").pop())==null?void 0:d.toLowerCase()))return A.jsx(FQ,{document:{url:n?new URL(decodeURIComponent(l)).href:l,sources:[]},className:"mb-2 mt-2"});if(Array.isArray(u)&&typeof u[0]=="string"&&(u[0].startsWith("citation:")||l!=null&&l.startsWith("citation:"))){const f=u[0].includes("citation:")?u[0].split("citation:")[1].trim():(l==null?void 0:l.replace("citation:","").trim())||"",m=e==null?void 0:e.nodes.findIndex(E=>E.id===f),h=e==null?void 0:e.nodes.find(E=>E.id===f);return m!==void 0&&m>-1&&h?r?A.jsx(r,{index:m,node:h}):A.jsx(u2e,{index:m,node:h}):null}return A.jsx("a",{href:l,target:"_blank",rel:"noopener",children:u})})}),children:s})})}function S2e({questions:t,sendMessage:e,className:n}){return t.length>0&&A.jsx("div",{className:Zt("flex flex-col space-y-2",n),children:t.map((a,i)=>A.jsxs("a",{onClick:()=>{e({id:pCe(),role:KLe.User,parts:[{type:OM,text:a}]})},className:"cursor-pointer text-sm italic hover:underline",children:["->"," ",a]},i))})}var GQ=N.createContext(null),v2e=GQ.Provider;function UC(t){const e=N.useContext(GQ);if(!e)throw new Error("usePart must be used within a ChatPartProvider");return e.part.type!==t?null:e.part}function zQ({className:t,renderData:e}){const n=UC(VLe);return n?A.jsx(JLe,{event:n.data,className:t,renderData:e}):null}function qQ(t){var e,n;const{message:r}=Q0(),a=(e=UC(OM))==null?void 0:e.text,o=WLe(r,DQ).map(l=>l.data),s=(n=o==null?void 0:o.map(l=>Rr(Qt({},l),{nodes:l.nodes?BQ(l.nodes):[]})).flatMap(l=>l.nodes))!=null?n:[];return a?A.jsx(E2e,{content:a,sources:{nodes:s},components:t.components,citationComponent:t.citationComponent,languageRenderers:t.languageRenderers,className:Zt({"bg-primary text-primary-foreground ml-auto w-fit max-w-[80%] rounded-xl px-3 py-2":r.role==="user"},t.className)}):null}function HQ({className:t}){var e,n;const r=(e=UC(DQ))==null?void 0:e.data,a=BQ((n=r==null?void 0:r.nodes)!=null?n:[]);return a.length===0?null:A.jsx(c2e,{data:{nodes:a},className:t})}function $Q({className:t}){var e;const{sendMessage:n}=MQ(),{isLast:r}=Q0(),a=(e=UC(jLe))==null?void 0:e.data;return!r||!n||!a?null:A.jsx(S2e,{questions:a,sendMessage:n,className:t})}function y2e(t){var e,n;const{chatMessagesRef:r}=T2e(),a=(e=t.children)!=null?e:A.jsxs(A.Fragment,{children:[A.jsx(YQ,{}),A.jsx(kM,{}),A.jsx(VQ,{})]}),i=(n=r==null?void 0:r.current)==null?void 0:n.clientHeight,o=i?Math.max(200,Math.floor(i*.8)):300,l=t.isLast&&t.message.role==="assistant"?{minHeight:`${o}px`}:void 0;return A.jsx(ZLe,{value:{message:t.message,isLast:t.isLast},children:A.jsx("div",{className:Zt("group flex gap-4 p-3",t.className),style:l,children:a})})}function YQ(t){var e;const{message:n}=Q0();if(n.role!=="assistant")return null;const r=(e=t.children)!=null?e:A.jsx(bEe,{className:"h-4 w-4"});return A.jsx("div",{className:Zt("bg-background flex h-8 w-8 shrink-0 select-none items-center justify-center rounded-full border",t.className),children:r})}function kM(t){var e;const{message:n}=Q0(),r=(e=t.children)!=null?e:A.jsxs(A.Fragment,{children:[A.jsx(zQ,{}),A.jsx(qQ,{}),A.jsx(HQ,{}),A.jsx($Q,{})]});return A.jsx("div",{className:Zt("flex min-w-0 flex-1 flex-col gap-4",t.className),children:n.parts.map((a,i)=>A.jsx(v2e,{value:{part:a},children:r},i))})}function VQ(t){var e;const{regenerate:n,isLoading:r}=MQ(),{isCopied:a,copyToClipboard:i}=IM({timeout:2e3}),{message:o,isLast:s}=Q0();if(o.role!=="assistant")return null;const l=o.role==="assistant"&&s,u=n&&!r&&l,d=o.parts.filter(m=>m.type===OM).map(m=>m.text).join(`
|
|
609
609
|
|
|
610
|
-
`),f=(e=t.children)!=null?e:A.jsxs(A.Fragment,{children:[A.jsx(Xn,{title:"Copy",onClick:()=>i(d),size:"icon-sm",variant:"outline",startIcon:a?A.jsx(yT,{}):A.jsx(Ex,{})}),u&&A.jsx(Xn,{title:"Regenerate",variant:"outline",size:"icon-sm",onClick:()=>n==null?void 0:n(),startIcon:A.jsx(MEe,{})})]});return A.jsx("div",{className:Zt("flex shrink-0 flex-col gap-2",t.className),children:f})}var yd=N.memo(y2e,(t,e)=>!e.isLast&&t.isLast===e.isLast&&t.message===e.message);yd.Content=kM,yd.Part=kM,yd.Part.Event=zQ,yd.Part.Markdown=qQ,yd.Part.Source=HQ,yd.Part.Suggestion=$Q,yd.Avatar=YQ,yd.Actions=VQ;var jQ=N.createContext(null);jQ.Provider;var T2e=()=>{const t=N.useContext(jQ);if(!t)throw new Error("useChatMessages must be used within a ChatMessagesProvider");return t};function C2e(t){var e;const n=(e=t.children)!=null?e:A.jsx(A.Fragment,{children:A.jsx(WQ,{})});return A.jsx("div",{className:Zt("flex items-center gap-1",t.className),children:n})}function WQ(){const{closeCanvas:t}=LQ();return A.jsx(Xn,{variant:"ghost",size:"icon-sm",onClick:t,startIcon:A.jsx(QG,{})})}C2e.Close=WQ;var MM={exports:{}},LM={};/**
|
|
610
|
+
`),f=(e=t.children)!=null?e:A.jsxs(A.Fragment,{children:[A.jsx(Xn,{title:"Copy",onClick:()=>i(d),size:"icon-sm",variant:"outline",startIcon:a?A.jsx(yT,{}):A.jsx(Ex,{})}),u&&A.jsx(Xn,{title:"Regenerate",variant:"outline",size:"icon-sm",onClick:()=>n==null?void 0:n(),startIcon:A.jsx(MEe,{})})]});return A.jsx("div",{className:Zt("flex shrink-0 flex-col gap-2",t.className),children:f})}var yd=N.memo(y2e,(t,e)=>!e.isLast&&t.isLast===e.isLast&&t.message===e.message);yd.Content=kM,yd.Part=kM,yd.Part.Event=zQ,yd.Part.Markdown=qQ,yd.Part.Source=HQ,yd.Part.Suggestion=$Q,yd.Avatar=YQ,yd.Actions=VQ;var jQ=N.createContext(null);jQ.Provider;var T2e=()=>{const t=N.useContext(jQ);if(!t)throw new Error("useChatMessages must be used within a ChatMessagesProvider");return t};function C2e(t){var e;const n=(e=t.children)!=null?e:A.jsx(A.Fragment,{children:A.jsx(WQ,{})});return A.jsx("div",{className:Zt("flex items-center gap-1",t.className),children:n})}function WQ(){const{closeCanvas:t}=LQ();return A.jsx(Xn,{variant:"ghost",size:"icon-sm",onClick:t,startIcon:A.jsx(QG,{})})}C2e.Close=WQ;var Z0=function(){return Z0=Object.assign||function(e){for(var n,r=1,a=arguments.length;r<a;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Z0.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;var A2e=N.createContext(void 0);function R2e(){var t=N.useContext(A2e);if(!t)throw new Error("useDayPicker must be used within a DayPickerProvider.");return t}N.createContext(void 0),N.forwardRef(function(t,e){var n=R2e(),r=n.classNames,a=n.styles,i=[r.button_reset,r.button];t.className&&i.push(t.className);var o=i.join(" "),s=Z0(Z0({},a.button_reset),a.button);return t.style&&Object.assign(s,t.style),A.jsx("button",Z0({},t,{ref:e,type:"button",className:o,style:s}))}),N.createContext(void 0),N.createContext(void 0);var Pl;(function(t){t.Outside="outside",t.Disabled="disabled",t.Selected="selected",t.Hidden="hidden",t.Today="today",t.RangeStart="range_start",t.RangeEnd="range_end",t.RangeMiddle="range_middle"})(Pl||(Pl={})),Pl.Selected,Pl.Disabled,Pl.Hidden,Pl.Today,Pl.RangeEnd,Pl.RangeMiddle,Pl.RangeStart,Pl.Outside,N.createContext(void 0),N.createContext(void 0),N.createContext(void 0);var MM={exports:{}},LM={};/**
|
|
611
611
|
* @license React
|
|
612
612
|
* use-sync-external-store-shim.production.js
|
|
613
613
|
*
|
|
@@ -615,15 +615,15 @@ https://github.com/highlightjs/highlight.js/issues/2277`),Cr=Be,Cn=St),Ht===void
|
|
|
615
615
|
*
|
|
616
616
|
* This source code is licensed under the MIT license found in the
|
|
617
617
|
* LICENSE file in the root directory of this source tree.
|
|
618
|
-
*/var KQ;function A2e(){if(KQ)return LM;KQ=1;var t=t0();function e(f,m){return f===m&&(f!==0||1/f===1/m)||f!==f&&m!==m}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,a=t.useEffect,i=t.useLayoutEffect,o=t.useDebugValue;function s(f,m){var h=m(),E=r({inst:{value:h,getSnapshot:m}}),b=E[0].inst,v=E[1];return i(function(){b.value=h,b.getSnapshot=m,l(b)&&v({inst:b})},[f,h,m]),a(function(){return l(b)&&v({inst:b}),f(function(){l(b)&&v({inst:b})})},[f]),o(h),h}function l(f){var m=f.getSnapshot;f=f.value;try{var h=m();return!n(f,h)}catch{return!0}}function u(f,m){return m()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:s;return LM.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,LM}var XQ;function QQ(){return XQ||(XQ=1,MM.exports=A2e()),MM.exports}var R2e=QQ();function w2e(){return R2e.useSyncExternalStore(x2e,()=>!0,()=>!1)}function x2e(){return()=>{}}var PM="Avatar",[N2e]=pa(PM),[O2e,ZQ]=N2e(PM),JQ=N.forwardRef((t,e)=>{const{__scopeAvatar:n,...r}=t,[a,i]=N.useState("idle");return A.jsx(O2e,{scope:n,imageLoadingStatus:a,onImageLoadingStatusChange:i,children:A.jsx(ft.span,{...r,ref:e})})});JQ.displayName=PM;var eZ="AvatarImage",tZ=N.forwardRef((t,e)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:a=()=>{},...i}=t,o=ZQ(eZ,n),s=I2e(r,i),l=Pa(u=>{a(u),o.onImageLoadingStatusChange(u)});return Wr(()=>{s!=="idle"&&l(s)},[s,l]),s==="loaded"?A.jsx(ft.img,{...i,ref:e,src:r}):null});tZ.displayName=eZ;var nZ="AvatarFallback",rZ=N.forwardRef((t,e)=>{const{__scopeAvatar:n,delayMs:r,...a}=t,i=ZQ(nZ,n),[o,s]=N.useState(r===void 0);return N.useEffect(()=>{if(r!==void 0){const l=window.setTimeout(()=>s(!0),r);return()=>window.clearTimeout(l)}},[r]),o&&i.imageLoadingStatus!=="loaded"?A.jsx(ft.span,{...a,ref:e}):null});rZ.displayName=nZ;function aZ(t,e){return t?e?(t.src!==e&&(t.src=e),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function I2e(t,{referrerPolicy:e,crossOrigin:n}){const r=w2e(),a=N.useRef(null),i=r?(a.current||(a.current=new window.Image),a.current):null,[o,s]=N.useState(()=>aZ(i,t));return Wr(()=>{s(aZ(i,t))},[i,t]),Wr(()=>{const l=f=>()=>{s(f)};if(!i)return;const u=l("loaded"),d=l("error");return i.addEventListener("load",u),i.addEventListener("error",d),e&&(i.referrerPolicy=e),typeof n=="string"&&(i.crossOrigin=n),()=>{i.removeEventListener("load",u),i.removeEventListener("error",d)}},[i,n,e]),o}var D2e=JQ,k2e=tZ,M2e=rZ;D2e.displayName,k2e.displayName,M2e.displayName;var FM=["Enter"," "],L2e=["ArrowDown","PageUp","Home"],iZ=["ArrowUp","PageDown","End"],P2e=[...L2e,...iZ],F2e={ltr:[...FM,"ArrowRight"],rtl:[...FM,"ArrowLeft"]},B2e={ltr:["ArrowLeft"],rtl:["ArrowRight"]},GC="Menu",[Z0,U2e,G2e]=h0(GC),[Sf,J0]=pa(GC,[G2e,Tl,$T]),BM=Tl(),oZ=$T(),[pQe,og]=Sf(GC),[fQe,eE]=Sf(GC),z2e="MenuAnchor",UM=N.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,a=BM(n);return A.jsx(kh,{...a,...r,ref:e})});UM.displayName=z2e;var q2e="MenuPortal",[mQe,sZ]=Sf(q2e,{forceMount:void 0}),ns="MenuContent",[H2e,GM]=Sf(ns),lZ=N.forwardRef((t,e)=>{const n=sZ(ns,t.__scopeMenu),{forceMount:r=n.forceMount,...a}=t,i=og(ns,t.__scopeMenu),o=eE(ns,t.__scopeMenu);return A.jsx(Z0.Provider,{scope:t.__scopeMenu,children:A.jsx(Fa,{present:r||i.open,children:A.jsx(Z0.Slot,{scope:t.__scopeMenu,children:o.modal?A.jsx($2e,{...a,ref:e}):A.jsx(Y2e,{...a,ref:e})})})})}),$2e=N.forwardRef((t,e)=>{const n=og(ns,t.__scopeMenu),r=N.useRef(null),a=It(e,r);return N.useEffect(()=>{const i=r.current;if(i)return uT(i)},[]),A.jsx(zM,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Le(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Y2e=N.forwardRef((t,e)=>{const n=og(ns,t.__scopeMenu);return A.jsx(zM,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),V2e=rd("MenuContent.ScrollLock"),zM=N.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:a,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:h,disableOutsideScroll:E,...b}=t,v=og(ns,n),y=eE(ns,n),C=BM(n),T=oZ(n),w=U2e(n),[O,x]=N.useState(null),D=N.useRef(null),M=It(e,D,v.onContentChange),F=N.useRef(0),P=N.useRef(""),q=N.useRef(0),j=N.useRef(null),Q=N.useRef("right"),U=N.useRef(0),K=E?p0:N.Fragment,G=E?{as:V2e,allowPinchZoom:!0}:void 0,Y=J=>{var ie,ce;const $=P.current+J,Z=w().filter(me=>!me.disabled),te=document.activeElement,B=(ie=Z.find(me=>me.ref.current===te))==null?void 0:ie.textValue,ae=Z.map(me=>me.textValue),se=aPe(ae,$,B),de=(ce=Z.find(me=>me.textValue===se))==null?void 0:ce.ref.current;(function me(be){P.current=be,window.clearTimeout(F.current),be!==""&&(F.current=window.setTimeout(()=>me(""),1e3))})($),de&&setTimeout(()=>de.focus())};N.useEffect(()=>()=>window.clearTimeout(F.current),[]),Ky();const W=N.useCallback(J=>{var Z,te;return Q.current===((Z=j.current)==null?void 0:Z.side)&&oPe(J,(te=j.current)==null?void 0:te.area)},[]);return A.jsx(H2e,{scope:n,searchRef:P,onItemEnter:N.useCallback(J=>{W(J)&&J.preventDefault()},[W]),onItemLeave:N.useCallback(J=>{var $;W(J)||(($=D.current)==null||$.focus(),x(null))},[W]),onTriggerLeave:N.useCallback(J=>{W(J)&&J.preventDefault()},[W]),pointerGraceTimerRef:q,onPointerGraceIntentChange:N.useCallback(J=>{j.current=J},[]),children:A.jsx(K,{...G,children:A.jsx(i0,{asChild:!0,trapped:a,onMountAutoFocus:Le(i,J=>{var $;J.preventDefault(),($=D.current)==null||$.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:A.jsx(nf,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:h,children:A.jsx(mH,{asChild:!0,...T,dir:y.dir,orientation:"vertical",loop:r,currentTabStopId:O,onCurrentTabStopIdChange:x,onEntryFocus:Le(l,J=>{y.isUsingKeyboardRef.current||J.preventDefault()}),preventScrollOnEntryFocus:!0,children:A.jsx(c0,{role:"menu","aria-orientation":"vertical","data-state":AZ(v.open),"data-radix-menu-content":"",dir:y.dir,...C,...b,ref:M,style:{outline:"none",...b.style},onKeyDown:Le(b.onKeyDown,J=>{const Z=J.target.closest("[data-radix-menu-content]")===J.currentTarget,te=J.ctrlKey||J.altKey||J.metaKey,B=J.key.length===1;Z&&(J.key==="Tab"&&J.preventDefault(),!te&&B&&Y(J.key));const ae=D.current;if(J.target!==ae||!P2e.includes(J.key))return;J.preventDefault();const de=w().filter(ie=>!ie.disabled).map(ie=>ie.ref.current);iZ.includes(J.key)&&de.reverse(),nPe(de)}),onBlur:Le(t.onBlur,J=>{J.currentTarget.contains(J.target)||(window.clearTimeout(F.current),P.current="")}),onPointerMove:Le(t.onPointerMove,nE(J=>{const $=J.target,Z=U.current!==J.clientX;if(J.currentTarget.contains($)&&Z){const te=J.clientX>U.current?"right":"left";Q.current=te,U.current=J.clientX}}))})})})})})})});lZ.displayName=ns;var j2e="MenuGroup",qM=N.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return A.jsx(ft.div,{role:"group",...r,ref:e})});qM.displayName=j2e;var W2e="MenuLabel",cZ=N.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return A.jsx(ft.div,{...r,ref:e})});cZ.displayName=W2e;var zC="MenuItem",uZ="menu.itemSelect",qC=N.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...a}=t,i=N.useRef(null),o=eE(zC,t.__scopeMenu),s=GM(zC,t.__scopeMenu),l=It(e,i),u=N.useRef(!1),d=()=>{const f=i.current;if(!n&&f){const m=new CustomEvent(uZ,{bubbles:!0,cancelable:!0});f.addEventListener(uZ,h=>r==null?void 0:r(h),{once:!0}),V8(f,m),m.defaultPrevented?u.current=!1:o.onClose()}};return A.jsx(dZ,{...a,ref:l,disabled:n,onClick:Le(t.onClick,d),onPointerDown:f=>{var m;(m=t.onPointerDown)==null||m.call(t,f),u.current=!0},onPointerUp:Le(t.onPointerUp,f=>{var m;u.current||(m=f.currentTarget)==null||m.click()}),onKeyDown:Le(t.onKeyDown,f=>{const m=s.searchRef.current!=="";n||m&&f.key===" "||FM.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});qC.displayName=zC;var dZ=N.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:a,...i}=t,o=GM(zC,n),s=oZ(n),l=N.useRef(null),u=It(e,l),[d,f]=N.useState(!1),[m,h]=N.useState("");return N.useEffect(()=>{const E=l.current;E&&h((E.textContent??"").trim())},[i.children]),A.jsx(Z0.ItemSlot,{scope:n,disabled:r,textValue:a??m,children:A.jsx(hH,{asChild:!0,...s,focusable:!r,children:A.jsx(ft.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:u,onPointerMove:Le(t.onPointerMove,nE(E=>{r?o.onItemLeave(E):(o.onItemEnter(E),E.defaultPrevented||E.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Le(t.onPointerLeave,nE(E=>o.onItemLeave(E))),onFocus:Le(t.onFocus,()=>f(!0)),onBlur:Le(t.onBlur,()=>f(!1))})})})}),K2e="MenuCheckboxItem",pZ=N.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...a}=t;return A.jsx(_Z,{scope:t.__scopeMenu,checked:n,children:A.jsx(qC,{role:"menuitemcheckbox","aria-checked":HC(n)?"mixed":n,...a,ref:e,"data-state":$M(n),onSelect:Le(a.onSelect,()=>r==null?void 0:r(HC(n)?!0:!n),{checkForDefaultPrevented:!1})})})});pZ.displayName=K2e;var fZ="MenuRadioGroup",[X2e,Q2e]=Sf(fZ,{value:void 0,onValueChange:()=>{}}),mZ=N.forwardRef((t,e)=>{const{value:n,onValueChange:r,...a}=t,i=Pa(r);return A.jsx(X2e,{scope:t.__scopeMenu,value:n,onValueChange:i,children:A.jsx(qM,{...a,ref:e})})});mZ.displayName=fZ;var hZ="MenuRadioItem",gZ=N.forwardRef((t,e)=>{const{value:n,...r}=t,a=Q2e(hZ,t.__scopeMenu),i=n===a.value;return A.jsx(_Z,{scope:t.__scopeMenu,checked:i,children:A.jsx(qC,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":$M(i),onSelect:Le(r.onSelect,()=>{var o;return(o=a.onValueChange)==null?void 0:o.call(a,n)},{checkForDefaultPrevented:!1})})})});gZ.displayName=hZ;var HM="MenuItemIndicator",[_Z,Z2e]=Sf(HM,{checked:!1}),bZ=N.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...a}=t,i=Z2e(HM,n);return A.jsx(Fa,{present:r||HC(i.checked)||i.checked===!0,children:A.jsx(ft.span,{...a,ref:e,"data-state":$M(i.checked)})})});bZ.displayName=HM;var J2e="MenuSeparator",EZ=N.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return A.jsx(ft.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});EZ.displayName=J2e;var ePe="MenuArrow",SZ=N.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,a=BM(n);return A.jsx(u0,{...a,...r,ref:e})});SZ.displayName=ePe;var tPe="MenuSub",[hQe,vZ]=Sf(tPe),tE="MenuSubTrigger",yZ=N.forwardRef((t,e)=>{const n=og(tE,t.__scopeMenu),r=eE(tE,t.__scopeMenu),a=vZ(tE,t.__scopeMenu),i=GM(tE,t.__scopeMenu),o=N.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:l}=i,u={__scopeMenu:t.__scopeMenu},d=N.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return N.useEffect(()=>d,[d]),N.useEffect(()=>{const f=s.current;return()=>{window.clearTimeout(f),l(null)}},[s,l]),A.jsx(UM,{asChild:!0,...u,children:A.jsx(dZ,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":a.contentId,"data-state":AZ(n.open),...t,ref:Wy(e,a.onTriggerChange),onClick:f=>{var m;(m=t.onClick)==null||m.call(t,f),!(t.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Le(t.onPointerMove,nE(f=>{i.onItemEnter(f),!f.defaultPrevented&&!t.disabled&&!n.open&&!o.current&&(i.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:Le(t.onPointerLeave,nE(f=>{var h,E;d();const m=(h=n.content)==null?void 0:h.getBoundingClientRect();if(m){const b=(E=n.content)==null?void 0:E.dataset.side,v=b==="right",y=v?-5:5,C=m[v?"left":"right"],T=m[v?"right":"left"];i.onPointerGraceIntentChange({area:[{x:f.clientX+y,y:f.clientY},{x:C,y:m.top},{x:T,y:m.top},{x:T,y:m.bottom},{x:C,y:m.bottom}],side:b}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(f),f.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:Le(t.onKeyDown,f=>{var h;const m=i.searchRef.current!=="";t.disabled||m&&f.key===" "||F2e[r.dir].includes(f.key)&&(n.onOpenChange(!0),(h=n.content)==null||h.focus(),f.preventDefault())})})})});yZ.displayName=tE;var TZ="MenuSubContent",CZ=N.forwardRef((t,e)=>{const n=sZ(ns,t.__scopeMenu),{forceMount:r=n.forceMount,...a}=t,i=og(ns,t.__scopeMenu),o=eE(ns,t.__scopeMenu),s=vZ(TZ,t.__scopeMenu),l=N.useRef(null),u=It(e,l);return A.jsx(Z0.Provider,{scope:t.__scopeMenu,children:A.jsx(Fa,{present:r||i.open,children:A.jsx(Z0.Slot,{scope:t.__scopeMenu,children:A.jsx(zM,{id:s.contentId,"aria-labelledby":s.triggerId,...a,ref:u,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var f;o.isUsingKeyboardRef.current&&((f=l.current)==null||f.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:Le(t.onFocusOutside,d=>{d.target!==s.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Le(t.onEscapeKeyDown,d=>{o.onClose(),d.preventDefault()}),onKeyDown:Le(t.onKeyDown,d=>{var h;const f=d.currentTarget.contains(d.target),m=B2e[o.dir].includes(d.key);f&&m&&(i.onOpenChange(!1),(h=s.trigger)==null||h.focus(),d.preventDefault())})})})})})});CZ.displayName=TZ;function AZ(t){return t?"open":"closed"}function HC(t){return t==="indeterminate"}function $M(t){return HC(t)?"indeterminate":t?"checked":"unchecked"}function nPe(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function rPe(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function aPe(t,e,n){const a=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let o=rPe(t,Math.max(i,0));a.length===1&&(o=o.filter(u=>u!==n));const l=o.find(u=>u.toLowerCase().startsWith(a.toLowerCase()));return l!==n?l:void 0}function iPe(t,e){const{x:n,y:r}=t;let a=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){const s=e[i],l=e[o],u=s.x,d=s.y,f=l.x,m=l.y;d>r!=m>r&&n<(f-u)*(r-d)/(m-d)+u&&(a=!a)}return a}function oPe(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return iPe(n,e)}function nE(t){return e=>e.pointerType==="mouse"?t(e):void 0}var YM=UM,VM=lZ,jM=qM,WM=cZ,KM=qC,XM=pZ,QM=mZ,ZM=gZ,JM=bZ,eL=EZ,tL=SZ,nL=yZ,rL=CZ,RZ="ContextMenu",[sPe]=pa(RZ,[J0]),po=J0(),[gQe,wZ]=sPe(RZ),xZ="ContextMenuTrigger",lPe=N.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:r=!1,...a}=t,i=wZ(xZ,n),o=po(n),s=N.useRef({x:0,y:0}),l=N.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...s.current})}),u=N.useRef(0),d=N.useCallback(()=>window.clearTimeout(u.current),[]),f=m=>{s.current={x:m.clientX,y:m.clientY},i.onOpenChange(!0)};return N.useEffect(()=>d,[d]),N.useEffect(()=>void(r&&d()),[r,d]),A.jsxs(A.Fragment,{children:[A.jsx(YM,{...o,virtualRef:l}),A.jsx(ft.span,{"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,...a,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:r?t.onContextMenu:Le(t.onContextMenu,m=>{d(),f(m),m.preventDefault()}),onPointerDown:r?t.onPointerDown:Le(t.onPointerDown,$C(m=>{d(),u.current=window.setTimeout(()=>f(m),700)})),onPointerMove:r?t.onPointerMove:Le(t.onPointerMove,$C(d)),onPointerCancel:r?t.onPointerCancel:Le(t.onPointerCancel,$C(d)),onPointerUp:r?t.onPointerUp:Le(t.onPointerUp,$C(d))})]})});lPe.displayName=xZ;var NZ="ContextMenuContent",OZ=N.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,a=wZ(NZ,n),i=po(n),o=N.useRef(!1);return A.jsx(VM,{...i,...r,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:s=>{var l;(l=t.onCloseAutoFocus)==null||l.call(t,s),!s.defaultPrevented&&o.current&&s.preventDefault(),o.current=!1},onInteractOutside:s=>{var l;(l=t.onInteractOutside)==null||l.call(t,s),!s.defaultPrevented&&!a.modal&&(o.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});OZ.displayName=NZ;var cPe="ContextMenuGroup",uPe=N.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,a=po(n);return A.jsx(jM,{...a,...r,ref:e})});uPe.displayName=cPe;var dPe="ContextMenuLabel",IZ=N.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,a=po(n);return A.jsx(WM,{...a,...r,ref:e})});IZ.displayName=dPe;var pPe="ContextMenuItem",DZ=N.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,a=po(n);return A.jsx(KM,{...a,...r,ref:e})});DZ.displayName=pPe;var fPe="ContextMenuCheckboxItem",kZ=N.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,a=po(n);return A.jsx(XM,{...a,...r,ref:e})});kZ.displayName=fPe;var mPe="ContextMenuRadioGroup",hPe=N.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,a=po(n);return A.jsx(QM,{...a,...r,ref:e})});hPe.displayName=mPe;var gPe="ContextMenuRadioItem",MZ=N.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,a=po(n);return A.jsx(ZM,{...a,...r,ref:e})});MZ.displayName=gPe;var _Pe="ContextMenuItemIndicator",bPe=N.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,a=po(n);return A.jsx(JM,{...a,...r,ref:e})});bPe.displayName=_Pe;var EPe="ContextMenuSeparator",LZ=N.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,a=po(n);return A.jsx(eL,{...a,...r,ref:e})});LZ.displayName=EPe;var SPe="ContextMenuArrow",vPe=N.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,a=po(n);return A.jsx(tL,{...a,...r,ref:e})});vPe.displayName=SPe;var yPe="ContextMenuSubTrigger",PZ=N.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,a=po(n);return A.jsx(nL,{...a,...r,ref:e})});PZ.displayName=yPe;var TPe="ContextMenuSubContent",FZ=N.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,a=po(n);return A.jsx(rL,{...a,...r,ref:e,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});FZ.displayName=TPe;function $C(t){return e=>e.pointerType!=="mouse"?t(e):void 0}var CPe=OZ,APe=IZ,RPe=DZ,wPe=kZ,xPe=MZ,NPe=LZ,OPe=PZ,IPe=FZ;OPe.displayName,IPe.displayName,CPe.displayName,RPe.displayName,wPe.displayName,xPe.displayName,APe.displayName,NPe.displayName,N.createContext({});var rE=function(){return rE=Object.assign||function(e){for(var n,r=1,a=arguments.length;r<a;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},rE.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;var DPe=N.createContext(void 0);function kPe(){var t=N.useContext(DPe);if(!t)throw new Error("useDayPicker must be used within a DayPickerProvider.");return t}N.createContext(void 0),N.forwardRef(function(t,e){var n=kPe(),r=n.classNames,a=n.styles,i=[r.button_reset,r.button];t.className&&i.push(t.className);var o=i.join(" "),s=rE(rE({},a.button_reset),a.button);return t.style&&Object.assign(s,t.style),A.jsx("button",rE({},t,{ref:e,type:"button",className:o,style:s}))}),N.createContext(void 0),N.createContext(void 0);var Pl;(function(t){t.Outside="outside",t.Disabled="disabled",t.Selected="selected",t.Hidden="hidden",t.Today="today",t.RangeStart="range_start",t.RangeEnd="range_end",t.RangeMiddle="range_middle"})(Pl||(Pl={})),Pl.Selected,Pl.Disabled,Pl.Hidden,Pl.Today,Pl.RangeEnd,Pl.RangeMiddle,Pl.RangeStart,Pl.Outside,N.createContext(void 0),N.createContext(void 0),N.createContext(void 0);const MPe=Oe.createContext(null);MPe.displayName="HookFormContext",typeof window<"u"?Oe.useLayoutEffect:Oe.useEffect,N.createContext({}),N.createContext({});function LPe(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",e.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}const PPe=Oe.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:"bottom",shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),YC=()=>{const t=Oe.useContext(PPe);if(!t)throw new Error("useDrawerContext must be used within a Drawer.Root");return t};LPe(`[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(
|
|
618
|
+
*/var KQ;function w2e(){if(KQ)return LM;KQ=1;var t=t0();function e(f,m){return f===m&&(f!==0||1/f===1/m)||f!==f&&m!==m}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,a=t.useEffect,i=t.useLayoutEffect,o=t.useDebugValue;function s(f,m){var h=m(),E=r({inst:{value:h,getSnapshot:m}}),b=E[0].inst,v=E[1];return i(function(){b.value=h,b.getSnapshot=m,l(b)&&v({inst:b})},[f,h,m]),a(function(){return l(b)&&v({inst:b}),f(function(){l(b)&&v({inst:b})})},[f]),o(h),h}function l(f){var m=f.getSnapshot;f=f.value;try{var h=m();return!n(f,h)}catch{return!0}}function u(f,m){return m()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:s;return LM.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,LM}var XQ;function QQ(){return XQ||(XQ=1,MM.exports=w2e()),MM.exports}var x2e=QQ();function N2e(){return x2e.useSyncExternalStore(O2e,()=>!0,()=>!1)}function O2e(){return()=>{}}var PM="Avatar",[I2e]=pa(PM),[D2e,ZQ]=I2e(PM),JQ=N.forwardRef((t,e)=>{const{__scopeAvatar:n,...r}=t,[a,i]=N.useState("idle");return A.jsx(D2e,{scope:n,imageLoadingStatus:a,onImageLoadingStatusChange:i,children:A.jsx(ft.span,{...r,ref:e})})});JQ.displayName=PM;var eZ="AvatarImage",tZ=N.forwardRef((t,e)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:a=()=>{},...i}=t,o=ZQ(eZ,n),s=k2e(r,i),l=Pa(u=>{a(u),o.onImageLoadingStatusChange(u)});return Wr(()=>{s!=="idle"&&l(s)},[s,l]),s==="loaded"?A.jsx(ft.img,{...i,ref:e,src:r}):null});tZ.displayName=eZ;var nZ="AvatarFallback",rZ=N.forwardRef((t,e)=>{const{__scopeAvatar:n,delayMs:r,...a}=t,i=ZQ(nZ,n),[o,s]=N.useState(r===void 0);return N.useEffect(()=>{if(r!==void 0){const l=window.setTimeout(()=>s(!0),r);return()=>window.clearTimeout(l)}},[r]),o&&i.imageLoadingStatus!=="loaded"?A.jsx(ft.span,{...a,ref:e}):null});rZ.displayName=nZ;function aZ(t,e){return t?e?(t.src!==e&&(t.src=e),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function k2e(t,{referrerPolicy:e,crossOrigin:n}){const r=N2e(),a=N.useRef(null),i=r?(a.current||(a.current=new window.Image),a.current):null,[o,s]=N.useState(()=>aZ(i,t));return Wr(()=>{s(aZ(i,t))},[i,t]),Wr(()=>{const l=f=>()=>{s(f)};if(!i)return;const u=l("loaded"),d=l("error");return i.addEventListener("load",u),i.addEventListener("error",d),e&&(i.referrerPolicy=e),typeof n=="string"&&(i.crossOrigin=n),()=>{i.removeEventListener("load",u),i.removeEventListener("error",d)}},[i,n,e]),o}var M2e=JQ,L2e=tZ,P2e=rZ;M2e.displayName,L2e.displayName,P2e.displayName;var FM=["Enter"," "],F2e=["ArrowDown","PageUp","Home"],iZ=["ArrowUp","PageDown","End"],B2e=[...F2e,...iZ],U2e={ltr:[...FM,"ArrowRight"],rtl:[...FM,"ArrowLeft"]},G2e={ltr:["ArrowLeft"],rtl:["ArrowRight"]},GC="Menu",[J0,z2e,q2e]=h0(GC),[Sf,eE]=pa(GC,[q2e,Tl,$T]),BM=Tl(),oZ=$T(),[pQe,og]=Sf(GC),[fQe,tE]=Sf(GC),H2e="MenuAnchor",UM=N.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,a=BM(n);return A.jsx(kh,{...a,...r,ref:e})});UM.displayName=H2e;var $2e="MenuPortal",[mQe,sZ]=Sf($2e,{forceMount:void 0}),ns="MenuContent",[Y2e,GM]=Sf(ns),lZ=N.forwardRef((t,e)=>{const n=sZ(ns,t.__scopeMenu),{forceMount:r=n.forceMount,...a}=t,i=og(ns,t.__scopeMenu),o=tE(ns,t.__scopeMenu);return A.jsx(J0.Provider,{scope:t.__scopeMenu,children:A.jsx(Fa,{present:r||i.open,children:A.jsx(J0.Slot,{scope:t.__scopeMenu,children:o.modal?A.jsx(V2e,{...a,ref:e}):A.jsx(j2e,{...a,ref:e})})})})}),V2e=N.forwardRef((t,e)=>{const n=og(ns,t.__scopeMenu),r=N.useRef(null),a=It(e,r);return N.useEffect(()=>{const i=r.current;if(i)return uT(i)},[]),A.jsx(zM,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Le(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),j2e=N.forwardRef((t,e)=>{const n=og(ns,t.__scopeMenu);return A.jsx(zM,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),W2e=rd("MenuContent.ScrollLock"),zM=N.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:a,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:h,disableOutsideScroll:E,...b}=t,v=og(ns,n),y=tE(ns,n),C=BM(n),T=oZ(n),w=z2e(n),[O,x]=N.useState(null),D=N.useRef(null),M=It(e,D,v.onContentChange),F=N.useRef(0),P=N.useRef(""),q=N.useRef(0),j=N.useRef(null),Q=N.useRef("right"),U=N.useRef(0),K=E?p0:N.Fragment,G=E?{as:W2e,allowPinchZoom:!0}:void 0,Y=J=>{var ie,ce;const $=P.current+J,Z=w().filter(me=>!me.disabled),te=document.activeElement,B=(ie=Z.find(me=>me.ref.current===te))==null?void 0:ie.textValue,ae=Z.map(me=>me.textValue),se=oPe(ae,$,B),de=(ce=Z.find(me=>me.textValue===se))==null?void 0:ce.ref.current;(function me(be){P.current=be,window.clearTimeout(F.current),be!==""&&(F.current=window.setTimeout(()=>me(""),1e3))})($),de&&setTimeout(()=>de.focus())};N.useEffect(()=>()=>window.clearTimeout(F.current),[]),Ky();const W=N.useCallback(J=>{var Z,te;return Q.current===((Z=j.current)==null?void 0:Z.side)&&lPe(J,(te=j.current)==null?void 0:te.area)},[]);return A.jsx(Y2e,{scope:n,searchRef:P,onItemEnter:N.useCallback(J=>{W(J)&&J.preventDefault()},[W]),onItemLeave:N.useCallback(J=>{var $;W(J)||(($=D.current)==null||$.focus(),x(null))},[W]),onTriggerLeave:N.useCallback(J=>{W(J)&&J.preventDefault()},[W]),pointerGraceTimerRef:q,onPointerGraceIntentChange:N.useCallback(J=>{j.current=J},[]),children:A.jsx(K,{...G,children:A.jsx(i0,{asChild:!0,trapped:a,onMountAutoFocus:Le(i,J=>{var $;J.preventDefault(),($=D.current)==null||$.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:A.jsx(nf,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:h,children:A.jsx(mH,{asChild:!0,...T,dir:y.dir,orientation:"vertical",loop:r,currentTabStopId:O,onCurrentTabStopIdChange:x,onEntryFocus:Le(l,J=>{y.isUsingKeyboardRef.current||J.preventDefault()}),preventScrollOnEntryFocus:!0,children:A.jsx(c0,{role:"menu","aria-orientation":"vertical","data-state":AZ(v.open),"data-radix-menu-content":"",dir:y.dir,...C,...b,ref:M,style:{outline:"none",...b.style},onKeyDown:Le(b.onKeyDown,J=>{const Z=J.target.closest("[data-radix-menu-content]")===J.currentTarget,te=J.ctrlKey||J.altKey||J.metaKey,B=J.key.length===1;Z&&(J.key==="Tab"&&J.preventDefault(),!te&&B&&Y(J.key));const ae=D.current;if(J.target!==ae||!B2e.includes(J.key))return;J.preventDefault();const de=w().filter(ie=>!ie.disabled).map(ie=>ie.ref.current);iZ.includes(J.key)&&de.reverse(),aPe(de)}),onBlur:Le(t.onBlur,J=>{J.currentTarget.contains(J.target)||(window.clearTimeout(F.current),P.current="")}),onPointerMove:Le(t.onPointerMove,rE(J=>{const $=J.target,Z=U.current!==J.clientX;if(J.currentTarget.contains($)&&Z){const te=J.clientX>U.current?"right":"left";Q.current=te,U.current=J.clientX}}))})})})})})})});lZ.displayName=ns;var K2e="MenuGroup",qM=N.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return A.jsx(ft.div,{role:"group",...r,ref:e})});qM.displayName=K2e;var X2e="MenuLabel",cZ=N.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return A.jsx(ft.div,{...r,ref:e})});cZ.displayName=X2e;var zC="MenuItem",uZ="menu.itemSelect",qC=N.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...a}=t,i=N.useRef(null),o=tE(zC,t.__scopeMenu),s=GM(zC,t.__scopeMenu),l=It(e,i),u=N.useRef(!1),d=()=>{const f=i.current;if(!n&&f){const m=new CustomEvent(uZ,{bubbles:!0,cancelable:!0});f.addEventListener(uZ,h=>r==null?void 0:r(h),{once:!0}),V8(f,m),m.defaultPrevented?u.current=!1:o.onClose()}};return A.jsx(dZ,{...a,ref:l,disabled:n,onClick:Le(t.onClick,d),onPointerDown:f=>{var m;(m=t.onPointerDown)==null||m.call(t,f),u.current=!0},onPointerUp:Le(t.onPointerUp,f=>{var m;u.current||(m=f.currentTarget)==null||m.click()}),onKeyDown:Le(t.onKeyDown,f=>{const m=s.searchRef.current!=="";n||m&&f.key===" "||FM.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});qC.displayName=zC;var dZ=N.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:a,...i}=t,o=GM(zC,n),s=oZ(n),l=N.useRef(null),u=It(e,l),[d,f]=N.useState(!1),[m,h]=N.useState("");return N.useEffect(()=>{const E=l.current;E&&h((E.textContent??"").trim())},[i.children]),A.jsx(J0.ItemSlot,{scope:n,disabled:r,textValue:a??m,children:A.jsx(hH,{asChild:!0,...s,focusable:!r,children:A.jsx(ft.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:u,onPointerMove:Le(t.onPointerMove,rE(E=>{r?o.onItemLeave(E):(o.onItemEnter(E),E.defaultPrevented||E.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Le(t.onPointerLeave,rE(E=>o.onItemLeave(E))),onFocus:Le(t.onFocus,()=>f(!0)),onBlur:Le(t.onBlur,()=>f(!1))})})})}),Q2e="MenuCheckboxItem",pZ=N.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...a}=t;return A.jsx(_Z,{scope:t.__scopeMenu,checked:n,children:A.jsx(qC,{role:"menuitemcheckbox","aria-checked":HC(n)?"mixed":n,...a,ref:e,"data-state":$M(n),onSelect:Le(a.onSelect,()=>r==null?void 0:r(HC(n)?!0:!n),{checkForDefaultPrevented:!1})})})});pZ.displayName=Q2e;var fZ="MenuRadioGroup",[Z2e,J2e]=Sf(fZ,{value:void 0,onValueChange:()=>{}}),mZ=N.forwardRef((t,e)=>{const{value:n,onValueChange:r,...a}=t,i=Pa(r);return A.jsx(Z2e,{scope:t.__scopeMenu,value:n,onValueChange:i,children:A.jsx(qM,{...a,ref:e})})});mZ.displayName=fZ;var hZ="MenuRadioItem",gZ=N.forwardRef((t,e)=>{const{value:n,...r}=t,a=J2e(hZ,t.__scopeMenu),i=n===a.value;return A.jsx(_Z,{scope:t.__scopeMenu,checked:i,children:A.jsx(qC,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":$M(i),onSelect:Le(r.onSelect,()=>{var o;return(o=a.onValueChange)==null?void 0:o.call(a,n)},{checkForDefaultPrevented:!1})})})});gZ.displayName=hZ;var HM="MenuItemIndicator",[_Z,ePe]=Sf(HM,{checked:!1}),bZ=N.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...a}=t,i=ePe(HM,n);return A.jsx(Fa,{present:r||HC(i.checked)||i.checked===!0,children:A.jsx(ft.span,{...a,ref:e,"data-state":$M(i.checked)})})});bZ.displayName=HM;var tPe="MenuSeparator",EZ=N.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return A.jsx(ft.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});EZ.displayName=tPe;var nPe="MenuArrow",SZ=N.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,a=BM(n);return A.jsx(u0,{...a,...r,ref:e})});SZ.displayName=nPe;var rPe="MenuSub",[hQe,vZ]=Sf(rPe),nE="MenuSubTrigger",yZ=N.forwardRef((t,e)=>{const n=og(nE,t.__scopeMenu),r=tE(nE,t.__scopeMenu),a=vZ(nE,t.__scopeMenu),i=GM(nE,t.__scopeMenu),o=N.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:l}=i,u={__scopeMenu:t.__scopeMenu},d=N.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return N.useEffect(()=>d,[d]),N.useEffect(()=>{const f=s.current;return()=>{window.clearTimeout(f),l(null)}},[s,l]),A.jsx(UM,{asChild:!0,...u,children:A.jsx(dZ,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":a.contentId,"data-state":AZ(n.open),...t,ref:Wy(e,a.onTriggerChange),onClick:f=>{var m;(m=t.onClick)==null||m.call(t,f),!(t.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Le(t.onPointerMove,rE(f=>{i.onItemEnter(f),!f.defaultPrevented&&!t.disabled&&!n.open&&!o.current&&(i.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:Le(t.onPointerLeave,rE(f=>{var h,E;d();const m=(h=n.content)==null?void 0:h.getBoundingClientRect();if(m){const b=(E=n.content)==null?void 0:E.dataset.side,v=b==="right",y=v?-5:5,C=m[v?"left":"right"],T=m[v?"right":"left"];i.onPointerGraceIntentChange({area:[{x:f.clientX+y,y:f.clientY},{x:C,y:m.top},{x:T,y:m.top},{x:T,y:m.bottom},{x:C,y:m.bottom}],side:b}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(f),f.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:Le(t.onKeyDown,f=>{var h;const m=i.searchRef.current!=="";t.disabled||m&&f.key===" "||U2e[r.dir].includes(f.key)&&(n.onOpenChange(!0),(h=n.content)==null||h.focus(),f.preventDefault())})})})});yZ.displayName=nE;var TZ="MenuSubContent",CZ=N.forwardRef((t,e)=>{const n=sZ(ns,t.__scopeMenu),{forceMount:r=n.forceMount,...a}=t,i=og(ns,t.__scopeMenu),o=tE(ns,t.__scopeMenu),s=vZ(TZ,t.__scopeMenu),l=N.useRef(null),u=It(e,l);return A.jsx(J0.Provider,{scope:t.__scopeMenu,children:A.jsx(Fa,{present:r||i.open,children:A.jsx(J0.Slot,{scope:t.__scopeMenu,children:A.jsx(zM,{id:s.contentId,"aria-labelledby":s.triggerId,...a,ref:u,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var f;o.isUsingKeyboardRef.current&&((f=l.current)==null||f.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:Le(t.onFocusOutside,d=>{d.target!==s.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Le(t.onEscapeKeyDown,d=>{o.onClose(),d.preventDefault()}),onKeyDown:Le(t.onKeyDown,d=>{var h;const f=d.currentTarget.contains(d.target),m=G2e[o.dir].includes(d.key);f&&m&&(i.onOpenChange(!1),(h=s.trigger)==null||h.focus(),d.preventDefault())})})})})})});CZ.displayName=TZ;function AZ(t){return t?"open":"closed"}function HC(t){return t==="indeterminate"}function $M(t){return HC(t)?"indeterminate":t?"checked":"unchecked"}function aPe(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function iPe(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function oPe(t,e,n){const a=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let o=iPe(t,Math.max(i,0));a.length===1&&(o=o.filter(u=>u!==n));const l=o.find(u=>u.toLowerCase().startsWith(a.toLowerCase()));return l!==n?l:void 0}function sPe(t,e){const{x:n,y:r}=t;let a=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){const s=e[i],l=e[o],u=s.x,d=s.y,f=l.x,m=l.y;d>r!=m>r&&n<(f-u)*(r-d)/(m-d)+u&&(a=!a)}return a}function lPe(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return sPe(n,e)}function rE(t){return e=>e.pointerType==="mouse"?t(e):void 0}var YM=UM,VM=lZ,jM=qM,WM=cZ,KM=qC,XM=pZ,QM=mZ,ZM=gZ,JM=bZ,eL=EZ,tL=SZ,nL=yZ,rL=CZ,RZ="ContextMenu",[cPe]=pa(RZ,[eE]),po=eE(),[gQe,wZ]=cPe(RZ),xZ="ContextMenuTrigger",uPe=N.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:r=!1,...a}=t,i=wZ(xZ,n),o=po(n),s=N.useRef({x:0,y:0}),l=N.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...s.current})}),u=N.useRef(0),d=N.useCallback(()=>window.clearTimeout(u.current),[]),f=m=>{s.current={x:m.clientX,y:m.clientY},i.onOpenChange(!0)};return N.useEffect(()=>d,[d]),N.useEffect(()=>void(r&&d()),[r,d]),A.jsxs(A.Fragment,{children:[A.jsx(YM,{...o,virtualRef:l}),A.jsx(ft.span,{"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,...a,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:r?t.onContextMenu:Le(t.onContextMenu,m=>{d(),f(m),m.preventDefault()}),onPointerDown:r?t.onPointerDown:Le(t.onPointerDown,$C(m=>{d(),u.current=window.setTimeout(()=>f(m),700)})),onPointerMove:r?t.onPointerMove:Le(t.onPointerMove,$C(d)),onPointerCancel:r?t.onPointerCancel:Le(t.onPointerCancel,$C(d)),onPointerUp:r?t.onPointerUp:Le(t.onPointerUp,$C(d))})]})});uPe.displayName=xZ;var NZ="ContextMenuContent",OZ=N.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,a=wZ(NZ,n),i=po(n),o=N.useRef(!1);return A.jsx(VM,{...i,...r,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:s=>{var l;(l=t.onCloseAutoFocus)==null||l.call(t,s),!s.defaultPrevented&&o.current&&s.preventDefault(),o.current=!1},onInteractOutside:s=>{var l;(l=t.onInteractOutside)==null||l.call(t,s),!s.defaultPrevented&&!a.modal&&(o.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});OZ.displayName=NZ;var dPe="ContextMenuGroup",pPe=N.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,a=po(n);return A.jsx(jM,{...a,...r,ref:e})});pPe.displayName=dPe;var fPe="ContextMenuLabel",IZ=N.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,a=po(n);return A.jsx(WM,{...a,...r,ref:e})});IZ.displayName=fPe;var mPe="ContextMenuItem",DZ=N.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,a=po(n);return A.jsx(KM,{...a,...r,ref:e})});DZ.displayName=mPe;var hPe="ContextMenuCheckboxItem",kZ=N.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,a=po(n);return A.jsx(XM,{...a,...r,ref:e})});kZ.displayName=hPe;var gPe="ContextMenuRadioGroup",_Pe=N.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,a=po(n);return A.jsx(QM,{...a,...r,ref:e})});_Pe.displayName=gPe;var bPe="ContextMenuRadioItem",MZ=N.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,a=po(n);return A.jsx(ZM,{...a,...r,ref:e})});MZ.displayName=bPe;var EPe="ContextMenuItemIndicator",SPe=N.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,a=po(n);return A.jsx(JM,{...a,...r,ref:e})});SPe.displayName=EPe;var vPe="ContextMenuSeparator",LZ=N.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,a=po(n);return A.jsx(eL,{...a,...r,ref:e})});LZ.displayName=vPe;var yPe="ContextMenuArrow",TPe=N.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,a=po(n);return A.jsx(tL,{...a,...r,ref:e})});TPe.displayName=yPe;var CPe="ContextMenuSubTrigger",PZ=N.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,a=po(n);return A.jsx(nL,{...a,...r,ref:e})});PZ.displayName=CPe;var APe="ContextMenuSubContent",FZ=N.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,a=po(n);return A.jsx(rL,{...a,...r,ref:e,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});FZ.displayName=APe;function $C(t){return e=>e.pointerType!=="mouse"?t(e):void 0}var RPe=OZ,wPe=IZ,xPe=DZ,NPe=kZ,OPe=MZ,IPe=LZ,DPe=PZ,kPe=FZ;DPe.displayName,kPe.displayName,RPe.displayName,xPe.displayName,NPe.displayName,OPe.displayName,wPe.displayName,IPe.displayName,N.createContext({});const MPe=Oe.createContext(null);MPe.displayName="HookFormContext",typeof window<"u"?Oe.useLayoutEffect:Oe.useEffect,N.createContext({}),N.createContext({});function LPe(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",e.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}const PPe=Oe.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:"bottom",shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),YC=()=>{const t=Oe.useContext(PPe);if(!t)throw new Error("useDrawerContext must be used within a Drawer.Root");return t};LPe(`[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(
|
|
619
619
|
[data-state=closed]
|
|
620
|
-
){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function FPe(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function BPe(...t){return e=>t.forEach(n=>FPe(n,e))}function BZ(...t){return N.useCallback(BPe(...t),t)}const UZ=t=>{switch(t){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return t}};function aL(t,e){if(!t)return()=>{};const n=t.style.cssText;return Object.assign(t.style,e),()=>{t.style.cssText=n}}function UPe(...t){return(...e)=>{for(const n of t)typeof n=="function"&&n(...e)}}const iL={DURATION:.5,EASE:[.32,.72,0,1]},GPe=8,zPe=26,qPe=()=>()=>{};function HPe(){const{direction:t,isOpen:e,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:a}=YC(),i=Oe.useRef(null),o=N.useMemo(()=>document.body.style.backgroundColor,[]);function s(){return(window.innerWidth-zPe)/window.innerWidth}Oe.useEffect(()=>{if(e&&n){i.current&&clearTimeout(i.current);const l=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!l)return;UPe(r&&!a?aL(document.body,{background:"black"}):qPe,aL(l,{transformOrigin:UZ(t)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${iL.DURATION}s`,transitionTimingFunction:`cubic-bezier(${iL.EASE.join(",")})`}));const u=aL(l,{borderRadius:`${GPe}px`,overflow:"hidden",...UZ(t)?{transform:`scale(${s()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${s()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{u(),i.current=window.setTimeout(()=>{o?document.body.style.background=o:document.body.style.removeProperty("background")},iL.DURATION*1e3)}}},[e,n,o])}const GZ=Oe.forwardRef(function({...t},e){const{overlayRef:n,snapPoints:r,onRelease:a,shouldFade:i,isOpen:o,modal:s,shouldAnimate:l}=YC(),u=BZ(e,n),d=r&&r.length>0;if(!s)return null;const f=Oe.useCallback(m=>a(m),[a]);return Oe.createElement(x0,{onMouseUp:f,ref:u,"data-vaul-overlay":"","data-vaul-snap-points":o&&d?"true":"false","data-vaul-snap-points-overlay":o&&i?"true":"false","data-vaul-animate":l!=null&&l.current?"true":"false",...t})});GZ.displayName="Drawer.Overlay";const $Pe=Oe.forwardRef(function({onPointerDownOutside:t,style:e,onOpenAutoFocus:n,...r},a){const{drawerRef:i,onPress:o,onRelease:s,onDrag:l,keyboardIsOpen:u,snapPointsOffset:d,activeSnapPointIndex:f,modal:m,isOpen:h,direction:E,snapPoints:b,container:v,handleOnly:y,shouldAnimate:C,autoFocus:T}=YC(),[w,O]=Oe.useState(!1),x=BZ(a,i),D=Oe.useRef(null),M=Oe.useRef(null),F=Oe.useRef(!1),P=b&&b.length>0;HPe();const q=(Q,U,K=0)=>{if(F.current)return!0;const G=Math.abs(Q.y),Y=Math.abs(Q.x),W=Y>G,J=["bottom","right"].includes(U)?1:-1;if(U==="left"||U==="right"){if(!(Q.x*J<0)&&Y>=0&&Y<=K)return W}else if(!(Q.y*J<0)&&G>=0&&G<=K)return!W;return F.current=!0,!0};Oe.useEffect(()=>{P&&window.requestAnimationFrame(()=>{O(!0)})},[]);function j(Q){D.current=null,F.current=!1,s(Q)}return Oe.createElement(N0,{"data-vaul-drawer-direction":E,"data-vaul-drawer":"","data-vaul-delayed-snap-points":w?"true":"false","data-vaul-snap-points":h&&P?"true":"false","data-vaul-custom-container":v?"true":"false","data-vaul-animate":C!=null&&C.current?"true":"false",...r,ref:x,style:d&&d.length>0?{"--snap-point-height":`${d[f??0]}px`,...e}:e,onPointerDown:Q=>{y||(r.onPointerDown==null||r.onPointerDown.call(r,Q),D.current={x:Q.pageX,y:Q.pageY},o(Q))},onOpenAutoFocus:Q=>{n==null||n(Q),T||Q.preventDefault()},onPointerDownOutside:Q=>{if(t==null||t(Q),!m||Q.defaultPrevented){Q.preventDefault();return}u.current&&(u.current=!1)},onFocusOutside:Q=>{if(!m){Q.preventDefault();return}},onPointerMove:Q=>{if(M.current=Q,y||(r.onPointerMove==null||r.onPointerMove.call(r,Q),!D.current))return;const U=Q.pageY-D.current.y,K=Q.pageX-D.current.x,G=Q.pointerType==="touch"?10:2;q({x:K,y:U},E,G)?l(Q):(Math.abs(K)>G||Math.abs(U)>G)&&(D.current=null)},onPointerUp:Q=>{r.onPointerUp==null||r.onPointerUp.call(r,Q),D.current=null,F.current=!1,s(Q)},onPointerOut:Q=>{r.onPointerOut==null||r.onPointerOut.call(r,Q),j(M.current)},onContextMenu:Q=>{r.onContextMenu==null||r.onContextMenu.call(r,Q),M.current&&j(M.current)}})});$Pe.displayName="Drawer.Content";const YPe=250,VPe=120,jPe=Oe.forwardRef(function({preventCycle:t=!1,children:e,...n},r){const{closeDrawer:a,isDragging:i,snapPoints:o,activeSnapPoint:s,setActiveSnapPoint:l,dismissible:u,handleOnly:d,isOpen:f,onPress:m,onDrag:h}=YC(),E=Oe.useRef(null),b=Oe.useRef(!1);function v(){if(b.current){T();return}window.setTimeout(()=>{y()},VPe)}function y(){if(i||t||b.current){T();return}if(T(),!o||o.length===0){u||a();return}if(s===o[o.length-1]&&u){a();return}const O=o.findIndex(D=>D===s);if(O===-1)return;const x=o[O+1];l(x)}function C(){E.current=window.setTimeout(()=>{b.current=!0},YPe)}function T(){E.current&&window.clearTimeout(E.current),b.current=!1}return Oe.createElement("div",{onClick:v,onPointerCancel:T,onPointerDown:w=>{d&&m(w),C()},onPointerMove:w=>{d&&h(w)},ref:r,"data-vaul-drawer-visible":f?"true":"false","data-vaul-handle":"","aria-hidden":"true",...n},Oe.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},e))});jPe.displayName="Drawer.Handle";const oL={Overlay:GZ,Title:ZT,Description:JT};oL.Overlay.displayName,oL.Title.displayName,oL.Description.displayName;var aE="Menubar",[sL,WPe,KPe]=h0(aE),[zZ]=pa(aE,[KPe,$T]),fo=J0(),qZ=$T(),[XPe,HZ]=zZ(aE),$Z=N.forwardRef((t,e)=>{const{__scopeMenubar:n,value:r,onValueChange:a,defaultValue:i,loop:o=!0,dir:s,...l}=t,u=g0(s),d=qZ(n),[f,m]=Xo({prop:r,onChange:a,defaultProp:i??"",caller:aE}),[h,E]=N.useState(null);return A.jsx(XPe,{scope:n,value:f,onMenuOpen:N.useCallback(b=>{m(b),E(b)},[m]),onMenuClose:N.useCallback(()=>m(""),[m]),onMenuToggle:N.useCallback(b=>{m(v=>v?"":b),E(b)},[m]),dir:u,loop:o,children:A.jsx(sL.Provider,{scope:n,children:A.jsx(sL.Slot,{scope:n,children:A.jsx(mH,{asChild:!0,...d,orientation:"horizontal",loop:o,dir:u,currentTabStopId:h,onCurrentTabStopIdChange:E,children:A.jsx(ft.div,{role:"menubar",...l,ref:e})})})})})});$Z.displayName=aE;var QPe="MenubarMenu",[_Qe,YZ]=zZ(QPe),lL="MenubarTrigger",VZ=N.forwardRef((t,e)=>{const{__scopeMenubar:n,disabled:r=!1,...a}=t,i=qZ(n),o=fo(n),s=HZ(lL,n),l=YZ(lL,n),u=N.useRef(null),d=It(e,u,l.triggerRef),[f,m]=N.useState(!1),h=s.value===l.value;return A.jsx(sL.ItemSlot,{scope:n,value:l.value,disabled:r,children:A.jsx(hH,{asChild:!0,...i,focusable:!r,tabStopId:l.value,children:A.jsx(YM,{asChild:!0,...o,children:A.jsx(ft.button,{type:"button",role:"menuitem",id:l.triggerId,"aria-haspopup":"menu","aria-expanded":h,"aria-controls":h?l.contentId:void 0,"data-highlighted":f?"":void 0,"data-state":h?"open":"closed","data-disabled":r?"":void 0,disabled:r,...a,ref:d,onPointerDown:Le(t.onPointerDown,E=>{!r&&E.button===0&&E.ctrlKey===!1&&(s.onMenuOpen(l.value),h||E.preventDefault())}),onPointerEnter:Le(t.onPointerEnter,()=>{var b;!!s.value&&!h&&(s.onMenuOpen(l.value),(b=u.current)==null||b.focus())}),onKeyDown:Le(t.onKeyDown,E=>{r||(["Enter"," "].includes(E.key)&&s.onMenuToggle(l.value),E.key==="ArrowDown"&&s.onMenuOpen(l.value),["Enter"," ","ArrowDown"].includes(E.key)&&(l.wasKeyboardTriggerOpenRef.current=!0,E.preventDefault()))}),onFocus:Le(t.onFocus,()=>m(!0)),onBlur:Le(t.onBlur,()=>m(!1))})})})})});VZ.displayName=lL;var cL="MenubarContent",jZ=N.forwardRef((t,e)=>{const{__scopeMenubar:n,align:r="start",...a}=t,i=fo(n),o=HZ(cL,n),s=YZ(cL,n),l=WPe(n),u=N.useRef(!1);return A.jsx(VM,{id:s.contentId,"aria-labelledby":s.triggerId,"data-radix-menubar-content":"",...i,...a,ref:e,align:r,onCloseAutoFocus:Le(t.onCloseAutoFocus,d=>{var m;!!!o.value&&!u.current&&((m=s.triggerRef.current)==null||m.focus()),u.current=!1,d.preventDefault()}),onFocusOutside:Le(t.onFocusOutside,d=>{const f=d.target;l().some(h=>{var E;return(E=h.ref.current)==null?void 0:E.contains(f)})&&d.preventDefault()}),onInteractOutside:Le(t.onInteractOutside,()=>{u.current=!0}),onEntryFocus:d=>{s.wasKeyboardTriggerOpenRef.current||d.preventDefault()},onKeyDown:Le(t.onKeyDown,d=>{if(["ArrowRight","ArrowLeft"].includes(d.key)){const f=d.target,m=f.hasAttribute("data-radix-menubar-subtrigger"),h=f.closest("[data-radix-menubar-content]")!==d.currentTarget,b=(o.dir==="rtl"?"ArrowRight":"ArrowLeft")===d.key;if(!b&&m||h&&b)return;let C=l().filter(O=>!O.disabled).map(O=>O.value);b&&C.reverse();const T=C.indexOf(s.value);C=o.loop?f4e(C,T+1):C.slice(T+1);const[w]=C;w&&o.onMenuOpen(w)}},{checkForDefaultPrevented:!1}),style:{...t.style,"--radix-menubar-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-menubar-content-available-width":"var(--radix-popper-available-width)","--radix-menubar-content-available-height":"var(--radix-popper-available-height)","--radix-menubar-trigger-width":"var(--radix-popper-anchor-width)","--radix-menubar-trigger-height":"var(--radix-popper-anchor-height)"}})});jZ.displayName=cL;var ZPe="MenubarGroup",JPe=N.forwardRef((t,e)=>{const{__scopeMenubar:n,...r}=t,a=fo(n);return A.jsx(jM,{...a,...r,ref:e})});JPe.displayName=ZPe;var e4e="MenubarLabel",WZ=N.forwardRef((t,e)=>{const{__scopeMenubar:n,...r}=t,a=fo(n);return A.jsx(WM,{...a,...r,ref:e})});WZ.displayName=e4e;var t4e="MenubarItem",KZ=N.forwardRef((t,e)=>{const{__scopeMenubar:n,...r}=t,a=fo(n);return A.jsx(KM,{...a,...r,ref:e})});KZ.displayName=t4e;var n4e="MenubarCheckboxItem",XZ=N.forwardRef((t,e)=>{const{__scopeMenubar:n,...r}=t,a=fo(n);return A.jsx(XM,{...a,...r,ref:e})});XZ.displayName=n4e;var r4e="MenubarRadioGroup",a4e=N.forwardRef((t,e)=>{const{__scopeMenubar:n,...r}=t,a=fo(n);return A.jsx(QM,{...a,...r,ref:e})});a4e.displayName=r4e;var i4e="MenubarRadioItem",QZ=N.forwardRef((t,e)=>{const{__scopeMenubar:n,...r}=t,a=fo(n);return A.jsx(ZM,{...a,...r,ref:e})});QZ.displayName=i4e;var o4e="MenubarItemIndicator",s4e=N.forwardRef((t,e)=>{const{__scopeMenubar:n,...r}=t,a=fo(n);return A.jsx(JM,{...a,...r,ref:e})});s4e.displayName=o4e;var l4e="MenubarSeparator",ZZ=N.forwardRef((t,e)=>{const{__scopeMenubar:n,...r}=t,a=fo(n);return A.jsx(eL,{...a,...r,ref:e})});ZZ.displayName=l4e;var c4e="MenubarArrow",u4e=N.forwardRef((t,e)=>{const{__scopeMenubar:n,...r}=t,a=fo(n);return A.jsx(tL,{...a,...r,ref:e})});u4e.displayName=c4e;var d4e="MenubarSubTrigger",JZ=N.forwardRef((t,e)=>{const{__scopeMenubar:n,...r}=t,a=fo(n);return A.jsx(nL,{"data-radix-menubar-subtrigger":"",...a,...r,ref:e})});JZ.displayName=d4e;var p4e="MenubarSubContent",eJ=N.forwardRef((t,e)=>{const{__scopeMenubar:n,...r}=t,a=fo(n);return A.jsx(rL,{...a,"data-radix-menubar-content":"",...r,ref:e,style:{...t.style,"--radix-menubar-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-menubar-content-available-width":"var(--radix-popper-available-width)","--radix-menubar-content-available-height":"var(--radix-popper-available-height)","--radix-menubar-trigger-width":"var(--radix-popper-anchor-width)","--radix-menubar-trigger-height":"var(--radix-popper-anchor-height)"}})});eJ.displayName=p4e;function f4e(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var m4e=$Z,h4e=VZ,g4e=jZ,_4e=WZ,b4e=KZ,E4e=XZ,S4e=QZ,v4e=ZZ,y4e=JZ,T4e=eJ;m4e.displayName,h4e.displayName,y4e.displayName,T4e.displayName,g4e.displayName,b4e.displayName,E4e.displayName,S4e.displayName,_4e.displayName,v4e.displayName;const uL=N.createContext(null);uL.displayName="PanelGroupContext";const mo={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandleId:"data-panel-resize-handle-id"},dL=10,sg=N.useLayoutEffect,tJ=xw.useId,C4e=typeof tJ=="function"?tJ:()=>null;let A4e=0;function nJ(t=null){const e=C4e(),n=N.useRef(t||e||null);return n.current===null&&(n.current=""+A4e++),t??n.current}function rJ({children:t,className:e="",collapsedSize:n,collapsible:r,defaultSize:a,forwardedRef:i,id:o,maxSize:s,minSize:l,onCollapse:u,onExpand:d,onResize:f,order:m,style:h,tagName:E="div",...b}){const v=N.useContext(uL);if(v===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:y,expandPanel:C,getPanelSize:T,getPanelStyle:w,groupId:O,isPanelCollapsed:x,reevaluatePanelConstraints:D,registerPanel:M,resizePanel:F,unregisterPanel:P}=v,q=nJ(o),j=N.useRef({callbacks:{onCollapse:u,onExpand:d,onResize:f},constraints:{collapsedSize:n,collapsible:r,defaultSize:a,maxSize:s,minSize:l},id:q,idIsFromProps:o!==void 0,order:m});N.useRef({didLogMissingDefaultSizeWarning:!1}),sg(()=>{const{callbacks:U,constraints:K}=j.current,G={...K};j.current.id=q,j.current.idIsFromProps=o!==void 0,j.current.order=m,U.onCollapse=u,U.onExpand=d,U.onResize=f,K.collapsedSize=n,K.collapsible=r,K.defaultSize=a,K.maxSize=s,K.minSize=l,(G.collapsedSize!==K.collapsedSize||G.collapsible!==K.collapsible||G.maxSize!==K.maxSize||G.minSize!==K.minSize)&&D(j.current,G)}),sg(()=>{const U=j.current;return M(U),()=>{P(U)}},[m,q,M,P]),N.useImperativeHandle(i,()=>({collapse:()=>{y(j.current)},expand:U=>{C(j.current,U)},getId(){return q},getSize(){return T(j.current)},isCollapsed(){return x(j.current)},isExpanded(){return!x(j.current)},resize:U=>{F(j.current,U)}}),[y,C,T,x,q,F]);const Q=w(j.current,a);return N.createElement(E,{...b,children:t,className:e,id:q,style:{...Q,...h},[mo.groupId]:O,[mo.panel]:"",[mo.panelCollapsible]:r||void 0,[mo.panelId]:q,[mo.panelSize]:parseFloat(""+Q.flexGrow).toFixed(1)})}const R4e=N.forwardRef((t,e)=>N.createElement(rJ,{...t,forwardedRef:e}));rJ.displayName="Panel",R4e.displayName="forwardRef(Panel)";function aJ(t){return t.type==="keydown"}function iJ(t){return t.type.startsWith("pointer")}function oJ(t){return t.type.startsWith("mouse")}function w4e(t){if(iJ(t)){if(t.isPrimary)return{x:t.clientX,y:t.clientY}}else if(oJ(t))return{x:t.clientX,y:t.clientY};return{x:1/0,y:1/0}}function x4e(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}const N4e=1,O4e=2,I4e=4,D4e=8;x4e();let k4e=new Map;function pL(t,e){k4e.set(t,e)}function M4e(){const[t,e]=N.useState(0);return N.useCallback(()=>e(n=>n+1),[])}function _n(t,e){if(!t)throw console.error(e),Error(e)}function vf(t,e,n=dL){return t.toFixed(n)===e.toFixed(n)?0:t>e?1:-1}function Fc(t,e,n=dL){return vf(t,e,n)===0}function ho(t,e,n){return vf(t,e,n)===0}function L4e(t,e,n){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++){const a=t[r],i=e[r];if(!ho(a,i,n))return!1}return!0}function lg({panelConstraints:t,panelIndex:e,size:n}){const r=t[e];_n(r!=null,`Panel constraints not found for index ${e}`);let{collapsedSize:a=0,collapsible:i,maxSize:o=100,minSize:s=0}=r;if(vf(n,s)<0)if(i){const l=(a+s)/2;vf(n,l)<0?n=a:n=s}else n=s;return n=Math.min(o,n),n=parseFloat(n.toFixed(dL)),n}function iE({delta:t,initialLayout:e,panelConstraints:n,pivotIndices:r,prevLayout:a,trigger:i}){if(ho(t,0))return e;const o=[...e],[s,l]=r;_n(s!=null,"Invalid first pivot index"),_n(l!=null,"Invalid second pivot index");let u=0;if(i==="keyboard"){{const f=t<0?l:s,m=n[f];_n(m,`Panel constraints not found for index ${f}`);const{collapsedSize:h=0,collapsible:E,minSize:b=0}=m;if(E){const v=e[f];if(_n(v!=null,`Previous layout not found for panel index ${f}`),ho(v,h)){const y=b-v;vf(y,Math.abs(t))>0&&(t=t<0?0-y:y)}}}{const f=t<0?s:l,m=n[f];_n(m,`No panel constraints found for index ${f}`);const{collapsedSize:h=0,collapsible:E,minSize:b=0}=m;if(E){const v=e[f];if(_n(v!=null,`Previous layout not found for panel index ${f}`),ho(v,b)){const y=v-h;vf(y,Math.abs(t))>0&&(t=t<0?0-y:y)}}}}{const f=t<0?1:-1;let m=t<0?l:s,h=0;for(;;){const b=e[m];_n(b!=null,`Previous layout not found for panel index ${m}`);const y=lg({panelConstraints:n,panelIndex:m,size:100})-b;if(h+=y,m+=f,m<0||m>=n.length)break}const E=Math.min(Math.abs(t),Math.abs(h));t=t<0?0-E:E}{let m=t<0?s:l;for(;m>=0&&m<n.length;){const h=Math.abs(t)-Math.abs(u),E=e[m];_n(E!=null,`Previous layout not found for panel index ${m}`);const b=E-h,v=lg({panelConstraints:n,panelIndex:m,size:b});if(!ho(E,v)&&(u+=E-v,o[m]=v,u.toFixed(3).localeCompare(Math.abs(t).toFixed(3),void 0,{numeric:!0})>=0))break;t<0?m--:m++}}if(L4e(a,o))return a;{const f=t<0?l:s,m=e[f];_n(m!=null,`Previous layout not found for panel index ${f}`);const h=m+u,E=lg({panelConstraints:n,panelIndex:f,size:h});if(o[f]=E,!ho(E,h)){let b=h-E,y=t<0?l:s;for(;y>=0&&y<n.length;){const C=o[y];_n(C!=null,`Previous layout not found for panel index ${y}`);const T=C+b,w=lg({panelConstraints:n,panelIndex:y,size:T});if(ho(C,w)||(b-=w-C,o[y]=w),ho(b,0))break;t>0?y--:y++}}}const d=o.reduce((f,m)=>m+f,0);return ho(d,100)?o:a}function P4e({layout:t,panelsArray:e,pivotIndices:n}){let r=0,a=100,i=0,o=0;const s=n[0];_n(s!=null,"No pivot index found"),e.forEach((f,m)=>{const{constraints:h}=f,{maxSize:E=100,minSize:b=0}=h;m===s?(r=b,a=E):(i+=b,o+=E)});const l=Math.min(a,100-i),u=Math.max(r,100-o),d=t[s];return{valueMax:l,valueMin:u,valueNow:d}}function VC(t,e=document){return Array.from(e.querySelectorAll(`[${mo.resizeHandleId}][data-panel-group-id="${t}"]`))}function F4e(t,e,n=document){const a=VC(t,n).findIndex(i=>i.getAttribute(mo.resizeHandleId)===e);return a??null}function sJ(t,e,n){const r=F4e(t,e,n);return r!=null?[r,r+1]:[-1,-1]}function B4e(t){return t instanceof HTMLElement?!0:typeof t=="object"&&t!==null&&"tagName"in t&&"getAttribute"in t}function lJ(t,e=document){if(B4e(e)&&e.dataset.panelGroupId==t)return e;const n=e.querySelector(`[data-panel-group][data-panel-group-id="${t}"]`);return n||null}function fL(t,e=document){const n=e.querySelector(`[${mo.resizeHandleId}="${t}"]`);return n||null}function U4e(t,e,n,r=document){var a,i,o,s;const l=fL(e,r),u=VC(t,r),d=l?u.indexOf(l):-1,f=(a=(i=n[d])===null||i===void 0?void 0:i.id)!==null&&a!==void 0?a:null,m=(o=(s=n[d+1])===null||s===void 0?void 0:s.id)!==null&&o!==void 0?o:null;return[f,m]}function G4e({committedValuesRef:t,eagerValuesRef:e,groupId:n,layout:r,panelDataArray:a,panelGroupElement:i,setLayout:o}){N.useRef({didWarnAboutMissingResizeHandle:!1}),sg(()=>{if(!i)return;const s=VC(n,i);for(let l=0;l<a.length-1;l++){const{valueMax:u,valueMin:d,valueNow:f}=P4e({layout:r,panelsArray:a,pivotIndices:[l,l+1]}),m=s[l];if(m!=null){const h=a[l];_n(h,`No panel data found for index "${l}"`),m.setAttribute("aria-controls",h.id),m.setAttribute("aria-valuemax",""+Math.round(u)),m.setAttribute("aria-valuemin",""+Math.round(d)),m.setAttribute("aria-valuenow",f!=null?""+Math.round(f):"")}}return()=>{s.forEach((l,u)=>{l.removeAttribute("aria-controls"),l.removeAttribute("aria-valuemax"),l.removeAttribute("aria-valuemin"),l.removeAttribute("aria-valuenow")})}},[n,r,a,i]),N.useEffect(()=>{if(!i)return;const s=e.current;_n(s,"Eager values not found");const{panelDataArray:l}=s,u=lJ(n,i);_n(u!=null,`No group found for id "${n}"`);const d=VC(n,i);_n(d,`No resize handles found for group id "${n}"`);const f=d.map(m=>{const h=m.getAttribute(mo.resizeHandleId);_n(h,"Resize handle element has no handle id attribute");const[E,b]=U4e(n,h,l,i);if(E==null||b==null)return()=>{};const v=y=>{if(!y.defaultPrevented)switch(y.key){case"Enter":{y.preventDefault();const C=l.findIndex(T=>T.id===E);if(C>=0){const T=l[C];_n(T,`No panel data found for index ${C}`);const w=r[C],{collapsedSize:O=0,collapsible:x,minSize:D=0}=T.constraints;if(w!=null&&x){const M=iE({delta:ho(w,O)?D-O:O-w,initialLayout:r,panelConstraints:l.map(F=>F.constraints),pivotIndices:sJ(n,h,i),prevLayout:r,trigger:"keyboard"});r!==M&&o(M)}}break}}};return m.addEventListener("keydown",v),()=>{m.removeEventListener("keydown",v)}});return()=>{f.forEach(m=>m())}},[i,t,e,n,r,a,o])}function cJ(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function uJ(t,e){const n=t==="horizontal",{x:r,y:a}=w4e(e);return n?r:a}function z4e(t,e,n,r,a){const i=n==="horizontal",o=fL(e,a);_n(o,`No resize handle element found for id "${e}"`);const s=o.getAttribute(mo.groupId);_n(s,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=r;const u=uJ(n,t),d=lJ(s,a);_n(d,`No group element found for id "${s}"`);const f=d.getBoundingClientRect(),m=i?f.width:f.height;return(u-l)/m*100}function q4e(t,e,n,r,a,i){if(aJ(t)){const o=n==="horizontal";let s=0;t.shiftKey?s=100:a!=null?s=a:s=10;let l=0;switch(t.key){case"ArrowDown":l=o?0:s;break;case"ArrowLeft":l=o?-s:0;break;case"ArrowRight":l=o?s:0;break;case"ArrowUp":l=o?0:-s;break;case"End":l=100;break;case"Home":l=-100;break}return l}else return r==null?0:z4e(t,e,n,r,i)}function H4e({panelDataArray:t}){const e=Array(t.length),n=t.map(i=>i.constraints);let r=0,a=100;for(let i=0;i<t.length;i++){const o=n[i];_n(o,`Panel constraints not found for index ${i}`);const{defaultSize:s}=o;s!=null&&(r++,e[i]=s,a-=s)}for(let i=0;i<t.length;i++){const o=n[i];_n(o,`Panel constraints not found for index ${i}`);const{defaultSize:s}=o;if(s!=null)continue;const l=t.length-r,u=a/l;r++,e[i]=u,a-=u}return e}function cg(t,e,n){e.forEach((r,a)=>{const i=t[a];_n(i,`Panel data not found for index ${a}`);const{callbacks:o,constraints:s,id:l}=i,{collapsedSize:u=0,collapsible:d}=s,f=n[l];if(f==null||r!==f){n[l]=r;const{onCollapse:m,onExpand:h,onResize:E}=o;E&&E(r,f),d&&(m||h)&&(h&&(f==null||Fc(f,u))&&!Fc(r,u)&&h(),m&&(f==null||!Fc(f,u))&&Fc(r,u)&&m())}})}function jC(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!=e[n])return!1;return!0}function $4e({defaultSize:t,dragState:e,layout:n,panelData:r,panelIndex:a,precision:i=3}){const o=n[a];let s;return o==null?s=t!=null?t.toFixed(i):"1":r.length===1?s="1":s=o.toFixed(i),{flexBasis:0,flexGrow:s,flexShrink:1,overflow:"hidden",pointerEvents:e!==null?"none":void 0}}function Y4e(t,e=10){let n=null;return(...a)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{t(...a)},e)}}function dJ(t){try{if(typeof localStorage<"u")t.getItem=e=>localStorage.getItem(e),t.setItem=(e,n)=>{localStorage.setItem(e,n)};else throw new Error("localStorage not supported in this environment")}catch(e){console.error(e),t.getItem=()=>null,t.setItem=()=>{}}}function pJ(t){return`react-resizable-panels:${t}`}function fJ(t){return t.map(e=>{const{constraints:n,id:r,idIsFromProps:a,order:i}=e;return a?r:i?`${i}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((e,n)=>e.localeCompare(n)).join(",")}function mJ(t,e){try{const n=pJ(t),r=e.getItem(n);if(r){const a=JSON.parse(r);if(typeof a=="object"&&a!=null)return a}}catch{}return null}function V4e(t,e,n){var r,a;const i=(r=mJ(t,n))!==null&&r!==void 0?r:{},o=fJ(e);return(a=i[o])!==null&&a!==void 0?a:null}function j4e(t,e,n,r,a){var i;const o=pJ(t),s=fJ(e),l=(i=mJ(t,a))!==null&&i!==void 0?i:{};l[s]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{a.setItem(o,JSON.stringify(l))}catch(u){console.error(u)}}function hJ({layout:t,panelConstraints:e}){const n=[...t],r=n.reduce((i,o)=>i+o,0);if(n.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${n.map(i=>`${i}%`).join(", ")}`);if(!ho(r,100)&&n.length>0)for(let i=0;i<e.length;i++){const o=n[i];_n(o!=null,`No layout data found for index ${i}`);const s=100/r*o;n[i]=s}let a=0;for(let i=0;i<e.length;i++){const o=n[i];_n(o!=null,`No layout data found for index ${i}`);const s=lg({panelConstraints:e,panelIndex:i,size:o});o!=s&&(a+=o-s,n[i]=s)}if(!ho(a,0))for(let i=0;i<e.length;i++){const o=n[i];_n(o!=null,`No layout data found for index ${i}`);const s=o+a,l=lg({panelConstraints:e,panelIndex:i,size:s});if(o!==l&&(a-=l-o,n[i]=l,ho(a,0)))break}return n}const W4e=100,oE={getItem:t=>(dJ(oE),oE.getItem(t)),setItem:(t,e)=>{dJ(oE),oE.setItem(t,e)}},gJ={};function _J({autoSaveId:t=null,children:e,className:n="",direction:r,forwardedRef:a,id:i=null,onLayout:o=null,keyboardResizeBy:s=null,storage:l=oE,style:u,tagName:d="div",...f}){const m=nJ(i),h=N.useRef(null),[E,b]=N.useState(null),[v,y]=N.useState([]),C=M4e(),T=N.useRef({}),w=N.useRef(new Map),O=N.useRef(0),x=N.useRef({autoSaveId:t,direction:r,dragState:E,id:m,keyboardResizeBy:s,onLayout:o,storage:l}),D=N.useRef({layout:v,panelDataArray:[],panelDataArrayChanged:!1});N.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),N.useImperativeHandle(a,()=>({getId:()=>x.current.id,getLayout:()=>{const{layout:B}=D.current;return B},setLayout:B=>{const{onLayout:ae}=x.current,{layout:se,panelDataArray:de}=D.current,ie=hJ({layout:B,panelConstraints:de.map(ce=>ce.constraints)});cJ(se,ie)||(y(ie),D.current.layout=ie,ae&&ae(ie),cg(de,ie,T.current))}}),[]),sg(()=>{x.current.autoSaveId=t,x.current.direction=r,x.current.dragState=E,x.current.id=m,x.current.onLayout=o,x.current.storage=l}),G4e({committedValuesRef:x,eagerValuesRef:D,groupId:m,layout:v,panelDataArray:D.current.panelDataArray,setLayout:y,panelGroupElement:h.current}),N.useEffect(()=>{const{panelDataArray:B}=D.current;if(t){if(v.length===0||v.length!==B.length)return;let ae=gJ[t];ae==null&&(ae=Y4e(j4e,W4e),gJ[t]=ae);const se=[...B],de=new Map(w.current);ae(t,se,de,v,l)}},[t,v,l]),N.useEffect(()=>{});const M=N.useCallback(B=>{const{onLayout:ae}=x.current,{layout:se,panelDataArray:de}=D.current;if(B.constraints.collapsible){const ie=de.map(Ae=>Ae.constraints),{collapsedSize:ce=0,panelSize:me,pivotIndices:be}=yf(de,B,se);if(_n(me!=null,`Panel size not found for panel "${B.id}"`),!Fc(me,ce)){w.current.set(B.id,me);const we=ug(de,B)===de.length-1?me-ce:ce-me,Te=iE({delta:we,initialLayout:se,panelConstraints:ie,pivotIndices:be,prevLayout:se,trigger:"imperative-api"});jC(se,Te)||(y(Te),D.current.layout=Te,ae&&ae(Te),cg(de,Te,T.current))}}},[]),F=N.useCallback((B,ae)=>{const{onLayout:se}=x.current,{layout:de,panelDataArray:ie}=D.current;if(B.constraints.collapsible){const ce=ie.map(De=>De.constraints),{collapsedSize:me=0,panelSize:be=0,minSize:Ae=0,pivotIndices:we}=yf(ie,B,de),Te=ae??Ae;if(Fc(be,me)){const De=w.current.get(B.id),We=De!=null&&De>=Te?De:Te,Tt=ug(ie,B)===ie.length-1?be-We:We-be,_t=iE({delta:Tt,initialLayout:de,panelConstraints:ce,pivotIndices:we,prevLayout:de,trigger:"imperative-api"});jC(de,_t)||(y(_t),D.current.layout=_t,se&&se(_t),cg(ie,_t,T.current))}}},[]),P=N.useCallback(B=>{const{layout:ae,panelDataArray:se}=D.current,{panelSize:de}=yf(se,B,ae);return _n(de!=null,`Panel size not found for panel "${B.id}"`),de},[]),q=N.useCallback((B,ae)=>{const{panelDataArray:se}=D.current,de=ug(se,B);return $4e({defaultSize:ae,dragState:E,layout:v,panelData:se,panelIndex:de})},[E,v]),j=N.useCallback(B=>{const{layout:ae,panelDataArray:se}=D.current,{collapsedSize:de=0,collapsible:ie,panelSize:ce}=yf(se,B,ae);return _n(ce!=null,`Panel size not found for panel "${B.id}"`),ie===!0&&Fc(ce,de)},[]),Q=N.useCallback(B=>{const{layout:ae,panelDataArray:se}=D.current,{collapsedSize:de=0,collapsible:ie,panelSize:ce}=yf(se,B,ae);return _n(ce!=null,`Panel size not found for panel "${B.id}"`),!ie||vf(ce,de)>0},[]),U=N.useCallback(B=>{const{panelDataArray:ae}=D.current;ae.push(B),ae.sort((se,de)=>{const ie=se.order,ce=de.order;return ie==null&&ce==null?0:ie==null?-1:ce==null?1:ie-ce}),D.current.panelDataArrayChanged=!0,C()},[C]);sg(()=>{if(D.current.panelDataArrayChanged){D.current.panelDataArrayChanged=!1;const{autoSaveId:B,onLayout:ae,storage:se}=x.current,{layout:de,panelDataArray:ie}=D.current;let ce=null;if(B){const be=V4e(B,ie,se);be&&(w.current=new Map(Object.entries(be.expandToSizes)),ce=be.layout)}ce==null&&(ce=H4e({panelDataArray:ie}));const me=hJ({layout:ce,panelConstraints:ie.map(be=>be.constraints)});cJ(de,me)||(y(me),D.current.layout=me,ae&&ae(me),cg(ie,me,T.current))}}),sg(()=>{const B=D.current;return()=>{B.layout=[]}},[]);const K=N.useCallback(B=>{let ae=!1;const se=h.current;return se&&window.getComputedStyle(se,null).getPropertyValue("direction")==="rtl"&&(ae=!0),function(ie){ie.preventDefault();const ce=h.current;if(!ce)return()=>null;const{direction:me,dragState:be,id:Ae,keyboardResizeBy:we,onLayout:Te}=x.current,{layout:De,panelDataArray:We}=D.current,{initialLayout:Ye}=be??{},Tt=sJ(Ae,B,ce);let _t=q4e(ie,B,me,be,we,ce);const Jt=me==="horizontal";Jt&&ae&&(_t=-_t);const Ge=We.map(mt=>mt.constraints),Ve=iE({delta:_t,initialLayout:Ye??De,panelConstraints:Ge,pivotIndices:Tt,prevLayout:De,trigger:aJ(ie)?"keyboard":"mouse-or-touch"}),Xe=!jC(De,Ve);(iJ(ie)||oJ(ie))&&O.current!=_t&&(O.current=_t,!Xe&&_t!==0?Jt?pL(B,_t<0?N4e:O4e):pL(B,_t<0?I4e:D4e):pL(B,0)),Xe&&(y(Ve),D.current.layout=Ve,Te&&Te(Ve),cg(We,Ve,T.current))}},[]),G=N.useCallback((B,ae)=>{const{onLayout:se}=x.current,{layout:de,panelDataArray:ie}=D.current,ce=ie.map(De=>De.constraints),{panelSize:me,pivotIndices:be}=yf(ie,B,de);_n(me!=null,`Panel size not found for panel "${B.id}"`);const we=ug(ie,B)===ie.length-1?me-ae:ae-me,Te=iE({delta:we,initialLayout:de,panelConstraints:ce,pivotIndices:be,prevLayout:de,trigger:"imperative-api"});jC(de,Te)||(y(Te),D.current.layout=Te,se&&se(Te),cg(ie,Te,T.current))},[]),Y=N.useCallback((B,ae)=>{const{layout:se,panelDataArray:de}=D.current,{collapsedSize:ie=0,collapsible:ce}=ae,{collapsedSize:me=0,collapsible:be,maxSize:Ae=100,minSize:we=0}=B.constraints,{panelSize:Te}=yf(de,B,se);Te!=null&&(ce&&be&&Fc(Te,ie)?Fc(ie,me)||G(B,me):Te<we?G(B,we):Te>Ae&&G(B,Ae))},[G]),W=N.useCallback((B,ae)=>{const{direction:se}=x.current,{layout:de}=D.current;if(!h.current)return;const ie=fL(B,h.current);_n(ie,`Drag handle element not found for id "${B}"`);const ce=uJ(se,ae);b({dragHandleId:B,dragHandleRect:ie.getBoundingClientRect(),initialCursorPosition:ce,initialLayout:de})},[]),J=N.useCallback(()=>{b(null)},[]),$=N.useCallback(B=>{const{panelDataArray:ae}=D.current,se=ug(ae,B);se>=0&&(ae.splice(se,1),delete T.current[B.id],D.current.panelDataArrayChanged=!0,C())},[C]),Z=N.useMemo(()=>({collapsePanel:M,direction:r,dragState:E,expandPanel:F,getPanelSize:P,getPanelStyle:q,groupId:m,isPanelCollapsed:j,isPanelExpanded:Q,reevaluatePanelConstraints:Y,registerPanel:U,registerResizeHandle:K,resizePanel:G,startDragging:W,stopDragging:J,unregisterPanel:$,panelGroupElement:h.current}),[M,E,r,F,P,q,m,j,Q,Y,U,K,G,W,J,$]),te={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return N.createElement(uL.Provider,{value:Z},N.createElement(d,{...f,children:e,className:n,id:i,ref:h,style:{...te,...u},[mo.group]:"",[mo.groupDirection]:r,[mo.groupId]:m}))}const K4e=N.forwardRef((t,e)=>N.createElement(_J,{...t,forwardedRef:e}));_J.displayName="PanelGroup",K4e.displayName="forwardRef(PanelGroup)";function ug(t,e){return t.findIndex(n=>n===e||n.id===e.id)}function yf(t,e,n){const r=ug(t,e),i=r===t.length-1?[r-1,r]:[r,r+1],o=n[r];return{...e.constraints,panelSize:o,pivotIndices:i}}N.createContext({});var bJ="Toggle",EJ=N.forwardRef((t,e)=>{const{pressed:n,defaultPressed:r,onPressedChange:a,...i}=t,[o,s]=Xo({prop:n,onChange:a,defaultProp:r??!1,caller:bJ});return A.jsx(ft.button,{type:"button","aria-pressed":o,"data-state":o?"on":"off","data-disabled":t.disabled?"":void 0,...i,ref:e,onClick:Le(t.onClick,()=>{t.disabled||s(!o)})})});EJ.displayName=bJ;var X4e=EJ;X4e.displayName;var WC="Switch",[Q4e]=pa(WC),[Z4e,J4e]=Q4e(WC),SJ=N.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:a,defaultChecked:i,required:o,disabled:s,value:l="on",onCheckedChange:u,form:d,...f}=t,[m,h]=N.useState(null),E=It(e,T=>h(T)),b=N.useRef(!1),v=m?d||!!m.closest("form"):!0,[y,C]=Xo({prop:a,defaultProp:i??!1,onChange:u,caller:WC});return A.jsxs(Z4e,{scope:n,checked:y,disabled:s,children:[A.jsx(ft.button,{type:"button",role:"switch","aria-checked":y,"aria-required":o,"data-state":CJ(y),"data-disabled":s?"":void 0,disabled:s,value:l,...f,ref:E,onClick:Le(t.onClick,T=>{C(w=>!w),v&&(b.current=T.isPropagationStopped(),b.current||T.stopPropagation())})}),v&&A.jsx(TJ,{control:m,bubbles:!b.current,name:r,value:l,checked:y,required:o,disabled:s,form:d,style:{transform:"translateX(-100%)"}})]})});SJ.displayName=WC;var vJ="SwitchThumb",yJ=N.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,a=J4e(vJ,n);return A.jsx(ft.span,{"data-state":CJ(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:e})});yJ.displayName=vJ;var e3e="SwitchBubbleInput",TJ=N.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...a},i)=>{const o=N.useRef(null),s=It(o,i),l=dx(n),u=nx(e);return N.useEffect(()=>{const d=o.current;if(!d)return;const f=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(f,"checked").set;if(l!==n&&h){const E=new Event("click",{bubbles:r});h.call(d,n),d.dispatchEvent(E)}},[l,n,r]),A.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:s,style:{...a.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});TJ.displayName=e3e;function CJ(t){return t?"checked":"unchecked"}var t3e=SJ,n3e=yJ,r3e=Ps(["peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors","disabled:cursor-not-allowed disabled:opacity-50","data-[state=unchecked]:bg-input","data-[state=checked]:bg-primary","focus-visible:outline-none focus-visible:border focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50"],{variants:{variant:{default:"",box:""}},defaultVariants:{variant:"default"}}),a3e=Ps("pointer-events-none block size-4 rounded-full bg-background transition-transform data-[state=unchecked]:translate-x-0 data-[state=checked]:translate-x-4 shadow-lg",{variants:{variant:{default:"",box:""}},defaultVariants:{variant:"default"}}),i3e=Ps("inline-flex items-start gap-3",{variants:{variant:{default:"",box:"rounded-lg border border-input bg-card p-4 shadow-xs has-[[data-state=checked]]:border-primary has-[[data-state=checked]]:bg-[var(--custom-bg-primary-5-dark-bg-primary-10)] transition-colors hover:bg-accent/50"},controlPlacement:{start:"",end:"flex-row-reverse justify-between w-full"}},defaultVariants:{variant:"default",controlPlacement:"start"}}),o3e=N.createContext({}),AJ=t=>{var e=t,{ref:n,variant:r,label:a,required:i,optional:o,icon:s,badge:l,tooltip:u,description:d,controlPlacement:f="start",disabled:m}=e,h=Mn(e,["ref","variant","label","required","optional","icon","badge","tooltip","description","controlPlacement","disabled"]),E;const b=N.useId(),v=h.id||b,y=N.use(o3e),C=(E=r??y.variant)!=null?E:"default",T=A.jsx(t3e,Rr(Qt({ref:n,id:v,className:r3e({variant:C}),disabled:m},h),{children:A.jsx(n3e,{className:Zt(a3e({variant:C}))})}));return!a&&!d?T:A.jsxs("div",{className:Zt(i3e({variant:C,controlPlacement:f}),m?"cursor-not-allowed":"cursor-pointer",m&&"opacity-70"),onClick:w=>{var O;!m&&C==="box"&&w.target instanceof Element&&!w.target.closest('[role="switch"]')&&!w.target.closest("label")&&((O=document.getElementById(v))==null||O.click())},children:[A.jsx("div",{className:"flex h-5 items-center",children:T}),A.jsx(Bs,{label:a||"",htmlFor:v,required:i,optional:o,icon:s,badge:l,tooltip:u,description:d})]})};AJ.displayName="Switch",x0.displayName,N0.displayName,ZT.displayName,JT.displayName;var s3e=class{constructor(){Ch(this,"activeStreams",new Map)}subscribe(t,e,n,r){const a=this.activeStreams.get(t);return a?this.subscribeToExistingStream(t,a,e):this.createNewStream(t,e,n,r)}getStreamEvents(t){const e=this.activeStreams.get(t);return e?[...e.events]:[]}isStreamActive(t){return this.activeStreams.has(t)}getSubscriberCount(t){const e=this.activeStreams.get(t);return e?e.subscribers.size:0}closeStream(t){const e=this.activeStreams.get(t);e&&(e.controller.abort(),this.cleanupStream(t))}closeAllStreams(){for(const t of this.activeStreams.keys())this.closeStream(t)}subscribeToExistingStream(t,e,n){var r,a,i,o,s;e.subscribers.add(n);try{(r=n.onStart)==null||r.call(n);for(const l of e.events)(a=n.onData)==null||a.call(n,l);e.isCompleted&&(e.error?(i=n.onError)==null||i.call(n,e.error):(o=n.onSuccess)==null||o.call(n,e.events),(s=n.onComplete)==null||s.call(n))}catch(l){console.error("Error sending historical events to subscriber:",l)}return{promise:e.promise,unsubscribe:()=>this.unsubscribe(t,n),disconnect:()=>this.disconnect(t),cancel:()=>this.cancel(t)}}createNewStream(t,e,n,r){const a=new AbortController,i=new Set([e]),o=[],s={controller:a,promise:Promise.resolve([]),subscribers:i,events:o,isCompleted:!1,error:null,canceler:r};this.activeStreams.set(t,s);const l={onStart:()=>{s.subscribers.forEach(d=>{var f;try{(f=d.onStart)==null||f.call(d)}catch(m){console.error("Error in subscriber onStart:",m)}})},onData:d=>{o.push(d),s.subscribers.forEach(f=>{var m;try{(m=f.onData)==null||m.call(f,d)}catch(h){console.error("Error in subscriber onData:",h)}})},onError:d=>{s.error=d,s.isCompleted=!0,s.subscribers.forEach(f=>{var m,h;try{(m=f.onError)==null||m.call(f,d),(h=f.onComplete)==null||h.call(f)}catch(E){console.error("Error in subscriber onError:",E)}}),this.cleanupStream(t)},onSuccess:d=>{s.isCompleted=!0,s.subscribers.forEach(f=>{var m,h;try{(m=f.onSuccess)==null||m.call(f,d),(h=f.onComplete)==null||h.call(f)}catch(E){console.error("Error in subscriber onFinish:",E)}}),this.cleanupStream(t)}},u=this.executeStream(n,l,a.signal);return s.promise=u,{promise:u,unsubscribe:()=>this.unsubscribe(t,e),cancel:()=>this.cancel(t),disconnect:()=>this.disconnect(t)}}async executeStream(t,e,n){var r;try{return await t(e,n)}catch(a){const i=a instanceof Error?a:new Error(String(a));throw(r=e.onError)==null||r.call(e,i),i}}async cancel(t){const e=this.activeStreams.get(t);this.disconnect(t),await(e==null?void 0:e.canceler())}disconnect(t){const e=this.activeStreams.get(t);if(e){for(const n of e.subscribers)this.unsubscribe(t,n);this.cleanupStream(t)}}unsubscribe(t,e){const n=this.activeStreams.get(t);if(n&&(n.subscribers.delete(e),n.subscribers.size===0)){try{n.controller.abort()}catch(r){pf.debug("Error aborting stream in unsubscribe",r)}this.cleanupStream(t)}}cleanupStream(t){this.activeStreams.delete(t)}},l3e=new s3e;const c3e=Symbol(),mL=Symbol(),sE="a",RJ="f",wJ="p",xJ="c",NJ="t",hL="h",lE="w",gL="o",_L="k";let u3e=(t,e)=>new Proxy(t,e);const bL=Object.getPrototypeOf,EL=new WeakMap,OJ=t=>t&&(EL.has(t)?EL.get(t):bL(t)===Object.prototype||bL(t)===Array.prototype),KC=t=>typeof t=="object"&&t!==null,d3e=t=>Object.values(Object.getOwnPropertyDescriptors(t)).some(e=>!e.configurable&&!e.writable),p3e=t=>{if(Array.isArray(t))return Array.from(t);const e=Object.getOwnPropertyDescriptors(t);return Object.values(e).forEach(n=>{n.configurable=!0}),Object.create(bL(t),e)},f3e=(t,e)=>{const n={[RJ]:e};let r=!1;const a=(s,l)=>{if(!r){let u=n[sE].get(t);if(u||(u={},n[sE].set(t,u)),s===lE)u[lE]=!0;else{let d=u[s];d||(d=new Set,u[s]=d),d.add(l)}}},i=()=>{r=!0,n[sE].delete(t)},o={get(s,l){return l===mL?t:(a(_L,l),IJ(Reflect.get(s,l),n[sE],n[xJ],n[NJ]))},has(s,l){return l===c3e?(i(),!0):(a(hL,l),Reflect.has(s,l))},getOwnPropertyDescriptor(s,l){return a(gL,l),Reflect.getOwnPropertyDescriptor(s,l)},ownKeys(s){return a(lE),Reflect.ownKeys(s)}};return e&&(o.set=o.deleteProperty=()=>!1),[o,n]},SL=t=>t[mL]||t,IJ=(t,e,n,r)=>{if(!OJ(t))return t;let a=r&&r.get(t);if(!a){const l=SL(t);d3e(l)?a=[l,p3e(l)]:a=[l],r==null||r.set(t,a)}const[i,o]=a;let s=n&&n.get(i);return(!s||s[1][RJ]!==!!o)&&(s=f3e(i,!!o),s[1][wJ]=u3e(o||i,s[0]),n&&n.set(i,s)),s[1][sE]=e,s[1][xJ]=n,s[1][NJ]=r,s[1][wJ]},m3e=(t,e)=>{const n=Reflect.ownKeys(t),r=Reflect.ownKeys(e);return n.length!==r.length||n.some((a,i)=>a!==r[i])},DJ=(t,e,n,r,a=Object.is)=>{if(a(t,e))return!1;if(!KC(t)||!KC(e))return!0;const i=n.get(SL(t));if(!i)return!0;if(r){if(r.get(t)===e)return!1;r.set(t,e)}let o=null;for(const s of i[hL]||[])if(o=Reflect.has(t,s)!==Reflect.has(e,s),o)return o;if(i[lE]===!0){if(o=m3e(t,e),o)return o}else for(const s of i[gL]||[]){const l=!!Reflect.getOwnPropertyDescriptor(t,s),u=!!Reflect.getOwnPropertyDescriptor(e,s);if(o=l!==u,o)return o}for(const s of i[_L]||[])if(o=DJ(t[s],e[s],n,r,a),o)return o;if(o===null)throw new Error("invalid used");return o},h3e=t=>OJ(t)&&t[mL]||null,kJ=(t,e=!0)=>{EL.set(t,e)},g3e=(t,e,n)=>{const r=[],a=new WeakSet,i=(o,s)=>{var l,u,d;if(a.has(o))return;KC(o)&&a.add(o);const f=KC(o)&&e.get(SL(o));if(f){if((l=f[hL])===null||l===void 0||l.forEach(m=>{const h=`:has(${String(m)})`;r.push(s?[...s,h]:[h])}),f[lE]===!0){const m=":ownKeys";r.push(s?[...s,m]:[m])}else(u=f[gL])===null||u===void 0||u.forEach(m=>{const h=`:hasOwn(${String(m)})`;r.push(s?[...s,h]:[h])});(d=f[_L])===null||d===void 0||d.forEach(m=>{"value"in(Object.getOwnPropertyDescriptor(o,m)||{})&&i(o[m],s?[...s,m]:[m])})}else s&&r.push(s)};return i(t),r},XC={},vL=t=>typeof t=="object"&&t!==null,_3e=t=>vL(t)&&!yL.has(t)&&(Array.isArray(t)||!(Symbol.iterator in t))&&!(t instanceof WeakMap)&&!(t instanceof WeakSet)&&!(t instanceof Error)&&!(t instanceof Number)&&!(t instanceof Date)&&!(t instanceof String)&&!(t instanceof RegExp)&&!(t instanceof ArrayBuffer)&&!(t instanceof Promise),MJ=(t,e)=>{const n=LJ.get(t);if((n==null?void 0:n[0])===e)return n[1];const r=Array.isArray(t)?[]:Object.create(Object.getPrototypeOf(t));return kJ(r,!0),LJ.set(t,[e,r]),Reflect.ownKeys(t).forEach(a=>{if(Object.getOwnPropertyDescriptor(r,a))return;const i=Reflect.get(t,a),{enumerable:o}=Reflect.getOwnPropertyDescriptor(t,a),s={value:i,enumerable:o,configurable:!0};if(yL.has(i))kJ(i,!1);else if(Tf.has(i)){const[l,u]=Tf.get(i);s.value=MJ(l,u())}Object.defineProperty(r,a,s)}),Object.preventExtensions(r)},b3e=(t,e,n,r)=>({deleteProperty(a,i){const o=Reflect.get(a,i);n(i);const s=Reflect.deleteProperty(a,i);return s&&r(["delete",[i],o]),s},set(a,i,o,s){const l=!t()&&Reflect.has(a,i),u=Reflect.get(a,i,s);if(l&&(PJ(u,o)||QC.has(o)&&PJ(u,QC.get(o))))return!0;n(i),vL(o)&&(o=h3e(o)||o);const d=!Tf.has(o)&&S3e(o)?cE(o):o;return e(i,d),Reflect.set(a,i,d,s),r(["set",[i],o,u]),!0}}),Tf=new WeakMap,yL=new WeakSet,LJ=new WeakMap,TL=[1],QC=new WeakMap;let PJ=Object.is,E3e=(t,e)=>new Proxy(t,e),S3e=_3e,v3e=MJ,y3e=b3e;function cE(t={}){if(!vL(t))throw new Error("object required");const e=QC.get(t);if(e)return e;let n=TL[0];const r=new Set,a=(v,y=++TL[0])=>{n!==y&&(i=n=y,r.forEach(C=>C(v,y)))};let i=n;const o=(v=TL[0])=>(i!==v&&(i=v,l.forEach(([y])=>{const C=y[1](v);C>n&&(n=C)})),n),s=v=>(y,C)=>{const T=[...y];T[1]=[v,...T[1]],a(T,C)},l=new Map,u=(v,y)=>{const C=!yL.has(y)&&Tf.get(y);if(C){if((XC?"production":void 0)!=="production"&&l.has(v))throw new Error("prop listener already exists");if(r.size){const T=C[2](s(v));l.set(v,[C,T])}else l.set(v,[C])}},d=v=>{var y;const C=l.get(v);C&&(l.delete(v),(y=C[1])==null||y.call(C))},f=v=>(r.add(v),r.size===1&&l.forEach(([C,T],w)=>{if((XC?"production":void 0)!=="production"&&T)throw new Error("remove already exists");const O=C[2](s(w));l.set(w,[C,O])}),()=>{r.delete(v),r.size===0&&l.forEach(([C,T],w)=>{T&&(T(),l.set(w,[C]))})});let m=!0;const h=y3e(()=>m,u,d,a),E=E3e(t,h);QC.set(t,E);const b=[t,o,f];return Tf.set(E,b),Reflect.ownKeys(t).forEach(v=>{const y=Object.getOwnPropertyDescriptor(t,v);"value"in y&&y.writable&&(E[v]=t[v])}),m=!1,E}function T3e(t,e,n){const r=Tf.get(t);(XC?"production":void 0)!=="production"&&!r&&console.warn("Please use proxy object");let a;const i=[],o=r[2];let s=!1;const u=o(d=>{i.push(d),a||(a=Promise.resolve().then(()=>{a=void 0,s&&e(i.splice(0))}))});return s=!0,()=>{s=!1,u()}}function FJ(t){const e=Tf.get(t);(XC?"production":void 0)!=="production"&&!e&&console.warn("Please use proxy object");const[n,r]=e;return v3e(n,r())}const C3e={},A3e=(t,e)=>{const n=N.useRef(void 0);N.useEffect(()=>{n.current=g3e(t,e)}),N.useDebugValue(n.current)},R3e=new WeakMap;function ZC(t,e){const r=N.useMemo(()=>t&&new WeakMap,[t]),a=N.useRef(void 0);let i=!0;const o=N.useSyncExternalStore(N.useCallback(l=>{const u=T3e(t,l);return l(),u},[t,void 0]),()=>{const l=FJ(t);try{if(!i&&a.current&&!DJ(a.current,l,r,new WeakMap))return a.current}catch{}return l},()=>FJ(t));i=!1,N.useLayoutEffect(()=>{a.current=o}),(C3e?"production":void 0)!=="production"&&A3e(o,r);const s=N.useMemo(()=>new WeakMap,[]);return IJ(o,r,s,R3e)}var CL=new Map;function JC(t,e){return CL.has(t)||CL.set(t,e()),CL.get(t)}var Td={handler_id:"",workflow_name:"",status:"not_started",started_at:"",updated_at:void 0,completed_at:void 0,result:void 0,loading:!0},Cf=(t={})=>{var e,n,r,a;const i={handler_id:(e=t.handler_id)!=null?e:Td.handler_id,workflow_name:(n=t.workflow_name)!=null?n:Td.workflow_name,status:(r=t.status)!=null?r:Td.status,started_at:(a=t.started_at)!=null?a:Td.started_at,updated_at:t.updated_at?new Date(t.updated_at):Td.updated_at,completed_at:t.completed_at?new Date(t.completed_at):Td.completed_at,error:t.error,result:t.result?oN.fromRawEvent(t.result):Td.result,loading:t.status?!1:Td.loading,loadingError:void 0};return cE(i)};function BJ(t,e){const n={async sendEvent(r,a){if(!t.handler_id)throw new Error("Handler ID is not yet initialized");const i=r instanceof Aa?r.toRawEvent():r;return(await jq({client:e,path:{handler_id:t.handler_id},body:{event:i,step:a}})).data},async sync(){t.loading=!0,t.loadingError=void 0;const r=t.handler_id;if(r)try{const a=await aye({client:e,path:{handler_id:r}});if(a.error){const i=a.error;if(typeof i=="object"&&i!==null&&"handler_id"in i&&"status"in i){const s=Cf(i);Object.assign(t,s);return}const o=typeof i=="object"&&i!==null&&"detail"in i?String(i.detail):String(i);t.loadingError=o;return}if(a.data){const i=Cf(a.data);Object.assign(t,i)}}catch(a){t.loadingError=a instanceof Error?a.message:String(a)}finally{t.loading=!1}},subscribeToEvents(r,a=!1){if(!t.handler_id)throw new Error("Handler ID is not yet initialized");const i=`handler:${t.handler_id}`,o={onStart:()=>{var m;t.status="running",(m=r==null?void 0:r.onStart)==null||m.call(r)},onData:m=>{var h;t.updated_at=new Date,(h=r==null?void 0:r.onData)==null||h.call(r,m)},onError:m=>{var h;t.status="failed",t.completed_at=new Date,t.updated_at=new Date,t.error=m.message,(h=r==null?void 0:r.onError)==null||h.call(r,m)},onSuccess:m=>{var h;t.status="completed",t.completed_at=new Date,t.updated_at=new Date,t.result=m[m.length-1],(h=r==null?void 0:r.onSuccess)==null||h.call(r,m)},onComplete:()=>{var m;t.completed_at=new Date,t.updated_at=new Date,(m=r==null?void 0:r.onComplete)==null||m.call(r)}},s=async()=>{await iye({client:e,path:{handler_id:t.handler_id}})},{promise:l,unsubscribe:u,disconnect:d,cancel:f}=l3e.subscribe(i,o,async(m,h)=>w3e({client:e,handlerId:t.handler_id,includeInternal:a,abortSignal:h},m,n,t),s);return{promise:l,unsubscribe:u,disconnect:d,cancel:f}}};return n}function w3e(t,e,n,r){return new Promise(a=>{var i;const o=((i=t.client.getConfig().baseUrl)!=null?i:"").replace(/\/$/,""),s=new URLSearchParams;s.set("sse","true"),t.includeInternal&&s.set("include_internal","true");const l=[],u=new EventSource(`${o}/events/${encodeURIComponent(t.handlerId)}?${s.toString()}`,{withCredentials:!0});t.abortSignal&&t.abortSignal.addEventListener("abort",()=>{u.close()}),u.addEventListener("message",d=>{var f;pf.debug("[streamByEventSource] message",JSON.parse(d.data));const m=Aa.fromRawEvent(JSON.parse(d.data));(f=e.onData)==null||f.call(e,m),l.push(m),MH(m)&&(u.close(),n.sync().then(()=>{var h,E,b;if(r.status==="completed")(h=e.onSuccess)==null||h.call(e,l);else if(r.status==="failed")(E=e.onError)==null||E.call(e,new Error(r.error||"Server Error"));else if(r.status==="cancelled")(b=e.onCancel)==null||b.call(e);else throw new Error(`[This should never happen] Unexpected running status: ${r.status}`);a(l)}))}),u.addEventListener("error",d=>{pf.warn("[streamByEventSource] error",d)}),u.addEventListener("open",()=>{var d;pf.debug("[streamByEventSource] open"),(d=e.onStart)==null||d.call(e)}),u.addEventListener("close",()=>{var d;pf.debug("[streamByEventSource] close"),(d=e.onSuccess)==null||d.call(e,l),a(l)})})}function x3e(t,e){const n=Cf(e);return Object.assign(t,n),t}var N3e=({query:t}={})=>cE({query:t??{},loading:!0,error:void 0,handlers:{}});function O3e(t,e){return{async sync(){var n,r;t.loading=!0,t.loadingError=void 0;try{const i=(r=(n=(await rye({client:e,query:t.query})).data)==null?void 0:n.handlers)!=null?r:[],o=new Set(i.map(l=>l.handler_id)),s=new Set(Object.keys(t.handlers));for(const l of s)o.has(l)||delete t.handlers[l];for(const l of i)t.handlers[l.handler_id]=t.handlers[l.handler_id]?x3e(t.handlers[l.handler_id],l):Cf(l)}catch(a){t.loadingError=a instanceof Error?a.message:String(a)}finally{t.loading=!1}},setHandler(n){t.handlers[n.handler_id]=n},actions(n){return BJ(t.handlers[n],e)}}}function I3e(){return cE({workflows:{},loading:!0,error:void 0})}function D3e(t,e){return{async sync(){var n,r;t.loading=!0,t.loadingError=void 0;try{((r=(n=(await Zve({client:e})).data)==null?void 0:n.workflows)!=null?r:[]).forEach(o=>{t.workflows[o]={name:o}})}catch(a){t.loadingError=a instanceof Error?a.message:String(a)}finally{t.loading=!1}},setWorkflow(n){t.workflows[n.name]=n}}}function k3e(t){return cE({name:t,graph:null,loading:!0,loadingError:void 0})}function M3e(t,e){return{async sync(){var n,r;t.loading=!0,t.loadingError=void 0;try{const a=await Wq({client:e,path:{name:t.name}});t.graph=(r=(n=a.data)==null?void 0:n.graph)!=null?r:null}catch(a){t.loadingError=a instanceof Error?a.message:String(a)}finally{t.loading=!1}},async runToCompletion(n){const r=await Jve({client:e,path:{name:t.name},body:{start_event:n}});if(!r.data)throw new Error(`Workflow run empty, response ${JSON.stringify(r)}`);return Cf(r.data)},async createHandler(n,r){const a=await eye({client:e,path:{name:t.name},body:{start_event:n,handler_id:r}});if(!a.data)throw new Error("Handler creation failed");return Cf(a.data)}}}function UJ({query:t,sync:e=!0}={}){const n=pd(),r=JC(`handlers:${JSON.stringify(t)}`,()=>N3e({query:t??{}})),a=N.useMemo(()=>O3e(r,n),[r,n]);return N.useEffect(()=>{e&&a.sync()},[a,e]),Qt({state:ZC(r)},a)}function L3e({sync:t=!0}={}){const e=pd(),n=JC("workflows",()=>I3e()),r=N.useMemo(()=>D3e(n,e),[n,e]);return N.useEffect(()=>{t&&r.sync()},[r,t]),Qt({state:ZC(n)},r)}function P3e(t){const e=pd(),n=JC(`workflow:${t}`,()=>k3e(t)),r=N.useMemo(()=>M3e(n,e),[n,e]);return Qt({state:ZC(n)},r)}function F3e(t,{sync:e=!0}={}){const n=pd(),r=JC(`handler:${t}`,()=>Cf({handler_id:t??void 0})),a=N.useMemo(()=>BJ(r,n),[r,n]);return N.useEffect(()=>{e&&a.sync()},[a,e,t]),Qt({state:ZC(r)},a)}function B3e(t=100,e){const n=Oe.useRef([]),[r,a]=Oe.useState([]),i=Oe.useCallback(s=>{n.current.push(s)},[]),o=Oe.useCallback(()=>{n.current=[],a([])},[]);return Oe.useEffect(()=>{const s=setInterval(()=>{const l=n.current;l.length!==0&&(a(u=>[...u,...l].sort(e)),n.current=[])},t);return()=>clearInterval(s)},[t,e]),{items:r,push:i,clear:o}}var U3e="AlertDialog",[G3e]=pa(U3e,[PH]),Af=PH(),z3e="AlertDialogTrigger",q3e=N.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,a=Af(n);return A.jsx(ZH,{...a,...r,ref:e})});q3e.displayName=z3e;var H3e="AlertDialogOverlay",GJ=N.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,a=Af(n);return A.jsx(x0,{...a,...r,ref:e})});GJ.displayName=H3e;var dg="AlertDialogContent",[$3e,Y3e]=G3e(dg),V3e=Y8("AlertDialogContent"),zJ=N.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...a}=t,i=Af(n),o=N.useRef(null),s=It(e,o),l=N.useRef(null);return A.jsx(zTe,{contentName:dg,titleName:qJ,docsSlug:"alert-dialog",children:A.jsx($3e,{scope:n,cancelRef:l,children:A.jsxs(N0,{role:"alertdialog",...i,...a,ref:s,onOpenAutoFocus:Le(a.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=l.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[A.jsx(V3e,{children:r}),A.jsx(W3e,{contentRef:o})]})})})});zJ.displayName=dg;var qJ="AlertDialogTitle",HJ=N.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,a=Af(n);return A.jsx(ZT,{...a,...r,ref:e})});HJ.displayName=qJ;var $J="AlertDialogDescription",YJ=N.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,a=Af(n);return A.jsx(JT,{...a,...r,ref:e})});YJ.displayName=$J;var j3e="AlertDialogAction",VJ=N.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,a=Af(n);return A.jsx(eC,{...a,...r,ref:e})});VJ.displayName=j3e;var jJ="AlertDialogCancel",WJ=N.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:a}=Y3e(jJ,n),i=Af(n),o=It(e,a);return A.jsx(eC,{...i,...r,ref:o})});WJ.displayName=jJ;var W3e=({contentRef:t})=>{const e=`\`${dg}\` requires a description for the component to be accessible for screen reader users.
|
|
620
|
+
){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function FPe(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function BPe(...t){return e=>t.forEach(n=>FPe(n,e))}function BZ(...t){return N.useCallback(BPe(...t),t)}const UZ=t=>{switch(t){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return t}};function aL(t,e){if(!t)return()=>{};const n=t.style.cssText;return Object.assign(t.style,e),()=>{t.style.cssText=n}}function UPe(...t){return(...e)=>{for(const n of t)typeof n=="function"&&n(...e)}}const iL={DURATION:.5,EASE:[.32,.72,0,1]},GPe=8,zPe=26,qPe=()=>()=>{};function HPe(){const{direction:t,isOpen:e,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:a}=YC(),i=Oe.useRef(null),o=N.useMemo(()=>document.body.style.backgroundColor,[]);function s(){return(window.innerWidth-zPe)/window.innerWidth}Oe.useEffect(()=>{if(e&&n){i.current&&clearTimeout(i.current);const l=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!l)return;UPe(r&&!a?aL(document.body,{background:"black"}):qPe,aL(l,{transformOrigin:UZ(t)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${iL.DURATION}s`,transitionTimingFunction:`cubic-bezier(${iL.EASE.join(",")})`}));const u=aL(l,{borderRadius:`${GPe}px`,overflow:"hidden",...UZ(t)?{transform:`scale(${s()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${s()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{u(),i.current=window.setTimeout(()=>{o?document.body.style.background=o:document.body.style.removeProperty("background")},iL.DURATION*1e3)}}},[e,n,o])}const GZ=Oe.forwardRef(function({...t},e){const{overlayRef:n,snapPoints:r,onRelease:a,shouldFade:i,isOpen:o,modal:s,shouldAnimate:l}=YC(),u=BZ(e,n),d=r&&r.length>0;if(!s)return null;const f=Oe.useCallback(m=>a(m),[a]);return Oe.createElement(x0,{onMouseUp:f,ref:u,"data-vaul-overlay":"","data-vaul-snap-points":o&&d?"true":"false","data-vaul-snap-points-overlay":o&&i?"true":"false","data-vaul-animate":l!=null&&l.current?"true":"false",...t})});GZ.displayName="Drawer.Overlay";const $Pe=Oe.forwardRef(function({onPointerDownOutside:t,style:e,onOpenAutoFocus:n,...r},a){const{drawerRef:i,onPress:o,onRelease:s,onDrag:l,keyboardIsOpen:u,snapPointsOffset:d,activeSnapPointIndex:f,modal:m,isOpen:h,direction:E,snapPoints:b,container:v,handleOnly:y,shouldAnimate:C,autoFocus:T}=YC(),[w,O]=Oe.useState(!1),x=BZ(a,i),D=Oe.useRef(null),M=Oe.useRef(null),F=Oe.useRef(!1),P=b&&b.length>0;HPe();const q=(Q,U,K=0)=>{if(F.current)return!0;const G=Math.abs(Q.y),Y=Math.abs(Q.x),W=Y>G,J=["bottom","right"].includes(U)?1:-1;if(U==="left"||U==="right"){if(!(Q.x*J<0)&&Y>=0&&Y<=K)return W}else if(!(Q.y*J<0)&&G>=0&&G<=K)return!W;return F.current=!0,!0};Oe.useEffect(()=>{P&&window.requestAnimationFrame(()=>{O(!0)})},[]);function j(Q){D.current=null,F.current=!1,s(Q)}return Oe.createElement(N0,{"data-vaul-drawer-direction":E,"data-vaul-drawer":"","data-vaul-delayed-snap-points":w?"true":"false","data-vaul-snap-points":h&&P?"true":"false","data-vaul-custom-container":v?"true":"false","data-vaul-animate":C!=null&&C.current?"true":"false",...r,ref:x,style:d&&d.length>0?{"--snap-point-height":`${d[f??0]}px`,...e}:e,onPointerDown:Q=>{y||(r.onPointerDown==null||r.onPointerDown.call(r,Q),D.current={x:Q.pageX,y:Q.pageY},o(Q))},onOpenAutoFocus:Q=>{n==null||n(Q),T||Q.preventDefault()},onPointerDownOutside:Q=>{if(t==null||t(Q),!m||Q.defaultPrevented){Q.preventDefault();return}u.current&&(u.current=!1)},onFocusOutside:Q=>{if(!m){Q.preventDefault();return}},onPointerMove:Q=>{if(M.current=Q,y||(r.onPointerMove==null||r.onPointerMove.call(r,Q),!D.current))return;const U=Q.pageY-D.current.y,K=Q.pageX-D.current.x,G=Q.pointerType==="touch"?10:2;q({x:K,y:U},E,G)?l(Q):(Math.abs(K)>G||Math.abs(U)>G)&&(D.current=null)},onPointerUp:Q=>{r.onPointerUp==null||r.onPointerUp.call(r,Q),D.current=null,F.current=!1,s(Q)},onPointerOut:Q=>{r.onPointerOut==null||r.onPointerOut.call(r,Q),j(M.current)},onContextMenu:Q=>{r.onContextMenu==null||r.onContextMenu.call(r,Q),M.current&&j(M.current)}})});$Pe.displayName="Drawer.Content";const YPe=250,VPe=120,jPe=Oe.forwardRef(function({preventCycle:t=!1,children:e,...n},r){const{closeDrawer:a,isDragging:i,snapPoints:o,activeSnapPoint:s,setActiveSnapPoint:l,dismissible:u,handleOnly:d,isOpen:f,onPress:m,onDrag:h}=YC(),E=Oe.useRef(null),b=Oe.useRef(!1);function v(){if(b.current){T();return}window.setTimeout(()=>{y()},VPe)}function y(){if(i||t||b.current){T();return}if(T(),!o||o.length===0){u||a();return}if(s===o[o.length-1]&&u){a();return}const O=o.findIndex(D=>D===s);if(O===-1)return;const x=o[O+1];l(x)}function C(){E.current=window.setTimeout(()=>{b.current=!0},YPe)}function T(){E.current&&window.clearTimeout(E.current),b.current=!1}return Oe.createElement("div",{onClick:v,onPointerCancel:T,onPointerDown:w=>{d&&m(w),C()},onPointerMove:w=>{d&&h(w)},ref:r,"data-vaul-drawer-visible":f?"true":"false","data-vaul-handle":"","aria-hidden":"true",...n},Oe.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},e))});jPe.displayName="Drawer.Handle";const oL={Overlay:GZ,Title:JT,Description:eC};oL.Overlay.displayName,oL.Title.displayName,oL.Description.displayName;var aE="Menubar",[sL,WPe,KPe]=h0(aE),[zZ]=pa(aE,[KPe,$T]),fo=eE(),qZ=$T(),[XPe,HZ]=zZ(aE),$Z=N.forwardRef((t,e)=>{const{__scopeMenubar:n,value:r,onValueChange:a,defaultValue:i,loop:o=!0,dir:s,...l}=t,u=g0(s),d=qZ(n),[f,m]=Xo({prop:r,onChange:a,defaultProp:i??"",caller:aE}),[h,E]=N.useState(null);return A.jsx(XPe,{scope:n,value:f,onMenuOpen:N.useCallback(b=>{m(b),E(b)},[m]),onMenuClose:N.useCallback(()=>m(""),[m]),onMenuToggle:N.useCallback(b=>{m(v=>v?"":b),E(b)},[m]),dir:u,loop:o,children:A.jsx(sL.Provider,{scope:n,children:A.jsx(sL.Slot,{scope:n,children:A.jsx(mH,{asChild:!0,...d,orientation:"horizontal",loop:o,dir:u,currentTabStopId:h,onCurrentTabStopIdChange:E,children:A.jsx(ft.div,{role:"menubar",...l,ref:e})})})})})});$Z.displayName=aE;var QPe="MenubarMenu",[_Qe,YZ]=zZ(QPe),lL="MenubarTrigger",VZ=N.forwardRef((t,e)=>{const{__scopeMenubar:n,disabled:r=!1,...a}=t,i=qZ(n),o=fo(n),s=HZ(lL,n),l=YZ(lL,n),u=N.useRef(null),d=It(e,u,l.triggerRef),[f,m]=N.useState(!1),h=s.value===l.value;return A.jsx(sL.ItemSlot,{scope:n,value:l.value,disabled:r,children:A.jsx(hH,{asChild:!0,...i,focusable:!r,tabStopId:l.value,children:A.jsx(YM,{asChild:!0,...o,children:A.jsx(ft.button,{type:"button",role:"menuitem",id:l.triggerId,"aria-haspopup":"menu","aria-expanded":h,"aria-controls":h?l.contentId:void 0,"data-highlighted":f?"":void 0,"data-state":h?"open":"closed","data-disabled":r?"":void 0,disabled:r,...a,ref:d,onPointerDown:Le(t.onPointerDown,E=>{!r&&E.button===0&&E.ctrlKey===!1&&(s.onMenuOpen(l.value),h||E.preventDefault())}),onPointerEnter:Le(t.onPointerEnter,()=>{var b;!!s.value&&!h&&(s.onMenuOpen(l.value),(b=u.current)==null||b.focus())}),onKeyDown:Le(t.onKeyDown,E=>{r||(["Enter"," "].includes(E.key)&&s.onMenuToggle(l.value),E.key==="ArrowDown"&&s.onMenuOpen(l.value),["Enter"," ","ArrowDown"].includes(E.key)&&(l.wasKeyboardTriggerOpenRef.current=!0,E.preventDefault()))}),onFocus:Le(t.onFocus,()=>m(!0)),onBlur:Le(t.onBlur,()=>m(!1))})})})})});VZ.displayName=lL;var cL="MenubarContent",jZ=N.forwardRef((t,e)=>{const{__scopeMenubar:n,align:r="start",...a}=t,i=fo(n),o=HZ(cL,n),s=YZ(cL,n),l=WPe(n),u=N.useRef(!1);return A.jsx(VM,{id:s.contentId,"aria-labelledby":s.triggerId,"data-radix-menubar-content":"",...i,...a,ref:e,align:r,onCloseAutoFocus:Le(t.onCloseAutoFocus,d=>{var m;!!!o.value&&!u.current&&((m=s.triggerRef.current)==null||m.focus()),u.current=!1,d.preventDefault()}),onFocusOutside:Le(t.onFocusOutside,d=>{const f=d.target;l().some(h=>{var E;return(E=h.ref.current)==null?void 0:E.contains(f)})&&d.preventDefault()}),onInteractOutside:Le(t.onInteractOutside,()=>{u.current=!0}),onEntryFocus:d=>{s.wasKeyboardTriggerOpenRef.current||d.preventDefault()},onKeyDown:Le(t.onKeyDown,d=>{if(["ArrowRight","ArrowLeft"].includes(d.key)){const f=d.target,m=f.hasAttribute("data-radix-menubar-subtrigger"),h=f.closest("[data-radix-menubar-content]")!==d.currentTarget,b=(o.dir==="rtl"?"ArrowRight":"ArrowLeft")===d.key;if(!b&&m||h&&b)return;let C=l().filter(O=>!O.disabled).map(O=>O.value);b&&C.reverse();const T=C.indexOf(s.value);C=o.loop?f4e(C,T+1):C.slice(T+1);const[w]=C;w&&o.onMenuOpen(w)}},{checkForDefaultPrevented:!1}),style:{...t.style,"--radix-menubar-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-menubar-content-available-width":"var(--radix-popper-available-width)","--radix-menubar-content-available-height":"var(--radix-popper-available-height)","--radix-menubar-trigger-width":"var(--radix-popper-anchor-width)","--radix-menubar-trigger-height":"var(--radix-popper-anchor-height)"}})});jZ.displayName=cL;var ZPe="MenubarGroup",JPe=N.forwardRef((t,e)=>{const{__scopeMenubar:n,...r}=t,a=fo(n);return A.jsx(jM,{...a,...r,ref:e})});JPe.displayName=ZPe;var e4e="MenubarLabel",WZ=N.forwardRef((t,e)=>{const{__scopeMenubar:n,...r}=t,a=fo(n);return A.jsx(WM,{...a,...r,ref:e})});WZ.displayName=e4e;var t4e="MenubarItem",KZ=N.forwardRef((t,e)=>{const{__scopeMenubar:n,...r}=t,a=fo(n);return A.jsx(KM,{...a,...r,ref:e})});KZ.displayName=t4e;var n4e="MenubarCheckboxItem",XZ=N.forwardRef((t,e)=>{const{__scopeMenubar:n,...r}=t,a=fo(n);return A.jsx(XM,{...a,...r,ref:e})});XZ.displayName=n4e;var r4e="MenubarRadioGroup",a4e=N.forwardRef((t,e)=>{const{__scopeMenubar:n,...r}=t,a=fo(n);return A.jsx(QM,{...a,...r,ref:e})});a4e.displayName=r4e;var i4e="MenubarRadioItem",QZ=N.forwardRef((t,e)=>{const{__scopeMenubar:n,...r}=t,a=fo(n);return A.jsx(ZM,{...a,...r,ref:e})});QZ.displayName=i4e;var o4e="MenubarItemIndicator",s4e=N.forwardRef((t,e)=>{const{__scopeMenubar:n,...r}=t,a=fo(n);return A.jsx(JM,{...a,...r,ref:e})});s4e.displayName=o4e;var l4e="MenubarSeparator",ZZ=N.forwardRef((t,e)=>{const{__scopeMenubar:n,...r}=t,a=fo(n);return A.jsx(eL,{...a,...r,ref:e})});ZZ.displayName=l4e;var c4e="MenubarArrow",u4e=N.forwardRef((t,e)=>{const{__scopeMenubar:n,...r}=t,a=fo(n);return A.jsx(tL,{...a,...r,ref:e})});u4e.displayName=c4e;var d4e="MenubarSubTrigger",JZ=N.forwardRef((t,e)=>{const{__scopeMenubar:n,...r}=t,a=fo(n);return A.jsx(nL,{"data-radix-menubar-subtrigger":"",...a,...r,ref:e})});JZ.displayName=d4e;var p4e="MenubarSubContent",eJ=N.forwardRef((t,e)=>{const{__scopeMenubar:n,...r}=t,a=fo(n);return A.jsx(rL,{...a,"data-radix-menubar-content":"",...r,ref:e,style:{...t.style,"--radix-menubar-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-menubar-content-available-width":"var(--radix-popper-available-width)","--radix-menubar-content-available-height":"var(--radix-popper-available-height)","--radix-menubar-trigger-width":"var(--radix-popper-anchor-width)","--radix-menubar-trigger-height":"var(--radix-popper-anchor-height)"}})});eJ.displayName=p4e;function f4e(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var m4e=$Z,h4e=VZ,g4e=jZ,_4e=WZ,b4e=KZ,E4e=XZ,S4e=QZ,v4e=ZZ,y4e=JZ,T4e=eJ;m4e.displayName,h4e.displayName,y4e.displayName,T4e.displayName,g4e.displayName,b4e.displayName,E4e.displayName,S4e.displayName,_4e.displayName,v4e.displayName,N.createContext({}),x0.displayName,N0.displayName,JT.displayName,eC.displayName;const uL=N.createContext(null);uL.displayName="PanelGroupContext";const mo={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandleId:"data-panel-resize-handle-id"},dL=10,sg=N.useLayoutEffect,tJ=xw.useId,C4e=typeof tJ=="function"?tJ:()=>null;let A4e=0;function nJ(t=null){const e=C4e(),n=N.useRef(t||e||null);return n.current===null&&(n.current=""+A4e++),t??n.current}function rJ({children:t,className:e="",collapsedSize:n,collapsible:r,defaultSize:a,forwardedRef:i,id:o,maxSize:s,minSize:l,onCollapse:u,onExpand:d,onResize:f,order:m,style:h,tagName:E="div",...b}){const v=N.useContext(uL);if(v===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:y,expandPanel:C,getPanelSize:T,getPanelStyle:w,groupId:O,isPanelCollapsed:x,reevaluatePanelConstraints:D,registerPanel:M,resizePanel:F,unregisterPanel:P}=v,q=nJ(o),j=N.useRef({callbacks:{onCollapse:u,onExpand:d,onResize:f},constraints:{collapsedSize:n,collapsible:r,defaultSize:a,maxSize:s,minSize:l},id:q,idIsFromProps:o!==void 0,order:m});N.useRef({didLogMissingDefaultSizeWarning:!1}),sg(()=>{const{callbacks:U,constraints:K}=j.current,G={...K};j.current.id=q,j.current.idIsFromProps=o!==void 0,j.current.order=m,U.onCollapse=u,U.onExpand=d,U.onResize=f,K.collapsedSize=n,K.collapsible=r,K.defaultSize=a,K.maxSize=s,K.minSize=l,(G.collapsedSize!==K.collapsedSize||G.collapsible!==K.collapsible||G.maxSize!==K.maxSize||G.minSize!==K.minSize)&&D(j.current,G)}),sg(()=>{const U=j.current;return M(U),()=>{P(U)}},[m,q,M,P]),N.useImperativeHandle(i,()=>({collapse:()=>{y(j.current)},expand:U=>{C(j.current,U)},getId(){return q},getSize(){return T(j.current)},isCollapsed(){return x(j.current)},isExpanded(){return!x(j.current)},resize:U=>{F(j.current,U)}}),[y,C,T,x,q,F]);const Q=w(j.current,a);return N.createElement(E,{...b,children:t,className:e,id:q,style:{...Q,...h},[mo.groupId]:O,[mo.panel]:"",[mo.panelCollapsible]:r||void 0,[mo.panelId]:q,[mo.panelSize]:parseFloat(""+Q.flexGrow).toFixed(1)})}const R4e=N.forwardRef((t,e)=>N.createElement(rJ,{...t,forwardedRef:e}));rJ.displayName="Panel",R4e.displayName="forwardRef(Panel)";function aJ(t){return t.type==="keydown"}function iJ(t){return t.type.startsWith("pointer")}function oJ(t){return t.type.startsWith("mouse")}function w4e(t){if(iJ(t)){if(t.isPrimary)return{x:t.clientX,y:t.clientY}}else if(oJ(t))return{x:t.clientX,y:t.clientY};return{x:1/0,y:1/0}}function x4e(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}const N4e=1,O4e=2,I4e=4,D4e=8;x4e();let k4e=new Map;function pL(t,e){k4e.set(t,e)}function M4e(){const[t,e]=N.useState(0);return N.useCallback(()=>e(n=>n+1),[])}function _n(t,e){if(!t)throw console.error(e),Error(e)}function vf(t,e,n=dL){return t.toFixed(n)===e.toFixed(n)?0:t>e?1:-1}function Fc(t,e,n=dL){return vf(t,e,n)===0}function ho(t,e,n){return vf(t,e,n)===0}function L4e(t,e,n){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++){const a=t[r],i=e[r];if(!ho(a,i,n))return!1}return!0}function lg({panelConstraints:t,panelIndex:e,size:n}){const r=t[e];_n(r!=null,`Panel constraints not found for index ${e}`);let{collapsedSize:a=0,collapsible:i,maxSize:o=100,minSize:s=0}=r;if(vf(n,s)<0)if(i){const l=(a+s)/2;vf(n,l)<0?n=a:n=s}else n=s;return n=Math.min(o,n),n=parseFloat(n.toFixed(dL)),n}function iE({delta:t,initialLayout:e,panelConstraints:n,pivotIndices:r,prevLayout:a,trigger:i}){if(ho(t,0))return e;const o=[...e],[s,l]=r;_n(s!=null,"Invalid first pivot index"),_n(l!=null,"Invalid second pivot index");let u=0;if(i==="keyboard"){{const f=t<0?l:s,m=n[f];_n(m,`Panel constraints not found for index ${f}`);const{collapsedSize:h=0,collapsible:E,minSize:b=0}=m;if(E){const v=e[f];if(_n(v!=null,`Previous layout not found for panel index ${f}`),ho(v,h)){const y=b-v;vf(y,Math.abs(t))>0&&(t=t<0?0-y:y)}}}{const f=t<0?s:l,m=n[f];_n(m,`No panel constraints found for index ${f}`);const{collapsedSize:h=0,collapsible:E,minSize:b=0}=m;if(E){const v=e[f];if(_n(v!=null,`Previous layout not found for panel index ${f}`),ho(v,b)){const y=v-h;vf(y,Math.abs(t))>0&&(t=t<0?0-y:y)}}}}{const f=t<0?1:-1;let m=t<0?l:s,h=0;for(;;){const b=e[m];_n(b!=null,`Previous layout not found for panel index ${m}`);const y=lg({panelConstraints:n,panelIndex:m,size:100})-b;if(h+=y,m+=f,m<0||m>=n.length)break}const E=Math.min(Math.abs(t),Math.abs(h));t=t<0?0-E:E}{let m=t<0?s:l;for(;m>=0&&m<n.length;){const h=Math.abs(t)-Math.abs(u),E=e[m];_n(E!=null,`Previous layout not found for panel index ${m}`);const b=E-h,v=lg({panelConstraints:n,panelIndex:m,size:b});if(!ho(E,v)&&(u+=E-v,o[m]=v,u.toFixed(3).localeCompare(Math.abs(t).toFixed(3),void 0,{numeric:!0})>=0))break;t<0?m--:m++}}if(L4e(a,o))return a;{const f=t<0?l:s,m=e[f];_n(m!=null,`Previous layout not found for panel index ${f}`);const h=m+u,E=lg({panelConstraints:n,panelIndex:f,size:h});if(o[f]=E,!ho(E,h)){let b=h-E,y=t<0?l:s;for(;y>=0&&y<n.length;){const C=o[y];_n(C!=null,`Previous layout not found for panel index ${y}`);const T=C+b,w=lg({panelConstraints:n,panelIndex:y,size:T});if(ho(C,w)||(b-=w-C,o[y]=w),ho(b,0))break;t>0?y--:y++}}}const d=o.reduce((f,m)=>m+f,0);return ho(d,100)?o:a}function P4e({layout:t,panelsArray:e,pivotIndices:n}){let r=0,a=100,i=0,o=0;const s=n[0];_n(s!=null,"No pivot index found"),e.forEach((f,m)=>{const{constraints:h}=f,{maxSize:E=100,minSize:b=0}=h;m===s?(r=b,a=E):(i+=b,o+=E)});const l=Math.min(a,100-i),u=Math.max(r,100-o),d=t[s];return{valueMax:l,valueMin:u,valueNow:d}}function VC(t,e=document){return Array.from(e.querySelectorAll(`[${mo.resizeHandleId}][data-panel-group-id="${t}"]`))}function F4e(t,e,n=document){const a=VC(t,n).findIndex(i=>i.getAttribute(mo.resizeHandleId)===e);return a??null}function sJ(t,e,n){const r=F4e(t,e,n);return r!=null?[r,r+1]:[-1,-1]}function B4e(t){return t instanceof HTMLElement?!0:typeof t=="object"&&t!==null&&"tagName"in t&&"getAttribute"in t}function lJ(t,e=document){if(B4e(e)&&e.dataset.panelGroupId==t)return e;const n=e.querySelector(`[data-panel-group][data-panel-group-id="${t}"]`);return n||null}function fL(t,e=document){const n=e.querySelector(`[${mo.resizeHandleId}="${t}"]`);return n||null}function U4e(t,e,n,r=document){var a,i,o,s;const l=fL(e,r),u=VC(t,r),d=l?u.indexOf(l):-1,f=(a=(i=n[d])===null||i===void 0?void 0:i.id)!==null&&a!==void 0?a:null,m=(o=(s=n[d+1])===null||s===void 0?void 0:s.id)!==null&&o!==void 0?o:null;return[f,m]}function G4e({committedValuesRef:t,eagerValuesRef:e,groupId:n,layout:r,panelDataArray:a,panelGroupElement:i,setLayout:o}){N.useRef({didWarnAboutMissingResizeHandle:!1}),sg(()=>{if(!i)return;const s=VC(n,i);for(let l=0;l<a.length-1;l++){const{valueMax:u,valueMin:d,valueNow:f}=P4e({layout:r,panelsArray:a,pivotIndices:[l,l+1]}),m=s[l];if(m!=null){const h=a[l];_n(h,`No panel data found for index "${l}"`),m.setAttribute("aria-controls",h.id),m.setAttribute("aria-valuemax",""+Math.round(u)),m.setAttribute("aria-valuemin",""+Math.round(d)),m.setAttribute("aria-valuenow",f!=null?""+Math.round(f):"")}}return()=>{s.forEach((l,u)=>{l.removeAttribute("aria-controls"),l.removeAttribute("aria-valuemax"),l.removeAttribute("aria-valuemin"),l.removeAttribute("aria-valuenow")})}},[n,r,a,i]),N.useEffect(()=>{if(!i)return;const s=e.current;_n(s,"Eager values not found");const{panelDataArray:l}=s,u=lJ(n,i);_n(u!=null,`No group found for id "${n}"`);const d=VC(n,i);_n(d,`No resize handles found for group id "${n}"`);const f=d.map(m=>{const h=m.getAttribute(mo.resizeHandleId);_n(h,"Resize handle element has no handle id attribute");const[E,b]=U4e(n,h,l,i);if(E==null||b==null)return()=>{};const v=y=>{if(!y.defaultPrevented)switch(y.key){case"Enter":{y.preventDefault();const C=l.findIndex(T=>T.id===E);if(C>=0){const T=l[C];_n(T,`No panel data found for index ${C}`);const w=r[C],{collapsedSize:O=0,collapsible:x,minSize:D=0}=T.constraints;if(w!=null&&x){const M=iE({delta:ho(w,O)?D-O:O-w,initialLayout:r,panelConstraints:l.map(F=>F.constraints),pivotIndices:sJ(n,h,i),prevLayout:r,trigger:"keyboard"});r!==M&&o(M)}}break}}};return m.addEventListener("keydown",v),()=>{m.removeEventListener("keydown",v)}});return()=>{f.forEach(m=>m())}},[i,t,e,n,r,a,o])}function cJ(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function uJ(t,e){const n=t==="horizontal",{x:r,y:a}=w4e(e);return n?r:a}function z4e(t,e,n,r,a){const i=n==="horizontal",o=fL(e,a);_n(o,`No resize handle element found for id "${e}"`);const s=o.getAttribute(mo.groupId);_n(s,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=r;const u=uJ(n,t),d=lJ(s,a);_n(d,`No group element found for id "${s}"`);const f=d.getBoundingClientRect(),m=i?f.width:f.height;return(u-l)/m*100}function q4e(t,e,n,r,a,i){if(aJ(t)){const o=n==="horizontal";let s=0;t.shiftKey?s=100:a!=null?s=a:s=10;let l=0;switch(t.key){case"ArrowDown":l=o?0:s;break;case"ArrowLeft":l=o?-s:0;break;case"ArrowRight":l=o?s:0;break;case"ArrowUp":l=o?0:-s;break;case"End":l=100;break;case"Home":l=-100;break}return l}else return r==null?0:z4e(t,e,n,r,i)}function H4e({panelDataArray:t}){const e=Array(t.length),n=t.map(i=>i.constraints);let r=0,a=100;for(let i=0;i<t.length;i++){const o=n[i];_n(o,`Panel constraints not found for index ${i}`);const{defaultSize:s}=o;s!=null&&(r++,e[i]=s,a-=s)}for(let i=0;i<t.length;i++){const o=n[i];_n(o,`Panel constraints not found for index ${i}`);const{defaultSize:s}=o;if(s!=null)continue;const l=t.length-r,u=a/l;r++,e[i]=u,a-=u}return e}function cg(t,e,n){e.forEach((r,a)=>{const i=t[a];_n(i,`Panel data not found for index ${a}`);const{callbacks:o,constraints:s,id:l}=i,{collapsedSize:u=0,collapsible:d}=s,f=n[l];if(f==null||r!==f){n[l]=r;const{onCollapse:m,onExpand:h,onResize:E}=o;E&&E(r,f),d&&(m||h)&&(h&&(f==null||Fc(f,u))&&!Fc(r,u)&&h(),m&&(f==null||!Fc(f,u))&&Fc(r,u)&&m())}})}function jC(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!=e[n])return!1;return!0}function $4e({defaultSize:t,dragState:e,layout:n,panelData:r,panelIndex:a,precision:i=3}){const o=n[a];let s;return o==null?s=t!=null?t.toFixed(i):"1":r.length===1?s="1":s=o.toFixed(i),{flexBasis:0,flexGrow:s,flexShrink:1,overflow:"hidden",pointerEvents:e!==null?"none":void 0}}function Y4e(t,e=10){let n=null;return(...a)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{t(...a)},e)}}function dJ(t){try{if(typeof localStorage<"u")t.getItem=e=>localStorage.getItem(e),t.setItem=(e,n)=>{localStorage.setItem(e,n)};else throw new Error("localStorage not supported in this environment")}catch(e){console.error(e),t.getItem=()=>null,t.setItem=()=>{}}}function pJ(t){return`react-resizable-panels:${t}`}function fJ(t){return t.map(e=>{const{constraints:n,id:r,idIsFromProps:a,order:i}=e;return a?r:i?`${i}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((e,n)=>e.localeCompare(n)).join(",")}function mJ(t,e){try{const n=pJ(t),r=e.getItem(n);if(r){const a=JSON.parse(r);if(typeof a=="object"&&a!=null)return a}}catch{}return null}function V4e(t,e,n){var r,a;const i=(r=mJ(t,n))!==null&&r!==void 0?r:{},o=fJ(e);return(a=i[o])!==null&&a!==void 0?a:null}function j4e(t,e,n,r,a){var i;const o=pJ(t),s=fJ(e),l=(i=mJ(t,a))!==null&&i!==void 0?i:{};l[s]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{a.setItem(o,JSON.stringify(l))}catch(u){console.error(u)}}function hJ({layout:t,panelConstraints:e}){const n=[...t],r=n.reduce((i,o)=>i+o,0);if(n.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${n.map(i=>`${i}%`).join(", ")}`);if(!ho(r,100)&&n.length>0)for(let i=0;i<e.length;i++){const o=n[i];_n(o!=null,`No layout data found for index ${i}`);const s=100/r*o;n[i]=s}let a=0;for(let i=0;i<e.length;i++){const o=n[i];_n(o!=null,`No layout data found for index ${i}`);const s=lg({panelConstraints:e,panelIndex:i,size:o});o!=s&&(a+=o-s,n[i]=s)}if(!ho(a,0))for(let i=0;i<e.length;i++){const o=n[i];_n(o!=null,`No layout data found for index ${i}`);const s=o+a,l=lg({panelConstraints:e,panelIndex:i,size:s});if(o!==l&&(a-=l-o,n[i]=l,ho(a,0)))break}return n}const W4e=100,oE={getItem:t=>(dJ(oE),oE.getItem(t)),setItem:(t,e)=>{dJ(oE),oE.setItem(t,e)}},gJ={};function _J({autoSaveId:t=null,children:e,className:n="",direction:r,forwardedRef:a,id:i=null,onLayout:o=null,keyboardResizeBy:s=null,storage:l=oE,style:u,tagName:d="div",...f}){const m=nJ(i),h=N.useRef(null),[E,b]=N.useState(null),[v,y]=N.useState([]),C=M4e(),T=N.useRef({}),w=N.useRef(new Map),O=N.useRef(0),x=N.useRef({autoSaveId:t,direction:r,dragState:E,id:m,keyboardResizeBy:s,onLayout:o,storage:l}),D=N.useRef({layout:v,panelDataArray:[],panelDataArrayChanged:!1});N.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),N.useImperativeHandle(a,()=>({getId:()=>x.current.id,getLayout:()=>{const{layout:B}=D.current;return B},setLayout:B=>{const{onLayout:ae}=x.current,{layout:se,panelDataArray:de}=D.current,ie=hJ({layout:B,panelConstraints:de.map(ce=>ce.constraints)});cJ(se,ie)||(y(ie),D.current.layout=ie,ae&&ae(ie),cg(de,ie,T.current))}}),[]),sg(()=>{x.current.autoSaveId=t,x.current.direction=r,x.current.dragState=E,x.current.id=m,x.current.onLayout=o,x.current.storage=l}),G4e({committedValuesRef:x,eagerValuesRef:D,groupId:m,layout:v,panelDataArray:D.current.panelDataArray,setLayout:y,panelGroupElement:h.current}),N.useEffect(()=>{const{panelDataArray:B}=D.current;if(t){if(v.length===0||v.length!==B.length)return;let ae=gJ[t];ae==null&&(ae=Y4e(j4e,W4e),gJ[t]=ae);const se=[...B],de=new Map(w.current);ae(t,se,de,v,l)}},[t,v,l]),N.useEffect(()=>{});const M=N.useCallback(B=>{const{onLayout:ae}=x.current,{layout:se,panelDataArray:de}=D.current;if(B.constraints.collapsible){const ie=de.map(Ae=>Ae.constraints),{collapsedSize:ce=0,panelSize:me,pivotIndices:be}=yf(de,B,se);if(_n(me!=null,`Panel size not found for panel "${B.id}"`),!Fc(me,ce)){w.current.set(B.id,me);const we=ug(de,B)===de.length-1?me-ce:ce-me,Te=iE({delta:we,initialLayout:se,panelConstraints:ie,pivotIndices:be,prevLayout:se,trigger:"imperative-api"});jC(se,Te)||(y(Te),D.current.layout=Te,ae&&ae(Te),cg(de,Te,T.current))}}},[]),F=N.useCallback((B,ae)=>{const{onLayout:se}=x.current,{layout:de,panelDataArray:ie}=D.current;if(B.constraints.collapsible){const ce=ie.map(De=>De.constraints),{collapsedSize:me=0,panelSize:be=0,minSize:Ae=0,pivotIndices:we}=yf(ie,B,de),Te=ae??Ae;if(Fc(be,me)){const De=w.current.get(B.id),We=De!=null&&De>=Te?De:Te,Tt=ug(ie,B)===ie.length-1?be-We:We-be,_t=iE({delta:Tt,initialLayout:de,panelConstraints:ce,pivotIndices:we,prevLayout:de,trigger:"imperative-api"});jC(de,_t)||(y(_t),D.current.layout=_t,se&&se(_t),cg(ie,_t,T.current))}}},[]),P=N.useCallback(B=>{const{layout:ae,panelDataArray:se}=D.current,{panelSize:de}=yf(se,B,ae);return _n(de!=null,`Panel size not found for panel "${B.id}"`),de},[]),q=N.useCallback((B,ae)=>{const{panelDataArray:se}=D.current,de=ug(se,B);return $4e({defaultSize:ae,dragState:E,layout:v,panelData:se,panelIndex:de})},[E,v]),j=N.useCallback(B=>{const{layout:ae,panelDataArray:se}=D.current,{collapsedSize:de=0,collapsible:ie,panelSize:ce}=yf(se,B,ae);return _n(ce!=null,`Panel size not found for panel "${B.id}"`),ie===!0&&Fc(ce,de)},[]),Q=N.useCallback(B=>{const{layout:ae,panelDataArray:se}=D.current,{collapsedSize:de=0,collapsible:ie,panelSize:ce}=yf(se,B,ae);return _n(ce!=null,`Panel size not found for panel "${B.id}"`),!ie||vf(ce,de)>0},[]),U=N.useCallback(B=>{const{panelDataArray:ae}=D.current;ae.push(B),ae.sort((se,de)=>{const ie=se.order,ce=de.order;return ie==null&&ce==null?0:ie==null?-1:ce==null?1:ie-ce}),D.current.panelDataArrayChanged=!0,C()},[C]);sg(()=>{if(D.current.panelDataArrayChanged){D.current.panelDataArrayChanged=!1;const{autoSaveId:B,onLayout:ae,storage:se}=x.current,{layout:de,panelDataArray:ie}=D.current;let ce=null;if(B){const be=V4e(B,ie,se);be&&(w.current=new Map(Object.entries(be.expandToSizes)),ce=be.layout)}ce==null&&(ce=H4e({panelDataArray:ie}));const me=hJ({layout:ce,panelConstraints:ie.map(be=>be.constraints)});cJ(de,me)||(y(me),D.current.layout=me,ae&&ae(me),cg(ie,me,T.current))}}),sg(()=>{const B=D.current;return()=>{B.layout=[]}},[]);const K=N.useCallback(B=>{let ae=!1;const se=h.current;return se&&window.getComputedStyle(se,null).getPropertyValue("direction")==="rtl"&&(ae=!0),function(ie){ie.preventDefault();const ce=h.current;if(!ce)return()=>null;const{direction:me,dragState:be,id:Ae,keyboardResizeBy:we,onLayout:Te}=x.current,{layout:De,panelDataArray:We}=D.current,{initialLayout:Ye}=be??{},Tt=sJ(Ae,B,ce);let _t=q4e(ie,B,me,be,we,ce);const Jt=me==="horizontal";Jt&&ae&&(_t=-_t);const Ge=We.map(mt=>mt.constraints),Ve=iE({delta:_t,initialLayout:Ye??De,panelConstraints:Ge,pivotIndices:Tt,prevLayout:De,trigger:aJ(ie)?"keyboard":"mouse-or-touch"}),Xe=!jC(De,Ve);(iJ(ie)||oJ(ie))&&O.current!=_t&&(O.current=_t,!Xe&&_t!==0?Jt?pL(B,_t<0?N4e:O4e):pL(B,_t<0?I4e:D4e):pL(B,0)),Xe&&(y(Ve),D.current.layout=Ve,Te&&Te(Ve),cg(We,Ve,T.current))}},[]),G=N.useCallback((B,ae)=>{const{onLayout:se}=x.current,{layout:de,panelDataArray:ie}=D.current,ce=ie.map(De=>De.constraints),{panelSize:me,pivotIndices:be}=yf(ie,B,de);_n(me!=null,`Panel size not found for panel "${B.id}"`);const we=ug(ie,B)===ie.length-1?me-ae:ae-me,Te=iE({delta:we,initialLayout:de,panelConstraints:ce,pivotIndices:be,prevLayout:de,trigger:"imperative-api"});jC(de,Te)||(y(Te),D.current.layout=Te,se&&se(Te),cg(ie,Te,T.current))},[]),Y=N.useCallback((B,ae)=>{const{layout:se,panelDataArray:de}=D.current,{collapsedSize:ie=0,collapsible:ce}=ae,{collapsedSize:me=0,collapsible:be,maxSize:Ae=100,minSize:we=0}=B.constraints,{panelSize:Te}=yf(de,B,se);Te!=null&&(ce&&be&&Fc(Te,ie)?Fc(ie,me)||G(B,me):Te<we?G(B,we):Te>Ae&&G(B,Ae))},[G]),W=N.useCallback((B,ae)=>{const{direction:se}=x.current,{layout:de}=D.current;if(!h.current)return;const ie=fL(B,h.current);_n(ie,`Drag handle element not found for id "${B}"`);const ce=uJ(se,ae);b({dragHandleId:B,dragHandleRect:ie.getBoundingClientRect(),initialCursorPosition:ce,initialLayout:de})},[]),J=N.useCallback(()=>{b(null)},[]),$=N.useCallback(B=>{const{panelDataArray:ae}=D.current,se=ug(ae,B);se>=0&&(ae.splice(se,1),delete T.current[B.id],D.current.panelDataArrayChanged=!0,C())},[C]),Z=N.useMemo(()=>({collapsePanel:M,direction:r,dragState:E,expandPanel:F,getPanelSize:P,getPanelStyle:q,groupId:m,isPanelCollapsed:j,isPanelExpanded:Q,reevaluatePanelConstraints:Y,registerPanel:U,registerResizeHandle:K,resizePanel:G,startDragging:W,stopDragging:J,unregisterPanel:$,panelGroupElement:h.current}),[M,E,r,F,P,q,m,j,Q,Y,U,K,G,W,J,$]),te={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return N.createElement(uL.Provider,{value:Z},N.createElement(d,{...f,children:e,className:n,id:i,ref:h,style:{...te,...u},[mo.group]:"",[mo.groupDirection]:r,[mo.groupId]:m}))}const K4e=N.forwardRef((t,e)=>N.createElement(_J,{...t,forwardedRef:e}));_J.displayName="PanelGroup",K4e.displayName="forwardRef(PanelGroup)";function ug(t,e){return t.findIndex(n=>n===e||n.id===e.id)}function yf(t,e,n){const r=ug(t,e),i=r===t.length-1?[r-1,r]:[r,r+1],o=n[r];return{...e.constraints,panelSize:o,pivotIndices:i}}var bJ="Toggle",EJ=N.forwardRef((t,e)=>{const{pressed:n,defaultPressed:r,onPressedChange:a,...i}=t,[o,s]=Xo({prop:n,onChange:a,defaultProp:r??!1,caller:bJ});return A.jsx(ft.button,{type:"button","aria-pressed":o,"data-state":o?"on":"off","data-disabled":t.disabled?"":void 0,...i,ref:e,onClick:Le(t.onClick,()=>{t.disabled||s(!o)})})});EJ.displayName=bJ;var X4e=EJ;X4e.displayName;var WC="Switch",[Q4e]=pa(WC),[Z4e,J4e]=Q4e(WC),SJ=N.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:a,defaultChecked:i,required:o,disabled:s,value:l="on",onCheckedChange:u,form:d,...f}=t,[m,h]=N.useState(null),E=It(e,T=>h(T)),b=N.useRef(!1),v=m?d||!!m.closest("form"):!0,[y,C]=Xo({prop:a,defaultProp:i??!1,onChange:u,caller:WC});return A.jsxs(Z4e,{scope:n,checked:y,disabled:s,children:[A.jsx(ft.button,{type:"button",role:"switch","aria-checked":y,"aria-required":o,"data-state":CJ(y),"data-disabled":s?"":void 0,disabled:s,value:l,...f,ref:E,onClick:Le(t.onClick,T=>{C(w=>!w),v&&(b.current=T.isPropagationStopped(),b.current||T.stopPropagation())})}),v&&A.jsx(TJ,{control:m,bubbles:!b.current,name:r,value:l,checked:y,required:o,disabled:s,form:d,style:{transform:"translateX(-100%)"}})]})});SJ.displayName=WC;var vJ="SwitchThumb",yJ=N.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,a=J4e(vJ,n);return A.jsx(ft.span,{"data-state":CJ(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:e})});yJ.displayName=vJ;var e3e="SwitchBubbleInput",TJ=N.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...a},i)=>{const o=N.useRef(null),s=It(o,i),l=dx(n),u=nx(e);return N.useEffect(()=>{const d=o.current;if(!d)return;const f=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(f,"checked").set;if(l!==n&&h){const E=new Event("click",{bubbles:r});h.call(d,n),d.dispatchEvent(E)}},[l,n,r]),A.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:s,style:{...a.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});TJ.displayName=e3e;function CJ(t){return t?"checked":"unchecked"}var t3e=SJ,n3e=yJ,r3e=Ps(["peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors","disabled:cursor-not-allowed disabled:opacity-50","data-[state=unchecked]:bg-input","data-[state=checked]:bg-primary","focus-visible:outline-none focus-visible:border focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50"],{variants:{variant:{default:"",box:""}},defaultVariants:{variant:"default"}}),a3e=Ps("pointer-events-none block size-4 rounded-full bg-background transition-transform data-[state=unchecked]:translate-x-0 data-[state=checked]:translate-x-4 shadow-lg",{variants:{variant:{default:"",box:""}},defaultVariants:{variant:"default"}}),i3e=Ps("inline-flex items-start gap-3",{variants:{variant:{default:"",box:"rounded-lg border border-input bg-card p-4 shadow-xs has-[[data-state=checked]]:border-primary has-[[data-state=checked]]:bg-[var(--custom-bg-primary-5-dark-bg-primary-10)] transition-colors hover:bg-accent/50"},controlPlacement:{start:"",end:"flex-row-reverse justify-between w-full"}},defaultVariants:{variant:"default",controlPlacement:"start"}}),o3e=N.createContext({}),AJ=t=>{var e=t,{ref:n,variant:r,label:a,required:i,optional:o,icon:s,badge:l,tooltip:u,description:d,controlPlacement:f="start",disabled:m}=e,h=Mn(e,["ref","variant","label","required","optional","icon","badge","tooltip","description","controlPlacement","disabled"]),E;const b=N.useId(),v=h.id||b,y=N.use(o3e),C=(E=r??y.variant)!=null?E:"default",T=A.jsx(t3e,Rr(Qt({ref:n,id:v,className:r3e({variant:C}),disabled:m},h),{children:A.jsx(n3e,{className:Zt(a3e({variant:C}))})}));return!a&&!d?T:A.jsxs("div",{className:Zt(i3e({variant:C,controlPlacement:f}),m?"cursor-not-allowed":"cursor-pointer",m&&"opacity-70"),onClick:w=>{var O;!m&&C==="box"&&w.target instanceof Element&&!w.target.closest('[role="switch"]')&&!w.target.closest("label")&&((O=document.getElementById(v))==null||O.click())},children:[A.jsx("div",{className:"flex h-5 items-center",children:T}),A.jsx(Bs,{label:a||"",htmlFor:v,required:i,optional:o,icon:s,badge:l,tooltip:u,description:d})]})};AJ.displayName="Switch";var s3e=class{constructor(){Ch(this,"activeStreams",new Map)}subscribe(t,e,n,r){const a=this.activeStreams.get(t);return a?this.subscribeToExistingStream(t,a,e):this.createNewStream(t,e,n,r)}getStreamEvents(t){const e=this.activeStreams.get(t);return e?[...e.events]:[]}isStreamActive(t){return this.activeStreams.has(t)}getSubscriberCount(t){const e=this.activeStreams.get(t);return e?e.subscribers.size:0}closeStream(t){const e=this.activeStreams.get(t);e&&(e.controller.abort(),this.cleanupStream(t))}closeAllStreams(){for(const t of this.activeStreams.keys())this.closeStream(t)}subscribeToExistingStream(t,e,n){var r,a,i,o,s;e.subscribers.add(n);try{(r=n.onStart)==null||r.call(n);for(const l of e.events)(a=n.onData)==null||a.call(n,l);e.isCompleted&&(e.error?(i=n.onError)==null||i.call(n,e.error):(o=n.onSuccess)==null||o.call(n,e.events),(s=n.onComplete)==null||s.call(n))}catch(l){console.error("Error sending historical events to subscriber:",l)}return{promise:e.promise,unsubscribe:()=>this.unsubscribe(t,n),disconnect:()=>this.disconnect(t),cancel:()=>this.cancel(t)}}createNewStream(t,e,n,r){const a=new AbortController,i=new Set([e]),o=[],s={controller:a,promise:Promise.resolve([]),subscribers:i,events:o,isCompleted:!1,error:null,canceler:r};this.activeStreams.set(t,s);const l={onStart:()=>{s.subscribers.forEach(d=>{var f;try{(f=d.onStart)==null||f.call(d)}catch(m){console.error("Error in subscriber onStart:",m)}})},onData:d=>{o.push(d),s.subscribers.forEach(f=>{var m;try{(m=f.onData)==null||m.call(f,d)}catch(h){console.error("Error in subscriber onData:",h)}})},onError:d=>{s.error=d,s.isCompleted=!0,s.subscribers.forEach(f=>{var m,h;try{(m=f.onError)==null||m.call(f,d),(h=f.onComplete)==null||h.call(f)}catch(E){console.error("Error in subscriber onError:",E)}}),this.cleanupStream(t)},onSuccess:d=>{s.isCompleted=!0,s.subscribers.forEach(f=>{var m,h;try{(m=f.onSuccess)==null||m.call(f,d),(h=f.onComplete)==null||h.call(f)}catch(E){console.error("Error in subscriber onFinish:",E)}}),this.cleanupStream(t)}},u=this.executeStream(n,l,a.signal);return s.promise=u,{promise:u,unsubscribe:()=>this.unsubscribe(t,e),cancel:()=>this.cancel(t),disconnect:()=>this.disconnect(t)}}async executeStream(t,e,n){var r;try{return await t(e,n)}catch(a){const i=a instanceof Error?a:new Error(String(a));throw(r=e.onError)==null||r.call(e,i),i}}async cancel(t){const e=this.activeStreams.get(t);this.disconnect(t),await(e==null?void 0:e.canceler())}disconnect(t){const e=this.activeStreams.get(t);if(e){for(const n of e.subscribers)this.unsubscribe(t,n);this.cleanupStream(t)}}unsubscribe(t,e){const n=this.activeStreams.get(t);if(n&&(n.subscribers.delete(e),n.subscribers.size===0)){try{n.controller.abort()}catch(r){pf.debug("Error aborting stream in unsubscribe",r)}this.cleanupStream(t)}}cleanupStream(t){this.activeStreams.delete(t)}},l3e=new s3e;const c3e=Symbol(),mL=Symbol(),sE="a",RJ="f",wJ="p",xJ="c",NJ="t",hL="h",lE="w",gL="o",_L="k";let u3e=(t,e)=>new Proxy(t,e);const bL=Object.getPrototypeOf,EL=new WeakMap,OJ=t=>t&&(EL.has(t)?EL.get(t):bL(t)===Object.prototype||bL(t)===Array.prototype),KC=t=>typeof t=="object"&&t!==null,d3e=t=>Object.values(Object.getOwnPropertyDescriptors(t)).some(e=>!e.configurable&&!e.writable),p3e=t=>{if(Array.isArray(t))return Array.from(t);const e=Object.getOwnPropertyDescriptors(t);return Object.values(e).forEach(n=>{n.configurable=!0}),Object.create(bL(t),e)},f3e=(t,e)=>{const n={[RJ]:e};let r=!1;const a=(s,l)=>{if(!r){let u=n[sE].get(t);if(u||(u={},n[sE].set(t,u)),s===lE)u[lE]=!0;else{let d=u[s];d||(d=new Set,u[s]=d),d.add(l)}}},i=()=>{r=!0,n[sE].delete(t)},o={get(s,l){return l===mL?t:(a(_L,l),IJ(Reflect.get(s,l),n[sE],n[xJ],n[NJ]))},has(s,l){return l===c3e?(i(),!0):(a(hL,l),Reflect.has(s,l))},getOwnPropertyDescriptor(s,l){return a(gL,l),Reflect.getOwnPropertyDescriptor(s,l)},ownKeys(s){return a(lE),Reflect.ownKeys(s)}};return e&&(o.set=o.deleteProperty=()=>!1),[o,n]},SL=t=>t[mL]||t,IJ=(t,e,n,r)=>{if(!OJ(t))return t;let a=r&&r.get(t);if(!a){const l=SL(t);d3e(l)?a=[l,p3e(l)]:a=[l],r==null||r.set(t,a)}const[i,o]=a;let s=n&&n.get(i);return(!s||s[1][RJ]!==!!o)&&(s=f3e(i,!!o),s[1][wJ]=u3e(o||i,s[0]),n&&n.set(i,s)),s[1][sE]=e,s[1][xJ]=n,s[1][NJ]=r,s[1][wJ]},m3e=(t,e)=>{const n=Reflect.ownKeys(t),r=Reflect.ownKeys(e);return n.length!==r.length||n.some((a,i)=>a!==r[i])},DJ=(t,e,n,r,a=Object.is)=>{if(a(t,e))return!1;if(!KC(t)||!KC(e))return!0;const i=n.get(SL(t));if(!i)return!0;if(r){if(r.get(t)===e)return!1;r.set(t,e)}let o=null;for(const s of i[hL]||[])if(o=Reflect.has(t,s)!==Reflect.has(e,s),o)return o;if(i[lE]===!0){if(o=m3e(t,e),o)return o}else for(const s of i[gL]||[]){const l=!!Reflect.getOwnPropertyDescriptor(t,s),u=!!Reflect.getOwnPropertyDescriptor(e,s);if(o=l!==u,o)return o}for(const s of i[_L]||[])if(o=DJ(t[s],e[s],n,r,a),o)return o;if(o===null)throw new Error("invalid used");return o},h3e=t=>OJ(t)&&t[mL]||null,kJ=(t,e=!0)=>{EL.set(t,e)},g3e=(t,e,n)=>{const r=[],a=new WeakSet,i=(o,s)=>{var l,u,d;if(a.has(o))return;KC(o)&&a.add(o);const f=KC(o)&&e.get(SL(o));if(f){if((l=f[hL])===null||l===void 0||l.forEach(m=>{const h=`:has(${String(m)})`;r.push(s?[...s,h]:[h])}),f[lE]===!0){const m=":ownKeys";r.push(s?[...s,m]:[m])}else(u=f[gL])===null||u===void 0||u.forEach(m=>{const h=`:hasOwn(${String(m)})`;r.push(s?[...s,h]:[h])});(d=f[_L])===null||d===void 0||d.forEach(m=>{"value"in(Object.getOwnPropertyDescriptor(o,m)||{})&&i(o[m],s?[...s,m]:[m])})}else s&&r.push(s)};return i(t),r},XC={},vL=t=>typeof t=="object"&&t!==null,_3e=t=>vL(t)&&!yL.has(t)&&(Array.isArray(t)||!(Symbol.iterator in t))&&!(t instanceof WeakMap)&&!(t instanceof WeakSet)&&!(t instanceof Error)&&!(t instanceof Number)&&!(t instanceof Date)&&!(t instanceof String)&&!(t instanceof RegExp)&&!(t instanceof ArrayBuffer)&&!(t instanceof Promise),MJ=(t,e)=>{const n=LJ.get(t);if((n==null?void 0:n[0])===e)return n[1];const r=Array.isArray(t)?[]:Object.create(Object.getPrototypeOf(t));return kJ(r,!0),LJ.set(t,[e,r]),Reflect.ownKeys(t).forEach(a=>{if(Object.getOwnPropertyDescriptor(r,a))return;const i=Reflect.get(t,a),{enumerable:o}=Reflect.getOwnPropertyDescriptor(t,a),s={value:i,enumerable:o,configurable:!0};if(yL.has(i))kJ(i,!1);else if(Tf.has(i)){const[l,u]=Tf.get(i);s.value=MJ(l,u())}Object.defineProperty(r,a,s)}),Object.preventExtensions(r)},b3e=(t,e,n,r)=>({deleteProperty(a,i){const o=Reflect.get(a,i);n(i);const s=Reflect.deleteProperty(a,i);return s&&r(["delete",[i],o]),s},set(a,i,o,s){const l=!t()&&Reflect.has(a,i),u=Reflect.get(a,i,s);if(l&&(PJ(u,o)||QC.has(o)&&PJ(u,QC.get(o))))return!0;n(i),vL(o)&&(o=h3e(o)||o);const d=!Tf.has(o)&&S3e(o)?cE(o):o;return e(i,d),Reflect.set(a,i,d,s),r(["set",[i],o,u]),!0}}),Tf=new WeakMap,yL=new WeakSet,LJ=new WeakMap,TL=[1],QC=new WeakMap;let PJ=Object.is,E3e=(t,e)=>new Proxy(t,e),S3e=_3e,v3e=MJ,y3e=b3e;function cE(t={}){if(!vL(t))throw new Error("object required");const e=QC.get(t);if(e)return e;let n=TL[0];const r=new Set,a=(v,y=++TL[0])=>{n!==y&&(i=n=y,r.forEach(C=>C(v,y)))};let i=n;const o=(v=TL[0])=>(i!==v&&(i=v,l.forEach(([y])=>{const C=y[1](v);C>n&&(n=C)})),n),s=v=>(y,C)=>{const T=[...y];T[1]=[v,...T[1]],a(T,C)},l=new Map,u=(v,y)=>{const C=!yL.has(y)&&Tf.get(y);if(C){if((XC?"production":void 0)!=="production"&&l.has(v))throw new Error("prop listener already exists");if(r.size){const T=C[2](s(v));l.set(v,[C,T])}else l.set(v,[C])}},d=v=>{var y;const C=l.get(v);C&&(l.delete(v),(y=C[1])==null||y.call(C))},f=v=>(r.add(v),r.size===1&&l.forEach(([C,T],w)=>{if((XC?"production":void 0)!=="production"&&T)throw new Error("remove already exists");const O=C[2](s(w));l.set(w,[C,O])}),()=>{r.delete(v),r.size===0&&l.forEach(([C,T],w)=>{T&&(T(),l.set(w,[C]))})});let m=!0;const h=y3e(()=>m,u,d,a),E=E3e(t,h);QC.set(t,E);const b=[t,o,f];return Tf.set(E,b),Reflect.ownKeys(t).forEach(v=>{const y=Object.getOwnPropertyDescriptor(t,v);"value"in y&&y.writable&&(E[v]=t[v])}),m=!1,E}function T3e(t,e,n){const r=Tf.get(t);(XC?"production":void 0)!=="production"&&!r&&console.warn("Please use proxy object");let a;const i=[],o=r[2];let s=!1;const u=o(d=>{i.push(d),a||(a=Promise.resolve().then(()=>{a=void 0,s&&e(i.splice(0))}))});return s=!0,()=>{s=!1,u()}}function FJ(t){const e=Tf.get(t);(XC?"production":void 0)!=="production"&&!e&&console.warn("Please use proxy object");const[n,r]=e;return v3e(n,r())}const C3e={},A3e=(t,e)=>{const n=N.useRef(void 0);N.useEffect(()=>{n.current=g3e(t,e)}),N.useDebugValue(n.current)},R3e=new WeakMap;function ZC(t,e){const r=N.useMemo(()=>t&&new WeakMap,[t]),a=N.useRef(void 0);let i=!0;const o=N.useSyncExternalStore(N.useCallback(l=>{const u=T3e(t,l);return l(),u},[t,void 0]),()=>{const l=FJ(t);try{if(!i&&a.current&&!DJ(a.current,l,r,new WeakMap))return a.current}catch{}return l},()=>FJ(t));i=!1,N.useLayoutEffect(()=>{a.current=o}),(C3e?"production":void 0)!=="production"&&A3e(o,r);const s=N.useMemo(()=>new WeakMap,[]);return IJ(o,r,s,R3e)}var CL=new Map;function JC(t,e){return CL.has(t)||CL.set(t,e()),CL.get(t)}var Td={handler_id:"",workflow_name:"",status:"not_started",started_at:"",updated_at:void 0,completed_at:void 0,result:void 0,loading:!0},Cf=(t={})=>{var e,n,r,a;const i={handler_id:(e=t.handler_id)!=null?e:Td.handler_id,workflow_name:(n=t.workflow_name)!=null?n:Td.workflow_name,status:(r=t.status)!=null?r:Td.status,started_at:(a=t.started_at)!=null?a:Td.started_at,updated_at:t.updated_at?new Date(t.updated_at):Td.updated_at,completed_at:t.completed_at?new Date(t.completed_at):Td.completed_at,error:t.error,result:t.result?oN.fromRawEvent(t.result):Td.result,loading:t.status?!1:Td.loading,loadingError:void 0};return cE(i)};function BJ(t,e){const n={async sendEvent(r,a){if(!t.handler_id)throw new Error("Handler ID is not yet initialized");const i=r instanceof Aa?r.toRawEvent():r;return(await jq({client:e,path:{handler_id:t.handler_id},body:{event:i,step:a}})).data},async sync(){t.loading=!0,t.loadingError=void 0;const r=t.handler_id;if(r)try{const a=await aye({client:e,path:{handler_id:r}});if(a.error){const i=a.error;if(typeof i=="object"&&i!==null&&"handler_id"in i&&"status"in i){const s=Cf(i);Object.assign(t,s);return}const o=typeof i=="object"&&i!==null&&"detail"in i?String(i.detail):String(i);t.loadingError=o;return}if(a.data){const i=Cf(a.data);Object.assign(t,i)}}catch(a){t.loadingError=a instanceof Error?a.message:String(a)}finally{t.loading=!1}},subscribeToEvents(r,a=!1){if(!t.handler_id)throw new Error("Handler ID is not yet initialized");const i=`handler:${t.handler_id}`,o={onStart:()=>{var m;t.status="running",(m=r==null?void 0:r.onStart)==null||m.call(r)},onData:m=>{var h;t.updated_at=new Date,(h=r==null?void 0:r.onData)==null||h.call(r,m)},onError:m=>{var h;t.status="failed",t.completed_at=new Date,t.updated_at=new Date,t.error=m.message,(h=r==null?void 0:r.onError)==null||h.call(r,m)},onSuccess:m=>{var h;t.status="completed",t.completed_at=new Date,t.updated_at=new Date,t.result=m[m.length-1],(h=r==null?void 0:r.onSuccess)==null||h.call(r,m)},onComplete:()=>{var m;t.completed_at=new Date,t.updated_at=new Date,(m=r==null?void 0:r.onComplete)==null||m.call(r)}},s=async()=>{await iye({client:e,path:{handler_id:t.handler_id}})},{promise:l,unsubscribe:u,disconnect:d,cancel:f}=l3e.subscribe(i,o,async(m,h)=>w3e({client:e,handlerId:t.handler_id,includeInternal:a,abortSignal:h},m,n,t),s);return{promise:l,unsubscribe:u,disconnect:d,cancel:f}}};return n}function w3e(t,e,n,r){return new Promise(a=>{var i;const o=((i=t.client.getConfig().baseUrl)!=null?i:"").replace(/\/$/,""),s=new URLSearchParams;s.set("sse","true"),t.includeInternal&&s.set("include_internal","true");const l=[],u=new EventSource(`${o}/events/${encodeURIComponent(t.handlerId)}?${s.toString()}`,{withCredentials:!0});t.abortSignal&&t.abortSignal.addEventListener("abort",()=>{u.close()}),u.addEventListener("message",d=>{var f;pf.debug("[streamByEventSource] message",JSON.parse(d.data));const m=Aa.fromRawEvent(JSON.parse(d.data));(f=e.onData)==null||f.call(e,m),l.push(m),MH(m)&&(u.close(),n.sync().then(()=>{var h,E,b;if(r.status==="completed")(h=e.onSuccess)==null||h.call(e,l);else if(r.status==="failed")(E=e.onError)==null||E.call(e,new Error(r.error||"Server Error"));else if(r.status==="cancelled")(b=e.onCancel)==null||b.call(e);else throw new Error(`[This should never happen] Unexpected running status: ${r.status}`);a(l)}))}),u.addEventListener("error",d=>{pf.warn("[streamByEventSource] error",d)}),u.addEventListener("open",()=>{var d;pf.debug("[streamByEventSource] open"),(d=e.onStart)==null||d.call(e)}),u.addEventListener("close",()=>{var d;pf.debug("[streamByEventSource] close"),(d=e.onSuccess)==null||d.call(e,l),a(l)})})}function x3e(t,e){const n=Cf(e);return Object.assign(t,n),t}var N3e=({query:t}={})=>cE({query:t??{},loading:!0,error:void 0,handlers:{}});function O3e(t,e){return{async sync(){var n,r;t.loading=!0,t.loadingError=void 0;try{const i=(r=(n=(await rye({client:e,query:t.query})).data)==null?void 0:n.handlers)!=null?r:[],o=new Set(i.map(l=>l.handler_id)),s=new Set(Object.keys(t.handlers));for(const l of s)o.has(l)||delete t.handlers[l];for(const l of i)t.handlers[l.handler_id]=t.handlers[l.handler_id]?x3e(t.handlers[l.handler_id],l):Cf(l)}catch(a){t.loadingError=a instanceof Error?a.message:String(a)}finally{t.loading=!1}},setHandler(n){t.handlers[n.handler_id]=n},actions(n){return BJ(t.handlers[n],e)}}}function I3e(){return cE({workflows:{},loading:!0,error:void 0})}function D3e(t,e){return{async sync(){var n,r;t.loading=!0,t.loadingError=void 0;try{((r=(n=(await Zve({client:e})).data)==null?void 0:n.workflows)!=null?r:[]).forEach(o=>{t.workflows[o]={name:o}})}catch(a){t.loadingError=a instanceof Error?a.message:String(a)}finally{t.loading=!1}},setWorkflow(n){t.workflows[n.name]=n}}}function k3e(t){return cE({name:t,graph:null,loading:!0,loadingError:void 0})}function M3e(t,e){return{async sync(){var n,r;t.loading=!0,t.loadingError=void 0;try{const a=await Wq({client:e,path:{name:t.name}});t.graph=(r=(n=a.data)==null?void 0:n.graph)!=null?r:null}catch(a){t.loadingError=a instanceof Error?a.message:String(a)}finally{t.loading=!1}},async runToCompletion(n){const r=await Jve({client:e,path:{name:t.name},body:{start_event:n}});if(!r.data)throw new Error(`Workflow run empty, response ${JSON.stringify(r)}`);return Cf(r.data)},async createHandler(n,r){const a=await eye({client:e,path:{name:t.name},body:{start_event:n,handler_id:r}});if(!a.data)throw new Error("Handler creation failed");return Cf(a.data)}}}function UJ({query:t,sync:e=!0}={}){const n=pd(),r=JC(`handlers:${JSON.stringify(t)}`,()=>N3e({query:t??{}})),a=N.useMemo(()=>O3e(r,n),[r,n]);return N.useEffect(()=>{e&&a.sync()},[a,e]),Qt({state:ZC(r)},a)}function L3e({sync:t=!0}={}){const e=pd(),n=JC("workflows",()=>I3e()),r=N.useMemo(()=>D3e(n,e),[n,e]);return N.useEffect(()=>{t&&r.sync()},[r,t]),Qt({state:ZC(n)},r)}function P3e(t){const e=pd(),n=JC(`workflow:${t}`,()=>k3e(t)),r=N.useMemo(()=>M3e(n,e),[n,e]);return Qt({state:ZC(n)},r)}function F3e(t,{sync:e=!0}={}){const n=pd(),r=JC(`handler:${t}`,()=>Cf({handler_id:t??void 0})),a=N.useMemo(()=>BJ(r,n),[r,n]);return N.useEffect(()=>{e&&a.sync()},[a,e,t]),Qt({state:ZC(r)},a)}function B3e(t=100,e){const n=Oe.useRef([]),[r,a]=Oe.useState([]),i=Oe.useCallback(s=>{n.current.push(s)},[]),o=Oe.useCallback(()=>{n.current=[],a([])},[]);return Oe.useEffect(()=>{const s=setInterval(()=>{const l=n.current;l.length!==0&&(a(u=>[...u,...l].sort(e)),n.current=[])},t);return()=>clearInterval(s)},[t,e]),{items:r,push:i,clear:o}}var U3e="AlertDialog",[G3e]=pa(U3e,[zH]),Af=zH(),z3e="AlertDialogTrigger",q3e=N.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,a=Af(n);return A.jsx(r$,{...a,...r,ref:e})});q3e.displayName=z3e;var H3e="AlertDialogOverlay",GJ=N.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,a=Af(n);return A.jsx(x0,{...a,...r,ref:e})});GJ.displayName=H3e;var dg="AlertDialogContent",[$3e,Y3e]=G3e(dg),V3e=Y8("AlertDialogContent"),zJ=N.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...a}=t,i=Af(n),o=N.useRef(null),s=It(e,o),l=N.useRef(null);return A.jsx(KTe,{contentName:dg,titleName:qJ,docsSlug:"alert-dialog",children:A.jsx($3e,{scope:n,cancelRef:l,children:A.jsxs(N0,{role:"alertdialog",...i,...a,ref:s,onOpenAutoFocus:Le(a.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=l.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[A.jsx(V3e,{children:r}),A.jsx(W3e,{contentRef:o})]})})})});zJ.displayName=dg;var qJ="AlertDialogTitle",HJ=N.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,a=Af(n);return A.jsx(JT,{...a,...r,ref:e})});HJ.displayName=qJ;var $J="AlertDialogDescription",YJ=N.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,a=Af(n);return A.jsx(eC,{...a,...r,ref:e})});YJ.displayName=$J;var j3e="AlertDialogAction",VJ=N.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,a=Af(n);return A.jsx(tC,{...a,...r,ref:e})});VJ.displayName=j3e;var jJ="AlertDialogCancel",WJ=N.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:a}=Y3e(jJ,n),i=Af(n),o=It(e,a);return A.jsx(tC,{...i,...r,ref:o})});WJ.displayName=jJ;var W3e=({contentRef:t})=>{const e=`\`${dg}\` requires a description for the component to be accessible for screen reader users.
|
|
621
621
|
|
|
622
622
|
You can add a description to the \`${dg}\` by passing a \`${$J}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
623
623
|
|
|
624
624
|
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${dg}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
|
|
625
625
|
|
|
626
|
-
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return N.useEffect(()=>{var r;document.getElementById((r=t.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},K3e=GJ,X3e=zJ,Q3e=VJ,Z3e=WJ,J3e=HJ,eFe=YJ;K3e.displayName,X3e.displayName,J3e.displayName,eFe.displayName,Q3e.displayName,Z3e.displayName;var KJ="DropdownMenu",[tFe]=pa(KJ,[
|
|
626
|
+
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return N.useEffect(()=>{var r;document.getElementById((r=t.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},K3e=GJ,X3e=zJ,Q3e=VJ,Z3e=WJ,J3e=HJ,eFe=YJ;K3e.displayName,X3e.displayName,J3e.displayName,eFe.displayName,Q3e.displayName,Z3e.displayName;var KJ="DropdownMenu",[tFe]=pa(KJ,[eE]),go=eE(),[EQe,XJ]=tFe(KJ),QJ="DropdownMenuTrigger",nFe=N.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...a}=t,i=XJ(QJ,n),o=go(n);return A.jsx(YM,{asChild:!0,...o,children:A.jsx(ft.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...a,ref:Wy(e,i.triggerRef),onPointerDown:Le(t.onPointerDown,s=>{!r&&s.button===0&&s.ctrlKey===!1&&(i.onOpenToggle(),i.open||s.preventDefault())}),onKeyDown:Le(t.onKeyDown,s=>{r||(["Enter"," "].includes(s.key)&&i.onOpenToggle(),s.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(s.key)&&s.preventDefault())})})})});nFe.displayName=QJ;var ZJ="DropdownMenuContent",JJ=N.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,a=XJ(ZJ,n),i=go(n),o=N.useRef(!1);return A.jsx(VM,{id:a.contentId,"aria-labelledby":a.triggerId,...i,...r,ref:e,onCloseAutoFocus:Le(t.onCloseAutoFocus,s=>{var l;o.current||(l=a.triggerRef.current)==null||l.focus(),o.current=!1,s.preventDefault()}),onInteractOutside:Le(t.onInteractOutside,s=>{const l=s.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0,d=l.button===2||u;(!a.modal||d)&&(o.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});JJ.displayName=ZJ;var rFe="DropdownMenuGroup",aFe=N.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,a=go(n);return A.jsx(jM,{...a,...r,ref:e})});aFe.displayName=rFe;var iFe="DropdownMenuLabel",eee=N.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,a=go(n);return A.jsx(WM,{...a,...r,ref:e})});eee.displayName=iFe;var oFe="DropdownMenuItem",tee=N.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,a=go(n);return A.jsx(KM,{...a,...r,ref:e})});tee.displayName=oFe;var sFe="DropdownMenuCheckboxItem",nee=N.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,a=go(n);return A.jsx(XM,{...a,...r,ref:e})});nee.displayName=sFe;var lFe="DropdownMenuRadioGroup",cFe=N.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,a=go(n);return A.jsx(QM,{...a,...r,ref:e})});cFe.displayName=lFe;var uFe="DropdownMenuRadioItem",ree=N.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,a=go(n);return A.jsx(ZM,{...a,...r,ref:e})});ree.displayName=uFe;var dFe="DropdownMenuItemIndicator",pFe=N.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,a=go(n);return A.jsx(JM,{...a,...r,ref:e})});pFe.displayName=dFe;var fFe="DropdownMenuSeparator",aee=N.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,a=go(n);return A.jsx(eL,{...a,...r,ref:e})});aee.displayName=fFe;var mFe="DropdownMenuArrow",hFe=N.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,a=go(n);return A.jsx(tL,{...a,...r,ref:e})});hFe.displayName=mFe;var gFe="DropdownMenuSubTrigger",iee=N.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,a=go(n);return A.jsx(nL,{...a,...r,ref:e})});iee.displayName=gFe;var _Fe="DropdownMenuSubContent",oee=N.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,a=go(n);return A.jsx(rL,{...a,...r,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});oee.displayName=_Fe;var bFe=JJ,EFe=eee,SFe=tee,vFe=nee,yFe=ree,TFe=aee,CFe=iee,AFe=oee;CFe.displayName,AFe.displayName,bFe.displayName,SFe.displayName,vFe.displayName,yFe.displayName,EFe.displayName,TFe.displayName;function eA(){var t;return typeof window<"u"&&((t=window.location)!=null&&t.origin)?window.location.origin:"http://localhost:8000"}function RFe(t,e){if(t==null)return{};var n,r,a=nz(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function AL(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function wFe(t){if(Array.isArray(t))return AL(t)}function xFe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function NFe(t,e){if(t){if(typeof t=="string")return AL(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?AL(t,e):void 0}}function OFe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
627
627
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function RL(t){return wFe(t)||xFe(t)||NFe(t)||OFe()}function uE(t){"@babel/helpers - typeof";return uE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},uE(t)}function IFe(t,e){if(uE(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(uE(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function DFe(t){var e=IFe(t,"string");return uE(e)=="symbol"?e:e+""}function see(t,e,n){return(e=DFe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function lee(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function pg(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?lee(Object(n),!0).forEach(function(r){see(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):lee(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function kFe(t){var e=t.length;if(e===0||e===1)return t;if(e===2)return[t[0],t[1],"".concat(t[0],".").concat(t[1]),"".concat(t[1],".").concat(t[0])];if(e===3)return[t[0],t[1],t[2],"".concat(t[0],".").concat(t[1]),"".concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[0]),"".concat(t[1],".").concat(t[2]),"".concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[1]),"".concat(t[0],".").concat(t[1],".").concat(t[2]),"".concat(t[0],".").concat(t[2],".").concat(t[1]),"".concat(t[1],".").concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[0],".").concat(t[1]),"".concat(t[2],".").concat(t[1],".").concat(t[0])];if(e>=4)return[t[0],t[1],t[2],t[3],"".concat(t[0],".").concat(t[1]),"".concat(t[0],".").concat(t[2]),"".concat(t[0],".").concat(t[3]),"".concat(t[1],".").concat(t[0]),"".concat(t[1],".").concat(t[2]),"".concat(t[1],".").concat(t[3]),"".concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[1]),"".concat(t[2],".").concat(t[3]),"".concat(t[3],".").concat(t[0]),"".concat(t[3],".").concat(t[1]),"".concat(t[3],".").concat(t[2]),"".concat(t[0],".").concat(t[1],".").concat(t[2]),"".concat(t[0],".").concat(t[1],".").concat(t[3]),"".concat(t[0],".").concat(t[2],".").concat(t[1]),"".concat(t[0],".").concat(t[2],".").concat(t[3]),"".concat(t[0],".").concat(t[3],".").concat(t[1]),"".concat(t[0],".").concat(t[3],".").concat(t[2]),"".concat(t[1],".").concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[0],".").concat(t[3]),"".concat(t[1],".").concat(t[2],".").concat(t[0]),"".concat(t[1],".").concat(t[2],".").concat(t[3]),"".concat(t[1],".").concat(t[3],".").concat(t[0]),"".concat(t[1],".").concat(t[3],".").concat(t[2]),"".concat(t[2],".").concat(t[0],".").concat(t[1]),"".concat(t[2],".").concat(t[0],".").concat(t[3]),"".concat(t[2],".").concat(t[1],".").concat(t[0]),"".concat(t[2],".").concat(t[1],".").concat(t[3]),"".concat(t[2],".").concat(t[3],".").concat(t[0]),"".concat(t[2],".").concat(t[3],".").concat(t[1]),"".concat(t[3],".").concat(t[0],".").concat(t[1]),"".concat(t[3],".").concat(t[0],".").concat(t[2]),"".concat(t[3],".").concat(t[1],".").concat(t[0]),"".concat(t[3],".").concat(t[1],".").concat(t[2]),"".concat(t[3],".").concat(t[2],".").concat(t[0]),"".concat(t[3],".").concat(t[2],".").concat(t[1]),"".concat(t[0],".").concat(t[1],".").concat(t[2],".").concat(t[3]),"".concat(t[0],".").concat(t[1],".").concat(t[3],".").concat(t[2]),"".concat(t[0],".").concat(t[2],".").concat(t[1],".").concat(t[3]),"".concat(t[0],".").concat(t[2],".").concat(t[3],".").concat(t[1]),"".concat(t[0],".").concat(t[3],".").concat(t[1],".").concat(t[2]),"".concat(t[0],".").concat(t[3],".").concat(t[2],".").concat(t[1]),"".concat(t[1],".").concat(t[0],".").concat(t[2],".").concat(t[3]),"".concat(t[1],".").concat(t[0],".").concat(t[3],".").concat(t[2]),"".concat(t[1],".").concat(t[2],".").concat(t[0],".").concat(t[3]),"".concat(t[1],".").concat(t[2],".").concat(t[3],".").concat(t[0]),"".concat(t[1],".").concat(t[3],".").concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[3],".").concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[0],".").concat(t[1],".").concat(t[3]),"".concat(t[2],".").concat(t[0],".").concat(t[3],".").concat(t[1]),"".concat(t[2],".").concat(t[1],".").concat(t[0],".").concat(t[3]),"".concat(t[2],".").concat(t[1],".").concat(t[3],".").concat(t[0]),"".concat(t[2],".").concat(t[3],".").concat(t[0],".").concat(t[1]),"".concat(t[2],".").concat(t[3],".").concat(t[1],".").concat(t[0]),"".concat(t[3],".").concat(t[0],".").concat(t[1],".").concat(t[2]),"".concat(t[3],".").concat(t[0],".").concat(t[2],".").concat(t[1]),"".concat(t[3],".").concat(t[1],".").concat(t[0],".").concat(t[2]),"".concat(t[3],".").concat(t[1],".").concat(t[2],".").concat(t[0]),"".concat(t[3],".").concat(t[2],".").concat(t[0],".").concat(t[1]),"".concat(t[3],".").concat(t[2],".").concat(t[1],".").concat(t[0])]}var wL={};function MFe(t){if(t.length===0||t.length===1)return t;var e=t.join(".");return wL[e]||(wL[e]=kFe(t)),wL[e]}function LFe(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,r=t.filter(function(i){return i!=="token"}),a=MFe(r);return a.reduce(function(i,o){return pg(pg({},i),n[o])},e)}function cee(t){return t.join(" ")}function PFe(t,e){var n=0;return function(r){return n+=1,r.map(function(a,i){return uee({node:a,stylesheet:t,useInlineStyles:e,key:"code-segment-".concat(n,"-").concat(i)})})}}function uee(t){var e=t.node,n=t.stylesheet,r=t.style,a=r===void 0?{}:r,i=t.useInlineStyles,o=t.key,s=e.properties,l=e.type,u=e.tagName,d=e.value;if(l==="text")return d;if(u){var f=PFe(n,i),m;if(!i)m=pg(pg({},s),{},{className:cee(s.className)});else{var h=Object.keys(n).reduce(function(y,C){return C.split(".").forEach(function(T){y.includes(T)||y.push(T)}),y},[]),E=s.className&&s.className.includes("token")?["token"]:[],b=s.className&&E.concat(s.className.filter(function(y){return!h.includes(y)}));m=pg(pg({},s),{},{className:cee(b)||void 0,style:LFe(s.className,Object.assign({},s.style,a),n)})}var v=f(e.children);return Oe.createElement(u,AT({key:o},m),v)}}const FFe=(function(t,e){var n=t.listLanguages();return n.indexOf(e)!==-1});var BFe=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function dee(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function Cd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?dee(Object(n),!0).forEach(function(r){see(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):dee(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}var UFe=/\n/g;function GFe(t){return t.match(UFe)}function zFe(t){var e=t.lines,n=t.startingLineNumber,r=t.style;return e.map(function(a,i){var o=i+n;return Oe.createElement("span",{key:"line-".concat(i),className:"react-syntax-highlighter-line-number",style:typeof r=="function"?r(o):r},"".concat(o,`
|
|
628
628
|
`))})}function qFe(t){var e=t.codeString,n=t.codeStyle,r=t.containerStyle,a=r===void 0?{float:"left",paddingRight:"10px"}:r,i=t.numberStyle,o=i===void 0?{}:i,s=t.startingLineNumber;return Oe.createElement("code",{style:Object.assign({},n,a)},zFe({lines:e.replace(/\n$/,"").split(`
|
|
629
629
|
`),style:o,startingLineNumber:s}))}function HFe(t){return"".concat(t.toString().length,".25em")}function pee(t,e){return{type:"element",tagName:"span",properties:{key:"line-number--".concat(t),className:["comment","linenumber","react-syntax-highlighter-line-number"],style:e},children:[{type:"text",value:t}]}}function fee(t,e,n){var r={display:"inline-block",minWidth:HFe(n),paddingRight:"1em",textAlign:"right",userSelect:"none"},a=typeof t=="function"?t(e):t,i=Cd(Cd({},r),a);return i}function tA(t){var e=t.children,n=t.lineNumber,r=t.lineNumberStyle,a=t.largestLineNumber,i=t.showInlineLineNumbers,o=t.lineProps,s=o===void 0?{}:o,l=t.className,u=l===void 0?[]:l,d=t.showLineNumbers,f=t.wrapLongLines,m=t.wrapLines,h=m===void 0?!1:m,E=h?Cd({},typeof s=="function"?s(n):s):{};if(E.className=E.className?[].concat(RL(E.className.trim().split(/\s+/)),RL(u)):u,n&&i){var b=fee(r,n,a);e.unshift(pee(n,b))}return f&d&&(E.style=Cd({display:"flex"},E.style)),{type:"element",tagName:"span",properties:E,children:e}}function mee(t){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],r=0;r<t.length;r++){var a=t[r];if(a.type==="text")n.push(tA({children:[a],className:RL(new Set(e))}));else if(a.children){var i=e.concat(a.properties.className);mee(a.children,i).forEach(function(o){return n.push(o)})}}return n}function $Fe(t,e,n,r,a,i,o,s,l){var u,d=mee(t.value),f=[],m=-1,h=0;function E(O,x){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return tA({children:O,lineNumber:x,lineNumberStyle:s,largestLineNumber:o,showInlineLineNumbers:a,lineProps:n,className:D,showLineNumbers:r,wrapLongLines:l,wrapLines:e})}function b(O,x){if(r&&x&&a){var D=fee(s,x,o);O.unshift(pee(x,D))}return O}function v(O,x){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return e||D.length>0?E(O,x,D):b(O,x)}for(var y=function(){var x=d[h],D=x.children[0].value,M=GFe(D);if(M){var F=D.split(`
|
|
@@ -652,7 +652,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
652
652
|
`,`
|
|
653
653
|
+`).split(`
|
|
654
654
|
`)),d=u.reduce((f,m)=>f.concat(...m),[]);return[u,d]}return[[],[]]},[t]);return N.useEffect(()=>{const l=(e==null?void 0:e.target)??ule,u=(e==null?void 0:e.actInsideInputWithModifier)??!0;if(t!==null){const d=h=>{var v,y;if(a.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!a.current||a.current&&!u)&&Cse(h))return!1;const b=ple(h.code,s);if(i.current.add(h[b]),dle(o,i.current,!1)){const C=((y=(v=h.composedPath)==null?void 0:v.call(h))==null?void 0:y[0])||h.target,T=(C==null?void 0:C.nodeName)==="BUTTON"||(C==null?void 0:C.nodeName)==="A";e.preventDefault!==!1&&(a.current||!T)&&h.preventDefault(),r(!0)}},f=h=>{const E=ple(h.code,s);dle(o,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(h[E]),h.key==="Meta"&&i.current.clear(),a.current=!1},m=()=>{i.current.clear(),r(!1)};return l==null||l.addEventListener("keydown",d),l==null||l.addEventListener("keyup",f),window.addEventListener("blur",m),window.addEventListener("contextmenu",m),()=>{l==null||l.removeEventListener("keydown",d),l==null||l.removeEventListener("keyup",f),window.removeEventListener("blur",m),window.removeEventListener("contextmenu",m)}}},[t,r]),n}function dle(t,e,n){return t.filter(r=>n||r.length===e.size).some(r=>r.every(a=>e.has(a)))}function ple(t,e){return e.includes(t)?"code":"key"}const _He=()=>{const t=Er();return N.useMemo(()=>({zoomIn:e=>{const{panZoom:n}=t.getState();return n?n.scaleBy(1.2,{duration:e==null?void 0:e.duration}):Promise.resolve(!1)},zoomOut:e=>{const{panZoom:n}=t.getState();return n?n.scaleBy(1/1.2,{duration:e==null?void 0:e.duration}):Promise.resolve(!1)},zoomTo:(e,n)=>{const{panZoom:r}=t.getState();return r?r.scaleTo(e,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},getZoom:()=>t.getState().transform[2],setViewport:async(e,n)=>{const{transform:[r,a,i],panZoom:o}=t.getState();return o?(await o.setViewport({x:e.x??r,y:e.y??a,zoom:e.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[e,n,r]=t.getState().transform;return{x:e,y:n,zoom:r}},setCenter:async(e,n,r)=>t.getState().setCenter(e,n,r),fitBounds:async(e,n)=>{const{width:r,height:a,minZoom:i,maxZoom:o,panZoom:s}=t.getState(),l=q5(e,r,a,i,o,(n==null?void 0:n.padding)??.1);return s?(await s.setViewport(l,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(e,n={})=>{const{transform:r,snapGrid:a,snapToGrid:i,domNode:o}=t.getState();if(!o)return e;const{x:s,y:l}=o.getBoundingClientRect(),u={x:e.x-s,y:e.y-l},d=n.snapGrid??a,f=n.snapToGrid??i;return NE(u,r,f,d)},flowToScreenPosition:e=>{const{transform:n,domNode:r}=t.getState();if(!r)return e;const{x:a,y:i}=r.getBoundingClientRect(),o=kA(e,n);return{x:o.x+a,y:o.y+i}}}),[])};function fle(t,e){const n=[],r=new Map,a=[];for(const i of t)if(i.type==="add"){a.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const o=r.get(i.id);o?o.push(i):r.set(i.id,[i])}for(const i of e){const o=r.get(i.id);if(!o){n.push(i);continue}if(o[0].type==="remove")continue;if(o[0].type==="replace"){n.push({...o[0].item});continue}const s={...i};for(const l of o)bHe(l,s);n.push(s)}return a.length&&a.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function bHe(t,e){switch(t.type){case"select":{e.selected=t.selected;break}case"position":{typeof t.position<"u"&&(e.position=t.position),typeof t.dragging<"u"&&(e.dragging=t.dragging);break}case"dimensions":{typeof t.dimensions<"u"&&(e.measured??(e.measured={}),e.measured.width=t.dimensions.width,e.measured.height=t.dimensions.height,t.setAttributes&&((t.setAttributes===!0||t.setAttributes==="width")&&(e.width=t.dimensions.width),(t.setAttributes===!0||t.setAttributes==="height")&&(e.height=t.dimensions.height))),typeof t.resizing=="boolean"&&(e.resizing=t.resizing);break}}}function mle(t,e){return fle(t,e)}function hle(t,e){return fle(t,e)}function kf(t,e){return{id:t,type:"select",selected:e}}function Ag(t,e=new Set,n=!1){const r=[];for(const[a,i]of t){const o=e.has(a);!(i.selected===void 0&&!o)&&i.selected!==o&&(n&&(i.selected=o),r.push(kf(i.id,o)))}return r}function gle({items:t=[],lookup:e}){var a;const n=[],r=new Map(t.map(i=>[i.id,i]));for(const[i,o]of t.entries()){const s=e.get(o.id),l=((a=s==null?void 0:s.internals)==null?void 0:a.userNode)??s;l!==void 0&&l!==o&&n.push({id:o.id,item:o,type:"replace"}),l===void 0&&n.push({item:o,type:"add",index:i})}for(const[i]of e)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function _le(t){return{id:t.id,type:"remove"}}const ble=t=>Yze(t),EHe=t=>fse(t);function Ele(t){return N.forwardRef(t)}const SHe=typeof window<"u"?N.useLayoutEffect:N.useEffect;function Sle(t){const[e,n]=N.useState(BigInt(0)),[r]=N.useState(()=>vHe(()=>n(a=>a+BigInt(1))));return SHe(()=>{const a=r.get();a.length&&(t(a),r.reset())},[e]),r}function vHe(t){let e=[];return{get:()=>e,reset:()=>{e=[]},push:n=>{e.push(n),t()}}}const vle=N.createContext(null);function yHe({children:t}){const e=Er(),n=N.useCallback(s=>{const{nodes:l=[],setNodes:u,hasDefaultNodes:d,onNodesChange:f,nodeLookup:m,fitViewQueued:h}=e.getState();let E=l;for(const v of s)E=typeof v=="function"?v(E):v;const b=gle({items:E,lookup:m});d&&u(E),b.length>0?f==null||f(b):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:v,nodes:y,setNodes:C}=e.getState();v&&C(y)})},[]),r=Sle(n),a=N.useCallback(s=>{const{edges:l=[],setEdges:u,hasDefaultEdges:d,onEdgesChange:f,edgeLookup:m}=e.getState();let h=l;for(const E of s)h=typeof E=="function"?E(h):E;d?u(h):f&&f(gle({items:h,lookup:m}))},[]),i=Sle(a),o=N.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return A.jsx(vle.Provider,{value:o,children:t})}function THe(){const t=N.useContext(vle);if(!t)throw new Error("useBatchContext must be used within a BatchProvider");return t}const CHe=t=>!!t.panZoom;function rB(){const t=_He(),e=Er(),n=THe(),r=mn(CHe),a=N.useMemo(()=>{const i=f=>e.getState().nodeLookup.get(f),o=f=>{n.nodeQueue.push(f)},s=f=>{n.edgeQueue.push(f)},l=f=>{var y,C;const{nodeLookup:m,nodeOrigin:h}=e.getState(),E=ble(f)?f:m.get(f.id),b=E.parentId?vse(E.position,E.measured,E.parentId,m,h):E.position,v={...E,position:b,width:((y=E.measured)==null?void 0:y.width)??E.width,height:((C=E.measured)==null?void 0:C.height)??E.height};return Sg(v)},u=(f,m,h={replace:!1})=>{o(E=>E.map(b=>{if(b.id===f){const v=typeof m=="function"?m(b):m;return h.replace&&ble(v)?v:{...b,...v}}return b}))},d=(f,m,h={replace:!1})=>{s(E=>E.map(b=>{if(b.id===f){const v=typeof m=="function"?m(b):m;return h.replace&&EHe(v)?v:{...b,...v}}return b}))};return{getNodes:()=>e.getState().nodes.map(f=>({...f})),getNode:f=>{var m;return(m=i(f))==null?void 0:m.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:f=[]}=e.getState();return f.map(m=>({...m}))},getEdge:f=>e.getState().edgeLookup.get(f),setNodes:o,setEdges:s,addNodes:f=>{const m=Array.isArray(f)?f:[f];n.nodeQueue.push(h=>[...h,...m])},addEdges:f=>{const m=Array.isArray(f)?f:[f];n.edgeQueue.push(h=>[...h,...m])},toObject:()=>{const{nodes:f=[],edges:m=[],transform:h}=e.getState(),[E,b,v]=h;return{nodes:f.map(y=>({...y})),edges:m.map(y=>({...y})),viewport:{x:E,y:b,zoom:v}}},deleteElements:async({nodes:f=[],edges:m=[]})=>{const{nodes:h,edges:E,onNodesDelete:b,onEdgesDelete:v,triggerNodeChanges:y,triggerEdgeChanges:C,onDelete:T,onBeforeDelete:w}=e.getState(),{nodes:O,edges:x}=await Xze({nodesToRemove:f,edgesToRemove:m,nodes:h,edges:E,onBeforeDelete:w}),D=x.length>0,M=O.length>0;if(D){const F=x.map(_le);v==null||v(x),C(F)}if(M){const F=O.map(_le);b==null||b(O),y(F)}return(M||D)&&(T==null||T({nodes:O,edges:x})),{deletedNodes:O,deletedEdges:x}},getIntersectingNodes:(f,m=!0,h)=>{const E=Ese(f),b=E?f:l(f),v=h!==void 0;return b?(h||e.getState().nodes).filter(y=>{const C=e.getState().nodeLookup.get(y.id);if(C&&!E&&(y.id===f.id||!C.internals.positionAbsolute))return!1;const T=Sg(v?y:C),w=wE(T,b);return m&&w>0||w>=T.width*T.height||w>=b.width*b.height}):[]},isNodeIntersecting:(f,m,h=!0)=>{const b=Ese(f)?f:l(f);if(!b)return!1;const v=wE(b,m);return h&&v>0||v>=m.width*m.height||v>=b.width*b.height},updateNode:u,updateNodeData:(f,m,h={replace:!1})=>{u(f,E=>{const b=typeof m=="function"?m(E):m;return h.replace?{...E,data:b}:{...E,data:{...E.data,...b}}},h)},updateEdge:d,updateEdgeData:(f,m,h={replace:!1})=>{d(f,E=>{const b=typeof m=="function"?m(E):m;return h.replace?{...E,data:b}:{...E,data:{...E.data,...b}}},h)},getNodesBounds:f=>{const{nodeLookup:m,nodeOrigin:h}=e.getState();return Vze(f,{nodeLookup:m,nodeOrigin:h})},getHandleConnections:({type:f,id:m,nodeId:h})=>{var E;return Array.from(((E=e.getState().connectionLookup.get(`${h}-${f}${m?`-${m}`:""}`))==null?void 0:E.values())??[])},getNodeConnections:({type:f,handleId:m,nodeId:h})=>{var E;return Array.from(((E=e.getState().connectionLookup.get(`${h}${f?m?`-${f}-${m}`:`-${f}`:""}`))==null?void 0:E.values())??[])},fitView:async f=>{const m=e.getState().fitViewResolver??eqe();return e.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:m}),n.nodeQueue.push(h=>[...h]),m.promise}}},[]);return N.useMemo(()=>({...a,...t,viewportInitialized:r}),[r])}const yle=t=>t.selected,AHe=typeof window<"u"?window:void 0;function RHe({deleteKeyCode:t,multiSelectionKeyCode:e}){const n=Er(),{deleteElements:r}=rB(),a=kE(t,{actInsideInputWithModifier:!1}),i=kE(e,{target:AHe});N.useEffect(()=>{if(a){const{edges:o,nodes:s}=n.getState();r({nodes:s.filter(yle),edges:o.filter(yle)}),n.setState({nodesSelectionActive:!1})}},[a]),N.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function wHe(t){const e=Er();N.useEffect(()=>{const n=()=>{var a,i,o,s;if(!t.current||!(((i=(a=t.current).checkVisibility)==null?void 0:i.call(a))??!0))return!1;const r=H5(t.current);(r.height===0||r.width===0)&&((s=(o=e.getState()).onError)==null||s.call(o,"004",Gl.error004())),e.setState({width:r.width||500,height:r.height||500})};if(t.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(t.current),()=>{window.removeEventListener("resize",n),r&&t.current&&r.unobserve(t.current)}}},[])}const GA={position:"absolute",width:"100%",height:"100%",top:0,left:0},xHe=t=>({userSelectionActive:t.userSelectionActive,lib:t.lib,connectionInProgress:t.connection.inProgress});function NHe({onPaneContextMenu:t,zoomOnScroll:e=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:a=.5,panOnScrollMode:i=If.Free,zoomOnDoubleClick:o=!0,panOnDrag:s=!0,defaultViewport:l,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:m,preventScrolling:h=!0,children:E,noWheelClassName:b,noPanClassName:v,onViewportChange:y,isControlledViewport:C,paneClickDistance:T}){const w=Er(),O=N.useRef(null),{userSelectionActive:x,lib:D,connectionInProgress:M}=mn(xHe,Nr),F=kE(m),P=N.useRef();wHe(O);const q=N.useCallback(j=>{y==null||y({x:j[0],y:j[1],zoom:j[2]}),C||w.setState({transform:j})},[y,C]);return N.useEffect(()=>{if(O.current){P.current=Pqe({domNode:O.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:l,paneClickDistance:T,onDraggingChange:K=>w.setState({paneDragging:K}),onPanZoomStart:(K,G)=>{const{onViewportChangeStart:Y,onMoveStart:W}=w.getState();W==null||W(K,G),Y==null||Y(G)},onPanZoom:(K,G)=>{const{onViewportChange:Y,onMove:W}=w.getState();W==null||W(K,G),Y==null||Y(G)},onPanZoomEnd:(K,G)=>{const{onViewportChangeEnd:Y,onMoveEnd:W}=w.getState();W==null||W(K,G),Y==null||Y(G)}});const{x:j,y:Q,zoom:U}=P.current.getViewport();return w.setState({panZoom:P.current,transform:[j,Q,U],domNode:O.current.closest(".react-flow")}),()=>{var K;(K=P.current)==null||K.destroy()}}},[]),N.useEffect(()=>{var j;(j=P.current)==null||j.update({onPaneContextMenu:t,zoomOnScroll:e,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:a,panOnScrollMode:i,zoomOnDoubleClick:o,panOnDrag:s,zoomActivationKeyPressed:F,preventScrolling:h,noPanClassName:v,userSelectionActive:x,noWheelClassName:b,lib:D,onTransformChange:q,connectionInProgress:M})},[t,e,n,r,a,i,o,s,F,h,v,x,b,D,q,M]),A.jsx("div",{className:"react-flow__renderer",ref:O,style:GA,children:E})}const OHe=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function IHe(){const{userSelectionActive:t,userSelectionRect:e}=mn(OHe,Nr);return t&&e?A.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}const aB=(t,e)=>n=>{n.target===e.current&&(t==null||t(n))},DHe=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,connectionInProgress:t.connection.inProgress,dragging:t.paneDragging});function kHe({isSelecting:t,selectionKeyPressed:e,selectionMode:n=CE.Full,panOnDrag:r,selectionOnDrag:a,onSelectionStart:i,onSelectionEnd:o,onPaneClick:s,onPaneContextMenu:l,onPaneScroll:u,onPaneMouseEnter:d,onPaneMouseMove:f,onPaneMouseLeave:m,children:h}){const E=Er(),{userSelectionActive:b,elementsSelectable:v,dragging:y,connectionInProgress:C}=mn(DHe,Nr),T=v&&(t||b),w=N.useRef(null),O=N.useRef(),x=N.useRef(new Set),D=N.useRef(new Set),M=N.useRef(!1),F=N.useRef(!1),P=Y=>{if(M.current||C){M.current=!1;return}s==null||s(Y),E.getState().resetSelectedElements(),E.setState({nodesSelectionActive:!1})},q=Y=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){Y.preventDefault();return}l==null||l(Y)},j=u?Y=>u(Y):void 0,Q=Y=>{var te,B;const{resetSelectedElements:W,domNode:J}=E.getState();if(O.current=J==null?void 0:J.getBoundingClientRect(),!v||!t||Y.button!==0||Y.target!==w.current||!O.current)return;(B=(te=Y.target)==null?void 0:te.setPointerCapture)==null||B.call(te,Y.pointerId),F.current=!0,M.current=!1;const{x:$,y:Z}=Ws(Y.nativeEvent,O.current);W(),E.setState({userSelectionRect:{width:0,height:0,startX:$,startY:Z,x:$,y:Z}}),i==null||i(Y)},U=Y=>{const{userSelectionRect:W,transform:J,nodeLookup:$,edgeLookup:Z,connectionLookup:te,triggerNodeChanges:B,triggerEdgeChanges:ae,defaultEdgeOptions:se}=E.getState();if(!O.current||!W)return;M.current=!0;const{x:de,y:ie}=Ws(Y.nativeEvent,O.current),{startX:ce,startY:me}=W,be={startX:ce,startY:me,x:de<ce?de:ce,y:ie<me?ie:me,width:Math.abs(de-ce),height:Math.abs(ie-me)},Ae=x.current,we=D.current;x.current=new Set(G5($,be,J,n===CE.Partial,!0).map(De=>De.id)),D.current=new Set;const Te=(se==null?void 0:se.selectable)??!0;for(const De of x.current){const We=te.get(De);if(We)for(const{edgeId:Ye}of We.values()){const Tt=Z.get(Ye);Tt&&(Tt.selectable??Te)&&D.current.add(Ye)}}if(!yse(Ae,x.current)){const De=Ag($,x.current,!0);B(De)}if(!yse(we,D.current)){const De=Ag(Z,D.current);ae(De)}E.setState({userSelectionRect:be,userSelectionActive:!0,nodesSelectionActive:!1})},K=Y=>{var J,$;if(Y.button!==0||!F.current)return;($=(J=Y.target)==null?void 0:J.releasePointerCapture)==null||$.call(J,Y.pointerId);const{userSelectionRect:W}=E.getState();!b&&W&&Y.target===w.current&&(P==null||P(Y)),E.setState({userSelectionActive:!1,userSelectionRect:null,nodesSelectionActive:x.current.size>0}),o==null||o(Y),(e||a)&&(M.current=!1),F.current=!1},G=r===!0||Array.isArray(r)&&r.includes(0);return A.jsxs("div",{className:ra(["react-flow__pane",{draggable:G,dragging:y,selection:t}]),onClick:T?void 0:aB(P,w),onContextMenu:aB(q,w),onWheel:aB(j,w),onPointerEnter:T?void 0:d,onPointerDown:T?Q:f,onPointerMove:T?U:f,onPointerUp:T?K:void 0,onPointerLeave:m,ref:w,style:GA,children:[h,A.jsx(IHe,{})]})}function iB({id:t,store:e,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:a,unselectNodesAndEdges:i,multiSelectionActive:o,nodeLookup:s,onError:l}=e.getState(),u=s.get(t);if(!u){l==null||l("012",Gl.error012(t));return}e.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&o)&&(i({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var d;return(d=r==null?void 0:r.current)==null?void 0:d.blur()})):a([t])}function Tle({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:r,nodeId:a,isSelectable:i,nodeClickDistance:o}){const s=Er(),[l,u]=N.useState(!1),d=N.useRef();return N.useEffect(()=>{d.current=vqe({getStoreItems:()=>s.getState(),onNodeMouseDown:f=>{iB({id:f,store:s,nodeRef:t})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),N.useEffect(()=>{var f,m;if(e)(f=d.current)==null||f.destroy();else if(t.current)return(m=d.current)==null||m.update({noDragClassName:n,handleSelector:r,domNode:t.current,isSelectable:i,nodeId:a,nodeClickDistance:o}),()=>{var h;(h=d.current)==null||h.destroy()}},[n,r,e,i,t,a]),l}const MHe=t=>e=>e.selected&&(e.draggable||t&&typeof e.draggable>"u");function Cle(){const t=Er();return N.useCallback(n=>{const{nodeExtent:r,snapToGrid:a,snapGrid:i,nodesDraggable:o,onError:s,updateNodePositions:l,nodeLookup:u,nodeOrigin:d}=t.getState(),f=new Map,m=MHe(o),h=a?i[0]:5,E=a?i[1]:5,b=n.direction.x*h*n.factor,v=n.direction.y*E*n.factor;for(const[,y]of u){if(!m(y))continue;let C={x:y.internals.positionAbsolute.x+b,y:y.internals.positionAbsolute.y+v};a&&(C=xE(C,i));const{position:T,positionAbsolute:w}=mse({nodeId:y.id,nextPosition:C,nodeLookup:u,nodeExtent:r,nodeOrigin:d,onError:s});y.position=T,y.internals.positionAbsolute=w,f.set(y.id,y)}l(f)},[])}const oB=N.createContext(null),LHe=oB.Provider;oB.Consumer;const Ale=()=>N.useContext(oB),PHe=t=>({connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName,rfId:t.rfId}),FHe=(t,e,n)=>r=>{const{connectionClickStartHandle:a,connectionMode:i,connection:o}=r,{fromHandle:s,toHandle:l,isValid:u}=o,d=(l==null?void 0:l.nodeId)===t&&(l==null?void 0:l.id)===e&&(l==null?void 0:l.type)===n;return{connectingFrom:(s==null?void 0:s.nodeId)===t&&(s==null?void 0:s.id)===e&&(s==null?void 0:s.type)===n,connectingTo:d,clickConnecting:(a==null?void 0:a.nodeId)===t&&(a==null?void 0:a.id)===e&&(a==null?void 0:a.type)===n,isPossibleEndHandle:i===_g.Strict?(s==null?void 0:s.type)!==n:t!==(s==null?void 0:s.nodeId)||e!==(s==null?void 0:s.id),connectionInProcess:!!s,clickConnectionInProcess:!!a,valid:d&&u}};function BHe({type:t="source",position:e=vt.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:a=!0,isConnectableEnd:i=!0,id:o,onConnect:s,children:l,className:u,onMouseDown:d,onTouchStart:f,...m},h){var K,G;const E=o||null,b=t==="target",v=Er(),y=Ale(),{connectOnClick:C,noPanClassName:T,rfId:w}=mn(PHe,Nr),{connectingFrom:O,connectingTo:x,clickConnecting:D,isPossibleEndHandle:M,connectionInProcess:F,clickConnectionInProcess:P,valid:q}=mn(FHe(y,E,t),Nr);y||(G=(K=v.getState()).onError)==null||G.call(K,"010",Gl.error010());const j=Y=>{const{defaultEdgeOptions:W,onConnect:J,hasDefaultEdges:$}=v.getState(),Z={...W,...Y};if($){const{edges:te,setEdges:B}=v.getState();B(Ise(Z,te))}J==null||J(Z),s==null||s(Z)},Q=Y=>{if(!y)return;const W=Ase(Y.nativeEvent);if(a&&(W&&Y.button===0||!W)){const J=v.getState();Z5.onPointerDown(Y.nativeEvent,{handleDomNode:Y.currentTarget,autoPanOnConnect:J.autoPanOnConnect,connectionMode:J.connectionMode,connectionRadius:J.connectionRadius,domNode:J.domNode,nodeLookup:J.nodeLookup,lib:J.lib,isTarget:b,handleId:E,nodeId:y,flowId:J.rfId,panBy:J.panBy,cancelConnection:J.cancelConnection,onConnectStart:J.onConnectStart,onConnectEnd:J.onConnectEnd,updateConnection:J.updateConnection,onConnect:j,isValidConnection:n||J.isValidConnection,getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:J.autoPanSpeed,dragThreshold:J.connectionDragThreshold})}W?d==null||d(Y):f==null||f(Y)},U=Y=>{const{onClickConnectStart:W,onClickConnectEnd:J,connectionClickStartHandle:$,connectionMode:Z,isValidConnection:te,lib:B,rfId:ae,nodeLookup:se,connection:de}=v.getState();if(!y||!$&&!a)return;if(!$){W==null||W(Y.nativeEvent,{nodeId:y,handleId:E,handleType:t}),v.setState({connectionClickStartHandle:{nodeId:y,type:t,id:E}});return}const ie=Tse(Y.target),ce=n||te,{connection:me,isValid:be}=Z5.isValid(Y.nativeEvent,{handle:{nodeId:y,id:E,type:t},connectionMode:Z,fromNodeId:$.nodeId,fromHandleId:$.id||null,fromType:$.type,isValidConnection:ce,flowId:ae,doc:ie,lib:B,nodeLookup:se});be&&me&&j(me);const Ae=structuredClone(de);delete Ae.inProgress,Ae.toPosition=Ae.toHandle?Ae.toHandle.position:null,J==null||J(Y,Ae),v.setState({connectionClickStartHandle:null})};return A.jsx("div",{"data-handleid":E,"data-nodeid":y,"data-handlepos":e,"data-id":`${w}-${y}-${E}-${t}`,className:ra(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",T,u,{source:!b,target:b,connectable:r,connectablestart:a,connectableend:i,clickconnecting:D,connectingfrom:O,connectingto:x,valid:q,connectionindicator:r&&(!F||M)&&(F||P?i:a)}]),onMouseDown:Q,onTouchStart:Q,onClick:C?U:void 0,ref:h,...m,children:l})}const zl=N.memo(Ele(BHe));function UHe({data:t,isConnectable:e,sourcePosition:n=vt.Bottom}){return A.jsxs(A.Fragment,{children:[t==null?void 0:t.label,A.jsx(zl,{type:"source",position:n,isConnectable:e})]})}function GHe({data:t,isConnectable:e,targetPosition:n=vt.Top,sourcePosition:r=vt.Bottom}){return A.jsxs(A.Fragment,{children:[A.jsx(zl,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label,A.jsx(zl,{type:"source",position:r,isConnectable:e})]})}function zHe(){return null}function qHe({data:t,isConnectable:e,targetPosition:n=vt.Top}){return A.jsxs(A.Fragment,{children:[A.jsx(zl,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label]})}const zA={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Rle={input:UHe,default:GHe,output:qHe,group:zHe};function HHe(t){var e,n,r,a;return t.internals.handleBounds===void 0?{width:t.width??t.initialWidth??((e=t.style)==null?void 0:e.width),height:t.height??t.initialHeight??((n=t.style)==null?void 0:n.height)}:{width:t.width??((r=t.style)==null?void 0:r.width),height:t.height??((a=t.style)==null?void 0:a.height)}}const $He=t=>{const{width:e,height:n,x:r,y:a}=RE(t.nodeLookup,{filter:i=>!!i.selected});return{width:js(e)?e:null,height:js(n)?n:null,userSelectionActive:t.userSelectionActive,transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]}) translate(${r}px,${a}px)`}};function YHe({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const r=Er(),{width:a,height:i,transformString:o,userSelectionActive:s}=mn($He,Nr),l=Cle(),u=N.useRef(null);if(N.useEffect(()=>{var m;n||(m=u.current)==null||m.focus({preventScroll:!0})},[n]),Tle({nodeRef:u}),s||!a||!i)return null;const d=t?m=>{const h=r.getState().nodes.filter(E=>E.selected);t(m,h)}:void 0,f=m=>{Object.prototype.hasOwnProperty.call(zA,m.key)&&(m.preventDefault(),l({direction:zA[m.key],factor:m.shiftKey?4:1}))};return A.jsx("div",{className:ra(["react-flow__nodesselection","react-flow__container",e]),style:{transform:o},children:A.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:f,style:{width:a,height:i}})})}const wle=typeof window<"u"?window:void 0,VHe=t=>({nodesSelectionActive:t.nodesSelectionActive,userSelectionActive:t.userSelectionActive});function xle({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:a,onPaneContextMenu:i,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:l,selectionKeyCode:u,selectionOnDrag:d,selectionMode:f,onSelectionStart:m,onSelectionEnd:h,multiSelectionKeyCode:E,panActivationKeyCode:b,zoomActivationKeyCode:v,elementsSelectable:y,zoomOnScroll:C,zoomOnPinch:T,panOnScroll:w,panOnScrollSpeed:O,panOnScrollMode:x,zoomOnDoubleClick:D,panOnDrag:M,defaultViewport:F,translateExtent:P,minZoom:q,maxZoom:j,preventScrolling:Q,onSelectionContextMenu:U,noWheelClassName:K,noPanClassName:G,disableKeyboardA11y:Y,onViewportChange:W,isControlledViewport:J}){const{nodesSelectionActive:$,userSelectionActive:Z}=mn(VHe),te=kE(u,{target:wle}),B=kE(b,{target:wle}),ae=B||M,se=B||w,de=d&&ae!==!0,ie=te||Z||de;return RHe({deleteKeyCode:l,multiSelectionKeyCode:E}),A.jsx(NHe,{onPaneContextMenu:i,elementsSelectable:y,zoomOnScroll:C,zoomOnPinch:T,panOnScroll:se,panOnScrollSpeed:O,panOnScrollMode:x,zoomOnDoubleClick:D,panOnDrag:!te&&ae,defaultViewport:F,translateExtent:P,minZoom:q,maxZoom:j,zoomActivationKeyCode:v,preventScrolling:Q,noWheelClassName:K,noPanClassName:G,onViewportChange:W,isControlledViewport:J,paneClickDistance:s,children:A.jsxs(kHe,{onSelectionStart:m,onSelectionEnd:h,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:a,onPaneContextMenu:i,onPaneScroll:o,panOnDrag:ae,isSelecting:!!ie,selectionMode:f,selectionKeyPressed:te,selectionOnDrag:de,children:[t,$&&A.jsx(YHe,{onSelectionContextMenu:U,noPanClassName:G,disableKeyboardA11y:Y})]})})}xle.displayName="FlowRenderer";const jHe=N.memo(xle),WHe=t=>e=>t?G5(e.nodeLookup,{x:0,y:0,width:e.width,height:e.height},e.transform,!0).map(n=>n.id):Array.from(e.nodeLookup.keys());function KHe(t){return mn(N.useCallback(WHe(t),[t]),Nr)}const XHe=t=>t.updateNodeInternals;function QHe(){const t=mn(XHe),[e]=N.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(a=>{const i=a.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:a.target,force:!0})}),t(r)}));return N.useEffect(()=>()=>{e==null||e.disconnect()},[e]),e}function ZHe({node:t,nodeType:e,hasDimensions:n,resizeObserver:r}){const a=Er(),i=N.useRef(null),o=N.useRef(null),s=N.useRef(t.sourcePosition),l=N.useRef(t.targetPosition),u=N.useRef(e),d=n&&!!t.internals.handleBounds;return N.useEffect(()=>{i.current&&!t.hidden&&(!d||o.current!==i.current)&&(o.current&&(r==null||r.unobserve(o.current)),r==null||r.observe(i.current),o.current=i.current)},[d,t.hidden]),N.useEffect(()=>()=>{o.current&&(r==null||r.unobserve(o.current),o.current=null)},[]),N.useEffect(()=>{if(i.current){const f=u.current!==e,m=s.current!==t.sourcePosition,h=l.current!==t.targetPosition;(f||m||h)&&(u.current=e,s.current=t.sourcePosition,l.current=t.targetPosition,a.getState().updateNodeInternals(new Map([[t.id,{id:t.id,nodeElement:i.current,force:!0}]])))}},[t.id,e,t.sourcePosition,t.targetPosition]),i}function JHe({id:t,onClick:e,onMouseEnter:n,onMouseMove:r,onMouseLeave:a,onContextMenu:i,onDoubleClick:o,nodesDraggable:s,elementsSelectable:l,nodesConnectable:u,nodesFocusable:d,resizeObserver:f,noDragClassName:m,noPanClassName:h,disableKeyboardA11y:E,rfId:b,nodeTypes:v,nodeClickDistance:y,onError:C}){const{node:T,internals:w,isParent:O}=mn(ce=>{const me=ce.nodeLookup.get(t),be=ce.parentLookup.has(t);return{node:me,internals:me.internals,isParent:be}},Nr);let x=T.type||"default",D=(v==null?void 0:v[x])||Rle[x];D===void 0&&(C==null||C("003",Gl.error003(x)),x="default",D=(v==null?void 0:v.default)||Rle.default);const M=!!(T.draggable||s&&typeof T.draggable>"u"),F=!!(T.selectable||l&&typeof T.selectable>"u"),P=!!(T.connectable||u&&typeof T.connectable>"u"),q=!!(T.focusable||d&&typeof T.focusable>"u"),j=Er(),Q=Sse(T),U=ZHe({node:T,nodeType:x,hasDimensions:Q,resizeObserver:f}),K=Tle({nodeRef:U,disabled:T.hidden||!M,noDragClassName:m,handleSelector:T.dragHandle,nodeId:t,isSelectable:F,nodeClickDistance:y}),G=Cle();if(T.hidden)return null;const Y=qc(T),W=HHe(T),J=F||M||e||n||r||a,$=n?ce=>n(ce,{...w.userNode}):void 0,Z=r?ce=>r(ce,{...w.userNode}):void 0,te=a?ce=>a(ce,{...w.userNode}):void 0,B=i?ce=>i(ce,{...w.userNode}):void 0,ae=o?ce=>o(ce,{...w.userNode}):void 0,se=ce=>{const{selectNodesOnDrag:me,nodeDragThreshold:be}=j.getState();F&&(!me||!M||be>0)&&iB({id:t,store:j,nodeRef:U}),e&&e(ce,{...w.userNode})},de=ce=>{if(!(Cse(ce.nativeEvent)||E)){if(lse.includes(ce.key)&&F){const me=ce.key==="Escape";iB({id:t,store:j,unselect:me,nodeRef:U})}else if(M&&T.selected&&Object.prototype.hasOwnProperty.call(zA,ce.key)){ce.preventDefault();const{ariaLabelConfig:me}=j.getState();j.setState({ariaLiveMessage:me["node.a11yDescription.ariaLiveMessage"]({direction:ce.key.replace("Arrow","").toLowerCase(),x:~~w.positionAbsolute.x,y:~~w.positionAbsolute.y})}),G({direction:zA[ce.key],factor:ce.shiftKey?4:1})}}},ie=()=>{var De;if(E||!((De=U.current)!=null&&De.matches(":focus-visible")))return;const{transform:ce,width:me,height:be,autoPanOnNodeFocus:Ae,setCenter:we}=j.getState();if(!Ae)return;G5(new Map([[t,T]]),{x:0,y:0,width:me,height:be},ce,!0).length>0||we(T.position.x+Y.width/2,T.position.y+Y.height/2,{zoom:ce[2]})};return A.jsx("div",{className:ra(["react-flow__node",`react-flow__node-${x}`,{[h]:M},T.className,{selected:T.selected,selectable:F,parent:O,draggable:M,dragging:K}]),ref:U,style:{zIndex:w.z,transform:`translate(${w.positionAbsolute.x}px,${w.positionAbsolute.y}px)`,pointerEvents:J?"all":"none",visibility:Q?"visible":"hidden",...T.style,...W},"data-id":t,"data-testid":`rf__node-${t}`,onMouseEnter:$,onMouseMove:Z,onMouseLeave:te,onContextMenu:B,onClick:se,onDoubleClick:ae,onKeyDown:q?de:void 0,tabIndex:q?0:void 0,onFocus:q?ie:void 0,role:T.ariaRole??(q?"group":void 0),"aria-roledescription":"node","aria-describedby":E?void 0:`${ale}-${b}`,"aria-label":T.ariaLabel,...T.domAttributes,children:A.jsx(LHe,{value:t,children:A.jsx(D,{id:t,data:T.data,type:x,positionAbsoluteX:w.positionAbsolute.x,positionAbsoluteY:w.positionAbsolute.y,selected:T.selected??!1,selectable:F,draggable:M,deletable:T.deletable??!0,isConnectable:P,sourcePosition:T.sourcePosition,targetPosition:T.targetPosition,dragging:K,dragHandle:T.dragHandle,zIndex:w.z,parentId:T.parentId,...Y})})})}const e$e=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,onError:t.onError});function Nle(t){const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:r,elementsSelectable:a,onError:i}=mn(e$e,Nr),o=KHe(t.onlyRenderVisibleElements),s=QHe();return A.jsx("div",{className:"react-flow__nodes",style:GA,children:o.map(l=>A.jsx(JHe,{id:l,nodeTypes:t.nodeTypes,nodeExtent:t.nodeExtent,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,resizeObserver:s,nodesDraggable:e,nodesConnectable:n,nodesFocusable:r,elementsSelectable:a,nodeClickDistance:t.nodeClickDistance,onError:i},l))})}Nle.displayName="NodeRenderer";const t$e=N.memo(Nle);function n$e(t){return mn(N.useCallback(n=>{if(!t)return n.edges.map(a=>a.id);const r=[];if(n.width&&n.height)for(const a of n.edges){const i=n.nodeLookup.get(a.source),o=n.nodeLookup.get(a.target);i&&o&&aqe({sourceNode:i,targetNode:o,width:n.width,height:n.height,transform:n.transform})&&r.push(a.id)}return r},[t]),Nr)}const r$e=({color:t="none",strokeWidth:e=1})=>{const n={strokeWidth:e,...t&&{stroke:t}};return A.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},a$e=({color:t="none",strokeWidth:e=1})=>{const n={strokeWidth:e,...t&&{stroke:t,fill:t}};return A.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Ole={[bg.Arrow]:r$e,[bg.ArrowClosed]:a$e};function i$e(t){const e=Er();return N.useMemo(()=>{var a,i;return Object.prototype.hasOwnProperty.call(Ole,t)?Ole[t]:((i=(a=e.getState()).onError)==null||i.call(a,"009",Gl.error009(t)),null)},[t])}const o$e=({id:t,type:e,color:n,width:r=12.5,height:a=12.5,markerUnits:i="strokeWidth",strokeWidth:o,orient:s="auto-start-reverse"})=>{const l=i$e(e);return l?A.jsx("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${r}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:s,refX:"0",refY:"0",children:A.jsx(l,{color:n,strokeWidth:o})}):null},Ile=({defaultColor:t,rfId:e})=>{const n=mn(i=>i.edges),r=mn(i=>i.defaultEdgeOptions),a=N.useMemo(()=>dqe(n,{id:e,defaultColor:t,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,e,t]);return a.length?A.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:A.jsx("defs",{children:a.map(i=>A.jsx(o$e,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};Ile.displayName="MarkerDefinitions";var s$e=N.memo(Ile);function Dle({x:t,y:e,label:n,labelStyle:r,labelShowBg:a=!0,labelBgStyle:i,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:l,className:u,...d}){const[f,m]=N.useState({x:1,y:0,width:0,height:0}),h=ra(["react-flow__edge-textwrapper",u]),E=N.useRef(null);return N.useEffect(()=>{if(E.current){const b=E.current.getBBox();m({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),n?A.jsxs("g",{transform:`translate(${t-f.width/2} ${e-f.height/2})`,className:h,visibility:f.width?"visible":"hidden",...d,children:[a&&A.jsx("rect",{width:f.width+2*o[0],x:-o[0],y:-o[1],height:f.height+2*o[1],className:"react-flow__edge-textbg",style:i,rx:s,ry:s}),A.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:E,style:r,children:n}),l]}):null}Dle.displayName="EdgeText";const l$e=N.memo(Dle);function qA({path:t,labelX:e,labelY:n,label:r,labelStyle:a,labelShowBg:i,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:l,interactionWidth:u=20,...d}){return A.jsxs(A.Fragment,{children:[A.jsx("path",{...d,d:t,fill:"none",className:ra(["react-flow__edge-path",d.className])}),u?A.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&js(e)&&js(n)?A.jsx(l$e,{x:e,y:n,label:r,labelStyle:a,labelShowBg:i,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:l}):null]})}function kle({pos:t,x1:e,y1:n,x2:r,y2:a}){return t===vt.Left||t===vt.Right?[.5*(e+r),n]:[e,.5*(n+a)]}function Mle({sourceX:t,sourceY:e,sourcePosition:n=vt.Bottom,targetX:r,targetY:a,targetPosition:i=vt.Top}){const[o,s]=kle({pos:n,x1:t,y1:e,x2:r,y2:a}),[l,u]=kle({pos:i,x1:r,y1:a,x2:t,y2:e}),[d,f,m,h]=wse({sourceX:t,sourceY:e,targetX:r,targetY:a,sourceControlX:o,sourceControlY:s,targetControlX:l,targetControlY:u});return[`M${t},${e} C${o},${s} ${l},${u} ${r},${a}`,d,f,m,h]}function Lle(t){return N.memo(({id:e,sourceX:n,sourceY:r,targetX:a,targetY:i,sourcePosition:o,targetPosition:s,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:m,labelBgBorderRadius:h,style:E,markerEnd:b,markerStart:v,interactionWidth:y})=>{const[C,T,w]=Mle({sourceX:n,sourceY:r,sourcePosition:o,targetX:a,targetY:i,targetPosition:s}),O=t.isInternal?void 0:e;return A.jsx(qA,{id:O,path:C,labelX:T,labelY:w,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:m,labelBgBorderRadius:h,style:E,markerEnd:b,markerStart:v,interactionWidth:y})})}const c$e=Lle({isInternal:!1}),Ple=Lle({isInternal:!0});c$e.displayName="SimpleBezierEdge",Ple.displayName="SimpleBezierEdgeInternal";function Fle(t){return N.memo(({id:e,sourceX:n,sourceY:r,targetX:a,targetY:i,label:o,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:m,sourcePosition:h=vt.Bottom,targetPosition:E=vt.Top,markerEnd:b,markerStart:v,pathOptions:y,interactionWidth:C})=>{const[T,w,O]=$5({sourceX:n,sourceY:r,sourcePosition:h,targetX:a,targetY:i,targetPosition:E,borderRadius:y==null?void 0:y.borderRadius,offset:y==null?void 0:y.offset,stepPosition:y==null?void 0:y.stepPosition}),x=t.isInternal?void 0:e;return A.jsx(qA,{id:x,path:T,labelX:w,labelY:O,label:o,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:m,markerEnd:b,markerStart:v,interactionWidth:C})})}const Ble=Fle({isInternal:!1}),Ule=Fle({isInternal:!0});Ble.displayName="SmoothStepEdge",Ule.displayName="SmoothStepEdgeInternal";function Gle(t){return N.memo(({id:e,...n})=>{var a;const r=t.isInternal?void 0:e;return A.jsx(Ble,{...n,id:r,pathOptions:N.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(a=n.pathOptions)==null?void 0:a.offset])})})}const u$e=Gle({isInternal:!1}),zle=Gle({isInternal:!0});u$e.displayName="StepEdge",zle.displayName="StepEdgeInternal";function qle(t){return N.memo(({id:e,sourceX:n,sourceY:r,targetX:a,targetY:i,label:o,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:m,markerEnd:h,markerStart:E,interactionWidth:b})=>{const[v,y,C]=Dse({sourceX:n,sourceY:r,targetX:a,targetY:i}),T=t.isInternal?void 0:e;return A.jsx(qA,{id:T,path:v,labelX:y,labelY:C,label:o,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:m,markerEnd:h,markerStart:E,interactionWidth:b})})}const d$e=qle({isInternal:!1}),Hle=qle({isInternal:!0});d$e.displayName="StraightEdge",Hle.displayName="StraightEdgeInternal";function $le(t){return N.memo(({id:e,sourceX:n,sourceY:r,targetX:a,targetY:i,sourcePosition:o=vt.Bottom,targetPosition:s=vt.Top,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:m,labelBgBorderRadius:h,style:E,markerEnd:b,markerStart:v,pathOptions:y,interactionWidth:C})=>{const[T,w,O]=Nse({sourceX:n,sourceY:r,sourcePosition:o,targetX:a,targetY:i,targetPosition:s,curvature:y==null?void 0:y.curvature}),x=t.isInternal?void 0:e;return A.jsx(qA,{id:x,path:T,labelX:w,labelY:O,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:m,labelBgBorderRadius:h,style:E,markerEnd:b,markerStart:v,interactionWidth:C})})}const p$e=$le({isInternal:!1}),Yle=$le({isInternal:!0});p$e.displayName="BezierEdge",Yle.displayName="BezierEdgeInternal";const Vle={default:Yle,straight:Hle,step:zle,smoothstep:Ule,simplebezier:Ple},jle={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},f$e=(t,e,n)=>n===vt.Left?t-e:n===vt.Right?t+e:t,m$e=(t,e,n)=>n===vt.Top?t-e:n===vt.Bottom?t+e:t,Wle="react-flow__edgeupdater";function Kle({position:t,centerX:e,centerY:n,radius:r=10,onMouseDown:a,onMouseEnter:i,onMouseOut:o,type:s}){return A.jsx("circle",{onMouseDown:a,onMouseEnter:i,onMouseOut:o,className:ra([Wle,`${Wle}-${s}`]),cx:f$e(e,r,t),cy:m$e(n,r,t),r,stroke:"transparent",fill:"transparent"})}function h$e({isReconnectable:t,reconnectRadius:e,edge:n,sourceX:r,sourceY:a,targetX:i,targetY:o,sourcePosition:s,targetPosition:l,onReconnect:u,onReconnectStart:d,onReconnectEnd:f,setReconnecting:m,setUpdateHover:h}){const E=Er(),b=(w,O)=>{if(w.button!==0)return;const{autoPanOnConnect:x,domNode:D,isValidConnection:M,connectionMode:F,connectionRadius:P,lib:q,onConnectStart:j,onConnectEnd:Q,cancelConnection:U,nodeLookup:K,rfId:G,panBy:Y,updateConnection:W}=E.getState(),J=O.type==="target",$=(B,ae)=>{m(!1),f==null||f(B,n,O.type,ae)},Z=B=>u==null?void 0:u(n,B),te=(B,ae)=>{m(!0),d==null||d(w,n,O.type),j==null||j(B,ae)};Z5.onPointerDown(w.nativeEvent,{autoPanOnConnect:x,connectionMode:F,connectionRadius:P,domNode:D,handleId:O.id,nodeId:O.nodeId,nodeLookup:K,isTarget:J,edgeUpdaterType:O.type,lib:q,flowId:G,cancelConnection:U,panBy:Y,isValidConnection:M,onConnect:Z,onConnectStart:te,onConnectEnd:Q,onReconnectEnd:$,updateConnection:W,getTransform:()=>E.getState().transform,getFromHandle:()=>E.getState().connection.fromHandle,dragThreshold:E.getState().connectionDragThreshold,handleDomNode:w.currentTarget})},v=w=>b(w,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),y=w=>b(w,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),C=()=>h(!0),T=()=>h(!1);return A.jsxs(A.Fragment,{children:[(t===!0||t==="source")&&A.jsx(Kle,{position:s,centerX:r,centerY:a,radius:e,onMouseDown:v,onMouseEnter:C,onMouseOut:T,type:"source"}),(t===!0||t==="target")&&A.jsx(Kle,{position:l,centerX:i,centerY:o,radius:e,onMouseDown:y,onMouseEnter:C,onMouseOut:T,type:"target"})]})}function g$e({id:t,edgesFocusable:e,edgesReconnectable:n,elementsSelectable:r,onClick:a,onDoubleClick:i,onContextMenu:o,onMouseEnter:s,onMouseMove:l,onMouseLeave:u,reconnectRadius:d,onReconnect:f,onReconnectStart:m,onReconnectEnd:h,rfId:E,edgeTypes:b,noPanClassName:v,onError:y,disableKeyboardA11y:C}){let T=mn(we=>we.edgeLookup.get(t));const w=mn(we=>we.defaultEdgeOptions);T=w?{...w,...T}:T;let O=T.type||"default",x=(b==null?void 0:b[O])||Vle[O];x===void 0&&(y==null||y("011",Gl.error011(O)),O="default",x=(b==null?void 0:b.default)||Vle.default);const D=!!(T.focusable||e&&typeof T.focusable>"u"),M=typeof f<"u"&&(T.reconnectable||n&&typeof T.reconnectable>"u"),F=!!(T.selectable||r&&typeof T.selectable>"u"),P=N.useRef(null),[q,j]=N.useState(!1),[Q,U]=N.useState(!1),K=Er(),{zIndex:G,sourceX:Y,sourceY:W,targetX:J,targetY:$,sourcePosition:Z,targetPosition:te}=mn(N.useCallback(we=>{const Te=we.nodeLookup.get(T.source),De=we.nodeLookup.get(T.target);if(!Te||!De)return{zIndex:T.zIndex,...jle};const We=uqe({id:t,sourceNode:Te,targetNode:De,sourceHandle:T.sourceHandle||null,targetHandle:T.targetHandle||null,connectionMode:we.connectionMode,onError:y});return{zIndex:rqe({selected:T.selected,zIndex:T.zIndex,sourceNode:Te,targetNode:De,elevateOnSelect:we.elevateEdgesOnSelect}),...We||jle}},[T.source,T.target,T.sourceHandle,T.targetHandle,T.selected,T.zIndex]),Nr),B=N.useMemo(()=>T.markerStart?`url('#${Y5(T.markerStart,E)}')`:void 0,[T.markerStart,E]),ae=N.useMemo(()=>T.markerEnd?`url('#${Y5(T.markerEnd,E)}')`:void 0,[T.markerEnd,E]);if(T.hidden||Y===null||W===null||J===null||$===null)return null;const se=we=>{var Ye;const{addSelectedEdges:Te,unselectNodesAndEdges:De,multiSelectionActive:We}=K.getState();F&&(K.setState({nodesSelectionActive:!1}),T.selected&&We?(De({nodes:[],edges:[T]}),(Ye=P.current)==null||Ye.blur()):Te([t])),a&&a(we,T)},de=i?we=>{i(we,{...T})}:void 0,ie=o?we=>{o(we,{...T})}:void 0,ce=s?we=>{s(we,{...T})}:void 0,me=l?we=>{l(we,{...T})}:void 0,be=u?we=>{u(we,{...T})}:void 0,Ae=we=>{var Te;if(!C&&lse.includes(we.key)&&F){const{unselectNodesAndEdges:De,addSelectedEdges:We}=K.getState();we.key==="Escape"?((Te=P.current)==null||Te.blur(),De({edges:[T]})):We([t])}};return A.jsx("svg",{style:{zIndex:G},children:A.jsxs("g",{className:ra(["react-flow__edge",`react-flow__edge-${O}`,T.className,v,{selected:T.selected,animated:T.animated,inactive:!F&&!a,updating:q,selectable:F}]),onClick:se,onDoubleClick:de,onContextMenu:ie,onMouseEnter:ce,onMouseMove:me,onMouseLeave:be,onKeyDown:D?Ae:void 0,tabIndex:D?0:void 0,role:T.ariaRole??(D?"group":"img"),"aria-roledescription":"edge","data-id":t,"data-testid":`rf__edge-${t}`,"aria-label":T.ariaLabel===null?void 0:T.ariaLabel||`Edge from ${T.source} to ${T.target}`,"aria-describedby":D?`${ile}-${E}`:void 0,ref:P,...T.domAttributes,children:[!Q&&A.jsx(x,{id:t,source:T.source,target:T.target,type:T.type,selected:T.selected,animated:T.animated,selectable:F,deletable:T.deletable??!0,label:T.label,labelStyle:T.labelStyle,labelShowBg:T.labelShowBg,labelBgStyle:T.labelBgStyle,labelBgPadding:T.labelBgPadding,labelBgBorderRadius:T.labelBgBorderRadius,sourceX:Y,sourceY:W,targetX:J,targetY:$,sourcePosition:Z,targetPosition:te,data:T.data,style:T.style,sourceHandleId:T.sourceHandle,targetHandleId:T.targetHandle,markerStart:B,markerEnd:ae,pathOptions:"pathOptions"in T?T.pathOptions:void 0,interactionWidth:T.interactionWidth}),M&&A.jsx(h$e,{edge:T,isReconnectable:M,reconnectRadius:d,onReconnect:f,onReconnectStart:m,onReconnectEnd:h,sourceX:Y,sourceY:W,targetX:J,targetY:$,sourcePosition:Z,targetPosition:te,setUpdateHover:j,setReconnecting:U})]})})}const _$e=t=>({edgesFocusable:t.edgesFocusable,edgesReconnectable:t.edgesReconnectable,elementsSelectable:t.elementsSelectable,connectionMode:t.connectionMode,onError:t.onError});function Xle({defaultMarkerColor:t,onlyRenderVisibleElements:e,rfId:n,edgeTypes:r,noPanClassName:a,onReconnect:i,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:l,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:f,onEdgeDoubleClick:m,onReconnectStart:h,onReconnectEnd:E,disableKeyboardA11y:b}){const{edgesFocusable:v,edgesReconnectable:y,elementsSelectable:C,onError:T}=mn(_$e,Nr),w=n$e(e);return A.jsxs("div",{className:"react-flow__edges",children:[A.jsx(s$e,{defaultColor:t,rfId:n}),w.map(O=>A.jsx(g$e,{id:O,edgesFocusable:v,edgesReconnectable:y,elementsSelectable:C,noPanClassName:a,onReconnect:i,onContextMenu:o,onMouseEnter:s,onMouseMove:l,onMouseLeave:u,onClick:d,reconnectRadius:f,onDoubleClick:m,onReconnectStart:h,onReconnectEnd:E,rfId:n,onError:T,edgeTypes:r,disableKeyboardA11y:b},O))]})}Xle.displayName="EdgeRenderer";const b$e=N.memo(Xle),E$e=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function S$e({children:t}){const e=mn(E$e);return A.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:e},children:t})}function v$e(t){const e=rB(),n=N.useRef(!1);N.useEffect(()=>{!n.current&&e.viewportInitialized&&t&&(setTimeout(()=>t(e),1),n.current=!0)},[t,e.viewportInitialized])}const y$e=t=>{var e;return(e=t.panZoom)==null?void 0:e.syncViewport};function T$e(t){const e=mn(y$e),n=Er();return N.useEffect(()=>{t&&(e==null||e(t),n.setState({transform:[t.x,t.y,t.zoom]}))},[t,e]),null}function C$e(t){return t.connection.inProgress?{...t.connection,to:NE(t.connection.to,t.transform)}:{...t.connection}}function A$e(t){return C$e}function R$e(t){const e=A$e();return mn(e,Nr)}const w$e=t=>({nodesConnectable:t.nodesConnectable,isValid:t.connection.isValid,inProgress:t.connection.inProgress,width:t.width,height:t.height});function x$e({containerStyle:t,style:e,type:n,component:r}){const{nodesConnectable:a,width:i,height:o,isValid:s,inProgress:l}=mn(w$e,Nr);return!(i&&a&&l)?null:A.jsx("svg",{style:t,width:i,height:o,className:"react-flow__connectionline react-flow__container",children:A.jsx("g",{className:ra(["react-flow__connection",pse(s)]),children:A.jsx(Qle,{style:e,type:n,CustomComponent:r,isValid:s})})})}const Qle=({style:t,type:e=Ad.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:a,from:i,fromNode:o,fromHandle:s,fromPosition:l,to:u,toNode:d,toHandle:f,toPosition:m}=R$e();if(!a)return;if(n)return A.jsx(n,{connectionLineType:e,connectionLineStyle:t,fromNode:o,fromHandle:s,fromX:i.x,fromY:i.y,toX:u.x,toY:u.y,fromPosition:l,toPosition:m,connectionStatus:pse(r),toNode:d,toHandle:f});let h="";const E={sourceX:i.x,sourceY:i.y,sourcePosition:l,targetX:u.x,targetY:u.y,targetPosition:m};switch(e){case Ad.Bezier:[h]=Nse(E);break;case Ad.SimpleBezier:[h]=Mle(E);break;case Ad.Step:[h]=$5({...E,borderRadius:0});break;case Ad.SmoothStep:[h]=$5(E);break;default:[h]=Dse(E)}return A.jsx("path",{d:h,fill:"none",className:"react-flow__connection-path",style:t})};Qle.displayName="ConnectionLine";const N$e={};function Zle(t=N$e){N.useRef(t),Er(),N.useEffect(()=>{},[t])}function O$e(){Er(),N.useRef(!1),N.useEffect(()=>{},[])}function Jle({nodeTypes:t,edgeTypes:e,onInit:n,onNodeClick:r,onEdgeClick:a,onNodeDoubleClick:i,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:l,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:f,onSelectionStart:m,onSelectionEnd:h,connectionLineType:E,connectionLineStyle:b,connectionLineComponent:v,connectionLineContainerStyle:y,selectionKeyCode:C,selectionOnDrag:T,selectionMode:w,multiSelectionKeyCode:O,panActivationKeyCode:x,zoomActivationKeyCode:D,deleteKeyCode:M,onlyRenderVisibleElements:F,elementsSelectable:P,defaultViewport:q,translateExtent:j,minZoom:Q,maxZoom:U,preventScrolling:K,defaultMarkerColor:G,zoomOnScroll:Y,zoomOnPinch:W,panOnScroll:J,panOnScrollSpeed:$,panOnScrollMode:Z,zoomOnDoubleClick:te,panOnDrag:B,onPaneClick:ae,onPaneMouseEnter:se,onPaneMouseMove:de,onPaneMouseLeave:ie,onPaneScroll:ce,onPaneContextMenu:me,paneClickDistance:be,nodeClickDistance:Ae,onEdgeContextMenu:we,onEdgeMouseEnter:Te,onEdgeMouseMove:De,onEdgeMouseLeave:We,reconnectRadius:Ye,onReconnect:Tt,onReconnectStart:_t,onReconnectEnd:Jt,noDragClassName:Ge,noWheelClassName:Ve,noPanClassName:Xe,disableKeyboardA11y:mt,nodeExtent:yt,rfId:Dt,viewport:ge,onViewportChange:xe}){return Zle(t),Zle(e),O$e(),v$e(n),T$e(ge),A.jsx(jHe,{onPaneClick:ae,onPaneMouseEnter:se,onPaneMouseMove:de,onPaneMouseLeave:ie,onPaneContextMenu:me,onPaneScroll:ce,paneClickDistance:be,deleteKeyCode:M,selectionKeyCode:C,selectionOnDrag:T,selectionMode:w,onSelectionStart:m,onSelectionEnd:h,multiSelectionKeyCode:O,panActivationKeyCode:x,zoomActivationKeyCode:D,elementsSelectable:P,zoomOnScroll:Y,zoomOnPinch:W,zoomOnDoubleClick:te,panOnScroll:J,panOnScrollSpeed:$,panOnScrollMode:Z,panOnDrag:B,defaultViewport:q,translateExtent:j,minZoom:Q,maxZoom:U,onSelectionContextMenu:f,preventScrolling:K,noDragClassName:Ge,noWheelClassName:Ve,noPanClassName:Xe,disableKeyboardA11y:mt,onViewportChange:xe,isControlledViewport:!!ge,children:A.jsxs(S$e,{children:[A.jsx(b$e,{edgeTypes:e,onEdgeClick:a,onEdgeDoubleClick:o,onReconnect:Tt,onReconnectStart:_t,onReconnectEnd:Jt,onlyRenderVisibleElements:F,onEdgeContextMenu:we,onEdgeMouseEnter:Te,onEdgeMouseMove:De,onEdgeMouseLeave:We,reconnectRadius:Ye,defaultMarkerColor:G,noPanClassName:Xe,disableKeyboardA11y:mt,rfId:Dt}),A.jsx(x$e,{style:b,type:E,component:v,containerStyle:y}),A.jsx("div",{className:"react-flow__edgelabel-renderer"}),A.jsx(t$e,{nodeTypes:t,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:s,onNodeMouseMove:l,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:Ae,onlyRenderVisibleElements:F,noPanClassName:Xe,noDragClassName:Ge,disableKeyboardA11y:mt,nodeExtent:yt,rfId:Dt}),A.jsx("div",{className:"react-flow__viewport-portal"})]})})}Jle.displayName="GraphView";const I$e=N.memo(Jle),ece=({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,width:a,height:i,fitView:o,fitViewOptions:s,minZoom:l=.5,maxZoom:u=2,nodeOrigin:d,nodeExtent:f}={})=>{const m=new Map,h=new Map,E=new Map,b=new Map,v=r??e??[],y=n??t??[],C=d??[0,0],T=f??TE;Gse(E,b,v);const w=W5(y,m,h,{nodeOrigin:C,nodeExtent:T,elevateNodesOnSelect:!1});let O=[0,0,1];if(o&&a&&i){const x=RE(m,{filter:P=>!!((P.width||P.initialWidth)&&(P.height||P.initialHeight))}),{x:D,y:M,zoom:F}=q5(x,a,i,l,u,(s==null?void 0:s.padding)??.1);O=[D,M,F]}return{rfId:"1",width:a??0,height:i??0,transform:O,nodes:y,nodesInitialized:w,nodeLookup:m,parentLookup:h,edges:v,edgeLookup:b,connectionLookup:E,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:l,maxZoom:u,translateExtent:TE,nodeExtent:T,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:_g.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:C,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...use},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Qze,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:cse}},D$e=({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,width:a,height:i,fitView:o,fitViewOptions:s,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f})=>Jqe((m,h)=>{async function E(){const{nodeLookup:b,panZoom:v,fitViewOptions:y,fitViewResolver:C,width:T,height:w,minZoom:O,maxZoom:x}=h();v&&(await Kze({nodes:b,width:T,height:w,panZoom:v,minZoom:O,maxZoom:x},y),C==null||C.resolve(!0),m({fitViewResolver:null}))}return{...ece({nodes:t,edges:e,width:a,height:i,fitView:o,fitViewOptions:s,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,defaultNodes:n,defaultEdges:r}),setNodes:b=>{const{nodeLookup:v,parentLookup:y,nodeOrigin:C,elevateNodesOnSelect:T,fitViewQueued:w}=h(),O=W5(b,v,y,{nodeOrigin:C,nodeExtent:f,elevateNodesOnSelect:T,checkEquality:!0});w&&O?(E(),m({nodes:b,nodesInitialized:O,fitViewQueued:!1,fitViewOptions:void 0})):m({nodes:b,nodesInitialized:O})},setEdges:b=>{const{connectionLookup:v,edgeLookup:y}=h();Gse(v,y,b),m({edges:b})},setDefaultNodesAndEdges:(b,v)=>{if(b){const{setNodes:y}=h();y(b),m({hasDefaultNodes:!0})}if(v){const{setEdges:y}=h();y(v),m({hasDefaultEdges:!0})}},updateNodeInternals:b=>{const{triggerNodeChanges:v,nodeLookup:y,parentLookup:C,domNode:T,nodeOrigin:w,nodeExtent:O,debug:x,fitViewQueued:D}=h(),{changes:M,updatedInternals:F}=_qe(b,y,C,T,w,O);F&&(fqe(y,C,{nodeOrigin:w,nodeExtent:O}),D?(E(),m({fitViewQueued:!1,fitViewOptions:void 0})):m({}),(M==null?void 0:M.length)>0&&(x&&console.log("React Flow: trigger node changes",M),v==null||v(M)))},updateNodePositions:(b,v=!1)=>{const y=[],C=[],{nodeLookup:T,triggerNodeChanges:w}=h();for(const[O,x]of b){const D=T.get(O),M=!!(D!=null&&D.expandParent&&(D!=null&&D.parentId)&&(x!=null&&x.position)),F={id:O,type:"position",position:M?{x:Math.max(0,x.position.x),y:Math.max(0,x.position.y)}:x.position,dragging:v};M&&D.parentId&&y.push({id:O,parentId:D.parentId,rect:{...x.internals.positionAbsolute,width:x.measured.width??0,height:x.measured.height??0}}),C.push(F)}if(y.length>0){const{parentLookup:O,nodeOrigin:x}=h(),D=X5(y,T,O,x);C.push(...D)}w(C)},triggerNodeChanges:b=>{const{onNodesChange:v,setNodes:y,nodes:C,hasDefaultNodes:T,debug:w}=h();if(b!=null&&b.length){if(T){const O=mle(b,C);y(O)}w&&console.log("React Flow: trigger node changes",b),v==null||v(b)}},triggerEdgeChanges:b=>{const{onEdgesChange:v,setEdges:y,edges:C,hasDefaultEdges:T,debug:w}=h();if(b!=null&&b.length){if(T){const O=hle(b,C);y(O)}w&&console.log("React Flow: trigger edge changes",b),v==null||v(b)}},addSelectedNodes:b=>{const{multiSelectionActive:v,edgeLookup:y,nodeLookup:C,triggerNodeChanges:T,triggerEdgeChanges:w}=h();if(v){const O=b.map(x=>kf(x,!0));T(O);return}T(Ag(C,new Set([...b]),!0)),w(Ag(y))},addSelectedEdges:b=>{const{multiSelectionActive:v,edgeLookup:y,nodeLookup:C,triggerNodeChanges:T,triggerEdgeChanges:w}=h();if(v){const O=b.map(x=>kf(x,!0));w(O);return}w(Ag(y,new Set([...b]))),T(Ag(C,new Set,!0))},unselectNodesAndEdges:({nodes:b,edges:v}={})=>{const{edges:y,nodes:C,nodeLookup:T,triggerNodeChanges:w,triggerEdgeChanges:O}=h(),x=b||C,D=v||y,M=x.map(P=>{const q=T.get(P.id);return q&&(q.selected=!1),kf(P.id,!1)}),F=D.map(P=>kf(P.id,!1));w(M),O(F)},setMinZoom:b=>{const{panZoom:v,maxZoom:y}=h();v==null||v.setScaleExtent([b,y]),m({minZoom:b})},setMaxZoom:b=>{const{panZoom:v,minZoom:y}=h();v==null||v.setScaleExtent([y,b]),m({maxZoom:b})},setTranslateExtent:b=>{var v;(v=h().panZoom)==null||v.setTranslateExtent(b),m({translateExtent:b})},setPaneClickDistance:b=>{var v;(v=h().panZoom)==null||v.setClickDistance(b)},resetSelectedElements:()=>{const{edges:b,nodes:v,triggerNodeChanges:y,triggerEdgeChanges:C,elementsSelectable:T}=h();if(!T)return;const w=v.reduce((x,D)=>D.selected?[...x,kf(D.id,!1)]:x,[]),O=b.reduce((x,D)=>D.selected?[...x,kf(D.id,!1)]:x,[]);y(w),C(O)},setNodeExtent:b=>{const{nodes:v,nodeLookup:y,parentLookup:C,nodeOrigin:T,elevateNodesOnSelect:w,nodeExtent:O}=h();b[0][0]===O[0][0]&&b[0][1]===O[0][1]&&b[1][0]===O[1][0]&&b[1][1]===O[1][1]||(W5(v,y,C,{nodeOrigin:T,nodeExtent:b,elevateNodesOnSelect:w,checkEquality:!1}),m({nodeExtent:b}))},panBy:b=>{const{transform:v,width:y,height:C,panZoom:T,translateExtent:w}=h();return bqe({delta:b,panZoom:T,transform:v,translateExtent:w,width:y,height:C})},setCenter:async(b,v,y)=>{const{width:C,height:T,maxZoom:w,panZoom:O}=h();if(!O)return Promise.resolve(!1);const x=typeof(y==null?void 0:y.zoom)<"u"?y.zoom:w;return await O.setViewport({x:C/2-b*x,y:T/2-v*x,zoom:x},{duration:y==null?void 0:y.duration,ease:y==null?void 0:y.ease,interpolate:y==null?void 0:y.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{m({connection:{...use}})},updateConnection:b=>{m({connection:b})},reset:()=>m({...ece()})}},Object.is);function k$e({initialNodes:t,initialEdges:e,defaultNodes:n,defaultEdges:r,initialWidth:a,initialHeight:i,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:l,fitView:u,nodeOrigin:d,nodeExtent:f,children:m}){const[h]=N.useState(()=>D$e({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,width:a,height:i,fitView:u,minZoom:o,maxZoom:s,fitViewOptions:l,nodeOrigin:d,nodeExtent:f}));return A.jsx(eHe,{value:h,children:A.jsx(yHe,{children:m})})}function M$e({children:t,nodes:e,edges:n,defaultNodes:r,defaultEdges:a,width:i,height:o,fitView:s,fitViewOptions:l,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:m}){return N.useContext(FA)?A.jsx(A.Fragment,{children:t}):A.jsx(k$e,{initialNodes:e,initialEdges:n,defaultNodes:r,defaultEdges:a,initialWidth:i,initialHeight:o,fitView:s,initialFitViewOptions:l,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:f,nodeExtent:m,children:t})}const L$e={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function P$e({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,className:a,nodeTypes:i,edgeTypes:o,onNodeClick:s,onEdgeClick:l,onInit:u,onMove:d,onMoveStart:f,onMoveEnd:m,onConnect:h,onConnectStart:E,onConnectEnd:b,onClickConnectStart:v,onClickConnectEnd:y,onNodeMouseEnter:C,onNodeMouseMove:T,onNodeMouseLeave:w,onNodeContextMenu:O,onNodeDoubleClick:x,onNodeDragStart:D,onNodeDrag:M,onNodeDragStop:F,onNodesDelete:P,onEdgesDelete:q,onDelete:j,onSelectionChange:Q,onSelectionDragStart:U,onSelectionDrag:K,onSelectionDragStop:G,onSelectionContextMenu:Y,onSelectionStart:W,onSelectionEnd:J,onBeforeDelete:$,connectionMode:Z,connectionLineType:te=Ad.Bezier,connectionLineStyle:B,connectionLineComponent:ae,connectionLineContainerStyle:se,deleteKeyCode:de="Backspace",selectionKeyCode:ie="Shift",selectionOnDrag:ce=!1,selectionMode:me=CE.Full,panActivationKeyCode:be="Space",multiSelectionKeyCode:Ae=OE()?"Meta":"Control",zoomActivationKeyCode:we=OE()?"Meta":"Control",snapToGrid:Te,snapGrid:De,onlyRenderVisibleElements:We=!1,selectNodesOnDrag:Ye,nodesDraggable:Tt,autoPanOnNodeFocus:_t,nodesConnectable:Jt,nodesFocusable:Ge,nodeOrigin:Ve=ole,edgesFocusable:Xe,edgesReconnectable:mt,elementsSelectable:yt=!0,defaultViewport:Dt=fHe,minZoom:ge=.5,maxZoom:xe=2,translateExtent:He=TE,preventScrolling:ot=!0,nodeExtent:Ct,defaultMarkerColor:pr="#b1b1b7",zoomOnScroll:Yn=!0,zoomOnPinch:Tn=!0,panOnScroll:zt=!1,panOnScrollSpeed:hn=.5,panOnScrollMode:Bt=If.Free,zoomOnDoubleClick:Mr=!0,panOnDrag:ir=!0,onPaneClick:Lr,onPaneMouseEnter:Et,onPaneMouseMove:Hr,onPaneMouseLeave:$r,onPaneScroll:Nn,onPaneContextMenu:ue,paneClickDistance:Ee=0,nodeClickDistance:Me=0,children:Je,onReconnect:en,onReconnectStart:qt,onReconnectEnd:et,onEdgeContextMenu:Qe,onEdgeDoubleClick:pt,onEdgeMouseEnter:Sn,onEdgeMouseMove:or,onEdgeMouseLeave:Es,reconnectRadius:ku=10,onNodesChange:Mu,onEdgesChange:qo,noDragClassName:Tr="nodrag",noWheelClassName:Ea="nowheel",noPanClassName:Ss="nopan",fitView:Lu,fitViewOptions:Rp,connectOnClick:Pu,attributionPosition:th,proOptions:gc,defaultEdgeOptions:wp,elevateNodesOnSelect:Ma,elevateEdgesOnSelect:vs,disableKeyboardA11y:ys=!1,autoPanOnConnect:dl,autoPanOnNodeDrag:Pr,autoPanSpeed:nh,connectionRadius:_c,isValidConnection:Ts,onError:Be,style:St,id:Ht,nodeDragThreshold:Cn,connectionDragThreshold:Cr,viewport:Sa,onViewportChange:di,width:Wa,height:Fn,colorMode:pi="light",debug:rh,onScroll:Cs,ariaLabelConfig:xp,...Fu},mb){const va=Ht||"1",Np=gHe(pi),bc=N.useCallback(pl=>{pl.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Cs==null||Cs(pl)},[Cs]);return A.jsx("div",{"data-testid":"rf__wrapper",...Fu,onScroll:bc,style:{...St,...L$e},ref:mb,className:ra(["react-flow",a,Np]),id:Ht,role:"application",children:A.jsxs(M$e,{nodes:t,edges:e,width:Wa,height:Fn,fitView:Lu,fitViewOptions:Rp,minZoom:ge,maxZoom:xe,nodeOrigin:Ve,nodeExtent:Ct,children:[A.jsx(I$e,{onInit:u,onNodeClick:s,onEdgeClick:l,onNodeMouseEnter:C,onNodeMouseMove:T,onNodeMouseLeave:w,onNodeContextMenu:O,onNodeDoubleClick:x,nodeTypes:i,edgeTypes:o,connectionLineType:te,connectionLineStyle:B,connectionLineComponent:ae,connectionLineContainerStyle:se,selectionKeyCode:ie,selectionOnDrag:ce,selectionMode:me,deleteKeyCode:de,multiSelectionKeyCode:Ae,panActivationKeyCode:be,zoomActivationKeyCode:we,onlyRenderVisibleElements:We,defaultViewport:Dt,translateExtent:He,minZoom:ge,maxZoom:xe,preventScrolling:ot,zoomOnScroll:Yn,zoomOnPinch:Tn,zoomOnDoubleClick:Mr,panOnScroll:zt,panOnScrollSpeed:hn,panOnScrollMode:Bt,panOnDrag:ir,onPaneClick:Lr,onPaneMouseEnter:Et,onPaneMouseMove:Hr,onPaneMouseLeave:$r,onPaneScroll:Nn,onPaneContextMenu:ue,paneClickDistance:Ee,nodeClickDistance:Me,onSelectionContextMenu:Y,onSelectionStart:W,onSelectionEnd:J,onReconnect:en,onReconnectStart:qt,onReconnectEnd:et,onEdgeContextMenu:Qe,onEdgeDoubleClick:pt,onEdgeMouseEnter:Sn,onEdgeMouseMove:or,onEdgeMouseLeave:Es,reconnectRadius:ku,defaultMarkerColor:pr,noDragClassName:Tr,noWheelClassName:Ea,noPanClassName:Ss,rfId:va,disableKeyboardA11y:ys,nodeExtent:Ct,viewport:Sa,onViewportChange:di}),A.jsx(hHe,{nodes:t,edges:e,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:E,onConnectEnd:b,onClickConnectStart:v,onClickConnectEnd:y,nodesDraggable:Tt,autoPanOnNodeFocus:_t,nodesConnectable:Jt,nodesFocusable:Ge,edgesFocusable:Xe,edgesReconnectable:mt,elementsSelectable:yt,elevateNodesOnSelect:Ma,elevateEdgesOnSelect:vs,minZoom:ge,maxZoom:xe,nodeExtent:Ct,onNodesChange:Mu,onEdgesChange:qo,snapToGrid:Te,snapGrid:De,connectionMode:Z,translateExtent:He,connectOnClick:Pu,defaultEdgeOptions:wp,fitView:Lu,fitViewOptions:Rp,onNodesDelete:P,onEdgesDelete:q,onDelete:j,onNodeDragStart:D,onNodeDrag:M,onNodeDragStop:F,onSelectionDrag:K,onSelectionDragStart:U,onSelectionDragStop:G,onMove:d,onMoveStart:f,onMoveEnd:m,noPanClassName:Ss,nodeOrigin:Ve,rfId:va,autoPanOnConnect:dl,autoPanOnNodeDrag:Pr,autoPanSpeed:nh,onError:Be,connectionRadius:_c,isValidConnection:Ts,selectNodesOnDrag:Ye,nodeDragThreshold:Cn,connectionDragThreshold:Cr,onBeforeDelete:$,paneClickDistance:Ee,debug:rh,ariaLabelConfig:xp}),A.jsx(pHe,{onSelectionChange:Q}),Je,A.jsx(sHe,{proOptions:gc,position:th}),A.jsx(oHe,{rfId:va,disableKeyboardA11y:ys})]})})}var F$e=Ele(P$e);function B$e(t){const[e,n]=N.useState(t),r=N.useCallback(a=>n(i=>mle(a,i)),[]);return[e,n,r]}function U$e(t){const[e,n]=N.useState(t),r=N.useCallback(a=>n(i=>hle(a,i)),[]);return[e,n,r]}function G$e({dimensions:t,lineWidth:e,variant:n,className:r}){return A.jsx("path",{strokeWidth:e,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`,className:ra(["react-flow__background-pattern",n,r])})}function z$e({radius:t,className:e}){return A.jsx("circle",{cx:t,cy:t,r:t,className:ra(["react-flow__background-pattern","dots",e])})}var Hc;(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(Hc||(Hc={}));const q$e={[Hc.Dots]:1,[Hc.Lines]:1,[Hc.Cross]:6},H$e=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function tce({id:t,variant:e=Hc.Dots,gap:n=20,size:r,lineWidth:a=1,offset:i=0,color:o,bgColor:s,style:l,className:u,patternClassName:d}){const f=N.useRef(null),{transform:m,patternId:h}=mn(H$e,Nr),E=r||q$e[e],b=e===Hc.Dots,v=e===Hc.Cross,y=Array.isArray(n)?n:[n,n],C=[y[0]*m[2]||1,y[1]*m[2]||1],T=E*m[2],w=Array.isArray(i)?i:[i,i],O=v?[T,T]:C,x=[w[0]*m[2]||1+O[0]/2,w[1]*m[2]||1+O[1]/2],D=`${h}${t||""}`;return A.jsxs("svg",{className:ra(["react-flow__background",u]),style:{...l,...GA,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:f,"data-testid":"rf__background",children:[A.jsx("pattern",{id:D,x:m[0]%C[0],y:m[1]%C[1],width:C[0],height:C[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${x[0]},-${x[1]})`,children:b?A.jsx(z$e,{radius:T/2,className:d}):A.jsx(G$e,{dimensions:O,lineWidth:a,variant:e,className:d})}),A.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${D})`})]})}tce.displayName="Background";const $$e=N.memo(tce);function Y$e(){return A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:A.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function V$e(){return A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:A.jsx("path",{d:"M0 0h32v4.2H0z"})})}function j$e(){return A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:A.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function W$e(){return A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:A.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function K$e(){return A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:A.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function HA({children:t,className:e,...n}){return A.jsx("button",{type:"button",className:ra(["react-flow__controls-button",e]),...n,children:t})}const X$e=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom,ariaLabelConfig:t.ariaLabelConfig});function nce({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:a,onZoomIn:i,onZoomOut:o,onFitView:s,onInteractiveChange:l,className:u,children:d,position:f="bottom-left",orientation:m="vertical","aria-label":h}){const E=Er(),{isInteractive:b,minZoomReached:v,maxZoomReached:y,ariaLabelConfig:C}=mn(X$e,Nr),{zoomIn:T,zoomOut:w,fitView:O}=rB(),x=()=>{T(),i==null||i()},D=()=>{w(),o==null||o()},M=()=>{O(a),s==null||s()},F=()=>{E.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),l==null||l(!b)},P=m==="horizontal"?"horizontal":"vertical";return A.jsxs(BA,{className:ra(["react-flow__controls",P,u]),position:f,style:t,"data-testid":"rf__controls","aria-label":h??C["controls.ariaLabel"],children:[e&&A.jsxs(A.Fragment,{children:[A.jsx(HA,{onClick:x,className:"react-flow__controls-zoomin",title:C["controls.zoomIn.ariaLabel"],"aria-label":C["controls.zoomIn.ariaLabel"],disabled:y,children:A.jsx(Y$e,{})}),A.jsx(HA,{onClick:D,className:"react-flow__controls-zoomout",title:C["controls.zoomOut.ariaLabel"],"aria-label":C["controls.zoomOut.ariaLabel"],disabled:v,children:A.jsx(V$e,{})})]}),n&&A.jsx(HA,{className:"react-flow__controls-fitview",onClick:M,title:C["controls.fitView.ariaLabel"],"aria-label":C["controls.fitView.ariaLabel"],children:A.jsx(j$e,{})}),r&&A.jsx(HA,{className:"react-flow__controls-interactive",onClick:F,title:C["controls.interactive.ariaLabel"],"aria-label":C["controls.interactive.ariaLabel"],children:b?A.jsx(K$e,{}):A.jsx(W$e,{})}),d]})}nce.displayName="Controls",N.memo(nce);function Q$e({id:t,x:e,y:n,width:r,height:a,style:i,color:o,strokeColor:s,strokeWidth:l,className:u,borderRadius:d,shapeRendering:f,selected:m,onClick:h}){const{background:E,backgroundColor:b}=i||{},v=o||E||b;return A.jsx("rect",{className:ra(["react-flow__minimap-node",{selected:m},u]),x:e,y:n,rx:d,ry:d,width:r,height:a,style:{fill:v,stroke:s,strokeWidth:l},shapeRendering:f,onClick:h?y=>h(y,t):void 0})}const Z$e=N.memo(Q$e),J$e=t=>t.nodes.map(e=>e.id),sB=t=>t instanceof Function?t:()=>t;function eYe({nodeStrokeColor:t,nodeColor:e,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:a,nodeComponent:i=Z$e,onClick:o}){const s=mn(J$e,Nr),l=sB(e),u=sB(t),d=sB(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return A.jsx(A.Fragment,{children:s.map(m=>A.jsx(nYe,{id:m,nodeColorFunc:l,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:a,NodeComponent:i,onClick:o,shapeRendering:f},m))})}function tYe({id:t,nodeColorFunc:e,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:a,nodeStrokeWidth:i,shapeRendering:o,NodeComponent:s,onClick:l}){const{node:u,x:d,y:f,width:m,height:h}=mn(E=>{const{internals:b}=E.nodeLookup.get(t),v=b.userNode,{x:y,y:C}=b.positionAbsolute,{width:T,height:w}=qc(v);return{node:v,x:y,y:C,width:T,height:w}},Nr);return!u||u.hidden||!Sse(u)?null:A.jsx(s,{x:d,y:f,width:m,height:h,style:u.style,selected:!!u.selected,className:r(u),color:e(u),borderRadius:a,strokeColor:n(u),strokeWidth:i,shapeRendering:o,onClick:l,id:u.id})}const nYe=N.memo(tYe);var rYe=N.memo(eYe);const aYe=200,iYe=150,oYe=t=>!t.hidden,sYe=t=>{const e={x:-t.transform[0]/t.transform[2],y:-t.transform[1]/t.transform[2],width:t.width/t.transform[2],height:t.height/t.transform[2]};return{viewBB:e,boundingRect:t.nodeLookup.size>0?bse(RE(t.nodeLookup,{filter:oYe}),e):e,rfId:t.rfId,panZoom:t.panZoom,translateExtent:t.translateExtent,flowWidth:t.width,flowHeight:t.height,ariaLabelConfig:t.ariaLabelConfig}},lYe="react-flow__minimap-desc";function rce({style:t,className:e,nodeStrokeColor:n,nodeColor:r,nodeClassName:a="",nodeBorderRadius:i=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:l,maskColor:u,maskStrokeColor:d,maskStrokeWidth:f,position:m="bottom-right",onClick:h,onNodeClick:E,pannable:b=!1,zoomable:v=!1,ariaLabel:y,inversePan:C,zoomStep:T=1,offsetScale:w=5}){const O=Er(),x=N.useRef(null),{boundingRect:D,viewBB:M,rfId:F,panZoom:P,translateExtent:q,flowWidth:j,flowHeight:Q,ariaLabelConfig:U}=mn(sYe,Nr),K=(t==null?void 0:t.width)??aYe,G=(t==null?void 0:t.height)??iYe,Y=D.width/K,W=D.height/G,J=Math.max(Y,W),$=J*K,Z=J*G,te=w*J,B=D.x-($-D.width)/2-te,ae=D.y-(Z-D.height)/2-te,se=$+te*2,de=Z+te*2,ie=`${lYe}-${F}`,ce=N.useRef(0),me=N.useRef();ce.current=J,N.useEffect(()=>{if(x.current&&P)return me.current=wqe({domNode:x.current,panZoom:P,getTransform:()=>O.getState().transform,getViewScale:()=>ce.current}),()=>{var Te;(Te=me.current)==null||Te.destroy()}},[P]),N.useEffect(()=>{var Te;(Te=me.current)==null||Te.update({translateExtent:q,width:j,height:Q,inversePan:C,pannable:b,zoomStep:T,zoomable:v})},[b,v,C,T,q,j,Q]);const be=h?Te=>{var Ye;const[De,We]=((Ye=me.current)==null?void 0:Ye.pointer(Te))||[0,0];h(Te,{x:De,y:We})}:void 0,Ae=E?N.useCallback((Te,De)=>{const We=O.getState().nodeLookup.get(De).internals.userNode;E(Te,We)},[]):void 0,we=y??U["minimap.ariaLabel"];return A.jsx(BA,{position:m,style:{...t,"--xy-minimap-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*J:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o=="number"?o:void 0},className:ra(["react-flow__minimap",e]),"data-testid":"rf__minimap",children:A.jsxs("svg",{width:K,height:G,viewBox:`${B} ${ae} ${se} ${de}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ie,ref:x,onClick:be,children:[we&&A.jsx("title",{id:ie,children:we}),A.jsx(rYe,{onClick:Ae,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:a,nodeStrokeWidth:o,nodeComponent:s}),A.jsx("path",{className:"react-flow__minimap-mask",d:`M${B-te},${ae-te}h${se+te*2}v${de+te*2}h${-se-te*2}z
|
|
655
|
-
M${M.x},${M.y}h${M.width}v${M.height}h${-M.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}rce.displayName="MiniMap",N.memo(rce);const cYe=t=>e=>t?`${Math.max(1/e.transform[2],1)}`:void 0,uYe={[Cg.Line]:"right",[Cg.Handle]:"bottom-right"};function dYe({nodeId:t,position:e,variant:n=Cg.Handle,className:r,style:a=void 0,children:i,color:o,minWidth:s=10,minHeight:l=10,maxWidth:u=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:m,autoScale:h=!0,shouldResize:E,onResizeStart:b,onResize:v,onResizeEnd:y}){const C=Ale(),T=typeof t=="string"?t:C,w=Er(),O=N.useRef(null),x=n===Cg.Handle,D=mn(N.useCallback(cYe(x&&h),[x,h]),Nr),M=N.useRef(null),F=e??uYe[n];N.useEffect(()=>{if(!(!O.current||!T))return M.current||(M.current=Hqe({domNode:O.current,nodeId:T,getStoreItems:()=>{const{nodeLookup:q,transform:j,snapGrid:Q,snapToGrid:U,nodeOrigin:K,domNode:G}=w.getState();return{nodeLookup:q,transform:j,snapGrid:Q,snapToGrid:U,nodeOrigin:K,paneDomNode:G}},onChange:(q,j)=>{const{triggerNodeChanges:Q,nodeLookup:U,parentLookup:K,nodeOrigin:G}=w.getState(),Y=[],W={x:q.x,y:q.y},J=U.get(T);if(J&&J.expandParent&&J.parentId){const $=J.origin??G,Z=q.width??J.measured.width??0,te=q.height??J.measured.height??0,B={id:J.id,parentId:J.parentId,rect:{width:Z,height:te,...vse({x:q.x??J.position.x,y:q.y??J.position.y},{width:Z,height:te},J.parentId,U,$)}},ae=X5([B],U,K,G);Y.push(...ae),W.x=q.x?Math.max($[0]*Z,q.x):void 0,W.y=q.y?Math.max($[1]*te,q.y):void 0}if(W.x!==void 0&&W.y!==void 0){const $={id:T,type:"position",position:{...W}};Y.push($)}if(q.width!==void 0&&q.height!==void 0){const Z={id:T,type:"dimensions",resizing:!0,setAttributes:m?m==="horizontal"?"width":"height":!0,dimensions:{width:q.width,height:q.height}};Y.push(Z)}for(const $ of j){const Z={...$,type:"position"};Y.push(Z)}Q(Y)},onEnd:({width:q,height:j})=>{const Q={id:T,type:"dimensions",resizing:!1,dimensions:{width:q,height:j}};w.getState().triggerNodeChanges([Q])}})),M.current.update({controlPosition:F,boundaries:{minWidth:s,minHeight:l,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:m,onResizeStart:b,onResize:v,onResizeEnd:y,shouldResize:E}),()=>{var q;(q=M.current)==null||q.destroy()}},[F,s,l,u,d,f,b,v,y,E]);const P=F.split("-");return A.jsx("div",{className:ra(["react-flow__resize-control","nodrag",...P,n,r]),ref:O,style:{...a,scale:D,...o&&{[x?"backgroundColor":"borderColor"]:o}},children:i})}N.memo(dYe);function pYe({workflowName:t,className:e="w-full h-[600px]",events:n,onNodeClick:r,highlightedNodeId:a,selectedNodeId:i,isComplete:o=!1}){const[s,l,u]=B$e([]),[d,f,m]=U$e([]),[h,E]=N.useState(!1),[b,v]=N.useState(null),[y,C]=N.useState(-1),[T,w]=N.useState(()=>{if(typeof window>"u")return!1;try{return document.documentElement.classList.contains("dark")?!0:window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches}catch{return!1}}),O=N.useMemo(()=>({step:({data:P,id:q})=>{const j=a===q,Q=i===q;let U={transition:"all 1s ease-out"};return P.highlightColor&&P.highlightColor!==null?(U.backgroundColor=T?void 0:"#CCFBEF",U.borderColor=P.highlightColor,U.boxShadow=`0 0 0 3px ${P.highlightColor}66`):P.highlightColor===null&&(U.backgroundColor=T?"#0b1220":"#E6EEFF",U.borderColor=T?"#274690":"#7EA6FF",U.boxShadow="0 0 0 0px transparent"),Q?U={backgroundColor:T?"#1e3a8a":"#DBEAFE",borderColor:"#3B82F6",boxShadow:"0 0 0 4px #3B82F6",transition:"all 1s ease-out"}:j&&(U={...U,borderColor:"#10B981",boxShadow:"0 0 0 3px #10B98166"}),A.jsxs("div",{className:"px-4 py-2 shadow-md rounded-md min-w-[160px] cursor-pointer transition-all bg-[#E6EEFF] border-2 border-[#7EA6FF] dark:bg-[#0b1220] dark:border-[#274690] hover:shadow-lg hover:scale-105",style:U,onClick:()=>r==null?void 0:r(q),children:[A.jsx(zl,{type:"target",position:vt.Left}),A.jsxs("div",{className:"flex items-center justify-between gap-2",children:[A.jsx("div",{className:"font-bold text-[#1E3A8A] text-sm dark:text-[#e5edff]",children:P.label}),P.workerCount>0&&A.jsx("div",{className:"flex items-center justify-center min-w-[20px] h-[20px] px-1.5 rounded-full bg-[#10B981] text-white text-[10px] font-bold",children:P.workerCount})]}),P.title&&A.jsx("div",{className:"text-xs text-[#1D4ED8] mt-1 dark:text-[#9db4ff]",children:P.title}),(P.lastInputEvent||P.lastOutputEvent)&&A.jsxs("div",{className:"text-[10px] text-gray-700 dark:text-gray-300 mt-1",children:[P.lastInputEvent&&A.jsxs("div",{children:[A.jsx("span",{className:"font-semibold",children:"in:"})," ",P.lastInputEvent]}),P.lastOutputEvent&&A.jsxs("div",{children:[A.jsx("span",{className:"font-semibold",children:"out:"})," ",P.lastOutputEvent]})]}),A.jsx(zl,{type:"source",position:vt.Right})]})},event:({data:P,id:q})=>{const j=a===q,Q=i===q;let U={transition:"all 1s ease-out"};return P.highlightColor&&P.highlightColor!==null?(U.backgroundColor=T?void 0:"#FFE8B5",U.borderColor=P.highlightColor,U.boxShadow=`0 0 0 3px ${P.highlightColor}66`):P.highlightColor===null&&(U.backgroundColor=T?"#241a06":"#FFF3BF",U.borderColor=T?"#F59E0B":"#FFD166",U.boxShadow="0 0 0 0px transparent"),Q?U={backgroundColor:T?"#1e3a8a":"#DBEAFE",borderColor:"#3B82F6",boxShadow:"0 0 0 4px #3B82F6",transition:"all 1s ease-out"}:j&&(U={...U,borderColor:"#10B981",boxShadow:"0 0 0 3px #10B98166"}),A.jsxs("div",{className:"px-3 py-2 shadow-md rounded-full min-w-[140px] text-center cursor-pointer transition-all bg-[#FFF3BF] border-2 border-[#FFD166] dark:bg-[#241a06] dark:border-[#F59E0B] hover:shadow-lg hover:scale-105",style:U,onClick:()=>r==null?void 0:r(q),children:[A.jsx(zl,{type:"target",position:vt.Left}),A.jsx("div",{className:"font-bold text-[#92400E] text-sm dark:text-[#fde68a]",children:P.label}),P.event_type&&A.jsx("div",{className:"text-xs text-[#B45309] mt-1 dark:text-[#fbbf24]",children:P.event_type}),A.jsx(zl,{type:"source",position:vt.Right})]})},external:({data:P,id:q})=>{const j=a===q,Q=i===q;let U=P.highlightColor?{backgroundColor:T?void 0:"#FFE5D4",borderColor:P.highlightColor,boxShadow:`0 0 0 3px ${P.highlightColor}66`}:void 0;return Q?U={backgroundColor:T?"#1e3a8a":"#DBEAFE",borderColor:"#3B82F6",boxShadow:"0 0 0 4px #3B82F6"}:j&&(U={backgroundColor:U==null?void 0:U.backgroundColor,borderColor:"#10B981",boxShadow:"0 0 0 3px #10B98166"}),A.jsxs("div",{className:"px-3 py-2 shadow-md rounded-lg min-w-[140px] text-center cursor-pointer transition-all bg-[#FFEDD5] border-2 border-[#FB923C] dark:bg-[#1f0f08] dark:border-[#ea7a3a] hover:shadow-lg hover:scale-105",style:U,onClick:()=>r==null?void 0:r(q),children:[A.jsx(zl,{type:"target",position:vt.Left}),A.jsx("div",{className:"font-bold text-[#7C2D12] text-sm dark:text-[#fed7aa]",children:P.label}),P.title&&A.jsx("div",{className:"text-xs text-[#C2410C] mt-1 dark:text-[#fdba74]",children:P.title}),A.jsx(zl,{type:"source",position:vt.Right})]})}}),[T,a,i,r]);N.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const P=window.matchMedia("(prefers-color-scheme: dark)"),q=j=>w(j.matches);return P.addEventListener?P.addEventListener("change",q):P.addListener(q),()=>{P.removeEventListener?P.removeEventListener("change",q):P.removeListener(q)}},[]);const x=pd(),D=N.useCallback(P=>f(q=>Ise(P,q)),[f]),M=N.useCallback(P=>{const q=new Map,j=new Map;P.nodes.forEach($=>{q.set($.id,[]),j.set($.id,0)}),P.edges.forEach(({source:$,target:Z})=>{var te;(te=q.get($))==null||te.push(Z),j.set(Z,(j.get(Z)||0)+1)});const Q=[];j.forEach(($,Z)=>{$===0&&Q.push(Z)});const U=new Map;for(Q.forEach($=>U.set($,0));Q.length;){const $=Q.shift(),Z=U.get($)??0;for(const te of q.get($)||[]){const B=Math.max(Z+1,U.get(te)??0);U.set(te,B),j.set(te,(j.get(te)||0)-1),(j.get(te)||0)===0&&Q.push(te)}}const K={};P.nodes.forEach($=>{const Z=U.get($.id)??0;K[Z]||(K[Z]=[]),K[Z].push($.id)});const G=260,Y=110,W=P.nodes.map($=>{const Z=U.get($.id)??0,B=K[Z].indexOf($.id),ae=Z*G,se=B*Y;return{id:$.id,type:$.node_type,position:{x:ae,y:se},data:{label:$.label,title:$.title,event_type:$.event_type,type:$.node_type}}}),J=P.edges.map(($,Z)=>({id:`edge-${Z}`,source:$.source,target:$.target,type:"smoothstep",animated:!1,style:{stroke:"var(--wf-edge-stroke)",strokeWidth:2},markerEnd:{type:bg.ArrowClosed,color:"var(--wf-edge-stroke)"}}));return{nodes:W,edges:J}},[]),F=N.useCallback(async()=>{if(!t){l([]),f([]),v(null);return}E(!0),v(null);try{const{data:P,error:q}=await Wq({client:x,path:{name:t}});if(q)throw new Error(String(q));const j=P==null?void 0:P.graph;if(!j)throw new Error("No graph data received");const Q=M(j);l(Q.nodes),f(Q.edges)}catch(P){console.error("Error fetching workflow visualization:",P),v(P instanceof Error?P.message:"Failed to load workflow visualization"),l([]),f([])}finally{E(!1)}},[t,x,M,l,f]);return N.useEffect(()=>{F()},[F]),N.useEffect(()=>{if(!n||n.length===0){C(-1),l(Q=>Q.map(U=>{const K={...U.data};return delete K.highlightColor,delete K.activeWorkers,delete K.workerCount,delete K.fadeTimestamp,{...U,data:K}}));return}const P=n.slice(y+1);if(P.length===0)return;C(n.length-1);const q=Q=>{if(!Q)return"";try{return((typeof Q=="string"?Q:String(Q)).replace("<class","").replace(">","").replaceAll("'","").split(".").at(-1)||"").trim()}catch{return""}},j=Q=>{switch(Q){case"preparing":return"#3B82F6";case"in_progress":return"#F59E0B";case"running":return"#10B981";case"not_running":case"not_in_progress":case"exited":return null;default:return"#10B981"}};for(const Q of P){const U=(Q==null?void 0:Q.type)??"",K=(Q==null?void 0:Q.data)??{};if(U==="StepStateChanged"||U==="workflows.events.StepStateChanged"){const G=String((K==null?void 0:K.name)||""),Y=String((K==null?void 0:K.step_state)||""),W=String((K==null?void 0:K.worker_id)||""),J=j(Y);l($=>$.map(Z=>{const te={...Z.data};if(Z.id===G){const B=new Set(te.activeWorkers||[]);if(Y==="preparing"||Y==="in_progress"||Y==="running"?B.add(W):(Y==="not_running"||Y==="not_in_progress"||Y==="exited")&&B.delete(W),te.activeWorkers=Array.from(B),te.workerCount=B.size,B.size>0)te.highlightColor=J||"#10B981",te.fadeTimestamp=Date.now();else if((Y==="exited"||Y==="not_running")&&te.highlightColor){const ae=Date.now();te.fadeTimestamp=ae,setTimeout(()=>{l(se=>se.map(de=>{if(de.id===G&&de.data.fadeTimestamp===ae){const ie={...de.data};return ie.highlightColor=null,{...de,data:ie}}return de}))},1e3)}return te.lastInputEvent=q(K==null?void 0:K.input_event_name),te.lastOutputEvent=q(K==null?void 0:K.output_event_name),te.status=Y,{...Z,data:te}}return Z}))}else if(U&&!U.includes("workflows.events.EventsQueueChanged")){const G=q(U.replace("__main__.","").replace("workflows.events.",""));l(Y=>Y.map(W=>{if(W.id===G&&W.type==="event"){const J={...W.data};return J.highlightColor="#10B981",J.fadeTimestamp=Date.now(),{...W,data:J}}return W})),setTimeout(()=>{l(Y=>Y.map(W=>{if(W.id===G&&W.type==="event"){const J={...W.data};return J.highlightColor=null,J.fadeTimestamp=null,{...W,data:J}}return W}))},1e3)}}},[n,y,l,o]),h?A.jsx("div",{className:`${e} flex items-center justify-center bg-card border border-border rounded-lg`,children:A.jsxs("div",{className:"text-center",children:[A.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-2"}),A.jsx("p",{className:"text-muted-foreground",children:"Loading workflow visualization..."})]})}):b?A.jsx("div",{className:`${e} flex items-center justify-center bg-destructive/10 border border-destructive/30 rounded-lg`,children:A.jsxs("div",{className:"text-center p-4",children:[A.jsx("p",{className:"text-destructive font-medium",children:"Error loading visualization"}),A.jsx("p",{className:"text-sm mt-1 text-destructive",children:b}),A.jsx("button",{onClick:F,className:"mt-3 px-4 py-2 bg-primary text-primary-foreground rounded-md text-sm hover:opacity-90 transition-colors",children:"Retry"})]})}):t?s.length===0?A.jsx("div",{className:`${e} flex items-center justify-center bg-card border border-border rounded-lg`,children:A.jsx("p",{className:"text-muted-foreground",children:"No workflow data available"})}):A.jsx("div",{className:`${e} border border-border rounded-lg overflow-hidden`,children:A.jsx(F$e,{nodes:s,edges:d,onNodesChange:u,onEdgesChange:m,onConnect:D,nodeTypes:O,defaultEdgeOptions:{markerEnd:{type:bg.ArrowClosed,color:"var(--wf-edge-stroke)"}},fitView:!0,attributionPosition:"bottom-left",children:A.jsx($$e,{variant:Hc.Dots,gap:12,size:1,color:T?"#374151":"#e5e7eb"})})}):A.jsx("div",{className:`${e} flex items-center justify-center bg-card border border-border rounded-lg`,children:A.jsx("p",{className:"text-muted-foreground",children:"Select a workflow to view its visualization"})})}function lB(t){if(t.type)return{type:t.type,nullable:t.nullable??!1};if(t.anyOf&&Array.isArray(t.anyOf)){const e=t.anyOf.map(a=>a.type).filter(a=>typeof a=="string"),n=e.includes("null"),r=e.filter(a=>a!=="null");if(r.length===1)return{type:r[0],nullable:n}}return{type:"unknown",nullable:!1}}function fYe(t){if(!t)return!1;const e=t.toLowerCase();return e.includes("object")||e.includes("array")||e.includes("map")||e.includes("dict")||/\w+\s*\[.*\]/.test(t)}function mYe(t){const e=(t||"").toLowerCase(),n=e.includes("array")||e.includes("list")||/\w+\s*\[.*\]/.test(t||""),r=e.includes("object")||e.includes("map")||e.includes("dict");return n?{hint:'Expected: JSON array (e.g., ["a", "b"])',placeholder:'["item1", "item2"]'}:r?{hint:'Expected: JSON object (e.g., {"key": "value"})',placeholder:'{"key": "value"}'}:{hint:"Expected: valid JSON (object or array)",placeholder:"Enter value as JSON"}}const hYe={};function ace({schema:t,values:e,onChange:n,onErrorsChange:r,className:a}){const i=(t==null?void 0:t.properties)??hYe,o=new Set((t==null?void 0:t.required)||[]),[s,l]=N.useState({}),[u,d]=N.useState({});N.useEffect(()=>{r==null||r(u)},[u,r]),N.useEffect(()=>{l(h=>{const E={...h};for(const[b,v]of Object.entries(i)){const{type:y}=lB(v);if(fYe(y)&&E[b]===void 0){const C=e[b];E[b]=C!==void 0?JSON.stringify(C,null,2):""}}return E})},[i,e]),N.useEffect(()=>{const h={};for(const[E,b]of Object.entries(i)){const{type:v,nullable:y}=lB(b);v==="boolean"&&e[E]===void 0&&o.has(E)&&(h[E]=y?null:!1)}Object.keys(h).length>0&&n({...e,...h})},[i,n]);const f=(h,E)=>{n({...e,[h]:E})},m=N.useMemo(()=>Object.entries(i),[i]);return m.length===0?null:A.jsx("div",{className:a,children:m.map(([h,E])=>{const b=`field-${h}`,v=E.title||h,{type:y,nullable:C}=lB(E),T=E.description||"";if(y==="string")return A.jsxs("div",{className:"space-y-2",children:[A.jsx(Bs,{htmlFor:b,label:v,required:o.has(h)}),A.jsx(RT,{id:b,value:e[h]||"",onChange:M=>f(h,M.target.value),placeholder:T||`Enter ${v.toLowerCase()}`,minRows:3}),T&&A.jsx("p",{className:"text-xs text-muted-foreground",children:T})]},h);if(y==="number"||y==="integer")return A.jsxs("div",{className:"space-y-2",children:[A.jsx(Bs,{htmlFor:b,label:v,required:o.has(h)}),A.jsx(OT,{id:b,type:"number",value:e[h]??"",onChange:M=>{const F=M.target.value;if(F===""){f(h,null);return}const P=y==="integer"?parseInt(F,10):parseFloat(F);f(h,Number.isNaN(P)?null:P)},placeholder:T||`Enter ${v.toLowerCase()}`,step:y==="integer"?"1":"any"}),T&&A.jsx("p",{className:"text-xs text-muted-foreground",children:T})]},h);if(y==="boolean"){const M=()=>e[h]===null?"null":e[h]===!0||e[h]==="true"?"true":e[h]===!1||e[h]==="false"?"false":C?"":"false";return A.jsxs("div",{className:"space-y-2",children:[A.jsx(Bs,{htmlFor:b,label:v,required:o.has(h)}),A.jsxs(Sx,{onValueChange:F=>{F==="null"?f(h,null):f(h,F==="true")},value:M(),children:[A.jsx(TT,{placeholder:"Select..."}),A.jsxs(CT,{children:[A.jsx(Gh,{value:"true",label:"True"}),A.jsx(Gh,{value:"false",label:"False"}),C&&A.jsx(Gh,{value:"null",label:"None"})]})]}),T&&A.jsx("p",{className:"text-xs text-muted-foreground",children:T})]},h)}const{hint:w,placeholder:O}=mYe(y),x=s[h]??(e[h]!==void 0?JSON.stringify(e[h],null,2):""),D=!!u[h];return A.jsxs("div",{className:"space-y-2",children:[A.jsx(Bs,{htmlFor:b,label:`${v} (JSON)`,required:o.has(h)}),A.jsx("div",{className:"font-mono",children:A.jsx(RT,{id:b,value:x,onChange:M=>{const F=M.target.value;if(l(P=>({...P,[h]:F})),F.trim()===""){d(q=>({...q,[h]:null}));const P={...e};delete P[h],n(P);return}try{const P=JSON.parse(F);d(q=>({...q,[h]:null})),f(h,P)}catch{d(P=>({...P,[h]:"Invalid JSON"}))}},placeholder:T||O,variant:D?"error":"default",minRows:3})}),D?A.jsx("p",{className:"text-xs text-destructive mt-1",children:u[h]}):A.jsx("p",{className:"text-xs text-muted-foreground",children:w}),T&&A.jsx("p",{className:"text-xs text-muted-foreground",children:T})]},h)})})}function gYe({handlerId:t,workflowName:e,disabled:n}){const[r,a]=N.useState(!1),[i,o]=N.useState([]),[s,l]=N.useState(null),[u,d]=N.useState({}),[f,m]=N.useState(!1),[h,E]=N.useState(null),[b,v]=N.useState(!1),[y,C]=N.useState(null),[T,w]=N.useState(!1),O=pd();N.useEffect(()=>{if(!r||!e)return;(async()=>{m(!0),C(null);try{const j=(await oye({client:O,path:{name:e}})).data;if(!j){o([]);return}if(!j.events){o([]);return}if(o(j.events),j.events&&j.events.length>0){const U=j.events[0].title;l(U||null)}}catch(q){console.error("Failed to fetch event schemas:",q),C(q instanceof Error?q.message:"Failed to fetch events"),o([])}finally{m(!1)}})()},[r,e,O]),N.useEffect(()=>{r||(l(null),d({}),E(null),C(null),w(!1))},[r]),N.useEffect(()=>{d({}),C(null),w(!1)},[s]);const x=N.useMemo(()=>s&&i.find(P=>P.title===s)||null,[s,i]),D=N.useMemo(()=>h?Object.values(h).some(P=>P!==null):!1,[h]),M=async()=>{if(!(!t||!s)){v(!0),C(null),w(!1);try{const P={type:s,data:u},{error:q}=await jq({client:O,path:{handler_id:t},body:{event:JSON.stringify(P)}});if(q)throw new Error(typeof q=="string"?q:JSON.stringify(q));w(!0),setTimeout(()=>{a(!1)},1e3)}catch(P){console.error("Failed to send event:",P),C(P instanceof Error?P.message:"Failed to send event")}finally{v(!1)}}},F=!b&&!D&&s&&t&&!T;return A.jsxs(jTe,{open:r,onOpenChange:a,children:[A.jsx(WTe,{asChild:!0,children:A.jsx(Xn,{variant:"outline",size:"sm",disabled:n||!t||!e,title:t?e?"Send event to workflow":"No workflow selected":"No active handler",label:"Send Event",startIcon:A.jsx(PEe,{})})}),A.jsxs(e$,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[A.jsx(t$,{title:"Send Event to Workflow",description:"Send a custom event to the running workflow handler."}),A.jsx("div",{className:"space-y-4 py-4",children:f?A.jsx("div",{className:"text-center text-muted-foreground",children:"Loading event types..."}):i.length===0?A.jsx("div",{className:"text-center text-muted-foreground",children:y||"No events available for this workflow"}):A.jsxs(A.Fragment,{children:[A.jsxs("div",{className:"space-y-2",children:[A.jsx(Bs,{htmlFor:"eventType",label:"Event Type"}),A.jsxs(Sx,{value:s||"",onValueChange:l,children:[A.jsx(TT,{placeholder:"Select event type..."}),A.jsx(CT,{children:i.map(P=>A.jsx(Gh,{value:P.title||"",label:P.title||"Unnamed Event"},P.title||"unknown"))})]})]}),x&&A.jsxs("div",{className:"space-y-2",children:[A.jsx(Bs,{htmlFor:"eventData",label:"Event Data"}),A.jsx(ace,{schema:{properties:x.properties,required:x.required},values:u,onChange:d,onErrorsChange:E,className:"space-y-3 border border-border rounded-lg p-4 bg-muted/30"})]}),y&&A.jsx("div",{className:"text-destructive text-sm p-3 bg-destructive/10 border border-destructive/20 rounded",children:y}),T&&A.jsx("div",{className:"text-green-600 text-sm p-3 bg-green-50 border border-green-200 rounded",children:"Event sent successfully!"})]})}),A.jsx(n$,{secondary:{label:"Cancel",onClick:()=>a(!1)},primary:{label:b?"Sending...":"Send Event",onClick:M,disabled:!F}})]})]})}function _Ye({handlerId:t,selectedWorkflow:e}){var C;const{state:n,subscribeToEvents:r}=F3e(t),[a,i]=N.useState(!1),[o,s]=N.useState(!0),[l,u]=N.useState(null),[d,f]=N.useState(null),{items:m,push:h,clear:E}=B3e(100,(T,w)=>T.timestamp.getTime()-w.timestamp.getTime()),b=T=>typeof T=="string"?T:!T||typeof T!="object"?String(T??""):JSON.stringify(T,null,a?0:2),v=T=>{if(!T)return"";const w=new Date(T),O=w.toLocaleTimeString([],{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),x=String(w.getMilliseconds()).padStart(3,"0");return`${O}.${x}`};N.useEffect(()=>{if(n.status==="running"){const{disconnect:T}=r({onData:w=>{h(w)},onSuccess(w){var O,x;u(((x=(O=w[w.length-1])==null?void 0:O.data)==null?void 0:x.result)??null)},onError(w){f(w.message)}},!0);return()=>{T()}}},[r,n.status,h]),N.useEffect(()=>{E(),u(null),f(null)},[t,E]);const y=N.useMemo(()=>o?m.filter(T=>!MTe(T)):m,[m,o]);return A.jsxs("div",{className:"h-full flex flex-col",children:[A.jsxs("div",{className:"p-4 border-b border-border",children:[A.jsxs("div",{className:"flex items-center justify-between",children:[A.jsx("h2",{className:"font-semibold text-sm",children:"Run Details"}),A.jsxs("div",{className:"flex items-center gap-2",children:[A.jsx(_T,{variant:n.status==="completed"?"default":"secondary",label:n.status}),A.jsx(gYe,{handlerId:t,workflowName:e??null,disabled:!n||n.status==="completed"||n.status==="failed"})]})]}),A.jsxs("div",{className:"flex items-center justify-between gap-2 mt-2",children:[A.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:n.handler_id}),A.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:["Last updated: ",(C=n.updated_at)==null?void 0:C.getTime()]})]})]}),A.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[A.jsx("div",{className:"flex-1 p-4 overflow-auto border-r border-border",children:A.jsx(pYe,{workflowName:e||null,events:m.map(T=>({type:T.type,data:T.data})),className:"w-full h-full min-h-[400px]",isComplete:n.status==="completed"||n.status==="failed"})}),A.jsxs("div",{className:"w-[480px] flex flex-col overflow-hidden",children:[A.jsx("div",{className:"p-4 pb-2 border-b border-border",children:A.jsxs("div",{className:"flex items-center justify-between mb-3",children:[A.jsxs("h4",{className:"font-medium text-sm",children:["Event Stream (",y.length,")"]}),A.jsxs("div",{className:"flex items-center gap-3",children:[A.jsxs("div",{className:"flex items-center gap-2",children:[A.jsx(Bs,{htmlFor:"hide-internal",label:"Hide internal"}),A.jsx(AJ,{id:"hide-internal",checked:o,onCheckedChange:T=>s(!!T)})]}),A.jsx(Xn,{variant:"ghost",size:"sm",onClick:()=>i(!a),label:a?"Formatted":"Compact"})]})]})}),A.jsx("div",{className:"flex-1 overflow-auto",children:n.handler_id?m.length===0?A.jsx("div",{className:"flex items-center justify-center h-full",children:A.jsx("p",{className:"text-muted-foreground text-sm",children:"No events yet..."})}):A.jsxs(Nz,{children:[A.jsx(Oz,{sticky:!0,children:A.jsxs(Ox,{children:[A.jsx(Ix,{label:"#"}),A.jsx(Ix,{label:"Event"})]})}),A.jsx(Iz,{children:y.map((T,w)=>{const O=T;return A.jsxs(Ox,{"data-event-index":w,children:[A.jsx(kz,{label:w+1}),A.jsx(Mz,{children:A.jsxs("div",{className:"space-y-2",children:[A.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[A.jsx("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:A.jsx("code",{className:"text-sm font-mono truncate",children:O.type})}),O.timestamp!==void 0?A.jsx("span",{className:"text-[10px] text-muted-foreground font-mono whitespace-nowrap",children:v(O.timestamp.getTime())}):null]}),A.jsx(moe,{language:typeof O.data=="string"?"text":"json",value:b(O.data),wrapLongLines:a,className:"rounded border max-h-64 overflow-auto"})]})})]},`${O.type}-${w}`)})})]}):A.jsx("div",{className:"flex items-center justify-center h-full",children:A.jsx("p",{className:"text-muted-foreground text-sm",children:"Start a run to see events"})})}),(l||d)&&A.jsxs("div",{className:"p-4 border-t border-border",children:[A.jsx("h4",{className:"font-medium text-sm mb-2",children:"Final Result"}),d?A.jsxs("div",{className:"text-destructive text-sm p-3 bg-destructive/10 border border-destructive/20 rounded",children:["Failed to load final result: ",d]}):A.jsx(moe,{language:typeof l=="string"?"text":"json",value:typeof l=="string"?l:JSON.stringify(l,null,2),className:"rounded border overflow-hidden"})]})]})]})]})}function bYe({activeHandlerId:t,onHandlerSelect:e}){const{state:n,sync:r}=UJ(),a=n.handlers,[i,o]=N.useState(!1);N.useEffect(()=>{o(!0),r().finally(()=>o(!1))},[r]);const s=u=>`${u.workflow_name||"Unknown"}`,l=Object.values(a);return A.jsxs("div",{className:"h-full flex flex-col text-sm",children:[A.jsx("div",{className:"px-3 py-2 border-b border-border",children:A.jsx("div",{className:"flex items-center justify-between",children:A.jsx("h2",{className:"font-semibold text-xs tracking-tight",children:"Recent Runs"})})}),A.jsxs("div",{className:"flex-1 overflow-y-auto",children:[i&&A.jsxs("div",{className:"p-2 space-y-2",children:[A.jsx(uf,{className:"h-8 w-full"}),A.jsx(uf,{className:"h-8 w-full"}),A.jsx(uf,{className:"h-8 w-full"})]}),!i&&A.jsx("div",{className:"p-2 divide-y divide-border",children:l.length===0?A.jsx("div",{className:"text-muted-foreground text-xs p-3 text-center",children:"No runs yet. Start a workflow to see runs here."}):l.map(u=>A.jsx("button",{onClick:()=>e(u.handler_id),className:`w-full text-left px-2 py-1.5 transition-colors cursor-pointer border border-collapse ${t===u.handler_id?"bg-accent ":"hover:bg-accent"}`,children:A.jsxs("div",{className:"grid grid-cols-[1fr_auto] items-center gap-2",children:[A.jsx("span",{className:"truncate text-xs",children:s(u)}),A.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:u.handler_id.slice(-8)})]})},u.handler_id))})]})]})}function EYe({selectedWorkflow:t,onRunStart:e,onCollapse:n}){const[r,a]=N.useState(null),[i,o]=N.useState({}),[s,l]=N.useState(!1),[u,d]=N.useState(null),[f,m]=N.useState(""),[h,E]=N.useState(null),[b,v]=N.useState({}),[y,C]=N.useState(!1),T=pd(),{createHandler:w}=P3e(t),{setHandler:O}=UJ();N.useEffect(()=>{t?(async()=>{if(t)try{l(!0),d(null);const{data:F,error:P}=await tye({client:T,path:{name:t}});if(F)a((F==null?void 0:F.start)??null);else throw new Error(P?String(P):"Failed to fetch schema");o({}),m(JSON.stringify({},null,2)),E(null),v({})}catch(F){d(F instanceof Error?F.message:"Failed to fetch schema"),a(null)}finally{l(!1)}})():(a(null),o({}),m(""),E(null),v({}))},[t,T]);const x=async()=>{if(t)try{C(!0);const M=await w(i);O(M),e(M.handler_id),n&&n()}catch(M){console.error("Failed to run workflow:",M)}finally{C(!1)}},D=!!(r!=null&&r.properties&&Object.keys(r.properties).length>0);return t?A.jsxs("div",{className:"h-full flex flex-col",children:[A.jsxs("div",{className:"p-4 border-b border-border flex items-center justify-between",children:[A.jsxs("h2",{className:"font-semibold text-sm",children:["Configure: ",t]}),n&&A.jsx(Xn,{variant:"ghost",size:"icon-sm",onClick:n,title:"Hide configuration panel (Ctrl+B)",startIcon:A.jsx(XG,{})})]}),A.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[s&&A.jsxs("div",{className:"space-y-4",children:[A.jsx(uf,{className:"h-4 w-32"}),A.jsx(uf,{className:"h-20 w-full"}),A.jsx(uf,{className:"h-4 w-32"}),A.jsx(uf,{className:"h-20 w-full"})]}),u&&A.jsxs("div",{className:"text-destructive text-sm p-3 bg-destructive/10 border border-destructive/20 rounded",children:["Error loading schema: ",u]}),!s&&!u&&A.jsx(A.Fragment,{children:A.jsx("div",{className:"space-y-4",children:D?A.jsx(ace,{schema:r,values:i,onChange:o,onErrorsChange:v}):A.jsxs("div",{className:"space-y-2",children:[A.jsx(Bs,{htmlFor:"raw-input",label:"Input (JSON)"}),A.jsx("div",{className:"font-mono",children:A.jsx(RT,{id:"raw-input",value:f,onChange:M=>{m(M.target.value);try{const F=JSON.parse(M.target.value);o(F),E(null)}catch{E("Invalid JSON")}},placeholder:'{"key": "value"}',variant:h?"error":"default",minRows:8})}),h&&A.jsx("p",{className:"text-xs text-destructive mt-1",children:h})]})})})]}),!s&&!u&&A.jsxs("div",{className:"p-4 border-t border-border",children:[Object.values(b).some(M=>M)&&A.jsx("p",{className:"text-xs text-destructive mb-2",children:"Fix invalid JSON fields before running."}),A.jsx(Xn,{onClick:x,disabled:y||Object.values(b).some(M=>M),fullWidth:!0,label:y?"Starting...":"Run Workflow"})]})]}):A.jsxs("div",{className:"h-full flex flex-col",children:[A.jsxs("div",{className:"p-4 border-b border-border flex items-center justify-between",children:[A.jsx("h2",{className:"font-semibold text-sm",children:"Workflow Configuration"}),n&&A.jsx(Xn,{variant:"ghost",size:"icon-sm",onClick:n,title:"Hide configuration panel (Ctrl+B)",startIcon:A.jsx(XG,{})})]}),A.jsx("div",{className:"flex-1 flex items-center justify-center",children:A.jsx("p",{className:"text-muted-foreground text-center",children:"Select a workflow to configure and run"})})]})}function SYe(t,e,n=!0){N.useEffect(()=>{const r=a=>{(n&&a.ctrlKey&&a.key.toLowerCase()===t.toLowerCase()||!n&&a.key.toLowerCase()===t.toLowerCase())&&(a.preventDefault(),e())};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[t,e,n])}function vYe(){if(typeof window>"u")return eA();const e=new URLSearchParams(window.location.search).get("api");return e?e.endsWith("/")?e.slice(0,-1):e:eA()}function yYe(){const[t,e]=N.useState(vYe),[n,r]=N.useState(t),[a,i]=N.useState(null),[o,s]=N.useState(null),{state:l,sync:u}=L3e(),[d,f]=N.useState(37.5),[m,h]=N.useState(!1),[E,b]=N.useState(!1),[v,y]=N.useState(!1),[C,T]=N.useState(null),[w,O]=N.useState(null),x=l.workflows,D=pd(),M=N.useCallback(async()=>{try{O(null);const{data:K,error:G}=await nye({client:D});if(G)throw new Error(String(G));K&&K.status?T(!0):(T(!1),O("Workflow server is unreachable"))}catch{T(!1),O("Workflow server is unreachable")}},[D]);N.useEffect(()=>{D.setConfig({baseUrl:t}),M(),u()},[t,D,M,u]);const F=()=>{const K=n.endsWith("/")?n.slice(0,-1):n;e(K)},P=()=>{const K=eA();e(K),r(K)},q=K=>{s(K)},j=K=>{K.preventDefault(),h(!0)},Q=N.useCallback(K=>{const G=document.querySelector(".main-content-area");if(!G)return;const Y=G.getBoundingClientRect(),W=(K.clientX-Y.left)/Y.width*100,J=Math.max(20,Math.min(80,W));f(J)},[]),U=N.useCallback(()=>{h(!1)},[]);return N.useEffect(()=>{if(m)return document.addEventListener("mousemove",Q),document.addEventListener("mouseup",U),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Q),document.removeEventListener("mouseup",U),document.body.style.cursor="",document.body.style.userSelect=""}},[m,Q,U]),SYe("b",N.useCallback(()=>{y(K=>!K)},[]),!0),A.jsxs("div",{className:`h-screen flex flex-col bg-background ${m?"resize-active":""}`,children:[A.jsxs("div",{className:"flex items-center justify-between h-12 px-4 bg-card border-b border-border",children:[A.jsxs("div",{className:"flex items-center gap-4",children:[A.jsx(Xn,{variant:"ghost",size:"icon-sm",onClick:()=>b(!E),title:E?"Show sidebar":"Hide sidebar",startIcon:E?A.jsx(IEe,{}):A.jsx(OEe,{})}),A.jsx("h1",{className:"text-md font-semibold",children:"Workflow Debugger"})]}),A.jsxs("div",{className:"flex items-center gap-2",children:[A.jsx("div",{className:"flex items-center",children:A.jsx(Bs,{htmlFor:"workflow",label:"Workflow:",variant:"standalone"})}),A.jsx("div",{className:"w-48",children:A.jsxs(Sx,{value:a||"",onValueChange:i,children:[A.jsx(TT,{id:"workflow",placeholder:"Select workflow..."}),A.jsx(CT,{children:Object.keys(x).map(K=>A.jsx(Gh,{value:K,label:K},K))})]})})]}),A.jsxs("div",{className:"flex items-center gap-2",children:[C!==null&&A.jsx("span",{className:`${C?"bg-green-500":"bg-red-500"} h-2 w-2 rounded-full`}),C===!1&&A.jsx("span",{className:"text-destructive text-xs",children:w||"Workflow server is unreachable"}),A.jsxs(I0e,{children:[A.jsx(D0e,{asChild:!0,children:A.jsx(Xn,{variant:"ghost",size:"icon-sm",startIcon:A.jsx(FEe,{})})}),A.jsx(iG,{className:"w-80",children:A.jsx("div",{className:"space-y-4",children:A.jsxs("div",{className:"space-y-2",children:[A.jsx("h4",{className:"font-medium text-sm",children:"API Configuration"}),A.jsx(OT,{value:n,onChange:K=>r(K.target.value),placeholder:"http://localhost:8000"}),A.jsxs("div",{className:"flex gap-2",children:[A.jsx(Xn,{onClick:F,variant:"outline",size:"sm",disabled:n===t,label:"Save"}),A.jsx(Xn,{onClick:P,variant:"outline",size:"sm",label:"Reset"})]}),A.jsxs("p",{className:"text-xs text-muted-foreground",children:["Current: ",t]})]})})})]})]})]}),A.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[!E&&A.jsx("div",{className:"w-48 border-r border-border bg-card overflow-hidden transition-all duration-200",children:A.jsx(bYe,{activeHandlerId:o,onHandlerSelect:s})}),A.jsxs("div",{className:"flex-1 flex overflow-hidden main-content-area",children:[v?A.jsx("div",{className:"w-10 border-r border-border bg-muted/30 flex flex-col items-center justify-center hover:bg-muted/50 transition-colors",children:A.jsx(Xn,{variant:"ghost",size:"icon-sm",onClick:()=>y(!1),title:"Show configuration panel (Ctrl+B)",startIcon:A.jsx(DEe,{})})}):A.jsxs(A.Fragment,{children:[A.jsx("div",{className:"border-r border-border overflow-auto",style:{width:`${d}%`},children:a&&A.jsx(EYe,{selectedWorkflow:a,onRunStart:q,activeHandlerId:o,onCollapse:()=>y(!0)})}),A.jsx("div",{className:`w-2 hover:bg-gray-500/20 hover:shadow-lg cursor-col-resize flex-shrink-0 transition-all duration-200 relative group border-l border-r border-border ${m?"shadow-xl":""}`,onMouseDown:j,title:"Drag to resize panels"})]}),A.jsx("div",{className:"overflow-auto",style:{width:v?"calc(100% - 40px)":`${100-d}%`},children:o&&A.jsx(_Ye,{handlerId:o,selectedWorkflow:a})})]})]})]})}class TYe extends Oe.Component{constructor(n){super(n);Fe(this,"resetError",()=>{this.setState({hasError:!1,error:void 0})});this.state={hasError:!1}}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,r){console.error("ErrorBoundary caught an error:",n,r)}render(){if(this.state.hasError&&this.state.error){if(this.props.fallback){const n=this.props.fallback;return A.jsx(n,{error:this.state.error,resetError:this.resetError})}return A.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:A.jsxs("div",{className:"max-w-md p-6 bg-card border border-border rounded-lg shadow-sm",children:[A.jsx("h2",{className:"text-lg font-semibold text-destructive mb-2",children:"Something went wrong"}),A.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"The workflow debugger encountered an error. This might happen if the workflow server is unreachable."}),A.jsxs("details",{className:"mb-4",children:[A.jsx("summary",{className:"text-sm font-medium cursor-pointer hover:text-foreground",children:"Error Details"}),A.jsx("pre",{className:"mt-2 text-xs bg-muted p-3 rounded border overflow-auto",children:this.state.error.message})]}),A.jsxs("div",{className:"flex gap-2",children:[A.jsx("button",{onClick:this.resetError,className:"px-3 py-2 text-sm bg-primary text-primary-foreground rounded hover:bg-primary/90 transition-colors",children:"Try Again"}),A.jsx("button",{onClick:()=>window.location.reload(),className:"px-3 py-2 text-sm bg-secondary text-secondary-foreground rounded hover:bg-secondary/90 transition-colors",children:"Reload Page"})]})]})})}return this.props.children}}function CYe(){const t=eA(),e=Vq({baseUrl:t});return A.jsx(TYe,{children:A.jsx(sye,{clients:{workflowsClient:e},children:A.jsx(yYe,{})})})}function ice(){const t=window.matchMedia("(prefers-color-scheme: dark)").matches;document.documentElement.classList.toggle("dark",t)}ice(),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",ice),ege.createRoot(document.getElementById("root")).render(A.jsx(N.StrictMode,{children:A.jsx(CYe,{})}));const Si=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),cB=[.001,0,0,.001,0,0],uB=1.35,Eo={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},ql={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},ME="pdfjs_internal_editor_",Pt={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},cn={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_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},oce={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},Ua={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},LE={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Xr={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},Rg={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},PE={ERRORS:0,WARNINGS:1,INFOS:5},wg={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,rawFillPath:94},$A={moveTo:0,lineTo:1,curveTo:2,closePath:3},sce={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let YA=PE.WARNINGS;function AYe(t){Number.isInteger(t)&&(YA=t)}function RYe(){return YA}function VA(t){YA>=PE.INFOS&&console.info(`Info: ${t}`)}function Ft(t){YA>=PE.WARNINGS&&console.warn(`Warning: ${t}`)}function er(t){throw new Error(t)}function pn(t,e){t||er(e)}function wYe(t){switch(t==null?void 0:t.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function dB(t,e=null,n=null){if(!t)return null;if(n&&typeof t=="string"){if(n.addDefaultProtocol&&t.startsWith("www.")){const a=t.match(/\./g);(a==null?void 0:a.length)>=2&&(t=`http://${t}`)}if(n.tryConvertEncoding)try{t=DYe(t)}catch{}}const r=e?URL.parse(t,e):URL.parse(t);return wYe(r)?r:null}function pB(t,e,n=!1){const r=URL.parse(t);return r?(r.hash=e,r.href):n&&dB(t,"http://example.com")?t.split("#",1)[0]+`${e?`#${e}`:""}`:""}function jt(t,e,n,r=!1){return Object.defineProperty(t,e,{value:n,enumerable:!r,configurable:!0,writable:!1}),n}const Mf=(function(){function e(n,r){this.message=n,this.name=r}return e.prototype=new Error,e.constructor=e,e})();class lce extends Mf{constructor(e,n){super(e,"PasswordException"),this.code=n}}class fB extends Mf{constructor(e,n){super(e,"UnknownErrorException"),this.details=n}}class jA extends Mf{constructor(e){super(e,"InvalidPDFException")}}class FE extends Mf{constructor(e,n,r){super(e,"ResponseException"),this.status=n,this.missing=r}}class xYe extends Mf{constructor(e){super(e,"FormatError")}}class $c extends Mf{constructor(e){super(e,"AbortException")}}function cce(t){(typeof t!="object"||(t==null?void 0:t.length)===void 0)&&er("Invalid argument for bytesToString");const e=t.length,n=8192;if(e<n)return String.fromCharCode.apply(null,t);const r=[];for(let a=0;a<e;a+=n){const i=Math.min(a+n,e),o=t.subarray(a,i);r.push(String.fromCharCode.apply(null,o))}return r.join("")}function BE(t){typeof t!="string"&&er("Invalid argument for stringToBytes");const e=t.length,n=new Uint8Array(e);for(let r=0;r<e;++r)n[r]=t.charCodeAt(r)&255;return n}function NYe(t){return String.fromCharCode(t>>24&255,t>>16&255,t>>8&255,t&255)}function OYe(){const t=new Uint8Array(4);return t[0]=1,new Uint32Array(t.buffer,0,1)[0]===1}function IYe(){try{return new Function(""),!0}catch{return!1}}class Ra{static get isLittleEndian(){return jt(this,"isLittleEndian",OYe())}static get isEvalSupported(){return jt(this,"isEvalSupported",IYe())}static get isOffscreenCanvasSupported(){return jt(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return jt(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get platform(){const{platform:e,userAgent:n}=navigator;return jt(this,"platform",{isAndroid:n.includes("Android"),isLinux:e.includes("Linux"),isMac:e.includes("Mac"),isWindows:e.includes("Win"),isFirefox:n.includes("Firefox")})}static get isCSSRoundSupported(){var e,n;return jt(this,"isCSSRoundSupported",(n=(e=globalThis.CSS)==null?void 0:e.supports)==null?void 0:n.call(e,"width: round(1.5px, 1px)"))}}const mB=Array.from(Array(256).keys(),t=>t.toString(16).padStart(2,"0"));class at{static makeHexColor(e,n,r){return`#${mB[e]}${mB[n]}${mB[r]}`}static domMatrixToTransform(e){return[e.a,e.b,e.c,e.d,e.e,e.f]}static scaleMinMax(e,n){let r;e[0]?(e[0]<0&&(r=n[0],n[0]=n[2],n[2]=r),n[0]*=e[0],n[2]*=e[0],e[3]<0&&(r=n[1],n[1]=n[3],n[3]=r),n[1]*=e[3],n[3]*=e[3]):(r=n[0],n[0]=n[1],n[1]=r,r=n[2],n[2]=n[3],n[3]=r,e[1]<0&&(r=n[1],n[1]=n[3],n[3]=r),n[1]*=e[1],n[3]*=e[1],e[2]<0&&(r=n[0],n[0]=n[2],n[2]=r),n[0]*=e[2],n[2]*=e[2]),n[0]+=e[4],n[1]+=e[5],n[2]+=e[4],n[3]+=e[5]}static transform(e,n){return[e[0]*n[0]+e[2]*n[1],e[1]*n[0]+e[3]*n[1],e[0]*n[2]+e[2]*n[3],e[1]*n[2]+e[3]*n[3],e[0]*n[4]+e[2]*n[5]+e[4],e[1]*n[4]+e[3]*n[5]+e[5]]}static multiplyByDOMMatrix(e,n){return[e[0]*n.a+e[2]*n.b,e[1]*n.a+e[3]*n.b,e[0]*n.c+e[2]*n.d,e[1]*n.c+e[3]*n.d,e[0]*n.e+e[2]*n.f+e[4],e[1]*n.e+e[3]*n.f+e[5]]}static applyTransform(e,n,r=0){const a=e[r],i=e[r+1];e[r]=a*n[0]+i*n[2]+n[4],e[r+1]=a*n[1]+i*n[3]+n[5]}static applyTransformToBezier(e,n,r=0){const a=n[0],i=n[1],o=n[2],s=n[3],l=n[4],u=n[5];for(let d=0;d<6;d+=2){const f=e[r+d],m=e[r+d+1];e[r+d]=f*a+m*o+l,e[r+d+1]=f*i+m*s+u}}static applyInverseTransform(e,n){const r=e[0],a=e[1],i=n[0]*n[3]-n[1]*n[2];e[0]=(r*n[3]-a*n[2]+n[2]*n[5]-n[4]*n[3])/i,e[1]=(-r*n[1]+a*n[0]+n[4]*n[1]-n[5]*n[0])/i}static axialAlignedBoundingBox(e,n,r){const a=n[0],i=n[1],o=n[2],s=n[3],l=n[4],u=n[5],d=e[0],f=e[1],m=e[2],h=e[3];let E=a*d+l,b=E,v=a*m+l,y=v,C=s*f+u,T=C,w=s*h+u,O=w;if(i!==0||o!==0){const x=i*d,D=i*m,M=o*f,F=o*h;E+=M,y+=M,v+=F,b+=F,C+=x,O+=x,w+=D,T+=D}r[0]=Math.min(r[0],E,v,b,y),r[1]=Math.min(r[1],C,w,T,O),r[2]=Math.max(r[2],E,v,b,y),r[3]=Math.max(r[3],C,w,T,O)}static inverseTransform(e){const n=e[0]*e[3]-e[1]*e[2];return[e[3]/n,-e[1]/n,-e[2]/n,e[0]/n,(e[2]*e[5]-e[4]*e[3])/n,(e[4]*e[1]-e[5]*e[0])/n]}static singularValueDecompose2dScale(e,n){const r=e[0],a=e[1],i=e[2],o=e[3],s=r**2+a**2,l=r*i+a*o,u=i**2+o**2,d=(s+u)/2,f=Math.sqrt(d**2-(s*u-l**2));n[0]=Math.sqrt(d+f||1),n[1]=Math.sqrt(d-f||1)}static normalizeRect(e){const n=e.slice(0);return e[0]>e[2]&&(n[0]=e[2],n[2]=e[0]),e[1]>e[3]&&(n[1]=e[3],n[3]=e[1]),n}static intersect(e,n){const r=Math.max(Math.min(e[0],e[2]),Math.min(n[0],n[2])),a=Math.min(Math.max(e[0],e[2]),Math.max(n[0],n[2]));if(r>a)return null;const i=Math.max(Math.min(e[1],e[3]),Math.min(n[1],n[3])),o=Math.min(Math.max(e[1],e[3]),Math.max(n[1],n[3]));return i>o?null:[r,i,a,o]}static pointBoundingBox(e,n,r){r[0]=Math.min(r[0],e),r[1]=Math.min(r[1],n),r[2]=Math.max(r[2],e),r[3]=Math.max(r[3],n)}static rectBoundingBox(e,n,r,a,i){i[0]=Math.min(i[0],e,r),i[1]=Math.min(i[1],n,a),i[2]=Math.max(i[2],e,r),i[3]=Math.max(i[3],n,a)}static bezierBoundingBox(e,n,r,a,i,o,s,l,u){u[0]=Math.min(u[0],e,s),u[1]=Math.min(u[1],n,l),u[2]=Math.max(u[2],e,s),u[3]=Math.max(u[3],n,l),X(this,jc,d7).call(this,e,r,i,s,n,a,o,l,3*(-e+3*(r-i)+s),6*(e-2*r+i),3*(r-e),u),X(this,jc,d7).call(this,e,r,i,s,n,a,o,l,3*(-n+3*(a-o)+l),6*(n-2*a+o),3*(a-n),u)}}jc=new WeakSet,K1=function(e,n,r,a,i,o,s,l,u,d){if(u<=0||u>=1)return;const f=1-u,m=u*u,h=m*u,E=f*(f*(f*e+3*u*n)+3*m*r)+h*a,b=f*(f*(f*i+3*u*o)+3*m*s)+h*l;d[0]=Math.min(d[0],E),d[1]=Math.min(d[1],b),d[2]=Math.max(d[2],E),d[3]=Math.max(d[3],b)},d7=function(e,n,r,a,i,o,s,l,u,d,f,m){if(Math.abs(u)<1e-12){Math.abs(d)>=1e-12&&X(this,jc,K1).call(this,e,n,r,a,i,o,s,l,-f/d,m);return}const h=d**2-4*f*u;if(h<0)return;const E=Math.sqrt(h),b=2*u;X(this,jc,K1).call(this,e,n,r,a,i,o,s,l,(-d+E)/b,m),X(this,jc,K1).call(this,e,n,r,a,i,o,s,l,(-d-E)/b,m)},V(at,jc);function DYe(t){return decodeURIComponent(escape(t))}let hB=null,uce=null;function dce(t){return hB||(hB=/([\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,uce=new Map([["ſt","ſt"]])),t.replaceAll(hB,(e,n,r)=>n?n.normalize("NFKC"):uce.get(r))}function gB(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const t=new Uint8Array(32);return crypto.getRandomValues(t),cce(t)}const _B="pdfjs_internal_id_";function kYe(t,e,n){if(!Array.isArray(n)||n.length<2)return!1;const[r,a,...i]=n;if(!t(r)&&!Number.isInteger(r)||!e(a))return!1;const o=i.length;let s=!0;switch(a.name){case"XYZ":if(o<2||o>3)return!1;break;case"Fit":case"FitB":return o===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(o>1)return!1;break;case"FitR":if(o!==4)return!1;s=!1;break;default:return!1}for(const l of i)if(!(typeof l=="number"||s&&l===null))return!1;return!0}function ri(t,e,n){return Math.min(Math.max(t,e),n)}function pce(t){return Uint8Array.prototype.toBase64?t.toBase64():btoa(cce(t))}function MYe(t){return Uint8Array.fromBase64?Uint8Array.fromBase64(t):BE(atob(t))}typeof Promise.try!="function"&&(Promise.try=function(t,...e){return new Promise(n=>{n(t(...e))})}),typeof Math.sumPrecise!="function"&&(Math.sumPrecise=function(t){return t.reduce((e,n)=>e+n,0)});class UE{static textContent(e){const n=[],r={items:n,styles:Object.create(null)};function a(i){var l;if(!i)return;let o=null;const s=i.name;if(s==="#text")o=i.value;else if(UE.shouldBuildText(s))(l=i==null?void 0:i.attributes)!=null&&l.textContent?o=i.attributes.textContent:i.value&&(o=i.value);else return;if(o!==null&&n.push({str:o}),!!i.children)for(const u of i.children)a(u)}return a(e),r}static shouldBuildText(e){return!(e==="textarea"||e==="input"||e==="option"||e==="select")}}class bB{static setupStorage(e,n,r,a,i){const o=a.getValue(n,{value:null});switch(r.name){case"textarea":if(o.value!==null&&(e.textContent=o.value),i==="print")break;e.addEventListener("input",s=>{a.setValue(n,{value:s.target.value})});break;case"input":if(r.attributes.type==="radio"||r.attributes.type==="checkbox"){if(o.value===r.attributes.xfaOn?e.setAttribute("checked",!0):o.value===r.attributes.xfaOff&&e.removeAttribute("checked"),i==="print")break;e.addEventListener("change",s=>{a.setValue(n,{value:s.target.checked?s.target.getAttribute("xfaOn"):s.target.getAttribute("xfaOff")})})}else{if(o.value!==null&&e.setAttribute("value",o.value),i==="print")break;e.addEventListener("input",s=>{a.setValue(n,{value:s.target.value})})}break;case"select":if(o.value!==null){e.setAttribute("value",o.value);for(const s of r.children)s.attributes.value===o.value?s.attributes.selected=!0:s.attributes.hasOwnProperty("selected")&&delete s.attributes.selected}e.addEventListener("input",s=>{const l=s.target.options,u=l.selectedIndex===-1?"":l[l.selectedIndex].value;a.setValue(n,{value:u})});break}}static setAttributes({html:e,element:n,storage:r=null,intent:a,linkService:i}){const{attributes:o}=n,s=e instanceof HTMLAnchorElement;o.type==="radio"&&(o.name=`${o.name}-${a}`);for(const[l,u]of Object.entries(o))if(u!=null)switch(l){case"class":u.length&&e.setAttribute(l,u.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",u);break;case"style":Object.assign(e.style,u);break;case"textContent":e.textContent=u;break;default:(!s||l!=="href"&&l!=="newWindow")&&e.setAttribute(l,u)}s&&i.addLinkAttributes(e,o.href,o.newWindow),r&&o.dataId&&this.setupStorage(e,o.dataId,n,r)}static render(e){var f,m;const n=e.annotationStorage,r=e.linkService,a=e.xfaHtml,i=e.intent||"display",o=document.createElement(a.name);a.attributes&&this.setAttributes({html:o,element:a,intent:i,linkService:r});const s=i!=="richText",l=e.div;if(l.append(o),e.viewport){const h=`matrix(${e.viewport.transform.join(",")})`;l.style.transform=h}s&&l.setAttribute("class","xfaLayer xfaFont");const u=[];if(a.children.length===0){if(a.value){const h=document.createTextNode(a.value);o.append(h),s&&UE.shouldBuildText(a.name)&&u.push(h)}return{textDivs:u}}const d=[[a,-1,o]];for(;d.length>0;){const[h,E,b]=d.at(-1);if(E+1===h.children.length){d.pop();continue}const v=h.children[++d.at(-1)[1]];if(v===null)continue;const{name:y}=v;if(y==="#text"){const T=document.createTextNode(v.value);u.push(T),b.append(T);continue}const C=(f=v==null?void 0:v.attributes)!=null&&f.xmlns?document.createElementNS(v.attributes.xmlns,y):document.createElement(y);if(b.append(C),v.attributes&&this.setAttributes({html:C,element:v,storage:n,intent:i,linkService:r}),((m=v.children)==null?void 0:m.length)>0)d.push([v,-1,C]);else if(v.value){const T=document.createTextNode(v.value);s&&UE.shouldBuildText(y)&&u.push(T),C.append(T)}}for(const h of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))h.setAttribute("readOnly",!0);return{textDivs:u}}static update(e){const n=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=n,e.div.hidden=!1}}const Yc="http://www.w3.org/2000/svg",Gf=class Gf{};Fe(Gf,"CSS",96),Fe(Gf,"PDF",72),Fe(Gf,"PDF_TO_CSS_UNITS",Gf.CSS/Gf.PDF);let Vc=Gf;async function xg(t,e="text"){if(qE(t,document.baseURI)){const n=await fetch(t);if(!n.ok)throw new Error(n.statusText);switch(e){case"arraybuffer":return n.arrayBuffer();case"blob":return n.blob();case"json":return n.json()}return n.text()}return new Promise((n,r)=>{const a=new XMLHttpRequest;a.open("GET",t,!0),a.responseType=e,a.onreadystatechange=()=>{if(a.readyState===XMLHttpRequest.DONE){if(a.status===200||a.status===0){switch(e){case"arraybuffer":case"blob":case"json":n(a.response);return}n(a.responseText);return}r(new Error(a.statusText))}},a.send(null)})}class GE{constructor({viewBox:e,userUnit:n,scale:r,rotation:a,offsetX:i=0,offsetY:o=0,dontFlip:s=!1}){this.viewBox=e,this.userUnit=n,this.scale=r,this.rotation=a,this.offsetX=i,this.offsetY=o,r*=n;const l=(e[2]+e[0])/2,u=(e[3]+e[1])/2;let d,f,m,h;switch(a%=360,a<0&&(a+=360),a){case 180:d=-1,f=0,m=0,h=1;break;case 90:d=0,f=1,m=1,h=0;break;case 270:d=0,f=-1,m=-1,h=0;break;case 0:d=1,f=0,m=0,h=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}s&&(m=-m,h=-h);let E,b,v,y;d===0?(E=Math.abs(u-e[1])*r+i,b=Math.abs(l-e[0])*r+o,v=(e[3]-e[1])*r,y=(e[2]-e[0])*r):(E=Math.abs(l-e[0])*r+i,b=Math.abs(u-e[1])*r+o,v=(e[2]-e[0])*r,y=(e[3]-e[1])*r),this.transform=[d*r,f*r,m*r,h*r,E-d*r*l-m*r*u,b-f*r*l-h*r*u],this.width=v,this.height=y}get rawDims(){const e=this.viewBox;return jt(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:e=this.scale,rotation:n=this.rotation,offsetX:r=this.offsetX,offsetY:a=this.offsetY,dontFlip:i=!1}={}){return new GE({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:e,rotation:n,offsetX:r,offsetY:a,dontFlip:i})}convertToViewportPoint(e,n){const r=[e,n];return at.applyTransform(r,this.transform),r}convertToViewportRectangle(e){const n=[e[0],e[1]];at.applyTransform(n,this.transform);const r=[e[2],e[3]];return at.applyTransform(r,this.transform),[n[0],n[1],r[0],r[1]]}convertToPdfPoint(e,n){const r=[e,n];return at.applyInverseTransform(r,this.transform),r}}class WA extends Mf{constructor(e,n=0){super(e,"RenderingCancelledException"),this.extraDelay=n}}function zE(t){const e=t.length;let n=0;for(;n<e&&t[n].trim()==="";)n++;return t.substring(n,n+5).toLowerCase()==="data:"}function KA(t){return typeof t=="string"&&/\.pdf$/i.test(t)}function fce(t){return[t]=t.split(/[#?]/,1),t.substring(t.lastIndexOf("/")+1)}function mce(t,e="document.pdf"){if(typeof t!="string")return e;if(zE(t))return Ft('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const r=(s=>{try{return new URL(s)}catch{try{return new URL(decodeURIComponent(s))}catch{try{return new URL(s,"https://foo.bar")}catch{try{return new URL(decodeURIComponent(s),"https://foo.bar")}catch{return null}}}}})(t);if(!r)return e;const a=s=>{try{let l=decodeURIComponent(s);return l.includes("/")?(l=l.split("/").at(-1),l.test(/^\.pdf$/i)?l:s):l}catch{return s}},i=/\.pdf$/i,o=r.pathname.split("/").at(-1);if(i.test(o))return a(o);if(r.searchParams.size>0){const s=Array.from(r.searchParams.values()).reverse();for(const u of s)if(i.test(u))return a(u);const l=Array.from(r.searchParams.keys()).reverse();for(const u of l)if(i.test(u))return a(u)}if(r.hash){const l=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(r.hash);if(l)return a(l[0])}return e}class hce{constructor(){Fe(this,"started",Object.create(null));Fe(this,"times",[])}time(e){e in this.started&&Ft(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||Ft(`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 n=0;for(const{name:r}of this.times)n=Math.max(r.length,n);for(const{name:r,start:a,end:i}of this.times)e.push(`${r.padEnd(n)} ${i-a}ms
|
|
655
|
+
M${M.x},${M.y}h${M.width}v${M.height}h${-M.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}rce.displayName="MiniMap",N.memo(rce);const cYe=t=>e=>t?`${Math.max(1/e.transform[2],1)}`:void 0,uYe={[Cg.Line]:"right",[Cg.Handle]:"bottom-right"};function dYe({nodeId:t,position:e,variant:n=Cg.Handle,className:r,style:a=void 0,children:i,color:o,minWidth:s=10,minHeight:l=10,maxWidth:u=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:m,autoScale:h=!0,shouldResize:E,onResizeStart:b,onResize:v,onResizeEnd:y}){const C=Ale(),T=typeof t=="string"?t:C,w=Er(),O=N.useRef(null),x=n===Cg.Handle,D=mn(N.useCallback(cYe(x&&h),[x,h]),Nr),M=N.useRef(null),F=e??uYe[n];N.useEffect(()=>{if(!(!O.current||!T))return M.current||(M.current=Hqe({domNode:O.current,nodeId:T,getStoreItems:()=>{const{nodeLookup:q,transform:j,snapGrid:Q,snapToGrid:U,nodeOrigin:K,domNode:G}=w.getState();return{nodeLookup:q,transform:j,snapGrid:Q,snapToGrid:U,nodeOrigin:K,paneDomNode:G}},onChange:(q,j)=>{const{triggerNodeChanges:Q,nodeLookup:U,parentLookup:K,nodeOrigin:G}=w.getState(),Y=[],W={x:q.x,y:q.y},J=U.get(T);if(J&&J.expandParent&&J.parentId){const $=J.origin??G,Z=q.width??J.measured.width??0,te=q.height??J.measured.height??0,B={id:J.id,parentId:J.parentId,rect:{width:Z,height:te,...vse({x:q.x??J.position.x,y:q.y??J.position.y},{width:Z,height:te},J.parentId,U,$)}},ae=X5([B],U,K,G);Y.push(...ae),W.x=q.x?Math.max($[0]*Z,q.x):void 0,W.y=q.y?Math.max($[1]*te,q.y):void 0}if(W.x!==void 0&&W.y!==void 0){const $={id:T,type:"position",position:{...W}};Y.push($)}if(q.width!==void 0&&q.height!==void 0){const Z={id:T,type:"dimensions",resizing:!0,setAttributes:m?m==="horizontal"?"width":"height":!0,dimensions:{width:q.width,height:q.height}};Y.push(Z)}for(const $ of j){const Z={...$,type:"position"};Y.push(Z)}Q(Y)},onEnd:({width:q,height:j})=>{const Q={id:T,type:"dimensions",resizing:!1,dimensions:{width:q,height:j}};w.getState().triggerNodeChanges([Q])}})),M.current.update({controlPosition:F,boundaries:{minWidth:s,minHeight:l,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:m,onResizeStart:b,onResize:v,onResizeEnd:y,shouldResize:E}),()=>{var q;(q=M.current)==null||q.destroy()}},[F,s,l,u,d,f,b,v,y,E]);const P=F.split("-");return A.jsx("div",{className:ra(["react-flow__resize-control","nodrag",...P,n,r]),ref:O,style:{...a,scale:D,...o&&{[x?"backgroundColor":"borderColor"]:o}},children:i})}N.memo(dYe);function pYe({workflowName:t,className:e="w-full h-[600px]",events:n,onNodeClick:r,highlightedNodeId:a,selectedNodeId:i,isComplete:o=!1}){const[s,l,u]=B$e([]),[d,f,m]=U$e([]),[h,E]=N.useState(!1),[b,v]=N.useState(null),[y,C]=N.useState(-1),[T,w]=N.useState(()=>{if(typeof window>"u")return!1;try{return document.documentElement.classList.contains("dark")?!0:window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches}catch{return!1}}),O=N.useMemo(()=>({step:({data:P,id:q})=>{const j=a===q,Q=i===q;let U={transition:"all 1s ease-out"};return P.highlightColor&&P.highlightColor!==null?(U.backgroundColor=T?void 0:"#CCFBEF",U.borderColor=P.highlightColor,U.boxShadow=`0 0 0 3px ${P.highlightColor}66`):P.highlightColor===null&&(U.backgroundColor=T?"#0b1220":"#E6EEFF",U.borderColor=T?"#274690":"#7EA6FF",U.boxShadow="0 0 0 0px transparent"),Q?U={backgroundColor:T?"#1e3a8a":"#DBEAFE",borderColor:"#3B82F6",boxShadow:"0 0 0 4px #3B82F6",transition:"all 1s ease-out"}:j&&(U={...U,borderColor:"#10B981",boxShadow:"0 0 0 3px #10B98166"}),A.jsxs("div",{className:"px-4 py-2 shadow-md rounded-md min-w-[160px] cursor-pointer transition-all bg-[#E6EEFF] border-2 border-[#7EA6FF] dark:bg-[#0b1220] dark:border-[#274690] hover:shadow-lg hover:scale-105",style:U,onClick:()=>r==null?void 0:r(q),children:[A.jsx(zl,{type:"target",position:vt.Left}),A.jsxs("div",{className:"flex items-center justify-between gap-2",children:[A.jsx("div",{className:"font-bold text-[#1E3A8A] text-sm dark:text-[#e5edff]",children:P.label}),P.workerCount>0&&A.jsx("div",{className:"flex items-center justify-center min-w-[20px] h-[20px] px-1.5 rounded-full bg-[#10B981] text-white text-[10px] font-bold",children:P.workerCount})]}),P.title&&A.jsx("div",{className:"text-xs text-[#1D4ED8] mt-1 dark:text-[#9db4ff]",children:P.title}),(P.lastInputEvent||P.lastOutputEvent)&&A.jsxs("div",{className:"text-[10px] text-gray-700 dark:text-gray-300 mt-1",children:[P.lastInputEvent&&A.jsxs("div",{children:[A.jsx("span",{className:"font-semibold",children:"in:"})," ",P.lastInputEvent]}),P.lastOutputEvent&&A.jsxs("div",{children:[A.jsx("span",{className:"font-semibold",children:"out:"})," ",P.lastOutputEvent]})]}),A.jsx(zl,{type:"source",position:vt.Right})]})},event:({data:P,id:q})=>{const j=a===q,Q=i===q;let U={transition:"all 1s ease-out"};return P.highlightColor&&P.highlightColor!==null?(U.backgroundColor=T?void 0:"#FFE8B5",U.borderColor=P.highlightColor,U.boxShadow=`0 0 0 3px ${P.highlightColor}66`):P.highlightColor===null&&(U.backgroundColor=T?"#241a06":"#FFF3BF",U.borderColor=T?"#F59E0B":"#FFD166",U.boxShadow="0 0 0 0px transparent"),Q?U={backgroundColor:T?"#1e3a8a":"#DBEAFE",borderColor:"#3B82F6",boxShadow:"0 0 0 4px #3B82F6",transition:"all 1s ease-out"}:j&&(U={...U,borderColor:"#10B981",boxShadow:"0 0 0 3px #10B98166"}),A.jsxs("div",{className:"px-3 py-2 shadow-md rounded-full min-w-[140px] text-center cursor-pointer transition-all bg-[#FFF3BF] border-2 border-[#FFD166] dark:bg-[#241a06] dark:border-[#F59E0B] hover:shadow-lg hover:scale-105",style:U,onClick:()=>r==null?void 0:r(q),children:[A.jsx(zl,{type:"target",position:vt.Left}),A.jsx("div",{className:"font-bold text-[#92400E] text-sm dark:text-[#fde68a]",children:P.label}),P.event_type&&A.jsx("div",{className:"text-xs text-[#B45309] mt-1 dark:text-[#fbbf24]",children:P.event_type}),A.jsx(zl,{type:"source",position:vt.Right})]})},external:({data:P,id:q})=>{const j=a===q,Q=i===q;let U=P.highlightColor?{backgroundColor:T?void 0:"#FFE5D4",borderColor:P.highlightColor,boxShadow:`0 0 0 3px ${P.highlightColor}66`}:void 0;return Q?U={backgroundColor:T?"#1e3a8a":"#DBEAFE",borderColor:"#3B82F6",boxShadow:"0 0 0 4px #3B82F6"}:j&&(U={backgroundColor:U==null?void 0:U.backgroundColor,borderColor:"#10B981",boxShadow:"0 0 0 3px #10B98166"}),A.jsxs("div",{className:"px-3 py-2 shadow-md rounded-lg min-w-[140px] text-center cursor-pointer transition-all bg-[#FFEDD5] border-2 border-[#FB923C] dark:bg-[#1f0f08] dark:border-[#ea7a3a] hover:shadow-lg hover:scale-105",style:U,onClick:()=>r==null?void 0:r(q),children:[A.jsx(zl,{type:"target",position:vt.Left}),A.jsx("div",{className:"font-bold text-[#7C2D12] text-sm dark:text-[#fed7aa]",children:P.label}),P.title&&A.jsx("div",{className:"text-xs text-[#C2410C] mt-1 dark:text-[#fdba74]",children:P.title}),A.jsx(zl,{type:"source",position:vt.Right})]})}}),[T,a,i,r]);N.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const P=window.matchMedia("(prefers-color-scheme: dark)"),q=j=>w(j.matches);return P.addEventListener?P.addEventListener("change",q):P.addListener(q),()=>{P.removeEventListener?P.removeEventListener("change",q):P.removeListener(q)}},[]);const x=pd(),D=N.useCallback(P=>f(q=>Ise(P,q)),[f]),M=N.useCallback(P=>{const q=new Map,j=new Map;P.nodes.forEach($=>{q.set($.id,[]),j.set($.id,0)}),P.edges.forEach(({source:$,target:Z})=>{var te;(te=q.get($))==null||te.push(Z),j.set(Z,(j.get(Z)||0)+1)});const Q=[];j.forEach(($,Z)=>{$===0&&Q.push(Z)});const U=new Map;for(Q.forEach($=>U.set($,0));Q.length;){const $=Q.shift(),Z=U.get($)??0;for(const te of q.get($)||[]){const B=Math.max(Z+1,U.get(te)??0);U.set(te,B),j.set(te,(j.get(te)||0)-1),(j.get(te)||0)===0&&Q.push(te)}}const K={};P.nodes.forEach($=>{const Z=U.get($.id)??0;K[Z]||(K[Z]=[]),K[Z].push($.id)});const G=260,Y=110,W=P.nodes.map($=>{const Z=U.get($.id)??0,B=K[Z].indexOf($.id),ae=Z*G,se=B*Y;return{id:$.id,type:$.node_type,position:{x:ae,y:se},data:{label:$.label,title:$.title,event_type:$.event_type,type:$.node_type}}}),J=P.edges.map(($,Z)=>({id:`edge-${Z}`,source:$.source,target:$.target,type:"smoothstep",animated:!1,style:{stroke:"var(--wf-edge-stroke)",strokeWidth:2},markerEnd:{type:bg.ArrowClosed,color:"var(--wf-edge-stroke)"}}));return{nodes:W,edges:J}},[]),F=N.useCallback(async()=>{if(!t){l([]),f([]),v(null);return}E(!0),v(null);try{const{data:P,error:q}=await Wq({client:x,path:{name:t}});if(q)throw new Error(String(q));const j=P==null?void 0:P.graph;if(!j)throw new Error("No graph data received");const Q=M(j);l(Q.nodes),f(Q.edges)}catch(P){console.error("Error fetching workflow visualization:",P),v(P instanceof Error?P.message:"Failed to load workflow visualization"),l([]),f([])}finally{E(!1)}},[t,x,M,l,f]);return N.useEffect(()=>{F()},[F]),N.useEffect(()=>{if(!n||n.length===0){C(-1),l(Q=>Q.map(U=>{const K={...U.data};return delete K.highlightColor,delete K.activeWorkers,delete K.workerCount,delete K.fadeTimestamp,{...U,data:K}}));return}const P=n.slice(y+1);if(P.length===0)return;C(n.length-1);const q=Q=>{if(!Q)return"";try{return((typeof Q=="string"?Q:String(Q)).replace("<class","").replace(">","").replaceAll("'","").split(".").at(-1)||"").trim()}catch{return""}},j=Q=>{switch(Q){case"preparing":return"#3B82F6";case"in_progress":return"#F59E0B";case"running":return"#10B981";case"not_running":case"not_in_progress":case"exited":return null;default:return"#10B981"}};for(const Q of P){const U=(Q==null?void 0:Q.type)??"",K=(Q==null?void 0:Q.data)??{};if(U==="StepStateChanged"||U==="workflows.events.StepStateChanged"){const G=String((K==null?void 0:K.name)||""),Y=String((K==null?void 0:K.step_state)||""),W=String((K==null?void 0:K.worker_id)||""),J=j(Y);l($=>$.map(Z=>{const te={...Z.data};if(Z.id===G){const B=new Set(te.activeWorkers||[]);if(Y==="preparing"||Y==="in_progress"||Y==="running"?B.add(W):(Y==="not_running"||Y==="not_in_progress"||Y==="exited")&&B.delete(W),te.activeWorkers=Array.from(B),te.workerCount=B.size,B.size>0)te.highlightColor=J||"#10B981",te.fadeTimestamp=Date.now();else if((Y==="exited"||Y==="not_running")&&te.highlightColor){const ae=Date.now();te.fadeTimestamp=ae,setTimeout(()=>{l(se=>se.map(de=>{if(de.id===G&&de.data.fadeTimestamp===ae){const ie={...de.data};return ie.highlightColor=null,{...de,data:ie}}return de}))},1e3)}return te.lastInputEvent=q(K==null?void 0:K.input_event_name),te.lastOutputEvent=q(K==null?void 0:K.output_event_name),te.status=Y,{...Z,data:te}}return Z}))}else if(U&&!U.includes("workflows.events.EventsQueueChanged")){const G=q(U.replace("__main__.","").replace("workflows.events.",""));l(Y=>Y.map(W=>{if(W.id===G&&W.type==="event"){const J={...W.data};return J.highlightColor="#10B981",J.fadeTimestamp=Date.now(),{...W,data:J}}return W})),setTimeout(()=>{l(Y=>Y.map(W=>{if(W.id===G&&W.type==="event"){const J={...W.data};return J.highlightColor=null,J.fadeTimestamp=null,{...W,data:J}}return W}))},1e3)}}},[n,y,l,o]),h?A.jsx("div",{className:`${e} flex items-center justify-center bg-card border border-border rounded-lg`,children:A.jsxs("div",{className:"text-center",children:[A.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-2"}),A.jsx("p",{className:"text-muted-foreground",children:"Loading workflow visualization..."})]})}):b?A.jsx("div",{className:`${e} flex items-center justify-center bg-destructive/10 border border-destructive/30 rounded-lg`,children:A.jsxs("div",{className:"text-center p-4",children:[A.jsx("p",{className:"text-destructive font-medium",children:"Error loading visualization"}),A.jsx("p",{className:"text-sm mt-1 text-destructive",children:b}),A.jsx("button",{onClick:F,className:"mt-3 px-4 py-2 bg-primary text-primary-foreground rounded-md text-sm hover:opacity-90 transition-colors",children:"Retry"})]})}):t?s.length===0?A.jsx("div",{className:`${e} flex items-center justify-center bg-card border border-border rounded-lg`,children:A.jsx("p",{className:"text-muted-foreground",children:"No workflow data available"})}):A.jsx("div",{className:`${e} border border-border rounded-lg overflow-hidden`,children:A.jsx(F$e,{nodes:s,edges:d,onNodesChange:u,onEdgesChange:m,onConnect:D,nodeTypes:O,defaultEdgeOptions:{markerEnd:{type:bg.ArrowClosed,color:"var(--wf-edge-stroke)"}},fitView:!0,attributionPosition:"bottom-left",children:A.jsx($$e,{variant:Hc.Dots,gap:12,size:1,color:T?"#374151":"#e5e7eb"})})}):A.jsx("div",{className:`${e} flex items-center justify-center bg-card border border-border rounded-lg`,children:A.jsx("p",{className:"text-muted-foreground",children:"Select a workflow to view its visualization"})})}function lB(t){if(t.type)return{type:t.type,nullable:t.nullable??!1};if(t.anyOf&&Array.isArray(t.anyOf)){const e=t.anyOf.map(a=>a.type).filter(a=>typeof a=="string"),n=e.includes("null"),r=e.filter(a=>a!=="null");if(r.length===1)return{type:r[0],nullable:n}}return{type:"unknown",nullable:!1}}function fYe(t){if(!t)return!1;const e=t.toLowerCase();return e.includes("object")||e.includes("array")||e.includes("map")||e.includes("dict")||/\w+\s*\[.*\]/.test(t)}function mYe(t){const e=(t||"").toLowerCase(),n=e.includes("array")||e.includes("list")||/\w+\s*\[.*\]/.test(t||""),r=e.includes("object")||e.includes("map")||e.includes("dict");return n?{hint:'Expected: JSON array (e.g., ["a", "b"])',placeholder:'["item1", "item2"]'}:r?{hint:'Expected: JSON object (e.g., {"key": "value"})',placeholder:'{"key": "value"}'}:{hint:"Expected: valid JSON (object or array)",placeholder:"Enter value as JSON"}}const hYe={};function ace({schema:t,values:e,onChange:n,onErrorsChange:r,className:a}){const i=(t==null?void 0:t.properties)??hYe,o=new Set((t==null?void 0:t.required)||[]),[s,l]=N.useState({}),[u,d]=N.useState({});N.useEffect(()=>{r==null||r(u)},[u,r]),N.useEffect(()=>{l(h=>{const E={...h};for(const[b,v]of Object.entries(i)){const{type:y}=lB(v);if(fYe(y)&&E[b]===void 0){const C=e[b];E[b]=C!==void 0?JSON.stringify(C,null,2):""}}return E})},[i,e]),N.useEffect(()=>{const h={};for(const[E,b]of Object.entries(i)){const{type:v,nullable:y}=lB(b);v==="boolean"&&e[E]===void 0&&o.has(E)&&(h[E]=y?null:!1)}Object.keys(h).length>0&&n({...e,...h})},[i,n]);const f=(h,E)=>{n({...e,[h]:E})},m=N.useMemo(()=>Object.entries(i),[i]);return m.length===0?null:A.jsx("div",{className:a,children:m.map(([h,E])=>{const b=`field-${h}`,v=E.title||h,{type:y,nullable:C}=lB(E),T=E.description||"";if(y==="string")return A.jsxs("div",{className:"space-y-2",children:[A.jsx(Bs,{htmlFor:b,label:v,required:o.has(h)}),A.jsx(RT,{id:b,value:e[h]||"",onChange:M=>f(h,M.target.value),placeholder:T||`Enter ${v.toLowerCase()}`,minRows:3}),T&&A.jsx("p",{className:"text-xs text-muted-foreground",children:T})]},h);if(y==="number"||y==="integer")return A.jsxs("div",{className:"space-y-2",children:[A.jsx(Bs,{htmlFor:b,label:v,required:o.has(h)}),A.jsx(OT,{id:b,type:"number",value:e[h]??"",onChange:M=>{const F=M.target.value;if(F===""){f(h,null);return}const P=y==="integer"?parseInt(F,10):parseFloat(F);f(h,Number.isNaN(P)?null:P)},placeholder:T||`Enter ${v.toLowerCase()}`,step:y==="integer"?"1":"any"}),T&&A.jsx("p",{className:"text-xs text-muted-foreground",children:T})]},h);if(y==="boolean"){const M=()=>e[h]===null?"null":e[h]===!0||e[h]==="true"?"true":e[h]===!1||e[h]==="false"?"false":C?"":"false";return A.jsxs("div",{className:"space-y-2",children:[A.jsx(Bs,{htmlFor:b,label:v,required:o.has(h)}),A.jsxs(Sx,{onValueChange:F=>{F==="null"?f(h,null):f(h,F==="true")},value:M(),children:[A.jsx(TT,{placeholder:"Select..."}),A.jsxs(CT,{children:[A.jsx(Gh,{value:"true",label:"True"}),A.jsx(Gh,{value:"false",label:"False"}),C&&A.jsx(Gh,{value:"null",label:"None"})]})]}),T&&A.jsx("p",{className:"text-xs text-muted-foreground",children:T})]},h)}const{hint:w,placeholder:O}=mYe(y),x=s[h]??(e[h]!==void 0?JSON.stringify(e[h],null,2):""),D=!!u[h];return A.jsxs("div",{className:"space-y-2",children:[A.jsx(Bs,{htmlFor:b,label:`${v} (JSON)`,required:o.has(h)}),A.jsx("div",{className:"font-mono",children:A.jsx(RT,{id:b,value:x,onChange:M=>{const F=M.target.value;if(l(P=>({...P,[h]:F})),F.trim()===""){d(q=>({...q,[h]:null}));const P={...e};delete P[h],n(P);return}try{const P=JSON.parse(F);d(q=>({...q,[h]:null})),f(h,P)}catch{d(P=>({...P,[h]:"Invalid JSON"}))}},placeholder:T||O,variant:D?"error":"default",minRows:3})}),D?A.jsx("p",{className:"text-xs text-destructive mt-1",children:u[h]}):A.jsx("p",{className:"text-xs text-muted-foreground",children:w}),T&&A.jsx("p",{className:"text-xs text-muted-foreground",children:T})]},h)})})}function gYe({handlerId:t,workflowName:e,disabled:n}){const[r,a]=N.useState(!1),[i,o]=N.useState([]),[s,l]=N.useState(null),[u,d]=N.useState({}),[f,m]=N.useState(!1),[h,E]=N.useState(null),[b,v]=N.useState(!1),[y,C]=N.useState(null),[T,w]=N.useState(!1),O=pd();N.useEffect(()=>{if(!r||!e)return;(async()=>{m(!0),C(null);try{const j=(await oye({client:O,path:{name:e}})).data;if(!j){o([]);return}if(!j.events){o([]);return}if(o(j.events),j.events&&j.events.length>0){const U=j.events[0].title;l(U||null)}}catch(q){console.error("Failed to fetch event schemas:",q),C(q instanceof Error?q.message:"Failed to fetch events"),o([])}finally{m(!1)}})()},[r,e,O]),N.useEffect(()=>{r||(l(null),d({}),E(null),C(null),w(!1))},[r]),N.useEffect(()=>{d({}),C(null),w(!1)},[s]);const x=N.useMemo(()=>s&&i.find(P=>P.title===s)||null,[s,i]),D=N.useMemo(()=>h?Object.values(h).some(P=>P!==null):!1,[h]),M=async()=>{if(!(!t||!s)){v(!0),C(null),w(!1);try{const P={type:s,data:u},{error:q}=await jq({client:O,path:{handler_id:t},body:{event:JSON.stringify(P)}});if(q)throw new Error(typeof q=="string"?q:JSON.stringify(q));w(!0),setTimeout(()=>{a(!1)},1e3)}catch(P){console.error("Failed to send event:",P),C(P instanceof Error?P.message:"Failed to send event")}finally{v(!1)}}},F=!b&&!D&&s&&t&&!T;return A.jsxs(tCe,{open:r,onOpenChange:a,children:[A.jsx(nCe,{asChild:!0,children:A.jsx(Xn,{variant:"outline",size:"sm",disabled:n||!t||!e,title:t?e?"Send event to workflow":"No workflow selected":"No active handler",label:"Send Event",startIcon:A.jsx(PEe,{})})}),A.jsxs(i$,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[A.jsx(o$,{title:"Send Event to Workflow",description:"Send a custom event to the running workflow handler."}),A.jsx("div",{className:"space-y-4 py-4",children:f?A.jsx("div",{className:"text-center text-muted-foreground",children:"Loading event types..."}):i.length===0?A.jsx("div",{className:"text-center text-muted-foreground",children:y||"No events available for this workflow"}):A.jsxs(A.Fragment,{children:[A.jsxs("div",{className:"space-y-2",children:[A.jsx(Bs,{htmlFor:"eventType",label:"Event Type"}),A.jsxs(Sx,{value:s||"",onValueChange:l,children:[A.jsx(TT,{placeholder:"Select event type..."}),A.jsx(CT,{children:i.map(P=>A.jsx(Gh,{value:P.title||"",label:P.title||"Unnamed Event"},P.title||"unknown"))})]})]}),x&&A.jsxs("div",{className:"space-y-2",children:[A.jsx(Bs,{htmlFor:"eventData",label:"Event Data"}),A.jsx(ace,{schema:{properties:x.properties,required:x.required},values:u,onChange:d,onErrorsChange:E,className:"space-y-3 border border-border rounded-lg p-4 bg-muted/30"})]}),y&&A.jsx("div",{className:"text-destructive text-sm p-3 bg-destructive/10 border border-destructive/20 rounded",children:y}),T&&A.jsx("div",{className:"text-green-600 text-sm p-3 bg-green-50 border border-green-200 rounded",children:"Event sent successfully!"})]})}),A.jsx(s$,{secondary:{label:"Cancel",onClick:()=>a(!1)},primary:{label:b?"Sending...":"Send Event",onClick:M,disabled:!F}})]})]})}function _Ye({handlerId:t,selectedWorkflow:e}){var C;const{state:n,subscribeToEvents:r}=F3e(t),[a,i]=N.useState(!1),[o,s]=N.useState(!0),[l,u]=N.useState(null),[d,f]=N.useState(null),{items:m,push:h,clear:E}=B3e(100,(T,w)=>T.timestamp.getTime()-w.timestamp.getTime()),b=T=>typeof T=="string"?T:!T||typeof T!="object"?String(T??""):JSON.stringify(T,null,a?0:2),v=T=>{if(!T)return"";const w=new Date(T),O=w.toLocaleTimeString([],{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),x=String(w.getMilliseconds()).padStart(3,"0");return`${O}.${x}`};N.useEffect(()=>{if(n.status==="running"){const{disconnect:T}=r({onData:w=>{h(w)},onSuccess(w){var O,x;u(((x=(O=w[w.length-1])==null?void 0:O.data)==null?void 0:x.result)??null)},onError(w){f(w.message)}},!0);return()=>{T()}}},[r,n.status,h]),N.useEffect(()=>{E(),u(null),f(null)},[t,E]);const y=N.useMemo(()=>o?m.filter(T=>!MTe(T)):m,[m,o]);return A.jsxs("div",{className:"h-full flex flex-col",children:[A.jsxs("div",{className:"p-4 border-b border-border",children:[A.jsxs("div",{className:"flex items-center justify-between",children:[A.jsx("h2",{className:"font-semibold text-sm",children:"Run Details"}),A.jsxs("div",{className:"flex items-center gap-2",children:[A.jsx(_T,{variant:n.status==="completed"?"default":"secondary",label:n.status}),A.jsx(gYe,{handlerId:t,workflowName:e??null,disabled:!n||n.status==="completed"||n.status==="failed"})]})]}),A.jsxs("div",{className:"flex items-center justify-between gap-2 mt-2",children:[A.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:n.handler_id}),A.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:["Last updated: ",(C=n.updated_at)==null?void 0:C.getTime()]})]})]}),A.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[A.jsx("div",{className:"flex-1 p-4 overflow-auto border-r border-border",children:A.jsx(pYe,{workflowName:e||null,events:m.map(T=>({type:T.type,data:T.data})),className:"w-full h-full min-h-[400px]",isComplete:n.status==="completed"||n.status==="failed"})}),A.jsxs("div",{className:"w-[480px] flex flex-col overflow-hidden",children:[A.jsx("div",{className:"p-4 pb-2 border-b border-border",children:A.jsxs("div",{className:"flex items-center justify-between mb-3",children:[A.jsxs("h4",{className:"font-medium text-sm",children:["Event Stream (",y.length,")"]}),A.jsxs("div",{className:"flex items-center gap-3",children:[A.jsxs("div",{className:"flex items-center gap-2",children:[A.jsx(Bs,{htmlFor:"hide-internal",label:"Hide internal"}),A.jsx(AJ,{id:"hide-internal",checked:o,onCheckedChange:T=>s(!!T)})]}),A.jsx(Xn,{variant:"ghost",size:"sm",onClick:()=>i(!a),label:a?"Formatted":"Compact"})]})]})}),A.jsx("div",{className:"flex-1 overflow-auto",children:n.handler_id?m.length===0?A.jsx("div",{className:"flex items-center justify-center h-full",children:A.jsx("p",{className:"text-muted-foreground text-sm",children:"No events yet..."})}):A.jsxs(Nz,{children:[A.jsx(Oz,{sticky:!0,children:A.jsxs(Ox,{children:[A.jsx(Ix,{label:"#"}),A.jsx(Ix,{label:"Event"})]})}),A.jsx(Iz,{children:y.map((T,w)=>{const O=T;return A.jsxs(Ox,{"data-event-index":w,children:[A.jsx(kz,{label:w+1}),A.jsx(Mz,{children:A.jsxs("div",{className:"space-y-2",children:[A.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[A.jsx("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:A.jsx("code",{className:"text-sm font-mono truncate",children:O.type})}),O.timestamp!==void 0?A.jsx("span",{className:"text-[10px] text-muted-foreground font-mono whitespace-nowrap",children:v(O.timestamp.getTime())}):null]}),A.jsx(moe,{language:typeof O.data=="string"?"text":"json",value:b(O.data),wrapLongLines:a,className:"rounded border max-h-64 overflow-auto"})]})})]},`${O.type}-${w}`)})})]}):A.jsx("div",{className:"flex items-center justify-center h-full",children:A.jsx("p",{className:"text-muted-foreground text-sm",children:"Start a run to see events"})})}),(l||d)&&A.jsxs("div",{className:"p-4 border-t border-border",children:[A.jsx("h4",{className:"font-medium text-sm mb-2",children:"Final Result"}),d?A.jsxs("div",{className:"text-destructive text-sm p-3 bg-destructive/10 border border-destructive/20 rounded",children:["Failed to load final result: ",d]}):A.jsx(moe,{language:typeof l=="string"?"text":"json",value:typeof l=="string"?l:JSON.stringify(l,null,2),className:"rounded border overflow-hidden"})]})]})]})]})}function bYe({activeHandlerId:t,onHandlerSelect:e}){const{state:n,sync:r}=UJ(),a=n.handlers,[i,o]=N.useState(!1);N.useEffect(()=>{o(!0),r().finally(()=>o(!1))},[r]);const s=u=>`${u.workflow_name||"Unknown"}`,l=Object.values(a);return A.jsxs("div",{className:"h-full flex flex-col text-sm",children:[A.jsx("div",{className:"px-3 py-2 border-b border-border",children:A.jsx("div",{className:"flex items-center justify-between",children:A.jsx("h2",{className:"font-semibold text-xs tracking-tight",children:"Recent Runs"})})}),A.jsxs("div",{className:"flex-1 overflow-y-auto",children:[i&&A.jsxs("div",{className:"p-2 space-y-2",children:[A.jsx(uf,{className:"h-8 w-full"}),A.jsx(uf,{className:"h-8 w-full"}),A.jsx(uf,{className:"h-8 w-full"})]}),!i&&A.jsx("div",{className:"p-2 divide-y divide-border",children:l.length===0?A.jsx("div",{className:"text-muted-foreground text-xs p-3 text-center",children:"No runs yet. Start a workflow to see runs here."}):l.map(u=>A.jsx("button",{onClick:()=>e(u.handler_id),className:`w-full text-left px-2 py-1.5 transition-colors cursor-pointer border border-collapse ${t===u.handler_id?"bg-accent ":"hover:bg-accent"}`,children:A.jsxs("div",{className:"grid grid-cols-[1fr_auto] items-center gap-2",children:[A.jsx("span",{className:"truncate text-xs",children:s(u)}),A.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:u.handler_id.slice(-8)})]})},u.handler_id))})]})]})}function EYe({selectedWorkflow:t,onRunStart:e,onCollapse:n}){const[r,a]=N.useState(null),[i,o]=N.useState({}),[s,l]=N.useState(!1),[u,d]=N.useState(null),[f,m]=N.useState(""),[h,E]=N.useState(null),[b,v]=N.useState({}),[y,C]=N.useState(!1),T=pd(),{createHandler:w}=P3e(t),{setHandler:O}=UJ();N.useEffect(()=>{t?(async()=>{if(t)try{l(!0),d(null);const{data:F,error:P}=await tye({client:T,path:{name:t}});if(F)a((F==null?void 0:F.start)??null);else throw new Error(P?String(P):"Failed to fetch schema");o({}),m(JSON.stringify({},null,2)),E(null),v({})}catch(F){d(F instanceof Error?F.message:"Failed to fetch schema"),a(null)}finally{l(!1)}})():(a(null),o({}),m(""),E(null),v({}))},[t,T]);const x=async()=>{if(t)try{C(!0);const M=await w(i);O(M),e(M.handler_id),n&&n()}catch(M){console.error("Failed to run workflow:",M)}finally{C(!1)}},D=!!(r!=null&&r.properties&&Object.keys(r.properties).length>0);return t?A.jsxs("div",{className:"h-full flex flex-col",children:[A.jsxs("div",{className:"p-4 border-b border-border flex items-center justify-between",children:[A.jsxs("h2",{className:"font-semibold text-sm",children:["Configure: ",t]}),n&&A.jsx(Xn,{variant:"ghost",size:"icon-sm",onClick:n,title:"Hide configuration panel (Ctrl+B)",startIcon:A.jsx(XG,{})})]}),A.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[s&&A.jsxs("div",{className:"space-y-4",children:[A.jsx(uf,{className:"h-4 w-32"}),A.jsx(uf,{className:"h-20 w-full"}),A.jsx(uf,{className:"h-4 w-32"}),A.jsx(uf,{className:"h-20 w-full"})]}),u&&A.jsxs("div",{className:"text-destructive text-sm p-3 bg-destructive/10 border border-destructive/20 rounded",children:["Error loading schema: ",u]}),!s&&!u&&A.jsx(A.Fragment,{children:A.jsx("div",{className:"space-y-4",children:D?A.jsx(ace,{schema:r,values:i,onChange:o,onErrorsChange:v}):A.jsxs("div",{className:"space-y-2",children:[A.jsx(Bs,{htmlFor:"raw-input",label:"Input (JSON)"}),A.jsx("div",{className:"font-mono",children:A.jsx(RT,{id:"raw-input",value:f,onChange:M=>{m(M.target.value);try{const F=JSON.parse(M.target.value);o(F),E(null)}catch{E("Invalid JSON")}},placeholder:'{"key": "value"}',variant:h?"error":"default",minRows:8})}),h&&A.jsx("p",{className:"text-xs text-destructive mt-1",children:h})]})})})]}),!s&&!u&&A.jsxs("div",{className:"p-4 border-t border-border",children:[Object.values(b).some(M=>M)&&A.jsx("p",{className:"text-xs text-destructive mb-2",children:"Fix invalid JSON fields before running."}),A.jsx(Xn,{onClick:x,disabled:y||Object.values(b).some(M=>M),fullWidth:!0,label:y?"Starting...":"Run Workflow"})]})]}):A.jsxs("div",{className:"h-full flex flex-col",children:[A.jsxs("div",{className:"p-4 border-b border-border flex items-center justify-between",children:[A.jsx("h2",{className:"font-semibold text-sm",children:"Workflow Configuration"}),n&&A.jsx(Xn,{variant:"ghost",size:"icon-sm",onClick:n,title:"Hide configuration panel (Ctrl+B)",startIcon:A.jsx(XG,{})})]}),A.jsx("div",{className:"flex-1 flex items-center justify-center",children:A.jsx("p",{className:"text-muted-foreground text-center",children:"Select a workflow to configure and run"})})]})}function SYe(t,e,n=!0){N.useEffect(()=>{const r=a=>{(n&&a.ctrlKey&&a.key.toLowerCase()===t.toLowerCase()||!n&&a.key.toLowerCase()===t.toLowerCase())&&(a.preventDefault(),e())};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[t,e,n])}function vYe(){if(typeof window>"u")return eA();const e=new URLSearchParams(window.location.search).get("api");return e?e.endsWith("/")?e.slice(0,-1):e:eA()}function yYe(){const[t,e]=N.useState(vYe),[n,r]=N.useState(t),[a,i]=N.useState(null),[o,s]=N.useState(null),{state:l,sync:u}=L3e(),[d,f]=N.useState(37.5),[m,h]=N.useState(!1),[E,b]=N.useState(!1),[v,y]=N.useState(!1),[C,T]=N.useState(null),[w,O]=N.useState(null),x=l.workflows,D=pd(),M=N.useCallback(async()=>{try{O(null);const{data:K,error:G}=await nye({client:D});if(G)throw new Error(String(G));K&&K.status?T(!0):(T(!1),O("Workflow server is unreachable"))}catch{T(!1),O("Workflow server is unreachable")}},[D]);N.useEffect(()=>{D.setConfig({baseUrl:t}),M(),u()},[t,D,M,u]);const F=()=>{const K=n.endsWith("/")?n.slice(0,-1):n;e(K)},P=()=>{const K=eA();e(K),r(K)},q=K=>{s(K)},j=K=>{K.preventDefault(),h(!0)},Q=N.useCallback(K=>{const G=document.querySelector(".main-content-area");if(!G)return;const Y=G.getBoundingClientRect(),W=(K.clientX-Y.left)/Y.width*100,J=Math.max(20,Math.min(80,W));f(J)},[]),U=N.useCallback(()=>{h(!1)},[]);return N.useEffect(()=>{if(m)return document.addEventListener("mousemove",Q),document.addEventListener("mouseup",U),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Q),document.removeEventListener("mouseup",U),document.body.style.cursor="",document.body.style.userSelect=""}},[m,Q,U]),SYe("b",N.useCallback(()=>{y(K=>!K)},[]),!0),A.jsxs("div",{className:`h-screen flex flex-col bg-background ${m?"resize-active":""}`,children:[A.jsxs("div",{className:"flex items-center justify-between h-12 px-4 bg-card border-b border-border",children:[A.jsxs("div",{className:"flex items-center gap-4",children:[A.jsx(Xn,{variant:"ghost",size:"icon-sm",onClick:()=>b(!E),title:E?"Show sidebar":"Hide sidebar",startIcon:E?A.jsx(IEe,{}):A.jsx(OEe,{})}),A.jsx("h1",{className:"text-md font-semibold",children:"Workflow Debugger"})]}),A.jsxs("div",{className:"flex items-center gap-2",children:[A.jsx("div",{className:"flex items-center",children:A.jsx(Bs,{htmlFor:"workflow",label:"Workflow:",variant:"standalone"})}),A.jsx("div",{className:"w-48",children:A.jsxs(Sx,{value:a||"",onValueChange:i,children:[A.jsx(TT,{id:"workflow",placeholder:"Select workflow..."}),A.jsx(CT,{children:Object.keys(x).map(K=>A.jsx(Gh,{value:K,label:K},K))})]})})]}),A.jsxs("div",{className:"flex items-center gap-2",children:[C!==null&&A.jsx("span",{className:`${C?"bg-green-500":"bg-red-500"} h-2 w-2 rounded-full`}),C===!1&&A.jsx("span",{className:"text-destructive text-xs",children:w||"Workflow server is unreachable"}),A.jsxs(I0e,{children:[A.jsx(D0e,{asChild:!0,children:A.jsx(Xn,{variant:"ghost",size:"icon-sm",startIcon:A.jsx(FEe,{})})}),A.jsx(iG,{className:"w-80",children:A.jsx("div",{className:"space-y-4",children:A.jsxs("div",{className:"space-y-2",children:[A.jsx("h4",{className:"font-medium text-sm",children:"API Configuration"}),A.jsx(OT,{value:n,onChange:K=>r(K.target.value),placeholder:"http://localhost:8000"}),A.jsxs("div",{className:"flex gap-2",children:[A.jsx(Xn,{onClick:F,variant:"outline",size:"sm",disabled:n===t,label:"Save"}),A.jsx(Xn,{onClick:P,variant:"outline",size:"sm",label:"Reset"})]}),A.jsxs("p",{className:"text-xs text-muted-foreground",children:["Current: ",t]})]})})})]})]})]}),A.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[!E&&A.jsx("div",{className:"w-48 border-r border-border bg-card overflow-hidden transition-all duration-200",children:A.jsx(bYe,{activeHandlerId:o,onHandlerSelect:s})}),A.jsxs("div",{className:"flex-1 flex overflow-hidden main-content-area",children:[v?A.jsx("div",{className:"w-10 border-r border-border bg-muted/30 flex flex-col items-center justify-center hover:bg-muted/50 transition-colors",children:A.jsx(Xn,{variant:"ghost",size:"icon-sm",onClick:()=>y(!1),title:"Show configuration panel (Ctrl+B)",startIcon:A.jsx(DEe,{})})}):A.jsxs(A.Fragment,{children:[A.jsx("div",{className:"border-r border-border overflow-auto",style:{width:`${d}%`},children:a&&A.jsx(EYe,{selectedWorkflow:a,onRunStart:q,activeHandlerId:o,onCollapse:()=>y(!0)})}),A.jsx("div",{className:`w-2 hover:bg-gray-500/20 hover:shadow-lg cursor-col-resize flex-shrink-0 transition-all duration-200 relative group border-l border-r border-border ${m?"shadow-xl":""}`,onMouseDown:j,title:"Drag to resize panels"})]}),A.jsx("div",{className:"overflow-auto",style:{width:v?"calc(100% - 40px)":`${100-d}%`},children:o&&A.jsx(_Ye,{handlerId:o,selectedWorkflow:a})})]})]})]})}class TYe extends Oe.Component{constructor(n){super(n);Fe(this,"resetError",()=>{this.setState({hasError:!1,error:void 0})});this.state={hasError:!1}}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,r){console.error("ErrorBoundary caught an error:",n,r)}render(){if(this.state.hasError&&this.state.error){if(this.props.fallback){const n=this.props.fallback;return A.jsx(n,{error:this.state.error,resetError:this.resetError})}return A.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:A.jsxs("div",{className:"max-w-md p-6 bg-card border border-border rounded-lg shadow-sm",children:[A.jsx("h2",{className:"text-lg font-semibold text-destructive mb-2",children:"Something went wrong"}),A.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"The workflow debugger encountered an error. This might happen if the workflow server is unreachable."}),A.jsxs("details",{className:"mb-4",children:[A.jsx("summary",{className:"text-sm font-medium cursor-pointer hover:text-foreground",children:"Error Details"}),A.jsx("pre",{className:"mt-2 text-xs bg-muted p-3 rounded border overflow-auto",children:this.state.error.message})]}),A.jsxs("div",{className:"flex gap-2",children:[A.jsx("button",{onClick:this.resetError,className:"px-3 py-2 text-sm bg-primary text-primary-foreground rounded hover:bg-primary/90 transition-colors",children:"Try Again"}),A.jsx("button",{onClick:()=>window.location.reload(),className:"px-3 py-2 text-sm bg-secondary text-secondary-foreground rounded hover:bg-secondary/90 transition-colors",children:"Reload Page"})]})]})})}return this.props.children}}function CYe(){const t=eA(),e=Vq({baseUrl:t});return A.jsx(TYe,{children:A.jsx(sye,{clients:{workflowsClient:e},children:A.jsx(yYe,{})})})}function ice(){const t=window.matchMedia("(prefers-color-scheme: dark)").matches;document.documentElement.classList.toggle("dark",t)}ice(),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",ice),ege.createRoot(document.getElementById("root")).render(A.jsx(N.StrictMode,{children:A.jsx(CYe,{})}));const Si=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),cB=[.001,0,0,.001,0,0],uB=1.35,Eo={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},ql={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},ME="pdfjs_internal_editor_",Pt={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},cn={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_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},oce={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},Ua={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},LE={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Xr={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},Rg={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},PE={ERRORS:0,WARNINGS:1,INFOS:5},wg={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,rawFillPath:94},$A={moveTo:0,lineTo:1,curveTo:2,closePath:3},sce={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let YA=PE.WARNINGS;function AYe(t){Number.isInteger(t)&&(YA=t)}function RYe(){return YA}function VA(t){YA>=PE.INFOS&&console.info(`Info: ${t}`)}function Ft(t){YA>=PE.WARNINGS&&console.warn(`Warning: ${t}`)}function er(t){throw new Error(t)}function pn(t,e){t||er(e)}function wYe(t){switch(t==null?void 0:t.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function dB(t,e=null,n=null){if(!t)return null;if(n&&typeof t=="string"){if(n.addDefaultProtocol&&t.startsWith("www.")){const a=t.match(/\./g);(a==null?void 0:a.length)>=2&&(t=`http://${t}`)}if(n.tryConvertEncoding)try{t=DYe(t)}catch{}}const r=e?URL.parse(t,e):URL.parse(t);return wYe(r)?r:null}function pB(t,e,n=!1){const r=URL.parse(t);return r?(r.hash=e,r.href):n&&dB(t,"http://example.com")?t.split("#",1)[0]+`${e?`#${e}`:""}`:""}function jt(t,e,n,r=!1){return Object.defineProperty(t,e,{value:n,enumerable:!r,configurable:!0,writable:!1}),n}const Mf=(function(){function e(n,r){this.message=n,this.name=r}return e.prototype=new Error,e.constructor=e,e})();class lce extends Mf{constructor(e,n){super(e,"PasswordException"),this.code=n}}class fB extends Mf{constructor(e,n){super(e,"UnknownErrorException"),this.details=n}}class jA extends Mf{constructor(e){super(e,"InvalidPDFException")}}class FE extends Mf{constructor(e,n,r){super(e,"ResponseException"),this.status=n,this.missing=r}}class xYe extends Mf{constructor(e){super(e,"FormatError")}}class $c extends Mf{constructor(e){super(e,"AbortException")}}function cce(t){(typeof t!="object"||(t==null?void 0:t.length)===void 0)&&er("Invalid argument for bytesToString");const e=t.length,n=8192;if(e<n)return String.fromCharCode.apply(null,t);const r=[];for(let a=0;a<e;a+=n){const i=Math.min(a+n,e),o=t.subarray(a,i);r.push(String.fromCharCode.apply(null,o))}return r.join("")}function BE(t){typeof t!="string"&&er("Invalid argument for stringToBytes");const e=t.length,n=new Uint8Array(e);for(let r=0;r<e;++r)n[r]=t.charCodeAt(r)&255;return n}function NYe(t){return String.fromCharCode(t>>24&255,t>>16&255,t>>8&255,t&255)}function OYe(){const t=new Uint8Array(4);return t[0]=1,new Uint32Array(t.buffer,0,1)[0]===1}function IYe(){try{return new Function(""),!0}catch{return!1}}class Ra{static get isLittleEndian(){return jt(this,"isLittleEndian",OYe())}static get isEvalSupported(){return jt(this,"isEvalSupported",IYe())}static get isOffscreenCanvasSupported(){return jt(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return jt(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get platform(){const{platform:e,userAgent:n}=navigator;return jt(this,"platform",{isAndroid:n.includes("Android"),isLinux:e.includes("Linux"),isMac:e.includes("Mac"),isWindows:e.includes("Win"),isFirefox:n.includes("Firefox")})}static get isCSSRoundSupported(){var e,n;return jt(this,"isCSSRoundSupported",(n=(e=globalThis.CSS)==null?void 0:e.supports)==null?void 0:n.call(e,"width: round(1.5px, 1px)"))}}const mB=Array.from(Array(256).keys(),t=>t.toString(16).padStart(2,"0"));class at{static makeHexColor(e,n,r){return`#${mB[e]}${mB[n]}${mB[r]}`}static domMatrixToTransform(e){return[e.a,e.b,e.c,e.d,e.e,e.f]}static scaleMinMax(e,n){let r;e[0]?(e[0]<0&&(r=n[0],n[0]=n[2],n[2]=r),n[0]*=e[0],n[2]*=e[0],e[3]<0&&(r=n[1],n[1]=n[3],n[3]=r),n[1]*=e[3],n[3]*=e[3]):(r=n[0],n[0]=n[1],n[1]=r,r=n[2],n[2]=n[3],n[3]=r,e[1]<0&&(r=n[1],n[1]=n[3],n[3]=r),n[1]*=e[1],n[3]*=e[1],e[2]<0&&(r=n[0],n[0]=n[2],n[2]=r),n[0]*=e[2],n[2]*=e[2]),n[0]+=e[4],n[1]+=e[5],n[2]+=e[4],n[3]+=e[5]}static transform(e,n){return[e[0]*n[0]+e[2]*n[1],e[1]*n[0]+e[3]*n[1],e[0]*n[2]+e[2]*n[3],e[1]*n[2]+e[3]*n[3],e[0]*n[4]+e[2]*n[5]+e[4],e[1]*n[4]+e[3]*n[5]+e[5]]}static multiplyByDOMMatrix(e,n){return[e[0]*n.a+e[2]*n.b,e[1]*n.a+e[3]*n.b,e[0]*n.c+e[2]*n.d,e[1]*n.c+e[3]*n.d,e[0]*n.e+e[2]*n.f+e[4],e[1]*n.e+e[3]*n.f+e[5]]}static applyTransform(e,n,r=0){const a=e[r],i=e[r+1];e[r]=a*n[0]+i*n[2]+n[4],e[r+1]=a*n[1]+i*n[3]+n[5]}static applyTransformToBezier(e,n,r=0){const a=n[0],i=n[1],o=n[2],s=n[3],l=n[4],u=n[5];for(let d=0;d<6;d+=2){const f=e[r+d],m=e[r+d+1];e[r+d]=f*a+m*o+l,e[r+d+1]=f*i+m*s+u}}static applyInverseTransform(e,n){const r=e[0],a=e[1],i=n[0]*n[3]-n[1]*n[2];e[0]=(r*n[3]-a*n[2]+n[2]*n[5]-n[4]*n[3])/i,e[1]=(-r*n[1]+a*n[0]+n[4]*n[1]-n[5]*n[0])/i}static axialAlignedBoundingBox(e,n,r){const a=n[0],i=n[1],o=n[2],s=n[3],l=n[4],u=n[5],d=e[0],f=e[1],m=e[2],h=e[3];let E=a*d+l,b=E,v=a*m+l,y=v,C=s*f+u,T=C,w=s*h+u,O=w;if(i!==0||o!==0){const x=i*d,D=i*m,M=o*f,F=o*h;E+=M,y+=M,v+=F,b+=F,C+=x,O+=x,w+=D,T+=D}r[0]=Math.min(r[0],E,v,b,y),r[1]=Math.min(r[1],C,w,T,O),r[2]=Math.max(r[2],E,v,b,y),r[3]=Math.max(r[3],C,w,T,O)}static inverseTransform(e){const n=e[0]*e[3]-e[1]*e[2];return[e[3]/n,-e[1]/n,-e[2]/n,e[0]/n,(e[2]*e[5]-e[4]*e[3])/n,(e[4]*e[1]-e[5]*e[0])/n]}static singularValueDecompose2dScale(e,n){const r=e[0],a=e[1],i=e[2],o=e[3],s=r**2+a**2,l=r*i+a*o,u=i**2+o**2,d=(s+u)/2,f=Math.sqrt(d**2-(s*u-l**2));n[0]=Math.sqrt(d+f||1),n[1]=Math.sqrt(d-f||1)}static normalizeRect(e){const n=e.slice(0);return e[0]>e[2]&&(n[0]=e[2],n[2]=e[0]),e[1]>e[3]&&(n[1]=e[3],n[3]=e[1]),n}static intersect(e,n){const r=Math.max(Math.min(e[0],e[2]),Math.min(n[0],n[2])),a=Math.min(Math.max(e[0],e[2]),Math.max(n[0],n[2]));if(r>a)return null;const i=Math.max(Math.min(e[1],e[3]),Math.min(n[1],n[3])),o=Math.min(Math.max(e[1],e[3]),Math.max(n[1],n[3]));return i>o?null:[r,i,a,o]}static pointBoundingBox(e,n,r){r[0]=Math.min(r[0],e),r[1]=Math.min(r[1],n),r[2]=Math.max(r[2],e),r[3]=Math.max(r[3],n)}static rectBoundingBox(e,n,r,a,i){i[0]=Math.min(i[0],e,r),i[1]=Math.min(i[1],n,a),i[2]=Math.max(i[2],e,r),i[3]=Math.max(i[3],n,a)}static bezierBoundingBox(e,n,r,a,i,o,s,l,u){u[0]=Math.min(u[0],e,s),u[1]=Math.min(u[1],n,l),u[2]=Math.max(u[2],e,s),u[3]=Math.max(u[3],n,l),X(this,jc,d7).call(this,e,r,i,s,n,a,o,l,3*(-e+3*(r-i)+s),6*(e-2*r+i),3*(r-e),u),X(this,jc,d7).call(this,e,r,i,s,n,a,o,l,3*(-n+3*(a-o)+l),6*(n-2*a+o),3*(a-n),u)}}jc=new WeakSet,K1=function(e,n,r,a,i,o,s,l,u,d){if(u<=0||u>=1)return;const f=1-u,m=u*u,h=m*u,E=f*(f*(f*e+3*u*n)+3*m*r)+h*a,b=f*(f*(f*i+3*u*o)+3*m*s)+h*l;d[0]=Math.min(d[0],E),d[1]=Math.min(d[1],b),d[2]=Math.max(d[2],E),d[3]=Math.max(d[3],b)},d7=function(e,n,r,a,i,o,s,l,u,d,f,m){if(Math.abs(u)<1e-12){Math.abs(d)>=1e-12&&X(this,jc,K1).call(this,e,n,r,a,i,o,s,l,-f/d,m);return}const h=d**2-4*f*u;if(h<0)return;const E=Math.sqrt(h),b=2*u;X(this,jc,K1).call(this,e,n,r,a,i,o,s,l,(-d+E)/b,m),X(this,jc,K1).call(this,e,n,r,a,i,o,s,l,(-d-E)/b,m)},V(at,jc);function DYe(t){return decodeURIComponent(escape(t))}let hB=null,uce=null;function dce(t){return hB||(hB=/([\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,uce=new Map([["ſt","ſt"]])),t.replaceAll(hB,(e,n,r)=>n?n.normalize("NFKC"):uce.get(r))}function gB(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const t=new Uint8Array(32);return crypto.getRandomValues(t),cce(t)}const _B="pdfjs_internal_id_";function kYe(t,e,n){if(!Array.isArray(n)||n.length<2)return!1;const[r,a,...i]=n;if(!t(r)&&!Number.isInteger(r)||!e(a))return!1;const o=i.length;let s=!0;switch(a.name){case"XYZ":if(o<2||o>3)return!1;break;case"Fit":case"FitB":return o===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(o>1)return!1;break;case"FitR":if(o!==4)return!1;s=!1;break;default:return!1}for(const l of i)if(!(typeof l=="number"||s&&l===null))return!1;return!0}function ri(t,e,n){return Math.min(Math.max(t,e),n)}function pce(t){return Uint8Array.prototype.toBase64?t.toBase64():btoa(cce(t))}function MYe(t){return Uint8Array.fromBase64?Uint8Array.fromBase64(t):BE(atob(t))}typeof Promise.try!="function"&&(Promise.try=function(t,...e){return new Promise(n=>{n(t(...e))})}),typeof Math.sumPrecise!="function"&&(Math.sumPrecise=function(t){return t.reduce((e,n)=>e+n,0)});class UE{static textContent(e){const n=[],r={items:n,styles:Object.create(null)};function a(i){var l;if(!i)return;let o=null;const s=i.name;if(s==="#text")o=i.value;else if(UE.shouldBuildText(s))(l=i==null?void 0:i.attributes)!=null&&l.textContent?o=i.attributes.textContent:i.value&&(o=i.value);else return;if(o!==null&&n.push({str:o}),!!i.children)for(const u of i.children)a(u)}return a(e),r}static shouldBuildText(e){return!(e==="textarea"||e==="input"||e==="option"||e==="select")}}class bB{static setupStorage(e,n,r,a,i){const o=a.getValue(n,{value:null});switch(r.name){case"textarea":if(o.value!==null&&(e.textContent=o.value),i==="print")break;e.addEventListener("input",s=>{a.setValue(n,{value:s.target.value})});break;case"input":if(r.attributes.type==="radio"||r.attributes.type==="checkbox"){if(o.value===r.attributes.xfaOn?e.setAttribute("checked",!0):o.value===r.attributes.xfaOff&&e.removeAttribute("checked"),i==="print")break;e.addEventListener("change",s=>{a.setValue(n,{value:s.target.checked?s.target.getAttribute("xfaOn"):s.target.getAttribute("xfaOff")})})}else{if(o.value!==null&&e.setAttribute("value",o.value),i==="print")break;e.addEventListener("input",s=>{a.setValue(n,{value:s.target.value})})}break;case"select":if(o.value!==null){e.setAttribute("value",o.value);for(const s of r.children)s.attributes.value===o.value?s.attributes.selected=!0:s.attributes.hasOwnProperty("selected")&&delete s.attributes.selected}e.addEventListener("input",s=>{const l=s.target.options,u=l.selectedIndex===-1?"":l[l.selectedIndex].value;a.setValue(n,{value:u})});break}}static setAttributes({html:e,element:n,storage:r=null,intent:a,linkService:i}){const{attributes:o}=n,s=e instanceof HTMLAnchorElement;o.type==="radio"&&(o.name=`${o.name}-${a}`);for(const[l,u]of Object.entries(o))if(u!=null)switch(l){case"class":u.length&&e.setAttribute(l,u.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",u);break;case"style":Object.assign(e.style,u);break;case"textContent":e.textContent=u;break;default:(!s||l!=="href"&&l!=="newWindow")&&e.setAttribute(l,u)}s&&i.addLinkAttributes(e,o.href,o.newWindow),r&&o.dataId&&this.setupStorage(e,o.dataId,n,r)}static render(e){var f,m;const n=e.annotationStorage,r=e.linkService,a=e.xfaHtml,i=e.intent||"display",o=document.createElement(a.name);a.attributes&&this.setAttributes({html:o,element:a,intent:i,linkService:r});const s=i!=="richText",l=e.div;if(l.append(o),e.viewport){const h=`matrix(${e.viewport.transform.join(",")})`;l.style.transform=h}s&&l.setAttribute("class","xfaLayer xfaFont");const u=[];if(a.children.length===0){if(a.value){const h=document.createTextNode(a.value);o.append(h),s&&UE.shouldBuildText(a.name)&&u.push(h)}return{textDivs:u}}const d=[[a,-1,o]];for(;d.length>0;){const[h,E,b]=d.at(-1);if(E+1===h.children.length){d.pop();continue}const v=h.children[++d.at(-1)[1]];if(v===null)continue;const{name:y}=v;if(y==="#text"){const T=document.createTextNode(v.value);u.push(T),b.append(T);continue}const C=(f=v==null?void 0:v.attributes)!=null&&f.xmlns?document.createElementNS(v.attributes.xmlns,y):document.createElement(y);if(b.append(C),v.attributes&&this.setAttributes({html:C,element:v,storage:n,intent:i,linkService:r}),((m=v.children)==null?void 0:m.length)>0)d.push([v,-1,C]);else if(v.value){const T=document.createTextNode(v.value);s&&UE.shouldBuildText(y)&&u.push(T),C.append(T)}}for(const h of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))h.setAttribute("readOnly",!0);return{textDivs:u}}static update(e){const n=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=n,e.div.hidden=!1}}const Yc="http://www.w3.org/2000/svg",Gf=class Gf{};Fe(Gf,"CSS",96),Fe(Gf,"PDF",72),Fe(Gf,"PDF_TO_CSS_UNITS",Gf.CSS/Gf.PDF);let Vc=Gf;async function xg(t,e="text"){if(qE(t,document.baseURI)){const n=await fetch(t);if(!n.ok)throw new Error(n.statusText);switch(e){case"arraybuffer":return n.arrayBuffer();case"blob":return n.blob();case"json":return n.json()}return n.text()}return new Promise((n,r)=>{const a=new XMLHttpRequest;a.open("GET",t,!0),a.responseType=e,a.onreadystatechange=()=>{if(a.readyState===XMLHttpRequest.DONE){if(a.status===200||a.status===0){switch(e){case"arraybuffer":case"blob":case"json":n(a.response);return}n(a.responseText);return}r(new Error(a.statusText))}},a.send(null)})}class GE{constructor({viewBox:e,userUnit:n,scale:r,rotation:a,offsetX:i=0,offsetY:o=0,dontFlip:s=!1}){this.viewBox=e,this.userUnit=n,this.scale=r,this.rotation=a,this.offsetX=i,this.offsetY=o,r*=n;const l=(e[2]+e[0])/2,u=(e[3]+e[1])/2;let d,f,m,h;switch(a%=360,a<0&&(a+=360),a){case 180:d=-1,f=0,m=0,h=1;break;case 90:d=0,f=1,m=1,h=0;break;case 270:d=0,f=-1,m=-1,h=0;break;case 0:d=1,f=0,m=0,h=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}s&&(m=-m,h=-h);let E,b,v,y;d===0?(E=Math.abs(u-e[1])*r+i,b=Math.abs(l-e[0])*r+o,v=(e[3]-e[1])*r,y=(e[2]-e[0])*r):(E=Math.abs(l-e[0])*r+i,b=Math.abs(u-e[1])*r+o,v=(e[2]-e[0])*r,y=(e[3]-e[1])*r),this.transform=[d*r,f*r,m*r,h*r,E-d*r*l-m*r*u,b-f*r*l-h*r*u],this.width=v,this.height=y}get rawDims(){const e=this.viewBox;return jt(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:e=this.scale,rotation:n=this.rotation,offsetX:r=this.offsetX,offsetY:a=this.offsetY,dontFlip:i=!1}={}){return new GE({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:e,rotation:n,offsetX:r,offsetY:a,dontFlip:i})}convertToViewportPoint(e,n){const r=[e,n];return at.applyTransform(r,this.transform),r}convertToViewportRectangle(e){const n=[e[0],e[1]];at.applyTransform(n,this.transform);const r=[e[2],e[3]];return at.applyTransform(r,this.transform),[n[0],n[1],r[0],r[1]]}convertToPdfPoint(e,n){const r=[e,n];return at.applyInverseTransform(r,this.transform),r}}class WA extends Mf{constructor(e,n=0){super(e,"RenderingCancelledException"),this.extraDelay=n}}function zE(t){const e=t.length;let n=0;for(;n<e&&t[n].trim()==="";)n++;return t.substring(n,n+5).toLowerCase()==="data:"}function KA(t){return typeof t=="string"&&/\.pdf$/i.test(t)}function fce(t){return[t]=t.split(/[#?]/,1),t.substring(t.lastIndexOf("/")+1)}function mce(t,e="document.pdf"){if(typeof t!="string")return e;if(zE(t))return Ft('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const r=(s=>{try{return new URL(s)}catch{try{return new URL(decodeURIComponent(s))}catch{try{return new URL(s,"https://foo.bar")}catch{try{return new URL(decodeURIComponent(s),"https://foo.bar")}catch{return null}}}}})(t);if(!r)return e;const a=s=>{try{let l=decodeURIComponent(s);return l.includes("/")?(l=l.split("/").at(-1),l.test(/^\.pdf$/i)?l:s):l}catch{return s}},i=/\.pdf$/i,o=r.pathname.split("/").at(-1);if(i.test(o))return a(o);if(r.searchParams.size>0){const s=Array.from(r.searchParams.values()).reverse();for(const u of s)if(i.test(u))return a(u);const l=Array.from(r.searchParams.keys()).reverse();for(const u of l)if(i.test(u))return a(u)}if(r.hash){const l=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(r.hash);if(l)return a(l[0])}return e}class hce{constructor(){Fe(this,"started",Object.create(null));Fe(this,"times",[])}time(e){e in this.started&&Ft(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||Ft(`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 n=0;for(const{name:r}of this.times)n=Math.max(r.length,n);for(const{name:r,start:a,end:i}of this.times)e.push(`${r.padEnd(n)} ${i-a}ms
|
|
656
656
|
`);return e.join("")}}function qE(t,e){const n=e?URL.parse(t,e):URL.parse(t);return(n==null?void 0:n.protocol)==="http:"||(n==null?void 0:n.protocol)==="https:"}function So(t){t.preventDefault()}function Or(t){t.preventDefault(),t.stopPropagation()}function LYe(t){console.log("Deprecated API usage: "+t)}class HE{static toDateObject(e){if(e instanceof Date)return e;if(!e||typeof e!="string")return null;_(this,aS)||L(this,aS,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const n=_(this,aS).exec(e);if(!n)return null;const r=parseInt(n[1],10);let a=parseInt(n[2],10);a=a>=1&&a<=12?a-1:0;let i=parseInt(n[3],10);i=i>=1&&i<=31?i:1;let o=parseInt(n[4],10);o=o>=0&&o<=23?o:0;let s=parseInt(n[5],10);s=s>=0&&s<=59?s:0;let l=parseInt(n[6],10);l=l>=0&&l<=59?l:0;const u=n[7]||"Z";let d=parseInt(n[8],10);d=d>=0&&d<=23?d:0;let f=parseInt(n[9],10)||0;return f=f>=0&&f<=59?f:0,u==="-"?(o+=d,s+=f):u==="+"&&(o-=d,s-=f),new Date(Date.UTC(r,a,i,o,s,l))}}aS=new WeakMap,V(HE,aS);function gce(t,{scale:e=1,rotation:n=0}){const{width:r,height:a}=t.attributes.style,i=[0,0,parseInt(r),parseInt(a)];return new GE({viewBox:i,userUnit:1,scale:e,rotation:n})}function Ng(t){if(t.startsWith("#")){const e=parseInt(t.slice(1),16);return[(e&16711680)>>16,(e&65280)>>8,e&255]}return t.startsWith("rgb(")?t.slice(4,-1).split(",").map(e=>parseInt(e)):t.startsWith("rgba(")?t.slice(5,-1).split(",").map(e=>parseInt(e)).slice(0,3):(Ft(`Not a valid color format: "${t}"`),[0,0,0])}function PYe(t){const e=document.createElement("span");e.style.visibility="hidden",e.style.colorScheme="only light",document.body.append(e);for(const n of t.keys()){e.style.color=n;const r=window.getComputedStyle(e).color;t.set(n,Ng(r))}e.remove()}function Ir(t){const{a:e,b:n,c:r,d:a,e:i,f:o}=t.getTransform();return[e,n,r,a,i,o]}function Hl(t){const{a:e,b:n,c:r,d:a,e:i,f:o}=t.getTransform().invertSelf();return[e,n,r,a,i,o]}function xd(t,e,n=!1,r=!0){if(e instanceof GE){const{pageWidth:a,pageHeight:i}=e.rawDims,{style:o}=t,s=Ra.isCSSRoundSupported,l=`var(--total-scale-factor) * ${a}px`,u=`var(--total-scale-factor) * ${i}px`,d=s?`round(down, ${l}, var(--scale-round-x))`:`calc(${l})`,f=s?`round(down, ${u}, var(--scale-round-y))`:`calc(${u})`;!n||e.rotation%180===0?(o.width=d,o.height=f):(o.width=f,o.height=d)}r&&t.setAttribute("data-main-rotation",e.rotation)}class Ks{constructor(){const{pixelRatio:e}=Ks;this.sx=e,this.sy=e}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(e,n,r,a,i=-1){let o=1/0,s=1/0,l=1/0;r=Ks.capPixels(r,i),r>0&&(o=Math.sqrt(r/(e*n))),a!==-1&&(s=a/e,l=a/n);const u=Math.min(o,s,l);return this.sx>u||this.sy>u?(this.sx=u,this.sy=u,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(e,n){if(n>=0){const r=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+n/100));return e>0?Math.min(e,r):r}return e}}const XA=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];class FYe{static get isDarkMode(){var e;return jt(this,"isDarkMode",!!((e=window==null?void 0:window.matchMedia)!=null&&e.call(window,"(prefers-color-scheme: dark)").matches))}}class _ce{static get commentForegroundColor(){const e=document.createElement("span");e.classList.add("comment","sidebar");const{style:n}=e;n.width=n.height="0",n.display="none",n.color="var(--comment-fg-color)",document.body.append(e);const{color:r}=window.getComputedStyle(e);return e.remove(),jt(this,"commentForegroundColor",Ng(r))}}function bce(t,e,n,r){r=Math.min(Math.max(r??1,0),1);const a=255*(1-r);return t=Math.round(t*r+a),e=Math.round(e*r+a),n=Math.round(n*r+a),[t,e,n]}function Ece(t,e){const n=t[0]/255,r=t[1]/255,a=t[2]/255,i=Math.max(n,r,a),o=Math.min(n,r,a),s=(i+o)/2;if(i===o)e[0]=e[1]=0;else{const l=i-o;switch(e[1]=s<.5?l/(i+o):l/(2-i-o),i){case n:e[0]=((r-a)/l+(r<a?6:0))*60;break;case r:e[0]=((a-n)/l+2)*60;break;case a:e[0]=((n-r)/l+4)*60;break}}e[2]=s}function EB(t,e){const n=t[0],r=t[1],a=t[2],i=(1-Math.abs(2*a-1))*r,o=i*(1-Math.abs(n/60%2-1)),s=a-i/2;switch(Math.floor(n/60)){case 0:e[0]=i+s,e[1]=o+s,e[2]=s;break;case 1:e[0]=o+s,e[1]=i+s,e[2]=s;break;case 2:e[0]=s,e[1]=i+s,e[2]=o+s;break;case 3:e[0]=s,e[1]=o+s,e[2]=i+s;break;case 4:e[0]=o+s,e[1]=s,e[2]=i+s;break;case 5:case 6:e[0]=i+s,e[1]=s,e[2]=o+s;break}}function Sce(t){return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function vce(t,e,n){EB(t,n),n.map(Sce);const r=.2126*n[0]+.7152*n[1]+.0722*n[2];EB(e,n),n.map(Sce);const a=.2126*n[0]+.7152*n[1]+.0722*n[2];return r>a?(r+.05)/(a+.05):(a+.05)/(r+.05)}const yce=new Map;function Tce(t,e){const n=t[0]+t[1]*256+t[2]*65536+e[0]*16777216+e[1]*4294967296+e[2]*1099511627776;let r=yce.get(n);if(r)return r;const a=new Float32Array(9),i=a.subarray(0,3),o=a.subarray(3,6);Ece(t,o);const s=a.subarray(6,9);Ece(e,s);const l=s[2]<.5,u=l?12:4.5;if(o[2]=l?Math.sqrt(o[2]):1-Math.sqrt(1-o[2]),vce(o,s,i)<u){let d,f;l?(d=o[2],f=1):(d=0,f=o[2]);const m=.005;for(;f-d>m;){const h=o[2]=(d+f)/2;l===vce(o,s,i)<u?d=h:f=h}o[2]=l?f:d}return EB(o,i),r=at.makeHexColor(Math.round(i[0]*255),Math.round(i[1]*255),Math.round(i[2]*255)),yce.set(n,r),r}function SB({html:t,dir:e,className:n},r){const a=document.createDocumentFragment();if(typeof t=="string"){const i=document.createElement("p");i.dir=e||"auto";const o=t.split(/(?:\r\n?|\n)/);for(let s=0,l=o.length;s<l;++s){const u=o[s];i.append(document.createTextNode(u)),s<l-1&&i.append(document.createElement("br"))}a.append(i)}else bB.render({xfaHtml:t,div:a,intent:"richText"});a.firstChild.classList.add("richText",n),r.append(a)}const Wc=class Wc{constructor(e){V(this,za);V(this,Od,null);V(this,Id,null);V(this,os);V(this,ss,null);V(this,iS,null);V(this,Dd,null);V(this,Bg,null);V(this,Ug,null);L(this,os,e),_(Wc,oS)||L(Wc,oS,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",signature:"pdfjs-editor-remove-signature-button"}))}render(){const e=L(this,Od,document.createElement("div"));e.classList.add("editToolbar","hidden"),e.setAttribute("role","toolbar");const n=_(this,os)._uiManager._signal;n instanceof AbortSignal&&!n.aborted&&(e.addEventListener("contextmenu",So,{signal:n}),e.addEventListener("pointerdown",X(Wc,yR,hme),{signal:n}));const r=L(this,ss,document.createElement("div"));r.className="buttons",e.append(r);const a=_(this,os).toolbarPosition;if(a){const{style:i}=e,o=_(this,os)._uiManager.direction==="ltr"?1-a[0]:a[0];i.insetInlineEnd=`${100*o}%`,i.top=`calc(${100*a[1]}% + var(--editor-toolbar-vert-offset))`}return e}get div(){return _(this,Od)}hide(){var e;_(this,Od).classList.add("hidden"),(e=_(this,Id))==null||e.hideDropdown()}show(){var e,n;_(this,Od).classList.remove("hidden"),(e=_(this,iS))==null||e.shown(),(n=_(this,Dd))==null||n.shown()}addDeleteButton(){const{editorType:e,_uiManager:n}=_(this,os),r=document.createElement("button");r.classList.add("basic","deleteButton"),r.tabIndex=0,r.setAttribute("data-l10n-id",_(Wc,oS)[e]),X(this,za,jb).call(this,r)&&r.addEventListener("click",a=>{n.delete()},{signal:n._signal}),_(this,ss).append(r)}async addAltText(e){const n=await e.render();X(this,za,jb).call(this,n),_(this,ss).append(n,_(this,za,Ry)),L(this,iS,e)}addComment(e,n=null){if(_(this,Dd))return;const r=e.renderForToolbar();if(!r)return;X(this,za,jb).call(this,r);const a=L(this,Bg,_(this,za,Ry));n?(_(this,ss).insertBefore(r,n),_(this,ss).insertBefore(a,n)):_(this,ss).append(r,a),L(this,Dd,e),e.toolbar=this}addColorPicker(e){if(_(this,Id))return;L(this,Id,e);const n=e.renderButton();X(this,za,jb).call(this,n),_(this,ss).append(n,_(this,za,Ry))}async addEditSignatureButton(e){const n=L(this,Ug,await e.renderEditButton(_(this,os)));X(this,za,jb).call(this,n),_(this,ss).append(n,_(this,za,Ry))}removeButton(e){var n,r;switch(e){case"comment":(n=_(this,Dd))==null||n.removeToolbarCommentButton(),L(this,Dd,null),(r=_(this,Bg))==null||r.remove(),L(this,Bg,null);break}}async addButton(e,n){switch(e){case"colorPicker":this.addColorPicker(n);break;case"altText":await this.addAltText(n);break;case"editSignature":await this.addEditSignatureButton(n);break;case"delete":this.addDeleteButton();break;case"comment":this.addComment(n);break}}async addButtonBefore(e,n,r){const a=_(this,ss).querySelector(r);a&&e==="comment"&&this.addComment(n,a)}updateEditSignatureButton(e){_(this,Ug)&&(_(this,Ug).title=e)}remove(){var e;_(this,Od).remove(),(e=_(this,Id))==null||e.destroy(),L(this,Id,null)}};Od=new WeakMap,Id=new WeakMap,os=new WeakMap,ss=new WeakMap,iS=new WeakMap,Dd=new WeakMap,Bg=new WeakMap,Ug=new WeakMap,oS=new WeakMap,yR=new WeakSet,hme=function(e){e.stopPropagation()},za=new WeakSet,gme=function(e){_(this,os)._focusEventsAllowed=!1,Or(e)},_me=function(e){_(this,os)._focusEventsAllowed=!0,Or(e)},jb=function(e){const n=_(this,os)._uiManager._signal;return!(n instanceof AbortSignal)||n.aborted?!1:(e.addEventListener("focusin",X(this,za,gme).bind(this),{capture:!0,signal:n}),e.addEventListener("focusout",X(this,za,_me).bind(this),{capture:!0,signal:n}),e.addEventListener("contextmenu",So,{signal:n}),!0)},Ry=function(){const e=document.createElement("div");return e.className="divider",e},V(Wc,yR),V(Wc,oS,null);let vB=Wc;class BYe{constructor(e){V(this,Xc);V(this,sS,null);V(this,zf,null);V(this,Kc);L(this,Kc,e)}show(e,n,r){const[a,i]=X(this,Xc,Eme).call(this,n,r),{style:o}=_(this,zf)||L(this,zf,X(this,Xc,bme).call(this));e.append(_(this,zf)),o.insetInlineEnd=`${100*a}%`,o.top=`calc(${100*i}% + var(--editor-toolbar-vert-offset))`}hide(){_(this,zf).remove()}}sS=new WeakMap,zf=new WeakMap,Kc=new WeakMap,Xc=new WeakSet,bme=function(){const e=L(this,zf,document.createElement("div"));e.className="editToolbar",e.setAttribute("role","toolbar");const n=_(this,Kc)._signal;n instanceof AbortSignal&&!n.aborted&&e.addEventListener("contextmenu",So,{signal:n});const r=L(this,sS,document.createElement("div"));return r.className="buttons",e.append(r),_(this,Kc).hasCommentManager()&&X(this,Xc,p7).call(this,"commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{_(this,Kc).commentSelection("floating_button")}),X(this,Xc,p7).call(this,"highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{_(this,Kc).highlightSelection("floating_button")}),e},Eme=function(e,n){let r=0,a=0;for(const i of e){const o=i.y+i.height;if(o<r)continue;const s=i.x+(n?i.width:0);if(o>r){a=s,r=o;continue}n?s>a&&(a=s):s<a&&(a=s)}return[n?1-a:a,r]},p7=function(e,n,r,a){const i=document.createElement("button");i.classList.add("basic",e),i.tabIndex=0,i.setAttribute("data-l10n-id",n);const o=document.createElement("span");i.append(o),o.className="visuallyHidden",o.setAttribute("data-l10n-id",r);const s=_(this,Kc)._signal;s instanceof AbortSignal&&!s.aborted&&(i.addEventListener("contextmenu",So,{signal:s}),i.addEventListener("click",a,{signal:s})),_(this,sS).append(i)};function Cce(t,e,n){for(const r of n)e.addEventListener(r,t[r].bind(t))}class UYe{constructor(){V(this,TR,0)}get id(){return`${ME}${Ca(this,TR)._++}`}}TR=new WeakMap;const i6=class i6{constructor(){V(this,zg);V(this,Gg,gB());V(this,lS,0);V(this,ii,null)}static get _isSVGFittingCanvas(){const e='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>',r=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),a=new Image;a.src=e;const i=a.decode().then(()=>(r.drawImage(a,0,0,1,1,0,0,1,3),new Uint32Array(r.getImageData(0,0,1,1).data.buffer)[0]===0));return jt(this,"_isSVGFittingCanvas",i)}async getFromFile(e){const{lastModified:n,name:r,size:a,type:i}=e;return X(this,zg,X1).call(this,`${n}_${r}_${a}_${i}`,e)}async getFromUrl(e){return X(this,zg,X1).call(this,e,e)}async getFromBlob(e,n){const r=await n;return X(this,zg,X1).call(this,e,r)}async getFromId(e){_(this,ii)||L(this,ii,new Map);const n=_(this,ii).get(e);if(!n)return null;if(n.bitmap)return n.refCounter+=1,n;if(n.file)return this.getFromFile(n.file);if(n.blobPromise){const{blobPromise:r}=n;return delete n.blobPromise,this.getFromBlob(n.id,r)}return this.getFromUrl(n.url)}getFromCanvas(e,n){_(this,ii)||L(this,ii,new Map);let r=_(this,ii).get(e);if(r!=null&&r.bitmap)return r.refCounter+=1,r;const a=new OffscreenCanvas(n.width,n.height);return a.getContext("2d").drawImage(n,0,0),r={bitmap:a.transferToImageBitmap(),id:`image_${_(this,Gg)}_${Ca(this,lS)._++}`,refCounter:1,isSvg:!1},_(this,ii).set(e,r),_(this,ii).set(r.id,r),r}getSvgUrl(e){const n=_(this,ii).get(e);return n!=null&&n.isSvg?n.svgUrl:null}deleteId(e){var a;_(this,ii)||L(this,ii,new Map);const n=_(this,ii).get(e);if(!n||(n.refCounter-=1,n.refCounter!==0))return;const{bitmap:r}=n;if(!n.url&&!n.file){const i=new OffscreenCanvas(r.width,r.height);i.getContext("bitmaprenderer").transferFromImageBitmap(r),n.blobPromise=i.convertToBlob()}(a=r.close)==null||a.call(r),n.bitmap=null}isValidId(e){return e.startsWith(`image_${_(this,Gg)}_`)}};Gg=new WeakMap,lS=new WeakMap,ii=new WeakMap,zg=new WeakSet,X1=async function(e,n){_(this,ii)||L(this,ii,new Map);let r=_(this,ii).get(e);if(r===null)return null;if(r!=null&&r.bitmap)return r.refCounter+=1,r;try{r||(r={bitmap:null,id:`image_${_(this,Gg)}_${Ca(this,lS)._++}`,refCounter:0,isSvg:!1});let a;if(typeof n=="string"?(r.url=n,a=await xg(n,"blob")):n instanceof File?a=r.file=n:n instanceof Blob&&(a=n),a.type==="image/svg+xml"){const i=i6._isSVGFittingCanvas,o=new FileReader,s=new Image,l=new Promise((u,d)=>{s.onload=()=>{r.bitmap=s,r.isSvg=!0,u()},o.onload=async()=>{const f=r.svgUrl=o.result;s.src=await i?`${f}#svgView(preserveAspectRatio(none))`:f},s.onerror=o.onerror=d});o.readAsDataURL(a),await l}else r.bitmap=await createImageBitmap(a);r.refCounter=1}catch(a){Ft(a),r=null}return _(this,ii).set(e,r),r&&_(this,ii).set(r.id,r),r};let yB=i6;class GYe{constructor(e=128){V(this,Qr,[]);V(this,kd,!1);V(this,cS);V(this,kr,-1);L(this,cS,e)}add({cmd:e,undo:n,post:r,mustExec:a,type:i=NaN,overwriteIfSameType:o=!1,keepUndo:s=!1}){if(a&&e(),_(this,kd))return;const l={cmd:e,undo:n,post:r,type:i};if(_(this,kr)===-1){_(this,Qr).length>0&&(_(this,Qr).length=0),L(this,kr,0),_(this,Qr).push(l);return}if(o&&_(this,Qr)[_(this,kr)].type===i){s&&(l.undo=_(this,Qr)[_(this,kr)].undo),_(this,Qr)[_(this,kr)]=l;return}const u=_(this,kr)+1;u===_(this,cS)?_(this,Qr).splice(0,1):(L(this,kr,u),u<_(this,Qr).length&&_(this,Qr).splice(u)),_(this,Qr).push(l)}undo(){if(_(this,kr)===-1)return;L(this,kd,!0);const{undo:e,post:n}=_(this,Qr)[_(this,kr)];e(),n==null||n(),L(this,kd,!1),L(this,kr,_(this,kr)-1)}redo(){if(_(this,kr)<_(this,Qr).length-1){L(this,kr,_(this,kr)+1),L(this,kd,!0);const{cmd:e,post:n}=_(this,Qr)[_(this,kr)];e(),n==null||n(),L(this,kd,!1)}}hasSomethingToUndo(){return _(this,kr)!==-1}hasSomethingToRedo(){return _(this,kr)<_(this,Qr).length-1}cleanType(e){if(_(this,kr)!==-1){for(let n=_(this,kr);n>=0;n--)if(_(this,Qr)[n].type!==e){_(this,Qr).splice(n+1,_(this,kr)-n),L(this,kr,n);return}_(this,Qr).length=0,L(this,kr,-1)}}destroy(){L(this,Qr,null)}}Qr=new WeakMap,kd=new WeakMap,cS=new WeakMap,kr=new WeakMap;class $E{constructor(e){V(this,CR);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:n}=Ra.platform;for(const[r,a,i={}]of e)for(const o of r){const s=o.startsWith("mac+");n&&s?(this.callbacks.set(o.slice(4),{callback:a,options:i}),this.allKeys.add(o.split("+").at(-1))):!n&&!s&&(this.callbacks.set(o,{callback:a,options:i}),this.allKeys.add(o.split("+").at(-1)))}}exec(e,n){if(!this.allKeys.has(n.key))return;const r=this.callbacks.get(X(this,CR,Sme).call(this,n));if(!r)return;const{callback:a,options:{bubbles:i=!1,args:o=[],checker:s=null}}=r;s&&!s(e,n)||(a.bind(e,...o,n)(),i||Or(n))}}CR=new WeakSet,Sme=function(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 n=this.buffer.join("+");return this.buffer.length=0,n};const AR=class AR{get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);return PYe(e),jt(this,"_colors",e)}convert(e){const n=Ng(e);if(!window.matchMedia("(forced-colors: active)").matches)return n;for(const[r,a]of this._colors)if(a.every((i,o)=>i===n[o]))return AR._colorsMapping.get(r);return n}getHexCode(e){const n=this._colors.get(e);return n?at.makeHexColor(...n):e}};Fe(AR,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let TB=AR;const Zg=class Zg{constructor(e,n,r,a,i,o,s,l,u,d,f,m,h,E,b,v){V(this,Ze);V(this,qg,new AbortController);V(this,yo,null);V(this,Hg,null);V(this,Br,new Map);V(this,ha,new Map);V(this,$g,null);V(this,ls,null);V(this,Yg,null);V(this,cs,new GYe);V(this,oi,null);V(this,Md,null);V(this,Ld,null);V(this,Vg,0);V(this,Pd,new Set);V(this,Vl,null);V(this,us,null);V(this,qf,new Set);Fe(this,"_editorUndoBar",null);V(this,uS,!1);V(this,dS,!1);V(this,jg,!1);V(this,pS,null);V(this,jl,null);V(this,Fd,null);V(this,Wg,null);V(this,Bd,!1);V(this,Wl,null);V(this,RR,new UYe);V(this,Ud,!1);V(this,Kg,!1);V(this,fS,!1);V(this,Gd,null);V(this,Hf,null);V(this,Xg,null);V(this,zd,null);V(this,mS,null);V(this,ia,Pt.NONE);V(this,Ln,new Set);V(this,Qc,null);V(this,qd,null);V(this,Hd,null);V(this,hS,null);V(this,Qg,null);V(this,gS,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});V(this,$d,[0,0]);V(this,Kl,null);V(this,Zc,null);V(this,_S,null);V(this,bS,null);V(this,ds,null);const y=this._signal=_(this,qg).signal;L(this,Zc,e),L(this,_S,n),L(this,bS,r),L(this,$g,a),L(this,oi,i),L(this,qd,o),L(this,Qg,l),this._eventBus=s,s._on("editingaction",this.onEditingAction.bind(this),{signal:y}),s._on("pagechanging",this.onPageChanging.bind(this),{signal:y}),s._on("scalechanging",this.onScaleChanging.bind(this),{signal:y}),s._on("rotationchanging",this.onRotationChanging.bind(this),{signal:y}),s._on("setpreference",this.onSetPreference.bind(this),{signal:y}),s._on("switchannotationeditorparams",C=>this.updateParams(C.type,C.value),{signal:y}),window.addEventListener("pointerdown",()=>{L(this,Kg,!0)},{capture:!0,signal:y}),window.addEventListener("pointerup",()=>{L(this,Kg,!1)},{capture:!0,signal:y}),X(this,Ze,Tme).call(this),X(this,Ze,wme).call(this),X(this,Ze,m7).call(this),L(this,ls,l.annotationStorage),L(this,pS,l.filterFactory),L(this,Hd,u),L(this,Wg,d||null),L(this,uS,f),L(this,dS,m),L(this,jg,h),L(this,mS,E||null),this.viewParameters={realScale:Vc.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=b||null,this._supportsPinchToZoom=v!==!1,i==null||i.setSidebarUiManager(this)}static get _keyboardManager(){const e=Zg.prototype,n=o=>_(o,Zc).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&o.hasSomethingToControl(),r=(o,{target:s})=>{if(s instanceof HTMLInputElement){const{type:l}=s;return l!=="text"&&l!=="number"}return!0},a=this.TRANSLATE_SMALL,i=this.TRANSLATE_BIG;return jt(this,"_keyboardManager",new $E([[["ctrl+a","mac+meta+a"],e.selectAll,{checker:r}],[["ctrl+z","mac+meta+z"],e.undo,{checker:r}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo,{checker:r}],[["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:r}],[["Enter","mac+Enter"],e.addNewEditorFromKeyboard,{checker:(o,{target:s})=>!(s instanceof HTMLButtonElement)&&_(o,Zc).contains(s)&&!o.isEnterHandled}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(o,{target:s})=>!(s instanceof HTMLButtonElement)&&_(o,Zc).contains(document.activeElement)}],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-a,0],checker:n}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-i,0],checker:n}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[a,0],checker:n}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[i,0],checker:n}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-a],checker:n}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-i],checker:n}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,a],checker:n}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,i],checker:n}]]))}destroy(){var e,n,r,a,i,o,s,l,u;(e=_(this,ds))==null||e.resolve(),L(this,ds,null),(n=_(this,qg))==null||n.abort(),L(this,qg,null),this._signal=null;for(const d of _(this,ha).values())d.destroy();_(this,ha).clear(),_(this,Br).clear(),_(this,qf).clear(),(r=_(this,zd))==null||r.clear(),L(this,yo,null),_(this,Ln).clear(),_(this,cs).destroy(),(a=_(this,$g))==null||a.destroy(),(i=_(this,oi))==null||i.destroy(),(o=_(this,qd))==null||o.destroy(),(s=_(this,Wl))==null||s.hide(),L(this,Wl,null),(l=_(this,Xg))==null||l.destroy(),L(this,Xg,null),L(this,Hg,null),_(this,jl)&&(clearTimeout(_(this,jl)),L(this,jl,null)),_(this,Kl)&&(clearTimeout(_(this,Kl)),L(this,Kl,null)),(u=this._editorUndoBar)==null||u.destroy(),L(this,Qg,null)}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return _(this,mS)}get useNewAltTextFlow(){return _(this,dS)}get useNewAltTextWhenAddingImage(){return _(this,jg)}get hcmFilter(){return jt(this,"hcmFilter",_(this,Hd)?_(this,pS).addHCMFilter(_(this,Hd).foreground,_(this,Hd).background):"none")}get direction(){return jt(this,"direction",getComputedStyle(_(this,Zc)).direction)}get _highlightColors(){return jt(this,"_highlightColors",_(this,Wg)?new Map(_(this,Wg).split(",").map(e=>(e=e.split("=").map(n=>n.trim()),e[1]=e[1].toUpperCase(),e))):null)}get highlightColors(){const{_highlightColors:e}=this;if(!e)return jt(this,"highlightColors",null);const n=new Map,r=!!_(this,Hd);for(const[a,i]of e){const o=a.endsWith("_HCM");if(r&&o){n.set(a.replace("_HCM",""),i);continue}!r&&!o&&n.set(a,i)}return jt(this,"highlightColors",n)}get highlightColorNames(){return jt(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}getNonHCMColor(e){if(!this._highlightColors)return e;const n=this.highlightColorNames.get(e);return this._highlightColors.get(n)||e}getNonHCMColorName(e){return this.highlightColorNames.get(e)||e}setCurrentDrawingSession(e){e?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),L(this,Ld,e)}setMainHighlightColorPicker(e){L(this,Xg,e)}editAltText(e,n=!1){var r;(r=_(this,$g))==null||r.editAltText(this,e,n)}hasCommentManager(){return!!_(this,oi)}editComment(e,n,r,a){var i;(i=_(this,oi))==null||i.showDialog(this,e,n,r,a)}selectComment(e,n){const r=_(this,ha).get(e),a=r==null?void 0:r.getEditorByUID(n);a==null||a.toggleComment(!0,!0)}updateComment(e){var n;(n=_(this,oi))==null||n.updateComment(e.getData())}updatePopupColor(e){var n;(n=_(this,oi))==null||n.updatePopupColor(e)}removeComment(e){var n;(n=_(this,oi))==null||n.removeComments([e.uid])}toggleComment(e,n,r=void 0){var a;(a=_(this,oi))==null||a.toggleCommentPopup(e,n,r)}makeCommentColor(e,n){var r;return e&&((r=_(this,oi))==null?void 0:r.makeCommentColor(e,n))||null}getCommentDialogElement(){var e;return((e=_(this,oi))==null?void 0:e.dialogElement)||null}async waitForEditorsRendered(e){if(_(this,ha).has(e-1))return;const{resolve:n,promise:r}=Promise.withResolvers(),a=i=>{i.pageNumber===e&&(this._eventBus._off("editorsrendered",a),n())};this._eventBus.on("editorsrendered",a),await r}getSignature(e){var n;(n=_(this,qd))==null||n.getSignature({uiManager:this,editor:e})}get signatureManager(){return _(this,qd)}switchToMode(e,n){this._eventBus.on("annotationeditormodechanged",n,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:e})}setPreference(e,n){this._eventBus.dispatch("setpreference",{source:this,name:e,value:n})}onSetPreference({name:e,value:n}){switch(e){case"enableNewAltTextWhenAddingImage":L(this,jg,n);break}}onPageChanging({pageNumber:e}){L(this,Vg,e-1)}focusMainContainer(){_(this,Zc).focus()}findParent(e,n){for(const r of _(this,ha).values()){const{x:a,y:i,width:o,height:s}=r.div.getBoundingClientRect();if(e>=a&&e<=a+o&&n>=i&&n<=i+s)return r}return null}disableUserSelect(e=!1){_(this,_S).classList.toggle("noUserSelect",e)}addShouldRescale(e){_(this,qf).add(e)}removeShouldRescale(e){_(this,qf).delete(e)}onScaleChanging({scale:e}){var n;this.commitOrRemove(),this.viewParameters.realScale=e*Vc.PDF_TO_CSS_UNITS;for(const r of _(this,qf))r.onScaleChanging();(n=_(this,Ld))==null||n.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}highlightSelection(e="",n=!1){const r=document.getSelection();if(!r||r.isCollapsed)return;const{anchorNode:a,anchorOffset:i,focusNode:o,focusOffset:s}=r,l=r.toString(),d=X(this,Ze,Q1).call(this,r).closest(".textLayer"),f=this.getSelectionBoxes(d);if(!f)return;r.empty();const m=X(this,Ze,f7).call(this,d),h=_(this,ia)===Pt.NONE,E=()=>{const b=m==null?void 0:m.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:f,anchorNode:a,anchorOffset:i,focusNode:o,focusOffset:s,text:l});h&&this.showAllEditors("highlight",!0,!0),n&&(b==null||b.editComment())};if(h){this.switchToMode(Pt.HIGHLIGHT,E);return}E()}commentSelection(e=""){this.highlightSelection(e,!0)}getAndRemoveDataFromAnnotationStorage(e){if(!_(this,ls))return null;const n=`${ME}${e}`,r=_(this,ls).getRawValue(n);return r&&_(this,ls).remove(n),r}addToAnnotationStorage(e){!e.isEmpty()&&_(this,ls)&&!_(this,ls).has(e.id)&&_(this,ls).setValue(e.id,e)}a11yAlert(e,n=null){const r=_(this,bS);r&&(r.setAttribute("data-l10n-id",e),n?r.setAttribute("data-l10n-args",JSON.stringify(n)):r.removeAttribute("data-l10n-args"))}blur(){if(this.isShiftKeyDown=!1,_(this,Bd)&&(L(this,Bd,!1),X(this,Ze,wy).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:e}=document;for(const n of _(this,Ln))if(n.div.contains(e)){L(this,Hf,[n,e]),n._focusEventsAllowed=!1;break}}focus(){if(!_(this,Hf))return;const[e,n]=_(this,Hf);L(this,Hf,null),n.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),n.focus()}addEditListeners(){X(this,Ze,m7).call(this),X(this,Ze,h7).call(this)}removeEditListeners(){X(this,Ze,Rme).call(this),X(this,Ze,g7).call(this)}dragOver(e){for(const{type:n}of e.dataTransfer.items)for(const r of _(this,us))if(r.isHandlingMimeForPasting(n)){e.dataTransfer.dropEffect="copy",e.preventDefault();return}}drop(e){for(const n of e.dataTransfer.items)for(const r of _(this,us))if(r.isHandlingMimeForPasting(n.type)){r.paste(n,this.currentLayer),e.preventDefault();return}}copy(e){var r;if(e.preventDefault(),(r=_(this,yo))==null||r.commitOrRemove(),!this.hasSelection)return;const n=[];for(const a of _(this,Ln)){const i=a.serialize(!0);i&&n.push(i)}n.length!==0&&e.clipboardData.setData("application/pdfjs",JSON.stringify(n))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();const{clipboardData:n}=e;for(const i of n.items)for(const o of _(this,us))if(o.isHandlingMimeForPasting(i.type)){o.paste(i,this.currentLayer);return}let r=n.getData("application/pdfjs");if(!r)return;try{r=JSON.parse(r)}catch(i){Ft(`paste: "${i.message}".`);return}if(!Array.isArray(r))return;this.unselectAll();const a=this.currentLayer;try{const i=[];for(const l of r){const u=await a.deserialize(l);if(!u)return;i.push(u)}const o=()=>{for(const l of i)X(this,Ze,_7).call(this,l);X(this,Ze,b7).call(this,i)},s=()=>{for(const l of i)l.remove()};this.addCommands({cmd:o,undo:s,mustExec:!0})}catch(i){Ft(`paste: "${i.message}".`)}}keydown(e){!this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!0),_(this,ia)!==Pt.NONE&&!this.isEditorHandlingKeyboard&&Zg._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!1,_(this,Bd)&&(L(this,Bd,!1),X(this,Ze,wy).call(this,"main_toolbar")))}onEditingAction({name:e}){switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu");break;case"commentSelection":this.commentSelection("context_menu");break}}setEditingState(e){e?(X(this,Ze,Cme).call(this),X(this,Ze,h7).call(this),X(this,Ze,Ni).call(this,{isEditing:_(this,ia)!==Pt.NONE,isEmpty:X(this,Ze,xy).call(this),hasSomethingToUndo:_(this,cs).hasSomethingToUndo(),hasSomethingToRedo:_(this,cs).hasSomethingToRedo(),hasSelectedEditor:!1})):(X(this,Ze,Ame).call(this),X(this,Ze,g7).call(this),X(this,Ze,Ni).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!_(this,us)){L(this,us,e);for(const n of _(this,us))X(this,Ze,ed).call(this,n.defaultPropertiesToUpdate)}}getId(){return _(this,RR).id}get currentLayer(){return _(this,ha).get(_(this,Vg))}getLayer(e){return _(this,ha).get(e)}get currentPageIndex(){return _(this,Vg)}addLayer(e){_(this,ha).set(e.pageIndex,e),_(this,Ud)?e.enable():e.disable()}removeLayer(e){_(this,ha).delete(e.pageIndex)}async updateMode(e,n=null,r=!1,a=!1,i=!1){var o,s,l,u,d,f;if(_(this,ia)!==e&&!(_(this,ds)&&(await _(this,ds).promise,!_(this,ds)))){if(L(this,ds,Promise.withResolvers()),(o=_(this,Ld))==null||o.commitOrRemove(),_(this,ia)===Pt.POPUP&&((s=_(this,oi))==null||s.hideSidebar()),(l=_(this,oi))==null||l.destroyPopup(),L(this,ia,e),e===Pt.NONE){this.setEditingState(!1),X(this,Ze,Nme).call(this);for(const m of _(this,Br).values())m.hideStandaloneCommentButton();(u=this._editorUndoBar)==null||u.hide(),this.toggleComment(null),_(this,ds).resolve();return}for(const m of _(this,Br).values())m.addStandaloneCommentButton();e===Pt.SIGNATURE&&await((d=_(this,qd))==null?void 0:d.loadSignatures()),this.setEditingState(!0),await X(this,Ze,xme).call(this),this.unselectAll();for(const m of _(this,ha).values())m.updateMode(e);if(e===Pt.POPUP){_(this,Hg)||L(this,Hg,await _(this,Qg).getAnnotationsByType(new Set(_(this,us).map(E=>E._editorType))));const m=new Set,h=[];for(const E of _(this,Br).values()){const{annotationElementId:b,hasComment:v,deleted:y}=E;b&&m.add(b),v&&!y&&h.push(E.getData())}for(const E of _(this,Hg)){const{id:b,popupRef:v,contentsObj:y}=E;v&&(y!=null&&y.str)&&!m.has(b)&&!_(this,Pd).has(b)&&h.push(E)}(f=_(this,oi))==null||f.showSidebar(h)}if(!n){r&&this.addNewEditorFromKeyboard(),_(this,ds).resolve();return}for(const m of _(this,Br).values())m.uid===n?(this.setSelected(m),i?m.editComment():a?m.enterInEditMode():m.focus()):m.unselect();_(this,ds).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e.mode!==_(this,ia)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...e})}updateParams(e,n){if(_(this,us)){switch(e){case cn.CREATE:this.currentLayer.addNewEditor(n);return;case cn.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(_(this,hS)||L(this,hS,new Map)).set(e,n),this.showAllEditors("highlight",n);break}if(this.hasSelection)for(const r of _(this,Ln))r.updateParams(e,n);else for(const r of _(this,us))r.updateDefaultParams(e,n)}}showAllEditors(e,n,r=!1){var i;for(const o of _(this,Br).values())o.editorType===e&&o.show(n);(((i=_(this,hS))==null?void 0:i.get(cn.HIGHLIGHT_SHOW_ALL))??!0)!==n&&X(this,Ze,ed).call(this,[[cn.HIGHLIGHT_SHOW_ALL,n]])}enableWaiting(e=!1){if(_(this,fS)!==e){L(this,fS,e);for(const n of _(this,ha).values())e?n.disableClick():n.enableClick(),n.div.classList.toggle("waiting",e)}}*getEditors(e){for(const n of _(this,Br).values())n.pageIndex===e&&(yield n)}getEditor(e){return _(this,Br).get(e)}addEditor(e){_(this,Br).set(e.id,e)}removeEditor(e){var n,r;e.div.contains(document.activeElement)&&(_(this,jl)&&clearTimeout(_(this,jl)),L(this,jl,setTimeout(()=>{this.focusMainContainer(),L(this,jl,null)},0))),_(this,Br).delete(e.id),e.annotationElementId&&((n=_(this,zd))==null||n.delete(e.annotationElementId)),this.unselect(e),(!e.annotationElementId||!_(this,Pd).has(e.annotationElementId))&&((r=_(this,ls))==null||r.remove(e.id))}addDeletedAnnotationElement(e){_(this,Pd).add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return _(this,Pd).has(e)}removeDeletedAnnotationElement(e){_(this,Pd).delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}setActiveEditor(e){_(this,yo)!==e&&(L(this,yo,e),e&&X(this,Ze,ed).call(this,e.propertiesToUpdate))}updateUI(e){_(this,Ze,Ome)===e&&X(this,Ze,ed).call(this,e.propertiesToUpdate)}updateUIForDefaultProperties(e){X(this,Ze,ed).call(this,e.defaultPropertiesToUpdate)}toggleSelected(e){if(_(this,Ln).has(e)){_(this,Ln).delete(e),e.unselect(),X(this,Ze,Ni).call(this,{hasSelectedEditor:this.hasSelection});return}_(this,Ln).add(e),e.select(),X(this,Ze,ed).call(this,e.propertiesToUpdate),X(this,Ze,Ni).call(this,{hasSelectedEditor:!0})}setSelected(e){var n;this.updateToolbar({mode:e.mode,editId:e.id}),(n=_(this,Ld))==null||n.commitOrRemove();for(const r of _(this,Ln))r!==e&&r.unselect();_(this,Ln).clear(),_(this,Ln).add(e),e.select(),X(this,Ze,ed).call(this,e.propertiesToUpdate),X(this,Ze,Ni).call(this,{hasSelectedEditor:!0})}isSelected(e){return _(this,Ln).has(e)}get firstSelectedEditor(){return _(this,Ln).values().next().value}unselect(e){e.unselect(),_(this,Ln).delete(e),X(this,Ze,Ni).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return _(this,Ln).size!==0}get isEnterHandled(){return _(this,Ln).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){var e;_(this,cs).undo(),X(this,Ze,Ni).call(this,{hasSomethingToUndo:_(this,cs).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:X(this,Ze,xy).call(this)}),(e=this._editorUndoBar)==null||e.hide()}redo(){_(this,cs).redo(),X(this,Ze,Ni).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:_(this,cs).hasSomethingToRedo(),isEmpty:X(this,Ze,xy).call(this)})}addCommands(e){_(this,cs).add(e),X(this,Ze,Ni).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:X(this,Ze,xy).call(this)})}cleanUndoStack(e){_(this,cs).cleanType(e)}delete(){var i;this.commitOrRemove();const e=(i=this.currentLayer)==null?void 0:i.endDrawingSession(!0);if(!this.hasSelection&&!e)return;const n=e?[e]:[..._(this,Ln)],r=()=>{var o;(o=this._editorUndoBar)==null||o.show(a,n.length===1?n[0].editorType:n.length);for(const s of n)s.remove()},a=()=>{for(const o of n)X(this,Ze,_7).call(this,o)};this.addCommands({cmd:r,undo:a,mustExec:!0})}commitOrRemove(){var e;(e=_(this,yo))==null||e.commitOrRemove()}hasSomethingToControl(){return _(this,yo)||this.hasSelection}selectAll(){for(const e of _(this,Ln))e.commit();X(this,Ze,b7).call(this,_(this,Br).values())}unselectAll(){var e;if(!(_(this,yo)&&(_(this,yo).commitOrRemove(),_(this,ia)!==Pt.NONE))&&!((e=_(this,Ld))!=null&&e.commitOrRemove())&&this.hasSelection){for(const n of _(this,Ln))n.unselect();_(this,Ln).clear(),X(this,Ze,Ni).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(e,n,r=!1){if(r||this.commitOrRemove(),!this.hasSelection)return;_(this,$d)[0]+=e,_(this,$d)[1]+=n;const[a,i]=_(this,$d),o=[..._(this,Ln)],s=1e3;_(this,Kl)&&clearTimeout(_(this,Kl)),L(this,Kl,setTimeout(()=>{L(this,Kl,null),_(this,$d)[0]=_(this,$d)[1]=0,this.addCommands({cmd:()=>{for(const l of o)_(this,Br).has(l.id)&&(l.translateInPage(a,i),l.translationDone())},undo:()=>{for(const l of o)_(this,Br).has(l.id)&&(l.translateInPage(-a,-i),l.translationDone())},mustExec:!1})},s));for(const l of o)l.translateInPage(e,n),l.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),L(this,Vl,new Map);for(const e of _(this,Ln))_(this,Vl).set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!_(this,Vl))return!1;this.disableUserSelect(!1);const e=_(this,Vl);L(this,Vl,null);let n=!1;for(const[{x:a,y:i,pageIndex:o},s]of e)s.newX=a,s.newY=i,s.newPageIndex=o,n||(n=a!==s.savedX||i!==s.savedY||o!==s.savedPageIndex);if(!n)return!1;const r=(a,i,o,s)=>{if(_(this,Br).has(a.id)){const l=_(this,ha).get(s);l?a._setParentAndPosition(l,i,o):(a.pageIndex=s,a.x=i,a.y=o)}};return this.addCommands({cmd:()=>{for(const[a,{newX:i,newY:o,newPageIndex:s}]of e)r(a,i,o,s)},undo:()=>{for(const[a,{savedX:i,savedY:o,savedPageIndex:s}]of e)r(a,i,o,s)},mustExec:!0}),!0}dragSelectedEditors(e,n){if(_(this,Vl))for(const r of _(this,Vl).keys())r.drag(e,n)}rebuild(e){if(e.parent===null){const n=this.getLayer(e.pageIndex);n?(n.changeParent(e),n.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){var e;return((e=this.getActive())==null?void 0:e.shouldGetKeyboardEvents())||_(this,Ln).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return _(this,yo)===e}getActive(){return _(this,yo)}getMode(){return _(this,ia)}isEditingMode(){return _(this,ia)!==Pt.NONE}get imageManager(){return jt(this,"imageManager",new yB)}getSelectionBoxes(e){if(!e)return null;const n=document.getSelection();for(let u=0,d=n.rangeCount;u<d;u++)if(!e.contains(n.getRangeAt(u).commonAncestorContainer))return null;const{x:r,y:a,width:i,height:o}=e.getBoundingClientRect();let s;switch(e.getAttribute("data-main-rotation")){case"90":s=(u,d,f,m)=>({x:(d-a)/o,y:1-(u+f-r)/i,width:m/o,height:f/i});break;case"180":s=(u,d,f,m)=>({x:1-(u+f-r)/i,y:1-(d+m-a)/o,width:f/i,height:m/o});break;case"270":s=(u,d,f,m)=>({x:1-(d+m-a)/o,y:(u-r)/i,width:m/o,height:f/i});break;default:s=(u,d,f,m)=>({x:(u-r)/i,y:(d-a)/o,width:f/i,height:m/o});break}const l=[];for(let u=0,d=n.rangeCount;u<d;u++){const f=n.getRangeAt(u);if(!f.collapsed)for(const{x:m,y:h,width:E,height:b}of f.getClientRects())E===0||b===0||l.push(s(m,h,E,b))}return l.length===0?null:l}addChangedExistingAnnotation({annotationElementId:e,id:n}){(_(this,Yg)||L(this,Yg,new Map)).set(e,n)}removeChangedExistingAnnotation({annotationElementId:e}){var n;(n=_(this,Yg))==null||n.delete(e)}renderAnnotationElement(e){var a;const n=(a=_(this,Yg))==null?void 0:a.get(e.data.id);if(!n)return;const r=_(this,ls).getRawValue(n);r&&(_(this,ia)===Pt.NONE&&!r.hasBeenModified||r.renderAnnotationElement(e))}setMissingCanvas(e,n,r){var i;const a=(i=_(this,zd))==null?void 0:i.get(e);a&&(a.setCanvas(n,r),_(this,zd).delete(e))}addMissingCanvas(e,n){(_(this,zd)||L(this,zd,new Map)).set(e,n)}};qg=new WeakMap,yo=new WeakMap,Hg=new WeakMap,Br=new WeakMap,ha=new WeakMap,$g=new WeakMap,ls=new WeakMap,Yg=new WeakMap,cs=new WeakMap,oi=new WeakMap,Md=new WeakMap,Ld=new WeakMap,Vg=new WeakMap,Pd=new WeakMap,Vl=new WeakMap,us=new WeakMap,qf=new WeakMap,uS=new WeakMap,dS=new WeakMap,jg=new WeakMap,pS=new WeakMap,jl=new WeakMap,Fd=new WeakMap,Wg=new WeakMap,Bd=new WeakMap,Wl=new WeakMap,RR=new WeakMap,Ud=new WeakMap,Kg=new WeakMap,fS=new WeakMap,Gd=new WeakMap,Hf=new WeakMap,Xg=new WeakMap,zd=new WeakMap,mS=new WeakMap,ia=new WeakMap,Ln=new WeakMap,Qc=new WeakMap,qd=new WeakMap,Hd=new WeakMap,hS=new WeakMap,Qg=new WeakMap,gS=new WeakMap,$d=new WeakMap,Kl=new WeakMap,Zc=new WeakMap,_S=new WeakMap,bS=new WeakMap,ds=new WeakMap,Ze=new WeakSet,Q1=function({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e},f7=function(e){const{currentLayer:n}=this;if(n.hasTextLayer(e))return n;for(const r of _(this,ha).values())if(r.hasTextLayer(e))return r;return null},vme=function(){const e=document.getSelection();if(!e||e.isCollapsed)return;const r=X(this,Ze,Q1).call(this,e).closest(".textLayer"),a=this.getSelectionBoxes(r);a&&(_(this,Wl)||L(this,Wl,new BYe(this)),_(this,Wl).show(r,a,this.direction==="ltr"))},yme=function(){var i,o,s;const e=document.getSelection();if(!e||e.isCollapsed){_(this,Qc)&&((i=_(this,Wl))==null||i.hide(),L(this,Qc,null),X(this,Ze,Ni).call(this,{hasSelectedText:!1}));return}const{anchorNode:n}=e;if(n===_(this,Qc))return;const a=X(this,Ze,Q1).call(this,e).closest(".textLayer");if(!a){_(this,Qc)&&((o=_(this,Wl))==null||o.hide(),L(this,Qc,null),X(this,Ze,Ni).call(this,{hasSelectedText:!1}));return}if((s=_(this,Wl))==null||s.hide(),L(this,Qc,n),X(this,Ze,Ni).call(this,{hasSelectedText:!0}),!(_(this,ia)!==Pt.HIGHLIGHT&&_(this,ia)!==Pt.NONE)&&(_(this,ia)===Pt.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),L(this,Bd,this.isShiftKeyDown),!this.isShiftKeyDown)){const l=_(this,ia)===Pt.HIGHLIGHT?X(this,Ze,f7).call(this,a):null;if(l==null||l.toggleDrawing(),_(this,Kg)){const u=new AbortController,d=this.combinedSignal(u),f=m=>{m.type==="pointerup"&&m.button!==0||(u.abort(),l==null||l.toggleDrawing(!0),m.type==="pointerup"&&X(this,Ze,wy).call(this,"main_toolbar"))};window.addEventListener("pointerup",f,{signal:d}),window.addEventListener("blur",f,{signal:d})}else l==null||l.toggleDrawing(!0),X(this,Ze,wy).call(this,"main_toolbar")}},wy=function(e=""){_(this,ia)===Pt.HIGHLIGHT?this.highlightSelection(e):_(this,uS)&&X(this,Ze,vme).call(this)},Tme=function(){document.addEventListener("selectionchange",X(this,Ze,yme).bind(this),{signal:this._signal})},Cme=function(){if(_(this,Fd))return;L(this,Fd,new AbortController);const e=this.combinedSignal(_(this,Fd));window.addEventListener("focus",this.focus.bind(this),{signal:e}),window.addEventListener("blur",this.blur.bind(this),{signal:e})},Ame=function(){var e;(e=_(this,Fd))==null||e.abort(),L(this,Fd,null)},m7=function(){if(_(this,Gd))return;L(this,Gd,new AbortController);const e=this.combinedSignal(_(this,Gd));window.addEventListener("keydown",this.keydown.bind(this),{signal:e}),window.addEventListener("keyup",this.keyup.bind(this),{signal:e})},Rme=function(){var e;(e=_(this,Gd))==null||e.abort(),L(this,Gd,null)},h7=function(){if(_(this,Md))return;L(this,Md,new AbortController);const e=this.combinedSignal(_(this,Md));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})},g7=function(){var e;(e=_(this,Md))==null||e.abort(),L(this,Md,null)},wme=function(){const e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e}),document.addEventListener("drop",this.drop.bind(this),{signal:e})},Ni=function(e){Object.entries(e).some(([r,a])=>_(this,gS)[r]!==a)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(_(this,gS),e)}),_(this,ia)===Pt.HIGHLIGHT&&e.hasSelectedEditor===!1&&X(this,Ze,ed).call(this,[[cn.HIGHLIGHT_FREE,!0]]))},ed=function(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})},xme=async function(){if(!_(this,Ud)){L(this,Ud,!0);const e=[];for(const n of _(this,ha).values())e.push(n.enable());await Promise.all(e);for(const n of _(this,Br).values())n.enable()}},Nme=function(){if(this.unselectAll(),_(this,Ud)){L(this,Ud,!1);for(const e of _(this,ha).values())e.disable();for(const e of _(this,Br).values())e.disable()}},_7=function(e){const n=_(this,ha).get(e.pageIndex);n?n.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))},Ome=function(){let e=null;for(e of _(this,Ln));return e},xy=function(){if(_(this,Br).size===0)return!0;if(_(this,Br).size===1)for(const e of _(this,Br).values())return e.isEmpty();return!1},b7=function(e){for(const n of _(this,Ln))n.unselect();_(this,Ln).clear();for(const n of e)n.isEmpty()||(_(this,Ln).add(n),n.select());X(this,Ze,Ni).call(this,{hasSelectedEditor:this.hasSelection})},Fe(Zg,"TRANSLATE_SMALL",1),Fe(Zg,"TRANSLATE_BIG",10);let Nd=Zg;const vi=class vi{constructor(e){V(this,Qs);V(this,wa,null);V(this,Xl,!1);V(this,Xs,null);V(this,Jg,null);V(this,Ql,null);V(this,To,null);V(this,e_,!1);V(this,Zl,null);V(this,qi,null);V(this,Jc,null);V(this,$f,null);V(this,Jl,!1);L(this,qi,e),L(this,Jl,e._uiManager.useNewAltTextFlow),_(vi,Yd)||L(vi,Yd,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){vi._l10n??(vi._l10n=e)}async render(){const e=L(this,Xs,document.createElement("button"));e.className="altText",e.tabIndex="0";const n=L(this,Jg,document.createElement("span"));e.append(n),_(this,Jl)?(e.classList.add("new"),e.setAttribute("data-l10n-id",_(vi,Yd).missing),n.setAttribute("data-l10n-id",_(vi,Yd)["missing-label"])):(e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),n.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const r=_(this,qi)._uiManager._signal;e.addEventListener("contextmenu",So,{signal:r}),e.addEventListener("pointerdown",i=>i.stopPropagation(),{signal:r});const a=i=>{i.preventDefault(),_(this,qi)._uiManager.editAltText(_(this,qi)),_(this,Jl)&&_(this,qi)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:_(this,Qs,Ny)}})};return e.addEventListener("click",a,{capture:!0,signal:r}),e.addEventListener("keydown",i=>{i.target===e&&i.key==="Enter"&&(L(this,e_,!0),a(i))},{signal:r}),await X(this,Qs,Z1).call(this),e}finish(){_(this,Xs)&&(_(this,Xs).focus({focusVisible:_(this,e_)}),L(this,e_,!1))}isEmpty(){return _(this,Jl)?_(this,wa)===null:!_(this,wa)&&!_(this,Xl)}hasData(){return _(this,Jl)?_(this,wa)!==null||!!_(this,Jc):this.isEmpty()}get guessedText(){return _(this,Jc)}async setGuessedText(e){_(this,wa)===null&&(L(this,Jc,e),L(this,$f,await vi._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:e})),X(this,Qs,Z1).call(this))}toggleAltTextBadge(e=!1){var n;if(!_(this,Jl)||_(this,wa)){(n=_(this,Zl))==null||n.remove(),L(this,Zl,null);return}if(!_(this,Zl)){const r=L(this,Zl,document.createElement("div"));r.className="noAltTextBadge",_(this,qi).div.append(r)}_(this,Zl).classList.toggle("hidden",!e)}serialize(e){let n=_(this,wa);return!e&&_(this,Jc)===n&&(n=_(this,$f)),{altText:n,decorative:_(this,Xl),guessedText:_(this,Jc),textWithDisclaimer:_(this,$f)}}get data(){return{altText:_(this,wa),decorative:_(this,Xl)}}set data({altText:e,decorative:n,guessedText:r,textWithDisclaimer:a,cancel:i=!1}){r&&(L(this,Jc,r),L(this,$f,a)),!(_(this,wa)===e&&_(this,Xl)===n)&&(i||(L(this,wa,e),L(this,Xl,n)),X(this,Qs,Z1).call(this))}toggle(e=!1){_(this,Xs)&&(!e&&_(this,To)&&(clearTimeout(_(this,To)),L(this,To,null)),_(this,Xs).disabled=!e)}shown(){_(this,qi)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:_(this,Qs,Ny)}})}destroy(){var e,n;(e=_(this,Xs))==null||e.remove(),L(this,Xs,null),L(this,Jg,null),L(this,Ql,null),(n=_(this,Zl))==null||n.remove(),L(this,Zl,null)}};wa=new WeakMap,Xl=new WeakMap,Xs=new WeakMap,Jg=new WeakMap,Ql=new WeakMap,To=new WeakMap,e_=new WeakMap,Zl=new WeakMap,qi=new WeakMap,Jc=new WeakMap,$f=new WeakMap,Jl=new WeakMap,Yd=new WeakMap,Qs=new WeakSet,Ny=function(){return _(this,wa)&&"added"||_(this,wa)===null&&this.guessedText&&"review"||"missing"},Z1=async function(){var a,i,o;const e=_(this,Xs);if(!e)return;if(_(this,Jl)){if(e.classList.toggle("done",!!_(this,wa)),e.setAttribute("data-l10n-id",_(vi,Yd)[_(this,Qs,Ny)]),(a=_(this,Jg))==null||a.setAttribute("data-l10n-id",_(vi,Yd)[`${_(this,Qs,Ny)}-label`]),!_(this,wa)){(i=_(this,Ql))==null||i.remove();return}}else{if(!_(this,wa)&&!_(this,Xl)){e.classList.remove("done"),(o=_(this,Ql))==null||o.remove();return}e.classList.add("done"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let n=_(this,Ql);if(!n){L(this,Ql,n=document.createElement("span")),n.className="tooltip",n.setAttribute("role","tooltip"),n.id=`alt-text-tooltip-${_(this,qi).id}`;const s=100,l=_(this,qi)._uiManager._signal;l.addEventListener("abort",()=>{clearTimeout(_(this,To)),L(this,To,null)},{once:!0}),e.addEventListener("mouseenter",()=>{L(this,To,setTimeout(()=>{L(this,To,null),_(this,Ql).classList.add("show"),_(this,qi)._reportTelemetry({action:"alt_text_tooltip"})},s))},{signal:l}),e.addEventListener("mouseleave",()=>{var u;_(this,To)&&(clearTimeout(_(this,To)),L(this,To,null)),(u=_(this,Ql))==null||u.classList.remove("show")},{signal:l})}_(this,Xl)?n.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(n.removeAttribute("data-l10n-id"),n.textContent=_(this,wa)),n.parentNode||e.append(n);const r=_(this,qi).getElementForAltText();r==null||r.setAttribute("aria-describedby",n.id)},V(vi,Yd,null),Fe(vi,"_l10n",null);let QA=vi;class ZA{constructor(e){V(this,SS);V(this,qa,null);V(this,ps,null);V(this,Yf,!1);V(this,dr,null);V(this,ES,null);V(this,Vf,null);V(this,Zs,null);V(this,jf,null);V(this,Wf,!1);V(this,Kf,null);L(this,dr,e)}renderForToolbar(){const e=L(this,ps,document.createElement("button"));return e.className="comment",X(this,SS,E7).call(this,e,!1)}renderForStandalone(){const e=L(this,qa,document.createElement("button"));e.className="annotationCommentButton";const n=_(this,dr).commentButtonPosition;if(n){const{style:r}=e;r.insetInlineEnd=`calc(${100*(_(this,dr)._uiManager.direction==="ltr"?1-n[0]:n[0])}% - var(--comment-button-dim))`,r.top=`calc(${100*n[1]}% - var(--comment-button-dim))`;const a=_(this,dr).commentButtonColor;a&&(r.backgroundColor=a)}return X(this,SS,E7).call(this,e,!0)}focusButton(){setTimeout(()=>{var e;(e=_(this,qa)??_(this,ps))==null||e.focus()},0)}onUpdatedColor(){if(!_(this,qa))return;const e=_(this,dr).commentButtonColor;e&&(_(this,qa).style.backgroundColor=e),_(this,dr)._uiManager.updatePopupColor(_(this,dr))}get commentButtonWidth(){var e;return(((e=_(this,qa))==null?void 0:e.getBoundingClientRect().width)??0)/_(this,dr).parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(_(this,Kf))return _(this,Kf);if(!_(this,qa))return null;const{x:e,y:n,height:r}=_(this,qa).getBoundingClientRect(),{x:a,y:i,width:o,height:s}=_(this,dr).parent.boundingClientRect;return[(e-a)/o,(n+r-i)/s]}set commentPopupPositionInLayer(e){L(this,Kf,e)}hasDefaultPopupPosition(){return _(this,Kf)===null}removeStandaloneCommentButton(){var e;(e=_(this,qa))==null||e.remove(),L(this,qa,null)}removeToolbarCommentButton(){var e;(e=_(this,ps))==null||e.remove(),L(this,ps,null)}setCommentButtonStates({selected:e,hasPopup:n}){_(this,qa)&&(_(this,qa).classList.toggle("selected",e),_(this,qa).ariaExpanded=n)}edit(e){const n=this.commentPopupPositionInLayer;let r,a;if(n)[r,a]=n;else{[r,a]=_(this,dr).commentButtonPosition;const{width:d,height:f,x:m,y:h}=_(this,dr);r=m+r*d,a=h+a*f}const i=_(this,dr).parent.boundingClientRect,{x:o,y:s,width:l,height:u}=i;_(this,dr)._uiManager.editComment(_(this,dr),o+r*l,s+a*u,{...e,parentDimensions:i})}finish(){_(this,ps)&&(_(this,ps).focus({focusVisible:_(this,Yf)}),L(this,Yf,!1))}isDeleted(){return _(this,Wf)||_(this,Zs)===""}isEmpty(){return _(this,Zs)===null}hasBeenEdited(){return this.isDeleted()||_(this,Zs)!==_(this,ES)}serialize(){return this.data}get data(){return{text:_(this,Zs),richText:_(this,Vf),date:_(this,jf),deleted:this.isDeleted()}}set data(e){if(e!==_(this,Zs)&&L(this,Vf,null),e===null){L(this,Zs,""),L(this,Wf,!0);return}L(this,Zs,e),L(this,jf,new Date),L(this,Wf,!1)}setInitialText(e,n=null){L(this,ES,e),this.data=e,L(this,jf,null),L(this,Vf,n)}shown(){}destroy(){var e,n;(e=_(this,ps))==null||e.remove(),L(this,ps,null),(n=_(this,qa))==null||n.remove(),L(this,qa,null),L(this,Zs,""),L(this,Vf,null),L(this,jf,null),L(this,dr,null),L(this,Yf,!1),L(this,Wf,!1)}}qa=new WeakMap,ps=new WeakMap,Yf=new WeakMap,dr=new WeakMap,ES=new WeakMap,Vf=new WeakMap,Zs=new WeakMap,jf=new WeakMap,Wf=new WeakMap,Kf=new WeakMap,SS=new WeakSet,E7=function(e,n){if(!_(this,dr)._uiManager.hasCommentManager())return null;e.tabIndex="0",e.ariaHasPopup="dialog",n?(e.ariaControls="commentPopup",e.setAttribute("data-l10n-id","pdfjs-show-comment-button")):(e.ariaControlsElements=[_(this,dr)._uiManager.getCommentDialogElement()],e.setAttribute("data-l10n-id","pdfjs-editor-edit-comment-button"));const r=_(this,dr)._uiManager._signal;if(!(r instanceof AbortSignal)||r.aborted)return e;e.addEventListener("contextmenu",So,{signal:r}),n&&(e.addEventListener("focusin",i=>{_(this,dr)._focusEventsAllowed=!1,Or(i)},{capture:!0,signal:r}),e.addEventListener("focusout",i=>{_(this,dr)._focusEventsAllowed=!0,Or(i)},{capture:!0,signal:r})),e.addEventListener("pointerdown",i=>i.stopPropagation(),{signal:r});const a=i=>{i.preventDefault(),e===_(this,ps)?this.edit():_(this,dr).toggleComment(!0)};return e.addEventListener("click",a,{capture:!0,signal:r}),e.addEventListener("keydown",i=>{i.target===e&&i.key==="Enter"&&(L(this,Yf,!0),a(i))},{signal:r}),e.addEventListener("pointerenter",()=>{_(this,dr).toggleComment(!1,!0)},{signal:r}),e.addEventListener("pointerleave",()=>{_(this,dr).toggleComment(!1,!1)},{signal:r}),e};const o6=class o6{constructor({container:e,isPinchingDisabled:n=null,isPinchingStopped:r=null,onPinchStart:a=null,onPinching:i=null,onPinchEnd:o=null,signal:s}){V(this,Vd);V(this,t_);V(this,Xf,!1);V(this,vS,null);V(this,yS);V(this,TS);V(this,CS);V(this,AS);V(this,eu,null);V(this,Qf);V(this,tu,null);V(this,Zf);V(this,nu,null);L(this,t_,e),L(this,vS,r),L(this,yS,n),L(this,TS,a),L(this,CS,i),L(this,AS,o),L(this,Zf,new AbortController),L(this,Qf,AbortSignal.any([s,_(this,Zf).signal])),e.addEventListener("touchstart",X(this,Vd,Ime).bind(this),{passive:!1,signal:_(this,Qf)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/Ks.pixelRatio}destroy(){var e,n;(e=_(this,Zf))==null||e.abort(),L(this,Zf,null),(n=_(this,eu))==null||n.abort(),L(this,eu,null)}};t_=new WeakMap,Xf=new WeakMap,vS=new WeakMap,yS=new WeakMap,TS=new WeakMap,CS=new WeakMap,AS=new WeakMap,eu=new WeakMap,Qf=new WeakMap,tu=new WeakMap,Zf=new WeakMap,nu=new WeakMap,Vd=new WeakSet,Ime=function(e){var a,i,o;if((a=_(this,yS))!=null&&a.call(this))return;if(e.touches.length===1){if(_(this,eu))return;const s=L(this,eu,new AbortController),l=AbortSignal.any([_(this,Qf),s.signal]),u=_(this,t_),d={capture:!0,signal:l,passive:!1},f=m=>{var h;m.pointerType==="touch"&&((h=_(this,eu))==null||h.abort(),L(this,eu,null))};u.addEventListener("pointerdown",m=>{m.pointerType==="touch"&&(Or(m),f(m))},d),u.addEventListener("pointerup",f,d),u.addEventListener("pointercancel",f,d);return}if(!_(this,nu)){L(this,nu,new AbortController);const s=AbortSignal.any([_(this,Qf),_(this,nu).signal]),l=_(this,t_),u={signal:s,capture:!1,passive:!1};l.addEventListener("touchmove",X(this,Vd,Dme).bind(this),u);const d=X(this,Vd,kme).bind(this);l.addEventListener("touchend",d,u),l.addEventListener("touchcancel",d,u),u.capture=!0,l.addEventListener("pointerdown",Or,u),l.addEventListener("pointermove",Or,u),l.addEventListener("pointercancel",Or,u),l.addEventListener("pointerup",Or,u),(i=_(this,TS))==null||i.call(this)}if(Or(e),e.touches.length!==2||(o=_(this,vS))!=null&&o.call(this)){L(this,tu,null);return}let[n,r]=e.touches;n.identifier>r.identifier&&([n,r]=[r,n]),L(this,tu,{touch0X:n.screenX,touch0Y:n.screenY,touch1X:r.screenX,touch1Y:r.screenY})},Dme=function(e){var w;if(!_(this,tu)||e.touches.length!==2)return;Or(e);let[n,r]=e.touches;n.identifier>r.identifier&&([n,r]=[r,n]);const{screenX:a,screenY:i}=n,{screenX:o,screenY:s}=r,l=_(this,tu),{touch0X:u,touch0Y:d,touch1X:f,touch1Y:m}=l,h=f-u,E=m-d,b=o-a,v=s-i,y=Math.hypot(b,v)||1,C=Math.hypot(h,E)||1;if(!_(this,Xf)&&Math.abs(C-y)<=o6.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(l.touch0X=a,l.touch0Y=i,l.touch1X=o,l.touch1Y=s,!_(this,Xf)){L(this,Xf,!0);return}const T=[(a+o)/2,(i+s)/2];(w=_(this,CS))==null||w.call(this,T,C,y)},kme=function(e){var n;e.touches.length>=2||(_(this,nu)&&(_(this,nu).abort(),L(this,nu,null),(n=_(this,AS))==null||n.call(this)),_(this,tu)&&(Or(e),L(this,tu,null),L(this,Xf,!1)))};let YE=o6;const Ut=class Ut{constructor(e){V(this,Nt);V(this,Jf,null);V(this,Js,null);V(this,Sr,null);V(this,nr,null);V(this,ru,null);V(this,n_,!1);V(this,jd,null);V(this,RS,"");V(this,Ha,null);V(this,em,null);V(this,au,null);V(this,ec,null);V(this,Wd,null);V(this,wS,"");V(this,tm,!1);V(this,Co,null);V(this,xS,!1);V(this,nm,!1);V(this,iu,!1);V(this,tc,null);V(this,r_,0);V(this,a_,0);V(this,fs,null);V(this,rm,null);Fe(this,"isSelected",!1);Fe(this,"_isCopy",!1);Fe(this,"_editToolbar",null);Fe(this,"_initialOptions",Object.create(null));Fe(this,"_initialData",null);Fe(this,"_isVisible",!0);Fe(this,"_uiManager",null);Fe(this,"_focusEventsAllowed",!0);V(this,NS,!1);V(this,wR,Ut._zIndex++);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,this.annotationElementId=e.annotationElementId||null,this.creationDate=e.creationDate||new Date,this.modificationDate=e.modificationDate||null;const{rotation:n,rawDims:{pageWidth:r,pageHeight:a,pageX:i,pageY:o}}=this.parent.viewport;this.rotation=n,this.pageRotation=(360+n-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[r,a],this.pageTranslation=[i,o];const[s,l]=this.parentDimensions;this.x=e.x/s,this.y=e.y/l,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const e=Ut.prototype._resizeWithKeyboard,n=Nd.TRANSLATE_SMALL,r=Nd.TRANSLATE_BIG;return jt(this,"_resizerKeyboardManager",new $E([[["ArrowLeft","mac+ArrowLeft"],e,{args:[-n,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e,{args:[-r,0]}],[["ArrowRight","mac+ArrowRight"],e,{args:[n,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e,{args:[r,0]}],[["ArrowUp","mac+ArrowUp"],e,{args:[0,-n]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e,{args:[0,-r]}],[["ArrowDown","mac+ArrowDown"],e,{args:[0,n]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e,{args:[0,r]}],[["Escape","mac+Escape"],Ut.prototype._stopResizingWithKeyboard]]))}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return jt(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){const n=new zYe({id:e.parent.getNextId(),parent:e.parent,uiManager:e._uiManager});n.annotationElementId=e.annotationElementId,n.deleted=!0,n._uiManager.addToAnnotationStorage(n)}static initialize(e,n){if(Ut._l10n??(Ut._l10n=e),Ut._l10nResizer||(Ut._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"})),Ut._borderLineWidth!==-1)return;const r=getComputedStyle(document.documentElement);Ut._borderLineWidth=parseFloat(r.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,n){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,n){er("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return _(this,NS)}set _isDraggable(e){var n;L(this,NS,e),(n=this.div)==null||n.classList.toggle("draggable",e)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){const[e,n]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*n/(e*2),this.y+=this.width*e/(n*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*n/(e*2),this.y-=this.width*e/(n*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}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,wR)}setParent(e){var n;e!==null?(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions):(X(this,Nt,Oy).call(this),(n=_(this,ec))==null||n.remove(),L(this,ec,null)),this.parent=e}focusin(e){this._focusEventsAllowed&&(_(this,tm)?L(this,tm,!1):this.parent.setSelected(this))}focusout(e){var r;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const n=e.relatedTarget;n!=null&&n.closest(`#${this.id}`)||(e.preventDefault(),(r=this.parent)!=null&&r.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,n,r,a){const[i,o]=this.parentDimensions;[r,a]=this.screenToPageTranslation(r,a),this.x=(e+r)/i,this.y=(n+a)/o,this.fixAndSetPosition()}_moveAfterPaste(e,n){const[r,a]=this.parentDimensions;this.setAt(e*r,n*a,this.width*r,this.height*a),this._onTranslated()}translate(e,n){X(this,Nt,S7).call(this,this.parentDimensions,e,n)}translateInPage(e,n){_(this,Co)||L(this,Co,[this.x,this.y,this.width,this.height]),X(this,Nt,S7).call(this,this.pageDimensions,e,n),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(e,n){_(this,Co)||L(this,Co,[this.x,this.y,this.width,this.height]);const{div:r,parentDimensions:[a,i]}=this;if(this.x+=e/a,this.y+=n/i,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:f,y:m}=this.div.getBoundingClientRect();this.parent.findNewParent(this,f,m)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:o,y:s}=this;const[l,u]=this.getBaseTranslation();o+=l,s+=u;const{style:d}=r;d.left=`${(100*o).toFixed(2)}%`,d.top=`${(100*s).toFixed(2)}%`,this._onTranslating(o,s),r.scrollIntoView({block:"nearest"})}_onTranslating(e,n){}_onTranslated(e,n){}get _hasBeenMoved(){return!!_(this,Co)&&(_(this,Co)[0]!==this.x||_(this,Co)[1]!==this.y)}get _hasBeenResized(){return!!_(this,Co)&&(_(this,Co)[2]!==this.width||_(this,Co)[3]!==this.height)}getBaseTranslation(){const[e,n]=this.parentDimensions,{_borderLineWidth:r}=Ut,a=r/e,i=r/n;switch(this.rotation){case 90:return[-a,i];case 180:return[a,i];case 270:return[a,-i];default:return[-a,-i]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){const{div:{style:n},pageDimensions:[r,a]}=this;let{x:i,y:o,width:s,height:l}=this;if(s*=r,l*=a,i*=r,o*=a,this._mustFixPosition)switch(e){case 0:i=ri(i,0,r-s),o=ri(o,0,a-l);break;case 90:i=ri(i,0,r-l),o=ri(o,s,a);break;case 180:i=ri(i,s,r),o=ri(o,l,a);break;case 270:i=ri(i,l,r),o=ri(o,0,a-s);break}this.x=i/=r,this.y=o/=a;const[u,d]=this.getBaseTranslation();i+=u,o+=d,n.left=`${(100*i).toFixed(2)}%`,n.top=`${(100*o).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(e,n){var r;return X(r=Ut,OS,v7).call(r,e,n,this.parentRotation)}pageTranslationToScreen(e,n){var r;return X(r=Ut,OS,v7).call(r,e,n,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:e,pageDimensions:[n,r]}=this;return[n*e,r*e]}setDims(){const{div:{style:e},width:n,height:r}=this;e.width=`${(100*n).toFixed(2)}%`,e.height=`${(100*r).toFixed(2)}%`}getInitialTranslation(){return[0,0]}_onResized(){}static _round(e){return Math.round(e*1e4)/1e4}_onResizing(){}altTextFinish(){var e;(e=_(this,Sr))==null||e.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||_(this,nm))return this._editToolbar;this._editToolbar=new vB(this),this.div.append(this._editToolbar.render());const{toolbarButtons:e}=this;if(e)for(const[n,r]of e)await this._editToolbar.addButton(n,r);return this.hasComment||this._editToolbar.addButton("comment",this.addCommentButton()),this._editToolbar.addButton("delete"),this._editToolbar}addCommentButtonInToolbar(){var e;(e=this._editToolbar)==null||e.addButtonBefore("comment",this.addCommentButton(),".deleteButton")}removeCommentButtonFromToolbar(){var e;(e=this._editToolbar)==null||e.removeButton("comment")}removeEditToolbar(){var e,n;(e=this._editToolbar)==null||e.remove(),this._editToolbar=null,(n=_(this,Sr))==null||n.destroy()}addContainer(e){var r;const n=(r=this._editToolbar)==null?void 0:r.div;n?n.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return _(this,Sr)||(QA.initialize(Ut._l10n),L(this,Sr,new QA(this)),_(this,Jf)&&(_(this,Sr).data=_(this,Jf),L(this,Jf,null))),_(this,Sr)}get altTextData(){var e;return(e=_(this,Sr))==null?void 0:e.data}set altTextData(e){_(this,Sr)&&(_(this,Sr).data=e)}get guessedAltText(){var e;return(e=_(this,Sr))==null?void 0:e.guessedText}async setGuessedAltText(e){var n;await((n=_(this,Sr))==null?void 0:n.setGuessedText(e))}serializeAltText(e){var n;return(n=_(this,Sr))==null?void 0:n.serialize(e)}hasAltText(){return!!_(this,Sr)&&!_(this,Sr).isEmpty()}hasAltTextData(){var e;return((e=_(this,Sr))==null?void 0:e.hasData())??!1}focusCommentButton(){var e;(e=_(this,nr))==null||e.focusButton()}addCommentButton(){return _(this,nr)||L(this,nr,new ZA(this))}addStandaloneCommentButton(){if(_(this,ru)){this._uiManager.isEditingMode()&&_(this,ru).classList.remove("hidden");return}this.hasComment&&(L(this,ru,_(this,nr).renderForStandalone()),this.div.append(_(this,ru)))}removeStandaloneCommentButton(){_(this,nr).removeStandaloneCommentButton(),L(this,ru,null)}hideStandaloneCommentButton(){var e;(e=_(this,ru))==null||e.classList.add("hidden")}get comment(){const{data:{richText:e,text:n,date:r,deleted:a}}=_(this,nr);return{text:n,richText:e,date:r,deleted:a,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(e){_(this,nr)||L(this,nr,new ZA(this)),_(this,nr).data=e,this.hasComment?(this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this)):(this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this))}setCommentData({comment:e,popupRef:n,richText:r}){if(!n||(_(this,nr)||L(this,nr,new ZA(this)),_(this,nr).setInitialText(e,r),!this.annotationElementId))return;const a=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);a&&this.updateFromAnnotationLayer(a)}get hasEditedComment(){var e;return(e=_(this,nr))==null?void 0:e.hasBeenEdited()}get hasDeletedComment(){var e;return(e=_(this,nr))==null?void 0:e.isDeleted()}get hasComment(){return!!_(this,nr)&&!_(this,nr).isEmpty()&&!_(this,nr).isDeleted()}async editComment(e){_(this,nr)||L(this,nr,new ZA(this)),_(this,nr).edit(e)}toggleComment(e,n=void 0){this.hasComment&&this._uiManager.toggleComment(this,e,n)}setSelectedCommentButton(e){_(this,nr).setSelectedButton(e)}addComment(e){if(this.hasEditedComment){const[,,,a]=e.rect,[i]=this.pageDimensions,[o]=this.pageTranslation,s=o+i+1,l=a-100,u=s+180;e.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[s,l,u,a]}}}updateFromAnnotationLayer({popup:{contents:e,deleted:n}}){_(this,nr).data=n?null:e}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){var o;const e=this.div=document.createElement("div");e.setAttribute("data-editor-rotation",(360-this.rotation)%360),e.className=this.name,e.setAttribute("id",this.id),e.tabIndex=_(this,n_)?-1:0,e.setAttribute("role","application"),this.defaultL10nId&&e.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||e.classList.add("hidden"),this.setInForeground(),X(this,Nt,A7).call(this);const[n,r]=this.parentDimensions;this.parentRotation%180!==0&&(e.style.maxWidth=`${(100*r/n).toFixed(2)}%`,e.style.maxHeight=`${(100*n/r).toFixed(2)}%`);const[a,i]=this.getInitialTranslation();return this.translate(a,i),Cce(this,e,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(_(this,rm)||L(this,rm,new YE({container:e,isPinchingDisabled:()=>!this.isSelected,onPinchStart:X(this,Nt,Pme).bind(this),onPinching:X(this,Nt,Fme).bind(this),onPinchEnd:X(this,Nt,Bme).bind(this),signal:this._uiManager._signal}))),this.addStandaloneCommentButton(),(o=this._uiManager._editorUndoBar)==null||o.hide(),e}pointerdown(e){const{isMac:n}=Ra.platform;if(e.button!==0||e.ctrlKey&&n){e.preventDefault();return}if(L(this,tm,!0),this._isDraggable){X(this,Nt,Ume).call(this,e);return}X(this,Nt,C7).call(this,e)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){_(this,tc)&&clearTimeout(_(this,tc)),L(this,tc,setTimeout(()=>{var e;L(this,tc,null),(e=this.parent)==null||e.moveEditorInDOM(this)},0))}_setParentAndPosition(e,n,r){e.changeParent(this),this.x=n,this.y=r,this.fixAndSetPosition(),this._onTranslated()}getRect(e,n,r=this.rotation){const a=this.parentScale,[i,o]=this.pageDimensions,[s,l]=this.pageTranslation,u=e/a,d=n/a,f=this.x*i,m=this.y*o,h=this.width*i,E=this.height*o;switch(r){case 0:return[f+u+s,o-m-d-E+l,f+u+h+s,o-m-d+l];case 90:return[f+d+s,o-m+u+l,f+d+E+s,o-m+u+h+l];case 180:return[f-u-h+s,o-m+d+l,f-u+s,o-m+d+E+l];case 270:return[f-d-E+s,o-m-u-h+l,f-d+s,o-m-u+l];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,n){const[r,a,i,o]=e,s=i-r,l=o-a;switch(this.rotation){case 0:return[r,n-o,s,l];case 90:return[r,n-a,l,s];case 180:return[i,n-a,s,l];case 270:return[i,n-o,l,s];default:throw new Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&Ut._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){var e;(e=_(this,nr))==null||e.onUpdatedColor()}getData(){const{comment:{text:e,color:n,date:r,opacity:a,deleted:i,richText:o},uid:s,pageIndex:l,creationDate:u,modificationDate:d}=this;return{id:s,pageIndex:l,rect:this.getPDFRect(),richText:o,contentsObj:{str:e},creationDate:u,modificationDate:r||d,popupRef:!i,color:n,opacity:a}}onceAdded(e){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),L(this,nm,!0),!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),L(this,nm,!1),!0):!1}isInEditMode(){return _(this,nm)}shouldGetKeyboardEvents(){return _(this,iu)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:e,left:n,bottom:r,right:a}=this.getClientDimensions(),{innerHeight:i,innerWidth:o}=window;return n<o&&a>0&&e<i&&r>0}rebuild(){X(this,Nt,A7).call(this)}rotate(e){}resize(){}serializeDeleted(){var e;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:((e=this._initialData)==null?void 0:e.popupRef)||""}}serialize(e=!1,n=null){var r;return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:((r=this._initialData)==null?void 0:r.popupRef)||""}}static async deserialize(e,n,r){const a=new this.prototype.constructor({parent:n,id:n.getNextId(),uiManager:r,annotationElementId:e.annotationElementId,creationDate:e.creationDate,modificationDate:e.modificationDate});a.rotation=e.rotation,L(a,Jf,e.accessibilityData),a._isCopy=e.isCopy||!1;const[i,o]=a.pageDimensions,[s,l,u,d]=a.getRectInCurrentCoords(e.rect,o);return a.x=s/i,a.y=l/o,a.width=u/i,a.height=d/o,a}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var e,n;if((e=_(this,Wd))==null||e.abort(),L(this,Wd,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),_(this,tc)&&(clearTimeout(_(this,tc)),L(this,tc,null)),X(this,Nt,Oy).call(this),this.removeEditToolbar(),_(this,fs)){for(const r of _(this,fs).values())clearTimeout(r);L(this,fs,null)}this.parent=null,(n=_(this,rm))==null||n.destroy(),L(this,rm,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(X(this,Nt,Mme).call(this),_(this,Ha).classList.remove("hidden"))}get toolbarPosition(){return null}get commentButtonPosition(){return this._uiManager.direction==="ltr"?[1,0]:[0,0]}get commentButtonPositionInPage(){const{commentButtonPosition:[e,n]}=this,[r,a,i,o]=this.getPDFRect();return[Ut._round(r+(i-r)*e),Ut._round(a+(o-a)*(1-n))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return _(this,nr).commentPopupPositionInLayer}set commentPopupPosition(e){_(this,nr).commentPopupPositionInLayer=e}hasDefaultPopupPosition(){return _(this,nr).hasDefaultPopupPosition()}get commentButtonWidth(){return _(this,nr).commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(e){_(this,nr).setCommentButtonStates(e)}keydown(e){if(!this.isResizable||e.target!==this.div||e.key!=="Enter")return;this._uiManager.setSelected(this),L(this,au,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const n=_(this,Ha).children;if(!_(this,Js)){L(this,Js,Array.from(n));const o=X(this,Nt,Gme).bind(this),s=X(this,Nt,zme).bind(this),l=this._uiManager._signal;for(const u of _(this,Js)){const d=u.getAttribute("data-resizer-name");u.setAttribute("role","spinbutton"),u.addEventListener("keydown",o,{signal:l}),u.addEventListener("blur",s,{signal:l}),u.addEventListener("focus",X(this,Nt,qme).bind(this,d),{signal:l}),u.setAttribute("data-l10n-id",Ut._l10nResizer[d])}}const r=_(this,Js)[0];let a=0;for(const o of n){if(o===r)break;a++}const i=(360-this.rotation+this.parentRotation)%360/90*(_(this,Js).length/4);if(i!==a){if(i<a)for(let s=0;s<a-i;s++)_(this,Ha).append(_(this,Ha).firstChild);else if(i>a)for(let s=0;s<i-a;s++)_(this,Ha).firstChild.before(_(this,Ha).lastChild);let o=0;for(const s of n){const u=_(this,Js)[o++].getAttribute("data-resizer-name");s.setAttribute("data-l10n-id",Ut._l10nResizer[u])}}X(this,Nt,R7).call(this,0),L(this,iu,!0),_(this,Ha).firstChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}_resizeWithKeyboard(e,n){_(this,iu)&&X(this,Nt,T7).call(this,_(this,wS),{deltaX:e,deltaY:n,fromKeyboard:!0})}_stopResizingWithKeyboard(){X(this,Nt,Oy).call(this),this.div.focus()}select(){var e,n,r;if(this.isSelected&&this._editToolbar){this._editToolbar.show();return}if(this.isSelected=!0,this.makeResizable(),(e=this.div)==null||e.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{var a,i;(a=this.div)!=null&&a.classList.contains("selectedEditor")&&((i=this._editToolbar)==null||i.show())});return}(n=this._editToolbar)==null||n.show(),(r=_(this,Sr))==null||r.toggleAltTextBadge(!1)}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>{var e;return(e=this.div)==null?void 0:e.focus({preventScroll:!0})},0)}unselect(){var e,n,r,a,i;this.isSelected&&(this.isSelected=!1,(e=_(this,Ha))==null||e.classList.add("hidden"),(n=this.div)==null||n.classList.remove("selectedEditor"),(r=this.div)!=null&&r.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(a=this._editToolbar)==null||a.hide(),(i=_(this,Sr))==null||i.toggleAltTextBadge(!0),this.hasComment&&this._uiManager.toggleComment(this,!1,!1))}updateParams(e,n){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(e){e.target.nodeName!=="BUTTON"&&(this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.id}))}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return _(this,xS)}set isEditing(e){L(this,xS,e),this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(e,n=!1){if(n){_(this,fs)||L(this,fs,new Map);const{action:r}=e;let a=_(this,fs).get(r);a&&clearTimeout(a),a=setTimeout(()=>{this._reportTelemetry(e),_(this,fs).delete(r),_(this,fs).size===0&&L(this,fs,null)},Ut._telemetryTimeout),_(this,fs).set(r,a);return}e.type||(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),L(this,n_,!1)}disable(){this.div&&(this.div.tabIndex=-1),L(this,n_,!0)}updateFakeAnnotationElement(e){if(!_(this,ec)&&!this.deleted){L(this,ec,e.addFakeAnnotation(this));return}if(this.deleted){_(this,ec).remove(),L(this,ec,null);return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&_(this,ec).updateEdited({rect:this.getPDFRect(),popup:this.comment})}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;let n=e.container.querySelector(".annotationContent");if(!n)n=document.createElement("div"),n.classList.add("annotationContent",this.editorType),e.container.prepend(n);else if(n.nodeName==="CANVAS"){const r=n;n=document.createElement("div"),n.classList.add("annotationContent",this.editorType),r.before(n)}return n}resetAnnotationElement(e){const{firstChild:n}=e.container;(n==null?void 0:n.nodeName)==="DIV"&&n.classList.contains("annotationContent")&&n.remove()}};Jf=new WeakMap,Js=new WeakMap,Sr=new WeakMap,nr=new WeakMap,ru=new WeakMap,n_=new WeakMap,jd=new WeakMap,RS=new WeakMap,Ha=new WeakMap,em=new WeakMap,au=new WeakMap,ec=new WeakMap,Wd=new WeakMap,wS=new WeakMap,tm=new WeakMap,Co=new WeakMap,xS=new WeakMap,nm=new WeakMap,iu=new WeakMap,tc=new WeakMap,r_=new WeakMap,a_=new WeakMap,fs=new WeakMap,rm=new WeakMap,NS=new WeakMap,wR=new WeakMap,Nt=new WeakSet,S7=function([e,n],r,a){[r,a]=this.screenToPageTranslation(r,a),this.x+=r/e,this.y+=a/n,this._onTranslating(this.x,this.y),this.fixAndSetPosition()},OS=new WeakSet,v7=function(e,n,r){switch(r){case 90:return[n,-e];case 180:return[-e,-n];case 270:return[-n,e];default:return[e,n]}},J1=function(e){switch(e){case 90:{const[n,r]=this.pageDimensions;return[0,-n/r,r/n,0]}case 180:return[-1,0,0,-1];case 270:{const[n,r]=this.pageDimensions;return[0,n/r,-r/n,0]}default:return[1,0,0,1]}},Mme=function(){if(_(this,Ha))return;L(this,Ha,document.createElement("div")),_(this,Ha).classList.add("resizers");const e=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],n=this._uiManager._signal;for(const r of e){const a=document.createElement("div");_(this,Ha).append(a),a.classList.add("resizer",r),a.setAttribute("data-resizer-name",r),a.addEventListener("pointerdown",X(this,Nt,Lme).bind(this,r),{signal:n}),a.addEventListener("contextmenu",So,{signal:n}),a.tabIndex=-1}this.div.prepend(_(this,Ha))},Lme=function(e,n){var d;n.preventDefault();const{isMac:r}=Ra.platform;if(n.button!==0||n.ctrlKey&&r)return;(d=_(this,Sr))==null||d.toggle(!1);const a=this._isDraggable;this._isDraggable=!1,L(this,em,[n.screenX,n.screenY]);const i=new AbortController,o=this._uiManager.combinedSignal(i);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",X(this,Nt,T7).bind(this,e),{passive:!0,capture:!0,signal:o}),window.addEventListener("touchmove",Or,{passive:!1,signal:o}),window.addEventListener("contextmenu",So,{signal:o}),L(this,au,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const s=this.parent.div.style.cursor,l=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(n.target).cursor;const u=()=>{var f;i.abort(),this.parent.togglePointerEvents(!0),(f=_(this,Sr))==null||f.toggle(!0),this._isDraggable=a,this.parent.div.style.cursor=s,this.div.style.cursor=l,X(this,Nt,ew).call(this)};window.addEventListener("pointerup",u,{signal:o}),window.addEventListener("blur",u,{signal:o})},y7=function(e,n,r,a){this.width=r,this.height=a,this.x=e,this.y=n,this.setDims(),this.fixAndSetPosition(),this._onResized()},ew=function(){if(!_(this,au))return;const{savedX:e,savedY:n,savedWidth:r,savedHeight:a}=_(this,au);L(this,au,null);const i=this.x,o=this.y,s=this.width,l=this.height;i===e&&o===n&&s===r&&l===a||this.addCommands({cmd:X(this,Nt,y7).bind(this,i,o,s,l),undo:X(this,Nt,y7).bind(this,e,n,r,a),mustExec:!0})},T7=function(e,n){const[r,a]=this.parentDimensions,i=this.x,o=this.y,s=this.width,l=this.height,u=Ut.MIN_SIZE/r,d=Ut.MIN_SIZE/a,f=X(this,Nt,J1).call(this,this.rotation),m=(G,Y)=>[f[0]*G+f[2]*Y,f[1]*G+f[3]*Y],h=X(this,Nt,J1).call(this,360-this.rotation),E=(G,Y)=>[h[0]*G+h[2]*Y,h[1]*G+h[3]*Y];let b,v,y=!1,C=!1;switch(e){case"topLeft":y=!0,b=(G,Y)=>[0,0],v=(G,Y)=>[G,Y];break;case"topMiddle":b=(G,Y)=>[G/2,0],v=(G,Y)=>[G/2,Y];break;case"topRight":y=!0,b=(G,Y)=>[G,0],v=(G,Y)=>[0,Y];break;case"middleRight":C=!0,b=(G,Y)=>[G,Y/2],v=(G,Y)=>[0,Y/2];break;case"bottomRight":y=!0,b=(G,Y)=>[G,Y],v=(G,Y)=>[0,0];break;case"bottomMiddle":b=(G,Y)=>[G/2,Y],v=(G,Y)=>[G/2,0];break;case"bottomLeft":y=!0,b=(G,Y)=>[0,Y],v=(G,Y)=>[G,0];break;case"middleLeft":C=!0,b=(G,Y)=>[0,Y/2],v=(G,Y)=>[G,Y/2];break}const T=b(s,l),w=v(s,l);let O=m(...w);const x=Ut._round(i+O[0]),D=Ut._round(o+O[1]);let M=1,F=1,P,q;if(n.fromKeyboard)({deltaX:P,deltaY:q}=n);else{const{screenX:G,screenY:Y}=n,[W,J]=_(this,em);[P,q]=this.screenToPageTranslation(G-W,Y-J),_(this,em)[0]=G,_(this,em)[1]=Y}if([P,q]=E(P/r,q/a),y){const G=Math.hypot(s,l);M=F=Math.max(Math.min(Math.hypot(w[0]-T[0]-P,w[1]-T[1]-q)/G,1/s,1/l),u/s,d/l)}else C?M=ri(Math.abs(w[0]-T[0]-P),u,1)/s:F=ri(Math.abs(w[1]-T[1]-q),d,1)/l;const j=Ut._round(s*M),Q=Ut._round(l*F);O=m(...v(j,Q));const U=x-O[0],K=D-O[1];_(this,Co)||L(this,Co,[this.x,this.y,this.width,this.height]),this.width=j,this.height=Q,this.x=U,this.y=K,this.setDims(),this.fixAndSetPosition(),this._onResizing()},Pme=function(){var e;L(this,au,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),(e=_(this,Sr))==null||e.toggle(!1),this.parent.togglePointerEvents(!1)},Fme=function(e,n,r){let i=.7*(r/n)+1-.7;if(i===1)return;const o=X(this,Nt,J1).call(this,this.rotation),s=(x,D)=>[o[0]*x+o[2]*D,o[1]*x+o[3]*D],[l,u]=this.parentDimensions,d=this.x,f=this.y,m=this.width,h=this.height,E=Ut.MIN_SIZE/l,b=Ut.MIN_SIZE/u;i=Math.max(Math.min(i,1/m,1/h),E/m,b/h);const v=Ut._round(m*i),y=Ut._round(h*i);if(v===m&&y===h)return;_(this,Co)||L(this,Co,[d,f,m,h]);const C=s(m/2,h/2),T=Ut._round(d+C[0]),w=Ut._round(f+C[1]),O=s(v/2,y/2);this.x=T-O[0],this.y=w-O[1],this.width=v,this.height=y,this.setDims(),this.fixAndSetPosition(),this._onResizing()},Bme=function(){var e;(e=_(this,Sr))==null||e.toggle(!0),this.parent.togglePointerEvents(!0),X(this,Nt,ew).call(this)},C7=function(e){const{isMac:n}=Ra.platform;e.ctrlKey&&!n||e.shiftKey||e.metaKey&&n?this.parent.toggleSelected(this):this.parent.setSelected(this)},Ume=function(e){const{isSelected:n}=this;this._uiManager.setUpDragSession();let r=!1;const a=new AbortController,i=this._uiManager.combinedSignal(a),o={capture:!0,passive:!1,signal:i},s=u=>{a.abort(),L(this,jd,null),L(this,tm,!1),this._uiManager.endDragSession()||X(this,Nt,C7).call(this,u),r&&this._onStopDragging()};n&&(L(this,r_,e.clientX),L(this,a_,e.clientY),L(this,jd,e.pointerId),L(this,RS,e.pointerType),window.addEventListener("pointermove",u=>{r||(r=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());const{clientX:d,clientY:f,pointerId:m}=u;if(m!==_(this,jd)){Or(u);return}const[h,E]=this.screenToPageTranslation(d-_(this,r_),f-_(this,a_));L(this,r_,d),L(this,a_,f),this._uiManager.dragSelectedEditors(h,E)},o),window.addEventListener("touchmove",Or,o),window.addEventListener("pointerdown",u=>{u.pointerType===_(this,RS)&&(_(this,rm)||u.isPrimary)&&s(u),Or(u)},o));const l=u=>{if(!_(this,jd)||_(this,jd)===u.pointerId){s(u);return}Or(u)};window.addEventListener("pointerup",l,{signal:i}),window.addEventListener("blur",l,{signal:i})},A7=function(){if(_(this,Wd)||!this.div)return;L(this,Wd,new AbortController);const e=this._uiManager.combinedSignal(_(this,Wd));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:e}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:e})},Gme=function(e){Ut._resizerKeyboardManager.exec(this,e)},zme=function(e){var n;_(this,iu)&&((n=e.relatedTarget)==null?void 0:n.parentNode)!==_(this,Ha)&&X(this,Nt,Oy).call(this)},qme=function(e){L(this,wS,_(this,iu)?e:"")},R7=function(e){if(_(this,Js))for(const n of _(this,Js))n.tabIndex=e},Oy=function(){L(this,iu,!1),X(this,Nt,R7).call(this,-1),X(this,Nt,ew).call(this)},V(Ut,OS),Fe(Ut,"_l10n",null),Fe(Ut,"_l10nResizer",null),Fe(Ut,"_borderLineWidth",-1),Fe(Ut,"_colorManager",new TB),Fe(Ut,"_zIndex",1),Fe(Ut,"_telemetryTimeout",1e3);let ur=Ut;class zYe extends ur{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const Ace=3285377520,rs=4294901760,$l=65535;class Rce{constructor(e){this.h1=e?e&4294967295:Ace,this.h2=e?e&4294967295:Ace}update(e){let n,r;if(typeof e=="string"){n=new Uint8Array(e.length*2),r=0;for(let b=0,v=e.length;b<v;b++){const y=e.charCodeAt(b);y<=255?n[r++]=y:(n[r++]=y>>>8,n[r++]=y&255)}}else if(ArrayBuffer.isView(e))n=e.slice(),r=n.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const a=r>>2,i=r-a*4,o=new Uint32Array(n.buffer,0,a);let s=0,l=0,u=this.h1,d=this.h2;const f=3432918353,m=461845907,h=f&$l,E=m&$l;for(let b=0;b<a;b++)b&1?(s=o[b],s=s*f&rs|s*h&$l,s=s<<15|s>>>17,s=s*m&rs|s*E&$l,u^=s,u=u<<13|u>>>19,u=u*5+3864292196):(l=o[b],l=l*f&rs|l*h&$l,l=l<<15|l>>>17,l=l*m&rs|l*E&$l,d^=l,d=d<<13|d>>>19,d=d*5+3864292196);switch(s=0,i){case 3:s^=n[a*4+2]<<16;case 2:s^=n[a*4+1]<<8;case 1:s^=n[a*4],s=s*f&rs|s*h&$l,s=s<<15|s>>>17,s=s*m&rs|s*E&$l,a&1?u^=s:d^=s}this.h1=u,this.h2=d}hexdigest(){let e=this.h1,n=this.h2;return e^=n>>>1,e=e*3981806797&rs|e*36045&$l,n=n*4283543511&rs|((n<<16|e>>>16)*2950163797&rs)>>>16,e^=n>>>1,e=e*444984403&rs|e*60499&$l,n=n*3301882366&rs|((n<<16|e>>>16)*3120437893&rs)>>>16,e^=n>>>1,(e>>>0).toString(16).padStart(8,"0")+(n>>>0).toString(16).padStart(8,"0")}}const CB=Object.freeze({map:null,hash:"",transfer:void 0});class AB{constructor(){V(this,xR);V(this,am,!1);V(this,im,null);V(this,ou,null);V(this,$a,new Map);this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(e,n){const r=_(this,$a).get(e);return r===void 0?n:Object.assign(n,r)}getRawValue(e){return _(this,$a).get(e)}remove(e){const n=_(this,$a).get(e);if(n!==void 0&&(n instanceof ur&&_(this,ou).delete(n.annotationElementId),_(this,$a).delete(e),_(this,$a).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function")){for(const r of _(this,$a).values())if(r instanceof ur)return;this.onAnnotationEditor(null)}}setValue(e,n){const r=_(this,$a).get(e);let a=!1;if(r!==void 0)for(const[i,o]of Object.entries(n))r[i]!==o&&(a=!0,r[i]=o);else a=!0,_(this,$a).set(e,n);a&&X(this,xR,Hme).call(this),n instanceof ur&&((_(this,ou)||L(this,ou,new Map)).set(n.annotationElementId,n),typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(n.constructor._type))}has(e){return _(this,$a).has(e)}get size(){return _(this,$a).size}resetModified(){_(this,am)&&(L(this,am,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new wce(this)}get serializable(){if(_(this,$a).size===0)return CB;const e=new Map,n=new Rce,r=[],a=Object.create(null);let i=!1;for(const[o,s]of _(this,$a)){const l=s instanceof ur?s.serialize(!1,a):s;l&&(e.set(o,l),n.update(`${o}:${JSON.stringify(l)}`),i||(i=!!l.bitmap))}if(i)for(const o of e.values())o.bitmap&&r.push(o.bitmap);return e.size>0?{map:e,hash:n.hexdigest(),transfer:r}:CB}get editorStats(){let e=null;const n=new Map;let r=0,a=0;for(const i of _(this,$a).values()){if(!(i instanceof ur)){i.popup&&(i.popup.deleted?a+=1:r+=1);continue}i.isCommentDeleted?a+=1:i.hasEditedComment&&(r+=1);const o=i.telemetryFinalData;if(!o)continue;const{type:s}=o;n.has(s)||n.set(s,Object.getPrototypeOf(i).constructor),e||(e=Object.create(null));const l=e[s]||(e[s]=new Map);for(const[u,d]of Object.entries(o)){if(u==="type")continue;let f=l.get(u);f||(f=new Map,l.set(u,f));const m=f.get(d)??0;f.set(d,m+1)}}if((a>0||r>0)&&(e||(e=Object.create(null)),e.comments={deleted:a,edited:r}),!e)return null;for(const[i,o]of n)e[i]=o.computeTelemetryFinalData(e[i]);return e}resetModifiedIds(){L(this,im,null)}updateEditor(e,n){var a;const r=(a=_(this,ou))==null?void 0:a.get(e);return r?(r.updateFromAnnotationLayer(n),!0):!1}getEditor(e){var n;return((n=_(this,ou))==null?void 0:n.get(e))||null}get modifiedIds(){if(_(this,im))return _(this,im);const e=[];if(_(this,ou))for(const n of _(this,ou).values())n.serialize()&&e.push(n.annotationElementId);return L(this,im,{ids:new Set(e),hash:e.join(",")})}[Symbol.iterator](){return _(this,$a).entries()}}am=new WeakMap,im=new WeakMap,ou=new WeakMap,$a=new WeakMap,xR=new WeakSet,Hme=function(){_(this,am)||(L(this,am,!0),typeof this.onSetModified=="function"&&this.onSetModified())};class wce extends AB{constructor(n){super();V(this,IS);const{map:r,hash:a,transfer:i}=n.serializable,o=structuredClone(r,i?{transfer:i}:null);L(this,IS,{map:o,hash:a,transfer:i})}get print(){er("Should not call PrintAnnotationStorage.print")}get serializable(){return _(this,IS)}get modifiedIds(){return jt(this,"modifiedIds",{ids:new Set,hash:""})}}IS=new WeakMap;class qYe{constructor({ownerDocument:e=globalThis.document,styleElement:n=null}){V(this,i_,new Set);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 n=this.styleElement.sheet;n.insertRule(e,n.cssRules.length)}clear(){for(const e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.clear(),_(this,i_).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:e,disableFontFace:n,_inspectFont:r}){if(!(!e||_(this,i_).has(e.loadedName))){if(pn(!n,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:a,src:i,style:o}=e,s=new FontFace(a,i,o);this.addNativeFontFace(s);try{await s.load(),_(this,i_).add(a),r==null||r(e)}catch{Ft(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(s)}return}er("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){await this.loadSystemFont(e);return}if(this.isFontLoadingAPISupported){const r=e.createNativeFontFace();if(r){this.addNativeFontFace(r);try{await r.loaded}catch(a){throw Ft(`Failed to load font '${r.family}': '${a}'.`),e.disableFontFace=!0,a}}return}const n=e.createFontFaceRule();if(n){if(this.insertRule(n),this.isSyncFontLoadingSupported)return;await new Promise(r=>{const a=this._queueLoadingCallback(r);this._prepareFontLoadEvent(e,a)})}}get isFontLoadingAPISupported(){var n;const e=!!((n=this._document)!=null&&n.fonts);return jt(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){return jt(this,"isSyncFontLoadingSupported",Si||Ra.platform.isFirefox)}_queueLoadingCallback(e){function n(){for(pn(!a.done,"completeRequest() cannot be called twice."),a.done=!0;r.length>0&&r[0].done;){const i=r.shift();setTimeout(i.callback,0)}}const{loadingRequests:r}=this,a={done:!1,complete:n,callback:e};return r.push(a),a}get _loadTestFont(){const e=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return jt(this,"_loadTestFont",e)}_prepareFontLoadEvent(e,n){function r(w,O){return w.charCodeAt(O)<<24|w.charCodeAt(O+1)<<16|w.charCodeAt(O+2)<<8|w.charCodeAt(O+3)&255}function a(w,O,x,D){const M=w.substring(0,O),F=w.substring(O+x);return M+D+F}let i,o;const s=this._document.createElement("canvas");s.width=1,s.height=1;const l=s.getContext("2d");let u=0;function d(w,O){if(++u>30){Ft("Load test font never loaded."),O();return}if(l.font="30px "+w,l.fillText(".",0,20),l.getImageData(0,0,1,1).data[3]>0){O();return}setTimeout(d.bind(null,w,O))}const f=`lt${Date.now()}${this.loadTestFontId++}`;let m=this._loadTestFont;m=a(m,976,f.length,f);const E=16,b=1482184792;let v=r(m,E);for(i=0,o=f.length-3;i<o;i+=4)v=v-b+r(f,i)|0;i<f.length&&(v=v-b+r(f+"XXX",i)|0),m=a(m,E,4,NYe(v));const y=`url(data:font/opentype;base64,${btoa(m)});`,C=`@font-face {font-family:"${f}";src:${y}}`;this.insertRule(C);const T=this._document.createElement("div");T.style.visibility="hidden",T.style.width=T.style.height="10px",T.style.position="absolute",T.style.top=T.style.left="0px";for(const w of[e.loadedName,f]){const O=this._document.createElement("span");O.textContent="Hi",O.style.fontFamily=w,T.append(O)}this._document.body.append(T),d(f,()=>{T.remove(),n.complete()})}}i_=new WeakMap;class HYe{constructor(e,n=null,r,a){V(this,Gn);this.compiledGlyphs=Object.create(null),L(this,Gn,e),this._inspectFont=n,r&&Object.assign(this,r),a&&(this.charProcOperatorList=a)}createNativeFontFace(){var n;if(!this.data||this.disableFontFace)return null;let e;if(!this.cssFontInfo)e=new FontFace(this.loadedName,this.data,{});else{const r={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(r.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,r)}return(n=this._inspectFont)==null||n.call(this,this),e}createFontFaceRule(){var r;if(!this.data||this.disableFontFace)return null;const e=`url(data:${this.mimetype};base64,${pce(this.data)});`;let n;if(!this.cssFontInfo)n=`@font-face {font-family:"${this.loadedName}";src:${e}}`;else{let a=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(a+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),n=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${a}src:${e}}`}return(r=this._inspectFont)==null||r.call(this,this,e),n}getPathGenerator(e,n){if(this.compiledGlyphs[n]!==void 0)return this.compiledGlyphs[n];const r=this.loadedName+"_path_"+n;let a;try{a=e.get(r)}catch(o){Ft(`getPathGenerator - ignoring character: "${o}".`)}const i=new Path2D(a||"");return this.fontExtraProperties||e.delete(r),this.compiledGlyphs[n]=i}get black(){return _(this,Gn).black}get bold(){return _(this,Gn).bold}get disableFontFace(){return _(this,Gn).disableFontFace??!1}get fontExtraProperties(){return _(this,Gn).fontExtraProperties??!1}get isInvalidPDFjsFont(){return _(this,Gn).isInvalidPDFjsFont}get isType3Font(){return _(this,Gn).isType3Font}get italic(){return _(this,Gn).italic}get missingFile(){return _(this,Gn).missingFile}get remeasure(){return _(this,Gn).remeasure}get vertical(){return _(this,Gn).vertical}get ascent(){return _(this,Gn).ascent}get defaultWidth(){return _(this,Gn).defaultWidth}get descent(){return _(this,Gn).descent}get bbox(){return _(this,Gn).bbox}get fontMatrix(){return _(this,Gn).fontMatrix}get fallbackName(){return _(this,Gn).fallbackName}get loadedName(){return _(this,Gn).loadedName}get mimetype(){return _(this,Gn).mimetype}get name(){return _(this,Gn).name}get data(){return _(this,Gn).data}clearData(){_(this,Gn).clearData()}get cssFontInfo(){return _(this,Gn).cssFontInfo}get systemFontInfo(){return _(this,Gn).systemFontInfo}get defaultVMetrics(){return _(this,Gn).defaultVMetrics}}Gn=new WeakMap;function $Ye(t){if(t instanceof URL)return t.href;if(typeof t=="string"){if(Si)return t;const e=URL.parse(t,window.location);if(e)return e.href}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function YYe(t){if(Si&&typeof Buffer<"u"&&t instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength)return t;if(typeof t=="string")return BE(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)||typeof t=="object"&&!isNaN(t==null?void 0:t.length))return new Uint8Array(t);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function JA(t){if(typeof t!="string")return null;if(t.endsWith("/"))return t;throw new Error(`Invalid factory url: "${t}" must include trailing slash.`)}const RB=t=>typeof t=="object"&&Number.isInteger(t==null?void 0:t.num)&&t.num>=0&&Number.isInteger(t==null?void 0:t.gen)&&t.gen>=0,VYe=t=>typeof t=="object"&&typeof(t==null?void 0:t.name)=="string",xce=kYe.bind(null,RB,VYe);class jYe{constructor(){V(this,su,new Map);V(this,NR,Promise.resolve())}postMessage(e,n){const r={data:structuredClone(e,n?{transfer:n}:null)};_(this,NR).then(()=>{for(const[a]of _(this,su))a.call(this,r)})}addEventListener(e,n,r=null){let a=null;if((r==null?void 0:r.signal)instanceof AbortSignal){const{signal:i}=r;if(i.aborted){Ft("LoopbackPort - cannot use an `aborted` signal.");return}const o=()=>this.removeEventListener(e,n);a=()=>i.removeEventListener("abort",o),i.addEventListener("abort",o)}_(this,su).set(n,a)}removeEventListener(e,n){const r=_(this,su).get(n);r==null||r(),_(this,su).delete(n)}terminate(){for(const[,e]of _(this,su))e==null||e();_(this,su).clear()}}su=new WeakMap,NR=new WeakMap;const eR={DATA:1,ERROR:2},aa={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function Nce(){}function Gi(t){if(t instanceof $c||t instanceof jA||t instanceof lce||t instanceof FE||t instanceof fB)return t;switch(t instanceof Error||typeof t=="object"&&t!==null||er('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new $c(t.message);case"InvalidPDFException":return new jA(t.message);case"PasswordException":return new lce(t.message,t.code);case"ResponseException":return new FE(t.message,t.status,t.missing);case"UnknownErrorException":return new fB(t.message,t.details)}return new fB(t.message,t.toString())}class VE{constructor(e,n,r){V(this,ms);V(this,o_,new AbortController);this.sourceName=e,this.targetName=n,this.comObj=r,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),r.addEventListener("message",X(this,ms,$me).bind(this),{signal:_(this,o_).signal})}on(e,n){const r=this.actionHandler;if(r[e])throw new Error(`There is already an actionName called "${e}"`);r[e]=n}send(e,n,r){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:n},r)}sendWithPromise(e,n,r){const a=this.callbackId++,i=Promise.withResolvers();this.callbackCapabilities[a]=i;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:a,data:n},r)}catch(o){i.reject(o)}return i.promise}sendWithStream(e,n,r,a){const i=this.streamId++,o=this.sourceName,s=this.targetName,l=this.comObj;return new ReadableStream({start:u=>{const d=Promise.withResolvers();return this.streamControllers[i]={controller:u,startCall:d,pullCall:null,cancelCall:null,isClosed:!1},l.postMessage({sourceName:o,targetName:s,action:e,streamId:i,data:n,desiredSize:u.desiredSize},a),d.promise},pull:u=>{const d=Promise.withResolvers();return this.streamControllers[i].pullCall=d,l.postMessage({sourceName:o,targetName:s,stream:aa.PULL,streamId:i,desiredSize:u.desiredSize}),d.promise},cancel:u=>{pn(u instanceof Error,"cancel must have a valid reason");const d=Promise.withResolvers();return this.streamControllers[i].cancelCall=d,this.streamControllers[i].isClosed=!0,l.postMessage({sourceName:o,targetName:s,stream:aa.CANCEL,streamId:i,reason:Gi(u)}),d.promise}},r)}destroy(){var e;(e=_(this,o_))==null||e.abort(),L(this,o_,null)}}o_=new WeakMap,ms=new WeakSet,$me=function({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream){X(this,ms,Vme).call(this,e);return}if(e.callback){const r=e.callbackId,a=this.callbackCapabilities[r];if(!a)throw new Error(`Cannot resolve callback ${r}`);if(delete this.callbackCapabilities[r],e.callback===eR.DATA)a.resolve(e.data);else if(e.callback===eR.ERROR)a.reject(Gi(e.reason));else throw new Error("Unexpected callback case");return}const n=this.actionHandler[e.action];if(!n)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const r=this.sourceName,a=e.sourceName,i=this.comObj;Promise.try(n,e.data).then(function(o){i.postMessage({sourceName:r,targetName:a,callback:eR.DATA,callbackId:e.callbackId,data:o})},function(o){i.postMessage({sourceName:r,targetName:a,callback:eR.ERROR,callbackId:e.callbackId,reason:Gi(o)})});return}if(e.streamId){X(this,ms,Yme).call(this,e);return}n(e.data)},Yme=function(e){const n=e.streamId,r=this.sourceName,a=e.sourceName,i=this.comObj,o=this,s=this.actionHandler[e.action],l={enqueue(u,d=1,f){if(this.isCancelled)return;const m=this.desiredSize;this.desiredSize-=d,m>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),i.postMessage({sourceName:r,targetName:a,stream:aa.ENQUEUE,streamId:n,chunk:u},f)},close(){this.isCancelled||(this.isCancelled=!0,i.postMessage({sourceName:r,targetName:a,stream:aa.CLOSE,streamId:n}),delete o.streamSinks[n])},error(u){pn(u instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,i.postMessage({sourceName:r,targetName:a,stream:aa.ERROR,streamId:n,reason:Gi(u)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};l.sinkCapability.resolve(),l.ready=l.sinkCapability.promise,this.streamSinks[n]=l,Promise.try(s,e.data,l).then(function(){i.postMessage({sourceName:r,targetName:a,stream:aa.START_COMPLETE,streamId:n,success:!0})},function(u){i.postMessage({sourceName:r,targetName:a,stream:aa.START_COMPLETE,streamId:n,reason:Gi(u)})})},Vme=function(e){const n=e.streamId,r=this.sourceName,a=e.sourceName,i=this.comObj,o=this.streamControllers[n],s=this.streamSinks[n];switch(e.stream){case aa.START_COMPLETE:e.success?o.startCall.resolve():o.startCall.reject(Gi(e.reason));break;case aa.PULL_COMPLETE:e.success?o.pullCall.resolve():o.pullCall.reject(Gi(e.reason));break;case aa.PULL:if(!s){i.postMessage({sourceName:r,targetName:a,stream:aa.PULL_COMPLETE,streamId:n,success:!0});break}s.desiredSize<=0&&e.desiredSize>0&&s.sinkCapability.resolve(),s.desiredSize=e.desiredSize,Promise.try(s.onPull||Nce).then(function(){i.postMessage({sourceName:r,targetName:a,stream:aa.PULL_COMPLETE,streamId:n,success:!0})},function(u){i.postMessage({sourceName:r,targetName:a,stream:aa.PULL_COMPLETE,streamId:n,reason:Gi(u)})});break;case aa.ENQUEUE:if(pn(o,"enqueue should have stream controller"),o.isClosed)break;o.controller.enqueue(e.chunk);break;case aa.CLOSE:if(pn(o,"close should have stream controller"),o.isClosed)break;o.isClosed=!0,o.controller.close(),X(this,ms,tw).call(this,o,n);break;case aa.ERROR:pn(o,"error should have stream controller"),o.controller.error(Gi(e.reason)),X(this,ms,tw).call(this,o,n);break;case aa.CANCEL_COMPLETE:e.success?o.cancelCall.resolve():o.cancelCall.reject(Gi(e.reason)),X(this,ms,tw).call(this,o,n);break;case aa.CANCEL:if(!s)break;const l=Gi(e.reason);Promise.try(s.onCancel||Nce,l).then(function(){i.postMessage({sourceName:r,targetName:a,stream:aa.CANCEL_COMPLETE,streamId:n,success:!0})},function(u){i.postMessage({sourceName:r,targetName:a,stream:aa.CANCEL_COMPLETE,streamId:n,reason:Gi(u)})}),s.sinkCapability.reject(l),s.isCancelled=!0,delete this.streamSinks[n];break;default:throw new Error("Unexpected stream case")}},tw=async function(e,n){var r,a,i;await Promise.allSettled([(r=e.startCall)==null?void 0:r.promise,(a=e.pullCall)==null?void 0:a.promise,(i=e.cancelCall)==null?void 0:i.promise]),delete this.streamControllers[n]};class Oce{constructor({enableHWA:e=!1}){V(this,DS,!1);L(this,DS,e)}create(e,n){if(e<=0||n<=0)throw new Error("Invalid canvas size");const r=this._createCanvas(e,n);return{canvas:r,context:r.getContext("2d",{willReadFrequently:!_(this,DS)})}}reset(e,n,r){if(!e.canvas)throw new Error("Canvas is not specified");if(n<=0||r<=0)throw new Error("Invalid canvas size");e.canvas.width=n,e.canvas.height=r}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,n){er("Abstract method `_createCanvas` called.")}}DS=new WeakMap;class WYe extends Oce{constructor({ownerDocument:e=globalThis.document,enableHWA:n=!1}){super({enableHWA:n}),this._document=e}_createCanvas(e,n){const r=this._document.createElement("canvas");return r.width=e,r.height=n,r}}class Ice{constructor({baseUrl:e=null,isCompressed:n=!0}){this.baseUrl=e,this.isCompressed=n}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 n=this.baseUrl+e+(this.isCompressed?".bcmap":"");return this._fetch(n).then(r=>({cMapData:r,isCompressed:this.isCompressed})).catch(r=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${n}`)})}async _fetch(e){er("Abstract method `_fetch` called.")}}class Dce extends Ice{async _fetch(e){const n=await xg(e,this.isCompressed?"arraybuffer":"text");return n instanceof ArrayBuffer?new Uint8Array(n):BE(n)}}class kce{addFilter(e){return"none"}addHCMFilter(e,n){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addHighlightHCMFilter(e,n,r,a,i){return"none"}destroy(e=!1){}}class KYe extends kce{constructor({docId:n,ownerDocument:r=globalThis.document}){super();V(this,rt);V(this,om);V(this,s_);V(this,lu);V(this,cu);V(this,si);V(this,sm);V(this,lm,0);L(this,cu,n),L(this,si,r)}addFilter(n){if(!n)return"none";let r=_(this,rt,fi).get(n);if(r)return r;const[a,i,o]=X(this,rt,nw).call(this,n),s=n.length===1?a:`${a}${i}${o}`;if(r=_(this,rt,fi).get(s),r)return _(this,rt,fi).set(n,r),r;const l=`g_${_(this,cu)}_transfer_map_${Ca(this,lm)._++}`,u=X(this,rt,Kb).call(this,l);_(this,rt,fi).set(n,u),_(this,rt,fi).set(s,u);const d=X(this,rt,Xb).call(this,l);return X(this,rt,ky).call(this,a,i,o,d),u}addHCMFilter(n,r){var E;const a=`${n}-${r}`,i="base";let o=_(this,rt,Iy).get(i);if((o==null?void 0:o.key)===a||(o?((E=o.filter)==null||E.remove(),o.key=a,o.url="none",o.filter=null):(o={key:a,url:"none",filter:null},_(this,rt,Iy).set(i,o)),!n||!r))return o.url;const s=X(this,rt,My).call(this,n);n=at.makeHexColor(...s);const l=X(this,rt,My).call(this,r);if(r=at.makeHexColor(...l),_(this,rt,Wb).style.color="",n==="#000000"&&r==="#ffffff"||n===r)return o.url;const u=new Array(256);for(let b=0;b<=255;b++){const v=b/255;u[b]=v<=.03928?v/12.92:((v+.055)/1.055)**2.4}const d=u.join(","),f=`g_${_(this,cu)}_hcm_filter`,m=o.filter=X(this,rt,Xb).call(this,f);X(this,rt,ky).call(this,d,d,d,m),X(this,rt,w7).call(this,m);const h=(b,v)=>{const y=s[b]/255,C=l[b]/255,T=new Array(v+1);for(let w=0;w<=v;w++)T[w]=y+w/v*(C-y);return T.join(",")};return X(this,rt,ky).call(this,h(0,5),h(1,5),h(2,5),m),o.url=X(this,rt,Kb).call(this,f),o.url}addAlphaFilter(n){let r=_(this,rt,fi).get(n);if(r)return r;const[a]=X(this,rt,nw).call(this,[n]),i=`alpha_${a}`;if(r=_(this,rt,fi).get(i),r)return _(this,rt,fi).set(n,r),r;const o=`g_${_(this,cu)}_alpha_map_${Ca(this,lm)._++}`,s=X(this,rt,Kb).call(this,o);_(this,rt,fi).set(n,s),_(this,rt,fi).set(i,s);const l=X(this,rt,Xb).call(this,o);return X(this,rt,x7).call(this,a,l),s}addLuminosityFilter(n){let r=_(this,rt,fi).get(n||"luminosity");if(r)return r;let a,i;if(n?([a]=X(this,rt,nw).call(this,[n]),i=`luminosity_${a}`):i="luminosity",r=_(this,rt,fi).get(i),r)return _(this,rt,fi).set(n,r),r;const o=`g_${_(this,cu)}_luminosity_map_${Ca(this,lm)._++}`,s=X(this,rt,Kb).call(this,o);_(this,rt,fi).set(n,s),_(this,rt,fi).set(i,s);const l=X(this,rt,Xb).call(this,o);return X(this,rt,jme).call(this,l),n&&X(this,rt,x7).call(this,a,l),s}addHighlightHCMFilter(n,r,a,i,o){var C;const s=`${r}-${a}-${i}-${o}`;let l=_(this,rt,Iy).get(n);if((l==null?void 0:l.key)===s||(l?((C=l.filter)==null||C.remove(),l.key=s,l.url="none",l.filter=null):(l={key:s,url:"none",filter:null},_(this,rt,Iy).set(n,l)),!r||!a))return l.url;const[u,d]=[r,a].map(X(this,rt,My).bind(this));let f=Math.round(.2126*u[0]+.7152*u[1]+.0722*u[2]),m=Math.round(.2126*d[0]+.7152*d[1]+.0722*d[2]),[h,E]=[i,o].map(X(this,rt,My).bind(this));m<f&&([f,m,h,E]=[m,f,E,h]),_(this,rt,Wb).style.color="";const b=(T,w,O)=>{const x=new Array(256),D=(m-f)/O,M=T/255,F=(w-T)/(255*O);let P=0;for(let q=0;q<=O;q++){const j=Math.round(f+q*D),Q=M+q*F;for(let U=P;U<=j;U++)x[U]=Q;P=j+1}for(let q=P;q<256;q++)x[q]=x[P-1];return x.join(",")},v=`g_${_(this,cu)}_hcm_${n}_filter`,y=l.filter=X(this,rt,Xb).call(this,v);return X(this,rt,w7).call(this,y),X(this,rt,ky).call(this,b(h[0],E[0],5),b(h[1],E[1],5),b(h[2],E[2],5),y),l.url=X(this,rt,Kb).call(this,v),l.url}destroy(n=!1){var r,a,i,o;n&&((r=_(this,sm))!=null&&r.size)||((a=_(this,lu))==null||a.parentNode.parentNode.remove(),L(this,lu,null),(i=_(this,s_))==null||i.clear(),L(this,s_,null),(o=_(this,sm))==null||o.clear(),L(this,sm,null),L(this,lm,0))}}om=new WeakMap,s_=new WeakMap,lu=new WeakMap,cu=new WeakMap,si=new WeakMap,sm=new WeakMap,lm=new WeakMap,rt=new WeakSet,fi=function(){return _(this,s_)||L(this,s_,new Map)},Iy=function(){return _(this,sm)||L(this,sm,new Map)},Wb=function(){if(!_(this,lu)){const n=_(this,si).createElement("div"),{style:r}=n;r.visibility="hidden",r.contain="strict",r.width=r.height=0,r.position="absolute",r.top=r.left=0,r.zIndex=-1;const a=_(this,si).createElementNS(Yc,"svg");a.setAttribute("width",0),a.setAttribute("height",0),L(this,lu,_(this,si).createElementNS(Yc,"defs")),n.append(a),a.append(_(this,lu)),_(this,si).body.append(n)}return _(this,lu)},nw=function(n){if(n.length===1){const u=n[0],d=new Array(256);for(let m=0;m<256;m++)d[m]=u[m]/255;const f=d.join(",");return[f,f,f]}const[r,a,i]=n,o=new Array(256),s=new Array(256),l=new Array(256);for(let u=0;u<256;u++)o[u]=r[u]/255,s[u]=a[u]/255,l[u]=i[u]/255;return[o.join(","),s.join(","),l.join(",")]},Kb=function(n){if(_(this,om)===void 0){L(this,om,"");const r=_(this,si).URL;r!==_(this,si).baseURI&&(zE(r)?Ft('#createUrl: ignore "data:"-URL for performance reasons.'):L(this,om,pB(r,"")))}return`url(${_(this,om)}#${n})`},jme=function(n){const r=_(this,si).createElementNS(Yc,"feColorMatrix");r.setAttribute("type","matrix"),r.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"),n.append(r)},w7=function(n){const r=_(this,si).createElementNS(Yc,"feColorMatrix");r.setAttribute("type","matrix"),r.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"),n.append(r)},Xb=function(n){const r=_(this,si).createElementNS(Yc,"filter");return r.setAttribute("color-interpolation-filters","sRGB"),r.setAttribute("id",n),_(this,rt,Wb).append(r),r},Dy=function(n,r,a){const i=_(this,si).createElementNS(Yc,r);i.setAttribute("type","discrete"),i.setAttribute("tableValues",a),n.append(i)},ky=function(n,r,a,i){const o=_(this,si).createElementNS(Yc,"feComponentTransfer");i.append(o),X(this,rt,Dy).call(this,o,"feFuncR",n),X(this,rt,Dy).call(this,o,"feFuncG",r),X(this,rt,Dy).call(this,o,"feFuncB",a)},x7=function(n,r){const a=_(this,si).createElementNS(Yc,"feComponentTransfer");r.append(a),X(this,rt,Dy).call(this,a,"feFuncA",n)},My=function(n){return _(this,rt,Wb).style.color=n,Ng(getComputedStyle(_(this,rt,Wb)).getPropertyValue("color"))};class Mce{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 n=`${this.baseUrl}${e}`;return this._fetch(n).catch(r=>{throw new Error(`Unable to load font data at: ${n}`)})}async _fetch(e){er("Abstract method `_fetch` called.")}}class Lce extends Mce{async _fetch(e){const n=await xg(e,"arraybuffer");return new Uint8Array(n)}}class Pce{constructor({baseUrl:e=null}){this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error("Ensure that the `wasmUrl` API parameter is provided.");if(!e)throw new Error("Wasm filename must be specified.");const n=`${this.baseUrl}${e}`;return this._fetch(n).catch(r=>{throw new Error(`Unable to load wasm data at: ${n}`)})}async _fetch(e){er("Abstract method `_fetch` called.")}}class Fce extends Pce{async _fetch(e){const n=await xg(e,"arraybuffer");return new Uint8Array(n)}}Si&&Ft("Please use the `legacy` build in Node.js environments.");async function wB(t){const n=await process.getBuiltinModule("fs").promises.readFile(t);return new Uint8Array(n)}class XYe extends kce{}class QYe extends Oce{_createCanvas(e,n){return process.getBuiltinModule("module").createRequire(In&&In.tagName.toUpperCase()==="SCRIPT"&&In.src||new URL("app.js",document.baseURI).href)("@napi-rs/canvas").createCanvas(e,n)}}class ZYe extends Ice{async _fetch(e){return wB(e)}}class JYe extends Mce{async _fetch(e){return wB(e)}}class eVe extends Pce{async _fetch(e){return wB(e)}}const Og="__forcedDependency",{floor:Bce,ceil:Uce}=Math;function tR(t,e,n,r,a,i){t[e*4+0]=Math.min(t[e*4+0],n),t[e*4+1]=Math.min(t[e*4+1],r),t[e*4+2]=Math.max(t[e*4+2],a),t[e*4+3]=Math.max(t[e*4+3],i)}const xB=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0];class tVe{constructor(e,n){V(this,l_);V(this,Kd);L(this,l_,e),L(this,Kd,n)}get length(){return _(this,l_).length}isEmpty(e){return _(this,l_)[e]===xB}minX(e){return _(this,Kd)[e*4+0]/256}minY(e){return _(this,Kd)[e*4+1]/256}maxX(e){return(_(this,Kd)[e*4+2]+1)/256}maxY(e){return(_(this,Kd)[e*4+3]+1)/256}}l_=new WeakMap,Kd=new WeakMap;const nR=(t,e)=>{if(!t)return;let n=t.get(e);return n||(n={dependencies:new Set,isRenderingOperation:!1},t.set(e,n)),n};class nVe{constructor(e,n,r=!1){V(this,MS);V(this,Hi,{__proto__:null});V(this,$i,{__proto__:null,transform:[],moveText:[],sameLineText:[],[Og]:[]});V(this,cm,new Map);V(this,el,[]);V(this,um,[]);V(this,uu,[[1,0,0,1,0,0]]);V(this,Pn,[-1/0,-1/0,1/0,1/0]);V(this,zn,new Float64Array([1/0,1/0,-1/0,-1/0]));V(this,du,-1);V(this,Yi,new Set);V(this,kS,new Map);V(this,c_,new Map);V(this,dm);V(this,pm);V(this,pu);V(this,li);V(this,nc);L(this,dm,e.width),L(this,pm,e.height),X(this,MS,N7).call(this,n),r&&L(this,nc,new Map)}growOperationsCount(e){e>=_(this,li).length&&X(this,MS,N7).call(this,e,_(this,li))}save(e){return L(this,Hi,{__proto__:_(this,Hi)}),L(this,$i,{__proto__:_(this,$i),transform:{__proto__:_(this,$i).transform},moveText:{__proto__:_(this,$i).moveText},sameLineText:{__proto__:_(this,$i).sameLineText},[Og]:{__proto__:_(this,$i)[Og]}}),L(this,Pn,{__proto__:_(this,Pn)}),_(this,el).push(e),this}restore(e){var a;const n=Object.getPrototypeOf(_(this,Hi));if(n===null)return this;L(this,Hi,n),L(this,$i,Object.getPrototypeOf(_(this,$i))),L(this,Pn,Object.getPrototypeOf(_(this,Pn)));const r=_(this,el).pop();return r!==void 0&&((a=nR(_(this,nc),e))==null||a.dependencies.add(r),_(this,li)[e]=_(this,li)[r]),this}recordOpenMarker(e){return _(this,el).push(e),this}getOpenMarker(){return _(this,el).length===0?null:_(this,el).at(-1)}recordCloseMarker(e){var r;const n=_(this,el).pop();return n!==void 0&&((r=nR(_(this,nc),e))==null||r.dependencies.add(n),_(this,li)[e]=_(this,li)[n]),this}beginMarkedContent(e){return _(this,um).push(e),this}endMarkedContent(e){var r;const n=_(this,um).pop();return n!==void 0&&((r=nR(_(this,nc),e))==null||r.dependencies.add(n),_(this,li)[e]=_(this,li)[n]),this}pushBaseTransform(e){return _(this,uu).push(at.multiplyByDOMMatrix(_(this,uu).at(-1),e.getTransform())),this}popBaseTransform(){return _(this,uu).length>1&&_(this,uu).pop(),this}recordSimpleData(e,n){return _(this,Hi)[e]=n,this}recordIncrementalData(e,n){return _(this,$i)[e].push(n),this}resetIncrementalData(e,n){return _(this,$i)[e].length=0,this}recordNamedData(e,n){return _(this,cm).set(e,n),this}recordSimpleDataFromNamed(e,n,r){_(this,Hi)[e]=_(this,cm).get(n)??r}recordFutureForcedDependency(e,n){return this.recordIncrementalData(Og,n),this}inheritSimpleDataAsFutureForcedDependencies(e){for(const n of e)n in _(this,Hi)&&this.recordFutureForcedDependency(n,_(this,Hi)[n]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(const e of _(this,Yi))this.recordFutureForcedDependency(Og,e);return this}resetBBox(e){return _(this,du)!==e&&(L(this,du,e),_(this,zn)[0]=1/0,_(this,zn)[1]=1/0,_(this,zn)[2]=-1/0,_(this,zn)[3]=-1/0),this}recordClipBox(e,n,r,a,i,o){const s=at.multiplyByDOMMatrix(_(this,uu).at(-1),n.getTransform()),l=[1/0,1/0,-1/0,-1/0];at.axialAlignedBoundingBox([r,i,a,o],s,l);const u=at.intersect(_(this,Pn),l);return u?(_(this,Pn)[0]=u[0],_(this,Pn)[1]=u[1],_(this,Pn)[2]=u[2],_(this,Pn)[3]=u[3]):(_(this,Pn)[0]=_(this,Pn)[1]=1/0,_(this,Pn)[2]=_(this,Pn)[3]=-1/0),this}recordBBox(e,n,r,a,i,o){const s=_(this,Pn);if(s[0]===1/0)return this;const l=at.multiplyByDOMMatrix(_(this,uu).at(-1),n.getTransform());if(s[0]===-1/0)return at.axialAlignedBoundingBox([r,i,a,o],l,_(this,zn)),this;const u=[1/0,1/0,-1/0,-1/0];return at.axialAlignedBoundingBox([r,i,a,o],l,u),_(this,zn)[0]=Math.min(_(this,zn)[0],Math.max(u[0],s[0])),_(this,zn)[1]=Math.min(_(this,zn)[1],Math.max(u[1],s[1])),_(this,zn)[2]=Math.max(_(this,zn)[2],Math.min(u[2],s[2])),_(this,zn)[3]=Math.max(_(this,zn)[3],Math.min(u[3],s[3])),this}recordCharacterBBox(e,n,r,a=1,i=0,o=0,s){const l=r.bbox;let u,d;if(l&&(u=l[2]!==l[0]&&l[3]!==l[1]&&_(this,c_).get(r),u!==!1&&(d=[0,0,0,0],at.axialAlignedBoundingBox(l,r.fontMatrix,d),(a!==1||i!==0||o!==0)&&at.scaleMinMax([a,0,0,-a,i,o],d),u)))return this.recordBBox(e,n,d[0],d[2],d[1],d[3]);if(!s)return this.recordFullPageBBox(e);const f=s();return l&&d&&u===void 0&&(u=d[0]<=i-f.actualBoundingBoxLeft&&d[2]>=i+f.actualBoundingBoxRight&&d[1]<=o-f.actualBoundingBoxAscent&&d[3]>=o+f.actualBoundingBoxDescent,_(this,c_).set(r,u),u)?this.recordBBox(e,n,d[0],d[2],d[1],d[3]):this.recordBBox(e,n,i-f.actualBoundingBoxLeft,i+f.actualBoundingBoxRight,o-f.actualBoundingBoxAscent,o+f.actualBoundingBoxDescent)}recordFullPageBBox(e){return _(this,zn)[0]=Math.max(0,_(this,Pn)[0]),_(this,zn)[1]=Math.max(0,_(this,Pn)[1]),_(this,zn)[2]=Math.min(_(this,dm),_(this,Pn)[2]),_(this,zn)[3]=Math.min(_(this,pm),_(this,Pn)[3]),this}getSimpleIndex(e){return _(this,Hi)[e]}recordDependencies(e,n){const r=_(this,Yi),a=_(this,Hi),i=_(this,$i);for(const o of n)o in _(this,Hi)?r.add(a[o]):o in i&&i[o].forEach(r.add,r);return this}recordNamedDependency(e,n){return _(this,cm).has(n)&&_(this,Yi).add(_(this,cm).get(n)),this}recordOperation(e,n=!1){if(this.recordDependencies(e,[Og]),_(this,nc)){const r=nR(_(this,nc),e),{dependencies:a}=r;_(this,Yi).forEach(a.add,a),_(this,el).forEach(a.add,a),_(this,um).forEach(a.add,a),a.delete(e),r.isRenderingOperation=!0}if(_(this,du)===e){const r=Bce(_(this,zn)[0]*256/_(this,dm)),a=Bce(_(this,zn)[1]*256/_(this,pm)),i=Uce(_(this,zn)[2]*256/_(this,dm)),o=Uce(_(this,zn)[3]*256/_(this,pm));tR(_(this,pu),e,r,a,i,o);for(const s of _(this,Yi))s!==e&&tR(_(this,pu),s,r,a,i,o);for(const s of _(this,el))s!==e&&tR(_(this,pu),s,r,a,i,o);for(const s of _(this,um))s!==e&&tR(_(this,pu),s,r,a,i,o);n||(_(this,Yi).clear(),L(this,du,-1))}return this}recordShowTextOperation(e,n=!1){const r=Array.from(_(this,Yi));this.recordOperation(e,n),this.recordIncrementalData("sameLineText",e);for(const a of r)this.recordIncrementalData("sameLineText",a);return this}bboxToClipBoxDropOperation(e,n=!1){return _(this,du)===e&&(L(this,du,-1),_(this,Pn)[0]=Math.max(_(this,Pn)[0],_(this,zn)[0]),_(this,Pn)[1]=Math.max(_(this,Pn)[1],_(this,zn)[1]),_(this,Pn)[2]=Math.min(_(this,Pn)[2],_(this,zn)[2]),_(this,Pn)[3]=Math.min(_(this,Pn)[3],_(this,zn)[3]),n||_(this,Yi).clear()),this}_takePendingDependencies(){const e=_(this,Yi);return L(this,Yi,new Set),e}_extractOperation(e){const n=_(this,kS).get(e);return _(this,kS).delete(e),n}_pushPendingDependencies(e){for(const n of e)_(this,Yi).add(n)}take(){return _(this,c_).clear(),new tVe(_(this,li),_(this,pu))}takeDebugMetadata(){return _(this,nc)}}Hi=new WeakMap,$i=new WeakMap,cm=new WeakMap,el=new WeakMap,um=new WeakMap,uu=new WeakMap,Pn=new WeakMap,zn=new WeakMap,du=new WeakMap,Yi=new WeakMap,kS=new WeakMap,c_=new WeakMap,dm=new WeakMap,pm=new WeakMap,pu=new WeakMap,li=new WeakMap,nc=new WeakMap,MS=new WeakSet,N7=function(e,n){const r=new ArrayBuffer(e*4);L(this,pu,new Uint8ClampedArray(r)),L(this,li,new Uint32Array(r)),n&&n.length>0?(_(this,li).set(n),_(this,li).fill(xB,n.length)):_(this,li).fill(xB)};const s6=class s6{constructor(e,n,r){V(this,rr);V(this,Ur);V(this,tl);V(this,u_,0);V(this,d_,0);if(e instanceof s6&&_(e,tl)===!!r)return e;L(this,rr,e),L(this,Ur,n),L(this,tl,!!r)}growOperationsCount(){throw new Error("Unreachable")}save(e){return Ca(this,d_)._++,_(this,rr).save(_(this,Ur)),this}restore(e){return _(this,d_)>0&&(_(this,rr).restore(_(this,Ur)),Ca(this,d_)._--),this}recordOpenMarker(e){return Ca(this,u_)._++,this}getOpenMarker(){return _(this,u_)>0?_(this,Ur):_(this,rr).getOpenMarker()}recordCloseMarker(e){return Ca(this,u_)._--,this}beginMarkedContent(e){return this}endMarkedContent(e){return this}pushBaseTransform(e){return _(this,rr).pushBaseTransform(e),this}popBaseTransform(){return _(this,rr).popBaseTransform(),this}recordSimpleData(e,n){return _(this,rr).recordSimpleData(e,_(this,Ur)),this}recordIncrementalData(e,n){return _(this,rr).recordIncrementalData(e,_(this,Ur)),this}resetIncrementalData(e,n){return _(this,rr).resetIncrementalData(e,_(this,Ur)),this}recordNamedData(e,n){return this}recordSimpleDataFromNamed(e,n,r){return _(this,rr).recordSimpleDataFromNamed(e,n,_(this,Ur)),this}recordFutureForcedDependency(e,n){return _(this,rr).recordFutureForcedDependency(e,_(this,Ur)),this}inheritSimpleDataAsFutureForcedDependencies(e){return _(this,rr).inheritSimpleDataAsFutureForcedDependencies(e),this}inheritPendingDependenciesAsFutureForcedDependencies(){return _(this,rr).inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(e){return _(this,tl)||_(this,rr).resetBBox(_(this,Ur)),this}recordClipBox(e,n,r,a,i,o){return _(this,tl)||_(this,rr).recordClipBox(_(this,Ur),n,r,a,i,o),this}recordBBox(e,n,r,a,i,o){return _(this,tl)||_(this,rr).recordBBox(_(this,Ur),n,r,a,i,o),this}recordCharacterBBox(e,n,r,a,i,o,s){return _(this,tl)||_(this,rr).recordCharacterBBox(_(this,Ur),n,r,a,i,o,s),this}recordFullPageBBox(e){return _(this,tl)||_(this,rr).recordFullPageBBox(_(this,Ur)),this}getSimpleIndex(e){return _(this,rr).getSimpleIndex(e)}recordDependencies(e,n){return _(this,rr).recordDependencies(_(this,Ur),n),this}recordNamedDependency(e,n){return _(this,rr).recordNamedDependency(_(this,Ur),n),this}recordOperation(e){return _(this,rr).recordOperation(_(this,Ur),!0),this}recordShowTextOperation(e){return _(this,rr).recordShowTextOperation(_(this,Ur),!0),this}bboxToClipBoxDropOperation(e){return _(this,tl)||_(this,rr).bboxToClipBoxDropOperation(_(this,Ur),!0),this}take(){throw new Error("Unreachable")}takeDebugMetadata(){throw new Error("Unreachable")}};rr=new WeakMap,Ur=new WeakMap,tl=new WeakMap,u_=new WeakMap,d_=new WeakMap;let rR=s6;const as={stroke:["path","transform","filter","strokeColor","strokeAlpha","lineWidth","lineCap","lineJoin","miterLimit","dash"],fill:["path","transform","filter","fillColor","fillAlpha","globalCompositeOperation","SMask"],imageXObject:["transform","SMask","filter","fillAlpha","strokeAlpha","globalCompositeOperation"],rawFillPath:["filter","fillColor","fillAlpha"],showText:["transform","leading","charSpacing","wordSpacing","hScale","textRise","moveText","textMatrix","font","fontObj","filter","fillColor","textRenderingMode","SMask","fillAlpha","strokeAlpha","globalCompositeOperation","sameLineText"],transform:["transform"],transformAndFill:["transform","fillColor"]},Ga={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function NB(t,e){if(!e)return;const n=e[2]-e[0],r=e[3]-e[1],a=new Path2D;a.rect(e[0],e[1],n,r),t.clip(a)}class OB{isModifyingCurrentTransform(){return!1}getPattern(){er("Abstract method `getPattern` called.")}}class rVe extends OB{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 n;this._type==="axial"?n=e.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(n=e.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const r of this._colorStops)n.addColorStop(r[0],r[1]);return n}getPattern(e,n,r,a){let i;if(a===Ga.STROKE||a===Ga.FILL){const o=n.current.getClippedPathBoundingBox(a,Ir(e))||[0,0,0,0],s=Math.ceil(o[2]-o[0])||1,l=Math.ceil(o[3]-o[1])||1,u=n.cachedCanvases.getCanvas("pattern",s,l),d=u.context;d.clearRect(0,0,d.canvas.width,d.canvas.height),d.beginPath(),d.rect(0,0,d.canvas.width,d.canvas.height),d.translate(-o[0],-o[1]),r=at.transform(r,[1,0,0,1,o[0],o[1]]),d.transform(...n.baseTransform),this.matrix&&d.transform(...this.matrix),NB(d,this._bbox),d.fillStyle=this._createGradient(d),d.fill(),i=e.createPattern(u.canvas,"no-repeat");const f=new DOMMatrix(r);i.setTransform(f)}else NB(e,this._bbox),i=this._createGradient(e);return i}}function IB(t,e,n,r,a,i,o,s){const l=e.coords,u=e.colors,d=t.data,f=t.width*4;let m;l[n+1]>l[r+1]&&(m=n,n=r,r=m,m=i,i=o,o=m),l[r+1]>l[a+1]&&(m=r,r=a,a=m,m=o,o=s,s=m),l[n+1]>l[r+1]&&(m=n,n=r,r=m,m=i,i=o,o=m);const h=(l[n]+e.offsetX)*e.scaleX,E=(l[n+1]+e.offsetY)*e.scaleY,b=(l[r]+e.offsetX)*e.scaleX,v=(l[r+1]+e.offsetY)*e.scaleY,y=(l[a]+e.offsetX)*e.scaleX,C=(l[a+1]+e.offsetY)*e.scaleY;if(E>=C)return;const T=u[i],w=u[i+1],O=u[i+2],x=u[o],D=u[o+1],M=u[o+2],F=u[s],P=u[s+1],q=u[s+2],j=Math.round(E),Q=Math.round(C);let U,K,G,Y,W,J,$,Z;for(let te=j;te<=Q;te++){if(te<v){const ie=te<E?0:(E-te)/(E-v);U=h-(h-b)*ie,K=T-(T-x)*ie,G=w-(w-D)*ie,Y=O-(O-M)*ie}else{let ie;te>C?ie=1:v===C?ie=0:ie=(v-te)/(v-C),U=b-(b-y)*ie,K=x-(x-F)*ie,G=D-(D-P)*ie,Y=M-(M-q)*ie}let B;te<E?B=0:te>C?B=1:B=(E-te)/(E-C),W=h-(h-y)*B,J=T-(T-F)*B,$=w-(w-P)*B,Z=O-(O-q)*B;const ae=Math.round(Math.min(U,W)),se=Math.round(Math.max(U,W));let de=f*te+ae*4;for(let ie=ae;ie<=se;ie++)B=(U-ie)/(U-W),B<0?B=0:B>1&&(B=1),d[de++]=K-(K-J)*B|0,d[de++]=G-(G-$)*B|0,d[de++]=Y-(Y-Z)*B|0,d[de++]=255}}function aVe(t,e,n){const r=e.coords,a=e.colors;let i,o;switch(e.type){case"lattice":const s=e.verticesPerRow,l=Math.floor(r.length/s)-1,u=s-1;for(i=0;i<l;i++){let d=i*s;for(let f=0;f<u;f++,d++)IB(t,n,r[d],r[d+1],r[d+s],a[d],a[d+1],a[d+s]),IB(t,n,r[d+s+1],r[d+1],r[d+s],a[d+s+1],a[d+1],a[d+s])}break;case"triangles":for(i=0,o=r.length;i<o;i+=3)IB(t,n,r[i],r[i+1],r[i+2],a[i],a[i+1],a[i+2]);break;default:throw new Error("illegal figure")}}class iVe extends OB{constructor(e){super(),this._coords=e[2],this._colors=e[3],this._figures=e[4],this._bounds=e[5],this._bbox=e[6],this._background=e[7],this.matrix=null}_createMeshCanvas(e,n,r){const s=Math.floor(this._bounds[0]),l=Math.floor(this._bounds[1]),u=Math.ceil(this._bounds[2])-s,d=Math.ceil(this._bounds[3])-l,f=Math.min(Math.ceil(Math.abs(u*e[0]*1.1)),3e3),m=Math.min(Math.ceil(Math.abs(d*e[1]*1.1)),3e3),h=u/f,E=d/m,b={coords:this._coords,colors:this._colors,offsetX:-s,offsetY:-l,scaleX:1/h,scaleY:1/E},v=f+4,y=m+4,C=r.getCanvas("mesh",v,y),T=C.context,w=T.createImageData(f,m);if(n){const x=w.data;for(let D=0,M=x.length;D<M;D+=4)x[D]=n[0],x[D+1]=n[1],x[D+2]=n[2],x[D+3]=255}for(const x of this._figures)aVe(w,x,b);return T.putImageData(w,2,2),{canvas:C.canvas,offsetX:s-2*h,offsetY:l-2*E,scaleX:h,scaleY:E}}isModifyingCurrentTransform(){return!0}getPattern(e,n,r,a){NB(e,this._bbox);const i=new Float32Array(2);if(a===Ga.SHADING)at.singularValueDecompose2dScale(Ir(e),i);else if(this.matrix){at.singularValueDecompose2dScale(this.matrix,i);const[s,l]=i;at.singularValueDecompose2dScale(n.baseTransform,i),i[0]*=s,i[1]*=l}else at.singularValueDecompose2dScale(n.baseTransform,i);const o=this._createMeshCanvas(i,a===Ga.SHADING?null:this._background,n.cachedCanvases);return a!==Ga.SHADING&&(e.setTransform(...n.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(o.offsetX,o.offsetY),e.scale(o.scaleX,o.scaleY),e.createPattern(o.canvas,"no-repeat")}}class oVe extends OB{getPattern(){return"hotpink"}}function sVe(t){switch(t[0]){case"RadialAxial":return new rVe(t);case"Mesh":return new iVe(t);case"Dummy":return new oVe}throw new Error(`Unknown IR type: ${t[0]}`)}const Gce={COLORED:1,UNCOLORED:2},OR=class OR{constructor(e,n,r,a){this.color=e[1],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.ctx=n,this.canvasGraphicsFactory=r,this.baseTransform=a}createPatternCanvas(e,n){var J,$;const{bbox:r,operatorList:a,paintType:i,tilingType:o,color:s,canvasGraphicsFactory:l}=this;let{xstep:u,ystep:d}=this;u=Math.abs(u),d=Math.abs(d),VA("TilingType: "+o);const f=r[0],m=r[1],h=r[2],E=r[3],b=h-f,v=E-m,y=new Float32Array(2);at.singularValueDecompose2dScale(this.matrix,y);const[C,T]=y;at.singularValueDecompose2dScale(this.baseTransform,y);const w=C*y[0],O=T*y[1];let x=b,D=v,M=!1,F=!1;const P=Math.ceil(u*w),q=Math.ceil(d*O),j=Math.ceil(b*w),Q=Math.ceil(v*O);P>=j?x=u:M=!0,q>=Q?D=d:F=!0;const U=this.getSizeAndScale(x,this.ctx.canvas.width,w),K=this.getSizeAndScale(D,this.ctx.canvas.height,O),G=e.cachedCanvases.getCanvas("pattern",U.size,K.size),Y=G.context,W=l.createCanvasGraphics(Y,n);if(W.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(W,i,s),Y.translate(-U.scale*f,-K.scale*m),W.transform(0,U.scale,0,0,K.scale,0,0),Y.save(),(J=W.dependencyTracker)==null||J.save(),this.clipBbox(W,f,m,h,E),W.baseTransform=Ir(W.ctx),W.executeOperatorList(a),W.endDrawing(),($=W.dependencyTracker)==null||$.restore(),Y.restore(),M||F){const Z=G.canvas;M&&(x=u),F&&(D=d);const te=this.getSizeAndScale(x,this.ctx.canvas.width,w),B=this.getSizeAndScale(D,this.ctx.canvas.height,O),ae=te.size,se=B.size,de=e.cachedCanvases.getCanvas("pattern-workaround",ae,se),ie=de.context,ce=M?Math.floor(b/u):0,me=F?Math.floor(v/d):0;for(let be=0;be<=ce;be++)for(let Ae=0;Ae<=me;Ae++)ie.drawImage(Z,ae*be,se*Ae,ae,se,0,0,ae,se);return{canvas:de.canvas,scaleX:te.scale,scaleY:B.scale,offsetX:f,offsetY:m}}return{canvas:G.canvas,scaleX:U.scale,scaleY:K.scale,offsetX:f,offsetY:m}}getSizeAndScale(e,n,r){const a=Math.max(OR.MAX_PATTERN_SIZE,n);let i=Math.ceil(e*r);return i>=a?i=a:r=i/e,{scale:r,size:i}}clipBbox(e,n,r,a,i){const o=a-n,s=i-r;e.ctx.rect(n,r,o,s),at.axialAlignedBoundingBox([n,r,a,i],Ir(e.ctx),e.current.minMax),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,n,r){const a=e.ctx,i=e.current;switch(n){case Gce.COLORED:const{fillStyle:o,strokeStyle:s}=this.ctx;a.fillStyle=i.fillColor=o,a.strokeStyle=i.strokeColor=s;break;case Gce.UNCOLORED:a.fillStyle=a.strokeStyle=r,i.fillColor=i.strokeColor=r;break;default:throw new xYe(`Unsupported paint type: ${n}`)}}isModifyingCurrentTransform(){return!1}getPattern(e,n,r,a,i){let o=r;a!==Ga.SHADING&&(o=at.transform(o,n.baseTransform),this.matrix&&(o=at.transform(o,this.matrix)));const s=this.createPatternCanvas(n,i);let l=new DOMMatrix(o);l=l.translate(s.offsetX,s.offsetY),l=l.scale(1/s.scaleX,1/s.scaleY);const u=e.createPattern(s.canvas,"repeat");return u.setTransform(l),u}};Fe(OR,"MAX_PATTERN_SIZE",3e3);let DB=OR;function lVe({src:t,srcPos:e=0,dest:n,width:r,height:a,nonBlackColor:i=4294967295,inverseDecode:o=!1}){const s=Ra.isLittleEndian?4278190080:255,[l,u]=o?[i,s]:[s,i],d=r>>3,f=r&7,m=t.length;n=new Uint32Array(n.buffer);let h=0;for(let E=0;E<a;E++){for(const v=e+d;e<v;e++){const y=e<m?t[e]:255;n[h++]=y&128?u:l,n[h++]=y&64?u:l,n[h++]=y&32?u:l,n[h++]=y&16?u:l,n[h++]=y&8?u:l,n[h++]=y&4?u:l,n[h++]=y&2?u:l,n[h++]=y&1?u:l}if(f===0)continue;const b=e<m?t[e++]:255;for(let v=0;v<f;v++)n[h++]=b&1<<7-v?u:l}return{srcPos:e,destPos:h}}const zce=16,qce=100,cVe=15,Hce=10,zi=16,kB=new DOMMatrix,vo=new Float32Array(2),Ig=new Float32Array([1/0,1/0,-1/0,-1/0]);function uVe(t,e){if(t._removeMirroring)throw new Error("Context is already forwarding operations.");t.__originalSave=t.save,t.__originalRestore=t.restore,t.__originalRotate=t.rotate,t.__originalScale=t.scale,t.__originalTranslate=t.translate,t.__originalTransform=t.transform,t.__originalSetTransform=t.setTransform,t.__originalResetTransform=t.resetTransform,t.__originalClip=t.clip,t.__originalMoveTo=t.moveTo,t.__originalLineTo=t.lineTo,t.__originalBezierCurveTo=t.bezierCurveTo,t.__originalRect=t.rect,t.__originalClosePath=t.closePath,t.__originalBeginPath=t.beginPath,t._removeMirroring=()=>{t.save=t.__originalSave,t.restore=t.__originalRestore,t.rotate=t.__originalRotate,t.scale=t.__originalScale,t.translate=t.__originalTranslate,t.transform=t.__originalTransform,t.setTransform=t.__originalSetTransform,t.resetTransform=t.__originalResetTransform,t.clip=t.__originalClip,t.moveTo=t.__originalMoveTo,t.lineTo=t.__originalLineTo,t.bezierCurveTo=t.__originalBezierCurveTo,t.rect=t.__originalRect,t.closePath=t.__originalClosePath,t.beginPath=t.__originalBeginPath,delete t._removeMirroring},t.save=function(){e.save(),this.__originalSave()},t.restore=function(){e.restore(),this.__originalRestore()},t.translate=function(n,r){e.translate(n,r),this.__originalTranslate(n,r)},t.scale=function(n,r){e.scale(n,r),this.__originalScale(n,r)},t.transform=function(n,r,a,i,o,s){e.transform(n,r,a,i,o,s),this.__originalTransform(n,r,a,i,o,s)},t.setTransform=function(n,r,a,i,o,s){e.setTransform(n,r,a,i,o,s),this.__originalSetTransform(n,r,a,i,o,s)},t.resetTransform=function(){e.resetTransform(),this.__originalResetTransform()},t.rotate=function(n){e.rotate(n),this.__originalRotate(n)},t.clip=function(n){e.clip(n),this.__originalClip(n)},t.moveTo=function(n,r){e.moveTo(n,r),this.__originalMoveTo(n,r)},t.lineTo=function(n,r){e.lineTo(n,r),this.__originalLineTo(n,r)},t.bezierCurveTo=function(n,r,a,i,o,s){e.bezierCurveTo(n,r,a,i,o,s),this.__originalBezierCurveTo(n,r,a,i,o,s)},t.rect=function(n,r,a,i){e.rect(n,r,a,i),this.__originalRect(n,r,a,i)},t.closePath=function(){e.closePath(),this.__originalClosePath()},t.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}class dVe{constructor(e){this.canvasFactory=e,this.cache=Object.create(null)}getCanvas(e,n,r){let a;return this.cache[e]!==void 0?(a=this.cache[e],this.canvasFactory.reset(a,n,r)):(a=this.canvasFactory.create(n,r),this.cache[e]=a),a}delete(e){delete this.cache[e]}clear(){for(const e in this.cache){const n=this.cache[e];this.canvasFactory.destroy(n),delete this.cache[e]}}}function aR(t,e,n,r,a,i,o,s,l,u){const[d,f,m,h,E,b]=Ir(t);if(f===0&&m===0){const C=o*d+E,T=Math.round(C),w=s*h+b,O=Math.round(w),x=(o+l)*d+E,D=Math.abs(Math.round(x)-T)||1,M=(s+u)*h+b,F=Math.abs(Math.round(M)-O)||1;return t.setTransform(Math.sign(d),0,0,Math.sign(h),T,O),t.drawImage(e,n,r,a,i,0,0,D,F),t.setTransform(d,f,m,h,E,b),[D,F]}if(d===0&&h===0){const C=s*m+E,T=Math.round(C),w=o*f+b,O=Math.round(w),x=(s+u)*m+E,D=Math.abs(Math.round(x)-T)||1,M=(o+l)*f+b,F=Math.abs(Math.round(M)-O)||1;return t.setTransform(0,Math.sign(f),Math.sign(m),0,T,O),t.drawImage(e,n,r,a,i,0,0,F,D),t.setTransform(d,f,m,h,E,b),[F,D]}t.drawImage(e,n,r,a,i,o,s,l,u);const v=Math.hypot(d,f),y=Math.hypot(m,h);return[v*l,y*u]}class $ce{constructor(e,n,r){Fe(this,"alphaIsShape",!1);Fe(this,"fontSize",0);Fe(this,"fontSizeScale",1);Fe(this,"textMatrix",null);Fe(this,"textMatrixScale",1);Fe(this,"fontMatrix",cB);Fe(this,"leading",0);Fe(this,"x",0);Fe(this,"y",0);Fe(this,"lineX",0);Fe(this,"lineY",0);Fe(this,"charSpacing",0);Fe(this,"wordSpacing",0);Fe(this,"textHScale",1);Fe(this,"textRenderingMode",Ua.FILL);Fe(this,"textRise",0);Fe(this,"fillColor","#000000");Fe(this,"strokeColor","#000000");Fe(this,"patternFill",!1);Fe(this,"patternStroke",!1);Fe(this,"fillAlpha",1);Fe(this,"strokeAlpha",1);Fe(this,"lineWidth",1);Fe(this,"activeSMask",null);Fe(this,"transferMaps","none");r==null||r(this),this.clipBox=new Float32Array([0,0,e,n]),this.minMax=Ig.slice()}clone(){const e=Object.create(this);return e.clipBox=this.clipBox.slice(),e.minMax=this.minMax.slice(),e}getPathBoundingBox(e=Ga.FILL,n=null){const r=this.minMax.slice();if(e===Ga.STROKE){n||er("Stroke bounding box must include transform."),at.singularValueDecompose2dScale(n,vo);const a=vo[0]*this.lineWidth/2,i=vo[1]*this.lineWidth/2;r[0]-=a,r[1]-=i,r[2]+=a,r[3]+=i}return r}updateClipFromPath(){const e=at.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(e){this.clipBox.set(e,0),this.minMax.set(Ig,0)}getClippedPathBoundingBox(e=Ga.FILL,n=null){return at.intersect(this.clipBox,this.getPathBoundingBox(e,n))}}function Yce(t,e){if(e instanceof ImageData){t.putImageData(e,0,0);return}const n=e.height,r=e.width,a=n%zi,i=(n-a)/zi,o=a===0?i:i+1,s=t.createImageData(r,zi);let l=0,u;const d=e.data,f=s.data;let m,h,E,b;if(e.kind===LE.GRAYSCALE_1BPP){const v=d.byteLength,y=new Uint32Array(f.buffer,0,f.byteLength>>2),C=y.length,T=r+7>>3,w=4294967295,O=Ra.isLittleEndian?4278190080:255;for(m=0;m<o;m++){for(E=m<i?zi:a,u=0,h=0;h<E;h++){const x=v-l;let D=0;const M=x>T?r:x*8-7,F=M&-8;let P=0,q=0;for(;D<F;D+=8)q=d[l++],y[u++]=q&128?w:O,y[u++]=q&64?w:O,y[u++]=q&32?w:O,y[u++]=q&16?w:O,y[u++]=q&8?w:O,y[u++]=q&4?w:O,y[u++]=q&2?w:O,y[u++]=q&1?w:O;for(;D<M;D++)P===0&&(q=d[l++],P=128),y[u++]=q&P?w:O,P>>=1}for(;u<C;)y[u++]=0;t.putImageData(s,0,m*zi)}}else if(e.kind===LE.RGBA_32BPP){for(h=0,b=r*zi*4,m=0;m<i;m++)f.set(d.subarray(l,l+b)),l+=b,t.putImageData(s,0,h),h+=zi;m<o&&(b=r*a*4,f.set(d.subarray(l,l+b)),t.putImageData(s,0,h))}else if(e.kind===LE.RGB_24BPP)for(E=zi,b=r*E,m=0;m<o;m++){for(m>=i&&(E=a,b=r*E),u=0,h=b;h--;)f[u++]=d[l++],f[u++]=d[l++],f[u++]=d[l++],f[u++]=255;t.putImageData(s,0,m*zi)}else throw new Error(`bad image kind: ${e.kind}`)}function Vce(t,e){if(e.bitmap){t.drawImage(e.bitmap,0,0);return}const n=e.height,r=e.width,a=n%zi,i=(n-a)/zi,o=a===0?i:i+1,s=t.createImageData(r,zi);let l=0;const u=e.data,d=s.data;for(let f=0;f<o;f++){const m=f<i?zi:a;({srcPos:l}=lVe({src:u,srcPos:l,dest:d,width:r,height:m,nonBlackColor:0})),t.putImageData(s,0,f*zi)}}function jE(t,e){const n=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const r of n)t[r]!==void 0&&(e[r]=t[r]);t.setLineDash!==void 0&&(e.setLineDash(t.getLineDash()),e.lineDashOffset=t.lineDashOffset)}function iR(t){t.strokeStyle=t.fillStyle="#000000",t.fillRule="nonzero",t.globalAlpha=1,t.lineWidth=1,t.lineCap="butt",t.lineJoin="miter",t.miterLimit=10,t.globalCompositeOperation="source-over",t.font="10px sans-serif",t.setLineDash!==void 0&&(t.setLineDash([]),t.lineDashOffset=0);const{filter:e}=t;e!=="none"&&e!==""&&(t.filter="none")}function jce(t,e){if(e)return!0;at.singularValueDecompose2dScale(t,vo);const n=Math.fround(Ks.pixelRatio*Vc.PDF_TO_CSS_UNITS);return vo[0]<=n&&vo[1]<=n}const pVe=["butt","round","square"],fVe=["miter","round","bevel"],mVe={},Wce={},l6=class l6{constructor(e,n,r,a,i,{optionalContentConfig:o,markedContentStack:s=null},l,u,d){V(this,nl);this.ctx=e,this.current=new $ce(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=n,this.objs=r,this.canvasFactory=a,this.filterFactory=i,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=s||[],this.optionalContentConfig=o,this.cachedCanvases=new dVe(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=l,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=u,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map,this.dependencyTracker=d??null}getObject(e,n,r=null){var a;return typeof n=="string"?((a=this.dependencyTracker)==null||a.recordNamedDependency(e,n),n.startsWith("g_")?this.commonObjs.get(n):this.objs.get(n)):r}beginDrawing({transform:e,viewport:n,transparency:r=!1,background:a=null}){const i=this.ctx.canvas.width,o=this.ctx.canvas.height,s=this.ctx.fillStyle;if(this.ctx.fillStyle=a||"#ffffff",this.ctx.fillRect(0,0,i,o),this.ctx.fillStyle=s,r){const l=this.cachedCanvases.getCanvas("transparent",i,o);this.compositeCtx=this.ctx,this.transparentCanvas=l.canvas,this.ctx=l.context,this.ctx.save(),this.ctx.transform(...Ir(this.compositeCtx))}this.ctx.save(),iR(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...n.transform),this.viewportScale=n.scale,this.baseTransform=Ir(this.ctx)}executeOperatorList(e,n,r,a,i){var y;const o=e.argsArray,s=e.fnArray;let l=n||0;const u=o.length;if(u===l)return l;const d=u-l>Hce&&typeof r=="function",f=d?Date.now()+cVe:0;let m=0;const h=this.commonObjs,E=this.objs;let b,v;for(;;){if(a!==void 0&&l===a.nextBreakPoint)return a.breakIt(l,r),l;if(!i||i(l))if(b=s[l],v=o[l]??null,b!==wg.dependency)v===null?this[b](l):this[b](l,...v);else for(const C of v){(y=this.dependencyTracker)==null||y.recordNamedData(C,l);const T=C.startsWith("g_")?h:E;if(!T.has(C))return T.get(C,r),l}if(l++,l===u)return l;if(d&&++m>Hce){if(Date.now()>f)return r(),l;m=0}}}endDrawing(){X(this,nl,O7).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const e of this._cachedBitmapsMap.values()){for(const n of e.values())typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement&&(n.width=n.height=0);e.clear()}this._cachedBitmapsMap.clear(),X(this,nl,I7).call(this)}_scaleImage(e,n){const r=e.width??e.displayWidth,a=e.height??e.displayHeight;let i=Math.max(Math.hypot(n[0],n[1]),1),o=Math.max(Math.hypot(n[2],n[3]),1),s=r,l=a,u="prescale1",d,f;for(;i>2&&s>1||o>2&&l>1;){let m=s,h=l;i>2&&s>1&&(m=s>=16384?Math.floor(s/2)-1||1:Math.ceil(s/2),i/=s/m),o>2&&l>1&&(h=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l)/2,o/=l/h),d=this.cachedCanvases.getCanvas(u,m,h),f=d.context,f.clearRect(0,0,m,h),f.drawImage(e,0,0,s,l,0,0,m,h),e=d.canvas,s=m,l=h,u=u==="prescale1"?"prescale2":"prescale1"}return{img:e,paintWidth:s,paintHeight:l}}_createMaskCanvas(e,n){var P,q;const r=this.ctx,{width:a,height:i}=n,o=this.current.fillColor,s=this.current.patternFill,l=Ir(r);let u,d,f,m;if((n.bitmap||n.data)&&n.count>1){const j=n.bitmap||n.data.buffer;d=JSON.stringify(s?l:[l.slice(0,4),o]),u=this._cachedBitmapsMap.get(j),u||(u=new Map,this._cachedBitmapsMap.set(j,u));const Q=u.get(d);if(Q&&!s){const U=Math.round(Math.min(l[0],l[2])+l[4]),K=Math.round(Math.min(l[1],l[3])+l[5]);return(P=this.dependencyTracker)==null||P.recordDependencies(e,as.transformAndFill),{canvas:Q,offsetX:U,offsetY:K}}f=Q}f||(m=this.cachedCanvases.getCanvas("maskCanvas",a,i),Vce(m.context,n));let h=at.transform(l,[1/a,0,0,-1/i,0,0]);h=at.transform(h,[1,0,0,1,0,-i]);const E=Ig.slice();at.axialAlignedBoundingBox([0,0,a,i],h,E);const[b,v,y,C]=E,T=Math.round(y-b)||1,w=Math.round(C-v)||1,O=this.cachedCanvases.getCanvas("fillCanvas",T,w),x=O.context,D=b,M=v;x.translate(-D,-M),x.transform(...h),f||(f=this._scaleImage(m.canvas,Hl(x)),f=f.img,u&&s&&u.set(d,f)),x.imageSmoothingEnabled=jce(Ir(x),n.interpolate),aR(x,f,0,0,f.width,f.height,0,0,a,i),x.globalCompositeOperation="source-in";const F=at.transform(Hl(x),[1,0,0,1,-D,-M]);return x.fillStyle=s?o.getPattern(r,this,F,Ga.FILL,e):o,x.fillRect(0,0,a,i),u&&!s&&(this.cachedCanvases.delete("fillCanvas"),u.set(d,O.canvas)),(q=this.dependencyTracker)==null||q.recordDependencies(e,as.transformAndFill),{canvas:O.canvas,offsetX:Math.round(D),offsetY:Math.round(M)}}setLineWidth(e,n){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("lineWidth",e),n!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=n,this.ctx.lineWidth=n}setLineCap(e,n){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("lineCap",e),this.ctx.lineCap=pVe[n]}setLineJoin(e,n){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("lineJoin",e),this.ctx.lineJoin=fVe[n]}setMiterLimit(e,n){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("miterLimit",e),this.ctx.miterLimit=n}setDash(e,n,r){var i;(i=this.dependencyTracker)==null||i.recordSimpleData("dash",e);const a=this.ctx;a.setLineDash!==void 0&&(a.setLineDash(n),a.lineDashOffset=r)}setRenderingIntent(e,n){}setFlatness(e,n){}setGState(e,n){var r,a,i,o,s;for(const[l,u]of n)switch(l){case"LW":this.setLineWidth(e,u);break;case"LC":this.setLineCap(e,u);break;case"LJ":this.setLineJoin(e,u);break;case"ML":this.setMiterLimit(e,u);break;case"D":this.setDash(e,u[0],u[1]);break;case"RI":this.setRenderingIntent(e,u);break;case"FL":this.setFlatness(e,u);break;case"Font":this.setFont(e,u[0],u[1]);break;case"CA":(r=this.dependencyTracker)==null||r.recordSimpleData("strokeAlpha",e),this.current.strokeAlpha=u;break;case"ca":(a=this.dependencyTracker)==null||a.recordSimpleData("fillAlpha",e),this.ctx.globalAlpha=this.current.fillAlpha=u;break;case"BM":(i=this.dependencyTracker)==null||i.recordSimpleData("globalCompositeOperation",e),this.ctx.globalCompositeOperation=u;break;case"SMask":(o=this.dependencyTracker)==null||o.recordSimpleData("SMask",e),this.current.activeSMask=u?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":(s=this.dependencyTracker)==null||s.recordSimpleData("filter",e),this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(u);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}beginSMaskMode(e){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const n=this.ctx.canvas.width,r=this.ctx.canvas.height,a="smaskGroupAt"+this.groupLevel,i=this.cachedCanvases.getCanvas(a,n,r);this.suspendedCtx=this.ctx;const o=this.ctx=i.context;o.setTransform(this.suspendedCtx.getTransform()),jE(this.suspendedCtx,o),uVe(o,this.suspendedCtx),this.setGState(e,[["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),jE(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 n=this.current.activeSMask,r=this.suspendedCtx;this.composeSMask(r,n,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,n,r,a){const i=a[0],o=a[1],s=a[2]-i,l=a[3]-o;s===0||l===0||(this.genericComposeSMask(n.context,r,s,l,n.subtype,n.backdrop,n.transferMap,i,o,n.offsetX,n.offsetY),e.save(),e.globalAlpha=1,e.globalCompositeOperation="source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(r.canvas,0,0),e.restore())}genericComposeSMask(e,n,r,a,i,o,s,l,u,d,f){let m=e.canvas,h=l-d,E=u-f;if(o)if(h<0||E<0||h+r>m.width||E+a>m.height){const v=this.cachedCanvases.getCanvas("maskExtension",r,a),y=v.context;y.drawImage(m,-h,-E),y.globalCompositeOperation="destination-atop",y.fillStyle=o,y.fillRect(0,0,r,a),y.globalCompositeOperation="source-over",m=v.canvas,h=E=0}else{e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);const v=new Path2D;v.rect(h,E,r,a),e.clip(v),e.globalCompositeOperation="destination-atop",e.fillStyle=o,e.fillRect(h,E,r,a),e.restore()}n.save(),n.globalAlpha=1,n.setTransform(1,0,0,1,0,0),i==="Alpha"&&s?n.filter=this.filterFactory.addAlphaFilter(s):i==="Luminosity"&&(n.filter=this.filterFactory.addLuminosityFilter(s));const b=new Path2D;b.rect(l,u,r,a),n.clip(b),n.globalCompositeOperation="destination-in",n.drawImage(m,h,E,r,a,l,u,r,a),n.restore()}save(e){var r;this.inSMaskMode&&jE(this.ctx,this.suspendedCtx),this.ctx.save();const n=this.current;this.stateStack.push(n),this.current=n.clone(),(r=this.dependencyTracker)==null||r.save(e)}restore(e){var n;if((n=this.dependencyTracker)==null||n.restore(e),this.stateStack.length===0){this.inSMaskMode&&this.endSMaskMode();return}this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&jE(this.suspendedCtx,this.ctx),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(e,n,r,a,i,o,s){var l;(l=this.dependencyTracker)==null||l.recordIncrementalData("transform",e),this.ctx.transform(n,r,a,i,o,s),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,n,r,a){let[i]=r;if(!a){i||(i=r[0]=new Path2D),this[n](e,i);return}if(this.dependencyTracker!==null){const o=n===wg.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(e).recordBBox(e,this.ctx,a[0]-o,a[2]+o,a[1]-o,a[3]+o).recordDependencies(e,["transform"])}if(!(i instanceof Path2D)){const o=r[0]=new Path2D;for(let s=0,l=i.length;s<l;)switch(i[s++]){case $A.moveTo:o.moveTo(i[s++],i[s++]);break;case $A.lineTo:o.lineTo(i[s++],i[s++]);break;case $A.curveTo:o.bezierCurveTo(i[s++],i[s++],i[s++],i[s++],i[s++],i[s++]);break;case $A.closePath:o.closePath();break;default:Ft(`Unrecognized drawing path operator: ${i[s-1]}`);break}i=o}at.axialAlignedBoundingBox(a,Ir(this.ctx),this.current.minMax),this[n](e,i),this._pathStartIdx=e}closePath(e){this.ctx.closePath()}stroke(e,n,r=!0){var o;const a=this.ctx,i=this.current.strokeColor;if(a.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof i=="object"&&(i!=null&&i.getPattern)){const s=i.isModifyingCurrentTransform()?a.getTransform():null;if(a.save(),a.strokeStyle=i.getPattern(a,this,Hl(a),Ga.STROKE,e),s){const l=new Path2D;l.addPath(n,a.getTransform().invertSelf().multiplySelf(s)),n=l}this.rescaleAndStroke(n,!1),a.restore()}else this.rescaleAndStroke(n,!0);(o=this.dependencyTracker)==null||o.recordDependencies(e,as.stroke),r&&this.consumePath(e,n,this.current.getClippedPathBoundingBox(Ga.STROKE,Ir(this.ctx))),a.globalAlpha=this.current.fillAlpha}closeStroke(e,n){this.stroke(e,n)}fill(e,n,r=!0){var u,d,f;const a=this.ctx,i=this.current.fillColor,o=this.current.patternFill;let s=!1;if(o){const m=i.isModifyingCurrentTransform()?a.getTransform():null;if((u=this.dependencyTracker)==null||u.save(e),a.save(),a.fillStyle=i.getPattern(a,this,Hl(a),Ga.FILL,e),m){const h=new Path2D;h.addPath(n,a.getTransform().invertSelf().multiplySelf(m)),n=h}s=!0}const l=this.current.getClippedPathBoundingBox();this.contentVisible&&l!==null&&(this.pendingEOFill?(a.fill(n,"evenodd"),this.pendingEOFill=!1):a.fill(n)),(d=this.dependencyTracker)==null||d.recordDependencies(e,as.fill),s&&(a.restore(),(f=this.dependencyTracker)==null||f.restore(e)),r&&this.consumePath(e,n,l)}eoFill(e,n){this.pendingEOFill=!0,this.fill(e,n)}fillStroke(e,n){this.fill(e,n,!1),this.stroke(e,n,!1),this.consumePath(e,n)}eoFillStroke(e,n){this.pendingEOFill=!0,this.fillStroke(e,n)}closeFillStroke(e,n){this.fillStroke(e,n)}closeEOFillStroke(e,n){this.pendingEOFill=!0,this.fillStroke(e,n)}endPath(e,n){this.consumePath(e,n)}rawFillPath(e,n){var r;this.ctx.fill(n),(r=this.dependencyTracker)==null||r.recordDependencies(e,as.rawFillPath).recordOperation(e)}clip(e){var n;(n=this.dependencyTracker)==null||n.recordFutureForcedDependency("clipMode",e),this.pendingClip=mVe}eoClip(e){var n;(n=this.dependencyTracker)==null||n.recordFutureForcedDependency("clipMode",e),this.pendingClip=Wce}beginText(e){var n;this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,(n=this.dependencyTracker)==null||n.recordOpenMarker(e).resetIncrementalData("sameLineText").resetIncrementalData("moveText",e)}endText(e){const n=this.pendingTextPaths,r=this.ctx;if(this.dependencyTracker){const{dependencyTracker:a}=this;n!==void 0&&a.recordFutureForcedDependency("textClip",a.getOpenMarker()).recordFutureForcedDependency("textClip",e),a.recordCloseMarker(e)}if(n!==void 0){const a=new Path2D,i=r.getTransform().invertSelf();for(const{transform:o,x:s,y:l,fontSize:u,path:d}of n)d&&a.addPath(d,new DOMMatrix(o).preMultiplySelf(i).translate(s,l).scale(u,-u));r.clip(a)}delete this.pendingTextPaths}setCharSpacing(e,n){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("charSpacing",e),this.current.charSpacing=n}setWordSpacing(e,n){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("wordSpacing",e),this.current.wordSpacing=n}setHScale(e,n){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("hScale",e),this.current.textHScale=n/100}setLeading(e,n){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("leading",e),this.current.leading=-n}setFont(e,n,r){var f,m;(f=this.dependencyTracker)==null||f.recordSimpleData("font",e).recordSimpleDataFromNamed("fontObj",n,e);const a=this.commonObjs.get(n),i=this.current;if(!a)throw new Error(`Can't find font for ${n}`);if(i.fontMatrix=a.fontMatrix||cB,(i.fontMatrix[0]===0||i.fontMatrix[3]===0)&&Ft("Invalid font matrix for font "+n),r<0?(r=-r,i.fontDirection=-1):i.fontDirection=1,this.current.font=a,this.current.fontSize=r,a.isType3Font)return;const o=a.loadedName||"sans-serif",s=((m=a.systemFontInfo)==null?void 0:m.css)||`"${o}", ${a.fallbackName}`;let l="normal";a.black?l="900":a.bold&&(l="bold");const u=a.italic?"italic":"normal";let d=r;r<zce?d=zce:r>qce&&(d=qce),this.current.fontSizeScale=r/d,this.ctx.font=`${u} ${l} ${d}px ${s}`}setTextRenderingMode(e,n){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("textRenderingMode",e),this.current.textRenderingMode=n}setTextRise(e,n){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("textRise",e),this.current.textRise=n}moveText(e,n,r){var a;(a=this.dependencyTracker)==null||a.resetIncrementalData("sameLineText").recordIncrementalData("moveText",e),this.current.x=this.current.lineX+=n,this.current.y=this.current.lineY+=r}setLeadingMoveText(e,n,r){this.setLeading(e,-r),this.moveText(e,n,r)}setTextMatrix(e,n){var a;(a=this.dependencyTracker)==null||a.recordSimpleData("textMatrix",e);const{current:r}=this;r.textMatrix=n,r.textMatrixScale=Math.hypot(n[0],n[1]),r.x=r.lineX=0,r.y=r.lineY=0}nextLine(e){var n;this.moveText(e,0,this.current.leading),(n=this.dependencyTracker)==null||n.recordIncrementalData("moveText",this.dependencyTracker.getSimpleIndex("leading")??e)}paintChar(e,n,r,a,i,o){var y,C,T,w;const s=this.ctx,l=this.current,u=l.font,d=l.textRenderingMode,f=l.fontSize/l.fontSizeScale,m=d&Ua.FILL_STROKE_MASK,h=!!(d&Ua.ADD_TO_PATH_FLAG),E=l.patternFill&&!u.missingFile,b=l.patternStroke&&!u.missingFile;let v;if((u.disableFontFace||h||E||b)&&!u.missingFile&&(v=u.getPathGenerator(this.commonObjs,n)),v&&(u.disableFontFace||E||b)){s.save(),s.translate(r,a),s.scale(f,-f),(y=this.dependencyTracker)==null||y.recordCharacterBBox(e,s,u);let O;if(m===Ua.FILL||m===Ua.FILL_STROKE)if(i){O=s.getTransform(),s.setTransform(...i);const x=X(this,nl,D7).call(this,v,O,i);s.fill(x)}else s.fill(v);if(m===Ua.STROKE||m===Ua.FILL_STROKE)if(o){O||(O=s.getTransform()),s.setTransform(...o);const{a:x,b:D,c:M,d:F}=O,P=at.inverseTransform(o),q=at.transform([x,D,M,F,0,0],P);at.singularValueDecompose2dScale(q,vo),s.lineWidth*=Math.max(vo[0],vo[1])/f,s.stroke(X(this,nl,D7).call(this,v,O,o))}else s.lineWidth/=f,s.stroke(v);s.restore()}else(m===Ua.FILL||m===Ua.FILL_STROKE)&&(s.fillText(n,r,a),(C=this.dependencyTracker)==null||C.recordCharacterBBox(e,s,u,f,r,a,()=>s.measureText(n))),(m===Ua.STROKE||m===Ua.FILL_STROKE)&&(this.dependencyTracker&&((T=this.dependencyTracker)==null||T.recordCharacterBBox(e,s,u,f,r,a,()=>s.measureText(n)).recordDependencies(e,as.stroke)),s.strokeText(n,r,a));h&&((this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:Ir(s),x:r,y:a,fontSize:f,path:v}),(w=this.dependencyTracker)==null||w.recordCharacterBBox(e,s,u,f,r,a))}get isFontSubpixelAAEnabled(){const{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1),e.fillText("I",0,10);const n=e.getImageData(0,0,10,10).data;let r=!1;for(let a=3;a<n.length;a+=4)if(n[a]>0&&n[a]<255){r=!0;break}return jt(this,"isFontSubpixelAAEnabled",r)}showText(e,n){var M,F,P,q;this.dependencyTracker&&(this.dependencyTracker.recordDependencies(e,as.showText).resetBBox(e),this.current.textRenderingMode&Ua.ADD_TO_PATH_FLAG&&this.dependencyTracker.recordFutureForcedDependency("textClip",e).inheritPendingDependenciesAsFutureForcedDependencies());const r=this.current,a=r.font;if(a.isType3Font){this.showType3Text(e,n),(M=this.dependencyTracker)==null||M.recordShowTextOperation(e);return}const i=r.fontSize;if(i===0){(F=this.dependencyTracker)==null||F.recordOperation(e);return}const o=this.ctx,s=r.fontSizeScale,l=r.charSpacing,u=r.wordSpacing,d=r.fontDirection,f=r.textHScale*d,m=n.length,h=a.vertical,E=h?1:-1,b=a.defaultVMetrics,v=i*r.fontMatrix[0],y=r.textRenderingMode===Ua.FILL&&!a.disableFontFace&&!r.patternFill;o.save(),r.textMatrix&&o.transform(...r.textMatrix),o.translate(r.x,r.y+r.textRise),d>0?o.scale(f,-1):o.scale(f,1);let C,T;if(r.patternFill){o.save();const j=r.fillColor.getPattern(o,this,Hl(o),Ga.FILL,e);C=Ir(o),o.restore(),o.fillStyle=j}if(r.patternStroke){o.save();const j=r.strokeColor.getPattern(o,this,Hl(o),Ga.STROKE,e);T=Ir(o),o.restore(),o.strokeStyle=j}let w=r.lineWidth;const O=r.textMatrixScale;if(O===0||w===0){const j=r.textRenderingMode&Ua.FILL_STROKE_MASK;(j===Ua.STROKE||j===Ua.FILL_STROKE)&&(w=this.getSinglePixelWidth())}else w/=O;if(s!==1&&(o.scale(s,s),w/=s),o.lineWidth=w,a.isInvalidPDFjsFont){const j=[];let Q=0;for(const K of n)j.push(K.unicode),Q+=K.width;const U=j.join("");if(o.fillText(U,0,0),this.dependencyTracker!==null){const K=o.measureText(U);this.dependencyTracker.recordBBox(e,this.ctx,-K.actualBoundingBoxLeft,K.actualBoundingBoxRight,-K.actualBoundingBoxAscent,K.actualBoundingBoxDescent).recordShowTextOperation(e)}r.x+=Q*v*f,o.restore(),this.compose();return}let x=0,D;for(D=0;D<m;++D){const j=n[D];if(typeof j=="number"){x+=E*j*i/1e3;continue}let Q=!1;const U=(j.isSpace?u:0)+l,K=j.fontChar,G=j.accent;let Y,W,J=j.width;if(h){const te=j.vmetric||b,B=-(j.vmetric?te[1]:J*.5)*v,ae=te[2]*v;J=te?-te[0]:J,Y=B/s,W=(x+ae)/s}else Y=x/s,W=0;let $;if(a.remeasure&&J>0){$=o.measureText(K);const te=$.width*1e3/i*s;if(J<te&&this.isFontSubpixelAAEnabled){const B=J/te;Q=!0,o.save(),o.scale(B,1),Y/=B}else J!==te&&(Y+=(J-te)/2e3*i/s)}if(this.contentVisible&&(j.isInFont||a.missingFile)){if(y&&!G)o.fillText(K,Y,W),(P=this.dependencyTracker)==null||P.recordCharacterBBox(e,o,$?{bbox:null}:a,i/s,Y,W,()=>$??o.measureText(K));else if(this.paintChar(e,K,Y,W,C,T),G){const te=Y+i*G.offset.x/s,B=W-i*G.offset.y/s;this.paintChar(e,G.fontChar,te,B,C,T)}}const Z=h?J*v-U*d:J*v+U*d;x+=Z,Q&&o.restore()}h?r.y-=x:r.x+=x*f,o.restore(),this.compose(),(q=this.dependencyTracker)==null||q.recordShowTextOperation(e)}showType3Text(e,n){const r=this.ctx,a=this.current,i=a.font,o=a.fontSize,s=a.fontDirection,l=i.vertical?1:-1,u=a.charSpacing,d=a.wordSpacing,f=a.textHScale*s,m=a.fontMatrix||cB,h=n.length,E=a.textRenderingMode===Ua.INVISIBLE;let b,v,y,C;if(E||o===0)return;this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,r.save(),a.textMatrix&&r.transform(...a.textMatrix),r.translate(a.x,a.y+a.textRise),r.scale(f,s);const T=this.dependencyTracker;for(this.dependencyTracker=T?new rR(T,e):null,b=0;b<h;++b){if(v=n[b],typeof v=="number"){C=l*v*o/1e3,this.ctx.translate(C,0),a.x+=C*f;continue}const w=(v.isSpace?d:0)+u,O=i.charProcOperatorList[v.operatorListId];O?this.contentVisible&&(this.save(),r.scale(o,o),r.transform(...m),this.executeOperatorList(O),this.restore()):Ft(`Type3 character "${v.operatorListId}" is not available.`);const x=[v.width,0];at.applyTransform(x,m),y=x[0]*o+w,r.translate(y,0),a.x+=y*f}r.restore(),T&&(this.dependencyTracker=T)}setCharWidth(e,n,r){}setCharWidthAndBounds(e,n,r,a,i,o,s){var u;const l=new Path2D;l.rect(a,i,o-a,s-i),this.ctx.clip(l),(u=this.dependencyTracker)==null||u.recordBBox(e,this.ctx,a,o,i,s).recordClipBox(e,this.ctx,a,o,i,s),this.endPath(e)}getColorN_Pattern(e,n){let r;if(n[0]==="TilingPattern"){const a=this.baseTransform||Ir(this.ctx),i={createCanvasGraphics:(o,s)=>new l6(o,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new rR(this.dependencyTracker,s,!0):null)};r=new DB(n,this.ctx,i,a)}else r=this._getPattern(e,n[1],n[2]);return r}setStrokeColorN(e,...n){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("strokeColor",e),this.current.strokeColor=this.getColorN_Pattern(e,n),this.current.patternStroke=!0}setFillColorN(e,...n){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("fillColor",e),this.current.fillColor=this.getColorN_Pattern(e,n),this.current.patternFill=!0}setStrokeRGBColor(e,n){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("strokeColor",e),this.ctx.strokeStyle=this.current.strokeColor=n,this.current.patternStroke=!1}setStrokeTransparent(e){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("strokeColor",e),this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(e,n){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("fillColor",e),this.ctx.fillStyle=this.current.fillColor=n,this.current.patternFill=!1}setFillTransparent(e){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("fillColor",e),this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(e,n,r=null){let a;return this.cachedPatterns.has(n)?a=this.cachedPatterns.get(n):(a=sVe(this.getObject(e,n)),this.cachedPatterns.set(n,a)),r&&(a.matrix=r),a}shadingFill(e,n){var o;if(!this.contentVisible)return;const r=this.ctx;this.save(e);const a=this._getPattern(e,n);r.fillStyle=a.getPattern(r,this,Hl(r),Ga.SHADING,e);const i=Hl(r);if(i){const{width:s,height:l}=r.canvas,u=Ig.slice();at.axialAlignedBoundingBox([0,0,s,l],i,u);const[d,f,m,h]=u;this.ctx.fillRect(d,f,m-d,h-f)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);(o=this.dependencyTracker)==null||o.resetBBox(e).recordFullPageBBox(e).recordDependencies(e,as.transform).recordDependencies(e,as.fill).recordOperation(e),this.compose(this.current.getClippedPathBoundingBox()),this.restore(e)}beginInlineImage(){er("Should not call beginInlineImage")}beginImageData(){er("Should not call beginImageData")}paintFormXObjectBegin(e,n,r){var a;if(this.contentVisible&&(this.save(e),this.baseTransformStack.push(this.baseTransform),n&&this.transform(e,...n),this.baseTransform=Ir(this.ctx),r)){at.axialAlignedBoundingBox(r,this.baseTransform,this.current.minMax);const[i,o,s,l]=r,u=new Path2D;u.rect(i,o,s-i,l-o),this.ctx.clip(u),(a=this.dependencyTracker)==null||a.recordClipBox(e,this.ctx,i,s,o,l),this.endPath(e)}}paintFormXObjectEnd(e){this.contentVisible&&(this.restore(e),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e,n){var T;if(!this.contentVisible)return;this.save(e),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const r=this.ctx;n.isolated||VA("TODO: Support non-isolated groups."),n.knockout&&Ft("Knockout groups not supported.");const a=Ir(r);if(n.matrix&&r.transform(...n.matrix),!n.bbox)throw new Error("Bounding box is required.");let i=Ig.slice();at.axialAlignedBoundingBox(n.bbox,Ir(r),i);const o=[0,0,r.canvas.width,r.canvas.height];i=at.intersect(i,o)||[0,0,0,0];const s=Math.floor(i[0]),l=Math.floor(i[1]),u=Math.max(Math.ceil(i[2])-s,1),d=Math.max(Math.ceil(i[3])-l,1);this.current.startNewPathAndClipBox([0,0,u,d]);let f="groupAt"+this.groupLevel;n.smask&&(f+="_smask_"+this.smaskCounter++%2);const m=this.cachedCanvases.getCanvas(f,u,d),h=m.context;h.translate(-s,-l),h.transform(...a);let E=new Path2D;const[b,v,y,C]=n.bbox;if(E.rect(b,v,y-b,C-v),n.matrix){const w=new Path2D;w.addPath(E,new DOMMatrix(n.matrix)),E=w}h.clip(E),n.smask&&this.smaskStack.push({canvas:m.canvas,context:h,offsetX:s,offsetY:l,subtype:n.smask.subtype,backdrop:n.smask.backdrop,transferMap:n.smask.transferMap||null,startTransformInverse:null}),(!n.smask||this.dependencyTracker)&&(r.setTransform(1,0,0,1,0,0),r.translate(s,l),r.save()),jE(r,h),this.ctx=h,(T=this.dependencyTracker)==null||T.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha","strokeAlpha","globalCompositeOperation"]).pushBaseTransform(r),this.setGState(e,[["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(r),this.groupLevel++}endGroup(e,n){var i;if(!this.contentVisible)return;this.groupLevel--;const r=this.ctx,a=this.groupStack.pop();if(this.ctx=a,this.ctx.imageSmoothingEnabled=!1,(i=this.dependencyTracker)==null||i.popBaseTransform(),n.smask)this.tempSMask=this.smaskStack.pop(),this.restore(e),this.dependencyTracker&&this.ctx.restore();else{this.ctx.restore();const o=Ir(this.ctx);this.restore(e),this.ctx.save(),this.ctx.setTransform(...o);const s=Ig.slice();at.axialAlignedBoundingBox([0,0,r.canvas.width,r.canvas.height],o,s),this.ctx.drawImage(r.canvas,0,0),this.ctx.restore(),this.compose(s)}}beginAnnotation(e,n,r,a,i,o){if(X(this,nl,O7).call(this),iR(this.ctx),this.ctx.save(),this.save(e),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),r){const s=r[2]-r[0],l=r[3]-r[1];if(o&&this.annotationCanvasMap){a=a.slice(),a[4]-=r[0],a[5]-=r[1],r=r.slice(),r[0]=r[1]=0,r[2]=s,r[3]=l,at.singularValueDecompose2dScale(Ir(this.ctx),vo);const{viewportScale:u}=this,d=Math.ceil(s*this.outputScaleX*u),f=Math.ceil(l*this.outputScaleY*u);this.annotationCanvas=this.canvasFactory.create(d,f);const{canvas:m,context:h}=this.annotationCanvas;this.annotationCanvasMap.set(n,m),this.annotationCanvas.savedCtx=this.ctx,this.ctx=h,this.ctx.save(),this.ctx.setTransform(vo[0],0,0,-vo[1],0,l*vo[1]),iR(this.ctx)}else{iR(this.ctx),this.endPath(e);const u=new Path2D;u.rect(r[0],r[1],s,l),this.ctx.clip(u)}}this.current=new $ce(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(e,...a),this.transform(e,...i)}endAnnotation(e){this.annotationCanvas&&(this.ctx.restore(),X(this,nl,I7).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(e,n){var s;if(!this.contentVisible)return;const r=n.count;n=this.getObject(e,n.data,n),n.count=r;const a=this.ctx,i=this._createMaskCanvas(e,n),o=i.canvas;a.save(),a.setTransform(1,0,0,1,0,0),a.drawImage(o,i.offsetX,i.offsetY),(s=this.dependencyTracker)==null||s.resetBBox(e).recordBBox(e,this.ctx,i.offsetX,i.offsetX+o.width,i.offsetY,i.offsetY+o.height).recordOperation(e),a.restore(),this.compose()}paintImageMaskXObjectRepeat(e,n,r,a=0,i=0,o,s){var f,m,h;if(!this.contentVisible)return;n=this.getObject(e,n.data,n);const l=this.ctx;l.save();const u=Ir(l);l.transform(r,a,i,o,0,0);const d=this._createMaskCanvas(e,n);l.setTransform(1,0,0,1,d.offsetX-u[4],d.offsetY-u[5]),(f=this.dependencyTracker)==null||f.resetBBox(e);for(let E=0,b=s.length;E<b;E+=2){const v=at.transform(u,[r,a,i,o,s[E],s[E+1]]);l.drawImage(d.canvas,v[4],v[5]),(m=this.dependencyTracker)==null||m.recordBBox(e,this.ctx,v[4],v[4]+d.canvas.width,v[5],v[5]+d.canvas.height)}l.restore(),this.compose(),(h=this.dependencyTracker)==null||h.recordOperation(e)}paintImageMaskXObjectGroup(e,n){var o,s,l;if(!this.contentVisible)return;const r=this.ctx,a=this.current.fillColor,i=this.current.patternFill;(o=this.dependencyTracker)==null||o.resetBBox(e).recordDependencies(e,as.transformAndFill);for(const u of n){const{data:d,width:f,height:m,transform:h}=u,E=this.cachedCanvases.getCanvas("maskCanvas",f,m),b=E.context;b.save();const v=this.getObject(e,d,u);Vce(b,v),b.globalCompositeOperation="source-in",b.fillStyle=i?a.getPattern(b,this,Hl(r),Ga.FILL,e):a,b.fillRect(0,0,f,m),b.restore(),r.save(),r.transform(...h),r.scale(1,-1),aR(r,E.canvas,0,0,f,m,0,-1,1,1),(s=this.dependencyTracker)==null||s.recordBBox(e,r,0,f,0,m),r.restore()}this.compose(),(l=this.dependencyTracker)==null||l.recordOperation(e)}paintImageXObject(e,n){if(!this.contentVisible)return;const r=this.getObject(e,n);if(!r){Ft("Dependent image isn't ready yet");return}this.paintInlineImageXObject(e,r)}paintImageXObjectRepeat(e,n,r,a,i){if(!this.contentVisible)return;const o=this.getObject(e,n);if(!o){Ft("Dependent image isn't ready yet");return}const s=o.width,l=o.height,u=[];for(let d=0,f=i.length;d<f;d+=2)u.push({transform:[r,0,0,a,i[d],i[d+1]],x:0,y:0,w:s,h:l});this.paintInlineImageXObjectGroup(e,o,u)}applyTransferMapsToCanvas(e){return this.current.transferMaps!=="none"&&(e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter="none"),e.canvas}applyTransferMapsToBitmap(e){if(this.current.transferMaps==="none")return e.bitmap;const{bitmap:n,width:r,height:a}=e,i=this.cachedCanvases.getCanvas("inlineImage",r,a),o=i.context;return o.filter=this.current.transferMaps,o.drawImage(n,0,0),o.filter="none",i.canvas}paintInlineImageXObject(e,n){var u;if(!this.contentVisible)return;const r=n.width,a=n.height,i=this.ctx;this.save(e);const{filter:o}=i;o!=="none"&&o!==""&&(i.filter="none"),i.scale(1/r,-1/a);let s;if(n.bitmap)s=this.applyTransferMapsToBitmap(n);else if(typeof HTMLElement=="function"&&n instanceof HTMLElement||!n.data)s=n;else{const f=this.cachedCanvases.getCanvas("inlineImage",r,a).context;Yce(f,n),s=this.applyTransferMapsToCanvas(f)}const l=this._scaleImage(s,Hl(i));i.imageSmoothingEnabled=jce(Ir(i),n.interpolate),(u=this.dependencyTracker)==null||u.resetBBox(e).recordBBox(e,i,0,r,-a,0).recordDependencies(e,as.imageXObject).recordOperation(e),aR(i,l.img,0,0,l.paintWidth,l.paintHeight,0,-a,r,a),this.compose(),this.restore(e)}paintInlineImageXObjectGroup(e,n,r){var o,s,l;if(!this.contentVisible)return;const a=this.ctx;let i;if(n.bitmap)i=n.bitmap;else{const u=n.width,d=n.height,m=this.cachedCanvases.getCanvas("inlineImage",u,d).context;Yce(m,n),i=this.applyTransferMapsToCanvas(m)}(o=this.dependencyTracker)==null||o.resetBBox(e);for(const u of r)a.save(),a.transform(...u.transform),a.scale(1,-1),aR(a,i,u.x,u.y,u.w,u.h,0,-1,1,1),(s=this.dependencyTracker)==null||s.recordBBox(e,a,0,1,-1,0),a.restore();(l=this.dependencyTracker)==null||l.recordOperation(e),this.compose()}paintSolidColorImageMask(e){var n;this.contentVisible&&((n=this.dependencyTracker)==null||n.resetBBox(e).recordBBox(e,this.ctx,0,1,0,1).recordDependencies(e,as.fill).recordOperation(e),this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(e,n){}markPointProps(e,n,r){}beginMarkedContent(e,n){var r;(r=this.dependencyTracker)==null||r.beginMarkedContent(e),this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,n,r){var a;(a=this.dependencyTracker)==null||a.beginMarkedContent(e),n==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(r)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(e){var n;(n=this.dependencyTracker)==null||n.endMarkedContent(e),this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(e){}endCompat(e){}consumePath(e,n,r){var o,s;const a=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(r);const i=this.ctx;this.pendingClip?(a||(this.pendingClip===Wce?i.clip(n,"evenodd"):i.clip(n)),this.pendingClip=null,(o=this.dependencyTracker)==null||o.bboxToClipBoxDropOperation(e).recordFutureForcedDependency("clipPath",e)):(s=this.dependencyTracker)==null||s.recordOperation(e),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=Ir(this.ctx);if(e[1]===0&&e[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{const n=Math.abs(e[0]*e[3]-e[2]*e[1]),r=Math.hypot(e[0],e[2]),a=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(r,a)/n}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:e}=this.current,{a:n,b:r,c:a,d:i}=this.ctx.getTransform();let o,s;if(r===0&&a===0){const l=Math.abs(n),u=Math.abs(i);if(l===u)if(e===0)o=s=1/l;else{const d=l*e;o=s=d<1?1/d:1}else if(e===0)o=1/l,s=1/u;else{const d=l*e,f=u*e;o=d<1?1/d:1,s=f<1?1/f:1}}else{const l=Math.abs(n*i-r*a),u=Math.hypot(n,r),d=Math.hypot(a,i);if(e===0)o=d/l,s=u/l;else{const f=e*l;o=d>f?d/f:1,s=u>f?u/f:1}}this._cachedScaleForStroking[0]=o,this._cachedScaleForStroking[1]=s}return this._cachedScaleForStroking}rescaleAndStroke(e,n){const{ctx:r,current:{lineWidth:a}}=this,[i,o]=this.getScaleForStroking();if(i===o){r.lineWidth=(a||1)*i,r.stroke(e);return}const s=r.getLineDash();n&&r.save(),r.scale(i,o),kB.a=1/i,kB.d=1/o;const l=new Path2D;if(l.addPath(e,kB),s.length>0){const u=Math.max(i,o);r.setLineDash(s.map(d=>d/u)),r.lineDashOffset/=u}r.lineWidth=a||1,r.stroke(l),n&&r.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}};nl=new WeakSet,O7=function(){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)},I7=function(){if(this.pageColors){const e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!=="none"){const n=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=n}}},D7=function(e,n,r){const a=new Path2D;return a.addPath(e,new DOMMatrix(r).invertSelf().multiplySelf(n)),a};let Dg=l6;for(const t in wg)Dg.prototype[t]!==void 0&&(Dg.prototype[wg[t]]=Dg.prototype[t]);const h_=class h_{constructor(e){V(this,m_);V(this,p_);V(this,f_);V(this,LS);L(this,p_,e),L(this,f_,new DataView(_(this,p_))),L(this,LS,new TextDecoder)}static write(e){const n=new TextEncoder,r={};let a=0;for(const u of h_.strings){const d=n.encode(e[u]);r[u]=d,a+=4+d.length}const i=new ArrayBuffer(a),o=new Uint8Array(i),s=new DataView(i);let l=0;for(const u of h_.strings){const d=r[u],f=d.length;s.setUint32(l,f),o.set(d,l+4),l+=4+f}return pn(l===i.byteLength,"CssFontInfo.write: Buffer overflow"),i}get fontFamily(){return X(this,m_,rw).call(this,0)}get fontWeight(){return X(this,m_,rw).call(this,1)}get italicAngle(){return X(this,m_,rw).call(this,2)}};p_=new WeakMap,f_=new WeakMap,LS=new WeakMap,m_=new WeakSet,rw=function(e){pn(e<h_.strings.length,"Invalid string index");let n=0;for(let a=0;a<e;a++)n+=_(this,f_).getUint32(n)+4;const r=_(this,f_).getUint32(n);return _(this,LS).decode(new Uint8Array(_(this,p_),n+4,r))},Fe(h_,"strings",["fontFamily","fontWeight","italicAngle"]);let oR=h_;const g_=class g_{constructor(e){V(this,mm);V(this,Xd);V(this,rc);V(this,fm);L(this,Xd,e),L(this,rc,new DataView(_(this,Xd))),L(this,fm,new TextDecoder)}static write(e){const n=new TextEncoder,r={};let a=0;for(const m of g_.strings){const h=n.encode(e[m]);r[m]=h,a+=4+h.length}a+=4;let i,o,s=1+a;e.style&&(i=n.encode(e.style.style),o=n.encode(e.style.weight),s+=4+i.length+4+o.length);const l=new ArrayBuffer(s),u=new Uint8Array(l),d=new DataView(l);let f=0;d.setUint8(f++,e.guessFallback?1:0),d.setUint32(f,0),f+=4,a=0;for(const m of g_.strings){const h=r[m],E=h.length;a+=4+E,d.setUint32(f,E),u.set(h,f+4),f+=4+E}return d.setUint32(f-a-4,a),e.style&&(d.setUint32(f,i.length),u.set(i,f+4),f+=4+i.length,d.setUint32(f,o.length),u.set(o,f+4),f+=4+o.length),pn(f<=l.byteLength,"SubstitionInfo.write: Buffer overflow"),l.transferToFixedLength(f)}get guessFallback(){return _(this,rc).getUint8(0)!==0}get css(){return X(this,mm,Ly).call(this,0)}get loadedName(){return X(this,mm,Ly).call(this,1)}get baseFontName(){return X(this,mm,Ly).call(this,2)}get src(){return X(this,mm,Ly).call(this,3)}get style(){let e=1;e+=4+_(this,rc).getUint32(e);const n=_(this,rc).getUint32(e),r=_(this,fm).decode(new Uint8Array(_(this,Xd),e+4,n));e+=4+n;const a=_(this,rc).getUint32(e),i=_(this,fm).decode(new Uint8Array(_(this,Xd),e+4,a));return{style:r,weight:i}}};Xd=new WeakMap,rc=new WeakMap,fm=new WeakMap,mm=new WeakSet,Ly=function(e){pn(e<g_.strings.length,"Invalid string index");let n=5;for(let a=0;a<e;a++)n+=_(this,rc).getUint32(n)+4;const r=_(this,rc).getUint32(n);return _(this,fm).decode(new Uint8Array(_(this,Xd),n+4,r))},Fe(g_,"strings",["css","loadedName","baseFontName","src"]);let sR=g_;const Gt=class Gt{constructor({data:e,extra:n}){V(this,Gr);V(this,ac);V(this,PS);V(this,qn);L(this,ac,e),L(this,PS,new TextDecoder),L(this,qn,new DataView(_(this,ac))),n&&Object.assign(this,n)}get black(){return X(this,Gr,_l).call(this,0)}get bold(){return X(this,Gr,_l).call(this,1)}get disableFontFace(){return X(this,Gr,_l).call(this,2)}get fontExtraProperties(){return X(this,Gr,_l).call(this,3)}get isInvalidPDFjsFont(){return X(this,Gr,_l).call(this,4)}get isType3Font(){return X(this,Gr,_l).call(this,5)}get italic(){return X(this,Gr,_l).call(this,6)}get missingFile(){return X(this,Gr,_l).call(this,7)}get remeasure(){return X(this,Gr,_l).call(this,8)}get vertical(){return X(this,Gr,_l).call(this,9)}get ascent(){return X(this,Gr,aw).call(this,0)}get defaultWidth(){return X(this,Gr,aw).call(this,1)}get descent(){return X(this,Gr,aw).call(this,2)}get bbox(){let e=_(Gt,b_);if(_(this,qn).getUint8(e)===0)return;e+=1;const r=[];for(let a=0;a<4;a++)r.push(_(this,qn).getInt16(e,!0)),e+=2;return r}get fontMatrix(){let e=_(Gt,E_);if(_(this,qn).getUint8(e)===0)return;e+=1;const r=[];for(let a=0;a<6;a++)r.push(_(this,qn).getFloat64(e,!0)),e+=8;return r}get defaultVMetrics(){let e=_(Gt,S_);if(_(this,qn).getUint8(e)===0)return;e+=1;const r=[];for(let a=0;a<3;a++)r.push(_(this,qn).getInt16(e,!0)),e+=2;return r}get fallbackName(){return X(this,Gr,Py).call(this,0)}get loadedName(){return X(this,Gr,Py).call(this,1)}get mimetype(){return X(this,Gr,Py).call(this,2)}get name(){return X(this,Gr,Py).call(this,3)}get data(){let e=_(Gt,Ao);const n=_(this,qn).getUint32(e);e+=4+n;const r=_(this,qn).getUint32(e);e+=4+r;const a=_(this,qn).getUint32(e);e+=4+a;const i=_(this,qn).getUint32(e);if(i!==0)return new Uint8Array(_(this,ac),e+4,i)}clearData(){let e=_(Gt,Ao);const n=_(this,qn).getUint32(e);e+=4+n;const r=_(this,qn).getUint32(e);e+=4+r;const a=_(this,qn).getUint32(e);e+=4+a;const i=_(this,qn).getUint32(e);new Uint8Array(_(this,ac),e+4,i).fill(0),_(this,qn).setUint32(e,0)}get cssFontInfo(){let e=_(Gt,Ao);const n=_(this,qn).getUint32(e);e+=4+n;const r=_(this,qn).getUint32(e);e+=4+r;const a=_(this,qn).getUint32(e);if(a===0)return null;const i=new Uint8Array(a);return i.set(new Uint8Array(_(this,ac),e+4,a)),new oR(i.buffer)}get systemFontInfo(){let e=_(Gt,Ao);const n=_(this,qn).getUint32(e);e+=4+n;const r=_(this,qn).getUint32(e);if(r===0)return null;const a=new Uint8Array(r);return a.set(new Uint8Array(_(this,ac),e+4,r)),new sR(a.buffer)}static write(e){const n=e.systemFontInfo?sR.write(e.systemFontInfo):null,r=e.cssFontInfo?oR.write(e.cssFontInfo):null,a=new TextEncoder,i={};let o=0;for(const b of Gt.strings)i[b]=a.encode(e[b]),o+=4+i[b].length;const s=_(Gt,Ao)+4+o+4+(n?n.byteLength:0)+4+(r?r.byteLength:0)+4+(e.data?e.data.length:0),l=new ArrayBuffer(s),u=new Uint8Array(l),d=new DataView(l);let f=0;const m=Gt.bools.length;let h=0,E=0;for(let b=0;b<m;b++){const v=e[Gt.bools[b]];h|=(v===void 0?0:v?2:1)<<E,E+=2,(E===8||b===m-1)&&(d.setUint8(f++,h),h=0,E=0)}pn(f===_(Gt,__),"FontInfo.write: Boolean properties offset mismatch");for(const b of Gt.numbers)d.setFloat64(f,e[b]),f+=8;if(pn(f===_(Gt,b_),"FontInfo.write: Number properties offset mismatch"),e.bbox){d.setUint8(f++,4);for(const b of e.bbox)d.setInt16(f,b,!0),f+=2}else d.setUint8(f++,0),f+=8;if(pn(f===_(Gt,E_),"FontInfo.write: BBox properties offset mismatch"),e.fontMatrix){d.setUint8(f++,6);for(const b of e.fontMatrix)d.setFloat64(f,b,!0),f+=8}else d.setUint8(f++,0),f+=48;if(pn(f===_(Gt,S_),"FontInfo.write: FontMatrix properties offset mismatch"),e.defaultVMetrics){d.setUint8(f++,1);for(const b of e.defaultVMetrics)d.setInt16(f,b,!0),f+=2}else d.setUint8(f++,0),f+=6;pn(f===_(Gt,Ao),"FontInfo.write: DefaultVMetrics properties offset mismatch"),d.setUint32(_(Gt,Ao),0),f+=4;for(const b of Gt.strings){const v=i[b],y=v.length;d.setUint32(f,y),u.set(v,f+4),f+=4+y}if(d.setUint32(_(Gt,Ao),f-_(Gt,Ao)-4),!n)d.setUint32(f,0),f+=4;else{const b=n.byteLength;d.setUint32(f,b),pn(f+4+b<=l.byteLength,"FontInfo.write: Buffer overflow at systemFontInfo"),u.set(new Uint8Array(n),f+4),f+=4+b}if(!r)d.setUint32(f,0),f+=4;else{const b=r.byteLength;d.setUint32(f,b),pn(f+4+b<=l.byteLength,"FontInfo.write: Buffer overflow at cssFontInfo"),u.set(new Uint8Array(r),f+4),f+=4+b}return e.data===void 0?(d.setUint32(f,0),f+=4):(d.setUint32(f,e.data.length),u.set(e.data,f+4),f+=4+e.data.length),pn(f<=l.byteLength,"FontInfo.write: Buffer overflow"),l.transferToFixedLength(f)}};__=new WeakMap,b_=new WeakMap,E_=new WeakMap,S_=new WeakMap,Ao=new WeakMap,ac=new WeakMap,PS=new WeakMap,qn=new WeakMap,Gr=new WeakSet,_l=function(e){pn(e<Gt.bools.length,"Invalid boolean index");const n=Math.floor(e/4),r=e*2%8,a=_(this,qn).getUint8(n)>>r&3;return a===0?void 0:a===2},aw=function(e){return pn(e<Gt.numbers.length,"Invalid number index"),_(this,qn).getFloat64(_(Gt,__)+e*8)},Py=function(e){pn(e<Gt.strings.length,"Invalid string index");let n=_(Gt,Ao)+4;for(let i=0;i<e;i++)n+=_(this,qn).getUint32(n)+4;const r=_(this,qn).getUint32(n),a=new Uint8Array(r);return a.set(new Uint8Array(_(this,ac),n+4,r)),_(this,PS).decode(a)},Fe(Gt,"bools",["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"]),Fe(Gt,"numbers",["ascent","defaultWidth","descent"]),Fe(Gt,"strings",["fallbackName","loadedName","mimetype","name"]),V(Gt,__,Math.ceil(Gt.bools.length*2/8)),V(Gt,b_,_(Gt,__)+Gt.numbers.length*8),V(Gt,E_,_(Gt,b_)+1+8),V(Gt,S_,_(Gt,E_)+1+48),V(Gt,Ao,_(Gt,S_)+1+6);let MB=Gt;class is{static get workerPort(){return _(this,FS)}static set workerPort(e){if(!(typeof Worker<"u"&&e instanceof Worker)&&e!==null)throw new Error("Invalid `workerPort` type.");L(this,FS,e)}static get workerSrc(){return _(this,BS)}static set workerSrc(e){if(typeof e!="string")throw new Error("Invalid `workerSrc` type.");L(this,BS,e)}}FS=new WeakMap,BS=new WeakMap,V(is,FS,null),V(is,BS,"");class hVe{constructor({parsedData:e,rawData:n}){V(this,v_);V(this,US);L(this,v_,e),L(this,US,n)}getRaw(){return _(this,US)}get(e){return _(this,v_).get(e)??null}[Symbol.iterator](){return _(this,v_).entries()}}v_=new WeakMap,US=new WeakMap;const kg=Symbol("INTERNAL");class gVe{constructor(e,{name:n,intent:r,usage:a,rbGroups:i}){V(this,GS,!1);V(this,zS,!1);V(this,qS,!1);V(this,y_,!0);L(this,GS,!!(e&Eo.DISPLAY)),L(this,zS,!!(e&Eo.PRINT)),this.name=n,this.intent=r,this.usage=a,this.rbGroups=i}get visible(){if(_(this,qS))return _(this,y_);if(!_(this,y_))return!1;const{print:e,view:n}=this.usage;return _(this,GS)?(n==null?void 0:n.viewState)!=="OFF":_(this,zS)?(e==null?void 0:e.printState)!=="OFF":!0}_setVisible(e,n,r=!1){e!==kg&&er("Internal method `_setVisible` called."),L(this,qS,r),L(this,y_,n)}}GS=new WeakMap,zS=new WeakMap,qS=new WeakMap,y_=new WeakMap;class _Ve{constructor(e,n=Eo.DISPLAY){V(this,HS);V(this,Qd,null);V(this,Hn,new Map);V(this,T_,null);V(this,C_,null);if(this.renderingIntent=n,this.name=null,this.creator=null,e!==null){this.name=e.name,this.creator=e.creator,L(this,C_,e.order);for(const r of e.groups)_(this,Hn).set(r.id,new gVe(n,r));if(e.baseState==="OFF")for(const r of _(this,Hn).values())r._setVisible(kg,!1);for(const r of e.on)_(this,Hn).get(r)._setVisible(kg,!0);for(const r of e.off)_(this,Hn).get(r)._setVisible(kg,!1);L(this,T_,this.getHash())}}isVisible(e){if(_(this,Hn).size===0)return!0;if(!e)return VA("Optional content group not defined."),!0;if(e.type==="OCG")return _(this,Hn).has(e.id)?_(this,Hn).get(e.id).visible:(Ft(`Optional content group not found: ${e.id}`),!0);if(e.type==="OCMD"){if(e.expression)return X(this,HS,k7).call(this,e.expression);if(!e.policy||e.policy==="AnyOn"){for(const n of e.ids){if(!_(this,Hn).has(n))return Ft(`Optional content group not found: ${n}`),!0;if(_(this,Hn).get(n).visible)return!0}return!1}else if(e.policy==="AllOn"){for(const n of e.ids){if(!_(this,Hn).has(n))return Ft(`Optional content group not found: ${n}`),!0;if(!_(this,Hn).get(n).visible)return!1}return!0}else if(e.policy==="AnyOff"){for(const n of e.ids){if(!_(this,Hn).has(n))return Ft(`Optional content group not found: ${n}`),!0;if(!_(this,Hn).get(n).visible)return!0}return!1}else if(e.policy==="AllOff"){for(const n of e.ids){if(!_(this,Hn).has(n))return Ft(`Optional content group not found: ${n}`),!0;if(_(this,Hn).get(n).visible)return!1}return!0}return Ft(`Unknown optional content policy ${e.policy}.`),!0}return Ft(`Unknown group type ${e.type}.`),!0}setVisibility(e,n=!0,r=!0){var i;const a=_(this,Hn).get(e);if(!a){Ft(`Optional content group not found: ${e}`);return}if(r&&n&&a.rbGroups.length)for(const o of a.rbGroups)for(const s of o)s!==e&&((i=_(this,Hn).get(s))==null||i._setVisible(kg,!1,!0));a._setVisible(kg,!!n,!0),L(this,Qd,null)}setOCGState({state:e,preserveRB:n}){let r;for(const a of e){switch(a){case"ON":case"OFF":case"Toggle":r=a;continue}const i=_(this,Hn).get(a);if(i)switch(r){case"ON":this.setVisibility(a,!0,n);break;case"OFF":this.setVisibility(a,!1,n);break;case"Toggle":this.setVisibility(a,!i.visible,n);break}}L(this,Qd,null)}get hasInitialVisibility(){return _(this,T_)===null||this.getHash()===_(this,T_)}getOrder(){return _(this,Hn).size?_(this,C_)?_(this,C_).slice():[..._(this,Hn).keys()]:null}getGroup(e){return _(this,Hn).get(e)||null}getHash(){if(_(this,Qd)!==null)return _(this,Qd);const e=new Rce;for(const[n,r]of _(this,Hn))e.update(`${n}:${r.visible}`);return L(this,Qd,e.hexdigest())}[Symbol.iterator](){return _(this,Hn).entries()}}Qd=new WeakMap,Hn=new WeakMap,T_=new WeakMap,C_=new WeakMap,HS=new WeakSet,k7=function(e){const n=e.length;if(n<2)return!0;const r=e[0];for(let a=1;a<n;a++){const i=e[a];let o;if(Array.isArray(i))o=X(this,HS,k7).call(this,i);else if(_(this,Hn).has(i))o=_(this,Hn).get(i).visible;else return Ft(`Optional content group not found: ${i}`),!0;switch(r){case"And":if(!o)return!1;break;case"Or":if(o)return!0;break;case"Not":return!o;default:return!0}}return r==="And"};class bVe{constructor(e,{disableRange:n=!1,disableStream:r=!1}){pn(e,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:a,initialData:i,progressiveDone:o,contentDispositionFilename:s}=e;if(this._queuedChunks=[],this._progressiveDone=o,this._contentDispositionFilename=s,(i==null?void 0:i.length)>0){const l=i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer;this._queuedChunks.push(l)}this._pdfDataRangeTransport=e,this._isStreamingSupported=!r,this._isRangeSupported=!n,this._contentLength=a,this._fullRequestReader=null,this._rangeReaders=[],e.addRangeListener((l,u)=>{this._onReceiveData({begin:l,chunk:u})}),e.addProgressListener((l,u)=>{this._onProgress({loaded:l,total:u})}),e.addProgressiveReadListener(l=>{this._onReceiveData({chunk:l})}),e.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),e.transportReady()}_onReceiveData({begin:e,chunk:n}){const r=n instanceof Uint8Array&&n.byteLength===n.buffer.byteLength?n.buffer:new Uint8Array(n).buffer;if(e===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(r):this._queuedChunks.push(r);else{const a=this._rangeReaders.some(function(i){return i._begin!==e?!1:(i._enqueue(r),!0)});pn(a,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}_onProgress(e){var n,r,a,i;e.total===void 0?(r=(n=this._rangeReaders[0])==null?void 0:n.onProgress)==null||r.call(n,{loaded:e.loaded}):(i=(a=this._fullRequestReader)==null?void 0:a.onProgress)==null||i.call(a,{loaded:e.loaded,total:e.total})}_onProgressiveDone(){var e;(e=this._fullRequestReader)==null||e.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){const n=this._rangeReaders.indexOf(e);n>=0&&this._rangeReaders.splice(n,1)}getFullReader(){pn(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;return this._queuedChunks=null,new EVe(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,n){if(n<=this._progressiveDataLength)return null;const r=new SVe(this,e,n);return this._pdfDataRangeTransport.requestDataRange(e,n),this._rangeReaders.push(r),r}cancelAllRequests(e){var n;(n=this._fullRequestReader)==null||n.cancel(e);for(const r of this._rangeReaders.slice(0))r.cancel(e);this._pdfDataRangeTransport.abort()}}class EVe{constructor(e,n,r=!1,a=null){this._stream=e,this._done=r||!1,this._filename=KA(a)?a:null,this._queuedChunks=n||[],this._loaded=0;for(const i of this._queuedChunks)this._loaded+=i.byteLength;this._requests=[],this._headersReady=Promise.resolve(),e._fullRequestReader=this,this.onProgress=null}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):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 n of this._requests)n.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class SVe{constructor(e,n,r){this._stream=e,this._begin=n,this._end=r,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(e){if(!this._done){if(this._requests.length===0)this._queuedChunk=e;else{this._requests.shift().resolve({value:e,done:!1});for(const r of this._requests)r.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 n=this._queuedChunk;return this._queuedChunk=null,{value:n,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 n of this._requests)n.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function vVe(t){let e=!0,n=r("filename\\*","i").exec(t);if(n){n=n[1];let d=s(n);return d=unescape(d),d=l(d),d=u(d),i(d)}if(n=o(t),n){const d=u(n);return i(d)}if(n=r("filename","i").exec(t),n){n=n[1];let d=s(n);return d=u(d),i(d)}function r(d,f){return new RegExp("(?:^|;)\\s*"+d+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',f)}function a(d,f){if(d){if(!/^[\x00-\xFF]+$/.test(f))return f;try{const m=new TextDecoder(d,{fatal:!0}),h=BE(f);f=m.decode(h),e=!1}catch{}}return f}function i(d){return e&&/[\x80-\xff]/.test(d)&&(d=a("utf-8",d),e&&(d=a("iso-8859-1",d))),d}function o(d){const f=[];let m;const h=r("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(m=h.exec(d))!==null;){let[,b,v,y]=m;if(b=parseInt(b,10),b in f){if(b===0)break;continue}f[b]=[v,y]}const E=[];for(let b=0;b<f.length&&b in f;++b){let[v,y]=f[b];y=s(y),v&&(y=unescape(y),b===0&&(y=l(y))),E.push(y)}return E.join("")}function s(d){if(d.startsWith('"')){const f=d.slice(1).split('\\"');for(let m=0;m<f.length;++m){const h=f[m].indexOf('"');h!==-1&&(f[m]=f[m].slice(0,h),f.length=m+1),f[m]=f[m].replaceAll(/\\(.)/g,"$1")}d=f.join('"')}return d}function l(d){const f=d.indexOf("'");if(f===-1)return d;const m=d.slice(0,f),E=d.slice(f+1).replace(/^[^']*'/,"");return a(m,E)}function u(d){return!d.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(d)?d:d.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(f,m,h,E){if(h==="q"||h==="Q")return E=E.replaceAll("_"," "),E=E.replaceAll(/=([0-9a-fA-F]{2})/g,function(b,v){return String.fromCharCode(parseInt(v,16))}),a(m,E);try{E=atob(E)}catch{}return a(m,E)})}return""}function Kce(t,e){const n=new Headers;if(!t||!e||typeof e!="object")return n;for(const r in e){const a=e[r];a!==void 0&&n.append(r,a)}return n}function lR(t){var e;return((e=URL.parse(t))==null?void 0:e.origin)??null}function Xce({responseHeaders:t,isHttp:e,rangeChunkSize:n,disableRange:r}){const a={allowRangeRequests:!1,suggestedLength:void 0},i=parseInt(t.get("Content-Length"),10);return!Number.isInteger(i)||(a.suggestedLength=i,i<=2*n)||r||!e||t.get("Accept-Ranges")!=="bytes"||(t.get("Content-Encoding")||"identity")!=="identity"||(a.allowRangeRequests=!0),a}function Qce(t){const e=t.get("Content-Disposition");if(e){let n=vVe(e);if(n.includes("%"))try{n=decodeURIComponent(n)}catch{}if(KA(n))return n}return null}function WE(t,e){return new FE(`Unexpected server response (${t}) while retrieving PDF "${e}".`,t,t===404||t===0&&e.startsWith("file:"))}function Zce(t){return t===200||t===206}function Jce(t,e,n){return{method:"GET",headers:t,signal:n.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function eue(t){return t instanceof Uint8Array?t.buffer:t instanceof ArrayBuffer?t:(Ft(`getArrayBuffer - unexpected data format: ${t}`),new Uint8Array(t).buffer)}class yVe{constructor(e){Fe(this,"_responseOrigin",null);this.source=e,this.isHttp=/^https?:/i.test(e.url),this.headers=Kce(this.isHttp,e.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}getFullReader(){return pn(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new TVe(this),this._fullRequestReader}getRangeReader(e,n){if(n<=this._progressiveDataLength)return null;const r=new CVe(this,e,n);return this._rangeRequestReaders.push(r),r}cancelAllRequests(e){var n;(n=this._fullRequestReader)==null||n.cancel(e);for(const r of this._rangeRequestReaders.slice(0))r.cancel(e)}}class TVe{constructor(e){this._stream=e,this._reader=null,this._loaded=0,this._filename=null;const n=e.source;this._withCredentials=n.withCredentials||!1,this._contentLength=n.length,this._headersCapability=Promise.withResolvers(),this._disableRange=n.disableRange||!1,this._rangeChunkSize=n.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!n.disableStream,this._isRangeSupported=!n.disableRange;const r=new Headers(e.headers),a=n.url;fetch(a,Jce(r,this._withCredentials,this._abortController)).then(i=>{if(e._responseOrigin=lR(i.url),!Zce(i.status))throw WE(i.status,a);this._reader=i.body.getReader(),this._headersCapability.resolve();const o=i.headers,{allowRangeRequests:s,suggestedLength:l}=Xce({responseHeaders:o,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s,this._contentLength=l||this._contentLength,this._filename=Qce(o),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new $c("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(){var r;await this._headersCapability.promise;const{value:e,done:n}=await this._reader.read();return n?{value:e,done:n}:(this._loaded+=e.byteLength,(r=this.onProgress)==null||r.call(this,{loaded:this._loaded,total:this._contentLength}),{value:eue(e),done:!1})}cancel(e){var n;(n=this._reader)==null||n.cancel(e),this._abortController.abort()}}class CVe{constructor(e,n,r){this._stream=e,this._reader=null,this._loaded=0;const a=e.source;this._withCredentials=a.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!a.disableStream,this._abortController=new AbortController;const i=new Headers(e.headers);i.append("Range",`bytes=${n}-${r-1}`);const o=a.url;fetch(o,Jce(i,this._withCredentials,this._abortController)).then(s=>{const l=lR(s.url);if(l!==e._responseOrigin)throw new Error(`Expected range response-origin "${l}" to match "${e._responseOrigin}".`);if(!Zce(s.status))throw WE(s.status,o);this._readCapability.resolve(),this._reader=s.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var r;await this._readCapability.promise;const{value:e,done:n}=await this._reader.read();return n?{value:e,done:n}:(this._loaded+=e.byteLength,(r=this.onProgress)==null||r.call(this,{loaded:this._loaded}),{value:eue(e),done:!1})}cancel(e){var n;(n=this._reader)==null||n.cancel(e),this._abortController.abort()}}const LB=200,PB=206;function AVe(t){const e=t.response;return typeof e!="string"?e:BE(e).buffer}class RVe{constructor({url:e,httpHeaders:n,withCredentials:r}){Fe(this,"_responseOrigin",null);this.url=e,this.isHttp=/^https?:/i.test(e),this.headers=Kce(this.isHttp,n),this.withCredentials=r||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}request(e){const n=new XMLHttpRequest,r=this.currXhrId++,a=this.pendingRequests[r]={xhr:n};n.open("GET",this.url),n.withCredentials=this.withCredentials;for(const[i,o]of this.headers)n.setRequestHeader(i,o);return this.isHttp&&"begin"in e&&"end"in e?(n.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),a.expectedStatus=PB):a.expectedStatus=LB,n.responseType="arraybuffer",pn(e.onError,"Expected `onError` callback to be provided."),n.onerror=()=>{e.onError(n.status)},n.onreadystatechange=this.onStateChange.bind(this,r),n.onprogress=this.onProgress.bind(this,r),a.onHeadersReceived=e.onHeadersReceived,a.onDone=e.onDone,a.onError=e.onError,a.onProgress=e.onProgress,n.send(null),r}onProgress(e,n){var a;const r=this.pendingRequests[e];r&&((a=r.onProgress)==null||a.call(r,n))}onStateChange(e,n){const r=this.pendingRequests[e];if(!r)return;const a=r.xhr;if(a.readyState>=2&&r.onHeadersReceived&&(r.onHeadersReceived(),delete r.onHeadersReceived),a.readyState!==4||!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],a.status===0&&this.isHttp){r.onError(a.status);return}const i=a.status||LB;if(!(i===LB&&r.expectedStatus===PB)&&i!==r.expectedStatus){r.onError(a.status);return}const s=AVe(a);if(i===PB){const l=a.getResponseHeader("Content-Range"),u=/bytes (\d+)-(\d+)\/(\d+)/.exec(l);u?r.onDone({begin:parseInt(u[1],10),chunk:s}):(Ft('Missing or invalid "Content-Range" header.'),r.onError(0))}else s?r.onDone({begin:0,chunk:s}):r.onError(a.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){const n=this.pendingRequests[e].xhr;delete this.pendingRequests[e],n.abort()}}class wVe{constructor(e){this._source=e,this._manager=new RVe(e),this._rangeChunkSize=e.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(e){const n=this._rangeRequestReaders.indexOf(e);n>=0&&this._rangeRequestReaders.splice(n,1)}getFullReader(){return pn(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new xVe(this._manager,this._source),this._fullRequestReader}getRangeReader(e,n){const r=new NVe(this._manager,e,n);return r.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(r),r}cancelAllRequests(e){var n;(n=this._fullRequestReader)==null||n.cancel(e);for(const r of this._rangeRequestReaders.slice(0))r.cancel(e)}}class xVe{constructor(e,n){this._manager=e,this._url=n.url,this._fullRequestId=e.request({onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._headersCapability=Promise.withResolvers(),this._disableRange=n.disableRange||!1,this._contentLength=n.length,this._rangeChunkSize=n.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,n=this._manager.getRequestXhr(e);this._manager._responseOrigin=lR(n.responseURL);const r=n.getAllResponseHeaders(),a=new Headers(r?r.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(s=>{const[l,...u]=s.split(": ");return[l,u.join(": ")]}):[]),{allowRangeRequests:i,suggestedLength:o}=Xce({responseHeaders:a,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});i&&(this._isRangeSupported=!0),this._contentLength=o||this._contentLength,this._filename=Qce(a),this._isRangeSupported&&this._manager.abortRequest(e),this._headersCapability.resolve()}_onDone(e){if(e&&(this._requests.length>0?this._requests.shift().resolve({value:e.chunk,done:!1}):this._cachedChunks.push(e.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const n of this._requests)n.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(e){this._storedError=WE(e,this._url),this._headersCapability.reject(this._storedError);for(const n of this._requests)n.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(e){var n;(n=this.onProgress)==null||n.call(this,{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(await this._headersCapability.promise,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 n of this._requests)n.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class NVe{constructor(e,n,r){this._manager=e,this._url=e.url,this._requestId=e.request({begin:n,end:r,onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_onHeadersReceived(){var n;const e=lR((n=this._manager.getRequestXhr(this._requestId))==null?void 0:n.responseURL);e!==this._manager._responseOrigin&&(this._storedError=new Error(`Expected range response-origin "${e}" to match "${this._manager._responseOrigin}".`),this._onError(0))}_close(){var e;(e=this.onClosed)==null||e.call(this,this)}_onDone(e){const n=e.chunk;this._requests.length>0?this._requests.shift().resolve({value:n,done:!1}):this._queuedChunk=n,this._done=!0;for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(e){this._storedError??(this._storedError=WE(e,this._url));for(const n of this._requests)n.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){var n;this.isStreamingSupported||(n=this.onProgress)==null||n.call(this,{loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const n=this._queuedChunk;return this._queuedChunk=null,{value:n,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 n of this._requests)n.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const OVe=/^[a-z][a-z0-9\-+.]+:/i;function IVe(t){if(OVe.test(t))return new URL(t);const e=process.getBuiltinModule("url");return new URL(e.pathToFileURL(t))}class DVe{constructor(e){this.source=e,this.url=IVe(e.url),pn(this.url.protocol==="file:","PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}getFullReader(){return pn(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new kVe(this),this._fullRequestReader}getRangeReader(e,n){if(n<=this._progressiveDataLength)return null;const r=new MVe(this,e,n);return this._rangeRequestReaders.push(r),r}cancelAllRequests(e){var n;(n=this._fullRequestReader)==null||n.cancel(e);for(const r of this._rangeRequestReaders.slice(0))r.cancel(e)}}class kVe{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null;const n=e.source;this._contentLength=n.length,this._loaded=0,this._filename=null,this._disableRange=n.disableRange||!1,this._rangeChunkSize=n.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!n.disableStream,this._isRangeSupported=!n.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers();const r=process.getBuiltinModule("fs");r.promises.lstat(this._url).then(a=>{this._contentLength=a.size,this._setReadableStream(r.createReadStream(this._url)),this._headersCapability.resolve()},a=>{a.code==="ENOENT"&&(a=WE(0,this._url.href)),this._storedError=a,this._headersCapability.reject(a)})}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(){var r;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return e===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,(r=this.onProgress)==null||r.call(this,{loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){if(!this._readableStream){this._error(e);return}this._readableStream.destroy(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",n=>{this._error(n)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new $c("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class MVe{constructor(e,n,r){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const a=e.source;this._isStreamingSupported=!a.disableStream;const i=process.getBuiltinModule("fs");this._setReadableStream(i.createReadStream(this._url,{start:n,end:r-1}))}get isStreamingSupported(){return this._isStreamingSupported}async read(){var r;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return e===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,(r=this.onProgress)==null||r.call(this,{loaded:this._loaded}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){if(!this._readableStream){this._error(e);return}this._readableStream.destroy(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",n=>{this._error(n)}),this._storedError&&this._readableStream.destroy(this._storedError)}}const KE=Symbol("INITIAL_DATA");class tue{constructor(){V(this,$S);V(this,Ro,Object.create(null))}get(e,n=null){if(n){const a=X(this,$S,M7).call(this,e);return a.promise.then(()=>n(a.data)),null}const r=_(this,Ro)[e];if(!r||r.data===KE)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return r.data}has(e){const n=_(this,Ro)[e];return!!n&&n.data!==KE}delete(e){const n=_(this,Ro)[e];return!n||n.data===KE?!1:(delete _(this,Ro)[e],!0)}resolve(e,n=null){const r=X(this,$S,M7).call(this,e);r.data=n,r.resolve()}clear(){var e;for(const n in _(this,Ro)){const{data:r}=_(this,Ro)[n];(e=r==null?void 0:r.bitmap)==null||e.close()}L(this,Ro,Object.create(null))}*[Symbol.iterator](){for(const e in _(this,Ro)){const{data:n}=_(this,Ro)[e];n!==KE&&(yield[e,n])}}}Ro=new WeakMap,$S=new WeakSet,M7=function(e){var n;return(n=_(this,Ro))[e]||(n[e]={...Promise.withResolvers(),data:KE})};const LVe=1e5,nue=30;let XE=(zr=class{constructor({textContentSource:e,container:n,viewport:r}){V(this,mu);V(this,Zd,Promise.withResolvers());V(this,Vi,null);V(this,YS,!1);V(this,VS,!!((Lue=globalThis.FontInspector)!=null&&Lue.enabled));V(this,hm,null);V(this,fu,null);V(this,jS,0);V(this,WS,0);V(this,gm,null);V(this,A_,null);V(this,R_,0);V(this,Jd,0);V(this,w_,Object.create(null));V(this,KS,[]);V(this,x_,null);V(this,_m,[]);V(this,XS,new WeakMap);V(this,QS,null);var l;if(e instanceof ReadableStream)L(this,x_,e);else if(typeof e=="object")L(this,x_,new ReadableStream({start(u){u.enqueue(e),u.close()}}));else throw new Error('No "textContentSource" parameter specified.');L(this,Vi,L(this,A_,n)),L(this,Jd,r.scale*Ks.pixelRatio),L(this,R_,r.rotation),L(this,fu,{div:null,properties:null,ctx:null});const{pageWidth:a,pageHeight:i,pageX:o,pageY:s}=r.rawDims;L(this,QS,[1,0,0,-1,-o,s+i]),L(this,WS,a),L(this,jS,i),X(l=zr,wo,Xme).call(l),xd(n,r),_(this,Zd).promise.finally(()=>{_(zr,O_).delete(this),L(this,fu,null),L(this,w_,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:e,isFirefox:n}=Ra.platform;return jt(this,"fontFamilyMap",new Map([["sans-serif",`${e&&n?"Calibri, ":""}sans-serif`],["monospace",`${e&&n?"Lucida Console, ":""}monospace`]]))}render(){const e=()=>{_(this,gm).read().then(({value:n,done:r})=>{if(r){_(this,Zd).resolve();return}_(this,hm)??L(this,hm,n.lang),Object.assign(_(this,w_),n.styles),X(this,mu,Wme).call(this,n.items),e()},_(this,Zd).reject)};return L(this,gm,_(this,x_).getReader()),_(zr,O_).add(this),e(),_(this,Zd).promise}update({viewport:e,onBefore:n=null}){var i;const r=e.scale*Ks.pixelRatio,a=e.rotation;if(a!==_(this,R_)&&(n==null||n(),L(this,R_,a),xd(_(this,A_),{rotation:a})),r!==_(this,Jd)){n==null||n(),L(this,Jd,r);const o={div:null,properties:null,ctx:X(i=zr,wo,iw).call(i,_(this,hm))};for(const s of _(this,_m))o.properties=_(this,XS).get(s),o.div=s,X(this,mu,L7).call(this,o)}}cancel(){var n;const e=new $c("TextLayer task cancelled.");(n=_(this,gm))==null||n.cancel(e).catch(()=>{}),L(this,gm,null),_(this,Zd).reject(e)}get textDivs(){return _(this,_m)}get textContentItemsStr(){return _(this,KS)}static cleanup(){if(!(_(this,O_).size>0)){_(this,N_).clear();for(const{canvas:e}of _(this,bm).values())e.remove();_(this,bm).clear()}}},Zd=new WeakMap,Vi=new WeakMap,YS=new WeakMap,VS=new WeakMap,hm=new WeakMap,fu=new WeakMap,jS=new WeakMap,WS=new WeakMap,gm=new WeakMap,A_=new WeakMap,R_=new WeakMap,Jd=new WeakMap,w_=new WeakMap,KS=new WeakMap,x_=new WeakMap,_m=new WeakMap,XS=new WeakMap,QS=new WeakMap,N_=new WeakMap,bm=new WeakMap,ZS=new WeakMap,ep=new WeakMap,O_=new WeakMap,mu=new WeakSet,Wme=function(e){var a,i;if(_(this,YS))return;(i=_(this,fu)).ctx??(i.ctx=X(a=zr,wo,iw).call(a,_(this,hm)));const n=_(this,_m),r=_(this,KS);for(const o of e){if(n.length>LVe){Ft("Ignoring additional textDivs for performance reasons."),L(this,YS,!0);return}if(o.str===void 0){if(o.type==="beginMarkedContentProps"||o.type==="beginMarkedContent"){const s=_(this,Vi);L(this,Vi,document.createElement("span")),_(this,Vi).classList.add("markedContent"),o.id&&_(this,Vi).setAttribute("id",`${o.id}`),s.append(_(this,Vi))}else o.type==="endMarkedContent"&&L(this,Vi,_(this,Vi).parentNode);continue}r.push(o.str),X(this,mu,Kme).call(this,o)}},Kme=function(e){var b;const n=document.createElement("span"),r={angle:0,canvasWidth:0,hasText:e.str!=="",hasEOL:e.hasEOL,fontSize:0};_(this,_m).push(n);const a=at.transform(_(this,QS),e.transform);let i=Math.atan2(a[1],a[0]);const o=_(this,w_)[e.fontName];o.vertical&&(i+=Math.PI/2);let s=_(this,VS)&&o.fontSubstitution||o.fontFamily;s=zr.fontFamilyMap.get(s)||s;const l=Math.hypot(a[2],a[3]),u=l*X(b=zr,wo,Qme).call(b,s,o,_(this,hm));let d,f;i===0?(d=a[4],f=a[5]-u):(d=a[4]+u*Math.sin(i),f=a[5]-u*Math.cos(i));const m="calc(var(--total-scale-factor) *",h=n.style;_(this,Vi)===_(this,A_)?(h.left=`${(100*d/_(this,WS)).toFixed(2)}%`,h.top=`${(100*f/_(this,jS)).toFixed(2)}%`):(h.left=`${m}${d.toFixed(2)}px)`,h.top=`${m}${f.toFixed(2)}px)`),h.fontSize=`${m}${(_(zr,ep)*l).toFixed(2)}px)`,h.fontFamily=s,r.fontSize=l,n.setAttribute("role","presentation"),n.textContent=e.str,n.dir=e.dir,_(this,VS)&&(n.dataset.fontName=o.fontSubstitutionLoadedName||e.fontName),i!==0&&(r.angle=i*(180/Math.PI));let E=!1;if(e.str.length>1)E=!0;else if(e.str!==" "&&e.transform[0]!==e.transform[3]){const v=Math.abs(e.transform[0]),y=Math.abs(e.transform[3]);v!==y&&Math.max(v,y)/Math.min(v,y)>1.5&&(E=!0)}if(E&&(r.canvasWidth=o.vertical?e.height:e.width),_(this,XS).set(n,r),_(this,fu).div=n,_(this,fu).properties=r,X(this,mu,L7).call(this,_(this,fu)),r.hasText&&_(this,Vi).append(n),r.hasEOL){const v=document.createElement("br");v.setAttribute("role","presentation"),_(this,Vi).append(v)}},L7=function(e){var s;const{div:n,properties:r,ctx:a}=e,{style:i}=n;let o="";if(_(zr,ep)>1&&(o=`scale(${1/_(zr,ep)})`),r.canvasWidth!==0&&r.hasText){const{fontFamily:l}=i,{canvasWidth:u,fontSize:d}=r;X(s=zr,wo,P7).call(s,a,d*_(this,Jd),l);const{width:f}=a.measureText(n.textContent);f>0&&(o=`scaleX(${u*_(this,Jd)/f}) ${o}`)}r.angle!==0&&(o=`rotate(${r.angle}deg) ${o}`),o.length>0&&(i.transform=o)},wo=new WeakSet,iw=function(e=null){let n=_(this,bm).get(e||(e=""));if(!n){const r=document.createElement("canvas");r.className="hiddenCanvasElement",r.lang=e,document.body.append(r),n=r.getContext("2d",{alpha:!1,willReadFrequently:!0}),_(this,bm).set(e,n),_(this,ZS).set(n,{size:0,family:""})}return n},P7=function(e,n,r){const a=_(this,ZS).get(e);n===a.size&&r===a.family||(e.font=`${n}px ${r}`,a.size=n,a.family=r)},Xme=function(){if(_(this,ep)!==null)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),L(this,ep,e.getBoundingClientRect().height),e.remove()},Qme=function(e,n,r){const a=_(this,N_).get(e);if(a)return a;const i=X(this,wo,iw).call(this,r);i.canvas.width=i.canvas.height=nue,X(this,wo,P7).call(this,i,nue,e);const o=i.measureText(""),s=o.fontBoundingBoxAscent,l=Math.abs(o.fontBoundingBoxDescent);i.canvas.width=i.canvas.height=0;let u=.8;return s?u=s/(s+l):(Ra.platform.isFirefox&&Ft("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),n.ascent?u=n.ascent:n.descent&&(u=1+n.descent)),_(this,N_).set(e,u),u},V(zr,wo),V(zr,N_,new Map),V(zr,bm,new Map),V(zr,ZS,new WeakMap),V(zr,ep,null),V(zr,O_,new Set),zr);const PVe=100;function FB(t={}){typeof t=="string"||t instanceof URL?t={url:t}:(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t});const e=new BB,{docId:n}=e,r=t.url?$Ye(t.url):null,a=t.data?YYe(t.data):null,i=t.httpHeaders||null,o=t.withCredentials===!0,s=t.password??null,l=t.range instanceof UB?t.range:null,u=Number.isInteger(t.rangeChunkSize)&&t.rangeChunkSize>0?t.rangeChunkSize:2**16;let d=t.worker instanceof Mg?t.worker:null;const f=t.verbosity,m=typeof t.docBaseUrl=="string"&&!zE(t.docBaseUrl)?t.docBaseUrl:null,h=JA(t.cMapUrl),E=t.cMapPacked!==!1,b=t.CMapReaderFactory||(Si?ZYe:Dce),v=JA(t.iccUrl),y=JA(t.standardFontDataUrl),C=t.StandardFontDataFactory||(Si?JYe:Lce),T=JA(t.wasmUrl),w=t.WasmFactory||(Si?eVe:Fce),O=t.stopAtErrors!==!0,x=Number.isInteger(t.maxImageSize)&&t.maxImageSize>-1?t.maxImageSize:-1,D=t.isEvalSupported!==!1,M=typeof t.isOffscreenCanvasSupported=="boolean"?t.isOffscreenCanvasSupported:!Si,F=typeof t.isImageDecoderSupported=="boolean"?t.isImageDecoderSupported:!Si&&(Ra.platform.isFirefox||!globalThis.chrome),P=Number.isInteger(t.canvasMaxAreaInBytes)?t.canvasMaxAreaInBytes:-1,q=typeof t.disableFontFace=="boolean"?t.disableFontFace:Si,j=t.fontExtraProperties===!0,Q=t.enableXfa===!0,U=t.ownerDocument||globalThis.document,K=t.disableRange===!0,G=t.disableStream===!0,Y=t.disableAutoFetch===!0,W=t.pdfBug===!0,J=t.CanvasFactory||(Si?QYe:WYe),$=t.FilterFactory||(Si?XYe:KYe),Z=t.enableHWA===!0,te=t.useWasm!==!1,B=l?l.length:t.length??NaN,ae=typeof t.useSystemFonts=="boolean"?t.useSystemFonts:!Si&&!q,se=typeof t.useWorkerFetch=="boolean"?t.useWorkerFetch:!!(b===Dce&&C===Lce&&w===Fce&&h&&y&&T&&qE(h,document.baseURI)&&qE(y,document.baseURI)&&qE(T,document.baseURI)),de=null;AYe(f);const ie={canvasFactory:new J({ownerDocument:U,enableHWA:Z}),filterFactory:new $({docId:n,ownerDocument:U}),cMapReaderFactory:se?null:new b({baseUrl:h,isCompressed:E}),standardFontDataFactory:se?null:new C({baseUrl:y}),wasmFactory:se?null:new w({baseUrl:T})};d||(d=Mg.create({verbosity:f,port:is.workerPort}),e._worker=d);const ce={docId:n,apiVersion:"5.4.296",data:a,password:s,disableAutoFetch:Y,rangeChunkSize:u,length:B,docBaseUrl:m,enableXfa:Q,evaluatorOptions:{maxImageSize:x,disableFontFace:q,ignoreErrors:O,isEvalSupported:D,isOffscreenCanvasSupported:M,isImageDecoderSupported:F,canvasMaxAreaInBytes:P,fontExtraProperties:j,useSystemFonts:ae,useWasm:te,useWorkerFetch:se,cMapUrl:h,iccUrl:v,standardFontDataUrl:y,wasmUrl:T}},me={ownerDocument:U,pdfBug:W,styleElement:de,loadingParams:{disableAutoFetch:Y,enableXfa:Q}};return d.promise.then(function(){if(e.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const be=d.messageHandler.sendWithPromise("GetDocRequest",ce,a?[a.buffer]:null);let Ae;if(l)Ae=new bVe(l,{disableRange:K,disableStream:G});else if(!a){if(!r)throw new Error("getDocument - no `url` parameter provided.");const we=qE(r)?yVe:Si?DVe:wVe;Ae=new we({url:r,length:B,httpHeaders:i,withCredentials:o,rangeChunkSize:u,disableRange:K,disableStream:G})}return be.then(we=>{if(e.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const Te=new VE(n,we,d.port),De=new UVe(Te,e,Ae,me,ie,Z);e._transport=De,Te.send("Ready",null)})}).catch(e._capability.reject),e}const DR=class DR{constructor(){Fe(this,"_capability",Promise.withResolvers());Fe(this,"_transport",null);Fe(this,"_worker",null);Fe(this,"docId",`d${Ca(DR,IR)._++}`);Fe(this,"destroyed",!1);Fe(this,"onPassword",null);Fe(this,"onProgress",null)}get promise(){return this._capability.promise}async destroy(){var e,n,r,a;this.destroyed=!0;try{(e=this._worker)!=null&&e.port&&(this._worker._pendingDestroy=!0),await((n=this._transport)==null?void 0:n.destroy())}catch(i){throw(r=this._worker)!=null&&r.port&&delete this._worker._pendingDestroy,i}this._transport=null,(a=this._worker)==null||a.destroy(),this._worker=null}async getData(){return this._transport.getData()}};IR=new WeakMap,V(DR,IR,0);let BB=DR,UB=(Pue=class{constructor(e,n,r=!1,a=null){V(this,Em,Promise.withResolvers());V(this,JS,[]);V(this,ev,[]);V(this,tv,[]);V(this,nv,[]);this.length=e,this.initialData=n,this.progressiveDone=r,this.contentDispositionFilename=a}addRangeListener(e){_(this,nv).push(e)}addProgressListener(e){_(this,tv).push(e)}addProgressiveReadListener(e){_(this,ev).push(e)}addProgressiveDoneListener(e){_(this,JS).push(e)}onDataRange(e,n){for(const r of _(this,nv))r(e,n)}onDataProgress(e,n){_(this,Em).promise.then(()=>{for(const r of _(this,tv))r(e,n)})}onDataProgressiveRead(e){_(this,Em).promise.then(()=>{for(const n of _(this,ev))n(e)})}onDataProgressiveDone(){_(this,Em).promise.then(()=>{for(const e of _(this,JS))e()})}transportReady(){_(this,Em).resolve()}requestDataRange(e,n){er("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}},Em=new WeakMap,JS=new WeakMap,ev=new WeakMap,tv=new WeakMap,nv=new WeakMap,Pue);class FVe{constructor(e,n){this._pdfInfo=e,this._transport=n}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 jt(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()}getAnnotationsByType(e,n){return this._transport.getAnnotationsByType(e,n)}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:e="display"}={}){const{renderingIntent:n}=this._transport.getRenderingIntent(e);return this._transport.getOptionalContentConfig(n)}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 BVe{constructor(e,n,r,a=!1){V(this,Sm);V(this,hu,!1);this._pageIndex=e,this._pageInfo=n,this._transport=r,this._stats=a?new hce:null,this._pdfBug=a,this.commonObjs=r.commonObjs,this.objs=new tue,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null}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:n=this.rotate,offsetX:r=0,offsetY:a=0,dontFlip:i=!1}={}){return new GE({viewBox:this.view,userUnit:this.userUnit,scale:e,rotation:n,offsetX:r,offsetY:a,dontFlip:i})}getAnnotations({intent:e="display"}={}){const{renderingIntent:n}=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,n)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return jt(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var e;return((e=this._transport._htmlForXfa)==null?void 0:e.children[this._pageIndex])||null}render({canvasContext:e,canvas:n=e.canvas,viewport:r,intent:a="display",annotationMode:i=ql.ENABLE,transform:o=null,background:s=null,optionalContentConfigPromise:l=null,annotationCanvasMap:u=null,pageColors:d=null,printAnnotationStorage:f=null,isEditing:m=!1,recordOperations:h=!1,operationsFilter:E=null}){var F,P,q;(F=this._stats)==null||F.time("Overall");const b=this._transport.getRenderingIntent(a,i,f,m),{renderingIntent:v,cacheKey:y}=b;L(this,hu,!1),l||(l=this._transport.getOptionalContentConfig(v));let C=this._intentStates.get(y);C||(C=Object.create(null),this._intentStates.set(y,C)),C.streamReaderCancelTimeout&&(clearTimeout(C.streamReaderCancelTimeout),C.streamReaderCancelTimeout=null);const T=!!(v&Eo.PRINT);C.displayReadyCapability||(C.displayReadyCapability=Promise.withResolvers(),C.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(P=this._stats)==null||P.time("Page Request"),this._pumpOperatorList(b));const w=!!(this._pdfBug&&((q=globalThis.StepperManager)!=null&&q.enabled)),O=!this.recordedBBoxes&&(h||w),x=j=>{var Q,U;if(C.renderTasks.delete(D),O){const K=(Q=D.gfx)==null?void 0:Q.dependencyTracker.take();K&&(D.stepper&&D.stepper.setOperatorBBoxes(K,D.gfx.dependencyTracker.takeDebugMetadata()),h&&(this.recordedBBoxes=K))}T&&L(this,hu,!0),X(this,Sm,Fy).call(this),j?(D.capability.reject(j),this._abortOperatorList({intentState:C,reason:j instanceof Error?j:new Error(j)})):D.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(U=globalThis.Stats)!=null&&U.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},D=new GB({callback:x,params:{canvas:n,canvasContext:e,dependencyTracker:O?new nVe(n,C.operatorList.length,w):null,viewport:r,transform:o,background:s},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:u,operatorList:C.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!T,pdfBug:this._pdfBug,pageColors:d,enableHWA:this._transport.enableHWA,operationsFilter:E});(C.renderTasks||(C.renderTasks=new Set)).add(D);const M=D.task;return Promise.all([C.displayReadyCapability.promise,l]).then(([j,Q])=>{var U;if(this.destroyed){x();return}if((U=this._stats)==null||U.time("Rendering"),!(Q.renderingIntent&v))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");D.initializeGraphics({transparency:j,optionalContentConfig:Q}),D.operatorListChanged()}).catch(x),M}getOperatorList({intent:e="display",annotationMode:n=ql.ENABLE,printAnnotationStorage:r=null,isEditing:a=!1}={}){var u;function i(){s.operatorList.lastChunk&&(s.opListReadCapability.resolve(s.operatorList),s.renderTasks.delete(l))}const o=this._transport.getRenderingIntent(e,n,r,a,!0);let s=this._intentStates.get(o.cacheKey);s||(s=Object.create(null),this._intentStates.set(o.cacheKey,s));let l;return s.opListReadCapability||(l=Object.create(null),l.operatorListChanged=i,s.opListReadCapability=Promise.withResolvers(),(s.renderTasks||(s.renderTasks=new Set)).add(l),s.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(u=this._stats)==null||u.time("Page Request"),this._pumpOperatorList(o)),s.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:n=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:e===!0,disableNormalization:n===!0},{highWaterMark:100,size(a){return a.items.length}})}getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then(r=>UE.textContent(r));const n=this.streamTextContent(e);return new Promise(function(r,a){function i(){o.read().then(function({value:l,done:u}){if(u){r(s);return}s.lang??(s.lang=l.lang),Object.assign(s.styles,l.styles),s.items.push(...l.items),i()},a)}const o=n.getReader(),s={items:[],styles:Object.create(null),lang:null};i()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const e=[];for(const n of this._intentStates.values())if(this._abortOperatorList({intentState:n,reason:new Error("Page was destroyed."),force:!0}),!n.opListReadCapability)for(const r of n.renderTasks)e.push(r.completed),r.cancel();return this.objs.clear(),L(this,hu,!1),Promise.all(e)}cleanup(e=!1){L(this,hu,!0);const n=X(this,Sm,Fy).call(this);return e&&n&&this._stats&&(this._stats=new hce),n}_startRenderPage(e,n){var a,i;const r=this._intentStates.get(n);r&&((a=this._stats)==null||a.timeEnd("Page Request"),(i=r.displayReadyCapability)==null||i.resolve(e))}_renderPageChunk(e,n){for(let r=0,a=e.length;r<a;r++)n.operatorList.fnArray.push(e.fnArray[r]),n.operatorList.argsArray.push(e.argsArray[r]);n.operatorList.lastChunk=e.lastChunk,n.operatorList.separateAnnots=e.separateAnnots;for(const r of n.renderTasks)r.operatorListChanged();e.lastChunk&&X(this,Sm,Fy).call(this)}_pumpOperatorList({renderingIntent:e,cacheKey:n,annotationStorageSerializable:r,modifiedIds:a}){const{map:i,transfer:o}=r,l=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:n,annotationStorage:i,modifiedIds:a},o).getReader(),u=this._intentStates.get(n);u.streamReader=l;const d=()=>{l.read().then(({value:f,done:m})=>{if(m){u.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(f,u),d())},f=>{if(u.streamReader=null,!this._transport.destroyed){if(u.operatorList){u.operatorList.lastChunk=!0;for(const m of u.renderTasks)m.operatorListChanged();X(this,Sm,Fy).call(this)}if(u.displayReadyCapability)u.displayReadyCapability.reject(f);else if(u.opListReadCapability)u.opListReadCapability.reject(f);else throw f}})};d()}_abortOperatorList({intentState:e,reason:n,force:r=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!r){if(e.renderTasks.size>0)return;if(n instanceof WA){let a=PVe;n.extraDelay>0&&n.extraDelay<1e3&&(a+=n.extraDelay),e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:n,force:!0})},a);return}}if(e.streamReader.cancel(new $c(n.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(const[a,i]of this._intentStates)if(i===e){this._intentStates.delete(a);break}this.cleanup()}}}get stats(){return this._stats}}hu=new WeakMap,Sm=new WeakSet,Fy=function(){if(!_(this,hu)||this.destroyed)return!1;for(const{renderTasks:e,operatorList:n}of this._intentStates.values())if(e.size>0||!n.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),L(this,hu,!1),!0};const vr=class vr{constructor({name:e=null,port:n=null,verbosity:r=RYe()}={}){V(this,yi);V(this,tp,Promise.withResolvers());V(this,rl,null);V(this,gu,null);V(this,vm,null);if(this.name=e,this.destroyed=!1,this.verbosity=r,n){if(_(vr,Tm).has(n))throw new Error("Cannot use more than one PDFWorker per port.");_(vr,Tm).set(n,this),X(this,yi,Zme).call(this,n)}else X(this,yi,Jme).call(this)}get promise(){return _(this,tp).promise}get port(){return _(this,gu)}get messageHandler(){return _(this,rl)}destroy(){var e,n;this.destroyed=!0,(e=_(this,vm))==null||e.terminate(),L(this,vm,null),_(vr,Tm).delete(_(this,gu)),L(this,gu,null),(n=_(this,rl))==null||n.destroy(),L(this,rl,null)}static create(e){const n=_(this,Tm).get(e==null?void 0:e.port);if(n){if(n._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return n}return new vr(e)}static get workerSrc(){if(is.workerSrc)return is.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return jt(this,"_setupFakeWorkerGlobal",(async()=>_(this,I_,sw)?_(this,I_,sw):(await import(this.workerSrc)).WorkerMessageHandler)())}};tp=new WeakMap,rl=new WeakMap,gu=new WeakMap,vm=new WeakMap,kR=new WeakMap,ym=new WeakMap,Tm=new WeakMap,yi=new WeakSet,ow=function(){_(this,tp).resolve(),_(this,rl).send("configure",{verbosity:this.verbosity})},Zme=function(e){L(this,gu,e),L(this,rl,new VE("main","worker",e)),_(this,rl).on("ready",()=>{}),X(this,yi,ow).call(this)},Jme=function(){if(_(vr,ym)||_(vr,I_,sw)){X(this,yi,By).call(this);return}let{workerSrc:e}=vr;try{vr._isSameOrigin(window.location,e)||(e=vr._createCDNWrapper(new URL(e,window.location).href));const n=new Worker(e,{type:"module"}),r=new VE("main","worker",n),a=()=>{i.abort(),r.destroy(),n.terminate(),this.destroyed?_(this,tp).reject(new Error("Worker was destroyed")):X(this,yi,By).call(this)},i=new AbortController;n.addEventListener("error",()=>{_(this,vm)||a()},{signal:i.signal}),r.on("test",s=>{if(i.abort(),this.destroyed||!s){a();return}L(this,rl,r),L(this,gu,n),L(this,vm,n),X(this,yi,ow).call(this)}),r.on("ready",s=>{if(i.abort(),this.destroyed){a();return}try{o()}catch{X(this,yi,By).call(this)}});const o=()=>{const s=new Uint8Array;r.send("test",s,[s.buffer])};o();return}catch{VA("The worker has been disabled.")}X(this,yi,By).call(this)},By=function(){_(vr,ym)||(Ft("Setting up fake worker."),L(vr,ym,!0)),vr._setupFakeWorkerGlobal.then(e=>{if(this.destroyed){_(this,tp).reject(new Error("Worker was destroyed"));return}const n=new jYe;L(this,gu,n);const r=`fake${Ca(vr,kR)._++}`,a=new VE(r+"_worker",r,n);e.setup(a,n),L(this,rl,new VE(r,r+"_worker",n)),X(this,yi,ow).call(this)}).catch(e=>{_(this,tp).reject(new Error(`Setting up fake worker failed: "${e.message}".`))})},I_=new WeakSet,sw=function(){var e;try{return((e=globalThis.pdfjsWorker)==null?void 0:e.WorkerMessageHandler)||null}catch{return null}},V(vr,I_),V(vr,kR,0),V(vr,ym,!1),V(vr,Tm,new WeakMap),Si&&(L(vr,ym,!0),is.workerSrc||(is.workerSrc="./pdf.worker.mjs")),vr._isSameOrigin=(e,n)=>{const r=URL.parse(e);if(!(r!=null&&r.origin)||r.origin==="null")return!1;const a=new URL(n,r);return r.origin===a.origin},vr._createCDNWrapper=e=>{const n=`await import("${e}");`;return URL.createObjectURL(new Blob([n],{type:"text/javascript"}))},vr.fromPort=e=>{if(LYe("`PDFWorker.fromPort` - please use `PDFWorker.create` instead."),!(e!=null&&e.port))throw new Error("PDFWorker.fromPort - invalid method signature.");return vr.create(e)};let Mg=vr;class UVe{constructor(e,n,r,a,i,o){V(this,Cm);V(this,_u,new Map);V(this,ic,new Map);V(this,D_,new Map);V(this,k_,new Map);V(this,bu,null);this.messageHandler=e,this.loadingTask=n,this.commonObjs=new tue,this.fontLoader=new qYe({ownerDocument:a.ownerDocument,styleElement:a.styleElement}),this.loadingParams=a.loadingParams,this._params=a,this.canvasFactory=i.canvasFactory,this.filterFactory=i.filterFactory,this.cMapReaderFactory=i.cMapReaderFactory,this.standardFontDataFactory=i.standardFontDataFactory,this.wasmFactory=i.wasmFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=r,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.enableHWA=o,this.setupMessageHandler()}get annotationStorage(){return jt(this,"annotationStorage",new AB)}getRenderingIntent(e,n=ql.ENABLE,r=null,a=!1,i=!1){let o=Eo.DISPLAY,s=CB;switch(e){case"any":o=Eo.ANY;break;case"display":break;case"print":o=Eo.PRINT;break;default:Ft(`getRenderingIntent - invalid intent: ${e}`)}const l=o&Eo.PRINT&&r instanceof wce?r:this.annotationStorage;switch(n){case ql.DISABLE:o+=Eo.ANNOTATIONS_DISABLE;break;case ql.ENABLE:break;case ql.ENABLE_FORMS:o+=Eo.ANNOTATIONS_FORMS;break;case ql.ENABLE_STORAGE:o+=Eo.ANNOTATIONS_STORAGE,s=l.serializable;break;default:Ft(`getRenderingIntent - invalid annotationMode: ${n}`)}a&&(o+=Eo.IS_EDITING),i&&(o+=Eo.OPLIST);const{ids:u,hash:d}=l.modifiedIds,f=[o,s.hash,d];return{renderingIntent:o,cacheKey:f.join("_"),annotationStorageSerializable:s,modifiedIds:u}}destroy(){var r;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(r=_(this,bu))==null||r.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const a of _(this,ic).values())e.push(a._destroy());_(this,ic).clear(),_(this,D_).clear(),_(this,k_).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const n=this.messageHandler.sendWithPromise("Terminate",null);return e.push(n),Promise.all(e).then(()=>{var a,i;this.commonObjs.clear(),this.fontLoader.clear(),_(this,_u).clear(),this.filterFactory.destroy(),XE.cleanup(),(a=this._networkStream)==null||a.cancelAllRequests(new $c("Worker was terminated.")),(i=this.messageHandler)==null||i.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:n}=this;e.on("GetReader",(r,a)=>{pn(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=i=>{this._lastProgress={loaded:i.loaded,total:i.total}},a.onPull=()=>{this._fullReader.read().then(function({value:i,done:o}){if(o){a.close();return}pn(i instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),a.enqueue(new Uint8Array(i),1,[i])}).catch(i=>{a.error(i)})},a.onCancel=i=>{this._fullReader.cancel(i),a.ready.catch(o=>{if(!this.destroyed)throw o})}}),e.on("ReaderHeadersReady",async r=>{var s;await this._fullReader.headersReady;const{isStreamingSupported:a,isRangeSupported:i,contentLength:o}=this._fullReader;return(!a||!i)&&(this._lastProgress&&((s=n.onProgress)==null||s.call(n,this._lastProgress)),this._fullReader.onProgress=l=>{var u;(u=n.onProgress)==null||u.call(n,{loaded:l.loaded,total:l.total})}),{isStreamingSupported:a,isRangeSupported:i,contentLength:o}}),e.on("GetRangeReader",(r,a)=>{pn(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const i=this._networkStream.getRangeReader(r.begin,r.end);if(!i){a.close();return}a.onPull=()=>{i.read().then(function({value:o,done:s}){if(s){a.close();return}pn(o instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),a.enqueue(new Uint8Array(o),1,[o])}).catch(o=>{a.error(o)})},a.onCancel=o=>{i.cancel(o),a.ready.catch(s=>{if(!this.destroyed)throw s})}}),e.on("GetDoc",({pdfInfo:r})=>{this._numPages=r.numPages,this._htmlForXfa=r.htmlForXfa,delete r.htmlForXfa,n._capability.resolve(new FVe(r,this))}),e.on("DocException",r=>{n._capability.reject(Gi(r))}),e.on("PasswordRequest",r=>{L(this,bu,Promise.withResolvers());try{if(!n.onPassword)throw Gi(r);const a=i=>{i instanceof Error?_(this,bu).reject(i):_(this,bu).resolve({password:i})};n.onPassword(a,r.code)}catch(a){_(this,bu).reject(a)}return _(this,bu).promise}),e.on("DataLoaded",r=>{var a;(a=n.onProgress)==null||a.call(n,{loaded:r.length,total:r.length}),this.downloadInfoCapability.resolve(r)}),e.on("StartRenderPage",r=>{if(this.destroyed)return;_(this,ic).get(r.pageIndex)._startRenderPage(r.transparency,r.cacheKey)}),e.on("commonobj",([r,a,i])=>{var o;if(this.destroyed||this.commonObjs.has(r))return null;switch(a){case"Font":if("error"in i){const f=i.error;Ft(`Error during font loading: ${f}`),this.commonObjs.resolve(r,f);break}const s=new MB(i),l=this._params.pdfBug&&((o=globalThis.FontInspector)!=null&&o.enabled)?(f,m)=>globalThis.FontInspector.fontAdded(f,m):null,u=new HYe(s,l,i.extra,i.charProcOperatorList);this.fontLoader.bind(u).catch(()=>e.sendWithPromise("FontFallback",{id:r})).finally(()=>{!u.fontExtraProperties&&u.data&&u.clearData(),this.commonObjs.resolve(r,u)});break;case"CopyLocalImage":const{imageRef:d}=i;pn(d,"The imageRef must be defined.");for(const f of _(this,ic).values())for(const[,m]of f.objs)if((m==null?void 0:m.ref)===d)return m.dataLen?(this.commonObjs.resolve(r,structuredClone(m)),m.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(r,i);break;default:throw new Error(`Got unknown common object type ${a}`)}return null}),e.on("obj",([r,a,i,o])=>{var l;if(this.destroyed)return;const s=_(this,ic).get(a);if(!s.objs.has(r)){if(s._intentStates.size===0){(l=o==null?void 0:o.bitmap)==null||l.close();return}switch(i){case"Image":case"Pattern":s.objs.resolve(r,o);break;default:throw new Error(`Got unknown object type ${i}`)}}}),e.on("DocProgress",r=>{var a;this.destroyed||(a=n.onProgress)==null||a.call(n,{loaded:r.loaded,total:r.total})}),e.on("FetchBinaryData",async r=>{if(this.destroyed)throw new Error("Worker was destroyed.");const a=this[r.type];if(!a)throw new Error(`${r.type} not initialized, see the \`useWorkerFetch\` parameter.`);return a.fetch(r)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var r;this.annotationStorage.size<=0&&Ft("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:e,transfer:n}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:((r=this._fullReader)==null?void 0:r.filename)??null},n).finally(()=>{this.annotationStorage.resetModified()})}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(new Error("Invalid page request."));const n=e-1,r=_(this,D_).get(n);if(r)return r;const a=this.messageHandler.sendWithPromise("GetPage",{pageIndex:n}).then(i=>{if(this.destroyed)throw new Error("Transport destroyed");i.refStr&&_(this,k_).set(i.refStr,e);const o=new BVe(n,i,this,this._params.pdfBug);return _(this,ic).set(n,o),o});return _(this,D_).set(n,a),a}getPageIndex(e){return RB(e)?this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(e,n){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:n})}getFieldObjects(){return X(this,Cm,Uy).call(this,"GetFieldObjects")}hasJSActions(){return X(this,Cm,Uy).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(e){return typeof e!="string"?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)}getAnnotationsByType(e,n){return this.messageHandler.sendWithPromise("GetAnnotationsByType",{types:e,pageIndexesToSkip:n})}getDocJSActions(){return X(this,Cm,Uy).call(this,"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 X(this,Cm,Uy).call(this,"GetOptionalContentConfig").then(n=>new _Ve(n,e))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const e="GetMetadata",n=_(this,_u).get(e);if(n)return n;const r=this.messageHandler.sendWithPromise(e,null).then(a=>{var i,o;return{info:a[0],metadata:a[1]?new hVe(a[1]):null,contentDispositionFilename:((i=this._fullReader)==null?void 0:i.filename)??null,contentLength:((o=this._fullReader)==null?void 0:o.contentLength)??null}});return _(this,_u).set(e,r),r}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const n of _(this,ic).values())if(!n.cleanup())throw new Error(`startCleanup: Page ${n.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),_(this,_u).clear(),this.filterFactory.destroy(!0),XE.cleanup()}}cachedPageNumber(e){if(!RB(e))return null;const n=e.gen===0?`${e.num}R`:`${e.num}R${e.gen}`;return _(this,k_).get(n)??null}}_u=new WeakMap,ic=new WeakMap,D_=new WeakMap,k_=new WeakMap,bu=new WeakMap,Cm=new WeakSet,Uy=function(e,n=null){const r=_(this,_u).get(e);if(r)return r;const a=this.messageHandler.sendWithPromise(e,n);return _(this,_u).set(e,a),a};class GVe{constructor(e){V(this,np,null);Fe(this,"onContinue",null);Fe(this,"onError",null);L(this,np,e)}get promise(){return _(this,np).capability.promise}cancel(e=0){_(this,np).cancel(null,e)}get separateAnnots(){const{separateAnnots:e}=_(this,np).operatorList;if(!e)return!1;const{annotationCanvasMap:n}=_(this,np);return e.form||e.canvas&&(n==null?void 0:n.size)>0}}np=new WeakMap;const Rm=class Rm{constructor({callback:e,params:n,objs:r,commonObjs:a,annotationCanvasMap:i,operatorList:o,pageIndex:s,canvasFactory:l,filterFactory:u,useRequestAnimationFrame:d=!1,pdfBug:f=!1,pageColors:m=null,enableHWA:h=!1,operationsFilter:E=null}){V(this,rp,null);this.callback=e,this.params=n,this.objs=r,this.commonObjs=a,this.annotationCanvasMap=i,this.operatorListIdx=null,this.operatorList=o,this._pageIndex=s,this.canvasFactory=l,this.filterFactory=u,this._pdfBug=f,this.pageColors=m,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=d===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new GVe(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=n.canvas,this._canvasContext=n.canvas?null:n.canvasContext,this._enableHWA=h,this._dependencyTracker=n.dependencyTracker,this._operationsFilter=E}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:e=!1,optionalContentConfig:n}){var l,u;if(this.cancelled)return;if(this._canvas){if(_(Rm,Am).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.");_(Rm,Am).add(this._canvas)}this._pdfBug&&((l=globalThis.StepperManager)!=null&&l.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{viewport:r,transform:a,background:i,dependencyTracker:o}=this.params,s=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new Dg(s,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:n},this.annotationCanvasMap,this.pageColors,o),this.gfx.beginDrawing({transform:a,viewport:r,transparency:e,background:i}),this.operatorListIdx=0,this.graphicsReady=!0,(u=this.graphicsReadyCallback)==null||u.call(this)}cancel(e=null,n=0){var r,a,i;this.running=!1,this.cancelled=!0,(r=this.gfx)==null||r.endDrawing(),_(this,rp)&&(window.cancelAnimationFrame(_(this,rp)),L(this,rp,null)),_(Rm,Am).delete(this._canvas),e||(e=new WA(`Rendering cancelled, page ${this._pageIndex+1}`,n)),this.callback(e),(i=(a=this.task).onError)==null||i.call(a,e)}operatorListChanged(){var e,n;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}(e=this.gfx.dependencyTracker)==null||e.growOperationsCount(this.operatorList.fnArray.length),(n=this.stepper)==null||n.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?L(this,rp,window.requestAnimationFrame(()=>{L(this,rp,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._operationsFilter),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),_(Rm,Am).delete(this._canvas),this.callback())))}};rp=new WeakMap,Am=new WeakMap,V(Rm,Am,new WeakSet);let GB=Rm;const QE="5.4.296",rue="f56dc8601",ji=class ji{constructor({editor:e=null,uiManager:n=null}){V(this,$n);V(this,xo,null);V(this,wm,null);V(this,M_);V(this,ga,null);V(this,rv,!1);V(this,L_,!1);V(this,Eu,null);V(this,av);V(this,ap,null);V(this,al,null);var r,a;e?(L(this,L_,!1),L(this,Eu,e)):L(this,L_,!0),L(this,al,(e==null?void 0:e._uiManager)||n),L(this,av,_(this,al)._eventBus),L(this,M_,((r=e==null?void 0:e.color)==null?void 0:r.toUpperCase())||((a=_(this,al))==null?void 0:a.highlightColors.values().next().value)||"#FFFF98"),_(ji,iv)||L(ji,iv,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"}))}static get _keyboardManager(){return jt(this,"_keyboardManager",new $E([[["Escape","mac+Escape"],ji.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],ji.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],ji.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],ji.prototype._moveToPrevious],[["Home","mac+Home"],ji.prototype._moveToBeginning],[["End","mac+End"],ji.prototype._moveToEnd]]))}renderButton(){const e=L(this,xo,document.createElement("button"));e.className="colorPicker",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),e.ariaHasPopup="true",_(this,Eu)&&(e.ariaControls=`${_(this,Eu).id}_colorpicker_dropdown`);const n=_(this,al)._signal;e.addEventListener("click",X(this,$n,vh).bind(this),{signal:n}),e.addEventListener("keydown",X(this,$n,U7).bind(this),{signal:n});const r=L(this,wm,document.createElement("span"));return r.className="swatch",r.ariaHidden="true",r.style.backgroundColor=_(this,M_),e.append(r),e}renderMainDropdown(){const e=L(this,ga,X(this,$n,F7).call(this));return e.ariaOrientation="horizontal",e.ariaLabelledBy="highlightColorPickerLabel",e}_colorSelectFromKeyboard(e){if(e.target===_(this,xo)){X(this,$n,vh).call(this,e);return}const n=e.target.getAttribute("data-color");n&&X(this,$n,B7).call(this,n,e)}_moveToNext(e){var n,r;if(!_(this,$n,ef)){X(this,$n,vh).call(this,e);return}if(e.target===_(this,xo)){(n=_(this,ga).firstChild)==null||n.focus();return}(r=e.target.nextSibling)==null||r.focus()}_moveToPrevious(e){var n,r;if(e.target===((n=_(this,ga))==null?void 0:n.firstChild)||e.target===_(this,xo)){_(this,$n,ef)&&this._hideDropdownFromKeyboard();return}_(this,$n,ef)||X(this,$n,vh).call(this,e),(r=e.target.previousSibling)==null||r.focus()}_moveToBeginning(e){var n;if(!_(this,$n,ef)){X(this,$n,vh).call(this,e);return}(n=_(this,ga).firstChild)==null||n.focus()}_moveToEnd(e){var n;if(!_(this,$n,ef)){X(this,$n,vh).call(this,e);return}(n=_(this,ga).lastChild)==null||n.focus()}hideDropdown(){var e,n;(e=_(this,ga))==null||e.classList.add("hidden"),_(this,xo).ariaExpanded="false",(n=_(this,ap))==null||n.abort(),L(this,ap,null)}_hideDropdownFromKeyboard(){var e;if(!_(this,L_)){if(!_(this,$n,ef)){(e=_(this,Eu))==null||e.unselect();return}this.hideDropdown(),_(this,xo).focus({preventScroll:!0,focusVisible:_(this,rv)})}}updateColor(e){if(_(this,wm)&&(_(this,wm).style.backgroundColor=e),!_(this,ga))return;const n=_(this,al).highlightColors.values();for(const r of _(this,ga).children)r.ariaSelected=n.next().value===e.toUpperCase()}destroy(){var e,n;(e=_(this,xo))==null||e.remove(),L(this,xo,null),L(this,wm,null),(n=_(this,ga))==null||n.remove(),L(this,ga,null)}};xo=new WeakMap,wm=new WeakMap,M_=new WeakMap,ga=new WeakMap,rv=new WeakMap,L_=new WeakMap,Eu=new WeakMap,av=new WeakMap,ap=new WeakMap,al=new WeakMap,iv=new WeakMap,$n=new WeakSet,F7=function(){const e=document.createElement("div"),n=_(this,al)._signal;e.addEventListener("contextmenu",So,{signal:n}),e.className="dropdown",e.role="listbox",e.ariaMultiSelectable="false",e.ariaOrientation="vertical",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),_(this,Eu)&&(e.id=`${_(this,Eu).id}_colorpicker_dropdown`);for(const[r,a]of _(this,al).highlightColors){const i=document.createElement("button");i.tabIndex="0",i.role="option",i.setAttribute("data-color",a),i.title=r,i.setAttribute("data-l10n-id",_(ji,iv)[r]);const o=document.createElement("span");i.append(o),o.className="swatch",o.style.backgroundColor=a,i.ariaSelected=a===_(this,M_),i.addEventListener("click",X(this,$n,B7).bind(this,a),{signal:n}),e.append(i)}return e.addEventListener("keydown",X(this,$n,U7).bind(this),{signal:n}),e},B7=function(e,n){n.stopPropagation(),_(this,av).dispatch("switchannotationeditorparams",{source:this,type:cn.HIGHLIGHT_COLOR,value:e}),this.updateColor(e)},U7=function(e){ji._keyboardManager.exec(this,e)},vh=function(e){if(_(this,$n,ef)){this.hideDropdown();return}if(L(this,rv,e.detail===0),_(this,ap)||(L(this,ap,new AbortController),window.addEventListener("pointerdown",X(this,$n,ehe).bind(this),{signal:_(this,al).combinedSignal(_(this,ap))})),_(this,xo).ariaExpanded="true",_(this,ga)){_(this,ga).classList.remove("hidden");return}const n=L(this,ga,X(this,$n,F7).call(this));_(this,xo).append(n)},ehe=function(e){var n;(n=_(this,ga))!=null&&n.contains(e.target)||this.hideDropdown()},ef=function(){return _(this,ga)&&!_(this,ga).classList.contains("hidden")},V(ji,iv,null);let ZE=ji;const xm=class xm{constructor(e){V(this,oc,null);V(this,ov,null);V(this,P_,null);L(this,ov,e),L(this,P_,e._uiManager),_(xm,sv)||L(xm,sv,Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"}))}renderButton(){if(_(this,oc))return _(this,oc);const{editorType:e,colorType:n,colorValue:r}=_(this,ov),a=L(this,oc,document.createElement("input"));return a.type="color",a.value=r||"#000000",a.className="basicColorPicker",a.tabIndex=0,a.setAttribute("data-l10n-id",_(xm,sv)[e]),a.addEventListener("input",()=>{_(this,P_).updateParams(n,a.value)},{signal:_(this,P_)._signal}),a}update(e){_(this,oc)&&(_(this,oc).value=e)}destroy(){var e;(e=_(this,oc))==null||e.remove(),L(this,oc,null)}hideDropdown(){}};oc=new WeakMap,ov=new WeakMap,P_=new WeakMap,sv=new WeakMap,V(xm,sv,null);let cR=xm;function aue(t){return Math.floor(Math.max(0,Math.min(1,t))*255).toString(16).padStart(2,"0")}function JE(t){return Math.max(0,Math.min(255,255*t))}class iue{static CMYK_G([e,n,r,a]){return["G",1-Math.min(1,.3*e+.59*r+.11*n+a)]}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=JE(e),[e,e,e]}static G_HTML([e]){const n=aue(e);return`#${n}${n}${n}`}static RGB_G([e,n,r]){return["G",.3*e+.59*n+.11*r]}static RGB_rgb(e){return e.map(JE)}static RGB_HTML(e){return`#${e.map(aue).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([e,n,r,a]){return["RGB",1-Math.min(1,e+a),1-Math.min(1,r+a),1-Math.min(1,n+a)]}static CMYK_rgb([e,n,r,a]){return[JE(1-Math.min(1,e+a)),JE(1-Math.min(1,r+a)),JE(1-Math.min(1,n+a))]}static CMYK_HTML(e){const n=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(n)}static RGB_CMYK([e,n,r]){const a=1-e,i=1-n,o=1-r,s=Math.min(a,i,o);return["CMYK",a,i,o,s]}}class zVe{create(e,n,r=!1){if(e<=0||n<=0)throw new Error("Invalid SVG dimensions");const a=this._createSVG("svg:svg");return a.setAttribute("version","1.1"),r||(a.setAttribute("width",`${e}px`),a.setAttribute("height",`${n}px`)),a.setAttribute("preserveAspectRatio","none"),a.setAttribute("viewBox",`0 0 ${e} ${n}`),a}createElement(e){if(typeof e!="string")throw new Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){er("Abstract method `_createSVG` called.")}}class eS extends zVe{_createSVG(e){return document.createElementNS(Yc,e)}}const qVe=9,Lf=new WeakSet,HVe=new Date().getTimezoneOffset()*60*1e3;class oue{static create(e){switch(e.data.annotationType){case Xr.LINK:return new zB(e);case Xr.TEXT:return new YVe(e);case Xr.WIDGET:switch(e.data.fieldType){case"Tx":return new VVe(e);case"Btn":return e.data.radioButton?new sue(e):e.data.checkBox?new WVe(e):new KVe(e);case"Ch":return new XVe(e);case"Sig":return new jVe(e)}return new Pf(e);case Xr.POPUP:return new qB(e);case Xr.FREETEXT:return new lue(e);case Xr.LINE:return new ZVe(e);case Xr.SQUARE:return new JVe(e);case Xr.CIRCLE:return new eje(e);case Xr.POLYLINE:return new cue(e);case Xr.CARET:return new nje(e);case Xr.INK:return new HB(e);case Xr.POLYGON:return new tje(e);case Xr.HIGHLIGHT:return new uue(e);case Xr.UNDERLINE:return new rje(e);case Xr.SQUIGGLY:return new aje(e);case Xr.STRIKEOUT:return new ije(e);case Xr.STAMP:return new due(e);case Xr.FILEATTACHMENT:return new oje(e);default:return new Dr(e)}}}const c6=class c6{constructor(e,{isRenderable:n=!1,ignoreBorder:r=!1,createQuadrilaterals:a=!1}={}){V(this,lv);V(this,Nm,null);V(this,F_,!1);V(this,hs,null);this.isRenderable=n,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.enableComment=e.enableComment,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,n&&(this.container=this._createContainer(r)),a&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:e,richText:n}){return!!(e!=null&&e.str||n!=null&&n.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return c6._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){var r;const{data:e}=this,n=(r=this.annotationStorage)==null?void 0:r.getEditor(e.id);return n?n.getData():e}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}get commentButtonPosition(){var s;const e=(s=this.annotationStorage)==null?void 0:s.getEditor(this.data.id);if(e)return e.commentButtonPositionInPage;const{quadPoints:n,inkLists:r,rect:a}=this.data;let i=-1/0,o=-1/0;if((n==null?void 0:n.length)>=8){for(let l=0;l<n.length;l+=8)n[l+1]>o?(o=n[l+1],i=n[l+2]):n[l+1]===o&&(i=Math.max(i,n[l+2]));return[i,o]}if((r==null?void 0:r.length)>=1){for(const l of r)for(let u=0,d=l.length;u<d;u+=2)l[u+1]>o?(o=l[u+1],i=l[u]):l[u+1]===o&&(i=Math.max(i,l[u]));if(i!==1/0)return[i,o]}return a?[a[2],a[3]]:null}_normalizePoint(e){const{page:{view:n},viewport:{rawDims:{pageWidth:r,pageHeight:a,pageX:i,pageY:o}}}=this.parent;return e[1]=n[3]-e[1]+n[1],e[0]=100*(e[0]-i)/r,e[1]=100*(e[1]-o)/a,e}get commentText(){var n,r,a;const{data:e}=this;return((r=(n=this.annotationStorage.getRawValue(`${ME}${e.id}`))==null?void 0:n.popup)==null?void 0:r.contents)||((a=e.contentsObj)==null?void 0:a.str)||""}set commentText(e){const{data:n}=this,r={deleted:!e,contents:e||""};this.annotationStorage.updateEditor(n.id,{popup:r})||this.annotationStorage.setValue(`${ME}${n.id}`,{id:n.id,annotationType:n.annotationType,pageIndex:this.parent.page._pageIndex,popup:r,popupRef:n.popupRef,modificationDate:new Date}),e||this.removePopup()}removePopup(){var e,n;(n=((e=_(this,hs))==null?void 0:e.popup)||this.popup)==null||n.remove(),L(this,hs,this.popup=null)}updateEdited(e){var i;if(!this.container)return;e.rect&&(_(this,Nm)||L(this,Nm,{rect:this.data.rect.slice(0)}));const{rect:n,popup:r}=e;n&&X(this,lv,G7).call(this,n);let a=((i=_(this,hs))==null?void 0:i.popup)||this.popup;!a&&(r!=null&&r.text)&&(this._createPopup(r),a=_(this,hs).popup),a&&(a.updateEdited(e),r!=null&&r.deleted&&(a.remove(),L(this,hs,null),this.popup=null))}resetEdited(){var e;_(this,Nm)&&(X(this,lv,G7).call(this,_(this,Nm).rect),(e=_(this,hs))==null||e.popup.resetEdited(),L(this,Nm,null))}_createContainer(e){const{data:n,parent:{page:r,viewport:a}}=this,i=document.createElement("section");i.setAttribute("data-annotation-id",n.id),!(this instanceof Pf)&&!(this instanceof zB)&&(i.tabIndex=0);const{style:o}=i;if(o.zIndex=this.parent.zIndex,this.parent.zIndex+=2,n.alternativeText&&(i.title=n.alternativeText),n.noRotate&&i.classList.add("norotate"),!n.rect||this instanceof qB){const{rotation:b}=n;return!n.hasOwnCanvas&&b!==0&&this.setRotation(b,i),i}const{width:s,height:l}=this;if(!e&&n.borderStyle.width>0){o.borderWidth=`${n.borderStyle.width}px`;const b=n.borderStyle.horizontalCornerRadius,v=n.borderStyle.verticalCornerRadius;if(b>0||v>0){const C=`calc(${b}px * var(--total-scale-factor)) / calc(${v}px * var(--total-scale-factor))`;o.borderRadius=C}else if(this instanceof sue){const C=`calc(${s}px * var(--total-scale-factor)) / calc(${l}px * var(--total-scale-factor))`;o.borderRadius=C}switch(n.borderStyle.style){case Rg.SOLID:o.borderStyle="solid";break;case Rg.DASHED:o.borderStyle="dashed";break;case Rg.BEVELED:Ft("Unimplemented border style: beveled");break;case Rg.INSET:Ft("Unimplemented border style: inset");break;case Rg.UNDERLINE:o.borderBottomStyle="solid";break}const y=n.borderColor||null;y?(L(this,F_,!0),o.borderColor=at.makeHexColor(y[0]|0,y[1]|0,y[2]|0)):o.borderWidth=0}const u=at.normalizeRect([n.rect[0],r.view[3]-n.rect[1]+r.view[1],n.rect[2],r.view[3]-n.rect[3]+r.view[1]]),{pageWidth:d,pageHeight:f,pageX:m,pageY:h}=a.rawDims;o.left=`${100*(u[0]-m)/d}%`,o.top=`${100*(u[1]-h)/f}%`;const{rotation:E}=n;return n.hasOwnCanvas||E===0?(o.width=`${100*s/d}%`,o.height=`${100*l/f}%`):this.setRotation(E,i),i}setRotation(e,n=this.container){if(!this.data.rect)return;const{pageWidth:r,pageHeight:a}=this.parent.viewport.rawDims;let{width:i,height:o}=this;e%180!==0&&([i,o]=[o,i]),n.style.width=`${100*i/r}%`,n.style.height=`${100*o/a}%`,n.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const e=(n,r,a)=>{const i=a.detail[n],o=i[0],s=i.slice(1);a.target.style[r]=iue[`${o}_HTML`](s),this.annotationStorage.setValue(this.data.id,{[r]:iue[`${o}_rgb`](s)})};return jt(this,"_commonActions",{display:n=>{const{display:r}=n.detail,a=r%2===1;this.container.style.visibility=a?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:a,noPrint:r===1||r===2})},print:n=>{this.annotationStorage.setValue(this.data.id,{noPrint:!n.detail.print})},hidden:n=>{const{hidden:r}=n.detail;this.container.style.visibility=r?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:r,noView:r})},focus:n=>{setTimeout(()=>n.target.focus({preventScroll:!1}),0)},userName:n=>{n.target.title=n.detail.userName},readonly:n=>{n.target.disabled=n.detail.readonly},required:n=>{this._setRequired(n.target,n.detail.required)},bgColor:n=>{e("bgColor","backgroundColor",n)},fillColor:n=>{e("fillColor","backgroundColor",n)},fgColor:n=>{e("fgColor","color",n)},textColor:n=>{e("textColor","color",n)},borderColor:n=>{e("borderColor","borderColor",n)},strokeColor:n=>{e("strokeColor","borderColor",n)},rotation:n=>{const r=n.detail.rotation;this.setRotation(r),this.annotationStorage.setValue(this.data.id,{rotation:r})}})}_dispatchEventFromSandbox(e,n){const r=this._commonActions;for(const a of Object.keys(n.detail)){const i=e[a]||r[a];i==null||i(n)}}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;const n=this.annotationStorage.getRawValue(this.data.id);if(!n)return;const r=this._commonActions;for(const[a,i]of Object.entries(n)){const o=r[a];if(o){const s={detail:{[a]:i},target:e};o(s),delete n[a]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:e}=this.data;if(!e)return;const[n,r,a,i]=this.data.rect.map(b=>Math.fround(b));if(e.length===8){const[b,v,y,C]=e.subarray(2,6);if(a===b&&i===v&&n===y&&r===C)return}const{style:o}=this.container;let s;if(_(this,F_)){const{borderColor:b,borderWidth:v}=o;o.borderWidth=0,s=["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="${b}" stroke-width="${v}">`],this.container.classList.add("hasBorder")}const l=a-n,u=i-r,{svgFactory:d}=this,f=d.createElement("svg");f.classList.add("quadrilateralsContainer"),f.setAttribute("width",0),f.setAttribute("height",0),f.role="none";const m=d.createElement("defs");f.append(m);const h=d.createElement("clipPath"),E=`clippath_${this.data.id}`;h.setAttribute("id",E),h.setAttribute("clipPathUnits","objectBoundingBox"),m.append(h);for(let b=2,v=e.length;b<v;b+=8){const y=e[b],C=e[b+1],T=e[b+2],w=e[b+3],O=d.createElement("rect"),x=(T-n)/l,D=(i-C)/u,M=(y-T)/l,F=(C-w)/u;O.setAttribute("x",x),O.setAttribute("y",D),O.setAttribute("width",M),O.setAttribute("height",F),h.append(O),s==null||s.push(`<rect vector-effect="non-scaling-stroke" x="${x}" y="${D}" width="${M}" height="${F}"/>`)}_(this,F_)&&(s.push("</g></svg>')"),o.backgroundImage=s.join("")),this.container.append(f),this.container.style.clipPath=`url(#${E})`}_createPopup(e=null){const{data:n}=this;let r,a;e?(r={str:e.text},a=e.date):(r=n.contentsObj,a=n.modificationDate);const i=L(this,hs,new qB({data:{color:n.color,titleObj:n.titleObj,modificationDate:a,contentsObj:r,richText:n.richText,parentRect:n.rect,borderStyle:0,id:`popup_${n.id}`,rotation:n.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]}));this.parent._commentManager||this.parent.div.append(i.render())}get hasPopupElement(){return!!(_(this,hs)||this.popup||this.data.popupRef)}get extraPopupElement(){return _(this,hs)}render(){er("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,n=null){const r=[];if(this._fieldObjects){const a=this._fieldObjects[e];if(a)for(const{page:i,id:o,exportValues:s}of a){if(i===-1||o===n)continue;const l=typeof s=="string"?s:null,u=document.querySelector(`[data-element-id="${o}"]`);if(u&&!Lf.has(u)){Ft(`_getElementsByName - element not allowed: ${o}`);continue}r.push({id:o,exportValue:l,domElement:u})}return r}for(const a of document.getElementsByName(e)){const{exportValue:i}=a,o=a.getAttribute("data-element-id");o!==n&&Lf.has(a)&&r.push({id:o,exportValue:i,domElement:a})}return r}show(){var e;this.container&&(this.container.hidden=!1),(e=this.popup)==null||e.maybeShow()}hide(){var e;this.container&&(this.container.hidden=!0),(e=this.popup)==null||e.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(const n of e)n.classList.add("highlightArea");else e.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:e,data:{id:n}}=this;this.container.addEventListener("dblclick",()=>{var r;(r=this.linkService.eventBus)==null||r.dispatch("switchannotationeditormode",{source:this,mode:e,editId:n,mustEnterInEditMode:!0})})}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}};Nm=new WeakMap,F_=new WeakMap,hs=new WeakMap,lv=new WeakSet,G7=function(e){const{container:{style:n},data:{rect:r,rotation:a},parent:{viewport:{rawDims:{pageWidth:i,pageHeight:o,pageX:s,pageY:l}}}}=this;r==null||r.splice(0,4,...e),n.left=`${100*(e[0]-s)/i}%`,n.top=`${100*(o-e[3]+l)/o}%`,a===0?(n.width=`${100*(e[2]-e[0])/i}%`,n.height=`${100*(e[3]-e[1])/o}%`):this.setRotation(a)};let Dr=c6;class $Ve extends Dr{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.editor=e.editor}render(){return this.container.className="editorAnnotation",this.container}createOrUpdatePopup(){const{editor:e}=this;e.hasComment&&(this._createPopup(e.comment),this.extraPopupElement.popup.renderCommentButton())}get hasCommentButton(){return this.enableComment&&this.editor.hasComment}get commentButtonPosition(){return this.editor.commentButtonPositionInPage}get commentText(){return this.editor.comment.text}set commentText(e){this.editor.comment=e,e||this.removePopup()}get commentData(){return this.editor.getData()}remove(){this.container.remove(),this.container=null,this.removePopup()}}class zB extends Dr{constructor(n,r=null){super(n,{isRenderable:!0,ignoreBorder:!!(r!=null&&r.ignoreBorder),createQuadrilaterals:!0});V(this,No);this.isTooltipOnly=n.data.isTooltipOnly}render(){const{data:n,linkService:r}=this,a=document.createElement("a");a.setAttribute("data-element-id",n.id);let i=!1;return n.url?(r.addLinkAttributes(a,n.url,n.newWindow),i=!0):n.action?(this._bindNamedAction(a,n.action,n.overlaidText),i=!0):n.attachment?(X(this,No,the).call(this,a,n.attachment,n.overlaidText,n.attachmentDest),i=!0):n.setOCGState?(X(this,No,nhe).call(this,a,n.setOCGState,n.overlaidText),i=!0):n.dest?(this._bindLink(a,n.dest,n.overlaidText),i=!0):(n.actions&&(n.actions.Action||n.actions["Mouse Up"]||n.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(a,n),i=!0),n.resetForm?(this._bindResetFormAction(a,n.resetForm),i=!0):this.isTooltipOnly&&!i&&(this._bindLink(a,""),i=!0)),this.container.classList.add("linkAnnotation"),i&&this.container.append(a),this.container}_bindLink(n,r,a=""){n.href=this.linkService.getDestinationHash(r),n.onclick=()=>(r&&this.linkService.goToDestination(r),!1),(r||r==="")&&X(this,No,yh).call(this),a&&(n.title=a)}_bindNamedAction(n,r,a=""){n.href=this.linkService.getAnchorUrl(""),n.onclick=()=>(this.linkService.executeNamedAction(r),!1),a&&(n.title=a),X(this,No,yh).call(this)}_bindJSAction(n,r){n.href=this.linkService.getAnchorUrl("");const a=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const i of Object.keys(r.actions)){const o=a.get(i);o&&(n[o]=()=>{var s;return(s=this.linkService.eventBus)==null||s.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r.id,name:i}}),!1})}r.overlaidText&&(n.title=r.overlaidText),n.onclick||(n.onclick=()=>!1),X(this,No,yh).call(this)}_bindResetFormAction(n,r){const a=n.onclick;if(a||(n.href=this.linkService.getAnchorUrl("")),X(this,No,yh).call(this),!this._fieldObjects){Ft('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),a||(n.onclick=()=>!1);return}n.onclick=()=>{var f;a==null||a();const{fields:i,refs:o,include:s}=r,l=[];if(i.length!==0||o.length!==0){const m=new Set(o);for(const h of i){const E=this._fieldObjects[h]||[];for(const{id:b}of E)m.add(b)}for(const h of Object.values(this._fieldObjects))for(const E of h)m.has(E.id)===s&&l.push(E)}else for(const m of Object.values(this._fieldObjects))l.push(...m);const u=this.annotationStorage,d=[];for(const m of l){const{id:h}=m;switch(d.push(h),m.type){case"text":{const b=m.defaultValue||"";u.setValue(h,{value:b});break}case"checkbox":case"radiobutton":{const b=m.defaultValue===m.exportValues;u.setValue(h,{value:b});break}case"combobox":case"listbox":{const b=m.defaultValue||"";u.setValue(h,{value:b});break}default:continue}const E=document.querySelector(`[data-element-id="${h}"]`);if(E){if(!Lf.has(E)){Ft(`_bindResetFormAction - element not allowed: ${h}`);continue}}else continue;E.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((f=this.linkService.eventBus)==null||f.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:d,name:"ResetForm"}})),!1}}}No=new WeakSet,yh=function(){this.container.setAttribute("data-internal-link","")},the=function(n,r,a="",i=null){n.href=this.linkService.getAnchorUrl(""),r.description?n.title=r.description:a&&(n.title=a),n.onclick=()=>{var o;return(o=this.downloadManager)==null||o.openOrDownloadData(r.content,r.filename,i),!1},X(this,No,yh).call(this)},nhe=function(n,r,a=""){n.href=this.linkService.getAnchorUrl(""),n.onclick=()=>(this.linkService.executeSetOCGState(r),!1),a&&(n.title=a),X(this,No,yh).call(this)};class YVe extends Dr{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 Pf extends Dr{render(){return this.container}showElementAndHideCanvas(e){var n;this.data.hasOwnCanvas&&(((n=e.previousSibling)==null?void 0:n.nodeName)==="CANVAS"&&(e.previousSibling.hidden=!0),e.hidden=!1)}_getKeyModifier(e){return Ra.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,n,r,a,i){r.includes("mouse")?e.addEventListener(r,o=>{var s;(s=this.linkService.eventBus)==null||s.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:a,value:i(o),shift:o.shiftKey,modifier:this._getKeyModifier(o)}})}):e.addEventListener(r,o=>{var s;if(r==="blur"){if(!n.focused||!o.relatedTarget)return;n.focused=!1}else if(r==="focus"){if(n.focused)return;n.focused=!0}i&&((s=this.linkService.eventBus)==null||s.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:a,value:i(o)}}))})}_setEventListeners(e,n,r,a){var i,o,s;for(const[l,u]of r)(u==="Action"||(i=this.data.actions)!=null&&i[u])&&((u==="Focus"||u==="Blur")&&(n||(n={focused:!1})),this._setEventListener(e,n,l,u,a),u==="Focus"&&!((o=this.data.actions)!=null&&o.Blur)?this._setEventListener(e,n,"blur","Blur",null):u==="Blur"&&!((s=this.data.actions)!=null&&s.Focus)&&this._setEventListener(e,n,"focus","Focus",null))}_setBackgroundColor(e){const n=this.data.backgroundColor||null;e.style.backgroundColor=n===null?"transparent":at.makeHexColor(n[0],n[1],n[2])}_setTextStyle(e){const n=["left","center","right"],{fontColor:r}=this.data.defaultAppearanceData,a=this.data.defaultAppearanceData.fontSize||qVe,i=e.style;let o;const s=2,l=u=>Math.round(10*u)/10;if(this.data.multiLine){const u=Math.abs(this.data.rect[3]-this.data.rect[1]-s),d=Math.round(u/(uB*a))||1,f=u/d;o=Math.min(a,l(f/uB))}else{const u=Math.abs(this.data.rect[3]-this.data.rect[1]-s);o=Math.min(a,l(u/uB))}i.fontSize=`calc(${o}px * var(--total-scale-factor))`,i.color=at.makeHexColor(r[0],r[1],r[2]),this.data.textAlignment!==null&&(i.textAlign=n[this.data.textAlignment])}_setRequired(e,n){n?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",n)}}class VVe extends Pf{constructor(e){const n=e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue;super(e,{isRenderable:n})}setPropertyOnSiblings(e,n,r,a){const i=this.annotationStorage;for(const o of this._getElementsByName(e.name,e.id))o.domElement&&(o.domElement[n]=r),i.setValue(o.id,{[a]:r})}render(){var a,i;const e=this.annotationStorage,n=this.data.id;this.container.classList.add("textWidgetAnnotation");let r=null;if(this.renderForms){const o=e.getValue(n,{value:this.data.fieldValue});let s=o.value||"";const l=e.getValue(n,{charLimit:this.data.maxLen}).charLimit;l&&s.length>l&&(s=s.slice(0,l));let u=o.formattedValue||((a=this.data.textContent)==null?void 0:a.join(`
|
|
657
657
|
`))||null;u&&this.data.comb&&(u=u.replaceAll(/\s+/g,""));const d={userValue:s,formattedValue:u,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(r=document.createElement("textarea"),r.textContent=u??s,this.data.doNotScroll&&(r.style.overflowY="hidden")):(r=document.createElement("input"),r.type=this.data.password?"password":"text",r.setAttribute("value",u??s),this.data.doNotScroll&&(r.style.overflowX="hidden")),this.data.hasOwnCanvas&&(r.hidden=!0),Lf.add(r),r.setAttribute("data-element-id",n),r.disabled=this.data.readOnly,r.name=this.data.fieldName,r.tabIndex=0;const{datetimeFormat:f,datetimeType:m,timeStep:h}=this.data,E=!!m&&this.enableScripting;f&&(r.title=f),this._setRequired(r,this.data.required),l&&(r.maxLength=l),r.addEventListener("input",v=>{e.setValue(n,{value:v.target.value}),this.setPropertyOnSiblings(r,"value",v.target.value,"value"),d.formattedValue=null}),r.addEventListener("resetform",v=>{const y=this.data.defaultFieldValue??"";r.value=d.userValue=y,d.formattedValue=null});let b=v=>{const{formattedValue:y}=d;y!=null&&(v.target.value=y),v.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){r.addEventListener("focus",y=>{var T;if(d.focused)return;const{target:C}=y;if(E&&(C.type=m,h&&(C.step=h)),d.userValue){const w=d.userValue;if(E)if(m==="time"){const O=new Date(w),x=[O.getHours(),O.getMinutes(),O.getSeconds()];C.value=x.map(D=>D.toString().padStart(2,"0")).join(":")}else C.value=new Date(w-HVe).toISOString().split(m==="date"?"T":".",1)[0];else C.value=w}d.lastCommittedValue=C.value,d.commitKey=1,(T=this.data.actions)!=null&&T.Focus||(d.focused=!0)}),r.addEventListener("updatefromsandbox",y=>{this.showElementAndHideCanvas(y.target);const C={value(T){d.userValue=T.detail.value??"",E||e.setValue(n,{value:d.userValue.toString()}),T.target.value=d.userValue},formattedValue(T){const{formattedValue:w}=T.detail;d.formattedValue=w,w!=null&&T.target!==document.activeElement&&(T.target.value=w);const O={formattedValue:w};E&&(O.value=w),e.setValue(n,O)},selRange(T){T.target.setSelectionRange(...T.detail.selRange)},charLimit:T=>{var D;const{charLimit:w}=T.detail,{target:O}=T;if(w===0){O.removeAttribute("maxLength");return}O.setAttribute("maxLength",w);let x=d.userValue;!x||x.length<=w||(x=x.slice(0,w),O.value=d.userValue=x,e.setValue(n,{value:x}),(D=this.linkService.eventBus)==null||D.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n,name:"Keystroke",value:x,willCommit:!0,commitKey:1,selStart:O.selectionStart,selEnd:O.selectionEnd}}))}};this._dispatchEventFromSandbox(C,y)}),r.addEventListener("keydown",y=>{var w;d.commitKey=1;let C=-1;if(y.key==="Escape"?C=0:y.key==="Enter"&&!this.data.multiLine?C=2:y.key==="Tab"&&(d.commitKey=3),C===-1)return;const{value:T}=y.target;d.lastCommittedValue!==T&&(d.lastCommittedValue=T,d.userValue=T,(w=this.linkService.eventBus)==null||w.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n,name:"Keystroke",value:T,willCommit:!0,commitKey:C,selStart:y.target.selectionStart,selEnd:y.target.selectionEnd}}))});const v=b;b=null,r.addEventListener("blur",y=>{var w,O;if(!d.focused||!y.relatedTarget)return;(w=this.data.actions)!=null&&w.Blur||(d.focused=!1);const{target:C}=y;let{value:T}=C;if(E){if(T&&m==="time"){const x=T.split(":").map(D=>parseInt(D,10));T=new Date(2e3,0,1,x[0],x[1],x[2]||0).valueOf(),C.step=""}else T.includes("T")||(T=`${T}T00:00`),T=new Date(T).valueOf();C.type="text"}d.userValue=T,d.lastCommittedValue!==T&&((O=this.linkService.eventBus)==null||O.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n,name:"Keystroke",value:T,willCommit:!0,commitKey:d.commitKey,selStart:y.target.selectionStart,selEnd:y.target.selectionEnd}})),v(y)}),(i=this.data.actions)!=null&&i.Keystroke&&r.addEventListener("beforeinput",y=>{var F;d.lastCommittedValue=null;const{data:C,target:T}=y,{value:w,selectionStart:O,selectionEnd:x}=T;let D=O,M=x;switch(y.inputType){case"deleteWordBackward":{const P=w.substring(0,O).match(/\w*[^\w]*$/);P&&(D-=P[0].length);break}case"deleteWordForward":{const P=w.substring(O).match(/^[^\w]*\w*/);P&&(M+=P[0].length);break}case"deleteContentBackward":O===x&&(D-=1);break;case"deleteContentForward":O===x&&(M+=1);break}y.preventDefault(),(F=this.linkService.eventBus)==null||F.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n,name:"Keystroke",value:w,change:C||"",willCommit:!1,selStart:D,selEnd:M}})}),this._setEventListeners(r,d,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],y=>y.target.value)}if(b&&r.addEventListener("blur",b),this.data.comb){const y=(this.data.rect[2]-this.data.rect[0])/l;r.classList.add("comb"),r.style.letterSpacing=`calc(${y}px * var(--total-scale-factor) - 1ch)`}}else r=document.createElement("div"),r.textContent=this.data.fieldValue,r.style.verticalAlign="middle",r.style.display="table-cell",this.data.hasOwnCanvas&&(r.hidden=!0);return this._setTextStyle(r),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class jVe extends Pf{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class WVe extends Pf{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,n=this.data,r=n.id;let a=e.getValue(r,{value:n.exportValue===n.fieldValue}).value;typeof a=="string"&&(a=a!=="Off",e.setValue(r,{value:a})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const i=document.createElement("input");return Lf.add(i),i.setAttribute("data-element-id",r),i.disabled=n.readOnly,this._setRequired(i,this.data.required),i.type="checkbox",i.name=n.fieldName,a&&i.setAttribute("checked",!0),i.setAttribute("exportValue",n.exportValue),i.tabIndex=0,i.addEventListener("change",o=>{const{name:s,checked:l}=o.target;for(const u of this._getElementsByName(s,r)){const d=l&&u.exportValue===n.exportValue;u.domElement&&(u.domElement.checked=d),e.setValue(u.id,{value:d})}e.setValue(r,{value:l})}),i.addEventListener("resetform",o=>{const s=n.defaultFieldValue||"Off";o.target.checked=s===n.exportValue}),this.enableScripting&&this.hasJSActions&&(i.addEventListener("updatefromsandbox",o=>{const s={value(l){l.target.checked=l.detail.value!=="Off",e.setValue(r,{value:l.target.checked})}};this._dispatchEventFromSandbox(s,o)}),this._setEventListeners(i,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],o=>o.target.checked)),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class sue extends Pf{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const e=this.annotationStorage,n=this.data,r=n.id;let a=e.getValue(r,{value:n.fieldValue===n.buttonValue}).value;if(typeof a=="string"&&(a=a!==n.buttonValue,e.setValue(r,{value:a})),a)for(const o of this._getElementsByName(n.fieldName,r))e.setValue(o.id,{value:!1});const i=document.createElement("input");if(Lf.add(i),i.setAttribute("data-element-id",r),i.disabled=n.readOnly,this._setRequired(i,this.data.required),i.type="radio",i.name=n.fieldName,a&&i.setAttribute("checked",!0),i.tabIndex=0,i.addEventListener("change",o=>{const{name:s,checked:l}=o.target;for(const u of this._getElementsByName(s,r))e.setValue(u.id,{value:!1});e.setValue(r,{value:l})}),i.addEventListener("resetform",o=>{const s=n.defaultFieldValue;o.target.checked=s!=null&&s===n.buttonValue}),this.enableScripting&&this.hasJSActions){const o=n.buttonValue;i.addEventListener("updatefromsandbox",s=>{const l={value:u=>{const d=o===u.detail.value;for(const f of this._getElementsByName(u.target.name)){const m=d&&f.id===r;f.domElement&&(f.domElement.checked=m),e.setValue(f.id,{value:m})}}};this._dispatchEventFromSandbox(l,s)}),this._setEventListeners(i,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],s=>s.target.checked)}return this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class KVe extends zB{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){const e=super.render();e.classList.add("buttonWidgetAnnotation","pushButton");const n=e.lastChild;return this.enableScripting&&this.hasJSActions&&n&&(this._setDefaultPropertiesFromJS(n),n.addEventListener("updatefromsandbox",r=>{this._dispatchEventFromSandbox({},r)})),e}}class XVe extends Pf{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const e=this.annotationStorage,n=this.data.id,r=e.getValue(n,{value:this.data.fieldValue}),a=document.createElement("select");Lf.add(a),a.setAttribute("data-element-id",n),a.disabled=this.data.readOnly,this._setRequired(a,this.data.required),a.name=this.data.fieldName,a.tabIndex=0;let i=this.data.combo&&this.data.options.length>0;this.data.combo||(a.size=this.data.options.length,this.data.multiSelect&&(a.multiple=!0)),a.addEventListener("resetform",d=>{const f=this.data.defaultFieldValue;for(const m of a.options)m.selected=m.value===f});for(const d of this.data.options){const f=document.createElement("option");f.textContent=d.displayValue,f.value=d.exportValue,r.value.includes(d.exportValue)&&(f.setAttribute("selected",!0),i=!1),a.append(f)}let o=null;if(i){const d=document.createElement("option");d.value=" ",d.setAttribute("hidden",!0),d.setAttribute("selected",!0),a.prepend(d),o=()=>{d.remove(),a.removeEventListener("input",o),o=null},a.addEventListener("input",o)}const s=d=>{const f=d?"value":"textContent",{options:m,multiple:h}=a;return h?Array.prototype.filter.call(m,E=>E.selected).map(E=>E[f]):m.selectedIndex===-1?null:m[m.selectedIndex][f]};let l=s(!1);const u=d=>{const f=d.target.options;return Array.prototype.map.call(f,m=>({displayValue:m.textContent,exportValue:m.value}))};return this.enableScripting&&this.hasJSActions?(a.addEventListener("updatefromsandbox",d=>{const f={value(m){o==null||o();const h=m.detail.value,E=new Set(Array.isArray(h)?h:[h]);for(const b of a.options)b.selected=E.has(b.value);e.setValue(n,{value:s(!0)}),l=s(!1)},multipleSelection(m){a.multiple=!0},remove(m){const h=a.options,E=m.detail.remove;h[E].selected=!1,a.remove(E),h.length>0&&Array.prototype.findIndex.call(h,v=>v.selected)===-1&&(h[0].selected=!0),e.setValue(n,{value:s(!0),items:u(m)}),l=s(!1)},clear(m){for(;a.length!==0;)a.remove(0);e.setValue(n,{value:null,items:[]}),l=s(!1)},insert(m){const{index:h,displayValue:E,exportValue:b}=m.detail.insert,v=a.children[h],y=document.createElement("option");y.textContent=E,y.value=b,v?v.before(y):a.append(y),e.setValue(n,{value:s(!0),items:u(m)}),l=s(!1)},items(m){const{items:h}=m.detail;for(;a.length!==0;)a.remove(0);for(const E of h){const{displayValue:b,exportValue:v}=E,y=document.createElement("option");y.textContent=b,y.value=v,a.append(y)}a.options.length>0&&(a.options[0].selected=!0),e.setValue(n,{value:s(!0),items:u(m)}),l=s(!1)},indices(m){const h=new Set(m.detail.indices);for(const E of m.target.options)E.selected=h.has(E.index);e.setValue(n,{value:s(!0)}),l=s(!1)},editable(m){m.target.disabled=!m.detail.editable}};this._dispatchEventFromSandbox(f,d)}),a.addEventListener("input",d=>{var h;const f=s(!0),m=s(!1);e.setValue(n,{value:f}),d.preventDefault(),(h=this.linkService.eventBus)==null||h.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n,name:"Keystroke",value:l,change:m,changeEx:f,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(a,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],d=>d.target.value)):a.addEventListener("input",function(d){e.setValue(n,{value:s(!0)})}),this.data.combo&&this._setTextStyle(a),this._setBackgroundColor(a),this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}}class qB extends Dr{constructor(n){const{data:r,elements:a,parent:i}=n,o=!!i._commentManager;super(n,{isRenderable:!o&&Dr._hasPopupData(r)});V(this,cv);if(this.elements=a,o&&Dr._hasPopupData(r)){const s=this.popup=X(this,cv,z7).call(this);for(const l of a)l.popup=s}else this.popup=null}render(){const{container:n}=this;n.classList.add("popupAnnotation"),n.role="comment";const r=this.popup=X(this,cv,z7).call(this),a=[];for(const i of this.elements)i.popup=r,i.container.ariaHasPopup="dialog",a.push(i.data.id),i.addHighlightArea();return this.container.setAttribute("aria-controls",a.map(i=>`${_B}${i}`).join(",")),this.container}}cv=new WeakSet,z7=function(){return new QVe({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate||this.data.creationDate,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,commentManager:this.parent._commentManager})};class QVe{constructor({container:e,color:n,elements:r,titleObj:a,modificationDate:i,contentsObj:o,richText:s,parent:l,rect:u,parentRect:d,open:f,commentManager:m=null}){V(this,Wt);V(this,Oo,null);V(this,ip,X(this,Wt,ihe).bind(this));V(this,MR,X(this,Wt,V7).bind(this));V(this,LR,X(this,Wt,dw).bind(this));V(this,B_,X(this,Wt,uw).bind(this));V(this,U_,null);V(this,qr,null);V(this,sc,null);V(this,op,null);V(this,Om,null);V(this,G_,null);V(this,z_,null);V(this,lc,!1);V(this,Io,null);V(this,Su,null);V(this,vu,null);V(this,xa,null);V(this,yu,null);V(this,sp,null);V(this,uv,null);V(this,Tu,null);V(this,q_,null);V(this,Im,null);V(this,lp,!1);V(this,ci,null);V(this,cp,null);L(this,qr,e),L(this,q_,a),L(this,sc,o),L(this,Tu,s),L(this,G_,l),L(this,U_,n),L(this,uv,u),L(this,z_,d),L(this,Om,r),L(this,Oo,m),L(this,ci,r[0]),L(this,op,HE.toDateObject(i)),this.trigger=r.flatMap(h=>h.getElementsToTriggerPopup()),m?this.renderCommentButton():(X(this,Wt,lw).call(this),_(this,qr).hidden=!0,f&&X(this,Wt,uw).call(this))}renderCommentButton(){if(_(this,xa)||(_(this,yu)||X(this,Wt,q7).call(this),!_(this,yu)))return;const{signal:e}=L(this,Su,new AbortController),n=!!_(this,ci).extraPopupElement,r=()=>{_(this,Oo).toggleCommentPopup(this,!0,void 0,!n)},a=()=>{_(this,Oo).toggleCommentPopup(this,!1,!0,!n)},i=()=>{_(this,Oo).toggleCommentPopup(this,!1,!1)};if(n){L(this,xa,_(this,ci).container);for(const o of this.trigger)o.ariaHasPopup="dialog",o.ariaControls="commentPopup",o.addEventListener("keydown",_(this,ip),{signal:e}),o.addEventListener("click",r,{signal:e}),o.addEventListener("pointerenter",a,{signal:e}),o.addEventListener("pointerleave",i,{signal:e}),o.classList.add("popupTriggerArea")}else{const o=L(this,xa,document.createElement("button"));o.className="annotationCommentButton";const s=_(this,ci).container;o.style.zIndex=s.style.zIndex+1,o.tabIndex=0,o.ariaHasPopup="dialog",o.ariaControls="commentPopup",o.setAttribute("data-l10n-id","pdfjs-show-comment-button"),X(this,Wt,$7).call(this),X(this,Wt,H7).call(this),o.addEventListener("keydown",_(this,ip),{signal:e}),o.addEventListener("click",r,{signal:e}),o.addEventListener("pointerenter",a,{signal:e}),o.addEventListener("pointerleave",i,{signal:e}),s.after(o)}}get commentButtonColor(){const{color:e,opacity:n}=_(this,ci).commentData;return e?_(this,G_)._commentManager.makeCommentColor(e,n):null}focusCommentButton(){setTimeout(()=>{var e;(e=_(this,xa))==null||e.focus()},0)}getData(){const{richText:e,color:n,opacity:r,creationDate:a,modificationDate:i}=_(this,ci).commentData;return{contentsObj:{str:this.comment},richText:e,color:n,opacity:r,creationDate:a,modificationDate:i}}get elementBeforePopup(){return _(this,xa)}get comment(){return _(this,cp)||L(this,cp,_(this,ci).commentText),_(this,cp)}set comment(e){e!==this.comment&&(_(this,ci).commentText=L(this,cp,e))}get parentBoundingClientRect(){return _(this,ci).layer.getBoundingClientRect()}setCommentButtonStates({selected:e,hasPopup:n}){_(this,xa)&&(_(this,xa).classList.toggle("selected",e),_(this,xa).ariaExpanded=n)}setSelectedCommentButton(e){_(this,xa).classList.toggle("selected",e)}get commentPopupPosition(){if(_(this,sp))return _(this,sp);const{x:e,y:n,height:r}=_(this,xa).getBoundingClientRect(),{x:a,y:i,width:o,height:s}=_(this,ci).layer.getBoundingClientRect();return[(e-a)/o,(n+r-i)/s]}set commentPopupPosition(e){L(this,sp,e)}hasDefaultPopupPosition(){return _(this,sp)===null}get commentButtonPosition(){return _(this,yu)}get commentButtonWidth(){return _(this,xa).getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(e){const[n,r]=_(this,sp)||this.commentButtonPosition.map(u=>u/100),a=this.parentBoundingClientRect,{x:i,y:o,width:s,height:l}=a;_(this,Oo).showDialog(null,this,i+n*s,o+r*l,{...e,parentDimensions:a})}render(){var r,a;if(_(this,Io))return;const e=L(this,Io,document.createElement("div"));if(e.className="popup",_(this,U_)){const i=e.style.outlineColor=at.makeHexColor(..._(this,U_));e.style.backgroundColor=`color-mix(in srgb, ${i} 30%, white)`}const n=document.createElement("span");if(n.className="header",(r=_(this,q_))!=null&&r.str){const i=document.createElement("span");i.className="title",n.append(i),{dir:i.dir,str:i.textContent}=_(this,q_)}if(e.append(n),_(this,op)){const i=document.createElement("time");i.className="popupDate",i.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),i.setAttribute("data-l10n-args",JSON.stringify({dateObj:_(this,op).valueOf()})),i.dateTime=_(this,op).toISOString(),n.append(i)}SB({html:_(this,Wt,cw)||_(this,sc).str,dir:(a=_(this,sc))==null?void 0:a.dir,className:"popupContent"},e),_(this,qr).append(e)}updateEdited({rect:e,popup:n,deleted:r}){var a;if(_(this,Oo)){r?(this.remove(),L(this,cp,null)):n&&(n.deleted?this.remove():(X(this,Wt,$7).call(this),L(this,cp,n.text))),e&&(L(this,yu,null),X(this,Wt,q7).call(this),X(this,Wt,H7).call(this));return}if(r||n!=null&&n.deleted){this.remove();return}X(this,Wt,lw).call(this),_(this,Im)||L(this,Im,{contentsObj:_(this,sc),richText:_(this,Tu)}),e&&L(this,vu,null),n&&n.text&&(L(this,Tu,X(this,Wt,ahe).call(this,n.text)),L(this,op,HE.toDateObject(n.date)),L(this,sc,null)),(a=_(this,Io))==null||a.remove(),L(this,Io,null)}resetEdited(){var e;_(this,Im)&&({contentsObj:Ca(this,sc)._,richText:Ca(this,Tu)._}=_(this,Im),L(this,Im,null),(e=_(this,Io))==null||e.remove(),L(this,Io,null),L(this,vu,null))}remove(){var e,n,r;if((e=_(this,Su))==null||e.abort(),L(this,Su,null),(n=_(this,Io))==null||n.remove(),L(this,Io,null),L(this,lp,!1),L(this,lc,!1),(r=_(this,xa))==null||r.remove(),L(this,xa,null),this.trigger)for(const a of this.trigger)a.classList.remove("popupTriggerArea")}forceHide(){L(this,lp,this.isVisible),_(this,lp)&&(_(this,qr).hidden=!0)}maybeShow(){_(this,Oo)||(X(this,Wt,lw).call(this),_(this,lp)&&(_(this,Io)||X(this,Wt,dw).call(this),L(this,lp,!1),_(this,qr).hidden=!1))}get isVisible(){return _(this,Oo)?!1:_(this,qr).hidden===!1}}Oo=new WeakMap,ip=new WeakMap,MR=new WeakMap,LR=new WeakMap,B_=new WeakMap,U_=new WeakMap,qr=new WeakMap,sc=new WeakMap,op=new WeakMap,Om=new WeakMap,G_=new WeakMap,z_=new WeakMap,lc=new WeakMap,Io=new WeakMap,Su=new WeakMap,vu=new WeakMap,xa=new WeakMap,yu=new WeakMap,sp=new WeakMap,uv=new WeakMap,Tu=new WeakMap,q_=new WeakMap,Im=new WeakMap,lp=new WeakMap,ci=new WeakMap,cp=new WeakMap,Wt=new WeakSet,lw=function(){var n;if(_(this,Su))return;L(this,Su,new AbortController);const{signal:e}=_(this,Su);for(const r of this.trigger)r.addEventListener("click",_(this,B_),{signal:e}),r.addEventListener("pointerenter",_(this,LR),{signal:e}),r.addEventListener("pointerleave",_(this,MR),{signal:e}),r.classList.add("popupTriggerArea");for(const r of _(this,Om))(n=r.container)==null||n.addEventListener("keydown",_(this,ip),{signal:e})},q7=function(){const e=_(this,Om).find(n=>n.hasCommentButton);e&&L(this,yu,e._normalizePoint(e.commentButtonPosition))},H7=function(){if(_(this,ci).extraPopupElement&&!_(this,ci).editor)return;this.renderCommentButton();const[e,n]=_(this,yu),{style:r}=_(this,xa);r.left=`calc(${e}%)`,r.top=`calc(${n}% - var(--comment-button-dim))`},$7=function(){_(this,ci).extraPopupElement||(this.renderCommentButton(),_(this,xa).style.backgroundColor=this.commentButtonColor||"")},cw=function(){const e=_(this,Tu),n=_(this,sc);return e!=null&&e.str&&(!(n!=null&&n.str)||n.str===e.str)&&_(this,Tu).html||null},Y7=function(){var e,n,r;return((r=(n=(e=_(this,Wt,cw))==null?void 0:e.attributes)==null?void 0:n.style)==null?void 0:r.fontSize)||0},rhe=function(){var e,n,r;return((r=(n=(e=_(this,Wt,cw))==null?void 0:e.attributes)==null?void 0:n.style)==null?void 0:r.color)||null},ahe=function(e){const n=[],r={str:e,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:n}]}},a={style:{color:_(this,Wt,rhe),fontSize:_(this,Wt,Y7)?`calc(${_(this,Wt,Y7)}px * var(--total-scale-factor))`:""}};for(const i of e.split(`
|
|
658
658
|
`))n.push({name:"span",value:i,attributes:a});return r},ihe=function(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||(e.key==="Enter"||e.key==="Escape"&&_(this,lc))&&X(this,Wt,uw).call(this)},ohe=function(){if(_(this,vu)!==null)return;const{page:{view:e},viewport:{rawDims:{pageWidth:n,pageHeight:r,pageX:a,pageY:i}}}=_(this,G_);let o=!!_(this,z_),s=o?_(this,z_):_(this,uv);for(const E of _(this,Om))if(!s||at.intersect(E.data.rect,s)!==null){s=E.data.rect,o=!0;break}const l=at.normalizeRect([s[0],e[3]-s[1]+e[1],s[2],e[3]-s[3]+e[1]]),d=o?s[2]-s[0]+5:0,f=l[0]+d,m=l[1];L(this,vu,[100*(f-a)/n,100*(m-i)/r]);const{style:h}=_(this,qr);h.left=`${_(this,vu)[0]}%`,h.top=`${_(this,vu)[1]}%`},uw=function(){if(_(this,Oo)){_(this,Oo).toggleCommentPopup(this,!1);return}L(this,lc,!_(this,lc)),_(this,lc)?(X(this,Wt,dw).call(this),_(this,qr).addEventListener("click",_(this,B_)),_(this,qr).addEventListener("keydown",_(this,ip))):(X(this,Wt,V7).call(this),_(this,qr).removeEventListener("click",_(this,B_)),_(this,qr).removeEventListener("keydown",_(this,ip)))},dw=function(){_(this,Io)||this.render(),this.isVisible?_(this,lc)&&_(this,qr).classList.add("focused"):(X(this,Wt,ohe).call(this),_(this,qr).hidden=!1,_(this,qr).style.zIndex=parseInt(_(this,qr).style.zIndex)+1e3)},V7=function(){_(this,qr).classList.remove("focused"),!(_(this,lc)||!this.isVisible)&&(_(this,qr).hidden=!0,_(this,qr).style.zIndex=parseInt(_(this,qr).style.zIndex)-1e3)};class lue extends Dr{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=Pt.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 n of this.textContent){const r=document.createElement("span");r.textContent=n,e.append(r)}this.container.append(e)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}class ZVe extends Dr{constructor(n){super(n,{isRenderable:!0,ignoreBorder:!0});V(this,dv,null)}render(){this.container.classList.add("lineAnnotation");const{data:n,width:r,height:a}=this,i=this.svgFactory.create(r,a,!0),o=L(this,dv,this.svgFactory.createElement("svg:line"));return o.setAttribute("x1",n.rect[2]-n.lineCoordinates[0]),o.setAttribute("y1",n.rect[3]-n.lineCoordinates[1]),o.setAttribute("x2",n.rect[2]-n.lineCoordinates[2]),o.setAttribute("y2",n.rect[3]-n.lineCoordinates[3]),o.setAttribute("stroke-width",n.borderStyle.width||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),i.append(o),this.container.append(i),!n.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return _(this,dv)}addHighlightArea(){this.container.classList.add("highlightArea")}}dv=new WeakMap;class JVe extends Dr{constructor(n){super(n,{isRenderable:!0,ignoreBorder:!0});V(this,pv,null)}render(){this.container.classList.add("squareAnnotation");const{data:n,width:r,height:a}=this,i=this.svgFactory.create(r,a,!0),o=n.borderStyle.width,s=L(this,pv,this.svgFactory.createElement("svg:rect"));return s.setAttribute("x",o/2),s.setAttribute("y",o/2),s.setAttribute("width",r-o),s.setAttribute("height",a-o),s.setAttribute("stroke-width",o||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),i.append(s),this.container.append(i),!n.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return _(this,pv)}addHighlightArea(){this.container.classList.add("highlightArea")}}pv=new WeakMap;class eje extends Dr{constructor(n){super(n,{isRenderable:!0,ignoreBorder:!0});V(this,fv,null)}render(){this.container.classList.add("circleAnnotation");const{data:n,width:r,height:a}=this,i=this.svgFactory.create(r,a,!0),o=n.borderStyle.width,s=L(this,fv,this.svgFactory.createElement("svg:ellipse"));return s.setAttribute("cx",r/2),s.setAttribute("cy",a/2),s.setAttribute("rx",r/2-o/2),s.setAttribute("ry",a/2-o/2),s.setAttribute("stroke-width",o||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),i.append(s),this.container.append(i),!n.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return _(this,fv)}addHighlightArea(){this.container.classList.add("highlightArea")}}fv=new WeakMap;class cue extends Dr{constructor(n){super(n,{isRenderable:!0,ignoreBorder:!0});V(this,mv,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:n,vertices:r,borderStyle:a,popupRef:i},width:o,height:s}=this;if(!r)return this.container;const l=this.svgFactory.create(o,s,!0);let u=[];for(let f=0,m=r.length;f<m;f+=2){const h=r[f]-n[0],E=n[3]-r[f+1];u.push(`${h},${E}`)}u=u.join(" ");const d=L(this,mv,this.svgFactory.createElement(this.svgElementName));return d.setAttribute("points",u),d.setAttribute("stroke-width",a.width||1),d.setAttribute("stroke","transparent"),d.setAttribute("fill","transparent"),l.append(d),this.container.append(l),!i&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return _(this,mv)}addHighlightArea(){this.container.classList.add("highlightArea")}}mv=new WeakMap;class tje extends cue{constructor(e){super(e),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class nje extends Dr{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 HB extends Dr{constructor(n){super(n,{isRenderable:!0,ignoreBorder:!0});V(this,gv);V(this,hv,null);V(this,Dm,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?Pt.HIGHLIGHT:Pt.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:n,rotation:r,inkLists:a,borderStyle:i,popupRef:o}}=this,{transform:s,width:l,height:u}=X(this,gv,j7).call(this,r,n),d=this.svgFactory.create(l,u,!0),f=L(this,hv,this.svgFactory.createElement("svg:g"));d.append(f),f.setAttribute("stroke-width",i.width||1),f.setAttribute("stroke-linecap","round"),f.setAttribute("stroke-linejoin","round"),f.setAttribute("stroke-miterlimit",10),f.setAttribute("stroke","transparent"),f.setAttribute("fill","transparent"),f.setAttribute("transform",s);for(let m=0,h=a.length;m<h;m++){const E=this.svgFactory.createElement(this.svgElementName);_(this,Dm).push(E),E.setAttribute("points",a[m].join(",")),f.append(E)}return!o&&this.hasPopupData&&this._createPopup(),this.container.append(d),this._editOnDoubleClick(),this.container}updateEdited(n){super.updateEdited(n);const{thickness:r,points:a,rect:i}=n,o=_(this,hv);if(r>=0&&o.setAttribute("stroke-width",r||1),a)for(let s=0,l=_(this,Dm).length;s<l;s++)_(this,Dm)[s].setAttribute("points",a[s].join(","));if(i){const{transform:s,width:l,height:u}=X(this,gv,j7).call(this,this.data.rotation,i);o.parentElement.setAttribute("viewBox",`0 0 ${l} ${u}`),o.setAttribute("transform",s)}}getElementsToTriggerPopup(){return _(this,Dm)}addHighlightArea(){this.container.classList.add("highlightArea")}}hv=new WeakMap,Dm=new WeakMap,gv=new WeakSet,j7=function(n,r){switch(n){case 90:return{transform:`rotate(90) translate(${-r[0]},${r[1]}) scale(1,-1)`,width:r[3]-r[1],height:r[2]-r[0]};case 180:return{transform:`rotate(180) translate(${-r[2]},${r[1]}) scale(1,-1)`,width:r[2]-r[0],height:r[3]-r[1]};case 270:return{transform:`rotate(270) translate(${-r[2]},${r[3]}) scale(1,-1)`,width:r[3]-r[1],height:r[2]-r[0]};default:return{transform:`translate(${-r[0]},${r[3]}) scale(1,-1)`,width:r[2]-r[0],height:r[3]-r[1]}}};class uue extends Dr{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=Pt.HIGHLIGHT}render(){const{data:{overlaidText:e,popupRef:n}}=this;if(!n&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),e){const r=document.createElement("mark");r.classList.add("overlaidText"),r.textContent=e,this.container.append(r)}return this.container}}class rje extends Dr{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:n}}=this;if(!n&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),e){const r=document.createElement("u");r.classList.add("overlaidText"),r.textContent=e,this.container.append(r)}return this.container}}class aje extends Dr{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:n}}=this;if(!n&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),e){const r=document.createElement("u");r.classList.add("overlaidText"),r.textContent=e,this.container.append(r)}return this.container}}class ije extends Dr{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:n}}=this;if(!n&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),e){const r=document.createElement("s");r.classList.add("overlaidText"),r.textContent=e,this.container.append(r)}return this.container}}class due extends Dr{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=Pt.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 oje extends Dr{constructor(n){var a;super(n,{isRenderable:!0});V(this,bv);V(this,_v,null);const{file:r}=this.data;this.filename=r.filename,this.content=r.content,(a=this.linkService.eventBus)==null||a.dispatch("fileattachmentannotation",{source:this,...r})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:n,data:r}=this;let a;r.hasAppearance||r.fillAlpha===0?a=document.createElement("div"):(a=document.createElement("img"),a.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(r.name)?"paperclip":"pushpin"}.svg`,r.fillAlpha&&r.fillAlpha<1&&(a.style=`filter: opacity(${Math.round(r.fillAlpha*100)}%);`)),a.addEventListener("dblclick",X(this,bv,W7).bind(this)),L(this,_v,a);const{isMac:i}=Ra.platform;return n.addEventListener("keydown",o=>{o.key==="Enter"&&(i?o.metaKey:o.ctrlKey)&&X(this,bv,W7).call(this)}),!r.popupRef&&this.hasPopupData?this._createPopup():a.classList.add("popupTriggerArea"),n.append(a),n}getElementsToTriggerPopup(){return _(this,_v)}addHighlightArea(){this.container.classList.add("highlightArea")}}_v=new WeakMap,bv=new WeakSet,W7=function(){var n;(n=this.downloadManager)==null||n.openOrDownloadData(this.content,this.filename)};let $B=(Y_=class{constructor({div:e,accessibilityManager:n,annotationCanvasMap:r,annotationEditorUIManager:a,page:i,viewport:o,structTreeLayer:s,commentManager:l,linkService:u,annotationStorage:d}){V(this,dp);V(this,H_,null);V(this,km,null);V(this,$_,null);V(this,up,new Map);V(this,Ev,null);V(this,Mm,null);this.div=e,L(this,H_,n),L(this,km,r),L(this,Ev,s||null),L(this,Mm,u||null),L(this,$_,d||new AB),this.page=i,this.viewport=o,this.zIndex=0,this._annotationEditorUIManager=a,this._commentManager=l||null}hasEditableAnnotations(){return _(this,up).size>0}async render(e){var o,s,l;const{annotations:n}=e,r=this.div;xd(r,this.viewport);const a=new Map,i={data:null,layer:r,linkService:_(this,Mm),downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:e.renderForms!==!1,svgFactory:new eS,annotationStorage:_(this,$_),enableComment:e.enableComment===!0,enableScripting:e.enableScripting===!0,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(const u of n){if(u.noHTML)continue;const d=u.annotationType===Xr.POPUP;if(d){const h=a.get(u.id);if(!h)continue;i.elements=h}else if(u.rect[2]===u.rect[0]||u.rect[3]===u.rect[1])continue;i.data=u;const f=oue.create(i);if(!f.isRenderable)continue;if(!d&&u.popupRef){const h=a.get(u.popupRef);h?h.push(f):a.set(u.popupRef,[f])}const m=f.render();u.hidden&&(m.style.visibility="hidden"),await X(this,dp,K7).call(this,m,u.id,i.elements),(s=(o=f.extraPopupElement)==null?void 0:o.popup)==null||s.renderCommentButton(),f._isEditable&&(_(this,up).set(f.data.id,f),(l=this._annotationEditorUIManager)==null||l.renderAnnotationElement(f))}X(this,dp,X7).call(this)}async addLinkAnnotations(e){const n={data:null,layer:this.div,linkService:_(this,Mm),svgFactory:new eS,parent:this};for(const r of e){r.borderStyle||(r.borderStyle=Y_._defaultBorderStyle),n.data=r;const a=oue.create(n);if(!a.isRenderable)continue;const i=a.render();await X(this,dp,K7).call(this,i,r.id,null)}}update({viewport:e}){const n=this.div;this.viewport=e,xd(n,{rotation:e.rotation}),X(this,dp,X7).call(this),n.hidden=!1}getEditableAnnotations(){return Array.from(_(this,up).values())}getEditableAnnotation(e){return _(this,up).get(e)}addFakeAnnotation(e){var s;const{div:n}=this,{id:r,rotation:a}=e,i=new $Ve({data:{id:r,rect:e.getPDFRect(),rotation:a},editor:e,layer:n,parent:this,enableComment:!!this._commentManager,linkService:_(this,Mm),annotationStorage:_(this,$_)}),o=i.render();return n.append(o),(s=_(this,H_))==null||s.moveElementInDOM(n,o,o,!1),i.createOrUpdatePopup(),i}static get _defaultBorderStyle(){return jt(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:Rg.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}},H_=new WeakMap,km=new WeakMap,$_=new WeakMap,up=new WeakMap,Ev=new WeakMap,Mm=new WeakMap,dp=new WeakSet,K7=async function(e,n,r){var s,l;const a=e.firstChild||e,i=a.id=`${_B}${n}`,o=await((s=_(this,Ev))==null?void 0:s.getAriaAttributes(i));if(o)for(const[u,d]of o)a.setAttribute(u,d);r?r.at(-1).container.after(e):(this.div.append(e),(l=_(this,H_))==null||l.moveElementInDOM(this.div,e,a,!1))},X7=function(){var n;if(!_(this,km))return;const e=this.div;for(const[r,a]of _(this,km)){const i=e.querySelector(`[data-annotation-id="${r}"]`);if(!i)continue;a.className="annotationContent";const{firstChild:o}=i;o?o.nodeName==="CANVAS"?o.replaceWith(a):o.classList.contains("annotationContent")?o.after(a):o.before(a):i.append(a);const s=_(this,up).get(r);s&&(s._hasNoCanvas?((n=this._annotationEditorUIManager)==null||n.setMissingCanvas(r,i.id,a),s._hasNoCanvas=!1):s.canvas=a)}_(this,km).clear()},Y_);const uR=/\r\n?|\n/g,mr=class mr extends ur{constructor(n){super({...n,name:"freeTextEditor"});V(this,oa);V(this,Do,"");V(this,Sv,`${this.id}-editor`);V(this,Lm,null);V(this,ko);Fe(this,"_colorPicker",null);this.color=n.color||mr._defaultColor||ur._defaultLineColor,L(this,ko,n.fontSize||mr._defaultFontSize),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert")}static get _keyboardManager(){const n=mr.prototype,r=o=>o.isEmpty(),a=Nd.TRANSLATE_SMALL,i=Nd.TRANSLATE_BIG;return jt(this,"_keyboardManager",new $E([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],n.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],n.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],n._translateEmpty,{args:[-a,0],checker:r}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],n._translateEmpty,{args:[-i,0],checker:r}],[["ArrowRight","mac+ArrowRight"],n._translateEmpty,{args:[a,0],checker:r}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],n._translateEmpty,{args:[i,0],checker:r}],[["ArrowUp","mac+ArrowUp"],n._translateEmpty,{args:[0,-a],checker:r}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],n._translateEmpty,{args:[0,-i],checker:r}],[["ArrowDown","mac+ArrowDown"],n._translateEmpty,{args:[0,a],checker:r}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],n._translateEmpty,{args:[0,i],checker:r}]]))}static initialize(n,r){ur.initialize(n,r);const a=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(a.getPropertyValue("--freetext-padding"))}static updateDefaultParams(n,r){switch(n){case cn.FREETEXT_SIZE:mr._defaultFontSize=r;break;case cn.FREETEXT_COLOR:mr._defaultColor=r;break}}updateParams(n,r){switch(n){case cn.FREETEXT_SIZE:X(this,oa,she).call(this,r);break;case cn.FREETEXT_COLOR:X(this,oa,lhe).call(this,r);break}}static get defaultPropertiesToUpdate(){return[[cn.FREETEXT_SIZE,mr._defaultFontSize],[cn.FREETEXT_COLOR,mr._defaultColor||ur._defaultLineColor]]}get propertiesToUpdate(){return[[cn.FREETEXT_SIZE,_(this,ko)],[cn.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new cR(this)),[["colorPicker",this._colorPicker]]}get colorType(){return cn.FREETEXT_COLOR}onUpdatedColor(){var n;this.editorDiv.style.color=this.color,(n=this._colorPicker)==null||n.update(this.color),super.onUpdatedColor()}_translateEmpty(n,r){this._uiManager.translateSelectedEditors(n,r,!0)}getInitialTranslation(){const n=this.parentScale;return[-mr._internalPadding*n,-(mr._internalPadding+_(this,ko))*n]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(!super.enableEditMode())return!1;this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),L(this,Lm,new AbortController);const n=this._uiManager.combinedSignal(_(this,Lm));return this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:n}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:n}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:n}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:n}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:n}),!0}disableEditMode(){var n;return super.disableEditMode()?(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",_(this,Sv)),this._isDraggable=!0,(n=_(this,Lm))==null||n.abort(),L(this,Lm,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0):!1}focusin(n){this._focusEventsAllowed&&(super.focusin(n),n.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(n){var r;this.width||(this.enableEditMode(),n&&this.editorDiv.focus(),(r=this._initialOptions)!=null&&r.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()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const n=_(this,Do),r=L(this,Do,X(this,oa,che).call(this).trimEnd());if(n===r)return;const a=i=>{if(L(this,Do,i),!i){this.remove();return}X(this,oa,mw).call(this),this._uiManager.rebuild(this),X(this,oa,pw).call(this)};this.addCommands({cmd:()=>{a(r)},undo:()=>{a(n)},mustExec:!1}),X(this,oa,pw).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(n){n.target===this.div&&n.key==="Enter"&&(this.enterInEditMode(),n.preventDefault())}editorDivKeydown(n){mr._keyboardManager.exec(this,n)}editorDivFocus(n){this.isEditing=!0}editorDivBlur(n){this.isEditing=!1}editorDivInput(n){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)}get canChangeContent(){return!0}render(){if(this.div)return this.div;let n,r;(this._isCopy||this.annotationElementId)&&(n=this.x,r=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",_(this,Sv)),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,ko)}px * var(--total-scale-factor))`,a.color=this.color,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){const[i,o]=this.parentDimensions;if(this.annotationElementId){const{position:s}=this._initialData;let[l,u]=this.getInitialTranslation();[l,u]=this.pageTranslationToScreen(l,u);const[d,f]=this.pageDimensions,[m,h]=this.pageTranslation;let E,b;switch(this.rotation){case 0:E=n+(s[0]-m)/d,b=r+this.height-(s[1]-h)/f;break;case 90:E=n+(s[0]-m)/d,b=r-(s[1]-h)/f,[l,u]=[u,-l];break;case 180:E=n-this.width+(s[0]-m)/d,b=r-(s[1]-h)/f,[l,u]=[-l,-u];break;case 270:E=n+(s[0]-m-this.height*f)/d,b=r+(s[1]-h-this.width*d)/f,[l,u]=[-u,l];break}this.setAt(E*i,b*o,l,u)}else this._moveAfterPaste(n,r);X(this,oa,mw).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(n){var E,b,v;const r=n.clipboardData||window.clipboardData,{types:a}=r;if(a.length===1&&a[0]==="text/plain")return;n.preventDefault();const i=X(E=mr,Cu,Q7).call(E,r.getData("text")||"").replaceAll(uR,`
|