PageSourceSearch

https://dixiecountyadvocate.com/assets/index-D-sGguz5.js

js dixiecountyadvocate.com collected 2026-10-09 05:15:29 UTC 1,809,045 bytes, 1,390 lines download raw bytes

vendor: 4,971 bytes, lines 1-9
1var _6=Object.defineProperty;var xE=r=>{throw TypeError(r)};var N6=(r,e,t)=>e in r?_6(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Re=(r,e,t)=>N6(r,typeof e!="symbol"?e+"":e,t),Jv=(r,e,t)=>e.has(r)||xE("Cannot "+t);var x=(r,e,t)=>(Jv(r,e,"read from private field"),t?t.call(r):e.get(r)),$=(r,e,t)=>e.has(r)?xE("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),P=(r,e,t,n)=>(Jv(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),O=(r,e,t)=>(Jv(r,e,"access private method"),t);var fn=(r,e,t,n)=>({set _(s){P(r,e,s,t)},get _(){return x(r,e,n)}});(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function t(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(s){if(s.ep)return;s.ep=!0;const i=t(s);fetch(s.href,i)}})();var Be=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function f3(r){if(r.__esModule)return r;var e=r.default;if(typeof e=="function"){var t=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(n){var s=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:function(){return r[n]}})}),t}var p3={exports:{}},xx={},m3={exports:{}},Qe={};/**
2 * @license React
3 * react.production.min.js
4 *
5 * Copyright (c) Facebook, Inc. and its affiliates.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE file in the root directory of this source tree.
9 */var Dg=Symbol.for("react.element"),S6=Symbol.for("react.portal"),k6=Symbol.for("react.fragment"),C6=Symbol.for("react.strict_mode"),E6=Symbol.for("react.profiler"),j6=Symbol.for("react.provider"),A6=Symbol.for("react.context"),T6=Symbol.for("react.forward_ref"),D6=Symbol.for("react.suspense"),R6=Symbol.for("react.memo"),P6=Symbol.for("react.lazy"),vE=Symbol.iterator;function I6(r){return r===null||typeof r!="object"?null:(r=vE&&r[vE]||r["@@iterator"],typeof r=="function"?r:null)}var g3={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y3=Object.assign,b3={};function mf(r,e,t){this.props=r,this.context=e,this.refs=b3,this.updater=t||g3}mf.prototype.isReactComponent={};mf.prototype.setState=function(r,e){if(typeof r!="object"&&typeof r!="function"&&r!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,r,e,"setState")};mf.prototype.forceUpdate=function(r){this.updater.enqueueForceUpdate(this,r,"forceUpdate")};function x3(){}x3.prototype=mf.prototype;function pS(r,e,t){this.props=r,this.context=e,this.refs=b3,this.updater=t||g3}var mS=pS.prototype=new x3;mS.constructor=pS;y3(mS,mf.prototype);mS.isPureReactComponent=!0;var wE=Array.isArray,v3=Object.prototype.hasOwnProperty,gS={current:null},w3={key:!0,ref:!0,__self:!0,__source:!0};function _3(r,e,t){var n,s={},i=null,o=null;if(e!=null)for(n in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(i=""+e.key),e)v3.call(e,n)&&!w3.hasOwnProperty(n)&&(s[n]=e[n]);var l=arguments.length-2;if(l===1)s.children=t;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];s.children=c}if(r&&r.defaultProps)for(n in l=r.defaultProps,l)s[n]===void 0&&(s[n]=l[n]);return{$$typeof:Dg,type:r,key:i,ref:o,props:s,_owner:gS.current}}function L6(r,e){return{$$typeof:Dg,type:r.type,key:e,ref:r.ref,props:r.props,_owner:r._owner}}function yS(r){return typeof r=="object"&&r!==null&&r.$$typeof===Dg}function O6(r){var e={"=":"=0",":":"=2"};return"$"+r.replace(/[=:]/g,function(t){return e[t]})}var _E=/\/+/g;function Zv(r,e){return typeof r=="object"&&r!==null&&r.key!=null?O6(""+r.key):e.toString(36)}function ey(r,e,t,n,s){var i=typeof r;(i==="undefined"||i==="boolean")&&(r=null);var o=!1;if(r===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(r.$$typeof){case Dg:case S6:o=!0}}if(o)return o=r,s=s(o),r=n===""?"."+Zv(o,0):n,wE(s)?(t="",r!=null&&(t=r.replace(_E,"$&/")+"/"),ey(s,e,t,"",function(u){return u})):s!=null&&(yS(s)&&(s=L6(s,t+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(_E,"$&/")+"/")+r)),e.push(s)),1;if(o=0,n=n===""?".":n+":",wE(r))for(var l=0;l<r.length;l++){i=r[l];var c=n+Zv(i,l);o+=ey(i,e,t,c,s)}
vendor: 4,183 bytes, lines 9-17
9else if(c=I6(r),typeof c=="function")for(r=c.call(r),l=0;!(i=r.next()).done;)i=i.value,c=n+Zv(i,l++),o+=ey(i,e,t,c,s);else if(i==="object")throw e=String(r),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function c0(r,e,t){if(r==null)return r;var n=[],s=0;return ey(r,n,"","",function(i){return e.call(t,i,s++)}),n}function M6(r){if(r._status===-1){var e=r._result;e=e(),e.then(function(t){(r._status===0||r._status===-1)&&(r._status=1,r._result=t)},function(t){(r._status===0||r._status===-1)&&(r._status=2,r._result=t)}),r._status===-1&&(r._status=0,r._result=e)}if(r._status===1)return r._result.default;throw r._result}var Cn={current:null},ty={transition:null},F6={ReactCurrentDispatcher:Cn,ReactCurrentBatchConfig:ty,ReactCurrentOwner:gS};function N3(){throw Error("act(...) is not supported in production builds of React.")}Qe.Children={map:c0,forEach:function(r,e,t){c0(r,function(){e.apply(this,arguments)},t)},count:function(r){var e=0;return c0(r,function(){e++}),e},toArray:function(r){return c0(r,function(e){return e})||[]},only:function(r){if(!yS(r))throw Error("React.Children.only expected to receive a single React element child.");return r}};Qe.Component=mf;Qe.Fragment=k6;Qe.Profiler=E6;Qe.PureComponent=pS;Qe.StrictMode=C6;Qe.Suspense=D6;Qe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=F6;Qe.act=N3;Qe.cloneElement=function(r,e,t){if(r==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+r+".");var n=y3({},r.props),s=r.key,i=r.ref,o=r._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,o=gS.current),e.key!==void 0&&(s=""+e.key),r.type&&r.type.defaultProps)var l=r.type.defaultProps;for(c in e)v3.call(e,c)&&!w3.hasOwnProperty(c)&&(n[c]=e[c]===void 0&&l!==void 0?l[c]:e[c])}var c=arguments.length-2;if(c===1)n.children=t;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];n.children=l}return{$$typeof:Dg,type:r.type,key:s,ref:i,props:n,_owner:o}};Qe.createContext=function(r){return r={$$typeof:A6,_currentValue:r,_currentValue2:r,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},r.Provider={$$typeof:j6,_context:r},r.Consumer=r};Qe.createElement=_3;Qe.createFactory=function(r){var e=_3.bind(null,r);return e.type=r,e};Qe.createRef=function(){return{current:null}};Qe.forwardRef=function(r){return{$$typeof:T6,render:r}};Qe.isValidElement=yS;Qe.lazy=function(r){return{$$typeof:P6,_payload:{_status:-1,_result:r},_init:M6}};Qe.memo=function(r,e){return{$$typeof:R6,type:r,compare:e===void 0?null:e}};Qe.startTransition=function(r){var e=ty.transition;ty.transition={};try{r()}finally{ty.transition=e}};Qe.unstable_act=N3;Qe.useCallback=function(r,e){return Cn.current.useCallback(r,e)};Qe.useContext=function(r){return Cn.current.useContext(r)};Qe.useDebugValue=function(){};Qe.useDeferredValue=function(r){return Cn.current.useDeferredValue(r)};Qe.useEffect=function(r,e){return Cn.current.useEffect(r,e)};Qe.useId=function(){return Cn.current.useId()};Qe.useImperativeHandle=function(r,e,t){return Cn.current.useImperativeHandle(r,e,t)};Qe.useInsertionEffect=function(r,e){return Cn.current.useInsertionEffect(r,e)};Qe.useLayoutEffect=function(r,e){return Cn.current.useLayoutEffect(r,e)};Qe.useMemo=function(r,e){return Cn.current.useMemo(r,e)};Qe.useReducer=function(r,e,t){return Cn.current.useReducer(r,e,t)};Qe.useRef=function(r){return Cn.current.useRef(r)};Qe.useState=function(r){return Cn.current.useState(r)};Qe.useSyncExternalStore=function(r,e,t){return Cn.current.useSyncExternalStore(r,e,t)};Qe.useTransition=function(){return Cn.current.useTransition()};Qe.version="18.3.1";m3.exports=Qe;var k=m3.exports;/**
10 * @license React
11 * react-jsx-runtime.production.min.js
12 *
13 * Copyright (c) Facebook, Inc. and its affiliates.
14 *
15 * This source code is licensed under the MIT license found in the
16 * LICENSE file in the root directory of this source tree.
17 */var B6=k,$6=Symbol.for("react.element"),U6=Symbol.for("react.fragment"),H6=Object.prototype.hasOwnProperty,z6=B6.__SECRET_INT
vendor: 11,398 bytes, lines 17-34
17ERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,q6={key:!0,ref:!0,__self:!0,__source:!0};function S3(r,e,t){var n,s={},i=null,o=null;t!==void 0&&(i=""+t),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(o=e.ref);for(n in e)H6.call(e,n)&&!q6.hasOwnProperty(n)&&(s[n]=e[n]);if(r&&r.defaultProps)for(n in e=r.defaultProps,e)s[n]===void 0&&(s[n]=e[n]);return{$$typeof:$6,type:r,key:i,ref:o,props:s,_owner:z6.current}}xx.Fragment=U6;xx.jsx=S3;xx.jsxs=S3;p3.exports=xx;var a=p3.exports,k3={exports:{}},fs={},C3={exports:{}},E3={};/**
18 * @license React
19 * scheduler.production.min.js
20 *
21 * Copyright (c) Facebook, Inc. and its affiliates.
22 *
23 * This source code is licensed under the MIT license found in the
24 * LICENSE file in the root directory of this source tree.
25 */(function(r){function e(I,z){var X=I.length;I.push(z);e:for(;0<X;){var F=X-1>>>1,q=I[F];if(0<s(q,z))I[F]=z,I[X]=q,X=F;else break e}}function t(I){return I.length===0?null:I[0]}function n(I){if(I.length===0)return null;var z=I[0],X=I.pop();if(X!==z){I[0]=X;e:for(var F=0,q=I.length,V=q>>>1;F<V;){var K=2*(F+1)-1,ee=I[K],Z=K+1,ie=I[Z];if(0>s(ee,X))Z<q&&0>s(ie,ee)?(I[F]=ie,I[Z]=X,F=Z):(I[F]=ee,I[K]=X,F=K);else if(Z<q&&0>s(ie,X))I[F]=ie,I[Z]=X,F=Z;else break e}}return z}function s(I,z){var X=I.sortIndex-z.sortIndex;return X!==0?X:I.id-z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;r.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();r.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,h=null,f=3,p=!1,m=!1,g=!1,v=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(I){for(var z=t(u);z!==null;){if(z.callback===null)n(u);else if(z.startTime<=I)n(u),z.sortIndex=z.expirationTime,e(c,z);else break;z=t(u)}}function _(I){if(g=!1,w(I),!m)if(t(c)!==null)m=!0,L(N);else{var z=t(u);z!==null&&B(_,z.startTime-I)}}function N(I,z){m=!1,g&&(g=!1,b(T),T=-1),p=!0;var X=f;try{for(w(z),h=t(c);h!==null&&(!(h.expirationTime>z)||I&&!H());){var F=h.callback;if(typeof F=="function"){h.callback=null,f=h.priorityLevel;var q=F(h.expirationTime<=z);z=r.unstable_now(),typeof q=="function"?h.callback=q:h===t(c)&&n(c),w(z)}else n(c);h=t(c)}if(h!==null)var V=!0;else{var K=t(u);K!==null&&B(_,K.startTime-z),V=!1}return V}finally{h=null,f=X,p=!1}}var S=!1,E=null,T=-1,D=5,R=-1;function H(){return!(r.unstable_now()-R<D)}function A(){if(E!==null){var I=r.unstable_now();R=I;var z=!0;try{z=E(!0,I)}finally{z?U():(S=!1,E=null)}}else S=!1}var U;if(typeof y=="function")U=function(){y(A)};else if(typeof MessageChannel<"u"){var C=new MessageChannel,M=C.port2;C.port1.onmessage=A,U=function(){M.postMessage(null)}}else U=function(){v(A,0)};function L(I){E=I,S||(S=!0,U())}function B(I,z){T=v(function(){I(r.unstable_now())},z)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(I){I.callback=null},r.unstable_continueExecution=function(){m||p||(m=!0,L(N))},r.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<I?Math.floor(1e3/I):5},r.unstable_getCurrentPriorityLevel=function(){return f},r.unstable_getFirstCallbackNode=function(){return t(c)},r.unstable_next=function(I){switch(f){case 1:case 2:case 3:var z=3;break;default:z=f}var X=f;f=z;try{return I()}finally{f=X}},r.unstable_pauseExecution=function(){},r.unstable_requestPaint=function(){},r.unstable_runWithPriority=function(I,z){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var X=f;f=I;try{return z()}finally{f=X}},r.unstable_scheduleCallback=function(I,z,X){var F=r.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?F+X:F):X=F,I){case 1:var q=-1;break;case 2:q=250;break;case 5:q=1073741823;break;case 4:q=1e4;break;default:q=5e3}return q=X+q,I={id:d++,callback:z,priorityLevel:I,startTime:X,expirationTime:q,sortIndex:-1},X>F?(I.sortIndex=X,e(u,I),t(c)===null&&I===t(u)&&(g?(b(T),T=-1):g=!0,B(_,X-F))):(I.sortIndex=q,e(c,I),m||p||(m=!0,L(N))),I},r.unstable_shouldYield=H,r.unstable_wrapCallback=function(I){var z=f;return function(){var X=f;f=z;try{return I.apply(this,arguments)}finally{f=X}}}})(E3);C3.exports=E3;var W6=C3.exports;/**
26 * @license React
27 * react-dom.production.min.js
28 *
29 * Copyright (c) Facebook, Inc. and its affiliates.
30 *
31 * This source code is licensed under the MIT license found in the
32 * LICENSE file in the root directory of this source tree.
33 */var V6=k,hs=W6;function we(r){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+r,t=1;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t]);return"Minified React error #"+r+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var j3=new Set,Rp={};function zu(r,e){Xh(r,e),Xh(r+"Capture",e)}function Xh(r,e){for(Rp[r]=e,r=0;r<e.length;r++)j3.add(e[r])}var uo=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),y2=Object.prototype.hasOwnProperty,G6=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,NE={},SE={};function X6(r){return y2.call(SE,r)?!0:y2.call(NE,r)?!1:G6.test(r)?SE[r]=!0:(NE[r]=!0,!1)}function Y6(r,e,t,n){if(t!==null&&t.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return n?!1:t!==null?!t.acceptsBooleans:(r=r.toLowerCase().slice(0,5),r!=="data-"&&r!=="aria-");default:return!1}}function K6(r,e,t,n){if(e===null||typeof e>"u"||Y6(r,e,t,n))return!0;if(n)return!1;if(t!==null)switch(t.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function En(r,e,t,n,s,i,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=n,this.attributeNamespace=s,this.mustUseProperty=t,this.propertyName=r,this.type=e,this.sanitizeURL=i,this.removeEmptyString=o}var Ur={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){Ur[r]=new En(r,0,!1,r,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(r){var e=r[0];Ur[e]=new En(e,1,!1,r[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(r){Ur[r]=new En(r,2,!1,r.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){Ur[r]=new En(r,2,!1,r,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(r){Ur[r]=new En(r,3,!1,r.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(r){Ur[r]=new En(r,3,!0,r,null,!1,!1)});["capture","download"].forEach(function(r){Ur[r]=new En(r,4,!1,r,null,!1,!1)});["cols","rows","size","span"].forEach(function(r){Ur[r]=new En(r,6,!1,r,null,!1,!1)});["rowSpan","start"].forEach(function(r){Ur[r]=new En(r,5,!1,r.toLowerCase(),null,!1,!1)});var bS=/[\-:]([a-z])/g;function xS(r){return r[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(r){var e=r.replace(bS,xS);Ur[e]=new En(e,1,!1,r,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(r){var e=r.replace(bS,xS);Ur[e]=new En(e,1,!1,r,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(r){var e=r.replace(bS,xS);Ur[e]=new En(e,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(r){Ur[r]=new En(r,1,!1,r.toLowerCase(),null,!1,!1)});Ur.xlinkHref=new En("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(r){Ur[r]=new En(r,1,!1,r.toLowerCase(),null,!0,!0)});function vS(r,e,t,n){var s=Ur.hasOwnProperty(e)?Ur[e]:null;(s!==null?s.type!==0:n||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(K6(e,t,s,n)&&(t=null),n||s===null?X6(e)&&(t===null?r.removeAttribute(e):r.setAttribute(e,""+t)):s.mustUseProperty?r[s.propertyName]=t===null?s.type===3?!1:"":t:(e=s.attributeName,n=s.attributeNamespace,t===null?r.removeAttribute(e):(s=s.type,t=s===3||s===4&&t===!0?"":""+t,n?r.setAttributeNS(n,e,t):r.setAttribute(e,t))))}var _o=V6.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,u0=Symbol.for("react.element"),wd=Symbol.for("react.portal"),_d=Symbol.for("react.fragment"),wS=Symbol.for("react.strict_mode"),b2=Symbol.for("react.profiler"),A3=Symbol.for("react.provider"),T3=Symbol.for("react.context"),_S=Symbol.for("react.forward_ref"),x2=Symbol.for("react.suspense"),v2=Symbol.for("react.suspense_list"),NS=Symbol.for("react.memo"),Lo=Symbol.for("react.lazy"),D3=Symbol.for("react.offscreen"),kE=Symbol.iterator;function Pf(r){return r===null||typeof r!="object"?null:(r=kE&&r[kE]||r["@@iterator"],typeof r=="function"?r:null)}var Xt=Object.assign,Qv;function Xf(r){if(Qv===void 0)try{throw Error()}catch(t){var e=t.stack.trim().match(/\n( *(at )?)/);Qv=e&&e[1]||""}return`
34`+Qv+r}var ew=!1;function tw(r,e){if(!r||ew)return"";ew=!0;var t=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(u){var n=u}Reflect.construct(r,[],e)}else{try{e.call()}catch(u){n=u}r.call(e.prototype)}else{try{throw Error()}catch(u){n=u}r()}}
vendor: 16,024 bytes, lines 34-37
34catch(u){if(u&&n&&typeof u.stack=="string"){for(var s=u.stack.split(`
35`),i=n.stack.split(`
36`),o=s.length-1,l=i.length-1;1<=o&&0<=l&&s[o]!==i[l];)l--;for(;1<=o&&0<=l;o--,l--)if(s[o]!==i[l]){if(o!==1||l!==1)do if(o--,l--,0>l||s[o]!==i[l]){var c=`
37`+s[o].replace(" at new "," at ");return r.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",r.displayName)),c}while(1<=o&&0<=l);break}}}finally{ew=!1,Error.prepareStackTrace=t}return(r=r?r.displayName||r.name:"")?Xf(r):""}function J6(r){switch(r.tag){case 5:return Xf(r.type);case 16:return Xf("Lazy");case 13:return Xf("Suspense");case 19:return Xf("SuspenseList");case 0:case 2:case 15:return r=tw(r.type,!1),r;case 11:return r=tw(r.type.render,!1),r;case 1:return r=tw(r.type,!0),r;default:return""}}function w2(r){if(r==null)return null;if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case _d:return"Fragment";case wd:return"Portal";case b2:return"Profiler";case wS:return"StrictMode";case x2:return"Suspense";case v2:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case T3:return(r.displayName||"Context")+".Consumer";case A3:return(r._context.displayName||"Context")+".Provider";case _S:var e=r.render;return r=r.displayName,r||(r=e.displayName||e.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case NS:return e=r.displayName||null,e!==null?e:w2(r.type)||"Memo";case Lo:e=r._payload,r=r._init;try{return w2(r(e))}catch{}}return null}function Z6(r){var e=r.type;switch(r.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return r=e.render,r=r.displayName||r.name||"",e.displayName||(r!==""?"ForwardRef("+r+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return w2(e);case 8:return e===wS?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Tl(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function R3(r){var e=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Q6(r){var e=R3(r)?"checked":"value",t=Object.getOwnPropertyDescriptor(r.constructor.prototype,e),n=""+r[e];if(!r.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var s=t.get,i=t.set;return Object.defineProperty(r,e,{configurable:!0,get:function(){return s.call(this)},set:function(o){n=""+o,i.call(this,o)}}),Object.defineProperty(r,e,{enumerable:t.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){r._valueTracker=null,delete r[e]}}}}function d0(r){r._valueTracker||(r._valueTracker=Q6(r))}function P3(r){if(!r)return!1;var e=r._valueTracker;if(!e)return!0;var t=e.getValue(),n="";return r&&(n=R3(r)?r.checked?"true":"false":r.value),r=n,r!==t?(e.setValue(r),!0):!1}function Zy(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}function _2(r,e){var t=e.checked;return Xt({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??r._wrapperState.initialChecked})}function CE(r,e){var t=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;t=Tl(e.value!=null?e.value:t),r._wrapperState={initialChecked:n,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function I3(r,e){e=e.checked,e!=null&&vS(r,"checked",e,!1)}function N2(r,e){I3(r,e);var t=Tl(e.value),n=e.type;if(t!=null)n==="number"?(t===0&&r.value===""||r.value!=t)&&(r.value=""+t):r.value!==""+t&&(r.value=""+t);else if(n==="submit"||n==="reset"){r.removeAttribute("value");return}e.hasOwnProperty("value")?S2(r,e.type,t):e.hasOwnProperty("defaultValue")&&S2(r,e.type,Tl(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(r.defaultChecked=!!e.defaultChecked)}function EE(r,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+r._wrapperState.initialValue,t||e===r.value||(r.value=e),r.defaultValue=e}t=r.name,t!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,t!==""&&(r.name=t)}function S2(r,e,t){(e!=="number"||Zy(r.ownerDocument)!==r)&&(t==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+t&&(r.defaultValue=""+t))}var Yf=Array.isArray;function Bd(r,e,t,n){if(r=r.options,e){e={};for(var s=0;s<t.length;s++)e["$"+t[s]]=!0;for(t=0;t<r.length;t++)s=e.hasOwnProperty("$"+r[t].value),r[t].selected!==s&&(r[t].selected=s),s&&n&&(r[t].defaultSelected=!0)}else{for(t=""+Tl(t),e=null,s=0;s<r.length;s++){if(r[s].value===t){r[s].selected=!0,n&&(r[s].defaultSelected=!0);return}e!==null||r[s].disabled||(e=r[s])}e!==null&&(e.selected=!0)}}function k2(r,e){if(e.dangerouslySetInnerHTML!=null)throw Error(we(91));return Xt({},e,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function jE(r,e){var t=e.value;if(t==null){if(t=e.children,e=e.defaultValue,t!=null){if(e!=null)throw Error(we(92));if(Yf(t)){if(1<t.length)throw Error(we(93));t=t[0]}e=t}e==null&&(e=""),t=e}r._wrapperState={initialValue:Tl(t)}}function L3(r,e){var t=Tl(e.value),n=Tl(e.defaultValue);t!=null&&(t=""+t,t!==r.value&&(r.value=t),e.defaultValue==null&&r.defaultValue!==t&&(r.defaultValue=t)),n!=null&&(r.defaultValue=""+n)}function AE(r){var e=r.textContent;e===r._wrapperState.initialValue&&e!==""&&e!==null&&(r.value=e)}function O3(r){switch(r){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function C2(r,e){return r==null||r==="http://www.w3.org/1999/xhtml"?O3(e):r==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var h0,M3=function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,t,n,s){MSApp.execUnsafeLocalFunction(function(){return r(e,t,n,s)})}:r}(function(r,e){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=e;else{for(h0=h0||document.createElement("div"),h0.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=h0.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;e.firstChild;)r.appendChild(e.firstChild)}});function Pp(r,e){if(e){var t=r.firstChild;if(t&&t===r.lastChild&&t.nodeType===3){t.nodeValue=e;return}}r.textContent=e}var pp={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},eM=["Webkit","ms","Moz","O"];Object.keys(pp).forEach(function(r){eM.forEach(function(e){e=e+r.charAt(0).toUpperCase()+r.substring(1),pp[e]=pp[r]})});function F3(r,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||pp.hasOwnProperty(r)&&pp[r]?(""+e).trim():e+"px"}function B3(r,e){r=r.style;for(var t in e)if(e.hasOwnProperty(t)){var n=t.indexOf("--")===0,s=F3(t,e[t],n);t==="float"&&(t="cssFloat"),n?r.setProperty(t,s):r[t]=s}}var tM=Xt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function E2(r,e){if(e){if(tM[r]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(we(137,r));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(we(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(we(61))}if(e.style!=null&&typeof e.style!="object")throw Error(we(62))}}function j2(r,e){if(r.indexOf("-")===-1)return typeof e.is=="string";switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var A2=null;function SS(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var T2=null,$d=null,Ud=null;function TE(r){if(r=Ig(r)){if(typeof T2!="function")throw Error(we(280));var e=r.stateNode;e&&(e=Sx(e),T2(r.stateNode,r.type,e))}}function $3(r){$d?Ud?Ud.push(r):Ud=[r]:$d=r}function U3(){if($d){var r=$d,e=Ud;if(Ud=$d=null,TE(r),e)for(r=0;r<e.length;r++)TE(e[r])}}function H3(r,e){return r(e)}function z3(){}var rw=!1;function q3(r,e,t){if(rw)return r(e,t);rw=!0;try{return H3(r,e,t)}finally{rw=!1,($d!==null||Ud!==null)&&(z3(),U3())}}function Ip(r,e){var t=r.stateNode;if(t===null)return null;var n=Sx(t);if(n===null)return null;t=n[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(r=r.type,n=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!n;break e;default:r=!1}if(r)return null;if(t&&typeof t!="function")throw Error(we(231,e,typeof t));return t}var D2=!1;if(uo)try{var If={};Object.defineProperty(If,"passive",{get:function(){D2=!0}}),window.addEventListener("test",If,If),window.removeEventListener("test",If,If)}catch{D2=!1}function rM(r,e,t,n,s,i,o,l,c){var u=Array.prototype.slice.call(arguments,3);try{e.apply(t,u)}catch(d){this.onError(d)}}var mp=!1,Qy=null,eb=!1,R2=null,nM={onError:function(r){mp=!0,Qy=r}};function sM(r,e,t,n,s,i,o,l,c){mp=!1,Qy=null,rM.apply(nM,arguments)}function iM(r,e,t,n,s,i,o,l,c){if(sM.apply(this,arguments),mp){if(mp){var u=Qy;mp=!1,Qy=null}else throw Error(we(198));eb||(eb=!0,R2=u)}}function qu(r){var e=r,t=r;if(r.alternate)for(;e.return;)e=e.return;else{r=e;do e=r,e.flags&4098&&(t=e.return),r=e.return;while(r)}return e.tag===3?t:null}function W3(r){if(r.tag===13){var e=r.memoizedState;if(e===null&&(r=r.alternate,r!==null&&(e=r.memoizedState)),e!==null)return e.dehydrated}return null}function DE(r){if(qu(r)!==r)throw Error(we(188))}function aM(r){var e=r.alternate;if(!e){if(e=qu(r),e===null)throw Error(we(188));return e!==r?null:r}for(var t=r,n=e;;){var s=t.return;if(s===null)break;var i=s.alternate;if(i===null){if(n=s.return,n!==null){t=n;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===t)return DE(s),r;if(i===n)return DE(s),e;i=i.sibling}throw Error(we(188))}if(t.return!==n.return)t=s,n=i;else{for(var o=!1,l=s.child;l;){if(l===t){o=!0,t=s,n=i;break}if(l===n){o=!0,n=s,t=i;break}l=l.sibling}if(!o){for(l=i.child;l;){if(l===t){o=!0,t=i,n=s;break}if(l===n){o=!0,n=i,t=s;break}l=l.sibling}if(!o)throw Error(we(189))}}if(t.alternate!==n)throw Error(we(190))}if(t.tag!==3)throw Error(we(188));return t.stateNode.current===t?r:e}function V3(r){return r=aM(r),r!==null?G3(r):null}function G3(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var e=G3(r);if(e!==null)return e;r=r.sibling}return null}var X3=hs.unstable_scheduleCallback,RE=hs.unstable_cancelCallback,oM=hs.unstable_shouldYield,lM=hs.unstable_requestPaint,Zt=hs.unstable_now,cM=hs.unstable_getCurrentPriorityLevel,kS=hs.unstable_ImmediatePriority,Y3=hs.unstable_UserBlockingPriority,tb=hs.unstable_NormalPriority,uM=hs.unstable_LowPriority,K3=hs.unstable_IdlePriority,vx=null,aa=null;function dM(r){if(aa&&typeof aa.onCommitFiberRoot=="function")try{aa.onCommitFiberRoot(vx,r,void 0,(r.current.flags&128)===128)}catch{}}var _i=Math.clz32?Math.clz32:pM,hM=Math.log,fM=Math.LN2;function pM(r){return r>>>=0,r===0?32:31-(hM(r)/fM|0)|0}var f0=64,p0=4194304;function Kf(r){switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return r&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return r}}function rb(r,e){var t=r.pendingLanes;if(t===0)return 0;var n=0,s=r.suspendedLanes,i=r.pingedLanes,o=t&268435455;if(o!==0){var l=o&~s;l!==0?n=Kf(l):(i&=o,i!==0&&(n=Kf(i)))}else o=t&~s,o!==0?n=Kf(o):i!==0&&(n=Kf(i));if(n===0)return 0;if(e!==0&&e!==n&&!(e&s)&&(s=n&-n,i=e&-e,s>=i||s===16&&(i&4194240)!==0))return e;if(n&4&&(n|=t&16),e=r.entangledLanes,e!==0)for(r=r.entanglements,e&=n;0<e;)t=31-_i(e),s=1<<t,n|=r[t],e&=~s;return n}function mM(r,e){switch(r){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function gM(r,e){for(var t=r.suspendedLanes,n=r.pingedLanes,s=r.expirationTimes,i=r.pendingLanes;0<i;){var o=31-_i(i),l=1<<o,c=s[o];c===-1?(!(l&t)||l&n)&&(s[o]=mM(l,e)):c<=e&&(r.expiredLanes|=l),i&=~l}}function P2(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function J3(){var r=f0;return f0<<=1,!(f0&4194240)&&(f0=64),r}function nw(r){for(var e=[],t=0;31>t;t++)e.push(r);return e}function Rg(r,e,t){r.pendingLanes|=e,e!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,e=31-_i(e),r[e]=t}function yM(r,e){var t=r.pendingLanes&~e;r.pendingLanes=e,r.suspendedLanes=0,r.pingedLanes=0,r.expiredLanes&=e,r.mutableReadLanes&=e,r.entangledLanes&=e,e=r.entanglements;var n=r.eventTimes;for(r=r.expirationTimes;0<t;){var s=31-_i(t),i=1<<s;e[s]=0,n[s]=-1,r[s]=-1,t&=~i}}function CS(r,e){var t=r.entangledLanes|=e;for(r=r.entanglements;t;){var n=31-_i(t),s=1<<n;s&e|r[n]&e&&(r[n]|=e),t&=~s}}var yt=0;function Z3(r){return r&=-r,1<r?4<r?r&268435455?16:536870912:4:1}var Q3,ES,e4,t4,r4,I2=!1,m0=[],vl=null,wl=null,_l=null,Lp=new Map,Op=new Map,Fo=[],bM="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function PE(r,e){switch(r){case"focusin":case"focusout":vl=null;break;case"dragenter":case"dragleave":wl=null;break;case"mouseover":case"mouseout":_l=null;break;case"pointerover":case"pointerout":Lp.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Op.delete(e.pointerId)}}function Lf(r,e,t,n,s,i){return r===null||r.nativeEvent!==i?(r={blockedOn:e,domEventName:t,eventSystemFlags:n,nativeEvent:i,targetContainers:[s]},e!==null&&(e=Ig(e),e!==null&&ES(e)),r):(r.eventSystemFlags|=n,e=r.targetContainers,s!==null&&e.indexOf(s)===-1&&e.push(s),r)}function xM(r,e,t,n,s){switch(e){case"focusin":return vl=Lf(vl,r,e,t,n,s),!0;case"dragenter":return wl=Lf(wl,r,e,t,n,s),!0;case"mouseover":return _l=Lf(_l,r,e,t,n,s),!0;case"pointerover":var i=s.pointerId;return Lp.set(i,Lf(Lp.get(i)||null,r,e,t,n,s)),!0;case"gotpointercapture":return i=s.pointerId,Op.set(i,Lf(Op.get(i)||null,r,e,t,n,s)),!0}return!1}function n4(r){var e=gc(r.target);if(e!==null){var t=qu(e);
vendor: 12,250 bytes, line 37
37if(t!==null){if(e=t.tag,e===13){if(e=W3(t),e!==null){r.blockedOn=e,r4(r.priority,function(){e4(t)});return}}else if(e===3&&t.stateNode.current.memoizedState.isDehydrated){r.blockedOn=t.tag===3?t.stateNode.containerInfo:null;return}}}r.blockedOn=null}function ry(r){if(r.blockedOn!==null)return!1;for(var e=r.targetContainers;0<e.length;){var t=L2(r.domEventName,r.eventSystemFlags,e[0],r.nativeEvent);if(t===null){t=r.nativeEvent;var n=new t.constructor(t.type,t);A2=n,t.target.dispatchEvent(n),A2=null}else return e=Ig(t),e!==null&&ES(e),r.blockedOn=t,!1;e.shift()}return!0}function IE(r,e,t){ry(r)&&t.delete(e)}function vM(){I2=!1,vl!==null&&ry(vl)&&(vl=null),wl!==null&&ry(wl)&&(wl=null),_l!==null&&ry(_l)&&(_l=null),Lp.forEach(IE),Op.forEach(IE)}function Of(r,e){r.blockedOn===e&&(r.blockedOn=null,I2||(I2=!0,hs.unstable_scheduleCallback(hs.unstable_NormalPriority,vM)))}function Mp(r){function e(s){return Of(s,r)}if(0<m0.length){Of(m0[0],r);for(var t=1;t<m0.length;t++){var n=m0[t];n.blockedOn===r&&(n.blockedOn=null)}}for(vl!==null&&Of(vl,r),wl!==null&&Of(wl,r),_l!==null&&Of(_l,r),Lp.forEach(e),Op.forEach(e),t=0;t<Fo.length;t++)n=Fo[t],n.blockedOn===r&&(n.blockedOn=null);for(;0<Fo.length&&(t=Fo[0],t.blockedOn===null);)n4(t),t.blockedOn===null&&Fo.shift()}var Hd=_o.ReactCurrentBatchConfig,nb=!0;function wM(r,e,t,n){var s=yt,i=Hd.transition;Hd.transition=null;try{yt=1,jS(r,e,t,n)}finally{yt=s,Hd.transition=i}}function _M(r,e,t,n){var s=yt,i=Hd.transition;Hd.transition=null;try{yt=4,jS(r,e,t,n)}finally{yt=s,Hd.transition=i}}function jS(r,e,t,n){if(nb){var s=L2(r,e,t,n);if(s===null)fw(r,e,n,sb,t),PE(r,n);else if(xM(s,r,e,t,n))n.stopPropagation();else if(PE(r,n),e&4&&-1<bM.indexOf(r)){for(;s!==null;){var i=Ig(s);if(i!==null&&Q3(i),i=L2(r,e,t,n),i===null&&fw(r,e,n,sb,t),i===s)break;s=i}s!==null&&n.stopPropagation()}else fw(r,e,n,null,t)}}var sb=null;function L2(r,e,t,n){if(sb=null,r=SS(n),r=gc(r),r!==null)if(e=qu(r),e===null)r=null;else if(t=e.tag,t===13){if(r=W3(e),r!==null)return r;r=null}else if(t===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;r=null}else e!==r&&(r=null);return sb=r,null}function s4(r){switch(r){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(cM()){case kS:return 1;case Y3:return 4;case tb:case uM:return 16;case K3:return 536870912;default:return 16}default:return 16}}var gl=null,AS=null,ny=null;function i4(){if(ny)return ny;var r,e=AS,t=e.length,n,s="value"in gl?gl.value:gl.textContent,i=s.length;for(r=0;r<t&&e[r]===s[r];r++);var o=t-r;for(n=1;n<=o&&e[t-n]===s[i-n];n++);return ny=s.slice(r,1<n?1-n:void 0)}function sy(r){var e=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&e===13&&(r=13)):r=e,r===10&&(r=13),32<=r||r===13?r:0}function g0(){return!0}function LE(){return!1}function ps(r){function e(t,n,s,i,o){this._reactName=t,this._targetInst=s,this.type=n,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var l in r)r.hasOwnProperty(l)&&(t=r[l],this[l]=t?t(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?g0:LE,this.isPropagationStopped=LE,this}return Xt(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var t=this.nativeEvent;t&&(t.preventDefault?t.preventDefault():typeof t.returnValue!="unknown"&&(t.returnValue=!1),this.isDefaultPrevented=g0)},stopPropagation:function(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():typeof t.cancelBubble!="unknown"&&(t.cancelBubble=!0),this.isPropagationStopped=g0)},persist:function(){},isPersistent:g0}),e}var gf={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},TS=ps(gf),Pg=Xt({},gf,{view:0,detail:0}),NM=ps(Pg),sw,iw,Mf,wx=Xt({},Pg,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:DS,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Mf&&(Mf&&r.type==="mousemove"?(sw=r.screenX-Mf.screenX,iw=r.screenY-Mf.screenY):iw=sw=0,Mf=r),sw)},movementY:function(r){return"movementY"in r?r.movementY:iw}}),OE=ps(wx),SM=Xt({},wx,{dataTransfer:0}),kM=ps(SM),CM=Xt({},Pg,{relatedTarget:0}),aw=ps(CM),EM=Xt({},gf,{animationName:0,elapsedTime:0,pseudoElement:0}),jM=ps(EM),AM=Xt({},gf,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),TM=ps(AM),DM=Xt({},gf,{data:0}),ME=ps(DM),RM={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},PM={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},IM={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function LM(r){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(r):(r=IM[r])?!!e[r]:!1}function DS(){return LM}var OM=Xt({},Pg,{key:function(r){if(r.key){var e=RM[r.key]||r.key;if(e!=="Unidentified")return e}return r.type==="keypress"?(r=sy(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?PM[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:DS,charCode:function(r){return r.type==="keypress"?sy(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?sy(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),MM=ps(OM),FM=Xt({},wx,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),FE=ps(FM),BM=Xt({},Pg,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:DS}),$M=ps(BM),UM=Xt({},gf,{propertyName:0,elapsedTime:0,pseudoElement:0}),HM=ps(UM),zM=Xt({},wx,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),qM=ps(zM),WM=[9,13,27,32],RS=uo&&"CompositionEvent"in window,gp=null;uo&&"documentMode"in document&&(gp=document.documentMode);var VM=uo&&"TextEvent"in window&&!gp,a4=uo&&(!RS||gp&&8<gp&&11>=gp),BE=" ",$E=!1;function o4(r,e){switch(r){case"keyup":return WM.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function l4(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Nd=!1;function GM(r,e){switch(r){case"compositionend":return l4(e);case"keypress":return e.which!==32?null:($E=!0,BE);case"textInput":return r=e.data,r===BE&&$E?null:r;default:return null}}function XM(r,e){if(Nd)return r==="compositionend"||!RS&&o4(r,e)?(r=i4(),ny=AS=gl=null,Nd=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return a4&&e.locale!=="ko"?null:e.data;default:return null}}var YM={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function UE(r){var e=r&&r.nodeName&&r.nodeName.toLowerCase();return e==="input"?!!YM[r.type]:e==="textarea"}function c4(r,e,t,n){$3(n),e=ib(e,"onChange"),0<e.length&&(t=new TS("onChange","change",null,t,n),r.push({event:t,listeners:e}))}var yp=null,Fp=null;function KM(r){v4(r,0)}function _x(r){var e=Cd(r);if(P3(e))return r}function JM(r,e){if(r==="change")return e}var u4=!1;if(uo){var ow;if(uo){var lw="oninput"in document;if(!lw){var HE=document.createElement("div");HE.setAttribute("oninput","return;"),lw=typeof HE.oninput=="function"}ow=lw}else ow=!1;u4=ow&&(!document.documentMode||9<document.documentMode)}function zE(){yp&&(yp.detachEvent("onpropertychange",d4),Fp=yp=null)}function d4(r){if(r.propertyName==="value"&&_x(Fp)){var e=[];c4(e,Fp,r,SS(r)),q3(KM,e)}}function ZM(r,e,t){r==="focusin"?(zE(),yp=e,Fp=t,yp.attachEvent("onpropertychange",d4)):r==="focusout"&&zE()}function QM(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return _x(Fp)}function eF(r,e){if(r==="click")return _x(e)}function tF(r,e){if(r==="input"||r==="change")return _x(e)}function rF(r,e){return r===e&&(r!==0||1/r===1/e)||r!==r&&e!==e}var Ci=typeof Object.is=="function"?Object.is:rF;function Bp(r,e){if(Ci(r,e))return!0;if(typeof r!="object"||r===null||typeof e!="object"||e===null)return!1;var t=Object.keys(r),n=Object.keys(e);if(t.length!==n.length)return!1;for(n=0;n<t.length;n++){var s=t[n];if(!y2.call(e,s)||!Ci(r[s],e[s]))return!1}return!0}function qE(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function WE(r,e){var t=qE(r);r=0;for(var n;t;){if(t.nodeType===3){if(n=r+t.textContent.length,r<=e&&n>=e)return{node:t,offset:e-r};r=n}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=qE(t)}}function h4(r,e){return r&&e?r===e?!0:r&&r.nodeType===3?!1:e&&e.nodeType===3?h4(r,e.parentNode):"contains"in r?r.contains(e):r.compareDocumentPosition?!!(r.compareDocumentPosition(e)&16):!1:!1}function f4(){for(var r=window,e=Zy();e instanceof r.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)r=e.contentWindow;else break;e=Zy(r.document)}return e}function PS(r){var e=r&&r.nodeName&&r.nodeName.toLowerCase();return e&&(e==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||e==="textarea"||r.contentEditable==="true")}function nF(r){var e=f4(),t=r.focusedElem,n=r.selectionRange;if(e!==t&&t&&t.ownerDocument&&h4(t.ownerDocument.documentElement,t)){if(n!==null&&PS(t)){if(e=n.start,r=n.end,r===void 0&&(r=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(r,t.value.length);else if(r=(e=t.ownerDocument||document)&&e.defaultView||window,r.getSelection){r=r.getSelection();var s=t.textContent.length,i=Math.min(n.start,s);n=n.end===void 0?i:Math.min(n.end,s),!r.extend&&i>n&&(s=n,n=i,i=s),s=WE(t,i);var o=WE(t,n);s&&o&&(r.rangeCount!==1||r.anchorNode!==s.node||r.anchorOffset!==s.offset||r.focusNode!==o.node||r.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(s.node,s.offset),r.removeAllRanges(),i>n?(r.addRange(e),r.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),r.addRange(e)))}}for(e=[],r=t;r=r.parentNode;)r.nodeType===1&&e.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t<e.length;t++)r=e[t],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var sF=uo&&"documentMode"in document&&11>=document.documentMode,Sd=null,O2=null,bp=null,M2=!1;
vendor: 4,703 bytes, line 37
37function VE(r,e,t){var n=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;M2||Sd==null||Sd!==Zy(n)||(n=Sd,"selectionStart"in n&&PS(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),bp&&Bp(bp,n)||(bp=n,n=ib(O2,"onSelect"),0<n.length&&(e=new TS("onSelect","select",null,e,t),r.push({event:e,listeners:n}),e.target=Sd)))}function y0(r,e){var t={};return t[r.toLowerCase()]=e.toLowerCase(),t["Webkit"+r]="webkit"+e,t["Moz"+r]="moz"+e,t}var kd={animationend:y0("Animation","AnimationEnd"),animationiteration:y0("Animation","AnimationIteration"),animationstart:y0("Animation","AnimationStart"),transitionend:y0("Transition","TransitionEnd")},cw={},p4={};uo&&(p4=document.createElement("div").style,"AnimationEvent"in window||(delete kd.animationend.animation,delete kd.animationiteration.animation,delete kd.animationstart.animation),"TransitionEvent"in window||delete kd.transitionend.transition);function Nx(r){if(cw[r])return cw[r];if(!kd[r])return r;var e=kd[r],t;for(t in e)if(e.hasOwnProperty(t)&&t in p4)return cw[r]=e[t];return r}var m4=Nx("animationend"),g4=Nx("animationiteration"),y4=Nx("animationstart"),b4=Nx("transitionend"),x4=new Map,GE="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function $l(r,e){x4.set(r,e),zu(e,[r])}for(var uw=0;uw<GE.length;uw++){var dw=GE[uw],iF=dw.toLowerCase(),aF=dw[0].toUpperCase()+dw.slice(1);$l(iF,"on"+aF)}$l(m4,"onAnimationEnd");$l(g4,"onAnimationIteration");$l(y4,"onAnimationStart");$l("dblclick","onDoubleClick");$l("focusin","onFocus");$l("focusout","onBlur");$l(b4,"onTransitionEnd");Xh("onMouseEnter",["mouseout","mouseover"]);Xh("onMouseLeave",["mouseout","mouseover"]);Xh("onPointerEnter",["pointerout","pointerover"]);Xh("onPointerLeave",["pointerout","pointerover"]);zu("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));zu("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));zu("onBeforeInput",["compositionend","keypress","textInput","paste"]);zu("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));zu("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));zu("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Jf="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),oF=new Set("cancel close invalid load scroll toggle".split(" ").concat(Jf));function XE(r,e,t){var n=r.type||"unknown-event";r.currentTarget=t,iM(n,e,void 0,r),r.currentTarget=null}function v4(r,e){e=(e&4)!==0;for(var t=0;t<r.length;t++){var n=r[t],s=n.event;n=n.listeners;e:{var i=void 0;if(e)for(var o=n.length-1;0<=o;o--){var l=n[o],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==i&&s.isPropagationStopped())break e;XE(s,l,u),i=c}else for(o=0;o<n.length;o++){if(l=n[o],c=l.instance,u=l.currentTarget,l=l.listener,c!==i&&s.isPropagationStopped())break e;XE(s,l,u),i=c}}}if(eb)throw r=R2,eb=!1,R2=null,r}function Rt(r,e){var t=e[H2];t===void 0&&(t=e[H2]=new Set);var n=r+"__bubble";t.has(n)||(w4(e,r,2,!1),t.add(n))}function hw(r,e,t){var n=0;e&&(n|=4),w4(t,r,n,e)}var b0="_reactListening"+Math.random().toString(36).slice(2);function $p(r){if(!r[b0]){r[b0]=!0,j3.forEach(function(t){t!=="selectionchange"&&(oF.has(t)||hw(t,!1,r),hw(t,!0,r))});var e=r.nodeType===9?r:r.ownerDocument;e===null||e[b0]||(e[b0]=!0,hw("selectionchange",!1,e))}}function w4(r,e,t,n){switch(s4(e)){case 1:var s=wM;break;case 4:s=_M;break;default:s=jS}t=s.bind(null,e,t,r),s=void 0,!D2||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(s=!0),n?s!==void 0?r.addEventListener(e,t,{capture:!0,passive:s}):r.addEventListener(e,t,!0):s!==void 0?r.addEventListener(e,t,{passive:s}):r.addEventListener(e,t,!1)}function fw(r,e,t,n,s){var i=n;
vendor: 21,895 bytes, lines 37-38
37if(!(e&1)&&!(e&2)&&n!==null)e:for(;;){if(n===null)return;var o=n.tag;if(o===3||o===4){var l=n.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(o===4)for(o=n.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===s||c.nodeType===8&&c.parentNode===s))return;o=o.return}for(;l!==null;){if(o=gc(l),o===null)return;if(c=o.tag,c===5||c===6){n=i=o;continue e}l=l.parentNode}}n=n.return}q3(function(){var u=i,d=SS(t),h=[];e:{var f=x4.get(r);if(f!==void 0){var p=TS,m=r;switch(r){case"keypress":if(sy(t)===0)break e;case"keydown":case"keyup":p=MM;break;case"focusin":m="focus",p=aw;break;case"focusout":m="blur",p=aw;break;case"beforeblur":case"afterblur":p=aw;break;case"click":if(t.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=OE;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=kM;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=$M;break;case m4:case g4:case y4:p=jM;break;case b4:p=HM;break;case"scroll":p=NM;break;case"wheel":p=qM;break;case"copy":case"cut":case"paste":p=TM;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=FE}var g=(e&4)!==0,v=!g&&r==="scroll",b=g?f!==null?f+"Capture":null:f;g=[];for(var y=u,w;y!==null;){w=y;var _=w.stateNode;if(w.tag===5&&_!==null&&(w=_,b!==null&&(_=Ip(y,b),_!=null&&g.push(Up(y,_,w)))),v)break;y=y.return}0<g.length&&(f=new p(f,m,null,t,d),h.push({event:f,listeners:g}))}}if(!(e&7)){e:{if(f=r==="mouseover"||r==="pointerover",p=r==="mouseout"||r==="pointerout",f&&t!==A2&&(m=t.relatedTarget||t.fromElement)&&(gc(m)||m[ho]))break e;if((p||f)&&(f=d.window===d?d:(f=d.ownerDocument)?f.defaultView||f.parentWindow:window,p?(m=t.relatedTarget||t.toElement,p=u,m=m?gc(m):null,m!==null&&(v=qu(m),m!==v||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=u),p!==m)){if(g=OE,_="onMouseLeave",b="onMouseEnter",y="mouse",(r==="pointerout"||r==="pointerover")&&(g=FE,_="onPointerLeave",b="onPointerEnter",y="pointer"),v=p==null?f:Cd(p),w=m==null?f:Cd(m),f=new g(_,y+"leave",p,t,d),f.target=v,f.relatedTarget=w,_=null,gc(d)===u&&(g=new g(b,y+"enter",m,t,d),g.target=w,g.relatedTarget=v,_=g),v=_,p&&m)t:{for(g=p,b=m,y=0,w=g;w;w=Zu(w))y++;for(w=0,_=b;_;_=Zu(_))w++;for(;0<y-w;)g=Zu(g),y--;for(;0<w-y;)b=Zu(b),w--;for(;y--;){if(g===b||b!==null&&g===b.alternate)break t;g=Zu(g),b=Zu(b)}g=null}else g=null;p!==null&&YE(h,f,p,g,!1),m!==null&&v!==null&&YE(h,v,m,g,!0)}}e:{if(f=u?Cd(u):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var N=JM;else if(UE(f))if(u4)N=tF;else{N=QM;var S=ZM}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(N=eF);if(N&&(N=N(r,u))){c4(h,N,t,d);break e}S&&S(r,f,u),r==="focusout"&&(S=f._wrapperState)&&S.controlled&&f.type==="number"&&S2(f,"number",f.value)}switch(S=u?Cd(u):window,r){case"focusin":(UE(S)||S.contentEditable==="true")&&(Sd=S,O2=u,bp=null);break;case"focusout":bp=O2=Sd=null;break;case"mousedown":M2=!0;break;case"contextmenu":case"mouseup":case"dragend":M2=!1,VE(h,t,d);break;case"selectionchange":if(sF)break;case"keydown":case"keyup":VE(h,t,d)}var E;if(RS)e:{switch(r){case"compositionstart":var T="onCompositionStart";break e;case"compositionend":T="onCompositionEnd";break e;case"compositionupdate":T="onCompositionUpdate";break e}T=void 0}else Nd?o4(r,t)&&(T="onCompositionEnd"):r==="keydown"&&t.keyCode===229&&(T="onCompositionStart");T&&(a4&&t.locale!=="ko"&&(Nd||T!=="onCompositionStart"?T==="onCompositionEnd"&&Nd&&(E=i4()):(gl=d,AS="value"in gl?gl.value:gl.textContent,Nd=!0)),S=ib(u,T),0<S.length&&(T=new ME(T,r,null,t,d),h.push({event:T,listeners:S}),E?T.data=E:(E=l4(t),E!==null&&(T.data=E)))),(E=VM?GM(r,t):XM(r,t))&&(u=ib(u,"onBeforeInput"),0<u.length&&(d=new ME("onBeforeInput","beforeinput",null,t,d),h.push({event:d,listeners:u}),d.data=E))}v4(h,e)})}function Up(r,e,t){return{instance:r,listener:e,currentTarget:t}}function ib(r,e){for(var t=e+"Capture",n=[];r!==null;){var s=r,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=Ip(r,t),i!=null&&n.unshift(Up(r,i,s)),i=Ip(r,e),i!=null&&n.push(Up(r,i,s))),r=r.return}return n}function Zu(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function YE(r,e,t,n,s){for(var i=e._reactName,o=[];t!==null&&t!==n;){var l=t,c=l.alternate,u=l.stateNode;if(c!==null&&c===n)break;l.tag===5&&u!==null&&(l=u,s?(c=Ip(t,i),c!=null&&o.unshift(Up(t,c,l))):s||(c=Ip(t,i),c!=null&&o.push(Up(t,c,l)))),t=t.return}o.length!==0&&r.push({event:e,listeners:o})}var lF=/\r\n?/g,cF=/\u0000|\uFFFD/g;function KE(r){return(typeof r=="string"?r:""+r).replace(lF,`
38`).replace(cF,"")}function x0(r,e,t){if(e=KE(e),KE(r)!==e&&t)throw Error(we(425))}function ab(){}var F2=null,B2=null;function $2(r,e){return r==="textarea"||r==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var U2=typeof setTimeout=="function"?setTimeout:void 0,uF=typeof clearTimeout=="function"?clearTimeout:void 0,JE=typeof Promise=="function"?Promise:void 0,dF=typeof queueMicrotask=="function"?queueMicrotask:typeof JE<"u"?function(r){return JE.resolve(null).then(r).catch(hF)}:U2;function hF(r){setTimeout(function(){throw r})}function pw(r,e){var t=e,n=0;do{var s=t.nextSibling;if(r.removeChild(t),s&&s.nodeType===8)if(t=s.data,t==="/$"){if(n===0){r.removeChild(s),Mp(e);return}n--}else t!=="$"&&t!=="$?"&&t!=="$!"||n++;t=s}while(t);Mp(e)}function Nl(r){for(;r!=null;r=r.nextSibling){var e=r.nodeType;if(e===1||e===3)break;if(e===8){if(e=r.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return r}function ZE(r){r=r.previousSibling;for(var e=0;r;){if(r.nodeType===8){var t=r.data;if(t==="$"||t==="$!"||t==="$?"){if(e===0)return r;e--}else t==="/$"&&e++}r=r.previousSibling}return null}var yf=Math.random().toString(36).slice(2),na="__reactFiber$"+yf,Hp="__reactProps$"+yf,ho="__reactContainer$"+yf,H2="__reactEvents$"+yf,fF="__reactListeners$"+yf,pF="__reactHandles$"+yf;function gc(r){var e=r[na];if(e)return e;for(var t=r.parentNode;t;){if(e=t[ho]||t[na]){if(t=e.alternate,e.child!==null||t!==null&&t.child!==null)for(r=ZE(r);r!==null;){if(t=r[na])return t;r=ZE(r)}return e}r=t,t=r.parentNode}return null}function Ig(r){return r=r[na]||r[ho],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function Cd(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(we(33))}function Sx(r){return r[Hp]||null}var z2=[],Ed=-1;function Ul(r){return{current:r}}function Pt(r){0>Ed||(r.current=z2[Ed],z2[Ed]=null,Ed--)}function jt(r,e){Ed++,z2[Ed]=r.current,r.current=e}var Dl={},cn=Ul(Dl),$n=Ul(!1),Cu=Dl;function Yh(r,e){var t=r.type.contextTypes;if(!t)return Dl;var n=r.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in t)s[i]=e[i];return n&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=e,r.__reactInternalMemoizedMaskedChildContext=s),s}function Un(r){return r=r.childContextTypes,r!=null}function ob(){Pt($n),Pt(cn)}function QE(r,e,t){if(cn.current!==Dl)throw Error(we(168));jt(cn,e),jt($n,t)}function _4(r,e,t){var n=r.stateNode;if(e=e.childContextTypes,typeof n.getChildContext!="function")return t;n=n.getChildContext();for(var s in n)if(!(s in e))throw Error(we(108,Z6(r)||"Unknown",s));return Xt({},t,n)}function lb(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||Dl,Cu=cn.current,jt(cn,r),jt($n,$n.current),!0}function ej(r,e,t){var n=r.stateNode;if(!n)throw Error(we(169));t?(r=_4(r,e,Cu),n.__reactInternalMemoizedMergedChildContext=r,Pt($n),Pt(cn),jt(cn,r)):Pt($n),jt($n,t)}var Ca=null,kx=!1,mw=!1;function N4(r){Ca===null?Ca=[r]:Ca.push(r)}function mF(r){kx=!0,N4(r)}function Hl(){if(!mw&&Ca!==null){mw=!0;var r=0,e=yt;try{var t=Ca;for(yt=1;r<t.length;r++){var n=t[r];do n=n(!0);while(n!==null)}Ca=null,kx=!1}catch(s){throw Ca!==null&&(Ca=Ca.slice(r+1)),X3(kS,Hl),s}finally{yt=e,mw=!1}}return null}var jd=[],Ad=0,cb=null,ub=0,Rs=[],Ps=0,Eu=null,Za=1,Qa="";function rc(r,e){jd[Ad++]=ub,jd[Ad++]=cb,cb=r,ub=e}function S4(r,e,t){Rs[Ps++]=Za,Rs[Ps++]=Qa,Rs[Ps++]=Eu,Eu=r;var n=Za;r=Qa;var s=32-_i(n)-1;n&=~(1<<s),t+=1;var i=32-_i(e)+s;if(30<i){var o=s-s%5;i=(n&(1<<o)-1).toString(32),n>>=o,s-=o,Za=1<<32-_i(e)+s|t<<s|n,Qa=i+r}else Za=1<<i|t<<s|n,Qa=r}function IS(r){r.return!==null&&(rc(r,1),S4(r,1,0))}function LS(r){for(;r===cb;)cb=jd[--Ad],jd[Ad]=null,ub=jd[--Ad],jd[Ad]=null;for(;r===Eu;)Eu=Rs[--Ps],Rs[Ps]=null,Qa=Rs[--Ps],Rs[Ps]=null,Za=Rs[--Ps],Rs[Ps]=null}var us=null,cs=null,Ft=!1,bi=null;function k4(r,e){var t=Ms(5,null,null,0);t.elementType="DELETED",t.stateNode=e,t.return=r,e=r.deletions,e===null?(r.deletions=[t],r.flags|=16):e.push(t)}function tj(r,e){switch(r.tag){case 5:var t=r.type;return e=e.nodeType!==1||t.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(r.stateNode=e,us=r,cs=Nl(e.firstChild),!0):!1;case 6:return e=r.pendingProps===""||e.nodeType!==3?null:e,e!==null?(r.stateNode=e,us=r,cs=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(t=Eu!==null?{id:Za,overflow:Qa}:null,r.memoizedState={dehydrated:e,treeContext:t,retryLane:1073741824},t=Ms(18,null,null,0),t.stateNode=e,t.return=r,r.child=t,us=r,cs=null,!0):!1;default:return!1}}function q2(r){return(r.mode&1)!==0&&(r.flags&128)===0}function W2(r){if(Ft){var e=cs;if(e){var t=e;if(!tj(r,e)){if(q2(r))throw Error(we(418));e=Nl(t.nextSibling);var n=us;e&&tj(r,e)?k4(n,t):(r.flags=r.flags&-4097|2,Ft=!1,us=r)}}else{if(q2(r))throw Error(we(418));r.flags=r.flags&-4097|2,Ft=!1,us=r}}}function rj(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;us=r}function v0(r){if(r!==us)return!1;if(!Ft)return rj(r),Ft=!0,!1;var e;if((e=r.tag!==3)&&!(e=r.tag!==5)&&(e=r.type,e=e!=="head"&&e!=="body"&&!$2(r.type,r.memoizedProps)),e&&(e=cs)){if(q2(r))throw C4(),Error(we(418));for(;e;)k4(r,e),e=Nl(e.nextSibling)}if(rj(r),r.tag===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(we(317));e:{for(r=r.nextSibling,e=0;r;){if(r.nodeType===8){var t=r.data;if(t==="/$"){if(e===0){cs=Nl(r.nextSibling);break e}e--}else t!=="$"&&t!=="$!"&&t!=="$?"||e++}r=r.nextSibling}cs=null}}else cs=us?Nl(r.stateNode.nextSibling):null;return!0}function C4(){for(var r=cs;r;)r=Nl(r.nextSibling)}function Kh(){cs=us=null,Ft=!1}function OS(r){bi===null?bi=[r]:bi.push(r)}var gF=_o.ReactCurrentBatchConfig;function Ff(r,e,t){if(r=t.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(t._owner){if(t=t._owner,t){if(t.tag!==1)throw Error(we(309));var n=t.stateNode}if(!n)throw Error(we(147,r));var s=n,i=""+r;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===i?e.ref:(e=function(o){var l=s.refs;o===null?delete l[i]:l[i]=o},e._stringRef=i,e)}if(typeof r!="string")throw Error(we(284));if(!t._owner)throw Error(we(290,r))}return r}function w0(r,e){throw r=Object.prototype.toString.call(e),Error(we(31,r==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":r))}function nj(r){var e=r._init;return e(r._payload)}function E4(r){function e(b,y){if(r){var w=b.deletions;w===null?(b.deletions=[y],b.flags|=16):w.push(y)}}function t(b,y){if(!r)return null;for(;y!==null;)e(b,y),y=y.sibling;return null}function n(b,y){for(b=new Map;y!==null;)y.key!==null?b.set(y.key,y):b.set(y.index,y),y=y.sibling;return b}function s(b,y){return b=El(b,y),b.index=0,b.sibling=null,b}function i(b,y,w){return b.index=w,r?(w=b.alternate,w!==null?(w=w.index,w<y?(b.flags|=2,y):w):(b.flags|=2,y)):(b.flags|=1048576,y)}function o(b){return r&&b.alternate===null&&(b.flags|=2),b}function l(b,y,w,_){return y===null||y.tag!==6?(y=_w(w,b.mode,_),y.return=b,y):(y=s(y,w),y.return=b,y)}function c(b,y,w,_){var N=w.type;return N===_d?d(b,y,w.props.children,_,w.key):y!==null&&(y.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===Lo&&nj(N)===y.type)?(_=s(y,w.props),_.ref=Ff(b,y,w),_.return=b,_):(_=dy(w.type,w.key,w.props,null,b.mode,_),_.ref=Ff(b,y,w),_.return=b,_)}function u(b,y,w,_){return y===null||y.tag!==4||y.stateNode.containerInfo!==w.containerInfo||y.stateNode.implementation!==w.implementation?(y=Nw(w,b.mode,_),y.return=b,y):(y=s(y,w.children||[]),y.return=b,y)}function d(b,y,w,_,N){return y===null||y.tag!==7?(y=xu(w,b.mode,_,N),y.return=b,y):(y=s(y,w),y.return=b,y)}function h(b,y,w){if(typeof y=="string"&&y!==""||typeof y=="number")return y=_w(""+y,b.mode,w),y.return=b,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case u0:return w=dy(y.type,y.key,y.props,null,b.mode,w),w.ref=Ff(b,null,y),w.return=b,w;case wd:return y=Nw(y,b.mode,w),y.return=b,y;case Lo:var _=y._init;return h(b,_(y._payload),w)}if(Yf(y)||Pf(y))return y=xu(y,b.mode,w,null),y.return=b,y;w0(b,y)}return null}function f(b,y,w,_){var N=y!==null?y.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return N!==null?null:l(b,y,""+w,_);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case u0:return w.key===N?c(b,y,w,_):null;case wd:return w.key===N?u(b,y,w,_):null;case Lo:return N=w._init,f(b,y,N(w._payload),_)}if(Yf(w)||Pf(w))return N!==null?null:d(b,y,w,_,null);w0(b,w)}return null}function p(b,y,w,_,N){if(typeof _=="string"&&_!==""||typeof _=="number")return b=b.get(w)||null,l(y,b,""+_,N);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case u0:return b=b.get(_.key===null?w:_.key)||null,c(y,b,_,N);case wd:return b=b.get(_.key===null?w:_.key)||null,u(y,b,_,N);case Lo:var S=_._init;return p(b,y,w,S(_._payload),N)}if(Yf(_)||Pf(_))return b=b.get(w)||null,d(y,b,_,N,null);w0(y,_)}return null}function m(b,y,w,_){for(var N=null,S=null,E=y,T=y=0,D=null;E!==null&&T<w.length;T++){E.index>T?(D=E,E=null):D=E.sibling;var R=f(b,E,w[T],_);if(R===null){E===null&&(E=D);break}r&&E&&R.alternate===null&&e(b,E),y=i(R,y,T),S===null?N=R:S.sibling=R,S=R,E=D}if(T===w.length)return t(b,E),Ft&&rc(b,T),N;if(E===null){for(;T<w.length;T++)E=h(b,w[T],_),E!==null&&(y=i(E,y,T),S===null?N=E:S.sibling=E,S=E);return Ft&&rc(b,T),N}for(E=n(b,E);T<w.length;T++)D=p(E,b,T,w[T],_),D!==null&&(r&&D.alternate!==null&&E.delete(D.key===null?T:D.key),y=i(D,y,T),S===null?N=D:S.sibling=D,S=D);return r&&E.forEach(function(H){return e(b,H)}),Ft&&rc(b,T),N}function g(b,y,w,_){var N=Pf(w);if(typeof N!="function")throw Error(we(150));if(w=N.call(w),w==null)throw Error(we(151));for(var S=N=null,E=y,T=y=0,D=null,R=w.next();E!==null&&!R.done;T++,R=w.next()){E.index>T?(D=E,E=null):D=E.sibling;var H=f(b,E,R.value,_);if(H===null){E===null&&(E=D);break}r&&E&&H.alternate===null&&e(b,E),y=i(H,y,T),S===null?N=H:S.sibling=H,S=H,E=D}if(R.done)return t(b,E),Ft&&rc(b,T),N;if(E===null){for(;!R.done;T++,R=w.next())R=h(b,R.value,_),R!==null&&(y=i(R,y,T),S===null?N=R:S.sibling=R,S=R);return Ft&&rc(b,T),N}for(E=n(b,E);!R.done;T++,R=w.next())R=p(E,b,T,R.value,_),R!==null&&(r&&R.alternate!==null&&E.delete(R.key===null?T:R.key),y=i(R,y,T),S===null?N=R:S.sibling=R,S=R);return r&&E.forEach(function(A){return e(b,A)}),Ft&&rc(b,T),N}function v(b,y,w,_){if(typeof w=="object"&&w!==null&&w.type===_d&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case u0:e:{for(var N=w.key,S=y;S!==null;){if(S.key===N){if(N=w.type,N===_d){if(S.tag===7){t(b,S.sibling),y=s(S,w.props.children),y.return=b,b=y;break e}}else if(S.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===Lo&&nj(N)===S.type){t(b,S.sibling),y=s(S,w.props),y.ref=Ff(b,S,w),y.return=b,b=y;break e}t(b,S);break}else e(b,S);S=S.sibling}w.type===_d?(y=xu(w.props.children,b.mode,_,w.key),y.return=b,b=y):(_=dy(w.type,w.key,w.props,null,b.mode,_),_.ref=Ff(b,y,w),_.return=b,b=_)}return o(b);case wd:e:{for(S=w.key;y!==null;){if(y.key===S)if(y.tag===4&&y.stateNode.containerInfo===w.containerInfo&&y.stateNode.implementation===w.implementation){t(b,y.sibling),y=s(y,w.children||[]),y.return=b,b=y;break e}else{t(b,y);break}else e(b,y);y=y.sibling}y=Nw(w,b.mode,_),y.return=b,b=y}return o(b);case Lo:return S=w._init,v(b,y,S(w._payload),_)}if(Yf(w))return m(b,y,w,_);if(Pf(w))return g(b,y,w,_);w0(b,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,y!==null&&y.tag===6?(t(b,y.sibling),y=s(y,w),y.return=b,b=y):(t(b,y),y=_w(w,b.mode,_),y.return=b,b=y),o(b)):t(b,y)}return v}var Jh=E4(!0),j4=E4(!1),db=Ul(null),hb=null,Td=null,MS=null;function FS(){MS=Td=hb=null}function BS(r){var e=db.current;Pt(db),r._currentValue=e}function V2(r,e,t){for(;r!==null;){var n=r.alternate;if((r.childLanes&e)!==e?(r.childLanes|=e,n!==null&&(n.childLanes|=e)):n!==null&&(n.childLanes&e)!==e&&(n.childLanes|=e),r===t)break;r=r.return}}function zd(r,e){hb=r,MS=Td=null,r=r.dependencies,r!==null&&r.firstContext!==null&&(r.lanes&e&&(Mn=!0),r.firstContext=null)}function Hs(r){var e=r._currentValue;if(MS!==r)if(r={context:r,memoizedValue:e,next:null},Td===null){if(hb===null)throw Error(we(308));Td=r,hb.dependencies={lanes:0,firstContext:r}}else Td=Td.next=r;return e}var yc=null;function $S(r){yc===null?yc=[r]:yc.push(r)}function A4(r,e,t,n){var s=e.interleaved;return s===null?(t.next=t,$S(e)):(t.next=s.next,s.next=t),e.interleaved=t,fo(r,n)}function fo(r,e){r.lanes|=e;var t=r.alternate;for(t!==null&&(t.lanes|=e),t=r,r=r.return;r!==null;)r.childLanes|=e,t=r.alternate,t!==null&&(t.childLanes|=e),t=r,r=r.return;return t.tag===3?t.stateNode:null}var Oo=!1;function US(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function T4(r,e){r=r.updateQueue,e.updateQueue===r&&(e.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,effects:r.effects})}function so(r,e){return{eventTime:r,lane:e,tag:0,payload:null,callback:null,next:null}}function Sl(r,e,t){var n=r.updateQueue;if(n===null)return null;if(n=n.shared,lt&2){var s=n.pending;return s===null?e.next=e:(e.next=s.next,s.next=e),n.pending=e,fo(r,t)}return s=n.interleaved,s===null?(e.next=e,$S(n)):(e.next=s.next,s.next=e),n.interleaved=e,fo(r,t)}function iy(r,e,t){if(e=e.updateQueue,e!==null&&(e=e.shared,(t&4194240)!==0)){var n=e.lanes;n&=r.pendingLanes,t|=n,e.lanes=t,CS(r,t)}}function sj(r,e){var t=r.updateQueue,n=r.alternate;if(n!==null&&(n=n.updateQueue,t===n)){var s=null,i=null;if(t=t.firstBaseUpdate,t!==null){do{var o={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};i===null?s=i=o:i=i.next=o,t=t.next}while(t!==null);i===null?s=i=e:i=i.next=e}else s=i=e;t={baseState:n.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:n.shared,effects:n.effects},r.updateQueue=t;return}r=t.lastBaseUpdate,r===null?t.firstBaseUpdate=e:r.next=e,t.lastBaseUpdate=e}function fb(r,e,t,n){var s=r.updateQueue;Oo=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var d=r.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(i!==null){var h=s.baseState;o=0,d=u=c=null,l=i;do{var f=l.lane,p=l.eventTime;if((n&f)===f){d!==null&&(d=d.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var m=r,g=l;switch(f=e,p=t,g.tag){case 1:if(m=g.payload,typeof m=="function"){h=m.call(p,h,f);break e}h=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m=="function"?m.call(p,h,f):m,f==null)break e;h=Xt({},h,f);break e;case 2:Oo=!0}}l.callback!==null&&l.lane!==0&&(r.flags|=64,f=s.effects,f===null?s.effects=[l]:f.push(l))}else p={eventTime:p,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=p,c=h):d=d.next=p,o|=f;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;f=l,l=f.next,f.next=null,s.lastBaseUpdate=f,s.shared.pending=null}}while(!0);if(d===null&&(c=h),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,e=s.shared.interleaved,e!==null){s=e;do o|=s.lane,s=s.next;while(s!==e)}else i===null&&(s.shared.lanes=0);Au|=o,r.lanes=o,r.memoizedState=h}}function ij(r,e,t){if(r=e.effects,e.effects=null,r!==null)for(e=0;e<r.length;e++){var n=r[e],s=n.callback;if(s!==null){if(n.callback=null,n=t,typeof s!="function")throw Error(we(191,s));s.call(n)}}}var Lg={},oa=Ul(Lg),zp=Ul(Lg),qp=Ul(Lg);function bc(r){if(r===Lg)throw Error(we(174));return r}function HS(r,e){switch(jt(qp,e),jt(zp,r),jt(oa,Lg),r=e.nodeType,r){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:C2(null,"");break;default:r=r===8?e.parentNode:e,e=r.namespaceURI||null,r=r.tagName,e=C2(e,r)}Pt(oa),jt(oa,e)}function Zh(){Pt(oa),Pt(zp),Pt(qp)}function D4(r){bc(qp.current);var e=bc(oa.current),t=C2(e,r.type);e!==t&&(jt(zp,r),jt(oa,t))}function zS(r){zp.current===r&&(Pt(oa),Pt(zp))}var Vt=Ul(0);function pb(r){for(var e=r;e!==null;){if(e.tag===13){var t=e.memoizedState;if(t!==null&&(t=t.dehydrated,t===null||t.data==="$?"||t.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===r)break;for(;e.sibling===null;){if(e.return===null||e.return===r)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var gw=[];function qS(){for(var r=0;r<gw.length;r++)gw[r]._workInProgressVersionPrimary=null;gw.length=0}var ay=_o.ReactCurrentDispatcher,yw=_o.ReactCurrentBatchConfig,ju=0,Gt=null,pr=null,Cr=null,mb=!1,xp=!1,Wp=0,yF=0;function Vr(){throw Error(we(321))}function WS(r,e){if(e===null)return!1;for(var t=0;t<e.length&&t<r.length;t++)if(!Ci(r[t],e[t]))return!1;return!0}function VS(r,e,t,n,s,i){if(ju=i,Gt=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,ay.current=r===null||r.memoizedState===null?wF:_F,r=t(n,s),xp){i=0;do{if(xp=!1,Wp=0,25<=i)throw Error(we(301));
vendor: 4,522 bytes, line 38
38i+=1,Cr=pr=null,e.updateQueue=null,ay.current=NF,r=t(n,s)}while(xp)}if(ay.current=gb,e=pr!==null&&pr.next!==null,ju=0,Cr=pr=Gt=null,mb=!1,e)throw Error(we(300));return r}function GS(){var r=Wp!==0;return Wp=0,r}function Li(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Cr===null?Gt.memoizedState=Cr=r:Cr=Cr.next=r,Cr}function zs(){if(pr===null){var r=Gt.alternate;r=r!==null?r.memoizedState:null}else r=pr.next;var e=Cr===null?Gt.memoizedState:Cr.next;if(e!==null)Cr=e,pr=r;else{if(r===null)throw Error(we(310));pr=r,r={memoizedState:pr.memoizedState,baseState:pr.baseState,baseQueue:pr.baseQueue,queue:pr.queue,next:null},Cr===null?Gt.memoizedState=Cr=r:Cr=Cr.next=r}return Cr}function Vp(r,e){return typeof e=="function"?e(r):e}function bw(r){var e=zs(),t=e.queue;if(t===null)throw Error(we(311));t.lastRenderedReducer=r;var n=pr,s=n.baseQueue,i=t.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}n.baseQueue=s=i,t.pending=null}if(s!==null){i=s.next,n=n.baseState;var l=o=null,c=null,u=i;do{var d=u.lane;if((ju&d)===d)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),n=u.hasEagerState?u.eagerState:r(n,u.action);else{var h={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=h,o=n):c=c.next=h,Gt.lanes|=d,Au|=d}u=u.next}while(u!==null&&u!==i);c===null?o=n:c.next=l,Ci(n,e.memoizedState)||(Mn=!0),e.memoizedState=n,e.baseState=o,e.baseQueue=c,t.lastRenderedState=n}if(r=t.interleaved,r!==null){s=r;do i=s.lane,Gt.lanes|=i,Au|=i,s=s.next;while(s!==r)}else s===null&&(t.lanes=0);return[e.memoizedState,t.dispatch]}function xw(r){var e=zs(),t=e.queue;if(t===null)throw Error(we(311));t.lastRenderedReducer=r;var n=t.dispatch,s=t.pending,i=e.memoizedState;if(s!==null){t.pending=null;var o=s=s.next;do i=r(i,o.action),o=o.next;while(o!==s);Ci(i,e.memoizedState)||(Mn=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),t.lastRenderedState=i}return[i,n]}function R4(){}function P4(r,e){var t=Gt,n=zs(),s=e(),i=!Ci(n.memoizedState,s);if(i&&(n.memoizedState=s,Mn=!0),n=n.queue,XS(O4.bind(null,t,n,r),[r]),n.getSnapshot!==e||i||Cr!==null&&Cr.memoizedState.tag&1){if(t.flags|=2048,Gp(9,L4.bind(null,t,n,s,e),void 0,null),jr===null)throw Error(we(349));ju&30||I4(t,e,s)}return s}function I4(r,e,t){r.flags|=16384,r={getSnapshot:e,value:t},e=Gt.updateQueue,e===null?(e={lastEffect:null,stores:null},Gt.updateQueue=e,e.stores=[r]):(t=e.stores,t===null?e.stores=[r]:t.push(r))}function L4(r,e,t,n){e.value=t,e.getSnapshot=n,M4(e)&&F4(r)}function O4(r,e,t){return t(function(){M4(e)&&F4(r)})}function M4(r){var e=r.getSnapshot;r=r.value;try{var t=e();return!Ci(r,t)}catch{return!0}}function F4(r){var e=fo(r,1);e!==null&&Ni(e,r,1,-1)}function aj(r){var e=Li();return typeof r=="function"&&(r=r()),e.memoizedState=e.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Vp,lastRenderedState:r},e.queue=r,r=r.dispatch=vF.bind(null,Gt,r),[e.memoizedState,r]}function Gp(r,e,t,n){return r={tag:r,create:e,destroy:t,deps:n,next:null},e=Gt.updateQueue,e===null?(e={lastEffect:null,stores:null},Gt.updateQueue=e,e.lastEffect=r.next=r):(t=e.lastEffect,t===null?e.lastEffect=r.next=r:(n=t.next,t.next=r,r.next=n,e.lastEffect=r)),r}function B4(){return zs().memoizedState}function oy(r,e,t,n){var s=Li();Gt.flags|=r,s.memoizedState=Gp(1|e,t,void 0,n===void 0?null:n)}function Cx(r,e,t,n){var s=zs();n=n===void 0?null:n;var i=void 0;if(pr!==null){var o=pr.memoizedState;if(i=o.destroy,n!==null&&WS(n,o.deps)){s.memoizedState=Gp(e,t,i,n);return}}Gt.flags|=r,s.memoizedState=Gp(1|e,t,i,n)}function oj(r,e){return oy(8390656,8,r,e)}function XS(r,e){return Cx(2048,8,r,e)}function $4(r,e){return Cx(4,2,r,e)}function U4(r,e){return Cx(4,4,r,e)}function H4(r,e){if(typeof e=="function")return r=r(),e(r),function(){e(null)};if(e!=null)return r=r(),e.current=r,function(){e.current=null}}function z4(r,e,t){return t=t!=null?t.concat([r]):null,Cx(4,4,H4.bind(null,e,r),t)}function YS(){}function q4(r,e){var t=zs();e=e===void 0?null:e;var n=t.memoizedState;return n!==null&&e!==null&&WS(e,n[1])?n[0]:(t.memoizedState=[r,e],r)}function W4(r,e){var t=zs();e=e===void 0?null:e;var n=t.memoizedState;return n!==null&&e!==null&&WS(e,n[1])?n[0]:(r=r(),t.memoizedState=[r,e],r)}function V4(r,e,t){return ju&21?(Ci(t,e)||(t=J3(),Gt.lanes|=t,Au|=t,r.baseState=!0),e):(r.baseState&&(r.baseState=!1,Mn=!0),r.memoizedState=t)}function bF(r,e){var t=yt;
vendor: 9,219 bytes, lines 38-40
38yt=t!==0&&4>t?t:4,r(!0);var n=yw.transition;yw.transition={};try{r(!1),e()}finally{yt=t,yw.transition=n}}function G4(){return zs().memoizedState}function xF(r,e,t){var n=Cl(r);if(t={lane:n,action:t,hasEagerState:!1,eagerState:null,next:null},X4(r))Y4(e,t);else if(t=A4(r,e,t,n),t!==null){var s=wn();Ni(t,r,n,s),K4(t,e,n)}}function vF(r,e,t){var n=Cl(r),s={lane:n,action:t,hasEagerState:!1,eagerState:null,next:null};if(X4(r))Y4(e,s);else{var i=r.alternate;if(r.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var o=e.lastRenderedState,l=i(o,t);if(s.hasEagerState=!0,s.eagerState=l,Ci(l,o)){var c=e.interleaved;c===null?(s.next=s,$S(e)):(s.next=c.next,c.next=s),e.interleaved=s;return}}catch{}finally{}t=A4(r,e,s,n),t!==null&&(s=wn(),Ni(t,r,n,s),K4(t,e,n))}}function X4(r){var e=r.alternate;return r===Gt||e!==null&&e===Gt}function Y4(r,e){xp=mb=!0;var t=r.pending;t===null?e.next=e:(e.next=t.next,t.next=e),r.pending=e}function K4(r,e,t){if(t&4194240){var n=e.lanes;n&=r.pendingLanes,t|=n,e.lanes=t,CS(r,t)}}var gb={readContext:Hs,useCallback:Vr,useContext:Vr,useEffect:Vr,useImperativeHandle:Vr,useInsertionEffect:Vr,useLayoutEffect:Vr,useMemo:Vr,useReducer:Vr,useRef:Vr,useState:Vr,useDebugValue:Vr,useDeferredValue:Vr,useTransition:Vr,useMutableSource:Vr,useSyncExternalStore:Vr,useId:Vr,unstable_isNewReconciler:!1},wF={readContext:Hs,useCallback:function(r,e){return Li().memoizedState=[r,e===void 0?null:e],r},useContext:Hs,useEffect:oj,useImperativeHandle:function(r,e,t){return t=t!=null?t.concat([r]):null,oy(4194308,4,H4.bind(null,e,r),t)},useLayoutEffect:function(r,e){return oy(4194308,4,r,e)},useInsertionEffect:function(r,e){return oy(4,2,r,e)},useMemo:function(r,e){var t=Li();return e=e===void 0?null:e,r=r(),t.memoizedState=[r,e],r},useReducer:function(r,e,t){var n=Li();return e=t!==void 0?t(e):e,n.memoizedState=n.baseState=e,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:e},n.queue=r,r=r.dispatch=xF.bind(null,Gt,r),[n.memoizedState,r]},useRef:function(r){var e=Li();return r={current:r},e.memoizedState=r},useState:aj,useDebugValue:YS,useDeferredValue:function(r){return Li().memoizedState=r},useTransition:function(){var r=aj(!1),e=r[0];return r=bF.bind(null,r[1]),Li().memoizedState=r,[e,r]},useMutableSource:function(){},useSyncExternalStore:function(r,e,t){var n=Gt,s=Li();if(Ft){if(t===void 0)throw Error(we(407));t=t()}else{if(t=e(),jr===null)throw Error(we(349));ju&30||I4(n,e,t)}s.memoizedState=t;var i={value:t,getSnapshot:e};return s.queue=i,oj(O4.bind(null,n,i,r),[r]),n.flags|=2048,Gp(9,L4.bind(null,n,i,t,e),void 0,null),t},useId:function(){var r=Li(),e=jr.identifierPrefix;if(Ft){var t=Qa,n=Za;t=(n&~(1<<32-_i(n)-1)).toString(32)+t,e=":"+e+"R"+t,t=Wp++,0<t&&(e+="H"+t.toString(32)),e+=":"}else t=yF++,e=":"+e+"r"+t.toString(32)+":";return r.memoizedState=e},unstable_isNewReconciler:!1},_F={readContext:Hs,useCallback:q4,useContext:Hs,useEffect:XS,useImperativeHandle:z4,useInsertionEffect:$4,useLayoutEffect:U4,useMemo:W4,useReducer:bw,useRef:B4,useState:function(){return bw(Vp)},useDebugValue:YS,useDeferredValue:function(r){var e=zs();return V4(e,pr.memoizedState,r)},useTransition:function(){var r=bw(Vp)[0],e=zs().memoizedState;return[r,e]},useMutableSource:R4,useSyncExternalStore:P4,useId:G4,unstable_isNewReconciler:!1},NF={readContext:Hs,useCallback:q4,useContext:Hs,useEffect:XS,useImperativeHandle:z4,useInsertionEffect:$4,useLayoutEffect:U4,useMemo:W4,useReducer:xw,useRef:B4,useState:function(){return xw(Vp)},useDebugValue:YS,useDeferredValue:function(r){var e=zs();return pr===null?e.memoizedState=r:V4(e,pr.memoizedState,r)},useTransition:function(){var r=xw(Vp)[0],e=zs().memoizedState;return[r,e]},useMutableSource:R4,useSyncExternalStore:P4,useId:G4,unstable_isNewReconciler:!1};function ri(r,e){if(r&&r.defaultProps){e=Xt({},e),r=r.defaultProps;for(var t in r)e[t]===void 0&&(e[t]=r[t]);return e}return e}function G2(r,e,t,n){e=r.memoizedState,t=t(n,e),t=t==null?e:Xt({},e,t),r.memoizedState=t,r.lanes===0&&(r.updateQueue.baseState=t)}var Ex={isMounted:function(r){return(r=r._reactInternals)?qu(r)===r:!1},enqueueSetState:function(r,e,t){r=r._reactInternals;var n=wn(),s=Cl(r),i=so(n,s);i.payload=e,t!=null&&(i.callback=t),e=Sl(r,i,s),e!==null&&(Ni(e,r,s,n),iy(e,r,s))},enqueueReplaceState:function(r,e,t){r=r._reactInternals;var n=wn(),s=Cl(r),i=so(n,s);i.tag=1,i.payload=e,t!=null&&(i.callback=t),e=Sl(r,i,s),e!==null&&(Ni(e,r,s,n),iy(e,r,s))},enqueueForceUpdate:function(r,e){r=r._reactInternals;var t=wn(),n=Cl(r),s=so(t,n);s.tag=2,e!=null&&(s.callback=e),e=Sl(r,s,n),e!==null&&(Ni(e,r,n,t),iy(e,r,n))}};function lj(r,e,t,n,s,i,o){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(n,i,o):e.prototype&&e.prototype.isPureReactComponent?!Bp(t,n)||!Bp(s,i):!0}function J4(r,e,t){var n=!1,s=Dl,i=e.contextType;return typeof i=="object"&&i!==null?i=Hs(i):(s=Un(e)?Cu:cn.current,n=e.contextTypes,i=(n=n!=null)?Yh(r,s):Dl),e=new e(t,i),r.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=Ex,r.stateNode=e,e._reactInternals=r,n&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=s,r.__reactInternalMemoizedMaskedChildContext=i),e}function cj(r,e,t,n){r=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(t,n),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(t,n),e.state!==r&&Ex.enqueueReplaceState(e,e.state,null)}function X2(r,e,t,n){var s=r.stateNode;s.props=t,s.state=r.memoizedState,s.refs={},US(r);var i=e.contextType;typeof i=="object"&&i!==null?s.context=Hs(i):(i=Un(e)?Cu:cn.current,s.context=Yh(r,i)),s.state=r.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(G2(r,e,i,t),s.state=r.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(e=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),e!==s.state&&Ex.enqueueReplaceState(s,s.state,null),fb(r,t,s,n),s.state=r.memoizedState),typeof s.componentDidMount=="function"&&(r.flags|=4194308)}function Qh(r,e){try{var t="",n=e;do t+=J6(n),n=n.return;while(n);var s=t}catch(i){s=`
39Error generating stack: `+i.message+`
40`+i.stack}return{value:r,source:e,stack:s,digest:null}}function vw(r,e,t){return{value:r,source:null,stack:t??null,digest:e??null}}function Y2(r,e){try{console.error(e.value)}catch(t){setTimeout(function(){throw t})}}var SF=typeof WeakMap=="function"?WeakMap:Map;function Z4(r,e,t){t=so(-1,t),t.tag=3,t.payload={element:null};var n=e.value;return t.callback=function(){bb||(bb=!0,i_=n),Y2(r,e)},t}function Q4(r,e,t){t=so(-1,t),t.tag=3;var n=r.type.getDerivedStateFromError;if(typeof n=="function"){var s=e.value;t.payload=function(){return n(s)},t.callback=function(){Y2(r,e)}}var i=r.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(t.callback=function(){Y2(r,e),typeof n!="function"&&(kl===null?kl=new Set([this]):kl.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),t}function uj(r,e,t){var n=r.pingCache;if(n===null){n=r.pingCache=new SF;var s=new Set;n.set(e,s)}else s=n.get(e),s===void 0&&(s=new Set,n.set(e,s));s.has(t)||(s.add(t),r=FF.bind(null,r,e,t),e.then(r,r))}function dj(r){do{var e;if((e=r.tag===13)&&(e=r.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return r;r=r.return}while(r!==null);return null}function hj(r,e,t,n,s){return r.mode&1?(r.flags|=65536,r.lanes=s,r):(r===e?r.flags|=65536:(r.flags|=128,t.flags|=131072,t.flags&=-52805,t.tag===1&&(t.alternate===null?t.tag=17:(e=so(-1,1),e.tag=2,Sl(t,e,1))),t.lanes|=1),r)}var kF=_o.ReactCurrentOwner,Mn=!1;function yn(r,e,t,n){e.child=r===null?j4(e,null,t,n):Jh(e,r.child,t,n)}function fj(r,e,t,n,s){t=t.render;var i=e.ref;return zd(e,s),n=VS(r,e,t,n,i,s),t=GS(),r!==null&&!Mn?(e.updateQueue=r.updateQueue,e.flags&=-2053,r.lanes&=~s,po(r,e,s)):(Ft&&t&&IS(e),e.flags|=1,yn(r,e,n,s),e.child)}function pj(r,e,t,n,s){if(r===null){var i=t.type;return typeof i=="function"&&!nk(i)&&i.defaultProps===void 0&&t.compare===null&&t.defaultProps===void 0?(e.tag=15,e.type=i,eD(r,e,i,n,s)):(r=dy(t.type,null,n,e,e.mode,s),r.ref=e.ref,r.return=e,e.child=r)}if(i=r.child,!(r.lanes&s)){var o=i.memoizedProps;if(t=t.compare,t=t!==null?t:Bp,t(o,n)&&r.ref===e.ref)return po(r,e,s)}return e.flags|=1,r=El(i,n),r.ref=e.ref,r.return=e,e.child=r}function eD(r,e,t,n,s){if(r!==null){var i=r.memoizedProps;if(Bp(i,n)&&r.ref===e.ref)if(Mn=!1,e.pendingProps=n=i,(r.lanes&s)!==0)r.flags&131072&&(Mn=!0);else return e.lanes=r.lanes,po(r,e,s)}return K2(r,e,t,n,s)}function tD(r,e,t){var n=e.pendingProps,s=n.children,i=r!==null?r.memoizedState:null;if(n.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},jt(Rd,os),os|=t;else{if(!(t&1073741824))return r=i!==null?i.baseLanes|t:t,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:r,cachePool:null,transitions:null},e.updateQueue=null,jt(Rd,os),os|=r,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null}
vendor: 4,957 bytes, line 40
40,n=i!==null?i.baseLanes:t,jt(Rd,os),os|=n}else i!==null?(n=i.baseLanes|t,e.memoizedState=null):n=t,jt(Rd,os),os|=n;return yn(r,e,s,t),e.child}function rD(r,e){var t=e.ref;(r===null&&t!==null||r!==null&&r.ref!==t)&&(e.flags|=512,e.flags|=2097152)}function K2(r,e,t,n,s){var i=Un(t)?Cu:cn.current;return i=Yh(e,i),zd(e,s),t=VS(r,e,t,n,i,s),n=GS(),r!==null&&!Mn?(e.updateQueue=r.updateQueue,e.flags&=-2053,r.lanes&=~s,po(r,e,s)):(Ft&&n&&IS(e),e.flags|=1,yn(r,e,t,s),e.child)}function mj(r,e,t,n,s){if(Un(t)){var i=!0;lb(e)}else i=!1;if(zd(e,s),e.stateNode===null)ly(r,e),J4(e,t,n),X2(e,t,n,s),n=!0;else if(r===null){var o=e.stateNode,l=e.memoizedProps;o.props=l;var c=o.context,u=t.contextType;typeof u=="object"&&u!==null?u=Hs(u):(u=Un(t)?Cu:cn.current,u=Yh(e,u));var d=t.getDerivedStateFromProps,h=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==n||c!==u)&&cj(e,o,n,u),Oo=!1;var f=e.memoizedState;o.state=f,fb(e,n,o,s),c=e.memoizedState,l!==n||f!==c||$n.current||Oo?(typeof d=="function"&&(G2(e,t,d,n),c=e.memoizedState),(l=Oo||lj(e,t,l,n,f,c,u))?(h||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=n,e.memoizedState=c),o.props=n,o.state=c,o.context=u,n=l):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),n=!1)}else{o=e.stateNode,T4(r,e),l=e.memoizedProps,u=e.type===e.elementType?l:ri(e.type,l),o.props=u,h=e.pendingProps,f=o.context,c=t.contextType,typeof c=="object"&&c!==null?c=Hs(c):(c=Un(t)?Cu:cn.current,c=Yh(e,c));var p=t.getDerivedStateFromProps;(d=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==h||f!==c)&&cj(e,o,n,c),Oo=!1,f=e.memoizedState,o.state=f,fb(e,n,o,s);var m=e.memoizedState;l!==h||f!==m||$n.current||Oo?(typeof p=="function"&&(G2(e,t,p,n),m=e.memoizedState),(u=Oo||lj(e,t,u,n,f,m,c)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,m,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,m,c)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===r.memoizedProps&&f===r.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===r.memoizedProps&&f===r.memoizedState||(e.flags|=1024),e.memoizedProps=n,e.memoizedState=m),o.props=n,o.state=m,o.context=c,n=u):(typeof o.componentDidUpdate!="function"||l===r.memoizedProps&&f===r.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===r.memoizedProps&&f===r.memoizedState||(e.flags|=1024),n=!1)}return J2(r,e,t,n,i,s)}function J2(r,e,t,n,s,i){rD(r,e);var o=(e.flags&128)!==0;if(!n&&!o)return s&&ej(e,t,!1),po(r,e,i);n=e.stateNode,kF.current=e;var l=o&&typeof t.getDerivedStateFromError!="function"?null:n.render();return e.flags|=1,r!==null&&o?(e.child=Jh(e,r.child,null,i),e.child=Jh(e,null,l,i)):yn(r,e,l,i),e.memoizedState=n.state,s&&ej(e,t,!0),e.child}function nD(r){var e=r.stateNode;e.pendingContext?QE(r,e.pendingContext,e.pendingContext!==e.context):e.context&&QE(r,e.context,!1),HS(r,e.containerInfo)}function gj(r,e,t,n,s){return Kh(),OS(s),e.flags|=256,yn(r,e,t,n),e.child}var Z2={dehydrated:null,treeContext:null,retryLane:0};function Q2(r){return{baseLanes:r,cachePool:null,transitions:null}}function sD(r,e,t){var n=e.pendingProps,s=Vt.current,i=!1,o=(e.flags&128)!==0,l;if((l=o)||(l=r!==null&&r.memoizedState===null?!1:(s&2)!==0),l?(i=!0,e.flags&=-129):(r===null||r.memoizedState!==null)&&(s|=1),jt(Vt,s&1),r===null)return W2(e),r=e.memoizedState,r!==null&&(r=r.dehydrated,r!==null)?(e.mode&1?r.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=n.children,r=n.fallback,i?(n=e.mode,i=e.child,o={mode:"hidden",children:o},!(n&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=Tx(o,n,0,null),r=xu(r,n,t,null),i.return=e,r.return=e,i.sibling=r,e.child=i,e.child.memoizedState=Q2(t),e.memoizedState=Z2,r):KS(e,o));if(s=r.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return CF(r,e,o,n,l,s,t);if(i){i=n.fallback,o=e.mode,s=r.child,l=s.sibling;var c={mode:"hidden",children:n.children};return!(o&1)&&e.child!==s?(n=e.child,n.childLanes=0,n.pendingProps=c,e.deletions=null):(n=El(s,c),n.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=El(l,i):(i=xu(i,o,t,null),i.flags|=2),i.return=e,n.return=e,n.sibling=i,e.child=n,n=i,i=e.child,o=r.child.memoizedState,o=o===null?Q2(t):{base
vendor: 8,923 bytes, line 40
40Lanes:o.baseLanes|t,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=r.childLanes&~t,e.memoizedState=Z2,n}return i=r.child,r=i.sibling,n=El(i,{mode:"visible",children:n.children}),!(e.mode&1)&&(n.lanes=t),n.return=e,n.sibling=null,r!==null&&(t=e.deletions,t===null?(e.deletions=[r],e.flags|=16):t.push(r)),e.child=n,e.memoizedState=null,n}function KS(r,e){return e=Tx({mode:"visible",children:e},r.mode,0,null),e.return=r,r.child=e}function _0(r,e,t,n){return n!==null&&OS(n),Jh(e,r.child,null,t),r=KS(e,e.pendingProps.children),r.flags|=2,e.memoizedState=null,r}function CF(r,e,t,n,s,i,o){if(t)return e.flags&256?(e.flags&=-257,n=vw(Error(we(422))),_0(r,e,o,n)):e.memoizedState!==null?(e.child=r.child,e.flags|=128,null):(i=n.fallback,s=e.mode,n=Tx({mode:"visible",children:n.children},s,0,null),i=xu(i,s,o,null),i.flags|=2,n.return=e,i.return=e,n.sibling=i,e.child=n,e.mode&1&&Jh(e,r.child,null,o),e.child.memoizedState=Q2(o),e.memoizedState=Z2,i);if(!(e.mode&1))return _0(r,e,o,null);if(s.data==="$!"){if(n=s.nextSibling&&s.nextSibling.dataset,n)var l=n.dgst;return n=l,i=Error(we(419)),n=vw(i,n,void 0),_0(r,e,o,n)}if(l=(o&r.childLanes)!==0,Mn||l){if(n=jr,n!==null){switch(o&-o){case 4:s=2;break;case 16:s=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(n.suspendedLanes|o)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,fo(r,s),Ni(n,r,s,-1))}return rk(),n=vw(Error(we(421))),_0(r,e,o,n)}return s.data==="$?"?(e.flags|=128,e.child=r.child,e=BF.bind(null,r),s._reactRetry=e,null):(r=i.treeContext,cs=Nl(s.nextSibling),us=e,Ft=!0,bi=null,r!==null&&(Rs[Ps++]=Za,Rs[Ps++]=Qa,Rs[Ps++]=Eu,Za=r.id,Qa=r.overflow,Eu=e),e=KS(e,n.children),e.flags|=4096,e)}function yj(r,e,t){r.lanes|=e;var n=r.alternate;n!==null&&(n.lanes|=e),V2(r.return,e,t)}function ww(r,e,t,n,s){var i=r.memoizedState;i===null?r.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:n,tail:t,tailMode:s}:(i.isBackwards=e,i.rendering=null,i.renderingStartTime=0,i.last=n,i.tail=t,i.tailMode=s)}function iD(r,e,t){var n=e.pendingProps,s=n.revealOrder,i=n.tail;if(yn(r,e,n.children,t),n=Vt.current,n&2)n=n&1|2,e.flags|=128;else{if(r!==null&&r.flags&128)e:for(r=e.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&yj(r,t,e);else if(r.tag===19)yj(r,t,e);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===e)break e;for(;r.sibling===null;){if(r.return===null||r.return===e)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}n&=1}if(jt(Vt,n),!(e.mode&1))e.memoizedState=null;else switch(s){case"forwards":for(t=e.child,s=null;t!==null;)r=t.alternate,r!==null&&pb(r)===null&&(s=t),t=t.sibling;t=s,t===null?(s=e.child,e.child=null):(s=t.sibling,t.sibling=null),ww(e,!1,s,t,i);break;case"backwards":for(t=null,s=e.child,e.child=null;s!==null;){if(r=s.alternate,r!==null&&pb(r)===null){e.child=s;break}r=s.sibling,s.sibling=t,t=s,s=r}ww(e,!0,t,null,i);break;case"together":ww(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function ly(r,e){!(e.mode&1)&&r!==null&&(r.alternate=null,e.alternate=null,e.flags|=2)}function po(r,e,t){if(r!==null&&(e.dependencies=r.dependencies),Au|=e.lanes,!(t&e.childLanes))return null;if(r!==null&&e.child!==r.child)throw Error(we(153));if(e.child!==null){for(r=e.child,t=El(r,r.pendingProps),e.child=t,t.return=e;r.sibling!==null;)r=r.sibling,t=t.sibling=El(r,r.pendingProps),t.return=e;t.sibling=null}return e.child}function EF(r,e,t){switch(e.tag){case 3:nD(e),Kh();break;case 5:D4(e);break;case 1:Un(e.type)&&lb(e);break;case 4:HS(e,e.stateNode.containerInfo);break;case 10:var n=e.type._context,s=e.memoizedProps.value;jt(db,n._currentValue),n._currentValue=s;break;case 13:if(n=e.memoizedState,n!==null)return n.dehydrated!==null?(jt(Vt,Vt.current&1),e.flags|=128,null):t&e.child.childLanes?sD(r,e,t):(jt(Vt,Vt.current&1),r=po(r,e,t),r!==null?r.sibling:null);jt(Vt,Vt.current&1);break;case 19:if(n=(t&e.childLanes)!==0,r.flags&128){if(n)return iD(r,e,t);e.flags|=128}if(s=e.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),jt(Vt,Vt.current),n)break;return null;case 22:case 23:return e.lanes=0,tD(r,e,t)}return po(r,e,t)}var aD,e_,oD,lD;aD=function(r,e){for(var t=e.child;t!==null;){if(t.tag===5||t.tag===6)r.appendChild(t.stateNode);else if(t.tag!==4&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return;t=t.return}t.sibling.return=t.return,t=t.sibling}};e_=function(){};oD=function(r,e,t,n){var s=r.memoizedProps;if(s!==n){r=e.stateNode,bc(oa.current);var i=null;switch(t){case"input":s=_2(r,s),n=_2(r,n),i=[];break;case"select":s=Xt({},s,{value:void 0}),n=Xt({},n,{value:void 0}),i=[];break;case"textarea":s=k2(r,s),n=k2(r,n),i=[];break;default:typeof s.onClick!="function"&&typeof n.onClick=="function"&&(r.onclick=ab)}E2(t,n);var o;t=null;for(u in s)if(!n.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var l=s[u];for(o in l)l.hasOwnProperty(o)&&(t||(t={}),t[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Rp.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in n){var c=n[u];if(l=s!=null?s[u]:void 0,n.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(o in l)!l.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(t||(t={}),t[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(t||(t={}),t[o]=c[o])}else t||(i||(i=[]),i.push(u,t)),t=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Rp.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&Rt("scroll",r),i||l===c||(i=[])):(i=i||[]).push(u,c))}t&&(i=i||[]).push("style",t);var u=i;(e.updateQueue=u)&&(e.flags|=4)}};lD=function(r,e,t,n){t!==n&&(e.flags|=4)};function Bf(r,e){if(!Ft)switch(r.tailMode){case"hidden":e=r.tail;for(var t=null;e!==null;)e.alternate!==null&&(t=e),e=e.sibling;t===null?r.tail=null:t.sibling=null;break;case"collapsed":t=r.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e||r.tail===null?r.tail=null:r.tail.sibling=null:n.sibling=null}}function Gr(r){var e=r.alternate!==null&&r.alternate.child===r.child,t=0,n=0;if(e)for(var s=r.child;s!==null;)t|=s.lanes|s.childLanes,n|=s.subtreeFlags&14680064,n|=s.flags&14680064,s.return=r,s=s.sibling;else for(s=r.child;s!==null;)t|=s.lanes|s.childLanes,n|=s.subtreeFlags,n|=s.flags,s.return=r,s=s.sibling;return r.subtreeFlags|=n,r.childLanes=t,e}function jF(r,e,t){var n=e.pendingProps;switch(LS(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Gr(e),null;case 1:return Un(e.type)&&ob(),Gr(e),null;case 3:return n=e.stateNode,Zh(),Pt($n),Pt(cn),qS(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(r===null||r.child===null)&&(v0(e)?e.flags|=4:r===null||r.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,bi!==null&&(l_(bi),bi=null))),e_(r,e),Gr(e),null;case 5:zS(e);var s=bc(qp.current);if(t=e.type,r!==null&&e.stateNode!=null)oD(r,e,t,n,s),r.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!n){if(e.stateNode===null)throw Error(we(166));return Gr(e),null}if(r=bc(oa.current),v0(e)){n=e.stateNode,t=e.type;var i=e.memoizedProps;switch(n[na]=e,n[Hp]=i,r=(e.mode&1)!==0,t){case"dialog":Rt("cancel",n),Rt("close",n);break;case"iframe":case"object":case"embed":Rt("load",n);break;case"video":case"audio":for(s=0;s<Jf.length;s++)Rt(Jf[s],n);break;case"source":Rt("error",n);break;case"img":case"image":case"link":Rt("error",n),Rt("load",n);break;case"details":Rt("toggle",n);break;case"input":CE(n,i),Rt("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!i.multiple},Rt("invalid",n);break;case"textarea":jE(n,i),Rt("invalid",n)}E2(t,i),s=null;for(var o in i)if(i.hasOwnProperty(o)){var l=i[o];o==="children"?typeof l=="string"?n.textContent!==l&&(i.suppressHydrationWarning!==!0&&x0(n.textContent,l,r),s=["children",l]):typeof l=="number"&&n.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&x0(n.textContent,l,r),s=["children",""+l]):Rp.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&Rt("scroll",n)}switch(t){case"input":d0(n),EE(n,i,!0);break;case"textarea":d0(n),AE(n);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(n.onclick=ab)}n=s,e.updateQueue=n,n!==null&&(e.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=O3(t)),r==="http://www.w3.org/1999/xhtml"?t==="script"?(r=o.createElement("div"),r.innerHTML="<script><\/script>
40",r=r.removeChild(r.firstChild)):typeof n.is=="string"?r=o.createElement(t,{is:n.is}):(r=o.createElement(t),t==="select"&&(o=r,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):r=o.createElementNS(r,t),r[na]=e,r[Hp]=n,aD(r,e,!1,!1),e.stateNode=r;e:{switch(o=j2(t,n),t){case"dialog":Rt("cancel",r),Rt("close",r),s=n;break;case"iframe":case"object":case"embed":Rt("load",r),s=n;break;case"video":case"audio":for(s=0;s<Jf.length;s++)Rt(Jf[s],r);s=n;break;case"source":Rt("error",r),s=n;break;case"img":case"image":case"link":Rt("error",r),Rt("load",r),s=n;break;case"details":Rt("toggle",r),s=n;break;case"input":CE(r,n),s=_2(r,n),Rt("invalid",r);break;case"option":s=n;break;case"select":r._wrapperState={wasMultiple:!!n.multiple},s=Xt({},n,{value:void 0}),Rt("invalid",r);break;case"textarea":jE(r,n),s=k2(r,n),Rt("invalid",r);break;default:s=n}E2(t,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?B3(r,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&M3(r,c)):i==="children"?typeof c=="string"?(t!=="textarea"||c!=="")&&Pp(r,c):typeof c=="number"&&Pp(r,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Rp.hasOwnProperty(i)?c!=null&&i==="onScroll"&&Rt("scroll",r):c!=null&&vS(r,i,c,o))}switch(t){case"input":d0(r),EE(r,n,!1);break;case"textarea":d0(r),AE(r);break;case"option":n.value!=null&&r.setAttribute("value",""+Tl(n.value));break;case"select":r.multiple=!!n.multiple,i=n.value,i!=null?Bd(r,!!n.multiple,i,!1):n.defaultValue!=null&&Bd(r,!!n.multiple,n.defaultValue,!0);break;default:typeof s.onClick=="function"&&(r.onclick=ab)}switch(t){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}}n&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return Gr(e),null;case 6:if(r&&e.stateNode!=null)lD(r,e,r.memoizedProps,n);else{if(typeof n!="string"&&e.stateNode===null)throw Error(we(166));if(t=bc(qp.current),bc(oa.current),v0(e)){if(n=e.stateNode,t=e.memoizedProps,n[na]=e,(i=n.nodeValue!==t)&&(r=us,r!==null))switch(r.tag){case 3:x0(n.nodeValue,t,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&x0(n.nodeValue,t,(r.mode&1)!==0)}i&&(e.flags|=4)}else n=(t.nodeType===9?t:t.ownerDocument).createTextNode(n),n[na]=e,e.stateNode=n}return Gr(e),null;case 13:if(Pt(Vt),n=e.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(Ft&&cs!==null&&e.mode&1&&!(e.flags&128))C4(),Kh(),e.flags|=98560,i=!1;else if(i=v0(e),n!==null&&n.dehydrated!==null){if(r===null){if(!i)throw Error(we(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(we(317));i[na]=e}else Kh(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Gr(e),i=!1}else bi!==null&&(l_(bi),bi=null),i=!0;if(!i)return e.flags&65536?e:null}return e.flags&128?(e.lanes=t,e):(n=n!==null,n!==(r!==null&&r.memoizedState!==null)&&n&&(e.child.flags|=8192,e.mode&1&&(r===null||Vt.current&1?gr===0&&(gr=3):rk())),e.updateQueue!==null&&(e.flags|=4),Gr(e),null);case 4:return Zh(),e_(r,e),r===null&&$p(e.stateNode.containerInfo),Gr(e),null;
vendor: 26,406 bytes, line 40
40case 10:return BS(e.type._context),Gr(e),null;case 17:return Un(e.type)&&ob(),Gr(e),null;case 19:if(Pt(Vt),i=e.memoizedState,i===null)return Gr(e),null;if(n=(e.flags&128)!==0,o=i.rendering,o===null)if(n)Bf(i,!1);else{if(gr!==0||r!==null&&r.flags&128)for(r=e.child;r!==null;){if(o=pb(r),o!==null){for(e.flags|=128,Bf(i,!1),n=o.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),e.subtreeFlags=0,n=t,t=e.child;t!==null;)i=t,r=n,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=r,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,r=o.dependencies,i.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),t=t.sibling;return jt(Vt,Vt.current&1|2),e.child}r=r.sibling}i.tail!==null&&Zt()>ef&&(e.flags|=128,n=!0,Bf(i,!1),e.lanes=4194304)}else{if(!n)if(r=pb(o),r!==null){if(e.flags|=128,n=!0,t=r.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),Bf(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!Ft)return Gr(e),null}else 2*Zt()-i.renderingStartTime>ef&&t!==1073741824&&(e.flags|=128,n=!0,Bf(i,!1),e.lanes=4194304);i.isBackwards?(o.sibling=e.child,e.child=o):(t=i.last,t!==null?t.sibling=o:e.child=o,i.last=o)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=Zt(),e.sibling=null,t=Vt.current,jt(Vt,n?t&1|2:t&1),e):(Gr(e),null);case 22:case 23:return tk(),n=e.memoizedState!==null,r!==null&&r.memoizedState!==null!==n&&(e.flags|=8192),n&&e.mode&1?os&1073741824&&(Gr(e),e.subtreeFlags&6&&(e.flags|=8192)):Gr(e),null;case 24:return null;case 25:return null}throw Error(we(156,e.tag))}function AF(r,e){switch(LS(e),e.tag){case 1:return Un(e.type)&&ob(),r=e.flags,r&65536?(e.flags=r&-65537|128,e):null;case 3:return Zh(),Pt($n),Pt(cn),qS(),r=e.flags,r&65536&&!(r&128)?(e.flags=r&-65537|128,e):null;case 5:return zS(e),null;case 13:if(Pt(Vt),r=e.memoizedState,r!==null&&r.dehydrated!==null){if(e.alternate===null)throw Error(we(340));Kh()}return r=e.flags,r&65536?(e.flags=r&-65537|128,e):null;case 19:return Pt(Vt),null;case 4:return Zh(),null;case 10:return BS(e.type._context),null;case 22:case 23:return tk(),null;case 24:return null;default:return null}}var N0=!1,sn=!1,TF=typeof WeakSet=="function"?WeakSet:Set,Te=null;function Dd(r,e){var t=r.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(n){Kt(r,e,n)}else t.current=null}function t_(r,e,t){try{t()}catch(n){Kt(r,e,n)}}var bj=!1;function DF(r,e){if(F2=nb,r=f4(),PS(r)){if("selectionStart"in r)var t={start:r.selectionStart,end:r.selectionEnd};else e:{t=(t=r.ownerDocument)&&t.defaultView||window;var n=t.getSelection&&t.getSelection();if(n&&n.rangeCount!==0){t=n.anchorNode;var s=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{t.nodeType,i.nodeType}catch{t=null;break e}var o=0,l=-1,c=-1,u=0,d=0,h=r,f=null;t:for(;;){for(var p;h!==t||s!==0&&h.nodeType!==3||(l=o+s),h!==i||n!==0&&h.nodeType!==3||(c=o+n),h.nodeType===3&&(o+=h.nodeValue.length),(p=h.firstChild)!==null;)f=h,h=p;for(;;){if(h===r)break t;if(f===t&&++u===s&&(l=o),f===i&&++d===n&&(c=o),(p=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=p}t=l===-1||c===-1?null:{start:l,end:c}}else t=null}t=t||{start:0,end:0}}else t=null;for(B2={focusedElem:r,selectionRange:t},nb=!1,Te=e;Te!==null;)if(e=Te,r=e.child,(e.subtreeFlags&1028)!==0&&r!==null)r.return=e,Te=r;else for(;Te!==null;){e=Te;try{var m=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var g=m.memoizedProps,v=m.memoizedState,b=e.stateNode,y=b.getSnapshotBeforeUpdate(e.elementType===e.type?g:ri(e.type,g),v);b.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var w=e.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(we(163))}}catch(_){Kt(e,e.return,_)}if(r=e.sibling,r!==null){r.return=e.return,Te=r;break}Te=e.return}return m=bj,bj=!1,m}function vp(r,e,t){var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var s=n=n.next;do{if((s.tag&r)===r){var i=s.destroy;s.destroy=void 0,i!==void 0&&t_(e,t,i)}s=s.next}while(s!==n)}}function jx(r,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&r)===r){var n=t.create;t.destroy=n()}t=t.next}while(t!==e)}}function r_(r){var e=r.ref;if(e!==null){var t=r.stateNode;switch(r.tag){case 5:r=t;break;default:r=t}typeof e=="function"?e(r):e.current=r}}function cD(r){var e=r.alternate;e!==null&&(r.alternate=null,cD(e)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(e=r.stateNode,e!==null&&(delete e[na],delete e[Hp],delete e[H2],delete e[fF],delete e[pF])),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function uD(r){return r.tag===5||r.tag===3||r.tag===4}function xj(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||uD(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function n_(r,e,t){var n=r.tag;if(n===5||n===6)r=r.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(r,e):t.insertBefore(r,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(r,t)):(e=t,e.appendChild(r)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=ab));else if(n!==4&&(r=r.child,r!==null))for(n_(r,e,t),r=r.sibling;r!==null;)n_(r,e,t),r=r.sibling}function s_(r,e,t){var n=r.tag;if(n===5||n===6)r=r.stateNode,e?t.insertBefore(r,e):t.appendChild(r);else if(n!==4&&(r=r.child,r!==null))for(s_(r,e,t),r=r.sibling;r!==null;)s_(r,e,t),r=r.sibling}var Or=null,gi=!1;function ko(r,e,t){for(t=t.child;t!==null;)dD(r,e,t),t=t.sibling}function dD(r,e,t){if(aa&&typeof aa.onCommitFiberUnmount=="function")try{aa.onCommitFiberUnmount(vx,t)}catch{}switch(t.tag){case 5:sn||Dd(t,e);case 6:var n=Or,s=gi;Or=null,ko(r,e,t),Or=n,gi=s,Or!==null&&(gi?(r=Or,t=t.stateNode,r.nodeType===8?r.parentNode.removeChild(t):r.removeChild(t)):Or.removeChild(t.stateNode));break;case 18:Or!==null&&(gi?(r=Or,t=t.stateNode,r.nodeType===8?pw(r.parentNode,t):r.nodeType===1&&pw(r,t),Mp(r)):pw(Or,t.stateNode));break;case 4:n=Or,s=gi,Or=t.stateNode.containerInfo,gi=!0,ko(r,e,t),Or=n,gi=s;break;case 0:case 11:case 14:case 15:if(!sn&&(n=t.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){s=n=n.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&t_(t,e,o),s=s.next}while(s!==n)}ko(r,e,t);break;case 1:if(!sn&&(Dd(t,e),n=t.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=t.memoizedProps,n.state=t.memoizedState,n.componentWillUnmount()}catch(l){Kt(t,e,l)}ko(r,e,t);break;case 21:ko(r,e,t);break;case 22:t.mode&1?(sn=(n=sn)||t.memoizedState!==null,ko(r,e,t),sn=n):ko(r,e,t);break;default:ko(r,e,t)}}function vj(r){var e=r.updateQueue;if(e!==null){r.updateQueue=null;var t=r.stateNode;t===null&&(t=r.stateNode=new TF),e.forEach(function(n){var s=$F.bind(null,r,n);t.has(n)||(t.add(n),n.then(s,s))})}}function Ys(r,e){var t=e.deletions;if(t!==null)for(var n=0;n<t.length;n++){var s=t[n];try{var i=r,o=e,l=o;e:for(;l!==null;){switch(l.tag){case 5:Or=l.stateNode,gi=!1;break e;case 3:Or=l.stateNode.containerInfo,gi=!0;break e;case 4:Or=l.stateNode.containerInfo,gi=!0;break e}l=l.return}if(Or===null)throw Error(we(160));dD(i,o,s),Or=null,gi=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(u){Kt(s,e,u)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)hD(e,r),e=e.sibling}function hD(r,e){var t=r.alternate,n=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(Ys(e,r),Pi(r),n&4){try{vp(3,r,r.return),jx(3,r)}catch(g){Kt(r,r.return,g)}try{vp(5,r,r.return)}catch(g){Kt(r,r.return,g)}}break;case 1:Ys(e,r),Pi(r),n&512&&t!==null&&Dd(t,t.return);break;case 5:if(Ys(e,r),Pi(r),n&512&&t!==null&&Dd(t,t.return),r.flags&32){var s=r.stateNode;try{Pp(s,"")}catch(g){Kt(r,r.return,g)}}if(n&4&&(s=r.stateNode,s!=null)){var i=r.memoizedProps,o=t!==null?t.memoizedProps:i,l=r.type,c=r.updateQueue;if(r.updateQueue=null,c!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&I3(s,i),j2(l,o);var u=j2(l,i);for(o=0;o<c.length;o+=2){var d=c[o],h=c[o+1];d==="style"?B3(s,h):d==="dangerouslySetInnerHTML"?M3(s,h):d==="children"?Pp(s,h):vS(s,d,h,u)}switch(l){case"input":N2(s,i);break;case"textarea":L3(s,i);break;case"select":var f=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?Bd(s,!!i.multiple,p,!1):f!==!!i.multiple&&(i.defaultValue!=null?Bd(s,!!i.multiple,i.defaultValue,!0):Bd(s,!!i.multiple,i.multiple?[]:"",!1))}s[Hp]=i}catch(g){Kt(r,r.return,g)}}break;case 6:if(Ys(e,r),Pi(r),n&4){if(r.stateNode===null)throw Error(we(162));s=r.stateNode,i=r.memoizedProps;try{s.nodeValue=i}catch(g){Kt(r,r.return,g)}}break;case 3:if(Ys(e,r),Pi(r),n&4&&t!==null&&t.memoizedState.isDehydrated)try{Mp(e.containerInfo)}catch(g){Kt(r,r.return,g)}break;case 4:Ys(e,r),Pi(r);break;case 13:Ys(e,r),Pi(r),s=r.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(QS=Zt())),n&4&&vj(r);break;case 22:if(d=t!==null&&t.memoizedState!==null,r.mode&1?(sn=(u=sn)||d,Ys(e,r),sn=u):Ys(e,r),Pi(r),n&8192){if(u=r.memoizedState!==null,(r.stateNode.isHidden=u)&&!d&&r.mode&1)for(Te=r,d=r.child;d!==null;){for(h=Te=d;Te!==null;){switch(f=Te,p=f.child,f.tag){case 0:case 11:case 14:case 15:vp(4,f,f.return);break;case 1:Dd(f,f.return);var m=f.stateNode;if(typeof m.componentWillUnmount=="function"){n=f,t=f.return;try{e=n,m.props=e.memoizedProps,m.state=e.memoizedState,m.componentWillUnmount()}catch(g){Kt(n,t,g)}}break;case 5:Dd(f,f.return);break;case 22:if(f.memoizedState!==null){_j(h);continue}}p!==null?(p.return=f,Te=p):_j(h)}d=d.sibling}e:for(d=null,h=r;;){if(h.tag===5){if(d===null){d=h;try{s=h.stateNode,u?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=h.stateNode,c=h.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=F3("display",o))}catch(g){Kt(r,r.return,g)}}}else if(h.tag===6){if(d===null)try{h.stateNode.nodeValue=u?"":h.memoizedProps}catch(g){Kt(r,r.return,g)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===r)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===r)break e;for(;h.sibling===null;){if(h.return===null||h.return===r)break e;d===h&&(d=null),h=h.return}d===h&&(d=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:Ys(e,r),Pi(r),n&4&&vj(r);break;case 21:break;default:Ys(e,r),Pi(r)}}function Pi(r){var e=r.flags;if(e&2){try{e:{for(var t=r.return;t!==null;){if(uD(t)){var n=t;break e}t=t.return}throw Error(we(160))}switch(n.tag){case 5:var s=n.stateNode;n.flags&32&&(Pp(s,""),n.flags&=-33);var i=xj(r);s_(r,i,s);break;case 3:case 4:var o=n.stateNode.containerInfo,l=xj(r);n_(r,l,o);break;default:throw Error(we(161))}}catch(c){Kt(r,r.return,c)}r.flags&=-3}e&4096&&(r.flags&=-4097)}function RF(r,e,t){Te=r,fD(r)}function fD(r,e,t){for(var n=(r.mode&1)!==0;Te!==null;){var s=Te,i=s.child;if(s.tag===22&&n){var o=s.memoizedState!==null||N0;if(!o){var l=s.alternate,c=l!==null&&l.memoizedState!==null||sn;l=N0;var u=sn;if(N0=o,(sn=c)&&!u)for(Te=s;Te!==null;)o=Te,c=o.child,o.tag===22&&o.memoizedState!==null?Nj(s):c!==null?(c.return=o,Te=c):Nj(s);for(;i!==null;)Te=i,fD(i),i=i.sibling;Te=s,N0=l,sn=u}wj(r)}else s.subtreeFlags&8772&&i!==null?(i.return=s,Te=i):wj(r)}}function wj(r){for(;Te!==null;){var e=Te;if(e.flags&8772){var t=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:sn||jx(5,e);break;case 1:var n=e.stateNode;if(e.flags&4&&!sn)if(t===null)n.componentDidMount();else{var s=e.elementType===e.type?t.memoizedProps:ri(e.type,t.memoizedProps);n.componentDidUpdate(s,t.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&ij(e,i,n);break;case 3:var o=e.updateQueue;if(o!==null){if(t=null,e.child!==null)switch(e.child.tag){case 5:t=e.child.stateNode;break;case 1:t=e.child.stateNode}ij(e,o,t)}break;case 5:var l=e.stateNode;if(t===null&&e.flags&4){t=l;var c=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&t.focus();break;case"img":c.src&&(t.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var u=e.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var h=d.dehydrated;h!==null&&Mp(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(we(163))}sn||e.flags&512&&r_(e)}catch(f){Kt(e,e.return,f)}}if(e===r){Te=null;break}if(t=e.sibling,t!==null){t.return=e.return,Te=t;break}Te=e.return}}function _j(r){for(;Te!==null;){var e=Te;if(e===r){Te=null;break}var t=e.sibling;if(t!==null){t.return=e.return,Te=t;break}Te=e.return}}function Nj(r){for(;Te!==null;){var e=Te;try{switch(e.tag){case 0:case 11:case 15:var t=e.return;try{jx(4,e)}catch(c){Kt(e,t,c)}break;case 1:var n=e.stateNode;if(typeof n.componentDidMount=="function"){var s=e.return;try{n.componentDidMount()}catch(c){Kt(e,s,c)}}var i=e.return;try{r_(e)}catch(c){Kt(e,i,c)}break;case 5:var o=e.return;try{r_(e)}catch(c){Kt(e,o,c)}}}catch(c){Kt(e,e.return,c)}if(e===r){Te=null;break}var l=e.sibling;if(l!==null){l.return=e.return,Te=l;break}Te=e.return}}var PF=Math.ceil,yb=_o.ReactCurrentDispatcher,JS=_o.ReactCurrentOwner,Fs=_o.ReactCurrentBatchConfig,lt=0,jr=null,nr=null,Fr=0,os=0,Rd=Ul(0),gr=0,Xp=null,Au=0,Ax=0,ZS=0,wp=null,In=null,QS=0,ef=1/0,_a=null,bb=!1,i_=null,kl=null,S0=!1,yl=null,xb=0,_p=0,a_=null,cy=-1,uy=0;function wn(){return lt&6?Zt():cy!==-1?cy:cy=Zt()}function Cl(r){return r.mode&1?lt&2&&Fr!==0?Fr&-Fr:gF.transition!==null?(uy===0&&(uy=J3()),uy):(r=yt,r!==0||(r=window.event,r=r===void 0?16:s4(r.type)),r):1}function Ni(r,e,t,n){if(50<_p)throw _p=0,a_=null,Error(we(185));Rg(r,t,n),(!(lt&2)||r!==jr)&&(r===jr&&(!(lt&2)&&(Ax|=t),gr===4&&Bo(r,Fr)),Hn(r,n),t===1&&lt===0&&!(e.mode&1)&&(ef=Zt()+500,kx&&Hl()))}function Hn(r,e){var t=r.callbackNode;gM(r,e);var n=rb(r,r===jr?Fr:0);if(n===0)t!==null&&RE(t),r.callbackNode=null,r.callbackPriority=0;else if(e=n&-n,r.callbackPriority!==e){if(t!=null&&RE(t),e===1)r.tag===0?mF(Sj.bind(null,r)):N4(Sj.bind(null,r)),dF(function(){!(lt&6)&&Hl()}),t=null;else{switch(Z3(n)){case 1:t=kS;break;case 4:t=Y3;break;case 16:t=tb;break;case 536870912:t=K3;break;default:t=tb}t=wD(t,pD.bind(null,r))}r.callbackPriority=e,r.callbackNode=t}}function pD(r,e){if(cy=-1,uy=0,lt&6)throw Error(we(327));var t=r.callbackNode;if(qd()&&r.callbackNode!==t)return null;var n=rb(r,r===jr?Fr:0);if(n===0)return null;if(n&30||n&r.expiredLanes||e)e=vb(r,n);else{e=n;var s=lt;lt|=2;var i=gD();(jr!==r||Fr!==e)&&(_a=null,ef=Zt()+500,bu(r,e));do try{OF();break}catch(l){mD(r,l)}while(!0);FS(),yb.current=i,lt=s,nr!==null?e=0:(jr=null,Fr=0,e=gr)}if(e!==0){if(e===2&&(s=P2(r),s!==0&&(n=s,e=o_(r,s))),e===1)throw t=Xp,bu(r,0),Bo(r,n),Hn(r,Zt()),t;if(e===6)Bo(r,n);else{if(s=r.current.alternate,!(n&30)&&!IF(s)&&(e=vb(r,n),e===2&&(i=P2(r),i!==0&&(n=i,e=o_(r,i))),e===1))throw t=Xp,bu(r,0),Bo(r,n),Hn(r,Zt()),t;switch(r.finishedWork=s,r.finishedLanes=n,e){case 0:case 1:throw Error(we(345));case 2:nc(r,In,_a);break;case 3:if(Bo(r,n),(n&130023424)===n&&(e=QS+500-Zt(),10<e)){if(rb(r,0)!==0)break;if(s=r.suspendedLanes,(s&n)!==n){wn(),r.pingedLanes|=r.suspendedLanes&s;break}r.timeoutHandle=U2(nc.bind(null,r,In,_a),e);break}nc(r,In,_a);break;case 4:if(Bo(r,n),(n&4194240)===n)break;for(e=r.eventTimes,s=-1;0<n;){var o=31-_i(n);i=1<<o,o=e[o],o>s&&(s=o),n&=~i}if(n=s,n=Zt()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*PF(n/1960))-n,10<n){r.timeoutHandle=U2(nc.bind(null,r,In,_a),n);break}nc(r,In,_a);break;case 5:nc(r,In,_a);break;default:throw Error(we(329))}}}return Hn(r,Zt()),r.callbackNode===t?pD.bind(null,r):null}function o_(r,e){var t=wp;return r.current.memoizedState.isDehydrated&&(bu(r,e).flags|=256),r=vb(r,e),r!==2&&(e=In,In=t,e!==null&&l_(e)),r}function l_(r){In===null?In=r:In.push.apply(In,r)}function IF(r){for(var e=r;;){if(e.flags&16384){var t=e.updateQueue;if(t!==null&&(t=t.stores,t!==null))for(var n=0;n<t.length;n++){var s=t[n],i=s.getSnapshot;s=s.value;try{if(!Ci(i(),s))return!1}catch{return!1}}}if(t=e.child,e.subtreeFlags&16384&&t!==null)t.return=e,e=t;else{if(e===r)break;for(;e.sibling===null;){if(e.return===null||e.return===r)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Bo(r,e){for(e&=~ZS,e&=~Ax,r.suspendedLanes|=e,r.pingedLanes&=~e,r=r.expirationTimes;0<e;){var t=31-_i(e),n=1<<t;r[t]=-1,e&=~n}}function Sj(r){if(lt&6)throw Error(we(327));qd();var e=rb(r,0);if(!(e&1))return Hn(r,Zt()),null;var t=vb(r,e);if(r.tag!==0&&t===2){var n=P2(r);n!==0&&(e=n,t=o_(r,n))}if(t===1)throw t=Xp,bu(r,0),Bo(r,e),Hn(r,Zt()),t;if(t===6)throw Error(we(345));return r.finishedWork=r.current.alternate,r.finishedLanes=e,nc(r,In,_a),Hn(r,Zt()),null}function ek(r,e){var t=lt;lt|=1;try{return r(e)}finally{lt=t,lt===0&&(ef=Zt()+500,kx&&Hl())}}function Tu(r){yl!==null&&yl.tag===0&&!(lt&6)&&qd();var e=lt;lt|=1;var t=Fs.transition,n=yt;try{if(Fs.transition=null,yt=1,r)return r()}finally{yt=n,Fs.transition=t,lt=e,!(lt&6)&&Hl()}}function tk(){os=Rd.current,Pt(Rd)}function bu(r,e){r.finishedWork=null,r.finishedLanes=0;var t=r.timeoutHandle;if(t!==-1&&(r.timeoutHandle=-1,uF(t)),nr!==null)for(t=nr.return;t!==null;){var n=t;switch(LS(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&ob();break;case 3:Zh(),Pt($n),Pt(cn),qS();break;case 5:zS(n);break;case 4:Zh();break;case 13:Pt(Vt);break;case 19:Pt(Vt);break;case 10:BS(n.type._context);break;case 22:case 23:tk()}t=t.return}if(jr=r,nr=r=El(r.current,null),Fr=os=e,gr=0,Xp=null,ZS=Ax=Au=0,In=wp=null,yc!==null){for(e=0;e<yc.length;e++)if(t=yc[e],n=t.interleaved,n!==null){t.interleaved=null;var s=n.next,i=t.pending;if(i!==null){var o=i.next;i.next=s,n.next=o}t.pending=n}yc=null}return r}function mD(r,e){do{var t=nr;try{if(FS(),ay.current=gb,mb){for(var n=Gt.memoizedState;n!==null;){var s=n.queue;s!==null&&(s.pending=null),n=n.next}mb=!1}if(ju=0,Cr=pr=Gt=null,xp=!1,Wp=0,JS.current=null,t===null||t.return===null){gr=1,Xp=e,nr=null;break}e:{var i=r,o=t.return,l=t,c=e;if(e=Fr,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=l,h=d.tag;if(!(d.mode&1)&&(h===0||h===11||h===15)){var f=d.alternate;f?(d.updateQueue=f.updateQueue,d.memoizedState=f.memoizedState,d.lanes=f.lanes):(d.updateQueue=null,d.memoizedState=null)}var p=dj(o);if(p!==null){p.flags&=-257,hj(p,o,l,i,e),p.mode&1&&uj(i,u,e),e=p,c=u;var m=e.updateQueue;if(m===null){var g=new Set;g.add(c),e.updateQueue=g}else m.add(c);break e}else{if(!(e&1)){uj(i,u,e),rk();break e}c=Error(we(426))}}else if(Ft&&l.mode&1){var v=dj(o);if(v!==null){!(v.flags&65536)&&(v.flags|=256),hj(v,o,l,i,e),OS(Qh(c,l));break e}}i=c=Qh(c,l),gr!==4&&(gr=2),wp===null?wp=[i]:wp.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var b=Z4(i,c,e);sj(i,b);break e;case 1:l=c;var y=i.type,w=i.stateNode;if(!(i.flags&128)&&(typeof y.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(kl===null||!kl.has(w)))){i.flags|=65536,e&=-e,i.lanes|=e;var _=Q4(i,l,e);sj(i,_);break e}}i=i.return}while(i!==null)}bD(t)}catch(N){e=N,nr===t&&t!==null&&(nr=t=t.return);continue}break}while(!0)}function gD(){var r=yb.current;return yb.current=gb,r===null?gb:r}function rk(){(gr===0||gr===3||gr===2)&&(gr=4),jr===null||!(Au&268435455)&&!(Ax&268435455)||Bo(jr,Fr)}function vb(r,e){var t=lt;lt|=2;var n=gD();(jr!==r||Fr!==e)&&(_a=null,bu(r,e));do try{LF();break}catch(s){mD(r,s)}while(!0);if(FS(),lt=t,yb.current=n,nr!==null)throw Error(we(261));return jr=null,Fr=0,gr}function LF(){for(;nr!==null;)yD(nr)}function OF(){for(;nr!==null&&!oM();)yD(nr)}function yD(r){var e=vD(r.alternate,r,os);r.memoizedProps=r.pendingProps,e===null?bD(r):nr=e,JS.current=null}function bD(r){var e=r;do{var t=e.alternate;if(r=e.return,e.flags&32768){if(t=AF(t,e),t!==null){t.flags&=32767,nr=t;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{gr=6,nr=null;return}}else if(t=jF(t,e,os),t!==null){nr=t;return}if(e=e.sibling,e!==null){nr=e;return}nr=e=r}while(e!==null);gr===0&&(gr=5)}function nc(r,e,t){var n=yt,s=Fs.transition;try{Fs.transition=null,yt=1,MF(r,e,t,n)}finally{Fs.transition=s,yt=n}return null}function MF(r,e,t,n){do qd();while(yl!==null);if(lt&6)throw Error(we(327));t=r.finishedWork;var s=r.finishedLanes;if(t===null)return null;if(r.finishedWork=null,r.finishedLanes=0,t===r.current)throw Error(we(177));r.callbackNode=null,r.callbackPriority=0;var i=t.lanes|t.childLanes;if(yM(r,i),r===jr&&(nr=jr=null,Fr=0),!(t.subtreeFlags&2064)&&!(t.flags&2064)||S0||(S0=!0,wD(tb,function(){return qd(),null})),i=(t.flags&15990)!==0,t.subtreeFlags&15990||i){i=Fs.transition,Fs.transition=null;var o=yt;yt=1;var l=lt;lt|=4,JS.current=null,DF(r,t),hD(t,r),nF(B2),nb=!!F2,B2=F2=null,r.current=t,RF(t),lM(),lt=l,yt=o,Fs.transition=i}else r.current=t;if(S0&&(S0=!1,yl=r,xb=s),i=r.pendingLanes,i===0&&(kl=null),dM(t.stateNode),Hn(r,Zt()),e!==null)for(n=r.onRecoverableError,t=0;t<e.length;t++)s=e[t],n(s.value,{componentStack:s.stack,digest:s.digest});if(bb)throw bb=!1,r=i_,i_=null,r;return xb&1&&r.tag!==0&&qd(),i=r.pendingLanes,i&1?r===a_?_p++:(_p=0,a_=r):_p=0,Hl(),null}function qd(){if(yl!==null){var r=Z3(xb),e=Fs.transition,t=yt;try{if(Fs.transition=null,yt=16>r?16:r,yl===null)var n=!1;else{if(r=yl,yl=null,xb=0,lt&6)throw Error(we(331));var s=lt;for(lt|=4,Te=r.current;Te!==null;){var i=Te,o=i.child;if(Te.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(Te=u;Te!==null;){var d=Te;switch(d.tag){case 0:case 11:case 15:vp(8,d,i)}var h=d.child;if(h!==null)h.return=d,Te=h;else for(;Te!==null;){d=Te;var f=d.sibling,p=d.return;if(cD(d),d===u){Te=null;break}if(f!==null){f.return=p,Te=f;break}Te=p}}}var m=i.alternate;if(m!==null){var g=m.child;if(g!==null){m.child=null;do{var v=g.sibling;g.sibling=null,g=v}while(g!==null)}}Te=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,Te=o;else e:for(;Te!==null;){if(i=Te,i.flags&2048)switch(i.tag){case 0:case 11:case 15:vp(9,i,i.return)}var b=i.sibling;if(b!==null){b.return=i.return,Te=b;break e}Te=i.return}}var y=r.current;for(Te=y;Te!==null;){o=Te;var w=o.child;if(o.subtreeFlags&2064&&w!==null)w.return=o,Te=w;else e:for(o=y;Te!==null;){if(l=Te,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:jx(9,l)}}catch(N){Kt(l,l.return,N)}if(l===o){Te=null;break e}var _=l.sibling;if(_!==null){_.return=l.return,Te=_;break e}Te=l.return}}if(lt=s,Hl(),aa&&typeof aa.onPostCommitFiberRoot=="function")try{aa.onPostCommitFiberRoot(vx,r)}catch{}n=!0}return n}finally{yt=t,Fs.transition=e}}return!1}function kj(r,e,t){e=Qh(t,e),e=Z4(r,e,1),r=Sl(r,e,1),e=wn(),r!==null&&(Rg(r,1,e),Hn(r,e))}function Kt(r,e,t){if(r.tag===3)kj(r,r,t);else for(;e!==null;){if(e.tag===3){kj(e,r,t);break}else if(e.tag===1){var n=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(kl===null||!kl.has(n))){r=Qh(t,r),r=Q4(e,r,1),e=Sl(e,r,1),r=wn(),e!==null&&(Rg(e,1,r),Hn(e,r));break}}e=e.return}}function FF(r,e,t){var n=r.pingCache;n!==null&&n.delete(e),e=wn(),r.pingedLanes|=r.suspendedLanes&t,jr===r&&(Fr&t)===t&&(gr===4||gr===3&&(Fr&130023424)===Fr&&500>Zt()-QS?bu(r,0):ZS|=t),Hn(r,e)}function xD(r,e){e===0&&(r.mode&1?(e=p0,p0<<=1,!(p0&130023424)&&(p0=4194304)):e=1);var t=wn();r=fo(r,e),r!==null&&(Rg(r,e,t),Hn(r,t))}function BF(r){var e=r.memoizedState,t=0;e!==null&&(t=e.retryLane),xD(r,t)}function $F(r,e){var t=0;switch(r.tag){case 13:var n=r.stateNode,s=r.memoizedState;s!==null&&(t=s.retryLane);break;case 19:n=r.stateNode;break;default:throw Error(we(314))}n!==null&&n.delete(e),xD(r,t)}var vD;vD=function(r,e,t){if(r!==null)if(r.memoizedProps!==e.pendingProps||$n.current)Mn=!0;else{if(!(r.lanes&t)&&!(e.flags&128))return Mn=!1,EF(r,e,t);Mn=!!(r.flags&131072)}else Mn=!1,Ft&&e.flags&1048576&&S4(e,ub,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;ly(r,e),r=e.pendingProps;var s=Yh(e,cn.current);zd(e,t),s=VS(null,e,n,r,s,t);var i=GS();return e.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Un(n)?(i=!0,lb(e)):i=!1,e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,US(e),s.updater=Ex,e.stateNode=s,s._reactInternals=e,X2(e,n,r,t),e=J2(null,e,n,!0,i,t)):(e.tag=0,Ft&&i&&IS(e),yn(null,e,s,t),e=e.child),e;case 16:n=e.elementType;e:{switch(ly(r,e),r=e.pendingProps,s=n._init,n=s(n._payload),e.type=n,s=e.tag=HF(n),r=ri(n,r),s){case 0:e=K2(null,e,n,r,t);break e;case 1:e=mj(null,e,n,r,t);break e;case 11:e=fj(null,e,n,r,t);break e;case 14:e=pj(null,e,n,ri(n.type,r),t);break e}throw Error(we(306,n,""))}return e;case 0:return n=e.type,s=e.pendingProps,s=e.elementType===n?s:ri(n,s),K2(r,e,n,s,t);case 1:return n=e.type,s=e.pendingProps,s=e.elementType===n?s:ri(n,s),mj(r,e,n,s,t);case 3:e:{if(nD(e),r===null)throw Error(we(387));n=e.pendingProps,i=e.memoizedState,s=i.element,T4(r,e),fb(e,n,null,t);var o=e.memoizedState;if(n=o.element,i.isDehydrated)if(i={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){s=Qh(Error(we(423)),e),e=gj(r,e,n,t,s);break e}else if(n!==s){s=Qh(Error(we(424)),e),e=gj(r,e,n,t,s);break e}else for(cs=Nl(e.stateNode.containerInfo.firstChild),us=e,Ft=!0,bi=null,t=j4(e,null,n,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(Kh(),n===s){e=po(r,e,t);break e}yn(r,e,n,t)}e=e.child}return e;case 5:return D4(e),r===null&&W2(e),n=e.type,s=e.pendingProps,i=r!==null?r.memoizedProps:null,o=s.children,$2(n,s)?o=null:i!==null&&$2(n,i)&&(e.flags|=32),rD(r,e),yn(r,e,o,t),e.child;case 6:return r===null&&W2(e),null;case 13:return sD(r,e,t);case 4:return HS(e,e.stateNode.containerInfo),n=e.pendingProps,r===null?e.child=Jh(e,null,n,t):yn(r,e,n,t),e.child;case 11:return n=e.type,s=e.pendingProps,s=e.elementType===n?s:ri(n,s),fj(r,e,n,s,t);case 7:return yn(r,e,e.pendingProps,t),e.child;case 8:return yn(r,e,e.pendingProps.children,t),e.child;case 12:return yn(r,e,e.pendingProps.children,t),e.child;
vendor: 4,552 bytes, line 40
40case 10:e:{if(n=e.type._context,s=e.pendingProps,i=e.memoizedProps,o=s.value,jt(db,n._currentValue),n._currentValue=o,i!==null)if(Ci(i.value,o)){if(i.children===s.children&&!$n.current){e=po(r,e,t);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var l=i.dependencies;if(l!==null){o=i.child;for(var c=l.firstContext;c!==null;){if(c.context===n){if(i.tag===1){c=so(-1,t&-t),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}i.lanes|=t,c=i.alternate,c!==null&&(c.lanes|=t),V2(i.return,t,e),l.lanes|=t;break}c=c.next}}else if(i.tag===10)o=i.type===e.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(we(341));o.lanes|=t,l=o.alternate,l!==null&&(l.lanes|=t),V2(o,t,e),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}yn(r,e,s.children,t),e=e.child}return e;case 9:return s=e.type,n=e.pendingProps.children,zd(e,t),s=Hs(s),n=n(s),e.flags|=1,yn(r,e,n,t),e.child;case 14:return n=e.type,s=ri(n,e.pendingProps),s=ri(n.type,s),pj(r,e,n,s,t);case 15:return eD(r,e,e.type,e.pendingProps,t);case 17:return n=e.type,s=e.pendingProps,s=e.elementType===n?s:ri(n,s),ly(r,e),e.tag=1,Un(n)?(r=!0,lb(e)):r=!1,zd(e,t),J4(e,n,s),X2(e,n,s,t),J2(null,e,n,!0,r,t);case 19:return iD(r,e,t);case 22:return tD(r,e,t)}throw Error(we(156,e.tag))};function wD(r,e){return X3(r,e)}function UF(r,e,t,n){this.tag=r,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ms(r,e,t,n){return new UF(r,e,t,n)}function nk(r){return r=r.prototype,!(!r||!r.isReactComponent)}function HF(r){if(typeof r=="function")return nk(r)?1:0;if(r!=null){if(r=r.$$typeof,r===_S)return 11;if(r===NS)return 14}return 2}function El(r,e){var t=r.alternate;return t===null?(t=Ms(r.tag,e,r.key,r.mode),t.elementType=r.elementType,t.type=r.type,t.stateNode=r.stateNode,t.alternate=r,r.alternate=t):(t.pendingProps=e,t.type=r.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=r.flags&14680064,t.childLanes=r.childLanes,t.lanes=r.lanes,t.child=r.child,t.memoizedProps=r.memoizedProps,t.memoizedState=r.memoizedState,t.updateQueue=r.updateQueue,e=r.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=r.sibling,t.index=r.index,t.ref=r.ref,t}function dy(r,e,t,n,s,i){var o=2;if(n=r,typeof r=="function")nk(r)&&(o=1);else if(typeof r=="string")o=5;else e:switch(r){case _d:return xu(t.children,s,i,e);case wS:o=8,s|=8;break;case b2:return r=Ms(12,t,e,s|2),r.elementType=b2,r.lanes=i,r;case x2:return r=Ms(13,t,e,s),r.elementType=x2,r.lanes=i,r;case v2:return r=Ms(19,t,e,s),r.elementType=v2,r.lanes=i,r;case D3:return Tx(t,s,i,e);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case A3:o=10;break e;case T3:o=9;break e;case _S:o=11;break e;case NS:o=14;break e;case Lo:o=16,n=null;break e}throw Error(we(130,r==null?r:typeof r,""))}return e=Ms(o,t,e,s),e.elementType=r,e.type=n,e.lanes=i,e}function xu(r,e,t,n){return r=Ms(7,r,n,e),r.lanes=t,r}function Tx(r,e,t,n){return r=Ms(22,r,n,e),r.elementType=D3,r.lanes=t,r.stateNode={isHidden:!1},r}function _w(r,e,t){return r=Ms(6,r,null,e),r.lanes=t,r}function Nw(r,e,t){return e=Ms(4,r.children!==null?r.children:[],r.key,e),e.lanes=t,e.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},e}function zF(r,e,t,n,s){this.tag=e,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=nw(0),this.expirationTimes=nw(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=nw(0),this.identifierPrefix=n,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function sk(r,e,t,n,s,i,o,l,c){return r=new zF(r,e,t,l,c),e===1?(e=1,i===!0&&(e|=8)):e=0,i=Ms(3,null,null,e),r.current=i,i.stateNode=r,i.memoizedState={element:n,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},US(i),r}function qF(r,e,t){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;
vendor: 7,000 bytes, line 40
40return{$$typeof:wd,key:n==null?null:""+n,children:r,containerInfo:e,implementation:t}}function _D(r){if(!r)return Dl;r=r._reactInternals;e:{if(qu(r)!==r||r.tag!==1)throw Error(we(170));var e=r;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Un(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(we(171))}if(r.tag===1){var t=r.type;if(Un(t))return _4(r,t,e)}return e}function ND(r,e,t,n,s,i,o,l,c){return r=sk(t,n,!0,r,s,i,o,l,c),r.context=_D(null),t=r.current,n=wn(),s=Cl(t),i=so(n,s),i.callback=e??null,Sl(t,i,s),r.current.lanes=s,Rg(r,s,n),Hn(r,n),r}function Dx(r,e,t,n){var s=e.current,i=wn(),o=Cl(s);return t=_D(t),e.context===null?e.context=t:e.pendingContext=t,e=so(i,o),e.payload={element:r},n=n===void 0?null:n,n!==null&&(e.callback=n),r=Sl(s,e,o),r!==null&&(Ni(r,s,o,i),iy(r,s,o)),o}function wb(r){if(r=r.current,!r.child)return null;switch(r.child.tag){case 5:return r.child.stateNode;default:return r.child.stateNode}}function Cj(r,e){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var t=r.retryLane;r.retryLane=t!==0&&t<e?t:e}}function ik(r,e){Cj(r,e),(r=r.alternate)&&Cj(r,e)}function WF(){return null}var SD=typeof reportError=="function"?reportError:function(r){console.error(r)};function ak(r){this._internalRoot=r}Rx.prototype.render=ak.prototype.render=function(r){var e=this._internalRoot;if(e===null)throw Error(we(409));Dx(r,e,null,null)};Rx.prototype.unmount=ak.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var e=r.containerInfo;Tu(function(){Dx(null,r,null,null)}),e[ho]=null}};function Rx(r){this._internalRoot=r}Rx.prototype.unstable_scheduleHydration=function(r){if(r){var e=t4();r={blockedOn:null,target:r,priority:e};for(var t=0;t<Fo.length&&e!==0&&e<Fo[t].priority;t++);Fo.splice(t,0,r),t===0&&n4(r)}};function ok(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function Px(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function Ej(){}function VF(r,e,t,n,s){if(s){if(typeof n=="function"){var i=n;n=function(){var u=wb(o);i.call(u)}}var o=ND(e,n,r,0,null,!1,!1,"",Ej);return r._reactRootContainer=o,r[ho]=o.current,$p(r.nodeType===8?r.parentNode:r),Tu(),o}for(;s=r.lastChild;)r.removeChild(s);if(typeof n=="function"){var l=n;n=function(){var u=wb(c);l.call(u)}}var c=sk(r,0,!1,null,null,!1,!1,"",Ej);return r._reactRootContainer=c,r[ho]=c.current,$p(r.nodeType===8?r.parentNode:r),Tu(function(){Dx(e,c,t,n)}),c}function Ix(r,e,t,n,s){var i=t._reactRootContainer;if(i){var o=i;if(typeof s=="function"){var l=s;s=function(){var c=wb(o);l.call(c)}}Dx(e,o,r,s)}else o=VF(t,e,r,s,n);return wb(o)}Q3=function(r){switch(r.tag){case 3:var e=r.stateNode;if(e.current.memoizedState.isDehydrated){var t=Kf(e.pendingLanes);t!==0&&(CS(e,t|1),Hn(e,Zt()),!(lt&6)&&(ef=Zt()+500,Hl()))}break;case 13:Tu(function(){var n=fo(r,1);if(n!==null){var s=wn();Ni(n,r,1,s)}}),ik(r,1)}};ES=function(r){if(r.tag===13){var e=fo(r,134217728);if(e!==null){var t=wn();Ni(e,r,134217728,t)}ik(r,134217728)}};e4=function(r){if(r.tag===13){var e=Cl(r),t=fo(r,e);if(t!==null){var n=wn();Ni(t,r,e,n)}ik(r,e)}};t4=function(){return yt};r4=function(r,e){var t=yt;try{return yt=r,e()}finally{yt=t}};T2=function(r,e,t){switch(e){case"input":if(N2(r,t),e=t.name,t.type==="radio"&&e!=null){for(t=r;t.parentNode;)t=t.parentNode;for(t=t.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<t.length;e++){var n=t[e];if(n!==r&&n.form===r.form){var s=Sx(n);if(!s)throw Error(we(90));P3(n),N2(n,s)}}}break;case"textarea":L3(r,t);break;case"select":e=t.value,e!=null&&Bd(r,!!t.multiple,e,!1)}};H3=ek;z3=Tu;var GF={usingClientEntryPoint:!1,Events:[Ig,Cd,Sx,$3,U3,ek]},$f={findFiberByHostInstance:gc,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},XF={bundleType:$f.bundleType,version:$f.version,rendererPackageName:$f.rendererPackageName,rendererConfig:$f.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:_o.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=V3(r),r===null?null:r.stateNode},findFiberByHostInstance:$f.findFiberByHostInstance||WF,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var k0=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!k0.isDisabled&&k0.supportsFiber)try{vx=k0.inject(XF),aa=k0}catch{}}fs.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=GF;fs.createPortal=function(r,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!ok(e))throw Error(we(200));return qF(r,e,null,t)};fs.createRoot=function(r,e){if(!ok(r))throw Error(we(299));var t=!1,n="",s=SD;return e!=null&&(e.unstable_strictMode===!0&&(t=!0),e.identifierPrefix!==void 0&&(n=e.identifierPrefix),e.onRecoverableError!==void 0&&(s=e.onRecoverableError)),e=sk(r,1,!1,null,null,t,!1,n,s),r[ho]=e.current,$p(r.nodeType===8?r.parentNode:r),new ak(e)};fs.findDOMNode=function(r){if(r==null)return null;if(r.nodeType===1)return r;var e=r._reactInternals;if(e===void 0)throw typeof r.render=="function"?Error(we(188)):(r=Object.keys(r).join(","),Error(we(268,r)));return r=V3(e),r=r===null?null:r.stateNode,r};fs.flushSync=function(r){return Tu(r)};fs.hydrate=function(r,e,t){if(!Px(e))throw Error(we(200));return Ix(null,r,e,!0,t)};fs.hydrateRoot=function(r,e,t){if(!ok(r))throw Error(we(405));var n=t!=null&&t.hydratedSources||null,s=!1,i="",o=SD;if(t!=null&&(t.unstable_strictMode===!0&&(s=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),e=ND(e,null,r,1,t??null,s,!1,i,o),r[ho]=e.current,$p(r),n)for(r=0;r<n.length;r++)t=n[r],s=t._getVersion,s=s(t._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[t,s]:e.mutableSourceEagerHydrationData.push(t,s);return new Rx(e)};fs.render=function(r,e,t){if(!Px(e))throw Error(we(200));return Ix(null,r,e,!1,t)};fs.unmountComponentAtNode=function(r){if(!Px(r))throw Error(we(40));return r._reactRootContainer?(Tu(function(){Ix(null,null,r,!1,function(){r._reactRootContainer=null,r[ho]=null})}),!0):!1};fs.unstable_batchedUpdates=ek;fs.unstable_renderSubtreeIntoContainer=function(r,e,t,n){if(!Px(t))throw Error(we(200));if(r==null||r._reactInternals===void 0)throw Error(we(38));return Ix(r,e,t,!1,n)};fs.version="18.3.1-next-f1338f8080-20240426";function kD(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(kD)}catch(r){console.error(r)}}kD(),k3.exports=fs;var YF=k3.exports,CD,jj=YF;CD=jj.createRoot,jj.hydrateRoot;/**
41 * react-router v7.16.0
42 *
43 * Copyright (c) Remix Software Inc.
44 *
45 * This source code is licensed under the MIT license found in the
46 * LICENSE.md file in the root directory of this source tree.
47 *
48 * @license MIT
49 */var Aj="popstate";function Tj(r){return typeof r=="object"&&r!=null&&"pathname"in r&&"search"in r&&"hash"in r&&"state"in r&&"key"in r}function KF(r={}){function e(n,s){var u;let i=(u=s.state)==null?void 0:u.masked,{pathname:o,search:l,hash:c}=i||n.location;return c_("",{pathname:o,search:l,hash:c},s.state&&s.state.usr||null,s.state&&s.state.key||"default",i?{pathname:n.location.pathname,search:n.location.search,hash:n.location.hash}:void 0)}function t(n,s){return typeof s=="string"?s:Yp(s)}return ZF(e,t,null,r)}function $t(r,e){if(r===!1||r===null||typeof r>"u")throw new Error(e)}function qs(r,e){if(!r){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function JF(){return Math.random().toString(36).substring(2,10)}function Dj(r,e){return{usr:r.state,key:r.key,idx:e,masked:r.mask?{pathname:r.pathname,search:r.search,hash:r.hash}:void 0}}function c_(r,e,t=null,n,s){return{pathname:typeof r=="string"?r:r.pathname,search:"",hash:"",...typeof e=="string"?bf(e):e,state:t,key:e&&e.key||n||JF(),mask:s}}function Yp({pathname:r="/",search:e="",hash:t=""}){return e&&e!=="?"&&(r+=e.charAt(0)==="?"?e:"?"+e),t&&t!=="#"&&(r+=t.charAt(0)==="#"?t:"#"+t),r}function bf(r){let e={};if(r){let t=r.indexOf("#");t>=0&&(e.hash=r.substring(t),r=r.substring(0,t));let n=r.indexOf("?");n>=0&&(e.search=r.substring(n),r=r.substring(0,n)),r&&(e.pathname=r)}return e}function ZF(r,e,t,n={}){let{window:s=document.defaultView,v5Compat:i=!1}=n,o=s.history,l="POP",c=null,u=d();u==null&&(u=0,o.replaceState({...o.state,idx:u},""));function d(){return(o.state||{idx:null}).idx}function h(){l="POP";let v=d(),b=v==null?null:v-u;u=v,c&&c({action:l,location:g.location,delta:b})}function f(v,b){l="PUSH";let y=Tj(v)?v:c_(g.location,v,b);u=d()+1;let w=Dj(y,u),_=g.createHref(y.mask||y);try{o.pushState(w,"",_)}catch(N){if(N instanceof DOMException&&N.name==="DataCloneError")throw N;s.location.assign(_)}i&&c&&c({action:l,location:g.location,delta:1})}function p(v,b){l="REPLACE";let y=Tj(v)?v:c_(g.location,v,b);u=d();let w=Dj(y,u),_=g.createHref(y.mask||y);o.replaceState(w,"",_),i&&c&&c({action:l,location:g.location,delta:0})}function m(v){return QF(s,v)}let g={get action(){return l},get location(){return r(s,o)},listen(v){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener(Aj,h),c=v,()=>{s.removeEventListener(Aj,h),c=null}},createHref(v){return e(s,v)},createURL:m,encodeLocation(v){let b=m(v);return{pathname:b.pathname,search:b.search,hash:b.hash}},push:f,replace:p,go(v){return o.go(v)}};return g}function QF(r,e,t=!1){let n="http://localhost";r&&(n=r.location.origin!=="null"?r.location.origin:r.location.href),$t(n,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:Yp(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=n+s),new URL(s,n)}function ED(r,e,t="/"){return e9(r,e,t,!1)}function e9(r,e,t,n,s){let i=typeof e=="string"?bf(e):e,o=mo(i.pathname||"/",t);if(o==null)return null;let l=t9(r),c=null,u=f9(o);for(let d=0;c==null&&d<l.length;++d)c=d9(l[d],u,n);return c}function t9(r){let e=jD(r);return r9(e),e}function jD(r,e=[],t=[],n="",s=!1){let i=(o,l,c=s,u)=>{let d={relativePath:u===void 0?o.path||"":u,caseSensitive:o.caseSensitive===!0,childrenIndex:l,route:o};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(n)&&c)return;$t(d.relativePath.startsWith(n),`Absolute route path "${d.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(n.length)}let h=Si([n,d.relativePath]),f=t.concat(d);o.children&&o.children.length>0&&($t(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),jD(o.children,e,f,h,c)),!(o.path==null&&!o.index)&&e.push({path:h,score:c9(h,o.index),routesMeta:f})};return r.forEach((o,l)=>{var c;if(o.path===""||!((c=o.path)!=null&&c.includes("?")))i(o,l);else for(let u of AD(o.path))i(o,l,!0,u)}),e}function AD(r){let e=r.split("/");if(e.length===0)return[];let[t,...n]=e,s=t.endsWith("?"),i=t.replace(/\?$/,"");if(n.length===0)return s?[i,""]:[i];let o=AD(n.join("/")),l=[];return l.push(...o.map(c=>c===""?i:[i,c].join("/"))),s&&l.push(...o),l.map(c=>r.startsWith("/")&&c===""?"/":c)}function r9(r){r.sort((e,t)=>
49e.score!==t.score?t.score-e.score:u9(e.routesMeta.map(n=>n.childrenIndex),t.routesMeta.map(n=>n.childrenIndex)))}var n9=/^:[\w-]+$/,s9=3,i9=2,a9=1,o9=10,l9=-2,Rj=r=>r==="*";function c9(r,e){let t=r.split("/"),n=t.length;return t.some(Rj)&&(n+=l9),e&&(n+=i9),t.filter(s=>!Rj(s)).reduce((s,i)=>s+(n9.test(i)?s9:i===""?a9:o9),n)}function u9(r,e){return r.length===e.length&&r.slice(0,-1).every((n,s)=>n===e[s])?r[r.length-1]-e[e.length-1]:0}function d9(r,e,t=!1){let{routesMeta:n}=r,s={},i="/",o=[];for(let l=0;l<n.length;++l){let c=n[l],u=l===n.length-1,d=i==="/"?e:e.slice(i.length)||"/",h=_b({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},d),f=c.route;if(!h&&u&&t&&!n[n.length-1].route.index&&(h=_b({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},d)),!h)return null;Object.assign(s,h.params),o.push({params:s,pathname:Si([i,h.pathname]),pathnameBase:y9(Si([i,h.pathnameBase])),route:f}),h.pathnameBase!=="/"&&(i=Si([i,h.pathnameBase]))}return o}function _b(r,e){typeof r=="string"&&(r={path:r,caseSensitive:!1,end:!0});let[t,n]=h9(r.path,r.caseSensitive,r.end),s=e.match(t);if(!s)return null;let i=s[0],o=i.replace(/(.)\/+$/,"$1"),l=s.slice(1);return{params:n.reduce((u,{paramName:d,isOptional:h},f)=>{if(d==="*"){let m=l[f]||"";o=i.slice(0,i.length-m.length).replace(/(.)\/+$/,"$1")}const p=l[f];return h&&!p?u[d]=void 0:u[d]=(p||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:o,pattern:r}}function h9(r,e=!1,t=!0){qs(r==="*"||!r.endsWith("*")||r.endsWith("/*"),`Route path "${r}" will be treated as if it were "${r.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${r.replace(/\*$/,"/*")}".`);let n=[],s="^"+r.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c,u,d)=>{if(n.push({paramName:l,isOptional:c!=null}),c){let h=d.charAt(u+o.length);return h&&h!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return r.endsWith("*")?(n.push({paramName:"*"}),s+=r==="*"||r==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):t?s+="\\/*$":r!==""&&r!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,e?void 0:"i"),n]}function f9(r){try{return r.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return qs(!1,`The URL path "${r}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),r}}function mo(r,e){if(e==="/")return r;if(!r.toLowerCase().startsWith(e.toLowerCase()))return null;let t=e.endsWith("/")?e.length-1:e.length,n=r.charAt(t);return n&&n!=="/"?null:r.slice(t)||"/"}var p9=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function m9(r,e="/"){let{pathname:t,search:n="",hash:s=""}=typeof r=="string"?bf(r):r,i;return t?(t=TD(t),t.startsWith("/")?i=Pj(t.substring(1),"/"):i=Pj(t,e)):i=e,{pathname:i,search:b9(n),hash:x9(s)}}function Pj(r,e){let t=Nb(e).split("/");return r.split("/").forEach(s=>{s===".."?t.length>1&&t.pop():s!=="."&&t.push(s)}),t.length>1?t.join("/"):"/"}function Sw(r,e,t,n){return`Cannot include a '${r}' character in a manually specified \`to.${e}\` field [${JSON.stringify(n)}].  Please separate it out to the \`to.${t}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function g9(r){return r.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function lk(r){let e=g9(r);return e.map((t,n)=>n===e.length-1?t.pathname:t.pathnameBase)}function Lx(r,e,t,n=!1){let s;typeof r=="string"?s=bf(r):(s={...r},$t(!s.pathname||!s.pathname.includes("?"),Sw("?","pathname","search",s)),$t(!s.pathname||!s.pathname.includes("#"),Sw("#","pathname","hash",s)),$t(!s.search||!s.search.includes("#"),Sw("#","search","hash",s)));let i=r===""||s.pathname==="",o=i?"/":s.pathname,l;if(o==null)l=t;else{let h=e.length-1;if(!n&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),h-=1;s.pathname=f.join("/")}l=h>=0?e[h]:"/"}let c=m9(s,l),u=o&&o!=="/"&&o.endsWith("/"),d=(i||o===".")&&t.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}var TD=r=>r.replace(/\/\/+/g,"/"),Si=r=>TD(r.join("/")),Nb=r=>r.replace(/\/+$/,""),y9=r=>Nb(r).replace(/^\/*/,"/"),b9=r=>!r||r==="?"?"":r.startsWith("?")?r:"?"+r,x9=r=>!r||r==="#"?"":r.startsWith("#")?r:"#"+r,v9=class{constructor(r,e,t,n=!1){this.status=r,this.statusText=e||"",this.internal=n,t instanceof Error?(this.data=t.toString(),this.error=t):this.data=t}};function w9(r){return r!=null&&typeof r.status=="number"&&typeof r.statusText=="string"&&typeof r.internal=="boolean"&&"data"in r}function _9(r){let e=r.map(t=>
49t.route.path).filter(Boolean);return Si(e)||"/"}var DD=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function RD(r,e){let t=r;if(typeof t!="string"||!p9.test(t))return{absoluteURL:void 0,isExternal:!1,to:t};let n=t,s=!1;if(DD)try{let i=new URL(window.location.href),o=t.startsWith("//")?new URL(i.protocol+t):new URL(t),l=mo(o.pathname,e);o.origin===i.origin&&l!=null?t=l+o.search+o.hash:s=!0}catch{qs(!1,`<Link to="${t}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:n,isExternal:s,to:t}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var PD=["POST","PUT","PATCH","DELETE"];new Set(PD);var N9=["GET",...PD];new Set(N9);var xf=k.createContext(null);xf.displayName="DataRouter";var Ox=k.createContext(null);Ox.displayName="DataRouterState";var ID=k.createContext(!1);function S9(){return k.useContext(ID)}var LD=k.createContext({isTransitioning:!1});LD.displayName="ViewTransition";var k9=k.createContext(new Map);k9.displayName="Fetchers";var C9=k.createContext(null);C9.displayName="Await";var ms=k.createContext(null);ms.displayName="Navigation";var Og=k.createContext(null);Og.displayName="Location";var ji=k.createContext({outlet:null,matches:[],isDataRoute:!1});ji.displayName="Route";var ck=k.createContext(null);ck.displayName="RouteError";var OD="REACT_ROUTER_ERROR",E9="REDIRECT",j9="ROUTE_ERROR_RESPONSE";function A9(r){if(r.startsWith(`${OD}:${E9}:{`))try{let e=JSON.parse(r.slice(28));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.location=="string"&&typeof e.reloadDocument=="boolean"&&typeof e.replace=="boolean")return e}catch{}}function T9(r){if(r.startsWith(`${OD}:${j9}:{`))try{let e=JSON.parse(r.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new v9(e.status,e.statusText,e.data)}catch{}}function D9(r,{relative:e}={}){$t(vf(),"useHref() may be used only in the context of a <Router> component.");let{basename:t,navigator:n}=k.useContext(ms),{hash:s,pathname:i,search:o}=Fg(r,{relative:e}),l=i;return t!=="/"&&(l=i==="/"?t:Si([t,i])),n.createHref({pathname:l,search:o,hash:s})}function vf(){return k.useContext(Og)!=null}function It(){return $t(vf(),"useLocation() may be used only in the context of a <Router> component."),k.useContext(Og).location}var MD="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function FD(r){k.useContext(ms).static||k.useLayoutEffect(r)}function Mg(){let{isDataRoute:r}=k.useContext(ji);return r?q9():R9()}function R9(){$t(vf(),"useNavigate() may be used only in the context of a <Router> component.");
49let r=k.useContext(xf),{basename:e,navigator:t}=k.useContext(ms),{matches:n}=k.useContext(ji),{pathname:s}=It(),i=JSON.stringify(lk(n)),o=k.useRef(!1);return FD(()=>{o.current=!0}),k.useCallback((c,u={})=>{if(qs(o.current,MD),!o.current)return;if(typeof c=="number"){t.go(c);return}let d=Lx(c,JSON.parse(i),s,u.relative==="path");r==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:Si([e,d.pathname])),(u.replace?t.replace:t.push)(d,u.state,u)},[e,t,i,s,r])}k.createContext(null);function uk(){let{matches:r}=k.useContext(ji),e=r[r.length-1];return(e==null?void 0:e.params)??{}}function Fg(r,{relative:e}={}){let{matches:t}=k.useContext(ji),{pathname:n}=It(),s=JSON.stringify(lk(t));return k.useMemo(()=>Lx(r,JSON.parse(s),n,e==="path"),[r,s,n,e])}function P9(r,e){return BD(r,e)}function BD(r,e,t){var v;$t(vf(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:n}=k.useContext(ms),{matches:s}=k.useContext(ji),i=s[s.length-1],o=i?i.params:{},l=i?i.pathname:"/",c=i?i.pathnameBase:"/",u=i&&i.route;{let b=u&&u.path||"";UD(l,!u||b.endsWith("*")||b.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${b}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
50
51Please change the parent <Route path="${b}"> to <Route path="${b==="/"?"*":`${b}/*`}">.`)}let d=It(),h;if(e){let b=typeof e=="string"?bf(e):e;$t(c==="/"||((v=b.pathname)==null?void 0:v.startsWith(c)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${b.pathname}" was given in the \`location\` prop.`),h=b}else h=d;let f=h.pathname||"/",p=f;if(c!=="/"){let b=c.replace(/^\//,"").split("/");p="/"+f.replace(/^\//,"").split("/").slice(b.length).join("/")}let m=t&&t.state.matches.length?t.state.matches.map(b=>Object.assign(b,{route:t.manifest[b.route.id]||b.route})):ED(r,{pathname:p});qs(u||m!=null,`No routes matched location "${h.pathname}${h.search}${h.hash}" `),qs(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${h.pathname}${h.search}${h.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let g=F9(m&&m.map(b=>Object.assign({},b,{params:Object.assign({},o,b.params),pathname:Si([c,n.encodeLocation?n.encodeLocation(b.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:b.pathname]),pathnameBase:b.pathnameBase==="/"?c:Si([c,n.encodeLocation?n.encodeLocation(b.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:b.pathnameBase])})),s,t);return e&&g?k.createElement(Og.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...h},navigationType:"POP"}},g):g}function I9(){let r=z9(),e=w9(r)?`${r.status} ${r.statusText}`:r instanceof Error?r.message:JSON.stringify(r),t=r instanceof Error?r.stack:null,n="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:n},i={padding:"2px 4px",backgroundColor:n},o=null;return console.error("Error handled by React Router default ErrorBoundary:",r),o=k.createElement(k.Fragment,null,k.createElement("p",null,"💿 Hey developer 👋"),k.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",k.createElement("code",{style:i},"ErrorBoundary")," or"," ",k.createElement("code",{style:i},"errorElement")," prop on your route.")),k.createElement(k.Fragment,null,k.createElement("h2",null,"Unexpected Application Error!"),k.createElement("h3",{style:{fontStyle:"italic"}},e),t?k.createElement("pre",{style:s},t):null,o)}var L9=k.createElement(I9,null),$D=class extends k.Component{constructor(r){super(r),this.state={location:r.location,revalidation:r.revalidation,error:r.error}}static getDerivedStateFromError(r){return{error:r}}static getDerivedStateFromProps(r,e){return e.location!==r.location||e.revalidation!=="idle"&&r.revalidation==="idle"?{error:r.error,location:r.location,revalidation:r.revalidation}:{error:r.error!==void 0?r.error:e.error,location:e.location,revalidation:r.revalidation||e.revalidation}}componentDidCatch(r,e){this.props.onError?this.props.onError(r,e):console.error("React Router caught the following error during render",r)}render(){let r=this.state.error;if(this.context&&typeof r=="object"&&r&&"digest"in r&&typeof r.digest=="string"){const t=T9(r.digest);t&&(r=t)}let e=r!==void 0?k.createElement(ji.Provider,{value:this.props.routeContext},k.createElement(ck.Provider,{value:r,children:this.props.component})):this.props.children;return this.context?k.createElement(O9,{error:r},e):e}};$D.contextType=ID;var kw=new WeakMap;function O9({children:r,error:e}){let{basename:t}=k.useContext(ms);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let n=A9(e.digest);if(n){let s=kw.get(e);if(s)throw s;let i=RD(n.location,t);if(DD&&!kw.get(e))if(i.isExternal||n.reloadDocument)window.location.href=i.absoluteURL||i.to;else{const o=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:n.replace}));throw kw.set(e,o),o}return k.createElement("meta",{httpEquiv:"refresh",content:`0;url=${i.absoluteURL||i.to}`})}}return r}function M9({routeContext:r,match:e,children:t}){let n=k.useContext(xf);return n&&n.static&&n.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=e.route.id),k.createElement(ji.Provider,{value:r},t)}function F9(r,e=[],t){let n=t==null?void 0:t.state;if(r==null){if(!n)return null;if(n.errors)r=n.matches;else if(e.length===0&&!n.initialized&&n.matches.length>0)r=n.matches;else return null}let s=r,i=n==null?void 0:n.errors;if(i!=null){let d=s.findIndex(h=>h.route.id&&(i==null?void 0:i[h.route.id])!==void 0);$t(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),s=s.slice(0,Math.min(s.length,d+1))}let o=!1,l=-1;if(t&&n){o=n.renderFallback;for(let d=0;d<s.length;d++){let h=s[d];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(l=d),h.route.id){let{loaderData:f,errors:p}
51=n,m=h.route.loader&&!f.hasOwnProperty(h.route.id)&&(!p||p[h.route.id]===void 0);if(h.route.lazy||m){t.isStatic&&(o=!0),l>=0?s=s.slice(0,l+1):s=[s[0]];break}}}}let c=t==null?void 0:t.onError,u=n&&c?(d,h)=>{var f,p;c(d,{location:n.location,params:((p=(f=n.matches)==null?void 0:f[0])==null?void 0:p.params)??{},pattern:_9(n.matches),errorInfo:h})}:void 0;return s.reduceRight((d,h,f)=>{let p,m=!1,g=null,v=null;n&&(p=i&&h.route.id?i[h.route.id]:void 0,g=h.route.errorElement||L9,o&&(l<0&&f===0?(UD("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),m=!0,v=null):l===f&&(m=!0,v=h.route.hydrateFallbackElement||null)));let b=e.concat(s.slice(0,f+1)),y=()=>{let w;return p?w=g:m?w=v:h.route.Component?w=k.createElement(h.route.Component,null):h.route.element?w=h.route.element:w=d,k.createElement(M9,{match:h,routeContext:{outlet:d,matches:b,isDataRoute:n!=null},children:w})};return n&&(h.route.ErrorBoundary||h.route.errorElement||f===0)?k.createElement($D,{location:n.location,revalidation:n.revalidation,component:g,error:p,children:y(),routeC
51ontext:{outlet:null,matches:b,isDataRoute:!0},onError:u}):y()},null)}function dk(r){return`${r} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function B9(r){let e=k.useContext(xf);return $t(e,dk(r)),e}function $9(r){let e=k.useContext(Ox);return $t(e,dk(r)),e}function U9(r){let e=k.useContext(ji);return $t(e,dk(r)),e}function hk(r){let e=U9(r),t=e.matches[e.matches.length-1];return $t(t.route.id,`${r} can only be used on routes that contain a unique "id"`),t.route.id}function H9(){return hk("useRouteId")}function z9(){var n;let r=k.useContext(ck),e=$9("useRouteError"),t=hk("useRouteError");return r!==void 0?r:(n=e.errors)==null?void 0:n[t]}function q9(){let{router:r}=B9("useNavigate"),e=hk("useNavigate"),t=k.useRef(!1);return FD(()=>{t.current=!0}),k.useCallback(async(s,i={})=>{qs(t.current,MD),t.current&&(typeof s=="number"?await r.navigate(s):await r.navigate(s,{fromRouteId:e,...i}))},[r,e])}var Ij={};function UD(r,e,t){!e&&!Ij[r]&&(Ij[r]=!0,qs(!1,t))}k.memo(W9);function W9({routes:r,manifest:e,future:t,state:n,isStatic:s,onError:i}){return BD(r,void 0,{manifest:e,state:n,isStatic:s,onError:i,future:t})}function V9({to:r,replace:e,state:t,relative:n}){$t(vf(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=k.useContext(ms);qs(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:i}=k.useContext(ji),{pathname:o}=It(),l=Mg(),c=Lx(r,lk(i),o,n==="path"),u=JSON.stringify(c);return k.useEffect(()=>{l(JSON.parse(u),{replace:e,state:t,relative:n})},[l,u,n,e,t]),null}function Mt(r){$t(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function G9({basename:r="/",children:e=null,location:t,navigationType:n="POP",navigator:s,static:i=!1,useTransitions:o}){$t(!vf(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=r.replace(/^\/*/,"/"),c=k.useMemo(()=>({basename:l,navigator:s,static:i,useTransitions:o,future:{}}),[l,s,i,o]);typeof t=="string"&&(t=bf(t));let{pathname:u="/",search:d="",hash:h="",state:f=null,key:p="default",mask:m}=t,g=k.useMemo(()=>{let v=mo(u,l);return v==null?null:{location:{pathname:v,search:d,hash:h,state:f,key:p,mask:m},navigationType:n}},[l,u,d,h,f,p,n,m]);return qs(g!=null,`<Router basename="${l}"> is not able to match the URL "${u}${d}${h}" because it does not start with the basename, so the <Router> won't render anything.`),g==null?null:k.createElement(ms.Provider,{value:c},k.createElement(Og.Provider,{children:e,value:g}))}function u_({children:r,location:e}){return P9(d_(r),e)}function d_(r,e=[]){let t=[];return k.Children.forEach(r,(n,s)=>{if(!k.isValidElement(n))return;let i=[...e,s];if(n.type===k.Fragment){t.push.apply(t,d_(n.props.children,i));return}$t(n.type===Mt,`[${typeof n.type=="string"?n.type:n.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),$t(!n.props.index||!n.props.children,"An index route cannot have child routes.");let o={id:n.props.id||i.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,middleware:n.props.middleware,loader:n.props.loader,action:n.props.action,hydrateFallbackElement:n.props.hydrateFallbackElement,HydrateFallback:n.props.HydrateFallback,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.hasErrorBoundary===!0||n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(o.children=d_(n.props.children,i)),t.push(o)}),t}var hy="get",fy="application/x-www-form-urlencoded";function Mx(r){return typeof HTMLElement<"u"&&r instanceof HTMLElement}function X9(r){return Mx(r)&&r.tagName.toLowerCase()==="button"}function Y9(r){return Mx(r)&&r.tagName.toLowerCase()==="form"}function K9(r){return Mx(r)&&r.tagName.toLowerCase()==="input"}function J9(r){return!!(r.metaKey||r.altKey||r.ctrlKey||r.shiftKey)}function Z9(r,e){return r.button===0&&(!e||e==="_self")&&!J9(r)}function h_(r=""){return new URLSearchParams(typeof r=="string"||Array.isArray(r)||r instanceof URLSearchParams?r:Object.keys(r).reduce((e,t)=>
51{let n=r[t];return e.concat(Array.isArray(n)?n.map(s=>[t,s]):[[t,n]])},[]))}function Q9(r,e){let t=h_(r);return e&&e.forEach((n,s)=>{t.has(s)||e.getAll(s).forEach(i=>{t.append(s,i)})}),t}var C0=null;function e7(){if(C0===null)try{new FormData(document.createElement("form"),0),C0=!1}catch{C0=!0}return C0}var t7=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Cw(r){return r!=null&&!t7.has(r)?(qs(!1,`"${r}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${fy}"`),null):r}function r7(r,e){let t,n,s,i,o;if(Y9(r)){let l=r.getAttribute("action");n=l?mo(l,e):null,t=r.getAttribute("method")||hy,s=Cw(r.getAttribute("enctype"))||fy,i=new FormData(r)}else if(X9(r)||K9(r)&&(r.type==="submit"||r.type==="image")){let l=r.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=r.getAttribute("formaction")||l.getAttribute("action");if(n=c?mo(c,e):null,t=r.getAttribute("formmethod")||l.getAttribute("method")||hy,s=Cw(r.getAttribute("formenctype"))||Cw(l.getAttribute("enctype"))||fy,i=new FormData(l,r),!e7()){let{name:u,type:d,value:h}=r;if(d==="image"){let f=u?`${u}.`:"";i.append(`${f}x`,"0"),i.append(`${f}y`,"0")}else u&&i.append(u,h)}}else{if(Mx(r))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');t=hy,n=null,s=fy,o=r}return i&&s==="text/plain"&&(o=i,i=void 0),{action:n,method:t.toLowerCase(),encType:s,formData:i,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function fk(r,e){if(r===!1||r===null||typeof r>"u")throw new Error(e)}function HD(r,e,t,n){let s=typeof r=="string"?new URL(r,typeof window>"u"?"server://singlefetch/":window.location.origin):r;return t?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${n}`:s.pathname=`${s.pathname}.${n}`:s.pathname==="/"?s.pathname=`_root.${n}`:e&&mo(s.pathname,e)==="/"?s.pathname=`${Nb(e)}/_root.${n}`:s.pathname=`${Nb(s.pathname)}.${n}`,s}async function n7(r,e){if(r.id in e)return e[r.id];try{let t=await import(r.module);return e[r.id]=t,t}catch(t){return console.error(`Error loading route module \`${r.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function s7(r){return r==null?!1:r.href==null?r.rel==="preload"&&typeof r.imageSrcSet=="string"&&typeof r.imageSizes=="string":typeof r.rel=="string"&&typeof r.href=="string"}async function i7(r,e,t){let n=await Promise.all(r.map(async s=>{let i=e.routes[s.route.id];if(i){let o=await n7(i,t);return o.links?o.links():[]}return[]}));return c7(n.flat(1).filter(s7).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function Lj(r,e,t,n,s,i){let o=(c,u)=>t[u]?c.route.id!==t[u].route.id:!0,l=(c,u)=>{var d;return t[u].pathname!==c.pathname||((d=t[u].route.path)==null?void 0:d.endsWith("*"))&&t[u].params["*"]!==c.params["*"]};return i==="assets"?e.filter((c,u)=>o(c,u)||l(c,u)):i==="data"?e.filter((c,u)=>{var h;let d=n.routes[c.route.id];if(!d||!d.hasLoader)return!1;if(o(c,u)||l(c,u))return!0;if(c.route.shouldRevalidate){let f=c.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((h=t[0])==null?void 0:h.params)||{},nextUrl:new URL(r,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof f=="boolean")return f}return!0}):[]}function a7(r,e,{includeHydrateFallback:t}={}){return o7(r.map(n=>{let s=e.routes[n.route.id];if(!s)return[];let i=[s.module];return s.clientActionModule&&(i=i.concat(s.clientActionModule)),s.clientLoaderModule&&(i=i.concat(s.clientLoaderModule)),t&&s.hydrateFallbackModule&&(i=i.concat(s.hydrateFallbackModule)),s.imports&&(i=i.concat(s.imports)),i}).flat(1))}function o7(r){return[...new Set(r)]}function l7(r){let e={},t=Object.keys(r).sort();for(let n of t)e[n]=r[n];return e}function c7(r,e){let t=new Set;return new Set(e),r.reduce((n,s)=>{let i=JSON.stringify(l7(s));return t.has(i)||(t.add(i),n.push({key:i,link:s})),n},[])}function pk(){let r=k.useContext(xf);return fk(r,"You must render this element inside a <DataRouterContext.Provider> element"),r}function u7(){let r=k.useContext(Ox);return fk(r,"You must render this element inside a <DataRouterStateContext.Provider> element"),r}var mk=k.createContext(void 0);mk.displayName="FrameworkContext";function gk(){let r=k.useContext(mk);return fk(r,"You must render this element inside a <HydratedRouter> element"),r}function d7(r,e){let t=k.useContext(mk),[n,s]=k.useState(!1),[i,o]=k.useState(!1),{onFocus:l,onBlur:c,onMouseEnter:u,onMouseLeave:d,onTouchStart:h}=e,f=k.useRef(null);k.useEffect(()=>{if(r==="render"&&o(!0),r==="viewport"){let g=b=>{b.forEach(y=>{o(y.isIntersecting)})},v=new IntersectionObserver(g,{threshold:.5});return f.current&&v.observe(f.current),()=>{v.disconnect()}}},[r]),k.useEffect(()=>{if(n){let g=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(g)}}},[n]);let p=()=>{s(!0)},m=()=>{s(!1),o(!1)};return t?r!=="intent"?[i,f,{}]:[i,f,{onFocus:Uf(l,p),onBlur:Uf(c,m),onMouseEnter:Uf(u,p),onMouseLeave:Uf(d,m),onTouchStart:Uf(h,p)}]:[!1,f,{}]}function Uf(r,e){return t=>{r&&r(t),t.defaultPrevented||e(t)}}function h7({page:r,...e}){let t=S9(),{router:n}=pk(),s=k.useMemo(()=>ED(n.routes,r,n.basename),[n.routes,r,n.basename]);return s?t?k.createElement(p7,{page:r,matches:s,...e}):k.createElement(m7,{page:r,matches:s,...e}):null}function f7(r){let{manifest:e,routeModules:t}=gk(),[n,s]=k.useState([]);return k.useEffect(()=>{let i=!1;return i7(r,e,t).then(o=>{i||s(o)}),()=>{i=!0}},[r,e,t]),n}function p7({page:r,matches:e,...t}){let n=It(),{future:s}=gk(),{basename:i}=pk(),o=k.useMemo(()=>
51{if(r===n.pathname+n.search+n.hash)return[];let l=HD(r,i,s.v8_trailingSlashAwareDataRequests,"rsc"),c=!1,u=[];for(let d of e)typeof d.route.shouldRevalidate=="function"?c=!0:u.push(d.route.id);return c&&u.length>0&&l.searchParams.set("_routes",u.join(",")),[l.pathname+l.search]},[i,s.v8_trailingSlashAwareDataRequests,r,n,e]);return k.createElement(k.Fragment,null,o.map(l=>k.createElement("link",{key:l,rel:"prefetch",as:"fetch",href:l,...t})))}function m7({page:r,matches:e,...t}){let n=It(),{future:s,manifest:i,routeModules:o}=gk(),{basename:l}=pk(),{loaderData:c,matches:u}=u7(),d=k.useMemo(()=>Lj(r,e,u,i,n,"data"),[r,e,u,i,n]),h=k.useMemo(()=>Lj(r,e,u,i,n,"assets"),[r,e,u,i,n]),f=k.useMemo(()=>{if(r===n.pathname+n.search+n.hash)return[];let g=new Set,v=!1;if(e.forEach(y=>{var _;let w=i.routes[y.route.id];!w||!w.hasLoader||(!d.some(N=>N.route.id===y.route.id)&&y.route.id in c&&((_=o[y.route.id])!=null&&_.shouldRevalidate)||w.hasClientLoader?v=!0:g.add(y.route.id))}),g.size===0)return[];let b=HD(r,l,s.v8_trailingSlashAwareDataRequests,"data");return v&&g.size>0&&b.searchParams.set("_routes",e.filter(y=>g.has(y.route.id)).map(y=>y.route.id).join(",")),[b.pathname+b.search]},[l,s.v8_trailingSlashAwareDataRequests,c,n,i,d,e,r,o]),p=k.useMemo(()=>a7(h,i),[h,i]),m=f7(h);return k.createElement(k.Fragment,null,f.map(g=>k.createElement("link",{key:g,rel:"prefetch",as:"fetch",href:g,...t})),p.map(g=>k.createElement("link",{key:g,rel:"modulepreload",href:g,...t})),m.map(({key:g,link:v})=>k.createElement("link",{key:g,nonce:t.nonce,...v,crossOrigin:v.crossOrigin??t.crossOrigin})))}function g7(...r){return e=>{r.forEach(t=>{typeof t=="function"?t(e):t!=null&&(t.current=e)})}}var y7=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{y7&&(window.__reactRouterVersion="7.16.0")}catch{}function b7({basename:r,children:e,useTransitions:t,window:n}){let s=k.useRef();s.current==null&&(s.current=KF({window:n,v5Compat:!0}));let i=s.current,[o,l]=k.useState({action:i.action,location:i.location}),c=k.useCallback(u=>{t===!1?l(u):k.startTransition(()=>l(u))},[t]);return k.useLayoutEffect(()=>i.listen(c),[i,c]),k.createElement(G9,{basename:r,children:e,location:o.location,navigationType:o.action,navigator:i,useTransitions:t})}var zD=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,$e=k.forwardRef(function({onClick:e,discover:t="render",prefetch:n="none",relative:s,reloadDocument:i,replace:o,mask:l,state:c,target:u,to:d,preventScrollReset:h,viewTransition:f,defaultShouldRevalidate:p,...m},g){let{basename:v,navigator:b,useTransitions:y}=k.useContext(ms),w=typeof d=="string"&&zD.test(d),_=RD(d,v);d=_.to;let N=D9(d,{relative:s}),S=It(),E=null;if(l){let M=Lx(l,[],S.mask?S.mask.pathname:"/",!0);v!=="/"&&(M.pathname=M.pathname==="/"?v:Si([v,M.pathname])),E=b.createHref(M)}let[T,D,R]=d7(n,m),H=_7(d,{replace:o,mask:l,state:c,target:u,preventScrollReset:h,relative:s,viewTransition:f,defaultShouldRevalidate:p,useTransitions:y});function A(M){e&&e(M),M.defaultPrevented||H(M)}let U=!(_.isExternal||i),C=k.createElement("a",{...m,...R,href:(U?E:void 0)||_.absoluteURL||N,onClick:U?A:e,ref:g7(g,D),target:u,"data-discover":!w&&t==="render"?"true":void 0});return T&&!w?k.createElement(k.Fragment,null,C,k.createElement(h7,{page:N})):C});$e.displayName="Link";var x7=k.forwardRef(function({"aria-current":e="page",caseSensitive:t=!1,className:n="",end:s=!1,style:i,to:o,viewTransition:l,children:c,...u},d){let h=Fg(o,{relative:u.relative}),f=It(),p=k.useContext(Ox),{navigator:m,basename:g}=k.useContext(ms),v=p!=null&&E7(h)&&l===!0,b=m.encodeLocation?m.encodeLocation(h).pathname:h.pathname,y=f.pathname,w=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;t||(y=y.toLowerCase(),w=w?w.toLowerCase():null,b=b.toLowerCase()),w&&g&&(w=mo(w,g)||w);const _=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let N=y===b||!s&&y.startsWith(b)&&y.charAt(_)==="/",S=w!=null&&(w===b||!s&&w.startsWith(b)&&w.charAt(b.length)==="/"),E={isActive:N,isPending:S,isTransitioning:v},T=N?e:void 0,D;typeof n=="function"?D=n(E):D=[n,N?"active":null,S?"pending":null,v?"transitioning":null].filter(
51Boolean).join(" ");let R=typeof i=="function"?i(E):i;return k.createElement($e,{...u,"aria-current":T,className:D,ref:d,style:R,to:o,viewTransition:l},typeof c=="function"?c(E):c)});x7.displayName="NavLink";var v7=k.forwardRef(({discover:r="render",fetcherKey:e,navigate:t,reloadDocument:n,replace:s,state:i,method:o=hy,action:l,onSubmit:c,relative:u,preventScrollReset:d,viewTransition:h,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:g}=k.useContext(ms),v=k7(),b=C7(l,{relative:u}),y=o.toLowerCase()==="get"?"get":"post",w=typeof l=="string"&&zD.test(l),_=N=>{if(c&&c(N),N.defaultPrevented)return;N.preventDefault();let S=N.nativeEvent.submitter,E=(S==null?void 0:S.getAttribute("formmethod"))||o,T=()=>v(S||N.currentTarget,{fetcherKey:e,method:E,navigate:t,replace:s,state:i,relative:u,preventScrollReset:d,viewTransition:h,defaultShouldRevalidate:f});g&&t!==!1?k.startTransition(()=>T()):T()};return k.createElement("form",{ref:m,method:y,action:b,onSubmit:n?c:_,...p,"data-discover":!w&&r==="render"?"true":void 0})});v7.displayName="Form";function w7(r){return`${r} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function qD(r){let e=k.useContext(xf);return $t(e,w7(r)),e}function _7(r,{target:e,replace:t,mask:n,state:s,preventScrollReset:i,relative:o,viewTransition:l,defaultShouldRevalidate:c,useTransitions:u}={}){let d=Mg(),h=It(),f=Fg(r,{relative:o});return k.useCallback(p=>{if(Z9(p,e)){p.preventDefault();let m=t!==void 0?t:Yp(h)===Yp(f),g=()=>d(r,{replace:m,mask:n,state:s,preventScrollReset:i,relative:o,viewTransition:l,defaultShouldRevalidate:c});u?k.startTransition(()=>g()):g()}},[h,d,f,t,n,s,e,r,i,o,l,c,u])}function WD(r){qs(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let e=k.useRef(h_(r)),t=k.useRef(!1),n=It(),s=k.useMemo(()=>Q9(n.search,t.current?null:e.current),[n.search]),i=Mg(),o=k.useCallback((l,c)=>{const u=h_(typeof l=="function"?l(new URLSearchParams(s)):l);t.current=!0,i("?"+u,c)},[i,s]);return[s,o]}var N7=0,S7=()=>`__${String(++N7)}__`;function k7(){let{router:r}=qD("useSubmit"),{basename:e}=k.useContext(ms),t=H9(),n=r.fetch,s=r.navigate;return k.useCallback(async(i,o={})=>{let{action:l,method:c,encType:u,formData:d,body:h}=r7(i,e);if(o.navigate===!1){let f=o.fetcherKey||S7();await n(f,t,o.action||l,{defaultShouldRevalidate:o.defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:d,body:h,formMethod:o.method||c,formEncType:o.encType||u,flushSync:o.flushSync})}else await s(o.action||l,{defaultShouldRevalidate:o.defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:d,body:h,formMethod:o.method||c,formEncType:o.encType||u,replace:o.replace,state:o.state,fromRouteId:t,flushSync:o.flushSync,viewTransition:o.viewTransition})},[n,s,e,t])}function C7(r,{relative:e}={}){let{basename:t}=k.useContext(ms),n=k.useContext(ji);$t(n,"useFormAction must be used inside a RouteContext");let[s]=n.matches.slice(-1),i={...Fg(r||".",{relative:e})},o=It();if(r==null){i.search=o.search;let l=new URLSearchParams(i.search),c=l.getAll("index");if(c.some(d=>d==="")){l.delete("index"),c.filter(h=>h).forEach(h=>l.append("index",h));let d=l.toString();i.search=d?`?${d}`:""}}return(!r||r===".")&&s.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),t!=="/"&&(i.pathname=i.pathname==="/"?t:Si([t,i.pathname])),Yp(i)}function E7(r,{relative:e}={}){let t=k.useContext(LD);$t(t!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=qD("useViewTransitionState"),s=Fg(r,{relative:e});if(!t.isTransitioning)return!1;let i=mo(t.currentLocation.pathname,n)||t.currentLocation.pathname,o=mo(t.nextLocation.pathname,n)||t.nextLocation.pathname;return _b(s.pathname,o)!=null||_b(s.pathname,i)!=null}const j7="modulepreload",A7=function(r){return"/"+r},Oj={},eo=function(e,t,n){let s=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(t.map(c=>
51{if(c=A7(c),c in Oj)return;Oj[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":j7,u||(h.as="script"),h.crossOrigin="",h.href=c,l&&h.setAttribute("nonce",l),document.head.appendChild(h),u)return new Promise((f,p)=>{h.addEventListener("load",f),h.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return s.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return e().catch(i)})},T7=r=>{let e;return r?e=r:typeof fetch>"u"?e=(...t)=>eo(async()=>{const{default:n}=await Promise.resolve().then(()=>wf);return{default:n}},[]).then(({default:n})=>n(...t)):e=fetch,(...t)=>e(...t)};class yk extends Error{constructor(e,t="FunctionsError",n){super(e),this.name=t,this.context=n}}class D7 extends yk{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class Mj extends yk{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class Fj extends yk{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var f_;(function(r){r.Any="any",r.ApNortheast1="ap-northeast-1",r.ApNortheast2="ap-northeast-2",r.ApSouth1="ap-south-1",r.ApSoutheast1="ap-southeast-1",r.ApSoutheast2="ap-southeast-2",r.CaCentral1="ca-central-1",r.EuCentral1="eu-central-1",r.EuWest1="eu-west-1",r.EuWest2="eu-west-2",r.EuWest3="eu-west-3",r.SaEast1="sa-east-1",r.UsEast1="us-east-1",r.UsWest1="us-west-1",r.UsWest2="us-west-2"})(f_||(f_={}));var R7=function(r,e,t,n){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function l(d){try{u(n.next(d))}catch(h){o(h)}}function c(d){try{u(n.throw(d))}catch(h){o(h)}}function u(d){d.done?i(d.value):s(d.value).then(l,c)}u((n=n.apply(r,e||[])).next())})};class P7{constructor(e,{headers:t={},customFetch:n,region:s=f_.Any}={}){this.url=e,this.headers=t,this.region=s,this.fetch=T7(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e,t={}){var n;return R7(this,void 0,void 0,function*(){try{const{headers:s,method:i,body:o}=t;let l={},{region:c}=t;c||(c=this.region);const u=new URL(`${this.url}/${e}`);c&&c!=="any"&&(l["x-region"]=c,u.searchParams.set("forceFunctionRegion",c));let d;o&&(s&&!Object.prototype.hasOwnProperty.call(s,"Content-Type")||!s)&&(typeof Blob<"u"&&o instanceof Blob||o instanceof ArrayBuffer?(l["Content-Type"]="application/octet-stream",d=o):typeof o=="string"?(l["Content-Type"]="text/plain",d=o):typeof FormData<"u"&&o instanceof FormData?d=o:(l["Content-Type"]="application/json",d=JSON.stringify(o)));const h=yield this.fetch(u.toString(),{method:i||"POST",headers:Object.assign(Object.assign(Object.assign({},l),this.headers),s),body:d}).catch(g=>{throw new D7(g)}),f=h.headers.get("x-relay-error");if(f&&f==="true")throw new Mj(h);if(!h.ok)throw new Fj(h);let p=((n=h.headers.get("Content-Type"))!==null&&n!==void 0?n:"text/plain").split(";")[0].trim(),m;return p==="application/json"?m=yield h.json():p==="application/octet-stream"?m=yield h.blob():p==="text/event-stream"?m=h:p==="multipart/form-data"?m=yield h.formData():m=yield h.text(),{data:m,error:null,response:h}}catch(s){return{data:null,error:s,response:s instanceof Fj||s instanceof Mj?s.context:void 0}}})}}var Ln={},bk={},Fx={},Bg={},Bx={},$x={},I7=function(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")},tf=I7();const L7=tf.fetch,VD=tf.fetch.bind(tf),GD=tf.Headers,O7=tf.Request,M7=tf.Response,wf=Object.freeze(Object.defineProperty({__proto__:null,Headers:GD,Request:O7,Response:M7,default:VD,fetch:L7},Symbol.toStringTag,{value:"Module"})),F7=f3(wf);var Ux={};Object.defineProperty(Ux,"__esModule",{value:!0});let B7=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.co
51de=e.code}};Ux.default=B7;var XD=Be&&Be.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty($x,"__esModule",{value:!0});const $7=XD(F7),U7=XD(Ux);let H7=class{constructor(e){var t,n;this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(t=e.shouldThrowOnError)!==null&&t!==void 0?t:!1,this.signal=e.signal,this.isMaybeSingle=(n=e.isMaybeSingle)!==null&&n!==void 0?n:!1,e.fetch?this.fetch=e.fetch:typeof fetch>"u"?this.fetch=$7.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}then(e,t){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");const n=this.fetch;let s=n(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async i=>{var o,l,c,u;let d=null,h=null,f=null,p=i.status,m=i.statusText;if(i.ok){if(this.method!=="HEAD"){const y=await i.text();y===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((o=this.headers.get("Accept"))===null||o===void 0)&&o.includes("application/vnd.pgrst.plan+text"))?h=y:h=JSON.parse(y))}const v=(l=this.headers.get("Prefer"))===null||l===void 0?void 0:l.match(/count=(exact|planned|estimated)/),b=(c=i.headers.get("content-range"))===null||c===void 0?void 0:c.split("/");v&&b&&b.length>1&&(f=parseInt(b[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(h)&&(h.length>1?(d={code:"PGRST116",details:`Results contain ${h.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},h=null,f=null,p=406,m="Not Acceptable"):h.length===1?h=h[0]:h=null)}else{const v=await i.text();try{d=JSON.parse(v),Array.isArray(d)&&i.status===404&&(h=[],d=null,p=200,m="OK")}catch{i.status===404&&v===""?(p=204,m="No Content"):d={message:v}}if(d&&this.isMaybeSingle&&(!((u=d==null?void 0:d.details)===null||u===void 0)&&u.includes("0 rows"))&&(d=null,p=200,m="OK"),d&&this.shouldThrowOnError)throw new U7.default(d)}return{error:d,data:h,count:f,status:p,statusText:m}});return this.shouldThrowOnError||(s=s.catch(i=>{var o,l,c;return{error:{message:`${(o=i==null?void 0:i.name)!==null&&o!==void 0?o:"FetchError"}: ${i==null?void 0:i.message}`,details:`${(l=i==null?void 0:i.stack)!==null&&l!==void 0?l:""}`,hint:"",code:`${(c=i==null?void 0:i.code)!==null&&c!==void 0?c:""}`},data:null,count:null,status:0,statusText:""}})),s.then(e,t)}returns(){return this}overrideTypes(){return this}};$x.default=H7;var z7=Be&&Be.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Bx,"__esModule",{value:!0});const q7=z7($x);let W7=class extends q7.default{select(e){let t=!1;const n=(e??"*").split("").map(s=>/\s/.test(s)&&!t?"":(s==='"'&&(t=!t),s)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:n,foreignTable:s,referencedTable:i=s}={}){const o=i?`${i}.order`:"order",l=this.url.searchParams.get(o);return this.url.searchParams.set(o,`${l?`${l},`:""}${e}.${t?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:n=t}={}){const s=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(s,`${e}`),this}range(e,t,{foreignTable:n,referencedTable:s=n}={}){const i=typeof s>"u"?"offset":`${s}.offset`,o=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(i,`${e}`),this.url.searchParams.set(o,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}
51explain({analyze:e=!1,verbose:t=!1,settings:n=!1,buffers:s=!1,wal:i=!1,format:o="text"}={}){var l;const c=[e?"analyze":null,t?"verbose":null,n?"settings":null,s?"buffers":null,i?"wal":null].filter(Boolean).join("|"),u=(l=this.headers.get("Accept"))!==null&&l!==void 0?l:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${o}; for="${u}"; options=${c};`),o==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};Bx.default=W7;var V7=Be&&Be.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Bg,"__esModule",{value:!0});const G7=V7(Bx);let X7=class extends G7.default{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}in(e,t){const n=Array.from(new Set(t)).map(s=>typeof s=="string"&&new RegExp("[,()]").test(s)?`"${s}"`:`${s}`).join(",");return this.url.searchParams.append(e,`in.(${n})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:n,type:s}={}){let i="";s==="plain"?i="pl":s==="phrase"?i="ph":s==="websearch"&&(i="w");const o=n===void 0?"":`(${n})`;return this.url.searchParams.append(e,`${i}fts${o}.${t}`),this}match(e){return Object.entries(e).forEach(([t,n])=>{this.url.searchParams.append(t,`eq.${n}`)}),this}not(e,t,n){return this.url.searchParams.append(e,`not.${t}.${n}`),this}or(e,{foreignTable:t,referencedTable:n=t}={}){const s=n?`${n}.or`:"or";return this.url.searchParams.append(s,`(${e})`),this}filter(e,t,n){return this.url.searchParams.append(e,`${t}.${n}`),this}};Bg.default=X7;var Y7=Be&&Be.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Fx,"__esModule",{value:!0});const Hf=Y7(Bg);let K7=class{constructor(e,{headers:t={},schema:n,fetch:s}){this.url=e,this.headers=new Headers(t),this.schema=n,this.fetch=s}select(e,{head:t=!1,count:n}={}){const s=t?"HEAD":"GET";let i=!1;const o=(e??"*").split("").map(l=>/\s/.test(l)&&!i?"":(l==='"'&&(i=!i),l)).join("");return this.url.searchParams.set("select",o),n&&this.headers.append("Prefer",`count=${n}`),new Hf.default({method:s,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(e,{count:t,defaultToNull:n=!0}={}){var s;const i="POST";if(t&&this.headers.append("Prefer",`count=${t}`),n||this.headers.append("Prefer","missing=default"),Array.isArray(e)){const o=e.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(o.length>0){const l=[...new Set(o)].map(c=>`"${c}"`);this.url.searchParams.set("columns",l.join(","))}}return new Hf.default({method:i,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch})}upsert(e,{onConflict:t,ignoreDuplicates:n=!1,count:s,defaultToNull:i=!0}={}){var o;const l="POST";if(this.headers.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),t!==void 0&&this.url.searchParams.set("on_conflict",t),s&&this.headers.append("Prefer",`count=${s}`),i||this.headers.append("Prefer","missing=default"),Array.isArray(e)){const c=e.reduce((u,d)=>u.concat(Object.keys(d)),[]);if(c.length>0){const u=[...new Set(c)].map(d=>`"${d}"`);this.url.searchParams.set("columns",u.join(","))}}return new Hf.default({method:l,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}update(e,{count:t}={}){var n;const s="PATCH";return t&&this.headers.append("Prefer",`count=${t}`),new Hf.default({method:s,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}delete({count:e}={}){var t;const n="DELETE";return e&&this.headers.append("Prefer",`count=${e}`),new Hf.default({method:n,url:this.url,headers:this.headers,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch})}};Fx.default=K7;var YD=Be&&Be.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(bk,"__esModule",{value:!0});const J7=YD(Fx),Z7=YD(Bg);let Q7=class KD{constructor(e,{headers:t={},schema:n,fetch:s}={}){this.url=e,this.headers=new Headers(t),this.schemaName=n,this.fetch=s}from(e){const t=new URL(`${this.url}/${e}`);return new J7.default(t,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new KD(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,t={},{head:n=!1,get:s=!1,count:i}={}){var o;let l;const c=new URL(`${this.url}/rpc/${e}`);let u;n||s?(l=n?"HEAD":"GET",Object.entries(t).filter(([h,f])=>f!==void 0).map(([h,f])=>[h,Array.isArray(f)?`{${f.join(",")}}`:`${f}
51`]).forEach(([h,f])=>{c.searchParams.append(h,f)})):(l="POST",u=t);const d=new Headers(this.headers);return i&&d.set("Prefer",`count=${i}`),new Z7.default({method:l,url:c,headers:d,schema:this.schemaName,body:u,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}};bk.default=Q7;var _f=Be&&Be.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ln,"__esModule",{value:!0});Ln.PostgrestError=Ln.PostgrestBuilder=Ln.PostgrestTransformBuilder=Ln.PostgrestFilterBuilder=Ln.PostgrestQueryBuilder=Ln.PostgrestClient=void 0;const JD=_f(bk);Ln.PostgrestClient=JD.default;const ZD=_f(Fx);Ln.PostgrestQueryBuilder=ZD.default;const QD=_f(Bg);Ln.PostgrestFilterBuilder=QD.default;const eR=_f(Bx);Ln.PostgrestTransformBuilder=eR.default;const tR=_f($x);Ln.PostgrestBuilder=tR.default;const rR=_f(Ux);Ln.PostgrestError=rR.default;var eB=Ln.default={PostgrestClient:JD.default,PostgrestQueryBuilder:ZD.default,PostgrestFilterBuilder:QD.default,PostgrestTransformBuilder:eR.default,PostgrestBuilder:tR.default,PostgrestError:rR.default};const{PostgrestClient:tB,PostgrestQueryBuilder:IQ,PostgrestFilterBuilder:LQ,PostgrestTransformBuilder:OQ,PostgrestBuilder:MQ,PostgrestError:FQ}=eB;class rB{static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};if(typeof process<"u"){const t=process.versions;if(t&&t.node){const n=t.node,s=parseInt(n.replace(/^v/,"").split(".")[0]);return s>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${s} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${s} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
52import ws from "ws"
53new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.constructor)return e.constructor;let t=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(t+=`
54
55Suggested solution: ${e.workaround}`),new Error(t)}static createWebSocket(e,t){const n=this.getWebSocketConstructor();return new n(e,t)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const nB="2.15.5",sB=`realtime-js/${nB}`,iB="1.0.0",p_=1e4,aB=1e3,oB=100;var Np;(function(r){r[r.connecting=0]="connecting",r[r.open=1]="open",r[r.closing=2]="closing",r[r.closed=3]="closed"})(Np||(Np={}));var lr;(function(r){r.closed="closed",r.errored="errored",r.joined="joined",r.joining="joining",r.leaving="leaving"})(lr||(lr={}));var yi;(function(r){r.close="phx_close",r.error="phx_error",r.join="phx_join",r.reply="phx_reply",r.leave="phx_leave",r.access_token="access_token"})(yi||(yi={}));var m_;(function(r){r.websocket="websocket"})(m_||(m_={}));var dc;(function(r){r.Connecting="connecting",r.Open="open",r.Closing="closing",r.Closed="closed"})(dc||(dc={}));class lB{constructor(){this.HEADER_LENGTH=1}decode(e,t){return e.constructor===ArrayBuffer?t(this._binaryDecode(e)):t(typeof e=="string"?JSON.parse(e):{})}_binaryDecode(e){const t=new DataView(e),n=new TextDecoder;return this._decodeBroadcast(e,t,n)}_decodeBroadcast(e,t,n){const s=t.getUint8(1),i=t.getUint8(2);let o=this.HEADER_LENGTH+2;const l=n.decode(e.slice(o,o+s));o=o+s;const c=n.decode(e.slice(o,o+i));o=o+i;const u=JSON.parse(n.decode(e.slice(o,e.byteLength)));return{ref:null,topic:l,event:c,payload:u}}}class nR{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=t}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var St;(function(r){r.abstime="abstime",r.bool="bool",r.date="date",r.daterange="daterange",r.float4="float4",r.float8="float8",r.int2="int2",r.int4="int4",r.int4range="int4range",r.int8="int8",r.int8range="int8range",r.json="json",r.jsonb="jsonb",r.money="money",r.numeric="numeric",r.oid="oid",r.reltime="reltime",r.text="text",r.time="time",r.timestamp="timestamp",r.timestamptz="timestamptz",r.timetz="timetz",r.tsrange="tsrange",r.tstzrange="tstzrange"})(St||(St={}));const Bj=(r,e,t={})=>{var n;const s=(n=t.skipTypes)!==null&&n!==void 0?n:[];return Object.keys(e).reduce((i,o)=>(i[o]=cB(o,r,e,s),i),{})},cB=(r,e,t,n)=>{const s=e.find(l=>
vendor: 4,552 bytes, line 55
55l.name===r),i=s==null?void 0:s.type,o=t[r];return i&&!n.includes(i)?sR(i,o):g_(o)},sR=(r,e)=>{if(r.charAt(0)==="_"){const t=r.slice(1,r.length);return fB(e,t)}switch(r){case St.bool:return uB(e);case St.float4:case St.float8:case St.int2:case St.int4:case St.int8:case St.numeric:case St.oid:return dB(e);case St.json:case St.jsonb:return hB(e);case St.timestamp:return pB(e);case St.abstime:case St.date:case St.daterange:case St.int4range:case St.int8range:case St.money:case St.reltime:case St.text:case St.time:case St.timestamptz:case St.timetz:case St.tsrange:case St.tstzrange:return g_(e);default:return g_(e)}},g_=r=>r,uB=r=>{switch(r){case"t":return!0;case"f":return!1;default:return r}},dB=r=>{if(typeof r=="string"){const e=parseFloat(r);if(!Number.isNaN(e))return e}return r},hB=r=>{if(typeof r=="string")try{return JSON.parse(r)}catch(e){return console.log(`JSON parse error: ${e}`),r}return r},fB=(r,e)=>{if(typeof r!="string")return r;const t=r.length-1,n=r[t];if(r[0]==="{"&&n==="}"){let i;const o=r.slice(1,t);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(l=>sR(e,l))}return r},pB=r=>typeof r=="string"?r.replace(" ","T"):r,iR=r=>{let e=r;return e=e.replace(/^ws/i,"http"),e=e.replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,""),e.replace(/\/+$/,"")+"/api/broadcast"};class Ew{constructor(e,t,n={},s=p_){this.channel=e,this.event=t,this.payload=n,this.timeout=s,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,t){var n;return this._hasReceived(e)&&t((n=this.receivedResp)===null||n===void 0?void 0:n.response),this.recHooks.push({status:e,callback:t}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=t=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=t,this._matchReceive(t)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,t){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:t})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:t}){this.recHooks.filter(n=>n.status===e).forEach(n=>n.callback(t))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var $j;(function(r){r.SYNC="sync",r.JOIN="join",r.LEAVE="leave"})($j||($j={}));class Sp{constructor(e,t){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const n=(t==null?void 0:t.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(n.state,{},s=>{const{onJoin:i,onLeave:o,onSync:l}=this.caller;this.joinRef=this.channel._joinRef(),this.state=Sp.syncState(this.state,s,i,o),this.pendingDiffs.forEach(c=>{this.state=Sp.syncDiff(this.state,c,i,o)}),this.pendingDiffs=[],l()}),this.channel._on(n.diff,{},s=>{const{onJoin:i,onLeave:o,onSync:l}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=Sp.syncDiff(this.state,s,i,o),l())}),this.onJoin((s,i,o)=>{this.channel._trigger("presence",{event:"join",key:s,currentPresences:i,newPresences:o})}),this.onLeave((s,i,o)=>{this.channel._trigger("presence",{event:"leave",key:s,currentPresences:i,leftPresences:o})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,t,n,s){const i=this.cloneDeep(e),o=this.transformState(t),l={},c={};return this.map(i,(u,d)=>{o[u]||(c[u]=d)}),this.map(o,(u,d)=>{const h=i[u];if(h){const f=d.map(v=>v.presence_ref),p=h.map(v=>v.presence_ref),m=d.filter(v=>p.indexOf(v.presence_ref)<0),g=h.filter(v=>f.indexOf(v.presence_ref)<0);m.length>0&&(l[u]=m),g.length>0&&(c[u]=g)}else l[u]=d}),this.syncDiff(i,{joins:l,leaves:c},n,s)}static syncDiff(e,t,n,s){const{joins:i,leaves:o}={joins:this.transformState(t.joins),leaves:this.transformState(t.leaves)};return n||(n=()=>{}),s||(s=()=>{}),this.map(i,(l,c)=>{var u;
55const d=(u=e[l])!==null&&u!==void 0?u:[];if(e[l]=this.cloneDeep(c),d.length>0){const h=e[l].map(p=>p.presence_ref),f=d.filter(p=>h.indexOf(p.presence_ref)<0);e[l].unshift(...f)}n(l,d,c)}),this.map(o,(l,c)=>{let u=e[l];if(!u)return;const d=c.map(h=>h.presence_ref);u=u.filter(h=>d.indexOf(h.presence_ref)<0),e[l]=u,s(l,u,c),u.length===0&&delete e[l]}),e}static map(e,t){return Object.getOwnPropertyNames(e).map(n=>t(n,e[n]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((t,n)=>{const s=e[n];return"metas"in s?t[n]=s.metas.map(i=>(i.presence_ref=i.phx_ref,delete i.phx_ref,delete i.phx_ref_prev,i)):t[n]=s,t},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var Uj;(function(r){r.ALL="*",r.INSERT="INSERT",r.UPDATE="UPDATE",r.DELETE="DELETE"})(Uj||(Uj={}));var kp;(function(r){r.BROADCAST="broadcast",r.PRESENCE="presence",r.POSTGRES_CHANGES="postgres_changes",r.SYSTEM="system"})(kp||(kp={}));var Na;(function(r){r.SUBSCRIBED="SUBSCRIBED",r.TIMED_OUT="TIMED_OUT",r.CLOSED="CLOSED",r.CHANNEL_ERROR="CHANNEL_ERROR"})(Na||(Na={}));class xk{constructor(e,t={config:{}},n){this.topic=e,this.params=t,this.socket=n,this.bindings={},this.state=lr.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config),this.timeout=this.socket.timeout,this.joinPush=new Ew(this,yi.join,this.params,this.timeout),this.rejoinTimer=new nR(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=lr.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(s=>s.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=lr.closed,this.socket._remove(this)}),this._onError(s=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,s),this.state=lr.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=lr.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",s=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,s),this.state=lr.errored,this.rejoinTimer.scheduleTimeout())}),this._on(yi.reply,{},(s,i)=>{this._trigger(this._replyEventName(i),s)}),this.presence=new Sp(this),this.broadcastEndpointURL=iR(this.socket.endPoint),this.private=this.params.config.private||!1}subscribe(e,t=this.timeout){var n,s,i;if(this.socket.isConnected()||this.socket.connect(),this.state==lr.closed){const{config:{broadcast:o,presence:l,private:c}}=this.params,u=(s=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(p=>p.filter))!==null&&s!==void 0?s:[],d=!!this.bindings[kp.PRESENCE]&&this.bindings[kp.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,h={},f={broadcast:o,presence:Object.assign(Object.assign({},l),{enabled:d}),postgres_changes:u,private:c};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(p=>e==null?void 0:e(Na.CHANNEL_ERROR,p)),this._onClose(()=>e==null?void 0:e(Na.CLOSED)),this.updateJoinPayload(Object.assign({config:f},h)),this.joinedOnce=!0,this._rejoin(t),this.joinPush.receive("ok",async({postgres_changes:p})=>{var m;if(this.socket.setAuth(),p===void 0){e==null||e(Na.SUBSCRIBED);return}else{const g=this.bindings.postgres_changes,v=(m=g==null?void 0:g.length)!==null&&m!==void 0?m:0,b=[];for(let y=0;y<v;y++){const w=g[y],{filter:{event:_,schema:N,table:S,filter:E}}=w,T=p&&p[y];if(T&&T.event===_&&T.schema===N&&T.table===S&&T.filter===E)b.push(Object.assign(Object.assign({},w),{id:T.id}));else{this.unsubscribe(),this.state=lr.errored,e==null||e(Na.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=b,e&&e(Na.SUBSCRIBED);return}}).receive("error",p=>{this.state=lr.errored,e==null||e(Na.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(p).join(", ")||"error")))}).receive("timeout",()=>{e==null||e(Na.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,t={}){return await this.send({type:"presence",event:"track",payload:e},t.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,t,n){return this.state===lr.joined&&e===kp.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(()=>this.subscribe())),this._on(e,t,n)}async send(e,t={}){var n,s;if(!this._canPush()&&e.type==="broadcast"){const{event:i,payload:o}=e,c={method:"POST",headers:{Authorization:this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:o,private:this.private}]})};try{const u=await this._fetchWithTimeout(this.broadcastEndpointURL,c,(n=t.timeout)!==null&&n!==void 0?n:this.timeout);return await((s=u.body)===null||s===void 0?void 0:s.cancel()),u.ok?"ok":"error"}catch(u){return u.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var o,l,c;const u=this._push(e.type,e,t.timeout||this.timeout);e.type==="broadcast"&&!(!((c=(l=(o=this.params)===null||o===void 0?void 0:o.config)===null||l===void 0?void 0:l.broadcast)===null||c===void 0)&&c.ack)&&i("ok"),u.receive("ok",()=>i("ok")),u.receive("error",()=>i("error")),u.receive("timeout",()=>i("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=lr.leaving;const t=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(yi.close,"leave",this._joinRef())};this.joinPush.destroy();let n=null;return new Promise(s=>{n=new Ew(this,yi.leave,{},e),n.receive("ok",()=>{t(),s("ok")}).receive("timeout",()=>{t(),s("timed out")}).receive("error",()=>{s("error")}),n.send(),this._canPush()||n.trigger("ok",{})}).finally(()=>{n==null||n.destroy()})}
55teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=lr.closed,this.bindings={}}async _fetchWithTimeout(e,t,n){const s=new AbortController,i=setTimeout(()=>s.abort(),n),o=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:s.signal}));return clearTimeout(i),o}_push(e,t,n=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let s=new Ew(this,e,t,n);return this._canPush()?s.send():this._addToPushBuffer(s),s}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>oB){const t=this.pushBuffer.shift();t&&(t.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${t.event}`,t.payload))}}_onMessage(e,t,n){return t}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,t,n){var s,i;const o=e.toLocaleLowerCase(),{close:l,error:c,leave:u,join:d}=yi;if(n&&[l,c,u,d].indexOf(o)>=0&&n!==this._joinRef())return;let f=this._onMessage(o,t,n);if(t&&!f)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(o)?(s=this.bindings.postgres_changes)===null||s===void 0||s.filter(p=>{var m,g,v;return((m=p.filter)===null||m===void 0?void 0:m.event)==="*"||((v=(g=p.filter)===null||g===void 0?void 0:g.event)===null||v===void 0?void 0:v.toLocaleLowerCase())===o}).map(p=>p.callback(f,n)):(i=this.bindings[o])===null||i===void 0||i.filter(p=>{var m,g,v,b,y,w;if(["broadcast","presence","postgres_changes"].includes(o))if("id"in p){const _=p.id,N=(m=p.filter)===null||m===void 0?void 0:m.event;return _&&((g=t.ids)===null||g===void 0?void 0:g.includes(_))&&(N==="*"||(N==null?void 0:N.toLocaleLowerCase())===((v=t.data)===null||v===void 0?void 0:v.type.toLocaleLowerCase()))}else{const _=(y=(b=p==null?void 0:p.filter)===null||b===void 0?void 0:b.event)===null||y===void 0?void 0:y.toLocaleLowerCase();return _==="*"||_===((w=t==null?void 0:t.event)===null||w===void 0?void 0:w.toLocaleLowerCase())}else return p.type.toLocaleLowerCase()===o}).map(p=>{if(typeof f=="object"&&"ids"in f){const m=f.data,{schema:g,table:v,commit_timestamp:b,type:y,errors:w}=m;f=Object.assign(Object.assign({},{schema:g,table:v,commit_timestamp:b,eventType:y,new:{},old:{},errors:w}),this._getPayloadRecords(m))}p.callback(f,n)})}_isClosed(){return this.state===lr.closed}_isJoined(){return this.state===lr.joined}_isJoining(){return this.state===lr.joining}_isLeaving(){return this.state===lr.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,t,n){const s=e.toLocaleLowerCase(),i={type:s,filter:t,callback:n};return this.bindings[s]?this.bindings[s].push(i):this.bindings[s]=[i],this}_off(e,t){const n=e.toLocaleLowerCase();return this.bindings[n]&&(this.bindings[n]=this.bindings[n].filter(s=>{var i;return!(((i=s.type)===null||i===void 0?void 0:i.toLocaleLowerCase())===n&&xk.isEqual(s.filter,t))})),this}static isEqual(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(yi.close,{},e)}_onError(e){this._on(yi.error,{},t=>e(t))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=lr.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const t={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(t.new=Bj(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(t.old=Bj(e.columns,e.old_record)),t}}const jw=()=>{},E0={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},mB=[1e3,2e3,5e3,1e4],gB=1e4,yB=`
56  addEventListener("message", (e) => {
57    if (e.data.event === "start") {
58      setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
59    }
60  });`;class bB{constructor(e,t){var n;if(this.accessTokenValue=null,this.apiKey=null,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=p_,this.transport=null,this.heartbeatIntervalMs=E0.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=jw,this.ref=0,this.reconnectTimer=null,this.logger=jw,this.conn=null,this.sendBuffer=[],this.serializer
60=new lB,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=s=>{let i;return s?i=s:typeof fetch>"u"?i=(...o)=>eo(async()=>{const{default:l}=await Promise.resolve().then(()=>wf);return{default:l}},void 0).then(({default:l})=>l(...o)).catch(l=>{throw new Error(`Failed to load @supabase/node-fetch: ${l.message}. This is required for HTTP requests in Node.js environments without native fetch.`)}):i=fetch,(...o)=>i(...o)},!(!((n=t==null?void 0:t.params)===null||n===void 0)&&n.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=t.params.apikey,this.endPoint=`${e}/${m_.websocket}`,this.httpEndpoint=iR(e),this._initializeOptions(t),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(t==null?void 0:t.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=rB.createWebSocket(this.endpointURL())}catch(e){this._setConnectionState("disconnected");const t=e.message;throw t.includes("Node.js")?new Error(`${t}
61
62To use Realtime in Node.js, you need to provide a WebSocket implementation:
63
64Option 1: Use Node.js 22+ which has native WebSocket support
65Option 2: Install and provide the "ws" package:
66
67  npm install ws
68
69  import ws from "ws"
70  const client = new RealtimeClient(url, {
71    ...options,
72    transport: ws
73  })`):new Error(`WebSocket not available: ${t}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:iB}))}disconnect(e,t){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const n=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(n),this._setConnectionState("disconnected")},e?this.conn.close(e,t??""):this.conn.close(),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const t=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),t}async removeAllChannels(){const e=await Promise.all(this.channels.map(t=>t.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,t,n){this.logger(e,t,n)}connectionState(){switch(this.conn&&this.conn.readyState){case Np.connecting:return dc.Connecting;case Np.open:return dc.Open;case Np.closing:return dc.Closing;default:return dc.Closed}}isConnected(){return this.connectionState()===dc.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,t={config:{}}){const n=`realtime:${e}`,s=this.getChannels().find(i=>i.topic===n);if(s)return s;{const i=new xk(`realtime:${e}`,t,this);return this.channels.push(i),i}}push(e){const{topic:t,event:n,payload:s,ref:i}=e,o=()=>{this.encode(e,l=>{var c;(c=this.conn)===null||c===void 0||c.send(l)})};this.log("push",`${t} ${n} (${i})`,s),this.isConnected()?o():this.sendBuffer.push(o)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}async sendHeartbeat(){var e;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(t){this.log("error","error in heartbeat callback",t)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(t){this.log("error","error in heartbeat callback",t)}this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(aB,"heartbeat timeout"),setTimeout(()=>{var t;this.isConnected()||(t=this.reconnectTimer)===null||t===void 0||t.scheduleTimeout()},E0.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(t){this.log("error","error in heartbeat callback",t)}this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>
730&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let t=this.channels.find(n=>n.topic===e&&(n._isJoined()||n._isJoining()));t&&(this.log("transport",`leaving duplicate topic "${e}"`),t.unsubscribe())}_remove(e){this.channels=this.channels.filter(t=>t.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,t=>{if(t.topic==="phoenix"&&t.event==="phx_reply")try{this.heartbeatCallback(t.payload.status==="ok"?"ok":"error")}catch(u){this.log("error","error in heartbeat callback",u)}t.ref&&t.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:n,event:s,payload:i,ref:o}=t,l=o?`(${o})`:"",c=i.status||"";this.log("receive",`${c} ${n} ${s} ${l}`.trim(),i),this.channels.filter(u=>u._isMember(n)).forEach(u=>u._trigger(s,i,o)),this._triggerStateCallbacks("message",t)})}_clearTimer(e){var t;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((t=this.reconnectTimer)===null||t===void 0||t.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e))}_teardownConnection(){this.conn&&(this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null),this._clearAllTimers(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),this.flushSendBuffer(),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=t=>{this.log("worker","worker error",t.message),this.workerRef.terminate()},this.workerRef.onmessage=t=>{t.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(e){var t;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(t=this.reconnectTimer)===null||t===void 0||t.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger(yi.error))}_appendParams(e,t){if(Object.keys(t).length===0)return e;const n=e.match(/\?/)?"&":"?",s=new URLSearchParams(t);return`${e}${n}${s}`}_workerObjectUrl(e){let t;if(e)t=e;else{const n=new Blob([yB],{type:"application/javascript"});t=URL.createObjectURL(n)}return t}_setConnectionState(e,t=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=t)}async _performAuth(e=null){let t;e?t=e:this.accessToken?t=await this.accessToken():t=this.accessTokenValue,this.accessTokenValue!=t&&(this.accessTokenValue=t,this.channels.forEach(n=>{const s={access_token:t,version:sB};t&&n.updateJoinPayload(s),n.joinedOnce&&n._isJoined()&&n._push(yi.access_token,{access_token:t})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this.setAuth().catch(t=>{this.log("error",`error setting auth in ${e}`,t)})}_triggerStateCallbacks(e,t){try{this.stateChangeCallbacks[e].forEach(n=>{try{n(t)}catch(s){this.log("error",`error in ${e} callback`,s)}})}catch(n){this.log("error",`error triggering ${e} callbacks`,n)}}_setupReconnectionTimer(){this.reconnectTimer=new nR(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},E0.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var t,n,s,i,o,l,c,u,d;if(this.transport=(t=e==null?void 0:e.transport)!==null&&t!==void 0?t:null,this.timeout=(n=e==null?void 0:e.timeout)!==null&&n!==void 0?n:p_,this.heartbeatIntervalMs=(s=e==null?void 0:e.heartbeatIntervalMs)!==null&&s!==void 0?s:E0.HEARTBEAT_INTERVAL,this.worker=(i=e==null?void 0:e.worker)!==null&&i!==void 0?i:!1,this.accessToken=(o=e==null?void 0:e.accessToken)!==null&&o!==void 0?o:null,this.heartbeatCallback=(l=e==null?void 0:e.heartbeatCallback)!==null&&l!==void 0?l:jw,e!=null&&e.params&&(this.params=e.params),e!=null&&e.logger&&(this.logger=e.logger),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(c=e==null?void 0:e.reconnectAfterMs)!==null&&c!==void 0?c:h=>mB[h-1]||gB,this.encode=(u=e==null?void 0:e.encode)!==null&&u!==void 0?u:(h,f)=>f(JSON.stringify(h)),this.decode=(d=e==null?void 0:e.decode)!==null&&d!==void 0?d:this.serializer.decode.bind(this.serializer),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl}}}
73class vk extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function fr(r){return typeof r=="object"&&r!==null&&"__isStorageError"in r}class xB extends vk{constructor(e,t,n){super(e),this.name="StorageApiError",this.status=t,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class y_ extends vk{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}}var vB=function(r,e,t,n){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function l(d){try{u(n.next(d))}catch(h){o(h)}}function c(d){try{u(n.throw(d))}catch(h){o(h)}}function u(d){d.done?i(d.value):s(d.value).then(l,c)}u((n=n.apply(r,e||[])).next())})};const aR=r=>{let e;return r?e=r:typeof fetch>"u"?e=(...t)=>eo(async()=>{const{default:n}=await Promise.resolve().then(()=>wf);return{default:n}},void 0).then(({default:n})=>n(...t)):e=fetch,(...t)=>e(...t)},wB=()=>vB(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield eo(()=>Promise.resolve().then(()=>wf),void 0)).Response:Response}),b_=r=>{if(Array.isArray(r))return r.map(t=>b_(t));if(typeof r=="function"||r!==Object(r))return r;const e={};return Object.entries(r).forEach(([t,n])=>{const s=t.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[s]=b_(n)}),e},_B=r=>{if(typeof r!="object"||r===null)return!1;const e=Object.getPrototypeOf(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in r)&&!(Symbol.iterator in r)};var Wu=function(r,e,t,n){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function l(d){try{u(n.next(d))}catch(h){o(h)}}function c(d){try{u(n.throw(d))}catch(h){o(h)}}function u(d){d.done?i(d.value):s(d.value).then(l,c)}u((n=n.apply(r,e||[])).next())})};const Aw=r=>r.msg||r.message||r.error_description||r.error||JSON.stringify(r),NB=(r,e,t)=>Wu(void 0,void 0,void 0,function*(){const n=yield wB();r instanceof n&&!(t!=null&&t.noResolveJson)?r.json().then(s=>{const i=r.status||500,o=(s==null?void 0:s.statusCode)||i+"";e(new xB(Aw(s),i,o))}).catch(s=>{e(new y_(Aw(s),s))}):e(new y_(Aw(r),r))}),SB=(r,e,t,n)=>{const s={method:r,headers:(e==null?void 0:e.headers)||{}};return r==="GET"||!n?s:(_B(n)?(s.headers=Object.assign({"Content-Type":"application/json"},e==null?void 0:e.headers),s.body=JSON.stringify(n)):s.body=n,e!=null&&e.duplex&&(s.duplex=e.duplex),Object.assign(Object.assign({},s),t))};function $g(r,e,t,n,s,i){return Wu(this,void 0,void 0,function*(){return new Promise((o,l)=>{r(t,SB(e,n,s,i)).then(c=>{if(!c.ok)throw c;return n!=null&&n.noResolveJson?c:c.json()}).then(c=>o(c)).catch(c=>NB(c,l,n))})})}function Sb(r,e,t,n){return Wu(this,void 0,void 0,function*(){return $g(r,"GET",e,t,n)})}function Oi(r,e,t,n,s){return Wu(this,void 0,void 0,function*(){return $g(r,"POST",e,n,s,t)})}function x_(r,e,t,n,s){return Wu(this,void 0,void 0,function*(){return $g(r,"PUT",e,n,s,t)})}function kB(r,e,t,n){return Wu(this,void 0,void 0,function*(){return $g(r,"HEAD",e,Object.assign(Object.assign({},t),{noResolveJson:!0}),n)})}function oR(r,e,t,n,s){return Wu(this,void 0,void 0,function*(){return $g(r,"DELETE",e,n,s,t)})}var pn=function(r,e,t,n){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function l(d){try{u(n.next(d))}catch(h){o(h)}}function c(d){try{u(n.throw(d))}catch(h){o(h)}}function u(d){d.done?i(d.value):s(d.value).then(l,c)}u((n=n.apply(r,e||[])).next())})};const CB={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Hj={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class EB{constructor(e,t={},n,s){this.shouldThrowOnError=!1,this.url=e,this.headers=t,this.bucketId=n,this.fetch=aR(s)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,t,n,s){return pn(this,void 0,void 0,function*(){try{let i;const o=Object.assign(Object.assign({},Hj),s);let l=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(o.upsert)});const c=o.metadata;typeof Blob<"u"&&n instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),c&&i.append("metadata",this.encodeMetadata(c)),i.append("",n)):typeof FormData<"u"&&n instanceof FormData?(i=n,i.append("cacheControl",o.cacheControl),c&&i.append("metadata",this.encodeMetadata(c))):(i=n,l["cache-control"]=`max-age=${o.cacheControl}`,l["content-type"]=o.contentType,c&&(l["x-metadata"]=this.toBase64(this.encodeMetadata(c)))),s!=null&&s.headers&&(l=Object.assign(Object.assign({},l),s.headers));const u=this._removeEmptyFolders(t),d=this._getFinalPath(u),h=yield(e=="PUT"?x_:Oi)(this.fetch,`${this.url}/object/${d}`,i,Object.assign({headers:l},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{data:{path:u,id:h.Id,fullPath:h.Key},error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(fr(i))return{data:null,error:i};throw i}})}upload(e,t,n){return pn(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,t,n)})}uploadToSignedUrl(e,t,n,s){return pn(this,void 0,void 0,function*(){const i=this._removeEmptyFolders(e),o=this._getFinalPath(i),l=new URL(this.url+`/object/upload/sign/${o}`);l.searchParams.set("token",t);try{let c;const u=Object.assign({upsert:Hj.upsert},s),d=Object.assign(Object.assign({},this.headers),{"x-upsert":String(u.upsert)});typeof Blob<"u"&&n instanceof Blob?(c=new FormData,c.append("cacheControl",u.cacheControl),c.append("",n)):typeof FormData<"u"&&n instanceof FormData?(c=n,c.append("cacheControl",u.cacheControl)):(c=n,d["cache-control"]=`max-age=${u.cacheControl}`,d["content-type"]=u.contentType);const h=yield x_(this.fetch,l.toString(),c,{headers:d});return{data:{path:i,fullPath:h.Key},error:null}}catch(c){if(this.shouldThrowOnError)throw c;if(fr(c))return{data:null,error:c};throw c}})}createSignedUploadUrl(e,t){return pn(this,void 0,void 0,function*(){try{let n=this._getFinalPath(e);const s=Object.assign({},this.headers);t!=null&&t.upsert&&(s["x-upsert"]="true");const i=yield Oi(this.fetch,`${this.url}/object/upload/sign/${n}`,{},{headers:s}),o=new URL(this.url+i.url),l=o.searchParams.get("token");if(!l)throw new vk("No token returned by API");return{data:{signedUrl:o.toString(),path:e,token:l},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(fr(n))return{data:null,error:n};throw n}})}update(e,t,n){return pn(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,t,n)})}move(e,t,n){return pn(this,void 0,void 0,function*(){try{return{data:yield Oi(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,de
73stinationBucket:n==null?void 0:n.destinationBucket},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(fr(s))return{data:null,error:s};throw s}})}copy(e,t,n){return pn(this,void 0,void 0,function*(){try{return{data:{path:(yield Oi(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n==null?void 0:n.destinationBucket},{headers:this.headers})).Key},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(fr(s))return{data:null,error:s};throw s}})}createSignedUrl(e,t,n){return pn(this,void 0,void 0,function*(){try{let s=this._getFinalPath(e),i=yield Oi(this.fetch,`${this.url}/object/sign/${s}`,Object.assign({expiresIn:t},n!=null&&n.transform?{transform:n.transform}:{}),{headers:this.headers});const o=n!=null&&n.download?`&download=${n.download===!0?"":n.download}`:"";return i={signedUrl:encodeURI(`${this.url}${i.signedURL}${o}`)},{data:i,error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(fr(s))return{data:null,error:s};throw s}})}createSignedUrls(e,t,n){return pn(this,void 0,void 0,function*(){try{const s=yield Oi(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:t,paths:e},{headers:this.headers}),i=n!=null&&n.download?`&download=${n.download===!0?"":n.download}`:"";return{data:s.map(o=>Object.assign(Object.assign({},o),{signedUrl:o.signedURL?encodeURI(`${this.url}${o.signedURL}${i}`):null})),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(fr(s))return{data:null,error:s};throw s}})}download(e,t){return pn(this,void 0,void 0,function*(){const s=typeof(t==null?void 0:t.transform)<"u"?"render/image/authenticated":"object",i=this.transformOptsToQueryString((t==null?void 0:t.transform)||{}),o=i?`?${i}`:"";try{const l=this._getFinalPath(e);return{data:yield(yield Sb(this.fetch,`${this.url}/${s}/${l}${o}`,{headers:this.headers,noResolveJson:!0})).blob(),error:null}}catch(l){if(this.shouldThrowOnError)throw l;if(fr(l))return{data:null,error:l};throw l}})}info(e){return pn(this,void 0,void 0,function*(){const t=this._getFinalPath(e);try{const n=yield Sb(this.fetch,`${this.url}/object/info/${t}`,{headers:this.headers});return{data:b_(n),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(fr(n))return{data:null,error:n};throw n}})}exists(e){return pn(this,void 0,void 0,function*(){const t=this._getFinalPath(e);try{return yield kB(this.fetch,`${this.url}/object/${t}`,{headers:this.headers}),{data:!0,error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(fr(n)&&n instanceof y_){const s=n.originalError;if([400,404].includes(s==null?void 0:s.status))return{data:!1,error:n}}throw n}})}getPublicUrl(e,t){const n=this._getFinalPath(e),s=[],i=t!=null&&t.download?`download=${t.download===!0?"":t.download}`:"";i!==""&&s.push(i);const l=typeof(t==null?void 0:t.transform)<"u"?"render/image":"object",c=this.transformOptsToQueryString((t==null?void 0:t.transform)||{});c!==""&&s.push(c);let u=s.join("&");return u!==""&&(u=`?${u}`),{data:{publicUrl:encodeURI(`${this.url}/${l}/public/${n}${u}`)}}}remove(e){return pn(this,void 0,void 0,function*(){try{return{data:yield oR(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(t){if(this.shouldThrowOnError)throw t;if(fr(t))return{data:null,error:t};throw t}})}list(e,t,n){return pn(this,void 0,void 0,function*(){try{const s=Object.assign(Object.assign(Object.assign({},CB),t),{prefix:e||""});return{data:yield Oi(this.fetch,`${this.url}/object/list/${this.bucketId}`,s,{headers:this.headers},n),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(fr(s))return{data:null,error:s};throw s}})}listV2(e,t){return pn(this,void 0,void 0,function*(){try{const n=Object.assign({},e);return{data:yield Oi(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,n,{headers:this.headers},t),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(fr(n))return{data:null,error:n};throw n}})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const t=[];return e.width&&t.push(`width=${e.width}`),e.height&&t.push(`height=${e.height}`),e.resize&&t.push(`resize=${e.resize}`),e.format&&t.push(`format=${e.format}`),e.quality&&t.push(`quality=${e.quality}`),t.join("&")}}const jB="2.12.1",AB={"X-Client-Info":`storage-js/${jB}`};var Qu=function(r,e,t,n){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function l(d){try{u(n.next(d))}catch(h){o(h)}}function c(d){try{u(n.throw(d))}catch(h){o(h)}}function u(d){d.done?i(d.value):s(d.value).then(l,c)}u((n=n.apply(r,e||[])).next())})};class TB{constructor(e,t={},n,s){this.shouldThrowOnError=!1;const i=new URL(e);s!=null&&s.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes("storage.supabase.")&&(i.hostname=i.hostname.replace("supabase.","storage.supabase.")),this.url=i.href,this.headers=Object.assign(Object.assign({},AB),t),this.fetch=aR(n)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(){return Qu(this,void 0,void 0,function*(){try{return{data:yield Sb(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(fr(e))return{data:null,error:e};throw e}})}getBucket(e){return Qu(this,void 0,void 0,function*(){try{return{data:yield Sb(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(t){if(this.shouldThrowOnError)throw t;if(fr(t))return{data:null,error:t};throw t}})}createBucket(e,t={public:!1}){return Qu(this,void 0,void 0,function*(){try{return{data:yield Oi(this.fetch,`${this.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(fr(n))return{data:null,error:n};throw n}})}updateBucket(e,t){return Qu(this,void 0,void 0,function*(){try{return{data:yield x_(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(fr(n))return{data:null,error:n};throw n}})}emptyBucket(e){return Qu(this,void 0,void 0,function*(){try{return{data:yield Oi(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(t){if(this.shouldThrowOnError)throw t;if(fr(t))return{data:null,error:t};throw t}})}deleteBucket(e){return Qu(this,void 0,void 0,function*(){try{return{data:yield oR(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(t){if(this.shouldThrowOnError)throw t;if(fr(t))return{data:null,error:t};throw t}})}}class DB extends TB{constructor(e,t={},n,s){super(e,t,n,s)}from(e){return new EB(this.url,this.headers,e,this.fetch)}}const RB="2.57.4";let Zf="";typeof Deno<"u"?Zf="deno":typeof document<"u"?Zf="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Zf="react-native":Zf="node";const PB={"X-Client-Info":`supabase-js-${Zf}/${RB}`},IB={headers:PB},LB={schema:"public"},OB={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},MB={};var FB=function(r,e,t,n){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function l(d){try{u(n.next(d))}catch(h){o(h)}}function c(d){try{u(n.throw(d))}catch(h){o(h)}}function u(d){d.done?i(d.value):s(d.value).then(l,c)}u((n=n.apply(r,e||[])).next())})};const BB=r=>{let e;return r?e=r:typeof fetch>"u"?e=VD:e=fetch,(...t)=>e(...t)},$B=()=>typeof Headers>"u"?GD:Headers,UB=(r,e,t)=>{const n=BB(t),s=$B();return(i,o)=>FB(void 0,void 0,void 0,function*(){var l;const c=(l=yield e())!==null&&l!==void 0?l:r;let u=new s(o==null?void 0:o.headers);return u.has("apikey")||u.set("apikey",r),u.has("Authorization")||u.set("Authorization",`Bearer ${c}`),n(i,Object.assign(Object.assign({},o),{headers:u}))})};var HB=function(r,e,t,n){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function l(d){try{u(n.next(d))}catch(h){o(h)}}function c(d){try{u(n.throw(d))}catch(h){o(h)}}function u(d){d.done?i(d.value):s(d.value).then(l,c)}u((n=n.apply(r,e||[])).next())})};function zB(r){return r.endsWith("/")?r:r+"/"}function qB(r,e){var t,n;const{db:s,auth:i,realtime:o,global:l}=r,{db:c,auth:u,realtime:d,global:h}=e,f={db:Object.assign(Object.assign({},c),s),auth:Object.assign(Object.assign({},u),i),realtime:Object.assign(Object.assign({},d),o),storage:{},global:Object.assign(Object.assign(Object.assign({},h),l),{headers:Object.assign(Object.assign({},(t=h==null?void 0:h.headers)!==null&&t!==void 0?t:{}),(n=l==null?void 0:l.headers)!==null&&n!==void 0?n:{})}),accessToken:()=>HB(this,void 0,void 0,function*(){return""})};return r.accessToken?f.accessToken=r.accessToken:delete f.accessToken,f}function WB(r){const e=r==null?void 0:r.trim();if(!e)throw new Error("supabaseUrl is required.");
73if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(zB(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}const lR="2.71.1",hd=30*1e3,v_=3,Tw=v_*hd,VB="http://localhost:9999",GB="supabase.auth.token",XB={"X-Client-Info":`gotrue-js/${lR}`},w_="X-Supabase-Api-Version",cR={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},YB=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,KB=10*60*1e3;class wk extends Error{constructor(e,t,n){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t,this.code=n}}function qe(r){return typeof r=="object"&&r!==null&&"__isAuthError"in r}class JB extends wk{constructor(e,t,n){super(e,t,n),this.name="AuthApiError",this.status=t,this.code=n}}function ZB(r){return qe(r)&&r.name==="AuthApiError"}class uR extends wk{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}}class zl extends wk{constructor(e,t,n,s){super(e,n,s),this.name=t,this.status=n}}class To extends zl{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function QB(r){return qe(r)&&r.name==="AuthSessionMissingError"}class j0 extends zl{constructor(){super("Auth session or user missing","AuthInvalidToken
73ResponseError",500,void 0)}}class A0 extends zl{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class T0 extends zl{constructor(e,t=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function e$(r){return qe(r)&&r.name==="AuthImplicitGrantRedirectError"}class zj extends zl{constructor(e,t=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class __ extends zl{constructor(e,t){super(e,"AuthRetryableFetchError",t,void 0)}}function Dw(r){return qe(r)&&r.name==="AuthRetryableFetchError"}class qj extends zl{constructor(e,t,n){super(e,"AuthWeakPasswordError",t,"weak_password"),this.reasons=n}}class N_ extends zl{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const kb="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Wj=` 	
74\r=`.split(""),t$=(()=>{const r=new Array(128);for(let e=0;e<r.length;e+=1)r[e]=-1;for(let e=0;e<Wj.length;e+=1)r[Wj[e].charCodeAt(0)]=-2;for(let e=0;e<kb.length;e+=1)r[kb[e].charCodeAt(0)]=e;return r})();function Vj(r,e,t){if(r!==null)for(e.queue=e.queue<<8|r,e.queuedBits+=8;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;t(kb[n]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;t(kb[n]),e.queuedBits-=6}}function dR(r,e,t){const n=t$[r];if(n>-1)for(e.queue=e.queue<<6|n,e.queuedBits+=6;e.queuedBits>=8;)t(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(n===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(r)}"`)}}function Gj(r){const e=[],t=o=>{e.push(String.fromCodePoint(o))},n={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},i=o=>{s$(o,n,t)};for(let o=0;o<r.length;o+=1)dR(r.charCodeAt(o),s,i);return e.join("")}function r$(r,e){if(r<=127){e(r);return}else if(r<=2047){e(192|r>>6),e(128|r&63);return}else if(r<=65535){e(224|r>>12),e(128|r>>6&63),e(128|r&63);return}else if(r<=1114111){e(240|r>>18),e(128|r>>12&63),e(128|r>>6&63),e(128|r&63);return}throw new Error(`Unrecognized Unicode codepoint: ${r.toString(16)}`)}function n$(r,e){for(let t=0;t<r.length;t+=1){let n=r.charCodeAt(t);if(n>55295&&n<=56319){const s=(n-55296)*1024&65535;n=(r.charCodeAt(t+1)-56320&65535|s)+65536,t+=1}r$(n,e)}}function s$(r,e,t){if(e.utf8seq===0){if(r<=127){t(r);return}for(let n=1;n<6;n+=1)if(!(r>>7-n&1)){e.utf8seq=n;break}if(e.utf8seq===2)e.codepoint=r&31;else if(e.utf8seq===3)e.codepoint=r&15;else if(e.utf8seq===4)e.codepoint=r&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(r<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|r&63,e.utf8seq-=1,e.utf8seq===0&&t(e.codepoint)}}function i$(r){const e=[],t={queue:0,queuedBits:0},n=s=>{e.push(s)};for(let s=0;s<r.length;s+=1)dR(r.charCodeAt(s),t,n);return new Uint8Array(e)}function a$(r){const e=[];return n$(r,t=>e.push(t)),new Uint8Array(e)}function o$(r){const e=[],t={queue:0,queuedBits:0},n=s=>{e.push(s)};return r.forEach(s=>Vj(s,t,n)),Vj(null,t,n),e.join("")}function l$(r){return Math.round(Date.now()/1e3)+r}function c$(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(r){const e=Math.random()*16|0;return(r=="x"?e:e&3|8).toString(16)})}const Zs=()=>typeof window<"u"&&typeof document<"u",Zl={tested:!1,writable:!1},hR=()=>
74{if(!Zs())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Zl.tested)return Zl.writable;const r=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(r,r),globalThis.localStorage.removeItem(r),Zl.tested=!0,Zl.writable=!0}catch{Zl.tested=!0,Zl.writable=!1}return Zl.writable};function u$(r){const e={},t=new URL(r);if(t.hash&&t.hash[0]==="#")try{new URLSearchParams(t.hash.substring(1)).forEach((s,i)=>{e[i]=s})}catch{}return t.searchParams.forEach((n,s)=>{e[s]=n}),e}const fR=r=>{let e;return r?e=r:typeof fetch>"u"?e=(...t)=>eo(async()=>{const{default:n}=await Promise.resolve().then(()=>wf);return{default:n}},void 0).then(({default:n})=>n(...t)):e=fetch,(...t)=>e(...t)},d$=r=>typeof r=="object"&&r!==null&&"status"in r&&"ok"in r&&"json"in r&&typeof r.json=="function",fd=async(r,e,t)=>{await r.setItem(e,JSON.stringify(t))},Ql=async(r,e)=>{const t=await r.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch{return t}},Co=async(r,e)=>{await r.removeItem(e)};class Hx{constructor(){this.promise=new Hx.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}Hx.promiseConstructor=Promise;function Rw(r){const e=r.split(".");if(e.length!==3)throw new N_("Invalid JWT structure");for(let n=0;n<e.length;n++)if(!YB.test(e[n]))throw new N_("JWT not in base64url format");return{header:JSON.parse(Gj(e[0])),payload:JSON.parse(Gj(e[1])),signature:i$(e[2]),raw:{header:e[0],payload:e[1]}}}async function h$(r){return await new Promise(e=>{setTimeout(()=>e(null),r)})}function f$(r,e){return new Promise((n,s)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await r(i);if(!e(i,null,o)){n(o);return}}catch(o){if(!e(i,o)){s(o);return}}})()})}function p$(r){return("0"+r.toString(16)).substr(-2)}function m$(){const e=new Uint32Array(56);if(typeof crypto>"u"){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=t.length;let s="";for(let i=0;i<56;i++)s+=t.charAt(Math.floor(Math.random()*n));return s}return crypto.getRandomValues(e),Array.from(e,p$).join("")}async function g$(r){const t=new TextEncoder().encode(r),n=await crypto.subtle.digest("SHA-256",t),s=new Uint8Array(n);return Array.from(s).map(i=>String.fromCharCode(i)).join("")}async function y$(r){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),r;const t=await g$(r);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function ed(r,e,t=!1){const n=m$();let s=n;t&&(s+="/PASSWORD_RECOVERY"),await fd(r,`${e}-code-verifier`,s);const i=await y$(n);return[i,n===i?"plain":"s256"]}const b$=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function x$(r){const e=r.headers.get(w_);if(!e||!e.match(b$))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function v$(r){if(!r)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(r<=e)throw new Error("JWT has expired")}function w$(r){switch(r){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const _$=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function td(r){if(!_$.test(r))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Pw(){const r={};return new Proxy(r,{get:(e,t)=>{if(t==="__isUserNotAvailableProxy")return!0;if(typeof t=="symbol"){const n=t.toString();if(n==="Symbol(Symbol.toPrimitive)"||n==="Symbol(Symbol.toStringTag)"||n==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${t}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function Xj(r){return JSON.parse(JSON.stringify(r))}var N$=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(r);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(r,n[s])&&(t[n[s]]=r[n[s]]);return t};const sc=r=>r.msg||r.message||r.error_description||r.error||JSON.stringify(r),S$=[502,503,504];async function Yj(r){var e;if(!d$(r))throw new __(sc(r),0);if(S$.includes(r.status))throw new __(sc(r),r.status);let t;try{t=await r.json()}catch(i){throw new uR(sc(i),i)}let n;const s=x$(r);if(s&&s.getTime()>=cR["2024-01-01"].timestamp&&typeof t=="object"&&t&&typeof t.code=="string"?n=t.code:typeof t=="object"&&t&&typeof t.error_code=="string"&&(n=t.error_code),n){if(n==="weak_password")throw new qj(sc(t),r.status,((e=t.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(n==="session_not_found")throw new To}else if(typeof t=="object"&&t&&typeof t.weak_password=="object"&&t.weak_password&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.reasons.reduce((i,o)=>
74i&&typeof o=="string",!0))throw new qj(sc(t),r.status,t.weak_password.reasons);throw new JB(sc(t),r.status||500,n)}const k$=(r,e,t,n)=>{const s={method:r,headers:(e==null?void 0:e.headers)||{}};return r==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),s.body=JSON.stringify(n),Object.assign(Object.assign({},s),t))};async function Ze(r,e,t,n){var s;const i=Object.assign({},n==null?void 0:n.headers);i[w_]||(i[w_]=cR["2024-01-01"].name),n!=null&&n.jwt&&(i.Authorization=`Bearer ${n.jwt}`);const o=(s=n==null?void 0:n.query)!==null&&s!==void 0?s:{};n!=null&&n.redirectTo&&(o.redirect_to=n.redirectTo);const l=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",c=await C$(r,e,t+l,{headers:i,noResolveJson:n==null?void 0:n.noResolveJson},{},n==null?void 0:n.body);return n!=null&&n.xform?n==null?void 0:n.xform(c):{data:Object.assign({},c),error:null}}async function C$(r,e,t,n,s,i){const o=k$(e,n,s,i);let l;try{l=await r(t,Object.assign({},o))}catch(c){throw console.error(c),new __(sc(c),0)}if(l.ok||await Yj(l),n!=null&&n.noResolveJson)return l;try{return await l.json()}catch(c){await Yj(c)}}function va(r){var e;let t=null;T$(r)&&(t=Object.assign({},r),r.expires_at||(t.expires_at=l$(r.expires_in)));const n=(e=r.user)!==null&&e!==void 0?e:r;return{data:{session:t,user:n},error:null}}function Kj(r){const e=va(r);return!e.error&&r.weak_password&&typeof r.weak_password=="object"&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.message&&typeof r.weak_password.message=="string"&&r.weak_password.reasons.reduce((t,n)=>t&&typeof n=="string",!0)&&(e.data.weak_password=r.weak_password),e}function $o(r){var e;return{data:{user:(e=r.user)!==null&&e!==void 0?e:r},error:null}}function E$(r){return{data:r,error:null}}function j$(r){const{action_link:e,email_otp:t,hashed_token:n,redirect_to:s,verification_type:i}=r,o=N$(r,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),l={action_link:e,email_otp:t,hashed_token:n,redirect_to:s,verification_type:i},c=Object.assign({},o);return{data:{properties:l,user:c},error:null}}function A$(r){return r}function T$(r){return r.access_token&&r.refresh_token&&r.expires_in}const Iw=["global","local","others"];var D$=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(r);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(r,n[s])&&(t[n[s]]=r[n[s]]);return t};class R${constructor({url:e="",headers:t={},fetch:n}){this.url=e,this.headers=t,this.fetch=fR(n),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)}}async signOut(e,t=Iw[0]){if(Iw.indexOf(t)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Iw.join(", ")}`);try{return await Ze(this.fetch,"POST",`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(n){if(qe(n))return{data:null,error:n};throw n}}async inviteUserByEmail(e,t={}){try{return await Ze(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:$o})}catch(n){if(qe(n))return{data:{user:null},error:n};throw n}}async generateLink(e){try{const{options:t}=e,n=D$(e,["options"]),s=Object.assign(Object.assign({},n),t);return"newEmail"in n&&(s.new_email=n==null?void 0:n.newEmail,delete s.newEmail),await Ze(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:j$,redirectTo:t==null?void 0:t.redirectTo})}catch(t){if(qe(t))return{data:{properties:null,user:null},error:t};throw t}}async createUser(e){try{return await Ze(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:$o})}catch(t){if(qe(t))return{data:{user:null},error:t};throw t}}async listUsers(e){var t,n,s,i,o,l,c;try{const u={nextPage:null,lastPage:0,total:0},d=await Ze(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(t=e==null?void 0:e.page)===null||t===void 0?void 0:t.toString())!==null&&n!==void 0?n:"",per_page:(i=(s=e==null?void 0:e.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:A$});if(d.error)throw d.error;const h=await d.json(),f=(o=d.headers.get("x-total-count"))!==null&&o!==void 0?o:0,p=(c=(l=d.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return p.length>
740&&(p.forEach(m=>{const g=parseInt(m.split(";")[0].split("=")[1].substring(0,1)),v=JSON.parse(m.split(";")[1].split("=")[1]);u[`${v}Page`]=g}),u.total=parseInt(f)),{data:Object.assign(Object.assign({},h),u),error:null}}catch(u){if(qe(u))return{data:{users:[]},error:u};throw u}}async getUserById(e){td(e);try{return await Ze(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:$o})}catch(t){if(qe(t))return{data:{user:null},error:t};throw t}}async updateUserById(e,t){td(e);try{return await Ze(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:$o})}catch(n){if(qe(n))return{data:{user:null},error:n};throw n}}async deleteUser(e,t=!1){td(e);try{return await Ze(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:$o})}catch(n){if(qe(n))return{data:{user:null},error:n};throw n}}async _listFactors(e){td(e.userId);try{const{data:t,error:n}=await Ze(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:s=>({data:{factors:s},error:null})});return{data:t,error:n}}catch(t){if(qe(t))return{data:null,error:t};throw t}}async _deleteFactor(e){td(e.userId),td(e.id);try{return{data:await Ze(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(t){if(qe(t))return{data:null,error:t};throw t}}}function Jj(r={}){return{getItem:e=>r[e]||null,setItem:(e,t)=>{r[e]=t},removeItem:e=>{delete r[e]}}}function P$(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}const rd={debug:!!(globalThis&&hR()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class pR extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class I$ extends pR{}async function L$(r,e,t){rd.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",r,e);const n=new globalThis.AbortController;return e>0&&setTimeout(()=>{n.abort(),rd.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",r)},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(r,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:n.signal},async s=>{if(s){rd.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",r,s.name);try{return await t()}finally{rd.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",r,s.name)}}else{if(e===0)throw rd.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",r),new I$(`Acquiring an exclusive Navigator LockManager lock "${r}" immediately failed`);if(rd.debug)try{const i=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(i,null,"  "))}catch(i){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",i)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await t()}}))}P$();const O$={url:VB,storageKey:GB,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:XB,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function Zj(r,e,t){return await t()}const nd={};class Kp{constructor(e){var t,n;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=Kp.nextInstanceID,Kp.nextInstanceID+=1,this.instanceID>0&&Zs()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");const s=Object.assign(Object.assign({},O$),e);if(this.logDebugMessages=!!s.debug,typeof s.debug=="function"&&(this.logger=s.debug),this.persistSession=s.persistSession,this.storageKey=s.storageKey,this.autoRefreshToken=s.autoRefreshToken,this.admin=new R$({url:s.url,headers:s.headers,fetch:s.fetch}),this.url=s.url,this.headers=s.headers,this.fetch=fR(s.fetch),this.lock=s.lock||Zj,this.detectSessionInUrl=s.detectSessionInUrl,this.flowType=s.flowType,this.hasCustomAuthorizationHeader=s.hasCustomAuthorizationHeader,s.lock?this.lock=s.lock:Zs()&&(!((t=globalThis==null?void 0:globalThis.navigator)===null||t===void 0)&&t.locks)?this.lock=L$:this.lock=Zj,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this)},this.persistSession?(s.storage?this.storage=s.storage:hR()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Jj(this.memoryStorage)),s.userStorage&&(this.userStorage=s.userStorage)):(this.memoryStorage={},this.storage=Jj(this.memoryStorage)),Zs()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(i){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",i)}(n=this.broadcastChannel)===null||n===void 0||n.addEventListener("message",async i=>{this._debug("received broadcast notification from other tab or client",i),await this._notifyAllSubscribers(i.data.event,i.data.session,!1)})}this.initialize()}get jwks(){var e,t;return(t=(e=nd[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&t!==void 0?t:{keys:[]}}set jwks(e){nd[this.storageKey]=Object.assign(Object.assign({},nd[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,t;return(t=(e=nd[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&t!==void 0?t:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){nd[this.storageKey]=Object.assign(Object.assign({},nd[this.storageKey]),{cachedAt:e})}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${lR}) ${new Date().toISOString()}`,...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{const t=u$(window.location.href);let n="none";if(this._isImplicitGrantCallback(t)?n="implicit":await this._isPKCECallback(t)&&(n="pkce"),Zs()&&this.detectSessionInUrl&&n!=="none"){const{data:s,error:i}=await this._getSessionFromURL(t,n);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),e$(i)){const c=(e=i.details)===null||e===void 0?void 0:e.code;if(c==="identity_already_exists"||c==="identity_not_found"||c==="single_identity_not_deletable")return{error:i}}return await this._removeSession(),{error:i}}const{session:o,redirectType:l}=s;return this._debug("#_initialize()","detected session in URL",o,"redirect type",l),await this._saveSession(o),setTimeout(async()=>{l==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(t){return qe(t)?{error:t}:{error:new uR("Unexpected error during initialization",t)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var t,n,s;try{const i=await Ze(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(t=e==null?void 0:e.options)===null||t===void 0?void 0:t.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.captchaToken}},xform:va}),{data:o,error:l}=i;if(l||!o)return{data:{user:null,session:null},error:l};const c=o.session,u=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",c)),{data:{user:u,session:c},error:null}}catch(i){if(qe(i))return{data:{user:null,session:null},error:i};throw i}}async signUp(e){var t,n,s;try{let i;if("email"in e){const{email:d,password:h,options:f}=e;let p=null,m=null;this.flowType==="pkce"&&([p,m]=await ed(this.storage,this.storageKey)),i=await Ze(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:f==null?void 0:f.emailRedirectTo,body:{email:d,password:h,data:(t=f==null?void 0:f.data)!==null&&t!==void 0?t:{},gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken},code_challenge:p,code_challenge_method:m},xform:va})}else if("phone"in e){const{phone:d,password:h,options:f}=e;i=await Ze(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:d,password:h,data:(n=f==null?void 0:f.data)!==null&&n!==void 0?n:{},channel:(s=f==null?void 0:f.channel)!==null&&s!==void 0?s:"sms",gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken}},xform:va})}else throw new A0("You must provide either an email or phone number and a password");const{data:o,error:l}=i;if(l||!o)return{data:{user:null,session:null},error:l};const c=o.session,u=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",c)),{data:{user:u,session:c},error:null}}catch(i){if(qe(i))return{data:{user:null,session:null},error:i};throw i}}async signInWithPassword(e){try{let t;if("email"in e){const{email:i,password:o,options:l}=e;t=await Ze(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:Kj})}else if("phone"in e){const{phone:i,password:o,options:l}=e;t=await Ze(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:Kj})}else throw new A0("You must provide either an email or phone number and a password");const{data:n,error:s}=t;return s?{data:{user:null,session:null},error:s}:!n||!n.session||!n.user?{data:{user:null,session:null},error:new j0}:(n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),{data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:s})}catch(t){if(qe(t))return{data:{user:null,session:null},error:t};throw t}}async signInWithOAuth(e){var t,n,s,i;return await this._handleProviderSignIn(e.provider,{redirectTo:(t=e.options)===null||t===void 0?void 0:t.redirectTo,scopes:(n=e.options)===null||n===void 0?void 0:n.scopes,queryParams:(s=e.options)===null||s===void 0?void 0:s.queryParams,skipBrowserRedirect:(i=e.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:t}=e;if(t==="solana")return await this.signInWithSolana(e);throw new Error(`@supabase/auth-js: Unsupported chain "${t}"`)}async signInWithSolana(e){var t,n,s,i,o,l,c,u,d,h,f,p;let m,g;if("message"in e)m=e.message,g=e.signature;else{const{chain:v,wallet:b,statement:y,options:w}=e;let _;if(Zs())if(typeof b=="object")_=b;else{const S=window;if("solana"in S&&typeof S.solana=="object"&&("signIn"in S.solana&&typeof S.solana.signIn=="function"||"signMessage"in S.solana&&typeof S.solana.signMessage=="function"))_=S.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof b!="object"||!(w!=null&&w.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");_=b}const N=new URL((t=w==null?void 0:w.url)!==null&&t!==void 0?t:window.location.href);if("signIn"in _&&_.signIn){const S=await _.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},w==null?void 0:w.signInWithSolana),{version:"1",domain:N.host,uri:N.href}),y?{statement:y}:null));let E;if(Array.isArray(S)&&S[0]&&typeof S[0]=="object")E=S[0];else if(S&&typeof S=="object"&&"signedMessage"in S&&"signature"in S)E=S;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in E&&"signature"in E&&(typeof E.signedMessage=="string"||E.signedMessage instanceof Uint8Array)&&E.signature instanceof Uint8Array)m=typeof E.signedMessage=="string"?E.signedMessage:new TextDecoder().decode(E.signedMessage),g=E.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in _)||typeof _.signMessage!="function"||!("publicKey"in _)||typeof _!="object"||!_.publicKey||!("toBase58"in _.publicKey)||typeof _.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");m=[`${N.host} wants you to sign in with your Solana account:`,_.publicKey.toBase58(),...y?["",y,""]:[""],"Version: 1",`URI: ${N.href}`,`Issued At: ${(s=(n=w==null?void 0:w.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((i=w==null?void 0:w.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${w.signInWithSolana.notBefore}`]:[],...!((o=w==null?void 0:w.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${w.signInWithSolana.expirationTime}`]:[],...!((l=w==null?void 0:w.signInWithSolana)===null||l===void 0)&&l.chainId?[`Chain ID: ${w.signInWithSolana.chainId}`]:[],...!((c=w==null?void 0:w.signInWithSolana)===null||c===void 0)&&c.nonce?[`Nonce: ${w.signInWithSolana.nonce}`]:[],...!((u=w==null?void 0:w.signInWithSolana)===null||u===void 0)&&u.requestId?[`Request ID: ${w.signInWithSolana.requestId}`]:[],...!((h=(d=w==null?void 0:w.signInWithSolana)===null||d===void 0?void 0:d.resources)===null||h===void 0)&&h.length?["Resources",...w.sign
74InWithSolana.resources.map(E=>`- ${E}`)]:[]].join(`
75`);const S=await _.signMessage(new TextEncoder().encode(m),"utf8");if(!S||!(S instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");g=S}}try{const{data:v,error:b}=await Ze(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:m,signature:o$(g)},!((f=e.options)===null||f===void 0)&&f.captchaToken?{gotrue_meta_security:{captcha_token:(p=e.options)===null||p===void 0?void 0:p.captchaToken}}:null),xform:va});if(b)throw b;return!v||!v.session||!v.user?{data:{user:null,session:null},error:new j0}:(v.session&&(await this._saveSession(v.session),await this._notifyAllSubscribers("SIGNED_IN",v.session)),{data:Object.assign({},v),error:b})}catch(v){if(qe(v))return{data:{user:null,session:null},error:v};throw v}}async _exchangeCodeForSession(e){const t=await Ql(this.storage,`${this.storageKey}-code-verifier`),[n,s]=(t??"").split("/");try{const{data:i,error:o}=await Ze(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:va});if(await Co(this.storage,`${this.storageKey}-code-verifier`),o)throw o;return!i||!i.session||!i.user?{data:{user:null,session:null,redirectType:null},error:new j0}:(i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),{data:Object.assign(Object.assign({},i),{redirectType:s??null}),error:o})}catch(i){if(qe(i))return{data:{user:null,session:null,redirectType:null},error:i};throw i}}async signInWithIdToken(e){try{const{options:t,provider:n,token:s,access_token:i,nonce:o}=e,l=await Ze(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:s,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:t==null?void 0:t.captchaToken}},xform:va}),{data:c,error:u}=l;return u?{data:{user:null,session:null},error:u}:!c||!c.session||!c.user?{data:{user:null,session:null},error:new j0}:(c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",c.session)),{data:c,error:u})}catch(t){if(qe(t))return{data:{user:null,session:null},error:t};throw t}}async signInWithOtp(e){var t,n,s,i,o;try{if("email"in e){const{email:l,options:c}=e;let u=null,d=null;this.flowType==="pkce"&&([u,d]=await ed(this.storage,this.storageKey));const{error:h}=await Ze(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:l,data:(t=c==null?void 0:c.data)!==null&&t!==void 0?t:{},create_user:(n=c==null?void 0:c.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},code_challenge:u,code_challenge_method:d},redirectTo:c==null?void 0:c.emailRedirectTo});return{data:{user:null,session:null},error:h}}if("phone"in e){const{phone:l,options:c}=e,{data:u,error:d}=await Ze(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:l,data:(s=c==null?void 0:c.data)!==null&&s!==void 0?s:{},create_user:(i=c==null?void 0:c.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},channel:(o=c==null?void 0:c.channel)!==null&&o!==void 0?o:"sms"}});return{data:{user:null,session:null,messageId:u==null?void 0:u.message_id},error:d}}throw new A0("You must provide either an email or phone number.")}catch(l){if(qe(l))return{data:{user:null,session:null},error:l};throw l}}async verifyOtp(e){var t,n;try{let s,i;"options"in e&&(s=(t=e.options)===null||t===void 0?void 0:t.redirectTo,i=(n=e.options)===null||n===void 0?void 0:n.captchaToken);const{data:o,error:l}=await Ze(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:s,xform:va});if(l)throw l;if(!o)throw new Error("An error occurred on token verification.");const c=o.session,u=o.user;return c!=null&&c.access_token&&(await this._saveSession(c),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",c)),{data:{user:u,session:c},error:null}}catch(s){if(qe(s))return{data:{user:null,session:null},error:s};throw s}}async signInWithSSO(e){var t,n,s;try{let i=null,o=null;return this.flowType==="pkce"&&([i,o]=await ed(this.storage,this.storageKey)),await Ze(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(n=(t=e.options)===null||t===void 0?void 0:t.redirectTo)!==null&&n!==void 0?n:void 0}),!((s=e==null?void 0:e.options)===null||s===void 0)&&s.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:i,code_challenge_method:o}),headers:this.headers,xform:E$})}catch(i){if(qe(i))return{data:null,error:i};throw i}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:t},error:n}=e;if(n)throw n;if(!t)throw new To;const{error:s}=await Ze(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return{data:{user:null,session:null},error:s}})}catch(e){if(qe(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{const t=`${this.url}/resend`;if("email"in e){const{email:n,type:s,options:i}=e,{error:o}=await Ze(this.fetch,"POST",t,{headers:this.headers,body:{email:n,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},redirectTo:i==null?void 0:i.emailRedirectTo});return{data:{user:null,session:null},error:o}}else if("phone"in e){const{phone:n,type:s,options:i}=e,{data:o,error:l}=await Ze(this.fetch,"POST",t,{headers:this.headers,body:{phone:n,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}}});return{data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:l}}throw new A0("You must provide either an email or phone number and a type")}catch(t){if(qe(t))return{data:{user:null,session:null},error:t};throw t}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async t=>t))}async _acquireLock(e,t){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await n,await t()))();return this.pendingInLock.push((async()=>{try{await s}catch{}})()),s}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const n=t();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){const s=[...this.pendingInLock];await Promise.all(s),this.pendingInLock.splice(0,s.length)}return await n}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const t=await this.__loadSession();return await e(t)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const t=await Ql(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",t),t!==null&&(this._isValidSession(t)?e=t:(this._debug("#getSession()","session from storage is not val
75id"),await this._removeSession())),!e)return{data:{session:null},error:null};const n=e.expires_at?e.expires_at*1e3-Date.now()<Tw:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n){if(this.userStorage){const o=await Ql(this.userStorage,this.storageKey+"-user");o!=null&&o.user?e.user=o.user:e.user=Pw()}if(this.storage.isServer&&e.user){let o=this.suppressGetSessionWarning;e=new Proxy(e,{get:(c,u,d)=>(!o&&u==="user"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),o=!0,this.suppressGetSessionWarning=!0),Reflect.get(c,u,d))})}return{data:{session:e},error:null}}const{session:s,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{session:null},error:i}:{data:{session:s},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(e){try{return e?await Ze(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:$o}):await this._useSession(async t=>{var n,s,i;const{data:o,error:l}=t;if(l)throw l;return!(!((n=o.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new To}:await Ze(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(s=o.session)===null||s===void 0?void 0:s.access_token)!==null&&i!==void 0?i:void 0,xform:$o})})}catch(t){if(qe(t))return QB(t)&&(await this._removeSession(),await Co(this.storage,`${this.storageKey}-code-verifier`)),{data:{user:null},error:t};throw t}}async updateUser(e,t={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,t))}async _updateUser(e,t={}){try{return await this._useSession(async n=>{const{data:s,error:i}=n;if(i)throw i;if(!s.session)throw new To;const o=s.session;let l=null,c=null;this.flowType==="pkce"&&e.email!=null&&([l,c]=await ed(this.storage,this.storageKey));const{data:u,error:d}=await Ze(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:t==null?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:l,code_challenge_method:c}),jwt:o.access_token,xform:$o});if(d)throw d;return o.user=u.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),{data:{user:o.user},error:null}})}catch(n){if(qe(n))return{data:{user:null},error:n};throw n}}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new To;const t=Date.now()/1e3;let n=t,s=!0,i=null;const{payload:o}=Rw(e.access_token);if(o.exp&&(n=o.exp,s=n<=t),s){const{session:l,error:c}=await this._callRefreshToken(e.refresh_token);if(c)return{data:{user:null,session:null},error:c};if(!l)return{data:{user:null,session:null},error:null};i=l}else{const{data:l,error:c}=await this._getUser(e.access_token);if(c)throw c;i={access_token:e.access_token,refresh_token:e.refresh_token,user:l.user,token_type:"bearer",expires_in:n-t,expires_at:n},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return{data:{user:i.user,session:i},error:null}}catch(t){if(qe(t))return{data:{session:null,user:null},error:t};throw t}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async t=>{var n;if(!e){const{data:o,error:l}=t;if(l)throw l;e=(n=o.session)!==null&&n!==void 0?n:void 0}if(!(e!=null&&e.refresh_token))throw new To;const{session:s,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{user:null,session:null},error:i}:s?{data:{user:s.user,session:s},error:null}:{data:{user:null,session:null},error:null}})}catch(t){if(qe(t))return{data:{user:null,session:null},error:t};throw t}}
75async _getSessionFromURL(e,t){try{if(!Zs())throw new T0("No browser detected.");if(e.error||e.error_description||e.error_code)throw new T0(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(t){case"implicit":if(this.flowType==="pkce")throw new zj("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new T0("Not a valid implicit grant flow url.");break;default:}if(t==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new zj("No code detected.");const{data:y,error:w}=await this._exchangeCodeForSession(e.code);if(w)throw w;const _=new URL(window.location.href);return _.searchParams.delete("code"),window.history.replaceState(window.history.state,"",_.toString()),{data:{session:y.session,redirectType:null},error:null}}const{provider_token:n,provider_refresh_token:s,access_token:i,refresh_token:o,expires_in:l,expires_at:c,token_type:u}=e;if(!i||!l||!o||!u)throw new T0("No session defined in URL");const d=Math.round(Date.now()/1e3),h=parseInt(l);let f=d+h;c&&(f=parseInt(c));const p=f-d;p*1e3<=hd&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${p}s, should have been closer to ${h}s`);const m=f-h;d-m>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",m,f,d):d-m<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",m,f,d);const{data:g,error:v}=await this._getUser(i);if(v)throw v;const b={provider_token:n,provider_refresh_token:s,access_token:i,expires_in:h,expires_at:f,refresh_token:o,token_type:u,user:g.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:b,redirectType:e.type},error:null}}catch(n){if(qe(n))return{data:{session:null,redirectType:null},error:n};throw n}}_isImplicitGrantCallback(e){return!!(e.access_token||e.error_description)}async _isPKCECallback(e){const t=await Ql(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&t)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async t=>{var n;const{data:s,error:i}=t;if(i)return{error:i};const o=(n=s.session)===null||n===void 0?void 0:n.access_token;if(o){const{error:l}=await this.admin.signOut(o,e);if(l&&!(ZB(l)&&(l.status===404||l.status===401||l.status===403)))return{error:l}}return e!=="others"&&(await this._removeSession(),await Co(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(e){const t=c$(),n={id:t,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",t),this.stateChangeEmitters.delete(t)}};return this._debug("#onAuthStateChange()","registered callback with id",t),this.stateChangeEmitters.set(t,n),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(t)})))(),{data:{subscription:n}}}async _emitInitialSession(e){return await this._useSession(async t=>{var n,s;try{const{data:{session:i},error:o}=t;if(o)throw o;await((n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",e,"session",i)}catch(i){await((s=this.stateChangeEmitters.get(e))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",i),console.error(i)}})}async resetPasswordForEmail(e,t={}){let n=null,s=null;this.flowType==="pkce"&&([n,s]=await ed(this.storage,this.storageKey,!0));try{return await Ze(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:n,code_challenge_method:s,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(i){if(qe(i))return{data:null,error:i};throw i}}async getUserIdentities(){var e;try{const{data:t,error:n}=await this.getUser();if(n)throw n;return{data:{identities:(e=t.user.identities)!==null&&e!==void 0?e:[]},error:null}}catch(t){if(qe(t))return{data:null,error:t};throw t}}async linkIdentity(e){var t;try{const{data:n,error:s}=await this._useSession(async i=>{var o,l,c,u,d;const{data:h,error:f}=i;if(f)throw f;const p=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(o=e.options)===null||o===void 0?void 0:o.redirectTo,scopes:(l=e.options)===null||l===void 0?void 0:l.scopes,queryParams:(c=e.options)===null||c===void 0?void 0:c.queryParams,skipBrowserRedirect:!0});return await Ze(this.fetch,"GET",p,{headers:this.headers,jwt:(d=(u=h.session)===null||u===void 0?void 0:u.access_token)!==null&&d!==void 0?d:void 0})});if(s)throw s;return Zs()&&!(!((t=e.options)===null||t===void 0)&&t.skipBrowserRedirect)&&window.location.assign(n==null?void 0:n.url),{data:{provider:e.provider,url:n==null?void 0:n.url},error:null}}catch(n){if(qe(n))return{data:{provider:e.provider,url:null},error:n};throw n}}async unlinkIdentity(e){try{return await this._useSession(async t=>{var n,s;const{data:i,error:o}=t;if(o)throw o;
75return await Ze(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(s=(n=i.session)===null||n===void 0?void 0:n.access_token)!==null&&s!==void 0?s:void 0})})}catch(t){if(qe(t))return{data:null,error:t};throw t}}async _refreshAccessToken(e){const t=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(t,"begin");try{const n=Date.now();return await f$(async s=>(s>0&&await h$(200*Math.pow(2,s-1)),this._debug(t,"refreshing attempt",s),await Ze(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:va})),(s,i)=>{const o=200*Math.pow(2,s);return i&&Dw(i)&&Date.now()+o-n<hd})}catch(n){if(this._debug(t,"error",n),qe(n))return{data:{session:null,user:null},error:n};throw n}finally{this._debug(t,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,t){const n=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:t.redirectTo,scopes:t.scopes,queryParams:t.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",t,"url",n),Zs()&&!t.skipBrowserRedirect&&window.location.assign(n),{data:{provider:e,url:n},error:null}}async _recoverAndRefresh(){var e,t;const n="#_recoverAndRefresh()";this._debug(n,"begin");try{const s=await Ql(this.storage,this.storageKey);if(s&&this.userStorage){let o=await Ql(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:s.user},await fd(this.userStorage,this.storageKey+"-user",o)),s.user=(e=o==null?void 0:o.user)!==null&&e!==void 0?e:Pw()}else if(s&&!s.user&&!s.user){const o=await Ql(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(s.user=o.user,await Co(this.storage,this.storageKey+"-user"),await fd(this.storage,this.storageKey,s)):s.user=Pw()}if(this._debug(n,"session from storage",s),!this._isValidSession(s)){this._debug(n,"session is not valid"),s!==null&&await this._removeSession();return}const i=((t=s.expires_at)!==null&&t!==void 0?t:1/0)*1e3-Date.now()<Tw;if(this._debug(n,`session has${i?"":" not"} expired with margin of ${Tw}s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:o}=await this._callRefreshToken(s.refresh_token);o&&(console.error(o),Dw(o)||(this._debug(n,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(s.user&&s.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:l}=await this._getUser(s.access_token);!l&&(o!=null&&o.user)?(s.user=o.user,await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)):this._debug(n,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(n,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){this._debug(n,"error",s),console.error(s);return}finally{this._debug(n,"end")}}async _callRefreshToken(e){var t,n;if(!e)throw new To;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const s=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new Hx;const{data:i,error:o}=await this._refreshAccessToken(e);if(o)throw o;if(!i.session)throw new To;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const l={session:i.session,error:null};return this.refreshingDeferred.resolve(l),l}catch(i){if(this._debug(s,"error",i),qe(i)){const o={session:null,error:i};return Dw(i)||await this._removeSession(),(t=this.refreshingDeferred)===null||t===void 0||t.resolve(o),o}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(i),i}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(e,t,n=!0){const s=`#_notifyAllSubscribers(${e})`;this._debug(s,"begin",t,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:e,session:t});const i=[],o=Array.from(this.stateChangeEmitters.values()).map(async l=>{try{await l.callback(e,t)}catch(c){i.push(c)}});if(await Promise.all(o),i.length>0){for(let l=0;l<i.length;l+=1)console.error(i[l]);throw i[0]}}finally{this._debug(s,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0;const t=Object.assign({},e),n=t.user&&t.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&t.user&&await fd(this.userStorage,this.storageKey+"-user",{user:t.user});const s=Object.assign({},t);delete s.user;const i=Xj(s);await fd(this.storage,this.storageKey,i)}else{const s=Xj(t);await fd(this.storage,this.storageKey,s)}}async _removeSession(){this._debug("#_removeSession()"),await Co(this.storage,this.storageKey),await Co(this.storage,this.storageKey+"-code-verifier"),await Co(this.storage,this.storageKey+"-user"),this.userStorage&&await Co(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Zs()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}
75catch(t){console.error("removing visibilitychange callback failed",t)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),hd);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async t=>{const{data:{session:n}}=t;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const s=Math.floor((n.expires_at*1e3-e)/hd);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${hd}ms, refresh threshold is ${v_} ticks`),s<=v_&&await this._callRefreshToken(n.refresh_token)})}catch(t){console.error("Auto refresh tick failed with error. This is likely a transient error.",t)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof pR)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Zs()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const t=`#_onVisibilityChanged(${e})`;this._debug(t,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(t,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,n){const s=[`provider=${encodeURIComponent(t)}`];if(n!=null&&n.redirectTo&&s.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n!=null&&n.scopes&&s.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){const[i,o]=await ed(this.storage,this.storageKey),l=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});s.push(l.toString())}if(n!=null&&n.queryParams){const i=new URLSearchParams(n.queryParams);s.push(i.toString())}return n!=null&&n.skipBrowserRedirect&&s.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${e}?${s.join("&")}`}async _unenroll(e){try{return await this._useSession(async t=>{var n;const{data:s,error:i}=t;return i?{data:null,error:i}:await Ze(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token})})}catch(t){if(qe(t))return{data:null,error:t};throw t}}async _enroll(e){try{return await this._useSession(async t=>{var n,s;const{data:i,error:o}=t;if(o)return{data:null,error:o};const l=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:{issuer:e.issuer}),{data:c,error:u}=await Ze(this.fetch,"POST",`${this.url}/factors`,{body:l,headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token});return u?{data:null,error:u}:(e.factorType==="totp"&&(!((s=c==null?void 0:c.totp)===null||s===void 0)&&s.qr_code)&&(c.totp.qr_code=`data:image/svg+xml;utf-8,${c.totp.qr_code}`),{data:c,error:null})})}catch(t){if(qe(t))return{data:null,error:t};throw t}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var n;const{data:s,error:i}=t;if(i)return{data:null,error:i};const{data:o,error:l}=await Ze(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:{code:e.code,challenge_id:e.challengeId},headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token});return l?{data:null,error:l}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+o.expires_in},o)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",o),{data:o,error:l})})}catch(t){if(qe(t))return{data:null,error:t};throw t}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var n;const{data:s,error:i}=t;return i?{data:null,error:i}:await Ze(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:{channel:e.channel},headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token})})}catch(t){if(qe(t))return{data:null,error:t};throw t}})}async _challengeAndVerify(e){const{data:t,error:n}=await this._challenge({factorId:e.factorId});return n?{data:null,error:n}:await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){const{data:{user:e},error:t}=await this.getUser();if(t)return{data:null,error:t};const n=(e==null?void 0:e.factors)||[],s=n.filter(o=>o.factor_type==="totp"&&o.status==="verified"),i=n.filter(o=>o.factor_type==="phone"&&o.status==="verified");return{data:{all:n,totp:s,phone:i},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async e=>{var t,n;const{data:{session:s},error:i}=e;if(i)return{data:null,error:i};if(!s)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=Rw(s.access_token);let l=null;o.aal&&(l=o.aal);let c=l;((n=(t=s.user.factors)===null||t===void 0?void 0:t.filter(h=>h.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(c="aal2");const d=o.amr||[];return{data:{currentLevel:l,nextLevel:c,currentAuthenticationMethods:d},error:null}}))}async fetchJwk(e,t={keys:[]}){let n=t.keys.find(l=>l.kid===e);if(n)return n;const s=Date.now();if(n=this.jwks.keys.find(l=>l.kid===e),n&&this.jwks_cached_at+KB>s)return n;const{data:i,error:o}=await Ze(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=s,n=i.keys.find(l=>l.kid===e),!n)?null:n}async getClaims(e,t={}){try{let n=e;if(!n){const{data:p,error:m}
75=await this.getSession();if(m||!p.session)return{data:null,error:m};n=p.session.access_token}const{header:s,payload:i,signature:o,raw:{header:l,payload:c}}=Rw(n);t!=null&&t.allowExpired||v$(i.exp);const u=!s.alg||s.alg.startsWith("HS")||!s.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(s.kid,t!=null&&t.keys?{keys:t.keys}:t==null?void 0:t.jwks);if(!u){const{error:p}=await this.getUser(n);if(p)throw p;return{data:{claims:i,header:s,signature:o},error:null}}const d=w$(s.alg),h=await crypto.subtle.importKey("jwk",u,d,!0,["verify"]);if(!await crypto.subtle.verify(d,h,o,a$(`${l}.${c}`)))throw new N_("Invalid JWT signature");return{data:{claims:i,header:s,signature:o},error:null}}catch(n){if(qe(n))return{data:null,error:n};throw n}}}Kp.nextInstanceID=0;const M$=Kp;class F$ extends M${constructor(e){super(e)}}var B$=function(r,e,t,n){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function l(d){try{u(n.next(d))}catch(h){o(h)}}function c(d){try{u(n.throw(d))}catch(h){o(h)}}function u(d){d.done?i(d.value):s(d.value).then(l,c)}u((n=n.apply(r,e||[])).next())})};class $${constructor(e,t,n){var s,i,o;this.supabaseUrl=e,this.supabaseKey=t;const l=WB(e);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",l),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",l),this.storageUrl=new URL("storage/v1",l),this.functionsUrl=new URL("functions/v1",l);const c=`sb-${l.hostname.split(".")[0]}-auth-token`,u={db:LB,realtime:MB,auth:Object.assign(Object.assign({},OB),{storageKey:c}),global:IB},d=qB(n??{},u);this.storageKey=(s=d.auth.storageKey)!==null&&s!==void 0?s:"",this.headers=(i=d.global.headers)!==null&&i!==void 0?i:{},d.accessToken?(this.accessToken=d.accessToken,this.auth=new Proxy({},{get:(h,f)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(f)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((o=d.auth)!==null&&o!==void 0?o:{},this.headers,d.global.fetch),this.fetch=UB(t,this._getAccessToken.bind(this),d.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},d.realtime)),this.rest=new tB(new URL("rest/v1",l).href,{headers:this.headers,schema:d.db.schema,fetch:this.fetch}),this.storage=new DB(this.storageUrl.href,this.headers,this.fetch,n==null?void 0:n.storage),d.accessToken||this._listenForAuthEvents()}get functions(){return new P7(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={}){return this.rest.rpc(e,t,n)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){var e,t;return B$(this,void 0,void 0,function*(){if(this.accessToken)return yield this.accessToken();const{data:n}=yield this.auth.getSession();return(t=(e=n.session)===null||e===void 0?void 0:e.access_token)!==null&&t!==void 0?t:this.supabaseKey})}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:s,userStorage:i,storageKey:o,flowType:l,lock:c,debug:u},d,h){const f={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new F$({url:this.authUrl.href,headers:Object.assign(Object.assign({},f),d),storageKey:o,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:s,userStorage:i,flowType:l,lock:c,debug:u,fetch:h,hasCustomAuthorizationHeader:Object.keys(this.headers).some(p=>p.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new bB(this.realtimeUrl.href,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,n)=>{this._handleTokenChanged(t,"CLIENT",n==null?void 0:n.access_token)})}_handleTokenChanged(e,t,n){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==n?this.changedAccessToken=n:e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}const U$=(r,e,t)=>new $$(r,e,t);function H$(){if(typeof window<"u"||typeof process>"u")return!1;const r=process.version;if(r==null)return!1;const e=r.match(/^v(\d+)\./);return e?parseInt(e[1],10)<=18:!1}H$()&&console.warn("⚠️  Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to N
75ode.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const z$="https://rdyprhzjnqjauufyfqlp.supabase.co",mR="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJkeXByaHpqbnFqYXV1ZnlmcWxwIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODAzNDYzMDAsImV4cCI6MjA5NTkyMjMwMH0.zyA_fVB72pAmHui8m1UhJkK-R9yndy6nuLgyzLDvW04",je=!!mR,Y=je?U$(z$,mR):null,gR=k.createContext(null);function q$({children:r}){const[e,t]=k.useState(null),[n,s]=k.useState(null),[i,o]=k.useState(!0);k.useEffect(()=>{if(!Y){o(!1);return}let d=!1;const{data:h}=Y.auth.onAuthStateChange((f,p)=>{s(p),t((p==null?void 0:p.user)??null),d||(d=!0,o(!1))});return Y.auth.getSession().then(({data:f})=>{var p;d||(d=!0,s(f.session),t(((p=f.session)==null?void 0:p.user)??null),o(!1))}).catch(()=>{d||(d=!0,o(!1))}),()=>h.subscription.unsubscribe()},[]);async function l(d,h){if(!Y)return{error:"Supabase not configured"};const{error:f}=await Y.auth.signInWithPassword({email:d,password:h});return{error:(f==null?void 0:f.message)??null}}async function c(d,h){if(!Y)return{error:"Supabase not configured"};const{error:f}=await Y.auth.signUp({email:d,password:h});return{error:(f==null?void 0:f.message)??null}}async function u(){Y&&await Y.auth.signOut()}return a.jsx(gR.Provider,{value:{user:e,session:n,loading:i,signIn:l,signUp:c,signOut:u},children:r})}function Nf(){const r=k.useContext(gR);if(!r)throw new Error("useAuth must be used inside AuthProvider");return r}const Lw=new Date(1921,6,1),ql="America/New_York";function Ug(){const r=new Date,e=r.getFullYear()-Lw.getFullYear(),t=r.getMonth()-Lw.getMonth();return t<0||t===0&&r.getDate()<Lw.getDate()?e-1:e}function W$(){return 105}function V$(){const r=new Date,e=new Date(r.getFullYear(),0,1),t=Math.floor((r.getTime()-e.getTime())/(24*60*60*1e3));return Math.ceil((t+e.getDay()+1)/7)}function rf(r){return new Date(r).toLocaleDateString("en-US",{timeZone:ql,year:"numeric",month:"long",day:"numeric"})}function xi(r){return new Date(r).toLocaleDateString("en-US",{timeZone:ql,month:"short",day:"numeric",year:"numeric"})}function _k(r){return new Date(r).toLocaleDateString("en-US",{timeZone:ql,weekday:"long",month:"long",day:"numeric",year:"numeric"})}function yR(r){return new Date(r).toLocaleTimeString("en-US",{timeZone:ql,hour:"numeric",minute:"2-digit"})}function G$(r){return new Date(r).toLocaleString("en-US",{timeZone:ql,month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function X$(){return new Date().toLocaleDateString("en-US",{timeZone:ql,weekday:"long",year:"numeric",month:"long",day:"numeric"})}function Y$(r){if(!r)return"";const e=new Date(r),t=new Intl.DateTimeFormat("en-US",{timeZone:ql,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(e),n=u=>{var d;return((d=t.find(h=>h.type===u))==null?void 0:d.value)??"00"},s=n("year"),i=n("month"),o=n("day"),l=n("hour")==="24"?"00":n("hour"),c=n("minute");return`${s}-${i}-${o}T${l}:${c}`}function K$(r){if(!r)return"";const[e,t]=r.split("T"),[n,s,i]=e.split("-").map(Number),[o,l]=(t??"00:00").split(":").map(Number),c=new Date(Date.UTC(n,s-1,i,o,l)),u=new Intl.DateTimeFormat("en-US",{timeZone:ql,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(c),d=b=>{var y;return((y=u.find(w=>w.type===b))==null?void 0:y.value)??"00"},h=Number(d("hour")==="24"?"0":d("hour")),f=Number(d("minute")),p=o*60+l,m=h*60+f;let g=p-m;return g<-12*60&&(g+=24*60),g>12*60&&(g-=24*60),new Date(c.getTime()+g*60*1e3).toISOString()}function J$(r){return r.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")}function bR(r){const e=r.replace(/<[^>]+>/g,"").split(/\s+/).length;return`${Math.max(1,Math.round(e/200))} min read`}const Cb={local:{slug:"local",label:"Local News",color:"text-white",bgColor:"bg-brand-red"},sports:{slug:"sports",label:"Sports",color:"text-white",bgColor:"bg-brand-black"},community:{slug:"community",label:"Community",color:"text-white",bgColor:"bg-green-700"},opinion:{slug:"opinion",label:"Opinion",color:"text-white",bgColor:"bg-slate-700"},obituaries:{slug:"obituaries",label:"Obituaries",color:"text-white",bgColor:"bg-gray-600"},notices:{slug:"notices",label:"Public Notices",color:"text-white",bgColor:"bg-
75amber-700"},gilchrist:{slug:"gilchrist",label:"Gilchrist News",color:"text-white",bgColor:"bg-teal-700"},perspectives:{slug:"perspectives",label:"Perspectives",color:"text-white",bgColor:"bg-blue-700"}};function Z$(){const r=W$(),e=V$(),t=Ug(),n=X$();return a.jsxs("div",{className:"bg-white border-b border-gray-200",children:[a.jsx("div",{className:"border-b border-gray-200",children:a.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-1.5 flex items-center justify-between text-xs",children:[a.jsx("span",{className:"font-body text-gray-500 hidden sm:inline",children:n}),a.jsxs("div",{className:"flex items-center gap-3 sm:gap-4 text-gray-500 ml-auto sm:ml-0",children:[a.jsxs("span",{className:"hidden sm:inline",children:["Vol. ",r," • Issue ",e]}),a.jsx($e,{to:"/subscribe",className:"hover:text-brand-red transition-colors",children:"Subscribe"}),a.jsx($e,{to:"/admin",className:"hover:text-brand-red transition-colors",children:"Staff"})]})]})}),a.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-5 md:py-7 text-center",children:[a.jsx($e,{to:"/",className:"group inline-block",children:a.jsx("h1",{className:"font-masthead text-4xl sm:text-5xl md:text-6xl lg:text-7xl font-bold text-brand-red leading-none tracking-wide group-hover:opacity-85 transition-opacity",children:"The Dixie County Advocate"})}),a.jsxs("div",{className:"flex items-center justify-center gap-3 mt-3 mb-1",children:[a.jsx("div",{className:"h-px bg-brand-red/30 flex-1 max-w-24"}),a.jsx("span",{className:"font-headline italic text-gray-600 text-sm md:text-base tracking-wider",children:"Every week without fail since July 1, 1921"}),a.jsx("div",{className:"h-px bg-brand-red/30 flex-1 max-w-24"})]}),a.jsxs("p",{className:"font-body text-gray-400 text-xs tracking-widest uppercase mt-1",children:["Serving Dixie County, Florida • ",t," Years of Continuous Publication"]})]}),a.jsx("div",{className:"border-t-4 border-brand-red"}),a.jsx("div",{className:"border-t border-brand-red/40"})]})}/**
76 * @license lucide-react v0.344.0 - ISC
77 *
78 * This source code is licensed under the ISC license.
79 * See the LICENSE file in the root directory of this source tree.
80 */var Q$={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
81 * @license lucide-react v0.344.0 - ISC
82 *
83 * This source code is licensed under the ISC license.
84 * See the LICENSE file in the root directory of this source tree.
85 */const eU=r=>r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),ye=(r,e)=>{const t=k.forwardRef(({color:n="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:o,className:l="",children:c,...u},d)=>k.createElement("svg",{ref:d,...Q$,width:s,height:s,stroke:n,strokeWidth:o?Number(i)*24/Number(s):i,className:["lucide",`lucide-${eU(r)}`,l].join(" "),...u},[...e.map(([h,f])=>k.createElement(h,f)),...Array.isArray(c)?c:[c]]));return t.displayName=`${r}`,t};/**
86 * @license lucide-react v0.344.0 - ISC
87 *
88 * This source code is licensed under the ISC license.
89 * See the LICENSE file in the root directory of this source tree.
90 */const Ve=ye("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
91 * @license lucide-react v0.344.0 - ISC
92 *
93 * This source code is licensed under the ISC license.
94 * See the LICENSE file in the root directory of this source tree.
95 */const xR=ye("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
96 * @license lucide-react v0.344.0 - ISC
97 *
98 * This source code is licensed under the ISC license.
99 * See the LICENSE file in the root directory of this source tree.
100 */const Qj=ye("AlignCenter",[["line",{x1:"21",x2:"3",y1:"6",y2:"6",key:"1fp77t"}],["line",{x1:"17",x2:"7",y1:"12",y2:"12",key:"rsh8ii"}],["line",{x1:"19",x2:"5",y1:"18",y2:"18",key:"1t0tuv"}]]);/**
101 * @license lucide-react v0.344.0 - ISC
102 *
103 * This source code is licensed under the ISC license.
104 * See the LICENSE file in the root directory of this source tree.
105 */const tU=ye("AlignEndVertical",[["rect",{width:"16",height:"6",x:"2",y:"4",rx:"2",key:"10wcwx"}],["rect",{width:"9",height:"6",x:"9",y:"14",rx:"2",key:"4p5bwg"}],["path",{d:"M22 22V2",key:"12ipfv"}]]);/**
106 * @license lucide-react v0.344.0 - ISC
107 *
108 * This source code is licensed under the ISC license.
109 * See the LICENSE file in the root directory of this source tree.
110 */const rU=ye("AlignLeft",[["line",{x1:"21",x2:"3",y1:"6",y2:"6",key:"1fp77t"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}],["line",{x1:"17",x2:"3",y1:"18",y2:"18",key:"1awlsn"}]]);/**
111 * @license lucide-react v0.344.0 - ISC
112 *
113 * This source code is licensed under the ISC license.
114 * See the LICENSE file in the root directory of this source tree.
115 */const nU=ye("AlignStartVertical",[["rect",{width:"9",height:"6",x:"6",y:"14",rx:"2",key:"lpm2y7"}],["rect",{width:"16",height:"6",x:"6",y:"4",rx:"2",key:"rdj6ps"}],["path",{d:"M2 2v20",key:"1ivd8o"}
115]]);/**
116 * @license lucide-react v0.344.0 - ISC
117 *
118 * This source code is licensed under the ISC license.
119 * See the LICENSE file in the root directory of this source tree.
120 */const Wd=ye("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
121 * @license lucide-react v0.344.0 - ISC
122 *
123 * This source code is licensed under the ISC license.
124 * See the LICENSE file in the root directory of this source tree.
125 */const vR=ye("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
126 * @license lucide-react v0.344.0 - ISC
127 *
128 * This source code is licensed under the ISC license.
129 * See the LICENSE file in the root directory of this source tree.
130 */const Eb=ye("Award",[["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}],["path",{d:"M15.477 12.89 17 22l-5-3-5 3 1.523-9.11",key:"em7aur"}]]);/**
131 * @license lucide-react v0.344.0 - ISC
132 *
133 * This source code is licensed under the ISC license.
134 * See the LICENSE file in the root directory of this source tree.
135 */const eA=ye("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/**
136 * @license lucide-react v0.344.0 - ISC
137 *
138 * This source code is licensed under the ISC license.
139 * See the LICENSE file in the root directory of this source tree.
140 */const jb=ye("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);/**
141 * @license lucide-react v0.344.0 - ISC
142 *
143 * This source code is licensed under the ISC license.
144 * See the LICENSE file in the root directory of this source tree.
145 */const Jp=ye("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);/**
146 * @license lucide-react v0.344.0 - ISC
147 *
148 * This source code is licensed under the ISC license.
149 * See the LICENSE file in the root directory of this source tree.
150 */const sU=ye("CalendarPlus",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 13V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"3spt84"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M19 16v6",key:"tddt3s"}]]);/**
151 * @license lucide-react v0.344.0 - ISC
152 *
153 * This source code is licensed under the ISC license.
154 * See the LICENSE file in the root directory of this source tree.
155 */const iU=ye("CalendarX",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m14 14-4 4",key:"rymu2i"}],["path",{d:"m10 14 4 4",key:"3sz06r"}]]);/**
156 * @license lucide-react v0.344.0 - ISC
157 *
158 * This source code is licensed under the ISC license.
159 * See the LICENSE file in the root directory of this source tree.
160 */const ha=ye("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
161 * @license lucide-react v0.344.0 - ISC
162 *
163 * This source code is licensed under the ISC license.
164 * See the LICENSE file in the root directory of this source tree.
165 */const ia=ye("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/**
166 * @license lucide-react v0.344.0 - ISC
167 *
168 * This source code is licensed under the ISC license.
169 * See the LICENSE file in the root directory of this source tree.
170 */const aU=ye("CheckCircle2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
171 * @license lucide-react v0.344.0 - ISC
172 *
173 * This source code is licensed under the ISC license.
174 * See the LICENSE file in the root directory of this source tree.
175 */const At=ye("CheckCircle",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
176 * @license lucide-react v0.344.0 - ISC
177 *
178 * This source code is licensed under the ISC license.
179 * See the LICENSE file in the root directory of this source tree.
180 */const Nk=ye("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
181 * @license lucide-react v0.344.0 - ISC
182 *
183 * This source code is licensed under the ISC license.
184 * See the LICENSE file in the root directory of this source tree.
185 */const Ws=ye("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
186 * @license lucide-react v0.344.0 - ISC
187 *
188 * This source code is licensed under the ISC license.
189 * See the LICENSE file in the root directory of this source tree.
190 */const wR=ye("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
191 * @license lucide-react v0.344.0 - ISC
192 *
193 * This source code is licensed under the ISC license.
194 * See the LICENSE file in the root directory of this source tree.
195 */const zx=ye("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
196 * @license lucide-react v0.344.0 - ISC
197 *
198 * This source code is licensed under the ISC license.
199 * See the LICENSE file in the root directory of this source tree.
200 */const fa=ye("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
201 * @license lucide-react v0.344.0 - ISC
202 *
203 * This source code is licensed under the ISC license.
204 * See the LICENSE file in the root directory of this source tree.
205 */const zr=ye("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
206 * @license lucide-react v0.344.0 - ISC
207 *
208 * This source code is licensed under the ISC license.
209 * See the LICENSE file in the root directory of this source tree.
210 */const oU=ye("CloudDrizzle",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M8 19v1",key:"1dk2by"}],["path",{d:"M8 14v1",key:"84yxot"}],["path",{d:"M16 19v1",key:"v220m7"}],["path",{d:"M16 14v1",key:"g12gj6"}],["path",{d:"M12 21v1",key:"q8vafk"}],["path",{d:"M12 16v1",key:"1mx6rx"}]]);/**
211 * @license lucide-react v0.344.0 - ISC
212 *
213 * This source code is licensed under the ISC license.
214 * See the LICENSE file in the root directory of this source tree.
215 */const lU=ye("CloudLightning",[["path",{d:"M6 16.326A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 .5 8.973",key:"1cez44"}],["path",{d:"m13 12-3 5h4l-3 5",key:"1t22er"}]]);/**
216 * @license lucide-react v0.344.0 - ISC
217 *
218 * This source code is licensed under the ISC license.
219 * See the LICENSE file in the root directory of this source tree.
220 */const cU=ye("CloudRain",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 14v6",key:"1j4efv"}],["path",{d:"M8 14v6",key:"17c4r9"}],["path",{d:"M12 16v6",key:"c8a4gj"}]]);/**
221 * @license lucide-react v0.344.0 - ISC
222 *
223 * This source code is licensed under the ISC license.
224 * See the LICENSE file in the root directory of this source tree.
225 */const uU=ye("CloudSnow",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M8 15h.01",key:"a7atzg"}],["path",{d:"M8 19h.01",key:"puxtts"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M12 21h.01",key:"h35vbk"}],["path",{d:"M16 15h.01",key:"rnfrdf"}],["path",{d:"M16 19h.01",key:"1vcnzz"}]]);/**
226 * @license lucide-react v0.344.0 - ISC
227 *
228 * This source code is licensed under the ISC license.
229 * See the LICENSE file in the root directory of this source tree.
230 */const S_=ye("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
231 * @license lucide-react v0.344.0 - ISC
232 *
233 * This source code is licensed under the ISC license.
234 * See the LICENSE file in the root directory of this source tree.
235 */const dU=ye("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
236 * @license lucide-react v0.344.0 - ISC
237 *
238 * This source code is licensed under the ISC license.
239 * See the LICENSE file in the root directory of this source tree.
240 */const k_=ye("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);/**
241 * @license lucide-react v0.344.0 - ISC
242 *
243 * This source code is licensed under the ISC license.
244 * See the LICENSE file in the root directory of this source tree.
245 */const _R=ye("Crosshair",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]]);/**
246 * @license lucide-react v0.344.0 - ISC
247 *
248 * This source code is licensed under the ISC license.
249 * See the LICENSE file in the root directory of this source tree.
250 */const Du=ye("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
251 * @license lucide-react v0.344.0 - ISC
252 *
253 * This source code is licensed under the ISC license.
254 * See the LICENSE file in the root directory of this source tree.
255 */const vu=ye("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
256 * @license lucide-react v0.344.0 - ISC
257 *
258 * This source code is licensed under the ISC license.
259 * See the LICENSE file in the root directory of this source tree.
260 */const Hg=ye("EyeOff",[["path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24",key:"1jxqfv"}],["path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68",key:"9wicm4"}],["path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61",key:"1jreej"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/**
261 * @license lucide-react v0.344.0 - ISC
262 *
263 * This source code is licensed under the ISC license.
264 * See the LICENSE file in the root directory of this source tree.
265 */const zg=ye("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
266 * @license lucide-react v0.344.0 - ISC
267 *
268 * This source code is licensed under the ISC license.
269 * See the LICENSE file in the root directory of this source tree.
270 */const NR=ye("Facebook",[["path",{d:"M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z",key:"1jg4f8"}]]);/**
271 * @license lucide-react v0.344.0 - ISC
272 *
273 * This source code is licensed under the ISC license.
274 * See the LICENSE file in the root directory of this source tree.
275 */const hU=ye("FileCheck",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m9 15 2 2 4-4",key:"1grp1n"}]]);/**
276 * @license lucide-react v0.344.0 - ISC
277 *
278 * This source code is licensed under the ISC license.
279 * See the LICENSE file in the root directory of this source tree.
280 */const C_=ye("FilePlus2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]);/**
281 * @license lucide-react v0.344.0 - ISC
282 *
283 * This source code is licensed under the ISC license.
284 * See the LICENSE file in the root directory of this source tree.
285 */const Bt=ye("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
286 * @license lucide-react v0.344.0 - ISC
287 *
288 * This source code is licensed under the ISC license.
289 * See the LICENSE file in the root directory of this source tree.
290 */const Ow=ye("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/**
291 * @license lucide-react v0.344.0 - ISC
292 *
293 * This source code is licensed under the ISC license.
294 * See the LICENSE file in the root directory of this source tree.
295 */const fU=ye("Film",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]]);/**
296 * @license lucide-react v0.344.0 - ISC
297 *
298 * This source code is licensed under the ISC license.
299 * See the LICENSE file in the root directory of this source tree.
300 */const pU=ye("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
301 * @license lucide-react v0.344.0 - ISC
302 *
303 * This source code is licensed under the ISC license.
304 * See the LICENSE file in the root directory of this source tree.
305 */const tA=ye("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
306 * @license lucide-react v0.344.0 - ISC
307 *
308 * This source code is licensed under the ISC license.
309 * See the LICENSE file in the root directory of this source tree.
310 */const mU=ye("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
311 * @license lucide-react v0.344.0 - ISC
312 *
313 * This source code is licensed under the ISC license.
314 * See the LICENSE file in the root directory of this source tree.
315 */const bl=ye("Headphones",[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3",key:"1xhozi"}]]);/**
316 * @license lucide-react v0.344.0 - ISC
317 *
318 * This source code is licensed under the ISC license.
319 * See the LICENSE file in the root directory of this source tree.
320 */const jl=ye("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/**
321 * @license lucide-react v0.344.0 - ISC
322 *
323 * This source code is licensed under the ISC license.
324 * See the LICENSE file in the root directory of this source tree.
325 */const gU=ye("ImageOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]]);/**
326 * @license lucide-react v0.344.0 - ISC
327 *
328 * This source code is licensed under the ISC license.
329 * See the LICENSE file in the root directory of this source tree.
330 */const qx=ye("ImagePlus",[["path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7",key:"31hg93"}],["line",{x1:"16",x2:"22",y1:"5",y2:"5",key:"ez7e4s"}],["line",{x1:"19",x2:"19",y1:"2",y2:"8",key:"1gkr8c"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
331 * @license lucide-react v0.344.0 - ISC
332 *
333 * This source code is licensed under the ISC license.
334 * See the LICENSE file in the root directory of this source tree.
335 */const Vu=ye("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
336 * @license lucide-react v0.344.0 - ISC
337 *
338 * This source code is licensed under the ISC license.
339 * See the LICENSE file in the root directory of this source tree.
340 */const yU=ye("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
341 * @license lucide-react v0.344.0 - ISC
342 *
343 * This source code is licensed under the ISC license.
344 * See the LICENSE file in the root directory of this source tree.
345 */const bU=ye("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
346 * @license lucide-react v0.344.0 - ISC
347 *
348 * This source code is licensed under the ISC license.
349 * See the LICENSE file in the root directory of this source tree.
350 */const E_=ye("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
351 * @license lucide-react v0.344.0 - ISC
352 *
353 * This source code is licensed under the ISC license.
354 * See the LICENSE file in the root directory of this source tree.
355 */const xU=ye("LayoutList",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["path",{d:"M14 4h7",key:"3xa0d5"}],["path",{d:"M14 9h7",key:"1icrd9"}],["path",{d:"M14 15h7",key:"1mj8o2"}],["path",{d:"M14 20h7",key:"11slyb"}]]);/**
356 * @license lucide-react v0.344.0 - ISC
357 *
358 * This source code is licensed under the ISC license.
359 * See the LICENSE file in the root directory of this source tree.
360 */const rA=ye("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/**
361 * @license lucide-react v0.344.0 - ISC
362 *
363 * This source code is licensed under the ISC license.
364 * See the LICENSE file in the root directory of this source tree.
365 */const SR=ye("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/**
366 * @license lucide-react v0.344.0 - ISC
367 *
368 * This source code is licensed under the ISC license.
369 * See the LICENSE file in the root directory of this source tree.
370 */const _e=ye("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
371 * @license lucide-react v0.344.0 - ISC
372 *
373 * This source code is licensed under the ISC license.
374 * See the LICENSE file in the root directory of this source tree.
375 */const Sk=ye("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
376 * @license lucide-react v0.344.0 - ISC
377 *
378 * This source code is licensed under the ISC license.
379 * See the LICENSE file in the root directory of this source tree.
380 */const Ab=ye("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/**
381 * @license lucide-react v0.344.0 - ISC
382 *
383 * This source code is licensed under the ISC license.
384 * See the LICENSE file in the root directory of this source tree.
385 */const kk=ye("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
386 * @license lucide-react v0.344.0 - ISC
387 *
388 * This source code is licensed under the ISC license.
389 * See the LICENSE file in the root directory of this source tree.
390 */const go=ye("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/**
391 * @license lucide-react v0.344.0 - ISC
392 *
393 * This source code is licensed under the ISC license.
394 * See the LICENSE file in the root directory of this source tree.
395 */const yo=ye("MapPin",[["path",{d:"M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z",key:"2oe9fu"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/**
396 * @license lucide-react v0.344.0 - ISC
397 *
398 * This source code is licensed under the ISC license.
399 * See the LICENSE file in the root directory of this source tree.
400 */const nA=ye("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
401 * @license lucide-react v0.344.0 - ISC
402 *
403 * This source code is licensed under the ISC license.
404 * See the LICENSE file in the root directory of this source tree.
405 */const Tb=ye("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]);/**
406 * @license lucide-react v0.344.0 - ISC
407 *
408 * This source code is licensed under the ISC license.
409 * See the LICENSE file in the root directory of this source tree.
410 */const sA=ye("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
411 * @license lucide-react v0.344.0 - ISC
412 *
413 * This source code is licensed under the ISC license.
414 * See the LICENSE file in the root directory of this source tree.
415 */const vU=ye("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
416 * @license lucide-react v0.344.0 - ISC
417 *
418 * This source code is licensed under the ISC license.
419 * See the LICENSE file in the root directory of this source tree.
420 */const Vs=ye("Newspaper",[["path",{d:"M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2",key:"7pis2x"}],["path",{d:"M18 14h-8",key:"sponae"}],["path",{d:"M15 18h-5",key:"95g1m2"}],["path",{d:"M10 6h8v4h-8V6Z",key:"smlsk5"}]]);/**
421 * @license lucide-react v0.344.0 - ISC
422 *
423 * This source code is licensed under the ISC license.
424 * See the LICENSE file in the root directory of this source tree.
425 */const wU=ye("Package",[["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/**
426 * @license lucide-react v0.344.0 - ISC
427 *
428 * This source code is licensed under the ISC license.
429 * See the LICENSE file in the root directory of this source tree.
430 */const _U=ye("PanelBottom",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/**
431 * @license lucide-react v0.344.0 - ISC
432 *
433 * This source code is licensed under the ISC license.
434 * See the LICENSE file in the root directory of this source tree.
435 */const NU=ye("PanelTop",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]]);/**
436 * @license lucide-react v0.344.0 - ISC
437 *
438 * This source code is licensed under the ISC license.
439 * See the LICENSE file in the root directory of this source tree.
440 */const SU=ye("Pause",[["rect",{width:"4",height:"16",x:"6",y:"4",key:"iffhe4"}],["rect",{width:"4",height:"16",x:"14",y:"4",key:"sjin7j"}]]);/**
441 * @license lucide-react v0.344.0 - ISC
442 *
443 * This source code is licensed under the ISC license.
444 * See the LICENSE file in the root directory of this source tree.
445 */const kU=ye("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z",key:"ymcmye"}]]);/**
446 * @license lucide-react v0.344.0 - ISC
447 *
448 * This source code is licensed under the ISC license.
449 * See the LICENSE file in the root directory of this source tree.
450 */const CU=ye("Pen",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}]]);/**
451 * @license lucide-react v0.344.0 - ISC
452 *
453 * This source code is licensed under the ISC license.
454 * See the LICENSE file in the root directory of this source tree.
455 */const Sf=ye("Pencil",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
456 * @license lucide-react v0.344.0 - ISC
457 *
458 * This source code is licensed under the ISC license.
459 * See the LICENSE file in the root directory of this source tree.
460 */const Ck=ye("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/**
461 * @license lucide-react v0.344.0 - ISC
462 *
463 * This source code is licensed under the ISC license.
464 * See the LICENSE file in the root directory of this source tree.
465 */const kf=ye("Play",[["polygon",{points:"5 3 19 12 5 21 5 3",key:"191637"}]]);/**
466 * @license lucide-react v0.344.0 - ISC
467 *
468 * This source code is licensed under the ISC license.
469 * See the LICENSE file in the root directory of this source tree.
470 */const j_=ye("PlusCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/**
471 * @license lucide-react v0.344.0 - ISC
472 *
473 * This source code is licensed under the ISC license.
474 * See the LICENSE file in the root directory of this source tree.
475 */const No=ye("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
476 * @license lucide-react v0.344.0 - ISC
477 *
478 * This source code is licensed under the ISC license.
479 * See the LICENSE file in the root directory of this source tree.
480 */const Vd=ye("Printer",[["polyline",{points:"6 9 6 2 18 2 18 9",key:"1306q4"}],["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}
480],["rect",{width:"12",height:"8",x:"6",y:"14",key:"5ipwut"}]]);/**
481 * @license lucide-react v0.344.0 - ISC
482 *
483 * This source code is licensed under the ISC license.
484 * See the LICENSE file in the root directory of this source tree.
485 */const wu=ye("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);/**
486 * @license lucide-react v0.344.0 - ISC
487 *
488 * This source code is licensed under the ISC license.
489 * See the LICENSE file in the root directory of this source tree.
490 */const Ru=ye("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
491 * @license lucide-react v0.344.0 - ISC
492 *
493 * This source code is licensed under the ISC license.
494 * See the LICENSE file in the root directory of this source tree.
495 */const vn=ye("Save",[["path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z",key:"1owoqh"}],["polyline",{points:"17 21 17 13 7 13 7 21",key:"1md35c"}],["polyline",{points:"7 3 7 8 15 8",key:"8nz8an"}]]);/**
496 * @license lucide-react v0.344.0 - ISC
497 *
498 * This source code is licensed under the ISC license.
499 * See the LICENSE file in the root directory of this source tree.
500 */const A_=ye("ScrollText",[["path",{d:"M8 21h12a2 2 0 0 0 2-2v-2H10v2a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v3h4",key:"13a6an"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M15 12h-5",key:"r7krc0"}]]);/**
501 * @license lucide-react v0.344.0 - ISC
502 *
503 * This source code is licensed under the ISC license.
504 * See the LICENSE file in the root directory of this source tree.
505 */const nf=ye("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
506 * @license lucide-react v0.344.0 - ISC
507 *
508 * This source code is licensed under the ISC license.
509 * See the LICENSE file in the root directory of this source tree.
510 */const qg=ye("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/**
511 * @license lucide-react v0.344.0 - ISC
512 *
513 * This source code is licensed under the ISC license.
514 * See the LICENSE file in the root directory of this source tree.
515 */const EU=ye("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/**
516 * @license lucide-react v0.344.0 - ISC
517 *
518 * This source code is licensed under the ISC license.
519 * See the LICENSE file in the root directory of this source tree.
520 */const kR=ye("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
521 * @license lucide-react v0.344.0 - ISC
522 *
523 * This source code is licensed under the ISC license.
524 * See the LICENSE file in the root directory of this source tree.
525 */const jU=ye("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
526 * @license lucide-react v0.344.0 - ISC
527 *
528 * This source code is licensed under the ISC license.
529 * See the LICENSE file in the root directory of this source tree.
530 */const AU=ye("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
531 * @license lucide-react v0.344.0 - ISC
532 *
533 * This source code is licensed under the ISC license.
534 * See the LICENSE file in the root directory of this source tree.
535 */const TU=ye("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a2.121 2.121 0 1 1 3 3L12 15l-4 1 1-4Z",key:"1lpok0"}]]);/**
536 * @license lucide-react v0.344.0 - ISC
537 *
538 * This source code is licensed under the ISC license.
539 * See the LICENSE file in the root directory of this source tree.
540 */const T_=ye("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
541 * @license lucide-react v0.344.0 - ISC
542 *
543 * This source code is licensed under the ISC license.
544 * See the LICENSE file in the root directory of this source tree.
545 */const DU=ye("SwitchCamera",[["path",{d:"M11 19H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5",key:"mtk2lu"}],["path",{d:"M13 5h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-5",key:"120jsl"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m18 22-3-3 3-3",key:"kgdoj7"}],["path",{d:"m6 2 3 3-3 3",key:"1fnbkv"}]]);/**
546 * @license lucide-react v0.344.0 - ISC
547 *
548 * This source code is licensed under the ISC license.
549 * See the LICENSE file in the root directory of this source tree.
550 */const Sn=ye("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}
550],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
551 * @license lucide-react v0.344.0 - ISC
552 *
553 * This source code is licensed under the ISC license.
554 * See the LICENSE file in the root directory of this source tree.
555 */const _u=ye("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);/**
556 * @license lucide-react v0.344.0 - ISC
557 *
558 * This source code is licensed under the ISC license.
559 * See the LICENSE file in the root directory of this source tree.
560 */const RU=ye("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/**
561 * @license lucide-react v0.344.0 - ISC
562 *
563 * This source code is licensed under the ISC license.
564 * See the LICENSE file in the root directory of this source tree.
565 */const iA=ye("Unlock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]]);/**
566 * @license lucide-react v0.344.0 - ISC
567 *
568 * This source code is licensed under the ISC license.
569 * See the LICENSE file in the root directory of this source tree.
570 */const PU=ye("UploadCloud",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M12 12v9",key:"192myk"}],["path",{d:"m16 16-4-4-4 4",key:"119tzi"}]]);/**
571 * @license lucide-react v0.344.0 - ISC
572 *
573 * This source code is licensed under the ISC license.
574 * See the LICENSE file in the root directory of this source tree.
575 */const Fn=ye("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
576 * @license lucide-react v0.344.0 - ISC
577 *
578 * This source code is licensed under the ISC license.
579 * See the LICENSE file in the root directory of this source tree.
580 */const IU=ye("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);/**
581 * @license lucide-react v0.344.0 - ISC
582 *
583 * This source code is licensed under the ISC license.
584 * See the LICENSE file in the root directory of this source tree.
585 */const Nu=ye("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/**
586 * @license lucide-react v0.344.0 - ISC
587 *
588 * This source code is licensed under the ISC license.
589 * See the LICENSE file in the root directory of this source tree.
590 */const LU=ye("UserX",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]);/**
591 * @license lucide-react v0.344.0 - ISC
592 *
593 * This source code is licensed under the ISC license.
594 * See the LICENSE file in the root directory of this source tree.
595 */const Wl=ye("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
596 * @license lucide-react v0.344.0 - ISC
597 *
598 * This source code is licensed under the ISC license.
599 * See the LICENSE file in the root directory of this source tree.
600 */const Ek=ye("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
601 * @license lucide-react v0.344.0 - ISC
602 *
603 * This source code is licensed under the ISC license.
604 * See the LICENSE file in the root directory of this source tree.
605 */const D_=ye("VideoOff",[["path",{d:"M10.66 6H14a2 2 0 0 1 2 2v2.34l1 1L22 8v8",key:"ubwiq0"}],["path",{d:"M16 16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2l10 10Z",key:"1l10zd"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/**
606 * @license lucide-react v0.344.0 - ISC
607 *
608 * This source code is licensed under the ISC license.
609 * See the LICENSE file in the root directory of this source tree.
610 */const vi=ye("Video",[["path",{d:"m22 8-6 4 6 4V8Z",key:"50v9me"}],["rect",{width:"14",height:"12",x:"2",y:"6",rx:"2",ry:"2",key:"1rqjg6"}]]);/**
611 * @license lucide-react v0.344.0 - ISC
612 *
613 * This source code is licensed under the ISC license.
614 * See the LICENSE file in the root directory of this source tree.
615 */const OU=ye("Wind",[["path",{d:"M17.7 7.7a2.5 2.5 0 1 1 1.8 4.3H2",key:"1k4u03"}
615],["path",{d:"M9.6 4.6A2 2 0 1 1 11 8H2",key:"b7d0fd"}],["path",{d:"M12.6 19.4A2 2 0 1 0 14 16H2",key:"1p5cb3"}]]);/**
616 * @license lucide-react v0.344.0 - ISC
617 *
618 * This source code is licensed under the ISC license.
619 * See the LICENSE file in the root directory of this source tree.
620 */const MU=ye("XCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
621 * @license lucide-react v0.344.0 - ISC
622 *
623 * This source code is licensed under the ISC license.
624 * See the LICENSE file in the root directory of this source tree.
625 */const tt=ye("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
626 * @license lucide-react v0.344.0 - ISC
627 *
628 * This source code is licensed under the ISC license.
629 * See the LICENSE file in the root directory of this source tree.
630 */const ki=ye("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),aA=[{label:"Home",path:"/"},{label:"News",path:"/news"},{label:"Perspectives",path:"/perspectives"},{label:"Sports",path:"/sports"},{label:"Community",path:"/community"},{label:"Obituaries",path:"/obituaries"},{label:"Public Notices",path:"/public-notices"},{label:"This Week's Pics",path:"/this-weeks-pics"},{label:"Digital Paper",path:"/digital-paper"},{label:"Subscriber Extras",path:"/subscriber-extras"},{label:"More",children:[{label:"About Us",path:"/about"},{label:"Contact",path:"/contact"},{label:"Advertise",path:"/advertise"},{label:"Subscribe",path:"/subscribe"}]}];function FU(){const[r,e]=k.useState(!1),[t,n]=k.useState(!1),[s,i]=k.useState(!1),[o,l]=k.useState(""),c=It(),u=Mg(),d=f=>{f.preventDefault(),o.trim()&&(u(`/news?q=${encodeURIComponent(o.trim())}`),i(!1),l(""))},h=f=>c.pathname===f;return a.jsxs("nav",{className:"bg-brand-black text-white sticky top-0 z-50 shadow-lg",children:[a.jsx("div",{className:"max-w-7xl mx-auto px-4",children:a.jsxs("div",{className:"flex items-center h-11",children:[a.jsx($e,{to:"/",className:"md:hidden font-masthead text-sm font-bold text-white tracking-wide mr-auto leading-none",children:"Dixie County Advocate"}),a.jsx("div",{className:"hidden md:flex items-center h-full flex-1",children:aA.map(f=>f.children?a.jsxs("div",{className:"relative h-full flex items-center",children:[a.jsxs("button",{onClick:()=>n(!t),onBlur:()=>setTimeout(()=>n(!1),150),className:"flex items-center gap-1 px-3 h-full text-sm font-medium text-gray-300 hover:text-white hover:bg-white/10 transition-colors",children:[f.label,a.jsx(Ws,{className:`w-3.5 h-3.5 transition-transform ${t?"rotate-180":""}`})]}),t&&a.jsx("div",{className:"absolute top-full left-0 w-40 bg-white text-brand-black shadow-xl rounded-b-lg overflow-hidden z-50",children:f.children.map(p=>a.jsx($e,{to:p.path,onClick:()=>n(!1),className:"block px-4 py-2.5 text-sm hover:bg-gray-50 hover:text-brand-red transition-colors font-medium",children:p.label},p.path))})]},"more"):a.jsx($e,{to:f.path,className:`px-3 h-full flex items-center text-sm font-medium transition-colors ${h(f.path)?"text-white border-b-2 border-brand-red":"text-gray-300 hover:text-white hover:bg-white/10"}`,children:f.label},f.path))}),a.jsx("button",{onClick:()=>i(!s),className:"p-2.5 text-gray-300 hover:text-white hover:bg-white/10 rounded transition-colors md:ml-auto","aria-label":"Search",children:a.jsx(nf,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>e(!r),className:"md:hidden bg-brand-red hover:bg-brand-red-dark text-white text-xs font-bold uppercase tracking-wider px-3 py-1.5 rounded transition-colors","aria-label":"Menu",children:r?"Close":"Menu"})]})}),s&&a.jsx("div",{className:"border-t border-white/10 bg-brand-black/95",children:a.jsx("div",{className:"max-w-7xl mx-auto px-4 py-3",children:a.jsxs("form",{onSubmit:d,className:"flex gap-2",children:[a.jsx("input",{autoFocus:!0,t
630ype:"text",value:o,onChange:f=>l(f.target.value),placeholder:"Search stories, topics...",className:"flex-1 bg-white/10 border border-white/20 text-white placeholder-gray-400 rounded px-4 py-2 text-sm focus:outline-none focus:border-white/40"}),a.jsx("button",{type:"submit",className:"bg-brand-red hover:bg-brand-red-dark text-white px-5 py-2 rounded text-sm font-semibold transition-colors",children:"Search"})]})})}),r&&a.jsx("div",{className:"md:hidden border-t border-white/10",children:aA.map(f=>f.children?a.jsxs("div",{children:[a.jsx("div",{className:"px-4 py-1 text-xs font-semibold text-gray-500 uppercase tracking-widest mt-2",children:"More"}),f.children.map(p=>a.jsx($e,{to:p.path,onClick:()=>e(!1),className:"block px-6 py-3 text-sm text-gray-300 hover:text-white hover:bg-white/10 transition-colors",children:p.label},p.path))]},"more"):a.jsx($e,{to:f.path,onClick:()=>e(!1),className:`block px-4 py-3 text-sm font-medium border-b border-white/5 transition-colors ${h(f.path)?"text-white bg-brand-red":"text-gray-300 hover:text-white hover:bg-white/10"}`,children:f.label},f.path))})]})}const Br=[{id:"1",title:"County Commission Approves $4.2 Million Road Resurfacing Package",slug:"county-commission-road-resurfacing-2026",excerpt:"The Dixie County Board of County Commissioners unanimously approved a $4.2 million road resurfacing project that will improve 23 miles of rural county roads over the next 18 months.",content:`<p>The Dixie County Board of County Commissioners unanimously approved a $4.2 million road resurfacing project Tuesday that will bring improvements to 23 miles of rural county roads, many of which have not seen major maintenance work in more than a decade.</p>
631
632<p>County Engineer David Strickland presented the project scope, explaining that the roads were selected based on a pavement condition index survey completed earlier this year. "We prioritized the roads with the worst deterioration that also carry the highest daily traffic counts," Strickland told commissioners during the regular meeting at the Dixie County Courthouse.</p>
633
634<p>The project will be funded through a combination of the county's road and bridge millage fund and a State Revenue Sharing grant of $1.1 million that Commissioner Barbara Hawkins secured earlier this year. Hawkins said the grant required the county to match funds, which motivated the commission to act quickly.</p>
635
636<p>"Our residents deserve safe roads to travel on, and this is a major step toward delivering that," said Board Chairman Tom Ellis. "We've been working toward this for three years."</p>
637
638<p>Work is expected to begin in October after the summer rainy season. The county will issue an Invitation to Bid next month for qualified paving contractors. The project is scheduled for completion by spring 2028.</p>
639
640<p>Roads included in the project span all three commission districts and include portions of SE Road 349, CR 340, and several connector roads in the Suwannee and Old Town areas.</p>`,author:"Staff Reporter",category:"local",published_at:"2026-06-02T08:00:00Z",published:!0,featured:!0,is_breaking:!0,image_url:"https://images.pexels.com/photos/1029635/pexels-photo-1029635.jpeg?auto=compress&cs=tinysrgb&w=1200",views:412,created_at:"2026-06-02T08:00:00Z"},{id:"3",title:"Suwannee River Levels Rising; Flood Watch in Effect for Lower Basin",slug:"suwannee-river-flood-watch-june-2026",excerpt:"Heavy rainfall over the past two weeks has pushed the Suwannee River above flood stage at the Wilcox gauge. Emergency management officials are monitoring the situation closely.",content:`<p>Heavy and persistent rainfall over the past two weeks has pushed the Suwannee River above flood stage at several monitoring stations, prompting the National Weather Service to issue a Flood Watch for portions of Dixie and Levy counties.</p>
641
642<p>As of Tuesday morning, the river was measured at 72.4 feet at the Wilcox gauge, nearly two feet above the 70.5-foot flood stage. The NWS forecasts the river will crest near 74.5 feet later this week before beginning a gradual recession.</p>
643
644<p>Dixie County Emergency Management Director Sandra Collins said her team activated the county's flood response protocol Monday. "We're asking residents in low-lying areas along the river — particularly in the Suwannee, Jena, and Rock Bluff areas — to move valuables and vehicles to higher ground as a precaution," Collins said.</p>
645
646<p>Several low-water crossings are already closed, including portions of C
646R 349 near Suwannee and SE 97th Drive near Jena. Motorists are urged to use alternate routes and to never attempt to drive through flooded roads.</p>
647
648<p>The county has opened a sandbag distribution point at the Cross City Public Works Department, located at 301 NE 340 Highway. Sandbags are available to county residents free of charge. Staff will be on site from 7 a.m. to 5 p.m. Monday through Saturday.</p>
649
650<p>Residents can monitor river levels at water.weather.gov or sign up for Dixie County emergency alerts at dixiecountyfl.gov/alerts.</p>`,author:"Sarah Mitchell",category:"local",published_at:"2026-06-02T06:30:00Z",published:!0,featured:!1,is_breaking:!0,image_url:"https://images.pexels.com/photos/1020016/pexels-photo-1020016.jpeg?auto=compress&cs=tinysrgb&w=1200",views:298,created_at:"2026-06-02T06:30:00Z"},{id:"4",title:"Cross City Business Owner Named Florida Small Business Person of the Year",slug:"cross-city-small-business-person-year",excerpt:'Patricia "Patty" Rivers, owner of Rivers Family Hardware on US 19, has been named the Florida Small Business Person of the Year by the U.S. Small Business Administration.',content:`<p>Patricia "Patty" Rivers, who has operated Rivers Family Hardware on US Highway 19 in Cross City for 22 years, has been named the Florida Small Business Person of the Year by the United States Small Business Administration.</p>
651
652<p>Rivers, 54, will travel to Washington, D.C. in September to represent Florida at the national SBA ceremony, where a national winner will be named from among the 50 state honorees.</p>
653
654<p>The SBA recognized Rivers for building her hardware store from a small operation with two employees into a community anchor with 14 full-time staff members. Rivers also mentors young entrepreneurs through the Dixie County Chamber of Commerce and has helped launch three other locally-owned businesses in the past decade.</p>
655
656<p>"This is really an award for this whole community," Rivers said when reached by phone Tuesday. "My customers, my employees, my family — they built this store as much as I did. Dixie County people are loyal people, and that has made all the difference."</p>
657
658<p>Rivers expanded the store in 2019 to add a rental equipment department and a farm supply section. Despite the expansion of a national hardware chain in the Chiefland area, Rivers said staying community-focused has been her competitive advantage.</p>
659
660<p>County Commissioner Barbara Hawkins praised the recognition. "Patty Rivers is exactly the kind of entrepreneur who makes small communities thrive. We're incredibly proud of her," Hawkins said.</p>`,author:"Lisa Crawford",category:"local",published_at:"2026-05-31T09:00:00Z",published:!0,featured:!1,is_breaking:!1,image_url:"https://images.pexels.com/photos/1267338/pexels-photo-1267338.jpeg?auto=compress&cs=tinysrgb&w=1200",views:244,created_at:"2026-05-31T09:00:00Z"},{id:"6",title:"Annual Suwannee River Cleanup Draws Over 400 Volunteers",slug:"suwannee-river-cleanup-record-volunteers",excerpt:"More than 400 volunteers joined the 18th Annual Suwannee River Cleanup effort last weekend, removing an estimated 6,800 pounds of trash and debris from 14 miles of the iconic river.",content:`<p>More than 400 volunteers — a record turnout — joined the 18th Annual Suwannee River Cleanup effort last weekend, collecting an estimated 6,800 pounds of trash, debris, and abandoned equipment from 14 miles of riverbank stretching from Suwannee Springs to the Manatee Springs area.</p>
661
662<p>The cleanup, organized by the Suwannee River Water Management District in partnership with Dixie County, drew participants ranging from elementary school children to retirees in their 80s. Eight local civic organizations, four churches, and a contingent of National Guard troops assisted with the effort.</p>
663
664<p>"This river is the heart of our community. Taking care of it is everyone's responsibility, and the people of North Florida have responded beautifully," said cleanup coordinator Ellen James of the Water Management District.</p>
665
666<p>Volunteers worked in teams using kayaks, canoes, and wading gear to access trash concentrated in backwater areas and along banks where flooding had deposited debris. Among the items recovered were dozens of tires, abandoned fishing gear, and several large appliances that had been illegally dumped.</p>
667
668<p>The Suwannee River Wilderness Trail, a 207-mile paddling trail that draws thousands of visitors to the region each year, depends on volunteer maintenance efforts like this one to remain accessible and welcoming.</p>
669
670<p>Next year's cleanup is being planned for late April. Organizations interested in participating can contact the Water Management District at suwanneeriverkeeper.org.</p>`,author:"Lisa Crawford",category:"community",published_at:"2026-05-29T08:00:00Z",published:!0,featured:!1,is_breaking:!1,image_url:"https://images.pexels.com/photos/1020016/pexels-photo-1020016.jpeg?auto=compress&cs=tinysrgb&w=800",views:189,created_at:"2026-05-29T08:00:00Z"},{id:"7",title:"Dixie County Schools Post Best Graduation Rate in District History",slug:"dixie-county-schools-graduation-rate-record",excerpt:"Dixie County Public Schools announced this week that the district's graduation rate reached 89.2 percent for the 2025-26 school year — the highest in the district's recorded history.",content:`<p>Dixie County Public Schools announced Tuesday that the district's graduation rate climbed to 89.2 percent for the 2025-26 school year, the highest figure in the district's recorded history and a full five percentage points above the state average for rural school districts.</p>
671
672<p>Superintendent Dr. Angela Brooks credited expanded mentoring programs, a new credit recovery initiative, and increased family engagement as key factors. "Every single one of these graduates represents teachers who refused to give up and families who stayed committed," Brooks said at a school board meeting Monday night.</p>
673
674<p>The district also reported that 72 percent of third-grade students tested at grade level in reading, up from 61 percent three years ago. The improvement has been attributed in part to a literacy coaching program funded by a state grant.</p>
675
676<p>Dixie County High School principal Marcus Williams said the school's culture has shifted toward celebrating academic achievement alongside athletic success. "Our students are seeing that education opens doors, and our community has made a real commitment to supp
676orting them," Williams said.</p>
677
678<p>Graduation ceremonies for the Class of 2026 will be held Friday, June 5, at 7 p.m. in the Dixie County High School gymnasium. The public is invited to attend.</p>`,author:"Sarah Mitchell",category:"local",published_at:"2026-05-28T09:00:00Z",published:!0,featured:!1,is_breaking:!1,image_url:"https://images.pexels.com/photos/256490/pexels-photo-256490.jpeg?auto=compress&cs=tinysrgb&w=1200",views:201,created_at:"2026-05-28T09:00:00Z"},{id:"8",title:"Annual Fish Camp Fishing Tournament Raises $18,000 for Youth Programs",slug:"fish-camp-tournament-raises-18000",excerpt:"The 14th Annual Suwannee Fish Camp Classic brought 120 two-person teams to the river last weekend, raising $18,000 for Dixie County youth recreational programs.",content:`<p>The 14th Annual Suwannee Fish Camp Classic fishing tournament concluded Sunday with a total of $18,000 raised for Dixie County youth recreational programs — a record for the event that has grown steadily since its founding in 2012.</p>
679
680<p>One hundred twenty two-person teams competed across the two-day event, targeting largemouth bass in the Suwannee River and its connected lakes and backwaters. The winning team of Cody Barrett and his father Dale Barrett weighed in a five-fish limit of 22.4 pounds to take top honors and a $3,500 prize.</p>
681
682<p>"We've been fishing this river our whole lives and there's nothing better than competing right here at home," said Cody Barrett, 19, a recent Dixie County High School graduate.</p>
683
684<p>Tournament director Mike Holloway said proceeds will be split between the Dixie County Little League and the county's after-school recreation program. "These programs give our kids something positive to do and build community," Holloway said. "The fishermen of this area have been incredibly generous."</p>
685
686<p>Registration for next year's tournament opens in January. Information is available at dixiecountyfishingclub.org.</p>`,author:"Staff Reporter",category:"community",published_at:"2026-05-27T10:00:00Z",published:!0,featured:!1,is_breaking:!1,image_url:"https://images.pexels.com/photos/954654/pexels-photo-954654.jpeg?auto=compress&cs=tinysrgb&w=1200",views:167,created_at:"2026-05-27T10:00:00Z"},{id:"9",title:"County Launches New Countywide Emergency Alert System",slug:"dixie-county-emergency-alert-system",excerpt:"Dixie County has gone live with a new emergency notification system that allows officials to send targeted alerts to residents by geographic zone, phone, email, or text message.",content:`<p>Dixie County has activated a new countywide emergency notification system that allows officials to push targeted alerts to residents by phone call, text message, and email, including the ability to target specific geographic areas affected by emergencies.</p>
687
688<p>Emergency Management Director Sandra Collins demonstrated the new system at a press briefing Tuesday. The system, called Rave Alert, was purchased using a Federal Emergency Management Agency Hazard Mitigation Grant that required no local match.</p>
689
690<p>"For the first time, we can send a flood warning specifically to residents in the Suwannee basin without alarming everyone on the other side of the county," Collins said. "That's a game-changer for how we communicate during events."</p>
691
692<p>Residents are encouraged to register their cell phone numbers and email addresses in the system, which is accessible at dixiecountyfl.gov/alerts. Landline phone numbers already in the county's 911 database are automatically enrolled.</p>
693
694<p>The county tested the system Tuesday with a countywide test message. Residents who did not receive the test message are urged to register their contact information online or call the Dixie County Emergency Management office at (352) 498-1200.</p>`,author:"Sarah Mitchell",category:"local",published_at:"2026-05-26T11:00:00Z",published:!0,featured:!1,is_breaking:!1,image_url:"https://images.pexels.com/photos/280076/pexels-photo-280076.jpeg?auto=compress&cs=tinysrgb&w=1200",views:143,created_at:"2026-05-26T11:00:00Z"},{id:"10",title:"Opinion: The Advocate Stands for Open Government in Dixie County",slug:"editorial-open-government-dixie-county",excerpt:"As your community newspaper for more than a century, The Advocate believes that transparent government is the cornerstone of a healthy democracy — and we will always champion that principle.",content:`<p>For 105 years, The Dixie County Advocate has been the community's w
694atchdog — attending every commission meeting, covering every election, and ensuring that the residents of this county have access to the information that affects their daily lives.</p>
695
696<p>That mission has never changed, and it never will.</p>
697
698<p>This week, a commissioner suggested that the board consider moving certain committee meetings to a building without adequate public parking, limiting who can practically attend. We want to be clear: The Advocate opposes any action that makes it harder for citizens to participate in their government, whether through inconvenience, lack of notice, or any other means.</p>
699
700<p>Florida's Government in the Sunshine Law is among the strongest open meetings laws in the nation. The people of Dixie County have a right to see their government work — and to hold it accountable when it doesn't.</p>
701
702<p>We call on the Board of County Commissioners to recommit to the principle of accessible government. Hold your meetings in accessible locations. Provide adequate notice. Welcome your constituents, even when they come with hard questions.</p>
703
704<p>That is the bargain of public service, and the people of Dixie County deserve nothing less.</p>
705
706<p><em>— The Editors</em></p>`,author:"The Editorial Board",category:"opinion",published_at:"2026-05-25T08:00:00Z",published:!0,featured:!1,is_breaking:!1,image_url:"https://images.pexels.com/photos/1550337/pexels-photo-1550337.jpeg?auto=compress&cs=tinysrgb&w=1200",views:298,created_at:"2026-05-25T08:00:00Z"}],Mw=[{id:"o1",name:'John "Buck" Henderson',birth_date:"1939-03-15",death_date:"2026-05-28",body:`John "Buck" Henderson, 87, of Cross City, passed away peacefully on May 28, 2026, surrounded by his loving family at his home on the Suwannee River.
707
708Born March 15, 1939, in Dixie County, Buck was the son of James Earl and Ruth Ann Henderson. He attended Dixie County High School where he played football and baseball, and after graduation farmed the land his family had worked for three generations.
709
710Buck was a fixture at the Dixie County Farmers Market for over 40 years, where he sold vegetables, watermelons, and the pecans he was famous for. He served on the Dixie County Agricultural Advisory Board for two decades and was a longtime member of the First Baptist Church of Cross City.
711
712He is survived by his wife of 62 years, Doris Jean Henderson; three children, James Henderson of Gainesville, Sandra Combs of Cross City, and Bobby Henderson of Chiefland; seven grandchildren; and four great-grandchildren.
713
714Funeral services will be held Saturday, June 7, at 11 a.m. at First Baptist Church of Cross City.`,submitted_at:"2026-05-29T10:00:00Z",is_published:!0},{id:"o2",name:"Mary Elizabeth Tanner",birth_date:"1953-07-22",death_date:"2026-05-30",body:`Mary Elizabeth Tanner, 72, beloved wife, mother, and educator, passed away on May 30, 2026, after a brief illness.
715
716Mary spent 35 years teaching fourth grade at Cross City Elementary School, where she was known for her patient instruction and her dedication to ensuring every child learned to love reading. She was named Dixie County Teacher of the Year four times.
717
718Outside of teaching, Mary was an avid gardener and an accomplished quilter. She is survived by her husband of 48 years, Gerald Tanner; two daughters, Patricia Moore and Carolyn Tanner; five grandchildren; and one great-grandchild.
719
720A celebration of life service will be held Sunday, June 8, at 2 p.m. at Cross City United Methodist Church.`,submitted_at:"2026-05-31T09:00:00Z",is_published:!0},{id:"o3",name:'Robert "Bobby" Goodwin',birth_date:"1961-11-04",death_date:"2026-05-25",body:`Robert "Bobby" Goodwin, 64, of Horseshoe Beach, died unexpectedly on May 25, 2026. Bobby moved to Horseshoe Beach in 1988 and operated Goodwin's Marine Service for over 30 years, providing boat repair, fuel, and supplies to the fishing community.
721
722He was a commercial fisherman in his younger years and never lost his love for the Gulf of Mexico. Bobby is survived by his wife, Linda Goodwin; son, Tyler Goodwin; daughter, Ashley Raines; three grandchildren; and siblings Dale Goodwin and Connie Mathews.
723
724Services will be private. A public celebration of life will be announced at a later date.`,submitted_at:"2026-05-26T14:00:00Z",is_published:!0}],Fw=[{id:"e1",title:"County Commission Regular Meeting",description:"The Dixie County Board of County Commissioners regular monthly meeting. Public comment welcome.",event_date:"2026-06-10T09:00:00Z",location:"Dixie County Courthouse, Cross City",submitted_by:"Dixie County BCC",created_at:"2026-06-01T00:00:00Z"},{id:"e2",title:"Community Blood Drive",description:"OneBlood community blood drive. Walk-ins welcome. All blood types needed.",event_date:"2026-06-20T09:00:00Z",location:"Cross City Recreation Center",submitted_by:"OneBlood",created_at:"2026-06-01T00:00:00Z"},{id:"e3",title:"Fourth of July Parade & Fireworks",description:"Annual Independence Day celebration with parade, picnic, and fireworks over the Suwannee River.",event_date:"2026-07-04T10:00:00Z",location:"Downtown Cross City / Suwannee River",submitted_by:"Dixie County Recreation Dept.",created_at:"2026-06-01T00:00:00Z"},{id:"e4",title:"Suwannee River Folk & Heritage Festival",description:"Annual celebration of Suwannee River history featuring live music, crafts, canoe tours, and local food.",event_date:"2026-08-15T09:00:00Z",location:"Fanning Springs State Park",submitted_by:"Heritage Festival Committee",created_at:"2026-06-01T00:00:00Z"},{id:"e5",title:"62nd Annual Dixie County Fair",description:"Livestock competitions, 4-H exhibits, carnival rides, live entertainment, and traditional fair food.",event_date:"2026-10-03T12:00:00Z",location:"Dixie County Fairgrounds, 
724Cross City",submitted_by:"Dixie County Fair Association",created_at:"2026-06-01T00:00:00Z"},{id:"e6",title:"Senior Center Bingo Night",description:"Weekly bingo for adults 55+. Light refreshments provided.",event_date:"2026-06-12T18:00:00Z",location:"Dixie County Senior Center, Old Town",submitted_by:"Dixie County Senior Services",created_at:"2026-06-01T00:00:00Z"}],py=[{id:"n1",title:"NOTICE OF PUBLIC HEARING — Comprehensive Plan Amendment CPA-2026-01",content:`NOTICE IS HEREBY GIVEN that the Dixie County Board of County Commissioners will hold a Public Hearing on Tuesday, June 23, 2026, at 9:00 A.M. in the Board of County Commissioners Meeting Room, 214 NE 351 Highway, Cross City, Florida 32628, to consider adoption of Comprehensive Plan Amendment CPA-2026-01.
725
726The proposed amendment would change the Future Land Use designation of approximately 47.3 acres (Parcel ID: 14-11-13-0000-0004-0010) from Rural Residential (RR) to Mixed Use Commercial (MUC).
727
728All interested parties are invited to be heard. Written comments may be submitted to the Dixie County Planning Department no later than June 22, 2026.
729
730For additional information, contact (352) 498-1200.`,notice_type:"hearing",published_at:"2026-06-01T08:00:00Z",expiry_date:"2026-06-23",published:!0},{id:"n2",title:"INVITATION TO BID — Road Resurfacing Project No. 2026-R-04",content:`The Dixie County Board of County Commissioners invites sealed bids from qualified contractors for Road Resurfacing Project No. 2026-R-04, which includes resurfacing of approximately 8.4 lane miles of county roads.
731
732Bid documents are available at the Dixie County Public Works Department or at dixiecountyfl.gov/bids. A non-mandatory pre-bid meeting will be held June 17, 2026, at 10:00 A.M.
733
734Sealed bids must be received no later than 2:00 P.M. on July 1, 2026, at the Office of the County Clerk, 214 NE 351 Hwy, Cross City, FL 32628.
735
736Dixie County reserves the right to reject any and all bids.`,notice_type:"bid",published_at:"2026-06-02T08:00:00Z",expiry_date:"2026-07-01",published:!0},{id:"n3",title:"NOTICE OF TAX DEED APPLICATION — Parcel ID 31-09-13-0000-0021-0070",content:`NOTICE IS HEREBY GIVEN that on the 15th day of July, 2026, at 11:00 A.M., the Clerk of the Circuit Court of Dixie County, Florida, will offer for sale at public auction the following property to satisfy a Tax Deed Application:
737
738Legal Description: Lot 7, Block 21, HORSESHOE BEACH UNIT 3, Plat Book 4, Page 19, Public Records of Dixie County, Florida.
739
740Property Address: 117 NW 5th Ave, Horseshoe Beach, FL 32648.
741
742The successful bidder must pay the amount of the bid by cash or certified check at time of sale.
743
744For more information contact the Dixie County Clerk of Courts at (352) 498-1200.`,notice_type:"legal",published_at:"2026-06-02T08:00:00Z",expiry_date:"2026-07-15",published:!0}];function sf(r){var t,n,s,i;const e=(t=r.images)==null?void 0:t.find(o=>o.position==="top");return{id:r.id,title:r.title,slug:r.slug||r.id,content:r.body,excerpt:r.body.slice(0,160).replace(/\n/g," "),author:r.author,category:r.category??"local",category_id:null,categories:null,published_at:r.created_at,published:r.published,featured:r.featured??!1,is_breaking:!1,image_url:(e==null?void 0:e.url)??r.image_url,image_focal_point:(e==null?void 0:e.focal_point)??((s=(n=r.images)==null?void 0:n[0])==null?void 0:s.focal_point),story_images:(i=r.images)!=null&&i.length?r.images:void 0,views:0,created_at:r.created_at,updated_at:r.updated_at}}async function oA(r=20){if(!je||!Y)return[];try{const{data:e}=await Y.from("stories").select("*").eq("published",!0).order("created_at",{ascending:!1}).limit(r);return(e??[]).map(sf)}catch{return[]}}async function lA(r,e=12){if(!je||!Y)return[];try{const{data:t}=await Y.from("stories").select("*").eq("published",!0).eq("category",r).order("sort_order",{ascending:!0,nullsFirst:!1}).order("created_at",{ascending:!1}).limit(e);return(t??[]).map(sf)}catch{return[]}}async function CR(r=20){if(!je||!Y)return Br.slice(0,r);try{const{data:e,error:t}=await Y.from("articles").select("*").eq("published",!0).order("published_at",{ascending:!1}).limit(r);if(t)throw t;if(e!=null&&e.length)return e;const n=await oA(r);return n.length?n:Br.slice(0,r)}catch{const e=await oA(r);return e.length?e:Br.slice(0,r)}}async function jk(r){if(!je||!Y){const e=Br.filter(t=>t.category===r);return e.find(t=>t.featured)??e[Math.floor(Math.random()*e.length)]??null}try{const{data:e}=await Y.from("articles").select("*").eq("published",!0).eq("category",r).eq("featured",!0).order("published_at",{ascending:!1}).limit(1).maybeSingle();if(e)return e;const{data:t}=await Y.from("stories").select("*").eq("published",!0).eq("category",r).eq("featured",!0).order("created_at",{ascending:!1}).limit(1).maybeSingle();if(t)return sf(t);const n=await Rl(r,50);return n.length?n[Math.floor(Math.random()*n.length)]:null}catch{const e=await Rl(r,50);return e.length?e[Math.floor(Math.random()*e.length)]:null}}async function BU(){try{const{data:r}=await Y.from("articles").select("id, title, slug").eq("published",!0).eq("is_breaking",!0).order("published_at",{ascending:!1}).limit(5);return r!=null&&r.length?r:Br.filter(e=>e.is_breaking)}catch{return Br.filter(r=>r.is_breaking)}}async function Rl(r,e=12){if(!je||!Y)return Br.filter(t=>t.category===r).slice(0,e);try{const{data:t}=await Y.from("articles").select("*").eq("published",!0).eq("category",r).order("sort_order",{ascending:!0,nullsFirst:!1}).order("published_at",{ascending:!1}).limit(e);
744if(t!=null&&t.length)return t;const n=await lA(r,e);return n.length?n:Br.filter(s=>s.category===r).slice(0,e)}catch{const t=await lA(r,e);return t.length?t:Br.filter(n=>n.category===r).slice(0,e)}}async function $U(r){if(!je||!Y)return Br.find(e=>e.slug===r)??null;try{const{data:e,error:t}=await Y.from("articles").select("*").eq("slug",r).eq("published",!0).maybeSingle();if(t)throw new Error(t.message);if(e)return e;const{data:n}=await Y.from("stories").select("*").eq("published",!0).eq("slug",r).maybeSingle();if(n)return sf(n);const{data:s}=await Y.from("stories").select("*").eq("id",r).eq("published",!0).maybeSingle();return s?sf(s):Br.find(o=>o.slug===r)??null}catch{return null}}async function ER(r){const e=r.toLowerCase();if(!je||!Y)return Br.filter(t=>t.title.toLowerCase().includes(e)||t.excerpt.toLowerCase().includes(e));try{const[{data:t},n]=await Promise.all([Y.from("articles").select("*").eq("published",!0).or(`title.ilike.%${r}%,excerpt.ilike.%${r}%`).order("published_at",{ascending:!1}).limit(20),Y.from("stories").select("*").eq("published",!0).or(`title.ilike.%${r}%,body.ilike.%${r}%`).order("created_at",{ascending:!1}).limit(20)]),s=t??[],i=(n.data??[]).map(sf),o=[...s,...i].sort((l,c)=>new Date(c.published_at).getTime()-new Date(l.published_at).getTime());return o.length?o:Br.filter(l=>l.title.toLowerCase().includes(e)||l.excerpt.toLowerCase().includes(e))}catch{return Br.filter(t=>t.title.toLowerCase().includes(e)||t.excerpt.toLowerCase().includes(e))}}async function UU(){if(!je||!Y)return Mw;try{const{data:r}=await Y.from("obituaries").select("*").eq("is_published",!0).order("submitted_at",{ascending:!1});return r!=null&&r.length?r:Mw}catch{return Mw}}async function HU(){if(!je||!Y)return Fw;try{const{data:r}=await Y.from("events").select("*").gte("event_date",new Date().toISOString()).order("event_date",{ascending:!0});return r!=null&&r.length?r:Fw}catch{return Fw}}async function zU(){if(!je||!Y)return py;try{const{data:r}=await Y.from("public_notices").select("*").eq("published",!0).order("published_at",{ascending:!1});return r!=null&&r.length?r:py}catch{return py}}async function qU(){if(!je||!Y)return Br;try{const{data:r}=await Y.from("articles").select("*").order("created_at",{ascending:!1});return r!=null&&r.length?r:Br}catch{return Br}}async function WU(r){if(!je||!Y)return{error:null};const e=new Date().toISOString();try{if(r.id){const{id:t,created_at:n,published_at:s,...i}=r,{data:o,error:l}=await Y.from("articles").update({...i,updated_at:e}).eq("id",t).select();return l?{error:l.message}:!o||o.length===0?{error:"Update failed — no rows matched. Check your permissions."}:{error:null}}else{const{error:t}=await Y.from("articles").insert({...r,published_at:e,created_at:e,updated_at:e});return{error:(t==null?void 0:t.message)??null}}}catch{return{error:"Save failed."}}}async function VU(r){!je||!Y||await Y.from("articles").delete().eq("id",r)}async function GU(){if(!je||!Y)return[];try{const{data:r,error:e}=await Y.from("ads").select("*").order("created_at",{ascending:!1});if(e)throw new Error(e.message);return r??[]}catch{return[]}}function cA(r,e){const t=r.length,n=new Array(t).fill(null),s=r.filter(d=>d.rotation_lock_position!==null),i=r.filter(d=>d.rotation_lock_position===null);for(const d of s){const h=((d.rotation_lock_position-1)%t+t)%t;n[h]=d.ad}const o=[...i.map(d=>d.ad)],l=e%(o.length||1),c=[...o.slice(l),...o.slice(0,l)];let u=0;for(let d=0;d<t;d++)n[d]===null&&u<c.length&&(n[d]=c[u++]);return n.filter(d=>d!==null)}async function jR(r,e){if(!je||!Y)return[];const t=new Date().toISOString().slice(0,10);if(e)try{const{data:n}=await Y.from("ad_pages").select("id, sidebar_rotation, leaderboard_weekly_rotation").eq("path",e).maybeSingle();if(n!=null&&n.id){const{data:s,error:i}=await Y.from("ad_placements").select("position, rotation_lock_position, ad:ads(*)").eq("page_id",n.id).eq("zone",r).order("position",{ascending:!0});if(!i){const o=(s??[]).filter(l=>l.ad.active&&(!l.ad.start_date||l.ad.start_date<=t)&&(!l.ad.end_date||l.ad.end_date>=t));if(r==="sidebar"&&n.sidebar_rotation&&o.length>1){const c=Math.floor(Date.now()/18e5)%o.length;return cA(o,c)}if(r==="leaderboard"&&n.leaderboard_weekly_rotation&&o.length>1){const l=new Date,c=new Date(l),u=l.getDay();c.setDate(l.getDate()-(u+6)%7),c.setHours(0,0,0,0);
744const h=Math.floor(c.getTime()/(7*24*60*60*1e3))%o.length;return cA(o,h)}return o.map(l=>l.ad)}}}catch{}try{const{data:n}=await Y.from("ads").select("*").eq("zone",r).eq("active",!0).order("created_at",{ascending:!1}),i=(n??[]).filter(o=>(!o.start_date||o.start_date<=t)&&(!o.end_date||o.end_date>=t));return e?i.filter(o=>{var l;return!((l=o.pages)!=null&&l.length)||o.pages.includes(e)}):i}catch{return[]}}async function AR(r){if(!je||!Y)return{error:null};const e=new Date().toISOString();try{if(r.id){const{id:t,created_at:n,...s}=r,{error:i}=await Y.from("ads").update({...s,updated_at:e}).eq("id",t);return i?{error:i.message}:{error:null}}else{const{error:t}=await Y.from("ads").insert({...r,created_at:e,updated_at:e});return t?{error:t.message}:{error:null}}}catch(t){return{error:t instanceof Error?t.message:"Save failed."}}}async function XU(r){!je||!Y||await Y.from("ads").delete().eq("id",r)}async function YU(r,e){if(!(!je||!Y))try{await Y.rpc("increment_ad_impressions",{ad_id:r})}catch{}}async function uA(r,e){if(!(!je||!Y))try{await Y.rpc("increment_ad_clicks",{ad_id:r})}catch{}}async function KU(){if(!je||!Y)return py;try{const{data:r,error:e}=await Y.from("public_notices").select("*").order("created_at",{ascending:!1});if(e)throw new Error(e.message);return r??[]}catch{return[]}}async function dA(r){if(!je||!Y)return{error:null,id:null};const e=new Date().toISOString();try{if(r.id){const{id:t,created_at:n,published_at:s,...i}=r,{error:o}=await Y.from("public_notices").update(i).eq("id",t);return{error:(o==null?void 0:o.message)??null,id:t}}else{const{data:t,error:n}=await Y.from("public_notices").insert({...r,published_at:e,created_at:e}).select("id").maybeSingle();return{error:(n==null?void 0:n.message)??null,id:(t==null?void 0:t.id)??null}}}catch(t){return{error:t instanceof Error?t.message:"Save failed.",id:null}}}async function JU(r){!je||!Y||await Y.from("public_notices").delete().eq("id",r)}async function hA(r,e){if(!Y)throw new Error("Supabase not configured");if(!ZU.includes(r.type))throw new Error("Unsupported format. Please upload JPG, PNG, WebP, or PDF.");if(r.size>Wg)throw new Error(`File too large (${(r.size/1024/1024).toFixed(1)} MB). Max 10 MB.`);const t=r.name.split(".").pop()??"jpg",n=`notices/${Date.now()}-${Math.random().toString(36).slice(2)}.${t}`;let s=null,i=0;e&&(e(0),s=setInterval(()=>{i=Math.min(i+15,85),e(i)},200));try{const{error:o}=await Y.storage.from("notice-images").upload(n,r,{upsert:!1,contentType:r.type});if(s&&clearInterval(s),e&&e(100),o)throw new Error(o.message);const{data:l}=Y.storage.from("notice-images").getPublicUrl(n);return l.publicUrl}catch(o){throw s&&clearInterval(s),o}}const Wx=["image/jpeg","image/png","image/webp"],ZU=["image/jpeg","image/png","image/webp","application/pdf"],Wg=10*1024*1024;async function TR(r,e){if(!Y)throw new Error("Supabase not configured");if(!Wx.includes(r.type))throw new Error("Unsupported format. Please upload JPG, PNG, or WebP.");if(r.size>Wg)throw new Error(`File too large (${(r.size/1024/1024).toFixed(1)} MB). Max 10 MB.`);const t=r.name.split(".").pop()??"jpg",n=`articles/${Date.now()}-${Math.random().toString(36).slice(2)}.${t}`;let s=null,i=0;e&&(e(0),s=setInterval(()=>{i=Math.min(i+15,85),e(i)},200));try{const{error:o}=await Y.storage.from("article-images").upload(n,r,{upsert:!1,contentType:r.type});if(s&&clearInterval(s),e&&e(100),o)throw new Error(o.message);const{data:l}=Y.storage.from("article-images").getPublicUrl(n);return l.publicUrl}catch(o){throw s&&clearInterval(s),o}}async function QU(r,e){if(!Y)throw new Error("Supabase not configured");if(!Wx.includes(r.type))throw new Error("Unsupported format. Please upload JPG, PNG, or WebP.");if(r.size>Wg)throw new Error(`File too large (${(r.size/1024/1024).toFixed(1)} MB). Max 10 MB.`);const t=r.name.split(".").pop()??"jpg",n=`ads/${Date.now()}-${Math.random().toString(36).slice(2)}.${t}`;let s=null,i=0;e&&(e(0),s=setInterval(()=>{i=Math.min(i+15,85),e(i)},200));try{const{error:o}=await Y.storage.from("article-images").upload(n,r,{upsert:!1,contentType:r.type});if(s&&clearInterval(s),e&&e(100),o)throw new Error(o.message);const{data:l}=Y.storage.from("article-images").getPublicUrl(n);return l.publicUrl}catch(o){throw s&&clearInterval(s),o}}async function Xs(r){if(!je||!Y)return{};try{const{data:e,error:t}=await Y.from("page_content").select("field_key, field_value").eq("page_id",r);
744if(t)return{};const n={};for(const s of e??[])n[s.field_key]=s.field_value;return n}catch{return{}}}async function eH(r,e){if(!je||!Y)return{error:null};const t=new Date().toISOString(),n=Object.entries(e).map(([s,i])=>({page_id:r,field_key:s,field_value:i,updated_at:t}));try{const{error:s}=await Y.from("page_content").upsert(n,{onConflict:"page_id,field_key"});return s?{error:s.message}:{error:null}}catch(s){return{error:s instanceof Error?s.message:"Save failed."}}}async function tH(){if(!je||!Y)return[];try{const{data:r,error:e}=await Y.from("ad_pages").select("*").order("sort_order",{ascending:!0});if(e)throw new Error(e.message);return r??[]}catch{return[]}}async function Bw(r){if(!je||!Y)return{error:null,data:null};try{if(r.id){const{id:e,created_at:t,...n}=r,{data:s,error:i}=await Y.from("ad_pages").update(n).eq("id",e).select().maybeSingle();return i?{error:i.message,data:null}:{error:null,data:s}}else{const{data:e,error:t}=await Y.from("ad_pages").insert(r).select().maybeSingle();return t?{error:t.message,data:null}:{error:null,data:e}}}catch(e){return{error:e instanceof Error?e.message:"Save failed.",data:null}}}async function rH(r){!je||!Y||await Y.from("ad_pages").delete().eq("id",r)}async function nH(r){if(!je||!Y)return[];try{const{data:e,error:t}=await Y.from("ad_placements").select("*, ad:ads(*)").eq("page_id",r).order("position",{ascending:!0});if(t)throw new Error(t.message);return e??[]}catch{return[]}}async function sH(r){if(!je||!Y)return{error:null};try{const{error:e}=await Y.from("ad_placements").insert(r);return e?{error:e.message}:{error:null}}catch(e){return{error:e instanceof Error?e.message:"Failed to add placement."}}}async function iH(r){!je||!Y||await Y.from("ad_placements").delete().eq("id",r)}async function fA(r){if(!je||!Y||r.length===0)return{error:null};try{return await Promise.all(r.map(({id:e,position:t})=>Y.from("ad_placements").update({position:t}).eq("id",e))),{error:null}}catch(e){return{error:e instanceof Error?e.message:"Failed to update positions."}}}async function aH(r,e){if(!je||!Y)return{error:null};try{const{error:t}=await Y.from("ad_placements").update({rotation_lock_position:e}).eq("id",r);return t?{error:t.message}:{error:null}}catch(t){return{error:t instanceof Error?t.message:"Failed to update lock."}}}async function Vx(r,e,t,n){if(!je||!Y)return{ok:!1,error:"Not configured."};try{const{error:s}=await Y.from("form_submissions").insert({form_type:r,sender_name:e,sender_email:t,data:n});if(s)throw new Error(s.message);return await fetch("https://rdyprhzjnqjauufyfqlp.supabase.co/functions/v1/send-contact-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJkeXByaHpqbnFqYXV1ZnlmcWxwIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODAzNDYzMDAsImV4cCI6MjA5NTkyMjMwMH0.zyA_fVB72pAmHui8m1UhJkK-R9yndy6nuLgyzLDvW04"},body:JSON.stringify({form_type:r,sender_name:e,sender_email:t,data:n,submission_id:void 0})}),{ok:!0}}
744catch(s){return{ok:!1,error:s instanceof Error?s.message:"Submission failed."}}}async function oH(r,e,t){if(!je||!Y)return{ok:!1,error:"Not configured."};try{let n="",s="";if(e){if(!["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/plain","application/rtf","image/jpeg","image/png","image/webp","image/gif"].includes(e.type))return{ok:!1,error:`Unsupported file format (${e.type||"unknown"}). Please upload PDF, DOC, DOCX, TXT, RTF, or image files.`};if(e.size>25*1024*1024)return{ok:!1,error:`File too large (${(e.size/1024/1024).toFixed(1)} MB). Max 25 MB.`};const l=e.name.split(".").pop()??"pdf";s=`public-notices/${Date.now()}-${Math.random().toString(36).slice(2)}.${l}`;let c=null,u=0;t&&(t(0),c=setInterval(()=>{u=Math.min(u+15,85),t(u)},200));try{const{error:d}=await Y.storage.from("public-notice-uploads").upload(s,e,{upsert:!1,contentType:e.type||"application/octet-stream"});if(c&&clearInterval(c),t&&t(100),d)throw new Error(d.message);const{data:h}=Y.storage.from("public-notice-uploads").getPublicUrl(s);n=h.publicUrl}catch(d){throw c&&clearInterval(c),d}}const i={"Law Firm or Requestor Name":r.lawFirm,"Contact Name":r.contactName,"Phone Number":r.phone,"Email Address":r.email,"Number of Weeks for Insertion":r.insertions,"Requested First Publication Date":r.firstPublicationDate,"Notice Text":r.noticeText};return n&&(i["Attached File"]=n,i["Attached File Name"]=e.name),Vx("public_notice",r.contactName,r.email,i)}catch(n){return{ok:!1,error:n instanceof Error?n.message:"Submission failed."}}}async function lH(r){if(!je||!Y||!r)return null;try{const{data:e}=await Y.from("image_focal_points").select("x, y, aspect_ratio").eq("image_key",r).maybeSingle();return e?{x:e.x,y:e.y,aspectRatio:e.aspect_ratio}:null}catch{return null}}async function cH(r,e){if(!(!je||!Y||!r))try{await Y.from("image_focal_points").upsert({image_key:r,x:e.x,y:e.y,aspect_ratio:e.aspectRatio??"16/9",updated_at:new Date().toISOString()},{onConflict:"image_key"})}catch{}}async function uH(){if(!je||!Y)return[];try{const{data:r,error:e}=await Y.from("events").select("*").order("event_date",{ascending:!0});if(e)throw new Error(e.message);return r??[]}catch{return[]}}async function dH(r){if(!je||!Y)return{error:null};const e=new Date().toISOString();try{if(r.id){const{id:t,created_at:n,...s}=r,{error:i}=await Y.from("events").update(s).eq("id",t);return{error:(i==null?void 0:i.message)??null}}else{const{error:t}=await Y.from("events").insert({...r,created_at:e});return{error:(t==null?void 0:t.message)??null}}}catch(t){return{error:t instanceof Error?t.message:"Save failed."}}}async function hH(r){!je||!Y||await Y.from("events").delete().eq("id",r)}async function DR(r,e){if(!je||!Y)return{error:null};try{const{error:t}=await Y.from("articles").update({is_breaking:e,updated_at:new Date().toISOString()}).eq("id",r);return{error:(t==null?void 0:t.message)??null}}catch(t){return{error:t instanceof Error?t.message:"Update failed."}}}async function fH(){if(!je||!Y)return[];try{const{data:r,error:e}=await Y.from("obituaries").select("*").order("submitted_at",{ascending:!1});if(e)throw new Error(e.message);return r??[]}catch{return[]}}async function pH(r){if(!je||!Y)return{error:null};const e=new Date().toISOString();try{if(r.id){const{id:t,submitted_at:n,...s}=r,{data:i,error:o}=await Y.from("obituaries").update({...s,updated_at:e}).eq("id",t).select();return o?{error:o.message}:!i||i.length===0?{error:"Update failed — no rows matched. Check your permissions."}:{error:null}}else{const{error:t}=await Y.from("obituaries").insert({...r,submitted_at:e,updated_at:e});return{error:(t==null?void 0:t.message)??null}}}catch(t){return{error:t instanceof Error?t.message:"Save failed."}}}async function mH(r){!je||!Y||await Y.from("obituaries").delete().eq("id",r)}async function gH(r,e){if(!Y)throw new Error("Supabase not configured");if(!Wx.includes(r.type))throw new Error("Unsupported format. Please upload JPG, PNG, or WebP.");if(r.size>Wg)throw new Error(`File too large (${(r.size/1024/1024).toFixed(1)} MB). Max 10 MB.`);const t=r.name.split(".").pop()??"jpg",n=`staff/${Date.now()}-${Math.random().toString(36).slice(2)}.${t}`;let s=null,i=0;e&&(e(0),s=setInterval(()=>{i=Math.min(i+15,85),e(i)},200));try{const{error:o}=await Y.storage.from("article-images").upload(n,r,{upsert:!1,contentType:r.type});if(s&&clearInterval(s),e&&e(100),o)throw new Error(o.message);const{data:l}=Y.storage.from("article-images").getPublicUrl(n);return l.publicUrl}catch(o){throw s&&clearInterval(s),o}}async function RR(r,e){if(!Y)throw new Error("Supabase not configured");if(!Wx.includes(r.type))throw new Error("Unsupported format. Please upload JPG, PNG, or WebP.");if(r.size>Wg)throw new Error(`File too large (${(r.size/1024/1024).toFixed(1)} MB). Max 10 MB.`);const t=r.name.split(".").pop()??"jpg",n=`obituaries/${Date.now()}-${Math.random().toString(36).slice(2)}.${t}`;let s=null,i=0;e&&(e(0),s=setInterval(()=>{i=Math.min(i+15,85),e(i)},200));try{const{error:o}=await Y.storage.from("article-images").upload(n,r,{upsert:!1,contentType:r.type});if(s&&clearInterval(s),e&&e(100),o)throw new Error(o.message);const{data:l}=Y.storage.from("article-images").getPublicUrl(n);return l.publicUrl}catch(o){throw s&&clearInterval(s),o}}async function Gx(){if(!je||!Y)return[];try{const{data:r}=await Y.from("games").select("*").order("game_date",{ascending:!0,nullsFirst:!1}).order("sort_order",{ascending:!0}).order("created_at",{ascending:!0});return r??[]}catch{return[]}}async function yH(r){if(!je||!Y)return{error:null};const e=new Date().toISOString();try{if(r.id){const{id:t,created_at:n,...s}=r,{error:i}=await Y.from("games").update({...s,updated_at:e}).eq("id",t);return{error:(i==null?void 0:i.message)??null}}else{const{error:t}=await Y.from("games").insert({...r,created_at:e,updated_at:e});return{error:(t==null?void 0:t.message)??null}}}catch(t){return{error:t instanceof Error?t.message:"Save failed."}}}async function bH(r){!je||!Y||await Y.from("games").delete().eq("id",r)}async function xH(){if(!je||!Y)return[];try{const{data:r,error:e}=await Y.from("timeline_items").select("*").eq("published",!0).order("sort_year",{ascending:!0}).order("created_at",{ascending:!0});if(e)throw new Error(e.message);return r??[]}catch{return[]}}async function vH(){if(!je||!Y)return[];try{const{data:r,error:e}=await Y.from("timeline_items").select("*").order("sort_year",{ascending:!0}).order("created_at",{ascending:!0});if(e)throw new Error(e.message);return r??[]}catch{return[]}}async function pA(r){if(!je||!Y)return{error:null,data:null};const e=new Date().toISOString();try{if(r.id){const{id:t,created_at:n,...s}=r,{data:i,error:o}=await Y.from("timeline_items").update({...s,updated_at:e}).eq("id",t).select().maybeSingle();return o?{error:o.message,data:null}:{error:null,data:i}}else{const{data:t,error:n}=await Y.from("timeline_items").insert({...r,created_at:e,updated_at:e}).select().maybeSingle();return n?{error:n.message,data:null}:{error:null,data:t}}}catch(t){return{error:t instanceof Error?t.message:"Save failed.",data:null}}}async function wH(r){!je||!Y||await Y.from("timeline_items").delete().eq("id",r)}async function _H(r){if(!je||!Y)return null;try{const{data:e}=await Y.from("public_notice_affidavits").select("*").eq("notice_id",r).order("created_at",{ascending:!1}).limit(1).maybeSingle();return e}catch{return null}}async function PR(r){if(!je||!Y)return{error:null,data:null};const e=new Date().toISOString();try{if(r.id){const{id:t,created_at:n,...s}=r,{data:i,error:o}=await Y.from("public_notice_affidavits").update({...s,updated_at:e}).eq("id",t).select().maybeSingle();return{error:(o==null?void 0:o.message)??null,data:i}}else{const{data:t,error:n}=await Y.from("public_notice_affidavits").insert({...r,created_at:e,updated_at:e}).select().maybeSingle();return{error:(n==null?void 0:n.message)??null,data:t}}}catch(t){return{error:t instanceof Error?t.message:"Save failed.",data:null}}}function NH(){const[r,e]=k.useState([]);if(k.useEffect(()=>{BU().then(e)},[]),r.length===0)return null;const t=r.map(n=>n.title).join("  ·  ");return a.jsxs("div",{className:"bg-brand-black text-white flex items-stretch overflow-hidden border-b border-white/10",children:[a.jsxs("div",{className:"flex items-center gap-1.5 bg-brand-red px-3 py-2 flex-shrink-0 z-10",children:[a.jsx(Ve,{className:"w-3.5 h-3.5 text-white"}),a.jsx("span",{className:"text-xs font-bold tracking-widest uppercase text-white whitespace-nowrap",children:"Breaking"})]}),a.jsx("div",{className:"ticker-wrap flex-1 py-2 px-3",children:a.jsxs("div",{className:"ticker-content text-xs md:text-sm font-medium text-gray-200",children:[t,"      ",t]})}),a.jsx($e,{to:"/news",className:"flex items-center px-3 py-2 text-xs font-semibold text-gray-400 hover:text-white hover:bg-white/10 flex-shrink-0 transition-colors",children:"All News →"})]})}function SH({className:r}
744){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:r,"aria-hidden":"true",children:a.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-4.714-6.231-5.401 6.231H2.747l7.73-8.835L1.254 2.25H8.08l4.258 5.624L18.244 2.25zm-1.161 17.52h1.833L7.084 4.126H5.117L17.083 19.77z"})})}function kH(){const r=Ug(),[e,t]=k.useState({});k.useEffect(()=>{Xs("contact").then(t)},[]);const n=e.address_line1||"174 NE 351 Hwy",s=e.address_line2||"Cross City, FL 32628",i=e.phone||"(352) 498-3312",o=e.email_news||"[email protected]";return a.jsxs("footer",{className:"bg-brand-black text-gray-300 mt-12",children:[a.jsxs("div",{className:"bg-brand-red text-white text-center py-6 px-4",children:[a.jsx("div",{className:"font-masthead text-2xl md:text-3xl font-bold mb-1 tracking-wide",children:"The Dixie County Advocate"}),a.jsx("p",{className:"font-headline italic text-white/80 text-sm",children:"Every week without fail since July 1, 1921"}),a.jsxs("p",{className:"text-white/50 text-xs mt-1 tracking-widest uppercase",children:[r," Years of Continuous Publication • Dixie County, Florida"]})]}),a.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-10 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-8",children:[a.jsxs("div",{className:"lg:col-span-1",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsx(Vs,{className:"w-5 h-5 text-brand-red"}),a.jsx("span",{className:"font-headline font-bold text-white",children:"About the Advocate"})]}),a.jsx("p",{className:"text-sm text-gray-400 leading-relaxed mb-4",children:"The Dixie County Advocate has served as the community's trusted voice for over a century, delivering local news, sports coverage, and community information every week without fail."}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("a",{href:"#",className:"w-8 h-8 bg-white/10 hover:bg-brand-red text-gray-400 hover:text-white rounded flex items-center justify-center transition-colors",children:a.jsx(NR,{className:"w-4 h-4"})}),a.jsx("a",{href:"#",className:"w-8 h-8 bg-white/10 hover:bg-brand-red text-gray-400 hover:text-white rounded flex items-center justify-center transition-colors",children:a.jsx(SH,{className:"w-4 h-4"})})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-white text-sm uppercase tracking-widest mb-4",children:"News"}),a.jsx("ul",{className:"space-y-2 text-sm",children:[{label:"Local News",path:"/news"},{label:"Sports",path:"/sports"},{label:"Community",path:"/community"},{label:"Obituaries",path:"/obituaries"},{label:"Public Notices",path:"/public-notices"}].map(l=>a.jsx("li",{children:a.jsx($e,{to:l.path,className:"hover:text-white hover:text-brand-red transition-colors",children:l.label})},l.label))})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-white text-sm uppercase tracking-widest mb-4",children:"More"}),a.jsx("ul",{className:"space-y-2 text-sm",children:[{label:"About the Advocate",path:"/about"},{label:"Subscribe",path:"/subscribe"},{label:"Submit a Story Tip",path:"/community"},{label:"Submit an Obituary",path:"/obituaries"},{label:"Staff Login",path:"/admin"}].map(l=>a.jsx("li",{children:a.jsx($e,{to:l.path,className:"hover:text-white transition-colors",children:l.label})},l.label))})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-white text-sm uppercase tracking-widest mb-4",children:"Contact"}),a.jsxs("ul",{className:"space-y-3 text-sm",children:[a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx(yo,{className:"w-4 h-4 text-brand-red mt-0.5 flex-shrink-0"}),a.jsxs("span",{children:[n,a.jsx("br",{}),s]})]}),a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(Ck,{className:"w-4 h-4 text-brand-red flex-shrink-0"}),a.jsx("a",{href:`tel:${i.replace(/\D/g,"")}`,className:"hover:text-white",children:i})]}),a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(go,{className:"w-4 h-4 text-brand-red flex-shrink-0"}),a.jsx("a",{href:`mailto:${o}`,className:"hover:text-white break-all",children:o})]})]})]})]}),a.jsx("div",{className:"border-t border-white/10",children:a.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-4 flex flex-col sm:flex-row items-center justify-between gap-2 text-xs text-gray-500",children:[a.jsxs("span",{children:["© ",new Date().getFullYear()," The Dixie County Advocate. All rights reserved."]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx($e,{to:"/privacy-policy",className:"hover:text-white transition-colors",children:"Privacy Policy"}),a.jsx("span",{children:"Est. July 1, 1921 • Cross City, Florida"})]})]})}),a.jsx("div",{className:"border-t border-white/5 bg-black/30",children:a.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-3 flex items-center justify-center gap-2.5",children:[a.jsx("span",{className:"text-xs text-gray-600 tracking-wide",children:"Powered by"}),a.jsxs("a",{href:"https://lsa-media.com",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 opacity-50 hover:opacity-90 transition-opacity",children:[a.jsx("img",{src:"/lsa_logo_v6_digital.png",alt:"LSA Media LLC Digital",className:"h-5"}),a.jsx("span",{className:"text-xs text-gray-600",children:"LSA Media LLC. Digital"})]})]})})]})}var R_,P_,bn,wi;(function(r){r.OPUS="OPUS",r.NONE="NONE"})(R_||(R_={})),function(r){r.VP8="VP8",r.H264="H264",r.H265="H265",r.AV1="AV1",r.NONE="NONE"}(P_||(P_={})),function(r){r[r.UNAVAILABLE=1e3]="UNAVAILABLE",r[r.AVAILABLE=0]="AVAILABLE",r[r.IDLE=1]="IDLE",r[r.PLAYING=2]="PLAYING",r[r.PAUSED=3]="PAUSED"}(bn||(bn={})),function(r){r.UNAVAILABLE="Playback.UNAVAILABLE",r.AVAILABLE="Playback.AVAILABLE",r.IDLE="Playback.IDLE",r.PLAYING="Playback.PLAYING",r.PAUSED="Playback.PAUSED"}(wi||(wi={}));const CH={[bn.UNAVAILABLE]:wi.UNAVAILABLE,[bn.AVAILABLE]:wi.AVAILABLE,[bn.IDLE]:wi.IDLE,[bn.PLAYING]:wi.PLAYING,[bn.PAUSED]:wi.PAUSED};var mA,I_,gA,Db;(function(r){r.RTMP="rtmp",r.RTC="rtc"})(mA||(mA={})),function(r){r.LIVE="live",r.RECORD="record",r.APPEND="append"}(I_||(I_={})),function(r){r.OPUS="OPUS"}(gA||(gA={})),function(r){r.VP8="VP8",r.H264="H264",r.H265="H265",r.AV1="AV1"}(Db||(Db={}));var L_={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},IR={};function $w(r){return typeof r=="string"?L_[r.toLowerCase()]:r}function O_(r,e){return O_=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t},O_(r,e)}function M_(r,e,t){return M_=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}()?Reflect.construct:function(n,s,i){var o=[null];o.push.apply(o,s);var l=new(Function.bind.apply(n,o));return i&&O_(l,i.prototype),l},M_.apply(null,arguments)}function hc(r){if(r==null)return r;if(Array.isArray(r))return r.slice();if(typeof r=="object"){var e={};return Object.keys(r).forEach(function(t){e[t]=r[t]}),e}return r}function F_(r){return r===void 0?"undefined":r===null?"null":Array.isArray(r)?"[ "+r.map(function(e){return F_(e)}).join(", ")+" ]":typeof r=="object"?JSON.stringify(r):typeof r=="function"?"[Function: "+r.name+"]":typeof r=="boolean"||typeof r=="number"?r:"'"+r.toString()+"'"}function ic(r){if(typeof r!="string"){for(var e=new Array(arguments.length),t=0;t<arguments.length;t++)e[t]=F_(arguments[t]);return e.join(" ")}for(var n=1,s=arguments,i=s.length,o=String(r).replace(/%[sdj%]/g,function(c){if(c==="%%")return"%";if(n>=i)return c;switch(c){case"%s":return String(s[n++]);case"%d":return Number(s[n++]);case"%j":try{return JSON.stringify(s[n++])}catch{return"[Circular]"}default:return c}}),l=s[n];n<i;l=s[++n])o+=l===null||typeof l!="object"?" "+l:" "+F_(l);return o}Object.keys(L_).forEach(function(r){IR[L_[r]]=r});var B_={};function $_(r,e){if(e){if(B_[e])return;B_[e]=!0}console.error(r+`
745`)}var EH=function(){function r(){}return r.prototype.write=function(e){e.level<30?console.log(e):e.level<40?console.info(e):e.level<50?console.warn(e):console.error(e),e.err&&e.err.stack&&console.error(e.err.stack),e.obj&&console.log(e.obj)},r}(),ac=function(){function r(t,n,s){var i,o,l,c,u=this;if(!(this instanceof r))return new r(t,n);if(n!==void 0&&(i=t,t=n,!(i instanceof r)))throw new TypeError("invalid Logger creation: do not pass a second arg");if(!t)throw new TypeError("options (object) is required");if(i){if(t.name)throw new TypeError("invalid options.name: child cannot set logger name")}else if(!t.name)throw new TypeError("options.name (string) is required");if(t.stream&&t.streams)throw new TypeError('cannot mix "streams" and "stream" options');if(t.streams&&!Array.isArray(t.streams))throw new TypeError("invalid options.streams: must be an array");if(t.serializers&&(typeof t.serializers!="object"||Array.isArray(t.serializers)))throw new TypeError("invalid options.serializers: must be an object");
745if(i&&s){this._level=i._level,this.streams=i.streams,this.serializers=i.serializers,this.src=i.src,o=this.fields={};var d=Object.keys(i.fields);for(c=0;c<d.length;c++)o[l=d[c]]=i.fields[l];var h=Object.keys(t);for(c=0;c<h.length;c++)o[l=h[c]]=t[l]}else{if(i){for(this._level=i._level,this.streams=[],c=0;c<i.streams.length;c++){var f=hc(i.streams[c]);this.streams.push(f)}this.serializers=hc(i.serializers),this.src=i.src,this.fields=hc(i.fields),t.level&&this.level(t.level)}else this._level=Number.POSITIVE_INFINITY,this.streams=[],this.serializers=null,this.src=!1,this.fields={};t.stream?this.addStream({type:"stream",stream:t.stream,level:t.level}):t.streams?t.streams.forEach(function(p){u.addStream(p,t.level)}):i&&t.level?this.level(t.level):i||this.addStream({type:"raw",stream:new EH,level:t.level}),t.serializers&&this.addSerializers(t.serializers),t.src&&(this.src=!0),delete(o=hc(t)).stream,delete o.level,delete o.streams,delete o.serializers,delete o.src,this.serializers&&this._applySerializers(o),Object.keys(o).forEach(function(p){u.fields[p]=o[p]})}}var e=r.prototype;return e.addStream=function(t,n){n===void 0&&(n=30),(t=hc(t)).type="raw",t.level=$w(t.level||n),t.level<this._level&&(this._level=t.level),this.streams.push(t),delete this.haveNonRawStreams},e.addSerializers=function(t){var n=this;this.serializers||(this.serializers={}),Object.keys(t).forEach(function(s){var i=t[s];if(typeof i!="function")throw new TypeError(ic('invalid serializer for "%s" field: must be a function',s));n.serializers[s]=i})},e.child=function(t,n){return new this.constructor(this,t||{},n)},e.level=function(t){if(t===void 0)return this._level;for(var n=$w(t),s=this.streams.length,i=0;i<s;i++)this.streams[i].level=n;this._level=n},e.levels=function(t,n){if(t===void 0)return this.streams.map(function(u){return u.level});var s;if(typeof t=="number"){if((s=this.streams[t])===void 0)throw new Error("invalid stream index: "+t)}else{for(var i=this.streams.length,o=0;o<i;o++){var l=this.streams[o];if(l.name===t){s=l;break}}if(!s)throw new Error(ic('no stream with name "%s"',t))}if(n===void 0)return s.level;var c=$w(n);s.level=c,c<this._level&&(this._level=c)},e._applySerializers=function(t,n){var s=this;Object.keys(this.serializers).forEach(function(i){if(!(t[i]===void 0||n&&n[i]))try{t[i]=s.serializers[i](t[i])}catch(o){$_(ic(`bunyan: ERROR: Exception thrown from the "%s" Bunyan serializer. This should never happen. This is a bugin that serializer function.
746%s`,i,o.stack||o)),t[i]=ic('(Error in Bunyan log "%s" serializer broke field. See stderr for details.)',i)}})},e._emit=function(t,n){var s,i;if(this.haveNonRawStreams===void 0){for(this.haveNonRawStreams=!1,s=0;s<this.streams.length;s++)if(!this.streams[s].raw){this.haveNonRawStreams=!0;break}}if(n||this.haveNonRawStreams)try{i=JSON.stringify(t,function(){var u=[];return function(d,h){return h&&typeof h=="object"?u.indexOf(h)!==-1?"[Circular]":(u.push(h),h):h}}())+`
747`}catch(u){var o=u.stack.split(/\n/g,2).join(`
748`);$_('bunyan: ERROR: Exception in `JSON.stringify(rec)`. You can install the "safe-json-stringify" module to have Bunyan fallback to safer stringification. Record:\n'+function(d,h){return h||(h="    "),h+d.split(/\r?\n/g).join(`
749`+h)}(ic(`%s
750%s`,t,u.stack)),o),i=ic(`(Exception in JSON.stringify(rec): %j. See stderr for details.)
751`,u.message)}if(n)return i;var l=t.level;for(s=0;s<this.streams.length;s++){var c=this.streams[s];c.level<=l&&c.stream.write(t)}return i},r}();function sd(r){return function(){var e=this,t=null,n=arguments,s=null;if(arguments.length===0)return this._level<=r;this._level>r||(s=function(i){var o;i[0]instanceof Error?(t={err:e.serializers&&e.serializers.err?e.serializers.err(i[0]):jH.err(i[0])},o={err:!0},n=i.length===1?[t.err.message]:Array.prototype.slice.call(i,1)):typeof i[0]!="object"&&i[0]!==null||Array.isArray(i[0])?(t=null,n=Array.prototype.slice.call(i)):(t=i[0],n=i.length===1&&t.err&&t.err instanceof Error?[t.err.message]:Array.prototype.slice.call(i,1));var l=hc(e.fields);l.level=r;var c=t?hc(t):null;if(c&&(e.serializers&&e._applySerializers(c,o),Object.keys(c).forEac
751h(function(d){l[d]=c[d]})),l.levelName=IR[r],l.msg=n.length?ic.apply(e,n):"",l.time||(l.time=new Date),e.src&&!l.src)try{throw new Error("call-stack-error")}catch(d){var u=d.stack?function(h,f){var p=h.split(`
752`);p[0]&&p[0].indexOf("call-stack-error")>=0&&p.shift();var m=p[f],g=null;if(m){var v=/^\s*(at|.*@)\s*(.+)?$/.exec(m);g=Array.isArray(v)&&v[2]?v[2]:m}return g}(d.stack,2):"";u||function(h){return B_[h]}("src")||$_("Unable to determine src line info","src"),l.src=u||""}return l.v=1,l}(n),this._emit(s))}}function LR(r){var e=r.stack||r.toString();if(r.cause&&typeof r.cause=="function"){var t=r.cause();t&&(e+=`
753Caused by: `+LR(t))}return e}ac.prototype.trace=sd(10),ac.prototype.debug=sd(20),ac.prototype.info=sd(30),ac.prototype.warn=sd(40),ac.prototype.error=sd(50),ac.prototype.fatal=sd(60);var jH={err:function(r){return r&&r.stack?{message:r.message,name:r.name,stack:LR(r),code:r.code,signal:r.signal}:r}};const AH={10:"TRACE",20:"DEBUG",30:"INFO",40:"WARN",50:"ERROR",60:"FATAL"};class TH{write(e){console.log("%s - [%s] %s: %s",e.time.toISOString(),e.name,AH[e.level]||"UNKNOWN",e.msg)}}let my,Uw;const Ak=r=>(e,t)=>{var n;my&&typeof my[r]=="function"&&my[r]((n=e,s=>`(${n}) ${s}`)(t))},Pl={TRACE:"trace",INFO:"info",DEBUG:"debug",WARN:"warn",ERROR:"error",FATAL:"fatal"},DH=(r,e=!1,t)=>{const n=[{level:r,stream:new TH,type:"raw"}];e&&(Uw=[],n.push({level:r,stream:{write:s=>{const i=`[${s.time.toISOString()}] ${r.toUpperCase()}: ${s.msg}`;Uw==null||Uw.push(i)}},type:"raw"})),my=function(){return M_(ac,[].slice.call(arguments))}({level:r,name:"red5pro-sdk",streams:n})},ve=Ak(Pl.DEBUG),gt=Ak(Pl.WARN),sr=Ak(Pl.ERROR),D0="RED5PRO";class Xx{constructor(){this._callbacks={},this._callbacks[D0]=[]}_notify(e,t){let n;const s=e.length;for(n=0;n<s;n++)e[n](t)}on(e,t){typeof t=="function"&&(e!=="*"?(this._callbacks[e]===void 0&&(this._callbacks[e]=[]),this._callbacks[e].indexOf(t)===-1&&this._callbacks[e].push(t)):this._callbacks[D0].push(t))}off(e,t){let n=this._callbacks[e];if(e==="*"&&(n=this._callbacks[D0]),n){const s=n.indexOf(t);s!==-1&&n.splice(s,1)}}trigger(e){const t=e.type;this._callbacks[t]&&this._notify(this._callbacks[t],e),this._notify(this._callbacks[D0],e)}}const RH=/['"](.*?)['"]:/gi,PH=/:['"](.*?)['"]/gi,Qs=new WeakMap;function IH(r,e,t){let n="",s=e;const i=e+t;do n+=String.fromCharCode(r[s++]);while(s<i);return n}function OR(r,e){try{return JSON.parse(r)[e]}catch{const n=RH.exec(r);let s;return n&&n.length>1&&(s=PH.exec(r),n[1]===e&&s&&s.length>1)?s[1]:void 0}}function LH(r){const e=OR(r,"orientation");if(e)return{orientation:parseInt(e)}}function OH(r){const e=OR(r,"streamingMode");if(e)return{streamingMode:e}}const MH=r=>Qs.get(r),yA=r=>{const e=r.textTracks;e&&(r.addTextTrack("metadata"),e.addEventListener("addtrack",t=>{const n=t.track;n.mode="hidden",n.addEventListener("cuechange",s=>{let i,o;for(s&&s.currentTarget?i=s.currentTarget.cues:(i=n.cues,i=i&&i.length>0?i:n.activeCues),i=i||[],o=0;o<i.length;o++){const l=i[o];if(l.value){const c=typeof l.value.data=="string"?l.value.data:IH(l.value.data,0,l.size),u=LH(c),d=OH(c),h=MH(r);u&&h&&h.orientation&&h.orientation.forEach(f=>{f(u)}),d&&h&&h.streamingMode&&h.streamingMode.forEach(f=>{f(d)})}}})}))},MR="BrowserEnvironment",gy=r=>ve(MR,r),R0=r=>gt(MR,r);let fc=[];const Hw=()=>{const r=screen.orientation?screen.orientation.angle:void 0,e=r===void 0?window.matchMedia("(orientation: portrait)").matches?0:90:r,t=fc.length;gy(`[window:onorientationchange]: orientation(${e}).`);for(let n=0;n<t;n++)fc[n]((e+90)%360)};let bA=!1;const zw=[],xA=()=>{const r=document.createElement("video");return r.canPlayType("application/vnd.apple.mpegURL").length>0||r.canPlayType("application/x-mpegURL").length>0||r.canPlayType("audio/mpegurl").length>0||r.canPlayType("audio/x-mpegurl").length>0},FH=typeof window<"u"&&window.adapter;var yr={gUM:async r=>navigator.mediaDevices.getUserMedia(r),createElement:r=>document.createElement(r),resolveElement:r=>document.getElementById(r),getElementId:r=>r.id,setVideoSource:(r,e,t)=>{if(r.srcObject=e,t)try{const n=r.play();n&&n.then(()=>gy("[setVideoSource:action]: play (START)")).catch(s=>{R0(`[setVideoSource:action]: play (CATCH::FAULT) ${s.message}`);
753try{r.setAttribute("autoplay","false"),r.pause()}catch(i){R0(`[setVideoSource:action]: pause (CATCH::FAULT) ${i.message}`)}})}catch(n){R0(`[setVideoSource:action]: play (CATCH::FAULT) ${n.message}`)}},hasAttributeDefined:(r,e)=>r.hasAttribute(e),addOrientationChangeHandler:(r,e=!0)=>{"onorientationchange"in window&&(gy("[window:orientation:addOrientationChangeHandler]: add"),fc.push(r),e&&Hw()),fc.length===1&&(gy("[window:orientation:addOrientationChangeHandler]: add"),window.addEventListener("orientationchange",Hw))},removeOrientationChangeHandler:r=>{fc=fc.filter(e=>e!==r),fc.length===0&&window.removeEventListener("orientationchange",Hw)},toggleFullScreen:r=>{window.screenfull&&window.screenfull.enabled?window.screenfull.toggle(r):document.fullscreenEnabled&&(document.fullscreenElement&&document.fullscreenElement===r?document.exitFullscreen():r.requestFullscreen())},onFullScreenStateChange:r=>{var e;zw.push(r),e=window.screenfull,bA||(bA=!0,window.screenfull?window.screenfull.on("change",()=>{zw.forEach(t=>t(e.isFullscreen))}):document.fullscreenEnabled&&document.addEventListener("fullscreenchange",()=>{zw.forEach(t=>t(document.fullscreenElement!==null))}))},getOrGenerateFingerprint:()=>{const r=window.localStorage;if(r&&r.getItem("red5_fingerprint"))return r.getItem("red5_fingerprint");let e;try{e=window.crypto.randomUUID()}catch{e="10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(Number(n)^crypto.getRandomValues(new Uint8Array(1))[0]&15>>Number(n)/4).toString(16))}return r.setItem("red5_fingerprint",e),e},getBrowserDetails:()=>{const r=window.adapter!==void 0,{navigator:e,adapter:t}=window,{appVersion:n,platform:s,userAgent:i,vendor:o}=e,l={appVersion:n,platform:s,userAgent:i,vendor:o};return r?{...t.browserDetails,...l}:l},supportsHLS:xA,onOrientationMetadata:(r,e)=>{const t=Qs.get(r);Qs.has(r)?Object.prototype.hasOwnProperty.call(t,"orientation")||(Qs.get(r).orientation=[]):(yA(r),Qs.set(r,{orientation:[]})),Qs.get(r).orientation.push(e)},onStreamingModeMetadata:(r,e)=>{const t=Qs.get(r);Qs.has(r)?Object.prototype.hasOwnProperty.call(t,"streamingMode")||(Qs.get(r).streamingMode=[]):(yA(r),Qs.set(r,{streamingMode:[]})),Qs.get(r).streamingMode.push(e)},isTouchEnabled:()=>"ontouchstart"in window,isPossiblySafari:()=>FH?window.adapter.browserDetails.browser.toLowerCase()==="safari":xA(),findByQuerySelector:r=>document.querySelector(r),addGlobalEventListener:(r,e,t=document)=>{t.addEventListener(r,e)},removeGlobalEventListener:(r,e,t=document)=>{t.removeEventListener(r,e)},supportsNonNativeHLS:r=>{if(r)try{return r.isSupported()}catch{return R0("Could not access Hls.js."),!1}return!!window.Hls&&window.Hls.isSupported()},createHLSClient:(r={})=>new window.Hls(r),getHLSClientEventEnum:()=>window.Hls.Events,globalAssign:(r,e)=>{window[r]=e},globalUnassign:r=>{delete window[r]},getAssignedValue:r=>window[r]};const FR=r=>{const e=new URL(r),t=e.pathname.split("/").filter(i=>i.length>0),n=e.protocol==="https:"?"https":"http",s=e.hostname;return{protocol:n,port:e.port.length>0?e.port:443,app:t[0],host:s,streamName:t[t.length-1]}},BR=(r,e="whip")=>{var t;const{endpoint:n,proxy:s}=r;if(n)return n;{const{protocol:i,host:o,port:l,app:c,streamName:u}=r,d=i.match(/^http/)?i:i==="ws"?"http":"https";return s!=null&&s.enabled?`${d}://${o}:${l}/as/${(t=s.version)!==null&&t!==void 0?t:"v1"}/proxy/${e}/${c}/${u}`:`${d}://${o}:${l}/${c}/${e}/endpoint/${u}`}},vA=r=>{const e={audio:!1,video:!1},t={audio:!1,video:!1};return r.getTracks().forEach(n=>{n.kind==="video"?(t.video=n.getSettings(),e.video=n.getConstraints()):n.kind==="audio"&&(t.audio=n.getSettings(),e.audio=n.getConstraints())}),{requested:e,accepted:t}},Vg=r=>{const e=r.length;return function t(...n){return n.length>=e?r(...n):function(...s){return t(...n,...s)}}},$R=Vg((r,e)=>{let t=0;const n=e.length,s=[];for(;t<n;)r(e[t])&&(s[s.length]=e[t]),t+=1;return s});var Rb,wA,_A,NA,af,Su;(function(r){r.UDP="udp",r.TCP="tcp"})(Rb||(Rb={})),function(r){r.ENCODED_FRAME="EncodedFrame",r.PACKET="Packet"}(wA||(wA={})),function(r){r.VIDEO="encodeVideo",r.AUDIO="encodeAudio"}(_A||(_A={})),function(r){r.VIDEO="decodeVideo",r.AUDIO="decodeAudio"}(NA||(NA={})),function(r){r[r.FAILED=400]="FAILED",r[r.NOT_FOUND=404]="NOT_FOUND",r[r.GONE=410]="GONE"}(af||(af={})),function(r){r.DEV_NULL="dev/null",r.DATA_CHANNEL="data-channel",r.EVENT_TRANSPORT="event-transport"}(Su||(Su={}));const Gg={endpoint:Su.DATA_CHANNEL,interval:5e3,include:[]},BH={protocol:"https",port:443,app:"live",streamMode:I_.LIVE,keyFramerate:3e3,mediaElementId:"red5pro-publisher",rtcConfiguration:{iceCandidatePoolSize:2,bundlePolicy:"max-bundle"},iceTransport:Rb.UDP,bandwidth:{audio:56,video:750},clearMediaOnUnpublish:!1,reconnect:void 0,mediaConstraints:{audio:!0,video:{width:{min:640,max:1920},height:{min:360,max:1080},frameRate:{min:30,max:60}}},dataChannelConfiguration:{name:"red5pro"},signalingSocketOnly:!1,includeDataChannel:!0,forceVP8:!1,videoEncoding:void 0,audioEncoding:void 0,stats:Gg,pubnub:void 0,signalingSocketOnly:!1,enableChannelSignaling:!1,includeDataChannel:!0,disableProxy:!0,trickleIce:!0,mungeOffer:void 0,mungeAnswer:void 0,offerSDPResolution:!1},$H={enabled:!1,timeout:2e3,maxAttempts:10};class UH extends Xx{constructor(e){super(),this._name=e||"MessageTransport",this._responseHandlers=[],this._asyncTickets=[]}
vendor: 4,361 bytes, line 753
753getJsonFromSocketMessage(e){try{return typeof e.data=="string"?JSON.parse(e.data):e.data}catch(t){gt(this._name,"Could not parse message as JSON. Message= "+e.data+". Error= "+t.message)}return null}addResponseHandler(e){this._responseHandlers.push(e)}respond(e){gt(this._name,`respond() should be overriden. Unhandled message: ${e}`)}post(e){return gt(this._name,`post() should be overriden. Unhandled request: ${e}`),Promise.resolve(!1)}postAsync(e){const t=function(){let s,i;return{promise:new Promise((o,l)=>{s=o,i=l}),resolve:s,reject:i}}(),n=Math.floor(65536*Math.random()).toString(16);return e.id=n,e.async=!0,this._asyncTickets.push({id:n,promise:t}),this.post(e),t.promise}handleMessageResponse(e){let t,n;const s=this._responseHandlers.length;for(t=0;t<s;t++)if(n=this._responseHandlers[t],n.respond(e))return!0;return!1}}let Yx=class{constructor(r,e){this._type=r,this._data=e}get type(){return this._type}get data(){return this._data}};class Xe extends Yx{constructor(e,t,n){super(e,n),this._publisher=t}get publisher(){return this._publisher}}class Me extends Yx{constructor(e,t,n){super(e,n),this._subscriber=t}get subscriber(){return this._subscriber}}class Tk extends Yx{constructor(e,t,n){super(e,n),this._name=t}get name(){return this._name}}class Xr extends Yx{constructor(e,t,n){super(e,n),this._pubnub=t}get pubnub(){return this._pubnub}}var at,Ct,Fe,Et,Pu,to,Pd;(function(r){r.RECONNECT_START="Reconnect.Start",r.RECONNECT_FAILURE="Reconnect.Failure",r.RECONNECT_SUCCESS="Reconnect.Success",r.CONNECT_SUCCESS="Connect.Success",r.CONNECT_FAILURE="Connect.Failure",r.PUBLISH_START="Publish.Start",r.PUBLISH_FAIL="Publish.Fail",r.PUBLISH_INVALID_NAME="Publish.InvalidName",r.UNPUBLISH_SUCCESS="Unpublish.Success",r.PUBLISH_METADATA="Publish.Metadata",r.PUBLISH_STATUS="Publish.Status",r.PUBLISH_AVAILABLE="Publish.Available",r.PUBLISH_INSUFFICIENT_BANDWIDTH="Publish.InsufficientBW",r.PUBLISH_SUFFICIENT_BANDWIDTH="Publish.SufficientBW",r.PUBLISH_RECOVERING_BANDWIDTH="Publish.RecoveringBW",r.PUBLISH_SEND_INVOKE="Publish.Send.Invoke",r.CONNECTION_CLOSED="Publisher.Connection.Closed",r.DIMENSION_CHANGE="Publisher.Video.DimensionChange",r.STATISTICS_ENDPOINT_CHANGE="Publisher.StatisticsEndpoint.Change"})(at||(at={})),function(r){r.CONSTRAINTS_ACCEPTED="WebRTC.MediaConstraints.Accepted",r.CONSTRAINTS_REJECTED="WebRTC.MediaConstraints.Rejected",r.MEDIA_STREAM_AVAILABLE="WebRTC.MediaStream.Available",r.PEER_CONNECTION_AVAILABLE="WebRTC.PeerConnection.Available",r.OFFER_START="WebRTC.Offer.Start",r.OFFER_END="WebRTC.Offer.End",r.CANDIDATE_CREATE="WebRTC.Candidate.Create",r.CANDIDATE_RECEIVE="WebRTC.Candidate.Receive",r.PEER_CANDIDATE_END="WebRTC.PeerConnection.CandidateEnd",r.ICE_TRICKLE_COMPLETE="WebRTC.IceTrickle.Complete",r.SOCKET_MESSAGE="WebRTC.Socket.Message",r.DATA_CHANNEL_OPEN="WebRTC.DataChannel.Open",r.DATA_CHANNEL_AVAILABLE="WebRTC.DataChannel.Available",r.DATA_CHANNEL_CLOSE="WebRTC.DataChannel.Close",r.DATA_CHANNEL_MESSAGE="WebRTC.DataChannel.Message",r.DATA_CHANNEL_ERROR="WebRTC.DataChannel.Error",r.PEER_CONNECTION_OPEN="WebRTC.PeerConnection.Open",r.TRACK_ADDED="WebRTC.PeerConnection.OnTrack",r.UNSUPPORTED_FEATURE="WebRTC.Unsupported.Feature",r.TRANSFORM_ERROR="WebRTC.Transform.Error",r.HOST_ENDPOINT_CHANGED="WebRTC.Endpoint.Changed",r.STATS_REPORT="WebRTC.Stats.Report"}(Ct||(Ct={})),function(r){r.RECONNECT_START="Reconnect.Start",r.RECONNECT_FAILURE="Reconnect.Failure",r.CONNECT_SUCCESS="Connect.Success",r.CONNECT_FAILURE="Connect.Failure",r.SUBSCRIBE_START="Subscribe.Start",r.SUBSCRIBE_STOP="Subscribe.Stop",r.SUBSCRIBE_FAIL="Subscribe.Fail",r.SUBSCRIBE_INVALID_NAME="Subscribe.InvalidName",r.SUBSCRIBE_METADATA="Subscribe.Metadata",r.SUBSCRIBE_STATUS="Subscribe.Status",r.SUBSCRIBE_SEND_INVOKE="Subscribe.Send.Invoke",r.SUBSCRIBE_PUBLISHER_CONGESTION="Subscribe.Publisher.NetworkCongestion",r.SUBSCRIBE_PUBLISHER_RECOVERY="Subscribe.Publisher.NetworkRecovery",r.PLAY_UNPUBLISH="Subscribe.Play.Unpublish",r.CONNECTION_CLOSED="Subscribe.Connection.Closed",r.ORIENTATION_CHANGE="Subscribe.Orientation.Change",r.STREAMING_MODE_CHANGE="Subscribe.StreamingMode.Change",r.VIDEO_DIMENSIONS_CHANGE="Subscribe.VideoDimensions.Change",r.LOADED_METADATA="Subscribe.LoadedMetadata",r.VOLUME_CHANGE="Subscribe.Volume.Change",r.SEEK_CHANGE="Subscribe.Seek.Change",r.PLAYBACK_TIME_UPDATE="Subscribe.Time.Update",r.P
753LAYBACK_STATE_CHANGE="Subscribe.Playback.Change",r.FULL_SCREEN_STATE_CHANGE="Subscribe.FullScreen.Change",r.AUTO_PLAYBACK_FAILURE="Subscribe.Autoplay.Failure",r.AUTO_PLAYBACK_MUTED="Subscribe.Autoplay.Muted",r.STATISTICS_ENDPOINT_CHANGE="Subscribe.StatisticsEndpoint.Change"}(Fe||(Fe={})),function(r){r.PEER_CONNECTION_AVAILABLE="WebRTC.PeerConnection.Available",r.OFFER_START="WebRTC.Offer.Start",r.OFFER_END="WebRTC.Offer.End",r.ANSWER_START="WebRTC.Answer.Start",r.ANSWER_END="WebRTC.Answer.End",r.CANDIDATE_CREATE="WebRTC.Candidate.Create",r.CANDIDATE_RECEIVE="WebRTC.Candidate.Receive",r.PEER_CANDIDATE_END="WebRTC.PeerConnection.CandidateEnd",r.ICE_TRICKLE_COMPLETE="WebRTC.IceTrickle.Complete",r.SOCKET_MESSAGE="WebRTC.Socket.Message",r.DATA_CHANNEL_MESSAGE="WebRTC.DataChannel.Message",r.DATA_CHANNEL_OPEN="WebRTC.DataChannel.Open",r.DATA_CHANNEL_AVAILABLE="WebRTC.DataChannel.Available",r.DATA_CHANNEL_CLOSE="WebRTC.DataChannel.Close",r.DATA_CHANNEL_ERROR="WebRTC.DataChannel.Error",r.PEER_CONNECTION_OPEN="WebRTC.PeerConnection.Open",r.ON_ADD_STREAM="WebRTC.Add.Stream",r.TRACK_ADDED="WebRTC.PeerConnection.OnTrack",r.SUBSCRIBE_STREAM_SWITCH="WebRTC.Subscribe.StreamSwitch",r.TRANSFORM_ERROR="WebRTC.Transform.Error",r.HOST_ENDPOINT_CHANGED="WebRTC.Endpoint.Changed",r.STATS_REPORT="WebRTC.Stats.Report"}(Et||(Et={})),function(r){r.OPEN="MessageTransport.Open",r.CLOSE="MessageTransport.Close",r.CHANGE="MessageTransport.Change",r.ERROR="MessageTransport.Error"}(Pu||(Pu={})),function(r){r.CONNECTION_HEALTH_STALE_STATS="WebRTC.Connection.StaleStats",r.CONNECTION_HEALTH_STATE_REGRESSION="WebRTC.Connection.StateRegression",r.CONNECTION_HEALTH_EXCESSIVE_RTT="WebRTC.Connection.ExcessiveRTT",r.CONNECTION_HEALTH_ICE_TIMEOUT="WebRTC.Connection.IceTimeout"}(to||(to={})),function(r){r.OPEN="MessageChannel.Open",r.SEND="MessageChannel.Send",r.RECEIVE="MessageChannel.Receive",r.CLOSE="MessageChannel.Close",r.FAIL="MessageChannel.Fail",r.ERROR="MessageChannel.Error"}(Pd||(Pd={}));const HH=[{urls:"stun:stun2.l.google.com:19302"}],zH={ordered:!0},qH=r=>{const e=["id","negotiated","ordered","maxPacketLifeTime","maxRetransmits","protocol"];return Object.fromEntries(Object.entries(r).filter(([t])=>e.includes(t)))};class UR extends UH{constructor(e,t="R5RTCPeerConnectionHelper"){super(t),this._responder=e}_removeDataChannelHandlers(e){e.onopen=null,e.onerror=null,e.onclose=null,e.onmessage=null}_addDataChannelHandlers(e){e.onerror=t=>{this._responder.onDataChannelError(e,t.error.message)},e.onmessage=t=>{this._onDataChannelMessage(t)},e.onopen=()=>{this._responder.onDataChannelOpen(e)},e.onclose=t=>{this._responder.onDataChannelClose(e),this.trigger(new Tk(Pu.CLOSE,this._name,{socket:this,event:t}))}}_isStatsMessage(e){return(e==null?void 0:e.type)==="stats-report"}_isErrorMessage(e){return!((e==null?void 0:e.type)!=="error"||!(e!=null&&e.message)&&!(e!=null&&e.code))}_isStatusMessage(e){return(e==null?void 0:e.type)==="status"}_onDataChannelMessage(e){if(this.handleMessageResponse(e))return!0;const t=this.getJsonFromSocketMessage(e);return t?!!this._isStatsMessage(t)||(ve(this._name,`[datachannel-response]: ${JSON.stringify(t,null,2)}`),this._handleMessageContent(t)):(gt(this._name,"Determined websocket response not in correct format. Aborting message handle."),!0)}_handleMessageContent(e){const{async:t,data:n,method:s,send:i,type:o,id:l}=e;if(this._isErrorMessage(n)){const c=(n==null?void 0:n.message)||(n==null?void 0:n.code);if(c)return this._responder.onDataChannelError(this._dataChannel,c),!0}if(s)return this._responder.onSendReceived(s,n),!0;if(i){const{senderName:c,dcLabel:u}=e,{data:d,method:h}=i,f={...d,senderName:c,dcLabel:u};return this._responder.onSendReceived(h,f),!0}return o==="metadata"&&n?(this._responder.onMetaData(n),!0):this._isStatusMessage(n)&&(n==null?void 0:n.code)==="NetConnection.Connect.Closed"?(this._responder.onConnectionClosed(),!0):!(!t||!l)&&this._handleAsyncResponse(l,e)}_handleAsyncResponse(e,t){const n=this._asyncTickets.find(o=>o.id===e);if(!n)return!1;const{promise:s}=n,{data:i}=t;if((i==null?void 0:i.type)==="error"){const o=i.message||i.code||"Unknown error";s.reject(new Error(o))}else s.resolve(i);return this._asyncTickets=this._asyncTickets.filter(o=>o.id!==e),!0}async setUpWithPeerConfiguration(e,t){this.tearDown(),e!=null&&e.iceServers&&e.iceServers.length>0||(e.iceServers=HH);try{ve(this._name,`[peerconnection:setUpWithPeerConfiguration]: ${JSON.stringify(e,null,2)}`);const n=new RTCPeerConnection(e);if(t){const s=t.name||t.label||"red5pro",i={...zH,...qH(t)};
753this._dataChannel=n.createDataChannel(s,i),ve(this._name,`[peerconnection:createDataChannel:${s}]: ${JSON.stringify(i,null,2)}`),this._addDataChannelHandlers(this._dataChannel)}return this._addConnectionHandlers(n),this._peerConnection=n,n}catch(n){throw gt(this._name,`Could not establish a PeerConnection. ${n.message}`),new Error(n.message)}}tearDown(){if(this._dataChannel){ve(this._name,"[teardown:datachannel]"),this._removeDataChannelHandlers(this._dataChannel);try{this._dataChannel.close()}catch(e){gt(this._name,`[datachannel.close] error: ${e.message}`)}finally{this._dataChannel=void 0}}if(this._peerConnection){ve(this._name,"[teardown:peerconnection]"),this._removeConnectionHandlers(this._peerConnection);try{this._peerConnection.close()}catch(e){gt(this._name,`[peerconnection.close] error: ${e.message}`)}finally{this._peerConnection=void 0}}}async setLocalDescription(e){var t;return ve(this._name,"[setlocaldescription]"),(t=this._peerConnection)===null||t===void 0?void 0:t.setLocalDescription(e)}async setRemoteDescription(e){var t;return ve(this._name,"[setremotedescription]"),(t=this._peerConnection)===null||t===void 0?void 0:t.setRemoteDescription(new RTCSessionDescription(e))}async addIceCandidate(e){var t;return ve(this._name,"[addcandidate]"),(t=this._peerConnection)===null||t===void 0?void 0:t.addIceCandidate(e)}async waitToGatherIce(e=5e3){const t=this._peerConnection;return ve(this._name,"[waittogatherice]"),new Promise(n=>{if(t.iceGatheringState==="complete")ve(this._name,"[waittogatherice] ice gathering state complete."),t.addIceCandidate(null).then(()=>{n(t.localDescription)}).catch(s=>{gt(this._name,"Error adding null candidate: "+s.message||s),n(t.localDescription)});else{ve(this._name,"[waittogatherice] waiting...");const s=setTimeout(()=>{clearTimeout(s),t.addIceCandidate(null).then(()=>{n(t.localDescription)}).catch(i=>{gt(this._name,"Error adding null candidate: "+i.message||i),n(t.localDescription)})},e);t.onicegatheringstatechange=()=>{clearTimeout(s),ve(this._name,"[waittogatherice] ice gathering state complete."),t.iceGatheringState==="complete"&&t.addIceCandidate(null).then(()=>{n(t.localDescription)}).catch(i=>{gt(this._name,"Error adding null candidate: "+i.message||i),n(t.localDescription)})}}})}post(e){if(this._dataChannel){const t=typeof e=="string"?e:JSON.stringify(e,null,2);ve(this._name,`[datachannel.send] message: ${t}`);try{return this._dataChannel.send(t),Promise.resolve(!0)}catch(n){sr(this._name,n.message)}}return Promise.resolve(!1)}get connection(){return this._peerConnection}get dataChannel(){return this._dataChannel}}const HR=[{label:"4K(UHD)",width:3840,height:2160},{label:"1080p(FHD)",width:1920,height:1080},{label:"UXGA",width:1600,height:1200},{label:"720p(HD)",width:1280,height:720},{label:"SVGA",width:800,height:600},{label:"VGA",width:640,height:480},{label:"360p(nHD)",width:640,height:360},{label:"CIF",width:352,height:288},{label:"QVGA",width:320,height:240},{label:"QCIF",width:176,height:144},{label:"QQVGA",width:160,height:120}],of=r=>typeof r=="number"?r:r.exact||r.ideal||r.max||r.min||r,WH=Vg((r,e)=>{var t,n;if(typeof r.video=="boolean")return!0;const s=!((t=r.video)===null||t===void 0)&&t.width?of(r.video.width):0,i=!((n=r.video)===null||n===void 0)&&n.height?of(r.video.height):0,o=s===e.width&&i===e.height;return o&&ve("[gum:isExact]",`Found matching resolution for ${e.width}, ${e.height}.`),o}),VH=Vg((r,e)=>{const t=$R(WH(e))(r);return ve("[gum:hasMatchingFormat]","Filtered list: "+JSON.stringify(t,null,2)),t.length>0}),GH=Vg((r,e)=>{var t,n;if(typeof r.video=="boolean")return!0;const s=(!((t=r.video)===null||t===void 0)&&t.width?of(r.video.width):0)*(!((n=r.video)===null||n===void 0)&&n.height?of(r.video.height):0);return e.width*e.height<s}),XH=Vg((r,e)=>{const t=GH(e);return $R(t)(r)}),YH=async r=>{ve("[gum:determineSupportedResolution]","Determine next neighbor based on constraints: "+JSON.stringify(r,null,2));const e=XH(HR)(r),t={...r};return await(async(n,s)=>{let i={...n};if(s.length==0)i.video;else{const o=s.shift();i={...n,video:{...n.video,width:{exact:o.width},height:{exact:o.height}}}}return{media:await yr.gUM(i),constraints:i}})(t,e)},KH=async r=>{let e;const t=VH(HR),n=async s=>{if(s){const i=typeof s=="string"?s:[s.name,s.message].join(": ");ve("[gum:getUserMedia]",`Failure in getUserMedia: ${i}. Attempting other resolution tests...`)}return await YH(r)};if((s=>s.video&&typeof s.video=="object"&&(s.video.width||s.video.height))(r)){if(!t(r))return await n(void 0);{ve("[gum:getUserMedia]","Found constraints in list. Checking quick support for faster setup with: "+JSON.stringify(r,null,2));const s=(i=>{var o,l;const c={...i};return typeof i.video=="boolean"||(c.video={...c.video},!((o=i.video)===null||o===void 0)&&o.width&&(c.video.width={exact:of(i.video.width)}),!((l=i.video)===null||l===void 0)&&l.height&&(c.video.height={exact:of(i.video.height)})),c})(r);try{return e=await yr.gUM(s),{media:e,constraints:s}}catch(i){return await n(i)}}}else try{return e=await yr.gUM(r),{media:e,constraints:r}}catch(s){return await n(s)}},zR=(r,e,t)=>{const n="a=end-of-candidates",s=/^a=candidate:/,i=/^a=ice-ufrag:/,o=/^a=ice-pwd:/,l=/^m=(audio|video|application)\ /,c=r.split(`\r
754`);let u,d="",h="";const f=[];
754return c.forEach(p=>{!u&&l.exec(p)?u=p:i.exec(p)?d=p:o.exec(p)?h=p:s.exec(p)&&f.push(p)}),f[f.length-1]!==n&&f.push(n),[d,h,u,"a=mid:0"].concat(f).join(`\r
755`)},Dr="RTCPeerConnectionPublisher";class JH extends UR{constructor(e){super(e,Dr)}_removeConnectionHandlers(e){e.onconnectionstatechange=null,e.oniceconnectionstatechange=null,e.onsignalingstatechange=null,e.onicecandidate=null,e.ontrack=null}_addConnectionHandlers(e){let t;e.onsignalingstatechange=()=>{const n=e.signalingState;ve(Dr,`[peer.onsignalingstatechange] - State: ${n}`)},e.onconnectionstatechange=()=>{const{connectionState:n}=e;n==="connected"?(ve(this._name,"[peerconnection:open]"),this._responder.onPeerConnectionOpen()):n!=="failed"&&n!=="disconnected"||(gt(this._name,"[peerconnection:error]"),n==="failed"&&this._responder.onPeerConnectionFail())},e.oniceconnectionstatechange=n=>{const{iceConnectionState:s}=e;ve(this._name,`[peer.oniceconnectionstatechange] - State: ${s}`),s==="failed"?(t&&clearTimeout(t),this._responder.onPeerConnectionClose(n,af.FAILED)):s==="disconnected"?t=setTimeout(()=>{ve(this._name,"[peer.oniceconnectionstatechange] - Reconnect timeout reached. Closing PeerConnection."),clearTimeout(t),this._responder.onPeerConnectionClose(n,af.GONE)},3e3):t&&(ve(this._name,"[peer.oniceconnectionstatechange] - Clearing timeout for reconnect."),clearTimeout(t))},e.onicecandidate=n=>{const{candidate:s}=n;ve(this._name,`[peer.onicecandidate] - Peer Candidate: ${s==null?void 0:s.candidate}`),s&&this._responder.onIceCandidate(s)},e.ontrack=n=>{ve(this._name,"[peer:ontrack]"),this._responder.onPeerConnectionTrackAdd(n.track)}}_onDataChannelMessage(e){const t=e;if(super._onDataChannelMessage(e))return!0;const n=this.getJsonFromSocketMessage(t);if(n===null)return gt(this._name,"Determined websocket response not in correct format. Aborting message handle."),!0;ve(this._name,"[datachannel-response]: "+JSON.stringify(n,null,2));const{data:s}=n;return s&&s.type==="status"?s.code==="NetStream.Play.UnpublishNotify"?(this._responder.onUnpublish(),!0):s.code==="NetConnection.Publish.InsufficientBW"?(this._responder.onInsufficientBandwidth(s),!0):s.code==="NetConnection.Publish.SufficientBW"?(this._responder.onSufficientBandwidth(s),!0):s.code==="NetConnection.Publish.RecoveringBW"?(this._responder.onRecoveringBandwidth(s),!0):s.code==="Application.Statistics.Endpoint"?(this._responder.onStatisticsEndpointChange(s.statistics),!0):(ve(Dr,`[datachannel.message] status :: ${s.code}`),this._responder.onPublisherStatus(s),!0):(this._responder.onDataChannelMessage(this._dataChannel,t),!1)}addTrack(e){this._peerConnection?this._peerConnection.addTrack(e):gt(Dr,"PeerConnection not initialized. Cannot add track.")}async postUnpublish(e){const t=this.post({unpublish:e});return ve(Dr,`[peerconnection:unpublish] complete: ${t}`),t}async createOfferWithoutSetLocal(e=null){var t;ve(Dr,`[createoffer:withoutlocal]:: bandwidth request: ${JSON.stringify(e,null,2)}`);try{const n=await((t=this._peerConnection)===null||t===void 0?void 0:t.createOffer());if(e){const s=((i,o)=>{const l=o.indexOf("m=audio");let c,u,d,h=o.indexOf("m=video"),f=o.indexOf("m=application");return l>-1&&i.audio&&(c=o.indexOf(`\r
756`,l),u=o.slice(0,c),d=o.slice(c+2,o.length),h=(o=[u,"b=AS:"+i.audio,d].join(`\r
757`)).indexOf("m=video"),f=o.indexOf("m=application")),h>-1&&i.video&&(c=o.indexOf(`\r
758`,h),u=o.slice(0,c),d=o.slice(c+2,o.length),f=(o=[u,"b=AS:"+i.video,d].join(`\r
759`)).indexOf("m=application")),f>-1&&i.dataChannel&&(c=o.indexOf(`\r
760`,f),u=o.slice(0,c),d=o.slice(c+2,o.length),o=[u,"b=AS:"+i.dataChannel,d].join(`\r
761`)),o})(e,n.sdp);n.sdp=s}return this._responder.onSDPSuccess(),n}catch(n){throw ve(Dr,"[createoffer:error]"),this._responder.onSDPError(n),n}}async updateBandwidthRequest(e=null){var t;ve(Dr,`[updatebandwidthrequest]:: bandwidth request: ${JSON.stringify(e,null,2)}`);try{const n=(t=this._peerConnection)===null||t===void 0?void 0:t.getSenders();if(e&&(n!=null&&n.length)&&n.length>0){const s=(o,l,c)=>new Promise((u,d)=>{try{ve(Dr,`[updatebandwidthrequest:${c}]:: bandwidth(${l.encodings[0].maxBitrate})`),o.setParameters(l).then(u).catch(d)}catch(h){d(h)}}),i=[];
vendor: 8,541 bytes, line 761
761n==null||n.forEach(async o=>{var l,c;if(((l=o.track)===null||l===void 0?void 0:l.kind)==="video"&&e.video){const u=o.getParameters();u.encodings||(u.encodings=[{}]),u.encodings[0].maxBitrate=75e4,u.encodings[0].maxFramerate=60,u.encodings[0].priority="high",i.push(s(o,u,"video"))}else if(((c=o.track)===null||c===void 0?void 0:c.kind)==="audio"&&e.audio){const u=o.getParameters();u.encodings||(u.encodings=[{}]),u.encodings[0].maxBitrate=128e3,i.push(s(o,u,"audio"))}}),await Promise.all(i).catch(o=>{sr(Dr,`[updatebandwidthrequest:error]:: ${o.message}`)})}return!0}catch(n){sr(Dr,`[updatebandwidthrequest:error]:: ${n.message}`)}return!1}async setOptimizationParams(e,t){var n;if(ve(Dr,`[setoptimizationparams]:: optimization params: ${JSON.stringify(t,null,2)}`),t.contentHint)try{e.getTracks().forEach(s=>{"contentHint"in s&&(s.contentHint=t.contentHint,ve(Dr,`[setoptimizationparams:contenthint]:: track: ${s.kind} contentHint: ${s.contentHint}`))})}catch(s){gt(Dr,`[setoptimizationparams:error]:: ${s.message}`)}if(t.degradationPreference)try{const s=(n=this._peerConnection)===null||n===void 0?void 0:n.getSenders();s!=null&&s.length&&s.length>0&&s.forEach(async i=>{var o,l;if(((o=i.track)===null||o===void 0?void 0:o.kind)==="video")try{let c=i.getParameters();c.degradationPreference=t.degradationPreference,await i.setParameters(c)}catch(c){gt(Dr,`[setoptimizationparams:error]:: ${c.message}`)}finally{let c=i.getParameters();ve(Dr,`[setoptimizationparams:degradationpreference]:: sender: ${(l=i.track)===null||l===void 0?void 0:l.kind} degradationPreference: ${c==null?void 0:c.degradationPreference}`)}})}catch(s){sr(Dr,`[setoptimizationparams:error]:: ${s.message}`)}}}class Pb extends Error{constructor(e){super(e),this.name="InvalidNameError"}}const Lt="WhipWhepSignalingHelper",Ts=new Map;Ts.set(400,"Invalid offer SDP."),Ts.set(401,"Not authorized."),Ts.set(404,"Scope resolver failed for the publish name and / or scope."),Ts.set(405,"Remember to update the URL passed into the WHIP or WHEP client."),Ts.set(406,"Scope connection rejected."),Ts.set(409,"Session already initialized."),Ts.set(412,"Invalid request body."),Ts.set(417,"Session lookup or creation failure.");const Ds=new Map;Ds.set(400,"Offer already sent, double POST assumed."),Ds.set(401,"Not authorized."),Ds.set(404,"Scope resolver failed for the playback name and / or scope."),Ds.set(406,"Playback failed due to an exception during creation."),Ds.set(409,"Stream is not available to playback.");const P0=["transcode"];var Ib;(function(r){r.ICE_SERVER="ice-server",r.STATISTICS="statistics"})(Ib||(Ib={}));const Ks=r=>r&&(e=>{const t=/[?&](.*)=([^&#]*)/.exec(e);return t&&t.length>0})(r)?"&":"?",SA=r=>r.split(";").map(e=>e.trim()).map(e=>e.charAt(0)==="<"?["url",e.substring(1,e.length-1)]:e.split("=")).reduce((e,t)=>e.set(t[0].replaceAll('"',""),t[1].replaceAll('"',"")),new Map);class qR{constructor(e,t=!1,n=!0,s=!1){ve(Lt,`[whipwhep] ${e}`),this._url=e,this._origin=void 0,this._forceHost=n,this._reconnectEnabled=s,this._resource=void 0,this._enableSignalingChannel=t}async getOptions(e={}){let t=`${this._url}${Ks(this._url)}signal=${this._enableSignalingChannel}`;this._reconnectEnabled&&(t+=`&resilient=${this._reconnectEnabled}`),e&&Object.keys(e).forEach(n=>{t+=`&${n}=${e[n]}`}),ve(Lt,`[whipwhep-options] ${t}`);try{const n=await fetch(t,{method:"OPTIONS",mode:"cors"}),{status:s,headers:i}=n;if(s===200||s===204){const o=/^(L|l)ink/,l=/^(S|s)ession-(H|h)ost/,c=[];let u;return i.forEach((d,h)=>{if(l.exec(h)&&(this._origin=d),o.exec(h)){if(d.indexOf(`rel="${Ib.ICE_SERVER}"`)>-1){const f=SA(d),p=f.get("url"),{protocol:m,host:g}=(y=>{const w=y.split(":");return w.length>1?{protocol:w[0],host:w[1]}:{protocol:void 0,host:y}})(p),v=f.get("username"),b=f.get("credential");m&&g&&v&&b?c.push({username:v,credential:b,urls:p}):p&&c.push({urls:p})}else if(d.indexOf(`rel="${Ib.STATISTICS}"`)>-1){const f=SA(d).get("url");f&&(u=f)}}}),ve(Lt,`[whipwhep-links]: ${JSON.stringify(c)}`),ve(Lt,`[whipwhep-origin]: ${this._origin}`),{links:c.length>0?c:void 0,origin:this._origin,statisticsEndpoint:u}}throw new Error(`Failed to get options: ${s}`)}catch(n){throw sr(Lt,n.message),n}}async postSDPOffer(e,t={},n=!0){let s=`${this._url}${Ks(this._url)}signal=${this._enableSignalingChannel}`;this._reconnectEnabled&&(s+=`&resilient=${this._reconnectEnabled}`),t&&Object.keys(t).forEach(i=>{P0.indexOf(i)===-1&&(s+=`&${i}=${t[i]}`)}),this._forceHost&&this._origin&&!(t!=null&&t.host)&&(s+=`&host=${this._origin}`),ve(Lt,`[whipwhep:post-offer] ${s}: `+JSON.stringify(e,null,2));try{const i={method:"POST",mode:"cors",headers:{"Content-Type":"application/sdp"}};e&&e.length>0&&(i.body=e);const o=await fetch(s,i),{status:l,headers:c}=o;if(c&&c.forEach((u,d)=>{ve(Lt,`[header] ${d}: ${u}`)}),l>=200&&l<300){const u=await o.text(),d=c.get("Location")||c.get("location");if(d){if(d.match(/^(http|https)/))this._resource=d;else{ve(Lt,`[whipwhep-response] Location provided as relative path: ${d}`);const h=new URL(this._url);h.pathname=d.split("?")[0],this._resource=h.toString().replace(/\/endpoint\//,"/resource/")}return ve(Lt,`[whipwhep-response] ${this._resource}: ${u}`),{sdp:u,location:this._resource}}return gt(Lt,"Location not provided in header response to Offer."),this._resource=new URL(this._url).toString().replace(/\/endpoint\//,"/resource/"),{sdp:u,location:this._resource}}if(n&&Ts.get(l))throw ve(Lt,Ts.get(l)),l===404||l===409?new Pb(Ts.get(l)):new Error(Ts.get(l));if(!n&&Ds.get(l))throw ve(Lt,Ds.get(l)),l===404||l===409?new Pb(Ds.get(l)):new Error(Ds.get(l));{const u=await o.text();throw Error(u)}}catch(i){throw sr(Lt,i.message),i}}async postSDPAnswer(e,t={}){ve(Lt,`[whipwhep:post-answer] ${this._resource}: `+JSON.stringify(e,null,2));let n=this._resource,s=Ks(n);t&&Object.keys(t).forEach(i=>{P0.indexOf(i)===-1&&(s=Ks(n),n+=`${s}${i}=${t[i]}`)}),this._forceHost&&this._origin&&!(t!=null&&t.host)&&(s=n.indexOf("?")>-1?"&":"?",n+=`${s}host=${this._origin}`);try{const i=await fetch(n,{method:"PATCH",mode:"cors",headers:{"Content-Type":"application/sdp"},body:e}),{status:o}=i;if(o>=200&&o<300)return{success:!0,code:o};if(Ds.get(o))throw ve(Lt,Ds.get(o)),new Error(Ds.get(o));{const l=await i.text();throw Error(l)}}catch(i){throw sr(Lt,i.message),i}}async trickle(e,t={}){ve(Lt,`[whipwhep-trickle] ${this._resource}: `+JSON.stringify(e,null,2));let n=this._resource,s=Ks(n);t&&Object.keys(t).forEach(i=>{P0.indexOf(i)===-1&&(s=Ks(n),n+=`${s}${i}=${t[i]}`)}),this._forceHost&&this._origin&&!(t!=null&&t.host)&&(s=Ks(n),n+=`${s}host=${this._origin}`);try{const i=await fetch(n,{method:"PATCH",mode:"cors",headers:{"Content-Type":"application/trickle-ice-sdpfrag"},body:e}),{status:o}=i;if(o>=200&&o<300){const l=await i.text();return ve(Lt,`[whipwhep-response] ${this._resource}: ${l}`),{candidate:l}}if(o===405)throw ve(Lt,"Remember to update the URL passed into the WHIP or WHEP client"),new Error("Remember to update the URL passed into the WHIP or WHEP client");{const l=await i.text();throw Error(l)}}catch(i){throw sr(Lt,i.message),i}}async tearDown(e={},t=!1){if(!this._resource)return;let n=this._resource,s=Ks(n);this._reconnectEnabled&&!t&&(s=Ks(n),n+=`${s}resilient=close`),e&&Object.keys(e).forEach(i=>{P0.indexOf(i)===-1&&(s=Ks(n),n+=`${s}${i}=${e[i]}`)}),this._forceHost&&this._origin&&!(e!=null&&e.host)&&(s=Ks(n),n+=`${s}host=${this._origin}`),ve(Lt,"[whipwhep-teardown]");try{await fetch(n,{method:"DELETE",mode:"cors"})}catch(i){if(sr(Lt,i.message),!t)throw i}this._url=void 0,this._origin=void 0,this._resource=void 0,this._forceHost=!1,this._enableSignalingChannel=!1}async post(){return ve(Lt,"[whipwhep:post] transport called."),Promise.resolve(!1)}async postAsync(){return ve(Lt,"[whipwhep:postAsync] transport called."),Promise.resolve(null)}getUrl(){return this._url}}const kA="R5ProPublishView";class ZH{constructor(e="red5pro-publisher"){try{this._targetElement=yr.resolveElement(e)}catch(t){throw sr(kA,`Could not instantiate a new instance of PublishView. Reason: ${t.message}`),t}}preview(e){const t=this.isAutoplay;ve(kA,`[preview]: autoplay(${t})`),yr.setVideoSource(this._targetElement,e,t)}unpreview(){yr.setVideoSource(this._targetElement,null,this.isAutoplay)}get isAutoplay(){return yr.hasAttributeDefined(this._targetElement,"autoplay")}get view(){return this._targetElement}}var ro,Ns;(function(r){r.INBOUND="inbound-rtp",r.OUTBOUND="outbound-rtp",r.CODEC="codec",r.MEDIA_SOURCE="media-source",r.CANDIDATE_PAIR="candidate-pair",r.CERTIFICATE="certificate",r.DATA_CHANNEL="data-channel",r.LO
761CAL_CANDIDATE="local-candidate",r.REMOTE_CANDIDATE="remote-candidate",r.PEER_CONNECTION="peer-connection",r.REMOTE_INBOUND="remote-inbound-rtp",r.REMOTE_OUTBOUND="remote-outbound-rtp",r.TRANSPORT="transport"})(ro||(ro={})),function(r){r.STALE_STATS="STALE_STATS",r.STATE_REGRESSION="STATE_REGRESSION",r.EXCESSIVE_RTT="EXCESSIVE_RTT",r.ICE_TIMEOUT="ICE_TIMEOUT"}(Ns||(Ns={}));class WR{constructor(e,t,n,s){this._name="RTCStatsMonitor",this._queue=[],this._startTime=0,this._stopped=!1,this._interval=0,this._candidatePairHealth=new Map,this._name=e,this._renegotiationPolicy=s,this._config={...Gg,...t},this._client=n,this._identifier={name:this._name,created:new Date().getTime(),fingerprint:yr.getOrGenerateFingerprint(),device:yr.getBrowserDetails(),client:t}}_emptyStatsReportQueue(){for(var e;this._queue.length>0;){const t=this._queue.shift(),n=(e=this._client)===null||e===void 0?void 0:e.getMessageTransport();n?n.post(t):gt(this._name,"Failed to post stats data to message transport. Message transport is not available.")}}_getStats(){const{_connection:e}=this;if(e)try{e.getStats(null).then(t=>{t.forEach(n=>{this._handleStatsReport(n)})}).catch(t=>{sr(this._name,`Failed to get stats report. ${t.message||t}`)})}catch(t){sr(this._name,`Failed to get stats report. ${t.message||t}`)}}_handleStatsReport(e){console.log(`[${this._name}]: ${JSON.stringify(e,null,2)}`)}_appendClientDetails(e){this._identifier.client={...this._identifier.client,...e}}async start(e){clearInterval(this._interval),this._startTime=new Date().getTime(),this._stopped=!1,this._connection=e,this._candidatePairHealth.clear(),this.postAction("started"),this._getStats(),this._interval=setInterval(()=>{this._stopped||this._getStats()},this._config.interval)}stop(){this._stopped=!0,clearInterval(this._interval),this.postAction("ended")}async post(e){const t={...this._identifier,type:"stats-report",timestamp:new Date().getTime(),data:e},{endpoint:n,additionalHeaders:s}=this._config;if(n===Su.DEV_NULL)return;if(this._client&&this._client.onStatsReport&&(n===null||n===Su.EVENT_TRANSPORT))return void this._client.onStatsReport(this._connection,t);let i={"Content-Type":"application/json"};if(s&&(i={...i,...s}),n&&n.match(/^(http|https):\/\//))try{const o=await fetch(n,{method:"POST",headers:i,body:JSON.stringify(t)});o.status>=200&&o.status<300?ve(this._name,`Posted stats data to endpoint: ${n}.`):sr(this._name,`Failed to post stats data to endpoint: ${n}. ${o.status}`)}catch(o){sr(this._name,`Failed to post stats data to endpoint: ${n}. ${o.message||o}`)}else if(this._client&&this._client.getMessageTransport()&&(n===void 0||n===Su.DATA_CHANNEL))try{let o=!1;const l=this._client.getMessageTransport();l&&(o=await l.post(t)),!o&&this._client&&(this._queue.push(t),this._client.on(Pu.CHANGE,()=>{this._client&&this._client.off(Pu.CHANGE),this._emptyStatsReportQueue()}),gt(this._name,"Failed to post stats data to message transport. Message transport is not available. Pushed to Queue."))}catch(o){sr(this._name,`Failed to post stats data to message transport. ${o.message||o}`)}}async postAction(e,t=void 0){return this.post({action:{type:e,data:t,timestamp:new Date().getTime()}})}async postEvent(e,t){return this.post({event:{type:e,data:t||void 0,timestamp:new Date().getTime()}})}updateEndpoint(e,t=!0){const{endpoint:n}=this._config;t?this._config.endpoint=e:t||n||(this._config.endpoint=e)}_checkCandidatePairHealth(e){var t,n;const{id:s,state:i,currentRoundTripTime:o,totalRoundTripTime:l}=e,c=(t=this._client)===null||t===void 0?void 0:t.getPeerConnection();if(!c)return void this.stop();const{iceConnectionState:u}=c,d=u==="connected"||u==="completed",h=new Date().getTime();if(d&&i!=="succeeded")return;this._candidatePairHealth.has(s)||this._candidatePairHealth.set(s,{id:s,staleSampleCount:0,stateTransitionTime:h,inProgressStartTime:i==="in-progress"?h:void 0});const f=this._candidatePairHealth.get(s);if(f.previousRTT!==void 0&&f.previousTotalRTT!==void 0&&o!==void 0&&l!==void 0&&(o===f.previousRTT&&l===f.previousTotalRTT?(f.staleSampleCount++,f.staleSampleCount>=3&&f.lastIssueReported!==Ns.STALE_STATS&&(this._client.emit(to.CONNECTION_HEALTH_STALE_STATS,{candidatePairId:s,currentState:i,frozenRTT:o,frozenTotalRTT:l,staleDurationSeconds:f.staleSampleCount,message:"RTT values frozen - connection may be dead"}),f.lastIssueReported=Ns.STALE_STATS)):(f.staleSampleCount=0,f.lastIssueReported===Ns.STALE_STATS&&(f.lastIssueReported=void 0))),f.previousState!=="succeeded"||i==="succeeded"||d||(this._client.emit(to.CONNECTION_HEALTH_STATE_REGRESSION,{candidatePairId:s,previousState:f.previousState,currentState:i,message:`ICE candidate pair regressed from '${f.previousState}' to '${i}' - connection lost`}),f.lastIssueReported=Ns.STATE_REGRESSION,f.stateTransitionTime=h),o!==void 0&&o>.2){const p=o>1?"critical":o>.6?"severe":o>.35?"poor":"degrading";(f.lastIssueReported!==Ns.EXCESSIVE_RTT||f.lastRttSeverity!==p)&&
761(this._client.emit(to.CONNECTION_HEALTH_EXCESSIVE_RTT,{candidatePairId:s,currentRTT:o,severity:p,message:`Elevated RTT detected (${p}): ${(1e3*o).toFixed(0)}ms`}),f.lastIssueReported=Ns.EXCESSIVE_RTT,f.lastRttSeverity=p)}else o!==void 0&&o<=.2&&(f.lastIssueReported===Ns.EXCESSIVE_RTT&&(f.lastIssueReported=void 0),f.lastRttSeverity=void 0);if(i==="in-progress"){f.inProgressStartTime||(f.inProgressStartTime=h);const p=h-f.inProgressStartTime;p>(((n=this._renegotiationPolicy)===null||n===void 0?void 0:n.iceTimeoutInterval)||5e3)&&f.lastIssueReported!==Ns.ICE_TIMEOUT&&(this._client.emit(to.CONNECTION_HEALTH_ICE_TIMEOUT,{candidatePairId:s,currentState:i,durationSeconds:Math.floor(p/1e3),message:`ICE negotiation timeout - candidate pair stuck in 'in-progress' for ${Math.floor(p/1e3)}s`}),f.lastIssueReported=Ns.ICE_TIMEOUT)}else f.inProgressStartTime=void 0,f.lastIssueReported===Ns.ICE_TIMEOUT&&(f.lastIssueReported=void 0);i!==f.previousState&&(f.stateTransitionTime=h),f.previousState=i,f.previousRTT=o,f.previousTotalRTT=l}dispose(){ve(this._name,"[dispose]"),this.stop(),this._candidatePairHealth.clear(),this._connection=void 0,this._client=void 0}}const QH=/(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b) \d+ typ srflx/,VR=r=>{const e=r.match(QH);return e&&e.length>1?e[1]:null},ez=[at.PUBLISH_START,at.PUBLISH_FAIL,at.PUBLISH_INSUFFICIENT_BANDWIDTH,at.PUBLISH_SUFFICIENT_BANDWIDTH,at.PUBLISH_RECOVERING_BANDWIDTH,at.STATISTICS_ENDPOINT_CHANGE];class tz extends WR{constructor(e,t){if(super("RTCPublisherStats",e,t),this.estimatedAudioBitrate=0,this.estimatedVideoBitrate=0,this.lastAudioReport=null,this.lastVideoReport=null,this._eventHandler=n=>{const{type:s,data:i}=n;if(ez.indexOf(s)>-1){if(s===at.STATISTICS_ENDPOINT_CHANGE){const{statisticsEndpoint:o}=i;this.updateEndpoint(o,!1)}this.postEvent(s)}},this._candidateCreateHandler=({data:{candidate:n}})=>{const{candidate:s}=n,i=VR(s);i&&(this._identifier.publicIP=i)},this._hostEndpointChangedHandler=({data:{endpoint:n,iceServers:s}})=>{this._appendClientDetails({node:n,iceServers:s})},this._client.on("*",this._eventHandler),this._client.on(Ct.CANDIDATE_CREATE,this._candidateCreateHandler),this._client.on(Ct.HOST_ENDPOINT_CHANGED,this._hostEndpointChangedHandler),this._client.getPeerConnection())this.start(this._client.getPeerConnection());else{const n=({data:s})=>{this._client.off(Ct.PEER_CONNECTION_AVAILABLE,n),this.start(s)};this._client.on(Ct.PEER_CONNECTION_AVAILABLE,n)}}_handleStatsReport(e){const{type:t}=e,{include:n}=this._config,s=n&&n.length>0;if(s&&n.indexOf(t)>=-1)this.post(e);else if(!s){if(t===ro.CODEC){const{id:i,clockRate:o,mimeType:l,payloadType:c}=e;this.post({id:i,type:t,clockRate:o,mimeType:l,payloadType:c})}else if(t===ro.CANDIDATE_PAIR){const{availableOutgoingBitrate:i,currentRoundTripTime:o,totalRoundTripTime:l,state:c}=e;this._checkCandidatePairHealth(e),this.post({type:t,availableOutgoingBitrate:i,currentRoundTripTime:o,totalRoundTripTime:l,state:c})}else if(t===ro.MEDIA_SOURCE){const{kind:i}=e;if(i==="audio")this.post({type:t,kind:i});else if(i==="video"){const{framesPerSecond:o,height:l,width:c}=e;this.post({type:t,kind:i,framesPerSecond:o,height:l,width:c})}}else if([ro.OUTBOUND,"outboundrtp"].indexOf(t)>-1){const{timestamp:i,kind:o,codecId:l,mediaType:c,active:u,bytesSent:d,packetsSent:h,totalPacketsSendDelay:f,retransmittedPacketsSent:p}=e,m={type:t,kind:o,codecId:l,mediaType:c,active:u,bytesSent:d,packetsSent:h,totalPacketsSendDelay:f,retransmittedPacketsSent:p};if(o==="audio"){if(this.lastAudioReport){const{bytesSent:g,timestamp:v}=this.lastAudioReport,b=8*(d-g)/(i-v);this.estimatedAudioBitrate=b}this.post({...m,estimatedBitrate:Math.floor(this.estimatedAudioBitrate)}),this.lastAudioReport=e}else if(o==="video"){const{firCount:g,pliCount:v,nackCount:b,frameWidth:y,frameHeight:w,framesEncoded:_,framesPerSecond:N,framesSent:S,keyFramesEncoded:E,qualityLimitationReason:T,qualityLimitationDurations:D}=e,R={...m,firCount:g,pliCount:v,nackCount:b,frameWidth:y,frameHeight:w,framesEncoded:_,framesPerSecond:N,framesSent:S,keyFramesEncoded:E,qualityLimitationReason:T!=="none"?T:void 0,qualityLimitationDurations:T!=="none"?D:void 0};if(this.lastVideoReport){const{bytesSent:H,timestamp:A}=this.lastVideoReport,U=8*(d-H)/(i-A);this.estimatedVideoBitrate=U}this.post({...R,estimatedBitrate:Math.floor(this.estimatedVideoBitrate)}),this.lastVideoReport=e}}}}dispose(){this._client.off("*",this._eventHandler),this._client.off(Ct.CANDIDATE_CREATE,this._candidateCreateHandler),this._client.off(Ct.HOST_ENDPOINT_CHANGED,this._hostEndpointChangedHandler),super.dispose()}}const rz={pubnub:window.PubNub,userId:`user-${Math.floor(65536*Math.random()).toString(16)}`,publishKey:void 0,subscribeKey:void 0,authToken:void 0,cloudEndpoint:void 0,backendUrl:void 0,backendURL:void 0,expiryMinutes:120,channelId:"red5",logLevel:"trace"};var xr;(function(r){r.CONNECTED="PubNub.Connected",r.DISCONNECTED="PubNub.Disconnected",r.SUBSCRIBE_SUCCESS="PubNub.Subscribe.Success",r.SUBSCRIBE_FAILURE="PubNub.Subscribe.Failure",r.UNSUBSCRIBE_SUCCESS="PubNub.Unsubscribe.Success",r.UNSUBSCRIBE_FAILURE="PubNub.Unsubscribe.Failure",r.MESSAGE_RECEIVED="PubNub.Message.Received",r.MESSAGE_SEND_SUCCESS="PubNub.Message.Send.Success",r.MESSAGE_SEND_FAILURE="PubNub.Message.Send.Failure",r.AUTH_TOKEN_GENERATED="PubNub.AuthToken.Generated",r.AUTH_TOKEN_GENERATION_ERROR="PubNub.AuthToken.Generation.Error",r.STATUS="PubNub.Status",r.ERROR="PubNub.Error"})(xr||(xr={}));const CA="PubNubService";class EA{constructor(){}_decodeToken(e){const t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(atob(t).split("").map(s=>"%"+("00"+s.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(n)}async getAuthTokenFromBackendService(e){var t;const{userId:n,backendUrl:s,backendURL:i,channelId:o="red5",expiryMinutes:l=120}=e;if(!s&&!i)throw new Error("Backend URL is required. Please provide a backend URL in the pubnub configuration.");const c={userId:n,channelId:o,read:!0,write:!0,ttlMinutes:l};try{const u=await fetch(s||i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!u.ok)throw new Error("Failed to generate auth token. Please try again later.");const d=await u.json(),{token:h}=d;return h}catch(u){throw new Error((t=u.message)!==null&&t!==void 0?t:"Failed to generate auth token. Please try again later.")}}async getAuthTokenFromCloud(e){var t;const{userId:n,cloudEndpoint:s,publishKey:i,subscribeKey:o,channelId:l="red5",expiryMinutes:c=120}=e;if(!s)throw new Error("Cloud endpoint is required. Please provide a cloud endpoint in the pubnub configuration.");try{const d=s.match(/^https?:\/\//)?s:`https://${s}`,h=await fetch(`${d}/config-meetings/api/generate-token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:n,channelId:l,expirationMinutes:c})});if(!h.ok)throw new Error("Failed to generate auth token. Please try again later.");const f=await h.json(),{success:p,token:m}=f;if(!p)throw new Error("Failed to generate auth token. Please try again later.");const g=this._decodeToken(m);if(!g)throw new Error("Failed to decode auth token. Please try again later.");u=`[${CA}] :: Decoded auth token: ${JSON.stringify(g)}`,ve(CA,u);const{uid:v,roomId:b,pubnubPublishKey:y,pubnubSubscribeKey:w,pubnubToken:_}=g;if(v!==n||b!==l)throw new Error("Invalid auth token. Please try again later.");if(y!==i||w!==o)throw new Error("Invalid auth token. Please try again later.");return _}catch(d){throw new Error((t=d.message)!==null&&t!==void 0?t:"Failed to generate auth token. Please try again later.")}var u}}const Dk="PubNubClient",nz={receivePresenceEvents:!0,withPresence:!1},I0=r=>ve(Dk,r),jA=r=>gt(Dk,r),Eo=r=>sr(Dk,r);class GR extends Xx{constructor(){super(),this._subscriptions={}}async _getAuthFromCloud(e){return await new EA().getAuthTokenFromCloud(e)}async _getAuthFromBackend(e){return await new EA().getAuthTokenFromBackendService(e)}async init(e){var t,n,s,i,o,l,c,u;if(this._config={...rz,...e},((t=this._config)===null||t===void 0?void 0:t.cloudEndpoint)||((n=this._config)===null||n===void 0?void 0:n.backendUrl)||((s=this._config)===null||s===void 0?void 0:s.backendURL)){let v;try{if(!((i=this._config)===null||i===void 0)&&i.cloudEndpoint?v=await this._getAuthFromCloud(this._config):(!((o=this._config)===null||o===void 0)&&o.backendUrl||!((l=this._config)===null||l===void 0)&&l.backendURL)&&(v=await this._getAuthFromBackend(this._config)),!v)throw new Error("Failed to get auth token.");this._config.authToken=v,this.trigger(new Xr(xr.AUTH_TOKEN_GENERATED,this,{authToken:v}))}catch(b){return Eo((c=b.message)!==null&&c!==void 0?c:"Failed to get auth token."),this.trigger(new Xr(xr.AUTH_TOKEN_GENERATION_ERROR,this,{error:b.message})),this}}const{pubnub:d,publishKey:h,subscribeKey:f,authToken:p,userId:m,logLevel:g}=this._config;if(!d){const v="PubNub library is not initialized. Please provide a Pub
761Nub library reference in the configuration.";throw this.trigger(new Xr(xr.ERROR,this,{error:v})),Eo(v),new Error(v)}return I0(`Initializing PubNub client with options: ${JSON.stringify({...this._config,...!((u=this._config)===null||u===void 0)&&u.authToken?{authToken:"********"}:{}})}`),this._pubnub=new d({userId:m,publishKey:h,subscribeKey:f,logLevel:g}),this._pubnub.setToken(p),this._pubnub.addListener({message:v=>{var b;I0(`Message received on channel ${v.channel}: ${v.message}`),this.trigger(new Xr(xr.MESSAGE_RECEIVED,this,{...v,userId:(b=this._config)===null||b===void 0?void 0:b.userId}))},presence:v=>{I0(`Presence event on channel ${v.channel}: ${JSON.stringify(v)}`)},status:v=>{const{category:b,operation:y}=v;if(I0(`Status event ${b}`),this.trigger(new Xr(xr.STATUS,this,v)),b==="PNConnectedCategory")this.trigger(new Xr(xr.CONNECTED,this,v)),y==="PNSubscribeOperation"&&this.trigger(new Xr(xr.SUBSCRIBE_SUCCESS,this,v));else if(b==="PNDisconnectedCategory")this.trigger(new Xr(xr.DISCONNECTED,this,v));else if(b!=="PNReconnectedCategory"){if(b==="PNAcknowledgmentCategory")y==="PNUnsubscribeOperation"&&this.trigger(new Xr(xr.UNSUBSCRIBE_SUCCESS,this,v));else if(b==="PNBadRequestCategory")this.trigger(new Xr(xr.ERROR,this,v));else if(b==="PNAccessDeniedCategory"){this.trigger(new Xr(xr.ERROR,this,v));const{message:w,payload:_}=v;if(_!=null&&_.channels&&(_==null?void 0:_.channels.length)>0)for(const N of _.channels)Eo(`Failed to subscribe to channel ${N}: ${w}.`),this.trigger(new Xr(xr.SUBSCRIBE_FAILURE,this,{channel:N}))}}}}),this}async publishMessage(e,t){var n,s;if(!this._pubnub)return Eo("PubNub client not initialized."),!1;try{const i=await this._pubnub.publish({channel:e,message:t});this.trigger(new Xr(xr.MESSAGE_SEND_SUCCESS,this,{...i,channel:e,message:t,userId:(n=this._config)===null||n===void 0?void 0:n.userId}))}catch(i){return Eo((s=i.message)!==null&&s!==void 0?s:`Failed to publish message to channel ${e}.`),this.trigger(new Xr(xr.MESSAGE_SEND_FAILURE,this,{channel:e,message:t})),!1}return!0}async subscribe(e,t){var n;if(!this._pubnub)return Eo("PubNub client not initialized."),!1;if(this._subscriptions[e])return!0;try{const s=this._pubnub.channel(e),i=await s.subscription({...nz,...t});if(!i)throw new Error(`Failed to subscribe to channel ${e}.`);i.subscribe(),this._subscriptions[e]=i}catch(s){return Eo((n=s.message)!==null&&n!==void 0?n:`Failed to subscribe to channel ${e}.`),this.trigger(new Xr(xr.SUBSCRIBE_FAILURE,this,{channel:e})),!1}return!0}async unsubscribe(e){var t;if(!this._pubnub)return!0;if(!this._subscriptions[e])return jA(`Subscription ${e} not found.`),!1;try{await this._subscriptions[e].unsubscribe()}catch(n){Eo((t=n.message)!==null&&t!==void 0?t:`Failed to unsubscribe from channel ${e}.`),this.trigger(new Xr(xr.UNSUBSCRIBE_FAILURE,this,{channel:e}))}return delete this._subscriptions[e],!0}async destroy(){var e;if(this._pubnub)try{await this._pubnub.destroy()}catch(t){jA((e=t.message)!==null&&e!==void 0?e:"Failed to destroy PubNub client.")}return this._subscriptions={},this._pubnub=void 0,this._config=void 0,!0}getOptions(){var e;return(e=this._config)!==null&&e!==void 0?e:{}}get config(){return this._config}get pubnub(){return this._pubnub}}const Rk="WHIPClient",qw=BH,ft=r=>ve(Rk,r),Yr=r=>sr(Rk,r),L0=r=>gt(Rk,r);class sz extends Xx{constructor(e,t,n){super(),this._reconnectAttempts=0,this._reconnectTimeout=null;const s=e?FR(e):qw,i=n||qw,o={...i,...s,endpoint:e,mediaElementId:t?t.id:i.mediaElementId};e&&this.internalInit(o),this._onOrientationChange=this._onOrientationChange.bind(this)}async internalInit(e){await this.init(e),await this.publish()}async generateMediaStream(e){var t,n;const{onGetUserMedia:s}=e;if(s){ft("Requesting gUM from user-defined configuration:onGetUserMedia.");const i=await s();return this.trigger(new Xe(Ct.CONSTRAINTS_ACCEPTED,this,vA(i))),i}{const{mediaConstraints:i}=e;let o;ft(`Requesting gUM using mediaConstraints: ${JSON.stringify(i,null,2)}`);let l=i;const c=await KH(l);return c&&c.media||(o=await yr.gUM(l)),o=(t=c==null?void 0:c.media)!==null&&t!==void 0?t:o,l=(n=c==null?void 0:c.constraints)!==null&&n!==void 0?n:i,ft(`Constraints accepted: ${JSON.stringify(l,null,2)}`),this.trigger(new Xe(Ct.CONSTRAINTS_ACCEPTED,this,{constraints:l,...vA(o)})),o}}async getAndPreviewStreamIfAvailable(){var e;let t=this._mediaStream;if(!t){try{t=t??await this.generateMediaStream(this._options)}catch(n){const s=(e=n.message)!==null&&e!==void 0?e:"Could not generate media stream.";throw this.trigger(new Xe(Ct.CONSTRAINTS_REJECTED,this,{constraints:this._options.mediaConstraints})),new Error(s)}if(!t)throw new Error("Could not generate media stream.")}return this.trigger(new Xe(Ct.MEDIA_STREAM_AVAILABLE,this,t)),this.preview(t),t}establishStatsMonitor(e){return new tz(e,{onStatsReport:this._onStatsReport.bind(this),getPeerConnection:this.getPeerConnection.bind(this),getMessageTransport:this.getMessageTransport.bind(this),on:this.on.bind(this),off:this.off.bind(this),trigger:this.trigger.bind(this),emit:this.emit.bind(this)})}postStatsMonitorEvent(e,t){this._statsMonitor&&this._statsMonitor.postEvent(e,t)}
761reorderCodecPreferences(e,t,n){e.getTransceivers().forEach(s=>{if(s.sender&&s.sender.track){const{kind:i}=s.sender.track;if(t&&i==="video"&&s.setCodecPreferences)try{const{codecs:o}=RTCRtpSender.getCapabilities("video"),l=o.findIndex(c=>c.mimeType===`video/${t}`);if(l>-1){const c=o.slice(0),u=o[l];c.splice(l,1),c.unshift(u),s.setCodecPreferences(c)}}catch(o){L0(`[videoEncoding] Could not set codec preferences for ${t}. ${o.message||o}`)}else if(n&&i==="audio"&&s.setCodecPreferences)try{const{codecs:o}=RTCRtpSender.getCapabilities("audio"),l=o.findIndex(c=>c.mimeType===`audio/${n}`);if(l>-1){const c=o[l];o.splice(l,1),o.unshift(c),s.setCodecPreferences(o)}}catch(o){L0(`[audioEncoding] Could not set codec preferences for ${n}. ${o.message||o}`)}}})}async postOffer(e){var t;try{const{sdp:n}=e;let{videoEncoding:s}=this._options;const{mungeOffer:i,streamMode:o,keyFramerate:l,iceTransport:c,connectionParams:u,mediaConstraints:d,forceVP8:h,audioEncoding:f,offerSDPResolution:p}=this._options;h&&!s&&(s=Db.VP8);let m=n;i&&(ft(`[MUNGE:before] offer: ${m}`),m=i(m),ft(`[MUNGE:after] offer: ${m}`)),p&&(ft(`[MUNGE] Setting resolution on offer: ${m}`),m=((v,b)=>{if(!b)return v;const{width:y,height:w}=b;if(!y||!w)return v;const _=`a=framesize:${y}-${w}`,N=v.split(`\r
762`);let S=N.length;const E=/^m=video/;for(;--S>-1;)if(E.exec(N[S])){for(;++S<N.length;)if(N[S].indexOf("a=mid")>-1){N.splice(S+1,0,_);break}break}return N.join(`\r
763`)})(m,((v,b)=>{let y;if(v)try{const w=v.getVideoTracks()&&v.getVideoTracks()[0];if(w){const _=w.getSettings();y={width:_.width,height:_.height}}}catch(w){gt("[determineMediaResolution]",`Could not determine resolution from MediaStream. ${w.message||w}`)}if(!y)try{const w=b.video,{width:_,height:N}=w;_&&N&&(typeof _=="number"&&typeof N=="number"?y={width:_,height:N}:y={width:_.exact||_.min||_.max||_.ideal||640,height:N.exact||N.min||N.max||N.ideal||480})}catch(w){gt("[determineMediaResolution]",`Could not determine resolution from MediaConstraints. ${w.message||w}`)}return y&&ve("[determineMediaResolution]",`constraints: ${JSON.stringify(y,null,2)}`),y})(this._mediaStream,d)),ft(`[MUNGE:after] offer: ${m}`));const g={...u,mode:o,transport:c,keyFramerate:l};return s&&(g.videoEncoding=s),f&&(g.audioEncoding=f),await((t=this._whipWhepService)===null||t===void 0?void 0:t.postSDPOffer(m,g))}catch(n){throw Yr(n.message||n),n instanceof Pb&&this.trigger(new Xe(at.PUBLISH_INVALID_NAME,this)),n}}async postCandidateFragments(e){var t;const{connectionParams:n}=this._options,s=zR(e);return await((t=this._whipWhepService)===null||t===void 0?void 0:t.trickle(s,n))}async initPubNub(e){var t;try{const n=new GR;this._pubnubClient=n,this._pubnubClient.on("*",s=>{this.trigger(s)}),await n.init(e)}catch(n){return n((t=n.message)!==null&&t!==void 0?t:"Failed to initialize PubNub."),!1}return!0}async deinitPubNub(){var e,t;try{await((e=this._pubnubClient)===null||e===void 0?void 0:e.destroy()),this._pubnubClient=void 0}catch(n){return n((t=n.message)!==null&&t!==void 0?t:"Failed to deinitialize PubNub."),!1}return!0}async init(e){var t,n,s,i;this._options={...qw,...e};const o=BR(this._options),{includeDataChannel:l,disableProxy:c,reconnect:u}=this._options;return u&&(this._options.reconnect={...$H,...u}),this._whipWhepService=new qR(o,l,c,(n=(t=this._options.reconnect)===null||t===void 0?void 0:t.enabled)!==null&&n!==void 0&&n),this._messageTransport=this._whipWhepService,!((s=this._options)===null||s===void 0)&&s.stats&&this.monitorStats(this._options.stats),this._mediaStream=await this.getAndPreviewStreamIfAvailable(),!((i=this._options)===null||i===void 0)&&i.pubnub&&await this.initPubNub(this._options.pubnub),this}async initWithStream(e,t){return this._mediaStream=t,this.init(e)}async publish(e){var t,n,s,i,o,l,c;e&&(this._options.streamName=e);const{forceVP8:u,audioEncoding:d,rtcConfiguration:h,dataChannelConfiguration:f,includeDataChannel:p,signalingSocketOnly:m,enableChannelSignaling:g,connectionParams:v,bandwidth:b,mungeAnswer:y}=this._options;let{videoEncoding:w}=this._options;u&&(w=Db.VP8,this._options.videoEncoding=w),this._mediaStream||(this._mediaStream=await this.getAndPreviewStreamIfAvailable());try{const _=v??{};if(v){const{transcode:U}=v;U&&(_.transcode=U)}const N=await((t=this._whipWhepService)===null||t===void 0?void 0:t.getOptions(_)),S=!!(!((n=this._options)===null||n===void 0)&&n.rtcConfiguration)&&Array.isArray(this._options.rtcConfiguration.iceServers)&&this._options.rtcConfiguration.iceServers.length>0;N!=null&&N.links&&!S&&(this._options.rtcConfiguration={...h,iceServers:N.links}),N!=null&&N.origin&&this.trigger(new Xe(Ct.HOST_ENDPOINT_CHANGED,this,{endpoint:N.origin})),N!=null&&N.statisticsEndpoint&&this._onStatisticsEndpointChange(N.statisticsEndpoint);const E=p||g||m?f:void 0;this._peerConnectionHelper=new JH({onDataChannelError:this._onDataChannelError.bind(this),onSendReceived:this._onSendReceived.bind(this),onMetaData:this._onMetaData.bind(this),onConnectionClosed:this._onConnectionClosed.bind(this),onDataChannelOpen:this._onDataChannelOpen.bind(this),onDataChannelClose:this._onDataChannelClose.bind(this),onDataChannelMessage:this._onDataChannelMessage.bind(this),onPeerConnectionOpen:this._onPeerConnectionOpen.bind(this),onPeerConnectionFail:this._onPeerConnectionFail.bind(this),onPeerConnectionClose:this._onPeerConnectionClose.bind(this),onIceCandidate:this._onIceCandidate.bind(this),onSDPSuccess:this._onSDPSuccess.bind(this),onSDPError:this._onSDPError.bind(this),onStatisticsEndpointChange:this._onStatisticsEndpointChange.bind(this),onPublisherStatus:this._onPublisherStatus.bind(this),onPeerConnectionTrackAdd:this._onPeerConnectionTrackAdd.bind(this),onInsufficientBandwidth:this._onInsufficientBandwidth.bind(this),onSufficientBandwidth:this._onSufficientBandwidth.bind(this),onRecoveringBandwidth:this._onRecoveringBandwidth.bind(this),onUnpublish:this._onUnpublish.bind(this)}),await this._peerConnectionHelper.setUpWithPeerConfiguration(this._options.rtcConfiguration,E),this.trigger(new Xe(Ct.PEER_CONNECTION_AVAILABLE,this,this.getPeerConnection())),this._mediaStream&&this._mediaStream.getTracks().forEac
763h(U=>{var C;(C=this.getPeerConnection())===null||C===void 0||C.addTransceiver(U,{direction:"sendonly"})}),this.reorderCodecPreferences(this.getPeerConnection(),w,d);const T=await((s=this._peerConnectionHelper)===null||s===void 0?void 0:s.createOfferWithoutSetLocal(b));await this._peerConnectionHelper.setLocalDescription(T),this.trigger(new Xe(Ct.OFFER_START,this,T));const{sdp:D}=await this.postOffer(T);let R=D;if(y&&(ft(`[MUNGE:before] answer: ${R}`),R=y(R),ft(`[MUNGE:after] answer: ${R}`)),!this._peerConnectionHelper)throw new Error("SDP Exchange interrupted. Peer Connection Helper not available.");if(await((i=this._peerConnectionHelper)===null||i===void 0?void 0:i.setRemoteDescription({type:"answer",sdp:R})),this.trigger(new Xe(Ct.OFFER_END,this,R)),!this._peerConnectionHelper)throw new Error("SDP Exchange interrupted. Peer Connection Helper not available.");const H=await((o=this._peerConnectionHelper)===null||o===void 0?void 0:o.waitToGatherIce()),{sdp:A}=H;return await this.postCandidateFragments(A),this.trigger(new Xe(Ct.ICE_TRICKLE_COMPLETE,this)),yr.addOrientationChangeHandler(this._onOrientationChange),!((l=this._options)===null||l===void 0)&&l.includeDataChannel||this.trigger(new Xe(at.PUBLISH_START,this)),this}catch(_){throw Yr((c=_.message)!==null&&c!==void 0?c:"Could not publish."),this.trigger(new Xe(at.CONNECT_FAILURE,this,_)),this.unpublish(!0),_}}async unpublish(e=!1,t=!1){var n;ft("[unpublish]"),this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),t||(this._reconnectAttempts=0,this._reconnectTimeout=null),this._peerConnectionHelper&&await this._peerConnectionHelper.tearDown(),this._whipWhepService&&await this._whipWhepService.tearDown(null,e),this._pubnubClient&&await this.deinitPubNub(),this._pubnubClient=void 0,!((n=this._options)===null||n===void 0)&&n.clearMediaOnUnpublish&&!t&&this.unpreview(),t||(this._mediaStream=void 0),this.unmonitorStats(),this._peerConnectionHelper=void 0,this._whipWhepService=void 0,this._messageTransport=void 0,this._publishView=void 0,t||this.trigger(new Xe(at.UNPUBLISH_SUCCESS,this)),yr.removeOrientationChangeHandler(this._onOrientationChange)}async attemptReconnect(e){var t;if(ft("[attemptReconnect]"),this._reconnectTimeout&&clearTimeout(this._reconnectTimeout),!e)return void Yr("Reconnect configuration not provided.");const{enabled:n,timeout:s,maxAttempts:i}=e;if(n){if(this._reconnectAttempts>=i)return Yr("Reconnect attempts exceeded maximum attempts."),void this.trigger(new Xe(at.RECONNECT_FAILURE,this,{error:"Reconnect attempts exceeded maximum attempts."}));try{await this.unpublish(!0,!0)}catch(o){Yr((t=o.message)!==null&&t!==void 0?t:"Could not unpublish for reconnect.")}return this._reconnectAttempts++,this._reconnectTimeout=setTimeout(()=>{this.reconnect(e)},s),this}Yr("Reconnect is not enabled.")}async reconnect(e){var t,n;ft("[reconnect]"),this._reconnectTimeout&&clearTimeout(this._reconnectTimeout),this.trigger(new Xe(at.RECONNECT_START,this));try{await this.init(this._options),await this.publish(),this.trigger(new Xe(at.RECONNECT_SUCCESS,this)),this._reconnectAttempts=0,this._reconnectTimeout=null}catch(s){Yr((t=s.message)!==null&&t!==void 0?t:"Could not reconnect."),this.trigger(new Xe(at.RECONNECT_FAILURE,this,{error:(n=s.message)!==null&&n!==void 0?n:"Could not reconnect."})),this.attemptReconnect(e)}return this}preview(e){const{mediaElementId:t}=this._options;t&&(ft("[preview]"),this._publishView=new ZH(t),this._publishView.preview(e))}unpreview(){this._mediaStream&&this._mediaStream.getTracks().forEach(e=>{e.stop()}),this._publishView&&(ft("[unpreview]"),this._publishView.unpreview()),this._publishView=void 0}monitorStats(e){ft("[monitorStats]");const{host:t,endpoint:n,app:s,streamName:i,connectionParams:o}=this._options,l=e??Gg;return this._statisticsConfiguration={...l,host:t,hostEndpoint:n,app:s,streamName:i,connectionParams:o},this._statsMonitor?L0("Cannot monitor stats without a Peer Connection. Please call `init` before calling `monitorStats`."):this._statsMonitor=this.establishStatsMonitor(this._statisticsConfiguration),this}unmonitorStats(){return this._statsMonitor&&this._statsMonitor.dispose(),this._statsMonitor=void 0,this._statisticsConfiguration=void 0,this}muteAudio(){var e;(e=this.getMessageTransport())===null||e===void 0||e.post({mute:{muteAudio:!0}})}unmuteAudio(){var e;(e=this.getMessageTransport())===null||e===void 0||e.post({mute:{muteAudio:!1}})}muteVideo(){var e;(e=this.getMessageTransport())===null||e===void 0||e.post({mute:{muteVideo:!0}})}unmuteVideo(){var e;(e=this.getMessageTransport())===null||e===void 0||e.post({mute:{muteVideo:!1}})}updateOptimizationParams(e){var t,n;this._options.optimizationParams=e,this._mediaStream&&(!((t=this._options)===null||t===void 0)&&t.optimizationParams)&&
763((n=this._peerConnectionHelper)===null||n===void 0||n.setOptimizationParams(this._mediaStream,e))}async send(e,t){var n;let s=t;try{s=typeof t=="string"?JSON.parse(t):t}catch(i){L0(`Could not parse data as JSON. Sending as message. Error: ${i.message||i}`),s={message:t}}return(n=this.getMessageTransport())===null||n===void 0?void 0:n.post({send:{method:e,data:s}})}async sendPubNub(e,t){return this._pubnubClient?await this._pubnubClient.publishMessage(e,t):(Yr("PubNub client not initialized."),!1)}async subscribePubNub(e,t){return this._pubnubClient?await this._pubnubClient.subscribe(e,t):(Yr("PubNub client not initialized."),!1)}async unsubscribePubNub(e){return this._pubnubClient?await this._pubnubClient.unsubscribe(e):(Yr("PubNub client not initialized."),!1)}async callServer(e,t){var n;try{if(!this.getMessageTransport())throw new Error("Message transport not available");return(n=this.getMessageTransport())===null||n===void 0?void 0:n.postAsync({callAdapter:{method:e,arguments:t}})}catch(s){Yr(s.message||s)}}sendLog(e,t){var n;try{const s=Object.keys(Pl).find(o=>o.toLowerCase()===e.toLowerCase())?e:Pl.DEBUG,i=typeof t=="string"?t:JSON.stringify(t);(n=this.getMessageTransport())===null||n===void 0||n.post({log:s.toUpperCase(),message:i})}catch(s){const i=s.message||s;Yr("Could not send log to server. Message parameter expected to be String or JSON-serializable object."),Yr(i)}}get options(){return this._options}getOptions(){return this._options}getPeerConnection(){var e;return(e=this._peerConnectionHelper)===null||e===void 0?void 0:e.connection}getDataChannel(){var e;return(e=this._peerConnectionHelper)===null||e===void 0?void 0:e.dataChannel}getMediaStream(){return this._mediaStream}getMessageTransport(){return this._messageTransport}getPubNubClient(){return this._pubnubClient}_onDataChannelError(e,t){Yr(`Data channel error: ${t}`),this.trigger(new Xe(Ct.DATA_CHANNEL_ERROR,this,{dataChannel:e,error:t}))}_onSendReceived(e,t){ft(`Send received: ${e} ${JSON.stringify(t)}`),e==="onMetaData"?this._onMetaData(t):this.trigger(new Xe(at.PUBLISH_SEND_INVOKE,this,{methodName:e,data:t}))}_onMetaData(e){ft(`Metadata received: ${JSON.stringify(e)}`),this.trigger(new Xe(at.PUBLISH_METADATA,this,e))}_onConnectionClosed(){ft("Connection closed"),this.unpublish(),this.trigger(new Xe(at.CONNECTION_CLOSED,this))}_onDataChannelOpen(e){ft(`Data channel opened: ${e.label}`),this.trigger(new Xe(Ct.DATA_CHANNEL_OPEN,this,{dataChannel:e})),this.trigger(new Xe(Ct.DATA_CHANNEL_AVAILABLE,this,{name:e.label,dataChannel:e})),this._messageTransport=this._peerConnectionHelper,this.trigger(new Tk(Pu.CHANGE,this,{controller:this,transport:this._messageTransport})),this.trigger(new Xe(at.PUBLISH_START,this))}_onDataChannelClose(e){ft(`Data channel closed: ${e.label}`),this.trigger(new Xe(Ct.DATA_CHANNEL_CLOSE,this,{dataChannel:e}))}_onDataChannelMessage(e,t){ft(`Data channel message: ${t.data}`),this.trigger(new Xe(Ct.DATA_CHANNEL_MESSAGE,this,{dataChannel:e,message:t}))}_onPeerConnectionTrackAdd(e){ft(`Peer connection track added: ${e.id}`),this.trigger(new Xe(Ct.TRACK_ADDED,this,{track:e}))}_onPeerConnectionOpen(){ft("Peer connection opened"),this.trigger(new Xe(Ct.PEER_CONNECTION_OPEN,this,this.getPeerConnection()))}_onPeerConnectionFail(){Yr("Peer connection failed"),this.trigger(new Xe(at.PUBLISH_FAIL,this))}_onPeerConnectionClose(e,t){var n,s,i;ft(`Peer connection closed: ${e.type}`),this._peerConnectionHelper&&this._peerConnectionHelper.tearDown(),this.trigger(new Xe(at.CONNECTION_CLOSED,this,e)),!t||t!==af.GONE&&t!==af.FAILED||!((s=(n=this._options)===null||n===void 0?void 0:n.reconnect)===null||s===void 0)&&s.enabled&&this.attemptReconnect((i=this._options)===null||i===void 0?void 0:i.reconnect)}_onIceCandidate(e){ft(`ICE candidate: ${JSON.stringify(e,null,2)}`),this.trigger(new Xe(Ct.CANDIDATE_CREATE,this,{candidate:e}))}_onUnpublish(){ft("Unpublish received")}_onPublisherStatus(e){var t,n,s;ft("[publisherstatus] - "+JSON.stringify(e,null,2)),e.code&&e.code==="NetStream.Publish.IsAvailable"?this.trigger(new Xe(at.PUBLISH_AVAILABLE,this,e)):(e.code&&e.code==="NetStream.Publish.Start"&&this._mediaStream&&(!((t=this._options)===null||t===void 0)&&t.optimizationParams)&&
vendor: 13,155 bytes, line 763
763((n=this._peerConnectionHelper)===null||n===void 0||n.setOptimizationParams(this._mediaStream,(s=this._options)===null||s===void 0?void 0:s.optimizationParams)),this.trigger(new Xe(at.PUBLISH_STATUS,this,e)))}_onInsufficientBandwidth(e){this.trigger(new Xe(at.PUBLISH_INSUFFICIENT_BANDWIDTH,this,e))}_onSufficientBandwidth(e){this.trigger(new Xe(at.PUBLISH_SUFFICIENT_BANDWIDTH,this,e))}_onRecoveringBandwidth(e){this.trigger(new Xe(at.PUBLISH_RECOVERING_BANDWIDTH,this,e))}_onSDPSuccess(e=void 0){const t=e?": "+JSON.stringify(e,null,2):"";ft(`[onsdpsuccess]:: ${t}`)}_onSDPError(e=void 0){this.trigger(new Xe(at.PUBLISH_FAIL,this));const t=e?": "+JSON.stringify(e,null,2):"";Yr(`[onsdperror]:: ${t}`)}_onOrientationChange(e){const t=this.getMessageTransport();t&&t.post({send:{method:"onMetaData",data:{deviceOrientation:e}}})}_onStatisticsEndpointChange(e){ft(`Statistics endpoint changed: ${e}`),this._statsMonitor&&this._statsMonitor.updateEndpoint(e),this.trigger(new Xe(at.STATISTICS_ENDPOINT_CHANGE,this,{statisticsEndpoint:e}))}_onStatsReport(e,t){this.trigger(new Xe(Ct.STATS_REPORT,this,{connection:e,report:t}))}on(e,t){super.on(e,t)}off(e,t){super.off(e,t)}trigger(e){super.trigger(e)}emit(e,t){this.trigger(new Xe(e,this,t))}getType(){return"RTC"}}const XR={protocol:"https",port:443,app:"live",autoLayoutOrientation:!0,mediaElementId:"red5pro-subscriber",rtcConfiguration:{iceCandidatePoolSize:2,bundlePolicy:"max-bundle"},iceTransport:Rb.UDP,muteOnAutoplayRestriction:!0,maintainConnectionOnSubscribeErrors:!1,dataChannelConfiguration:{name:"red5pro"},signalingSocketOnly:!1,includeDataChannel:!0,maintainStreamVariant:!1,buffer:0,stats:Gg,pubnub:void 0,renegotiationPolicy:void 0,signalingSocketOnly:!1,enableChannelSignaling:!1,includeDataChannel:!0,disableProxy:!0,trickleIce:!0,postEmptyOffer:!1,mungeOffer:void 0,mungeAnswer:void 0},iz={endpoint:Su.DEV_NULL,interval:3e3},Ww="R5ProPlaybackView";class az{constructor(e="red5pro-subscriber"){try{this._targetElement=yr.resolveElement(e)}catch(t){throw sr(Ww,`Could not instantiate a new instance of Red5ProSubscriber. Reason: ${t.message||t}`),t}}attachStream(e){const t=this.isAutoplay;ve(Ww,"[attachstream]"),yr.setVideoSource(this._targetElement,e,t)}detachStream(){ve(Ww,"[detachstream]"),yr.setVideoSource(this._targetElement,null,this.isAutoplay)}get isAutoplay(){return yr.hasAttributeDefined(this._targetElement,"autoplay")}get view(){return this._targetElement}}const Vw="RTCPeerConnectionSubscriber";class oz extends UR{constructor(e){super(e,Vw)}_removeConnectionHandlers(e){e.onconnectionstatechange=null,e.oniceconnectionstatechange=null,e.onicegatheringstatechange=null,e.onsignalingstatechange=null,e.onicecandidate=null,e.ontrack=null,e.onnegotiationneeded=null}_addConnectionHandlers(e){let t;e.onsignalingstatechange=()=>{const n=e.signalingState;ve(Vw,`[peer.onsignalingstatechange] - State: ${n}`)},e.onconnectionstatechange=()=>{const{connectionState:n}=e;n==="connected"?(ve(this._name,"[peerconnection:open]"),this._responder.onPeerConnectionOpen()):n==="failed"||n==="disconnected"?(gt(this._name,`[peerconnection:error]:: ${n}`),n==="failed"&&this._responder.onPeerConnectionFail()):ve(this._name,`[peerconnection:state]:: ${n}`)},e.oniceconnectionstatechange=n=>{const{iceConnectionState:s}=e;ve(this._name,`[peer.oniceconnectionstatechange] - State: ${s}`),s==="failed"?(t&&clearTimeout(t),this._responder.onPeerConnectionFail(),this._responder.onPeerConnectionClose(n)):s==="disconnected"?t=setTimeout(()=>{ve(this._name,"[peer.oniceconnectionstatechange] - Reconnect timeout reached."),clearTimeout(t),this._responder.onPeerConnectionClose(n)},3e3):t&&(ve(this._name,"[peer.oniceconnectionstatechange] - Clearing timeout for reconnect."),clearTimeout(t))},e.onicecandidate=n=>{const{candidate:s}=n;ve(this._name,`[peer.onicecandidate] - Peer Candidate: ${s==null?void 0:s.candidate}`),s&&this._responder.onIceCandidate(s)},e.onnegotiationneeded=()=>{ve(this._name,"[peer.onnegotiationneeded]")},e.onicegatheringstatechange=()=>{const{iceGatheringState:n}=e;ve(this._name,`[peer.onicegatheringstatechange] - State: ${n}`)}}_onDataChannelMessage(e){const t=e;if(super._onDataChannelMessage(e))return!0;const n=this.getJsonFromSocketMessage(t);if(n===null)return gt(this._name,"Determined websocket response not in correct format. Aborting message handle."),!0;ve(this._name,"[datachannel-response]: "+JSON.stringify(n,null,2));const{data:s}=n;if(s&&s.type==="status")return s.code==="NetStream.Play.UnpublishNotify"?(this._responder.onUnpublish(),this._responder.onConnectionClosed(),!0):s.code==="Application.Statistics.Endpoint"?(this._responder.onStatisticsEndpointChange(s.statistics),!0):(ve(Vw,`[datachannel.message] status :: ${s.code}`),this._responder.onSubscriberStatus(s),!0);if(s&&s.status&&s.status==="NetStream.Play.UnpublishNotify")return this._responder.onUnpublish(),this._responder.onConnectionClosed(),!0;if(s&&s.type==="result"){const{message:i}=s;if(i==="Stream switch: Success")try{return this._responder.onStreamSwitchComplete(),!0}catch{}}return this._responder.onDataChannelMessage(this._dataChannel,t),!1}}var Id;(function(r){r.EMPTY="Empty",r.VIDEO="Video",r.AUDIO="Audio",r.FULL="Video/Audio"})(Id||(Id={}));class YR extends Xx{trigger(e){super.trigger(e)}on(e,t){super.on(e,t)}off(e,t){super.off(e,t)}}class lz extends YR{}const cz=[Fe.SUBSCRIBE_START,Fe.SUBSCRIBE_STOP,Fe.SUBSCRIBE_FAIL,Fe.SUBSCRIBE_PUBLISHER_CONGESTION,Fe.SUBSCRIBE_PUBLISHER_RECOVERY,Fe.PLAY_UNPUBLISH,Fe.STREAMING_MODE_CHANGE,Fe.PLAYBACK_STATE_CHANGE,Fe.STATISTICS_ENDPOINT_CHANGE];class uz extends WR{constructor(e,t,n){if(super("RTCSubscriberStats",e,t,n),this.estimatedAudioBitrate=0,this.estimatedVideoBitrate=0,this.lastAudioReport=null,this.lastVideoReport=null,this._eventHandler=s=>{const{type:i,data:o}=s;if(cz.indexOf(i)>-1)if(i===Fe.STREAMING_MODE_CHANGE){const{streamingMode:l,previousStreamingMode:c}=o;this.postEvent(i,{data:{streamingMode:l,previousStreamingMode:c}})}else if(i===Fe.PLAYBACK_STATE_CHANGE){const{code:l}=o;let c;l===bn.AVAILABLE&&(c={timeToFirstFrameMS:new Date().getTime()-this._startTime}),this.postEvent(CH[l],c)}else{if(i===Fe.STATISTICS_ENDPOINT_CHANGE){const{statisticsEndpoint:l}=o;this.updateEndpoint(l,!1)}this.postEvent(i)}},this._candidateCreateHandler=({data:{candidate:s}})=>{const{candidate:i}=s,o=VR(i);o&&(this._identifier.publicIP=o)},this._hostEndpointChangedHandler=({data:{endpoint:s,iceServers:i}})=>{this._appendClientDetails({node:s,iceServers:i})},this._client.on("*",this._eventHandler),this._client.on(Et.CANDIDATE_CREATE,this._candidateCreateHandler),this._client.on(Et.HOST_ENDPOINT_CHANGED,this._hostEndpointChangedHandler),this._client.getPeerConnection())this.start(this._client.getPeerConnection());else{const s=({data:i})=>{this._client.off(Et.PEER_CONNECTION_AVAILABLE,s),this.start(i)};this._client.on(Et.PEER_CONNECTION_AVAILABLE,s)}}_handleStatsReport(e){const{type:t}=e,{include:n}=this._config,s=n&&n.length>0;if(s&&n.indexOf(t)>=-1)this.post(e);else if(!s){if(t===ro.CODEC){const{id:i,clockRate:o,mimeType:l,payloadType:c}=e;this.post({id:i,type:t,clockRate:o,mimeType:l,payloadType:c})}else if(t===ro.CANDIDATE_PAIR){const{availableOutgoingBitrate:i,currentRoundTripTime:o,totalRoundTripTime:l,state:c}=e;this._checkCandidatePairHealth(e),this.post({type:t,availableOutgoingBitrate:i,currentRoundTripTime:o,totalRoundTripTime:l,state:c})}else if([ro.INBOUND,"inboundrtp"].indexOf(t)>-1){const{timestamp:i,kind:o,codecId:l,jitter:c,packetsLost:u,packetsReceived:d,bytesReceived:h}=e,f={type:t,kind:o,codecId:l,jitter:c,packetsLost:u,packetsReceived:d,bytesReceived:h};if(o==="audio"){const{packetsDiscarded:p}=e;if(this.lastAudioReport){const{bytesReceived:m,timestamp:g}=this.lastAudioReport,v=8*(h-m)/(i-g);this.estimatedAudioBitrate=v}this.post({...f,packetsDiscarded:p,estimatedBitrate:Math.floor(this.estimatedAudioBitrate)}),this.lastAudioReport=e}else if(o==="video"){const{firCount:p,frameWidth:m,frameHeight:g,framesDecoded:v,framesDropped:b,framesPerSecond:y,framesReceived:w,freezeCount:_,keyFramesDecoded:N,nackCount:S,pauseCount:E,pliCount:T,totalFreezesDuration:D,totalPausesDuration:R}=e,H={...f,firCount:p,frameWidth:m,frameHeight:g,framesDecoded:v,framesDropped:b,framesPerSecond:y,framesReceived:w,freezeCount:_,keyFramesDecoded:N,nackCount:S,pauseCount:E,pliCount:T,totalFreezesDuration:D,totalPausesDuration:R};if(this.lastVideoReport){const{bytesReceived:A,timestamp:U}=this.lastVideoReport,C=8*(h-A)/(i-U);this.estimatedVideoBitrate=C}this.post({...H,estimatedBitrate:Math.floor(this.estimatedVideoBitrate)}),this.lastVideoReport=e}}}}dispose(){this._client.off("*",this._eventHandler),this._client.off(Et.CANDIDATE_CREATE,this._candidateCreateHandler),this._client.off(Et.HOST_ENDPOINT_CHANGED,this._hostEndpointChangedHandler),super.dispose()}}class dz extends lz{constructor(e,t){super(),this._isVOD=!1,this._name=`SourceHandler-${t}`,this._view=e,this._playbackNotificationCenter=this._view,this.onCanPlay=this._onCanPlay.bind(this),this.onDurationChange=this._onDurationChange.bind(this),this.onEnded=this._onEnded.bind(this),this.onTimeUpdate=this._onTimeUpdate.bind(this),this.onPlay=this._onPlay.bind(this),this.onPause=this._onPause.bind(this),this.onVolumeChange=this._onVolumeChange.bind(this),this.onLoadedData=this._onLoadedData.bind(this),this.onLoadedMetadata=this._onLoadedMetadata.bind(this),this.onResize=this._onResize.bind(this),this.onLoadStart=this._onLoadStart.bind(this),this.onSuspend=this._onSuspend.bind(this),this.onStalled=this._onStalled.bind(this),this.onWaiting=this._onWaiting.bind(this),this.onError=this._onError.bind(this),this.onEncrypted=this._onEncrypted.bind(this),this._addPlaybackNotificationCenterHandlers(this._playbackNotificationCenter),yr.onFullScreenStateChange(this._handleFullScreenChange.bind(this))}_addPlaybackNotificationCenterHandlers(e){e.addEventListener("canplay",this.onCanPlay),e.addEventListener("durationchange",this.onDurationChange),e.addEventListener("ended",this.onEnded),e.addEventListener("timeupdate",this.onTimeUpdate),e.addEventListener("play",this.onPlay),e.addEventListener("pause",this.onPause),e.addEventListener("volumechange",this.onVolumeChange),e.addEventListener("loadeddata",this.onLoadedData),e.addEventListener("loadedmetadata",this.onLoadedMetadata),e.addEventListener("resize",this.onResize),e.addEventListener("loadstart",this.onLoadStart),e.addEventListener("suspend",this.onSuspend),e.addEventListener("stalled",this.onStalled),e.addEventListener("waiting",this.onWaiting),e.addEventListener("error",this.onError),e.addEventListener("encrypted",this.onEncrypted)}_removePlaybackNotificationCenterHandlers(e){e.removeEventListener("canplay",this.onCanPlay),e.removeEventListener("durationchange",this.onDurationChange),e.removeEventListener("ended",this.onEnded),e.removeEventListener("timeupdate",this.onTimeUpdate),e.removeEventListener("play",this.onPlay),e.removeEventListener("pause",this.onPause),e.removeEventListener("volumechange",this.onVolumeChange),e.removeEventListener("loadeddata",this.onLoadedData),e.removeEventListener("loadedmetadata",this.onLoadedMetadata),e.removeEventListener("resize",this.onResize),e.removeEventListener("loadstart",this.onLoadStart),e.removeEventListener("suspend",this.onSuspend),e.removeEventListener("stalled",this.onStalled),e.removeEventListener("waiting",this.onWaiting),e.removeEventListener("error",this.onError)}_handleFullScreenChange(e){var t,n;e?(t=this._view)===null||t===void 0||t.classList.add("red5pro-media-container-full-screen"):(n=this._view)===null||n===void 0||n.classList.remove("red5pro-media-container-full-screen"),this.trigger(new Me(Fe.FULL_SCREEN_STATE_CHANGE,void 0,e))}_cleanup(){this._playbackNotificationCenter&&this._removePlaybackNotificationCenterHandlers(this._playbackNotificationCenter),this._playbackNotificationCenter=void 0,this._view=void 0}_onCanPlay(e){var t;ve(this._name,"[videoelement:event] canplay");const n=(t=this._playbackNotificationCenter)!==null&&t!==void 0?t:e.target,s=this.getControls();s&&s.enable(!0),this.trigger(new Me(Fe.PLAYBACK_STATE_CHANGE,void 0,{code:bn.AVAILABLE,state:wi.AVAILABLE})),this.trigger(new Me(Fe.VOLUME_CHANGE,void 0,{volume:n.volume}))}_onDurationChange(e){var t;ve(this._name,"[videoelement:event] durationchange");const n=(t=this._playbackNotificationCenter)!==null&&t!==void 0?t:e.target,s=this.getControls();s&&s.setPlaybackDuration(n.duration),!isNaN(n.duration)&&Number.isFinite(n.duration)&&(this._isVOD=!0)}_onEnded(){ve(this._name,"[videoelement:event] ended");const e=this.getControls();e&&e.setState(bn.IDLE),this.trigger(new Me(Fe.PLAYBACK_STATE_CHANGE,void 0,{code:bn.IDLE,state:wi.IDLE}))}_onTimeUpdate(e){var t;const n=(t=this._playbackNotificationCenter)!==null&&t!==void 0?t:e.target,s=this.getControls();s&&s.setSeekTime(n.currentTime,this.isVOD()?n.duration:void 0),this.trigger(new Me(Fe.PLAYBACK_TIME_UPDATE,void 0,{time:n.currentTime,duration:n.duration}))}_onPlay(){ve(this._name,"[videoelement:event] play");const e=this.getControls();e&&e.setState(bn.PLAYING),this.trigger(new Me(Fe.PLAYBACK_STATE_CHANGE,void 0,{code:bn.PLAYING,
763state:wi.PLAYING}))}_onPause(){ve(this._name,"[videoelement:event] pause");const e=this.getControls();e&&e.setState(bn.PAUSED),this.trigger(new Me(Fe.PLAYBACK_STATE_CHANGE,void 0,{code:bn.PAUSED,state:wi.PAUSED}))}_onVolumeChange(e){var t;ve(this._name,"[videoelement:event] volumechange");const n=(t=this._playbackNotificationCenter)!==null&&t!==void 0?t:e.target,s=this.getControls();s&&s.getVolume()!==n.volume&&s.setVolume(n.volume),this.trigger(new Me(Fe.VOLUME_CHANGE,void 0,{volume:n.volume}))}_onLoadedData(e){var t,n,s;ve(this._name,"[videoelement:event] loadeddata");const i=(t=this._view)!==null&&t!==void 0?t:e.target;this.trigger(new Me(Fe.VIDEO_DIMENSIONS_CHANGE,void 0,{width:(n=i.videoWidth)!==null&&n!==void 0?n:0,height:(s=i.videoHeight)!==null&&s!==void 0?s:0}))}_onLoadedMetadata(e){var t,n;ve(this._name,"[videoelement:event] loadedmetadata");const s=(t=this._view)!==null&&t!==void 0?t:e.target;this.trigger(new Me(Fe.LOADED_METADATA,void 0,{duration:(n=s.duration)!==null&&n!==void 0?n:0}))}_onResize(e){var t,n,s;ve(this._name,"[videoelement:event] resize");const i=(t=this._view)!==null&&t!==void 0?t:e.target;this.trigger(new Me(Fe.VIDEO_DIMENSIONS_CHANGE,void 0,{width:(n=i.videoWidth)!==null&&n!==void 0?n:0,height:(s=i.videoHeight)!==null&&s!==void 0?s:0}))}_onLoadStart(){ve(this._name,"[videoelement:event] loadstart")}_onSuspend(){ve(this._name,"[videoelement:event] suspend")}_onStalled(){ve(this._name,"[videoelement:event] stalled")}_onWaiting(){ve(this._name,"[videoelement:event] waiting")}_onEncrypted(){ve(this._name,"[videoelement:event] encrypted")}_onError(e){ve(this._name,"[videoelement:event] error"),this.trigger(new Me(Fe.CONNECT_FAILURE,void 0,{error:e.message}))}async attemptAutoplay(e=!1){try{await this.play(),this.isMuted()&&this.trigger(new Me(Fe.AUTO_PLAYBACK_MUTED,void 0,{element:this._view}))}catch(t){e?(this.mute(),this.attemptAutoplay(!1)):this.trigger(new Me(Fe.AUTO_PLAYBACK_FAILURE,void 0,{error:t.message?t.message:t,element:this._view}))}}async play(){var e,t;if(ve(this._name,"[videoelement:action] play"),!(!((e=this._view)===null||e===void 0)&&e.paused))return ve(this._name,"[videoelement:action] play (ALREADY PLAYING)"),!0;try{return await((t=this._view)===null||t===void 0?void 0:t.play()),!0}catch(n){throw sr(this._name,"[videoelement:action] play (FAULT) - "+n.message),n}}async pause(){var e;ve(this._name,"[videoelement:action] pause");try{return await((e=this._view)===null||e===void 0?void 0:e.pause()),!0}catch(t){gt(this._name,"[videoelement:action] pause (CATCH::FAULT) - "+t.message)}return!1}async resume(){var e;ve(this._name,"[videoelement:action] resume");try{return await((e=this._view)===null||e===void 0?void 0:e.play()),!0}catch(t){gt(this._name,"[videoelement:action] resume (CATCH::FAULT) - "+t.message)}return!1}async stop(){var e;ve(this._name,"[videoelement:action] stop");try{return await((e=this._view)===null||e===void 0?void 0:e.pause()),!0}catch(t){gt(this._name,"[videoelement:action] stop (CATCH::FAULT) - "+t.message)}return!1}mute(){this._view&&(this._view.muted=!0);const e=this.getControls();e&&e.setMutedState(!0)}unmute(){this._view&&(this._view.muted=!1);const e=this.getControls();e&&e.setMutedState(!1)}setVolume(e){this.unmute(),this._view&&(this._view.volume=e)}getVolume(){var e,t;return(t=(e=this._view)===null||e===void 0?void 0:e.volume)!==null&&t!==void 0?t:0}seekTo(e,t=void 0){this._view&&(this._view.currentTime=t?e*t:e)}toggleFullScreen(e){try{(e||this._view)&&yr.toggleFullScreen(e??this._view)}catch{}}async unpublish(){var e;try{await this.stop(),(e=this._view)===null||e===void 0||e.dispatchEvent(new Event("ended"))}catch{}}disconnect(){this._cleanup()}isVOD(){return this._isVOD}isMuted(){var e,t;return(t=(e=this._view)===null||e===void 0?void 0:e.muted)!==null&&t!==void 0&&t}getControls(){}}const Pk="WHEPClient",Gw=XR,Ke=r=>ve(Pk,r),xs=r=>sr(Pk,r),vs=r=>gt(Pk,r);class hz extends YR{constructor(e,t,n){super(),this._reconnecting=!1,this._videoMuted=!0,this._audioMuted=!0;const s=e?FR(e):Gw,i=n||Gw,o={...i,...s,endpoint:e,mediaElementId:t?t.id:i.mediaElementId};this._videoUnmuteHandler=this._onVideoUnmute.bind(this),this._audioUnmuteHandler=this._onAudioUnmute.bind(this),e&&this.internalInit(o)}async internalInit(e){await this.init(e),await this.subscribe()}async _runMuteCheck(){var e,t,n;if(this.getPeerConnection())try{let s=this._videoMuted,i=this._audioMuted;const o=await((e=this.getPeerConnection())===null||e===void 0?void 0:e.getStats());if(o==null||o.forEach(c=>{const{type:u,kind:d,bytesReceived:h}=c;u!=="inbound-rtp"&&u!=="inboundrtp"||(d==="video"?s=h<=0:d==="audio"&&(i=h<=0))}),s===this._videoMuted&&i===this._audioMuted)return;this._videoMuted=s,this._audioMuted=i;const l={data:{streamingMode:(t=!this._videoMuted,n=!this._audioMuted,t&&n?Id.FULL:t?Id.VIDEO:n?Id.AUDIO:Id.EMPTY),method:"onMetaData"},type:"metadata",method:"onMetaData",eventTimestamp:new Date().getTime()};this._onMetaData(l)}catch(s){xs(s.message||s)}}_onVideoUnmute(e){const t=e.target;t==null||t.removeEventListener("unmute",this._videoUnmuteHandler);const n=setTimeout(async()=>{clearTimeout(n),this._runMuteCheck()},1e3)}_onAudioUnmute(e){const t=e.target;t==null||t.removeEventListener("unmute",this._audioUnmuteHandler);const n=setTimeout(async()=>{clearTimeout(n),this._runMuteCheck()},1e3)}_attachSourceHandler(e){this._sourceHandler=new dz(e,this.getType())}_glomTrigger(e){e.on("*",t=>{const{type:n,data:s}=t;this.trigger(new Me(n,this,s))})}_playIfAutoplaySet(e,t){var n;if(e&&t){const{muteOnAutoplayRestriction:s}=e;yr.hasAttributeDefined(t,"autoplay")&&((n=this._sourceHandler)===null||n===void 0||n.attemptAutoplay(s))}}addMediaStreamToPlayback(e,t){var n;!this._playbackView&&e&&(this._playbackView=new az(e)),(n=this._playbackView)===null||n===void 0||n.attachStream(t)}async requestOffer(e){var t;Ke("[requestoffer]");const{iceTransport:n,maintainStreamVariant:s,videoEncoding:i,audioEncoding:o,connectionParams:l,mungeOffer:c}=this._options;e.addTransceiver("video",{direction:"recvonly"}),e.addTransceiver("audio",{direction:"recvonly"});const u={transport:n,doNotSwitch:s};
763i&&i!==P_.NONE&&(u.videoEncoding=i),o&&o!==R_.NONE&&(u.audioEncoding=o);const d=l??{},h=await e.createOffer(),f=await((t=this._whipWhepService)===null||t===void 0?void 0:t.postSDPOffer(h.sdp,{...d,...u},!1));if(!f)throw xs("Failed to get offer from WHEP"),new Error("Failed to get offer from WHEP");const{sdp:p}=f;let m=p;return c&&(Ke(`[MUNGE:before] offer: ${m}`),m=c(m),Ke(`[MUNGE:after] offer: ${m}`)),m}async requestAnswer(e){const{mungeAnswer:t}=this._options;let n=(await e.createAnswer()).sdp;return t&&(Ke(`[MUNGE:before] answer: ${n}`),n=t(n),Ke(`[MUNGE:after] answer: ${n}`)),n}async sendAnswer(e){var t;const{connectionParams:n}=this._options;return await((t=this._whipWhepService)===null||t===void 0?void 0:t.postSDPAnswer(e,n))}async postCandidateFragments(e){var t;const{connectionParams:n}=this._options,s=zR(e);return await((t=this._whipWhepService)===null||t===void 0?void 0:t.trickle(s,n))}async initPubNub(e){var t;try{const n=new GR;this._pubnubClient=n,this._pubnubClient.on("*",s=>{this.trigger(s)}),await n.init(e)}catch(n){return n((t=n.message)!==null&&t!==void 0?t:"Failed to initialize PubNub."),!1}return!0}async deinitPubNub(){var e,t;try{await((e=this._pubnubClient)===null||e===void 0?void 0:e.destroy()),this._pubnubClient=void 0}catch(n){return n((t=n.message)!==null&&t!==void 0?t:"Failed to deinitialize PubNub."),!1}return!0}_evaluateRenegotiationPolicy(e,t){const{renegotiationPolicy:n}=this._options;if(n){const{type:s}=n,i=s.toLowerCase();if(Ke(`[evaluateRenegotiationPolicy] - Type: ${e}, Renegotiation Policy: ${n.type}`),e===to.CONNECTION_HEALTH_STATE_REGRESSION&&i==="regression")this._reconnect();else if(e===to.CONNECTION_HEALTH_ICE_TIMEOUT&&i==="timeout")this._reconnect();else if(e===Fe.CONNECTION_CLOSED&&i==="disconnect")this._reconnect();else if(e===to.CONNECTION_HEALTH_EXCESSIVE_RTT&&i==="excessive-rtt"){const{severity:o}=t;!o||o.toLowerCase()!=="critical"&&o.toLowerCase()!=="severe"||this._reconnect()}}}async _reconnect(){var e,t;if(this._reconnecting)Ke("[reconnect] - already in progress. Ignoring request.");else{this._reconnecting=!0,Ke("[reconnect]"),this.trigger(new Me(Fe.RECONNECT_START,this));try{await this.unsubscribe(!0),await this.init(this._options),await this.subscribe()}catch(n){xs((e=n.message)!==null&&e!==void 0?e:"Could not reconnect."),this.trigger(new Me(Fe.RECONNECT_FAILURE,this,{error:(t=n.message)!==null&&t!==void 0?t:"Could not reconnect."}))}finally{this._reconnecting=!1}}}async init(e){var t,n,s;this._options={...Gw,...e},this._options.subscriptionId=this._options.subscriptionId||`subscriber-${Math.floor(65536*Math.random()).toString(16)}`;const i=BR(this._options,"whep"),{includeDataChannel:o,disableProxy:l}=this._options;return this._whipWhepService=new qR(`${i}?requestId=${this._options.subscriptionId}`,o,l),this._messageTransport=this._whipWhepService,(!((t=this._options)===null||t===void 0)&&t.stats||!((n=this._options)===null||n===void 0)&&n.renegotiationPolicy)&&(!this._options.stats&&this._options.renegotiationPolicy&&(this._options.stats=iz),this.monitorStats(this._options.stats,this._options.renegotiationPolicy)),!((s=this._options)===null||s===void 0)&&s.pubnub&&await this.initPubNub(this._options.pubnub),this}async subscribe(){var e,t,n,s,i,o,l,c,u;const{connectionParams:d,rtcConfiguration:h,includeDataChannel:f,signalingSocketOnly:p,enableChannelSignaling:m,dataChannelConfiguration:g}=this._options;try{const b=d||{},y=await((e=this._whipWhepService)===null||e===void 0?void 0:e.getOptions(b));this.trigger(new Me(Fe.CONNECT_SUCCESS,this,(t=this._whipWhepService)===null||t===void 0?void 0:t.getUrl()));const w=!!(!((n=this._options)===null||n===void 0)&&n.rtcConfiguration)&&Array.isArray(this._options.rtcConfiguration.iceServers)&&this._options.rtcConfiguration.iceServers.length>0;y!=null&&y.links&&!w&&(this._options.rtcConfiguration={...h,iceServers:y.links}),y!=null&&y.origin&&this.trigger(new Me(Et.HOST_ENDPOINT_CHANGED,this,{endpoint:y.origin})),y!=null&&y.statisticsEndpoint&&this._onStatisticsEndpointChange(y.statisticsEndpoint);const _=f||m||p?g:void 0;if(this._peerConnectionHelper=new oz({onUnpublish:this._onUnpublish.bind(this),onStreamUnavailable:this._onStreamUnavailable.bind(this),onSubscriberStatus:this._onSubscriberStatus.bind(this),onStreamSwitchComplete:this._onStreamSwitchComplete.bind(this),onDataChannelError:this._onDataChannelError.bind(this),onSendReceived:this._onSendReceived.bind(this),onMetaData:this._onMetaData.bind(this),onConnectionClosed:this._onConnectionClosed.bind(this),onDataChannelOpen:this._onDataChannelOpen.bind(this),onDataChannelClose:this._onDataChannelClose.bind(this),onDataChannelMessage:this._onDataChannelMessage.bind(this),onPeerConnectionOpen:this._onPeerConnectionOpen.bind(this),onPeerConnectionFail:this._onPeerConnectionFail.bind(this),onPeerConnectionClose:this._onPeerConnectionClose.bind(this),onIceCandidate:this._onIceCandidate.bind(this),onSDPSuccess:this._onSDPSuccess.bind(this),onSDPError:this._onSDPError.bind(this),onStatisticsEndpointChange:this._onStatisticsEndpointChange.bind(this)}),await this._peerConnectionHelper.setUpWithPeerConfiguration(this._options.rtcConfiguration,_),(s=this.getPeerConnection())===null||s===void 0||s.addEventListener("track",A=>{const{buffer:U}=this._options;Ke("[peerconnection.ontrack]");const{streams:C,track:M,receiver:L,transceiver:B}=A;L.jitterBufferDelayHint=U,this.trigger(new Me(Et.TRACK_ADDED,this,{streams:C,track:M,receiver:L,transceiver:B})),this._mediaStream=C&&C.length>0?C[0]:void 0,M.kind==="video"?(this._videoMuted=M.muted,M.muted&&M.addEventListener("unmute",this._videoUnmuteHandler)):M.kind==="audio"&&(this._audioMuted=M.muted,M.muted&&M.addEventListener("unmute",this._audioUnmuteHandler)),this._runMuteCheck()}),this.trigger(new Me(Et.PEER_CONNECTION_AVAILABLE,this,this.getPeerConnection())),this.trigger(new Me(Et.OF
763FER_START,this)),!this.getPeerConnection())throw new Error("SDP Exchange interrupted. Peer Connection Helper not available.");const N=await this.requestOffer(this.getPeerConnection()),S=new RTCSessionDescription({type:"offer",sdp:N});if(!this.getPeerConnection())throw new Error("SDP Exchange interrupted. Peer Connection Helper not available.");await((i=this.getPeerConnection())===null||i===void 0?void 0:i.setRemoteDescription(S)),this.trigger(new Me(Et.OFFER_END,this)),this.trigger(new Me(Et.ANSWER_START,this));const E=await this.requestAnswer(this.getPeerConnection()),T=(v=E).includes("stereo=1")?v:v.replace("useinbandfec=1","useinbandfec=1;stereo=1;sprop-stereo=1"),D=new RTCSessionDescription({type:"answer",sdp:T});await((o=this.getPeerConnection())===null||o===void 0?void 0:o.setLocalDescription(D)),await this.sendAnswer(T),this.trigger(new Me(Et.ANSWER_END,this));const R=await this._peerConnectionHelper.waitToGatherIce(),{sdp:H}=R;return await this.postCandidateFragments(H),this.trigger(new Me(Et.ICE_TRICKLE_COMPLETE,this)),this._mediaStream&&(this.trigger(new Me(Et.ON_ADD_STREAM,this,this._mediaStream)),this.addMediaStreamToPlayback(this._options.mediaElementId,this._mediaStream)),!((l=this._playbackView)===null||l===void 0)&&l.view&&this._attachSourceHandler(this._playbackView.view),this._sourceHandler&&this._glomTrigger(this._sourceHandler),this._playIfAutoplaySet(this._options,(c=this._playbackView)===null||c===void 0?void 0:c.view),this}catch(b){throw xs((u=b.message)!==null&&u!==void 0?u:"Could not subscribe."),b instanceof Pb?this._onStreamUnavailable(b):this.trigger(new Me(Fe.CONNECT_FAILURE,this,b)),this._options.maintainConnectionOnSubscribeErrors||this.unsubscribe(!0),b}var v}async unsubscribe(e=!1){var t;Ke("[unsubscribe]"),this._peerConnectionHelper&&await this._peerConnectionHelper.tearDown(),this._whipWhepService&&await this._whipWhepService.tearDown(null,e),this._sourceHandler&&this._sourceHandler.disconnect(),this._pubnubClient&&await this.deinitPubNub(),this.unmonitorStats(),(t=this._playbackView)===null||t===void 0||t.detachStream(),this._playbackView=void 0,this._pubnubClient=void 0,this._whipWhepService=void 0,this._messageTransport=void 0,this._peerConnectionHelper=void 0,this._sourceHandler=void 0,this._mediaStream=void 0,this.trigger(new Me(Fe.SUBSCRIBE_STOP,this))}async send(e,t){var n;let s=t;try{s=typeof t=="string"?JSON.parse(t):t}catch(i){vs(`Could not parse data as JSON. Sending as message. Error: ${i.message||i}`),s={message:t}}return(n=this.getMessageTransport())===null||n===void 0?void 0:n.post({send:{method:e,data:s}})}async sendPubNub(e,t){return this._pubnubClient?await this._pubnubClient.publishMessage(e,t):(xs("PubNub client not initialized."),!1)}async subscribePubNub(e,t){return this._pubnubClient?await this._pubnubClient.subscribe(e,t):(xs("PubNub client not initialized."),!1)}async unsubscribePubNub(e){return this._pubnubClient?await this._pubnubClient.unsubscribe(e):(xs("PubNub client not initialized."),!1)}async callServer(e,t){var n;const s=e==="switchStreams",{app:i,streamName:o}=this._options;if(s){const{path:l}=t[0];this._requestedStreamSwitch=l,Ke(`[callServer:switch]:: ${e}, ${i}/${o} -> ${l}`)}return(n=this.getMessageTransport())===null||n===void 0?void 0:n.postAsync({callAdapter:{method:e,arguments:t}})}sendLog(e,t){var n;try{const s=Object.keys(Pl).find(o=>o.toLowerCase()===e.toLowerCase())?e:Pl.DEBUG,i=typeof t=="string"?t:JSON.stringify(t);(n=this.getMessageTransport())===null||n===void 0||n.post({log:s.toUpperCase(),message:i})}catch(s){const i=s.message||s;xs("Could not send log to server. Message parameter expected to be String or JSON-serializable object."),xs(i)}}enableStandby(){var e;(e=this.getMessageTransport())===null||e===void 0||e.post({mute:{muteAudio:!0,muteVideo:!0}})}disableStandby(){var e;(e=this.getMessageTransport())===null||e===void 0||e.post({mute:{muteAudio:!1,muteVideo:!1}})}muteAudio(){var e;(e=this.getMessageTransport())===null||e===void 0||e.post({mute:{muteAudio:!0}})}unmuteAudio(){var e;(e=this.getMessageTransport())===null||e===void 0||e.post({mute:{muteAudio:!1}})}muteVideo(){var e;(e=this.getMessageTransport())===null||e===void 0||e.post({mute:{muteVideo:!0}})}unmuteVideo(){var e;(e=this.getMessageTransport())===null||e===void 0||e.post({mute:{muteVideo:!1}})}get options(){return this._options}getOptions(){return this._options}getPeerConnection(){var e;return(e=this._peerConnectionHelper)===null||e===void 0?void 0:e.connection}
763getDataChannel(){var e;return(e=this._peerConnectionHelper)===null||e===void 0?void 0:e.dataChannel}getMediaStream(){return this._mediaStream}getMessageTransport(){return this._messageTransport}getPubNubClient(){return this._pubnubClient}getPlayer(){var e;return(e=this._playbackView)===null||e===void 0?void 0:e.view}play(){Ke("[play]"),this._sourceHandler?this._sourceHandler.play():vs("Cannot play without a Source Handler.")}pause(){Ke("[pause]"),this._sourceHandler?this._sourceHandler.pause():vs("Cannot pause without a Source Handler.")}resume(){Ke("[resume]"),this._sourceHandler?this._sourceHandler.resume():vs("Cannot resume without a Source Handler.")}stop(){Ke("[stop]"),this._sourceHandler?this._sourceHandler.stop():vs("Cannot stop without a Source Handler.")}setVolume(e){Ke("[setVolume]"),this._sourceHandler?this._sourceHandler.setVolume(e):vs("Cannot set volume without a Source Handler.")}getVolume(){var e,t,n;return Ke("[getVolume]"),this._sourceHandler?this._sourceHandler.getVolume():(vs("Cannot get volume without a Source Handler."),(n=(t=(e=this._playbackView)===null||e===void 0?void 0:e.view)===null||t===void 0?void 0:t.volume)!==null&&n!==void 0?n:0)}mute(){Ke("[mute]"),this._sourceHandler?this._sourceHandler.mute():vs("Cannot mute without a Source Handler.")}unmute(){Ke("[unmute]"),this._sourceHandler?this._sourceHandler.unmute():vs("Cannot unmute without a Source Handler.")}seekTo(e){Ke("[seekTo]"),this._sourceHandler?this._sourceHandler.seekTo(e):vs("Cannot seek without a Source Handler.")}toggleFullScreen(){Ke("[toggleFullScreen]"),this._sourceHandler?this._sourceHandler.toggleFullScreen():vs("Cannot toggle full screen without a Source Handler.")}monitorStats(e,t){Ke(`[monitorStats]:: Stats: ${e?JSON.stringify(e):"undefined"}`),Ke(`[monitorStats]:: Renegotiation Policy: ${t?JSON.stringify(t):"undefined"}`);const{host:n,endpoint:s,app:i,streamName:o,subscriptionId:l,connectionParams:c}=this._options,u=e??Gg;return this._statisticsConfiguration={...u,host:n,app:i,hostEndpoint:s,streamName:o,subscriptionId:l,connectionParams:c},this._statsMonitor?vs("Cannot monitor stats without a Peer Connection. Please call `init` before calling `monitorStats`."):this._statsMonitor=new uz(this._statisticsConfiguration,{onStatsReport:this._onStatsReport.bind(this),getPeerConnection:this.getPeerConnection.bind(this),getMessageTransport:this.getMessageTransport.bind(this),on:this.on.bind(this),off:this.off.bind(this),trigger:this.trigger.bind(this),emit:this.emit.bind(this)},t),this}unmonitorStats(){return this._statsMonitor&&this._statsMonitor.dispose(),this._statsMonitor=void 0,this._statisticsConfiguration=void 0,this}_onUnpublish(){Ke("[unpublish]"),this.trigger(new Me(Fe.PLAY_UNPUBLISH,this)),this._sourceHandler&&this._sourceHandler.unpublish()}_onStreamUnavailable(e){Ke(`Stream ${this._options.streamName} does not exist.`),Ke("[onstreamunavailable]: "+JSON.stringify(e,null,2)),this.trigger(new Me(Fe.SUBSCRIBE_INVALID_NAME,this))}_onDataChannelError(e,t){xs(`Data channel error: ${t}`),this.trigger(new Me(Et.DATA_CHANNEL_ERROR,this,{dataChannel:e,error:t}))}_onSendReceived(e,t){Ke(`Send received: ${e} ${JSON.stringify(t)}`),e==="onMetaData"?this._onMetaData(t):this.trigger(new Me(Fe.SUBSCRIBE_SEND_INVOKE,this,{methodName:e,data:t}))}_onStreamSwitchComplete(){Ke("[streamswitch::complete]");const e=this._requestedStreamSwitch;this.trigger(new Me(Et.SUBSCRIBE_STREAM_SWITCH,this,{path:e})),this._requestedStreamSwitch=void 0}_onMetaData(e){const{orientation:t,streamingMode:n}=e,s=this._streamingMode;t!==void 0&&t!==this._orientation&&(this._orientation=t,this.trigger(new Me(Fe.ORIENTATION_CHANGE,this,{orientation:parseInt(t,10),viewElement:this._playbackView?this._playbackView.view:void 0}))),n&&n!==void 0&&n!==s&&(this._streamingMode=n,this.trigger(new Me(Fe.STREAMING_MODE_CHANGE,this,{streamingMode:n,previousStreamingMode:s,viewElement:this._playbackView?this._playbackView.view:void 0}))),this.trigger(new Me(Fe.SUBSCRIBE_METADATA,this,e))}_onConnectionClosed(){Ke("Connection closed"),this.unsubscribe(!0),this.trigger(new Me(Fe.CONNECTION_CLOSED,this))}_onDataChannelOpen(e){Ke(`Data channel opened: ${e.label}`),this.trigger(new Me(Et.DATA_CHANNEL_OPEN,this,{dataChannel:e})),this.trigger(new Me(Et.DATA_CHANNEL_AVAILABLE,this,{name:e.label,dataChannel:e})),this._messageTransport=this._peerConnectionHelper,this.trigger(new Tk(Pu.CHANGE,this,{controller:this,transport:this._messageTransport})),this.trigger(new Me(Fe.SUBSCRIBE_START,this))}_onDataChannelClose(e){Ke(`Data channel closed: ${e.label}`),this.trigger(new Me(Et.DATA_CHANNEL_CLOSE,this,{dataChannel:e}))}_onDataChannelMessage(e,t){Ke(`Data channel message: ${t.data}`),this.trigger(new Me(Et.DATA_CHANNEL_MESSAGE,this,{dataChannel:e,message:t}))}_onPeerConnectionOpen(){var e;Ke("Peer connection opened"),this.trigger(new Me(Et.PEER_CONNECTION_OPEN,this,this.getPeerConnection())),!((e=this._options)===null||e===void 0)&&e.includeDataChannel||this.trigger(new Me(Fe.SUBSCRIBE_START,this))}_onPeerConnectionFail(){xs("Peer connection failed"),this.trigger(new Me(Fe.SUBSCRIBE_FAIL,this))}_onPeerConnectionClose(e){Ke(`Peer connection closed: ${e.type}`),this._evaluateRenegotiationPolicy(Fe.CONNECTION_CLOSED)}_onIceCandidate(e){Ke(`ICE candidate: ${e.candidate}`),this.trigger(new Me(Et.CANDIDATE_CREATE,this,{candidate:e}))}_onPeerConnectionTrackAdd(e){Ke(`Peer connection track added: ${e.id}`)}_onSubscriberStatus(e){Ke(`Subscriber status: ${JSON.stringify(e)}`)}_onSDPSuccess(){Ke("SDP success")}_onSDPError(e){xs(`SDP error: ${e}`)}_onStatisticsEndpointChange(e){Ke(`Statistics endpoint changed: ${e}`),this._statsMonitor&&this._statsMonitor.updateEndpoint(e),this.trigger(new Me(Fe.STATISTICS_ENDPOINT_CHANGE,this,{statisticsEndpoint:e}))}_onStatsReport(e,t){this.trigger(new Me(Et.STATS_REPORT,this,{connection:e,report:t}))}on(e,t){super.on(e,t)}off(e,t){super.off(e,t)}trigger(e){super.trigger(e)}emit(e,t){this.trigger(new Me(e,this,t)),this._evaluateRenegotiationPolicy(e,t)}getType(){return"RTC"}}Pd.OPEN,Pd.CLOSE,Pd.ERROR,Pd.FAIL,at.STATISTICS_ENDPOINT_CHANGE;const fz={baseURL:void 0,fullURL:void 0,hlsjsRef:void 0,hlsElement:void 0,usePlaybackControlsUI:!0,options:{debug:!1,backBufferLength:0}};({...XR});var AA,TA;(function(r){r.SEEK_START="Seek.Start",r.SEEK_END="Seek.End"})(AA||(AA={})),function(r){r.CHANGE="Slider.Change",r.CHANGE_START="Slider.Change.Start",r.CHANGE_COMPLETE="Slider.Change.Complete"}(TA||(TA={}));var Lb,Ob;(function(r){r[r.LIVE=0]="LIVE",r[r.VOD=1]="VOD"})(Lb||(Lb={})),function(r){r.LIVE="LiveSeek.LIVE",r.VOD="LiveSeek.VOD"}(Ob||(Ob={}));Lb.LIVE+"",Ob.LIVE,Lb.VOD+"",Ob.VOD;var DA;(function(r){r.LIVE_SEEK_UNSUPPORTED="WebRTC.LiveSeek.Unsupported",r.LIVE_SEEK_ERROR="WebRTC.LiveSeek.Error",r.LIVE_SEEK_ENABLED="WebRTC.LiveSeek.Enabled",r.LIVE_SEEK_DISABLED="WebRTC.LiveSeek.Disabled",r.LIVE_SEEK_LOADING="WebRTC.LiveSeek.FragmentLoading",r.LIVE_SEEK_LOADED="WebRTC.LiveSeek.FragmentLoaded",r.LIVE_SEEK_CHANGE="WebRTC.LiveSeek.Change"})(DA||(DA={}));const pz="15.6.1";DH(Pl.ERROR);ve("RED5",`Red5 Pro HTML SDK Version: ${pz}`);const mz="dca-live",gz="live";function Mb(r){return!!(r!=null&&r.red5_enabled&&(r!=null&&r.red5_host)&&(r!=null&&r.red5_stream_name))}function yz(r){return{host:((r==null?void 0:r.red5_host)??"").trim(),streamName:((r==null?void 0:r.red5_stream_name)??mz).trim(),appName:((r==null?void 0:r.red5_app_name)??gz).trim()}}function bz(r,e,t){return`https://${r.replace(/^https?:\/\//,"").replace(/\/+$/,"")}/as/v1/proxy/whip/${e}/${t}`}function xz(r,e,t){return`https://${r.replace(/^https?:\/\//,"").replace(/\/+$/,"")}/as/v1/proxy/whep/${e}/${t}`}function vz(){const r=k.useRef(null),e=k.useRef(null),t=k.useRef(null),[n,s]=k.useState(!1),[i,o]=k.useState("offline"),[l,c]=k.useState({is_live:!1,title:"Live Camera",publisher_id:null,overlay_enabled:!1,overlay_top_text:null,overlay_bottom_text:null,red5_enabled:!1,red5_host:null,red5_stream_name:null,red5_app_name:null});k.useEffect(()=>{if(!je||!Y)return;Y.from("live_stream_settings").select("is_live, title, publisher_id, overlay_enabled, overlay_top_text, overlay_bottom_text, red5_enabled, red5_host, red5_stream_name, red5_app_name").eq("id",1).maybeSingle().then(({data:f})=>{f&&c(f)});const h=Y.channel("red5_stream_settings_viewer").on("postgres_changes",{event:"*",table:"live_stream_settings",schema:"public"},f=>{const p=f.new;c(p)}).subscribe();return()=>{Y.removeChannel(h)}},[]);const u=k.useCallback(()=>{var p;const h=(p=t.current)==null?void 0:p.getMediaStream();if(!h)return!1;const f=n?e.current:r.current;return f?(f.srcObject=h,f.play().catch(()=>{}),!0):!1},[n]);k.useEffect(()=>{var h;(h=t.current)!=null&&h.getMediaStream()&&u()},[n,u]),k.useEffect(()=>{if(i!=="live")return;let h=!1,f=0;const p=()=>
763{if(h||f>=20)return;f++,u()||setTimeout(p,250)};return p(),()=>{h=!0}},[i,n,u]);const d=k.useCallback(()=>{if(!Mb(l)){o("error");return}o("connecting"),t.current&&(t.current.unsubscribe().catch(()=>{}),t.current=null);const{host:h,appName:f,streamName:p}=yz(l),m=xz(h,f,p),g=r.current;let v;try{v=new hz}catch{o("error");return}v.on("*",b=>{console.log("[Red5 Subscriber]",b.type,b.data??"")}),v.on(Fe.SUBSCRIBE_SUCCESS,()=>{o("live"),u()}),v.on(Fe.SUBSCRIBE_FAIL,()=>{o("error")}),v.on(Fe.DISCONNECT,()=>{o("error")}),v.on(Fe.CLOSE,()=>{l.is_live?o("connecting"):o("offline")}),v.init({streamName:p,endpoint:m,mediaElementId:g==null?void 0:g.id,connectionParams:{nodeGroup:"default"}}).then(()=>v.subscribe()).then(()=>{o("live"),u()}).catch(()=>{o("error")}),t.current=v},[l,u]);return k.useEffect(()=>{if(l.is_live&&Mb(l)){const h=setTimeout(()=>d(),100);return()=>clearTimeout(h)}else t.current&&(t.current.unsubscribe().catch(()=>{}),t.current=null),r.current&&(r.current.srcObject=null),e.current&&(e.current.srcObject=null),o("offline");return()=>{t.current&&(t.current.unsubscribe().catch(()=>{}),t.current=null)}},[l.is_live,l.red5_host,l.red5_stream_name,l.red5_enabled,d]),k.useEffect(()=>()=>{t.current&&(t.current.unsubscribe().catch(()=>{}),t.current=null)},[]),{videoRef:r,fullscreenVideoRef:e,isFullscreen:n,setIsFullscreen:s,status:i,settings:l,connect:d}}function RA(r,e){return r.overlay_enabled?a.jsxs(a.Fragment,{children:[r.overlay_top_text&&a.jsx("div",{className:`absolute top-0 left-0 right-0 z-10 bg-black/70 backdrop-blur-sm flex items-center justify-center ${e?"py-2.5":"py-1"}`,children:a.jsx("span",{className:`text-white font-semibold uppercase tracking-wide truncate px-3 ${e?"text-base":"text-[11px]"}`,children:r.overlay_top_text})}),r.overlay_bottom_text&&a.jsx("div",{className:`absolute bottom-0 left-0 right-0 z-10 bg-black/70 backdrop-blur-sm overflow-hidden ${e?"py-2":"py-1"}`,children:a.jsx("div",{className:"ticker-track whitespace-nowrap",style:e?{animationDuration:"24s"}:{animationDuration:"16s"},children:a.jsx("span",{className:`text-white font-semibold ${e?"text-sm px-8":"text-[11px] px-4"}`,children:r.overlay_bottom_text})})})]}):null}function wz(){const{videoRef:r,fullscreenVideoRef:e,isFullscreen:t,setIsFullscreen:n,status:s,settings:i,connect:o}=vz(),[l,c]=k.useState(!1);if(!i.is_live)return null;if(t)return a.jsxs("div",{className:"fixed inset-0 z-[300] bg-black flex items-center justify-center",children:[a.jsx("button",{onClick:()=>n(!1),className:"absolute top-4 right-4 z-20 w-10 h-10 rounded-full bg-white/15 hover:bg-white/30 text-white flex items-center justify-center transition-colors","aria-label":"Exit fullscreen",children:a.jsx(tt,{className:"w-5 h-5"})}),a.jsxs("div",{className:"absolute top-4 left-4 z-20 flex items-center gap-2 bg-black/50 backdrop-blur-sm rounded px-3 py-1.5",children:[a.jsx("span",{className:"w-2 h-2 rounded-full bg-red-500 animate-pulse"}),a.jsx("span",{className:"text-white text-sm font-semibold uppercase tracking-wider",children:i.title})]}),a.jsxs("button",{onClick:()=>n(!1),className:"absolute bottom-4 right-4 z-20 flex items-center gap-2 bg-white/15 hover:bg-white/25 text-white text-sm px-4 py-2 rounded-full transition-colors",children:[a.jsx(vU,{className:"w-4 h-4"}),"Exit Fullscreen"]}),a.jsx("video",{id:"red5pro-subscriber-fullscreen",ref:e,autoPlay:!0,playsInline:!0,className:"w-full h-full object-contain"}),RA(i,!0)]});if(l)return a.jsx("div",{className:"fixed bottom-4 right-4 z-[250]",children:a.jsxs("button",{onClick:()=>c(!1),className:"flex items-center gap-2 bg-red-600 hover:bg-red-700 text-white rounded-full shadow-lg pl-3 pr-4 py-2.5 transition-colors",children:[a.jsx("span",{className:"w-2 h-2 rounded-full bg-white animate-pulse"}),a.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",children:"Watch Live"}),a.jsx(fa,{className:"w-4 h-4"})]})});const u=s==="live",d=s==="connecting",h=s==="error";return a.jsx("div",{className:"fixed bottom-4 right-4 z-[250] w-[300px] sm:w-[340px]",children:a.jsxs("div",{className:"rounded-xl overflow-hidden bg-black border border-gray-700 shadow-2xl",children:[a.jsxs("div",{className:"flex items-center justify-between bg-gray-900 px-3 py-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"w-2 h-2 rounded-full bg-red-500 animate-pulse"}),a.jsx("span",{className:"text-white text-xs font-semibold uppercase tracking-wider truncate max-w-[160px]",children:i.title})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>n(!0),className:"text-white/60 hover:text-white p-1 transition-colors",title:"Fullscreen",children:a.jsx(nA,{className:"w-3.5 h-3.5"})}),a.jsx("button",{onClick:()=>c(!0),className:"text-white/60 hover:text-white p-1 transition-colors",title:"Minimize",children:a.jsx(Ws,{className:"w-3.5 h-3.5"})})]})]}),a.jsxs("div",{className:"relative aspect-video bg-black cursor-pointer group",onClick:()=>n(!0),children:[a.jsx("video",{id:"red5pro-subscriber",ref:r,autoPlay:!0,playsInl
763ine:!0,muted:!0,className:"w-full h-full object-cover"}),u&&RA(i,!1),u&&a.jsx("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:a.jsxs("div",{className:"bg-black/60 backdrop-blur-sm rounded-full px-3 py-1.5 flex items-center gap-1.5",children:[a.jsx(nA,{className:"w-3.5 h-3.5 text-white"}),a.jsx("span",{className:"text-white text-xs font-semibold",children:"Click to enlarge"})]})}),d&&a.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-black",children:[a.jsx(_e,{className:"w-6 h-6 text-white/60 animate-spin mb-2"}),a.jsx("span",{className:"text-white/60 text-xs",children:"Connecting to live stream…"})]}),h&&a.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center p-3 text-center bg-black",children:i.is_live?a.jsxs(a.Fragment,{children:[a.jsx(Ve,{className:"w-5 h-5 text-red-400 mb-1.5"}),a.jsx("span",{className:"text-white/70 text-xs mb-2",children:"Stream connection lost"}),a.jsx("button",{onClick:()=>o(),className:"text-xs font-semibold text-white bg-white/20 hover:bg-white/30 px-3 py-1.5 rounded-full transition-colors",children:"Reconnect"})]}):a.jsxs(a.Fragment,{children:[a.jsx(D_,{className:"w-5 h-5 text-gray-400 mb-1.5"}),a.jsx("span",{className:"text-white/70 text-xs",children:"The live stream has ended"})]})})]})]})})}function Uo({category:r,size:e="md"}){const t=Cb[r]??Cb.local;return a.jsx("span",{className:`inline-block font-body font-bold uppercase tracking-widest ${t.bgColor} ${t.color} ${e==="sm"?"text-[10px] px-1.5 py-0.5":"text-xs px-2.5 py-1"}`,children:t.label})}const yy={x:50,y:50,aspectRatio:"16/9"};function KR(r){try{return`focal_point_${btoa(r)}`}catch{return`focal_point_${encodeURIComponent(r).slice(0,80)}`}}function PA(r){try{const e=localStorage.getItem(KR(r));if(!e)return null;const t=JSON.parse(e);if(typeof t.x=="number"&&typeof t.y=="number")return{x:t.x,y:t.y,aspectRatio:t.aspectRatio??yy.aspectRatio}}catch{}return null}function IA(r,e){try{localStorage.setItem(KR(r),JSON.stringify(e))}catch{}}function _z(r,e){const[t,n]=k.useState(()=>e||(r?PA(r)??yy:yy)),s=k.useRef("");k.useEffect(()=>{!r||s.current===r||(s.current=r,lH(r).then(d=>{d&&(n(d),IA(r,d))}))},[r]);const i=k.useRef(void 0);k.useEffect(()=>{var h,f,p;if(!e||((h=i.current)==null?void 0:h.x)===e.x&&((f=i.current)==null?void 0:f.y)===e.y&&((p=i.current)==null?void 0:p.aspectRatio)===e.aspectRatio)return;i.current=e,(r?PA(r):null)||n(e)},[e,r]);const o=k.useCallback(d=>{n(d)},[]),l=k.useCallback(async d=>{n(d),r&&(IA(r,d),await cH(r,d))},[r]),c=k.useCallback(()=>({objectPosition:`${t.x}% ${t.y}%`}),[t]),u=k.useCallback(()=>({aspectRatio:t.aspectRatio??yy.aspectRatio}),[t]);return{focalPoint:t,setFocalPoint:o,saveFocalPoint:l,getFocalPointStyle:c,getContainerStyle:u}}const O0=[{label:"16:9",value:"16/9",w:160,h:90},{label:"3:2",value:"3/2",w:135,h:90},{label:"4:3",value:"4/3",w:120,h:90},{label:"1:1",value:"1/1",w:90,h:90},{label:"3:4",value:"3/4",w:68,h:90},{label:"2:3",value:"2/3",w:60,h:90}];function Ld(r,e,t){return Math.min(t,Math.max(e,r))}function Nz(r,e){return{x:Math.round(Ld((r.clientX-e.left)/e.width*100,0,100)),y:Math.round(Ld((r.clientY-e.top)/e.height*100,0,100))}}function JR({imageUrl:r,initialFocalPoint:e,onSave:t,onClose:n,isOpen:s}){const[i,o]=k.useState(e??{x:50,y:50,aspectRatio:"16/9"}),l=k.useRef(!1),c=k.useRef(null),u=k.useRef(null);k.useEffect(()=>{s&&o(e??{x:50,y:50,aspectRatio:"16/9"})},[s,e]),k.useEffect(()=>{var m;if(!s)return;(m=u.current)==null||m.focus();function p(g){g.key==="Escape"&&n()}return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[s,n]);const d=k.useCallback((p,m)=>{if(!c.current)return;const g=c.current.getBoundingClientRect(),{x:v,y:b}=Nz({clientX:p,clientY:m},g);o(y=>({...y,x:v,y:b}))},[]),h=k.useCallback(p=>{p.preventDefault(),l.current=!0,d(p.clientX,p.clientY)},[d]);if(k.useEffect(()=>{function p(g){l.current&&d(g.clientX,g.clientY)}function m(){l.current=!1}return document.addEventListener("mousemove",p),document.addEventListener("mouseup",m),()=>{document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",m)}},[d]),k.useEffect(()=>{function p(g){const v=g.touches[0];v&&l.current&&d(v.clientX,v.clientY)}function m(){l.current=!1}return document.addEventListener("touchmove",p,{passive:!0}),document.addEventListener("touchend",m),()=>{document.removeEventListener("touchmove",p),document.removeEventListener("touchend",m)}},[d]),!s)return null;const f=O0.find(p=>p.value===i.aspectRatio)??O0[0];return a.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center bg-black/70 p-4 overflow-y-auto",onClick:p=>{p.target===p.currentTarget&&n()},"aria-modal":"true",role:"dialog","aria-label":"Set image focal point",children:a.jsxs("div",{className:"bg-gray-900 rounded-2xl shadow-2xl w-full max-w-2xl overflow-hidden my-auto",children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-gray-700",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"font-headline text-white text-lg font-bold",children:"Set Focal Point"}),a.jsx("p",{className:"font-body text-gray-400 text-xs mt-0.5",children:"Choose a crop ratio, then click or drag to position the focal point"})]}),a.jsx("button",{ref:u,type:"button",onClick:n,className:"p-2 rounded-lg text-gray-400 hover:text-white hover:bg-gray-700 transition","aria-label":"Close focal point picker",children:a.jsx(tt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"px-5 pt-4",children:[a.jsx("p",{className:"font-body text-xs text-gray-500 uppercase tracking-wider mb-2.5",children:"Crop ratio"}),a.jsx("div",{className:"flex gap-2 flex-wrap",children:O0.map(p=>a.jsx("button",{type:"button",onClick:()=>o(m=>({...m,aspectRatio:p.value})),className:`px-3 py-1.5 rounded-full font-body text-xs font-semibold border transition ${i.aspectRatio===p.value?"bg-brand-red border-brand-red text-white":"bg-gray-800 border-gray-600 text-gray-300 hover:border-gray-400"}`,children:p.label},p.value))})]}),a.jsxs("div",{className:"px-5 py-4",children:[a.jsxs("div",{className:"relative w-full overflow-hidden rounded-xl cursor-crosshair select-none bg-gray-800 mx-auto",style:{aspectRatio:i.aspectRatio??"16/9",maxHeight:"40vh"},ref:c,onMouseDown:h,onTouchStart:p=>{l.current=!0;const m=p.touches[0];m&&d(m.clientX,m.clientY)},role:"slider","aria-label":"Focal point position","aria-valuetext":`X: ${i.x}%, Y: ${i.y}%`,tabIndex:0,onKeyDown:p=>{const m=p.shiftKey?5:1;p.key==="ArrowLeft"&&o(g=>({...g,x:Ld(g.x-m,0,100)})),p.key==="ArrowRight"&&o(g=>({...g,x:Ld(g.x+m,0,100)})),p.key==="ArrowUp"&&o(g=>({...g,y:Ld(g.y-m,0,100)})),p.key==="ArrowDown"&&o(g=>({...g,y:Ld(g.y+m,0,100)}))},children:[a.jsx("img",{src:r,alt:"Focal point preview",className:"absolute inset-0 w-full h-full object-cover pointer-events-none select-none",style:{objectPosition:`${i.x}% ${i.y}%`},draggable:!1}),a.jsxs("div",{className:"absolute inset-0 pointer-events-none",children:[a.jsx("div",{className:"absolute top-1/3 left-0 right-0 h-px bg-white/10"}),a.jsx("div",{className:"absolute top-2/3 left-0 right-0 h-px bg-white/10"}),a.jsx("div",{className:"absolute left-1/3 top-0 bottom-0 w-px bg-white/10"}),a.jsx("div",{className:"absolute left-2/3 top-0 bottom-0 w-px bg-white/10"})]}),a.jsxs("div",{className:"absolute w-8 h-8 -translate-x-1/2 -translate-y-1/2 pointer-events-none",style:{left:`${i.x}%`,top:`${i.y}%`},children:[a.jsx("div",{className:"border-2 border-white rounded-full w-full h-full",style:{boxShadow:"0 0 0 1.5px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.6)"}}),a.jsx("div",{className:"absolute inset-0 m-auto w-1.5 h-1.5 bg-white rounded-full",style:{boxShadow:"0 0 0 1px rgba(0,0,0,0.4)"}}),a.jsx("div",{className:"absolute top-1/2 -left-3 -right-3 h-px bg-white/70 -translate-y-1/2"}),a.jsx("div",{className:"absolute left-1/2 -top-3 -bottom-3 w-px bg-white/70 -translate-x-1/2"})]})]}),a.jsxs("p",{className:"font-body text-xs text-gray-400 mt-2 text-center",children:["X: ",a.jsxs("span",{className:"text-white font-semibold",children:[i.x,"%"]}),"  Y: ",a.jsxs("span",{className:"text-white font-semibold",children:[i.y,"%"]}),"  ",a.jsxs("span",{className:"text-gray-500",children:["— image cropped to ",f.label]})]})]}),a.jsxs("div",{className:"px-5 pb-4",children:[a.jsx("p",{className:"font-body text-xs text-gray-500 uppercase tracking-wider mb-3",children:"Live previews at all ratios"}),a.jsx("div",{className:"flex gap-3 flex-wrap",children:O0.map(({label:p,value:m,w:g,h:v})=>a.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[a.jsx("div",{className:`rounded overflow-hidden border bg-gray-800 shrink-0 ${m===i.aspectRatio?"border-brand-red":"border-gray-600"}`,style:{width:g,height:v},children:a.jsx("img",{src:r,alt:`${p} crop preview`,className:"w-full h-full object-cover pointer-events-none",style:{objectPosition:`${i.x}% ${i.y}%`},draggable:!1})}),a.jsx("span",{className:`font-body text-xs ${m===i.aspectRatio?"text-brand-red font-semibold":"text-gray-500"}`,children:p})]},p))})]}),a.jsxs("div",{className:"flex items-center justify-end gap-3 px-5 py-4 border-t border-gray-700",children:[a.jsx("button",{type:"button",onClick:n,className:"font-body text-sm font-semibold text-gray-400 hover:text-white px-4 py-2 rounded-lg hover:bg-gray-700 transition",children:"Cancel"}),a.jsxs("button",{type:"button",onClick:()=>t(i),className:"flex items-center gap-2 font-body text-sm font-semibold text-white bg-brand-red hover:bg-brand-red-dark px-4 py-2 rounded-lg transition",children:[a.jsx(vn,{className:"w-4 h-4"}),"Save Focal Point"]})]})]})})}function Mr({src:r,alt:e,imageId:t,className:n="",containerClassName:s="",enforceAspectRatio:i=!1,initialFocalPoint:o,style:l,...c}){const u=t??r,{focalPoint:d,saveFocalPoint:h,getFocalPointStyle:f,getContainerStyle:p}=_z(u,o),[m,g]=k.useState(!1),[v,b]=k.useState(!1);k.useEffect(()=>{if(!Y)return;Y.auth.getSession().then(({data:E})=>{if(!E.session){b(!1);return}Y.from("staff_roles").select("id").eq("user_id",E.session.user.id).maybeSingle().then(({data:T})=>b(!!T))});const{data:S}=Y.auth.onAuthStateChange((E,T)=>{if(!T){b(!1);return}Y.from("staff_roles").select("id").eq("user_id",T.user.id).maybeSingle().then(({data:D})=>b(!!D))});return()=>S.subscription.unsubscribe()},[]);const y=i?p():void 0,{objectPosition:w,..._}=l??{},N={...f(),..._};return a.jsxs("div",{className:`relative group overflow-hidden ${s}`,style:y,children:[a.jsx("img",{src:r,alt:e,className:`${i?"w-full h-full object-cover":""} ${n}`.trim(),style:N,...c}),v&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",onClick:S=>{S.preventDefault(),S.stopPropagation(),g(!0)},className:"absolute top-2 right-2 z-10 p-1.5 rounded-full bg-black/40 text-white opacity-0 group-hover:opacity-100 transition-opacity duration-200 hover:bg-black/70 cursor-pointer","aria-label":"Set image focal point",title:"Set focal point",children:a.jsx(_R,{className:"w-3.5 h-3.5"})}),a.jsx(JR,{imageUrl:r,imageId:t,initialFocalPoint:d,isOpen:m,onSave:S=>{h(S),g(!1)},onClose:()=>g(!1)})]})]})}function Kx({article:r}){return a.jsxs($e,{to:`/article/${r.slug}`,className:"group block relative overflow-hidden bg-brand-black",children:[r.image_url&&a.jsxs("div",{className:"absolute inset-0",children:[a.jsx(Mr,{src:r.image_url,alt:r.title,imageId:r.id,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-700 opacity-60",containerClassName:"w-full h-full"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black via-black/50 to-transparent"})]}),r.is_breaking&&a.jsx("div",{className:"absolute top-4 left-4 z-10",children:a.jsx("span",{className:"bg-brand-red text-white font-body font-bold uppercase tracking-widest text-xs px-3 py-1.5 animate-pulse",children:"Breaking News"})}),a.jsx("div",{className:"relative z-10 flex flex-col justify-end min-h-[380px] md:min-
763h-[480px] p-6 md:p-8",children:a.jsxs("div",{className:"max-w-3xl",children:[a.jsx(Uo,{category:r.category}),a.jsx("h2",{className:"font-headline text-white text-2xl md:text-4xl font-bold leading-tight mt-3 group-hover:text-gray-100 transition-colors",children:r.title}),a.jsx("p",{className:"font-body text-gray-300 mt-2 md:mt-3 text-sm md:text-base leading-relaxed line-clamp-2",children:r.excerpt}),a.jsxs("div",{className:"flex flex-wrap items-center gap-4 mt-4 text-gray-400 text-xs font-body",children:[a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx(Wl,{className:"w-3.5 h-3.5"}),r.author]}),a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx(zr,{className:"w-3.5 h-3.5"}),rf(r.published_at)]}),a.jsx("span",{className:"text-gray-500",children:bR(r.content)})]}),a.jsxs("div",{className:"inline-flex items-center gap-2 mt-4 text-white font-semibold text-sm group-hover:gap-3 transition-all",children:["Read Full Story",a.jsx(vR,{className:"w-4 h-4"})]})]})})]})}function no({article:r,variant:e="standard"}){return e==="sidebar"?a.jsxs($e,{to:`/article/${r.slug}`,className:"group block py-3 border-b border-gray-100 last:border-0",children:[r.image_url&&a.jsx(Mr,{src:r.image_url,alt:r.title,imageId:r.id,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300",containerClassName:"w-full aspect-[3/2] bg-gray-100 mb-2",loading:"lazy"}),a.jsx(Uo,{category:r.category,size:"sm"}),a.jsx("h4",{className:"font-headline font-bold text-brand-black group-hover:text-brand-red transition-colors text-sm leading-snug mt-1 line-clamp-3",children:r.title}),a.jsx("p",{className:"font-body text-xs text-gray-400 mt-1",children:xi(r.published_at)})]}):e==="list"?a.jsxs($e,{to:`/article/${r.slug}`,className:"group flex gap-3 py-3 border-b border-gray-100 last:border-0 items-start",children:[r.image_url&&a.jsx(Mr,{src:r.image_url,alt:r.title,imageId:r.id,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300",containerClassName:"w-20 h-16 flex-shrink-0 bg-gray-100",loading:"lazy"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx(Uo,{category:r.category,size:"sm"}),a.jsx("h4",{className:"font-headline font-bold text-brand-black group-hover:text-brand-red transition-colors text-sm leading-snug mt-1 line-clamp-2",children:r.title}),a.jsx("p",{className:"font-body text-xs text-gray-400 mt-1",children:xi(r.published_at)})]})]}):e==="compact"?a.jsxs($e,{to:`/article/${r.slug}`,className:"group block py-3 border-b border-gray-100 last:border-0",children:[a.jsx(Uo,{category:r.category,size:"sm"}),a.jsx("h4",{className:"font-headline font-bold text-brand-black group-hover:text-brand-red transition-colors text-sm leading-snug mt-1 line-clamp-2",children:r.title}),a.jsx("p",{className:"font-body text-xs text-gray-400 mt-1",children:xi(r.published_at)})]}):e==="feature"?a.jsxs($e,{to:`/article/${r.slug}`,className:"group block bg-white border border-gray-200 hover:border-gray-300 hover:shadow-md transition-all",children:[r.image_url&&a.jsx(Mr,{src:r.image_url,alt:r.title,imageId:r.id,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-500",containerClassName:"aspect-[16/9] bg-gray-100",loading:"lazy"}),a.jsxs("div",{className:"p-4",children:[a.jsx(Uo,{category:r.category}),a.jsx("h3",{className:"font-headline font-bold text-brand-black group-hover:text-brand-red transition-colors text-lg leading-tight mt-2",children:r.title}),a.jsx("p",{className:"font-body text-gray-600 text-sm mt-2 leading-relaxed line-clamp-3",children:r.excerpt}),a.jsxs("div",{className:"flex items-center gap-3 mt-3 text-xs text-gray-400 font-body",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(Wl,{className:"w-3 h-3"}),r.author]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(zr,{className:"w-3 h-3"}),xi(r.published_at)]})]})]})]}):a.jsxs($e,{to:`/article/${r.slug}`,className:"group block bg-white border border-gray-200 hover:border-gray-300 hover:shadow-sm transition-all",children:[r.image_url&&a.jsx(Mr,{src:r.image_url,alt:r.title,imageId:r.id,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-500",containerClassName:"aspect-[3/2] bg-gray-100",loading:"lazy"}),a.jsxs("div",{className:"p-3",children:[a.jsx(Uo,{category:r.category,size:"sm"}),a.jsx("h3",{className:"font-headline font-bold text-brand-black group-hover:text-brand-red transition-colors text-base leading-snug mt-1.5 line-clamp-2",children:r.title}),a.jsx("p",{className:"font-body text-gray-500 text-xs mt-1.5 line-clamp-2",children:r.excerpt}),a.jsx("p",{className:"font-body text-xs text-gray-400 mt-2",children:xi(r.published_at)})]})]})}function Bs({title:r,subtitle:e,className:t="",action:n}){return a.jsx("div",{className:`mb-5 ${t}`,children:a.jsx("div",{className:"rule-double pb-2",children:a.jsxs("div",{className:"flex items-end justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"font-headline text-xl md:text-2xl font-bold text-brand-black leading-tight",children:r}),e&&a.jsx("p",{className:"font-body text-xs text-gray-500 mt-0.5 uppercase tracking-widest",children:e})]}),n&&a.jsx("div",{className:"flex-shrink-0",children:n})]})})})}const LA={leaderboard:{wrapper:"w-full",img:"w-full h-auto block"},"in-content":{wrapper:"w-full",img:"w-full h-auto block"},sidebar:{wrapper:"w-full",img:"w-full h-auto block"},footer:{wrapper:"w-full",img:"w-full h-auto block"}};function U_({ad:r,page:e,zone:t,className:n=""}){const s=k.useRef(!1),[i,o]=k.useState(!1);k.useEffect(()=>{s.current||(s.current=!0,YU(r.id))},[r.id,e]),k.useEffect(()=>{if(!i)return;const p=m=>{m.key==="Escape"&&o(!1)};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[i]);const l=t??r.zone??"sidebar",c=LA[l]??LA.sidebar,u=r.ad_width&&r.ad_height,d=u?{maxWidth:"100%",height:"auto",display:"block"}:void 0,h=!!(r.link_url&&r.link_url.trim());if(!r.image_url)return a.jsx("div",{className:`bg-gray-100 border-2 border-dashed border-gray-300 rounded flex items-center justify-center p-4 ${c.wrapper} ${n}`,children:a.jsxs("span",{className:"text-gray-400 text-xs text-center",children:["Advertisement",a.jsx("br",{}),r.name]})});const f=a.jsx("img",{src:r.image_url,alt:r.name,className:u?"group-hover:opacity-95 transition-opacity duration-200 block":`${c.img} group-hover:opacity-95 transition-opacity duration-200`,style:d,loading:"lazy"});return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:`${u?"":c.wrapper} ${n}`,children:[h?a.jsx("a",{href:r.link_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>uA(r.id),className:`block overflow-hidden rounded shadow-sm hover:shadow-md transition-shadow group ${u?"":"w-full"}`,style:u?{maxWidth:"100%"}:void 0,children:f}):a.jsx("button",{type:"button",onClick:()=>{uA(r.id),o(!0)},className:`block overflow-hidden rounded shadow-sm hover:shadow-md transition-shadow group cursor-zoom-in text-left ${u?"":"w-full"}`,style:u?{maxWidth:"100%"}:void 0,children:f}),a.jsxs("div",{className:"flex items-center justify-between mt-0.5",children:[h?a.jsxs("span",{className:"flex items-center gap-1 text-[10px] font-body font-bold text-brand-red",children:[a.jsx(vu,{className:"w-3 h-3"}),"Click to Visit"]}):a.jsxs("span",{className:"flex items-center gap-1 text-[10px] font-body text-gray-400",children:[a.jsx(ki,{className:"w-3 h-3"}),"Click to enlarge"]}),a.jsx("span",{className:"text-[9px] text-gray-400 uppercase tracking-wider font-body",children:"Ad"})]})]}),i&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm",onClick:()=>o(!1),children:a.jsxs("div",{className:"relative max-w-[90vw] max-h-[90vh]",onClick:p=>p.stopPropagation(),children:[a.jsx("button",{type:"button",onClick:()=>o(!1),className:"absolute -top-3 -right-3 z-10 w-8 h-8 bg-white rounded-full shadow-lg flex items-center justify-center text-gray-700 hover:text-gray-900 hover:shadow-xl transition-all","aria-label":"Close",children:a.jsx(tt,{className:"w-4 h-4"})}),a.jsx("img",{src:r.image_url,alt:r.name,className:"block max-w-[90vw] max-h-[90vh] rounded shadow-2xl object-contain"})]})})]})}function Jx({slotBeforeFirst:r,slotAfterFirst:e}={}){const[t,n]=k.useState([]),i=It().pathname;return k.useEffect(()=>{jR("sidebar",i).then(n)},[i]),a.jsxs("aside",{className:"w-36 sm:w-52 lg:w-72 xl:w-80 flex-shrink-0 space-y-4 sm:sp
763ace-y-6",children:[r,t[0]&&a.jsx(U_,{ad:t[0],page:i,zone:"sidebar"}),e,t.slice(1).map(o=>a.jsx(U_,{ad:o,page:i,zone:"sidebar"},o.id))]})}function Xg({variant:r="full",className:e=""}){const t=Ug();return r==="compact"?a.jsxs("div",{className:`flex items-center gap-1.5 ${e}`,children:[a.jsx(Eb,{className:"w-3.5 h-3.5 text-brand-red flex-shrink-0"}),a.jsxs("span",{className:"font-body text-xs text-gray-500 italic",children:["Est. July 1, 1921 — ",t," years of continuous publication"]})]}):a.jsxs("div",{className:`border border-gray-200 rounded px-4 py-3 text-center bg-gray-50 ${e}`,children:[a.jsxs("div",{className:"flex items-center justify-center gap-2 mb-1",children:[a.jsx("div",{className:"h-px bg-brand-red flex-1"}),a.jsx(Eb,{className:"w-4 h-4 text-brand-red"}),a.jsx("div",{className:"h-px bg-brand-red flex-1"})]}),a.jsx("p",{className:"font-headline italic text-brand-red text-sm font-semibold",children:"Every week without fail since July 1, 1921"}),a.jsxs("p",{className:"font-body text-xs text-gray-500 mt-0.5",children:[t," Years • Dixie County, Florida"]})]})}function ze({zone:r,page:e,className:t=""}){const[n,s]=k.useState([]);return k.useEffect(()=>{jR(r,e).then(s)},[r,e]),n.length===0?null:a.jsxs("div",{className:t,children:[a.jsx("div",{className:"text-center text-xs text-gray-400 mb-1 uppercase tracking-widest font-body",children:"Advertisement"}),n.map(i=>a.jsx(U_,{ad:i,page:e,zone:r,className:"mb-2 last:mb-0"},i.id))]})}const Sz=[{name:"Cross City",url:"https://api.weather.gov/gridpoints/TAE/131,55/forecast"},{name:"Old Town",url:"https://api.weather.gov/gridpoints/TAE/136,54/forecast"},{name:"Suwannee",url:"https://api.weather.gov/gridpoints/TAE/131,41/forecast"},{name:"Trenton",url:"https://api.weather.gov/gridpoints/JAX/25,29/forecast"}];function OA(r,e,t="w-5 h-5"){const n=r.toLowerCase();return n.includes("thunder")||n.includes("storm")?a.jsx(lU,{className:`${t} text-amber-500`}):n.includes("snow")||n.includes("blizzard")||n.includes("flurr")?a.jsx(uU,{className:`${t} text-sky-300`}):n.includes("drizzle")||n.includes("mist")?a.jsx(oU,{className:`${t} text-sky-400`}):n.includes("rain")||n.includes("shower")?a.jsx(cU,{className:`${t} text-sky-500`}):n.includes("wind")&&!n.includes("cloud")?a.jsx(OU,{className:`${t} text-gray-400`}):n.includes("overcast")||n.includes("cloudy")?a.jsx(S_,{className:`${t} text-gray-400`}):n.includes("partly")||n.includes("mostly")?a.jsx(S_,{className:`${t} text-gray-300`}):e?a.jsx(T_,{className:`${t} text-amber-400`}):a.jsx(T_,{className:`${t} text-slate-400`})}function kz(){const[r,e]=k.useState([]),[t,n]=k.useState(0),[s,i]=k.useState(!0),[o,l]=k.useState(!1);return k.useEffect(()=>{Promise.all(Sz.map(c=>fetch(c.url,{headers:{"User-Agent":"LSAMedia-WeatherWidget ([email protected])",Accept:"application/geo+json"}}).then(u=>{if(!u.ok)throw new Error("fetch failed");return u.json()}).then(u=>({name:c.name,periods:u.properties.periods})))).then(c=>{e(c),i(!1)}).catch(()=>{l(!0),i(!1)})},[]),a.jsxs("div",{className:"border border-gray-200 bg-white overflow-hidden",children:[a.jsxs("div",{className:"bg-brand-red text-white px-3 py-2 flex items-center gap-2",children:[a.jsx(T_,{className:"w-4 h-4"}),a.jsx("h3",{className:"font-semibold text-sm uppercase tracking-widest",children:"Local Weather"})]}),s&&a.jsxs("div",{className:"flex items-center justify-center gap-2 py-8 text-gray-400 text-xs",children:[a.jsx(_e,{className:"w-4 h-4 animate-spin"}),"Loading forecast…"]}),o&&a.jsxs("div",{className:"flex items-center gap-2 px-4 py-5 text-xs text-gray-500",children:[a.jsx(xR,{className:"w-4 h-4 text-amber-400 shrink-0"}),"Weather data unavailable. Please check back shortly."]}),!s&&!o&&r.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex border-b border-gray-200 overflow-x-auto",children:r.map((c,u)=>a.jsx("button",{onClick:()=>n(u),className:`flex-1 text-xs font-semibold py-2 px-1 whitespace-nowrap transition-colors border-b-2 ${t===u?"border-brand-red text-brand-red bg-white":"border-transparent text-gray-500 hover:text-brand-black bg-gray-50"}`,children:c.name},c.name))}),(()=>{const c=r[t],u=c.periods[0];return u?a.jsxs("div",{className:"px-4 pt-4 pb-3",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[a.jsx("div",{className:"shrink-0",children:OA(u.shortForec
763ast,u.isDaytime,"w-10 h-10")}),a.jsxs("div",{className:"min-w-0",children:[a.jsxs("p",{className:"text-3xl font-bold text-brand-black leading-none",children:[u.temperature,"°",u.temperatureUnit]}),a.jsxs("p",{className:"text-xs text-gray-500 mt-0.5 truncate",children:[c.name,", FL"]})]})]}),a.jsx("p",{className:"text-sm text-gray-700 font-medium leading-snug",children:u.shortForecast}),a.jsxs("p",{className:"text-xs text-gray-400 mt-1",children:["Wind ",u.windSpeed," ",u.windDirection]}),a.jsx("div",{className:"grid grid-cols-3 gap-1 mt-3 pt-3 border-t border-gray-100",children:c.periods.slice(1,4).map(d=>a.jsxs("div",{className:"text-center py-1",children:[a.jsx("p",{className:"text-xs text-gray-500 leading-tight truncate px-0.5",children:d.name}),a.jsx("div",{className:"flex justify-center my-1",children:OA(d.shortForecast,d.isDaytime,"w-4 h-4")}),a.jsxs("p",{className:"text-xs font-bold text-brand-black",children:[d.temperature,"°"]}),a.jsx("p",{className:"text-xs text-gray-400 leading-tight truncate px-0.5",children:d.shortForecast})]},d.number))})]}):null})()]})]})}function Cz(){const[r,e]=k.useState(null),[t,n]=k.useState(""),[s,i]=k.useState("idle");k.useEffect(()=>{if(!je||!Y)return;Y.from("live_stream_settings").select("scheduled_at, scheduled_title, scheduled_description, is_live, title").eq("id",1).maybeSingle().then(({data:p})=>{p&&e(p)});const f=Y.channel("scheduled_stream_banner").on("postgres_changes",{event:"*",table:"live_stream_settings",schema:"public"},p=>e(p.new)).subscribe();return()=>{Y.removeChannel(f)}},[]);const o=async f=>{if(f.preventDefault(),!Y||!t.trim())return;const p=t.trim().toLowerCase();if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(p)){i("error");return}i("loading");const{error:m}=await Y.from("live_stream_subscribers").insert({email:p,phone:null});if(m){m.code==="23505"?i("done"):i("error");return}i("done")};if(!r||r.is_live||!r.scheduled_at)return null;const l=new Date(r.scheduled_at),c=Date.now();if(l.getTime()+2*60*60*1e3<c)return null;const u=l.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric"}),d=l.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit"}),h=l.getTime()<=c;return a.jsx("section",{className:"mb-6 overflow-hidden rounded-lg bg-brand-red text-white shadow-lg","aria-label":"Scheduled live stream",children:a.jsxs("div",{className:"flex items-start gap-4 px-4 py-4 sm:px-6",children:[a.jsx("div",{className:"mt-0.5 flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-white/20",children:a.jsx(wu,{className:"h-6 w-6"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-sm font-bold uppercase tracking-widest text-white/90",children:[a.jsx("span",{className:"text-base sm:text-lg",children:"Dixie County Advocate Exclusive Live Stream"}),a.jsxs("span",{className:"inline-flex items-center gap-1 text-xs sm:text-sm",children:[a.jsx(zr,{className:"h-4 w-4"}),h?"Starting soon":"Upcoming"]})]}),r.scheduled_title&&a.jsx("h2",{className:"mt-1.5 text-xl font-extrabold leading-tight sm:text-2xl sm:font-black",children:r.scheduled_title}),r.scheduled_description&&a.jsx("p",{className:"mt-1.5 text-sm font-medium leading-5 text-white/90 sm:text-base",children:r.scheduled_description}),a.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5 text-sm font-semibold sm:text-base",children:[a.jsx(Jp,{className:"h-4 w-4"}),a.jsx("span",{children:u}),a.jsx("span",{className:"text-white/60",children:"at"}),a.jsx("span",{children:d})]}),a.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 text-sm font-bold sm:text-base",children:[a.jsx(yo,{className:"h-4 w-4"}),a.jsx("span",{children:"Watch it right here on dixiecountyadvocate.com"})]}),a.jsxs("div",{className:"mt-3 flex flex-col gap-2 sm:flex-row sm:items-start sm:gap-3",children:[s==="done"?a.jsxs("div",{className:"flex items-center gap-2 bg-white/20 rounded-lg px-4 py-2.5 text-sm font-semibold",children:[a.jsx(aU,{className:"h-4 w-4 shrink-0"}),a.jsx("span",{children:"You're signed up! We'll notify you the moment we go live."})]}):a.jsx("form",{onSubmit:o,className:"flex flex-col gap-2 w-full",children:a.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-white/90 pt-2 shrink-0",children:[a.jsx(eA,{className:"h-4 w-4 shrink-0"}),a.jsx("span",{children:"Get notified when we go live:"})]}),a.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[a.jsxs("div",{className:"relative",children:[a.jsx(go,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-white/50"}),a.jsx("input",{type:"email",value:t,onChange:f=>{n(f.target.value),i("idle")},placeholder:"[email protected]",className:"w-full sm:w-52 bg-white/15 border border-white/30 rounded-lg pl-9 pr-3 py-2 text-sm text-white placeholder-white/50 focus:outline-none focus:ring-2 focus:ring-white/40 focus:bg-white/25"})]}),a.jsxs("button",{type:"submit",disabled:s==="loading",className:"flex items-center justify-center gap-1.5 bg-white text-brand-red font-bold text-sm px-4 py-2 rounded-lg hover:bg-white/90 transition-colors disabled:opacity-60 whitespace-nowrap",children:[s==="loading"?a.jsx(_e,{className:"h-4 w-4 animate-spin"}):a.jsx(eA,{className:"h-4 w-4"}),"Notify Me"]})]})]})}),s==="error"&&a.jsx("span",{className:"text-xs text-white/80",children:"Please enter a valid email address."})]})]})]})})}function Ez(r){return r.team_score!==null&&r.team_score!==void 0&&r.opponent_score!==null&&r.opponent_score!==void 0}function jz(){const r=new Date,e=r.getDay(),t=new Date(r);return t.setDate(r.getDate()-(e+6)%7),t.setHours(0,0,0,0),Math.floor(t.getTime()/(
7637*24*60*60*1e3))}function Az(r){const e=new Date().toISOString().slice(0,10),t=r.filter(s=>s.school==="Dixie County Bears"&&!Ez(s)).filter(s=>s.sport.toLowerCase().includes("football")).filter(s=>!s.game_date||s.game_date>=e).sort((s,i)=>{const o=s.game_date??"9999-12-31",l=i.game_date??"9999-12-31";return o.localeCompare(l)});if(t.length===0)return null;const n=jz();return t[n%t.length]}function Tz(r){return r.game_date?new Date(`${r.game_date}T00:00:00`).toLocaleDateString("en-US",{weekday:"long"}):r.date_label||"This Week"}function Dz(r){return r.game_date?new Date(`${r.game_date}T00:00:00`).toLocaleDateString("en-US",{month:"short",day:"numeric"}):""}function Rz(){const[r,e]=k.useState(null),[t,n]=k.useState(!0);if(k.useEffect(()=>{Gx().then(l=>e(Az(l))).catch(()=>{}).finally(()=>n(!1))},[]),t||!r)return null;const s=Tz(r),i=Dz(r),o=r.location==="Home"?"HOME":"AWAY";return a.jsx($e,{to:"/sports","aria-label":`Bears vs ${r.opponent}, ${o}, ${s} at ${r.game_time}`,className:"block group overflow-hidden rounded-xl shadow-lg focus:outline-none focus-visible:ring-4 focus-visible:ring-red-300",children:a.jsxs("div",{className:"relative h-[148px] w-full sm:h-[190px] md:h-[230px]",children:[a.jsx("img",{src:"/bear banner.jpg",alt:"","aria-hidden":"true",className:"absolute inset-0 h-full w-full",style:{objectFit:"cover",objectPosition:"center 48%"}}),a.jsx("div",{className:"absolute inset-0 flex items-center justify-center px-[15%] text-center",children:a.jsxs("div",{className:"min-w-0 drop-shadow-[0_3px_5px_rgba(0,0,0,0.9)]",children:[a.jsx("p",{className:"font-body text-xs sm:text-sm md:text-base font-extrabold uppercase tracking-[0.2em] text-white",children:"Dixie County Bears Football"}),a.jsxs("h2",{className:"mt-1 font-headline text-2xl sm:text-4xl md:text-6xl font-black uppercase leading-none tracking-tight text-white",children:["Bears ",a.jsx("span",{className:"text-black",children:"VS"})," ",r.opponent]}),a.jsxs("p",{className:"mt-2 font-body text-sm sm:text-lg md:text-2xl font-extrabold uppercase tracking-[0.1em] text-white",children:[o," · ",s,i?`, ${i}`:""," · ",r.game_time||"7:30 PM"]})]})}),a.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-1 bg-yellow-300/90 transition-colors group-hover:bg-yellow-200"})]})})}function Pz(){const[r,e]=k.useState(null),[t,n]=k.useState([]),[s,i]=k.useState([]),[o,l]=k.useState([]),[c,u]=k.useState(!0),h=It().pathname;return k.useEffect(()=>{Promise.all([jk("local"),CR(10),Rl("sports",3),Rl("community",3)]).then(([f,p,m,g])=>{e(f),n(p.filter(v=>v.id!==(f==null?void 0:f.id))),i(m),l(g)}).catch(()=>{}).finally(()=>u(!1))},[]),c?a.jsx("div",{className:"flex items-center justify-center min-h-[40vh]",children:a.jsx(_e,{className:"w-8 h-8 animate-spin text-brand-red"})}):a.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-6 md:py-8",children:[a.jsx(Cz,{}),a.jsx("div",{className:"mb-6",children:a.jsx(Rz,{})}),a.jsx(ze,{zone:"leaderboard",page:h,className:"mb-6"}),a.jsxs("div",{className:"flex flex-row gap-3 sm:gap-6 lg:gap-8 items-start",children:[a.jsxs("main",{className:"flex-1 min-w-0",children:[r&&a.jsx("div",{className:"mb-8",children:a.jsx(Kx,{article:r})}),t.length>0&&a.jsxs("section",{className:"mb-10",children:[a.jsx(Bs,{title:"Latest News",action:a.jsx($e,{to:"/news",className:"text-xs font-semibold text-brand-red hover:underline uppercase tracking-wider",children:"All News →"})}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-5 mb-5",children:t.slice(0,2).map(f=>a.jsx(no,{article:f,variant:"feature"},f.id))}),a.jsx("div",{className:"border border-gray-200 bg-white divide-y divide-gray-100 px-4",children:t.slice(2,6).map(f=>a.jsx(no,{article:f,variant:"list"},f.id))})]}),s.length>0&&a.jsxs("section",{className:"mb-10",children:[a.jsx(Bs,{title:"Sports",action:a.jsx($e,{to:"/sports",className:"text-xs font-semibold text-brand-red hover:underline uppercase tracking-wider",children:"All Sports →"})}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:s.map(f=>a.jsx(no,{article:f,variant:"standard"},f.id))})]}),a.jsx(Xg,{className:"my-8"}),o.length>0&&a.jsxs("section",{className:"mb-6",children:[a.jsx(Bs,{title:"Community",action:a.jsx($e,{to:"/community",className:"text-xs font-semibold text-brand-red hover:underline uppercase tracking-wider",children:"All Community →"})}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:o.map(f=>a.jsx(no,{article:f,variant:"standard"},f.id))})]}),a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mt-8",children:[{label:"Obituaries",path:"/obituaries",icon:"✦"},{label:"Public Notices",path:"/public-notices",icon:"§"},{label:"Subscribe",path:"/subscribe",icon:"★"},{label:"About Us",path:"/about",icon:"◆"}].map(f=>a.jsxs($e,{to:f.path,className:"flex flex-col items-center justify-center gap-1 border-2 border-gray-200 hover:border-brand-red hover:bg-brand-red hover:text-white text-brand-black py-4 px-3 text-center transition-all group",children:[a.jsx("span",{className:"text-xl group-hover:text-white text-brand-red",children:f.icon}),a.jsx("span",{className:"font-body font-semibold text-xs uppercase tracking-wider",children:f.label})]},f.label))})]}),a.jsx(Jx,{slotAfterFirst:a.jsx(kz,{})})]}),a.jsx(ze,{zone:"footer",page:h,className:"mt-8"})]})}const Iz=["local","perspectives","sports","community","obituaries","gilchrist","notices"],Lz=[{value:"all",label:"All News"},...Iz.map(r=>({value:Cb[r].slug,label:Cb[r].label}))];function Oz(){const[r,e]=WD(),[t,n]=k.useState([]),[s,i]=k.useState(!0),[o,l]=k.useState(r.get("category")??"all"),[c,u]=k.useState(r.get("q")??""),[d,h]=k.useState(r.get("q")??""),[f,p]=k.useState(1),m=9,v=It().pathname,[b,y]=k.useState({});k.useEffect(()=>{Xs("news").then(y)},[]),k.useEffect(()=>{i(!0),(c?ER(c):CR(50)).then(D=>n(D)).catch(()=>n([])).finally(()=>i(!1))},[c]);const w=k.useMemo(()=>o==="all"?t:t.filter(T=>T.category===o),[t,o]),_=w.slice(0,f*m),N=_.length<w.length,S=T=>{T.preventDefault(),u(d),p(1),e(d?{q:d}:{})},E=T=>{l(T),p(1);const D={};T!=="all"&&(D.category=T),c&&(D.q=c),e(D)};return a.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-8",children:[a.jsx(ze,{zone:"leaderboard",page:v,className:"mb-6"}),a.jsx(Bs,{title:c?`Search: "${c}"`:b.page_heading||"News & Stories",subtitle:c?`${w.length} ${w.length===1?"story":"stories"}`:b.page_subtitle||`${w.length} ${w.length===1?"story":"stories"}`}),a.jsxs("form",{onSubmit:S,className:"flex gap-2 mb-6",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(nf,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),a.jsx("input",{type:"text",value:d,onChange:T=>h(T.target.value),placeholder:"Search all stories...",className:"w-full pl-9 pr-4 py-2.5 border border-gray-300 text-sm focus:outline-none focus:border-brand-red font-body"})]}),a.jsx("button",{type:"submit",className:"bg-brand-red hover:bg-brand-red-dark text-white px-5 py-2.5 text-sm font-semibold transition-colors font-body",children:"Search"}),c&&a.jsx("button",{type:"button",onClick:()=>{u(""),h(""),e({})},className:"px-4 py-2.5 border border-gray-300 text-sm text-gray-600 hover:bg-gray-50 font-body",children:"Clear"})]}),a.jsxs("div",{className:"flex items-center gap-2 mb-6 overflow-x-auto pb-1",children:[a.jsx(pU,{className:"w-4 h-4 text-gray-400 flex-shrink-0"}),Lz.map(T=>a.jsx("button",{onClick:()=>E(T.value),className:`flex-shrink-0 px-4 py-1.5 text-xs font-bold uppercase tracking-wider transition-colors font-body ${o===T.value?"bg-brand-red text-white":"border border-gray-200 text-gray-600 hover:border-brand-red hover:text-brand-red bg-white"}`,children:T.label},T.value))]}),a.jsxs("div",{className:"flex flex-row gap-3 sm:gap-6 lg:gap-8 items-start",children:[a.jsxs("main",{className:"flex-1 min-w-0",children:[s?a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx(_e,{className:"w-8 h-8 animate-spin text-brand-red"})}):w.length===0?a.jsxs("div",{className:"text-center py-16",children:[a.jsx(nf,{className:"w-12 h-12 mx-auto text-gray-300 mb-3"}),a.jsx("p",{className:"font-headline text-xl text-gray-500",children:"No stories found"}),a.jsx("p",{className:"font-body text-sm text-gray-400 mt-1",children:"Try different keywords or a different category."})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-5",children:_.map(T=>a.jsx(no,{article:T,variant:"feature"},T.id))}),N&&a.jsx("div",{className:"text-center mt-8",children:a.jsx("button",{onClick:()=>p(T=>T+1),className:"border-2 border-brand-black hover:bg-brand-black hover:text-white text-brand-black font-semibold px-8 py-3 text-sm transition-colors font-body",children:"Load More Stories"})})]}),a.jsx(ze,{zone:"in-content",page:v,className:"mt-8"})]}),a.jsx(Jx,{})]}),a.jsx(ze,{zone:"footer",page:v,className:"mt-8"})]})}function Mz({className:r}
763){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:r,"aria-hidden":"true",children:a.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-4.714-6.231-5.401 6.231H2.747l7.73-8.835L1.254 2.25H8.08l4.258 5.624L18.244 2.25zm-1.161 17.52h1.833L7.084 4.126H5.117L17.083 19.77z"})})}const Fz={local:"/news",sports:"/sports",community:"/community",opinion:"/news",obituaries:"/obituaries",notices:"/public-notices",gilchrist:"/gilchrist",perspectives:"/perspectives"};function M0({images:r,startIndex:e,onClose:t}){const[n,s]=k.useState(e),i=r[n],o=k.useCallback(()=>s(c=>(c-1+r.length)%r.length),[r.length]),l=k.useCallback(()=>s(c=>(c+1)%r.length),[r.length]);return k.useEffect(()=>{function c(u){u.key==="Escape"&&t(),u.key==="ArrowLeft"&&o(),u.key==="ArrowRight"&&l()}return document.addEventListener("keydown",c),document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",c),document.body.style.overflow=""}},[t,o,l]),a.jsxs("div",{className:"fixed inset-0 z-50 bg-black/92 flex flex-col items-center justify-center",onClick:t,children:[r.length>1&&a.jsxs("div",{className:"absolute top-4 left-1/2 -translate-x-1/2 font-body text-xs text-white/60",children:[n+1," / ",r.length]}),a.jsxs("div",{className:"relative max-w-5xl w-full px-3 sm:px-8 md:px-14 flex flex-col items-center",onClick:c=>c.stopPropagation(),children:[a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:t,className:"absolute top-2 left-2 text-white/50 hover:text-white/90 transition-colors z-10","aria-label":"Close",children:a.jsx(tt,{className:"w-4 h-4"})}),a.jsx("img",{src:i.url,alt:i.caption||"",className:"max-h-[80vh] max-w-full object-contain rounded shadow-2xl"})]}),(i.caption||i.attribution)&&a.jsxs("div",{className:"mt-3 text-center font-body text-sm text-white/75 max-w-2xl",children:[i.caption&&a.jsx("span",{className:"italic",children:i.caption}),i.caption&&i.attribution&&a.jsx("span",{className:"mx-1.5 text-white/40",children:"·"}),i.attribution&&a.jsxs("span",{className:"text-white/55",children:["Photo: ",i.attribution]})]})]}),r.length>1&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:c=>{c.stopPropagation(),o()},className:"absolute left-3 top-1/2 -translate-y-1/2 text-white/70 hover:text-white bg-white/10 hover:bg-white/20 rounded-full p-3 transition-colors","aria-label":"Previous photo",children:a.jsx(wR,{className:"w-6 h-6"})}),a.jsx("button",{onClick:c=>{c.stopPropagation(),l()},className:"absolute right-3 top-1/2 -translate-y-1/2 text-white/70 hover:text-white bg-white/10 hover:bg-white/20 rounded-full p-3 transition-colors","aria-label":"Next photo",children:a.jsx(zx,{className:"w-6 h-6"})})]})]})}function Bz({content:r,images:e,onOpenGallery:t,onOpenInline:n}){const s=e.filter(f=>f.position==="inline-top"),i=e.filter(f=>f.position==="inline-mid"),o=e.filter(f=>f.position==="gallery"),l=e.filter(f=>f.position==="bottom"),c=e.filter(f=>/^after:\d+$/.test(f.position)),u=r.split(new RegExp("(?<=<\\/p>)","i")).filter(f=>f.trim()!==""),d=u.length>1?Math.floor((u.length-1)/2):0,h=new Map;for(const f of c){const p=f.position.match(/^after:(\d+)$/);if(!p)continue;const m=parseInt(p[1],10)-1;h.set(m,[...h.get(m)??[],f])}return a.jsxs(a.Fragment,{children:[s.map(f=>a.jsx(xl,{img:f,onClick:()=>n(f)},f.id)),u.map((f,p)=>a.jsxs("span",{children:[a.jsx("div",{className:"article-body font-body text-base leading-relaxed text-gray-800",dangerouslySetInnerHTML:{__html:f}}),(h.get(p)??[]).map(m=>a.jsx(xl,{img:m,onClick:()=>n(m)},m.id)),p===d&&i.map(m=>a.jsx(xl,{img:m,onClick:()=>n(m)},m.id))]},p)),l.map(f=>a.jsx(xl,{img:f,onClick:()=>n(f)},f.id)),o.length>0&&a.jsxs("div",{className:"mt-10 pt-8 border-t border-gray-100",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-5",children:[a.jsx(ia,{className:"w-4 h-4 text-brand-red"}),a.jsx("h3",{className:"font-headline font-bold text-brand-black text-lg",children:"Photos"})]}),a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:o.map((f,p)=>{const m=f.focal_point??{x:50,y:50};return a.jsxs("figure",{children:[a.jsx("button",{type:"button",onClick:()=>t(p),className:"block w-full text-left group focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-red rounded-lg overflow-hidden",children:a.jsxs("div",{className:"overflow-hidden bg-gray-100 border border-gray-200 rounded-lg relative",style:{aspectRatio:"4/3"},children:[a.jsx("img",{src:f.url,alt:f.caption||"",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-[1.03]",style:{objectPosition:`${m.x}% ${m.y}%`}}),a.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/20 transition-colors duration-200 flex items-center justify-center",children:a.jsx(ki,{className:"w-6 h-6 text-white opacity-0 group-hover:opacity-100 transition-opacity duration-200 drop-shadow-lg"})})]})}),f.caption&&a.jsx("figcaption",{className:"font-body text-xs text-gray-500 mt-1.5 leading-snug italic",children:f.caption})]},f.id)})})]})]})}function $z(r){return r.split(`
764`).reduce((e,t)=>
764(t.trim()===""?e.length>0&&e[e.length-1]!==""&&e.push(""):e.push(t),e),[]).filter((e,t,n)=>!(n[t]===""&&(t===0||t===n.length-1)))}function xl({img:r,onClick:e}){const t=r.focal_point??{x:50,y:50,aspectRatio:"4/3"},n=t.aspectRatio??"4/3",s=a.jsxs("div",{className:`w-full max-w-sm sm:max-w-md overflow-hidden rounded-lg border border-gray-100 bg-gray-50 relative${e?" group cursor-zoom-in":""}`,style:{aspectRatio:n},children:[a.jsx("img",{src:r.url,alt:r.caption||"",className:"w-full h-full object-cover",style:{objectPosition:`${t.x}% ${t.y}%`}}),e&&a.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/20 transition-colors duration-200 flex items-center justify-center",children:a.jsx(ki,{className:"w-7 h-7 text-white opacity-0 group-hover:opacity-100 transition-opacity duration-200 drop-shadow-lg"})})]});return a.jsxs("figure",{className:"my-6 flex flex-col items-center",children:[e?a.jsx("button",{type:"button",onClick:e,className:"w-full max-w-sm sm:max-w-md focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-red rounded-lg",children:s}):s,r.caption&&a.jsx("figcaption",{className:"font-body text-xs text-gray-500 italic mt-2 text-center max-w-sm sm:max-w-md",children:r.caption})]})}function Uz({body:r,images:e,onOpenGallery:t,onOpenInline:n}){const s=e.filter(f=>f.position==="gallery"),i=e.filter(f=>f.position==="bottom"),o=e.filter(f=>f.position==="inline-top"),l=e.filter(f=>f.position==="inline-mid"),c=e.filter(f=>/^after:\d+$/.test(f.position)),u=$z(r),d=u.length>1?Math.floor((u.length-1)/2):0,h=new Map;for(const f of c){const p=f.position.match(/^after:(\d+)$/);if(!p)continue;const m=parseInt(p[1],10)-1;h.set(m,[...h.get(m)??[],f])}return a.jsxs(a.Fragment,{children:[o.map(f=>a.jsx(xl,{img:f,onClick:()=>n(f)},f.id)),u.map((f,p)=>a.jsxs("span",{children:[f===""?a.jsx("div",{className:"mt-5"}):a.jsx("p",{className:"font-body text-gray-800 text-base md:text-[1.0625rem] leading-[1.8] mb-5",children:f}),(h.get(p)??[]).map(m=>a.jsx(xl,{img:m,onClick:()=>n(m)},m.id)),p===d&&l.map(m=>a.jsx(xl,{img:m,onClick:()=>n(m)},m.id))]},p)),i.map(f=>a.jsx(xl,{img:f,onClick:()=>n(f)},f.id)),s.length>0&&a.jsxs("div",{className:"mt-10 pt-8 border-t border-gray-100",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-5",children:[a.jsx(ia,{className:"w-4 h-4 text-brand-red"}),a.jsx("h3",{className:"font-headline font-bold text-brand-black text-lg",children:"Photos"})]}),a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:s.map((f,p)=>{const m=f.focal_point??{x:50,y:50};return a.jsxs("figure",{children:[a.jsx("button",{type:"button",onClick:()=>t(p),className:"block w-full text-left group focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-red rounded-lg overflow-hidden",children:a.jsxs("div",{className:"overflow-hidden bg-gray-100 border border-gray-200 rounded-lg relative",style:{aspectRatio:"4/3"},children:[a.jsx("img",{src:f.url,alt:f.caption||"",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-[1.03]",style:{objectPosition:`${m.x}% ${m.y}%`}}),a.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/20 transition-colors duration-200 flex items-center justify-center",children:a.jsx(ki,{className:"w-6 h-6 text-white opacity-0 group-hover:opacity-100 transition-opacity duration-200 drop-shadow-lg"})})]})}),f.caption&&a.jsx("figcaption",{className:"font-body text-xs text-gray-500 mt-1.5 leading-snug italic",children:f.caption})]},f.id)})})]})]})}function Hz(){const{slug:r}=uk(),[e,t]=k.useState(null),[n,s]=k.useState([]),[i,o]=k.useState(!0),[l,c]=k.useState(""),[u,d]=k.useState(null),[h,f]=k.useState(null),[p,m]=k.useState(!1),[g,v]=k.useState(null),b=Mg();k.useEffect(()=>{if(!r){o(!1);return}o(!0),c(""),t(null),$U(r).then(async D=>{if(t(D),D){const R=await Rl(D.category,4);s(R.filter(H=>H.id!==D.id).slice(0,3))}}).catch(D=>{c(D instanceof Error?D.message:"Failed to load article.")}).finally(()=>o(!1))},[r]);const y=typeof window<"u"?window.location.href:"";if(i)return a.jsx("div",{className:"flex items-center justify-center min-h-[40vh]",children:a.jsx(_e,{className:"w-8 h-8 animate-spin text-brand-red"})});if(l)return a.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-16 text-center",children:[a.jsx("p",{className:"font-headline text-2xl text-gray-600 mb-2",children:"Could not load article"}),a.jsx("p",{className:"font-body text-sm text-gray-500 mb-6",children:l}),a.jsx("button",{onClick:()=>b("/news"),className:"bg-brand-red text-white px-6 py-2.5 font-semibold hover:bg-brand-red-dark transition-colors",children:"Back to News"})]});if(!e)return a.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-16 text-center",children:[a.jsx("p",{className:"font-headline text-2xl text-gray-600 mb-4",children:"Story Not Found"}),a.jsx("button",{onClick:()=>b("/news"),className:"bg-brand-red text-white px-6 py-2.5 font-semibold hover:bg-brand-red-dark transition-colors",children:"Back to News"})]});const w=Fz[e.category]??"/news",_=e.story_images??[],N=_.length>0,S=/<p[\s>]/i.test(e.content),E=_.filter(D=>D.position==="gallery"),T=e.additional_images??[];return a.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-8",children:[u!==null&&T.length>0&&a.jsx(M0,{images:T,startIndex:u,onClose:()=>d(null)}),h!==null&&E.length>0&&a.jsx(M0,{images:E,startIndex:h,onClose:()=>f(null)}),p&&e.image_url&&a.jsx(M0,{images:[{url:e.image_url,caption:e.title}],startIndex:0,onClose:()=>m(!1)}),g&&a.jsx(M0,{images:[{url:g.url,caption:g.caption}],startIndex:0,onClose:()=>v(null)}),a.jsx(ze,{zone:"leaderboard",page:w,className:"mb-6 no-print"}),a.jsxs("div",{className:"mb-0",children:[a.jsxs($e,{to:"/news",className:"inline-flex items-center gap-1.5 text-xs font-semibold text-gray-500 hover:text-brand-red transition-colors font-body mb-4 no-print",children:[a.jsx(Wd,{className:"w-3.5 h-3.5"})," Back to News"]}),a.jsx(Uo,{category:e.category}),a.jsx("h1",{className:"font-headline text-3xl md:text-4xl font-bold text-brand-black leading-tight mt-3 mb-3",children:e.title}),e.excerpt&&a.jsx("p",{className:"font-headline italic text-gray-600 text-lg border-l-4 border-brand-red pl-4 leading-relaxed mb-4",children:e.excerpt}),a.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-sm text-gray-500 font-body pb-4 border-b border-gray-200 mb-0",children:[a.jsxs("span",{className:"flex items-center gap-1.5 font-semibold text-brand-black",children:[a.jsx(Wl,{className:"w-4 h-4"}),e.author]}),a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx(zr,{className:"w-4 h-4"}),rf(e.published_at)]}),a.jsx("span",{className:"text-gray-400",children:bR(e.content)})]})]}),e.image_url&&(e.category==="perspectives"?a.jsx("figure",{className:"my-6",children:a.jsxs("button",{type:"button",onClick:()=>m(!0),className:"w-40 h-48 overflow-hidden border border-gray-200 block relative group cursor-zoom-in",children:[a.jsx(Mr,{src:e.image_url,alt:e.title,imageId:e.id,className:"w-full h-full object-cover",containerClassName:"w-full h-full"}),a.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/20 transition-colors duration-200 flex items-center justify-center",children:a.jsx(ki,{className:"w-6 h-6 text-white opacity-0 group-hover:opacity-100 transition-opacity duration-200 drop-shadow-lg"})})]})}):a.jsxs("figure",{className:"my-6 overflow-hidden bg-gray-100 relative group cursor-zoom-in",onClick:()=>m(!0),children:[a.jsx(Mr,{src:e.image_url,alt:e.title,imageId:e.id,enforceAspectRatio:!0,containerClassName:"w-full"}),a.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/20 transition-colors duration-200 flex items-center justify-center pointer-events-none",children:a.jsx(ki,{className:"w-8 h-8 text-white opacity-0 group-hover:opacity-100 transition-opacity duration-200 drop-shadow-lg"})})]})),a.jsxs("div",{className:"flex flex-row gap-3 sm:gap-6 lg:gap-10 items-start",children:[a.jsxs("article",{className:"flex-1 min-w-0 max-w-3xl",children:[N&&S?a.jsx(Bz,{content:e.content,images:_,onOpenGallery:D=>f(D),onOpenInline:D=>v(D)}):N?a.jsx(Uz,{body:e.content,images:_,onOpenGallery:D=>f(D),onOpenInline:D=>v(D)}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"article-body font-body text-base leading-relaxed text-gray-800",dangerouslySetInnerHTML:{__html:e.content}}),T.length>0&&a.jsxs("div",{className:"mt-10 pt-8 border-t border-gray-100",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-5",children:[a.jsx(ia,{className:"w-4 h-4 text-brand-red"}),a.jsx("h3",{className:"font-headline font-bold text-brand-black text-lg",children:"Photos"})]}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-5",children:T.map((D,R)=>a.jsxs("figure",{children:[a.jsx("button",{type:"button",onClick:()=>d(R),className:"block w-full text-left group focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-red",children:a.jsxs("div",{className:"overflow-hidden bg-gray-100 border border-gray-200 relative",style:{aspectRatio:D.aspect_ratio??"4/3"},children:[a.jsx("img",{src:D.url,alt:D.caption||"",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-[1.02]"}),a.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/20 transition-colors duration-200 flex items-center justify-center",children:a.jsx(ki,{className:"w-7 h-7 text-white opacity-0 group-hover:opacity-100 transition-opacity duration-200 drop-shadow-lg"})})]})}),(D.caption||D.attribution)&&a.jsxs("figcaption",{className:"font-body text-xs text-gray-500 mt-1.5 leading-snug",children:[D.caption&&a.jsx("span",{className:"italic",children:D.caption}),D.caption&&D.attribution&&a.jsx("span",{className:"mx-1",children:"·"}),D.attribution&&a.jsxs("span",{children:["Photo: ",D.attribution]})]})]},D.id))})]})]}),a.jsxs("div",{className:"mt-10 pt-6 border-t border-gray-200 no-print",children:[a.jsxs("p",{className:"font-body text-sm font-semibold text-gray-700 mb-3 flex items-center gap-2",children:[a.jsx(EU,{className:"w-4 h-4"}),"Share This Story"]}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsxs("a",{href:`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(y)}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 bg-[#1877f2] text-white px-4 py-2 text-sm font-semibold hover:opacity-90 transition-opacity font-body",children:[a.jsx(NR,{className:"w-4 h-4"})," Facebook"]}),a.jsxs("a",{href:`https://x.com/intent/tweet?url=${encodeURIComponent(y)}&text=${encodeURIComponent(e.title)}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 bg-black text-white px-4 py-2 text-sm font-semibold hover:opacity-80 transition-opacity font-body",children:[a.jsx(Mz,{className:"w-4 h-4"}
764)," X"]}),a.jsxs("a",{href:`mailto:?subject=${encodeURIComponent(e.title)}&body=${encodeURIComponent(y)}`,className:"flex items-center gap-2 bg-gray-600 text-white px-4 py-2 text-sm font-semibold hover:opacity-90 transition-opacity font-body",children:[a.jsx(go,{className:"w-4 h-4"})," Email"]}),a.jsxs("button",{onClick:()=>window.print(),className:"flex items-center gap-2 bg-gray-100 text-gray-700 px-4 py-2 text-sm font-semibold hover:bg-gray-200 transition-colors font-body",children:[a.jsx(Vd,{className:"w-4 h-4"})," Print"]})]})]}),a.jsx(Xg,{variant:"compact",className:"mt-8"})]}),a.jsxs("aside",{className:"w-36 sm:w-52 lg:w-72 xl:w-80 flex-shrink-0 no-print space-y-4 sm:space-y-6",children:[a.jsx(ze,{zone:"sidebar",page:w}),n.length>0&&a.jsxs("div",{className:"hidden lg:block border border-gray-200 bg-white",children:[a.jsx("div",{className:"bg-brand-red text-white px-4 py-2.5",children:a.jsx("h3",{className:"font-semibold text-sm uppercase tracking-widest",children:"Related Stories"})}),a.jsx("div",{className:"px-3 py-2",children:n.map(D=>a.jsx(no,{article:D,variant:"sidebar"},D.id))})]})]})]}),n.length>0&&a.jsxs("div",{className:"mt-12 pt-8 border-t-2 border-brand-red no-print",children:[a.jsx("h2",{className:"font-headline font-bold text-brand-black text-2xl mb-6 uppercase tracking-wide",children:"Related Stories"}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6",children:n.map(D=>a.jsx(no,{article:D,variant:"feature"},D.id))})]})]})}function Cp(r){return r.team_score!==null&&r.team_score!==void 0&&r.opponent_score!==null&&r.opponent_score!==void 0}function zz(r){return Cp(r)&&r.team_score>r.opponent_score}function qz(r){return Cp(r)&&r.team_score<r.opponent_score}function Wz(){const[r,e]=k.useState([]),[t,n]=k.useState(!0);k.useEffect(()=>{Gx().then(o=>{const l=o.filter(c=>c.school==="Dixie County Bears").sort((c,u)=>{const d=c.game_date??"",h=u.game_date??"";return d&&h?d.localeCompare(h):d?-1:h?1:c.sort_order-u.sort_order});e(l)}).catch(()=>{}).finally(()=>n(!1))},[]);const s=r.filter(o=>!Cp(o)),i=r.filter(o=>Cp(o));return a.jsxs("div",{className:"border-2 border-red-700 bg-white overflow-hidden",children:[a.jsxs("div",{className:"bg-red-700 text-white px-3 py-2.5 flex items-center gap-2",children:[a.jsx(_u,{className:"w-4 h-4 opacity-90"}),a.jsx("h3",{className:"font-headline font-bold text-sm uppercase tracking-wider",children:"Bears Schedule"})]}),t?a.jsx("div",{className:"px-3 py-6 text-center text-sm text-gray-400",children:"Loading games…"}):r.length===0?a.jsx("div",{className:"px-3 py-6 text-center text-sm text-gray-400",children:"No games scheduled."}):a.jsxs("div",{className:"divide-y divide-gray-100",children:[s.map(o=>a.jsxs("div",{className:"px-3 py-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-red-700 bg-red-50 px-1.5 py-0.5 rounded",children:o.sport}),a.jsx("span",{className:`text-xs font-bold px-1.5 py-0.5 rounded ${o.location==="Home"?"bg-brand-red text-white":"bg-gray-200 text-gray-700"}`,children:o.location})]}),a.jsx("p",{className:"font-headline font-bold text-sm text-brand-black leading-snug",children:o.opponent}),a.jsxs("div",{className:"flex items-center gap-3 mt-1 text-xs text-gray-500",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(ha,{className:"w-3 h-3"})," ",o.date_label]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(zr,{className:"w-3 h-3"})," ",o.game_time]})]})]},o.id)),i.length>0&&a.jsxs(a.Fragment,{children:[s.length>0&&a.jsx("div",{className:"bg-gray-50 px-3 py-1.5 text-xs font-bold uppercase tracking-wider text-gray-500",children:"Recent Results"}),i.map(o=>{const l=zz(o),c=qz(o);return a.jsxs("div",{className:`px-3 py-3 ${l?"bg-green-50":c?"bg-red-50":"bg-gray-50"}`,children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-gray-500",children:o.sport}),l&&a.jsxs("span",{className:"text-xs font-bold uppercase tracking-wider text-green-700 bg-green-200 px-2 py-0.5 rounded-full flex items-center gap-1",children:[a.jsx(_u,{className:"w-3 h-3"})," Win"]}),c&&a.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-red-700 bg-red-200 px-2 py-0.5 rounded-full",children:"Loss"}),Cp(o)&&o.team_score===o.opponent_score&&a.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-gray-600 bg-gray-200 px-2 py-0.5 rounded-full",children:"Tie"})]}),a.jsx("p",{className:"font-headline font-bold text-sm text-brand-black leading-snug",children:o.opponent}),a.jsxs("div",{className:"flex items-center gap-2 mt-1.5",children:[a.jsx("span",{className:`text-lg font-bold tabular-nums ${l?"text-green-700":c?"text-red-700":"text-gray-700"}`,children:o.team_score}),a.jsx("span",{className:"text-xs text-gray-400",children:"—"}),a.jsx("span",{className:`text-lg font-bold tabular-nums ${l?"text-gray-400":"text-gray-700"}`,children:o.opponent_score}),a.jsxs("span",{className:"text-xs text-gray-400 ml-1 flex items-center gap-1",children:[a.jsx(yo,{className:"w-3 h-3"})," ",o.location]})]}),a.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:o.date_label})]},o.id)})]})]})]})}const Vz="bg-brand-red text-white",Gz=["Dixie County Bears","Trenton Tigers","Bell Bulldogs"],Xz={"Dixie County Bears":"bg-red-700 text-white","Trenton Tigers":"bg-orange-600 text-white","Bell Bulldogs":"bg-purple-700 text-white"},Yz={"Dixie County Bears":"border-red-700","Trenton Tigers":"border-orange-600","Bell Bulldogs":"border-purple-700"};function ZR(r){return r.team_score!==null&&r.team_score!==void 0&&r.opponent_score!==null&&r.opponent_score!==void 0}function Kz(r){return ZR(r)&&r.team_score>r.opponent_score}function Jz(){const[r,e]=k.useState([]),[t,n]=k.useState([]),[s,i]=k.useState(!0),l=It().pathname,[c,u]=k.useState({});k.useEffect(()=>{Xs("sports").then(u)},[]),k.useEffect(()=>{Promise.all([Rl("sports",12),Gx()]).then(([f,p])=>{e(f),n(p)}).catch(()=>{}).finally(()=>i(!1))},[]);const[d,...h]=r;return a.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-8",children:[a.jsx(ze,{zone:"leaderboard",page:l,className:"mb-4"}),a.jsxs("div",{className:`${Vz} px-6 py-5 mb-8 text-center`,children:[a.jsx("p",{className:"font-body text-sm font-semibold uppercase tracking-widest text-white/70 mb-1",children:c.banner_eyebrow||"Dixie County High School"}),a.jsx("h1",{className:"font-masthead text-3xl md:text-4xl font-bold text-white leading-none",children:c.banner_title||"Hurricanes Athletics"}),a.jsx("p",{className:"text-white/80 font-body text-sm mt-1",children:c.banner_subtitle||"Local sports coverage for all Dixie County team
764s"})]}),a.jsxs("div",{className:"flex flex-row gap-3 sm:gap-6 lg:gap-8 items-start",children:[a.jsxs("main",{className:"flex-1 min-w-0",children:[s?a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx(_e,{className:"w-8 h-8 animate-spin text-brand-red"})}):a.jsx(a.Fragment,{children:r.length>0&&a.jsxs(a.Fragment,{children:[d&&a.jsx("div",{className:"mb-8",children:a.jsx(Kx,{article:d})}),h.length>0&&a.jsxs("section",{className:"mb-8",children:[a.jsx(Bs,{title:c.news_section_title||"Sports News"}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-5",children:h.map(f=>a.jsx(no,{article:f,variant:"feature"},f.id))})]})]})}),a.jsx(ze,{zone:"in-content",page:l,className:"mb-8"}),a.jsxs("div",{className:"space-y-5",children:[a.jsx("h2",{className:"font-headline font-bold text-xl text-brand-black",children:c.games_section_title||"Upcoming Games"}),t.length===0?a.jsx("p",{className:"text-center py-6 text-gray-400 font-body text-sm",children:"No games scheduled."}):Gz.map(f=>{const p=t.filter(m=>m.school===f);return a.jsxs("div",{className:`border-2 ${Yz[f]}`,children:[a.jsxs("div",{className:`${Xz[f]} px-4 py-2.5 flex items-center gap-2`,children:[a.jsx(_u,{className:"w-4 h-4 opacity-80"}),a.jsx("h3",{className:"font-headline font-bold text-base",children:f})]}),p.length===0?a.jsx("p",{className:"px-4 py-4 text-center text-gray-400 font-body text-sm",children:"No games scheduled."}):a.jsx("div",{className:"p-4 overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm font-body",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b-2 border-brand-black text-left",children:[a.jsx("th",{className:"py-2 font-bold text-brand-black",children:"Date"}),a.jsx("th",{className:"py-2 font-bold text-brand-black",children:"Sport"}),a.jsx("th",{className:"py-2 font-bold text-brand-black",children:"Opponent"}),a.jsx("th",{className:"py-2 font-bold text-brand-black",children:"Location"}),a.jsx("th",{className:"py-2 font-bold text-brand-black",children:"Time"}),a.jsx("th",{className:"py-2 font-bold text-brand-black text-center",children:"Score"})]})}),a.jsx("tbody",{className:"divide-y divide-gray-100",children:p.map(m=>{const g=ZR(m),v=Kz(m),b=g&&m.team_score<m.opponent_score;return g&&(m.team_score,m.opponent_score),a.jsxs("tr",{className:`transition-colors ${g?v?"bg-green-50":b?"bg-red-50":"bg-gray-50":"hover:bg-gray-50"}`,children:[a.jsx("td",{className:"py-2.5 font-semibold text-brand-red",children:m.date_label}),a.jsx("td",{className:"py-2.5",children:m.sport}),a.jsxs("td",{className:"py-2.5 font-medium",children:[m.opponent,g&&a.jsx("span",{className:`ml-2 text-xs font-bold uppercase tracking-wider px-2 py-0.5 rounded-full ${v?"text-green-700 bg-green-200":b?"text-red-700 bg-red-200":"text-gray-600 bg-gray-200"}`,children:v?"WIN":b?"LOSS":"TIE"})]}),a.jsx("td",{className:"py-2.5",children:a.jsx("span",{className:`text-xs font-bold px-2 py-0.5 ${m.location==="Home"?"bg-brand-red text-white":"bg-gray-200 text-gray-700"}`,children:m.location})}),a.jsx("td",{className:"py-2.5 text-gray-500",children:g?"Final":m.game_time}),a.jsx("td",{className:"py-2.5 text-center",children:g?a.jsxs("span",{className:`font-bold tabular-nums text-base ${v?"text-green-700":b?"text-red-700":"text-gray-700"}`,children:[m.team_score," – ",m.opponent_score]}):a.jsx("span",{className:"text-gray-300",children:"—"})})]},m.id)})})]})})]},f)})]}),a.jsx(Xg,{variant:"compact",className:"mt-8"})]}),a.jsx("div",{className:"w-[300px] shrink-0 hidden lg:block",children:a.jsxs("div",{className:"space-y-6 font-body",children:[a.jsx(Wz,{}),a.jsx(Jx,{})]})})]}),a.jsx(ze,{zone:"footer",page:l,className:"mt-6"})]})}function Zz({event:r,onClose:e}){return k.useEffect(()=>{const t=n=>{n.key==="Escape"&&e()};return document.addEventListener("keydown",t),document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",t),document.body.style.overflow=""}},[e]),a.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",onClick:e,children:[a.jsx("div",{className:"absolute inset-0 bg-black/60"}
764),a.jsxs("div",{className:"relative bg-white w-full max-w-md shadow-2xl animate-in fade-in zoom-in-95 duration-150",onClick:t=>t.stopPropagation(),children:[a.jsxs("div",{className:"bg-brand-black text-white px-5 py-4 flex items-start justify-between gap-3",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[a.jsx(ha,{className:"w-4 h-4 flex-shrink-0 text-brand-red"}),a.jsx("h2",{className:"font-headline font-bold text-base leading-snug",children:r.title})]}),a.jsx("button",{onClick:e,className:"flex-shrink-0 text-gray-400 hover:text-white transition-colors mt-0.5","aria-label":"Close",children:a.jsx(tt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-5 space-y-3 font-body",children:[a.jsxs("div",{className:"flex items-center gap-2.5 text-sm",children:[a.jsx(ha,{className:"w-4 h-4 text-brand-red flex-shrink-0"}),a.jsx("span",{className:"font-semibold text-brand-black",children:_k(r.event_date)})]}),a.jsxs("div",{className:"flex items-center gap-2.5 text-sm text-gray-600",children:[a.jsx(zr,{className:"w-4 h-4 text-gray-400 flex-shrink-0"}),a.jsx("span",{children:yR(r.event_date)})]}),r.location&&a.jsxs("div",{className:"flex items-start gap-2.5 text-sm text-gray-600",children:[a.jsx(yo,{className:"w-4 h-4 text-gray-400 flex-shrink-0 mt-0.5"}),a.jsx("span",{children:r.location})]}),r.description&&a.jsx("div",{className:"border-t border-gray-100 pt-4",children:a.jsx("p",{className:"text-sm text-gray-700 leading-relaxed whitespace-pre-line",children:r.description})}),r.submitted_by&&a.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-400 pt-1 border-t border-gray-100",children:[a.jsx(Wl,{className:"w-3.5 h-3.5"}),a.jsxs("span",{children:["Submitted by ",r.submitted_by]})]})]}),a.jsx("div",{className:"px-5 pb-4",children:a.jsx("button",{onClick:e,className:"w-full py-2 border border-gray-300 text-sm font-semibold text-gray-600 hover:bg-gray-50 transition-colors font-body",children:"Close"})})]})]})}function Qz(){const[r,e]=k.useState([]),[t,n]=k.useState([]),[s,i]=k.useState(null),[o,l]=k.useState(!0),[c,u]=k.useState({name:"",email:"",tip:""}),[d,h]=k.useState(!1),[f,p]=k.useState(!1),[m,g]=k.useState(""),[v,b]=k.useState(null),w=It().pathname,[_,N]=k.useState({});k.useEffect(()=>{Xs("community").then(N)},[]),k.useEffect(()=>{Promise.all([HU(),Rl("community",9),jk("community")]).then(([T,D,R])=>{e(T),i(R),n(D.filter(H=>H.id!==(R==null?void 0:R.id)))}).catch(()=>{}).finally(()=>l(!1))},[]);const S=async T=>{T.preventDefault(),p(!0),g("");const{ok:D,error:R}=await Vx("community_tip",c.name,c.email,{Name:c.name,Email:c.email,"Story Tip":c.tip});p(!1),D?(h(!0),u({name:"",email:"",tip:""})):g(R??"Something went wrong. Please try again.")},E=a.jsxs("div",{className:"border border-gray-200 bg-white",children:[a.jsxs("div",{className:"bg-brand-black text-white px-2 lg:px-4 py-2 lg:py-3 flex items-center gap-1.5 lg:gap-2",children:[a.jsx(ha,{className:"w-3.5 h-3.5 lg:w-4 lg:h-4 flex-shrink-0"}),a.jsx("h2",{className:"font-semibold text-xs lg:text-sm uppercase tracking-widest leading-tight",children:"Community Calendar"})]}),o?a.jsx("div",{className:"p-3 text-center",children:a.jsx(_e,{className:"w-4 h-4 animate-spin text-gray-400 mx-auto"})}):r.length===0?a.jsx("p",{className:"px-3 py-3 text-xs text-gray-400 font-body",children:"No upcoming events."}):a.jsx("div",{className:"divide-y divide-gray-100",children:r.map(T=>a.jsxs("button",{onClick:()=>b(T),className:"w-full text-left px-2 lg:px-4 py-2 lg:py-4 hover:bg-gray-50 transition-colors group cursor-pointer",children:[a.jsx("p",{className:"font-headline font-bold text-brand-black text-xs lg:text-sm leading-snug group-hover:text-brand-red transition-colors",children:T.title}),a.jsxs("p",{className:"flex items-center gap-1 lg:gap-1.5 text-xs text-brand-red mt-1 font-body",children:[a.jsx(ha,{className:"w-2.5 h-2.5 lg:w-3 lg:h-3 flex-shrink-0"}),a.jsx("span",{className:"truncate",children:_k(T.event_date)})]}),a.jsxs("p",{className:"flex items-center gap-1 lg:gap-1.5 text-xs text-gray-500 mt-0.5 font-body",children:[a.jsx(zr,{className:"w-2.5 h-2.5 lg:w-3 lg:h-3 flex-shrink-0"}),a.jsx("span",{className:"truncate",children:yR(T.event_date)})]}),a.jsxs("p",{className:"flex items-center gap-1 lg:gap-1.5 text-xs text-gray-500 mt-0.5 font-body",children:[a.jsx(yo,{className:"w-2.5 h-2.5 lg:w-3 lg:h-3 flex-shrink-0"}),a.jsx("span",{className:"truncate",children:T.location})]}),a.jsx("p",{className:"hidden lg:block text-xs text-gray-400 mt-1.5 leading-relaxed font-body line-clamp-2",children:T.description})]},T.id))})]});return a.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-8",children:[v&&a.jsx(Zz,{event:v,onClose:()=>b(null)}),a.jsx(ze,{zone:"leaderboard",page:w,className:"mb-6"}),a.jsx(Bs,{title:_.page_heading||"Community",subtitle:_.page_subtitle||"News, Events & Announcements"}),a.jsxs("div",{className:"flex flex-row gap-3 sm:gap-6 lg:gap-8",children:[a.jsxs("main",{className:"flex-1 min-w-0",children:[o?a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx(_e,{className:"w-8 h-8 animate-spin text-brand-red"})}):a.jsxs(a.Fragment,{children:[s&&a.jsx("div",{className:"mb-8",children:a.jsx(Kx,{article:s})}),t.length>0&&a.jsx("section",{className:"mb-8",children:a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-5",children:t.map(T=>a.jsx(no,{article:T,variant:"feature"},T.id))})})]}),a.jsx(ze,{zone:"in-content",page:w,className:"mb-8"}),a.jsxs("div",{className:"border border-gray-200 bg-white",children:[a.jsx("div",{className:"bg-brand-red text-white px-4 py-3",children:a.jsx("h2",{className:"font-headline font-bold text-lg",children:"Submit a Story Tip"})}),a.jsx("div",{className:"p-5",children:d?a.jsxs("div",{className:"flex items-center gap-3 py-4",children:[a.jsx(At,{className:"w-6 h-6 text-green-600 flex-shrink-0"}),a.jsxs("div",{children:[a.jsx("p",{className:"font-semibold text-brand-black font-headline",children:_.tip_success_title||"Tip submitted — thank you!"}),a.jsx("p",{className:"text-sm text-gray-500 font-body mt-0.5",children:_.tip_success_body||"Our newsroom will follow up if we pursue your story."})]})]}):a.jsxs("form",{onSubmit:S,className:"space-y-4 font-body",children:[a.jsx("p",{className:"text-sm text-gray-600",children:_.tip_intro||"Have a story idea? Let us know. We read every submission."}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider",children:"Your Name"}),a.jsx("input",{type:"text",required:!0,value:c.name,onChange:T=>u({...c,name:T.target.value}),className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider",children:"Your Email"}),a.jsx("input",{type:"email",required:!0,value:c.email,onChange:T=>u({...c,email:T.target.value}),className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider",children:"Your Story Tip"}),a.jsx("textarea",{required:!0,rows:4,value:c.tip,onChange:T=>u({...c,tip:T.target.value}),placeholder:"Tell us what you know...",className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red resize-none"})]}),m&&a.jsxs("div",{className:"flex items-center gap-2 text-xs text-red-700 bg-red-50 border border-red-200 rounded px-3 py-2",children:[a.jsx(Ve,{className:"w-3.5 h-3.5 shrink-0"})," ",m]}),a.jsxs("button",{type:"submit",disabled:f,className:"flex items-center gap-2 bg-brand-red hover:bg-brand-red-dark text-white font-bold px-6 py-2.5 text-sm transition-colors disabled:opacity-60",children:[f?a.jsx(_e,{className:"w-4 h-4 animate-spin"}):a.jsx(qg,{className:"w-4 h-4"}),f?"Sending…":"Submit Tip"]})]})})]})]}),a.jsxs("aside",{className:"w-36 sm:w-48 lg:w-72 xl:w-80 flex-shrink-0 space-y-5 sticky top-4 self-start",children:[E,a.jsx(ze,{zone:"sidebar",page:w})]})]}),a.jsx(ze,{zone:"footer",page:w,className:"mt-8"})]})}function eq({obituary:r}){const[e,t]=k.useState(!1),n=r.birth_date&&r.death_date?parseInt(r.death_date.slice(0,4))-parseInt(r.birth_date.slice(0,4)):null;return a.jsx("div",{className:"bg-white border border-gray-200",children:a.jsxs("div",{className:"p-5",children:[a.jsxs("div",{className:"flex items-start gap-4",children:[r.photo_url&&a.jsx("img",{src:r.photo_url,alt:r.name,className:"w-40 h-48 object-cover border border-gray-200 flex-shrink-0",style:r.photo_focal_point?{objectPosition:`${r.photo_focal_point.x}% ${r.photo_focal_point.y}%`}:void 0}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx(jl,{className:"w-4 h-4 text-gray-400 flex-shrink-0"}),a.jsx("span",{className:"font-body text-xs text-gray-400 uppercase tracking-widest",children:"In Memoriam"})]}),a.jsx("h3",{className:"font-headline font-bold text-brand-black text-xl",children:r.name}),n!==null&&a.jsxs("p",{className:"font-body text-sm text-gray-500 mt-0.5",children:[r.birth_date&&rf(r.birth_date)," – ",r.death_date&&rf(r.death_date),a.jsxs("span",{className:"ml-2 text-gray-400",children:["(",n,")"]})]})]})]}),a.jsx("div",{className:`mt-3 font-body text-sm text-gray-700 leading-relaxed whitespace-pre-line ${e?"":"line-clamp-4"}`,children:r.body}),a.jsx("button",{onClick:()=>t(!e),className:"mt-3 text-xs font-semibold text-brand-red hover:underline font-body",children:e?"Show less":"Read full obituary"})]})})}function tq(){const[r,e]=k.useState([]),[t,n]=k.useState(!0),[s,i]=k.useState({name:"",email:"",obituary:""}),[o,l]=k.useState(null),[c,u]=k.useState(null),[d,h]=k.useState(!1),[f,p]=k.useState(0),[m,g]=k.useState(!1),[v,b]=k.useState(!1),[y,w]=k.useState(""),[_,N]=k.useState({}),S=k.useRef(null),T=It().pathname;k.useEffect(()=>{UU().then(A=>e(A)).catch(()=>{}).finally(()=>n(!1)),Xs("obituaries").then(N)},[]);
764function D(A){var C;const U=(C=A.target.files)==null?void 0:C[0];U&&(l(U),u(URL.createObjectURL(U)),S.current&&(S.current.value=""))}function R(){l(null),c&&URL.revokeObjectURL(c),u(null)}const H=async A=>{A.preventDefault(),b(!0),w("");let U;if(o){try{h(!0),p(0),U=await RR(o,p)}catch(B){b(!1),h(!1),w(B instanceof Error?B.message:"Photo upload failed.");return}h(!1)}const C={Name:s.name,Email:s.email,"Obituary Text":s.obituary};U&&(C.Photo=U);const{ok:M,error:L}=await Vx("obituary",s.name,s.email,C);b(!1),M?(g(!0),i({name:"",email:"",obituary:""}),R()):w(L??"Something went wrong. Please try again.")};return a.jsxs("div",{className:"max-w-5xl mx-auto px-4 py-8",children:[a.jsx(ze,{zone:"leaderboard",page:T,className:"mb-6"}),a.jsx(Bs,{title:"Obituaries",subtitle:"In loving memory of those we have lost"}),a.jsxs("div",{className:"flex flex-col lg:flex-row gap-6 lg:gap-8",children:[a.jsxs("main",{className:"flex-1 min-w-0 w-full",children:[t?a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx(_e,{className:"w-8 h-8 animate-spin text-brand-red"})}):r.length===0?a.jsx("p",{className:"text-center py-16 text-gray-400 font-body",children:"No obituaries currently published."}):a.jsx("div",{className:"space-y-5",children:r.map(A=>a.jsx(eq,{obituary:A},A.id))}),a.jsx(ze,{zone:"in-content",page:T,className:"mt-8"})]}),a.jsxs("aside",{className:"w-full lg:w-80 flex-shrink-0 space-y-5",children:[a.jsx(ze,{zone:"sidebar",page:T}),a.jsxs("div",{className:"border border-gray-200 bg-white",children:[a.jsx("div",{className:"bg-brand-red text-white px-4 py-3",children:a.jsx("h2",{className:"font-headline font-bold text-lg",children:"Submit an Obituary"})}),a.jsx("div",{className:"p-4",children:m?a.jsxs("div",{className:"flex items-center gap-3 py-4",children:[a.jsx(At,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),a.jsx("p",{className:"text-sm font-body text-gray-700",children:"Thank you. Our staff will contact you within one business day."})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-xs text-gray-500 font-body leading-relaxed mb-4",children:"To submit an obituary, please fill out this form. A staff member will contact you to confirm details and discuss publication options."}),a.jsxs("form",{onSubmit:H,className:"space-y-3 font-body",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider",children:"Your Name *"}),a.jsx("input",{required:!0,type:"text",value:s.name,onChange:A=>i({...s,name:A.target.value}),className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider",children:"Your Email *"}),a.jsx("input",{required:!0,type:"email",value:s.email,onChange:A=>i({...s,email:A.target.value}),className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider",children:"Obituary Text *"}),a.jsx("textarea",{required:!0,rows:8,value:s.obituary,onChange:A=>i({...s,obituary:A.target.value}),placeholder:"Include full name, age, dates, life history, survivors, and service details...",className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red resize-none"})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider",children:["Photo ",a.jsx("span",{className:"text-gray-400 normal-case font-normal",children:"(optional)"})]}),c?a.jsxs("div",{className:"relative border border-gray-200 bg-gray-50 p-2 flex items-start gap-3",children:[a.jsx("img",{src:c,alt:"Preview",className:"w-16 h-20 object-cover border border-gray-200 flex-shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-xs font-semibold text-gray-700 truncate",children:o==null?void 0:o.name}),a.jsxs("p",{className:"text-xs text-gray-400 mt-0.5",children:[o?(o.size/1024/1024).toFixed(1):"0"," MB"]}),d&&a.jsxs("div",{className:"mt-2",children:[a.jsx("div",{className:"w-full bg-gray-200 rounded-full h-1.5",children:a.jsx("div",{className:"bg-brand-red h-1.5 rounded-full transition-all duration-200",style:{width:`${f}%`}})}),a.jsxs("p",{className:"text-xs text-gray-400 mt-1",children:["Uploading… ",f,"%"]})]})]}),a.jsx("button",{type:"button",onClick:R,className:"shrink-0 text-gray-400 hover:text-gray-700 transition-colors",children:a.jsx(tt,{className:"w-4 h-4"})})]}):a.jsxs("button",{type:"button",onClick:()=>{var A;return(A=S.current)==null?void 0:A.click()},className:"w-full border-2 border-dashed border-gray-300 hover:border-brand-red hover:bg-red-50 transition-colors px-3 py-4 flex flex-col items-center gap-1.5 text-gray-400 hover:text-brand-red",children:[a.jsx(qx,{className:"w-5 h-5"}),a.jsx("span",{className:"text-xs font-semibold",children:"Click to attach a photo"}),a.jsx("span",{className:"text-xs",children:"JPG, PNG, or WebP — max 10 MB"})]}),a.jsx("input",{ref:S,type:"file",accept:"image/jpeg,image/png,image/webp",className:"hidden",onChange:D})]}),y&&a.jsxs("div",{className:"flex items-center gap-2 text-xs text-red-700 bg-red-50 border border-red-200 rounded px-3 py-2",children:[a.jsx(Ve,{className:"w-3.5 h-3.5 shrink-0"})," ",y]}
764),a.jsx("button",{type:"submit",disabled:v||d,className:"w-full flex items-center justify-center gap-2 bg-brand-red hover:bg-brand-red-dark text-white font-bold py-2.5 text-sm transition-colors disabled:opacity-60",children:d?a.jsxs(a.Fragment,{children:[a.jsx(_e,{className:"w-4 h-4 animate-spin"})," Uploading photo…"]}):v?a.jsxs(a.Fragment,{children:[a.jsx(_e,{className:"w-4 h-4 animate-spin"})," Submitting…"]}):a.jsxs(a.Fragment,{children:[a.jsx(qg,{className:"w-4 h-4"})," Submit Obituary"]})})]}),a.jsx("p",{className:"text-xs text-gray-400 mt-3 font-body leading-relaxed",children:_.pricing_note||"Contact us at (352) 498-3312 or [email protected] for pricing and photo submission."})]})})]})]})]}),a.jsx(ze,{zone:"footer",page:T,className:"mt-8"})]})}const QR={hearing:"Public Hearing",bid:"Invitation to Bid",legal:"Legal Notice",general:"Public Notice"},rq={hearing:"bg-amber-100 text-amber-800",bid:"bg-blue-100 text-blue-800",legal:"bg-gray-100 text-gray-700",general:"bg-green-100 text-green-800"};function nq({url:r,title:e,onClose:t}){const n=r.toLowerCase().includes(".pdf");return k.useEffect(()=>{const s=i=>{i.key==="Escape"&&t()};return document.addEventListener("keydown",s),document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",s),document.body.style.overflow=""}},[t]),a.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/80 p-4",onClick:t,children:a.jsxs("div",{className:"relative bg-white rounded-lg shadow-2xl max-w-5xl w-full max-h-[90vh] flex flex-col overflow-hidden",onClick:s=>s.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200 bg-gray-50 flex-shrink-0",children:[a.jsx("p",{className:"font-headline font-bold text-brand-black text-sm leading-snug line-clamp-1 flex-1 mr-4",children:e}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-xs text-gray-500 hover:text-brand-red transition-colors px-2 py-1.5 rounded hover:bg-gray-100",children:[a.jsx(vu,{className:"w-3.5 h-3.5"})," Open"]}),a.jsx("button",{onClick:t,className:"p-1.5 rounded hover:bg-gray-200 text-gray-500 hover:text-gray-800 transition-colors","aria-label":"Close",children:a.jsx(tt,{className:"w-5 h-5"})})]})]}),a.jsx("div",{className:"flex-1 overflow-auto bg-gray-100 flex items-center justify-center min-h-0",children:n?a.jsx("iframe",{src:r,title:e,className:"w-full h-full min-h-[70vh]",style:{border:0}}):a.jsx("img",{src:r,alt:e,className:"max-w-full max-h-full object-contain p-2"})})]})})}function sq({notice:r}){const[e,t]=k.useState(!1),[n,s]=k.useState(null),i=QR[r.notice_type]??"Public Notice",o=rq[r.notice_type]??"bg-gray-100 text-gray-700",l=r.content_type==="image"&&r.image_url,c=l&&r.image_url.toLowerCase().includes(".pdf"),u=l?[r.image_url,...r.additional_images??[]].filter(Boolean):[];return a.jsxs(a.Fragment,{children:[n!==null&&u[n]&&a.jsx(nq,{url:u[n],title:r.title,onClose:()=>s(null)}),a.jsxs("div",{className:"border border-gray-200 bg-white",children:[a.jsxs("button",{onClick:()=>t(!e),className:"w-full flex items-start justify-between gap-4 px-5 py-4 text-left hover:bg-gray-50 transition-colors",children:[a.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[a.jsx("div",{className:"flex-shrink-0 mt-0.5",children:l?a.jsx(Vu,{className:"w-4 h-4 text-blue-400"}):a.jsx(Bt,{className:"w-4 h-4 text-gray-400"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-1",children:[a.jsx("span",{className:`text-xs font-bold px-2 py-0.5 uppercase tracking-wider ${o} font-body`,children:i}),a.jsxs("span",{className:"text-xs text-gray-400 font-body",children:["Published ",rf(r.published_at),r.expiry_date&&` · Expires ${rf(r.expiry_date)}`]})]}),a.jsx("p",{className:"font-headline font-bold text-brand-black text-base leading-snug",children:r.title})]})]}),a.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e?a.jsx(fa,{className:"w-5 h-5 text-gray-400"}):a.jsx(Ws,{className:"w-5 h-5 text-gray-400"})})]}),e&&a.jsx("div",{className:"px-5 pb-5 border-t border-gray-100",children:l?a.jsxs("div",{className:"mt-4",children:[c?a.jsxs("button",{onClick:()=>s(0),className:"flex items-center gap-3 w-full text-left border border-gray-200 rounded-lg px-4 py-4 hover:bg-gray-50 hover:border-brand-red transition-colors group",children:[a.jsx(Bt,{className:"w-8 h-8 text-brand-red flex-shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-semibold text-brand-black group-hover:text-brand-red transition-colors",children:"View PDF Document"}),a.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"Click to open full-screen viewer"})]}),a.jsx(ki,{className:"w-5 h-5 text-gray-400 group-hover:text-brand-red transition-colors flex-shrink-0"})]}):a.jsxs("button",{onClick:()=>s(0),className:"relative group block w-full cursor-zoom-in","aria-label":"View full size",children:[a.jsx("img",{src:r.image_url,alt:r.title,className:"max-w-full rounded-lg border border-gray-200 shadow-sm group-hover:opacity-95 transition-opacity"}),a.jsx("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:a.jsx("div",{className:"bg-black/50 rounded-full p-3",children:a.jsx(ki,{className:"w-6 h-6 text-white"})})})]}),u.length>1&&a.jsx("div",{className:"mt-3 grid grid-cols-2 sm:grid-cols-3 gap-2",children:u.slice(1).map((d,h)=>{const f=d.toLowerCase().includes(".pdf");return a.jsxs("button",{onClick:()=>s(h+1),className:"relative group border border-gray-200 rounded-lg overflow-hidden hover:border-brand-red transition-colors",children:[f?a.jsxs("div",{className:"flex items-center gap-2 px-3 py-4 bg-gray-50",children:[a.jsx(Bt,{className:"w-6 h-6 text-brand-red flex-shrink-0"}),a.jsxs("p",{className:"text-xs font-semibold text-gray-700 line-clamp-2",children:["PDF Document ",h+2]})]}):a.jsx("img",{src:d,alt:`${r.title} — image ${h+2}`,className:"w-full h-24 object-cover group-hover:opacity-90 transition-opacity"}),a.jsx("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity bg-black/20",children:a.jsx(ki,{className:"w-5 h-5 text-white"})})]},h)})})]}):a.jsx("pre",{className:"font-body text-sm text-gray-700 leading-relaxed whitespace-pre-wrap mt-3",children:r.content})})]})]})}function iq(){const[r,e]=k.useState({lawFirm:"",contactName:"",phone:"",email:"",insertions:"",f
764irstPublicationDate:"",noticeText:""}),[t,n]=k.useState(null),[s,i]=k.useState(!1),[o,l]=k.useState(!1),[c,u]=k.useState(!1),[d,h]=k.useState(""),[f,p]=k.useState(0),m=k.useRef(null),g=(_,N)=>e(S=>({...S,[_]:N})),v=k.useCallback(_=>{var T;const N=["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/plain","application/rtf","image/jpeg","image/png","image/webp","image/gif"],S=((T=_.name.split(".").pop())==null?void 0:T.toLowerCase())??"",E=["pdf","doc","docx","txt","rtf","jpg","jpeg","png","webp","gif"].includes(S);if(!N.includes(_.type)&&!E){h(`Unsupported file format${_.type?` (${_.type})`:""}. Please upload PDF, DOC, DOCX, TXT, RTF, or image files.`);return}if(_.size>25*1024*1024){h(`File too large (${(_.size/1024/1024).toFixed(1)} MB). Max 25 MB.`);return}h(""),n(_)},[]),b=_=>{var S;const N=(S=_.target.files)==null?void 0:S[0];N&&v(N),m.current&&(m.current.value="")},y=_=>{var S;_.preventDefault(),i(!1);const N=(S=_.dataTransfer.files)==null?void 0:S[0];N&&v(N)},w=async _=>{if(_.preventDefault(),!r.lawFirm.trim()||!r.contactName.trim()||!r.phone.trim()||!r.email.trim()){h("Please fill in all required fields.");return}if(!r.noticeText.trim()&&!t){h("Please either type the notice text or upload a file.");return}l(!0),h(""),p(0);const{ok:N,error:S}=await oH(r,t,p);l(!1),N?(u(!0),e({lawFirm:"",contactName:"",phone:"",email:"",insertions:"",firstPublicationDate:"",noticeText:""}),n(null),p(0)):h(S??"Something went wrong. Please try again.")};return c?a.jsxs("div",{className:"border border-gray-200 bg-white",children:[a.jsxs("div",{className:"bg-brand-red text-white px-4 py-3 flex items-center gap-2",children:[a.jsx(C_,{className:"w-4 h-4"}),a.jsx("h2",{className:"font-semibold text-sm uppercase tracking-widest",children:"Submit a Public Notice"})]}),a.jsxs("div",{className:"p-8 flex flex-col items-center justify-center text-center",children:[a.jsx(At,{className:"w-14 h-14 text-green-500 mb-4"}),a.jsx("h3",{className:"font-headline font-bold text-brand-black text-xl mb-2",children:"Notice Submitted!"}),a.jsx("p",{className:"font-body text-sm text-gray-500 max-w-md",children:"Thank you for your submission. Our team will review your public notice and contact you regarding publication details within one business day."}),a.jsx("button",{onClick:()=>u(!1),className:"mt-6 px-5 py-2 border border-gray-300 text-sm text-gray-600 hover:bg-gray-50 font-body transition-colors",children:"Submit another notice"})]})]}):a.jsxs("div",{className:"border border-gray-200 bg-white",children:[a.jsxs("div",{className:"bg-brand-red text-white px-4 py-3 flex items-center gap-2",children:[a.jsx(C_,{className:"w-4 h-4"}),a.jsx("h2",{className:"font-semibold text-sm uppercase tracking-widest",children:"Submit a Public Notice"})]}),a.jsxs("form",{onSubmit:w,className:"p-5 space-y-4",children:[a.jsxs("p",{className:"font-body text-sm text-gray-500 leading-relaxed",children:["Complete the form below to submit a public notice for publication. Our staff will contact you to confirm details and arrange payment. Fields marked with ",a.jsx("span",{className:"text-brand-red",children:"*"})," are required."]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:["Law Firm or Requestor Name ",a.jsx("span",{className:"text-brand-red",children:"*"})]}),a.jsx("input",{required:!0,type:"text",value:r.lawFirm,onChange:_=>g("lawFirm",_.target.value),className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red font-body",placeholder:"e.g. Smith & Associates, P.A."})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:["Contact Name ",a.jsx("span",{className:"text-brand-red",children:"*"})]}),a.jsx("input",{required:!0,type:"text",value:r.contactName,onChange:_=>g("contactName",_.target.value),className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red font-body",placeholder:"e.g. Jane Smith"})]})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:["Phone Number ",a.jsx("span",{className:"text-brand-red",children:"*"})]}),a.jsx("input",{required:!0,type:"tel",value:r.phone,onChange:_=>g("phone",_.target.value),className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red font-body",placeholder:"(352) 5
76455-0100"})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:["Email Address ",a.jsx("span",{className:"text-brand-red",children:"*"})]}),a.jsx("input",{required:!0,type:"email",value:r.email,onChange:_=>g("email",_.target.value),className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red font-body",placeholder:"[email protected]"})]})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:"Number of Weeks for Insertion"}),a.jsx("input",{type:"number",min:1,value:r.insertions,onChange:_=>g("insertions",_.target.value),className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red font-body",placeholder:"e.g. 1, 2, 4"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:"Requested First Publication Date"}),a.jsx("input",{type:"date",value:r.firstPublicationDate,onChange:_=>g("firstPublicationDate",_.target.value),className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red font-body"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:"Notice Text"}),a.jsx("p",{className:"font-body text-xs text-gray-400 mb-1.5",children:"Type or paste the full text of the notice, or upload a file below."}),a.jsx("textarea",{rows:6,value:r.noticeText,onChange:_=>g("noticeText",_.target.value),className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red font-body resize-y",placeholder:"Enter the full text of the public notice here…"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1.5 uppercase tracking-wider font-body",children:"Upload Notice File"}),a.jsx("input",{ref:m,type:"file",accept:".pdf,.doc,.docx,.txt,image/jpeg,image/png,image/webp",onChange:b,className:"hidden"}),t?a.jsxs("div",{className:"flex items-center gap-3 border border-gray-200 bg-gray-50 rounded px-4 py-3",children:[a.jsx(Bt,{className:"w-6 h-6 text-brand-red flex-shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-body text-sm font-medium text-gray-800 truncate",children:t.name}),a.jsxs("p",{className:"font-body text-xs text-gray-400",children:[(t.size/1024).toFixed(0)," KB"]})]}),a.jsx("button",{type:"button",onClick:()=>n(null),className:"text-gray-400 hover:text-brand-red transition-colors",children:a.jsx(tt,{className:"w-5 h-5"})})]}):o&&f>0&&f<100?a.jsxs("div",{className:"border border-gray-200 rounded p-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx(_e,{className:"w-4 h-4 animate-spin text-brand-red shrink-0"}),a.jsx("span",{className:"font-body text-xs text-gray-600",children:"Uploading…"}),a.jsxs("span",{className:"font-body text-xs font-semibold text-brand-red ml-auto",children:[f,"%"]})]}),a.jsx("div",{className:"w-full bg-gray-100 rounded-full h-1.5",children:a.jsx("div",{className:"bg-brand-red h-1.5 rounded-full transition-all duration-200",style:{width:`${f}%`}})})]}):a.jsxs("div",{onDrop:y,onDragOver:_=>{_.preventDefault(),i(!0)},onDragLeave:()=>i(!1),onClick:()=>{var _;return(_=m.current)==null?void 0:_.click()},className:`border-2 border-dashed rounded p-5 flex flex-col items-center justify-center gap-1.5 cursor-pointer transition-colors ${s?"border-brand-red bg-red-50":"border-gray-300 hover:border-brand-red hover:bg-gray-50"}`,children:[a.jsx(Fn,{className:"w-6 h-6 text-gray-400"}),a.jsx("p",{className:"font-body text-xs font-medium text-gray-600",children:s?"Drop file here":"Drag & drop or click to upload"}),a.jsx("p",{className:"font-body text-xs text-gray-400",children:"PDF, DOC, DOCX, TXT, or image · max 25 MB"})]})]}),d&&a.jsxs("div",{className:"flex items-start gap-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded px-3 py-2.5 font-body",children:[a.jsx(Ve,{className:"w-4 h-4 mt-0.5 shrink-0"}),d]}),a.jsxs("button",{type:"submit",disabled:o,className:"flex items-center justify-center gap-2 bg-brand-red hover:bg-brand-red-dark disabled:opacity-60 text-white font-bold px-6 py-2.5 text-sm transition-colors font-body w-full",children:[o?a.jsx(_e,{className:"w-4 h-4 animate-spin"}):a.jsx(qg,{className:"w-4 h-4"}),o?"Submitting…":"Submit Notice"]})]})]})}function aq(){const[r,e]=k.useState([]),[t,n]=k.useState(!0),[s,i]=k.useState(""),[o,l]=k.useState({}),[c,u]=k.useState("notices"),h=It().pathname;k.useEffect(()=>{zU().then(m=>e(m)).catch(()=>{}).finally(()=>n(!1)),Xs("public-notices").then(l).catch(()=>{})},[]);const f=s.trim().toLowerCase(),p=f?r.filter(m=>{const g=QR[m.notice_type]??"Public Notice";return m.title.toLowerCase().includes(f)||(m.content??"").toLowerCase().includes(f)||g.toLowerCase().includes(f)}):r;return a.jsxs("div",{className:"max-w-5xl mx-auto px-4 py-8",children:[a.jsx(ze,{zone:"leaderboard",page:h,className:"mb-6"}),a.jsx(Bs,{title:"Public Notices & Legal Advertisements",subtitle:"Official notices for Dixie County, Florida"}),a.jsxs("div",{className:"flex flex-col lg:flex-row gap-6 lg:gap-8",children:[a.jsxs("main",{className:"flex-1 min-w-0 
764w-full",children:[a.jsxs("div",{className:"flex border-b border-gray-200 mb-6",role:"tablist",children:[a.jsxs("button",{role:"tab","aria-selected":c==="notices",onClick:()=>u("notices"),className:`flex items-center gap-2 px-5 py-3 text-sm font-headline font-bold transition-colors border-b-2 -mb-px ${c==="notices"?"border-brand-red text-brand-black":"border-transparent text-gray-500 hover:text-brand-black hover:border-gray-300"}`,children:[a.jsx(Bt,{className:"w-4 h-4"}),"View Notices"]}),a.jsxs("button",{role:"tab","aria-selected":c==="submit",onClick:()=>u("submit"),className:`flex items-center gap-2 px-5 py-3 text-sm font-headline font-bold transition-colors border-b-2 -mb-px ${c==="submit"?"border-brand-red text-brand-black":"border-transparent text-gray-500 hover:text-brand-black hover:border-gray-300"}`,children:[a.jsx(C_,{className:"w-4 h-4"}),"Submit a Notice"]})]}),c==="notices"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"border border-gray-200 bg-white mb-6",children:[a.jsxs("div",{className:"bg-brand-black text-white px-4 py-3 flex items-center gap-2",children:[a.jsx(Bt,{className:"w-4 h-4"}),a.jsx("h2",{className:"font-semibold text-sm uppercase tracking-widest",children:"Florida Public Notices Search"})]}),a.jsxs("div",{className:"p-5",children:[a.jsx("p",{className:"font-body text-sm text-gray-600 leading-relaxed mb-4",children:"Search official public notices for Dixie County published in The Dixie County Advocate below. This database is maintained by the Florida Press Association."}),a.jsx("div",{className:"flex justify-center",children:a.jsx("iframe",{src:"https://floridapublicnotices.com/widget/searchlarge.php?id=246",width:"300",height:"270",scrolling:"no",style:{border:0,overflow:"hidden"},title:"Florida Public Notices"})})]})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-4",children:[a.jsx("h2",{className:"font-headline font-bold text-xl text-brand-black",children:"Current Public Notices"}),!t&&r.length>0&&a.jsxs("div",{className:"relative w-full sm:w-72",children:[a.jsx(nf,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 pointer-events-none"}),a.jsx("input",{type:"search",value:s,onChange:m=>i(m.target.value),placeholder:"Search notices…",className:"w-full pl-9 pr-4 py-2 border border-gray-300 rounded-lg text-sm font-body focus:outline-none focus:border-brand-red focus:ring-1 focus:ring-brand-red/20 bg-white"}),s&&a.jsx("button",{onClick:()=>i(""),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600","aria-label":"Clear search",children:a.jsx(tt,{className:"w-4 h-4"})})]})]}),t?a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx(_e,{className:"w-8 h-8 animate-spin text-brand-red"})}):r.length===0?a.jsx("p",{className:"text-center py-12 text-gray-400 font-body",children:"No current public notices."}):p.length===0?a.jsxs("div",{className:"text-center py-12 font-body",children:[a.jsx(nf,{className:"w-8 h-8 text-gray-300 mx-auto mb-3"}),a.jsxs("p",{className:"text-gray-500 font-semibold",children:['No notices match "',s,'"']}),a.jsx("button",{onClick:()=>i(""),className:"mt-2 text-sm text-brand-red hover:underline",children:"Clear search"})]}):a.jsxs(a.Fragment,{children:[f&&a.jsxs("p",{className:"text-xs text-gray-500 font-body mb-3",children:[p.length," result",p.length!==1?"s":"",' for "',s,'"']}),a.jsx("div",{className:"space-y-3",children:p.map(m=>a.jsx(sq,{notice:m},m.id))})]})]}),a.jsx(ze,{zone:"in-content",page:h,className:"mt-8"})]}),c==="submit"&&a.jsx(iq,{})]}),a.jsxs("aside",{className:"w-full lg:w-72 flex-shrink-0 space-y-5",children:[a.jsx(ze,{zone:"sidebar",page:h}),a.jsxs("div",{className:"border border-gray-200 bg-white",children:[a.jsx("div",{className:"bg-brand-red text-white px-4 py-3",children:a.jsx("h3",{className:"font-semibold text-sm uppercase tracking-widest",children:"About Public Notices"})}),a.jsxs("div",{className:"p-4 font-body text-sm text-gray-600 space-y-3",children:[a.jsx("p",{children:o.about_text_1||"Public notices are legal advertisements required by Florida law to be published in a newspaper of general circulation. The Dixie County Advocate serves as Dixie County's newspaper of record."}),a.jsx("p",{children:o.about_text_2||"Notices include: government hearings, bids, foreclosures, tax deeds, zoning changes, and other matters of public re
764cord."}),a.jsxs("div",{className:"pt-3 border-t border-gray-100",children:[a.jsx("p",{className:"font-semibold text-brand-black mb-1",children:"To Place a Notice:"}),(o.placement_phone||"(352) 498-3312")&&a.jsxs("p",{children:["Call ",a.jsx("a",{href:`tel:${(o.placement_phone||"(352) 498-3312").replace(/\D/g,"")}`,className:"text-brand-red hover:underline",children:o.placement_phone||"(352) 498-3312"})]}),(o.placement_email||"[email protected]")&&a.jsxs("p",{children:["or email ",a.jsx("a",{href:`mailto:${o.placement_email||"[email protected]"}`,className:"text-brand-red hover:underline break-all",children:o.placement_email||"[email protected]"})]})]})]})]})]})]}),a.jsx(ze,{zone:"footer",page:h,className:"mt-8"})]})}const Xw=[{item_type:"event",year_label:"1921",sort_year:1921,title:"First Issue Published",description:"The Dixie County Advocate publishes its first issue on July 1, founded by Charles Edwin Morse in Cross City."},{item_type:"event",year_label:"1930s",sort_year:1930,title:"Survives the Great Depression",description:"The paper survives the Great Depression, maintaining weekly publication even as many local businesses closed."},{item_type:"event",year_label:"1945",sort_year:1945,title:"WWII Tribute Edition",description:"Special edition honoring Dixie County servicemen and women returning from World War II."},{item_type:"event",year_label:"1960s",sort_year:1960,title:"Sports Coverage Begins",description:"Expanded to include comprehensive coverage of Dixie County school athletics, beginning a tradition of local sports reporting."},{item_type:"event",year_label:"1985",sort_year:1985,title:"Second-Generation Ownership",description:"Second-generation ownership under the Morse family. Newsroom expands and circulation reaches its historic high."},{item_type:"event",year_label:"2000",sort_year:2e3,title:"Florida Press Association Recognition",description:"Celebrates 79 years of continuous publication. The Advocate is recognized by the Florida Press Association."},{item_type:"event",year_label:"2010",sort_year:2010,title:"Digital Launch",description:"The Advocate launches its digital presence, extending reach to Dixie County residents and former residents worldwide."},{item_type:"event",year_label:"2021",sort_year:2021,title:"Centennial Celebration",description:"100 years of publishing every week without fail. Commemorative edition distributed to all county households."}],oq=[{key:"staff_editor",photoKey:"staff_editor_photo",role:"Editor",fallback:"Editor"},{key:"staff_publisher",photoKey:"staff_publisher_photo",role:"Publisher",fallback:"Publisher"},{key:"staff_reporter",photoKey:"staff_reporter_photo",role:"Independent Reporter",fallback:"Independent Reporter"}];function lq(){const r=Ug(),[e,t]=k.useState({}),[n,s]=k.useState([]),[i,o]=k.useState(!1),c=It().pathname;k.useEffect(()=>{Xs("about").then(t).catch(()=>{}),xH().then(h=>{s(h.length>0?h:Xw)}).catch(()=>s(Xw)).finally(()=>o(!0))},[]);const u=(h,f)=>e[h]??f,d=i?n:Xw;return a.jsxs("div",{className:"max-w-5xl mx-auto px-4 py-8",children:[a.jsx(ze,{zone:"leaderboard",page:c,className:"mb-6"}),a.jsxs("div",{className:"bg-brand-red text-white text-center py-12 px-6 mb-10",children:[a.jsxs("div",{className:"flex items-center justify-center gap-3 mb-4",children:[a.jsx("div",{className:"h-px bg-white/30 flex-1 max-w-16"}),a.jsx(Eb,{className:"w-8 h-8 text-white/80"}),a.jsx("div",{className:"h-px bg-white/30 flex-1 max-w-16"})]}),a.jsx("h1",{className:"font-masthead text-3xl md:text-5xl font-bold leading-tight mb-3",children:"Every week without fail"}),a.jsx("p",{className:"font-headline italic text-white/80 text-xl mb-4",children:"since July 1, 1921"}),a.jsxs("p",{className:"font-body text-white/70 text-sm max-w-xl mx-auto",children:["For more than ",r," years, The Dixie County Advocate has never missed a week — through hurricanes, depressions, wars, and change. We are your community newspaper."]})]}),a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-12",children:[{value:`${r}+`,label:"Years of Service",icon:zr},{value:u("stats_issues","5,500+"),label:"Consecutive Issues",icon:Vs},{value:u("stats_residents","17,000"),label:"County Residents",icon:Ek},{value:"1",label:"Trusted Local Voice",icon:Eb}].map(({value:h,label:f,icon:p})=>a.jsxs("div",{className:"border-2 border-brand-red text-center py-5 px-3",children:[a.jsx(p,{className:"w-6 h-6 text-brand-red mx-auto mb-2"}),a.jsx("p",{className:"font-masthead text-2xl font-bold text-brand-black",children:h}),a.jsx("p",{className:"font-body text-xs text-gray-500 uppercase tracking-wider mt-1",children:f})]},f))}),a.jsxs("div",{className:"flex flex-col lg:flex-row gap-10",children:[a.jsxs("main",{className:"flex-1 min-w-0",children:[a.jsxs("section",{className:"mb-10",children:[a.jsx("h2",{className:"font-headline text-2xl font-bold text-brand-black border-b-2 border-brand-red pb-2 mb-4",children:"Our Mission"}),a.jsxs("div",{className:"font-body text-gray-700 text-base leading-relaxed space-y-4",children:[a.jsx("p",{children:u("mission_p1","The Dixie County Advocate exists to serve the residents of Dixie County, Florida — one of the most naturally beautiful and community-minded places in America. Our mission is simple: to publish local news accurately, fairly, and every single week without fail.")}),a.jsx("p",{children:u("mission_p2","We believe that local journalism is the foundation of informed democracy. When residents know what is happening at their county commission, in their schools, on their sports fields, and in their neighborhoods, they can make better decisions about their community's future.")}),a.jsx("p",{children:u("mission_p3","For more than a century, this paper has served as Dixie County's newspaper of record — the place where legal notices are published, where births and deaths are remembered, where athletes are celebrated, and where public officials are held to account.")}),a.jsx("p",{children:u("mission_p4","We are not a national media company. We are your neighbors. The Advocate has always been, and will always remain, the community's newspaper.")})]})]}),a.jsxs("section",{className:"mb-8",children:[a.jsx("h2",{className:"font-headline text-2xl font-bold text-brand-black border-b-2 border-brand-red pb-2 mb-6",children:"A Century of Serving Dixie County"}),a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"absolute left-16 top-0 bottom-0 w-px bg-gray-200"}),a.jsx("div",{className:"space-y-6",children:d.map(h=>h.item_type==="year"?a.jsxs("div",{className:"flex gap-6 items-center",children:[a.jsx("div",{className:"w-16 flex-shrink-0 text-right",children:a.jsx("span",{className:"font-headline font-bold text-brand-black text-sm",children:h.year_label})}),a.jsx("div",{className:"w-3 h-3 bg-brand-black rounded-full flex-shrink-0 relative z-10"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("p",{className:"font-headline font-bold text-brand-black text-base",children:h.title}),h.description&&a.jsx("p",{className:"font-body text-sm text-gray-600 leading-relaxed mt-0.5",children:h.description})]})]},h.year_label+h.title):a.jsxs("div",{className:"flex gap-6 items-start",children:[a.jsx("div",{className:"w-16 flex-shrink-0 text-right",children:a.jsx("span",{className:"font-headline font-bold text-brand-red text-sm",children:h.year_label})}),a.jsx("div",{className:"w-3 h-3 bg-brand-red rounded-full flex-shrink-0 mt-1 relative z-10"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("p",{className:"font-body font-semibold text-brand-black text-sm",children:h.title}),h.description&&a.jsx("p",{className:"font-body text-sm text-gray-700 leading-relaxed mt-0.5",children:h.description})]})]},h.year_label+h.title))})]})]})]}),a.jsxs("aside",{className:"w-full lg:w-72 flex-shrink-0 space-y-5",children:[a.jsx(Xg,{}),a.jsxs("div",{className:"border border-gray-200 bg-white",children:[a.jsx("div",{className:"bg-brand-black text-white px-4 py-3",children:a.jsx("h3",{className:"font-semibold text-sm uppercase tracking-widest",children:"Our Staff"})}),a.jsx("div",{className:"divide-y divide-gray-100",children:oq.map(({key:h,photoKey:f,role:p,fallback:m})=>{const g=u(h,m),v=u(f,"");return a.jsxs("div",{className:"px-4 py-4",children:[v?a.jsx("img",{src:v,alt:g,className:"w-full border border-gray-200 mb-3 block",style:{imageRendering:"auto"}}):a.jsx("div",{className:"w-40 h-48 bg-gray-100 border border-gray-200 mb-3 mx-auto flex items-center justify-center",children:a.jsx("div",{className:"w-16 h-16 bg-brand-red text-white rounded-full flex items-center justify-center text-xl font-bold flex-shrink-0",children:g.split(" ").map(b=>b[0]).join("")})}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"font-semibold text-brand-black text-sm font-body",children:g}),a.jsx("p",{className:"text-xs text-gray-500 font-body",children:p})]})]},h)})})]}),a.jsxs("div",{className:"bg-brand-red text-white p-4 text-center",children:[a.jsx("p",{className:"font-headline font-bold text-lg mb-1",children:"Support Local Journalism"}),a.jsx("p",{className:"font-body text-white/80 text-xs leading-relaxed mb-3",children:"Subscribe to print or digital to keep your community paper strong."}),a.jsxs($e,{to:"/subscribe",className:"inline-flex items-center gap-1 bg-white text-brand-red font-bold text-sm px-4 py-2 hover:bg-gray-100 transition-colors",children:["Subscribe Today ",a.jsx(zx,{className:"w-3.5 h-3.5"})]})]})]})]}),a.jsx(ze,{zone:"footer",page:c,className:"mt-8"})]})}const cq={hero_headline:"Support Local Journalism",hero_subhead:"Every week without fail since July 1, 1921",digital_title:"Digital Only",digital_subtitle:"Full online access, anytime",digital_price:"$5.99",digital_price_annual:"$59",digital_features:`Unlimited online access
765Full article archive
766Breaking news alerts
767PDF edition each week
768Community calendar`,print_title:"Print Only",print_subtitle:"Weekly paper — annual subscription",print_local_price:"$30",print_outofarea_price:"$35",print_features:`Weekly print edition
769Delivered every Thursday
770Full local coverage
771Legal notices & public records
772Sports & community pages`,bundle_title:"Print + Digital",bundle_subtitle:"The complete Dixie County Advocate",bundle_price:"$13.99",bundle_price_annual:"$76",bundle_savings_badge:"Save $20",bundle_features:`Print edition delivered weekly
773Unlimited digital access
774PDF edition each week
775Breaking news alerts
776Full archive access
777Subscriber-only content`,link_digital_monthly:"https://pay.wave.com/m/M_OfLNMPbpuNMm/c/CAD/?product=P_eqLNMPbpuNMm",link_digital_annual:"https://pay.wave.com/m/M_OfLNMPbpuNMm/c/CAD/?product=P_fqLNMPbpuNMm",link_print_local:"https://pay.wave.com/m/M_OfLNMPbpuNMm/c/CAD/?product=P_gqLNMPbpuNMm",link_print_outofarea:"https://pay.wave.com/m/M_OfLNMPbpuNMm/c/CAD/?product=P_hqLNMPbpuNMm",link_bundle_monthly:"https://pay.wave.com/m/M_OfLNMPbpuNMm/c/CAD/?product=P_iqLNMPbpuNMm",link_bundle_annual:"https://pay.wave.com/m/M_OfLNMPbpuNMm/c/CAD/?product=P_jqLNMPbpuNMm",why_p1:"The Dixie County Advocate is the only locally owned newspaper serving Dixie County. No parent company, no outside investors — just neighbors writing about neighbors.",why_p2:"Your subscription funds the reporters, photographers, and editors who cover your county commission, your schools, and your community events.",why_phone:"(352) 498-3312",why_email:"[email protected]",gift_body:"Give the gift of local news. Gift subscriptions are available in 3-, 6-, and 12-month terms. Call us to arrange a gift subscription for a friend or family member.",gift_phone:"(352) 498-3312"};function xt(r,e){return(r==null?void 0:r.trim())||cq[e]}function Yw(r,e){return xt(r,e).split(`
778`).map(n=>n.trim()).filter(Boolean)}function uq(){const r=Ug(),[e,t]=k.useState("monthly"),[n,s]=k.useState("local"),[i,o]=k.useState({});k.useEffect(()=>{Xs("subscribe").then(o)},[]);const l=xt(i.hero_headline,"hero_headline"),c=xt(i.hero_subhead,"hero_subhead"),u=xt(i.digital_title,"digital_title"),d=xt(i.digital_subtitle,"digital_subtitle"),h=xt(i.digital_price,"digital_price"),f=xt(i.digital_price_annual,"digital_price_annual"),p=Yw(i.digital_features,"digital_features"),m=xt(i.print_title,"print_title"),g=xt(i.print_subtitle,"print_subtitle"),v=xt(i.print_local_price,"print_local_price"),b=xt(i.print_outofarea_price,"print_outofarea_price"),y=Yw(i.print_features,"print_features"),w=xt(i.bundle_title,"bundle_title"),_=xt(i.bundle_subtitle,"bundle_subtitle"),N=xt(i.bundle_price,"bundle_price"),S=xt(i.bundle_price_annual,"bundle_price_annual"),E=xt(i.bundle_savings_badge,"bundle_savings_badge"),T=Yw(i.bundle_features,"bundle_features"),D=xt(i.link_digital_monthly,"link_digital_monthly"),R=xt(i.link_digital_annual,"link_digital_annual"),H=xt(i.link_print_local,"link_print_local"),A=xt(i.link_print_outofarea,"link_print_outofarea"),U=xt(i.link_bundle_monthly,"link_bundle_monthly"),C=xt(i.link_bundle_annual,"link_bundle_annual"),M=xt(i.why_p1,"why_p1"),L=xt(i.why_p2,"why_p2"),B=xt(i.why_phone,"why_phone"),I=xt(i.why_email,"why_email"),z=xt(i.gift_body,"gift_body"),X=xt(i.gift_phone,"gift_phone"),F=n==="local"?H:A,q=n==="local"?v:b;return a.jsxs("div",{className:"max-w-6xl mx-auto px-4 py-8",children:[a.jsxs("div",{className:"bg-brand-red text-white text-center py-12 px-6 mb-10",children:[a.jsxs("div",{className:"flex items-center justify-center gap-3 mb-4",children:[a.jsx("div",{className:"h-px bg-white/30 flex-1 max-w-16"}),a.jsx(Vs,{className:"w-7 h-7 text-white/80"}),a.jsx("div",{className:"h-px bg-white/30 flex-1 max-w-16"})]}),a.jsx("h1",{className:"font-masthead text-3xl md:text-5xl font-bold leading-tight mb-3",children:l}),a.jsx("p",{className:"font-headline italic text-white/80 text-xl mb-4",children:c}),a.jsxs("p",{className:"font-body text-white/70 text-sm max-w-xl mx-auto leading-relaxed",children:["For ",r," years we have published every week without fail — through hurricanes, depressions, and change. Your subscription keeps Dixie County's only local newspaper strong."]})]}),a.jsxs("div",{className:"flex flex-col items-center mb-8 gap-3",children:[a.jsx("h2",{className:"font-headline text-2xl font-bold text-brand-black",children:"Choose Your Plan"}),a.jsxs("div",{className:"inline-flex items-center bg-gray-100 rounded-full p-1 gap-1",children:[a.jsx("button",{onClick:()=>t("monthly"),className:`px-5 py-2 rounded-full text-sm font-semibold font-body transition-all duration-200 ${e==="monthly"?"bg-white text-brand-black shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:"Monthly"}),a.jsxs("button",{onClick:()=>t("annual"),className:`px-5 py-2 rounded-full text-sm font-semibold font-body transition-all duration-200 flex items-center gap-2 ${e==="annual"?"bg-white text-brand-black shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:["Annual",a.jsx("span",{className:"bg-green-100 text-green-700 text-xs font-bold px-2 py-0.5 rounded-full",children:"Save more"})]})]}),a.jsx("p",{className:"font-body text-xs text-gray-400",children:"Print subscriptions are annual only"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-12 items-start",children:[a.jsxs("div",{className:"relative flex flex-col bg-white rounded-2xl overflow-hidden border border-gray-200 shadow-sm hover:shadow-md transition-all duration-200",children:[a.jsxs("div",{className:"px-6 pt-8 pb-6",children:[a.jsxs("div",{className:"flex items-center gap-2.5 mb-4",children:[a.jsx("div",{className:"w-9 h-9 rounded-xl flex items-center justify-center bg-gray-100",children:a.jsx(AU,{className:"w-5 h-5 text-gray-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-headline font-bold text-brand-black text-base leading-tight",children:u}),a.jsx("p",{className:"font-body text-xs text-gray-400",children:d})]})]}),a.jsxs("div",{className:"flex items-end gap-2 mb-1",children:[a.jsx("span",{className:"font-masthead text-4xl font-bold text-brand-black leading-none",children:e==="monthly"?h:f}),a.jsx("span",{className:"font-body text-sm text-gray-400 mb-1",children:e==="monthly"?"/month":"per year"})]}),a.jsx("p",{className:"font-body text-xs text-gray-400",children:e==="monthly"?"b
778illed monthly — cancel anytime":"billed once per year"})]}),a.jsx("div",{className:"h-px bg-gray-100 mx-6"}),a.jsx("div",{className:"px-6 py-5 flex-1",children:a.jsx("ul",{className:"space-y-2.5",children:p.map(V=>a.jsxs("li",{className:"flex items-start gap-2 font-body text-sm text-gray-700",children:[a.jsx(At,{className:"w-4 h-4 shrink-0 mt-0.5 text-green-600"}),V]},V))})}),a.jsx("div",{className:"px-6 pb-6 pt-2",children:a.jsxs("a",{href:e==="monthly"?D:R,target:"_blank",rel:"noopener noreferrer",className:"w-full py-3 rounded-xl text-sm font-bold font-body flex items-center justify-center gap-2 bg-brand-black text-white hover:bg-gray-800 transition-all duration-150 hover:scale-[1.02] active:scale-100",children:["Subscribe ",a.jsx(vu,{className:"w-3.5 h-3.5"})]})})]}),a.jsxs("div",{className:"relative flex flex-col bg-white rounded-2xl overflow-hidden border border-gray-200 shadow-sm hover:shadow-md transition-all duration-200",children:[a.jsxs("div",{className:"px-6 pt-8 pb-6",children:[a.jsxs("div",{className:"flex items-center gap-2.5 mb-4",children:[a.jsx("div",{className:"w-9 h-9 rounded-xl flex items-center justify-center bg-gray-100",children:a.jsx(Vs,{className:"w-5 h-5 text-gray-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-headline font-bold text-brand-black text-base leading-tight",children:m}),a.jsx("p",{className:"font-body text-xs text-gray-400",children:g})]})]}),a.jsx("div",{className:"flex gap-2 mb-4",children:[{id:"local",label:"Local",sublabel:"Dixie County"},{id:"outofarea",label:"Out of Area",sublabel:"All other areas"}].map(({id:V,label:K,sublabel:ee})=>a.jsxs("button",{type:"button",onClick:()=>s(V),className:`flex-1 flex flex-col items-center py-2 px-1 rounded-lg border text-center transition-colors ${n===V?"border-brand-black bg-brand-black text-white":"border-gray-200 bg-gray-50 text-gray-600 hover:border-gray-300"}`,children:[a.jsx(yo,{className:"w-3.5 h-3.5 mb-0.5"}),a.jsx("span",{className:"text-xs font-bold leading-tight",children:K}),a.jsx("span",{className:`text-[10px] leading-tight ${n===V?"text-white/70":"text-gray-400"}`,children:ee})]},V))}),a.jsxs("div",{className:"flex items-end gap-2 mb-1",children:[a.jsx("span",{className:"font-masthead text-4xl font-bold text-brand-black leading-none",children:q}),a.jsx("span",{className:"font-body text-sm text-gray-400 mb-1",children:"per year"})]}),a.jsx("p",{className:"font-body text-xs text-gray-400",children:"billed once per year — print only"})]}),a.jsx("div",{className:"h-px bg-gray-100 mx-6"}),a.jsx("div",{className:"px-6 py-5 flex-1",children:a.jsx("ul",{className:"space-y-2.5",children:y.map(V=>a.jsxs("li",{className:"flex items-start gap-2 font-body text-sm text-gray-700",children:[a.jsx(At,{className:"w-4 h-4 shrink-0 mt-0.5 text-green-600"}),V]},V))})}),a.jsx("div",{className:"px-6 pb-6 pt-2",children:a.jsxs("a",{href:F,target:"_blank",rel:"noopener noreferrer",className:"w-full py-3 rounded-xl text-sm font-bold font-body flex items-center justify-center gap-2 bg-brand-black text-white hover:bg-gray-800 transition-all duration-150 hover:scale-[1.02] active:scale-100",children:["Subscribe ",a.jsx(vu,{className:"w-3.5 h-3.5"})]})})]}),a.jsxs("div",{className:"relative flex flex-col bg-white rounded-2xl overflow-hidden border-2 border-brand-red shadow-xl scale-[1.02] transition-all duration-200",children:[a.jsx("div",{className:"absolute top-0 left-0 right-0 bg-brand-red text-white text-xs font-bold text-center py-1.5 uppercase tracking-widest",children:"Best Value"}),a.jsxs("div",{className:"px-6 pt-10 pb-6",children:[a.jsxs("div",{className:"flex items-center gap-2.5 mb-4",children:[a.jsx("div",{className:"w-9 h-9 rounded-xl flex items-center justify-center bg-brand-red/10",children:a.jsx(wU,{className:"w-5 h-5 text-brand-red"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-headline font-bold text-brand-black text-base leading-tight",children:w}),a.jsx("p",{className:"font-body text-xs text-gray-400",children:_})]})]}),a.jsxs("div",{className:"flex items-end gap-2 mb-1",children:[a.jsx("span",{className:"font-masthead text-4xl font-bold text-brand-black leading-none",children:e==="monthly"?N:S}),a.jsx("span",{className:"font-body text-sm text-gray-400 mb-1",children:e==="monthly"?"/month":"per year"}),e==="annual"&&E&&a.jsx("span",{className:"mb-1 bg-green-100 text-green-700 text-xs font-bold px-2.5 py-1 rounded-full leading-none",children:E})]}),a.jsx("p",{className:"font-body text-xs text-gray-400",children:e==="monthly"?"b
778illed monthly — cancel anytime":"billed once per year"})]}),a.jsx("div",{className:"h-px bg-gray-100 mx-6"}),a.jsx("div",{className:"px-6 py-5 flex-1",children:a.jsx("ul",{className:"space-y-2.5",children:T.map(V=>a.jsxs("li",{className:"flex items-start gap-2 font-body text-sm text-gray-700",children:[a.jsx(At,{className:"w-4 h-4 shrink-0 mt-0.5 text-brand-red"}),V]},V))})}),a.jsx("div",{className:"px-6 pb-6 pt-2",children:a.jsxs("a",{href:e==="monthly"?U:C,target:"_blank",rel:"noopener noreferrer",className:"w-full py-3 rounded-xl text-sm font-bold font-body flex items-center justify-center gap-2 bg-brand-red text-white hover:bg-red-700 shadow-md shadow-brand-red/20 transition-all duration-150 hover:scale-[1.02] active:scale-100",children:["Subscribe ",a.jsx(vu,{className:"w-3.5 h-3.5"})]})})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[a.jsx(Xg,{}),a.jsxs("div",{className:"border border-gray-200 bg-white rounded-xl overflow-hidden",children:[a.jsx("div",{className:"bg-brand-black text-white px-4 py-3",children:a.jsx("h3",{className:"font-semibold text-sm uppercase tracking-widest",children:"Why Subscribe?"})}),a.jsxs("div",{className:"p-4 space-y-3 font-body text-sm text-gray-700",children:[a.jsx("p",{className:"leading-relaxed",children:M}),a.jsx("p",{className:"leading-relaxed",children:L}),a.jsxs("div",{className:"border-t border-gray-100 pt-3",children:[a.jsx("p",{className:"font-semibold text-brand-black mb-1",children:"Questions?"}),a.jsxs("p",{children:["Call"," ",a.jsx("a",{href:`tel:+1${B.replace(/\D/g,"")}`,className:"text-brand-red hover:underline",children:B})]}),a.jsx("p",{className:"mt-1",children:a.jsx("a",{href:`mailto:${I}`,className:"text-brand-red hover:underline text-xs break-all",children:I})})]})]})]}),a.jsxs("div",{className:"border border-gray-200 bg-white rounded-xl overflow-hidden",children:[a.jsx("div",{className:"bg-brand-black text-white px-4 py-3",children:a.jsx("h3",{className:"font-semibold text-sm uppercase tracking-widest",children:"Gift Subscriptions"})}),a.jsxs("div",{className:"p-4 font-body text-sm text-gray-600 leading-relaxed",children:[a.jsx("p",{children:z}),a.jsxs("a",{href:`tel:+1${X.replace(/\D/g,"")}`,className:"inline-flex items-center gap-1 mt-3 text-brand-red font-semibold hover:underline",children:["Call ",X," ",a.jsx(zx,{className:"w-3.5 h-3.5"})]})]})]})]})]})}const Kw={address_line1:"174 NE 351 Hwy",address_line2:"Cross City, FL 32628",phone:"(352) 498-3312",email_news:"[email protected]",email_ads:"[email protected]",hours:"Mon – Fri: 8am – 5pm",hours_note:"Closed weekends & holidays",advertise_blurb:"Reach thousands of Dixie County residents. Contact us for rates and availability."};function dq(){const[r,e]=k.useState({name:"",email:"",subject:"",message:""}),[t,n]=k.useState(!1),[s,i]=k.useState(!1),[o,l]=k.useState(""),[c,u]=k.useState(Kw),h=It().pathname;k.useEffect(()=>{Xs("contact").then(m=>{Object.keys(m).length>0&&u({...Kw,...m})})},[]);const f=m=>c[m]??Kw[m]??"",p=async m=>{m.preventDefault(),i(!0),l("");const{ok:g,error:v}=await Vx("contact",r.name,r.email,{Name:r.name,Email:r.email,Subject:r.subject||"(none)",Message:r.message});i(!1),g?(n(!0),e({name:"",email:"",subject:"",message:""})):l(v??"Something went wrong. Please try again.")};return a.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-10",children:[a.jsx(ze,{zone:"leaderboard",page:h,className:"mb-6"}),a.jsxs("div",{className:"max-w-5xl mx-auto",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-400 mb-6",children:[a.jsx($e,{to:"/",className:"hover:text-navy-700",children:"Home"}),a.jsx("span",{children:"/"}),a.jsx("span",{children:"Contact Us"})]}),a.jsx("h1",{className:"font-serif text-3xl md:text-4xl font-bold text-navy-900 mb-2",children:"Contact Us"}),a.jsx("p",{className:"text-gray-500 mb-8 max-w-xl",children:"Have a news tip, a question, or want to advertise? We'd love to hear from you. Our team is here to help."}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[a.jsxs("div",{className:"space-y-5",children:[a.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-5 shadow-sm",children:[a.jsx("h2",{className:"font-semibold text-navy-900 mb-4",children:"Get In Touch"}),a.jsxs("ul",{className:"space-y-4 text-sm",children:[a.jsxs("li",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-navy-50 rounded-lg flex items-center justify-center flex-shrink-0",children:a.jsx(yo,{className:"w-4 h-4 text-navy-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-navy-800",children:"Office Address"}),a.jsxs("p",{className:"text-gray-500",children:[f("address_line1"),a.jsx("br",{}),f("address_line2")]})]})]}),a.jsxs("li",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-navy-50 rounded-lg flex items-center justify-center flex-shrink-0",children:a.jsx(Ck,{className:"w-4 h-4 text-navy-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-navy-800",children:"Phone"}),a.jsx("a",{href:`tel:+1${f("phone").replace(/\D/g,"")}`,className:"text-navy-600 hover:text-navy-900",children:f("phone")})]})]}),a.jsxs("li",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-navy-50 rounded-lg flex items-center justify-center flex-shrink-0",children:a.jsx(go,{className:"w-4 h-4 text-navy-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-navy-800",children:"Email"}),a.jsx("a",{href:`mailto:${f("email_news")}`,className:"text-navy-600 hover:text-navy-900 break-all",children:f("email_news")})]})]}),a.jsxs("li",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-navy-50 rounded-lg flex items-center justify-center flex-shrink-0",children:a.jsx(zr,{className:"w-4 h-4 text-navy-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-navy-800",children:"Office Hours"}),a.jsx("p",{className:"text-gray-500",children:f("hours")}),a.jsx("p",{className:"text-gray-500",children:f("hours_note")})]})]})]})]}),a.jsxs("div",{className:"bg-navy-900 rounded-xl p-5 text-white",children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Advertise With Us"}),a.jsx("p",{className:"text-navy-300 text-sm leading-relaxed mb-3",children:f("advertise_blurb")}),a.jsx("a",{href:`mailto:${f("email_ads")}`,className:"text-gold-400 text-sm font-semibold hover:text-gold-300 transition-colors",children:f("email_ads")})]})]}),a.jsx("div",{className:"lg:col-span-2",children:a.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-6 shadow-sm",children:[a.jsx("h2",{className:"font-semibold text-navy-900 text-lg mb-5",children:"Send Us a Message"}),t?a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[a.jsx(At,{className:"w-14 h-14 text-green-500 mb-4"}),a.jsx("h3",{className:"font-bold text-navy-900 text-xl mb-2",children:"Message Sent!"}),a.jsx("p",{className:"text-gray-500 max-w-sm",children:"Thank y
778ou for reaching out. A member of our team will get back to you within one business day."}),a.jsx("button",{onClick:()=>n(!1),className:"mt-6 text-navy-600 text-sm underline",children:"Send another message"})]}):a.jsxs("form",{onSubmit:p,className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["Your Name ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{type:"text",required:!0,value:r.name,onChange:m=>e({...r,name:m.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-2.5 text-sm focus:outline-none focus:border-navy-500 focus:ring-1 focus:ring-navy-500",placeholder:"Jane Smith"})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["Email Address ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{type:"email",required:!0,value:r.email,onChange:m=>e({...r,email:m.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-2.5 text-sm focus:outline-none focus:border-navy-500 focus:ring-1 focus:ring-navy-500",placeholder:"[email protected]"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Subject"}),a.jsxs("select",{value:r.subject,onChange:m=>e({...r,subject:m.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-2.5 text-sm focus:outline-none focus:border-navy-500 focus:ring-1 focus:ring-navy-500",children:[a.jsx("option",{value:"",children:"Select a subject…"}),a.jsx("option",{children:"News Tip"}),a.jsx("option",{children:"Advertising Inquiry"}),a.jsx("option",{children:"Obituary Submission"}),a.jsx("option",{children:"Letter to the Editor"}),a.jsx("option",{children:"Classified Ad"}),a.jsx("option",{children:"General Question"}),a.jsx("option",{children:"Other"})]})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["Message ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("textarea",{required:!0,rows:6,value:r.message,onChange:m=>e({...r,message:m.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-2.5 text-sm focus:outline-none focus:border-navy-500 focus:ring-1 focus:ring-navy-500 resize-none",placeholder:"Tell us what's on your mind…"})]}),o&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg px-3 py-2",children:[a.jsx(Ve,{className:"w-4 h-4 shrink-0"})," ",o]}),a.jsxs("button",{type:"submit",disabled:s,className:"w-full bg-brand-red hover:bg-red-700 text-white font-semibold py-3 rounded-lg text-sm transition-colors flex items-center justify-center gap-2 disabled:opacity-60",children:[s?a.jsx(_e,{className:"w-4 h-4 animate-spin"}):a.jsx(qg,{className:"w-4 h-4"}),s?"Sending…":"Send Message"]})]})]})})]})]}),a.jsx(ze,{zone:"footer",page:h,className:"mt-8"})]})}const H_={hero_headline:"Advertise With The Dixie County Advocate",hero_subhead:"Reach over 17,000 Dixie County residents every week with targeted print and digital advertising.",intro:"The Dixie County Advocate is the community's most trusted source of local news. Our readers are engaged, local, and loyal — the exact audience your business needs to reach.",contact_name:"Diana Weston",contact_title:"Advertising Manager",contact_email:"[email protected]",contact_phone:"(352) 498-3312",pkg_print_name:"Print Display Ad",pkg_print_desc:"Full-color ads in our weekly print edition, delivered to every subscriber in Dixie County.",pkg_print_sizes:"Full Page, Half Page, Quarter Page, Business Card",pkg_print_price:"Starting at $85/week",pkg_digital_name:"Digital Banner Ad",pkg_digital_desc:"Banner ads on our website — leaderboard, sidebar, in-content, and footer placements.",pkg_digital_sizes:"728×90 Leaderboard, 300×250 Sidebar, In-Content, Footer",pkg_digital_price:"Starting at $50/week",pkg_combo_name:"Print + Digital Bundle",pkg_combo_desc:"Maximum visibility — run your ad in print and online simultaneously for the best reach.",pkg_combo_sizes:"All print and digital placements",pkg_combo_price:"Starting at $120/week",pkg_classified_name:"Classified Ad",pkg_classified_desc:"Text-based listings for jobs, rentals, services, and merchandise. Affordable and effective.",pkg_classified_sizes:"Up to 30 words",pkg_classified_price:"$15 per insertion",deadline_note:"Ad copy deadline is every Tuesday at noon for that week's Thursday print edition. Digital ads go live immediately upon approval."},hq=[{prefix:"pkg_print",icon:"🗞️",accent:"border-brand-red"},{prefix:"pkg_digital",icon:"🖥️",accent:"border-blue-700"},{prefix:"pkg_combo",icon:"⭐",accent:"border-amber-500"},{prefix:"pkg_classified",icon:"📋",accent:"border-gray-400"}];function Kr(r,e){return r[e]??H_[e]??""}function fq(){const[r,e]=k.useState(H_),[t,n]=k.useState(!0),i=It().pathname;return k.useEffect(()=>{Xs("advertise").then(o=>{Object.keys(o).length>0&&e({...H_,...o}),n(!1)})},[]),a.jsxs("div",{className:"max-w-5xl mx-auto px-4 py-8",children:[a.jsx(ze,{zone:"leaderboard",page:i,className:"mb-6"}),a.jsxs("div",{className:"bg-gray-900 text-white text-center py-12 px-6 mb-10 rounded-xl",children:[a.jsx("h1",{className:"font-masthead text-3xl md:text-4xl font-bold leading-tight mb-3",children:t?a.jsx("span",{className:"opacity-50",children:"Loading…"}):Kr(r,"hero_headline")}),a.jsx("p",{className:"font-headline italic text-white/80 text-lg max-w-2xl mx-auto",children:Kr(r,"hero_subhead")}),a.jsxs("a",{href:`mailto:${Kr(r,"contact_email")}`,className:"inline-flex items-center gap-2 mt-6 bg-brand-red hover:bg-brand-red-dark text-white font-semibold px-6 py-3 transition-colors",children:[a.jsx(go,{className:"w-4 h-4"})," Contact Our Ad Team"]})]}),a.jsx("div",{className:"max-w-2xl mx-auto text-center mb-12",children:a.jsx("p",{className:"font-body text-gray-700 text-base leading-relaxed",children:Kr(r,"intro")})}),a.jsx("h2",{className:"font-headline text-2xl font-bold text-brand-black text-center mb-6",children:"Advertising Packages"}),a.jsx("div",{className:"grid sm:grid-cols-2 gap-5 mb-10",children:hq.map(({prefix:o,icon:l,accent:c})=>a.jsxs("div",{className:`bg-white border-2 ${c} rounded-xl p-6 shadow-sm hover:shadow-md transition-shadow`,children:[a.jsx("div",{className:"text-2xl mb-2",children:l}),a.jsx("h3",{className:"font-headline text-xl font-bold text-brand-black mb-2",children:Kr(r,`${o}_name`)}),a.jsx("p",{className:"font-body text-gray-600 text-sm leading-relaxed mb-4",children:Kr(r,`${o}_desc`)}),a.jsxs("div",{className:"space-y-2 text-sm",children:[a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(At,{className:"w-4 h-4 text-green-500 mt-0.5 shrink-0"}),a.jsx("span",{className:"font-body text-gray-600",children:Kr(r,`${o}_sizes`)})]}),a.jsx("div",{className:"mt-3 pt-3 border-t border-gray-100",children:a.jsx("span",{className:"font-headline font-bold text-brand-red text-lg",children:Kr(r,`${o}_price`)})})]})]},o))}),Kr(r,"deadline_note")&&a.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-xl px-5 py-4 mb-10 text-sm font-body text-amber-900",children:[a.jsx("strong",{children:"Deadline:"})," ",Kr(r,"deadline_note")]}),a.jsxs("div",{className:"bg-brand-red text-white rounded-xl p-8 text-center",children:[a.jsx("h2",{className:"font-headline text-2xl font-bold mb-2",children:"Ready to Advert
778ise?"}),a.jsxs("p",{className:"text-white/80 font-body text-sm mb-6 max-w-md mx-auto",children:["Contact ",Kr(r,"contact_name"),", our ",Kr(r,"contact_title"),", to discuss your advertising needs."]}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-4",children:[a.jsxs("a",{href:`mailto:${Kr(r,"contact_email")}`,className:"flex items-center gap-2 bg-white text-brand-red font-bold px-6 py-3 hover:bg-gray-100 transition-colors",children:[a.jsx(go,{className:"w-4 h-4"})," ",Kr(r,"contact_email")]}),a.jsxs("a",{href:`tel:${Kr(r,"contact_phone").replace(/\D/g,"")}`,className:"flex items-center gap-2 border-2 border-white text-white font-bold px-6 py-3 hover:bg-white hover:text-brand-red transition-colors",children:[a.jsx(Ck,{className:"w-4 h-4"})," ",Kr(r,"contact_phone")]})]})]}),a.jsx(ze,{zone:"footer",page:i,className:"mt-8"})]})}const eP=[{zone:"leaderboard",label:"Leaderboard",size:"728×90",thumbW:48,thumbH:10,icon:NU},{zone:"sidebar",label:"Sidebar",size:"300×250",thumbW:48,thumbH:40,icon:xU},{zone:"in-content",label:"In-Content",size:"728×90",thumbW:48,thumbH:10,icon:rU},{zone:"footer",label:"Footer",size:"728×90",thumbW:48,thumbH:10,icon:_U}];function pq({zone:r,placements:e,allAds:t,rotationEnabled:n,leaderboardRotationEnabled:s,onAdd:i,onRemove:o,onMoveUp:l,onMoveDown:c,onSetLock:u,saving:d}){const[h,f]=k.useState(!1),[p,m]=k.useState(""),g=eP.find(E=>E.zone===r),v=g.icon,b=new Set(e.map(E=>E.ad_id)),y=t.filter(E=>E.active&&!b.has(E.id)&&E.name.toLowerCase().includes(p.toLowerCase())),w=[...e].sort((E,T)=>E.position-T.position),_=r==="sidebar",N=r==="leaderboard",S=_&&n||N&&s;return a.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-4 flex flex-col gap-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(v,{className:"w-4 h-4 text-gray-400 shrink-0"}),a.jsx("span",{className:"font-semibold text-gray-800 text-sm",children:g.label}),S&&a.jsxs("span",{className:"flex items-center gap-1 ml-1 text-[10px] font-semibold text-amber-700 bg-amber-50 border border-amber-200 rounded-full px-2 py-0.5",children:[a.jsx(Ru,{className:"w-2.5 h-2.5"})," ",N?"Weekly":"Rotating"]}),a.jsx("span",{className:"ml-auto text-xs text-gray-400 bg-gray-100 px-2 py-0.5 rounded-full",children:g.size})]}),S&&w.length>0&&a.jsx("p",{className:"text-[11px] text-amber-700 leading-snug bg-amber-50 border border-amber-100 rounded-lg px-3 py-2",children:N?"Ads rotate through leaderboard slots every Monday. Use the lock icon to pin an ad to a fixed slot.":"Ads rotate through sidebar slots every 30 minutes. Use the lock icon to pin an ad to a fixed slot."}),a.jsx("div",{className:"space-y-1.5 min-h-[48px]",children:w.length===0?a.jsx("div",{className:"border-2 border-dashed border-gray-200 rounded-lg p-3 text-center",children:a.jsx("p",{className:"text-xs text-gray-400",children:"No ads assigned"})}):w.map((E,T)=>a.jsx(mq,{placement:E,idx:T,total:w.length,thumbW:g.thumbW,thumbH:g.thumbH,showLock:S,saving:d,onMoveUp:()=>l(E),onMoveDown:()=>c(E),onRemove:()=>o(E.id),onSetLock:D=>u(E,D)},E.id))}),h?a.jsxs("div",{className:"border border-gray-200 rounded-lg bg-white shadow overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-gray-100",children:[a.jsx("input",{autoFocus:!0,t
778ype:"text",placeholder:"Search ads…",value:p,onChange:E=>m(E.target.value),className:"flex-1 text-xs outline-none placeholder-gray-400"}),a.jsx("button",{type:"button",onClick:()=>{f(!1),m("")},className:"text-gray-400 hover:text-gray-600",children:a.jsx(tt,{className:"w-3.5 h-3.5"})})]}),a.jsx("div",{className:"max-h-40 overflow-y-auto",children:y.length===0?a.jsx("p",{className:"text-xs text-gray-400 text-center py-3",children:t.filter(E=>E.active).length===0?"No active ads in library":"All active ads already assigned"}):y.map(E=>a.jsxs("button",{type:"button",onClick:async()=>{await i(E.id,r),f(!1),m("")},className:"w-full flex items-center gap-2.5 px-3 py-2 hover:bg-gray-50 text-left transition",children:[a.jsx("div",{className:"shrink-0 rounded overflow-hidden bg-gray-100 border border-gray-100",style:{width:32,height:g.thumbH>20?27:9},children:E.image_url&&a.jsx("img",{src:E.image_url,alt:"",className:"w-full h-full object-fill"})}),a.jsx("span",{className:"text-xs font-medium text-gray-700 truncate flex-1",children:E.name}),a.jsx(Nk,{className:"w-3 h-3 text-gray-300 shrink-0"})]},E.id))})]}):a.jsxs("button",{type:"button",onClick:()=>f(!0),className:"w-full flex items-center justify-center gap-1.5 py-1.5 border border-dashed border-gray-300 rounded-lg text-xs text-gray-500 hover:border-gray-400 hover:text-gray-700 hover:bg-gray-50 transition",children:[a.jsx(No,{className:"w-3 h-3"})," Add to ",g.label]})]})}function mq({placement:r,idx:e,total:t,thumbW:n,thumbH:s,showLock:i,saving:o,onMoveUp:l,onMoveDown:c,onRemove:u,onSetLock:d}){const[h,f]=k.useState(!1),p=r.rotation_lock_position!==null;return a.jsxs("div",{className:`flex items-center gap-2 border rounded-lg px-2.5 py-2 group transition ${p?"border-amber-200 bg-amber-50":"border-gray-100 bg-gray-50 hover:border-gray-200"}`,children:[p?a.jsx("span",{title:`Locked to slot ${r.rotation_lock_position}`,className:"w-5 h-5 rounded-full bg-amber-400 flex items-center justify-center shrink-0 text-[10px] font-bold text-white",children:r.rotation_lock_position}):a.jsx("span",{className:"w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center shrink-0 text-xs font-bold text-gray-600",children:r.position}),a.jsx("div",{className:"shrink-0 rounded overflow-hidden bg-gray-200 border border-gray-200",style:{width:n,height:s},children:r.ad.image_url&&a.jsx("img",{src:r.ad.image_url,alt:"",className:"w-full h-full object-fill"})}),a.jsx("span",{className:"flex-1 text-xs font-medium text-gray-700 truncate",children:r.ad.name}),i&&a.jsxs("div",{className:"relative shrink-0",children:[a.jsx("button",{type:"button",disabled:o,onClick:()=>f(m=>!m),title:p?`Locked to slot ${r.rotation_lock_position} — click to change`:"Unlock — click to lock to a slot",className:`p-1 rounded transition ${p?"text-amber-600 hover:text-amber-800 hover:bg-amber-100":"text-gray-400 hover:text-gray-600 hover:bg-gray-100 opacity-0 group-hover:opacity-100"}`,children:p?a.jsx(Sk,{className:"w-3.5 h-3.5"}):a.jsx(iA,{className:"w-3.5 h-3.5"})}),h&&a.jsxs("div",{className:"absolute right-0 top-full mt-1 z-20 bg-white border border-gray-200 rounded-xl shadow-xl p-3 w-44",children:[a.jsx("p",{className:"text-[11px] font-semibold text-gray-600 mb-2 uppercase tracking-wider",children:"Lock to slot"}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:Array.from({length:t},(m,g)=>g+1).map(m=>a.jsx("button",{type:"button",onClick:()=>{d(m),f(!1)},className:`w-7 h-7 rounded-full text-xs font-bold transition ${r.rotation_lock_position===m?"bg-amber-400 text-white":"bg-gray-100 text-gray-700 hover:bg-amber-100 hover:text-amber-800"}`,children:m},m))}),p&&a.jsxs("button",{type:"button",onClick:()=>{d(null),f(!1)},className:"w-full flex items-center justify-center gap-1.5 py-1.5 border border-gray-200 rounded-lg text-xs text-gray-500 hover:bg-gray-50 transition",children:[a.jsx(iA,{className:"w-3 h-3"})," Remove lock"]})]})]}),a.jsxs("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition shrink-0",children:[a.jsx("button",{type:"button",disabled:e===0||o,onClick:l,className:"p-1 rounded text-gray-400 hover:text-gray-700 hover:bg-gray-100 disabled:opacity-30 transition",children:a.jsx(fa,{className:"w-3.5 h-3.5"})}),a.jsx("button",{type:"button",disabled:e===t-1||o,onClick:c,className:"p-1 rounded text-gray-400 hover:text-gray-700 hover:bg-gray-100 disabled:opacity-30 transition",children:a.jsx(Ws,{className:"w-3.5 h-3.5"})}),a.jsx("button",{type:"button",disabled:o,onClick:u,className:"p-1 rounded text-red-400 hover:text-red-600 hover:bg-red-50 disabled:opacity-30 transition",children:a.jsx(tt,{className:"w-3.5 h-3.5"})})]}),o&&a.jsx(_e,{className:"w-3 h-3 animate-spin text-gray-300 shrink-0"})]})}function gq({allAds:r}){const[e,t]=k.useState([]),[n,s]=k.useState(null),[i,o]=k.useState([]),[l,c]=k.useState(!0),[u,d]=k.useState(!1),[h,f]=k.useState(!1),[p,m]=k.useState(""),[g,v]=k.useState(!1),[b,y]=k.useState(""),[w,_]=k.useState(""),[N,S]=k.useState(""),[E,T]=k.useState(!1),D=k.useCallback(async()=>{c(!0);const F=await tH();t(F),c(!1),F.length>0&&!n&&s(F[0].id)},[n]),R=k.useCallback(async F=>{d(!0);const q=await nH(F);o(q),d(!1)},[]);k.useEffect(()=>{D()},[]),k.useEffect(()=>{n&&R(n)},[n,R]);const H=e.find(F=>F.id===n),A=F=>i.filter(q=>q.zone===F).sort((q,V)=>q.position-V.position),U=async()=>{const F=b.trim(),q=w.trim();if(!F.startsWith("/")){S("Path must start with '/'.");return}if(!q){S("Label is required.");return}T(!0),S("");const{error:V,data:K}=await Bw({path:F,label:q,sort_order:e.length,sidebar_rotation:!1,leaderboard_weekly_rotation:!1});if(T(!1),V){S(V);return}v(!1),y(""),_(""),await D(),K&&s(K.id)},C=async F=>{confirm(`Remove "${F.label}"? All ad assignments for this page will be deleted.`)&&(await rH(
778F.id),n===F.id&&s(null),await D())},M=async()=>{H&&(f(!0),await Bw({...H,sidebar_rotation:!H.sidebar_rotation}),await D(),f(!1))},L=async()=>{H&&(f(!0),await Bw({...H,leaderboard_weekly_rotation:!H.leaderboard_weekly_rotation}),await D(),f(!1))},B=async(F,q)=>{if(!n)return;const V=i.filter(ee=>ee.zone===q),K=V.length?Math.max(...V.map(ee=>ee.position))+1:1;f(!0),await sH({ad_id:F,page_id:n,zone:q,position:K}),await R(n),f(!1)},I=async F=>{if(!n)return;const q=i.find(V=>V.id===F);if(f(!0),await iH(F),q){const V=q.zone,K=i.filter(ee=>ee.zone===V&&ee.id!==F).sort((ee,Z)=>ee.position-Z.position).map((ee,Z)=>({id:ee.id,position:Z+1}));K.length&&await fA(K)}await R(n),f(!1)},z=async(F,q)=>{if(!n)return;const V=F.zone,K=i.filter(ie=>ie.zone===V).sort((ie,pe)=>ie.position-pe.position),ee=K.findIndex(ie=>ie.id===F.id),Z=q==="up"?ee-1:ee+1;Z<0||Z>=K.length||(f(!0),await fA([{id:K[ee].id,position:K[Z].position},{id:K[Z].id,position:K[ee].position}]),await R(n),f(!1))},X=async(F,q)=>{n&&(f(!0),await aH(F.id,q),await R(n),f(!1))};return a.jsxs("div",{className:"flex gap-4 min-h-[520px]",children:[a.jsxs("div",{className:"w-52 shrink-0 flex flex-col gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Pages"}),a.jsx("button",{type:"button",onClick:()=>{v(F=>!F),S("")},className:"p-1 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-100 transition",title:"Add page",children:a.jsx(No,{className:"w-4 h-4"})})]}),g&&a.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-3 shadow-sm space-y-2",children:[a.jsx("p",{className:"text-xs font-semibold text-gray-700",children:"Add Page"}),N&&a.jsxs("p",{className:"text-xs text-red-600 flex items-center gap-1",children:[a.jsx(Ve,{className:"w-3 h-3"})," ",N]}),a.jsx("input",{type:"text",value:b,onChange:F=>y(F.target.value),placeholder:"/path",className:"w-full border border-gray-200 rounded-lg px-2.5 py-1.5 text-xs focus:outline-none focus:border-blue-400"}),a.jsx("input",{type:"text",value:w,onChange:F=>_(F.target.value),placeholder:"Label",className:"w-full border border-gray-200 rounded-lg px-2.5 py-1.5 text-xs focus:outline-none focus:border-blue-400",onKeyDown:F=>{F.key==="Enter"&&U()}}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsxs("button",{type:"button",onClick:U,disabled:E,className:"flex-1 flex items-center justify-center gap-1 py-1.5 bg-gray-900 text-white rounded-lg text-xs font-semibold hover:bg-gray-800 disabled:opacity-50",children:[E?a.jsx(_e,{className:"w-3 h-3 animate-spin"}):a.jsx(Nk,{className:"w-3 h-3"})," Add"]}),a.jsx("button",{type:"button",onClick:()=>{v(!1),y(""),_(""),S("")},className:"px-2.5 py-1.5 border border-gray-200 rounded-lg text-xs text-gray-500 hover:bg-gray-50",children:a.jsx(tt,{className:"w-3 h-3"})})]})]}),l?a.jsx("div",{className:"flex justify-center pt-8",children:a.jsx(_e,{className:"w-5 h-5 animate-spin text-gray-300"})}):a.jsx("div",{className:"space-y-1",children:e.map(F=>a.jsxs("div",{className:`flex items-center gap-1.5 group rounded-xl px-3 py-2 cursor-pointer transition-all ${n===F.id?"bg-gray-900 text-white":"text-gray-700 hover:bg-gray-100"}`,onClick:()=>s(F.id),children:[a.jsx(tA,{className:`w-3.5 h-3.5 shrink-0 ${n===F.id?"text-gray-300":"text-gray-400"}`}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium truncate",children:F.label}),a.jsx("p",{className:`text-xs truncate ${n===F.id,"text-gray-400"}`,children:F.path})]}),F.sidebar_rotation&&a.jsx(Ru,{className:`w-3 h-3 shrink-0 ${n===F.id?"text-amber-400":"text-amber-500"}`,title:"Sidebar rotation on"}),F.leaderboard_weekly_rotation&&a.jsx(jb,{className:`w-3 h-3 shrink-0 ${n===F.id?"text-blue-400":"text-blue-500"}`,title:"Leaderboard weekly rotation on"}),a.jsx("button",{type:"button",onClick:q=>{q.stopPropagation(),C(F)},className:`shrink-0 p-0.5 rounded opacity-0 group-hover:opacity-100 transition ${n===F.id?"text-gray-400 hover:text-red-300 hover:bg-white/10":"text-gray-400 hover:text-red-500 hover:bg-red-50"}`,title:"Remove page",children:a.jsx(Sn,{className:"w-3 h-3"})})]},F.id))})]}),a.jsx("div",{className:"flex-1 min-w-0",children:H?a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-900 flex items-center justify-center shrink-0",children:a.jsx(tA,{className:"w-4 h-4 text-white"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"font-bold text-gray-900",children:H.label}),a.jsx("p",{className:"text-xs text-gray-400",children:H.path})]}),a.jsxs("div",{className:"ml-auto flex items-center gap-3 bg-white border border-gray-200 rounded-xl px-4 py-2.5",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(jb,{className:`w-4 h-4 ${H.leaderboard_weekly_rotation?"text-blue-500":"text-gray-400"}`}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-semibold text-gray-700 leading-tight",children:"Leaderboard Weekly"}),a.jsx("p",{className:"text-[11px] text-gray-400 leading-tight",children:H.leaderboard_weekly_rotation?"Rotates every Monday":"Fixed order"})]})]}),a.jsx("button",{type:"button",disabled:h,onClick:L,className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors disabled:opacity-50 ${H.leaderboard_weekly_rotation?"bg-blue-400":"bg-gray-300"}`,children:a.jsx("span",{className:`inline-block h-3.5 w-3.5 rounded-full bg-white shadow transition-transform ${H.leaderboard_weekly_rotation?"translate-x-4.5":"translate-x-0.5"}`})})]}),a.jsxs("div",{className:"flex items-center gap-3 bg-white border border-gray-200 rounded-xl px-4 py-2.5",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ru,{className:`w-4 h-4 ${H.sidebar_rotation?"text-amber-500":"text-gray-400"}`}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-semibold text-gray-700 leading-tight",children:"Sidebar Rotation"}),a.jsx("p",{className:"text-[11px] text-gray-400 leading-tight",children:H.sidebar_rotation?"Ads rotate every 30 min":"Fixed order"})]})]}),a.jsx("button",{type:"button",disabled:h,onClick:M,className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors disabled:opacity-50 ${H.sidebar_rotation?"bg-amber-400":"bg-gray-300"}`,children:a.jsx("span",{className:`inline-block h-3.5 w-3.5 rounded-full bg-white shadow transition-transform ${H.sidebar_rotation?"translate-x-4.5":"translate-x-0.5"}`})})]}),u&&a.jsx(_e,{className:"w-4 h-4 animate-spin text-gray-400"})]}),p&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg px-3 py-2 mb-4",children:[a.jsx(Ve,{className:"w-4 h-4 shrink-0"})," ",p,a.jsx("button",{onClick:()=>m(""),className:"ml-auto",children:a.jsx(tt,{className:"w-3.5 h-3.5"})})]}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:eP.map(({zone:F})=>
778a.jsx(pq,{zone:F,placements:A(F),allAds:r,rotationEnabled:H.sidebar_rotation,leaderboardRotationEnabled:H.leaderboard_weekly_rotation,onAdd:B,onRemove:I,onMoveUp:q=>z(q,"up"),onMoveDown:q=>z(q,"down"),onSetLock:X,saving:h},F))})]}):a.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center text-gray-400 border-2 border-dashed border-gray-200 rounded-2xl py-16 px-6",children:[a.jsx(mU,{className:"w-10 h-10 mb-3 text-gray-300"}),a.jsx("p",{className:"font-medium text-gray-500 mb-1",children:"Select a page"}),a.jsx("p",{className:"text-sm",children:"Choose a page from the left to manage its ad assignments."})]})})]})}const yq={title:"",content:"",content_type:"text",image_url:null,notice_type:"general",published:!1},Ik={general:"Public Notice",hearing:"Public Hearing",bid:"Invitation to Bid",legal:"Legal Notice"};function bq(r){const e=["th","st","nd","rd"],t=r%100;return r+(e[(t-20)%10]??e[t]??e[0])}function Lk(r){if(!r)return"_______________";const[e,t,n]=r.split("-"),s=["January","February","March","April","May","June","July","August","September","October","November","December"];return`${bq(parseInt(n,10))} day of ${s[parseInt(t,10)-1]}, ${e}`}function tP(r){if(!r)return"";const[e,t,n]=r.split("-");return`${["January","February","March","April","May","June","July","August","September","October","November","December"][parseInt(t,10)-1]} ${parseInt(n,10)}, ${e}`}function xq(r,e,t,n,s){const i=Ik[e]??e,o=t.filter(Boolean).map(tP),l=o.length>0?o.map(u=>`<div>${u}</div>`).join(""):"<div>_______________</div>",c=n?Lk(n):"_____ day of _______________, 20___";return`<!DOCTYPE html>
779<html lang="en">
780<head>
781<meta charset="UTF-8">
782<title> </title>
783<style>
784  @page { size: letter; margin: 0; }
785  * { box-sizing: border-box; margin: 0; padding: 0; }
786  body { font-family: 'Times New Roman', Times, serif; font-size: 10pt; color: #000; background: #fff; padding: 0.75in 0.5in; }
787
788  .page { display: flex; width: 100%; gap: 0; }
789
790  /* Left affidavit column: ~3.5 inches */
791  .affidavit-col { width: 3.5in; flex-shrink: 0; padding-right: 0.2in; }
792
793  /* Right paste column: remainder */
794  .paste-col {
795    flex: 1;
796    border: 1px dashed #999;
797    min-height: 9in;
798    display: flex;
799    align-items: flex-start;
800    justify-content: center;
801    padding-top: 0.5in;
802  }
803  .paste-label {
804    font-family: Arial, sans-serif;
805    font-size: 8pt;
806    color: #aaa;
807    text-align: center;
808    line-height: 1.4;
809    transform: rotate(-90deg);
810    white-space: nowrap;
811  }
812
813  .proof-title { font-size: 10pt; font-weight: bold; text-align: center; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.12in; }
814  .state-header { text-align: center; margin-bottom: 0.15in; }
815  .state-header p { font-size: 9pt; font-weight: bold; text-transform: uppercase; letter-spacing: 0.05em; line-height: 1.6; }
816  .newspaper-name { font-size: 9pt; font-weight: bold; text-align: center; border-top: 1pt solid #000; border-bottom: 1pt solid #000; padding: 2pt 0; margin-bottom: 0.15in; }
817
818  .body-text { font-size: 9.5pt; line-height: 1.5; margin-bottom: 0.12in; text-align: justify; }
819  .body-text strong { font-weight: bold; }
820
821  .dates-box {
822    border: 1pt solid #000;
823    padding: 4pt 6pt;
824    min-height: 30pt;
825    font-size: 9.5pt;
826    font-weight: bold;
827    text-align: center;
828    line-height: 1.8;
829    margin-bottom: 0.12in;
830  }
831
832  .sig-line { border-bottom: 1pt solid #000; height: 18pt; margin-bottom: 3pt; }
833  .sig-label { font-size: 7pt; text-align: center; margin-bottom: 0.12in; }
834
835  .sworn-text { font-size: 9.5pt; line-height: 1.5; margin-bottom: 0.15in; }
836
837  .notary-grid { display: flex; gap: 0.15in; margin-top: 0.1in; }
838  .notary-block { flex: 1; }
839  .notary-block .sig-line { margin-bottom: 2pt; }
840  .notary-block .sig-label { text-align: center; font-size: 7pt; }
841
842  .footer-note { font-size: 7pt; color: #555; border-top: 0.5pt solid #ccc; padding-top: 4pt; margin-top: 0.15in; text-align: center; }
843
844  .col-inches-footer { position: fixed; bottom: 0.25in; left: 0; right: 0; text-align: center; font-size: 10pt; font-weight: bold; }
845</style>
846</head>
847<body>
848<div class="page">
849  <!-- LEFT: Affidavit text (~2.5 in) -->
850  <div class="affidavit-col">
851    <div class="proof-title">Proof of Publication</div>
852
853    <div class="state-header">
854      <p>State of Florida</p>
855      <p>County of Dixie</p>
856    </div>
857
858    <div class="newspaper-name">Dixie County Advocate</div>
859
860    <p class="body-text">
861      Before me, the undersigned authority, personally appeared
862      <strong>Joseph Lander</strong>, on behalf of <strong>LSA Media LLC.</strong>, the
863      owner and publisher of the <strong>Dixie County Advocate</strong>
863, a weekly newspaper
864      published at Cross City, in Dixie County, Florida; that the attached copy of
865      advertisement, being a <strong>${i}</strong> for
866      <strong>${r||"_______________"}</strong>, was published in said newspaper in
867      the issues of:
868    </p>
869
870    <div class="dates-box">${l}</div>
871
872    <p class="body-text">
873      Affiant further says that the said <strong>Dixie County Advocate</strong> is a newspaper
874      published at Cross City, in said Dixie County, Florida, and that the said newspaper has
875      heretofore been continuously published in said Dixie County, Florida each week and has been
876      entered as Periodicals (USPS 158-760) matter at the post office in Cross City, in said Dixie County,
877      Florida, for a period of one year next preceding the first publication of the attached copy
878      of advertisement; and affiant further says that he has neither paid nor promised any person,
879      firm or corporation any discount, rebate, commission or refund for the purpose of securing
880      this advertisement for publication in the said newspaper.
881    </p>
882
883    <p class="body-text">
884      The Dixie County Advocate complies with all legal requirements for publication in chapter 50, Florida Statutes.
885    </p>
886
887    <div class="sig-line"></div>
888    <p class="sig-label">Joseph Lander, Publisher</p>
889
890    <p class="sworn-text">
891      Sworn to and subscribed before me this <strong>${c}</strong>.
892    </p>
893
894    <div class="notary-grid">
895      <div class="notary-block">
896        <div class="sig-line"></div>
897        <p class="sig-label">Notary Public, State of Florida at Large</p>
898      </div>
899    </div>
900
901    <p class="footer-note">Dixie County Advocate · P.O. Box 1538, Cross City, FL 32628 · (352) 498-3312</p>
902  </div>
903
904  <!-- RIGHT: Paste area (~6 in) -->
905  <div class="paste-col">
906  </div>
907</div>
908
909<div class="col-inches-footer">${s!==null?s.toFixed(2):""}</div>
910</body>
911</html>`}function rP(r,e,t,n){const s=r?`<span class="fill">${Ep(r)}</span>`:"",i=e.filter(Boolean),o=i.length>0?i.map(c=>`<span class="date-entry fill">${Ep(c)}</span>`).join(""):'<span class="date-blank"></span><span class="date-blank"></span><span class="date-blank"></span><span class="date-blank"></span>';return`<!DOCTYPE html>
912<html lang="en">
913<head>
914<meta charset="UTF-8">
915<title> </title>
916<style>
917  @page { size: letter; margin: 0; }
918  * { box-sizing: border-box; margin: 0; padding: 0; }
919  body { font-family: 'Times New Roman', Times, serif; font-size: 10pt; color: #000; background: #fff; padding: 0.75in 0.5in; }
920
921  .page { display: flex; width: 100%; gap: 0; }
922
923  .affidavit-col { width: 3.5in; flex-shrink: 0; padding-right: 0.2in; }
924
925  .paste-col {
926    flex: 1;
927    border: 1px dashed #999;
928    min-height: 9in;
929    display: flex;
930    align-items: flex-start;
931    justify-content: center;
932    padding-top: 0.5in;
933  }
934  .paste-label {
935    font-family: Arial, sans-serif;
936    font-size: 8pt;
937    color: #aaa;
938    text-align: center;
939    line-height: 1.4;
940    transform: rotate(-90deg);
941    white-space: nowrap;
942  }
943
944  .proof-title { font-size: 10pt; font-weight: bold; text-align: center; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.12in; }
945  .state-header { text-align: center; margin-bottom: 0.15in; }
946  .state-header p { font-size: 9pt; font-weight: bold; text-transform: uppercase; letter-spacing: 0.05em; line-height: 1.6; }
947  .newspaper-name { font-size: 9pt; font-weight: bold; text-align: center; border-top: 1pt solid #000; border-bottom: 1pt solid #000; padding: 2pt 0; margin-bottom: 0.15in; }
948
949  .body-text { font-size: 9.5pt; line-height: 1.5; margin-bottom: 0.12in; text-align: justify; }
950  .body-text strong { font-weight: bold; }
951
952  .title-line { border-bottom: 1pt solid #000; min-height: 14pt; margin-bottom: 0.12in; padding: 0 2pt; }
953
954  .dates-box {
955    border: 1pt solid #000;
956    padding: 4pt 6pt;
957    min-height: 80pt;
958    font-size: 9.5pt;
959    text-align: center;
960    line-height: 2.0;
961    margin-bottom: 0.12in;
962  }
963  .dates-box .date-blank { display: block; height: 16pt; }
964  .dates-box .date-entry { display: block; }
965
966  .sig-line { border-bottom: 1pt solid #000; height: 18pt; margin-bottom: 3pt; }
967  .sig-label { font-size: 7pt; text-align: center; margin-bottom: 0.12in; }
968
969  .sworn-text { font-size: 9.5pt; line-height: 1.5; margin-bottom: 0.15in; }
970
971  .notary-grid { display: flex; gap: 0.15in; margin-top: 0.1in; }
972  .notary-block { flex: 1; }
973  .notary-block .sig-line { margin-bottom: 2pt; }
974  .notary-block .sig-label { text-align: center; font-size: 7pt; }
975
976  .footer-note { font-size: 7pt; color: #555; border-top: 0.5pt solid #ccc; padding-top: 4pt; margin-top: 0.15in; text-align: center; }${n?`
977  body.overlay { background: #fff !important; }
978  body.overlay * { visibility: hidden !important; }
979  body.overlay .fill { visibility: visible !important; color: #000 !important; }
980  body.overlay .title-line { border: none !important; height: 14pt !important; min-height: 14pt !important; overflow: visible !important; }
981  body.overlay .dates-box { border: none !important; }
982  body.overlay .dates-box .date-blank { display: none !important; }
983  body.overlay .sig-line { border: none !important; }
984  body.overlay .newspaper-name { border: none !important; }
985  body.overlay .footer-note { border: none !important; }
986  body.overlay .paste-col { border: none !important; }`:""}
987</style>
988</head>
989<body${n?' class="overlay"':""}>
990<div class="page">
991  <div class="affidavit-col">
992    <div class="proof-title">Proof of Publication</div>
993
994    <div class="state-header">
995      <p>State of Florida</p>
996      <p>County of Dixie</p>
997    </div>
998
999    <div class="newspaper-name">Dixie County Advocate</div>
1000
1001    <p class="body-text">
1002      Before me, the undersigned authority, personally appeared
1003      <strong>Joseph Lander</strong>, on behalf of <strong>LSA Media LLC.</strong>, the
1004      owner and publisher of the <strong>Dixie County Advocate</strong>
1004, a weekly newspaper
1005      published at Cross City, in Dixie County, Florida; that the attached copy of
1006      advertisement, being a
1007    </p>
1008
1009    <div class="title-line">${s}</div>
1010
1011    <p class="body-text">
1012      was published in said newspaper in the issues of:
1013    </p>
1014
1015    <div class="dates-box">
1016      ${o}
1017    </div>
1018
1019    <p class="body-text">
1020      Affiant further says that the said <strong>Dixie County Advocate</strong> is a newspaper
1021      published at Cross City, in said Dixie County, Florida, and that the said newspaper has
1022      heretofore been continuously published in said Dixie County, Florida each week and has been
1023      entered as Periodicals (USPS 158-760) matter at the post office in Cross City, in said Dixie County,
1024      Florida, for a period of one year next preceding the first publication of the attached copy
1025      of advertisement; and affiant further says that he has neither paid nor promised any person,
1026      firm or corporation any discount, rebate, commission or refund for the purpose of securing
1027      this advertisement for publication in the said newspaper.
1028    </p>
1029
1030    <p class="body-text">
1031      The Dixie County Advocate complies with all legal requirements for publication in chapter 50, Florida Statutes.
1032    </p>
1033
1034    <div class="sig-line"></div>
1035    <p class="sig-label">Joseph Lander, Publisher</p>
1036
1037    <p class="sworn-text">
1038      Sworn to and subscribed before me this ${t?`<span class="fill">${Ep(Lk(t))}</span>`:""}
1039    </p>
1040
1041    <div class="notary-grid">
1042      <div class="notary-block">
1043        <div class="sig-line"></div>
1044        <p class="sig-label">Notary Public, State of Florida at Large</p>
1045      </div>
1046    </div>
1047
1048    <p class="footer-note">Dixie County Advocate · P.O. Box 1538, Cross City, FL 32628 · (352) 498-3312</p>
1049  </div>
1050
1051  <div class="paste-col">
1052  </div>
1053</div>
1054</body>
1055</html>`}function Ep(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function vq(r,e,t,n){const s=Ik[e]??e,i=Ep(r),o=Ep(t),l=new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}),c=n!==null?`${n.toFixed(2)} col. in.`:"_______________";return`<!DOCTYPE html>
1056<html lang="en">
1057<head>
1058<meta charset="UTF-8">
1059<title>Client Proof – ${i}</title>
1060<style>
1061  @page { size: letter; margin: 0.75in 0.5in; }
1062  * { box-sizing: border-box; margin: 0; padding: 0; }
1063  body { font-family: Arial, Helvetica, sans-serif; background: #fff; color: #000; }
1064
1065  .proof-banner {
1066    border: 2pt solid #000;
1067    padding: 10pt 16pt;
1068    text-align: center;
1069    margin-bottom: 14pt;
1070  }
1071  .proof-banner h1 {
1072    font-size: 14pt;
1073    font-weight: bold;
1074    text-transform: uppercase;
1075    letter-spacing: 0.12em;
1076  }
1077  .proof-banner .sub {
1078    font-size: 8pt;
1079    margin-top: 4pt;
1080    color: #555;
1081    text-transform: uppercase;
1082    letter-spacing: 0.08em;
1083  }
1084
1085  .notice-info {
1086    font-size: 9pt;
1087    margin-bottom: 14pt;
1088    padding-bottom: 8pt;
1089    border-bottom: 0.5pt solid #ccc;
1090  }
1091  .notice-info p { margin-bottom: 2pt; }
1092  .notice-info strong { font-weight: bold; }
1093
1094  .spec-label {
1095    font-size: 7pt;
1096    color: #999;
1097    margin-bottom: 6pt;
1098    letter-spacing: 0.05em;
1099    text-transform: uppercase;
1100  }
1101
1102  .proof-body {
1103    width: 1.6434in;
1104    font-size: 6pt;
1105    line-height: 1.15;
1106    font-family: 'Helvetica', Arial, sans-serif;
1107    text-align: justify;
1108    white-space: pre-wrap;
1109    word-wrap: break-word;
1110    overflow-wrap: break-word;
1111  }
1112</style>
1113</head>
1114<body>
1115  <div class="proof-banner">
1116    <h1>Client Proof</h1>
1117    <p class="sub">Proof — Not for Publication</p>
1118  </div>
1119
1120  <div class="notice-info">
1121    <p><strong>Notice Title:</strong> ${i||"_______________"}</p>
1122    <p><strong>Notice Type:</strong> ${s}</p>
1123    <p><strong>Proof Date:</strong> ${l}</p>
1124    <p><strong>Estimated Column Inches:</strong> ${c}</p>
1125  </div>
1126
1127  <p class="spec-label">Set in Helvetica 6pt · 1.6434" column · Florida Standard</p>
1128
1129  <div class="proof-body">${o}</div>
1130</body>
1131</html>`}function wq(r,e){const t=new Date(`${r}T00:00:00`);return t.setDate(t.getDate()+e),t.toISOString().slice(0,10)}
1131function _q({noticeId:r,noticeTitle:e,noticeType:t,pubDates:n,setPubDates:s,affidavitDate:i,setAffidavitDate:o,savedAffidavit:l,setSavedAffidavit:c,columnInches:u}){const[d,h]=k.useState(!1),[f,p]=k.useState(""),[m,g]=k.useState(!1),[v,b]=k.useState(1),[y,w]=k.useState(!1);k.useEffect(()=>{l&&(g(!0),l.affidavit_date&&w(!0))},[l]),k.useEffect(()=>{if(y||l!=null&&l.affidavit_date)return;const C=n.filter(Boolean);if(C.length>0){const M=C.sort()[C.length-1];o(M)}},[n,y,l,o]);const _=n.some(Boolean),N=(C,M)=>{const L=[];for(let B=0;B<M;B++)L.push(wq(C,B*7));s(L)},S=C=>{b(C);const M=n.find(Boolean);M&&N(M,C)},E=C=>{v>1&&C?N(C,v):s([C,...n.slice(1)])},T=()=>s([...n,""]),D=C=>s(n.filter((M,L)=>L!==C)),R=(C,M)=>s(n.map((L,B)=>B===C?M:L)),H=async()=>{h(!0),p("");const{data:C,error:M}=await PR({...l?{id:l.id}:{},notice_id:r??null,notice_title:e,notice_type:t,pub_dates:n.filter(Boolean),affidavit_date:i||null});h(!1),M?p("Error: "+M):(c(C),p("Saved"),setTimeout(()=>p(""),3e3))},A=()=>{var B,I;const C=xq(e,t,n,i,u),M=document.createElement("iframe");M.style.cssText="position:fixed;left:-9999px;top:0;width:816px;height:1056px;border:0;",document.body.appendChild(M);const L=M.contentDocument??((B=M.contentWindow)==null?void 0:B.document);if(!L){document.body.removeChild(M);return}L.open(),L.write(C),L.close(),(I=M.contentWindow)==null||I.focus(),setTimeout(()=>{var F;const X=L.body.scrollHeight;if(X>912){const q=Math.max(.55,912/X);L.body.style.zoom=String(q)}(F=M.contentWindow)==null||F.print(),setTimeout(()=>document.body.removeChild(M),1e3)},400)},U=()=>{var B,I;const C=rP(),M=document.createElement("iframe");M.style.cssText="position:fixed;left:-9999px;top:0;width:816px;height:1056px;border:0;",document.body.appendChild(M);const L=M.contentDocument??((B=M.contentWindow)==null?void 0:B.document);if(!L){document.body.removeChild(M);return}L.open(),L.write(C),L.close(),(I=M.contentWindow)==null||I.focus(),setTimeout(()=>{var F;const X=L.body.scrollHeight;if(X>912){const q=Math.max(.55,912/X);L.body.style.zoom=String(q)}(F=M.contentWindow)==null||F.print(),setTimeout(()=>document.body.removeChild(M),1e3)},400)};return a.jsxs("div",{className:"mt-6 bg-white border border-gray-200 rounded-xl shadow-sm overflow-hidden",children:[a.jsxs("div",{className:"px-6 py-4 flex items-center justify-between gap-3",children:[a.jsxs("button",{type:"button",onClick:()=>g(C=>!C),className:"flex items-center gap-2 text-left hover:opacity-70 transition-opacity",children:[a.jsx(Bt,{className:"w-5 h-5 text-navy-600"}),a.jsx("span",{className:"font-semibold text-navy-900 text-sm",children:"Proof of Publication Affidavit"}),l&&a.jsxs("span",{className:"flex items-center gap-1 text-xs text-green-600 font-medium",children:[a.jsx(At,{className:"w-3.5 h-3.5"})," Saved"]}),a.jsx("span",{className:"text-xs text-gray-500",children:m?"Hide":"Show"})]}),a.jsxs("button",{type:"button",onClick:U,className:"flex items-center gap-1.5 px-3 py-1.5 border border-gray-300 text-gray-700 rounded-lg text-sm font-semibold hover:bg-gray-50 transition-colors flex-shrink-0",title:"Print a blank affidavit form to fill in by hand",children:[a.jsx(Vd,{className:"w-4 h-4"})," Print Blank Affidavit"]})]}),m&&a.jsxs("div",{className:"border-t border-gray-200 p-6 space-y-5",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Publication Schedule"}),a.jsx("div",{className:"flex gap-2 mb-3",children:[1,2,4,5].map(C=>a.jsx("button",{type:"button",onClick:()=>S(C),className:`px-3 py-1.5 rounded-lg text-sm font-semibold border transition-colors ${v===C?"bg-navy-900 text-white border-navy-900":"bg-white text-gray-600 border-gray-300 hover:border-navy-400"}`,children:C===1?"1 Week":`${C} Weeks`},C))}),a.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"First Publication Date"}),a.jsx("input",{type:"date",value:n[0]??"",onChange:C=>E(C.target.value),className:"border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:border-navy-400 mb-3"}),v>1&&n.filter(Boolean).length>1&&a.jsxs("div",{className:"space-y-2 mb-2",children:[a.jsx("label",{className:"block text-xs font-medium text-gray-500",children:"Subsequent Publications (auto-filled, sequential Thursdays)"}),n.slice(1).map((C,M)=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"date",value:C,onChange:L=>R(M+1,L.target.value),className:"border border-gray-200 rounded-lg px-3 py-2 text-sm bg-gray-50 focus:outline-none focus:border-navy-400"}),a.jsxs("span",{className:"text-xs text-gray-400",children:["Week ",M+2]})]},M+1))]}),v===1&&a.jsxs("div",{className:"space-y-2",children:[n.slice(1).map((C,M)=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"date",value:C,onChange:L=>R(M+1,L.target.value),className:"border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:border-navy-400"}),n.length>1&&a.jsx("button",{type:"button",onClick:()=>D(M+1),className:"p-1.5 text-red-500 hover:bg-red-50 rounded-lg transition-colors",title:"Remove date",children:a.jsx(tt,{className:"w-4 h-4"})})]},M+1)),a.jsxs("button",{type:"button",onClick:T,className:"flex items-center gap-1.5 text-sm text-navy-600 hover:text-navy-900 font-medium",children:[a.jsx(sU,{className:"w-4 h-4"})," Add another date"]})]})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["Affidavit Date ",n.filter(
1131Boolean).length>0&&!y&&a.jsx("span",{className:"text-xs text-gray-400 font-normal",children:"(auto-set to last publication)"})]}),a.jsx("input",{type:"date",value:i,onChange:C=>{w(!0),o(C.target.value)},className:"border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:border-navy-400"})]}),a.jsxs("div",{className:"flex items-center gap-3 pt-1",children:[a.jsxs("button",{type:"button",onClick:A,disabled:!_,className:"flex items-center gap-1.5 px-4 py-2 border border-gray-300 text-gray-700 rounded-lg text-sm font-semibold hover:bg-gray-50 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",title:_?"":"Enter at least one publication date to print",children:[a.jsx(Vd,{className:"w-4 h-4"})," Print Affidavit"]}),a.jsxs("button",{type:"button",onClick:H,disabled:d||!_,className:"flex items-center gap-1.5 px-4 py-2 bg-navy-900 text-white rounded-lg text-sm font-semibold hover:bg-navy-800 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",title:_?"":"Enter at least one publication date to save",children:[d?a.jsx(_e,{className:"w-4 h-4 animate-spin"}):a.jsx(vn,{className:"w-4 h-4"}),d?"SAVING…":"SAVE"]}),f&&a.jsx("span",{className:`text-sm font-medium ${f.startsWith("Error")?"text-red-600":"text-green-600"}`,children:f})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-medium text-gray-500 uppercase tracking-wide mb-2",children:"Preview"}),a.jsx("div",{className:"border border-gray-200 rounded-lg bg-gray-50 overflow-hidden",children:a.jsxs("div",{className:"flex",style:{minHeight:"320px"},children:[a.jsxs("div",{className:"p-5 font-serif text-black text-xs leading-relaxed",style:{width:"42%",flexShrink:0},children:[a.jsx("p",{className:"font-bold uppercase tracking-widest text-[10px] text-center mb-2",children:"Proof of Publication"}),a.jsxs("div",{className:"text-center mb-2 space-y-0.5",children:[a.jsx("p",{className:"font-bold uppercase tracking-wide text-[10px]",children:"State of Florida"}),a.jsx("p",{className:"font-bold uppercase tracking-wide text-[10px]",children:"County of Dixie"})]}),a.jsx("div",{className:"text-center font-bold text-[10px] border-t border-b border-black py-1 mb-3",children:"Dixie County Advocate"}),a.jsxs("p",{className:"text-[10px] leading-relaxed mb-2 text-justify",children:["Before me, the undersigned authority, personally appeared"," ",a.jsx("strong",{children:"Joseph Lander"}),", on behalf of"," ",a.jsx("strong",{children:"LSA Media LLC."}),", the owner and publisher of the"," ",a.jsx("strong",{children:"Dixie County Advocate"}),", a weekly newspaper published at Cross City, in Dixie County, Florida; that the attached copy of advertisement, being a ",a.jsx("strong",{children:Ik[t]??t})," for"," ",a.jsx("strong",{children:e||"_______________"}),", was published in said newspaper in the issues of:"]}),a.jsx("div",{className:"border border-black px-2 py-1.5 mb-2 text-[10px] font-semibold text-center min-h-[24px] leading-relaxed",children:n.filter(
1131Boolean).length>0?n.filter(Boolean).map((C,M)=>a.jsx("div",{children:tP(C)},M)):"_______________"}),a.jsx("p",{className:"text-[10px] leading-relaxed mb-3 text-justify",children:"Affiant further says that the said newspaper has heretofore been continuously published in said Dixie County, Florida each week and has been entered as Periodicals (USPS 158-760) at the post office in Cross City, in said Dixie County, Florida, for a period of one year next preceding the first publication of the attached copy of advertisement, and affiant further says that he has neither paid nor promised any person, firm or corporation any discount, rebate, commission or refund for the purpose of securing this advertisement for publication in the said newspaper."}),a.jsx("p",{className:"text-[10px] leading-relaxed mb-3 text-justify",children:"The Dixie County Advocate complies with all legal requirements for publication in chapter 50, Florida Statutes."}),a.jsx("div",{className:"border-b border-black mb-0.5 h-4"}),a.jsx("p",{className:"text-[8px] text-center mb-3",children:"Joseph Lander, Publisher"}),a.jsxs("p",{className:"text-[10px] mb-3",children:["Sworn to and subscribed before me this"," ",a.jsx("strong",{children:i?Lk(i):"_____ day of _______________, 20___"}),"."]}),a.jsxs("div",{children:[a.jsx("div",{className:"border-b border-black h-4 mb-0.5"}),a.jsx("p",{className:"text-[7px] text-center",children:"Notary Public, State of Florida at Large"})]}),a.jsx("p",{className:"text-[7px] text-gray-500 text-center border-t border-gray-300 pt-1 mt-1.5",children:"Dixie County Advocate · P.O. Box 1538, Cross City, FL 32628 · (352) 498-3312"})]}),a.jsx("div",{className:"flex-1 border-l border-dashed border-gray-300 flex items-center justify-center bg-white"})]})})]})]})]})}function Nq(){var Q,se,ue,Ne;const[r,e]=k.useState([]),[t,n]=k.useState(!0),[s,i]=k.useState(null),[o,l]=k.useState(!1),[c,u]=k.useState(null),[d,h]=k.useState(""),[f,p]=k.useState(null),[m,g]=k.useState(!1),[v,b]=k.useState([]),[y,w]=k.useState(null),[_,N]=k.useState(""),S=k.useRef([]),[E,T]=k.useState([""]),[D,R]=k.useState(""),[H,A]=k.useState(null),U=k.useRef(null),[C,M]=k.useState(!1),[L,B]=k.useState(null),I=k.useRef(null),[z,X]=k.useState(!1),[F,q]=k.useState(""),[V,K]=k.useState(["","","",""]),[ee,Z]=k.useState(""),[ie,pe]=k.useState(!1),me=()=>{n(!0),KU().then(ce=>{e(ce),n(!1)})};k.useEffect(()=>{me()},[]),k.useEffect(()=>{if(!I.current)return;const ce=I.current;(s==null?void 0:s.content_type)==="text"&&s.content?(ce.textContent=s.content,B(ce.scrollHeight/96)):B(null)},[s==null?void 0:s.content,s==null?void 0:s.content_type]);const Oe=()=>{i({...yq}),p(null),g(!1),b([]),w(null),N(""),h(""),u(null),T([""]),R(""),A(null)},De=async ce=>{i(ce),p(ce.image_url??null),g((ce.image_url??"").toLowerCase().endsWith(".pdf")),b((ce.additional_images??[]).map(be=>({url:be,isPdf:be.toLowerCase().endsWith(".pdf")}))),w(null),N(""),h(""),u(null),T([""]),R(""),A(null);const le=await _H(ce.id);le&&(A(le),T(le.pub_dates.length?le.pub_dates:[""]),R(le.affidavit_date??""))},re=async ce=>{h(""),u(0);const le=ce.type==="application/pdf";g(le),p(le?ce.name:URL.createObjectURL(ce));try{const be=await hA(ce,u);i(de=>de&&{...de,image_url:be})}catch(be){h(be instanceof Error?be.message:"Upload failed."),p((s==null?void 0:s.image_url)??null),g(((s==null?void 0:s.image_url)??"").toLowerCase().endsWith(".pdf"))}finally{u(null),U.current&&(U.current.value="")}},fe=async ce=>{var be;const le=(be=ce.target.files)==null?void 0:be[0];le&&await re(le)},j=async ce=>{var be;ce.preventDefault(),M(!1);const le=(be=ce.dataTransfer.files)==null?void 0:be[0];le&&await re(le)},oe=async(ce,le)=>{N(""),w(0);const be=ce.type==="application/pdf";b(de=>{const Se=[...de];for(;Se.length<=le;)Se.push({url:"",isPdf:!1});return Se[le]={url:be?ce.name:URL.createObjectURL(ce),isPdf:be},Se});try{const de=await hA(ce,w);i(Se=>{if(!Se)return Se;const ke=[...Se.additional_images??[]];for(;ke.length<=le;)ke.push("");return ke[le]=de,{...Se,additional_images:ke.filter(Boolean)}})}catch(de){N(de instanceof Error?de.message:"Upload failed."),b(Se=>{const ke=[...Se];return ke[le]&&(ke[le]={url:"",isPdf:!1}),ke.filter(Le=>Le.url)})}finally{w(null),S.current[le]&&(S.current[le].value="")}},ne=async(ce,le)=>{var de;const be=(de=ce.target.files)==null?void 0:de[0];be&&await oe(be,le)},G=async(ce,le)=>{var de;ce.preventDefault(),M(!1);const be=(de=ce.dataTransfer.files)==null?void 0:de[0];be&&await oe(be,le)},W=ce=>{b(le=>le.filter((be,de)=>de!==ce)),i(le=>{if(!le)return le;const be=[...le.additional_images??[]];return be.splice(ce,1),{...le,additional_images:be.length?be:null}})},te=async()=>{var de,Se;if(!s)return;if(!((de=s.title)!=null&&de.trim())){alert("Please enter a title.");return}if(s.content_type==="text"&&!((Se=s.content)!=null&&Se.trim())){alert("Please enter the notice text.");return}if(s.content_type==="image"&&!s.image_url){alert("Please upload an image.");return}l(!0);const ce={...s};ce.content_type==="image"&&(ce.content=""),ce.content_type==="text"&&(ce.image_url=null,ce.additional_images=null);const{error:le,id:be}=await dA(ce);if(!le&&be&&E.some(Boolean)){const ke=be;await PR({...H?{id:H.id}:{},notice_id:ke,notice_title:s.title??"",notice_type:s.notice_type??"general",pub_dates:E.filter(
1131Boolean),affidavit_date:D||null})}l(!1),le?alert("Error: "+le):(me(),i(null))},he=async(ce,le)=>{confirm(`Delete "${le}"?`)&&(await JU(ce),me())},ge=()=>{var de,Se;const ce=rP(F,V,ee,ie),le=document.createElement("iframe");le.style.cssText="position:fixed;left:-9999px;top:0;width:816px;height:1056px;border:0;",document.body.appendChild(le);const be=le.contentDocument??((de=le.contentWindow)==null?void 0:de.document);if(!be){document.body.removeChild(le);return}be.open(),be.write(ce),be.close(),(Se=le.contentWindow)==null||Se.focus(),setTimeout(()=>{var Dt;const Le=be.body.scrollHeight;if(Le>912){const Ut=Math.max(.55,912/Le);be.body.style.zoom=String(Ut)}(Dt=le.contentWindow)==null||Dt.print(),setTimeout(()=>document.body.removeChild(le),1e3)},400)},ae=async ce=>{await dA({id:ce.id,published:!ce.published}),me()},J=()=>{var de,Se,ke;if(!((de=s==null?void 0:s.content)!=null&&de.trim()))return;const ce=vq(s.title??"",s.notice_type??"general",s.content,L),le=document.createElement("iframe");le.style.cssText="position:fixed;left:-9999px;top:0;width:816px;height:1056px;border:0;",document.body.appendChild(le);const be=le.contentDocument??((Se=le.contentWindow)==null?void 0:Se.document);if(!be){document.body.removeChild(le);return}be.open(),be.write(ce),be.close(),(ke=le.contentWindow)==null||ke.focus(),setTimeout(()=>{var Le;(Le=le.contentWindow)==null||Le.print(),setTimeout(()=>document.body.removeChild(le),1e3)},400)};if(s!==null){const ce=s.content_type==="image";return a.jsxs("div",{className:"max-w-2xl",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsx("h2",{className:"font-bold text-navy-900 text-xl",children:s.id?"Edit Notice":"Post New Notice"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:()=>i(null),className:"flex items-center gap-1.5 px-4 py-2 border border-gray-200 rounded-lg text-sm text-gray-600 hover:bg-gray-50",children:[a.jsx(tt,{className:"w-4 h-4"})," Cancel"]}),a.jsxs("button",{onClick:te,disabled:o||c!==null,className:"flex items-center gap-1.5 px-4 py-2 bg-red-600 text-white rounded-lg text-sm font-semibold hover:bg-red-700 disabled:opacity-50",children:[o?a.jsx(_e,{className:"w-4 h-4 animate-spin"}):a.jsx(vn,{className:"w-4 h-4"}),o?"Saving…":"Save Notice"]})]})]}),a.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-6 space-y-5 shadow-sm",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Notice Title *"}),a.jsx("input",{type:"text",value:s.title??"",onChange:le=>i({...s,title:le.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-2.5 text-sm focus:outline-none focus:border-navy-400",placeholder:"e.g. Notice of Public Hearing — Zoning Amendment"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Notice Type"}),a.jsxs("select",{value:s.notice_type??"general",onChange:le=>i({...s,notice_type:le.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-2.5 text-sm focus:outline-none focus:border-navy-400 bg-white",children:[a.jsx("option",{value:"general",children:"Public Notice"}),a.jsx("option",{value:"hearing",children:"Public Hearing"}),a.jsx("option",{value:"bid",children:"Invitation to Bid"}),a.jsx("option",{value:"legal",children:"Legal Notice"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Content Format *"}),a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("button",{type:"button",onClick:()=>i({...s,content_type:"text"}),className:`flex items-center gap-2 px-4 py-2.5 rounded-lg border text-sm font-medium transition-colors ${ce?"bg-white text-gray-600 border-gray-300 hover:border-navy-400":"bg-navy-900 text-white border-navy-900"}`,children:[a.jsx(Bt,{className:"w-4 h-4"})," Text Notice"]}),a.jsxs("button",{type:"button",onClick:()=>i({...s,content_type:"image"}),className:`flex items-center gap-2 px-4 py-2.5 rounded-lg border text-sm font-medium transition-colors ${ce?"bg-navy-900 text-white border-navy-900":"bg-white text-gray-600 border-gray-300 hover:border-navy-400"}`,children:[a.jsx(Vu,{className:"w-4 h-4"})," Image Upload"]})]})]}),!ce&&a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Notice Text *"}),a.jsx("textarea",{rows:10,value:s.content??"",onChange:le=>i({...s,content:le.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-2.5 text-sm focus:outline-none focus:border-navy-400 resize-y font-mono",placeholder:"Enter the full text of the public notice…"}),L!==null&&a.jsxs("div",{className:"mt-2 bg-gray-50 border border-gray-200 rounded-lg px-4 py-2.5 flex items-center justify-between",children:[a.jsx("span",{className:"text-xs text-gray-500",children:"Estimated Column Inches"}),a.jsxs("span",{className:"text-sm font-bold text-navy-900",children:[L.toFixed(2)," col. in."]})]})]}),ce&&a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:["Notice Image or PDF * ",a.jsx("span",{className:"text-gray-400 font-normal",children:"(add as many as needed)"})]}),a.jsx("p",{className:"text-xs text-gray-500 mb-1.5 font-medium",children:"Image 1 (primary)"}),a.jsx("input",{ref:U,type:"file",accept:"image/jpeg,image/png,image/webp,application/pdf",onChange:fe,className:"hidden"}),f?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"relative rounded-lg overflow-hidden border border-gray-200 bg-gray-50",children:[m?a.jsxs("div",{className:"flex items-center gap-3 px-4 py-5",children:[a.jsx(Ow,{className:"w-8 h-8 text-red-500 flex-shrink-0"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-semibold text-gray-800 break-all",children:f}),a.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"PDF document"})]})]}):a.jsx("img",{src:f,alt:"Notice preview",className:"w-full max-h-96 object-contain"}),c!==null&&a.jsx("div",{className:"absolute inset-0 bg-black/40 flex items-center justify-center",children:a.jsxs("div",{className:"bg-white rounded-full px-4 py-2 text-sm font-semibold text-navy-900",children:["Uploading ",c,"%"]})})]}),c===null&&a.jsxs("div",{onDrop:j,onDragOver:le=>{le.preventDefault(),M(!0)},onDragLeave:()=>M(!1),onClick:()=>{var le;return(le=U.current)==null?void 0:le.click()},className:`flex items-center gap-2 text-sm text-navy-600 hover:text-navy-900 font-medium cursor-pointer rounded-lg px-2 py-1 transition-colors ${C?"bg-navy-50 border border-navy-300":""}`,children:[a.jsx(Fn,{className:"w-4 h-4"})," ",C?"Drop file to replace":"Replace file (drag & drop or click)"]})]}):a.jsxs("div",{onDrop:j,onDragOver:le=>{le.preventDefault(),M(!0)},onDragLeave:()=>M(!1),onClick:()=>{var le;return(le=U.current)==null?void 0:le.click()},className:`w-full flex flex-col items-center justify-center gap-3 border-2 border-dashed rounded-xl py-12 cursor-pointer transition-colors ${C?"border-navy-500 bg-navy-50":"border-gray-300 hover:border-navy-400 hover:bg-gray-50"}`,children:[a.jsx(Fn,{className:"w-8 h-8 text-gray-400"}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-sm font-semibold text-gray-700",children:C?"Drop file here":"Drag & drop or click to upload"}),a.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"JPG, PNG, WebP, or PDF · Max 10 MB"})]})]}),d&&a.jsxs("div",{className:"flex items-center gap-2 mt-2 text-red-600 text-sm",children:[a.jsx(Ve,{className:"w-4 h-4 flex-shrink-0"}),d]}),f&&a.jsxs("div",{className:"mt-4 space-y-3",children:[v.map((le,be)=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[a.jsxs("p",{className:"text-xs text-gray-500 font-medium",children:["Image ",be+2]}),a.jsxs("button",{type:"button",onClick:()=>W(be),className:"text-xs text-red-500 hover:text-red-700 flex items-center gap-1",children:[a.jsx(tt,{className:"w-3 h-3"})," Remove"]})]}),a.jsx("input",{ref:de=>{de&&(S.current[be]=de)},type:"file",accept:"image/jpeg,image/png,image/webp,application/pdf",onChange:de=>ne(de,be),className:"hidden"}),a.jsxs("div",{className:"relative rounded-lg overflow-hidden border border-gray-200 bg-gray-50",children:[le.isPdf?a.jsxs("div",{className:"flex items-center gap-3 px-4 py-5",children:[a.jsx(Ow,{className:"w-8 h-8 text-red-500 flex-shrink-0"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-semibold text-gray-800 break-all",children:le.url}),a.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"PDF document"})]})]}):a.jsx("img",{src:le.url,alt:`Notice image ${be+2}`,className:"w-full max-h-96 object-contain"}),y!==null&&a.jsx("div",{className:"absolute inset-0 bg-black/40 flex items-center justify-center",children:a.jsxs("div",{className:"bg-white rounded-full px-4 py-2 text-sm font-semibold text-navy-900",children:["Uploading ",y,"%"]})})]}),y===null&&a.jsxs("div",{onDrop:de=>G(de,be),onDragOver:de=>{de.preventDefault(),M(!0)},onDragLeave:()=>M(!1),onClick:()=>{var de;return(de=S.current[be])==null?void 0:de.click()},className:`flex items-center gap-2 text-sm text-navy-600 hover:text-navy-900 font-medium cursor-pointer rounded-lg px-2 py-1 transition-colors mt-2 ${C?"bg-navy-50 border border-navy-300":""}`,children:[a.jsx(Fn,{className:"w-4 h-4"})," ",C?"Drop file to replace":"Replace (drag & drop or click)"]})]},be)),a.jsxs("div",{children:[a.jsxs("p",{className:"text-xs text-gray-500 mb-1.5 font-medium",children:["Image ",v.length+2]}),a.jsx("input",{ref:le=>{le&&(S.current[v.length]=le)},type:"file",accept:"image/jpeg,image/png,image/webp,application/pdf",onChange:le=>ne(le,v.length),className:"hidden"}),a.jsxs("div",{onDrop:le=>G(le,v.length),onDragOver:le=>{le.preventDefault(),M(!0)},onDragLeave:()=>M(!1),onClick:()=>{var le;return(le=S.current[v.length])==null?void 0:le.click()},className:`w-full flex flex-col items-center justify-center gap-2 border-2 border-dashed rounded-xl py-8 cursor-pointer transition-colors ${C?"border-navy-500 bg-navy-50":"border-gray-300 hover:border-navy-400 hover:bg-gray-50"}`,children:[a.jsx(Fn,{className:"w-6 h-6 text-gray-400"}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-sm font-semibold text-gray-700",children:C?"Drop file here":"Drag & drop or click to add image"}),a.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"JPG, PNG, WebP, or PDF"})]})]})]})]}),_&&a.jsxs("div",{className:"flex items-center gap-2 mt-2 text-red-600 text-sm",children:[a.jsx(Ve,{className:"w-4 h-4 flex-shrink-0"}),_]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Expiry Date (optional)"}),a.jsx("input",{type:"date",value:s.expiry_date??"",onChange:le=>i({...s,expiry_date:le.target.value||null}),className:"border border-gray-300 rounded-lg px-3 py-2.5 text-sm focus:outline-none focus:border-navy-400"})]}),a.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[a.jsx("div",{onClick:()=>i({...s,published:!s.published}),className:`w-11 h-6 rounded-full transition-colors flex items-center ${s.published?"bg-green-500":"bg-gray-300"}`,children:a.jsx("div",{className:`w-5 h-5 bg-white rounded-full shadow transition-transform mx-0.5 ${s.published?"translate-x-5":"translate-x-0"}`})}),a.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Publish on website"})]})]}),!ce&&a.jsxs("div",{className:"mt-6 bg-white border border-gray-200 rounded-xl shadow-sm overflow-hidden",children:[a.jsxs("div",{className:"px-6 py-4 border-b border-gray-100 flex items-center gap-2",children:[a.jsx(hU,{className:"w-5 h-5 text-navy-600"}),a.jsx("span",{className:"font-semibold text-navy-900 text-sm",children:"Client Proof"})]}),a.jsxs("div",{className:"p-6 space-y-3",children:[a.jsx("p",{className:"text-sm text-gray-500",children:'Generate a print-ready proof of this notice as it will appear in the newsp
1131aper — set in Helvetica 6pt type in a 1.6434" column (Florida standard).'}),L!==null&&a.jsxs("div",{className:"flex items-center gap-2 text-sm bg-navy-50 border border-navy-100 rounded-lg px-3 py-2",children:[a.jsx("span",{className:"text-gray-600",children:"Estimated size:"}),a.jsxs("span",{className:"font-bold text-navy-900",children:[L.toFixed(2)," column inches"]}),a.jsxs("span",{className:"text-gray-400 text-xs",children:["(",L.toFixed(2),'" tall × 1.6434" wide)']})]}),a.jsxs("div",{className:"flex items-center gap-3 pt-1",children:[a.jsxs("button",{type:"button",onClick:J,disabled:!((Q=s.content)!=null&&Q.trim()),className:"flex items-center gap-1.5 px-4 py-2 border border-gray-300 text-gray-700 rounded-lg text-sm font-semibold hover:bg-gray-50 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",title:(se=s.content)!=null&&se.trim()?"":"Enter notice text to generate proof",children:[a.jsx(Vd,{className:"w-4 h-4"})," Print Proof"]}),a.jsxs("button",{type:"button",onClick:J,disabled:!((ue=s.content)!=null&&ue.trim()),className:"flex items-center gap-1.5 px-4 py-2 border border-gray-300 text-gray-700 rounded-lg text-sm font-semibold hover:bg-gray-50 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",title:(Ne=s.content)!=null&&Ne.trim()?"":"Enter notice text to generate proof",children:[a.jsx(Du,{className:"w-4 h-4"})," Download PDF"]})]}),a.jsx("p",{className:"text-xs text-gray-400 italic",children:'Both options open a print dialog — select "Save as PDF" to download, or choose your printer to print.'})]})]}),!s.id&&a.jsx("p",{className:"mt-4 text-xs text-gray-400 italic",children:"Save the notice first to link the affidavit to it."}),a.jsx(_q,{noticeId:s.id,noticeTitle:s.title??"",noticeType:s.notice_type??"general",pubDates:E,setPubDates:T,affidavitDate:D,setAffidavitDate:R,savedAffidavit:H,setSavedAffidavit:A,columnInches:L}),a.jsx("div",{ref:I,style:{position:"fixed",left:"-9999px",top:0,width:"1.6434in",fontSize:"6pt",lineHeight:"1.15",fontFamily:"Helvetica, Arial, sans-serif",textAlign:"justify",whiteSpace:"pre-wrap",wordWrap:"break-word",overflowWrap:"break-word",pointerEvents:"none"}})]})}return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsx("h2",{className:"font-bold text-navy-900 text-xl",children:"Public Notices"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:()=>X(!0),className:"flex items-center gap-1.5 px-4 py-2.5 border border-gray-300 text-gray-700 rounded-lg text-sm font-semibold hover:bg-gray-50 transition-colors",title:"Print a blank affidavit form with optional pre-filled fields",children:[a.jsx(Vd,{className:"w-4 h-4"})," Print Blank Affidavit"]}),a.jsxs("button",{onClick:Oe,className:"flex items-center gap-1.5 bg-red-600 text-white px-4 py-2.5 rounded-lg text-sm font-semibold hover:bg-red-700 transition-colors",children:[a.jsx(No,{className:"w-4 h-4"})," Post New Notice"]})]})]}),t?a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx(_e,{className:"w-8 h-8 animate-spin text-navy-400"})}):a.jsx("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm overflow-hidden",children:r.length===0?a.jsx("p",{className:"text-center py-12 text-gray-400",children:"No public notices yet."}):a.jsx("div",{className:"divide-y divide-gray-100",children:r.map(ce=>a.jsxs("div",{className:"flex items-start gap-3 px-5 py-4 hover:bg-gray-50 transition-colors",children:[ce.content_type==="image"&&ce.image_url?ce.image_url.toLowerCase().endsWith(".pdf")?a.jsx("div",{className:"w-12 h-12 rounded flex-shrink-0 bg-red-50 border border-red-200 flex items-center justify-center",children:a.jsx(Ow,{className:"w-5 h-5 text-red-500"})}):a.jsx("img",{src:ce.image_url,alt:ce.title,className:"w-12 h-12 rounded object-cover flex-shrink-0 border border-gray-200"}):a.jsx("div",{className:"w-12 h-12 rounded flex-shrink-0 bg-gray-100 flex items-center justify-center",children:a.jsx(Bt,{className:"w-5 h-5 text-gray-400"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-medium text-navy-900 text-sm",children:ce.title}),a.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[a.jsx("span",{className:"text-xs text-gray-400",children:xi(ce.created_at)}),a.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded font-semibold ${ce.content_type==="image"?"bg-blue-50 text-blue-700":"bg-gray-100 text-gray-600"}`,children:ce.content_type==="image"?"Image":"Text"})]}),ce.content_type==="text"&&ce.content&&a.jsx("p",{className:"text-xs text-gray-500 mt-1 line-clamp-2",children:ce.content})]}),a.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[a.jsx("button",{onClick:()=>ae(ce),title:ce.published?"Unpublish":"Publish",className:`p-1.5 rounded-lg transition-colors ${ce.published?"text-green-600 hover:bg-green-50":"text-gray-400 hover:bg-gray-100"}`,children:ce.published?a.jsx(zg,{className:"w-4 h-4"}):a.jsx(Hg,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>De(ce),className:"p-1.5 text-navy-600 hover:bg-navy-50 rounded-lg transition-colors",children:a.jsx(Sf,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>he(ce.id,ce.title),className:"p-1.5 text-red-500 hover:bg-red-50 rounded-lg transition-colors",children:a.jsx(Sn,{className:"w-4 h-4"})})]})]},ce.id))})}),z&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:()=>X(!1),children:a.jsxs("div",{className:"bg-white rounded-xl shadow-2xl w-full max-w-lg max-h-[90vh] overflow-y-auto",onClick:ce=>ce.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200",children:[a.jsx("h3",{className:"font-bold text-navy-900 text-lg",children:"Print Blank Affidavit"}),a.jsx("button",{onClick:()=>X(!1),className:"text-gray-400 hover:text-gray-600",children:a.jsx(tt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"px-6 py-5 space-y-5",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-semibold text-gray-700 mb-1.5",children:"Notice / Advert
1131isement Title"}),a.jsx("input",{type:"text",value:F,onChange:ce=>q(ce.target.value),placeholder:"e.g. Notice of Public Meeting",className:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-navy-400"}),a.jsx("p",{className:"text-xs text-gray-400 mt-1",children:'Prints on the single line after "being a"'})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-semibold text-gray-700 mb-1.5",children:"Publication Dates (up to 4)"}),a.jsx("div",{className:"space-y-2",children:V.map((ce,le)=>a.jsx("input",{type:"text",value:ce,onChange:be=>{const de=[...V];de[le]=be.target.value,K(de)},placeholder:`Date ${le+1}${le===0?" (required to show any dates)":" (optional)"}`,className:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-navy-400"},le))}),a.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Prints inside the bordered box. Leave blank for empty lines."})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-semibold text-gray-700 mb-1.5",children:"Sworn Date"}),a.jsx("input",{type:"date",value:ee,onChange:ce=>Z(ce.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-brand-red"}),a.jsx("p",{className:"text-xs text-gray-400 mt-1",children:'Fills in the sworn date after "this" at the bottom. Leave blank to print nothing there.'})]}),a.jsxs("label",{className:"flex items-start gap-2.5 cursor-pointer p-3 bg-amber-50 border border-amber-200 rounded-lg",children:[a.jsx("input",{type:"checkbox",checked:ie,onChange:ce=>pe(ce.target.checked),className:"mt-0.5 w-4 h-4 accent-amber-600 cursor-pointer"}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm font-semibold text-amber-900",children:"Overlay mode (pre-printed forms)"}),a.jsx("p",{className:"text-xs text-amber-700 mt-0.5",children:"Hides all static text and borders so only your entered values print in black. Use this when feeding already-printed affidavit forms through the printer."})]})]})]}),a.jsxs("div",{className:"flex justify-end gap-2 px-6 py-4 border-t border-gray-200 bg-gray-50",children:[a.jsx("button",{onClick:()=>X(!1),className:"px-4 py-2 border border-gray-300 text-gray-600 rounded-lg text-sm font-semibold hover:bg-gray-100 transition-colors",children:"Cancel"}),a.jsxs("button",{onClick:()=>{X(!1),ge(),q(""),K(["","","",""]),Z(""),pe(!1)},className:"flex items-center gap-1.5 bg-brand-red text-white px-4 py-2 rounded-lg text-sm font-semibold hover:bg-brand-red-dark transition-colors",children:[a.jsx(Vd,{className:"w-4 h-4"})," Print"]})]})]})})]})}const Sq=[{id:"contact",label:"Site-Wide Contact & Address",description:"Phone, address, and email used throughout the site — footer, contact page, and more.",fields:[{key:"address_line1",label:"Address Line 1",type:"text",placeholder:"174 NE 351 Hwy"},{key:"address_line2",label:"Address Line 2",type:"text",placeholder:"Cross City, FL 32628"},{key:"phone",label:"Phone Number",type:"tel",placeholder:"(352) 498-3312"},{key:"email_news",label:"News Email",type:"email",placeholder:"[email protected]"},{key:"email_ads",label:"Advertising Email",type:"email",placeholder:"[email protected]"},{key:"hours",label:"Office Hours",type:"text",placeholder:"Mon – Fri: 8am – 5pm"},{key:"hours_note",label:"Hours Note",type:"text",placeholder:"Closed weekends & holidays"},{key:"advertise_blurb",label:"Advertise With Us Blurb",type:"textarea",rows:2}]},{id:"subscribe",label:"Subscribe Page",description:"Edit every card on the subscription page — titles, prices, feature bullets, links, and info panels.",fields:[{key:"hero_headline",label:"Hero Headline",type:"text",placeholder:"Support Local Journalism"},{key:"hero_subhead",label:"Hero Sub-headline",type:"text",placeholder:"Every week without fail since July 1, 1921"},{key:"digital_title",label:"Digital Card — Title",type:"text",placeholder:"Digital Only"},{key:"digital_subtitle",label:"Digital Card — Subtitle",type:"text",placeholder:"Full online access, anytime"},{key:"digital_price",label:"Digital Card — Monthly Price",type:"text",placeholder:"$5.99"},{key:"digital_price_annual",label:"Digital Card — Annual Price",type:"text",placeholder:"$59"},{key:"digital_features",label:"Digital Card — Feature Bullets (one per line)",type:"textarea",rows:5,placeholder:`Unlimited online access
1132Full article archive
1133Breaking news alerts
1134PDF edition each week
1135Community calendar`},{key:"print_title",label:"Print Card — Title",type:"text",placeholder:"Print Only"},{key:"print_subtitle",label:"Print Card — Subtitle",type:"text",placeholder:"Weekly paper — annual subscription"},{key:"print_local_price",label:"Print Card — Local (Dixie County) Annual Price",type:"text",placeholder:"$30"},{key:"print_outofarea_price",label:"Print Card — Out of Area Annual Price",type:"text",placeholder:"$35"},{key:"print_features",label:"Print Card — Feature Bullets (one per line)",type:"textarea",rows:5,placeholder:`Weekly print edition
1136Delivered every Thursday
1137Full local coverage
1138Legal notices & public records
1139Sports & community pages`},{key:"bundle_title",label:"Bundle Card — Title",type:"text",placeholder:"Print + Digital"},{key:"bundle_subtitle",label:"Bundle Card — Subtitle",type:"text",placeholder:"The complete Dixie County Advocate"},{key:"bundle_price",label:"Bundle Card — Monthly Price",type:"text",placeholder:"$13.99"},{key:"bundle_price_annual",label:"Bundle Card — Annual Price",type:"text",placeholder:"$76"},{key:"bundle_savings_badge",label:"Bundle Card — Annual Savings Badge",type:"text",placeholder:"Save $20"},{key:"bundle_features",label:"Bundle Card — Feature Bullets (one per line)",type:"textarea",rows:6,placeholder:`Print edition delivered weekly
1140Unlimited digital access
1141PDF edition each week
1142Breaking news alerts
1143Full archive access
1144Subscriber-only content`},{key:"link_digital_monthly",label:"Payment Link — Digital Only (Monthly)",type:"text",placeholder:"https://pay.wave.com/..."},{key:"link_digital_annual",label:"Payment Link — Digital Only (Annual)",type:"text",placeholder:"https://pay.wave.com/..."},{key:"link_print_local",label:"Payment Link — Print Only (Local / Dixie County)",type:"text",placeholder:"https://pay.wave.com/..."},{key:"link_print_outofarea",label:"Payment Link — Print Only (Out of Area)",type:"text",placeholder:"https://pay.wave.com/..."}
1144,{key:"link_bundle_monthly",label:"Payment Link — Bundle (Monthly)",type:"text",placeholder:"https://pay.wave.com/..."},{key:"link_bundle_annual",label:"Payment Link — Bundle (Annual)",type:"text",placeholder:"https://pay.wave.com/..."},{key:"why_p1",label:'"Why Subscribe?" — Paragraph 1',type:"textarea",rows:3,placeholder:"The Dixie County Advocate is the only locally owned newspaper serving Dixie County. No parent company, no outside investors — just neighbors writing about neighbors."},{key:"why_p2",label:'"Why Subscribe?" — Paragraph 2',type:"textarea",rows:3,placeholder:"Your subscription funds the reporters, photographers, and editors who cover your county commission, your schools, and your community events."},{key:"why_phone",label:'"Why Subscribe?" — Phone',type:"tel",placeholder:"(352) 498-3312"},{key:"why_email",label:'"Why Subscribe?" — Email',type:"email",placeholder:"[email protected]"},{key:"gift_body",label:'"Gift Subscriptions" — Body Text',type:"textarea",rows:3,placeholder:"Give the gift of local news. Gift subscriptions are available in 3-, 6-, and 12-month terms. Call us to arrange a gift subscription for a friend or family member."},{key:"gift_phone",label:'"Gift Subscriptions" — Phone',type:"tel",placeholder:"(352) 498-3312"}]},{id:"obituaries",label:"Obituaries Page",description:"Edit the submission intro text, pricing note, and contact information for obituary submissions.",fields:[{key:"intro_heading",label:"Submission Heading",type:"text",placeholder:"Submit an Obituary"},{key:"intro_text",label:"Submission Intro Text",type:"textarea",rows:3,placeholder:"To submit an obituary, please provide..."},{key:"pricing_note",label:"Pricing & Contact Note",type:"textarea",rows:2,placeholder:"Contact us at (352) 498-3312 or [email protected] for pricing and photo submission."}]},{id:"public-notices",label:"Public Notices Page",description:"Edit the sidebar text and contact information on the Public Notices page.",fields:[{key:"about_text_1",label:"About — Paragraph 1",type:"textarea",rows:3},{key:"about_text_2",label:"About — Paragraph 2",type:"textarea",rows:2},{key:"placement_phone",label:"To Place a Notice — Phone",type:"tel",placeholder:"(352) 498-3312"},{key:"placement_email",label:"To Place a Notice — Email",type:"email",placeholder:"[email protected]"}]},{id:"home",label:"Home Page",description:"Edit the homepage tagline, section descriptions, and intro text.",fields:[{key:"tagline",label:"Site Tagline",type:"text",placeholder:"Dixie County's Source for Local News"},{key:"hero_intro",label:"Hero Section Intro",type:"textarea",rows:2},{key:"sports_section_intro",label:"Sports Section Intro",type:"text",placeholder:"Local sports coverage from Dixie County schools and leagues."},{key:"community_section_intro",label:"Community Section Intro",type:"text",placeholder:"Events, organizations, and people making a difference."}]},{id:"gilchrist",label:"Gilchrist News Page",description:"Edit the intro text and description for the Gilchrist County news section.",fields:[{key:"section_intro",label:"Section Intro Text",type:"textarea",rows:2,placeholder:"Local news and updates from Gilchrist County, Florida."},{key:"sidebar_blurb",label:"Sidebar Blurb",type:"textarea",rows:3}]},{id:"advertise",label:"Advertise With Us",description:"Edit pricing, packages, contact info, and the intro text on the Advertise page.",fields:[{key:"hero_headline",label:"Page Headline",type:"text"},{key:"hero_subhead",label:"Page Sub-headline",type:"text"},{key:"intro",label:"Introduction Paragraph",type:"textarea",rows:4},{key:"contact_name",label:"Ad Contact Name",type:"text"},{key:"contact_title",label:"Ad Contact Title",type:"text"},{key:"contact_email",label:"Ad Contact Email",type:"email"},{key:"contact_phone",label:"Ad Contact Phone",type:"tel"},{key:"deadline_note",label:"Submission Deadline Note",type:"textarea",rows:2},{key:"pkg_print_name",label:"Package 1 — Name",type:"text",placeholder:"Print Display Ad"},{key:"pkg_print_desc",label:"Package 1 — Description",type:"textarea",rows:2},{key:"pkg_print_sizes",label:"Package 1 — Available Sizes",type:"text"},{key:"pkg_print_price",label:"Package 1 — Price",type:"text",placeholder:"Starting at $85/week"},{key:"pkg_digital_name",label:"Package 2 — Name",type:"text",placeholder:"Digital Banner Ad"},{key:"pkg_digital_desc",label:"Package 2 — Description",type:"textarea",rows:2},{key:"pkg_digital_sizes",label:"Package 2 — Available Sizes",type:"text"},{key:"pkg_digital_price",label:"Package 2 — Price",type:"text",placeholder:"Starting at $50/week"},{key:"pkg_combo_name",label:"Package 3 — Name",type:"text",placeholder:"Print + Digital Bundle"},{key:"pkg_combo_desc",label:"Package 3 — Description",type:"textarea",rows:2},{key:"pkg_combo_sizes",label:"Package 3 — Available Sizes",type:"text"},{key:"pkg_combo_price",label:"Package 3 — Price",type:"text",placeholder:"Starting at $120/week"},{key:"pkg_classified_name",label:"Package 4 — Name",type:"text",placeholder:"Classified Ad"},{key:"pkg_classified_desc",label:"Package 4 — Description",type:"textarea",rows:2},{key:"pkg_classified_sizes",label:"Package 4 — Available Sizes",type:"text"},{key:"pkg_classified_price",label:"Package 4 — Price",type:"text",placeholder:"$15 per insertion"}]},{id:"news",label:"News Page",description:"Edit the page heading and intro text on the main News & Stories page.",fields:[{key:"page_heading",label:"Page Heading",type:"text",placeholder:"News & Stories"},{key:"page_subtitle",label:"Page Subtitle (when not searching)",type:"text",placeholder:"All local stories in one place"}]},{id:"sports",label:"Sports Page",description:"Edit the athletics banner, intro text, and section labels on the Sports page.",fields:[{key:"banner_eyebrow",label:"Banner Eyebrow",type:"text",placeholder:"Dixie County High School"},{key:"banner_title",label:"Banner Title",type:"text",placeholder:"Hurricanes Athletics"},{key:"banner_subtitle",label:"Banner Subtitle",type:"text",placeholder:"Local sports coverage for all Dixie County team
1144s"},{key:"news_section_title",label:"Sports News Section Title",type:"text",placeholder:"Sports News"},{key:"games_section_title",label:"Upcoming Games Section Title",type:"text",placeholder:"Upcoming Games"}]},{id:"perspectives",label:"Perspectives Page",description:"Edit the page heading and intro text on the Perspectives page.",fields:[{key:"page_heading",label:"Page Heading",type:"text",placeholder:"Perspectives"},{key:"empty_heading",label:"Empty State Heading",type:"text",placeholder:"No perspectives published yet"},{key:"empty_text",label:"Empty State Description",type:"textarea",rows:2,placeholder:"Op-eds, commentary, and columns will appear here."}]},{id:"community",label:"Community Page",description:"Edit the page heading, subtitle, and story tip intro text on the Community page.",fields:[{key:"page_heading",label:"Page Heading",type:"text",placeholder:"Community"},{key:"page_subtitle",label:"Page Subtitle",type:"text",placeholder:"News, Events & Announcements"},{key:"tip_intro",label:"Story Tip — Intro Text",type:"textarea",rows:2,placeholder:"Have a story idea? Let us know. We read every submission."},{key:"tip_success_title",label:"Story Tip — Success Title",type:"text",placeholder:"Tip submitted — thank you!"},{key:"tip_success_body",label:"Story Tip — Success Body",type:"textarea",rows:2,placeholder:"Our newsroom will follow up if we pursue your story."}]},{id:"about",label:"About Page",description:"Edit the mission statement, staff roster, photos, and key statistics on the About page. Timeline entries are managed separately under the Timeline tab.",fields:[{key:"mission_p1",label:"Mission — Paragraph 1",type:"textarea",rows:3},{key:"mission_p2",label:"Mission — Paragraph 2",type:"textarea",rows:3},{key:"mission_p3",label:"Mission — Paragraph 3",type:"textarea",rows:3},{key:"mission_p4",label:"Mission — Paragraph 4",type:"textarea",rows:3},{key:"stats_issues",label:"Stat — Consecutive Issues",type:"text",placeholder:"5,500+"},{key:"stats_residents",label:"Stat — County Residents",type:"text",placeholder:"17,000"},{key:"staff_editor",label:"Editor — Name",type:"text"},{key:"staff_editor_photo",label:"Editor — Photo",type:"image"},{key:"staff_publisher",label:"Publisher — Name",type:"text"},{key:"staff_publisher_photo",label:"Publisher — Photo",type:"image"},{key:"staff_reporter",label:"Independent Reporter — Name",type:"text"},{key:"staff_reporter_photo",label:"Independent Reporter — Photo",type:"image"}]}];function kq({fieldKey:r,label:e,value:t,onChange:n}){const s=k.useRef(null),[i,o]=k.useState(!1),[l,c]=k.useState(0),[u,d]=k.useState("");async function h(f){var m;const p=(m=f.target.files)==null?void 0:m[0];if(p){o(!0),c(0),d("");try{const g=await gH(p,c);n(g)}catch(g){d(g instanceof Error?g.message:"Upload failed.")}finally{o(!1),s.current&&(s.current.value="")}}}return a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:e}),a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:`w-40 border-2 border-dashed border-gray-300 rounded-lg overflow-hidden flex items-center justify-center bg-gray-50 relative flex-shrink-0 ${t?"":"h-48"}`,children:t?a.jsxs(a.Fragment,{children:[a.jsx("img",{src:t,alt:"",className:"w-full h-auto block"}),a.jsx("button",{type:"button",onClick:()=>n(""),className:"absolute top-1 right-1 bg-black/60 text-white rounded-full p-0.5 hover:bg-black/80 transition",children:a.jsx(tt,{className:"w-3 h-3"})})]}):i?a.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[a.jsx(_e,{className:"w-5 h-5 animate-spin text-brand-red"}),a.jsxs("span",{className:"text-xs text-gray-400",children:[l,"%"]})]}):a.jsxs("button",{type:"button",onClick:()=>{var f;return(f=s.current)==null?void 0:f.click()},className:"flex flex-col items-center gap-1.5 text-gray-400 hover:text-gray-700 transition",children:[a.jsx(qx,{className:"w-7 h-7"}),a.jsx("span",{className:"text-xs",children:"Upload photo"})]})}),a.jsxs("div",{className:"flex flex-col gap-2 pt-1",children:[!i&&a.jsxs("button",{type:"button",onClick:()=>{var f;return(f=s.current)==null?void 0:f.click()},className:"inline-flex items-center gap-1.5 text-xs font-semibold text-gray-600 hover:text-gray-900 border border-gray-200 rounded-lg px-3 py-2 transition hover:bg-gray-50",children:[a.jsx(Fn,{className:"w-3.5 h-3.5"}),t?"Replace":"Choose file"]}),t&&!i&&a.jsxs("button",{type:"button",onClick:()=>n(""),className:"inline-flex items-center gap-1.5 text-xs font-semibold text-red-500 hover:text-red-700 border border-red-100 rounded-lg px-3 py-2 transition hover:bg-red-50",children:[a.jsx(tt,{className:"w-3.5 h-3.5"})," Remove"]}),u&&a.jsxs("p",{className:"text-xs text-red-600 flex items-start gap-1 max-w-[160px]",children:[a.jsx(Ve,{className:"w-3.5 h-3.5 mt-0.5 shrink-0"})," ",u]}),a.jsx("p",{className:"text-xs text-gray-400 max-w-[160px] leading-relaxed",children:"JPG, PNG, or WebP. Max 10 MB."})]})]}),a.jsx("input",{ref:s,id:r,type:"file",accept:"image/jpeg,image/png,image/webp",className:"hidden",onChange:h})]})}function Cq({def:r}){const[e,t]=k.useState({}),[n,s]=k.useState({}),[i,o]=k.useState(!0),[l,c]=k.useState(!1),[u,d]=k.useState("idle"),[h,f]=k.useState(""),[p,m]=k.useState(!1),g=k.useCallback(async()=>{o(!0);const y=await Xs(r.id),w={};for(const _ of r.fields)w[_.key]=y[_.key]??_.placeholder??"";t(w),s(w),o(!1)},[r.id,r.fields]);k.useEffect(()=>{p&&g()},[p,g]);const v=JSON.stringify(e)!==JSON.stringify(n),b=async()=>{c(!0),d("idle"),f("");const{error:y}=await eH(r.id,e);c(!1),y?(d("error"),f(y)):(d("saved"),s({...e}),setTimeout(()=>d("idle"),3e3))};return a.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl overflow-hidden shadow-sm",children:[a.jsxs("button",{onClick:()=>m(y=>!y),className:"w-full flex items-center justify-between px-5 py-4 hover:bg-gray-50 transition-colors text-left",children:[a.jsxs("div",{children:[a.jsx("p",{className:"font-bold text-gray-900 text-base",children:r.label}),a.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:r.description})]}),a.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0 ml-4",children:[v&&p&&a.jsx("span",{className:"text-xs font-semibold text-amber-600 bg-amber-50 border border-amber-200 px-2 py-0.5 rounded-full",children:"Unsaved changes"}),p?a.jsx(fa,{className:"w-4 h-4 text-gray-400"}):a.jsx(Ws,{className:"w-4 h-4 text-gray-400"})]})]}),p&&a.jsx("div",{className:"border-t border-gray-100 px-5 py-5",children:i?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(_e,{className:"w-5 h-5 animate-spin text-gray-400"})}):a.jsxs(a.Fragment,{children:[u==="saved"&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-700 bg-green-50 border border-green-200 rounded-lg px-4 py-3 mb-4",children:[a.jsx(At,{className:"w-4 h-4 shrink-0"})," Changes saved successfully."]}),u==="error"&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg px-4 py-3 mb-4",children:[a.jsx(Ve,{className:"w-4 h-4 shrink-0"})," ",h]}),a.jsx("div",{className:"space-y-4",children:r.fields.map(y=>y.type==="image"?a.jsx(kq,{fieldKey:y.key,label:y.label,value:e[y.key]??"",onChange:w=>t(_=>
1144({..._,[y.key]:w}))},y.key):a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:y.label}),y.type==="textarea"?a.jsx("textarea",{rows:y.rows??3,value:e[y.key]??"",onChange:w=>t({...e,[y.key]:w.target.value}),placeholder:y.placeholder,className:"w-full border border-gray-300 rounded-lg px-3 py-2.5 text-sm focus:outline-none focus:border-blue-400 resize-y"}):a.jsx("input",{type:y.type,value:e[y.key]??"",onChange:w=>t({...e,[y.key]:w.target.value}),placeholder:y.placeholder,className:"w-full border border-gray-300 rounded-lg px-3 py-2.5 text-sm focus:outline-none focus:border-blue-400"})]},y.key))}),a.jsxs("div",{className:"flex items-center justify-end gap-3 mt-6 pt-4 border-t border-gray-100",children:[v&&a.jsx("button",{onClick:()=>{t({...n}),d("idle")},className:"text-sm text-gray-500 hover:text-gray-700 underline",children:"Discard changes"}),a.jsxs("button",{onClick:b,disabled:l||!v,className:"flex items-center gap-2 bg-gray-900 text-white px-5 py-2 rounded-lg text-sm font-semibold hover:bg-gray-800 disabled:opacity-50 transition-colors",children:[l?a.jsx(_e,{className:"w-4 h-4 animate-spin"}):a.jsx(vn,{className:"w-4 h-4"}),l?"Saving…":"Save Changes"]})]})]})})]})}function Eq(){return a.jsxs("div",{children:[a.jsxs("div",{className:"mb-6",children:[a.jsx("h2",{className:"font-bold text-gray-900 text-xl",children:"Page Content"}),a.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Edit the text content of static pages on the website. Changes go live immediately after saving."})]}),a.jsx("div",{className:"space-y-4",children:Sq.map(r=>a.jsx(Cq,{def:r},r.id))})]})}function nP(r){const e=new Date(r),t=e.getDay();return e.setDate(e.getDate()+(t===0?-6:1-t)),e.setHours(0,0,0,0),e}function sP(r){const e=new Date(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate())),t=e.getUTCDay()||7;e.setUTCDate(e.getUTCDate()+4-t);const n=new Date(Date.UTC(e.getUTCFullYear(),0,1));return Math.ceil(((e.getTime()-n.getTime())/864e5+1)/7)}function z_(r){return r.toLocaleDateString("en-US",{month:"short",day:"numeric"})}function jq(){const e=nP(new Date),t=[];for(let n=-1;n<=8;n++){const s=new Date(e);s.setDate(s.getDate()+n*7);const i=new Date(s);i.setDate(s.getDate()+6);const o=s.toISOString().split("T")[0],l=sP(s),c=n===0,u=n>0;t.push({weekStart:o,isoWeek:l,label:`Week ${l} — ${z_(s)}–${z_(i)}, ${s.getFullYear()}`,isCurrent:c,isFuture:u})}return t}function MA(){return nP(new Date).toISOString().split("T")[0]}function Aq({value:r,onChange:e,weekOptions:t}){const n=t.find(i=>i.weekStart===r)??t[1],s=(n==null?void 0:n.isFuture)??!1;return a.jsx("div",{className:`rounded-xl border-2 p-4 mb-5 ${s?"border-amber-400 bg-amber-50":"border-gray-200 bg-gray-50"}`,children:a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3",children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx(jb,{className:`w-5 h-5 flex-shrink-0 ${s?"text-amber-600":"text-brand-red"}`}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-body font-semibold text-gray-500 uppercase tracking-widest leading-none mb-0.5",children:"Uploading for Issue"}),a.jsx("p",{className:`font-headline font-bold text-base leading-tight ${s?"text-amber-700":"text-gray-900"}`,children:n?`Week ${n.isoWeek}${n.isCurrent?" (Current)":""}`:"Select a week"})]})]}),a.jsx("div",{className:"flex-1 sm:max-w-xs",children:a.jsx("select",{value:r,onChange:i=>e(i.target.value),className:`w-full text-sm font-body border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 transition-colors appearance-none cursor-pointer ${s?"border-amber-300 focus:ring-amber-200 focus:border-amber-400 bg-white text-amber-800":"border-gray-300 focus:ring-brand-red/30 focus:border-brand-red bg-white text-gray-800"}`,children:t.map(i=>a.jsxs("option",{value:i.weekStart,children:[i.label,i.isCurrent?" ← current":i.isFuture?" ← future":" ← past"]},i.weekStart))})}),s&&a.jsxs("div",{className:"flex items-center gap-1.5 bg-amber-100 border border-amber-300 text-amber-800 text-xs font-semibold font-body px-3 py-1.5 rounded-full flex-shrink-0",children:[a.jsx(zr,{className:"w-3.5 h-3.5"}),"Won't appear until ",z_(new Date(r+"T12:00:00"))]})]})})}const FA={url:"",title:"",media_type:"image"};function BA(r){return r.replace(/[^a-zA-Z0-9._-]/g,"_").toLowerCase()}function Tq(r){var e;try{const t=new URL(r.trim());if(t.hostname.includes("youtube.com")||t.hostname==="youtu.be")return"youtube";if(t.hostname.includes("vimeo.com"))return"vimeo";if(t.hostname.includes("facebook.com")||t.hostname.includes("fb.watch"))return"facebook";const n=(e=t.pathname.split(".").pop())==null?void 0:e.toLowerCase();if(n==="mp4"||n==="webm"||n==="ogg"||n==="mov")return"direct"}catch{}return null}function Dq(r){const e=r.trim();if(!e)return"Please enter a video URL.";let t;try{t=new URL(e)}catch{return"Please enter a valid URL (must start with https://)."}return t.protocol!=="https:"&&t.protocol!=="http:"?"Only http and https URLs are supported.":t.hostname.includes("youtube.com")?!t.searchParams.get("v")&&!t.pathname.startsWith("/embed/")&&!t.pathname.startsWith("/shorts/")?"Invalid YouTube URL. Expected format: https://youtube.com/watch?v=VIDEO_ID":null:t.hostname==="youtu.be"?t.pathname.length<=1?"Invalid YouTube short URL. Expected: https://youtu.be/VIDEO_ID":null:t.hostname.includes("vimeo.com")?/\/\d+/.test(t.pathname)?null:"Invalid Vimeo URL. Expected format: https://vimeo.com/VIDEO_ID":t.hostname.includes("facebook.com")?t.searchParams.get("v")||t.pathname.includes("/videos/")||t.pathname.includes("/video/")||t.pathname.includes("/reel/")||t.pathname==="/watch"?null:`Invalid Facebook video URL. Supported formats:
1145• facebook.com/watch?v=ID
1146• facebook.com/PAGE/videos/ID
1147• facebook.com/reel/ID`:(t.hostname.includes("fb.watch"),null)}function iP(r){try{const e=new URL(r.trim());if(e.hostname.includes("youtube.com")&&e.searchParams.get("v"))return`https://www.youtube-nocookie.com/embed/${e.searchParams.get("v")}`;if(e.hostname.includes("youtube.com")&&e.pathname.startsWith("/shorts/"))return`https://www.youtube-nocookie.com/embed${e.pathname.replace("/shorts","")}`;if(e.hostname==="youtu.be")return`https://www.youtube-nocookie.com/embed${e.pathname}`;const t=e.pathname.match(/\/(\d+)/);if(e.hostname.includes("vimeo.com")&&t)return`https://player.vimeo.com/video/${t[1]}`}catch{}return r.trim()}function Rq(r){return r.includes("youtube-nocookie.com/embed")||r.includes("youtube.com/embed")||r.includes("player.vimeo.com")}function aP(r){try{const e=new URL(r);return e.hostname.includes("facebook.com")||e.hostname.includes("fb.watch")}catch{return!1}}function Pq(r){const e=r.match(/\/embed\/([^?&/]+)/);return e?e[1]:null}function Iq({url:r}){const[e,t]=k.useState(!1),n=Pq(r);return n&&!e?a.jsx("img",{src:`https://img.youtube.com/vi/${n}/hqdefault.jpg`,alt:"thumbnail",loading:"lazy",className:"w-full h-full object-cover",onError:()=>t(!0)}
1147):aP(r)?a.jsx("div",{className:"w-full h-full bg-[#1877F2] flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 24 24",className:"w-8 h-8 fill-white/70","aria-hidden":"true",children:a.jsx("path",{d:"M24 12.073C24 5.405 18.627 0 12 0S0 5.405 0 12.073C0 18.1 4.388 23.094 10.125 24v-8.437H7.078v-3.49h3.047V9.41c0-3.025 1.792-4.697 4.533-4.697 1.312 0 2.686.235 2.686.235v2.97h-1.513c-1.491 0-1.956.93-1.956 1.874v2.25h3.328l-.532 3.49h-2.796V24C19.612 23.094 24 18.1 24 12.073z"})})}):a.jsx("div",{className:"w-full h-full bg-gray-700 flex items-center justify-center",children:a.jsx(kf,{className:"w-8 h-8 text-white/50 fill-white/50"})})}function oP({platform:r}){if(!r)return null;const t={youtube:{label:"YouTube",bg:"bg-red-50 border-red-200",text:"text-red-700",icon:a.jsx("svg",{viewBox:"0 0 24 24",className:"w-3.5 h-3.5 fill-current","aria-hidden":"true",children:a.jsx("path",{d:"M23.5 6.2a3 3 0 0 0-2.1-2.1C19.5 3.6 12 3.6 12 3.6s-7.5 0-9.4.5A3 3 0 0 0 .5 6.2 31 31 0 0 0 0 12a31 31 0 0 0 .5 5.8 3 3 0 0 0 2.1 2.1c1.9.5 9.4.5 9.4.5s7.5 0 9.4-.5a3 3 0 0 0 2.1-2.1A31 31 0 0 0 24 12a31 31 0 0 0-.5-5.8zM9.75 15.02V8.98L15.5 12l-5.75 3.02z"})})},vimeo:{label:"Vimeo",bg:"bg-sky-50 border-sky-200",text:"text-sky-700",icon:a.jsx("svg",{viewBox:"0 0 24 24",className:"w-3.5 h-3.5 fill-current","aria-hidden":"true",children:a.jsx("path",{d:"M23.977 6.416c-.105 2.338-1.739 5.543-4.894 9.609-3.268 4.247-6.026 6.37-8.29 6.37-1.409 0-2.578-1.294-3.553-3.881L5.322 11.4C4.603 8.816 3.834 7.522 3.01 7.522c-.179 0-.806.378-1.881 1.132L0 7.197a315.065 315.065 0 0 0 3.501-3.128C5.08 2.74 6.266 1.983 7.055 1.91c1.867-.18 3.016 1.1 3.447 3.838.465 2.953.789 4.789.971 5.507.539 2.45 1.131 3.674 1.776 3.674.502 0 1.256-.796 2.265-2.385 1.004-1.589 1.54-2.797 1.612-3.628.144-1.371-.395-2.061-1.614-2.061-.574 0-1.167.132-1.777.396 1.18-3.86 3.43-5.733 6.75-5.617 2.464.088 3.62 1.67 3.492 4.782z"})})},facebook:{label:"Facebook",bg:"bg-blue-50 border-blue-200",text:"text-blue-700",icon:a.jsx("svg",{viewBox:"0 0 24 24",className:"w-3.5 h-3.5 fill-current","aria-hidden":"true",children:a.jsx("path",{d:"M24 12.073C24 5.405 18.627 0 12 0S0 5.405 0 12.073C0 18.1 4.388 23.094 10.125 24v-8.437H7.078v-3.49h3.047V9.41c0-3.025 1.792-4.697 4.533-4.697 1.312 0 2.686.235 2.686.235v2.97h-1.513c-1.491 0-1.956.93-1.956 1.874v2.25h3.328l-.532 3.49h-2.796V24C19.612 23.094 24 18.1 24 12.073z"})})},direct:{label:"Direct video",bg:"bg-gray-50 border-gray-200",text:"text-gray-600",icon:a.jsx(vi,{className:"w-3.5 h-3.5"})}}[r];return a.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded border text-xs font-semibold font-body ${t.bg} ${t.text}`,children:[t.icon," ",t.label]})}function Lq(){return a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mt-2",children:[a.jsx("span",{className:"text-xs text-gray-400 font-body",children:"Supported:"}),["youtube","vimeo","facebook","direct"].map(r=>a.jsx(oP,{platform:r},r))]})}function Oq(r){const n=Math.max(0,(window.screen.width-900)/2),s=Math.max(0,(window.screen.height-600)/2);window.open(r,"fb_video",`width=900,height=600,left=${n},top=${s},scrollbars=no,resizable=yes`)}function Mq({url:r,mediaType:e}){const[t,n]=k.useState(!1);if(!r.trim())return null;if(e==="video"){if(aP(r))return a.jsxs("div",{className:"w-full aspect-video rounded-lg border border-gray-200 overflow-hidden bg-gradient-to-br from-[#1a1a2e] via-[#16213e] to-[#0f3460] flex flex-col items-center justify-center gap-4",children:[a.jsx("div",{className:"w-14 h-14 rounded-2xl bg-[#1877F2] flex items-center justify-center shadow-lg shadow-[#1877F2]/40",children:a.jsx("svg",{viewBox:"0 0 24 24",className:"w-8 h-8 fill-white","aria-hidden":"true",children:a.jsx("path",{d:"M24 12.073C24 5.405 18.627 0 12 0S0 5.405 0 12.073C0 18.1 4.388 23.094 10.125 24v-8.437H7.078v-3.49h3.047V9.41c0-3.025 1.792-4.697 4.533-4.697 1.312 0 2.686.235 2.686.235v2.97h-1.513c-1.491 0-1.956.93-1.956 1.874v2.25h3.328l-.532 3.49h-2.796V24C19.612 23.094 24 18.1 24 12.073z"})})}),a.jsxs("button",{type:"button",onClick:()=>Oq(r),className:"flex items-center gap-2 bg-[#1877F2] hover:bg-[#166fe5] text-white text-sm font-bold font-body px-5 py-2.5 rounded-full transition-all hover:scale-105 shadow-lg",children:[a.jsx(kf,{className:"w-4 h-4 fill-current"}),"Preview on Facebook"]}),a.jsx("p",{className:"text-white/40 text-xs font-body",children:"Opens in a popup"})]});const s=iP(r);return Rq(s)?a.jsx("div",{className:"w-full aspect-video rounded-lg border border-gray-200 overflow-hidden bg-black",children:a.jsx("iframe",{src:s,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",sandbox:"allow-scripts allow-same-origin allow-presentation allow-popups allow-popups-to-escape-sandbox",allowFullScreen:!0,title:"Video preview"})}):a.jsx("div",{className:"w-full aspect-video rounded-lg border border-gray-200 overflow-hidden bg-black",children:a.jsx("video",{src:s,controls:!0,className:"w-full h-full"})})}return a.jsx("div",{className:"w-full aspect-video rounded-lg border border-gray-200 overflow-hidden bg-gray-100 flex items-center justify-center",children:t?a.jsxs("div",{className:"flex flex-col items-center gap-2 text-gray-400",children:[a.jsx(gU,{className:"w-8 h-8"}),a.jsx("p",{className:"text-xs",children:"Could not load image"})]}):a.jsx("img",{src:r,alt:"Preview",className:"w-full h-full object-contain",onError:()=>n(!0)})})}function Fq({item:r}){return r.mediaType==="video"?a.jsx("div",{className:"w-full h-full bg-gray-800 flex items-center justify-center",children:a.jsx(vi,{className:"w-5 h-5 text-white/60"})}):a.jsx("img",{src:r.preview,alt:"",className:"w-full h-full object-cover"})}function Bq(){const[r,e]=k.useState([]),[t,n]=k.useState(!0),[s,i]=k.useState(FA),[o,l]=k.useState(!1),[c,u]=k.useState(""),[d,h]=k.useState("upload"),[f,p]=k.useState(!1),[m,g]=k.useState([]),[v,b]=k.useState(!1),y=k.useRef(null),[w,_]=k.useState(null),[N,S]=k.useState(""),[E,T]=k.useState(!1),D=jq(),[R,H
1147]=k.useState(MA()),A=k.useCallback(async()=>{if(!je||!Y){n(!1);return}try{const{data:Z}=await Y.from("gallery_images").select("*").order("issue_week_start",{ascending:!1}).order("created_at",{ascending:!1});e(Z??[])}catch{}finally{n(!1)}},[]);k.useEffect(()=>{A()},[A]);const U=Z=>{const pe=Array.from(Z).filter(me=>me.type.startsWith("image/")||me.type.startsWith("video/")).map(me=>({id:`${Date.now()}-${Math.random()}`,file:me,preview:URL.createObjectURL(me),caption:me.name.replace(/\.[^.]+$/,"").replace(/[-_]/g," "),mediaType:me.type.startsWith("video/")?"video":"image",status:"pending"}));pe.length&&(g(me=>[...me,...pe]),u(""))},C=Z=>{g(ie=>{const pe=ie.find(me=>me.id===Z);return pe&&URL.revokeObjectURL(pe.preview),ie.filter(me=>me.id!==Z)})},M=(Z,ie)=>g(pe=>pe.map(me=>me.id===Z?{...me,caption:ie}:me)),L=()=>{g(Z=>(Z.filter(ie=>ie.status==="done").forEach(ie=>URL.revokeObjectURL(ie.preview)),Z.filter(ie=>ie.status!=="done")))},B=async()=>{if(!je||!Y){u("Supabase not configured.");return}const Z=m.filter(ie=>ie.status==="pending");if(Z.length){b(!0),u("");for(const ie of Z){g(Oe=>Oe.map(De=>De.id===ie.id?{...De,status:"uploading"}:De));let pe="";if(ie.mediaType==="image"){const Oe=`gallery/${Date.now()}-${BA(ie.file.name)}`,{error:De}=await Y.storage.from("gallery-photos").upload(Oe,ie.file,{upsert:!1});if(De){g(fe=>fe.map(j=>j.id===ie.id?{...j,status:"error",error:De.message}:j));continue}const{data:re}=Y.storage.from("gallery-photos").getPublicUrl(Oe);pe=re.publicUrl}else{const Oe=`gallery/${Date.now()}-${BA(ie.file.name)}`,{error:De}=await Y.storage.from("gallery-photos").upload(Oe,ie.file,{upsert:!1,contentType:ie.file.type});if(De){g(fe=>fe.map(j=>j.id===ie.id?{...j,status:"error",error:De.message}:j));continue}const{data:re}=Y.storage.from("gallery-photos").getPublicUrl(Oe);pe=re.publicUrl}const{error:me}=await Y.from("gallery_images").insert({url:pe,title:ie.caption.trim(),media_type:ie.mediaType,issue_week_start:R});g(Oe=>Oe.map(De=>De.id===ie.id?{...De,status:me?"error":"done",error:me==null?void 0:me.message}:De))}b(!1),await A()}},I=async Z=>{if(Z.preventDefault(),!s.url.trim()){u("URL is required.");return}if(s.media_type==="video"){const me=Dq(s.url);if(me){u(me);return}}if(!je||!Y){u("Supabase not configured.");return}l(!0),u("");const ie=s.media_type==="video"?iP(s.url):s.url.trim(),{error:pe}=await Y.from("gallery_images").insert({url:ie,title:s.title.trim(),media_type:s.media_type,issue_week_start:R});pe?u(pe.message):(i(FA),await A()),l(!1)},z=async Z=>{if(!je||!Y)return;T(!0);const{error:ie}=await Y.from("gallery_images").update({title:N.trim()}).eq("id",Z);ie||(e(pe=>pe.map(me=>me.id===Z?{...me,title:N.trim()}:me)),_(null)),T(!1)},X=async Z=>{!je||!Y||confirm("Delete this item?")&&(await Y.from("gallery_images").delete().eq("id",Z),e(ie=>ie.filter(pe=>pe.id!==Z)))},F=r.filter(Z=>Z.media_type!=="video"),q=r.filter(Z=>Z.media_type==="video"),V=s.media_type==="video"?Tq(s.url):null,K=m.filter(Z=>Z.status==="pending").length,ee=m.filter(Z=>Z.status==="done").length;return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-5",children:[a.jsxs("h2",{className:"font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[a.jsx(ia,{className:"w-4 h-4 text-brand-red"}),"Add to Gallery"]}),a.jsx(Aq,{value:R,onChange:H,weekOptions:D}),a.jsxs("div",{className:"flex gap-1 p-1 bg-gray-100 rounded-lg w-fit mb-4",children:[a.jsxs("button",{type:"button",onClick:()=>{h("upload"),u(""),i(Z=>({...Z,url:""}))},className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-semibold transition-colors ${d==="upload"?"bg-white text-gray-800 shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:[a.jsx(Fn,{className:"w-3.5 h-3.5"})," Bulk Upload"]}),a.jsxs("button",{type:"button",onClick:()=>{h("url"),u("")},className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-semibold transition-colors ${d==="url"?"bg-white text-gray-800 shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:[a.jsx(SR,{className:"w-3.5 h-3.5"})," Paste URL"]})]}),d==="upload"?a.jsxs(a.Fragment,{children:[a.jsx("input",{ref:y,type:"file",multiple:!0,accept:"image/*,video/*",className:"hidden",onChange:Z=>Z.target.files&&U(Z.target.files)}),a.jsxs("div",{onDragOver:Z=>{Z.preventDefault(),p(!0)},onDragLeave:()=>p(!1),onDrop:Z=>{Z.preventDefault(),p(!1),U(Z.dataTransfer.files)},onClick:()=>{var Z;return(Z=y.current)==null?void 0:Z.click()},className:`border-2 border-dashed rounded-xl p-8 text-center cursor-pointer transition-colors ${f?"border-brand-red bg-red-50":"border-gray-300 hover:border-brand-red hover:bg-gray-50"}`,children:[a.jsx(qx,{className:`w-10 h-10 mx-auto mb-3 ${f?"text-brand-red":"text-gray-400"}`}),a.jsx("p",{className:"text-sm font-semibold text-gray-700",children:f?"Drop files here":"Click to select or drag & drop photos and videos"}),a.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"JPG, PNG, WebP, MP4, WebM — multiple files supported"})]}),m.length>0&&a.jsxs("div",{className:"mt-5 rounded-xl border border-gray-200 overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-gray-100",children:[a.jsxs("h3",{className:"font-semibold text-sm text-gray-800",children:["Upload Queue — ",m.length," item",m.length!==1?"s":""]}),a.jsxs("div",{className:"flex items-center gap-2",children:[ee>0&&a.jsx("button",{onClick:L,className:"text-xs font-medium text-gray-500 hover:text-gray-800 transition-colors",children:"Clear done"}),K>0&&a.jsxs("button",{onClick:B,disabled:v,className:"flex items-center gap-1.5 bg-brand-red hover:bg-brand-red-dark text-white text-xs font-semibold px-4 py-2 rounded-lg transition-colors disabled:opacity-60",children:[v?a.jsx(_e,{className:"w-3.5 h-3.5 animate-spin"}):a.jsx(Fn,{className:"w-3.5 h-3.5"}),"Upload ",K," item",K!==1?"s":""]})]})]}),a.jsx("div",{className:"divide-y divide-gray-50",children:m.map(Z=>a.jsxs("div",{className:"flex items-center gap-4 px-5 py-3",children:[a.jsx("div",{className:"w-14 h-14 flex-shrink-0 rounded-lg overflow-hidden bg-gray-100 border border-gray-200",children:a.jsx(Fq,{item:Z})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("input",{type:"text",value:Z.caption,onChange:ie=>M(Z.id,ie.target.value),disabled:Z.status!=="pending",placeholder:"Add a caption...",className:"w-full text-sm border border-gray-200 rounded-lg px-3 py-1.5 focus:outline-none focus:ring-2 focus:ring-brand-red/30 focus:border-brand-red disabled:bg-gray-50 disabled:text-gray-400"}),a.jsxs("p",{className:"text-xs text-gray-400 mt-0.5 truncate flex items-center gap-1",children:[Z.mediaType==="video"&&a.jsx(vi,{className:"w-3 h-3"}),Z.file.name]})]}),a.jsxs("div",{className:"flex-shrink-0 flex items-center gap-2",children:[Z.status==="pending"&&a.jsx("span",{className:"text-xs text-gray-400",children:"Ready"}),Z.status==="uploading"&&a.jsx(_e,{className:"w-4 h-4 animate-spin text-brand-red"}),Z.status==="done"&&a.jsx(At,{className:"w-4 h-4 text-green-500"}),Z.status==="error"&&a.jsxs("span",{className:"flex items-center gap-1 text-xs text-red-600",title:Z.error,children:[a.jsx(Ve,{className:"w-4 h-4"})," Error"]}),(Z.status==="pending"||Z.status==="error")&&a.jsx("button",{onClick:()=>C(Z.id),className:"text-gray-300 hover:text-gray-600 transition-colors",children:a.jsx(tt,{className:"w-4 h-4"})})]})]}
1147,Z.id))})]}),c&&a.jsxs("div",{className:"mt-4 flex items-start gap-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg px-3 py-2.5",children:[a.jsx(Ve,{className:"w-4 h-4 shrink-0 mt-0.5"}),a.jsx("span",{className:"whitespace-pre-line font-body",children:c})]})]}):a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:[a.jsxs("form",{onSubmit:I,className:"space-y-4",children:[a.jsx("div",{className:"flex gap-2",children:["image","video"].map(Z=>a.jsxs("button",{type:"button",onClick:()=>{i(ie=>({...ie,media_type:Z,url:""})),u("")},className:`flex items-center gap-1.5 px-4 py-2 rounded-lg text-sm font-semibold border transition-colors ${s.media_type===Z?"bg-brand-red text-white border-brand-red":"bg-white text-gray-600 border-gray-200 hover:border-gray-300"}`,children:[Z==="image"?a.jsx(ia,{className:"w-4 h-4"}):a.jsx(vi,{className:"w-4 h-4"}),Z==="image"?"Photo":"Video"]},Z))}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:[s.media_type==="video"?"Video URL":"Image URL"," ",a.jsx("span",{className:"text-brand-red",children:"*"})]}),a.jsxs("div",{className:"relative",children:[a.jsx("input",{type:"url",value:s.url,onChange:Z=>{i(ie=>({...ie,url:Z.target.value})),u("")},placeholder:s.media_type==="video"?"Paste a YouTube, Vimeo, or Facebook video URL":"https://imagedelivery.net/...",className:`w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 transition-colors ${c&&s.media_type==="video"?"border-red-300 focus:ring-red-200 focus:border-red-400":V?"border-green-300 focus:ring-green-100 focus:border-green-400":"border-gray-300 focus:ring-brand-red/30 focus:border-brand-red"}`}),V&&!c&&a.jsx("div",{className:"absolute right-2.5 top-1/2 -translate-y-1/2",children:a.jsx(At,{className:"w-4 h-4 text-green-500"})})]}),s.media_type==="video"&&a.jsxs(a.Fragment,{children:[V&&!c&&a.jsxs("div",{className:"flex items-center gap-1.5 mt-1.5",children:[a.jsx(At,{className:"w-3 h-3 text-green-500 shrink-0"}),a.jsx("span",{className:"text-xs text-green-700 font-body",children:"Detected: "}),a.jsx(oP,{platform:V})]}),a.jsx(Lq,{})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Caption / Title"}),a.jsx("input",{type:"text",value:s.title,onChange:Z=>i(ie=>({...ie,title:Z.target.value})),placeholder:"e.g. Softball game, May 31",className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-brand-red/30 focus:border-brand-red"})]}),c&&a.jsxs("div",{className:"flex items-start gap-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg px-3 py-2.5",children:[a.jsx(Ve,{className:"w-4 h-4 shrink-0 mt-0.5"}),a.jsx("span",{className:"whitespace-pre-line font-body",children:c})]}),a.jsxs("button",{type:"submit",disabled:o,className:"flex items-center gap-2 bg-brand-red hover:bg-brand-red-dark text-white px-5 py-2 rounded-lg text-sm font-semibold transition-colors disabled:opacity-50",children:[o?a.jsx(_e,{className:"w-4 h-4 animate-spin"}):a.jsx(No,{className:"w-4 h-4"}),"Add to Gallery"]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Preview"}),s.url.trim()&&!c?a.jsx(Mq,{url:s.url,mediaType:s.media_type}):a.jsx("div",{className:"w-full aspect-video rounded-lg border-2 border-dashed border-gray-200 flex items-center justify-center text-gray-300",children:a.jsxs("div",{className:"text-center",children:[s.media_type==="video"?a.jsx(vi,{className:"w-8 h-8 mx-auto mb-1 opacity-40"}):a.jsx(ia,{className:"w-8 h-8 mx-auto mb-1 opacity-40"}),a.jsx("p",{className:"text-xs",children:"Enter a URL to preview"})]})})]})]})]}),[{label:"Gallery Photos",icon:ia,data:F},{label:"Gallery Videos",icon:vi,data:q}].map(({label:Z,icon:ie,data:pe})=>a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden",children:[a.jsxs("div",{className:"px-5 py-4 border-b border-gray-100 flex items-center justify-between",children:[a.jsxs("h2",{className:"font-semibold text-gray-900 flex items-center gap-2",children:[a.jsx(ie,{className:"w-4 h-4 text-brand-red"}),Z]}),a.jsxs("span",{className:"text-sm text-gray-400",children:[pe.length," item",pe.length!==1?"s":""]})]}),t?a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx(_e,{className:"w-6 h-6 animate-spin text-gray-400"})}):pe.length===0?a.jsx("p",{className:"text-center py-12 text-gray-400 text-sm",children:"None yet."}):a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 xl:grid-cols-5 ga
1147p-4 p-5",children:pe.map(me=>{const Oe=w===me.id;return a.jsxs("div",{className:"relative group rounded-lg overflow-hidden border border-gray-200 bg-gray-50",children:[a.jsx("div",{className:"aspect-square bg-gray-100 flex items-center justify-center overflow-hidden relative",children:me.media_type==="video"?a.jsxs(a.Fragment,{children:[a.jsx(Iq,{url:me.url}),a.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/20",children:a.jsx(kf,{className:"w-8 h-8 text-white fill-white drop-shadow"})}),a.jsxs("span",{className:"absolute top-1.5 left-1.5 bg-black/60 text-white text-[10px] font-bold px-1.5 py-0.5 rounded flex items-center gap-1",children:[a.jsx(vi,{className:"w-2.5 h-2.5"})," VIDEO"]})]}):a.jsx("img",{src:me.url,alt:me.title||"Gallery image",loading:"lazy",className:"w-full h-full object-cover"})}),Oe?a.jsxs("div",{className:"px-2 pt-2 pb-1.5 bg-white",children:[a.jsx("input",{autoFocus:!0,type:"text",value:N,onChange:De=>S(De.target.value),onKeyDown:De=>{De.key==="Enter"&&z(me.id),De.key==="Escape"&&_(null)},className:"w-full text-xs border border-brand-red rounded px-2 py-1 focus:outline-none focus:ring-1 focus:ring-brand-red/40",placeholder:"Add a caption..."}),a.jsxs("div",{className:"flex gap-1 mt-1.5",children:[a.jsxs("button",{type:"button",onClick:()=>z(me.id),disabled:E,className:"flex-1 flex items-center justify-center gap-1 bg-brand-red text-white text-[10px] font-bold py-1 rounded transition-colors hover:bg-brand-red-dark disabled:opacity-50",children:[E?a.jsx(_e,{className:"w-2.5 h-2.5 animate-spin"}):a.jsx(vn,{className:"w-2.5 h-2.5"}
1147),"Save"]}),a.jsx("button",{type:"button",onClick:()=>_(null),className:"flex items-center justify-center w-7 rounded bg-gray-100 hover:bg-gray-200 text-gray-500 transition-colors",children:a.jsx(tt,{className:"w-3 h-3"})})]})]}):a.jsxs("div",{className:"px-2 py-1.5 bg-white flex items-start justify-between gap-1",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-xs font-medium text-gray-700 truncate leading-tight",children:me.title||a.jsx("span",{className:"text-gray-400 italic",children:"No caption"})}),(()=>{const De=sP(new Date(me.issue_week_start+"T12:00:00")),re=me.issue_week_start>MA();return a.jsxs("span",{className:`inline-flex items-center gap-1 text-[10px] font-semibold font-body mt-0.5 px-1.5 py-0.5 rounded ${re?"bg-amber-100 text-amber-700":"bg-gray-100 text-gray-500"}`,children:[re&&a.jsx(zr,{className:"w-2.5 h-2.5"}),"Wk ",De,re?" — scheduled":""]})})()]}),a.jsx("button",{type:"button",onClick:()=>{_(me.id),S(me.title??"")},className:"flex-shrink-0 p-0.5 rounded text-gray-300 hover:text-brand-red transition-colors",title:"Edit caption",children:a.jsx(Sf,{className:"w-3 h-3"})})]}),a.jsx("button",{onClick:()=>X(me.id),className:"absolute top-2 right-2 w-7 h-7 bg-red-600 text-white rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity shadow",title:"Delete",children:a.jsx(Sn,{className:"w-3.5 h-3.5"})})]},me.id)})})]},Z))]})}const lP="digital-paper",$A="current/edition.pdf";function $q(r){if(!r)return $A;const e=`/${lP}/`,t=r.indexOf(e);return t===-1?$A:r.slice(t+e.length).split("?")[0]}async function Zp(r,e=3600){if(!je||!Y)return null;const t=$q(r),{data:n,error:s}=await Y.storage.from(lP).createSignedUrl(t,e);return s||!(n!=null&&n.signedUrl)?null:n.signedUrl}const Uq=25*1024*1024;function Hq(){const[r,e]=k.useState(null),[t,n]=k.useState(""),[s,i]=k.useState(!0),[o,l]=k.useState(!1),[c,u]=k.useState(0),[d,h]=k.useState(""),[f,p]=k.useState(""),[m,g]=k.useState(!1),[v,b]=k.useState(null),[y,w]=k.useState(!1),[_,N]=k.useState(""),S=k.useRef(null),E=async()=>{if(!je||!Y){i(!1);return}const{data:M}=await Y.from("digital_paper").select("*").order("uploaded_at",{ascending:!1}).limit(1).maybeSingle();e(M??null),n(M?await Zp(M.pdf_url)??"":""),i(!1)};k.useEffect(()=>{E()},[]);const T=()=>{h(""),p("")},D=M=>{var B;T(),g(!1),b(null);const L=(B=M.target.files)==null?void 0:B[0];if(L){if(L.type!=="application/pdf"){h("Only PDF files are accepted.");return}if(L.size>Uq){h(`File is too large (${(L.size/1024/1024).toFixed(1)} MB). Maximum size is 25 MB.`);return}r?(b(L),g(!0)):H(L)}},R="00000000-0000-0000-0000-000000000001",H=async M=>{if(!je||!Y){h("Supabase is not configured.");return}const{data:L}=await Y.auth.getSession();if(!L.session){h("Your session has expired. Please sign out and sign back in.");return}l(!0),u(10),T(),g(!1),b(null);try{u(30);const B=L.session.access_token,I="https://rdyprhzjnqjauufyfqlp.supabase.co/functions/v1/save-digital-paper",z=new FormData;z.append("file",M),u(60);const X=await fetch(I,{method:"POST",headers:{Authorization:`Bearer ${B}`,Apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJkeXByaHpqbnFqYXV1ZnlmcWxwIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODAzNDYzMDAsImV4cCI6MjA5NTkyMjMwMH0.zyA_fVB72pAmHui8m1UhJkK-R9yndy6nuLgyzLDvW04"},body:z});if(!X.ok){const F=await X.json().catch(()=>({error:"Unknown error"}));throw new Error(F.error??"Failed to save record")}u(100),p(`"${M.name}" is now live as the current digital paper.`),await E()}catch(B){h(B instanceof Error?B.message:"Upload failed. Please try again.")}finally{l(!1),u(0),S.current&&(S.current.value="")}},A=async()=>{if(!je||!Y)return;const{data:M}=await Y.auth.getSession();if(!M.session){N("Your session has expired. Please sign out and sign back in.");return}w(!0),N("");try{const B=await fetch("https://rdyprhzjnqjauufyfqlp.supabase.co/functions/v1/notify-digital-paper",{method:"POST",headers:{Authorization:`Bearer ${M.session.access_token}`,Apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJkeXByaHpqbnFqYXV1Znlm
1147cWxwIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODAzNDYzMDAsImV4cCI6MjA5NTkyMjMwMH0.zyA_fVB72pAmHui8m1UhJkK-R9yndy6nuLgyzLDvW04"}}),I=await B.json().catch(()=>({error:"Unknown error"}));if(!B.ok)throw new Error(I.error??"Failed to send notifications");const z=I;z.email_sent?N(`Notification sent to ${z.recipients} subscriber${(z.recipients??0)===1?"":"s"}.`):N(z.reason??"No notifications sent.")}catch(L){N(L instanceof Error?L.message:"Failed to send notifications.")}finally{w(!1)}},U=async()=>{!Y||!r||confirm("Remove the current digital paper? The page will show a placeholder until a new one is uploaded.")&&(T(),await Y.from("digital_paper").delete().eq("id",R),e(null),p("Digital paper removed."))},C=r?new Date(r.uploaded_at).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}):null;return a.jsxs("div",{className:"max-w-2xl space-y-6",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-bold text-navy-900 font-headline",children:"Digital Paper"}),a.jsx("p",{className:"text-sm text-gray-500 font-body mt-0.5",children:"Upload the current edition PDF. Only one PDF is shown at a time — uploading a new one replaces the previous."})]}),a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm overflow-hidden",children:[a.jsxs("div",{className:"px-5 py-4 border-b border-gray-100 flex items-center justify-between",children:[a.jsx("span",{className:"text-sm font-semibold text-navy-900 font-body",children:"Currently Live"}),a.jsx("button",{onClick:E,className:"text-gray-400 hover:text-gray-600 transition-colors",title:"Refresh",children:a.jsx(Ru,{className:"w-3.5 h-3.5"})})]}),a.jsx("div",{className:"px-5 py-4",children:s?a.jsxs("div",{className:"flex items-center gap-2 text-gray-400 text-sm",children:[a.jsx(_e,{className:"w-4 h-4 animate-spin"}),a.jsx("span",{children:"Loading..."})]}):r?a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-10 h-10 rounded-lg bg-brand-red/10 flex items-center justify-center flex-shrink-0",children:a.jsx(Bt,{className:"w-5 h-5 text-brand-red"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-semibold text-navy-900 text-sm font-body leading-tight",children:r.file_name??"digital-paper.pdf"}),a.jsxs("p",{className:"text-xs text-gray-400 font-body mt-0.5",children:["Uploaded ",C]}),a.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-brand-red hover:underline font-body mt-0.5 inline-block",children:"Preview PDF"})]})]}),a.jsxs("button",{onClick:U,className:"flex items-center gap-1.5 text-xs text-red-500 hover:text-red-700 font-body font-medium transition-colors flex-shrink-0 mt-1",children:[a.jsx(Sn,{className:"w-3.5 h-3.5"}),"Remove"]})]}):a.jsxs("div",{className:"flex items-center gap-2 text-gray-400 text-sm font-body",children:[a.jsx(Bt,{className:"w-4 h-4"}),"No digital paper is currently live."]})})]}),a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm overflow-hidden",children:[a.jsx("div",{className:"px-5 py-4 border-b border-gray-100",children:a.jsx("span",{className:"text-sm font-semibold text-navy-900 font-body",children:r?"Replace Current Edition":"Upload New Edition"})}),a.jsxs("div",{className:"px-5 py-5 space-y-4",children:[m&&v&&a.jsxs("div",{className:"rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 flex items-start gap-3",children:[a.jsx(Ve,{className:"w-4 h-4 text-amber-600 flex-shrink-0 mt-0.5"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-semibold text-amber-800 font-body",children:"Replace current edition?"}),a.jsxs("p",{className:"text-xs text-amber-700 font-body mt-0.5",children:["This will replace ",a.jsx("strong",{children:(r==null?void 0:r.file_name)??"the current PDF"})," with"," ",a.jsx("strong",{children:v.name})," (",(v.size/1024/1024).toFixed(1)," MB)."]}),a.jsxs("div",{className:"flex gap-2 mt-3",children:[a.jsx("button",{onClick:()=>H(v),className:"bg-amber-600 hover:bg-amber-700 text-white text-xs font-bold font-body px-4 py-1.5 rounded transition-colors",children:"Yes, Replace"}),a.jsx("button",{onClick:()=>{g(!1),b(null),S.current&&(S.current.value="")},className:"bg-white border border-gray-300 text-gray-600 text-xs font-body px-4 py-1.5 rounded hover:bg-gray-50 transition-colors",children:"Cancel"})]})]})]}),!m&&a.jsxs("label",{className:`flex flex-col items-center justify-center gap-3 w-full border-2 border-dashed rounded-xl py-10 px-6 cursor-pointer transition-colors ${o?"border-gray-200 bg-gray-50 cursor-not-allowed":"border-gray-300 hover:border-brand-red hover:bg-brand-red/5"}`,children:[a.jsx("input",{ref:S,type:"file",accept:"application/pdf",onChange:D,disabled:o,className:"sr-only"}),o?a.jsx(_e,{className:"w-8 h-8 text-brand-red animate-spin"}):a.jsx("div",{className:"w-12 h-12 rounded-full bg-brand-red/10 flex items-center justify-center",children:a.jsx(Fn,{className:"w-6 h-6 text-brand-red"})}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"font-semibold text-sm text-navy-900 font-body",children:o?"Uploading…":"Click to select a PDF"}),a.jsx("p",{className:"text-xs text-gray-400 font-body mt-0.5",children:"PDF only · max 25 MB"})]})]}),o&&c>0&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"w-full bg-gray-100 rounded-full h-1.5 overflow-hidden",children:a.jsx("div",{className:"bg-brand-red h-full rounded-full transition-all duration-300",style:{width:`${c}%`}})}),a.jsxs("p",{className:"text-xs text-gray-400 font-body text-right",children:[c,"%"]})]}),d&&a.jsxs("div",{className:"flex items-start gap-2 text-red-600 bg-red-50 border border-red-100 rounded-lg px-4 py-3",children:[a.jsx(Ve,{className:"w-4 h-4 flex-shrink-0 mt-0.5"}),a.jsx("p",{className:"text-sm font-body",children:d})]}),f&&a.jsxs("div",{className:"flex items-start gap-2 text-green-700 bg-green-50 border border-green-100 rounded-lg px-4 py-3",children:[a.jsx(At,{className:"w-4 h-4 flex-shrink-0 mt-0.5"}),a.jsx("p",{className:"text-sm font-body",children:f})]})]})]}),r&&a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm overflow-hidden",children:[a.jsxs("div",{className:"px-5 py-4 border-b border-gray-100 flex items-center gap-2",children:[a.jsx(go,{className:"w-4 h-4 text-navy-900"}),a.jsx("span",{className:"text-sm font-semibold text-navy-900 font-body",children:"Notify Subscribers"})]}),a.jsxs("div",{className:"px-5 py-4 space-y-3",children:[a.jsx("p",{className:"text-xs text-gray-500 font-body leading-relaxed",children:"Send an email to all subscriber accounts letting them know a new digital paper is available on the website."}),a.jsxs("button",{onClick:A,disabled:y,className:"flex items-center gap-2 px-4 py-2 bg-navy-900 text-white rounded-lg text-sm font-semibold hover:bg-navy-800 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:[y?a.jsx(_e,{className:"w-4 h-4 animate-spin"}):a.jsx(qg,{className:"w-4 h-4"}
1147),y?"Sending…":"Send Notification Email"]}),_&&a.jsxs("div",{className:`flex items-start gap-2 rounded-lg px-4 py-3 ${_.includes("sent to")?"text-green-700 bg-green-50 border border-green-100":"text-gray-600 bg-gray-50 border border-gray-100"}`,children:[_.includes("sent to")?a.jsx(At,{className:"w-4 h-4 flex-shrink-0 mt-0.5"}):a.jsx(Ve,{className:"w-4 h-4 flex-shrink-0 mt-0.5"}),a.jsx("p",{className:"text-sm font-body",children:_})]})]})]})]})}const UA={item_type:"event",year_label:"",sort_year:new Date().getFullYear(),title:"",description:"",published:!0};function zq(r){const e=parseInt(r.replace(/\D/g,""),10);return isNaN(e)?new Date().getFullYear():e}function qq(){const[r,e]=k.useState([]),[t,n]=k.useState(!0),[s,i]=k.useState(null),[o,l]=k.useState(UA),[c,u]=k.useState(!1),[d,h]=k.useState(""),[f,p]=k.useState(null),[m,g]=k.useState(!1),[v,b]=k.useState("");k.useEffect(()=>{vH().then(R=>e(R)).catch(()=>{}).finally(()=>n(!1))},[]);function y(R){b(R),setTimeout(()=>b(""),3e3)}function w(){l({...UA,sort_year:new Date().getFullYear()}),i("new"),h("")}function _(R){l({item_type:R.item_type,year_label:R.year_label,sort_year:R.sort_year,title:R.title,description:R.description??"",published:R.published}),i(R.id),h("")}function N(){i(null),h("")}function S(R){l(H=>({...H,year_label:R,sort_year:zq(R)}))}async function E(){if(!o.year_label.trim()){h("Year is required.");return}if(!o.title.trim()){h("Title is required.");return}u(!0),h("");const R=s==="new"?{...o,year_label:o.year_label.trim(),title:o.title.trim()}:{id:s,...o,year_label:o.year_label.trim(),title:o.title.trim()},{data:H,error:A}=await pA(R);if(u(!1),A){h(A);return}H&&e(U=>s==="new"?[...U,H].sort((C,M)=>C.sort_year-M.sort_year):U.map(C=>C.id===H.id?H:C)),i(null),y(s==="new"?"Timeline item added.":"Timeline item updated.")}async function T(R){g(!0),await wH(R),e(H=>H.filter(A=>A.id!==R)),p(null),g(!1),y("Item deleted.")}async function D(R){const{data:H}=await pA({...R,published:!R.published});H&&e(A=>A.map(U=>U.id===H.id?H:U))}return a.jsxs("div",{className:"p-6 max-w-3xl mx-auto",children:[v&&a.jsxs("div",{className:"fixed top-4 right-4 z-50 bg-green-600 text-white px-4 py-2.5 rounded-lg shadow-lg flex items-center gap-2 text-sm font-medium",children:[a.jsx(At,{className:"w-4 h-4"})," ",v]}),a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"font-headline text-xl font-bold text-gray-900",children:"Timeline Manager"}),a.jsx("p",{className:"text-sm text-gray-500 mt-0.5",children:"Manage the historical timeline displayed on the About page."})]}),a.jsxs("button",{onClick:w,className:"flex items-center gap-2 bg-brand-red hover:bg-brand-red-dark text-white px-4 py-2 text-sm font-bold transition-colors",children:[a.jsx(No,{className:"w-4 h-4"})," Add Item"]})]}),s!==null&&a.jsxs("div",{className:"border border-brand-red bg-red-50 p-5 mb-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"font-headline font-bold text-brand-black",children:s==="new"?"Add New Timeline Item":"Edit Timeline Item"}),a.jsx("button",{onClick:N,className:"text-gray-400 hover:text-gray-700 transition-colors",children:a.jsx(tt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider",children:"Type"}),a.jsx("div",{className:"flex",children:["year","event"].map(R=>a.jsx("button",{type:"button",onClick:()=>l(H=>({...H,item_type:R})),className:`flex-1 py-2 text-sm font-semibold border transition-colors first:rounded-l-none last:rounded-r-none ${o.item_type===R?"bg-brand-red text-white border-brand-red":"bg-white text-gray-600 border-gray-300 hover:bg-gray-50"}`,children:R==="year"?"Year Marker":"Event"},R))}),a.jsx("p",{className:"text-xs text-gray-400 mt-1",children:o.item_type==="year"?"A prominent year milestone displayed as a section header.":"A specific event that occurred — shown as a timeline entry."})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider",children:"Year Label"}),a.jsx("input",{type:"text",value:o.year_label,onChange:R=>S(R.target.value),placeholder:"e.g. 1921, 1930s, 2024",className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red"}),a.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Used for display and sort order."})]}),a.jsxs("div",{className:"sm:col-span-2",children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider",children:"Title *"}),a.jsx("input",{type:"text",value:o.title,onChange:R=>l(H=>({...H,title:R.target.value})),placeholder:o.item_type==="year"?"e.g. Founded":"e.g. First issue published",className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red"})]}),a.jsxs("div",{className:"sm:col-span-2",children:[a.jsxs("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider",children:["Description ",a.jsx("span",{className:"text-gray-400 normal-case font-normal",children:"(optional for year markers)"})]}),a.jsx("textarea",{rows:3,value:o.description??"",onChange:R=>l(H=>({...H,description:R.target.value})),placeholder:"Additional detail about this milestone or event...",className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red resize-none"})]}),a.jsx("div",{children:a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:o.published,onChange:R=>l(H=>({...H,published:R.target.checked})),className:"w-4 h-4 rounded border-gray-300 text-brand-red focus:ring-brand-red"}),a.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Published (visible to readers)"})]})})]}),d&&a.jsxs("div",{className:"flex items-center gap-2 mt-4 text-xs text-red-700 bg-red-100 border border-red-200 rounded px-3 py-2",children:[a.jsx(Ve,{className:"w-3.5 h-3.5 shrink-0"})," ",d]}),a.jsxs("div",{className:"flex gap-3 mt-4",children:[a.jsxs("button",{onClick:E,disabled:c,
1147className:"flex items-center gap-2 bg-brand-red hover:bg-brand-red-dark text-white px-5 py-2 text-sm font-bold transition-colors disabled:opacity-60",children:[c?a.jsx(_e,{className:"w-4 h-4 animate-spin"}):a.jsx(At,{className:"w-4 h-4"}),c?"Saving…":"Save Item"]}),a.jsx("button",{onClick:N,className:"px-4 py-2 text-sm font-medium text-gray-600 hover:text-gray-900 border border-gray-300 hover:border-gray-400 transition-colors",children:"Cancel"})]})]}),t?a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx(_e,{className:"w-6 h-6 animate-spin text-brand-red"})}):r.length===0?a.jsxs("div",{className:"text-center py-16 text-gray-400 border border-dashed border-gray-300",children:[a.jsx("p",{className:"font-medium",children:"No timeline items yet."}),a.jsx("p",{className:"text-sm mt-1",children:'Click "Add Item" to create the first entry.'})]}):a.jsx("div",{className:"border border-gray-200 bg-white divide-y divide-gray-100",children:r.map(R=>a.jsxs("div",{className:`px-4 py-4 flex items-start gap-4 ${R.published?"":"opacity-60 bg-gray-50"}`,children:[a.jsx("div",{className:"flex-shrink-0 pt-0.5",children:R.item_type==="year"?a.jsx("span",{className:"inline-flex items-center gap-1 text-xs font-bold px-2 py-0.5 bg-brand-black text-white uppercase tracking-wider",children:"Year"}):a.jsx("span",{className:"inline-flex items-center gap-1 text-xs font-bold px-2 py-0.5 bg-blue-100 text-blue-800 uppercase tracking-wider",children:"Event"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.jsx("span",{className:"font-headline font-bold text-brand-red text-sm",children:R.year_label}),!R.published&&a.jsx("span",{className:"text-xs text-gray-400 font-body",children:"· Draft"})]}),a.jsx("p",{className:"font-semibold text-brand-black text-sm leading-snug",children:R.title}),R.description&&a.jsx("p",{className:"text-xs text-gray-500 mt-0.5 leading-relaxed line-clamp-2",children:R.description})]}),a.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[a.jsx("button",{onClick:()=>D(R),title:R.published?"Unpublish":"Publish",className:`p-1.5 rounded transition-colors text-xs font-bold ${R.published?"text-green-600 hover:bg-green-50":"text-gray-400 hover:bg-gray-100"}`,children:R.published?a.jsx(fa,{className:"w-4 h-4"}):a.jsx(Ws,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>_(R),className:"p-1.5 rounded text-gray-500 hover:text-brand-red hover:bg-red-50 transition-colors",title:"Edit",children:a.jsx(Sf,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>p(R.id),className:"p-1.5 rounded text-gray-400 hover:text-red-600 hover:bg-red-50 transition-colors",title:"Delete",children:a.jsx(Sn,{className:"w-4 h-4"})})]})]},R.id))}),f&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:()=>p(null),children:a.jsxs("div",{className:"bg-white rounded-lg shadow-2xl p-6 max-w-sm w-full",onClick:R=>R.stopPropagation(),children:[a.jsx("h3",{className:"font-headline font-bold text-brand-black text-lg mb-2",children:"Delete Timeline Item?"}),a.jsx("p",{className:"text-sm text-gray-600 mb-5",children:"This action cannot be undone."}),a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("button",{onClick:()=>T(f),disabled:m,className:"flex items-center gap-2 bg-red-600 hover:bg-red-700 text-white px-4 py-2 text-sm font-bold transition-colors disabled:opacity-60",children:[m?a.jsx(_e,{className:"w-4 h-4 animate-spin"}):a.jsx(Sn,{className:"w-4 h-4"}),m?"Deleting…":"Delete"]}),a.jsx("button",{onClick:()=>p(null),className:"px-4 py-2 text-sm font-medium text-gray-600 border border-gray-300 hover:border-gray-400 transition-colors",children:"Cancel"})]})]})})]})}class Wq{constructor(){this.stream=null,this.publisher=null,this.facing="user",this.listeners=new Set,this.recorder=null,this.recordedChunks=[],this.recordStartTs=0,this.lastRecording=null,this.overlay={enabled:!1,topText:null,bottomText:null},this.recordCanvas=null,this.recordVideo=null,this.recordCtx=null,this.recordAnimFrame=0,this.recordTickerOffset=0,this.host="",this.appName="live",this.streamName="dca-live",this.state={active:!1,viewerCount:0,error:null,stream
1147:null,facing:"user",recording:!1,lastRecording:null},this.publishVideo=null}setRed5Config(e,t,n){this.host=e,this.appName=t,this.streamName=n}isActive(){return this.stream!==null}subscribe(e){return this.listeners.add(e),e(this.state),()=>this.listeners.delete(e)}notify(){this.state={active:this.stream!==null,viewerCount:0,error:this.state.error,stream:this.stream,facing:this.facing,recording:this.recorder!==null&&this.recorder.state==="recording",lastRecording:this.lastRecording},this.listeners.forEach(e=>e(this.state))}setOverlaySettings(e){this.overlay=e}pickRecorderMime(){var t;const e=["video/webm;codecs=vp9,opus","video/webm;codecs=vp8,opus","video/webm","video/mp4"];for(const n of e)if(typeof MediaRecorder<"u"&&((t=MediaRecorder.isTypeSupported)!=null&&t.call(MediaRecorder,n)))return n;return"video/webm"}drawOverlay(e,t,n){if(this.overlay.enabled){if(this.overlay.topText){const s=Math.round(n*.08);e.fillStyle="rgba(0, 0, 0, 0.7)",e.fillRect(0,0,t,s),e.fillStyle="#ffffff",e.font=`600 ${Math.round(s*.55)}px sans-serif`,e.textAlign="center",e.textBaseline="middle",e.fillText(this.overlay.topText,t/2,s/2)}if(this.overlay.bottomText){const s=Math.round(n*.08);e.fillStyle="rgba(0, 0, 0, 0.7)",e.fillRect(0,n-s,t,s),e.fillStyle="#ffffff",e.font=`600 ${Math.round(s*.5)}px sans-serif`,e.textAlign="left",e.textBaseline="middle";const i=this.overlay.bottomText,o=e.measureText(i).width,l=60,c=o+l+t;this.recordTickerOffset=(this.recordTickerOffset+2)%c;const u=t-this.recordTickerOffset;e.fillText(i,u,n-s/2),u+o<t&&e.fillText(i,u+o+l,n-s/2)}}}startRecording(e){if(!(typeof MediaRecorder>"u"))try{const t=e.getVideoTracks()[0],n=e.getAudioTracks()[0];let s;if(this.overlay.enabled&&(this.overlay.topText||this.overlay.bottomText)&&t){const l=t.getSettings(),c=l.width||1280,u=l.height||720,d=document.createElement("canvas");d.width=c,d.height=u;const h=d.getContext("2d"),f=document.createElement("video");f.srcObject=e,f.muted=!0,f.play().catch(()=>{}),this.recordCanvas=d,this.recordVideo=f,this.recordCtx=h,this.recordTickerOffset=0;const p=()=>{!this.recordCtx||!this.recordVideo||!this.recordCanvas||(this.recordVideo.readyState>=2&&(this.recordCtx.drawImage(this.recordVideo,0,0,this.recordCanvas.width,this.recordCanvas.height),this.drawOverlay(this.recordCtx,this.recordCanvas.width,this.recordCanvas.height)),this.recordAnimFrame=requestAnimationFrame(p))};p();const m=d.captureStream(30);n&&m.addTrack(n),s=m}else s=e;const i=this.pickRecorderMime(),o=new MediaRecorder(s,{mimeType:i,videoBitsPerSecond:25e5});this.recordedChunks=[],this.recordStartTs=Date.now(),o.ondataavailable=l=>{l.data&&l.data.size>0&&this.recordedChunks.push(l.data)},o.onstop=()=>{const l=new Blob(this.recordedChunks,{type:i}),c=Date.now()-this.recordStartTs;l.size>0&&(this.lastRecording&&URL.revokeObjectURL(this.lastRecording.url),this.lastRecording={blob:l,url:URL.createObjectURL(l),mimeType:i,durationMs:c,startedAt:new Date(this.recordStartTs).toISOString()}),this.cleanupRecordCanvas(),this.recorder=null,this.notify()},o.start(1e3),this.recorder=o,this.notify()}catch{this.recorder=null}}cleanupRecordCanvas(){this.recordAnimFrame&&(cancelAnimationFrame(this.recordAnimFrame),this.recordAnimFrame=0),this.recordVideo&&(this.recordVideo.srcObject=null,this.recordVideo=null),this.recordCanvas=null,this.recordCtx=null}async start(e="user"){if(!this.stream){this.facing=e,this.state.error=null;try{const t={video:{width:{ideal:1280},height:{ideal:720},facingMode:e},audio:!0},n=await navigator.mediaDevices.getUserMedia(t);this.stream=n,this.startRecording(n),this.notify(),await this.publishToRed5()}catch(t){const n=t;throw n.name==="NotAllowedError"?this.state.error="Camera access denied. Allow camera permission in your browser.":n.name==="NotFoundError"?this.state.error="No camera found on this device.":this.state.error="Unable to access the camera.",this.notify(),t}}}async publishToRed5(){if(!(!this.stream||!this.host))try{const e=bz(this.host,this.appName,this.streamName),t=document.createElement("video");t.id="red5pro-publisher",t.muted=!0,t.playsInline=!0,t.setAttribute("autoplay",""),t.setAttribute("muted",""),t.setAttribute("playsinline",""),t.style.display="none",document.body.appendChild(t),this.publishVideo=t,t.srcObject=this.stream,t.play().catch(()=>{});const n=new sz;n.on("*",s=>{console.log("[Red5 Publisher]",s.type,s.data??"")}),n.on(at.PUBLISH_SUCCESS,()=>{this.state.error=null,this.notify()}),n.on(at.PUBLISH_INVALID,()=>{this.state.error="Red5 publish failed — the stream name may already be in use.",this.notify()}),n.on(at.DISCONNECT,()=>{this.stream&&(this.state.error="Connection to Red5 server was lost.",this.notify())}),await n.initWithStream({streamName:this.streamName,endpoint:e,mediaElementId:t.id,connectionParams:{nodeGroup:"default"}},this.stream),await n.publish(),this.publisher=n}catch(e){const t=e instanceof Error?e.message:"Failed to publish to Red5 Cloud.";this.state.error=`Red5 Cloud: ${t}`,this.notify()}}async switchCamera(e){var t;if(this.stream){this.facing=e;try{const n={video:{width:{ideal:1280},height:{ideal:720},facingMode:e},audio:!0},s=this.stream.getVideoTracks()[0];s&&s.stop();const o=(await navigator.mediaDevices.getUserMedia(n)).getVideoTracks()[0];s&&this.stream.removeTrack(s),this.stream.addTrack(o);const l=(t=this.publisher)==null?void 0:t.getPeerConnection();if(l){const c=l.getSenders().find(u=>{var d;return((d=u.track)==null?void 0:d.kind)==="video"});c&&c.replaceTrack(o).catch(()=>{})}this.notify()}catch(n){const s=n;this.state.error=s.name==="NotAllowedError"?"Camera access denied.":"Unable to switch camera.",this.notify()}}}stop(){if(this.recorder&&this.recorder.state!=="inactive")try{this.recorder.stop()}catch{}this.cleanupRecordCanvas(),this.recorder=null,this.publisher&&(this.publisher.unpublish().catch(()=>{}),this.publisher=null),this.publishVideo&&(this.publishVideo.srcObject=null,this.publishVideo.remove(),this.publishVideo=null),this.stream&&(this.stream.getTracks().forEac
1147h(e=>e.stop()),this.stream=null),this.notify()}clearRecording(){this.lastRecording&&(URL.revokeObjectURL(this.lastRecording.url),this.lastRecording=null,this.notify())}}window.addEventListener("beforeunload",()=>{Mi.isActive()&&(Mi.stop(),Y==null||Y.from("live_stream_settings").update({is_live:!1,publisher_id:null,stopped_at:new Date().toISOString(),updated_at:new Date().toISOString()}).eq("id",1))});const Mi=new Wq;var pt;(function(r){r.LOAD="LOAD",r.EXEC="EXEC",r.FFPROBE="FFPROBE",r.WRITE_FILE="WRITE_FILE",r.READ_FILE="READ_FILE",r.DELETE_FILE="DELETE_FILE",r.RENAME="RENAME",r.CREATE_DIR="CREATE_DIR",r.LIST_DIR="LIST_DIR",r.DELETE_DIR="DELETE_DIR",r.ERROR="ERROR",r.DOWNLOAD="DOWNLOAD",r.PROGRESS="PROGRESS",r.LOG="LOG",r.MOUNT="MOUNT",r.UNMOUNT="UNMOUNT"})(pt||(pt={}));const Vq=(()=>{let r=0;return()=>r++})(),Gq=new Error("ffmpeg is not loaded, call `await ffmpeg.load()` first"),Xq=new Error("called FFmpeg.terminate()");var Zn,zo,Ea,xc,vc,tx,gn;class Yq{constructor(){$(this,Zn,null);$(this,zo,{});$(this,Ea,{});$(this,xc,[]);$(this,vc,[]);Re(this,"loaded",!1);$(this,tx,()=>{x(this,Zn)&&(x(this,Zn).onmessage=({data:{id:e,type:t,data:n}})=>{switch(t){case pt.LOAD:this.loaded=!0,x(this,zo)[e](n);break;case pt.MOUNT:case pt.UNMOUNT:case pt.EXEC:case pt.FFPROBE:case pt.WRITE_FILE:case pt.READ_FILE:case pt.DELETE_FILE:case pt.RENAME:case pt.CREATE_DIR:case pt.LIST_DIR:case pt.DELETE_DIR:x(this,zo)[e](n);break;case pt.LOG:x(this,xc).forEach(s=>s(n));break;case pt.PROGRESS:x(this,vc).forEach(s=>s(n));break;case pt.ERROR:x(this,Ea)[e](n);break}delete x(this,zo)[e],delete x(this,Ea)[e]})});$(this,gn,({type:e,data:t},n=[],s)=>x(this,Zn)?new Promise((i,o)=>{const l=Vq();x(this,Zn)&&x(this,Zn).postMessage({id:l,type:e,data:t},n),x(this,zo)[l]=i,x(this,Ea)[l]=o,s==null||s.addEventListener("abort",()=>{o(new DOMException(`Message # ${l} was aborted`,"AbortError"))},{once:!0})}):Promise.reject(Gq));Re(this,"load",({classWorkerURL:e,...t}={},{signal:n}={})=>(x(this,Zn)||(P(this,Zn,e?new Worker(new URL(e,import.meta.url),{type:"module"}):new Worker(new URL("/assets/worker-BAOIWoxA.js",import.meta.url),{type:"module"})),x(this,tx).call(this)),x(this,gn).call(this,{type:pt.LOAD,data:t},void 0,n)));Re(this,"exec",(e,t=-1,{signal:n}={})=>x(this,gn).call(this,{type:pt.EXEC,data:{args:e,timeout:t}},void 0,n));Re(this,"ffprobe",(e,t=-1,{signal:n}={})=>x(this,gn).call(this,{type:pt.FFPROBE,data:{args:e,timeout:t}},void 0,n));Re(this,"terminate",()=>{const e=Object.keys(x(this,Ea));for(const t of e)x(this,Ea)[t](Xq),delete x(this,Ea)[t],delete x(this,zo)[t];x(this,Zn)&&(x(this,Zn).terminate(),P(this,Zn,null),this.loaded=!1)});Re(this,"writeFile",(e,t,{signal:n}={})=>{const s=[];return t instanceof Uint8Array&&s.push(t.buffer),x(this,gn).call(this,{type:pt.WRITE_FILE,data:{path:e,data:t}},s,n)});Re(this,"mount",(e,t,n)=>{const s=[];return x(this,gn).call(this,{type:pt.MOUNT,data:{fsType:e,options:t,mountPoint:n}},s)});Re(this,"unmount",e=>{const t=[];return x(this,gn).call(this,{type:pt.UNMOUNT,data:{mountPoint:e}},t)});Re(this,"readFile",(e,t="binary",{signal:n}={})=>x(this,gn).call(this,{type:pt.READ_FILE,data:{path:e,encoding:t}},void 0,n));Re(this,"deleteFile",(e,{signal:t}={})=>x(this,gn).call(this,{type:pt.DELETE_FILE,data:{path:e}},void 0,t));Re(this,"rename",(e,t,{signal:n}={})=>x(this,gn).call(this,{type:pt.RENAME,data:{oldPath:e,newPath:t}},void 0,n));Re(this,"createDir",(e,{signal:t}={})=>x(this,gn).call(this,{type:pt.CREATE_DIR,data:{path:e}},void 0,t));Re(this,"listDir",(e,{signal:t}={})=>x(this,gn).call(this,{type:pt.LIST_DIR,data:{path:e}},void 0,t));Re(this,"deleteDir",(e,{signal:t}={})=>x(this,gn).call(this,{type:pt.DELETE_DIR,data:{path:e}},void 0,t))}on(e,t){e==="log"?x(this,xc).push(t):e==="progress"&&x(this,vc).push(t)}off(e,t){e==="log"?P(this,xc,x(this,xc).filter(n=>n!==t)):e==="progress"&&P(this,vc,x(this,vc).filter(n=>n!==t))}}Zn=new WeakMap,zo=new WeakMap,Ea=new WeakMap,xc=new WeakMap,vc=new WeakMap,tx=new WeakMap,gn=new WeakMap;var HA;(function(r){r.MEMFS="MEMFS",r.NODEFS="NODEFS",r.NODERAWFS="NODERAWFS",r.IDBFS="IDBFS",r.WORKERFS="WORKERFS",r.PROXYFS="PROXYFS"})(HA||(HA={}));const Kq=new Error("failed to get response body reader"),Jq=new Error("failed to complete download"),Zq="Content-Length",Qq=r=>new Promise((e,t)=>
1147{const n=new FileReader;n.onload=()=>{const{result:s}=n;s instanceof ArrayBuffer?e(new Uint8Array(s)):e(new Uint8Array)},n.onerror=s=>{var i,o;t(Error(`File could not be read! Code=${((o=(i=s==null?void 0:s.target)==null?void 0:i.error)==null?void 0:o.code)||-1}`))},n.readAsArrayBuffer(r)}),eW=async r=>{let e;if(typeof r=="string")/data:_data\/([a-zA-Z]*);base64,([^"]*)/.test(r)?e=atob(r.split(",")[1]).split("").map(t=>t.charCodeAt(0)):e=await(await fetch(r)).arrayBuffer();else if(r instanceof URL)e=await(await fetch(r)).arrayBuffer();else if(r instanceof File||r instanceof Blob)e=await Qq(r);else return new Uint8Array;return new Uint8Array(e)},tW=async(r,e)=>{var s;const t=await fetch(r);let n;try{const i=parseInt(t.headers.get(Zq)||"-1"),o=(s=t.body)==null?void 0:s.getReader();if(!o)throw Kq;const l=[];let c=0;for(;;){const{done:h,value:f}=await o.read(),p=f?f.length:0;if(h){if(i!=-1&&i!==c)throw Jq;e&&e({url:r,total:i,received:c,delta:p,done:h});break}l.push(f),c+=p,e&&e({url:r,total:i,received:c,delta:p,done:h})}const u=new Uint8Array(c);let d=0;for(const h of l)u.set(h,d),d+=h.length;n=u.buffer}catch(i){console.log("failed to send download progress event: ",i),n=await t.arrayBuffer()}return n},zA=async(r,e,t=!1,n)=>{const s=t?await tW(r,n):await(await fetch(r)).arrayBuffer(),i=new Blob([s],{type:e});return URL.createObjectURL(i)};let Jw=null,F0=null;async function rW(){return Jw||F0||(F0=(async()=>{const r=new Yq,e=await zA("/ffmpeg-core.js","text/javascript"),t=await zA("/ffmpeg-core.wasm","application/wasm");return await r.load({coreURL:e,wasmURL:t}),Jw=r,r})(),F0)}async function qA(r,e){if(r.type.includes("mp4"))return r;const n=await rW();e&&n.on("progress",({progress:l})=>{e(Math.min(1,Math.max(0,l)))});const s="input.webm",i="output.mp4";await n.writeFile(s,await eW(r)),await n.exec(["-i",s,"-c:v","libx264","-preset","fast","-crf","23","-c:a","aac","-b:a","128k","-movflags","+faststart",i]);const o=await n.readFile(i);return await n.deleteFile(s),await n.deleteFile(i),new Blob([o],{type:"video/mp4"})}function nW(){const[r,e]=k.useState(null),[t,n]=k.useState(""),[s,i]=k.useState(!0),[o,l]=k.useState(!1),[c,u]=k.useState(null),[d,h]=k.useState(null),[f,p]=k.useState("user"),[m,g]=k.useState(!1),[v,b]=k.useState(""),[y,w]=k.useState(""),[_,N]=k.useState(""),[S,E]=k.useState(""),[T,D]=k.useState(""),[R,H]=k.useState(""),[A,U]=k.useState(!1),[C,M]=k.useState(""),[L,B]=k.useState("dca-live"),[I,z]=k.useState("live"),[X,F]=k.useState({active:!1,viewerCount:0,error:null,stream:null,facing:"user",recording:!1,lastRecording:null}),[q,V]=k.useState(!1),[K,ee]=k.useState(""),[Z,ie]=k.useState(!1),[pe,me]=k.useState(!1),[Oe,De]=k.useState(null),[re,fe]=k.useState(!1),[j,oe]=k.useState(0),ne=k.useRef(null),G=k.useRef("");k.useEffect(()=>Mi.subscribe(F),[]),k.useEffect(()=>{X.stream&&ne.current?(ne.current.srcObject=X.stream,ne.current.play().catch(()=>{})):!X.stream&&ne.current&&(ne.current.srcObject=null)},[X.stream]),k.useEffect(()=>{ne.current&&(ne.current.style.transform=X.facing==="user"?"scaleX(-1)":"")},[X.facing]),k.useEffect(()=>{if(!je||!Y){u("Supabase is not configured."),i(!1);return}Y.from("live_stream_settings").select("*").eq("id",1).maybeSingle().then(({data:Se,error:ke})=>{if(ke)u(ke.message);else if(Se){const Le=Se;if(e(Le),n(Le.title),g(Le.overlay_enabled),b(Le.overlay_top_text??""),w(Le.overlay_bottom_text??""),Le.scheduled_at){const Dt=new Date(Le.scheduled_at);N(Dt.toISOString().slice(0,10)),E(Dt.toTimeString().slice(0,5))}D(Le.scheduled_title??""),H(Le.scheduled_description??""),U(Le.red5_enabled),M(Le.red5_host??""),B(Le.red5_stream_name??"dca-live"),z(Le.red5_app_name??"live")}i(!1)});const de=Y.channel("admin_stream_settings").on("postgres_changes",{event:"*",table:"live_stream_settings",schema:"public"},Se=>{const ke=Se.new;if(e(ke),n(ke.title),g(ke.overlay_enabled),b(ke.overlay_top_text??""),w(ke.overlay_bottom_text??""),ke.scheduled_at){const Le=new Date(ke.scheduled_at);N(Le.toISOString().slice(0,10)),E(Le.toTimeString().slice(0,5))}else N(""),E("");D(ke.scheduled_title??""),H(ke.scheduled_description??""),U(ke.red5_enabled),M(ke.red5_host??""),B(ke.red5_stream_name??"dca-live"),z(ke.red5_app_name??"live")}
1147).subscribe();return()=>{Y.removeChannel(de)}},[]),k.useEffect(()=>{Y&&Y.auth.getSession().then(({data:de})=>{var Se;(Se=de.session)!=null&&Se.user&&(G.current=de.session.user.id)})},[]);const W={red5_enabled:A,red5_host:C,red5_stream_name:L,red5_app_name:I},te=async()=>{if(!Y||!r)return;if(l(!0),u(null),h(null),A&&!Mb(W)){u("Red5 Cloud is enabled but the host or stream name is missing. Configure it in the Red5 Cloud section below."),l(!1);return}const de=!r.is_live,Se={is_live:de,title:t||"Live Camera",publisher_id:de?G.current:null,started_at:de?new Date().toISOString():r.started_at,stopped_at:de?r.stopped_at:new Date().toISOString(),updated_at:new Date().toISOString()},{error:ke}=await Y.from("live_stream_settings").update(Se).eq("id",1);if(ke){u(ke.message),l(!1);return}if(e({...r,...Se}),de){q||ce(t||"Dixie County Advocate Live Stream",r.scheduled_description);try{if(Mi.setOverlaySettings({enabled:m,topText:v||null,bottomText:y||null}),A){const Le=C.trim(),Dt=I.trim()||"live",Ut=L.trim()||"dca-live";Mi.setRed5Config(Le,Dt,Ut)}await Mi.start(f),h(A?"Stream is now LIVE via Red5 Cloud — broadcasting to all visitors.":"Stream is now LIVE — broadcasting your camera to all visitors.")}catch{u(X.error||"Failed to start camera.")}}else Mi.stop(),h("Stream has been stopped.");l(!1),setTimeout(()=>h(null),4e3)},he=async()=>{const de=f==="user"?"environment":"user";p(de),await Mi.switchCamera(de)},ge=async de=>{if(!(!je||!Y)){ie(!0),De(null);try{fe(!0),oe(0);const Se=await qA(de.blob,o0=>oe(o0));fe(!1);const ke=`gallery/stream-${Date.now()}.mp4`,Le=new File([Se],"stream-recording.mp4",{type:"video/mp4"}),{error:Dt}=await Y.storage.from("gallery-photos").upload(ke,Le,{upsert:!1});if(Dt){De(Dt.message+" You can use Download to save it to your computer instead.");return}const{data:Ut}=Y.storage.from("gallery-photos").getPublicUrl(ke),Yn=new Date,ma=Yn.getDay();Yn.setDate(Yn.getDate()+(ma===0?-6:1-ma));const Kv=Yn.toISOString().split("T")[0],{error:a0}=await Y.from("gallery_images").insert({url:Ut.publicUrl,title:K.trim()||"Live Stream Recording",media_type:"video",issue_week_start:Kv});if(a0){De(a0.message);return}me(!0),h("Recording saved to This Week's Pics."),setTimeout(()=>h(null),4e3)}catch(Se){De(Se instanceof Error?Se.message:"Upload failed. Please try again.")}finally{ie(!1),fe(!1)}}},ae=async de=>{try{fe(!0),oe(0);let Se,ke;
1147try{Se=await qA(de.blob,Ut=>oe(Ut)),ke="mp4"}catch{Se=de.blob,ke="webm"}fe(!1);const Le=URL.createObjectURL(Se),Dt=document.createElement("a");Dt.href=Le,Dt.download=`live-stream-${new Date(de.startedAt).toISOString().replace(/[:.]/g,"-")}.${ke}`,document.body.appendChild(Dt),Dt.click(),document.body.removeChild(Dt),setTimeout(()=>URL.revokeObjectURL(Le),1e4)}catch(Se){De(Se instanceof Error?Se.message:"Download failed. Please try again."),fe(!1)}},J=async()=>{if(!Y||!r)return;l(!0),u(null),h(null);const{error:de}=await Y.from("live_stream_settings").update({title:t||"Live Camera",updated_at:new Date().toISOString()}).eq("id",1);l(!1),de?u(de.message):(e({...r,title:t}),h("Title saved."),setTimeout(()=>h(null),3e3))},Q=async()=>{if(!Y||!r)return;l(!0),u(null),h(null);const de={overlay_enabled:m,overlay_top_text:v||null,overlay_bottom_text:y||null,updated_at:new Date().toISOString()},{error:Se}=await Y.from("live_stream_settings").update(de).eq("id",1);l(!1),Se?u(Se.message):(e({...r,...de}),Mi.setOverlaySettings({enabled:m,topText:v||null,bottomText:y||null}),h("Overlay settings saved."),setTimeout(()=>h(null),3e3))},se=async()=>{if(!Y||!r)return;l(!0),u(null),h(null);const de={red5_enabled:A,red5_host:C.trim()||null,red5_stream_name:L.trim()||null,red5_app_name:I.trim()||"live",updated_at:new Date().toISOString()},{error:Se}=await Y.from("live_stream_settings").update(de).eq("id",1);l(!1),Se?u(Se.message):(e({...r,...de}),h("Red5 Cloud settings saved."),setTimeout(()=>h(null),3e3))},ue=async()=>{if(!Y||!r)return;l(!0),u(null),h(null);let de=null;if(_&&S){const Le=new Date(`${_}T${S}`);if(isNaN(Le.getTime())){u("Invalid date or time."),l(!1);return}de=Le.toISOString()}const Se={scheduled_at:de,scheduled_title:T.trim()||null,scheduled_description:R.trim()||null,updated_at:new Date().toISOString()},{error:ke}=await Y.from("live_stream_settings").update(Se).eq("id",1);l(!1),ke?u(ke.message):(e({...r,...Se}),h(de?"Live stream scheduled. A banner will appear on the front page.":"Schedule cleared."),setTimeout(()=>h(null),4e3))},Ne=()=>{N(""),E(""),D(""),H("")},ce=async(de,Se)=>{var ke;if(!(!je||!Y))try{const{data:Le}=await Y.auth.getSession(),Dt=(ke=Le.session)==null?void 0:ke.access_token;if(!Dt)return;const Ut=await fetch("https://rdyprhzjnqjauufyfqlp.supabase.co/functions/v1/notify-live-stream-subscribers",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Dt}`,Apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJkeXByaHpqbnFqYXV1ZnlmcWxwIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODAzNDYzMDAsImV4cCI6MjA5NTkyMjMwMH0.zyA_fVB72pAmHui8m1UhJkK-R9yndy6nuLgyzLDvW04"},body:JSON.stringify({title:de,description:Se})}),Yn=await Ut.json().catch(()=>({}));if(!Ut.ok)console.warn("Live stream subscriber notification failed:",Ut.status,Yn);else{const ma=[];Yn.email_sent&&ma.push(`email sent to ${Yn.email_recipients} subscriber(s)`),Yn.sms_sent&&ma.push(`text sent to ${Yn.sms_recipients} subscriber(s)`),ma.length>0&&console.log("Live stream notification result:",ma.join(", "))}}catch(Le){console.warn("Live stream subscriber notification error:",Le)}};if(s)return a.jsx("div",{className:"flex items-center justify-center py-20",children:a.jsx(_e,{className:"w-8 h-8 animate-spin text-brand-red"})});if(!r)return a.jsx("div",{className:"bg-white border border-gray-200 p-6 text-center",children:a.jsx("p",{className:"text-gray-500",children:"Unable to load stream settings."})});const le=r.is_live&&X.active,be=Mb(W);return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:`rounded-2xl p-6 ${le?"bg-red-50 border-2 border-red-200":"bg-gray-50 border-2 border-gray-200"}`,children:[a.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[le?a.jsx("div",{className:"w-12 h-12 rounded-xl bg-red-500 flex items-center justify-center",children:a.jsx(wu,{className:"w-6 h-6 text-white"})}):a.jsx("div",{className:"w-12 h-12 rounded-xl bg-gray-400 flex items-center justify-center",children:a.jsx(D_,{className:"w-6 h-6 text-white"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-gray-900",children:le?"Stream is LIVE":"Stream is Offline"}),a.jsx("p",{className:"text-sm text-gray-500 mt-0.5",children:le?`Broadcasting since ${new Date(r.started_at??Date.now()).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit"})} via ${A?"Red5 Cloud":"direct WebRTC"}`:A?"Red5 Cloud is enabled — viewers connect through the Red5 server.":"The webcam widget is hidden from visitors."})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[!le&&a.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-600 cursor-pointer select-none",title:"Skip sending email/text notifications when going live",children:[a.jsx("input",{type:"checkbox",checked:q,onCh
1147ange:de=>V(de.target.checked),className:"w-4 h-4 rounded border-gray-300 text-brand-red focus:ring-red-200"}),a.jsx("span",{className:"hidden sm:inline",children:"Test mode (no notifications)"}),a.jsx("span",{className:"sm:hidden",children:"No alerts"})]}),le&&a.jsxs("button",{onClick:he,className:"px-3 py-3 bg-white border border-gray-300 rounded-lg font-semibold text-sm text-gray-700 hover:bg-gray-50 transition-colors flex items-center gap-2",title:"Switch camera",children:[a.jsx(DU,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden sm:inline",children:X.facing==="user"?"Front":"Rear"})]}),a.jsxs("button",{onClick:te,disabled:o,className:`px-6 py-3 rounded-lg font-semibold text-sm transition-colors flex items-center gap-2 disabled:opacity-50 ${le?"bg-red-600 text-white hover:bg-red-700":"bg-green-600 text-white hover:bg-green-700"}`,children:[o?a.jsx(_e,{className:"w-4 h-4 animate-spin"}):le?a.jsx(D_,{className:"w-4 h-4"}):a.jsx(vi,{className:"w-4 h-4"}),le?"Stop Stream":"Start Stream"]})]})]}),A&&!be&&a.jsxs("div",{className:"mt-4 flex items-start gap-2 text-sm text-amber-700 bg-amber-100 border border-amber-300 rounded-lg px-4 py-3",children:[a.jsx(Ve,{className:"w-4 h-4 mt-0.5 shrink-0"}),a.jsx("span",{children:"Red5 Cloud is enabled but not fully configured. Enter your host and stream name below before going live."})]}),X.error&&a.jsxs("div",{className:"mt-4 flex items-start gap-2 text-sm text-red-700 bg-red-100 border border-red-300 rounded-lg px-4 py-3",children:[a.jsx(Ve,{className:"w-4 h-4 mt-0.5 shrink-0"}),a.jsx("span",{children:X.error})]})]}),le&&a.jsxs("div",{className:"bg-black rounded-xl overflow-hidden border border-gray-300",children:[a.jsxs("div",{className:"flex items-center gap-2 bg-gray-900 px-4 py-2",children:[a.jsx("span",{className:"w-2 h-2 rounded-full bg-red-500 animate-pulse"}),a.jsx("span",{className:"text-white text-xs font-semibold uppercase tracking-wider",children:"Camera Preview (what viewers see)"})]}),a.jsxs("div",{className:"relative",children:[a.jsx("video",{ref:ne,autoPlay:!0,playsInline:!0,muted:!0,className:"w-full aspect-video object-cover"}),m&&a.jsxs(a.Fragment,{children:[v&&a.jsx("div",{className:"absolute top-0 left-0 right-0 z-10 bg-black/70 backdrop-blur-sm flex items-center justify-center py-1",children:a.jsx("span",{className:"text-white font-semibold uppercase tracking-wide truncate px-3 text-[11px]",children:v})}),y&&a.jsx("div",{className:"absolute bottom-0 left-0 right-0 z-10 bg-black/70 backdrop-blur-sm overflow-hidden py-1",children:a.jsx("div",{className:"ticker-track whitespace-nowrap",style:{animationDuration:"16s"},children:a.jsx("span",{className:"text-white font-semibold text-[11px] px-4",children:y})})})]})]})]}),!le&&X.lastRecording&&a.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-5 shadow-sm",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsx(fU,{className:"w-5 h-5 text-brand-red"}),a.jsx("h3",{className:"font-semibold text-gray-900",children:"Save Stream Recording"})]}),a.jsx("p",{className:"text-sm text-gray-500 mb-4",children:"This recording captured your live broadcast. Save it to This Week's Pics so visitors can watch it on demand."}),a.jsxs("div",{className:"grid sm:grid-cols-[200px_1fr] gap-4 items-start",children:[a.jsx("div",{className:"rounded-lg overflow-hidden bg-black border border-gray-200",children:a.jsx("video",{src:X.lastRecording.url,controls:!0,className:"w-full aspect-video object-contain"})}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Caption"}),a.jsx("input",{type:"text",value:K,onChange:de=>ee(de.target.value),placeholder:"e.g. Live: County Commission Meeting",maxLength:200,className:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-red-200 focus:border-red-400"})]}),a.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[pe?a.jsxs("span",{className:"flex items-center gap-1.5 text-sm font-semibold text-green-600",children:[a.jsx(At,{className:"w-4 h-4"})," Saved to This Week's Pics"]}):a.jsxs("button",{onClick:()=>ge(X.lastRecording),disabled:Z||re,className:"flex items-center gap-2 bg-brand-red hover:bg-brand-red-dark text-white text-sm font-semibold px-4 py-2 rounded-lg transition-colors disabled:opacity-60",children:[Z?a.jsx(_e,{className:"w-4 h-4 animate-spin"}):a.jsx(PU,{className:"w-4 h-4"}),"Save to This Week's Pics"]}),a.jsxs("button",{onClick:()=>ae(X.lastRecording),disabled:Z||re,className:"flex items-center gap-1.5 text-sm font-medium text-blue-600 hover:text-blue-700 transition-colors disabled:opacity-60",children:[re&&!Z?a.jsx(_e,{className:"w-3.5 h-3.5 animate-spin"}):a.jsx(Du,{className:"w-3.5 h-3.5"}),"Download MP4"]}),a.jsxs("button",{onClick:()=>{Mi.clearRecording(),me(!1),ee(""),De(null)},disabled:re||Z,className:"flex items-center gap-1.5 text-sm font-medium text-gray-500 hover:text-red-600 transition-colors disabled:opacity-60",children:[a.jsx(Sn,{className:"w-3.5 h-3.5"}),"Discard"]})]}),re&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[a.jsx(_e,{className:"w-4 h-4 animate-spin text-brand-red"}
1147),a.jsxs("span",{children:["Converting to MP4… ",Math.round(j*100),"%"]})]}),Oe&&a.jsxs("p",{className:"text-sm text-red-600 flex items-center gap-1.5",children:[a.jsx(Ve,{className:"w-4 h-4"})," ",Oe]})]})]})]}),a.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-5 shadow-sm",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsxs("h3",{className:"font-semibold text-gray-900 flex items-center gap-2",children:[a.jsx(S_,{className:"w-4 h-4 text-blue-500"}),"Red5 Cloud Streaming"]}),a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("span",{className:"text-sm text-gray-500",children:"Enable"}),a.jsx("button",{onClick:()=>U(!A),className:`relative w-11 h-6 rounded-full transition-colors ${A?"bg-green-500":"bg-gray-300"}`,children:a.jsx("span",{className:`absolute top-0.5 left-0.5 w-5 h-5 bg-white rounded-full shadow transition-transform ${A?"translate-x-5":""}`})})]})]}),a.jsx("p",{className:"text-sm text-gray-400 mb-4",children:"When enabled, your stream goes through a Red5 Cloud server instead of direct browser-to-browser connections. This allows unlimited viewers with sub-second latency."}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Red5 Cloud Host"}),a.jsx("input",{type:"text",value:C,onChange:de=>M(de.target.value),placeholder:"e.g. my-deployment.cloud.red5.net",disabled:!A,className:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-200 focus:border-blue-400 disabled:bg-gray-50 disabled:text-gray-400"}),a.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"The hostname from your Red5 Cloud dashboard (no https:// needed)."})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Stream Name"}),a.jsx("input",{type:"text",value:L,onChange:de=>B(de.target.value),placeholder:"dca-live",disabled:!A,className:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-200 focus:border-blue-400 disabled:bg-gray-50 disabled:text-gray-400"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:"App Name"}),a.jsx("input",{type:"text",value:I,onChange:de=>z(de.target.value),placeholder:"live",disabled:!A,className:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-200 focus:border-blue-400 disabled:bg-gray-50 disabled:text-gray-400"})]})]}),A&&be&&a.jsxs("div",{className:"flex items-start gap-2 text-sm text-green-700 bg-green-50 border border-green-200 rounded-lg px-3 py-2.5",children:[a.jsx(At,{className:"w-4 h-4 mt-0.5 shrink-0"}),a.jsxs("span",{children:["Red5 Cloud is configured. The stream will publish to ",a.jsx("strong",{children:C})," and viewers will connect through the Red5 server."]})]}),a.jsxs("button",{onClick:se,disabled:o,className:"px-4 py-2 bg-gray-900 text-white rounded-lg text-sm font-semibold hover:bg-gray-800 transition-colors flex items-center gap-2 disabled:opacity-50",children:[a.jsx(vn,{className:"w-4 h-4"}),"Save Red5 Settings"]})]})]}),a.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-5 shadow-sm",children:[a.jsx("h3",{className:"font-semibold text-gray-900 mb-1",children:"Stream Title"}),a.jsx("p",{className:"text-sm text-gray-400 mb-4",children:"This label appears on the live widget and in fullscreen mode."}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{type:"text",value:t,onChange:de=>n(de.target.value),placeholder:"Live Camera",className:"flex-1 px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-red-200 focus:border-red-400"}),a.jsxs("button",{onClick:J,disabled:o||t===r.title,className:"px-4 py-2 bg-gray-900 text-white rounded-lg text-sm font-semibold hover:bg-gray-800 transition-colors flex items-center gap-2 disabled:opacity-50",children:[a.jsx(vn,{className:"w-4 h-4"}),"Save"]})]})]}),a.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-5 shadow-sm",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsxs("h3",{className:"font-semibold text-gray-900 flex items-center gap-2",children:[a.jsx(RU,{className:"w-4 h-4 text-gray-500"}),"Text Overlays"]}),a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("span",{className:"text-sm text-gray-500",children:"Enable"}),a.jsx("button",{onClick:()=>g(!m),className:`relative w-11 h-6 rounded-full transition-colors ${m?"bg-green-500":"bg-gray-300"}`,children:a.jsx("span",{className:`absolute top-0.5 left-0.5 w-
11475 h-5 bg-white rounded-full shadow transition-transform ${m?"translate-x-5":""}`})})]})]}),a.jsx("p",{className:"text-sm text-gray-400 mb-4",children:"Add a static banner at the top and/or a scrolling ticker at the bottom of the live video."}),a.jsxs("div",{className:"space-y-4",children:[m&&(v||y)&&a.jsxs("div",{className:"rounded-lg overflow-hidden bg-black border border-gray-200 relative aspect-video",children:[a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsx(vi,{className:"w-12 h-12 text-gray-700"})}),v&&a.jsx("div",{className:"absolute top-0 left-0 right-0 z-10 bg-black/70 backdrop-blur-sm flex items-center justify-center py-1.5",children:a.jsx("span",{className:"text-white font-semibold uppercase tracking-wide truncate px-3 text-sm",children:v})}),y&&a.jsx("div",{className:"absolute bottom-0 left-0 right-0 z-10 bg-black/70 backdrop-blur-sm overflow-hidden py-1.5",children:a.jsx("div",{className:"ticker-track whitespace-nowrap",style:{animationDuration:"16s"},children:a.jsx("span",{className:"text-white font-semibold text-sm px-8",children:y})})})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"flex items-center gap-1.5 text-sm font-medium text-gray-700 mb-1.5",children:[a.jsx(nU,{className:"w-3.5 h-3.5 text-gray-400"}),"Top Banner (static)"]}),a.jsx("input",{type:"text",value:v,onChange:de=>b(de.target.value),placeholder:"e.g. Dixie County Advocate — Live",maxLength:120,className:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-red-200 focus:border-red-400 disabled:bg-gray-50 disabled:text-gray-400",disabled:!m})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"flex items-center gap-1.5 text-sm font-medium text-gray-700 mb-1.5",children:[a.jsx(tU,{className:"w-3.5 h-3.5 text-gray-400"}),"Bottom Ticker (scrolling)"]}),a.jsx("input",{type:"text",value:y,onChange:de=>w(de.target.value),placeholder:"e.g. Breaking: Local event underway at the courthouse...",maxLength:200,className:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-red-200 focus:border-red-400 disabled:bg-gray-50 disabled:text-gray-400",disabled:!m})]}),a.jsxs("button",{onClick:Q,disabled:o||m===r.overlay_enabled&&v===(r.overlay_top_text??"")&&y===(r.overlay_bottom_text??""),className:"px-4 py-2 bg-gray-900 text-white rounded-lg text-sm font-semibold hover:bg-gray-800 transition-colors flex items-center gap-2 disabled:opacity-50",children:[a.jsx(vn,{className:"w-4 h-4"}),"Save Overlays"]})]})]}),a.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-5 shadow-sm",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsxs("h3",{className:"font-semibold text-gray-900 flex items-center gap-2",children:[a.jsx(jb,{className:"w-4 h-4 text-gray-500"}),"Schedule a Live Stream"]}),(_||S||T||R)&&a.jsxs("button",{onClick:Ne,className:"flex items-center gap-1.5 text-sm text-gray-500 hover:text-red-600 transition-colors",children:[a.jsx(iU,{className:"w-3.5 h-3.5"}),"Clear"]})]}),a.jsx("p",{className:"text-sm text-gray-400 mb-4",children:"Pick a date and time for a future broadcast. A banner will appear on the front page telling visitors when to tune in."}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Date"}),a.jsx("input",{type:"date",value:_,onChange:de=>N(de.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-red-200 focus:border-red-400"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Time"}),a.jsx("input",{type:"time",value:S,onChange:de=>E(de.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-red-200 focus:border-red-400"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Stream Title"}),a.jsx("input",{type:"text",value:T,onChange:de=>D(de.target.value),placeholder:"e.g. County Commission Meeting — Live Coverage",maxLength:120,className:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-red-200 focus:border-red-400"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Description (optional)"}),a.jsx("textarea",{value:R,onChange:de=>H(de.target.value),placeholder:"Tell viewers what to expect during the broadcast…",maxLength:300,rows:2,className:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-red-200 focus:border-red-400 resize-none"})]}),_&&S&&a.jsxs("div",{className:"flex items-start gap-2 text-sm text-blue-800 bg-blue-50 border border-blue-200 rounded-lg px-3 py-2.5",children:[a.jsx(yU,{className:"w-4 h-4 mt-0.5 shrink-0"}),a.jsxs("span",{children:["Banner will show: ",a.jsx("strong",{children:"Dixie County Advocate Exclusive Live Stream"}),T&&a.jsxs(a.Fragment,{children:[" — ",T]})," on"," ",a.jsx("strong",{children:new Date(`${_}T${S}`).toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric"})})," at"," ",a.jsx("strong",{children:new Date(`${_}T${S}`).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit"})})]})]}),a.jsxs("button",{onClick:ue,disabled:o,className:"px-4 py-2 bg-gray-900 text-white rounded-lg text-sm font-semibold hover:bg-gray-800 transition-colors flex items-center gap-2 disabled:opacity-50",children:[a.jsx(vn,{className:"w-4 h-4"}),_&&S?"Save Schedule":"Clear Schedule"]})]})]}),a.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-xl p-5",children:[a.jsx("h3",{className:"font-semibold text-blue-900 mb-2",children:"How broadcasting works"}),a.jsxs("ul",{className:"text-sm text-blue-800 space-y-1.5",children:[a.jsxs("li",{children:["• Click ",a.jsx("strong",{children:"Start Stream"})," to begin broadcasting. Your browser will ask for camera and microphone access."]}),a.jsxs("li",{children:["• Use the ",a.jsx("strong",{children:"Front/Rear"})," button to switch cameras — works on iPhone, Android, and multi-camera devices."]}),a.jsx("li",{children:"• A live preview shows exactly what viewers will see."}),a.jsxs("li",{children:["• Enable ",a.jsx("strong",{children:"Text Overlays"})," to show a static top banner and/or scrolling bottom ticker over the video."]}),A?a.jsxs("li",{children:["• With ",a.jsx("strong",{children:"Red5 Cloud"})," enabled, your video goes through a Red5 server that redistributes it to unlimited viewers with sub-second latency."]}):a.jsx("li",{children:"• Each visitor's browser connects directly to yours via WebRTC — the video feed goes peer-to-peer, not through a server."}),a.jsx("li",{children:"• Your camera keeps broadcasting even if you navigate to another admin tab or leave this page — as long as the browser tab stays open."}),a.jsxs("li",{children:["• Click ",a.jsx("strong",{children:"Stop Stream"})," to end the broadcast and hide the widget from all visitors."]})]})]}),c&&a.jsx("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 z-[200] bg-red-600 text-white text-sm px-5 py-3 rounded-full shadow-lg",children:c}),d&&a.jsx("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 z-[200] bg-green-600 text-white text-sm px-5 py-3 rounded-full shadow-lg",children:d})]})}const sW={name:"",birth_date:null,death_date:null,body:"",photo_url:null,photo_focal_point:null,is_published:!1};function iW(){var A,U;const[r,e]=k.useState([]),[t,n]=k.useState(!0),[s,i]=k.useState(""),[o,l]=k.useState(null),[c,u]=k.useState(!1),[d,h]=k.useState(null),[f,p]=k.useState(null),[m,g]=k.useState(""),[v,b]=k.useState(!1),[y,w]=k.useState(0),[_,N]=k.useState(!1),S=k.useRef(null),E=k.useCallback(()=>{n(!0),i(""),fH().then(e).catch(C=>i(C.message??"Failed to load obituaries.")).finally(()=>n(!1))},[]);k.useEffect(()=>{E()},[E]);async function T(){if(!o)return;u(!0),g("");const{error:C}=await pH(o);if(u(!1),C){g(C);return}N(!1),l(null),E()}async function D(C){h(C),p(null),await mH(C),e(M=>M.filter(L=>L.id!==C)),h(null)}async function R(C){var L;const M=(L=C.target.files)==null?void 0:L[0];if(!(!M||!o)){b(!0),w(0);try{const B=await RR(M,w);l(I=>I&&{...I,photo_url:B})}catch(B){g(B instanceof Error?B.message:"Upload failed.")}finally{b(!1),S.current&&(S.current.value="")}}}const H=r.filter(C=>C.is_published).length;return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-9 h-9 bg-brand-red rounded-full flex items-center justify-center",children:a.jsx(jl,{className:"w-5 h-5 text-white"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"font-headline text-2xl font-bold text-gray-900",children:"Obituaries"}),a.jsxs("p",{className:"font-body text-xs text-gray-500",children:[H," published · ",r.length-H," drafts"]})]})]}),!o&&a.jsxs("button",{onClick:()=>{l({...sW}),g(""),N(!1)},className:"inline-flex items-center gap-2 bg-brand-red hover:bg-brand-red-dark text-white font-body font-semibold text-sm px-4 py-2.5 rounded-lg transition",children:[a.jsx(j_,{className:"w-4 h-4"}),"New Obituary"]})]}),s&&a.jsxs("div",{className:"flex items-start gap-2.5 bg-red-50 border border-red-200 rounded-lg px-4 py-3 text-sm text-red-700 mb-5",children:[a.jsx(Ve,{className:"w-4 h-4 mt-0.5 shrink-0"}),a.jsx("span",{children:s})]}),o&&a.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl mb-6 overflow-hidden",children:[a.jsxs("div",{className:"bg-gray-50 border-b border-gray-200 px-5 py-3 flex items-center justify-between",children:[a.jsx("h2",{className:"font-headline font-bold text-gray-900 text-base",children:o.id?"Edit Obituary":"New Obituary"}),a.jsx("button",{onClick:()=>{l(null),N(!1)},className:"text-gray-400 hover:text-gray-700 transition",children:a.jsx(tt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-5 space-y-4",children:[m&&a.jsxs("div",{className:"flex items-start gap-2 bg-red-50 border border-red-200 rounded px-3 py-2 text-sm text-red-700",children:[a.jsx(Ve,{className:"w-4 h-4 mt-0.5 shrink-0"}),m]}),a.jsxs("div",{className:"flex gap-5",children:[a.jsxs("div",{className:"flex-shrink-0",children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-2 uppercase tracking-wider font-body",children:"Photo"}),a.jsx("div",{className:"w-28 h-32 border-2 border-dashed border-gray-300 rounded-lg overflow-hidden flex items-center justify-center bg-gray-50 relative",children:o.photo_url?a.jsxs(a.Fragment,{children:[a.jsx("img",{src:o.photo_url,alt:"Deceased",className:"w-full h-full object-cover",style:o.photo_focal_point?{objectPosition:`${o.photo_focal_point.x}% ${o.photo_focal_point.y}%`}:void 0}),o.photo_focal_point&&a.jsx("div",{className:"absolute pointer-events-none",style:{left:`${o.photo_focal_point.x}%`,top:`${o.photo_focal_point.y}%`,transform:"translate(-50%, -50%)"},children:a.jsx("div",{className:"w-5 h-5 rounded-full border-2 border-white shadow-md flex items-center justify-center",children:a.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-white"})})}),a.jsx("button",{type:"button",onClick:()=>l(C=>C&&{...C,photo_url:null,photo_focal_point:null}),className:"absolute top-1 right-1 bg-black/60 text-white rounded-full p-0.5 hover:bg-black/80 transition",children:a.jsx(tt,{className:"w-3 h-3"})})]}):v?a.jsxs("div",{className:"flex flex-col items-center gap-1",children:[a.jsx(_e,{className:"w-5 h-5 animate-spin text-brand-red"}),a.jsxs("span",{className:"text-xs text-gray-400 font-body",children:[y,"%"]})]}):a.jsxs("button",{type:"button",onClick:()=>{var C;return(C=S.current)==null?void 0:C.click()},className:"flex flex-col items-center gap-1 text-gray-400 hover:text-brand-red transition",children:[a.jsx(qx,{className:"w-6 h-6"}),a.jsx("span",{className:"text-xs font-body",children:"Upload"})]})}),!v&&!o.photo_url&&a.jsxs("button",{type:"button",onClick:()=>{var C;return(C=S.current)==null?void 0:C.click()},className:"mt-2 w-28 flex items-center justify-center gap-1 text-xs font-body font-semibold text-gray-600 hover:text-brand-red border border-gray-200 rounded px-2 py-1.5 transition",children:[a.jsx(Fn,{className:"w-3 h-3"})," Choose"]}),o.photo_url&&!v&&a.jsxs("button",{type:"button",onClick:()=>N(!0),className:`mt-2 w-28 flex items-center justify-center gap-1 text-xs font-body font-semibold border rounded px-2 py-1.5 transition ${o.photo_focal_point?"bg-brand-red/10 text-brand-red border-brand-red/30 hover:bg-brand-red/20":"text-gray-600 hover:text-brand-red border-gray-200 hover:border-brand-red/40"}`,children:[a.jsx(_R,{className:"w-3 h-3"}),o.photo_focal_point?"Edit Focal Point":"Set Focal Point"]}),a.jsx("input",{ref:S,type:"file",accept:"image/jpeg,image/png,image/webp",className:"hidden",onChange:R})]}),a.jsxs("div",{className:"flex-1 space-y-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:"Full Name *"}),a.jsx("input",{type:"text",required:!0,value:o.name??"",onChange:C=>l(M=>M&&{...M,name:C.target.value}),className:"w-full border border-gray-300 rounded px-3 py-2 text-sm font-body focus:outline-none focus:border-brand-red"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:"Date of Birth"}),a.jsx("input",{type:"date",value:o.birth_date??"",onChange:C=>l(M=>M&&{...M,birth_date:C.target.value||null}),className:"w-full border border-gray-300 rounded px-3 py-2 text-sm font-body focus:outline-none focus:border-brand-red"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:"Date of Passing"}),a.jsx("input",{type:"date",value:o.death_date??"",onChange:C=>l(M=>M&&{...M,death_date:C.target.value||null}),className:"w-full border border-gray-300 rounded px-3 py-2 text-sm font-body focus:outline-none focus:border-brand-red"})]})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:"Obituary Text *"}),a.jsx("textarea",{required:!0,rows:8,value:o.body??"",onChange:C=>l(M=>M&&{...M,body:C.target.value}),placeholder:"Enter the full obituary text here...",className:"w-full border border-gray-300 rounded px-3 py-2 text-sm font-body focus:outline-none focus:border-brand-red resize-y"})]}),a.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-gray-100",children:[a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:o.is_published??!1,onChange:C=>l(M=>M&&{...M,is_published:C.target.checked}),className:"w-4 h-4 rounded border-gray-300 text-brand-red accent-brand-red"}),a.jsx("span",{className:"font-body text-sm font-semibold text-gray-700",children:"Publish on website"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{type:"button",onClick:()=>{l(null),N(!1)},className:"font-body text-sm font-semibold text-gray-600 border border-gray-200 rounded-lg px-4 py-2 hover:bg-gray-50 transition",children:"Cancel"}),a.jsxs("button",{type:"button",onClick:T,disabled:c||!((A=o.name)!=null&&A.trim())||!((U=o.body)!=null&&U.trim()),className:"inline-flex items-center gap-2 bg-brand-red hover:bg-brand-red-dark disabled:opacity-50 text-white font-body font-semibold text-sm px-5 py-2 rounded-lg transition",children:[c?a.jsx(_e,{className:"w-4 h-4 animate-spin"}):a.jsx(vn,{className:"w-4 h-4"}),c?"Saving…":"Save"]})]})]})]})]}
1147),(o==null?void 0:o.photo_url)&&a.jsx(JR,{isOpen:_,imageUrl:o.photo_url,initialFocalPoint:o.photo_focal_point?o.photo_focal_point:{x:50,y:50,aspectRatio:"3/4"},onSave:C=>{l(M=>M&&{...M,photo_focal_point:C}),N(!1)},onClose:()=>N(!1)}),t?a.jsx("div",{className:"flex items-center justify-center h-48",children:a.jsx(_e,{className:"w-7 h-7 animate-spin text-brand-red"})}):r.length===0?a.jsxs("div",{className:"bg-white border border-dashed border-gray-300 rounded-xl flex flex-col items-center justify-center py-16 px-4 text-center",children:[a.jsx(jl,{className:"w-12 h-12 text-gray-300 mb-3"}),a.jsx("p",{className:"font-headline text-lg text-gray-500",children:"No obituaries yet"}),a.jsx("p",{className:"font-body text-sm text-gray-400 mt-1",children:"Add the first obituary above."})]}):a.jsx("div",{className:"bg-white border border-gray-200 rounded-xl overflow-hidden",children:a.jsxs("table",{className:"w-full text-left",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-gray-100 bg-gray-50",children:[a.jsx("th",{className:"font-body text-xs font-semibold text-gray-500 uppercase tracking-wider px-5 py-3",children:"Name"}),a.jsx("th",{className:"font-body text-xs font-semibold text-gray-500 uppercase tracking-wider px-3 py-3 hidden sm:table-cell",children:"Dates"}),a.jsx("th",{className:"font-body text-xs font-semibold text-gray-500 uppercase tracking-wider px-3 py-3",children:"Status"}),a.jsx("th",{className:"font-body text-xs font-semibold text-gray-500 uppercase tracking-wider px-3 py-3 text-right",children:"Actions"})]})}),a.jsx("tbody",{className:"divide-y divide-gray-100",children:r.map(C=>a.jsxs("tr",{className:"hover:bg-gray-50 transition-colors",children:[a.jsx("td",{className:"px-5 py-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[C.photo_url?a.jsx("img",{src:C.photo_url,alt:C.name,className:"w-10 h-10 rounded-full object-cover border border-gray-200 flex-shrink-0"}):a.jsx("div",{className:"w-10 h-10 rounded-full bg-gray-100 flex items-center justify-center flex-shrink-0",children:a.jsx(jl,{className:"w-4 h-4 text-gray-300"})}),a.jsx("p",{className:"font-body text-sm font-semibold text-gray-900",children:C.name})]})}),a.jsx("td",{className:"px-3 py-4 hidden sm:table-cell",children:a.jsxs("span",{className:"font-body text-xs text-gray-500",children:[C.birth_date&&C.birth_date.slice(0,4),C.birth_date&&C.death_date&&" – ",C.death_date&&C.death_date.slice(0,4)]})}),a.jsx("td",{className:"px-3 py-4",children:C.is_published?a.jsxs("span",{className:"inline-flex items-center gap-1 text-green-700 bg-green-50 text-xs font-semibold px-2 py-0.5 rounded-full font-body",children:[a.jsx(At,{className:"w-3 h-3"})," Published"]}):a.jsxs("span",{className:"inline-flex items-center gap-1 text-amber-700 bg-amber-50 text-xs font-semibold px-2 py-0.5 rounded-full font-body",children:[a.jsx(MU,{className:"w-3 h-3"})," Draft"]})}),a.jsx("td",{className:"px-3 py-4",children:a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("button",{onClick:()=>{l({...C}),g(""),N(!1)},className:"inline-flex items-center gap-1 font-body text-xs font-semibold text-gray-600 hover:text-brand-red bg-gray-100 hover:bg-red-50 px-2.5 py-1.5 rounded-lg transition",children:"Edit"}),f===C.id?a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>D(C.id),disabled:d===C.id,className:"font-body text-xs font-semibold text-white bg-brand-red hover:bg-brand-red-dark px-2.5 py-1.5 rounded-lg transition disabled:opacity-60",children:d===C.id?a.jsx(_e,{className:"w-3.5 h-3.5 animate-spin"}):"Delete"}),a.jsx("button",{onClick:()=>p(null),className:"font-body text-xs font-semibold text-gray-600 bg-gray-100 hover:bg-gray-200 px-2.5 py-1.5 rounded-lg transition",children:"Cancel"})]}):a.jsx("button",{onClick:()=>p(C.id),className:"inline-flex items-center gap-1 font-body text-xs font-semibold text-gray-500 hover:text-brand-red bg-gray-100 hover:bg-red-50 px-2.5 py-1.5 rounded-lg transition",children:a.jsx(Sn,{className:"w-3.5 h-3.5"})})]})})]},C.id))})]})})]})}const WA=["Dixie County Bears","Trenton Tigers","Bell Bulldogs"],aW={"Dixie County Bears":"bg-red-700 text-white","Trenton Tigers":"bg-orange-600 text-white","Bell Bulldogs":"bg-purple-700 text-white"},oW={"Dixie County Bears":"bg-red-700","Trenton Tigers":"bg-orange-600","Bell Bulldogs":"bg-purple-700"},lW=["Baseball","Softball","Football","Football (7-on-7)","Basketball","Volleyball","S
1147occer","Golf","Tennis","Track & Field","Cross Country","Wrestling","Swimming"],cW={school:"Dixie County Bears",date_label:"",sport:"",opponent:"",location:"Home",game_time:"",game_date:null,sort_order:0,team_score:null,opponent_score:null};function uW(){var S,E,T,D;const[r,e]=k.useState([]),[t,n]=k.useState(!0),[s,i]=k.useState(""),[o,l]=k.useState(null),[c,u]=k.useState(!1),[d,h]=k.useState(null),[f,p]=k.useState(null),[m,g]=k.useState(""),v=k.useCallback(()=>{n(!0),i(""),Gx().then(e).catch(R=>i(R.message??"Failed to load games.")).finally(()=>n(!1))},[]);k.useEffect(()=>{v()},[v]);async function b(){if(!o)return;u(!0),g("");const{error:R}=await yH({...o,sort_order:o.sort_order??r.length});if(u(!1),R){g(R);return}l(null),v()}async function y(R){h(R),p(null),await bH(R),e(H=>H.filter(A=>A.id!==R)),h(null)}function w(){l({...cW,sort_order:r.length}),g("")}function _(R){l({...R}),g("")}const N=WA.map(R=>({school:R,games:r.filter(H=>H.school===R)}));return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-9 h-9 bg-brand-red rounded-full flex items-center justify-center",children:a.jsx(_u,{className:"w-5 h-5 text-white"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"font-headline text-2xl font-bold text-gray-900",children:"Upcoming Games"}),a.jsxs("p",{className:"font-body text-xs text-gray-500",children:[r.length," games scheduled"]})]})]}),!o&&a.jsxs("button",{onClick:w,className:"inline-flex items-center gap-2 bg-brand-red hover:bg-brand-red-dark text-white font-body font-semibold text-sm px-4 py-2.5 rounded-lg transition",children:[a.jsx(j_,{className:"w-4 h-4"}),"Add Game"]})]}),s&&a.jsxs("div",{className:"flex items-start gap-2.5 bg-red-50 border border-red-200 rounded-lg px-4 py-3 text-sm text-red-700 mb-5",children:[a.jsx(Ve,{className:"w-4 h-4 mt-0.5 shrink-0"}),a.jsx("span",{children:s})]}),o&&a.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl mb-6 overflow-hidden",children:[a.jsxs("div",{className:"bg-gray-50 border-b border-gray-200 px-5 py-3 flex items-center justify-between",children:[a.jsx("h2",{className:"font-headline font-bold text-gray-900 text-base",children:o.id?"Edit Game":"Add Game"}),a.jsx("button",{onClick:()=>l(null),className:"text-gray-400 hover:text-gray-700 transition",children:a.jsx(tt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-5 space-y-4",children:[m&&a.jsxs("div",{className:"flex items-start gap-2 bg-red-50 border border-red-200 rounded px-3 py-2 text-sm text-red-700",children:[a.jsx(Ve,{className:"w-4 h-4 mt-0.5 shrink-0"}),m]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"sm:col-span-2",children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:"School *"}),a.jsx("div",{className:"flex flex-wrap gap-3",children:WA.map(R=>a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"radio",name:"school",value:R,checked:o.school===R,onChange:()=>l(H=>H&&{...H,school:R}),className:"accent-brand-red"}),a.jsx("span",{className:`font-body text-sm font-semibold px-2.5 py-0.5 rounded-full ${aW[R]}`,children:R})]},R))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:"Display Date *"}),a.jsx("input",{type:"text",required:!0,placeholder:"e.g. June 6",value:o.date_label??"",onChange:R=>l(H=>H&&{...H,date_label:R.target.value}),className:"w-full border border-gray-300 rounded px-3 py-2 text-sm font-body focus:outline-none focus:border-brand-red"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:"Calendar Date *"}),a.jsx("input",{type:"date",required:!0,value:o.game_date??"",onChange:R=>l(H=>H&&{...H,game_date:R.target.value||null}),className:"w-full border border-gray-300 rounded px-3 py-2 text-sm font-body focus:outline-none focus:border-brand-red"}),a.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Used to sort games in chronological order."})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:"Sport *"}),a.jsx("input",{type:"text",required:!0,list:"sport-options",placeholder:"Baseball, Football…",value:o.sport??"",onChange:R=>l(H=>H&&{...H,sport:R.target.value}),className:"w-full border border-gray-300 rounded px-3 py-2 text-sm font-body focus:outline-none focus:border-brand-red"}),a.jsx("datalist",{id:"sport-options",children:lW.map(R=>a.jsx("option",{value:R},R))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:"Opponent *"}),a.jsx("input",{type:"text",required:!0,value:o.opponent??"",onChange:R=>l(H=>H&&{...H,opponent:R.target.value}),className:"w-full border border-gray-300 rounded px-3 py-2 text-sm font-body focus:outline-none focus:border-brand-red"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:"Time *"}),a.jsx("input",{type:"text",required:!0,placeholder:"e.g. 6:00 PM",value:o.game_time??"",onChange:R=>l(H=>H&&{...H,game_time:R.target.value}),className:"w-full border border-gray-300 rounded px-3 py-2 text-sm font-body focus:outline-none focus:border-brand-red"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:"Location *"}),a.jsx("div",{className:"flex gap-3",children:["Home","Away"].map(R=>a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"radio",name:"location",value:R,checked:o.location===R,onChange:()=>l(H=>H&&{...H,location:R}),className:"accent-brand-red"}),a.jsx("span",{className:"font-body text-sm text-gray-700",children:R})]},R))})]}),a.jsxs("div",{className:"sm:col-span-2 border-t border-gray-100 pt-4",children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-2 uppercase tracking-wider font-body",children:"Final Score (leave blank if game hasn't been played)"}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm font-semibold text-gray-700",children:o.school??"Team"}),a.jsx("input",{type:"number",min:0,placeholder:"—",value:o.team_score??"",onChange:R=>l(H=>H&&{...H,team_score:R.target.value===""?null:parseInt(R.target.value)}),className:"w-20 border border-gray-300 rounded px-3 py-2 text-sm font-body text-center tabular-nums focus:outline-none focus:border-brand-red"})]}),a.jsx("span",{className:"text-gray-400 font-bold",children:"vs"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"number",min:0,placeholder:"—",value:o.opponent_score??"",onChange:R=>l(H=>H&&{...H,opponent_score:R.target.value===""?null:parseInt(R.target.value)}),className:"w-20 border border-gray-300 rounded px-3 py-2 text-sm font-body text-center tabular-nums focus:outline-none focus:border-brand-red"}),a.jsx("span",{className:"text-sm font-semibold text-gray-700",children:o.opponent||"Opponent"})]})]})]})]}),a.jsxs("div",{className:"flex items-center justify-end gap-2 pt-2 border-t border-gray-100",children:[a.jsx("button",{type:"button",onClick:()=>l(null),className:"font-body text-sm font-semibold text-gray-600 border border-gray-200 rounded-lg px-4 py-2 hover:bg-gray-50 transition",children:"Cancel"}),a.jsxs("button",{type:"button",onClick:b,disabled:c||!((S=o.date_label)!=null&&S.trim())||!((E=o.sport)!=null&&E.trim())||!((T=o.opponent)!=null&&T.trim())||!((D=o.game_time)!=null&&D.trim()),className:"inline-flex items-center gap-2 bg-brand-red hover:bg-brand-red-dark disabled:opacity-50 text-white font-body font-semibold text-sm px-5 py-2 rounded-lg transition",children:[c?a.jsx(_e,{className:"w-4 h-4 animate-spin"}):a.jsx(vn,{className:"w-4 h-4"}),c?"Saving…":"Save Game"]})]})]})]}),t?a.jsx("div",{className:"flex items-center justify-center h-48",children:a.jsx(_e,{className:"w-7 h-7 animate-spin text-brand-red"})}):r.length===0?a.jsxs("div",{className:"bg-white border border-dashed border-gray-300 rounded-xl flex flex-col items-center justify-center py-16 px-4 text-center",children:[a.jsx(_u,{className:"w-12 h-12 text-gray-300 mb-3"}),a.jsx("p",{className:"font-headline text-lg text-gray-500",children:"No games scheduled"}),a.jsx("p",{className:"font-body text-sm text-gray-400 mt-1 mb-4",children:"Add upcoming games to display on the Sports page."}),a.jsxs("button",{onClick:w,className:"inline-flex items-center gap-2 bg-brand-red text-white font-body font-semibold text-sm px-4 py-2 rounded-lg hover:bg-brand-red-dark transition",children:[a.jsx(j_,{className:"w-4 h-4"}),"Add First Game"]})]}):a.jsx("div",{className:"space-y-6",children:N.map(({school:R,games:H})=>a.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl overflow-hidden",children:[a.jsxs("div",{className:`${oW[R]} px-5 py-3 flex items-center justify-between`,children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(_u,{className:"w-4 h-4 text-white opacity-80"}),a.jsx("h3",{className:"font-headline font-bold text-white text-base",children:R})]}),a.jsxs("span",{className:"font-body text-xs text-white opacity-75 font-semibold",children:[H.length," ",H.length===1?"game":"games"]})]}),H.length===0?a.jsx("div",{className:"px-5 py-6 text-center",children:a.jsx("p",{className:"font-body text-sm text-gray-400",children:"No games scheduled for this school."})}):a.jsxs("table",{className:"w-full text-left",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-gray-100 bg-gray-50",children:[a.jsx("th",{className:"font-body text-xs font-semibold text-gray-500 uppercase tracking-wider px-4 py-3",children:"Date"}),a.jsx("th",{className:"font-body text-xs font-semibold text-gray-500 uppercase tracking-wider px-3 py-3",children:"Sport"}),a.jsx("th",{className:"font-body text-xs font-semibold text-gray-500 uppercase tracking-wider px-3 py-3",children:"Opponent"}),a.jsx("th",{className:"font-body text-xs font-semibold text-gray-500 uppercase tracking-wider px-3 py-3 hidden sm:table-cell",children:"Location"}),a.jsx("th",{className:"font-body text-xs font-semibold text-gray-500 uppercase tracking-wider px-3 py-3 hidden sm:table-cell",children:"Time"}),a.jsx("th",{className:"font-body text-xs font-semibold text-gray-500 uppercase tracking-wider px-3 py-3 text-center",children:"Score"}),a.jsx("th",{className:"font-body text-xs font-semibold text-gray-500 uppercase tracking-wider px-3 py-3 text-right",children:"Actions"})]})}),a.jsx("tbody",{className:"divide-y divide-gray-100",children:H.map(A=>{const U=A.team_score!==null&&A.team_score!==void 0&&A.opponent_score!==null&&A.opponent_score!==void 0,C=U&&A.team_score>A.opponent_score,M=U&&A.team_score<A.opponent_score;return U&&(A.team_score,A.opponent_score),a.jsxs("tr",{className:`transition-colors ${U?C?"bg-green-50":M?"bg-red-50":"bg-gray-50":"hover:bg-gray-50"}`,children:[a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:"font-body text-sm font-semibold text-brand-red",children:A.date_label})}),a.jsx("td",{className:"px-3 py-3",children:a.jsx("span",{className:"font-body text-sm text-gray-700",children:A.sport})}),a.jsx("td",{className:"px-3 py-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-body text-sm font-medium text-gray-900",children:A.opponent}),U&&a.jsx("span",{className:`text-xs font-bold uppercase tracking-wider px-2 py-0.5 rounded-full ${C?"text-green-700 bg-green-200":M?"text-red-700 bg-red-200":"text-gray-600 bg-gray-200"}`,children:C?"WIN":M?"LOSS":"TIE"})]})}),a.jsx("td",{className:"px-3 py-3 hidden sm:table-cell",children:a.jsx("span",{className:`text-xs font-bold px-2 py-0.5 rounded font-body ${A.location==="Home"?"bg-brand-red text-white":"bg-gray-200 text-gray-700"}`,children:A.location})}),a.jsx("td",{className:"px-3 py-3 hidden sm:table-cell",children:a.jsx("span",{className:"font-body text-sm text-gray-500",children:U?"Final":A.game_time})}),a.jsx("td",{className:"px-3 py-3 text-center",children:U?a.jsxs("span",{className:`font-bold tabular-nums text-base ${C?"text-green-700":M?"text-red-700":"text-gray-700"}`,children:[A.team_score," – ",A.opponent_score]}):a.jsx("span",{className:"text-gray-300",children:"—"})}),a.jsx("td",{className:"px-3 py-3",children:a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("button",{onClick:()=>_(A),className:"inline-flex items-center gap-1 font-body text-xs font-semibold text-gray-600 hover:text-brand-red bg-gray-100 hover:bg-red-50 px-2.5 py-1.5 rounded-lg transition",children:"Edit"}),f===A.id?a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>y(A.id),disabled:d===A.id,className:"font-body text-xs font-semibold text-white bg-brand-red hover:bg-brand-red-dark px-2.5 py-1.5 rounded-lg transition disabled:opacity-60",children:d===A.id?a.jsx(_e,{className:"w-3.5 h-3.5 animate-spin"}):"Delete"}),a.jsx("button",{onClick:()=>p(null),className:"font-body text-xs font-semibold text-gray-600 bg-gray-100 hover:bg-gray-200 px-2.5 py-1.5 rounded-lg transition",children:"Cancel"})]}):a.jsx("button",{onClick:()=>p(A.id),className:"inline-flex items-center gap-1 font-body text-xs font-semibold text-gray-500 hover:text-brand-red bg-gray-100 hover:bg-red-50 px-2.5 py-1.5 rounded-lg transition",children:a.jsx(Sn,{className:"w-3.5 h-3.5"})})]})})]},A.id)})})]})]},R))})]})}function Zw({active:r,onClick:e,title:t,children:n}){return a.jsx("button",{type:"button",onMouseDown:s=>{s.preventDefault(),e()},title:t,className:`w-7 h-7 rounded flex items-center justify-center transition-colors ${r?"bg-brand-red text-white":"text-gray-600 hover:bg-gray-200 hover:text-gray-900"}`,children:n})}function dW({value:r,onChange:e,placeholder:t="Write the full story here…",minHeight:n=440}){const s=k.useRef(null),i=k.useRef(!1),[o,l]=k.useState({bold:!1,italic:!1,underline:!1});k.useEffect(()=>{s.current&&(s.current.innerHTML=r||"",document.execCommand("defaultParagraphSeparator",!1,"p"))},[]),k.useEffect(()=>{if(s.current){if(i.current){i.current=!1;return}s.current.innerHTML!==r&&(s.current.innerHTML=r||"")}},[r]);function c(){l({bold:document.queryCommandState("bold"),italic:document.queryCommandState("italic"),underline:document.queryCommandState("underline")})}function u(p){var m,g;(m=s.current)==null||m.focus(),document.execCommand(p,!1),i.current=!0,e(((g=s.current)==null?void 0:g.innerHTML)??""),c()}function d(){var p;i.current=!0,e(((p=s.current)==null?void 0:p.innerHTML)??"")}function h(p){p.preventDefault();const m=p.clipboardData.getData("text/plain");document.execCommand("insertText",!1,m)}const f=!r.replace(/<[^>]*>/g,"").trim();return a.jsxs("div",{className:"relative",children:[a.jsxs("div",{className:"flex items-center gap-1 px-2 py-1.5 bg-gray-50 border border-gray-300 rounded-t-lg",children:[a.jsx(Zw,{active:o.bold,onClick:()=>u("bold"),title:"Bold (Ctrl+B)",children:a.jsx("span",{className:"font-bold text-sm leading-none",children:"B"})}),a.jsx(Zw,{active:o.italic,onClick:()=>u("italic"),title:"Italic (Ctrl+I)",children:a.jsx("span",{className:"italic text-sm leading-none font-serif",children:"I"})}),a.jsx(Zw,{active:o.underline,onClick:()=>u("underline"),title:"Underline (Ctrl+U)",children:a.jsx("span",{className:"underline text-sm leading-none",children:"U"})}),a.jsx("div",{className:"w-px h-4 bg-gray-200 mx-1"}),a.jsx("span",{className:"font-body text-xs text-gray-400 hidden sm:block",children:"Press Enter twice for a new paragraph"})]}),f&&a.jsx("p",{className:"absolute left-4 font-body text-sm text-gray-400 pointer-events-none select-none",style:{to
1147p:"calc(2.25rem + 0.625rem)"},children:t}),a.jsx("div",{ref:s,contentEditable:!0,suppressContentEditableWarning:!0,onInput:d,onKeyUp:c,onMouseUp:c,onPaste:h,className:"w-full border border-gray-300 border-t-0 rounded-b-lg px-3.5 py-2.5 font-body text-sm leading-relaxed focus:outline-none focus:ring-2 focus:ring-brand-red/30 focus:border-brand-red transition overflow-auto",style:{minHeight:n},spellCheck:!0})]})}const hW={title:"",description:"",summary:"",transcript:"",audio_url:"",audio_path:"",audio_file_name:"",transcript_docx_path:"",transcript_file_name:"",hero_image_url:null,audio_date:null,sort_order:0};function fW(){const[r,e]=k.useState([]),[t,n]=k.useState(!0),[s,i]=k.useState(null),[o,l]=k.useState(!1),[c,u]=k.useState(""),[d,h]=k.useState(!1),[f,p]=k.useState(!1),[m,g]=k.useState(!1),[v,b]=k.useState(""),[y,w]=k.useState(!1),[_,N]=k.useState(!1),[S,E]=k.useState(!1),[T,D]=k.useState(!1),[R,H]=k.useState(!1),A=k.useRef(null),U=k.useRef(null),C=k.useRef(null);k.useEffect(()=>{M()},[]);const M=async()=>{if(!je||!Y){n(!1);return}try{const{data:K}=await Y.from("subscriber_audio").select("*").order("sort_order",{ascending:!1}).order("created_at",{ascending:!1});e(K??[])}finally{n(!1)}},L=async K=>{var pe;if(!Y)throw new Error("Not configured");const ee=((pe=K.name.split(".").pop())==null?void 0:pe.toLowerCase())??"",Z=`audio/${Date.now()}.${ee}`,{error:ie}=await Y.storage.from("subscriber-audio").upload(Z,K,{contentType:K.type||"audio/mpeg"});if(ie)throw new Error(ie.message);return{path:Z,fileName:K.name}},B=async K=>{var pe;if(!Y)throw new Error("Not configured");const ee=((pe=K.name.split(".").pop())==null?void 0:pe.toLowerCase())??"docx",Z=`transcripts/${Date.now()}.${ee}`,{error:ie}=await Y.storage.from("subscriber-audio").upload(Z,K,{contentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"});if(ie)throw new Error(ie.message);return{path:Z,fileName:K.name}},I=async K=>{var me;if(!Y)throw new Error("Not configured");const ee=((me=K.name.split(".").pop())==null?void 0:me.toLowerCase())??"jpg",Z=`audio-hero/${Date.now()}.${ee}`,{error:ie}=await Y.storage.from("article-images").upload(Z,K,{contentType:K.type});if(ie)throw new Error(ie.message);const{data:pe}=Y.storage.from("article-images").getPublicUrl(Z);return pe.publicUrl},z=async K=>{b(""),h(!0);try{const{path:ee,fileName:Z}=await L(K);i(ie=>ie&&{...ie,audio_path:ee,audio_file_name:Z,audio_url:null})}catch(ee){b(ee instanceof Error?ee.message:"Audio upload failed.")}finally{h(!1),A.current&&(A.current.value="")}},X=async K=>{b(""),g(!0);try{const{path:ee,fileName:Z}=await B(K);i(ie=>ie&&{...ie,transcript_docx_path:ee,transcript_file_name:Z,transcript:null})}catch(ee){b(ee instanceof Error?ee.message:"Transcript upload failed.")}finally{g(!1),C.current&&(C.current.value="")}},F=async K=>{b(""),p(!0);try{const ee=await I(K);i(Z=>Z&&{...Z,hero_image_url:ee})}catch(ee){b(ee instanceof Error?ee.message:"Image upload failed.")}finally{p(!1),U.current&&(U.current.value="")}},q=async()=>{var K,ee,Z,ie;if(s){if(!((K=s.title)!=null&&K.trim())){u("Title is required.");return}if(!s.audio_path&&!s.audio_url){u("An audio file is required.");return}u(""),l(!0);try{if(!Y)throw new Error("Not configured");const pe={title:s.title.trim(),description:((ee=s.description)==null?void 0:ee.trim())||null,summary:((Z=s.summary)==null?void 0:Z.trim())||null,transcript:((ie=s.transcript)==null?void 0:ie.trim())||null,audio_url:s.audio_url||null,audio_path:s.audio_path||null,audio_file_name:s.audio_file_name||null,transcript_docx_path:s.transcript_docx_path||null,transcript_file_name:s.transcript_file_name||null,hero_image_url:s.hero_image_url||null,audio_date:s.audio_date||null,sort_order:s.sort_order??0};let me;if(s.id?me=await Y.from("subscriber_audio").update(pe).eq("id",s.id):me=await Y.from("subscriber_audio").insert(pe),me.error)throw new Error(me.error.message);i(null),await M()}catch(pe){u(pe instanceof Error?pe.message:"Save failed.")}finally{l(!1)}}},V=async K=>{Y&&confirm("Delete this recording? The summary, transcript, and audio will all be removed.")&&(await Y.from("subscriber_audio").delete().eq("id",K),await M())};return t?a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx(_e,{className:"w-8 h-8 animate-spin text-navy-400"})}):s?a.jsxs("div",{className:"max-w-3xl mx-auto",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsx("h2",{className:"font-bold text-navy-900 text-xl",children:s.id?"Edit Recording":"New Recording"}),a.jsx("button",{onClick:()=>i(null),className:"text-gray-400 hover:text-gray-600",children:a.jsx(tt,{className:"w-5 h-5"})})]}),a.jsx("p",{className:"text-sm text-gray-500 mb-5 bg-blue-50 border border-blue-200 rounded-lg px-4 py-3",children:"Upload the full Otter.ai output for this meeting: the audio recording, AI summary, and transcript document."}),c&&a.jsxs("div",{className:"mb-4 flex items-center gap-2 bg-red-50 border border-red-200 text-red-700 rounded-lg px-4 py-3 text-sm",children:[a.jsx(Ve,{className:"w-4 h-4 flex-shrink-0"}),c]}),a.jsxs("div",{className:"space-y-5",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Title *"}),a.jsx("input",{type:"text",value:s.title??"",onChange:K=>i({...s,title:K.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-2.5 text-sm focus:outline-none focus:border-navy-400",placeholder:"e.g. County Commission Meeting — September 2026"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Short Description"}),a.jsx("textarea",{rows:2,value:s.description??"",onChange:K=>i({...s,description:K.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-2.5 text-sm focus:outline-none focus:border-navy-400 resize-y",placeholder:"A brief one-line description shown on the card (optional)"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Recording Date"}),a.jsx("input",{type:"date",value:s.audio_date??"",onChange:K=>i({...s,audio_date:K.target.value||null}),className:"border border-gray-300 rounded-lg px-3 py-2.5 text-sm focus:outline-none focus:border-navy-400"})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-2 flex items-center gap-1.5",children:[a.jsx(bl,{className:"w-4 h-4 text-navy-500"})," Audio Recording *"]}),a.jsx("input",{ref:A,type:"file",accept:"audio/mpeg,audio/mp3,audio/wav,audio/ogg,audio/mp4,audio/x-m4a,.mp3,.wav,.ogg,.m4a",onChange:K=>{var Z;const ee=(Z=K.target.files)==null?void 0:Z[0];ee&&z(ee)},className:"hidden"}),s.audio_path||s.audio_url?a.jsx("div",{className:"space-y-2",children:a.jsxs("div",{className:"flex items-center gap-3 bg-gray-50 border border-gray-200 rounded-lg px-4 py-3",children:[a.jsx(bl,{className:"w-6 h-6 text-navy-500 flex-shrink-0"}),a.jsx("span",{className:"text-sm text-gray-700 font-medium flex-1 truncate",children:s.audio_file_name||"Audio uploaded"}),a.jsx("button",{type:"button",onClick:()=>{var K;return(K=A.current)==null?void 0:K.click()},className:"text-sm text-navy-600 hover:text-navy-900 font-medium",children:"Replace"})]})}):d?a.jsxs("div",{className:"flex items-center justify-center py-8 border-2 border-dashed border-gray-300 rounded-xl",children:[a.jsx(_e,{className:"w-6 h-6 animate-spin text-navy-400"}),a.jsx("span",{className:"ml-2 text-sm text-gray-500",children:"Uploading…"})]}):a.jsxs("div",{onDrop:K=>{var Z;K.preventDefault(),w(!1);const ee=(Z=K.dataTransfer.files)==null?void 0:Z[0];ee&&z(ee)},onDragOver:K=>{K.preventDefault(),w(!0)},onDragLeave:()=>w(!1),onClick:()=>{var K;return(K=A.current)==null?void 0:K.click()},className:`w-full flex flex-col items-center justify-center gap-3 border-2 border-dashed rounded-xl py-10 cursor-pointer transition-colors ${y?"border-navy-500 bg-navy-50":"border-gray-300 hover:border-navy-400 hover:bg-gray-50"}`,children:[a.jsx(Fn,{className:"w-7 h-7 text-gray-400"}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-sm font-semibold text-gray-700",children:y?"Drop audio file here":"Drag & drop or click to upload audio"}),a.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"MP3, WAV, OGG, M4A"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Hero Image (optional)"}),a.jsx("input",{ref:U,type:"file",accept:"image/jpeg,image/png,image/webp",onChange:K=>{var Z;const ee=(Z=K.target.files)==null?void 0:Z[0];ee&&F(ee)},className:"hidden"}),s.hero_image_url?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"relative rounded-lg overflow-hidden border border-gray-200",children:[a.jsx(Mr,{src:s.hero_image_url,alt:"Hero preview",imageId:s.hero_image_url,className:"w-full max-h-48 object-cover",containerClassName:"w-full"}),a.jsx("button",{type:"button",onClick:()=>i({...s,hero_image_url:null}),className:"absolute top-2 right-2 bg-black/60 text-white rounded-full p-1.5 hover:bg-black/80",children:a.jsx(tt,{className:"w-4 h-4"})})]}),a.jsx("button",{type:"button",onClick:()=>{var K;return(K=U.current)==null?void 0:K.click()},className:"text-sm text-navy-600 hover:text-navy-900 font-medium",children:"Replace image"})]}):f?a.jsxs("div",{className:"flex items-center justify-center py-8 border-2 border-dashed border-gray-300 rounded-xl",children:[a.jsx(_e,{className:"w-6 h-6 animate-spin text-navy-400"}),a.jsx("span",{className:"ml-2 text-sm text-gray-500",children:"Uploading…"})]}):a.jsxs("div",{onDrop:K=>{var Z;K.preventDefault(),N(!1);const ee=(Z=K.dataTransfer.files)==null?void 0:Z[0];ee&&F(ee)},onDragOver:K=>{K.preventDefault(),N(!0)},onDragLeave:()=>N(!1),onClick:()=>{var K;return(K=U.current)==null?void 0:K.click()},className:`w-full flex flex-col items-center justify-center gap-2 border-2 border-dashed rounded-xl py-8 cursor-pointer transition-colors ${_?"border-navy-500 bg-navy-50":"border-gray-300 hover:border-navy-400 hover:bg-gray-50"}`,children:[a.jsx(Vu,{className:"w-6 h-6 text-gray-400"}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-sm font-semibold text-gray-700",children:_?"Drop image here":"Drag & drop or click to upload hero image"}),a.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"JPG, PNG, WebP"})]})]})]}),a.jsxs("div",{children:[a.jsxs("button",{type:"button",onClick:()=>D(!T),className:"w-full flex items-center justify-between px-4 py-3 bg-amber-50 border border-amber-200 rounded-lg text-sm font-medium text-amber-900 hover:bg-amber-100 transition-colors",children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx(A_,{className:"w-4 h-4"}),"Otter.ai Summary"]}),T?a.jsx(fa,{className:"w-4 h-4"}):a.jsx(Ws,{className:"w-4 h-4"})]}),T&&a.jsxs("div",{className:"mt-2",children:[a.jsx("textarea",{rows:6,value:s.summary??"",onChange:K=>i({...s,summary:K.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-2.5 text-sm focus:outline-none focus:border-navy-400 resize-y font-mono",placeholder:"Paste the Otter.ai AI summary here…"}),a.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"The AI-generated summary from Otter.ai. Shown to subscribers above the transcript."})]})]}),a.jsxs("div",{children:[a.jsxs("button",{type:"button",onClick:()=>H(!R),className:"w-full flex items-center justify-between px-4 py-3 bg-green-50 border border-green-200 rounded-lg text-sm font-medium text-green-900 hover:bg-green-100 transition-colors",children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx(Bt,{className:"w-4 h-4"}),"Otter.ai Transcript (.docx)"]}),R?a.jsx(fa,{className:"w-4 h-4"}):a.jsx(Ws,{className:"w-4 h-4"})]}),R&&a.jsxs("div",{className:"mt-2 space-y-3",children:[a.jsx("input",{ref:C,type:"file",accept:".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document",onChange:K=>{var Z;const ee=(Z=K.target.files)==null?void 0:Z[0];ee&&X(ee)},className:"hidden"}),s.transcript_docx_path?a.jsxs("div",{className:"flex items-center gap-3 bg-gray-50 border border-gray-200 rounded-lg px-4 py-3",children:[a.jsx(Bt,{className:"w-6 h-6 text-green-600 flex-shrink-0"}),a.jsx("span",{className:"text-sm text-gray-700 font-medium flex-1 truncate",children:s.transcript_file_name||"Transcript uploaded"}),a.jsx("button",{type:"button",onClick:()=>i({...s,transcript_docx_path:null,transcript_file_name:null}),className:"text-sm text-red-500 hover:text-red-700 font-medium",children:"Remove"}),a.jsx("button",{type:"button",onClick:()=>{var K;return(K=C.current)==null?void 0:K.click()},className:"text-sm text-navy-600 hover:text-navy-900 font-medium",children:"Replace"})]}):m?a.jsxs("div",{className:"flex items-center justify-center py-8 border-2 border-dashed border-gray-300 rounded-xl",children:[a.jsx(_e,{className:"w-6 h-6 animate-spin text-green-400"}),a.jsx("span",{className:"ml-2 text-sm text-gray-500",children:"Uploading transcript…"})]}):a.jsxs("div",{onDrop:K=>{var Z;K.preventDefault(),E(!1);const ee=(Z=K.dataTransfer.files)==null?void 0:Z[0];ee&&X(ee)},onDragOver:K=>{K.preventDefault(),E(!0)},onDragLeave:()=>E(!1),onClick:()=>{var K;return(K=C.current)==null?void 0:K.click()},className:`w-full flex flex-col items-center justify-center gap-2 border-2 border-dashed rounded-xl py-8 cursor-pointer transition-colors ${S?"border-green-500 bg-green-50":"border-gray-300 hover:border-green-400 hover:bg-gray-50"}`,children:[a.jsx(Bt,{className:"w-6 h-6 text-gray-400"}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-sm font-semibold text-gray-700",children:S?"Drop .docx here":"Drag & drop or click to upload Otter.ai transcript"}),a.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:".docx file from Otter.ai export"})]})]}),a.jsx("p",{className:"text-xs text-gray-400",children:"Upload the .docx transcript file exported from Otter.ai. Subscribers can read it on-screen and download it."})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Sort Order (higher = first)"}),a.jsx("input",{type:"number",value:s.sort_order??0,onChange:K=>i({...s,sort_order:parseInt(K.target.value)||0}),className:"w-32 border border-gray-300 rounded-lg px-3 py-2.5 text-sm focus:outline-none focus:border-navy-400"})]}),v&&a.jsxs("div",{className:"flex items-center gap-2 text-red-600 text-sm",children:[a.jsx(Ve,{className:"w-4 h-4 flex-shrink-0"}),v]}),a.jsxs("div",{className:"flex items-center gap-3 pt-2",children:[a.jsxs("button",{onClick:q,disabled:o,className:"flex items-center gap-1.5 bg-navy-700 text-white px-5 py-2.5 rounded-lg text-sm font-semibold hover:bg-navy-800 disabled:opacity-50 transition-colors",children:[o?a.jsx(_e,{className:"w-4 h-4 animate-spin"}):a.jsx(vn,{className:"w-4 h-4"}),"Save"]}),a.jsx("button",{onClick:()=>i(null),className:"px-5 py-2.5 border border-gray-300 text-gray-600 rounded-lg text-sm font-semibold hover:bg-gray-50 transition-colors",children:"Cancel"})]})]})]}):a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsx("h2",{className:"font-bold text-navy-900 text-xl",children:"Subscriber Extras"}),a.jsxs("button",{onClick:()=>{i({...hW}),u(""),b(""),D(!1),H(!1)},className:"flex items-center gap-1.5 bg-navy-700 text-white px-4 py-2.5 rounded-lg text-sm font-semibold hover:bg-navy-800 transition-colors",children:[a.jsx(No,{className:"w-4 h-4"})," Add Recording"]})]}),a.jsx("p",{className:"text-sm text-gray-500 mb-4",children:"Meeting recordings with Otter.ai summaries and transcripts for digital subscribers. Each entry can include the audio recording, AI summary, a .docx transcript, and a hero image."}),r.length===0?a.jsxs("div",{className:"text-center py-16 text-gray-400",children:[a.jsx(bl,{className:"w-10 h-10 mx-auto mb-3 text-gray-300"}),a.jsx("p",{className:"text-sm",children:'No recordings yet. Click "Add Recording" to create one.'})]}):a.jsx("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm overflow-hidden",children:a.jsx("div",{className:"divide-y divide-gray-100",children:r.map(K=>a.jsxs("div",{className:"flex items-start gap-3 px-5 py-4 hover:bg-gray-50 transition-colors",children:[K.hero_image_url?a.jsx(Mr,{src:K.hero_image_url,
1147alt:"",imageId:K.hero_image_url,className:"w-full h-full object-cover",containerClassName:"w-12 h-12 rounded flex-shrink-0 border border-gray-200 overflow-hidden"}):a.jsx("div",{className:"w-12 h-12 rounded flex-shrink-0 bg-navy-50 border border-navy-100 flex items-center justify-center",children:a.jsx(bl,{className:"w-5 h-5 text-navy-400"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-medium text-navy-900 text-sm",children:K.title}),a.jsxs("div",{className:"flex items-center gap-2 mt-0.5 flex-wrap",children:[K.audio_date&&a.jsxs("span",{className:"text-xs text-gray-400 flex items-center gap-1",children:[a.jsx(ha,{className:"w-3 h-3"}),new Date(K.audio_date+"T00:00:00").toLocaleDateString()]}),K.summary&&a.jsxs("span",{className:"text-xs text-amber-700 bg-amber-50 px-1.5 py-0.5 rounded flex items-center gap-1",children:[a.jsx(A_,{className:"w-3 h-3"})," Summary"]}),(K.transcript_docx_path||K.transcript)&&a.jsxs("span",{className:"text-xs text-green-700 bg-green-50 px-1.5 py-0.5 rounded flex items-center gap-1",children:[a.jsx(Bt,{className:"w-3 h-3"})," Transcript"]}),a.jsxs("span",{className:"text-xs text-gray-400",children:["Order: ",K.sort_order]})]}),K.description&&a.jsx("p",{className:"text-xs text-gray-500 mt-1 line-clamp-2",children:K.description})]}),a.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[a.jsx("button",{onClick:()=>{i(K),u(""),b(""),D(!!K.summary),H(!!K.transcript_docx_path)},className:"p-1.5 text-navy-600 hover:bg-navy-50 rounded-lg transition-colors",children:a.jsx(Sf,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>V(K.id),className:"p-1.5 text-red-500 hover:bg-red-50 rounded-lg transition-colors",children:a.jsx(Sn,{className:"w-4 h-4"})})]})]},K.id))})})]})}var jp={};jp.d=(r,e)=>{for(var t in e)jp.o(e,t)&&!jp.o(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:e[t]})};jp.o=(r,e)=>Object.prototype.hasOwnProperty.call(r,e);var He=globalThis.pdfjsLib={};jp.d(He,{AbortException:()=>Xu,AnnotationEditorLayer:()=>tS,AnnotationEditorParamsType:()=>Ue,AnnotationEditorType:()=>Ge,AnnotationEditorUIManager:()=>Lu,AnnotationLayer:()=>uG,AnnotationMode:()=>Ho,CMapCompressionType:()=>W_,ColorPicker:()=>$b,DOMSVGFactory:()=>Fk,DrawLayer:()=>iS,FeatureTest:()=>zn,GlobalWorkerOptions:()=>Ja,ImageKind:()=>by,InvalidPDFException:()=>uP,MissingPDFException:()=>Gu,OPS:()=>ni,OutputScale:()=>J_,PDFDataRangeTransport:()=>aI,PDFDateString:()=>xP,PDFWorker:()=>Xd,PasswordResponses:()=>yW,PermissionFlag:()=>gW,PixelsPerInch:()=>Il,RenderingCancelledException:()=>Bk,TextLayer:()=>Qp,UnexpectedResponseException:()=>tv,Util:()=>Pe,VerbosityLevel:()=>Zx,XfaLayer:()=>lI,build:()=>WV,createValidAbsoluteUrl:()=>wW,fetchData:()=>nv,getDocument:()=>OV,getFilenameFromUrl:()=>RW,getPdfFilenameFromUrl:()=>PW,getXfaPageViewport:()=>IW,isDataScheme:()=>sv,isPdfFile:()=>$k,noContextMenu:()=>Gs,normalizeUnicode:()=>EW,setLayerDimensions:()=>Iu,shadow:()=>it,version:()=>qV});const an=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),cP=[1,0,0,1,0,0],q_=[.001,0,0,.001,0,0],pW=1e7,Qw=1.35,as={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},Ho={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},mW="pdfjs_internal_editor_",Ge={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},Ue={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35},gW={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},Zr={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},by={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},or={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},zf={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},Zx={ERRORS:0,WARNINGS:1,INFOS:5},W_={NONE:0,BINARY:1},ni={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},yW={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let Qx=Zx.WARNINGS;function bW(r){Number.isInteger(r)&&(Qx=r)}function xW(){return Qx}function ev(r){Qx>=Zx.INFOS&&console.log(`Info: ${r}`)}function Je(r){Qx>=Zx.WARNINGS&&console.log(`Warning: ${r}`)}function ar(r){throw new Error(r)}function mr(r,e){r||ar(e)}function vW(r){switch(r==null?void 0:r.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function wW(r,e=null,t=null){if(!r)return null;try{if(t&&typeof r=="string"){if(t.addDefaultProtocol&&r.startsWith("www.")){const s=r.match(/\./g);(s==null?void 0:s.length)>=2&&(r=`http://${r}`)}if(t.tryConvertEncoding)try{r=CW(r)}catch{}}const n=e?new URL(r,e):new URL(r);if(vW(n))return n}catch{}return null}function it(r,e,t,n=!1){return Object.defineProperty(r,e,{value:t,enumerable:!n,configurable:!0,writable:!1}),t}const Vl=function(){function e(t,n){this.message=t,this.name=n}return e.prototype=new Error,e.constructor=e,e}();class V_ extends Vl{constructor(e,t){super(e,"PasswordException"),this.code=t}}class G_ extends Vl{constructor(e,t){super(e,"UnknownErrorException"),this.details=t}}class uP extends Vl{constructor(e){super(e,"InvalidPDFException")}}class Gu extends Vl{constructor(e){super(e,"MissingPDFException")}}class tv extends Vl{constructor(e,t){super(e,"UnexpectedResponseException"),this.status=t}}class _W extends Vl{constructor(e){super(e,"FormatError")}}class Xu extends Vl{constructor(e){super(e,"AbortException")}}function dP(r){(typeof r!="object"||(r==null?void 0:r.length)===void 0)&&ar("Invalid argument for bytesToString");const e=r.length,t=8192;if(e<t)return String.fromCharCode.apply(null,r);const n=[];for(let s=0;s<e;s+=t){const i=Math.min(s+t,e),o=r.subarray(s,i);n.push(String.fromCharCode.apply(null,o))}return n.join("")}function rv(r){typeof r!="string"&&ar("Invalid argument for stringToBytes");const e=r.length,t=new Uint8Array(e);for(let n=0;n<e;++n)t[n]=r.charCodeAt(n)&255;return t}function NW(r){return String.fromCharCode(r>>24&255,r>>16&255,r>>8&255,r&255)}function Ok(r){const e=Object.create(null);for(const[t,n]of r)e[t]=n;return e}
1147function SW(){const r=new Uint8Array(4);return r[0]=1,new Uint32Array(r.buffer,0,1)[0]===1}function kW(){try{return new Function(""),!0}catch{return!1}}class zn{static get isLittleEndian(){return it(this,"isLittleEndian",SW())}static get isEvalSupported(){return it(this,"isEvalSupported",kW())}static get isOffscreenCanvasSupported(){return it(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.platform)=="string"?it(this,"platform",{isMac:navigator.platform.includes("Mac"),isWindows:navigator.platform.includes("Win"),isFirefox:typeof(navigator==null?void 0:navigator.userAgent)=="string"&&navigator.userAgent.includes("Firefox")}):it(this,"platform",{isMac:!1,isWindows:!1,isFirefox:!1})}static get isCSSRoundSupported(){var e,t;return it(this,"isCSSRoundSupported",(t=(e=globalThis.CSS)==null?void 0:e.supports)==null?void 0:t.call(e,"width: round(1.5px, 1px)"))}}const e1=Array.from(Array(256).keys(),r=>r.toString(16).padStart(2,"0"));var lo,xy,X_;class Pe{static makeHexColor(e,t,n){return`#${e1[e]}${e1[t]}${e1[n]}`}static scaleMinMax(e,t){let n;e[0]?(e[0]<0&&(n=t[0],t[0]=t[2],t[2]=n),t[0]*=e[0],t[2]*=e[0],e[3]<0&&(n=t[1],t[1]=t[3],t[3]=n),t[1]*=e[3],t[3]*=e[3]):(n=t[0],t[0]=t[1],t[1]=n,n=t[2],t[2]=t[3],t[3]=n,e[1]<0&&(n=t[1],t[1]=t[3],t[3]=n),t[1]*=e[1],t[3]*=e[1],e[2]<0&&(n=t[0],t[0]=t[2],t[2]=n),t[0]*=e[2],t[2]*=e[2]),t[0]+=e[4],t[1]+=e[5],t[2]+=e[4],t[3]+=e[5]}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static applyTransform(e,t){const n=e[0]*t[0]+e[1]*t[2]+t[4],s=e[0]*t[1]+e[1]*t[3]+t[5];return[n,s]}static applyInverseTransform(e,t){const n=t[0]*t[3]-t[1]*t[2],s=(e[0]*t[3]-e[1]*t[2]+t[2]*t[5]-t[4]*t[3])/n,i=(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/n;return[s,i]}static getAxialAlignedBoundingBox(e,t){const n=this.applyTransform(e,t),s=this.applyTransform(e.slice(2,4),t),i=this.applyTransform([e[0],e[3]],t),o=this.applyTransform([e[2],e[1]],t);return[Math.min(n[0],s[0],i[0],o[0]),Math.min(n[1],s[1],i[1],o[1]),Math.max(n[0],s[0],i[0],o[0]),Math.max(n[1],s[1],i[1],o[1])]}static inverseTransform(e){const t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e){const t=[e[0],e[2],e[1],e[3]],n=e[0]*t[0]+e[1]*t[2],s=e[0]*t[1]+e[1]*t[3],i=e[2]*t[0]+e[3]*t[2],o=e[2]*t[1]+e[3]*t[3],l=(n+o)/2,c=Math.sqrt((n+o)**2-4*(n*o-i*s))/2,u=l+c||1,d=l-c||1;return[Math.sqrt(u),Math.sqrt(d)]}static normalizeRect(e){const t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){const n=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),s=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(n>s)return null;const i=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),o=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return i>o?null:[n,i,s,o]}static bezierBoundingBox(e,t,n,s,i,o,l,c,u){return u?(u[0]=Math.min(u[0],e,l),u[1]=Math.min(u[1],t,c),u[2]=Math.max(u[2],e,l),u[3]=Math.max(u[3],t,c)):u=[Math.min(e,l),Math.min(t,c),Math.max(e,l),Math.max(t,c)],O(this,lo,X_).call(this,e,n,i,l,t,s,o,c,3*(-e+3*(n-i)+l),6*(e-2*n+i),3*(n-e),u),O(this,lo,X_).call(this,e,n,i,l,t,s,o,c,3*(-t+3*(s-o)+c),6*(t-2*s+o),3*(s-t),u),u}}lo=new WeakSet,xy=function(e,t,n,s,i,o,l,c,u,d){if(u<=0||u>=1)return;const h=1-u,f=u*u,p=f*u,m=h*(h*(h*e+3*u*t)+3*f*n)+p*s,g=h*(h*(h*i+3*u*o)+3*f*l)+p*c;d[0]=Math.min(d[0],m),d[1]=Math.min(d[1],g),d[2]=Math.max(d[2],m),d[3]=Math.max(d[3],g)},X_=function(e,t,n,s,i,o,l,c,u,d,h,f){if(Math.abs(u)<1e-12){Math.abs(d)>=1e-12&&O(this,lo,xy).call(this,e,t,n,s,i,o,l,c,-h/d,f);return}const p=d**2-4*h*u;if(p<0)return;const m=Math.sqrt(p),g=2*u;O(this,lo,xy).call(this,e,t,n,s,i,o,l,c,(-d+m)/g,f),O(this,lo,xy).call(this,e,t,n,s,i,o,l,c,(-d-m)/g,f)},$(Pe,lo);function CW(r){return decodeURIComponent(escape(r))}let t1=null,VA=null;function EW(r){return t1||(t1=/([\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,VA=new Map([["ſt","ſt"]])),r.replaceAll(t1,(e,t,n)=>t?t.normalize("NFKC"):VA.get(n))}function jW(){if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.randomUUID)=="function")return crypto.randomUUID();
1147const r=new Uint8Array(32);if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.getRandomValues)=="function")crypto.getRandomValues(r);else for(let e=0;e<32;e++)r[e]=Math.floor(Math.random()*255);return dP(r)}const Mk="pdfjs_internal_id_",ga={BEZIER_CURVE_TO:0,MOVE_TO:1,LINE_TO:2,QUADRATIC_CURVE_TO:3,RESTORE:4,SAVE:5,SCALE:6,TRANSFORM:7,TRANSLATE:8};class hP{addFilter(e){return"none"}addHCMFilter(e,t){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addHighlightHCMFilter(e,t,n,s,i){return"none"}destroy(e=!1){}}var pm;class fP{constructor({enableHWA:e=!1}){$(this,pm,!1);P(this,pm,e)}create(e,t){if(e<=0||t<=0)throw new Error("Invalid canvas size");const n=this._createCanvas(e,t);return{canvas:n,context:n.getContext("2d",{willReadFrequently:!x(this,pm)})}}reset(e,t,n){if(!e.canvas)throw new Error("Canvas is not specified");if(t<=0||n<=0)throw new Error("Invalid canvas size");e.canvas.width=t,e.canvas.height=n}destroy(e){if(!e.canvas)throw new Error("Canvas is not specified");e.canvas.width=0,e.canvas.height=0,e.canvas=null,e.context=null}_createCanvas(e,t){ar("Abstract method `_createCanvas` called.")}}pm=new WeakMap;class pP{constructor({baseUrl:e=null,isCompressed:t=!0}){this.baseUrl=e,this.isCompressed=t}async fetch({name:e}){if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!e)throw new Error("CMap name must be specified.");const t=this.baseUrl+e+(this.isCompressed?".bcmap":""),n=this.isCompressed?W_.BINARY:W_.NONE;return this._fetchData(t,n).catch(s=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${t}`)})}_fetchData(e,t){ar("Abstract method `_fetchData` called.")}}class mP{constructor({baseUrl:e=null}){this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!e)throw new Error("Font filename must be specified.");const t=`${this.baseUrl}${e}`;return this._fetchData(t).catch(n=>{throw new Error(`Unable to load font data at: ${t}`)})}_fetchData(e){ar("Abstract method `_fetchData` called.")}}class AW{create(e,t,n=!1){if(e<=0||t<=0)throw new Error("Invalid SVG dimensions");const s=this._createSVG("svg:svg");return s.setAttribute("version","1.1"),n||(s.setAttribute("width",`${e}px`),s.setAttribute("height",`${t}px`)),s.setAttribute("preserveAspectRatio","none"),s.setAttribute("viewBox",`0 0 ${e} ${t}`),s}createElement(e){if(typeof e!="string")throw new Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){ar("Abstract method `_createSVG` called.")}}const wa="http://www.w3.org/2000/svg",pc=class pc{};Re(pc,"CSS",96),Re(pc,"PDF",72),Re(pc,"PDF_TO_CSS_UNITS",pc.CSS/pc.PDF);let Il=pc;var wc,_c,Fi,ja,en,rx,Nc,Ae,Qr,pd,md,vy,gd,gP,Y_,yd,Qf,ep,K_,tp;class TW extends hP{constructor({docId:t,ownerDocument:n=globalThis.document}){super();$(this,Ae);$(this,wc);$(this,_c);$(this,Fi);$(this,ja);$(this,en);$(this,rx);$(this,Nc,0);P(this,ja,t),P(this,en,n)}addFilter(t){if(!t)return"none";let n=x(this,Ae,Qr).get(t);if(n)return n;const[s,i,o]=O(this,Ae,vy).call(this,t),l=t.length===1?s:`${s}${i}${o}`;if(n=x(this,Ae,Qr).get(l),n)return x(this,Ae,Qr).set(t,n),n;const c=`g_${x(this,ja)}_transfer_map_${fn(this,Nc)._++}`,u=O(this,Ae,gd).call(this,c);x(this,Ae,Qr).set(t,u),x(this,Ae,Qr).set(l,u);const d=O(this,Ae,yd).call(this,c);return O(this,Ae,ep).call(this,s,i,o,d),u}addHCMFilter(t,n){var m;const s=`${t}-${n}`,i="base";let o=x(this,Ae,pd).get(i);if((o==null?void 0:o.key)===s||(o?((m=o.filter)==null||m.remove(),o.key=s,o.url="none",o.filter=null):(o={key:s,url:"none",filter:null},x(this,Ae,pd).set(i,o)),!t||!n))return o.url;const l=O(this,Ae,tp).call(this,t);t=Pe.makeHexColor(...l);const c=O(this,Ae,tp).call(this,n);if(n=Pe.makeHexColor(...c),x(this,Ae,md).style.color="",t==="#000000"&&n==="#ffffff"||t===n)return o.url;const u=new Array(256);for(let g=0;g<=255;g++){const v=g/255;u[g]=v<=.03928?v/12.92:((v+.055)/1.055)**2.4}const d=u.join(","),h=`g_${x(this,ja)}_hcm_filter`,f=o.filter=O(this,Ae,yd).call(this,h);O(this,Ae,ep).call(this,d,d,d,f),O(this,Ae,Y_).call(this,f);const p=(g,v)=>{const b=l[g]/255,y=c[g]/255,w=new Array(v+1);for(let _=0;_<=v;_++)w[_]=b+_/v*(y-b);return w.join(",")};return O(this,Ae,ep).call(this,p(0,5),p(1,5),p(2,5),f),o.url=O(this,Ae,gd).call(this,h),o.url}addAlphaFilter(t){let n=x(this,Ae,Qr).get(t);if(n)return n;const[s]=O(this,Ae,vy).call(this,[t]),i=`alpha_${s}`;if(n=x(this,Ae,Qr).get(i),n)return x(this,Ae,Qr).set(t,n),n;const o=`g_${x(this,ja)}_alpha_map_${fn(this,Nc)._++}`,l=O(this,Ae,gd).call(this,o);x(this,Ae,Qr).set(t,l),x(this,Ae,Qr).set(i,l);
1147const c=O(this,Ae,yd).call(this,o);return O(this,Ae,K_).call(this,s,c),l}addLuminosityFilter(t){let n=x(this,Ae,Qr).get(t||"luminosity");if(n)return n;let s,i;if(t?([s]=O(this,Ae,vy).call(this,[t]),i=`luminosity_${s}`):i="luminosity",n=x(this,Ae,Qr).get(i),n)return x(this,Ae,Qr).set(t,n),n;const o=`g_${x(this,ja)}_luminosity_map_${fn(this,Nc)._++}`,l=O(this,Ae,gd).call(this,o);x(this,Ae,Qr).set(t,l),x(this,Ae,Qr).set(i,l);const c=O(this,Ae,yd).call(this,o);return O(this,Ae,gP).call(this,c),t&&O(this,Ae,K_).call(this,s,c),l}addHighlightHCMFilter(t,n,s,i,o){var y;const l=`${n}-${s}-${i}-${o}`;let c=x(this,Ae,pd).get(t);if((c==null?void 0:c.key)===l||(c?((y=c.filter)==null||y.remove(),c.key=l,c.url="none",c.filter=null):(c={key:l,url:"none",filter:null},x(this,Ae,pd).set(t,c)),!n||!s))return c.url;const[u,d]=[n,s].map(O(this,Ae,tp).bind(this));let h=Math.round(.2126*u[0]+.7152*u[1]+.0722*u[2]),f=Math.round(.2126*d[0]+.7152*d[1]+.0722*d[2]),[p,m]=[i,o].map(O(this,Ae,tp).bind(this));f<h&&([h,f,p,m]=[f,h,m,p]),x(this,Ae,md).style.color="";const g=(w,_,N)=>{const S=new Array(256),E=(f-h)/N,T=w/255,D=(_-w)/(255*N);let R=0;for(let H=0;H<=N;H++){const A=Math.round(h+H*E),U=T+H*D;for(let C=R;C<=A;C++)S[C]=U;R=A+1}for(let H=R;H<256;H++)S[H]=S[R-1];return S.join(",")},v=`g_${x(this,ja)}_hcm_${t}_filter`,b=c.filter=O(this,Ae,yd).call(this,v);return O(this,Ae,Y_).call(this,b),O(this,Ae,ep).call(this,g(p[0],m[0],5),g(p[1],m[1],5),g(p[2],m[2],5),b),c.url=O(this,Ae,gd).call(this,v),c.url}destroy(t=!1){t&&x(this,Ae,pd).size!==0||(x(this,Fi)&&(x(this,Fi).parentNode.parentNode.remove(),P(this,Fi,null)),x(this,_c)&&(x(this,_c).clear(),P(this,_c,null)),P(this,Nc,0))}}wc=new WeakMap,_c=new WeakMap,Fi=new WeakMap,ja=new WeakMap,en=new WeakMap,rx=new WeakMap,Nc=new WeakMap,Ae=new WeakSet,Qr=function(){return x(this,_c)||P(this,_c,new Map)},pd=function(){return x(this,rx)||P(this,rx,new Map)},md=function(){if(!x(this,Fi)){const t=x(this,en).createElement("div"),{style:n}=t;n.visibility="hidden",n.contain="strict",n.width=n.height=0,n.position="absolute",n.top=n.left=0,n.zIndex=-1;const s=x(this,en).createElementNS(wa,"svg");s.setAttribute("width",0),s.setAttribute("height",0),P(this,Fi,x(this,en).createElementNS(wa,"defs")),t.append(s),s.append(x(this,Fi)),x(this,en).body.append(t)}return x(this,Fi)},vy=function(t){if(t.length===1){const u=t[0],d=new Array(256);for(let f=0;f<256;f++)d[f]=u[f]/255;const h=d.join(",");return[h,h,h]}const[n,s,i]=t,o=new Array(256),l=new Array(256),c=new Array(256);for(let u=0;u<256;u++)o[u]=n[u]/255,l[u]=s[u]/255,c[u]=i[u]/255;return[o.join(","),l.join(","),c.join(",")]},gd=function(t){if(x(this,wc)===void 0){P(this,wc,"");const n=x(this,en).URL;n!==x(this,en).baseURI&&(sv(n)?Je('#createUrl: ignore "data:"-URL for performance reasons.'):P(this,wc,n.split("#",1)[0]))}return`url(${x(this,wc)}#${t})`},gP=function(t){const n=x(this,en).createElementNS(wa,"feColorMatrix");n.setAttribute("type","matrix"),n.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"),t.append(n)},Y_=function(t){const n=x(this,en).createElementNS(wa,"feColorMatrix");n.setAttribute("type","matrix"),n.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"),t.append(n)},yd=function(t){const n=x(this,en).createElementNS(wa,"filter");return n.setAttribute("color-interpolation-filters","sRGB"),n.setAttribute("id",t),x(this,Ae,md).append(n),n},Qf=function(t,n,s){const i=x(this,en).createElementNS(wa,n);i.setAttribute("type","discrete"),i.setAttribute("tableValues",s),t.append(i)},ep=function(t,n,s,i){const o=x(this,en).createElementNS(wa,"feComponentTransfer");i.append(o),O(this,Ae,Qf).call(this,o,"feFuncR",t),O(this,Ae,Qf).call(this,o,"feFuncG",n),O(this,Ae,Qf).call(this,o,"feFuncB",s)},K_=function(t,n){const s=x(this,en).createElementNS(wa,"feComponentTransfer");n.append(s),O(this,Ae,Qf).call(this,s,"feFuncA",t)},tp=function(t){return x(this,Ae,md).style.color=t,Uk(getComputedStyle(x(this,Ae,md)).getPropertyValue("color"))};class DW extends fP{constructor({ownerDocument:e=globalThis.document,enableHWA:t=!1}){super({enableHWA:t}),this._document=e}_createCanvas(e,t){const n=this._document.createElement("canvas");return n.width=e,n.height=t,n}}async function nv(r,e="text"){if(rp(r,document.baseURI)){const t=await fetch(r);if(!t.ok)throw new Error(t.statusText);switch(e){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"json":return t.json()}return t.text()}return new Promise((t,n)=>{const s=new XMLHttpRequest;s.open("GET",r,!0),s.responseType=e,s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE){if(s.status===200||s.status===0){switch(e){case"arraybuffer":case"blob":case"json":t(s.response);return}t(s.responseText);return}n(new Error(s.statusText))}},s.send(null)})}class yP extends pP{_fetchData(e,t){return nv(e,this.isCompressed?"arraybuffer":"text").then(n=>({cMapData:n instanceof ArrayBuffer?new Uint8Array(n):rv(n),compressionType:t}))}}class bP extends mP{_fetchData(e){return nv(e,"arraybuffer").then(t=>new Uint8Array(t))}}class Fk extends AW{_createSVG(e){return document.createElementNS(wa,e)}}class Yg{constructor({viewBox:e,scale:t,rotation:n,offsetX:s=0,offsetY:i=0,dontFlip:o=!1}){this.viewBox=e,this.scale=t,this.rotation=n,this.offsetX=s,this.offsetY=i;const l=(e[2]+e[0])/2,c=(e[3]+e[1])/2;let u,d,h,f;switch(n%=360,n<0&&(n+=360),n){case 180:u=-1,d=0,h=0,f=1;break;case 90:u=0,d=1,h=1,f=0;break;case 270:u=0,d=-1,h=-1,f=0;break;case 0:u=1,d=0,h=0,f=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}o&&(h=-h,f=-f);let p,m,g,v;u===0?(p=Math.abs(c-e[1])*t+s,m=Math.abs(l-e[0])*t+i,g=(e[3]-e[1])*t,v=(e[2]-e[0])*t):(p=Math.abs(l-e[0])*t+s,m=Math.abs(c-e[1])*t+i,g=(e[2]-e[0])*t,v=(e[3]-e[1])*t),this.transform=[u*t,d*t,h*t,f*t,p-u*t*l-h*t*c,m-d*t*l-f*t*c],this.width=g,this.height=v}get rawDims(){const{viewBox:e}=this;return it(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:e=this.scale,rotation:t=this.rotation,offsetX:n=this.offsetX,offsetY:s=this.offsetY,dontFlip:i=!1}={}){return new Yg({viewBox:this.viewBox.slice(),scale:e,rotation:t,offsetX:n,offsetY:s,dontFlip:i})}convertToViewportPoint(e,t){return Pe.applyTransform([e,t],this.transform)}convertToViewportRectangle(e){const t=Pe.applyTransform([e[0],e[1]],this.transform),n=Pe.applyTransform([e[2],e[3]],this.transform);return[t[0],t[1],n[0],n[1]]}convertToPdfPoint(e,t){return Pe.applyInverseTransform([e,t],this.transform)}}class Bk extends Vl{constructor(e,t=0){super(e,"RenderingCancelledException"),this.extraDelay=t}}function sv(r){const e=r.length;let t=0;for(;t<e&&r[t].trim()==="";)t++;return r.substring(t,t+5).toLowerCase()==="data:"}function $k(r){return typeof r=="string"&&/\.pdf$/i.test(r)}function RW(r){return[r]=r.split(/[#?]/,1),r.substring(r.lastIndexOf("/")+1)}function PW(r,e="document.pdf"){if(typeof r!="string")return e;if(sv(r))return Je('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const t=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,n=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,s=t.exec(r);let i=n.exec(s[1])||n.exec(s[2])||n.exec(s[3]);if(i&&(i=i[0],i.includes("%")))try{i=n.exec(decodeURIComponent(i))[0]}catch{}return i||e}class GA{constructor(){Re(this,"started",Object.create(null));Re(this,"times",[])}time(e){e in this.started&&Je(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||Je(`Timer has not been started for ${e}`),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e]}toString(){const e=[];let t=0;for(const{name:n}of this.times)t=Math.max(n.length,t);for(const{name:n,start:s,end:i}of this.times)e.push(`${n.padEnd(t)} ${i-s}ms
1148`);return e.join("")}}function rp(r,e){try{const{protocol:t}=e?new URL(r,e):new URL(r);return t==="http:"||t==="https:"}catch{return!1}}function Gs(r){r.preventDefault()}function XA(r){console.log("Deprecated API usage: "+r)}let YA;class xP{static toDateObject(e){if(!e||typeof e!="string")return null;YA||(YA=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const t=YA.exec(e);if(!t)return null;const n=parseInt(t[1],10);let s=parseInt(t[2],10);s=s>=1&&s<=12?s-1:0;let i=parseInt(t[3],10);i=i>=1&&i<=31?i:1;let o=parseInt(t[4],10);o=o>=0&&o<=23?o:0;let l=parseInt(t[5],10);l=l>=0&&l<=59?l:0;let c=parseInt(t[6],10);c=c>=0&&c<=59?c:0;const u=t[7]||"Z";let d=parseInt(t[8],10);d=d>=0&&d<=23?d:0;let h=parseInt(t[9],10)||0;return h=h>=0&&h<=59?h:0,u==="-"?(o+=d,l+=h):u==="+"&&(o-=d,l-=h),new Date(Date.UTC(n,s,i,o,l,c))}}function IW(r,{scale:e=1,rotation:t=0}){const{width:n,height:s}=r.attributes.style,i=[0,0,parseInt(n),parseInt(s)];return new Yg({viewBox:i,scale:e,rotation:t})}function Uk(r){if(r.startsWith("#")){const e=parseInt(r.slice(1),16);return[(e&16711680)>>16,(e&65280)>>8,e&255]}return r.startsWith("rgb(")?r.slice(4,-1).split(",").map(e=>parseInt(e)):r.startsWith("rgba(")?r.slice(5,-1).split(",").map(e=>parseInt(e)).slice(0,3):(Je(`Not a valid color format: "${r}"`),[0,0,0])}function LW(r){const e=document.createElement("span");e.style.visibility="hidden",document.body.append(e);for(const t of r.keys()){e.style.color=t;
1148const n=window.getComputedStyle(e).color;r.set(t,Uk(n))}e.remove()}function Wt(r){const{a:e,b:t,c:n,d:s,e:i,f:o}=r.getTransform();return[e,t,n,s,i,o]}function ya(r){const{a:e,b:t,c:n,d:s,e:i,f:o}=r.getTransform().invertSelf();return[e,t,n,s,i,o]}function Iu(r,e,t=!1,n=!0){if(e instanceof Yg){const{pageWidth:s,pageHeight:i}=e.rawDims,{style:o}=r,l=zn.isCSSRoundSupported,c=`var(--scale-factor) * ${s}px`,u=`var(--scale-factor) * ${i}px`,d=l?`round(down, ${c}, var(--scale-round-x, 1px))`:`calc(${c})`,h=l?`round(down, ${u}, var(--scale-round-y, 1px))`:`calc(${u})`;!t||e.rotation%180===0?(o.width=d,o.height=h):(o.width=h,o.height=d)}n&&r.setAttribute("data-main-rotation",e.rotation)}class J_{constructor(){const e=window.devicePixelRatio||1;this.sx=e,this.sy=e}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}}var qo,Sc,si,kc,mm,gm,nx,vP,_n,wP,_P,wy,NP,Q_;const Sa=class Sa{constructor(e){$(this,_n);$(this,qo,null);$(this,Sc,null);$(this,si);$(this,kc,null);$(this,mm,null);P(this,si,e),x(Sa,gm)||P(Sa,gm,Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button"}))}render(){const e=P(this,qo,document.createElement("div"));e.classList.add("editToolbar","hidden"),e.setAttribute("role","toolbar");const t=x(this,si)._uiManager._signal;e.addEventListener("contextmenu",Gs,{signal:t}),e.addEventListener("pointerdown",O(Sa,nx,vP),{signal:t});const n=P(this,kc,document.createElement("div"));n.className="buttons",e.append(n);const s=x(this,si).toolbarPosition;if(s){const{style:i}=e,o=x(this,si)._uiManager.direction==="ltr"?1-s[0]:s[0];i.insetInlineEnd=`${100*o}%`,i.top=`calc(${100*s[1]}% + var(--editor-toolbar-vert-offset))`}return O(this,_n,NP).call(this),e}get div(){return x(this,qo)}hide(){var e;x(this,qo).classList.add("hidden"),(e=x(this,Sc))==null||e.hideDropdown()}show(){var e;x(this,qo).classList.remove("hidden"),(e=x(this,mm))==null||e.shown()}async addAltText(e){const t=await e.render();O(this,_n,wy).call(this,t),x(this,kc).prepend(t,x(this,_n,Q_)),P(this,mm,e)}addColorPicker(e){P(this,Sc,e);const t=e.renderButton();O(this,_n,wy).call(this,t),x(this,kc).prepend(t,x(this,_n,Q_))}remove(){var e;x(this,qo).remove(),(e=x(this,Sc))==null||e.destroy(),P(this,Sc,null)}};qo=new WeakMap,Sc=new WeakMap,si=new WeakMap,kc=new WeakMap,mm=new WeakMap,gm=new WeakMap,nx=new WeakSet,vP=function(e){e.stopPropagation()},_n=new WeakSet,wP=function(e){x(this,si)._focusEventsAllowed=!1,e.preventDefault(),e.stopPropagation()},_P=function(e){x(this,si)._focusEventsAllowed=!0,e.preventDefault(),e.stopPropagation()},wy=function(e){const t=x(this,si)._uiManager._signal;e.addEventListener("focusin",O(this,_n,wP).bind(this),{capture:!0,signal:t}),e.addEventListener("focusout",O(this,_n,_P).bind(this),{capture:!0,signal:t}),e.addEventListener("contextmenu",Gs,{signal:t})},NP=function(){const{editorType:e,_uiManager:t}=x(this,si),n=document.createElement("button");n.className="delete",n.tabIndex=0,n.setAttribute("data-l10n-id",x(Sa,gm)[e]),O(this,_n,wy).call(this,n),n.addEventListener("click",s=>{t.delete()},{signal:t._signal}),x(this,kc).append(n)},Q_=function(){const e=document.createElement("div");return e.className="divider",e},$(Sa,nx),$(Sa,gm,null);let Z_=Sa;var ym,Cc,Ec,Fl,SP,kP,CP;class OW{constructor(e){$(this,Fl);$(this,ym,null);$(this,Cc,null);$(this,Ec);P(this,Ec,e)}show(e,t,n){const[s,i]=O(this,Fl,kP).call(this,t,n),{style:o}=x(this,Cc)||P(this,Cc,O(this,Fl,SP).call(this));e.append(x(this,Cc)),o.insetInlineEnd=`${100*s}%`,o.top=`calc(${100*i}% + var(--editor-toolbar-vert-offset))`}hide(){x(this,Cc).remove()}}ym=new WeakMap,Cc=new WeakMap,Ec=new WeakMap,Fl=new WeakSet,SP=function(){const e=P(this,Cc,document.createElement("div"));e.className="editToolbar",e.setAttribute("role","toolbar"),e.addEventListener("contextmenu",Gs,{signal:x(this,Ec)._signal});const t=P(this,ym,document.createElement("div"));return t.className="buttons",e.append(t),O(this,Fl,CP).call(this),e},kP=function(e,t){let n=0,s=0;for(const i of e){const o=i.y+i.height;if(o<n)continue;const l=i.x+(t?i.width:0);if(o>n){s=l,n=o;continue}t?l>s&&(s=l):l<s&&(s=l)}return[t?1-s:s,n]},CP=function(){const e=document.createElement("button");e.className="highlightButton",e.tabIndex=0,e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const t=document.createElement("span");e.append(t),t.className="visuallyHidden",t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const n=x(this,Ec)._signal;e.addEventListener("contextmenu",Gs,{signal:n}),e.addEventListener("click",()=>{x(this,Ec).highlightSelection("floating_button")},{signal:n}),x(this,ym).append(e)};function Fb(r,e,t){for(const n of t)e.addEventListener(n,r[n].bind(r))}function MW(r){return Math.round(Math.min(255,Math.max(1,255*r))).toString(16).padStart(2,"0")}var sx;class FW{constructor(){$(this,sx,0)}get id(){return`${mW}${fn(this,sx)._++}`}}sx=new WeakMap;var Jd,bm,tn,Zd,_y;const gE=class gE{constructor(){$(this,Zd);$(this,Jd,jW());$(this,bm,0);$(this,tn,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>',n=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),s=new Image;s.src=e;const i=s.decode().then(()=>(n.drawImage(s,0,0,1,1,0,0,1,3),new Uint32Array(n.getImageData(0,0,1,1).data.buffer)[0]===0));return it(this,"_isSVGFittingCanvas",i)}async getFromFile(e){const{lastModified:t,name:n,size:s,type:i}=e;return O(this,Zd,_y).call(this,`${t}_${n}_${s}_${i}`,e)}async getFromUrl(e){return O(this,Zd,_y).call(this,e,e)}async getFromBlob(e,t){const n=await t;return O(this,Zd,_y).call(this,e,n)}async getFromId(e){x(this,tn)||P(this,tn,new Map);const t=x(this,tn).get(e);if(!t)return null;if(t.bitmap)return t.refCounter+=1,t;if(t.file)return this.getFromFile(t.file);if(t.blobPromise){const{blobPromise:n}=t;return delete t.blobPromise,this.getFromBlob(t.id,n)}return this.getFromUrl(t.url)}getFromCanvas(e,t){x(this,tn)||P(this,tn,new Map);let n=x(this,tn).get(e);if(n!=null&&n.bitmap)return n.refCounter+=1,n;const s=new OffscreenCanvas(t.width,t.height);return s.getContext("2d").drawImage(t,0,0),n={bitmap:s.transferToImageBitmap(),id:`image_${x(this,Jd)}_${fn(this,bm)._++}`,refCounter:1,isSvg:!1},x(this,tn).set(e,n),x(this,tn).set(n.id,n),n}getSvgUrl(e){const t=x(this,tn).get(e);return t!=null&&t.isSvg?t.svgUrl:null}deleteId(e){var s;x(this,tn)||P(this,tn,new Map);const t=x(this,tn).get(e);if(!t||(t.refCounter-=1,t.refCounter!==0))return;const{bitmap:n}=t;if(!t.url&&!t.file){const i=new OffscreenCanvas(n.width,n.height);i.getContext("bitmaprenderer").transferFromImageBitmap(n),t.blobPromise=i.convertToBlob()}(s=n.close)==null||s.call(n),t.bitmap=null}isValidId(e){return e.startsWith(`image_${x(this,Jd)}_`)}};Jd=new WeakMap,bm=new WeakMap,tn=new WeakMap,Zd=new WeakSet,_y=async function(e,t){x(this,tn)||P(this,tn,new Map);let n=x(this,tn).get(e);if(n===null)return null;if(n!=null&&n.bitmap)return n.refCounter+=1,n;try{n||(n={bitmap:null,id:`image_${x(this,Jd)}_${fn(this,bm)._++}`,refCounter:0,isSvg:!1});let s;if(typeof t=="string"?(n.url=t,s=await nv(t,"blob")):t instanceof File?s=n.file=t:t instanceof Blob&&(s=t),s.type==="image/svg+xml"){const i=gE._isSVGFittingCanvas,o=new FileReader,l=new Image,c=new Promise((u,d)=>{l.onload=()=>{n.bitmap=l,n.isSvg=!0,u()},o.onload=async()=>{const h=n.svgUrl=o.result;l.src=await i?`${h}#svgView(preserveAspectRatio(none))`:h},l.onerror=o.onerror=d});o.readAsDataURL(s),await c}else n.bitmap=await createImageBitmap(s);n.refCounter=1}catch(s){console.error(s),n=null}return x(this,tn).set(e,n),n&&x(this,tn).set(n.id,n),n};let eN=gE;var wr,Wo,xm,_r;class BW{constructor(e=128){$(this,wr,[]);$(this,Wo,!1);$(this,xm);$(this,_r,-1);P(this,xm,e)}add({cmd:e,undo:t,post:n,mustExec:s,type:i=NaN,overwriteIfSameType:o=!1,keepUndo:l=!1}){if(s&&e(),x(this,Wo))return;const c={cmd:e,undo:t,post:n,type:i};if(x(this,_r)===-1){x(this,wr).length>0&&(x(this,wr).length=0),P(this,_r,0),x(this,wr).push(c);return}if(o&&x(this,wr)[x(this,_r)].type===i){l&&(c.undo=x(this,wr)[x(this,_r)].undo),x(this,wr)[x(this,_r)]=c;return}const u=x(this,_r)+1;u===x(this,xm)?x(this,wr).splice(0,1):(P(this,_r,u),u<x(this,wr).length&&x(this,wr).splice(u)),x(this,wr).push(c)}undo(){if(x(this,_r)===-1)return;P(this,Wo,!0);const{undo:e,post:t}=x(this,wr)[x(this,_r)];e(),t==null||t(),P(this,Wo,!1),P(this,_r,x(this,_r)-1)}redo(){if(x(this,_r)<x(this,wr).length-1){P(this,_r,x(this,_r)+1),P(this,Wo,!0);const{cmd:e,post:t}=x(this,wr)[x(this,_r)];e(),t==null||t(),P(this,Wo,!1)}}hasSomethingToUndo(){return x(this,_r)!==-1}hasSomethingToRedo(){return x(this,_r)<x(this,wr).length-1}destroy(){P(this,wr,null)}}wr=new WeakMap,Wo=new WeakMap,xm=new WeakMap,_r=new WeakMap;var ix,EP;class Kg{constructor(e){$(this,ix);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:t}=zn.platform;for(const[n,s,i={}]of e)for(const o of n){const l=o.startsWith("mac+");t&&l?(this.callbacks.set(o.slice(4),{callback:s,options:i}),this.allKeys.add(o.split("+").at(-1))):!t&&!l&&(this.callbacks.set(o,{callback:s,options:i}),this.allKeys.add(o.split("+").at(-1)))}}exec(e,t){if(!this.allKeys.has(t.key))return;const n=this.callbacks.get(O(this,ix,EP).call(this,t));if(!n)return;const{callback:s,options:{bubbles:i=!1,args:o=[],checker:l=null}}=n;l&&!l(e,t)||(s.bind(e,...o,t)(),i||(t.stopPropagation(),t.preventDefault()))}}ix=new WeakSet,EP=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 t=this.buffer.join("+");return this.buffer.length=0,t};const ax=class ax{get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);return LW(e),it(this,"_colors",e)}convert(e){const t=Uk(e);if(!window.matchMedia("(forced-colors: active)").matches)return t;for(const[n,s]of this._colors)if(s.every((i,o)=>i===t[o]))return ax._colorsMapping.get(n);return t}getHexCode(e){const t=this._colors.get(e);return t?Pe.makeHexColor(...t):e}};Re(ax,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let tN=ax;var Qd,Qn,ur,Pr,eh,Aa,th,ii,Vo,rh,jc,Bi,ai,Ac,vm,wm,nh,_m,$i,Go,sh,Xo,Ui,ox,Yo,Nm,Ko,Tc,Sm,km,Nr,mt,Ta,Dc,Cm,Em,Jo,Hi,Da,jm,ks,Ee,Ny,rN,jP,AP,Sy,TP,DP,RP,nN,PP,sN,iN,IP,mn,Do,LP,OP,aN,MP,np,oN;const Fd=class Fd{constructor(e,t,n,s,i,o,l,c,u,d,h){$(this,Ee);$(this,Qd,new AbortController);$(this,Qn,null);$(this,ur,new Map);$(this,Pr,new Map);$(this,eh,null);$(this,Aa,null);$(this,th,null);$(this,ii,new BW);$(this,Vo,null);$(this,rh,0);$(this,jc,new Set);$(this,Bi,null);$(this,ai,null);$(this,Ac,new Set);$(this,vm,!1);$(this,wm,!1);$(this,nh,!1);$(this,_m,null);$(this,$i,null);$(this,Go,null);$(this,sh,null);$(this,Xo,!1);$(this,Ui,null);$(this,ox,new FW);$(this,Yo,!1);$(this,Nm,!1);$(this,Ko,null);$(this,Tc,null);$(this,Sm,null);$(this,km,null);$(this,Nr,Ge.NONE);$(this,mt,new Set);$(this,Ta,null);$(this,Dc,null);$(this,Cm,null);$(this,Em,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});$(this,Jo,[0,0]);$(this,Hi,null);$(this,Da,null);$(this,jm,null);$(this,ks,null);const f=this._signal=x(this,Qd).signal;P(this,Da,e),P(this,jm,t),P(this,eh,n),this._eventBus=s,s._on("editingaction",this.onEditingAction.bind(this),{signal:f}),s._on("pagechanging",this.onPageChanging.bind(this),{signal:f}),s._on("scalechanging",this.onScaleChanging.bind(this),{signal:f}),s._on("rotationchanging",this.onRotationChanging.bind(this),{signal:f}),s._on("setpreference",this.onSetPreference.bind(this),{signal:f}),s._on("switchannotationeditorparams",p=>this.updateParams(p.type,p.value),{signal:f}),O(this,Ee,TP).call(this),O(this,Ee,IP).call(this),O(this,Ee,nN).call(this),P(this,Aa,i.annotationStorage),P(this,_m,i.filterFactory),P(this,Dc,o),P(this,sh,l||null),P(this,vm,c),P(this,wm,u),P(this,nh,d),P(this,km,h||null),this.viewParameters={realScale:Il.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}static get _keyboardManager(){const e=Fd.prototype,t=o=>x(o,Da).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&o.hasSomethingToControl(),n=(o,{target:l})=>
1148{if(l instanceof HTMLInputElement){const{type:c}=l;return c!=="text"&&c!=="number"}return!0},s=this.TRANSLATE_SMALL,i=this.TRANSLATE_BIG;return it(this,"_keyboardManager",new Kg([[["ctrl+a","mac+meta+a"],e.selectAll,{checker:n}],[["ctrl+z","mac+meta+z"],e.undo,{checker:n}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo,{checker:n}],[["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:n}],[["Enter","mac+Enter"],e.addNewEditorFromKeyboard,{checker:(o,{target:l})=>!(l instanceof HTMLButtonElement)&&x(o,Da).contains(l)&&!o.isEnterHandled}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(o,{target:l})=>!(l instanceof HTMLButtonElement)&&x(o,Da).contains(document.activeElement)}],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-s,0],checker:t}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-i,0],checker:t}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[s,0],checker:t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[i,0],checker:t}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-s],checker:t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-i],checker:t}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,s],checker:t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,i],checker:t}]]))}destroy(){var e,t,n,s;(e=x(this,ks))==null||e.resolve(),P(this,ks,null),(t=x(this,Qd))==null||t.abort(),P(this,Qd,null),this._signal=null;for(const i of x(this,Pr).values())i.destroy();x(this,Pr).clear(),x(this,ur).clear(),x(this,Ac).clear(),P(this,Qn,null),x(this,mt).clear(),x(this,ii).destroy(),(n=x(this,eh))==null||n.destroy(),(s=x(this,Ui))==null||s.hide(),P(this,Ui,null),x(this,$i)&&(clearTimeout(x(this,$i)),P(this,$i,null)),x(this,Hi)&&(clearTimeout(x(this,Hi)),P(this,Hi,null))}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return x(this,km)}get useNewAltTextFlow(){return x(this,wm)}get useNewAltTextWhenAddingImage(){return x(this,nh)}get hcmFilter(){return it(this,"hcmFilter",x(this,Dc)?x(this,_m).addHCMFilter(x(this,Dc).foreground,x(this,Dc).background):"none")}get direction(){return it(this,"direction",getComputedStyle(x(this,Da)).direction)}get highlightColors(){return it(this,"highlightColors",x(this,sh)?new Map(x(this,sh).split(",").map(e=>e.split("=").map(t=>t.trim()))):null)}get highlightColorNames(){return it(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}setMainHighlightColorPicker(e){P(this,Sm,e)}editAltText(e,t=!1){var n;(n=x(this,eh))==null||n.editAltText(this,e,t)}switchToMode(e,t){this._eventBus.on("annotationeditormodechanged",t,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:e})}setPreference(e,t){this._eventBus.dispatch("setpreference",{source:this,name:e,value:t})}onSetPreference({name:e,value:t}){switch(e){case"enableNewAltTextWhenAddingImage":P(this,nh,t);break}}onPageChanging({pageNumber:e}){P(this,rh,e-1)}focusMainContainer(){x(this,Da).focus()}findParent(e,t){for(const n of x(this,Pr).values()){const{x:s,y:i,width:o,height:l}=n.div.getBoundingClientRect();if(e>=s&&e<=s+o&&t>=i&&t<=i+l)return n}return null}disableUserSelect(e=!1){x(this,jm).classList.toggle("noUserSelect",e)}addShouldRescale(e){x(this,Ac).add(e)}removeShouldRescale(e){x(this,Ac).delete(e)}onScaleChanging({scale:e}){this.commitOrRemove(),this.viewParameters.realScale=e*Il.PDF_TO_CSS_UNITS;for(const t of x(this,Ac))t.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}highlightSelection(e=""){const t=document.getSelection();if(!t||t.isCollapsed)return;const{anchorNode:n,anchorOffset:s,focusNode:i,focusOffset:o}
1148=t,l=t.toString(),u=O(this,Ee,Ny).call(this,t).closest(".textLayer"),d=this.getSelectionBoxes(u);if(!d)return;t.empty();const h=O(this,Ee,rN).call(this,u),f=x(this,Nr)===Ge.NONE,p=()=>{h==null||h.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:d,anchorNode:n,anchorOffset:s,focusNode:i,focusOffset:o,text:l}),f&&this.showAllEditors("highlight",!0,!0)};if(f){this.switchToMode(Ge.HIGHLIGHT,p);return}p()}addToAnnotationStorage(e){!e.isEmpty()&&x(this,Aa)&&!x(this,Aa).has(e.id)&&x(this,Aa).setValue(e.id,e)}blur(){if(this.isShiftKeyDown=!1,x(this,Xo)&&(P(this,Xo,!1),O(this,Ee,Sy).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:e}=document;for(const t of x(this,mt))if(t.div.contains(e)){P(this,Tc,[t,e]),t._focusEventsAllowed=!1;break}}focus(){if(!x(this,Tc))return;const[e,t]=x(this,Tc);P(this,Tc,null),t.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),t.focus()}addEditListeners(){O(this,Ee,nN).call(this),O(this,Ee,sN).call(this)}removeEditListeners(){O(this,Ee,PP).call(this),O(this,Ee,iN).call(this)}dragOver(e){for(const{type:t}of e.dataTransfer.items)for(const n of x(this,ai))if(n.isHandlingMimeForPasting(t)){e.dataTransfer.dropEffect="copy",e.preventDefault();return}}drop(e){for(const t of e.dataTransfer.items)for(const n of x(this,ai))if(n.isHandlingMimeForPasting(t.type)){n.paste(t,this.currentLayer),e.preventDefault();return}}copy(e){var n;if(e.preventDefault(),(n=x(this,Qn))==null||n.commitOrRemove(),!this.hasSelection)return;const t=[];for(const s of x(this,mt)){const i=s.serialize(!0);i&&t.push(i)}t.length!==0&&e.clipboardData.setData("application/pdfjs",JSON.stringify(t))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();const{clipboardData:t}=e;for(const i of t.items)for(const o of x(this,ai))if(o.isHandlingMimeForPasting(i.type)){o.paste(i,this.currentLayer);return}let n=t.getData("application/pdfjs");if(!n)return;try{n=JSON.parse(n)}catch(i){Je(`paste: "${i.message}".`);return}if(!Array.isArray(n))return;this.unselectAll();const s=this.currentLayer;try{const i=[];for(const c of n){const u=await s.deserialize(c);if(!u)return;i.push(u)}const o=()=>{for(const c of i)O(this,Ee,aN).call(this,c);O(this,Ee,oN).call(this,i)},l=()=>{for(const c of i)c.remove()};this.addCommands({cmd:o,undo:l,mustExec:!0})}catch(i){Je(`paste: "${i.message}".`)}}keydown(e){!this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!0),x(this,Nr)!==Ge.NONE&&!this.isEditorHandlingKeyboard&&Fd._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!1,x(this,Xo)&&(P(this,Xo,!1),O(this,Ee,Sy).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}}setEditingState(e){e?(O(this,Ee,DP).call(this),O(this,Ee,sN).call(this),O(this,Ee,mn).call(this,{isEditing:x(this,Nr)!==Ge.NONE,isEmpty:O(this,Ee,np).call(this),hasSomethingToUndo:x(this,ii).hasSomethingToUndo(),hasSomethingToRedo:x(this,ii).hasSomethingToRedo(),hasSelectedEditor:!1})):(O(this,Ee,RP).call(this),O(this,Ee,iN).call(this),O(this,Ee,mn).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!x(this,ai)){P(this,ai,e);for(const t of x(this,ai))O(this,Ee,Do).call(this,t.defaultPropertiesToUpdate)}}getId(){return x(this,ox).id}get currentLayer(){return x(this,Pr).get(x(this,rh))}getLayer(e){return x(this,Pr).get(e)}get currentPageIndex(){return x(this,rh)}addLayer(e){x(this,Pr).set(e.pageIndex,e),x(this,Yo)?e.enable():e.disable()}removeLayer(e){x(this,Pr).delete(e.pageIndex)}async updateMode(e,t=null,n=!1){if(x(this,Nr)!==e&&!(x(this,ks)&&(await x(this,ks).promise,!x(this,ks)))){if(P(this,ks,Promise.withResolvers()),P(this,Nr,e),e===Ge.NONE){this.setEditingState(!1),O(this,Ee,OP).call(this),x(this,ks).resolve();return}this.setEditingState(!0),await O(this,Ee,LP).call(this),this.unselectAll();for(const s of x(this,Pr).values())s.updateMode(e);if(!t){n&&this.addNewEditorFromKeyboard(),x(this,ks).resolve();return}for(const s of x(this,ur).values())s.annotationElementId===t?(this.setSelected(s),s.enterInEditMode()):s.unselect();x(this,ks).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e!==x(this,Nr)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:e})}updateParams(e,t){var n;if(x(this,ai)){switch(e){case Ue.CREATE:this.currentLayer.addNewEditor();return;case Ue.HIGHLIGHT_DEFAULT_COLOR:(n=x(this,Sm))==null||n.updateColor(t);break;case Ue.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(x(this,Cm)||P(this,Cm,new Map)).set(e,t),this.showAllEditors("highlight",t);break}for(const s of x(this,mt))s.updateParams(e,t);for(const s of x(this,ai))s.updateDefaultParams(e,t)}}showAllEditors(e,t,n=!1){var i;for(const o of x(this,ur).values())o.editorType===e&&o.show(t);(((i=x(this,Cm))==null?void 0:i.get(Ue.HIGHLIGHT_SHOW_ALL))??!0)!==t&&O(this,Ee,Do).call(this,[[Ue.HIGHLIGHT_SHOW_ALL,t]])}enableWaiting(e=!1){if(x(this,Nm)!==e){P(this,Nm,e);for(const t of x(this,Pr).values())e?t.disableClick():t.enableClick(),t.div.classList.toggle("waiting",e)}}getEditors(e){const t=[];for(const n of x(this,ur).values())n.pageIndex===e&&t.push(n);return t}getEditor(e){return x(this,ur).get(e)}addEditor(e){x(this,ur).set(e.id,e)}removeEditor(e){var t;e.div.contains(document.activeElement)&&(x(this,$i)&&clearTimeout(x(this,$i)),P(this,$i,setTimeout(()=>{this.focusMainContainer(),P(this,$i,null)},0))),x(this,ur).delete(e.id),this.unselect(e),(!e.annotationElementId||!x(this,jc).has(e.annotationElementId))&&((t=x(this,Aa))==null||t.remove(e.id))}addDeletedAnnotationElement(e){x(this,jc).add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}
1148isDeletedAnnotationElement(e){return x(this,jc).has(e)}removeDeletedAnnotationElement(e){x(this,jc).delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}setActiveEditor(e){x(this,Qn)!==e&&(P(this,Qn,e),e&&O(this,Ee,Do).call(this,e.propertiesToUpdate))}updateUI(e){x(this,Ee,MP)===e&&O(this,Ee,Do).call(this,e.propertiesToUpdate)}toggleSelected(e){if(x(this,mt).has(e)){x(this,mt).delete(e),e.unselect(),O(this,Ee,mn).call(this,{hasSelectedEditor:this.hasSelection});return}x(this,mt).add(e),e.select(),O(this,Ee,Do).call(this,e.propertiesToUpdate),O(this,Ee,mn).call(this,{hasSelectedEditor:!0})}setSelected(e){for(const t of x(this,mt))t!==e&&t.unselect();x(this,mt).clear(),x(this,mt).add(e),e.select(),O(this,Ee,Do).call(this,e.propertiesToUpdate),O(this,Ee,mn).call(this,{hasSelectedEditor:!0})}isSelected(e){return x(this,mt).has(e)}get firstSelectedEditor(){return x(this,mt).values().next().value}unselect(e){e.unselect(),x(this,mt).delete(e),O(this,Ee,mn).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return x(this,mt).size!==0}get isEnterHandled(){return x(this,mt).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){x(this,ii).undo(),O(this,Ee,mn).call(this,{hasSomethingToUndo:x(this,ii).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:O(this,Ee,np).call(this)})}redo(){x(this,ii).redo(),O(this,Ee,mn).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:x(this,ii).hasSomethingToRedo(),isEmpty:O(this,Ee,np).call(this)})}addCommands(e){x(this,ii).add(e),O(this,Ee,mn).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:O(this,Ee,np).call(this)})}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const e=[...x(this,mt)],t=()=>{for(const s of e)s.remove()},n=()=>{for(const s of e)O(this,Ee,aN).call(this,s)};this.addCommands({cmd:t,undo:n,mustExec:!0})}commitOrRemove(){var e;(e=x(this,Qn))==null||e.commitOrRemove()}hasSomethingToControl(){return x(this,Qn)||this.hasSelection}selectAll(){for(const e of x(this,mt))e.commit();O(this,Ee,oN).call(this,x(this,ur).values())}unselectAll(){if(!(x(this,Qn)&&(x(this,Qn).commitOrRemove(),x(this,Nr)!==Ge.NONE))&&this.hasSelection){for(const e of x(this,mt))e.unselect();x(this,mt).clear(),O(this,Ee,mn).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(e,t,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;x(this,Jo)[0]+=e,x(this,Jo)[1]+=t;const[s,i]=x(this,Jo),o=[...x(this,mt)],l=1e3;x(this,Hi)&&clearTimeout(x(this,Hi)),P(this,Hi,setTimeout(()=>{P(this,Hi,null),x(this,Jo)[0]=x(this,Jo)[1]=0,this.addCommands({cmd:()=>{for(const c of o)x(this,ur).has(c.id)&&c.translateInPage(s,i)},undo:()=>{for(const c of o)x(this,ur).has(c.id)&&c.translateInPage(-s,-i)},mustExec:!1})},l));for(const c of o)c.translateInPage(e,t)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),P(this,Bi,new Map);for(const e of x(this,mt))x(this,Bi).set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!x(this,Bi))return!1;this.disableUserSelect(!1);const e=x(this,Bi);P(this,Bi,null);let t=!1;for(const[{x:s,y:i,pageIndex:o},l]of e)l.newX=s,l.newY=i,l.newPageIndex=o,t||(t=s!==l.savedX||i!==l.savedY||o!==l.savedPageIndex);if(!t)return!1;const n=(s,i,o,l)=>{if(x(this,ur).has(s.id)){const c=x(this,Pr).get(l);c?s._setParentAndPosition(c,i,o):(s.pageIndex=l,s.x=i,s.y=o)}};return this.addCommands({cmd:()=>{for(const[s,{newX:i,newY:o,newPageIndex:l}]of e)n(s,i,o,l)},undo:()=>{for(const[s,{savedX:i,savedY:o,savedPageIndex:l}]of e)n(s,i,o,l)},mustExec:!0}),!0}dragSelectedEditors(e,t){if(x(this,Bi))for(const n of x(this,Bi).keys())n.drag(e,t)}rebuild(e){if(e.parent===null){const t=this.getLayer(e.pageIndex);t?(t.changeParent(e),t.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){var e;return((e=this.getActive())==null?void 0:e.shouldGetKeyboardEvents())||x(this,mt).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return x(this,Qn)===e}getActive(){return x(this,Qn)}getMode(){return x(this,Nr)}get imageManager(){return it(this,"imageManager",new eN)}getSelectionBoxes(e){if(!e)return null;const t=document.getSelection();for(let u=0,d=t.rangeCount;u<d;u++)if(!e.contains(t.getRangeAt(u).commonAncestorContainer))return null;const{x:n,y:s,width:i,height:o}=e.getBoundingClientRect();let l;switch(e.getAttribute("data-main-rotation")){case"90":l=(u,d,h,f)=>({x:(d-s)/o,y:1-(u+h-n)/i,width:f/o,height:h/i});break;case"180":l=(u,d,h,f)=>({x:1-(u+h-n)/i,y:1-(d+f-s)/o,width:h/i,height:f/o});break;case"270":l=(u,d,h,f)=>({x:1-(d+f-s)/o,y:(u-n)/i,width:f/o,height:h/i});break;default:l=(u,d,h,f)=>({x:(u-n)/i,y:(d-s)/o,width:h/i,height:f/o});break}const c=[];for(let u=0,d=t.rangeCount;u<d;u++){const h=t.getRangeAt(u);if(!h.collapsed)for(const{x:f,y:p,width:m,height:g}of h.getClientRects())m===0||g===0||c.push(l(f,p,m,g))}return c.length===0?null:c}addChangedExistingAnnotation({annotationElementId:e,id:t}){(x(this,th)||P(this,th,new Map)).set(e,t)}removeChangedExistingAnnotation({annotationElementId:e}){var t;(t=x(this,th))==null||t.delete(e)}renderAnnotationElement(e){var s;const t=(s=x(this,th))==null?void 0:s.get(e.data.id);if(!t)return;const n=x(this,Aa).getRawValue(t);n&&(x(this,Nr)===Ge.NONE&&!n.hasBeenModified||n.renderAnnotationElement(e))}};Qd=new WeakMap,Qn=new WeakMap,ur=new WeakMap,Pr=new WeakMap,eh=new WeakMap,Aa=new WeakMap,th=new WeakMap,ii=new WeakMap,Vo=new WeakMap,rh=new WeakMap,jc=new WeakMap,Bi=new WeakMap,ai=new WeakMap,Ac=new WeakMap,vm=new WeakMap,wm=new WeakMap,nh=new WeakMap,_m=new WeakMap,$i=new WeakMap,Go=new WeakMap,sh=new WeakMap,Xo=new WeakMap,Ui=new WeakMap,ox=new WeakMap,Yo=new WeakMap,Nm=new WeakMap,Ko=new WeakMap,Tc=new WeakMap,Sm=new WeakMap,km=new WeakMap,Nr=new WeakMap,mt=new WeakMap,Ta=new WeakMap,Dc=new WeakMap,Cm=new WeakMap,Em=new WeakMap,Jo=new WeakMap,Hi=new WeakMap,Da=new WeakMap,jm=new WeakMap,ks=new WeakMap,Ee=new WeakSet,Ny=function({anchorNode:e}
1148){return e.nodeType===Node.TEXT_NODE?e.parentElement:e},rN=function(e){const{currentLayer:t}=this;if(t.hasTextLayer(e))return t;for(const n of x(this,Pr).values())if(n.hasTextLayer(e))return n;return null},jP=function(){const e=document.getSelection();if(!e||e.isCollapsed)return;const n=O(this,Ee,Ny).call(this,e).closest(".textLayer"),s=this.getSelectionBoxes(n);s&&(x(this,Ui)||P(this,Ui,new OW(this)),x(this,Ui).show(n,s,this.direction==="ltr"))},AP=function(){var i,o,l;const e=document.getSelection();if(!e||e.isCollapsed){x(this,Ta)&&((i=x(this,Ui))==null||i.hide(),P(this,Ta,null),O(this,Ee,mn).call(this,{hasSelectedText:!1}));return}const{anchorNode:t}=e;if(t===x(this,Ta))return;const s=O(this,Ee,Ny).call(this,e).closest(".textLayer");if(!s){x(this,Ta)&&((o=x(this,Ui))==null||o.hide(),P(this,Ta,null),O(this,Ee,mn).call(this,{hasSelectedText:!1}));return}if((l=x(this,Ui))==null||l.hide(),P(this,Ta,t),O(this,Ee,mn).call(this,{hasSelectedText:!0}),!(x(this,Nr)!==Ge.HIGHLIGHT&&x(this,Nr)!==Ge.NONE)&&(x(this,Nr)===Ge.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),P(this,Xo,this.isShiftKeyDown),!this.isShiftKeyDown)){const c=x(this,Nr)===Ge.HIGHLIGHT?O(this,Ee,rN).c
1148all(this,s):null;c==null||c.toggleDrawing();const u=new AbortController,d=this.combinedSignal(u),h=f=>{f.type==="pointerup"&&f.button!==0||(u.abort(),c==null||c.toggleDrawing(!0),f.type==="pointerup"&&O(this,Ee,Sy).call(this,"main_toolbar"))};window.addEventListener("pointerup",h,{signal:d}),window.addEventListener("blur",h,{signal:d})}},Sy=function(e=""){x(this,Nr)===Ge.HIGHLIGHT?this.highlightSelection(e):x(this,vm)&&O(this,Ee,jP).call(this)},TP=function(){document.addEventListener("selectionchange",O(this,Ee,AP).bind(this),{signal:this._signal})},DP=function(){if(x(this,Go))return;P(this,Go,new AbortController);const e=this.combinedSignal(x(this,Go));window.addEventListener("focus",this.focus.bind(this),{signal:e}),window.addEventListener("blur",this.blur.bind(this),{signal:e})},RP=function(){var e;(e=x(this,Go))==null||e.abort(),P(this,Go,null)},nN=function(){if(x(this,Ko))return;P(this,Ko,new AbortController);const e=this.combinedSignal(x(this,Ko));window.addEventListener("keydown",this.keydown.bind(this),{signal:e}),window.addEventListener("keyup",this.keyup.bind(this),{signal:e})},PP=function(){var e;(e=x(this,Ko))==null||e.abort(),P(this,Ko,null)},sN=function(){if(x(this,Vo))return;P(this,Vo,new AbortController);const e=this.combinedSignal(x(this,Vo));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})},iN=function(){var e;(e=x(this,Vo))==null||e.abort(),P(this,Vo,null)},IP=function(){const e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e}),document.addEventListener("drop",this.drop.bind(this),{signal:e})},mn=function(e){Object.entries(e).some(([n,s])=>x(this,Em)[n]!==s)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(x(this,Em),e)}),x(this,Nr)===Ge.HIGHLIGHT&&e.hasSelectedEditor===!1&&O(this,Ee,Do).call(this,[[Ue.HIGHLIGHT_FREE,!0]]))},Do=function(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})},LP=async function(){if(!x(this,Yo)){P(this,Yo,!0);const e=[];for(const t of x(this,Pr).values())e.push(t.enable());await Promise.all(e);for(const t of x(this,ur).values())t.enable()}},OP=function(){if(this.unselectAll(),x(this,Yo)){P(this,Yo,!1);for(const e of x(this,Pr).values())e.disable();for(const e of x(this,ur).values())e.disable()}},aN=function(e){const t=x(this,Pr).get(e.pageIndex);t?t.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))},MP=function(){let e=null;for(e of x(this,mt));return e},np=function(){if(x(this,ur).size===0)return!0;if(x(this,ur).size===1)for(const e of x(this,ur).values())return e.isEmpty();return!1},oN=function(e){for(const t of x(this,mt))t.unselect();x(this,mt).clear();for(const t of e)t.isEmpty()||(x(this,mt).add(t),t.select());O(this,Ee,mn).call(this,{hasSelectedEditor:this.hasSelection})},Re(Fd,"TRANSLATE_SMALL",1),Re(Fd,"TRANSLATE_BIG",10);let Lu=Fd;var Sr,zi,oi,qi,es,ih,Wi,Tn,Ra,Rc,Vi,ah,ua,ky,Cy;const vr=class vr{constructor(e){$(this,ua);$(this,Sr,null);$(this,zi,!1);$(this,oi,null);$(this,qi,null);$(this,es,null);$(this,ih,!1);$(this,Wi,null);$(this,Tn,null);$(this,Ra,null);$(this,Rc,null);$(this,Vi,!1);P(this,Tn,e),P(this,Vi,e._uiManager.useNewAltTextFlow),x(vr,ah)||P(vr,ah,Object.freeze({added:"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button-label"}))}static initialize(e){vr._l10nPromise||(vr._l10nPromise=e)}async render(){const e=P(this,oi,document.createElement("button"));e.className="altText";let t;x(this,Vi)?(e.classList.add("new"),t=await vr._l10nPromise.get(x(vr,ah).missing)):t=await vr._l10nPromise.get("pdfjs-editor-alt-text-button-label"),e.textContent=t,e.setAttribute("aria-label",t),e.tabIndex="0";const n=x(this,Tn)._uiManager._signal;e.addEventListener("contextmenu",Gs,{signal:n}),e.addEventListener("pointerdown",i=>i.stopPropagation(),{signal:n});const s=i=>{i.preventDefault(),x(this,Tn)._uiManager.editAltText(x(this,Tn)),x(this,Vi)&&x(this,Tn)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:x(this,ua,ky)}})};
1148return e.addEventListener("click",s,{capture:!0,signal:n}),e.addEventListener("keydown",i=>{i.target===e&&i.key==="Enter"&&(P(this,ih,!0),s(i))},{signal:n}),await O(this,ua,Cy).call(this),e}finish(){x(this,oi)&&(x(this,oi).focus({focusVisible:x(this,ih)}),P(this,ih,!1))}isEmpty(){return x(this,Vi)?x(this,Sr)===null:!x(this,Sr)&&!x(this,zi)}hasData(){return x(this,Vi)?x(this,Sr)!==null||!!x(this,Ra):this.isEmpty()}get guessedText(){return x(this,Ra)}async setGuessedText(e){x(this,Sr)===null&&(P(this,Ra,e),P(this,Rc,await vr._l10nPromise.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer")({generatedAltText:e})),O(this,ua,Cy).call(this))}toggleAltTextBadge(e=!1){var t;if(!x(this,Vi)||x(this,Sr)){(t=x(this,Wi))==null||t.remove(),P(this,Wi,null);return}if(!x(this,Wi)){const n=P(this,Wi,document.createElement("div"));n.className="noAltTextBadge",x(this,Tn).div.append(n)}x(this,Wi).classList.toggle("hidden",!e)}serialize(e){let t=x(this,Sr);return!e&&x(this,Ra)===t&&(t=x(this,Rc)),{altText:t,decorative:x(this,zi),guessedText:x(this,Ra),textWithDisclaimer:x(this,Rc)}}get data(){return{altText:x(this,Sr),decorative:x(this,zi)}}set data({altText:e,decorative:t,guessedText:n,textWithDisclaimer:s,cancel:i=!1}){n&&(P(this,Ra,n),P(this,Rc,s)),!(x(this,Sr)===e&&x(this,zi)===t)&&(i||(P(this,Sr,e),P(this,zi,t)),O(this,ua,Cy).call(this))}toggle(e=!1){x(this,oi)&&(!e&&x(this,es)&&(clearTimeout(x(this,es)),P(this,es,null)),x(this,oi).disabled=!e)}shown(){x(this,Tn)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:x(this,ua,ky)}})}destroy(){var e,t;(e=x(this,oi))==null||e.remove(),P(this,oi,null),P(this,qi,null),(t=x(this,Wi))==null||t.remove(),P(this,Wi,null)}};Sr=new WeakMap,zi=new WeakMap,oi=new WeakMap,qi=new WeakMap,es=new WeakMap,ih=new WeakMap,Wi=new WeakMap,Tn=new WeakMap,Ra=new WeakMap,Rc=new WeakMap,Vi=new WeakMap,ah=new WeakMap,ua=new WeakSet,ky=function(){return x(this,Sr)&&"added"||x(this,Sr)===null&&this.guessedText&&"review"||"missing"},Cy=async function(){var s,i;const e=x(this,oi);if(!e)return;if(x(this,Vi)){if(e.classList.toggle("done",!!x(this,Sr)),vr._l10nPromise.get(x(vr,ah)[x(this,ua,ky)]).then(o=>{e.setAttribute("aria-label",o);for(const l of e.childNodes)if(l.nodeType===Node.TEXT_NODE){l.textContent=o;break}}),!x(this,Sr)){(s=x(this,qi))==null||s.remove();return}}else{if(!x(this,Sr)&&!x(this,zi)){e.classList.remove("done"),(i=x(this,qi))==null||i.remove();return}e.classList.add("done"),vr._l10nPromise.get("pdfjs-editor-alt-text-edit-button-label").then(o=>{e.setAttribute("aria-label",o)})}let t=x(this,qi);if(!t){P(this,qi,t=document.createElement("span")),t.className="tooltip",t.setAttribute("role","tooltip"),t.id=`alt-text-tooltip-${x(this,Tn).id}`;const o=100,l=x(this,Tn)._uiManager._signal;l.addEventListener("abort",()=>{clearTimeout(x(this,es)),P(this,es,null)},{once:!0}),e.addEventListener("mouseenter",()=>{P(this,es,setTimeout(()=>{P(this,es,null),x(this,qi).classList.add("show"),x(this,Tn)._reportTelemetry({action:"alt_text_tooltip"})},o))},{signal:l}),e.addEventListener("mouseleave",()=>{var c;x(this,es)&&(clearTimeout(x(this,es)),P(this,es,null)),(c=x(this,qi))==null||c.classList.remove("show")},{signal:l})}t.innerText=x(this,zi)?await vr._l10nPromise.get("pdfjs-editor-alt-text-decorative-tooltip"):x(this,Sr),t.parentNode||e.append(t);const n=x(this,Tn).getImageForAltText();n==null||n.setAttribute("aria-describedby",t.id)},$(vr,ah,null),Re(vr,"_l10nPromise",null);let Bb=vr;var Pc,li,zt,oh,Ic,Ir,Lc,Zo,Am,Oc,Qo,Tm,Mc,Pa,Gi,lh,ch,Cs,Dm,lx,Ye,lN,Rm,cN,uN,FP,BP,dN,hN,fN,$P,pN,UP,HP,zP,mN,sp;const ct=class ct{constructor(e){$(this,Ye);$(this,Pc,null);$(this,li,null);$(this,zt,null);$(this,oh,!1);$(this,Ic,!1);$(this,Ir,null);$(this,Lc,null);$(this,Zo,null);$(this,Am,"");$(this,Oc,!1);$(this,Qo,null);$(this,Tm,!1);$(this,Mc,!1);$(this,Pa,!1);$(this,Gi,null);$(this,lh,0);$(this,ch,0);$(this,Cs,null);Re(this,"_editToolbar",null);Re(this,"_initialOptions",Object.create(null));Re(this,"_initialData",null);Re(this,"_isVisible",!0);Re(this,"_uiManager",null);Re(this,"_focusEventsAllowed",!0);$(this,Dm,!1);$(this,lx,ct._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;const{rotation:t,rawDims:{pageWidth:n,pageHeight:s,pageX:i,pageY:o}}=this.parent.viewport;this.rotation=t,this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,s],this.pageTranslation=[i,o];const[l,c]=this.parentDimensions;this.x=e.x/l,this.y=e.y/c,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const e=ct.prototype._resizeWithKeyboard,t=Lu.TRANSLATE_SMALL,n=Lu.TRANSLATE_BIG;
1148return it(this,"_resizerKeyboardManager",new Kg([[["ArrowLeft","mac+ArrowLeft"],e,{args:[-t,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e,{args:[-n,0]}],[["ArrowRight","mac+ArrowRight"],e,{args:[t,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e,{args:[n,0]}],[["ArrowUp","mac+ArrowUp"],e,{args:[0,-t]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e,{args:[0,-n]}],[["ArrowDown","mac+ArrowDown"],e,{args:[0,t]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e,{args:[0,n]}],[["Escape","mac+Escape"],ct.prototype._stopResizingWithKeyboard]]))}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return it(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){const t=new $W({id:e.parent.getNextId(),parent:e.parent,uiManager:e._uiManager});t.annotationElementId=e.annotationElementId,t.deleted=!0,t._uiManager.addToAnnotationStorage(t)}static initialize(e,t,n){if(ct._l10nResizer||(ct._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"})),ct._l10nPromise||(ct._l10nPromise=new Map([...["pdfjs-editor-alt-text-button-label","pdfjs-editor-alt-text-edit-button-label","pdfjs-editor-alt-text-decorative-tooltip","pdfjs-editor-new-alt-text-added-button-label","pdfjs-editor-new-alt-text-missing-button-label","pdfjs-editor-new-alt-text-to-review-button-label"].map(i=>[i,e.get(i)]),...["pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer"].map(i=>[i,e.get.bind(e,i)])])),n!=null&&n.strings)for(const i of n.strings)ct._l10nPromise.set(i,e.get(i));if(ct._borderLineWidth!==-1)return;const s=getComputedStyle(document.documentElement);ct._borderLineWidth=parseFloat(s.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,t){ar("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return x(this,Dm)}set _isDraggable(e){var t;P(this,Dm,e),(t=this.div)==null||t.classList.toggle("draggable",e)}get isEnterHandled(){return!0}center(){const[e,t]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*t/(e*2),this.y+=this.width*e/(t*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*t/(e*2),this.y-=this.width*e/(t*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=x(this,lx)}setParent(e){e!==null?(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions):O(this,Ye,sp).call(this),this.parent=e}focusin(e){this._focusEventsAllowed&&(x(this,Oc)?P(this,Oc,!1):this.parent.setSelected(this))}focusout(e){var n;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const t=e.relatedTarget;t!=null&&t.closest(`#${this.id}`)||(e.preventDefault(),(n=this.parent)!=null&&n.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,t,n,s){const[i,o]=this.parentDimensions;[n,s]=this.screenToPageTranslation(n,s),this.x=(e+n)/i,this.y=(t+s)/o,this.fixAndSetPosition()}translate(e,t){O(this,Ye,lN).call(this,this.parentDimensions,e,t)}translateInPage(e,t){x(this,Qo)||P(this,Qo,[this.x,this.y]),O(this,Ye,lN).call(this,this.pageDimensions,e,t),this.div.scrollIntoView({block:"nearest"})}drag(e,t){x(this,Qo)||P(this,Qo,[this.x,this.y]);const[n,s]=this.parentDimensions;if(this.x+=e/n,this.y+=t/s,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:u,y:d}=this.div.getBoundingClientRect();this.parent.findNewParent(this,u,d)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:i,y:o}=this;const[l,c]=this.getBaseTranslation();i+=l,o+=c,this.div.style.left=`${(100*i).toFixed(2)}%`,this.div.style.top=`${(100*o).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!x(this,Qo)&&(x(this,Qo)[0]!==this.x||x(this,Qo)[1]!==this.y)}getBaseTranslation(){const[e,t]=this.parentDimensions,{_borderLineWidth:n}=ct,s=n/e,i=n/t;switch(this.rotation){case 90:return[-s,i];case 180:return[s,i];case 270:return[s,-i];default:return[-s,-i]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){const[t,n]=this.pageDimensions;let{x:s,y:i,width:o,height:l}=this;if(o*=t,l*=n,s*=t,i*=n,this._mustFixPosition)switch(e){case 0:s=Math.max(0,Math.min(t-o,s)),i=Math.max(0,Math.min(n-l,i));break;case 90:s=Math.max(0,Math.min(t-l,s)),i=Math.min(n,Math.max(o,i));break;
1148case 180:s=Math.min(t,Math.max(o,s)),i=Math.min(n,Math.max(l,i));break;case 270:s=Math.min(t,Math.max(l,s)),i=Math.max(0,Math.min(n-o,i));break}this.x=s/=t,this.y=i/=n;const[c,u]=this.getBaseTranslation();s+=c,i+=u;const{style:d}=this.div;d.left=`${(100*s).toFixed(2)}%`,d.top=`${(100*i).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(e,t){var n;return O(n=ct,Rm,cN).call(n,e,t,this.parentRotation)}pageTranslationToScreen(e,t){var n;return O(n=ct,Rm,cN).call(n,e,t,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:[t,n]}=this;return[t*e,n*e]}setDims(e,t){const[n,s]=this.parentDimensions;this.div.style.width=`${(100*e/n).toFixed(2)}%`,x(this,Ic)||(this.div.style.height=`${(100*t/s).toFixed(2)}%`)}fixDims(){const{style:e}=this.div,{height:t,width:n}=e,s=n.endsWith("%"),i=!x(this,Ic)&&t.endsWith("%");if(s&&i)return;const[o,l]=this.parentDimensions;s||(e.width=`${(100*parseFloat(n)/o).toFixed(2)}%`),!x(this,Ic)&&!i&&(e.height=`${(100*parseFloat(t)/l).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}altTextFinish(){var e;(e=x(this,zt))==null||e.finish()}async addEditToolbar(){return this._editToolbar||x(this,Mc)?this._editToolbar:(this._editToolbar=new Z_(this),this.div.append(this._editToolbar.render()),x(this,zt)&&await this._editToolbar.addAltText(x(this,zt)),this._editToolbar)}removeEditToolbar(){var e;this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,(e=x(this,zt))==null||e.destroy())}addContainer(e){var n;const t=(n=this._editToolbar)==null?void 0:n.div;t?t.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){x(this,zt)||(Bb.initialize(ct._l10nPromise),P(this,zt,new Bb(this)),x(this,Pc)&&(x(this,zt).data=x(this,Pc),P(this,Pc,null)),await this.addEditToolbar())}get altTextData(){var e;return(e=x(this,zt))==null?void 0:e.data}set altTextData(e){x(this,zt)&&(x(this,zt).data=e)}get guessedAltText(){var e;return(e=x(this,zt))==null?void 0:e.guessedText}async setGuessedAltText(e){var t;await((t=x(this,zt))==null?void 0:t.setGuessedText(e))}serializeAltText(e){var t;return(t=x(this,zt))==null?void 0:t.serialize(e)}hasAltText(){return!!x(this,zt)&&!x(this,zt).isEmpty()}hasAltTextData(){var e;return((e=x(this,zt))==null?void 0:e.hasData())??!1}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.tabIndex=x(this,oh)?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),O(this,Ye,pN).call(this);const[e,t]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*t/e).toFixed(2)}%`,this.div.style.maxHeight=`${(100*e/t).toFixed(2)}%`);const[n,s]=this.getInitialTranslation();return this.translate(n,s),Fb(this,this.div,["pointerdown"]),this.div}pointerdown(e){const{isMac:t}=zn.platform;if(e.button!==0||e.ctrlKey&&t){e.preventDefault();return}if(P(this,Oc,!0),this._isDraggable){O(this,Ye,$P).call(this,e);return}O(this,Ye,fN).call(this,e)}moveInDOM(){x(this,Gi)&&clearTimeout(x(this,Gi)),P(this,Gi,setTimeout(()=>{var e;P(this,Gi,null),(e=this.parent)==null||e.moveEditorInDOM(this)},0))}_setParentAndPosition(e,t,n){e.changeParent(this),this.x=t,this.y=n,this.fixAndSetPosition()}getRect(e,t,n=this.rotation){const s=this.parentScale,[i,o]=this.pageDimensions,[l,c]=this.pageTranslation,u=e/s,d=t/s,h=this.x*i,f=this.y*o,p=this.width*i,m=this.height*o;switch(n){case 0:return[h+u+l,o-f-d-m+c,h+u+p+l,o-f-d+c];case 90:return[h+d+l,o-f+u+c,h+d+m+l,o-f+u+p+c];case 180:return[h-u-p+l,o-f+d+c,h-u+l,o-f+d+m+c];case 270:return[h-d-m+l,o-f-u-p+c,h-d+l,o-f-u+c];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,t){const[n,s,i,o]=e,l=i-n,c=o-s;switch(this.rotation){case 0:return[n,t-o,l,c];case 90:return[n,t-s,c,l];case 180:return[i,t-s,l,c];case 270:return[i,t-o,c,l];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){P(this,Mc,!0)}disableEditMode(){P(this,Mc,!1)}isInEditMode(){return x(this,Mc)}shouldGetKeyboardEvents(){return x(this,Pa)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){O(this,Ye,pN).call(this)}rotate(e){}serializeDeleted(){var e;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:((e=this._initialData)==null?void 0:e.popupRef)||""}}serialize(e=!1,t=null){ar("An editor must be serializable")}static async deserialize(e,t,n){const s=new this.prototype.constructor({parent:t,id:t.getNextId(),uiManager:n});s.rotation=e.rotation,P(s,Pc,e.accessibilityData);const[i,o]=s.pageDimensions,[l,c,u,d]=s.getRectInCurrentCoords(e.rect,o);return s.x=l/i,s.y=c/o,s.width=u/i,s.height=d/o,s}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var e;
1148if((e=x(this,Zo))==null||e.abort(),P(this,Zo,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),x(this,Gi)&&(clearTimeout(x(this,Gi)),P(this,Gi,null)),O(this,Ye,sp).call(this),this.removeEditToolbar(),x(this,Cs)){for(const t of x(this,Cs).values())clearTimeout(t);P(this,Cs,null)}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(O(this,Ye,FP).call(this),x(this,Ir).classList.remove("hidden"),Fb(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(e){if(!this.isResizable||e.target!==this.div||e.key!=="Enter")return;this._uiManager.setSelected(this),P(this,Lc,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const t=x(this,Ir).children;if(!x(this,li)){P(this,li,Array.from(t));const o=O(this,Ye,UP).bind(this),l=O(this,Ye,HP).bind(this),c=this._uiManager._signal;for(const u of x(this,li)){const d=u.getAttribute("data-resizer-name");u.setAttribute("role","spinbutton"),u.addEventListener("keydown",o,{signal:c}),u.addEventListener("blur",l,{signal:c}),u.addEventListener("focus",O(this,Ye,zP).bind(this,d),{signal:c}),u.setAttribute("data-l10n-id",ct._l10nResizer[d])}}const n=x(this,li)[0];let s=0;for(const o of t){if(o===n)break;s++}const i=(360-this.rotation+this.parentRotation)%360/90*(x(this,li).length/4);if(i!==s){if(i<s)for(let l=0;l<s-i;l++)x(this,Ir).append(x(this,Ir).firstChild);else if(i>s)for(let l=0;l<i-s;l++)x(this,Ir).firstChild.before(x(this,Ir).lastChild);let o=0;for(const l of t){const u=x(this,li)[o++].getAttribute("data-resizer-name");l.setAttribute("data-l10n-id",ct._l10nResizer[u])}}O(this,Ye,mN).call(this,0),P(this,Pa,!0),x(this,Ir).firstChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}_resizeWithKeyboard(e,t){x(this,Pa)&&O(this,Ye,hN).call(this,x(this,Am),{movementX:e,movementY:t})}_stopResizingWithKeyboard(){O(this,Ye,sp).call(this),this.div.focus()}select(){var e,t,n;if(this.makeResizable(),(e=this.div)==null||e.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{var s,i;(s=this.div)!=null&&s.classList.contains("selectedEditor")&&((i=this._editToolbar)==null||i.show())});return}(t=this._editToolbar)==null||t.show(),(n=x(this,zt))==null||n.toggleAltTextBadge(!1)}unselect(){var e,t,n,s,i;(e=x(this,Ir))==null||e.classList.add("hidden"),(t=this.div)==null||t.classList.remove("selectedEditor"),(n=this.div)!=null&&n.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(s=this._editToolbar)==null||s.hide(),(i=x(this,zt))==null||i.toggleAltTextBadge(!0)}updateParams(e,t){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return x(this,Tm)}set isEditing(e){P(this,Tm,e),this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(e,t){P(this,Ic,!0);const n=e/t,{style:s}=this.div;s.aspectRatio=n,s.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(e,t=!1){if(t){x(this,Cs)||P(this,Cs,new Map);const{action:n}=e;let s=x(this,Cs).get(n);s&&clearTimeout(s),s=setTimeout(()=>{this._reportTelemetry(e),x(this,Cs).delete(n),x(this,Cs).size===0&&P(this,Cs,null)},ct._telemetryTimeout),x(this,Cs).set(n,s);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),P(this,oh,!1)}disable(){this.div&&(this.div.tabIndex=-1),P(this,oh,!0)}renderAnnotationElement(e){let t=e.container.querySelector(".annotationContent");if(!t)t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),e.container.prepend(t);else if(t.nodeName==="CANVAS"){const n=t;t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),n.before(t)}return t}resetAnnotationElement(e){const{firstChild:t}=e.container;(t==null?void 0:t.nodeName)==="DIV"&&t.classList.contains("annotationContent")&&t.remove()}};Pc=new WeakMap,li=new WeakMap,zt=new WeakMap,oh=new WeakMap,Ic=new WeakMap,Ir=new WeakMap,Lc=new WeakMap,Zo=new WeakMap,Am=new WeakMap,Oc=new WeakMap,Qo=new WeakMap,Tm=new WeakMap,Mc=new WeakMap,Pa=new WeakMap,Gi=new WeakMap,lh=new WeakMap,ch=new WeakMap,Cs=new WeakMap,Dm=new WeakMap,lx=new WeakMap,Ye=new WeakSet,lN=function([e,t],n,s){[n,s]=this.screenToPageTranslation(n,s),this.x+=n/e,this.y+=s/t,this.fixAndSetPosition()},Rm=new WeakSet,cN=function(e,t,n){switch(n){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}},uN=function(e){switch(e){case 90:{const[t,n]=this.pageDimensions;return[0,-t/n,n/t,0]}case 180:return[-1,0,0,-1];case 270:{const[t,n]=this.pageDimensions;return[0,t/n,-n/t,0]}default:return[1,0,0,1]}},FP=function(){if(x(this,Ir))return;P(this,Ir,document.createElement("div")),x(this,Ir).classList.add("resizers");const e=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],t=this._uiManager._signal;for(const n of e){const s=document.createElement("div");x(this,Ir).append(s),s.classList.add("resizer",n),s.setAttribute("data-resizer-name",n),s.addEventListener("pointerdown",O(this,Ye,BP).bind(this,n),{signal:t}),s.addEventListener("contextmenu",Gs,{signal:t}),s.tabIndex=-1}this.div.prepend(x(this,Ir))},BP=function(e,t){var m;t.preventDefault();const{isMac:n}=zn.platform;if(t.button!==0||t.ctrlKey&&n)return;(m=x(this,zt))==null||m.toggle(!1);const s=this._isDraggable;this._isDraggable=!1;const i=new AbortController,o=this._uiManager.combinedSignal(i);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",O(this,Ye,hN).bind(this,e),{passive:!0,capture:!0,signal:o}),window.addEventListener("contextmenu",Gs,{signal:o});const l=this.x,c=this.y,u=this.width,d=this.height,h=this.parent.div.style.cursor,f=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;const p=()=>{var g;i.abort(),this.parent.togglePointerEvents(!0),(g=x(this,zt))==null||g.toggle(!0),this._isDraggable=s,this.parent.div.style.cursor=h,this.div.style.cursor=f,O(this,Ye,dN).call(this,l,c,u,d)};window.addEventListener("pointerup",p,{signal:o}),window.addEventListener("blur",p,{signal:o})},dN=function(e,t,n,s){const i=this.x,o=this.y,l=this.width,c=this.height;i===e&&o===t&&l===n&&c===s||this.addCommands({cmd:()=>{this.width=l,this.height=c,this.x=i,this.y=o;const[u,d]=this.parentDimensions;this.setDims(u*l,d*c),this.fixAndSetPosition()},undo:()=>{this.width=n,this.height=s,this.x=e,this.y=t;const[u,d]=this.parentDimensions;this.setDims(u*n,d*s),this.fixAndSetPosition()},mustExec:!0})},hN=function(e,t){const[n,s]=this.parentDimensions,i=this.x,o=this.y,l=this.width,c=this.height,u=ct.MIN_SIZE/n,d=ct.MIN_SIZE/s,h=B=>Math.round(B*1e4)/1e4,f=O(this,Ye,uN).call(this,this.rotation),p=(B,I)=>[f[0]*B+f[2]*I,f[1]*B+f[3]*I],m=O(this,Ye,uN).call(this,360-this.rotation),g=(B,I)=>[m[0]*B+m[2]*I,m[1]*B+m[3]*I];let v,b,y=!1,w=!1;switch(e){case"topLeft":y=!0,v=(B,I)=>[0,0],b=(B,I)=>[B,I];break;case"topMiddle":v=(B,I)=>[B/2,0],b=(B,I)=>[B/2,I];break;case"topRight":y=!0,v=(B,I)=>[B,0],b=(B,I)=>[0,I];break;case"middleRight":w=!0,v=(B,I)=>[B,I/2],b=(B,I)=>[0,I/2];break;case"bottomRight":y=!0,v=(B,I)=>[B,I],b=(B,I)=>[0,0];break;case"bottomMiddle":v=(B,I)=>[B/2,I],b=(B,I)=>[B/2,0];break;case"bottomLeft":y=!0,v=(B,I)=>[0,I],b=(B,I)=>[B,0];break;case"middleLeft":w=!0,v=(B,I)=>[0,I/2],b=(B,I)=>[B,I/2];break}const _=v(l,c),N=b(l,c);let S=p(...N);const E=h(i+S[0]),T=h(o+S[1]);let D=1,R=1,[H,A]=this.screenToPageTranslation(t.movementX,t.movementY);if([H,A]=g(H/n,A/s),y){const B=Math.hypot(l,c);D=R=Math.max(Math.min(Math.hypot(N[0]-_[0]-H,N[1]-_[1]-A)/B,1/l,1/c),u/l,d/c)}else w?D=Math.max(u,Math.min(1,Math.abs(N[0]-_[0]-H)))/l:R=Math.max(d,Math.min(1,Math.abs(N[1]-_[1]-A)))/c;const U=h(l*D),C=h(c*R);S=p(...b(U,C));const M=E-S[0],L=T-S[1];this.width=U,this.height=C,this.x=M,this.y=L,this.setDims(n*U,s*C),this.fixAndSetPosition()},fN=function(e){const{isMac:t}=zn.platform;e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this)},$P=function(e){const t=this._uiManager.isSelected(this);this._uiManager.setUpDragSession();const n=new AbortController,s=this._uiManager.combinedSignal(n);if(t){this.div.classList.add("moving"),P(this,lh,e.clientX),P(this,ch,e.clientY);const o=l=>{const{clientX:c,clientY:u}=l,[d,h]=this.screenToPageTranslation(c-x(this,lh),u-x(this,ch));P(this,lh,c),P(this,ch,u),this._uiManager.dragSelectedEditors(d,h)};window.addEventListener("pointermove",o,{passive:!0,capture:!0,signal:s})}const i=()=>{n.abort(),t&&this.div.classList.remove("moving"),P(this,Oc,!1),this._uiManager.endDragSession()||O(this,Ye,fN).call(this,e)};window.addEventListener("pointerup",i,{signal:s}),window.addEventListener("blur",i,{signal:s})},pN=function(){if(x(this,Zo)||!this.div)return;P(this,Zo,new AbortController);
1148const e=this._uiManager.combinedSignal(x(this,Zo));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:e}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:e})},UP=function(e){ct._resizerKeyboardManager.exec(this,e)},HP=function(e){var t;x(this,Pa)&&((t=e.relatedTarget)==null?void 0:t.parentNode)!==x(this,Ir)&&O(this,Ye,sp).call(this)},zP=function(e){P(this,Am,x(this,Pa)?e:"")},mN=function(e){if(x(this,li))for(const t of x(this,li))t.tabIndex=e},sp=function(){if(P(this,Pa,!1),O(this,Ye,mN).call(this,-1),x(this,Lc)){const{savedX:e,savedY:t,savedWidth:n,savedHeight:s}=x(this,Lc);O(this,Ye,dN).call(this,e,t,n,s),P(this,Lc,null)}},$(ct,Rm),Re(ct,"_l10nPromise",null),Re(ct,"_l10nResizer",null),Re(ct,"_borderLineWidth",-1),Re(ct,"_colorManager",new tN),Re(ct,"_zIndex",1),Re(ct,"_telemetryTimeout",1e3);let dt=ct;class $W extends dt{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const KA=3285377520,ws=4294901760,Ii=65535;class qP{constructor(e){this.h1=e?e&4294967295:KA,this.h2=e?e&4294967295:KA}update(e){let t,n;if(typeof e=="string"){t=new Uint8Array(e.length*2),n=0;for(let g=0,v=e.length;g<v;g++){const b=e.charCodeAt(g);b<=255?t[n++]=b:(t[n++]=b>>>8,t[n++]=b&255)}}else if(ArrayBuffer.isView(e))t=e.slice(),n=t.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const s=n>>2,i=n-s*4,o=new Uint32Array(t.buffer,0,s);let l=0,c=0,u=this.h1,d=this.h2;const h=3432918353,f=461845907,p=h&Ii,m=f&Ii;for(let g=0;g<s;g++)g&1?(l=o[g],l=l*h&ws|l*p&Ii,l=l<<15|l>>>17,l=l*f&ws|l*m&Ii,u^=l,u=u<<13|u>>>19,u=u*5+3864292196):(c=o[g],c=c*h&ws|c*p&Ii,c=c<<15|c>>>17,c=c*f&ws|c*m&Ii,d^=c,d=d<<13|d>>>19,d=d*5+3864292196);switch(l=0,i){case 3:l^=t[s*4+2]<<16;case 2:l^=t[s*4+1]<<8;case 1:l^=t[s*4],l=l*h&ws|l*p&Ii,l=l<<15|l>>>17,l=l*f&ws|l*m&Ii,s&1?u^=l:d^=l}this.h1=u,this.h2=d}hexdigest(){let e=this.h1,t=this.h2;return e^=t>>>1,e=e*3981806797&ws|e*36045&Ii,t=t*4283543511&ws|((t<<16|e>>>16)*2950163797&ws)>>>16,e^=t>>>1,e=e*444984403&ws|e*60499&Ii,t=t*3301882366&ws|((t<<16|e>>>16)*3120437893&ws)>>>16,e^=t>>>1,(e>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}const gN=Object.freeze({map:null,hash:"",transfer:void 0});var Fc,Bc,kr,cx,WP;class Hk{constructor(){$(this,cx);$(this,Fc,!1);$(this,Bc,null);$(this,kr,new Map);this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(e,t){const n=x(this,kr).get(e);return n===void 0?t:Object.assign(t,n)}getRawValue(e){return x(this,kr).get(e)}remove(e){if(x(this,kr).delete(e),x(this,kr).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const t of x(this,kr).values())if(t instanceof dt)return;this.onAnnotationEditor(null)}}setValue(e,t){const n=x(this,kr).get(e);let s=!1;if(n!==void 0)for(const[i,o]of Object.entries(t))n[i]!==o&&(s=!0,n[i]=o);else s=!0,x(this,kr).set(e,t);s&&O(this,cx,WP).call(this),t instanceof dt&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(t.constructor._type)}has(e){return x(this,kr).has(e)}getAll(){return x(this,kr).size>0?Ok(x(this,kr)):null}setAll(e){for(const[t,n]of Object.entries(e))this.setValue(t,n)}get size(){return x(this,kr).size}resetModified(){x(this,Fc)&&(P(this,Fc,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new VP(this)}get serializable(){if(x(this,kr).size===0)return gN;const e=new Map,t=new qP,n=[],s=Object.create(null);let i=!1;for(const[o,l]of x(this,kr)){const c=l instanceof dt?l.serialize(!1,s):l;c&&(e.set(o,c),t.update(`${o}:${JSON.stringify(c)}`),i||(i=!!c.bitmap))}if(i)for(const o of e.values())o.bitmap&&n.push(o.bitmap);return e.size>0?{map:e,hash:t.hexdigest(),transfer:n}:gN}get editorStats(){let e=null;const t=new Map;for(const n of x(this,kr).values()){if(!(n instanceof dt))continue;const s=n.telemetryFinalData;if(!s)continue;const{type:i}=s;t.has(i)||t.set(i,Object.getPrototypeOf(n).constructor),e||(e=Object.create(null));const o=e[i]||(e[i]=new Map);for(const[l,c]of Object.entries(s)){if(l==="type")continue;let u=o.get(l);u||(u=new Map,o.set(l,u));const d=u.get(c)??0;u.set(c,d+1)}}for(const[n,s]of t)e[n]=s.computeTelemetryFinalData(e[n]);return e}resetModifiedIds(){P(this,Bc,null)}get modifiedIds(){if(x(this,Bc))return x(this,Bc);const e=[];for(const t of x(this,kr).values())!(t instanceof dt)||!t.annotationElementId||!t.serialize()||e.push(t.annotationElementId);return P(this,Bc,{ids:new Set(e),hash:e.join(",")})}}Fc=new WeakMap,Bc=new WeakMap,kr=new WeakMap,cx=new WeakSet,WP=function(){x(this,Fc)||(P(this,Fc,!0),typeof this.onSetModified=="function"&&this.onSetModified())};var Pm;class VP extends Hk{constructor(t){super();$(this,Pm);const{map:n,hash:s,transfer:i}=t.serializable,o=structuredClone(n,i?{transfer:i}:null);P(this,Pm,{map:o,hash:s,transfer:i})}get print(){ar("Should not call PrintAnnotationStorage.print")}get serializable(){return x(this,Pm)}get modifiedIds(){return it(this,"modifiedIds",{ids:new Set,hash:""})}}Pm=new WeakMap;var uh;class UW{constructor({ownerDocument:e=globalThis.document,styleElement:t=null}){$(this,uh,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 t=this.styleElement.sheet;t.insertRule(e,t.cssRules.length)}clear(){for(const e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.clear(),x(this,uh).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:e,_inspectFont:t}
1148){if(!(!e||x(this,uh).has(e.loadedName))){if(mr(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:n,src:s,style:i}=e,o=new FontFace(n,s,i);this.addNativeFontFace(o);try{await o.load(),x(this,uh).add(n),t==null||t(e)}catch{Je(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(o)}return}ar("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 n=e.createNativeFontFace();if(n){this.addNativeFontFace(n);try{await n.loaded}catch(s){throw Je(`Failed to load font '${n.family}': '${s}'.`),e.disableFontFace=!0,s}}return}const t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise(n=>{const s=this._queueLoadingCallback(n);this._prepareFontLoadEvent(e,s)})}}get isFontLoadingAPISupported(){var t;const e=!!((t=this._document)!=null&&t.fonts);return it(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){let e=!1;return(an||typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.userAgent)=="string"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(e=!0),it(this,"isSyncFontLoadingSupported",e)}_queueLoadingCallback(e){function t(){for(mr(!s.done,"completeRequest() cannot be called twice."),s.done=!0;n.length>0&&n[0].done;){const i=n.shift();setTimeout(i.callback,0)}}const{loadingRequests:n}=this,s={done:!1,complete:t,callback:e};return n.push(s),s}get _loadTestFont(){const e=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return it(this,"_loadTestFont",e)}_prepareFontLoadEvent(e,t){function n(_,N){return _.charCodeAt(N)<<24|_.charCodeAt(N+1)<<16|_.charCodeAt(N+2)<<8|_.charCodeAt(N+3)&255}function s(_,N,S,E){const T=_.substring(0,N),D=_.substring(N+S);return T+E+D}let i,o;const l=this._document.createElement("canvas");l.width=1,l.height=1;const c=l.getContext("2d");let u=0;function d(_,N){if(++u>30){Je("Load test font never loaded."),N();return}if(c.font="30px "+_,c.fillText(".",0,20),c.getImageData(0,0,1,1).data[3]>0){N();return}setTimeout(d.bind(null,_,N))}const h=`lt${Date.now()}${this.loadTestFontId++}`;let f=this._loadTestFont;f=s(f,976,h.length,h);const m=16,g=1482184792;let v=n(f,m);for(i=0,o=h.length-3;i<o;i+=4)v=v-g+n(h,i)|0;i<h.length&&(v=v-g+n(h+"XXX",i)|0),f=s(f,m,4,NW(v));const b=`url(data:font/opentype;base64,${btoa(f)});`,y=`@font-face {font-family:"${h}";src:${b}}`;this.insertRule(y);const w=this._document.createElement("div");
1148w.style.visibility="hidden",w.style.width=w.style.height="10px",w.style.position="absolute",w.style.top=w.style.left="0px";for(const _ of[e.loadedName,h]){const N=this._document.createElement("span");N.textContent="Hi",N.style.fontFamily=_,w.append(N)}this._document.body.append(w),d(h,()=>{w.remove(),t.complete()})}}uh=new WeakMap;class HW{constructor(e,{disableFontFace:t=!1,inspectFont:n=null}){this.compiledGlyphs=Object.create(null);for(const s in e)this[s]=e[s];this.disableFontFace=t===!0,this._inspectFont=n}createNativeFontFace(){var t;if(!this.data||this.disableFontFace)return null;let e;if(!this.cssFontInfo)e=new FontFace(this.loadedName,this.data,{});else{const n={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(n.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,n)}return(t=this._inspectFont)==null||t.call(this,this),e}createFontFaceRule(){var s;if(!this.data||this.disableFontFace)return null;const e=dP(this.data),t=`url(data:${this.mimetype};base64,${btoa(e)});`;let n;if(!this.cssFontInfo)n=`@font-face {font-family:"${this.loadedName}";src:${t}}`;else{let i=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(i+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),n=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${i}src:${t}}`}return(s=this._inspectFont)==null||s.call(this,this,t),n}getPathGenerator(e,t){if(this.compiledGlyphs[t]!==void 0)return this.compiledGlyphs[t];let n;try{n=e.get(this.loadedName+"_path_"+t)}catch(i){Je(`getPathGenerator - ignoring character: "${i}".`)}if(!Array.isArray(n)||n.length===0)return this.compiledGlyphs[t]=function(i,o){};const s=[];for(let i=0,o=n.length;i<o;)switch(n[i++]){case ga.BEZIER_CURVE_TO:{const[l,c,u,d,h,f]=n.slice(i,i+6);s.push(p=>p.bezierCurveTo(l,c,u,d,h,f)),i+=6}break;case ga.MOVE_TO:{const[l,c]=n.slice(i,i+2);s.push(u=>u.moveTo(l,c)),i+=2}break;case ga.LINE_TO:{const[l,c]=n.slice(i,i+2);s.push(u=>u.lineTo(l,c)),i+=2}break;case ga.QUADRATIC_CURVE_TO:{const[l,c,u,d]=n.slice(i,i+4);s.push(h=>h.quadraticCurveTo(l,c,u,d)),i+=4}break;case ga.RESTORE:s.push(l=>l.restore());break;case ga.SAVE:s.push(l=>l.save());break;case ga.SCALE:mr(s.length===2,"Scale command is only valid at the third position.");break;case ga.TRANSFORM:{const[l,c,u,d,h,f]=n.slice(i,i+6);s.push(p=>p.transform(l,c,u,d,h,f)),i+=6}break;case ga.TRANSLATE:{const[l,c]=n.slice(i,i+2);s.push(u=>u.translate(l,c)),i+=2}break}return this.compiledGlyphs[t]=function(o,l){s[0](o),s[1](o),o.scale(l,-l);for(let c=2,u=s.length;c<u;c++)s[c](o)}}}if(an){var yN=Promise.withResolvers(),Ap=null;(async()=>{const e=await eo(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]),t=await eo(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]),n=await eo(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]),s=await eo(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]);let i,o;return new Map(Object.entries({fs:e,http:t,https:n,url:s,canvas:i,path2d:o}))})().then(e=>{Ap=e,yN.resolve()},e=>{Je(`loadPackages: ${e}`),Ap=new Map,yN.resolve()})}class Ll{static get promise(){return yN.promise}static get(e){return Ap==null?void 0:Ap.get(e)}}const GP=function(r){return Ll.get("fs").promises.readFile(r).then(t=>new Uint8Array(t))};class zW extends hP{}class qW extends fP{_createCanvas(e,t){return Ll.get("canvas").createCanvas(e,t)}}class WW extends pP{_fetchData(e,t){return GP(e).then(n=>({cMapData:n,compressionType:t}))}}class VW extends mP{_fetchData(e){return GP(e)}}const xn={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function bN(r,e){if(!e)return;const t=e[2]-e[0],n=e[3]-e[1],s=new Path2D;s.rect(e[0],e[1],t,n),r.clip(s)}class zk{getPattern(){ar("Abstract method `getPattern` called.")}}class GW extends zk{constructor(e){super(),this._type=e[1],this._bbox=e[2],this._colorStops=e[3],this._p0=e[4],this._p1=e[5],this._r0=e[6],this._r1=e[7],this.matrix=null}_createGradient(e){let t;this._type==="axial"?t=e.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(t=e.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const n of this._colorStops)t.addColorStop(n[0],n[1]);return t}getPattern(e,t,n,s){let i;if(s===xn.STROKE||s===xn.FILL){const o=t.current.getClippedPathBoundingBox(s,Wt(e))||[0,0,0,0],l=Math.ceil(o[2]-o[0])||1,c=Math.ceil(o[3]-o[1])||1,u=t.cachedCanvases.getCanvas("pattern",l,c),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]),n=Pe.transform(n,[1,0,0,1,o[0],o[1]]),d.transform(...t.baseTransform),this.matrix&&d.transform(...this.matrix
vendor: 10,494 bytes, line 1148
1148),bN(d,this._bbox),d.fillStyle=this._createGradient(d),d.fill(),i=e.createPattern(u.canvas,"no-repeat");const h=new DOMMatrix(n);i.setTransform(h)}else bN(e,this._bbox),i=this._createGradient(e);return i}}function r1(r,e,t,n,s,i,o,l){const c=e.coords,u=e.colors,d=r.data,h=r.width*4;let f;c[t+1]>c[n+1]&&(f=t,t=n,n=f,f=i,i=o,o=f),c[n+1]>c[s+1]&&(f=n,n=s,s=f,f=o,o=l,l=f),c[t+1]>c[n+1]&&(f=t,t=n,n=f,f=i,i=o,o=f);const p=(c[t]+e.offsetX)*e.scaleX,m=(c[t+1]+e.offsetY)*e.scaleY,g=(c[n]+e.offsetX)*e.scaleX,v=(c[n+1]+e.offsetY)*e.scaleY,b=(c[s]+e.offsetX)*e.scaleX,y=(c[s+1]+e.offsetY)*e.scaleY;if(m>=y)return;const w=u[i],_=u[i+1],N=u[i+2],S=u[o],E=u[o+1],T=u[o+2],D=u[l],R=u[l+1],H=u[l+2],A=Math.round(m),U=Math.round(y);let C,M,L,B,I,z,X,F;for(let q=A;q<=U;q++){if(q<v){const ie=q<m?0:(m-q)/(m-v);C=p-(p-g)*ie,M=w-(w-S)*ie,L=_-(_-E)*ie,B=N-(N-T)*ie}else{let ie;q>y?ie=1:v===y?ie=0:ie=(v-q)/(v-y),C=g-(g-b)*ie,M=S-(S-D)*ie,L=E-(E-R)*ie,B=T-(T-H)*ie}let V;q<m?V=0:q>y?V=1:V=(m-q)/(m-y),I=p-(p-b)*V,z=w-(w-D)*V,X=_-(_-R)*V,F=N-(N-H)*V;const K=Math.round(Math.min(C,I)),ee=Math.round(Math.max(C,I));let Z=h*q+K*4;for(let ie=K;ie<=ee;ie++)V=(C-ie)/(C-I),V<0?V=0:V>1&&(V=1),d[Z++]=M-(M-z)*V|0,d[Z++]=L-(L-X)*V|0,d[Z++]=B-(B-F)*V|0,d[Z++]=255}}function XW(r,e,t){const n=e.coords,s=e.colors;let i,o;switch(e.type){case"lattice":const l=e.verticesPerRow,c=Math.floor(n.length/l)-1,u=l-1;for(i=0;i<c;i++){let d=i*l;for(let h=0;h<u;h++,d++)r1(r,t,n[d],n[d+1],n[d+l],s[d],s[d+1],s[d+l]),r1(r,t,n[d+l+1],n[d+1],n[d+l],s[d+l+1],s[d+1],s[d+l])}break;case"triangles":for(i=0,o=n.length;i<o;i+=3)r1(r,t,n[i],n[i+1],n[i+2],s[i],s[i+1],s[i+2]);break;default:throw new Error("illegal figure")}}class YW extends zk{constructor(e){super(),this._coords=e[2],this._colors=e[3],this._figures=e[4],this._bounds=e[5],this._bbox=e[7],this._background=e[8],this.matrix=null}_createMeshCanvas(e,t,n){const l=Math.floor(this._bounds[0]),c=Math.floor(this._bounds[1]),u=Math.ceil(this._bounds[2])-l,d=Math.ceil(this._bounds[3])-c,h=Math.min(Math.ceil(Math.abs(u*e[0]*1.1)),3e3),f=Math.min(Math.ceil(Math.abs(d*e[1]*1.1)),3e3),p=u/h,m=d/f,g={coords:this._coords,colors:this._colors,offsetX:-l,offsetY:-c,scaleX:1/p,scaleY:1/m},v=h+2*2,b=f+2*2,y=n.getCanvas("mesh",v,b),w=y.context,_=w.createImageData(h,f);if(t){const S=_.data;for(let E=0,T=S.length;E<T;E+=4)S[E]=t[0],S[E+1]=t[1],S[E+2]=t[2],S[E+3]=255}for(const S of this._figures)XW(_,S,g);return w.putImageData(_,2,2),{canvas:y.canvas,offsetX:l-2*p,offsetY:c-2*m,scaleX:p,scaleY:m}}getPattern(e,t,n,s){bN(e,this._bbox);let i;if(s===xn.SHADING)i=Pe.singularValueDecompose2dScale(Wt(e));else if(i=Pe.singularValueDecompose2dScale(t.baseTransform),this.matrix){const l=Pe.singularValueDecompose2dScale(this.matrix);i=[i[0]*l[0],i[1]*l[1]]}const o=this._createMeshCanvas(i,s===xn.SHADING?null:this._background,t.cachedCanvases);return s!==xn.SHADING&&(e.setTransform(...t.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 KW extends zk{getPattern(){return"hotpink"}}function JW(r){switch(r[0]){case"RadialAxial":return new GW(r);case"Mesh":return new YW(r);case"Dummy":return new KW}throw new Error(`Unknown IR type: ${r[0]}`)}const JA={COLORED:1,UNCOLORED:2},ux=class ux{constructor(e,t,n,s,i){this.operatorList=e[2],this.matrix=e[3],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.color=t,this.ctx=n,this.canvasGraphicsFactory=s,this.baseTransform=i}createPatternCanvas(e){const{bbox:t,operatorList:n,paintType:s,tilingType:i,color:o,canvasGraphicsFactory:l}=this;let{xstep:c,ystep:u}=this;c=Math.abs(c),u=Math.abs(u),ev("TilingType: "+i);const d=t[0],h=t[1],f=t[2],p=t[3],m=f-d,g=p-h,v=Pe.singularValueDecompose2dScale(this.matrix),b=Pe.singularValueDecompose2dScale(this.baseTransform),y=v[0]*b[0],w=v[1]*b[1];let _=m,N=g,S=!1,E=!1;const T=Math.ceil(c*y),D=Math.ceil(u*w),R=Math.ceil(m*y),H=Math.ceil(g*w);T>=R?_=c:S=!0,D>=H?N=u:E=!0;const A=this.getSizeAndScale(_,this.ctx.canvas.width,y),U=this.getSizeAndScale(N,this.ctx.canvas.height,w),C=e.cachedCanvases.getCanvas("pattern",A.size,U.size),M=C.context,L=l.createCanvasGraphics(M);if(L.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(L,s,o),M.translate(-A.scale*d,-U.scale*h),L.transform(A.scale,0,0,U.scale,0,0),M.save(),this.clipBbox(L,d,h,f,p),L.baseTransform=Wt(L.ctx),L.executeOperatorList(n),L.endDrawing(),M.restore(),S||E){const B=C.canvas;S&&(_=c),E&&(N=u);const I=this.getSizeAndScale(_,this.ctx.canvas.width,y),z=this.getSizeAndScale(N,this.ctx.canvas.height,w),X=I.size,F=z.size,q=e.cachedCanvases.getCanvas("pattern-workaround",X,F),V=q.context,K=S?Math.floor(m/c):0,ee=E?Math.floor(g/u):0;for(let Z=0;Z<=K;Z++)for(let ie=0;ie<=ee;ie++)V.drawImage(B,X*Z,F*ie,X,F,0,0,X,F);return{canvas:q.canvas,scaleX:I.scale,scaleY:z.scale,offsetX:d,offsetY:h}}return{canvas:C.canvas,scaleX:A.scale,scaleY:U.scale,offsetX:d,offsetY:h}}getSizeAndScale(e,t,n){const s=Math.max(ux.MAX_PATTERN_SIZE,t);let i=Math.ceil(e*n);return i>=s?i=s:n=i/e,{scale:n,size:i}}clipBbox(e,t,n,s,i){const o=s-t,l=i-n;e.ctx.rect(t,n,o,l),e.current.updateRectMinMax(Wt(e.ctx),[t,n,s,i]),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,t,n){const s=e.ctx,i=e.current;switch(t){case JA.COLORED:const o=this.ctx;s.fillStyle=o.fillStyle,s.strokeStyle=o.strokeStyle,i.fillColor=o.fillStyle,i.strokeColor=o.strokeStyle;break;case JA.UNCOLORED:const l=Pe.makeHexColor(n[0],n[1],n[2]);s.fillStyle=l,s.strokeStyle=l,i.fillColor=l,i.strokeColor=l;break;default:throw new _W(`Unsupported paint type: ${t}`)}}getPattern(e,t,n,s){let i=n;s!==xn.SHADING&&(i=Pe.transform(i,t.baseTransform),this.matrix&&(i=Pe.transform(i,this.matrix)));const o=this.createPatternCanvas(t);let l=new DOMMatrix(i);l=l.translate(o.offsetX,o.offsetY),l=l.scale(1/o.scaleX,1/o.scaleY);const c=e.createPattern(o.canvas,"repeat");return c.setTransform(l),c}};Re(ux,"MAX_PATTERN_SIZE",3e3);let xN=ux;function ZW({src:r,srcPos:e=0,dest:t,width:n,height:s,nonBlackColor:i=4294967295,inverseDecode:o=!1}){const l=zn.isLittleEndian?4278190080:255,[c,u]=o?[i,l]:[l,i],d=n>>3,h=n&7,f=r.length;t=new Uint32Array(t.buffer);let p=0;for(let m=0;m<s;m++){for(const v=e+d;e<v;e++){const b=e<f?r[e]:255;t[p++]=b&128?u:c,t[p++]=b&64?u:c,t[p++]=b&32?u:c,t[p++]=b&16?u:c,t[p++]=b&8?u:c,t[p++]=b&4?u:c,t[p++]=b&2?u:c,t[p++]=b&1?u:c}if(h===0)continue;const g=e<f?r[e++]:255;for(let v=0;v<h;v++)t[p++]=g&1<<7-v?u:c}return{srcPos:e,destPos:p}}const ZA=16,QA=100,QW=15,eT=10,tT=1e3,Pn=16;function eV(r,e){if(r._removeMirroring)throw new Error("Context is already forwarding operations.");r.__originalSave=r.save,r.__originalRestore=r.restore,r.__originalRotate=r.rotate,r.__originalScale=r.scale,r.__originalTranslate=r.translate,r.__originalTransform=r.transform,r.__originalSetTransform=r.setTransform,r.__originalResetTransform=r.resetTransform,r.__originalClip=r.clip,r.__originalMoveTo=r.moveTo,r.__originalLineTo=r.lineTo,r.__originalBezierCurveTo=r.bezierCurveTo,r.__originalRect=r.rect,r.__originalClosePath=r.closePath,r.__originalBeginPath=r.beginPath,r._removeMirroring=()=>{r.save=r.__originalSave,r.restore=r.__originalRestore,r.rotate=r.__originalRotate,r.scale=r.__originalScale,r.translate=r.__originalTranslate,r.transform=r.__originalTransform,r.setTransform=r.__originalSetTransform,r.resetTransform=r.__originalResetTransform,r.clip=r.__originalClip,r.moveTo=r.__originalMoveTo,r.lineTo=r.__originalLineTo,r.bezierCurveTo=r.__originalBezierCurveTo,r.rect=r.__originalRect,r.closePath=r.__originalClosePath,r.beginPath=r.__originalBeginPath,delete r._removeMirroring},r.save=function(){e.save(),this.__originalSave()},r.restore=function(){e.restore(),this.__originalRestore()},r.translate=function(n,s){e.translate(n,s),this.__originalTranslate(n,s)},r.scale=function(n,s){e.scale(n,s),this.__originalScale(n,s)},r.transform=function(n,s,i,o,l,c){e.transform(n,s,i,o,l,c),this.__originalTransform(n,s,i,o,l,c)},r.setTransform=function(n,s,i,o,l,c){e.setTransform(n,s,i,o,l,c),this.__originalSetTransform(n,s,i,o,l,c)},r.resetTransform=function(){e.resetTransform(),this.__originalResetTransform()},r.rotate=function(n){e.rotate(n),this.__originalRotate(n)},r.clip=function(n){e.clip(n),this.__originalClip(n)},r.moveTo=function(t,n){e.moveTo(t,n),this.__originalMoveTo(t,n)},r.lineTo=function(t,n){e.lineTo(t,n),this.__originalLineTo(t,n)},r.bezierCurveTo=function(t,n,s,i,o,l){e.bezierCurveTo(t,n,s,i,o,l),this.__originalBezierCurveTo(t,n,s,i,o,l)},r.rect=function(t,n,s,i){e.rect(t,n,s,i),this.__originalRect(t,n,s,i)},r.closePath=function(){e.closePath(),this.__originalClosePath()},r.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}class tV{constructor(e){this.canvasFactory=e,this.cache=Object.create(null)}getCanvas(e,t,n){let s;return this.cache[e]!==void 0?(s=this.cache[e],this.canvasFactory.reset(s,t,n)):(s=this.canvasFactory.create(t,n),this.cache[e]=s),s}delete(e){delete this.cache[e]}clear(){for(const e in this.cache){const t=this.cache[e];this.canvasFactory.destroy(t),delete this.cache[e]}}}function B0(r,e,t,n,s,i,o,l,c,u){const[d,h,f,p,m,g]=Wt(r);if(h===0&&f===0){const y=o*d+m,w=Math.round(y),_=l*p+g,N=Math.round(_),S=(o+c)*d+m,E=Math.abs(Math.round(S)-w)||1,T=(l+u)*p+g,D=Math.abs(Math.round(T)-N)||1;return r.setTransform(Math.sign(d),0,0,Math.sign(p),w,N),r.drawImage(e,t,n,s,i,0,0,E,D),r.setTransform(d,h,f,p,m,g),[E,D]}if(d===0&&p===0){const y=l*f+m,w=Math.round(y),_=o*h+g,N=Math.round(_),S=(l+u)*f+m,E=Math.abs(Math.round(S)-w)||1,T=(o+c)*h+g,D=Math.abs(Math.round(T)-N)||1;return r.setTransform(0,Math.sign(h),Math.sign(f),0,w,N),r.drawImage(e,t,n,s,i,0,0,D,E),r.setTransform(d,h,f,p,m,g),[D,E]}r.drawImage(e,t,n,s,i,o,l,c,u);const v=Math.hypot(d,h),b=Math.hypot(f,p);return[v*c,b*u]}function rV(r){const{width:e,height:t}=r;if(e>tT||t>tT)return null;const n=1e3,s=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),i=e+1;let o=new Uint8Array(i*(t+1)),l,c,u;const d=e+7&-8;let h=new Uint8Array(d*t),f=0;for(const b of r.data){let y=128;for(;y>0;)h[f++]=b&y?0:255,y>>=1}let p=0;for(f=0,h[f]!==0&&(o[0]=1,++p),c=1;c<e;c++)h[f]!==h[f+1]&&(o[c]=h[f]?2:1,++p),f++;for(h[f]!==0&&(o[c]=2,++p),l=1;l<t;l++){f=l*d,u=l*i,h[f-d]!==h[f]&&(o[u]=h[f]?1:8,++p);let b=(h[f]?4:0)+(h[f-d]?8:0);for(c=1;c<e;c++)b=(b>>2)+(h[f+1]?4:0)+(h[f-d+1]?8:0),s[b]&&(o[u+c]=s[b],++p),f++;if(h[f-d]!==h[f]&&(o[u+c]=h[f]?2:4,++p),p>n)return null}for(f=d*(t-1),u=l*i,h[f]!==0&&(o[u]=8,++p),c=1;c<e;
1148c++)h[f]!==h[f+1]&&(o[u+c]=h[f]?4:8,++p),f++;if(h[f]!==0&&(o[u+c]=4,++p),p>n)return null;const m=new Int32Array([0,i,-1,0,-i,0,0,0,1]),g=new Path2D;for(l=0;p&&l<=t;l++){let b=l*i;const y=b+e;for(;b<y&&!o[b];)b++;if(b===y)continue;g.moveTo(b%i,l);const w=b;let _=o[b];do{const N=m[_];do b+=N;while(!o[b]);const S=o[b];S!==5&&S!==10?(_=S,o[b]=0):(_=S&51*_>>4,o[b]&=_>>2|_<<2),g.lineTo(b%i,b/i|0),o[b]||--p}while(w!==b);--l}return h=null,o=null,function(b){b.save(),b.scale(1/e,-1/t),b.translate(0,-t),b.fill(g),b.beginPath(),b.restore()}}class rT{constructor(e,t){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=cP,this.textMatrixScale=1,this.fontMatrix=q_,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=Zr.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,e,t])}clone(){const e=Object.create(this);return e.clipBox=this.clipBox.slice(),e}setCurrentPoint(e,t){this.x=e,this.y=t}updatePathMinMax(e,t,n){[t,n]=Pe.applyTransform([t,n],e),this.minX=Math.min(this.minX,t),this.minY=Math.min(this.minY,n),this.maxX=Math.max(this.maxX,t),this.maxY=Math.max(this.maxY,n)}updateRectMinMax(e,t){const n=Pe.applyTransform(t,e),s=Pe.applyTransform(t.slice(2),e),i=Pe.applyTransform([t[0],t[3]],e),o=Pe.applyTransform([t[2],t[1]],e);this.minX=Math.min(this.minX,n[0],s[0],i[0],o[0]),this.minY=Math.min(this.minY,n[1],s[1],i[1],o[1]),this.maxX=Math.max(this.maxX,n[0],s[0],i[0],o[0]),this.maxY=Math.max(this.maxY,n[1],s[1],i[1],o[1])}updateScalingPathMinMax(e,t){Pe.scaleMinMax(e,t),this.minX=Math.min(this.minX,t[0]),this.minY=Math.min(this.minY,t[1]),this.maxX=Math.max(this.maxX,t[2]),this.maxY=Math.max(this.maxY,t[3])}updateCurvePathMinMax(e,t,n,s,i,o,l,c,u,d){const h=Pe.bezierBoundingBox(t,n,s,i,o,l,c,u,d);d||this.updateRectMinMax(e,h)}getPathBoundingBox(e=xn.FILL,t=null){const n=[this.minX,this.minY,this.maxX,this.maxY];if(e===xn.STROKE){t||ar("Stroke bounding box must include transform.");const s=Pe.singularValueDecompose2dScale(t),i=s[0]*this.lineWidth/2,o=s[1]*this.lineWidth/2;n[0]-=i,n[1]-=o,n[2]+=i,n[3]+=o}return n}updateClipFromPath(){const e=Pe.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(e){this.clipBox=e,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(e=xn.FILL,t=null){return Pe.intersect(this.clipBox,this.getPathBoundingBox(e,t))}}function nT(r,e){if(typeof ImageData<"u"&&e instanceof ImageData){r.putImageData(e,0,0);return}const t=e.height,n=e.width,s=t%Pn,i=(t-s)/Pn,o=s===0?i:i+1,l=r.createImageData(n,Pn);let c=0,u;const d=e.data,h=l.data;let f,p,m,g;if(e.kind===by.GRAYSCALE_1BPP){const v=d.byteLength,b=new Uint32Array(h.buffer,0,h.byteLength>>2),y=b.length,w=n+7>>3,_=4294967295,N=zn.isLittleEndian?4278190080:255;for(f=0;f<o;f++){for(m=f<i?Pn:s,u=0,p=0;p<m;p++){const S=v-c;let E=0;const T=S>w?n:S*8-7,D=T&-8;let R=0,H=0;for(;E<D;E+=8)H=d[c++],b[u++]=H&128?_:N,b[u++]=H&64?_:N,b[u++]=H&32?_:N,b[u++]=H&16?_:N,b[u++]=H&8?_:N,b[u++]=H&4?_:N,b[u++]=H&2?_:N,b[u++]=H&1?_:N;for(;E<T;E++)R===0&&(H=d[c++],R=128),b[u++]=H&R?_:N,R>>=1}for(;u<y;)b[u++]=0;r.putImageData(l,0,f*Pn)}}else if(e.kind===by.RGBA_32BPP){for(p=0,g=n*Pn*4,f=0;f<i;f++)h.set(d.subarray(c,c+g)),c+=g,r.putImageData(l,0,p),p+=Pn;f<o&&(g=n*s*4,h.set(d.subarray(c,c+g)),r.putImageData(l,0,p))}else if(e.kind===by.RGB_24BPP)for(m=Pn,g=n*m,f=0;f<o;f++){for(f>=i&&(m=s,g=n*m),u=0,p=g;p--;)h[u++]=d[c++],h[u++]=d[c++],h[u++]=d[c++],h[u++]=255;r.putImageData(l,0,f*Pn)}else throw new Error(`bad image kind: ${e.kind}`)}function sT(r,e){if(e.bitmap){r.drawImage(e.bitmap,0,0);return}const t=e.height,n=e.width,s=t%Pn,i=(t-s)/Pn,o=s===0?i:i+1,l=r.createImageData(n,Pn);let c=0;const u=e.data,d=l.data;for(let h=0;h<o;h++){const f=h<i?Pn:s;({srcPos:c}=ZW({src:u,srcPos:c,dest:d,width:n,height:f,nonBlackColor:0})),r.putImageData(l,0,h*Pn)}}function qf(r,e){const t=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const n of t)r[n]!==void 0&&(e[n]=r[n]);r.setLineDash!==void 0&&(e.setLineDash(r.getLineDash()),e.lineDashOffset=r.lineDashOffset)}function $0(r){if(r.strokeStyle=r.fillStyle="#000000",r.fillRule="nonzero",r.globalAlpha=1,r.lineWidth=1,r.lineCap="butt",r.lineJoin="miter",r.miterLimit=10,r.globalCompositeOperation="source-over",r.font="10px sans-serif",r.setLineDash!==void 0&&(r.setLineDash([]),r.lineDashOffset=0),!an){const{filter:e}=r;e!=="none"&&e!==""&&(r.filter="none")}}function iT(r,e){if(e)return!0;const t=Pe.singularValueDecompose2dScale(r);t[0]=Math.fround(t[0]),t[1]=Math.fround(t[1]);const n=Math.fround((globalThis.devicePixelRatio||1)*Il.PDF_TO_CSS_UNITS);return t[0]<=n&&t[1]<=n}const nV=["butt","round","square"],sV=["miter","round","bevel"],iV={},aT={};var Bl,vN,wN;const yE=class yE{constructor(e,t,n,s,i,{optionalContentConfig:o,markedContentStack:l=null},c,u){$(this,Bl);
vendor: 4,468 bytes, line 1148
1148this.ctx=e,this.current=new rT(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=t,this.objs=n,this.canvasFactory=s,this.filterFactory=i,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=l||[],this.optionalContentConfig=o,this.cachedCanvases=new tV(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=c,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=u,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(e,t=null){return typeof e=="string"?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):t}beginDrawing({transform:e,viewport:t,transparency:n=!1,background:s=null}){const i=this.ctx.canvas.width,o=this.ctx.canvas.height,l=this.ctx.fillStyle;if(this.ctx.fillStyle=s||"#ffffff",this.ctx.fillRect(0,0,i,o),this.ctx.fillStyle=l,n){const c=this.cachedCanvases.getCanvas("transparent",i,o);this.compositeCtx=this.ctx,this.transparentCanvas=c.canvas,this.ctx=c.context,this.ctx.save(),this.ctx.transform(...Wt(this.compositeCtx))}this.ctx.save(),$0(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...t.transform),this.viewportScale=t.scale,this.baseTransform=Wt(this.ctx)}executeOperatorList(e,t,n,s){const i=e.argsArray,o=e.fnArray;let l=t||0;const c=i.length;if(c===l)return l;const u=c-l>eT&&typeof n=="function",d=u?Date.now()+QW:0;let h=0;const f=this.commonObjs,p=this.objs;let m;for(;;){if(s!==void 0&&l===s.nextBreakPoint)return s.breakIt(l,n),l;if(m=o[l],m!==ni.dependency)this[m].apply(this,i[l]);else for(const g of i[l]){const v=g.startsWith("g_")?f:p;if(!v.has(g))return v.get(g,n),l}if(l++,l===c)return l;if(u&&++h>eT){if(Date.now()>d)return n(),l;h=0}}}endDrawing(){O(this,Bl,vN).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const e of this._cachedBitmapsMap.values()){for(const t of e.values())typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);e.clear()}this._cachedBitmapsMap.clear(),O(this,Bl,wN).call(this)}_scaleImage(e,t){const n=e.width,s=e.height;let i=Math.max(Math.hypot(t[0],t[1]),1),o=Math.max(Math.hypot(t[2],t[3]),1),l=n,c=s,u="prescale1",d,h;for(;i>2&&l>1||o>2&&c>1;){let f=l,p=c;i>2&&l>1&&(f=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l/2),i/=l/f),o>2&&c>1&&(p=c>=16384?Math.floor(c/2)-1||1:Math.ceil(c)/2,o/=c/p),d=this.cachedCanvases.getCanvas(u,f,p),h=d.context,h.clearRect(0,0,f,p),h.drawImage(e,0,0,l,c,0,0,f,p),e=d.canvas,l=f,c=p,u=u==="prescale1"?"prescale2":"prescale1"}return{img:e,paintWidth:l,paintHeight:c}}_createMaskCanvas(e){const t=this.ctx,{width:n,height:s}=e,i=this.current.fillColor,o=this.current.patternFill,l=Wt(t);let c,u,d,h;if((e.bitmap||e.data)&&e.count>1){const T=e.bitmap||e.data.buffer;u=JSON.stringify(o?l:[l.slice(0,4),i]),c=this._cachedBitmapsMap.get(T),c||(c=new Map,this._cachedBitmapsMap.set(T,c));const D=c.get(u);if(D&&!o){const R=Math.round(Math.min(l[0],l[2])+l[4]),H=Math.round(Math.min(l[1],l[3])+l[5]);return{canvas:D,offsetX:R,offsetY:H}}d=D}d||(h=this.cachedCanvases.getCanvas("maskCanvas",n,s),sT(h.context,e));let f=Pe.transform(l,[1/n,0,0,-1/s,0,0]);f=Pe.transform(f,[1,0,0,1,0,-s]);const[p,m,g,v]=Pe.getAxialAlignedBoundingBox([0,0,n,s],f),b=Math.round(g-p)||1,y=Math.round(v-m)||1,w=this.cachedCanvases.getCanvas("fillCanvas",b,y),_=w.context,N=p,S=m;_.translate(-N,-S),_.transform(...f),d||(d=this._scaleImage(h.canvas,ya(_)),d=d.img,c&&o&&c.set(u,d)),_.imageSmoothingEnabled=iT(Wt(_),e.interpolate),B0(_,d,0,0,d.width,d.height,0,0,n,s),_.globalCompositeOperation="source-in";const E=Pe.transform(ya(_),[1,0,0,1,-N,-S]);return _.fillStyle=o?i.getPattern(t,this,E,xn.FILL):i,_.fillRect(0,0,n,s),c&&!o&&(this.cachedCanvases.delete("fillCanvas"),c.set(u,w.canvas)),{canvas:w.canvas,offsetX:Math.round(N),offsetY:Math.round(S)}}setLineWidth(e){e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(e){this.ctx.lineCap=nV[e]}setLineJoin(e){this.ctx.lineJoin=sV[e]}setMiterLimit(e){this.ctx.miterLimit=e}setDash(e,t){const n=this.ctx;n.setLineDash!==void 0&&(n.setLineDash(e),n.lineDashOffset=t)}
1148setRenderingIntent(e){}setFlatness(e){}setGState(e){for(const[t,n]of e)switch(t){case"LW":this.setLineWidth(n);break;case"LC":this.setLineCap(n);break;case"LJ":this.setLineJoin(n);break;case"ML":this.setMiterLimit(n);break;case"D":this.setDash(n[0],n[1]);break;case"RI":this.setRenderingIntent(n);break;case"FL":this.setFlatness(n);break;case"Font":this.setFont(n[0],n[1]);break;case"CA":this.current.strokeAlpha=n;break;case"ca":this.current.fillAlpha=n,this.ctx.globalAlpha=n;break;case"BM":this.ctx.globalCompositeOperation=n;break;case"SMask":this.current.activeSMask=n?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(n);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const e=this.ctx.canvas.width,t=this.ctx.canvas.height,n="smaskGroupAt"+this.groupLevel,s=this.cachedCanvases.getCanvas(n,e,t);this.suspendedCtx=this.ctx,this.ctx=s.context;const i=this.ctx;i.setTransform(...Wt(this.suspendedCtx)),qf(this.suspendedCtx,i),eV(i,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),qf(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(e){if(!this.current.activeSMask)return;e?(e[0]=Math.floor(e[0]),e[1]=Math.floor(e[1]),e[2]=Math.ceil(e[2]),e[3]=Math.ceil(e[3])):e=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const t=this.current.activeSMask,n=this.suspendedCtx;this.composeSMask(n,t,this.ctx,e),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(e,t,n,s){const i=s[0],o=s[1],l=s[2]-i,c=s[3]-o;l===0||c===0||(this.genericComposeSMask(t.context,n,l,c,t.subtype,t.backdrop,t.transferMap,i,o,t.offsetX,t.offsetY),e.save(),e.globalAlpha=1,e.globalCompositeOperation="source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(n.canvas,0,0),e.restore())}genericComposeSMask(e,t,n,s,i,o,l,c,u,d,h){let f=e.canvas,p=c-d,m=u-h;if(o){if(p<0||m<0||p+n>f.width||m+s>f.height){const v=this.cachedCanvases.getCanvas("maskExtension",n,s),b=v.context;b.drawImage(f,-p,-m),o.some(y=>y!==0)&&(b.globalCompositeOperation="destination-atop",b.fillStyle=Pe.makeHexColor(...o),b.fillRect(0,0,n,s),b.globalCompositeOperation="source-over"),f=v.canvas,p=m=0}else if(o.some(v=>v!==0)){e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);const v=new Path2D;v.rect(p,m,n,s),e.clip(v),e.globalCompositeOperation="destination-atop",e.fillStyle=Pe.makeHexColor(...o),e.fillRect(p,m,n,s),e.restore()}}t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0),i==="Alpha"&&l?t.filter=this.filterFactory.addAlphaFilter(l):i==="Luminosity"&&(t.filter=this.filterFactory.addLuminosityFilter(l));const g=new Path2D;g.rect(c,u,n,s),t.clip(g),t.globalCompositeOperation="destination-in",t.drawImage(f,p,m,n,s,c,u,n,s),t.restore()}save(){this.inSMaskMode?(qf(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const e=this.current;this.stateStack.push(e),this.current=e.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),qf(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(e,t,n,s,i,o){this.ctx.transform(e,t,n,s,i,o),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,t,n){const s=this.ctx,i=this.current;let o=i.x,l=i.y,c,u;const d=Wt(s),h=d[0]===0&&d[3]===0||d[1]===0&&d[2]===0,f=h?n.slice(0):null;for(let p=0,m=0,g=e.length;p<g;p++)switch(e[p]|0){case ni.rectangle:o=t[m++],l=t[m++];const v=t[m++],b=t[m++],y=o+v,w=l+b;s.moveTo(o,l),v===0||b===0?s.lineTo(y,w):(s.lineTo(y,l),s.lineTo(y,w),s.lineTo(o,w)),h||i.updateRectMinMax(d,[o,l,y,w]),s.closePath();break;case ni.moveTo:o=t[m++],l=t[m++],s.moveTo(o,l),h||i.updatePathMinMax(d,o,l);break;case ni.lineTo:o=t[m++],l=t[m++],s.lineTo(o,l),h||i.updatePathMinMax(d,o,l);break;case ni.curveTo:c=o,u=l,o=t[m+4],l=t[m+5],s.bezierCurveTo(t[m],t[m+1],t[m+2],t[m+3],o,l),i.updateCurvePathMinMax(d,c,u,t[m],t[m+1],t[m+2],t[m+3],o,l,f),m+=6;break;case ni.curveTo2:c=o,u=l,s.bezierCurveTo(o,l,t[m],t[m+1],t[m+2],t[m+3]),i.updateCurvePathMinMax(d,c,u,o,l,t[m],t[m+1],t[m+2],t[m+3],f),o=t[m+2],l=t[m+3],m+=4;break;case ni.curveTo3:c=o,u=l,o=t[m+2],l=t[m+3],s.bezierCurveTo(t[m],t[m+1],o,l,o,l),i.updateCurvePathMinMax(d,c,u,t[m],t[m+1],o,l,o,l,f),m+=4;break;case ni.closePath:s.closePath();break}h&&i.updateScalingPathMinMax(d,f),i.setCurrentPoint(o,l)}closePath(){this.ctx.closePath()}stroke(e=!0){const t=this.ctx,n=this.current.strokeColor;t.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof n=="object"&&(n!=null&&n.getPattern)?(t.save(),t.strokeStyle=n.getPattern(t,this,ya(t),xn.STROKE),this.rescaleAndStroke(!1),t.restore(
1148)):this.rescaleAndStroke(!0)),e&&this.consumePath(this.current.getClippedPathBoundingBox()),t.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(e=!0){const t=this.ctx,n=this.current.fillColor,s=this.current.patternFill;let i=!1;s&&(t.save(),t.fillStyle=n.getPattern(t,this,ya(t),xn.FILL),i=!0);const o=this.current.getClippedPathBoundingBox();this.contentVisible&&o!==null&&(this.pendingEOFill?(t.fill("evenodd"),this.pendingEOFill=!1):t.fill()),i&&t.restore(),e&&this.consumePath(o)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=iV}eoClip(){this.pendingClip=aT}beginText(){this.current.textMatrix=cP,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const e=this.pendingTextPaths,t=this.ctx;if(e===void 0){t.beginPath();return}t.save(),t.beginPath();for(const n of e)t.setTransform(...n.transform),t.translate(n.x,n.y),n.addToPath(t,n.fontSize);t.restore(),t.clip(),t.beginPath(),delete this.pendingTextPaths}setCharSpacing(e){this.current.charSpacing=e}setWordSpacing(e){this.current.wordSpacing=e}setHScale(e){this.current.textHScale=e/100}setLeading(e){this.current.leading=-e}setFont(e,t){var d;const n=this.commonObjs.get(e),s=this.current;if(!n)throw new Error(`Can't find font for ${e}`);if(s.fontMatrix=n.fontMatrix||q_,(s.fontMatrix[0]===0||s.fontMatrix[3]===0)&&Je("Invalid font matrix for font "+e),t<0?(t=-t,s.fontDirection=-1):s.fontDirection=1,this.current.font=n,this.current.fontSize=t,n.isType3Font)return;const i=n.loadedName||"sans-serif",o=((d=n.systemFontInfo)==null?void 0:d.css)||`"${i}", ${n.fallbackName}`;let l="normal";n.black?l="900":n.bold&&(l="bold");const c=n.italic?"italic":"normal";let u=t;t<ZA?u=ZA:t>QA&&(u=QA),this.current.fontSizeScale=t/u,this.ctx.font=`${c} ${l} ${u}px ${o}`}setTextRenderingMode(e){this.current.textRenderingMode=e}setTextRise(e){this.current.textRise=e}moveText(e,t){this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=t}setLeadingMoveText(e,t){this.setLeading(-t),this.moveText(e,t)}setTextMatrix(e,t,n,s,i,o){this.current.textMatrix=[e,t,n,s,i,o],this.current.textMatrixScale=Math.hypot(e,t),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(e,t,n,s){const i=this.ctx,o=this.current,l=o.font,c=o.textRenderingMode,u=o.fontSize/o.fontSizeScale,d=c&Zr.FILL_STROKE_MASK,h=!!(c&Zr.ADD_TO_PATH_FLAG),f=o.patternFill&&!l.missingFile;let p;(l.disableFontFace||h||f)&&(p=l.getPathGenerator(this.commonObjs,e)),l.disableFontFace||f?(i.save(),i.translate(t,n),i.beginPath(),p(i,u),s&&i.setTransform(...s),(d===Zr.FILL||d===Zr.FILL_STROKE)&&i.fill(),(d===Zr.STROKE||d===Zr.FILL_STROKE)&&i.stroke(),i.restore()):((d===Zr.FILL||d===Zr.FILL_STROKE)&&i.fillText(e,t,n),(d===Zr.STROKE||d===Zr.FILL_STROKE)&&i.strokeText(e,t,n)),h&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:Wt(i),x:t,y:n,fontSize:u,addToPath:p})}get isFontSubpixelAAEnabled(){const{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1),e.fillText("I",0,10);const t=e.getImageData(0,0,10,10).data;let n=!1;for(let s=3;s<t.length;s+=4)if(t[s]>0&&t[s]<255){n=!0;break}return it(this,"isFontSubpixelAAEnabled",n)}showText(e){const t=this.current,n=t.font;if(n.isType3Font)return this.showType3Text(e);const s=t.fontSize;if(s===0)return;const i=this.ctx,o=t.fontSizeScale,l=t.charSpacing,c=t.wordSpacing,u=t.fontDirection,d=t.textHScale*u,h=e.length,f=n.vertical,p=f?1:-1,m=n.defaultVMetrics,g=s*t.fontMatrix[0],v=t.textRenderingMode===Zr.FILL&&!n.disableFontFace&&!t.patternFill;i.save(),i.transform(...t.textMatrix),i.translate(t.x,t.y+t.textRise),u>0?i.scale(d,-1):i.scale(d,1);let b;if(t.patternFill){i.save();const S=t.fillColor.getPattern(i,this,ya(i),xn.FILL);
1148b=Wt(i),i.restore(),i.fillStyle=S}let y=t.lineWidth;const w=t.textMatrixScale;if(w===0||y===0){const S=t.textRenderingMode&Zr.FILL_STROKE_MASK;(S===Zr.STROKE||S===Zr.FILL_STROKE)&&(y=this.getSinglePixelWidth())}else y/=w;if(o!==1&&(i.scale(o,o),y/=o),i.lineWidth=y,n.isInvalidPDFjsFont){const S=[];let E=0;for(const T of e)S.push(T.unicode),E+=T.width;i.fillText(S.join(""),0,0),t.x+=E*g*d,i.restore(),this.compose();return}let _=0,N;for(N=0;N<h;++N){const S=e[N];if(typeof S=="number"){_+=p*S*s/1e3;continue}let E=!1;const T=(S.isSpace?c:0)+l,D=S.fontChar,R=S.accent;let H,A,U=S.width;if(f){const M=S.vmetric||m,L=-(S.vmetric?M[1]:U*.5)*g,B=M[2]*g;U=M?-M[0]:U,H=L/o,A=(_+B)/o}else H=_/o,A=0;if(n.remeasure&&U>0){const M=i.measureText(D).width*1e3/s*o;if(U<M&&this.isFontSubpixelAAEnabled){const L=U/M;E=!0,i.save(),i.scale(L,1),H/=L}else U!==M&&(H+=(U-M)/2e3*s/o)}if(this.contentVisible&&(S.isInFont||n.missingFile)){if(v&&!R)i.fillText(D,H,A);else if(this.paintChar(D,H,A,b),R){const M=H+s*R.offset.x/o,L=A-s*R.offset.y/o;this.paintChar(R.fontChar,M,L,b)}}const C=f?U*g-T*u:U*g+T*u;_+=C,E&&i.restore()}f?t.y-=_:t.x+=_*d,i.restore(),this.compose()}showType3Text(e){const t=this.ctx,n=this.current,s=n.font,i=n.fontSize,o=n.fontDirection,l=s.vertical?1:-1,c=n.charSpacing,u=n.wordSpacing,d=n.textHScale*o,h=n.fontMatrix||q_,f=e.length,p=n.textRenderingMode===Zr.INVISIBLE;let m,g,v,b;if(!(p||i===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,t.save(),t.transform(...n.textMatrix),t.translate(n.x,n.y),t.scale(d,o),m=0;m<f;++m){if(g=e[m],typeof g=="number"){b=l*g*i/1e3,this.ctx.translate(b,0),n.x+=b*d;continue}const y=(g.isSpace?u:0)+c,w=s.charProcOperatorList[g.operatorListId];if(!w){Je(`Type3 character "${g.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=g,this.save(),t.scale(i,i),t.transform(...h),this.executeOperatorList(w),this.restore()),v=Pe.applyTransform([g.width,0],h)[0]*i+y,t.translate(v,0),n.x+=v*d}t.restore(),this.processingType3=null}}setCharWidth(e,t){}setCharWidthAndBounds(e,t,n,s,i,o){this.ctx.rect(n,s,i-n,o-s),this.ctx.clip(),this.endPath()}getColorN_Pattern(e){let t;if(e[0]==="TilingPattern"){const n=e[1],s=this.baseTransform||Wt(this.ctx),i={createCanvasGraphics:o=>new yE(o,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};t=new xN(e,n,this.ctx,i,s)}else t=this._getPattern(e[1],e[2]);return t}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(e,t,n){this.ctx.strokeStyle=this.current.strokeColor=Pe.makeHexColor(e,t,n)}
1148setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent"}setFillRGBColor(e,t,n){this.ctx.fillStyle=this.current.fillColor=Pe.makeHexColor(e,t,n),this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(e,t=null){let n;return this.cachedPatterns.has(e)?n=this.cachedPatterns.get(e):(n=JW(this.getObject(e)),this.cachedPatterns.set(e,n)),t&&(n.matrix=t),n}shadingFill(e){if(!this.contentVisible)return;const t=this.ctx;this.save();const n=this._getPattern(e);t.fillStyle=n.getPattern(t,this,ya(t),xn.SHADING);const s=ya(t);if(s){const{width:i,height:o}=t.canvas,[l,c,u,d]=Pe.getAxialAlignedBoundingBox([0,0,i,o],s);this.ctx.fillRect(l,c,u-l,d-c)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){ar("Should not call beginInlineImage")}beginImageData(){ar("Should not call beginImageData")}paintFormXObjectBegin(e,t){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),e&&this.transform(...e),this.baseTransform=Wt(this.ctx),t)){const n=t[2]-t[0],s=t[3]-t[1];this.ctx.rect(t[0],t[1],n,s),this.current.updateRectMinMax(Wt(this.ctx),t),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const t=this.ctx;
vendor: 4,158 bytes, line 1148
1148e.isolated||ev("TODO: Support non-isolated groups."),e.knockout&&Je("Knockout groups not supported.");const n=Wt(t);if(e.matrix&&t.transform(...e.matrix),!e.bbox)throw new Error("Bounding box is required.");let s=Pe.getAxialAlignedBoundingBox(e.bbox,Wt(t));const i=[0,0,t.canvas.width,t.canvas.height];s=Pe.intersect(s,i)||[0,0,0,0];const o=Math.floor(s[0]),l=Math.floor(s[1]),c=Math.max(Math.ceil(s[2])-o,1),u=Math.max(Math.ceil(s[3])-l,1);this.current.startNewPathAndClipBox([0,0,c,u]);let d="groupAt"+this.groupLevel;e.smask&&(d+="_smask_"+this.smaskCounter++%2);const h=this.cachedCanvases.getCanvas(d,c,u),f=h.context;f.translate(-o,-l),f.transform(...n),e.smask?this.smaskStack.push({canvas:h.canvas,context:f,offsetX:o,offsetY:l,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}):(t.setTransform(1,0,0,1,0,0),t.translate(o,l),t.save()),qf(t,f),this.ctx=f,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(t),this.groupLevel++}endGroup(e){if(!this.contentVisible)return;this.groupLevel--;const t=this.ctx,n=this.groupStack.pop();if(this.ctx=n,this.ctx.imageSmoothingEnabled=!1,e.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const s=Wt(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...s);const i=Pe.getAxialAlignedBoundingBox([0,0,t.canvas.width,t.canvas.height],s);this.ctx.drawImage(t.canvas,0,0),this.ctx.restore(),this.compose(i)}}beginAnnotation(e,t,n,s,i){if(O(this,Bl,vN).call(this),$0(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),t){const o=t[2]-t[0],l=t[3]-t[1];if(i&&this.annotationCanvasMap){n=n.slice(),n[4]-=t[0],n[5]-=t[1],t=t.slice(),t[0]=t[1]=0,t[2]=o,t[3]=l;const[c,u]=Pe.singularValueDecompose2dScale(Wt(this.ctx)),{viewportScale:d}=this,h=Math.ceil(o*this.outputScaleX*d),f=Math.ceil(l*this.outputScaleY*d);this.annotationCanvas=this.canvasFactory.create(h,f);const{canvas:p,context:m}=this.annotationCanvas;this.annotationCanvasMap.set(e,p),this.annotationCanvas.savedCtx=this.ctx,this.ctx=m,this.ctx.save(),this.ctx.setTransform(c,0,0,-u,0,l*u),$0(this.ctx)}else $0(this.ctx),this.endPath(),this.ctx.rect(t[0],t[1],o,l),this.ctx.clip(),this.ctx.beginPath()}this.current=new rT(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...n),this.transform(...s)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),O(this,Bl,wN).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(e){if(!this.contentVisible)return;const t=e.count;e=this.getObject(e.data,e),e.count=t;const n=this.ctx,s=this.processingType3;if(s&&(s.compiled===void 0&&(s.compiled=rV(e)),s.compiled)){s.compiled(n);return}const i=this._createMaskCanvas(e),o=i.canvas;n.save(),n.setTransform(1,0,0,1,0,0),n.drawImage(o,i.offsetX,i.offsetY),n.restore(),this.compose()}paintImageMaskXObjectRepeat(e,t,n=0,s=0,i,o){if(!this.contentVisible)return;e=this.getObject(e.data,e);const l=this.ctx;l.save();const c=Wt(l);l.transform(t,n,s,i,0,0);const u=this._createMaskCanvas(e);l.setTransform(1,0,0,1,u.offsetX-c[4],u.offsetY-c[5]);for(let d=0,h=o.length;d<h;d+=2){const f=Pe.transform(c,[t,n,s,i,o[d],o[d+1]]),[p,m]=Pe.applyTransform([0,0],f);l.drawImage(u.canvas,p,m)}l.restore(),this.compose()}paintImageMaskXObjectGroup(e){if(!this.contentVisible)return;const t=this.ctx,n=this.current.fillColor,s=this.current.patternFill;for(const i of e){const{data:o,width:l,height:c,transform:u}=i,d=this.cachedCanvases.getCanvas("maskCanvas",l,c),h=d.context;h.save();const f=this.getObject(o,i);sT(h,f),h.globalCompositeOperation="source-in",h.fillStyle=s?n.getPattern(h,this,ya(t),xn.FILL):n,h.fillRect(0,0,l,c),h.restore(),t.save(),t.transform(...u),t.scale(1,-1),B0(t,d.canvas,0,0,l,c,0,-1,1,1),t.restore()}this.compose()}paintImageXObject(e){if(!this.contentVisible)return;const t=this.getObject(e);if(!t){Je("Dependent image isn't ready yet");return}this.paintInlineImageXObject(t)}paintImageXObjectRepeat(e,t,n,s){if(!this.contentVisible)return;const i=this.getObject(e);
1148if(!i){Je("Dependent image isn't ready yet");return}const o=i.width,l=i.height,c=[];for(let u=0,d=s.length;u<d;u+=2)c.push({transform:[t,0,0,n,s[u],s[u+1]],x:0,y:0,w:o,h:l});this.paintInlineImageXObjectGroup(i,c)}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:t,width:n,height:s}=e,i=this.cachedCanvases.getCanvas("inlineImage",n,s),o=i.context;return o.filter=this.current.transferMaps,o.drawImage(t,0,0),o.filter="none",i.canvas}paintInlineImageXObject(e){if(!this.contentVisible)return;const t=e.width,n=e.height,s=this.ctx;if(this.save(),!an){const{filter:l}=s;l!=="none"&&l!==""&&(s.filter="none")}s.scale(1/t,-1/n);let i;if(e.bitmap)i=this.applyTransferMapsToBitmap(e);else if(typeof HTMLElement=="function"&&e instanceof HTMLElement||!e.data)i=e;else{const c=this.cachedCanvases.getCanvas("inlineImage",t,n).context;nT(c,e),i=this.applyTransferMapsToCanvas(c)}const o=this._scaleImage(i,ya(s));s.imageSmoothingEnabled=iT(Wt(s),e.interpolate),B0(s,o.img,0,0,o.paintWidth,o.paintHeight,0,-n,t,n),this.compose(),this.restore()}paintInlineImageXObjectGroup(e,t){if(!this.contentVisible)return;const n=this.ctx;let s;if(e.bitmap)s=e.bitmap;else{const i=e.width,o=e.height,c=this.cachedCanvases.getCanvas("inlineImage",i,o).context;nT(c,e),s=this.applyTransferMapsToCanvas(c)}for(const i of t)n.save(),n.transform(...i.transform),n.scale(1,-1),B0(n,s,i.x,i.y,i.w,i.h,0,-1,1,1),n.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(e){}markPointProps(e,t){}beginMarkedContent(e){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,t){e==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(t)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(e){const t=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(e);const n=this.ctx;this.pendingClip&&(t||(this.pendingClip===aT?n.clip("evenodd"):n.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),n.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=Wt(this.ctx);if(e[1]===0&&e[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{const t=Math.abs(e[0]*e[3]-e[2]*e[1]),n=Math.hypot(e[0],e[2]),s=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(n,s)/t}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:e}=this.current,{a:t,b:n,c:s,d:i}=this.ctx.getTransform();let o,l;if(n===0&&s===0){const c=Math.abs(t),u=Math.abs(i);if(c===u)if(e===0)o=l=1/c;else{const d=c*e;o=l=d<1?1/d:1}else if(e===0)o=1/c,l=1/u;else{const d=c*e,h=u*e;o=d<1?1/d:1,l=h<1?1/h:1}}else{const c=Math.abs(t*i-n*s),u=Math.hypot(t,n),d=Math.hypot(s,i);if(e===0)o=d/c,l=u/c;else{const h=e*c;o=d>h?d/h:1,l=u>h?u/h:1}}this._cachedScaleForStroking[0]=o,this._cachedScaleForStroking[1]=l}return this._cachedScaleForStroking}rescaleAndStroke(e){const{ctx:t}=this,{lineWidth:n}=this.current,[s,i]=this.getScaleForStroking();if(t.lineWidth=n||1,s===1&&i===1){t.stroke();return}const o=t.getLineDash();if(e&&t.save(),t.scale(s,i),o.length>0){const l=Math.max(s,i);t.setLineDash(o.map(c=>c/l)),t.lineDashOffset/=l}t.stroke(),e&&t.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}};Bl=new WeakSet,vN=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(
1148),this.transparentCanvas=null)},wN=function(){if(this.pageColors){const e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!=="none"){const t=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=t}}};let Gd=yE;for(const r in ni)Gd.prototype[r]!==void 0&&(Gd.prototype[ni[r]]=Gd.prototype[r]);var Im,Lm;class Ja{static get workerPort(){return x(this,Im)}static set workerPort(e){if(!(typeof Worker<"u"&&e instanceof Worker)&&e!==null)throw new Error("Invalid `workerPort` type.");P(this,Im,e)}static get workerSrc(){return x(this,Lm)}static set workerSrc(e){if(typeof e!="string")throw new Error("Invalid `workerSrc` type.");P(this,Lm,e)}}Im=new WeakMap,Lm=new WeakMap,$(Ja,Im,null),$(Ja,Lm,"");const U0={UNKNOWN:0,DATA:1,ERROR:2},tr={UNKNOWN:0,CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function Kn(r){switch(r instanceof Error||typeof r=="object"&&r!==null||ar('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),r.name){case"AbortException":return new Xu(r.message);case"MissingPDFException":return new Gu(r.message);case"PasswordException":return new V_(r.message,r.code);case"UnexpectedResponseException":return new tv(r.message,r.status);case"UnknownErrorException":return new G_(r.message,r.details);default:return new G_(r.message,r.toString())}}var da,XP,YP,Ey;class ip{constructor(e,t,n){$(this,da);this.sourceName=e,this.targetName=t,this.comObj=n,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),this._onComObjOnMessage=s=>{const i=s.data;if(i.targetName!==this.sourceName)return;if(i.stream){O(this,da,YP).call(this,i);return}if(i.callback){const l=i.callbackId,c=this.callbackCapabilities[l];if(!c)throw new Error(`Cannot resolve callback ${l}`);if(delete this.callbackCapabilities[l],i.callback===U0.DATA)c.resolve(i.data);else if(i.callback===U0.ERROR)c.reject(Kn(i.reason));else throw new Error("Unexpected callback case");return}const o=this.actionHandler[i.action];if(!o)throw new Error(`Unknown action from worker: ${i.action}`);if(i.callbackId){const l=this.sourceName,c=i.sourceName;new Promise(function(u){u(o(i.data))}).then(function(u){n.postMessage({sourceName:l,targetName:c,callback:U0.DATA,callbackId:i.callbackId,data:u})},function(u){n.postMessage({sourceName:l,targetName:c,callback:U0.ERROR,callbackId:i.callbackId,reason:Kn(u)})});return}if(i.streamId){O(this,da,XP).call(this,i);return}o(i.data)},n.addEventListener("message",this._onComObjOnMessage)}on(e,t){const n=this.actionHandler;if(n[e])throw new Error(`There is already an actionName called "${e}"`);n[e]=t}send(e,t,n){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},n)}sendWithPromise(e,t,n){const s=this.callbackId++,i=Promise.withResolvers();this.callbackCapabilities[s]=i;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:s,data:t},n)}catch(o){i.reject(o)}return i.promise}sendWithStream(e,t,n,s){const i=this.streamId++,o=this.sourceName,l=this.targetName,c=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},c.postMessage({sourceName:o,targetName:l,action:e,streamId:i,data:t,desiredSize:u.desiredSize},s),d.promise},pull:u=>{const d=Promise.withResolvers();return this.streamControllers[i].pullCall=d,c.postMessage({sourceName:o,targetName:l,stream:tr.PULL,streamId:i,desiredSize:u.desiredSize}),d.promise},cancel:u=>{mr(u instanceof Error,"cancel must have a valid reason");const d=Promise.withResolvers();return this.streamControllers[i].cancelCall=d,this.streamControllers[i].isClosed=!0,c.postMessage({sourceName:o,targetName:l,stream:tr.CANCEL,streamId:i,reason:Kn(u)}),d.promise}},n)}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}da=new WeakSet,XP=function(e){const t=e.streamId,n=this.sourceName,s=e.sourceName,i=this.comObj,o=this,l=this.actionHandler[e.action],c={enqueue(u,d=1,h){if(this.isCancelled)return;const f=this.desiredSize;this.desiredSize-=d,f>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),i.postMessage({sourceName:n,targetName:s,stream:tr.ENQUEUE,streamId:t,chunk:u},h)},close(){this.isCancelled||(this.isCancelled=!0,i.postMessage({sourceName:n,targetName:s,stream:tr.CLOSE,streamId:t}),delete o.streamSinks[t])},error(u){mr(u instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,i.postMessage({sourceName:n,targetName:s,stream:tr.ERROR,streamId:t,reason:Kn(u)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};c.sinkCapability.resolve(),c.ready=c.sinkCapability.promise,this.streamSinks[t]=c,new Promise(function(u){u(l(e.data,c))}).then(function(){i.postMessage({sourceName:n,targetName:s,stream:tr.START_COMPLETE,streamId:t,success:!0})},function(u){i.postMessage({sourceName:n,targetName:s,stream:tr.START_COMPLETE,streamId:t,reason:Kn(u)})})},YP=function(e){const t=e.streamId,n=this.sourceName,s=e.sourceName,i=this.comObj,o=this.streamControllers[t],l=this.streamSinks[t];switch(e.stream){case tr.START_COMPLETE:e.success?o.startCall.resolve():o.startCall.reject(Kn(e.reason));break;case tr.PULL_COMPLETE:e.success?o.pullCall.resolve():o.pullCall.reject(Kn(e.reason));break;case tr.PULL:if(!l){i.postMessage({sourceName:n,targetName:s,stream:tr.PULL_COMPLETE,streamId:t,success:!0});break}l.desiredSize<=0&&e.desiredSize>0&&l.sinkCapability.resolve(),l.desiredSize=e.desiredSize,new Promise(function(c){var u;c((u=l.onPull)==null?void 0:u.call(l))}).then(function(){i.postMessage({sourceName:n,targetName:s,stream:tr.PULL_COMPLETE,streamId:t,success:!0})},function(c){i.postMessage({sourceName:n,targetName:s,stream:tr.PULL_COMPLETE,streamId:t,reason:Kn(c)})});break;case tr.ENQUEUE:if(mr(o,"enqueue should have stream controller"),o.isClosed)break;o.controller.enqueue(e.chunk);break;case tr.CLOSE:if(mr(o,"close should have stream controller"),o.isClosed)break;o.isClosed=!0,o.controller.close(),O(this,da,Ey).call(this,o,t);break;case tr.ERROR:mr(o,"error should have stream controller"),o.controller.error(Kn(e.reason)),O(this,da,Ey).call(this,o,t);break;case tr.CANCEL_COMPLETE:e.success?o.cancelCall.resolve():o.cancelCall.reject(Kn(e.reason)),O(this,da,Ey).call(this,o,t);break;case tr.CANCEL:if(!l)break;new Promise(function(c){var u;c((u=l.onCancel)==null?void 0:u.call(l,Kn(e.reason)))}).then(function(){i.postMessage({sourceName:n,targetName:s,stream:tr.CANCEL_COMPLETE,streamId:t,success:!0})},function(c){i.postMessage({sourceName:n,targetName:s,stream:tr.CANCEL_COMPLETE,streamId:t,reason:Kn(c)})}),l.sinkCapability.reject(Kn(e.reason)),l.isCancelled=!0,delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}},Ey=async function(e,t){var n,s,i;await Promise.allSettled([(n=e.startCall)==null?void 0:n.promise,(s=e.pullCall)==null?void 0:s.promise,(i=e.cancelCall)==null?void 0:i.promise]),delete this.streamControllers[t]};var $c,Om;class aV{constructor({parsedData:e,rawData:t}){$(this,$c);$(this,Om);P(this,$c,e),P(this,Om,t)}getRaw(){return x(this,Om)}get(e){return x(this,$c).get(e)??null}getAll(){return Ok(x(this,$c))}has(e){return x(this,$c).has(e)}}$c=new WeakMap,Om=new WeakMap;const Ro=Symbol("INTERNAL");var Mm,Fm,Bm,dh;class oV{constructor(e,{name:t,intent:n,usage:s}){$(this,Mm,!1);$(this,Fm,!1);$(this,Bm,!1);$(this,dh,!0);P(this,Mm,!!(e&as.DISPLAY)),P(this,Fm,!!(e&as.PRINT)),this.name=t,this.intent=n,this.usage=s}get visible(){if(x(this,Bm))return x(this,dh);if(!x(this,dh))return!1;const{print:e,view:t}=this.usage;return x(this,Mm)?(t==null?void 0:t.viewState)!=="OFF":x(this,Fm)?(e==null?void 0:e.printState)!=="OFF":!0}_setVisible(e,t,n=!1){e!==Ro&&ar("Internal method `_setVisible` called."),P(this,Bm,n
1148),P(this,dh,t)}}Mm=new WeakMap,Fm=new WeakMap,Bm=new WeakMap,dh=new WeakMap;var el,vt,hh,fh,$m,_N;class lV{constructor(e,t=as.DISPLAY){$(this,$m);$(this,el,null);$(this,vt,new Map);$(this,hh,null);$(this,fh,null);if(this.renderingIntent=t,this.name=null,this.creator=null,e!==null){this.name=e.name,this.creator=e.creator,P(this,fh,e.order);for(const n of e.groups)x(this,vt).set(n.id,new oV(t,n));if(e.baseState==="OFF")for(const n of x(this,vt).values())n._setVisible(Ro,!1);for(const n of e.on)x(this,vt).get(n)._setVisible(Ro,!0);for(const n of e.off)x(this,vt).get(n)._setVisible(Ro,!1);P(this,hh,this.getHash())}}isVisible(e){if(x(this,vt).size===0)return!0;if(!e)return ev("Optional content group not defined."),!0;if(e.type==="OCG")return x(this,vt).has(e.id)?x(this,vt).get(e.id).visible:(Je(`Optional content group not found: ${e.id}`),!0);if(e.type==="OCMD"){if(e.expression)return O(this,$m,_N).call(this,e.expression);if(!e.policy||e.policy==="AnyOn"){for(const t of e.ids){if(!x(this,vt).has(t))return Je(`Optional content group not found: ${t}`),!0;if(x(this,vt).get(t).visible)return!0}return!1}else if(e.policy==="AllOn"){for(const t of e.ids){if(!x(this,vt).has(t))return Je(`Optional content group not found: ${t}`),!0;if(!x(this,vt).get(t).visible)return!1}return!0}else if(e.policy==="AnyOff"){for(const t of e.ids){if(!x(this,vt).has(t))return Je(`Optional content group not found: ${t}`),!0;if(!x(this,vt).get(t).visible)return!0}return!1}else if(e.policy==="AllOff"){for(const t of e.ids){if(!x(this,vt).has(t))return Je(`Optional content group not found: ${t}`),!0;if(x(this,vt).get(t).visible)return!1}return!0}return Je(`Unknown optional content policy ${e.policy}.`),!0}return Je(`Unknown group type ${e.type}.`),!0}setVisibility(e,t=!0){const n=x(this,vt).get(e);if(!n){Je(`Optional content group not found: ${e}`);return}n._setVisible(Ro,!!t,!0),P(this,el,null)}setOCGState({state:e,preserveRB:t}){let n;for(const s of e){switch(s){case"ON":case"OFF":case"Toggle":n=s;continue}const i=x(this,vt).get(s);if(i)switch(n){case"ON":i._setVisible(Ro,!0);break;case"OFF":i._setVisible(Ro,!1);break;case"Toggle":i._setVisible(Ro,!i.visible);break}}P(this,el,null)}get hasInitialVisibility(){return x(this,hh)===null||this.getHash()===x(this,hh)}getOrder(){return x(this,vt).size?x(this,fh)?x(this,fh).slice():[...x(this,vt).keys()]:null}getGroups(){return x(this,vt).size>0?Ok(x(this,vt)):null}getGroup(e){return x(this,vt).get(e)||null}getHash(){if(x(this,el)!==null)return x(this,el);const e=new qP;for(const[t,n]of x(this,vt))e.update(`${t}:${n.visible}`);return P(this,el,e.hexdigest())}}el=new WeakMap,vt=new WeakMap,hh=new WeakMap,fh=new WeakMap,$m=new WeakSet,_N=function(e){const t=e.length;if(t<2)return!0;const n=e[0];for(let s=1;s<t;s++){const i=e[s];let o;if(Array.isArray(i))o=O(this,$m,_N).call(this,i);else if(x(this,vt).has(i))o=x(this,vt).get(i).visible;else return Je(`Optional content group not found: ${i}`),!0;switch(n){case"And":if(!o)return!1;break;case"Or":if(o)return!0;break;case"Not":return!o;default:return!0}}return n==="And"};class cV{constructor(e,{disableRange:t=!1,disableStream:n=!1}){mr(e,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:s,initialData:i,progressiveDone:o,contentDispositionFilename:l}=e;if(this._queuedChunks=[],this._progressiveDone=o,this._contentDispositionFilename=l,(i==null?void 0:i.length)>0){const c=i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer;this._queuedChunks.push(c)}this._pdfDataRangeTransport=e,this._isStreamingSupported=!n,this._isRangeSupported=!t,this._contentLength=s,this._fullRequestReader=null,this._rangeReaders=[],e.addRangeListener((c,u)=>{this._onReceiveData({begin:c,chunk:u})}),e.addProgressListener((c,u)=>{this._onProgress({loaded:c,total:u})}),e.addProgressiveReadListener(c=>{this._onReceiveData({chunk:c})}),e.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),e.transportReady()}_onReceiveData({begin:e,chunk:t}){const n=t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer;if(e===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(n):this._queuedChunks.push(n);else{const s=this._rangeReaders.some(function(i){return i._begin!==e?!1:(i._enqueue(n),!0)});mr(s,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}_onProgress(e){var t,n,s,i;e.total===void 0?(n=(t=this._rangeReaders[0])==null?void 0:t.onProgress)==null||n.call(t,{loaded:e.loaded}):(i=(s=this._fullRequestReader)==null?void 0:s.onProgress)==null||i.call(s,{loaded:e.loaded,total:e.total})}_onProgressiveDone(){var e;(e=this._fullRequestReader)==null||e.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){const t=this._rangeReaders.indexOf(e);t>=0&&this._rangeReaders.splice(t,1)}getFullReader(){mr(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;return this._queuedChunks=null,new uV(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const n=new dV(this,e,t);return this._pdfDataRangeTransport.requestDataRange(e,t),this._rangeReaders.push(n),n}cancelAllRequests(e){var t;(t=this._fullRequestReader)==null||t.cancel(e);for(const n of this._rangeReaders.slice(0))n.cancel(e);this._pdfDataRangeTransport.abort()}}class uV{constructor(e,t,n=!1,s=null){this._stream=e,this._done=n||!1,this._filename=$k(s)?s:null,this._queuedChunks=t||[],this._loaded=0;for(const i of this._queuedChunks)this._loaded+=i.byteLength;
1148this._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 t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class dV{constructor(e,t,n){this._stream=e,this._begin=t,this._end=n,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 n of this._requests)n.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 t=this._queuedChunk;return this._queuedChunk=null,{value:t,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 t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function hV(r){let e=!0,t=n("filename\\*","i").exec(r);if(t){t=t[1];let d=l(t);return d=unescape(d),d=c(d),d=u(d),i(d)}if(t=o(r),t){const d=u(t);return i(d)}if(t=n("filename","i").exec(r),t){t=t[1];let d=l(t);return d=u(d),i(d)}function n(d,h){return new RegExp("(?:^|;)\\s*"+d+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',h)}function s(d,h){if(d){if(!/^[\x00-\xFF]+$/.test(h))return h;try{const f=new TextDecoder(d,{fatal:!0}),p=rv(h);h=f.decode(p),e=!1}catch{}}return h}function i(d){return e&&/[\x80-\xff]/.test(d)&&(d=s("utf-8",d),e&&(d=s("iso-8859-1",d))),d}function o(d){const h=[];let f;const p=n("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(f=p.exec(d))!==null;){let[,g,v,b]=f;if(g=parseInt(g,10),g in h){if(g===0)break;continue}h[g]=[v,b]}const m=[];for(let g=0;g<h.length&&g in h;++g){let[v,b]=h[g];b=l(b),v&&(b=unescape(b),g===0&&(b=c(b))),m.push(b)}return m.join("")}function l(d){if(d.startsWith('"')){const h=d.slice(1).split('\\"');for(let f=0;f<h.length;++f){const p=h[f].indexOf('"');p!==-1&&(h[f]=h[f].slice(0,p),h.length=f+1),h[f]=h[f].replaceAll(/\\(.)/g,"$1")}d=h.join('"')}return d}function c(d){const h=d.indexOf("'");if(h===-1)return d;const f=d.slice(0,h),m=d.slice(h+1).replace(/^[^']*'/,"");return s(f,m)}function u(d){return!d.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(d)?d:d.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(h,f,p,m){if(p==="q"||p==="Q")return m=m.replaceAll("_"," "),m=m.replaceAll(/=([0-9a-fA-F]{2})/g,function(g,v){return String.fromCharCode(parseInt(v,16))}),s(f,m);try{m=atob(m)}catch{}return s(f,m)})}return""}function qk(r,e){const t=new Headers;if(!r||!e||typeof e!="object")return t;for(const n in e){const s=e[n];s!==void 0&&t.append(n,s)}return t}function Wk({responseHeaders:r,isHttp:e,rangeChunkSize:t,disableRange:n}){const s={allowRangeRequests:!1,suggestedLength:void 0},i=parseInt(r.get("Content-Length"),10);return!Number.isInteger(i)||(s.suggestedLength=i,i<=2*t)||n||!e||r.get("Accept-Ranges")!=="bytes"||(r.get("Content-Encoding")||"identity")!=="identity"||(s.allowRangeRequests=!0),s}function Vk(r){const e=r.get("Content-Disposition");if(e){let t=hV(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch{}if($k(t))return t}return null}function iv(r,e){return r===404||r===0&&e.startsWith("file:")?new Gu('Missing PDF "'+e+'".'):new tv(`Unexpected server response (${r}) while retrieving PDF "${e}".`,r)}function KP(r){return r===200||r===206}function JP(r,e,t){return{method:"GET",headers:r,signal:t.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function ZP(r){return r instanceof Uint8Array?r.buffer:r instanceof ArrayBuffer?r:(Je(`getArrayBuffer - unexpected data format: ${r}`),new Uint8Array(r).buffer)}class oT{constructor(e){this.source=e,this.isHttp=/^https?:/i.test(e.url),this.headers=qk(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 mr(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new fV(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const n=new pV(this,e,t);return this._rangeRequestReaders.push(n),n}cancelAllRequests(e){var t;(t=this._fullRequestReader)==null||t.cancel(e);for(const n of this._rangeRequestReaders.slice(0))n.cancel(e)}}class fV{constructor(e){this._stream=e,this._reader=null,this._loaded=0,this._filename=null;const t=e.source;this._withCredentials=t.withCredentials||!1,this._contentLength=t.length,this._headersCapability=Promise.withResolvers(),this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange;const n=new Headers(e.headers),s=t.url;fetch(s,JP(n,this._withCredentials,this._abortController)).then(i=>{if(!KP(i.status))throw iv(i.status,s);this._reader=i.body.getReader(),this._headersCapability.resolve();const o=i.headers,{allowRangeRequests:l,suggestedLength:c}=Wk({responseHeaders:o,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=l,this._contentLength=c||this._contentLength,this._filename=Vk(o),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Xu("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 n;await this._headersCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,(n=this.onProgress)==null||n.call(this,{loaded:this._loaded,total:this._contentLength}),{value:ZP(e),done:!1})}cancel(e){var t;(t=this._reader)==null||t.cancel(e),this._abortController.abort()}}class pV{constructor(e,t,n){this._stream=e,this._reader=null,this._loaded=0;const s=e.source;this._withCredentials=s.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!s.disableStream,this._abortController=new AbortController;const i=new Headers(e.headers);i.append("Range",`bytes=${t}-${n-1}`);const o=s.url;fetch(o,JP(i,this._withCredentials,this._abortController)).then(l=>{if(!KP(l.status))throw iv(l.status,o);this._readCapability.resolve(),this._reader=l.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var n;await this._readCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,(n=this.onProgress)==null||n.call(this,{loaded:this._loaded}),{value:ZP(e),done:!1})}cancel(e){var t;(t=this._reader)==null||t.cancel(e),this._abortController.abort()}}const n1=200,s1=206;function mV(r){const e=r.response;return typeof e!="string"?e:rv(e).buffer}class gV{constructor({url:e,httpHeaders:t,withCredentials:n}){this.url=e,this.isHttp=/^https?:/i.test(e),this.headers=qk(this.isHttp,t),this.withCredentials=n||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(e,t,n){const s={begin:e,end:t};for(const i in n)s[i]=n[i];return this.request(s)}requestFull(e){return this.request(e)}request(e){const t=new XMLHttpRequest,n=this.currXhrId++,s=this.pendingRequests[n]={xhr:t};t.open("GET",this.url),t.withCredentials=this.withCredentials;for(const[i,o]of this.headers)t.setRequestHeader(i,o);return this.isHttp&&"begin"in e&&"end"in e?(t.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),s.expectedStatus=s1):s.expectedStatus=n1,t.responseType="arraybuffer",e.onError&&(t.onerror=function(i){e.onError(t.status)}),t.onreadystatechange=this.onStateChange.bind(this,n),t.onprogress=this.onProgress.bind(this,n),s.onHeadersReceived=e.onHeadersReceived,s.onDone=e.onDone,s.onError=e.onError,s.onProgress=e.onProgress,t.send(null),n}onProgress(e,t){var s;const n=this.pendingRequests[e];n&&((s=n.onProgress)==null||s.call(n,t))}onStateChange(e,t){var c,u,d;const n=this.pendingRequests[e];if(!n)return;const s=n.xhr;if(s.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),s.readyState!==4||!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],s.status===0&&this.isHttp){(c=n.onError)==null||c.call(n,s.status);return}const i=s.status||n1;
1148if(!(i===n1&&n.expectedStatus===s1)&&i!==n.expectedStatus){(u=n.onError)==null||u.call(n,s.status);return}const l=mV(s);if(i===s1){const h=s.getResponseHeader("Content-Range"),f=/bytes (\d+)-(\d+)\/(\d+)/.exec(h);n.onDone({begin:parseInt(f[1],10),chunk:l})}else l?n.onDone({begin:0,chunk:l}):(d=n.onError)==null||d.call(n,s.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){const t=this.pendingRequests[e].xhr;delete this.pendingRequests[e],t.abort()}}class yV{constructor(e){this._source=e,this._manager=new gV(e),this._rangeChunkSize=e.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(e){const t=this._rangeRequestReaders.indexOf(e);t>=0&&this._rangeRequestReaders.splice(t,1)}getFullReader(){return mr(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new bV(this._manager,this._source),this._fullRequestReader}getRangeReader(e,t){const n=new xV(this._manager,e,t);return n.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(n),n}cancelAllRequests(e){var t;(t=this._fullRequestReader)==null||t.cancel(e);for(const n of this._rangeRequestReaders.slice(0))n.cancel(e)}}class bV{constructor(e,t){this._manager=e;const n={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._fullRequestId=e.requestFull(n),this._headersCapability=Promise.withResolvers(),this._disableRange=t.disableRange||!1,this._contentLength=t.length,this._rangeChunkSize=t.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const e=this._fullRequestId,t=this._manager.getRequestXhr(e),n=new Headers(t.getAllResponseHeaders().trim().split(/[\r\n]+/).map(o=>{const[l,...c]=o.split(": ");return[l,c.join(": ")]})),{allowRangeRequests:s,suggestedLength:i}=Wk({responseHeaders:n,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});s&&(this._isRangeSupported=!0),this._contentLength=i||this._contentLength,this._filename=Vk(n),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 t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(e){this._storedError=iv(e,this._url),this._headersCapability.reject(this._storedError);for(const t of this._requests)t.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(e){var t;(t=this.onProgress)==null||t.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(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 t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class xV{constructor(e,t,n){this._manager=e;const s={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._requestId=e.requestRange(t,n,s),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){var e;(e=this.onClosed)==null||e.call(this,this)}_onDone(e){const t=e.chunk;this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t,this._done=!0;for(const n of this._requests)n.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(e){this._storedError=iv(e,this._url);for(const t of this._requests)t.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){var t;this.isStreamingSupported||(t=this.onProgress)==null||t.call(this,{loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,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 t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest
1148(this._requestId),this._close()}}const vV=/^[a-z][a-z0-9\-+.]+:/i;function wV(r){if(vV.test(r))return new URL(r);const e=Ll.get("url");return new URL(e.pathToFileURL(r))}function QP(r,e,t){return r.protocol==="http:"?Ll.get("http").request(r,{headers:e},t):Ll.get("https").request(r,{headers:e},t)}class _V{constructor(e){this.source=e,this.url=wV(e.url),this.isHttp=this.url.protocol==="http:"||this.url.protocol==="https:",this.isFsUrl=this.url.protocol==="file:",this.headers=qk(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 mr(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new kV(this):new NV(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const n=this.isFsUrl?new CV(this,e,t):new SV(this,e,t);return this._rangeRequestReaders.push(n),n}cancelAllRequests(e){var t;(t=this._fullRequestReader)==null||t.cancel(e);for(const n of this._rangeRequestReaders.slice(0))n.cancel(e)}}class eI{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null;const t=e.source;this._contentLength=t.length,this._loaded=0,this._filename=null,this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers()}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var n;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,(n=this.onProgress)==null||n.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",t=>{this._error(t)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new Xu("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class tI{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const t=e.source;this._isStreamingSupported=!t.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){var n;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,(n=this.onProgress)==null||n.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",t=>{this._error(t)}),this._storedError&&this._readableStream.destroy(this._storedError)}}class NV extends eI{constructor(e){super(e);const t=Object.fromEntries(e.headers),n=s=>{if(s.statusCode===404){const c=new Gu(`Missing PDF "${this._url}".`);this._storedError=c,this._headersCapability.reject(c);return}this._headersCapability.resolve(),this._setReadableStream(s);const i=new Headers(this._readableStream.headers),{allowRangeRequests:o,suggestedLength:l}=Wk({responseHeaders:i,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=o,this._contentLength=l||this._contentLength,this._filename=Vk(i)};this._request=QP(this._url,t,n),this._request.on("error",s=>{this._storedError=s,this._headersCapability.reject(s)}),this._request.end()}}class SV extends tI{constructor(e,t,n){super(e);const s=Object.fromEntries(e.headers);s.Range=`bytes=${t}-${n-1}`;const i=o=>
vendor: 8,897 bytes, line 1148
1148{if(o.statusCode===404){const l=new Gu(`Missing PDF "${this._url}".`);this._storedError=l;return}this._setReadableStream(o)};this._request=QP(this._url,s,i),this._request.on("error",o=>{this._storedError=o}),this._request.end()}}class kV extends eI{constructor(e){super(e);const t=Ll.get("fs");t.promises.lstat(this._url).then(n=>{this._contentLength=n.size,this._setReadableStream(t.createReadStream(this._url)),this._headersCapability.resolve()},n=>{n.code==="ENOENT"&&(n=new Gu(`Missing PDF "${this._url}".`)),this._storedError=n,this._headersCapability.reject(n)})}}class CV extends tI{constructor(e,t,n){super(e);const s=Ll.get("fs");this._setReadableStream(s.createReadStream(this._url,{start:t,end:n-1}))}}const EV=1e5,jn=30,jV=.8;var h3,tl,Dn,Um,Hm,Uc,Ia,zm,qm,Hc,ph,mh,rl,gh,Wm,yh,zc,Vm,Gm,qc,Wc,Xm,nl,bh,vo,rI,nI,NN,ds,jy,SN,sI,iI;const cr=class cr{constructor({textContentSource:e,container:t,viewport:n}){$(this,vo);$(this,tl,Promise.withResolvers());$(this,Dn,null);$(this,Um,!1);$(this,Hm,!!((h3=globalThis.FontInspector)!=null&&h3.enabled));$(this,Uc,null);$(this,Ia,null);$(this,zm,0);$(this,qm,0);$(this,Hc,null);$(this,ph,null);$(this,mh,0);$(this,rl,0);$(this,gh,Object.create(null));$(this,Wm,[]);$(this,yh,null);$(this,zc,[]);$(this,Vm,new WeakMap);$(this,Gm,null);var c;if(e instanceof ReadableStream)P(this,yh,e);else if(typeof e=="object")P(this,yh,new ReadableStream({start(u){u.enqueue(e),u.close()}}));else throw new Error('No "textContentSource" parameter specified.');P(this,Dn,P(this,ph,t)),P(this,rl,n.scale*(globalThis.devicePixelRatio||1)),P(this,mh,n.rotation),P(this,Ia,{div:null,properties:null,ctx:null});const{pageWidth:s,pageHeight:i,pageX:o,pageY:l}=n.rawDims;P(this,Gm,[1,0,0,-1,-o,l+i]),P(this,qm,s),P(this,zm,i),O(c=cr,ds,sI).call(c),Iu(t,n),x(this,tl).promise.finally(()=>{x(cr,bh).delete(this),P(this,Ia,null),P(this,gh,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:e,isFirefox:t}=zn.platform;return it(this,"fontFamilyMap",new Map([["sans-serif",`${e&&t?"Calibri, ":""}sans-serif`],["monospace",`${e&&t?"Lucida Console, ":""}monospace`]]))}render(){const e=()=>{x(this,Hc).read().then(({value:t,done:n})=>{if(n){x(this,tl).resolve();return}x(this,Uc)??P(this,Uc,t.lang),Object.assign(x(this,gh),t.styles),O(this,vo,rI).call(this,t.items),e()},x(this,tl).reject)};return P(this,Hc,x(this,yh).getReader()),x(cr,bh).add(this),e(),x(this,tl).promise}update({viewport:e,onBefore:t=null}){var i;const n=e.scale*(globalThis.devicePixelRatio||1),s=e.rotation;if(s!==x(this,mh)&&(t==null||t(),P(this,mh,s),Iu(x(this,ph),{rotation:s})),n!==x(this,rl)){t==null||t(),P(this,rl,n);const o={div:null,properties:null,ctx:O(i=cr,ds,jy).call(i,x(this,Uc))};for(const l of x(this,zc))o.properties=x(this,Vm).get(l),o.div=l,O(this,vo,NN).call(this,o)}}cancel(){var t;const e=new Xu("TextLayer task cancelled.");(t=x(this,Hc))==null||t.cancel(e).catch(()=>{}),P(this,Hc,null),x(this,tl).reject(e)}get textDivs(){return x(this,zc)}get textContentItemsStr(){return x(this,Wm)}static cleanup(){if(!(x(this,bh).size>0)){x(this,qc).clear();for(const{canvas:e}of x(this,Wc).values())e.remove();x(this,Wc).clear()}}};tl=new WeakMap,Dn=new WeakMap,Um=new WeakMap,Hm=new WeakMap,Uc=new WeakMap,Ia=new WeakMap,zm=new WeakMap,qm=new WeakMap,Hc=new WeakMap,ph=new WeakMap,mh=new WeakMap,rl=new WeakMap,gh=new WeakMap,Wm=new WeakMap,yh=new WeakMap,zc=new WeakMap,Vm=new WeakMap,Gm=new WeakMap,qc=new WeakMap,Wc=new WeakMap,Xm=new WeakMap,nl=new WeakMap,bh=new WeakMap,vo=new WeakSet,rI=function(e){var s,i;if(x(this,Um))return;(i=x(this,Ia)).ctx??(i.ctx=O(s=cr,ds,jy).call(s,x(this,Uc)));const t=x(this,zc),n=x(this,Wm);for(const o of e){if(t.length>EV){Je("Ignoring additional textDivs for performance reasons."),P(this,Um,!0);return}if(o.str===void 0){if(o.type==="beginMarkedContentProps"||o.type==="beginMarkedContent"){const l=x(this,Dn);P(this,Dn,document.createElement("span")),x(this,Dn).classList.add("markedContent"),o.id!==null&&x(this,Dn).setAttribute("id",`${o.id}`),l.append(x(this,Dn))}else o.type==="endMarkedContent"&&P(this,Dn,x(this,Dn).parentNode);continue}n.push(o.str),O(this,vo,nI).call(this,o)}},nI=function(e){var g;const t=document.createElement("span"),n={angle:0,canvasWidth:0,hasText:e.str!=="",hasEOL:e.hasEOL,fontSize:0};x(this,zc).push(t);const s=Pe.transform(x(this,Gm),e.transform);let i=Math.atan2(s[1],s[0]);const o=x(this,gh)[e.fontName];o.vertical&&(i+=Math.PI/2);let l=x(this,Hm)&&o.fontSubstitution||o.fontFamily;l=cr.fontFamilyMap.get(l)||l;const c=Math.hypot(s[2],s[3]),u=c*O(g=cr,ds,iI).call(g,l,x(this,Uc));let d,h;i===0?(d=s[4],h=s[5]-u):(d=s[4]+u*Math.sin(i),h=s[5]-u*Math.cos(i));const f="calc(var(--scale-factor)*",p=t.style;x(this,Dn)===x(this,ph)?(p.left=`${(100*d/x(this,qm)).toFixed(2)}%`,p.top=`${(100*h/x(this,zm)).toFixed(2)}%`):(p.left=`${f}${d.toFixed(2)}px)`,p.top=`${f}${h.toFixed(2)}px)`),p.fontSize=`${f}${(x(cr,nl)*c).toFixed(2)}px)`,p.fontFamily=l,n.fontSize=c,t.setAttribute("role","presentation"),t.textContent=e.str,t.dir=e.dir,x(this,Hm)&&(t.dataset.fontName=o.fontSubstitutionLoadedName||e.fontName),i!==0&&(n.angle=i*(180/Math.PI));let m=!1;if(e.str.length>1)m=!0;else if(e.str!==" "&&e.transform[0]!==e.transform[3]){const v=Math.abs(e.transform[0]),b=Math.abs(e.transform[3]);v!==b&&Math.max(v,b)/Math.min(v,b)>1.5&&(m=!0)}if(m&&(n.canvasWidth=o.vertical?e.height:e.width),x(this,Vm).set(t,n),x(this,Ia).div=t,x(this,Ia).properties=n,O(this,vo,NN).call(this,x(this,Ia)),n.hasText&&x(this,Dn).append(t),n.hasEOL){const v=document.createElement("br");v.setAttribute("role","presentation"),x(this,Dn).append(v)}},NN=function(e){var l;const{div:t,properties:n,ctx:s}=e,{style:i}=t;let o="";if(x(cr,nl)>1&&(o=`scale(${1/x(cr,nl)})`),n.canvasWidth!==0&&n.hasText){const{fontFamily:c}=i,{canvasWidth:u,fontSize:d}=n;O(l=cr,ds,SN).call(l,s,d*x(this,rl),c);const{width:h}=s.measureText(t.textContent);h>0&&(o=`scaleX(${u*x(this,rl)/h}) ${o}`)}n.angle!==0&&(o=`rotate(${n.angle}deg) ${o}`),o.length>0&&(i.transform=o)},ds=new WeakSet,jy=function(e=null){let t=x(this,Wc).get(e||(e=""));if(!t){const n=document.createElement("canvas");n.className="hiddenCanvasElement",n.lang=e,document.body.append(n),t=n.getContext("2d",{alpha:!1,willReadFrequently:!0}),x(this,Wc).set(e,t),x(this,Xm).set(t,{size:0,family:""})}return t},SN=function(e,t,n){const s=x(this,Xm).get(e);t===s.size&&n===s.family||(e.font=`${t}px ${n}`,s.size=t,s.family=n)},sI=function(){if(x(this,nl)!==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),P(this,nl,e.getBoundingClientRect().height),e.remove()},iI=function(e,t){const n=x(this,qc).get(e);if(n)return n;const s=O(this,ds,jy).call(this,t);s.canvas.width=s.canvas.height=jn,O(this,ds,SN).call(this,s,jn,e);const i=s.measureText("");let o=i.fontBoundingBoxAscent,l=Math.abs(i.fontBoundingBoxDescent);if(o){const d=o/(o+l);return x(this,qc).set(e,d),s.canvas.width=s.canvas.height=0,d}s.strokeStyle="red",s.clearRect(0,0,jn,jn),s.strokeText("g",0,0);let c=s.getImageData(0,0,jn,jn).data;l=0;for(let d=c.length-1-3;d>=0;d-=4)if(c[d]>0){l=Math.ceil(d/4/jn);break}s.clearRect(0,0,jn,jn),s.strokeText("A",0,jn),c=s.getImageData(0,0,jn,jn).data,o=0;for(let d=0,h=c.length;d<h;d+=4)if(c[d]>0){o=jn-Math.floor(d/4/jn);break}s.canvas.width=s.canvas.height=0;const u=o?o/(o+l):jV;return x(this,qc).set(e,u),u},$(cr,ds),$(cr,qc,new Map),$(cr,Wc,new Map),$(cr,Xm,new WeakMap),$(cr,nl,null),$(cr,bh,new Set);let Qp=cr;class em{static textContent(e){const t=[],n={items:t,styles:Object.create(null)};function s(i){var c;if(!i)return;let o=null;const l=i.name;if(l==="#text")o=i.value;else if(em.shouldBuildText(l))(c=i==null?void 0:i.attributes)!=null&&c.textContent?o=i.attributes.textContent:i.value&&(o=i.value);else return;if(o!==null&&t.push({str:o}),!!i.children)for(const u of i.children)s(u)}return s(e),n}static shouldBuildText(e){return!(e==="textarea"||e==="input"||e==="option"||e==="select")}}const AV=65536,TV=100,DV=5e3,RV=an?qW:DW,PV=an?WW:yP,IV=an?zW:TW,LV=an?VW:bP;function OV(r={}){typeof r=="string"||r instanceof URL?r={url:r}:(r instanceof ArrayBuffer||ArrayBuffer.isView(r))&&(r={data:r});const e=new kN,{docId:t}=e,n=r.url?MV(r.url):null,s=r.data?FV(r.data):null,i=r.httpHeaders||null,o=r.withCredentials===!0,l=r.password??null,c=r.range instanceof aI?r.range:null,u=Number.isInteger(r.rangeChunkSize)&&r.rangeChunkSize>0?r.rangeChunkSize:AV;let d=r.worker instanceof Xd?r.worker:null;const h=r.verbosity,f=typeof r.docBaseUrl=="string"&&!sv(r.docBaseUrl)?r.docBaseUrl:null,p=typeof r.cMapUrl=="string"?r.cMapUrl:null,m=r.cMapPacked!==!1,g=r.CMapReaderFactory||PV,v=typeof r.standardFontDataUrl=="string"?r.standardFontDataUrl:null,b=r.StandardFontDataFactory||LV,y=r.stopAtErrors!==!0,w=Number.isInteger(r.maxImageSize)&&r.maxImageSize>
1148-1?r.maxImageSize:-1,_=r.isEvalSupported!==!1,N=typeof r.isOffscreenCanvasSupported=="boolean"?r.isOffscreenCanvasSupported:!an,S=Number.isInteger(r.canvasMaxAreaInBytes)?r.canvasMaxAreaInBytes:-1,E=typeof r.disableFontFace=="boolean"?r.disableFontFace:an,T=r.fontExtraProperties===!0,D=r.enableXfa===!0,R=r.ownerDocument||globalThis.document,H=r.disableRange===!0,A=r.disableStream===!0,U=r.disableAutoFetch===!0,C=r.pdfBug===!0,M=r.CanvasFactory||RV,L=r.FilterFactory||IV,B=r.enableHWA===!0,I=c?c.length:r.length??NaN,z=typeof r.useSystemFonts=="boolean"?r.useSystemFonts:!an&&!E,X=typeof r.useWorkerFetch=="boolean"?r.useWorkerFetch:g===yP&&b===bP&&p&&v&&rp(p,document.baseURI)&&rp(v,document.baseURI);r.canvasFactory&&XA("`canvasFactory`-instance option, please use `CanvasFactory` instead."),r.filterFactory&&XA("`filterFactory`-instance option, please use `FilterFactory` instead.");const F=null;bW(h);const q={canvasFactory:new M({ownerDocument:R,enableHWA:B}),filterFactory:new L({docId:t,ownerDocument:R}),cMapReaderFactory:X?null:new g({baseUrl:p,isCompressed:m}),standardFontDataFactory:X?null:new b({baseUrl:v})};if(!d){const ee={verbosity:h,port:Ja.workerPort};d=ee.port?Xd.fromPort(ee):new Xd(ee),e._worker=d}const V={docId:t,apiVersion:"4.7.76",data:s,password:l,disableAutoFetch:U,rangeChunkSize:u,length:I,docBaseUrl:f,enableXfa:D,evaluatorOptions:{maxImageSize:w,disableFontFace:E,ignoreErrors:y,isEvalSupported:_,isOffscreenCanvasSupported:N,canvasMaxAreaInBytes:S,fontExtraProperties:T,useSystemFonts:z,cMapUrl:X?p:null,standardFontDataUrl:X?v:null}},K={disableFontFace:E,fontExtraProperties:T,ownerDocument:R,pdfBug:C,styleElement:F,loadingParams:{disableAutoFetch:U,enableXfa:D}};return d.promise.then(function(){if(e.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const ee=d.messageHandler.sendWithPromise("GetDocRequest",V,s?[s.buffer]:null);let Z;if(c)Z=new cV(c,{disableRange:H,disableStream:A});else if(!s){if(!n)throw new Error("getDocument - no `url` parameter provided.");let ie;an?ie=typeof fetch<"u"&&typeof Response<"u"&&"body"in Response.prototype&&rp(n)?oT:_V:ie=rp(n)?oT:yV,Z=new ie({url:n,length:I,httpHeaders:i,withCredentials:o,rangeChunkSize:u,disableRange:H,disableStream:A})}return ee.then(ie=>{if(e.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const pe=new ip(t,ie,d.port),me=new HV(pe,e,Z,K,q);e._transport=me,pe.send("Ready",null)})}).catch(e._capability.reject),e}function MV(r){if(r instanceof URL)return r.href;try{return new URL(r,window.location).href}catch{if(an&&typeof r=="string")return r}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function FV(r){if(an&&typeof Buffer<"u"&&r instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(r instanceof Uint8Array&&r.byteLength===r.buffer.byteLength)return r;if(typeof r=="string")return rv(r);if(r instanceof ArrayBuffer||ArrayBuffer.isView(r)||typeof r=="object"&&!isNaN(r==null?void 0:r.length))return new Uint8Array(r);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function lT(r){return typeof r=="object"&&Number.isInteger(r==null?void 0:r.num)&&r.num>=0&&Number.isInteger(r==null?void 0:r.gen)&&r.gen>=0}var dx;const hx=class hx{constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId=`d${fn(hx,dx)._++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){var e,t,n;this.destroyed=!0;try{(e=this._worker)!=null&&e.port&&(this._worker._pendingDestroy=!0),await((t=this._transport)==null?void 0:t.destroy())}catch(s){throw(n=this._worker)!=null&&n.port&&delete this._worker._pendingDestroy,s}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}};dx=new WeakMap,$(hx,dx,0);let kN=hx;class aI{constructor(e,t,n=!1,s=null){this.length=e,this.initialData=t,this.progressiveDone=n,this.contentDispositionFilename=s,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}addRangeListener(e){this._rangeListeners.push(e)}addProgressListener(e){this._progressListeners.push(e)}addProgressiveReadListener(e){this._progressiveReadListeners.push(e)}addProgressiveDoneListener(e){this._progressiveDoneListeners.push(e)}onDataRange(e,t){for(const n of this._rangeListeners)n(e,t)}onDataProgress(e,t){this._readyCapability.promise.then(()=>{for(const n of this._progressListeners)n(e,t)})}onDataProgressiveRead(e){this._readyCapability.promise.then(()=>{for(const t of this._progressiveReadListeners)t(e)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const e of this._progressiveDoneListeners)e()})}transportReady(){this._readyCapability.resolve()}requestDataRange(e,t){ar("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class BV{constructor(e,t){this._pdfInfo=e,this._transport=t}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return it(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)}
1148getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:e="display"}={}){const{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getOptionalContentConfig(t)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(e){return this._transport.cachedPageNumber(e)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}var sl,La,Ls,bd,Ay;class $V{constructor(e,t,n,s=!1){$(this,Ls);$(this,sl,null);$(this,La,!1);this._pageIndex=e,this._pageInfo=t,this._transport=n,this._stats=s?new GA:null,this._pdfBug=s,this.commonObjs=n.commonObjs,this.objs=new oI,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:e,rotation:t=this.rotate,offsetX:n=0,offsetY:s=0,dontFlip:i=!1}={}){return new Yg({viewBox:this.view,scale:e,rotation:t,offsetX:n,offsetY:s,dontFlip:i})}getAnnotations({intent:e="display"}={}){const{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,t)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return it(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,viewport:t,intent:n="display",annotationMode:s=Ho.ENABLE,transform:i=null,background:o=null,optionalContentConfigPromise:l=null,annotationCanvasMap:c=null,pageColors:u=null,printAnnotationStorage:d=null,isEditing:h=!1}){var _,N;(_=this._stats)==null||_.time("Overall");const f=this._transport.getRenderingIntent(n,s,d,h),{renderingIntent:p,cacheKey:m}=f;P(this,La,!1),O(this,Ls,Ay).call(this),l||(l=this._transport.getOptionalContentConfig(p));let g=this._intentStates.get(m);g||(g=Object.create(null),this._intentStates.set(m,g)),g.streamReaderCancelTimeout&&(clearTimeout(g.streamReaderCancelTimeout),g.streamReaderCancelTimeout=null);const v=!!(p&as.PRINT);g.displayReadyCapability||(g.displayReadyCapability=Promise.withResolvers(),g.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(N=this._stats)==null||N.time("Page Request"),this._pumpOperatorList(f));const b=S=>{var E;g.renderTasks.delete(y),(this._maybeCleanupAfterRender||v)&&P(this,La,!0),O(this,Ls,bd).call(this,!v),S?(y.capability.reject(S),this._abortOperatorList({intentState:g,reason:S instanceof Error?S:new Error(S)})):y.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(E=globalThis.Stats)!=null&&E.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},y=new EN({callback:b,params:{canvasContext:e,viewport:t,transform:i,background:o},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:c,operatorList:g.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!v,pdfBug:this._pdfBug,page
1148Colors:u});(g.renderTasks||(g.renderTasks=new Set)).add(y);const w=y.task;return Promise.all([g.displayReadyCapability.promise,l]).then(([S,E])=>{var T;if(this.destroyed){b();return}if((T=this._stats)==null||T.time("Rendering"),!(E.renderingIntent&p))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");y.initializeGraphics({transparency:S,optionalContentConfig:E}),y.operatorListChanged()}).catch(b),w}getOperatorList({intent:e="display",annotationMode:t=Ho.ENABLE,printAnnotationStorage:n=null,isEditing:s=!1}={}){var u;function i(){l.operatorList.lastChunk&&(l.opListReadCapability.resolve(l.operatorList),l.renderTasks.delete(c))}const o=this._transport.getRenderingIntent(e,t,n,s,!0);let l=this._intentStates.get(o.cacheKey);l||(l=Object.create(null),this._intentStates.set(o.cacheKey,l));let c;return l.opListReadCapability||(c=Object.create(null),c.operatorListChanged=i,l.opListReadCapability=Promise.withResolvers(),(l.renderTasks||(l.renderTasks=new Set)).add(c),l.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(u=this._stats)==null||u.time("Page Request"),this._pumpOperatorList(o)),l.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:t=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:e===!0,disableNormalization:t===!0},{highWaterMark:100,size(s){return s.items.length}})}getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then(n=>em.textContent(n));const t=this.streamTextContent(e);return new Promise(function(n,s){function i(){o.read().then(function({value:c,done:u}){if(u){n(l);return}l.lang??(l.lang=c.lang),Object.assign(l.styles,c.styles),l.items.push(...c.items),i()},s)}const o=t.getReader(),l={items:[],styles:Object.create(null),lang:null};i()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const e=[];for(const t of this._intentStates.values())if(this._abortOperatorList({intentState:t,reason:new Error("Page was destroyed."),force:!0}),!t.opListReadCapability)for(const n of t.renderTasks)e.push(n.completed),n.cancel();return this.objs.clear(),P(this,La,!1),O(this,Ls,Ay).call(this),Promise.all(e)}cleanup(e=!1){P(this,La,!0);const t=O(this,Ls,bd).call(this,!1);return e&&t&&this._stats&&(this._stats=new GA),t}_startRenderPage(e,t){var s,i;const n=this._intentStates.get(t);n&&((s=this._stats)==null||s.timeEnd("Page Request"),(i=n.displayReadyCapability)==null||i.resolve(e))}_renderPageChunk(e,t){for(let n=0,s=e.length;n<s;n++)t.operatorList.fnArray.push(e.fnArray[n]),t.operatorList.argsArray.push(e.argsArray[n]);t.operatorList.lastChunk=e.lastChunk,t.operatorList.separateAnnots=e.separateAnnots;for(const n of t.renderTasks)n.operatorListChanged();e.lastChunk&&O(this,Ls,bd).call(this,!0)}_pumpOperatorList({renderingIntent:e,cacheKey:t,annotationStorageSerializable:n,modifiedIds:s}){const{map:i,transfer:o}=n,c=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:t,annotationStorage:i,modifiedIds:s},o).getReader(),u=this._intentStates.get(t);u.streamReader=c;const d=()=>{c.read().then(({value:h,done:f})=>{if(f){u.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(h,u),d())},h=>{if(u.streamReader=null,!this._transport.destroyed){if(u.operatorList){u.operatorList.lastChunk=!0;for(const f of u.renderTasks)f.operatorListChanged();O(this,Ls,bd).call(this,!0)}if(u.displayReadyCapability)u.displayReadyCapability.reject(h);else if(u.opListReadCapability)u.opListReadCapability.reject(h);else throw h}})};d()}_abortOperatorList({intentState:e,reason:t,force:n=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!n){if(e.renderTasks.size>0)return;if(t instanceof Bk){let s=TV;t.extraDelay>0&&t.extraDelay<1e3&&(s+=t.extraDelay),e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:t,force:!0})},s);return}}if(e.streamReader.cancel(new Xu(t.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(const[s,i]of this._intentStates)if(i===e){this._intentStates.delete(s);break}this.cleanup()}}}get stats(){return this._stats}}sl=new WeakMap,La=new WeakMap,Ls=new WeakSet,bd=function(e=!1){if(O(this,Ls,Ay).call(this),!x(this,La)||this.destroyed)return!1;if(e)return P(this,sl,setTimeout(()=>{P(this,sl,null),O(this,Ls,bd).call(this,!1)},DV)),!1;for(const{renderTasks:t,operatorList:n}of this._intentStates.values())if(t.size>0||!n.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),P(this,La,!1),!0},Ay=function(){x(this,sl)&&(clearTimeout(x(this,sl)),P(this,sl,null))};var Vc,fx;class UV{constructor(){$(this,Vc,new Set);$(this,fx,Promise.resolve())}postMessage(e,t){const n={data:structuredClone(e,t?{transfer:t}:null)};x(this,fx).then(()=>{for(const s of x(this,Vc))s.call(this,n)})}addEventListener(e,t){x(this,Vc).add(t)}removeEventListener(e,t){x(this,Vc).delete(t)}terminate(){x(this,Vc).clear()}}Vc=new WeakMap,fx=new WeakMap;var px,Gc,Xc,xh,Ty,vh,Dy;const Ot=class Ot{constructor({name:e=null,port:t=null,verbosity:n=xW()}={}){$(this,xh);var s;if(this.name=e,this.destroyed=!1,this.verbosity=n,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,t){if((s=x(Ot,Xc))!=null&&s.has(t))throw new Error("Cannot use more than one PDFWorker per port.");(x(Ot,Xc)||P(Ot,Xc,new WeakMap)).set(t,this),this._initializeFromPort(t);return}this._initialize()}get promise(){return an?Promise.all([Ll.promise,this._readyCapability.promise]):this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(e){this._port=e,this._messageHandler=new ip("main","worker",e),this._messageHandler.on("ready",function(){}),O(this,xh,Ty).call(this)}_initialize(){if(x(Ot,Gc)||x(Ot,vh,Dy)){this._setupFakeWorker();return}let{workerSrc:e}=Ot;try{Ot._isSameOrigin(window.location.href,e)||(e=Ot._createCDNWrapper(new URL(e,window.location).href));const t=new Worker(e,{type:"module"}),n=new ip("main","worker",t),s=()=>{i.abort(),n.destroy(),t.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},i=new AbortController;t.addEventListener("error",()=>{this._webWorker||s()},{signal:i.signal}),n.on("test",l=>
1148{if(i.abort(),this.destroyed||!l){s();return}this._messageHandler=n,this._port=t,this._webWorker=t,O(this,xh,Ty).call(this)}),n.on("ready",l=>{if(i.abort(),this.destroyed){s();return}try{o()}catch{this._setupFakeWorker()}});const o=()=>{const l=new Uint8Array;n.send("test",l,[l.buffer])};o();return}catch{ev("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){x(Ot,Gc)||(Je("Setting up fake worker."),P(Ot,Gc,!0)),Ot._setupFakeWorkerGlobal.then(e=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const t=new UV;this._port=t;const n=`fake${fn(Ot,px)._++}`,s=new ip(n+"_worker",n,t);e.setup(s,t),this._messageHandler=new ip(n,n+"_worker",t),O(this,xh,Ty).call(this)}).catch(e=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${e.message}".`))})}destroy(){var e;this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),(e=x(Ot,Xc))==null||e.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(e){var n;if(!(e!=null&&e.port))throw new Error("PDFWorker.fromPort - invalid method signature.");const t=(n=x(this,Xc))==null?void 0:n.get(e.port);if(t){if(t._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return t}return new Ot(e)}static get workerSrc(){if(Ja.workerSrc)return Ja.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return it(this,"_setupFakeWorkerGlobal",(async()=>x(this,vh,Dy)?x(this,vh,Dy):(await import(this.workerSrc)).WorkerMessageHandler)())}};px=new WeakMap,Gc=new WeakMap,Xc=new WeakMap,xh=new WeakSet,Ty=function(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})},vh=new WeakSet,Dy=function(){var e;try{return((e=globalThis.pdfjsWorker)==null?void 0:e.WorkerMessageHandler)||null}catch{return null}},$(Ot,vh),$(Ot,px,0),$(Ot,Gc,!1),$(Ot,Xc),an&&(P(Ot,Gc,!0),Ja.workerSrc||(Ja.workerSrc="./pdf.worker.mjs")),Ot._isSameOrigin=(e,t)=>{let n;try{if(n=new URL(e),!n.origin||n.origin==="null")return!1}catch{return!1}const s=new URL(t,n);return n.origin===s.origin},Ot._createCDNWrapper=e=>{const t=`await import("${e}");`;return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))};let Xd=Ot;var Oa,Xi,wh,_h,Yi,Yc,ap;class HV{constructor(e,t,n,s,i){$(this,Yc);$(this,Oa,new Map);$(this,Xi,new Map);$(this,wh,new Map);$(this,_h,new Map);$(this,Yi,null);this.messageHandler=e,this.loadingTask=t,this.commonObjs=new oI,this.fontLoader=new UW({ownerDocument:s.ownerDocument,styleElement:s.styleElement}),this.loadingParams=s.loadingParams,this._params=s,this.canvasFactory=i.canvasFactory,this.filterFactory=i.filterFactory,this.cMapReaderFactory=i.cMapReaderFactory,this.standardFontDataFactory=i.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=n,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}get annotationStorage(){return it(this,"annotationStorage",new Hk)}getRenderingIntent(e,t=Ho.ENABLE,n=null,s=!1,i=!1){let o=as.DISPLAY,l=gN;switch(e){case"any":o=as.ANY;break;case"display":break;case"print":o=as.PRINT;break;default:Je(`getRenderingIntent - invalid intent: ${e}`)}const c=o&as.PRINT&&n instanceof VP?n:this.annotationStorage;switch(t){case Ho.DISABLE:o+=as.ANNOTATIONS_DISABLE;break;case Ho.ENABLE:break;case Ho.ENABLE_FORMS:o+=as.ANNOTATIONS_FORMS;break;case Ho.ENABLE_STORAGE:o+=as.ANNOTATIONS_STORAGE,l=c.serializable;break;default:Je(`getRenderingIntent - invalid annotationMode: ${t}`)}s&&(o+=as.IS_EDITING),i&&(o+=as.OPLIST);const{ids:u,hash:d}=c.modifiedIds,h=[o,l.hash,d];return{renderingIntent:o,cacheKey:h.join("_"),annotationStorageSerializable:l,modifiedIds:u}}destroy(){var n;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(n=x(this,Yi))==null||n.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const s of x(this,Xi).values())e.push(s._destroy());x(this,Xi).clear(),x(this,wh).clear(),x(this,_h).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();
1148const t=this.messageHandler.sendWithPromise("Terminate",null);return e.push(t),Promise.all(e).then(()=>{var s;this.commonObjs.clear(),this.fontLoader.clear(),x(this,Oa).clear(),this.filterFactory.destroy(),Qp.cleanup(),(s=this._networkStream)==null||s.cancelAllRequests(new Xu("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:t}=this;e.on("GetReader",(n,s)=>{mr(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=i=>{this._lastProgress={loaded:i.loaded,total:i.total}},s.onPull=()=>{this._fullReader.read().then(function({value:i,done:o}){if(o){s.close();return}mr(i instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),s.enqueue(new Uint8Array(i),1,[i])}).catch(i=>{s.error(i)})},s.onCancel=i=>{this._fullReader.cancel(i),s.ready.catch(o=>{if(!this.destroyed)throw o})}}),e.on("ReaderHeadersReady",n=>{const s=Promise.withResolvers(),i=this._fullReader;return i.headersReady.then(()=>{var o;(!i.isStreamingSupported||!i.isRangeSupported)&&(this._lastProgress&&((o=t.onProgress)==null||o.call(t,this._lastProgress)),i.onProgress=l=>{var c;(c=t.onProgress)==null||c.call(t,{loaded:l.loaded,total:l.total})}),s.resolve({isStreamingSupported:i.isStreamingSupported,isRangeSupported:i.isRangeSupported,contentLength:i.contentLength})},s.reject),s.promise}),e.on("GetRangeReader",(n,s)=>{mr(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const i=this._networkStream.getRangeReader(n.begin,n.end);if(!i){s.close();return}s.onPull=()=>{i.read().then(function({value:o,done:l}){if(l){s.close();return}mr(o instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),s.enqueue(new Uint8Array(o),1,[o])}).catch(o=>{s.error(o)})},s.onCancel=o=>{i.cancel(o),s.ready.catch(l=>{if(!this.destroyed)throw l})}}),e.on("GetDoc",({pdfInfo:n})=>{this._numPages=n.numPages,this._htmlForXfa=n.htmlForXfa,delete n.htmlForXfa,t._capability.resolve(new BV(n,this))}),e.on("DocException",function(n){let s;switch(n.name){case"PasswordException":s=new V_(n.message,n.code);break;case"InvalidPDFException":s=new uP(n.message);break;case"MissingPDFException":s=new Gu(n.message);break;case"UnexpectedResponseException":s=new tv(n.message,n.status);break;case"UnknownErrorException":s=new G_(n.message,n.details);break;default:ar("DocException - expected a valid Error.")}t._capability.reject(s)}),e.on("PasswordRequest",n=>{if(P(this,Yi,Promise.withResolvers()),t.onPassword){const s=i=>{i instanceof Error?x(this,Yi).reject(i):x(this,Yi).resolve({password:i})};try{t.onPassword(s,n.code)}catch(i){x(this,Yi).reject(i)}}else x(this,Yi).reject(new V_(n.message,n.code));return x(this,Yi).promise}),e.on("DataLoaded",n=>{var s;(s=t.onProgress)==null||s.call(t,{loaded:n.length,total:n.length}),this.downloadInfoCapability.resolve(n)}),e.on("StartRenderPage",n=>{if(this.destroyed)return;x(this,Xi).get(n.pageIndex)._startRenderPage(n.transparency,n.cacheKey)}),e.on("commonobj",([n,s,i])=>{var o;if(this.destroyed||this.commonObjs.has(n))return null;switch(s){case"Font":const{disableFontFace:l,fontExtraProperties:c,pdfBug:u}=this._params;if("error"in i){const p=i.error;Je(`Error during font loading: ${p}`),this.commonObjs.resolve(n,p);break}const d=u&&((o=globalThis.FontInspector)!=null&&o.enabled)?(p,m)=>globalThis.FontInspector.fontAdded(p,m):null,h=new HW(i,{disableFontFace:l,inspectFont:d});this.fontLoader.bind(h).catch(()=>e.sendWithPromise("FontFallback",{id:n})).finally(()=>{!c&&h.data&&(h.data=null),this.commonObjs.resolve(n,h)});break;case"CopyLocalImage":const{imageRef:f}=i;mr(f,"The imageRef must be defined.");for(const p of x(this,Xi).values())for(const[,m]of p.objs)if((m==null?void 0:m.ref)===f)return m.dataLen?(this.commonObjs.resolve(n,structuredClone(m)),m.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(n,i);break;default:throw new Error(`Got unknown common object type ${s}`)}return null}),e.on("obj",([n,s,i,o])=>{var c;if(this.destroyed)return;const l=x(this,Xi).get(s);if(!l.objs.has(n)){if(l._intentStates.size===0){(c=o==null?void 0:o.bitmap)==null||c.close();return}
1148switch(i){case"Image":l.objs.resolve(n,o),(o==null?void 0:o.dataLen)>pW&&(l._maybeCleanupAfterRender=!0);break;case"Pattern":l.objs.resolve(n,o);break;default:throw new Error(`Got unknown object type ${i}`)}}}),e.on("DocProgress",n=>{var s;this.destroyed||(s=t.onProgress)==null||s.call(t,{loaded:n.loaded,total:n.total})}),e.on("FetchBuiltInCMap",n=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(n):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),e.on("FetchStandardFontData",n=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(n):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var n;this.annotationStorage.size<=0&&Je("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:e,transfer:t}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:((n=this._fullReader)==null?void 0:n.filename)??null},t).finally(()=>{this.annotationStorage.resetModified()})}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(new Error("Invalid page request."));const t=e-1,n=x(this,wh).get(t);if(n)return n;const s=this.messageHandler.sendWithPromise("GetPage",{pageIndex:t}).then(i=>{if(this.destroyed)throw new Error("Transport destroyed");i.refStr&&x(this,_h).set(i.refStr,e);const o=new $V(t,i,this,this._params.pdfBug);return x(this,Xi).set(t,o),o});return x(this,wh).set(t,s),s}getPageIndex(e){return lT(e)?this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(e,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:t})}getFieldObjects(){return O(this,Yc,ap).call(this,"GetFieldObjects")}hasJSActions(){return O(this,Yc,ap).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)}getDocJSActions(){return O(this,Yc,ap).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 O(this,Yc,ap).call(this,"GetOptionalContentConfig").then(t=>new lV(t,e))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const e="GetMetadata",t=x(this,Oa).get(e);if(t)return t;const n=this.messageHandler.sendWithPromise(e,null).then(s=>{var i,o;return{info:s[0],metadata:s[1]?new aV(s[1]):null,contentDispositionFilename:((i=this._fullReader)==null?void 0:i.filename)??null,contentLength:((o=this._fullReader)==null?void 0:o.contentLength)??null}});return x(this,Oa).set(e,n),n}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithProm
1148ise("Cleanup",null);for(const t of x(this,Xi).values())if(!t.cleanup())throw new Error(`startCleanup: Page ${t.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),x(this,Oa).clear(),this.filterFactory.destroy(!0),Qp.cleanup()}}cachedPageNumber(e){if(!lT(e))return null;const t=e.gen===0?`${e.num}R`:`${e.num}R${e.gen}`;return x(this,_h).get(t)??null}}Oa=new WeakMap,Xi=new WeakMap,wh=new WeakMap,_h=new WeakMap,Yi=new WeakMap,Yc=new WeakSet,ap=function(e,t=null){const n=x(this,Oa).get(e);if(n)return n;const s=this.messageHandler.sendWithPromise(e,t);return x(this,Oa).set(e,s),s};const H0=Symbol("INITIAL_DATA");var ci,Ym,CN;class oI{constructor(){$(this,Ym);$(this,ci,Object.create(null))}get(e,t=null){if(t){const s=O(this,Ym,CN).call(this,e);return s.promise.then(()=>t(s.data)),null}const n=x(this,ci)[e];if(!n||n.data===H0)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return n.data}has(e){const t=x(this,ci)[e];return!!t&&t.data!==H0}resolve(e,t=null){const n=O(this,Ym,CN).call(this,e);n.data=t,n.resolve()}clear(){var e;for(const t in x(this,ci)){const{data:n}=x(this,ci)[t];(e=n==null?void 0:n.bitmap)==null||e.close()}P(this,ci,Object.create(null))}*[Symbol.iterator](){for(const e in x(this,ci)){const{data:t}=x(this,ci)[e];t!==H0&&(yield[e,t])}}}ci=new WeakMap,Ym=new WeakSet,CN=function(e){var t;return(t=x(this,ci))[e]||(t[e]={...Promise.withResolvers(),data:H0})};var il;class zV{constructor(e){$(this,il,null);P(this,il,e),this.onContinue=null}get promise(){return x(this,il).capability.promise}cancel(e=0){x(this,il).cancel(null,e)}get separateAnnots(){const{separateAnnots:e}=x(this,il).operatorList;if(!e)return!1;const{annotationCanvasMap:t}=x(this,il);return e.form||e.canvas&&(t==null?void 0:t.size)>0}}il=new WeakMap;var al,Kc;const mc=class mc{constructor({callback:e,params:t,objs:n,commonObjs:s,annotationCanvasMap:i,operatorList:o,pageIndex:l,canvasFactory:c,filterFactory:u,useRequestAnimationFrame:d=!1,pdfBug:h=!1,pageColors:f=null}){$(this,al,null);this.callback=e,this.params=t,this.objs=n,this.commonObjs=s,this.annotationCanvasMap=i,this.operatorListIdx=null,this.operatorList=o,this._pageIndex=l,this.canvasFactory=c,this.filterFactory=u,this._pdfBug=h,this.pageColors=f,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 zV(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=t.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:e=!1,optionalContentConfig:t}){var l,c;if(this.cancelled)return;if(this._canvas){if(x(mc,Kc).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.");x(mc,Kc).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{canvasContext:n,viewport:s,transform:i,background:o}=this.params;this.gfx=new Gd(n,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:t},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:i,viewport:s,transparency:e,background:o}),this.operatorListIdx=0,this.graphicsReady=!0,(c=this.graphicsReadyCallback)==null||c.call(this)}cancel(e=null,t=0){var n;this.running=!1,this.cancelled=!0,(n=this.gfx)==null||n.endDrawing(),x(this,al)&&(window.cancelAnimationFrame(x(this,al)),P(this,al,null)),x(mc,Kc).delete(this._canvas),this.callback(e||new Bk(`Rendering cancelled, page ${this._pageIndex+1}`,t))}operatorListChanged(){var e;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}(e=this.stepper)==null||e.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?P(this,al,window.requestAnimationFrame(()=>{P(this,al,null),this._nextBound().catch(this._cancelBound)}
1148)):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),x(mc,Kc).delete(this._canvas),this.callback())))}};al=new WeakMap,Kc=new WeakMap,$(mc,Kc,new WeakSet);let EN=mc;const qV="4.7.76",WV="8b73b828b";function cT(r){return Math.floor(Math.max(0,Math.min(1,r))*255).toString(16).padStart(2,"0")}function Wf(r){return Math.max(0,Math.min(255,255*r))}class uT{static CMYK_G([e,t,n,s]){return["G",1-Math.min(1,.3*e+.59*n+.11*t+s)]}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=Wf(e),[e,e,e]}static G_HTML([e]){const t=cT(e);return`#${t}${t}${t}`}static RGB_G([e,t,n]){return["G",.3*e+.59*t+.11*n]}static RGB_rgb(e){return e.map(Wf)}static RGB_HTML(e){return`#${e.map(cT).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([e,t,n,s]){return["RGB",1-Math.min(1,e+s),1-Math.min(1,n+s),1-Math.min(1,t+s)]}static CMYK_rgb([e,t,n,s]){return[Wf(1-Math.min(1,e+s)),Wf(1-Math.min(1,n+s)),Wf(1-Math.min(1,t+s))]}static CMYK_HTML(e){const t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}static RGB_CMYK([e,t,n]){const s=1-e,i=1-t,o=1-n,l=Math.min(s,i,o);return["CMYK",s,i,o,l]}}class lI{static setupStorage(e,t,n,s,i){const o=s.getValue(t,{value:null});switch(n.name){case"textarea":if(o.value!==null&&(e.textContent=o.value),i==="print")break;e.addEventListener("input",l=>{s.setValue(t,{value:l.target.value})});break;case"input":if(n.attributes.type==="radio"||n.attributes.type==="checkbox"){if(o.value===n.attributes.xfaOn?e.setAttribute("checked",!0):o.value===n.attributes.xfaOff&&e.removeAttribute("checked"),i==="print")break;e.addEventListener("change",l=>{s.setValue(t,{value:l.target.checked?l.target.getAttribute("xfaOn"):l.target.getAttribute("xfaOff")})})}else{if(o.value!==null&&e.setAttribute("value",o.value),i==="print")break;e.addEventListener("input",l=>{s.setValue(t,{value:l.target.value})})}break;case"select":if(o.value!==null){e.setAttribute("value",o.value);for(const l of n.children)l.attributes.value===o.value?l.attributes.selected=!0:l.attributes.hasOwnProperty("selected")&&delete l.attributes.selected}e.addEventListener("input",l=>{const c=l.target.options,u=c.selectedIndex===-1?"":c[c.selectedIndex].value;s.setValue(t,{value:u})});break}}static setAttributes({html:e,element:t,storage:n=null,intent:s,linkService:i}){const{attributes:o}=t,l=e instanceof HTMLAnchorElement;o.type==="radio"&&(o.name=`${o.name}-${s}`);for(const[c,u]of Object.entries(o))if(u!=null)switch(c){case"class":u.length&&e.setAttribute(c,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:(!l||c!=="href"&&c!=="newWindow")&&e.setAttribute(c,u)}l&&i.addLinkAttributes(e,o.href,o.newWindow),n&&o.dataId&&this.setupStorage(e,o.dataId,t,n)}static render(e){var h,f;const t=e.annotationStorage,n=e.linkService,s=e.xfaHtml,i=e.intent||"display",o=document.createElement(s.name);s.attributes&&this.setAttributes({html:o,element:s,intent:i,linkService:n});const l=i!=="richText",c=e.div;if(c.append(o),e.viewport){const p=`matrix(${e.viewport.transform.join(",")})`;c.style.transform=p}l&&c.setAttribute("class","xfaLayer xfaFont");const u=[];if(s.children.length===0){if(s.value){const p=document.createTextNode(s.value);o.append(p),l&&em.shouldBuildText(s.name)&&u.push(p)}return{textDivs:u}}const d=[[s,-1,o]];for(;d.length>0;){const[p,m,g]=d.at(-1);if(m+1===p.children.length){d.pop();continue}const v=p.children[++d.at(-1)[1]];if(v===null)continue;const{name:b}=v;if(b==="#text"){const w=document.createTextNode(v.value);u.push(w),g.append(w);continue}const y=(h=v==null?void 0:v.attributes)!=null&&h.xmlns?document.createElementNS(v.attributes.xmlns,b):document.createElement(b);if(g.append(y),v.attributes&&this.setAttributes({html:y,element:v,storage:t,intent:i,linkService:n}),((f=v.children)==null?void 0:f.length)>0)d.push([v,-1,y]);else if(v.value){const w=document.createTextNode(v.value);l&&em.shouldBuildText(b)&&u.push(w),y.append(w)}}for(const p of c.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))p.setAttribute("readOnly",!0);return{textDivs:u}}static update(e){const t=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=t,e.div.hidden=!1}}const Jg=1e3,VV=9,Ou=new WeakSet;function io(r){return{width:r[2]-r[0],height:r[3]-r[1]}}class GV{static create(e){switch(e.data.annotationType){case or.LINK:return new cI(e);case or.TEXT:return new XV(e);case or.WIDGET:switch(e.data.fieldType){case"Tx":return new YV(e);case"Btn":return e.data.radioButton?new hI(e):e.data.checkBox?new JV(e):new ZV(e);case"Ch":return new QV(e);case"Sig":return new KV(e)}return new Yu(e);case or.POPUP:return new AN(e);case or.FREETEXT:return new yI(e);case or.LINE:return new tG(e);case or.SQUARE:return new rG(e);
1148case or.CIRCLE:return new nG(e);case or.POLYLINE:return new bI(e);case or.CARET:return new iG(e);case or.INK:return new Gk(e);case or.POLYGON:return new sG(e);case or.HIGHLIGHT:return new xI(e);case or.UNDERLINE:return new aG(e);case or.SQUIGGLY:return new oG(e);case or.STRIKEOUT:return new lG(e);case or.STAMP:return new vI(e);case or.FILEATTACHMENT:return new cG(e);default:return new Qt(e)}}}var Jc,Nh,Sh,Km,jN;const bE=class bE{constructor(e,{isRenderable:t=!1,ignoreBorder:n=!1,createQuadrilaterals:s=!1}={}){$(this,Km);$(this,Jc,null);$(this,Nh,!1);$(this,Sh,null);this.isRenderable=t,this.data=e.data,this.layer=e.layer,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,t&&(this.container=this._createContainer(n)),s&&this._createQuadrilaterals()}static _hasPopupData({titleObj:e,contentsObj:t,richText:n}){return!!(e!=null&&e.str||t!=null&&t.str||n!=null&&n.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return bE._hasPopupData(this.data)}updateEdited(e){var n;if(!this.container)return;x(this,Jc)||P(this,Jc,{rect:this.data.rect.slice(0)});const{rect:t}=e;t&&O(this,Km,jN).call(this,t),(n=x(this,Sh))==null||n.popup.updateEdited(e)}resetEdited(){var e;x(this,Jc)&&(O(this,Km,jN).call(this,x(this,Jc).rect),(e=x(this,Sh))==null||e.popup.resetEdited(),P(this,Jc,null))}_createContainer(e){const{data:t,parent:{page:n,viewport:s}}=this,i=document.createElement("section");i.setAttribute("data-annotation-id",t.id),this instanceof Yu||(i.tabIndex=Jg);const{style:o}=i;if(o.zIndex=this.parent.zIndex++,t.popupRef&&i.setAttribute("aria-haspopup","dialog"),t.alternativeText&&(i.title=t.alternativeText),t.noRotate&&i.classList.add("norotate"),!t.rect||this instanceof AN){const{rotation:g}=t;return!t.hasOwnCanvas&&g!==0&&this.setRotation(g,i),i}const{width:l,height:c}=io(t.rect);if(!e&&t.borderStyle.width>0){o.borderWidth=`${t.borderStyle.width}px`;const g=t.borderStyle.horizontalCornerRadius,v=t.borderStyle.verticalCornerRadius;if(g>0||v>0){const y=`calc(${g}px * var(--scale-factor)) / calc(${v}px * var(--scale-factor))`;o.borderRadius=y}else if(this instanceof hI){const y=`calc(${l}px * var(--scale-factor)) / calc(${c}px * var(--scale-factor))`;o.borderRadius=y}switch(t.borderStyle.style){case zf.SOLID:o.borderStyle="solid";break;case zf.DASHED:o.borderStyle="dashed";break;case zf.BEVELED:Je("Unimplemented border style: beveled");break;case zf.INSET:Je("Unimplemented border style: inset");break;case zf.UNDERLINE:o.borderBottomStyle="solid";break}const b=t.borderColor||null;b?(P(this,Nh,!0),o.borderColor=Pe.makeHexColor(b[0]|0,b[1]|0,b[2]|0)):o.borderWidth=0}const u=Pe.normalizeRect([t.rect[0],n.view[3]-t.rect[1]+n.view[1],t.rect[2],n.view[3]-t.rect[3]+n.view[1]]),{pageWidth:d,pageHeight:h,pageX:f,pageY:p}=s.rawDims;o.left=`${100*(u[0]-f)/d}%`,o.top=`${100*(u[1]-p)/h}%`;const{rotation:m}=t;return t.hasOwnCanvas||m===0?(o.width=`${100*l/d}%`,o.height=`${100*c/h}%`):this.setRotation(m,i),i}setRotation(e,t=this.container){if(!this.data.rect)return;const{pageWidth:n,pageHeight:s}=this.parent.viewport.rawDims,{width:i,height:o}=io(this.data.rect);let l,c;e%180===0?(l=100*i/n,c=100*o/s):(l=100*o/n,c=100*i/s),t.style.width=`${l}%`,t.style.height=`${c}%`,t.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const e=(t,n,s)=>{const i=s.detail[t],o=i[0],l=i.slice(1);s.target.style[n]=uT[`${o}_HTML`](l),this.annotationStorage.setValue(this.data.id,{[n]:uT[`${o}_rgb`](l)})};return it(this,"_commonActions",{display:t=>{const{display:n}=t.detail,s=n%2===1;this.container.style.visibility=s?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:s,noPrint:n===1||n===2})},print:t=>{this.annotationStorage.setValue(this.data.id,{noPrint:!t.detail.print})},hidden:t=>{const{hidden:n}=t.detail;this.container.style.visibility=n?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:n,noView:n})},focus:t=>{setTimeout(()=>
1148t.target.focus({preventScroll:!1}),0)},userName:t=>{t.target.title=t.detail.userName},readonly:t=>{t.target.disabled=t.detail.readonly},required:t=>{this._setRequired(t.target,t.detail.required)},bgColor:t=>{e("bgColor","backgroundColor",t)},fillColor:t=>{e("fillColor","backgroundColor",t)},fgColor:t=>{e("fgColor","color",t)},textColor:t=>{e("textColor","color",t)},borderColor:t=>{e("borderColor","borderColor",t)},strokeColor:t=>{e("strokeColor","borderColor",t)},rotation:t=>{const n=t.detail.rotation;this.setRotation(n),this.annotationStorage.setValue(this.data.id,{rotation:n})}})}_dispatchEventFromSandbox(e,t){const n=this._commonActions;for(const s of Object.keys(t.detail)){const i=e[s]||n[s];i==null||i(t)}}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;const t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;const n=this._commonActions;for(const[s,i]of Object.entries(t)){const o=n[s];if(o){const l={detail:{[s]:i},target:e};o(l),delete t[s]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:e}=this.data;if(!e)return;const[t,n,s,i]=this.data.rect.map(g=>Math.fround(g));if(e.length===8){const[g,v,b,y]=e.subarray(2,6);if(s===g&&i===v&&t===b&&n===y)return}const{style:o}=this.container;let l;if(x(this,Nh)){const{borderColor:g,borderWidth:v}=o;o.borderWidth=0,l=["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="${g}" stroke-width="${v}">`],this.container.classList.add("hasBorder")}const c=s-t,u=i-n,{svgFactory:d}=this,h=d.createElement("svg");h.classList.add("quadrilateralsContainer"),h.setAttribute("width",0),h.setAttribute("height",0);const f=d.createElement("defs");h.append(f);const p=d.createElement("clipPath"),m=`clippath_${this.data.id}`;p.setAttribute("id",m),p.setAttribute("clipPathUnits","objectBoundingBox"),f.append(p);for(let g=2,v=e.length;g<v;g+=8){const b=e[g],y=e[g+1],w=e[g+2],_=e[g+3],N=d.createElement("rect"),S=(w-t)/c,E=(i-y)/u,T=(b-w)/c,D=(y-_)/u;N.setAttribute("x",S),N.setAttribute("y",E),N.setAttribute("width",T),N.setAttribute("height",D),p.append(N),l==null||l.push(`<rect vector-effect="non-scaling-stroke" x="${S}" y="${E}" width="${T}" height="${D}"/>`)}x(this,Nh)&&(l.push("</g></svg>')"),o.backgroundImage=l.join("")),this.container.append(h),this.container.style.clipPath=`url(#${m})`}_createPopup(){const{container:e,data:t}=this;e.setAttribute("aria-haspopup","dialog");const n=P(this,Sh,new AN({data:{color:t.color,titleObj:t.titleObj,modificationDate:t.modificationDate,contentsObj:t.contentsObj,richText:t.richText,parentRect:t.rect,borderStyle:0,id:`popup_${t.id}`,rotation:t.rotation},parent:this.parent,elements:[this]}));this.parent.div.append(n.render())}render(){ar("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,t=null){const n=[];if(this._fieldObjects){const s=this._fieldObjects[e];if(s)for(const{page:i,id:o,exportValues:l}of s){if(i===-1||o===t)continue;const c=typeof l=="string"?l:null,u=document.querySelector(`[data-element-id="${o}"]`);if(u&&!Ou.has(u)){Je(`_getElementsByName - element not allowed: ${o}`);continue}n.push({id:o,exportValue:c,domElement:u})}return n}for(const s of document.getElementsByName(e)){const{exportValue:i}=s,o=s.getAttribute("data-element-id");o!==t&&Ou.has(s)&&n.push({id:o,exportValue:i,domElement:s})}return n}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 t of e)t.classList.add("highlightArea");else e.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:e,data:{id:t}}=this;this.container.addEventListener("dblclick",()=>{var n;(n=this.linkService.eventBus)==null||n.dispatch("switchannotationeditormode",{source:this,mode:e,editId:t})})}};Jc=new WeakMap,Nh=new WeakMap,Sh=new WeakMap,Km=new WeakSet,jN=function(e){const{container:{style:t},data:{rect:n,rotation:s},parent:{viewport:{rawDims:{pageWidth:i,pageHeight:o,pageX:l,pageY:c}}}}=this;n==null||n.splice(0,4,...e);const{width:u,height:d}=io(e);t.left=`${100*(e[0]-l)/i}%`,t.top=`${100*(o-e[3]+c)/o}%`,s===0?(t.width=`${100*u/i}%`,t.height=`${100*d/o}%`):this.setRotation(s)};let Qt=bE;var ls,oc,uI,dI;class cI extends Qt{constructor(t,n=null){super(t,{isRenderable:!0,ignoreBorder:!!(n!=null&&n.ignoreBorder),createQuadrilaterals:!0});$(this,ls);this.isTooltipOnly=t.data.isTooltipOnly}render(){const{data:t,linkService:n}=this,s=document.createElement("a");s.setAttribute("data-element-id",t.id);let i=!1;return t.url?(n.addLinkAttributes(s,t.url,t.newWindow),i=!0):t.action?(this._bindNamedAction(s,t.action),i=!0):t.attachment?(O(this,ls,uI).call(this,s,t.attachment,t.attachmentDest),i=!0):t.setOCGState?(O(this,ls,dI).call(this,s,t.setOCGState),i=!0):t.dest?(this._bindLink(s,t.dest),i=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(s,t),i=!0),t.resetForm?(this._bindResetFormAction(s,t.resetForm),i=!0):this.isTooltipOnly&&!i&&(this._bindLink(s,""),i=!0)),this.container.classList.add("linkA
1148nnotation"),i&&this.container.append(s),this.container}_bindLink(t,n){t.href=this.linkService.getDestinationHash(n),t.onclick=()=>(n&&this.linkService.goToDestination(n),!1),(n||n==="")&&O(this,ls,oc).call(this)}_bindNamedAction(t,n){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(n),!1),O(this,ls,oc).call(this)}_bindJSAction(t,n){t.href=this.linkService.getAnchorUrl("");const s=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const i of Object.keys(n.actions)){const o=s.get(i);o&&(t[o]=()=>{var l;return(l=this.linkService.eventBus)==null||l.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n.id,name:i}}),!1})}t.onclick||(t.onclick=()=>!1),O(this,ls,oc).call(this)}_bindResetFormAction(t,n){const s=t.onclick;if(s||(t.href=this.linkService.getAnchorUrl("")),O(this,ls,oc).call(this),!this._fieldObjects){Je('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),s||(t.onclick=()=>!1);return}t.onclick=()=>{var h;s==null||s();const{fields:i,refs:o,include:l}=n,c=[];if(i.length!==0||o.length!==0){const f=new Set(o);for(const p of i){const m=this._fieldObjects[p]||[];for(const{id:g}of m)f.add(g)}for(const p of Object.values(this._fieldObjects))for(const m of p)f.has(m.id)===l&&c.push(m)}else for(const f of Object.values(this._fieldObjects))c.push(...f);const u=this.annotationStorage,d=[];for(const f of c){const{id:p}=f;switch(d.push(p),f.type){case"text":{const g=f.defaultValue||"";u.setValue(p,{value:g});break}case"checkbox":case"radiobutton":{const g=f.defaultValue===f.exportValues;u.setValue(p,{value:g});break}case"combobox":case"listbox":{const g=f.defaultValue||"";u.setValue(p,{value:g});break}default:continue}const m=document.querySelector(`[data-element-id="${p}"]`);if(m){if(!Ou.has(m)){Je(`_bindResetFormAction - element not allowed: ${p}`);continue}}else continue;m.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((h=this.linkService.eventBus)==null||h.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:d,name:"ResetForm"}})),!1}}}ls=new WeakSet,oc=function(){this.container.setAttribute("data-internal-link","")},uI=function(t,n,s=null){t.href=this.linkService.getAnchorUrl(""),n.description&&(t.title=n.description),t.onclick=()=>{var i;return(i=this.downloadManager)==null||i.openOrDownloadData(n.content,n.filename,s),!1},O(this,ls,oc).call(this)},dI=function(t,n){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(n),!1),O(this,ls,oc).call(this)};class XV extends Qt{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 Yu extends Qt{render(){return this.container}showElementAndHideCanvas(e){var t;this.data.hasOwnCanvas&&(((t=e.previousSibling)==null?void 0:t.nodeName)==="CANVAS"&&(e.previousSibling.hidden=!0),e.hidden=!1)}_getKeyModifier(e){return zn.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,t,n,s,i){n.includes("mouse")?e.addEventListener(n,o=>{var l;(l=this.linkService.eventBus)==null||l.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:i(o),shift:o.shiftKey,modifier:this._getKeyModifier(o)}})}):e.addEventListener(n,o=>{var l;if(n==="blur"){if(!t.focused||!o.relatedTarget)return;t.focused=!1}else if(n==="focus"){if(t.focused)return;t.focused=!0}i&&((l=this.linkService.eventBus)==null||l.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:i(o)}}))})}_setEventListeners(e,t,n,s){var i,o,l;for(const[c,u]of n)(u==="Action"||(i=this.data.actions)!=null&&i[u])&&((u==="Focus"||u==="Blur")&&(t||(t={focused:!1})),this._setEventListener(e,t,c,u,s),u==="Focus"&&!((o=this.data.actions)!=null&&o.Blur)?this._setEventListener(e,t,"blur","Blur",null):u==="Blur"&&!((l=this.data.actions)!=null&&l.Focus)&&this._setEventListener(e,t,"focus","Focus",null))}
1148_setBackgroundColor(e){const t=this.data.backgroundColor||null;e.style.backgroundColor=t===null?"transparent":Pe.makeHexColor(t[0],t[1],t[2])}_setTextStyle(e){const t=["left","center","right"],{fontColor:n}=this.data.defaultAppearanceData,s=this.data.defaultAppearanceData.fontSize||VV,i=e.style;let o;const l=2,c=u=>Math.round(10*u)/10;if(this.data.multiLine){const u=Math.abs(this.data.rect[3]-this.data.rect[1]-l),d=Math.round(u/(Qw*s))||1,h=u/d;o=Math.min(s,c(h/Qw))}else{const u=Math.abs(this.data.rect[3]-this.data.rect[1]-l);o=Math.min(s,c(u/Qw))}i.fontSize=`calc(${o}px * var(--scale-factor))`,i.color=Pe.makeHexColor(n[0],n[1],n[2]),this.data.textAlignment!==null&&(i.textAlign=t[this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",t)}}class YV extends Yu{constructor(e){const t=e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue;super(e,{isRenderable:t})}setPropertyOnSiblings(e,t,n,s){const i=this.annotationStorage;
1148for(const o of this._getElementsByName(e.name,e.id))o.domElement&&(o.domElement[t]=n),i.setValue(o.id,{[s]:n})}render(){var s,i;const e=this.annotationStorage,t=this.data.id;this.container.classList.add("textWidgetAnnotation");let n=null;if(this.renderForms){const o=e.getValue(t,{value:this.data.fieldValue});let l=o.value||"";const c=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;c&&l.length>c&&(l=l.slice(0,c));let u=o.formattedValue||((s=this.data.textContent)==null?void 0:s.join(`
1149`))||null;u&&this.data.comb&&(u=u.replaceAll(/\s+/g,""));const d={userValue:l,formattedValue:u,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(n=document.createElement("textarea"),n.textContent=u??l,this.data.doNotScroll&&(n.style.overflowY="hidden")):(n=document.createElement("input"),n.type="text",n.setAttribute("value",u??l),this.data.doNotScroll&&(n.style.overflowX="hidden")),this.data.hasOwnCanvas&&(n.hidden=!0),Ou.add(n),n.setAttribute("data-element-id",t),n.disabled=this.data.readOnly,n.name=this.data.fieldName,n.tabIndex=Jg,this._setRequired(n,this.data.required),c&&(n.maxLength=c),n.addEventListener("input",f=>{e.setValue(t,{value:f.target.value}),this.setPropertyOnSiblings(n,"value",f.target.value,"value"),d.formattedValue=null}),n.addEventListener("resetform",f=>{const p=this.data.defaultFieldValue??"";n.value=d.userValue=p,d.formattedValue=null});let h=f=>{const{formattedValue:p}=d;p!=null&&(f.target.value=p),f.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){n.addEventListener("focus",p=>{var g;if(d.focused)return;const{target:m}=p;d.userValue&&(m.value=d.userValue),d.lastCommittedValue=m.value,d.commitKey=1,(g=this.data.actions)!=null&&g.Focus||(d.focused=!0)}),n.addEventListener("updatefromsandbox",p=>{this.showElementAndHideCanvas(p.target);const m={value(g){d.userValue=g.detail.value??"",e.setValue(t,{value:d.userValue.toString()}),g.target.value=d.userValue},formattedValue(g){const{formattedValue:v}=g.detail;d.formattedValue=v,v!=null&&g.target!==document.activeElement&&(g.target.value=v),e.setValue(t,{formattedValue:v})},selRange(g){g.target.setSelectionRange(...g.detail.selRange)},charLimit:g=>{var w;const{charLimit:v}=g.detail,{target:b}=g;if(v===0){b.removeAttribute("maxLength");return}b.setAttribute("maxLength",v);let y=d.userValue;!y||y.length<=v||(y=y.slice(0,v),b.value=d.userValue=y,e.setValue(t,{value:y}),(w=this.linkService.eventBus)==null||w.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:y,willCommit:!0,commitKey:1,selStart:b.selectionStart,selEnd:b.selectionEnd}}))}};this._dispatchEventFromSandbox(m,p)}),n.addEventListener("keydown",p=>{var v;d.commitKey=1;let m=-1;if(p.key==="Escape"?m=0:p.key==="Enter"&&!this.data.multiLine?m=2:p.key==="Tab"&&(d.commitKey=3),m===-1)return;const{value:g}=p.target;d.lastCommittedValue!==g&&(d.lastCommittedValue=g,d.userValue=g,(v=this.linkService.eventBus)==null||v.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:g,willCommit:!0,commitKey:m,selStart:p.target.selectionStart,selEnd:p.target.selectionEnd}}))});const f=h;h=null,n.addEventListener("blur",p=>{var g,v;if(!d.focused||!p.relatedTarget)return;(g=this.data.actions)!=null&&g.Blur||(d.focused=!1);const{value:m}=p.target;d.userValue=m,d.lastCommittedValue!==m&&((v=this.linkService.eventBus)==null||v.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:m,willCommit:!0,commitKey:d.commitKey,selStart:p.target.selectionStart,selEnd:p.target.selectionEnd}})),f(p)}),(i=this.data.actions)!=null&&i.Keystroke&&n.addEventListener("beforeinput",p=>{var N;d.lastCommittedValue=null;const{data:m,target:g}=p,{value:v,selectionStart:b,selectionEnd:y}=g;let w=b,_=y;switch(p.inputType){case"deleteWordBackward":{const S=v.substring(0,b).match(/\w*[^\w]*$/);S&&(w-=S[0].length);break}
vendor: 4,156 bytes, line 1149
1149case"deleteWordForward":{const S=v.substring(b).match(/^[^\w]*\w*/);S&&(_+=S[0].length);break}case"deleteContentBackward":b===y&&(w-=1);break;case"deleteContentForward":b===y&&(_+=1);break}p.preventDefault(),(N=this.linkService.eventBus)==null||N.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:v,change:m||"",willCommit:!1,selStart:w,selEnd:_}})}),this._setEventListeners(n,d,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],p=>p.target.value)}if(h&&n.addEventListener("blur",h),this.data.comb){const p=(this.data.rect[2]-this.data.rect[0])/c;n.classList.add("comb"),n.style.letterSpacing=`calc(${p}px * var(--scale-factor) - 1ch)`}}else n=document.createElement("div"),n.textContent=this.data.fieldValue,n.style.verticalAlign="middle",n.style.display="table-cell",this.data.hasOwnCanvas&&(n.hidden=!0);return this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class KV extends Yu{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class JV extends Yu{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,t=this.data,n=t.id;let s=e.getValue(n,{value:t.exportValue===t.fieldValue}).value;typeof s=="string"&&(s=s!=="Off",e.setValue(n,{value:s})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const i=document.createElement("input");return Ou.add(i),i.setAttribute("data-element-id",n),i.disabled=t.readOnly,this._setRequired(i,this.data.required),i.type="checkbox",i.name=t.fieldName,s&&i.setAttribute("checked",!0),i.setAttribute("exportValue",t.exportValue),i.tabIndex=Jg,i.addEventListener("change",o=>{const{name:l,checked:c}=o.target;for(const u of this._getElementsByName(l,n)){const d=c&&u.exportValue===t.exportValue;u.domElement&&(u.domElement.checked=d),e.setValue(u.id,{value:d})}e.setValue(n,{value:c})}),i.addEventListener("resetform",o=>{const l=t.defaultFieldValue||"Off";o.target.checked=l===t.exportValue}),this.enableScripting&&this.hasJSActions&&(i.addEventListener("updatefromsandbox",o=>{const l={value(c){c.target.checked=c.detail.value!=="Off",e.setValue(n,{value:c.target.checked})}};this._dispatchEventFromSandbox(l,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 hI extends Yu{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const e=this.annotationStorage,t=this.data,n=t.id;let s=e.getValue(n,{value:t.fieldValue===t.buttonValue}).value;if(typeof s=="string"&&(s=s!==t.buttonValue,e.setValue(n,{value:s})),s)for(const o of this._getElementsByName(t.fieldName,n))e.setValue(o.id,{value:!1});const i=document.createElement("input");if(Ou.add(i),i.setAttribute("data-element-id",n),i.disabled=t.readOnly,this._setRequired(i,this.data.required),i.type="radio",i.name=t.fieldName,s&&i.setAttribute("checked",!0),i.tabIndex=Jg,i.addEventListener("change",o=>{const{name:l,checked:c}=o.target;for(const u of this._getElementsByName(l,n))e.setValue(u.id,{value:!1});e.setValue(n,{value:c})}),i.addEventListener("resetform",o=>{const l=t.defaultFieldValue;o.target.checked=l!=null&&l===t.buttonValue}),this.enableScripting&&this.hasJSActions){const o=t.buttonValue;i.addEventListener("updatefromsandbox",l=>{const c={value:u=>{const d=o===u.detail.value;for(const h of this._getElementsByName(u.target.name)){const f=d&&h.id===n;h.domElement&&(h.domElement.checked=f),e.setValue(h.id,{value:f})}}};this._dispatchEventFromSandbox(c,l)}),this._setEventListeners(i,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],l=>l.target.checked)}
1149return this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class ZV extends cI{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){const e=super.render();e.classList.add("buttonWidgetAnnotation","pushButton");const t=e.lastChild;return this.enableScripting&&this.hasJSActions&&t&&(this._setDefaultPropertiesFromJS(t),t.addEventListener("updatefromsandbox",n=>{this._dispatchEventFromSandbox({},n)})),e}}class QV extends Yu{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const e=this.annotationStorage,t=this.data.id,n=e.getValue(t,{value:this.data.fieldValue}),s=document.createElement("select");Ou.add(s),s.setAttribute("data-element-id",t),s.disabled=this.data.readOnly,this._setRequired(s,this.data.required),s.name=this.data.fieldName,s.tabIndex=Jg;let i=this.data.combo&&this.data.options.length>0;this.data.combo||(s.size=this.data.options.length,this.data.multiSelect&&(s.multiple=!0)),s.addEventListener("resetform",d=>{const h=this.data.defaultFieldValue;for(const f of s.options)f.selected=f.value===h});for(const d of this.data.options){const h=document.createElement("option");h.textContent=d.displayValue,h.value=d.exportValue,n.value.includes(d.exportValue)&&(h.setAttribute("selected",!0),i=!1),s.append(h)}let o=null;if(i){const d=document.createElement("option");d.value=" ",d.setAttribute("hidden",!0),d.setAttribute("selected",!0),s.prepend(d),o=()=>{d.remove(),s.removeEventListener("input",o),o=null},s.addEventListener("input",o)}const l=d=>{const h=d?"value":"textContent",{options:f,multiple:p}=s;return p?Array.prototype.filter.call(f,m=>m.selected).map(m=>m[h]):f.selectedIndex===-1?null:f[f.selectedIndex][h]};let c=l(!1);const u=d=>{const h=d.target.options;return Array.prototype.map.call(h,f=>({displayValue:f.textContent,exportValue:f.value}))};return this.enableScripting&&this.hasJSActions?(s.addEventListener("updatefromsandbox",d=>{const h={value(f){o==null||o();const p=f.detail.value,m=new Set(Array.isArray(p)?p:[p]);for(const g of s.options)g.selected=m.has(g.value);e.setValue(t,{value:l(!0)}),c=l(!1)},multipleSelection(f){s.multiple=!0},remove(f){const p=s.options,m=f.detail.remove;p[m].selected=!1,s.remove(m),p.length>0&&Array.prototype.findIndex.call(p,v=>v.selected)===-1&&(p[0].selected=!0),e.setValue(t,{value:l(!0),items:u(f)}),c=l(!1)},clear(f){for(;s.length!==0;)s.remove(0);e.setValue(t,{value:null,items:[]}),c=l(!1)},insert(f){const{index:p,displayValue:m,exportValue:g}=f.detail.insert,v=s.children[p],b=document.createElement("option");b.textContent=m,b.value=g,v?v.before(b):s.append(b),e.setValue(t,{value:l(!0),items:u(f)}),c=l(!1)},items(f){const{items:p}=f.detail;for(;s.length!==0;)s.remove(0);for(const m of p){const{displayValue:g,exportValue:v}=m,b=document.createElement("option");b.textContent=g,b.value=v,s.append(b)}s.options.length>0&&(s.options[0].selected=!0),e.setValue(t,{value:l(!0),items:u(f)}),c=l(!1)},indices(f){const p=new Set(f.detail.indices);for(const m of f.target.options)m.selected=p.has(m.index);e.setValue(t,{value:l(!0)}),c=l(!1)},editable(f){f.target.disabled=!f.detail.editable}};this._dispatchEventFromSandbox(h,d)}),s.addEventListener("input",d=>{var p;const h=l(!0),f=l(!1);e.setValue(t,{value:h}),d.preventDefault(),(p=this.linkService.eventBus)==null||p.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:c,change:f,changeEx:h,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(s,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)):s.addEventListener("input",function(d){e.setValue(t,{value:l(!0)})}),this.data.combo&&this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class AN extends Qt{constructor(e){const{data:t,elements:n}=e;super(e,{isRenderable:Qt._hasPopupData(t)}),this.elements=n,this.popup=null}render(){this.container.classList.add("popupAnnotation");const e=this.popup=new eG({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open}),t=[];for(const n of this.elements)n.popup=e,t.push(n.data.id),n.addHighlightArea();return this.container.setAttribute("aria-controls",t.map(n=>`${Mk}${n}`).join(",")),this.container}}
1149var kh,mx,gx,Ch,Zc,Yt,Ma,Eh,Jm,Zm,jh,Fa,ui,Ba,Qm,$a,eg,Qc,eu,wt,Ry,TN,fI,pI,mI,gI,Py,Iy,DN;class eG{constructor({container:e,color:t,elements:n,titleObj:s,modificationDate:i,contentsObj:o,richText:l,parent:c,rect:u,parentRect:d,open:h}){$(this,wt);$(this,kh,O(this,wt,mI).bind(this));$(this,mx,O(this,wt,DN).bind(this));$(this,gx,O(this,wt,Iy).bind(this));$(this,Ch,O(this,wt,Py).bind(this));$(this,Zc,null);$(this,Yt,null);$(this,Ma,null);$(this,Eh,null);$(this,Jm,null);$(this,Zm,null);$(this,jh,null);$(this,Fa,!1);$(this,ui,null);$(this,Ba,null);$(this,Qm,null);$(this,$a,null);$(this,eg,null);$(this,Qc,null);$(this,eu,!1);var f;P(this,Yt,e),P(this,eg,s),P(this,Ma,o),P(this,$a,l),P(this,Zm,c),P(this,Zc,t),P(this,Qm,u),P(this,jh,d),P(this,Jm,n),P(this,Eh,xP.toDateObject(i)),this.trigger=n.flatMap(p=>p.getElementsToTriggerPopup());for(const p of this.trigger)p.addEventListener("click",x(this,Ch)),p.addEventListener("mouseenter",x(this,gx)),p.addEventListener("mouseleave",x(this,mx)),p.classList.add("popupTriggerArea");for(const p of n)(f=p.container)==null||f.addEventListener("keydown",x(this,kh));x(this,Yt).hidden=!0,h&&O(this,wt,Py).call(this)}render(){if(x(this,ui))return;const e=P(this,ui,document.createElement("div"));if(e.className="popup",x(this,Zc)){const i=e.style.outlineColor=Pe.makeHexColor(...x(this,Zc));CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?e.style.backgroundColor=`color-mix(in srgb, ${i} 30%, white)`:e.style.backgroundColor=Pe.makeHexColor(...x(this,Zc).map(l
1149=>Math.floor(.7*(255-l)+l)))}const t=document.createElement("span");t.className="header";const n=document.createElement("h1");if(t.append(n),{dir:n.dir,str:n.textContent}=x(this,eg),e.append(t),x(this,Eh)){const i=document.createElement("span");i.classList.add("popupDate"),i.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),i.setAttribute("data-l10n-args",JSON.stringify({dateObj:x(this,Eh).valueOf()})),t.append(i)}const s=x(this,wt,Ry);if(s)lI.render({xfaHtml:s,intent:"richText",div:e}),e.lastChild.classList.add("richText","popupContent");else{const i=this._formatContents(x(this,Ma));e.append(i)}x(this,Yt).append(e)}_formatContents({str:e,dir:t}){const n=document.createElement("p");n.classList.add("popupContent"),n.dir=t;const s=e.split(/(?:\r\n?|\n)/);for(let i=0,o=s.length;i<o;++i){const l=s[i];n.append(document.createTextNode(l)),i<o-1&&n.append(document.createElement("br"))}return n}updateEdited({rect:e,popupContent:t}){var n;x(this,Qc)||P(this,Qc,{contentsObj:x(this,Ma),richText:x(this,$a)}),e&&P(this,Ba,null),t&&(P(this,$a,O(this,wt,pI).call(this,t)),P(this,Ma,null)),(n=x(this,ui))==null||n.remove(),P(this,ui,null)}resetEdited(){var e;x(this,Qc)&&({contentsObj:fn(this,Ma)._,richText:fn(this,$a)._}=x(this,Qc),P(this,Qc,null),(e=x(this,ui))==null||e.remove(),P(this,ui,null),P(this,Ba,null))}forceHide(){P(this,eu,this.isVisible),x(this,eu)&&(x(this,Yt).hidden=!0)}maybeShow(){x(this,eu)&&(x(this,ui)||O(this,wt,Iy).call(this),P(this,eu,!1),x(this,Yt).hidden=!1)}get isVisible(){return x(this,Yt).hidden===!1}}
1149kh=new WeakMap,mx=new WeakMap,gx=new WeakMap,Ch=new WeakMap,Zc=new WeakMap,Yt=new WeakMap,Ma=new WeakMap,Eh=new WeakMap,Jm=new WeakMap,Zm=new WeakMap,jh=new WeakMap,Fa=new WeakMap,ui=new WeakMap,Ba=new WeakMap,Qm=new WeakMap,$a=new WeakMap,eg=new WeakMap,Qc=new WeakMap,eu=new WeakMap,wt=new WeakSet,Ry=function(){const e=x(this,$a),t=x(this,Ma);return e!=null&&e.str&&(!(t!=null&&t.str)||t.str===e.str)&&x(this,$a).html||null},TN=function(){var e,t,n;return((n=(t=(e=x(this,wt,Ry))==null?void 0:e.attributes)==null?void 0:t.style)==null?void 0:n.fontSize)||0},fI=function(){var e,t,n;return((n=(t=(e=x(this,wt,Ry))==null?void 0:e.attributes)==null?void 0:t.style)==null?void 0:n.color)||null},pI=function(e){const t=[],n={str:e,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:t}]}},s={style:{color:x(this,wt,fI),fontSize:x(this,wt,TN)?`calc(${x(this,wt,TN)}px * var(--scale-factor))`:""}};for(const i of e.split(`
1150`))t.push({name:"span",value:i,attributes:s});return n},mI=function(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||(e.key==="Enter"||e.key==="Escape"&&x(this,Fa))&&O(this,wt,Py).call(this)},gI=function(){if(x(this,Ba)!==null)return;const{page:{view:e},viewport:{rawDims:{pageWidth:t,pageHeight:n,pageX:s,pageY:i}}}=x(this,Zm);let o=!!x(this,jh),l=o?x(this,jh):x(this,Qm);for(const m of x(this,Jm))if(!l||Pe.intersect(m.data.rect,l)!==null){l=m.data.rect,o=!0;break}const c=Pe.normalizeRect([l[0],e[3]-l[1]+e[1],l[2],e[3]-l[3]+e[1]]),d=o?l[2]-l[0]+5:0,h=c[0]+d,f=c[1];P(this,Ba,[100*(h-s)/t,100*(f-i)/n]);const{style:p}=x(this,Yt);p.left=`${x(this,Ba)[0]}%`,p.top=`${x(this,Ba)[1]}%`},Py=function(){P(this,Fa,!x(this,Fa)),x(this,Fa)?(O(this,wt,Iy).call(this),x(this,Yt).addEventListener("click",x(this,Ch)),x(this,Yt).addEventListener("keydown",x(this,kh))):(O(this,wt,DN).call(this),x(this,Yt).removeEventListener("click",x(this,Ch)),x(this,Yt).removeEventListener("keydown",x(this,kh)))},Iy=function(){x(this,ui)||this.render(),this.isVisible?x(this,Fa)&&x(this,Yt).classList.add("focused"):(O(this,wt,gI).call(this),x(this,Yt).hidden=!1,x(this,Yt).style.zIndex=parseInt(x(this,Yt).style.zIndex)+1e3)},DN=function(){x(this,Yt).classList.remove("focused"),!(x(this,Fa)||!this.isVisible)&&(x(this,Yt).hidden=!0,x(this,Yt).style.zIndex=parseInt(x(this,Yt).style.zIndex)-1e3)};class yI extends Qt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=Ge.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const e=document.createElement("div");e.classList.add("annotationTextContent"),e.setAttribute("role","comment");for(const t of this.textContent){const n=document.createElement("span");n.textContent=t,e.append(n)}this.container.append(e)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var tg;class tG extends Qt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});$(this,tg,null)}render(){this.container.classList.add("lineAnnotation");const t=this.data,{width:n,height:s}=io(t.rect),i=this.svgFactory.create(n,s,!0),o=P(this,tg,this.svgFactory.createElement("svg:line"));return o.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),o.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),o.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),o.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),o.setAttribute("stroke-width",t.borderStyle.width||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),i.append(o),this.container.append(i),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return x(this,tg)}addHighlightArea(){this.container.classList.add("highlightArea")}}tg=new WeakMap;var rg;class rG extends Qt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});$(this,rg,null)}render(){this.container.classList.add("squareAnnotation");const t=this.data,{width:n,height:s}=io(t.rect),i=this.svgFactory.create(n,s,!0),o=t.borderStyle.width,l=P(this,rg,this.svgFactory.createElement("svg:rect"));return l.setAttribute("x",o/2),l.setAttribute("y",o/2),l.setAttribute("width",n-o),l.setAttribute("height",s-o),l.setAttribute("stroke-width",o||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),i.append(l),this.container.append(i),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return x(this,rg)}addHighlightArea(){this.container.classList.add("highlightArea")}}rg=new WeakMap;var ng;class nG extends Qt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});$(this,ng,null)}render(){this.container.classList.add("circleAnnotation");const t=this.data,{width:n,height:s}=io(t.rect),i=this.svgFactory.create(n,s,!0),o=t.borderStyle.width,l=P(this,ng,this.svgFactory.createElement("svg:ellipse"));return l.setAttribute("cx",n/2),l.setAttribute("cy",s/2),l.setAttribute("rx",n/2-o/2),l.setAttribute("ry",s/2-o/2),l.setAttribute("stroke-width",o||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),i.append(l),this.container.append(i),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return x(this,ng)}addHighlightArea(){this.container.classList.add("highlightArea")}}ng=new WeakMap;var sg;class bI extends Qt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});$(this,sg,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,vertices:n,borderStyle:s,popupRef:i}}=this;if(!n)return this.container;const{width:o,height:l}
1150=io(t),c=this.svgFactory.create(o,l,!0);let u=[];for(let h=0,f=n.length;h<f;h+=2){const p=n[h]-t[0],m=t[3]-n[h+1];u.push(`${p},${m}`)}u=u.join(" ");const d=P(this,sg,this.svgFactory.createElement(this.svgElementName));return d.setAttribute("points",u),d.setAttribute("stroke-width",s.width||1),d.setAttribute("stroke","transparent"),d.setAttribute("fill","transparent"),c.append(d),this.container.append(c),!i&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return x(this,sg)}addHighlightArea(){this.container.classList.add("highlightArea")}}sg=new WeakMap;class sG extends bI{constructor(e){super(e),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class iG extends Qt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}var ig;class Gk extends Qt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});$(this,ig,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?Ge.HIGHLIGHT:Ge.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,inkLists:n,borderStyle:s,popupRef:i}}=this,{width:o,height:l}
1150=io(t),c=this.svgFactory.create(o,l,!0);for(const u of n){let d=[];for(let f=0,p=u.length;f<p;f+=2){const m=u[f]-t[0],g=t[3]-u[f+1];d.push(`${m},${g}`)}d=d.join(" ");const h=this.svgFactory.createElement(this.svgElementName);x(this,ig).push(h),h.setAttribute("points",d),h.setAttribute("stroke-width",s.width||1),h.setAttribute("stroke","transparent"),h.setAttribute("fill","transparent"),!i&&this.hasPopupData&&this._createPopup(),c.append(h)}return this.container.append(c),this._editOnDoubleClick(),this.container}getElementsToTriggerPopup(){return x(this,ig)}addHighlightArea(){this.container.classList.add("highlightArea")}}ig=new WeakMap;class xI extends Qt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=Ge.HIGHLIGHT}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),this.container}}class aG extends Qt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class oG extends Qt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class lG extends Qt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class vI extends Qt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=Ge.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var ag,og,RN;class cG extends Qt{constructor(t){var s;super(t,{isRenderable:!0});$(this,og);$(this,ag,null);const{file:n}=this.data;this.filename=n.filename,this.content=n.content,(s=this.linkService.eventBus)==null||s.dispatch("fileattachmentannotation",{source:this,...n})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:t,data:n}=this;let s;n.hasAppearance||n.fillAlpha===0?s=document.createElement("div"):(s=document.createElement("img"),s.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(n.name)?"paperclip":"pushpin"}.svg`,n.fillAlpha&&n.fillAlpha<1&&(s.style=`filter: opacity(${Math.round(n.fillAlpha*100)}%);`)),s.addEventListener("dblclick",O(this,og,RN).bind(this)),P(this,ag,s);const{isMac:i}=zn.platform;return t.addEventListener("keydown",o=>{o.key==="Enter"&&(i?o.metaKey:o.ctrlKey)&&O(this,og,RN).call(this)}),!n.popupRef&&this.hasPopupData?this._createPopup():s.classList.add("popupTriggerArea"),t.append(s),t}getElementsToTriggerPopup(){return x(this,ag)}addHighlightArea(){this.container.classList.add("highlightArea")}}ag=new WeakMap,og=new WeakSet,RN=function(){var t;(t=this.downloadManager)==null||t.openOrDownloadData(this.content,this.filename)};var lg,tu,ru,cg,Uu,wI,PN;class uG{constructor({div:e,accessibilityManager:t,annotationCanvasMap:n,annotationEditorUIManager:s,page:i,viewport:o,structTreeLayer:l}){$(this,Uu);$(this,lg,null);$(this,tu,null);$(this,ru,new Map);$(this,cg,null);this.div=e,P(this,lg,t),P(this,tu,n),P(this,cg,l||null),this.page=i,this.viewport=o,this.zIndex=0,this._annotationEditorUIManager=s}hasEditableAnnotations(){return x(this,ru).size>0}async render(e){var o;const{annotations:t}=e,n=this.div;Iu(n,this.viewport);const s=new Map,i={data:null,layer:n,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:e.renderForms!==!1,svgFactory:new Fk,annotationStorage:e.annotationStorage||new Hk,enableScripting:e.enableScripting===!0,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(const l of t){if(l.noHTML)continue;const c=l.annotationType===or.POPUP;if(c){const h=s.get(l.id);if(!h)continue;i.elements=h}else{const{width:h,height:f}=io(l.rect);if(h<=0||f<=0)continue}i.data=l;const u=GV.create(i);if(!u.isRenderable)continue;if(!c&&l.popupRef){const h=s.get(l.popupRef);h?h.push(u):s.set(l.popupRef,[u])}const d=u.render();l.hidden&&(d.style.visibility="hidden"),await O(this,Uu,wI).call(this,d,l.id),u._isEditable&&(x(this,ru).set(u.data.id,u),(o=this._annotationEditorUIManager)==null||o.renderAnnotationElement(u))}O(this,Uu,PN).call(this)}update({viewport:e}){const t=this.div;this.viewport=e,Iu(t,{rotation:e.rotation}),O(this,Uu,PN).call(this),t.hidden=!1}getEditableAnnotations(){return Array.from(x(this,ru).values())}getEditableAnnotation(e){return x(this,ru).get(e)}}
1150lg=new WeakMap,tu=new WeakMap,ru=new WeakMap,cg=new WeakMap,Uu=new WeakSet,wI=async function(e,t){var o,l;const n=e.firstChild||e,s=n.id=`${Mk}${t}`,i=await((o=x(this,cg))==null?void 0:o.getAriaAttributes(s));if(i)for(const[c,u]of i)n.setAttribute(c,u);this.div.append(e),(l=x(this,lg))==null||l.moveElementInDOM(this.div,e,n,!1)},PN=function(){if(!x(this,tu))return;const e=this.div;for(const[t,n]of x(this,tu)){const s=e.querySelector(`[data-annotation-id="${t}"]`);if(!s)continue;n.className="annotationContent";const{firstChild:i}=s;i?i.nodeName==="CANVAS"?i.replaceWith(n):i.classList.contains("annotationContent")?i.after(n):i.before(n):s.append(n)}x(this,tu).clear()};const z0=/\r\n?|\n/g;var di,ts,ug,nu,rs,ir,_I,NI,SI,Ly,co,Oy,My,kI,LN,CI;const kt=class kt extends dt{constructor(t){super({...t,name:"freeTextEditor"});$(this,ir);$(this,di);$(this,ts,"");$(this,ug,`${this.id}-editor`);$(this,nu,null);$(this,rs);P(this,di,t.color||kt._defaultColor||dt._defaultLineColor),P(this,rs,t.fontSize||kt._defaultFontSize)}static get _keyboardManager(){const t=kt.prototype,n=o=>o.isEmpty(),s=Lu.TRANSLATE_SMALL,i=Lu.TRANSLATE_BIG;return it(this,"_keyboardManager",new Kg([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],t.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],t._translateEmpty,{args:[-s,0],checker:n}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-i,0],checker:n}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[s,0],checker:n}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[i,0],checker:n}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-s],checker:n}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-i],checker:n}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,s],checker:n}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,i],checker:n}]]))}static initialize(t,n){dt.initialize(t,n,{strings:["pdfjs-free-text-default-content"]});const s=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(s.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,n){switch(t){case Ue.FREETEXT_SIZE:kt._defaultFontSize=n;break;case Ue.FREETEXT_COLOR:kt._defaultColor=n;break}}updateParams(t,n){switch(t){case Ue.FREETEXT_SIZE:O(this,ir,_I).call(this,n);break;case Ue.FREETEXT_COLOR:O(this,ir,NI).call(this,n);break}}static get defaultPropertiesToUpdate(){return[[Ue.FREETEXT_SIZE,kt._defaultFontSize],[Ue.FREETEXT_COLOR,kt._defaultColor||dt._defaultLineColor]]}get propertiesToUpdate(){return[[Ue.FREETEXT_SIZE,x(this,rs)],[Ue.FREETEXT_COLOR,x(this,di)]]}_translateEmpty(t,n){this._uiManager.translateSelectedEditors(t,n,!0)}getInitialTranslation(){const t=this.parentScale;return[-kt._internalPadding*t,-(kt._internalPadding+x(this,rs))*t]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(this.isInEditMode())return;this.parent.setEditingState(!1),this.parent.updateToolbar(Ge.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),P(this,nu,new AbortController);const t=this._uiManager.combinedSignal(x(this,nu));this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:t}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:t}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:t}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:t}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:t})}disableEditMode(){var t;this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",x(this,ug)),this._isDraggable=!0,(t=x(this,nu))==null||t.abort(),P(this,nu,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){var t;this.width||(this.enableEditMode(),this.editorDiv.focus(),(t=this._initialOptions)!=null&&t.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 t=x(this,ts),n=P(this,ts,O(this,ir,SI).call(this).trimEnd());if(t===n)return;const s=i=>{if(P(this,ts,i),!i){this.remove();return}O(this,ir,My).call(this),this._uiManager.rebuild(this),O(this,ir,Ly).call(this)};this.addCommands({cmd:()=>{s(n)},undo:()=>{s(t)},mustExec:!1}),O(this,ir,Ly).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(t){this.enterInEditMode()}keydown(t){t.target===this.div&&t.key==="Enter"&&(this.enterInEditMode(),t.preventDefault())}editorDivKeydown(t){kt._keyboardManager.exec(this,t)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}editorDivInput(t){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)}
vendor: 5,009 bytes, lines 1150-1156
1150render(){if(this.div)return this.div;let t,n;this.width&&(t=this.x,n=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",x(this,ug)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text"),this.enableEditing(),dt._l10nPromise.get("pdfjs-free-text-default-content").then(i=>{var o;return(o=this.editorDiv)==null?void 0:o.setAttribute("default-content",i)}),this.editorDiv.contentEditable=!0;const{style:s}=this.editorDiv;if(s.fontSize=`calc(${x(this,rs)}px * var(--scale-factor))`,s.color=x(this,di),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),Fb(this,this.div,["dblclick","keydown"]),this.width){const[i,o]=this.parentDimensions;if(this.annotationElementId){const{position:l}=this._initialData;let[c,u]=this.getInitialTranslation();[c,u]=this.pageTranslationToScreen(c,u);const[d,h]=this.pageDimensions,[f,p]=this.pageTranslation;let m,g;switch(this.rotation){case 0:m=t+(l[0]-f)/d,g=n+this.height-(l[1]-p)/h;break;case 90:m=t+(l[0]-f)/d,g=n-(l[1]-p)/h,[c,u]=[u,-c];break;case 180:m=t-this.width+(l[0]-f)/d,g=n-(l[1]-p)/h,[c,u]=[-c,-u];break;case 270:m=t+(l[0]-f-this.height*h)/d,g=n+(l[1]-p-this.width*d)/h,[c,u]=[-u,c];break}this.setAt(m*i,g*o,c,u)}else this.setAt(t*i,n*o,this.width*i,this.height*o);O(this,ir,My).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(t){var m,g,v;const n=t.clipboardData||window.clipboardData,{types:s}=n;if(s.length===1&&s[0]==="text/plain")return;t.preventDefault();const i=O(m=kt,co,LN).call(m,n.getData("text")||"").replaceAll(z0,`
1151`);if(!i)return;const o=window.getSelection();if(!o.rangeCount)return;this.editorDiv.normalize(),o.deleteFromDocument();const l=o.getRangeAt(0);if(!i.includes(`
1152`)){l.insertNode(document.createTextNode(i)),this.editorDiv.normalize(),o.collapseToStart();return}const{startContainer:c,startOffset:u}=l,d=[],h=[];if(c.nodeType===Node.TEXT_NODE){const b=c.parentElement;if(h.push(c.nodeValue.slice(u).replaceAll(z0,"")),b!==this.editorDiv){let y=d;for(const w of this.editorDiv.childNodes){if(w===b){y=h;continue}y.push(O(g=kt,co,Oy).call(g,w))}}d.push(c.nodeValue.slice(0,u).replaceAll(z0,""))}else if(c===this.editorDiv){let b=d,y=0;for(const w of this.editorDiv.childNodes)y++===u&&(b=h),b.push(O(v=kt,co,Oy).call(v,w))}P(this,ts,`${d.join(`
1153`)}${i}${h.join(`
1154`)}`),O(this,ir,My).call(this);const f=new Range;let p=d.reduce((b,y)=>b+y.length,0);for(const{firstChild:b}of this.editorDiv.childNodes)if(b.nodeType===Node.TEXT_NODE){const y=b.nodeValue.length;if(p<=y){f.setStart(b,p),f.setEnd(b,p);break}p-=y}o.removeAllRanges(),o.addRange(f)}get contentDiv(){return this.editorDiv}static async deserialize(t,n,s){var l;let i=null;if(t instanceof yI){const{data:{defaultAppearanceData:{fontSize:c,fontColor:u},rect:d,rotation:h,id:f,popupRef:p},textContent:m,textPosition:g,parent:{page:{pageNumber:v}}}=t;if(!m||m.length===0)return null;i=t={annotationType:Ge.FREETEXT,color:Array.from(u),fontSize:c,value:m.join(`
1155`),position:g,pageIndex:v-1,rect:d.slice(0),rotation:h,id:f,deleted:!1,popupRef:p}}const o=await super.deserialize(t,n,s);return P(o,rs,t.fontSize),P(o,di,Pe.makeHexColor(...t.color)),P(o,ts,O(l=kt,co,LN).call(l,t.value)),o.annotationElementId=t.id||null,o._initialData=i,o}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const n=kt._internalPadding*this.parentScale,s=this.getRect(n,n),i=dt._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:x(this,di)),o={annotationType:Ge.FREETEXT,color:i,fontSize:x(this,rs),value:O(this,ir,kI).call(this),pageIndex:this.pageIndex,rect:s,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?o:this.annotationElementId&&!O(this,ir,CI).call(this,o)?null:(o.id=this.annotationElementId,o)}renderAnnotationElement(t){const n=super.renderAnnotationElement(t);if(this.deleted)return n;const{style:s}=n;s.fontSize=`calc(${x(this,rs)}px * var(--scale-factor))`,s.color=x(this,di),n.replaceChildren();for(const o of x(this,ts).split(`
1156`)){const l=document.createElement("div");l.append(o?document.createTextNode(o):document.createElement("br")),n.append(l)}const i=kt._internalPadding*this.parentScale;return t.updateEdited({rect:this.getRect(i,i),popupContent:x(this,ts)}),n}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}};di=new WeakMap,ts=new WeakMap,ug=new WeakMap,nu=new WeakMap,rs=new WeakMap,ir=new WeakSet,_I=function(t){const n=i=>{this.editorDiv.style.fontSize=`calc(${i}px * var(--scale-factor))`,this.translate(0,-(i-x(this,rs))*this.parentScale),P(this,rs,i),O(this,ir,Ly).call(this)},s=x(this,rs);this.addCommands({cmd:n.bind(this,t),undo:n.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Ue.FREETEXT_S
1156IZE,overwriteIfSameType:!0,keepUndo:!0})},NI=function(t){const n=i=>{P(this,di,this.editorDiv.style.color=i)},s=x(this,di);this.addCommands({cmd:n.bind(this,t),undo:n.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Ue.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},SI=function(){var s;const t=[];this.editorDiv.normalize();let n=null;for(const i of this.editorDiv.childNodes)(n==null?void 0:n.nodeType)===Node.TEXT_NODE&&i.nodeName==="BR"||(t.push(O(s=kt,co,Oy).call(s,i)),n=i);return t.join(`
1157`)},Ly=function(){const[t,n]=this.parentDimensions;let s;if(this.isAttachedToDOM)s=this.div.getBoundingClientRect();else{const{currentLayer:i,div:o}=this,l=o.style.display,c=o.classList.contains("hidden");o.classList.remove("hidden"),o.style.display="hidden",i.div.append(this.div),s=o.getBoundingClientRect(),o.remove(),o.style.display=l,o.classList.toggle("hidden",c)}this.rotation%180===this.parentRotation%180?(this.width=s.width/t,this.height=s.height/n):(this.width=s.height/t,this.height=s.width/n),this.fixAndSetPosition()},co=new WeakSet,Oy=function(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(z0,"")},My=function(){if(this.editorDiv.replaceChildren(),!!x(this,ts))for(const t of x(this,ts).split(`
1158`)){const n=document.createElement("div");n.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(n)}},kI=function(){return x(this,ts).replaceAll(" "," ")},LN=function(t){return t.replaceAll(" "," ")},CI=function(t){const{value:n,fontSize:s,color:i,pageIndex:o}=this._initialData;return this._hasBeenMoved||t.value!==n||t.fontSize!==s||t.color.some((l,c)=>l!==i[c])||t.pageIndex!==o},$(kt,co),Re(kt,"_freeTextDefaultContent",""),Re(kt,"_internalPadding",0),Re(kt,"_defaultColor",null),Re(kt,"_defaultFontSize",10),Re(kt,"_type","freetext"),Re(kt,"_editorType",Ge.FREETEXT);let IN=kt;var dg,ol,hi,Nn,EI,Fy,jI,AI,ON;class dT{constructor(e,t=0,n=0,s=!0){$(this,Nn);$(this,dg);$(this,ol,[]);$(this,hi,[]);let i=1/0,o=-1/0,l=1/0,c=-1/0;const d=10**-4;for(const{x:b,y,width:w,height:_}of e){const N=Math.floor((b-t)/d)*d,S=Math.ceil((b+w+t)/d)*d,E=Math.floor((y-t)/d)*d,T=Math.ceil((y+_+t)/d)*d,D=[N,E,T,!0],R=[S,E,T,!1];x(this,ol).push(D,R),i=Math.min(i,N),o=Math.max(o,S),l=Math.min(l,E),c=Math.max(c,T)}const h=o-i+2*n,f=c-l+2*n,p=i-n,m=l-n,g=x(this,ol).at(s?-1:-2),v=[g[0],g[2]];for(const b of x(this,ol)){const[y,w,_]=b;b[0]=(y-p)/h,b[1]=(w-m)/f,b[2]=(_-m)/f}P(this,dg,{x:p,y:m,width:h,height:f,lastPoint:v})}getOutlines(){x(this,ol).sort((t,n)=>t[0]-n[0]||t[1]-n[1]||t[2]-n[2]);const e=[];for(const t of x(this,ol))t[3]?(e.push(...O(this,Nn,ON).call(this,t)),O(this,Nn,jI).call(this,t)):(O(this,Nn,AI).call(this,t),e.push(...O(this,Nn,ON).call(this,t)));return O(this,Nn,EI).call(this,e)}}dg=new WeakMap,ol=new WeakMap,hi=new WeakMap,Nn=new WeakSet,EI=function(e){const t=[],n=new Set;for(const o of e){const[l,c,u]=o;t.push([l,c,o],[l,u,o])}t.sort((o,l)=>o[1]-l[1]||o[0]-l[0]);for(let o=0,l=t.length;o<l;o+=2){const c=t[o][2],u=t[o+1][2];c.push(u),u.push(c),n.add(c),n.add(u)}const s=[];let i;for(;n.size>0;){const o=n.values().next().value;let[l,c,u,d,h]=o;n.delete(o);let f=l,p=c;for(i=[l,u],s.push(i);;){let m;if(n.has(d))m=d;else if(n.has(h))m=h;else break;n.delete(m),[l,c,u,d,h]=m,f!==l&&(i.push(f,p,l,p===c?c:u),f=l),p=p===c?u:c}i.push(f,p)}return new dG(s,x(this,dg))},Fy=function(e){const t=x(this,hi);let n=0,s=t.length-1;for(;n<=s;){const i=n+s>>1,o=t[i][0];if(o===e)return i;o<e?n=i+1:s=i-1}return s+1},jI=function([,e,t]){const n=O(this,Nn,Fy).call(this,e);x(this,hi).splice(n,0,[e,t])},AI=function([,e,t]){const n=O(this,Nn,Fy).call(this,e);for(let s=n;s<x(this,hi).length;s++){const[i,o]=x(this,hi)[s];if(i!==e)break;if(i===e&&o===t){x(this,hi).splice(s,1);return}}for(let s=n-1;s>=0;s--){const[i,o]=x(this,hi)[s];if(i!==e)break;if(i===e&&o===t){x(this,hi).splice(s,1);return}}},ON=function(e){const[t,n,s]=e,i=[[t,n,s]],o=O(this,Nn,Fy).call(this,s);for(let l=0;l<o;l++){const[c,u]=x(this,hi)[l];for(let d=0,h=i.length;d<h;d++){const[,f,p]=i[d];if(!(u<=f||p<=c)){if(f>=c){if(p>u)i[d][1]=u;else{if(h===1)return[];i.splice(d,1),d--,h--}continue}i[d][2]=c,p>u&&i.push([t,u,p])}}}return i};class TI{toSVGPath(){throw new Error("Abstract method `toSVGPath` must be implemented.")}get box(){throw new Error("Abstract getter `box` must be implemented.")}serialize(e,t){throw new Error("Abstract method `serialize` must be implemented.")}get free(){return this instanceof FN}}var hg,Ah;class dG extends TI{constructor(t,n){super();$(this,hg);$(this,Ah);P(this,Ah,t),P(this,hg,n)}toSVGPath(){const t=[];for(const n of x(this,Ah)){let[s,i]=n;t.push(`M${s} ${i}`);for(let o=2;o<n.length;o+=2){const l=n[o],c=n[o+1];l===s?(t.push(`V${c}`),i=c):c===i&&(t.push(`H${l}`),s=l)}t.push("Z")}return t.join(" ")}serialize([t,n,s,i],o){const l=[],c=s-t,u=i-n;for(const d of x(this,Ah)){const h=new Array(d.length);for(let f=0;f<d.length;f+=2)h[f]=t+d[f]*c,h[f+1]=i-d[f+1]*u;l.push(h)}return l}get box(){return x(this,hg)}}hg=new WeakMap,Ah=new WeakMap;var Ki,Ua,Th,Dh,Ji,st,su,iu,fg,pg,Rh,Ph,ll,mg,yx,bx,gg,MN;const ka=class ka{constructor({x:e,y:t},n,s,i,o,l=0){$(this,gg);$(this,Ki);$(this,Ua,[]);$(this,Th);$(this,Dh);$(this,Ji,[]);$(this,st,new Float64Array(18));$(this,su);$(this,iu);$(this,fg);$(this,pg);$(this,Rh);$(this,Ph);$(this,ll,[]);P(this,Ki,n),P(this,Ph,i*s),P(this,Dh,o),x(this,st).set([NaN,NaN,NaN,NaN,e,t],6),P(this,Th,l),P(this,pg,x(ka,mg)*s),P(this,fg,x(ka,bx)*s),P(this,Rh,s),x(this,ll).push(e,t)}get free(){return!0}isEmpty(){return isNaN(x(this,st)[8])}add({x:e,y:t}){var D;P(this,su,e),P(this,iu,t);const[n,s,i,o]=x(this,Ki);let[l,c,u,d]=x(this,st).subarray(8,12);const h=e-u,f=t-d,p=Math.hypot(h,f);if(p<x(this,fg))return!1;const m=p-x(this,pg),g=m/p,v=g*h,b=g*f;let y=l,w=c;l=u,c=d,u+=v,d+=b,(D=x(this,ll))==null||D.push(e,t);const _=-b/m,N=v/m,S=_*x(this,Ph),E=N*x(this,Ph);return x(this,st).set(x(this,st).subarray(2,8),0),x(this,st).set([u+S,d+E],4),x(this,st).set(x(this,st).subarray(14,18),12),x(this,st).set([u-S,d-E],16),isNaN(x(this,st)[6])?(x(this,Ji).length===0&&(x(this,st).set([l+S,c+E],2),x(this,Ji).push(NaN,NaN,NaN,NaN,(l+S-n)/i,(c+E-s)/o),x(this,st).set([l-S,c-E],14),x(this,Ua).push(NaN,NaN,NaN,NaN,(l-S-n)/i,(c-E-s)/o)),x(this,st).set([y,w,l,c,u,d],6),!this.isEmpty()):(x(this,st).set([y,w,l,c,u,d],6),Math.abs(Math.atan2(w-c,y-l)-Math.atan2(b,v))<Math.PI/2?([l,c,u,d]=x(this,st).subarray(2,6),x(this,Ji).push(NaN,NaN,NaN,NaN,((l+u)/2-n)/i,((c+d)/2-s)/o),[l,c,y,w]=x(this,st).subarray(14,18),x(this,Ua).push(NaN,NaN,NaN,NaN,((y+l)/2-n)/i,((w+c)/2-s)/o),!0):([y,w,l,c,u,d]=x(this,st).subarray(0,6),x(this,Ji).push(((y+5*l)/6-n)/i,((w+5*c)/6-s)/o,((5*l+u)/6-n)/i,((5*c+d)/6-s)/o,((l+u)/2-n)/i,((c+d)/2-s)/o),[u,d,l,c,y,w]=x(this,st).subarray(12,18),x(this,Ua).push(((y+5*l)/6-n)/i,((w+5*c)/6-s)/o,((5*l+u)/6-n)/i,((5*c+d)/6-s)/o,((l+u)/2-n)/i,((c+d)/2-s)/o),!0))}toSVGPath(){if(this.isEmpty())return"";const e=x(this,Ji),t=x(this,Ua),n=x(this,st).subarray(4,6),s=x(this,st).subarray(16,18),[i,o,l,c]=x(this,Ki),[u,d,h,f]=O(this,gg,MN).call(this);if(isNaN(x(this,st)[6])&&!this.isEmpty())return`M${(x(this,st)[2]-i)/l} ${(x(this,st)[3]-o)/c} L${(x(this,st)[4]-i)/l} ${(x(this,st)[5]-o)/c} L${u} ${d} L${h} ${f} L${(x(this,st)[16]-i)/l} ${(x(this,st)[17]-o)/c} L${(x(this,st)[14]-i)/l} ${(x(this,st)[15]-o)/c} Z`;const p=[];p.push(`M${e[4]} ${e[5]}`);for(let m=6;m<e.length;
1158m+=6)isNaN(e[m])?p.push(`L${e[m+4]} ${e[m+5]}`):p.push(`C${e[m]} ${e[m+1]} ${e[m+2]} ${e[m+3]} ${e[m+4]} ${e[m+5]}`);p.push(`L${(n[0]-i)/l} ${(n[1]-o)/c} L${u} ${d} L${h} ${f} L${(s[0]-i)/l} ${(s[1]-o)/c}`);for(let m=t.length-6;m>=6;m-=6)isNaN(t[m])?p.push(`L${t[m+4]} ${t[m+5]}`):p.push(`C${t[m]} ${t[m+1]} ${t[m+2]} ${t[m+3]} ${t[m+4]} ${t[m+5]}`);return p.push(`L${t[4]} ${t[5]} Z`),p.join(" ")}getOutlines(){var b;const e=x(this,Ji),t=x(this,Ua),n=x(this,st),s=n.subarray(4,6),i=n.subarray(16,18),[o,l,c,u]=x(this,Ki),d=new Float64Array((((b=x(this,ll))==null?void 0:b.length)??0)+2);for(let y=0,w=d.length-2;y<w;y+=2)d[y]=(x(this,ll)[y]-o)/c,d[y+1]=(x(this,ll)[y+1]-l)/u;d[d.length-2]=(x(this,su)-o)/c,d[d.length-1]=(x(this,iu)-l)/u;const[h,f,p,m]=O(this,gg,MN).call(this);if(isNaN(n[6])&&!this.isEmpty()){const y=new Float64Array(36);return y.set([NaN,NaN,NaN,NaN,(n[2]-o)/c,(n[3]-l)/u,NaN,NaN,NaN,NaN,(n[4]-o)/c,(n[5]-l)/u,NaN,NaN,NaN,NaN,h,f,NaN,NaN,NaN,NaN,p,m,NaN,NaN,NaN,NaN,(n[16]-o)/c,(n[17]-l)/u,NaN,NaN,NaN,NaN,(n[14]-o)/c,(n[15]-l)/u],0),new FN(y,d,x(this,Ki),x(this,Rh),x(this,Th),x(this,Dh))}const g=new Float64Array(x(this,Ji).length+24+x(this,Ua).length);let v=e.length;for(let y=0;y<v;y+=2){if(isNaN(e[y])){g[y]=g[y+1]=NaN;continue}g[y]=e[y],g[y+1]=e[y+1]}g.set([NaN,NaN,NaN,NaN,(s[0]-o)/c,(s[1]-l)/u,NaN,NaN,NaN,NaN,h,f,NaN,NaN,NaN,NaN,p,m,NaN,NaN,NaN,NaN,(i[0]-o)/c,(i[1]-l)/u],v),v+=24;for(let y=t.length-6;y>=6;y-=6)for(let w=0;w<6;w+=2){if(isNaN(t[y+w])){g[v]=g[v+1]=NaN,v+=2;continue}g[v]=t[y+w],g[v+1]=t[y+w+1],v+=2}return g.set([NaN,NaN,NaN,NaN,t[4],t[5]],v),new FN(g,d,x(this,Ki),x(this,Rh),x(this,Th),x(this,Dh))}};Ki=new WeakMap,Ua=new WeakMap,Th=new WeakMap,Dh=new WeakMap,Ji=new WeakMap,st=new WeakMap,su=new WeakMap,iu=new WeakMap,fg=new WeakMap,pg=new WeakMap,Rh=new WeakMap,Ph=new WeakMap,ll=new WeakMap,mg=new WeakMap,yx=new WeakMap,bx=new WeakMap,gg=new WeakSet,MN=function(){const e=x(this,st).subarray(4,6),t=x(this,st).subarray(16,18),[n,s,i,o]=x(this,Ki);return[(x(this,su)+(e[0]-t[0])/2-n)/i,(x(this,iu)+(e[1]-t[1])/2-s)/o,(x(this,su)+(t[0]-e[0])/2-n)/i,(x(this,iu)+(t[1]-e[1])/2-s)/o]},$(ka,mg,8),$(ka,yx,2),$(ka,bx,x(ka,mg)+x(ka,yx));let tm=ka;var Ih,au,Ha,yg,ns,bg,Jt,Bn,op,lp,DI;class FN extends TI{constructor(t,n,s,i,o,l){super();$(this,Bn);$(this,Ih);$(this,au,null);$(this,Ha);$(this,yg);$(this,ns);$(this,bg);$(this,Jt);P(this,Jt,t),P(this,ns,n),P(this,Ih,s),P(this,bg,i),P(this,Ha,o),P(this,yg,l),O(this,Bn,DI).call(this,l);const{x:c,y:u,width:d,height:h}=x(this,au);for(let f=0,p=t.length;f<p;f+=2)t[f]=(t[f]-c)/d,t[f+1]=(t[f+1]-u)/h;for(let f=0,p=n.length;f<p;f+=2)n[f]=(n[f]-c)/d,n[f+1]=(n[f+1]-u)/h}toSVGPath(){const t=[`M${x(this,Jt)[4]} ${x(this,Jt)[5]}`];for(let n=6,s=x(this,Jt).length;n<s;n+=6){if(isNaN(x(this,Jt)[n])){t.push(`L${x(this,Jt)[n+4]} ${x(this,Jt)[n+5]}`);continue}t.push(`C${x(this,Jt)[n]} ${x(this,Jt)[n+1]} ${x(this,Jt)[n+2]} ${x(this,Jt)[n+3]} ${x(this,Jt)[n+4]} ${x(this,Jt)[n+5]}`)}return t.push("Z"),t.join(" ")}serialize([t,n,s,i],o){const l=s-t,c=i-n;let u,d;switch(o){case 0:u=O(this,Bn,op).call(this,x(this,Jt),t,i,l,-c),d=O(this,Bn,op).call(this,x(this,ns),t,i,l,-c);break;case 90:u=O(this,Bn,lp).call(this,x(this,Jt),t,n,l,c),d=O(this,Bn,lp).call(this,x(this,ns),t,n,l,c);break;case 180:u=O(this,Bn,op).call(this,x(this,Jt),s,n,-l,c),d=O(this,Bn,op).call(this,x(this,ns),s,n,-l,c);break;case 270:u=O(this,Bn,lp).call(this,x(this,Jt),s,i,-l,-c),d=O(this,Bn,lp).call(this,x(this,ns),s,i,-l,-c);break}return{outline:Array.from(u),points:[Array.from(d)]}}get box(){return x(this,au)}getNewOutline(t,n){const{x:s,y:i,width:o,height:l}=x(this,au),[c,u,d,h]=x(this,Ih),f=o*d,p=l*h,m=s*d+c,g=i*h+u,v=new tm({x:x(this,ns)[0]*f+m,y:x(this,ns)[1]*p+g},x(this,Ih),x(this,bg),t,x(this,yg),n??x(this,Ha));for(let b=2;b<x(this,ns).length;b+=2)v.add({x:x(this,ns)[b]*f+m,y:x(this,ns)[b+1]*p+g});return v.getOutlines()}}Ih=new WeakMap,au=new WeakMap,Ha=new WeakMap,yg=new WeakMap,ns=new WeakMap,bg=new WeakMap,Jt=new WeakMap,Bn=new WeakSet,op=function(t,n,s,i,o){const l=new Float64Array(t.length);for(let c=0,u=t.length;c<u;c+=2)l[c]=n+t[c]*i,l[c+1]=s+t[c+1]*o;return l},lp=function(t,n,s,i,o){const l=new Float64Array(t.length);for(let c=0,u=t.length;c<u;c+=2)l[c]=n+t[c+1]*i,l[c+1]=s+t[c]*o;return l},DI=function(t){const n=x(this,Jt);let s=n[4],i=n[5],o=s,l=i,c=s,u=i,d=s,h=i;const f=t?Math.max:Math.min;for(let b=6,y=n.length;b<y;b+=6){if(isNaN(n[b]))o=Math.min(o,n[b+4]),l=Math.min(l,n[b+5]),c=Math.max(c,n[b+4]),u=Math.max(u,n[b+5]),h<n[b+5]?(d=n[b+4],h=n[b+5]):h===n[b+5]&&(d=f(d,n[b+4]));else{const w=Pe.bezierBoundingBox(s,i,...n.slice(b,b+6));o=Math.min(o,w[0]),l=Math.min(l,w[1]),c=Math.max(c,w[2]),u=Math.max(u,w[3]),h<w[3]?(d=w[2],h=w[3]):h===w[3]&&(d=f(d,w[2]))}s=n[b+4],i=n[b+5]}const p=o-x(this,Ha),m=l-x(this,Ha),g=c-o+2*x(this,Ha),v=u-l+2*x(this,Ha);P(this,au,{x:p,y:m,width:g,height:v,lastPoint:[d,h]})};var xg,vg,fi,ou,Lh,dr,wg,Oh,_g,Ng,pi,Mh,Sg,_t,BN,$N,RI,lc,PI,Po;const An=class An{constructor({editor:e=null,uiManager:t=null}){$(this,_t);$(this,xg,O(this,_t,RI).bind(this));$(this,vg,O(this,_t,PI).bind(this));$(this,fi,null);$(this,ou,null);$(this,Lh);$(this,dr,null);$(this,wg,!1);$(this,Oh,!1);$(this,_g,null);$(this,Ng);$(this,pi,null);$(this,Mh);var n;e?(P(this,Oh,!1),P(this,Mh,Ue.HIGHLIGHT_COLOR),P(this,_g,e)):(P(this,Oh,!0),P(this,Mh,Ue.HIGHLIGHT_DEFAULT_COLOR)),P(this,pi,(e==null?void 0:e._uiManager)||t),P(this,Ng,x(this,pi)._eventBus),P(this,Lh,(e==null?void 0:e.color)||((n=x(this,pi))==null?void 0:n.highlightColors.values().next().value)||"#FFFF98"),x(An,Sg)||P(An,Sg,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 it(this,"_keyboardManager",new Kg
1158([[["Escape","mac+Escape"],An.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],An.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],An.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],An.prototype._moveToPrevious],[["Home","mac+Home"],An.prototype._moveToBeginning],[["End","mac+End"],An.prototype._moveToEnd]]))}renderButton(){const e=P(this,fi,document.createElement("button"));e.className="colorPicker",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),e.setAttribute("aria-haspopup",!0);const t=x(this,pi)._signal;e.addEventListener("click",O(this,_t,lc).bind(this),{signal:t}),e.addEventListener("keydown",x(this,xg),{signal:t});const n=P(this,ou,document.createElement("span"));return n.className="swatch",n.setAttribute("aria-hidden",!0),n.style.backgroundColor=x(this,Lh),e.append(n),e}renderMainDropdown(){const e=P(this,dr,O(this,_t,BN).call(this));return e.setAttribute("aria-orientation","horizontal"),e.setAttribute("aria-labelledby","highlightColorPickerLabel"),e}_colorSelectFromKeyboard(e){if(e.target===x(this,fi)){O(this,_t,lc).call(this,e);return}const t=e.target.getAttribute("data-color");t&&O(this,_t,$N).call(this,t,e)}_moveToNext(e){var t,n;if(!x(this,_t,Po)){O(this,_t,lc).call(this,e);return}if(e.target===x(this,fi)){(t=x(this,dr).firstChild)==null||t.focus();return}(n=e.target.nextSibling)==null||n.focus()}_moveToPrevious(e){var t,n;if(e.target===((t=x(this,dr))==null?void 0:t.firstChild)||e.target===x(this,fi)){x(this,_t,Po)&&this._hideDropdownFromKeyboard();return}x(this,_t,Po)||O(this,_t,lc).call(this,e),(n=e.target.previousSibling)==null||n.focus()}_moveToBeginning(e){var t;if(!x(this,_t,Po)){O(this,_t,lc).call(this,e);return}(t=x(this,dr).firstChild)==null||t.focus()}_moveToEnd(e){var t;if(!x(this,_t,Po)){O(this,_t,lc).call(this,e);return}(t=x(this,dr).lastChild)==null||t.focus()}hideDropdown(){var e;(e=x(this,dr))==null||e.classList.add("hidden"),window.removeEventListener("pointerdown",x(this,vg))}_hideDropdownFromKeyboard(){var e;if(!x(this,Oh)){if(!x(this,_t,Po)){(e=x(this,_g))==null||e.unselect();return}this.hideDropdown(),x(this,fi).focus({preventScroll:!0,focusVisible:x(this,wg)})}}updateColor(e){if(x(this,ou)&&(x(this,ou).style.backgroundColor=e),!x(this,dr))return;const t=x(this,pi).highlightColors.values();for(const n of x(this,dr).children)n.setAttribute("aria-selected",t.next().value===e)}destroy(){var e,t;(e=x(this,fi))==null||e.remove(),P(this,fi,null),P(this,ou,null),(t=x(this,dr))==null||t.remove(),P(this,dr,null)}};xg=new WeakMap,vg=new WeakMap,fi=new WeakMap,ou=new WeakMap,Lh=new WeakMap,dr=new WeakMap,wg=new WeakMap,Oh=new WeakMap,_g=new WeakMap,Ng=new WeakMap,pi=new WeakMap,Mh=new WeakMap,Sg=new WeakMap,_t=new WeakSet,BN=function(){const e=document.createElement("div"),t=x(this,pi)._signal;e.addEventListener("contextmenu",Gs,{signal:t}),e.className="dropdown",e.role="listbox",e.setAttribute("aria-multiselectable",!1),e.setAttribute("aria-orientation","vertical"),e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown");for(const[n,s]of x(this,pi).highlightColors){const i=document.createElement("button");i.tabIndex="0",i.role="option",i.setAttribute("data-color",s),i.title=n,i.setAttribute("data-l10n-id",x(An,Sg)[n]);const o=document.createElement("span");i.append(o),o.className="swatch",o.style.backgroundColor=s,i.setAttribute("aria-selected",s===x(this,Lh)),i.addEventListener("click",O(this,_t,$N).bind(this,s),{signal:t}),e.append(i)}return e.addEventListener("keydown",x(this,xg),{signal:t}),e},$N=function(e,t){t.stopPropagation(),x(this,Ng).dispatch("switchannotationeditorparams",{source:this,type:x(this,Mh),value:e})},RI=function(e){An._keyboardManager.exec(this,e)},lc=function(e){if(x(this,_t,Po)){this.hideDropdown();return}if(P(this,wg,e.detail===0),window.addEventListener("pointerdown",x(this,vg),{signal:x(this,pi)._signal}),x(this,dr)){x(this,dr).classList.remove("hidden");return}const t=P(this,dr,O(this,_t,BN).call(this));x(this,fi).append(t)},PI=function(e){var t;(t=x(this,dr))!=null&&t.contains(e.target)||this.hideDropdown()},Po=function(){return x(this,dr)&&!x(this,dr).classList.contains("hidden")},$(An,Sg,null);let $b=An;var Fh,kg,za,lu,Bh,Es,Cg,Eg,cu,mi,rn,Rn,$h,qa,hr,Uh,js,jg,We,UN,By,II,LI,OI,HN,cc,Os,xd,MI,$y,cp,FI,BI,$I,UI,HI;const ut=class ut extends dt{constructor(t){super({...t,name:"highlightEditor"});$(this,We);$(this,Fh,null);$(this,kg,0);$(this,za);$(this,lu,null);$(this,Bh,null);$(this,Es,null);$(this,Cg,null);$(this,Eg,0);$(this,cu,null);$(this,mi,null);$(this,rn,null);$(this,Rn,!1);$(this,$h,null);$(this,qa);$(this,hr,null);$(this,Uh,"");$(this,js);$(this,jg,"");this.color=t.color||ut._defaultColor,P(this,js,t.thickness||ut._defaultThickness),P(this,qa,t.opacity||ut._defaultOpacity),P(this,za,t.boxes||null),P(this,jg,t.methodOfCreation||""),P(this,Uh,t.text||""),this._isDraggable=!1,t.highlightId>-1?(P(this,Rn,!0),O(this,We,By).call(this,t),O(this,We,cc).call(this)):x(this,za)&&(P(this,Fh,t.anchorNode),P(this,kg,t.anchorOffset),P(this,Cg,t.focusNode),P(this,Eg,t.focusOffset),O(this,We,UN).call(this),O(this,We,cc).call(this),this.rotate(this.rotation))}static get _keyboardManager(){const t=ut.prototype;
1158return it(this,"_keyboardManager",new Kg([[["ArrowLeft","mac+ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],t._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:x(this,Rn)?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:x(this,js),methodOfCreation:x(this,jg)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}static initialize(t,n){var s;dt.initialize(t,n),ut._defaultColor||(ut._defaultColor=((s=n.highlightColors)==null?void 0:s.values().next().value)||"#fff066")}static updateDefaultParams(t,n){switch(t){case Ue.HIGHLIGHT_DEFAULT_COLOR:ut._defaultColor=n;break;case Ue.HIGHLIGHT_THICKNESS:ut._defaultThickness=n;break}}translateInPage(t,n){}get toolbarPosition(){return x(this,$h)}updateParams(t,n){switch(t){case Ue.HIGHLIGHT_COLOR:O(this,We,II).call(this,n);break;case Ue.HIGHLIGHT_THICKNESS:O(this,We,LI).call(this,n);break}}static get defaultPropertiesToUpdate(){return[[Ue.HIGHLIGHT_DEFAULT_COLOR,ut._defaultColor],[Ue.HIGHLIGHT_THICKNESS,ut._defaultThickness]]}get propertiesToUpdate(){return[[Ue.HIGHLIGHT_COLOR,this.color||ut._defaultColor],[Ue.HIGHLIGHT_THICKNESS,x(this,js)||ut._defaultThickness],[Ue.HIGHLIGHT_FREE,x(this,Rn)]]}async addEditToolbar(){const t=await super.addEditToolbar();return t?(this._uiManager.highlightColors&&(P(this,Bh,new $b({editor:this})),t.addColorPicker(x(this,Bh))),t):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(O(this,We,cp).call(this))}getBaseTranslation(){return[0,0]}getRect(t,n){return super.getRect(t,n,O(this,We,cp).call(this))}onceAdded(){this.annotationElementId||this.parent.addUndoableEditor(this),this.div.focus()}remove(){O(this,We,HN).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(O(this,We,cc).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){var s;let n=!1;this.parent&&!t?O(this,We,HN).call(this):t&&(O(this,We,cc).call(this,t),n=!this.parent&&((s=this.div)==null?void 0:s.classList.contains("selectedEditor"))),super.setParent(t),this.show(this._isVisible),n&&this.select()}rotate(t){var i,o,l;const{drawLayer:n}=this.parent;let s;x(this,Rn)?(t=(t-this.rotation+360)%360,s=O(i=ut,Os,xd).call(i,x(this,mi).box,t)):s=O(o=ut,Os,xd).call(o,this,t),n.rotate(x(this,rn),t),n.rotate(x(this,hr),t),n.updateBox(x(this,rn),s),n.updateBox(x(this,hr),O(l=ut,Os,xd).call(l,x(this,Es).box,t))}render(){if(this.div)return this.div;const t=super.render();x(this,Uh)&&(t.setAttribute("aria-label",x(this,Uh)),t.setAttribute("role","mark")),x(this,Rn)?t.classList.add("free"):this.div.addEventListener("keydown",O(this,We,MI).bind(this),{signal:this._uiManager._signal});const n=P(this,cu,document.createElement("div"));t.append(n),n.setAttribute("aria-hidden","true"),n.className="internal",n.style.clipPath=x(this,lu);const[s,i]=this.parentDimensions;return this.setDims(this.width*s,this.height*i),Fb(this,x(this,cu),["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){this.parent.drawLayer.addClass(x(this,hr),"hovered")}pointerleave(){this.parent.drawLayer.removeClass(x(this,hr),"hovered")}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:O(this,We,$y).call(this,!0);break;case 1:case 3:O(this,We,$y).call(this,!1);break}}select(){var t,n;super.select(),x(this,hr)&&((t=this.parent)==null||t.drawLayer.removeClass(x(this,hr),"hovered"),(n=this.parent)==null||n.drawLayer.addClass(x(this,hr),"selected"))}unselect(){var t;super.unselect(),x(this,hr)&&((t=this.parent)==null||t.drawLayer.removeClass(x(this,hr),"selected"),x(this,Rn)||O(this,We,$y).call(this,!1))}get _mustFixPosition(){return!x(this,Rn)}show(t=this._isVisible){super.show(t),this.parent&&(this.parent.drawLayer.show(x(this,rn),t),this.parent.drawLayer.show(x(this,hr),t))}static startHighlighting(t,n,{target:s,x:i,y:o}){const{x:l,y:c,width:u,height:d}=s.getBoundingClientRect(),h=new AbortController,f=t.combinedSignal(h),p=g=>{g.preventDefault(),g.stopPropagation()},m=g=>
1158{h.abort(),O(this,Os,UI).call(this,t,g)};window.addEventListener("blur",m,{signal:f}),window.addEventListener("pointerup",m,{signal:f}),window.addEventListener("pointerdown",p,{capture:!0,passive:!1,signal:f}),window.addEventListener("contextmenu",Gs,{signal:f}),s.addEventListener("pointermove",O(this,Os,$I).bind(this,t),{signal:f}),this._freeHighlight=new tm({x:i,y:o},[l,c,u,d],t.scale,this._defaultThickness/2,n,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.highlight(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0)}static async deserialize(t,n,s){var g,v,b,y;let i=null;if(t instanceof xI){const{data:{quadPoints:w,rect:_,rotation:N,id:S,color:E,opacity:T,popupRef:D},parent:{page:{pageNumber:R}}}=t;i=t={annotationType:Ge.HIGHLIGHT,color:Array.from(E),opacity:T,quadPoints:w,boxes:null,pageIndex:R-1,rect:_.slice(0),rotation:N,id:S,deleted:!1,popupRef:D}}else if(t instanceof Gk){const{data:{inkLists:w,rect:_,rotation:N,id:S,color:E,borderStyle:{rawWidth:T},popupRef:D},parent:{page:{pageNumber:R}}}=t;i=t={annotationType:Ge.HIGHLIGHT,color:Array.from(E),thickness:T,inkLists:w,boxes:null,pageIndex:R-1,rect:_.slice(0),rotation:N,id:S,deleted:!1,popupRef:D}}const{color:o,quadPoints:l,inkLists:c,opacity:u}=t,d=await super.deserialize(t,n,s);d.color=Pe.makeHexColor(...o),P(d,qa,u||1),c&&P(d,js,t.thickness),d.annotationElementId=t.id||null,d._initialData=i;const[h,f]=d.pageDimensions,[p,m]=d.pageTranslation;if(l){const w=P(d,za,[]);for(let _=0;_<l.length;_+=8)w.push({x:(l[_]-p)/h,y:1-(l[_+1]-m)/f,width:(l[_+2]-l[_])/h,height:(l[_+1]-l[_+5])/f});O(g=d,We,UN).call(g),O(v=d,We,cc).call(v),d.rotate(d.rotation)}else if(c){P(d,Rn,!0);const w=c[0],_={x:w[0]-p,y:f-(w[1]-m)},N=new tm(_,[0,0,h,f],1,x(d,js)/2,!0,.001);for(let T=0,D=w.length;T<D;T+=2)_.x=w[T]-p,_.y=f-(w[T+1]-m),N.add(_);const{id:S,clipPathId:E}=n.drawLayer.highlight(N,d.color,d._defaultOpacity,!0);O(b=d,We,By).call(b,{highlightOutlines:N.getOutlines(),highlightId:S,clipPathId:E}),O(y=d,We,cc).call(y)}return d}serialize(t=!1){if(this.isEmpty()||t)return null;if(this.deleted)return this.serializeDeleted();const n=this.getRect(0,0),s=dt._colorManager.convert(this.color),i={annotationType:Ge.HIGHLIGHT,color:s,opacity:x(this,qa),thickness:x(this,js),quadPoints:O(this,We,FI).call(this),outlines:O(this,We,BI).call(this,n),pageIndex:this.pageIndex,rect:n,rotation:O(this,We,cp).call(this),structTreeParentId:this._structTreeParentId};return this.annotationElementId&&!O(this,We,HI).call(this,i)?null:(i.id=this.annotationElementId,i)}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}};Fh=new WeakMap,kg=new WeakMap,za=new WeakMap,lu=new WeakMap,Bh=new WeakMap,Es=new WeakMap,Cg=new WeakMap,Eg=new WeakMap,cu=new WeakMap,mi=new WeakMap,rn=new WeakMap,Rn=new WeakMap,$h=new WeakMap,qa=new WeakMap,hr=new WeakMap,Uh=new WeakMap,js=new WeakMap,jg=new WeakMap,We=new WeakSet,UN=function(){const t=new dT(x(this,za),.001);P(this,mi,t.getOutlines()),{x:this.x,y:this.y,width:this.width,height:this.height}=x(this,mi).box;const n=new dT(x(this,za),.0025,.001,this._uiManager.direction==="ltr");P(this,Es,n.getOutlines());const{lastPoint:s}=x(this,Es).box;P(this,$h,[(s[0]-this.x)/this.width,(s[1]-this.y)/this.height])},By=function({highlightOutlines:t,highlightId:n,clipPathId:s}){var h,f;if(P(this,mi,t),P(this,Es,t.getNewOutline(x(this,js)/2+1.5,.0025)),n>=0)P(this,rn,n),P(this,lu,s),this.parent.drawLayer.finalizeLine(n,t),P(this,hr,this.parent.drawLayer.highlightOutline(x(this,Es)));else if(this.parent){const p=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(x(this,rn),t),this.parent.drawLayer.updateBox(x(this,rn),O(h=ut,Os,xd).call(h,x(this,mi).box,(p-this.rotation+360)%360)),this.parent.drawLayer.updateLine(x(this,hr),x(this,Es)),this.parent.drawLayer.updateBox(x(this,hr),O(f=ut,Os,xd).call(f,x(this,Es).box,p))}const{x:o,y:l,width:c,height:u}=t.box;switch(this.rotation){case 0:this.x=o,this.y=l,this.width=c,this.height=u;break;case 90:{const[p,m]=this.parentDimensions;
1158this.x=l,this.y=1-o,this.width=c*m/p,this.height=u*p/m;break}case 180:this.x=1-o,this.y=1-l,this.width=c,this.height=u;break;case 270:{const[p,m]=this.parentDimensions;this.x=1-l,this.y=o,this.width=c*m/p,this.height=u*p/m;break}}const{lastPoint:d}=x(this,Es).box;P(this,$h,[(d[0]-o)/c,(d[1]-l)/u])},II=function(t){const n=(o,l)=>{var c,u,d;this.color=o,(c=this.parent)==null||c.drawLayer.changeColor(x(this,rn),o),(u=x(this,Bh))==null||u.updateColor(o),P(this,qa,l),(d=this.parent)==null||d.drawLayer.changeOpacity(x(this,rn),l)},s=this.color,i=x(this,qa);this.addCommands({cmd:n.bind(this,t,ut._defaultOpacity),undo:n.bind(this,s,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Ue.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(t)},!0)},LI=function(t){const n=x(this,js),s=i=>{P(this,js,i),O(this,We,OI).call(this,i)};this.addCommands({cmd:s.bind(this,t),undo:s.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Ue.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)},OI=function(t){if(!x(this,Rn))return;O(this,We,By).call(this,{highlightOutlines:x(this,mi).getNewOutline(t/2)}),this.fixAndSetPosition();const[n,s]=this.parentDimensions;this.setDims(this.width*n,this.height*s)},HN=function(){x(this,rn)===null||!this.parent||(this.parent.drawLayer.remove(x(this,rn)),P(this,rn,null),this.parent.drawLayer.remove(x(this,hr)),P(this,hr,null))},cc=function(t=this.parent){x(this,rn)===null&&({id:fn(this,rn)._,clipPathId:fn(this,lu)._}=t.drawLayer.highlight(x(this,mi),this.color,x(this,qa)),P(this,hr,t.drawLayer.highlightOutline(x(this,Es))),x(this,cu)&&(x(this,cu).style.clipPath=x(this,lu)))},Os=new WeakSet,xd=function({x:t,y:n,width:s,height:i},o){switch(o){case 90:return{x:1-n-i,y:t,width:i,height:s};case 180:return{x:1-t-s,y:1-n-i,width:s,height:i};case 270:return{x:n,y:1-t-s,width:i,height:s}}return{x:t,y:n,width:s,height:i}},MI=function(t){ut._keyboardManager.exec(this,t)},$y=function(t){if(!x(this,Fh))return;const n=window.getSelection();t?n.setPosition(x(this,Fh),x(this,kg)):n.setPosition(x(this,Cg),x(this,Eg))},cp=function(){return x(this,Rn)?this.rotation:0},FI=function(){if(x(this,Rn))return null;const[t,n]=this.pageDimensions,[s,i]=this.pageTranslation,o=x(this,za),l=new Float32Array(o.length*8);let c=0;for(const{x:u,y:d,width:h,height:f}of o){const p=u*t+s,m=(1-d-f)*n+i;l[c]=l[c+4]=p,l[c+1]=l[c+3]=m,l[c+2]=l[c+6]=p+h*t,l[c+5]=l[c+7]=m+f*n,c+=8}return l},BI=function(t){return x(this,mi).serialize(t,O(this,We,cp).call(this))},$I=function(t,n){this._freeHighlight.add(n)&&t.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)},UI=function(t,n){this._freeHighlight.isEmpty()?t.drawLayer.removeFreeHighlight(this._freeHighlightId):t.createAndAddNewEditor(n,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},HI=function(t){const{color:n}=this._initialData;return t.color.some((s,i)=>s!==n[i])},$(ut,Os),Re(ut,"_defaultColor",null),Re(ut,"_defaultOpacity",1),Re(ut,"_defaultThickness",12),Re(ut,"_type","highlight"),Re(ut,"_editorType",Ge.HIGHLIGHT),Re(ut,"_freeHighlightId",-1),Re(ut,"_freeHighlight",null),Re(ut,"_freeHighlightClipId","");let Ub=ut;var uu,du,Zi,Wa,As,hu,fu,pu,Va,Hh,mu,gu,cl,Ce,zI,qI,WI,VI,qN,GI,WN,XI,YI,KI,JI,ZI,uc,VN,GN,XN,Uy,Hy,vd,YN,zy,wo,QI,KN,eL,tL,JN,qy,up;const Ht=class Ht extends dt{constructor(t){super({...t,name:"inkEditor"});$(this,Ce);$(this,uu,0);$(this,du,0);$(this,Zi,null);$(this,Wa,new Path2D);$(this,As,!1);$(this,hu,null);$(this,fu,!1);$(this,pu,!1);$(this,Va,null);$(this,Hh,null);$(this,mu,0);$(this,gu,0);$(this,cl,null);this.color=t.color||null,this.thickness=t.thickness||null,this.opacity=t.opacity||null,this.paths=[],this.bezierPath2D=[],this.allRawPaths=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0,this._willKeepAspectRatio=!0}static initialize(t,n){dt.initialize(t,n)}static updateDefaultParams(t,n){switch(t){case Ue.INK_THICKNESS:Ht._defaultThickness=n;break;case Ue.INK_COLOR:Ht._defaultColor=n;break;case Ue.INK_OPACITY:Ht._defaultOpacity=n/100;break}}updateParams(t,n){switch(t){case Ue.INK_THICKNESS:O(this,Ce,zI).call(this,n);break;case Ue.INK_COLOR:O(this,Ce,qI).call(this,n);break;case Ue.INK_OPACITY:O(this,Ce,WI).call(this,n);break}}static get defaultPropertiesToUpdate(){return[[Ue.INK_THICKNESS,Ht._defaultThickness],[Ue.INK_COLOR,Ht._defaultColor||dt._defaultLineColor],[Ue.INK_OPACITY,Math.round(Ht._defaultOpacity*100)]]}get propertiesToUpdate(){return[[Ue.INK_THICKNESS,this.thickness||Ht._defaultThickness],[Ue.INK_COLOR,this.color||Ht._defaultColor||dt._defaultLineColor],[Ue.INK_OPACITY,Math.round(100*(this.opacity??Ht._defaultOpacity))]]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.canvas||(O(this,Ce,Uy).call(this),O(this,Ce,Hy).call(this)),this.isAttachedToDOM||(this.parent.add(this),O(this,Ce,vd).call(this)),O(this,Ce,up).call(this)))}remove(){var t;this.canvas!==null&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,x(this,Zi)&&(clearTimeout(x(this,Zi)),P(this,Zi,null)),(t=x(this,Va))==null||t.disconnect(),P(this,Va,null),super.remove())}setParent(t){!this.parent&&t?this._uiManager.removeShouldRescale(this):this.parent&&t===null&&this._uiManager.addShouldRescale(this),super.setParent(t)}onScaleChanging(){const[t,n]=this.parentDimensions,s=this.width*t,i=this.height*n;this.setDimensions(s,i)}enableEditMode(){x(this,As)||this.canvas===null||(super.enableEditMode(),this._isDraggable=!1,O(this,Ce,VN).call(this))}disableEditMode(){!this.isInEditMode()||this.canvas===null||(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),O(this,Ce,GN).call(this))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return this.paths.length===0||this.paths.length===1&&this.paths[0].length===0}commit(){x(this,As)||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),P(this,As,!0),this.div.classList.add("disabled"),O(this,Ce,up).call(this,!0),this.select(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),this.enableEditMode())}canvasPointerdown(t){t.button!==0||!this.isInEditMode()||x(this,As)||(this.setInForeground(),t.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),O(this,Ce,GI).call(this,t.offsetX,t.offsetY))}canvasPointermove(t){t.preventDefault(),O(this,Ce,WN).call(this,t.offsetX,t.offsetY)}canvasPointerup(t){t.preventDefault(),O(this,Ce,XN).call(this,t)}canvasPointerleave(t){O(this,Ce,XN).call(this,t)}get isResizable(){return!this.isEmpty()&&x(this,As)}
1158render(){if(this.div)return this.div;let t,n;this.width&&(t=this.x,n=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");const[s,i,o,l]=O(this,Ce,VI).call(this);if(this.setAt(s,i,0,0),this.setDims(o,l),O(this,Ce,Uy).call(this),this.width){const[c,u]=this.parentDimensions;this.setAspectRatio(this.width*c,this.height*u),this.setAt(t*c,n*u,this.width*c,this.height*u),P(this,pu,!0),O(this,Ce,vd).call(this),this.setDims(this.width*c,this.height*u),O(this,Ce,uc).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return O(this,Ce,Hy).call(this),this.div}setDimensions(t,n){const s=Math.round(t),i=Math.round(n);if(x(this,mu)===s&&x(this,gu)===i)return;P(this,mu,s),P(this,gu,i),this.canvas.style.visibility="hidden";const[o,l]=this.parentDimensions;this.width=t/o,this.height=n/l,this.fixAndSetPosition(),x(this,As)&&O(this,Ce,YN).call(this,t,n),O(this,Ce,vd).call(this),O(this,Ce,uc).call(this),this.canvas.style.visibility="visible",this.fixDims()}static async deserialize(t,n,s){var v,b,y;if(t instanceof Gk)return null;const i=await super.deserialize(t,n,s);i.thickness=t.thickness,i.color=Pe.makeHexColor(...t.color),i.opacity=t.opacity;const[o,l]=i.pageDimensions,c=i.width*o,u=i.height*l,d=i.parentScale,h=t.thickness/2;P(i,As,!0),P(i,mu,Math.round(c)),P(i,gu,Math.round(u));const{paths:f,rect:p,rotation:m}=t;for(let{bezier:w}of f){w=O(v=Ht,wo,eL).call(v,w,p,m);const _=[];i.paths.push(_);let N=d*(w[0]-h),S=d*(w[1]-h);for(let T=2,D=w.length;T<D;T+=6){const R=d*(w[T]-h),H=d*(w[T+1]-h),A=d*(w[T+2]-h),U=d*(w[T+3]-h),C=d*(w[T+4]-h),M=d*(w[T+5]-h);_.push([[N,S],[R,H],[A,U],[C,M]]),N=C,S=M}const E=O(this,wo,QI).call(this,_);i.bezierPath2D.push(E)}const g=O(b=i,Ce,JN).call(b);return P(i,du,Math.max(dt.MIN_SIZE,g[2]-g[0])),P(i,uu,Math.max(dt.MIN_SIZE,g[3]-g[1])),O(y=i,Ce,YN).call(y,c,u),i}serialize(){if(this.isEmpty())return null;const t=this.getRect(0,0),n=dt._colorManager.convert(this.ctx.strokeStyle);return{annotationType:Ge.INK,color:n,thickness:this.thickness,opacity:this.opacity,paths:O(this,Ce,tL).call(this,this.scaleFactor/this.parentScale,this.translationX,this.translationY,t),pageIndex:this.pageIndex,rect:t,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}};uu=new WeakMap,du=new WeakMap,Zi=new WeakMap,Wa=new WeakMap,As=new WeakMap,hu=new WeakMap,fu=new WeakMap,pu=new WeakMap,Va=new WeakMap,Hh=new WeakMap,mu=new WeakMap,gu=new WeakMap,cl=new WeakMap,Ce=new WeakSet,zI=function(t){const n=i=>{this.thickness=i,O(this,Ce,up).call(this)},s=this.thickness;this.addCommands({cmd:n.bind(this,t),undo:n.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Ue.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})},qI=function(t){const n=i=>
1158{this.color=i,O(this,Ce,uc).call(this)},s=this.color;this.addCommands({cmd:n.bind(this,t),undo:n.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Ue.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})},WI=function(t){const n=i=>{this.opacity=i,O(this,Ce,uc).call(this)};t/=100;const s=this.opacity;this.addCommands({cmd:n.bind(this,t),undo:n.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Ue.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})},VI=function(){const{parentRotation:t,parentDimensions:[n,s]}=this;switch(t){case 90:return[0,s,s,n];case 180:return[n,s,n,s];case 270:return[n,0,s,n];default:return[0,0,n,s]}},qN=function(){const{ctx:t,color:n,opacity:s,thickness:i,parentScale:o,scaleFactor:l}=this;t.lineWidth=i*o/l,t.lineCap="round",t.lineJoin="round",t.miterLimit=10,t.strokeStyle=`${n}${MW(s)}`},GI=function(t,n){this.canvas.addEventListener("contextmenu",Gs,{signal:this._uiManager._signal}),O(this,Ce,GN).call(this),P(this,hu,new AbortController);const s=this._uiManager.combinedSignal(x(this,hu));this.canvas.addEventListener("pointerleave",this.canvasPointerleave.bind(this),{signal:s}),this.canvas.addEventListener("pointermove",this.canvasPointermove.bind(this),{signal:s}),this.canvas.addEventListener("pointerup",this.canvasPointerup.bind(this),{signal:s}),this.isEditing=!0,x(this,pu)||(P(this,pu,!0),O(this,Ce,vd).call(this),this.thickness||(this.thickness=Ht._defaultThickness),this.color||(this.color=Ht._defaultColor||dt._defaultLineColor),this.opacity??(this.opacity=Ht._defaultOpacity)),this.currentPath.push([t,n]),P(this,fu,!1),O(this,Ce,qN).call(this),P(this,cl,()=>{O(this,Ce,KI).call(this),x(this,cl)&&window.requestAnimationFrame(x(this,cl))}),window.requestAnimationFrame(x(this,cl))},WN=function(t,n){const[s,i]=this.currentPath.at(-1);if(this.currentPath.length>1&&t===s&&n===i)return;const o=this.currentPath;let l=x(this,Wa);if(o.push([t,n]),P(this,fu,!0),o.length<=2){l.moveTo(...o[0]),l.lineTo(t,n);return}o.length===3&&(P(this,Wa,l=new Path2D),l.moveTo(...o[0])),O(this,Ce,JI).call(this,l,...o.at(-3),...o.at(-2),t,n)},XI=function(){if(this.currentPath.length===0)return;const t=this.currentPath.at(-1);x(this,Wa).lineTo(...t)},YI=function(t,n){P(this,cl,null),t=Math.min(Math.max(t,0),this.canvas.width),n=Math.min(Math.max(n,0),this.canvas.height),O(this,Ce,WN).call(this,t,n),O(this,Ce,XI).call(this);let s;if(this.currentPath.length!==1)s=O(this,Ce,ZI).call(this);else{const u=[t,n];s=[[u,u.slice(),u.slice(),u]]}const i=x(this,Wa),o=this.currentPath;this.currentPath=[],P(this,Wa,new Path2D);const l=()=>{this.allRawPaths.push(o),this.paths.push(s),this.bezierPath2D.push(i),this._uiManager.rebuild(this)},c=()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),this.paths.length===0?this.remove():(this.canvas||(O(this,Ce,Uy).call(this),O(this,Ce,Hy).call(this)),O(this,Ce,up).call(this))};this.addCommands({cmd:l,undo:c,mustExec:!0})},KI=function(){if(!x(this,fu))return;P(this,fu,!1);const t=Math.ceil(this.thickness*this.parentScale),n=this.currentPath.slice(-3),s=n.map(l=>l[0]),i=n.map(l=>l[1]);Math.min(...s)-t,Math.max(...s)+t,Math.min(...i)-t,Math.max(...i)+t;const{ctx:o}=this;o.save(),o.clearRect(0,0,this.canvas.width,this.canvas.height);for(const l of this.bezierPath2D)o.stroke(l);o.stroke(x(this,Wa)),o.restore()},JI=function(t,n,s,i,o,l,c){const u=(n+i)/2,d=(s+o)/2,h=(i+l)/2,f=(o+c)/2;t.bezierCurveTo(u+2*(i-u)/3,d+2*(o-d)/3,h+2*(i-h)/3,f+2*(o-f)/3,h,f)},ZI=function(){const t=this.currentPath;if(t.length<=2)return[[t[0],t[0],t.at(-1),t.at(-1)]];const n=[];let s,[i,o]=t[0];for(s=1;s<t.length-2;s++){const[p,m]=t[s],[g,v]=t[s+1],b=(p+g)/2,y=(m+v)/2,w=[i+2*(p-i)/3,o+2*(m-o)/3],_=[b+2*(p-b)/3,y+2*(m-y)/3];n.push([[i,o],w,_,[b,y]]),[i,o]=[b,y]}const[l,c]=t[s],[u,d]=t[s+1],h=[i+2*(l-i)/3,o+2*(c-o)/3],f=[u+2*(l-u)/3,d+2*(c-d)/3];return n.push([[i,o],h,f,[u,d]]),n},uc=function(){if(this.isEmpty()){O(this,Ce,zy).call(this);return}O(this,Ce,qN).call(this);const{canvas:t,ctx:n}=this;n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,t.width,t.height),O(this,Ce,zy).call(this);for(const s of this.bezierPath2D)n.stroke(s)},VN=function(){if(x(this,Hh))return;P(this,Hh,new AbortController);const t=this._uiManager.combinedSignal(x(this,Hh));this.canvas.addEventListener("pointerdown",this.canvasPointerdown.bind(this),{signal:t})},GN=function(){var t;(t=this.pointerdownAC)==null||t.abort(),this.pointerdownAC=null},XN=function(t){var n;(n=x(this,hu))==null||n.abort(),P(this,hu,null),O(this,Ce,VN).call(this),x(this,Zi)&&clearTimeout(x(this,Zi)),P(this,Zi,setTimeout(()=>{P(this,Zi,null),this.canvas.removeEventListener("contextmenu",Gs)},10)),O(this,Ce,YI).call(this,t.offsetX,t.offsetY),this.addToAnnotationStorage(),this.setInBackgroun
1158d()},Uy=function(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",this.canvas.setAttribute("data-l10n-id","pdfjs-ink-canvas"),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")},Hy=function(){P(this,Va,new ResizeObserver(t=>{const n=t[0].contentRect;n.width&&n.height&&this.setDimensions(n.width,n.height)})),x(this,Va).observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{var t;(t=x(this,Va))==null||t.disconnect(),P(this,Va,null)},{once:!0})},vd=function(){if(!x(this,pu))return;const[t,n]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*t),this.canvas.height=Math.ceil(this.height*n),O(this,Ce,zy).call(this)},YN=function(t,n){const s=O(this,Ce,qy).call(this),i=(t-s)/x(this,du),o=(n-s)/x(this,uu);this.scaleFactor=Math.min(i,o)},zy=function(){const t=O(this,Ce,qy).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+t,this.translationY*this.scaleFactor+t)},wo=new WeakSet,QI=function(t){const n=new Path2D;for(let s=0,i=t.length;s<i;s++){const[o,l,c,u]=t[s];s===0&&n.moveTo(...o),n.bezierCurveTo(l[0],l[1],c[0],c[1],u[0],u[1])}return n},KN=function(t,n,s){const[i,o,l,c]=n;switch(s){case 0:for(let u=0,d=t.length;u<d;u+=2)t[u]+=i,t[u+1]=c-t[u+1];break;case 90:for(let u=0,d=t.length;u<d;u+=2){const h=t[u];t[u]=t[u+1]+i,t[u+1]=h+o}break;case 180:for(let u=0,d=t.length;u<d;u+=2)t[u]=l-t[u],t[u+1]+=o;break;case 270:for(let u=0,d=t.length;u<d;u+=2){const h=t[u];t[u]=l-t[u+1],t[u+1]=c-h}break;default:throw new Error("Invalid rotation")}return t},eL=function(t,n,s){const[i,o,l,c]=n;switch(s){case 0:for(let u=0,d=t.length;u<d;u+=2)t[u]-=i,t[u+1]=c-t[u+1];break;case 90:for(let u=0,d=t.length;u<d;u+=2){const h=t[u];t[u]=t[u+1]-o,t[u+1]=h-i}break;case 180:for(let u=0,d=t.length;u<d;u+=2)t[u]=l-t[u],t[u+1]-=o;break;case 270:for(let u=0,d=t.length;u<d;u+=2){const h=t[u];t[u]=c-t[u+1],t[u+1]=l-h}break;default:throw new Error("Invalid rotation")}return t},tL=function(t,n,s,i){var d,h;const o=[],l=this.thickness/2,c=t*n+l,u=t*s+l;for(const f of this.paths){const p=[],m=[];for(let g=0,v=f.length;g<v;g++){const[b,y,w,_]=f[g];if(b[0]===_[0]&&b[1]===_[1]&&v===1){const U=t*b[0]+c,C=t*b[1]+u;p.push(U,C),m.push(U,C);break}const N=t*b[0]+c,S=t*b[1]+u,E=t*y[0]+c,T=t*y[1]+u,D=t*w[0]+c,R=t*w[1]+u,H=t*_[0]+c,A=t*_[1]+u;g===0&&(p.push(N,S),m.push(N,S)),p.push(E,T,D,R,H,A),m.push(E,T),g===v-1&&m.push(H,A)}o.push({bezier:O(d=Ht,wo,KN).call(d,p,i,this.rotation),points:O(h=Ht,wo,KN).call(h,m,i,this.rotation)})}return o},JN=function(){let t=1/0,n=-1/0,s=1/0,i=-1/0;for(const o of this.paths)for(const[l,c,u,d]of o){const h=Pe.bezierBoundingBox(...l,...c,...u,...d);t=Math.min(t,h[0]),s=Math.min(s,h[1]),n=Math.max(n,h[2]),i=Math.max(i,h[3])}return[t,s,n,i]},qy=function(){return x(this,As)?Math.ceil(this.thickness*this.parentScale):0},up=function(t=!1){if(this.isEmpty())return;
1158if(!x(this,As)){O(this,Ce,uc).call(this);return}const n=O(this,Ce,JN).call(this),s=O(this,Ce,qy).call(this);P(this,du,Math.max(dt.MIN_SIZE,n[2]-n[0])),P(this,uu,Math.max(dt.MIN_SIZE,n[3]-n[1]));const i=Math.ceil(s+x(this,du)*this.scaleFactor),o=Math.ceil(s+x(this,uu)*this.scaleFactor),[l,c]=this.parentDimensions;this.width=i/l,this.height=o/c,this.setAspectRatio(i,o);const u=this.translationX,d=this.translationY;this.translationX=-n[0],this.translationY=-n[1],O(this,Ce,vd).call(this),O(this,Ce,uc).call(this),P(this,mu,i),P(this,gu,o),this.setDims(i,o);const h=t?s/this.scaleFactor/2:0;this.translate(u-this.translationX-h,d-this.translationY-h)},$(Ht,wo),Re(Ht,"_defaultColor",null),Re(Ht,"_defaultOpacity",1),Re(Ht,"_defaultThickness",1),Re(Ht,"_type","ink"),Re(Ht,"_editorType",Ge.INK);let zN=Ht;var qt,Lr,ul,Ga,dl,zh,Qi,Xa,ea,ss,qh,et,dp,hp,Wy,QN,rL,Vy,eS,Gy,nL,sL;const Dp=class Dp extends dt{constructor(t){super({...t,name:"stampEditor"});$(this,et);$(this,qt,null);$(this,Lr,null);$(this,ul,null);$(this,Ga,null);$(this,dl,null);$(this,zh,"");$(this,Qi,null);$(this,Xa,null);$(this,ea,null);$(this,ss,!1);$(this,qh,!1);P(this,Ga,t.bitmapUrl),P(this,dl,t.bitmapFile)}static initialize(t,n){dt.initialize(t,n)}static get supportedTypes(){return it(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map(n=>`image/${n}`))}static get supportedTypesStr(){return it(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(t){return this.supportedTypes.includes(t)}static paste(t,n){n.pasteEditor(Ge.STAMP,{bitmapFile:t.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var t;return{type:"stamp",hasAltText:!!((t=this.altTextData)!=null&&t.altText)}}static computeTelemetryFinalData(t){const n=t.get("hasAltText");return{hasAltText:n.get(!0)??0,hasNoAltText:n.get(!1)??0}}async mlGuessAltText(t=null,n=!0){if(this.hasAltTextData())return null;const{mlManager:s}=this._uiManager;if(!s)throw new Error("No ML.");if(!await s.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:i,width:o,height:l}=t||this.copyCanvas(null,null,!0).imageData,c=await s.guess({name:"altText",request:{data:i,width:o,height:l,channels:i.length/(o*l)}});if(!c)throw new Error("No response from the AI service.");if(c.error)throw new Error("Error from the AI service.");if(c.cancel)return null;if(!c.output)throw new Error("No valid response from the AI service.");const u=c.output;return await this.setGuessedAltText(u),n&&!this.hasAltTextData()&&(this.altTextData={alt:u,decorative:!1}),u}remove(){var t,n;x(this,Lr)&&(P(this,qt,null),this._uiManager.imageManager.deleteId(x(this,Lr)),(t=x(this,Qi))==null||t.remove(),P(this,Qi,null),(n=x(this,Xa))==null||n.disconnect(),P(this,Xa,null),x(this,ea)&&(clearTimeout(x(this,ea)),P(this,ea,null))),super.remove()}rebuild(){if(!this.parent){x(this,Lr)&&O(this,et,Wy).call(this);return}super.rebuild(),this.div!==null&&(x(this,Lr)&&x(this,Qi)===null&&O(this,et,Wy).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(x(this,ul)||x(this,qt)||x(this,Ga)||x(this,dl)||x(this,Lr))}get isResizable(){return!0}render(){if(this.div)return this.div;let t,n;if(this.width&&(t=this.x,n=this.y),super.render(),this.div.hidden=!0,this.div.setAttribute("role","figure"),this.addAltTextButton(),x(this,qt)?O(this,et,QN).call(this):O(this,et,Wy).call(this),this.width&&!this.annotationElementId){const[s,i]=this.parentDimensions;this.setAt(t*s,n*i,this.width*s,this.height*i)}return this.div}copyCanvas(t,n,s=!1){var p;t||(t=224);const{width:i,height:o}=x(this,qt),l=new J_;let c=x(this,qt),u=i,d=o,h=null;if(n){if(i>n||o>n){const T=Math.min(n/i,n/o);u=Math.floor(i*T),d=Math.floor(o*T)}h=document.createElement("canvas");const m=h.width=Math.ceil(u*l.sx),g=h.height=Math.ceil(d*l.sy);x(this,ss)||(c=O(this,et,Vy).call(this,m,g));const v=h.getContext("2d");v.filter=this._uiManager.hcmFilter;let b="white",y="#cfcfd8";this._uiManager.hcmFilter!=="none"?y="black":(p=window.matchMedia)!=null&&p.call(window,"(prefers-color-scheme: dark)").matches&&(b="#8f8f9d",y="#42414d");const w=15,_=w*l.sx,N=w*l.sy,S=new OffscreenCanvas(_*2,N*2),E=S.getContext("2d");E.fillStyle=b,E.fillRect(0,0,_*2,N*2),E.fillStyle=y,E.fillRect(0,0,_,N),E.fillRect(_,N,_,N),v.fillStyle=v.createPattern(S,"repeat"),v.fillRect(0,0,m,g),v.drawImage(c,0,0,c.width,c.height,0,0,m,g)}let f=null;if(s){let m,g;if(l.symmetric&&c.width<t&&c.height<t)m=c.width,g=c.height;else if(c=x(this,qt),i>t||o>t){const y=Math.min(t/i,t/o);m=Math.floor(i*y),g=Math.floor(o*y),x(this,ss)||(c=O(this,et,Vy).call(this,m,g))}const b=new OffscreenCanvas(m,g).getContext("2d",{willReadFrequently:!0});b.drawImage(c,0,0,c.width,c.height,0,0,m,g),f={width:m,height:g,data:b.getImageData(0,0,m,g).data}}return{canvas:h,width:u,height:d,imageData:f}}getImageForAltText(){return x(this,Qi)}static async deserialize(t,n,s){var g;let i=null;if(t instanceof vI){const{data:{rect:v,rotation:b,id:y,structParent:w,popupRef:_},container:N,parent:{page:{pageNumber:S}}}=t,E=N.querySelector("canvas"),T=s.imageManager.getFromCanvas(N.id,E);E.remove();const D=((g=await n._structTree.getAriaAttributes(`${Mk}${y}`))==null?void 0:g.get("aria-label"))||"";i=t={annotationType:Ge.STAMP,bitmapId:T.id,bitmap:T.bitmap,pageIndex:S-1,rect:v.slice(0),rotation:b,id:y,deleted:!1,accessibilityData:{decorative:!1,altText:D},isSvg:!1,structParent:w,popupRef:_}}const o=await super.deserialize(t,n,s),{rect:l,bitmap:c,bitmapUrl:u,bitmapId:d,isSvg:h,accessibilityData:f}=t;d&&s.imageManager.isValidId(d)?(P(o,Lr,d),c&&P(o,qt,c)):P(o,Ga,u),P(o,ss,h);const[p,m]=o.pageDimensions;return o.width=(l[2]-l[0])/p,o.height=(l[3]-l[1])/m,o.annotationElementId=t.id||null,f&&(o.altTextData=f),o._initialData=i,P(o,qh,!!i),o}serialize(t=!1,n=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const s={annotationType:Ge.STAMP,bitmapId:x(this,Lr),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:x(this,ss),structTreeParentId:this._structTreeParentId};if(t)return s.bitmapUrl=O(this,et,Gy).call(this,!0),s.accessibilityData=this.serializeAltText(!0),s;const{decorative:i,altText:o}=this.serializeAltText(!1);if(!i&&o&&(s.accessibilityData={type:"Figure",alt:o}),this.annotationElementId){const c=O(this,et,sL).call(this,s);if(c.isSame)return null;c.isSameAltText?delete s.accessibilityData:s.accessibilityData.structParent=this._initialData.structParent??-1}if(s.id=this.annotationElementId,n===null)return s;n.stamps||(n.stamps=new Map);const l=x(this,ss)?(s.rect[2]-s.rect[0])*(s.rect[3]-s.rect[1]):null;if(!n.stamps.has(x(this,Lr)))n.stamps.set(x(this,Lr),{area:l,serialized:s}),s.bitmap=O(this,et,Gy).call(this,!1);else if(x(this,ss)){const c=n.stamps.get(x(this,Lr));l>c.area&&(c.area=l,c.serialized.bitmap.close(),c.serialized.bitmap=O(this,et,Gy).call(this,!1))}return s}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}};qt=new WeakMap,Lr=new WeakMap,ul=new WeakMap,Ga=new WeakMap,dl=new WeakMap,zh=new WeakMap,Qi=new WeakMap,Xa=new WeakMap,ea=new WeakMap,ss=new WeakMap,qh=new WeakMap,et=new WeakSet,dp=function(t,n=!1){if(!t){this.remove();return}P(this,qt,t.bitmap),n||(P(this,Lr,t.id),P(this,ss,t.isSvg)),t.file&&P(this,zh,t.file.name),O(this,et,QN).call(this)},hp=function(){if(P(this,ul,null),this._uiManager.enableWaiting(!1),!!x(this,Qi)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&x(this,qt)){this._editToolbar.hide(),this._uiManager.editAltText(this,!0);return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&x(this,qt)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},Wy=function(){if(x(this,Lr)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(x(this,Lr)).then(s=>
1158O(this,et,dp).call(this,s,!0)).finally(()=>O(this,et,hp).call(this));return}if(x(this,Ga)){const s=x(this,Ga);P(this,Ga,null),this._uiManager.enableWaiting(!0),P(this,ul,this._uiManager.imageManager.getFromUrl(s).then(i=>O(this,et,dp).call(this,i)).finally(()=>O(this,et,hp).call(this)));return}if(x(this,dl)){const s=x(this,dl);P(this,dl,null),this._uiManager.enableWaiting(!0),P(this,ul,this._uiManager.imageManager.getFromFile(s).then(i=>O(this,et,dp).call(this,i)).finally(()=>O(this,et,hp).call(this)));return}const t=document.createElement("input");t.type="file",t.accept=Dp.supportedTypesStr;const n=this._uiManager._signal;P(this,ul,new Promise(s=>{t.addEventListener("change",async()=>{if(!t.files||t.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const i=await this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),O(this,et,dp).call(this,i)}s()},{signal:n}),t.addEventListener("cancel",()=>{this.remove(),s()},{signal:n})}).finally(()=>O(this,et,hp).call(this))),t.click()},QN=function(){const{div:t}=this;let{width:n,height:s}=x(this,qt);const[i,o]=this.pageDimensions,l=.75;if(this.width)n=this.width*i,s=this.height*o;else if(n>l*i||s>l*o){const h=Math.min(l*i/n,l*o/s);n*=h,s*=h}const[c,u]=this.parentDimensions;this.setDims(n*c/i,s*u/o),this._uiManager.enableWaiting(!1);const d=P(this,Qi,document.createElement("canvas"));d.setAttribute("role","img"),this.addContainer(d),(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(t.hidden=!1),O(this,et,eS).call(this,n,s),O(this,et,nL).call(this),x(this,qh)||(this.parent.addUndoableEditor(this),P(this,qh,!0)),this._reportTelemetry({action:"inserted_image"}),x(this,zh)&&d.setAttribute("aria-label",x(this,zh))},rL=function(t,n){var l;const[s,i]=this.parentDimensions;this.width=t/s,this.height=n/i,(l=this._initialOptions)!=null&&l.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,x(this,ea)!==null&&clearTimeout(x(this,ea)),P(this,ea,setTimeout(()=>{P(this,ea,null),O(this,et,eS).call(this,t,n)},200))},Vy=function(t,n){const{width:s,height:i}=x(this,qt);let o=s,l=i,c=x(this,qt);for(;o>2*t||l>2*n;){const u=o,d=l;o>2*t&&(o=o>=16384?Math.floor(o/2)-1:Math.ceil(o/2)),l>2*n&&(l=l>=16384?Math.floor(l/2)-1:Math.ceil(l/2));const h=new OffscreenCanvas(o,l);h.getContext("2d").drawImage(c,0,0,u,d,0,0,o,l),c=h.transferToImageBitmap()}return c},eS=function(t,n){const s=new J_,i=Math.ceil(t*s.sx),o=Math.ceil(n*s.sy),l=x(this,Qi);if(!l||l.width===i&&l.height===o)return;l.width=i,l.height=o;const c=x(this,ss)?x(this,qt):O(this,et,Vy).call(this,i,o),u=l.getContext("2d");u.filter=this._uiManager.hcmFilter,u.drawImage(c,0,0,c.width,c.height,0,0,i,o)},Gy=function(t){if(t){if(x(this,ss)){const i=this._uiManager.imageManager.getSvgUrl(x(this,Lr));if(i)return i}const n=document.createElement("canvas");return{width:n.width,height:n.height}=x(this,qt),n.getContext("2d").drawImage(x(this,qt),0,0),n.toDataURL()}if(x(this,ss)){const[n,s]=this.pageDimensions,i=Math.round(this.width*n*Il.PDF_TO_CSS_UNITS),o=Math.round(this.height*s*Il.PDF_TO_CSS_UNITS),l=new OffscreenCanvas(i,o);return l.getContext("2d").drawImage(x(this,qt),0,0,x(this,qt).width,x(this,qt).height,0,0,i,o),l.transferToImageBitmap()}return structuredClone(x(this,qt))},nL=function(){this._uiManager._signal&&(P(this,Xa,new ResizeObserver(t=>{const n=t[0].contentRect;n.width&&n.height&&O(this,et,rL).call(this,n.width,n.height)})),x(this,Xa).observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{var t;(t=x(this,Xa))==null||t.disconnect(),P(this,Xa,null)},{once:!0}))},sL=function(t){var u;const{rect:n,pageIndex:s,accessibilityData:{altText:i}}=this._initialData,o=t.rect.every((d,h)=>Math.abs(d-n[h])<1),l=t.pageIndex===s,c=(((u=t.accessibilityData)==null?void 0:u.alt)||"")===i;return{isSame:o&&l&&c,isSameAltText:c}},Re(Dp,"_type","stamp"),Re(Dp,"_editorType",Ge.STAMP);let ZN=Dp;var yu,Wh,ta,hl,Ya,is,fl,Vh,Gh,nn,Ka,Ie,pl,$r,iL,rS,nS,sS,Xy;const ti=class ti{constructor({uiManager:e,pageIndex:t,div:n,structTreeLayer:s,accessibilityManager:i,annotationLayer:o,drawLayer:l,textLayer:c,viewport:u,l10n:d}){$(this,$r);$(this,yu);$(this,Wh,!1);$(this,ta,null);$(this,hl,null);$(this,Ya,null);$(this,is,new Map);$(this,fl,!1);$(this,Vh,!1);$(this,Gh,!1);$(this,nn,null);$(this,Ka,null);$(this,Ie);const h=[...x(ti,pl).values()];if(!ti._initialized){ti._initialized=!0;for(const f of h)f.initialize(d,e)}
1158e.registerEditorTypes(h),P(this,Ie,e),this.pageIndex=t,this.div=n,P(this,yu,i),P(this,ta,o),this.viewport=u,P(this,nn,c),this.drawLayer=l,this._structTree=s,x(this,Ie).addLayer(this)}get isEmpty(){return x(this,is).size===0}get isInvisible(){return this.isEmpty&&x(this,Ie).getMode()===Ge.NONE}updateToolbar(e){x(this,Ie).updateToolbar(e)}updateMode(e=x(this,Ie).getMode()){switch(O(this,$r,Xy).call(this),e){case Ge.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case Ge.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case Ge.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:t}=this.div;for(const n of x(ti,pl).values())t.toggle(`${n._type}Editing`,e===n._editorType);this.div.hidden=!1}hasTextLayer(e){var t;return e===((t=x(this,nn))==null?void 0:t.div)}addInkEditorIfNeeded(e){if(x(this,Ie).getMode()!==Ge.INK)return;if(!e){for(const n of x(this,is).values())if(n.isEmpty()){n.setInBackground();return}}this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}setEditingState(e){x(this,Ie).setEditingState(e)}addCommands(e){x(this,Ie).addCommands(e)}toggleDrawing(e=!1){this.div.classList.toggle("drawing",!e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(e=!1){var t;(t=x(this,ta))==null||t.div.classList.toggle("disabled",!e)}async enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);const e=new Set;for(const n of x(this,is).values())n.enableEditing(),n.show(!0),n.annotationElementId&&(x(this,Ie).removeChangedExistingAnnotation(n),e.add(n.annotationElementId));if(!x(this,ta))return;const t=x(this,ta).getEditableAnnotations();for(const n of t){if(n.hide(),x(this,Ie).isDeletedAnnotationElement(n.data.id)||e.has(n.data.id))continue;const s=await this.deserialize(n);s&&(this.addOrRebuild(s),s.enableEditing())}}disable(){var s;P(this,Gh,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1);const e=new Map,t=new Map;for(const i of x(this,is).values())if(i.disableEditing(),!!i.annotationElementId){if(i.serialize()!==null){e.set(i.annotationElementId,i);continue}else t.set(i.annotationElementId,i);(s=this.getEditableAnnotation(i.annotationElementId))==null||s.show(),i.remove()}if(x(this,ta)){const i=x(this,ta).getEditableAnnotations();for(const o of i){const{id:l}=o.data;if(x(this,Ie).isDeletedAnnotationElement(l))continue;let c=t.get(l);if(c){c.resetAnnotationElement(o),c.show(!1),o.show();continue}
1158c=e.get(l),c&&(x(this,Ie).addChangedExistingAnnotation(c),c.renderAnnotationElement(o)&&c.show(!1)),o.show()}}O(this,$r,Xy).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:n}=this.div;for(const i of x(ti,pl).values())n.remove(`${i._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),P(this,Gh,!1)}getEditableAnnotation(e){var t;return((t=x(this,ta))==null?void 0:t.getEditableAnnotation(e))||null}setActiveEditor(e){x(this,Ie).getActive()!==e&&x(this,Ie).setActiveEditor(e)}enableTextSelection(){var e;if(this.div.tabIndex=-1,(e=x(this,nn))!=null&&e.div&&!x(this,Ka)){P(this,Ka,new AbortController);const t=x(this,Ie).combinedSignal(x(this,Ka));x(this,nn).div.addEventListener("pointerdown",O(this,$r,iL).bind(this),{signal:t}),x(this,nn).div.classList.add("highlighting")}}disableTextSelection(){var e;this.div.tabIndex=0,(e=x(this,nn))!=null&&e.div&&x(this,Ka)&&(x(this,Ka).abort(),P(this,Ka,null),x(this,nn).div.classList.remove("highlighting"))}enableClick(){if(x(this,hl))return;P(this,hl,new AbortController);const e=x(this,Ie).combinedSignal(x(this,hl));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:e}),this.div.addEventListener("pointerup",this.pointerup.bind(this),{signal:e})}disableClick(){var e;(e=x(this,hl))==null||e.abort(),P(this,hl,null)}attach(e){x(this,is).set(e.id,e);const{annotationElementId:t}=e;t&&x(this,Ie).isDeletedAnnotationElement(t)&&x(this,Ie).removeDeletedAnnotationElement(e)}detach(e){var t;x(this,is).delete(e.id),(t=x(this,yu))==null||t.removePointerInTextLayer(e.contentDiv),!x(this,Gh)&&e.annotationElementId&&x(this,Ie).addDeletedAnnotationElement(e)}remove(e){this.detach(e),x(this,Ie).removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1,x(this,Vh)||this.addInkEditorIfNeeded(!1)}changeParent(e){var t;e.parent!==this&&(e.parent&&e.annotationElementId&&(x(this,Ie).addDeletedAnnotationElement(e.annotationElementId),dt.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),(t=e.parent)==null||t.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(!(e.parent===this&&e.isAttachedToDOM)){if(this.changeParent(e),x(this,Ie).addEditor(e),this.attach(e),!e.isAttachedToDOM){const t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(),x(this,Ie).addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){var n;if(!e.isAttachedToDOM)return;const{activeElement:t}=document;e.div.contains(t)&&!x(this,Ya)&&(e._focusEventsAllowed=!1,P(this,Ya,setTimeout(()=>{P(this,Ya,null),e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:x(this,Ie)._signal}),t.focus())},0))),e._structTreeParentId=(n=x(this,yu))==null?void 0:n.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||(e.parent=this),e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){const t=()=>e._uiManager.rebuild(e),n=()=>{e.remove()};this.addCommands({cmd:t,undo:n,mustExec:!1})}getNextId(){return x(this,Ie).getId()}combinedSignal(e){return x(this,Ie).combinedSignal(e)}canCreateNewEmptyEditor(){var e;return(e=x(this,$r,rS))==null?void 0:e.canCreateNewEmptyEditor()}pasteEditor(e,t){x(this,Ie).updateToolbar(e),x(this,Ie).updateMode(e);const{offsetX:n,offsetY:s}=O(this,$r,sS).call(this),i=this.getNextId(),o=O(this,$r,nS).call(this,{parent:this,id:i,x:n,y:s,uiManager:x(this,Ie),isCentered:!0,...t});o&&this.add(o)}async deserialize(e){var t;return await((t=x(ti,pl).get(e.annotationType??e.annotationEditorType))==null?void 0:t.deserialize(e,this,x(this,Ie)))||null}createAndAddNewEditor(e,t,n={}){const s=this.getNextId(),i=O(this,$r,nS).call(this,{parent:this,id:s,x:e.offsetX,y:e.offsetY,uiManager:x(this,Ie),isCentered:t,...n});return i&&this.add(i),i}addNewEditor(){this.createAndAddNewEditor(O(this,$r,sS).call(this),!0)}setSelected(e){x(this,Ie).setSelected(e)}toggleSelected(e){x(this,Ie).toggleSelected(e)}isSelected(e){return x(this,Ie).isSelected(e)}unselect(e){x(this,Ie).unselect(e)}pointerup(e){const{isMac:t}=zn.platform;if(!(e.button!==0||e.ctrlKey&&t)&&e.target===this.div&&x(this,fl)){if(P(this,fl,!1),!x(this,Wh)){P(this,Wh,!0);return}if(x(this,Ie).getMode()===Ge.STAMP){x(this,Ie).unselectAll();return}this.createAndAddNewEditor(e,!1)}}pointerdown(e){if(x(this,Ie).getMode()===Ge.HIGHLIGHT&&this.enableTextSelection(),x(this,fl)){P(this,fl,!1);return}const{isMac:t}=zn.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div)return;P(this,fl,!0);const n=x(this,Ie).getActive();P(this,Wh,!n||n.isEmpty())}findNewParent(e,t,n){const s=x(this,Ie).findParent(t,n);return s===null||s===this?!1:(s.changeParent(e),!0)}destroy(){var e,t;((e=x(this,Ie).getActive())==null?void 0:e.parent)===this&&(x(this,Ie).commitOrRemove(),x(this,Ie).setActiveEditor(null)),x(this,Ya)&&(clearTimeout(x(this,Ya)),P(this,Ya,null));for(const n of x(this,is).values())(t=x(this,yu))==null||t.removePointerInTextLayer(n.contentDiv),n.setParent(null),n.isAttachedToDOM=!1,n.div.remove();this.div=null,x(this,is).clear(),x(this,Ie).removeLayer(this)}render({viewport:e}){this.viewport=e,Iu(this.div,e);for(const t of x(this,Ie).getEditors(this.pageIndex))this.add(t),t.rebuild();this.updateMode()}update({viewport:e}){x(this,Ie).commitOrRemove(),O(this,$r,Xy).call(this);const t=this.viewport.rotation,n=e.rotation;if(this.viewport=e,Iu(this.div,{rotation:n}),t!==n)for(const s of x(this,is).values())s.rotate(n);this.addInkEditorIfNeeded(!1)}get pageDimensions(){const{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}get scale(){return x(this,Ie).viewParameters.realScale}};yu=new WeakMap,Wh=new WeakMap,ta=new WeakMap,hl=new WeakMap,Ya=new WeakMap,is=new WeakMap,fl=new WeakMap,Vh=new WeakMap,Gh=new WeakMap,nn=new WeakMap,Ka=new WeakMap,Ie=new WeakMap,pl=new WeakMap,$r=new WeakSet,iL=function(e){x(this,Ie).unselectAll();const{target:t}=e;if(t===x(this,nn).div||(t.getAttribute("role")==="img"||t.classList.contains("endOfContent"))&&x(this,nn).div.contains(t)){const{isMac:n}=zn.platform;if(e.button!==0||e.ctrlKey&&n)return;x(this,Ie).showAllEditors("highlight",!0,!0),x(this,nn).div.classList.add("free"),this.toggleDrawing(),Ub.startHighlighting(this,x(this,Ie).direction==="ltr",{target:x(this,nn).div,x:e.x,y:e.y}),x(this,nn).div.addEventListener("pointerup",()=>{x(this,nn).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:x(this,Ie)._signal}),e.preventDefault()}},rS=function(){return x(ti,pl).get(x(this,Ie).getMode())},nS=function(e){const t=x(this,$r,rS);return t?new t.prototype.constructor(e):null},sS=function(){const{x:e,y:t,width:n,height:s}=this.div.getBoundingClientRect(),i=Math.max(0,e),o=Math.max(0,t),l=
1158Math.min(window.innerWidth,e+n),c=Math.min(window.innerHeight,t+s),u=(i+l)/2-e,d=(o+c)/2-t,[h,f]=this.viewport.rotation%180===0?[u,d]:[d,u];return{offsetX:h,offsetY:f}},Xy=function(){P(this,Vh,!0);for(const e of x(this,is).values())e.isEmpty()&&e.remove();P(this,Vh,!1)},Re(ti,"_initialized",!1),$(ti,pl,new Map([IN,zN,ZN,Ub].map(e=>[e._editorType,e])));let tS=ti;var ra,Ag,rr,ml,Tg,aS,Hu,oS,aL;const Rr=class Rr{constructor({pageIndex:e}){$(this,Hu);$(this,ra,null);$(this,Ag,0);$(this,rr,new Map);$(this,ml,new Map);this.pageIndex=e}setParent(e){if(!x(this,ra)){P(this,ra,e);return}if(x(this,ra)!==e){if(x(this,rr).size>0)for(const t of x(this,rr).values())t.remove(),e.append(t);P(this,ra,e)}}static get _svgFactory(){return it(this,"_svgFactory",new Fk)}highlight(e,t,n,s=!1){const i=fn(this,Ag)._++,o=O(this,Hu,oS).call(this,e.box);o.classList.add("highlight"),e.free&&o.classList.add("free");const l=Rr._svgFactory.createElement("defs");o.append(l);const c=Rr._svgFactory.createElement("path");l.append(c);const u=`path_p${this.pageIndex}_${i}`;c.setAttribute("id",u),c.setAttribute("d",e.toSVGPath()),s&&x(this,ml).set(i,c);const d=O(this,Hu,aL).call(this,l,u),h=Rr._svgFactory.createElement("use");return o.append(h),o.setAttribute("fill",t),o.setAttribute("fill-opacity",n),h.setAttribute("href",`#${u}`),x(this,rr).set(i,o),{id:i,clipPathId:`url(#${d})`}}highlightOutline(e){const t=fn(this,Ag)._++,n=O(this,Hu,oS).call(this,e.box);n.classList.add("highlightOutline");const s=Rr._svgFactory.createElement("defs");n.append(s);const i=Rr._svgFactory.createElement("path");s.append(i);const o=`path_p${this.pageIndex}_${t}`;i.setAttribute("id",o),i.setAttribute("d",e.toSVGPath()),i.setAttribute("vector-effect","non-scaling-stroke");let l;if(e.free){n.classList.add("free");const d=Rr._svgFactory.createElement("mask");s.append(d),l=`mask_p${this.pageIndex}_${t}`,d.setAttribute("id",l),d.setAttribute("maskUnits","objectBoundingBox");const h=Rr._svgFactory.createElement("rect");d.append(h),h.setAttribute("width","1"),h.setAttribute("height","1"),h.setAttribute("fill","white");const f=Rr._svgFactory.createElement("use");d.append(f),f.setAttribute("href",`#${o}`),f.setAttribute("stroke","none"),f.setAttribute("fill","black"),f.setAttribute("fill-rule","nonzero"),f.classList.add("mask")}const c=Rr._svgFactory.createElement("use");n.append(c),c.setAttribute("href",`#${o}`),l&&c.setAttribute("mask",`url(#${l})`);const u=c.cloneNode();return n.append(u),c.classList.add("mainOutline"),u.classList.add("secondaryOutline"),x(this,rr).set(t,n),t}finalizeLine(e,t){const n=x(this,ml).get(e);x(this,ml).delete(e),this.updateBox(e,t.box),n.setAttribute("d",t.toSVGPath())}updateLine(e,t){x(this,rr).get(e).firstChild.firstChild.setAttribute("d",t.toSVGPath())}removeFreeHighlight(e){this.remove(e),x(this,ml).delete(e)}updatePath(e,t){x(this,ml).get(e).setAttribute("d",t.toSVGPath())}updateBox(e,t){var n;O(n=Rr,Tg,aS).call(n,x(this,rr).get(e),t)}show(e,t){x(this,rr).get(e).classList.toggle("hidden",!t)}rotate(e,t){x(this,rr).get(e).setAttribute("data-main-rotation",t)}changeColor(e,t){x(this,rr).get(e).setAttribute("fill",t)}changeOpacity(e,t){x(this,rr).get(e).setAttribute("fill-opacity",t)}addClass(e,t){x(this,rr).get(e).classList.add(t)}removeClass(e,t){x(this,rr).get(e).classList.remove(t)}getSVGRoot(e){return x(this,rr).get(e)}remove(e){x(this,ra)!==null&&(x(this,rr).get(e).remove(),x(this,rr).delete(e))}destroy(){P(this,ra,null);for(const e of x(this,rr).values())e.remove();x(this,rr).clear()}};ra=new WeakMap,Ag=new WeakMap,rr=new WeakMap,ml=new WeakMap,Tg=new WeakSet,aS=function(e,{x:t=0,y:n=0,width:s=1,height:i=1}={}){const{style:o}=e;o.top=`${100*n}%`,o.left=`${100*t}%`,o.width=`${100*s}%`,o.height=`${100*i}%`},Hu=new WeakSet,oS=function(e){var n;const t=Rr._svgFactory.create(1,1,!0);return x(this,ra).append(t),t.setAttribute("aria-hidden",!0),O(n=Rr,Tg,aS).call(n,t,e),t},aL=function(e,t){const n=Rr._svgFactory.createElement("clipPath");e.append(n);const s=`clip_${t}`;n.setAttribute("id",s),n.setAttribute("clipPathUnits","objectBoundingBox");const i=Rr._svgFactory.createElement("use");return n.append(i),i.setAttribute("href",`#${t}`),i.classList.add("clip"),s},$(Rr,Tg);let iS=Rr;He.AbortException;He.AnnotationEditorLayer;He.AnnotationEditorParamsType;He.AnnotationEditorType;He.AnnotationEditorUIManager;He.AnnotationLayer;He.AnnotationMode;He.CMapCompressionType;He.ColorPicker;He.DOMSVGFactory;He.DrawLayer;He.FeatureTest;var hG=He.GlobalWorkerOptions;He.ImageKind;He.InvalidPDFException;He.MissingPDFException;He.OPS;He.OutputScale;He.PDFDataRangeTransport;He.PDFDateString;He.PDFWorker;He.PasswordResponses;He.PermissionFlag;He.PixelsPerInch;He.RenderingCancelledException;He.TextLayer;He.UnexpectedResponseException;He.Util;He.VerbosityLevel;He.XfaLayer;He.build;He.createValidAbsoluteUrl;He.fetchData;var fG=He.getDocument;He.getFilenameFromUrl;He.getPdfFilenameFromUrl;He.getXfaPageViewport;He.isDataScheme;He.isPdfFile;He.noContextMenu;He.normalizeUnicode;He.setLayerDimensions;He.shadow;He.version;const pG="/assets/pdf.worker.min-BZ_6UHJF.mjs";hG.workerSrc=pG;async function oL(r,e=400,t=.7){try{const n=await r.arrayBuffer(),s=await fG({data:n}).promise,i=await s.getPage(1),o=i.getViewport({scale:1}),l=Math.min(e/o.width,2),c=i.getViewport({scale:l}),u=document.createElement("canvas"),d=u.getContext("2d");if(!d)return null;u.width=Math.floor(c.width),u.height=Math.floor(c.height),await i.render({canvasContext:d,viewport:c}).promise;const h=await new Promise(f=>{u.toBlob(f,"image/jpeg",t)});return s.destroy(),h}catch{return null}}async function lL(r,e=400,t=.7){try{const n=await fetch(r);if(!n.ok)return null;const s=await n.blob();return oL(s,e,t)}catch{return null}}const mG=25*1024*1024;function gG(){const[r,e]=k.useState([]),[t,n]=k.useState(!0),[s,i]=k.useState(!1),[o,l]=k.useState(""),[c,u]=k.useState(""),[d,h]=k.useState(""),[f,p]=k.useState(!1),m=k.useRef(null);k.useEffect(()=>{g()},[]);const g=async()=>
1158{if(!je||!Y){n(!1);return}try{const{data:w}=await Y.from("digital_paper_archive").select("*").order("edition_date",{ascending:!1}).order("archived_at",{ascending:!1});e(w??[])}finally{n(!1)}},v=async w=>{if(l(""),u(""),w.type!=="application/pdf"){l("Only PDF files are accepted.");return}if(w.size>mG){l(`File is too large (${(w.size/1024/1024).toFixed(1)} MB). Maximum size is 25 MB.`);return}if(!Y){l("Not configured.");return}const{data:_}=await Y.auth.getSession();if(!_.session){l("Your session has expired. Please sign out and sign back in.");return}i(!0);try{const N=d||new Date().toISOString().slice(0,10),S=`archive/${N}-${Date.now()}.pdf`,{error:E}=await Y.storage.from("digital-paper").upload(S,w,{contentType:"application/pdf"});if(E)throw new Error(E.message);const{data:T}=Y.storage.from("digital-paper").getPublicUrl(S),D=`${T.publicUrl}?t=${Date.now()}`;let R=null;const H=await oL(w);if(H){const U=`archive/thumbnails/${N}-${Date.now()}.jpg`,{error:C}=await Y.storage.from("digital-paper").upload(U,H,{contentType:"image/jpeg"});if(!C){const{data:M}=Y.storage.from("digital-paper").getPublicUrl(U);R=`${M.publicUrl}?t=${Date.now()}`}}const{error:A}=await Y.from("digital_paper_archive").insert({pdf_url:D,file_name:w.name,edition_date:d||null,archived_at:new Date().toISOString(),thumbnail_url:R});if(A)throw new Error(A.message);u(`"${w.name}" added to past editions${d?` for ${d}`:""}.`),h(""),await g()}catch(N){l(N instanceof Error?N.message:"Upload failed.")}finally{i(!1),m.current&&(m.current.value="")}},b=async w=>{var T;if(!Y||!confirm(`Delete "${w.file_name??"this edition"}" from the archive?`))return;l(""),u("");const _=w.pdf_url.replace(/^.*\/digital-paper\//,"").split("?")[0],N=(T=w.thumbnail_url)==null?void 0:T.replace(/^.*\/digital-paper\//,"").split("?")[0],S=[_,N].filter(D=>!!D&&D.startsWith("archive/"));S.length&&await Y.storage.from("digital-paper").remove(S);const{error:E}=await Y.from("digital_paper_archive").delete().eq("id",w.id);E?l(E.message):u("Edition removed from archive."),await g()},y=w=>w?new Date(w+"T00:00:00").toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}):"—";return t?a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx(_e,{className:"w-8 h-8 animate-spin text-brand-red"})}):a.jsxs("div",{className:"max-w-3xl",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("h2",{className:"font-headline font-bold text-brand-black text-xl",children:"Past Editions"}),a.jsx("button",{onClick:g,className:"text-gray-400 hover:text-gray-600 transition-colors",title:"Refresh",children:a.jsx(Ru,{className:"w-4 h-4"})})]}),a.jsx("p",{className:"font-body text-sm text-gray-500 mb-6",children:"Upload past digital paper editions so subscribers can browse them in the Subscriber Extras page."}),a.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm overflow-hidden mb-6",children:[a.jsx("div",{className:"px-5 py-4 border-b border-gray-100",children:a.jsx("span",{className:"text-sm font-semibold text-brand-black",children:"Add Past Edition"})}),a.jsxs("div",{className:"px-5 py-5 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Edition Date (optional)"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ha,{className:"w-4 h-4 text-gray-400"}),a.jsx("input",{type:"date",value:d,onChange:w=>h(w.target.value),className:"border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:border-brand-red font-body"})]}),a.jsx("p",{className:"text-xs text-gray-400 mt-1 font-body",children:"Set the publication date so editions sort correctly. If left blank, today's date is used."})]}),a.jsx("input",{ref:m,type:"file",accept:"application/pdf",onChange:w=>{var N;const _=(N=w.target.files)==null?void 0:N[0];_&&v(_)},className:"hidden"}),s?a.jsxs("div",{className:"flex flex-col items-center justify-center py-10 border-2 border-dashed border-gray-200 rounded-xl gap-2",children:[a.jsx(_e,{className:"w-6 h-6 animate-spin text-brand-red"}),a.jsx("span",{className:"font-body text-sm text-gray-500",children:"Uploading & generating thumbnail…"})]}):a.jsxs("div",{onDrop:w=>{var N;w.preventDefault(),p(!1);const _=(N=w.dataTransfer.files)==null?void 0:N[0];_&&v(_)},onDragOver:w=>{w.preventDefault(),p(!0)},onDragLeave:()=>p(!1),onClick:()=>{var w;return(w=m.current)==null?void 0:w.click()},className:`w-full flex flex-col items-center justify-center gap-3 border-2 border-dashed rounded-xl py-10 cursor-pointer transition-colors ${f?"border-brand-red bg-red-50":"border-gray-300 hover:border-brand-red hover:bg-gray-50"}`,children:[a.jsx("div",{className:"w-12 h-12 rounded-full bg-brand-red/10 flex items-center justify-center",children:a.jsx(Fn,{className:"w-6 h-6 text-brand-red"})}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"font-body text-sm font-semibold text-gray-700",children:f?"Drop PDF here":"Drag & drop or click to upload a past edition PDF"}),a.jsx("p",{className:"font-body text-xs text-gray-400 mt-0.5",children:"PDF only · max 25 MB · front-page thumbnail auto-generated"})]})]}),o&&a.jsxs("div",{className:"flex items-start gap-2 text-red-600 bg-red-50 border border-red-100 rounded-lg px-4 py-3",children:[a.jsx(Ve,{className:"w-4 h-4 flex-shrink-0 mt-0.5"}),a.jsx("p",{className:"font-body text-sm",children:o})]}),c&&a.jsxs("div",{className:"flex items-start gap-2 text-green-700 bg-green-50 border border-green-100 rounded-lg px-4 py-3",children:[a.jsx(At,{className:"w-4 h-4 flex-shrink-0 mt-0.5"}),a.jsx("p",{className:"font-body text-sm",children:c})]})]})]}),r.length===0?a.jsxs("div",{className:"text-center py-12 text-gray-400",children:[a.jsx(Vs,{className:"w-10 h-10 mx-auto mb-3 text-gray-300"}),a.jsx("p",{className:"font-body text-sm",children:"No past editions yet. Upload a PDF above to add one."})]}):a.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm overflow-hidden",children:[a.jsx("div",{className:"px-5 py-3 border-b border-gray-100",children:a.jsxs("span",{className:"text-sm font-semibold text-brand-black",children:["Archive (",r.length,")"]})}),a.jsx("div",{className:"divide-y divide-gray-100",children:r.map(w=>a.jsx(yG,{item:w,formatDate:y,onDelete:b},w.id))})]})]})}function yG({item:r,formatDate:e,onDelete:t}){const[n,s]=k.useState(""),[i,o]=k.useState(r.thumbnail_url),[l,c]=k.useState(!1);return k.useEffect(()=>{let u=!1;return(async()=>{const d=await Zp(r.pdf_url);u||s(d??"")})(),()=>{u=!0}},[r.pdf_url]),k.useEffect(()=>
1158{if(r.thumbnail_url||i||!n)return;let u=!1;return c(!0),(async()=>{const d=await lL(n);if(u||!d){c(!1);return}const h=URL.createObjectURL(d);u||(o(h),c(!1)),r.pdf_url.replace(/^.*\/digital-paper\//,"").split("?")[0];const p=`archive/thumbnails/${r.edition_date||new Date().toISOString().slice(0,10)}-${Date.now()}.jpg`,{error:m}=await Y.storage.from("digital-paper").upload(p,d,{contentType:"image/jpeg"});if(!m){const{data:g}=Y.storage.from("digital-paper").getPublicUrl(p),v=`${g.publicUrl}?t=${Date.now()}`;await Y.from("digital_paper_archive").update({thumbnail_url:v}).eq("id",r.id)}})(),()=>{u=!0}},[r.thumbnail_url,r.pdf_url,r.id,r.edition_date,n,i]),a.jsx("div",{className:"px-5 py-4 hover:bg-gray-50 transition-colors",children:a.jsxs("div",{className:"flex items-start gap-3",children:[i?a.jsx("img",{src:i,alt:r.file_name??"Edition thumbnail",className:"w-14 h-18 object-cover rounded border border-gray-200 flex-shrink-0 shadow-sm",style:{aspectRatio:"3 / 4"}}):l?a.jsx("div",{className:"w-10 h-10 rounded-lg bg-gray-100 flex items-center justify-center flex-shrink-0",children:a.jsx(_e,{className:"w-5 h-5 text-gray-400 animate-spin"})}):a.jsx("div",{className:"w-10 h-10 rounded-lg bg-brand-red/10 flex items-center justify-center flex-shrink-0",children:a.jsx(Bt,{className:"w-5 h-5 text-brand-red"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-body text-sm font-medium text-brand-black truncate",children:r.file_name??"Untitled edition"}),a.jsxs("div",{className:"flex items-center gap-2 mt-0.5 flex-wrap",children:[r.edition_date&&a.jsxs("span",{className:"font-body text-xs text-gray-400 flex items-center gap-1",children:[a.jsx(ha,{className:"w-3 h-3"}),e(r.edition_date)]}),a.jsxs("span",{className:"font-body text-xs text-gray-300",children:["Added ",e(r.archived_at)]})]})]}),a.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[a.jsx("a",{href:n||"#",target:"_blank",rel:"noopener noreferrer",className:"font-body text-xs text-brand-red hover:text-brand-red-dark font-medium px-2 py-1 hover:bg-red-50 rounded transition-colors",children:"Preview"}),a.jsx("button",{onClick:()=>t(r),className:"p-1.5 text-red-500 hover:bg-red-50 rounded-lg transition-colors",title:"Delete",children:a.jsx(Sn,{className:"w-4 h-4"})})]})]})})}const bG=["local","sports","community","opinion","obituaries","notices","gilchrist","perspectives"],Io=[{name:"Kimberly Williams Lander",image:"/Kim Head Shot newspaper.jpg"},{name:"Lindsey Lander",image:"/Lindsey Pic.jpg"},{name:"Cindy Chewning",image:""}],i1=Io.map(r=>r.image).filter(Boolean),xG={title:"",slug:"",excerpt:"",content:"",author:"",category:"local",image_url:"",published:!1,featured:!1,is_breaking:!1,story_images:[]},vG={name:"",zone:"sidebar",image_url:"",link_url:"",active:!0,start_date:null,end_date:null},Yy=[{value:"leaderboard",label:"Leaderboard",desc:"Full-width banner below navigation"},{value:"sidebar",label:"Sidebar",desc:"Right sidebar — stacked slots"},{value:"in-content",label:"In-Content",desc:"Between story cards"},{value:"footer",label:"Footer",desc:"Full-width above footer"}],cL={publisher:"Publisher",editor:"Editor",reporter:"Reporter"},uL={publisher:"bg-brand-red text-white",editor:"bg-blue-100 text-blue-700",reporter:"bg-gray-100 text-gray-600"};async function a1(r,e={}){var l;if(!Y)return{data:null,error:"Supabase not configured"};const{data:t}=await Y.auth.getSession(),n=(l=t.session)==null?void 0:l.access_token;if(!n)return{data:null,error:"Not authenticated"};const s=`https://rdyprhzjnqjauufyfqlp.supabase.co/functions/v1/manage-staff${r}`,i=await fetch(s,{...e,headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`,Apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJkeXByaHpqbnFqYXV1ZnlmcWxwIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODAzNDYzMDAsImV4cCI6MjA5NTkyMjMwMH0.zyA_fVB72pAmHui8m1UhJkK-R9yndy6nuLgyzLDvW04",...e.headers}}),o=await i.json();return i.ok?{data:o,error:null}:{data:null,error:o.error??"Request failed"}}function dL({imageUrl:r,onUpload:e,onClear:t,uploadFn:n}){const s=k.useRef(null),[i,o]=k.useState(!1),[l,c]=k.useState(0),[u,d]=k.useState(""),[h,f]=k.useState(!1),p=k.useCallback(async v=>{d(""),o(!0),c(0);try{const b=await n(v,c);e(b)}catch(b){d(b instanceof Error?b.message:"Upload failed.")}finally{o(!1),c(0)}},[n,e]);function m(v){var y;const b=(y=v.target.files)==null?void 0:y[0];b&&p(b),s.current&&(s.current.value="")}function g(v){var y;v.preventDefault(),f(!1);const b=(y=v.dataTransfer.files)==null?void 0:y[0];b&&p(b)}return a.jsxs("div",{className:"space-y-2",children:[a.jsx("input",{ref:s,t
1158ype:"file",accept:"image/jpeg,image/png,image/webp",onChange:m,className:"hidden"}),u&&a.jsxs("div",{className:"flex items-start gap-2 text-xs text-red-700 bg-red-50 border border-red-200 rounded px-3 py-2",children:[a.jsx(Ve,{className:"w-3.5 h-3.5 mt-0.5 shrink-0"}),a.jsx("span",{className:"flex-1",children:u}),a.jsx("button",{type:"button",onClick:()=>d(""),className:"text-red-400 hover:text-red-600 ml-1 shrink-0",children:a.jsx(tt,{className:"w-3 h-3"})})]}),r?a.jsxs("div",{className:"relative group rounded overflow-hidden border border-gray-200 bg-gray-50",children:[a.jsx("img",{src:r,alt:"Preview",className:"w-full max-h-40 object-cover"}),a.jsxs("div",{className:"absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2",children:[a.jsx("button",{type:"button",onClick:()=>{var v;return(v=s.current)==null?void 0:v.click()},className:"bg-white text-gray-800 font-semibold text-xs px-3 py-1.5 rounded hover:bg-gray-100 transition",children:"Replace"}),a.jsx("button",{type:"button",onClick:t,className:"bg-brand-red text-white font-semibold text-xs px-3 py-1.5 rounded hover:bg-brand-red-dark transition",children:"Remove"})]})]}):i?a.jsxs("div",{className:"border border-gray-200 rounded p-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx(_e,{className:"w-4 h-4 animate-spin text-brand-red shrink-0"}),a.jsx("span",{className:"text-xs text-gray-600 font-body",children:"Uploading…"}),a.jsxs("span",{className:"text-xs font-semibold text-brand-red ml-auto",children:[l,"%"]})]}),a.jsx("div",{className:"w-full bg-gray-100 rounded-full h-1.5",children:a.jsx("div",{className:"bg-brand-red h-1.5 rounded-full transition-all duration-200",style:{width:`${l}%`}})})]}):a.jsxs("div",{onDrop:g,onDragOver:v=>{v.preventDefault(),f(!0)},onDragLeave:()=>f(!1),onClick:()=>{var v;return(v=s.current)==null?void 0:v.click()},className:`border-2 border-dashed rounded p-5 flex flex-col items-center justify-center gap-1.5 cursor-pointer transition-colors ${h?"border-brand-red bg-red-50":"border-gray-300 hover:border-brand-red hover:bg-gray-50"}`,children:[a.jsx(Vu,{className:"w-6 h-6 text-gray-400"}),a.jsx("p",{className:"font-body text-xs font-medium text-gray-600",children:h?"Drop image here":"Drag & drop or click to upload"}),a.jsx("p",{className:"font-body text-xs text-gray-400",children:"JPG, PNG, WebP · max 10 MB"})]}),!r&&!i&&a.jsxs("div",{children:[a.jsx("p",{className:"font-body text-xs text-gray-400 mb-1 text-center",children:"or paste a URL"}),a.jsx("input",{type:"url",placeholder:"https://…",className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red font-body rounded",onChange:v=>{v.target.value&&e(v.target.value)}})]})]})}function wG(){return Math.random().toString(36).slice(2)+Date.now().toString(36)}function _G({images:r,onChange:e}){const t=k.useRef(null),[n,s]=k.useState(!1),[i,o]=k.useState(""),l=k.useCallback(async m=>{if(!m.length)return;o(""),s(!0);const g=[];for(const v of m)try{const b=await TR(v,()=>{});g.push({id:wG(),url:b,caption:"",attribution:"",position:"gallery"})}catch(b){o(b instanceof Error?b.message:"Upload failed.")}g.length&&e([...r,...g]),s(!1)},[r,e]);function c(m){const g=Array.from(m.target.files??[]);t.current&&(t.current.value=""),l(g)}function u(m){m.preventDefault(),l(Array.from(m.dataTransfer.files))}function d(m,g){e(r.map(v=>v.id===m?{...v,...g}:v))}function h(m){e(r.filter(g=>g.id!==m))}function f(m,g){const v=m+g;if(v<0||v>=r.length)return;const b=[...r];[b[m],b[v]]=[b[v],b[m]],e(b)}const p=[{value:"inline-top",label:"Inline — top of body"},{value:"inline-mid",label:"Inline — middle of body"},{value:"gallery",label:"Gallery — end of article"}];return a.jsxs("div",{children:[a.jsx("input",{ref:t,type:"file",accept:"image/jpeg,image/png,image/webp",multiple:!0,onChange:c,className:"hidden"}),i&&a.jsxs("div",{className:"flex items-start gap-2 text-xs text-red-700 bg-red-50 border border-red-200 rounded px-3 py-2 mb-3",children:[a.jsx(Ve,{className:"w-3.5 h-3.5 mt-0.5 shrink-0"}),a.jsx("span",{className:"flex-1",children:i}),a.jsx("button",{type:"button",onClick:()=>o(""),className:"text-red-400 hover:text-red-600",children:a.jsx(tt,{className:"w-3 h-3"})})]}),r.length>0&&a.jsxs("div",{className:"flex flex-wrap gap-2 mb-3 pb-3 border-b border-gray-100",children:[a.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-gray-600 bg-gray-100 border border-gray-200 px-1.5 py-0.5 rounded font-body",children:[a.jsx(Qj,{className:"w-2.5 h-2.5"})," Inline = constrained-width inside article"]}),a.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-blue-700 bg-blue-50 border border-blue-200 px-1.5 py-0.5 rounded font-body",children:[a.jsx(E_,{className:"w-2.5 h-2.5"})," Gallery = photo grid at end"]})]}),r.length>0&&a.jsx("div",{className:"space-y-3 mb-3",children:r.map((m,g)=>{const v=m.position==="gallery",b=m.position==="inline-top"?"Top":m.position==="inline-mid"?"Mid":"Gallery";return a.jsx("div",{className:`border rounded overflow-hidden bg-white ${v?"border-blue-200":"border-gray-200"}`,children:a.jsxs("div",{className:"flex gap-3 p-3",children:[a.jsxs("div",{className:"relative flex-shrink-0",children:[a.jsx("img",{src:m.url,alt:"",className:"w-20 h-16 object-cover rounded border border-gray-100"}),a.jsx("div",{className:"absolute bottom-0.5 left-0.5",children:v?a.jsxs("span",{className:"inline-flex items-center gap-0.5 bg-blue-600/90 text-white text-[9px] font-bold px-1 py-0.5 rounded",children:[a.jsx(E_,{className:"w-2 h-2"})," ",b]}):a.jsxs("span",{className:"inline-flex items-center gap-0.5 bg-gray-700/80 text-white text-[9px] font-bold px-1 py-0.5 rounded",children:[a.jsx(Qj,{className:"w-2 h-2"})," ",b]})})]}),a.jsxs("div",{className:"flex-1 min-w-0 space-y-1.5",children:[a.jsx("select",{value:m.position,onChange:y=>
1158d(m.id,{position:y.target.value}),className:"w-full border border-gray-200 rounded px-2 py-1.5 text-xs bg-white focus:outline-none focus:border-brand-red font-body",children:p.map(y=>a.jsx("option",{value:y.value,children:y.label},y.value))}),a.jsx("input",{type:"text",value:m.caption??"",onChange:y=>d(m.id,{caption:y.target.value}),placeholder:"Caption (optional)",className:"w-full border border-gray-200 rounded px-2.5 py-1.5 text-xs focus:outline-none focus:border-brand-red font-body"}),a.jsx("input",{type:"text",value:m.attribution??"",onChange:y=>d(m.id,{attribution:y.target.value}),placeholder:"Photographer / source (optional)",className:"w-full border border-gray-200 rounded px-2.5 py-1.5 text-xs focus:outline-none focus:border-brand-red font-body"})]}),a.jsxs("div",{className:"flex flex-col gap-1 flex-shrink-0",children:[a.jsx("button",{type:"button",onClick:()=>f(g,-1),disabled:g===0,className:"p-1 rounded bg-gray-100 hover:bg-gray-200 disabled:opacity-30 transition",title:"Move up",children:a.jsx(fa,{className:"w-3 h-3"})}),a.jsx("button",{type:"button",onClick:()=>f(g,1),disabled:g===r.length-1,className:"p-1 rounded bg-gray-100 hover:bg-gray-200 disabled:opacity-30 transition",title:"Move down",children:a.jsx(Ws,{className:"w-3 h-3"})}),a.jsx("button",{type:"button",onClick:()=>h(m.id),className:"p-1 rounded bg-red-50 hover:bg-red-100 text-red-600 transition",title:"Remove",children:a.jsx(tt,{className:"w-3 h-3"})})]})]})},m.id)})}),n?a.jsxs("div",{className:"border border-gray-200 rounded p-3 flex items-center gap-2",children:[a.jsx(_e,{className:"w-4 h-4 animate-spin text-brand-red"}),a.jsx("span",{className:"font-body text-xs text-gray-600",children:"Uploading…"})]}):a.jsxs("div",{onDrop:u,onDragOver:m=>m.preventDefault(),onClick:()=>{var m;return(m=t.current)==null?void 0:m.click()},className:"border-2 border-dashed border-gray-300 rounded p-5 flex flex-col items-center justify-center gap-1.5 cursor-pointer hover:border-brand-red hover:bg-gray-50 transition-colors",children:[a.jsx(Vu,{className:"w-5 h-5 text-gray-400"}),a.jsx("p",{className:"font-body text-xs font-medium text-gray-600",children:r.length>0?"Add more photos":"Drag & drop or click to upload"}),a.jsx("p",{className:"font-body text-xs text-gray-400",children:"JPG, PNG, WebP · max 10 MB · multiple allowed"})]})]})}function NG({onLogin:r}){const[e,t]=k.useState(""),[n,s]=k.useState(""),[i,o]=k.useState(!1),[l,c]=k.useState(""),[u,d]=k.useState(!1),h="[email protected]",f=async p=>{if(p.preventDefault(),!e.trim()||!n.trim()){c("Email and password are required.");return}if(e.trim().toLowerCase()!==h){c("Access denied. This portal is restricted to the publisher account.");return}if(d(!0),c(""),!Y){c("Supabase is not configured."),d(!1);return}const{data:m,error:g}=await Y.auth.signInWithPassword({email:e.trim(),password:n});if(d(!1),g||!m.user){c((g==null?void 0:g.message)??"Sign-in failed.");return}r(m.user)};return a.jsx("div",{className:"min-h-screen bg-brand-black flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-sm",children:[a.jsxs("div",{className:"text-center mb-8",children:[a.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 bg-brand-red rounded-full mb-4",children:a.jsx(Vs,{className:"w-6 h-6 text-white"})}),a.jsx("h1",{className:"font-masthead text-3xl font-bold text-white mb-1",children:"The Dixie County Advocate"}),a.jsx("p",{className:"font-body text-gray-400 text-sm",children:"Staff Access"})]}),a.jsxs("div",{className:"bg-white rounded-lg overflow-hidden shadow-xl",children:[a.jsx("div",{className:"bg-brand-red text-white px-6 py-4",children:a.jsx("h2",{className:"font-headline font-bold text-lg",children:"Staff Login"})}),a.jsxs("form",{onSubmit:f,className:"p-6 space-y-4",children:[l&&a.jsxs("div",{className:"flex items-start gap-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded px-3 py-2.5 font-body",children:[a.jsx(Ve,{className:"w-4 h-4 mt-0.5 shrink-0"}),l]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1.5 uppercase tracking-wider font-body",children:"Email"}
1158),a.jsx("input",{autoFocus:!0,type:"email",value:e,onChange:p=>{t(p.target.value),c("")},className:"w-full border border-gray-300 px-3 py-2.5 text-sm focus:outline-none focus:border-brand-red font-body rounded",placeholder:"[email protected]",autoComplete:"email"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1.5 uppercase tracking-wider font-body",children:"Password"}),a.jsxs("div",{className:"relative",children:[a.jsx("input",{type:i?"text":"password",value:n,onChange:p=>{s(p.target.value),c("")},className:"w-full border border-gray-300 px-3 py-2.5 pr-10 text-sm focus:outline-none focus:border-brand-red font-body rounded",placeholder:"••••••••",autoComplete:"current-password"}),a.jsx("button",{type:"button",onClick:()=>o(!i),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",tabIndex:-1,children:i?a.jsx(Hg,{className:"w-4 h-4"}):a.jsx(zg,{className:"w-4 h-4"})})]})]}),a.jsx("button",{type:"submit",disabled:u,className:"w-full bg-brand-red hover:bg-brand-red-dark disabled:opacity-60 text-white font-bold py-2.5 text-sm transition-colors font-body rounded",children:u?a.jsxs("span",{className:"flex items-center justify-center gap-2",children:[a.jsx(_e,{className:"w-4 h-4 animate-spin"}),"Signing in…"]}):"Sign In"})]})]}),a.jsx("p",{className:"text-center text-xs text-gray-600 mt-4 font-body",children:"Staff accounts are managed by the publisher. Contact (352) 498-3312 for access."})]})})}function SG({slug:r}){const[e,t]=k.useState(!1);return a.jsxs("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(`${window.location.origin}/article/${r}`).then(()=>{t(!0),setTimeout(()=>t(!1),2e3)})},className:"flex-shrink-0 flex items-center gap-1.5 px-3 py-2 border border-gray-200 text-xs font-semibold text-gray-600 hover:border-brand-red hover:text-brand-red transition-colors bg-white font-body",title:"Copy URL",children:[e?a.jsx(Nk,{className:"w-3.5 h-3.5 text-green-600"}):a.jsx(dU,{className:"w-3.5 h-3.5"}),e?"Copied!":"Copy"]})}function kG({article:r,onSave:e,onCancel:t}){var b;const[n,s]=k.useState(r),[i,o]=k.useState(!1),[l,c]=k.useState(!1),[u,d]=k.useState("");k.useEffect(()=>{s(r),c(!1),d("")},[r]);const h=(y,w)=>s(_=>({..._,[y]:w})),f=y=>s(w=>({...w,title:y,slug:w.id?w.slug:J$(y)})),p=String(n.category).toLowerCase()==="perspectives";k.useEffect(()=>{if(!p)return;const y=Io.find(w=>w.name===n.author);y!=null&&y.image&&n.image_url!==y.image&&(!n.image_url||i1.includes(n.image_url))&&h("image_url",y.image)},[p,n.author,n.image_url]);function m(y){const w=Io.find(_=>_.name===y);s(_=>({..._,author:y,image_url:(w==null?void 0:w.image)??(i1.includes(_.image_url??"")?"":_.image_url)}))}const g=async y=>{if(y.preventDefault(),!(n.content??"").replace(/<[^>]*>/g,"").trim()){d("Article body is required.");return}o(!0),d("");const{error:w}=await WU(n);o(!1),w?d(w):(c(!0),setTimeout(()=>c(!1),2500),await e(n))},v=n.story_images??[];return a.jsxs("form",{onSubmit:g,className:"bg-white border border-gray-200",children:[a.jsxs("div",{className:"bg-brand-black text-white px-5 py-4 flex items-center justify-between",children:[a.jsx("h2",{className:"font-headline font-bold text-lg",children:n.id?"Edit Article":"New Article"}),a.jsx("button",{type:"button",onClick:t,className:"text-gray-400 hover:text-white",children:a.jsx(tt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-5 space-y-4",children:[u&&a.jsxs("div",{className:"flex items-start gap-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded px-3 py-2.5 font-body",children:[a.jsx(Ve,{className:"w-4 h-4 mt-0.5 shrink-0"}),u]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:"Headline *"}),a.jsx("input",{required:!0,type:"text",value:n.title??"",onChange:y=>f(y.target.value),className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red font-body",placeholder:"Story headline..."})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:"URL Slug *"}),a.jsx("input",{required:!0,type:"text",value:n.slug??"",onChange:y=>h("slug",y.target.value),className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red font-body font-mono"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:"Excerpt / Summary *"}),a.jsx("textarea",{required:!0,rows:3,value:n.excerpt??"",onChange:y=>h("excerpt",y.target.value),className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red resize-none font-body",placeholder:"Brief summary shown in article cards..."})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:"Article Body *"}),a.jsx(dW,{value:n.content??"",onChange:y=>h("content",y),placeholder:"Write the full article here. Use the toolbar or Ctrl+B / Ctrl+I / Ctrl+U to format. Press Enter twice for a new paragraph.",minHeight:350})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-semibold text-gray-600 mb-1.5 uppercase tracking-wider font-body flex items-center gap-1.5",children:[a.jsx(Fn,{className:"w-3.5 h-3.5"})," Hero Image"]}),a.jsx("p",{className:"font-body text-xs text-gray-400 mb-2",children:"This image appears full-width at the top of the article."}),a.jsx(dL,{imageUrl:n.image_url??"",onUpload:y=>h("image_url",y),onClear:()=>h("image_url",""),uploadFn:TR})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-semibold text-gray-600 mb-0.5 uppercase tracking-wider font-body flex items-center gap-1.5",children:[a.jsx(Vu,{className:"w-3.5 h-3.5"})," Additional Photos"]}),a.jsxs("p",{className:"font-body text-xs text-gray-400 mb-2",children:["Each photo can be placed ",a.jsx("strong",{children:"inline"})," at the top or middle of the article body (constrained width), or in an",a.jsx("strong",{children:" end-of-article gallery"}),"."]}),a.jsx(_G,{images:v,onChange:y=>h("story_images",y)})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:"Author *"}),p?a.jsxs(a.Fragment,{children:[a.jsxs("select",{value:Io.some(y=>
1158y.name===n.author)?n.author:"__custom__",onChange:y=>{y.target.value==="__custom__"?s(w=>({...w,author:"",image_url:i1.includes(w.image_url??"")?"":w.image_url})):m(y.target.value)},className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red font-body bg-white",children:[!Io.some(y=>y.name===n.author)&&n.author&&a.jsx("option",{value:"__custom__",children:n.author}),Io.map(y=>a.jsx("option",{value:y.name,children:y.name},y.name)),a.jsx("option",{value:"__custom__",children:"— Custom name —"})]}),!Io.some(y=>y.name===n.author)&&a.jsx("input",{required:!0,type:"text",value:n.author??"",onChange:y=>m(y.target.value),className:"w-full border border-gray-300 px-3 py-2 text-sm mt-2 focus:outline-none focus:border-brand-red font-body",placeholder:"Type the author's name"}),((b=Io.find(y=>y.name===n.author))==null?void 0:b.image)&&a.jsxs("p",{className:"font-body text-xs text-green-600 mt-1.5 flex items-center gap-1",children:[a.jsx(At,{className:"w-3.5 h-3.5"})," Author photo set as hero image"]})]}):a.jsx("input",{required:!0,type:"text",value:n.author??"",onChange:y=>h("author",y.target.value),className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red font-body",placeholder:"Reporter name"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:"Category *"}),a.jsx("select",{value:n.category??"local",onChange:y=>h("category",y.target.value),className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red font-body bg-white",children:bG.map(y=>a.jsx("option",{value:y,children:y.charAt(0).toUpperCase()+y.slice(1)},y))})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:"Display Order"}),a.jsx("p",{className:"font-body text-xs text-gray-400 mb-1.5",children:"Controls position on category pages (e.g. Perspectives). Lower numbers appear first. Leave blank to sort by publish date."}),a.jsx("input",{type:"number",min:1,value:n.sort_order??"",onChange:y=>h("sort_order",y.target.value===""?null:parseInt(y.target.value,10)),placeholder:"e.g. 1, 2, 3…",className:"w-36 border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red font-body"})]}),n.slug&&a.jsxs("div",{className:"bg-gray-50 border border-gray-200 px-4 py-3",children:[a.jsx("p",{className:"font-body text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2",children:"Story URL"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("code",{className:"flex-1 font-mono text-sm text-gray-700 bg-white border border-gray-200 px-3 py-2 truncate",children:[window.location.origin,"/article/",n.slug]}),a.jsx(SG,{slug:n.slug})]})]}),a.jsx("div",{className:"flex flex-wrap gap-5 pt-1",children:[["published","Published"],["featured","Featured Story"],["is_breaking","Breaking News"]].map(([y,w])=>a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer font-body text-sm text-gray-700",children:[a.jsx("input",{type:"checkbox",checked:!!n[y],onChange:_=>h(y,_.target.checked),className:"w-4 h-4 accent-brand-red"}),w]},y))}),a.jsxs("div",{className:"flex items-center gap-3 pt-2 border-t border-gray-100",children:[a.jsxs("button",{type:"submit",disabled:i,className:"flex items-center gap-2 bg-brand-red hover:bg-brand-red-dark disabled:opacity-60 text-white font-bold px-6 py-2.5 text-sm transition-colors font-body",children:[i?a.jsx(_e,{className:"w-4 h-4 animate-spin"}):l?a.jsx(At,{className:"w-4 h-4"}):a.jsx(vn,{className:"w-4 h-4"}),i?"Saving...":l?"Saved!":"Save Article"]}),a.jsx("button",{type:"button",onClick:t,className:"px-5 py-2.5 border border-gray-300 text-sm text-gray-600 hover:bg-gray-50 font-body",children:"Cancel"})]})]})]})}function CG({ad:r,onSave:e,onCancel:t}){const[n,s]=k.useState(r),[i,o]=k.useState(!1),[l,c]=k.useState("");k.useEffect(()=>{s(r),c("")},[r]);const u=(f,p)=>s(m=>({...m,[f]:p})),d=async f=>{var m,g;if(f.preventDefault(),!((m=n.name)!=null&&m.trim())){c("Ad name is required.");return}if(!((g=n.image_url)!=null&&g.trim())){c("Ad image is required.");return}o(!0),c("");const{error:p}=await AR(n);o(!1),p?c(p):e()},h=new Date().toISOString().slice(0,10);return a.jsxs("form",{onSubmit:d,className:"bg-white border border-gray-200",children:[a.jsxs("div",{className:"bg-brand-black text-white px-5 py-4 flex items-center justify-between",children:[a.jsxs("h2",{className:"font-headline font-bold text-lg flex items-center gap-2",children:[a.jsx(Tb,{className:"w-5 h-5"}),n.id?"Edit Ad":"New Ad"]}),a.jsx("button",{type:"button",onClick:t,className:"text-gray-400 hover:text-white",children:a.jsx(tt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-5 space-y-4",children:[l&&a.jsxs("div",{className:"flex items-start gap-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded px-3 py-2.5 font-body",children:[a.jsx(Ve,{className:"w-4 h-4 mt-0.5 shrink-0"}),l]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:"Ad Name / Label *"}),a.jsx("p",{className:"font-body text-xs text-gray-400 mb-1",children:"Internal reference, not shown to readers."}),a.jsx("input",{required:!0,type:"text",value:n.name??"",onChange:f=>u("name",f.target.value),className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red font-body",placeholder:"e.g., Cross City Hardware — June 2026"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1.5 uppercase tracking-wider font-body",children:"Placement Zone *"}),a.jsx("div",{className:"grid grid-cols-2 gap-2",children:Yy.map(f=>a.jsxs("label",{className:`flex items-start gap-2.5 border rounded p-2.5 cursor-pointer transition-colors ${n.zone===f.value?"border-brand-red bg-red-50":"border-gray-200 hover:border-gray-300"}`,children:[a.jsx("input",{type:"radio",name:"zone",value:f.value,checked:n.zone===f.value,onChange:()=>u("zone",f.value),className:"mt-0.5 accent-brand-red"}),a.jsxs("div",{children:[a.jsx("p",{className:"font-body text-sm font-semibold text-gray-800",children:f.label}),a.jsx("p",{className:"font-body text-xs text-gray-400",children:f.desc})]})]},f.value))})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-semibold text-gray-600 mb-1.5 uppercase tracking-wider font-body flex items-center gap-1.5",children:[a.jsx(Fn,{className:"w-3.5 h-3.5"})," Ad Image *"]}),a.jsx(dL,{imageUrl:n.image_url??"",onUpload:f=>u("image_url",f),onClear:()=>u("image_url",""),uploadFn:QU})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body flex items-center gap-1.5",children:[a.jsx(SR,{className:"w-3.5 h-3.5"})," Click URL"]}),a.jsx("p",{className:"font-body text-xs text-gray-400 mb-1",children:"Where readers go when they click the ad."}),a.jsx("input",{type:"url",value:n.link_url??"",onChange:f=>u("link_url",f.target.value),className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red font-body",placeholder:"https://advertiser-website.com"})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body flex items-center gap-1.5",children:[a.jsx(Jp,{className:"w-3.5 h-3.5"})," Schedule"]}),a.jsx("p",{className:"font-body text-xs text-gray-400 mb-2",children:"Ad only shows when today falls within this range. Leave blank to run indefinitely."}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block font-body text-xs text-gray-600 mb-1",children:"Start Date"}),a.jsx("input",{type:"date",value:n.start_date??"",min:h,onChange:f=>u("start_date",f.target.value||null),className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red font-body"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block font-body text-xs text-gray-600 mb-1",children:"End Date"}),a.jsx("input",{type:"date",value:n.end_date??"",min:n.start_date??h,onChange:f=>u("end_date",f.target.value||null),className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red font-body"})]})]})]}),a.jsxs("div",{className:"flex items-center justify-between bg-gray-50 border border-gray-200 rounded px-4 py-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"font-body text-sm font-semibold text-gray-800",children:"Active"}),a.jsx("p",{className:"font-body text-xs text-gray-500",children:"Inactive ads are hidden from the site regardless of dates."})]}),a.jsx("button",{type:"button",onClick:()=>u("active",!n.active),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${n.active?"bg-brand-red":"bg-gray-300"}
1158`,children:a.jsx("span",{className:`inline-block h-4 w-4 rounded-full bg-white shadow transition-transform ${n.active?"translate-x-6":"translate-x-1"}`})})]}),a.jsxs("div",{className:"flex items-center gap-3 pt-2 border-t border-gray-100",children:[a.jsxs("button",{type:"submit",disabled:i,className:"flex items-center gap-2 bg-brand-red hover:bg-brand-red-dark disabled:opacity-60 text-white font-bold px-6 py-2.5 text-sm transition-colors font-body",children:[i?a.jsx(_e,{className:"w-4 h-4 animate-spin"}):a.jsx(vn,{className:"w-4 h-4"}),i?"Saving...":"Save Ad"]}),a.jsx("button",{type:"button",onClick:t,className:"px-5 py-2.5 border border-gray-300 text-sm text-gray-600 hover:bg-gray-50 font-body",children:"Cancel"})]})]})]})}function EG(){const[r,e]=k.useState("library"),[t,n]=k.useState([]),[s,i]=k.useState(!0),[o,l]=k.useState(null),[c,u]=k.useState(null),[d,h]=k.useState("all"),[f,p]=k.useState(""),m=k.useCallback(()=>{i(!0),p(""),GU().then(_=>n(_)).catch(_=>p(_ instanceof Error?_.message:"Failed to load ads.")).finally(()=>i(!1))},[]);k.useEffect(()=>{m()},[m]);const g=async(_,N)=>{window.confirm(`Delete ad "${N}"? This cannot be undone.`)&&(u(_),await XU(_),n(S=>S.filter(E=>E.id!==_)),u(null))},v=async _=>{await AR({id:_.id,active:!_.active}),m()},b=new Date().toISOString().slice(0,10),y=d==="all"?t:t.filter(_=>
1158_.zone===d),w=a.jsxs("div",{className:"flex gap-1 mb-5 bg-gray-100 p-1 rounded-xl w-fit",children:[a.jsxs("button",{onClick:()=>e("library"),className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-semibold font-body transition-all ${r==="library"?"bg-white text-gray-900 shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:[a.jsx(E_,{className:"w-4 h-4"})," Ad Library"]}),a.jsxs("button",{onClick:()=>e("assignments"),className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-semibold font-body transition-all ${r==="assignments"?"bg-white text-gray-900 shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:[a.jsx(bU,{className:"w-4 h-4"})," Page Assignments"]})]});return o!==null?a.jsx("div",{className:"mb-6",children:a.jsx(CG,{ad:o,onSave:()=>{m(),l(null)},onCancel:()=>l(null)})}):r==="assignments"?a.jsxs(a.Fragment,{children:[w,a.jsx(gq,{allAds:t})]}):a.jsxs(a.Fragment,{children:[w,a.jsxs("div",{className:"flex items-center justify-between mb-5",children:[a.jsxs("h2",{className:"font-headline font-bold text-xl text-brand-black flex items-center gap-2",children:[a.jsx(Tb,{className:"w-5 h-5 text-brand-red"}),"Ad Library",!s&&a.jsxs("span",{className:"font-body text-sm font-normal text-gray-500 ml-1",children:["(",t.length," total)"]})]}),a.jsxs("button",{onClick:()=>l({...vG}),className:"flex items-center gap-2 bg-brand-red hover:bg-brand-red-dark text-white font-bold px-4 py-2 text-sm transition-colors font-body",children:[a.jsx(No,{className:"w-4 h-4"})," New Ad"]})]}),a.jsx("div",{className:"flex flex-wrap gap-2 mb-5",children:["all",...Yy.map(_=>_.value)].map(_=>{var N;return a.jsxs("button",{onClick:()=>h(_),className:`px-3 py-1.5 text-xs font-semibold font-body rounded transition-colors ${d===_?"bg-brand-black text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:[_==="all"?"All Zones":((N=Yy.find(S=>S.value===_))==null?void 0:N.label)??_,_!=="all"&&a.jsxs("span",{className:"ml-1.5 opacity-60",children:["(",t.filter(S=>S.zone===_).length,")"]})]},_)})}),f&&a.jsxs("div",{className:"flex items-start gap-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded px-3 py-2.5 font-body mb-4",children:[a.jsx(Ve,{className:"w-4 h-4 mt-0.5 shrink-0"}),f]}),s?a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx(_e,{className:"w-8 h-8 animate-spin text-brand-red"})}):y.length===0?a.jsxs("div",{className:"bg-white border border-gray-200 p-10 text-center",children:[a.jsx(Tb,{className:"w-10 h-10 text-gray-300 mx-auto mb-3"}),a.jsx("p",{className:"font-headline font-bold text-gray-500 mb-1",children:"No ads yet"}),a.jsx("p",{className:"font-body text-sm text-gray-400",children:'Click "New Ad" to create your first advertisement.'})]}):a.jsx("div",{className:"bg-white border border-gray-200 overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm font-body",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b-2 border-brand-black text-left text-xs font-bold uppercase tracking-wider text-gray-500",children:[a.jsx("th",{className:"px-4 py-3",children:"Ad"}),a.jsx("th",{className:"px-4 py-3 hidden sm:table-cell",children:"Zone"}),a.jsx("th",{className:"px-4 py-3 hidden md:table-cell",children:"Schedule"}),a.jsx("th",{className:"px-4 py-3",children:"Status"}),a.jsx("th",{className:"px-4 py-3 text-right",children:"Actions"})]})}),a.jsx("tbody",{className:"divide-y divide-gray-100",children:y.map(_=>{var S;const N=_.active&&(!_.start_date||_.start_date<=b)&&(!_.end_date||_.end_date>=b);return a.jsxs("tr",{className:"hover:bg-gray-50 transition-colors",children:[a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-3",children:[_.image_url?a.jsx("img",{src:_.image_url,alt:"",className:"w-14 h-10 object-cover rounded border border-gray-100 shrink-0"}):a.jsx("div",{className:"w-14 h-10 bg-gray-100 rounded border border-gray-200 flex items-center justify-center shrink-0",children:a.jsx(Vu,{className:"w-4 h-4 text-gray-400"})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"font-semibold text-brand-black truncate max-w-[200px]",children:_.name}),_.link_url&&a.jsx("p",{className:"text-xs text-gray-400 truncate max-w-[200px]",children:_.link_url})]})]})}),a.jsx("td",{className:"px-4 py-3 hidden sm:table-cell",children:a.jsx("span",{className:"capitalize text-gray-600",children:((S=Yy.find(E=>E.value===_.zone))==null?void 0:S.label)??_.zone})}),a.jsx("td",{className:"px-4 py-3 hidden md:table-cell text-gray-400 text-xs",children:_.start_date||_.end_date?a.jsxs("span",{children:[_.start_date?`From ${_.start_date}`:"Open start"," · ",_.end_date?`Until ${_.end_date}`:"No end"]}):a.jsx("span",{className:"italic",children:"Always on"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("button",{onClick:()=>v(_),className:`inline-block text-xs font-bold px-2 py-0.5 uppercase tracking-wider transition-colors rounded ${N?"bg-green-100 text-green-700 hover:bg-green-200":"bg-gray-100 text-gray-500 hover:bg-gray-200"}`,children:N?"Live":_.active?"Off-schedule":"Inactive"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("button",{onClick:()=>l({..._}),className:"p-1.5 text-gray-400 hover:text-brand-black hover:bg-gray-100 rounded transition-colors",title:"Edit",children:a.jsx(Sf,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>g(_.id,_.name),disabled:c===_.id,className:"p-1.5 text-gray-400 hover:text-brand-red hover:bg-red-50 rounded transition-colors disabled:opacity-40",title:"Delete",children:c===_.id?a.jsx(_e,{className:"w-4 h-4 animate-spin"}):a.jsx(Sn,{className:"w-4 h-4"})})]})})]},_.id)})})]})})]})}function jG({currentUser:r}){const[e,t]=k.useState([]),[n,s]=k.useState(!0),[i,o]=k.useState(""),[l,c]=k.useState(null),[u,d]=k.useState(null),[h,f]=k.useState(!1),[p,m]=k.useState(""),[g,v]=k.useState(""),[b,y]=k.useState("reporter"),[w,_]=k.useState(!1),[N,S]=k.useState(!1),[E,T]=k.useState(""),[D,R]=k.useState(""),H=k.useCallback(async()=>{s(!0),o("");const{data:C,error:M}=await a1("");if(s(!1),M){o(M);return}t(C.staff??[])},[]);k.useEffect(()=>{H()},[H]);const A=async C=>
1158{if(C.preventDefault(),!p.trim()||!g.trim()){T("Email and password are required.");return}if(g.length<8){T("Password must be at least 8 characters.");return}S(!0),T(""),R("");const{error:M}=await a1("",{method:"POST",body:JSON.stringify({email:p.trim(),password:g,role:b})});if(S(!1),M){T(M);return}R(`Account created for ${p.trim()}.`),m(""),v(""),y("reporter"),await H(),setTimeout(()=>{R(""),f(!1)},2500)},U=async C=>{c(C),d(null);const{error:M}=await a1(`?user_id=${C}`,{method:"DELETE"});if(c(null),M){o(M);return}t(L=>L.filter(B=>B.user_id!==C))};return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-5",children:[a.jsxs("h2",{className:"font-headline font-bold text-xl text-brand-black flex items-center gap-2",children:[a.jsx(Ek,{className:"w-5 h-5 text-brand-red"}),"Staff Members",!n&&a.jsxs("span",{className:"font-body text-sm font-normal text-gray-500 ml-1",children:["(",e.length,")"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:H,className:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded transition-colors",title:"Refresh",children:a.jsx(Ru,{className:"w-4 h-4"})}),a.jsxs("button",{onClick:()=>{f(!h),T(""),R("")},className:"flex items-center gap-2 bg-brand-red hover:bg-brand-red-dark text-white font-bold px-4 py-2 text-sm transition-colors font-body rounded",children:[a.jsx(Nu,{className:"w-4 h-4"})," Add Staff"]})]})]}),h&&a.jsxs("div",{className:"bg-white border border-gray-200 rounded-lg p-5 mb-5",children:[a.jsxs("h3",{className:"font-headline font-bold text-base text-brand-black mb-4 flex items-center gap-2",children:[a.jsx(Nu,{className:"w-4 h-4 text-brand-red"})," Create Staff Account"]}),E&&a.jsxs("div",{className:"flex items-start gap-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded px-3 py-2.5 font-body mb-4",children:[a.jsx(Ve,{className:"w-4 h-4 mt-0.5 shrink-0"}),E]}),D&&a.jsxs("div",{className:"flex items-start gap-2 text-sm text-green-700 bg-green-50 border border-green-200 rounded px-3 py-2.5 font-body mb-4",children:[a.jsx(At,{className:"w-4 h-4 mt-0.5 shrink-0"}),D]}),a.jsxs("form",{onSubmit:A,className:"grid sm:grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:"Email *"}),a.jsx("input",{type:"email",value:p,onChange:C=>{m(C.target.value),T("")},className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red font-body rounded",placeholder:"[email protected]",autoComplete:"off"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:"Password *"}),a.jsxs("div",{className:"relative",children:[a.jsx("input",{type:w?"text":"password",value:g,onChange:C=>{v(C.target.value),T("")},className:"w-full border border-gray-300 px-3 py-2 pr-9 text-sm focus:outline-none focus:border-brand-red font-body rounded",placeholder:"Min. 8 characters",autoComplete:"new-password"}),a.jsx("button",{type:"button",onClick:()=>_(!w),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",tabIndex:-1,children:w?a.jsx(Hg,{className:"w-3.5 h-3.5"}):a.jsx(zg,{className:"w-3.5 h-3.5"})})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:"Role *"}),a.jsxs("select",{value:b,onChange:C=>y(C.target.value),className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red font-body bg-white rounded",children:[a.jsx("option",{value:"reporter",children:"Reporter"}),a.jsx("option",{value:"editor",children:"Editor"})]})]}),a.jsxs("div",{className:"sm:col-span-3 flex items-center gap-3 pt-1 border-t border-gray-100",children:[a.jsxs("button",{type:"submit",disabled:N,className:"flex items-center gap-2 bg-brand-red hover:bg-brand-red-dark disabled:opacity-60 text-white font-bold px-5 py-2 text-sm transition-colors font-body rounded",children:[N?a.jsx(_e,{className:"w-4 h-4 animate-spin"}):a.jsx(Nu,{className:"w-4 h-4"}),N?"Creating…":"Create Account"]}),a.jsx("button",{type:"button",onClick:()=>{f(!1),T(""),R("")},className:"px-4 py-2 border border-gray-300 text-sm text-gray-600 hover:bg-gray-50 font-body rounded",children:"Cancel"})]})]})]}),i&&a.jsxs("div",{className:"flex items-start gap-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded px-3 py-2.5 font-body mb-4",children:[a.jsx(Ve,{className:"w-4 h-4 mt-0.5 shrink-0"}),i]}),n?a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx(_e,{className:"w-7 h-7 animate-spin text-brand-red"})}):a.jsx("div",{className:"bg-white border border-gray-200 overflow-x-auto rounded-lg",children:a.jsxs("table",{className:"w-full text-sm font-body",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b-2 border-brand-black text-left text-xs font-bold uppercase tracking-wider text-gray-500",children:[a.jsx("th",{className:"px-4 py-3",children:"Email"}),a.jsx("th",{className:"px-4 py-3",children:"Role"}),a.jsx("th",{className:"px-4 py-3 hidden md:table-cell",children:"Added"}),a.jsx("th",{className:"px-4 py-3 text-right",children:"Actions"})]})}),a.jsxs("tbody",{className:"divide-y divide-gray-100",children:[e.map(C=>a.jsxs("tr",{className:"hover:bg-gray-50 transition-colors",children:[a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-7 h-7 rounded-full bg-gray-200 flex items-center justify-center shrink-0",children:a.jsx("span",{className:"font-body text-xs font-bold text-gray-600 uppercase",children:C.email[0]})}),a.jsx("span",{className:"font-medium text-brand-black",children:C.email}),C.user_id===r.id&&a.jsx("span",{className:"text-xs text-gray-400 font-body",children:"(you)"})]})}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("span",{className:`inline-flex items-center gap-1 text-xs font-bold px-2.5 py-1 rounded-full uppercase tracking-wider ${uL[C.role]??"bg-gray-100 text-gray-600"}`,children:[C.role==="publisher"&&a.jsx(kR,{className:"w-3 h-3"}),cL[C.role]??C.role]}
1158)}),a.jsx("td",{className:"px-4 py-3 hidden md:table-cell text-gray-400",children:xi(C.created_at)}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("div",{className:"flex items-center justify-end gap-2",children:C.user_id===r.id?a.jsx("span",{className:"text-xs text-gray-300 font-body italic",children:"your account"}):u===C.user_id?a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>U(C.user_id),disabled:l===C.user_id,className:"text-xs font-bold text-white bg-brand-red hover:bg-brand-red-dark px-3 py-1.5 rounded transition-colors disabled:opacity-60 font-body",children:l===C.user_id?a.jsx(_e,{className:"w-3.5 h-3.5 animate-spin"}):"Confirm Delete"}),a.jsx("button",{onClick:()=>d(null),className:"text-xs font-bold text-gray-600 bg-gray-100 hover:bg-gray-200 px-3 py-1.5 rounded transition-colors font-body",children:"Cancel"})]}):a.jsx("button",{onClick:()=>d(C.user_id),className:"p-1.5 text-gray-400 hover:text-brand-red hover:bg-red-50 rounded transition-colors",title:"Remove staff",children:a.jsx(Sn,{className:"w-4 h-4"})})})})]},C.id)),e.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:4,className:"px-4 py-10 text-center text-gray-400",children:"No staff members found."})})]})]})})]})}const AG={title:"",description:"",event_date:"",location:"",submitted_by:""};function TG(){const[r,e]=k.useState([]),[t,n]=k.useState(!0),[s,i]=k.useState(null),[o,l]=k.useState(!1),[c,u]=k.useState(""),[d,h]=k.useState(null),f=k.useCallback(()=>{n(!0),uH().then(g=>{e(g),n(!1)})},[]);k.useEffect(()=>{f()},[f]);const p=async g=>{var b;if(g.preventDefault(),!s)return;if(!((b=s.title)!=null&&b.trim())){u("Title is required.");return}if(!s.event_date){u("Date is required.");return}l(!0),u("");const{error:v}=await dH(s);if(l(!1),v){u(v);return}f(),i(null)},m=async(g,v)=>{confirm(`Delete "${v}"?`)&&(h(g),await hH(g),e(b=>b.filter(y=>y.id!==g)),h(null))};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-5",children:[a.jsxs("h2",{className:"font-headline font-bold text-xl text-brand-black flex items-center gap-2",children:[a.jsx(Jp,{className:"w-5 h-5 text-brand-red"})," Calendar of Events",!t&&a.jsxs("span",{className:"font-body text-sm font-normal text-gray-500 ml-1",children:["(",r.length,")"]})]}),!s&&a.jsxs("button",{onClick:()=>{i({...AG}),u("")},className:"flex items-center gap-2 bg-brand-red hover:bg-brand-red-dark text-white font-bold px-4 py-2 text-sm transition-colors font-body",children:[a.jsx(No,{className:"w-4 h-4"})," Add Event"]})]}),s&&a.jsxs("form",{onSubmit:p,className:"bg-white border border-gray-200 rounded-lg p-5 mb-6 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("h3",{className:"font-headline font-bold text-base text-brand-black",children:s.id?"Edit Event":"New Event"}),a.jsx("button",{type:"button",onClick:()=>i(null),className:"text-gray-400 hover:text-gray-700",children:a.jsx(tt,{className:"w-5 h-5"})})]}),c&&a.jsxs("div",{className:"flex items-start gap-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded px-3 py-2.5 font-body",children:[a.jsx(Ve,{className:"w-4 h-4 mt-0.5 shrink-0"}),c]}),a.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"sm:col-span-2",children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:"Event Title *"}),a.jsx("input",{required:!0,type:"text",value:s.title??"",onChange:g=>i({...s,title:g.target.value}),className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red font-body rounded",placeholder:"Community Meeting, Farmers Market, etc."})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:"Date & Time (Eastern Time) *"}),a.jsx("input",{required:!0,type:"datetime-local",value:s.event_date?Y$(s.event_date):"",onChange:g=>i({...s,event_date:K$(g.target.value)}),className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red font-body rounded"})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body flex items-center gap-1",children:[a.jsx(yo,{className:"w-3 h-3"})," Location"]}),a.jsx("input",{type:"text",value:s.location??"",onChange:g=>i({...s,location:g.target.value}),className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red font-body rounded",placeholder:"Cross City Community Center"})]}),a.jsxs("div",{className:"sm:col-span-2",children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:"Description"}),a.jsx("textarea",{rows:3,value:s.description??"",onChange:g=>i({...s,description:g.target.value}),className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red resize-none font-body rounded",placeholder:"Brief description of the event…"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1 uppercase tracking-wider font-body",children:"Submitted By"}),a.jsx("input",{type:"text",value:s.submitted_by??"",onChange:g=>i({...s,submitted_by:g.target.value}),className:"w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:border-brand-red font-body rounded",placeholder:"Name or organization"})]})]}),a.jsxs("div",{className:"flex items-center gap-3 pt-2 border-t border-gray-100",children:[a.jsxs("button",{type:"submit",disabled:o,className:"flex items-center gap-2 bg-brand-red hover:bg-brand-red-dark disabled:opacity-60 text-white font-bold px-6 py-2.5 text-sm transition-colors font-body rounded",children:[o?a.jsx(_e,{className:"w-4 h-4 animate-spin"}):a.jsx(vn,{className:"w-4 h-4"}),o?"Saving…":"Save Event"]}),a.jsx("button",{type:"button",onClick:()=>{i(null),u("")},className:"px-5 py-2.5 border border-gray-300 text-sm text-gray-600 hover:bg-gray-50 font-body rounded",children:"Cancel"})]})]}),t?a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx(_e,{className:"w-8 h-8 animate-spin text-brand-red"})}):r.length===0?a.jsxs("div",{className:"bg-white border border-gray-200 p-10 text-center rounded-lg",children:[a.jsx(Jp,{className:"w-10 h-10 text-gray-300 mx-auto mb-3"}),a.jsx("p",{className:"font-headline font-bold text-gray-500 mb-1",children:"No upcoming events"}),a.jsx("p",{className:"font-body text-sm text-gray-400",children:'Click "Add Event" to create the first calendar entry.'})]}):a.jsx("div",{className:"bg-white border border-gray-200 rounded-lg overflow-hidden",children:a.jsxs("table",{className:"w-full text-sm font-body",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b-2 border-brand-black text-left text-xs font-bold uppercase tracking-wider text-gray-500",children:[a.jsx("th",{className:"px-4 py-3",children:"Event"}),a.jsx("th",{className:"px-4 py-3 hidden sm:table-cell",children:"Date"}),a.jsx("th",{className:"px-4 py-3 hidden md:table-cell",children:"Location"}),a.jsx("th",{className:"px-4 py-3 text-right",children:"Actions"})]})}),a.jsx("tbody",{className:"divide-y divide-gray-100",children:r.map(g=>a.jsxs("tr",{className:"hover:bg-gray-50 transition-colors",children:[a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("p",{className:"font-semibold text-brand-black",children:g.title}),g.description&&a.jsx("p",{className:"text-xs text-gray-400 line-clamp-1 mt-0.5",children:g.description})]}),a.jsx("td",{className:"px-4 py-3 hidden sm:table-cell text-gray-600",children:G$(g.event_date)}),a.jsx("td",{className:"px-4 py-3 hidden md:table-cell text-gray-500",children:a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(yo,{className:"w-3 h-3"}),g.location||"—"]}
1158)}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("button",{onClick:()=>{i({...g}),u("")},className:"p-1.5 text-gray-400 hover:text-brand-black hover:bg-gray-100 rounded transition-colors",title:"Edit",children:a.jsx(Sf,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>m(g.id,g.title),disabled:d===g.id,className:"p-1.5 text-gray-400 hover:text-brand-red hover:bg-red-50 rounded transition-colors disabled:opacity-40",title:"Delete",children:d===g.id?a.jsx(_e,{className:"w-4 h-4 animate-spin"}):a.jsx(Sn,{className:"w-4 h-4"})})]})})]},g.id))})]})})]})}function DG({articles:r,articlesLoading:e,onRefreshArticles:t}){const[n,s]=k.useState(null),i=r.filter(c=>c.is_breaking),o=r.filter(c=>c.published&&!c.is_breaking),l=async(c,u)=>{s(c),await DR(c,!u),t(),s(null)};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"mb-5",children:[a.jsxs("h2",{className:"font-headline font-bold text-xl text-brand-black flex items-center gap-2 mb-1",children:[a.jsx(wu,{className:"w-5 h-5 text-brand-red"})," Breaking News Ticker"]}),a.jsx("p",{className:"font-body text-sm text-gray-500",children:"Articles marked as Breaking appear in the scrolling ticker at the top of every page."})]}),e?a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx(_e,{className:"w-8 h-8 animate-spin text-brand-red"})}):a.jsxs("div",{className:"space-y-5",children:[a.jsxs("div",{children:[a.jsxs("h3",{className:"font-body text-xs font-bold uppercase tracking-wider text-gray-500 mb-2",children:["Currently in ticker (",i.length,")"]}),i.length===0?a.jsx("div",{className:"bg-white border border-gray-200 rounded-lg p-6 text-center",children:a.jsx("p",{className:"font-body text-sm text-gray-400",children:"No breaking news selected. Choose articles from the list below."})}):a.jsx("div",{className:"bg-white border border-gray-200 rounded-lg overflow-hidden divide-y divide-gray-100",children:i.map(c=>a.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-semibold text-brand-black text-sm truncate",children:c.title}),a.jsxs("p",{className:"text-xs text-gray-400",children:[c.category," · ",xi(c.published_at??c.created_at)]})]}),a.jsxs("button",{onClick:()=>l(c.id,!0),disabled:n===c.id,className:"flex items-center gap-1 text-xs font-bold bg-brand-red text-white px-3 py-1.5 rounded hover:bg-brand-red-dark disabled:opacity-60 transition",children:[n===c.id?a.jsx(_e,{className:"w-3 h-3 animate-spin"}):a.jsx(tt,{className:"w-3 h-3"}),"Remove"]})]},c.id))})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-body text-xs font-bold uppercase tracking-wider text-gray-500 mb-2",children:"Published articles — click to add to ticker"}),o.length===0?a.jsx("p",{className:"font-body text-sm text-gray-400",children:"No other published articles."}):a.jsx("div",{className:"bg-white border border-gray-200 rounded-lg overflow-hidden divide-y divide-gray-100",children:o.map(c=>a.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 hover:bg-gray-50 transition-colors",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-semibold text-brand-black text-sm truncate",children:c.title}),a.jsxs("p",{className:"text-xs text-gray-400",children:[c.category," · ",xi(c.published_at??c.created_at)]})]}),a.jsxs("button",{onClick:()=>l(c.id,!1),disabled:n===c.id,className:"flex items-center gap-1 text-xs font-bold bg-gray-100 text-gray-600 px-3 py-1.5 rounded hover:bg-brand-red hover:text-white disabled:opacity-60 transition",children:[n===c.id?a.jsx(_e,{className:"w-3 h-3 animate-spin"}):a.jsx(wu,{className:"w-3 h-3"}),"Add to Ticker"]})]},c.id))})]})]})]})}function RG({currentUser:r}){const[e,t]=k.useState([]),[n,s]=k.useState(!0),[i,o]=k.useState(""),[l,c]=k.useState(""),[u,d]=k.useState(""),h=k.useCallback(async()=>{var w;if(s(!0),o(""),!Y){o("Supabase not configured"),s(!1);return}const{data:v}=await Y.auth.getSession(),b=(w=v.session)==null?void 0:w.access_token;if(!b){o("Not authenticated"),s(!1);return}const y="https://rdyprhzjnqjauufyfqlp.supabase.co/functions/v1/list-subscribers";try{const _=await fetch(y,{headers:{Authorization:`Bearer ${b}`,Apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJkeXByaHpqbnFqYXV1Znlm
1158cWxwIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODAzNDYzMDAsImV4cCI6MjA5NTkyMjMwMH0.zyA_fVB72pAmHui8m1UhJkK-R9yndy6nuLgyzLDvW04"}}),N=await _.json();if(!_.ok){o(N.error??"Failed to load subscribers"),s(!1);return}t(N.subscribers??[])}catch{o("Network error — could not load subscribers")}finally{s(!1)}},[]);k.useEffect(()=>{h()},[h]);function f(v){navigator.clipboard.writeText(v),d(v),setTimeout(()=>d(""),2e3)}function p(){const v=m.map(b=>b.email).join(`
1159`);navigator.clipboard.writeText(v),d("__all__"),setTimeout(()=>d(""),2e3)}const m=e.filter(v=>v.email.toLowerCase().includes(l.toLowerCase())),g=v=>v?new Date(v).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"—";return a.jsxs("div",{children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-5",children:[a.jsxs("div",{children:[a.jsxs("h2",{className:"font-headline font-bold text-xl text-brand-black",children:["Digital Subscribers",!n&&a.jsxs("span",{className:"font-body text-sm font-normal text-gray-500 ml-2",children:["(",e.length," account",e.length!==1?"s":"",")"]})]}),a.jsx("p",{className:"font-body text-xs text-gray-500 mt-0.5",children:"Accounts created via the Digital Paper paywall — cross-reference with Wave to verify payment."})]}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[a.jsxs("button",{onClick:p,disabled:m.length===0,className:"inline-flex items-center gap-1.5 bg-white border border-gray-300 hover:border-gray-400 text-gray-700 text-xs font-semibold font-body px-3 py-2 rounded transition-colors disabled:opacity-40",children:[a.jsx(go,{className:"w-3.5 h-3.5"}),u==="__all__"?"Copied!":"Copy all emails"]}),a.jsxs("button",{onClick:h,className:"inline-flex items-center gap-1.5 bg-white border border-gray-300 hover:border-gray-400 text-gray-700 text-xs font-semibold font-body px-3 py-2 rounded transition-colors",children:[a.jsx(Ru,{className:"w-3.5 h-3.5"}),"Refresh"]})]})]}),a.jsx("div",{className:"mb-4",children:a.jsx("input",{type:"text",value:l,onChange:v=>c(v.target.value),placeholder:"Search by email…",className:"w-full max-w-sm border border-gray-300 px-3 py-2 text-sm font-body focus:outline-none focus:border-brand-red rounded"})}),i&&a.jsxs("div",{className:"flex items-start gap-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded px-4 py-3 mb-4 font-body",children:[a.jsx(Ve,{className:"w-4 h-4 mt-0.5 shrink-0"}),i]}),n?a.jsx("div",{className:"flex items-center justify-center py-20",children:a.jsx(_e,{className:"w-8 h-8 animate-spin text-brand-red"})}):m.length===0?a.jsxs("div",{className:"text-center py-20 text-gray-400",children:[a.jsx(k_,{className:"w-10 h-10 mx-auto mb-3 text-gray-200"}),a.jsx("p",{className:"font-headline font-bold text-gray-400",children:l?"No matching subscribers":"No subscriber accounts yet"}),a.jsx("p",{className:"font-body text-sm mt-1",children:l?"Try a different search term.":"Accounts will appear here once readers sign up via the Digital Paper page."})]}):a.jsxs("div",{className:"bg-white border border-gray-200 overflow-x-auto rounded",children:[a.jsxs("table",{className:"w-full text-sm font-body",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b-2 border-brand-black text-left text-xs font-bold uppercase tracking-wider text-gray-500",children:[a.jsx("th",{className:"px-4 py-3",children:"Email"}),a.jsx("th",{className:"px-4 py-3 hidden sm:table-cell",children:"Signed Up"}),a.jsx("th",{className:"px-4 py-3 hidden md:table-cell",children:"Last Sign In"}),a.jsx("th",{className:"px-4 py-3 hidden lg:table-cell",children:"Status"}),a.jsx("th",{className:"px-4 py-3 text-right",children:"Actions"})]})}),a.jsx("tbody",{className:"divide-y divide-gray-100",children:m.map(v=>a.jsxs("tr",{className:"hover:bg-gray-50 transition-colors",children:[a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-7 h-7 rounded-full bg-brand-red/10 flex items-center justify-center shrink-0",children:a.jsx("span",{className:"text-xs font-bold text-brand-red",children:v.email[0].toUpperCase()})}),a.jsx("span",{className:"font-medium text-gray-900 truncate max-w-[200px]",children:v.email})]})}),a.jsx("td",{className:"px-4 py-3 hidden sm:table-cell text-gray-600",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(zr,{className:"w-3.5 h-3.5 text-gray-400"}),g(v.created_at)]})}),a.jsx("td",{className:"px-4 py-3 hidden md:table-cell text-gray-600",children:v.last_sign_in_at?a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(IU,{className:"w-3.5 h-3.5 text-green-500"}),g(v.last_sign_in_at)]}):a.jsxs("div",{className:"flex items-center gap-1.5 text-gray-400",children:[a.jsx(LU,{className:"w-3.5 h-3.5"}),"Never"]})}),a.jsx("td",{className:"px-4 py-3 hidden lg:table-cell",children:a.jsx("span",{className:`inline-flex items-center gap-1 text-xs font-bold px-2 py-0.5 rounded-full ${v.email_confirmed?"bg-green-100 text-green-700":"bg-amber-100 text-amber-700"}`,children:v.email_confirmed?"Confirmed":"Unconfirmed"})}),a.jsx("td",{className:"px-4 py-3 text-right",children:a.jsxs("button",{onClick:()=>f(v.email),title:"Copy email",className:"inline-flex items-center gap-1 text-xs font-semibold text-gray-500 hover:text-brand-red border border-gray-200 hover:border-brand-red px-2.5 py-1 rounded transition-colors",children:[a.jsx(go,{className:"w-3 h-3"}),u===v.email?"Copied!":"Copy"]})})]},v.id))})]}),a.jsxs("div",{className:"px-4 py-3 border-t border-gray-100 bg-gray-50 text-xs text-gray-500 font-body flex items-center gap-2",children:[a.jsx(k_,{className:"w-3.5 h-3.5 text-gray-400"}),"Showing ",m.length," of ",e.length," subscriber",e.length!==1?"s":"",". Cross-reference emails with your Wave account to verify active subscriptions."]})]})]})}function hT(){const[r,e]=k.useState(null),[t,n]=k.useState("reporter"),[s,i]=k.useState(!0),[o,l]=k.useState([]),[c,u]=k.useState(!0),[d,h]=k.useState(null),[f,p]=k.useState(null),[m,g]=k.useState("articles"),v="[email protected]";k.useEffect(()=>{if(!Y){i(!1);return}Y.auth.getSession().then(({data:T})=>{var R,H;const D=((R=T.session)==null?void 0:R.user)??null;e(((H=D==null?void 0:D.email)==null?void 0:H.toLowerCase())===v?D:null),i(!1)});const{data:E}=Y.auth.onAuthStateChange((T,D)=>{var H;const R=(D==null?void 0:D.user)??null;e(((H=R==null?void 0:R.email)==null?void 0:H.toLowerCase())===v?R:null)});return()=>E.subscription.unsubscribe()},[]),k.useEffect(()=>{!r||!Y||Y.from("staff_roles").select("role").eq("user_id",r.id).maybeSingle().then(({data:E})=>{E!=null&&E.role&&n(E.role)})},[r]);const b=k.useCallback(()=>{u(!0),qU().then(E=>{l(E),u(!1)})},[]);k.useEffect(()=>{r&&b()},[r,b]);const y=async()=>{Y&&await Y.auth.signOut(),e(null),n("reporter")},w=async E=>{b(),h(null)},_=async E=>{p(E),await VU(E),l(T=>T.filter(D=>D.id!==E)),p(null)};if(s)return a.jsx("div",{className:"min-h-screen bg-brand-black flex items-center justify-center",children:a.jsx(_e,{className:"w-8 h-8 animate-spin text-brand-red"})});if(!r)return a.jsx(NG,{onLogin:E=>e(E)});const N=!0,S=[{key:"articles",label:"Articles",icon:Vs},{key:"ads",label:"Advertisements",icon:Tb},{key:"events",label:"Calendar",icon:Jp},{key:"breaking",label:"Breaking News",icon:wu},{key:"notices",label:"Public Notices",icon:xR},{key:"obituaries",label:"Obituaries",icon:jl},{key:"games",label:"Upcoming Games",icon:_u},{key:"gallery",label:"This Week's Pics",icon:ia},{key:"digital-paper",label:"Digital Paper",icon:Bt},{key:"archive",label:"Past Editions",icon:Bt},{key:"subscriber-extras",label:"Subscriber Extras",icon:bl},{key:"cms",label:"Page Content",icon:TU},{key:"timeline",label:"Timeline",icon:zr},{key:"livestream",label:"Live Stream",icon:wu},{key:"subscribers",label:"Subscribers",icon:k_},{key:"staff",label:"Staff",icon:Ek}];return a.jsxs("div",{className:"min-h-screen bg-gray-50",children:[a.jsxs("header",{className:"bg-brand-black text-white",children:[a.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-4 flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-masthead text-xl font-bold text-white",children:"The Dixie County Advocate"}),a.jsxs("p",{className:"font-body text-xs text-gray-400 mt-0.5 flex items-center gap-2",children:["Staff Dashboard · ",r.email,a.jsxs("span",{className:`inline-flex items-center gap-1 text-xs font-bold px-2 py-0.5 rounded-full uppercase tracking-wider ${uL[t]??"bg-gray-700 text-gray-300"}`,children:[t==="publisher"&&a.jsx(kR,{className:"w-3 h-3"}),cL[t]??t]})]})]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("a",{href:"/",className:"font-body text-sm text-gray-400 hover:text-white transition-colors",children:"View Site"}),a.jsxs("button",{onClick:y,className:"flex items-center gap-1.5 font-body text-sm text-gray-400 hover:text-white transition-colors",children:[a.jsx(kk,{className:"w-4 h-4"})," Sign Out"]})]})]}),a.jsx("div",{className:"max-w-7xl mx-auto px-4 flex gap-0 border-t border-white/10 overflow-x-auto",children:S.map(E=>a.jsxs("button",{onClick:()=>g(E.key),className:`flex items-center gap-1.5 px-4 py-3 text-sm font-semibold font-body transition-colors border-b-2 whitespace-nowrap ${m===E.key?"border-brand-red text-white":"border-transparent text-gray-400 hover:text-white"}`,children:[a.jsx(E.icon,{className:"w-4 h-4"}),E.label]},E.key))})]}),a.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-6",children:[m==="articles"&&a.jsxs(a.Fragment,{children:[d&&a.jsx("div",{className:"mb-6",children:a.jsx(kG,{article:d,onSave:w,onCancel:()=>h(null)})}),!d&&a.jsxs("div",{className:"flex items-center justify-between mb-5",children:[a.jsxs("h2",{className:"font-headline font-bold text-xl text-brand-black",children:["Articles ",!c&&a.jsxs("span",{className:"font-body text-sm font-normal text-gray-500 ml-2",children:["(",o.length," total)"]})]}),a.jsxs("button",{onClick:()=>h({...xG}),className:"flex items-center gap-2 bg-brand-red hover:bg-brand-red-dark text-white font-bold px-4 py-2 text-sm transition-colors font-body",children:[a.jsx(No,{className:"w-4 h-4"}
1159)," New Article"]})]}),!d&&(c?a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx(_e,{className:"w-8 h-8 animate-spin text-brand-red"})}):a.jsx("div",{className:"bg-white border border-gray-200 overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm font-body",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b-2 border-brand-black text-left text-xs font-bold uppercase tracking-wider text-gray-500",children:[a.jsx("th",{className:"px-4 py-3",children:"Headline"}),a.jsx("th",{className:"px-4 py-3 hidden sm:table-cell",children:"Category"}),a.jsx("th",{className:"px-4 py-3 hidden md:table-cell",children:"Author"}),a.jsx("th",{className:"px-4 py-3 hidden lg:table-cell",children:"Date"}),a.jsx("th",{className:"px-4 py-3",children:"Status"}),a.jsx("th",{className:"px-4 py-3 text-right",children:"Actions"})]})}),a.jsxs("tbody",{className:"divide-y divide-gray-100",children:[o.map(E=>a.jsxs("tr",{className:"hover:bg-gray-50 transition-colors",children:[a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[E.image_url&&a.jsx("img",{src:E.image_url,alt:"",className:"w-10 h-8 object-cover rounded shrink-0"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-semibold text-brand-black line-clamp-1 max-w-[220px]",children:E.title}),E.is_breaking&&a.jsx("span",{className:"inline-block mt-0.5 text-xs bg-brand-red text-white px-1.5 py-0.5 font-bold uppercase tracking-wider",children:"Breaking"})]})]})}),a.jsx("td",{className:"px-4 py-3 hidden sm:table-cell",children:a.jsx("span",{className:"capitalize text-gray-600",children:E.category})}),a.jsx("td",{className:"px-4 py-3 hidden md:table-cell text-gray-600",children:E.author}),a.jsx("td",{className:"px-4 py-3 hidden lg:table-cell text-gray-400",children:xi(E.published_at??E.created_at)}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:`inline-block text-xs font-bold px-2 py-0.5 uppercase tracking-wider ${E.published?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"}`,children:E.published?"Live":"Draft"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsxs("button",{onClick:async()=>{await DR(E.id,!E.is_breaking),b()},title:E.is_breaking?"Remove from ticker":"Add to ticker",className:`flex items-center gap-1 text-xs font-bold px-2 py-0.5 rounded transition-colors ${E.is_breaking?"bg-brand-red text-white hover:bg-brand-red-dark":"bg-gray-100 text-gray-400 hover:bg-red-50 hover:text-brand-red"}`,children:[a.jsx(wu,{className:"w-3 h-3"}),E.is_breaking?"Breaking":"Ticker"]}),a.jsx("button",{onClick:()=>h({...E}),className:"p-1.5 text-gray-400 hover:text-brand-black hover:bg-gray-100 rounded transition-colors",title:"Edit",children:a.jsx(CU,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>{window.confirm(`Delete "${E.title}"?`)&&_(E.id)},disabled:f===E.id,className:"p-1.5 text-gray-400 hover:text-brand-red hover:bg-red-50 rounded transition-colors disabled:opacity-40",title:"Delete",children:f===E.id?a.jsx(_e,{className:"w-4 h-4 animate-spin"}):a.jsx(Sn,{className:"w-4 h-4"})})]})})]},E.id)),o.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:6,className:"px-4 py-12 text-center text-gray-400",children:'No articles yet. Click "New Article" to create one.'})})]})]})}))]}),m==="ads"&&a.jsx(EG,{}),m==="events"&&a.jsx(TG,{}),m==="breaking"&&a.jsx(DG,{onRefreshArticles:b,articles:o,articlesLoading:c}),m==="notices"&&a.jsx(Nq,{}),m==="obituaries"&&a.jsx(iW,{}),m==="games"&&a.jsx(uW,{}),m==="gallery"&&a.jsx(Bq,{}),m==="digital-paper"&&a.jsx(Hq,{}),m==="archive"&&a.jsx(gG,{}),m==="cms"&&a.jsx(Eq,{}),m==="timeline"&&a.jsx(qq,{}),m==="subscriber-extras"&&a.jsx(fW,{}),m==="livestream"&&N&&a.jsx(nW,{}),m==="staff"&&N&&a.jsx(jG,{currentUser:r}),m==="subscribers"&&N&&a.jsx(RG,{currentUser:r})]})]})}var Ai={},Xk="1.13.8",fT=typeof self=="object"&&self.self===self&&self||typeof global=="object"&&global.global===global&&global||Function("return this")()||{},av=Array.prototype,Yk=Object.prototype,pT=typeof Symbol<"u"?Symbol.prototype:null,PG=av.push,Zg=av.slice,rm=Yk.toString,IG=Yk.hasOwnProperty,hL=typeof ArrayBuffer<"u",LG=typeof DataView<"u",OG=Array.isArray,mT=Object.keys,gT=Object.create,yT=hL&&ArrayBuffer.isView,MG=isNaN,FG=isFinite,fL=!{toString:null}.propertyIsEnumerable("toString"),bT=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleStr
1159ing"],BG=Math.pow(2,53)-1;function kn(r,e){return e=e==null?r.length-1:+e,function(){for(var t=Math.max(arguments.length-e,0),n=Array(t),s=0;s<t;s++)n[s]=arguments[s+e];switch(e){case 0:return r.call(this,n);case 1:return r.call(this,arguments[0],n);case 2:return r.call(this,arguments[0],arguments[1],n)}var i=Array(e+1);for(s=0;s<e;s++)i[s]=arguments[s];return i[e]=n,r.apply(this,i)}}function Gl(r){var e=typeof r;return e==="function"||e==="object"&&!!r}function pL(r){return r===null}function Kk(r){return r===void 0}function Jk(r){return r===!0||r===!1||rm.call(r)==="[object Boolean]"}function mL(r){return!!(r&&r.nodeType===1)}function dn(r){var e="[object "+r+"]";return function(t){return rm.call(t)===e}}const ov=dn("String"),Zk=dn("Number"),gL=dn("Date"),yL=dn("RegExp"),bL=dn("Error"),Qk=dn("Symbol"),eC=dn("ArrayBuffer");var xL=dn("Function"),$G=fT.document&&fT.document.childNodes;typeof/./!="function"&&typeof Int8Array!="object"&&typeof $G!="function"&&(xL=function(r){return typeof r=="function"||!1});const un=xL,vL=dn("Object");var wL=LG&&(!/\[native code\]/.test(String(DataView))||vL(new DataView(new ArrayBuffer(8)))),tC=typeof Map<"u"&&vL(new Map),UG=dn("DataView");function HG(r){return r!=null&&un(r.getInt8)&&eC(r.buffer)}const nm=wL?HG:UG,Xl=OG||dn("Array");function Yl(r,e){return r!=null&&IG.call(r,e)}var lS=dn("Arguments");(function(){lS(arguments)||(lS=function(r){return Yl(r,"callee")})})();const lv=lS;function _L(r){return!Qk(r)&&FG(r)&&!isNaN(parseFloat(r))}function rC(r){return Zk(r)&&MG(r)}function nC(r){return function(){return r}}function NL(r){return function(e){var t=r(e);return typeof t=="number"&&t>=0&&t<=BG}}function SL(r){return function(e){return e==null?void 0:e[r]}}const Hb=SL("byteLength"),zG=NL(Hb);var qG=/\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;function WG(r){return yT?yT(r)&&!nm(r):zG(r)&&qG.test(rm.call(r))}const sC=hL?WG:nC(!1),ln=SL("length");function VG(r){for(var e={},t=r.length,n=0;n<t;++n)e[r[n]]=!0;return{contains:function(s){return e[s]===!0},push:function(s){return e[s]=!0,r.push(s)}}}function kL(r,e){e=VG(e);var t=bT.length,n=r.constructor,s=un(n)&&n.prototype||Yk,i="constructor";for(Yl(r,i)&&!e.contains(i)&&e.push(i);t--;)i=bT[t],i in r&&r[i]!==s[i]&&!e.contains(i)&&e.push(i)}function br(r){if(!Gl(r))return[];if(mT)return mT(r);var e=[];for(var t in r)Yl(r,t)&&e.push(t);return fL&&kL(r,e),e}function CL(r){if(r==null)return!0;var e=ln(r);return typeof e=="number"&&(Xl(r)||ov(r)||lv(r))?e===0:ln(br(r))===0}function iC(r,e){var t=br(e),n=t.length;if(r==null)return!n;for(var s=Object(r),i=0;i<n;i++){var o=t[i];if(e[o]!==s[o]||!(o in s))return!1}return!0}function ht(r){if(r instanceof ht)return r;if(!(this instanceof ht))return new ht(r);this._wrapped=r}ht.VERSION=Xk;ht.prototype.value=function(){return this._wrapped};ht.prototype.valueOf=ht.prototype.toJSON=ht.prototype.value;ht.prototype.toString=function(){return String(this._wrapped)};function xT(r){return new Uint8Array(r.buffer||r,r.byteOffset||0,Hb(r))}var vT="[object DataView]";function EL(r,e){for(var t=[{a:r,b:e}],n=[],s=[];t.length;){var i=t.pop();if(i===!0){n.pop(),s.pop();continue}if(r=i.a,e=i.b,r===e){if(r!==0||1/r===1/e)continue;return!1}if(r==null||e==null)return!1;if(r!==r){if(e!==e)continue;return!1}var o=typeof r;if(o!=="function"&&o!=="object"&&typeof e!="object")return!1;r instanceof ht&&(r=r._wrapped),e instanceof ht&&(e=e._wrapped);var l=rm.call(r);if(l!==rm.call(e))return!1;if(wL&&l=="[object Object]"&&nm(r)){if(!nm(e))return!1;l=vT}switch(l){case"[object RegExp]":case"[object String]":if(""+r==""+e)continue;return!1;case"[object Number]":t.push({a:+r,b:+e});continue;case"[object Date]":case"[object Boolean]":if(+r==+e)continue;return!1;case"[object Symbol]":if(pT.valueOf.call(r)===pT.valueOf.call(e))continue;return!1;case"[object ArrayBuffer]":case vT:t.push({a:xT(r),b:xT(e)});continue}var c=l==="[object Array]";if(!c&&sC(r)){var u=Hb(r);if(u!==Hb(e))return!1;if(r.buffer===e.buffer&&r.byteOffset===e.byteOffset)continue;c=!0}if(!c){if(typeof r!="object"||typeof e!="object")return!1;var d=r.constructor,h=e.constructor;if(d!==h&&!(un(d)&&d instanceof d&&un(h)&&h instanceof h)&&"constructor"in r&&"constructor"in e)return!1}for(var f=n.length;f--;)if(n[f]===r){if(s[f]===e)break;return!1}if(!(f>=0))if(n.push(r),s.push(e),t.push(!0),c){if(f=r.length,f!==e.length)return!1;for(;f--;)t.push({a:r[f],b:e[f]})}else{var p=br(r),m;if(f=p.length,br(e).length!==f)return!1;for(;f--;){if(m=p[f],!Yl(e,m))return!1;t.push({a:r[m],b:e[m]})}}}return!0}function Cf(r){if(!Gl(r))return[];var e=[];for(var t in r)e.push(t);return fL&&kL(r,e),e}function aC(r){var e=ln(r);return function(t){if(t==null)return!1;var n=Cf(t);if(ln(n))return!1;for(var s=0;s<e;s++)if(!un(t[r[s]]))return!1;return r!==TL||!un(t[oC])}}
1159var oC="forEach",jL="has",lC=["clear","delete"],AL=["get",jL,"set"],GG=lC.concat(oC,AL),TL=lC.concat(AL),XG=["add"].concat(lC,oC,jL);const DL=tC?aC(GG):dn("Map"),RL=tC?aC(TL):dn("WeakMap"),PL=tC?aC(XG):dn("Set"),IL=dn("WeakSet");function Ku(r){for(var e=br(r),t=e.length,n=Array(t),s=0;s<t;s++)n[s]=r[e[s]];return n}function LL(r){for(var e=br(r),t=e.length,n=Array(t),s=0;s<t;s++)n[s]=[e[s],r[e[s]]];return n}function cC(r){for(var e={},t=br(r),n=0,s=t.length;n<s;n++)e[r[t[n]]]=t[n];return e}function sm(r){var e=[];for(var t in r)un(r[t])&&e.push(t);return e.sort()}function uC(r,e){return function(t){var n=arguments.length;if(e&&(t=Object(t)),n<2||t==null)return t;for(var s=1;s<n;s++)for(var i=arguments[s],o=r(i),l=o.length,c=0;c<l;c++){var u=o[c];(!e||t[u]===void 0)&&(t[u]=i[u])}return t}}const dC=uC(Cf),lf=uC(br),hC=uC(Cf,!0);function YG(){return function(){}}function OL(r){if(!Gl(r))return{};if(gT)return gT(r);var e=YG();e.prototype=r;var t=new e;return e.prototype=null,t}function ML(r,e){var t=OL(r);return e&&lf(t,e),t}function FL(r){return Gl(r)?Xl(r)?r.slice():dC({},r):r}function BL(r,e){return e(r),r}function fC(r){return Xl(r)?r:[r]}ht.toPath=fC;function Qg(r){return ht.toPath(r)}function pC(r,e){for(var t=e.length,n=0;n<t;n++){if(r==null)return;r=r[e[n]]}return t?r:void 0}function mC(r,e,t){var n=pC(r,Qg(e));return Kk(n)?t:n}function $L(r,e){e=Qg(e);for(var t=e.length,n=0;n<t;n++){var s=e[n];if(!Yl(r,s))return!1;r=r[s]}return!!t}function cv(r){return r}function Mu(r){return r=lf({},r),function(e){return iC(e,r)}}function uv(r){return r=Qg(r),function(e){return pC(e,r)}}function e0(r,e,t){if(e===void 0)return r;switch(t??3){case 1:return function(n){return r.call(e,n)};case 3:return function(n,s,i){return r.call(e,n,s,i)};case 4:return function(n,s,i,o){return r.call(e,n,s,i,o)}}return function(){return r.apply(e,arguments)}}function UL(r,e,t){return r==null?cv:un(r)?e0(r,e,t):Gl(r)&&!Xl(r)?Mu(r):uv(r)}function dv(r,e){return UL(r,e,1/0)}ht.iteratee=dv;function Wn(r,e,t){return ht.iteratee!==dv?ht.iteratee(r,e):UL(r,e,t)}function HL(r,e,t){e=Wn(e,t);for(var n=br(r),s=n.length,i={},o=0;o<s;o++){var l=n[o];i[l]=e(r[l],l,r)}return i}function gC(){}function zL(r){return r==null?gC:function(e){return mC(r,e)}}function qL(r,e,t){var n=Array(Math.max(0,r));e=e0(e,t,1);for(var s=0;s<r;s++)n[s]=e(s);return n}function zb(r,e){return e==null&&(e=r,r=0),r+Math.floor(Math.random()*(e-r+1))}const cf=Date.now||function(){return new Date().getTime()};function WL(r){var e=function(i){return r[i]},t="(?:"+br(r).join("|")+")",n=RegExp(t),s=RegExp(t,"g");return function(i){return i=i==null?"":""+i,n.test(i)?i.replace(s,e):i}}const VL={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},GL=WL(VL),KG=cC(VL),XL=WL(KG),YL=ht.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var o1=/(.)^/,JG={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},ZG=/\\|'|\r|\n|\u2028|\u2029/g;function QG(r){return"\\"+JG[r]}var eX=/^\s*(\w|\$)+\s*$/;function KL(r,e,t){!e&&t&&(e=t),e=hC({},e,ht.templateSettings);var n=RegExp([(e.escape||o1).source,(e.interpolate||o1).source,(e.evaluate||o1).source].join("|")+"|$","g"),s=0,i="__p+='";r.replace(n,function(u,d,h,f,p){return i+=r.slice(s,p).replace(ZG,QG),s=p+u.length,d?i+=`'+
1160((__t=(`+d+`))==null?'':_.escape(__t))+
1161'`:h?i+=`'+
1162((__t=(`+h+`))==null?'':__t)+
1163'`:f&&(i+=`';
1164`+f+`
1165__p+='`),u}),i+=`';
1166`;var o=e.variable;if(o){if(!eX.test(o))throw new Error("variable is not a bare identifier: "+o)}else i=`with(obj||{}){
1167`+i+`}
1168`,o="obj";i=`var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};
1169`+i+`return __p;
1170`;var l;try{l=new Function(o,"_",i)}catch(u){throw u.source=i,u}var c=function(u){return l.call(this,u,ht)};return c.source="function("+o+`){
1171`+i+"}",c}function JL(r,e,t){e=Qg(e);var n=e.length;if(!n)return un(t)?t.call(r):t;for(var s=0;s<n;s++){var i=r==null?void 0:r[e[s]];i===void 0&&(i=t,s=n),r=un(i)?i.call(r):i}return r}var tX=0;function ZL(r){var e=++tX+"";return r?r+e:e}function QL(r){var e=ht(r);return e._chain=!0,e}function e8(r,e,t,n,s){if(!(n instanceof e))return r.apply(t,s);var i=OL(r.prototype),o=r.apply(i,s);
1171return Gl(o)?o:i}var Ju=kn(function(r,e){var t=Ju.placeholder,n=function(){for(var s=0,i=e.length,o=Array(i),l=0;l<i;l++)o[l]=e[l]===t?arguments[s++]:e[l];for(;s<arguments.length;)o.push(arguments[s++]);return e8(r,n,this,this,o)};return n});Ju.placeholder=ht;const yC=kn(function(r,e,t){if(!un(r))throw new TypeError("Bind must be called on a function");var n=kn(function(s){return e8(r,n,e,this,t.concat(s))});return n}),gs=NL(ln);function Ef(r,e,t){!e&&e!==0&&(e=1/0);for(var n=[],s=0,i=0,o=ln(r)||0,l=[];;){if(i>=o){if(!l.length)break;var c=l.pop();i=c.i,r=c.v,o=ln(r);continue}var u=r[i++];l.length>=e?n[s++]=u:gs(u)&&(Xl(u)||lv(u))?(l.push({i,v:r}),i=0,r=u,o=ln(r)):t||(n[s++]=u)}return n}const t8=kn(function(r,e){e=Ef(e,!1,!1);var t=e.length;if(t<1)throw new Error("bindAll must be passed function names");for(;t--;){var n=e[t];r[n]=yC(r[n],r)}return r});function r8(r,e){var t=function(n){var s=t.cache,i=""+(e?e.apply(this,arguments):n);return Yl(s,i)||(s[i]=r.apply(this,arguments)),s[i]};return t.cache={},t}const bC=kn(function(r,e,t){return setTimeout(function(){return r.apply(null,t)},e)}),n8=Ju(bC,ht,1);function s8(r,e,t){var n,s,i,o,l=0;t||(t={});var c=function(){l=t.leading===!1?0:cf(),n=null,o=r.apply(s,i),n||(s=i=null)},u=function(){var d=cf();!l&&t.leading===!1&&(l=d);var h=e-(d-l);return s=this,i=arguments,h<=0||h>e?(n&&(clearTimeout(n),n=null),l=d,o=r.apply(s,i),n||(s=i=null)):!n&&t.trailing!==!1&&(n=setTimeout(c,h)),o};return u.cancel=function(){clearTimeout(n),l=0,n=s=i=null},u}function i8(r,e,t){var n,s,i,o,l,c=function(){var d=cf()-s;e>d?n=setTimeout(c,e-d):(n=null,t||(o=r.apply(l,i)),n||(i=l=null))},u=kn(function(d){return l=this,i=d,s=cf(),n||(n=setTimeout(c,e),t&&(o=r.apply(l,i))),o});return u.cancel=function(){clearTimeout(n),n=i=l=null},u}function a8(r,e){return Ju(e,r)}function hv(r){return function(){return!r.apply(this,arguments)}}function o8(){var r=arguments,e=r.length-1;return function(){for(var t=e,n=r[e].apply(this,arguments);t--;)n=r[t].call(this,n);return n}}function l8(r,e){return function(){if(--r<1)return e.apply(this,arguments)}}function xC(r,e){var t;return function(){return--r>0&&(t=e.apply(this,arguments)),r<=1&&(e=null),t}}const c8=Ju(xC,2);function vC(r,e,t){e=Wn(e,t);for(var n=br(r),s,i=0,o=n.length;i<o;i++)if(s=n[i],e(r[s],s,r))return s}function u8(r){return function(e,t,n){t=Wn(t,n);for(var s=ln(e),i=r>0?0:s-1;i>=0&&i<s;i+=r)if(t(e[i],i,e))return i;return-1}}const fv=u8(1),wC=u8(-1);function _C(r,e,t,n){t=Wn(t,n,1);for(var s=t(e),i=0,o=ln(r);i<o;){var l=Math.floor((i+o)/2);t(r[l])<s?i=l+1:o=l}return i}function d8(r,e,t){return function(n,s,i){var o=0,l=ln(n);if(typeof i=="number")r>0?o=i>=0?i:Math.max(i+l,o):l=i>=0?Math.min(i+1,l):i+l+1;else if(t&&i&&l)return i=t(n,s),n[i]===s?i:-1;if(s!==s)return i=e(Zg.call(n,o,l),rC),i>=0?i+o:-1;for(i=r>0?o:l-1;i>=0&&i<l;i+=r)if(n[i]===s)return i;return-1}}const NC=d8(1,fv,_C),h8=d8(-1,wC);function im(r,e,t){var n=gs(r)?fv:vC,s=n(r,e,t);if(s!==void 0&&s!==-1)return r[s]}function f8(r,e){return im(r,Mu(e))}function Ei(r,e,t){e=e0(e,t);var n,s;if(gs(r))for(n=0,s=r.length;n<s;n++)e(r[n],n,r);else{var i=br(r);for(n=0,s=i.length;n<s;n++)e(r[i[n]],i[n],r)}return r}function bo(r,e,t){e=Wn(e,t);for(var n=!gs(r)&&br(r),s=(n||r).length,i=Array(s),o=0;o<s;o++){var l=n?n[o]:o;i[o]=e(r[l],l,r)}return i}function p8(r){var e=function(t,n,s,i){var o=!gs(t)&&br(t),l=(o||t).length,c=r>0?0:l-1;for(i||(s=t[o?o[c]:c],c+=r);c>=0&&c<l;c+=r){var u=o?o[c]:c;s=n(s,t[u],u,t)}return s};return function(t,n,s,i){var o=arguments.length>=3;return e(t,e0(n,i,4),s,o)}}const Yd=p8(1),qb=p8(-1);function Ol(r,e,t){var n=[];return e=Wn(e,t),Ei(r,function(s,i,o){e(s,i,o)&&n.push(s)}),n}function m8(r,e,t){return Ol(r,hv(Wn(e)),t)}function Wb(r,e,t){e=Wn(e,t);for(var n=!gs(r)&&br(r),s=(n||r).length,i=0;i<s;i++){var o=n?n[i]:i;if(!e(r[o],o,r))return!1}return!0}function Vb(r,e,t){e=Wn(e,t);for(var n=!gs(r)&&br(r),s=(n||r).length,i=0;i<s;i++){var o=n?n[i]:i;if(e(r[o],o,r))return!0}return!1}function $s(r,e,t,n){return gs(r)||(r=Ku(r)),(typeof t!="number"||n)&&(t=0),NC(r,e,t)>=0}const g8=kn(function(r,e,t){var n,s;return un(e)?s=e:(e=Qg(e),n=e.slice(0,-1),e=e[e.length-1]),bo(r,function(i){var o=s;if(!o){if(n&&n.length&&(i=pC(i,n)),i==null)return;o=i[e]}return o==null?o:o.apply(i,t)})});function pv(r,e){return bo(r,uv(e))}function y8(r,e){return Ol(r,Mu(e))}function SC(r,e,t){var n=-1/0,s=-1/0,i,o;
1171if(e==null||typeof e=="number"&&typeof r[0]!="object"&&r!=null){r=gs(r)?r:Ku(r);for(var l=0,c=r.length;l<c;l++)i=r[l],i!=null&&i>n&&(n=i)}else e=Wn(e,t),Ei(r,function(u,d,h){o=e(u,d,h),(o>s||o===-1/0&&n===-1/0)&&(n=u,s=o)});return n}function b8(r,e,t){var n=1/0,s=1/0,i,o;if(e==null||typeof e=="number"&&typeof r[0]!="object"&&r!=null){r=gs(r)?r:Ku(r);for(var l=0,c=r.length;l<c;l++)i=r[l],i!=null&&i<n&&(n=i)}else e=Wn(e,t),Ei(r,function(u,d,h){o=e(u,d,h),(o<s||o===1/0&&n===1/0)&&(n=u,s=o)});return n}var rX=/[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;function kC(r){return r?Xl(r)?Zg.call(r):ov(r)?r.match(rX):gs(r)?bo(r,cv):Ku(r):[]}function CC(r,e,t){if(e==null||t)return gs(r)||(r=Ku(r)),r[zb(r.length-1)];var n=kC(r),s=ln(n);e=Math.max(Math.min(e,s),0);for(var i=s-1,o=0;o<e;o++){var l=zb(o,i),c=n[o];n[o]=n[l],n[l]=c}return n.slice(0,e)}function x8(r){return CC(r,1/0)}function v8(r,e,t){var n=0;return e=Wn(e,t),pv(bo(r,function(s,i,o){return{value:s,index:n++,criteria:e(s,i,o)}}).sort(function(s,i){var o=s.criteria,l=i.criteria;if(o!==l){if(o>l||o===void 0)return 1;if(o<l||l===void 0)return-1}return s.index-i.index}),"value")}function mv(r,e){return function(t,n,s){var i=e?[[],[]]:{};return n=Wn(n,s),Ei(t,function(o,l){var c=n(o,l,t);r(i,o,c)}),i}}const w8=mv(function(r,e,t){Yl(r,t)?r[t].push(e):r[t]=[e]}),_8=mv(function(r,e,t){r[t]=e}),N8=mv(function(r,e,t){Yl(r,t)?r[t]++:r[t]=1}),S8=mv(function(r,e,t){r[t?0:1].push(e)},!0);function k8(r){return r==null?0:gs(r)?r.length:br(r).length}function nX(r,e,t){return e in t}const EC=kn(function(r,e){var t={},n=e[0];if(r==null)return t;un(n)?(e.length>1&&(n=e0(n,e[1])),e=Cf(r)):(n=nX,e=Ef(e,!1,!1),r=Object(r));for(var s=0,i=e.length;s<i;
1171s++){var o=e[s],l=r[o];n(l,o,r)&&(t[o]=l)}return t}),C8=kn(function(r,e){var t=e[0],n;return un(t)?(t=hv(t),e.length>1&&(n=e[1])):(e=bo(Ef(e,!1,!1),String),t=function(s,i){return!$s(e,i)}),EC(r,t,n)});function jC(r,e,t){return Zg.call(r,0,Math.max(0,r.length-(e==null||t?1:e)))}function Kd(r,e,t){return r==null||r.length<1?e==null||t?void 0:[]:e==null||t?r[0]:jC(r,r.length-e)}function ku(r,e,t){return Zg.call(r,e==null||t?1:e)}function E8(r,e,t){return r==null||r.length<1?e==null||t?void 0:[]:e==null||t?r[r.length-1]:ku(r,Math.max(0,r.length-e))}function j8(r){return Ol(r,Boolean)}function A8(r,e){return Ef(r,e,!1)}const AC=kn(function(r,e){return e=Ef(e,!0,!0),Ol(r,function(t){return!$s(e,t)})}),T8=kn(function(r,e){return AC(r,e)});function am(r,e,t,n){Jk(e)||(n=t,t=e,e=!1),t!=null&&(t=Wn(t,n));for(var s=[],i=[],o=0,l=ln(r);o<l;o++){var c=r[o],u=t?t(c,o,r):c;e&&!t?((!o||i!==u)&&s.push(c),i=u):t?$s(i,u)||(i.push(u),s.push(c)):$s(s,c)||s.push(c)}return s}const D8=kn(function(r){return am(Ef(r,!0,!0))});function R8(r){for(var e=[],t=arguments.length,n=0,s=ln(r);n<s;n++){var i=r[n];if(!$s(e,i)){var o;for(o=1;o<t&&$s(arguments[o],i);o++);o===t&&e.push(i)}}return e}function om(r){for(var e=r&&SC(r,ln).length||0,t=Array(e),n=0;n<e;n++)t[n]=pv(r,n);return t}const P8=kn(om);function I8(r,e){for(var t={},n=0,s=ln(r);n<s;n++)e?t[r[n]]=e[n]:t[r[n][0]]=r[n][1];return t}function L8(r,e,t){e==null&&(e=r||0,r=0),t||(t=e<r?-1:1);for(var n=Math.max(Math.ceil((e-r)/t),0),s=Array(n),i=0;i<n;i++,r+=t)s[i]=r;return s}function O8(r,e){if(e==null||e<1)return[];for(var t=[],n=0,s=r.length;n<s;)t.push(Zg.call(r,n,n+=e));return t}function TC(r,e){return r._chain?ht(e).chain():e}function DC(r){return Ei(sm(r),function(e){var t=ht[e]=r[e];ht.prototype[e]=function(){var n=[this._wrapped];return PG.apply(n,arguments),TC(this,t.apply(ht,n))}}),ht}Ei(["pop","push","reverse","shift","sort","splice","unshift"],function(r){var e=av[r];ht.prototype[r]=function(){var t=this._wrapped;return t!=null&&(e.apply(t,arguments),(r==="shift"||r==="splice")&&t.length===0&&delete t[0]),TC(this,t)}});Ei(["concat","join","slice"],function(r){var e=av[r];ht.prototype[r]=function(){var t=this._wrapped;return t!=null&&(t=e.apply(t,arguments)),TC(this,t)}});const sX=Object.freeze(Object.defineProperty({__proto__:null,VERSION:Xk,after:l8,all:Wb,allKeys:Cf,any:Vb,assign:lf,before:xC,bind:yC,bindAll:t8,chain:QL,chunk:O8,clone:FL,collect:bo,compact:j8,compose:o8,constant:nC,contains:$s,countBy:N8,create:ML,debounce:i8,default:ht,defaults:hC,defer:n8,delay:bC,detect:im,difference:AC,drop:ku,each:Ei,escape:GL,every:Wb,extend:dC,extendOwn:lf,filter:Ol,find:im,findIndex:fv,findKey:vC,findLastIndex:wC,findWhere:f8,first:Kd,flatten:A8,foldl:Yd,foldr:qb,forEach:Ei,functions:sm,get:mC,groupBy:w8,has:$L,head:Kd,identity:cv,include:$s,includes:$s,indexBy:_8,indexOf:NC,initial:jC,inject:Yd,intersection:R8,invert:cC,invoke:g8,isArguments:lv,isArray:Xl,isArrayBuffer:eC,isBoolean:Jk,isDataView:nm,isDate:gL,isElement:mL,isEmpty:CL,isEqual:EL,isError:bL,isFinite:_L,isFunction:un,isMap:DL,isMatch:iC,isNaN:rC,isNull:pL,isNumber:Zk,isObject:Gl,isRegExp:yL,isSet:PL,isString:ov,isSymbol:Qk,isTypedArray:sC,isUndefined:Kk,isWeakMap:RL,isWeakSet:IL,iteratee:dv,keys:br,last:E8,lastIndexOf:h8,map:bo,mapObject:HL,matcher:Mu,matches:Mu,max:SC,memoize:r8,methods:sm,min:b8,mixin:DC,negate:hv,noop:gC,now:cf,object:I8,omit:C8,once:c8,pairs:LL,partial:Ju,partition:S8,pick:EC,pluck:pv,property:uv,propertyOf:zL,random:zb,range:L8,reduce:Yd,reduceRight:qb,reject:m8,rest:ku,restArguments:kn,result:JL,sample:CC,select:Ol,shuffle:x8,size:k8,some:Vb,sortBy:v8,sortedIndex:_C,tail:ku,take:Kd,tap:BL,template:KL,templateSettings:YL,throttle:s8,times:qL,toArray:kC,toPath:fC,transpose:om,unescape:XL,union:D8,uniq:am,unique:am,uniqueId:ZL,unzip:om,values:Ku,where:y8,without:T8,wrap:a8,zip:P8},Symbol.toStringTag,{value:"Module"}));var cS=DC(sX);cS._=cS;const iX=Object.freeze(Object.defineProperty({__proto__:null,VERSION:Xk,after:l8,all:Wb,allKeys:Cf,any:Vb,assign:lf,before:xC,bind:yC,bindAll:t8,chain:QL,chunk:O8,clone:FL,collect:bo,compact:j8,compose:o8,constant:nC,contains:$s,countBy:N8,create:ML,debounce:i8,default:cS,defaults:hC,defer:n8,delay:bC,detect:im,difference:AC,drop:ku,each:Ei,escape:GL,every:Wb,extend:dC,extendOwn:lf,filter:Ol,find:im,findIndex:fv,findKey:vC,findLastIndex:wC,findWhere:f8,first:Kd,flatten:A8,foldl:Yd,foldr:qb,forEach:Ei,functions:sm,get:mC,groupBy:w8,has:$L,head:Kd,identity:cv,include:$s,includes:$s,indexBy:_8,indexOf:NC,initial:jC,inject:Yd,intersection:R8,invert:cC,invoke:g8,isArguments:lv,isArray:Xl,isArrayBuffer:eC,isBoolean:Jk,isDataView:nm,isDate:gL,isElement:mL,isEmpty:CL,isEqual:EL,isError:bL,isFinite:_L,isFunction:un,isMap:DL,isMatch:iC,isNaN:rC,isNull:pL,isNumber:Zk,isObject:Gl,isRegExp:yL,isSet:PL,isString:ov,isSymbol:Qk,isTypedArray:sC,isUndefined:Kk,isWeakMap:RL,isWeakSet:IL,iteratee:dv,ke
1171ys:br,last:E8,lastIndexOf:h8,map:bo,mapObject:HL,matcher:Mu,matches:Mu,max:SC,memoize:r8,methods:sm,min:b8,mixin:DC,negate:hv,noop:gC,now:cf,object:I8,omit:C8,once:c8,pairs:LL,partial:Ju,partition:S8,pick:EC,pluck:pv,property:uv,propertyOf:zL,random:zb,range:L8,reduce:Yd,reduceRight:qb,reject:m8,rest:ku,restArguments:kn,result:JL,sample:CC,select:Ol,shuffle:x8,size:k8,some:Vb,sortBy:v8,sortedIndex:_C,tail:ku,take:Kd,tap:BL,template:KL,templateSettings:YL,throttle:s8,times:qL,toArray:kC,toPath:fC,transpose:om,unescape:XL,union:D8,uniq:am,unique:am,uniqueId:ZL,unzip:om,values:Ku,where:y8,without:T8,wrap:a8,zip:P8},Symbol.toStringTag,{value:"Module"})),er=f3(iX);var RC={},Tr={},M8={exports:{}},q0={exports:{}},wT;function jf(){if(wT)return q0.exports;wT=1;var r=function(){return this===void 0}();if(r)q0.exports={freeze:Object.freeze,defineProperty:Object.defineProperty,getDescriptor:Object.getOwnPropertyDescriptor,keys:Object.keys,names:Object.getOwnPropertyNames,getPrototypeOf:Object.getPrototypeOf,isArray:Array.isArray,isES5:r,propertyIsWritable:function(d,h){var f=Object.getOwnPropertyDescriptor(d,h);return!!(!f||f.writable||f.set)}};else{var e={}.hasOwnProperty,t={}.toString,n={}.constructor.prototype,s=function(d){var h=[];for(var f in d)e.call(d,f)&&h.push(f);return h},i=function(d,h){return{value:d[h]}},o=function(d,h,f){return d[h]=f.value,d},l=function(d){return d},c=function(d){try{return Object(d).constructor.prototype}catch{return n}},u=function(d){try{return t.call(d)==="[object Array]"}catch{return!1}};q0.exports={isArray:u,keys:s,names:s,defineProperty:o,getDescriptor:i,freeze:l,getPrototypeOf:c,isES5:r,propertyIsWritable:function(){return!0}}}return q0.exports}var l1,_T;function Tt(){if(_T)return l1;_T=1;var r={},e=jf(),t=typeof navigator>"u",n={e:{}},s,i=typeof self<"u"?self:typeof window<"u"?window:typeof Be<"u"||Be!==void 0?Be:null;function o(){try{var V=s;return s=null,V.apply(this,arguments)}catch(K){return n.e=K,n}}function l(V){return s=V,o}var c=function(V,K){var ee={}.hasOwnProperty;function Z(){this.constructor=V,this.constructor$=K;for(var ie in K.prototype)ee.call(K.prototype,ie)&&ie.charAt(ie.length-1)!=="$"&&(this[ie+"$"]=K.prototype[ie])}return Z.prototype=K.prototype,V.prototype=new Z,V.prototype};function u(V){return V==null||V===!0||V===!1||typeof V=="string"||typeof V=="number"}function d(V){return typeof V=="function"||typeof V=="object"&&V!==null}function h(V){return u(V)?new Error(E(V)):V}function f(V,K){var ee=V.length,Z=new Array(ee+1),ie;for(ie=0;ie<ee;++ie)Z[ie]=V[ie];return Z[ie]=K,Z}function p(V,K,ee){if(e.isES5){var Z=Object.getOwnPropertyDescriptor(V,K);if(Z!=null)return Z.get==null&&Z.set==null?Z.value:ee}else return{}.hasOwnProperty.call(V,K)?V[K]:void 0}function m(V,K,ee){if(u(V))return V;var Z={value:ee,configurable:!0,enumerable:!1,writable:!0};return e.defineProperty(V,K,Z),V}function g(V){throw V}var v=function(){var V=[Array.prototype,Object.prototype,Function.prototype],K=function(ie){for(var pe=0;pe<V.length;++pe)if(V[pe]===ie)return!0;return!1};if(e.isES5){var ee=Object.getOwnPropertyNames;return function(ie){for(var pe=[],me=Object.create(null);ie!=null&&!K(ie);){var Oe;try{Oe=ee(ie)}catch{return pe}for(var De=0;De<Oe.length;++De){var re=Oe[De];if(!me[re]){me[re]=!0;var fe=Object.getOwnPropertyDescriptor(ie,re);fe!=null&&fe.get==null&&fe.set==null&&pe.push(re)}}ie=e.getPrototypeOf(ie)}return pe}}else{var Z={}.hasOwnProperty;return function(ie){if(K(ie))return[];var pe=[];e:for(var me in ie)if(Z.call(ie,me))pe.push(me);else{for(var Oe=0;Oe<V.length;++Oe)if(Z.call(V[Oe],me))continue e;pe.push(me)}return pe}}}(),b=/this\s*\.\s*\S+\s*=/;function y(V){try{if(typeof V=="function"){var K=e.names(V.prototype),ee=e.isES5&&K.length>1,Z=K.length>0&&!(K.length===1&&K[0]==="constructor"),ie=b.test(V+"")&&e.names(V).length>0;if(ee||Z||ie)return!0}return!1}catch{return!1}}function w(V){return V}var _=/^[a-z$_][a-z$_0-9]*$/i;function N(V){return _.test(V)}function S(V,K,ee){for(var Z=new Array(V),ie=0;ie<V;++ie)Z[ie]=K+ie+ee;return Z}function E(V){try{return V+""}catch{return"[no string representation]"}}function T(V){return V!==null&&typeof V=="object"&&typeof V.message=="string"&&typeof V.name=="string"}function D(V){try{m(V,"isOperational",!0)}catch{}}function R(V){return V==null?!1:V instanceof Error.__BluebirdErrorTypes__.OperationalError||V.isOperational===!0}
1171function H(V){return T(V)&&e.propertyIsWritable(V,"stack")}var A=function(){return"stack"in new Error?function(V){return H(V)?V:new Error(E(V))}:function(V){if(H(V))return V;try{throw new Error(E(V))}catch(K){return K}}}();function U(V){return{}.toString.call(V)}function C(V,K,ee){for(var Z=e.names(V),ie=0;ie<Z.length;++ie){var pe=Z[ie];if(ee(pe))try{e.defineProperty(K,pe,e.getDescriptor(V,pe))}catch{}}}var M=function(V){return e.isArray(V)?V:null};if(typeof Symbol<"u"&&Symbol.iterator){var L=typeof Array.from=="function"?function(V){return Array.from(V)}:function(V){for(var K=[],ee=V[Symbol.iterator](),Z;!(Z=ee.next()).done;)K.push(Z.value);return K};M=function(V){return e.isArray(V)?V:V!=null&&typeof V[Symbol.iterator]=="function"?L(V):null}}var B=typeof process<"u"&&U(process).toLowerCase()==="[object process]",I=typeof process<"u"&&typeof r<"u";function z(V){return I?r[V]:void 0}function X(){if(typeof Promise=="function")try{var V=new Promise(function(){});if({}.toString.call(V)==="[object Promise]")return Promise}catch{}}function F(V,K){return V.bind(K)}var q={isClass:y,isIdentifier:N,inheritedDataKeys:v,getDataPropertyOrDefault:p,thrower:g,isArray:e.isArray,asArray:M,notEnumerableProp:m,isPrimitive:u,isObject:d,isError:T,canEvaluate:t,errorObj:n,tryCatch:l,inherits:c,withAppended:f,maybeWrapAsError:h,toFastProperties:w,filledRange:S,toString:E,canAttachTrace:H,ensureErrorObject:A,originatesFromRejection:R,markAsOriginatingFromRejection:D,classString:U,copyDescriptors:C,hasDevTools:typeof chrome<"u"&&chrome&&typeof chrome.loadTimes=="function",isNode:B,hasEnvVariables:I,env:z,global:i,getNativePromise:X,domainBind:F};q.isRecentNode=q.isNode&&function(){var V=process.versions.node.split(".").map(Number);return V[0]===0&&V[1]>10||V[0]>0}(),q.isNode&&q.toFastProperties(process);try{throw new Error}catch(V){q.lastLineError=V}return l1=q,l1}var W0={exports:{}},c1,NT;function aX(){if(NT)return c1;NT=1;var r=Tt(),e,t=function(){throw new Error(`No async scheduler available
1172
1173    See http://goo.gl/MqrFmX
1174`)},n=r.getNativePromise();if(r.isNode&&typeof MutationObserver>"u"){var s=Be.setImmediate,i=process.nextTick;e=r.isRecentNode?function(l){s.call(Be,l)}:function(l){i.call(process,l)}}else if(typeof n=="function"&&typeof n.resolve=="function"){var o=n.resolve();e=function(l){o.then(l)}}else typeof MutationObserver<"u"&&!(typeof window<"u"&&window.navigator&&(window.navigator.standalone||window.cordova))?e=function(){var l=document.createElement("div"),c={attributes:!0},u=!1,d=document.createElement("div"),h=new MutationObserver(function(){l.classList.toggle("foo"),u=!1});h.observe(d,c);var f=function(){u||(u=!0,d.classList.toggle("foo"))};return function(m){var g=new MutationObserver(function(){g.disconnect(),m()});g.observe(l,c),f()}}():typeof setImmediate<"u"?e=function(l){setImmediate(l)}:typeof setTimeout<"u"?e=function(l){setTimeout(l,0)}:e=t;return c1=e,c1}var u1,ST;function oX(){if(ST)return u1;ST=1;function r(t,n,s,i,o){for(var l=0;l<o;++l)s[l+i]=t[l+n],t[l+n]=void 0}function e(t){this._capacity=t,this._length=0,this._front=0}return e.prototype._willBeOverCapacity=function(t){return this._capacity<t},e.prototype._pushOne=function(t){var n=this.length();this._checkCapacity(n+1);var s=this._front+n&this._capacity-1;this[s]=t,this._length=n+1},e.prototype.push=function(t,n,s){var i=this.length()+3;if(this._willBeOverCapacity(i)){this._pushOne(t),this._pushOne(n),this._pushOne(s);return}var o=this._front+i-3;this._checkCapacity(i);var l=this._capacity-1;this[o+0&l]=t,this[o+1&l]=n,this[o+2&l]=s,this._length=i},e.prototype.shift=function(){var t=this._front,n=this[t];return this[t]=void 0,this._front=t+1&this._capacity-1,this._length--,n},e.prototype.length=function(){return this._length},e.prototype._checkCapacity=function(t){this._capacity<t&&this._resizeTo(this._capacity<<1)},e.prototype._resizeTo=function(t){var n=this._capacity;this._capacity=t;var s=this._front,i=this._length,o=s+i&n-1;r(this,0,this,n,o)},u1=e,u1}var kT;function lX(){if(kT)return W0.exports;kT=1;var r;try{throw new Error}catch(c){r=c}var e=aX(),t=oX(),n=Tt();
1174function s(){this._customScheduler=!1,this._isTickUsed=!1,this._lateQueue=new t(16),this._normalQueue=new t(16),this._haveDrainedQueues=!1,this._trampolineEnabled=!0;var c=this;this.drainQueues=function(){c._drainQueues()},this._schedule=e}s.prototype.setScheduler=function(c){var u=this._schedule;return this._schedule=c,this._customScheduler=!0,u},s.prototype.hasCustomScheduler=function(){return this._customScheduler},s.prototype.enableTrampoline=function(){this._trampolineEnabled=!0},s.prototype.disableTrampolineIfNecessary=function(){n.hasDevTools&&(this._trampolineEnabled=!1)},s.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},s.prototype.fatalError=function(c,u){u?(process.stderr.write("Fatal "+(c instanceof Error?c.stack:c)+`
1175`),process.exit(2)):this.throwLater(c)},s.prototype.throwLater=function(c,u){if(arguments.length===1&&(u=c,c=function(){throw u}),typeof setTimeout<"u")setTimeout(function(){c(u)},0);else try{this._schedule(function(){c(u)})}catch{throw new Error(`No async scheduler available
1176
1177    See http://goo.gl/MqrFmX
1178`)}};function i(c,u,d){this._lateQueue.push(c,u,d),this._queueTick()}function o(c,u,d){this._normalQueue.push(c,u,d),this._queueTick()}function l(c){this._normalQueue._pushOne(c),this._queueTick()}return n.hasDevTools?(s.prototype.invokeLater=function(c,u,d){this._trampolineEnabled?i.call(this,c,u,d):this._schedule(function(){setTimeout(function(){c.call(u,d)},100)})},s.prototype.invoke=function(c,u,d){this._trampolineEnabled?o.call(this,c,u,d):this._schedule(function(){c.call(u,d)})},s.prototype.settlePromises=function(c){this._trampolineEnabled?l.call(this,c):this._schedule(function(){c._settlePromises()})}):(s.prototype.invokeLater=i,s.prototype.invoke=o,s.prototype.settlePromises=l),s.prototype._drainQueue=function(c){for(;c.length()>0;){var u=c.shift();if(typeof u!="function"){u._settlePromises();continue}var d=c.shift(),h=c.shift();u.call(d,h)}},s.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)},s.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},s.prototype._reset=function(){this._isTickUsed=!1}
1178,W0.exports=s,W0.exports.firstLineError=r,W0.exports}var d1,CT;function Ml(){if(CT)return d1;CT=1;var r=jf(),e=r.freeze,t=Tt(),n=t.inherits,s=t.notEnumerableProp;function i(b,y){function w(_){if(!(this instanceof w))return new w(_);s(this,"message",typeof _=="string"?_:y),s(this,"name",b),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this)}return n(w,Error),w}var o,l,c=i("Warning","warning"),u=i("CancellationError","cancellation error"),d=i("TimeoutError","timeout error"),h=i("AggregateError","aggregate error");try{o=TypeError,l=RangeError}catch{o=i("TypeError","type error"),l=i("RangeError","range error")}for(var f="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),p=0;p<f.length;++p)typeof Array.prototype[f[p]]=="function"&&(h.prototype[f[p]]=Array.prototype[f[p]]);r.defineProperty(h.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0}),h.prototype.isOperational=!0;var m=0;h.prototype.toString=function(){var b=Array(m*4+1).join(" "),y=`
1179`+b+`AggregateError of:
1180`;m++,b=Array(m*4+1).join(" ");for(var w=0;w<this.length;++w){for(var _=this[w]===this?"[Circular AggregateError]":this[w]+"",N=_.split(`
1181`),S=0;S<N.length;++S)N[S]=b+N[S];_=N.join(`
1182`),y+=_+`
1183`}return m--,y};function g(b){if(!(this instanceof g))return new g(b);s(this,"name","OperationalError"),s(this,"message",b),this.cause=b,this.isOperational=!0,b instanceof Error?(s(this,"message",b.message),s(this,"stack",b.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}n(g,Error);var v=Error.__BluebirdErrorTypes__;return v||(v=e({CancellationError:u,TimeoutError:d,OperationalError:g,RejectionError:g,AggregateError:h}),r.defineProperty(Error,"__BluebirdErrorTypes__",{value:v,writable:!1,enumerable:!1,configurable:!1})),d1={Error,TypeError:o,RangeError:l,CancellationError:v.CancellationError,OperationalError:v.OperationalError,TimeoutError:v.TimeoutError,AggregateError:v.AggregateError,Warning:c},d1}var h1,ET;function cX(){return ET||(ET=1,h1=function(r,e){var t=Tt(),n=t.errorObj,s=t.isObject;function i(h,f){if(s(h)){if(h instanceof r)return h;var p=l(h);if(p===n){f&&f._pushContext();var m=r.reject(p.e);return f&&f._popContext(),m}else if(typeof p=="function"){if(u(h)){var m=new r(e);return h._then(m._fulfill,m._reject,void 0,m,null),m}return d(h,p,f)}}return h}function o(h){return h.then}function l(h){try{return o(h)}catch(f){return n.e=f,n}}var c={}.hasOwnProperty;function u(h){try{return c.call(h,"_promise0")}catch{return!1}}function d(h,f,p){var m=new r(e),g=m;p&&p._pushContext(),m._captureStackTrace(),p&&p._popContext();var v=!0,b=t.tryCatch(f).call(h,y,w);v=!1,m&&b===n&&(m._rejectCallback(b.e,!0,!0),m=null);function y(_){m&&(m._resolveCallback(_),m=null)}function w(_){m&&(m._rejectCallback(_,v,!0),m=null)}return g}return i}),h1}var f1,jT;function uX(){return jT||(jT=1,f1=function(r,e,t,n,s){var i=Tt();i.isArray;function o(c){switch(c){case-2:return[];case-3:return{}}}function l(c){var u=this._promise=new r(e);c instanceof r&&u._propagateFrom(c,3),u._setOnCancel(this),this._values=c,this._length=0,this._totalResolved=0,this._init(void 0,-2)}return i.inherits(l,s),l.prototype.length=function(){return this._length},l.prototype.promise=function(){return this._promise},l.prototype._init=function c(u,d){var h=t(this._values,this._promise);if(h instanceof r){h=h._target();var f=h._bitField;if(this._values=h,f&50397184)if(f&33554432)h=h._value();else return f&16777216?this._reject(h._reason()):this._cancel();else return this._promise._setAsyncGuaranteed(),h._then(c,this._reject,void 0,this,d)}if(h=i.asArray(h),h===null){var p=n("expecting an array or an iterable object but got "+i.classString(h)).reason();this._promise._rejectCallback(p,!1);return}if(h.length===0){d===-5?this._resolveEmptyArray():this._resolve(o(d));return}this._iterate(h)},l.prototype._iterate=function(c){var u=this.getActualLength(c.length);this._length=u,this._values=this.shouldCopyValues()?new Array(u):this._values;for(var d=this._promise,h=!1,f=null,p=0;p<u;++p){var m=t(c[p],d);m instanceof r?(m=m._target(),f=m._bitField):f=null,h?f!==null&&m.suppressUnhandledRejections():f!==null?f&50397184?f&33554432?h=this._promiseFulfilled(m._value(),p):f&16777216?h=this._promiseRe
1183jected(m._reason(),p):h=this._promiseCancelled(p):(m._proxy(this,p),this._values[p]=m):h=this._promiseFulfilled(m,p)}h||d._setAsyncGuaranteed()},l.prototype._isResolved=function(){return this._values===null},l.prototype._resolve=function(c){this._values=null,this._promise._fulfill(c)},l.prototype._cancel=function(){this._isResolved()||!this._promise._isCancellable()||(this._values=null,this._promise._cancel())},l.prototype._reject=function(c){this._values=null,this._promise._rejectCallback(c,!1)},l.prototype._promiseFulfilled=function(c,u){this._values[u]=c;var d=++this._totalResolved;return d>=this._length?(this._resolve(this._values),!0):!1},l.prototype._promiseCancelled=function(){return this._cancel(),!0},l.prototype._promiseRejected=function(c){return this._totalResolved++,this._reject(c),!0},l.prototype._resultCancelled=function(){if(!this._isResolved()){var c=this._values;if(this._cancel(),c instanceof r)c.cancel();else for(var u=0;u<c.length;++u)c[u]instanceof r&&c[u].cancel()}},l.prototype.shouldCopyValues=function(){return!0},l.prototype.getActualLength=function(c){return c},l}),f1}var p1,AT;function dX(){return AT||(AT=1,p1=function(r){var e=!1,t=[];r.prototype._promiseCreated=function(){},r.prototype._pushContext=function(){},r.prototype._popContext=function(){return null},r._peekContext=r.prototype._peekContext=function(){};function n(){this._trace=new n.CapturedTrace(i())}n.prototype._pushContext=function(){this._trace!==void 0&&(this._trace._promiseCreated=null,t.push(this._trace))},n.prototype._popContext=function(){if(this._trace!==void 0){var o=t.pop(),l=o._promiseCreated;return o._promiseCreated=null,l}return null};function s(){if(e)return new n}function i(){var o=t.length-1;if(o>=0)return t[o]}return n.CapturedTrace=null,n.create=s,n.deactivateLongStackTraces=function(){},n.activateLongStackTraces=function(){var o=r.prototype._pushContext,l=r.prototype._popContext,c=r._peekContext,u=r.prototype._peekContext,d=r.prototype._promiseCreated;n.deactivateLongStackTraces=function(){r.prototype._pushContext=o,r.prototype._popContext=l,r._peekContext=c,r.prototype._peekContext=u,r.prototype._promiseCreated=d,e=!1},e=!0,r.prototype._pushContext=n.prototype._pushContext,r.prototype._popContext=n.prototype._popContext,r._peekContext=r.prototype._peekContext=i,r.prototype._promiseCreated=function(){var h=this._peekContext();h&&h._promiseCreated==null&&(h._promiseCreated=this)}},n}),p1}var m1,TT;function hX(){return TT||(TT=1,m1=function(r,e){var t=r._getDomain,n=r._async,s=Ml().Warning,i=Tt(),o=i.canAttachTrace,l,c,u=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,d=/\((?:timers\.js):\d+:\d+\)/,h=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,f=null,p=null,m=!1,g,v=!!(i.env("BLUEBIRD_DEBUG")!=0&&(i.env("BLUEBIRD_DEBUG")||i.env("NODE_ENV")==="development")),b=!!(i.env("BLUEBIRD_WARNINGS")!=0&&(v||i.env("BLUEBIRD_WARNINGS"))),y=!!(i.env("BLUEBIRD_LONG_STACK_TRACES")!=0&&(v||i.env("BLUEBIRD_LONG_STACK_TRACES"))),w=i.env("BLUEBIRD_W_FORGOTTEN_RETURN")!=0&&(b||!!i.env("BLUEBIRD_W_FORGOTTEN_RETURN"));r.prototype.suppressUnhandledRejections=function(){var J=this._target();J._bitField=J._bitField&-1048577|524288},r.prototype._ensurePossibleRejectionHandled=function(){this._bitField&524288||(this._setRejectionIsUnhandled(),n.invokeLater(this._notifyUnhandledRejection,this,void 0))},r.prototype._notifyUnhandledRejectionIsHandled=function(){re("rejectionHandled",l,void 0,this)},r.prototype._setReturnedNonUndefined=function(){this._bitField=this._bitField|268435456},r.prototype._returnedNonUndefined=function(){return(this._bitField&268435456)!==0},r.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var J=this._settledValue();this._setUnhandledRejectionIsNotified(),re("unhandledRejection",c,J,this)}},r.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=this._bitField|262144},r.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=this._bitField&-262145},r.prototype._isUnhandledRejectionNotified=function(){return(this._bitField&262144)>0},r.prototype._setRejectionIsUnhandled=function(){this._bitField=this._bitField|1048576},r.prototype._unsetRejectionIsUnhandled=function(){this._bitField=this._bitField&-1048577,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},r.prototype._isRejectionUnhandled=function(){return(this._bitField&1048576)>0},r.prototype._warn=function(J,Q,se){return K(J,Q,se||this)},r.onPossiblyUnhandledRejection=function(J){var Q=t();c=typeof J=="function"?Q===null?J:i.domainBind(Q,J):void 0},r.onUnhandledRejectionHandled=function(J){var Q=t();l=typeof J=="function"?Q===null?J:i.domainBind(Q,J):void 0};var _=function(){};r.longStackTraces=function(){if(n.haveItemsQueued()&&!ae.longStackTraces)throw new Error(`cannot enable long stack traces after promises have been created
1184
1185    See http://goo.gl/MqrFmX
1186`);if(!ae.longStackTraces&&oe()){var J=r.prototype._captureStackTrace,Q=r.prototype._attachExtraTrace;ae.longStackTraces=!0,_=function(){if(n.haveItemsQueued()&&!ae.longStackTraces)throw new Error(`cannot enable long stack traces after promises have been created
1187
1188    See http://goo.gl/MqrFmX
1189`);r.prototype._captureStackTrace=J,r.prototype._attachExtraTrace=Q,e.deactivateLongStackTraces(),n.enableTrampoline(),ae.longStackTraces=!1},r.prototype._captureStackTrace=X,r.prototype._attachExtraTrace=F,e.activateLongStackTraces(),n.disableTrampolineIfNecessary()}},r.hasLongStackTraces=function(){return ae.longStackTraces&&oe()};var N=function(){try{if(typeof CustomEvent=="function"){var J=new CustomEvent("CustomEvent");return i.global.dispatchEvent(J),function(Q,se){var ue=new CustomEvent(Q.toLowerCase(),{detail:se,cancelable:!0});return!i.global.dispatchEvent(ue)}}else if(typeof Event=="function"){var J=new Event("CustomEvent");return i.global.dispatchEvent(J),function(se,ue){var Ne=new Event(se.toLowerCase(),{cancelable:!0});return Ne.detail=ue,!i.global.dispatchEvent(Ne)}}else{var J=document.createEvent("CustomEvent");return J.initCustomEvent("testingtheevent",!1,!0,{}),i.global.dispatchEvent(J),function(se,ue){var Ne=document.createEvent("CustomEvent");return Ne.initCustomEvent(se.toLowerCase(),!1,!0,ue),!i.global.dispatchEvent(Ne)}}}catch{}return function(){return!1}}(),S=function(){return i.isNode?function(){return process.emit.apply(process,arguments)}:i.global?function(J){var Q="on"+J.toLowerCase(),se=i.global[Q];
1189return se?(se.apply(i.global,[].slice.call(arguments,1)),!0):!1}:function(){return!1}}();function E(J,Q){return{promise:Q}}var T={promiseCreated:E,promiseFulfilled:E,promiseRejected:E,promiseResolved:E,promiseCancelled:E,promiseChained:function(J,Q,se){return{promise:Q,child:se}},warning:function(J,Q){return{warning:Q}},unhandledRejection:function(J,Q,se){return{reason:Q,promise:se}},rejectionHandled:E},D=function(J){var Q=!1;try{Q=S.apply(null,arguments)}catch(ue){n.throwLater(ue),Q=!0}var se=!1;try{se=N(J,T[J].apply(null,arguments))}catch(ue){n.throwLater(ue),se=!0}return se||Q};r.config=function(J){if(J=Object(J),"longStackTraces"in J&&(J.longStackTraces?r.longStackTraces():!J.longStackTraces&&r.hasLongStackTraces()&&_()),"warnings"in J){var Q=J.warnings;ae.warnings=!!Q,w=ae.warnings,i.isObject(Q)&&"wForgottenReturn"in Q&&(w=!!Q.wForgottenReturn)}if("cancellation"in J&&J.cancellation&&!ae.cancellation){if(n.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");r.prototype._clearCancellationData=M,r.prototype._propagateFrom=L,r.prototype._onCancel=U,r.prototype._setOnCancel=C,r.prototype._attachCancellationCallback=A,r.prototype._execute=H,I=L,ae.cancellation=!0}return"monitoring"in J&&(J.monitoring&&!ae.monitoring?(ae.monitoring=!0,r.prototype._fireEvent=D):!J.monitoring&&ae.monitoring&&(ae.monitoring=!1,r.prototype._fireEvent=R)),r};function R(){return!1}r.prototype._fireEvent=R,r.prototype._execute=function(J,Q,se){try{J(Q,se)}catch(ue){return ue}},r.prototype._onCancel=function(){},r.prototype._setOnCancel=function(J){},r.prototype._attachCancellationCallback=function(J){},r.prototype._captureStackTrace=function(){},r.prototype._attachExtraTrace=function(){},r.prototype._clearCancellationData=function(){},r.prototype._propagateFrom=function(J,Q){};function H(J,Q,se){var ue=this;try{J(Q,se,function(Ne){if(typeof Ne!="function")throw new TypeError("onCancel must be a function, got: "+i.toString(Ne));ue._attachCancellationCallback(Ne)})}catch(Ne){return Ne}}function A(J){if(!this._isCancellable())return this;var Q=this._onCancel();Q!==void 0?i.isArray(Q)?Q.push(J):this._setOnCancel([Q,J]):this._setOnCancel(J)}function U(){return this._onCancelField}function C(J){this._onCancelField=J}function M(){this._cancellationParent=void 0,this._onCancelField=void 0}function L(J,Q){if(Q&1){this._cancellationParent=J;var se=J._branchesRemainingToCancel;se===void 0&&(se=0),J._branchesRemainingToCancel=se+1}Q&2&&J._isBound()&&this._setBoundTo(J._boundTo)}function B(J,Q){Q&2&&J._isBound()&&this._setBoundTo(J._boundTo)}var I=B;function z(){var J=this._boundTo;return J!==void 0&&J instanceof r?J.isFulfilled()?J.value():void 0:J}function X(){this._trace=new he(this._peekContext())}function F(J,Q){if(o(J)){var se=this._trace;if(se!==void 0&&Q&&(se=se._parent),se!==void 0)se.attachExtraTrace(J);else if(!J.__stackCleaned__){var ue=Oe(J);i.notEnumerableProp(J,"stack",ue.message+`
1190`+ue.stack.join(`
1191`)),i.notEnumerableProp(J,"__stackCleaned__",!0)}}}function q(J,Q,se,ue,Ne){if(J===void 0&&Q!==null&&w){if(Ne!==void 0&&Ne._returnedNonUndefined()||!(ue._bitField&65535))return;se&&(se=se+" ");var ce="",le="";if(Q._trace){for(var be=Q._trace.stack.split(`
1192`),de=pe(be),Se=de.length-1;Se>=0;--Se){var ke=de[Se];if(!d.test(ke)){var Le=ke.match(h);Le&&(ce="at "+Le[1]+":"+Le[2]+":"+Le[3]+" ");break}}if(de.length>0){for(var Dt=de[0],Se=0;Se<be.length;++Se)if(be[Se]===Dt){Se>0&&(le=`
1193`+be[Se-1]);break}}}var Ut="a promise was created in a "+se+"handler "+ce+"but was not returned from it, see http://goo.gl/rRqMUw"+le;ue._warn(Ut,!0,Q)}}function V(J,Q){var se=J+" is deprecated and will be removed in a future version.";return Q&&(se+=" Use "+Q+" instead."),K(se)}function K(J,Q,se){if(ae.warnings){var ue=new s(J),Ne;if(Q)se._attachExtraTrace(ue);else if(ae.longStackTraces&&(Ne=r._peekContext()))Ne.attachExtraTrace(ue);else{var ce=Oe(ue);ue.stack=ce.message+`
1194`+ce.stack.join(`
1195`)}D("warning",ue)||De(ue,"",!0)}}function ee(J,Q){for(var se=0;se<Q.length-1;++se)Q[se].push("From previous event:"),Q[se]=Q[se].join(`
1196`);return se<Q.length&&(Q[se]=Q[se].join(`
1197`)),J+`
1198`+Q.join(`
1199`)}function Z(J){for(var Q=0;Q<J.length;++Q)(J[Q].length===0||Q+1<J.length&&J[Q][0]===J[Q+1][0])&&(J.splice(Q,1),Q--)}function ie(J){for(var Q=J[0],se=1;se<J.length;++se){for(var ue=J[se],Ne=Q.length-1,ce=Q[Ne],le=-1,be=ue.length-1;be>=0;--be)if(ue[be]===ce){le=be;break}for(var be=le;be>=0;--be){var de=ue[be];
1199if(Q[Ne]===de)Q.pop(),Ne--;else break}Q=ue}}function pe(J){for(var Q=[],se=0;se<J.length;++se){var ue=J[se],Ne=ue==="    (No stack trace)"||f.test(ue),ce=Ne&&ne(ue);Ne&&!ce&&(m&&ue.charAt(0)!==" "&&(ue="    "+ue),Q.push(ue))}return Q}function me(J){for(var Q=J.stack.replace(/\s+$/g,"").split(`
1200`),se=0;se<Q.length;++se){var ue=Q[se];if(ue==="    (No stack trace)"||f.test(ue))break}return se>0&&J.name!="SyntaxError"&&(Q=Q.slice(se)),Q}function Oe(J){var Q=J.stack,se=J.toString();return Q=typeof Q=="string"&&Q.length>0?me(J):["    (No stack trace)"],{message:se,stack:J.name=="SyntaxError"?Q:pe(Q)}}function De(J,Q,se){if(typeof console<"u"){var ue;if(i.isObject(J)){var Ne=J.stack;ue=Q+p(Ne,J)}else ue=Q+String(J);typeof g=="function"?g(ue,se):(typeof console.log=="function"||typeof console.log=="object")&&console.log(ue)}}function re(J,Q,se,ue){var Ne=!1;try{typeof Q=="function"&&(Ne=!0,J==="rejectionHandled"?Q(ue):Q(se,ue))}catch(ce){n.throwLater(ce)}J==="unhandledRejection"?!D(J,se,ue)&&!Ne&&De(se,"Unhandled rejection "):D(J,ue)}function fe(J){var Q;if(typeof J=="function")Q="[function "+(J.name||"anonymous")+"]";else{Q=J&&typeof J.toString=="function"?J.toString():i.toString(J);var se=/\[object [a-zA-Z0-9$_]+\]/;if(se.test(Q))try{var ue=JSON.stringify(J);Q=ue}catch{}Q.length===0&&(Q="(empty array)")}return"(<"+j(Q)+">, no stack trace)"}function j(J){var Q=41;return J.length<Q?J:J.substr(0,Q-3)+"..."}function oe(){return typeof ge=="function"}var ne=function(){return!1},G=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function W(J){var Q=J.match(G);if(Q)return{fileName:Q[1],line:parseInt(Q[2],10)}}function te(J,Q){if(oe()){for(var se=J.stack.split(`
1201`),ue=Q.stack.split(`
1202`),Ne=-1,ce=-1,le,be,de=0;de<se.length;++de){var Se=W(se[de]);if(Se){le=Se.fileName,Ne=Se.line;break}}for(var de=0;de<ue.length;++de){var Se=W(ue[de]);if(Se){be=Se.fileName,ce=Se.line;break}}Ne<0||ce<0||!le||!be||le!==be||Ne>=ce||(ne=function(ke){if(u.test(ke))return!0;var Le=W(ke);return!!(Le&&Le.fileName===le&&Ne<=Le.line&&Le.line<=ce)})}}function he(J){this._parent=J,this._promisesCreated=0;var Q=this._length=1+(J===void 0?0:J._length);ge(this,he),Q>32&&this.uncycle()}i.inherits(he,Error),e.CapturedTrace=he,he.prototype.uncycle=function(){var J=this._length;if(!(J<2)){for(var Q=[],se={},ue=0,Ne=this;Ne!==void 0;++ue)Q.push(Ne),Ne=Ne._parent;J=this._length=ue;for(var ue=J-1;ue>=0;--ue){var ce=Q[ue].stack;se[ce]===void 0&&(se[ce]=ue)}for(var ue=0;ue<J;++ue){var le=Q[ue].stack,be=se[le];if(be!==void 0&&be!==ue){be>0&&(Q[be-1]._parent=void 0,Q[be-1]._length=1),Q[ue]._parent=void 0,Q[ue]._length=1;var de=ue>0?Q[ue-1]:this;be<J-1?(de._parent=Q[be+1],de._parent.uncycle(),de._length=de._parent._length+1):(de._parent=void 0,de._length=1);for(var Se=de._length+1,ke=ue-2;ke>=0;--ke)Q[ke]._length=Se,Se++;return}}}},he.prototype.attachExtraTrace=function(J){if(!J.__stackCleaned__){this.uncycle();for(var Q=Oe(J),se=Q.message,ue=[Q.stack],Ne=this;Ne!==void 0;)ue.push(pe(Ne.stack.split(`
1203`))),Ne=Ne._parent;ie(ue),Z(ue),i.notEnumerableProp(J,"stack",ee(se,ue)),i.notEnumerableProp(J,"__stackCleaned__",!0)}};var ge=function(){var Q=/^\s*at\s*/,se=function(le,be){return typeof le=="string"?le:be.name!==void 0&&be.message!==void 0?be.toString():fe(be)};if(typeof Error.stackTraceLimit=="number"&&typeof Error.captureStackTrace=="function"){Error.stackTraceLimit+=6,f=Q,p=se;var ue=Error.captureStackTrace;return ne=function(le){return u.test(le)},function(le,be){Error.stackTraceLimit+=6,ue(le,be),Error.stackTraceLimit-=6}}var Ne=new Error;if(typeof Ne.stack=="string"&&Ne.stack.split(`
1204`)[0].indexOf("stackDetection@")>=0)return f=/@/,p=se,m=!0,function(be){be.stack=new Error().stack};var ce;try{throw new Error}catch(le){ce="stack"in le}return!("stack"in Ne)&&ce&&typeof Error.stackTraceLimit=="number"?(f=Q,p=se,function(be){Error.stackTraceLimit+=6;try{throw new Error}catch(de){be.stack=de.stack}Error.stackTraceLimit-=6}):(p=function(le,be){return typeof le=="string"?le:(typeof be=="object"||typeof be=="function")&&be.name!==void 0&&be.message!==void 0?be.toString():fe(be)},null)}();typeof console<"u"&&typeof console.warn<"u"&&(g=function(J){console.warn(J)},i.isNode&&process.stderr.isTTY?g=function(J,Q){var se=Q?"\x1B[33m":"\x1B[31m";console.warn(se+J+`\x1B[0m
1205`)}
1205:!i.isNode&&typeof new Error().stack=="string"&&(g=function(J,Q){console.warn("%c"+J,Q?"color: darkorange":"color: red")}));var ae={warnings:b,longStackTraces:!1,cancellation:!1,monitoring:!1};return y&&r.longStackTraces(),{longStackTraces:function(){return ae.longStackTraces},warnings:function(){return ae.warnings},cancellation:function(){return ae.cancellation},monitoring:function(){return ae.monitoring},propagateFromFunction:function(){return I},boundValueFunction:function(){return z},checkForgottenReturns:q,setBounds:te,warn:K,deprecated:V,CapturedTrace:he,fireDomEvent:N,fireGlobalEvent:S}}),m1}var g1,DT;function fX(){return DT||(DT=1,g1=function(r,e){var t=Tt(),n=r.CancellationError,s=t.errorObj;function i(h,f,p){this.promise=h,this.type=f,this.handler=p,this.called=!1,this.cancelPromise=null}i.prototype.isFinallyHandler=function(){return this.type===0};function o(h){this.finallyHandler=h}o.prototype._resultCancelled=function(){l(this.finallyHandler)};function l(h,f){return h.cancelPromise!=null?(arguments.length>
12051?h.cancelPromise._reject(f):h.cancelPromise._cancel(),h.cancelPromise=null,!0):!1}function c(){return d.call(this,this.promise._target()._settledValue())}function u(h){if(!l(this,h))return s.e=h,s}function d(h){var f=this.promise,p=this.handler;if(!this.called){this.called=!0;var m=this.isFinallyHandler()?p.call(f._boundValue()):p.call(f._boundValue(),h);if(m!==void 0){f._setReturnedNonUndefined();var g=e(m,f);if(g instanceof r){if(this.cancelPromise!=null)if(g._isCancelled()){var v=new n("late cancellation observer");return f._attachExtraTrace(v),s.e=v,s}else g.isPending()&&g._attachCancellationCallback(new o(this));return g._then(c,u,void 0,this,void 0)}}}return f.isRejected()?(l(this),s.e=h,s):(l(this),h)}return r.prototype._passThrough=function(h,f,p,m){return typeof h!="function"?this.then():this._then(p,m,void 0,new i(this,f,h),void 0)},r.prototype.lastly=r.prototype.finally=function(h){return this._passThrough(h,0,d,d)},r.prototype.tap=function(h){return this._passThrough(h,1,d)},i}),g1}var y1,RT;function pX(){return RT||(RT=1,y1=function(r){var e=Tt(),t=jf().keys,n=e.tryCatch,s=e.errorObj;function i(o,l,c){return function(u){var d=c._boundValue();e:for(var h=0;h<o.length;++h){var f=o[h];if(f===Error||f!=null&&f.prototype instanceof Error){if(u instanceof f)return n(l).call(d,u)}else if(typeof f=="function"){var p=n(f).call(d,u);if(p===s)return p;if(p)return n(l).call(d,u)}else if(e.isObject(u)){for(var m=t(f),g=0;g<m.length;++g){var v=m[g];if(f[v]!=u[v])continue e}return n(l).call(d,u)}}return r}}return i}),y1}var b1,PT;function F8(){if(PT)return b1;PT=1;var r=Tt(),e=r.maybeWrapAsError,t=Ml(),n=t.OperationalError,s=jf();function i(u){return u instanceof Error&&s.getPrototypeOf(u)===Error.prototype}var o=/^(?:name|message|stack|cause)$/;function l(u){var d;if(i(u)){d=new n(u),d.name=u.name,d.message=u.message,d.stack=u.stack;for(var h=s.keys(u),f=0;f<h.length;++f){var p=h[f];o.test(p)||(d[p]=u[p])}return d}return r.markAsOriginatingFromRejection(u),u}function c(u,d){return function(h,f){if(u!==null){if(h){var p=l(e(h));u._attachExtraTrace(p),u._reject(p)}else if(!d)u._fulfill(f);else{for(var m=arguments.length,g=new Array(Math.max(m-1,0)),v=1;v<m;++v)g[v-1]=arguments[v];u._fulfill(g)}u=null}}}return b1=c,b1}var x1,IT;function mX(){return IT||(IT=1,x1=function(r,e,t,n,s){var i=Tt(),o=i.tryCatch;r.method=function(l){if(typeof l!="function")throw new r.TypeError("expecting a function but got "+i.classString(l));return function(){var c=new r(e);c._captureStackTrace(),c._pushContext();var u=o(l).apply(this,arguments),d=c._popContext();return s.checkForgottenReturns(u,d,"Promise.method",c),c._resolveFromSyncValue(u),c}},r.attempt=r.try=function(l){if(typeof l!="function")return n("expecting a function but got "+i.classString(l));var c=new r(e);c._captureStackTrace(),c._pushContext();var u;if(arguments.length>1){s.deprecated("calling Promise.try with more than 1 argument");var d=arguments[1],h=arguments[2];u=i.isArray(d)?o(l).apply(h,d):o(l).call(h,d)}else u=o(l)();var f=c._popContext();return s.checkForgottenReturns(u,f,"Promise.try",c),c._resolveFromSyncValue(u),c},r.prototype._resolveFromSyncValue=function(l){l===i.errorObj?this._rejectCallback(l.e,!1):this._resolveCallback(l,!0)}}),x1}var v1,LT;function gX(){return LT||(LT=1,v1=function(r,e,t,n){var s=!1,i=function(u,d){this._reject(d)}
1205,o=function(u,d){d.promiseRejectionQueued=!0,d.bindingPromise._then(i,i,null,this,u)},l=function(u,d){this._bitField&50397184||this._resolveCallback(d.target)},c=function(u,d){d.promiseRejectionQueued||this._reject(u)};r.prototype.bind=function(u){s||(s=!0,r.prototype._propagateFrom=n.propagateFromFunction(),r.prototype._boundValue=n.boundValueFunction());var d=t(u),h=new r(e);h._propagateFrom(this,1);var f=this._target();if(h._setBoundTo(d),d instanceof r){var p={promiseRejectionQueued:!1,promise:h,target:f,bindingPromise:d};f._then(e,o,void 0,h,p),d._then(l,c,void 0,h,p),h._setOnCancel(d)}else h._resolveCallback(f);return h},r.prototype._setBoundTo=function(u){u!==void 0?(this._bitField=this._bitField|2097152,this._boundTo=u):this._bitField=this._bitField&-2097153},r.prototype._isBound=function(){return(this._bitField&2097152)===2097152},r.bind=function(u,d){return r.resolve(d).bind(u)}}),v1}var w1,OT;function yX(){return OT||(OT=1,w1=function(r,e,t,n){var s=Tt(),i=s.tryCatch,o=s.errorObj,l=r._async;r.prototype.break=r.prototype.cancel=function(){if(!n.cancellation())return this._warn("cancellation is disabled");for(var c=this,u=c;c._isCancellable();){if(!c._cancelBy(u)){u._isFollowing()?u._followee().cancel():u._cancelBranched();break}var d=c._cancellationParent;if(d==null||!d._isCancellable()){c._isFollowing()?c._followee().cancel():c._cancelBranched();break}else c._isFollowing()&&c._followee().cancel(),c._setWillBeCancelled(),u=c,c=d}},r.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},r.prototype._enoughBranchesHaveCancelled=function(){return this._branchesRemainingToCancel===void 0||this._branchesRemainingToCancel<=0},r.prototype._cancelBy=function(c){return c===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),this._enoughBranchesHaveCancelled()?(this._invokeOnCancel(),!0):!1)},r.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},r.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),l.invoke(this._cancelPromises,this,void 0))},r.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},r.prototype._unsetOnCancel=function(){this._onCancelField=void 0},r.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},r.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},r.prototype._doInvokeOnCancel=function(c,u){if(s.isArray(c))for(var d=0;d<c.length;++d)this._doInvokeOnCancel(c[d],u);else if(c!==void 0)if(typeof c=="function"){if(!u){var h=i(c).call(this._boundValue());h===o&&(this._attachExtraTrace(h.e),l.throwLater(h.e))}}else c._resultCancelled(this)},r.prototype._invokeOnCancel=function(){var c=this._onCancel();this._unsetOnCancel(),l.invoke(this._doInvokeOnCancel,this,c)},r.prototype._invokeInternalOnCancel=function(){this._isCancellable()&&(this._doInvokeOnCancel(this._onCancel(),!0),this._unsetOnCancel())},r.prototype._resultCancelled=function(){this.cancel()}}),w1}var _1,MT;function bX(){return MT||(MT=1,_1=function(r){function e(){return this.value}function t(){throw this.reason}r.prototype.return=r.prototype.thenReturn=function(n){return n instanceof r&&n.suppressUnhandledRejections(),this._then(e,void 0,void 0,{value:n},void 0)},r.prototype.throw=r.prototype.thenThrow=function(n){return this._then(t,void 0,void 0,{reason:n},void 0)},r.prototype.catchThrow=function(n){if(arguments.length<=1)return this._then(void 0,t,void 0,{reason:n},void 0);var s=arguments[1],i=function(){throw s};return this.caught(n,i)},r.prototype.catchReturn=function(n){if(arguments.length<=1)return n instanceof r&&n.suppressUnhandledRejections(),this._then(void 0,e,void 0,{value:n},void 0);var s=arguments[1];s instanceof r&&s.suppressUnhandledRejections();var i=function(){return s};return this.caught(n,i)}}),_1}var N1,FT;function xX(){return FT||(FT=1,N1=function(r){function e(c){c!==void 0?(c=c._target(),this._bitField=c._bitField,this._settledValueField=c._isFateSealed()?c._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}e.prototype._settledValue=function(){return this._settledValueField};var t=e.prototype.value=function(){if(!this.isFulfilled())throw new TypeError(`cannot get fulfillment value of a non-fulfilled promise
1206
1207    See http://goo.gl/MqrFmX
1208`);return this._settledValue()},n=e.prototype.error=e.prototype.reason=function(){if(!this.isRejected())throw new TypeError(`cannot get rejection reason of a non-rejected promise
1209
1210    See http://goo.gl/MqrFmX
1211`);return this._settledValue()},s=e.prototype.isFulfilled=function(){return(this._bitField&33554432)!==0},i=e.prototype.isRejected=function(){return(this._bitField&16777216)!==0},o=e.prototype.isPending=function(){return(this._bitField&50397184)===0},l=e.prototype.isResolved=function(){return(this._bitField&50331648)!==0};e.prototype.isCancelled=function(){return(this._bitField&8454144)!==0},r.prototype.__isCancelled=function(){return(this._bitField&65536)===6
12115536},r.prototype._isCancelled=function(){return this._target().__isCancelled()},r.prototype.isCancelled=function(){return(this._target()._bitField&8454144)!==0},r.prototype.isPending=function(){return o.call(this._target())},r.prototype.isRejected=function(){return i.call(this._target())},r.prototype.isFulfilled=function(){return s.call(this._target())},r.prototype.isResolved=function(){return l.call(this._target())},r.prototype.value=function(){return t.call(this._target())},r.prototype.reason=function(){var c=this._target();return c._unsetRejectionIsUnhandled(),n.call(c)},r.prototype._value=function(){return this._settledValue()},r.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},r.PromiseInspection=e}),N1}var S1,BT;function vX(){return BT||(BT=1,S1=function(r,e,t,n,s,i){var o=Tt(),l=o.canEvaluate,c=o.tryCatch,u=o.errorObj,d;if(l){for(var h=function(y){return new Function("value","holder",`                             
1212	            'use strict';                                                    
1213	            holder.pIndex = value;                                           
1214	            holder.checkFulfillment(this);                                   
1215	            `.replace(/Index/g,y))},f=function(y){return new Function("promise","holder",`                           
1216	            'use strict';                                                    
1217	            holder.pIndex = promise;                                         
1218	            `.replace(/Index/g,y))},p=function(y){for(var w=new Array(y),_=0;_<w.length;++_)w[_]="this.p"+(_+1);var N=w.join(" = ")+" = null;",S=`var promise;
1219`+w.map(function(R){return`                                                         
1220	                promise = `+R+`;                                      
1221	                if (promise instanceof Promise) {                            
1222	                    promise.cancel();                                        
1223	                }                                                            
1224	            `}).join(`
1225`),E=w.join(", "),T="Holder$"+y,D=`return function(tryCatch, errorObj, Promise, async) {    
1226	            'use strict';                                                    
1227	            function [TheName](fn) {                                         
1228	                [TheProperties]                                              
1229	                this.fn = fn;                                                
1230	                this.asyncNeeded = true;                                     
1231	                this.now = 0;                                                
1232	            }                                                                
1233	                                                                             
1234	            [TheName].prototype._callFunction = function(promise) {          
1235	                promise._pushContext();                                      
1236	                var ret = tryCatch(this.fn)([ThePassedArguments]);           
1237	                promise._popContext();                                       
1238	                if (ret === errorObj) {                                      
1239	                    promise._rejectCallback(ret.e, false);                   
1240	                } else {                                                     
1241	                    promise._resolveCallback(ret);                           
1242	                }                                                            
1243	            };                                                               
1244	                                                                             
1245	            [TheName].prototype.checkFulfillment = function(promise) {       
1246	                var now = ++this.now;                                        
1247	                if (now === [TheTotal]) {                                    
1248	                    if (this.asyncNeeded) {                                  
1249	                        async.invoke(this._callFunction, this, promise);     
1250	                    } else {                                                 
1251	                        this._callFunction(promise);                         
1252	                    }                                                        
1253	                                                                             
1254	                }                                                            
1255	            };                                                               
1256	                                                                             
1257	            [TheName].prototype._resultCancelled = function() {              
1258	                [CancellationCode]                                           
1259	            };                                                               
1260	                                                                             
1261	            return [TheName];                                                
1262	        }(tryCatch, errorObj, Promise, async);                               
1263	        `;return D=D.replace(/\[TheName\]/g,T).replace(/\[TheTotal\]/g,y).replace(/\[ThePassedArguments\]/g,E).replace(/\[TheProperties\]/g,N).replace(/\[CancellationCode\]/g,S),new Function("tryCatch","errorObj","Promise","async",D)(c,u,r,s)},m=[],g=[],v=[],b=0;b<8;
1263++b)m.push(p(b+1)),g.push(h(b+1)),v.push(f(b+1));d=function(y){this._reject(y)}}r.join=function(){var y=arguments.length-1,w;if(y>0&&typeof arguments[y]=="function"&&(w=arguments[y],y<=8&&l)){var C=new r(n);C._captureStackTrace();for(var _=m[y-1],N=new _(w),S=g,E=0;E<y;++E){var T=t(arguments[E],C);if(T instanceof r){T=T._target();var D=T._bitField;D&50397184?D&33554432?S[E].call(C,T._value(),N):D&16777216?C._reject(T._reason()):C._cancel():(T._then(S[E],d,void 0,C,N),v[E](T,N),N.asyncNeeded=!1)}else S[E].call(C,T,N)}if(!C._isFateSealed()){if(N.asyncNeeded){var R=i();R!==null&&(N.fn=o.domainBind(R,N.fn))}C._setAsyncGuaranteed(),C._setOnCancel(N)}return C}for(var H=arguments.length,A=new Array(H),U=0;U<H;++U)A[U]=arguments[U];w&&A.pop();var C=new e(A).promise();return w!==void 0?C.spread(w):C}}),S1}var k1,$T;function wX(){return $T||($T=1,k1=function(r,e,t,n,s,i){var o=r._getDomain,l=Tt(),c=l.tryCatch,u=l.errorObj,d=r._async;function h(p,m,g,v){this.constructor$(p),this._promise._captureStackTrace();var b=o();this._callback=b===null?m:l.domainBind(b,m),this._preservedValues=v===s?new Array(this.length()):null,this._limit=g,this._inFlight=0,this._queue=[],d.invoke(this._asyncInit,this,void 0)}l.inherits(h,e),h.prototype._asyncInit=function(){this._init$(void 0,-2)},h.prototype._init=function(){},h.prototype._promiseFulfilled=function(p,m){var g=this._values,v=this.length(),b=this._preservedValues,y=this._limit;if(m<0){if(m=m*-1-1,g[m]=p,y>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(y>=1&&this._inFlight>=y)return g[m]=p,this._queue.push(m),!1;b!==null&&(b[m]=p);var w=this._promise,_=this._callback,N=w._boundValue();w._pushContext();var S=c(_).call(N,p,m,v),E=w._popContext();if(i.checkForgottenReturns(S,E,b!==null?"Promise.filter":"Promise.map",w),S===u)return this._reject(S.e),!0;var T=n(S,this._promise);if(T instanceof r){T=T._target();var D=T._bitField;if(D&50397184)if(D&33554432)S=T._value();else return D&16777216?(this._reject(T._reason()),!0):(this._cancel(),!0);else return y>=1&&this._inFlight++,g[m]=T,T._proxy(this,(m+1)*-1),!1}g[m]=S}var R=++this._totalResolved;return R>=v?(b!==null?this._filter(g,b):this._resolve(g),!0):!1},h.prototype._drainQueue=function(){for(var p=this._queue,m=this._limit,g=this._values;p.length>0&&this._inFlight<m;){if(this._isResolved())return;var v=p.pop();this._promiseFulfilled(g[v],v)}},h.prototype._filter=function(p,m){for(var g=m.length,v=new Array(g),b=0,y=0;y<g;++y)p[y]&&(v[b++]=m[y]);v.length=b,this._resolve(v)},h.prototype.preservedValues=function(){return this._preservedValues};function f(p,m,g,v){if(typeof m!="function")return t("expecting a function but got "+l.classString(m));var b=0;if(g!==void 0)if(typeof g=="object"&&g!==null){if(typeof g.concurrency!="number")return r.reject(new TypeError("'concurrency' must be a number but it is "+l.classString(g.concurrency)));b=g.concurrency}else return r.reject(new TypeError("options argument must be an object but it is "+l.classString(g)));return b=typeof b=="number"&&isFinite(b)&&b>=1?b:0,new h(p,m,b,v).promise()}r.prototype.map=function(p,m){return f(this,p,m,null)},r.map=function(p,m,g,v){return f(p,m,g,v)}}),k1}var C1,UT;function _X(){if(UT)return C1;UT=1;var r=Object.create;if(r){var e=r(null),t=r(null);e[" size"]=t[" size"]=0}return C1=function(n){var s=Tt(),i=s.canEvaluate,o=s.isIdentifier,l,c;{var u=function(v){return new Function("ensureMethod",`                                    
1264	        return function(obj) {                                               
1265	            'use strict'                                                     
1266	            var len = this.length;                                           
1267	            ensureMethod(obj, 'methodName');                                 
1268	            switch(len) {                                                    
1269	                case 1: return obj.methodName(this[0]);                      
1270	                case 2: return obj.methodName(this[0], this[1]);             
1271	                case 3: return obj.methodName(this[0], this[1], this[2]);    
1272	                case 0: return obj.methodName();                             
1273	                default:                                                     
1274	                    return obj.methodName.apply(obj, this);                  
1275	            }                                                                
1276	        };                                                                   
1277	        `.replace(/methodName/g,v))(f)},d=function(v){return new Function("obj",`                                             
1278	        'use strict';                                                        
1279	        return obj.propertyName;                                             
1280	        `.replace("propertyName",v))},h=function(v,b,y){var w=y[v];if(typeof w!="function"){if(!o(v))return null;if(w=b(v),y[v]=w,y[" size"]++,y[" size"]>512){for(var _=Object.keys(y),N=0;N<256;++N)delete y[_[N]];y[" size"]=_.length-256}}return w};l=function(v){return h(v,u,e)},c=function(v){return h(v,d,t)}}function f(v,b){var y;if(v!=null&&(y=v[b]),typeof y!="function"){var w="Object "+s.classString(v)+" has no method '"+s.toString(b)+"'";throw new n.TypeError(w)}return y}function p(v){var b=this.pop(),y=f(v,b);return y.apply(v,this)}n.prototype.call=function(v){for(var b=arguments.length,y=new Array(Math.max(b-1,0)),w=1;w<b;++w)y[w-1]=arguments[w];if(i){var _=l(v);if(_!==null)return this._then(_,void 0,void 0,y,void 0)}return y.push(v),this._then(p,void 0,void 0,y,void 0)};function m(v){return v[this]}function g(v){var b=+this;return b<0&&(b=Math.max(0,b+v.length)),v[b]}n.prototype.get=function(v){var b=typeof v=="number",y;if(b)y=g;else if(i){var w=c(v);y=w!==null?w:m}else y=m;return this._then(y,void 0,void 0,v,void 0)}},C1}var E1,HT;function NX(){return HT||(HT=1,E1=function(r,e,t,n,s,i){var o=Tt(),l=Ml().TypeError,c=Tt().inherits,u=o.errorObj,d=o.tryCatch,h={};function f(w){setTimeout(function(){throw w},0)}function p(w){var _=t(w);return _!==w&&typeof w._isDisposable=="function"&&typeof w._getDisposer=="function"&&w._isDisposable()&&_._setDisposable(w._getDisposer()),_}function m(w,_){var N=0,S=w.length,E=new r(s);function T(){if(N>=S)return E._fulfill();var D=p(w[N++]);if(D instanceof r&&D._isDisposable()){try{D=t(D._getDisposer().tryDispose(_),w.promise)}catch(R){return f(R)}if(D instanceof r)return D._then(T,f,null,null,null)}T()}return T(),E}function g(w,_,N){this._data=w,this._promise=_,this._context=N}g.prototype.data=function(){return this._data},g.prototype.promise=function(){return this._promise},g.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value(
1280):h},g.prototype.tryDispose=function(w){var _=this.resource(),N=this._context;N!==void 0&&N._pushContext();var S=_!==h?this.doDispose(_,w):null;return N!==void 0&&N._popContext(),this._promise._unsetDisposable(),this._data=null,S},g.isDisposer=function(w){return w!=null&&typeof w.resource=="function"&&typeof w.tryDispose=="function"};function v(w,_,N){this.constructor$(w,_,N)}c(v,g),v.prototype.doDispose=function(w,_){var N=this.data();return N.call(w,w,_)};function b(w){return g.isDisposer(w)?(this.resources[this.index]._setDisposable(w),w.promise()):w}function y(w){this.length=w,this.promise=null,this[w-1]=null}y.prototype._resultCancelled=function(){for(var w=this.length,_=0;_<w;++_){var N=this[_];N instanceof r&&N.cancel()}},r.using=function(){var w=arguments.length;if(w<2)return e("you must pass at least 2 arguments to Promise.using");var _=arguments[w-1];if(typeof _!="function")return e("expecting a function but got "+o.classString(_));var N,S=!0;w===2&&Array.isArray(arguments[0])?(N=arguments[0],w=N.length,S=!1):(N=arguments,w--);for(var E=new y(w),T=0;T<w;++T){var D=N[T];if(g.isDisposer(D)){var R=D;D=D.promise(),D._setDisposable(R)}else{var H=t(D);H instanceof r&&(D=H._then(b,null,null,{resources:E,index:T},void 0))}E[T]=D}for(var A=new Array(E.length),T=0;T<A.length;++T)A[T]=r.resolve(E[T]).reflect();var U=r.all(A).then(function(M){for(var L=0;L<M.length;++L){var B=M[L];if(B.isRejected())return u.e=B.error(),u;if(!B.isFulfilled()){U.cancel();return}M[L]=B.value()}C._pushContext(),_=d(_);var I=S?_.apply(void 0,M):_(M),z=C._popContext();return i.checkForgottenReturns(I,z,"Promise.using",C),I}),C=U.lastly(function(){var M=new r.PromiseInspection(U);return m(E,M)});return E.promise=C,C._setOnCancel(E),C},r.prototype._setDisposable=function(w){this._bitField=this._bitField|131072,this._disposer=w},r.prototype._isDisposable=function(){return(this._bitField&131072)>0},r.prototype._getDisposer=function(){return this._disposer},r.prototype._unsetDisposable=function(){this._bitField=this._bitField&-131073,this._disposer=void 0},r.prototype.disposer=function(w){if(typeof w=="function")return new v(w,this,n());throw new l}}),E1}var j1,zT;function SX(){return zT||(zT=1,j1=function(r,e,t){var n=Tt(),s=r.TimeoutError;function i(h){this.handle=h}i.prototype._resultCancelled=function(){clearTimeout(this.handle)};var o=function(h){return l(+this).thenReturn(h)},l=r.delay=function(h,f){var p,m;return f!==void 0?(p=r.resolve(f)._then(o,null,null,h,void 0),t.cancellation()&&f instanceof r&&p._setOnCancel(f)):(p=new r(e),m=setTimeout(function(){p._fulfill()},+h),t.cancellation()&&p._setOnCancel(new i(m)),p._captureStackTrace()),p._setAsyncGuaranteed(),p};r.prototype.delay=function(h){return l(h,this)};var c=function(h,f,p){var m;typeof f!="string"?f instanceof Error?m=f:m=new s("operation timed out"):m=new s(f),n.markAsOriginatingFromRejection(m),h._attachExtraTrace(m),h._reject(m),p!=null&&p.cancel()};function u(h){return clearTimeout(this.handle),h}function d(h){throw clearTimeout(this.handle),h}r.prototype.timeout=function(h,f){h=+h;var p,m,g=new i(setTimeout(function(){p.isPending()&&c(p,f,m)},h));return t.cancellation()?(m=this.then(),p=m._then(u,d,void 0,g,void 0),p._setOnCancel(g)):p=this._then(u,d,void 0,g,void 0),p}}),j1}var A1,qT;function kX(){return qT||(qT=1,A1=function(r,e,t,n,s,i){var o=Ml(),l=o.TypeError,c=Tt(),u=c.errorObj,d=c.tryCatch,h=[];function f(m,g,v){for(var b=0;b<g.length;++b){v._pushContext();var y=d(g[b])(m);if(v._popContext(),y===u){v._pushContext();var w=r.reject(u.e);return v._popContext(),w}var _=n(y,v);if(_ instanceof r)return _}return null}function p(m,g,v,b){if(i.cancellation()){var y=new r(t),w=this._finallyPromise=new r(t);this._promise=y.lastly(function(){return w}),y._captureStackTrace(),y._setOnCancel(this)}else{var _=this._promise=new r(t);_._captureStackTrace()}this._stack=b,this._generatorFunction=m,this._receiver=g,this._generator=void 0,this._yieldHandlers=typeof v=="function"?[v].concat(h):h,this._yieldedPromise=null,this._cancellationPhase=!1}c.inherits(p,s),p.prototype._isResolved=function(){return this._promise===null},p.prototype._cleanup=function(){this._promise=this._generator=null,i.c
1280ancellation()&&this._finallyPromise!==null&&(this._finallyPromise._fulfill(),this._finallyPromise=null)},p.prototype._promiseCancelled=function(){if(!this._isResolved()){var m=typeof this._generator.return<"u",g;if(m)this._promise._pushContext(),g=d(this._generator.return).call(this._generator,void 0),this._promise._popContext();else{var v=new r.CancellationError("generator .return() sentinel");r.coroutine.returnSentinel=v,this._promise._attachExtraTrace(v),this._promise._pushContext(),g=d(this._generator.throw).call(this._generator,v),this._promise._popContext()}this._cancellationPhase=!0,this._yieldedPromise=null,this._continue(g)}},p.prototype._promiseFulfilled=function(m){this._yieldedPromise=null,this._promise._pushContext();var g=d(this._generator.next).call(this._generator,m);this._promise._popContext(),this._continue(g)},p.prototype._promiseRejected=function(m){this._yieldedPromise=null,this._promise._attachExtraTrace(m),this._promise._pushContext();var g=d(this._generator.throw).call(this._generator,m);this._promise._popContext(),this._continue(g)},p.prototype._resultCancelled=function(){if(this._yieldedPromise instanceof r){var m=this._yieldedPromise;this._yieldedPromise=null,m.cancel()}},p.prototype.promise=function(){return this._promise},p.prototype._run=function(){this._generator=this._generatorFunction.call(this._receiver),this._receiver=this._generatorFunction=void 0,this._promiseFulfilled(void 0)},p.prototype._continue=function(m){var g=this._promise;if(m===u)return this._cleanup(),this._cancellationPhase?g.cancel():g._rejectCallback(m.e,!1);var v=m.value;if(m.done===!0)return this._cleanup(),this._cancellationPhase?g.cancel():g._resolveCallback(v);var b=n(v,this._promise);if(!(b instanceof r)&&(b=f(b,this._yieldHandlers,this._promise),b===null)){this._promiseRejected(new l(`A value %s was yielded that could not be treated as a promise
1281
1282    See http://goo.gl/MqrFmX
1283
1284`.replace("%s",v)+`From coroutine:
1285`+this._stack.split(`
1286`).slice(1,-7).join(`
1287`)));return}b=b._target();var y=b._bitField;y&50397184?y&33554432?r._async.invoke(this._promiseFulfilled,this,b._value()):y&16777216?r._async.invoke(this._promiseRejected,this,b._reason()):this._promiseCancelled():(this._yieldedPromise=b,b._proxy(this,null))},r.coroutine=function(m,g){if(typeof m!="function")throw new l(`generatorFunction must be a function
1288
1289    See http://goo.gl/MqrFmX
1290`);var v=Object(g).yieldHandler,b=p,y=new Error().stack;return function(){var w=m.apply(this,arguments),_=new b(void 0,void 0,v,y),N=_.promise();return _._generator=w,_._promiseFulfilled(void 0),N}},r.coroutine.addYieldHandler=function(m){if(typeof m!="function")throw new l("expecting a function but got "+c.classString(m));h.push(m)},r.spawn=function(m){if(i.deprecated("Promise.spawn()","Promise.coroutine()"),typeof m!="function")return e(`generatorFunction must be a function
1291
1292    See http://goo.gl/MqrFmX
1293`);var g=new p(m,this),v=g.promise();return g._run(r.spawn),v}}),A1}var T1,WT;function CX(){return WT||(WT=1,T1=function(r){var e=Tt(),t=r._async,n=e.tryCatch,s=e.errorObj;function i(c,u){var d=this;if(!e.isArray(c))return o.call(d,c,u);var h=n(u).apply(d._boundValue(),[null].concat(c));h===s&&t.throwLater(h.e)}function o(c,u){var d=this,h=d._boundValue(),f=c===void 0?n(u).call(h,null):n(u).call(h,null,c);f===s&&t.throwLater(f.e)}function l(c,u){var d=this;if(!c){var h=new Error(c+"");h.cause=c,c=h}var f=n(u).call(d._boundValue(),c);f===s&&t.throwLater(f.e)}r.prototype.asCallback=r.prototype.nodeify=function(c,u){if(typeof c=="function"){var d=o;u!==void 0&&Object(u).spread&&(d=i),this._then(d,l,void 0,this,c)}return this}}),T1}var D1,VT;function EX(){return VT||(VT=1,D1=function(r,e){var t={},n=Tt(),s=F8(),i=n.withAppended,o=n.maybeWrapAsError,l=n.canEvaluate,c=Ml().TypeError,u="Async",d={__isPromisified__:!0},h=["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"],f=new RegExp("^(?:"+h.join("|")+")$"),p=function(U){return n.isIdentifier(U)&&U.charAt(0)!=="_"&&U!=="constructor"};function m(U){return!f.test(U)}function g(U){try{return U.__isPromisified__===!0}catch{return!1}}function v(U,C,M){var L=n.getDataPropertyOrDefault(U,C+M,d);return L?g(L):!1}function b(U,C,M){for(var L=0;L<U.length;L+=2){var B=U[L];if(M.test(B)){for(var I=B.replace(M,""),z=0;z<U.length;z+=2)if(U[z]===I)throw new c(`Cannot promisify an API that has normal methods with '%s'-suffix
1294
1295    See http://goo.gl/MqrFmX
1296`.replace("%s",C))}}}function y(U,C,M,L){for(var B=n.inheritedDataKeys(U),I=[],z=0;
1296z<B.length;++z){var X=B[z],F=U[X],q=L===p?!0:p(X);typeof F=="function"&&!g(F)&&!v(U,X,C)&&L(X,F,U,q)&&I.push(X,F)}return b(I,C,M),I}var w=function(U){return U.replace(/([$])/,"\\$")},_;{var N=function(U){for(var C=[U],M=Math.max(0,U-1-3),L=U-1;L>=M;--L)C.push(L);for(var L=U+1;L<=3;++L)C.push(L);return C},S=function(U){return n.filledRange(U,"_arg","")},E=function(U){return n.filledRange(Math.max(U,3),"_arg","")},T=function(U){return typeof U.length=="number"?Math.max(Math.min(U.length,1024),0):0};_=function(U,C,M,L,B,I){var z=Math.max(0,T(L)-1),X=N(z),F=typeof U=="string"||C===t;function q(Z){var ie=S(Z).join(", "),pe=Z>0?", ":"",me;return F?me=`ret = callback.call(this, {{args}}, nodeback); break;
1297`:me=C===void 0?`ret = callback({{args}}, nodeback); break;
1298`:`ret = callback.call(receiver, {{args}}, nodeback); break;
1299`,me.replace("{{args}}",ie).replace(", ",pe)}function V(){for(var Z="",ie=0;ie<X.length;++ie)Z+="case "+X[ie]+":"+q(X[ie]);return Z+=`                                                             
1300	        default:                                                             
1301	            var args = new Array(len + 1);                                   
1302	            var i = 0;                                                       
1303	            for (var i = 0; i < len; ++i) {                                  
1304	               args[i] = arguments[i];                                       
1305	            }                                                                
1306	            args[i] = nodeback;                                              
1307	            [CodeForCall]                                                    
1308	            break;                                                           
1309	        `.replace("[CodeForCall]",F?`ret = callback.apply(this, args);
1310`:`ret = callback.apply(receiver, args);
1311`),Z}var K=typeof U=="string"?"this != null ? this['"+U+"'] : fn":"fn",ee=`'use strict';                                                
1312	        var ret = function (Parameters) {                                    
1313	            'use strict';                                                    
1314	            var len = arguments.length;                                      
1315	            var promise = new Promise(INTERNAL);                             
1316	            promise._captureStackTrace();                                    
1317	            var nodeback = nodebackForPromise(promise, `+I+`);   
1318	            var ret;                                                         
1319	            var callback = tryCatch([GetFunctionCode]);                      
1320	            switch(len) {                                                    
1321	                [CodeForSwitchCase]                                          
1322	            }                                                                
1323	            if (ret === errorObj) {                                          
1324	                promise._rejectCallback(maybeWrapAsError(ret.e), true, true);
1325	            }                                                                
1326	            if (!promise._isFateSealed()) promise._setAsyncGuaranteed();     
1327	            return promise;                                                  
1328	        };                                                                   
1329	        notEnumerableProp(ret, '__isPromisified__', true);                   
1330	        return ret;                                                          
1331	    `.replace("[CodeForSwitchCase]",V()).replace("[GetFunctionCode]",K);return ee=ee.replace("Parameters",E(z)),new Function("Promise","fn","receiver","withAppended","maybeWrapAsError","nodebackForPromise","tryCatch","errorObj","notEnumerableProp","INTERNAL",ee)(r,L,C,i,o,s,n.tryCatch,n.errorObj,n.notEnumerableProp,e)}}function D(U,C,M,L,B,I){var z=function(){return this}(),X=U;typeof X=="string"&&(U=L);function F(){var q=C;C===t&&(q=this);var V=new r(e);V._captureStackTrace();var K=typeof X=="string"&&this!==z?this[X]:U,ee=s(V,I);try{K.apply(q,i(arguments,ee))}catch(Z){V._rejectCallback(o(Z),!0,!0)}return V._isFateSealed()||V._setAsyncGuaranteed(),V}return n.notEnumerableProp(F,"__isPromisified__",!0),F}var R=l?_:D;function H(U,C,M,L,B){for(var I=new RegExp(w(C)+"$"),z=y(U,C,I,M),X=0,F=z.length;X<F;X+=2){var q=z[X],V=z[X+1],K=q+C;if(L===R)U[K]=R(q,t,q,V,C,B);else{var ee=L(V,function(){return R(q,t,q,V,C,B)});n.notEnumerableProp(ee,"__isPromisified__",!0),U[K]=ee}}return n.toFastProperties(U),U}function A(U,C,M){return R(U,C,void 0,U,null,M)}r.promisify=function(U,C){if(typeof U!="function")throw new c("expecting a function but got "+n.classString(U));if(g(U))return U;C=Object(C);var M=C.context===void 0?t:C.context,L=!!C.multiArgs,B=A(U,M,L);return n.copyDescriptors(U,B,m),B},r.promisifyAll=function(U,C){if(typeof U!="function"&&typeof U!="object")throw new c(`the target of promisifyAll must be an object or a function
1332
1333    See http://goo.gl/MqrFmX
1334`);C=Object(C);var M=!!C.multiArgs,L=C.suffix;
1334typeof L!="string"&&(L=u);var B=C.filter;typeof B!="function"&&(B=p);var I=C.promisifier;if(typeof I!="function"&&(I=R),!n.isIdentifier(L))throw new RangeError(`suffix must be a valid identifier
1335
1336    See http://goo.gl/MqrFmX
1337`);for(var z=n.inheritedDataKeys(U),X=0;X<z.length;++X){var F=U[z[X]];z[X]!=="constructor"&&n.isClass(F)&&(H(F.prototype,L,B,I,M),H(F,L,B,I,M))}return H(U,L,B,I,M)}}),D1}var R1,GT;function jX(){return GT||(GT=1,R1=function(r,e,t,n){var s=Tt(),i=s.isObject,o=jf(),l;typeof Map=="function"&&(l=Map);var c=function(){var f=0,p=0;function m(g,v){this[f]=g,this[f+p]=v,f++}return function(v){p=v.size,f=0;var b=new Array(v.size*2);return v.forEach(m,b),b}}(),u=function(f){for(var p=new l,m=f.length/2|0,g=0;g<m;++g){var v=f[m+g],b=f[g];p.set(v,b)}return p};function d(f){var p=!1,m;if(l!==void 0&&f instanceof l)m=c(f),p=!0;else{var g=o.keys(f),v=g.length;m=new Array(v*2);for(var b=0;b<v;++b){var y=g[b];m[b]=f[y],m[b+v]=y}}this.constructor$(m),this._isMap=p,this._init$(void 0,-3)}s.inherits(d,e),d.prototype._init=function(){},d.prototype._promiseFulfilled=function(f,p){this._values[p]=f;var m=++this._totalResolved;if(m>=this._length){var g;if(this._isMap)g=u(this._values);else{g={};for(var v=this.length(),b=0,y=this.length();b<y;++b)g[this._values[b+v]]=this._values[b]}return this._resolve(g),!0}return!1},d.prototype.shouldCopyValues=function(){return!1},d.prototype.getActualLength=function(f){return f>>1};function h(f){var p,m=t(f);if(i(m))m instanceof r?p=m._then(r.props,void 0,void 0,void 0,void 0):p=new d(m).promise();else return n(`cannot await properties of a non-object
1338
1339    See http://goo.gl/MqrFmX
1340`);return m instanceof r&&p._propagateFrom(m,2),p}r.prototype.props=function(){return h(this)},r.props=function(f){return h(f)}}),R1}var P1,XT;function AX(){return XT||(XT=1,P1=function(r,e,t,n){var s=Tt(),i=function(l){return l.then(function(c){return o(c,l)})};function o(l,c){var u=t(l);if(u instanceof r)return i(u);if(l=s.asArray(l),l===null)return n("expecting an array or an iterable object but got "+s.classString(l));var d=new r(e);c!==void 0&&d._propagateFrom(c,3);for(var h=d._fulfill,f=d._reject,p=0,m=l.length;p<m;++p){var g=l[p];g===void 0&&!(p in l)||r.cast(g)._then(h,f,void 0,d,null)}return d}r.race=function(l){return o(l,void 0)},r.prototype.race=function(){return o(this,void 0)}}),P1}var I1,YT;function TX(){return YT||(YT=1,I1=function(r,e,t,n,s,i){var o=r._getDomain,l=Tt(),c=l.tryCatch;function u(m,g,v,b){this.constructor$(m);var y=o();this._fn=y===null?g:l.domainBind(y,g),v!==void 0&&(v=r.resolve(v),v._attachCancellationCallback(this)),this._initialValue=v,this._currentCancellable=null,b===s?this._eachValues=Array(this._length):b===0?this._eachValues=null:this._eachValues=void 0,this._promise._captureStackTrace(),this._init$(void 0,-5)}l.inherits(u,e),u.prototype._gotAccum=function(m){this._eachValues!==void 0&&this._eachValues!==null&&m!==s&&this._eachValues.push(m)},u.prototype._eachComplete=function(m){return this._eachValues!==null&&this._eachValues.push(m),this._eachValues},u.prototype._init=function(){},u.prototype._resolveEmptyArray=function(){this._resolve(this._eachValues!==void 0?this._eachValues:this._initialValue)},u.prototype.shouldCopyValues=function(){return!1},u.prototype._resolve=function(m){this._promise._resolveCallback(m),this._values=null},u.prototype._resultCancelled=function(m){if(m===this._initialValue)return this._cancel();this._isResolved()||(this._resultCancelled$(),this._currentCancellable instanceof r&&this._currentCancellable.cancel(),this._initialValue instanceof r&&this._initialValue.cancel())},u.prototype._iterate=function(m){this._values=m;var g,v,b=m.length;if(this._initialValue!==void 0?(g=this._initialValue,v=0):(g=r.resolve(m[0]),v=1),this._currentCancellable=g,!g.isRejected())for(;v<b;++v){var y={accum:null,value:m[v],index:v,length:b,array:this};g=g._then(f,void 0,void 0,y,void 0)}this._eachValues!==void 0&&(g=g._then(this._eachComplete,void 0,void 0,this,void 0)),g._then(d,d,void 0,g,this)},r.prototype.reduce=function(m,g){return h(this,m,g,null)},r.reduce=function(m,g,v,b){return h(m,g,v,b)};function d(m,g){this.isFulfilled()?g._resolve(m):g._reject(m)}function h(m,g,v,b){if(typeof g!="function")return t("expecting a function but got "+l.classString(g));var y=new u(m,g,v,b);return y.promise()}function f(m){this.accum=m,this.array._gotAccum(m);var g=n(this.value,this.array._promise);return g instanceof r?(this.array._currentCancellable=g,g._then(p,void 0,void 0,this,void 0)):p.call(this,g)}function p(m){var g=this.array,v=g._promise,b=c(g._fn);v._pushContext();var y;g._eachValues!==void 0?y=b.call(v._boundValue(),m,this.index,this.length):y=b.call(v._boundValue(),this.accum,m,this.index,this.length),y instanceof r&&(g._currentCancellable=y);var w=v._popContext();return i.checkForgottenReturns(y,w,g._eachValues!==void 0?"Promise.each":"Promise.reduce",v),y}}),I1}var L1,KT;function DX(){return KT||(KT=1,L1=function(r,e,t){var n=r.PromiseInspection,s=Tt();function i(o){this.constructor$(o)}s.inherits(i,e),i.prototype._promiseResolved=function(o,l){this._values[o]=l;var c=++this._totalResolved;return c>=this._length?(this._resolve(this._values),!0):!1},i.prototype._promiseFulfilled=function(o,l){var c=new n;return c._bitField=33554432,c._settledValueField=o,this._promiseResolved(l,c)}
1340,i.prototype._promiseRejected=function(o,l){var c=new n;return c._bitField=16777216,c._settledValueField=o,this._promiseResolved(l,c)},r.settle=function(o){return t.deprecated(".settle()",".reflect()"),new i(o).promise()},r.prototype.settle=function(){return r.settle(this)}}),L1}var O1,JT;function RX(){return JT||(JT=1,O1=function(r,e,t){var n=Tt(),s=Ml().RangeError,i=Ml().AggregateError,o=n.isArray,l={};function c(d){this.constructor$(d),this._howMany=0,this._unwrap=!1,this._initialized=!1}n.inherits(c,e),c.prototype._init=function(){if(this._initialized){if(this._howMany===0){this._resolve([]);return}this._init$(void 0,-5);var d=o(this._values);!this._isResolved()&&d&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}},c.prototype.init=function(){this._initialized=!0,this._init()},c.prototype.setUnwrap=function(){this._unwrap=!0},c.prototype.howMany=function(){return this._howMany},c.prototype.setHowMany=function(d){this._howMany=d},c.prototype._promiseFulfilled=function(d){return this._addFulfilled(d),this._fulfilled()===this.howMany()?(this._values.length=this.howMany(),this.howMany()===1&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0):!1}
1340,c.prototype._promiseRejected=function(d){return this._addRejected(d),this._checkOutcome()},c.prototype._promiseCancelled=function(){return this._values instanceof r||this._values==null?this._cancel():(this._addRejected(l),this._checkOutcome())},c.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var d=new i,h=this.length();h<this._values.length;++h)this._values[h]!==l&&d.push(this._values[h]);return d.length>0?this._reject(d):this._cancel(),!0}return!1},c.prototype._fulfilled=function(){return this._totalResolved},c.prototype._rejected=function(){return this._values.length-this.length()},c.prototype._addRejected=function(d){this._values.push(d)},c.prototype._addFulfilled=function(d){this._values[this._totalResolved++]=d},c.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},c.prototype._getRangeError=function(d){var h="Input array must contain at least "+this._howMany+" items but contains only "+d+" items";return new s(h)},c.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))};function u(d,h){if((h|0)!==h||h<0)return t(`expecting a positive integer
1341
1342    See http://goo.gl/MqrFmX
1343`);var f=new c(d),p=f.promise();return f.setHowMany(h),f.init(),p}r.some=function(d,h){return u(d,h)},r.prototype.some=function(d){return u(this,d)},r._SomePromiseArray=c}),O1}var M1,ZT;function PX(){return ZT||(ZT=1,M1=function(r,e){var t=r.map;r.prototype.filter=function(n,s){return t(this,n,s,e)},r.filter=function(n,s,i){return t(n,s,i,e)}}),M1}var F1,QT;function IX(){return QT||(QT=1,F1=function(r,e){var t=r.reduce,n=r.all;function s(){return n(this)}function i(o,l){return t(o,l,e,e)}r.prototype.each=function(o){return t(this,o,e,0)._then(s,void 0,void 0,this,void 0)},r.prototype.mapSeries=function(o){return t(this,o,e,e)},r.each=function(o,l){return t(o,l,e,0)._then(s,void 0,void 0,o,void 0)},r.mapSeries=i}),F1}var B1,e5;function LX(){return e5||(e5=1,B1=function(r){var e=r._SomePromiseArray;function t(n){var s=new e(n),i=s.promise();return s.setHowMany(1),s.setUnwrap(),s.init(),i}r.any=function(n){return t(n)},r.prototype.any=function(){return t(this)}}),B1}(function(r){r.exports=function(){var e=function(){return new f(`circular promise resolution chain
1344
1345    See http://goo.gl/MqrFmX
1346`)},t=function(){return new A.PromiseInspection(this._target())},n=function(L){return A.reject(new f(L))};function s(){}var i={},o=Tt(),l;o.isNode?l=function(){var L=process.domain;return L===void 0&&(L=null),L}:l=function(){return null},o.notEnumerableProp(A,"_getDomain",l);var c=jf(),u=lX(),d=new u;c.defineProperty(A,"_async",{value:d});var h=Ml(),f=A.TypeError=h.TypeError;A.RangeError=h.RangeError;var p=A.CancellationError=h.CancellationError;A.TimeoutError=h.TimeoutError,A.OperationalError=h.OperationalError,A.RejectionError=h.OperationalError,A.AggregateError=h.AggregateError;var m=function(){},g={},v={},b=cX()(A,m),y=uX()(A,m,b,n,s),w=dX()(A),_=w.create,N=hX()(A,w);N.CapturedTrace;var S=fX()(A,b),E=pX()(v),T=F8(),D=o.errorObj,R=o.tryCatch;function H(L,B){if(typeof B!="function")throw new f("expecting a function but got "+o.classString(B));if(L.constructor!==A)throw new f(`the promise constructor cannot be invoked directly
1347
1348    See http://goo.gl/MqrFmX
1349`)}function A(L){this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,L!==m&&(H(this,L),this._resolveFromExecutor(L)),this._promiseCreated(),this._fireEvent("promiseCreated",this)}A.prototype.toString=function(){return"[object Promise]"},A.prototype.caught=A.prototype.catch=function(L){var B=arguments.length;if(B>1){var I=new Array(B-1),z=0,X;for(X=0;X<B-1;++X){var F=arguments[X];if(o.isObject(F))I[z++]=F;else return n("expecting an object but got A catch statement predicate "+o.classString(F))}return I.length=z,L=arguments[X],this.then(void 0,E(I,L,this))}return this.then(void 0,L)},A.prototype.reflect=function(){return this._then(t,t,void 0,this,void 0)},A.prototype.then=function(L,B){if(N.warnings()&&arguments.length>0&&typeof L!="function"&&typeof B!="function"){var I=".then() only accepts functions but was passed: "+o.classString(L);arguments.length>1&&(I+=", "+o.classString(B)),this._warn(I)}return this._then(L,B,void 0,void 0,void 0)},A.prototype.done=function(L,B){var I=this._then(L,B,void 0,void 0,void 0);I._setIsFinal()},A.prototype.spread=function(L){return typeof L!="function"?n("expecting a function but got "+o.classString(L)):this.all()._then(L,void 0,void 0,g,void 0)},A.prototype.toJSON=function(){var L={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(L.fulfillmentValue=this.value(),L.isFulfilled=!0):this.isRejected()&&(L.rejectionReason=this.reason(),L.isRejected=!0),L},A.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new y(this).promise()},A.prototype.error=function(L){return this.caught(o.originatesFromRejection,L)},A.getNewLibraryCopy=r.exports,A.is=function(L){return L instanceof A},A.fromNode=A.fromCallback=function(L){var B=new A(m);B._captureStackTrace();var I=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,z=R(L)(T(B,I));return z===D&&B._rejectCallback(z.e,!0),B._isFateSealed()||B._setAsyncGuaranteed(),B},A.all=function(L){return new y(L).promise()},A.cast=function(L){var B=b(L);return B instanceof A||(B=new A(m),B._captureStackTrace(),B._setFulfilled(),B._rejectionHandler0=L),B},A.resolve=A.fulfilled=A.cast,A.reject=A.rejected=function(L){var B=new A(m);return B._captureStackTrace(),B._rejectCallback(L,!0),B}
1349,A.setScheduler=function(L){if(typeof L!="function")throw new f("expecting a function but got "+o.classString(L));return d.setScheduler(L)},A.prototype._then=function(L,B,I,z,X){var F=X!==void 0,q=F?X:new A(m),V=this._target(),K=V._bitField;F||(q._propagateFrom(this,3),q._captureStackTrace(),z===void 0&&this._bitField&2097152&&(K&50397184?z=this._boundValue():z=V===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,q));var ee=l();if(K&50397184){var Z,ie,pe=V._settlePromiseCtx;K&33554432?(ie=V._rejectionHandler0,Z=L):K&16777216?(ie=V._fulfillmentHandler0,Z=B,V._unsetRejectionIsUnhandled()):(pe=V._settlePromiseLateCancellationObserver,ie=new p("late cancellation observer"),V._attachExtraTrace(ie),Z=B),d.invoke(pe,V,{handler:ee===null?Z:typeof Z=="function"&&o.domainBind(ee,Z),promise:q,receiver:z,value:ie})}else V._addCallbacks(L,B,q,z,ee);return q},A.prototype._length=function(){return this._bitField&65535},A.prototype._isFateSealed=function(){return(this._bitField&117506048)!==0},A.prototype._isFollowing=function(){return(this._bitField&67108864)===67108864},A.prototype._setLength=function(L){this._bitField=this._bitField&-65536|L&65535},A.prototype._setFulfilled=function(){this._bitField=this._bitField|33554432,this._fireEvent("promiseFulfilled",this)},A.prototype._setRejected=function(){this._bitField=this._bitField|16777216,this._fireEvent("promiseRejected",this)},A.prototype._setFollowing=function(){this._bitField=this._bitField|67108864,this._fireEvent("promiseResolved",this)},A.prototype._setIsFinal=function(){this._bitField=this._bitField|4194304},A.prototype._isFinal=function(){return(this._bitField&4194304)>0},A.prototype._unsetCancelled=function(){this._bitField=this._bitField&-65537},A.prototype._setCancelled=function(){this._bitField=this._bitField|65536,this._fireEvent("promiseCancelled",this)},A.prototype._setWillBeCancelled=function(){this._bitField=this._bitField|8388608},A.prototype._setAsyncGuaranteed=function(){d.hasCustomScheduler()||(this._bitField=this._bitField|134217728)},A.prototype._receiverAt=function(L){var B=L===0?this._receiver0:this[L*4-4+3];if(B!==i)return B===void 0&&this._isBound()?this._boundValue():B},A.prototype._promiseAt=function(L){return this[L*4-4+2]},A.prototype._fulfillmentHandlerAt=function(L){return this[L*4-4+0]},A.prototype._rejectionHandlerAt=function(L){return this[L*4-4+1]},A.prototype._boundValue=function(){},A.prototype._migrateCallback0=function(L){L._bitField;var B=L._fulfillmentHandler0,I=L._rejectionHandler0,z=L._promise0,X=L._receiverAt(0);X===void 0&&(X=i),this._addCallbacks(B,I,z,X,null)},A.prototype._migrateCallbackAt=function(L,B){var I=L._fulfillmentHandlerAt(B),z=L._rejectionHandlerAt(B),X=L._promiseAt(B),F=L._receiverAt(B);F===void 0&&(F=i),this._addCallbacks(I,z,X,F,null)},A.prototype._addCallbacks=function(L,B,I,z,X){var F=this._length();if(F>=65531&&(F=0,this._setLength(0)),F===0)this._promise0=I,this._receiver0=z,typeof L=="function"&&(this._fulfillmentHandler0=X===null?L:o.domainBind(X,L)),typeof B=="function"&&(this._rejectionHandler0=X===null?B:o.domainBind(X,B));else{var q=F*4-4;this[q+2]=I,this[q+3]=z,typeof L=="function"&&(this[q+0]=X===null?L:o.domainBind(X,L)),typeof B=="function"&&(this[q+1]=X===null?B:o.domainBind(X,B))}return this._setLength(F+1),F},A.prototype._proxy=function(L,B){this._addCallbacks(void 0,void 0,B,L,null)},A.prototype._resolveCallback=function(L,B){if(!(this._bitField&117506048)){if(L===this)return this._rejectCallback(e(),!1);var I=b(L,this);if(!(I instanceof A))return this._fulfill(L);B&&this._propagateFrom(I,2);var z=I._target();if(z===this){this._reject(e());return}var X=z._bitField;if(X&50397184)if(X&33554432)this._fulfill(z._value());else if(X&16777216)this._reject(z._reason());else{var V=new p("late cancellation observer");z._attachExtraTrace(V),this._reject(V)}else{var F=this._length();F>0&&z._migrateCallback0(this);for(var q=1;q<F;++q)z._migrateCallbackAt(this,q);this._setFollowing(),this._setLength(0),this._setFollowee(z)}}},A.prototype._rejectCallback=function(L,B,I){var z=o.ensureErrorObject(L),X=z===L;if(!X&&!I&&N.warnings()){var F="a promise was rejected with a non-error: "+o.classString(L);this._warn(F,!0)}this._attachExtraTrace(z,B?X:!1),this._reject(L)},A.prototype._resolveFromExecutor=function(L){var B=this;this._captureStackTrace(),this._pushContext();var I=!0,z=this._execute(L,function(X){B._resolveCallback(X)},function(X){B._rejectCallback(X,I)});I=!1,this._popContext(),z!==void 0&&B._rejectCallback(z,!0)},A.prototype._settlePromiseFromHandler=function(L,B,I,z){var X=z._bitField;if(!(X&65536)){z._pushContext();var F;B===g?!I||typeof I.length!="number"?(F=D,F.e=new f("cannot .spread() a non-array: "+o.classString(I))):
1349F=R(L).apply(this._boundValue(),I):F=R(L).call(B,I);var q=z._popContext();X=z._bitField,!(X&65536)&&(F===v?z._reject(I):F===D?z._rejectCallback(F.e,!1):(N.checkForgottenReturns(F,q,"",z,this),z._resolveCallback(F)))}},A.prototype._target=function(){for(var L=this;L._isFollowing();)L=L._followee();return L},A.prototype._followee=function(){return this._rejectionHandler0},A.prototype._setFollowee=function(L){this._rejectionHandler0=L},A.prototype._settlePromise=function(L,B,I,z){var X=L instanceof A,F=this._bitField,q=(F&134217728)!==0;F&65536?(X&&L._invokeInternalOnCancel(),I instanceof S&&I.isFinallyHandler()?(I.cancelPromise=L,R(B).call(I,z)===D&&L._reject(D.e)):B===t?L._fulfill(t.call(I)):I instanceof s?I._promiseCancelled(L):X||L instanceof y?L._cancel():I.cancel()):typeof B=="function"?X?(q&&L._setAsyncGuaranteed(),this._settlePromiseFromHandler(B,I,z,L)):B.call(I,z,L):I instanceof s?I._isResolved()||(F&33554432?I._promiseFulfilled(z,L):I._promiseRejected(z,L)):X&&(q&&L._setAsyncGuaranteed(),F&33554432?L._fulfill(z):L._reject(z))},A.prototype._settlePromiseLateCancellationObserver=function(L){var B=L.handler,I=L.promise,z=L.receiver,X=L.value;typeof B=="function"?I instanceof A?this._settlePromiseFromHandler(B,z,X,I):B.call(z,X,I):I instanceof A&&I._reject(X)},A.prototype._settlePromiseCtx=function(L){this._settlePromise(L.promise,L.handler,L.receiver,L.value)},A.prototype._settlePromise0=function(L,B,I){var z=this._promise0,X=this._receiverAt(0);this._promise0=void 0,this._receiver0=void 0,this._settlePromise(z,L,X,B)},A.prototype._clearCallbackDataAtIndex=function(L){var B=L*4-4;this[B+2]=this[B+3]=this[B+0]=this[B+1]=void 0},A.prototype._fulfill=function(L){var B=this._bitField;if(!((B&117506048)>>>16)){if(L===this){var I=e();return this._attachExtraTrace(I),this._reject(I)}this._setFulfilled(),this._rejectionHandler0=L,(B&65535)>0&&(B&134217728?this._settlePromises():d.settlePromises(this))}},A.prototype._reject=function(L){var B=this._bitField;if(!((B&117506048)>>>16)){if(this._setRejected(),this._fulfillmentHandler0=L,this._isFinal())return d.fatalError(L,o.isNode);(B&65535)>0?d.settlePromises(this):this._ensurePossibleRejectionHandled()}},A.prototype._fulfillPromises=function(L,B){for(var I=1;I<L;I++){var z=this._fulfillmentHandlerAt(I),X=this._promiseAt(I),F=this._receiverAt(I);this._clearCallbackDataAtIndex(I),this._settlePromise(X,z,F,B)}},A.prototype._rejectPromises=function(L,B){for(var I=1;I<L;I++){var z=this._rejectionHandlerAt(I),X=this._promiseAt(I),F=this._receiverAt(I);this._clearCallbackDataAtIndex(I),this._settlePromise(X,z,F,B)}},A.prototype._settlePromises=function(){var L=this._bitField,B=L&65535;if(B>0){if(L&16842752){var I=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,I,L),this._rejectPromises(B,I)}else{var z=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,z,L),this._fulfillPromises(B,z)}this._setLength(0)}this._clearCancellationData()},A.prototype._settledValue=function(){var L=this._bitField;if(L&33554432)return this._rejectionHandler0;if(L&16777216)return this._fulfillmentHandler0};function U(L){this.promise._resolveCallback(L)}function C(L){this.promise._rejectCallback(L,!1)}A.defer=A.pending=function(){N.deprecated("Promise.defer","new Promise");var L=new A(m);return{promise:L,resolve:U,reject:C}},o.notEnumerableProp(A,"_makeSelfResolutionError",e),mX()(A,m,b,n,N),gX()(A,m,b,N),yX()(A,y,n,N),bX()(A),xX()(A),vX()(A,y,b,m,d,l),A.Promise=A,A.version="3.4.7",wX()(A,y,n,b,m,N),_X()(A),NX()(A,n,b,_,m,N),SX()(A,m,N),kX()(A,n,m,b,s,N),CX()(A),EX()(A,m),jX()(A,y,b,n),AX()(A,m,b,n),TX()(A,y,n,b,m,N),DX()(A,y,N),RX()(A,y,n),PX()(A,m),IX()(A,m),LX()(A),o.toFastProperties(A),o.toFastProperties(A.prototype);function M(L){var B=new A(m);B._fulfillmentHandler0=L,B._rejectionHandler0=L,B._promise0=L,B._receiver0=L}return M({a:1}),M({b:2}),M({c:3}),M(1),M(function(){}),M(void 0),M(!1),M(new A(m)),N.setBounds(u.firstLineError,o.lastLineError),A}})(M8);var OX=M8.exports,MX=er,qn=OX();Tr.defer=FX;Tr.when=qn.resolve;Tr.resolve=qn.resolve;Tr.all=qn.all;Tr.props=qn.props;Tr.reject=qn.reject;Tr.promisify=qn.promisify;Tr.mapSeries=qn.mapSeries;Tr.attempt=qn.attempt;Tr.nfcall=function(r){var e=Array.prototype.slice.call(arguments,1
1349),t=qn.promisify(r);return t.apply(null,e)};qn.prototype.fail=qn.prototype.caught;qn.prototype.also=function(r){return this.then(function(e){var t=MX.extend({},e,r(e));return qn.props(t)})};function FX(){var r,e,t=new qn.Promise(function(n,s){r=n,e=s});return{resolve:r,reject:e,promise:t}}var rt={},BX=er,qr=rt.types={document:"document",paragraph:"paragraph",run:"run",text:"text",tab:"tab",checkbox:"checkbox",hyperlink:"hyperlink",noteReference:"noteReference",image:"image",note:"note",commentReference:"commentReference",comment:"comment",table:"table",tableRow:"tableRow",tableCell:"tableCell",break:"break",bookmarkStart:"bookmarkStart"};function $X(r,e){return e=e||{},{type:qr.document,children:r,notes:e.notes||new gv({}),comments:e.comments||[]}}function UX(r,e){e=e||{};var t=e.indent||{};return{type:qr.paragraph,children:r,styleId:e.styleId||null,styleName:e.styleName||null,numbering:e.numbering||null,alignment:e.alignment||null,indent:{start:t.start||null,end:t.end||null,firstLine:t.firstLine||null,hanging:t.hanging||null}}}function HX(r,e){return e=e||{},{type:qr.run,children:r,styleId:e.styleId||null,styleName:e.styleName||null,isBold:!!e.isBold,isUnderline:!!e.isUnderline,isItalic:!!e.isItalic,isStrikethrough:!!e.isStrikethrough,isAllCaps:!!e.isAllCaps,isSmallCaps:!!e.isSmallCaps,verticalAlignment:e.verticalAlignment||B8.baseline,font:e.font||null,fontSize:e.fontSize||null,highlight:e.highlight||null}}var B8={baseline:"baseline",superscript:"superscript",subscript:"subscript"};function zX(r){return{type:qr.text,value:r}}function qX(){return{type:qr.tab}}function WX(r){return{type:qr.checkbox,checked:r.checked}}function VX(r,e){return{type:qr.hyperlink,children:r,href:e.href,anchor:e.anchor,targetFrame:e.targetFrame}}function GX(r){return{type:qr.noteReference,noteType:r.noteType,noteId:r.noteId}}function gv(r){this._notes=BX.indexBy(r,function(e){return $8(e.noteType,e.noteId)})}gv.prototype.resolve=function(r){return this.findNoteByKey($8(r.noteType,r.noteId))};gv.prototype.findNoteByKey=function(r){return this._notes[r]||null};function XX(r){return{type:qr.note,noteType:r.noteType,noteId:r.noteId,body:r.body}}function YX(r){return{type:qr.commentReference,commentId:r.commentId}}function KX(r){return{type:qr.comment,commentId:r.commentId,body:r.body,authorName:r.authorName,authorInitials:r.authorInitials}}function $8(r,e){return r+"-"+e}function JX(r){return{type:qr.image,read:function(e){return e?r.readImage(e):r.readImage().then(function(t){return Buffer.from(t)})},readAsArrayBuffer:function(){return r.readImage()},readAsBase64String:function(){return r.readImage("base64")},readAsBuffer:function(){return r.readImage().then(function(e){return Buffer.from(e)})},altText:r.altText,contentType:r.contentType}}function ZX(r,e){return e=e||{},{type:qr.table,children:r,styleId:e.styleId||null,styleName:e.styleName||null}}function QX(r,e){return e=e||{},{type:qr.tableRow,children:r,isHeader:e.isHeader||!1}}function eY(r,e){return e=e||{},{type:qr.tableCell,children:r,colSpan:e.colSpan==null?1:e.colSpan,rowSpan:e.rowSpan==null?1:e.rowSpan}}function PC(r){return{type:qr.break,breakType:r}}function tY(r){return{type:qr.bookmarkStart,name:r.name}}rt.document=rt.Document=$X;rt.paragraph=rt.Paragraph=UX;rt.run=rt.Run=HX;rt.text=rt.Text=zX;rt.tab=rt.Tab=qX;rt.checkbox=rt.Checkbox=WX;rt.Hyperlink=VX;rt.noteReference=rt.NoteReference=GX;rt.Notes=gv;rt.Note=XX;rt.commentReference=YX;rt.comment=KX;rt.Image=JX;rt.Table=ZX;rt.TableRow=QX;rt.TableCell=eY;rt.lineBreak=PC("line");rt.pageBreak=PC("page");rt.columnBreak=PC("column");rt.BookmarkStart=tY;rt.verticalAlignment=B8;var ys={},lm=er;ys.Result=pa;ys.success=rY;ys.warning=nY;ys.error=sY;function pa(r,e){this.value=r,this.messages=e||[]}pa.prototype.map=function(r){return new pa(r(this.value),this.messages)};pa.prototype.flatMap=function(r){var e=r(this.value);return new pa(e.value,IC([this,e]))};pa.prototype.flatMapThen=function(r){var e=this;return r(this.value).then(function(t){return new pa(t.value,IC([e,t]))})};pa.combine=function(r){var e=lm.flatten(lm.pluck(r,"value")),t=IC(r);return new pa(e,t)};function rY(r){return new pa(r,[])}function nY(r){return{type:"warning",message:r}}function sY(r){return{type:"error",message:r.message,error:r}}function IC(r){var e=[];
1349return lm.flatten(lm.pluck(r,"messages"),!0).forEach(function(t){iY(e,t)||e.push(t)}),e}function iY(r,e){return lm.find(r,aY.bind(null,e))!==void 0}function aY(r,e){return r.type===e.type&&r.message===e.message}var t0={},yv={};yv.byteLength=cY;yv.toByteArray=dY;yv.fromByteArray=pY;var sa=[],Ss=[],oY=typeof Uint8Array<"u"?Uint8Array:Array,$1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var id=0,lY=$1.length;id<lY;++id)sa[id]=$1[id],Ss[$1.charCodeAt(id)]=id;Ss[45]=62;Ss[95]=63;function U8(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}function cY(r){var e=U8(r),t=e[0],n=e[1];return(t+n)*3/4-n}function uY(r,e,t){return(e+t)*3/4-t}function dY(r){var e,t=U8(r),n=t[0],s=t[1],i=new oY(uY(r,n,s)),o=0,l=s>0?n-4:n,c;for(c=0;c<l;c+=4)e=Ss[r.charCodeAt(c)]<<18|Ss[r.charCodeAt(c+1)]<<12|Ss[r.charCodeAt(c+2)]<<6|Ss[r.charCodeAt(c+3)],i[o++]=e>>16&255,i[o++]=e>>8&255,i[o++]=e&255;return s===2&&(e=Ss[r.charCodeAt(c)]<<2|Ss[r.charCodeAt(c+1)]>>4,i[o++]=e&255),s===1&&(e=Ss[r.charCodeAt(c)]<<10|Ss[r.charCodeAt(c+1)]<<4|Ss[r.charCodeAt(c+2)]>>2,i[o++]=e>>8&255,i[o++]=e&255),i}function hY(r){return sa[r>>18&63]+sa[r>>12&63]+sa[r>>6&63]+sa[r&63]}function fY(r,e,t){for(var n,s=[],i=e;i<t;i+=3)n=(r[i]<<16&16711680)+(r[i+1]<<8&65280)+(r[i+2]&255),s.push(hY(n));return s.join("")}function pY(r){for(var e,t=r.length,n=t%3,s=[],i=16383,o=0,l=t-n;o<l;o+=i)s.push(fY(r,o,o+i>l?l:o+i));return n===1?(e=r[t-1],s.push(sa[e>>2]+sa[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],s.push(sa[e>>10]+sa[e>>4&63]+sa[e<<2&63]+"=")),s.join("")}function V0(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var H8={exports:{}};/*!
1350
1351JSZip v3.10.2 - A JavaScript class for generating and reading zip files
1352<http://stuartk.com/jszip>
1353
1354(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
1355Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
1356
1357JSZip uses the library pako released under the MIT license :
1358https://github.com/nodeca/pako/blob/main/LICENSE
1359*/(function(r,e){(function(t){r.exports=t()})(function(){return function t(n,s,i){function o(u,d){if(!s[u]){if(!n[u]){var h=typeof V0=="function"&&V0;if(!d&&h)return h(u,!0);if(l)return l(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var p=s[u]={exports:{}};n[u][0].call(p.exports,function(m){var g=n[u][1][m];return o(g||m)},p,p.exports,t,n,s,i)}return s[u].exports}for(var l=typeof V0=="function"&&V0,c=0;c<i.length;c++)o(i[c]);return o}({1:[function(t,n,s){var i=t("./utils"),o=t("./support"),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";s.encode=function(c){for(var u,d,h,f,p,m,g,v=[],b=0,y=c.length,w=y,_=i.getTypeOf(c)!=="string";b<c.length;)w=y-b,h=_?(u=c[b++],d=b<y?c[b++]:0,b<y?c[b++]:0):(u=c.charCodeAt(b++),d=b<y?c.charCodeAt(b++):0,b<y?c.charCodeAt(b++):0),f=u>>2,p=(3&u)<<4|d>>4,m=1<w?(15&d)<<2|h>>6:64,g=2<w?63&h:64,v.push(l.charAt(f)+l.charAt(p)+l.charAt(m)+l.charAt(g));return v.join("")},s.decode=function(c){var u,d,h,f,p,m,g=0,v=0,b="data:";if(c.substr(0,b.length)===b)throw new Error("Invalid base64 input, it looks like a data url.");var y,w=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===l.charAt(64)&&w--,c.charAt(c.length-2)===l.charAt(64)&&w--,w%1!=0)throw new Error("Invalid base64 input, bad content length.");for(y=o.uint8array?new Uint8Array(0|w):new Array(0|w);g<c.length;)u=l.indexOf(c.charAt(g++))<<2|(f=l.indexOf(c.charAt(g++)))>>4,d=(15&f)<<4|(p=l.indexOf(c.charAt(g++)))>>2,h=(3&p)<<6|(m=l.indexOf(c.charAt(g++))),y[v++]=u,p!==64&&(y[v++]=d),m!==64&&(y[v++]=h);return y}},{"./support":30,"./utils":32}],2:[function(t,n,s){var i=t("./external"),o=t("./stream/DataWorker"),l=t("./stream/Crc32Probe"),c=t("./stream/DataLengthProbe");function u(d,h,f,p,m){this.compressedSize=d,this.uncompressedSize=h,this.crc32=f,this.compression=p,this.compressedContent=m}u.prototype={getContentWorker:function(){var d=new o(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),h=this;return d.on("end",function(){if(this.streamInfo.data_length!==h.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new o(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(d,h,f){return d.pipe(new l).pipe(new c("uncompressedSize")).pipe(h.compressWorker(f)).pipe(new c("compressedSize")).withStreamInfo("compression",h)},n.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,n,s){var i=t("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},s.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,n,s){var i=t("./utils"),o=function(){for(var l,c=[],u=0;u<256;u++){l=u;for(var d=0;d<8;d++)l=1&l?3988292384^l>>>1:l>>>1;c[u]=l}return c}();
vendor: 7,985 bytes, lines 1359-1360
1359n.exports=function(l,c){return l!==void 0&&l.length?i.getTypeOf(l)!=="string"?function(u,d,h,f){var p=o,m=f+h;u^=-1;for(var g=f;g<m;g++)u=u>>>8^p[255&(u^d[g])];return-1^u}(0|c,l,l.length,0):function(u,d,h,f){var p=o,m=f+h;u^=-1;for(var g=f;g<m;g++)u=u>>>8^p[255&(u^d.charCodeAt(g))];return-1^u}(0|c,l,l.length,0):0}},{"./utils":32}],5:[function(t,n,s){s.base64=!1,s.binary=!1,s.dir=!1,s.createFolders=!0,s.date=null,s.compression=null,s.compressionOptions=null,s.comment=null,s.unixPermissions=null,s.dosPermissions=null},{}],6:[function(t,n,s){var i=null;i=typeof Promise<"u"?Promise:t("lie"),n.exports={Promise:i}},{lie:37}],7:[function(t,n,s){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=t("pako"),l=t("./utils"),c=t("./stream/GenericWorker"),u=i?"uint8array":"array";function d(h,f){c.call(this,"FlateWorker/"+h),this._pako=null,this._pakoAction=h,this._pakoOptions=f,this.meta={}}s.magic="\b\0",l.inherits(d,c),d.prototype.processChunk=function(h){this.meta=h.meta,this._pako===null&&this._createPako(),this._pako.push(l.transformTo(u,h.data),!1)},d.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var h=this;this._pako.onData=function(f){h.push({data:f,meta:h.meta})}},s.compressWorker=function(h){return new d("Deflate",h)},s.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,n,s){function i(p,m){var g,v="";for(g=0;g<m;g++)v+=String.fromCharCode(255&p),p>>>=8;return v}function o(p,m,g,v,b,y){var w,_,N=p.file,S=p.compression,E=y!==u.utf8encode,T=l.transformTo("string",y(N.name)),D=l.transformTo("string",u.utf8encode(N.name)),R=N.comment,H=l.transformTo("string",y(R)),A=l.transformTo("string",u.utf8encode(R)),U=D.length!==N.name.length,C=A.length!==R.length,M="",L="",B="",I=N.dir,z=N.date,X={crc32:0,compressedSize:0,uncompressedSize:0};m&&!g||(X.crc32=p.crc32,X.compressedSize=p.compressedSize,X.uncompressedSize=p.uncompressedSize);var F=0;m&&(F|=8),E||!U&&!C||(F|=2048);var q=0,V=0;I&&(q|=16),b==="UNIX"?(V=798,q|=function(ee,Z){var ie=ee;return ee||(ie=Z?16893:33204),(65535&ie)<<16}(N.unixPermissions,I)):(V=20,q|=function(ee){return 63&(ee||0)}(N.dosPermissions)),w=z.getUTCHours(),w<<=6,w|=z.getUTCMinutes(),w<<=5,w|=z.getUTCSeconds()/2,_=z.getUTCFullYear()-1980,_<<=4,_|=z.getUTCMonth()+1,_<<=5,_|=z.getUTCDate(),U&&(L=i(1,1)+i(d(T),4)+D,M+="up"+i(L.length,2)+L),C&&(B=i(1,1)+i(d(H),4)+A,M+="uc"+i(B.length,2)+B);var K="";return K+=`
1360\0`,K+=i(F,2),K+=S.magic,K+=i(w,2),K+=i(_,2),K+=i(X.crc32,4),K+=i(X.compressedSize,4),K+=i(X.uncompressedSize,4),K+=i(T.length,2),K+=i(M.length,2),{fileRecord:h.LOCAL_FILE_HEADER+K+T+M,dirRecord:h.CENTRAL_FILE_HEADER+i(V,2)+K+i(H.length,2)+"\0\0\0\0"+i(q,4)+i(v,4)+T+M+H}}var l=t("../utils"),c=t("../stream/GenericWorker"),u=t("../utf8"),d=t("../crc32"),h=t("../signature");function f(p,m,g,v){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=m,this.zipPlatform=g,this.encodeFileName=v,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}l.inherits(f,c),f.prototype.push=function(p){var m=p.meta.percent||0,g=this.entriesCount,v=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,c.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:g?(m+100*(g-v-1))/g:100}}))},f.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var m=this.streamFiles&&!p.file.dir;if(m){var g=o(p,m,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:g.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(p){this.accumulate=!1;var m=this.streamFiles&&!p.file.dir,g=o(p,m,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(g.dirRecord),m)this.push({data:function(v){return h.DATA_DESCRIPTOR+i(v.crc32,4)+i(v.compressedSize,4)+i(v.uncompressedSize,4)}(p),meta:{percent:100}});else for(this.push({data:g.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var p=this.bytesWritten,m=0;m<this.dirRecords.length;m++)this.push({data:this.dirRecords[m],meta:{percent:100}});var g=this.bytesWritten-p,v=function(b,y,w,_,N){var S=l.transformTo("string",N(_));return h.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(b,2)+i(b,2)+i(y,4)+i(w,4)+i(S.length,2)+S}(this.dirRecords.length,g,p,this.zipComment,this.encodeFileName);this.push({data:v,meta:{percent:100}})},f.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},f.prototype.registerPrevious=function(p){this._sources.push(p);var m=this;return p.on("data",function(g){m.processChunk(g)}),p.on("end",function(){m.closedSource(m.previous.streamInfo),m._sources.length?m.prepareNextSource():m.end()}),p.on("error",function(g){m.error(g)}),this},f.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},f.prototype.error=function(p){var m=this._sources;if(!c.prototype.error.call(this,p))return!1;for(var g=0;g<m.length;g++)try{m[g].error(p)}catch{}return!0},f.prototype.lock=function(){c.prototype.lock.call(this);for(var p=this._sources,m=0;m<p.length;m++)p[m].lock()},n.exports=f},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(t,n,s){var i=t("../compressions"),o=t("./ZipFileWorker");s.generateWorker=function(l,c,u){var d=new o(c.streamFiles,u,c.platform,c.encodeFileName),h=0;try{l.forEach(function(f,p){h++;var m=function(y,w){var _=y||w,N=i[_];if(!N)throw new Error(_+" is not a valid compression method !");return N}(p.options.compression,c.compression),g=p.options.compressionOptions||c.compressionOptions||{},v=p.dir,b=p.date;p._compressWorker(m,g).withStreamInfo("file",{name:f,dir:v,date:b,comment:p.comment||"",unixPermissions:p.unixPermissions,dosPermissions:p.dosPermissions}).pipe(d)}),d.entriesCount=h}catch(f){d.error(f)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(t,n,s){function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var o=new i;for(var l in this)typeof this[l]!="function"&&(o[l]=this[l]);return o}}(i.prototype=t("./object")).loadAsync=t("./load"),i.support=t("./support"),i.defaults=t("./defaults"),i.version="3.10.2",i.loadAsync=function(o,l){return new i().loadAsync(o,l)},i.external=t("./external"),n.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(t,n,s){var i=t("./utils"),o=t("./external"),l=t("./utf8"),c=t("./zipEntries"),u=t("./stream/Crc32Probe"),d=t("./nodejsUtils");function h(f){return new o.Promise(function(p,m){var g=f.decompressed.getContentWorker().pipe(new u);g.on("error",function(v){m(v)}).on("end",function(){g.streamInfo.crc32!==f.decompressed.crc32?m(new Error("Corrupted zip : CRC32 mismatch")):p()}).resume()})}n.exports=function(f,p){var m=this;return p=i.extend(p||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:l.utf8decode}),d.isNode&&d.isStream(f)?o.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip f
1360ile",f,!0,p.optimizedBinaryString,p.base64).then(function(g){var v=new c(p);return v.load(g),v}).then(function(g){var v=[o.Promise.resolve(g)],b=g.files;if(p.checkCRC32)for(var y=0;y<b.length;y++)v.push(h(b[y]));return o.Promise.all(v)}).then(function(g){for(var v=g.shift(),b=v.files,y=0;y<b.length;y++){var w=b[y],_=w.fileNameStr,N=i.resolve(w.fileNameStr);m.file(N,w.decompressed,{binary:!0,optimizedBinaryString:!0,date:w.date,dir:w.dir,comment:w.fileCommentStr.length?w.fileCommentStr:null,unixPermissions:w.unixPermissions,dosPermissions:w.dosPermissions,createFolders:p.createFolders}),w.dir||(m.file(N).unsafeOriginalName=_)}return v.zipComment.length&&(m.comment=v.zipComment),m})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(t,n,s){var i=t("../utils"),o=t("../stream/GenericWorker");function l(c,u){o.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(u)}i.inherits(l,o),l.prototype._bindStream=function(c){var u=this;(this._stream=c).pause(),c.on("data",function(d){u.push({data:d,meta:{percent:0}})}).on("error",function(d){u.isPaused?this.generatedError=d:u.error(d)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},l.prototype.pause=function(){return!!o.prototype.pause.call(this)&&(this._stream.pause(),!0)},l.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},n.exports=l},{"../stream/GenericWorker":28,"../utils":32}],13:[function(t,n,s){var i=t("readable-stream").Readable;function o(l,c,u){i.call(this,c),this._helper=l;var d=this;l.on("data",function(h,f){d.push(h)||d._helper.pause(),u&&u(f)}).on("error",function(h){d.emit("error",h)}).on("end",function(){d.push(null)})}t("../utils").inherits(o,i),o.prototype._read=function(){this._helper.resume()},n.exports=o},{"../utils":32,"readable-stream":16}],14:[function(t,n,s){n.exports={isNode:typeof Buffer<"u",newBufferFrom:function(i,o){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,o);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,o)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var o=new Buffer(i);return o.fill(0),o},isBuffer:function(i){return Buffer.isBuffer(i)},isStream:function(i){return i&&typeof i.on=="function"&&typeof i.pause=="function"&&typeof i.resume=="function"}}},{}],15:[function(t,n,s){function i(N,S,E){var T,D=l.getTypeOf(S),R=l.extend(E||{},d);R.date=R.date||new Date,R.compression!==null&&(R.compression=R.compression.toUpperCase()),typeof R.unixPermissions=="string"&&(R.unixPermissions=parseInt(R.unixPermissions,8)),R.unixPermissions&&16384&R.unixPermissions&&(R.dir=!0),R.dosPermissions&&16&R.dosPermissions&&(R.dir=!0),R.dir&&(N=b(N)),R.createFolders&&(T=v(N))&&y.call(this,T,!0);var H=D==="string"&&R.binary===!1&&R.base64===!1;E&&E.binary!==void 0||(R.binary=!H),(S instanceof h&&S.uncompressedSize===0||R.dir||!S||S.length===0)&&(R.base64=!1,R.binary=!0,S="",R.compression="STORE",D="string");var A=null;A=S instanceof h||S instanceof c?S:m.isNode&&m.isStream(S)?new g(N,S):l.prepareContent(N,S,R.binary,R.optimizedBinaryString,R.base64);var U=new f(N,A,R);this.files[N]=U}var o=t("./utf8"),l=t("./utils"),c=t("./stream/GenericWorker"),u=t("./stream/StreamHelper"),d=t("./defaults"),h=t("./compressedObject"),f=t("./zipObject"),p=t("./generate"),m=t("./nodejsUtils"),g=t("./nodejs/NodejsStreamInputAdapter"),v=function(N){N.slice(-1)==="/"&&(N=N.substring(0,N.length-1));var S=N.lastIndexOf("/");return 0<S?N.substring(0,S):""},b=function(N){return N.slice(-1)!=="/"&&(N+="/"),N},y=function(N,S){return S=S!==void 0?S:d.createFolders,N=b(N),this.files[N]||i.call(this,N,null,{dir:!0,createFolders:S}),this.files[N]};function w(N){return Object.prototype.toString.call(N)==="[object RegExp]"}var _={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(N){var S,E,T;for(S in this.files)T=this.files[S],(E=S.slice(this.root.length,S.length))&&S.slice(0,this.root.length)===this.root&&N(E,T)},filter:function(N){var S=[];return this.forEach(function(E,T){N(E,T)&&S.push(T)}),S},file:function(N,S,E){if(arguments.length!==1)return N=this.root+N,i.call(this,N,S,E),this;if(w(N)){var T=N;return this.filter(function(R,H){return!H.dir&&T.test(R)})}var D=this.files[this.root+N];return D&&!D.dir?D:null},folder:function(N){if(!N)return this;if(w(N))return this.filter(function(D,R){return R.dir&&N.test(D)});var S=this.root+N,E=y.call(this,S),T=this.clone();return T.root=E.name,T},remove:function(N){N=this.root+N;var S=this.files[N];if(S||(N.slice(-1)!=="/"&&(N+="/"),S=this.files[N]),S&&!S.dir)delete this.files[N];else for(var E=this.filter(function(D,R){return R.name.slice(0,N.length)===N}),T=0;T<E.length;T++)delete this.files[E[T].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")}
vendor: 22,162 bytes, line 1360
1360,generateInternalStream:function(N){var S,E={};try{if((E=l.extend(N||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:o.utf8encode})).type=E.type.toLowerCase(),E.compression=E.compression.toUpperCase(),E.type==="binarystring"&&(E.type="string"),!E.type)throw new Error("No output type specified.");l.checkSupport(E.type),E.platform!=="darwin"&&E.platform!=="freebsd"&&E.platform!=="linux"&&E.platform!=="sunos"||(E.platform="UNIX"),E.platform==="win32"&&(E.platform="DOS");var T=E.comment||this.comment||"";S=p.generateWorker(this,E,T)}catch(D){(S=new c("error")).error(D)}return new u(S,E.type||"string",E.mimeType)},generateAsync:function(N,S){return this.generateInternalStream(N).accumulate(S)},generateNodeStream:function(N,S){return(N=N||{}).type||(N.type="nodebuffer"),this.generateInternalStream(N).toNodejsStream(S)}};n.exports=_},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(t,n,s){n.exports=t("stream")},{stream:void 0}],17:[function(t,n,s){var i=t("./DataReader");function o(l){i.call(this,l);for(var c=0;c<this.data.length;c++)l[c]=255&l[c]}t("../utils").inherits(o,i),o.prototype.byteAt=function(l){return this.data[this.zero+l]},o.prototype.lastIndexOfSignature=function(l){for(var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),h=l.charCodeAt(3),f=this.length-4;0<=f;--f)if(this.data[f]===c&&this.data[f+1]===u&&this.data[f+2]===d&&this.data[f+3]===h)return f-this.zero;return-1},o.prototype.readAndCheckSignature=function(l){var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),h=l.charCodeAt(3),f=this.readData(4);return c===f[0]&&u===f[1]&&d===f[2]&&h===f[3]},o.prototype.readData=function(l){if(this.checkOffset(l),l===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=o},{"../utils":32,"./DataReader":18}],18:[function(t,n,s){var i=t("../utils");function o(l){this.data=l,this.length=l.length,this.index=0,this.zero=0}o.prototype={checkOffset:function(l){this.checkIndex(this.index+l)},checkIndex:function(l){if(this.length<this.zero+l||l<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+l+"). Corrupted zip ?")},setIndex:function(l){this.checkIndex(l),this.index=l},skip:function(l){this.setIndex(this.index+l)},byteAt:function(){},readInt:function(l){var c,u=0;for(this.checkOffset(l),c=this.index+l-1;c>=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=l,u},readString:function(l){return i.transformTo("string",this.readData(l))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var l=this.readInt(4);return new Date(Date.UTC(1980+(l>>25&127),(l>>21&15)-1,l>>16&31,l>>11&31,l>>5&63,(31&l)<<1))}},n.exports=o},{"../utils":32}],19:[function(t,n,s){var i=t("./Uint8ArrayReader");function o(l){i.call(this,l)}t("../utils").inherits(o,i),o.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,n,s){var i=t("./DataReader");function o(l){i.call(this,l)}t("../utils").inherits(o,i),o.prototype.byteAt=function(l){return this.data.charCodeAt(this.zero+l)},o.prototype.lastIndexOfSignature=function(l){return this.data.lastIndexOf(l)-this.zero},o.prototype.readAndCheckSignature=function(l){return l===this.readData(4)},o.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=o},{"../utils":32,"./DataReader":18}],21:[function(t,n,s){var i=t("./ArrayReader");function o(l){i.call(this,l)}t("../utils").inherits(o,i),o.prototype.readData=function(l){if(this.checkOffset(l),l===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(t,n,s){var i=t("../utils"),o=t("../support"),l=t("./ArrayReader"),c=t("./StringReader"),u=t("./NodeBufferReader"),d=t("./Uint8ArrayReader");n.exports=function(h){var f=i.getTypeOf(h);return i.checkSupport(f),f!=="string"||o.uint8array?f==="nodebuffer"?new u(h):o.uint8array?new d(i.transformTo("uint8array",h)):new l(i.transformTo("array",h)):new c(h)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,n,s){s.LOCAL_FILE_HEADER="PK��",s.CENTRAL_FILE_HEADER="PK��",s.CENTRAL_DIRECTORY_END="PK��",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK�\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK��",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,n,s){var i=t("./GenericWorker"),o=t("../utils");function l(c){i.call(this,"ConvertWorker to "+c),this.destType=c}o.inherits(l,i),l.prototype.processChunk=function(c){this.push({data:o.transformTo(this.destType,c.data),meta:c.meta})},n.exports=l},{"../utils":32,"./GenericWorker":28}],25:[function(t,n,s){var i=t("./GenericWorker"),o=t("../crc32");function l(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(l,i),l.prototype.processChunk=function(c){this.streamInfo.crc32=o(c.data,this.streamInfo.crc32||0),this.push(c)},n.exports=l},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,n,s){var i=t("../utils"),o=t("./GenericWorker");function l(c){o.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}i.inherits(l,o),l.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}o.prototype.processChunk.call(this,c)},n.exports=l},{"../utils":32,"./GenericWorker":28}],27:[function(t,n,s){var i=t("../utils"),o=t("./GenericWorker");function l(c){o.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=i.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}i.inherits(l,o),l.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},l.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},l.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},l.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=l},{"../utils":32,"./GenericWorker":28}],28:[function(t,n,s){function i(o){this.name=o||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,l){return this._listeners[o].push(l),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,l){if(this._listeners[o])for(var c=0;c<this._listeners[o].length;c++)this._listeners[o][c].call(this,l)},pipe:function(o){return o.registerPrevious(this)},registerPrevious:function(o){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=o.streamInfo,this.mergeStreamInfo(),this.previous=o;var l=this;return o.on("data",function(c){l.processChunk(c)}),o.on("end",function(){l.end()}),o.on("error",function(c){l.error(c)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var o=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),o=!0),this.previous&&this.previous.resume(),!o},flush:function(){},processChunk:function(o){this.push(o)},withStreamInfo:function(o,l){return this.extraStreamInfo[o]=l,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var o in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,o)&&(this.streamInfo[o]=this.extraStreamInfo[o])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var o="Worker "+this.name;return this.previous?this.previous+" -> "+o:o}},n.exports=i},{}],29:[function(t,n,s){var i=t("../utils"),o=t("./ConvertWorker"),l=t("./GenericWorker"),c=t("../base64"),u=t("../support"),d=t("../external"),h=null;if(u.nodestream)try{h=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(m,g){return new d.Promise(function(v,b){var y=[],w=m._internalType,_=m._outputType,N=m._mimeType;m.on("data",function(S,E){y.push(S),g&&g(E)}).on("error",function(S){y=[],b(S)}).on("end",function(){try{var S=function(E,T,D){switch(E){case"blob":return i.newBlob(i.transformTo("arraybuffer",T),D);case"base64":return c.encode(T);default:return i.transformTo(E,T)}}(_,function(E,T){var D,R=0,H=null,A=0;for(D=0;D<T.length;D++)A+=T[D].length;switch(E){case"string":return T.join("");case"array":return Array.prototype.concat.apply([],T);case"uint8array":for(H=new Uint8Array(A),D=0;D<T.length;D++)H.set(T[D],R),R+=T[D].length;return H;case"nodebuffer":return Buffer.concat(T);default:throw new Error("concat : unsupported type '"+E+"'")}}(w,y),N);v(S)}catch(E){b(E)}y=[]}).resume()})}function p(m,g,v){var b=g;switch(g){case"blob":case"arraybuffer":b="uint8array";break;case"base64":b="string"}try{this._internalType=b,this._outputType=g,this._mimeType=v,i.checkSupport(b),this._worker=m.pipe(new o(b)),m.lock()}catch(y){this._worker=new l("error"),this._worker.error(y)}}p.prototype={accumulate:function(m){return f(this,m)},on:function(m,g){var v=this;return m==="data"?this._worker.on(m,function(b){g.call(v,b.data,b.meta)}):this._worker.on(m,function(){i.delay(g,arguments,v)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(m){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new h(this,{objectMode:this._outputType!=="nodebuffer"},m)}},n.exports=p},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(t,n,s){if(s.base64=!0,s.array=!0,s.string=!0,s.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",s.nodebuffer=typeof Buffer<"u",s.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")s.blob=!1;else{var i=new ArrayBuffer(0);try{s.blob=new Blob([i],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(i),s.blob=o.getBlob("application/zip").size===0}catch{s.blob=!1}}}try{s.nodestream=!!t("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(t,n,s){for(var i=t("./utils"),o=t("./support"),l=t("./nodejsUtils"),c=t("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function h(){c.call(this,"utf-8 decode"),this.leftOver=null}function f(){c.call(this,"utf-8 encode")}s.utf8encode=function(p){return o.nodebuffer?l.newBufferFrom(p,"utf-8"):function(m){var g,v,b,y,w,_=m.length,N=0;for(y=0;y<_;y++)(64512&(v=m.charCodeAt(y)))==55296&&y+1<_&&(64512&(b=m.charCodeAt(y+1)))==56320&&(v=65536+(v-55296<<10)+(b-56320),y++),N+=v<128?1:v<2048?2:v<65536?3:4;for(g=o.uint8array?new Uint8Array(N):new Array(N),y=w=0;w<N;y++)(64512&(v=m.charCodeAt(y)))==55296&&y+1<_&&(64512&(b=m.charCodeAt(y+1)))==56320&&(v=65536+(v-55296<<10)+(b-56320),y++),v<128?g[w++]=v:(v<2048?g[w++]=192|v>>>6:(v<65536?g[w++]=224|v>>>12:(g[w++]=240|v>>>18,g[w++]=128|v>>>12&63),g[w++]=128|v>>>6&63),g[w++]=128|63&v);return g}(p)},s.utf8decode=function(p){return o.nodebuffer?i.transformTo("nodebuffer",p).toString("utf-8"):function(m){var g,v,b,y,w=m.length,_=new Array(2*w);for(g=v=0;g<w;)if((b=m[g++])<128)_[v++]=b;else if(4<(y=u[b]))_[v++]=65533,g+=y-1;else{for(b&=y===2?31:y===3?15:7;1<y&&g<w;)b=b<<6|63&m[g++],y--;1<y?_[v++]=65533:b<65536?_[v++]=b:(b-=65536,_[v++]=55296|b>>10&1023,_[v++]=56320|1023&b)}return _.length!==v&&(_.subarray?_=_.subarray(0,v):_.length=v),i.applyFromCharCode(_)}(p=i.transformTo(o.uint8array?"uint8array":"array",p))},i.inherits(h,c),h.prototype.processChunk=function(p){var m=i.transformTo(o.uint8array?"uint8array":"array",p.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var g=m;(m=new Uint8Array(g.length+this.leftOver.length)).set(this.leftOver,0),m.set(g,this.leftOver.length)}else m=this.leftOver.concat(m);this.leftOver=null}var v=function(y,w){var _;for((w=w||y.length)>y.length&&(w=y.length),_=w-1;0<=_&&(192&y[_])==128;)_--;return _<0||_===0?w:_+u[y[_]]>w?_:w}(m),b=m;v!==m.length&&(o.uint8array?(b=m.subarray(0,v),this.leftOver=m.subarray(v,m.length)):(b=m.slice(0,v),this.leftOver=m.slice(v,m.length))),this.push({data:s.utf8decode(b),meta:p.meta})},h.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=h,i.inherits(f,c),f.prototype.processChunk=function(p){this.push({data:s.utf8encode(p.data),meta:p.meta})},s.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,n,s){var i=t("./support"),o=t("./base64"),l=t("./nodejsUtils"),c=t("./external");function u(g){return g}function d(g,v){for(var b=0;b<g.length;++b)v[b]=255&g.charCodeAt(b);return v}t("setimmediate"),s.newBlob=function(g,v){s.checkSupport("blob");try{return new Blob([g],{type:v})}catch{try{var b=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return b.append(g),b.getBlob(v)}catch{throw new Error("Bug : can't construct the Blob.")}}};var h={stringifyByChunk:function(g,v,b){var y=[],w=0,_=g.length;if(_<=b)return String.fromCharCode.apply(null,g);for(;w<_;)v==="array"||v==="nodebuffer"?y.push(String.fromCharCode.apply(null,g.slice(w,Math.min(w+b,_)))):y.push(String.fromCharCode.apply(null,g.subarray(w,Math.min(w+b,_)))),w+=b;return y.join("")},stringifyByChar:function(g){for(var v="",b=0;b<g.length;b++)v+=String.fromCharCode(g[b]);return v},applyCanBeUsed:{uint8array:function(){try{return i.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return i.nodebuffer&&String.fromCharCode.apply(null,l.allocBuffer(1)).length===1}catch{return!1}}()}};function f(g){var v=65536,b=s.getTypeOf(g),y=!0;if(b==="uint8array"?y=h.applyCanBeUsed.uint8array:b==="nodebuffer"&&(y=h.applyCanBeUsed.nodebuffer),y)for(;1<v;)try{return h.stringifyByChunk(g,b,v)}catch{v=Math.floor(v/2)}return h.stringifyByChar(g)}function p(g,v){for(var b=0;b<g.length;b++)v[b]=g[b];return v}s.applyFromCharCode=f;var m={};m.string={string:u,array:function(g){return d(g,new Array(g.length))},arraybuffer:function(g){return m.string.uint8array(g).buffer},uint8array:function(g){return d(g,new Uint8Array(g.length))},nodebuffer:function(g){return d(g,l.allocBuffer(g.length))}},m.array={string:f,array:u,arraybuffer:function(g){return new Uint8Array(g).buffer},uint8array:function(g){return new Uint8Array(g)},nodebuffer:function(g){return l.newBufferFrom(g)}},m.arraybuffer={string:function(g){return f(new Uint8Array(g))},array:function(g){return p(new Uint8Array(g),new Array(g.byteLength))},arraybuffer:u,uint8array:function(g){return new Uint8Array(g)},nodebuffer:function(g){return l.newBufferFrom(new Uint8Array(g))}},m.uint8array={string:f,array:function(g){return p(g,new Array(g.length))},arraybuffer:function(g){return g.buffer},uint8array:u,nodebuffer:function(g){return l.newBufferFrom(g)}},m.nodebuffer={string:f,array:function(g){return p(g,new Array(g.length))},arraybuffer:function(g){return m.nodebuffer.uint8array(g).buffer},uint8array:function(g){return p(g,new Uint8Array(g.length))},nodebuffer:u},s.transformTo=function(g,v){if(v=v||"",!g)return v;s.checkSupport(g);var b=s.getTypeOf(v);return m[b][g](v)},s.resolve=function(g){for(var v=g.split("/"),b=[],y=0;y<v.length;y++){var w=v[y];w==="."||w===""&&y!==0&&y!==v.length-1||(w===".."?b.pop():b.push(w))}return b.join("/")},s.getTypeOf=function(g){if(typeof g=="string")return"string";var v=Object.prototype.toString.call(g);return v==="[object Array]"?"array":i.nodebuffer&&l.isBuffer(g)?"nodebuffer":i.uint8array&&v==="[object Uint8Array]"?"uint8array":i.arraybuffer&&v==="[object ArrayBuffer]"?"arraybuffer":void 0},s.checkSupport=function(g){if(!i[g.toLowerCase()])throw new Error(g+" is not supported by this platform")},s.MAX_VALUE_16BITS=65535,s.MAX_VALUE_32BITS=-1,s.pretty=function(g){var v,b,y="";for(b=0;b<(g||"").length;b++)y+="\\x"+((v=g.charCodeAt(b))<16?"0":"")+v.toString(16).toUpperCase();return y},s.delay=function(g,v,b){setImmediate(function(){g.apply(b||null,v||[])})},s.inherits=function(g,v){function b(){}b.prototype=v.prototype,g.prototype=new b},s.extend=function(){var g,v,b={};for(g=0;g<arguments.length;g++)for(v in arguments[g])Object.prototype.hasOwnProperty.call(arguments[g],v)&&b[v]===void 0&&(b[v]=arguments[g][v]);return b},s.prepareContent=function(g,v,b,y,w){return c.Promise.resolve(v).then(function(_){return i.blob&&(_ instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(_))!==-1)?Blob.prototype.arrayBuffer!==void 0?_.arrayBuffer():typeof FileReader<"u"?new c.Promise(function(N,S){var E=new FileReader;E.onload=function(T){N(T.target.result)},E.onerror=function(T){S(T.target.error)},E.readAsArrayBuffer(_)}):c.Promise.reject(new Error(g+" is a Blob, but we have no way of reading it.")):_}).then(function(_){var N=s.getTypeOf(_);return N?(N==="arraybuffer"?_=s.transformTo("uint8array",_):N==="string"&&(w?_=o.decode(_):b&&y!==!0&&(_=function(S){return d(S,i.uint8array?new Uint8Array(S.length):new Array(S.length))}(_))),_):c.Promise.reject(new Error("Can't read the data of '"+g+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(t,n,s){var i=t("./reader/readerFor"),o=t("./utils"),l=t("./signature"),c=t("./zipEntry"),u=t("./support");function d(h){this.files=[],this.loadOptions=h}d.prototype={checkSignature:function(h){if(!this.reader.readAndCheckSignature(h)){this.reader.index-=4;var f=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+o.pretty(f)+", expected "+o.pretty(h)+")")}},isSignature:function(h,f){var p=this.reader.index;this.reader.setIndex(h);var m=this.reader.readString(4)===f;return this.reader.setIndex(p),m},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var h=this.reader.readData(this.zipCommentLength),f=u.uint8array?"uint8array":"array",p=o.transformTo(f,h);this.zipComment=this.loadOptions.decodeFileName(p)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var h,f,p,m=this.zip64EndOfCentralSize-44;0<m;)h=this.reader.readInt(2),f=this.reader.readInt(4),p=this.reader.readData(f),this.zip64ExtensibleData[h]={id:h,length:f,value:p}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var h,f;for(h=0;h<this.files.length;h++)f=this.files[h],this.reader.setIndex(f.localHeaderOffset),this.checkSignature(l.LOCAL_FILE_HEADER),f.readLocalPart(this.reader),f.handleUTF8(),f.processAttributes()},readCentralDir:function(){var h;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(l.CENTRAL_FILE_HEADER);)(h=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(h);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var h=this.reader.lastIndexOfSignature(l.CENTRAL_DIRECTORY_END);if(h<0)throw this.isSignature(0,l.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip f
1360ile ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(h);var f=h;if(this.checkSignature(l.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===o.MAX_VALUE_16BITS||this.diskWithCentralDirStart===o.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===o.MAX_VALUE_16BITS||this.centralDirRecords===o.MAX_VALUE_16BITS||this.centralDirSize===o.MAX_VALUE_32BITS||this.centralDirOffset===o.MAX_VALUE_32BITS){if(this.zip64=!0,(h=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(h),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,l.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var p=this.centralDirOffset+this.centralDirSize;this.zip64&&(p+=20,p+=12+this.zip64EndOfCentralSize);var m=f-p;if(0<m)this.isSignature(f,l.CENTRAL_FILE_HEADER)||(this.reader.zero=m);else if(m<0)throw new Error("Corrupted zip: missing "+Math.abs(m)+" bytes.")},prepareReader:function(h){this.reader=i(h)},load:function(h){this.prepareReader(h),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},n.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(t,n,s){var i=t("./reader/readerFor"),o=t("./utils"),l=t("./compressedObject"),c=t("./crc32"),u=t("./utf8"),d=t("./compressions"),h=t("./support");function f(p,m){this.options=p,this.loadOptions=m}f.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(p){var m,g;if(p.skip(22),this.fileNameLength=p.readInt(2),g=p.readInt(2),this.fileName=p.readData(this.fileNameLength),p.skip(g),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((m=function(v){for(var b in d)if(Object.prototype.hasOwnProperty.call(d,b)&&d[b].magic===v)return d[b];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+o.pretty(this.compressionMethod)+" unknown (inner file : "+o.transformTo("string",this.fileName)+")");this.decompressed=new l(this.compressedSize,this.uncompressedSize,this.crc32,m,p.readData(this.compressedSize))},readCentralPart:function(p){this.versionMadeBy=p.readInt(2),p.skip(2),this.bitFlag=p.readInt(2),this.compressionMethod=p.readString(2),this.date=p.readDate(),this.crc32=p.readInt(4),this.compressedSize=p.readInt(4),this.uncompressedSize=p.readInt(4);var m=p.readInt(2);if(this.extraFieldsLength=p.readInt(2),this.fileCommentLength=p.readInt(2),this.diskNumberStart=p.readInt(2),this.internalFileAttributes=p.readInt(2),this.externalFileAttributes=p.readInt(4),this.localHeaderOffset=p.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");p.skip(m),this.readExtraFields(p),this.parseZIP64ExtraField(p),this.fileComment=p.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var p=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),p==0&&(this.dosPermissions=63&this.externalFileAttributes),p==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var p=i(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&
vendor: 8,643 bytes, line 1360
1360(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var m,g,v,b=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4<b;)m=p.readInt(2),g=p.readInt(2),v=p.readData(g),this.extraFields[m]={id:m,length:g,value:v};p.setIndex(b)},handleUTF8:function(){var p=h.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var m=this.findExtraFieldUnicodePath();if(m!==null)this.fileNameStr=m;else{var g=o.transformTo(p,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(g)}var v=this.findExtraFieldUnicodeComment();if(v!==null)this.fileCommentStr=v;else{var b=o.transformTo(p,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(b)}}},findExtraFieldUnicodePath:function(){var p=this.extraFields[28789];if(p){var m=i(p.value);return m.readInt(1)!==1||c(this.fileName)!==m.readInt(4)?null:u.utf8decode(m.readData(p.length-5))}return null},findExtraFieldUnicodeComment:function(){var p=this.extraFields[25461];if(p){var m=i(p.value);return m.readInt(1)!==1||c(this.fileComment)!==m.readInt(4)?null:u.utf8decode(m.readData(p.length-5))}return null}},n.exports=f},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(t,n,s){function i(m,g,v){this.name=m,this.dir=v.dir,this.date=v.date,this.comment=v.comment,this.unixPermissions=v.unixPermissions,this.dosPermissions=v.dosPermissions,this._data=g,this._dataBinary=v.binary,this.options={compression:v.compression,compressionOptions:v.compressionOptions}}var o=t("./stream/StreamHelper"),l=t("./stream/DataWorker"),c=t("./utf8"),u=t("./compressedObject"),d=t("./stream/GenericWorker");i.prototype={internalStream:function(m){var g=null,v="string";try{if(!m)throw new Error("No output type specified.");var b=(v=m.toLowerCase())==="string"||v==="text";v!=="binarystring"&&v!=="text"||(v="string"),g=this._decompressWorker();var y=!this._dataBinary;y&&!b&&(g=g.pipe(new c.Utf8EncodeWorker)),!y&&b&&(g=g.pipe(new c.Utf8DecodeWorker))}catch(w){(g=new d("error")).error(w)}return new o(g,v,"")},async:function(m,g){return this.internalStream(m).accumulate(g)},nodeStream:function(m,g){return this.internalStream(m||"nodebuffer").toNodejsStream(g)},_compressWorker:function(m,g){if(this._data instanceof u&&this._data.compression.magic===m.magic)return this._data.getCompressedWorker();var v=this._decompressWorker();return this._dataBinary||(v=v.pipe(new c.Utf8EncodeWorker)),u.createWorkerFrom(v,m,g)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new l(this._data)}};for(var h=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],f=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},p=0;p<h.length;p++)i.prototype[h[p]]=f;n.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(t,n,s){(function(i){var o,l,c=i.MutationObserver||i.WebKitMutationObserver;if(c){var u=0,d=new c(m),h=i.document.createTextNode("");d.observe(h,{characterData:!0}),o=function(){h.data=u=++u%2}}else if(i.setImmediate||i.MessageChannel===void 0)o="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var g=i.document.createElement("script");g.onreadystatechange=function(){m(),g.onreadystatechange=null,g.parentNode.removeChild(g),g=null},i.document.documentElement.appendChild(g)}:function(){setTimeout(m,0)};else{var f=new i.MessageChannel;f.port1.onmessage=m,o=function(){f.port2.postMessage(0)}}var p=[];function m(){var g,v;l=!0;for(var b=p.length;b;){for(v=p,p=[],g=-1;++g<b;)v[g]();b=p.length}l=!1}n.exports=function(g){p.push(g)!==1||l||o()}}).call(this,typeof Be<"u"?Be:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(t,n,s){var i=t("immediate");function o(){}var l={},c=["REJECTED"],u=["FULFILLED"],d=["PENDING"];function h(b){if(typeof b!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,b!==o&&g(this,b)}function f(b,y,w){this.promise=b,typeof y=="function"&&(this.onFulfilled=y,this.callFulfilled=this.otherCallFulfilled),typeof w=="function"&&(this.onRejected=w,this.callRejected=this.otherCallRejected)}function p(b,y,w){i(function(){var _;try{_=y(w)}catch(N){return l.reject(b,N)}_===b?l.reject(b,new TypeError("Cannot resolve promise with itself")):l.resolve(b,_)})}function m(b){var y=b&&b.then;if(b&&(typeof b=="object"||typeof b=="function")&&typeof y=="function")return function(){y.apply(b,arguments)}}function g(b,y){var w=!1;function _(E){w||(w=!0,l.reject(b,E))}function N(E){w||(w=!0,l.resolve(b,E))}var S=v(function(){y(N,_)});S.status==="error"&&_(S.value)}function v(b,y){var w={};try{w.value=b(y),w.status="success"}catch(_){w.status="error",w.value=_}return w}(n.exports=h).prototype.finally=function(b){if(typeof b!="function")return this;var y=this.constructor;return this.then(function(w){return y.resolve(b()).then(function(){return w})},function(w){return y.resolve(b()).then(function(){throw w})})},h.prototype.catch=function(b){return this.then(null,b)},h.prototype.then=function(b,y){if(typeof b!="function"&&this.state===u||typeof y!="function"&&this.state===c)return this;var w=new this.constructor(o);return this.state!==d?p(w,this.state===u?b:y,this.outcome):this.queue.push(new f(w,b,y)),w},f.prototype.callFulfilled=function(b){l.resolve(this.promise,b)},f.prototype.otherCallFulfilled=function(b){p(this.promise,this.onFulfilled,b)},f.prototype.callRejected=function(b){l.reject(this.promise,b)},f.prototype.otherCallRejected=function(b){p(this.promise,this.onRejected,b)},l.resolve=function(b,y){var w=v(m,y);if(w.status==="error")return l.reject(b,w.value);var _=w.value;if(_)g(b,_);else{b.state=u,b.outcome=y;for(var N=-1,S=b.queue.length;++N<S;)b.queue[N].callFulfilled(y)}return b},l.reject=function(b,y){b.state=c,b.outcome=y;for(var w=-1,_=b.queue.length;++w<_;)b.queue[w].callRejected(y);return b},h.resolve=function(b){return b instanceof this?b:l.resolve(new this(o),b)},h.reject=function(b){var y=new this(o);return l.reject(y,b)},h.all=function(b){var y=this;if(Object.prototype.toString.call(b)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=b.length,_=!1;if(!w)return this.resolve([]);for(var N=new Array(w),S=0,E=-1,T=new this(o);++E<w;)D(b[E],E);return T;function D(R,H){y.resolve(R).then(function(A){N[H]=A,++S!==w||_||(_=!0,l.resolve(T,N))},function(A){_||(_=!0,l.reject(T,A))})}},h.race=function(b){var y=this;if(Object.prototype.toString.call(b)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=b.length,_=!1;if(!w)return this.resolve([]);for(var N=-1,S=new this(o);++N<w;)E=b[N],y.resolve(E).then(function(T){_||(_=!0,l.resolve(S,T))},function(T){_||(_=!0,l.reject(S,T))});var E;return S}},{immediate:36}],38:[function(t,n,s){var i={};(0,t("./lib/utils/common").assign)(i,t("./lib/deflate"),t("./lib/inflate"),t("./lib/zlib/constants")),n.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(t,n,s){var i=t("./zlib/deflate"),o=t("./utils/common"),l=t("./utils/strings"),c=t("./zlib/messages"),u=t("./zlib/zstream"),d=Object.prototype.toString,h=0,f=-1,p=0,m=8;function g(b){if(!(this instanceof g))return new g(b);this.options=o.assign({level:f,method:m,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,to:""},b||{});var y=this.options;y.raw&&0<y.windowBits?y.windowBits=-y.windowBits:y.gzip&&0<y.windowBits&&y.windowBits<16&&(y.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var w=i.deflateInit2(this.strm,y.level,y.method,y.windowBits,y.memLevel,y.strategy);if(w!==h)throw new Error(c[w]);if(y.header&&i.deflateSetHeader(this.strm,y.header),y.dictionary){var _;if(_=typeof y.dictionary=="string"?l.string2buf(y.dictionary):d.call(y.dictionary)==="[object ArrayBuffer]"?new Uint8Array(y.dictionary):y.dictionary,(w=i.deflateSetDictionary(this.strm,_))!==h)throw new Error(c[w]);this._dict_set=!0}}function v(b,y){var w=new g(y);if(w.push(b,!0),w.err)throw w.msg||c[w.err];return w.result}g.prototype.push=function(b,y){var w,_,N=this.strm,S=this.options.chunkSize;if(this.ended)return!1;_=y===~~y?y:y===!0?4:0,typeof b=="string"?N.input=l.string2buf(b):d.call(b)==="[object ArrayBuffer]"?N.input=new 
vendor: 2,440 bytes, line 1360
1360Uint8Array(b):N.input=b,N.next_in=0,N.avail_in=N.input.length;do{if(N.avail_out===0&&(N.output=new o.Buf8(S),N.next_out=0,N.avail_out=S),(w=i.deflate(N,_))!==1&&w!==h)return this.onEnd(w),!(this.ended=!0);N.avail_out!==0&&(N.avail_in!==0||_!==4&&_!==2)||(this.options.to==="string"?this.onData(l.buf2binstring(o.shrinkBuf(N.output,N.next_out))):this.onData(o.shrinkBuf(N.output,N.next_out)))}while((0<N.avail_in||N.avail_out===0)&&w!==1);return _===4?(w=i.deflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===h):_!==2||(this.onEnd(h),!(N.avail_out=0))},g.prototype.onData=function(b){this.chunks.push(b)},g.prototype.onEnd=function(b){b===h&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=b,this.msg=this.strm.msg},s.Deflate=g,s.deflate=v,s.deflateRaw=function(b,y){return(y=y||{}).raw=!0,v(b,y)},s.gzip=function(b,y){return(y=y||{}).gzip=!0,v(b,y)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(t,n,s){var i=t("./zlib/inflate"),o=t("./utils/common"),l=t("./utils/strings"),c=t("./zlib/constants"),u=t("./zlib/messages"),d=t("./zlib/zstream"),h=t("./zlib/gzheader"),f=Object.prototype.toString;function p(g){if(!(this instanceof p))return new p(g);this.options=o.assign({chunkSize:16384,windowBits:0,to:""},g||{});var v=this.options;v.raw&&0<=v.windowBits&&v.windowBits<16&&(v.windowBits=-v.windowBits,v.windowBits===0&&(v.windowBits=-15)),!(0<=v.windowBits&&v.windowBits<16)||g&&g.windowBits||(v.windowBits+=32),15<v.windowBits&&v.windowBits<48&&!(15&v.windowBits)&&(v.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var b=i.inflateInit2(this.strm,v.windowBits);if(b!==c.Z_OK)throw new Error(u[b]);this.header=new h,i.inflateGetHeader(this.strm,this.header)}function m(g,v){var b=new p(v);if(b.push(g,!0),b.err)throw b.msg||u[b.err];return b.result}p.prototype.push=function(g,v){var b,y,w,_,N,S,E=this.strm,T=this.options.chunkSize,D=this.options.dictionary,R=!1;if(this.ended)return!1;y=v===~~v?v:v===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof g=="string"?E.input=l.binstring2buf(g):f.call(g)==="[object ArrayBuffer]"?E.input=new Uint8Array(g):E.input=g,E.next_in=0,E.avail_in=E.input.length;do{if(E.avail_out===0&&(E.output=new o.Buf8(T),E.next_out=0,E.avail_out=T),(b=i.inflate(E,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&D&&(S=typeof D=="str
1360ing"?l.string2buf(D):f.call(D)==="[object ArrayBuffer]"?new Uint8Array(D):D,b=i.inflateSetDictionary(this.strm,S)),b===c.Z_BUF_ERROR&&R===!0&&(b=c.Z_OK,R=!1),b!==c.Z_STREAM_END&&b!==c.Z_OK)return this.onEnd(b),!(this.ended=!0);E.next_out&&(E.avail_out!==0&&b!==c.Z_STREAM_END&&(E.avail_in!==0||y!==c.Z_FINISH&&y!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(w=l.utf8border(E.output,E.next_out),_=E.next_out-w,N=l.buf2string(E.output,w),E.next_out=_,E.avail_out=T-_,_&&o.arraySet(E.output,E.output,w,_,0),this.onData(N)):this.onData(o.shrinkBuf(E.output,E.next_out)))),E.avail_in===0&&E.avail_out===0&&(R=!0)}while((0<E.avail_in||E.avail_out===0)&&b!==c.Z_STREAM_END);return b===c.Z_STREAM_END&&(y=c.Z_FINISH),y===c.Z_FINISH?(b=i.inflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===c.Z_OK):y!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(E.avail_out=0))},p.prototype.onData=function(g){this.chunks.push(g)},p.prototype.onEnd=function(g){g===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=g,this.msg=this.strm.msg},s.Inflate=p,s.inflate=m,s.inflateRaw=function(g,v){return(v=v||{}).raw=!0,m(g,v)},s.ungzip=m},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(t,n,s){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";s.assign=function(c){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var d=u.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var h in d)d.hasOwnProperty(h)&&(c[h]=d[h])}}return c},s.shrinkBuf=function(c,u){return c.length===u?c:c.subarray?c.subarray(0,u):(c.length=u,c)};var o={arraySet:function(c,u,d,h,f){if(u.subarray&&c.subarray)c.set(u.subarray(d,d+h),f);else for(var p=0;p<h;p++)c[f+p]=u[d+p]},flattenChunks:function(c){var u,d,h,f,p,m;for(u=h=0,d=c.length;u<d;u++)h+=c[u].length;for(m=new Uint8Array(h),u=f=0,d=c.length;u<d;u++)p=c[u],m.set(p,f),f+=p.length;return m}},l={arraySet:function(c,u,d,h,f){for(var p=0;p<h;p++)c[f+p]=u[d+p]},flattenChunks:function(c){return[].concat.apply([],c)}};s.setTyped=function(c){c?(s.Buf8=Uint8Array,s.Buf16=Uint16Array,s.Buf32=Int32Array,s.assign(s,o)):(s.Buf8=Array,s.Buf16=Array,s.Buf32=Array,s.assign(s,l))},s.setTyped(i)},{}],42:[function(t,n,s){var i=t("./common"),o=!0,l=!0;try{String.fromCharCode.apply(null,[0])}catch{o=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{l=!1}for(var c=new i.Buf8(256),u=0;u<256;u++)c[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function d(h,f){if(f<65537&&(h.subarray&&l||!h.subarray&&o))return String.fromCharCode.apply(null,i.shrinkBuf(h,f));for(var p="",m=0;m<f;m++)p+=String.fromCharCode(h[m]);return p}c[254]=c[254]=1,s.string2buf=function(h){var f,p,m,g,v,b=h.length,y=0;for(g=0;g<b;g++)(64512&(p=h.charCodeAt(g)))==55296&&g+1<b&&(64512&(m=h.charCodeAt(g+1)))==56320&&(p=65536+(p-55296<<10)+(m-56320),g++),y+=p<128?1:p<2048?2:p<65536?3:4;for(f=new i.Buf8(y),g=v=0;v<y;g++)(64512&(p=h.charCodeAt(g)))==55296&&g+1<b&&(64512&(m=h.charCodeAt(g+1)))==56320&&(p=65536+(p-55296<<10)+(m-56320),g++),p<128?f[v++]=p:(p<2048?f[v++]=192|p>>>6:(p<65536?f[v++]=224|p>>>12:(f[v++]=240|p>>>18,f[v++]=128|p>>>12&63),f[v++]=128|p>>>6&63),f[v++]=128|63&p);return f},s.buf2binstring=function(h){return d(h,h.length)},s.binstring2buf=function(h){for(var f=new i.Buf8(h.length),p=0,m=f.length;p<m;p++)f[p]=h.charCodeAt(p);return f},s.buf2string=function(h,f){var p,m,g,v,b=f||h.length,y=new Array(2*b);for(p=m=0;p<b;)if((g=h[p++])<128)y[m++]=g;else if(4<(v=c[g]))y[m++]=65533,p+=v-1;else{for(g&=v===2?31:v===3?15:7;1<v&&p<b;)g=g<<6|63&h[p++],v--;1<v?y[m++]=65533:g<65536?y[m++]=g:(g-=65536,y[m++]=55296|g>>10&1023,y[m++]=56320|1023&g)}return d(y,m)},s.utf8border=function(h,f){var p;for((f=f||h.length)>h.length&&(f=h.length),p=f-1;0<=p&&(192&h[p])==128;)p--;return p<0||p===0?f:p+c[h[p]]>f?p:f}},{"./common":41}],43:[function(t,n,s){n.exports=function(i,o,l,c){for(var u=65535&i|0,d=i>>>16&65535|0,h=0;l!==0;){for(l-=h=2e3<l?2e3:l;d=d+(u=u+o[c++]|0)|0,--h;);u%=65521,d%=65521}return u|d<<16|0}},{}],44:[function(t,n,s){n.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ER
vendor: 10,541 bytes, line 1360
1360ROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(t,n,s){var i=function(){for(var o,l=[],c=0;c<256;c++){o=c;for(var u=0;u<8;u++)o=1&o?3988292384^o>>>1:o>>>1;l[c]=o}return l}();n.exports=function(o,l,c,u){var d=i,h=u+c;o^=-1;for(var f=u;f<h;f++)o=o>>>8^d[255&(o^l[f])];return-1^o}},{}],46:[function(t,n,s){var i,o=t("../utils/common"),l=t("./trees"),c=t("./adler32"),u=t("./crc32"),d=t("./messages"),h=0,f=4,p=0,m=-2,g=-1,v=4,b=2,y=8,w=9,_=286,N=30,S=19,E=2*_+1,T=15,D=3,R=258,H=R+D+1,A=42,U=113,C=1,M=2,L=3,B=4;function I(j,oe){return j.msg=d[oe],oe}function z(j){return(j<<1)-(4<j?9:0)}function X(j){for(var oe=j.length;0<=--oe;)j[oe]=0}function F(j){var oe=j.state,ne=oe.pending;ne>j.avail_out&&(ne=j.avail_out),ne!==0&&(o.arraySet(j.output,oe.pending_buf,oe.pending_out,ne,j.next_out),j.next_out+=ne,oe.pending_out+=ne,j.total_out+=ne,j.avail_out-=ne,oe.pending-=ne,oe.pending===0&&(oe.pending_out=0))}function q(j,oe){l._tr_flush_block(j,0<=j.block_start?j.block_start:-1,j.strstart-j.block_start,oe),j.block_start=j.strstart,F(j.strm)}function V(j,oe){j.pending_buf[j.pending++]=oe}function K(j,oe){j.pending_buf[j.pending++]=oe>>>8&255,j.pending_buf[j.pending++]=255&oe}function ee(j,oe){var ne,G,W=j.max_chain_length,te=j.strstart,he=j.prev_length,ge=j.nice_match,ae=j.strstart>j.w_size-H?j.strstart-(j.w_size-H):0,J=j.window,Q=j.w_mask,se=j.prev,ue=j.strstart+R,Ne=J[te+he-1],ce=J[te+he];j.prev_length>=j.good_match&&(W>>=2),ge>j.lookahead&&(ge=j.lookahead);do if(J[(ne=oe)+he]===ce&&J[ne+he-1]===Ne&&J[ne]===J[te]&&J[++ne]===J[te+1]){te+=2,ne++;do;while(J[++te]===J[++ne]&&J[++te]===J[++ne]&&J[++te]===J[++ne]&&J[++te]===J[++ne]&&J[++te]===J[++ne]&&J[++te]===J[++ne]&&J[++te]===J[++ne]&&J[++te]===J[++ne]&&te<ue);if(G=R-(ue-te),te=ue-R,he<G){if(j.match_start=oe,ge<=(he=G))break;Ne=J[te+he-1],ce=J[te+he]}}while((oe=se[oe&Q])>ae&&--W!=0);return he<=j.lookahead?he:j.lookahead}function Z(j){var oe,ne,G,W,te,he,ge,ae,J,Q,se=j.w_size;do{if(W=j.window_size-j.lookahead-j.strstart,j.strstart>=se+(se-H)){for(o.arraySet(j.window,j.window,se,se,0),j.match_start-=se,j.strstart-=se,j.block_start-=se,oe=ne=j.hash_size;G=j.head[--oe],j.head[oe]=se<=G?G-se:0,--ne;);for(oe=ne=se;G=j.prev[--oe],j.prev[oe]=se<=G?G-se:0,--ne;);W+=se}if(j.strm.avail_in===0)break;if(he=j.strm,ge=j.window,ae=j.strstart+j.lookahead,J=W,Q=void 0,Q=he.avail_in,J<Q&&(Q=J),ne=Q===0?0:(he.avail_in-=Q,o.arraySet(ge,he.input,he.next_in,Q,ae),he.state.wrap===1?he.adler=c(he.adler,ge,Q,ae):he.state.wrap===2&&(he.adler=u(he.adler,ge,Q,ae)),he.next_in+=Q,he.total_in+=Q,Q),j.lookahead+=ne,j.lookahead+j.insert>=D)for(te=j.strstart-j.insert,j.ins_h=j.window[te],j.ins_h=(j.ins_h<<j.hash_shift^j.window[te+1])&j.hash_mask;j.insert&&(j.ins_h=(j.ins_h<<j.hash_shift^j.window[te+D-1])&j.hash_mask,j.prev[te&j.w_mask]=j.head[j.ins_h],j.head[j.ins_h]=te,te++,j.insert--,!(j.lookahead+j.insert<D)););}while(j.lookahead<H&&j.strm.avail_in!==0)}function ie(j,oe){for(var ne,G;;){if(j.lookahead<H){if(Z(j),j.lookahead<H&&oe===h)return C;if(j.lookahead===0)break}if(ne=0,j.lookahead>=D&&(j.ins_h=(j.ins_h<<j.hash_shift^j.window[j.strstart+D-1])&j.hash_mask,ne=j.prev[j.strstart&j.w_mask]=j.head[j.ins_h],j.head[j.ins_h]=j.strstart),ne!==0&&j.strstart-ne<=j.w_size-H&&(j.match_length=ee(j,ne)),j.match_length>=D)if(G=l._tr_tally(j,j.strstart-j.match_start,j.match_length-D),j.lookahead-=j.match_length,j.match_length<=j.max_lazy_match&&j.lookahead>=D){for(j.match_length--;j.strstart++,j.ins_h=(j.ins_h<<j.hash_shift^j.window[j.strstart+D-1])&j.hash_mask,ne=j.prev[j.strstart&j.w_mask]=j.head[j.ins_h],j.head[j.ins_h]=j.strstart,--j.match_length!=0;);j.strstart++}else j.strstart+=j.match_length,j.match_length=0,j.ins_h=j.window[j.strstart],j.ins_h=(j.ins_h<<j.hash_shift^j.window[j.strstart+1])&j.hash_mask;else G=l._tr_tally(j,0,j.window[j.strstart]),j.lookahead--,j.strstart++;if(G&&(q(j,!1),j.strm.avail_out===0))return C}return j.insert=j.strstart<D-1?j.strstart:D-1,oe===f?(q(j,!0),j.strm.avail_out===0?L:B):j.last_lit&&(q(j,!1),j.strm.avail_out===0)?C:M}function pe(j,oe){for(var ne,G,W;;){if(j.lookahead<H){if(Z(j),j.lookahead<H&&oe===h)return C;if(j.lookahead===0)break}if(ne=0,j.lookahead>=D&&(j.ins_h=(j.ins_h<<j.hash_shift^j.window[j.strstart+D-1])&j.hash_mask,ne=j.prev[j.strstart&j.w_mask]=j.head[j.ins_h],j.head[j.ins_h]=j.strstart),j.prev_length=j.match_length,j.prev_match=j.match_start,j.match_length=D-1,ne!==0&&j.prev_length<j.max_lazy_match&&j.strstart-ne<=j.w_size-H&&(j.match_length=ee(j,ne),j.match_length<=5&&(j.strategy===1||j.match_length===D&&4096<j.strstart-j.match_start)&&(j.match_length=D-1)),j.prev_length>=D&&j.match_length<=j.prev_length){for(W=j.strstart+j.lookahead-D,G=l._tr_tally(j,j.strstart-1-j.prev_match,j.prev_length-D),j.lookahead-=j.prev_length-1,j.prev_length-=2;++j.strstart<=W&&(j.ins_h=(j.ins_h<<j.hash_shift^j.window[j.strstart+D-1])&j.hash_mask,ne=j.prev[j.strstart&j.w_mask]=j.head[j.ins_h],j.head[j.ins_h]=j.strstart),--j.prev_length!=0;);if(j.match_available=0,j.match_length=D-1,j.strstart++,G&&(q(j,!1),j.strm.avail_out===0))return C}else if(j.match_available){if((G=l._tr_tally(j,0,j.window[j.strstart-1]))&&q(j,!1),j.strstart++,j.lookahead--,j.strm.avail_out===0)return C}else j.match_available=1,j.strstart++,j.lookahead--}return j.match_available&&(G=l._tr_tally(j,0,j.window[j.strstart-1]),j.match_available=0),j.insert=j.strstart<D-1?j.strstart:D-1,oe===f?(q(j,!0),j.strm.avail_out===0?L:B):j.last_lit&&(q(j,!1),j.strm.avail_out===0)?C:M}function me(j,oe,ne,G,W){this.good_length=j,this.max_lazy=oe,this.nice_length=ne,this.max_chain=G,this.func=W}function Oe(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=y,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new o.Buf16(2*E),this.dyn_dtree=new o.Buf16(2*(2*N+1)),this.bl_tree=new o.Buf16(2*(2*S+1)),X(this.dyn_ltree),X(this.dyn_dtree),X(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new o.Buf16(T+1),this.heap=new o.Buf16(2*_+1),X(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new o.Buf16(2*_+1),X(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function De(j){var oe;return j&&j.state?(j.total_in=j.total_out=0,j.data_type=b,(oe=j.state).pending=0,oe.pending_out=0,oe.wrap<0&&(oe.wrap=-oe.wrap),oe.status=oe.wrap?A:U,j.adler=oe.wrap===2?0:1,oe.last_flush=h,l._tr_init(oe),p):I(j,m)}function re(j){var oe=De(j);return oe===p&&function(ne){ne.window_size=2*ne.w_size,X(ne.head),ne.max_lazy_match=i[ne.level].max_lazy,ne.good_match=i[ne.level].good_length,ne.nice_match=i[ne.level].nice_length,ne.max_chain_length=i[ne.level].max_chain,ne.strstart=0,ne.block_start=0,ne.lookahead=0,ne.insert=0,ne.match_length=ne.prev_length=D-1,ne.match_available=0,ne.ins_h=0}(j.state),oe}function fe(j,oe,ne,G,W,te){if(!j)return m;var he=1;if(oe===g&&(oe=6),G<0?(he=0,G=-G):15<G&&(he=2,G-=16),W<1||w<W||ne!==y||G<8||15<G||oe<0||9<oe||te<0||v<te)return I(j,m);G===8&&(G=9);var ge=new Oe;return(j.state=ge).strm=j,ge.wrap=he,ge.gzhead=null,ge.w_bits=G,ge.w_size=1<<ge.w_bits,ge.w_mask=ge.w_size-1,ge.hash_bits=W+7,ge.hash_size=1<<ge.hash_bits,ge.hash_mask=ge.hash_size-1,ge.hash_shift=~~((ge.hash_bits+D-1)/D),ge.window=new o.Buf8(2*ge.w_size),ge.head=new o.Buf16(ge.hash_size),ge.prev=new o.Buf16(ge.w_size),ge.lit_bufsize=1<<W+6,ge.pending_buf_size=4*ge.lit_bufsize,ge.pending_buf=new o.Buf8(ge.pending_buf_size),ge.d_buf=1*ge.lit_bufsize,ge.l_buf=3*ge.lit_bufsize,ge.level=oe,ge.strategy=te,ge.method=ne,re(j)}i=[new me(0,0,0,0,function(j,oe){var ne=65535;for(ne>j.pending_buf_size-5&&(ne=j.pending_buf_size-5);;){if(j.lookahead<=1){if(Z(j),j.lookahead===0&&oe===h)return C;if(j.lookahead===0)break}j.strstart+=j.lookahead,j.lookahead=0;var G=j.block_start+ne;if((j.strstart===0||j.strstart>=G)&&(j.lookahead=j.strstart-G,j.strstart=G,q(j,!1),j.strm.avail_out===0)||j.strstart-j.block_start>=j.w_size-H&&(q(j,!1),j.strm.avail_out===0))return C}return j.insert=0,oe===f?(q(j,!0),j.strm.avail_out===0?L:B):(j.strstart>j.block_start&&(q(j,!1),j.strm.avail_out),C)}),new me(4,4,8,4,ie),new me(4,5,16,8,ie),new me(4,6,32,32,ie),new me(4,4,16,16,pe),new me(8,16,32,32,pe),new me(8,16,128,128,pe),new me(8,32,128,256,pe),new me(32,128,258,1024,pe),new me(32,258,258,4096,pe)],s.deflateInit=function(j,oe){return fe(j,oe,y,15,8,0)},s.deflateInit2=fe,s.deflateReset=re,s.deflateResetKeep=De,s.deflateSetHeader=function(j,oe){return j&&j.state?j.state.wrap!==2?m:(j.state.gzhead=oe,p):m},s.deflate=function(j,oe){var ne,G,W,te;if(!j||!j.state||5<oe||oe<0)return j?I(j,m):m;if(G=j.state,!j.output||!j.input&&j.avail_in!==0||G.status===666&&oe!==f)return I(j,j.avail_out===0?-5:m);if(G.strm=j,ne=G.last_flush,G.last_flush=oe,G.status===A)if(G.wrap===2)j.adler=0,V(G,31),V(G,139),V(G,8),G.gzhead?(V(G,(G.gzhead.text?1:0)+(G.gzhead.hcrc?2:0)+(G.gzhead.extra?4:0)+(G.gzhead.name?8:0)+(G.gzhead.comment?16:0)),V(G,255&G.gzhead.time),V(G,G.gzhead.time>>8&255),V(G,G.gzhead.time>>16&255),V(G,G.gzhead.time>>24&255),V(G,G.level===9?2:2<=G.strategy||G.level<2?4:0),V(G,255&G.gzhead.os),G.gzhead.extra&&G.gzhead.extra.length&&(V(G,255&G.gzhead.extra.length),V(G,G.gzhead.extra.length>>8&255)),G.gzhead.hcrc&&(j.adler=u(j.adler,G.pending_buf,G.pending,0)),G.gzindex=0,G.status=69):(V(G,0),V(G,0),V(G,0),V(G,0),V(G,0),V(G,G.level===9?2:2<=G.strategy||G.level<2?4:0),V(G,3),G.status=U);else{var he=y+(G.w_bits-8<<4)<<8;he|=(2<=G.strategy||G.level<2?0:G.level<6?1:G.level===6?2:3)<<6,G.strstart!==0&&(he|=32),he+=31-he%31,G.status=U,K(G,he),G.strstart!==0&&(K(G,j.adler>>>16),K(G,65535&j.adler)),j.adler=1}if(G.status===69)if(G.gzhead.extra){for(W=G.pending;G.gzindex<(65535&G.gzhead.extra.length)&&(G.pending!==G.pending_buf_size||(G.gzhead.hcrc&&G.pending>W&&(j.adler=u(j.adler,G.pending_buf,G.pending-W,W)),F(j),W=G.pen
vendor: 19,469 bytes, line 1360
1360ding,G.pending!==G.pending_buf_size));)V(G,255&G.gzhead.extra[G.gzindex]),G.gzindex++;G.gzhead.hcrc&&G.pending>W&&(j.adler=u(j.adler,G.pending_buf,G.pending-W,W)),G.gzindex===G.gzhead.extra.length&&(G.gzindex=0,G.status=73)}else G.status=73;if(G.status===73)if(G.gzhead.name){W=G.pending;do{if(G.pending===G.pending_buf_size&&(G.gzhead.hcrc&&G.pending>W&&(j.adler=u(j.adler,G.pending_buf,G.pending-W,W)),F(j),W=G.pending,G.pending===G.pending_buf_size)){te=1;break}te=G.gzindex<G.gzhead.name.length?255&G.gzhead.name.charCodeAt(G.gzindex++):0,V(G,te)}while(te!==0);G.gzhead.hcrc&&G.pending>W&&(j.adler=u(j.adler,G.pending_buf,G.pending-W,W)),te===0&&(G.gzindex=0,G.status=91)}else G.status=91;if(G.status===91)if(G.gzhead.comment){W=G.pending;do{if(G.pending===G.pending_buf_size&&(G.gzhead.hcrc&&G.pending>W&&(j.adler=u(j.adler,G.pending_buf,G.pending-W,W)),F(j),W=G.pending,G.pending===G.pending_buf_size)){te=1;break}te=G.gzindex<G.gzhead.comment.length?255&G.gzhead.comment.charCodeAt(G.gzindex++):0,V(G,te)}while(te!==0);G.gzhead.hcrc&&G.pending>W&&(j.adler=u(j.adler,G.pending_buf,G.pending-W,W)),te===0&&(G.status=103)}else G.status=103;if(G.status===103&&(G.gzhead.hcrc?(G.pending+2>G.pending_buf_size&&F(j),G.pending+2<=G.pending_buf_size&&(V(G,255&j.adler),V(G,j.adler>>8&255),j.adler=0,G.status=U)):G.status=U),G.pending!==0){if(F(j),j.avail_out===0)return G.last_flush=-1,p}else if(j.avail_in===0&&z(oe)<=z(ne)&&oe!==f)return I(j,-5);if(G.status===666&&j.avail_in!==0)return I(j,-5);if(j.avail_in!==0||G.lookahead!==0||oe!==h&&G.status!==666){var ge=G.strategy===2?function(ae,J){for(var Q;;){if(ae.lookahead===0&&(Z(ae),ae.lookahead===0)){if(J===h)return C;break}if(ae.match_length=0,Q=l._tr_tally(ae,0,ae.window[ae.strstart]),ae.lookahead--,ae.strstart++,Q&&(q(ae,!1),ae.strm.avail_out===0))return C}return ae.insert=0,J===f?(q(ae,!0),ae.strm.avail_out===0?L:B):ae.last_lit&&(q(ae,!1),ae.strm.avail_out===0)?C:M}(G,oe):G.strategy===3?function(ae,J){for(var Q,se,ue,Ne,ce=ae.window;;){if(ae.lookahead<=R){if(Z(ae),ae.lookahead<=R&&J===h)return C;if(ae.lookahead===0)break}if(ae.match_length=0,ae.lookahead>=D&&0<ae.strstart&&(se=ce[ue=ae.strstart-1])===ce[++ue]&&se===ce[++ue]&&se===ce[++ue]){Ne=ae.strstart+R;do;while(se===ce[++ue]&&se===ce[++ue]&&se===ce[++ue]&&se===ce[++ue]&&se===ce[++ue]&&se===ce[++ue]&&se===ce[++ue]&&se===ce[++ue]&&ue<Ne);ae.match_length=R-(Ne-ue),ae.match_length>ae.lookahead&&(ae.match_length=ae.lookahead)}if(ae.match_length>=D?(Q=l._tr_tally(ae,1,ae.match_length-D),ae.lookahead-=ae.match_length,ae.strstart+=ae.match_length,ae.match_length=0):(Q=l._tr_tally(ae,0,ae.window[ae.strstart]),ae.lookahead--,ae.strstart++),Q&&(q(ae,!1),ae.strm.avail_out===0))return C}return ae.insert=0,J===f?(q(ae,!0),ae.strm.avail_out===0?L:B):ae.last_lit&&(q(ae,!1),ae.strm.avail_out===0)?C:M}(G,oe):i[G.level].func(G,oe);if(ge!==L&&ge!==B||(G.status=666),ge===C||ge===L)return j.avail_out===0&&(G.last_flush=-1),p;if(ge===M&&(oe===1?l._tr_align(G):oe!==5&&(l._tr_stored_block(G,0,0,!1),oe===3&&(X(G.head),G.lookahead===0&&(G.strstart=0,G.block_start=0,G.insert=0))),F(j),j.avail_out===0))return G.last_flush=-1,p}return oe!==f?p:G.wrap<=0?1:(G.wrap===2?(V(G,255&j.adler),V(G,j.adler>>8&255),V(G,j.adler>>16&255),V(G,j.adler>>24&255),V(G,255&j.total_in),V(G,j.total_in>>8&255),V(G,j.total_in>>16&255),V(G,j.total_in>>24&255)):(K(G,j.adler>>>16),K(G,65535&j.adler)),F(j),0<G.wrap&&(G.wrap=-G.wrap),G.pending!==0?p:1)},s.deflateEnd=function(j){var oe;return j&&j.state?(oe=j.state.status)!==A&&oe!==69&&oe!==73&&oe!==91&&oe!==103&&oe!==U&&oe!==666?I(j,m):(j.state=null,oe===U?I(j,-3):p):m},s.deflateSetDictionary=function(j,oe){var ne,G,W,te,he,ge,ae,J,Q=oe.length;if(!j||!j.state||(te=(ne=j.state).wrap)===2||te===1&&ne.status!==A||ne.lookahead)return m;for(te===1&&(j.adler=c(j.adler,oe,Q,0)),ne.wrap=0,Q>=ne.w_size&&(te===0&&(X(ne.head),ne.strstart=0,ne.block_start=0,ne.insert=0),J=new o.Buf8(ne.w_size),o.arraySet(J,oe,Q-ne.w_size,ne.w_size,0),oe=J,Q=ne.w_size),he=j.avail_in,ge=j.next_in,ae=j.input,j.avail_in=Q,j.next_in=0,j.input=oe,Z(ne);ne.lookahead>=D;){for(G=ne.strstart,W=ne.lookahead-(D-1);ne.ins_h=(ne.ins_h<<ne.hash_shift^ne.window[G+D-1])&ne.hash_mask,ne.prev[G&ne.w_mask]=ne.head[ne.ins_h],ne.head[ne.ins_h]=G,G++,--W;);ne.strstart=G,ne.lookahead=D-1,Z(ne)}return ne.strstart+=ne.lookahead,ne.block_start=ne.strstart,ne.insert=ne.lookahead,ne.lookahead=0,ne.match_length=ne.prev_length=D-1,ne.match_available=0,j.next_in=ge,j.input=ae,j.avail_in=he,ne.wrap=te,p},s.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(t,n,s){n.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(t,n,s){n.exports=function(i,o){var l,c,u,d,h,f,p,m,g,v,b,y,w,_,N,S,E,T,D,R,H,A,U,C,M;l=i.state,c=i.next_in,C=i.input,u=c+(i.avail_in-5),d=i.next_out,M=i.output,h=d-(o-i.avail_out),f=d+(i.avail_out-257),p=l.dmax,m=l.wsize,g=l.whave,v=l.wnext,b=l.window,y=l.hold,w=l.bits,_=l.lencode,N=l.distcode,S=(1<<l.lenbits)-1,E=(1<<l.distbits)-1;e:do{w<15&&(y+=C[c++]<<w,w+=8,y+=C[c++]<<w,w+=8),T=_[y&S];t:for(;;){if(y>>>=D=T>>>24,w-=D,(D=T>>>16&255)===0)M[d++]=65535&T;else{if(!(16&D)){if(!(64&D)){T=_[(65535&T)+(y&(1<<D)-1)];continue t}if(32&D){l.mode=12;break e}i.msg="invalid literal/length code",l.mode=30;break e}R=65535&T,(D&=15)&&(w<D&&(y+=C[c++]<<w,w+=8),R+=y&(1<<D)-1,y>>>=D,w-=D),w<15&&(y+=C[c++]<<w,w+=8,y+=C[c++]<<w,w+=8),T=N[y&E];r:for(;;){if(y>>>=D=T>>>24,w-=D,!(16&(D=T>>>16&255))){if(!(64&D)){T=N[(65535&T)+(y&(1<<D)-1)];continue r}i.msg="invalid distance code",l.mode=30;break e}if(H=65535&T,w<(D&=15)&&(y+=C[c++]<<w,(w+=8)<D&&(y+=C[c++]<<w,w+=8)),p<(H+=y&(1<<D)-1)){i.msg="invalid distance too far back",l.mode=30;break e}if(y>>>=D,w-=D,(D=d-h)<H){if(g<(D=H-D)&&l.sane){i.msg="invalid distance too far back",l.mode=30;break e}if(U=b,(A=0)===v){if(A+=m-D,D<R){for(R-=D;M[d++]=b[A++],--D;);A=d-H,U=M}}else if(v<D){if(A+=m+v-D,(D-=v)<R){for(R-=D;M[d++]=b[A++],--D;);if(A=0,v<R){for(R-=D=v;M[d++]=b[A++],--D;);A=d-H,U=M}}}else if(A+=v-D,D<R){for(R-=D;M[d++]=b[A++],--D;);A=d-H,U=M}for(;2<R;)M[d++]=U[A++],M[d++]=U[A++],M[d++]=U[A++],R-=3;R&&(M[d++]=U[A++],1<R&&(M[d++]=U[A++]))}else{for(A=d-H;M[d++]=M[A++],M[d++]=M[A++],M[d++]=M[A++],2<(R-=3););R&&(M[d++]=M[A++],1<R&&(M[d++]=M[A++]))}break}}break}}while(c<u&&d<f);c-=R=w>>3,y&=(1<<(w-=R<<3))-1,i.next_in=c,i.next_out=d,i.avail_in=c<u?u-c+5:5-(c-u),i.avail_out=d<f?f-d+257:257-(d-f),l.hold=y,l.bits=w}},{}],49:[function(t,n,s){var i=t("../utils/common"),o=t("./adler32"),l=t("./crc32"),c=t("./inffast"),u=t("./inftrees"),d=1,h=2,f=0,p=-2,m=1,g=852,v=592;function b(A){return(A>>>24&255)+(A>>>8&65280)+((65280&A)<<8)+((255&A)<<24)}function y(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(A){var U;return A&&A.state?(U=A.state,A.total_in=A.total_out=U.total=0,A.msg="",U.wrap&&(A.adler=1&U.wrap),U.mode=m,U.last=0,U.havedict=0,U.dmax=32768,U.head=null,U.hold=0,U.bits=0,U.lencode=U.lendyn=new i.Buf32(g),U.distcode=U.distdyn=new i.Buf32(v),U.sane=1,U.back=-1,f):p}function _(A){var U;return A&&A.state?((U=A.state).wsize=0,U.whave=0,U.wnext=0,w(A)):p}function N(A,U){var C,M;return A&&A.state?(M=A.state,U<0?(C=0,U=-U):(C=1+(U>>4),U<48&&(U&=15)),U&&(U<8||15<U)?p:(M.window!==null&&M.wbits!==U&&(M.window=null),M.wrap=C,M.wbits=U,_(A))):p}function S(A,U){var C,M;return A?(M=new y,(A.state=M).window=null,(C=N(A,U))!==f&&(A.state=null),C):p}var E,T,D=!0;function R(A){if(D){var U;for(E=new i.Buf32(512),T=new i.Buf32(32),U=0;U<144;)A.lens[U++]=8;for(;U<256;)A.lens[U++]=9;for(;U<280;)A.lens[U++]=7;for(;U<288;)A.lens[U++]=8;for(u(d,A.lens,0,288,E,0,A.work,{bits:9}),U=0;U<32;)A.lens[U++]=5;u(h,A.lens,0,32,T,0,A.work,{bits:5}),D=!1}A.lencode=E,A.lenbits=9,A.distcode=T,A.distbits=5}function H(A,U,C,M){var L,B=A.state;return B.window===null&&(B.wsize=1<<B.wbits,B.wnext=0,B.whave=0,B.window=new i.Buf8(B.wsize)),M>=B.wsize?(i.arraySet(B.window,U,C-B.wsize,B.wsize,0),B.wnext=0,B.whave=B.wsize):(M<(L=B.wsize-B.wnext)&&(L=M),i.arraySet(B.window,U,C-M,L,B.wnext),(M-=L)?(i.arraySet(B.window,U,C-M,M,0),B.wnext=M,B.whave=B.wsize):(B.wnext+=L,B.wnext===B.wsize&&(B.wnext=0),B.whave<B.wsize&&(B.whave+=L))),0}s.inflateReset=_,s.inflateReset2=N,s.inflateResetKeep=w,s.inflateInit=function(A){return S(A,15)},s.inflateInit2=S,s.inflate=function(A,U){var C,M,L,B,I,z,X,F,q,V,K,ee,Z,ie,pe,me,Oe,De,re,fe,j,oe,ne,G,W=0,te=new i.Buf8(4),he=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!A||!A.state||!A.output||!A.input&&A.avail_in!==0)return p;(C=A.state).mode===12&&(C.mode=13),I=A.next_out,L=A.output,X=A.avail_out,B=A.next_in,M=A.input,z=A.avail_in,F=C.hold,q=C.bits,V=z,K=X,oe=f;e:for(;;)switch(C.mode){case m:if(C.wrap===0){C.mode=13;break}for(;q<16;){if(z===0)break e;z--,F+=M[B++]<<q,q+=8}if(2&C.wrap&&F===35615){te[C.check=0]=255&F,te[1]=F>>>8&255,C.check=l(C.check,te,2,0),q=F=0,C.mode=2;break}if(C.flags=0,C.head&&(C.head.done=!1),!(1&C.wrap)||(((255&F)<<8)+(F>>8))%31){A.msg="incorrect header check",C.mode=30;break}if((15&F)!=8){A.msg="unknown compression method",C.mode=30;break}if(q-=4,j=8+(15&(F>>>=4)),C.wbits===0)C.wbits=j;else if(j>C.wbits){A.msg="invalid window size",C.mode=30;break}C.dmax=1<<j,A.adler=C.check=1,C.mode=512&F?10:12,q=F=0;break;case 2:for(;q<16;){if(z===0)break e;z--,F+=M[B++]<<q,q+=8}if(C.flags=F,(255&C.flags)!=8){A.msg="unknown compression method",C.mode=30;break}if(57344&C.flags){A.msg="unknown header flags set",C.mode=30;break}C.head&&(C.head.text=F>>8&1),512&C.flags&&(te[0]=255&F,te[1]=F>>>8&255,C.check=l(C.check,te,2,0)),q=F=0,C.mode=3;case 3:for(;q<32;){if(z===0)break e;z--,F+=M[B++]<<q,q+=8}C.head&&(C.head.time=F),512&C.flags&&(te[0]=255&F,te[1]=F>>>8&255,te[2]=F>>>16&255,te[3]=F>>>24&255,C.check=l(C.check,te,4,0)),q=F=0,C.mode=4;case 4:for(;q<16;){if(z===0)break e;z--,F+=M[B++]<<q,q+=8}C.head&&(C.head.xflags=255&F,C.head.os=F>>8),512&C.flags&&(te[0]=255&F,te[1]=F>>>8&255,C.check=l(C.check,te,2,0)),q=F=0,C.mode=5;case 5:if(1024&C.flags){for(;q<16;){if(z===0)break e;z--,F+=M[B++]<<q,q+=8}C.length=F,C.head&&(C.head.extra_len=F),512&C.flags&&(te[0]=255&F,te[1]=F>>>8&255,C.check=l(C.check,te,2,0)),q=F=0}else C.head&&(C.head.extra=null);C.mode=6;case 6:if(1024&C.flags&&(z<(ee=C.length)&&(ee=z),ee&&(C.head&&(j=C.head.extra_len-C.length,C.head.extra||(C.head.extra=new Array(C.head.extra_len)),i.arraySet(C.head.extra,M,B,ee,j)),512&C.flags&&(C.check=l(C.check,M,ee,B)),z-=ee,B+=ee,C.length-=ee),C.length))break e;C.length=0,C.mode=7;case 7:if(2048&C.flags){if(z===0)break e;for(ee=0;j=M[B+ee++],C.head&&j&&C.length<65536&&(C.head.name+=String.fromCharCode(j)),j&&ee<z;);if(512&C.flags&&(C.check=l(C.check,M,ee,B)),z-=ee,B+=ee,j)break e}else C.head&&(C.head.name=null);C.length=0,C.mode=8;case 8:if(4096&C.flags){if(z===0)break e;for(ee=0;j=M[B+ee++],C.head&&j&&C.length<65536&&(C.head.comment+=String.fromCharCode(j)),j&&ee<z;);if(512&C.flags&&(C.check=l(C.check,M,ee,B)),z-=ee,B+=ee,j)break e}else C.head&&(C.head.comment=null);C.mode=9;case 9:if(512&C.flags){for(;q<16;){if(z===0)break e;z--,F+=M[B++]<<q,q+=8}if(F!==(65535&C.check)){A.msg="header crc mismatch",C.mode=30;break}q=F=0}C.head&&(C.head.hcrc=C.flags>>9&1,C.head.done=!0),A.adler=C.check=0,C.mode=12;break;case 10:for(;q<32;){if(z===0)break e;z--,F+=M[B++]<<q,q+=8}A.adler=C.check=b(F),q=F=0,C.mode=11;case 11:if(C.havedict===0)return A.next_out=I,A.avail_out=X,A.next_in=B,A.avail_in=z,C.hold=F,C.bits=q,2;A.adler=C.check=1,C.mode=12;case 12:if(U===5||U===6)break e;case 13:if(C.last){F>>>=7&q,q-=7&q,C.mode=27;break}for(;q<3;){if(z===0)break e;z--,F+=M[B++]<<q,q+=8}switch(C.last=1&F,q-=1,3&(F>>>=1)){case 0:C.mode=14;break;case 1:if(R(C),C.mode=20,U!==6)break;F>>>=2,q-=2;break e;case 2:C.mode=17;break;case 3:A.msg="invalid block type",C.mode=30}F>>>=2,q-=2;break;case 14:for(F>>>=7&q,q-=7&q;q<32;){if(z===0)break e;z--,F+=M[B++]<<q,q+=8}if((65535&F)!=(F>>>16^65535)){A.msg="invalid stored block lengths",C.mode=30;break}if(C.length=65535&F,q=F=0,C.mode=15,U===6)break e;case 15:C.mode=16;case 16:if(ee=C.length){if(z<ee&&(ee=z),X<ee&&(ee=X),ee===0)break e;i.arraySet(L,M,B,ee,I),z-=ee,B+=ee,X-=ee,I+=ee,C.length-=ee;break}C.mode=12;break;case 17:for(;q<14;){if(z===0)break e;z--,F+=M[B++]<<q,q+=8}if(C.nlen=257+(31&F),F>>>=5,q-=5,C.ndist=1+(31&F),F>>>=5,q-=5,C.ncode=4+(15&F),F>>>=4,q-=4,286<C.nlen||30<C.ndist){A.msg="too many length or distance symbols",C.mode=30;break}C.have=0,C.mode=18;case 18:for(;C.have<C.ncode;){for(;q<3;){if(z===0)break e;z--,F+=M[B++]<<q,q+=8}C.lens[he[C.have++]]=7&F,F>>>=3,q-=3}for(;C.have<19;)C.lens[he[C.have++]]=0;if(C.lencode=C.lendyn,C.lenbits=7,ne={bits:C.lenbits},oe=u(0,C.lens,0,19,C.lencode,0,C.work,ne),C.lenbits=ne.bits,oe){A.msg="invalid code lengths set",C.mode=30;break}C.have=0,C.mode=19;case 19:for(;C.have<C.nlen+C.ndist;){for(;me=(W=C.lencode[F&(1<<C.lenbits)-1])>>>16&255,Oe=65535&W,!((pe=W>>>24)<=q);){if(z===0)break e;z--,F+=M[B++]<<q,q+=8}if(Oe<16)F>>>=pe,q-=pe,C.lens[C.have++]=Oe;else{if(Oe===16){for(G=pe+2;q<G;){if(z===0)break e;z--,F+=M[B++]<<q,q+=8}if(F>>>=pe,q-=pe,C.have===0){A.msg="invalid bit length repeat",C.mode=30;break}j=C.lens[C.have-1],ee=3+(3&F),F>>>=2,q-=2}else if(Oe===17){for(G=pe+3;q<G;){if(z===0)break e;z--,F+=M[B++]<<q,q+=8}q-=pe,j=0,ee=3+(7&(F>>>=pe)),F>>>=3,q-=3}else{for(G=pe+7;q<G;){if(z===0)break e;z--,F+=M[B++]<<q,q+=8}q-=pe,j=0,ee=11+(127&(F>>>=pe)),F>>>=7,q-=7}if(C.have+ee>C.nlen+C.ndist){A.msg="invalid bit length repeat",C.mode=30;break}for(;ee--;)C.lens[C.have++]=j}}if(C.mode===30)break;if(C.lens[256]===0){A.msg="invalid code -- missing end-of-block",C.mode=30;break}if(C.lenbits=9,ne={bits:C.lenbits},oe=u(d,C.lens,0,C.nlen,C.lencode,0,C.work,ne),C.lenbits=ne.bits,oe){A.msg="invalid literal/lengths set",C.mode=30;break}if(C.distbits=6,C.distcode=C.distdyn,ne={bits:C.distbits},oe=u(h,C.lens,C.nlen,C.ndist,C.distcode,0,C.work,ne),C.distbits=ne.bits,oe){A.msg="invalid distances set",C.mode=30;break}if(C.mode=20,U===6)break e;case 20:C.mode=21;case 21:if(6<=z&&258<=X){A.next_out=I,A.avail_out=X,A.next_in=B,A.avail_in=z,C.hold=F,C.bits=q,c(A,K),I=A.next_out,L=A.output,X=A.avail_out,B=A.next_in,M=A.input,z=A.avail_in,F=C.hold,q=C.bits,C.mode===12&&(C.back=-1);break}for(C.back=0;me=(W=C.lencode[F&(1<<C.lenbits)-1])>>>16&255,Oe=65535&W,!((pe=W>>>24)<=q);){if(z===0)break e;z--,F+=M[B++]<<q,q+=8}if(me&&!(240&me)){for(De=pe,re=me,fe=Oe;me=(W=C.lencode[fe+((F&(1<<De+re)-1)>>De)])>>>16&255,Oe=65535&W,!(De+(pe=W>>>24)<=q);){if(z===0)break e;z--,F+=M[B++]<<q,q+=8}F>>>=De,q-=De,C.back+=De}if(F>>>=pe,q-=pe,C.back+=pe,C.length=Oe,me===0){C.mode=26;break}if(32&me){C.back=-1,C.mode=12;break}if(64&me){A.msg="invalid literal/length code",C.mode=30;break}C.extra=15&me,C.mode=22;case 22:if(C.extra){for(G=C.extra;q<G;){if(z===0)break e;z--,F+=M[B++]<<q,q+=8}C.length+=F&(1<<C.extra)-1,F>>>=C.extra,q-=C.extra,C.back+=C.extra}C.was=C.length,C.mode=23;case 23:for(;me=(W=C.distcode[F&(1<<C.distbits)-1])>>>16&255,Oe=65535&W,!((pe=W>>>24)<=q);){if(z===0)break e;z--,F+=M[B++]<<q,q+=8}if(!(240&me)){for(De=pe,re=me,fe=Oe;me=(W=C.distcode[fe+((F&(1<<De+re)-1)>>De)])>>>16&255,Oe=65535&W,!(De+(pe=W>>>24)<=q);){if(z===0)break e;z--,F+=M[B++]<<q,q+=8}F>>>=De,q-=De,C.back+=De}if(F>>>=pe,q-=pe,C.back+=pe,64&me){A.msg="invalid distance code",C.mode=30;break}C.offset=Oe,C.extra=15&me,C.mode=24;case 24:if(C.extra){for(G=C.extra;q<G;){if(z===0)break e;z--,F+=M[B++]<<q,q+=8}C.offset+=F&(1<<C.extra)-1,F>>>=C.extra,q-=C.extra,C.back+=C.extra}if(C.offset>C.dmax){A.msg="invalid distance too far back",C.mode=30;break}C.mode=25;case 25:if(X===0)break e;if(ee=K-X,C.offset>ee){if((ee=C.offset-ee)>C.whave&&C.sane){A.msg="invalid distance too far back",C.mode=30;break}Z=ee>C.wnext?(ee-=C.wnext,C.wsize-ee):C.wnext-ee,ee>C.length&&(ee=C.length),ie=C.window}else ie=L,Z=I-C.offset,ee=C.length;for(X<ee&&(ee=X),X-=ee,C.length-=ee;L[I++]=ie[Z++],--ee;);C.length===0&&(C.mode=21);break;case 26:if(X===0)break e;L[I++]=C.length,X--,C.mode=21;break;case 27:if(C.wrap){for(;q<32;){if(z===0)break e;z--,F|=M[B++]<<q,q+=8}if(K-=X,A.total_out+=K,C.total+=K,K&&(A.adler=C.check=C.flags?l(C.check,L,K,I-K):o(C.check,L,K,I-K)),K=X,(C.flags?F:b(F))!==C.check){A.msg="incorrect data check",C.mode=30;break}q=F=0}C.mode=28;case 28:if(C.wrap&&C.flags){for(;q<32;){if(z===0)break e;z--,F+=M[B++]<<q,q+=8}if(F!==(4294967295&C.total)){A.msg="incorrect length check",C.mode=30;break}q=F=0}C.mode=29;case 29:oe=1;break e;case 30:oe=-3;break e;case 31:return-4;case 32:default:return p}return A.next_out=I,A.avail_out=X,A.next_in=B,A.avail_in=z,C.hold=F,C.bits=q,(C.wsize||K!==A.avail_out&&C.mode<30&&(C.mode<27||U!==4))&&H(A,A.output,A.next_out,K-A.avail_out)?(C.mode=31,-4):(V-=A.avail_in,K-=A.avail_out,A.total_in+=V,A.total_out+=K,C.total+=K,C.wrap&&K&&(A.adler=C.check=C.flags?l(C.check,L,K,A.next_out-K):o(C.check,L,K,A.next_out-K)),A.data_type=C.bits+(C.last?64:0)+(C.mode===12?128:0)+(C.mode===20||C.mode===15?256:0),(V==0&&K===0||U===4)&&oe===f&&(oe=-5),oe)},s.inflateEnd=function(A){if(!A||!A.state)return p;var U=A.state;return U.window&&(U.window=null),A.state=null,f},s.inflateGetHeader=function(A,U){var C;return A&&A.state&&2&(C=A.state).wrap?((C.head=U).done=!1,f):p},s.inflateSetDictionary=function(A,U){var C,M=U.length;return A&&A.state?(C=A.state).wrap!==0&&C.mode!==11?p:C.mode===11&&o(1,U,M,0)!==C.check?-3:H(A,U,M,M)?(C.mode=31,-4):(C.havedict=1,f):p},s.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(t,n,s){var i=t("../utils/common"),o=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],l=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],c=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];n.exports=function(d,h,f,p,m,g,v,b){var y,w,_,N,S,E,T,D,R,H=b.bits,A=0,U=0,C=0,M=0,L=0,B=0,I=0,z=0,X=0,F=0,q=null,V=0,K=new i.Buf16(16),ee=new i.Buf16(16),Z=null,ie=0;for(A=0;A<=15;A++)K[A]=0;for(U=0;U<p;U++)K[h[f+U]]++;for(L=H,M=15;1<=M&&K[M]===0;M--);if(M<L&&(L=M),M===0)return m[g++]=20971520,m[g++]=20971520,b.bits=1,0;for(C=1;C<M&&K[C]===0;C++);for(L<C&&(L=C),A=z=1;A<=15;A++)if(z<<=1,(z-=K[A])<0)return-1;if(0<z&&(d===0||M!==1))return-1;for(ee[1]=0,A=1;A<15;A++)ee[A+1]=ee[A]+K[A];for(U=0;U<p;U++)h[f+U]!==0&&(v[ee[h[f+U]]++]=U);if(E=d===0?(q=Z=v,19):d===1?(q=o,V-=257,Z=l,ie-=257,256):(q=c,Z=u,-1),A=C,S=g,I=U=F=0,_=-1,N=(X=1<<(B=L))-1,d===1&&852<X||d===2&&592<X)return 1;for(;;){for(T=A-I,R=v[U]<E?(D=0,v[U]):v[U]>E?(D=Z[ie+v[U]],q[V+v[U]]):(D=96,0),y=1<<A-I,C=w=1<<B;m[S+(F>>I)+(w-=y)]=T<<24|D<<16|R|0,w!==0;);for(y=1<<A-1;F&y;)y>>=1;if(y!==0?(F&=y-1,F+=y):F=0,U++,--K[A]==0){if(A===M)break;A=h[f+v[U]]}if(L<A&&(F&N)!==_){for(I===0&&(I=L),S+=C,z=1<<(B=A-I);
vendor: 9,196 bytes, line 1360
1360B+I<M&&!((z-=K[B+I])<=0);)B++,z<<=1;if(X+=1<<B,d===1&&852<X||d===2&&592<X)return 1;m[_=F&N]=L<<24|B<<16|S-g|0}}return F!==0&&(m[S+F]=A-I<<24|64<<16|0),b.bits=L,0}},{"../utils/common":41}],51:[function(t,n,s){n.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(t,n,s){var i=t("../utils/common"),o=0,l=1;function c(W){for(var te=W.length;0<=--te;)W[te]=0}var u=0,d=29,h=256,f=h+1+d,p=30,m=19,g=2*f+1,v=15,b=16,y=7,w=256,_=16,N=17,S=18,E=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],T=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],D=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],R=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],H=new Array(2*(f+2));c(H);var A=new Array(2*p);c(A);var U=new Array(512);c(U);var C=new Array(256);c(C);var M=new Array(d);c(M);var L,B,I,z=new Array(p);function X(W,te,he,ge,ae){this.static_tree=W,this.extra_bits=te,this.extra_base=he,this.elems=ge,this.max_length=ae,this.has_stree=W&&W.length}function F(W,te){this.dyn_tree=W,this.max_code=0,this.stat_desc=te}function q(W){return W<256?U[W]:U[256+(W>>>7)]}function V(W,te){W.pending_buf[W.pending++]=255&te,W.pending_buf[W.pending++]=te>>>8&255}function K(W,te,he){W.bi_valid>b-he?(W.bi_buf|=te<<W.bi_valid&65535,V(W,W.bi_buf),W.bi_buf=te>>b-W.bi_valid,W.bi_valid+=he-b):(W.bi_buf|=te<<W.bi_valid&65535,W.bi_valid+=he)}function ee(W,te,he){K(W,he[2*te],he[2*te+1])}function Z(W,te){for(var he=0;he|=1&W,W>>>=1,he<<=1,0<--te;);return he>>>1}function ie(W,te,he){var ge,ae,J=new Array(v+1),Q=0;for(ge=1;ge<=v;ge++)J[ge]=Q=Q+he[ge-1]<<1;for(ae=0;ae<=te;ae++){var se=W[2*ae+1];se!==0&&(W[2*ae]=Z(J[se]++,se))}}function pe(W){var te;for(te=0;te<f;te++)W.dyn_ltree[2*te]=0;for(te=0;te<p;te++)W.dyn_dtree[2*te]=0;for(te=0;te<m;te++)W.bl_tree[2*te]=0;W.dyn_ltree[2*w]=1,W.opt_len=W.static_len=0,W.last_lit=W.matches=0}function me(W){8<W.bi_valid?V(W,W.bi_buf):0<W.bi_valid&&(W.pending_buf[W.pending++]=W.bi_buf),W.bi_buf=0,W.bi_valid=0}function Oe(W,te,he,ge){var ae=2*te,J=2*he;return W[ae]<W[J]||W[ae]===W[J]&&ge[te]<=ge[he]}function De(W,te,he){for(var ge=W.heap[he],ae=he<<1;ae<=W.heap_len&&(ae<W.heap_len&&Oe(te,W.heap[ae+1],W.heap[ae],W.depth)&&ae++,!Oe(te,ge,W.heap[ae],W.depth));)W.heap[he]=W.heap[ae],he=ae,ae<<=1;W.heap[he]=ge}function re(W,te,he){var ge,ae,J,Q,se=0;if(W.last_lit!==0)for(;ge=W.pending_buf[W.d_buf+2*se]<<8|W.pending_buf[W.d_buf+2*se+1],ae=W.pending_buf[W.l_buf+se],se++,ge===0?ee(W,ae,te):(ee(W,(J=C[ae])+h+1,te),(Q=E[J])!==0&&K(W,ae-=M[J],Q),ee(W,J=q(--ge),he),(Q=T[J])!==0&&K(W,ge-=z[J],Q)),se<W.last_lit;);ee(W,w,te)}function fe(W,te){var he,ge,ae,J=te.dyn_tree,Q=te.stat_desc.static_tree,se=te.stat_desc.has_stree,ue=te.stat_desc.elems,Ne=-1;for(W.heap_len=0,W.heap_max=g,he=0;he<ue;he++)J[2*he]!==0?(W.heap[++W.heap_len]=Ne=he,W.depth[he]=0):J[2*he+1]=0;for(;W.heap_len<2;)J[2*(ae=W.heap[++W.heap_len]=Ne<2?++Ne:0)]=1,W.depth[ae]=0,W.opt_len--,se&&(W.static_len-=Q[2*ae+1]);for(te.max_code=Ne,he=W.heap_len>>1;1<=he;he--)De(W,J,he);for(ae=ue;he=W.heap[1],W.heap[1]=W.heap[W.heap_len--],De(W,J,1),ge=W.heap[1],W.heap[--W.heap_max]=he,W.heap[--W.heap_max]=ge,J[2*ae]=J[2*he]+J[2*ge],W.depth[ae]=(W.depth[he]>=W.depth[ge]?W.depth[he]:W.depth[ge])+1,J[2*he+1]=J[2*ge+1]=ae,W.heap[1]=ae++,De(W,J,1),2<=W.heap_len;);W.heap[--W.heap_max]=W.heap[1],function(ce,le){var be,de,Se,ke,Le,Dt,Ut=le.dyn_tree,Yn=le.max_code,ma=le.stat_desc.static_tree,Kv=le.stat_desc.has_stree,a0=le.stat_desc.extra_bits,o0=le.stat_desc.extra_base,Rf=le.stat_desc.max_length,l0=0;for(ke=0;ke<=v;ke++)ce.bl_count[ke]=0;for(Ut[2*ce.heap[ce.heap_max]+1]=0,be=ce.heap_max+1;be<g;be++)Rf<(ke=Ut[2*Ut[2*(de=ce.heap[be])+1]+1]+1)&&(ke=Rf,l0++),Ut[2*de+1]=ke,Yn<de||(ce.bl_count[ke]++,Le=0,o0<=de&&(Le=a0[de-o0]),Dt=Ut[2*de],ce.opt_len+=Dt*(ke+Le),Kv&&(ce.static_len+=Dt*(ma[2*de+1]+Le)));if(l0!==0){do{for(ke=Rf-1;ce.bl_count[ke]===0;)ke--;ce.bl_count[ke]--,ce.bl_count[ke+1]+=2,ce.bl_count[Rf]--,l0-=2}while(0<l0);for(ke=Rf;ke!==0;ke--)for(de=ce.bl_count[ke];de!==0;)Yn<(Se=ce.heap[--be])||(Ut[2*Se+1]!==ke&&(ce.opt_len+=(ke-Ut[2*Se+1])*Ut[2*Se],Ut[2*Se+1]=ke),de--)}}(W,te),ie(J,Ne,W.bl_count)}function j(W,te,he){var ge,ae,J=-1,Q=te[1],se=0,ue=7,Ne=4;for(Q===0&&(ue=138,Ne=3),te[2*(he+1)+1]=65535,ge=0;ge<=he;ge++)ae=Q,Q=te[2*(ge+1)+1],++se<ue&&ae===Q||(se<Ne?W.bl_tree[2*ae]+=se:ae!==0?(ae!==J&&W.bl_tree[2*ae]++,W.bl_tree[2*_]++):se<=10?W.bl_tree[2*N]++:W.bl_tree[2*S]++,J=ae,Ne=(se=0)===Q?(ue=138,3):ae===Q?(ue=6,3):(ue=7,4))}function oe(W,te,he){var ge,ae,J=-1,Q=te[1],se=0,ue=7,Ne=4;for(Q===0&&(ue=138,Ne=3),ge=0;ge<=he;ge++)if(ae=Q,Q=te[2*(ge+1)+1],!(++se<ue&&ae===Q)){if(se<Ne)for(;ee(W,ae,W.bl_tree),--se!=0;);else ae!==0?(ae!==J&&(ee(W,ae,W.bl_tree),se--),ee(W,_,W.bl_tree),K(W,se-3,2)):se<=10?(ee(W,N,W.bl_tree),K(W,se-3,3)):(ee(W,S,W.bl_tree),K(W,se-11,7));J=ae,Ne=(se=0)===Q?(ue=138,3):ae===Q?(ue=6,3):(ue=7,4)}}c(z);var ne=!1;function G(W,te,he,ge){K(W,(u<<1)+(ge?1:0),3),function(ae,J,Q,se){me(ae),V(ae,Q),V(ae,~Q),i.arraySet(ae.pending_buf,ae.window,J,Q,ae.pending),ae.pending+=Q}(W,te,he)}s._tr_init=function(W){ne||(function(){var te,he,ge,ae,J,Q=new Array(v+1);for(ae=ge=0;ae<d-1;ae++)for(M[ae]=ge,te=0;te<1<<E[ae];te++)C[ge++]=ae;for(C[ge-1]=ae,ae=J=0;ae<16;ae++)for(z[ae]=J,te=0;te<1<<T[ae];te++)U[J++]=ae;for(J>>=7;ae<p;ae++)for(z[ae]=J<<7,te=0;te<1<<T[ae]-7;te++)U[256+J++]=ae;for(he=0;he<=v;he++)Q[he]=0;for(te=0;te<=143;)H[2*te+1]=8,te++,Q[8]++;for(;te<=255;)H[2*te+1]=9,te++,Q[9]++;for(;te<=279;)H[2*te+1]=7,te++,Q[7]++;for(;te<=287;)H[2*te+1]=8,te++,Q[8]++;for(ie(H,f+1,Q),te=0;te<p;te++)A[2*te+1]=5,A[2*te]=Z(te,5);L=new X(H,E,h+1,f,v),B=new X(A,T,0,p,v),I=new X(new Array(0),D,0,m,y)}(),ne=!0),W.l_desc=new F(W.dyn_ltree,L),W.d_desc=new F(W.dyn_dtree,B),W.bl_desc=new F(W.bl_tree,I),W.bi_buf=0,W.bi_valid=0,pe(W)},s._tr_stored_block=G,s._tr_flush_block=function(W,te,he,ge){var ae,J,Q=0;0<W.level?(W.strm.data_type===2&&(W.strm.data_type=function(se){var ue,Ne=4093624447;for(ue=0;ue<=31;ue++,Ne>>>=1)if(1&Ne&&se.dyn_ltree[2*ue]!==0)return o;if(se.dyn_ltree[18]!==0||se.dyn_ltree[20]!==0||se.dyn_ltree[26]!==0)return l;for(ue=32;ue<h;ue++)if(se.dyn_ltree[2*ue]!==0)return l;return o}(W)),fe(W,W.l_desc),fe(W,W.d_desc),Q=function(se){var ue;for(j(se,se.dyn_ltree,se.l_desc.max_code),j(se,se.dyn_dtree,se.d_desc.max_code),fe(se,se.bl_desc),ue=m-1;3<=ue&&se.bl_tree[2*R[ue]+1]===0;ue--);return se.opt_len+=3*(ue+1)+5+5+4,ue}(W),ae=W.opt_len+3+7>>>3,(J=W.static_len+3+7>>>3)<=ae&&(ae=J)):ae=J=he+5,he+4<=ae&&te!==-1?G(W,te,he,ge):W.strategy===4||J===ae?(K(W,2+(ge?1:0),3),re(W,H,A)):(K(W,4+(ge?1:0),3),function(se,ue,Ne,ce){var le;for(K(se,ue-257,5),K(se,Ne-1,5),K(se,ce-4,4),le=0;le<ce;le++)K(se,se.bl_tree[2*R[le]+1],3);oe(se,se.dyn_ltree,ue-1),oe(se,se.dyn_dtree,Ne-1)}(W,W.l_desc.max_code+1,W.d_desc.max_code+1,Q+1),re(W,W.dyn_ltree,W.dyn_dtree)),pe(W),ge&&me(W)},s._tr_tally=function(W,te,he){return W.pending_buf[W.d_buf+2*W.last_lit]=te>>>8&255,W.pending_buf[W.d_buf+2*W.last_lit+1]=255&te,W.pending_buf[W.l_buf+W.last_lit]=255&he,W.last_lit++,te===0?W.dyn_ltree[2*he]++:(W.matches++,te--,W.dyn_ltree[2*(C[he]+h+1)]++,W.dyn_dtree[2*q(te)]++),W.last_lit===W.lit_bufsize-1},s._tr_align=function(W){K(W,2,3),ee(W,w,H),function(te){te.bi_valid===16?(V(te,te.bi_buf),te.bi_buf=0,te.bi_valid=0):8<=te.bi_valid&&(te.pending_buf[te.pending++]=255&te.bi_buf,te.bi_buf>>=8,te.bi_valid-=8)}(W)}},{"../utils/common":41}],53:[function(t,n,s){n.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,n,s){(function(i){(function(o,l){if(!o.setImmediate){var c,u,d,h,f=1,p={},m=!1,g=o.document,v=Object.getPrototypeOf&&Object.getPrototypeOf(o);v=v&&v.setTimeout?v:o,c={}.toString.call(o.process)==="[object process]"?function(_){process.nextTick(function(){y(_)})}:function(){if(o.postMessage&&!o.importScripts){var _=!0,N=o.onmessage;return o.onmessage=function(){_=!1},o.postMessage("","*"),o.onmessage=N,_}}()?(h="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",w,!1):o.attachEvent("onmessage",w),function(_){o.postMessage(h+_,"*")}):o.MessageChannel?((d=new MessageChannel).port1.onmessage=function(_){y(_.data)},function(_){d.port2.postMessage(_)}):g&&"onreadystatechange"in g.createElement("script")?(u=g.documentElement,function(_){var N=g.createElement("script");N.onreadystatechange=function(){y(_),N.onreadystatechange=null,u.removeChild(N),N=null},u.appendChild(N)}):function(_){setTimeout(y,0,_)},v.setImmediate=function(_){typeof _!="function"&&(_=new Function(""+_));for(var N=new Array(arguments.length-1),S=0;S<N.length;S++)N[S]=arguments[S+1];var E={callback:_,args:N};return p[f]=E,c(f),f++},v.clearImmediate=b}function b(_){delete p[_]}function y(_){if(m)setTimeout(y,0,_);else{var N=p[_];if(N){m=!0;try{(function(S){var E=S.callback,T=S.args;switch(T.length){case 0:E();break;case 1:E(T[0]);break;case 2:E(T[0],T[1]);break;case 3:E(T[0],T[1],T[2]);break;default:E.apply(l,T)}})(N)}finally{b(_),m=!1}}}}
1360function w(_){_.source===o&&typeof _.data=="string"&&_.data.indexOf(h)===0&&y(+_.data.slice(h.length))}})(typeof self>"u"?i===void 0?this:i:self)}).call(this,typeof Be<"u"?Be:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(H8);var mY=H8.exports,gY=yv,yY=mY;t0.openArrayBuffer=bY;t0.splitPath=xY;t0.joinPath=vY;function bY(r){return yY.loadAsync(r).then(function(e){function t(o){return e.file(o)!==null}function n(o,l){return e.file(o).async("uint8array").then(function(c){if(l==="base64")return gY.fromByteArray(c);if(l){var u=new TextDecoder(l);return u.decode(c)}else return c})}function s(o,l){e.file(o,l)}function i(){return e.generateAsync({type:"arraybuffer"})}return{exists:t,read:n,write:s,toArrayBuffer:i}})}function xY(r){var e=r.lastIndexOf("/");return e===-1?{dirname:"",basename:r}:{dirname:r.substring(0,e),basename:r.substring(e+1)}}function vY(){var r=Array.prototype.filter.call(arguments,function(t){return t}),e=[];return r.forEach(function(t){/^\//.test(t)?e=[t]:e.push(t)}),e.join("/")}var LC={},So={},Af={},bv=er;Af.Element=Tf;Af.element=function(r,e,t){return new Tf(r,e,t)};Af.text=function(r){return{type:"text",value:r}};var z8=Af.emptyElement={first:function(){return null},firstOrEmpty:function(){return z8},attributes:{},children:[]};function Tf(r,e,t){this.type="element",this.name=r,this.attributes=e||{},this.children=t||[]}Tf.prototype.first=function(r){return bv.find(this.children,function(e){return e.name===r})};Tf.prototype.firstOrEmpty=function(r){return this.first(r)||z8};Tf.prototype.getElementsByTagName=function(r){var e=bv.filter(this.children,function(t){return t.name===r});return q8(e)};Tf.prototype.text=function(){if(this.children.length===0)return"";if(this.children.length!==1||this.children[0].type!=="text")throw new Error("Not implemented");return this.children[0].value};var wY={getElementsByTagName:function(r){return q8(bv.flatten(this.map(function(e){return e.getElementsByTagName(r)},!0)))}};function q8(r){return bv.extend(r,wY)}var W8={},OC={},xv={},Ti={},bs={};function _Y(r,e,t){if(t===void 0&&(t=Array.prototype),r&&typeof t.find=="function")return t.find.call(r,e);for(var n=0;n<r.length;n++)if(Object.prototype.hasOwnProperty.call(r,n)){var s=r[n];if(e.call(void 0,s,n,r))return s}}function MC(r,e){return e===void 0&&(e=Object),e&&typeof e.freeze=="function"?e.freeze(r):r}function NY(r,e){if(r===null||typeof r!="object")throw new TypeError("target is not an object");for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r}var V8=MC({HTML:"text/html",isHTML:function(r){return r===V8.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),G8=MC({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(r){return r===G8.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"}),Gb=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,uS=new RegExp("[\\-\\.0-9"+Gb.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),SY=new RegExp("^"+Gb.source+uS.source+"*(?::"+Gb.source+uS.source+"*)?$");bs.assign=NY;bs.find=_Y;bs.freeze=MC;bs.MIME_TYPE=V8;bs.NAMESPACE=G8;bs.nameStartChar=Gb;bs.nameChar=uS;bs.tagNamePattern=SY;var FC=bs,la=FC.find,cm=FC.NAMESPACE,Od=FC.tagNamePattern;function kY(r){return r!==""}function CY(r){return r?r.split(/[\t\n\f\r ]+/).filter(kY):[]}function EY(r,e){return r.hasOwnProperty(e)||(r[e]=!0),r}function t5(r){if(!r)return[];var e=CY(r);return Object.keys(e.reduce(EY,{}))}function jY(r){return function(e){return r&&r.indexOf(e)!==-1}}function r0(r,e){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}function Vn(r,e){var t=r.prototype;if(!(t instanceof e)){let n=function(){};n.prototype=e.prototype,n=new n,r0(t,n),r.prototype=t=n}t.constructor!=r&&(typeof r!="function"&&console.error("unknown Class:"+r),t.constructor=r)}var Gn={},Us=Gn.ELEMENT_NODE=1,uf=Gn.ATTRIBUTE_NODE=2,Tp=Gn.TEXT_NODE=3,X8=Gn.CDATA_SECTION_NODE=4,Y8=Gn.ENTITY_REFERENCE_NODE=5,AY=Gn.ENTITY_NODE=6,BC=Gn.PROCESSING_INSTRUCTION_NODE=7,$C=Gn.COMMENT_NODE=8,K8=Gn.DOCUMENT_NODE=9,J8=Gn.DOCUMENT_TYPE_NODE=10,ao=Gn.DOCUMENT_FRAGMENT_NODE=11,TY=Gn.NOTATION_NODE=12,hn={},Ar={};hn.INDEX_SIZE_ERR=(Ar[1]="Index size error",1);hn.DOMSTRING_SIZE_ERR=(Ar[2]="DOMString size error",2);var On=hn.HIERARCHY_REQUEST_ERR=(Ar[3]="Hierarchy request error",3);hn.WRONG_DOCUMENT_ERR=(Ar[4]="Wrong document",4);var r5=hn.INVALID_CHARACTER_ERR=(Ar[5]="Invalid character",5);
vendor: 20,292 bytes, line 1360
1360hn.NO_DATA_ALLOWED_ERR=(Ar[6]="No data allowed",6);hn.NO_MODIFICATION_ALLOWED_ERR=(Ar[7]="No modification allowed",7);var Z8=hn.NOT_FOUND_ERR=(Ar[8]="Not found",8);hn.NOT_SUPPORTED_ERR=(Ar[9]="Not supported",9);var n5=hn.INUSE_ATTRIBUTE_ERR=(Ar[10]="Attribute in use",10),ei=hn.INVALID_STATE_ERR=(Ar[11]="Invalid state",11);hn.SYNTAX_ERR=(Ar[12]="Syntax error",12);hn.INVALID_MODIFICATION_ERR=(Ar[13]="Invalid modification",13);hn.NAMESPACE_ERR=(Ar[14]="Invalid namespace",14);hn.INVALID_ACCESS_ERR=(Ar[15]="Invalid access",15);function ot(r,e){if(e instanceof Error)var t=e;else t=this,Error.call(this,Ar[r]),this.message=Ar[r],Error.captureStackTrace&&Error.captureStackTrace(this,ot);return t.code=r,e&&(this.message=this.message+": "+e),t}ot.prototype=Error.prototype;r0(hn,ot);function oo(){}oo.prototype={length:0,item:function(r){return r>=0&&r<this.length?this[r]:null},toString:function(r,e,t){for(var n=!!t&&!!t.requireWellFormed,s=[],i=0;i<this.length;i++)XC(this[i],s,r,e,null,n);return s.join("")},filter:function(r){return Array.prototype.filter.call(this,r)},indexOf:function(r){return Array.prototype.indexOf.call(this,r)}};function df(r,e){this._node=r,this._refresh=e,UC(this)}function UC(r){var e=r._node._inc||r._node.ownerDocument._inc;if(r._inc!==e){var t=r._refresh(r._node);if(dO(r,"length",t.length),!r.$$length||t.length<r.$$length)for(var n=t.length;n in r;n++)Object.prototype.hasOwnProperty.call(r,n)&&delete r[n];r0(t,r),r._inc=e}}df.prototype.item=function(r){return UC(this),this[r]||null};Vn(df,oo);function Xb(){this._nameIndex=Object.create(null)}function Q8(r,e){for(var t=r.length;t--;)if(r[t]===e)return t}function DY(r,e){r._nameIndex[e.nodeName]=e}function eO(r,e){r._nameIndex[e.nodeName]===e&&delete r._nameIndex[e.nodeName]}function s5(r,e,t,n){if(n?(e[Q8(e,n)]=t,eO(e,n)):e[e.length++]=t,DY(e,t),r){t.ownerElement=r;var s=r.ownerDocument;s&&(n&&nO(s,r,n),RY(s,r,t))}}function i5(r,e,t){var n=Q8(e,t);if(n>=0){for(var s=e.length-1;n<s;)e[n]=e[++n];if(e.length=s,eO(e,t),r){var i=r.ownerDocument;i&&(nO(i,r,t),t.ownerElement=null)}}else throw new ot(Z8,new Error(r.tagName+"@"+t))}Xb.prototype={length:0,item:oo.prototype.item,getNamedItem:function(r){for(var e=this.length;e--;){var t=this[e];if(t.nodeName==r)return t}},setNamedItem:function(r){var e=r.ownerElement;if(e&&e!=this._ownerElement)throw new ot(n5);var t=this._nameIndex[r.nodeName];return s5(this._ownerElement,this,r,t),t},setNamedItemNS:function(r){var e=r.ownerElement,t;if(e&&e!=this._ownerElement)throw new ot(n5);return t=this.getNamedItemNS(r.namespaceURI,r.localName),s5(this._ownerElement,this,r,t),t},removeNamedItem:function(r){var e=this.getNamedItem(r);return i5(this._ownerElement,this,e),e},removeNamedItemNS:function(r,e){var t=this.getNamedItemNS(r,e);return i5(this._ownerElement,this,t),t},getNamedItemNS:function(r,e){for(var t=this.length;t--;){var n=this[t];if(n.localName==e&&n.namespaceURI==r)return n}return null}};function tO(){}tO.prototype={hasFeature:function(r,e){return!0},createDocument:function(r,e,t){var n=new n0;if(n.implementation=this,n.childNodes=new oo,n.doctype=t||null,t&&n.appendChild(t),e){var s=n.createElementNS(r,e);n.appendChild(s)}return n},createDocumentType:function(r,e,t){var n=new wv;return n.name=r,n.nodeName=r,n.publicId=e||"",n.systemId=t||"",n}};function bt(){}bt.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(r,e){return Kb(this,r,e)},replaceChild:function(r,e){Kb(this,r,e,iO),e&&this.removeChild(e)},removeChild:function(r){return sO(this,r)},appendChild:function(r){return this.insertBefore(r,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(r){return uO(this.ownerDocument||this,this,r)},normalize:function(){Er(this,null,{enter:function(r){for(var e=r.firstChild;e;){var t=e.nextSibling;if(t!==null&&t.nodeType===Tp&&e.nodeType===Tp){for(var n=[],s=t;s!==null&&s.nodeType===Tp;)n.push(s.data),s=s.nextSibling;for(var i=e.nextSibling;i!==s;){var o=i.nextSibling;i.parentNode=null,i.previousSibling=null,i.nextSibling=null,i=o}e.nextSibling=s,s!==null?s.previousSibling=e:r.lastChild=e,e.appendData(n.join("")),vv(r.ownerDocument,r),e=s}else e=t}return!0}})},isSupported:function(r,e){return this.ownerDocument.implementation.hasFeature(r,e)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(r){for(var e=this;e;){var t=e._nsMap;if(t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&t[n]===r)return n}e=e.nodeType==uf?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(r){for(var e=this;e;){var t=e._nsMap;if(t&&Object.prototype.hasOwnProperty.call(t,r))return t[r];e=e.nodeType==uf?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(r){var e=this.lookupPrefix(r);return e==null}};function rO(r){return r=="<"&&"&lt;"||r==">"&&"&gt;"||r=="&"&&"&amp;"||r=='"'&&"&quot;"||"&#"+r.charCodeAt()+";"}r0(Gn,bt);r0(Gn,bt.prototype);function Yb(r,e){return Er(r,null,{enter:function(t){return e(t)?Er.STOP:!0}})===Er.STOP}function Er(r,e,t){for(var n=[{node:r,context:e,phase:Er.ENTER}];n.length>0;){var s=n.pop();if(s.phase===Er.ENTER){var i=t.enter(s.node,s.context);if(i===Er.STOP)return Er.STOP;if(n.push({node:s.node,context:i,phase:Er.EXIT}),i==null)continue;for(var o=s.node.lastChild;o;)n.push({node:o,context:i,phase:Er.ENTER}),o=o.previousSibling}else t.exit&&t.exit(s.node,s.context)}}Er.STOP=Symbol("walkDOM.STOP");Er.ENTER=0;Er.EXIT=1;function n0(){this.ownerDocument=this}function RY(r,e,t){r&&r._inc++;var n=t.namespaceURI;n===cm.XMLNS&&(e._nsMap[t.prefix?t.localName:""]=t.value)}function nO(r,e,t,n){r&&r._inc++;var s=t.namespaceURI;s===cm.XMLNS&&delete e._nsMap[t.prefix?t.localName:""]}function vv(r,e,t){if(r&&r._inc){r._inc++;var n=e.childNodes;if(t)n[n.length++]=t;else{for(var s=e.firstChild,i=0;s;)n[i++]=s,s=s.nextSibling;n.length=i,delete n[n.length]}}}function sO(r,e){var t=e.previousSibling,n=e.nextSibling;return t?t.nextSibling=n:r.firstChild=n,n?n.previousSibling=t:r.lastChild=t,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,vv(r.ownerDocument,r),e}function PY(r){return r&&(r.nodeType===bt.DOCUMENT_NODE||r.nodeType===bt.DOCUMENT_FRAGMENT_NODE||r.nodeType===bt.ELEMENT_NODE)}function IY(r){return r&&(ca(r)||HC(r)||xo(r)||r.nodeType===bt.DOCUMENT_FRAGMENT_NODE||r.nodeType===bt.COMMENT_NODE||r.nodeType===bt.PROCESSING_INSTRUCTION_NODE)}function xo(r){return r&&r.nodeType===bt.DOCUMENT_TYPE_NODE}function ca(r){return r&&r.nodeType===bt.ELEMENT_NODE}function HC(r){return r&&r.nodeType===bt.TEXT_NODE}function a5(r,e){var t=r.childNodes||[];if(la(t,ca)||xo(e))return!1;var n=la(t,xo);return!(e&&n&&t.indexOf(n)>t.indexOf(e))}function o5(r,e){var t=r.childNodes||[];function n(i){return ca(i)&&i!==e}if(la(t,n))return!1;var s=la(t,xo);return!(e&&s&&t.indexOf(s)>t.indexOf(e))}function LY(r,e,t){if(!PY(r))throw new ot(On,"Unexpected parent node type "+r.nodeType);if(t&&t.parentNode!==r)throw new ot(Z8,"child not in parent");if(!IY(e)||xo(e)&&r.nodeType!==bt.DOCUMENT_NODE)throw new ot(On,"Unexpected node type "+e.nodeType+" for parent node type "+r.nodeType)}function OY(r,e,t){var n=r.childNodes||[],s=e.childNodes||[];if(e.nodeType===bt.DOCUMENT_FRAGMENT_NODE){var i=s.filter(ca);if(i.length>1||la(s,HC))throw new ot(On,"More than one element or text in fragment");if(i.length===1&&!a5(r,t))throw new ot(On,"Element in fragment can not be inserted before doctype")}if(ca(e)&&!a5(r,t))throw new ot(On,"Only one element can be added and only after doctype");if(xo(e)){if(la(n,xo))throw new ot(On,"Only one doctype is allowed");var o=la(n,ca);if(t&&n.indexOf(o)<n.indexOf(t))throw new ot(On,"Doctype can only be inserted before an element");if(!t&&o)throw new ot(On,"Doctype can not be appended since element is present")}}function iO(r,e,t){var n=r.childNodes||[],s=e.childNodes||[];if(e.nodeType===bt.DOCUMENT_FRAGMENT_NODE){var i=s.filter(ca);if(i.length>1||la(s,HC))throw new ot(On,"More than one element or text in fragment");if(i.length===1&&!o5(r,t))throw new ot(On,"Element in fragment can not be inserted before doctype")}if(ca(e)&&!o5(r,t))throw new ot(On,"Only one element can be added and only after doctype");if(xo(e)){if(la(n,function(c){return xo(c)&&c!==t}))throw new ot(On,"Only one doctype is allowed");var o=la(n,ca);if(t&&n.indexOf(o)<n.indexOf(t))throw new ot(On,"Doctype can only be inserted before an element")}}function Kb(r,e,t,n){LY(r,e,t),r.nodeType===bt.DOCUMENT_NODE&&(n||OY)(r,e,t);var s=e.parentNode;if(s&&s.removeChild(e),e.nodeType===ao){var i=e.firstChild;if(i==null)return e;var o=e.lastChild}else i=o=e;var l=t?t.previousSibling:r.lastChild;i.previousSibling=l,o.nextSibling=t,l?l.nextSibling=i:r.firstChild=i,t==null?r.lastChild=o:t.previousSibling=o;do{i.parentNode=r;var c=r.ownerDocument||r;um(i,c)}while(i!==o&&(i=i.nextSibling));return vv(r.ownerDocument||r,r),e.nodeType==ao&&(e.firstChild=e.lastChild=null),e}function um(r,e){if(r.ownerDocument!==e){if(r.ownerDocument=e,r.nodeType===Us&&r.attributes)for(var t=0;t<r.attributes.length;t++){var n=r.attributes.item(t);n&&(n.ownerDocument=e)}for(var s=r.firstChild;s;)um(s,e),s=s.nextSibling}}function MY(r,e){e.parentNode&&e.parentNode.removeChild(e),e.parentNode=r,e.previousSibling=r.lastChild,e.nextSibling=null,e.previousSibling?e.previousSibling.nextSibling=e:r.firstChild=e,r.lastChild=e,vv(r.ownerDocument,r,e);var t=r.ownerDocument||r;return um(e,t),e}n0.prototype={nodeName:"#document",nodeType:K8,doctype:null,documentElement:null,_inc:1,insertBefore:function(r,e){if(r.nodeType==ao){for(var t=r.firstChild;t;){var n=t.nextSibling;this.insertBefore(t,e),t=n}return r}return Kb(this,r,e),um(r,this),this.documentElement===null&&r.nodeType===Us&&(this.documentElement=r),r},removeChild:function(r){return this.documentElement==r&&(this.documentElement=null),sO(this,r)},replaceChild:function(r,e){Kb(this,r,e,iO),um(r,this),e&&this.removeChild(e),ca(r)&&(this.documentElement=r)},importNode:function(r,e){return FY(this,r,e)},getElementById:function(r){var e=null;return Yb(this.documentElement,function(t){if(t.nodeType==Us&&t.getAttribute("id")==r)return e=t,!0}),e},getElementsByClassName:function(r){var e=t5(r);return new df(this,function(t){var n=[];return e.length>0&&Yb(t.documentElement,function(s){if(s!==t&&s.nodeType===Us){var i=s.getAttribute("class");if(i){var o=r===i;if(!o){var l=t5(i);o=e.every(jY(l))}o&&n.push(s)}}}),n})},createElement:function(r){var e=new Fu;e.ownerDocument=this,e.nodeName=r,e.tagName=r,e.localName=r,e.childNodes=new oo;var t=e.attributes=new Xb;return t._ownerElement=e,e},createDocumentFragment:function(){var r=new _v;return r.ownerDocument=this,r.childNodes=new oo,r},createTextNode:function(r){var e=new zC;return e.ownerDocument=this,e.appendData(r),e},createComment:function(r){var e=new qC;return e.ownerDocument=this,e.appendData(r),e},createCDATASection:function(r){if(r.indexOf("]]>")!==-1)throw new ot(r5,'data contains "]]>"');var e=new WC;return e.ownerDocument=this,e.appendData(r),e},createProcessingInstruction:function(r,e){var t=new GC;return t.ownerDocument=this,t.tagName=t.nodeName=t.target=r,t.nodeValue=t.data=e,t},createAttribute:function(r){var e=new Jb;return e.ownerDocument=this,e.name=r,e.nodeName=r,e.localName=r,e.specified=!0,e},createEntityReference:function(r){if(!Od.test(r))throw new ot(r5,'not a valid xml name "'+r+'"');var e=new VC;return e.ownerDocument=this,e.nodeName=r,e},createElementNS:function(r,e){var t=new Fu,n=e.split(":"),s=t.attributes=new Xb;return t.childNodes=new oo,t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.namespaceURI=r,n.length==2?(t.prefix=n[0],t.localName=n[1]):t.localName=e,s._ownerElement=t,t},createAttributeNS:function(r,e){var t=new Jb,n=e.split(":");return t.ownerDocument=this,t.nodeName=e,t.name=e,t.namespaceURI=r,t.specified=!0,n.length==2?(t.prefix=n[0],t.localName=n[1]):t.localName=e,t}};Vn(n0,bt);function Fu(){this._nsMap={}}Fu.prototype={nodeType:Us,hasAttribute:function(r){return this.getAttributeNode(r)!=null},getAttribute:function(r){var e=this.getAttributeNode(r);return e&&e.value||""},getAttributeNode:function(r){return this.attributes.getNamedItem(r)},setAttribute:function(r,e){var t=this.ownerDocument.createAttribute(r);t.value=t.nodeValue=""+e,this.setAttributeNode(t)},removeAttribute:function(r){var e=this.getAttributeNode(r);e&&this.removeAttributeNode(e)},appendChild:function(r){return r.nodeType===ao?this.insertBefore(r,null):MY(this,r)},setAttributeNode:function(r){return this.attributes.setNamedItem(r)},setAttributeNodeNS:function(r){return this.attributes.setNamedItemNS(r)},removeAttributeNode:function(r){return this.attributes.removeNamedItem(r.nodeName)},removeAttributeNS:function(r,e){var t=this.getAttributeNodeNS(r,e);t&&this.removeAttributeNode(t)},hasAttributeNS:function(r,e){return this.getAttributeNodeNS(r,e)!=null},getAttributeNS:function(r,e){var t=this.getAttributeNodeNS(r,e);return t&&t.value||""},setAttributeNS:function(r,e,t){var n=this.ownerDocument.createAttributeNS(r,e);n.value=n.nodeValue=""+t,this.setAttributeNode(n)},getAttributeNodeNS:function(r,e){return this.attributes.getNamedItemNS(r,e)},getElementsByTagName:function(r){return new df(this,function(e){var t=[];return Yb(e,function(n){n!==e&&n.nodeType==Us&&(r==="*"||n.tagName==r)&&t.push(n)}),t})},getElementsByTagNameNS:function(r,e){return new df(this,function(t){var n=[];return Yb(t,function(s){s!==t&&s.nodeType===Us&&(r==="*"||s.namespaceURI===r)&&(e==="*"||s.localName==e)&&n.push(s)}),n})}};n0.prototype.getElementsByTagName=Fu.prototype.getElementsByTagName;n0.prototype.getElementsByTagNameNS=Fu.prototype.getElementsByTagNameNS;Vn(Fu,bt);function Jb(){}Jb.prototype.nodeType=uf;Vn(Jb,bt);function s0(){}s0.prototype={data:"",substringData:function(r,e){return this.data.substring(r,r+e)},appendData:function(r){r=this.data+r,this.nodeValue=this.data=r,this.length=r.length},insertData:function(r,e){this.replaceData(r,0,e)},appendChild:function(r){throw new Error(Ar[On])},deleteData:function(r,e){this.replaceData(r,e,"")},replaceData:function(r,e,t){var n=this.data.substring(0,r),s=this.data.substring(r+e);t=n+t+s,this.nodeValue=this.data=t,this.length=t.length}};Vn(s0,bt);function zC(){}zC.prototype={nodeName:"#text",nodeType:Tp,splitText:function(r){var e=this.data,t=e.substring(r);e=e.substring(0,r),this.data=this.nodeValue=e,this.length=e.length;var n=this.ownerDocument.createTextNode(t);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}};Vn(zC,s0);function qC(){}qC.prototype={nodeName:"#comment",nodeType:$C};Vn(qC,s0);function WC(){}WC.prototype={nodeName:"#cdata-section",nodeType:X8};Vn(WC,s0);function wv(){}wv.prototype.nodeType=J8;Vn(wv,bt);function aO(){}aO.prototype.nodeType=TY;Vn(aO,bt);function oO(){}oO.prototype.nodeType=AY;Vn(oO,bt);function VC(){}VC.prototype.nodeType=Y8;Vn(VC,bt);function _v(){}_v.prototype.nodeName="#document-fragment";_v.prototype.nodeType=ao;Vn(_v,bt);function GC(){}GC.prototype.nodeType=BC;Vn(GC,bt);function lO(){}lO.prototype.serializeToString=function(r,e,t,n){return cO.call(r,e,t,n)};bt.prototype.toString=cO;function cO(r,e,t){var n=!!t&&!!t.requireWellFormed,s=[],i=this.nodeType==9&&this.documentElement||this,o=i.prefix,l=i.namespaceURI;if(l&&o==null){var o=i.lookupPrefix(l);if(o==null)var c=[{namespace:l,prefix:null}]}return XC(this,s,r,e,c,n),s.join("")}function l5(r,e,t){var n=r.prefix||"",s=r.namespaceURI;if(!s||n==="xml"&&s===cm.XML||s===cm.XMLNS)return!1;for(var i=t.length;i--;){var o=t[i];if(o.prefix===n)return o.namespace!==s}return!0}function G0(r,e,t,n){if(n&&!Od.test(e))throw new ot(ei,'The attribute name "'+e+'" is not a valid XML QName');r.push(" ",e,'="',t.replace(/[<>&"\t\n\r]/g,rO),'"')}function XC(r,e,t,n,s,i){s||(s=[]),Er(r,{ns:s,isHTML:t},{enter:function(o,l){var c=l.ns,u=l.isHTML;if(n)if(o=n(o),o){if(typeof o=="string")return e.push(o),null}else return null;switch(o.nodeType){case Us:var d=o.attributes,h=d.length,f=o.tagName;u=cm.isHTML(o.namespaceURI)||u;var p=f;if(!u&&!o.prefix&&o.namespaceURI){for(var m,g=0;g<d.length;g++)if(d.item(g).name==="xmlns"){m=d.item(g).value;break}if(!m)for(var v=c.length-1;v>=0;v--){var b=c[v];if(b.prefix===""&&b.namespace===o.namespaceURI){m=b.namespace;break}}if(m!==o.namespaceURI)for(var v=c.length-1;v>=0;v--){var b=c[v];if(b.namespace===o.namespaceURI){b.prefix&&(p=b.prefix+":"+f);break}}}if(i&&!Od.test(p))throw new ot(ei,'The element name "'+p+'" is not a valid XML QName');e.push("<",p);for(var y=c.slice(),w=0;w<h;w++){var _=d.item(w);_.prefix=="xmlns"?y.push({prefix:_.localName,namespace:_.value}):_.nodeName=="xmlns"&&y.push({prefix:"",namespace:_.value})}for(var w=0;w<h;w++){var _=d.item(w);if(l5(_,u,y)){var N=_.prefix||"",S=_.namespaceURI;G0(e,N?"xmlns:"+N:"xmlns",S,i),y.push({prefix:N,namespace:S})}var E=n?n(_):_;E&&(typeof E=="string"?e.push(E):G0(e,E.name,E.value,i))}if(f===p&&l5(o,u,y)){var T=o.prefix||"",S=o.namespaceURI;G0(e,T?"xmlns:"+T:"xmlns",S,i),y.push({prefix:T,namespace:S})}var D=o.firstChild;if(D||u&&!/^(?:meta|link|img|br|hr|input)$/i.test(f)){if(e.push(">"),u&&/^script$/i.test(f)){for(;D;)D.data?e.push(D.data):XC(D,e,u,n,y.slice(),i),D=D.nextSibling;return e.push("</",f,">"),null}return{ns:y,isHTML:u,tag:p}}else return e.push("/>"),null;case K8:case ao:return{ns:c.slice(),isHTML:u,tag:null};case uf:return G0(e,o.name,o.value,i),null;case Tp:return e.push(o.data.replace(/[<&>]/g,rO)),null;case X8:if(i&&o.data.indexOf("]]>")!==-1)throw new ot(ei,'The CDATASection data contains "]]>"');return e.push("<![CDATA[",o.data.replace(/]]>/g,"]]]]><![CDATA[>"),"]]>"),null;case $C:if(i&&o.data.indexOf("-->")!==-1)throw new ot(ei,'The comment node data contains "-->"');return e.push("<!--",o.data,"-->"),null;case J8:if(i){if(!Od.test(o.name))throw new ot(ei,'The doctype name "'+o.name+'" is not a valid XML Name');if(o.publicId&&!/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(o.publicId))throw new ot(ei,"DocumentType publicId is not a valid PubidLiteral");if(o.systemId&&!/^("[^"]*"|'[^']*')$/.test(o.systemId))throw new ot(ei,"DocumentType systemId is not a valid SystemLiteral");if(o.internalSubset&&o.internalSubset.indexOf("]>")!==-1)throw new ot(ei,'DocumentType internalSubset contains "]>"')}var R=o.publicId,H=o.systemId;if(e.push("<!DOCTYPE ",o.name),R)e.push(" PUBLIC ",R),H&&H!="."&&e.push(" ",H),e.push(">");else if(H&&H!=".")e.push(" SYSTEM ",H,">");else{var A=o.internalSubset;A&&e.push(" [",A,"]"),e.push(">")}return null;case BC:if(i){if(!Od.test(o.target)||o.target.indexOf(":")!==-1||o.target.toLowerCase()==="xml")throw new ot(ei,'The processing instruction target "'+o.target+'" is not a valid XML NCName or is reserved');if(o.data.indexOf("?>")!==-1)throw new ot(ei,'The ProcessingInstruction data contains "?>"')}return e.push("<?",o.target," ",o.data,"?>"),null;case Y8:if(i&&!Od.test(o.nodeName))throw new ot(ei,'The entity reference name "'+o.nodeName+'" is not a valid XML Name');return e.push("&",o.nodeName,";"),null;default:return e.push("??",o.nodeName),null}},exit:function(o,l){l&&l.tag&&e.push("</",l.tag,">")}})}function FY(r,e,t){var n;return Er(e,null,{enter:function(s,i){var o=s.cloneNode(!1);o.ownerDocument=r,o.parentNode=null,i===null?n=o:i.appendChild(o);var l=s.nodeType===uf||t;return l?o:null}}),n}function uO(r,e,t){var n;return Er(e,null,{enter:function(s,i){var o=new s.constructor;for(var l in s)if(Object.prototype.hasOwnProperty.call(s,l)){var c=s[l];typeof c!="object"&&c!=o[l]&&(o[l]=c)}s.childNodes&&(o.childNodes=new oo),o.ownerDocument=r;var u=t;switch(o.nodeType){case Us:var d=s.attributes,h=o.attributes=new Xb,f=d.length;h._ownerElement=o;for(var p=0;p<f;p++)o.setAttributeNode(uO(r,d.item(p),!0));break;case uf:u=!0}return i!==null?i.appendChild(o):n=o,u?o:null}}),n}function dO(r,e,t){r[e]=t}try{Object.defineProperty&&(Object.defineProperty(df.prototype,"length",{get:function(){return UC(this),this.$$length}}),Object.defineProperty(bt.prototype,"textContent",{get:function(){if(this.nodeType===Us||this.nodeType===ao){var r=[];return Er(this,null,{enter:function(e){if(e.nodeType===Us||e.nodeType===ao)return!0;
1360if(e.nodeType===BC||e.nodeType===$C)return null;r.push(e.nodeValue)}}),r.join("")}return this.nodeValue},set:function(r){switch(this.nodeType){case Us:case ao:for(;this.firstChild;)this.removeChild(this.firstChild);(r||String(r))&&this.appendChild(this.ownerDocument.createTextNode(r));break;default:this.data=r,this.value=r,this.nodeValue=r}}}),dO=function(r,e,t){r["$$"+e]=t})}catch{}Ti.DocumentType=wv;Ti.DOMException=ot;Ti.DOMImplementation=tO;Ti.Element=Fu;Ti.Node=bt;Ti.NodeList=oo;Ti.walkDOM=Er;Ti.XMLSerializer=lO;var Nv={},hO={};(function(r){var e=bs.freeze;r.XML_ENTITIES=e({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),r.HTML_ENTITIES=e
vendor: 14,815 bytes, line 1360
1360({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:
1360`
1361`
vendor: 9,925 bytes, line 1361
1361,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"
1361	",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),r.entityMap=r.HTML_ENTITIES})(hO);var YC={},dm=bs.NAMESPACE,dS=bs.tagNamePattern,ad=0,jo=1,od=2,Vf=3,ld=4,cd=5,Gf=6,X0=7;function hf(r,e){this.message=r,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,hf)}hf.prototype=new Error;hf.prototype.name=hf.name;function fO(){}fO.prototype={parse:function(r,e,t){var n=this.domBuilder;n.startDocument(),zY(e,e={}),BY(r,e,t,n,this.errorHandler),n.endDocument()}};
vendor: 6,174 bytes, line 1361
1361function BY(r,e,t,n,s){function i(L){if(L>65535){L-=65536;var B=55296+(L>>10),I=56320+(L&1023);return String.fromCharCode(B,I)}else return String.fromCharCode(L)}function o(L){var B=L.slice(1,-1);return Object.hasOwnProperty.call(t,B)?t[B]:B.charAt(0)==="#"?i(parseInt(B.substr(1).replace("x","0x"))):(s.error("entity not found:"+L),L)}function l(L){if(L>g){var B=r.substring(g,L).replace(/&#?\w+;/g,o);f&&c(g),n.characters(B,0,L-g),g=L}}function c(L,B){for(;L>=d&&(B=h.exec(r));)u=B.index,d=u+B[0].length,f.lineNumber++;f.columnNumber=L-u+1}for(var u=0,d=0,h=/.*(?:\r\n?|\n)|.*$/g,f=n.locator,p=[{currentNSMap:e}],m={},g=0;;){try{var v=r.indexOf("<",g);if(v<0){if(!r.substr(g).match(/^\s*$/)){var b=n.doc,y=b.createTextNode(r.substr(g));b.appendChild(y),n.currentElement=y}return}switch(v>g&&l(v),r.charAt(v+1)){case"/":var H=r.indexOf(">",v+3),w=r.substring(v+2,H).replace(/^([\s\S]*?[^ \t\n\r])?[ \t\n\r]*$/,"$1"),_=p.pop();H<0?(w=r.substring(v+2).replace(/[\s<].*/,""),s.error("end tag name: "+w+" is not complete:"+_.tagName),H=v+1+w.length):w.match(/\s</)?(w=w.replace(/[\s<].*/,""),s.error("end tag name: "+w+" maybe not complete"),H=v+1+w.length):/[ \t\n\r]/.test(w)&&dS.test(w.split(/[ \t\n\r]/)[0])&&s.error('end tag name is followed by whitespace and trailing content: "'+w+'"');var N=_.localNSMap,S=_.tagName==w,E=S||_.tagName&&_.tagName.toLowerCase()==w.toLowerCase();if(E){if(n.endElement(_.uri,_.localName,w),N)for(var T in N)Object.prototype.hasOwnProperty.call(N,T)&&n.endPrefixMapping(T);S||s.fatalError("end tag name: "+w+" is not match the current start tagName:"+_.tagName)}else p.push(_);H++;break;case"?":f&&c(v),H=WY(r,v,n);break;case"!":f&&c(v),H=qY(r,v,n,s);break;default:f&&c(v);var D=new pO,R=p[p.length-1].currentNSMap,H=$Y(r,v,D,R,o,s),A=D.length;if(!D.closed&&HY(r,H,D.tagName,m)&&(D.closed=!0,t.nbsp||s.warning("unclosed xml attribute")),f&&A){for(var U=c5(f,{}),C=0;C<A;C++){var M=D[C];c(M.offset),M.locator=c5(f,{})}n.locator=U,u5(D,n,R)&&p.push(D),n.locator=f}else u5(D,n,R)&&p.push(D);dm.isHTML(D.uri)&&!D.closed?H=UY(r,H,D.tagName,o,n):H++}}catch(L){if(L instanceof hf)throw L;s.error("element parse error: "+L),H=-1}H>g?g=H:l(Math.max(v,g)+1)}}function c5(r,e){return e.lineNumber=r.lineNumber,e.columnNumber=r.columnNumber,e}function $Y(r,e,t,n,s,i){function o(f,p,m){t.attributeNames.hasOwnProperty(f)&&i.fatalError("Attribute "+f+" redefined"),t.addValue(f,p.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,s),m)}for(var l,c,u=++e,d=ad;;){var h=r.charAt(u);if(d===ad&&h==="<")throw new Error("unexpected < in tag name: "+r.slice(e,u));switch(h){case"=":if(d===jo)l=r.slice(e,u),d=Vf;else if(d===od)d=Vf;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(d===Vf||d===jo)if(d===jo&&(i.warning('attribute value must after "="'),l=r.slice(e,u)),e=u+1,u=r.indexOf(h,e),u>0)c=r.slice(e,u),o(l,c,e-1),d=cd;else throw new Error("attribute value no end '"+h+"' match");else if(d==ld)c=r.slice(e,u),o(l,c,e),i.warning('attribute "'+l+'" missed start quot('+h+")!!"),e=u+1,d=cd;else throw new Error('attribute value must after "="');break;case"/":switch(d){case ad:t.setTagName(r.slice(e,u));case cd:case Gf:case X0:d=X0,t.closed=!0;case ld:case jo:break;case od:t.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return i.error("unexpected end of input"),d==ad&&t.setTagName(r.slice(e,u)),u;case">":switch(d){case ad:t.setTagName(r.slice(e,u));case cd:case Gf:case X0:break;case ld:case jo:c=r.slice(e,u),c.slice(-1)==="/"&&(t.closed=!0,c=c.slice(0,-1));case od:d===od&&(c=l),d==ld?(i.warning('attribute "'+c+'" missed quot(")!'),o(l,c,e)):((!dm.isHTML(n[""])||!c.match(/^(?:disabled|checked|selected)$/i))&&i.warning('attribute "'+c+'" missed value!! "'+c+'" instead!!'),o(c,c,e));break;case Vf:throw new Error("attribute value missed!!")}return u;case"€":h=" ";default:if(h<=" ")switch(d){case ad:t.setTagName(r.slice(e,u)),d=Gf;break;case jo:l=r.slice(e,u),d=od;break;case ld:var c=r.slice(e,u);i.warning('attribute "'+c+'" missed quot(")!!'),o(l,c,e);case cd:d=Gf;break}else switch(d){case od:t.tagName,(!dm.isHTML(n[""])||!l.match(/^(?:disabled|checked|selected)$/i))&&i.warning('attribute "'+l+'" missed value!! "'+l+'" instead2!!'),o(l,l,e),e=u,d=jo;break;case cd:i.warning('attribute space is required"'+l+'"!!');case Gf:d=jo,e=u;break;case Vf:d=ld,e=u;break;case X0:throw new Error("elements closed character '/' and '>' must be connected to")}}u++}}function u5(r,e,t){for(var n=r.tagName,s=null,h=r.length;h--;){var i=r[h],o=i.qName,l=i.value,f=o.indexOf(":");if(f>0)var c=i.prefix=o.slice(0,f),u=o.slice(f+1),d=c==="xmlns"&&u;else u=o,c=null,d=o==="xmlns"&&"";i.localName=u,d!==!1&&(s==null&&(s={},t=Object.create(t)),t[d]=s[d]=l,i.uri=dm.XMLNS,e.startPrefixMapping(d,l))}for(var h=r.length;h--;){i=r[h];var c=i.prefix;c&&(c==="xml"&&(i.uri=dm.XML),c!=="xmlns"&&(i.uri=t[c||""]))}var f=n.indexOf(":");f>0?(c=r.prefix=n.slice(0,f),u=r.localName=n.slice(f+1)):(c=null,u=r.localName=n);var p=r.uri=t[c||""];if(e.startElement(p,u,n,r),r.closed){if(e.endElement(p,u,n),s)for(c in s)Object.prototype.hasOwnProperty.call(s,c)&&e.endPrefixMapping(c)}else return r.currentNSMap=t,r.localNSMap=s,!0}function UY(r,e,t,n,s){if(/^(?:script|textarea)$/i.test(t)){var i=r.indexOf("</"+t+">",e),o=r.substring(e+1,i);if(/[&<]/.test(o))return/^script$/i.test(t)?(s.characters(o,0,o.length),i):(o=o.replace(/&#?\w+;/g,n),s.characters(o,0,o.length),i)}return e+1}function HY(r,e,t,n){var s=n[t];return s==null&&(s=r.lastIndexOf("</"+t+">"),s<e&&(s=r.lastIndexOf("</"+t)),n[t]=s),s<e}function zY(r,e){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}function qY(r,e,t,n){var s=r.charAt(e+2);switch(s){case"-":if(r.charAt(e+3)==="-"){var i=r.indexOf("-->",e+4);return i>e?(t.comment(r,e+4,i-e-4),i+3):(n.error("Unclosed comment"),-1)}else return-1;default:if(r.substr(e+3,6)=="CDATA["){var i=r.indexOf("]]>",e+9);return t.startCDATA(),t.characters(r,e+9,i-e-9),t.endCDATA(),i+3}var o=VY(r,e),l=o.length;if(l>1&&/!doctype/i.test(o[0][0])){var c=o[1][0],u=!1,d=!1;l>3&&(/^public$/i.test(o[2][0])?(u=o[3][0],d=l>4&&o[4][0]):/^system$/i.test(o[2][0])&&(d=o[3][0]));
vendor: 4,480 bytes, lines 1361-1364
1361var h=o[l-1];return t.startDTD(c,u,d),t.endDTD(),h.index+h[0].length}}return-1}function WY(r,e,t){var n=r.indexOf("?>",e);if(n){var s=r.substring(e,n).match(/^<\?(\S*)\s*([\s\S]*?)$/);return s?(s[0].length,t.processingInstruction(s[1],s[2]),n+2):-1}return-1}function pO(){this.attributeNames={}}pO.prototype={setTagName:function(r){if(!dS.test(r))throw new Error("invalid tagName:"+r);this.tagName=r},addValue:function(r,e,t){if(!dS.test(r))throw new Error("invalid attribute:"+r);this.attributeNames[r]=this.length,this[this.length++]={qName:r,value:e,offset:t}},length:0,getLocalName:function(r){return this[r].localName},getLocator:function(r){return this[r].locator},getQName:function(r){return this[r].qName},getURI:function(r){return this[r].uri},getValue:function(r){return this[r].value}};function VY(r,e){var t,n=[],s=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(s.lastIndex=e,s.exec(r);t=s.exec(r);)if(n.push(t),t[1])return n}YC.XMLReader=fO;YC.ParseError=hf;var GY=bs,XY=Ti,d5=hO,mO=YC,YY=XY.DOMImplementation,h5=GY.NAMESPACE,KY=mO.ParseError,JY=mO.XMLReader;function gO(r){return r.replace(/\r[\n\u0085]/g,`
1362`).replace(/[\r\u0085\u2028]/g,`
1363`)}function yO(r){this.options=r||{locator:{}}}yO.prototype.parseFromString=function(r,e){var t=this.options,n=new JY,s=t.domBuilder||new i0,i=t.errorHandler,o=t.locator,l=t.xmlns||{},c=/\/x?html?$/.test(e),u=c?d5.HTML_ENTITIES:d5.XML_ENTITIES;o&&s.setDocumentLocator(o),n.errorHandler=ZY(i,s,o),n.domBuilder=t.domBuilder||s,c&&(l[""]=h5.HTML),l.xml=l.xml||h5.XML;var d=t.normalizeLineEndings||gO;return r&&typeof r=="string"?n.parse(d(r),l,u):n.errorHandler.error("invalid doc source"),s.doc};function ZY(r,e,t){if(!r){if(e instanceof i0)return e;r=e}var n={},s=r instanceof Function;t=t||{};function i(o){var l=r[o];!l&&s&&(l=r.length==2?function(c){r(o,c)}:r),n[o]=l&&function(c){l("[xmldom "+o+"]	"+c+hS(t))}||function(){}}return i("warning"),i("error"),i("fatalError"),n}function i0(){this.cdata=!1}function ud(r,e){e.lineNumber=r.lineNumber,e.columnNumber=r.columnNumber}i0.prototype={startDocument:function(){this.doc=new YY().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(r,e,t,n){var s=this.doc,i=s.createElementNS(r,t||e),o=n.length;Y0(this,i),this.currentElement=i,this.locator&&ud(this.locator,i);for(var l=0;l<o;l++){var r=n.getURI(l),c=n.getValue(l),t=n.getQName(l),u=s.createAttributeNS(r,t);this.locator&&ud(n.getLocator(l),u),u.value=u.nodeValue=c,i.setAttributeNode(u)}},endElement:function(r,e,t){var n=this.currentElement;n.tagName,this.currentElement=n.parentNode},startPrefixMapping:function(r,e){},endPrefixMapping:function(r){},processingInstruction:function(r,e){var t=this.doc.createProcessingInstruction(r,e);this.locator&&ud(this.locator,t),Y0(this,t)},ignorableWhitespace:function(r,e,t){},characters:function(r,e,t){if(r=f5.apply(this,arguments),r){if(this.cdata)var n=this.doc.createCDATASection(r);else var n=this.doc.createTextNode(r);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(r)&&this.doc.appendChild(n),this.locator&&ud(this.locator,n)}},skippedEntity:function(r){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(r){(this.locator=r)&&(r.lineNumber=0)},comment:function(r,e,t){r=f5.apply(this,arguments);var n=this.doc.createComment(r);this.locator&&ud(this.locator,n),Y0(this,n)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(r,e,t){var n=this.doc.implementation;if(n&&n.createDocumentType){var s=n.createDocumentType(r,e,t);this.locator&&ud(this.locator,s),Y0(this,s),this.doc.doctype=s}},warning:function(r){console.warn("[xmldom warning]	"+r,hS(this.locator))},error:function(r){console.error("[xmldom error]	"+r,hS(this.locator))},fatalError:function(r){throw new KY(r,this.locator)}};function hS(r){if(r)return`
1364@`+(r.systemId||"")+"#[line:"+r.lineNumber+",col:"+r.columnNumber+"]"}function f5(r,e,t){return typeof r=="string"?r.substr(e,t):r.length>=e+t||e?new java.lang.String(r,e,t)+"":r}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(r){i0.prototype[r]=function(){return null}});function Y0(r,e){r.currentElement?r.currentElement.appendChild(e):r.doc.appendChild(e)}Nv.__DOMHandler=i0;Nv.normalizeLineEndings=gO;Nv.DOMParser=yO;var bO=Ti;xv.DOMImplementation=bO.DOMImplementation;
1364xv.XMLSerializer=bO.XMLSerializer;xv.DOMParser=Nv.DOMParser;var QY=xv,eK=Ti;function tK(r){var e=null,t=new QY.DOMParser({errorHandler:function(s,i){e={level:s,message:i}}}),n=t.parseFromString(r);if(e===null)return n;throw new Error(e.level+": "+e.message)}OC.parseFromString=tK;OC.Node=eK.Node;var U1=Tr,p5=er,xO=OC,vO=Af,rK=vO.Element;W8.readString=nK;var m5=xO.Node;function nK(r,e){e=e||{};try{var t=xO.parseFromString(r,"text/xml")}catch(o){return U1.reject(o)}if(t.documentElement.tagName==="parsererror")return U1.resolve(new Error(t.documentElement.textContent));function n(o){switch(o.nodeType){case m5.ELEMENT_NODE:return s(o);case m5.TEXT_NODE:return vO.text(o.nodeValue)}}function s(o){var l=i(o),c=[];p5.forEach(o.childNodes,function(d){var h=n(d);h&&c.push(h)});var u=Object.create(null);return p5.forEach(o.attributes,function(d){u[i(d)]=d.value}),new rK(l,u,c)}function i(o){if(o.namespaceURI){var l=e[o.namespaceURI],c;return l?c=l+":":c="{"+o.namespaceURI+"}",c+o.localName}else return o.localName}return U1.resolve(n(t.documentElement))}var wO={},fp={},ba={},g5;function Kl(){return g5||(g5=1,(function(){var r,e,t,n,s,i,o,l=[].slice,c={}.hasOwnProperty;r=function(){var u,d,h,f,p,m;if(m=arguments[0],p=2<=arguments.length?l.call(arguments,1):[],s(Object.assign))Object.assign.apply(null,arguments);else for(u=0,h=p.length;u<h;u++)if(f=p[u],f!=null)for(d in f)c.call(f,d)&&(m[d]=f[d]);return m},s=function(u){return!!u&&Object.prototype.toString.call(u)==="[object Function]"},i=function(u){var d;return!!u&&((d=typeof u)=="function"||d==="object")},t=function(u){return s(Array.isArray)?Array.isArray(u):Object.prototype.toString.call(u)==="[object Array]"},n=function(u){var d;if(t(u))return!u.length;for(d in u)if(c.call(u,d))return!1;return!0},o=function(u){var d,h;return i(u)&&(h=Object.getPrototypeOf(u))&&(d=h.constructor)&&typeof d=="function"&&d instanceof d&&Function.prototype.toString.call(d)===Function.prototype.toString.call(Object)},e=function(u){return s(u.valueOf)?u.valueOf():u},ba.assign=r,ba.isFunction=s,ba.isObject=i,ba.isArray=t,ba.isEmpty=n,ba.isPlainObject=o,ba.getValue=e}).call(Be)),ba}var H1={exports:{}},z1={exports:{}},q1={exports:{}},W1={exports:{}},y5;function _O(){return y5||(y5=1,(function(){W1.exports=function(){function r(e,t,n){if(this.options=e.options,this.stringify=e.stringify,this.parent=e,t==null)throw new Error("Missing attribute name. "+this.debugInfo(t));if(n==null)throw new Error("Missing attribute value. "+this.debugInfo(t));this.name=this.stringify.attName(t),this.value=this.stringify.attValue(n)}return r.prototype.clone=function(){return Object.create(this)},r.prototype.toString=function(e){return this.options.writer.set(e).attribute(this)},r.prototype.debugInfo=function(e){return e=e||this.name,e==null?"parent: <"+this.parent.name+">":"attribute: {"+e+"}, parent: <"+this.parent.name+">"},r}()}).call(Be)),W1.exports}var b5;function Sv(){return b5||(b5=1,(function(){var r,e,t,n,s,i,o=function(c,u){for(var d in u)l.call(u,d)&&(c[d]=u[d]);function h(){this.constructor=c}return h.prototype=u.prototype,c.prototype=new h,c.__super__=u.prototype,c},l={}.hasOwnProperty;i=Kl(),s=i.isObject,n=i.isFunction,t=i.getValue,e=Xn(),r=_O(),q1.exports=function(c){o(u,c);function u(d,h,f){if(u.__super__.constructor.call(this,d),h==null)throw new Error("Missing element name. "+this.debugInfo());this.name=this.stringify.eleName(h),this.attributes={},f!=null&&this.attribute(f),d.isDocument&&(this.isRoot=!0,this.documentObject=d,d.rootObject=this)}return u.prototype.clone=function(){var d,h,f,p;f=Object.create(this),f.isRoot&&(f.documentObject=null),f.attributes={},p=this.attributes;for(h in p)l.call(p,h)&&(d=p[h],f.attributes[h]=d.clone());return f.children=[],this.children.forEach(function(m){var g;return g=m.clone(),g.parent=f,f.children.push(g)}),f},u.prototype.attribute=function(d,h){var f,p;if(d!=null&&(d=t(d)),s(d))for(f in d)l.call(d,f)&&(p=d[f],this.attribute(f,p));else n(h)&&(h=h.apply()),(!this.options.skipNullAttributes||h!=null)&&(this.attributes[d]=new r(this,d,h));return this},u.prototype.removeAttribute=function(d){var h,f,p;if(d==null)throw new Error("Missing attribute name. "+this.debugInfo());if(d=t(d),Array.isArray(d))for(f=0,p=d.length;f<p;f++)h=d[f],delete this.attributes[h];else delete this.attributes[d];return this},u.prototype.toString=function(d){return this.options.writer.set(d).element
1364(this)},u.prototype.att=function(d,h){return this.attribute(d,h)},u.prototype.a=function(d,h){return this.attribute(d,h)},u}(e)}).call(Be)),q1.exports}var V1={exports:{}},x5;function kv(){return x5||(x5=1,(function(){var r,e=function(n,s){for(var i in s)t.call(s,i)&&(n[i]=s[i]);function o(){this.constructor=n}return o.prototype=s.prototype,n.prototype=new o,n.__super__=s.prototype,n},t={}.hasOwnProperty;r=Xn(),V1.exports=function(n){e(s,n);function s(i,o){if(s.__super__.constructor.call(this,i),o==null)throw new Error("Missing CDATA text. "+this.debugInfo());this.text=this.stringify.cdata(o)}return s.prototype.clone=function(){return Object.create(this)},s.prototype.toString=function(i){return this.options.writer.set(i).cdata(this)},s}(r)}).call(Be)),V1.exports}var G1={exports:{}},v5;function Cv(){return v5||(v5=1,(function(){var r,e=function(n,s){for(var i in s)t.call(s,i)&&(n[i]=s[i]);function o(){this.constructor=n}return o.prototype=s.prototype,n.prototype=new o,n.__super__=s.prototype,n},t={}.hasOwnProperty;r=Xn(),G1.exports=function(n){e(s,n);function s(i,o){if(s.__super__.constructor.call(this,i),o==null)throw new Error("Missing comment text. "+this.debugInfo());this.text=this.stringify.comment(o)}return s.prototype.clone=function(){return Object.create(this)},s.prototype.toString=function(i){return this.options.writer.set(i).comment(this)},s}(r)}).call(Be)),G1.exports}var X1={exports:{}},w5;function Ev(){return w5||(w5=1,(function(){var r,e,t=function(s,i){for(var o in i)n.call(i,o)&&(s[o]=i[o]);function l(){this.constructor=s}return l.prototype=i.prototype,s.prototype=new l,s.__super__=i.prototype,s},n={}.hasOwnProperty;e=Kl().isObject,r=Xn(),X1.exports=function(s){t(i,s);function i(o,l,c,u){var d;i.__super__.constructor.call(this,o),e(l)&&(d=l,l=d.version,c=d.encoding,u=d.standalone),l||(l="1.0"),this.version=this.stringify.xmlVersion(l),c!=null&&(this.encoding=this.stringify.xmlEncoding(c)),u!=null&&(this.standalone=this.stringify.xmlStandalone(u))}return i.prototype.toString=function(o){return this.options.writer.set(o).declaration(this)},i}(r)}).call(Be)),X1.exports}var Y1={exports:{}},K1={exports:{}},_5;function jv(){return _5||(_5=1,(function(){var r,e=function(n,s){for(var i in s)t.call(s,i)&&(n[i]=s[i]);function o(){this.constructor=n}return o.prototype=s.prototype,n.prototype=new o,n.__super__=s.prototype,n},t={}.hasOwnProperty;r=Xn(),K1.exports=function(n){e(s,n);function s(i,o,l,c,u,d){if(s.__super__.constructor.call(this,i),o==null)throw new Error("Missing DTD element name. "+this.debugInfo());if(l==null)throw new Error("Missing DTD attribute name. "+this.debugInfo(o));if(!c)throw new Error("Missing DTD attribute type. "+this.debugInfo(o));if(!u)throw new Error("Missing DTD attribute default. "+this.debugInfo(o));if(u.indexOf("#")!==0&&(u="#"+u),!u.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(o));if(d&&!u.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(o));this.elementName=this.stringify.eleName(o),this.attributeName=this.stringify.attName(l),this.attributeType=this.stringify.dtdAttType(c),this.defaultValue=this.stringify.dtdAttDefault(d),this.defaultValueType=u}return s.prototype.toString=function(i){return this.options.writer.set(i).dtdAttList(this)},s}(r)}).call(Be)),K1.exports}var J1={exports:{}},N5;function Av(){return N5||(N5=1,(function(){var r,e,t=function(s,i){for(var o in i)n.call(i,o)&&(s[o]=i[o]);function l(){this.constructor=s}return l.prototype=i.prototype,s.prototype=new l,s.__super__=i.prototype,s},n={}.hasOwnProperty;e=Kl().isObject,r=Xn(),J1.exports=function(s){t(i,s);function i(o,l,c,u){if(i.__super__.constructor.call(this,o),c==null)throw new Error("Missing DTD entity name. "+this.debugInfo(c));if(u==null)throw new Error("Missing DTD entity value. "+this.debugInfo(c));if(this.pe=!!l,this.name=this.stringify.eleName(c),!e(u))this.value=this.stringify.dtdEntityValue(u);else{if(!u.pubID&&!u.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(c));if(u.pubID&&!u.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(c));if(u.pubID!=null&&(this.pubID=this.stringify.dtdPubID(u.pubID)),u.sysID!=null&&(this.sysID=this.stringify.dtdSysID(u.sysID)),u.nData!=null&&(this.nData=this.stringify.dtdNData(u.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(c))}}return i.prototype.toString=function(o){return this.options.writer.set(o).dtdEntity(this)},i}(r)}).call(Be)),J1.exports}var Z1={exports:{}},S5;function Tv(){return S5||(S5=1,(function(){var r,e=function(n,s){for(var i in s)t.call(s,i)&&(n[i]=s[i]);function o(){this.constructor=n}return o.prototype=s.prototype,n.prototype=new o,n.__super__=s.prototype,n},t={}.hasOwnProperty;r=Xn(),Z1.exports=function(n){e(s,n);function s(i,o,l){if(s.__super__.constructor.call(this,i),o==null)throw new Error("Missing DTD element name. "+this.debugInfo());l||(l="(#PCDATA)"),Array.isArray(l)&&(l="("+l.join(",")+")"),this.name=this.stringify.eleName(o),this.value=this.stringify.dtdElementValue(l)}return s.prototype.toString=function(i){return this.options.writer.set(i).dtdElement(this)},s}(r)}).call(Be)),Z1.exports}var Q1={exports:{}},k5;function Dv(){return k5||(k5=1,(function(){var r,e=function(n,s){for(var i in s)t.call(s,i)&&(n[i]=s[i]);function o(){this.constructor=n}return o.prototype=s.prototype,n.prototype=new o,n.__super__=s.prototype,n},t={}.hasOwnProperty;r=Xn(),Q1.exports=function(n){e(s,n);function s(i,o,l){if(s.__super__.constructor.call(this,i),o==null)throw new Error("Missing DTD notation name. "+this.debugInfo(o));if(!l.pubID&&!l.sysID)throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(o));this.name=this.stringify.eleName(o),l.pubID!=null&&(this.pubID=this.stringify.dtdPubID(l.pubID)),l.sysI
1364D!=null&&(this.sysID=this.stringify.dtdSysID(l.sysID))}return s.prototype.toString=function(i){return this.options.writer.set(i).dtdNotation(this)},s}(r)}).call(Be)),Q1.exports}var C5;function Rv(){return C5||(C5=1,(function(){var r,e,t,n,s,i,o=function(c,u){for(var d in u)l.call(u,d)&&(c[d]=u[d]);function h(){this.constructor=c}return h.prototype=u.prototype,c.prototype=new h,c.__super__=u.prototype,c},l={}.hasOwnProperty;i=Kl().isObject,s=Xn(),r=jv(),t=Av(),e=Tv(),n=Dv(),Y1.exports=function(c){o(u,c);function u(d,h,f){var p,m;u.__super__.constructor.call(this,d),this.name="!DOCTYPE",this.documentObject=d,i(h)&&(p=h,h=p.pubID,f=p.sysID),f==null&&(m=[h,f],f=m[0],h=m[1]),h!=null&&(this.pubID=this.stringify.dtdPubID(h)),f!=null&&(this.sysID=this.stringify.dtdSysID(f))}return u.prototype.element=function(d,h){var f;return f=new e(this,d,h),this.children.push(f),this},u.prototype.attList=function(d,h,f,p,m){var g;return g=new r(this,d,h,f,p,m),this.children.push(g),this},u.prototype.entity=function(d,h){var f;return f=new t(this,!1,d,h),this.children.push(f),this},u.prototype.pEntity=function(d,h){var f;return f=new t(this,!0,d,h),this.children.push(f),this},u.prototype.notation=function(d,h){var f;return f=new n(this,d,h),this.children.push(f),this},u.prototype.toString=function(d){return this.options.writer.set(d).docType(this)},u.prototype.ele=function(d,h){return this.element(d,h)},u.prototype.att=function(d,h,f,p,m){return this.attList(d,h,f,p,m)},u.prototype.ent=function(d,h){return this.entity(d,h)},u.prototype.pent=function(d,h){return this.pEntity(d,h)},u.prototype.not=function(d,h){return this.notation(d,h)},u.prototype.up=function(){return this.root()||this.documentObject},u}(s)}).call(Be)),Y1.exports}var e2={exports:{}},E5;function Pv(){return E5||(E5=1,(function(){var r,e=function(n,s){for(var i in s)t.call(s,i)&&(n[i]=s[i]);function o(){this.constructor=n}return o.prototype=s.prototype,n.prototype=new o,n.__super__=s.prototype,n},t={}.hasOwnProperty;r=Xn(),e2.exports=function(n){e(s,n);function s(i,o){if(s.__super__.constructor.call(this,i),o==null)throw new Error("Missing raw text. "+this.debugInfo());this.value=this.stringify.raw(o)}return s.prototype.clone=function(){return Object.create(this)},s.prototype.toString=function(i){return this.options.writer.set(i).raw(this)},s}(r)}).call(Be)),e2.exports}var t2={exports:{}},j5;function Iv(){return j5||(j5=1,(function(){var r,e=function(n,s){for(var i in s)t.call(s,i)&&(n[i]=s[i]);function o(){this.constructor=n}return o.prototype=s.prototype,n.prototype=new o,n.__super__=s.prototype,n},t={}.hasOwnProperty;r=Xn(),t2.exports=function(n){e(s,n);function s(i,o){if(s.__super__.constructor.call(this,i),o==null)throw new Error("Missing element text. "+this.debugInfo());this.value=this.stringify.eleText(o)}return s.prototype.clone=function(){return Object.create(this)},s.prototype.toString=function(i){return this.options.writer.set(i).text(this)},s}(r)}).call(Be)),t2.exports}var r2={exports:{}},A5;function Lv(){return A5||(A5=1,(function(){var r,e=function(n,s){for(var i in s)t.call(s,i)&&(n[i]=s[i]);function o(){this.constructor=n}return o.prototype=s.prototype,n.prototype=new o,n.__super__=s.prototype,n},t={}.hasOwnProperty;r=Xn(),r2.exports=function(n){e(s,n);function s(i,o,l){if(s.__super__.constructor.call(this,i),o==null)throw new Error("Missing instruction target. "+this.debugInfo());this.target=this.stringify.insTarget(o),l&&(this.value=this.stringify.insValue(l))}return s.prototype.clone=function(){return Object.create(this)},s.prototype.toString=function(i){return this.options.writer.set(i).processingInstruction(this)},s}(r)}).call(Be)),r2.exports}var n2={exports:{}},T5;function KC(){return T5||(T5=1,(function(){var r,e=function(n,s){for(var i in s)t.call(s,i)&&(n[i]=s[i]);function o(){this.constructor=n}return o.prototype=s.prototype,n.prototype=new o,n.__super__=s.prototype,n},t={}.hasOwnProperty;r=Xn(),n2.exports=function(n){e(s,n);function s(i){s.__super__.constructor.call(this,i),this.isDummy=!0}return s.prototype.clone=function(){return Object.create(this)},s.prototype.toString=function(i){return""},s}(r)}).call(Be)),n2.exports}var D5;function Xn(){return D5||(D5=1,(function(){var r,e,t,n,s,i,o,l,c,u,d,h,f,p,m={}.hasOwnProperty;p=Kl(),f=p.isObject,h=p.isFunction,d=p.isEmpty,u=p.getValue,i=null,r=null,e=null,t=null,n=null,l=null,c=null,o=null,s=null,z1.exports=function(){function g(v){this.parent=v,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.children=[],i||(i=Sv(),r=kv(),e=Cv(),t=Ev(),n=Rv(),l=Pv(),c=Iv(),o=Lv(),s=KC())}return g.prototype.element=function(v,b,y){var w,_,N,S,E,T,D,R,H,A,U;if(T=null,b===null&&y==null&&(H=[{},null],b=H[0],y=H[1]),b==null&&(b={}),b=u(b),f(b)||(A=[b,y],y=A[0],b=A[1]),v!=null&&(v=u(v)),Array.isArray(v))for(N=0,D=v.length;N<D;
1364N++)_=v[N],T=this.element(_);else if(h(v))T=this.element(v.apply());else if(f(v)){for(E in v)if(m.call(v,E))if(U=v[E],h(U)&&(U=U.apply()),f(U)&&d(U)&&(U=null),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&E.indexOf(this.stringify.convertAttKey)===0)T=this.attribute(E.substr(this.stringify.convertAttKey.length),U);else if(!this.options.separateArrayItems&&Array.isArray(U))for(S=0,R=U.length;S<R;S++)_=U[S],w={},w[E]=_,T=this.element(w);else f(U)?(T=this.element(E),T.element(U)):T=this.element(E,U)}else this.options.skipNullNodes&&y===null?T=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&v.indexOf(this.stringify.convertTextKey)===0?T=this.text(y):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&v.indexOf(this.stringify.convertCDataKey)===0?T=this.cdata(y):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&v.indexOf(this.stringify.convertCommentKey)===0?T=this.comment(y):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&v.indexOf(this.stringify.convertRawKey)===0?T=this.raw(y):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&v.indexOf(this.stringify.convertPIKey)===0?T=this.instruction(v.substr(this.stringify.convertPIKey.length),y):T=this.node(v,b,y);if(T==null)throw new Error("Could not create any elements with: "+v+". "+this.debugInfo());return T},g.prototype.insertBefore=function(v,b,y){var w,_,N;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(v));return _=this.parent.children.indexOf(this),N=this.parent.children.splice(_),w=this.parent.element(v,b,y),Array.prototype.push.apply(this.parent.children,N),w},g.prototype.insertAfter=function(v,b,y){var w,_,N;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(v));return _=this.parent.children.indexOf(this),N=this.parent.children.splice(_+1),w=this.parent.element(v,b,y),Array.prototype.push.apply(this.parent.children,N),w},g.prototype.remove=function(){var v;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return v=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[v,v-v+1].concat([])),this.parent},g.prototype.node=function(v,b,y){var w,_;return v!=null&&(v=u(v)),b||(b={}),b=u(b),f(b)||(_=[b,y],y=_[0],b=_[1]),w=new i(this,v,b),y!=null&&w.text(y),this.children.push(w),w},g.prototype.text=function(v){var b;return b=new c(this,v),this.children.push(b),this},g.prototype.cdata=function(v){var b;return b=new r(this,v),this.children.push(b),this},g.prototype.comment=function(v){var b;return b=new e(this,v),this.children.push(b),this},g.prototype.commentBefore=function(v){var b,y;return b=this.parent.children.indexOf(this),y=this.parent.children.splice(b),this.parent.comment(v),Array.prototype.push.apply(this.parent.children,y),this},g.prototype.commentAfter=function(v){var b,y;return b=this.parent.children.indexOf(this),y=this.parent.children.splice(b+1),this.parent.comment(v),Array.prototype.push.apply(this.parent.children,y),this},g.prototype.raw=function(v){var b;return b=new l(this,v),this.children.push(b),this},g.prototype.dummy=function(){var v;return v=new s(this),this.children.push(v),v},g.prototype.instruction=function(v,b){var y,w,_,N,S;if(v!=null&&(v=u(v)),b!=null&&(b=u(b)),Array.isArray(v))for(N=0,S=v.length;N<S;N++)y=v[N],this.instruction(y);else if(f(v))for(y in v)m.call(v,y)&&(w=v[y],this.instruction(y,w));else h(b)&&(b=b.apply()),_=new o(this,v,b),this.children.push(_);return this},g.prototype.instructionBefore=function(v,b){var y,w;return y=this.parent.children.indexOf(this),w=this.parent.children.splice(y),this.parent.instruction(v,b),Array.prototype.push.apply(this.parent.children,w),this},g.prototype.instructionAfter=function(v,b){var y,w;return y=this.parent.children.indexOf(this),w=this.parent.children.splice(y+1),this.parent.instruction(v,b),Array.prototype.push.apply(this.parent.children,w),this},g.prototype.declaration=function(v,b,y){var w,_;return w=this.document(),_=new t(w,v,b,y),w.children[0]instanceof t?w.children[0]=_:w.children.unshift(_),w.root()||w},g.prototype.doctype=function(v,b){var y,w,_,N,S,E,T,D,R,H;for(w=this.document(),_=new n(w,v,b),R=w.children,N=S=0,T=R.length;S<T;N=++S)if(y=R[N],y instanceof n)return w.children[N]=_,_;for(H=w.children,N=E=0,D=H.length;E<D;N=++E)if(y=H[N],y.isRoot)return w.children.splice(N,0,_),_;return w.children.push(_),_},g.prototype.up=function(){if(this.isRoot)throw new Error("The root node has no parent. Use doc() if you need to get the document object.");return this.parent},g.prototype.root=function(){var v;
1364for(v=this;v;){if(v.isDocument)return v.rootObject;if(v.isRoot)return v;v=v.parent}},g.prototype.document=function(){var v;for(v=this;v;){if(v.isDocument)return v;v=v.parent}},g.prototype.end=function(v){return this.document().end(v)},g.prototype.prev=function(){var v;for(v=this.parent.children.indexOf(this);v>0&&this.parent.children[v-1].isDummy;)v=v-1;if(v<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[v-1]},g.prototype.next=function(){var v;for(v=this.parent.children.indexOf(this);v<this.parent.children.length-1&&this.parent.children[v+1].isDummy;)v=v+1;if(v===-1||v===this.parent.children.length-1)throw new Error("Already at the last node. "+this.debugInfo());return this.parent.children[v+1]},g.prototype.importDocument=function(v){var b;return b=v.root().clone(),b.parent=this,b.isRoot=!1,this.children.push(b),this},g.prototype.debugInfo=function(v){var b,y;return v=v||this.name,v==null&&!((b=this.parent)!=null&&b.name)?"":v==null?"parent: <"+this.parent.name+">":(y=this.parent)!=null&&y.name?"node: <"+v+">, parent: <"+this.parent.name+">":"node: <"+v+">"},g.prototype.ele=function(v,b,y){return this.element(v,b,y)},g.prototype.nod=function(v,b,y){return this.node(v,b,y)},g.prototype.txt=function(v){return this.text(v)},g.prototype.dat=function(v){return this.cdata(v)},g.prototype.com=function(v){return this.comment(v)},g.prototype.ins=function(v,b){return this.instruction(v,b)},g.prototype.doc=function(){return this.document()},g.prototype.dec=function(v,b,y){return this.declaration(v,b,y)},g.prototype.dtd=function(v,b){return this.doctype(v,b)},g.prototype.e=function(v,b,y){return this.element(v,b,y)},g.prototype.n=function(v,b,y){return this.node(v,b,y)},g.prototype.t=function(v){return this.text(v)},g.prototype.d=function(v){return this.cdata(v)},g.prototype.c=function(v){return this.comment(v)},g.prototype.r=function(v){return this.raw(v)},g.prototype.i=function(v,b){return this.instruction(v,b)},g.prototype.u=function(){return this.up()},g.prototype.importXMLBuilder=function(v){return this.importDocument(v)},g}()}).call(Be)),z1.exports}var s2={exports:{}},R5;function NO(){return R5||(R5=1,(function(){var r=function(t,n){return function(){return t.apply(n,arguments)}},e={}.hasOwnProperty;s2.exports=function(){function t(n){this.assertLegalChar=r(this.assertLegalChar,this);var s,i,o;n||(n={}),this.noDoubleEncoding=n.noDoubleEncoding,i=n.stringify||{};for(s in i)e.call(i,s)&&(o=i[s],this[s]=o)}return t.prototype.eleName=function(n){return n=""+n||"",this.assertLegalChar(n)},t.prototype.eleText=function(n){return n=""+n||"",this.assertLegalChar(this.elEscape(n))},t.prototype.cdata=function(n){return n=""+n||"",n=n.replace("]]>","]]]]><![CDATA[>"),this.assertLegalChar(n)},t.prototype.comment=function(n){if(n=""+n||"",n.match(/--/))throw new Error("Comment text cannot contain double-hypen: "+n);return this.assertLegalChar(n)},t.prototype.raw=function(n){return""+n||""},t.prototype.attName=function(n){return n=""+n||""},t.prototype.attValue=function(n){return n=""+n||"",this.attEscape(n)},t.prototype.insTarget=function(n){return""+n||""},t.prototype.insValue=function(n){if(n=""+n||"",n.match(/\?>/))throw new Error("Invalid processing instruction value: "+n);return n},t.prototype.xmlVersion=function(n){if(n=""+n||"",!n.match(/1\.[0-9]+/))throw new Error("Invalid version number: "+n);return n},t.prototype.xmlEncoding=function(n){if(n=""+n||"",!n.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+n);return n},t.prototype.xmlStandalone=function(n){return n?"yes":"no"},t.prototype.dtdPubID=function(n){return""+n||""},t.prototype.dtdSysID=function(n){return""+n||""},t.prototype.dtdElementValue=function(n){return""+n||""},t.prototype.dtdAttType=function(n){return""+n||""},t.prototype.dtdAttDefault=function(n){return n!=null?""+n||"":n},t.prototype.dtdEntityValue=function(n){return""+n||""},t.prototype.dtdNData=function(n){return""+n||""},t.prototype.convertAttKey="@",t.prototype.convertPIKey="?",t.prototype.convertTextKey="#text",t.prototype.convertCDataKey="#cdata",t.prototype.convertCommentKey="#comment",t.prototype.convertRawKey="#raw",t.prototype.assertLegalChar=function(n){var s;if(s=n.match(/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/),s)throw new Error("Invalid character in string: "+n+" at index "+s.index);return n},t.prototype.elEscape=function(n){var s;return s=this.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,n.replace(s,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r/g,"&#xD;")},t.prototype.attEscape=function(n){var s;return s=this.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,n.replace(s,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;")},t}()}).call(Be)),s2.exports}var i2={exports:{}},a2={exports:{}},P5;function SO(){return P5||(P5=1,(function(){var r={}.hasOwnProperty;a2.exports=function(){function e(t){var n,s,i,o,l,c,u,d,h;t||(t={}),this.pretty=t.pretty||!1,this.allowEmpty=(s=t.allowEmpty)!=null?s:!1,this.pretty?(this.indent=(i=t.indent)!=null?i:"  ",this.newline=(o=t.newline)!=null?o:`
1365`,this.offset=(l=t.offset)!=null?l:0,this.dontprettytextnodes=(c=t.dontprettytextnodes)!=null?c:0):(this.indent="",this.newline="",this.offset=0,this.dontprettytextnodes=0),this.spacebeforeslash=(u=t.spacebeforeslash)!=null?u:"",this.spacebeforeslash===!0&&(this.spacebeforeslash=" "),this.newlinedefault=this.newline,this.prettydefault=this.pretty,d=t.writer||{};for(n in d)r.call(d,n)&&(h=d[n],this[n]=h)}return e.prototype.set=function(t){var n,s,i;t||(t={}),"pretty"in t&&(this.pretty=t.pretty),"allowEmpty"in t&&(this.allowEmpty=t.allowEmpty),this.pretty?(this.indent="indent"in t?t.indent:"  ",this.newline="newline"in t?t.newline:`
1366`,this.offset="offset"in t?t.offset:0,this.dontprettytextnodes="dontprettytextnodes"in t?t.dontprettytextnodes:0):(this.indent="",this.newline="",this.offset=0,this.dontprettytextnodes=0),this.spacebeforeslash="spacebeforeslash"in t?t.spacebeforeslash:"",this.spacebeforeslash===!0&&(this.spacebeforeslash=" "),this.newlinedefault=this.newline,this.prettydefault=this.pretty,s=t.writer||{};for(n in s)r.call(s,n)&&(i=s[n],this[n]=i);return this},e.prototype.space=function(t){var n;return this.pretty?(n=(t||0)+this.offset+1,n>0?new Array(n).join(this.indent):""):""},e}()}).call(Be)),a2.exports}var I5;function JC(){return I5||(I5=1,(function(){var r,e,t,n,s,i,o,l,c,u,d,h,f,p,m=function(v,b){for(var y in b)g.call(b,y)&&(v[y]=b[y]);function w(){this.constructor=v}return w.prototype=b.prototype,v.prototype=new w,v.__super__=b.prototype,v},g={}.hasOwnProperty;o=Ev(),l=Rv(),r=kv(),e=Cv(),u=Sv(),h=Pv(),f=Iv(),d=Lv(),c=KC(),t=jv(),n=Tv(),s=Av(),i=Dv(),p=SO(),i2.exports=function(v){m(b,v);function b(y){b.__super__.constructor.call(this,y)}return b.prototype.document=function(y){var w,_,N,S,E;for(this.textispresent=!1,S="",E=y.children,_=0,N=E.length;_<N;_++)w=E[_],!(w instanceof c)&&(S+=(function(){switch(!1){case!(w instanceof o):return this.declaration(w);case!(w instanceof l):return this.docType(w);case!(w instanceof e):return this.comment(w);case!(w instanceof d):return this.processingInstruction(w);
1366default:return this.element(w,0)}}).call(this));return this.pretty&&S.slice(-this.newline.length)===this.newline&&(S=S.slice(0,-this.newline.length)),S},b.prototype.attribute=function(y){return" "+y.name+'="'+y.value+'"'},b.prototype.cdata=function(y,w){return this.space(w)+"<![CDATA["+y.text+"]]>"+this.newline},b.prototype.comment=function(y,w){return this.space(w)+"<!-- "+y.text+" -->"+this.newline},b.prototype.declaration=function(y,w){var _;return _=this.space(w),_+='<?xml version="'+y.version+'"',y.encoding!=null&&(_+=' encoding="'+y.encoding+'"'),y.standalone!=null&&(_+=' standalone="'+y.standalone+'"'),_+=this.spacebeforeslash+"?>",_+=this.newline,_},b.prototype.docType=function(y,w){var _,N,S,E,T;if(w||(w=0),E=this.space(w),E+="<!DOCTYPE "+y.root().name,y.pubID&&y.sysID?E+=' PUBLIC "'+y.pubID+'" "'+y.sysID+'"':y.sysID&&(E+=' SYSTEM "'+y.sysID+'"'),y.children.length>0){for(E+=" [",E+=this.newline,T=y.children,N=0,S=T.length;N<S;N++)_=T[N],E+=(function(){switch(!1){case!(_ instanceof t):return this.dtdAttList(_,w+1);case!(_ instanceof n):return this.dtdElement(_,w+1);case!(_ instanceof s):return this.dtdEntity(_,w+1);case!(_ instanceof i):return this.dtdNotation(_,w+1);case!(_ instanceof r):return this.cdata(_,w+1);case!(_ instanceof e):return this.comment(_,w+1);case!(_ instanceof d):return this.processingInstruction(_,w+1);default:throw new Error("Unknown DTD node type: "+_.constructor.name)}}).call(this);E+="]"}return E+=this.spacebeforeslash+">",E+=this.newline,E},b.prototype.element=function(y,w){var _,N,S,E,T,D,R,H,A,U,C,M,L;w||(w=0),L=!1,this.textispresent?(this.newline="",this.pretty=!1):(this.newline=this.newlinedefault,this.pretty=this.prettydefault),M=this.space(w),H="",H+=M+"<"+y.name,A=y.attributes;for(R in A)g.call(A,R)&&(_=A[R],H+=this.attribute(_));if(y.children.length===0||y.children.every(function(B){return B.value===""}))this.allowEmpty?H+="></"+y.name+">"+this.newline:H+=this.spacebeforeslash+"/>"+this.newline;else if(this.pretty&&y.children.length===1&&y.children[0].value!=null)H+=">",H+=y.children[0].value,H+="</"+y.name+">"+this.newline;else{if(this.dontprettytextnodes){for(U=y.children,S=0,T=U.length;S<T;S++)if(N=U[S],N.value!=null){this.textispresent++,L=!0;break}}for(this.textispresent&&(this.newline="",this.pretty=!1,M=this.space(w)),H+=">"+this.newline,C=y.children,E=0,D=C.length;E<D;E++)N=C[E],H+=(function(){switch(!1){case!(N instanceof r):return this.cdata(N,w+1);case!(N instanceof e):return this.comment(N,w+1);case!(N instanceof u):return this.element(N,w+1);case!(N instanceof h):return this.raw(N,w+1);case!(N instanceof f):return this.text(N,w+1);case!(N instanceof d):return this.processingInstruction(N,w+1);case!(N instanceof c):return"";default:throw new Error("Unknown XML node type: "+N.constructor.name)}}).call(this);L&&this.textispresent--,this.textispresent||(this.newline=this.newlinedefault,this.pretty=this.prettydefault),H+=M+"</"+y.name+">"+this.newline}return H},b.prototype.processingInstruction=function(y,w){var _;return _=this.space(w)+"<?"+y.target,y.value&&(_+=" "+y.value),_+=this.spacebeforeslash+"?>"+this.newline,_},b.prototype.raw=function(y,w){return this.space(w)+y.value+this.newline},b.prototype.text=function(y,w){return this.space(w)+y.value+this.newline},b.prototype.dtdAttList=function(y,w){var _;return _=this.space(w)+"<!ATTLIST "+y.elementName+" "+y.attributeName+" "+y.attributeType,y.defaultValueType!=="#DEFAULT"&&(_+=" "+y.defaultValueType),y.defaultValue&&(_+=' "'+y.defaultValue+'"'),_+=this.spacebeforeslash+">"+this.newline,_},b.prototype.dtdElement=function(y,w){return this.space(w)+"<!ELEMENT "+y.name+" "+y.value+this.spacebeforeslash+">"+this.newline},b.prototype.dtdEntity=function(y,w){var _;return _=this.space(w)+"<!ENTITY",y.pe&&(_+=" %"),_+=" "+y.name,y.value?_+=' "'+y.value+'"':(y.pubID&&y.sysID?_+=' PUBLIC "'+y.pubID+'" "'+y.sysID+'"':y.sysID&&(_+=' SYSTEM "'+y.sysID+'"'),y.nData&&(_+=" NDATA "+y.nData)),_+=this.spacebeforeslash+">"+this.newline,_},b.prototype.dtdNotation=function(y,w){var _;return _=this.space(w)+"<!NOTATION "+y.name,y.pubID&&y.sysID?_+=' PUBLIC "'+y.pubID+'" "'+y.sysID+'"':y.pubID?_+=' PUBLIC "'+y.pubID+'"':y.sysID&&(_+=' SYSTEM "'+y.sysID+'"'),_+=this.spacebeforeslash+">"+this.newline,_},b.prototype.openNode=function(y,w){var _,N,S,E;if(w||(w=0),y instanceof u){S=this.space(w)+"<"+y.name,E=y.attributes;for(N in E)g.call(E,N)&&(_=E[N],S+=this.attribute(_));return S+=(y.children?">":"/>")+this.newline,S}else return S=this.space(w)+"<!DOCTYPE "+y.rootNodeName,y.pubID&&y.sysID?S+=' PUBLIC "'+y.pubID+'" "'+y.sysID+'"':y.sysID&&(S+=' SYSTEM "'+y.sysID+'"'),S+=(y.children?" [":">")+this.newline,S},b.prototype.closeNode=function(y,w){switch(w||(w=0),!1){case!(y instanceof u):return this.space(w)+"</"+y.name+">"+this.newline;case!(y instanceof l):return this.space(w)+"]>"+this.newline}},b}(p)}).call(Be)),i2.exports}var L5;function sK(){return L5||(L5=1,(function(){var r,e,t,n,s=function(o,l){for(var c in l)i.call(l,c)&&(o[c]=l[c]);function u(){this.constructor=o}return u.prototype=l.prototype,o.prototype=new u,o.__super__=l.prototype,o},i={}.hasOwnProperty;n=Kl().isPlainObject,r=Xn(),t=NO(),e=JC(),H1.exports=function(o){s(l,o);function l(c){l.__super__.constructor.call(this,null),this.name="?xml",c||(c={}),c.writer||(c.writer=new e),this.options=c,this.stringify=new t(c),this.isDocument=!0}return l.prototype.end=function(c){var u;return c?n(c)&&(u=c,c=this.options.writer.set(u)):c=this.options.writer,c.document(this)},l.prototype.toString=function(c){return this.options.writer.set(c).document(this)},l}(r)}).call(Be)),H1.exports}var o2={exports:{}},O5;function iK(){return O5||(O5=1,(function(){var r,e,t,n,s,i,o,l,c,u,d,h,f,p,m,g,v,b,y,w,_={}.hasOwnProperty;w=Kl(),b=w.isObject,v=w.isFunction,y=w.isPlainObject,g=w.getValue,u=Sv(),e=kv(),t=Cv(),h=Pv(),m=Iv(),d=Lv(),l=Ev(),c=Rv(),n=jv(),i=Av(),s=Tv(),o=Dv(),r
1366=_O(),p=NO(),f=JC(),o2.exports=function(){function N(S,E,T){var D;this.name="?xml",S||(S={}),S.writer?y(S.writer)&&(D=S.writer,S.writer=new f(D)):S.writer=new f(S),this.options=S,this.writer=S.writer,this.stringify=new p(S),this.onDataCallback=E||function(){},this.onEndCallback=T||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return N.prototype.node=function(S,E,T){var D,R;if(S==null)throw new Error("Missing node name.");if(this.root&&this.currentLevel===-1)throw new Error("Document can only have one root node. "+this.debugInfo(S));return this.openCurrent(),S=g(S),E===null&&T==null&&(D=[{},null],E=D[0],T=D[1]),E==null&&(E={}),E=g(E),b(E)||(R=[E,T],T=R[0],E=R[1]),this.currentNode=new u(this,S,E),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,T!=null&&this.text(T),this},N.prototype.element=function(S,E,T){return this.currentNode&&this.currentNode instanceof c?this.dtdElement.apply(this,arguments):this.node(S,E,T)},N.prototype.attribute=function(S,E){var T,D;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(S));if(S!=null&&(S=g(S)),b(S))for(T in S)_.call(S,T)&&(D=S[T],this.attribute(T,D));else v(E)&&(E=E.apply()),(!this.options.skipNullAttributes||E!=null)&&(this.currentNode.attributes[S]=new r(this,S,E));return this},N.prototype.text=function(S){var E;return this.openCurrent(),E=new m(this,S),this.onData(this.writer.text(E,this.currentLevel+1),this.currentLevel+1),this},N.prototype.cdata=function(S){var E;return this.openCurrent(),E=new e(this,S),this.onData(this.writer.cd
1366ata(E,this.currentLevel+1),this.currentLevel+1),this},N.prototype.comment=function(S){var E;return this.openCurrent(),E=new t(this,S),this.onData(this.writer.comment(E,this.currentLevel+1),this.currentLevel+1),this},N.prototype.raw=function(S){var E;return this.openCurrent(),E=new h(this,S),this.onData(this.writer.raw(E,this.currentLevel+1),this.currentLevel+1),this},N.prototype.instruction=function(S,E){var T,D,R,H,A;if(this.openCurrent(),S!=null&&(S=g(S)),E!=null&&(E=g(E)),Array.isArray(S))for(T=0,H=S.length;T<H;T++)D=S[T],this.instruction(D);else if(b(S))for(D in S)_.call(S,D)&&(R=S[D],this.instruction(D,R));else v(E)&&(E=E.apply()),A=new d(this,S,E),this.onData(this.writer.processingInstruction(A,this.currentLevel+1),this.currentLevel+1);return this},N.prototype.declaration=function(S,E,T){var D;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return D=new l(this,S,E,T),this.onData(this.writer.declaration(D,this.currentLevel+1),this.currentLevel+1),this},N.prototype.doctype=function(S,E,T){if(this.openCurrent(),S==null)throw new Error("Missing root node name.");if(this.root)throw new Error("dtd() must come before the root node.");return this.currentNode=new c(this,E,T),this.currentNode.rootNodeName=S,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},N.prototype.dtdElement=function(S,E){var T;return this.openCurrent(),T=new s(this,S,E),this.onData(this.writer.dtdElement(T,this.currentLevel+1),this.currentLevel+1),this},N.prototype.attList=function(S,E,T,D,R){var H;return this.openCurrent(),H=new n(this,S,E,T,D,R),this.onData(this.writer.dtdAttList(H,this.currentLevel+1),this.currentLevel+1),this},N.prototype.entity=function(S,E){var T;return this.openCurrent(),T=new i(this,!1,S,E),this.onData(this.writer.dtdEntity(T,this.currentLevel+1),this.currentLevel+1),this},N.prototype.pEntity=function(S,E){var T;return this.openCurrent(),T=new i(this,!0,S,E),this.onData(this.writer.dtdEntity(T,this.currentLevel+1),this.currentLevel+1),this},N.prototype.notation=function(S,E){var T;return this.openCurrent(),T=new o(this,S,E),this.onData(this.writer.dtdNotation(T,this.currentLevel+1),this.currentLevel+1),this},N.prototype.up=function(){if(this.currentLevel<0)throw new Error("The document node has no parent.");return this.currentNode?(this.currentNode.children?this.closeNode(this.currentNode):this.openNode(this.currentNode),this.currentNode=null):this.closeNode(this.openTags[this.currentLevel]),delete this.openTags[this.currentLevel],this.currentLevel--,this},N.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},N.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},N.prototype.openNode=function(S){if(!S.isOpen)return!this.root&&this.currentLevel===0&&S instanceof u&&(this.root=S),this.onData(this.writer.openNode(S,this.currentLevel),this.currentLevel),S.isOpen=!0},N.prototype.closeNode=function(S){if(!S.isClosed)return this.onData(this.writer.closeNode(S,this.currentLevel),this.currentLevel),S.isClosed=!0},N.prototype.onData=function(S,E){return this.documentStarted=!0,this.onDataCallback(S,E+1)},N.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},N.prototype.debugInfo=function(S){return S==null?"":"node: <"+S+">"},N.prototype.ele=function(){return this.element.apply(this,arguments)},N.prototype.nod=function(S,E,T){return this.node(S,E,T)},N.prototype.txt=function(S){return this.text(S)},N.prototype.dat=function(S){return this.cdata(S)},N.prototype.com=function(S){return this.comment(S)},N.prototype.ins=function(S,E){return this.instruction(S,E)},N.prototype.dec=function(S,E,T){return this.declaration(S,E,T)},N.prototype.dtd=function(S,E,T){return this.doctype(S,E,T)},N.prototype.e=function(S,E,T){return this.element(S,E,T)},N.prototype.n=function(S,E,T){return this.node(S,E,T)},N.prototype.t=function(S){return this.text(S)},N.prototype.d=function(S){return this.cdata(S)},N.prototype.c=function(S){return this.comment(S)},N.prototype.r=function(S){return this.raw(S)},N.prototype.i=function(S,E){return this.instruction(S,E)},N.prototype.att=function(){return this.currentNode&&this.currentNode instanceof c?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},N.prototype.a=function(){return this.currentNode&&this.currentNode instanceof c?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},N.prototype.ent=function(S,E){return this.entity(S,E)},N.prototype.pent=function(S,E){return this.pEntity(S,E)},N.prototype.not=function(S,E){return this.notation(S,E)},N}()}).call(Be)),o2.exports}var l2={exports:{}},M5;function aK(){return M5||(M5=1,(function(){var r,e,t,n,s,i,o,l,c,u,d,h,f,p,m=function(v,b){for(var y in b)g.call(b,y)&&(v[y]=b[y]);function w(){this.constructor=v}return w.prototype=b.prototype,v.prototype=new w,v.__super__=b.prototype,v},g={}.hasOwnProperty;o=Ev(),l=Rv(),r=kv(),e=Cv(),u=Sv(),h=Pv(),f=Iv(),d=Lv(),c=KC(),t=jv(),n=Tv(),s=Av(),i=Dv(),p=SO(),l2.exports=function(v){m(b,v);function b(y,w){b.__super__.constructor.call(this,w),this.stream=y}return b.prototype.document=function(y){var w,_,N,S,E,T,D,R;for(T=y.children,_=0,S=T.length;_<S;_++)w=T[_],w.isLastRootNode=!1;for(y.children[y.children.length-1].isLastRootNode=!0,D=y.children,R=[],N=0,E=D.length;N<E;N++)if(w=D[N],!(w instanceof c))switch(!1){case!(w instanceof o):R.push(this.declaration(w));break;case!(w instanceof l):R.push(this.docType(w));break;case!(w instanceof e):R.push(this.comment(w));break;case!(w instanceof d):R.push(this.processingInstruction(w));break;
1366default:R.push(this.element(w))}return R},b.prototype.attribute=function(y){return this.stream.write(" "+y.name+'="'+y.value+'"')},b.prototype.cdata=function(y,w){return this.stream.write(this.space(w)+"<![CDATA["+y.text+"]]>"+this.endline(y))},b.prototype.comment=function(y,w){return this.stream.write(this.space(w)+"<!-- "+y.text+" -->"+this.endline(y))},b.prototype.declaration=function(y,w){return this.stream.write(this.space(w)),this.stream.write('<?xml version="'+y.version+'"'),y.encoding!=null&&this.stream.write(' encoding="'+y.encoding+'"'),y.standalone!=null&&this.stream.write(' standalone="'+y.standalone+'"'),this.stream.write(this.spacebeforeslash+"?>"),this.stream.write(this.endline(y))},b.prototype.docType=function(y,w){var _,N,S,E;if(w||(w=0),this.stream.write(this.space(w)),this.stream.write("<!DOCTYPE "+y.root().name),y.pubID&&y.sysID?this.stream.write(' PUBLIC "'+y.pubID+'" "'+y.sysID+'"'):y.sysID&&this.stream.write(' SYSTEM "'+y.sysID+'"'),y.children.length>0){for(this.stream.write(" ["),this.stream.write(this.endline(y)),E=y.children,N=0,S=E.length;N<S;N++)switch(_=E[N],!1){case!(_ instanceof t):this.dtdAttList(_,w+1);break;case!(_ instanceof n):this.dtdElement(_,w+1);break;case!(_ instanceof s):this.dtdEntity(_,w+1);break;case!(_ instanceof i):this.dtdNotation(_,w+1);break;case!(_ instanceof r):this.cdata(_,w+1);break;case!(_ instanceof e):this.comment(_,w+1);break;case!(_ instanceof d):this.processingInstruction(_,w+1);break;default:throw new Error("Unknown DTD node type: "+_.constructor.name)}this.stream.write("]")}return this.stream.write(this.spacebeforeslash+">"),this.stream.write(this.endline(y))},b.prototype.element=function(y,w){var _,N,S,E,T,D,R,H;w||(w=0),H=this.space(w),this.stream.write(H+"<"+y.name),D=y.attributes;for(T in D)g.call(D,T)&&(_=D[T],this.attribute(_));if(y.children.length===0||y.children.every(function(A){return A.value===""}))this.allowEmpty?this.stream.write("></"+y.name+">"):this.stream.write(this.spacebeforeslash+"/>");else if(this.pretty&&y.children.length===1&&y.children[0].value!=null)this.stream.write(">"),this.stream.write(y.children[0].value),this.stream.write("</"+y.name+">");else{for(this.stream.write(">"+this.newline),R=y.children,S=0,E=R.length;S<E;S++)switch(N=R[S],!1){case!(N instanceof r):this.cdata(N,w+1);break;case!(N instanceof e):this.comment(N,w+1);break;case!(N instanceof u):this.element(N,w+1);break;case!(N instanceof h):this.raw(N,w+1);break;case!(N instanceof f):this.text(N,w+1);break;case!(N instanceof d):this.processingInstruction(N,w+1);break;case!(N instanceof c):break;default:throw new Error("Unknown XML node type: "+N.constructor.name)}this.stream.write(H+"</"+y.name+">")}return this.stream.write(this.endline(y))},b.prototype.processingInstruction=function(y,w){return this.stream.write(this.space(w)+"<?"+y.target),y.value&&this.stream.write(" "+y.value),this.stream.write(this.spacebeforeslash+"?>"+this.endline(y))},b.prototype.raw=function(y,w){return this.stream.write(this.space(w)+y.value+this.endline(y))},b.prototype.text=function(y,w){return this.stream.write(this.space(w)+y.value+this.endline(y))},b.prototype.dtdAttList=function(y,w){return this.stream.write(this.space(w)+"<!ATTLIST "+y.elementName+" "+y.attributeName+" "+y.attributeType),y.defaultValueType!=="#DEFAULT"&&this.stream.write(" "+y.defaultValueType),y.defaultValue&&this.stream.write(' "'+y.defaultValue+'"'),this.stream.write(this.spacebeforeslash+">"+this.endline(y))},b.prototype.dtdElement=function(y,w){return this.stream.write(this.space(w)+"<!ELEMENT "+y.name+" "+y.value),this.stream.write(this.spacebeforeslash+">"+this.endline(y))},b.prototype.dtdEntity=function(y,w){return this.stream.write(this.space(w)+"<!ENTITY"),y.pe&&this.stream.write(" %"),this.stream.write(" "+y.name),y.value?this.stream.write(' "'+y.value+'"'):(y.pubID&&y.sysID?this.stream.write(' PUBLIC "'+y.pubID+'" "'+y.sysID+'"'):y.sysID&&this.stream.write(' SYSTEM "'+y.sysID+'"'),y.nData&&this.stream.write(" NDATA "+y.nData)),this.stream.write(this.spacebeforeslash+">"+this.endline(y))},b.prototype.dtdNotation=function(y,w){return this.stream.write(this.space(w)+"<!NOTATION "+y.name),y.pubID&&y.sysID?this.stream.write(' PUBLIC "'+y.pubID+'" "'+y.sysID+'"'):y.pubID?this.stream.write(' PUBLIC "'+y.pubID+'"'):y.sysID&&this.stream.write(' SYSTEM "'+y.sysID+'"'),this.stream.write(this.spacebeforeslash+">"+this.endline(y))},b.prototype.endline=function(y){return y.isLastRootNode?"":this.newline},b}(p)}).call(Be)),l2.exports}(function(){var r,e,t,n,s,i,o;o=Kl(),s=o.assign,i=o.isFunction,r=sK(),e=iK(),n=JC(),t=aK(),fp.create=function(l,c,u,d){var h,f;if(l==null)throw new Error("Root element needs a name.");return d=s({}
1366,c,u,d),h=new r(d),f=h.element(l),d.headless||(h.declaration(d),(d.pubID!=null||d.sysID!=null)&&h.doctype(d)),f},fp.begin=function(l,c,u){var d;return i(l)&&(d=[l,c],c=d[0],u=d[1],l={}),c?new e(l,c,u):new r(l)},fp.stringWriter=function(l){return new n(l)},fp.streamWriter=function(l,c){return new t(l,c)}}).call(Be);var F5=er,oK=fp;wO.writeString=lK;function lK(r,e){var t=F5.invert(e),n={element:i,text:cK};function s(c,u){return n[u.type](c,u)}function i(c,u){var d=c.element(o(u.name),u.attributes);u.children.forEach(function(h){s(d,h)})}function o(c){var u=/^\{(.*)\}(.*)$/.exec(c);if(u){var d=t[u[1]];return d+(d===""?"":":")+u[2]}else return c}function l(c){var u=oK.create(o(c.name),{version:"1.0",encoding:"UTF-8",standalone:!0});return F5.forEach(e,function(d,h){var f="xmlns"+(h===""?"":":"+h);u.attribute(f,d)}),c.children.forEach(function(d){s(u,d)}),u.end()}return l(r)}function cK(r,e){r.text(e.value)}var Ov=Af;So.Element=Ov.Element;So.element=Ov.element;So.emptyElement=Ov.emptyElement;So.text=Ov.text;So.readString=W8.readString;So.writeString=wO.writeString;var uK=er,dK=Tr,hK=So;LC.read=kO;LC.readXmlFromZipFile=pK;var fK={"http://schemas.openxmlformats.org/wordprocessingml/2006/main":"w","http://schemas.openxmlformats.org/officeDocument/2006/relationships":"r","http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing":"wp","http://schemas.openxmlformats.org/drawingml/2006/main":"a","http://schemas.openxmlformats.org/drawingml/2006/picture":"pic","http://purl.oclc.org/ooxml/wordprocessingml/main":"w","http://purl.oclc.org/ooxml/officeDocument/relationships":"r","http://purl.oclc.org/ooxml/drawingml/wordprocessingDrawing":"wp","http://purl.oclc.org/ooxml/drawingml/main":"a","http://purl.oclc.org/ooxml/drawingml/picture":"pic","http://schemas.openxmlformats.org/package/2006/content-types":"content-types","http://schemas.openxmlformats.org/package/2006/relationships":"relationships","http://schemas.openxmlformats.org/markup-compatibility/2006":"mc","urn:schemas-microsoft-com:vml":"v","urn:schemas-microsoft-com:office:word":"office-word","http://schemas.microsoft.com/office/word/2010/wordml":"wordml"};function kO(r){return hK.readString(r,fK).then(function(e){return CO(e)[0]})}function pK(r,e){return r.exists(e)?r.read(e,"utf-8").then(mK).then(kO):dK.resolve(null)}function mK(r){return r.replace(/^\uFEFF/g,"")}function CO(r){return r.type==="element"?r.name==="mc:AlternateContent"?r.firstOrEmpty("mc:Fallback").children:(r.children=uK.flatten(r.children.map(CO,!0)),[r]):[r]}var ZC={},Al={},QC={};Object.defineProperty(QC,"__esModule",{value:!0});var gK={SYMBOL:{32:32,33:33,34:8704,35:35,36:8707,37:37,38:38,39:8717,40:40,41:41,42:42,43:43,44:44,45:8722,46:46,47:47,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,58:58,59:59,60:60,61:61,62:62,63:63,64:8773,65:913,66:914,67:935,68:916,69:917,70:934,71:915,72:919,73:921,74:977,75:922,76:923,77:924,78:925,79:927,80:928,81:920,82:929,83:931,84:932,85:933,86:962,87:937,88:926,89:936,90:918,91:91,92:8756,93:93,94:8869,95:95,96:8254,97:945,98:946,99:967,100:948,101:949,102:966,103:947,104:951,105:953,106:981,107:954,108:955,109:956,110:957,111:959,112:960,113:952,114:961,115:963,116:964,117:965,118:982,119:969,120:958,121:968,122:950,123:123,124:124,125:125,126:126,160:8364,161:978,162:8242,163:8804,164:8260,165:8734,166:402,167:9827,168:9830,169:9829,170:9824,171:8596,172:8592,173:8593,174:8594,175:8595,176:176,177:177,178:8243,179:8805,180:215,181:8733,182:8706,183:8226,184:247,185:8800,186:8801,187:8776,188:8230,189:9168,190:9135,191:8629,192:8501,193:8465,194:8476,195:8472,196:8855,197:8853,198:8709,199:8745,200:8746,201:8835,202:8839,203:8836,204:8834,205:8838,206:8712,207:8713,208:8736,209:8711,210:174,211:169,212:8482,213:8719,214:8730,215:8901,216:172,217:8743,218:8744,219:8660,220:8656,221:8657,222:8658,223:8659,224:9674,225:12296,226:174,227:169,228:8482,229:8721,230:9115,231:9116,232:9117,233:9121,234:9122,235:9123,236:9127,237:9128,238:9129,239:9130,240:63743,241:12297,242:8747,243:8992,244:9134,245:8993,246:9118,247:9119,248:9120,249:9124,250:9125,251:9126,252:9131,253:9132,254:9133},WEBDINGS:{32:32,33:128375,34:128376,35:128370,36:128374,37:127942,38:127894,39:128391,40:128488,41:128489,42:128496,43:128497,44:127798,45:127895,46:128638,47:128636,48:128469,49:128470,50:128471,51:9204,52:9205,53:9206,54:9207,55:9194,56:9193,57:9198,58:9197,59:9208,60:9209,61:9210,62:128474,63:128499,64:128736,65:127959,66:127960,67:127961,68:127962,69:127964,70:127981,71:127963,72:127968,73:127958,74:127965,75:128739,76:128269,77:127956,78:128065,79:128066,80:127966,81:127957,82:128740,83:127967,84:128755,85:128364,86:128363,87:128360,88:128264,89:127892,90:127893,91:128492,92:128637,93:128493,94:128490,95:128491,96:11156,97:10004,98:128690,99:11036,100:128737,101:128230,102:128753,103:11035,104:128657,105:128712,106:128745,107:128752,108:128968,109:128372,110:11044,111:128741,112:128660,113:128472,114:128473,115:10067,116:128754,117:128647,118:128653,119:9971,12
13660:10680,121:8854,122:128685,123:128494,124:9168,125:128495,126:128498,128:128697,129:128698,130:128713,131:128714,132:128700,133:128125,134:127947,135:9975,136:127938,137:127948,138:127946,139:127940,140:127949,141:127950,142:128664,143:128480,144:128738,145:128176,146:127991,147:128179,148:128106,149:128481,150:128482,151:128483,152:10031,153:128388,154:128389,155:128387,156:128390,157:128441,158:128442,159:128443,160:128373,161:128368,162:128445,163:128446,164:128203,165:128466,166:128467,167:128366,168:128218,169:128478,170:128479,171:128451,172:128450,173:128444,174:127917,175:127900,176:127896,177:127897,178:127911,179:128191,180:127902,181:128247,182:127903,183:127916,184:128253,185:128249,186:128254,187:128251,188:127898,189:127899,190:128250,191:128187,192:128421,193:128422,194:128423,195:128377,196:127918,197:128379,198:128380,199:128223,200:128385,201:128384,202:128424,203:128425,204:128447,205:128426,206:128476,207:128274,208:128275,209:128477,210:128229,211:128228,212:128371,213:127779,214:127780,215:127781,216:127782,217:9729,218:127784,219:127783,220:127785,221:127786,222:127788,223:127787,224:127772,225:127777,226:128715,227:128719,228:127869,229:127864,230:128718,231:128717,232:9413,233:9855,234:128710,235:128392,236:127891,237:128484,238:128485,239:128486,240:128487,241:128746,242:128063,243:128038,244:128031,245:128021,246:128008,247:128620,248:128622,249:128621,250:128623,251:128506,252:127757,253:127759,254:127758,255:128330},WINGDINGS:{32:32,33:128393,34:9986,35:9985,36:128083,37:128365,38:128366,39:128367,40:128383,41:9990,42:128386,43:128387,44:128234,45:128235,46:128236,47:128237,48:128448,49:128449,50:128462,51:128463,52:128464,53:128452,54:8987,55:128430,56:128432,57:128434,58:128435,59:128436,60:128427,61:128428,62:9991,63:9997,64:128398,65:9996,66:128399,67:128077,68:128078,69:9756,70:9758,71:9757,72:9759,73:128400,74:9786,75:128528,76:9785,77:128163,78:128369,79:127987,80:127985,81:9992,82:9788,83:127778,84:10052,85:128326,86:10014,87:128328,88:10016,89:10017,90:9770,91:9775,92:128329,93:9784,94:9800,95:9801,96:9802,97:9803,98:9804,99:9805,100:9806,101:9807,102:9808,103:9809,104:9810,105:9811,106:128624,107:128629,108:9899,109:128318,110:9724,111:128911,112:128912,113:10065,114:10066,115:128927,116:10731,117:9670,118:10070,119:11049,120:8999,121:11193,122:8984,123:127989,124:127990,125:128630,126:128631,127:9647,128:127243,129:10112,130:10113,131:10114,132:10115,133:10116,134:10117,135:10118,136:10119,137:10120,138:10121,139:127244,140:10122,141:10123,142:10124,143:10125,144:10126,145:10127,146:10128,147:10129,148:10130,149:10131,150:128610,151:128608,152:128609,153:128611,154:128606,155:128604,156:128605,157:128607,158:8729,159:8226,160:11037,161:11096,162:128902,163:128904,164:128906,165:128907,166:128319,167:9642,168:128910,169:128961,170:128965,171:9733,172:128971,173:128975,174:128979,175:128977,176:11216,177:8982,178:11214,179:11215,180:11217,181:10026,182:10032,183:128336,184:128337,185:128338,186:128339,187:128340,188:128341,189:128342,190:128343,191:128344,192:128345,193:128346,194:128347,195:11184,196:11185,197:11186,198:11187,199:11188,200:11189,201:11190,202:11191,203:128618,204:128619,205:128597,206:128596,207:128599,208:128598,209:128592,210:128593,211:128594,212:128595,213:9003,214:8998,215:11160,216:11162,217:11161,218:11163,219:11144,220:11146,221:11145,222:11147,223:129128,224:129130,225:129129,226:129131,227:129132,228:129133,229:129135,230:129134,231:129144,232:129146,233:129145,234:129147,235:129148,236:129149,237:129151,238:129150,239:8678,240:8680,241:8679,242:8681,243:11012,244:8691,245:11009,246:11008,247:11011,248:11010,249:129196,250:129197,251:128502,252:10003,253:128503,254:128505},"WINGDINGS 2":{32:32,33:128394,34:128395,35:128396,36:128397,37:9988,38:9984,39:128382,40:128381,41:128453,42:128454,43:128455,44:128456,45:128457,46:128458,47:128459,48:128460,49:128461,50:128203,51:128465,52:128468,53:128437,54:128438,55:128439,56:128440,57:128429,58:128431,59:128433,60:128402,61:128403,62:128408,63:128409,64:128410,65:128411,66:128072,67:128073,68:128412,69:128413,70:128414,71:128415,72:128416,73:128417,74:128070,75:128071,76:128418,77:128419,78:128401,79:128500,80:128504,81:128501,82:9745,83:11197,84:9746,85:11198,86:11199,87:128711,88:10680,89:128625,90:128628,91:128626,92:128627,93:8253,94:128633,95:128634,96:128635,97:128614,98:128612,99:128613,100:128615,101:128602,102:128600,103:128601,104:128603,105:9450,106:9312,107:9313,108:9314,109:9315,110:9316,111:9317,112:9318,113:9319,114:9320,115:9321,116:9471,117:10102,118:10103,119:10104,120:10105,121:10106,122:10107,123:10108,124:10109,125:10110,126:10111,128:9737,129:127765,130:9789,131:9790,132:11839,133:10013,134:128327,135:128348,136:128349,137:128350,138:128351,139:128352,140:128353,141:128354,142:128355,143:128356,144:128357,145:128358,146:128359,147:128616,148:128617,149:8901,150:128900,151:10625,152:9679,153:9675,154:128901,155:128903,156:128905,157:885
13667,158:10687,159:128908,160:128909,161:9726,162:9632,163:9633,164:128913,165:128914,166:128915,167:128916,168:9635,169:128917,170:128918,171:128919,172:128920,173:11049,174:11045,175:9671,176:128922,177:9672,178:128923,179:128924,180:128925,181:128926,182:11050,183:11047,184:9674,185:128928,186:9686,187:9687,188:11210,189:11211,190:11200,191:11201,192:11039,193:11202,194:11043,195:11042,196:11203,197:11204,198:128929,199:128930,200:128931,201:128932,202:128933,203:128934,204:128935,205:128936,206:128937,207:128938,208:128939,209:128940,210:128941,211:128942,212:128943,213:128944,214:128945,215:128946,216:128947,217:128948,218:128949,219:128950,220:128951,221:128952,222:128953,223:128954,224:128955,225:128956,226:128957,227:128958,228:128959,229:128960,230:128962,231:128964,232:128966,233:128969,234:128970,235:10038,236:128972,237:128974,238:128976,239:128978,240:10041,241:128963,242:128967,243:10031,244:128973,245:128980,246:11212,247:11213,248:8251,249:8258},"WINGDINGS 3":{32:32,33:11104,34:11106,35:11105,36:11107,37:11110,38:11111,39:11113,40:11112,41:11120,42:11122,43:11121,44:11123,45:11126,46:11128,47:11131,48:11133,49:11108,50:11109,51:11114,52:11116,53:11115,54:11117,55:11085,56:11168,57:11169,58:11170,59:11171,60:11172,61:11173,62:11174,63:11175,64:11152,65:11153,66:11154,67:11155,68:11136,69:11139,70:11134,71:11135,72:11140,73:11142,74:11141,75:11143,76:11151,77:11149,78:11150,79:11148,80:11118,81:11119,82:9099,83:8996,84:8963,85:8997,86:9251,87:9085,88:8682,89:11192,90:129184,91:129185,92:129186,93:129187,94:129188,95:129189,96:129190,97:129191,98:129192,99:129193,100:129194,101:129195,102:129104,103:129106,104:129105,105:129107,106:129108,107:129109,108:129111,109:129110,110:129112,111:129113,112:9650,113:9660,114:9651,115:9661,116:9664,117:9654,118:9665,119:9655,120:9699,121:9698,122:9700,123:9701,124:128896,125:128898,126:128897,128:128899,129:11205,130:11206,131:11207,132:11208,133:11164,134:11166,135:11165,136:11167,137:129040,138:129042,139:129041,140:129043,141:129044,142:129046,143:129045,144:129047,145:129048,146:129050,147:129049,148:129051,149:129052,150:129054,151:129053,152:129055,153:129024,154:129026,155:129025,156:129027,157:129028,158:129030,159:129029,160:129031,161:129032,162:129034,163:129033,164:129035,165:129056,166:129058,167:129060,168:129062,169:129064,170:129066,171:129068,172:129180,173:129181,174:129182,175:129183,176:129070,177:129072,178:129074,179:129076,180:129078,181:129080,182:129082,183:129081,184:129083,185:129176,186:129178,187:129177,188:129179,189:129084,190:129086,191:129085,192:129087,193:129088,194:129090,195:129089,196:129091,197:129092,198:129094,199:129093,200:129095,201:11176,202:11177,203:11178,204:11179,205:11180,206:11181,207:11182,208:11183,209:129120,210:129122,211:129121,212:129123,213:129124,214:129125,215:129127,216:129126,217:129136,218:129138,219:129137,220:129139,221:129140,222:129141,223:129143,224:129142,225:129152,226:129154,227:129153,228:129155,229:129156,230:129157,231:129159,232:129158,233:129168,234:129170,235:129169,236:129171,237:129172,238:129174,239:129173,240:129175}};QC.default=gK;var yK=Be&&Be.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Al,"__esModule",{value:!0});Al.hex=Al.dec=Al.codePoint=void 0;var bK=yK(QC),xK=String.fromCodePoint?String.fromCodePoint:_K;function eE(r,e){var t=bK.default[r.toUpperCase()];if(t!==void 0){var n=t[e];if(n!==void 0)return{codePoint:n,string:xK(n)}}}Al.codePoint=eE;function vK(r,e){return eE(r,parseInt(e,10))}Al.dec=vK;function wK(r,e){return eE(r,parseInt(e,16))}Al.hex=wK;function _K(r){if(r<=65535)return String.fromCharCode(r);var e=Math.floor((r-65536)/1024)+55296,t=(r-65536)%1024+56320;return String.fromCharCode(e,t)}var Jl={},B5=er;Jl.paragraph=NK;Jl.run=SK;Jl._elements=EO;Jl._elementsOfType=tE;Jl.getDescendantsOfType=kK;Jl.getDescendants=jO;function NK(r){return tE("paragraph",r)}function SK(r){return tE("run",r)}function tE(r,e){return EO(function(t){return t.type===r?e(t):t})}function EO(r){return function e(t){if(t.children){var n=B5.map(t.children,e);t=B5.extend(t,{children:n})}return r(t)}}function kK(r,e){return jO(r).filter(function(t){return t.type===e})}function jO(r){var e=[];return AO(r,function(t){e.push(t)}),e}
1366function AO(r,e){r.children&&r.children.forEach(function(t){AO(t,e),e(t)})}var rE={};rE.uriToZipEntryName=CK;rE.replaceFragment=EK;function CK(r,e){return e.charAt(0)==="/"?e.substr(1):r+"/"+e}function EK(r,e){var t=r.indexOf("#");return t!==-1&&(r=r.substring(0,t)),r+"#"+e}ZC.createBodyReader=AK;ZC._readNumberingProperties=DO;var $5=Al,Is=er,Nt=rt,TO=ys.Result,Js=ys.warning,jK=So,U5=Jl,H5=rE;function AK(r){return{readXmlElement:function(e){return new z5(r).readXmlElement(e)},readXmlElements:function(e){return new z5(r).readXmlElements(e)}}}function z5(r){var e=[],t=[],n=[],s=r.relationships,i=r.contentTypes,o=r.docxFile,l=r.files,c=r.numbering,u=r.styles;function d(re){var fe=re.map(h);return q5(fe)}function h(re){if(re.type==="element"){var fe=L[re.name];if(fe)return fe(re);if(!Object.prototype.hasOwnProperty.call(DK,re.name)){var j=Js("An unrecognised element was ignored: "+re.name);return ec([j])}}return dd()}function f(re){return w(re).map(function(fe){return{type:"paragraphProperties",styleId:fe.styleId,styleName:fe.name,alignment:re.firstOrEmpty("w:jc").attributes["w:val"],numbering:DO(fe.styleId,re.firstOrEmpty("w:numPr"),c),indent:p(re.firstOrEmpty("w:ind"))}})}function p(re){return{start:re.attributes["w:start"]||re.attributes["w:left"],end:re.attributes["w:end"]||re.attributes["w:right"],firstLine:re.attributes["w:firstLine"],hanging:re.attributes["w:hanging"]}}function m(re){return _(re).map(function(fe){var j=re.firstOrEmpty("w:sz").attributes["w:val"],oe=/^[0-9]+$/.test(j)?parseInt(j,10)/2:null;return{type:"runProperties",styleId:fe.styleId,styleName:fe.name,verticalAlignment:re.firstOrEmpty("w:vertAlign").attributes["w:val"],font:re.firstOrEmpty("w:rFonts").attributes["w:ascii"],fontSize:oe,isBold:v(re.first("w:b")),isUnderline:g(re.first("w:u")),isItalic:v(re.first("w:i")),isStrikethrough:v(re.first("w:strike")),isAllCaps:v(re.first("w:caps")),isSmallCaps:v(re.first("w:smallCaps")),highlight:y(re.firstOrEmpty("w:highlight").attributes["w:val"])}})}function g(re){if(re){var fe=re.attributes["w:val"];return fe!==void 0&&fe!=="false"&&fe!=="0"&&fe!=="none"}else return!1}function v(re){if(re){var fe=re.attributes["w:val"];return fe!=="false"&&fe!=="0"}else return!1}function b(re){return re!=="false"&&re!=="0"}function y(re){return!re||re==="none"?null:re}function w(re){return S(re,"w:pStyle","Paragraph",u.findParagraphStyleById)}function _(re){return S(re,"w:rStyle","Run",u.findCharacterStyleById)}function N(re){return S(re,"w:tblStyle","Table",u.findTableStyleById)}function S(re,fe,j,oe){var ne=[],G=re.first(fe),W=null,te=null;if(G&&(W=G.attributes["w:val"],W)){var he=oe(W);he?te=he.name:ne.push(De(j,W))}return K0({styleId:W,name:te},ne)}function E(re){var fe=re.attributes["w:fldCharType"];if(fe==="begin")e.push({type:"begin",fldChar:re}),t=[];else if(fe==="end"){if(e.length===0)return ec([Js("Ignoring complex field end character without corresponding start character")]);var j=e.pop();if(j.type==="begin"&&(j=D(j)),j.type==="checkbox")return Jn(Nt.checkbox({checked:j.checked}))}else if(fe==="separate"){if(e.length===0)return ec([Js("Ignoring complex field separator character without corresponding start character")]);var oe=e.pop(),ne=D(oe);e.push(ne)}return dd()}function T(){var re=Is.last(e.filter(function(fe){return fe.type==="hyperlink"}));return re?re.options:null}function D(re){return R(t.join(""),re.type==="begin"?re.fldChar:jK.emptyElement)}function R(re,fe){var j=/^\s*HYPERLINK\s+(\\l\s+)?(?:"(.*)"|([^\\]\S*))/.exec(re);if(j){var oe=j[2]===void 0?j[3]:j[2],ne=j[1]===void 0?{href:oe}:{anchor:oe};return{type:"hyperlink",options:ne}}var G=/\s*FORMCHECKBOX\s*/.exec(re);if(G){var W=fe.firstOrEmpty("w:ffData").firstOrEmpty("w:checkBox"),te=W.first("w:checked"),he=te==null?v(W.first("w:default")):v(te);return{type:"checkbox",checked:he}}return{type:"unknown"}}function H(re){return t.push(re.text()),dd()}function A(re){var fe=re.attributes["w:font"],j=re.attributes["w:char"],oe=$5.hex(fe,j);return oe==null&&/^F0..$/.test(j)&&(oe=$5.hex(fe,j.substring(2))),oe==null?ec([Js("A w:sym element with an unsupported character was ignored: char "+j+" in font "+fe)]):Jn(new Nt.Text(oe.string))}function U(re){return function(fe){var j=fe.attributes["w:id"];return Jn(new Nt.NoteReference({noteType:re,noteId:j}))}}function C(re){return Jn(Nt.commentReference({commentId:re.attributes["w:id"]}))}function M(re){return d(re.children)}var L={"w:p":function(re){var fe=re.firstOrEmpty("w:pPr"),j=!!fe.firstOrEmpty("w:rPr").first("w:del");
1366if(j)return re.children.forEach(function(ne){n.push(ne)}),dd();var oe=re.children;return n.length>0&&(oe=n.concat(oe),n=[]),Hr.map(f(fe),d(oe),function(ne,G){return new Nt.Paragraph(G,ne)}).insertExtra()},"w:r":function(re){return Hr.map(m(re.firstOrEmpty("w:rPr")),d(re.children),function(fe,j){var oe=T();return oe!==null&&(j=[new Nt.Hyperlink(j,oe)]),new Nt.Run(j,fe)})},"w:fldChar":E,"w:instrText":H,"w:t":function(re){return Jn(new Nt.Text(re.text()))},"w:tab":function(re){return Jn(new Nt.Tab)},"w:noBreakHyphen":function(){return Jn(new Nt.Text("‑"))},"w:softHyphen":function(re){return Jn(new Nt.Text("­"))},"w:sym":A,"w:hyperlink":function(re){var fe=re.attributes["r:id"],j=re.attributes["w:anchor"];return d(re.children).map(function(oe){function ne(W){var te=re.attributes["w:tgtFrame"]||null;return new Nt.Hyperlink(oe,Is.extend({targetFrame:te},W))}if(fe){var G=s.findTargetByRelationshipId(fe);return j&&(G=H5.replaceFragment(G,j)),ne({href:G})}else return j?ne({anchor:j}):oe})},"w:tbl":B,"w:tr":z,"w:tc":X,"w:footnoteReference":U("footnote"),"w:endnoteReference":U("endnote"),"w:commentReference":C,"w:br":function(re){var fe=re.attributes["w:type"];return fe==null||fe==="textWrapping"?Jn(Nt.lineBreak):fe==="page"?Jn(Nt.pageBreak):fe==="column"?Jn(Nt.columnBreak):ec([Js("Unsupported break type: "+fe)])},"w:bookmarkStart":function(re){var fe=re.attributes["w:name"];return fe==="_GoBack"?dd():Jn(new Nt.BookmarkStart({name:fe}))},"mc:AlternateContent":function(re){return M(re.firstOrEmpty("mc:Fallback"))},"w:sdt":function(re){var fe=d(re.firstOrEmpty("w:sdtContent").children);return fe.map(function(j){var oe=re.firstOrEmpty("w:sdtPr").first("wordml:checkbox");if(oe){var ne=oe.first("wordml:checked"),G=!!ne&&b(ne.attributes["wordml:val"]),W=Nt.checkbox({checked:G}),te=!1,he=j.map(U5._elementsOfType(Nt.types.text,function(ge){return ge.value.length>0&&!te?(te=!0,W):ge}));return te?he:W}else return j})},"w:ins":M,"w:object":M,"w:smartTag":M,"w:drawing":M,"w:pict":function(re){return M(re).toExtra()},"v:roundrect":M,"v:shape":M,"v:textbox":M,"w:txbxContent":M,"wp:inline":K,"wp:anchor":K,"v:imagedata":pe,"v:group":M,"v:rect":M};return{readXmlElement:h,readXmlElements:d};function B(re){var fe=I(re.firstOrEmpty("w:tblPr"));return d(re.children).flatMap(q).flatMap(function(j){return fe.map(function(oe){return Nt.Table(j,oe)})})}function I(re){return N(re).map(function(fe){return{styleId:fe.styleId,styleName:fe.name}})}function z(re){var fe=re.firstOrEmpty("w:trPr"),j=!!fe.first("w:del");if(j)return dd();var oe=!!fe.first("w:tblHeader");return d(re.children).map(function(ne){return Nt.TableRow(ne,{isHeader:oe})})}function X(re){return d(re.children).map(function(fe){var j=re.firstOrEmpty("w:tcPr"),oe=j.firstOrEmpty("w:gridSpan").attributes["w:val"],ne=oe?parseInt(oe,10):1,G=Nt.TableCell(fe,{colSpan:ne});return G._vMerge=F(j),G})}function F(re){var fe=re.first("w:vMerge");if(fe){var j=fe.attributes["w:val"];return j==="continue"||!j}else return null}function q(re){var fe=Is.any(re,function(ne){return ne.type!==Nt.types.tableRow});if(fe)return V(re),K0(re,[Js("unexpected non-row element in table, cell merging may be incorrect")]);var j=Is.any(re,function(ne){return Is.any(ne.children,function(G){return G.type!==Nt.types.tableCell})});if(j)return V(re),K0(re,[Js("unexpected non-cell element in table row, cell merging may be incorrect")]);var oe={};return re.forEach(function(ne){var G=0;ne.children.forEach(function(W){W._vMerge&&oe[G]?oe[G].rowSpan++:(oe[G]=W,W._vMerge=!1),G+=W.colSpan})}),re.forEach(function(ne){ne.children=ne.children.filter(function(G){return!G._vMerge}),ne.children.forEach(function(G){delete G._vMerge})}),Jn(re)}function V(re){re.forEach(function(fe){var j=U5.getDescendantsOfType(fe,Nt.types.tableCell);j.forEach(function(oe){delete oe._vMerge})})}function K(re){var fe=re.getElementsByTagName("a:graphic").getElementsByTagName("a:graphicData").getElementsByTagName("pic:pic").getElementsByTagName("pic:blipFill").getElementsByTagName("a:blip");return q5(fe.map(ee.bind(null,re)))}function ee(re,fe){var j=re.firstOrEmpty("wp:docPr"),oe=j.attributes,ne=Z(oe.descr)?oe.title:oe.descr,G=ie(fe);return G===null?ec([Js("Could not find image file for a:blip element")]):Oe(G,ne).map(function(W){var te=j.firstOrEmpty("a:hlinkClick"),he=te.attributes["r:id"];if(he){var ge=s.findTargetByRelationshipId(he);return new Nt.Hyperlink([W],{href:ge})}else return W})}function Z(re){return re==null||/^\s*$/.test(re)}function ie(re){var fe=re.attributes["r:embed"],j=re.attributes["r:link"];if(fe)return me(fe);if(j){var oe=s.findTargetByRelationshipId(j);return{path:oe,read:l.read.bind(l,oe)}}else return null}function pe(re){var fe=re.attributes["r:id"];return fe?Oe(me(fe),re.attributes["o:title"]):ec([Js("A v:imagedata element without a relationship ID was ignored")])}function me(re){var fe=H5.uriToZipEntryName("word",s.findTargetByRelationshipId(re));return{path:fe,read:o.read.bind(o,fe)}}function Oe(re,fe){var j=i.findContentType(re.path),oe=Nt.Image({readImage:re.read,altText:fe,contentType:j}),ne=TK[j]?[]:Js("Image of type "+j+" is unlikely to display in web browsers");return K0(oe,ne)}function De(re,fe){return Js(re+" style with ID "+fe+" was referenced but not defined in the document")}}function DO(r,e,t){var n=e.firstOrEmpty("w:ilvl").attributes["w:val"],s=e.firstOrEmpty("w:numId").attributes["w:val"];if(n!==void 0&&s!==void 0)return t.findLevel(s,n);if(r!=null){var i=t.findLevelByParagraphStyleId(r);if(i!=null)return i}return s!==void 0?t.findLevel(s,"0"):null}var TK={"image/png":!0,"image/gif":!0,"image/jpeg":!0,"image/svg+xml":!0,"image/tiff":!0},DK={"office-word:wrap":!0,"v:shadow":!0,"v:shapetype":!0,"w:annotationRef":!0,"w:bookmarkEnd":!0,"w:sectPr":!0,"w:proofErr":!0,"w:lastRenderedPageBreak":!0,"w:commentRangeStart":!0,"w:commentRangeEnd":!0,"w:del":!0,"w:footnoteRef":!0,"w:endnoteRef":!0,"w:pPr":!0,"w:rPr":!0,"w:tblPr":!0,"w:tblGrid":!0,"w:trPr":!0,"w:tcPr":!0};function ec(r){return new Hr(null,null,r)}function dd(){return new Hr(null)}function Jn(r){return new Hr(r)}function K0(r,e){return new Hr(r,null,e)}function Hr(r,e,t){this.value=r||[],this.extra=e||[],this._result=new TO({element:this.value,extra:e},t),this.messages=this._result.messages}Hr.prototype.toExtra=function(){return new Hr(null,Mv(this.extra,this.value),this.messages)};Hr.prototype.insertExtra=function(){var r=this.extra;return r&&r.length?new Hr(Mv(this.value,r),null,this.messages):this};Hr.prototype.map=function(r){var e=this._result.map(function(t){return r(t.element)});return new Hr(e.value,this.extra,e.messages)};Hr.prototype.flatMap=function(r){var e=this._result.flatMap(function(t){return r(t.element)._result});return new Hr(e.value.element,Mv(this.extra,e.value.extra),e.messages)};Hr.map=function(r,e,t){return new Hr(t(r.value,e.value),Mv(r.extra,e.extra),r.messages.concat(e.messages))};function q5(r){var e=TO.combine(Is.pluck(r,"_result"));return new Hr(Is.flatten(Is.pluck(e.value,"element")),Is.filter(Is.flatten(Is.pluck(e.value,"extra")),RK),e.messages)}function Mv(r,e){return Is.flatten([r,e])}function RK(r){return r}var RO={};RO.DocumentXmlReader=LK;var PK=rt,IK=ys.Result;function LK(r){var e=r.bodyReader;function t(n){var s=n.first("w:body");if(s==null)throw new Error("Could not find the body element: are you sure this is a docx file?");var i=e.readXmlElements(s.children).map(function(o){return new PK.Document(o,{notes:r.notes,comments:r.comments})});return new IK(i.value,i.messages)}return{convertXmlToDocument:t}}var Fv={};Fv.readRelationships=OK;Fv.defaultValue=new nE([]);Fv.Relationships=nE;function OK(r){var e=[];
1366return r.children.forEach(function(t){if(t.name==="relationships:Relationship"){var n={relationshipId:t.attributes.Id,target:t.attributes.Target,type:t.attributes.Type};e.push(n)}}),new nE(e)}function nE(r){var e=Object.create(null);r.forEach(function(n){e[n.relationshipId]=n.target});var t=Object.create(null);return r.forEach(function(n){t[n.type]||(t[n.type]=[]),t[n.type].push(n.target)}),{findTargetByRelationshipId:function(n){return e[n]},findTargetsByType:function(n){return t[n]||[]}}}var sE={};sE.readContentTypesFromXml=FK;var MK={png:"png",gif:"gif",jpeg:"jpeg",jpg:"jpeg",tif:"tiff",tiff:"tiff",bmp:"bmp"};sE.defaultContentTypes=PO({},{});function FK(r){var e=Object.create(null),t=Object.create(null);return r.children.forEach(function(n){if(n.name==="content-types:Default"&&(e[n.attributes.Extension]=n.attributes.ContentType),n.name==="content-types:Override"){var s=n.attributes.PartName;s.charAt(0)==="/"&&(s=s.substring(1)),t[s]=n.attributes.ContentType}}),PO(t,e)}function PO(r,e){return{findContentType:function(t){var n=r[t];if(n)return n;var s=t.split("."),i=s[s.length-1];if(Object.prototype.hasOwnProperty.call(e,i))return e[i];var o=MK[i.toLowerCase()];return o?"image/"+o:null}}}var Bv={},J0=er;Bv.readNumberingXml=BK;Bv.Numbering=iE;Bv.defaultNumbering=new iE({},{});function iE(r,e,t){var n=J0.flatten(J0.values(e).map(function(c){return J0.values(c.levels)})),s=J0.indexBy(n.filter(function(c){return c.paragraphStyleId!=null}),"paragraphStyleId");function i(c,u){return o(c,u,Object.create(null))}function o(c,u,d){if(d[c])return null;d[c]=!0;var h=r[c];if(!h)return null;var f=e[h.abstractNumId];if(f){if(f.numStyleLink==null)return e[h.abstractNumId].levels[u];var p=t.findNumberingStyleById(f.numStyleLink);return o(p.numId,u,d)}else return null}function l(c){return s[c]||null}return{findLevel:i,findLevelByParagraphStyleId:l}}function BK(r,e){if(!e||!e.styles)throw new Error("styles is missing");var t=$K(r),n=HK(r);return new iE(n,t,e.styles)}function $K(r){var e=Object.create(null);return r.getElementsByTagName("w:abstractNum").forEach(function(t){var n=t.attributes["w:abstractNumId"];e[n]=UK(t)}),e}function UK(r){var e=Object.create(null),t=null;r.getElementsByTagName("w:lvl").forEach(function(s){var i=s.attributes["w:ilvl"],o=s.firstOrEmpty("w:numFmt").attributes["w:val"],l=o!=="bullet",c=s.firstOrEmpty("w:pStyle").attributes["w:val"];i===void 0?t={isOrdered:l,level:"0",paragraphStyleId:c}:e[i]={isOrdered:l,level:i,paragraphStyleId:c}}),t!==null&&e[t.level]===void 0&&(e[t.level]=t);var n=r.firstOrEmpty("w:numStyleLink").attributes["w:val"];return{levels:e,numStyleLink:n}}function HK(r){var e=Object.create(null);return r.getElementsByTagName("w:num").forEach(function(t){var n=t.attributes["w:numId"],s=t.first("w:abstractNumId").attributes["w:val"];e[n]={abstractNumId:s}}),e}var $v={};$v.readStylesXml=zK;$v.Styles=hm;$v.defaultStyles=new hm({},{});function hm(r,e,t,n){return{findParagraphStyleById:function(s){return r[s]},findCharacterStyleById:function(s){return e[s]},findTableStyleById:function(s){return t[s]},findNumberingStyleById:function(s){return n[s]}}}hm.EMPTY=new hm({},{},{},{});function zK(r){var e=Object.create(null),t=Object.create(null),n=Object.create(null),s=Object.create(null);return r.getElementsByTagName("w:style").forEach(function(i){var o=qK(i),l;switch(o.type){case"paragraph":l=e;break;case"character":l=t;break;case"table":l=n;break;case"numbering":l=s;break}l&&l[o.styleId]===void 0&&(l[o.styleId]=o)}),new hm(e,t,n,s)}function qK(r){var e=r.attributes["w:type"];if(e==="numbering")return VK(e,r);var t=IO(r),n=WK(r);return{type:e,styleId:t,name:n}}function WK(r){var e=r.first("w:name");return e?e.attributes["w:val"]:null}function VK(r,e){var t=IO(e),n=e.firstOrEmpty("w:pPr").firstOrEmpty("w:numPr").firstOrEmpty("w:numId").attributes["w:val"];return{type:r,numId:n,styleId:t}}function IO(r){return r.attributes["w:styleId"]}var aE={},GK=rt,XK=ys.Result;aE.createFootnotesReader=LO.bind(Be,"footnote");aE.createEndnotesReader=LO.bind(Be,"endnote");function LO(r,e){function t(i){return XK.combine(i.getElementsByTagName("w:"+r).filter(n).map(s))}function n(i){var o=i.attributes["w:type"];return o!=="continuationSeparator"&&o!=="separator"}function s(i){var o=i.attributes["w:id"];return e.readXmlElements(i.children).map(function(l){return GK.Note({noteType:r,noteId:o,body:l})})}return t}var OO={},YK=rt,KK=ys.Result;function JK(r){function e(n){return KK.combine(n.getElementsByTagName("w:comment").map(t))}function t(n){var s=n.attributes["w:id"];function i(o){return(n.attributes[o]||"").trim()||null}return r.readXmlElements(n.children).map(function(o){return YK.comment({commentId:s,body:o,authorName:i("w:author"),authorInitials:i("w:initials")})})}return e}OO.createCommentsReader=JK;var MO={},ZK=Tr;MO.Files=QK;function QK(){function r(e){return ZK.reject(new Error("could not open external image: '"+e+`'
1367cannot open linked files from a web browser`))}return{read:r}}RC.read=aJ;RC._findPartPaths=BO;var eJ=Tr,tJ=rt,c2=ys.Result,Zb=t0,FO=LC.readXmlFromZipFile,rJ=ZC.createBodyReader,nJ=RO.DocumentXmlReader,ff=Fv,W5=sE,V5=Bv,G5=$v,X5=aE,sJ=OO,iJ=MO.Files;function aJ(r,e,t){e=e||{},t=t||{};var n=new iJ({externalFileAccess:t.externalFileAccess,relativeToFile:e.path});return eJ.props({contentTypes:lJ(r),partPaths:BO(r),docxFile:r,files:n}
1367).also(function(s){return{styles:uJ(r,s.partPaths.styles)}}).also(function(s){return{numbering:cJ(r,s.partPaths.numbering,s.styles)}}).also(function(s){return{footnotes:Z0(s.partPaths.footnotes,s,function(i,o){return o?X5.createFootnotesReader(i)(o):new c2([])}),endnotes:Z0(s.partPaths.endnotes,s,function(i,o){return o?X5.createEndnotesReader(i)(o):new c2([])}),comments:Z0(s.partPaths.comments,s,function(i,o){return o?sJ.createCommentsReader(i)(o):new c2([])})}}).also(function(s){return{notes:s.footnotes.flatMap(function(i){return s.endnotes.map(function(o){return new tJ.Notes(i.concat(o))})})}}).then(function(s){return Z0(s.partPaths.mainDocument,s,function(i,o){return s.notes.flatMap(function(l){return s.comments.flatMap(function(c){var u=new nJ({bodyReader:i,notes:l,comments:c});return u.convertXmlToDocument(o)})})})})}function BO(r){return dJ(r).then(function(e){var t=Y5({docxFile:r,relationships:e,relationshipType:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",basePath:"",fallbackPath:"word/document.xml"});if(!r.exists(t))throw new Error("Could not find main document part. Are you sure this is a valid .docx file?");return Df({filename:$O(t),readElement:ff.readRelationships,defaultValue:ff.defaultValue})(r).then(function(n){function s(i){return Y5({docxFile:r,relationships:n,relationshipType:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/"+i,basePath:Zb.splitPath(t).dirname,fallbackPath:"word/"+i+".xml"})}return{mainDocument:t,comments:s("comments"),endnotes:s("endnotes"),footnotes:s("footnotes"),numbering:s("numbering"),styles:s("styles")}})})}function Y5(r){var e=r.docxFile,t=r.relationships,n=r.relationshipType,s=r.basePath,i=r.fallbackPath,o=t.findTargetsByType(n),l=o.map(function(u){return oJ(Zb.joinPath(s,u),"/")}),c=l.filter(function(u){return e.exists(u)});return c.length===0?i:c[0]}function oJ(r,e){return r.substring(0,e.length)===e?r.substring(e.length):r}function Df(r){return function(e){return FO(e,r.filename).then(function(t){return t?r.readElement(t):r.defaultValue})}}function Z0(r,e,t){var n=Df({filename:$O(r),readElement:ff.readRelationships,defaultValue:ff.defaultValue});return n(e.docxFile).then(function(s){var i=new rJ({relationships:s,contentTypes:e.contentTypes,docxFile:e.docxFile,numbering:e.numbering,styles:e.styles,files:e.files});return FO(e.docxFile,r).then(function(o){return t(i,o)})})}function $O(r){var e=Zb.splitPath(r);return Zb.joinPath(e.dirname,"_rels",e.basename+".rels")}var lJ=Df({filename:"[Content_Types].xml",readElement:W5.readContentTypesFromXml,defaultValue:W5.defaultContentTypes});function cJ(r,e,t){return Df({filename:e,readElement:function(n){return V5.readNumberingXml(n,{styles:t})},defaultValue:V5.defaultNumbering})(r)}function uJ(r,e){return Df({filename:e,readElement:G5.readStylesXml,defaultValue:G5.defaultStyles})(r)}var dJ=Df({filename:"_rels/.rels",readElement:ff.readRelationships,defaultValue:ff.defaultValue}),oE={},hJ=er,fJ=Tr,fm=So;oE.writeStyleMap=mJ;oE.readStyleMap=bJ;var pJ="http://schemas.zwobble.org/mammoth/style-map",Qb="mammoth/style-map",UO="/"+Qb;function mJ(r,e){return r.write(Qb,e),gJ(r).then(function(){return yJ(r)})}function gJ(r){var e="word/_rels/document.xml.rels",t="http://schemas.openxmlformats.org/package/2006/relationships",n="{"+t+"}Relationship";return r.read(e,"utf8").then(fm.readString).then(function(s){var i=s.children;HO(i,n,"Id",{Id:"rMammothStyleMap",Type:pJ,Target:UO});var o={"":t};return r.write(e,fm.writeString(s,o))})}function yJ(r){var e="[Content_Types].xml",t="http://schemas.openxmlformats.org/package/2006/content-types",n="{"+t+"}Override";return r.read(e,"utf8").then(fm.readString).then(function(s){var i=s.children;HO(i,n,"PartName",{PartName:UO,ContentType:"text/prs.mammoth.style-map"});var o={"":t};return r.write(e,fm.writeString(s,o))})}function HO(r,e,t,n){var s=hJ.find(r,function(i){return i.name===e&&i.attributes[t]===n[t]});s?s.attributes=n:r.push(fm.element(e,n))}function bJ(r){return r.exists(Qb)?r.read(Qb,"utf8"):fJ.resolve(null)}var lE={},tc={},xa={},Ao={},K5;function zO(){if(K5)return Ao;K5=1;var r=Hv();function e(c,u,d){return n(r.element(c,u,{fresh:!1}),d)}function t(c,u,d){var h=r.element(c,u,{fresh:!0});return n(h,d)}function n(c,u){return{type:"element",tag:c,children:u||[]}}function s(c){return{type:"text",value:c}}var i={type:"forceWrite"};Ao.freshElement=t,Ao.nonFreshElement=e,Ao.elementWithTag=n,Ao.text=s,Ao.forceWrite=i;var o={br:!0,hr:!0,img:!0,input:!0};function l(c){return c.children.length===0&&o[c.tag.tagName]}return Ao.isVoidElement=l,Ao}var u2,J5;function xJ(){if(J5)return u2;J5=1;var r=er,e=zO();function t(g){return n(u(g))}function n(g){var v=[];
1367return g.map(s).forEach(function(b){c(v,b)}),v}function s(g){return i[g.type](g)}var i={element:o,text:l,forceWrite:l};function o(g){return e.elementWithTag(g.tag,n(g.children))}function l(g){return g}function c(g,v){var b=g[g.length-1];v.type==="element"&&!v.tag.fresh&&b&&b.type==="element"&&v.tag.matchesElement(b.tag)?(v.tag.separator&&c(b.children,e.text(v.tag.separator)),v.children.forEach(function(y){c(b.children,y)})):g.push(v)}function u(g){return d(g,function(v){return h[v.type](v)})}function d(g,v){return r.flatten(r.map(g,v),!0)}var h={element:p,text:m,forceWrite:f};function f(g){return[g]}function p(g){var v=u(g.children);return v.length===0&&!e.isVoidElement(g)?[]:[e.elementWithTag(g.tag,v)]}function m(g){return g.value.length===0?[]:[g]}return u2=t,u2}var Z5;function Uv(){if(Z5)return xa;Z5=1;var r=zO();xa.freshElement=r.freshElement,xa.nonFreshElement=r.nonFreshElement,xa.elementWithTag=r.elementWithTag,xa.text=r.text,xa.forceWrite=r.forceWrite,xa.simplify=xJ();function e(o,l){l.forEach(function(c){t(o,c)})}function t(o,l){n[l.type](o,l)}var n={element:s,text:i,forceWrite:function(){}};function s(o,l){r.isVoidElement(l)?o.selfClosing(l.tag.tagName,l.tag.attributes):(o.open(l.tag.tagName,l.tag.attributes),e(o,l.children),o.close(l.tag.tagName))}function i(o,l){o.text(l.value)}return xa.write=e,xa}var Q5;function Hv(){if(Q5)return tc;Q5=1;var r=er,e=Uv();tc.topLevelElement=t,tc.elements=n,tc.element=i;function t(l,c){return n([i(l,c,{fresh:!0})])}function n(l){return new s(l.map(function(c){return r.isString(c)?i(c):c}))}function s(l){this._elements=l}s.prototype.wrap=function(c){for(var u=c(),d=this._elements.length-1;d>=0;d--)u=this._elements[d].wrapNodes(u);return u};function i(l,c,u){return u=u||{},new o(l,c,u)}function o(l,c,u){var d=Object.create(null);r.isArray(l)?(l.forEach(function(h){d[h]=!0}),l=l[0]):d[l]=!0,this.tagName=l,this.tagNames=d,this.attributes=c||{},this.fresh=u.fresh,this.separator=u.separator}return o.prototype.matchesElement=function(l){return this.tagNames[l.tagName]&&r.isEqual(this.attributes||{},l.attributes||{})},o.prototype.wrap=function(c){return this.wrapNodes(c())},o.prototype.wrapNodes=function(c){return[e.elementWithTag(this,c)]},tc.empty=n([]),tc.ignore={wrap:function(){return[]}},tc}var cE={};(function(r){var e=er,t=Tr,n=Uv();r.imgElement=s;function s(o){return function(l,c){return t.when(o(l)).then(function(u){var d={};return l.altText&&(d.alt=l.altText),e.extend(d,u),[n.freshElement("img",d)]})}}r.inline=r.imgElement,r.dataUri=s(function(o){return o.readAsBase64String().then(function(l){return{src:"data:"+o.contentType+";base64,"+l}})});function i(o){return o.contentType.split(/\/|\\/)[1]}r.imageFilenameExtension=i})(cE);var qO={},WO={},VO=er;WO.writer=vJ;function vJ(r){return r=r||{},r.prettyPrint?wJ():GO()}var Q0={div:!0,p:!0,ul:!0,li:!0};function wJ(){var r=0,e="  ",t=[],n=!0,s=!1,i=GO();function o(m,g){Q0[m]&&f(),t.push(m),i.open(m,g),Q0[m]&&r++,n=!1}function l(m){Q0[m]&&(r--,f()),t.pop(),i.close(m)}function c(m){h();var g=p()?m:m.replace(`
1368`,`
1369`+e);i.text(g)}function u(m,g){f(),i.selfClosing(m,g)}function d(){return t.length===0||Q0[t[t.length-1]]}function h(){s||(f(),s=!0)}function f(){if(s=!1,!n&&d()&&!p()){i._append(`
1370`);for(var m=0;m<r;m++)i._append(e)}}function p(){return VO.some(t,function(m){return m==="pre"})}return{asString:i.asString,open:o,close:l,text:c,selfClosing:u}}function GO(){var r=[];function e(c,u){var d=s(u);r.push("<"+c+d+">")}function t(c){r.push("</"+c+">")}function n(c,u){var d=s(u);r.push("<"+c+d+" />")}function s(c){return VO.map(c,function(u,d){return" "+d+'="'+NJ(u)+'"'}).join("")}function i(c){r.push(_J(c))}function o(c){r.push(c)}function l(){return r.join("")}return{asString:l,open:e,close:t,text:i,selfClosing:n,_append:o}}function _J(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function NJ(r){return r.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var XO={},SJ=er;function e3(r){return ex(r,r)}function ex(r,e){return function(){return{start:r,end:e}}}function kJ(r){var e=r.href||"";return e?{start:"[",end:"]("+e+")",anchorPosition:"before"}:{}}function CJ(r){var e=r.src||"",t=r.alt||"";return e||t?{start:"!["+t+"]("+e+")"}:{}}function t3(r){return function(e,t){return{start:t?`
1371`:"",end:t?"":`
1372`,list:{isOrdered:r.isOrdered,indent:t?t.indent+1:0,count:0}}}}function EJ(r,e,t){e=e||{indent:0,isOrdered:!1,count:0},e.count++,t.hasClosed=!1;var n=e.isOrdered?e.count+".":"-",s=KO("	",e.indent)+n+" ";return{start:s,end:function(){if(!t.hasClosed)return t.hasClosed=!0,`
1373`}}}var YO={p:ex("",`
1374
1375`),br:ex("",`  
1376`),ul:t3({isOrdered:!1}),ol:t3({isOrdered:!0}
1376),li:EJ,strong:e3("__"),em:e3("*"),a:kJ,img:CJ};(function(){for(var r=1;r<=6;r++)YO["h"+r]=ex(KO("#",r)+" ",`
1377
1378`)})();function KO(r,e){return new Array(e+1).join(r)}function jJ(){var r=[],e=[],t=null,n={};function s(d,h){h=h||{};var f=YO[d]||function(){return{}},p=f(h,t,n);e.push({end:p.end,list:t}),p.list&&(t=p.list);var m=p.anchorPosition==="before";m&&i(h),r.push(p.start||""),m||i(h)}function i(d){d.id&&r.push('<a id="'+d.id+'"></a>')}function o(d){var h=e.pop();t=h.list;var f=SJ.isFunction(h.end)?h.end():h.end;r.push(f||"")}function l(d,h){s(d,h),o()}function c(d){r.push(AJ(d))}function u(){return r.join("")}return{asString:u,open:s,close:o,text:c,selfClosing:l}}XO.writer=jJ;function AJ(r){return r.replace(/\\/g,"\\\\").replace(/([\`\*_\{\}\[\]\(\)\#\+\-\.\!])/g,"\\$1")}var TJ=WO,DJ=XO;qO.writer=RJ;function RJ(r){return r=r||{},r.outputFormat==="markdown"?DJ.writer():TJ.writer(r)}var Mo=er,r3=Tr,Ky=rt,_s=Hv(),fS=ys,PJ=cE,nt=Uv(),IJ=qO;lE.DocumentConverter=LJ;function LJ(r){return{convertToHtml:function(e){var t=Mo.indexBy(e.type===Ky.types.document?e.comments:[],"commentId"),n=new OJ(r,t);return n.convertToHtml(e)}}}function OJ(r,e){var t=1,n=[],s=[];r=Mo.extend({ignoreEmptyParagraphs:!0},r);var i=r.idPrefix===void 0?"":r.idPrefix,o=r.ignoreEmptyParagraphs,l=_s.topLevelElement("p"),c=r.styleMap||[];function u(I){var z=[],X=h(I,z,Object.create(null)),F=[];JO(X,function(V){V.type==="deferred"&&F.push(V)});var q=Object.create(null);return r3.mapSeries(F,function(V){return V.value().then(function(K){q[V.id]=K})}).then(function(){function V(ee){return d2(ee,function(Z){return Z.type==="deferred"?q[Z.id]:Z.children?[Mo.extend({},Z,{children:V(Z.children)})]:[Z]})}var K=IJ.writer({prettyPrint:r.prettyPrint,outputFormat:r.outputFormat});return nt.write(K,nt.simplify(V(X))),new fS.Result(K.asString(),z)})}function d(I,z,X){return d2(I,function(F){return h(F,z,X)})}function h(I,z,X){if(!X)throw new Error("options not set");var F=B[I.type];return F?F(I,z,X):[]}function f(I,z,X){return p(I,z).wrap(function(){var F=d(I.children,z,X);return o?F:[nt.forceWrite].concat(F)})}function p(I,z){var X=b(I);return X?X.to:(I.styleId&&z.push(n3("paragraph",I)),l)}function m(I,z,X){var F=function(){return d(I.children,z,X)},q=[];if(I.highlight!==null){var V=v({type:"highlight",color:I.highlight});V&&q.push(V)}I.isSmallCaps&&q.push(g("smallCaps")),I.isAllCaps&&q.push(g("allCaps")),I.isStrikethrough&&q.push(g("strikethrough","s")),I.isUnderline&&q.push(g("underline")),I.verticalAlignment===Ky.verticalAlignment.subscript&&q.push(_s.element("sub",{},{fresh:!1})),I.verticalAlignment===Ky.verticalAlignment.superscript&&q.push(_s.element("sup",{},{fresh:!1})),I.isItalic&&q.push(g("italic","em")),I.isBold&&q.push(g("bold","strong"));var K=_s.empty,ee=b(I);return ee?K=ee.to:I.styleId&&z.push(n3("run",I)),q.push(K),q.forEach(function(Z){F=Z.wrap.bind(Z,F)}),F()}function g(I,z){var X=v({type:I});return X||(z?_s.element(z,{},{fresh:!1}):_s.empty)}function v(I,z){var X=b(I);return X?X.to:z}function b(I){for(var z=0;z<c.length;z++)if(c[z].from.matches(I))return c[z]}function y(I){return function(z,X){return r3.attempt(function(){return I(z,X)}).caught(function(F){return X.push(fS.error(F)),[]})}}function w(I){return N(I.noteType,I.noteId)}function _(I){return S(I.noteType,I.noteId)}function N(I,z){return E(I+"-"+z)}function S(I,z){return E(I+"-ref-"+z)}function E(I){return i+I}var T=_s.elements([_s.element("table",{},{fresh:!0})]);function D(I,z,X){return v(I,T).wrap(function(){return R(I,z,X)})}function R(I,z,X){var F=Mo.findIndex(I.children,function(ee){return!ee.type===Ky.types.tableRow||!ee.isHeader});F===-1&&(F=I.children.length);var q;if(F===0)q=d(I.children,z,Mo.extend({},X,{isTableHeader:!1}));else{var V=d(I.children.slice(0,F),z,Mo.extend({},X,{isTableHeader:!0})),K=d(I.children.slice(F),z,Mo.extend({},X,{isTableHeader:!1}));q=[nt.freshElement("thead",{},V),nt.freshElement("tbody",{},K)]}return[nt.forceWrite].concat(q)}function H(I,z,X){var F=d(I.children,z,X);return[nt.freshElement("tr",{},[nt.forceWrite].concat(F))]}function A(I,z,X){var F=X.isTableHeader?"th":"td",q=d(I.children,z,X),V={};return I.colSpan!==1&&(V.colspan=I.colSpan.toString()),I.rowSpan!==1&&(V.rowspan=I.rowSpan.toString()),[nt.freshElement(F,V,[nt.forceWrite].concat(q))]}function U(I,z,X){return v(I,_s.ignore).wrap(function(){var F=e[I.commentId],q=s.length+1,V="["+BJ(F)+q+"]";return s.push({label:V,comment:F}),[nt.freshElement("a",{href:"#"+N("comment",I.commentId),id:S("comment",I.commentId)},[nt.text(V)])]})}function C(I,z,X){var F=I.label,q=I.comment,V=d(q.body,z,X).concat([nt.nonFreshElement("p",{}
vendor: 1,304 bytes, line 1378
1378,[nt.text(" "),nt.freshElement("a",{href:"#"+S("comment",q.commentId)},[nt.text("↑")])])]);return[nt.freshElement("dt",{id:N("comment",q.commentId)},[nt.text("Comment "+F)]),nt.freshElement("dd",{},V)]}function M(I,z,X){return L(I).wrap(function(){return[]})}function L(I){var z=b(I);return z?z.to:I.breakType==="line"?_s.topLevelElement("br"):_s.empty}var B={document:function(I,z,X){var F=d(I.children,z,X),q=n.map(function(K){return I.notes.resolve(K)}),V=d(q,z,X);return F.concat([nt.freshElement("ol",{},V),nt.freshElement("dl",{},d2(s,function(K){return C(K,z,X)}))])},paragraph:f,run:m,text:function(I,z,X){return[nt.text(I.value)]},tab:function(I,z,X){return[nt.text("	")]},hyperlink:function(I,z,X){var F=I.anchor?"#"+E(I.anchor):I.href,q={href:F};I.targetFrame!=null&&(q.target=I.targetFrame);var V=d(I.children,z,X);return[nt.nonFreshElement("a",q,V)]},checkbox:function(I){var z={type:"checkbox"};return I.checked&&(z.checked="checked"),[nt.freshElement("input",z)]},bookmarkStart:function(I,z,X){var F=nt.freshElement("a",{id:E(I.name)},[nt.forceWrite]);return[F]},noteReference:function(I,z,X){n.push(I);var F=nt.freshElement("a",{href:"#"+w(I),id:_(I)},[nt.text("["+t+++"]")]);return[nt.freshElement("sup",{},[F])]},note:function(I,z,X){var F=d(I.body,z,X),q=nt.elementWithTag(_s.element
1378("p",{},{fresh:!1}),[nt.text(" "),nt.freshElement("a",{href:"#"+_(I)},[nt.text("↑")])]),V=F.concat([q]);return nt.freshElement("li",{id:w(I)},V)},commentReference:U,comment:C,image:FJ(y(r.convertImage||PJ.dataUri)),table:D,tableRow:H,tableCell:A,break:M};return{convertToHtml:u}}var MJ=1;function FJ(r){return function(e,t,n){return[{type:"deferred",id:MJ++,value:function(){return r(e,t,n)}}]}}function n3(r,e){return fS.warning("Unrecognised "+r+" style: '"+e.styleName+"' (Style ID: "+e.styleId+")")}function d2(r,e){return Mo.flatten(r.map(e),!0)}function JO(r,e){r.forEach(function(t){e(t),t.children&&JO(t.children,e)})}var BJ=lE.commentAuthorLabel=function(e){return e.authorInitials||""},ZO={},$J=rt;function QO(r){if(r.type==="text")return r.value;if(r.type===$J.types.tab)return"	";var e=r.type==="paragraph"?`
1379
1380`:"";return(r.children||[]).map(QO).join("")+e}ZO.convertElementToRawText=QO;var zv={},Di={},e6={},t6={exports:{}},pf=t6.exports=function(r,e){this._tokens=r,this._startIndex=e||0};pf.prototype.head=function(){return this._tokens[this._startIndex]};pf.prototype.tail=function(r){return new pf(this._tokens,this._startIndex+1)};pf.prototype.toArray=function(){return this._tokens.slice(this._startIndex)};pf.prototype.end=function(){return this._tokens[this._tokens.length-1]};pf.prototype.to=function(r){var e=this.head().source,t=r.head()||r.end();return e.to(t.source)};var UJ=t6.exports,HJ=UJ;e6.Parser=function(r){var e=function(t,n){return t(new HJ(n))};return{parseTokens:e}};var uE={},r6={};(function(r){r.none=Object.create({value:function(){throw new Error("Called value on none")},isNone:function(){return!0},isSome:function(){return!1},map:function(){return r.none},flatMap:function(){return r.none},filter:function(){return r.none},toArray:function(){return[]},orElse:e,valueOrElse:e});function e(n){return typeof n=="function"?n():n}r.some=function(n){return new t(n)};var t=function(n){this._value=n};t.prototype.value=function(){return this._value},t.prototype.isNone=function(){return!1},t.prototype.isSome=function(){return!0},t.prototype.map=function(n){return new t(n(this._value))},t.prototype.flatMap=function(n){return n(this._value)},t.prototype.filter=function(n){return n(this._value)?this:r.none},t.prototype.toArray=function(){return[this._value]},t.prototype.orElse=function(n){return this},t.prototype.valueOrElse=function(n){return this._value},r.isOption=function(n){return n===r.none||n instanceof t},r.fromNullable=function(n){return n==null?r.none:new t(n)}})(r6);var dE={failure:function(r,e){if(r.length<1)throw new Error("Failure must have errors");return new on({status:"failure",remaining:e,errors:r})},error:function(r,e){if(r.length<1)throw new Error("Failure must have errors");return new on({status:"error",remaining:e,errors:r})},success:function(r,e,t){return new on({status:"success",value:r,source:t,remaining:e,errors:[]})},cut:function(r){return new on({status:"cut",remaining:r,errors:[]})}},on=function(r){this._value=r.value,this._status=r.status,this._hasValue=r.value!==void 0,this._remaining=r.remaining,this._source=r.source,this._errors=r.errors};on.prototype.map=function(r){return this._hasValue?new on({value:r(this._value,this._source),status:this._status,remaining:this._remaining,source:this._source,errors:this._errors}):this};on.prototype.changeRemaining=function(r){return new on({value:this._value,status:this._status,remaining:r,source:this._source,errors:this._errors})};on.prototype.isSuccess=function(){return this._status==="success"||this._status==="cut"};on.prototype.isFailure=function(){return this._status==="failure"};on.prototype.isError=function(){return this._status==="error"};on.prototype.isCut=function(){return this._status==="cut"};on.prototype.value=function(){return this._value};on.prototype.remaining=function(){return this._remaining};on.prototype.source=function(){return this._source};on.prototype.errors=function(){return this._errors};var hE={};hE.error=function(r){return new qv(r)};var qv=function(r){this.expected=r.expected,this.actual=r.actual,this._location=r.location};qv.prototype.describe=function(){var r=this._location?this._location.describe()+`:
1381`:"";return r+"Expected "+this.expected+`
1382but got `+this.actual};qv.prototype.lineNumber=function(){return this._location.lineNumber()};qv.prototype.characterNumber=function(){return this._location.characterNumber()};var n6={};n6.fromArray=function(r){var e=0,t=function(){return e<r.length};return new Bu({hasNext:t,next:function(){if(t())return r[e++];throw new Error("No more elements")}})};var Bu=function(r){this._iterator=r};Bu.prototype.map=function(r){var e=this._iterator;return new Bu({hasNext:function(){return e.hasNext()},next:function(){return r(e.next())}})};Bu.prototype.filter=function(r){var e=this._iterator,t=!1,n=!1,s,i=function(){if(!t)for(t=!0,n=!1;e.hasNext()&&!n;)s=e.next(),n=r(s)};return new Bu({hasNext:function(){return i(),n},next:function(){i();var o=s;return t=!1,o}})};Bu.prototype.first=function(){var r=this._iterator;return this._iterator.hasNext()?r.next():null};Bu.prototype.toArray=function(){for(var r=[];this._iterator.hasNext();)r.push(this._iterator.next());return r};(function(r){var e=er,t=r6,n=dE,s=hE,i=n6;r.token=function(f,p){var m=p!==void 0;return function(g){var v=g.head();if(v&&v.name===f&&(!m||v.value===p))return n.success(v.value,g.tail(),v.source);var b=d({name:f,value:p});return h(g,b)}},r.tokenOfType=function(f){return r.token(f)},r.firstOf=function(f,p){return e.isArray(p)||(p=Array.prototype.slice.call(arguments,1
1382)),function(m){return i.fromArray(p).map(function(g){return g(m)}).filter(function(g){return g.isSuccess()||g.isError()}).first()||h(m,f)}},r.then=function(f,p){return function(m){var g=f(m);return g.map||console.log(g),g.map(p)}},r.sequence=function(){var f=Array.prototype.slice.call(arguments,0),p=function(g){var v=e.foldl(f,function(y,w){var _=y.result,N=y.hasCut;if(!_.isSuccess())return{result:_,hasCut:N};var S=w(_.remaining());if(S.isCut())return{result:_,hasCut:!0};if(S.isSuccess()){var E;w.isCaptured?E=_.value().withValue(w,S.value()):E=_.value();var T=S.remaining(),D=g.to(T);return{result:n.success(E,T,D),hasCut:N}}else return N?{result:n.error(S.errors(),S.remaining()),hasCut:N}:{result:S,hasCut:N}},{result:n.success(new o,g),hasCut:!1}).result,b=g.to(v.remaining());return v.map(function(y){return y.withValue(r.sequence.source,b)})};p.head=function(){var g=e.find(f,m);return r.then(p,r.sequence.extract(g))},p.map=function(g){return r.then(p,function(v){return g.apply(this,v.toArray())})};function m(g){return g.isCaptured}return p};var o=function(f,p){this._values=f||{},this._valuesArray=p||[]};o.prototype.withValue=function(f,p){if(f.captureName&&f.captureName in this._values)throw new Error('Cannot add second value for capture "'+f.captureName+'"');var m=e.clone(this._values);m[f.captureName]=p;var g=this._valuesArray.concat([p]);return new o(m,g)},o.prototype.get=function(f){if(f.captureName in this._values)return this._values[f.captureName];throw new Error('No value for capture "'+f.captureName+'"')},o.prototype.toArray=function(){return this._valuesArray},r.sequence.capture=function(f,p){var m=function(){return f.apply(this,arguments)};return m.captureName=p,m.isCaptured=!0,m},r.sequence.extract=function(f){return function(p){return p.get(f)}},r.sequence.applyValues=function(f){var p=Array.prototype.slice.call(arguments,1);return function(m){var g=p.map(function(v){return m.get(v)});return f.apply(this,g)}},r.sequence.source={captureName:"☃source☃"},r.sequence.cut=function(){return function(f){return n.cut(f)}},r.optional=function(f){return function(p){var m=f(p);return m.isSuccess()?m.map(t.some):m.isFailure()?n.success(t.none,p):m}},r.zeroOrMoreWithSeparator=function(f,p){return u(f,p,!1)},r.oneOrMoreWithSeparator=function(f,p){return u(f,p,!0)};var l=r.zeroOrMore=function(f){return function(p){for(var m=[],g;(g=f(p))&&g.isSuccess();)p=g.remaining(),m.push(g.value());return g.isError()?g:n.success(m,p)}};r.oneOrMore=function(f){return r.oneOrMoreWithSeparator(f,c)};function c(f){return n.success(null,f)}var u=function(f,p,m){return function(g){var v=f(g);if(v.isSuccess()){var b=r.sequence.capture(f,"main"),y=l(r.then(r.sequence(p,b),r.sequence.extract(b))),w=y(v.remaining());return n.success([v.value()].concat(w.value()),w.remaining())}else return m||v.isError()?v:n.success([],g)}};r.leftAssociative=function(f,p,m){var g;m?g=[{func:m,rule:p}]:g=p,g=g.map(function(b){return r.then(b.rule,function(y){return function(w,_){return b.func(w,y,_)}})});
1382var v=r.firstOf.apply(null,["rules"].concat(g));return function(b){var y=b,w=f(b);if(!w.isSuccess())return w;for(var _=v(w.remaining());_.isSuccess();){var N=_.remaining(),S=y.to(_.remaining()),E=_.value();w=n.success(E(w.value(),S),N,S),_=v(w.remaining())}return _.isError()?_:w}},r.leftAssociative.firstOf=function(){return Array.prototype.slice.call(arguments,0)},r.nonConsuming=function(f){return function(p){return f(p).changeRemaining(p)}};var d=function(f){return f.value?f.name+' "'+f.value+'"':f.name};function h(f,p){var m,g=f.head();return g?m=s.error({expected:p,actual:d(g),location:g.source}):m=s.error({expected:p,actual:"end of tokens"}),n.failure([m],f)}})(uE);var s6={exports:{}};s6.exports=function(r,e){var t={asString:function(){return r},range:function(n,s){return new $u(r,e,n,s)}};return t};var $u=function(r,e,t,n){this._string=r,this._description=e,this._startIndex=t,this._endIndex=n};$u.prototype.to=function(r){return new $u(this._string,this._description,this._startIndex,r._endIndex)};$u.prototype.describe=function(){var r=this._position(),e=this._description?this._description+`
1383`:"";return e+"Line number: "+r.lineNumber+`
1384Character number: `+r.characterNumber};$u.prototype.lineNumber=function(){return this._position().lineNumber};$u.prototype.characterNumber=function(){return this._position().characterNumber};$u.prototype._position=function(){for(var r=this,e=0,t=function(){return r._string.indexOf(`
1385`,e)},n=1;t()!==-1&&t()<this._startIndex;)e=t()+1,n+=1;var s=this._startIndex-e+1;return{lineNumber:n,characterNumber:s}};var i6=s6.exports,a6=function(r,e,t){this.name=r,this.value=e,t&&(this.source=t)},o6={};(function(r){var e=uE,t=dE;r.parser=function(i,o,l){var c={rule:f,leftAssociative:p,rightAssociative:m},u=new n(l.map(h)),d=e.firstOf(i,o);function h(b){return{name:b.name,rule:s(b.ruleBuilder.bind(null,c))}}function f(){return g(u)}function p(b){return g(u.untilExclusive(b))}function m(b){return g(u.untilInclusive(b))}function g(b){return v.bind(null,b)}function v(b,y){var w=d(y);return w.isSuccess()?b.apply(w):w}return c};function n(i){function o(h){return new n(i.slice(0,c().indexOf(h)))}function l(h){return new n(i.slice(0,c().indexOf(h)+1))}function c(){return i.map(function(h){return h.name})}function u(h){for(var f,p;;)if(f=d(h.remaining()),f.isSuccess())p=h.source().to(f.source()),h=t.success(f.value()(h.value(),p),f.remaining(),p);else return f.isFailure()?h:f}function d(h){return e.firstOf("infix",i.map(function(f){return f.rule}))(h)}return{apply:u,untilExclusive:o,untilInclusive:l}}r.infix=function(i,o){function l(c){return r.infix(i,function(u){var d=o(u);return function(h){var f=d(h);return f.map(function(p){return function(m,g){return c(m,p,g)}})}})}return{name:i,ruleBuilder:o,map:l}};var s=function(i){var o;return function(l){return o||(o=i()),o(l)}}})(o6);var l6={},h2=a6,zJ=i6;l6.RegexTokeniser=qJ;function qJ(r){r=r.map(function(s){return{name:s.name,regex:new RegExp(s.regex.source,"g")}});function e(s,i){for(var o=new zJ(s,i),l=0,c=[];l<s.length;){var u=t(s,l,o);l=u.endIndex,c.push(u.token)}return c.push(n(s,o)),c}function t(s,i,o){for(var l=0;l<r.length;l++){var c=r[l].regex;c.lastIndex=i;var u=c.exec(s);if(u){var h=i+u[0].length;if(u.index===i&&h>i){var d=u[1],f=new h2(r[l].name,d,o.range(i,h));return{token:f,endIndex:h}}}}var h=i+1,f=new h2("unrecognisedCharacter",s.substring(i,h),o.range(i,h));return{token:f,endIndex:h}}function n(s,i){return new h2("end",null,i.range(s.length,s.length))}return{tokenise:e}}Di.Parser=e6.Parser;Di.rules=uE;Di.errors=hE;Di.results=dE;Di.StringSource=i6;Di.Token=a6;Di.bottomUp=o6;Di.RegexTokeniser=l6.RegexTokeniser;Di.rule=function(r){var e;return function(t){return e||(e=r()),e(t)}};var Wr={};Wr.paragraph=WJ;Wr.run=VJ;Wr.table=GJ;Wr.bold=new Ri("bold");Wr.italic=new Ri("italic");Wr.underline=new Ri("underline");Wr.strikethrough=new Ri("strikethrough");Wr.allCaps=new Ri("allCaps");Wr.smallCaps=new Ri("smallCaps");Wr.highlight=XJ;Wr.commentReference=new Ri("commentReference");Wr.lineBreak=new Wv({breakType:"line"});Wr.pageBreak=new Wv({breakType:"page"});Wr.columnBreak=new Wv({breakType:"column"});Wr.equalTo=KJ;Wr.startsWith=JJ;function WJ(r){return new Ri("paragraph",r)}function VJ(r){return new Ri("run",r)}function GJ(r){return new Ri("table",r)}function XJ(r){return new c6(r)}function Ri(r,e){e=e||{},this._elementType=r,this._styleId=e.styleId,this._styleName=e.styleName,e.list&&(this._listIndex=e.list.levelIndex,this._listIsOrdered=e.list.isOrdered)}Ri.prototype.matches=function(r){return r.type===this._elementType&&(this._styleId===void 0||r.styleId===this._styleId)&&(this._styleName===void 0||r.styleName&&this._styleName.operator(this._styleName.operand,r.styleName))&&(this._listIndex===void 0||YJ(r,this._listIndex,this._listIsOrdered))&&(this._breakType===void 0||this._breakType===r.breakType)};function c6(r){r=r||{},this._color=r.color}c6.prototype.matches=function(r){return r.type==="highlight"&&(this._color===void 0||r.color===this._color)};function Wv(r){r=r||{},this._breakType=r.breakType}Wv.prototype.matches=function(r){return r.type==="break"&&(this._breakType===void 0||r.breakType===this._breakType)};function YJ(r,e,t){return r.numbering&&r.numbering.level==e&&r.numbering.isOrdered==t}function KJ(r){return{operator:ZJ,operand:r}}function JJ(r){return{operator:QJ,operand:r}}function ZJ(r,e){return r.toUpperCase()===e.toUpperCase()}function QJ(r,e){return e.toUpperCase().indexOf(r.toUpperCase())===0}var u6={},eZ=Di,tZ=eZ.RegexTokeniser;u6.tokenise=rZ;var s3="'((?:\\\\(?:.|$)|[^'\\\\])*)";function rZ(r){var e="(?:[a-zA-Z\\-_]|\\\\.)",t=new tZ([{name:"identifier",regex:new RegExp("("+e+"(?:"+e+"|[0-9])*)")},{name:"dot",regex:/\./},{name:"colon",regex:/:/},{name:"gt",regex:/>/},{name:"whitespace",regex:/\s+/},{name:"arrow",regex:/=>/},{name:"equals",regex:/=/},{name:"startsWith",regex:/\^=/},{name:"open-paren",regex:/\(/},{name:"close-paren",regex:/\)/},{name:"open-square-bracket",regex:/\[/},{name:"close-square-bracket",regex:/\]/},{name:"string",regex:new RegExp(s3+"'")},{name:"unterminated-string",regex:new RegExp(s3)},{name:"integer",regex:/([0-9]+)/},{name:"choice",regex:/\|/},{name:"bang",regex:/(!)/}]);return t.tokenise(r)}
vendor: 5,174 bytes, lines 1385-1386
1385var nZ=er,xe=Di,Jr=Wr,Jy=Hv(),sZ=u6.tokenise,f2=ys;zv.readHtmlPath=lZ;zv.readDocumentMatcher=oZ;zv.readStyle=iZ;function iZ(r){return fE(gZ,r)}function aZ(){return xe.rules.sequence(xe.rules.sequence.capture(d6()),xe.rules.tokenOfType("whitespace"),xe.rules.tokenOfType("arrow"),xe.rules.sequence.capture(xe.rules.optional(xe.rules.sequence(xe.rules.tokenOfType("whitespace"),xe.rules.sequence.capture(h6())).head())),xe.rules.tokenOfType("end")).map(function(r,e){return{from:r,to:e.valueOrElse(Jy.empty)}})}function oZ(r){return fE(d6(),r)}function d6(){var r=xe.rules.sequence,e=function(S,E){return xe.rules.then(xe.rules.token("identifier",S),function(){return E})},t=e("p",Jr.paragraph),n=e("r",Jr.run),s=xe.rules.firstOf("p or r or table",t,n),i=xe.rules.sequence(xe.rules.tokenOfType("dot"),xe.rules.sequence.cut(),xe.rules.sequence.capture(Vv)).map(function(S){return{styleId:S}}),o=xe.rules.firstOf("style name matcher",xe.rules.then(xe.rules.sequence(xe.rules.tokenOfType("equals"),xe.rules.sequence.cut(),xe.rules.sequence.capture(Md)).head(),function(S){return{styleName:Jr.equalTo(S)}}),xe.rules.then(xe.rules.sequence(xe.rules.tokenOfType("startsWith"),xe.rules.sequence.cut(),xe.rules.sequence.capture(Md)).head(),function(S){return{styleName:Jr.startsWith(S)}})),l=xe.rules.sequence(xe.rules.tokenOfType("open-square-bracket"),xe.rules.sequence.cut(),xe.rules.token("identifier","style-name"),xe.rules.sequence.capture(o),xe.rules.tokenOfType("close-square-bracket")).head(),c=xe.rules.firstOf("list type",e("ordered-list",{isOrdered:!0}),e("unordered-list",{isOrdered:!1})),u=r(xe.rules.tokenOfType("colon"),r.capture(c),r.cut(),xe.rules.tokenOfType("open-paren"),r.capture(cZ),xe.rules.tokenOfType("close-paren")).map(function(S,E){return{list:{isOrdered:S.isOrdered,levelIndex:E-1}}});function d(S){var E=xe.rules.firstOf.apply(xe.rules.firstOf,["matcher suffix"].concat(S)),T=xe.rules.zeroOrMore(E);return xe.rules.then(T,function(D){var R={};return D.forEach(function(H){nZ.extend(R,H)}),R})}var h=r(r.capture(s),r.capture(d([i,l,u]))).map(function(S,E){return S(E)}),f=r(xe.rules.token("identifier","table"),r.capture(d([i,l]))).map(function(S){return Jr.table(S)}),p=e("b",Jr.bold),m=e("i",Jr.italic),g=e("u",Jr.underline),v=e("strike",Jr.strikethrough),b=e("all-caps",Jr.allCaps),y=e("small-caps",Jr.smallCaps),w=r(xe.rules.token("identifier","highlight"),xe.rules.sequence.capture(xe.rules.optional(xe.rules.sequence(xe.rules.tokenOfType("open-square-bracket"),xe.rules.sequence.cut(),xe.rules.token("identifier","color"),xe.rules.tokenOfType("equals"),xe.rules.sequence.capture(Md),xe.rules.tokenOfType("close-square-bracket")).head()))).map(function(S){return Jr.highlight({color:S.valueOrElse(void 0)})}),_=e("comment-reference",Jr.commentReference),N=r(xe.rules.token("identifier","br"),r.cut(),xe.rules.tokenOfType("open-square-bracket"),xe.rules.token("identifier","type"),xe.rules.tokenOfType("equals"),r.capture(Md),xe.rules.tokenOfType("close-square-bracket")).map(function(S){switch(S){case"line":return Jr.lineBreak;case"page":return Jr.pageBreak;case"column":return Jr.columnBreak}});return xe.rules.firstOf("element type",h,f,p,m,g,v,b,y,w,_,N)}function lZ(r){return fE(h6(),r)}function h6(){var r=xe.rules.sequence.capture,e=xe.rules.tokenOfType("whitespace"),t=xe.rules.then(xe.rules.optional(xe.rules.sequence(xe.rules.tokenOfType("colon"),xe.rules.token("identifier","fresh"))),function(o){return o.map(function(){return!0}).valueOrElse(!1)}),n=xe.rules.then(xe.rules.optional(xe.rules.sequence(xe.rules.tokenOfType("colon"),xe.rules.token("identifier","separator"),xe.rules.tokenOfType("open-paren"),r(Md),xe.rules.tokenOfType("close-paren")).head()),function(o){return o.valueOrElse("")}),s=xe.rules.oneOrMoreWithSeparator(Vv,xe.rules.tokenOfType("choice")),i=xe.rules.sequence(r(s),r(xe.rules.zeroOrMore(fZ)),r(t),r(n)).map(function(o,l,c,u){var d=Object.create(null),h={};return l.forEach(function(f){f.append&&d[f.name]?d[f.name]+=" "+f.value:d[f.name]=f.value}),c&&(h.fresh=!0),u&&(h.separator=u),Jy.element(o,d,h)});return xe.rules.firstOf("html path",xe.rules.then(xe.rules.tokenOfType("bang"),function(){return Jy.ignore}),xe.rules.then(xe.rules.zeroOrMoreWithSeparator(i,xe.rules.sequence(e,xe.rules.tokenOfType("gt"),e)),Jy.elements))}var Vv=xe.rules.then(xe.rules.tokenOfType("identifier"),f6),cZ=xe.rules.tokenOfType("integer"),Md=xe.rules.then(xe.rules.tokenOfType("string"),f6),uZ={n:`
1386`,r:"\r",t:"	"};function f6(r){return r.replace(/\\(.)/g,function(e,t){return uZ[t]||t})}var dZ=xe.rules.sequence(xe.rules.tokenOfType("open-square-bracket"),xe.rules.sequence.cut(),xe.rules.sequence.capture(Vv),xe.rules.tokenOfType("equals"),xe.rules.sequence.capture(Md),xe.rules.tokenOfType("close-square-bracket")).map(function(r,e){return{name:r,value:e,append:!1}}),hZ=xe.rules.sequence(xe.rules.tokenOfType("dot"),xe.rules.sequence.cut(),xe.rules.sequence.capture(Vv)).map(function(r){return{name:"class",value:r,append:!0}}),fZ=xe.rules.firstOf("attribute or class",dZ,hZ);function fE(r,e){var t=sZ(e),n=xe.Parser(),s=n.parseTokens(r,t);return s.isSuccess()?f2.success(s.value()):new f2.Result(null,[f2.warning(pZ(e,s))])}
1386function pZ(r,e){return"Did not understand this style mapping, so ignored it: "+r+`
1387`+e.errors().map(mZ).join(`
1388`)}function mZ(r){return"Error was at character number "+r.characterNumber()+": Expected "+r.expected+" but got "+r.actual}var gZ=aZ(),Gv={};Gv.readOptions=xZ;var p6=er,yZ=Gv._defaultStyleMap=["p.Heading1 => h1:fresh","p.Heading2 => h2:fresh","p.Heading3 => h3:fresh","p.Heading4 => h4:fresh","p.Heading5 => h5:fresh","p.Heading6 => h6:fresh","p[style-name='Heading 1'] => h1:fresh","p[style-name='Heading 2'] => h2:fresh","p[style-name='Heading 3'] => h3:fresh","p[style-name='Heading 4'] => h4:fresh","p[style-name='Heading 5'] => h5:fresh","p[style-name='Heading 6'] => h6:fresh","p[style-name='heading 1'] => h1:fresh","p[style-name='heading 2'] => h2:fresh","p[style-name='heading 3'] => h3:fresh","p[style-name='heading 4'] => h4:fresh","p[style-name='heading 5'] => h5:fresh","p[style-name='heading 6'] => h6:fresh","p.Heading => h1:fresh","p[style-name='Heading'] => h1:fresh","r[style-name='Strong'] => strong","p[style-name='footnote text'] => p:fresh","r[style-name='footnote reference'] =>","p[style-name='endnote text'] => p:fresh","r[style-name='endnote reference'] =>","p[style-name='annotation text'] => p:fresh","r[style-name='annotation reference'] =>","p[style-name='Footnote'] => p:fresh","r[style-name='Footnote anchor'] =>","p[style-name='Endnote'] => p:fresh","r[style-name='Endnote anchor'] =>","p:unordered-list(1) => ul > li:fresh","p:unordered-list(2) => ul|ol > li > ul > li:fresh","p:unordered-list(3) => ul|ol > li > ul|ol > li > ul > li:fresh","p:unordered-list(4) => ul|ol > li > ul|ol > li > ul|ol > li > ul > li:fresh","p:unordered-list(5) => ul|ol > li > ul|ol > li > ul|ol > li > ul|ol > li > ul > li:fresh","p:ordered-list(1) => ol > li:fresh","p:ordered-list(2) => ul|ol > li > ol > li:fresh","p:ordered-list(3) => ul|ol > li > ul|ol > li > ol > li:fresh","p:ordered-list(4) => ul|ol > li > ul|ol > li > ul|ol > li > ol > li:fresh","p:ordered-list(5) => ul|ol > li > ul|ol > li > ul|ol > li > ul|ol > li > ol > li:fresh","r[style-name='Hyperlink'] =>","p[style-name='Normal'] => p:fresh","p.Body => p:fresh","p[style-name='Body'] => p:fresh"],bZ=Gv._standardOptions={externalFileAccess:!1,transformDocument:vZ,includeDefaultStyleMap:!0,includeEmbeddedStyleMap:!0};function xZ(r){return r=r||{},p6.extend({},bZ,r,{customStyleMap:i3(r.styleMap),readStyleMap:function(){var e=this.customStyleMap;return this.includeEmbeddedStyleMap&&(e=e.concat(i3(this.embeddedStyleMap))),this.includeDefaultStyleMap&&(e=e.concat(yZ)),e}})}function i3(r){return r?p6.isString(r)?r.split(`
1389`).map(function(e){return e.trim()}).filter(function(e){return e!==""&&e.charAt(0)!=="#"}):r:[]}function vZ(r){return r}var m6={},a3=Tr,wZ=t0;m6.openZip=_Z;function _Z(r){return r.arrayBuffer?a3.resolve(wZ.openArrayBuffer(r.arrayBuffer)):a3.reject(new Error("Could not find file in options"))}var g6={},NZ=Hv(),SZ=Uv();g6.element=kZ;function kZ(r){return function(e){return SZ.elementWithTag(NZ.element(r),[e])}}var CZ=er,y6=RC,pE=oE,EZ=lE.DocumentConverter,jZ=ZO.convertElementToRawText,AZ=zv.readStyle,TZ=Gv.readOptions,Xv=m6,DZ=ys.Result;Ai.convertToHtml=RZ;Ai.convertToMarkdown=PZ;Ai.convert=mE;Ai.extractRawText=MZ;Ai.images=cE;Ai.transforms=Jl;Ai.underline=g6;Ai.embedStyleMap=FZ;Ai.readEmbeddedStyleMap=IZ;function RZ(r,e){return mE(r,e)}function PZ(r,e){var t=Object.create(e||{});return t.outputFormat="markdown",mE(r,t)}function mE(r,e){return e=TZ(e),Xv.openZip(r).tap(function(t){return pE.readStyleMap(t).then(function(n){e.embeddedStyleMap=n})}).then(function(t){return y6.read(t,r,e).then(function(n){return n.map(e.transformDocument)}).then(function(n){return LZ(n,e)})})}function IZ(r){return Xv.openZip(r).then(pE.readStyleMap)}function LZ(r,e){var t=OZ(e.readStyleMap()),n=CZ.extend({},e,{styleMap:t.value}),s=new EZ(n);return r.flatMapThen(function(i){return t.flatMapThen(function(o){return s.convertToHtml(i)})})}function OZ(r){return DZ.combine((r||[]).map(AZ)).map(function(e){return e.filter(function(t){return!!t})})}function MZ(r){return Xv.openZip(r).then(y6.read).then(function(e){return e.map(j
1389Z)})}function FZ(r,e){return Xv.openZip(r).tap(function(t){return pE.writeStyleMap(t,e)}).then(function(t){return t.toArrayBuffer()}).then(function(t){return{toArrayBuffer:function(){return t},toBuffer:function(){return Buffer.from(t)}}})}Ai.styleMapping=function(){throw new Error(`Use a raw string instead of mammoth.styleMapping e.g. "p[style-name='Title'] => h1" instead of mammoth.styleMapping("p[style-name='Title'] => h1")`)};function o3(r){if(!r)return null;if(!/^https?:\/\//i.test(r))return r;try{const e=new URL(r),t="/storage/v1/object/",n=e.pathname.indexOf(t);if(n<0)return null;const s=e.pathname.slice(n+t.length),i="subscriber-audio/",o=s.indexOf(i);return o>=0?decodeURIComponent(s.slice(o+i.length)):null}catch{return null}}async function BZ(r){if(!Y)return null;const{data:e,error:t}=await Y.storage.from("subscriber-audio").createSignedUrl(r,3600);return t||!e?null:e.signedUrl}async function $Z(r,e){if(!Y)return;const{data:t,error:n}=await Y.storage.from("subscriber-audio").download(r);if(n||!t)return;const s=URL.createObjectURL(t),i=document.createElement("a");i.href=s,i.download=e||"recording.mp3",document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(s)}async function UZ(r,e){if(!Y)return;const{data:t,error:n}=await Y.storage.from("subscriber-audio").download(r);if(n||!t)return;const s=URL.createObjectURL(t),i=document.createElement("a");i.href=s,i.download=e||"transcript.docx",document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(s)}async function HZ(r){if(!Y)return null;const{data:e,error:t}=await Y.storage.from("subscriber-audio").download(r);if(t||!e)return null;const n=await e.arrayBuffer();return(await Ai.convertToHtml({arrayBuffer:n})).value}function zZ(){const{signIn:r,signUp:e}=Nf(),[t,n]=k.useState("sign-in"),[s,i]=k.useState(""),[o,l]=k.useState(""),[c,u]=k.useState(!1),[d,h]=k.useState(!1),[f,p]=k.useState(""),[m,g]=k.useState("");async function v(b){if(b.preventDefault(),!(!s.trim()||!o.trim())){if(p(""),g(""),h(!0),t==="sign-in"){const{error:y}=await r(s.trim(),o);y&&p("That email and password combination did not work.")}else{const{error:y}=await e(s.trim(),o);y?p("We could not create that account. Please check your details and try again."):(g("Account created! Check your email to confirm, then sign in below."),n("sign-in"),l(""))}h(!1)}}return a.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-8",children:[a.jsx(ze,{zone:"leaderboard",page:"/subscriber-extras",className:"mb-6"}),a.jsxs("div",{className:"max-w-2xl mx-auto mt-4",children:[a.jsxs("div",{className:"bg-brand-black text-white rounded-t-2xl px-8 py-10 text-center",children:[a.jsx("div",{className:"flex items-center justify-center gap-3 mb-5",children:a.jsx("div",{className:"w-14 h-14 rounded-2xl bg-white/10 flex items-center justify-center",children:a.jsx(bl,{className:"w-8 h-8 text-white"})})}),a.jsx("h1",{className:"font-masthead text-3xl font-bold leading-tight mb-2",children:"Subscriber Extras"}),a.jsx("p",{className:"font-headline italic text-white/70 text-base",children:"Audio recordings & past editions — exclusive to digital subscribers"})]}),a.jsxs("div",{className:"bg-white border border-t-0 border-gray-200 rounded-b-2xl shadow-lg px-8 py-8",children:[a.jsx("div",{className:"flex justify-center mb-6",children:a.jsxs("span",{className:"inline-flex items-center gap-2 bg-amber-50 border border-amber-200 text-amber-800 text-xs font-semibold px-4 py-1.5 rounded-full",children:[a.jsx(Sk,{className:"w-3.5 h-3.5"}),"Subscriber access only"]})}),a.jsx("p",{className:"text-center font-body text-sm text-gray-600 mb-6 leading-relaxed",children:t==="sign-in"?"Sign in to your subscriber account to access exclusive audio and past editions.":"Create an account to access your digital subscription."}),a.jsxs("div",{className:"flex bg-gray-100 rounded-xl p-1 gap-1 mb-6",children:[a.jsxs("button",{type:"button",onClick:()=>{n("sign-in"),p(""),g("")},className:`flex-1 flex items-center justify-center gap-1.5 py-2 rounded-lg text-sm font-semibold font-body transition-all ${t==="sign-in"?"bg-white text-brand-black shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:[a.jsx(Ab,{className:"w-3.5 h-3.5"}),"Sign In"]}),a.jsxs("button",{type:"button",onClick:()=>{n("create-account"),p(""),g("")},className:`flex-1 flex items-center justify-center gap-1.5 py-2 rounded-lg text-sm font-semibold font-body transition-all ${t==="create-account"?"bg-white text-brand-black shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:[a.jsx(Nu,{className:"w-3.5 h-3.5"}),"Create Account"]})]}),f&&a.jsx("div",{className:"mb-4 bg-red-50 border border-red-200 text-red-700 text-sm font-body rounded-lg px-4 py-3",children:f}),m&&a.jsx("div",{className:"mb-4 bg-green-50 border border-green-200 text-green-800 text-sm font-body rounded-lg px-4 py-3",children:m}),a.jsxs("form",{onSubmit:v,className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1.5 font-body",children:"Email address"}),a.jsx("input",{type:"email",required:!0,value:s,onChange:b=>i(b.target.value),placeholder:"[email protected]",className:"w-full border border-gray-300 rounded-xl px-4 py-2.5 text-sm font-body focus:outline-none focus:border-brand-black focus:ring-1 focus:ring-brand-black/20 transition"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1.5 font-body",children:"Password"}),a.jsxs("div",{className:"relative",children:[a.jsx("input",{type:c?"text":"password",required:!0,value:o,onChange:b=>l(b.target.value),placeholder:t==="create-account"?"Choose a password":"Your password",className:"w-full border border-gray-300 rounded-xl px-4 py-2.5 pr-10 text-sm font-body focus:outline-none focus:border-brand-black focus:ring-1 focus:ring-brand-black/20 transition"}),a.jsx("button",{type:"button",onClick:()=>u(b=>!b),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",tabIndex:-1,
1389children:c?a.jsx(Hg,{className:"w-4 h-4"}):a.jsx(zg,{className:"w-4 h-4"})})]})]}),a.jsx("button",{type:"submit",disabled:d,className:"w-full py-3 rounded-xl bg-brand-black text-white text-sm font-bold font-body flex items-center justify-center gap-2 hover:bg-gray-800 disabled:opacity-50 transition-all",children:d?a.jsx(_e,{className:"w-4 h-4 animate-spin"}):t==="sign-in"?a.jsxs(a.Fragment,{children:[a.jsx(Ab,{className:"w-4 h-4"})," Sign In"]}):a.jsxs(a.Fragment,{children:[a.jsx(Nu,{className:"w-4 h-4"})," Create Account"]})})]}),a.jsxs("div",{className:"mt-6 pt-6 border-t border-gray-100 text-center",children:[a.jsx("p",{className:"font-body text-sm text-gray-500 mb-3",children:"Don't have a subscription yet?"}),a.jsxs($e,{to:"/subscribe",className:"inline-flex items-center gap-2 bg-brand-red text-white text-sm font-bold font-body px-6 py-2.5 rounded-xl hover:bg-red-700 transition-all shadow-sm",children:[a.jsx(Vs,{className:"w-4 h-4"}),"View Subscription Plans"]})]})]})]}),a.jsx(ze,{zone:"footer",page:"/subscriber-extras",className:"mt-10"})]})}function qZ({audio:r}){const[e,t]=k.useState(!1),[n,s]=k.useState(!1),[i,o]=k.useState(!1),[l,c]=k.useState(""),[u,d]=k.useState(null),[h,f]=k.useState(!1),[p,m]=k.useState(!1),g=k.useRef(null),v=r.audio_date?new Date(r.audio_date+"T00:00:00").toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}):new Date(r.created_at).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"});k.useEffect(()=>{let _=!1;return(async()=>{const N=r.audio_path||o3(r.audio_url??"");if(N){const S=await BZ(N);!_&&S&&c(S)}else r.audio_url&&(_||c(r.audio_url))})(),()=>{_=!0}},[r.audio_path,r.audio_url]),k.useEffect(()=>{if(!i||!r.transcript_docx_path||u!==null)return;let _=!1;return f(!0),(async()=>{const N=await HZ(r.transcript_docx_path);_||(d(N),f(!1))})(),()=>{_=!0}},[i,r.transcript_docx_path,u]);const b=k.useCallback(()=>{g.current&&(e?g.current.pause():g.current.play().catch(()=>{}))},[e]),y=async()=>{if(!r.audio_path&&!r.audio_url)return;const _=r.audio_path||o3(r.audio_url??"");m(!0);try{if(_)await $Z(_,r.audio_file_name||"recording.mp3");else if(r.audio_url){const N=document.createElement("a");N.href=r.audio_url,N.download=r.audio_file_name||"recording.mp3",N.target="_blank",document.body.appendChild(N),N.click(),document.body.removeChild(N)}}finally{m(!1)}},w=async()=>{r.transcript_docx_path&&await UZ(r.transcript_docx_path,r.transcript_file_name||"transcript.docx")};return a.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl overflow-hidden shadow-sm hover:shadow-md transition-shadow",children:[r.hero_image_url&&a.jsxs("div",{className:"relative h-48 sm:h-56 overflow-hidden",children:[a.jsx(Mr,{src:r.hero_image_url,alt:r.title,imageId:r.hero_image_url,className:"w-full h-full object-cover",containerClassName:"w-full h-full"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/60 to-transparent pointer-events-none"}),a.jsx("button",{onClick:b,className:"absolute bottom-4 left-4 w-14 h-14 rounded-full bg-white/90 hover:bg-white flex items-center justify-center shadow-lg transition-transform hover:scale-105","aria-label":e?"Pause":"Play",children:e?a.jsx(SU,{className:"w-6 h-6 text-brand-black"}):a.jsx(kf,{className:"w-6 h-6 text-brand-black ml-0.5"})})]}),a.jsxs("div",{className:"p-5",children:[a.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-400 font-body mb-2",children:[a.jsx(ha,{className:"w-3.5 h-3.5"}),v]}),a.jsx("h3",{className:"font-headline font-bold text-brand-black text-lg leading-tight mb-2",children:r.title}),r.description&&a.jsx("p",{className:"font-body text-sm text-gray-600 leading-relaxed mb-3",children:r.description}),l?a.jsxs("div",{className:"mt-2 space-y-2",children:[a.jsx("audio",{ref:g,src:l,onPlay:()=>t(!0),onPause:()=>t(!1),onEnded:()=>t(!1),className:"w-full",controls:!0}),a.jsxs("button",{onClick:y,disabled:p,className:"inline-flex items-center gap-1.5 text-xs font-semibold font-body text-gray-500 hover:text-brand-black border border-gray-200 rounded-lg px-3 py-1.5 hover:bg-gray-50 transition disabled:opacity-50",children:[p?a.jsx(_e,{className:"w-3.5 h-3.5 animate-spin"}):a.jsx(Du,{className:"w-3.5 h-3.5"}),"Download Audio"]})]}):a.jsxs("div",{className:"mt-2 flex items-center gap-2 text-sm text-gray-400",children:[a.jsx(_e,{className:"w-4 h-4 animate-spin"}),"Loading audio…"]}),r.summary&&a.jsxs("div",{className:"mt-4",children:[a.jsxs("button",{onClick:()=>s(!n),className:"w-full flex items-center justify-between px-4 py-2.5 bg-amber-50 border border-amber-200 rounded-lg text-sm font-bold text-amber-900 hover:bg-amber-100 transition-colors",children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx(A_,{className:"w-4 h-4"}),"AI Summary"]}),n?a.jsx(fa,{className:"w-4 h-4"}):a.jsx(Ws,{className:"w-4 h-4"})]}),n&&a.jsx("div",{className:"mt-2 px-4 py-3 bg-amber-50/50 border border-amber-100 rounded-lg text-sm text-gray-700 leading-relaxed whitespace-pre-wrap font-body",children:r.summary})]}),(r.transcript_docx_path||r.transcript)&&a.jsxs("div",{className:"mt-3",children:[a.jsxs("button",{onClick:()=>o(!i),className:"w-full flex items-center justify-between px-4 py-2.5 bg-green-50 border border-green-200 rounded-lg text-sm font-bold text-green-900 hover:bg-green-100 transition-colors",children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx(Bt,{className:"w-4 h-4"}),"Full Transcript"]}),a.jsxs("span",{className:"flex items-center gap-2",children:[r.transcript_docx_path&&a.jsxs("span",{onClick:_=>{_.stopPropagation(),w()},className:"inline-flex items-center gap-1 text-xs font-semibold text-green-700 hover:text-green-900 bg-white/60 rounded px-2 py-0.5",children:[a.jsx(Du,{className:"w-3 h-3"}),".docx"]}),i?a.jsx(fa,{className:"w-4 h-4"}):a.jsx(Ws,{className:"w-4 h-4"})]})]}),i&&a.jsx("div",{className:"mt-2",children:r.transcript_docx_path?h?a.jsxs("div",{className:"flex items-center gap-2 px-4 py-6 bg-gray-50 border border-gray-200 rounded-lg text-sm text-gray-500",children:[a.jsx(_e,{className:"w-4 h-4 animate-spin text-green-500"}),"Loading transcript…"]}):u?a.jsx("div",{className:"max-h-[32rem] overflow-y-auto px-5 py-4 bg-white border border-gray-200 rounded-lg prose prose-sm max-w-none prose-headings:font-headline prose-headings:text-brand-black prose-p:text-gray-700 prose-p:leading-relaxed",dangerouslySetInnerHTML:{__html:u}}):a.jsx("div",{className:"px-4 py-3 bg-red-50 border border-red-200 rounded-lg text-sm text-red-600",children:"Could not load transcript. Try downloading the .docx file instead."}):a.jsx("div",{className:"max-h-96 overflow-y-auto px-4 py-3 bg-gray-50 border border-gray-200 rounded-lg text-sm text-gray-700 leading-relaxed whitespace-pre-wrap font-mono",children:r.transcript})})]})]})]})}function WZ({paper:r}){const[e,t]=k.useState(""),[n,s]=k.useState(null),[i,o]=k.useState(!1);k.useEffect(()=>{let c=!1;return(async()=>{const[u,d]=await Promise.all([Zp(r.pdf_url),r.thumbnail_url?Zp(r.thumbnail_url):Prom
1389ise.resolve(null)]);c||(t(u??""),d&&s(d))})(),()=>{c=!0}},[r.pdf_url,r.thumbnail_url]),k.useEffect(()=>{if(n||!e)return;let c=!1;return o(!0),(async()=>{const u=await lL(e);if(c||!u){o(!1);return}const d=URL.createObjectURL(u);c||(s(d),o(!1))})(),()=>{c=!0}},[r.thumbnail_url,r.pdf_url,e,n]);const l=r.edition_date?new Date(r.edition_date+"T00:00:00").toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}):new Date(r.archived_at).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"});return a.jsxs("a",{href:e||"#",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-4 bg-white border border-gray-200 rounded-xl p-4 hover:border-brand-red hover:shadow-md transition-all group",children:[n?a.jsx("img",{src:n,alt:r.file_name??"Edition thumbnail",className:"w-16 h-20 object-cover rounded border border-gray-200 flex-shrink-0 shadow-sm"}):i?a.jsx("div",{className:"w-12 h-12 rounded-lg bg-gray-100 flex items-center justify-center flex-shrink-0",children:a.jsx(_e,{className:"w-5 h-5 text-gray-400 animate-spin"})}):a.jsx("div",{className:"w-12 h-12 rounded-lg bg-brand-red/10 flex items-center justify-center flex-shrink-0",children:a.jsx(Bt,{className:"w-6 h-6 text-brand-red"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-headline font-bold text-brand-black text-sm leading-tight group-hover:text-brand-red transition-colors",children:r.file_name??"Edition"}),a.jsx("p",{className:"font-body text-xs text-gray-500 mt-0.5",children:l})]}),a.jsx(Du,{className:"w-5 h-5 text-gray-300 group-hover:text-brand-red transition-colors flex-shrink-0"})]})}function VZ(){const{user:r,signOut:e}=Nf(),[t,n]=k.useState([]),[s,i]=k.useState([]),[o,l]=k.useState(!0);return k.useEffect(()=>{let c=!1;if(!je||!Y){l(!1);return}return(async()=>{try{const[u,d]=await Promise.all([Y.from("subscriber_audio").select("*").order("sort_order",{ascending:!1}).order("created_at",{ascending:!1}),Y.from("digital_paper_archive").select("*").order("edition_date",{ascending:!1}).order("archived_at",{ascending:!1})]);if(c)return;n(u.data??[]),i(d.data??[])}finally{c||l(!1)}})(),()=>{c=!0}},[]),a.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-8",children:[a.jsx(ze,{zone:"leaderboard",page:"/subscriber-extras",className:"mb-6"}),a.jsxs("div",{className:"flex items-start justify-between gap-4 mb-2",children:[a.jsx(Bs,{title:"Subscriber Extras",subtitle:"Audio recordings from meetings & interviews, plus past digital editions"}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0 mt-1",children:[a.jsx("span",{className:"hidden sm:block font-body text-xs text-gray-400 truncate max-w-[180px]",children:r==null?void 0:r.email}),a.jsxs("button",{onClick:e,className:"inline-flex items-center gap-1.5 text-xs font-semibold font-body text-gray-500 hover:text-gray-800 border border-gray-200 rounded-lg px-3 py-1.5 hover:bg-gray-50 transition",children:[a.jsx(kk,{className:"w-3.5 h-3.5"}),"Sign out"]})]})]}),o?a.jsx("div",{className:"flex items-center justify-center py-32",children:a.jsx(_e,{className:"w-8 h-8 text-brand-red animate-spin"})}):a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 mt-8 items-start",children:[a.jsxs("section",{className:"bg-gray-50/70 border border-gray-200 rounded-2xl p-5 sm:p-6",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3 mb-5",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-9 h-9 rounded-lg bg-brand-black flex items-center justify-center",children:a.jsx(bl,{className:"w-4 h-4 text-white"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"font-headline font-bold text-brand-black text-xl",children:"Audio Recordings"}),a.jsx("p",{className:"font-body text-xs text-gray-500",children:"Meetings & interviews"})]})]}),a.jsx("span",{className:"font-body text-xs font-bold text-gray-500 bg-white border border-gray-200 rounded-full px-2.5 py-1",children:t.length})]}),t.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-gray-400 bg-white border border-gray-200 rounded-xl",children:[a.jsx(bl,{className:"w-9 h-9 text-gray-300 mb-3"}),a.jsx("p",{className:"font-headline font-bold text-gray-400 mb-1",children:"No audio recordings yet"}),a.jsx("p",{className:"font-body text-xs text-gray-400",children:"Check back soon for new recordings."})]}):a.jsx("div",{className:"space-y-5",children:t.map(c=>a.jsx(qZ,{audio:c},c.id))})]}),a.jsxs("section",{className:"bg-gray-50/70 border border-gray-200 rounded-2xl p-5 sm:p-6",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3 mb-5",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-9 h-9 rounded-lg bg-brand-red flex items-center justify-center",children:a.jsx(Vs,{className:"w-4 h-4 text-white"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"font-headline font-bold text-brand-black text-xl",children:"Past Editions"}),a.jsx("p",{className:"font-body text-xs text-gray-500",children:"Browse the newsp
1389aper archive"})]})]}),a.jsx("span",{className:"font-body text-xs font-bold text-gray-500 bg-white border border-gray-200 rounded-full px-2.5 py-1",children:s.length})]}),s.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-gray-400 bg-white border border-gray-200 rounded-xl",children:[a.jsx(Vs,{className:"w-9 h-9 text-gray-300 mb-3"}),a.jsx("p",{className:"font-headline font-bold text-gray-400 mb-1",children:"No archived editions yet"}),a.jsx("p",{className:"font-body text-xs text-gray-400",children:"Past editions will appear here when new papers are published."})]}):a.jsx("div",{className:"space-y-4",children:s.map(c=>a.jsx(WZ,{paper:c},c.id))})]})]}),a.jsx("div",{className:"mt-8",children:a.jsxs($e,{to:"/digital-paper",className:"inline-flex items-center gap-2 text-sm font-body text-gray-500 hover:text-brand-black transition",children:[a.jsx(Wd,{className:"w-4 h-4"}),"Back to current Digital Paper"]})}),a.jsx(ze,{zone:"footer",page:"/subscriber-extras",className:"mt-10"})]})}function GZ(){const{user:r,loading:e}=Nf();return e?a.jsx("div",{className:"flex items-center justify-center py-32",children:a.jsx(_e,{className:"w-8 h-8 text-brand-red animate-spin"})}):r?a.jsx(VZ,{}):a.jsx(zZ,{})}const XZ=9;function YZ(){const[r,e]=WD(),[t,n]=k.useState([]),[s,i]=k.useState(null),[o,l]=k.useState(!0),[c,u]=k.useState(r.get("q")??""),[d,h]=k.useState(r.get("q")??""),[f,p]=k.useState(1),m=It(),[g,v]=k.useState({});k.useEffect(()=>{Xs("perspectives").then(v)},[]),k.useEffect(()=>{l(!0);const _=c?ER(c).then(N=>N.filter(S=>S.category==="perspectives")):Rl("perspectives",100);Promise.all([jk("perspectives"),_]).then(([N,S])=>{i(N),n(S.filter(E=>E.id!==(N==null?void 0:N.id)))}).catch(()=>n([])).finally(()=>l(!1))},[c]);const b=t.slice(0,f*XZ),y=b.length<t.length,w=_=>{_.preventDefault(),u(d),p(1),e(d?{q:d}:{})};return a.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-8",children:[a.jsx(ze,{zone:"leaderboard",page:m.pathname,className:"mb-6"}),a.jsx(Bs,{title:g.page_heading||"Perspectives",subtitle:o?"Loading…":`${t.length} ${t.length===1?"piece":"pieces"}`}),!c&&!o&&s&&a.jsx("div",{className:"mb-8",children:a.jsx(Kx,{article:s})}),a.jsxs("form",{onSubmit:w,className:"flex gap-2 mb-6",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(nf,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),a.jsx("input",{type:"text",value:d,onChange:_=>h(_.target.value),placeholder:"Search perspectives...",className:"w-full pl-9 pr-4 py-2.5 border border-gray-300 text-sm focus:outline-none focus:border-brand-red font-body"})]}),a.jsx("button",{type:"submit",className:"bg-brand-red hover:bg-brand-red-dark text-white px-5 py-2.5 text-sm font-semibold transition-colors font-body",children:"Search"}),c&&a.jsx("button",{type:"button",onClick:()=>{u(""),h(""),e({})},className:"px-4 py-2.5 border border-gray-300 text-sm text-gray-600 hover:bg-gray-50 font-body",children:"Clear"})]}),a.jsxs("div",{className:"flex flex-row gap-3 sm:gap-6 lg:gap-8 items-start",children:[a.jsxs("main",{className:"flex-1 min-w-0",children:[o?a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx(_e,{className:"w-8 h-8 animate-spin text-brand-red"})}):t.length===0?a.jsxs("div",{className:"text-center py-16",children:[a.jsx(kU,{className:"w-12 h-12 mx-auto text-gray-300 mb-3"}),a.jsx("p",{className:"font-headline text-xl text-gray-500",children:g.empty_heading||"No perspectives published yet"}),a.jsx("p",{className:"font-body text-sm text-gray-400 mt-1",children:c?"Try different keywords.":g.empty_text||"Op-eds, commentary, and columns will appear here."})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex flex-col gap-4",children:b.map(_=>a.jsxs($e,{to:`/article/${_.slug}`,className:"group flex flex-col sm:flex-row gap-5 bg-white border border-gray-200 hover:border-gray-300 hover:shadow-md transition-all p-4",children:[_.image_url?a.jsx(Mr,{src:_.image_url,alt:_.title,imageId:_.id,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-500",containerClassName:"w-full sm:w-56 aspect-[4/3] flex-shrink-0 bg-gray-100",loading:"lazy"}):a.jsx("div",{className:"w-full sm:w-56 aspect-[4/3] flex-shrink-0 bg-gray-100 border border-gray-200"}),a.jsxs("div",{className:"flex-1 min-w-0 flex flex-col justify-between py-1",children:[a.jsxs("div",{children:[a.jsx(Uo,{category:_.category}),a.jsx("h3",{className:"font-headline font-bold text-brand-black group-hover:text-brand-red transition-colors text-lg leading-snug mt-1.5 line-clamp-2",children:_.title}),a.jsx("p",{className:"font-body text-gray-600 text-sm mt-2 leading-relaxed line-clamp-3",children:_.excerpt})]}),a.jsxs("div",{className:"flex items-center gap-4 mt-3 text-xs text-gray-400 font-body",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(Wl,{className:"w-3 h-3"}),_.author]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(zr,{className:"w-3 h-3"}),xi(_.published_at)]})]})]})]},_.id))}),y&&a.jsx("div",{className:"text-center mt-8",children:a.jsx("button",{onClick:()=>p(_=>_+1),className:"border-2 border-brand-black hover:bg-brand-black hover:text-white text-brand-black font-semibold px-8 py-3 text-sm transition-colors font-body",children:"Load More"})})]}),a.jsx(ze,{zone:"in-content",page:m.pathname,className:"mt-8"})]}),a.jsx(Jx,{})]}),a.jsx(ze,{zone:"footer",page:m.pathname,className:"mt-8"})]})}function l3({className:r}
1389){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:r,"aria-hidden":"true",children:a.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-4.714-6.231-5.401 6.231H2.747l7.73-8.835L1.254 2.25H8.08l4.258 5.624L18.244 2.25zm-1.161 17.52h1.833L7.084 4.126H5.117L17.083 19.77z"})})}function KZ(){return a.jsxs("div",{className:"bg-gray-200 rounded-lg overflow-hidden animate-pulse",children:[a.jsx("div",{className:"aspect-square bg-gray-300"}),a.jsxs("div",{className:"p-3",children:[a.jsx("div",{className:"h-3 bg-gray-300 rounded w-3/4 mb-1.5"}),a.jsx("div",{className:"h-3 bg-gray-300 rounded w-1/3"})]})]})}function JZ({message:r}){return a.jsx("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 z-[200] bg-brand-black text-white text-sm font-body px-5 py-3 rounded-full shadow-lg animate-fade-in",children:r})}async function c3(r,e){try{const n=await(await fetch(r)).blob(),s=URL.createObjectURL(n),i=document.createElement("a");i.href=s,i.download=e||"photo",document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(s)}catch{window.open(r,"_blank")}}function ZZ(r){return r.includes("youtube-nocookie.com/embed")||r.includes("youtube.com/embed")}function b6(r){return r.includes("player.vimeo.com")}function QZ(r){return ZZ(r)||b6(r)}function x6(r){try{const e=new URL(r);return e.hostname.includes("facebook.com")||e.hostname.includes("fb.watch")}catch{return!1}}function eQ(r){const e=r.match(/\/embed\/([^?&/]+)/);return e?e[1]:null}function tQ(r){const n=Math.max(0,(window.screen.width-900)/2),s=Math.max(0,(window.screen.height-600)/2);window.open(r,"fb_video",`width=900,height=600,left=${n},top=${s},scrollbars=no,resizable=yes`)}function rQ({url:r}){const[e,t]=k.useState(!1),n=eQ(r);return n&&!e?a.jsx("img",{src:`https://img.youtube.com/vi/${n}/hqdefault.jpg`,alt:"Video thumbnail",loading:"lazy",className:"w-full h-full object-cover",onError:()=>t(!0)}):x6(r)?a.jsx("div",{className:"w-full h-full bg-[#1877F2] flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 24 24",className:"w-12 h-12 fill-white/70","aria-hidden":"true",children:a.jsx("path",{d:"M24 12.073C24 5.405 18.627 0 12 0S0 5.405 0 12.073C0 18.1 4.388 23.094 10.125 24v-8.437H7.078v-3.49h3.047V9.41c0-3.025 1.792-4.697 4.533-4.697 1.312 0 2.686.235 2.686.235v2.97h-1.513c-1.491 0-1.956.93-1.956 1.874v2.25h3.328l-.532 3.49h-2.796V24C19.612 23.094 24 18.1 24 12.073z"})})}):b6(r)?a.jsx("div",{className:"w-full h-full bg-[#1ab7ea] flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 24 24",className:"w-12 h-12 fill-white/70","aria-hidden":"true",children:a.jsx("path",{d:"M23.977 6.416c-.105 2.338-1.739 5.543-4.894 9.609-3.268 4.247-6.026 6.37-8.29 6.37-1.409 0-2.578-1.294-3.553-3.881L5.322 11.4C4.603 8.816 3.834 7.522 3.01 7.522c-.179 0-.806.378-1.881 1.132L0 7.197a315.065 315.065 0 0 0 3.501-3.128C5.08 2.74 6.266 1.983 7.055 1.91c1.867-.18 3.016 1.1 3.447 3.838.465 2.953.789 4.789.971 5.507.539 2.45 1.131 3.674 1.776 3.674.502 0 1.256-.796 2.265-2.385 1.004-1.589 1.54-2.797 1.612-3.628.144-1.371-.395-2.061-1.614-2.061-.574 0-1.167.132-1.777.396 1.18-3.86 3.43-5.733 6.75-5.617 2.464.088 3.62 1.67 3.492 4.782z"})})}):a.jsx("div",{className:"w-full h-full bg-gray-800 flex items-center justify-center",children:a.jsx(vi,{className:"w-10 h-10 text-white/40"})})}function nQ({url:r,title:e}){return a.jsxs("div",{className:"aspect-video w-full relative overflow-hidden bg-gradient-to-br from-[#1a1a2e] via-[#16213e] to-[#0f3460] flex flex-col items-center justify-center gap-5",children:[a.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:a.jsx("div",{className:"w-64 h-64 rounded-full bg-[#1877F2]/20 blur-3xl"})}),a.jsxs("div",{className:"relative flex flex-col items-center gap-1",children:[a.jsx("div",{className:"w-16 h-16 rounded-2xl bg-[#1877F2] flex items-center justify-center shadow-xl shadow-[#1877F2]/40",children:a.jsx("svg",{viewBox:"0 0 24 24",className:"w-9 h-9 fill-white","aria-hidden":"true",children:a.jsx("path",{d:"M24 12.073C24 5.405 18.627 0 12 0S0 5.405 0 12.073C0 18.1 4.388 23.094 10.125 24v-8.437H7.078v-3.49h3.047V9.41c0-3.025 1.792-4.697 4.533-4.697 1.312 0 2.686.235 2.686.235v2.97h-1.513c-1.491 0-1.956.93-1.956 1.874v2.25h3.328l-.532 3.49h-2.796V24C19.612 23.094 24 18.1 24 12.073z"})})}),a.jsx("span",{className:"text-white/50 text-xs font-body tracking-widest uppercase mt-1",children:"Facebook Video"})]}),e&&a.jsx("p",{className:"relative text-white font-headline font-bold text-base text-center px-8 leading-snug max-w-sm",children:e}),a.jsxs("button",{onClick:()=>tQ(r),className:"relative flex items-center gap-3 bg-[#1877F2] hover:bg-[#166fe5] active:bg-[#1464d2] text-white font-body font-bold text-sm px-7 py-3 rounded-full transition-all duration-150 shadow-lg shadow-[#1877F2]/50 hover:shadow-xl hover:shadow-[#1877F2]/60 hover:scale-105",children:[a.jsx(kf,{className:"w-4 h-4 fill-current"}),"Watch on Facebook"]}),a.jsx("p",{className:"relative text-white/30 text-xs font-body",children:"Opens in a popup window"})]})}function sQ({item:r,liked:e,onLike:t,onClose:n}){const s=r.media_type==="video",i=r.title||"Check out this from Dixie County Advocate",[o,l]=k.useState(!1),c=`${window.location.origin}/this-weeks-pics?photo=${r.id}`,[u,d]=k.useState(""),h=async p=>{var m;if(!s){try{const g=await fetch(r.url);if(!g.ok)throw new Error("Unable to load photo");const v=await g.blob(),b=v.type.split("/")[1]||"jpg",y=new File([v],`${r.title||"this-weeks-pic"}.${b}`,{type:v.type});if(navigator.share&&((m=navigator.canShare)!=null&&m.call(navigator,{files:[y]}))){await navigator.share({files:[y],title:i,text:i});return}}catch(g){if(g instanceof DOMException&&g.name==="AbortError")return}await c3(r.url,r.title||"this-weeks-pic"),d(`Photo downloaded. Attach it to your ${p==="Text"?"text message":p+" post"}.`),window.setTimeout(()=>d(""),5e3)}},f=async()=>{try{await navigator.clipboard.writeText(c),l(!0),setTimeout(()=>l(!1),2e3)}catch{const p=document.createElement("textarea");p.value=c,document.body.appendChild(p),p.select(),document.execCommand("copy"),document.body.removeChild(p),l(!0),setTimeout(()=>l(!1),2e3)}};return a.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/85",role:"dialog","aria-modal":"true","aria-label":r.title||(s?"Video":"Photo"),onClick:n,children:a.jsxs("div",{className:"relative max-w-4xl w-full mx-4 flex flex-col items-center",onClick:p=>p.stopPropagation(),children:[a.jsx("button",{onClick:n,className:"absolute -top-10 right-0 w-9 h-9 rounded-full bg-white/15 hover:bg-white/30 text-white flex items-center justify-center transition-colors duration-150 z-10","aria-label":"Close",children:a.jsx(tt,{className:"w-5 h-5"})}),a.jsxs("div",{className:"relative w-full rounded-lg overflow-hidden shadow-2xl bg-black",children:[s?x6(r.url)?a.jsx(nQ,{url:r.url,title:r.title}):QZ(r.url)?a.jsx("div",{className:"aspect-video w-full",children:a.jsx("iframe",{src:`${r.url}?autoplay=1`,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",sandbox:"allow-scripts allow-same-origin allow-presentation allow-popups allow-popups-to-escape-sandbox",allowFullScreen:!0,title:r.title||"Video"})}):a.jsx("video",{src:r.url,controls:!0,autoPlay:!0,className:"w-full max-h-[80vh]"}):a.jsxs(a.Fragment,{children:[a.jsx("img",{src:r.url,alt:r.title||"Community photo",className:"w-full max-h-[80vh] object-contain"}),a.jsxs("div",{className:"absolute bottom-0 left-0 right-0 flex items-center justify-center gap-3 px-4 py-3 bg-black/40 flex-wrap",children:[a.jsxs("button",{onClick:()=>t(r.id),title:"Like",className:`flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-semibold font-body shadow transition-all duration-150 hover:scale-105 ${e?"bg-brand-red text-white":"bg-white/90 text-gray-800 hover:text-brand-red"}`,children:[a.jsx(jl,{className:`w-3.5 h-3.5 ${e?"fill-current":""}`}),a.jsx("span",{children:r.likes})]}),a.jsxs("button",{onClick:()=>c3(r.url,r.title),title:"Download",className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-white/90 text-gray-800 hover:text-brand-black text-xs font-semibold font-body shadow hover:scale-105 transition-all duration-150",children:[a.jsx(Du,{className:"w-3.5 h-3.5"}),a.jsx("span",{children:"Download"})]}),a.jsxs("button",{onClick:()=>h("Text"),title:"Send this photo via text message",className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-green-600 text-white text-xs font-semibold font-body shadow hover:scale-105 hover:opacity-90 transition-all duration-150",children:[a.jsx(sA,{className:"w-3.5 h-3.5"}),a.jsx("span",{children:"Text Photo"})]}),a.jsxs("button",{onClick:()=>h("X"),title:"Share this photo on X",className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-black text-white text-xs font-semibold font-body shadow hover:scale-105 hover:opacity-80 transition-all duration-150",children:[a.jsx(l3,{className:"w-3.5 h-3.5"}),a.jsx("span",{children:"X Photo"})]}),a.jsxs("button",{onClick:f,title:"Copy link",className:`flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-semibold font-body shadow transition-all duration-150 hover:scale-105 ${o?"bg-green-500 text-white":"bg-white/90 text-gray-800 hover:text-brand-black"}`,children:[o?a.jsx(At,{className:"w-3.5 h-3.5"}):a.jsx(rA,{className:"w-3.5 h-3.5"}),a.jsx("span",{children:o?"Copied!":"Copy Link"})]})]})]}),s&&a.jsxs("div",{className:"flex items-center justify-center gap-3 px-4 py-3 bg-black/60 flex-wrap",children:[a.jsxs("button",{onClick:()=>t(r.id),title:"Like",className:`flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-semibold font-body shadow transition-all duration-150 hover:scale-105 ${e?"bg-brand-red text-white":"bg-white/90 text-gray-800 hover:text-brand-red"}`,children:[a.jsx(jl,{className:`w-3.5 h-3.5 ${e?"fill-current":""}`}),a.jsx("span",{children:r.likes})]}),a.jsxs("button",{onClick:()=>h("Text"),title:"Send this photo via text message",className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-green-600 text-white text-xs font-semibold font-body shadow hover:scale-105 hover:opacity-90 transition-all duration-150",children:[a.jsx(sA,{className:"w-3.5 h-3.5"}),a.jsx("span",{children:"Text Photo"})]}),a.jsxs("button",{onClick:()=>h("X"),title:"Share this photo on X",className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-black text-white text-xs font-semibold font-body shadow hover:scale-105 hover:opacity-80 transition-all duration-150",children:[a.jsx(l3,{className:"w-3.5 h-3.5"}),a.jsx("span",{children:"X Photo"})]}),a.jsxs("button",{onClick:f,title:"Copy link",className:`flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-semibold font-body shadow transition-all duration-150 hover:scale-105 ${o?"bg-green-500 text-white":"bg-white/90 text-gray-800 hover:text-brand-black"}`,children:[o?a.jsx(At,{className:"w-3.5 h-3.5"}):a.jsx(rA,{className:"w-3.5 h-3.5"}),a.jsx("span",{children:o?"Copied!":"Copy Link"})]})]})]}),u&&a.jsx("p",{className:"mt-3 rounded-lg bg-white px-4 py-2 text-brand-black font-body text-sm text-center shadow-lg",role:"status",children:u}),r.title&&a.jsx("p",{className:"mt-3 text-white/80 font-body text-sm text-center",children:r.title})]})})}function iQ({item:r,onClick:e}){const[t,n]=k.useState(!1),s=r.media_type==="video";return a.jsxs("button",{onClick:e,className:"group relative bg-white rounded-lg overflow-hidden shadow-sm hover:shadow-md transition-shadow duration-200 border border-gray-100 text-left w-full cursor-pointer",children:[a.jsx("div",{className:"aspect-square overflow-hidden bg-gray-100 relative",children:s?a.jsxs(a.Fragment,{children:[a.jsx(rQ,{url:r.url}),a.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/20 group-hover:bg-black/30 transition-colors duration-200",children:a.jsx("div",{className:"w-14 h-14 roun
1389ded-full bg-black/40 group-hover:bg-black/60 flex items-center justify-center transition-colors duration-200 shadow-lg",children:a.jsx(kf,{className:"w-7 h-7 text-white fill-white ml-0.5"})})}),a.jsxs("span",{className:"absolute top-2 left-2 bg-black/60 text-white text-[10px] font-bold px-1.5 py-0.5 rounded flex items-center gap-1",children:[a.jsx(vi,{className:"w-2.5 h-2.5"})," VIDEO"]})]}):a.jsxs(a.Fragment,{children:[!t&&a.jsx("div",{className:"w-full h-full bg-gray-200 animate-pulse"}),a.jsx("img",{src:r.url,alt:r.title||"Community photo",loading:"lazy",onLoad:()=>n(!0),className:`w-full h-full object-cover transition-transform duration-300 group-hover:scale-105 ${t?"opacity-100":"opacity-0 absolute inset-0"}`})]})}),a.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/20 transition-colors duration-200 pointer-events-none rounded-lg"}),a.jsxs("div",{className:"px-3 py-2.5",children:[r.title&&a.jsx("p",{className:"font-body text-sm font-medium text-brand-black leading-tight truncate",children:r.title}),a.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[a.jsx(jl,{className:`w-3 h-3 ${r.likes>0?"text-brand-red":"text-gray-400"}`}),a.jsx("span",{className:"text-xs text-gray-500 font-body",children:r.likes})]})]})]})}function v6(r){const e=new Date(r),t=e.getDay();return e.setDate(e.getDate()+(t===0?-6:1-t)),e.setHours(0,0,0,0),e}function aQ(r){return v6(new Date(r)).toISOString().split("T")[0]}function p2(){return aQ(new Date().toISOString())}function u3(r){const e=new Date(r+"T12:00:00"),t=new Date(e);t.setDate(t.getDate()+6);const n=(s,i=!1)=>s.toLocaleDateString("en-US",{month:"short",day:"numeric",...i?{year:"numeric"}:{}});return`${n(e)} – ${n(t,!0)}`}function oQ(){const[r,e]=k.useState([]),[t,n]=k.useState(!0),[s,i]=k.useState(new Set),[o,l]=k.useState(""),[c,u]=k.useState(null),[d,h]=k.useState(p2()),f=k.useRef(!1);k.useEffect(()=>{if(!je||!Y){n(!1);return}const w=v6(new Date).toISOString().split("T")[0];Y.from("gallery_images").select("*").lte("issue_week_start",w).order("created_at",{ascending:!1}).then(({data:_})=>{e(_??[]),n(!1)})},[]),k.useEffect(()=>{if(f.current||t||r.length===0)return;f.current=!0;const _=new URLSearchParams(window.location.search).get("photo");if(_){const N=r.find(S=>S.id===_);N&&(u(N),N.issue_week_start&&h(N.issue_week_start))}},[t,r]),k.useEffect(()=>{if(!c)return;const w=r.find(_=>_.id===c.id);w&&w.likes!==c.likes&&u(w)},[r,c]);const p=k.useCallback(async w=>{s.has(w)||(i(_=>new Set(_).add(w)),e(_=>_.map(N=>N.id===w?{...N,likes:N.likes+1}:N)),je&&Y&&await Y.rpc("increment_gallery_likes",{image_id:w}))},[s]),m=k.useMemo(()=>{const w=new Map;for(const _ of r){const N=_.issue_week_start;w.has(N)||w.set(N,[]),w.get(N).push(_)}return w},[r]),g=k.useMemo(()=>[...new Set([...m.keys(),p2()])].sort((_,N)=>N.localeCompare(_)),[m]),v=m.get(d)??[],b=p2(),y=g.some(w=>{var _;return w!==b&&(((_=m.get(w))==null?void 0:_.length)??0)>0});return a.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-8",children:[a.jsx(ze,{zone:"leaderboard",page:"/this-weeks-pics",className:"mb-6"}),a.jsx(Bs,{title:"This Week's Pics",subtitle:"Photos and videos from around Dixie County"}),!t&&y&&a.jsxs("div",{className:"mt-5 mb-1 flex flex-col sm:flex-row sm:items-center gap-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm font-body text-gray-600",children:[a.jsx(ha,{className:"w-4 h-4 text-brand-red flex-shrink-0"}),a.jsx("span",{className:"font-semibold text-brand-black",children:"Browse Issues:"})]}),a.jsxs("div",{className:"relative inline-flex items-center",children:[a.jsx("select",{value:d,onChange:w=>h(w.target.value),className:"font-body text-sm bg-white border border-gray-300 hover:border-brand-red rounded px-3 py-2 pr-9 appearance-none cursor-pointer text-brand-black focus:outline-none focus:ring-2 focus:ring-brand-red/30 focus:border-brand-red transition-colors min-w-[240px]",children:g.map(w=>{var S;const _=((S=m.get(w))==null?void 0:S.length)??0,N=w===b;return a.jsxs("option",{value:w,children:[N?"Current Issue":"Issue",": ",u3(w),_>0?` (${_})`:" — no photos yet"]},w)})}),a.jsx(Ws,{className:"w-4 h-4 text-gray-400 absolute right-2.5 pointer-events-none"})]}),d!==b&&a.jsx("button",{onClick:()=>h(b),className:"text-xs font-body font-semibold text-brand-red hover:underline",children:"Back to current issue"})]}),!t&&a.jsxs("div",{className:"mt-4 mb-1 flex items-center justify-between",children:[a.jsxs("p",{className:"font-body text-xs text-gray-400 uppercase tracking-widest",children:[d===b?"Current Issue":"Past Issue"," — ",u3(d)]}),v.length>0&&a.jsxs("p",{className:"font-body text-xs text-gray-400",children:[v.length," ",v.length===1?"item":"items"]})]}),t?a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 mt-4",children:Array.from({length:8}).map((w,_)=>a.jsx(KZ,{},_))}):v.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-gray-400 border border-dashed border-gray-200 rounded-lg mt-4",children:[a.jsx(ia,{className:"w-12 h-12 mb-4 opacity-30"}),a.jsx("p",{className:"font-headline text-lg font-bold text-gray-400 mb-1",children:d===b?"No photos yet this week":"No photos for this issue"}),a.jsx("p",{className:"font-body text-sm text-center max-w-xs",children:d===b?"Check back soon — photos are added throughout the week.":"No photos were uploaded for this issue."}),y&&d===b&&a.jsx("button",{onClick:()=>h(g.find(w=>{var _;return w!==b&&(((_=m.get(w))==null?void 0:_.length)??0)>0}
1389)??b),className:"mt-4 text-sm font-semibold font-body text-brand-red hover:underline",children:"View last issue's photos"})]}):a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 mt-4",children:v.map(w=>a.jsx(iQ,{item:w,onClick:()=>u(w)},w.id))}),a.jsx(ze,{zone:"footer",page:"/this-weeks-pics",className:"mt-10"}),c&&a.jsx(sQ,{item:c,liked:s.has(c.id),onLike:p,onClose:()=>u(null)}),o&&a.jsx(JZ,{message:o})]})}function lQ(){const{signIn:r,signUp:e}=Nf(),[t,n]=k.useState("sign-in"),[s,i]=k.useState(""),[o,l]=k.useState(""),[c,u]=k.useState(!1),[d,h]=k.useState(!1),[f,p]=k.useState(""),[m,g]=k.useState("");async function v(b){if(b.preventDefault(),!(!s.trim()||!o.trim())){if(p(""),g(""),h(!0),t==="sign-in"){const{error:y}=await r(s.trim(),o);y&&p("That email and password combination did not work.")}else{const{error:y}=await e(s.trim(),o);y?p("We could not create that account. Please check your details and try again."):(g("Account created! Check your email to confirm, then sign in below."),n("sign-in"),l(""))}h(!1)}}return a.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-8",children:[a.jsx(ze,{zone:"leaderboard",page:"/digital-paper",className:"mb-6"}),a.jsxs("div",{className:"max-w-2xl mx-auto mt-4",children:[a.jsxs("div",{className:"bg-brand-black text-white rounded-t-2xl px-8 py-10 text-center",children:[a.jsx("div",{className:"flex items-center justify-center gap-3 mb-5",children:a.jsx("div",{className:"w-14 h-14 rounded-2xl bg-white/10 flex items-center justify-center",children:a.jsx(Vs,{className:"w-8 h-8 text-white"})})}),a.jsx("h1",{className:"font-masthead text-3xl font-bold leading-tight mb-2",children:"Digital Edition"}),a.jsx("p",{className:"font-headline italic text-white/70 text-base",children:"Dixie County Advocate — delivered every week"})]}),a.jsxs("div",{className:"bg-white border border-t-0 border-gray-200 rounded-b-2xl shadow-lg px-8 py-8",children:[a.jsx("div",{className:"flex justify-center mb-6",children:a.jsxs("span",{className:"inline-flex items-center gap-2 bg-amber-50 border border-amber-200 text-amber-800 text-xs font-semibold px-4 py-1.5 rounded-full",children:[a.jsx(Sk,{className:"w-3.5 h-3.5"}),"Subscriber access only"]})}),a.jsx("p",{className:"text-center font-body text-sm text-gray-600 mb-6 leading-relaxed",children:t==="sign-in"?"Sign in to your subscriber account to read this week's edition.":"Create an account to access your digital subscription."}),a.jsxs("div",{className:"flex bg-gray-100 rounded-xl p-1 gap-1 mb-6",children:[a.jsxs("button",{type:"button",onClick:()=>{n("sign-in"),p(""),g("")},className:`flex-1 flex items-center justify-center gap-1.5 py-2 rounded-lg text-sm font-semibold font-body transition-all ${t==="sign-in"?"bg-white text-brand-black shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:[a.jsx(Ab,{className:"w-3.5 h-3.5"}),"Sign In"]}),a.jsxs("button",{type:"button",onClick:()=>{n("create-account"),p(""),g("")},className:`flex-1 flex items-center justify-center gap-1.5 py-2 rounded-lg text-sm font-semibold font-body transition-all ${t==="create-account"?"bg-white text-brand-black shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:[a.jsx(Nu,{className:"w-3.5 h-3.5"}),"Create Account"]})]}),f&&a.jsx("div",{className:"mb-4 bg-red-50 border border-red-200 text-red-700 text-sm font-body rounded-lg px-4 py-3",children:f}),m&&a.jsx("div",{className:"mb-4 bg-green-50 border border-green-200 text-green-800 text-sm font-body rounded-lg px-4 py-3",children:m}),a.jsxs("form",{onSubmit:v,className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1.5 font-body",children:"Email address"}),a.jsx("input",{type:"email",required:!0,value:s,onChange:b=>i(b.target.value),placeholder:"[email protected]",className:"w-full border border-gray-300 rounded-xl px-4 py-2.5 text-sm font-body focus:outline-none focus:border-brand-black focus:ring-1 focus:ring-brand-black/20 transition"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1.5 font-body",children:"Password"}),a.jsxs("div",{className:"relative",children:[a.jsx("input",{type:c?"text":"password",required:!0,value:o,onChange:b=>l(b.target.value),placeholder:t==="create-account"?"Choose a password":"Your password",className:"w-full border border-gray-300 rounded-xl px-4 py-2.5 pr-10 text-sm font-body focus:outline-none focus:border-brand-black focus:ring-1 focus:ring-brand-black/20 transition"}),a.jsx("button",{type:"button",onClick:()=>u(b=>!b),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",tabIndex:-1,
1389children:c?a.jsx(Hg,{className:"w-4 h-4"}):a.jsx(zg,{className:"w-4 h-4"})})]})]}),a.jsx("button",{type:"submit",disabled:d,className:"w-full py-3 rounded-xl bg-brand-black text-white text-sm font-bold font-body flex items-center justify-center gap-2 hover:bg-gray-800 disabled:opacity-50 transition-all",children:d?a.jsx(_e,{className:"w-4 h-4 animate-spin"}):t==="sign-in"?a.jsxs(a.Fragment,{children:[a.jsx(Ab,{className:"w-4 h-4"})," Sign In"]}):a.jsxs(a.Fragment,{children:[a.jsx(Nu,{className:"w-4 h-4"})," Create Account"]})})]}),a.jsxs("div",{className:"mt-6 pt-6 border-t border-gray-100 text-center",children:[a.jsx("p",{className:"font-body text-sm text-gray-500 mb-3",children:"Don't have a subscription yet?"}),a.jsxs($e,{to:"/subscribe",className:"inline-flex items-center gap-2 bg-brand-red text-white text-sm font-bold font-body px-6 py-2.5 rounded-xl hover:bg-red-700 transition-all shadow-sm",children:[a.jsx(Vs,{className:"w-4 h-4"}),"View Subscription Plans"]})]})]})]}),a.jsx(ze,{zone:"footer",page:"/digital-paper",className:"mt-10"})]})}function cQ(){const{user:r,signOut:e}=Nf(),[t,n]=k.useState(null),[s,i]=k.useState(!0),[o,l]=k.useState(!1),[c,u]=k.useState("");k.useEffect(()=>{let h=!1;if(!je||!Y){i(!1);return}return(async()=>{try{const{data:f}=await Y.from("digital_paper").select("pdf_url, file_name, uploaded_at").order("uploaded_at",{ascending:!1}).limit(1).maybeSingle();if(h)return;if(n(f??null),f){const p=await Zp(f.pdf_url);h||u(p??"")}}finally{h||i(!1)}})(),()=>{h=!0}},[]);const d=t?new Date(t.uploaded_at).toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"}):null;return a.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-8",children:[a.jsx(ze,{zone:"leaderboard",page:"/digital-paper",className:"mb-6"}),a.jsxs("div",{className:"flex items-start justify-between gap-4 mb-2",children:[a.jsx(Bs,{title:"Digital Paper",subtitle:"Read this week's edition of the Dixie County Advocate online"}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0 mt-1",children:[a.jsx("span",{className:"hidden sm:block font-body text-xs text-gray-400 truncate max-w-[180px]",children:r==null?void 0:r.email}),a.jsxs("button",{onClick:e,className:"inline-flex items-center gap-1.5 text-xs font-semibold font-body text-gray-500 hover:text-gray-800 border border-gray-200 rounded-lg px-3 py-1.5 hover:bg-gray-50 transition",children:[a.jsx(kk,{className:"w-3.5 h-3.5"}),"Sign out"]})]})]}),s?a.jsx("div",{className:"flex items-center justify-center py-32",children:a.jsx(_e,{className:"w-8 h-8 text-brand-red animate-spin"})}):t?a.jsxs("div",{className:"mt-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-9 h-9 rounded-lg bg-brand-red/10 flex items-center justify-center",children:a.jsx(Bt,{className:"w-5 h-5 text-brand-red"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-headline font-bold text-brand-black text-sm leading-tight",children:t.file_name??"Current Edition"}),a.jsxs("p",{className:"font-body text-xs text-gray-500",children:["Published ",d]})]})]}),a.jsxs("div",{className:"flex items-center gap-2 self-start sm:self-auto",children:[a.jsxs("a",{href:c,download:!0,className:"inline-flex items-center gap-2 bg-white border border-gray-300 hover:border-gray-400 text-gray-700 text-sm font-semibold font-body px-4 py-2 rounded transition-colors shadow-sm",children:[a.jsx(Du,{className:"w-3.5 h-3.5"}),"Download"]}),a.jsxs("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 bg-brand-red hover:bg-brand-red-dark text-white text-sm font-semibold font-body px-4 py-2 rounded transition-colors shadow-sm",children:[a.jsx(vu,{className:"w-3.5 h-3.5"}),"Open PDF"]})]})]}),o?a.jsxs("div",{className:"w-full rounded-xl border border-gray-200 bg-gray-50 flex flex-col items-center justify-center py-24 gap-5",children:[a.jsx("div",{className:"w-16 h-16 rounded-full bg-brand-red/10 flex items-center justify-center",children:a.jsx(Bt,{className:"w-8 h-8 text-brand-red"})}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"font-headline font-bold text-gray-700 text-lg mb-1",children:"PDF preview unavailable"}),a.jsx("p",{className:"font-body text-sm text-gray-500 max-w-xs",children:"Your browser blocked the inline preview. Use the buttons above to open or download the PDF."})]}),a.jsxs("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 bg-brand-red hover:bg-brand-red-dark text-white text-sm font-semibold font-body px-6 py-2.5 rounded transition-colors shadow-sm",children:[a.jsx(vu,{className:"w-4 h-4"}),"Open PDF in New Tab"]})]}):a.jsx("div",{className:"w-full rounded-xl overflow-hidden border border-gray-200 shadow-sm bg-gray-100",children:a.jsx("object",{data:c,type:"application/pdf",className:"w-full",style:{minHeight:"82vh"},onError:()=>l(!0),children:a.jsx("embed",{src:c,type:"application/pdf",className:"w-full",style:{minHeight:"82vh"},onError:()=>l(!0)})})})]}):a.jsxs("div",{className:"flex flex-col items-center justify-center py-32 text-gray-400",children:[a.jsx("div",{className:"w-20 h-20 rounded-full bg-gray-100 flex items-center justify-center mb-5",children:a.jsx(Bt,{className:"w-10 h-10 text-gray-300"})}),a.jsx("p",{className:"font-headline text-xl font-bold text-gray-400 mb-2",children:"No digital paper available yet"}),a.jsx("p",{className:"font-body text-sm text-gray-400",children:"Check back soon — the current edition will appear here."})]}),a.jsx(ze,{zone:"footer",page:"/digital-paper",className:"mt-10"})]})}function uQ(){const{user:r,loading:e}=Nf();return e?a.jsx("div",{className:"flex items-center justify-center min-h-[60vh]",children:a.jsx(_e,{className:"w-8 h-8 text-brand-red animate-spin"})}):r?a.jsx(cQ,{}):a.jsx(lQ,{})}const Yv={local:"Local News",sports:"Sports",community:"Community",opinion:"Opinion",obituaries:"Obituaries",notices:"Public Notices",entertainment:"Entertainment",gilchrist:"Gilchrist News",perspectives:"Perspectives"};async function dQ(r=30){if(!Y)return[];const{data:e,error:t}=await Y.from("stories").select("*").eq("published",!0).order("created_at",{ascending:!1}).limit(r);if(t)throw new Error(t.message);return e??[]}async function hQ(r,e=20){if(!Y)return[];const{data:t,error:n}=await Y.from("stories").select("*").eq("published",!0).eq("category",r).order("sort_order",{ascending:!0,nullsFirst:!1}).order("created_at",{ascending:!1}).limit(e);
1389if(n)throw new Error(n.message);return t??[]}async function fQ(r){if(!Y)return null;const{data:e,error:t}=await Y.from("stories").select("*").eq("id",r).eq("published",!0).maybeSingle();if(t)throw new Error(t.message);return e}function m2({category:r}){return a.jsx("span",{className:"inline-block font-body text-xs font-bold uppercase tracking-widest text-brand-red",children:Yv[r]??r})}function g2({story:r,size:e="sm"}){return e==="hero"?a.jsx($e,{to:`/stories/${r.id}`,className:"group block",children:a.jsxs("div",{className:"relative overflow-hidden rounded-xl bg-gray-100",children:[r.image_url?a.jsx(Mr,{src:r.image_url,alt:r.title,imageId:r.id,className:"w-full h-96 object-cover group-hover:scale-[1.02] transition-transform duration-500",containerClassName:"w-full h-96"}):a.jsx("div",{className:"w-full h-96 bg-gradient-to-br from-gray-200 to-gray-300 flex items-center justify-center",children:a.jsx("span",{className:"font-headline text-4xl text-gray-400 font-bold",children:"DCA"})}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/75 via-black/20 to-transparent pointer-events-none"}),a.jsxs("div",{className:"absolute bottom-0 left-0 right-0 p-6",children:[a.jsx(m2,{category:r.category}),a.jsx("h2",{className:"font-headline text-2xl md:text-3xl font-bold text-white mt-2 leading-tight group-hover:text-gray-200 transition-colors line-clamp-3",children:r.title}),a.jsxs("div",{className:"flex items-center gap-3 mt-3 text-white/70 text-xs font-body",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(Wl,{className:"w-3 h-3"}),r.author]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(zr,{className:"w-3 h-3"}),new Date(r.created_at).toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"})]})]})]})]})}):e==="featured"?a.jsxs($e,{to:`/stories/${r.id}`,className:"group block",children:[a.jsx("div",{className:"overflow-hidden rounded-lg bg-gray-100",children:r.image_url?a.jsx(Mr,{src:r.image_url,alt:r.title,imageId:r.id,className:"w-full h-52 object-cover group-hover:scale-[1.02] transition-transform duration-500",containerClassName:"w-full h-52"}):a.jsx("div",{className:"w-full h-52 bg-gradient-to-br from-gray-200 to-gray-300 flex items-center justify-center",children:a.jsx("span",{className:"font-headline text-xl text-gray-400 font-bold",children:"DCA"})})}),a.jsxs("div",{className:"mt-3",children:[a.jsx(m2,{category:r.category}),a.jsx("h3",{className:"font-headline text-lg font-bold text-gray-900 mt-1 leading-snug group-hover:text-brand-red transition-colors line-clamp-3",children:r.title}),a.jsxs("p",{className:"font-body text-xs text-gray-400 mt-2",children:[r.author," · ",new Date(r.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric"})]})]})]}):a.jsxs($e,{to:`/stories/${r.id}`,className:"group flex gap-3 py-3 border-b border-gray-100 last:border-0",children:[r.image_url&&a.jsx(Mr,{src:r.image_url,alt:r.title,imageId:r.id,className:"w-full h-full object-cover",containerClassName:"w-16 h-16 rounded shrink-0 bg-gray-100"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx(m2,{category:r.category}),a.jsx("p",{className:"font-headline text-sm font-bold text-gray-900 leading-snug group-hover:text-brand-red transition-colors line-clamp-2 mt-0.5",children:r.title}),a.jsx("p",{className:"font-body text-xs text-gray-400 mt-1",children:r.author})]})]})}function pQ(){const[r,e]=k.useState([]),[t,n]=k.useState(!0),[s,i]=k.useState(""),l=It().pathname;if(k.useEffect(()=>{dQ(30).then(e).catch(p=>i(p.message)).finally(()=>n(!1))},[]),t)return a.jsx("div",{className:"flex items-center justify-center py-24",children:a.jsx(_e,{className:"w-7 h-7 animate-spin text-brand-red"})});if(s)return a.jsx("div",{className:"max-w-3xl mx-auto px-4 py-12",children:a.jsxs("div",{className:"flex items-start gap-2.5 bg-red-50 border border-red-200 rounded-lg px-4 py-3 text-sm text-red-700",children:[a.jsx(Ve,{className:"w-4 h-4 mt-0.5 shrink-0"})," ",s]})});if(r.length===0)return a.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-20 text-center",children:[a.jsx("p",{className:"font-headline text-xl text-gray-400",children:"No stories published yet."}),a.jsx("p",{className:"font-body text-sm text-gray-400 mt-2",children:"Check back soon for the latest news."})]});const[c,...u]=r,d=u.slice(0,2),h=u.slice(2),f={};for(const p of h){const m=p.category;f[m]||(f[m]=[]),f[m].push(p)}return a.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-8",children:[a.jsx(ze,{zone:"leaderboard",page:l,className:"mb-6"}),a.jsxs("div",{className:"grid lg:grid-cols-3 gap-6 mb-10",children:[a.jsx("div",{className:"lg:col-span-2",children:a.jsx(g2,{story:c,size:"hero"})}),a.jsx("div",{className:"flex flex-col gap-6",children:d.map(p=>a.jsx(g2,{story:p,size:"featured"},p.id))})]}),a.jsx("div",{className:"border-t-4 border-brand-red mb-8"}),Object.entries(f).map(([p,m])=>a.jsxs("section",{className:"mb-10",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h2",{className:"font-headline text-xl font-bold text-gray-900 border-l-4 border-brand-red pl-3",children:Yv[p]??p}),a.jsxs($e,{to:`/stories/category/${p}`,className:"inline-flex items-center gap-1 font-body text-xs font-semibold text-brand-red hover:text-brand-red-dark transition-colors",children:["More ",a.jsx(vR,{className:"w-3.5 h-3.5"})]})]}),a.jsx("div",{className:"grid sm:grid-cols-2 md:grid-cols-3 gap-5",children:m.slice(0,3).map(g=>a.jsx(g2,{story:g,size:"featured"},g.id))})]},p)),a.jsx(ze,{zone:"footer",page:l,className:"mt-4"})]})}function mQ({images:r,startIndex:e,onClose:t}){const[n,s]=k.useState(e),i=r[n],o=k.useCallback(()=>s(c=>(c-1+r.length)%r.length),[r.length]),l=k.useCallback(()=>s(c=>(c+1)%r.length),[r.length]);return k.useEffect(()=>{function c(u){u.key==="Escape"&&t(),u.key==="ArrowLeft"&&o(),u.key==="ArrowRight"&&l()}return document.addEventListener("keydown",c),document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",c),document.body.style.overflow=""}},[t,o,l]),a.jsxs("div",{className:"fixed inset-0 z-50 bg-black/92 flex flex-col items-center justify-center",onClick:t,children:[r.length>1&&a.jsxs("div",{className:"absolute top-4 left-1/2 -translate-x-1/2 font-body text-xs text-white/60",children:[n+1," / ",r.length]}),a.jsxs("div",{className:"relative max-w-5xl w-full px-3 sm:px-8 md:px-14 flex flex-col items-center",onClick:c=>c.stopPropagation(),children:[a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:t,className:"absolute top-2 left-2 text-white/50 hover:text-white/90 transition-colors z-10","aria-label":"Close",children:a.jsx(tt,{className:"w-4 h-4"})}),a.jsx("img",{src:i.url,alt:i.caption||"",className:"max-h-[80vh] max-w-full object-contain rounded shadow-2xl"})]}),i.caption&&a.jsx("p",{className:"mt-3 text-center font-body text-sm text-white/75 max-w-2xl italic",children:i.caption})]}),r.length>1&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:c=>{c.stopPropagation(),o()},className:"absolute left-3 top-1/2 -translate-y-1/2 text-white/70 hover:text-white bg-white/10 hover:bg-white/20 rounded-full p-3 transition-colors","aria-label":"Previous photo",children:a.jsx(wR,{className:"w-6 h-6"})}),a.jsx("button",{onClick:c=>{c.stopPropagation(),l()},className:"absolute right-3 top-1/2 -translate-y-1/2 text-white/70 hover:text-white bg-white/10 hover:bg-white/20 rounded-full p-3 transition-colors","aria-label":"Next p
1389hoto",children:a.jsx(zx,{className:"w-6 h-6"})})]})]})}function w6(r){return r.split(`
1390`).reduce((e,t)=>(t.trim()===""?e.length>0&&e[e.length-1]!==""&&e.push(""):e.push(t),e),[]).filter((e,t,n)=>!(n[t]===""&&(t===0||t===n.length-1)))}function gQ({img:r}){const e=r.focal_point?{x:r.focal_point.x,y:r.focal_point.y,aspectRatio:"16/9"}:void 0;return a.jsxs("figure",{className:"mb-8 rounded-xl overflow-hidden bg-gray-100",children:[a.jsx(Mr,{src:r.url,alt:r.caption||"",imageId:r.id,enforceAspectRatio:!0,initialFocalPoint:e,containerClassName:"w-full"}),r.caption&&a.jsx("figcaption",{className:"font-body text-sm text-gray-500 italic mt-2.5 text-center pb-2",children:r.caption})]})}function d3({img:r}){const e=r.focal_point??{x:50,y:50,aspectRatio:"4/3"},t=e.aspectRatio??"4/3";return a.jsxs("figure",{className:"my-6 flex flex-col items-center",children:[a.jsx("div",{className:"w-full max-w-sm sm:max-w-md overflow-hidden rounded-lg border border-gray-100 bg-gray-50",style:{aspectRatio:t},children:a.jsx("img",{src:r.url,alt:r.caption||"",className:"w-full h-full object-cover",style:{objectPosition:`${e.x}% ${e.y}%`}})}),r.caption&&a.jsx("figcaption",{className:"font-body text-xs text-gray-500 italic mt-2 text-center max-w-sm sm:max-w-md",children:r.caption})]})}function yQ({images:r,onOpen:e}){return r.length?a.jsxs("div",{className:"mt-10 pt-8 border-t border-gray-100",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-5",children:[a.jsx(ia,{className:"w-4 h-4 text-brand-red"}),a.jsx("h3",{className:"font-headline font-bold text-brand-black text-lg",children:"Photos"})]}),a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:r.map((t,n)=>{const s=t.focal_point??{x:50,y:50};return a.jsxs("figure",{children:[a.jsx("button",{type:"button",onClick:()=>e(n),className:"block w-full text-left group focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-red rounded-lg overflow-hidden",children:a.jsxs("div",{className:"overflow-hidden bg-gray-100 border border-gray-200 rounded-lg relative",style:{aspectRatio:"4/3"},children:[a.jsx("img",{src:t.url,alt:t.caption||"",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-[1.03]",style:{objectPosition:`${s.x}% ${s.y}%`}}),a.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/20 transition-colors duration-200 flex items-center justify-center",children:a.jsx(ki,{className:"w-6 h-6 text-white opacity-0 group-hover:opacity-100 transition-opacity duration-200 drop-shadow-lg"})})]})}),t.caption&&a.jsx("figcaption",{className:"font-body text-xs text-gray-500 mt-1.5 leading-snug italic",children:t.caption})]},t.id)})})]}):null}function bQ({body:r,images:e}){const[t,n]=k.useState(null),s=e.filter(d=>d.position==="top"),i=e.filter(d=>d.position==="gallery"),o=e.filter(d=>d.position==="bottom"),l=e.filter(d=>d.position!=="top"&&d.position!=="bottom"&&d.position!=="gallery"),c=w6(r),u=new Map;for(const d of l){const h=d.position.match(/^after:(\d+)$/);if(!h)continue;const f=parseInt(h[1],10)-1;u.set(f,[...u.get(f)??[],d])}return a.jsxs(a.Fragment,{children:[t!==null&&a.jsx(mQ,{images:i,startIndex:t,onClose:()=>n(null)}),a.jsxs("div",{className:"max-w-none",children:[s.map(d=>a.jsx(gQ,{img:d},d.id)),c.map((d,h)=>a.jsxs("span",{children:[d===""?a.jsx("div",{className:"mt-5"}):a.jsx("p",{className:"font-body text-gray-800 text-base md:text-[1.0625rem] leading-[1.8] mb-5",children:d}),(u.get(h)??[]).map(f=>a.jsx(d3,{img:f},f.id))]},h)),o.map(d=>a.jsx(d3,{img:d},d.id)),a.jsx(yQ,{images:i,onOpen:d=>n(d)})]})]})}function xQ(){const{id:r}=uk(),[e,t]=k.useState(null),[n,s]=k.useState(!0),[i,o]=k.useState("");if(k.useEffect(()=>{if(!r){o("Story not found."),s(!1);return}s(!0),o(""),t(null),fQ(r).then(d=>{d?t(d):o("Story not found.")}).catch(d=>o(d instanceof Error?d.message:"Failed to load story.")).finally(()=>s(!1))},[r]),n)return a.jsx("div",{className:"flex items-center justify-center py-24",children:a.jsx(_e,{className:"w-7 h-7 animate-spin text-brand-red"})});if(i||!e)return a.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-12",children:[a.jsxs("div",{className:"flex items-start gap-2.5 bg-red-50 border border-red-200 rounded-lg px-4 py-3 text-sm text-red-700 mb-4",children:[a.jsx(Ve,{className:"w-4 h-4 mt-0.5 shrink-0"}),i||"Story not found."]}),a.jsxs($e,{to:"/",className:"inline-flex items-center gap-1.5 font-body text-sm text-brand-red hover:underline",children:[a.jsx(Wd,{className:"w-4 h-4"})," Back to homepage"]})]});const l=e.images??[],c=l.length>0,u=l.find(d=>d.position==="top")??(e.image_url?{id:"legacy",url:e.image_url,caption:"",position:"top"}:null);return a.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-8",children:[a.jsx("div",{className:"mb-5",children:a.jsxs($e,{to:"/",className:"inline-flex items-center gap-1.5 font-body text-sm text-gray-500 hover:text-brand-red transition-colors",children:[a.jsx(Wd,{className:"w-4 h-4"})," All Stories"]})}),a.jsxs("article",{children:[a.jsxs("header",{className:"mb-6",children:[a.jsx("span",{className:"inline-block font-body text-xs font-bold uppercase tracking-widest text-brand-red mb-3",children:Yv[e.category]??e.category}),a.jsx("h1",{className:"font-headline text-3xl md:text-4xl font-bold text-gray-900 leading-tight mb-4",children:e.title}),a.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-sm text-gray-500 font-body border-t border-b border-gray-100 py-3",children:[a.jsxs("span",{className:"flex items-center gap-1.5 font-semibold text-gray-800",children:[a.jsx(Wl,{className:"w-4 h-4"}),e.author]}),a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx(zr,{className:"w-4 h-4"}),_k(e.created_at)]})]})]}),u&&!c&&a.jsxs("figure",{className:"mb-8 rounded-xl overflow-hidden bg-gray-100",children:[a.jsx(Mr,{src:u.url,alt:e.title,imageId:u.id,enforceAspectRatio:!0,containerClassName:"w-full"}),u.caption&&a.jsx("figcaption",{className:"font-body text-sm text-gray-500 italic mt-2.5 text-center pb-2",children:u.caption})]}),c?a.jsx(bQ,{body:e.body,images:l}):a.jsx("div",{className:"max-w-none",children:w6(e.body).map((d,h)=>d===""?a.jsx("div",{className:"mt-5"},h):a.jsx("p",{className:"font-body text-gray-800 text-base md:text-[1.0625rem] leading-[1.8] mb-5",children:d},h))})]}),a.jsx("div",{className:"mt-12 pt-6 border-t border-gray-200",children:a.jsxs($e,{to:"/",className:"inline-flex items-center gap-1.5 font-body text-sm text-brand-red hover:text-brand-red-dark transition-colors font-semibold",children:[a.jsx(Wd,{className:"w-4 h-4"})," Back to all stories"]})})]})}function vQ({story:r}){return a.jsxs($e,{to:`/stories/${r.id}`,className:"group block bg-white border border-gray-100 rounded-xl overflow-hidden hover:shadow-md transition-shadow",children:[r.image_url?a.jsx(Mr,{src:r.image_url,alt:r.title,imageId:r.id,className:"w-full h-full object-cover group-hover:scale-[1.02] transition-transform duration-500",containerClassName:"w-full h-44"}):a.jsx("div",{className:"w-full h-44 bg-gradient-to-br from-gray-100 to-gray-200 flex items-center justify-center",children:a.jsx("span",{className:"font-headline text-2xl text-gray-300 font-bold",children:"DCA"})}),a.jsxs("div",{className:"p-4",children:[a.jsx("h3",{className:"font-headline text-base font-bold text-gray-900 leading-snug group-hover:text-brand-red transition-colors line-clamp-3",children:r.title}),a.jsxs("div",{className:"flex items-center gap-3 mt-3 text-xs text-gray-400 font-body",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(Wl,{className:"w-3 h-3"}),r.author]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(zr,{className:"w-3 h-3"}),new Date(r.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})]})]})]})]})}function wQ(){const{category:r}=uk(),[e,t]=k.useState([]),[n,s]=k.useState(!0),[i,o]=k.useState("");k.useEffect(()=>{if(!r){s(!1);return}
1390s(!0),hQ(r).then(t).catch(c=>o(c.message)).finally(()=>s(!1))},[r]);const l=Yv[r]??r??"Category";return a.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-8",children:[a.jsx("div",{className:"mb-6",children:a.jsxs($e,{to:"/",className:"inline-flex items-center gap-1.5 font-body text-sm text-gray-500 hover:text-brand-red transition-colors",children:[a.jsx(Wd,{className:"w-4 h-4"})," All Stories"]})}),a.jsxs("div",{className:"flex items-center gap-3 mb-8",children:[a.jsx("div",{className:"w-1 h-8 bg-brand-red rounded-full"}),a.jsx("h1",{className:"font-headline text-3xl font-bold text-gray-900",children:l})]}),n?a.jsx("div",{className:"flex items-center justify-center py-24",children:a.jsx(_e,{className:"w-7 h-7 animate-spin text-brand-red"})}):i?a.jsxs("div",{className:"flex items-start gap-2.5 bg-red-50 border border-red-200 rounded-lg px-4 py-3 text-sm text-red-700",children:[a.jsx(Ve,{className:"w-4 h-4 mt-0.5 shrink-0"})," ",i]}):e.length===0?a.jsx("p",{className:"font-body text-gray-400 text-center py-16",children:"No published stories in this category yet."}):a.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:e.map(c=>a.jsx(vQ,{story:c},c.id))})]})}function _Q(){return a.jsxs("div",{className:"max-w-4xl mx-auto px-4 py-8",children:[a.jsxs("div",{className:"bg-brand-red text-white text-center py-12 px-6 mb-10",children:[a.jsxs("div",{className:"flex items-center justify-center gap-3 mb-4",children:[a.jsx("div",{className:"h-px bg-white/30 flex-1 max-w-16"}),a.jsx(jU,{className:"w-8 h-8 text-white/80"}),a.jsx("div",{className:"h-px bg-white/30 flex-1 max-w-16"})]}),a.jsx("h1",{className:"font-masthead text-3xl md:text-5xl font-bold leading-tight mb-3",children:"Privacy Policy"}),a.jsx("p",{className:"font-headline italic text-white/80 text-base",children:"The Dixie County Advocate"}),a.jsx("p",{className:"font-body text-white/60 text-xs mt-2",children:"Last updated: August 18, 2026"})]}),a.jsx("div",{className:"bg-white border border-gray-200 rounded-lg p-6 md:p-8 mb-6 shadow-sm",children:a.jsx("p",{className:"font-body text-gray-700 text-base leading-relaxed",children:'The Dixie County Advocate ("we," "us," or "our") is committed to protecting the privacy of our readers and website visitors. This Privacy Policy explains what information we collect, how we use it, and the choices you have. By using dixiecountyadvocate.com, you agree to the practices described here.'})}),a.jsxs("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-6 mb-8",children:[a.jsx("h2",{className:"font-headline text-sm font-bold text-brand-black uppercase tracking-widest mb-3",children:"Contents"}),a.jsx("ul",{className:"grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-1.5 text-sm",children:[["Information We Collect","#collect"],["How We Use Your Information","#use"],["Live Stream Notifications","#notifications"],["Cookies and Analytics","#cookies"],["Advertising","#advertising"],["Third-Party Services","#third-party"],["Data Storage and Security","#security"],["Your Rights and Choices","#rights"],["Children’s Privacy","#children"],["Contact Form Submissions","#forms"],["Changes to This Policy","#changes"],["Contact Us","#contact"]].map(([r,e])=>a.jsx("li",{children:a.jsx("a",{href:e,className:"text-brand-red hover:underline font-body",children:r})},e))})]}),a.jsxs("div",{className:"space-y-8",children:[a.jsxs("section",{id:"collect",className:"bg-white border border-gray-200 rounded-lg p-6 md:p-8 shadow-sm",children:[a.jsx("h2",{className:"font-headline text-2xl font-bold text-brand-black border-b-2 border-brand-red pb-2 mb-4",children:"Information We Collect"}),a.jsxs("div",{className:"font-body text-gray-700 text-base leading-relaxed space-y-4",children:[a.jsx("p",{children:a.jsx("strong",{children:"Information you provide directly:"})}),a.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[a.jsxs("li",{children:[a.jsx("strong",{children:"Email address"})," — when you sign up for our newsletter or live stream email notifications."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Phone number"})," — when you sign up for live stream text message notifications. This is optional."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Contact form submissions"})," — your name, email address, and any information you include when you use our contact, obituary submission, community story tip, or classified ad forms."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Advertising inquiries"})," — business name, contact details, and ad specifications you provide through our advertising page."]})]}),a.jsx("p",{children:a.jsx("strong",{children:"Information collected automatically:"})}),a.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[a.jsxs("li",{children:[a.jsx("strong",{children:"Usage data"})," — such as your IP address, browser type, device information, and the pages you visit on our site."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Location data (general)"})," — we may infer your general geographic region from your IP address for analytics purposes. We do not track your precise location."]})]})]})]}),a.jsxs("section",{id:"use",className:"bg-white border border-gray-200 rounded-lg p-6 md:p-8 shadow-sm",children:[a.jsx("h2",{className:"font-headline text-2xl font-bold text-brand-black border-b-2 border-brand-red pb-2 mb-4",children:"How We Use Your Information"}),a.jsxs("div",{className:"font-body text-gray-700 text-base leading-relaxed space-y-3",children:[a.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[a.jsx("li",{children:"To send you the notifications you signed up for — emails and text messages when we go live for a broadcast."}),a.jsx("li",{children:"To respond to your inquiries submitted through our contact forms."}),a.jsx("li",{children:"To process obituary submissions, community story tips, and classified ad submissions."}),a.jsx("li",{children:"To communicate with you about your subscription, advertising, or other requests."}),a.jsx("li",{children:"To improve our website, content, and services based on how visitors use the site."}),a.jsx("li",{children:"To comply with our legal obligations as a newspaper of record, including the publication of public notices."})]}),a.jsxs("p",{children:["We do ",a.jsx("strong",{children:"not"})," sell your email address or phone number to third parties."]})]})]}),a.jsxs("section",{id:"notifications",className:"bg-white border border-gray-200 rounded-lg p-6 md:p-8 shadow-sm",children:[a.jsx("h2",{className:"font-headline text-2xl font-bold text-brand-black border-b-2 border-brand-red pb-2 mb-4",children:"Live Stream Notifications"}),a.jsxs("div",{className:"font-body text-gray-700 text-base leading-relaxed space-y-3",children:[a.jsx("p",{children:"When you sign up for live stream notifications, you can choose to provide your email address, your phone number, or both."}),a.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[a.jsxs("li",{children:[a.jsx("strong",{children:"Email:"})," We send you an email when the broadcast goes live. Emails are sent through our email service provider, Resend."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Text message (SMS):"})," We send you a text message when the broadcast goes live. Texts are sent through our SMS service provider, Twilio. Message and data rates may apply. The frequency of text messages depends on how often we go live — you will receive one text per live broadcast, typically no more than a few times per week."]})]}),a.jsxs("p",{children:[a.jsx("strong",{children:"We do not share your mobile number with third parties"})," for marketing or promotional purposes. Your phone number is used solely to send you live stream notifications and is shared only with Twilio, our SMS service provider, for the purpose of delivering those messages."]}),a.jsx("p",{children:"You can unsubscribe at any time. If you provided an email, you can use the unsubscribe link in any notification email. If you provided a phone number, you can text STOP to opt out of future text messages, or contact us directly to be removed. Texting HELP will provide support information."})]})]}),a.jsxs("section",{id:"cookies",className:"bg-white border border-gray-200 rounded-lg p-6 md:p-8 shadow-sm",children:[a.jsx("h2",{className:"font-headline text-2xl font-bold text-brand-black border-b-2 border-brand-red pb-2 mb-4",children:"Cookies and Analytics"}),a.jsxs("div",{className:"font-body text-gray-700 text-base leading-relaxed space-y-3",children:[a.jsx("p",{children:"Our website may use cookies and similar technologies to remember your preferences and to collect anonymous usage data. Cookies are small files stored on your device that help the site function properly."}),a.jsx("p",{children:"We use analytics tools to understand how visitors interact with our site — which articles are read most, how people find us, and what devices they use. This data is aggregated and does not identify you personally. You can disable cookies in your browser settings, though some site features may not work as intended."})]})]}),a.jsxs("section",{id:"advertising",className:"bg-white border border-gray-200 rounded-lg p-6 md:p-8 shadow-sm",children:[a.jsx("h2",{className:"font-headline text-2xl font-bold text-brand-black border-b-2 border-brand-red pb-2 mb-4",children:"Advertising"}),a.jsxs("div",{className:"font-body text-gray-700 text-base leading-relaxed space-y-3",children:[a.jsx("p",{children:"We display advertisements on our website. Our advertising partners may use cookies or similar technologies to serve ads that are more relevant to your interests. We do not share your personal information with advertisers for this purpose — any ad targeting is handled by the advertising networks based on their own data and policies."}),a.jsx("p",{children:"If you have questions about a specific advertisement, please contact us directly."})]})]}),a.jsxs("section",{id:"third-party",className:"bg-white border border-gray-200 rounded-lg p-6 md:p-8 shadow-sm",children:[a.jsx("h2",{className:"font-headline text-2xl font-bold text-brand-black border-b-2 border-brand-red pb-2 mb-4",children:"Third-Party Services"}),a.jsxs("div",{className:"font-body text-gray-700 text-base leading-relaxed space-y-3",children:[a.jsx("p",{children:"We use the following third-party services to operate our website and send notifications:"}),a.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[a.jsxs("li",{children:[a.jsx("strong",{children:"Supabase"})," — our database and hosting provider for storing subscriber information and website content."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Resend"})," — our email delivery service for sending live stream notification emails."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Twilio"})," — our SMS service for sending live stream text message notifications."]})]}),a.jsx("p",{children:"Each of these providers has access to the information necessary to perform their services and is bound by their own privacy policies. We have chosen providers that meet industry standards for data protection."})]})]}),a.jsxs("section",{id:"security",className:"bg-white border border-gray-200 rounded-lg p-6 md:p-8 shadow-sm",children:[a.jsx("h2",{className:"font-headline text-2xl font-bold text-brand-black border-b-2 border-brand-red pb-2 mb-4",children:"Data Storage and Security"}),a.jsxs("div",{className:"font-body text-gray-700 text-base leading-relaxed space-y-3",children:[a.jsx("p",{children:"Your information is stored securely in our database hosted by Supabase. Access to personal data is restricted to authorized staff members who need it to perform their duties — such as sending notifications or responding to your inquiries."}),a.jsx("p",{children:"We use industry-standard security measures including encrypted connections (HTTPS), row-level security on our database, and restricted access controls. However, no method of transmission or storage is 100% secure, and we cannot guarantee absolute security."})]})]}),a.jsxs("section",{id:"rights",className:"bg-white border border-gray-200 rounded-lg p-6 md:p-8 shadow-sm",children:[a.jsx("h2",{className:"font-headline text-2xl font-bold text-brand-black border-b-2 border-brand-red pb-2 mb-4",children:"Your Rights and Choices"}),a.jsxs("div",{className:"font-body text-gray-700 text-base leading-relaxed space-y-3",children:[a.jsx("p",{children:"You have the following rights regarding your personal information:"}),a.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[a.jsxs("li",{children:[a.jsx("strong",{children:"Access:"})," You can request a copy of the personal information we hold about you."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Correction:"})," You can ask us to correct inaccurate or incomplete information."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Deletion:"})," You can ask us to delete your email address, phone number, or other personal data from our records."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Opt out:"})," You can unsubscribe from notifications at any time — use the unsubscribe link in emails, text STOP to opt out of SMS, or contact us directly."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Withdraw consent:"})," You can withdraw your consent for us to use your information at any time."]})]}),a.jsx("p",{children:"To exercise any of these rights, please contact us using the information provided at the bottom of this page."})]})]}),a.jsxs("section",{id:"children",className:"bg-white border border-gray-200 rounded-lg p-6 md:p-8 shadow-sm",children:[a.jsx("h2",{className:"font-headline text-2xl font-bold text-brand-black border-b-2 border-brand-red pb-2 mb-4",children:"Children's Privacy"}),a.jsx("div",{className:"font-body text-gray-700 text-base leading-relaxed",children:a.jsx("p",{children:"Our website is not directed at children under the age of 13. We do not knowingly collect personal information from children under 13. If you believe a child has provided us with personal information, please contact us and we will promptly delete it."})})]}),a.jsxs("section",{id:"forms",className:"bg-white border border-gray-200 rounded-lg p-6 md:p-8 shadow-sm",children:[a.jsx("h2",{className:"font-headline text-2xl font-bold text-brand-black border-b-2 border-brand-red pb-2 mb-4",children:"Contact Form Submissions"}),a.jsxs("div",{className:"font-body text-gray-700 text-base leading-relaxed space-y-3",children:[a.jsx("p",{children:"When you submit a form on our website — such as a contact message, obituary submission, community story tip, or classified ad — the information you provide is sent to our staff by email and stored in our database. We use this information solely to process your submission and communicate with you about it."}),a.jsx("p",{children:"If you submit a photo with your form, it is stored in our secure storage and may be published on our website or in our newspaper with your permission. You can request removal of a submitted photo at any time."})]})]}),a.jsxs("section",{id:"changes",className:"bg-white border border-gray-200 rounded-lg p-6 md:p-8 shadow-sm",children:[a.jsx("h2",{className:"font-headline text-2xl font-bold text-brand-black border-b-2 border-brand-red pb-2 mb-4",children:"Changes to This Policy"}),a.jsx("div",{className:"font-body text-gray-700 text-base leading-relaxed",children:a.jsx("p",{children:'We may update this Privacy Policy from time to time. When we do, we will revise the "Last updated" date at the top of this page. We encourage you to review this policy periodically to stay informed about how we protect your information.'})})]}),a.jsxs("section",{id:"contact",className:"bg-white border border-gray-200 rounded-lg p-6 md:p-8 shadow-sm",children:[a.jsx("h2",{className:"font-headline text-2xl font-bold text-brand-black border-b-2 border-brand-red pb-2 mb-4",children:"Contact Us"}),a.jsxs("div",{className:"font-body text-gray-700 text-base leading-relaxed space-y-3",children:[a.jsx("p",{children:"If you have questions about this Privacy Policy or want to exercise any of your rights, we encourage you to reach out:"}),a.jsxs("ul",{className:"list-disc pl-6 space-y-1",children:[a.jsxs("li",{children:[a.jsx("strong",{children:"By mail:"})," 174 NE 351 Hwy, Cross City, FL 32628"]}),a.jsxs("li",{children
vendor: 8,469 bytes, line 1390
1390:[a.jsx("strong",{children:"By phone:"})," (352) 498-3312"]}),a.jsxs("li",{children:[a.jsx("strong",{children:"By email:"})," [email protected]"]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Online:"})," ",a.jsx($e,{to:"/contact",className:"text-brand-red hover:underline",children:"Use our contact form"})]})]})]})]})]}),a.jsx("div",{className:"text-center mt-10",children:a.jsx($e,{to:"/",className:"inline-flex items-center gap-2 text-sm font-body text-brand-red hover:underline",children:"← Back to The Dixie County Advocate"})})]})}function NQ(){return a.jsxs("div",{className:"max-w-4xl mx-auto px-4 py-8",children:[a.jsxs("div",{className:"bg-brand-red text-white text-center py-12 px-6 mb-10",children:[a.jsxs("div",{className:"flex items-center justify-center gap-3 mb-4",children:[a.jsx("div",{className:"h-px bg-white/30 flex-1 max-w-16"}),a.jsx(Bt,{className:"w-8 h-8 text-white/80"}),a.jsx("div",{className:"h-px bg-white/30 flex-1 max-w-16"})]}),a.jsx("h1",{className:"font-masthead text-3xl md:text-5xl font-bold leading-tight mb-3",children:"SMS Terms & Conditions"}),a.jsx("p",{className:"font-headline italic text-white/80 text-base",children:"Live Stream Notification Service"}),a.jsx("p",{className:"font-body text-white/60 text-xs mt-2",children:"Last updated: August 18, 2026"})]}),a.jsx("div",{className:"bg-white border border-gray-200 rounded-lg p-6 md:p-8 mb-6 shadow-sm",children:a.jsx("p",{className:"font-body text-gray-700 text-base leading-relaxed",children:'These Terms and Conditions govern your use of the SMS text messaging service provided by The Dixie County Advocate (the "Service"). By signing up for live stream text notifications, you agree to be bound by these terms. If you do not agree to these terms, please do not sign up for the Service.'})}),a.jsxs("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-6 mb-8",children:[a.jsx("h2",{className:"font-headline text-sm font-bold text-brand-black uppercase tracking-widest mb-4",children:"Quick Reference"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 text-sm",children:[a.jsxs("div",{children:[a.jsx("p",{className:"font-bold text-gray-900 mb-1",children:"Program Name"}),a.jsx("p",{className:"text-gray-600",children:"DCA Live Stream Notifications"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"font-bold text-gray-900 mb-1",children:"Message Frequency"}),a.jsx("p",{className:"text-gray-600",children:"One message per live broadcast (varies, typically 1–5 per month)"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"font-bold text-gray-900 mb-1",children:"Opt Out"}),a.jsx("p",{className:"text-gray-600",children:"Text STOP to any message"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"font-bold text-gray-900 mb-1",children:"Get Help"}),a.jsx("p",{className:"text-gray-600",children:"Text HELP to any message"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"font-bold text-gray-900 mb-1",children:"Support Contact"}),a.jsx("p",{className:"text-gray-600",children:"(352) 498-3312 or [email protected]"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"font-bold text-gray-900 mb-1",children:"Carrier"}),a.jsx("p",{className:"text-gray-600",children:"All major U.S. wireless carriers supported"})]})]})]}),a.jsxs("div",{className:"space-y-8",children:[a.jsxs("section",{className:"bg-white border border-gray-200 rounded-lg p-6 md:p-8 shadow-sm",children:[a.jsx("h2",{className:"font-headline text-2xl font-bold text-brand-black border-b-2 border-brand-red pb-2 mb-4",children:"1. Service Description"}),a.jsxs("div",{className:"font-body text-gray-700 text-base leading-relaxed space-y-3",children:[a.jsx("p",{children:"The Dixie County Advocate offers an SMS notification service that alerts subscribers via text message when a live stream broadcast begins on our website, dixiecountyadvocate.com. The Service is intended to keep our community informed about live events, breaking news coverage, and special broadcasts."}),a.jsx("p",{children:"When you subscribe, you will receive a text message containing a brief description of the live stream and a link to watch it on our website. The Service is provided free of charge from The Dixie County Advocate, though standard message and data rates from your mobile carrier may apply."})]})]}),a.jsxs("section",{className:"bg-white border border-gray-200 rounded-lg p-6 md:p-8 shadow-sm",children:[a.jsx("h2",{className:"font-headline text-2xl font-bold text-brand-black border-b-2 border-brand-red pb-2 mb-4",children:"2. Opt-In and Consent"}),a.jsxs("div",{className:"font-body text-gray-700 text-base leading-relaxed space-y-3",children:[a.jsx("p",{children:"By entering your mobile phone number on the live stream sign-up form and checking the consent box, you expressly consent to receive SMS text messages from The Dixie County Advocate at the phone number you provided. You confirm that you are the owner or authorized user of the mobile device associated with that phone number."}),a.jsx("p",{children:"Consent is not required as a condition of purchasing any goods or services. You are signing up voluntarily to receive live stream notifications."}),a.jsxs("p",{children:["By opting in, you acknowledge that you have read and agree to these Terms and Conditions and our"," ",a.jsx($e,{to:"/privacy-policy",className:"text-brand-red hover:underline",children:"Privacy Policy"}),"."]})]})]}),a.jsxs("section",{className:"bg-white border border-gray-200 rounded-lg p-6 md:p-8 shadow-sm",children:[a.jsx("h2",{className:"font-headline text-2xl font-bold text-brand-black border-b-2 border-brand-red pb-2 mb-4",children:"3. Message Frequency"}),a.jsxs("div",{className:"font-body text-gray-700 text-base leading-relaxed space-y-3",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Message frequency varies."})," You will receive one (1) text message each time The Dixie County Advocate begins a live stream broadcast. The number of messages you receive depends on how often we go live."]}),a.jsx("p",{children:"On a typical week, you can expect to receive between 1 and 5 messages per month. During periods of breaking news or special event coverage, you may receive more frequent messages. We do not send promotional or marketing content through this Service — only live stream alerts."})]})]}),a.jsxs("section",{className:"bg-white border border-gray-200 rounded-lg p-6 md:p-8 shadow-sm",children:[a.jsx("h2",{className:"font-headline text-2xl font-bold text-brand-black border-b-2 border-brand-red pb-2 mb-4",children:"4. Message and Data Rates"}),a.jsx("div",{className:"font-body text-gray-700 text-base leading-relaxed",children:a.jsxs("p",{children:[a.jsx("strong",{children:"Message and data rates may apply."})," The Dixie County Advocate does not charge for the SMS Service, but your mobile carrier's standard message and data rates may apply to messages you receive. Check with your carrier for details on your messaging plan and any applicable rates."]})})]}),a.jsxs("section",{className:"bg-white border border-gray-200 rounded-lg p-6 md:p-8 shadow-sm",children:[a.jsx("h2",{className:"font-headline text-2xl font-bold text-brand-black border-b-2 border-brand-red pb-2 mb-4",children:"5. How to Opt Out"}),a.jsxs("div",{className:"font-body text-gray-700 text-base leading-relaxed space-y-3",children:[a.jsx("p",{children:"You may cancel your subscription to the SMS Service at any time by any of the following methods:"}),a.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[a.jsxs("li",{children:[a.jsx("strong",{children:"Text STOP"})," to any message you receive from us. You will receive a confirmation text confirming your opt-out."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Text CANCEL"})," or ",a.jsx("strong",{children:"UNSUBSCRIBE"})," to any message you receive from us."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Contact us directly"})," by phone at (352) 498-3312 or by email at [email protected] and request removal."]})]}),a.jsx("p",{children:"After opting out, you will receive no further SMS messages from this Service. Opting out of SMS does not affect any email notifications you may have signed up for separately."})]})]}),a.jsxs("section",{className:"bg-white border border-gray-200 rounded-lg p-6 md:p-8 shadow-sm",children:[a.jsx("h2",{className:"font-headline text-2xl font-bold text-brand-black border-b-2 border-brand-red pb-2 mb-4",children:"6. Help and 
1390Support"}),a.jsxs("div",{className:"font-body text-gray-700 text-base leading-relaxed space-y-3",children:[a.jsx("p",{children:"If you need assistance with the SMS Service, you can:"}),a.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[a.jsxs("li",{children:[a.jsx("strong",{children:"Text HELP"})," to any message you receive from us for support information."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Call us"})," at (352) 498-3312 during business hours."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Email us"})," at [email protected]."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Write to us"})," at 174 NE 351 Hwy, Cross City, FL 32628."]})]})]})]}),a.jsxs("section",{className:"bg-white border border-gray-200 rounded-lg p-6 md:p-8 shadow-sm",children:[a.jsx("h2",{className:"font-headline text-2xl font-bold text-brand-black border-b-2 border-brand-red pb-2 mb-4",children:"7. Participating Carriers"}),a.jsx("div",{className:"font-body text-gray-700 text-base leading-relaxed",children:a.jsx("p",{children:"The Service is available on all major U.S. wireless carriers, including but not limited to AT&T, Verizon Wireless, T-Mobile, Sprint (now part of T-Mobile), US Cellular, and their respective MVNO partners. If your carrier does not support short code or long code messaging, you may not be able to receive messages from this Service."})})]}),a.jsxs("section",{className:"bg-white border border-gray-200 rounded-lg p-6 md:p-8 shadow-sm",children:[a.jsx("h2",{className:"font-headline text-2xl font-bold text-brand-black border-b-2 border-brand-red pb-2 mb-4",children:"8. Data Privacy and Non-Sharing"}),a.jsxs("div",{className:"font-body text-gray-700 text-base leading-relaxed space-y-3",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"We do not share your mobile number with third parties"})," for marketing or promotional purposes. Your mobile number is used solely for the purpose of delivering live stream SMS notifications and is shared only with Twilio, our SMS service provider, for the technical purpose of transmitting messages."]}),a.jsxs("p",{children:["We will not sell, rent, lease, or otherwise distribute your mobile number to any other party. For more information about how we handle your personal data, please review our"," ",a.jsx($e,{to:"/privacy-policy",className:"text-brand-red hover:underline",children:"Privacy Policy"}),"."]})]})]}),a.jsxs("section",{className:"bg-white border border-gray-200 rounded-lg p-6 md:p-8 shadow-sm",children:[a.jsx("h2",{className:"font-headline text-2xl font-bold text-brand-black border-b-2 border-brand-red pb-2 mb-4",children:"9. Liability and Warranties"}),a.jsxs("div",{className:"font-body text-gray-700 text-base leading-relaxed space-y-3",children:[a.jsx("p",{children:`The Dixie County Advocate provides the SMS Service on an "as is" and "as available" basis. We do not guarantee that messages will be delivered without delay or error, as delivery depends on factors beyond our control, including your mobile carrier's network, signal strength, and device compatibility.`}),a.jsx("p",{children:"We are not liable for any delays, failures, or interruptions in message delivery. We are not responsible for any message and data rates charged by your carrier. To the fullest extent permitted by law, The Dixie County Advocate and LSA Media LLC shall not be liable for any damages arising from your use of or inability to use the Service."})]})]}),a.jsxs("section",{className:"bg-white border border-gray-200 rounded-lg p-6 md:p-8 shadow-sm",children:[a.jsx("h2",{className:"font-headline text-2xl font-bold text-brand-black border-b-2 border-brand-red pb-2 mb-4",children:"10. Age Requirement"}),a.jsx("div",{className:"font-body text-gray-700 text-base leading-relaxed",children:a.jsx("p",{children:"You must be at least 18 years old or have parental/guardian consent to subscribe to the SMS Service. By opting in, you represent that you meet this requirement."})})]}),a.jsxs("section",{className:"bg-white border border-gray-200 rounded-lg p-6 md:p-8 shadow-sm",children:[a.jsx("h2",{className:"font-headline text-2xl font-bold text-brand-black border-b-2 border-brand-red pb-2 mb-4",children:"11. Changes to These Terms"}),a.jsx("div",{className:"font-body text-gray-700 text-base leading-relaxed",children:a.jsx("p",{children:'We reserve the right to modify these Terms and Conditions at any time. When we do, we will revise the "Last updated" date at the top of this page. C
1390ontinued use of the Service after changes are posted constitutes your acceptance of the updated terms. We encourage you to review this page periodically.'})})]}),a.jsxs("section",{className:"bg-white border border-gray-200 rounded-lg p-6 md:p-8 shadow-sm",children:[a.jsx("h2",{className:"font-headline text-2xl font-bold text-brand-black border-b-2 border-brand-red pb-2 mb-4",children:"12. Termination"}),a.jsx("div",{className:"font-body text-gray-700 text-base leading-relaxed space-y-3",children:a.jsx("p",{children:"We reserve the right to suspend or terminate the Service, or your individual subscription, at any time and for any reason, including but not limited to technical issues, changes in carrier policies, or violation of these Terms. Upon termination, all obligations under these Terms will cease, except for those that by their nature should survive (such as liability and data privacy provisions)."})})]}),a.jsxs("section",{className:"bg-white border border-gray-200 rounded-lg p-6 md:p-8 shadow-sm",children:[a.jsx("h2",{className:"font-headline text-2xl font-bold text-brand-black border-b-2 border-brand-red pb-2 mb-4",children:"13. Contact Us"}),a.jsxs("div",{className:"font-body text-gray-700 text-base leading-relaxed space-y-3",children:[a.jsx("p",{children:"If you have questions about these Terms and Conditions or the SMS Service, please contact us:"}),a.jsxs("ul",{className:"list-disc pl-6 space-y-1",children:[a.jsxs("li",{children:[a.jsx("strong",{children:"By mail:"})," 174 NE 351 Hwy, Cross City, FL 32628"]}),a.jsxs("li",{children:[a.jsx("strong",{children:"By phone:"})," (352) 498-3312"]}),a.jsxs("li",{children:[a.jsx("strong",{children:"By email:"})," [email protected]"]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Online:"})," ",a.jsx($e,{to:"/contact",className:"text-brand-red hover:underline",children:"Use our contact form"})]})]})]})]})]}),a.jsx("div",{className:"text-center mt-10",children:a.jsx($e,{to:"/",className:"inline-flex items-center gap-2 text-sm font-body text-brand-red hover:underline",children:"← Back to The Dixie County Advocate"})})]})}function SQ(){return a.jsxs("div",{className:"min-h-screen bg-gray-50 flex flex-col overflow-x-hidden",children:[a.jsx(Z$,{}),a.jsx(NH,{}),a.jsx(FU,{}),a.jsx("main",{className:"flex-1",children:a.jsxs(u_,{children:[a.jsx(Mt,{path:"/",element:a.jsx(Pz,{})}),a.jsx(Mt,{path:"/news",element:a.jsx(Oz,{})}),a.jsx(Mt,{path:"/perspectives",element:a.jsx(YZ,{})}),a.jsx(Mt,{path:"/sports",element:a.jsx(Jz,{})}),a.jsx(Mt,{path:"/community",element:a.jsx(Qz,{})}),a.jsx(Mt,{path:"/obituaries",element:a.jsx(tq,{})}),a.jsx(Mt,{path:"/public-notices",element:a.jsx(aq,{})}),a.jsx(Mt,{path:"/this-weeks-pics",element:a.jsx(oQ,{})}),a.jsx(Mt,{path:"/digital-paper",element:a.jsx(uQ,{})}),a.jsx(Mt,{path:"/subscriber-extras",element:a.jsx(GZ,{})}),a.jsx(Mt,{path:"/about",element:a.jsx(lq,{})}),a.jsx(Mt,{path:"/subscribe",element:a.jsx(uq,{})}),a.jsx(Mt,{path:"/contact",element:a.jsx(dq,{})}),a.jsx(Mt,{path:"/advertise",element:a.jsx(fq,{})}),a.jsx(Mt,{path:"/article/:slug",element:a.jsx(Hz,{})}),a.jsx(Mt,{path:"/stories",element:a.jsx(pQ,{})}),a.jsx(Mt,{path:"/stories/:id",element:a.jsx(xQ,{})}),a.jsx(Mt,{path:"/stories/category/:category",element:a.jsx(wQ,{})}),a.jsx(Mt,{path:"/privacy-policy",element:a.jsx(_Q,{})}),a.jsx(Mt,{path:"/sms-terms",element:a.jsx(NQ,{})})]})}),a.jsx(kH,{}),a.jsx(wz,{})]})}function kQ(){const r=It();return r.pathname.startsWith("/admin")?a.jsxs(u_,{children:[a.jsx(Mt,{path:"/admin",element:a.jsx(hT,{})}),a.jsx(Mt,{path:"/admin/*",element:a.jsx(hT,{})})]}):r.pathname.startsWith("/staff")?a.jsx(u_,{children:a.jsx(Mt,{path:"/staff/*",element:a.jsx(V9,{to:"/admin",replace:!0})})}):a.jsx(SQ,{})}function CQ(){return a.jsx(b7,{children:a.jsx(q$,{children:a.jsx(kQ,{})})})}class EQ extends k.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error("App error:",e,t)}render(){return this.state.error?a.jsxs("div",{style:{padding:"2rem",fontFamily:"sans-serif",textAlign:"center"},children:[a.jsx("h2",{style:{color:"#c00",marginBottom:"1rem"},children:"Something went wrong"}),a.jsx("p",{style:{color:"#555",marginBottom:"1rem"},children:this.state.error.message}),a.jsx("button",{onClick:()=>{this.setState({error:null}),window.location.reload()},style:{background:"#c00",color:"#fff",border:"none",padding:"0.5rem 1.5rem",borderRadius:"4px",cursor:"pointer"},children:"Reload Page"})]}):this.props.children}}CD(document.getElementById("root")).render(a.jsx(k.StrictMode,{children:a.jsx(EQ,{
1390children:a.jsx(CQ,{})})}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.