vendor: 6,431 bytes, lines 1-9
1var Yne=Object.defineProperty;var sD=t=>{throw TypeError(t)};var Xne=(t,e,n)=>e in t?Yne(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var X=(t,e,n)=>Xne(t,typeof e!="symbol"?e+"":e,n),bC=(t,e,n)=>e.has(t)||sD("Cannot "+n);var Pe=(t,e,n)=>(bC(t,e,"read from private field"),n?n.call(t):e.get(t)),Rn=(t,e,n)=>e.has(t)?sD("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Zt=(t,e,n,r)=>(bC(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Bs=(t,e,n)=>(bC(t,e,"access private method"),n);var fb=(t,e,n,r)=>({set _(i){Zt(t,e,i,n)},get _(){return Pe(t,e,r)}});function Qne(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in t)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var r7e=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Zz(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e$={exports:{}},MS={},t$={exports:{}},kn={};/** 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 Qw=Symbol.for("react.element"),Zne=Symbol.for("react.portal"),ere=Symbol.for("react.fragment"),tre=Symbol.for("react.strict_mode"),nre=Symbol.for("react.profiler"),rre=Symbol.for("react.provider"),ire=Symbol.for("react.context"),sre=Symbol.for("react.forward_ref"),are=Symbol.for("react.suspense"),ore=Symbol.for("react.memo"),lre=Symbol.for("react.lazy"),aD=Symbol.iterator;function cre(t){return t===null||typeof t!="object"?null:(t=aD&&t[aD]||t["@@iterator"],typeof t=="function"?t:null)}var n$={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},r$=Object.assign,i$={};function Kv(t,e,n){this.props=t,this.context=e,this.refs=i$,this.updater=n||n$}Kv.prototype.isReactComponent={};Kv.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,e,"setState")};Kv.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function s$(){}s$.prototype=Kv.prototype;function d3(t,e,n){this.props=t,this.context=e,this.refs=i$,this.updater=n||n$}var h3=d3.prototype=new s$;h3.constructor=d3;r$(h3,Kv.prototype);h3.isPureReactComponent=!0;var oD=Array.isArray,a$=Object.prototype.hasOwnProperty,f3={current:null},o$={key:!0,ref:!0,__self:!0,__source:!0};function l$(t,e,n){var r,i={},s=null,a=null;if(e!=null)for(r in e.ref!==void 0&&(a=e.ref),e.key!==void 0&&(s=""+e.key),e)a$.call(e,r)&&!o$.hasOwnProperty(r)&&(i[r]=e[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var l=Array(o),c=0;c<o;c++)l[c]=arguments[c+2];i.children=l}if(t&&t.defaultProps)for(r in o=t.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return{$$typeof:Qw,type:t,key:s,ref:a,props:i,_owner:f3.current}}function ure(t,e){return{$$typeof:Qw,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function p3(t){return typeof t=="object"&&t!==null&&t.$$typeof===Qw}function dre(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var lD=/\/+/g;function xC(t,e){return typeof t=="object"&&t!==null&&t.key!=null?dre(""+t.key):e.toString(36)}function q2(t,e,n,r,i){var s=typeof t;(s==="undefined"||s==="boolean")&&(t=null);var a=!1;if(t===null)a=!0;else switch(s){case"string":case"number":a=!0;break;case"object":switch(t.$$typeof){case Qw:case Zne:a=!0}}if(a)return a=t,i=i(a),t=r===""?"."+xC(a,0):r,oD(i)?(n="",t!=null&&(n=t.replace(lD,"$&/")+"/"),q2(i,e,n,"",function(c){return c})):i!=null&&(p3(i)&&(i=ure(i,n+(!i.key||a&&a.key===i.key?"":(""+i.key).replace(lD,"$&/")+"/")+t)),e.push(i)),1;if(a=0,r=r===""?".":r+":",oD(t))for(var o=0;o<t.length;o++){s=t[o];var l=r+xC(s,o);a+=q2(s,e,n,l,i)}else if(l=cre(t),typeof l=="function")for(t=l.call(t),o=0;!(s=t.next()).done;)s=s.value,l=r+xC(s,o++),a+=q2(s,e,n,l,i);else if(s==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return a}function pb(t,e,n){if(t==null)return t;var r=[],i=0;return q2(t,r,"","",function(s){return e.call(n,s,i++)}),r}function hre(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(n){(t._status===0||t._status===-1)&&(t._status=1,t._result=n)},function(n){(t._status===0||t._status===-1)&&(t._status=2,t._result=n)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var Ea={current:null},W2={transition:null},fre={ReactCurrentDispatcher:Ea,ReactCurrentBatchConfig:W2,ReactCurrentOwner:f3};function c$(){throw Error("act(...) is not supported in production builds of React.")}kn.Children={map:pb,forEach:function(t,e,n){pb(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return pb(t,function(){e++}),e},toArray:function(t){return pb(t,function(e){return e})||[]},only:function(t){if(!p3(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};kn.Component=Kv;kn.Fragment=ere;kn.Profiler=nre;kn.PureComponent=d3;kn.StrictMode=tre;kn.Suspense=are;
vendor: 5,112 bytes, lines 9-25
9kn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=fre;kn.act=c$;kn.cloneElement=function(t,e,n){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var r=r$({},t.props),i=t.key,s=t.ref,a=t._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,a=f3.current),e.key!==void 0&&(i=""+e.key),t.type&&t.type.defaultProps)var o=t.type.defaultProps;for(l in e)a$.call(e,l)&&!o$.hasOwnProperty(l)&&(r[l]=e[l]===void 0&&o!==void 0?o[l]:e[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){o=Array(l);for(var c=0;c<l;c++)o[c]=arguments[c+2];r.children=o}return{$$typeof:Qw,type:t.type,key:i,ref:s,props:r,_owner:a}};kn.createContext=function(t){return t={$$typeof:ire,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:rre,_context:t},t.Consumer=t};kn.createElement=l$;kn.createFactory=function(t){var e=l$.bind(null,t);return e.type=t,e};kn.createRef=function(){return{current:null}};kn.forwardRef=function(t){return{$$typeof:sre,render:t}};kn.isValidElement=p3;kn.lazy=function(t){return{$$typeof:lre,_payload:{_status:-1,_result:t},_init:hre}};kn.memo=function(t,e){return{$$typeof:ore,type:t,compare:e===void 0?null:e}};kn.startTransition=function(t){var e=W2.transition;W2.transition={};try{t()}finally{W2.transition=e}};kn.unstable_act=c$;kn.useCallback=function(t,e){return Ea.current.useCallback(t,e)};kn.useContext=function(t){return Ea.current.useContext(t)};kn.useDebugValue=function(){};kn.useDeferredValue=function(t){return Ea.current.useDeferredValue(t)};kn.useEffect=function(t,e){return Ea.current.useEffect(t,e)};kn.useId=function(){return Ea.current.useId()};kn.useImperativeHandle=function(t,e,n){return Ea.current.useImperativeHandle(t,e,n)};kn.useInsertionEffect=function(t,e){return Ea.current.useInsertionEffect(t,e)};kn.useLayoutEffect=function(t,e){return Ea.current.useLayoutEffect(t,e)};kn.useMemo=function(t,e){return Ea.current.useMemo(t,e)};kn.useReducer=function(t,e,n){return Ea.current.useReducer(t,e,n)};kn.useRef=function(t){return Ea.current.useRef(t)};kn.useState=function(t){return Ea.current.useState(t)};kn.useSyncExternalStore=function(t,e,n){return Ea.current.useSyncExternalStore(t,e,n)};kn.useTransition=function(){return Ea.current.useTransition()};kn.version="18.3.1";t$.exports=kn;var I=t$.exports;const Ze=Zz(I),m3=Qne({__proto__:null,default:Ze},[I]);/** 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 pre=I,mre=Symbol.for("react.element"),gre=Symbol.for("react.fragment"),vre=Object.prototype.hasOwnProperty,yre=pre.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,_re={key:!0,ref:!0,__self:!0,__source:!0};function u$(t,e,n){var r,i={},s=null,a=null;n!==void 0&&(s=""+n),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(a=e.ref);for(r in e)vre.call(e,r)&&!_re.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:mre,type:t,key:s,ref:a,props:i,_owner:yre.current}}MS.Fragment=gre;MS.jsx=u$;MS.jsxs=u$;e$.exports=MS;var w=e$.exports,d$={exports:{}},Ao={},h$={exports:{}},f$={};/** 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(t){function e(V,q){var se=V.length;V.push(q);e:for(;0<se;){var he=se-1>>>1,z=V[he];if(0<i(z,q))V[he]=q,V[se]=z,se=he;else break e}}function n(V){return V.length===0?null:V[0]}function r(V){if(V.length===0)return null;var q=V[0],se=V.pop();if(se!==q){V[0]=se;e:for(var he=0,z=V.length,J=z>>>1;he<J;){var Y=2*(he+1)-1,de=V[Y],fe=Y+1,me=V[fe];if(0>i(de,se))fe<z&&0>i(me,de)?(V[he]=me,V[fe]=se,he=fe):(V[he]=de,V[Y]=se,he=Y);else if(fe<z&&0>i(me,se))V[he]=me,V[fe]=se,he=fe;else break e}}return q}function i(V,q){var se=V.sortIndex-q.sortIndex;return se!==0?se:V.id-q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();t.unstable_now=function(){return a.now()-o}}var l=[],c=[],u=1,d=null,f=3,h=!1,p=!1,m=!1,g=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b(V){for(var q=n(c);q!==null;){if(q.callback===null)r(c);else if(q.startTime<=V)r(c),q.sortIndex=q.expirationTime,e(l,q);else break;q=n(c)}}function x(V){if(m=!1,b(V),!p)if(n(l)!==null)p=!0,ne(T);else{var q=n(c);q!==null&&le(x,q.startTime-V)}}function T(V,q){p=!1,m&&(m=!1,v(L),L=-1),h=!0;var se=f;try{for(b(q),d=n(l);d!==null&&(!(d.expirationTime>q)||V&&!R());){var he=d.callback;
vendor: 9,203 bytes, lines 25-34
25if(typeof he=="function"){d.callback=null,f=d.priorityLevel;var z=he(d.expirationTime<=q);q=t.unstable_now(),typeof z=="function"?d.callback=z:d===n(l)&&r(l),b(q)}else r(l);d=n(l)}if(d!==null)var J=!0;else{var Y=n(c);Y!==null&&le(x,Y.startTime-q),J=!1}return J}finally{d=null,f=se,h=!1}}var N=!1,A=null,L=-1,M=5,B=-1;function R(){return!(t.unstable_now()-B<M)}function j(){if(A!==null){var V=t.unstable_now();B=V;var q=!0;try{q=A(!0,V)}finally{q?$():(N=!1,A=null)}}else N=!1}var $;if(typeof _=="function")$=function(){_(j)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,te=U.port2;U.port1.onmessage=j,$=function(){te.postMessage(null)}}else $=function(){g(j,0)};function ne(V){A=V,N||(N=!0,$())}function le(V,q){L=g(function(){V(t.unstable_now())},q)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(V){V.callback=null},t.unstable_continueExecution=function(){p||h||(p=!0,ne(T))},t.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<V?Math.floor(1e3/V):5},t.unstable_getCurrentPriorityLevel=function(){return f},t.unstable_getFirstCallbackNode=function(){return n(l)},t.unstable_next=function(V){switch(f){case 1:case 2:case 3:var q=3;break;default:q=f}var se=f;f=q;try{return V()}finally{f=se}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(V,q){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var se=f;f=V;try{return q()}finally{f=se}},t.unstable_scheduleCallback=function(V,q,se){var he=t.unstable_now();switch(typeof se=="object"&&se!==null?(se=se.delay,se=typeof se=="number"&&0<se?he+se:he):se=he,V){case 1:var z=-1;break;case 2:z=250;break;case 5:z=1073741823;break;case 4:z=1e4;break;default:z=5e3}return z=se+z,V={id:u++,callback:q,priorityLevel:V,startTime:se,expirationTime:z,sortIndex:-1},se>he?(V.sortIndex=se,e(c,V),n(l)===null&&V===n(c)&&(m?(v(L),L=-1):m=!0,le(x,se-he))):(V.sortIndex=z,e(l,V),p||h||(p=!0,ne(T))),V},t.unstable_shouldYield=R,t.unstable_wrapCallback=function(V){var q=f;return function(){var se=f;f=q;try{return V.apply(this,arguments)}finally{f=se}}}})(f$);h$.exports=f$;var wre=h$.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 bre=I,Eo=wre;function Ke(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var p$=new Set,z_={};function Yp(t,e){Tv(t,e),Tv(t+"Capture",e)}function Tv(t,e){for(z_[t]=e,t=0;t<e.length;t++)p$.add(e[t])}var cd=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),WA=Object.prototype.hasOwnProperty,xre=/^[: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]*$/,cD={},uD={};function kre(t){return WA.call(uD,t)?!0:WA.call(cD,t)?!1:xre.test(t)?uD[t]=!0:(cD[t]=!0,!1)}function Sre(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function Tre(t,e,n,r){if(e===null||typeof e>"u"||Sre(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.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 Aa(t,e,n,r,i,s,a){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=a}var Ps={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Ps[t]=new Aa(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Ps[e]=new Aa(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Ps[t]=new Aa(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Ps[t]=new Aa(t,2,!1,t,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(t){Ps[t]=new Aa(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Ps[t]=new Aa(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Ps[t]=new Aa(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Ps[t]=new Aa(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Ps[t]=new Aa(t,5,!1,t.toLowerCase(),null,!1,!1)});var g3=/[\-:]([a-z])/g;function v3(t){return t[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(t){var e=t.replace(g3,v3);Ps[e]=new Aa(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(g3,v3);Ps[e]=new Aa(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(g3,v3);Ps[e]=new Aa(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Ps[t]=new Aa(t,1,!1,t.toLowerCase(),null,!1,!1)});Ps.xlinkHref=new Aa("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Ps[t]=new Aa(t,1,!1,t.toLowerCase(),null,!0,!0)});function y3(t,e,n,r){var i=Ps.hasOwnProperty(e)?Ps[e]:null;(i!==null?i.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(Tre(e,n,i,r)&&(n=null),r||i===null?kre(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):i.mustUseProperty?t[i.propertyName]=n===null?i.type===3?!1:"":n:(e=i.attributeName,r=i.attributeNamespace,n===null?t.removeAttribute(e):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}var wd=bre.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,mb=Symbol.for("react.element"),_g=Symbol.for("react.portal"),wg=Symbol.for("react.fragment"),_3=Symbol.for("react.strict_mode"),GA=Symbol.for("react.profiler"),m$=Symbol.for("react.provider"),g$=Symbol.for("react.context"),w3=Symbol.for("react.forward_ref"),HA=Symbol.for("react.suspense"),KA=Symbol.for("react.suspense_list"),b3=Symbol.for("react.memo"),sh=Symbol.for("react.lazy"),v$=Symbol.for("react.offscreen"),dD=Symbol.iterator;function ay(t){return t===null||typeof t!="object"?null:(t=dD&&t[dD]||t["@@iterator"],typeof t=="function"?t:null)}var ni=Object.assign,kC;function Hy(t){if(kC===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);kC=e&&e[1]||""}return` 34`+kC+t}var SC=!1;function TC(t,e){if(!t||SC)return"";SC=!0;var n=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(c){var r=c}Reflect.construct(t,[],e)}else{try{e.call()}catch(c){r=c}t.call(e.prototype)}else{try{throw Error()}catch(c){r=c}t()}}
vendor: 8,492 bytes, lines 34-37
34catch(c){if(c&&r&&typeof c.stack=="string"){for(var i=c.stack.split(` 35`),s=r.stack.split(` 36`),a=i.length-1,o=s.length-1;1<=a&&0<=o&&i[a]!==s[o];)o--;for(;1<=a&&0<=o;a--,o--)if(i[a]!==s[o]){if(a!==1||o!==1)do if(a--,o--,0>o||i[a]!==s[o]){var l=` 37`+i[a].replace(" at new "," at ");return t.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",t.displayName)),l}while(1<=a&&0<=o);break}}}finally{SC=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Hy(t):""}function Cre(t){switch(t.tag){case 5:return Hy(t.type);case 16:return Hy("Lazy");case 13:return Hy("Suspense");case 19:return Hy("SuspenseList");case 0:case 2:case 15:return t=TC(t.type,!1),t;case 11:return t=TC(t.type.render,!1),t;case 1:return t=TC(t.type,!0),t;default:return""}}function JA(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case wg:return"Fragment";case _g:return"Portal";case GA:return"Profiler";case _3:return"StrictMode";case HA:return"Suspense";case KA:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case g$:return(t.displayName||"Context")+".Consumer";case m$:return(t._context.displayName||"Context")+".Provider";case w3:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case b3:return e=t.displayName||null,e!==null?e:JA(t.type)||"Memo";case sh:e=t._payload,t=t._init;try{return JA(t(e))}catch{}}return null}function Ere(t){var e=t.type;switch(t.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 t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return JA(e);case 8:return e===_3?"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 Gh(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function y$(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Are(t){var e=y$(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(a){r=""+a,s.call(this,a)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function gb(t){t._valueTracker||(t._valueTracker=Are(t))}function _$(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=y$(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function Hx(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function YA(t,e){var n=e.checked;return ni({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function hD(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Gh(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function w$(t,e){e=e.checked,e!=null&&y3(t,"checked",e,!1)}function XA(t,e){w$(t,e);var n=Gh(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?QA(t,e.type,n):e.hasOwnProperty("defaultValue")&&QA(t,e.type,Gh(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function fD(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function QA(t,e,n){(e!=="number"||Hx(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Ky=Array.isArray;function $g(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i<n.length;i++)e["$"+n[i]]=!0;for(n=0;n<t.length;n++)i=e.hasOwnProperty("$"+t[n].value),t[n].selected!==i&&(t[n].selected=i),i&&r&&(t[n].defaultSelected=!0)}else{for(n=""+Gh(n),e=null,i=0;i<t.length;i++){if(t[i].value===n){t[i].selected=!0,r&&(t[i].defaultSelected=!0);return}e!==null||t[i].disabled||(e=t[i])}e!==null&&(e.selected=!0)}}function ZA(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(Ke(91));return ni({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function pD(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(Ke(92));if(Ky(n)){if(1<n.length)throw Error(Ke(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:Gh(n)}}function b$(t,e){var n=Gh(e.value),r=Gh(e.defaultValue);n!=null&&(n=""+n,n!==t.value&&(t.value=n),e.defaultValue==null&&t.defaultValue!==n&&(t.defaultValue=n)),r!=null&&(t.defaultValue=""+r)}function mD(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function x$(t){switch(t){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 eP(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?x$(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var vb,k$=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,r,i){MSApp.execUnsafeLocalFunction(function(){return t(e,n,r,i)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(vb=vb||document.createElement("div"),vb.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=vb.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function $_(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var l_={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},Pre=["Webkit","ms","Moz","O"];Object.keys(l_).forEach(function(t){Pre.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),l_[e]=l_[t]})});function S$(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||l_.hasOwnProperty(t)&&l_[t]?(""+e).trim():e+"px"}function T$(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=S$(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var Mre=ni({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 tP(t,e){if(e){if(Mre[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Ke(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Ke(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Ke(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Ke(62))}}function nP(t,e){if(t.indexOf("-")===-1)return typeof e.is=="str
37ing";switch(t){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 rP=null;function x3(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var iP=null,Vg=null,qg=null;function gD(t){if(t=t1(t)){if(typeof iP!="function")throw Error(Ke(280));var e=t.stateNode;e&&(e=OS(e),iP(t.stateNode,t.type,e))}}function C$(t){Vg?qg?qg.push(t):qg=[t]:Vg=t}function E$(){if(Vg){var t=Vg,e=qg;if(qg=Vg=null,gD(t),e)for(t=0;t<e.length;t++)gD(e[t])}}function A$(t,e){return t(e)}function P$(){}var CC=!1;function M$(t,e,n){if(CC)return t(e,n);CC=!0;try{return A$(t,e,n)}finally{CC=!1,(Vg!==null||qg!==null)&&(P$(),E$())}}function V_(t,e){var n=t.stateNode;if(n===null)return null;var r=OS(n);if(r===null)return null;n=r[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":(r=!r.disabled)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(Ke(231,e,typeof n));return n}var sP=!1;if(cd)try{var oy={};Object.defineProperty(oy,"passive",{get:function(){sP=!0}}),window.addEventListener("test",oy,oy),window.removeEventListener("test",oy,oy)}catch{sP=!1}function Nre(t,e,n,r,i,s,a,o,l){var c=Array.prototype.slice.call(arguments,3);try{e.apply(n,c)}catch(u){this.onError(u)}}var c_=!1,Kx=null,Jx=!1,aP=null,Rre={onError:function(t){c_=!0,Kx=t}};function Ire(t,e,n,r,i,s,a,o,l){c_=!1,Kx=null,Nre.apply(Rre,arguments)}function Lre(t,e,n,r,i,s,a,o,l){if(Ire.apply(this,arguments),c_){if(c_){var c=Kx;c_=!1,Kx=null}else throw Error(Ke(198));Jx||(Jx=!0,aP=c)}}function Xp(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function N$(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function vD(t){if(Xp(t)!==t)throw Error(Ke(188))}function Ore(t){var e=t.alternate;if(!e){if(e=Xp(t),e===null)throw Error(Ke(188));return e!==t?null:t}for(var n=t,r=e;;){var i=n.return;if(i===null)break;var s=i.alternate;if(s===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return vD(i),t;if(s===r)return vD(i),e;s=s.sibling}throw Error(Ke(188))}if(n.return!==r.return)n=i,r=s;else{for(var a=!1,o=i.child;o;){if(o===n){a=!0,n=i,r=s;break}if(o===r){a=!0,r=i,n=s;break}o=o.sibling}if(!a){for(o=s.child;o;){if(o===n){a=!0,n=s,r=i;break}if(o===r){a=!0,r=s,n=i;break}o=o.sibling}if(!a)throw Error(Ke(189))}}if(n.alternate!==r)throw Error(Ke(190))}if(n.tag!==3)throw Error(Ke(188));return n.stateNode.current===n?t:e}function R$(t){return t=Ore(t),t!==null?I$(t):null}function I$(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=I$(t);if(e!==null)return e;t=t.sibling}return null}var L$=Eo.unstable_scheduleCallback,yD=Eo.unstable_cancelCallback,Dre=Eo.unstable_shouldYield,Fre=Eo.unstable_requestPaint,Si=Eo.unstable_now,jre=Eo.unstable_getCurrentPriorityLevel,k3=Eo.unstable_ImmediatePriority,O$=Eo.unstable_UserBlockingPriority,Yx=Eo.unstable_NormalPriority,Bre=Eo.unstable_LowPriority,D$=Eo.unstable_IdlePriority,NS=null,Jc=null;function Ure(t){if(Jc&&typeof Jc.onCommitFiberRoot=="function")try{Jc.onCommitFiberRoot(NS,t,void 0,(t.current.flags&128)===128)}catch{}}var Xl=Math.clz32?Math.clz32:Vre,zre=Math.log,$re=Math.LN2;function Vre(t){return t>>>=0,t===0?32:31-(zre(t)/$re|0)|0}var yb=64,_b=4194304;function Jy(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Xx(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,s=t.pingedLanes,a=n&268435455;if(a!==0){var o=a&~i;o!==0?r=Jy(o):(s&=a,s!==0&&(r=Jy(s)))}else a=n&~i,a!==0?r=Jy(a):s!==0&&(r=Jy(s));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0<e;)n=31-Xl(e),i=1<<n,r|=t[n],e&=~i;return r}function qre(t,e){switch(t){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 Wre(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,i=t.expirationTimes,s=t.pendingLanes;0<s;){var a=31-Xl(s),o=1<<a,l=i[a];l===-1?(!(o&n)||o&r)&&(i[a]=qre(o,e)):l<=e&&(t.expiredLanes|=o),s&=~o}}function oP(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function F$(){var t=yb;return yb<<=1,!(yb&4194240)&&(yb=64),t}function EC(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function Zw(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Xl(e),t[e]=n}function Gre(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0<n;){var i=31-Xl(n),s=1<<i;e[i]=0,r[i]=-1,t[i]=-1,n&=~s}}function S3(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-Xl(n),i=1<<r;i&e|t[r]&e&&(t[r]|=e),n&=~i}}var or=0;function j$(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var B$,T3,U$,z$,$$,lP=!1,wb=[],Ph=null,Mh=null,Nh=null,q_=new Map,W_=new Map,lh=[],Hre="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 _D(t,e){switch(t){case"focusin":case"focusout":Ph=null;break;case"dragenter":case"dragleave":Mh=null;break;case"mouseover":case"mouseout":Nh=null;break;case"pointerover":case"pointerout":q_.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":W_.delete(e.pointerId)}}function ly(t,e,n,r,i,s){return t===null||t.nativeEvent!==s?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[i]},e!==null&&(e=t1(e),e!==null&&T3(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,i!==null&&e.indexOf(i)===-1&&e.push(i),t)}function Kre(t,e,n,r,i){switch(e){case"focusin":return Ph=ly(Ph,t,e,n,r,i),!0;case"dragenter":return Mh=ly(Mh,t,e,n,r,i),!0;case"mouseover":return Nh=ly(Nh,t,e,n,r,i),!0;case"pointerover":var s=i.pointerId;return q_.set(s,ly(q_.get(s)||null,t,e,n,r,i)),!0;case"gotpointercapture":return s=i.pointerId,W_.set(s,ly(W_.get(s)||null,t,e,n,r,i)),!0}return!1}function V$(t){var e=lp(t.target);if(e!==null){var n=Xp(e);if(n!==null){if(e=n.tag,e===13){if(e=N$(n),e!==null){t.blockedOn=e,$$(t.priority,function(){U$(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function G2(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=cP(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);rP=r,n.target.dispatchEvent(r),rP=null}else return e=t1(n),e!==null&&T3(e),t.blockedOn=n,!1;e.shift()}return!0}function wD(t,e,n){G2(t)&&n.delete(e)}function Jre(){lP=!1,Ph!==null&&G2(Ph)&&(Ph=null),Mh!==null&&G2(Mh)&&(Mh=null),Nh!==null&&G2(Nh
vendor: 11,924 bytes, line 37
37)&&(Nh=null),q_.forEach(wD),W_.forEach(wD)}function cy(t,e){t.blockedOn===e&&(t.blockedOn=null,lP||(lP=!0,Eo.unstable_scheduleCallback(Eo.unstable_NormalPriority,Jre)))}function G_(t){function e(i){return cy(i,t)}if(0<wb.length){cy(wb[0],t);for(var n=1;n<wb.length;n++){var r=wb[n];r.blockedOn===t&&(r.blockedOn=null)}}for(Ph!==null&&cy(Ph,t),Mh!==null&&cy(Mh,t),Nh!==null&&cy(Nh,t),q_.forEach(e),W_.forEach(e),n=0;n<lh.length;n++)r=lh[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<lh.length&&(n=lh[0],n.blockedOn===null);)V$(n),n.blockedOn===null&&lh.shift()}var Wg=wd.ReactCurrentBatchConfig,Qx=!0;function Yre(t,e,n,r){var i=or,s=Wg.transition;Wg.transition=null;try{or=1,C3(t,e,n,r)}finally{or=i,Wg.transition=s}}function Xre(t,e,n,r){var i=or,s=Wg.transition;Wg.transition=null;try{or=4,C3(t,e,n,r)}finally{or=i,Wg.transition=s}}function C3(t,e,n,r){if(Qx){var i=cP(t,e,n,r);if(i===null)FC(t,e,r,Zx,n),_D(t,r);else if(Kre(i,t,e,n,r))r.stopPropagation();else if(_D(t,r),e&4&&-1<Hre.indexOf(t)){for(;i!==null;){var s=t1(i);if(s!==null&&B$(s),s=cP(t,e,n,r),s===null&&FC(t,e,r,Zx,n),s===i)break;i=s}i!==null&&r.stopPropagation()}else FC(t,e,r,null,n)}}var Zx=null;function cP(t,e,n,r){if(Zx=null,t=x3(r),t=lp(t),t!==null)if(e=Xp(t),e===null)t=null;else if(n=e.tag,n===13){if(t=N$(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return Zx=t,null}function q$(t){switch(t){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(jre()){case k3:return 1;case O$:return 4;case Yx:case Bre:return 16;case D$:return 536870912;default:return 16}default:return 16}}var wh=null,E3=null,H2=null;function W$(){if(H2)return H2;var t,e=E3,n=e.length,r,i="value"in wh?wh.value:wh.textContent,s=i.length;for(t=0;t<n&&e[t]===i[t];t++);var a=n-t;for(r=1;r<=a&&e[n-r]===i[s-r];r++);return H2=i.slice(t,1<r?1-r:void 0)}function K2(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function bb(){return!0}function bD(){return!1}function Po(t){function e(n,r,i,s,a){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=s,this.target=a,this.currentTarget=null;for(var o in t)t.hasOwnProperty(o)&&(n=t[o],this[o]=n?n(s):s[o]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?bb:bD,this.isPropagationStopped=bD,this}return ni(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=bb)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=bb)},persist:function(){},isPersistent:bb}),e}var Jv={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},A3=Po(Jv),e1=ni({},Jv,{view:0,detail:0}),Qre=Po(e1),AC,PC,uy,RS=ni({},e1,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:P3,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==uy&&(uy&&t.type==="mousemove"?(AC=t.screenX-uy.screenX,PC=t.screenY-uy.screenY):PC=AC=0,uy=t),AC)},movementY:function(t){return"movementY"in t?t.movementY:PC}}),xD=Po(RS),Zre=ni({},RS,{dataTransfer:0}),eie=Po(Zre),tie=ni({},e1,{relatedTarget:0}),MC=Po(tie),nie=ni({},Jv,{animationName:0,elapsedTime:0,pseudoElement:0}),rie=Po(nie),iie=ni({},Jv,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),sie=Po(iie),aie=ni({},Jv,{data:0}),kD=Po(aie),oie={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},lie={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"},cie={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function uie(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=cie[t])?!!e[t]:!1}function P3(){return uie}var die=ni({},e1,{key:function(t){if(t.key){var e=oie[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=K2(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?lie[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:P3,charCode:function(t){return t.type==="keypress"?K2(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?K2(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),hie=Po(die),fie=ni({},RS,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),SD=Po(fie),pie=ni({},e1,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:P3}),mie=Po(pie),gie=ni({},Jv,{propertyName:0,elapsedTime:0,pseudoElement:0}),vie=Po(gie),yie=ni({},RS,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),_ie=Po(yie),wie=[9,13,27,32],M3=cd&&"CompositionEvent"in window,u_=null;cd&&"documentMode"in document&&(u_=document.documentMode);var bie=cd&&"TextEvent"in window&&!u_,G$=cd&&(!M3||u_&&8<u_&&11>=u_),TD=" ",CD=!1;function H$(t,e){switch(t){case"keyup":return wie.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function K$(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var bg=!1;function xie(t,e){switch(t){case"compositionend":return K$(e);case"keypress":return e.which!==32?null:(CD=!0,TD);case"textInput":return t=e.data,t===TD&&CD?null:t;default:return null}}function kie(t,e){if(bg)return t==="compositionend"||!M3&&H$(t,e)?(t=W$(),H2=E3=wh=null,bg=!1,t):null;switch(t){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 G$&&e.locale!=="ko"?null:e.data;default:return null}}var Sie={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 ED(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!Sie[t.type]:e==="textarea"}function J$(t,e,n,r){C$(r),e=ek(e,"onChange"),0<e.length&&(n=new A3("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var d_=null,H_=null;function Tie(t){a9(t,0)}function IS(t){var e=Sg(t);if(_$(e))return t}function Cie(t,e){if(t==="change")return e}var Y$=!1;if(cd){var NC;if(cd){var RC="oninput"in document;if(!RC){var AD=document.createElement("div");AD.setAttribute("oninput","return;"),RC=typeof AD.oninput=="function"}NC=RC}else NC=!1;Y$=NC&&(!document.documentMode||9<document.documentMode)}function PD(){d_&&(d_.detachEvent("onpropertychange",X$),H_=d_=null)}function X$(t){if(t.propertyName==="value"&&IS(H_)){var e=[];J$(e,H_,t,x3(t)),M$(Tie,e)}}function Eie(t,e,n){t==="focusin"?(PD(),d_=e,H_=n,d_.attachEvent("onpropertychange",X$)):t==="focusout"&&PD()}function Aie(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return IS(H_)}function Pie(t,e){if(t==="click")return IS(e)}function Mie(t,e){if(t==="input"||t==="change")return IS(e)}function Nie(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var rc=typeof Object.is=="function"?Object.is:Nie;function K_(t,e){if(rc(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!WA.call(e,i)||!rc(t[i],e[i]))return!1}return!0}function MD(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function ND(t,e){var n=MD(t);t=0;for(var r;n;){if(n.nodeType===3){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=MD(n)}}function Q$(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Q$(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Z$(){for(var t=window,e=Hx();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Hx(t.document)}return e}function N3(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function Rie(t){var e=Z$(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&Q$(n.ownerDocument.documentElement,n)){if(r!==null&&N3(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!t.extend&&s>r&&(i=r,r=s,s=i),i=ND(n,s);var a=ND(n,r);i&&a&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==a.node||t.focusOffset!==a.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>r?(t.addRange(e),t.extend(a.node,a.offset)):(e.setEnd(a.node,a.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<e.length;n++)t=e[n],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var Iie=cd&&"documentMode"in document&&11>=document.documentMode,xg=null,uP=null,h_=null,dP=!1;function RD(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;dP||xg==null||xg!==Hx(r)||(r=xg,"selectionStart"in r&&N3(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focu
vendor: 4,510 bytes, line 37
37sNode:r.focusNode,focusOffset:r.focusOffset}),h_&&K_(h_,r)||(h_=r,r=ek(uP,"onSelect"),0<r.length&&(e=new A3("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=xg)))}function xb(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var kg={animationend:xb("Animation","AnimationEnd"),animationiteration:xb("Animation","AnimationIteration"),animationstart:xb("Animation","AnimationStart"),transitionend:xb("Transition","TransitionEnd")},IC={},e9={};cd&&(e9=document.createElement("div").style,"AnimationEvent"in window||(delete kg.animationend.animation,delete kg.animationiteration.animation,delete kg.animationstart.animation),"TransitionEvent"in window||delete kg.transitionend.transition);function LS(t){if(IC[t])return IC[t];if(!kg[t])return t;var e=kg[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in e9)return IC[t]=e[n];return t}var t9=LS("animationend"),n9=LS("animationiteration"),r9=LS("animationstart"),i9=LS("transitionend"),s9=new Map,ID="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 sf(t,e){s9.set(t,e),Yp(e,[t])}for(var LC=0;LC<ID.length;LC++){var OC=ID[LC],Lie=OC.toLowerCase(),Oie=OC[0].toUpperCase()+OC.slice(1);sf(Lie,"on"+Oie)}sf(t9,"onAnimationEnd");sf(n9,"onAnimationIteration");sf(r9,"onAnimationStart");sf("dblclick","onDoubleClick");sf("focusin","onFocus");sf("focusout","onBlur");sf(i9,"onTransitionEnd");Tv("onMouseEnter",["mouseout","mouseover"]);Tv("onMouseLeave",["mouseout","mouseover"]);Tv("onPointerEnter",["pointerout","pointerover"]);Tv("onPointerLeave",["pointerout","pointerover"]);Yp("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Yp("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Yp("onBeforeInput",["compositionend","keypress","textInput","paste"]);Yp("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Yp("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Yp("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Yy="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(" "),Die=new Set("cancel close invalid load scroll toggle".split(" ").concat(Yy));function LD(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,Lre(r,e,void 0,t),t.currentTarget=null}function a9(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],i=r.event;r=r.listeners;e:{var s=void 0;if(e)for(var a=r.length-1;0<=a;a--){var o=r[a],l=o.instance,c=o.currentTarget;if(o=o.listener,l!==s&&i.isPropagationStopped())break e;LD(i,o,c),s=l}else for(a=0;a<r.length;a++){if(o=r[a],l=o.instance,c=o.currentTarget,o=o.listener,l!==s&&i.isPropagationStopped())break e;LD(i,o,c),s=l}}}if(Jx)throw t=aP,Jx=!1,aP=null,t}function Mr(t,e){var n=e[gP];n===void 0&&(n=e[gP]=new Set);var r=t+"__bubble";n.has(r)||(o9(e,t,2,!1),n.add(r))}function DC(t,e,n){var r=0;e&&(r|=4),o9(n,t,r,e)}var kb="_reactListening"+Math.random().toString(36).slice(2);function J_(t){if(!t[kb]){t[kb]=!0,p$.forEach(function(n){n!=="selectionchange"&&(Die.has(n)||DC(n,!1,t),DC(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[kb]||(e[kb]=!0,DC("selectionchange",!1,e))}}function o9(t,e,n,r){switch(q$(e)){case 1:var i=Yre;break;case 4:i=Xre;break;default:i=C3}n=i.bind(null,e,n,t),i=void 0,!sP||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(i=!0),r?i!==void 0?t.addEventListener(e,n,{capture:!0,passive:i}):t.addEventListener(e,n,!0):i!==void 0?t.addEventListener(e,n,{passive:i}):t.addEventListener(e,n,!1)}function FC(t,e,n,r,i){var s=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var a=r.tag;if(a===3||a===4){var o=r.stateNode.containerInfo;
vendor: 5,340 bytes, lines 37-38
37if(o===i||o.nodeType===8&&o.parentNode===i)break;if(a===4)for(a=r.return;a!==null;){var l=a.tag;if((l===3||l===4)&&(l=a.stateNode.containerInfo,l===i||l.nodeType===8&&l.parentNode===i))return;a=a.return}for(;o!==null;){if(a=lp(o),a===null)return;if(l=a.tag,l===5||l===6){r=s=a;continue e}o=o.parentNode}}r=r.return}M$(function(){var c=s,u=x3(n),d=[];e:{var f=s9.get(t);if(f!==void 0){var h=A3,p=t;switch(t){case"keypress":if(K2(n)===0)break e;case"keydown":case"keyup":h=hie;break;case"focusin":p="focus",h=MC;break;case"focusout":p="blur",h=MC;break;case"beforeblur":case"afterblur":h=MC;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":h=xD;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=eie;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=mie;break;case t9:case n9:case r9:h=rie;break;case i9:h=vie;break;case"scroll":h=Qre;break;case"wheel":h=_ie;break;case"copy":case"cut":case"paste":h=sie;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=SD}var m=(e&4)!==0,g=!m&&t==="scroll",v=m?f!==null?f+"Capture":null:f;m=[];for(var _=c,b;_!==null;){b=_;var x=b.stateNode;if(b.tag===5&&x!==null&&(b=x,v!==null&&(x=V_(_,v),x!=null&&m.push(Y_(_,x,b)))),g)break;_=_.return}0<m.length&&(f=new h(f,p,null,n,u),d.push({event:f,listeners:m}))}}if(!(e&7)){e:{if(f=t==="mouseover"||t==="pointerover",h=t==="mouseout"||t==="pointerout",f&&n!==rP&&(p=n.relatedTarget||n.fromElement)&&(lp(p)||p[ud]))break e;if((h||f)&&(f=u.window===u?u:(f=u.ownerDocument)?f.defaultView||f.parentWindow:window,h?(p=n.relatedTarget||n.toElement,h=c,p=p?lp(p):null,p!==null&&(g=Xp(p),p!==g||p.tag!==5&&p.tag!==6)&&(p=null)):(h=null,p=c),h!==p)){if(m=xD,x="onMouseLeave",v="onMouseEnter",_="mouse",(t==="pointerout"||t==="pointerover")&&(m=SD,x="onPointerLeave",v="onPointerEnter",_="pointer"),g=h==null?f:Sg(h),b=p==null?f:Sg(p),f=new m(x,_+"leave",h,n,u),f.target=g,f.relatedTarget=b,x=null,lp(u)===c&&(m=new m(v,_+"enter",p,n,u),m.target=b,m.relatedTarget=g,x=m),g=x,h&&p)t:{for(m=h,v=p,_=0,b=m;b;b=Vm(b))_++;for(b=0,x=v;x;x=Vm(x))b++;for(;0<_-b;)m=Vm(m),_--;for(;0<b-_;)v=Vm(v),b--;for(;_--;){if(m===v||v!==null&&m===v.alternate)break t;m=Vm(m),v=Vm(v)}m=null}else m=null;h!==null&&OD(d,f,h,m,!1),p!==null&&g!==null&&OD(d,g,p,m,!0)}}e:{if(f=c?Sg(c):window,h=f.nodeName&&f.nodeName.toLowerCase(),h==="select"||h==="input"&&f.type==="file")var T=Cie;else if(ED(f))if(Y$)T=Mie;else{T=Aie;var N=Eie}else(h=f.nodeName)&&h.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(T=Pie);if(T&&(T=T(t,c))){J$(d,T,n,u);break e}N&&N(t,f,c),t==="focusout"&&(N=f._wrapperState)&&N.controlled&&f.type==="number"&&QA(f,"number",f.value)}switch(N=c?Sg(c):window,t){case"focusin":(ED(N)||N.contentEditable==="true")&&(xg=N,uP=c,h_=null);break;case"focusout":h_=uP=xg=null;break;case"mousedown":dP=!0;break;case"contextmenu":case"mouseup":case"dragend":dP=!1,RD(d,n,u);break;case"selectionchange":if(Iie)break;case"keydown":case"keyup":RD(d,n,u)}var A;if(M3)e:{switch(t){case"compositionstart":var L="onCompositionStart";break e;case"compositionend":L="onCompositionEnd";break e;case"compositionupdate":L="onCompositionUpdate";break e}L=void 0}else bg?H$(t,n)&&(L="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(L="onCompositionStart");L&&(G$&&n.locale!=="ko"&&(bg||L!=="onCompositionStart"?L==="onCompositionEnd"&&bg&&(A=W$()):(wh=u,E3="value"in wh?wh.value:wh.textContent,bg=!0)),N=ek(c,L),0<N.length&&(L=new kD(L,t,null,n,u),d.push({event:L,listeners:N}),A?L.data=A:(A=K$(n),A!==null&&(L.data=A)))),(A=bie?xie(t,n):kie(t,n))&&(c=ek(c,"onBeforeInput"),0<c.length&&(u=new kD("onBeforeInput","beforeinput",null,n,u),d.push({event:u,listeners:c}),u.data=A))}a9(d,e)})}function Y_(t,e,n){return{instance:t,listener:e,currentTarget:n}}function ek(t,e){for(var n=e+"Capture",r=[];t!==null;){var i=t,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=V_(t,n),s!=null&&r.unshift(Y_(t,s,i)),s=V_(t,e),s!=null&&r.push(Y_(t,s,i))),t=t.return}return r}function Vm(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function OD(t,e,n,r,i){for(var s=e._reactName,a=[];n!==null&&n!==r;){var o=n,l=o.alternate,c=o.stateNode;if(l!==null&&l===r)break;o.tag===5&&c!==null&&(o=c,i?(l=V_(n,s),l!=null&&a.unshift(Y_(n,l,o))):i||(l=V_(n,s),l!=null&&a.push(Y_(n,l,o)))),n=n.return}a.length!==0&&t.push({event:e,listeners:a})}var Fie=/\r\n?/g,jie=/\u0000|\uFFFD/g;function DD(t){return(typeof t=="string"?t:""+t).replace(Fie,` 38`).replace(jie,"")}function Sb(t,e,n){if(e=DD(e),DD(t)!==e&&n)throw Error(Ke(425))}function tk(){}var hP=null,fP=null;function pP(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var mP=typeof setTimeout=="function"?setTimeout:void 0,Bie=typeof clearTimeout=="function"?clearTimeout:void 0,FD=typeof Promise=="function"?Promise:void 0,Uie=typeof queueMicrotask=="function"?queueMicrotask:typeof FD<"u"?function(t){return FD.resolve(null).then(t).cat
vendor: 4,606 bytes, line 38
38ch(zie)}:mP;function zie(t){setTimeout(function(){throw t})}function jC(t,e){var n=e,r=0;do{var i=n.nextSibling;if(t.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){t.removeChild(i),G_(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);G_(e)}function Rh(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function jD(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(e===0)return t;e--}else n==="/$"&&e++}t=t.previousSibling}return null}var Yv=Math.random().toString(36).slice(2),$c="__reactFiber$"+Yv,X_="__reactProps$"+Yv,ud="__reactContainer$"+Yv,gP="__reactEvents$"+Yv,$ie="__reactListeners$"+Yv,Vie="__reactHandles$"+Yv;function lp(t){var e=t[$c];if(e)return e;for(var n=t.parentNode;n;){if(e=n[ud]||n[$c]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=jD(t);t!==null;){if(n=t[$c])return n;t=jD(t)}return e}t=n,n=t.parentNode}return null}function t1(t){return t=t[$c]||t[ud],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Sg(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(Ke(33))}function OS(t){return t[X_]||null}var vP=[],Tg=-1;function af(t){return{current:t}}function Dr(t){0>Tg||(t.current=vP[Tg],vP[Tg]=null,Tg--)}function Sr(t,e){Tg++,vP[Tg]=t.current,t.current=e}var Hh={},ea=af(Hh),Ga=af(!1),Op=Hh;function Cv(t,e){var n=t.type.contextTypes;if(!n)return Hh;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=e[s];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function Ha(t){return t=t.childContextTypes,t!=null}function nk(){Dr(Ga),Dr(ea)}function BD(t,e,n){if(ea.current!==Hh)throw Error(Ke(168));Sr(ea,e),Sr(Ga,n)}function l9(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(Ke(108,Ere(t)||"Unknown",i));return ni({},n,r)}function rk(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Hh,Op=ea.current,Sr(ea,t),Sr(Ga,Ga.current),!0}function UD(t,e,n){var r=t.stateNode;if(!r)throw Error(Ke(169));n?(t=l9(t,e,Op),r.__reactInternalMemoizedMergedChildContext=t,Dr(Ga),Dr(ea),Sr(ea,t)):Dr(Ga),Sr(Ga,n)}var Hu=null,DS=!1,BC=!1;function c9(t){Hu===null?Hu=[t]:Hu.push(t)}function qie(t){DS=!0,c9(t)}function of(){if(!BC&&Hu!==null){BC=!0;var t=0,e=or;try{var n=Hu;for(or=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}Hu=null,DS=!1}catch(i){throw Hu!==null&&(Hu=Hu.slice(t+1)),L$(k3,of),i}finally{or=e,BC=!1}}return null}var Cg=[],Eg=0,ik=null,sk=0,Ko=[],Jo=0,Dp=null,nd=1,rd="";function qf(t,e){Cg[Eg++]=sk,Cg[Eg++]=ik,ik=t,sk=e}function u9(t,e,n){Ko[Jo++]=nd,Ko[Jo++]=rd,Ko[Jo++]=Dp,Dp=t;var r=nd;t=rd;var i=32-Xl(r)-1;r&=~(1<<i),n+=1;var s=32-Xl(e)+i;if(30<s){var a=i-i%5;s=(r&(1<<a)-1).toString(32),r>>=a,i-=a,nd=1<<32-Xl(e)+i|n<<i|r,rd=s+t}else nd=1<<s|n<<i|r,rd=t}function R3(t){t.return!==null&&(qf(t,1),u9(t,1,0))}function I3(t){for(;t===ik;)ik=Cg[--Eg],Cg[Eg]=null,sk=Cg[--Eg],Cg[Eg]=null;for(;t===Dp;)Dp=Ko[--Jo],Ko[Jo]=null,rd=Ko[--Jo],Ko[Jo]=null,nd=Ko[--Jo],Ko[Jo]=null}var To=null,bo=null,qr=!1,Fl=null;function d9(t,e){var n=Qo(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,e=t.deletions,e===null?(t.deletions=[n],t.flags|=16):e.push(n)}function zD(t,e){switch(t.tag){case 5:var n=t.type;return e=e.nodeType!==1||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,To=t,bo=Rh(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,To=t,bo=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=Dp!==null?{id:nd,overflow:rd}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=Qo(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,To=t,bo=null,!0):!1;default:return!1}}function yP(t){return(t.mode&1)!==0&&(t.flags&128)===0}function _P(t){if(qr){var e=bo;if(e){var n=e;if(!zD(t,e)){if(yP(t))throw Error(Ke(418));e=Rh(n.nextSibling);var r=To;e&&zD(t,e)?d9(r,n):(t.flags=t.flags&-4097|2,qr=!1,To=t)}}else{if(yP(t))throw Error(Ke(418));t.flags=t.flags&-4097|2,qr=!1,To=t}}}function $D(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;To=t}function Tb(t){if(t!==To)return!1;if(!qr)return $D(t),qr=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!pP
vendor: 12,803 bytes, line 38
38(t.type,t.memoizedProps)),e&&(e=bo)){if(yP(t))throw h9(),Error(Ke(418));for(;e;)d9(t,e),e=Rh(e.nextSibling)}if($D(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(Ke(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){bo=Rh(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}bo=null}}else bo=To?Rh(t.stateNode.nextSibling):null;return!0}function h9(){for(var t=bo;t;)t=Rh(t.nextSibling)}function Ev(){bo=To=null,qr=!1}function L3(t){Fl===null?Fl=[t]:Fl.push(t)}var Wie=wd.ReactCurrentBatchConfig;function dy(t,e,n){if(t=n.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(Ke(309));var r=n.stateNode}if(!r)throw Error(Ke(147,t));var i=r,s=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===s?e.ref:(e=function(a){var o=i.refs;a===null?delete o[s]:o[s]=a},e._stringRef=s,e)}if(typeof t!="string")throw Error(Ke(284));if(!n._owner)throw Error(Ke(290,t))}return t}function Cb(t,e){throw t=Object.prototype.toString.call(e),Error(Ke(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function VD(t){var e=t._init;return e(t._payload)}function f9(t){function e(v,_){if(t){var b=v.deletions;b===null?(v.deletions=[_],v.flags|=16):b.push(_)}}function n(v,_){if(!t)return null;for(;_!==null;)e(v,_),_=_.sibling;return null}function r(v,_){for(v=new Map;_!==null;)_.key!==null?v.set(_.key,_):v.set(_.index,_),_=_.sibling;return v}function i(v,_){return v=Dh(v,_),v.index=0,v.sibling=null,v}function s(v,_,b){return v.index=b,t?(b=v.alternate,b!==null?(b=b.index,b<_?(v.flags|=2,_):b):(v.flags|=2,_)):(v.flags|=1048576,_)}function a(v){return t&&v.alternate===null&&(v.flags|=2),v}function o(v,_,b,x){return _===null||_.tag!==6?(_=GC(b,v.mode,x),_.return=v,_):(_=i(_,b),_.return=v,_)}function l(v,_,b,x){var T=b.type;return T===wg?u(v,_,b.props.children,x,b.key):_!==null&&(_.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===sh&&VD(T)===_.type)?(x=i(_,b.props),x.ref=dy(v,_,b),x.return=v,x):(x=tx(b.type,b.key,b.props,null,v.mode,x),x.ref=dy(v,_,b),x.return=v,x)}function c(v,_,b,x){return _===null||_.tag!==4||_.stateNode.containerInfo!==b.containerInfo||_.stateNode.implementation!==b.implementation?(_=HC(b,v.mode,x),_.return=v,_):(_=i(_,b.children||[]),_.return=v,_)}function u(v,_,b,x,T){return _===null||_.tag!==7?(_=Ep(b,v.mode,x,T),_.return=v,_):(_=i(_,b),_.return=v,_)}function d(v,_,b){if(typeof _=="string"&&_!==""||typeof _=="number")return _=GC(""+_,v.mode,b),_.return=v,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case mb:return b=tx(_.type,_.key,_.props,null,v.mode,b),b.ref=dy(v,null,_),b.return=v,b;case _g:return _=HC(_,v.mode,b),_.return=v,_;case sh:var x=_._init;return d(v,x(_._payload),b)}if(Ky(_)||ay(_))return _=Ep(_,v.mode,b,null),_.return=v,_;Cb(v,_)}return null}function f(v,_,b,x){var T=_!==null?_.key:null;if(typeof b=="string"&&b!==""||typeof b=="number")return T!==null?null:o(v,_,""+b,x);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case mb:return b.key===T?l(v,_,b,x):null;case _g:return b.key===T?c(v,_,b,x):null;case sh:return T=b._init,f(v,_,T(b._payload),x)}if(Ky(b)||ay(b))return T!==null?null:u(v,_,b,x,null);Cb(v,b)}return null}function h(v,_,b,x,T){if(typeof x=="string"&&x!==""||typeof x=="number")return v=v.get(b)||null,o(_,v,""+x,T);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case mb:return v=v.get(x.key===null?b:x.key)||null,l(_,v,x,T);case _g:return v=v.get(x.key===null?b:x.key)||null,c(_,v,x,T);case sh:var N=x._init;return h(v,_,b,N(x._payload),T)}if(Ky(x)||ay(x))return v=v.get(b)||null,u(_,v,x,T,null);Cb(_,x)}return null}function p(v,_,b,x){for(var T=null,N=null,A=_,L=_=0,M=null;A!==null&&L<b.length;L++){A.index>L?(M=A,A=null):M=A.sibling;var B=f(v,A,b[L],x);if(B===null){A===null&&(A=M);break}t&&A&&B.alternate===null&&e(v,A),_=s(B,_,L),N===null?T=B:N.sibling=B,N=B,A=M}if(L===b.length)return n(v,A),qr&&qf(v,L),T;if(A===null){for(;L<b.length;L++)A=d(v,b[L],x),A!==null&&(_=s(A,_,L),N===null?T=A:N.sibling=A,N=A);return qr&&qf(v,L),T}for(A=r(v,A);L<b.length;L++)M=h(A,v,L,b[L],x),M!==null&&(t&&M.alternate!==null&&A.delete(M.key===null?L:M.key),_=s(M,_,L),N===null?T=M:N.sibling=M,N=M);return t&&A.forEach(function(R){return e(v,R)}),qr&&qf(v,L),T}function m(v,_,b,x){var T=ay(b);if(typeof T!="function")throw Error(Ke(150));if(b=T.call(b),b==null)throw Error(Ke(151));for(var N=T=null,A=_,L=_=0,M=null,B=b.next();A!==null&&!B.done;L++,B=b.next()){A.index>L?(M=A,A=null):M=A.sibling;var R=f(v,A,B.value,x);if(R===null){A===null&&(A=M);break}t&&A&&R.alternate===null&&e(v,A),_=s(R,_,L),N===null?T=R:N.sibling=R,N=R,A=M}if(B.done)return n(v,A),qr&&qf(v,L),T;if(A===null){for(;!B.done;L++,B=b.next())B=d(v,B.value,x),B!==null&&(_=s(B,_,L),N===null?T=B:N.sibling=B,N=B);return qr&&qf(v,L),T}for(A=r(v,A);!B.done;L++,B=b.next())B=h(A,v,L,B.value,x),B!==null&&(t&&B.alternate!==null&&A.delete(B.key===null?L:B.key),_=s(B,_,L),N===null?T=B:N.sibling=B,N=B);return t&&A.forEach(function(j){return e(v,j)}),qr&&qf(v,L),T}function g(v,_,b,x){if(typeof b=="object"&&b!==null&&b.type===wg&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case mb:e:{for(var T=b.key,N=_;N!==null;){if(N.key===T){if(T=b.type,T===wg){if(N.tag===7){n(v,N.sibling),_=i(N,b.props.children),_.return=v,v=_;break e}}else if(N.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===sh&&VD(T)===N.type){n(v,N.sibling),_=i(N,b.props),_.ref=dy(v,N,b),_.return=v,v=_;break e}n(v,N);break}else e(v,N);N=N.sibling}b.type===wg?(_=Ep(b.props.children,v.mode,x,b.key),_.return=v,v=_):(x=tx(b.type,b.key,b.props,null,v.mode,x),x.ref=dy(v,_,b),x.return=v,v=x)}return a(v);case _g:e:{for(N=b.key;_!==null;){if(_.key===N)if(_.tag===4&&_.stateNode.containerInfo===b.containerInfo&&_.stateNode.implementation===b.implementation){n(v,_.sibling),_=i(_,b.children||[]),_.return=v,v=_;break e}else{n(v,_);break}else e(v,_);_=_.sibling}_=HC(b,v.mode,x),_.return=v,v=_}return a(v);case sh:return N=b._init,g(v,_,N(b._payload),x)}if(Ky(b))return p(v,_,b,x);if(ay(b))return m(v,_,b,x);Cb(v,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,_!==null&&_.tag===6?(n(v,_.sibling),_=i(_,b),_.return=v,v=_):(n(v,_),_=GC(b,v.mode,x),_.return=v,v=_),a(v)):n(v,_)}return g}var Av=f9(!0),p9=f9(!1),ak=af(null),ok=null,Ag=null,O3=null;function D3(){O3=Ag=ok=null}function F3(t){var e=ak.current;Dr(ak),t._currentValue=e}function wP(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function Gg(t,e){ok=t,O3=Ag=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Va=!0),t.firstContext=null)}function nl(t){var e=t._currentValue;if(O3!==t)if(t={context:t,memoizedValue:e,next:null},Ag===null){if(ok===null)throw Error(Ke(308));Ag=t,ok.dependencies={lanes:0,firstContext:t}}else Ag=Ag.next=t;return e}var cp=null;function j3(t){cp===null?cp=[t]:cp.push(t)}function m9(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,j3(e)):(n.next=i.next,i.next=n),e.interleaved=n,dd(t,r)}function dd(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var ah=!1;function B3(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function g9(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function od(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Ih(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,Un&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,dd(t,n)}return i=r.interleaved,i===null?(e.next=e,j3(r)):(e.next=i.next,i.next=e),r.interleaved=e,dd(t,n)}function J2(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,S3(t,n)}}function qD(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=a:s=s.next=a,n=n.next}while(n!==null);s===null?i=s=e:s=s.next=e}else i=s=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function lk(t,e,n,r){var i=t.updateQueue;ah=!1;var s=i.firstBaseUpdate,a=i.lastBaseUpdate,o=i.shared.pending;if(o!==null){i.shared.pending=null;var l=o,c=l.next;l.next=null,a===null?s=c:a.next=c,a=l;var u=t.alternate;u!==null&&(u=u.updateQueue,o=u.lastBaseUpdate,o!==a&&(o===null?u.firstBaseUpdate=c:o.next=c,u.lastBaseUpdate=l))}if(s!==null){var d=i.baseState;a=0,u=c=l=null,o=s;do{var f=o.lane,h=o.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:h,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var p=t,m=o;switch(f=e,h=n,m.tag){case 1:if(p=m.payload,typeof p=="function"){d=p.call(h,d,f);break e}d=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=m.payload,f=typeof p=="function"?p.call(h,d,f):p,f==null)break e;d=ni({},d,f);break e;case 2:ah=!0}}o.callback!==null&&o.lane!==0&&(t.flags|=64,f=i.effects,f===null?i.effects=[o]:f.push(o))}else h={eventTime:h,lane:f,tag:o.tag,payload:o.payload,callback:o.callback,next:null},u===null?(c=u=h,l=d):u=u.next=h,a|=f;if(o=o.next,o===null){if(o=i.shared.pending,o===null)break;f=o,o=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(u===null&&(l=d),i.baseState=l,i.firstBaseUpdate=c,i.lastBaseUpdate=u,e=i.shared.interleaved,e!==null){i=e;do a|=i.lane,i=i.next;while(i!==e)}else s===null&&(i.shared.lanes=0);jp|=a,t.lanes=a,t.memoizedState=d}}function WD(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(Ke(191,i));i.call(r)}}}var n1={},Yc=af(n1),Q_=af(n1),Z_=af(n1);function up(t){if(t===n1)throw Error(Ke(174));return t}function U3(t,e){switch(Sr(Z_,e),Sr(Q_,t),Sr(Yc,n1),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:eP(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=eP(e,t)}Dr(Yc),Sr(Yc,e)}function Pv(){Dr(Yc),Dr(Q_),Dr(Z_)}function v9(t){up(Z_.current);var e=up(Yc.current),n=eP(e,t.type);e!==n&&(Sr(Q_,t),Sr(Yc,n))}function z3(t){Q_.current===t&&(Dr(Yc),Dr(Q_))}var Zr=af(0);function ck(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.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===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var UC=[];function $3(){for(var t=0;t<UC.length;t++)UC[t]._workInProgressVersionPrimary=null;UC.length=0}var Y2=wd.ReactCurrentDispatcher,zC=wd.ReactCurrentBatchConfig,Fp=0,ei=null,Wi=null,as=null,uk=!1,f_=!1,ew=0,Gie=0;function Us(){throw Error(Ke(321))}function V3(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!rc(t[n],e[n]))return!1;return!0}function q3(t,e,n,r,i,s){if(Fp=s,ei=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Y2.current=t===null||t.memoizedState===null?Yie:Xie,t=n(r,i),f_){s=0;do{if(f_=!1,ew=0,25<=s)throw Error(Ke(301));s+=1,as=Wi=null,e.updateQueue=null,Y2.current=Qie,t=n(r,i)}while(f_)}if(Y2.current=dk,e=Wi!==null&&Wi.next!==null,Fp=0,as=Wi=ei=null,uk=!1,e)throw Error(Ke(300));return t}function W3(){var t=ew!==0;return ew=0,t}function Ic(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return as===null?ei.memoizedState=as=t:as=as.next=t,as}function rl(){if(Wi===null){var t=ei.alternate;t=t!==null?t.memoizedState:null}else t=Wi.next;var e=as===null?ei.memoizedState:as.next;if(e!==null)as=e,Wi=t;else{if(t===null)throw Error(Ke(310));Wi=t,t={memoizedState:Wi.memoizedState,baseState:Wi.baseState,baseQueue:Wi.baseQueue,queue:Wi.queue,next:null},as===null?ei.memoizedState=as=t:as=as.next=t}return as}function tw(t,e){return typeof e=="function"?e(t):e}function $C(t){var e=rl(),n=e.queue;if(n===null)throw Error(Ke(311));n.lastRenderedReducer=t;var r=Wi,i=r.baseQueue,s=n.pending;if(s!==null){if(i!==null){var a=i.next;
vendor: 5,622 bytes, line 38
38i.next=s.next,s.next=a}r.baseQueue=i=s,n.pending=null}if(i!==null){s=i.next,r=r.baseState;var o=a=null,l=null,c=s;do{var u=c.lane;if((Fp&u)===u)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:t(r,c.action);else{var d={lane:u,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(o=l=d,a=r):l=l.next=d,ei.lanes|=u,jp|=u}c=c.next}while(c!==null&&c!==s);l===null?a=r:l.next=o,rc(r,e.memoizedState)||(Va=!0),e.memoizedState=r,e.baseState=a,e.baseQueue=l,n.lastRenderedState=r}if(t=n.interleaved,t!==null){i=t;do s=i.lane,ei.lanes|=s,jp|=s,i=i.next;while(i!==t)}else i===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function VC(t){var e=rl(),n=e.queue;if(n===null)throw Error(Ke(311));n.lastRenderedReducer=t;var r=n.dispatch,i=n.pending,s=e.memoizedState;if(i!==null){n.pending=null;var a=i=i.next;do s=t(s,a.action),a=a.next;while(a!==i);rc(s,e.memoizedState)||(Va=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),n.lastRenderedState=s}return[s,r]}function y9(){}function _9(t,e){var n=ei,r=rl(),i=e(),s=!rc(r.memoizedState,i);if(s&&(r.memoizedState=i,Va=!0),r=r.queue,G3(x9.bind(null,n,r,t),[t]),r.getSnapshot!==e||s||as!==null&&as.memoizedState.tag&1){if(n.flags|=2048,nw(9,b9.bind(null,n,r,i,e),void 0,null),ds===null)throw Error(Ke(349));Fp&30||w9(n,e,i)}return i}function w9(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=ei.updateQueue,e===null?(e={lastEffect:null,stores:null},ei.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function b9(t,e,n,r){e.value=n,e.getSnapshot=r,k9(e)&&S9(t)}function x9(t,e,n){return n(function(){k9(e)&&S9(t)})}function k9(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!rc(t,n)}catch{return!0}}function S9(t){var e=dd(t,1);e!==null&&Ql(e,t,1,-1)}function GD(t){var e=Ic();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:tw,lastRenderedState:t},e.queue=t,t=t.dispatch=Jie.bind(null,ei,t),[e.memoizedState,t]}function nw(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=ei.updateQueue,e===null?(e={lastEffect:null,stores:null},ei.updateQueue=e,e.lastEffect=t.next=t):(n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t)),t}function T9(){return rl().memoizedState}function X2(t,e,n,r){var i=Ic();ei.flags|=t,i.memoizedState=nw(1|e,n,void 0,r===void 0?null:r)}function FS(t,e,n,r){var i=rl();r=r===void 0?null:r;var s=void 0;if(Wi!==null){var a=Wi.memoizedState;if(s=a.destroy,r!==null&&V3(r,a.deps)){i.memoizedState=nw(e,n,s,r);return}}ei.flags|=t,i.memoizedState=nw(1|e,n,s,r)}function HD(t,e){return X2(8390656,8,t,e)}function G3(t,e){return FS(2048,8,t,e)}function C9(t,e){return FS(4,2,t,e)}function E9(t,e){return FS(4,4,t,e)}function A9(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function P9(t,e,n){return n=n!=null?n.concat([t]):null,FS(4,4,A9.bind(null,e,t),n)}function H3(){}function M9(t,e){var n=rl();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&V3(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function N9(t,e){var n=rl();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&V3(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function R9(t,e,n){return Fp&21?(rc(n,e)||(n=F$(),ei.lanes|=n,jp|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,Va=!0),t.memoizedState=n)}function Hie(t,e){var n=or;or=n!==0&&4>n?n:4,t(!0);var r=zC.transition;zC.transition={};try{t(!1),e()}finally{or=n,zC.transition=r}}function I9(){return rl().memoizedState}function Kie(t,e,n){var r=Oh(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},L9(t))O9(e,n);else if(n=m9(t,e,n,r),n!==null){var i=Ta();Ql(n,t,r,i),D9(n,e,r)}}function Jie(t,e,n){var r=Oh(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(L9(t))O9(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var a=e.lastRenderedState,o=s(a,n);if(i.hasEagerState=!0,i.eagerState=o,rc(o,a)){var l=e.interleaved;l===null?(i.next=i,j3(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}n=m9(t,e,i,r),n!==null&&(i=Ta(),Ql(n,t,r,i),D9(n,e,r))}}function L9(t){var e=t.alternate;return t===ei||e!==null&&e===ei}function O9(t,e){f_=uk=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function D9(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,S3(t,n)}}var dk={readContext:nl,useCallback:Us,useContext:Us,useEffect:Us,useImperativeHandle:Us,useInsertionEffect:Us,useLayoutEffect:Us,useMemo:Us,useReducer:Us,useRef:Us,useState:Us,useDebugValue:Us,useDeferredValue:Us,useTransition:Us,useMutableSource:Us,useSyncExternalStore:Us,useId:Us,unstable_isNewReconciler:!1},Yie={readContext:nl,useCallback:function(t,e){return Ic().memoizedState=[t,e===void 0?null:e],t},useContext:nl,useEffect:HD,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,X2(4194308,4,A9.bind(null,e,t),n)},useLayoutEffect:function(t,e){return X2(4194308,4,t,e)},useInsertionEffect:function(t,e){return X2(4,2,t,e)},useMemo:function(t,e){var n=Ic();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Ic();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=Kie.bind(null,ei,t),[r.memoizedState,t]}
vendor: 7,442 bytes, lines 38-40
38,useRef:function(t){var e=Ic();return t={current:t},e.memoizedState=t},useState:GD,useDebugValue:H3,useDeferredValue:function(t){return Ic().memoizedState=t},useTransition:function(){var t=GD(!1),e=t[0];return t=Hie.bind(null,t[1]),Ic().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=ei,i=Ic();if(qr){if(n===void 0)throw Error(Ke(407));n=n()}else{if(n=e(),ds===null)throw Error(Ke(349));Fp&30||w9(r,e,n)}i.memoizedState=n;var s={value:n,getSnapshot:e};return i.queue=s,HD(x9.bind(null,r,s,t),[t]),r.flags|=2048,nw(9,b9.bind(null,r,s,n,e),void 0,null),n},useId:function(){var t=Ic(),e=ds.identifierPrefix;if(qr){var n=rd,r=nd;n=(r&~(1<<32-Xl(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=ew++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=Gie++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},Xie={readContext:nl,useCallback:M9,useContext:nl,useEffect:G3,useImperativeHandle:P9,useInsertionEffect:C9,useLayoutEffect:E9,useMemo:N9,useReducer:$C,useRef:T9,useState:function(){return $C(tw)},useDebugValue:H3,useDeferredValue:function(t){var e=rl();return R9(e,Wi.memoizedState,t)},useTransition:function(){var t=$C(tw)[0],e=rl().memoizedState;return[t,e]},useMutableSource:y9,useSyncExternalStore:_9,useId:I9,unstable_isNewReconciler:!1},Qie={readContext:nl,useCallback:M9,useContext:nl,useEffect:G3,useImperativeHandle:P9,useInsertionEffect:C9,useLayoutEffect:E9,useMemo:N9,useReducer:VC,useRef:T9,useState:function(){return VC(tw)},useDebugValue:H3,useDeferredValue:function(t){var e=rl();return Wi===null?e.memoizedState=t:R9(e,Wi.memoizedState,t)},useTransition:function(){var t=VC(tw)[0],e=rl().memoizedState;return[t,e]},useMutableSource:y9,useSyncExternalStore:_9,useId:I9,unstable_isNewReconciler:!1};function Pl(t,e){if(t&&t.defaultProps){e=ni({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function bP(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:ni({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var jS={isMounted:function(t){return(t=t._reactInternals)?Xp(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=Ta(),i=Oh(t),s=od(r,i);s.payload=e,n!=null&&(s.callback=n),e=Ih(t,s,i),e!==null&&(Ql(e,t,i,r),J2(e,t,i))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=Ta(),i=Oh(t),s=od(r,i);s.tag=1,s.payload=e,n!=null&&(s.callback=n),e=Ih(t,s,i),e!==null&&(Ql(e,t,i,r),J2(e,t,i))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=Ta(),r=Oh(t),i=od(n,r);i.tag=2,e!=null&&(i.callback=e),e=Ih(t,i,r),e!==null&&(Ql(e,t,r,n),J2(e,t,r))}};function KD(t,e,n,r,i,s,a){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,s,a):e.prototype&&e.prototype.isPureReactComponent?!K_(n,r)||!K_(i,s):!0}function F9(t,e,n){var r=!1,i=Hh,s=e.contextType;return typeof s=="object"&&s!==null?s=nl(s):(i=Ha(e)?Op:ea.current,r=e.contextTypes,s=(r=r!=null)?Cv(t,i):Hh),e=new e(n,s),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=jS,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=i,t.__reactInternalMemoizedMaskedChildContext=s),e}function JD(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&jS.enqueueReplaceState(e,e.state,null)}function xP(t,e,n,r){var i=t.stateNode;i.props=n,i.state=t.memoizedState,i.refs={},B3(t);var s=e.contextType;typeof s=="object"&&s!==null?i.context=nl(s):(s=Ha(e)?Op:ea.current,i.context=Cv(t,s)),i.state=t.memoizedState,s=e.getDerivedStateFromProps,typeof s=="function"&&(bP(t,e,s,n),i.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(e=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),e!==i.state&&jS.enqueueReplaceState(i,i.state,null),lk(t,n,i,r),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308)}function Mv(t,e){try{var n="",r=e;do n+=Cre(r),r=r.return;while(r);var i=n}catch(s){i=` 39Error generating stack: `+s.message+` 40`+s.stack}return{value:t,source:e,stack:i,digest:null}}function qC(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function kP(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var Zie=typeof WeakMap=="function"?WeakMap:Map;function j9(t,e,n){n=od(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){fk||(fk=!0,IP=r),kP(t,e)},n}function B9(t,e,n){n=od(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var i=e.value;n.payload=function(){return r(i)},n.callback=function(){kP(t,e)}}var s=t.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){kP(t,e),typeof r!="function"&&(Lh===null?Lh=new Set([this]):Lh.add(this));var a=e.stack;this.componentDidCatch(e.value,{componentStack:a!==null?a:""})}),n}function YD(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new Zie;var i=new Set;r.set(e,i)}else i=r.get(e),i===void 0&&(i=new Set,r.set(e,i));i.has(n)||(i.add(n),t=fse.bind(null,t,e,n),e.then(t,t))}function XD(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function QD(t,e,n,r,i){return t.mode&1?(t.flags|=65536,t.lanes=i,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=od(-1,1),e.tag=2,Ih(n,e,1))),n.lanes|=1),t)}var ese=wd.ReactCurrentOwner,Va=!1;function ga(t,e,n,r){e.child=t===null?p9(e,null,n,r):Av(e,t.child,n,r)}function ZD(t,e,n,r,i){n=n.render;var s=e.ref;return Gg(e,i),r=q3(t,e,n,r,s,i),n=W3(),t!==null&&!Va?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,hd(t,e,i)):(qr&&n&&R3(e),e.flags|=1,ga(t,e,r,i),e.child)}function eF(t,e,n,r,i){if(t===null){var s=n.type;return typeof s=="function"&&!tR(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=s,U9(t,e,s,r,i)):(t=tx(n.type,null,r,e,e.mode,i),t.ref=e.ref,t.return=e,e.child=t)}if(s=t.child,!(t.lanes&i)){var a=s.memoizedProps;if(n=n.compare,n=n!==null?n:K_,n(a,r)&&t.ref===e.ref)return hd(t,e,i)}return e.flags|=1,t=Dh(s,r),t.ref=e.ref,t.return=e,e.child=t}function U9(t,e,n,r,i){if(t!==null){var s=t.memoizedProps;if(K_(s,r)&&t.ref===e.ref)if(Va=!1,e.pendingProps=r=s,(t.lanes&i)!==0)t.flags&131072&&(Va=!0);else return e.lanes=t.lanes,hd(t,e,i)}return SP(t,e,n,r,i)}function z9(t,e,n){var r=e.pendingProps,i=r.children,s=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Sr(Mg,po),po|=n;else{if(!(n&1073741824))return t=s!==null?s.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,Sr(Mg,po),po|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,Sr(Mg,po),po|=r}else s!==null?(r=s.baseLanes|n,e.memoizedState=null):r=n,Sr(Mg,po),po|=r;return ga(t,e,i,n),e.child}function $9(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}
vendor: 5,246 bytes, line 40
40function SP(t,e,n,r,i){var s=Ha(n)?Op:ea.current;return s=Cv(e,s),Gg(e,i),n=q3(t,e,n,r,s,i),r=W3(),t!==null&&!Va?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,hd(t,e,i)):(qr&&r&&R3(e),e.flags|=1,ga(t,e,n,i),e.child)}function tF(t,e,n,r,i){if(Ha(n)){var s=!0;rk(e)}else s=!1;if(Gg(e,i),e.stateNode===null)Q2(t,e),F9(e,n,r),xP(e,n,r,i),r=!0;else if(t===null){var a=e.stateNode,o=e.memoizedProps;a.props=o;var l=a.context,c=n.contextType;typeof c=="object"&&c!==null?c=nl(c):(c=Ha(n)?Op:ea.current,c=Cv(e,c));var u=n.getDerivedStateFromProps,d=typeof u=="function"||typeof a.getSnapshotBeforeUpdate=="function";d||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==r||l!==c)&&JD(e,a,r,c),ah=!1;var f=e.memoizedState;a.state=f,lk(e,r,a,i),l=e.memoizedState,o!==r||f!==l||Ga.current||ah?(typeof u=="function"&&(bP(e,n,u,r),l=e.memoizedState),(o=ah||KD(e,n,o,r,f,l,c))?(d||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(e.flags|=4194308)):(typeof a.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=l),a.props=r,a.state=l,a.context=c,r=o):(typeof a.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{a=e.stateNode,g9(t,e),o=e.memoizedProps,c=e.type===e.elementType?o:Pl(e.type,o),a.props=c,d=e.pendingProps,f=a.context,l=n.contextType,typeof l=="object"&&l!==null?l=nl(l):(l=Ha(n)?Op:ea.current,l=Cv(e,l));var h=n.getDerivedStateFromProps;(u=typeof h=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==d||f!==l)&&JD(e,a,r,l),ah=!1,f=e.memoizedState,a.state=f,lk(e,r,a,i);var p=e.memoizedState;o!==d||f!==p||Ga.current||ah?(typeof h=="function"&&(bP(e,n,h,r),p=e.memoizedState),(c=ah||KD(e,n,c,r,f,p,l)||!1)?(u||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,p,l),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,p,l)),typeof a.componentDidUpdate=="function"&&(e.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof a.componentDidUpdate!="function"||o===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=p),a.props=r,a.state=p,a.context=l,r=c):(typeof a.componentDidUpdate!="function"||o===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),r=!1)}return TP(t,e,n,r,s,i)}function TP(t,e,n,r,i,s){$9(t,e);var a=(e.flags&128)!==0;if(!r&&!a)return i&&UD(e,n,!1),hd(t,e,s);r=e.stateNode,ese.current=e;var o=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&a?(e.child=Av(e,t.child,null,s),e.child=Av(e,null,o,s)):ga(t,e,o,s),e.memoizedState=r.state,i&&UD(e,n,!0),e.child}function V9(t){var e=t.stateNode;e.pendingContext?BD(t,e.pendingContext,e.pendingContext!==e.context):e.context&&BD(t,e.context,!1),U3(t,e.containerInfo)}function nF(t,e,n,r,i){return Ev(),L3(i),e.flags|=256,ga(t,e,n,r),e.child}var CP={dehydrated:null,treeContext:null,retryLane:0};function EP(t){return{baseLanes:t,cachePool:null,transitions:null}}function q9(t,e,n){var r=e.pendingProps,i=Zr.current,s=!1,a=(e.flags&128)!==0,o;if((o=a)||(o=t!==null&&t.memoizedState===null?!1:(i&2)!==0),o?(s=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(i|=1),Sr(Zr,i&1),t===null)return _P(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(a=r.children,t=r.fallback,s?(r=e.mode,s=e.child,a={mode:"hidden",children:a},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=a):s=zS(a,r,0,null),t=Ep(t,r,n,null),s.return=e,t.return=e,s.sibling=t,e.child=s,e.child.memoizedState=EP(n),e.memoizedState=CP,t):K3(e,a));if(i=t.memoizedState,i!==null&&(o=i.dehydrated,o!==null))return tse(t,e,a,r,o,i,n);if(s){s=r.fallback,a=e.mode,i=t.child,o=i.sibling;var l={mode:"hidden",children:r.children};return!(a&1)&&e.child!==i?(r=e.child,r.childLanes=0,r.pendingProps=l,e.deletions=null):(r=Dh(i,l),r.subtreeFlags=i.subtreeFlags&14680064),o!==null?s=Dh(o,s):(s=Ep(s,a,n,null),s.flags|=2),s.return=e,r.return=e,r.sibling=s,e.child=r,r=s,s=e.child,a=t.child.memoizedState,a=a===null?EP(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},s.memoizedState=a,s.childLanes=t.childLanes&~n,e.memoizedState=CP,r}return s=t.child,t=s.sibling,r=Dh(s,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function K3(t,e){return e=zS({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function Eb(t,e,n,r){return r!==null&&L3(r),Av(e,t.child,null,n),t=K3(e,e.pen
vendor: 4,868 bytes, line 40
40dingProps.children),t.flags|=2,e.memoizedState=null,t}function tse(t,e,n,r,i,s,a){if(n)return e.flags&256?(e.flags&=-257,r=qC(Error(Ke(422))),Eb(t,e,a,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(s=r.fallback,i=e.mode,r=zS({mode:"visible",children:r.children},i,0,null),s=Ep(s,i,a,null),s.flags|=2,r.return=e,s.return=e,r.sibling=s,e.child=r,e.mode&1&&Av(e,t.child,null,a),e.child.memoizedState=EP(a),e.memoizedState=CP,s);if(!(e.mode&1))return Eb(t,e,a,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var o=r.dgst;return r=o,s=Error(Ke(419)),r=qC(s,r,void 0),Eb(t,e,a,r)}if(o=(a&t.childLanes)!==0,Va||o){if(r=ds,r!==null){switch(a&-a){case 4:i=2;break;case 16:i=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:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|a)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,dd(t,i),Ql(r,t,i,-1))}return eR(),r=qC(Error(Ke(421))),Eb(t,e,a,r)}return i.data==="$?"?(e.flags|=128,e.child=t.child,e=pse.bind(null,t),i._reactRetry=e,null):(t=s.treeContext,bo=Rh(i.nextSibling),To=e,qr=!0,Fl=null,t!==null&&(Ko[Jo++]=nd,Ko[Jo++]=rd,Ko[Jo++]=Dp,nd=t.id,rd=t.overflow,Dp=e),e=K3(e,r.children),e.flags|=4096,e)}function rF(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),wP(t.return,e,n)}function WC(t,e,n,r,i){var s=t.memoizedState;s===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=i)}function W9(t,e,n){var r=e.pendingProps,i=r.revealOrder,s=r.tail;if(ga(t,e,r.children,n),r=Zr.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&rF(t,n,e);else if(t.tag===19)rF(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(Sr(Zr,r),!(e.mode&1))e.memoizedState=null;else switch(i){case"forwards":for(n=e.child,i=null;n!==null;)t=n.alternate,t!==null&&ck(t)===null&&(i=n),n=n.sibling;n=i,n===null?(i=e.child,e.child=null):(i=n.sibling,n.sibling=null),WC(e,!1,i,n,s);break;case"backwards":for(n=null,i=e.child,e.child=null;i!==null;){if(t=i.alternate,t!==null&&ck(t)===null){e.child=i;break}t=i.sibling,i.sibling=n,n=i,i=t}WC(e,!0,n,null,s);break;case"together":WC(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Q2(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function hd(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),jp|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(Ke(153));if(e.child!==null){for(t=e.child,n=Dh(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=Dh(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function nse(t,e,n){switch(e.tag){case 3:V9(e),Ev();break;case 5:v9(e);break;case 1:Ha(e.type)&&rk(e);break;case 4:U3(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,i=e.memoizedProps.value;Sr(ak,r._currentValue),r._currentValue=i;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(Sr(Zr,Zr.current&1),e.flags|=128,null):n&e.child.childLanes?q9(t,e,n):(Sr(Zr,Zr.current&1),t=hd(t,e,n),t!==null?t.sibling:null);Sr(Zr,Zr.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return W9(t,e,n);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Sr(Zr,Zr.current),r)break;return null;case 22:case 23:return e.lanes=0,z9(t,e,n)}return hd(t,e,n)}var G9,AP,H9,K9;G9=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};AP=function(){};H9=function(t,e,n,r){var i=t.memoizedProps;if(i!==r){t=e.stateNode,up(Yc.current);var s=null;switch(n){case"input":i=YA(t,i),r=YA(t,r),s=[];break;case"select":i=ni({},i,{value:void 0}),r=ni({},r,{value:void 0}),s=[];break;case"textarea":i=ZA(t,i),r=ZA(t,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=tk)}tP(n,r);var a;n=null;for(c in i)if(!r.hasOwnProperty(c)&&i.hasOwnProperty(c)&&i[c]!=null)if(c==="style"){var o=i[c];for(a in o)o.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(z_.hasOwnProperty(c)?s||
vendor: 5,322 bytes, line 40
40(s=[]):(s=s||[]).push(c,null));for(c in r){var l=r[c];if(o=i!=null?i[c]:void 0,r.hasOwnProperty(c)&&l!==o&&(l!=null||o!=null))if(c==="style")if(o){for(a in o)!o.hasOwnProperty(a)||l&&l.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in l)l.hasOwnProperty(a)&&o[a]!==l[a]&&(n||(n={}),n[a]=l[a])}else n||(s||(s=[]),s.push(c,n)),n=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,o=o?o.__html:void 0,l!=null&&o!==l&&(s=s||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(z_.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&Mr("scroll",t),s||o===l||(s=[])):(s=s||[]).push(c,l))}n&&(s=s||[]).push("style",n);var c=s;(e.updateQueue=c)&&(e.flags|=4)}};K9=function(t,e,n,r){n!==r&&(e.flags|=4)};function hy(t,e){if(!qr)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function zs(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=t,i=i.sibling;else for(i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=t,i=i.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function rse(t,e,n){var r=e.pendingProps;switch(I3(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return zs(e),null;case 1:return Ha(e.type)&&nk(),zs(e),null;case 3:return r=e.stateNode,Pv(),Dr(Ga),Dr(ea),$3(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(Tb(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Fl!==null&&(DP(Fl),Fl=null))),AP(t,e),zs(e),null;case 5:z3(e);var i=up(Z_.current);if(n=e.type,t!==null&&e.stateNode!=null)H9(t,e,n,r,i),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(Ke(166));return zs(e),null}if(t=up(Yc.current),Tb(e)){r=e.stateNode,n=e.type;var s=e.memoizedProps;switch(r[$c]=e,r[X_]=s,t=(e.mode&1)!==0,n){case"dialog":Mr("cancel",r),Mr("close",r);break;case"iframe":case"object":case"embed":Mr("load",r);break;case"video":case"audio":for(i=0;i<Yy.length;i++)Mr(Yy[i],r);break;case"source":Mr("error",r);break;case"img":case"image":case"link":Mr("error",r),Mr("load",r);break;case"details":Mr("toggle",r);break;case"input":hD(r,s),Mr("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},Mr("invalid",r);break;case"textarea":pD(r,s),Mr("invalid",r)}tP(n,s),i=null;for(var a in s)if(s.hasOwnProperty(a)){var o=s[a];a==="children"?typeof o=="string"?r.textContent!==o&&(s.suppressHydrationWarning!==!0&&Sb(r.textContent,o,t),i=["children",o]):typeof o=="number"&&r.textContent!==""+o&&(s.suppressHydrationWarning!==!0&&Sb(r.textContent,o,t),i=["children",""+o]):z_.hasOwnProperty(a)&&o!=null&&a==="onScroll"&&Mr("scroll",r)}switch(n){case"input":gb(r),fD(r,s,!0);break;case"textarea":gb(r),mD(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=tk)}r=i,e.updateQueue=r,r!==null&&(e.flags|=4)}else{a=i.nodeType===9?i:i.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=x$(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=a.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=a.createElement(n,{is:r.is}):(t=a.createElement(n),n==="select"&&(a=t,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):t=a.createElementNS(t,n),t[$c]=e,t[X_]=r,G9(t,e,!1,!1),e.stateNode=t;e:{switch(a=nP(n,r),n){case"dialog":Mr("cancel",t),Mr("close",t),i=r;break;case"iframe":case"object":case"embed":Mr("load",t),i=r;break;case"video":case"audio":for(i=0;i<Yy.length;i++)Mr(Yy[i],t);i=r;break;case"source":Mr("error",t),i=r;break;case"img":case"image":case"link":Mr("error",t),Mr("load",t),i=r;break;case"details":Mr("toggle",t),i=r;break;case"input":hD(t,r),i=YA(t,r),Mr("invalid",t);break;case"option":i=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},i=ni({},r,{value:void 0}),Mr("invalid",t);break;case"textarea":pD(t,r),i=ZA(t,r),Mr("invalid",t);break;default:i=r}tP(n,i),o=i;for(s in o)if(o.hasOwnProperty(s)){var l=o[s];s==="style"?T$(t,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&k$(t,l)):s==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&$_(t,l):typeof l=="number"&&$_(t,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(z_.hasOwnProperty(s)?l!=null&&s==="onScroll"&&Mr("scroll",t):l!=null&&y3(t,s,l,a))}switch(n){case"input":gb(t),fD(t,r,!1);break;case"textarea":gb(t),mD(t);break;case"option":r.value!=null&&t.setAttribute("value",""+Gh(r.value));break;case"select":t.multiple=!!r.multiple,s=r.value,s!=null?$g(t,!!r.multiple,s,!1):r.defaultValue!=null&&$g(t,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(t.onclick=tk)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}
vendor: 27,289 bytes, line 40
40return zs(e),null;case 6:if(t&&e.stateNode!=null)K9(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(Ke(166));if(n=up(Z_.current),up(Yc.current),Tb(e)){if(r=e.stateNode,n=e.memoizedProps,r[$c]=e,(s=r.nodeValue!==n)&&(t=To,t!==null))switch(t.tag){case 3:Sb(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&Sb(r.nodeValue,n,(t.mode&1)!==0)}s&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[$c]=e,e.stateNode=r}return zs(e),null;case 13:if(Dr(Zr),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(qr&&bo!==null&&e.mode&1&&!(e.flags&128))h9(),Ev(),e.flags|=98560,s=!1;else if(s=Tb(e),r!==null&&r.dehydrated!==null){if(t===null){if(!s)throw Error(Ke(318));if(s=e.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(Ke(317));s[$c]=e}else Ev(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;zs(e),s=!1}else Fl!==null&&(DP(Fl),Fl=null),s=!0;if(!s)return e.flags&65536?e:null}return e.flags&128?(e.lanes=n,e):(r=r!==null,r!==(t!==null&&t.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(t===null||Zr.current&1?Ki===0&&(Ki=3):eR())),e.updateQueue!==null&&(e.flags|=4),zs(e),null);case 4:return Pv(),AP(t,e),t===null&&J_(e.stateNode.containerInfo),zs(e),null;case 10:return F3(e.type._context),zs(e),null;case 17:return Ha(e.type)&&nk(),zs(e),null;case 19:if(Dr(Zr),s=e.memoizedState,s===null)return zs(e),null;if(r=(e.flags&128)!==0,a=s.rendering,a===null)if(r)hy(s,!1);else{if(Ki!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(a=ck(t),a!==null){for(e.flags|=128,hy(s,!1),r=a.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=n,n=e.child;n!==null;)s=n,t=r,s.flags&=14680066,a=s.alternate,a===null?(s.childLanes=0,s.lanes=t,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=a.childLanes,s.lanes=a.lanes,s.child=a.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=a.memoizedProps,s.memoizedState=a.memoizedState,s.updateQueue=a.updateQueue,s.type=a.type,t=a.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return Sr(Zr,Zr.current&1|2),e.child}t=t.sibling}s.tail!==null&&Si()>Nv&&(e.flags|=128,r=!0,hy(s,!1),e.lanes=4194304)}else{if(!r)if(t=ck(a),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),hy(s,!0),s.tail===null&&s.tailMode==="hidden"&&!a.alternate&&!qr)return zs(e),null}else 2*Si()-s.renderingStartTime>Nv&&n!==1073741824&&(e.flags|=128,r=!0,hy(s,!1),e.lanes=4194304);s.isBackwards?(a.sibling=e.child,e.child=a):(n=s.last,n!==null?n.sibling=a:e.child=a,s.last=a)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Si(),e.sibling=null,n=Zr.current,Sr(Zr,r?n&1|2:n&1),e):(zs(e),null);case 22:case 23:return Z3(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?po&1073741824&&(zs(e),e.subtreeFlags&6&&(e.flags|=8192)):zs(e),null;case 24:return null;case 25:return null}throw Error(Ke(156,e.tag))}function ise(t,e){switch(I3(e),e.tag){case 1:return Ha(e.type)&&nk(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Pv(),Dr(Ga),Dr(ea),$3(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return z3(e),null;case 13:if(Dr(Zr),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Ke(340));Ev()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Dr(Zr),null;case 4:return Pv(),null;case 10:return F3(e.type._context),null;case 22:case 23:return Z3(),null;case 24:return null;default:return null}}var Ab=!1,Ys=!1,sse=typeof WeakSet=="function"?WeakSet:Set,pt=null;function Pg(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){pi(t,e,r)}else n.current=null}function PP(t,e,n){try{n()}catch(r){pi(t,e,r)}}var iF=!1;function ase(t,e){if(hP=Qx,t=Z$(),N3(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var a=0,o=-1,l=-1,c=0,u=0,d=t,f=null;t:for(;;){for(var h;d!==n||i!==0&&d.nodeType!==3||(o=a+i),d!==s||r!==0&&d.nodeType!==3||(l=a+r),d.nodeType===3&&(a+=d.nodeValue.length),(h=d.firstChild)!==null;)f=d,d=h;for(;;){if(d===t)break t;if(f===n&&++c===i&&(o=a),f===s&&++u===r&&(l=a),(h=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=h}n=o===-1||l===-1?null:{start:o,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(fP={focusedElem:t,selectionRange:n},Qx=!1,pt=e;pt!==null;)if(e=pt,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,pt=t;else for(;pt!==null;){e=pt;try{var p=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var m=p.memoizedProps,g=p.memoizedState,v=e.stateNode,_=v.getSnapshotBeforeUpdate(e.elementType===e.type?m:Pl(e.type,m),g);v.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var b=e.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Ke(163))}}catch(x){pi(e,e.return,x)}if(t=e.sibling,t!==null){t.return=e.return,pt=t;break}pt=e.return}return p=iF,iF=!1,p}function p_(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var s=i.destroy;i.destroy=void 0,s!==void 0&&PP(e,n,s)}i=i.next}while(i!==r)}}function BS(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function MP(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function J9(t){var e=t.alternate;e!==null&&(t.alternate=null,J9(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[$c],delete e[X_],delete e[gP],delete e[$ie],delete e[Vie])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Y9(t){return t.tag===5||t.tag===3||t.tag===4}function sF(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Y9(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function NP(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=tk));else if(r!==4&&(t=t.child,t!==null))for(NP(t,e,n),t=t.sibling;t!==null;)NP(t,e,n),t=t.sibling}function RP(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(RP(t,e,n),t=t.sibling;t!==null;)RP(t,e,n),t=t.sibling}var bs=null,Ol=!1;function Vd(t,e,n){for(n=n.child;n!==null;)X9(t,e,n),n=n.sibling}function X9(t,e,n){if(Jc&&typeof Jc.onCommitFiberUnmount=="function")try{Jc.onCommitFiberUnmount(NS,n)}catch{}switch(n.tag){case 5:Ys||Pg(n,e);case 6:var r=bs,i=Ol;bs=null,Vd(t,e,n),bs=r,Ol=i,bs!==null&&(Ol?(t=bs,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):bs.removeChild(n.stateNode));break;case 18:bs!==null&&(Ol?(t=bs,n=n.stateNode,t.nodeType===8?jC(t.parentNode,n):t.nodeType===1&&jC(t,n),G_(t)):jC(bs,n.stateNode));break;case 4:r=bs,i=Ol,bs=n.stateNode.containerInfo,Ol=!0,Vd(t,e,n),bs=r,Ol=i;break;case 0:case 11:case 14:case 15:if(!Ys&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,a=s.destroy;s=s.tag,a!==void 0&&(s&2||s&4)&&PP(n,e,a),i=i.next}while(i!==r)}Vd(t,e,n);break;case 1:if(!Ys&&(Pg(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(o){pi(n,e,o)}Vd(t,e,n);break;case 21:Vd(t,e,n);break;case 22:n.mode&1?(Ys=(r=Ys)||n.memoizedState!==null,Vd(t,e,n),Ys=r):Vd(t,e,n);break;default:Vd(t,e,n)}}function aF(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new sse),e.forEach(function(r){var i=mse.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function bl(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var s=t,a=e,o=a;e:for(;o!==null;){switch(o.tag){case 5:bs=o.stateNode,Ol=!1;break e;case 3:bs=o.stateNode.containerInfo,Ol=!0;break e;case 4:bs=o.stateNode.containerInfo,Ol=!0;break e}o=o.return}if(bs===null)throw Error(Ke(160));X9(s,a,i),bs=null,Ol=!1;var l=i.alternate;l!==null&&(l.return=null),i.return=null}catch(c){pi(i,e,c)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)Q9(e,t),e=e.sibling}function Q9(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(bl(e,t),Tc(t),r&4){try{p_(3,t,t.return),BS(3,t)}catch(m){pi(t,t.return,m)}try{p_(5,t,t.return)}catch(m){pi(t,t.return,m)}}break;case 1:bl(e,t),Tc(t),r&512&&n!==null&&Pg(n,n.return);break;case 5:if(bl(e,t),Tc(t),r&512&&n!==null&&Pg(n,n.return),t.flags&32){var i=t.stateNode;try{$_(i,"")}catch(m){pi(t,t.return,m)}}if(r&4&&(i=t.stateNode,i!=null)){var s=t.memoizedProps,a=n!==null?n.memoizedProps:s,o=t.type,l=t.updateQueue;if(t.updateQueue=null,l!==null)try{o==="input"&&s.type==="radio"&&s.name!=null&&w$(i,s),nP(o,a);var c=nP(o,s);for(a=0;a<l.length;a+=2){var u=l[a],d=l[a+1];u==="style"?T$(i,d):u==="dangerouslySetInnerHTML"?k$(i,d):u==="children"?$_(i,d):y3(i,u,d,c)}switch(o){case"input":XA(i,s);break;case"textarea":b$(i,s);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var h=s.value;h!=null?$g(i,!!s.multiple,h,!1):f!==!!s.multiple&&(s.defaultValue!=null?$g(i,!!s.multiple,s.defaultValue,!0):$g(i,!!s.multiple,s.multiple?[]:"",!1))}i[X_]=s}catch(m){pi(t,t.return,m)}}break;case 6:if(bl(e,t),Tc(t),r&4){if(t.stateNode===null)throw Error(Ke(162));i=t.stateNode,s=t.memoizedProps;try{i.nodeValue=s}catch(m){pi(t,t.return,m)}}break;case 3:if(bl(e,t),Tc(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{G_(e.containerInfo)}catch(m){pi(t,t.return,m)}break;case 4:bl(e,t),Tc(t);break;case 13:bl(e,t),Tc(t),i=t.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(X3=Si())),r&4&&aF(t);break;case 22:if(u=n!==null&&n.memoizedState!==null,t.mode&1?(Ys=(c=Ys)||u,bl(e,t),Ys=c):bl(e,t),Tc(t),r&8192){if(c=t.memoizedState!==null,(t.stateNode.isHidden=c)&&!u&&t.mode&1)for(pt=t,u=t.child;u!==null;){for(d=pt=u;pt!==null;){switch(f=pt,h=f.child,f.tag){case 0:case 11:case 14:case 15:p_(4,f,f.return);break;case 1:Pg(f,f.return);var p=f.stateNode;if(typeof p.componentWillUnmount=="function"){r=f,n=f.return;try{e=r,p.props=e.memoizedProps,p.state=e.memoizedState,p.componentWillUnmount()}catch(m){pi(r,n,m)}}break;case 5:Pg(f,f.return);break;case 22:if(f.memoizedState!==null){lF(d);continue}}h!==null?(h.return=f,pt=h):lF(d)}u=u.sibling}e:for(u=null,d=t;;){if(d.tag===5){if(u===null){u=d;try{i=d.stateNode,c?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(o=d.stateNode,l=d.memoizedProps.style,a=l!=null&&l.hasOwnProperty("display")?l.display:null,o.style.display=S$("display",a))}catch(m){pi(t,t.return,m)}}}else if(d.tag===6){if(u===null)try{d.stateNode.nodeValue=c?"":d.memoizedProps}catch(m){pi(t,t.return,m)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===t)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===t)break e;for(;d.sibling===null;){if(d.return===null||d.return===t)break e;u===d&&(u=null),d=d.return}u===d&&(u=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:bl(e,t),Tc(t),r&4&&aF(t);break;case 21:break;default:bl(e,t),Tc(t)}}function Tc(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(Y9(n)){var r=n;break e}n=n.return}throw Error(Ke(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&($_(i,""),r.flags&=-33);var s=sF(t);RP(t,s,i);break;case 3:case 4:var a=r.stateNode.containerInfo,o=sF(t);NP(t,o,a);break;default:throw Error(Ke(161))}}catch(l){pi(t,t.return,l)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function ose(t,e,n){pt=t,Z9(t)}function Z9(t,e,n){for(var r=(t.mode&1)!==0;pt!==null;){var i=pt,s=i.child;if(i.tag===22&&r){var a=i.memoizedState!==null||Ab;if(!a){var o=i.alternate,l=o!==null&&o.memoizedState!==null||Ys;o=Ab;var c=Ys;if(Ab=a,(Ys=l)&&!c)for(pt=i;pt!==null;)a=pt,l=a.child,a.tag===22&&a.memoizedState!==null?cF(i):l!==null?(l.return=a,pt=l):cF(i);for(;s!==null;)pt=s,Z9(s),s=s.sibling;pt=i,Ab=o,Ys=c}oF(t)}else i.subtreeFlags&8772&&s!==null?(s.return=i,pt=s):oF(t)}}function oF(t){for(;pt!==null;){var e=pt;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:Ys||BS(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!Ys)if(n===null)r.componentDidMount();else{var i=e.elementType===e.type?n.memoizedProps:Pl(e.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=e.updateQueue;s!==null&&WD(e,s,r);break;case 3:var a=e.updateQueue;if(a!==null){if(n=null,e.child!==null)switch(e.child.tag){case 5:n=e.child.stateNode;break;case 1:n=e.child.stateNode}WD(e,a,n)}break;case 5:var o=e.stateNode;if(n===null&&e.flags&4){n=o;var l=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var c=e.alternate;if(c!==null){var u=c.memoizedState;if(u!==null){var d=u.dehydrated;d!==null&&G_(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Ke(163))}Ys||e.flags&512&&MP(e)}catch(f){pi(e,e.return,f)}}if(e===t){pt=null;break}if(n=e.sibling,n!==null){n.return=e.return,pt=n;break}pt=e.return}}function lF(t){for(;pt!==null;){var e=pt;if(e===t){pt=null;break}var n=e.sibling;if(n!==null){n.return=e.return,pt=n;break}pt=e.return}}function cF(t){for(;pt!==null;){var e=pt;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{BS(4,e)}catch(l){pi(e,n,l)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var i=e.return;try{r.componentDidMount()}catch(l){pi(e,i,l)}}var s=e.return;try{MP(e)}catch(l){pi(e,s,l)}break;case 5:var a=e.return;try{MP(e)}catch(l){pi(e,a,l)}}}catch(l){pi(e,e.return,l)}if(e===t){pt=null;break}var o=e.sibling;if(o!==null){o.return=e.return,pt=o;break}pt=e.return}}var lse=Math.ceil,hk=wd.ReactCurrentDispatcher,J3=wd.ReactCurrentOwner,el=wd.ReactCurrentBatchConfig,Un=0,ds=null,Di=null,Es=0,po=0,Mg=af(0),Ki=0,rw=null,jp=0,US=0,Y3=0,m_=null,za=null,X3=0,Nv=1/0,Vu=null,fk=!1,IP=null,Lh=null,Pb=!1,bh=null,pk=0,g_=0,LP=null,Z2=-1,ex=0;function Ta(){return Un&6?Si():Z2!==-1?Z2:Z2=Si()}function Oh(t){return t.mode&1?Un&2&&Es!==0?Es&-Es:Wie.transition!==null?(ex===0&&(ex=F$()),ex):(t=or,t!==0||(t=window.event,t=t===void 0?16:q$(t.type)),t):1}function Ql(t,e,n,r){if(50<g_)throw g_=0,LP=null,Error(Ke(185));Zw(t,n,r),(!(Un&2)||t!==ds)&&(t===ds&&(!(Un&2)&&(US|=n),Ki===4&&ch(t,Es)),Ka(t,r),n===1&&Un===0&&!(e.mode&1)&&(Nv=Si()+500,DS&&of()))}function Ka(t,e){var n=t.callbackNode;Wre(t,e);var r=Xx(t,t===ds?Es:0);if(r===0)n!==null&&yD(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&yD(n),e===1)t.tag===0?qie(uF.bind(null,t)):c9(uF.bind(null,t)),Uie(function(){!(Un&6)&&of()}),n=null;else{switch(j$(r)){case 1:n=k3;break;case 4:n=O$;break;case 16:n=Yx;break;case 536870912:n=D$;break;default:n=Yx}n=oV(n,eV.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function eV(t,e){if(Z2=-1,ex=0,Un&6)throw Error(Ke(327));var n=t.callbackNode;if(Hg()&&t.callbackNode!==n)return null;var r=Xx(t,t===ds?Es:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=mk(t,r);else{e=r;var i=Un;Un|=2;var s=nV();(ds!==t||Es!==e)&&(Vu=null,Nv=Si()+500,Cp(t,e));do try{dse();break}catch(o){tV(t,o)}while(!0);D3(),hk.current=s,Un=i,Di!==null?e=0:(ds=null,Es=0,e=Ki)}if(e!==0){if(e===2&&(i=oP(t),i!==0&&(r=i,e=OP(t,i))),e===1)throw n=rw,Cp(t,0),ch(t,r),Ka(t,Si()),n;if(e===6)ch(t,r);else{if(i=t.current.alternate,!(r&30)&&!cse(i)&&(e=mk(t,r),e===2&&(s=oP(t),s!==0&&(r=s,e=OP(t,s))),e===1))throw n=rw,Cp(t,0),ch(t,r),Ka(t,Si()),n;switch(t.finishedWork=i,t.finishedLanes=r,e){case 0:case 1:throw Error(Ke(345));case 2:Wf(t,za,Vu);break;case 3:if(ch(t,r),(r&130023424)===r&&(e=X3+500-Si(),10<e)){if(Xx(t,0)!==0)break;if(i=t.suspendedLanes,(i&r)!==r){Ta(),t.pingedLanes|=t.suspendedLanes&i;break}t.timeoutHandle=mP(Wf.bind(null,t,za,Vu),e);break}Wf(t,za,Vu);break;case 4:if(ch(t,r),(r&4194240)===r)break;for(e=t.eventTimes,i=-1;0<r;){var a=31-Xl(r);s=1<<a,a=e[a],a>i&&(i=a),r&=~s}if(r=i,r=Si()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*lse(r/1960))-r,10<r){t.timeoutHandle=mP(Wf.bind(null,t,za,Vu),r);break}Wf(t,za,Vu);break;case 5:Wf(t,za,Vu);break;default:throw Error(Ke(329))}}}return Ka(t,Si()),t.callbackNode===n?eV.bind(null,t):null}function OP(t,e){var n=m_;return t.current.memoizedState.isDehydrated&&(Cp(t,e).flags|=256),t=mk(t,e),t!==2&&(e=za,za=n,e!==null&&DP(e)),t}function DP(t){za===null?za=t:za.push.apply(za,t)}function cse(t){for(var e=t;;){if(e.flags&16384){var n=e.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],s=i.getSnapshot;i=i.value;try{if(!rc(s(),i))return!1}catch{return!1}}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function ch(t,e){for(e&=~Y3,e&=~US,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-Xl(e),r=1<<n;t[n]=-1,e&=~r}}function uF(t){if(Un&6)throw Error(Ke(327));Hg();var e=Xx(t,0);if(!(e&1))return Ka(t,Si()),null;var n=mk(t,e);if(t.tag!==0&&n===2){var r=oP(t);r!==0&&(e=r,n=OP(t,r))}if(n===1)throw n=rw,Cp(t,0),ch(t,e),Ka(t,Si()),n;if(n===6)throw Error(Ke(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Wf(t,za,Vu),Ka(t,Si()),null}function Q3(t,e){var n=Un;Un|=1;try{return t(e)}finally{Un=n,Un===0&&(Nv=Si()+500,DS&&of())}}function Bp(t){bh!==null&&bh.tag===0&&!(Un&6)&&Hg();var e=Un;Un|=1;var n=el.transition,r=or;try{if(el.transition=null,or=1,t)return t()}finally{or=r,el.transition=n,Un=e,!(Un&6)&&of()}}function Z3(){po=Mg.current,Dr(Mg)}function Cp(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,Bie(n)),Di!==null)for(n=Di.return;n!==null;){var r=n;switch(I3(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&nk();break;case 3:Pv(),Dr(Ga),Dr(ea),$3();break;case 5:z3(r);break;case 4:Pv();break;case 13:Dr(Zr);break;case 19:Dr(Zr);break;case 10:F3(r.type._context);break;case 22:case 23:Z3()}n=n.return}if(ds=t,Di=t=Dh(t.current,null),Es=po=e,Ki=0,rw=null,Y3=US=jp=0,za=m_=null,cp!==null){for(e=0;e<cp.length;e++)if(n=cp[e],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,s=n.pending;if(s!==null){var a=s.next;s.next=i,r.next=a}n.pending=r}cp=null}return t}function tV(t,e){do{var n=Di;try{if(D3(),Y2.current=dk,uk){for(var r=ei.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}uk=!1}if(Fp=0,as=Wi=ei=null,f_=!1,ew=0,J3.current=null,n===null||n.return===null){Ki=1,rw=e,Di=null;break}e:{var s=t,a=n.return,o=n,l=e;if(e=Es,o.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,u=o,d=u.tag;if(!(u.mode&1)&&(d===0||d===11||d===15)){var f=u.alternate;f?(u.updateQueue=f.updateQueue,u.memoizedState=f.memoizedState,u.lanes=f.lanes):(u.updateQueue=null,u.memoizedState=null)}var h=XD(a);if(h!==null){h.flags&=-257,QD(h,a,o,s,e),h.mode&1&&YD(s,c,e),e=h,l=c;var p=e.updateQueue;if(p===null){var m=new Set;m.add(l),e.updateQueue=m}else p.add(l);break e}else{if(!(e&1)){YD(s,c,e),eR();break e}l=Error(Ke(426))}}else if(qr&&o.mode&1){var g=XD(a);if(g!==null){!(g.flags&65536)&&(g.flags|=256),QD(g,a,o,s,e),L3(Mv(l,o));break e}}s=l=Mv(l,o),Ki!==4&&(Ki=2),m_===null?m_=[s]:m_.push(s),s=a;do{switch(s.tag){case 3:s.flags|=65536,e&=-e,s.lanes|=e;var v=j9(s,l,e);qD(s,v);break e;case 1:o=l;var _=s.type,b=s.stateNode;if(!(s.flags&128)&&(typeof _.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(Lh===null||!Lh.has(b)))){s.flags|=65536,e&=-e,s.lanes|=e;var x=B9(s,o,e);qD(s,x);break e}}s=s.return}while(s!==null)}iV(n)}catch(T){e=T,Di===n&&n!==null&&(Di=n=n.return);continue}break}while(!0)}function nV(){var t=hk.current;return hk.current=dk,t===null?dk:t}function eR(){(Ki===0||Ki===3||Ki===2)&&(Ki=4),ds===null||!(jp&268435455)&&!(US&268435455)||ch(ds,Es)}function mk(t,e){var n=Un;Un|=2;var r=nV();(ds!==t||Es!==e)&&(Vu=null,Cp(t,e));do try{use();break}catch(i){tV(t,i)}while(!0);if(D3(),Un=n,hk.current=r,Di!==null)throw Error(Ke(261));return ds=null,Es=0,Ki}function use(){for(;Di!==null;)rV(Di)}function dse(){for(;Di!==null&&!Dre();)rV(Di)}function rV(t){var e=aV(t.alternate,t,po);t.memoizedProps=t.pendingProps,e===null?iV(t):Di=e,J3.current=null}function iV(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=ise(n,e),n!==null){n.flags&=32767,Di=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Ki=6,Di=null;return}}else if(n=rse(n,e,po),n!==null){Di=n;return}if(e=e.sibling,e!==null){Di=e;return}Di=e=t}while(e!==null);Ki===0&&(Ki=5)}function Wf(t,e,n){var r=or,i=el.transition;try{el.transition=null,or=1,hse(t,e,n,r)}finally{el.transition=i,or=r}return null}function hse(t,e,n,r){do Hg();while(bh!==null);if(Un&6)throw Error(Ke(327));n=t.finishedWork;var i=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(Ke(177));t.callbackNode=null,t.callbackPriority=0;var s=n.lanes|n.childLanes;if(Gre(t,s),t===ds&&(Di=ds=null,Es=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Pb||(Pb=!0,oV(Yx,function(){return Hg(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=el.transition,el.transition=null;var a=or;or=1;var o=Un;Un|=4,J3.current=null,ase(t,n),Q9(n,t),Rie(fP),Qx=!!hP,fP=hP=null,t.current=n,ose(n),Fre(),Un=o,or=a,el.transition=s}else t.current=n;if(Pb&&(Pb=!1,bh=t,pk=i),s=t.pendingLanes,s===0&&(Lh=null),Ure(n.stateNode),Ka(t,Si()),e!==null)for(r=t.onRecoverableError,n=0;n<e.length;n++)i=e[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(fk)throw fk=!1,t=IP,IP=null,t;return pk&1&&t.tag!==0&&Hg(),s=t.pendingLanes,s&1?t===LP?g_++:(g_=0,LP=t):g_=0,of(),null}function Hg(){if(bh!==null){var t=j$(pk),e=el.transition,n=or;try{if(el.transition=null,or=16>t?16:t,bh===null)var r=!1;else{if(t=bh,bh=null,pk=0,Un&6)throw Error(Ke(331));var i=Un;for(Un|=4,pt=t.current;pt!==null;){var s=pt,a=s.child;if(pt.flags&16){var o=s.deletions;if(o!==null){for(var l=0;l<o.length;l++){var c=o[l];for(pt=c;pt!==null;){var u=pt;switch(u.tag){case 0:case 11:case 15:p_(8,u,s)}var d=u.child;if(d!==null)d.return=u,pt=d;else for(;pt!==null;){u=pt;var f=u.sibling,h=u.return;if(J9(u),u===c){pt=null;break}if(f!==null){f.return=h,pt=f;break}pt=h}}}var p=s.alternate;if(p!==null){var m=p.child;if(m!==null){p.child=null;do{var g=m.sibling;m.sibling=null,m=g}while(m!==null)}}pt=s}}if(s.subtreeFlags&2064&&a!==null)a.return=s,pt=a;else e:for(;pt!==null;){if(s=pt,s.flags&2048)switch(s.tag){case 0:case 11:case 15:p_(9,s,s.return)}var v=s.sibling;if(v!==null){v.return=s.return,pt=v;break e}pt=s.return}}var _=t.current;for(pt=_;pt!==null;){a=pt;var b=a.child;if(a.subtreeFlags&2064&&b!==null)b.return=a,pt=b;else e:for(a=_;pt!==null;){if(o=pt,o.flags&2048)try{switch(o.tag){case 0:case 11:case 15:BS(9,o)}}catch(T){pi(o,o.return,T)}if(o===a){pt=null;break e}var x=o.sibling;if(x!==null){x.return=o.return,pt=x;break e}pt=o.return}}if(Un=i,of(),Jc&&typeof Jc.onPostCommitFiberRoot=="function")try{Jc.onPostCommitFiberRoot(NS,t)}catch{}r=!0}return r}finally{or=n,el.transition=e}}return!1}function dF(t,e,n){e=Mv(n,e),e=j9(t,e,1),t=Ih(t,e,1),e=Ta(),t!==null&&(Zw(t,1,e),Ka(t,e))}function pi(t,e,n){if(t.tag===3)dF(t,t,n);else for(;e!==null;){if(e.tag===3){dF(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Lh===null||!Lh.has(r))){t=Mv(n,t),t=B9(e,t,1),e=Ih(e,t,1),t=Ta(),e!==null&&(Zw(e,1,t),Ka(e,t));break}}e=e.return}}function fse(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=Ta(),t.pingedLanes|=t.suspendedLanes&n,ds===t&&(Es&n)===n&&(Ki===4||Ki===3&&(Es&130023424)===Es&&500>Si()-X3?Cp(t,0):Y3|=n),Ka(t,e)}function sV(t,e){e===0&&(t.mode&1?(e=_b,_b<<=1,!(_b&130023424)&&(_b=4194304)):e=1);var n=Ta();t=dd(t,e),t!==null&&(Zw(t,e,n),Ka(t,n))}function pse(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),sV(t,n)}function mse(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(Ke(314))}r!==null&&r.delete(e),sV(t,n)}var aV;aV=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Ga.current)Va=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Va=!1,nse(t,e,n);Va=!!(t.flags&131072)}else Va=!1,qr&&e.flags&1048576&&u9(e,sk,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Q2(t,e),t=e.pendingProps;var i=Cv(e,ea.current);Gg(e,n),i=q3(null,e,r,t,i,n);var s=W3();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Ha(r)?(s=!0,rk(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,B3(e),i.updater=jS,e.stateNode=i,i._reactInternals=e,xP(e,r,t,n),e=TP(null,e,r,!0,s,n)):(e.tag=0,qr&&s&&R3(e),ga(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Q2(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=vse(r),t=Pl(r,t),i){case 0:e=SP(null,e,r,t,n);break e;case 1:e=tF(null,e,r,t,n);break e;case 11:e=ZD(null,e,r,t,n);break e;case 14:e=eF(null,e,r,Pl(r.type,t),n);break e}throw Error(Ke(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Pl(r,i),SP(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Pl(r,i),tF(t,e,r,i,n);case 3:e:{if(V9(e),t===null)throw Error(Ke(387));r=e.pendingProps,s=e.memoizedState,i=s.element,g9(t,e),lk(e,r,null,n);var a=e.memoizedState;if(r=a.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=Mv(Error(Ke(423)),e),e=nF(t,e,r,n,i);break e}else if(r!==i){i=Mv(Error(Ke(424)),e),e=nF(t,e,r,n,i);break e}else for(bo=Rh(e.stateNode.containerInfo.firstChild),To=e,qr=!0,Fl=null,n=p9(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ev(),r===i){e=hd(t,e,n);break e}ga(t,e,r,n)}e=e.child}return e;case 5:return v9(e),t===null&&_P(e),r=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,a=i.children,pP(r,i)?a=null:s!==null&&pP(r,s)&&
vendor: 8,303 bytes, line 40
40(e.flags|=32),$9(t,e),ga(t,e,a,n),e.child;case 6:return t===null&&_P(e),null;case 13:return q9(t,e,n);case 4:return U3(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Av(e,null,r,n):ga(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Pl(r,i),ZD(t,e,r,i,n);case 7:return ga(t,e,e.pendingProps,n),e.child;case 8:return ga(t,e,e.pendingProps.children,n),e.child;case 12:return ga(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,a=i.value,Sr(ak,r._currentValue),r._currentValue=a,s!==null)if(rc(s.value,a)){if(s.children===i.children&&!Ga.current){e=hd(t,e,n);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var o=s.dependencies;if(o!==null){a=s.child;for(var l=o.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=od(-1,n&-n),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),wP(s.return,n,e),o.lanes|=n;break}l=l.next}}else if(s.tag===10)a=s.type===e.type?null:s.child;else if(s.tag===18){if(a=s.return,a===null)throw Error(Ke(341));a.lanes|=n,o=a.alternate,o!==null&&(o.lanes|=n),wP(a,n,e),a=s.sibling}else a=s.child;if(a!==null)a.return=s;else for(a=s;a!==null;){if(a===e){a=null;break}if(s=a.sibling,s!==null){s.return=a.return,a=s;break}a=a.return}s=a}ga(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,Gg(e,n),i=nl(i),r=r(i),e.flags|=1,ga(t,e,r,n),e.child;case 14:return r=e.type,i=Pl(r,e.pendingProps),i=Pl(r.type,i),eF(t,e,r,i,n);case 15:return U9(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Pl(r,i),Q2(t,e),e.tag=1,Ha(r)?(t=!0,rk(e)):t=!1,Gg(e,n),F9(e,r,i),xP(e,r,i,n),TP(null,e,r,!0,t,n);case 19:return W9(t,e,n);case 22:return z9(t,e,n)}throw Error(Ke(156,e.tag))};function oV(t,e){return L$(t,e)}function gse(t,e,n,r){this.tag=t,this.key=n,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=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Qo(t,e,n,r){return new gse(t,e,n,r)}function tR(t){return t=t.prototype,!(!t||!t.isReactComponent)}function vse(t){if(typeof t=="function")return tR(t)?1:0;if(t!=null){if(t=t.$$typeof,t===w3)return 11;if(t===b3)return 14}return 2}function Dh(t,e){var n=t.alternate;return n===null?(n=Qo(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function tx(t,e,n,r,i,s){var a=2;if(r=t,typeof t=="function")tR(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case wg:return Ep(n.children,i,s,e);case _3:a=8,i|=8;break;case GA:return t=Qo(12,n,e,i|2),t.elementType=GA,t.lanes=s,t;case HA:return t=Qo(13,n,e,i),t.elementType=HA,t.lanes=s,t;case KA:return t=Qo(19,n,e,i),t.elementType=KA,t.lanes=s,t;case v$:return zS(n,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case m$:a=10;break e;case g$:a=9;break e;case w3:a=11;break e;case b3:a=14;break e;case sh:a=16,r=null;break e}throw Error(Ke(130,t==null?t:typeof t,""))}return e=Qo(a,n,e,i),e.elementType=t,e.type=r,e.lanes=s,e}function Ep(t,e,n,r){return t=Qo(7,t,r,e),t.lanes=n,t}function zS(t,e,n,r){return t=Qo(22,t,r,e),t.elementType=v$,t.lanes=n,t.stateNode={isHidden:!1},t}function GC(t,e,n){return t=Qo(6,t,null,e),t.lanes=n,t}function HC(t,e,n){return e=Qo(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function yse(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=EC(0),this.expirationTimes=EC(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=EC(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function nR(t,e,n,r,i,s,a,o,l){return t=new yse(t,e,n,o,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Qo(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},B3(s),t}function _se(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:_g,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function lV(t){if(!t)return Hh;t=t._reactInternals;e:{if(Xp(t)!==t||t.tag!==1)throw Error(Ke(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Ha(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(Ke(171))}if(t.tag===1){var n=t.type;if(Ha(n))return l9(t,n,e)}return e}function cV(t,e,n,r,i,s,a,o,l){return t=nR(n,r,!0,t,i,s,a,o,l),t.context=lV(null),n=t.current,r=Ta(),i=Oh(n),s=od(r,i),s.callback=e??null,Ih(n,s,i),t.current.lanes=i,Zw(t,i,r),Ka(t,r),t}function $S(t,e,n,r){var i=e.current,s=Ta(),a=Oh(i);return n=lV(n),e.context===null?e.context=n:e.pendingContext=n,e=od(s,a),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=Ih(i,e,a),t!==null&&(Ql(t,i,a,s),J2(t,i,a)),a}function gk(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function hF(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function rR(t,e){hF(t,e),(t=t.alternate)&&hF(t,e)}function wse(){return null}var uV=typeof reportError=="function"?reportError:function(t){console.error(t)};function iR(t){this._internalRoot=t}VS.prototype.render=iR.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(Ke(409));$S(t,e,null,null)};VS.prototype.unmount=iR.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;Bp(function(){$S(null,t,null,null)}),e[ud]=null}};function VS(t){this._internalRoot=t}VS.prototype.unstable_scheduleHydration=function(t){if(t){var e=z$();t={blockedOn:null,target:t,priority:e};for(var n=0;n<lh.length&&e!==0&&e<lh[n].priority;n++);lh.splice(n,0,t),n===0&&V$(t)}};function sR(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function qS(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function fF(){}function bse(t,e,n,r,i){if(i){if(typeof r=="function"){var s=r;r=function(){var c=gk(a);s.call(c)}}var a=cV(e,r,t,0,null,!1,!1,"",fF);return t._reactRootContainer=a,t[ud]=a.current,J_(t.nodeType===8?t.parentNode:t),Bp(),a}for(;i=t.lastChild;)t.removeChild(i);if(typeof r=="function"){var o=r;r=function(){var c=gk(l);o.call(c)}}var l=nR(t,0,!1,null,null,!1,!1,"",fF);return t._reactRootContainer=l,t[ud]=l.current,J_(t.nodeType===8?t.parentNode:t),Bp(function(){$S(e,l,n,r)}),l}function WS(t,e,n,r,i){var s=n._reactRootContainer;if(s){var a=s;if(typeof i=="function"){var o=i;i=function(){var l=gk(a);o.call(l)}}$S(e,a,t,i)}else a=bse(n,e,t,i,r);return gk(a)}B$=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=Jy(e.pendingLanes);n!==0&&(S3(e,n|1),Ka(e,Si()),!(Un&6)&&(Nv=Si()+500,of()))}break;case 13:Bp(function(){var r=dd(t,1);if(r!==null){var i=Ta();Ql(r,t,1,i)}}),rR(t,1)}};T3=function(t){if(t.tag===13){var e=dd(t,134217728);if(e!==null){var n=Ta();Ql(e,t,134217728,n)}rR(t,134217728)}};U$=function(t){if(t.tag===13){var e=Oh(t),n=dd(t,e);if(n!==null){var r=Ta();Ql(n,t,e,r)}rR(t,e)}};z$=function(){return or};$$=function(t,e){var n=or;
vendor: 4,209 bytes, line 40
40try{return or=t,e()}finally{or=n}};iP=function(t,e,n){switch(e){case"input":if(XA(t,n),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var i=OS(r);if(!i)throw Error(Ke(90));_$(r),XA(r,i)}}}break;case"textarea":b$(t,n);break;case"select":e=n.value,e!=null&&$g(t,!!n.multiple,e,!1)}};A$=Q3;P$=Bp;var xse={usingClientEntryPoint:!1,Events:[t1,Sg,OS,C$,E$,Q3]},fy={findFiberByHostInstance:lp,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},kse={bundleType:fy.bundleType,version:fy.version,rendererPackageName:fy.rendererPackageName,rendererConfig:fy.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:wd.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=R$(t),t===null?null:t.stateNode},findFiberByHostInstance:fy.findFiberByHostInstance||wse,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 Mb=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Mb.isDisabled&&Mb.supportsFiber)try{NS=Mb.inject(kse),Jc=Mb}catch{}}Ao.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=xse;Ao.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!sR(e))throw Error(Ke(200));return _se(t,e,null,n)};Ao.createRoot=function(t,e){if(!sR(t))throw Error(Ke(299));var n=!1,r="",i=uV;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(i=e.onRecoverableError)),e=nR(t,1,!1,null,null,n,!1,r,i),t[ud]=e.current,J_(t.nodeType===8?t.parentNode:t),new iR(e)};Ao.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(Ke(188)):(t=Object.keys(t).join(","),Error(Ke(268,t)));return t=R$(e),t=t===null?null:t.stateNode,t};Ao.flushSync=function(t){return Bp(t)};Ao.hydrate=function(t,e,n){if(!qS(e))throw Error(Ke(200));return WS(null,t,e,!0,n)};Ao.hydrateRoot=function(t,e,n){if(!sR(t))throw Error(Ke(405));var r=n!=null&&n.hydratedSources||null,i=!1,s="",a=uV;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),e=cV(e,null,t,1,n??null,i,!1,s,a),t[ud]=e.current,J_(t),r)for(t=0;t<r.length;t++)n=r[t],i=n._getVersion,i=i(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,i]:e.mutableSourceEagerHydrationData.push(n,i);return new VS(e)};Ao.render=function(t,e,n){if(!qS(e))throw Error(Ke(200));return WS(null,t,e,!1,n)};Ao.unmountComponentAtNode=function(t){if(!qS(t))throw Error(Ke(40));return t._reactRootContainer?(Bp(function(){WS(null,null,t,!1,function(){t._reactRootContainer=null,t[ud]=null})}),!0):!1};Ao.unstable_batchedUpdates=Q3;Ao.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!qS(n))throw Error(Ke(200));if(t==null||t._reactInternals===void 0)throw Error(Ke(38));return WS(t,e,n,!1,r)};Ao.version="18.3.1-next-f1338f8080-20240426";function dV(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(dV)}catch(t){console.error(t)}}dV(),d$.exports=Ao;var r1=d$.exports;const hV=Zz(r1);var fV,pF=r1;fV=pF.createRoot,pF.hydrateRoot;const Sse=1,Tse=1e6;let KC=0;function Cse(){return KC=(KC+1)%Number.MAX_SAFE_INTEGER,KC.toString()}const JC=new Map,mF=t=>{if(JC.has(t))return;const e=setTimeout(()=>{JC.delete(t),v_({type:"REMOVE_TOAST",toastId:t})},Tse);JC.set(t,e)},Ese=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,Sse)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(n=>n.id===e.toast.id?{...n,...e.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=e;
40return n?mF(n):t.toasts.forEach(r=>{mF(r.id)}),{...t,toasts:t.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(n=>n.id!==e.toastId)}}},nx=[];let rx={toasts:[]};function v_(t){rx=Ese(rx,t),nx.forEach(e=>{e(rx)})}function Ase({...t}){const e=Cse(),n=i=>v_({type:"UPDATE_TOAST",toast:{...i,id:e}}),r=()=>v_({type:"DISMISS_TOAST",toastId:e});return v_({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:i=>{i||r()}}}),{id:e,dismiss:r,update:n}}function Xv(){const[t,e]=I.useState(rx);return I.useEffect(()=>(nx.push(e),()=>{const n=nx.indexOf(e);n>-1&&nx.splice(n,1)}),[t]),{...t,toast:Ase,dismiss:n=>v_({type:"DISMISS_TOAST",toastId:n})}}function Hn(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function gF(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function pV(...t){return e=>{let n=!1;const r=t.map(i=>{const s=gF(i,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i<r.length;i++){const s=r[i];typeof s=="function"?s():gF(t[i],null)}}}}function ri(...t){return I.useCallback(pV(...t),t)}function Pse(t,e){const n=I.createContext(e),r=s=>{const{children:a,...o}=s,l=I.useMemo(()=>o,Object.values(o));return w.jsx(n.Provider,{value:l,children:a})};r.displayName=t+"Provider";function i(s){const a=I.useContext(n);if(a)return a;if(e!==void 0)return e;throw new Error(`\`${s}\` must be used within \`${t}\``)}return[r,i]}function lf(t,e=[]){let n=[];function r(s,a){const o=I.createContext(a),l=n.length;n=[...n,a];const c=d=>{var v;const{scope:f,children:h,...p}=d,m=((v=f==null?void 0:f[t])==null?void 0:v[l])||o,g=I.useMemo(()=>p,Object.values(p));return w.jsx(m.Provider,{value:g,children:h})};c.displayName=s+"Provider";function u(d,f){var m;const h=((m=f==null?void 0:f[t])==null?void 0:m[l])||o,p=I.useContext(h);if(p)return p;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[c,u]}const i=()=>{const s=n.map(a=>I.createContext(a));return function(o){const l=(o==null?void 0:o[t])||s;return I.useMemo(()=>({[`__scope${t}`]:{...o,[t]:l}}),[o,l])}};return i.scopeName=t,[r,Mse(i,...e)]}function Mse(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const a=r.reduce((o,{useScope:l,scopeName:c})=>{const d=l(s)[`__scope${c}`];return{...o,...d}},{});return I.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}function iw(t){const e=Nse(t),n=I.forwardRef((r,i)=>{const{children:s,...a}=r,o=I.Children.toArray(s),l=o.find(Ise);if(l){const c=l.props.children,u=o.map(d=>d===l?I.Children.count(c)>1?I.Children.only(null):I.isValidElement(c)?c.props.children:null:d);return w.jsx(e,{...a,ref:i,children:I.isValidElement(c)?I.cloneElement(c,void 0,u):null})}return w.jsx(e,{...a,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}var Qv=iw("Slot");function Nse(t){const e=I.forwardRef((n,r)=>{const{children:i,...s}=n;if(I.isValidElement(i)){const a=Ose(i),o=Lse(s,i.props);return i.type!==I.Fragment&&(o.ref=r?pV(r,a):a),I.cloneElement(i,o)}return I.Children.count(i)>1?I.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var mV=Symbol("radix.slottable");function Rse(t){const e=({children:n})=>w.jsx(w.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=mV,e}function Ise(t){return I.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===mV}function Lse(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...o)=>{const l=s(...o);return i(...o),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function Ose(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.
vendor: 8,571 bytes, line 40
40isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function gV(t){const e=t+"CollectionProvider",[n,r]=lf(e),[i,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),a=m=>{const{scope:g,children:v}=m,_=Ze.useRef(null),b=Ze.useRef(new Map).current;return w.jsx(i,{scope:g,itemMap:b,collectionRef:_,children:v})};a.displayName=e;const o=t+"CollectionSlot",l=iw(o),c=Ze.forwardRef((m,g)=>{const{scope:v,children:_}=m,b=s(o,v),x=ri(g,b.collectionRef);return w.jsx(l,{ref:x,children:_})});c.displayName=o;const u=t+"CollectionItemSlot",d="data-radix-collection-item",f=iw(u),h=Ze.forwardRef((m,g)=>{const{scope:v,children:_,...b}=m,x=Ze.useRef(null),T=ri(g,x),N=s(u,v);return Ze.useEffect(()=>(N.itemMap.set(x,{ref:x,...b}),()=>void N.itemMap.delete(x))),w.jsx(f,{[d]:"",ref:T,children:_})});h.displayName=u;function p(m){const g=s(t+"CollectionConsumer",m);return Ze.useCallback(()=>{const _=g.collectionRef.current;if(!_)return[];const b=Array.from(_.querySelectorAll(`[${d}]`));return Array.from(g.itemMap.values()).sort((N,A)=>b.indexOf(N.ref.current)-b.indexOf(A.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:a,Slot:c,ItemSlot:h},p,r]}var Dse=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Jn=Dse.reduce((t,e)=>{const n=iw(`Primitive.${e}`),r=I.forwardRef((i,s)=>{const{asChild:a,...o}=i,l=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),w.jsx(l,{...o,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function vV(t,e){t&&r1.flushSync(()=>t.dispatchEvent(e))}function tu(t){const e=I.useRef(t);return I.useEffect(()=>{e.current=t}),I.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function Fse(t,e=globalThis==null?void 0:globalThis.document){const n=tu(t);I.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var jse="DismissableLayer",FP="dismissableLayer.update",Bse="dismissableLayer.pointerDownOutside",Use="dismissableLayer.focusOutside",vF,yV=I.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),GS=I.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:a,onDismiss:o,...l}=t,c=I.useContext(yV),[u,d]=I.useState(null),f=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=I.useState({}),p=ri(e,A=>d(A)),m=Array.from(c.layers),[g]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),v=m.indexOf(g),_=u?m.indexOf(u):-1,b=c.layersWithOutsidePointerEventsDisabled.size>0,x=_>=v,T=$se(A=>{const L=A.target,M=[...c.branches].some(B=>B.contains(L));!x||M||(i==null||i(A),a==null||a(A),A.defaultPrevented||o==null||o())},f),N=Vse(A=>{const L=A.target;[...c.branches].some(B=>B.contains(L))||(s==null||s(A),a==null||a(A),A.defaultPrevented||o==null||o())},f);return Fse(A=>{_===c.layers.size-1&&(r==null||r(A),!A.defaultPrevented&&o&&(A.preventDefault(),o()))},f),I.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(vF=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),yF(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=vF)}},[u,f,n,c]),I.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),yF())},[u,c]),I.useEffect(()=>{const A=()=>h({});return document.addEventListener(FP,A),()=>document.removeEventListener(FP,A)},[]),w.jsx(Jn.div,{...l,ref:p,style:{pointerEvents:b?x?"auto":"none":void 0,...t.style},onFocusCapture:Hn(t.onFocusCapture,N.onFocusCapture),onBlurCapture:Hn(t.onBlurCapture,N.onBlurCapture),onPointerDownCapture:Hn(t.onPointerDownCapture,T.onPointerDownCapture)})});GS.displayName=jse;var zse="DismissableLayerBranch",_V=I.forwardRef((t,e)=>{const n=I.useContext(yV),r=I.useRef(null),i=ri(e,r);return I.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),w.jsx(Jn.div,{...t,ref:i})});_V.displayName=zse;function $se(t,e=globalThis==null?void 0:globalThis.document){const n=tu(t),r=I.useRef(!1),i=I.useRef(()=>{});return I.useEffect(()=>{const s=o=>{if(o.target&&!r.current){let l=function(){wV(Bse,n,c,{discrete:!0})};const c={originalEvent:o};o.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=l,e.addEventListener("click",i.current,{once:!0})):l()}else e.removeEventListener("click",i.current);r.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function Vse(t,e=globalThis==null?void 0:globalThis.document){const n=tu(t),r=I.useRef(!1);return I.useEffect(()=>{const i=s=>{s.target&&!r.current&&wV(Use,n,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function yF(){const t=new CustomEvent(FP);document.dispatchEvent(t)}function wV(t,e,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?vV(i,s):i.dispatchEvent(s)}var qse=GS,Wse=_V,fd=globalThis!=null&&globalThis.document?I.useLayoutEffect:()=>{},Gse="Portal",aR=I.forwardRef((t,e)=>{var o;const{container:n,...r}=t,[i,s]=I.useState(!1);fd(()=>s(!0),[]);const a=n||i&&((o=globalThis==null?void 0:globalThis.document)==null?void 0:o.body);return a?hV.createPortal(w.jsx(Jn.div,{...r,ref:e}),a):null});aR.displayName=Gse;function Hse(t,e){return I.useReducer((n,r)=>e[n][r]??n,t)}var Zv=t=>{const{present:e,children:n}=t,r=Kse(e),i=typeof n=="function"?n({present:r.isPresent}):I.Children.only(n),s=ri(r.ref,Jse(i));return typeof n=="function"||r.isPresent?I.cloneElement(i,{ref:s}):null};Zv.displayName="Presence";function Kse(t){const[e,n]=I.useState(),r=I.useRef(null),i=I.useRef(t),s=I.useRef("none"),a=t?"mounted":"unmounted",[o,l]=Hse(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return I.useEffect(()=>{const c=Nb(r.current);s.current=o==="mounted"?c:"none"},[o]),fd(()=>{const c=r.current,u=i.current;if(u!==t){const f=s.current,h=Nb(c);t?l("MOUNT"):h==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&f!==h?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),fd(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=h=>{const m=Nb(r.current).includes(h.animationName);if(h.target===e&&m&&(l("ANIMATION_END"),!i.current)){const g=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=g)})}},f=h=>{h.target===e&&(s.current=Nb(r.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(o),ref:I.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function Nb(t){return(t==null?void 0:t.animationName)||"none"}function Jse(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Yse=m3[" useInsertionEffect ".trim().toString()]||fd;function i1({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,s,a]=Xse({defaultProp:e,onChange:n}),o=t!==void 0,l=o?t:i;{const u=I.useRef(t!==void 0);I.useEffect(()=>{const d=u.current;d!==o&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${o?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=o},[o,r])}const c=I.useCallback(u=>{var d;if(o){const f=Qse(u)?u(t):u;f!==t&&((d=a.current)==null||d.call(a,f))}else s(u)},[o,t,s,a]);return[l,c]}function Xse({defaultProp:t,onChange:e}
40){const[n,r]=I.useState(t),i=I.useRef(n),s=I.useRef(e);return Yse(()=>{s.current=e},[e]),I.useEffect(()=>{var a;i.current!==n&&((a=s.current)==null||a.call(s,n),i.current=n)},[n,i]),[n,r,s]}function Qse(t){return typeof t=="function"}var Zse=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),eae="VisuallyHidden",HS=I.forwardRef((t,e)=>w.jsx(Jn.span,{...t,ref:e,style:{...Zse,...t.style}}));HS.displayName=eae;var tae=HS,oR="ToastProvider",[lR,nae,rae]=gV("Toast"),[bV,i7e]=lf("Toast",[rae]),[iae,KS]=bV(oR),xV=t=>{const{__scopeToast:e,label:n="Notification",duration:r=5e3,swipeDirection:i="right",swipeThreshold:s=50,children:a}=t,[o,l]=I.useState(null),[c,u]=I.useState(0),d=I.useRef(!1),f=I.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${oR}\`. Expected non-empty \`string\`.`),w.jsx(lR.Provider,{scope:e,children:w.jsx(iae,{scope:e,label:n,duration:r,swipeDirection:i,swipeThreshold:s,toastCount:c,viewport:o,onViewportChange:l,onToastAdd:I.useCallback(()=>u(h=>h+1),[]),onToastRemove:I.useCallback(()=>u(h=>h-1),[]),isFocusedToastEscapeKeyDownRef:d,isClosePausedRef:f,children:a})})};xV.displayName=oR;var kV="ToastViewport",sae=["F8"],jP="toast.viewportPause",BP="toast.viewportResume",SV=I.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:r=sae,label:i="Notifications ({hotkey})",...s}=t,a=KS(kV,n),o=nae(n),l=I.useRef(null),c=I.useRef(null),u=I.useRef(null),d=I.useRef(null),f=ri(e,d,a.onViewportChange),h=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),p=a.toastCount>0;I.useEffect(()=>{const g=v=>{var b;r.length!==0&&r.every(x=>v[x]||v.code===x)&&((b=d.current)==null||b.focus())};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]),I.useEffect(()=>{const g=l.current,v=d.current;if(p&&g&&v){const _=()=>{if(!a.isClosePausedRef.current){const N=new CustomEvent(jP);v.dispatchEvent(N),a.isClosePausedRef.current=!0}},b=()=>{if(a.isClosePausedRef.current){const N=new CustomEvent(BP);v.dispatchEvent(N),a.isClosePausedRef.current=!1}},x=N=>{!g.contains(N.relatedTarget)&&b()},T=()=>{g.contains(document.activeElement)||b()};return g.addEventListener("focusin",_),g.addEventListener("focusout",x),g.addEventListener("pointermove",_),g.addEventListener("pointerleave",T),window.addEventListener("blur",_),window.addEventListener("focus",b),()=>{g.removeEventListener("focusin",_),g.removeEventListener("focusout",x),g.removeEventListener("pointermove",_),g.removeEventListener("pointerleave",T),window.removeEventListener("blur",_),window.removeEventListener("focus",b)}}},[p,a.isClosePausedRef]);const m=I.useCallback(({tabbingDirection:g})=>{const _=o().map(b=>{const x=b.ref.current,T=[x,...yae(x)];return g==="forwards"?T:T.reverse()});return(g==="forwards"?_.reverse():_).flat()},[o]);return I.useEffect(()=>{const g=d.current;if(g){const v=_=>{var T,N,A;const b=_.altKey||_.ctrlKey||_.metaKey;if(_.key==="Tab"&&!b){const L=document.activeElement,M=_.shiftKey;if(_.target===g&&M){(T=c.current)==null||T.focus();return}const j=m({tabbingDirection:M?"backwards":"forwards"}),$=j.findIndex(U=>U===L);YC(j.slice($+1))?_.preventDefault():M?(N=c.current)==null||N.focus():(A=u.current)==null||A.focus()}};return g.addEventListener("keydown",v),()=>g.removeEventListener("keydown",v)}},[o,m]),w.jsxs(Wse,{ref:l,role:"region","aria-label":i.replace("{hotkey}",h),tabIndex:-1,style:{pointerEvents:p?void 0:"none"},children:[p&&w.jsx(UP,{ref:c,onFocusFromOutsideViewport:()=>{const g=m({tabbingDirection:"forwards"});YC(g)}}),w.jsx(lR.Slot,{scope:n,children:w.jsx(Jn.ol,{tabIndex:-1,...s,ref:f})}),p&&w.jsx(UP,{ref:u,onFocusFromOutsideViewport:()=>{const g=m({tabbingDirection:"backwards"});YC(g)}})]})});SV.displayName=kV;var TV="ToastFocusProxy",UP=I.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...i}=t,s=KS(TV,n);return w.jsx(HS,{"aria-hidden":!0,tabIndex:0,...i,ref:e,style:{position:"fixed"},onFocus:a=>{var c;const o=a.relatedTarget;!((c=s.viewport)!=null&&c.contains(o))&&r()}})});UP.displayName=TV;var s1="Toast",aae="toast.swipeStart",oae="toast.swipeMove",lae="toast.swipeCancel",cae="toast.swipeEnd",CV=I.forwardRef((t,e)=>{const{forceMount:n,open:r,defaultOpen:i,onOpenChange:s,...a}=t,[o,l]=i1({prop:r,defaultProp:i??!0,onChange:s,caller:s1});return w.jsx(Zv,{present:n||o,children:w.jsx(hae,{open:o,...a,ref:e,onClose:()=>l(!1),onPause:tu(t.onPause),onResume:tu(t.onResume),onSwipeStart:Hn(t.onSwipeStart,c=>{c.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Hn(t.onSwipeMove,c=>{const{x:u,y:d}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","move"),c.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${u}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${d}px`)}),onSwipeCancel:Hn(t.onSwipeCancel,c=>{c.currentTarget.setAttribute("data-swipe","cancel"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),c.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Hn(t.onSwipeEnd,c=>{const{x:u,y:d}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","end"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),c.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${u}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${d}px`),l(!1)})})})});CV.displayName=s1;var[uae,dae]=bV(s1,{onClose(){}}),hae=I.forwardRef((t,e)=>{const{__scopeToast:n,type:r="foreground",duration:i,open:s,onClose:a,onEscapeKeyDown:o,onPause:l,onResume:c,onSwipeStart:u,onSwipeMove:d,onSwipeCancel:f,onSwipeEnd:h,...p}=t,m=KS(s1,n),[g,v]=I.useState(null),_=ri(e,U=>v(U)),b=I.useRef(null),x=I.useRef(null),T=i||m.duration,N=I.useRef(0),A=I.useRef(T),L=I.useRef(0),{onToastAdd:M,onToastRemove:B}=m,R=tu(()=>{var te;(g==null?void 0:g.contains(document.activeElement))&&((te=m.viewport)==null||te.focus()),a()}),j=I.useCallback(U=>
40{!U||U===1/0||(window.clearTimeout(L.current),N.current=new Date().getTime(),L.current=window.setTimeout(R,U))},[R]);I.useEffect(()=>{const U=m.viewport;if(U){const te=()=>{j(A.current),c==null||c()},ne=()=>{const le=new Date().getTime()-N.current;A.current=A.current-le,window.clearTimeout(L.current),l==null||l()};return U.addEventListener(jP,ne),U.addEventListener(BP,te),()=>{U.removeEventListener(jP,ne),U.removeEventListener(BP,te)}}},[m.viewport,T,l,c,j]),I.useEffect(()=>{s&&!m.isClosePausedRef.current&&j(T)},[s,T,m.isClosePausedRef,j]),I.useEffect(()=>(M(),()=>B()),[M,B]);const $=I.useMemo(()=>g?IV(g):null,[g]);return m.viewport?w.jsxs(w.Fragment,{children:[$&&w.jsx(fae,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0,children:$}),w.jsx(uae,{scope:n,onClose:R,children:r1.createPortal(w.jsx(lR.ItemSlot,{scope:n,children:w.jsx(qse,{asChild:!0,onEscapeKeyDown:Hn(o,()=>{m.isFocusedToastEscapeKeyDownRef.current||R(),m.isFocusedToastEscapeKeyDownRef.current=!1}),children:w.jsx(Jn.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":s?"open":"closed","data-swipe-direction":m.swipeDirection,...p,ref:_,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:Hn(t.onKeyDown,U=>{U.key==="Escape"&&(o==null||o(U.nativeEvent),U.nativeEvent.defaultPrevented||(m.isFocusedToastEscapeKeyDownRef.current=!0,R()))}),onPointerDown:Hn(t.onPointerDown,U=>{U.button===0&&(b.current={x:U.clientX,y:U.clientY})}),onPointerMove:Hn(t.onPointerMove,U=>{if(!b.current)return;const te=U.clientX-b.current.x,ne=U.clientY-b.current.y,le=!!x.current,V=["left","right"].includes(m.swipeDirection),q=["left","up"].includes(m.swipeDirection)?Math.min:Math.max,se=V?q(0,te):0,he=V?0:q(0,ne),z=U.pointerType==="touch"?10:2,J={x:se,y:he},Y={originalEvent:U,delta:J};le?(x.current=J,Rb(oae,d,Y,{discrete:!1})):_F(J,m.swipeDirection,z)?(x.current=J,Rb(aae,u,Y,{discrete:!1}),U.target.setPointerCapture(U.pointerId)):(Math.abs(te)>z||Math.abs(ne)>z)&&(b.current=null)}),onPointerUp:Hn(t.onPointerUp,U=>{const te=x.current,ne=U.target;if(ne.hasPointerCapture(U.pointerId)&&ne.releasePointerCapture(U.pointerId),x.current=null,b.current=null,te){const le=U.currentTarget,V={originalEvent:U,delta:te};_F(te,m.swipeDirection,m.swipeThreshold)?Rb(cae,h,V,{discrete:!0}):Rb(lae,f,V,{discrete:!0}),le.addEventListener("click",q=>q.preventDefault(),{once:!0})}})})})}),m.viewport)})]}):null}),fae=t=>{const{__scopeToast:e,children:n,...r}=t,i=KS(s1,e),[s,a]=I.useState(!1),[o,l]=I.useState(!1);return gae(()=>a(!0)),I.useEffect(()=>{const c=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(c)},[]),o?null:w.jsx(aR,{asChild:!0,children:w.jsx(HS,{...r,children:s&&w.jsxs(w.Fragment,{children:[i.label," ",n]})})})},pae="ToastTitle",EV=I.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return w.jsx(Jn.div,{...r,ref:e})});EV.displayName=pae;var mae="ToastDescription",AV=I.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return w.jsx(Jn.div,{...r,ref:e})});AV.displayName=mae;var PV="ToastAction",MV=I.forwardRef((t,e)=>{const{altText:n,...r}=t;return n.trim()?w.jsx(RV,{altText:n,asChild:!0,children:w.jsx(cR,{...r,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${PV}\`. Expected non-empty \`string\`.`),null)});MV.displayName=PV;var NV="ToastClose",cR=I.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t,i=dae(NV,n);return w.jsx(RV,{asChild:!0,children:w.jsx(Jn.button,{type:"button",...r,ref:e,onClick:Hn(t.onClick,i.onClose)})})});cR.displayName=NV;var RV=I.forwardRef((t,e)=>{const{__scopeToast:n,altText:r,...i}=t;return w.jsx(Jn.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...i,ref:e})});function IV(t){const e=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),vae(r)){const i=r.ariaHidden||r.hidden||r.style.display==="none",s=r.dataset.radixToastAnnounceExclude==="";if(!i)if(s){const a=r.dataset.radixToastAnnounceAlt;a&&e.push(a)}else e.push(...IV(r))}}),e}function Rb(t,e,n,{discrete:r}){const i=n.originalEvent.currentTarget,s=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?vV(i,s):i.dispatchEvent(s)}var _F=(t,e,n=0)=>{const r=Math.abs(t.x),i=Math.abs(t.y),s=r>i;return e==="left"||e==="right"?s&&r>n:!s&&i>n};function gae(t=()=>{}){const e=tu(t);fd(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[e])}function vae(t){return t.nodeType===t.ELEMENT_NODE}function yae(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function YC(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var _ae=xV,LV=SV,OV=CV,DV=EV,FV=AV,jV=MV,BV=cR;function UV(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=UV(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function zV(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=UV(t))&&(r&&(r+=" "),r+=e);return r}const wF=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,bF=zV,a1=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return bF(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:s}=e,a=Object.keys(i).map(c=>{const u=n==null?void 0:n[c],d=s==null?void 0:s[c];if(u===null)return null;const f=wF(u)||wF(d);return i[c][f]}),o=n&&Object.entries(n).reduce((c,u)=>{let[d,f]=u;return f===void 0||(c[d]=f),c},{}),l=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:d,className:f,...h}=u;return Object.entries(h).every(p=>{let[m,g]=p;return Array.isArray(g)?g.includes({...s,...o}[m]):{...s,...o}[m]===g})?[...c,d,f]:c},[]);return bF(t,a,l,n==null?void 0:n.class,n==null?void 0:n.className)};/** 41 * @license lucide-react v0.462.0 - ISC 42 * 43 * This source code is licensed under the ISC license. 44 * See the LICENSE file in the root directory of this source tree. 45 */const wae=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),$V=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();/** 46 * @license lucide-react v0.462.0 - ISC 47 * 48 * This source code is licensed under the ISC license. 49 * See the LICENSE file in the root directory of this source tree. 50 */var bae={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"};/** 51 * @license lucide-react v0.462.0 - ISC 52 * 53 * This source code is licensed under the ISC license. 54 * See the LICENSE file in the root directory of this source tree. 55 */const xae=I.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:a,...o},l)=>I.createElement("svg",{ref:l,...bae,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:$V("lucide",i),...o},[...a.map(([c,u])=>I.createElement(c,u)),...Array.isArray(s)?s:[s]]));/** 56 * @license lucide-react v0.462.0 - ISC 57 * 58 * This source code is licensed under the ISC license. 59 * See the LICENSE file in the root directory of this source tree. 60 */const lt=(t,e)=>{const n=I.forwardRef(({className:r,...i},s)=>I.createElement(xae,{ref:s,iconNode:e,className:$V(`lucide-${wae(t)}`,r),...i}));return n.displayName=`${t}`,n};/** 61 * @license lucide-react v0.462.0 - ISC 62 * 63 * This source code is licensed under the ISC license. 64 * See the LICENSE file in the root directory of this source tree. 65 */const xF=lt("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l
65-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** 66 * @license lucide-react v0.462.0 - ISC 67 * 68 * This source code is licensed under the ISC license. 69 * See the LICENSE file in the root directory of this source tree. 70 */const kae=lt("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** 71 * @license lucide-react v0.462.0 - ISC 72 * 73 * This source code is licensed under the ISC license. 74 * See the LICENSE file in the root directory of this source tree. 75 */const o1=lt("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** 76 * @license lucide-react v0.462.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 */const Sae=lt("Battery",[["rect",{width:"16",height:"10",x:"2",y:"7",rx:"2",ry:"2",key:"1w10f2"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}]]);/** 81 * @license lucide-react v0.462.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 Tae=lt("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"}]]);/** 86 * @license lucide-react v0.462.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 uR=lt("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** 91 * @license lucide-react v0.462.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 zP=lt("BrainCircuit",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M9 13a4.5 4.5 0 0 0 3-4",key:"10igwf"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M12 13h4",key:"1ku699"}],["path",{d:"M12 18h6a2 2 0 0 1 2 2v1",key:"105ag5"}],["path",{d:"M12 8h8",key:"1lhi5i"}],["path",{d:"M16 8V5a2 2 0 0 1 2-2",key:"u6izg6"}],["circle",{cx:"16",cy:"13",r:".5",key:"ry7gng"}],["circle",{cx:"18",cy:"3",r:".5",key:"1aiba7"}],["circle",{cx:"20",cy:"21",r:".5",key:"yhc1fs"}],["circle",{cx:"20",cy:"8",r:".5",key:"1e43v0"}]]);/** 96 * @license lucide-react v0.462.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 VV=lt("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** 101 * @license lucide-react v0.462.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 Cae=lt("Building",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["path",{d:"M9 22v-4h6v4",key:"r93iot"}],["path",{d:"M8 6h.01",key:"1dz90k"}],["path",{d:"M16 6h.01",key:"1x0f13"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M8 14h.01",key:"6423bh"}]]);/** 106 * @license lucide-react v0.462.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 Eae=lt("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"}]]);/** 111 * @license lucide-react v0.462.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 qV=lt("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"}]]);/** 116 * @license lucide-react v0.462.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 Aae=lt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** 121 * @license lucide-react v0.462.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 WV=lt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** 126 * @license lucide-react v0.462.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 vk=lt("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** 131 * @license lucide-react v0.462.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 Pae=lt("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** 136 * @license lucide-react v0.462.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 Mae=lt("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** 141 * @license lucide-react v0.462.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 $P=lt("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** 146 * @license lucide-react v0.462.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 Kg=lt("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** 151 * @license lucide-react v0.462.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 Nae=lt("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}
155],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** 156 * @license lucide-react v0.462.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 Rae=lt("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"}]]);/** 161 * @license lucide-react v0.462.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 VP=lt("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/** 166 * @license lucide-react v0.462.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 sw=lt("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"}]]);/** 171 * @license lucide-react v0.462.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 dR=lt("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** 176 * @license lucide-react v0.462.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 hR=lt("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** 181 * @license lucide-react v0.462.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 yk=lt("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"}]]);/** 186 * @license lucide-react v0.462.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 Iae=lt("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** 191 * @license lucide-react v0.462.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 Lae=lt("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/** 196 * @license lucide-react v0.462.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 GV=lt("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);/** 201 * @license lucide-react v0.462.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 HV=lt("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"}]]);/** 206 * @license lucide-react v0.462.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 Oae=lt("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"}]]);/** 211 * @license lucide-react v0.462.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 Dae=lt("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** 216 * @license lucide-react v0.462.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 y_=lt("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** 221 * @license lucide-react v0.462.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 aw=lt("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"}]]);/** 226 * @license lucide-react v0.462.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 Fae=lt("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"}]]);/** 231 * @license lucide-react v0.462.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 fR=lt("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"}]]);/** 236 * @license lucide-react v0.462.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 jae=lt("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/** 241 * @license lucide-react v0.462.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 Bae=lt("MicOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2",key:"80xlxr"}],["path",{d:"M5 10v2a7 7 0 0 0 12 5",key:"p2k8kg"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** 246 * @license lucide-react v0.462.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 KV=lt("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** 251 * @license lucide-react v0.462.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 kF=lt("MoveHorizontal",[["path",{d:"m18 8 4 4-4 4",key:"1ak13k"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}]]);/** 256 * @license lucide-react v0.462.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 SF=lt("MoveVertical",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m8 18 4 4 4-4",key:"bh5tu3"}],["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}]]);/** 261 * @license lucide-react v0.462.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 Uae=lt("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/** 266 * @license lucide-react v0.462.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 zae=lt("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/** 271 * @license lucide-react v0.462.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 $ae=lt("PhoneOff",[["path",{d:"M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m
275-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 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.91",key:"z86iuo"}],["line",{x1:"22",x2:"2",y1:"2",y2:"22",key:"11kh81"}]]);/** 276 * @license lucide-react v0.462.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 JV=lt("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"}]]);/** 281 * @license lucide-react v0.462.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 pR=lt("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** 286 * @license lucide-react v0.462.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 qP=lt("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** 291 * @license lucide-react v0.462.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 mR=lt("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/** 296 * @license lucide-react v0.462.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 YV=lt("Route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);/** 301 * @license lucide-react v0.462.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 gR=lt("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** 306 * @license lucide-react v0.462.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 TF=lt("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** 311 * @license lucide-react v0.462.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 Vae=lt("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** 316 * @license lucide-react v0.462.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 qae=lt("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"}]]);/** 321 * @license lucide-react v0.462.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 py=lt("Ship",[["path",{d:"M12 10.189V14",key:"1p8cqu"}],["path",{d:"M12 2v3",key:"qbqxhf"}],["path",{d:"M19 13V7a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v6",key:"qpkstq"}],["path",{d:"M19.38 20A11.6 11.6 0 0 0 21 14l-8.188-3.639a2 2 0 0 0-1.624 0L3 14a11.6 11.6 0 0 0 2.81 7.76",key:"7tigtc"}],["path",{d:"M2 21c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1s1.2 1 2.5 1c2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"1924j5"}]]);/** 326 * @license lucide-react v0.462.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 Wae=lt("SlidersVertical",[["line",{x1:"4",x2:"4",y1:"21",y2:"14",key:"1p332r"}],["line",{x1:"4",x2:"4",y1:"10",y2:"3",key:"gb41h5"}],["line",{x1:"12",x2:"12",y1:"21",y2:"12",key:"hf2csr"}],["line",{x1:"12",x2:"12",y1:"8",y2:"3",key:"1kfi7u"}],["line",{x1:"20",x2:"20",y1:"21",y2:"16",key:"1lhrwl"}],["line",{x1:"20",x2:"20",y1:"12",y2:"3",key:"16vvfq"}],["line",{x1:"2",x2:"6",y1:"14",y2:"14",key:"1uebub"}],["line",{x1:"10",x2:"14",y1:"8",y2:"8",key:"1yglbp"}],["line",{x1:"18",x2:"22",y1:"16",y2:"16",key:"1jxqpz"}]]);/** 331 * @license lucide-react v0.462.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 WP=lt("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** 336 * @license lucide-react v0.462.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 XV=lt("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** 341 * @license lucide-react v0.462.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 CF=lt("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** 346 * @license lucide-react v0.462.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 Gae=lt("Thermometer",[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]]);/** 351 * @license lucide-react v0.462.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 GP=lt("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/** 356 * @license lucide-react v0.462.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 QV=lt("TriangleAlert",[["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-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** 361 * @license lucide-react v0.462.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 ZV=lt("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"}]]);/** 366 * @license lucide-react v0.462.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 _k=lt("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"}]]);/** 371 * @license lucide-react v0.462.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 EF=lt("VideoOff",[["path",{d:"M10.66 6H14a2 2 0 0 1 2 2v2.5l5.248-3.062A.5.5 0 0 1 22 7.87v8.196",key:"w8jjjt"}],["path",{d:"M16 16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2",key:"1xawa7"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** 376 * @license lucide-react v0.462.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 AF=lt("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);/** 381 * @license lucide-react v0.462.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 PF=lt("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/** 386 * @license lucide-react v0.462.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 Hae=lt("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);/** 391 * @license lucide-react v0.462.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 Kae=lt("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}
vendor: 9,629 bytes, lines 395-415
395],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** 396 * @license lucide-react v0.462.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 eq=lt("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** 401 * @license lucide-react v0.462.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 Jae=lt("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** 406 * @license lucide-react v0.462.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 vR=lt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** 411 * @license lucide-react v0.462.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 Yae=lt("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),yR="-",Xae=t=>{const e=Zae(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:a=>{const o=a.split(yR);return o[0]===""&&o.length!==1&&o.shift(),tq(o,e)||Qae(a)},getConflictingClassGroupIds:(a,o)=>{const l=n[a]||[];return o&&r[a]?[...l,...r[a]]:l}}},tq=(t,e)=>{var a;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?tq(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(yR);return(a=e.validators.find(({validator:o})=>o(s)))==null?void 0:a.classGroupId},MF=/^\[(.+)\]$/,Qae=t=>{if(MF.test(t)){const e=MF.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},Zae=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return toe(Object.entries(t.classGroups),n).forEach(([s,a])=>{HP(a,r,s,e)}),r},HP=(t,e,n,r)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:NF(e,i);s.classGroupId=n;return}if(typeof i=="function"){if(eoe(i)){HP(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([s,a])=>{HP(a,NF(e,s),n,r)})})},NF=(t,e)=>{let n=t;return e.split(yR).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},eoe=t=>t.isThemeGetter,toe=(t,e)=>e?t.map(([n,r])=>{const i=r.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([a,o])=>[e+a,o])):s);return[n,i]}):t,noe=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const i=(s,a)=>{n.set(s,a),e++,e>t&&(e=0,r=n,n=new Map)};return{get(s){let a=n.get(s);if(a!==void 0)return a;if((a=r.get(s))!==void 0)return i(s,a),a},set(s,a){n.has(s)?n.set(s,a):i(s,a)}}},nq="!",roe=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,i=e[0],s=e.length,a=o=>{const l=[];let c=0,u=0,d;for(let g=0;g<o.length;g++){let v=o[g];if(c===0){if(v===i&&(r||o.slice(g,g+s)===e)){l.push(o.slice(u,g)),u=g+s;continue}if(v==="/"){d=g;continue}}v==="["?c++:v==="]"&&c--}const f=l.length===0?o:o.substring(u),h=f.startsWith(nq),p=h?f.substring(1):f,m=d&&d>u?d-u:void 0;return{modifiers:l,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:m}};return n?o=>n({className:o,parseClassName:a}):a},ioe=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},soe=t=>({cache:noe(t.cacheSize),parseClassName:roe(t),...Xae(t)}),aoe=/\s+/,ooe=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,s=[],a=t.trim().split(aoe);let o="";for(let l=a.length-1;l>=0;l-=1){const c=a[l],{modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:h}=n(c);let p=!!h,m=r(p?f.substring(0,h):f);if(!m){if(!p){o=c+(o.length>0?" "+o:o);continue}if(m=r(f),!m){o=c+(o.length>0?" "+o:o);continue}p=!1}const g=ioe(u).join(":"),v=d?g+nq:g,_=v+m;if(s.includes(_))continue;s.push(_);const b=i(m,p);for(let x=0;x<b.length;++x){const T=b[x];s.push(v+T)}o=c+(o.length>0?" "+o:o)}return o};function loe(){let t=0,e,n,r="";for(;t<arguments.length;)(e=arguments[t++])&&(n=rq(e))&&(r&&(r+=" "),r+=n);return r}const rq=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=rq(t[r]))&&(n&&(n+=" "),n+=e);return n};function coe(t,...e){let n,r,i,s=a;function a(l){const c=e.reduce((u,d)=>d(u),t());return n=soe(c),r=n.cache.get,i=n.cache.set,s=o,o(l)}function o(l){const c=r(l);if(c)return c;const u=ooe(l,n);return i(l,u),u}return function(){return s(loe.apply(null,arguments))}}const Pr=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},iq=/^\[(?:([a-z-]+):)?(.+)\]$/i,uoe=/^\d+\/\d+$/,doe=new Set(["px","full","screen"]),hoe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,foe=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,poe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,moe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,goe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Lu=t=>Jg(t)||doe.has(t)||uoe.test(t),qd=t=>e0(t,"length",Soe),Jg=t=>!!t&&!Number.isNaN(Number(t)),XC=t=>e0(t,"number",Jg),my=t=>!!t&&Number.isInteger(Number(t)),voe=t=>t.endsWith("%")&&Jg(t.slice(0,-1)),fn=t=>iq.test(t),Wd=t=>hoe.test(t),yoe=new Set(["length","size","percentage"]),_oe=t=>e0(t,yoe,sq),woe=t=>e0(t,"position",sq),boe=new Set(["image","url"]),xoe=t=>e0(t,boe,Coe),koe=t=>e0(t,"",Toe),gy=()=>!0,e0=(t,e,n)=>{const r=iq.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},Soe=t=>foe.test(t)&&!poe.test(t),sq=()=>!1,Toe=t=>moe.test(t),Coe=t=>goe.test(t),Eoe=()=>{const t=Pr("colors"),e=Pr("spacing"),n=Pr("blur"),r=Pr("brightness"),i=Pr("borderColor"),s=Pr("borderRadius"),a=Pr("borderSpacing"),o=Pr("borderWidth"),l=Pr("contrast"),c=Pr("grayscale"),u=Pr("hueRotate"),d=Pr("invert"),f=Pr("gap"),h=Pr("gradientColorStops"),p=Pr("gradientColorStopPositions"),m=Pr("inset"),g=Pr("margin"),v=Pr("opacity"),_=Pr("padding"),b=Pr("saturate"),x=Pr("scale"),T=Pr("sepia"),N=Pr("skew"),A=Pr("space"),L=Pr("translate"),M=()=>["auto","contain","none"],B=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto",fn,e],j=()=>[fn,e],$=()=>["",Lu,qd],U=()=>["auto",Jg,fn],te=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ne=()=>["solid","dashed","dotted","double","none"],le=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],V=()=>["start","end","center","between","around","evenly","stretch"],q=()=>["","0",fn],se=()=>["auto","avoid","all","avoid-page","page","left","right","column"],he=()=>[Jg,fn];return{cacheSize:500,separator:":",theme:{colors:[gy],spacing:[Lu,qd],blur:["none","",Wd,fn],brightness:he(),borderColor:[t],borderRadius:["none","","full",Wd,fn],borderSpacing:j(),borderWidth:$(),contrast:he(),grayscale:q(),hueRotate:he(),invert:q(),gap:j(),gradientColorStops:[t],gradientColorStopPositions:[voe,qd],inset:R(),margin:R(),opacity:he(),padding:j(),saturate:he(),scale:he(),sepia:q(),skew:he(),space:j(),translate:j()},classGroups:{aspect:[{aspect:["auto","square","video",fn]}],container:["container"],columns:[{columns:[Wd]}],"break-after":[{"break-after":se()}],"break-before":[{"break-before":se()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...te(),fn]}],overflow:[{overflow:B()}],"overflow-x":[{"overflow-x":B()}],"overflow-y":[{"overflow-y":B()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",my,fn]}],basis:[{basis:R()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",fn]}],grow:[{grow:q()}],shrink:[{shrink:q()}],order:[{order:["first","last","none",my,fn]}],"grid-cols":[{"grid-cols":[gy]}],"col-start-end":[{col:["auto",{span:["full",my,fn]},fn]}],"col-start":[{"col-start":U()}
vendor: 9,433 bytes, line 415
415],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":[gy]}],"row-start-end":[{row:["auto",{span:[my,fn]},fn]}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",fn]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",fn]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...V()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...V(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...V(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[_]}],px:[{px:[_]}],py:[{py:[_]}],ps:[{ps:[_]}],pe:[{pe:[_]}],pt:[{pt:[_]}],pr:[{pr:[_]}],pb:[{pb:[_]}],pl:[{pl:[_]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[A]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[A]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",fn,e]}],"min-w":[{"min-w":[fn,e,"min","max","fit"]}],"max-w":[{"max-w":[fn,e,"none","full","min","max","fit","prose",{screen:[Wd]},Wd]}],h:[{h:[fn,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[fn,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[fn,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[fn,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Wd,qd]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",XC]}],"font-family":[{font:[gy]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",fn]}],"line-clamp":[{"line-clamp":["none",Jg,XC]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Lu,fn]}],"list-image":[{"list-image":["none",fn]}],"list-style-type":[{list:["none","disc","decimal",fn]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[v]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[v]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ne(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Lu,qd]}],"underline-offset":[{"underline-offset":["auto",Lu,fn]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",fn]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",fn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[v]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...te(),woe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",_oe]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},xoe]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[p]}],"gradient-via-pos":[{via:[p]}],"gradient-to-pos":[{to:[p]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[o]}],"border-w-x":[{"border-x":[o]}],"border-w-y":[{"border-y":[o]}],"border-w-s":[{"border-s":[o]}],"border-w-e":[{"border-e":[o]}],"border-w-t":[{"border-t":[o]}],"border-w-r":[{"border-r":[o]}],"border-w-b":[{"border-b":[o]}],"border-w-l":[{"border-l":[o]}],"border-opacity":[{"border-opacity":[v]}],"border-style":[{border:[...ne(),"hidden"]}],"divide-x":[{"divide-x":[o]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[o]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[v]}],"divide-style":[{divide:ne()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...ne()]}],"outline-offset":[{"outline-offset":[Lu,fn]}],"outline-w":[{outline:[Lu,qd]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[v]}],"ring-offset-w":[{"ring-offset":[Lu,qd]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Wd,koe]}],"shadow-color":[{shadow:[gy]}],opacity:[{opacity:[v]}],"mix-blend":[{"mix-blend":[...le(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":le()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Wd,fn]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[b]}],sepia:[{sepia:[T]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[v]}],"backdrop-saturate":[{"backdrop-saturate":[b]}],"backdrop-sepia":[{"backdrop-sepia":[T]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",fn]}],duration:[{duration:he()}],ease:[{ease:["linear","in","out","in-out",fn]}],delay:[{delay:he()}],animate:[{animate:["none","spin","ping","pulse","bounce",fn]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[x]}],"scale-x":[{"scale-x":[x]}],"scale-y":[{"scale-y":[x]}],rotate:[{rotate:[my,fn]}],"translate-x":[{"translate-x":[L]}],"translate-y":[{"translate-y":[L]}],"skew-x":[{"skew-x":[N]}],"skew-y":[{"skew-y":[N]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",fn]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",fn]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}
vendor: 4,657 bytes, line 415
415],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",fn]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Lu,qd,XC]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},Aoe=coe(Eoe);function vt(...t){return Aoe(zV(t))}const Poe=_ae,aq=I.forwardRef(({className:t,...e},n)=>w.jsx(LV,{ref:n,className:vt("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...e}));aq.displayName=LV.displayName;const Moe=a1("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),oq=I.forwardRef(({className:t,variant:e,...n},r)=>w.jsx(OV,{ref:r,className:vt(Moe({variant:e}),t),...n}));oq.displayName=OV.displayName;const Noe=I.forwardRef(({className:t,...e},n)=>w.jsx(jV,{ref:n,className:vt("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",t),...e}));Noe.displayName=jV.displayName;const lq=I.forwardRef(({className:t,...e},n)=>w.jsx(BV,{ref:n,className:vt("absolute right-2 top-2 rounded-md p-1 text-foreground
415/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:w.jsx(vR,{className:"h-4 w-4"})}));lq.displayName=BV.displayName;const cq=I.forwardRef(({className:t,...e},n)=>w.jsx(DV,{ref:n,className:vt("text-sm font-semibold",t),...e}));cq.displayName=DV.displayName;const uq=I.forwardRef(({className:t,...e},n)=>w.jsx(FV,{ref:n,className:vt("text-sm opacity-90",t),...e}));uq.displayName=FV.displayName;function Roe(){const{toasts:t}=Xv();return w.jsxs(Poe,{children:[t.map(function({id:e,title:n,description:r,action:i,...s}){return w.jsxs(oq,{...s,children:[w.jsxs("div",{className:"grid gap-1",children:[n&&w.jsx(cq,{children:n}),r&&w.jsx(uq,{children:r})]}),i,w.jsx(lq,{})]},e)}),w.jsx(aq,{})]})}var RF=["light","dark"],Ioe="(prefers-color-scheme: dark)",Loe=I.createContext(void 0),Ooe={setTheme:t=>{},themes:[]},Doe=()=>{var t;return(t=I.useContext(Loe))!=null?t:Ooe};I.memo(({forcedTheme:t,storageKey:e,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:s,value:a,attrs:o,nonce:l})=>{let c=s==="system",u=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${o.map(p=>`'${p}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,d=i?RF.includes(s)&&s?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${s}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",f=(p,m=!1,g=!0)=>{let v=a?a[p]:p,_=m?p+"|| ''":`'${v}'`,b="";return i&&g&&!m&&RF.includes(p)&&(b+=`d.style.colorScheme = '${p}';`),n==="class"?m||v?b+=`c.add(${_})`:b+="null":v&&(b+=`d[s](n,${_})`),b},h=t?`!function(){${u}${f(t)}}()`:r?`!function(){try{${u}var e=localStorage.getItem('${e}');if('system'===e||(!e&&${c})){var t='${Ioe}',m=window.matchMedia(t);if(m.media!==t||m.matches){${f("dark")}}else{${f("light")}}}else if(e){${a?`var x=${JSON.stringify(a)};`:""}${f(a?"x[e]":"e",!0)}}${c?"":"else{"+f(s,!1,!1)+"}"}${d}}catch(e){}}()`:`!function(){try{${u}var e=localStorage.getItem('${e}');if(e){${a?`var x=${JSON.stringify(a)};`:""}${f(a?"x[e]":"e",!0)}}else{${f(s,!1,!1)};}${d}}catch(t){}}();`;return I.createElement("script",{nonce:l,dangerouslySetInnerHTML:{__html:h}})});var Foe=t=>{switch(t){case"success":return Uoe;case"info":return $oe;case"warning":return zoe;case"error":return Voe;default:return null}},joe=Array(12).fill(0),Boe=({visible:t,className:e})=>Ze.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},Ze.createElement("div",{className:"sonner-spinner"},joe.map((n,r)=>Ze.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),Uoe=Ze.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ze.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),zoe=Ze.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},Ze.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),$oe=Ze.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ze.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),Voe=Ze.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ze.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),qoe=Ze.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},Ze.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Ze.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Woe=()=>{let[t,e]=Ze.useState(document.hidden);return Ze.useEffect(()=>{let n=()=>{e(document.hidden)};
415return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t},KP=1,Goe=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let n=this.subscribers.indexOf(e);this.subscribers.splice(n,1)}),this.publish=e=>{this.subscribers.forEach(n=>n(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var n;let{message:r,...i}=e,s=typeof(e==null?void 0:e.id)=="number"||((n=e.id)==null?void 0:n.length)>0?e.id:KP++,a=this.toasts.find(l=>l.id===s),o=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),a?this.toasts=this.toasts.map(l=>l.id===s?(this.publish({...l,...e,id:s,title:r}),{...l,...e,id:s,dismissible:o,title:r}):l):this.addToast({title:r,...i,dismissible:o,id:s}),s},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),this.subscribers.forEach(n=>n({id:e,dismiss:!0})),e),this.message=(e,n)=>this.create({...n,message:e}),this.error=(e,n)=>this.create({...n,message:e,type:"error"}),this.success=(e,n)=>this.create({...n,type:"success",message:e}),this.info=(e,n)=>this.create({...n,type:"info",message:e}),this.warning=(e,n)=>this.create({...n,type:"warning",message:e}),this.loading=(e,n)=>this.create({...n,type:"loading",message:e}),this.promise=(e,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:e,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));let i=e instanceof Promise?e:e(),s=r!==void 0,a,o=i.then(async c=>{if(a=["resolve",c],Ze.isValidElement(c))s=!1,this.create({id:r,type:"default",message:c});else if(Koe(c)&&!c.ok){s=!1;let u=typeof n.error=="function"?await n.error(`HTTP error! status: ${c.status}`):n.error,d=typeof n.description=="function"?await n.description(`HTTP error! status: ${c.status}`):n.description;this.create({id:r,type:"error",message:u,description:d})}else if(n.success!==void 0){s=!1;let u=typeof n.success=="function"?await n.success(c):n.success,d=typeof n.description=="function"?await n.description(c):n.description;this.create({id:r,type:"success",message:u,description:d})}}).catch(async c=>{if(a=["reject",c],n.error!==void 0){s=!1;let u=typeof n.error=="function"?await n.error(c):n.error,d=typeof n.description=="function"?await n.description(c):n.description;this.create({id:r,type:"error",message:u,description:d})}}).finally(()=>{var c;s&&(this.dismiss(r),r=void 0),(c=n.finally)==null||c.call(n)}),l=()=>new Promise((c,u)=>o.then(()=>a[0]==="reject"?u(a[1]):c(a[1])).catch(u));return typeof r!="string"&&typeof r!="number"?{unwrap:l}:Object.assign(r,{unwrap:l})},this.custom=(e,n)=>{let r=(n==null?void 0:n.id)||KP++;return this.create({jsx:e(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Ba=new Goe,Hoe=(t,e)=>{let n=(e==null?void 0:e.id)||KP++;return Ba.addToast({title:t,...e,id:n}),n},Koe=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",Joe=Hoe,Yoe=()=>Ba.toasts,Xoe=()=>Ba.getActiveToasts(),Ib=Object.assign(Joe,{success:Ba.success,info:Ba.info,warning:Ba.warning,error:Ba.error,custom:Ba.custom,message:Ba.message,promise:Ba.promise,dismiss:Ba.dismiss,loading:Ba.loading},{getHistory:Yoe,getToasts:Xoe});function Qoe(t,{insertAt:e}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",e==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}Qoe(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;
415left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}
415:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);
415--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} 416`);
416function Lb(t){return t.label!==void 0}var Zoe=3,ele="32px",tle="16px",IF=4e3,nle=356,rle=14,ile=20,sle=200;function xl(...t){return t.filter(Boolean).join(" ")}function ale(t){let[e,n]=t.split("-"),r=[];return e&&r.push(e),n&&r.push(n),r}var ole=t=>{var e,n,r,i,s,a,o,l,c,u,d;let{invert:f,toast:h,unstyled:p,interacting:m,setHeights:g,visibleToasts:v,heights:_,index:b,toasts:x,expanded:T,removeToast:N,defaultRichColors:A,closeButton:L,style:M,cancelButtonStyle:B,actionButtonStyle:R,className:j="",descriptionClassName:$="",duration:U,position:te,gap:ne,loadingIcon:le,expandByDefault:V,classNames:q,icons:se,closeButtonAriaLabel:he="Close toast",pauseWhenPageIsHidden:z}=t,[J,Y]=Ze.useState(null),[de,fe]=Ze.useState(null),[me,Ce]=Ze.useState(!1),[Ee,Ae]=Ze.useState(!1),[De,Fe]=Ze.useState(!1),[Re,Je]=Ze.useState(!1),[re,Ye]=Ze.useState(!1),[Mt,xt]=Ze.useState(0),[Ue,St]=Ze.useState(0),ot=Ze.useRef(h.duration||U||IF),Et=Ze.useRef(null),mt=Ze.useRef(null),An=b===0,Kt=b+1<=v,At=h.type,Jt=h.dismissible!==!1,ln=h.className||"",nt=h.descriptionClassName||"",Ut=Ze.useMemo(()=>_.findIndex(Dt=>Dt.toastId===h.id)||0,[_,h.id]),ht=Ze.useMemo(()=>{var Dt;return(Dt=h.closeButton)!=null?Dt:L},[h.closeButton,L]),wr=Ze.useMemo(()=>h.duration||U||IF,[h.duration,U]),pn=Ze.useRef(0),zt=Ze.useRef(0),Qt=Ze.useRef(0),Pn=Ze.useRef(null),[Nt,Zn]=te.split("-"),It=Ze.useMemo(()=>_.reduce((Dt,Wt,_n)=>_n>=Ut?Dt:Dt+Wt.height,0),[_,Ut]),qt=Woe(),lr=h.invert||f,rn=At==="loading";zt.current=Ze.useMemo(()=>Ut*ne+It,[Ut,It]),Ze.useEffect(()=>{ot.current=wr},[wr]),Ze.useEffect(()=>{Ce(!0)},[]),Ze.useEffect(()=>{let Dt=mt.current;if(Dt){let Wt=Dt.getBoundingClientRect().height;return St(Wt),g(_n=>[{toastId:h.id,height:Wt,position:h.position},..._n]),()=>g(_n=>_n.filter(Tr=>Tr.toastId!==h.id))}},[g,h.id]),Ze.useLayoutEffect(()=>{if(!me)return;let Dt=mt.current,Wt=Dt.style.height;Dt.style.height="auto";let _n=Dt.getBoundingClientRect().height;Dt.style.height=Wt,St(_n),g(Tr=>Tr.find(ct=>ct.toastId===h.id)?Tr.map(ct=>ct.toastId===h.id?{...ct,height:_n}:ct):[{toastId:h.id,height:_n,position:h.position},...Tr])},[me,h.title,h.description,g,h.id]);let Tt=Ze.useCallback(()=>{Ae(!0),xt(zt.current),g(Dt=>Dt.filter(Wt=>Wt.toastId!==h.id)),setTimeout(()=>{N(h)},sle)},[h,N,g,zt]);Ze.useEffect(()=>{if(h.promise&&At==="loading"||h.duration===1/0||h.type==="loading")return;let Dt;return T||m||z&&qt?(()=>{if(Qt.current<pn.current){let Wt=new Date().getTime()-pn.current;ot.current=ot.current-Wt}Qt.current=new Date().getTime()})():ot.current!==1/0&&(pn.current=new Date().getTime(),Dt=setTimeout(()=>{var Wt;(Wt=h.onAutoClose)==null||Wt.call(h,h),Tt()},ot.current)),()=>clearTimeout(Dt)},[T,m,h,At,z,qt,Tt]),Ze.useEffect(()=>{h.delete&&Tt()},[Tt,h.delete]);function Mn(){var Dt,Wt,_n;return se!=null&&se.loading?Ze.createElement("div",{className:xl(q==null?void 0:q.loader,(Dt=h==null?void 0:h.classNames)==null?void 0:Dt.loader,"sonner-loader"),"data-visible":At==="loading"},se.loading):le?Ze.createElement("div",{className:xl(q==null?void 0:q.loader,(Wt=h==null?void 0:h.classNames)==null?void 0:Wt.loader,"sonner-loader"),"data-visible":At==="loading"},le):Ze.createElement(Boe,{className:xl(q==null?void 0:q.loader,(_n=h==null?void 0:h.classNames)==null?void 0:_n.loader),visible:At==="loading"})}return Ze.createElement("li",{tabIndex:0,ref:mt,className:xl(j,ln,q==null?void 0:q.toast,(e=h==null?void 0:h.classNames)==null?void 0:e.toast,q==null?void 0:q.default,q==null?void 0:q[At],(n=h==null?void 0:h.classNames)==null?void 0:n[At]),"data-sonner-toast":"","data-rich-colors":(r=h.richColors)!=null?r:A,"data-styled":!(h.jsx||h.unstyled||p),"data-mounted":me,"data-promise":!!h.promise,"data-swiped":re,"data-removed":Ee,"data-visible":Kt,"data-y-position":Nt,"data-x-position":Zn,"data-index":b,"data-front":An,"data-swiping":De,"data-dismissible":Jt,"data-type":At,"data-invert":lr,"data-swipe-out":Re,"data-swipe-direction":de,"data-expanded":!!(T||V&&me),style:{"--index":b,"--toasts-before":b,"--z-index":x.length-b,"--offset":`${Ee?Mt:zt.current}px`,"--initial-height":V?"auto":`${Ue}px`,...M,...h.style},onDragEnd:()=>{Fe(!1),Y(null),Pn.current=null},onPointerDown:Dt=>
416{rn||!Jt||(Et.current=new Date,xt(zt.current),Dt.target.setPointerCapture(Dt.pointerId),Dt.target.tagName!=="BUTTON"&&(Fe(!0),Pn.current={x:Dt.clientX,y:Dt.clientY}))},onPointerUp:()=>{var Dt,Wt,_n,Tr;if(Re||!Jt)return;Pn.current=null;let ct=Number(((Dt=mt.current)==null?void 0:Dt.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),_i=Number(((Wt=mt.current)==null?void 0:Wt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Mi=new Date().getTime()-((_n=Et.current)==null?void 0:_n.getTime()),dr=J==="x"?ct:_i,Fr=Math.abs(dr)/Mi;if(Math.abs(dr)>=ile||Fr>.11){xt(zt.current),(Tr=h.onDismiss)==null||Tr.call(h,h),fe(J==="x"?ct>0?"right":"left":_i>0?"down":"up"),Tt(),Je(!0),Ye(!1);return}Fe(!1),Y(null)},onPointerMove:Dt=>{var Wt,_n,Tr,ct;if(!Pn.current||!Jt||((Wt=window.getSelection())==null?void 0:Wt.toString().length)>0)return;let _i=Dt.clientY-Pn.current.y,Mi=Dt.clientX-Pn.current.x,dr=(_n=t.swipeDirections)!=null?_n:ale(te);!J&&(Math.abs(Mi)>1||Math.abs(_i)>1)&&Y(Math.abs(Mi)>Math.abs(_i)?"x":"y");let Fr={x:0,y:0};J==="y"?(dr.includes("top")||dr.includes("bottom"))&&(dr.includes("top")&&_i<0||dr.includes("bottom")&&_i>0)&&(Fr.y=_i):J==="x"&&(dr.includes("left")||dr.includes("right"))&&(dr.includes("left")&&Mi<0||dr.includes("right")&&Mi>0)&&(Fr.x=Mi),(Math.abs(Fr.x)>0||Math.abs(Fr.y)>0)&&Ye(!0),(Tr=mt.current)==null||Tr.style.setProperty("--swipe-amount-x",`${Fr.x}px`),(ct=mt.current)==null||ct.style.setProperty("--swipe-amount-y",`${Fr.y}px`)}},ht&&!h.jsx?Ze.createElement("button",{"aria-label":he,"data-disabled":rn,"data-close-button":!0,onClick:rn||!Jt?()=>{}:()=>{var Dt;Tt(),(Dt=h.onDismiss)==null||Dt.call(h,h)},className:xl(q==null?void 0:q.closeButton,(i=h==null?void 0:h.classNames)==null?void 0:i.closeButton)},(s=se==null?void 0:se.close)!=null?s:qoe):null,h.jsx||I.isValidElement(h.title)?h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title:Ze.createElement(Ze.Fragment,null,At||h.icon||h.promise?Ze.createElement("div",{"data-icon":"",className:xl(q==null?void 0:q.icon,(a=h==null?void 0:h.classNames)==null?void 0:a.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||Mn():null,h.type!=="loading"?h.icon||(se==null?void 0:se[At])||Foe(At):null):null,Ze.createElement("div",{"data-content":"",className:xl(q==null?void 0:q.content,(o=h==null?void 0:h.classNames)==null?void 0:o.content)},Ze.createElement("div",{"data-title":"",className:xl(q==null?void 0:q.title,(l=h==null?void 0:h.classNames)==null?void 0:l.title)},typeof h.title=="function"?h.title():h.title),h.description?Ze.createElement("div",{"data-description":"",className:xl($,nt,q==null?void 0:q.description,(c=h==null?void 0:h.classNames)==null?void 0:c.description)},typeof h.description=="function"?h.description():h.description):null),I.isValidElement(h.cancel)?h.cancel:h.cancel&&Lb(h.cancel)?Ze.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||B,onClick:Dt=>{var Wt,_n;Lb(h.cancel)&&Jt&&((_n=(Wt=h.cancel).onClick)==null||_n.call(Wt,Dt),Tt())},className:xl(q==null?void 0:q.cancelButton,(u=h==null?void 0:h.classNames)==null?void 0:u.cancelButton)},h.cancel.label):null,I.isValidElement(h.action)?h.action:h.action&&Lb(h.action)?Ze.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||R,onClick:Dt=>{var Wt,_n;Lb(h.action)&&((_n=(Wt=h.action).onClick)==null||_n.call(Wt,Dt),!Dt.defaultPrevented&&Tt())},className:xl(q==null?void 0:q.actionButton,(d=h==null?void 0:h.classNames)==null?void 0:d.actionButton)},h.action.label):null))};function LF(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function lle(t,e){let n={};return[t,e].forEach((r,i)=>{let s=i===1,a=s?"--mobile-offset":"--offset",o=s?tle:ele;function l(c){["top","right","bottom","left"].forEach(u=>{n[`${a}-${u}`]=typeof c=="number"?`${c}px`:c})}typeof r=="number"||typeof r=="string"?l(r):typeof r=="object"?["top","right","bottom","left"].forEach(c=>{r[c]===void 0?n[`${a}-${c}`]=o:n[`${a}-${c}`]=typeof r[c]=="number"?`${r[c]}px`:r[c]}):l(o)}),n}var cle=I.forwardRef(function(t,e){let{invert:n,position:r="bottom-right",hotkey:i=["altKey","KeyT"],expand:s,closeButton:a,className:o,offset:l,mobileOffset:c,theme:u="light",richColors:d,duration:f,style:h,visibleToasts:p=Zoe,toastOptions:m,dir:g=LF(),gap:v=rle,loadingIcon:_,icons:b,containerAriaLabel:x="Notifications",pauseWhenPageIsHidden:T}=t,[N,A]=Ze.useState([]),L=Ze.useMemo(()=>Array.from(new Set([r].concat(N.filter(z=>z.position).map(z=>z.position)))),[N,r]),[M,B]=Ze.useState([]),[R,j]=Ze.useState(!1),[$,U]=Ze.useState(!1),[te,ne]=Ze.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dar
416k":"light"),le=Ze.useRef(null),V=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),q=Ze.useRef(null),se=Ze.useRef(!1),he=Ze.useCallback(z=>{A(J=>{var Y;return(Y=J.find(de=>de.id===z.id))!=null&&Y.delete||Ba.dismiss(z.id),J.filter(({id:de})=>de!==z.id)})},[]);return Ze.useEffect(()=>Ba.subscribe(z=>{if(z.dismiss){A(J=>J.map(Y=>Y.id===z.id?{...Y,delete:!0}:Y));return}setTimeout(()=>{hV.flushSync(()=>{A(J=>{let Y=J.findIndex(de=>de.id===z.id);return Y!==-1?[...J.slice(0,Y),{...J[Y],...z},...J.slice(Y+1)]:[z,...J]})})})}),[]),Ze.useEffect(()=>{if(u!=="system"){ne(u);return}if(u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?ne("dark"):ne("light")),typeof window>"u")return;let z=window.matchMedia("(prefers-color-scheme: dark)");try{z.addEventListener("change",({matches:J})=>{ne(J?"dark":"light")})}catch{z.addListener(({matches:Y})=>{try{ne(Y?"dark":"light")}catch(de){console.error(de)}})}},[u]),Ze.useEffect(()=>{N.length<=1&&j(!1)},[N]),Ze.useEffect(()=>{let z=J=>{var Y,de;i.every(fe=>J[fe]||J.code===fe)&&(j(!0),(Y=le.current)==null||Y.focus()),J.code==="Escape"&&(document.activeElement===le.current||(de=le.current)!=null&&de.contains(document.activeElement))&&j(!1)};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[i]),Ze.useEffect(()=>{if(le.current)return()=>{q.current&&(q.current.focus({preventScroll:!0}),q.current=null,se.current=!1)}},[le.current]),Ze.createElement("section",{ref:e,"aria-label":`${x} ${V}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},L.map((z,J)=>{var Y;let[de,fe]=z.split("-");return N.length?Ze.createElement("ol",{key:z,dir:g==="auto"?LF():g,tabIndex:-1,ref:le,className:o,"data-sonner-toaster":!0,"data-theme":te,"data-y-position":de,"data-lifted":R&&N.length>1&&!s,"data-x-position":fe,style:{"--front-toast-height":`${((Y=M[0])==null?void 0:Y.height)||0}px`,"--width":`${nle}px`,"--gap":`${v}px`,...h,...lle(l,c)},onBlur:me=>{se.current&&!me.currentTarget.contains(me.relatedTarget)&&(se.current=!1,q.current&&(q.current.focus({preventScroll:!0}),q.current=null))},onFocus:me=>{me.target instanceof HTMLElement&&me.target.dataset.dismissible==="false"||se.current||(se.current=!0,q.current=me.relatedTarget)},onMouseEnter:()=>j(!0),onMouseMove:()=>j(!0),onMouseLeave:()=>{$||j(!1)},onDragEnd:()=>j(!1),onPointerDown:me=>{me.target instanceof HTMLElement&&me.target.dataset.dismissible==="false"||U(!0)},onPointerUp:()=>U(!1)},N.filter(me=>!me.position&&J===0||me.position===z).map((me,Ce)=>{var Ee,Ae;
vendor: 4,497 bytes, line 416
416return Ze.createElement(ole,{key:me.id,icons:b,index:Ce,toast:me,defaultRichColors:d,duration:(Ee=m==null?void 0:m.duration)!=null?Ee:f,className:m==null?void 0:m.className,descriptionClassName:m==null?void 0:m.descriptionClassName,invert:n,visibleToasts:p,closeButton:(Ae=m==null?void 0:m.closeButton)!=null?Ae:a,interacting:$,position:z,style:m==null?void 0:m.style,unstyled:m==null?void 0:m.unstyled,classNames:m==null?void 0:m.classNames,cancelButtonStyle:m==null?void 0:m.cancelButtonStyle,actionButtonStyle:m==null?void 0:m.actionButtonStyle,removeToast:he,toasts:N.filter(De=>De.position==me.position),heights:M.filter(De=>De.position==me.position),setHeights:B,expandByDefault:s,gap:v,loadingIcon:_,expanded:R,pauseWhenPageIsHidden:T,swipeDirections:t.swipeDirections})})):null}))});const ule=({...t})=>{const{theme:e="system"}=Doe();return w.jsx(cle,{theme:e,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...t})};var dle=m3[" useId ".trim().toString()]||(()=>{}),hle=0;function ix(t){const[e,n]=I.useState(dle());return fd(()=>{n(r=>r??String(hle++))},[t]),e?`radix-${e}`:""}const fle=["top","right","bottom","left"],Kh=Math.min,go=Math.max,wk=Math.round,Ob=Math.floor,Jh=t=>({x:t,y:t}),ple={left:"right",right:"left",bottom:"top",top:"bottom"},mle={start:"end",end:"start"};function JP(t,e,n){return go(t,Kh(e,n))}function pd(t,e){return typeof t=="function"?t(e):t}function md(t){return t.split("-")[0]}function t0(t){return t.split("-")[1]}function _R(t){return t==="x"?"y":"x"}function wR(t){return t==="y"?"height":"width"}function Yh(t){return["top","bottom"].includes(md(t))?"y":"x"}function bR(t){return _R(Yh(t))}function gle(t,e,n){n===void 0&&(n=!1);const r=t0(t),i=bR(t),s=wR(i);let a=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(a=bk(a)),[a,bk(a)]}function vle(t){const e=bk(t);return[YP(t),e,YP(e)]}function YP(t){return t.replace(/start|end/g,e=>mle[e])}function yle(t,e,n){const r=["left","right"],i=["right","left"],s=["top","bottom"],a=["bottom","top"];switch(t){case"top":case"bottom":return n?e?i:r:e?r:i;case"left":case"right":return e?s:a;default:return[]}}function _le(t,e,n,r){const i=t0(t);let s=yle(md(t),n==="start",r);return i&&(s=s.map(a=>a+"-"+i),e&&(s=s.concat(s.map(YP)))),s}function bk(t){return t.replace(/left|right|bottom|top/g,e=>ple[e])}function wle(t){return{top:0,right:0,bottom:0,left:0,...t}}function dq(t){return typeof t!="number"?wle(t):{top:t,right:t,bottom:t,left:t}}function xk(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function OF(t,e,n){let{reference:r,floating:i}=t;const s=Yh(e),a=bR(e),o=wR(a),l=md(e),c=s==="y",u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[o]/2-i[o]/2;let h;switch(l){case"top":h={x:u,y:r.y-i.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-i.width,y:d};break;default:h={x:r.x,y:r.y}}switch(t0(e)){case"start":h[a]-=f*(n&&c?-1:1);break;case"end":h[a]+=f*(n&&c?-1:1);break}return h}const ble=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:a}=n,o=s.filter(Boolean),l=await(a.isRTL==null?void 0:a.isRTL(e));let c=await a.getElementRects({reference:t,floating:e,strategy:i}),{x:u,y:d}=OF(c,r,l),f=r,h={},p=0;for(let m=0;m<o.length;m++){const{name:g,fn:v}=o[m],{x:_,y:b,data:x,reset:T}=await v({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:h,rects:c,platform:a,elements:{reference:t,floating:e}});u=_??u,d=b??d,h={...h,[g]:{...h[g],...x}},T&&p<=50&&(p++,typeof T=="object"&&(T.placement&&(f=T.placement),T.rects&&(c=T.rects===!0?await a.getElementRects({reference:t,floating:e,strategy:i}):T.rects),{x:u,y:d}=OF(c,f,l)),m=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:h}};async function ow(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:a,elements:o,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=pd(e,t),p=dq(h),g=o[f?d==="floating"?"reference":"floating":d],v=xk(await s.getClippingRect
vendor: 9,502 bytes, line 416
416({element:(n=await(s.isElement==null?void 0:s.isElement(g)))==null||n?g:g.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(o.floating)),boundary:c,rootBoundary:u,strategy:l})),_=d==="floating"?{x:r,y:i,width:a.floating.width,height:a.floating.height}:a.reference,b=await(s.getOffsetParent==null?void 0:s.getOffsetParent(o.floating)),x=await(s.isElement==null?void 0:s.isElement(b))?await(s.getScale==null?void 0:s.getScale(b))||{x:1,y:1}:{x:1,y:1},T=xk(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:_,offsetParent:b,strategy:l}):_);return{top:(v.top-T.top+p.top)/x.y,bottom:(T.bottom-v.bottom+p.bottom)/x.y,left:(v.left-T.left+p.left)/x.x,right:(T.right-v.right+p.right)/x.x}}const xle=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:s,platform:a,elements:o,middlewareData:l}=e,{element:c,padding:u=0}=pd(t,e)||{};if(c==null)return{};const d=dq(u),f={x:n,y:r},h=bR(i),p=wR(h),m=await a.getDimensions(c),g=h==="y",v=g?"top":"left",_=g?"bottom":"right",b=g?"clientHeight":"clientWidth",x=s.reference[p]+s.reference[h]-f[h]-s.floating[p],T=f[h]-s.reference[h],N=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c));let A=N?N[b]:0;(!A||!await(a.isElement==null?void 0:a.isElement(N)))&&(A=o.floating[b]||s.floating[p]);const L=x/2-T/2,M=A/2-m[p]/2-1,B=Kh(d[v],M),R=Kh(d[_],M),j=B,$=A-m[p]-R,U=A/2-m[p]/2+L,te=JP(j,U,$),ne=!l.arrow&&t0(i)!=null&&U!==te&&s.reference[p]/2-(U<j?B:R)-m[p]/2<0,le=ne?U<j?U-j:U-$:0;return{[h]:f[h]+le,data:{[h]:te,centerOffset:U-te-le,...ne&&{alignmentOffset:le}},reset:ne}}}),kle=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:s,rects:a,initialPlacement:o,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...g}=pd(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const v=md(i),_=Yh(o),b=md(o)===o,x=await(l.isRTL==null?void 0:l.isRTL(c.floating)),T=f||(b||!m?[bk(o)]:vle(o)),N=p!=="none";!f&&N&&T.push(..._le(o,m,p,x));const A=[o,...T],L=await ow(e,g),M=[];let B=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&M.push(L[v]),d){const U=gle(i,a,x);M.push(L[U[0]],L[U[1]])}if(B=[...B,{placement:i,overflows:M}],!M.every(U=>U<=0)){var R,j;const U=(((R=s.flip)==null?void 0:R.index)||0)+1,te=A[U];if(te)return{data:{index:U,overflows:B},reset:{placement:te}};let ne=(j=B.filter(le=>le.overflows[0]<=0).sort((le,V)=>le.overflows[1]-V.overflows[1])[0])==null?void 0:j.placement;if(!ne)switch(h){case"bestFit":{var $;const le=($=B.filter(V=>{if(N){const q=Yh(V.placement);return q===_||q==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(q=>q>0).reduce((q,se)=>q+se,0)]).sort((V,q)=>V[1]-q[1])[0])==null?void 0:$[0];le&&(ne=le);break}case"initialPlacement":ne=o;break}if(i!==ne)return{reset:{placement:ne}}}return{}}}};function DF(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function FF(t){return fle.some(e=>t[e]>=0)}const Sle=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...i}=pd(t,e);switch(r){case"referenceHidden":{const s=await ow(e,{...i,elementContext:"reference"}),a=DF(s,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:FF(a)}}}case"escaped":{const s=await ow(e,{...i,altBoundary:!0}),a=DF(s,n.floating);return{data:{escapedOffsets:a,escaped:FF(a)}}}default:return{}}}}};async function Tle(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),a=md(n),o=t0(n),l=Yh(n)==="y",c=["left","top"].includes(a)?-1:1,u=s&&l?-1:1,d=pd(e,t);let{mainAxis:f,crossAxis:h,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return o&&typeof p=="number"&&(h=o==="end"?p*-1:p),l?{x:h*u,y:f*c}:{x:f*c,y:h*u}}const Cle=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:s,placement:a,middlewareData:o}=e,l=await Tle(e,t);return a===((n=o.offset)==null?void 0:n.placement)&&(r=o.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:a}}}}},Ele=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i}=e,{mainAxis:s=!0,crossAxis:a=!1,limiter:o={fn:g=>{let{x:v,y:_}=g;return{x:v,y:_}}},...l}=pd(t,e),c={x:n,y:r},u=await ow(e,l),d=Yh(md(i)),f=_R(d);let h=c[f],p=c[d];if(s){const g=f==="y"?"top":"left",v=f==="y"?"bottom":"right",_=h+u[g],b=h-u[v];h=JP(_,h,b)}if(a){const g=d==="y"?"top":"left",v=d==="y"?"bottom":"right",_=p+u[g],b=p-u[v];p=JP(_,p,b)}const m=o.fn({...e,[f]:h,[d]:p});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[f]:s,[d]:a}}}}}},Ale=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:s,middlewareData:a}=e,{offset:o=0,mainAxis:l=!0,crossAxis:c=!0}=pd(t,e),u={x:n,y:r},d=Yh(i),f=_R(d);let h=u[f],p=u[d];const m=pd(o,e),g=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const b=f==="y"?"height":"width",x=s.reference[f]-s.floating[b]+g.mainAxis,T=s.reference[f]+s.reference[b]-g.mainAxis;h<x?h=x:h>T&&(h=T)}if(c){var v,_;const b=f==="y"?"width":"height",x=["top","left"].includes(md(i)),T=s.reference[d]-s.floating[b]+(x&&((v=a.offset)==null?void 0:v[d])||0)+(x?0:g.crossAxis),N=s.reference[d]+s.reference[b]+(x?0:((_=a.offset)==null?void 0:_[d])||0)-(x?g.crossAxis:0);p<T?p=T:p>N&&(p=N)}return{[f]:h,[d]:p}}}},Ple=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:s,platform:a,elements:o}=e,{apply:l=()=>{},...c}=pd(t,e),u=await ow(e,c),d=md(i),f=t0(i),h=Yh(i)==="y",{width:p,height:m}=s.floating;let g,v;d==="top"||d==="bottom"?(g=d,v=f===(await(a.isRTL==null?void 0:a.isRTL(o.floating))?"start":"end")?"left":"right"):(v=d,g=f==="end"?"top":"bottom");const _=m-u.top-u.bottom,b=p-u.left-u.right,x=Kh(m-u[g],_),T=Kh(p-u[v],b),N=!e.middlewareData.shift;let A=x,L=T;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(L=b),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(A=_),N&&!f){const B=go(u.left,0),R=go(u.right,0),j=go(u.top,0),$=go(u.bottom,0);h?L=p-2*(B!==0||R!==0?B+R:go(u.left,u.right)):A=m-2*(j!==0||$!==0?j+$:go(u.top,u.bottom))}await l({...e,availableWidth:L,availableHeight:A});const M=await a.getDimensions(o.floating);return p!==M.width||m!==M.height?{reset:{rects:!0}}:{}}}};function JS(){return typeof window<"u"}function n0(t){return hq(t)?(t.nodeName||"").toLowerCase():"#document"}function Co(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function ou(t){var e;return(e=(hq(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function hq(t){return JS()?t instanceof Node||t instanceof Co(t).Node:!1}function ic(t){return JS()?t instanceof Element||t instanceof Co(t).Element:!1}function nu(t){return JS()?t instanceof HTMLElement||t instanceof Co(t).HTMLElement:!1}function jF(t){return!JS()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Co(t).ShadowRoot}function l1(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=sc(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(i)}function Mle(t){return["table","td","th"].includes(n0(t))}function YS(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function xR(t){const e=kR(),n=ic(t)?sc(t):t;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function Nle(t){let e=Xh(t);for(;nu(e)&&!Rv(e);){if(xR(e))return e;if(YS(e))return null;e=Xh(e)}return null}function kR(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Rv(t){return["html","body","#document"].includes(n0(t))}function sc(t){return Co(t).getComputedStyle(t)}function XS(t){return ic(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Xh(t){if(n0(t)==="html")return t;const e=t.assignedSlot||t.parentNode||jF(t)&&t.host||ou(t);return jF(e)?e.host:e}function fq(t){const e=Xh(t);return Rv(e)?t.ownerDocument?t.ownerDocument.body:t.body:nu(e)&&l1(e)?e:fq(e)}function lw(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=fq(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),a=Co(i);if(s){const o=XP(a);return e.concat(a,a.visualViewport||[],l1(i)?i:[],o&&n?lw(o):[])}return e.concat(i,lw(i,[],n))}function XP(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function pq(t){const e=sc(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=nu(t),s=i?t.offsetWidth:n,a=i?t.offsetHeight:r,o=wk(n)!==s||wk(r)!==a;return o&&(n=s,r=a),{width:n,height:r,$:o}}function SR(t){return ic(t)?t:t.contextElement}function Yg(t){const e=SR(t);if(!nu(e))return Jh(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=pq(e);let a=(s?wk(n.width):n.width)/r,o=(s?wk(n.height):n.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!o||!Number.isFinite(o))&&(o=1),{x:a,y:o}}const Rle=Jh(0);function mq(t){const e=Co(t);
vendor: 6,438 bytes, line 416
416return!kR()||!e.visualViewport?Rle:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Ile(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Co(t)?!1:e}function Up(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=SR(t);let a=Jh(1);e&&(r?ic(r)&&(a=Yg(r)):a=Yg(t));const o=Ile(s,n,r)?mq(s):Jh(0);let l=(i.left+o.x)/a.x,c=(i.top+o.y)/a.y,u=i.width/a.x,d=i.height/a.y;if(s){const f=Co(s),h=r&&ic(r)?Co(r):r;let p=f,m=XP(p);for(;m&&r&&h!==p;){const g=Yg(m),v=m.getBoundingClientRect(),_=sc(m),b=v.left+(m.clientLeft+parseFloat(_.paddingLeft))*g.x,x=v.top+(m.clientTop+parseFloat(_.paddingTop))*g.y;l*=g.x,c*=g.y,u*=g.x,d*=g.y,l+=b,c+=x,p=Co(m),m=XP(p)}}return xk({width:u,height:d,x:l,y:c})}function Lle(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",a=ou(r),o=e?YS(e.floating):!1;if(r===a||o&&s)return n;let l={scrollLeft:0,scrollTop:0},c=Jh(1);const u=Jh(0),d=nu(r);if((d||!d&&!s)&&((n0(r)!=="body"||l1(a))&&(l=XS(r)),nu(r))){const f=Up(r);c=Yg(r),u.x=f.x+r.clientLeft,u.y=f.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x,y:n.y*c.y-l.scrollTop*c.y+u.y}}function Ole(t){return Array.from(t.getClientRects())}function QP(t,e){const n=XS(t).scrollLeft;return e?e.left+n:Up(ou(t)).left+n}function Dle(t){const e=ou(t),n=XS(t),r=t.ownerDocument.body,i=go(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=go(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+QP(t);const o=-n.scrollTop;return sc(r).direction==="rtl"&&(a+=go(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:a,y:o}}function Fle(t,e){const n=Co(t),r=ou(t),i=n.visualViewport;let s=r.clientWidth,a=r.clientHeight,o=0,l=0;if(i){s=i.width,a=i.height;const c=kR();(!c||c&&e==="fixed")&&(o=i.offsetLeft,l=i.offsetTop)}return{width:s,height:a,x:o,y:l}}function jle(t,e){const n=Up(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=nu(t)?Yg(t):Jh(1),a=t.clientWidth*s.x,o=t.clientHeight*s.y,l=i*s.x,c=r*s.y;return{width:a,height:o,x:l,y:c}}function BF(t,e,n){let r;if(e==="viewport")r=Fle(t,n);else if(e==="document")r=Dle(ou(t));else if(ic(e))r=jle(e,n);else{const i=mq(t);r={...e,x:e.x-i.x,y:e.y-i.y}}return xk(r)}function gq(t,e){const n=Xh(t);return n===e||!ic(n)||Rv(n)?!1:sc(n).position==="fixed"||gq(n,e)}function Ble(t,e){const n=e.get(t);if(n)return n;let r=lw(t,[],!1).filter(o=>ic(o)&&n0(o)!=="body"),i=null;const s=sc(t).position==="fixed";let a=s?Xh(t):t;for(;ic(a)&&!Rv(a);){const o=sc(a),l=xR(a);!l&&o.position==="fixed"&&(i=null),(s?!l&&!i:!l&&o.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||l1(a)&&!l&&gq(t,a))?r=r.filter(u=>u!==a):i=o,a=Xh(a)}return e.set(t,r),r}function Ule(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const a=[...n==="clippingAncestors"?YS(e)?[]:Ble(e,this._c):[].concat(n),r],o=a[0],l=a.reduce((c,u)=>{const d=BF(e,u,i);return c.top=go(d.top,c.top),c.right=Kh(d.right,c.right),c.bottom=Kh(d.bottom,c.bottom),c.left=go(d.left,c.left),c},BF(e,o,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function zle(t){const{width:e,height:n}=pq(t);return{width:e,height:n}}function $le(t,e,n){const r=nu(e),i=ou(e),s=n==="fixed",a=Up(t,!0,s,e);let o={scrollLeft:0,scrollTop:0};const l=Jh(0);if(r||!r&&!s)if((n0(e)!=="body"||l1(i))&&(o=XS(e)),r){const h=Up(e,!0,s,e);l.x=h.x+e.clientLeft,l.y=h.y+e.clientTop}else i&&(l.x=QP(i));let c=0,u=0;if(i&&!r&&!s){const h=i.getBoundingClientRect();u=h.top+o.scrollTop,c=h.left+o.scrollLeft-QP(i,h)}const d=a.left+o.scrollLeft-l.x-c,f=a.top+o.scrollTop-l.y-u;return{x:d,y:f,width:a.width,height:a.height}}function QC(t){return sc(t).position==="static"}function UF(t,e){if(!nu(t)||sc(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return ou(t)===n&&(n=n.ownerDocument.body),n}function vq(t,e){const n=Co(t);if(YS(t))return n;if(!nu(t)){let i=Xh(t);for(;i&&!Rv(i);){if(ic(i)&&!QC(i))return i;i=Xh(i)}return n}let r=UF(t,e);for(;r&&Mle(r)&&QC(r);)r=UF(r,e);return r&&Rv(r)&&QC(r)&&!xR(r)?n:r||Nle(t)||n}const Vle=async function(t){const e=this.getOffsetParent||vq,n=this.getDimensions,r=await n(t.floating);return{reference:$le(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function qle(t){return sc(t).direction==="rtl"}const Wle={convertOffsetParentRelativeRectToViewportRelativeRect:Lle,getDocumentElement:ou,getClippingRect:Ule,getOffsetParent:vq,getElementRects:Vle,getClientRects:Ole,getDimensions:zle,getScale:Yg,isElement:ic,isRTL:qle};function Gle(t,e){let n=null,r;const i=ou(t);function s(){var o;clearTimeout(r),(o=n)==null||o.disconnect(),n=null}function a(o,l){o===void 0&&(o=!1),l===void 0&&(l=1),s();const{left:c,top:u,width:d,height:f}=t.getBoundingClientRect();if(o||e(),!d||!f)return;const h=Ob(u),p=Ob(i.clientWidth-(c+d)),m=Ob(i.clientHeight-(u+f)),g=Ob(c),_={rootMargin:-h+"px "+-p+"px "+-m+"px "+-g+"px",threshold:go(0,Kh(1,l))||1};let b=!0;function x(T){const N=T[0].intersectionRatio;if(N!==l){if(!b)return a();N?a(!1,N):r=setTimeout(()=>{a(!1,1e-7)},1e3)}b=!1}try{n=new IntersectionObserver(x,{..._,root:i.ownerDocument})}catch{n=new IntersectionObserver(x,_)}n.observe(t)}return a(!0),s}function Hle(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=SR(t),u=i||s?[...c?lw(c):[],...lw(e)]:[];u.forEach(v=>{i&&v.addEventListener("scroll",n,{passive:!0}),s&&v.addEventListener("resize",n)});const d=c&&o?Gle(c,n):null;let f=-1,h=null;a&&(h=new ResizeObserver(v=>{let[_]=v;_&&_.target===c&&h&&(h.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var b;(b=h)==null||b.observe(e)})),n()}),c&&!l&&h.observe(c),h.observe(e));let p,m=l?Up(t):null;l&&g();function g(){const v=Up(t);m&&(v.x!==m.x||v.y!==m.y||v.width!==m.width||v.height!==m.height)&&n(),m=v,p=requestAnimationFrame(g)}return n(),()=>{var v;u.forEach(_=>{i&&_.removeEventListener("scroll",n),s&&_.removeEventListener("resize",n)}),d==null||d(),(v=h)==null||v.disconnect(),h=null,l&&cancelAnimationFrame(p)}}const Kle=Cle,Jle=Ele,Yle=kle,Xle=Ple,Qle=Sle,zF=xle,Zle=Ale,ece=(t,e,n)=>{const r=new Map,i={platform:Wle,...n},s={...i.platform,_c:r};return ble(t,e,{...i,platform:s})};var sx=typeof document<"u"?I.useLayoutEffect:I.useEffect;function kk(t,e){if(t===e)return!0;
vendor: 4,331 bytes, line 416
416if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!kk(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&t.$$typeof)&&!kk(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function yq(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function $F(t,e){const n=yq(t);return Math.round(e*n)/n}function ZC(t){const e=I.useRef(t);return sx(()=>{e.current=t}),e}function tce(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:a}={},transform:o=!0,whileElementsMounted:l,open:c}=t,[u,d]=I.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[f,h]=I.useState(r);kk(f,r)||h(r);const[p,m]=I.useState(null),[g,v]=I.useState(null),_=I.useCallback(V=>{V!==N.current&&(N.current=V,m(V))},[]),b=I.useCallback(V=>{V!==A.current&&(A.current=V,v(V))},[]),x=s||p,T=a||g,N=I.useRef(null),A=I.useRef(null),L=I.useRef(u),M=l!=null,B=ZC(l),R=ZC(i),j=ZC(c),$=I.useCallback(()=>{if(!N.current||!A.current)return;const V={placement:e,strategy:n,middleware:f};R.current&&(V.platform=R.current),ece(N.current,A.current,V).then(q=>{const se={...q,isPositioned:j.current!==!1};U.current&&!kk(L.current,se)&&(L.current=se,r1.flushSync(()=>{d(se)}))})},[f,e,n,R,j]);sx(()=>{c===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,d(V=>({...V,isPositioned:!1})))},[c]);const U=I.useRef(!1);sx(()=>(U.current=!0,()=>{U.current=!1}),[]),sx(()=>{if(x&&(N.current=x),T&&(A.current=T),x&&T){if(B.current)return B.current(x,T,$);$()}},[x,T,$,B,M]);const te=I.useMemo(()=>({reference:N,floating:A,setReference:_,setFloating:b}),[_,b]),ne=I.useMemo(()=>({reference:x,floating:T}),[x,T]),le=I.useMemo(()=>{const V={position:n,left:0,top:0};if(!ne.floating)return V;const q=$F(ne.floating,u.x),se=$F(ne.floating,u.y);return o?{...V,transform:"translate("+q+"px, "+se+"px)",...yq(ne.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:q,top:se}},[n,o,ne.floating,u.x,u.y]);return I.useMemo(()=>({...u,update:$,refs:te,elements:ne,floatingStyles:le}),[u,$,te,ne,le])}const nce=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:i}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?zF({element:r.current,padding:i}).fn(n):{}:r?zF({element:r,padding:i}).fn(n):{}}}},rce=(t,e)=>({...Kle(t),options:[t,e]}),ice=(t,e)=>({...Jle(t),options:[t,e]}),sce=(t,e)=>({...Zle(t),options:[t,e]}),ace=(t,e)=>({...Yle(t),options:[t,e]}),oce=(t,e)=>({...Xle(t),options:[t,e]}),lce=(t,e)=>({...Qle(t),options:[t,e]}),cce=(t,e)=>({...nce(t),options:[t,e]});var uce="Arrow",_q=I.forwardRef((t,e)=>{const{children:n,width:r=10,height:i=5,...s}=t;return w.jsx(Jn.svg,{...s,ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:w.jsx("polygon",{points:"0,0 30,0 15,10"})})});_q.displayName=uce;var dce=_q;function TR(t){const[e,n]=I.useState(void 0);return fd(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let a,o;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;a=c.inlineSize,o=c.blockSize}else a=t.offsetWidth,o=t.offsetHeight;n({width:a,height:o})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var CR="Popper",[wq,bq]=lf(CR),[hce,xq]=wq(CR),kq=t=>{const{__scopePopper:e,children:n}=t,[r,i]=I.useState(null);return w.jsx(hce,{scope:e,anchor:r,onAnchorChange:i,children:n})};kq.displayName=CR;var Sq="PopperAnchor",Tq=I.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,s=xq(Sq,n),a=I.useRef(null),o=ri(e,a);return I.useEffect(()=>{s.onAnchorChange((r==null?void 0:r.current)||a.current)}),r?null:w.jsx(Jn.div,{...i,ref:o})});Tq.displayName=Sq;var ER="PopperContent",[fce,pce]=wq(ER),Cq=I.forwardRef((t,e)=>{var me,Ce,Ee,Ae,De,Fe;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:a=0,arrowPadding:o=0,avoidCollisions:l
vendor: 4,215 bytes, line 416
416=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:h="optimized",onPlaced:p,...m}=t,g=xq(ER,n),[v,_]=I.useState(null),b=ri(e,Re=>_(Re)),[x,T]=I.useState(null),N=TR(x),A=(N==null?void 0:N.width)??0,L=(N==null?void 0:N.height)??0,M=r+(s!=="center"?"-"+s:""),B=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},R=Array.isArray(c)?c:[c],j=R.length>0,$={padding:B,boundary:R.filter(gce),altBoundary:j},{refs:U,floatingStyles:te,placement:ne,isPositioned:le,middlewareData:V}=tce({strategy:"fixed",placement:M,whileElementsMounted:(...Re)=>Hle(...Re,{animationFrame:h==="always"}),elements:{reference:g.anchor},middleware:[rce({mainAxis:i+L,alignmentAxis:a}),l&&ice({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?sce():void 0,...$}),l&&ace({...$}),oce({...$,apply:({elements:Re,rects:Je,availableWidth:re,availableHeight:Ye})=>{const{width:Mt,height:xt}=Je.reference,Ue=Re.floating.style;Ue.setProperty("--radix-popper-available-width",`${re}px`),Ue.setProperty("--radix-popper-available-height",`${Ye}px`),Ue.setProperty("--radix-popper-anchor-width",`${Mt}px`),Ue.setProperty("--radix-popper-anchor-height",`${xt}px`)}}),x&&cce({element:x,padding:o}),vce({arrowWidth:A,arrowHeight:L}),f&&lce({strategy:"referenceHidden",...$})]}),[q,se]=Pq(ne),he=tu(p);fd(()=>{le&&(he==null||he())},[le,he]);const z=(me=V.arrow)==null?void 0:me.x,J=(Ce=V.arrow)==null?void 0:Ce.y,Y=((Ee=V.arrow)==null?void 0:Ee.centerOffset)!==0,[de,fe]=I.useState();return fd(()=>{v&&fe(window.getComputedStyle(v).zIndex)},[v]),w.jsx("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...te,transform:le?te.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:de,"--radix-popper-transform-origin":[(Ae=V.transformOrigin)==null?void 0:Ae.x,(De=V.transformOrigin)==null?void 0:De.y].join(" "),...((Fe=V.hide)==null?void 0:Fe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:w.jsx(fce,{scope:n,placedSide:q,onArrowChange:T,arrowX:z,arrowY:J,shouldHideArrow:Y,children:w.jsx(Jn.div,{"data-side":q,"data-align":se,...m,ref:b,style:{...m.style,animation:le?void 0:"none"}})})})});Cq.displayName=ER;var Eq="PopperArrow",mce={top:"bottom",right:"left",bottom:"top",left:"right"},Aq=I.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,s=pce(Eq,r),a=mce[s.placedSide];return w.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:w.jsx(dce,{...i,ref:n,style:{...i.style,display:"block"}})})});Aq.displayName=Eq;function gce(t){return t!==null}var vce=t=>({name:"transformOrigin",options:t,fn(e){var g,v,_;const{placement:n,rects:r,middlewareData:i}=e,a=((g=i.arrow)==null?void 0:g.centerOffset)!==0,o=a?0:t.arrowWidth,l=a?0:t.arrowHeight,[c,u]=Pq(n),d={start:"0%",center:"50%",end:"100%"}[u],f=(((v=i.arrow)==null?void 0:v.x)??0)+o/2,h=(((_=i.arrow)==null?void 0:_.y)??0)+l/2;let p="",m="";return c==="bottom"?(p=a?d:`${f}px`,m=`${-l}px`):c==="top"?(p=a?d:`${f}px`,m=`${r.floating.height+l}px`):c==="right"?(p=`${-l}px`,m=a?d:`${h}px`):c==="left"&&(p=`${r.floating.width+l}px`,m=a?d:`${h}px`),{data:{x:p,y:m}}}});function Pq(t){const[e,n="center"]=t.split("-");return[e,n]}var yce=kq,_ce=Tq,wce=Cq,bce=Aq,[QS,a7e]=lf("Tooltip",[bq]),ZS=bq(),Mq="TooltipProvider",xce=700,ZP="tooltip.open",[kce,AR]=QS(Mq),Nq=t=>{const{__scopeTooltip:e,delayDuration:n=xce,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=t,a=I.useRef(!0),o=I.useRef(!1),l=I.useRef(0);return I.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),w.jsx(kce,{scope:e,isOpenDelayedRef:a,delayDuration:n,onOpen:I.useCallback(()=>{window.clearTimeout(l.current),a.current=!1},[]),onClose:I.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:o,onPointerInTransitChange:I.useCallback(c=>{o.current=c}
vendor: 6,676 bytes, line 416
416,[]),disableHoverableContent:i,children:s})};Nq.displayName=Mq;var cw="Tooltip",[Sce,eT]=QS(cw),Rq=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:a,delayDuration:o}=t,l=AR(cw,t.__scopeTooltip),c=ZS(e),[u,d]=I.useState(null),f=ix(),h=I.useRef(0),p=a??l.disableHoverableContent,m=o??l.delayDuration,g=I.useRef(!1),[v,_]=i1({prop:r,defaultProp:i??!1,onChange:A=>{A?(l.onOpen(),document.dispatchEvent(new CustomEvent(ZP))):l.onClose(),s==null||s(A)},caller:cw}),b=I.useMemo(()=>v?g.current?"delayed-open":"instant-open":"closed",[v]),x=I.useCallback(()=>{window.clearTimeout(h.current),h.current=0,g.current=!1,_(!0)},[_]),T=I.useCallback(()=>{window.clearTimeout(h.current),h.current=0,_(!1)},[_]),N=I.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{g.current=!0,_(!0),h.current=0},m)},[m,_]);return I.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),w.jsx(yce,{...c,children:w.jsx(Sce,{scope:e,contentId:f,open:v,stateAttribute:b,trigger:u,onTriggerChange:d,onTriggerEnter:I.useCallback(()=>{l.isOpenDelayedRef.current?N():x()},[l.isOpenDelayedRef,N,x]),onTriggerLeave:I.useCallback(()=>{p?T():(window.clearTimeout(h.current),h.current=0)},[T,p]),onOpen:x,onClose:T,disableHoverableContent:p,children:n})})};Rq.displayName=cw;var eM="TooltipTrigger",Iq=I.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=eT(eM,n),s=AR(eM,n),a=ZS(n),o=I.useRef(null),l=ri(e,o,i.onTriggerChange),c=I.useRef(!1),u=I.useRef(!1),d=I.useCallback(()=>c.current=!1,[]);return I.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),w.jsx(_ce,{asChild:!0,...a,children:w.jsx(Jn.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:Hn(t.onPointerMove,f=>{f.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:Hn(t.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:Hn(t.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:Hn(t.onFocus,()=>{c.current||i.onOpen()}),onBlur:Hn(t.onBlur,i.onClose),onClick:Hn(t.onClick,i.onClose)})})});Iq.displayName=eM;var Tce="TooltipPortal",[o7e,Cce]=QS(Tce,{forceMount:void 0}),Iv="TooltipContent",Lq=I.forwardRef((t,e)=>{const n=Cce(Iv,t.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=t,a=eT(Iv,t.__scopeTooltip);return w.jsx(Zv,{present:r||a.open,children:a.disableHoverableContent?w.jsx(Oq,{side:i,...s,ref:e}):w.jsx(Ece,{side:i,...s,ref:e})})}),Ece=I.forwardRef((t,e)=>{const n=eT(Iv,t.__scopeTooltip),r=AR(Iv,t.__scopeTooltip),i=I.useRef(null),s=ri(e,i),[a,o]=I.useState(null),{trigger:l,onClose:c}=n,u=i.current,{onPointerInTransitChange:d}=r,f=I.useCallback(()=>{o(null),d(!1)},[d]),h=I.useCallback((p,m)=>{const g=p.currentTarget,v={x:p.clientX,y:p.clientY},_=Rce(v,g.getBoundingClientRect()),b=Ice(v,_),x=Lce(m.getBoundingClientRect()),T=Dce([...b,...x]);o(T),d(!0)},[d]);return I.useEffect(()=>()=>f(),[f]),I.useEffect(()=>{if(l&&u){const p=g=>h(g,u),m=g=>h(g,l);return l.addEventListener("pointerleave",p),u.addEventListener("pointerleave",m),()=>{l.removeEventListener("pointerleave",p),u.removeEventListener("pointerleave",m)}}},[l,u,h,f]),I.useEffect(()=>{if(a){const p=m=>{const g=m.target,v={x:m.clientX,y:m.clientY},_=(l==null?void 0:l.contains(g))||(u==null?void 0:u.contains(g)),b=!Oce(v,a);_?f():b&&(f(),c())};return document.addEventListener("pointermove",p),()=>document.removeEventListener("pointermove",p)}},[l,u,a,c,f]),w.jsx(Oq,{...t,ref:s})}),[Ace,Pce]=QS(cw,{isInside:!1}),Mce=Rse("TooltipContent"),Oq=I.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:a,...o}=t,l=eT(Iv,n),c=ZS(n),{onClose:u}=l;return I.useEffect(()=>(document.addEventListener(ZP,u),()=>document.removeEventListener(ZP,u)),[u]),I.useEffect(()=>{if(l.trigger){const d=f=>{const h=f.target;h!=null&&h.contains(l.trigger)&&u()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[l.trigger,u]),w.jsx(GS,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:w.jsxs(wce,{"data-state":l.stateAttribute,...c,...o,ref:e,style:{...o.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[w.jsx(Mce,{children:r}),w.jsx(Ace,{scope:n,isInside:!0,children:w.jsx(tae,{id:l.contentId,role:"tooltip",children:i||r})})]})})});Lq.displayName=Iv;var Dq="TooltipArrow",Nce=I.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=ZS(n);return Pce(Dq,n).isInside?null:w.jsx(bce,{...i,...r,ref:e})});Nce.displayName=Dq;function Rce(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),i=Math.abs(e.right-t.x),s=Math.abs(e.left-t.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function Ice(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function Lce(t){const{top:e,right:n,bottom:r,left:i}=t;return[{x:i,y:e},{x:n,y:e},{x:n,y:r},{x:i,y:r}]}function Oce(t,e){const{x:n,y:r}=t;let i=!1;for(let s=0,a=e.length-1;s<e.length;a=s++){const o=e[s],l=e[a],c=o.x,u=o.y,d=l.x,f=l.y;u>r!=f>r&&n<(d-c)*(r-u)/(f-u)+c&&(i=!i)}return i}function Dce(t){const e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),Fce(e)}function Fce(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const i=t[r];for(;e.length>=2;){const s=e[e.length-1],a=e[e.length-2];if((s.x-a.x)*(i.y-a.y)>=(s.y-a.y)*(i.x-a.x))e.pop();else break}e.push(i)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const i=t[r];for(;n.length>=2;){const s=n[n.length-1],a=n[n.length-2];if((s.x-a.x)*(i.y-a.y)>=(s.y-a.y)*(i.x-a.x))n.pop();else break}n.push(i)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var jce=Nq,Bce=Rq,Uce=Iq,Fq=Lq;const jq=jce,zce=Bce,$ce=Uce,Bq=I.forwardRef(({className:t,sideOffset:e=4,...n},r)=>
vendor: 23,699 bytes, line 416
416w.jsx(Fq,{ref:r,sideOffset:e,className:vt("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n}));Bq.displayName=Fq.displayName;var tT=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},nT=typeof window>"u"||"Deno"in globalThis;function Ml(){}function Vce(t,e){return typeof t=="function"?t(e):t}function qce(t){return typeof t=="number"&&t>=0&&t!==1/0}function Wce(t,e){return Math.max(t+(e||0)-Date.now(),0)}function tM(t,e){return typeof t=="function"?t(e):t}function Gce(t,e){return typeof t=="function"?t(e):t}function VF(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:a,stale:o}=t;if(a){if(r){if(e.queryHash!==PR(a,e.options))return!1}else if(!dw(e.queryKey,a))return!1}if(n!=="all"){const l=e.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof o=="boolean"&&e.isStale()!==o||i&&i!==e.state.fetchStatus||s&&!s(e))}function qF(t,e){const{exact:n,status:r,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(uw(e.options.mutationKey)!==uw(s))return!1}else if(!dw(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function PR(t,e){return((e==null?void 0:e.queryKeyHashFn)||uw)(t)}function uw(t){return JSON.stringify(t,(e,n)=>nM(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function dw(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>dw(t[n],e[n])):!1}function Uq(t,e){if(t===e)return t;const n=WF(t)&&WF(e);if(n||nM(t)&&nM(e)){const r=n?t:Object.keys(t),i=r.length,s=n?e:Object.keys(e),a=s.length,o=n?[]:{},l=new Set(r);let c=0;for(let u=0;u<a;u++){const d=n?u:s[u];(!n&&l.has(d)||n)&&t[d]===void 0&&e[d]===void 0?(o[d]=void 0,c++):(o[d]=Uq(t[d],e[d]),o[d]===t[d]&&t[d]!==void 0&&c++)}return i===a&&c===i?t:o}return e}function WF(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function nM(t){if(!GF(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!GF(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function GF(t){return Object.prototype.toString.call(t)==="[object Object]"}function Hce(t){return new Promise(e=>{setTimeout(e,t)})}function Kce(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?Uq(t,e):e}function Jce(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function Yce(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var MR=Symbol();function zq(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===MR?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var wp,mh,vv,zz,Xce=(zz=class extends tT{constructor(){super();Rn(this,wp);Rn(this,mh);Rn(this,vv);Zt(this,vv,e=>{if(!nT&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){Pe(this,mh)||this.setEventListener(Pe(this,vv))}onUnsubscribe(){var e;this.hasListeners()||((e=Pe(this,mh))==null||e.call(this),Zt(this,mh,void 0))}setEventListener(e){var n;Zt(this,vv,e),(n=Pe(this,mh))==null||n.call(this),Zt(this,mh,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){Pe(this,wp)!==e&&(Zt(this,wp,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof Pe(this,wp)=="boolean"?Pe(this,wp):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},wp=new WeakMap,mh=new WeakMap,vv=new WeakMap,zz),$q=new Xce,yv,gh,_v,$z,Qce=($z=class extends tT{constructor(){super();Rn(this,yv,!0);Rn(this,gh);Rn(this,_v);Zt(this,_v,e=>{if(!nT&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){Pe(this,gh)||this.setEventListener(Pe(this,_v))}onUnsubscribe(){var e;this.hasListeners()||((e=Pe(this,gh))==null||e.call(this),Zt(this,gh,void 0))}setEventListener(e){var n;Zt(this,_v,e),(n=Pe(this,gh))==null||n.call(this),Zt(this,gh,e(this.setOnline.bind(this)))}setOnline(e){Pe(this,yv)!==e&&(Zt(this,yv,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return Pe(this,yv)}},yv=new WeakMap,gh=new WeakMap,_v=new WeakMap,$z),Sk=new Qce;function Zce(){let t,e;const n=new Promise((i,s)=>{t=i,e=s});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},n.reject=i=>{r({status:"rejected",reason:i}),e(i)},n}function eue(t){return Math.min(1e3*2**t,3e4)}function Vq(t){return(t??"online")==="online"?Sk.isOnline():!0}var qq=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function e5(t){return t instanceof qq}function Wq(t){let e=!1,n=0,r=!1,i;const s=Zce(),a=m=>{var g;r||(f(new qq(m)),(g=t.abort)==null||g.call(t))},o=()=>{e=!0},l=()=>{e=!1},c=()=>$q.isFocused()&&(t.networkMode==="always"||Sk.isOnline())&&t.canRun(),u=()=>Vq(t.networkMode)&&t.canRun(),d=m=>{var g;r||(r=!0,(g=t.onSuccess)==null||g.call(t,m),i==null||i(),s.resolve(m))},f=m=>{var g;r||(r=!0,(g=t.onError)==null||g.call(t,m),i==null||i(),s.reject(m))},h=()=>new Promise(m=>{var g;i=v=>{(r||c())&&m(v)},(g=t.onPause)==null||g.call(t)}).then(()=>{var m;i=void 0,r||(m=t.onContinue)==null||m.call(t)}),p=()=>{if(r)return;let m;const g=n===0?t.initialPromise:void 0;try{m=g??t.fn()}catch(v){m=Promise.reject(v)}Promise.resolve(m).then(d).catch(v=>{var N;if(r)return;const _=t.retry??(nT?0:3),b=t.retryDelay??eue,x=typeof b=="function"?b(n,v):b,T=_===!0||typeof _=="number"&&n<_||typeof _=="function"&&_(n,v);if(e||!T){f(v);return}n++,(N=t.onFail)==null||N.call(t,n,v),Hce(x).then(()=>c()?void 0:h()).then(()=>{e?f(v):p()})})};return{promise:s,cancel:a,continue:()=>(i==null||i(),s),cancelRetry:o,continueRetry:l,canStart:u,start:()=>(u()?p():h().then(p),s)}}var tue=t=>setTimeout(t,0);function nue(){let t=[],e=0,n=o=>{o()},r=o=>{o()},i=tue;const s=o=>{e?t.push(o):i(()=>{n(o)})},a=()=>{const o=t;t=[],o.length&&i(()=>{r(()=>{o.forEach(l=>{n(l)})})})};return{batch:o=>{let l;e++;try{l=o()}finally{e--,e||a()}return l},batchCalls:o=>(...l)=>{s(()=>{o(...l)})},schedule:s,setNotifyFunction:o=>{n=o},setBatchNotifyFunction:o=>{r=o},setScheduler:o=>{i=o}}}var ya=nue(),bp,Vz,Gq=(Vz=class{constructor(){Rn(this,bp)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),qce(this.gcTime)&&Zt(this,bp,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(nT?1/0:5*60*1e3))}clearGcTimeout(){Pe(this,bp)&&(clearTimeout(Pe(this,bp)),Zt(this,bp,void 0))}},bp=new WeakMap,Vz),wv,xp,Go,kp,Hs,Kw,Sp,Il,zu,qz,rue=(qz=class extends Gq{constructor(e){super();Rn(this,Il);Rn(this,wv);Rn(this,xp);Rn(this,Go);Rn(this,kp);Rn(this,Hs);Rn(this,Kw);Rn(this,Sp);Zt(this,Sp,!1),Zt(this,Kw,e.defaultOptions),this.setOptions(e.options),this.observers=[],Zt(this,kp,e.client),Zt(this,Go,Pe(this,kp).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,Zt(this,wv,sue(this.options)),this.state=e.state??Pe(this,wv),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=Pe(this,Hs))==null?void 0:e.promise}setOptions(e){this.options={...Pe(this,Kw),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&Pe(this,Go).remove(this)}setData(e,n){const r=Kce(this.state.data,e,this.options);return Bs(this,Il,zu).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){Bs(this,Il,zu).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,i;const n=(r=Pe(this,Hs))==null?void 0:r.promise;return(i=Pe(this,Hs))==null||i.cancel(e),n?n.then(Ml).catch(Ml):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(Pe(this,wv))}isActive(){return this.observers.some(e=>Gce(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===MR||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>tM(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!Wce(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=Pe(this,Hs))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=Pe(this,Hs))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),Pe(this,Go).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(Pe(this,Hs)&&(Pe(this,Sp)?Pe(this,Hs).cancel({revert:!0}):Pe(this,Hs).cancelRetry()),this.scheduleGc()),Pe(this,Go).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Bs(this,Il,zu).call(this,{type:"invalidate"})}fetch(e,n){var c,u,d;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(Pe(this,Hs))return Pe(this,Hs).continueRetry(),Pe(this,Hs).promise}if(e&&this.setOptions(e),!this.options.queryFn){const f=this.observers.find(h=>h.options.queryFn);f&&this.setOptions(f.options)}const r=new AbortController,i=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(Zt(this,Sp,!0),r.signal)})},s=()=>{const f=zq(this.options,n),p=(()=>{const m={client:Pe(this,kp),queryKey:this.queryKey,meta:this.meta};return i(m),m})();return Zt(this,Sp,!1),this.options.persister?this.options.persister(f,p,this):f(p)},o=(()=>{const f={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:Pe(this,kp),state:this.state,fetchFn:s};return i(f),f})();(c=this.options.behavior)==null||c.onFetch(o,this),Zt(this,xp,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=o.fetchOptions)==null?void 0:u.meta))&&Bs(this,Il,zu).call(this,{type:"fetch",meta:(d=o.fetchOptions)==null?void 0:d.meta});const l=f=>{var h,p,m,g;e5(f)&&f.silent||Bs(this,Il,zu).call(this,{type:"error",error:f}),e5(f)||((p=(h=Pe(this,Go).config).onError)==null||p.call(h,f,this),(g=(m=Pe(this,Go).config).onSettled)==null||g.call(m,this.state.data,f,this)),this.scheduleGc()};return Zt(this,Hs,Wq({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,abort:r.abort.bind(r),onSuccess:f=>{var h,p,m,g;if(f===void 0){l(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(v){l(v);return}(p=(h=Pe(this,Go).config).onSuccess)==null||p.call(h,f,this),(g=(m=Pe(this,Go).config).onSettled)==null||g.call(m,f,this.state.error,this),this.scheduleGc()},onError:l,onFail:(f,h)=>{Bs(this,Il,zu).call(this,{type:"failed",failureCount:f,error:h})},onPause:()=>{Bs(this,Il,zu).call(this,{type:"pause"})},onContinue:()=>{Bs(this,Il,zu).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0})),Pe(this,Hs).start()}},wv=new WeakMap,xp=new WeakMap,Go=new WeakMap,kp=new WeakMap,Hs=new WeakMap,Kw=new WeakMap,Sp=new WeakMap,Il=new WeakSet,zu=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...iue(r.data,this.options),fetchMeta:e.meta??null};case"success":return Zt(this,xp,void 0),{...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=e.error;return e5(i)&&i.revert&&Pe(this,xp)?{...Pe(this,xp),fetchStatus:"idle"}:{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),ya.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),Pe(this,Go).notify({query:this,type:"updated",action:e})})},qz);function iue(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Vq(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function sue(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Fc,Wz,aue=(Wz=class extends tT{constructor(e={}){super();Rn(this,Fc);this.config=e,Zt(this,Fc,new Map)}build(e,n,r){const i=n.queryKey,s=n.queryHash??PR(i,n);let a=this.get(s);return a||(a=new rue({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(a)),a}add(e){Pe(this,Fc).has(e.queryHash)||(Pe(this,Fc).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=Pe(this,Fc).get(e.queryHash);n&&(e.destroy(),n===e&&Pe(this,Fc).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){ya.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return Pe(this,Fc).get(e)}getAll(){return[...Pe(this,Fc).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>VF(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>VF(e,r)):n}notify(e){ya.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){ya.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ya.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Fc=new WeakMap,Wz),jc,ma,Tp,Bc,th,Gz,oue=(Gz=class extends Gq{constructor(e){super();Rn(this,Bc);Rn(this,jc);Rn(this,ma);Rn(this,Tp);this.mutationId=e.mutationId,Zt(this,ma,e.mutationCache),Zt(this,jc,[]),this.state=e.state||lue(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){Pe(this,jc).includes(e)||(Pe(this,jc).push(e),this.clearGcTimeout(),Pe(this,ma).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){Zt(this,jc,Pe(this,jc).filter(n=>n!==e)),this.scheduleGc(),Pe(this,ma).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){Pe(this,jc).length||(this.state.status==="pending"?this.scheduleGc():Pe(this,ma).remove(this))}continue(){var e;return((e=Pe(this,Tp))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var s,a,o,l,c,u,d,f,h,p,m,g,v,_,b,x,T,N,A,L;const n=()=>{Bs(this,Bc,th).call(this,{type:"continue"})};Zt(this,Tp,Wq({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(M,B)=>{Bs(this,Bc,th).call(this,{type:"failed",failureCount:M,error:B})},onPause:()=>{Bs(this,Bc,th).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Pe(this,ma).canRun(this)}));const r=this.state.status==="pending",i=!Pe(this,Tp).canStart();try{if(r)n();else{Bs(this,Bc,th).call(this,{type:"pending",variables:e,isPaused:i}),await((a=(s=Pe(this,ma).config).onMutate)==null?void 0:a.call(s,e,this));const B=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,e));B!==this.state.context&&Bs(this,Bc,th).call(this,{type:"pending",context:B,variables:e,isPaused:i})}const M=await Pe(this,Tp).start();return await((u=(c=Pe(this,ma).config).onSuccess)==null?void 0:u.call(c,M,e,this.state.context,this)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,M,e,this.state.context)),await((p=(h=Pe(this,ma).config).onSettled)==null?void 0:p.call(h,M,null,this.state.variables,this.state.context,this)),await((g=(m=this.options).onSettled)==null?void 0:g.call(m,M,null,e,this.state.context)),Bs(this,Bc,th).call(this,{type:"success",data:M}),M}catch(M){try{throw await((_=(v=Pe(this,ma).config).onError)==null?void 0:_.call(v,M,e,this.state.context,this)),await((x=(b=this.options).onError)==null?void 0:x.call(b,M,e,this.state.context)),await((N=(T=Pe(this,ma).config).onSettled)==null?void 0:N.call(T,void 0,M,this.state.variables,this.state.context,this)),await((L=(A=this.options).onSettled)==null?void 0:L.call(A,void 0,M,e,this.state.context)),M}finally{Bs(this,Bc,th).call(this,{type:"error",error:M})}}finally{Pe(this,ma).runNext(this)}}},jc=new WeakMap,ma=new WeakMap,Tp=new WeakMap,Bc=new WeakSet,th=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),ya.batch(()=>{Pe(this,jc).forEach(r=>{r.onMutationUpdate(e)}),Pe(this,ma).notify({mutation:this,type:"updated",action:e})})},Gz);function lue(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Qu,Ll,Jw,Hz,cue=(Hz=class extends tT{constructor(e={}){super();Rn(this,Qu);Rn(this,Ll);Rn(this,Jw);this.config=e,Zt(this,Qu,new Set),Zt(this,Ll,new Map),Zt(this,Jw,0)}build(e,n,r){const i=new oue({mutationCache:this,mutationId:++fb(this,Jw)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){Pe(this,Qu).add(e);const n=Db(e);if(typeof n=="string"){const r=Pe(this,Ll).get(n);r?r.push(e):Pe(this,Ll).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(Pe(this,Qu).delete(e)){const n=Db(e);if(typeof n=="string"){const r=Pe(this,Ll).get(n);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&Pe(this,Ll).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=Db(e);if(typeof n=="string"){const r=Pe(this,Ll).get(n),i=r==null?void 0:r.find(s=>s.state.status==="pending");return!i||i===e}else return!0}runNext(e){var r;const n=Db(e);if(typeof n=="string"){const i=(r=Pe(this,Ll).get(n))==null?void 0:r.find(s=>s!==e&&s.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){ya.batch(()=>{Pe(this,Qu).forEach(e=>{this.notify({type:"removed",mutation:e})}),Pe(this,Qu).clear(),Pe(this,Ll).clear()})}getAll(){return Array.from(Pe(this,Qu))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>qF(n,r))}findAll(e={}){return this.getAll().filter(n=>qF(e,n))}notify(e){ya.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return ya.batch(()=>Promise.all(e.map(n=>n.continue().catch(Ml))))}},Qu=new WeakMap,Ll=new WeakMap,Jw=new WeakMap,Hz);function Db(t){var e;return(e=t.options.scope)==null?void 0:e.id}function HF(t){return{onFetch:(e,n)=>{var u,d,f,h,p;const r=e.options,i=(f=(d=(u=e.fetchOptions)==null?void 0:u.meta)==null?void 0:d.fetchMore)==null?void 0:f.direction,s=((h=e.state.data)==null?void 0:h.pages)||[],a=((p=e.state.data)==null?void 0:p.pageParams)||[];let o={pages:[],pageParams:[]},l=0;const c=async()=>{let m=!1;const g=b=>{Object.defineProperty(b,"signal",{enumerable:!0,get:()=>(e.signal.aborted?m=!0:e.signal.addEventListener("abort",()=>{m=!0}),e.signal)})},v=zq(e.options,e.fetchOptions),_=async(b,x,T)=>{if(m)return Promise.reject();if(x==null&&b.pages.length)return Promise.resolve(b);const A=(()=>{const R={client:e.client,queryKey:e.queryKey,pageParam:x,direction:T?"backward":"forward",meta:e.options.meta};return g(R),R})(),L=await v(A),{maxPages:M}=e.options,B=T?Yce:Jce;return{pages:B(b.pages,L,M),pageParams:B(b.pageParams,x,M)}};if(i&&s.length){const b=i==="backward",x=b?uue:KF,T={pages:s,pageParams:a},N=x(r,T);o=await _(T,N,b)}else{const b=t??s.length;do{const x=l===0?a[0]??r.initialPageParam:KF(r,o);if(l>0&&x==null)break;o=await _(o,x),l++}while(l<b)}return o};e.options.persister?e.fetchFn=()=>{var m,g;return(g=(m=e.options).persister)==null?void 0:g.call(m,c,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=c}}}function KF(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function uue(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var di,vh,yh,bv,xv,_h,kv,Sv,Kz,due=(Kz=class{constructor(t={}){Rn(this,di);Rn(this,vh);Rn(this,yh);Rn(this,bv);Rn(this,xv);Rn(this,_h);Rn(this,kv);Rn(this,Sv);Zt(this,di,t.queryCache||new aue),Zt(this,vh,t.mutationCache||new cue),Zt(this,yh,t.defaultOptions||{}),Zt(this,bv,new Map),Zt(this,xv,new Map),Zt(this,_h,0)}mount(){fb(this,_h)._++,Pe(this,_h)===1&&(Zt(this,kv,$q.subscribe(async t=>{t&&(await this.resumePausedMutations(),Pe(this,di).onFocus())})),Zt(this,Sv,Sk.subscribe(async t=>{t&&(await this.resumePausedMutations(),Pe(this,di).onOnline())})))}unmount(){var t,e;fb(this,_h)._--,Pe(this,_h)===0&&((t=Pe(this,kv))==null||t.call(this),Zt(this,kv,void 0),(e=Pe(this,Sv))==null||e.call(this),Zt(this,Sv,void 0))}isFetching(t){return Pe(this,di).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return Pe(this,vh).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=Pe(this,di).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=Pe(this,di).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(tM(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return Pe(this,di).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),i=Pe(this,di).get(r.queryHash),s=i==null?void 0:i.state.data,a=Vce(e,s);if(a!==void 0)return Pe(this,di).build(this,r).setData(a,{...n,manual:!0})}
416setQueriesData(t,e,n){return ya.batch(()=>Pe(this,di).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=Pe(this,di).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=Pe(this,di);ya.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=Pe(this,di);return ya.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=ya.batch(()=>Pe(this,di).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(Ml).catch(Ml)}invalidateQueries(t,e={}){return ya.batch(()=>(Pe(this,di).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=ya.batch(()=>Pe(this,di).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(Ml)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Ml)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=Pe(this,di).build(this,e);return n.isStaleByTime(tM(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}
416prefetchQuery(t){return this.fetchQuery(t).then(Ml).catch(Ml)}fetchInfiniteQuery(t){return t.behavior=HF(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Ml).catch(Ml)}ensureInfiniteQueryData(t){return t.behavior=HF(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Sk.isOnline()?Pe(this,vh).resumePausedMutations():Promise.resolve()}getQueryCache(){return Pe(this,di)}getMutationCache(){return Pe(this,vh)}getDefaultOptions(){return Pe(this,yh)}setDefaultOptions(t){Zt(this,yh,t)}setQueryDefaults(t,e){Pe(this,bv).set(uw(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...Pe(this,bv).values()],n={};return e.forEach(r=>{dw(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){Pe(this,xv).set(uw(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...Pe(this,xv).values()],n={};return e.forEach(r=>{dw(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...Pe(this,yh).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=PR(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===MR&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...Pe(this,yh).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){Pe(this,di).clear(),Pe(this,vh).clear()}},di=new WeakMap,vh=new WeakMap,yh=new WeakMap,bv=new WeakMap,xv=new WeakMap,_h=new WeakMap,kv=new WeakMap,Sv=new WeakMap,Kz),hue=I.createContext(void 0),fue=({client:t,children:e})=>(I.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),w.jsx(hue.Provider,{value:t,children:e}));/** 417 * @remix-run/router v1.23.0 418 * 419 * Copyright (c) Remix Software Inc. 420 * 421 * This source code is licensed under the MIT license found in the 422 * LICENSE.md file in the root directory of this source tree. 423 * 424 * @license MIT 425 */function hw(){return hw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},hw.apply(this,arguments)}var xh;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(xh||(xh={}));const JF="popstate";function pue(t){t===void 0&&(t={});function e(r,i){let{pathname:s,search:a,hash:o}=r.location;return rM("",{pathname:s,search:a,hash:o},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(r,i){return typeof i=="string"?i:Tk(i)}return gue(e,n,null,t)}function ti(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function Hq(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function mue(){return Math.random().toString(36).substr(2,8)}function YF(t,e){return{usr:t.state,key:t.key,idx:e}}function rM(t,e,n,r){return n===void 0&&(n=null),hw({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?r0(e):e,{state:n,key:e&&e.key||r||mue()})}function Tk(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function r0(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function gue(t,e,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:s=!1}=r,a=i.history,o=xh.Pop,l=null,c=u();c==null&&(c=0,a.replaceState(hw({},a.state,{idx:c}),""));function u(){return(a.state||{idx:null}).idx}function d(){o=xh.Pop;let g=u(),v=g==null?null:g-c;c=g,l&&l({action:o,location:m.location,delta:v})}function f(g,v){o=xh.Push;let _=rM(m.location,g,v);c=u()+1;let b=YF(_,c),x=m.createHref(_);try{a.pushState(b,"",x)}catch(T){if(T instanceof DOMException&&T.name==="DataCloneError")throw T;i.location.assign(x)}s&&l&&l({action:o,location:m.location,delta:1})}function h(g,v){o=xh.Replace;let _=rM(m.location,g,v);c=u();let b=YF(_,c),x=m.createHref(_);a.replaceState(b,"",x),s&&l&&l({action:o,location:m.location,delta:0})}function p(g){let v=i.location.origin!=="null"?i.location.origin:i.location.href,_=typeof g=="string"?g:Tk(g);return _=_.replace(/ $/,"%20"),ti(v,"No window.location.(origin|href) available to create URL for href: "+_),new URL(_,v)}let m={get action(){return o},get location(){return t(i,a)},listen(g){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(JF,d),l=g,()=>{i.removeEventListener(JF,d),l=null}},createHref(g){return e(i,g)},createURL:p,encodeLocation(g){let v=p(g);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:f,replace:h,go(g){return a.go(g)}};return m}var XF;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(XF||(XF={}));function vue(t,e,n){return n===void 0&&(n="/"),yue(t,e,n,!1)}function yue(t,e,n,r){let i=typeof e=="string"?r0(e):e,s=Lv(i.pathname||"/",n);if(s==null)return null;let a=Kq(t);_ue(a);let o=null;for(let l=0;o==null&&l<a.length;++l){let c=Mue(s);o=Aue(a[l],c,r)}return o}function Kq(t,e,n,r){e===void 0&&(e=[]),n===void 0&&(n=[]),r===void 0&&(r="");let i=(s,a,o)=>{let l={relativePath:o===void 0?s.path||"":o,caseSensitive:s.caseSensitive===!0,childrenIndex:a,route:s};l.relativePath.startsWith("/")&&(ti(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not val
425id. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let c=Fh([r,l.relativePath]),u=n.concat(l);s.children&&s.children.length>0&&(ti(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),Kq(s.children,e,u,c)),!(s.path==null&&!s.index)&&e.push({path:c,score:Cue(c,s.index),routesMeta:u})};return t.forEach((s,a)=>{var o;if(s.path===""||!((o=s.path)!=null&&o.includes("?")))i(s,a);else for(let l of Jq(s.path))i(s,a,l)}),e}function Jq(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let a=Jq(r.join("/")),o=[];return o.push(...a.map(l=>l===""?s:[s,l].join("/"))),i&&o.push(...a),o.map(l=>t.startsWith("/")&&l===""?"/":l)}function _ue(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:Eue(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const wue=/^:[\w-]+$/,bue=3,xue=2,kue=1,Sue=10,Tue=-2,QF=t=>t==="*";function Cue(t,e){let n=t.split("/"),r=n.length;return n.some(QF)&&(r+=Tue),e&&(r+=xue),n.filter(i=>!QF(i)).reduce((i,s)=>i+(wue.test(s)?bue:s===""?kue:Sue),r)}function Eue(t,e){return t.length===e.length&&t.slice(0,-1).every((r,i)=>r===e[i])?t[t.length-1]-e[e.length-1]:0}function Aue(t,e,n){let{routesMeta:r}=t,i={},s="/",a=[];for(let o=0;o<r.length;++o){let l=r[o],c=o===r.length-1,u=s==="/"?e:e.slice(s.length)||"/",d=Ck({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},u),f=l.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=Ck({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},u)),!d)return null;
vendor: 9,217 bytes, lines 425-434
425Object.assign(i,d.params),a.push({params:i,pathname:Fh([s,d.pathname]),pathnameBase:Lue(Fh([s,d.pathnameBase])),route:f}),d.pathnameBase!=="/"&&(s=Fh([s,d.pathnameBase]))}return a}function Ck(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=Pue(t.path,t.caseSensitive,t.end),i=e.match(n);if(!i)return null;let s=i[0],a=s.replace(/(.)\/+$/,"$1"),o=i.slice(1);return{params:r.reduce((c,u,d)=>{let{paramName:f,isOptional:h}=u;if(f==="*"){let m=o[d]||"";a=s.slice(0,s.length-m.length).replace(/(.)\/+$/,"$1")}const p=o[d];return h&&!p?c[f]=void 0:c[f]=(p||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:a,pattern:t}}function Pue(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),Hq(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,o,l)=>(r.push({paramName:o,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function Mue(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Hq(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function Lv(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}function Nue(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?r0(t):t;return{pathname:n?n.startsWith("/")?n:Rue(n,e):e,search:Oue(r),hash:Due(i)}}function Rue(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function t5(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function Iue(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function NR(t,e){let n=Iue(t);return e?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function RR(t,e,n,r){r===void 0&&(r=!1);let i;typeof t=="string"?i=r0(t):(i=hw({},t),ti(!i.pathname||!i.pathname.includes("?"),t5("?","pathname","search",i)),ti(!i.pathname||!i.pathname.includes("#"),t5("#","pathname","hash",i)),ti(!i.search||!i.search.includes("#"),t5("#","search","hash",i)));let s=t===""||i.pathname==="",a=s?"/":i.pathname,o;if(a==null)o=n;else{let d=e.length-1;if(!r&&a.startsWith("..")){let f=a.split("/");for(;f[0]==="..";)f.shift(),d-=1;i.pathname=f.join("/")}o=d>=0?e[d]:"/"}let l=Nue(i,o),c=a&&a!=="/"&&a.endsWith("/"),u=(s||a===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(c||u)&&(l.pathname+="/"),l}const Fh=t=>t.join("/").replace(/\/\/+/g,"/"),Lue=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),Oue=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,Due=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function Fue(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const Yq=["post","put","patch","delete"];new Set(Yq);const jue=["get",...Yq];new Set(jue);/** 426 * React Router v6.30.1 427 * 428 * Copyright (c) Remix Software Inc. 429 * 430 * This source code is licensed under the MIT license found in the 431 * LICENSE.md file in the root directory of this source tree. 432 * 433 * @license MIT 434 */function fw(){return fw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},fw.apply(this,arguments)}const rT=I.createContext(null),Xq=I.createContext(null),bd=I.createContext(null),iT=I.createContext(null),cf=I.createContext({outlet:null,matches:[],isDataRoute:!1}),Qq=I.createContext(null);function Bue(t,e){let{relative:n}=e===void 0?{}:e;i0()||ti(!1);let{basename:r,navigator:i}=I.useContext(bd),{hash:s,pathname:a,search:o}=sT(t,{relative:n}),l=a;return r!=="/"&&(l=a==="/"?r:Fh([r,a])),i.createHref({pathname:l,search:o,hash:s})}function i0(){return I.useContext(iT)!=null}function Qp(){return i0()||ti(!1),I.useContext(iT).location}function Zq(t){I.useContext(bd).static||I.useLayoutEffect(t)}function Zp(){let{isDataRoute:t}=I.useContext(cf);return t?Que():Uue()}function Uue(){i0()||ti(!1);let t=I.useContext(rT),{basename:e,future:n,navigator:r}=I.useContext(bd),{matches:i}=I.useContext(cf),{pathname:s}=Qp(),a=JSON.stringify(NR(i,n.v7_relativeSplatPath)),o=I.useRef(!1);return Zq(()=>{o.current=!0}),I.useCallback(function(c,u){if(u===void 0&&(u={}),!o.current)return;if(typeof c=="number"){r.go(c);return}let d=RR(c,JSON.parse(a),s,u.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:Fh([e,d.pathname])),(u.replace?r.replace:r.push)(d,u.state,u)},[e,r,a,s,t])}function sT(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=I.useContext(bd),{matches:i}=I.useContext(cf),{pathname:s}=Qp(),a=JSON.stringify(NR(i,r.v7_relativeSplatPath));return I.useMemo(()=>RR(t,JSON.parse(a),s,n==="path"),[t,a,s,n])}function zue(t,e){return $ue(t,e)}function $ue(t,e,n,r){i0()||ti(!1);let{navigator:i}=I.useContext(bd),{matches:s}=I.useContext(cf),a=s[s.length-1],o=a?a.params:{};a&&a.pathname;let l=a?a.pathnameBase:"/";a&&a.route;let c=Qp(),u;if(e){var d;let g=typeof e=="string"?r0(e):e;l==="/"||(d=g.pathname)!=null&&d.startsWith(l)||ti(!1),u=g}else u=c;let f=u.pathname||"/",h=f;if(l!=="/"){let g=l.replace(/^\//,"").split("/");h="/"+f.replace(/^\//,"").split("/").slice(g.length).join("/")}let p=vue(t,{pathname:h}),m=Hue(p&&p.map(g=>Object.assign({},g,{params:Object.assign({},o,g.params),pathname:Fh([l,i.encodeLocation?i.encodeLocation(g.pathname).pathname:g.pathname]),pathnameBase:g.pathnameBase==="/"?l:Fh([l,i.encodeLocation?i.encodeLocation(g.pathnameBase).pathname:g.pathnameBase])})),s,n,r);return e&&m?I.createElement(iT.Provider,{value:{location:fw({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:xh.Pop}},m):m}function Vue(){let t=Xue(),e=Fue(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return I.createElement(I.Fragment,null,I.createElement("h2",null,"Unexpected Application Error!"),I.createElement("h3",{style:{fontStyle:"italic"}},e),n?I.createElement("pre",{style:i},n):null,null)}const que=I.createElement(Vue,null);class Wue extends I.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?I.createElement(cf.Provider,{value:this.props.routeContext},I.createElement(Qq.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Gue(t){let{routeContext:e,match:n,children:r}=t,i=I.useContext(rT);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),I.createElement(cf.Provider,{value:e},r)}function Hue(t,e,n,r){var i;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var s;if(!n)return null;if(n.errors)t=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let a=t,o=(i=n)==null?void 0:i.errors;if(o!=null){let u=a.findIndex(d=>d.route.id&&(o==null?void 0:o[d.route.id])!==void 0);u>=0||ti(!1),a=a.slice(0,Math.min(a.length,u+1))}let l=!1,c=-1;if(n&&r&&r.v7_partialHydration)for(let u=0;u<a.length;u++){let d=a[u];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(c=u),d.route.id){let{loaderData:f,errors:h}=n,p=d.route.loader&&f[d.route.id]===void 0&&(!h||h[d.route.id]===void 0);if(d.route.lazy||p){l=!0,c>=0?a=a.slice(0,c+1):a=[a[0]];break}}}return a.reduceRight((u,d,f)=>{let h,p=!1,m=null,g=null;n&&(h=o&&d.route.id?o[d.route.id]:void 0,m=d.route.errorElement||que,l&&(c<0&&f===0?(p=!0,g=null):c===f&&(p=!0,g=d.route.hydrateFallbackElement||null)));let v=e.concat(a.slice(0,f+1)),_=()=>{let b;return h?b=m:p?b=g:d.route.Component?b=I.createElement(d.route.Component,null):d.route.element?b=d.route.element:b=u,I.createElement(Gue,{match:d,routeC
434ontext:{outlet:u,matches:v,isDataRoute:n!=null},children:b})};return n&&(d.route.ErrorBoundary||d.route.errorElement||f===0)?I.createElement(Wue,{location:n.location,revalidation:n.revalidation,component:m,error:h,children:_(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):_()},null)}var eW=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(eW||{}),Ek=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(Ek||{});function Kue(t){let e=I.useContext(rT);return e||ti(!1),e}function Jue(t){let e=I.useContext(Xq);return e||ti(!1),e}function Yue(t){let e=I.useContext(cf);return e||ti(!1),e}function tW(t){let e=Yue(),n=e.matches[e.matches.length-1];return n.route.id||ti(!1),n.route.id}function Xue(){var t;let e=I.useContext(Qq),n=Jue(Ek.UseRouteError),r=tW(Ek.UseRouteError);return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function Que(){let{router:t}=Kue(eW.UseNavigateStable),e=tW(Ek.UseNavigateStable),n=I.useRef(!1);return Zq(()=>{n.current=!0}),I.useCallback(function(i,s){s===void 0&&(s={}),n.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,fw({fromRouteId:e},s)))},[t,e])}function Zue(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function ede(t){let{to:e,replace:n,state:r,relative:i}=t;i0()||ti(!1);let{future:s,static:a}=I.useContext(bd),{matches:o}=I.useContext(cf),{pathname:l}=Qp(),c=Zp(),u=RR(e,NR(o,s.v7_relativeSplatPath),l,i==="path"),d=JSON.stringify(u);return I.useEffect(()=>c(JSON.parse(d),{replace:n,state:r,relative:i}),[c,d,i,n,r]),null}function pa(t){ti(!1)}function tde(t){let{basename:e="/",children:n=null,location:r,navigationType:i=xh.Pop,navigator:s,static:a=!1,future:o}=t;i0()&&ti(!1);let l=e.replace(/^\/*/,"/"),c=I.useMemo(()=>({basename:l,navigator:s,static:a,future:fw({v7_relativeSplatPath:!1},o)}),[l,o,s,a]);typeof r=="string"&&(r=r0(r));let{pathname:u="/",search:d="",hash:f="",state:h=null,key:p="default"}=r,m=I.useMemo(()=>{let g=Lv(u,l);return g==null?null:{location:{pathname:g,search:d,hash:f,state:h,key:p},navigationType:i}},[l,u,d,f,h,p,i]);return m==null?null:I.createElement(bd.Provider,{value:c},I.createElement(iT.Provider,{children:n,value:m}))}function nde(t){let{children:e,location:n}=t;return zue(iM(e),n)}new Promise(()=>{});function iM(t,e){e===void 0&&(e=[]);let n=[];return I.Children.forEach(t,(r,i)=>{if(!I.isValidElement(r))return;let s=[...e,i];if(r.type===I.Fragment){n.push.apply(n,iM(r.props.children,s));return}r.type!==pa&&ti(!1),!r.props.index||!r.props.children||ti(!1);let a={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(a.children=iM(r.props.children,s)),n.push(a)}),n}/** 435 * React Router DOM v6.30.1 436 * 437 * Copyright (c) Remix Software Inc. 438 * 439 * This source code is licensed under the MIT license found in the 440 * LICENSE.md file in the root directory of this source tree. 441 * 442 * @license MIT 443 */function Ak(){return Ak=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Ak.apply(this,arguments)}function nW(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}function rde(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function ide(t,e){return t.button===0&&(!e||e==="_self")&&!rde(t)}const sde=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],ade=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],ode="6";try{window.__reactRouterVersion=ode}catch{}const lde=I.createContext({isTransitioning:!1}),cde="startTransition",ZF=m3[cde];function ude(t){let{basename:e,children:n,future:r,window:i}=t,s=I.useRef();s.current==null&&(s.current=pue({window:i,v5Compat:!0}));let a=s.current,[o,l]=I.useState({action:a.action,location:a.location}),{v7_startTransition:c}=r||{},u=I.useCallback(d=>{c&&ZF?ZF(()=>l(d)):l(d)},[l,c]);return I.useLayoutEffect(()=>a.listen(u),[a,u]),I.useEffect(()=>Zue(r),[r]),I.createElement(tde,{basename:e,children:n,location:o.location,navigationType:o.action,navigator:a,future:r})}const dde=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",hde=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,aT=I.forwardRef(function(e,n){let{onClick:r,relative:i,reloadDocument:s,replace:a,state:o,target:l,to:c,preventScrollReset:u,viewTransition:d}=e,f=nW(e,sde),{basename:h}=I.useContext(bd),p,m=!1;if(typeof c=="string"&&hde.test(c)&&(p=c,dde))try{let b=new URL(window.location.href),x=c.startsWith("//")?new URL(b.protocol+c):new URL(c),T=Lv(x.pathname,h);x.origin===b.origin&&T!=null?c=T+x.search+x.hash:m=!0}catch{}let g=Bue(c,{relative:i}),v=mde(c,{replace:a,state:o,target:l,preventScrollReset:u,relative:i,viewTransition:d});function _(b){r&&r(b),b.defaultPrevented||v(b)}return I.createElement("a",Ak({},f,{href:p||g,onClick:m||s?r:_,ref:n,target:l}))}),fde=I.forwardRef(function(e,n){let{"aria-current":r="page",caseSensitive:i=!1,className:s="",end:a=!1,style:o,to:l,viewTransition:c,children:u}=e,d=nW(e,ade),f=sT(l,{relative:d.relative}),h=Qp(),p=I.useContext(Xq),{navigator:m,basename:g}=I.useContext(bd),v=p!=null&&gde(f)&&c===!0,_=m.encodeLocation?m.encodeLocation(f).pathname:f.pathname,b=h.pathname,x=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;i||(b=b.toLowerCase(),x=x?x.toLowerCase():null,_=_.toLowerCase()),x&&g&&(x=Lv(x,g)||x);const T=_!=="/"&&_.endsWith("/")?_.length-1:_.length;let N=b===_||!a&&b.startsWith(_)&&b.charAt(T)==="/",A=x!=null&&(x===_||!a&&x.startsWith(_)&&x.charAt(_.length)==="/"),L={isActive:N,isPending:A,isTransitioning:v},M=N?r:void 0,B;typeof s=="function"?B=s(L):B=[s,N?"active":null,A?"pending":null,v?"transitioning":null].filter(
443Boolean).join(" ");let R=typeof o=="function"?o(L):o;return I.createElement(aT,Ak({},d,{"aria-current":M,className:B,ref:n,style:R,to:l,viewTransition:c}),typeof u=="function"?u(L):u)});var sM;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(sM||(sM={}));var e6;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(e6||(e6={}));function pde(t){let e=I.useContext(rT);return e||ti(!1),e}function mde(t,e){let{target:n,replace:r,state:i,preventScrollReset:s,relative:a,viewTransition:o}=e===void 0?{}:e,l=Zp(),c=Qp(),u=sT(t,{relative:a});return I.useCallback(d=>{if(ide(d,n)){d.preventDefault();let f=r!==void 0?r:Tk(c)===Tk(u);l(t,{replace:f,state:i,preventScrollReset:s,relative:a,viewTransition:o})}},[c,l,u,r,i,n,t,s,a,o])}function gde(t,e){e===void 0&&(e={});let n=I.useContext(lde);n==null&&ti(!1);let{basename:r}=pde(sM.useViewTransitionState),i=sT(t,{relative:e.relative});if(!n.isTransitioning)return!1;let s=Lv(n.currentLocation.pathname,r)||n.currentLocation.pathname,a=Lv(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Ck(i.pathname,a)!=null||Ck(i.pathname,s)!=null}const vde=()=>{const t=Zp();return I.useEffect(()=>{t("/login")},[t]),null},IR=I.createContext({});function LR(t){const e=I.useRef(null);return e.current===null&&(e.current=t()),e.current}const yde=typeof window<"u",rW=yde?I.useLayoutEffect:I.useEffect,oT=I.createContext(null);function OR(t,e){t.indexOf(e)===-1&&t.push(e)}function Pk(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const ru=(t,e,n)=>n>e?e:n<t?t:n;let lT=()=>{},Ov=()=>{};const Qh={},iW=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function sW(t){return typeof t=="object"&&t!==null}const aW=t=>/^0[^.\s]+$/u.test(t);function oW(t){let e;return()=>(e===void 0&&(e=t()),e)}const tl=t=>t,_de=(t,e)=>n=>e(t(n)),c1=(...t)=>t.reduce(_de),pw=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r};class DR{constructor(){this.subscriptions=[]}add(e){return OR(this.subscriptions,e),()=>Pk(this.subscriptions,e)}notify(e,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,n,r);else for(let s=0;s<i;s++){const a=this.subscriptions[s];a&&a(e,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Ja=t=>t*1e3,Zo=t=>t/1e3;function lW(t,e){return e?t*(1e3/e):0}const cW=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,wde=1e-7,bde=12;function xde(t,e,n,r,i){let s,a,o=0;do a=e+(n-e)/2,s=cW(a,r,i)-t,s>0?n=a:e=a;while(Math.abs(s)>wde&&++o<bde);return a}function u1(t,e,n,r){if(t===e&&n===r)return tl;const i=s=>xde(s,0,1,t,n);return s=>s===0||s===1?s:cW(i(s),e,r)}const uW=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,dW=t=>e=>1-t(1-e),hW=u1(.33,1.53,.69,.99),FR=dW(hW),fW=uW(FR),pW=t=>t>=1?1:(t*=2)<1?.5*FR(t):.5*(2-Math.pow(2,-10*(t-1))),jR=t=>1-Math.sin(Math.acos(t)),mW=dW(jR),gW=uW(jR),kde=u1(.42,0,1,1),Sde=u1(0,0,.58,1),vW=u1(.42,0,.58,1),Tde=t=>Array.isArray(t)&&typeof t[0]!="number",yW=t=>Array.isArray(t)&&typeof t[0]=="number",t6={linear:tl,easeIn:kde,easeInOut:vW,easeOut:Sde,circIn:jR,circInOut:gW,circOut:mW,backIn:FR,backInOut:fW,backOut:hW,anticipate:pW},Cde=t=>typeof t=="string",n6=t=>{if(yW(t)){Ov(t.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[e,n,r,i]=t;return u1(e,n,r,i)}else if(Cde(t))return Ov(t6[t]!==void 0,`Invalid easing type '${t}'`,"invalid-easing-type"),t6[t];return t},Fb=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],r6={value:null,addProjectionMetrics:null};function Ede(t,e){let n=new Set,r=new Set,i=!1,s=!1;const a=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1},l=0;function c(d){a.has(d)&&(u.schedule(d),t()),l++,d(o)}const u={schedule:(d,f=!1,h=!1)=>{const m=h&&i?n:r;return f&&a.add(d),m.add(d),d},cancel:d=>{r.delete(d),a.delete(d)},process:d=>{if(o=d,i){s=!0;return}i=!0;const f=n;n=r,r=f,n.forEach(c),e&&r6.value&&r6.value.frameloop[e].push(l),l=0,n.clear(),i=!1,s&&(s=!1,u.process(d))}};return u}const Ade=40;function _W(t,e){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>n=!0,a=Fb.reduce((b,x)=>(b[x]=Ede(s,e?x:void 0),b),{}),{setup:o,read:l,resolveKeyframes:c,preUpdate:u,update:d,preRender:f,render:h,postRender:p}=a,m=()=>{const b=Qh.useManualTiming,x=b?i.timestamp:performance.now();n=!1,b||(i.delta=r?1e3/60:Math.max(Math.min(x-i.timestamp,Ade),1)),i.timestamp=x,i.isProcessing=!0,o.process(i),l.process(i),c.process(i),u.process(i),d.process(i),f.process(i),h.process(i),p.process(i),i.isProcessing=!1,n&&e&&(r=!1,t(m))},g=()=>{n=!0,r=!0,i.isProcessing||t(m)};return{schedule:Fb.reduce((b,x)=>{const T=a[x];return b[x]=(N,A=!1,L=!1)=>(n||g(),T.schedule(N,A,L)),b},{}),cancel:b=>{for(let x=0;x<Fb.length;x++)a[Fb[x]].cancel(b)},state:i,steps:a}}const{schedule:_r,cancel:Zh,state:ks,steps:n5}=_W(typeof requestAnimationFrame<"u"?requestAnimationFrame:tl,!0);let ax;function Pde(){ax=void 0}const xa={now:()=>(ax===void 0&&xa.set(ks.isProcessing||Qh.useManualTiming?ks.timestamp:performance.now()),ax),set
vendor: 27,424 bytes, line 443
443:t=>{ax=t,queueMicrotask(Pde)}},wW=t=>e=>typeof e=="string"&&e.startsWith(t),bW=wW("--"),Mde=wW("var(--"),BR=t=>Mde(t)?Nde.test(t.split("/*")[0].trim()):!1,Nde=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function i6(t){return typeof t!="string"?!1:t.split("/*")[0].includes("var(--")}const s0={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},mw={...s0,transform:t=>ru(0,1,t)},jb={...s0,default:1},__=t=>Math.round(t*1e5)/1e5,UR=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Rde(t){return t==null}const Ide=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,zR=(t,e)=>n=>!!(typeof n=="string"&&Ide.test(n)&&n.startsWith(t)||e&&!Rde(n)&&Object.prototype.hasOwnProperty.call(n,e)),xW=(t,e,n)=>r=>{if(typeof r!="string")return r;const[i,s,a,o]=r.match(UR);return{[t]:parseFloat(i),[e]:parseFloat(s),[n]:parseFloat(a),alpha:o!==void 0?parseFloat(o):1}},Lde=t=>ru(0,255,t),r5={...s0,transform:t=>Math.round(Lde(t))},dp={test:zR("rgb","red"),parse:xW("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+r5.transform(t)+", "+r5.transform(e)+", "+r5.transform(n)+", "+__(mw.transform(r))+")"};function Ode(t){let e="",n="",r="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),i=t.substring(4,5),e+=e,n+=n,r+=r,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const aM={test:zR("#"),parse:Ode,transform:dp.transform},d1=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),nh=d1("deg"),Xc=d1("%"),_t=d1("px"),Dde=d1("vh"),Fde=d1("vw"),s6={...Xc,parse:t=>Xc.parse(t)/100,transform:t=>Xc.transform(t*100)},Ng={test:zR("hsl","hue"),parse:xW("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+Xc.transform(__(e))+", "+Xc.transform(__(n))+", "+__(mw.transform(r))+")"},Li={test:t=>dp.test(t)||aM.test(t)||Ng.test(t),parse:t=>dp.test(t)?dp.parse(t):Ng.test(t)?Ng.parse(t):aM.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?dp.transform(t):Ng.transform(t),getAnimatableNone:t=>{const e=Li.parse(t);return e.alpha=0,Li.transform(e)}},jde=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Bde(t){var e,n;return isNaN(t)&&typeof t=="string"&&(((e=t.match(UR))==null?void 0:e.length)||0)+(((n=t.match(jde))==null?void 0:n.length)||0)>0}const kW="number",SW="color",Ude="var",zde="var(",a6="${}",$de=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Dv(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},i=[];let s=0;const o=e.replace($de,l=>(Li.test(l)?(r.color.push(s),i.push(SW),n.push(Li.parse(l))):l.startsWith(zde)?(r.var.push(s),i.push(Ude),n.push(l)):(r.number.push(s),i.push(kW),n.push(parseFloat(l))),++s,a6)).split(a6);return{values:n,split:o,indexes:r,types:i}}function Vde(t){return Dv(t).values}function TW({split:t,types:e}){const n=t.length;return r=>{let i="";for(let s=0;s<n;s++)if(i+=t[s],r[s]!==void 0){const a=e[s];a===kW?i+=__(r[s]):a===SW?i+=Li.transform(r[s]):i+=r[s]}return i}}function qde(t){return TW(Dv(t))}const Wde=t=>typeof t=="number"?0:Li.test(t)?Li.getAnimatableNone(t):t,Gde=(t,e)=>typeof t=="number"?e!=null&&e.trim().endsWith("/")?t:0:Wde(t);function Hde(t){const e=Dv(t);return TW(e)(e.values.map((r,i)=>Gde(r,e.split[i])))}const Zl={test:Bde,parse:Vde,createTransformer:qde,getAnimatableNone:Hde};function i5(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function Kde({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let i=0,s=0,a=0;if(!e)i=s=a=n;else{const o=n<.5?n*(1+e):n+e-n*e,l=2*n-o;i=i5(l,o,t+1/3),s=i5(l,o,t),a=i5(l,o,t-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(a*255),alpha:r}}function Mk(t,e){return n=>n>0?e:t}const Ir=(t,e,n)=>t+(e-t)*n,s5=(t,e,n)=>{const r=t*t,i=n*(e*e-r)+r;return i<0?0:Math.sqrt(i)},Jde=[aM,dp,Ng],Yde=t=>Jde.find(e=>e.test(t));function o6(t){const e=Yde(t);if(lT(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!e)return!1;let n=e.parse(t);return e===Ng&&(n=Kde(n)),n}const l6=(t,e)=>{const n=o6(t),r=o6(e);if(!n||!r)return Mk(t,e);const i={...n};return s=>(i.red=s5(n.red,r.red,s),i.green=s5(n.green,r.green,s),i.blue=s5(n.blue,r.blue,s),i.alpha=Ir(n.alpha,r.alpha,s),dp.transform(i))},oM=new Set(["none","hidden"]);function Xde(t,e){return oM.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function Qde(t,e){return n=>Ir(t,e,n)}function $R(t){return typeof t=="number"?Qde:typeof t=="string"?BR(t)?Mk:Li.test(t)?l6:the:Array.isArray(t)?CW:typeof t=="object"?Li.test(t)?l6:Zde:Mk}function CW(t,e){const n=[...t],r=n.length,i=t.map((s,a)=>$R(s)(s,e[a]));return s=>{for(let a=0;a<r;a++)n[a]=i[a](s);return n}}function Zde(t,e){const n={...t,...e},r={};for(const i in n)t[i]!==void 0&&e[i]!==void 0&&(r[i]=$R(t[i])(t[i],e[i]));return i=>{for(const s in r)n[s]=r[s](i);return n}}function ehe(t,e){const n=[],r={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const s=e.types[i],a=t.indexes[s][r[s]],o=t.values[a]??0;n[i]=o,r[s]++}return n}const the=(t,e)=>{const n=Zl.createTransformer(e),r=Dv(t),i=Dv(e);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?oM.has(t)&&!i.values.length||oM.has(e)&&!r.values.length?Xde(t,e):c1(CW(ehe(r,i),i.values),n):(lT(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),Mk(t,e))};function EW(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?Ir(t,e,n):$R(t)(t,e)}const nhe=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>_r.update(e,n),stop:()=>Zh(e),now:()=>ks.isProcessing?ks.timestamp:xa.now()}},AW=(t,e,n=10)=>{let r="";const i=Math.max(Math.round(e/n),2);for(let s=0;s<i;s++)r+=Math.round(t(s/(i-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},Nk=2e4;function VR(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<Nk;)e+=n,r=t.next(e);return e>=Nk?1/0:e}function rhe(t,e=100,n){const r=n({...t,keyframes:[0,e]}),i=Math.min(VR(r),Nk);return{type:"keyframes",ease:s=>r.next(i*s).value/e,duration:Zo(i)}}const Xr={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function lM(t,e){return t*Math.sqrt(1-e*e)}const ihe=12;function she(t,e,n){let r=n;for(let i=1;i<ihe;i++)r=r-t(r)/e(r);return r}const a5=.001;function ahe({duration:t=Xr.duration,bounce:e=Xr.bounce,velocity:n=Xr.velocity,mass:r=Xr.mass}){let i,s;lT(t<=Ja(Xr.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let a=1-e;a=ru(Xr.minDamping,Xr.maxDamping,a),t=ru(Xr.minDuration,Xr.maxDuration,Zo(t)),a<1?(i=c=>{const u=c*a,d=u*t,f=u-n,h=lM(c,a),p=Math.exp(-d);return a5-f/h*p},s=c=>{const d=c*a*t,f=d*n+n,h=Math.pow(a,2)*Math.pow(c,2)*t,p=Math.exp(-d),m=lM(Math.pow(c,2),a);return(-i(c)+a5>0?-1:1)*((f-h)*p)/m}):(i=c=>{const u=Math.exp(-c*t),d=(c-n)*t+1;return-a5+u*d},s=c=>{const u=Math.exp(-c*t),d=(n-c)*(t*t);return u*d});const o=5/t,l=she(i,s,o);if(t=Ja(t),isNaN(l))return{stiffness:Xr.stiffness,damping:Xr.damping,duration:t};{const c=Math.pow(l,2)*r;return{stiffness:c,damping:a*2*Math.sqrt(r*c),duration:t}}}const ohe=["duration","bounce"],lhe=["stiffness","damping","mass"];function c6(t,e){return e.some(n=>t[n]!==void 0)}function che(t){let e={velocity:Xr.velocity,stiffness:Xr.stiffness,damping:Xr.damping,mass:Xr.mass,isResolvedFromDuration:!1,...t};if(!c6(t,lhe)&&c6(t,ohe))if(e.velocity=0,t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,s=2*ru(.05,1,1-(t.bounce||0))*Math.sqrt(i);e={...e,mass:Xr.mass,stiffness:i,damping:s}}else{const n=ahe({...t,velocity:0});e={...e,...n,mass:Xr.mass},e.isResolvedFromDuration=!0}return e}function Rk(t=Xr.visualDuration,e=Xr.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:i}=n;const s=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],o={done:!1,value:s},{stiffness:l,damping:c,mass:u,duration:d,velocity:f,isResolvedFromDuration:h}=che({...n,velocity:-Zo(n.velocity||0)}),p=f||0,m=c/(2*Math.sqrt(l*u)),g=a-s,v=Zo(Math.sqrt(l/u)),_=Math.abs(g)<5;r||(r=_?Xr.restSpeed.granular:Xr.restSpeed.default),i||(i=_?Xr.restDelta.granular:Xr.restDelta.default);let b,x,T,N,A,L;if(m<1)T=lM(v,m),N=(p+m*v*g)/T,b=B=>{const R=Math.exp(-m*v*B);return a-R*(N*Math.sin(T*B)+g*Math.cos(T*B))},A=m*v*N+g*T,L=m*v*g-N*T,x=B=>Math.exp(-m*v*B)*(A*Math.sin(T*B)+L*Math.cos(T*B));else if(m===1){b=R=>a-Math.exp(-v*R)*(g+(p+v*g)*R);const B=p+v*g;x=R=>Math.exp(-v*R)*(v*B*R-p)}else{const B=v*Math.sqrt(m*m-1);b=U=>{const te=Math.exp(-m*v*U),ne=Math.min(B*U,300);return a-te*((p+m*v*g)*Math.sinh(ne)+B*g*Math.cosh(ne))/B};const R=(p+m*v*g)/B,j=m*v*R-g*B,$=m*v*g-R*B;x=U=>{const te=Math.exp(-m*v*U),ne=Math.min(B*U,300);return te*(j*Math.sinh(ne)+$*Math.cosh(ne))}}const M={calculatedDuration:h&&d||null,velocity:B=>Ja(x(B)),next:B=>{if(!h&&m<1){const j=Math.exp(-m*v*B),$=Math.sin(T*B),U=Math.cos(T*B),te=a-j*(N*$+g*U),ne=Ja(j*(A*$+L*U));return o.done=Math.abs(ne)<=r&&Math.abs(a-te)<=i,o.value=o.done?a:te,o}const R=b(B);if(h)o.done=B>=d;else{const j=Ja(x(B));o.done=Math.abs(j)<=r&&Math.abs(a-R)<=i}return o.value=o.done?a:R,o},toString:()=>{const B=Math.min(VR(M),Nk),R=AW(j=>M.next(B*j).value,B,30);return B+"ms "+R},toTransition:()=>{}};return M}Rk.applyToOptions=t=>{const e=rhe(t,100,Rk);return t.ease=e.ease,t.duration=Ja(e.duration),t.type="keyframes",t};const uhe=5;function PW(t,e,n){const r=Math.max(e-uhe,0);return lW(n-t(r),e-r)}function cM({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:a,min:o,max:l,restDelta:c=.5,restSpeed:u}){const d=t[0],f={done:!1,value:d},h=L=>o!==void 0&&L<o||l!==void 0&&L>l,p=L=>o===void 0?l:l===void 0||Math.abs(o-L)<Math.abs(l-L)?o:l;let m=n*e;const g=d+m,v=a===void 0?g:a(g);v!==g&&(m=v-d);const _=L=>-m*Math.exp(-L/r),b=L=>v+_(L),x=L=>{const M=_(L),B=b(L);f.done=Math.abs(M)<=c,f.value=f.done?v:B};let T,N;const A=L=>{h(f.value)&&(T=L,N=Rk({keyframes:[f.value,p(f.value)],velocity:PW(b,L,f.value),damping:i,stiffness:s,restDelta:c,restSpeed:u}))};return A(0),{calculatedDuration:null,next:L=>{let M=!1;return!N&&T===void 0&&(M=!0,x(L),A(L)),T!==void 0&&L>=T?N.next(L-T):(!M&&x(L),f)}}}function dhe(t,e,n){const r=[],i=n||Qh.mix||EW,s=t.length-1;for(let a=0;a<s;a++){let o=i(t[a],t[a+1]);if(e){const l=Array.isArray(e)?e[a]||tl:e;o=c1(l,o)}r.push(o)}return r}function hhe(t,e,{clamp:n=!0,ease:r,mixer:i}={}){const s=t.length;if(Ov(s===e.length,"Both input and output ranges must be the same length","range-length"),s===1)return()=>e[0];if(s===2&&e[0]===e[1])return()=>e[1];const a=t[0]===t[1];t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=dhe(e,r,i),l=o.length,c=u=>{if(a&&u<t[0])return e[0];let d=0;if(l>1)for(;d<t.length-2&&!(u<t[d+1]);d++);const f=pw(t[d],t[d+1],u);return o[d](f)};return n?u=>c(ru(t[0],t[s-1],u)):c}function fhe(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const i=pw(0,e,r);t.push(Ir(n,1,i))}}function phe(t){const e=[0];return fhe(e,t.length-1),e}function mhe(t,e){return t.map(n=>n*e)}function ghe(t,e){return t.map(()=>e||vW).splice(0,t.length-1)}function w_({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const i=Tde(r)?r.map(n6):n6(r),s={done:!1,value:e[0]},a=mhe(n&&n.length===e.length?n:phe(e),t),o=hhe(a,e,{ease:Array.isArray(i)?i:ghe(e,i)});return{calculatedDuration:t,next:l=>(s.value=o(l),s.done=l>=t,s)}}const vhe=t=>t!==null;function cT(t,{repeat:e,repeatType:n="loop"},r,i=1){const s=t.filter(vhe),o=i<0||e&&n!=="loop"&&e%2===1?0:s.length-1;return!o||r===void 0?s[o]:r}const yhe={decay:cM,inertia:cM,tween:w_,keyframes:w_,spring:Rk};function MW(t){typeof t.type=="string"&&(t.type=yhe[t.type])}class qR{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,n){return this.finished.then(e,n)}}const _he=t=>t/100;class Ik extends qR{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var r,i;const{motionValue:n}=this.options;n&&n.updatedAt!==xa.now()&&this.tick(xa.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(i=(r=this.options).onStop)==null||i.call(r))},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;MW(e);const{type:n=w_,repeat:r=0,repeatDelay:i=0,repeatType:s,velocity:a=0}=e;let{keyframes:o}=e;const l=n||w_;l!==w_&&typeof o[0]!="number"&&(this.mixKeyframes=c1(_he,EW(o[0],o[1])),o=[0,100]);const c=l({...e,keyframes:o});s==="mirror"&&(this.mirroredGenerator=l({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=VR(c));const{calculatedDuration:u}=c;this.calculatedDuration=u,this.resolvedDuration=u+i,this.totalDuration=this.resolvedDuration*(r+1)-i,this.generator=c}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:r,totalDuration:i,mixKeyframes:s,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:l}=this;if(this.startTime===null)return r.next(0);const{delay:c=0,keyframes:u,repeat:d,repeatType:f,repeatDelay:h,type:p,onUpdate:m,finalKeyframe:g}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-i/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const v=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?v<0:v>i;this.currentTime=Math.max(v,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let b=this.currentTime,x=r;if(d){const L=Math.min(this.currentTime,i)/o;let M=Math.floor(L),B=L%1;!B&&L>=1&&(B=1),B===1&&M--,M=Math.min(M,d+1),!!(M%2)&&(f==="reverse"?(B=1-B,h&&(B-=h/o)):f==="mirror"&&(x=a)),b=ru(0,1,B)*o}let T;_?(this.delayState.value=u[0],T=this.delayState):T=x.next(b),s&&!_&&(T.value=s(T.value));let{done:N}=T;!_&&l!==null&&(N=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const A=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&N);return A&&p!==cM&&(T.value=cT(u,this.options,g,this.speed)),m&&m(T.value),A&&this.finish(),T}then(e,n){return this.finished.then(e,n)}get duration(){return Zo(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Zo(e)}get time(){return Zo(this.currentTime)}set time(e){e=Ja(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){const e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);const n=this.generator.next(e).value;return PW(r=>this.generator.next(r).value,e,n)}get speed(){return this.playbackSpeed}set speed(e){const n=this.playbackSpeed!==e;n&&this.driver&&this.updateTime(xa.now()),this.playbackSpeed=e,n&&this.driver&&(this.time=Zo(this.currentTime))}play(){var i,s;if(this.isStopped)return;const{driver:e=nhe,startTime:n}=this.options;this.driver||(this.driver=e(a=>this.tick(a))),(s=(i=this.options).onPlay)==null||s.call(i);const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(xa.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(e=this.options).onComplete)==null||n.call(e)}cancel(){var e,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(e=this.options).onCancel)==null||n.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),e.observe(this)}}function whe(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const hp=t=>t*180/Math.PI,uM=t=>{const e=hp(Math.atan2(t[1],t[0]));return dM(e)},bhe={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:uM,rotateZ:uM,skewX:t=>hp(Math.atan(t[1])),skewY:t=>hp(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},dM=t=>(t=t%360,t<0&&(t+=360),t),u6=uM,d6=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),h6=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),xhe={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:d6,scaleY:h6,scale:t=>(d6(t)+h6(t))/2,rotateX:t=>dM(hp(Math.atan2(t[6],t[5]))),rotateY:t=>dM(hp(Math.atan2(-t[2],t[0]))),rotateZ:u6,rotate:u6,skewX:t=>hp(Math.atan(t[4])),skewY:t=>hp(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function hM(t){return t.includes("scale")?1:0}function fM(t,e){if(!t||t==="none")return hM(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,i;if(n)r=xhe,i=n;else{const o=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=bhe,i=o}if(!i)return hM(e);const s=r[e],a=i[1].split(",").map(She);return typeof s=="function"?s(a):a[s]}const khe=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return fM(n,e)};function She(t){return parseFloat(t.trim())}const a0=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],o0=new Set(a0),f6=t=>t===s0||t===_t,The=new Set(["x","y","z"]),Che=a0.filter(t=>!The.has(t));function Ehe(t){const e=[];return Che.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const kh={width:({x:t},{paddingLeft:e="0",paddingRight:n="0",boxSizing:r})=>{const i=t.max-t.min;return r==="border-box"?i:i-parseFloat(e)-parseFloat(n)},height:({y:t},{paddingTop:e="0",paddingBottom:n="0",boxSizing:r})=>{const i=t.max-t.min;return r==="border-box"?i:i-parseFloat(e)-parseFloat(n)},top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>fM(e,"x"),y:(t,{transform:e})=>fM(e,"y")};kh.translateX=kh.x;kh.translateY=kh.y;const Ap=new Set;let pM=!1,mM=!1,gM=!1;function NW(){if(mM){const t=Array.from(Ap).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const i=Ehe(r);i.length&&(n.set(r,i),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const i=n.get(r);i&&i.forEach(([s,a])=>{var o;(o=r.getValue(s))==null||o.set(a)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}mM=!1,pM=!1,Ap.forEach(t=>t.complete(gM)),Ap.clear()}function RW(){Ap.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(mM=!0)})}function Ahe(){gM=!0,RW(),NW(),gM=!1}class WR{constructor(e,n,r,i,s,a=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=i,this.element=s,this.isAsync=a}scheduleResolve(){this.state="scheduled",this.isAsync?(Ap.add(this),pM||(pM=!0,_r.read(RW),_r.resolveKeyframes(NW))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:i}=this;if(e[0]===null){const s=i==null?void 0:i.get(),a=e[e.length-1];if(s!==void 0)e[0]=s;else if(r&&n){const o=r.readValue(n,a);o!=null&&(e[0]=o)}e[0]===void 0&&(e[0]=a),i&&s===void 0&&i.set(e[0])}whe(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Ap.delete(this)}cancel(){this.state==="scheduled"&&(Ap.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const Phe=t=>t.startsWith("--");function IW(t,e,n){Phe(e)?t.style.setProperty(e,n):t.style[e]=n}const Mhe={};function LW(t,e){const n=oW(t);return()=>Mhe[e]??n()}const Nhe=LW(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),OW=LW(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Xy=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,p6={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Xy([0,.65,.55,1]),circOut:Xy([.55,0,1,.45]),backIn:Xy([.31,.01,.66,-.59]),backOut:Xy([.33,1.53,.69,.99])};function DW(t,e){if(t)return typeof t=="function"?OW()?AW(t,e):"ease-out":yW(t)?Xy(t):Array.isArray(t)?t.map(n=>DW(n,e)||p6.easeOut):p6[t]}function Rhe(t,e,n,{delay:r=0,duration:i=300,repeat:s=0,repeatType:a="loop",ease:o="easeOut",times:l}={},c=void 0){const u={[e]:n};l&&(u.offset=l);const d=DW(o,i);Array.isArray(d)&&(u.easing=d);const f={delay:r,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:a==="reverse"?"alternate":"normal"};return c&&(f.pseudoElement=c),t.animate(u,f)}function FW(t){return typeof t=="function"&&"applyToOptions"in t}function Ihe({type:t,...e}){return FW(t)&&OW()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class jW extends qR{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:n,name:r,keyframes:i,pseudoElement:s,allowFlatten:a=!1,finalKeyframe:o,onComplete:l}=e;this.isPseudoElement=!!s,this.allowFlatten=a,this.options=e,Ov(typeof e.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const c=Ihe(e);this.animation=Rhe(n,r,i,c,s),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){const u=cT(i,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(u),IW(n,r,u),this.animation.cancel()}l==null||l(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,n;(n=(e=this.animation).finish)==null||n.call(e)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var n,r,i;const e=(n=this.options)==null?void 0:n.element;!this.isPseudoElement&&(e!=null&&e.isConnected)&&((i=(r=this.animation).commitStyles)==null||i.call(r))}get duration(){var n,r;const e=((r=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:r.call(n).duration)||0;return Zo(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Zo(e)}get time(){return Zo(Number(this.animation.currentTime)||0)}set time(e){const n=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Ja(e),n&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:n,rangeEnd:r,observe:i}){var s;return this.allowFlatten&&((s=this.animation.effect)==null||s.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&Nhe()?(this.animation.timeline=e,n&&(this.animation.rangeStart=n),r&&(this.animation.rangeEnd=r),tl):i(this)}}const BW={anticipate:pW,backInOut:fW,circInOut:gW};function Lhe(t){return t in BW}function Ohe(t){typeof t.ease=="string"&&Lhe(t.ease)&&(t.ease=BW[t.ease])}const o5=10;class Dhe extends jW{constructor(e){Ohe(e),MW(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:r,onComplete:i,element:s,...a}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const o=new Ik({...a,autoplay:!1}),l=Math.max(o5,xa.now()-this.startTime),c=ru(0,o5,l-o5),u=o.sample(l).value,{name:d}=this.options;s&&d&&IW(s,d,u),n.setWithVelocity(o.sample(Math.max(0,l-c)).value,u,c),o.stop()}}const m6=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Zl.test(t)||t==="0")&&!t.startsWith("url("));function Fhe(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function jhe(t,e,n,r){const i=t[0];if(i===null)return!1;if(e==="display"||e==="visibility")return!0;const s=t[t.length-1],a=m6(i,e),o=m6(s,e);return lT(a===o,`You are trying to animate ${e} from "${i}" to "${s}". "${a?s:i}" is not an animatable value.`,"value-not-animatable"),!a||!o?!1:Fhe(t)||(n==="spring"||FW(n))&&r}function vM(t){t.duration=0,t.type="keyframes"}const UW=new Set(["opacity","clipPath","filter","transform"]),Bhe=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function Uhe(t){for(let e=0;e<t.length;e++)if(typeof t[e]=="string"&&Bhe.test(t[e]))return!0;return!1}const zhe=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),$he=oW(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Vhe(t){var d;const{motionValue:e,name:n,repeatDelay:r,repeatType:i,damping:s,type:a,keyframes:o}=t;if(!(((d=e==null?void 0:e.owner)==null?void 0:d.current)instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=e.owner.getProps();return $he()&&n&&(UW.has(n)||zhe.has(n)&&Uhe(o))&&(n!=="transform"||!u)&&!c&&!r&&i!=="mirror"&&s!==0&&a!=="inertia"}const qhe=40;class Whe extends qR{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:i=0,repeatDelay:s=0,repeatType:a="loop",keyframes:o,name:l,motionValue:c,element:u,...d}){var p;super(),this.stop=()=>{var m,g;this._animation&&(this._animation.stop(),(m=this.stopTimeline)==null||m.call(this)),(g=this.keyframeResolver)==null||g.cancel()}
443,this.createdAt=xa.now();const f={autoplay:e,delay:n,type:r,repeat:i,repeatDelay:s,repeatType:a,name:l,motionValue:c,element:u,...d},h=(u==null?void 0:u.KeyframeResolver)||WR;this.keyframeResolver=new h(o,(m,g,v)=>this.onKeyframesResolved(m,g,f,!v),l,c,u),(p=this.keyframeResolver)==null||p.scheduleResolve()}onKeyframesResolved(e,n,r,i){var v,_;this.keyframeResolver=void 0;const{name:s,type:a,velocity:o,delay:l,isHandoff:c,onUpdate:u}=r;this.resolvedAt=xa.now();let d=!0;jhe(e,s,a,o)||(d=!1,(Qh.instantAnimations||!l)&&(u==null||u(cT(e,r,n))),e[0]=e[e.length-1],vM(r),r.repeat=0);const h={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>qhe?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:e},p=d&&!c&&Vhe(h),m=(_=(v=h.motionValue)==null?void 0:v.owner)==null?void 0:_.current;let g;if(p)try{g=new Dhe({...h,element:m})}catch{g=new Ik(h)}else g=new Ik(h);g.finished.then(()=>{this.notifyFinished()}).catch(tl),this.pendingTimeline&&(this.stopTimeline=g.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=g}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),Ahe()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),(e=this.keyframeResolver)==null||e.cancel()}}function zW(t,e,n,r=0,i=1){const s=Array.from(t).sort((c,u)=>c.sortNodePosition(u)).indexOf(e),a=t.size,o=(a-1)*r;return typeof n=="function"?n(s,a):i===1?s*r:o-s*r}const Ghe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Hhe(t){const e=Ghe.exec(t);if(!e)return[,];const[,n,r,i]=e;return[`--${n??r}`,i]}const Khe=4;function $W(t,e,n=1){Ov(n<=Khe,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[r,i]=Hhe(t);if(!r)return;const s=window.getComputedStyle(e).getPropertyValue(r);if(s){const a=s.trim();return iW(a)?parseFloat(a):a}return BR(i)?$W(i,e,n+1):i}const Jhe={type:"spring",stiffness:500,damping:25,restSpeed:10},Yhe=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),Xhe={type:"keyframes",duration:.8},Qhe={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Zhe=(t,{keyframes:e})=>e.length>2?Xhe:o0.has(t)?t.startsWith("scale")?Yhe(e[1]):Jhe:Qhe;function VW(t,e){if(t!=null&&t.inherit&&e){const{inherit:n,...r}=t;return{...e,...r}}return t}function GR(t,e){const n=(t==null?void 0:t[e])??(t==null?void 0:t.default)??t;return n!==t?VW(n,t):n}const efe=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function tfe(t){for(const e in t)if(!efe.has(e))return!0;return!1}const HR=(t,e,n,r={},i,s)=>a=>{const o=GR(r,t)||{},l=o.delay||r.delay||0;let{elapsed:c=0}=r;c=c-Ja(l);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...o,delay:-c,onUpdate:f=>{e.set(f),o.onUpdate&&o.onUpdate(f)},onComplete:()=>{a(),o.onComplete&&o.onComplete()},name:t,motionValue:e,element:s?void 0:i};tfe(o)||Object.assign(u,Zhe(t,u)),u.duration&&(u.duration=Ja(u.duration)),u.repeatDelay&&(u.repeatDelay=Ja(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(vM(u),u.delay===0&&(d=!0)),(Qh.instantAnimations||Qh.skipAnimations||i!=null&&i.shouldSkipAnimations)&&(d=!0,vM(u),u.delay=0),u.allowFlatten=!o.type&&!o.ease,d&&!s&&e.get()!==void 0){const f=cT(u.keyframes,o);if(f!==void 0){_r.update(()=>{u.onUpdate(f),u.onComplete()});return}}return o.isSync?new Ik(u):new Whe(u)};function g6(t){const e=[{},{}];
vendor: 8,084 bytes, line 443
443return t==null||t.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function KR(t,e,n,r){if(typeof e=="function"){const[i,s]=g6(r);e=e(n!==void 0?n:t.custom,i,s)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,s]=g6(r);e=e(n!==void 0?n:t.custom,i,s)}return e}function Pp(t,e,n){const r=t.getProps();return KR(r,e,n!==void 0?n:r.custom,t)}const qW=new Set(["width","height","top","left","right","bottom",...a0]),v6=30,nfe=t=>!isNaN(parseFloat(t));class rfe{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{var s;const i=xa.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&((s=this.events.change)==null||s.notify(this.current),this.dependents))for(const a of this.dependents)a.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=xa.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=nfe(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new DR);const r=this.events[e].add(n);return e==="change"?()=>{r(),_r.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;(e=this.events.change)==null||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=xa.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>v6)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,v6);return lW(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var e,n;(e=this.dependents)==null||e.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Fv(t,e){return new rfe(t,e)}const yM=t=>Array.isArray(t);function ife(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Fv(n))}function sfe(t){return yM(t)?t[t.length-1]||0:t}function afe(t,e){const n=Pp(t,e);let{transitionEnd:r={},transition:i={},...s}=n||{};s={...s,...r};for(const a in s){const o=sfe(s[a]);ife(t,a,o)}}const Ss=t=>!!(t&&t.getVelocity);function ofe(t){return!!(Ss(t)&&t.add)}function _M(t,e){const n=t.getValue("willChange");if(ofe(n))return n.add(e);if(!n&&Qh.WillChange){const r=new Qh.WillChange("auto");t.addValue("willChange",r),r.add(e)}}function JR(t){return t.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const lfe="framerAppearId",WW="data-"+JR(lfe);function GW(t){return t.props[WW]}function cfe({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function HW(t,e,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:s,transitionEnd:a,...o}=e;const l=t.getDefaultTransition();s=s?VW(s,l):l;const c=s==null?void 0:s.reduceMotion;r&&(s=r);const u=[],d=i&&t.animationState&&t.animationState.getState()[i];for(const f in o){const h=t.getValue(f,t.latestValues[f]??null),p=o[f];if(p===void 0||d&&cfe(d,f))continue;const m={delay:n,...GR(s||{},f)},g=h.get();if(g!==void 0&&!h.isAnimating()&&!Array.isArray(p)&&p===g&&!m.velocity){_r.update(()=>h.set(p));continue}let v=!1;if(window.MotionHandoffAnimation){const x=GW(t);if(x){const T=window.MotionHandoffAnimation(x,f,_r);T!==null&&(m.startTime=T,v=!0)}}_M(t,f);const _=c??t.shouldReduceMotion;h.start(HR(f,h,p,_&&qW.has(f)?{type:!1}:m,t,v));const b=h.animation;b&&u.push(b)}if(a){const f=()=>_r.update(()=>{a&&afe(t,a)});u.length?Promise.all(u).then(f):f()}return u}function wM(t,e,n={}){var l;const r=Pp(t,e,n.type==="exit"?(l=t.presenceContext)==null?void 0:l.custom:void 0);let{transition:i=t.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);const s=r?()=>Promise.all(HW(t,r,n)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(c=0)=>{const{delayChildren:u=0,staggerChildren:d,staggerDirection:f}=i;return ufe(t,e,c,u,d,f,n)}:()=>Promise.resolve(),{when:o}=i;if(o){const[c,u]=o==="beforeChildren"?[s,a]:[a,s];return c().then(()=>u())}else return Promise.all([s(),a(n.delay)])}function ufe(t,e,n=0,r=0,i=0,s=1,a){const o=[];for(const l of t.variantChildren)l.notify("AnimationStart",e),o.push(wM(l,e,{...a,delay:n+(typeof r=="function"?0:r)+zW(t.variantChildren,l,r,i,s)}).then(()=>l.notify("AnimationComplete",e)));return Promise.all(o)}function dfe(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const i=e.map(s=>wM(t,s,n));r=Promise.all(i)}else if(typeof e=="string")r=wM(t,e,n);else{const i=typeof e=="function"?Pp(t,e,n.custom):e;r=Promise.all(HW(t,i,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}const hfe={test:t=>t==="auto",parse:t=>t},KW=t=>e=>e.test(t),JW=[s0,_t,Xc,nh,Fde,Dde,hfe],y6=t=>JW.find(KW(t));function ffe(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||aW(t):!0}const pfe=new Set(["brightness","contrast","saturate","opacity"]);function mfe(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(UR)||[];if(!r)return t;const i=n.replace(r,"");let s=pfe.has(e)?1:0;return r!==n&&(s*=100),e+"("+s+i+")"}const gfe=/\b([a-z-]*)\(.*?\)/gu,bM={...Zl,getAnimatableNone:t=>{const e=t.match(gfe);return e?e.map(mfe).join(" "):t}},xM={...Zl,getAnimatableNone:t=>{const e=Zl.parse(t);return Zl.createTransformer(t)(e.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},_6={...s0,transform:Math.round},vfe={rotate:nh,rotateX:nh,rotateY:nh,rotateZ:nh,scale:jb,scaleX:jb,scaleY:jb,scaleZ:jb,skew:nh,skewX:nh,skewY:nh,distance:_t,translateX:_t,translateY:_t,translateZ:_t,x:_t,y:_t,z:_t,perspective:_t,transformPerspective:_t,opacity:mw,originX:s6,originY:s6,originZ:_t},YR={borderWidth:_t,borderTopWidth:_t,borderRightWidth:_t,borderBottomWidth:_t,borderLeftWidth:_t,borderRadius:_t,borderTopLeftRadius:_t,borderTopRightRadius:_t,borderBottomRightRadius:_t,borderBottomLeftRadius:_t,width:_t,maxWidth:_t,height:_t,maxHeight:_t,top:_t,right:_t,bottom:_t,left:_t,inset:_t,insetBlock:_t,insetBlockStart:_t,insetBlockEnd:_t,insetInline:_t,insetInlineStart:_t,insetInlineEnd:_t,padding:_t,paddingTop:_t,paddingRight:_t,paddingBottom:_t,paddingLeft:_t,paddingBlock:_t,paddingBlockStart:_t,paddingBlockEnd:_t,paddingInline:_t,paddingInlineStart:_t,paddingInlineEnd:_t,margin:_t,marginTop:_t,marginRight:_t,marginBottom:_t,marginLeft:_t,marginBlock:_t,marginBlockStart:_t,marginBlockEnd:_t,marginInline:_t,marginInlineStart:_t,marginInlineEnd:_t,fontSize:_t,backgroundPositionX:_t,backgroundPositionY:_t,...vfe,zIndex:_6,fillOpacity:mw,strokeOpacity:mw,numOctaves:_6},yfe={...YR,color:Li,backgroundColor:Li,outlineColor:Li,fill:Li,stroke:Li,borderColor:Li,borderTopColor:Li,borderRightColor:Li,borderBottomColor:Li,borderLeftColor:Li,filter:bM,WebkitFilter:bM,mask:xM,WebkitMask:xM},YW=t=>yfe[t],_fe=new Set([bM,xM]);function XW(t,e){let n=YW(t);return _fe.has(n)||(n=Zl),n.getAnimatableNone?n.getAnimatableNone(e):void 0}
vendor: 1,723 bytes, line 443
443const wfe=new Set(["auto","none","0"]);function bfe(t,e,n){let r=0,i;for(;r<t.length&&!i;){const s=t[r];typeof s=="string"&&!wfe.has(s)&&Dv(s).values.length&&(i=t[r]),r++}if(i&&n)for(const s of e)t[s]=XW(n,i)}class xfe extends WR{constructor(e,n,r,i,s){super(e,n,r,i,s,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let u=0;u<e.length;u++){let d=e[u];if(typeof d=="string"&&(d=d.trim(),BR(d))){const f=$W(d,n.current);f!==void 0&&(e[u]=f),u===e.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!qW.has(r)||e.length!==2)return;const[i,s]=e,a=y6(i),o=y6(s),l=i6(i),c=i6(s);if(l!==c&&kh[r]){this.needsMeasurement=!0;return}if(a!==o)if(f6(a)&&f6(o))for(let u=0;u<e.length;u++){const d=e[u];typeof d=="string"&&(e[u]=parseFloat(d))}else kh[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let i=0;i<e.length;i++)(e[i]===null||ffe(e[i]))&&r.push(i);r.length&&bfe(e,r,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:r}=this;if(!e||!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=kh[r](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const i=n[n.length-1];i!==void 0&&e.getValue(r,i).jump(i,!1)}measureEndState(){var o;const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const i=e.getValue(n);i&&i.jump(this.measuredOrigin,!1);const s=r.length-1,a=r[s];r[s]=kh[n](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),(o=this.removedTransforms)!=null&&o.length&&this.removedTransforms.forEac
vendor: 50,871 bytes, line 443
443h(([l,c])=>{e.getValue(l).set(c)}),this.resolveNoneKeyframes()}}function QW(t,e,n){if(t==null)return[];if(t instanceof EventTarget)return[t];if(typeof t=="string"){const i=document.querySelectorAll(t);return i?Array.from(i):[]}return Array.from(t).filter(r=>r!=null)}const ZW=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function ox(t){return sW(t)&&"offsetHeight"in t&&!("ownerSVGElement"in t)}const{schedule:XR,cancel:l7e}=_W(queueMicrotask,!1),Cl={x:!1,y:!1};function eG(){return Cl.x||Cl.y}function kfe(t){return t==="x"||t==="y"?Cl[t]?null:(Cl[t]=!0,()=>{Cl[t]=!1}):Cl.x||Cl.y?null:(Cl.x=Cl.y=!0,()=>{Cl.x=Cl.y=!1})}function tG(t,e){const n=QW(t),r=new AbortController,i={passive:!0,...e,signal:r.signal};return[n,i,()=>r.abort()]}function Sfe(t){return!(t.pointerType==="touch"||eG())}function Tfe(t,e,n={}){const[r,i,s]=tG(t,n);return r.forEach(a=>{let o=!1,l=!1,c;const u=()=>{a.removeEventListener("pointerleave",p)},d=g=>{c&&(c(g),c=void 0),u()},f=g=>{o=!1,window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",f),l&&(l=!1,d(g))},h=()=>{o=!0,window.addEventListener("pointerup",f,i),window.addEventListener("pointercancel",f,i)},p=g=>{if(g.pointerType!=="touch"){if(o){l=!0;return}d(g)}},m=g=>{if(!Sfe(g))return;l=!1;const v=e(a,g);typeof v=="function"&&(c=v,a.addEventListener("pointerleave",p,i))};a.addEventListener("pointerenter",m,i),a.addEventListener("pointerdown",h,i)}),s}const nG=(t,e)=>e?t===e?!0:nG(t,e.parentElement):!1,QR=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,Cfe=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Efe(t){return Cfe.has(t.tagName)||t.isContentEditable===!0}const Afe=new Set(["INPUT","SELECT","TEXTAREA"]);function Pfe(t){return Afe.has(t.tagName)||t.isContentEditable===!0}const lx=new WeakSet;function w6(t){return e=>{e.key==="Enter"&&t(e)}}function l5(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const Mfe=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=w6(()=>{if(lx.has(n))return;l5(n,"down");const i=w6(()=>{l5(n,"up")}),s=()=>l5(n,"cancel");n.addEventListener("keyup",i,e),n.addEventListener("blur",s,e)});n.addEventListener("keydown",r,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),e)};function b6(t){return QR(t)&&!eG()}const x6=new WeakSet;function Nfe(t,e,n={}){const[r,i,s]=tG(t,n),a=o=>{const l=o.currentTarget;if(!b6(o)||x6.has(o))return;lx.add(l),n.stopPropagation&&x6.add(o);const c=e(l,o),u=(h,p)=>{window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",f),lx.has(l)&&lx.delete(l),b6(h)&&typeof c=="function"&&c(h,{success:p})},d=h=>{u(h,l===window||l===document||n.useGlobalTarget||nG(l,h.target))},f=h=>{u(h,!1)};window.addEventListener("pointerup",d,i),window.addEventListener("pointercancel",f,i)};return r.forEach(o=>{(n.useGlobalTarget?window:o).addEventListener("pointerdown",a,i),ox(o)&&(o.addEventListener("focus",c=>Mfe(c,i)),!Efe(o)&&!o.hasAttribute("tabindex")&&(o.tabIndex=0))}),s}function ZR(t){return sW(t)&&"ownerSVGElement"in t}const cx=new WeakMap;let rh;const rG=(t,e,n)=>(r,i)=>i&&i[0]?i[0][t+"Size"]:ZR(r)&&"getBBox"in r?r.getBBox()[e]:r[n],Rfe=rG("inline","width","offsetWidth"),Ife=rG("block","height","offsetHeight");function Lfe({target:t,borderBoxSize:e}){var n;(n=cx.get(t))==null||n.forEach(r=>{r(t,{get width(){return Rfe(t,e)},get height(){return Ife(t,e)}})})}function Ofe(t){t.forEach(Lfe)}function Dfe(){typeof ResizeObserver>"u"||(rh=new ResizeObserver(Ofe))}function Ffe(t,e){rh||Dfe();const n=QW(t);return n.forEach(r=>{let i=cx.get(r);i||(i=new Set,cx.set(r,i)),i.add(e),rh==null||rh.observe(r)}),()=>{n.forEach(r=>{const i=cx.get(r);i==null||i.delete(e),i!=null&&i.size||rh==null||rh.unobserve(r)})}}const ux=new Set;let Rg;function jfe(){Rg=()=>{const t={get width(){return window.innerWidth},get height(){return window.innerHeight}};ux.forEach(e=>e(t))},window.addEventListener("resize",Rg)}function Bfe(t){return ux.add(t),Rg||jfe(),()=>{ux.delete(t),!ux.size&&typeof Rg=="function"&&(window.removeEventListener("resize",Rg),Rg=void 0)}}function k6(t,e){return typeof t=="function"?Bfe(t):Ffe(t,e)}function Ufe(t){return ZR(t)&&t.tagName==="svg"}const zfe=[...JW,Li,Zl],$fe=t=>zfe.find(KW(t)),S6=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ig=()=>({x:S6(),y:S6()}),T6=()=>({min:0,max:0}),qi=()=>({x:T6(),y:T6()}),Vfe=new WeakMap;function uT(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function gw(t){return typeof t=="string"||Array.isArray(t)}const eI=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],tI=["initial",...eI];function dT(t){return uT(t.animate)||tI.some(e=>gw(t[e]))}function iG(t){return!!(dT(t)||t.variants)}function qfe(t,e,n){for(const r in e){const i=e[r],s=n[r];if(Ss(i))t.addValue(r,i);else if(Ss(s))t.addValue(r,Fv(i,{owner:t}));else if(s!==i)if(t.hasValue(r)){const a=t.getValue(r);a.liveStyle===!0?a.jump(i):a.hasAnimated||a.set(i)}else{const a=t.getStaticValue(r);t.addValue(r,Fv(a!==void 0?a:i,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const kM={current:null},sG={current:!1},Wfe=typeof window<"u";function Gfe(){if(sG.current=!0,!!Wfe)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>kM.current=t.matches;t.addEventListener("change",e),e()}else kM.current=!1}const C6=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Lk={};function aG(t){Lk=t}function Hfe(){return Lk}class Kfe{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:i,skipAnimations:s,blockInitialAnimation:a,visualState:o},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=WR,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const h=xa.now();this.renderScheduledAt<h&&(this.renderScheduledAt=h,_r.render(this.render,!1,!0))};const{latestValues:c,renderState:u}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=u,this.parent=e,this.props=n,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=i,this.skipAnimationsConfig=s,this.options=l,this.blockInitialAnimation=!!a,this.isControllingVariants=dT(n),this.isVariantNode=iG(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:d,...f}=this.scrapeMotionValuesFromProps(n,{},this);for(const h in f){const p=f[h];c[h]!==void 0&&Ss(p)&&p.set(c[h])}}mount(e){var n,r;if(this.hasBeenMounted)for(const i in this.initialValues)(n=this.values.get(i))==null||n.jump(this.initialValues[i]),this.latestValues[i]=this.initialValues[i];this.current=e,Vfe.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((i,s)=>this.bindToMotionValue(s,i)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(sG.current||Gfe(),this.shouldReduceMotion=kM.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(r=this.parent)==null||r.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var e;this.projection&&this.projection.unmount(),Zh(this.notifyUpdate),Zh(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const r=this.features[n];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),n.accelerate&&UW.has(e)&&this.current instanceof HTMLElement){const{factory:a,keyframes:o,times:l,ease:c,duration:u}=n.accelerate,d=new jW({element:this.current,name:e,keyframes:o,times:l,ease:c,duration:Ja(u)}),f=a(d);this.valueSubscriptions.set(e,()=>{f(),d.cancel()});return}const r=o0.has(e);r&&this.onBindTransform&&this.onBindTransform();const i=n.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&_r.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let s;typeof window<"u"&&window.MotionCheckAppearSync&&(s=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{i(),s&&s(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Lk){const n=Lk[e];if(!n)continue;const{isEnabled:r,Feature:i}=n;if(!this.features[e]&&i&&r(this.props)&&(this.features[e]=new i(this)),this.features[e]){const s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):qi()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<C6.length;r++){const i=C6[r];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const s="on"+i,a=e[s];a&&(this.propEventSubscriptions[i]=this.on(i,a))}this.prevMotionValues=qfe(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const r=this.values.get(e);n!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&n!==void 0&&(r=Fv(n===null?void 0:n,{owner:this}),this.addValue(e,r)),r}readValue(e,n){let r=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return r!=null&&(typeof r=="string"&&(iW(r)||aW(r))?r=parseFloat(r):!$fe(r)&&Zl.test(n)&&(r=XW(e,n)),this.setBaseTarget(e,Ss(r)?r.get():r)),Ss(r)?r.get():r}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var s;const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const a=KR(this.props,n,(s=this.presenceContext)==null?void 0:s.custom);a&&(r=a[e])}if(n&&r!==void 0)return r;const i=this.getBaseTargetFromProps(this.props,e);return i!==void 0&&!Ss(i)?i:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new DR),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){XR.render(this.render)}}class oG extends Kfe{constructor(){super(...arguments),this.KeyframeResolver=xfe}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){const r=e.style;return r?r[n]:void 0}removeValueFromRenderState(e,{vars:n,style:r}){delete n[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Ss(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class uf{constructor(e){this.isMounted=!1,this.node=e}update(){}}function lG({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function Jfe({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function Yfe(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function c5(t){return t===void 0||t===1}function SM({scale:t,scaleX:e,scaleY:n}){return!c5(t)||!c5(e)||!c5(n)}function Gf(t){return SM(t)||cG(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function cG(t){return E6(t.x)||E6(t.y)}function E6(t){return t&&t!=="0%"}function Ok(t,e,n){const r=t-n,i=e*r;return n+i}function A6(t,e,n,r,i){return i!==void 0&&(t=Ok(t,i,r)),Ok(t,n,r)+e}function TM(t,e=0,n=1,r,i){t.min=A6(t.min,e,n,r,i),t.max=A6(t.max,e,n,r,i)}function uG(t,{x:e,y:n}){TM(t.x,e.translate,e.scale,e.originPoint),TM(t.y,n.translate,n.scale,n.originPoint)}const P6=.999999999999,M6=1.0000000000001;function Xfe(t,e,n,r=!1){var o;const i=n.length;if(!i)return;e.x=e.y=1;let s,a;for(let l=0;l<i;l++){s=n[l],a=s.projectionDelta;const{visualElement:c}=s.options;c&&c.props.style&&c.props.style.display==="contents"||(r&&s.options.layoutScroll&&s.scroll&&s!==s.root&&(Uc(t.x,-s.scroll.offset.x),Uc(t.y,-s.scroll.offset.y)),a&&(e.x*=a.x.scale,e.y*=a.y.scale,uG(t,a)),r&&Gf(s.latestValues)&&dx(t,s.latestValues,(o=s.layout)==null?void 0:o.layoutBox))}e.x<M6&&e.x>P6&&(e.x=1),e.y<M6&&e.y>P6&&(e.y=1)}function Uc(t,e){t.min+=e,t.max+=e}function N6(t,e,n,r,i=.5){const s=Ir(t.min,t.max,i);TM(t,e,n,s,r)}function R6(t,e){return typeof t=="string"?parseFloat(t)/100*(e.max-e.min):t}function dx(t,e,n){const r=n??t;N6(t.x,R6(e.x,r.x),e.scaleX,e.scale,e.originX),N6(t.y,R6(e.y,r.y),e.scaleY,e.scale,e.originY)}function dG(t,e){return lG(Yfe(t.getBoundingClientRect(),e))}function Qfe(t,e,n){const r=dG(t,n),{scroll:i}=e;return i&&(Uc(r.x,i.offset.x),Uc(r.y,i.offset.y)),r}const Zfe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},epe=a0.length;function tpe(t,e,n){let r="",i=!0;for(let s=0;s<epe;s++){const a=a0[s],o=t[a];if(o===void 0)continue;let l=!0;if(typeof o=="number")l=o===(a.startsWith("scale")?1:0);else{const c=parseFloat(o);l=a.startsWith("scale")?c===1:c===0}if(!l||n){const c=ZW(o,YR[a]);if(!l){i=!1;const u=Zfe[a]||a;r+=`${u}(${c}) `}n&&(e[a]=c)}}return r=r.trim(),n?r=n(e,i?"":r):i&&(r="none"),r}function nI(t,e,n){const{style:r,vars:i,transformOrigin:s}=t;let a=!1,o=!1;for(const l in e){const c=e[l];if(o0.has(l)){a=!0;continue}else if(bW(l)){i[l]=c;continue}else{const u=ZW(c,YR[l]);l.startsWith("origin")?(o=!0,s[l]=u):r[l]=u}}if(e.transform||(a||n?r.transform=tpe(e,t.transform,n):r.transform&&(r.transform="none")),o){const{originX:l="50%",originY:c="50%",originZ:u=0}=s;r.transformOrigin=`${l} ${c} ${u}`}}function hG(t,{style:e,vars:n},r,i){const s=t.style;let a;for(a in e)s[a]=e[a];i==null||i.applyProjectionStyles(s,r);for(a in n)s.setProperty(a,n[a])}function I6(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const vy={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(_t.test(t))t=parseFloat(t);else return t;const n=I6(t,e.target.x),r=I6(t,e.target.y);return`${n}% ${r}%`}},npe={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,i=Zl.parse(t);if(i.length>5)return r;const s=Zl.createTransformer(t),a=typeof i[0]!="number"?1:0,o=n.x.scale*e.x,l=n.y.scale*e.y;i[0+a]/=o,i[1+a]/=l;const c=Ir(o,l,.5);return typeof i[2+a]=="number"&&(i[2+a]/=c),typeof i[3+a]=="number"&&(i[3+a]/=c),s(i)}},CM={borderRadius:{...vy,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:vy,borderTopRightRadius:vy,borderBottomLeftRadius:vy,borderBottomRightRadius:vy,boxShadow:npe};function fG(t,{layout:e,layoutId:n}){return o0.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!CM[t]||t==="opacity")}function rI(t,e,n){var a;const r=t.style,i=e==null?void 0:e.style,s={};if(!r)return s;for(const o in r)(Ss(r[o])||i&&Ss(i[o])||fG(o,t)||((a=n==null?void 0:n.getValue(o))==null?void 0:a.liveStyle)!==void 0)&&(s[o]=r[o]);return s}function rpe(t){return window.getComputedStyle(t)}class ipe extends oG{constructor(){super(...arguments),this.type="html",this.renderInstance=hG}readValueFromInstance(e,n){var r;if(o0.has(n))return(r=this.projection)!=null&&r.isProjecting?hM(n):khe(e,n);{const i=rpe(e),s=(bW(n)?i.getPropertyValue(n):i[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:n}){return dG(e,n)}build(e,n,r){nI(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return rI(e,n,r)}}const spe={offset:"stroke-dashoffset",array:"stroke-dasharray"},ape={offset:"strokeDashoffset",array:"strokeDasharray"};function ope(t,e,n=1,r=0,i=!0){t.pathLength=1;const s=i?spe:ape;t[s.offset]=`${-r}`,t[s.array]=`${e} ${n}`}const lpe=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function pG(t,{attrX:e,attrY:n,attrScale:r,pathLength:i,pathSpacing:s=1,pathOffset:a=0,...o},l,c,u){if(nI(t,o,c),l){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:d,style:f}=t;d.transform&&(f.transform=d.transform,delete d.transform),(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??"50% 50%",delete d.transformOrigin),f.transform&&(f.transformBox=(u==null?void 0:u.transformBox)??"fill-box",delete d.transformBox);for(const h of lpe)d[h]!==void 0&&(f[h]=d[h],delete d[h]);e!==void 0&&(d.x=e),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&ope(d,i,s,a,!1)}const mG=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),gG=t=>typeof t=="string"&&t.toLowerCase()==="svg";function cpe(t,e,n,r){hG(t,e,void 0,r);for(const i in e.attrs)t.setAttribute(mG.has(i)?i:JR(i),e.attrs[i])}function vG(t,e,n){const r=rI(t,e,n);for(const i in t)if(Ss(t[i])||Ss(e[i])){const s=a0.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;r[s]=t[i]}return r}class upe extends oG{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=qi}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(o0.has(n)){const r=YW(n);return r&&r.default||0}return n=mG.has(n)?n:JR(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return vG(e,n,r)}build(e,n,r){pG(e,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,n,r,i){cpe(e,n,r,i)}mount(e){this.isSVGTag=gG(e.tagName),super.mount(e)}}const dpe=tI.length;function yG(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?yG(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<dpe;n++){const r=tI[n],i=t.props[r];(gw(i)||i===!1)&&(e[r]=i)}return e}function _G(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}const hpe=[...eI].reverse(),fpe=eI.length;function ppe(t){return e=>Promise.all(e.map(({animation:n,options:r})=>dfe(t,n,r)))}function mpe(t){let e=ppe(t),n=L6(),r=!0,i=!1;const s=c=>(u,d)=>{var h;const f=Pp(t,d,c==="exit"?(h=t.presenceContext)==null?void 0:h.custom:void 0);if(f){const{transition:p,transitionEnd:m,...g}=f;u={...u,...g,...m}}return u};function a(c){e=c(t)}function o(c){const{props:u}=t,d=yG(t.parent)||{},f=[],h=new Set;let p={},m=1/0;for(let v=0;v<fpe;v++){const _=hpe[v],b=n[_],x=u[_]!==void 0?u[_]:d[_],T=gw(x),N=_===c?b.isActive:null;N===!1&&(m=v);let A=x===d[_]&&x!==u[_]&&T;if(A&&(r||i)&&t.manuallyAnimateOnMount&&(A=!1),b.protectedKeys={...p},!b.isActive&&N===null||!x&&!b.prevProp||uT(x)||typeof x=="boolean")continue;if(_==="exit"&&b.isActive&&N!==!0){b.prevResolvedValues&&(p={...p,...b.prevResolvedValues});continue}const L=gpe(b.prevProp,x);let M=L||_===c&&b.isActive&&!A&&T||v>m&&T,B=!1;const R=Array.isArray(x)?x:[x];let j=R.reduce(s(_),{});N===!1&&(j={});const{prevResolvedValues:$={}}=b,U={...$,...j},te=V=>{M=!0,h.has(V)&&(B=!0,h.delete(V)),b.needsAnimating[V]=!0;const q=t.getValue(V);q&&(q.liveStyle=!1)};for(const V in U){const q=j[V],se=$[V];if(p.hasOwnProperty(V))continue;let he=!1;yM(q)&&yM(se)?he=!_G(q,se):he=q!==se,he?q!=null?te(V):h.add(V):q!==void 0&&h.has(V)?te(V):b.protectedKeys[V]=!0}b.prevProp=x,b.prevResolvedValues=j,b.isActive&&(p={...p,...j}),(r||i)&&t.blockInitialAnimation&&(M=!1);const ne=A&&L;M&&(!ne||B)&&f.push(...R.map(V=>{const q={type:_};if(typeof V=="string"&&(r||i)&&!ne&&t.manuallyAnimateOnMount&&t.parent){const{parent:se}=t,he=Pp(se,V);if(se.enteringChildren&&he){const{delayChildren:z}=he.transition||{};q.delay=zW(se.enteringChildren,t,z)}}return{animation:V,options:q}}))}if(h.size){const v={};if(typeof u.initial!="boolean"){const _=Pp(t,Array.isArray(u.initial)?u.initial[0]:u.initial);_&&_.transition&&(v.transition=_.transition)}h.forEach(_=>{const b=t.getBaseTarget(_),x=t.getValue(_);x&&(x.liveStyle=!0),v[_]=b??null}),f.push({animation:v})}let g=!!f.length;return r&&(u.initial===!1||u.initial===u.animate)&&!t.manuallyAnimateOnMount&&(g=!1),r=!1,i=!1,g?e(f):Promise.resolve()}function l(c,u){var f;if(n[c].isActive===u)return Promise.resolve();(f=t.variantChildren)==null||f.forEach(h=>{var p;return(p=h.animationState)==null?void 0:p.setActive(c,u)}),n[c].isActive=u;const d=o(c);for(const h in n)n[h].protectedKeys={};return d}return{animateChanges:o,setActive:l,setAnimateFunction:a,getState:()=>n,reset:()=>{n=L6(),i=!0}}}function gpe(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!_G(e,t):!1}function Df(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function L6(){return{animate:Df(!0),whileInView:Df(),whileHover:Df(),whileTap:Df(),whileDrag:Df(),whileFocus:Df(),exit:Df()}}function EM(t,e){t.min=e.min,t.max=e.max}function kl(t,e){EM(t.x,e.x),EM(t.y,e.y)}function O6(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}const wG=1e-4,vpe=1-wG,ype=1+wG,bG=.01,_pe=0-bG,wpe=0+bG;function ka(t){return t.max-t.min}function bpe(t,e,n){return Math.abs(t-e)<=n}function D6(t,e,n,r=.5){t.origin=r,t.originPoint=Ir(e.min,e.max,t.origin),t.scale=ka(n)/ka(e),t.translate=Ir(n.min,n.max,t.origin)-t.originPoint,(t.scale>=vpe&&t.scale<=ype||isNaN(t.scale))&&(t.scale=1),(t.translate>=_pe&&t.translate<=wpe||isNaN(t.translate))&&(t.translate=0)}function b_(t,e,n,r){D6(t.x,e.x,n.x,r?r.originX:void 0),D6(t.y,e.y,n.y,r?r.originY:void 0)}function F6(t,e,n,r=0){const i=r?Ir(n.min,n.max,r):n.min;t.min=i+e.min,t.max=t.min+ka(e)}function xpe(t,e,n,r){F6(t.x,e.x,n.x,r==null?void 0:r.x),F6(t.y,e.y,n.y,r==null?void 0:r.y)}function j6(t,e,n,r=0){const i=r?Ir(n.min,n.max,r):n.min;t.min=e.min-i,t.max=t.min+ka(e)}function Dk(t,e,n,r){j6(t.x,e.x,n.x,r==null?void 0:r.x),j6(t.y,e.y,n.y,r==null?void 0:r.y)}function B6(t,e,n,r,i){return t-=e,t=Ok(t,1/n,r),i!==void 0&&(t=Ok(t,1/i,r)),t}function kpe(t,e=0,n=1,r=.5,i,s=t,a=t){if(Xc.test(e)&&(e=parseFloat(e),e=Ir(a.min,a.max,e/100)-a.min),typeof e!="number")return;let o=Ir(s.min,s.max,r);t===s&&(o-=e),t.min=B6(t.min,e,n,o,i),t.max=B6(t.max,e,n,o,i)}function U6(t,e,[n,r,i],s,a){kpe(t,e[n],e[r],e[i],e.scale,s,a)}const Spe=["x","scaleX","originX"],Tpe=["y","scaleY","originY"];function z6(t,e,n,r){U6(t.x,e,Spe,n?n.x:void 0,r?r.x:void 0),U6(t.y,e,Tpe,n?n.y:void 0,r?r.y:void 0)}function $6(t){return t.translate===0&&t.scale===1}function xG(t){return $6(t.x)&&$6(t.y)}function V6(t,e){return t.min===e.min&&t.max===e.max}function Cpe(t,e){return V6(t.x,e.x)&&V6(t.y,e.y)}function q6(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function kG(t,e){return q6(t.x,e.x)&&q6(t.y,e.y)}function W6(t){return ka(t.x)/ka(t.y)}function G6(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}function Lc(t){return[t("x"),t("y")]}function Epe(t,e,n){let r="";const i=t.x.translate/e.x,s=t.y.translate/e.y,a=(n==null?void 0:n.z)||0;if((i||s||a)&&(r=`translate3d(${i}px, ${s}px, ${a}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:c,rotate:u,rotateX:d,rotateY:f,skewX:h,skewY:p}=n;c&&(r=`perspective(${c}px) ${r}`),u&&(r+=`rotate(${u}deg) `),d&&(r+=`rotateX(${d}deg) `),f&&(r+=`rotateY(${f}deg) `),h&&(r+=`skewX(${h}deg) `),p&&(r+=`skewY(${p}deg) `)}const o=t.x.scale*e.x,l=t.y.scale*e.y;return(o!==1||l!==1)&&(r+=`scale(${o}, ${l})`),r||"none"}const SG=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],Ape=SG.length,H6=t=>typeof t=="string"?parseFloat(t):t,K6=t=>typeof t=="number"||_t.test(t);function Ppe(t,e,n,r,i,s){i?(t.opacity=Ir(0,n.opacity??1,Mpe(r)),t.opacityExit=Ir(e.opacity??1,0,Npe(r))):s&&(t.opacity=Ir(e.opacity??1,n.opacity??1,r));for(let a=0;a<Ape;a++){const o=SG[a];let l=J6(e,o),c=J6(n,o);if(l===void 0&&c===void 0)continue;l||(l=0),c||(c=0),l===0||c===0||K6(l)===K6(c)?(t[o]=Math.max(Ir(H6(l),H6(c),r),0),(Xc.test(c)||Xc.test(l))&&(t[o]+="%")):t[o]=c}(e.rotate||n.rotate)&&(t.rotate=Ir(e.rotate||0,n.rotate||0,r))}function J6(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const Mpe=TG(0,.5,mW),Npe=TG(.5,.95,tl);function TG(t,e,n){return r=>r<t?0:r>e?1:n(pw(t,e,r))}function Rpe(t,e,n){const r=Ss(t)?t:Fv(t);return r.start(HR("",r,e,n)),r.animation}function vw(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}const Ipe=(t,e)=>t.depth-e.depth;class Lpe{constructor(){this.children=[],this.isDirty=!1}add(e){OR(this.children,e),this.isDirty=!0}remove(e){Pk(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Ipe),this.isDirty=!1,this.children.forEach(e)}}function Ope(t,e){const n=xa.now(),r=({timestamp:i})=>{const s=i-n;s>=e&&(Zh(r),t(s-e))};return _r.setup(r,!0),()=>Zh(r)}function hx(t){return Ss(t)?t.get():t}class Dpe{constructor(){this.members=[]}add(e){OR(this.members,e);for(let n=this.members.length-1;n>=0;n--){const r=this.members[n];if(r===e||r===this.lead||r===this.prevLead)continue;const i=r.instance;(!i||i.isConnected===!1)&&!r.snapshot&&(Pk(this.members,r),r.unmount())}e.scheduleRender()}remove(e){if(Pk(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){var n;for(let r=this.members.indexOf(e)-1;r>=0;r--){const i=this.members[r];if(i.isPresent!==!1&&((n=i.instance)==null?void 0:n.isConnected)!==!1)return this.promote(i),!0}return!1}promote(e,n){var i;const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.updateSnapshot(),e.scheduleRender();const{layoutDependency:s}=r.options,{layoutDependency:a}=e.options;(s===void 0||s!==a)&&(e.resumeFrom=r,n&&(r.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),(i=e.root)!=null&&i.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{var n,r,i,s,a;(r=(n=e.options).onExitComplete)==null||r.call(n),(a=(i=e.resumingFrom)==null?void 0:(s=i.options).onExitComplete)==null||a.call(s)})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){var e;(e=this.lead)!=null&&e.snapshot&&(this.lead.snapshot=void 0)}}const fx={hasAnimatedSinceResize:!0,hasEverUpdated:!1},u5=["","X","Y","Z"],Fpe=1e3;let jpe=0;function d5(t,e,n,r){const{latestValues:i}=e;i[t]&&(n[t]=i[t],e.setStaticValue(t,0),r&&(r[t]=0))}function CG(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=GW(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",_r,!(i||s))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&CG(r)}function EG({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(a={},o=e==null?void 0:e()){this.id=jpe++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(zpe),this.nodes.forEach(Hpe),this.nodes.forEach(Kpe),this.nodes.forEach($pe)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=o?o.root||o:this,this.path=o?[...o.path,o]:[],this.parent=o,this.depth=o?o.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new Lpe)}addEventListener(a,o){return this.eventHandlers.has(a)||this.eventHandlers.set(a,new DR),this.eventHandlers.get(a).add(o)}notifyListeners(a,...o){const l=this.eventHandlers.get(a);l&&l.notify(...o)}hasListeners(a){return this.eventHandlers.has(a)}mount(a){if(this.instance)return;this.isSVG=ZR(a)&&!Ufe(a),this.instance=a;const{layoutId:o,layout:l,visualElement:c}=this.options;if(c&&!c.current&&c.mount(a),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(l||o)&&(this.isLayoutDirty=!0),t){let u,d=0;const f=()=>this.root.updateBlockedByResize=!1;_r.read(()=>{d=window.innerWidth}),t(a,()=>{const h=window.innerWidth;h!==d&&(d=h,this.root.updateBlockedByResize=!0,u&&u(),u=Ope(f,250),fx.hasAnimatedSinceResize&&(fx.hasAnimatedSinceResize=!1,this.nodes.forEach(Q6)))})}o&&this.root.registerSharedNode(o,this),this.options.animate!==!1&&c&&(o||l)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:d,hasRelativeLayoutChanged:f,layout:h})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const p=this.options.transition||c.getDefaultTransition()||Zpe,{onLayoutAnimationStart:m,onLayoutAnimationComplete:g}=c.getProps(),v=!this.targetLayout||!kG(this.targetLayout,h),_=!d&&f;if(this.options.layoutRoot||this.resumeFrom||_||d&&(v||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const b={...GR(p,"layout"),onPlay:m,onComplete:g};(c.shouldReduceMotion||this.options.layoutRoot)&&(b.delay=0,b.type=!1),this.startAnimation(b),this.setAnimationOrigin(u,_)}else d||Q6(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=h})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Zh(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Jpe),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&CG(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const d=this.path[u];d.shouldResetTransform=!0,(typeof d.latestValues.x=="string"||typeof d.latestValues.y=="string")&&(d.isLayoutDirty=!0),d.updateScroll("snapshot"),d.options.layoutRoot&&d.willUpdate(!1)}const{layoutId:o,layout:l}=this.options;if(o===void 0&&!l)return;const c=this.getTransformTemplate();this.prevTransformTemplateValue=c?c(this.latestValues,""):void 0,this.updateSnapshot(),a&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const l=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),l&&this.nodes.forEach(qpe),this.nodes.forEach(Y6);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(X6);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Wpe),this.nodes.forEach(Gpe),this.nodes.forEach(Bpe),this.nodes.forEach(Upe)):this.nodes.forEach(X6),this.clearAllSnapshots();const o=xa.now();ks.delta=ru(0,1e3/60,o-ks.timestamp),ks.timestamp=o,ks.isProcessing=!0,n5.update.process(ks),n5.preRender.process(ks),n5.render.process(ks),ks.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,XR.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Vpe),this.sharedNodes.forEach(Ype)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,_r.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){_r.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!ka(this.snapshot.measuredBox.x)&&!ka(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l<this.path.length;l++)this.path[l].updateScroll();const a=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=qi()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:o}=this.options;o&&o.notify("LayoutMeasure",this.layout.layoutBox,a?a.layoutBox:void 0)}updateScroll(a="measure"){let o=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===a&&(o=!1),o&&this.instance){const l=r(this.instance);this.scroll={animationId:this.root.animationId,phase:a,isRoot:l,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:l}}}resetTransform(){if(!i)return;const a=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,o=this.projectionDelta&&!xG(this.projectionDelta),l=this.getTransformTemplate(),c=l?l(this.latestValues,""):void 0,u=c!==this.prevTransformTemplateValue;a&&this.instance&&(o||Gf(this.latestValues)||u)&&(i(this.instance,c),this.shouldResetTransform=!1,this.scheduleRender())}measure(a=!0){const o=this.measurePageBox();let l=this.removeElementScroll(o);return a&&(l=this.removeTransform(l)),eme(l),{animationId:this.root.animationId,measuredBox:o,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){var c;const{visualElement:a}=this.options;if(!a)return qi();const o=a.measureViewportBox();if(!(((c=this.scroll)==null?void 0:c.wasRoot)||this.path.some(tme))){const{scroll:u}=this.root;u&&(Uc(o.x,u.offset.x),Uc(o.y,u.offset.y))}return o}removeElementScroll(a){var l;const o=qi();if(kl(o,a),(l=this.scroll)!=null&&l.wasRoot)return o;for(let c=0;c<this.path.length;c++){const u=this.path[c],{scroll:d,options:f}=u;u!==this.root&&d&&f.layoutScroll&&(d.wasRoot&&kl(o,a),Uc(o.x,d.offset.x),Uc(o.y,d.offset.y))}return o}applyTransform(a,o=!1,l){var u,d;const c=l||qi();kl(c,a);for(let f=0;f<this.path.length;f++){const h=this.path[f];!o&&h.options.layoutScroll&&h.scroll&&h!==h.root&&(Uc(c.x,-h.scroll.offset.x),Uc(c.y,-h.scroll.offset.y)),Gf(h.latestValues)&&dx(c,h.latestValues,(u=h.layout)==null?void 0:u.layoutBox)}return Gf(this.latestValues)&&dx(c,this.latestValues,(d=this.layout)==null?void 0:d.layoutBox),c}removeTransform(a){var l;const o=qi();kl(o,a);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!Gf(u.latestValues))continue;let d;u.instance&&(SM(u.latestValues)&&u.updateSnapshot(),d=qi(),kl(d,u.measurePageBox())),z6(o,u.latestValues,(l=u.snapshot)==null?void 0:l.layoutBox,d)}return Gf(this.latestValues)&&z6(o,this.latestValues),o}setTargetDelta(a){this.targetDelta=a,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(a){this.options={...this.options,...a,crossfade:a.crossfade!==void 0?a.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==ks.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(a=!1){var h;const o=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=o.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=o.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=o.isSharedProjectionDirty);const l=!!this.resumingFrom||this!==o;if(!(a||l&&this.isSharedProjectionDirty||this.isProjectionDirty||(h=this.parent)!=null&&h.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:u,layoutId:d}=this.options;if(!this.layout||!(u||d))return;this.resolvedRelativeTargetAt=ks.timestamp;const f=this.getClosestProjectingParent();f&&this.linkedParentVersion!==f.layoutVersion&&!f.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&f&&f.layout?this.createRelativeTarget(f,this.layout.layoutBox,f.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=qi(),this.targetWithTransforms=qi()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),xpe(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):kl(this.target,this.layout.layoutBox),uG(this.target,this.targetDelta)):kl(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&f&&!!f.resumingFrom==!!this.resumingFrom&&!f.options.layoutScroll&&f.target&&this.animationProgress!==1?this.createRelativeTarget(f,this.target,f.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||SM(this.parent.latestValues)||cG(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(a,o,l){this.relativeParent=a,this.linkedParentVersion=a.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=qi(),this.relativeTargetOrigin=qi(),Dk(this.relativeTargetOrigin,o,l,this.options.layoutAnchor||void 0),kl(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var p;const a=this.getLead(),o=!!this.resumingFrom||this!==a;let l=!0;if((this.isProjectionDirty||(p=this.parent)!=null&&p.isProjectionDirty)&&(l=!1),o&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(l=!1),this.resolvedRelativeTargetAt===ks.timestamp&&(l=!1),l)return;const{layout:c,layoutId:u}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(c||u))return;kl(this.layoutCorrected,this.layout.layoutBox);const d=this.treeScale.x,f=this.treeScale.y;Xfe(this.layoutCorrected,this.treeScale,this.path,o),a.layout&&!a.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(a.target=a.layout.layoutBox,a.targetWithTransforms=qi());const{target:h}=a;if(!h){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(O6(this.prevProjectionDelta.x,this.projectionDelta.x),O6(this.prevProjectionDelta.y,this.projectionDelta.y)),b_(this.projectionDelta,this.layoutCorrected,h,this.latestValues),(this.treeScale.x!==d||this.treeScale.y!==f||!G6(this.projectionDelta.x,this.prevProjectionDelta.x)||!G6(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",h))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(a=!0){var o;if((o=this.options.visualElement)==null||o.scheduleRender(),a){const l=this.getStack();l&&l.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Ig(),this.projectionDelta=Ig(),this.projectionDeltaWithTransform=Ig()}setAnimationOrigin(a,o=!1){const l=this.snapshot,c=l?l.latestValues:{},u={...this.latestValues},d=Ig();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!o;const f=qi(),h=l?l.source:void 0,p=this.layout?this.layout.source:void 0,m=h!==p,g=this.getStack(),v=!g||g.members.length<=1,_=!!(m&&!v&&this.options.crossfade===!0&&!this.path.some(Qpe));this.animationProgress=0;let b;this.mixTargetDelta=x=>{const T=x/1e3;Z6(d.x,a.x,T),Z6(d.y,a.y,T),this.setTargetDelta(d),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Dk(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),Xpe(this.relativeTarget,this.relativeTargetOrigin,f,T),b&&Cpe(this.relativeTarget,b)&&(this.isProjectionDirty=!1),b||(b=qi()),kl(b,this.relativeTarget)),m&&(this.animationValues=u,Ppe(u,c,this.latestValues,T,_,v)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=T},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){var o,l,c;this.notifyListeners("animationStart"),(o=this.currentAnimation)==null||o.stop(),(c=(l=this.resumingFrom)==null?void 0:l.currentAnimation)==null||c.stop(),this.pendingAnimation&&(Zh(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=_r.update(()=>{fx.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Fv(0)),this.motionValue.jump(0,!1),this.currentAnimation=Rpe(this.motionValue,[0,1e3],{...a,velocity:0,isSync:!0,onUpdate:u=>{this.mixTargetDelta(u),a.onUpdate&&a.onUpdate(u)},onStop:()=>{},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Fpe),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:o,target:l,layout:c,latestValues:u}=a;if(!(!o||!l||!c)){if(this!==a&&this.layout&&c&&AG(this.options.animationType,this.layout.layoutBox,c.layoutBox)){l=this.target||qi();const d=ka(this.layout.layoutBox.x);l.x.min=a.target.x.min,l.x.max=l.x.min+d;const f=ka(this.layout.layoutBox.y);l.y.min=a.target.y.min,l.y.max=l.y.min+f}kl(o,l),dx(o,u),b_(this.projectionDeltaWithTransform,this.layoutCorrected,o,u)}}registerSharedNode(a,o){this.sharedNodes.has(a)||this.sharedNodes.set(a,new Dpe),this.sharedNodes.get(a).add(o);const c=o.options.initialPromotionConfig;o.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(o):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())==null?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())==null?void 0:o.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:o,preserveFollowOpacity:l}={}){const c=this.getStack();c&&c.promote(this,l),a&&(this.projectionDelta=void 0,this.needsReset=!0),o&&this.setOptions({transition:o})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let o=!1;const{latestValues:l}=a;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(o=!0),!o)return;const c={};l.z&&d5("z",a,c,this.animationValues);for(let u=0;u<u5.length;u++)d5(`rotate${u5[u]}`,a,c,this.animationValues),d5(`skew${u5[u]}`,a,c,this.animationValues);a.render();for(const u in c)a.setStaticValue(u,c[u]),this.animationValues&&(this.animationValues[u]=c[u]);a.scheduleRender()}applyProjectionStyles(a,o){if(!this.instance||this.isSVG)return;if(!this.isVisible){a.visibility="hidden";return}const l=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,a.visibility="",a.opacity="",a.pointerEvents=hx(o==null?void 0:o.pointerEvents)||"",a.transform=l?l(this.latestValues,""):"none";return}const c=this.getLead();if(!this.projectionDelta||!this.layout||!c.target){this.options.layoutId&&(a.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,a.pointerEvents=hx(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!Gf(this.latestValues)&&(a.transform=l?l({},""):"none",this.hasProjected=!1);return}a.visibility="";const u=c.animationValues||c.latestValues;this.applyTransformsToTarget();let d=Epe(this.projectionDeltaWithTransform,this.treeScale,u);l&&(d=l(u,d)),a.transform=d;const{x:f,y:h}=this.projectionDelta;a.transformOrigin=`${f.origin*100}% ${h.origin*100}% 0`,c.animationValues?a.opacity=c===this?u.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:u.opacityExit:a.opacity=c===this?u.opacity!==void 0?u.opacity:"":u.opacityExit!==void 0?u.opacityExit:0;for(const p in CM){if(u[p]===void 0)continue;const{correct:m,applyTo:g,isCSSVariable:v}=CM[p],_=d==="none"?u[p]:m(u[p],c);if(g){const b=g.length;for(let x=0;x<b;x++)a[g[x]]=_}else v?this.options.visualElement.renderState.vars[p]=_:a[p]=_}this.options.layoutId&&(a.pointerEvents=c===this?hx(o==null?void 0:o.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(a=>{var o;return(o=a.currentAnimation)==null?void 0:o.stop()}),this.root.nodes.forEach(Y6),this.root.sharedNodes.clear()}}}function Bpe(t){t.updateLayout()}function Upe(t){var n;const e=((n=t.resumeFrom)==null?void 0:n.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:i}=t.layout,{animationType:s}=t.options,a=e.source!==t.layout.source;if(s==="size")Lc(d=>{const f=a?e.measuredBox[d]:e.layoutBox[d],h=ka(f);f.min=r[d].min,f.max=f.min+h});else if(s==="x"||s==="y"){const d=s==="x"?"y":"x";EM(a?e.measuredBox[d]:e.layoutBox[d],r[d])}else AG(s,e.layoutBox,r)&&Lc(d=>{const f=a?e.measuredBox[d]:e.layoutBox[d],h=ka(r[d]);f.max=f.min+h,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[d].max=t.relativeTarget[d].min+h)});const o=Ig();b_(o,r,e.layoutBox);const l=Ig();a?b_(l,t.applyTransform(i,!0),e.measuredBox):b_(l,r,e.layoutBox);const c=!xG(o);let u=!1;if(!t.resumeFrom){const d=t.getClosestProjectingParent();if(d&&!d.resumeFrom){const{snapshot:f,layout:h}=d;if(f&&h){const p=t.options.layoutAnchor||void 0,m=qi();Dk(m,e.layoutBox,f.layoutBox,p);const g=qi();Dk(g,r,h.layoutBox,p),kG(m,g)||(u=!0),d.options.layoutRoot&&(t.relativeTarget=g,t.relativeTargetOrigin=m,t.relativeParent=d)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:e,delta:l,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:u})}else if(t.isLead()){const{onExitComplete:r}=t.options;r&&r()}t.options.transition=void 0}function zpe(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function $pe(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Vpe(t){t.clearSnapshot()}function Y6(t){t.clearMeasurements()}function qpe(t){t.isLayoutDirty=!0,t.updateLayout()}function X6(t){t.isLayoutDirty=!1}function Wpe(t){t.isAnimationBlocked&&t.layout&&!t.isLayoutDirty&&(t.snapshot=t.layout,t.isLayoutDirty=!0)}function Gpe(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function Q6(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function Hpe(t){t.resolveTargetDelta()}function Kpe(t){t.calcProjection()}
443function Jpe(t){t.resetSkewAndRotation()}function Ype(t){t.removeLeadSnapshot()}function Z6(t,e,n){t.translate=Ir(e.translate,0,n),t.scale=Ir(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function ej(t,e,n,r){t.min=Ir(e.min,n.min,r),t.max=Ir(e.max,n.max,r)}function Xpe(t,e,n,r){ej(t.x,e.x,n.x,r),ej(t.y,e.y,n.y,r)}function Qpe(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const Zpe={duration:.45,ease:[.4,0,.1,1]},tj=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),nj=tj("applewebkit/")&&!tj("chrome/")?Math.round:tl;function rj(t){t.min=nj(t.min),t.max=nj(t.max)}function eme(t){rj(t.x),rj(t.y)}function AG(t,e,n){return t==="position"||t==="preserve-aspect"&&!bpe(W6(e),W6(n),.2)}function tme(t){var e;return t!==t.root&&((e=t.scroll)==null?void 0:e.wasRoot)}const nme=EG({attachResizeListener:(t,e)=>vw(t,"resize",e),measureScroll:()=>{var t,e;return{x:document.documentElement.scrollLeft||((t=document.body)==null?void 0:t.scrollLeft)||0,y:document.documentElement.scrollTop||((e=document.body)==null?void 0:e.scrollTop)||0}},checkIsScrollRoot:()=>!0}),h5={current:void 0},PG=EG({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!h5.current){const t=new nme({});t.mount(window),t.setOptions({layoutScroll:!0}),h5.current=t}return h5.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),iI=I.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function ij(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function rme(...t){return e=>{let n=!1;const r=t.map(i=>{const s=ij(i,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i<r.length;i++){const s=r[i];typeof s=="function"?s():ij(t[i],null)}}}}function ime(...t){return I.useCallback(rme(...t),t)}class sme extends I.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(ox(n)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const r=n.offsetParent,i=ox(r)&&r.offsetWidth||0,s=ox(r)&&r.offsetHeight||0,a=getComputedStyle(n),o=this.props.sizeRef.current;o.height=parseFloat(a.height),o.width=parseFloat(a.width),o.top=n.offsetTop,o.left=n.offsetLeft,o.right=i-o.width-o.left,o.bottom=s-o.height-o.top}return null}componentDidUpdate(){}render(){return this.props.children}}function ame({children:t,isPresent:e,anchorX:n,anchorY:r,root:i,pop:s}){var f;const a=I.useId(),o=I.useRef(null),l=I.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:c}=I.useContext(iI),u=((f=t.props)==null?void 0:f.ref)??(t==null?void 0:t.ref),d=ime(o,u);return I.useInsertionEffect(()=>{const{width:h,height:p,top:m,left:g,right:v,bottom:_}=l.current;if(e||s===!1||!o.current||!h||!p)return;const b=n==="left"?`left: ${g}`:`right: ${v}`,x=r==="bottom"?`bottom: ${_}`:`top: ${m}`;o.current.dataset.motionPopId=a;const T=document.createElement("style");c&&(T.nonce=c);const N=i??document.head;return N.appendChild(T),T.sheet&&T.sheet.insertRule(` 444 [data-motion-pop-id="${a}"] { 445 position: absolute !important; 446 width: ${h}px !important; 447 height: ${p}px !important; 448 ${b}px !important; 449 ${x}px !important; 450 } 451 `),()=>{var A;(A=o.current)==null||A.removeAttribute("data-motion-pop-id"),N.contains(T)&&N.removeChild(T)}},[e]),w.jsx(sme,{isPresent:e,childRef:o,sizeRef:l,pop:s,children:s===!1?t:I.cloneElement(t,{ref:d})})}const ome=({children:t,initial:e,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:s,mode:a,anchorX:o,anchorY:l,root:c})=>{const u=LR(lme),d=I.useId();let f=!0,h=I.useMemo(()=>(f=!1,{id:d,initial:e,isPresent:n,custom:i,onExitComplete:p=>{u.set(p,!0);for(const m of u.values())if(!m)return;r&&r()},register:p=>(u.set(p,!1),()=>u.delete(p))}),[n,u,r]);return s&&f&&(h={...h}),I.useMemo(()=>{u.forEach((p,m)=>u.set(m,!1))},[n]),I.useEffect(()=>{!n&&!u.size&&r&&r()},[n]),t=w.jsx(ame,{pop:a==="popLayout",isPresent:n,anchorX:o,anchorY:l,root:c,children:t}),w.jsx(oT.Provider,{value:h,children:t})};function lme(){return new Map}function MG(t=!0){const e=I.useContext(oT);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:i}=e,s=I.useId();I.useEffect(()=>{if(t)return i(s)},[t]);const a=I.useCallback(()=>t&&r&&r(s),[s,r,t]);return!n&&r?[!1,a]:[!0]}const Bb=t=>t.key||"";function sj(t){const e=[];
vendor: 5,425 bytes, line 451
451return I.Children.forEach(t,n=>{I.isValidElement(n)&&e.push(n)}),e}const cme=({children:t,custom:e,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:s="sync",propagate:a=!1,anchorX:o="left",anchorY:l="top",root:c})=>{const[u,d]=MG(a),f=I.useMemo(()=>sj(t),[t]),h=a&&!u?[]:f.map(Bb),p=I.useRef(!0),m=I.useRef(f),g=LR(()=>new Map),v=I.useRef(new Set),[_,b]=I.useState(f),[x,T]=I.useState(f);rW(()=>{p.current=!1,m.current=f;for(let L=0;L<x.length;L++){const M=Bb(x[L]);h.includes(M)?(g.delete(M),v.current.delete(M)):g.get(M)!==!0&&g.set(M,!1)}},[x,h.length,h.join("-")]);const N=[];if(f!==_){let L=[...f];for(let M=0;M<x.length;M++){const B=x[M],R=Bb(B);h.includes(R)||(L.splice(M,0,B),N.push(B))}return s==="wait"&&N.length&&(L=N),T(sj(L)),b(f),null}const{forceRender:A}=I.useContext(IR);return w.jsx(w.Fragment,{children:x.map(L=>{const M=Bb(L),B=a&&!u?!1:f===x||h.includes(M),R=()=>{if(v.current.has(M))return;if(g.has(M))v.current.add(M),g.set(M,!0);else return;let j=!0;g.forEach($=>{$||(j=!1)}),j&&(A==null||A(),T(m.current),a&&(d==null||d()),r&&r())};return w.jsx(ome,{isPresent:B,initial:!p.current||n?void 0:!1,custom:e,presenceAffectsLayout:i,mode:s,root:c,onExitComplete:B?void 0:R,anchorX:o,anchorY:l,children:L},M)})})},NG=I.createContext({strict:!1}),aj={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let oj=!1;function ume(){if(oj)return;const t={};for(const e in aj)t[e]={isEnabled:n=>aj[e].some(r=>!!n[r])};aG(t),oj=!0}function RG(){return ume(),Hfe()}function dme(t){const e=RG();for(const n in t)e[n]={...e[n],...t[n]};aG(e)}const hme=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Fk(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||hme.has(t)}let IG=t=>!Fk(t);function fme(t){typeof t=="function"&&(IG=e=>e.startsWith("on")?!Fk(e):t(e))}try{fme(require("@emotion/is-prop-valid").default)}catch{}function pme(t,e,n){const r={};for(const i in t)i==="values"&&typeof t.values=="object"||Ss(t[i])||(IG(i)||n===!0&&Fk(i)||!e&&!Fk(i)||t.draggable&&i.startsWith("onDrag"))&&(r[i]=t[i]);return r}const hT=I.createContext({});function mme(t,e){if(dT(t)){const{initial:n,animate:r}=t;return{initial:n===!1||gw(n)?n:void 0,animate:gw(r)?r:void 0}}return t.inherit!==!1?e:{}}function gme(t){const{initial:e,animate:n}=mme(t,I.useContext(hT));return I.useMemo(()=>({initial:e,animate:n}),[lj(e),lj(n)])}function lj(t){return Array.isArray(t)?t.join(" "):t}const sI=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function LG(t,e,n){for(const r in e)!Ss(e[r])&&!fG(r,n)&&(t[r]=e[r])}function vme({transformTemplate:t},e){return I.useMemo(()=>{const n=sI();return nI(n,e,t),Object.assign({},n.vars,n.style)},[e])}function yme(t,e){const n=t.style||{},r={};return LG(r,n,t),Object.assign(r,vme(t,e)),r}function _me(t,e){const n={},r=yme(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}const OG=()=>({...sI(),attrs:{}});function wme(t,e,n,r){const i=I.useMemo(()=>{const s=OG();return pG(s,e,gG(r),t.transformTemplate,t.style),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};LG(s,t.style,t),i.style={...s,...i.style}}return i}const bme=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function aI(t){return typeof t!="string"||t.includes("-")?!1:!!(bme.indexOf(t)>-1||/[A-Z]/u.test(t))}function xme(t,e,n,{latestValues:r},i,s=!1,a){const l=(a??aI(t)?wme:_me)(e,r,i,t),c=pme(e,typeof t=="string",s),u=t!==I.Fragment?{...c,...l,ref:n}:{},{children:d}=e,f=I.useMemo(()=>Ss(d)?d.get():d,[d]);return I.createElement(t,{...u,children:f})}function kme({scrapeMotionValuesFromProps:t,createRenderState:e},n,r,i){return{latestValues:Sme(n,r,i,t),renderState:e()}}function Sme(t,e,n,r){const i={},s=r(t,{});for(const f in s)i[f]=hx(s[f]);let{initial:a,animate:o}=t;const l=dT(t),c=iG(t);e&&c&&!l&&t.inherit!==!1&&(a===void 0&&(a=e.initial),o===void 0&&(o=e.animate));let u=n?n.initial===!1:!1;u=u||a===!1;const d=u?o:a;if(d&&typeof d!="boolean"&&!uT(d)){const f=Array.isArray(d)?d:[d];for(let h=0;h<f.length;h++){const p=KR(t,f[h]);if(p){const{transitionEnd:m,transition:g,...v}=p;for(const _ in v){let b=v[_];if(Array.isArray(b)){const x=u?b.length-1:0;b=b[x]}b!==null&&(i[_]=b)}for(const _ in m)i[_]=m[_]}}}return i}const DG=t=>
vendor: 22,019 bytes, line 451
451(e,n)=>{const r=I.useContext(hT),i=I.useContext(oT),s=()=>kme(t,e,r,i);return n?s():LR(s)},Tme=DG({scrapeMotionValuesFromProps:rI,createRenderState:sI}),Cme=DG({scrapeMotionValuesFromProps:vG,createRenderState:OG}),Eme=Symbol.for("motionComponentSymbol");function Ame(t,e,n){const r=I.useRef(n);I.useInsertionEffect(()=>{r.current=n});const i=I.useRef(null);return I.useCallback(s=>{var o;s&&((o=t.onMount)==null||o.call(t,s));const a=r.current;if(typeof a=="function")if(s){const l=a(s);typeof l=="function"&&(i.current=l)}else i.current?(i.current(),i.current=null):a(s);else a&&(a.current=s);e&&(s?e.mount(s):e.unmount())},[e])}const FG=I.createContext({});function ug(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function Pme(t,e,n,r,i,s){var b,x;const{visualElement:a}=I.useContext(hT),o=I.useContext(NG),l=I.useContext(oT),c=I.useContext(iI),u=c.reducedMotion,d=c.skipAnimations,f=I.useRef(null),h=I.useRef(!1);r=r||o.renderer,!f.current&&r&&(f.current=r(t,{visualState:e,parent:a,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:u,skipAnimations:d,isSVG:s}),h.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));const p=f.current,m=I.useContext(FG);p&&!p.projection&&i&&(p.type==="html"||p.type==="svg")&&Mme(f.current,n,i,m);const g=I.useRef(!1);I.useInsertionEffect(()=>{p&&g.current&&p.update(n,l)});const v=n[WW],_=I.useRef(!!v&&typeof window<"u"&&!((b=window.MotionHandoffIsComplete)!=null&&b.call(window,v))&&((x=window.MotionHasOptimisedAnimation)==null?void 0:x.call(window,v)));return rW(()=>{h.current=!0,p&&(g.current=!0,window.MotionIsMounted=!0,p.updateFeatures(),p.scheduleRenderMicrotask(),_.current&&p.animationState&&p.animationState.animateChanges())}),I.useEffect(()=>{p&&(!_.current&&p.animationState&&p.animationState.animateChanges(),_.current&&(queueMicrotask(()=>{var T;(T=window.MotionHandoffMarkAsComplete)==null||T.call(window,v)}),_.current=!1),p.enteringChildren=void 0)}),p}function Mme(t,e,n,r){const{layoutId:i,layout:s,drag:a,dragConstraints:o,layoutScroll:l,layoutRoot:c,layoutAnchor:u,layoutCrossfade:d}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:jG(t.parent)),t.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!a||o&&ug(o),visualElement:t,animationType:typeof s=="string"?s:"both",initialPromotionConfig:r,crossfade:d,layoutScroll:l,layoutRoot:c,layoutAnchor:u})}function jG(t){if(t)return t.options.allowProjection!==!1?t.projection:jG(t.parent)}function f5(t,{forwardMotionProps:e=!1,type:n}={},r,i){r&&dme(r);const s=n?n==="svg":aI(t),a=s?Cme:Tme;function o(c,u){let d;const f={...I.useContext(iI),...c,layoutId:Nme(c)},{isStatic:h}=f,p=gme(c),m=a(c,h);if(!h&&typeof window<"u"){Rme();const g=Ime(f);d=g.MeasureLayout,p.visualElement=Pme(t,m,f,i,g.ProjectionNode,s)}return w.jsxs(hT.Provider,{value:p,children:[d&&p.visualElement?w.jsx(d,{visualElement:p.visualElement,...f}):null,xme(t,c,Ame(m,p.visualElement,u),m,h,e,s)]})}o.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const l=I.forwardRef(o);return l[Eme]=t,l}function Nme({layoutId:t}){const e=I.useContext(IR).id;return e&&t!==void 0?e+"-"+t:t}function Rme(t,e){I.useContext(NG).strict}function Ime(t){const e=RG(),{drag:n,layout:r}=e;if(!n&&!r)return{};const i={...n,...r};return{MeasureLayout:n!=null&&n.isEnabled(t)||r!=null&&r.isEnabled(t)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}function Lme(t,e){if(typeof Proxy>"u")return f5;const n=new Map,r=(s,a)=>f5(s,a,t,e),i=(s,a)=>r(s,a);return new Proxy(i,{get:(s,a)=>a==="create"?r:(n.has(a)||n.set(a,f5(a,void 0,t,e)),n.get(a))})}const Ome=(t,e)=>e.isSVG??aI(t)?new upe(e):new ipe(e,{allowProjection:t!==I.Fragment});class Dme extends uf{constructor(e){super(e),e.animationState||(e.animationState=mpe(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();uT(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let Fme=0;class jme extends uf{constructor(){super(...arguments),this.id=Fme++,this.isExitComplete=!1}update(){var s;if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;if(e&&r===!1){if(this.isExitComplete){const{initial:a,custom:o}=this.node.getProps();if(typeof a=="string"){const l=Pp(this.node,a,o);if(l){const{transition:c,transitionEnd:u,...d}=l;for(const f in d)(s=this.node.getValue(f))==null||s.jump(d[f])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const i=this.node.animationState.setActive("exit",!e);n&&!e&&i.then(()=>{this.isExitComplete=!0,n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const Bme={animation:{Feature:Dme},exit:{Feature:jme}};function h1(t){return{point:{x:t.pageX,y:t.pageY}}}const Ume=t=>e=>QR(e)&&t(e,h1(e));function x_(t,e,n,r){return vw(t,e,Ume(n),r)}const BG=({current:t})=>t?t.ownerDocument.defaultView:null,cj=(t,e)=>Math.abs(t-e);function zme(t,e){const n=cj(t.x,e.x),r=cj(t.y,e.y);return Math.sqrt(n**2+r**2)}const uj=new Set(["auto","scroll"]);class UG{constructor(e,n,{transformPagePoint:r,contextWindow:i=window,dragSnapToOrigin:s=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=h=>{this.handleScroll(h.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Ub(this.lastRawMoveEventInfo,this.transformPagePoint));const h=p5(this.lastMoveEventInfo,this.history),p=this.startEvent!==null,m=zme(h.offset,{x:0,y:0})>=this.distanceThreshold;if(!p&&!m)return;const{point:g}=h,{timestamp:v}=ks;this.history.push({...g,timestamp:v});const{onStart:_,onMove:b}=this.handlers;p||(_&&_(this.lastMoveEvent,h),this.startEvent=this.lastMoveEvent),b&&b(this.lastMoveEvent,h)},this.handlePointerMove=(h,p)=>{this.lastMoveEvent=h,this.lastRawMoveEventInfo=p,this.lastMoveEventInfo=Ub(p,this.transformPagePoint),_r.update(this.updatePoint,!0)},this.handlePointerUp=(h,p)=>{this.end();const{onEnd:m,onSessionEnd:g,resumeAnimation:v}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&v&&v(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const _=p5(h.type==="pointercancel"?this.lastMoveEventInfo:Ub(p,this.transformPagePoint),this.history);this.startEvent&&m&&m(h,_),g&&g(h,_)},!QR(e))return;this.dragSnapToOrigin=s,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=a,this.contextWindow=i||window;const l=h1(e),c=Ub(l,this.transformPagePoint),{point:u}=c,{timestamp:d}=ks;this.history=[{...u,timestamp:d}];const{onSessionStart:f}=n;f&&f(e,p5(c,this.history)),this.removeListeners=c1(x_(this.contextWindow,"pointermove",this.handlePointerMove),x_(this.contextWindow,"pointerup",this.handlePointerUp),x_(this.contextWindow,"pointercancel",this.handlePointerUp)),o&&this.startScrollTracking(o)}startScrollTracking(e){let n=e.parentElement;for(;n;){const r=getComputedStyle(n);(uj.has(r.overflowX)||uj.has(r.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const n=this.scrollPositions.get(e);if(!n)return;const r=e===window,i=r?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},s={x:i.x-n.x,y:i.y-n.y};s.x===0&&s.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=s.x,this.lastMoveEventInfo.point.y+=s.y):this.history.length>0&&(this.history[0].x-=s.x,this.history[0].y-=s.y),this.scrollPositions.set(e,i),_r.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Zh(this.updatePoint)}}function Ub(t,e){return e?{point:e(t.point)}:t}function dj(t,e){return{x:t.x-e.x,y:t.y-e.y}}function p5({point:t},e){return{point:t,delta:dj(t,zG(e)),offset:dj(t,$me(e)),velocity:Vme(e,.1)}}function $me(t){return t[0]}function zG(t){return t[t.length-1]}function Vme(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const i=zG(t);for(;n>=0&&(r=t[n],!(i.timestamp-r.timestamp>Ja(e)));)n--;if(!r)return{x:0,y:0};r===t[0]&&t.length>2&&i.timestamp-r.timestamp>Ja(e)*2&&(r=t[1]);const s=Zo(i.timestamp-r.timestamp);if(s===0)return{x:0,y:0};const a={x:(i.x-r.x)/s,y:(i.y-r.y)/s};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function qme(t,{min:e,max:n},r){return e!==void 0&&t<e?t=r?Ir(e,t,r.min):Math.max(t,e):n!==void 0&&t>n&&(t=r?Ir(n,t,r.max):Math.min(t,n)),t}function hj(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function Wme(t,{top:e,left:n,bottom:r,right:i}){return{x:hj(t.x,n,i),y:hj(t.y,e,r)}}function fj(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,r]=[r,n]),{min:n,max:r}}function Gme(t,e){return{x:fj(t.x,e.x),y:fj(t.y,e.y)}}function Hme(t,e){let n=.5;const r=ka(t),i=ka(e);return i>r?n=pw(e.min,e.max-r,t.min):r>i&&(n=pw(t.min,t.max-i,e.min)),ru(0,1,n)}function Kme(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const AM=.35;function Jme(t=AM){return t===!1?t=0:t===!0&&(t=AM),{x:pj(t,"left","right"),y:pj(t,"top","bottom")}}function pj(t,e,n){return{min:mj(t,e),max:mj(t,n)}}function mj(t,e){return typeof t=="number"?t:t[e]||0}const Yme=new WeakMap;class Xme{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=qi(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const s=d=>{n&&this.snapToCursor(h1(d).point),this.stopAnimation()},a=(d,f)=>{const{drag:h,dragPropagation:p,onDragStart:m}=this.getProps();if(h&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=kfe(h),!this.openDragLock))return;this.latestPointerEvent=d,this.latestPanInfo=f,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Lc(v=>{let _=this.getAxisMotionValue(v).get()||0;if(Xc.test(_)){const{projection:b}=this.visualElement;if(b&&b.layout){const x=b.layout.layoutBox[v];x&&(_=ka(x)*(parseFloat(_)/100))}}this.originPoint[v]=_}),m&&_r.update(()=>m(d,f),!1,!0),_M(this.visualElement,"transform");const{animationState:g}=this.visualElement;g&&g.setActive("whileDrag",!0)},o=(d,f)=>{this.latestPointerEvent=d,this.latestPanInfo=f;const{dragPropagation:h,dragDirectionLock:p,onDirectionLock:m,onDrag:g}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:v}=f;if(p&&this.currentDirection===null){this.currentDirection=Zme(v),this.currentDirection!==null&&m&&m(this.currentDirection);return}this.updateAxis("x",f.point,v),this.updateAxis("y",f.point,v),this.visualElement.render(),g&&_r.update(()=>g(d,f),!1,!0)},l=(d,f)=>{this.latestPointerEvent=d,this.latestPanInfo=f,this.stop(d,f),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{const{dragSnapToOrigin:d}=this.getProps();(d||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:u}=this.getProps();this.panSession=new UG(e,{onSessionStart:s,onStart:a,onMove:o,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,distanceThreshold:r,contextWindow:BG(this.visualElement),element:this.visualElement.current})}stop(e,n){const r=e||this.latestPointerEvent,i=n||this.latestPanInfo,s=this.isDragging;if(this.cancel(),!s||!i||!r)return;const{velocity:a}=i;this.startAnimation(a);const{onDragEnd:o}=this.getProps();o&&_r.postRender(()=>o(r,i))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,n,r){const{drag:i}=this.getProps();if(!r||!zb(e,i,this.currentDirection))return;const s=this.getAxisMotionValue(e);let a=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(a=qme(a,this.constraints[e],this.elastic[e])),s.set(a)}resolveConstraints(){var s;const{dragConstraints:e,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(s=this.visualElement.projection)==null?void 0:s.layout,i=this.constraints;e&&ug(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=Wme(r.layoutBox,e):this.constraints=!1,this.elastic=Jme(n),i!==this.constraints&&!ug(e)&&r&&this.constraints&&!this.hasMutatedConstraints&&Lc(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=Kme(r.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!ug(e))return!1;const r=e.current;Ov(r!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=Qfe(r,i.root,this.visualElement.getTransformPagePoint());let a=Gme(i.layout.layoutBox,s);if(n){const o=n(Jfe(a));this.hasMutatedConstraints=!!o,o&&(a=lG(o))}return a}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:s,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),l=this.constraints||{},c=Lc(u=>{if(!zb(u,n,this.currentDirection))return;let d=l&&l[u]||{};(a===!0||a===u)&&(d={min:0,max:0});const f=i?200:1e6,h=i?40:1e7,p={type:"inertia",velocity:r?e[u]:0,bounceStiffness:f,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...s,...d};return this.startAxisValueAnimation(u,p)});return Promise.all(c).then(o)}startAxisValueAnimation(e,n){const r=this.getAxisMotionValue(e);return _M(this.visualElement,e),r.start(HR(e,r,0,n,this.visualElement,!1))}stopAnimation(){Lc(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),i=r[n];return i||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){Lc(n=>{const{drag:r}=this.getProps();if(!zb(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(n);if(i&&i.layout){const{min:a,max:o}=i.layout.layoutBox[n],l=s.get()||0;s.set(e[n]-Ir(a,o,.5)+l)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!ug(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Lc(a=>{const o=this.getAxisMotionValue(a);if(o&&this.constraints!==!1){const l=o.get();i[a]=Hme({min:l,max:l},this.constraints[a])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),Lc(a=>{if(!zb(a,e,null))return;const o=this.getAxisMotionValue(a),{min:l,max:c}=this.constraints[a];o.set(Ir(l,c,i[a]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;Yme.set(this.visualElement,this);const e=this.visualElement.current,n=x_(e,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps(),f=c.target,h=f!==e&&Pfe(f);u&&d&&!h&&this.start(c)});let r;const i=()=>{const{dragConstraints:c}=this.getProps();ug(c)&&c.current&&(this.constraints=this.resolveRefConstraints(),r||(r=Qme(e,c.current,()=>this.scalePositionWithinConstraints())))},{projection:s}=this.visualElement,a=s.addEventListener("measure",i);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),_r.read(i);const o=vw(window,"resize",()=>this.scalePositionWithinConstraints()),l=s.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(Lc(d=>{const f=this.getAxisMotionValue(d);f&&(this.originPoint[d]+=c[d].translate,f.set(f.get()+c[d].translate))}),this.visualElement.render())});return()=>{o(),n(),a(),l&&l(),r&&r()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:a=AM,dragMomentum:o=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:s,dragElastic:a,dragMomentum:o}}}function gj(t){let e=!0;return()=>{if(e){e=!1;return}t()}}function Qme(t,e,n){const r=k6(t,gj(n)),i=k6(e,gj(n));return()=>{r(),i()}}function zb(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function Zme(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class ege extends uf{constructor(e){super(e),this.removeGroupControls=tl,this.removeListeners=tl,this.controls=new Xme(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||tl}update(){const{dragControls:e}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};e!==n&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const m5=t=>(e,n)=>{t&&_r.update(()=>t(e,n),!1,!0)};class tge extends uf{constructor(){super(...arguments),this.removePointerDownListener=tl}onPointerDown(e){this.session=new UG(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:BG(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:m5(e),onStart:m5(n),onMove:m5(r),onEnd:(s,a)=>{delete this.session,i&&_r.postRender(()=>i(s,a))}}}mount(){this.removePointerDownListener=x_(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let g5=!1;class nge extends I.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:s}=e;s&&(n.group&&n.group.add(s),r&&r.register&&i&&r.register(s),g5&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),fx.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:i,isPresent:s}=this.props,{projection:a}=r;return a&&(a.isPresent=s,e.layoutDependency!==n&&a.setOptions({...a.options,layoutDependency:n}),g5=!0,i||e.layoutDependency!==n||n===void 0||e.isPresent!==s?a.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?a.promote():a.relegate()||_r.postRender(()=>{const o=a.getStack();(!o||!o.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:e,layoutAnchor:n}=this.props,{projection:r}=e;r&&(r.options.layoutAnchor=n,r.root.didUpdate(),XR.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=e;g5=!0,i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function $G(t){const[e,n]=MG(),r=I.useContext(IR);return w.jsx(nge,{...t,layoutGroup:r,switchLayoutGroup:I.useContext(FG),isPresent:e,safeToRemove:n})}const rge={pan:{Feature:tge},drag:{Feature:ege,ProjectionNode:PG,MeasureLayout:$G}};function vj(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,s=r[i];s&&_r.postRender(()=>s(e,h1(e)))}class ige extends uf{mount(){const{current:e}=this.node;e&&(this.unmount=Tfe(e,(n,r)=>(vj(this.node,r,"Start"),i=>vj(this.node,i,"End"))))}unmount(){}}class sge extends uf{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=c1(vw(this.node.current,"focus",()=>this.onFocus()),vw(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function yj(t,e,n){const{props:r}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),s=r[i];s&&_r.postRender(()=>s(e,h1(e)))}class age extends uf{mount(){const{current:e}=this.node;if(!e)return;
451const{globalTapTarget:n,propagate:r}=this.node.props;this.unmount=Nfe(e,(i,s)=>(yj(this.node,s,"Start"),(a,{success:o})=>yj(this.node,a,o?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:(r==null?void 0:r.tap)===!1})}unmount(){}}const PM=new WeakMap,v5=new WeakMap,oge=t=>{const e=PM.get(t.target);e&&e(t)},lge=t=>{t.forEach(oge)};function cge({root:t,...e}){const n=t||document;v5.has(n)||v5.set(n,{});const r=v5.get(n),i=JSON.stringify(e);return r[i]||(r[i]=new IntersectionObserver(lge,{root:t,...e})),r[i]}function uge(t,e,n){const r=cge(e);return PM.set(t,n),r.observe(t),()=>{PM.delete(t),r.unobserve(t)}}const dge={some:0,all:1};class hge extends uf{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var l;(l=this.stopObserver)==null||l.call(this);const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:s}=e,a={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:dge[i]},o=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,s&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:f}=this.node.getProps(),h=u?d:f;h&&h(c)};this.stopObserver=uge(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(fge(e,n))&&this.startObserver()}unmount(){var e;(e=this.stopObserver)==null||e.call(this),this.hasEnteredView=!1,this.isInView=!1}}function fge({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const pge={inView:{Feature:hge},tap:{Feature:age},focus:{Feature:sge},hover:{Feature:ige}},mge={layout:{ProjectionNode:PG,MeasureLayout:$G}},gge={...Bme,...pge,...rge,...mge},ar=Lme(gge,Ome),vge=a1("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90 shadow-glow hover:shadow-[0_0_30px_hsl(var(--aqua)/0.5)]",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-primary/50 bg-transparent text-primary hover:bg-primary/10 hover:border-primary",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"text-muted-foreground hover:bg-muted hover:text-foreground",link:"text-primary underline-offset-4 hover:underline",aqua:"bg-gradient-to-r from-aqua to-aqua-glow text-primary-foreground font-semibold shadow-glow hover:shadow-[0_0_35px_hsl(var(--aqua)/0.6)] hover:scale-[1.02]",navy:"bg-navy-mid text-foreground border border-border hover:bg-muted hover:border-primary/30",status:"bg-muted/50 text-foreground border border-border/50 hover:border-primary/50"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",xl:"h-12 rounded-lg px-10 text-base",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),$t=I.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...i},s)=>{const a=r?Qv:"button";return w.jsx(a,{className:vt(vge({variant:e,size:n,className:t})),ref:s,...i})});$t.displayName="Button";const kr=I.forwardRef(({className:t,type:e,...n},r)=>w.jsx("input",{type:e,className:vt("flex h-10 w-full rounded-md border border-border/50 bg-input/50 px-3 py-2 text-sm text-foreground ring-offset-background transition-all duration-200","file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground","placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:border-primary/50","disabled:cursor-not-allowed disabled:opacity-50","hover:border-primary/30",t),ref:r,...n}));kr.displayName="Input";const VG="/assets/nautiq-logo-BYCfZULH.png",f1=({size:t="md",showText:e=!0})=>{const n={sm:{height:60},md:{height:90},lg:{height:120}},{height:r}=n[t];return w.jsx(ar.div,{className:"flex items-center",initial:{opacity:0,y:-10}
451,animate:{opacity:1,y:0},transition:{duration:.5},children:w.jsx("img",{src:VG,alt:"NautIQ Technologies",style:{height:r},className:"w-auto object-contain shadow-none"})})};function yge(t,e,n,r){function i(s){return s instanceof n?s:new n(function(a){a(s)})}return new(n||(n=Promise))(function(s,a){function o(u){try{c(r.next(u))}catch(d){a(d)}}function l(u){try{c(r.throw(u))}catch(d){a(d)}}function c(u){u.done?s(u.value):i(u.value).then(o,l)}c((r=r.apply(t,e||[])).next())})}const _ge=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class oI extends Error{constructor(e,n="FunctionsError",r){super(e),this.name=n,this.context=r}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class wge extends oI{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class _j extends oI{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class wj extends oI{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var MM;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(MM||(MM={}));class bge{constructor(e,{headers:n={},customFetch:r,region:i=MM.Any}={}){this.url=e,this.headers=n,this.region=i,this.fetch=_ge(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return yge(this,arguments,void 0,function*(n,r={}){var i;let s,a;try{const{headers:o,method:l,body:c,signal:u,timeout:d}=r;let f={},{region:h}=r;h||(h=this.region);const p=new URL(`${this.url}/${n}`);h&&h!=="any"&&(f["x-region"]=h,p.searchParams.set("forceFunctionRegion",h));let m;c&&(o&&!Object.prototype.hasOwnProperty.call(o,"Content-Type")||!o)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(f["Content-Type"]="application/octet-stream",m=c):typeof c=="string"?(f["Content-Type"]="text/plain",m=c):typeof FormData<"u"&&c instanceof FormData?m=c:(f["Content-Type"]="application/json",m=JSON.stringify(c)):c&&typeof c!="string"&&!(typeof Blob<"u"&&c instanceof Blob)&&!(c instanceof ArrayBuffer)&&!(typeof FormData<"u"&&c instanceof FormData)?m=JSON.stringify(c):m=c;let g=u;d&&(a=new AbortController,s=setTimeout(()=>a.abort(),d),u?(g=a.signal,u.addEventListener("abort",()=>a.abort())):g=a.signal);const v=yield this.fetch(p.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},f),this.headers),o),body:m,signal:g}).catch(T=>{throw new wge(T)}),_=v.headers.get("x-relay-error");if(_&&_==="true")throw new _j(v);if(!v.ok)throw new wj(v);let b=((i=v.headers.get("Content-Type"))!==null&&i!==void 0?i:"text/plain").split(";")[0].trim(),x;return b==="application/json"?x=yield v.json():b==="application/octet-stream"||b==="application/pdf"?x=yield v.blob():b==="text/event-stream"?x=v:b==="multipart/form-data"?x=yield v.formData():x=yield v.text(),{data:x,error:null,response:v}}catch(o){return{data:null,error:o,response:o instanceof wj||o instanceof _j?o.context:void 0}}finally{s&&clearTimeout(s)}})}}const qG=3,bj=t=>Math.min(1e3*2**t,3e4),xge=[520,503],WG=["GET","HEAD","OPTIONS"];var kge=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.co
451de=t.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function xj(t,e){return new Promise(n=>{if(e!=null&&e.aborted){n();return}const r=setTimeout(()=>{e==null||e.removeEventListener("abort",i),n()},t);function i(){clearTimeout(r),n()}e==null||e.addEventListener("abort",i)})}function Sge(t,e,n,r){return!(!r||n>=qG||!WG.includes(t)||!xge.includes(e))}var Tge=class{constructor(t){var e,n,r,i,s;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(e=t.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=t.signal,this.isMaybeSingle=(n=t.isMaybeSingle)!==null&&n!==void 0?n:!1,this.shouldStripNulls=(r=t.shouldStripNulls)!==null&&r!==void 0?r:!1,this.urlLengthLimit=(i=t.urlLengthLimit)!==null&&i!==void 0?i:8e3,this.retryEnabled=(s=t.retry)!==null&&s!==void 0?s:!0,t.fetch?this.fetch=t.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(t,e){return this.headers=new Headers(this.headers),this.headers.set(t,e),this}retry(t){return this.retryEnabled=t,this}then(t,e){var n=this;if(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"),this.shouldStripNulls){const a=this.headers.get("Accept");a==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!a||a==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const r=this.fetch;let s=(async()=>{let a=0;for(;;){const c=new Headers(n.headers);a>0&&c.set("X-Retry-Count",String(a));let u;try{u=await r(n.url.toString(),{method:n.method,headers:c,body:JSON.stringify(n.body,(d,f)=>typeof f=="bigint"?f.toString():f),signal:n.signal})}catch(d){if((d==null?void 0:d.name)==="AbortError"||(d==null?void 0:d.code)==="ABORT_ERR"||!WG.includes(n.method))throw d;if(n.retryEnabled&&a<qG){const f=bj(a);a++,await xj(f,n.signal);continue}throw d}if(Sge(n.method,u.status,a,n.retryEnabled)){var o,l;const d=(o=(l=u.headers)===null||l===void 0?void 0:l.get("Retry-After"))!==null&&o!==void 0?o:null,f=d!==null?Math.max(0,parseInt(d,10)||0)*1e3:bj(a);await u.text(),a++,await xj(f,n.signal);continue}return await n.processResponse(u)}})();return this.shouldThrowOnError||(s=s.catch(a=>{var o;let l="",c="",u="";const d=a==null?void 0:a.cause;if(d){var f,h,p,m;const _=(f=d==null?void 0:d.message)!==null&&f!==void 0?f:"",b=(h=d==null?void 0:d.code)!==null&&h!==void 0?h:"";l=`${(p=a==null?void 0:a.name)!==null&&p!==void 0?p:"FetchError"}: ${a==null?void 0:a.message}`,l+=` 452 453Caused by: ${(m=d==null?void 0:d.name)!==null&&m!==void 0?m:"Error"}: ${_}`,b&&(l+=` (${b})`),d!=null&&d.stack&&(l+=` 454${d.stack}`)}else{var g;l=(g=a==null?void 0:a.stack)!==null&&g!==void 0?g:""}const v=this.url.toString().length;return(a==null?void 0:a.name)==="AbortError"||(a==null?void 0:a.code)==="ABORT_ERR"?(u="",c="Request was aborted (timeout or manual cancellation)",v>this.urlLengthLimit&&(c+=`. Note: Your request URL is ${v} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((d==null?void 0:d.name)==="HeadersOverflowError"||(d==null?void 0:d.code)==="UND_ERR_HEADERS_OVERFLOW")&&(u="",c="HTTP headers exceeded server limits (typically 16KB)",v>this.urlLengthLimit&&(c+=`. Your request URL is ${v} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${(o=a==null?void 0:a.name)!==null&&o!==void 0?o:"FetchError"}: ${a==null?void 0:a.message}`,details:l,hint:c,code:u},data:null,count:null,status:0,statusText:""}}
454)),s.then(t,e)}async processResponse(t){var e=this;let n=null,r=null,i=null,s=t.status,a=t.statusText;if(t.ok){var o,l;if(e.method!=="HEAD"){var c;const f=await t.text();f===""||(e.headers.get("Accept")==="text/csv"||e.headers.get("Accept")&&(!((c=e.headers.get("Accept"))===null||c===void 0)&&c.includes("application/vnd.pgrst.plan+text"))?r=f:r=JSON.parse(f))}const u=(o=e.headers.get("Prefer"))===null||o===void 0?void 0:o.match(/count=(exact|planned|estimated)/),d=(l=t.headers.get("content-range"))===null||l===void 0?void 0:l.split("/");u&&d&&d.length>1&&(i=parseInt(d[1])),e.isMaybeSingle&&Array.isArray(r)&&(r.length>1?(n={code:"PGRST116",details:`Results contain ${r.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},r=null,i=null,s=406,a="Not Acceptable"):r.length===1?r=r[0]:r=null)}else{const u=await t.text();try{n=JSON.parse(u),Array.isArray(n)&&t.status===404&&(r=[],n=null,s=200,a="OK")}catch{t.status===404&&u===""?(s=204,a="No Content"):n={message:u}}if(n&&e.shouldThrowOnError)throw new kge(n)}return{success:n===null,error:n,data:r,count:i,status:s,statusText:a}}returns(){return this}overrideTypes(){return this}},Cge=class extends Tge{select(t){let e=!1;const n=(t??"*").split("").map(r=>/\s/.test(r)&&!e?"":(r==='"'&&(e=!e),r)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:n,foreignTable:r,referencedTable:i=r}={}){const s=i?`${i}.order`:"order",a=this.url.searchParams.get(s);return this.url.searchParams.set(s,`${a?`${a},`:""}${t}.${e?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:n=e}={}){const r=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(r,`${t}`),this}range(t,e,{foreignTable:n,referencedTable:r=n}={}){const i=typeof r>"u"?"offset":`${r}.offset`,s=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(i,`${t}`),this.url.searchParams.set(s,`${e-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:t=!1,verbose:e=!1,settings:n=!1,buffers:r=!1,wal:i=!1,format:s="text"}={}){var a;const o=[t?"analyze":null,e?"verbose":null,n?"settings":null,r?"buffers":null,i?"wal":null].filter(Boolean).join("|"),l=(a=this.headers.get("Accept"))!==null&&a!==void 0?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${s}; for="${l}"; options=${o};`),s==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};const kj=new RegExp("[,()]");var dg=class extends Cge{eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}regexMatch(t,e){return this.url.searchParams.append(t,`match.${e}`),this}regexIMatch(t,e){return this.url.searchParams.append(t,`imatch.${e}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}isDistinct(t,e){return this.url.searchParams.append(t,`isdistinct.${e}`),this}in(t,e){const n=Array.from(new Set(e)).map(r=>typeof r=="string"&&kj.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(t,`in.(${n})`),this}notIn(t,e){const n=Array.from(new Set(e)).map(r=>typeof r=="string"&&kj.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(t,`not.in.(${n})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:n,type:r}={}){let i="";r==="plain"?i="pl":r==="phrase"?i="ph":r==="websearch"&&(i="w");const s=n===void 0?"":`(${n})`;return this.url.searchParams.append(t,`${i}fts${s}.${e}`),this}match(t){return Object.entries(t).filter(([e,n])=>
454n!==void 0).forEach(([e,n])=>{this.url.searchParams.append(e,`eq.${n}`)}),this}not(t,e,n){return this.url.searchParams.append(t,`not.${e}.${n}`),this}or(t,{foreignTable:e,referencedTable:n=e}={}){const r=n?`${n}.or`:"or";return this.url.searchParams.append(r,`(${t})`),this}filter(t,e,n){return this.url.searchParams.append(t,`${e}.${n}`),this}},Ege=class{constructor(t,{headers:e={},schema:n,fetch:r,urlLengthLimit:i=8e3,retry:s}){this.url=t,this.headers=new Headers(e),this.schema=n,this.fetch=r,this.urlLengthLimit=i,this.retry=s}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(t,e){const{head:n=!1,count:r}=e??{},i=n?"HEAD":"GET";let s=!1;const a=(t??"*").split("").map(c=>/\s/.test(c)&&!s?"":(c==='"'&&(s=!s),c)).join(""),{url:o,headers:l}=this.cloneRequestState();return o.searchParams.set("select",a),r&&l.append("Prefer",`count=${r}`),new dg({method:i,url:o,headers:l,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(t,{count:e,defaultToNull:n=!0}={}){var r;const i="POST",{url:s,headers:a}=this.cloneRequestState();if(e&&a.append("Prefer",`count=${e}`),n||a.append("Prefer","missing=default"),Array.isArray(t)){const o=t.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(o.length>0){const l=[...new Set(o)].map(c=>`"${c}"`);s.searchParams.set("columns",l.join(","))}}return new dg({method:i,url:s,headers:a,schema:this.schema,body:t,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(t,{onConflict:e,ignoreDuplicates:n=!1,count:r,defaultToNull:i=!0}={}){var s;const a="POST",{url:o,headers:l}=this.cloneRequestState();if(l.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),e!==void 0&&o.searchParams.set("on_conflict",e),r&&l.append("Prefer",`count=${r}`),i||l.append("Prefer","missing=default"),Array.isArray(t)){const c=t.reduce((u,d)=>u.concat(Object.keys(d)),[]);if(c.length>0){const u=[...new Set(c)].map(d=>`"${d}"`);o.searchParams.set("columns",u.join(","))}}return new dg({method:a,url:o,headers:l,schema:this.schema,body:t,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(t,{count:e}={}){var n;const r="PATCH",{url:i,headers:s}=this.cloneRequestState();return e&&s.append("Prefer",`count=${e}`),new dg({method:r,url:i,headers:s,schema:this.schema,body:t,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:t}={}){var e;const n="DELETE",{url:r,headers:i}=this.cloneRequestState();return t&&i.append("Prefer",`count=${t}`),new dg({method:n,url:r,headers:i,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function yw(t){"@babel/helpers - typeof";return yw=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yw(t)}function Age(t,e){if(yw(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(yw(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Pge(t){var e=Age(t,"string");return yw(e)=="symbol"?e:e+""}function Mge(t,e,n){return(e=Pge(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Sj(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function $b(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Sj(Object(n),!0).forEach(function(r){Mge(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Sj(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}var Nge=class GG{constructor(e,{headers:n={},schema:r,fetch:i,timeout:s,urlLengthLimit:a=8e3,retry:o}={}){this.url=e,this.headers=new Headers(n),this.schemaName=r,this.urlLengthLimit=a;const l=i??globalThis.fetch;s!==void 0&&s>0?this.fetch=(c,u)=>{const d=new AbortController,f=setTimeout(()=>d.abort(),s),h=u==null?void 0:u.signal;if(h){if(h.aborted)return clearTimeout(f),l(c,u);const p=()=>{clearTimeout(f),d.abort()};return h.addEventListener("abort",p,{once:!0}),l(c,$b($b({},u),{},{signal:d.signal})).finally(()=>{clearTimeout(f),h.removeEventListener("abort",p)})}return l(c,$b($b({},u),{},{signal:d.signal})).finally(()=>clearTimeout(f))}:this.fetch=l,this.retry=o}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new Ege(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(e){return new GG(this.url,{headers:this.headers,schema:e,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,n={},{head:r=!1,get:i=!1,count:s}={}){var a;let o;const l=new URL(`${this.url}/rpc/${e}`);let c;const u=h=>h!==null&&typeof h=="object"&&(!Array.isArray(h)||h.some(u)),d=r&&Object.values(n).some(u);d?(o="POST",c=n):r||i?(o=r?"HEAD":"GET",Object.entries(n).filter(([h,p])=>p!==void 0).map(([h,p])=>[h,Array.isArray(p)?`{${p.join(",")}}`:`${p}
454`]).forEach(([h,p])=>{l.searchParams.append(h,p)})):(o="POST",c=n);const f=new Headers(this.headers);return d?f.set("Prefer",s?`count=${s},return=minimal`:"return=minimal"):s&&f.set("Prefer",`count=${s}`),new dg({method:o,url:l,headers:f,schema:this.schemaName,body:c,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class Rge{constructor(){}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."};const n=globalThis.process;if(n){const r=n.versions;if(r&&r.node){const i=r.node,s=parseInt(i.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: 455import ws from "ws" 456new 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 n=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(n+=` 457 458Suggested solution: ${e.workaround}`),new Error(n)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const Ige="2.105.1",Lge=`realtime-js/${Ige}`,Oge="1.0.0",HG="2.0.0",Dge=HG,Fge=1e4,jge=100,uh={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},KG={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave",access_token:"access_token"},NM={connecting:"connecting",open:"open",closing:"closing",closed:"closed"};class Bge{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=e??[]}encode(e,n){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return n(this._binaryEncodeUserBroadcastPush(e));let r=[e.join_ref,e.ref,e.topic,e.event,e.payload];return n(JSON.stringify(r))}_binaryEncodeUserBroadcastPush(e){var n;return this._isArrayBuffer((n=e.payload)===null||n===void 0?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var n,r;const i=(r=(n=e.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,i)}_encodeJsonUserBroadcastPush(e){var n,r;const i=(r=(n=e.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:{},a=new TextEncoder().encode(JSON.stringify(i)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,a)}_encodeUserBroadcastPush(e,n,r){var i,s;const a=e.topic,o=(i=e.ref)!==null&&i!==void 0?i:"",l=(s=e.join_ref)!==null&&s!==void 0?s:"",c=e.payload.event,u=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},d=Object.keys(u).length===0?"":JSON.stringify(u);if(l.length>255)throw new Error(`joinRef length ${l.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`ref length ${o.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`topic length ${a.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`userEvent length ${c.length} exceeds maximum of 255`);if(d.length>255)throw new Error(`metadata length ${d.length} exceeds maximum of 255`);const f=this.USER_BROADCAST_PUSH_META_LENGTH+l.length+o.length+a.length+c.length+d.length,h=new ArrayBuffer(this.HEADER_LENGTH+f);
458let p=new DataView(h),m=0;p.setUint8(m++,this.KINDS.userBroadcastPush),p.setUint8(m++,l.length),p.setUint8(m++,o.length),p.setUint8(m++,a.length),p.setUint8(m++,c.length),p.setUint8(m++,d.length),p.setUint8(m++,n),Array.from(l,v=>p.setUint8(m++,v.charCodeAt(0))),Array.from(o,v=>p.setUint8(m++,v.charCodeAt(0))),Array.from(a,v=>p.setUint8(m++,v.charCodeAt(0))),Array.from(c,v=>p.setUint8(m++,v.charCodeAt(0))),Array.from(d,v=>p.setUint8(m++,v.charCodeAt(0)));var g=new Uint8Array(h.byteLength+r.byteLength);return g.set(new Uint8Array(h),0),g.set(new Uint8Array(r),h.byteLength),g.buffer}decode(e,n){if(this._isArrayBuffer(e)){let r=this._binaryDecode(e);return n(r)}if(typeof e=="string"){const r=JSON.parse(e),[i,s,a,o,l]=r;return n({join_ref:i,ref:s,topic:a,event:o,payload:l})}return n({})}_binaryDecode(e){const n=new DataView(e),r=n.getUint8(0),i=new TextDecoder;switch(r){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,n,i)}}_decodeUserBroadcast(e,n,r){const i=n.getUint8(1),s=n.getUint8(2),a=n.getUint8(3),o=n.getUint8(4);let l=this.HEADER_LENGTH+4;const c=r.decode(e.slice(l,l+i));l=l+i;const u=r.decode(e.slice(l,l+s));l=l+s;const d=r.decode(e.slice(l,l+a));l=l+a;const f=e.slice(l,e.byteLength),h=o===this.JSON_ENCODING?JSON.parse(r.decode(f)):f,p={type:this.BROADCAST_EVENT,event:u,payload:h};return a>0&&(p.meta=JSON.parse(d)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:p}}_isArrayBuffer(e){var n;return e instanceof ArrayBuffer||((n=e==null?void 0:e.constructor)===null||n===void 0?void 0:n.name)==="ArrayBuffer"}_pick(e,n){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([r])=>n.includes(r)))}}var xr;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(xr||(xr={}));const Tj=(t,e,n={})=>{var r;const i=(r=n.skipTypes)!==null&&r!==void 0?r:[];return e?Object.keys(e).reduce((s,a)=>(s[a]=Uge(a,t,e,i),s),{}):{}},Uge=(t,e,n,r)=>{const i=e.find(o=>o.name===t),s=i==null?void 0:i.type,a=n[t];return s&&!r.includes(s)?JG(s,a):RM(a)},JG=(t,e)=>{if(t.charAt(0)==="_"){const n=t.slice(1,t.length);return qge(e,n)}switch(t){case xr.bool:return zge(e);case xr.float4:case xr.float8:case xr.int2:case xr.int4:case xr.int8:case xr.numeric:case xr.oid:return $ge(e);case xr.json:case xr.jsonb:return Vge(e);case xr.timestamp:return Wge(e);case xr.abstime:case xr.date:case xr.daterange:case xr.int4range:case xr.int8range:case xr.money:case xr.reltime:case xr.text:case xr.time:case xr.timestamptz:case xr.timetz:case xr.tsrange:case xr.tstzrange:return RM(e);default:return RM(e)}},RM=t=>t,zge=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},$ge=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},Vge=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},qge=(t,e)=>{if(typeof t!="string")return t;const n=t.length-1,r=t[n];if(t[0]==="{"&&r==="}"){let s;const a=t.slice(1,n);try{s=JSON.parse("["+a+"]")}catch{s=a?a.split(","):[]}return s.map(o=>JG(e,o))}return t},Wge=t=>typeof t=="string"?t.replace(" ","T"):t,YG=t=>{const e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};var k_=t=>typeof t=="function"?t:function(){return t},Gge=typeof self<"u"?self:null,hg=typeof window<"u"?window:null,Oc=Gge||hg||globalThis,Hge="2.0.0",Kge=1e4,Jge=1e3,zc={connecting:0,open:1,closing:2,closed:3},Fa={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},qu={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},IM={longpoll:"longpoll",websocket:"websocket"},Yge={complete:4},LM="base64url.bearer.phx.",Vb=class{constructor(t,e,n,r){this.channel=t,this.event=e,this.payload=n||function(){return{}},this.receivedResp=null,this.timeout=r,this.timeoutTimer=null,this.recHo
vendor: 20,934 bytes, lines 458-459
458oks=[],this.sent=!1,this.ref=void 0}resend(t){this.timeout=t,this.reset(),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()}))}receive(t,e){return this.hasReceived(t)&&e(this.receivedResp.response),this.recHooks.push({status:t,callback:e}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:t,response:e,_ref:n}){this.recHooks.filter(r=>r.status===t).forEach(r=>r.callback(e))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,t=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=t,this.matchReceive(t)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}trigger(t,e){this.channel.trigger(this.refEvent,{status:t,response:e})}},XG=class{constructor(t,e){this.callback=t,this.timerCalc=e,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},Xge=class{constructor(t,e,n){this.state=Fa.closed,this.topic=t,this.params=k_(e||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Vb(this,qu.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new XG(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=Fa.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(r=>r.send()),this.pushBuffer=[]}),this.joinPush.receive("error",r=>{this.state=Fa.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,r),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=Fa.closed,this.socket.remove(this)}),this.onError(r=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,r),this.isJoining()&&this.joinPush.reset(),this.state=Fa.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new Vb(this,qu.leave,k_({}),this.timeout).send(),this.state=Fa.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(qu.reply,(r,i)=>{this.trigger(this.replyEventName(i),r)})}join(t=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=t,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(t=>t.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Fa.closed,this.bindings=[]}onClose(t){this.on(qu.close,t)}onError(t){return this.on(qu.error,e=>t(e))}on(t,e){let n=this.bindingRef++;return this.bindings.push({event:t,ref:n,callback:e}),n}off(t,e){this.bindings=this.bindings.filter(n=>!(n.event===t&&(typeof e>"u"||e===n.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(t,e,n=this.timeout){if(e=e||{},!this.joinedOnce)throw new Error(`tried to push '${t}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let r=new Vb(this,t,function(){return e},n);return this.canPush()?r.send():(r.startTimeout(),this.pushBuffer.push(r)),r}leave(t=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=Fa.leaving;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(qu.close,"leave")},n=new Vb(this,qu.leave,k_({}),t);return n.receive("ok",()=>e()).receive("timeout",()=>e()),n.send(),this.canPush()||n.trigger("ok",{}),n}onMessage(t,e,n){return e}filterBindings(t,e,n){return!0}isMember(t,e,n,r){return this.topic!==t?!1:r&&r!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:t,event:e,payload:n,joinRef:r}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(t=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=Fa.joining,this.joinPush.resend(t))}trigger(t,e,n,r){let i=this.onMessage(t,e,n,r);if(e&&!i)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let s=this.bindings.filter(a=>a.event===t&&this.filterBindings(a,e,n));for(let a=0;a<s.length;a++)s[a].callback(i,n,r||this.joinRef())}replyEventName(t){return`chan_reply_${t}`}isClosed(){return this.state===Fa.closed}isErrored(){return this.state===Fa.errored}isJoined(){return this.state===Fa.joined}isJoining(){return this.state===Fa.joining}isLeaving(){return this.state===Fa.leaving}},jk=class{static request(t,e,n,r,i,s,a){if(Oc.XDomainRequest){let o=new Oc.XDomainRequest;return this.xdomainRequest(o,t,e,r,i,s,a)}else if(Oc.XMLHttpRequest){let o=new Oc.XMLHttpRequest;return this.xhrRequest(o,t,e,n,r,i,s,a)}else{if(Oc.fetch&&Oc.AbortController)return this.fetchRequest(t,e,n,r,i,s,a);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(t,e,n,r,i,s,a){let o={method:t,headers:n,body:r},l=null;return i&&(l=new AbortController,setTimeout(()=>l.abort(),i),o.signal=l.signal),Oc.fetch(e,o).then(c=>c.text()).then(c=>this.parseJSON(c)).then(c=>a&&a(c)).catch(c=>{c.name==="AbortError"&&s?s():a&&a(null)}),l}static xdomainRequest(t,e,n,r,i,s,a){return t.timeout=i,t.open(e,n),t.onload=()=>{let o=this.parseJSON(t.responseText);a&&a(o)},s&&(t.ontimeout=s),t.onprogress=()=>{},t.send(r),t}static xhrRequest(t,e,n,r,i,s,a,o){t.open(e,n,!0),t.timeout=s;for(let[l,c]of Object.entries(r))t.setRequestHeader(l,c);return t.onerror=()=>o&&o(null),t.onreadystatechange=()=>{if(t.readyState===Yge.complete&&o){let l=this.parseJSON(t.responseText);o(l)}},a&&(t.ontimeout=a),t.send(i),t}static parseJSON(t){if(!t||t==="")return null;try{return JSON.parse(t)}catch{return console&&console.log("failed to parse JSON response",t),null}}static serialize(t,e){let n=[];for(var r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;let i=e?`${e}[${r}]`:r,s=t[r];typeof s=="object"?n.push(this.serialize(s,i)):n.push(encodeURIComponent(i)+"="+encodeURIComponent(s))}return n.join("&")}static appendParams(t,e){if(Object.keys(e).length===0)return t;let n=t.match(/\?/)?"&":"?";return`${t}${n}${this.serialize(e)}`}},Qge=t=>{let e="",n=new Uint8Array(t),r=n.byteLength;for(let i=0;i<r;i++)e+=String.fromCharCode(n[i]);return btoa(e)},qm=class{constructor(t,e){e&&e.length===2&&e[1].startsWith(LM)&&(this.authToken=atob(e[1].slice(LM.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(t),this.readyState=zc.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(t){return t.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+IM.websocket),"$1/"+IM.longpoll)}endpointURL(){return jk.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(t,e,n){this.close(t,e,n),this.readyState=zc.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===zc.open||this.readyState===zc.connecting}poll(){const t={Accept:"application/json"};this.authToken&&(t["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",t,null,()=>this.ontimeout(),e=>{if(e){var{status:n,token:r,messages:i}=e;if(n===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=r}else n=0;switch(n){case 200:i.forEach(s=>{setTimeout(()=>this.onmessage({data:s}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=zc.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${n}`)}})}send(t){typeof t!="string"&&(t=Qge(t)),this.currentBatch?this.currentBatch.push(t):this.awaitingBatchAck?this.batchBuffer.push(t):(this.currentBatch=[t],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(t){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},t.join(` 459`),()=>this.onerror("timeout"),e=>{this.awaitingBatchAck=!1,!e||e.status!==200?(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(t,e,n){for(let i of this.reqs)i.abort();this.readyState=zc.closed;let r=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:t,reason:e,wasClean:n});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",r)):this.onclose(r)}ajax(t,e,n,r,i){let s,a=()=>{this.reqs.delete(s),r()};s=jk.request(t,this.endpointURL(),e,n,this.timeout,a,o=>{this.reqs.delete(s),this.isActive()&&i(o)}),this.reqs.add(s)}},Zge=class Qy{constructor(e,n={}){let r=n.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=e,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(r.state,i=>{let{onJoin:s,onLeave:a,onSync:o}=this.caller;this.joinRef=this.channel.joinRef(),this.state=Qy.syncState(this.state,i,s,a),this.pendingDiffs.forEach(l=>{this.state=Qy.syncDiff(this.state,l,s,a)}),this.pendingDiffs=[],o()}),this.channel.on(r.diff,i=>{let{onJoin:s,onLeave:a,onSync:o}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(i):(this.state=Qy.syncDiff(this.state,i,s,a),o())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(e){return Qy.list(this.state,e)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,n,r,i){let s=this.clone(e),a={},o={};return this.map(s,(l,c)=>{n[l]||(o[l]=c)}),this.map(n,(l,c)=>{let u=s[l];if(u){let d=c.metas.map(m=>m.phx_ref),f=u.metas.map(m=>m.phx_ref),h=c.metas.filter(m=>f.indexOf(m.phx_ref)<0),p=u.metas.filter(m=>d.indexOf(m.phx_ref)<0);h.length>0&&(a[l]=c,a[l].metas=h),p.length>0&&(o[l]=this.clone(u),o[l].metas=p)}else a[l]=c}),this.syncDiff(s,{joins:a,leaves:o},r,i)}static syncDiff(e,n,r,i){let{joins:s,leaves:a}=this.clone(n);return r||(r=function(){}),i||(i=function(){}),this.map(s,(o,l)=>{let c=e[o];if(e[o]=this.clone(l),c){let u=e[o].metas.map(f=>f.phx_ref),d=c.metas.filter(f=>u.indexOf(f.phx_ref)<0);e[o].metas.unshift(...d)}r(o,c,l)}),this.map(a,(o,l)=>{let c=e[o];if(!c)return;let u=l.metas.map(d=>d.phx_ref);c.metas=c.metas.filter(d=>u.indexOf(d.phx_ref)<0),i(o,c,l),c.metas.length===0&&delete e[o]}),e}static list(e,n){return n||(n=function(r,i){return i}),this.map(e,(r,i)=>n(r,i))}static map(e,n){return Object.getOwnPropertyNames(e).map(r=>n(r,e[r]))}static clone(e){return JSON.parse(JSON.stringify(e))}},qb={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(t,e){if(t.payload.constructor===ArrayBuffer)return e(this.binaryEncode(t));{let n=[t.join_ref,t.ref,t.topic,t.event,t.payload];return e(JSON.stringify(n))}},decode(t,e){if(t.constructor===ArrayBuffer)return e(this.binaryDecode(t));{let[n,r,i,s,a]=JSON.parse(t);return e({join_ref:n,ref:r,topic:i,event:s,payload:a})}},binaryEncode(t){let{join_ref:e,ref:n,event:r,topic:i,payload:s}=t,a=this.META_LENGTH+e.length+n.length+i.length+r.length,o=new ArrayBuffer(this.HEADER_LENGTH+a),l=new DataView(o),c=0;l.setUint8(c++,this.KINDS.push),l.setUint8(c++,e.length),l.setUint8(c++,n.length),l.setUint8(c++,i.length),l.setUint8(c++,r.length),Array.from(e,d=>l.setUint8(c++,d.charCodeAt(0))),Array.from(n,d=>l.setUint8(c++,d.charCodeAt(0))),Array.from(i,d=>l.setUint8(c++,d.charCodeAt(0))),Array.from(r,d=>l.setUint8(c++,d.charCodeAt(0)));var u=new Uint8Array(o.byteLength+s.byteLength);return u.set(new Uint8Array(o),0),u.set(new Uint8Array(s),o.byteLength),u.buffer},binaryDecode(t){let e=new DataView(t),n=e.getUint8(0),r=new TextDecoder;switch(n){case this.KINDS.push:return this.decodePush(t,e,r);case this.KINDS.reply:return this.decodeReply(t,e,r);case this.KINDS.broadcast:return this.decodeBroadcast(t,e,r)}},decodePush(t,e,n){let r=e.getUint8(1),i=e.getUint8(2),s=e.getUint8(3),a=this.HEADER_LENGTH+this.META_LENGTH-1,o=n.decode(t.slice(a,a+r));a=a+r;let l=n.decode(t.slice(a,a+i));a=a+i;let c=n.decode(t.slice(a,a+s));a=a+s;let u=t.slice(a,t.byteLength);return{join_ref:o,ref:null,topic:l,event:c,payload:u}},decodeReply(t,e,n){let r=e.getUint8(1),i=e.getUint8(2),s=e.getUint8(3),a=e.getUint8(4),o=this.HEADER_LENGTH+this.META_LENGTH,l=n.decode(t.slice(o,o+r));o=o+r;let c=n.decode(t.slice(o,o+i));o=o+i;let u=n.decode(t.slice(o,o+s));o=o+s;let d=n.decode(t.slice(o,o+a));o=o+a;let f=t.slice(o,t.byteLength),h={status:d,response:f};return{join_ref:l,ref:c,topic:u,event:qu.reply,payload:h}},decodeBroadcast(t,e,n){let r=e.getUint8(1),i=e.getUint8(2),s=this.HEADER_LENGTH+2,a=n.decode(t.slice(s,s+r));s=s+r;let o=n.decode(t.slice(s,s+i));s=s+i;let l=t.slice(s,t.byteLength);return{join_ref:null,ref:null,topic:a,event:o,payload:l}}},eve=class{constructor(t,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=e.timeout||Kge,this.transport=e.transport||Oc.WebSocket||qm,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=e.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=e.sessionStorage||Oc&&Oc.sessionStorage,this.establishedConnections=0,this.defaultEncoder=qb.encode.bind(qb),this.defaultDecoder=qb.decode.bind(qb),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=e.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==qm?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;hg&&hg.addEventListener&&(hg.addEventListener("pagehide",r=>{this.conn&&(this.disconnect(),n=this.connectClock)}),hg.addEventListener("pageshow",r=>{n===this.connectClock&&(n=null,this.connect())}),hg.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=e.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=e.autoSendHeartbeat??!0,this.heartbeatCallback=e.heartbeatCallback??(()=>{}),this.rejoinAfterMs=r=>e.rejoinAfterMs?e.rejoinAfterMs(r):[1e3,2e3,5e3][r-1]||1e4,this.reconnectAfterMs=r=>e.reconnectAfterMs?e.reconnectAfterMs(r):[10,50,100,150,200,250,500,1e3,2e3][r-1]||5e3,this.logger=e.logger||null,!this.logger&&e.debug&&(this.logger=(r,i,s)=>{console.log(`${r}: ${i}`,s)}),this.longpollerTimeout=e.longpollerTimeout||2e4,this.params=k_(e.params||{}),this.endPoint=`${t}/${IM.websocket}`,this.vsn=e.vsn||Hge,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new XG(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{e.beforeReconnect&&await e.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=e.authToken}getLongPollTransport(){return qm}replaceTransport(t){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=t}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let t=jk.appendParams(jk.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return t.charAt(0)!=="/"?t:t.charAt(1)==="/"?`${this.protocol()}:${t}`:`${this.protocol()}://${location.host}${t}`}disconnect(t,e,n){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,t&&t()},e,n)}connect(t){t&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=k_(t)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==qm?this.connectWithFallback(qm,this.longPollFallbackMs):this.transportConnect())}log(t,e,n){this.logger&&this.logger(t,e,n)}hasLogger(){return this.logger!==null}onOpen(t){let e=this.makeRef();return this.stateChangeCallbacks.open.push([e,t]),e}onClose(t){let e=this.makeRef();return this.stateChangeCallbacks.close.push([e,t]),e}onError(t){let e=this.makeRef();return this.stateChangeCallbacks.error.push([e,t]),e}onMessage(t){let e=this.makeRef();return this.stateChangeCallbacks.message.push([e,t]),e}onHeartbeat(t){this.heartbeatCallback=t}ping(t){if(!this.isConnected())return!1;let e=this.makeRef(),n=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:e});let r=this.onMessage(i=>{i.ref===e&&(this.off([r]),t(Date.now()-n))});return!0}transportName(t){switch(t){case qm:return"LongPoll";default:return t.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let t;this.authToken&&(t=["phoenix",`${LM}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),t),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,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)}getSession(t){return this.sessionStore&&this.sessionStore.getItem(t)}storeSession(t,e){this.sessionStore&&this.sessionStore.setItem(t,e)}connectWithFallback(t,e=2500){clearTimeout(this.fallbackTimer);let n=!1,r=!0,i,s,a=this.transportName(t),o=l=>{this.log("transport",`falling back to ${a}...`,l),this.off([i,s]),r=!1,this.replaceTransport(t),this.transportConnect()};if(this.getSession(`phx:fallback:${a}`))return o("memorized");this.fallbackTimer=setTimeout(o,e),s=this.onError(l=>{this.log("transport","error",l),r&&!n&&(clearTimeout(this.fallbackTimer),o(l))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(n=!0,!r){let l=this.transportName(t);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${l}`,"true"),this.log("transport",`established ${l} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(o,e),this.ping(l=>{this.log("transport","connected to primary after",l),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&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.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),Jge,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(t,e,n){if(!this.conn)return t&&t();const r=this.conn;this.waitForBufferDone(r,()=>{e?r.close(e,n||""):r.close(),this.waitForSocketClosed(r,()=>{this.conn===r&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){}
vendor: 4,943 bytes, line 459
459,this.conn.onclose=function(){},this.conn=null),t&&t()})})}waitForBufferDone(t,e,n=1){if(n===5||!t.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(t,e,n+1)},150*n)}waitForSocketClosed(t,e,n=1){if(n===5||t.readyState===zc.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(t,e,n+1)},150*n)}onConnClose(t){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",t),this.triggerChanError(t),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",t)}onConnError(t){this.hasLogger()&&this.log("transport","error",t);let e=this.transport,n=this.establishedConnections;this.triggerStateCallbacks("error",t,e,n),(e===this.transport||n>0)&&this.triggerChanError(t)}triggerChanError(t){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(qu.error,t)})}connectionState(){switch(this.conn&&this.conn.readyState){case zc.connecting:return"connecting";case zc.open:return"open";case zc.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(t){this.off(t.stateChangeRefs),this.channels=this.channels.filter(e=>e!==t)}off(t){for(let e in this.stateChangeCallbacks)this.stateChangeCallbacks[e]=this.stateChangeCallbacks[e].filter(([n])=>t.indexOf(n)===-1)}channel(t,e={}){let n=new Xge(t,e,this);return this.channels.push(n),n}push(t){if(this.hasLogger()){let{topic:e,event:n,payload:r,ref:i,join_ref:s}=t;this.log("push",`${e} ${n} (${s}, ${i})`,r)}this.isConnected()?this.encode(t,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(t,e=>this.conn.send(e)))}makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(t){this.log("error","error in heartbeat callback",t)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),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.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}onConnMessage(t){this.decode(t.data,e=>{let{topic:n,event:r,payload:i,ref:s,join_ref:a}=e;if(s&&s===this.pendingHeartbeatRef){const o=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(i.status==="ok"?"ok":"error",o)}catch(l){this.log("error","error in heartbeat callback",l)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${i.status||""} ${n} ${r} ${s&&"("+s+")"||""}`.trim(),i);for(let o=0;o<this.channels.length;o++){const l=this.channels[o];l.isMember(n,r,i,a)&&l.trigger(r,i,s,a)}this.triggerStateCallbacks("message",e)})}triggerStateCallbacks(t,...e){try{this.stateChangeCallbacks[t].forEach(([n,r])=>{try{r(...e)}catch(i){this.log("error",`error in ${t} callback`,i)}})}catch(n){this.log("error",`error triggering ${t} callbacks`,n)}}leaveOpenTopic(t){let e=this.channels.find(n=>n.topic===t&&(n.isJoined()||n.isJoining()));e&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${t}"`),e.leave())}};class S_{constructor(e,n){const r=nve(n);this.presence=new Zge(e.getChannel(),r),this.presence.onJoin((i,s,a)=>{const o=S_.onJoinPayload(i,s,a);e.getChannel().trigger("presence",o)}),this.presence.onLeave((i,s,a)=>{const o=S_.onLeavePayload(i,s,a);e.getChannel().trigger("presence",o)}),this.presence.onSync(()=>{e.getChannel().trigger("presence",{event:"sync"})})}get state(){return S_.transformState(this.presence.state)}static transformState(e){return e=tve(e),Object.getOwnPropertyNames(e).reduce((n,r)=>{const i=e[r];return n[r]=px(i),n},{})}static onJoinPayload(e,n,r){const i=Cj(n),s=px(r);return{event:"join",key:e,currentPresences:i,newPresences:s}}static onLeavePayload(e,n,r){const i=Cj(n),s=px(r);return{event:"leave",key:e,currentPresences:i,leftPresences:s}}}function px(t){return t.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e))}function tve(t){return JSON.parse(JSON.stringify(t))}function nve(t){return(t==null?void 0:t.events)&&{events:t.events}}function Cj(t){return t!=null&&t.metas?px(t):[]}var Ej;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(Ej||(Ej={}));class rve{get state(){return this.presenceAdapter.state}constructor(e,n){this.channel=e,this.presenceAdapter=new S_(this.channel.channelAdapter,n)}}function ive(t){if(t instanceof Error)return t;if(typeof t=="string")return new Error(t);if(t&&typeof t=="object"){const e=t;
459if(typeof e.code=="number"){const n=typeof e.reason=="string"&&e.reason?` (${e.reason})`:"";return new Error(`socket closed: ${e.code}${n}`,{cause:t})}return new Error("channel error: transport failure",{cause:t})}return new Error("channel error: connection lost")}class sve{constructor(e,n,r){const i=ave(r);this.channel=e.getSocket().channel(n,i),this.socket=e}get state(){return this.channel.state}set state(e){this.channel.state=e}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(e,n){return this.channel.on(e,n)}off(e,n){this.channel.off(e,n)}subscribe(e){return this.channel.join(e)}unsubscribe(e){return this.channel.leave(e)}teardown(){this.channel.teardown()}onClose(e){this.channel.onClose(e)}onError(e){return this.channel.onError(e)}push(e,n,r){let i;try{i=this.channel.push(e,n,r)}catch{throw new Error(`tried to push '${e}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>jge){const s=this.channel.pushBuffer.shift();s.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${s.event}`,s.payload())}return i}updateJoinPayload(e){const n=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},n),e)}canPush(){return this.socket.isConnected()&&this.state===uh.joined}isJoined(){return this.state===uh.joined}isJoining(){return this.state===uh.joining}isClosed(){return this.state===uh.closed}isLeaving(){return this.state===uh.leaving}updateFilterBindings(e){this.channel.filterBindings=e}updatePayloadTransform(e){this.channel.onMessage=e}getChannel(){return this.channel}}function ave(t){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config)}}var Aj;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(Aj||(Aj={}));var Lg;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(Lg||(Lg={}));var Wu;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(Wu||(Wu={}));class T_{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(e,n={config:{}},r){var i,s;if(this.topic=e,this.params=n,this.socket=r,this.bindings={},this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},n.config),this.channelAdapter=new sve(this.socket.socketAdapter,e,this.params),this.presence=new rve(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=YG(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((s=(i=this.params.config)===null||i===void 0?void 0:i.broadcast)===null||s===void 0)&&s.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(e,n=this.timeout){var r,i,s;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:a,presence:o,private:l}}=this.params,c=(i=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(h=>h.filter))!==null&&i!==void 0?i:[],u=!!this.bindings[Lg.PRESENCE]&&this.bindings[Lg.PRESENCE].length>0||((s=this.params.config.presence)===null||s===void 0?void 0:s.enabled)===!0,d={},f={broadcast:a,presence:Object.assign(Object.assign({},o),{enabled:u}),postgres_changes:c,private:l};this.socket.accessTokenValue&&(d.access_token=this.socket.accessTokenValue),this._onError(h=>{e==null||e(Wu.CHANNEL_ERROR,ive(h))}),this._onClose(()=>e==null?void 0:e(Wu.CLOSED)),this.updateJoinPayload(Object.assign({config:f},d)),this._updateFilterMessage(),this.channelAdapter.subscribe(n).receive("ok",async({postgres_changes:h})=>{if(this.socket._isManualToken()||this.socket.setAuth(),h===void 0){e==null||e(Wu.SUBSCRIBED);return}this._updatePostgresBindings(h,e)}).receive("error",h=>{this.state=uh.errored;const p=Object.values(h).join(", ")||"error";e==null||e(Wu.CHANNEL_ERROR,new Error(p,{cause:h}))}).receive("timeout",()=>{e==null||e(Wu.TIMED_OUT)})}return this}_updatePostgresBindings(e,n){var r;const i=this.bindings.postgres_changes,s=(r=i==null?void 0:i.length)!==null&&r!==void 0?r:0,a=[];for(let o=0;o<s;o++){const l=i[o],{filter:{event:c,schema:u,table:d,filter:f}}=l,h=e&&e[o];if(h&&h.event===c&&T_.isFilterValueEqual(h.schema,u)&&T_.isFilterValueEqual(h.table,d)&&T_.isFilterValueEqual(h.filter,f))a.push(Object.assign(Object.assign({},l),{id:h.id}));else{this.unsubscribe(),this.state=uh.errored,n==null||n(Wu.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=a,this.state!=uh.errored&&n&&n(Wu.SUBSCRIBED)}presenceState(){return this.presence.state}async track(e,n={}){return await this.send({type:"presence",event:"track",payload:e},n.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,n,r){const i=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),s=e===Lg.PRESENCE||e===Lg.POSTGRES_CHANGES;if(i&&s)throw this.socket.log("channel",`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(e,n,r)}async httpSend(e,n,r={}){var i;if(n==null)return Promise.reject(new Error("Payload is required for httpSend()"));const s={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(s.Authorization=`Bearer ${this.socket.accessTokenValue}`);const a={method:"POST",headers:s,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:n,private:this.private}]})},o=await this._fetchWithTimeout(this.broadcastEndpointURL,a,(i=r.timeout)!==null&&i!==void 0?i:this.timeout);if(o.status===202)return{success:!0};let l=o.statusText;
459try{const c=await o.json();l=c.error||c.message||l}catch{}return Promise.reject(new Error(l))}async send(e,n={}){var r,i;if(!this.channelAdapter.canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:s,payload:a}=e,o={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const l={method:"POST",headers:o,body:JSON.stringify({messages:[{topic:this.subTopic,event:s,payload:a,private:this.private}]})};try{const c=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(r=n.timeout)!==null&&r!==void 0?r:this.timeout);return await((i=c.body)===null||i===void 0?void 0:i.cancel()),c.ok?"ok":"error"}catch(c){return c.name==="AbortError"?"timed out":"error"}}else return new Promise(s=>{var a,o,l;const c=this.channelAdapter.push(e.type,e,n.timeout||this.timeout);e.type==="broadcast"&&!(!((l=(o=(a=this.params)===null||a===void 0?void 0:a.config)===null||o===void 0?void 0:o.broadcast)===null||l===void 0)&&l.ack)&&s("ok"),c.receive("ok",()=>s("ok")),c.receive("error",()=>s("error")),c.receive("timeout",()=>s("timed out"))})}updateJoinPayload(e){this.channelAdapter.updateJoinPayload(e)}async unsubscribe(e=this.timeout){return new Promise(n=>{this.channelAdapter.unsubscribe(e).receive("ok",()=>n("ok")).receive("timeout",()=>n("timed out")).receive("error",()=>n("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(e,n,r){const i=new AbortController,s=setTimeout(()=>i.abort(),r),a=await this.socket.fetch(e,Object.assign(Object.assign({},n),{signal:i.signal}));return clearTimeout(s),a}_on(e,n,r){const i=e.toLocaleLowerCase(),s=this.channelAdapter.on(e,r),a={type:i,filter:n,callback:r,ref:s};return this.bindings[i]?this.bindings[i].push(a):this.bindings[i]=[a],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,n,r)=>{var i,s,a,o,l,c,u;const d=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(d,r))return!1;const f=(i=this.bindings[d])===null||i===void 0?void 0:i.find(h=>h.ref===e.ref);if(!f)return!0;if(["broadcast","presence","postgres_changes"].includes(d))if("id"in f){const h=f.id,p=(s=f.filter)===null||s===void 0?void 0:s.event;return h&&((a=n.ids)===null||a===void 0?void 0:a.includes(h))&&(p==="*"||(p==null?void 0:p.toLocaleLowerCase())===((o=n.data)===null||o===void 0?void 0:o.type.toLocaleLowerCase()))}else{const h=(c=(l=f==null?void 0:f.filter)===null||l===void 0?void 0:l.event)===null||c===void 0?void 0:c.toLocaleLowerCase();return h==="*"||h===((u=n==null?void 0:n.event)===null||u===void 0?void 0:u.toLocaleLowerCase())}else return f.type.toLocaleLowerCase()===d})}_notThisChannelEvent(e,n){const{close:r,error:i,leave:s,join:a}=KG;return n&&[r,i,s,a].includes(e)&&n!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,n,r)=>{if(typeof n=="object"&&"ids"in n){const i=n.data,{schema:s,table:a,commit_timestamp:o,type:l,errors:c}=i;return Object.assign(Object.assign({},{schema:s,table:a,commit_timestamp:o,eventType:l,new:{},old:{},errors:c}),this._getPayloadRecords(i))}return n})}copyBindings(e){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const n in e.bindings)for(const r of e.bindings[n])this._on(r.type,r.filter,r.callback)}static isFilterValueEqual(e,n){return(e??void 0)===(n??void 0)}_getPayloadRecords(e){const n={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(n.new=Tj(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(n.old=Tj(e.columns,e.old_record)),n}}class ove{constructor(e,n){this.socket=new eve(e,n)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(e){this.socket.heartbeatCallback=e}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(e,n,r,i=1e4){return new Promise(s=>{setTimeout(()=>s("timeout"),i),this.socket.disconnect(()=>{e(),s("ok")},n,r)})}push(e){this.socket.push(e)}log(e,n,r){this.socket.log(e,n,r)}makeRef(){return this.socket.makeRef()}onOpen(e){this.socket.onOpen(e)}onClose(e){this.socket.onClose(e)}onError(e){this.socket.onError(e)}onMessage(e){this.socket.onMessage(e)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==NM.connecting}isDisconnecting(){return this.socket.connectionState()==NM.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const Pj={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},lve=[1e3,2e3,5e3,1e4],cve=1e4,uve=` 460 addEventListener("message", (e) => { 461 if (e.data.event === "start") { 462 setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); 463 } 464 });`;class dve{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(e,n){var r;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint="",this.headers={},this.params={}
464,this.ref=0,this.serializer=new Bge,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=s=>s?(...a)=>s(...a):(...a)=>fetch(...a),!(!((r=n==null?void 0:n.params)===null||r===void 0)&&r.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey;const i=this._initializeOptions(n);this.socketAdapter=new ove(e,i),this.httpEndpoint=YG(e),this.fetch=this._resolveFetch(n==null?void 0:n.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(e){const n=e.message;throw n.includes("Node.js")?new Error(`${n} 465 466To use Realtime in Node.js, you need to provide a WebSocket implementation: 467 468Option 1: Use Node.js 22+ which has native WebSocket support 469Option 2: Install and provide the "ws" package: 470 471 npm install ws 472 473 import ws from "ws" 474 const client = new RealtimeClient(url, { 475 ...options, 476 transport: ws 477 })`):new Error(`WebSocket not available: ${n}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(e,n){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},e,n)}getChannels(){return this.channels}async removeChannel(e){const n=await e.unsubscribe();return n==="ok"&&e.teardown(),n}async removeAllChannels(){const e=this.channels.map(async r=>{const i=await r.unsubscribe();return r.teardown(),i}),n=await Promise.all(e);return await this.disconnect(),n}log(e,n,r){this.socketAdapter.log(e,n,r)}connectionState(){return this.socketAdapter.connectionState()||NM.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,n={config:{}}){const r=`realtime:${e}`,i=this.getChannels().find(s=>s.topic===r);if(i)return i;{const s=new T_(`realtime:${e}`,n,this);return this._cancelPendingDisconnect(),this.channels.push(s),s}}push(e){this.socketAdapter.push(e)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(e){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(e)}_makeRef(){return this.socketAdapter.makeRef()}_remove(e){this.channels=this.channels.filter(n=>n.topic!==e.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}
477this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(e=null){let n,r=!1;if(e)n=e,r=!0;else if(this.accessToken)try{n=await this.accessToken()}catch(i){this.log("error","Error fetching access token from callback",i),n=this.accessTokenValue}else n=this.accessTokenValue;r?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(i=>{const s={access_token:n,version:Lge};n&&i.updateJoinPayload(s),i.joinedOnce&&i.channelAdapter.isJoined()&&i.channelAdapter.push(KG.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(n=>{this.log("error",`Error setting auth in ${e}`,n)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(n=>{this.log("error","error waiting for auth on connect",n)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(e=>{e.ref&&e.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(e){return(n,r)=>{n=="sent"&&this._setAuthSafely(),e&&e(n,r)}}_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=n=>{this.log("worker","worker error",n.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=n=>{n.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(e){let n;if(e)n=e;else{const r=new Blob([uve],{type:"application/javascript"});n=URL.createObjectURL(r)}return n}_initializeOptions(e){var n,r,i,s,a,o,l,c,u,d,f;this.worker=(n=e==null?void 0:e.worker)!==null&&n!==void 0?n:!1,this.accessToken=(r=e==null?void 0:e.accessToken)!==null&&r!==void 0?r:null;const h={};h.timeout=(i=e==null?void 0:e.timeout)!==null&&i!==void 0?i:Fge,h.heartbeatIntervalMs=(s=e==null?void 0:e.heartbeatIntervalMs)!==null&&s!==void 0?s:Pj.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(a=e==null?void 0:e.disconnectOnEmptyChannelsAfterMs)!==null&&a!==void 0?a:2*((o=e==null?void 0:e.heartbeatIntervalMs)!==null&&o!==void 0?o:Pj.HEARTBEAT_INTERVAL),h.transport=(l=e==null?void 0:e.transport)!==null&&l!==void 0?l:Rge.getWebSocketConstructor(),h.params=e==null?void 0:e.params,h.logger=e==null?void 0:e.logger,h.heartbeatCallback=this._wrapHeartbeatCallback(e==null?void 0:e.heartbeatCallback),h.reconnectAfterMs=(c=e==null?void 0:e.reconnectAfterMs)!==null&&c!==void 0?c:v=>lve[v-1]||cve;let p,m;const g=(u=e==null?void 0:e.vsn)!==null&&u!==void 0?u:Dge;switch(g){case Oge:p=(v,_)=>_(JSON.stringify(v)),m=(v,_)=>_(JSON.parse(v));break;case HG:p=this.serializer.encode.bind(this.serializer),m=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${h.vsn}`)}if(h.vsn=g,h.encode=(d=e==null?void 0:e.encode)!==null&&d!==void 0?d:p,h.decode=(f=e==null?void 0:e.decode)!==null&&f!==void 0?f:m,h.beforeReconnect=this._reconnectAuth.bind(this),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,h.params=Object.assign(Object.assign({},h.params),{log_level:this.logLevel})),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl,h.autoSendHeartbeat=!this.worker}return h}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}
477var _w=class extends Error{constructor(t,e){var n;super(t),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&((n=e.icebergType)==null?void 0:n.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function hve(t,e,n){const r=new URL(e,t);if(n)for(const[i,s]of Object.entries(n))s!==void 0&&r.searchParams.set(i,s);return r.toString()}async function fve(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function pve(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:n,path:r,query:i,body:s,headers:a}){const o=hve(t.baseUrl,r,i),l=await fve(t.auth),c=await e(o,{method:n,headers:{...s?{"Content-Type":"application/json"}:{},...l,...a},body:s?JSON.stringify(s):void 0}),u=await c.text(),d=(c.headers.get("content-type")||"").includes("application/json"),f=d&&u?JSON.parse(u):u;if(!c.ok){const h=d?f:void 0,p=h==null?void 0:h.error;throw new _w((p==null?void 0:p.message)??`Request failed with status ${c.status}`,{status:c.status,icebergType:p==null?void 0:p.type,icebergCode:p==null?void 0:p.code,details:h})}return{status:c.status,headers:c.headers,data:f}}}}function Wb(t){return t.join("�")}var mve=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:Wb(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(r=>({namespace:r}))}async createNamespace(t,e){const n={namespace:t.namespace,properties:e==null?void 0:e.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:n})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Wb(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Wb(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Wb(t.namespace)}`}),!0}catch(e){if(e instanceof _w&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(n){if(n instanceof _w&&n.status===409)return;throw n}}};function Wm(t){return t.join("�")}var gve=class{constructor(t,e="",n){this.client=t,this.prefix=e,this.accessDelegation=n}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Wm(t.namespace)}/tables`})).data.identifiers}async createTable(t,e){const n={};return this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Wm(t.namespace)}/tables`,body:e,headers:n})).data.metadata}async updateTable(t,e){const n=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Wm(t.namespace)}/tables/${t.name}`,body:e});return{"metadata-location":n.data["metadata-location"],metadata:n.data.metadata}}async dropTable(t,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Wm(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String((e==null?void 0:e.purge)??!1)}})}async loadTable(t){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Wm(t.namespace)}/tables/${t.name}`,headers:e})).data.metadata}async tableExists(t){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Wm(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(n){if(n instanceof _w&&n.status===404)return!1;throw n}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(n){if(n instanceof _w&&n.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw n}}},vve=class{constructor(t){var r;let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const n=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=pve({baseUrl:n,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=(r=t.accessDelegation)==null?void 0:r.join(","),this.namespaceOps=new mve(this.client,e),this.tableOps=new gve(this.client,e,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,e){return this.namespaceOps.createNamespace(t,e)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}
477async createTable(t,e){return this.tableOps.createTable(t,e)}async updateTable(t,e){return this.tableOps.updateTable(t,e)}async dropTable(t,e){await this.tableOps.dropTable(t,e)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,e){return this.namespaceOps.createNamespaceIfNotExists(t,e)}async createTableIfNotExists(t,e){return this.tableOps.createTableIfNotExists(t,e)}};function ww(t){"@babel/helpers - typeof";return ww=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ww(t)}function yve(t,e){if(ww(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(ww(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function _ve(t){var e=yve(t,"string");return ww(e)=="symbol"?e:e+""}function wve(t,e,n){return(e=_ve(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Mj(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Bt(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Mj(Object(n),!0).forEach(function(r){wve(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Mj(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}var fT=class extends Error{constructor(t,e="storage",n,r){super(t),this.__isStorageError=!0,this.namespace=e,this.name=e==="vectors"?"StorageVectorsError":"StorageError",this.status=n,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function pT(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var OM=class extends fT{constructor(t,e,n,r="storage"){super(t,r,e,n),this.name=r==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=e,this.statusCode=n}toJSON(){return Bt({},super.toJSON())}},QG=class extends fT{constructor(t,e,n="storage"){super(t,n),this.name=n==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=e}};function Bk(t,e,n){const r=Bt({},t),i=e.toLowerCase();for(const s of Object.keys(r))s.toLowerCase()===i&&delete r[s];return r[i]=n,r}function bve(t){const e={};for(const[n,r]of Object.entries(t))e[n.toLowerCase()]=r;return e}const xve=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),kve=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},DM=t=>{if(Array.isArray(t))return t.map(n=>DM(n));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([n,r])=>{const i=n.replace(/([-_][a-z])/gi,s=>s.toUpperCase().replace(/[-_]/g,""));e[i]=DM(r)}),e},Sve=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t),Nj=t=>{var e;return t.msg||t.message||t.error_description||(typeof t.error=="string"?t.error:(e=t.error)===null||e===void 0?void 0:e.message)||JSON.stringify(t)},Tve=async(t,e,n,r)=>{if(t!==null&&typeof t=="object"&&typeof t.json=="function"){const i=t;let s=parseInt(i.status,10);Number.isFinite(s)||(s=500),i.json().then(a=>{const o=(a==null?void 0:a.statusCode)||(a==null?void 0:a.code)||s+"";e(new OM(Nj(a),s,o,r))}).catch(()=>{const a=s+"";e(new OM(i.statusText||`HTTP ${s} error`,s,a,r))})}else e(new QG(Nj(t),t,r))},Cve=(t,e,n,r)=>{const i={method:t,headers:(e==null?void 0:e.headers)||{}};if(t==="GET"||t==="HEAD"||!r)return Bt(Bt({},i),n);if(kve(r)){var s;const a=(e==null?void 0:e.headers)||{};let o;for(const[l,c]of Object.entries(a))l.toLowerCase()==="content-type"&&(o=c);i.headers=Bk(a,"Content-Type",(s=o)!==null&&s!==void 0?s:"application/json"),i.body=JSON.stringify(r)}else i.body=r;return e!=null&&e.duplex&&(i.duplex=e.duplex),Bt(Bt({},i),n)};async function yy(t,e,n,r,i,s,a){return new Promise((o,l)=>{t(n,Cve(e,r,i,s)).then(c=>{if(!c.ok)throw c;if(r!=null&&r.noResolveJson)return c;if(a==="vectors"){const u=c.headers.get("content-type");if(c.headers.get("content-length")==="0"||c.status===204)return{};if(!u||!u.includes("application/json"))return{}}return c.json()}).then(c=>o(c)).catch(c=>Tve(c,l,r,a))})}function ZG(t="storage"){return{get:async(e,n,r,i)=>yy(e,"GET",n,r,i,void 0,t),post:async(e,n,r,i,s)=>yy(e,"POST",n,i,s,r,t),put:async(e,n,r,i,s)=>yy(e,"PUT",n,i,s,r,t),head:async(e,n,r,i)=>yy(e,"HEAD",n,Bt(Bt({},r),{},{noResolveJson:!0}),i,void 0,t),remove:async(e,n,r,i,s)=>yy(e,"DELETE",n,i,s,r,t)}}const Eve=ZG("storage"),{get:bw,post:Nl,put:FM,head:Ave,remove:lI}=Eve,_o=ZG("vectors");var l0=class{constructor(t,e={},n,r="storage"){this.shouldThrowOnError=!1,this.url=t,this.headers=bve(e),this.fetch=xve(n),this.namespace=r}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=Bk(this.headers,t,e),this}async handleOperation(t){var e=this;try{return{data:await t(),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(pT(n))return{data:null,error:n};throw n}}},Pve=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e}then(t,e){return this.execute().then(t,e)}async execute(){var t=this;try{return{data:(await t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(pT(e))return{data:null,error:e};throw e}}};let eH;eH=Symbol.toStringTag;var Mve=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[eH]="BlobDownloadBuilder",this.promise=null}asStream(){return new Pve(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:await(await t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(pT(e))return{data:null,error:e};throw e}}};const Nve={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Rj={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var Rve=class extends l0{constructor(t,e={},n,r){super(t,e,r,"storage"),this.bucketId=n}async uploadOrUpdate(t,e,n,r){var i=this;return i.handleOperation(async()=>{let s;const a=Bt(Bt({},Rj),r);let o=Bt(Bt({},i.headers),t==="POST"&&{"x-upsert":String(a.upsert)});const l=a.metadata;if(typeof Blob<"u"&&n instanceof Blob?(s=new FormData,s.append("cacheControl",a.cacheControl),l&&s.append("metadata",i.encodeMetadata(l)),s.append("",n)):typeof FormData<"u"&&n instanceof FormData?(s=n,s.has("cacheControl")||s.append("cacheControl",a.cacheControl),l&&!s.has("metadata")&&s.append("metadata",i.encodeMetadata(l))):(s=n,o["cache-control"]=`max-age=${a.cacheControl}`,o["content-type"]=a.contentType,l&&(o["x-metadata"]=i.toBase64(i.encodeMetadata(l))),(typeof ReadableStream<"u"&&s instanceof ReadableStream||s&&typeof s=="object"&&"pipe"in s&&typeof s.pipe=="function")&&!a.duplex&&(a.duplex="half")),r!=null&&r.headers)for(const[f,h]of Object.entries(r.headers))o=Bk(o,f,h);const c=i._removeEmptyFolders(e),u=i._getFinalPath(c),d=await(t=="PUT"?FM:Nl)(i.fetch,`${i.url}/object/${u}`,s,Bt({headers:o},a!=null&&a.duplex?{duplex:a.duplex}:{}));return{path:c,id:d.Id,fullPath:d.Key}})}async upload(t,e,n){return this.uploadOrUpdate("POST",t,e,n)}async uploadToSignedUrl(t,e,n,r){var i=this;const s=i._removeEmptyFolders(t),a=i._getFinalPath(s),o=new URL(i.url+`/object/upload/sign/${a}`);return o.searchParams.set("token",e),i.handleOperation(async()=>{let l;const c=Bt(Bt({},Rj),r);let u=Bt(Bt({},i.headers),{"x-upsert":String(c.upsert)});const d=c.metadata;if(typeof Blob<"u"&&n instanceof Blob?(l=new FormData,l.append("cacheControl",c.cacheControl),d&&l.append("metadata",i.encodeMetadata(d)),l.append("",n)):typeof FormData<"u"&&n instanceof FormData?(l=n,l.has("cacheControl")||l.append("cacheControl",c.cacheControl),d&&!l.has("metadata")&&l.a
477ppend("metadata",i.encodeMetadata(d))):(l=n,u["cache-control"]=`max-age=${c.cacheControl}`,u["content-type"]=c.contentType,d&&(u["x-metadata"]=i.toBase64(i.encodeMetadata(d))),(typeof ReadableStream<"u"&&l instanceof ReadableStream||l&&typeof l=="object"&&"pipe"in l&&typeof l.pipe=="function")&&!c.duplex&&(c.duplex="half")),r!=null&&r.headers)for(const[f,h]of Object.entries(r.headers))u=Bk(u,f,h);return{path:s,fullPath:(await FM(i.fetch,o.toString(),l,Bt({headers:u},c!=null&&c.duplex?{duplex:c.duplex}:{}))).Key}})}async createSignedUploadUrl(t,e){var n=this;return n.handleOperation(async()=>{let r=n._getFinalPath(t);const i=Bt({},n.headers);e!=null&&e.upsert&&(i["x-upsert"]="true");const s=await Nl(n.fetch,`${n.url}/object/upload/sign/${r}`,{},{headers:i}),a=new URL(n.url+s.url),o=a.searchParams.get("token");if(!o)throw new fT("No token returned by API");return{signedUrl:a.toString(),path:t,token:o}})}async update(t,e,n){return this.uploadOrUpdate("PUT",t,e,n)}async move(t,e,n){var r=this;return r.handleOperation(async()=>await Nl(r.fetch,`${r.url}/object/move`,{bucketId:r.bucketId,sourceKey:t,destinationKey:e,destinationBucket:n==null?void 0:n.destinationBucket},{headers:r.headers}))}async copy(t,e,n){var r=this;return r.handleOperation(async()=>({path:(await Nl(r.fetch,`${r.url}/object/copy`,{bucketId:r.bucketId,sourceKey:t,destinationKey:e,destinationBucket:n==null?void 0:n.destinationBucket},{headers:r.headers})).Key}))}async createSignedUrl(t,e,n){var r=this;return r.handleOperation(async()=>{let i=r._getFinalPath(t);const s=typeof(n==null?void 0:n.transform)=="object"&&n.transform!==null&&Object.keys(n.transform).length>0;let a=await Nl(r.fetch,`${r.url}/object/sign/${i}`,Bt({expiresIn:e},s?{transform:n.transform}:{}),{headers:r.headers});const o=new URLSearchParams;n!=null&&n.download&&o.set("download",n.download===!0?"":n.download),(n==null?void 0:n.cacheNonce)!=null&&o.set("cacheNonce",String(n.cacheNonce));const l=o.toString();return{signedUrl:encodeURI(`${r.url}${a.signedURL}${l?`&${l}`:""}`)}})}async createSignedUrls(t,e,n){var r=this;return r.handleOperation(async()=>{const i=await Nl(r.fetch,`${r.url}/object/sign/${r.bucketId}`,{expiresIn:e,paths:t},{headers:r.headers}),s=new URLSearchParams;n!=null&&n.download&&s.set("download",n.download===!0?"":n.download),(n==null?void 0:n.cacheNonce)!=null&&s.set("cacheNonce",String(n.cacheNonce));const a=s.toString();return i.map(o=>Bt(Bt({},o),{},{signedUrl:o.signedURL?encodeURI(`${r.url}${o.signedURL}${a?`&${a}`:""}`):null}))})}download(t,e,n){const r=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image/authenticated":"object",i=new URLSearchParams;e!=null&&e.transform&&this.applyTransformOptsToQuery(i,e.transform),(e==null?void 0:e.cacheNonce)!=null&&i.set("cacheNonce",String(e.cacheNonce));const s=i.toString(),a=this._getFinalPath(t),o=()=>bw(this.fetch,`${this.url}/${r}/${a}${s?`?${s}`:""}`,{headers:this.headers,noResolveJson:!0},n);return new Mve(o,this.shouldThrowOnError)}async info(t){var e=this;const n=e._getFinalPath(t);return e.handleOperation(async()=>DM(await bw(e.fetch,`${e.url}/object/info/${n}`,{headers:e.headers})))}async exists(t){var e=this;const n=e._getFinalPath(t);try{return await Ave(e.fetch,`${e.url}/object/${n}`,{headers:e.headers}),{data:!0,error:null}}catch(i){if(e.shouldThrowOnError)throw i;if(pT(i)){var r;const s=i instanceof OM?i.status:i instanceof QG?(r=i.originalError)===null||r===void 0?void 0:r.status:void 0;if(s!==void 0&&[400,404].includes(s))return{data:!1,error:i}}throw i}}getPublicUrl(t,e){const n=this._getFinalPath(t),r=new URLSearchParams;e!=null&&e.download&&r.set("download",e.download===!0?"":e.download),e!=null&&e.transform&&this.applyTransformOptsToQuery(r,e.transform),(e==null?void 0:e.cacheNonce)!=null&&r.set("cacheNonce",String(e.cacheNonce));const i=r.toString(),s=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${s}/public/${n}`)+(i?`?${i}`:"")}}}async remove(t){var e=this;return e.handleOperation(async()=>await lI(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}))}async list(t,e,n){var r=this;return r.handleOperation(async()=>{const i=Bt(Bt(Bt({},Nve),e),{},{prefix:t||""});return await Nl(r.fetch,`${r.url}/object/list/${r.bucketId}`,i,{headers:r.headers},n)})}async listV2(t,e){var n=this;return n.handleOperation(async()=>{const r=Bt({},t);return await Nl(n.fetch,`${n.url}/object/list-v2/${n.bucketId}`,r,{headers:n.headers},e)})}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(t,e){return e.width&&t.set("width",e.width.toString()),e.height&&t.set("height",e.height.toString()),e.resize&&t.set("resize",e.resize),e.format&&t.set("format",e.format),e.quality&&t.set("qual
477ity",e.quality.toString()),t}};const Ive="2.105.1",p1={"X-Client-Info":`storage-js/${Ive}`};var Lve=class extends l0{constructor(t,e={},n,r){const i=new URL(t);r!=null&&r.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes("storage.supabase.")&&(i.hostname=i.hostname.replace("supabase.","storage.supabase."));const s=i.href.replace(/\/$/,""),a=Bt(Bt({},p1),e);super(s,a,n,"storage")}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const n=e.listBucketOptionsToQueryString(t);return await bw(e.fetch,`${e.url}/bucket${n}`,{headers:e.headers})})}async getBucket(t){var e=this;return e.handleOperation(async()=>await bw(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}))}async createBucket(t,e={public:!1}){var n=this;return n.handleOperation(async()=>await Nl(n.fetch,`${n.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:n.headers}))}async updateBucket(t,e){var n=this;return n.handleOperation(async()=>await FM(n.fetch,`${n.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:n.headers}))}async emptyBucket(t){var e=this;return e.handleOperation(async()=>await Nl(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await lI(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}listBucketOptionsToQueryString(t){const e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},Ove=class extends l0{constructor(t,e={},n){const r=t.replace(/\/$/,""),i=Bt(Bt({},p1),e);super(r,i,n,"storage")}async createBucket(t){var e=this;return e.handleOperation(async()=>await Nl(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers}))}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const n=new URLSearchParams;(t==null?void 0:t.limit)!==void 0&&n.set("limit",t.limit.toString()),(t==null?void 0:t.offset)!==void 0&&n.set("offset",t.offset.toString()),t!=null&&t.sortColumn&&n.set("sortColumn",t.sortColumn),t!=null&&t.sortOrder&&n.set("sortOrder",t.sortOrder),t!=null&&t.search&&n.set("search",t.search);const r=n.toString(),i=r?`${e.url}/bucket?${r}`:`${e.url}/bucket`;return await bw(e.fetch,i,{headers:e.headers})})}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await lI(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}from(t){var e=this;if(!Sve(t))throw new fT("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const n=new vve({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),r=this.shouldThrowOnError;return new Proxy(n,{get(i,s){const a=i[s];return typeof a!="function"?a:async(...o)=>{try{return{data:await a.apply(i,o),error:null}}catch(l){if(r)throw l;return{data:null,error:l}}}}})}},Dve=class extends l0{constructor(t,e={},n){const r=t.replace(/\/$/,""),i=Bt(Bt({},p1),{},{"Content-Type":"application/json"},e);super(r,i,n,"vectors")}async createIndex(t){var e=this;return e.handleOperation(async()=>await _o.post(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{})}async getIndex(t,e){var n=this;return n.handleOperation(async()=>await _o.post(n.fetch,`${n.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:n.headers}))}async listIndexes(t){var e=this;return e.handleOperation(async()=>await _o.post(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}))}async deleteIndex(t,e){var n=this;return n.handleOperation(async()=>await _o.post(n.fetch,`${n.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:n.headers})||{})}},Fve=class extends l0{constructor(t,e={},n){const r=t.replace(/\/$/,""),i=Bt(Bt({},p1),{},{"Content-Type":"application/json"},e);super(r,i,n,"vectors")}async putVectors(t){var e=this;if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return e.handleOperation(async()=>await _o.post(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{})}async getVectors(t){var e=this;return e.handleOperation(async()=>await _o.post(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers}))}async listVectors(t){var e=this;if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");
477if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return e.handleOperation(async()=>await _o.post(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}))}async queryVectors(t){var e=this;return e.handleOperation(async()=>await _o.post(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers}))}async deleteVectors(t){var e=this;if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return e.handleOperation(async()=>await _o.post(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{})}},jve=class extends l0{constructor(t,e={},n){const r=t.replace(/\/$/,""),i=Bt(Bt({},p1),{},{"Content-Type":"application/json"},e);super(r,i,n,"vectors")}async createBucket(t){var e=this;return e.handleOperation(async()=>await _o.post(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}async getBucket(t){var e=this;return e.handleOperation(async()=>await _o.post(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}))}async listBuckets(t={}){var e=this;return e.handleOperation(async()=>await _o.post(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await _o.post(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}},Bve=class extends jve{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new Uve(this.url,this.headers,t,this.fetch)}async createBucket(t){var e=()=>super.createBucket,n=this;return e().call(n,t)}async getBucket(t){var e=()=>super.getBucket,n=this;return e().call(n,t)}async listBuckets(t={}){var e=()=>super.listBuckets,n=this;return e().call(n,t)}async deleteBucket(t){var e=()=>super.deleteBucket,n=this;return e().call(n,t)}},Uve=class extends Dve{constructor(t,e,n,r){super(t,e,r),this.vectorBucketName=n}async createIndex(t){var e=()=>super.createIndex,n=this;return e().call(n,Bt(Bt({},t),{},{vectorBucketName:n.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,n=this;return e().call(n,Bt(Bt({},t),{},{vectorBucketName:n.vectorBucketName}))}async getIndex(t){var e=()=>super.getIndex,n=this;return e().call(n,n.vectorBucketName,t)}async deleteIndex(t){var e=()=>super.deleteIndex,n=this;return e().call(n,n.vectorBucketName,t)}index(t){return new zve(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},zve=class extends Fve{constructor(t,e,n,r,i){super(t,e,i),this.vectorBucketName=n,this.indexName=r}async putVectors(t){var e=()=>super.putVectors,n=this;return e().call(n,Bt(Bt({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async getVectors(t){var e=()=>super.getVectors,n=this;return e().call(n,Bt(Bt({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,n=this;return e().call(n,Bt(Bt({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,n=this;return e().call(n,Bt(Bt({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,n=this;return e().call(n,Bt(Bt({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}},$ve=class extends Lve{constructor(t,e={},n,r){super(t,e,n,r)}from(t){return new Rve(this.url,this.headers,t,this.fetch)}get vectors(){return new Bve(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Ove(this.url+"/iceberg",this.headers,this.fetch)}};function mT(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}const tH="2.105.1",fg=30*1e3,jM=3,y5=jM*fg,Vve="http://localhost:9999",qve="supabase.auth.token",Wve={"X-Client-Info":`gotrue-js/${tH}`},BM="X-Supabase-Api-Version",nH={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},Gve=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,Hve=10*60*1e3;
477class xw extends Error{constructor(e,n,r){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=r}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function it(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class Kve extends xw{constructor(e,n,r){super(e,n,r),this.name="AuthApiError",this.status=n,this.code=r}}function Jve(t){return it(t)&&t.name==="AuthApiError"}class Bl extends xw{constructor(e,n){super(e),this.name="AuthUnknownError",this.originalError=n}}class xd extends xw{constructor(e,n,r,i){super(e,r,i),this.name=n,this.status=r}}class ns extends xd{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Gb(t){return it(t)&&t.name==="AuthSessionMissingError"}class Gm extends xd{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Hb extends xd{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class Kb extends xd{constructor(e,n=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function Yve(t){return it(t)&&t.name==="AuthImplicitGrantRedirectError"}class Ij extends xd{constructor(e,n=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class Xve extends xd{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class UM extends xd{constructor(e,n){super(e,"AuthRetryableFetchError",n,void 0)}}function _5(t){return it(t)&&t.name==="AuthRetryableFetchError"}class Lj extends xd{constructor(e,n,r){super(e,"AuthWeakPasswordError",n,"weak_password"),this.reasons=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class zM extends xd{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Uk="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Oj=` 478\r=`.split(""),Qve=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<Oj.length;e+=1)t[Oj[e].charCodeAt(0)]=-2;for(let e=0;e<Uk.length;e+=1)t[Uk[e].charCodeAt(0)]=e;return t})();function Dj(t,e,n){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const r=e.queue>>e.queuedBits-6&63;n(Uk[r]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const r=e.queue>>e.queuedBits-6&63;n(Uk[r]),e.queuedBits-=6}}function rH(t,e,n){const r=Qve[t];if(r>-1)for(e.queue=e.queue<<6|r,e.queuedBits+=6;e.queuedBits>=8;)n(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(r===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function Fj(t){const e=[],n=a=>{e.push(String.fromCodePoint(a))},r={utf8seq:0,codepoint:0},i={queue:0,queuedBits:0},s=a=>{t0e(a,r,n)};for(let a=0;a<t.length;a+=1)rH(t.charCodeAt(a),i,s);return e.join("")}function Zve(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function e0e(t,e){for(let n=0;n<t.length;n+=1){let r=t.charCodeAt(n);if(r>55295&&r<=56319){const i=(r-55296)*1024&65535;r=(t.charCodeAt(n+1)-56320&65535|i)+65536,n+=1}Zve(r,e)}}function t0e(t,e,n){if(e.utf8seq===0){if(t<=127){n(t);return}for(let r=1;r<6;r+=1)if(!(t>>7-r&1)){e.utf8seq=r;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&n(e.codepoint)}}function Xg(t){const e=[],n={queue:0,queuedBits:0},r=i=>{e.push(i)};for(let i=0;i<t.length;i+=1)rH(t.charCodeAt(i),n,r);return new Uint8Array(e)}function n0e(t){const e=[];return e0e(t,n=>e.push(n)),new Uint8Array(e)}function fp(t){const e=[],n={queue:0,queuedBits:0},r=i=>{e.push(i)};return t.forEach(i=>
478Dj(i,n,r)),Dj(null,n,r),e.join("")}function r0e(t){return Math.round(Date.now()/1e3)+t}function i0e(){return Symbol("auth-callback")}const ws=()=>typeof window<"u"&&typeof document<"u",Ff={tested:!1,writable:!1},iH=()=>{if(!ws())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Ff.tested)return Ff.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),Ff.tested=!0,Ff.writable=!0}catch{Ff.tested=!0,Ff.writable=!1}return Ff.writable};function s0e(t){const e={},n=new URL(t);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((i,s)=>{e[s]=i})}catch{}return n.searchParams.forEach((r,i)=>{e[i]=r}),e}const sH=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),a0e=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",pg=async(t,e,n)=>{await t.setItem(e,JSON.stringify(n))},jf=async(t,e)=>{const n=await t.getItem(e);if(!n)return null;try{return JSON.parse(n)}catch{return n}},_s=async(t,e)=>{await t.removeItem(e)};class gT{constructor(){this.promise=new gT.promiseConstructor((e,n)=>{this.resolve=e,this.reject=n})}}gT.promiseConstructor=Promise;function Jb(t){const e=t.split(".");if(e.length!==3)throw new zM("Invalid JWT structure");for(let r=0;r<e.length;r++)if(!Gve.test(e[r]))throw new zM("JWT not in base64url format");return{header:JSON.parse(Fj(e[0])),payload:JSON.parse(Fj(e[1])),signature:Xg(e[2]),raw:{header:e[0],payload:e[1]}}}async function o0e(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function l0e(t,e){return new Promise((r,i)=>{(async()=>{for(let s=0;s<1/0;s++)try{const a=await t(s);if(!e(s,null,a)){r(a);return}}catch(a){if(!e(s,a)){i(a);return}}})()})}function c0e(t){return("0"+t.toString(16)).substr(-2)}function u0e(){const e=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=n.length;let i="";for(let s=0;s<56;s++)i+=n.charAt(Math.floor(Math.random()*r));return i}return crypto.getRandomValues(e),Array.from(e,c0e).join("")}async function d0e(t){const n=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",n),i=new Uint8Array(r);return Array.from(i).map(s=>String.fromCharCode(s)).join("")}async function h0e(t){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."),t;const n=await d0e(t);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Hm(t,e,n=!1){const r=u0e();let i=r;n&&(i+="/recovery"),await pg(t,`${e}-code-verifier`,i);const s=await h0e(r);return[s,r===s?"plain":"s256"]}const f0e=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function p0e(t){const e=t.headers.get(BM);if(!e||!e.match(f0e))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function m0e(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function g0e(t){switch(t){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 v0e=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Ou(t){if(!v0e.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function El(t){if(!t.passkey)throw new Error("@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).")}function w5(){const t={};return new Proxy(t,{get:(e,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const r=n.toString();if(r==="Symbol(Symbol.toPrimitive)"||r==="Symbol(Symbol.toStringTag)"||r==="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 "${n}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function y0e(t,e){return new Proxy(t,{get:(n,r,i)=>{if(r==="__isInsecureUserWarningProxy")return!0;
478if(typeof r=="symbol"){const s=r.toString();if(s==="Symbol(Symbol.toPrimitive)"||s==="Symbol(Symbol.toStringTag)"||s==="Symbol(util.inspect.custom)"||s==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(n,r,i)}return!e.value&&typeof r=="string"&&(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."),e.value=!0),Reflect.get(n,r,i)}})}function jj(t){return JSON.parse(JSON.stringify(t))}const Hf=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),_0e=[502,503,504,520,521,522,523,524,530];async function Bj(t){var e;if(!a0e(t))throw new UM(Hf(t),0);if(_0e.includes(t.status))throw new UM(Hf(t),t.status);let n;try{n=await t.json()}catch(s){throw new Bl(Hf(s),s)}let r;const i=p0e(t);if(i&&i.getTime()>=nH["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?r=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(r=n.error_code),r){if(r==="weak_password")throw new Lj(Hf(n),t.status,((e=n.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(r==="session_not_found")throw new ns}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((s,a)=>s&&typeof a=="string",!0))throw new Lj(Hf(n),t.status,n.weak_password.reasons);throw new Kve(Hf(n),t.status||500,r)}const w0e=(t,e,n,r)=>{const i={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),i.body=JSON.stringify(r),Object.assign(Object.assign({},i),n))};async function bt(t,e,n,r){var i;const s=Object.assign({},r==null?void 0:r.headers);s[BM]||(s[BM]=nH["2024-01-01"].name),r!=null&&r.jwt&&(s.Authorization=`Bearer ${r.jwt}`);const a=(i=r==null?void 0:r.query)!==null&&i!==void 0?i:{};r!=null&&r.redirectTo&&(a.redirect_to=r.redirectTo);const o=Object.keys(a).length?"?"+new URLSearchParams(a).toString():"",l=await b0e(t,e,n+o,{headers:s,noResolveJson:r==null?void 0:r.noResolveJson},{},r==null?void 0:r.body);return r!=null&&r.xform?r==null?void 0:r.xform(l):{data:Object.assign({},l),error:null}}async function b0e(t,e,n,r,i,s){const a=w0e(e,r,i,s);let o;try{o=await t(n,Object.assign({},a))}catch(l){throw console.error(l),new UM(Hf(l),0)}if(o.ok||await Bj(o),r!=null&&r.noResolveJson)return o;try{return await o.json()}catch(l){await Bj(l)}}function zo(t){var e;let n=null;S0e(t)&&(n=Object.assign({},t),t.expires_at||(n.expires_at=r0e(t.expires_in)));const r=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:n,user:r},error:null}}function Uj(t){const e=zo(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((n,r)=>n&&typeof r=="string",!0)&&(e.data.weak_password=t.weak_password),e}function dh(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function x0e(t){return{data:t,error:null}}function k0e(t){const{action_link:e,email_otp:n,hashed_token:r,redirect_to:i,verification_type:s}=t,a=mT(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),o={action_link:e,email_otp:n,hashed_token:r,redirect_to:i,verification_type:s},l=Object.assign({},a);return{data:{properties:o,user:l},error:null}}function zj(t){return t}function S0e(t){return t.access_token&&t.refresh_token&&t.expires_in}const b5=["global","local","others"];class T0e{constructor({url:e="",headers:n={},fetch:r,experimental:i}){this.url=e,this.headers=n,this.fetch=sH(r),this.experimental=i??{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(e,n=b5[0]){if(b5.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${b5.join(", ")}`);try{return await bt(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(r){if(it(r))return{data:null,error:r};throw r}}async inviteUserByEmail(e,n={}){try{return await bt(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:dh})}catch(r){if(it(r))return{data:{user:null},error:r};throw r}}async generateLink(e){try{const{options:n}=e,r=mT(e,["options"]),i=Object.assign(Object.assign({},r),n);return"newEmail"in r&&(i.new_email=r==null?void 0:r.newEmail,delete i.newEmail),await bt(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:i,headers:this.headers,xform:k0e,redirectTo:n==null?void 0:n.redirectTo})}catch(n){if(it(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(e){try{return await bt(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:dh})}catch(n){if(it(n))return{data:{user:null},error:n};throw n}}async listUsers(e){var n,r,i,s,a,o,l;try{const c={nextPage:null,lastPage:0,total:0},u=await bt(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=e==null?void 0:e.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(s=(i=e==null?void 0:e.perPage)===null||i===void 0?void 0:i.toString())!==null&&s!==void 0?s:""},xform:zj});if(u.error)throw u.error;const d=await u.json(),f=(a=u.headers.get("x-total-count"))!==null&&a!==void 0?a:0,h=(l=(o=u.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&l!==void 0?l:[];return h.length>
4780&&(h.forEach(p=>{const m=parseInt(p.split(";")[0].split("=")[1].substring(0,1)),g=JSON.parse(p.split(";")[1].split("=")[1]);c[`${g}Page`]=m}),c.total=parseInt(f)),{data:Object.assign(Object.assign({},d),c),error:null}}catch(c){if(it(c))return{data:{users:[]},error:c};throw c}}async getUserById(e){Ou(e);try{return await bt(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:dh})}catch(n){if(it(n))return{data:{user:null},error:n};throw n}}async updateUserById(e,n){Ou(e);try{return await bt(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:n,headers:this.headers,xform:dh})}catch(r){if(it(r))return{data:{user:null},error:r};throw r}}async deleteUser(e,n=!1){Ou(e);try{return await bt(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:n},xform:dh})}catch(r){if(it(r))return{data:{user:null},error:r};throw r}}async _listFactors(e){Ou(e.userId);try{const{data:n,error:r}=await bt(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:i=>({data:{factors:i},error:null})});return{data:n,error:r}}catch(n){if(it(n))return{data:null,error:n};throw n}}async _deleteFactor(e){Ou(e.userId),Ou(e.id);try{return{data:await bt(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(n){if(it(n))return{data:null,error:n};throw n}}async _listOAuthClients(e){var n,r,i,s,a,o,l;try{const c={nextPage:null,lastPage:0,total:0},u=await bt(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=e==null?void 0:e.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(s=(i=e==null?void 0:e.perPage)===null||i===void 0?void 0:i.toString())!==null&&s!==void 0?s:""},xform:zj});if(u.error)throw u.error;const d=await u.json(),f=(a=u.headers.get("x-total-count"))!==null&&a!==void 0?a:0,h=(l=(o=u.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&l!==void 0?l:[];return h.length>0&&(h.forEach(p=>{const m=parseInt(p.split(";")[0].split("=")[1].substring(0,1)),g=JSON.parse(p.split(";")[1].split("=")[1]);c[`${g}Page`]=m}),c.total=parseInt(f)),{data:Object.assign(Object.assign({},d),c),error:null}}catch(c){if(it(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(e){try{return await bt(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(it(n))return{data:null,error:n};throw n}}async _getOAuthClient(e){try{return await bt(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(it(n))return{data:null,error:n};throw n}}async _updateOAuthClient(e,n){try{return await bt(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(it(r))return{data:null,error:r};throw r}}async _deleteOAuthClient(e){try{return await bt(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(it(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(e){try{return await bt(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(it(n))return{data:null,error:n};throw n}}async _listCustomProviders(e){try{const n={};return e!=null&&e.type&&(n.type=e.type),await bt(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:n,xform:r=>{var i;return{data:{providers:(i=r==null?void 0:r.providers)!==null&&i!==void 0?i:[]},error:null}}})}catch(n){if(it(n))return{data:{providers:[]},error:n};throw n}}async _createCustomProvider(e){try{return await bt(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:e,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(it(n))return{data:null,error:n};throw n}}async _getCustomProvider(e){try{return await bt(this.fetch,"GET",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(it(n))return{data:null,error:n};throw n}}async _updateCustomProvider(e,n){try{return await bt(this.fetch,"PUT",`${this.url}/admin/custom-providers/${e}`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(it(r))return{data:null,error:r};throw r}}async _deleteCustomProvider(e){try{return await bt(this.fetch,"DELET
478E",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(it(n))return{data:null,error:n};throw n}}async _adminListPasskeys(e){El(this.experimental),Ou(e.userId);try{return await bt(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/passkeys`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(it(n))return{data:null,error:n};throw n}}async _adminDeletePasskey(e){El(this.experimental),Ou(e.userId),Ou(e.passkeyId);try{return await bt(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/passkeys/${e.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(it(n))return{data:null,error:n};throw n}}}function $j(t={}){return{getItem:e=>t[e]||null,setItem:(e,n)=>{t[e]=n},removeItem:e=>{delete t[e]}}}const Cc={debug:!!(globalThis&&iH()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class aH extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class Vj extends aH{}async function C0e(t,e,n){Cc.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const r=new globalThis.AbortController;let i;e>0&&(i=setTimeout(()=>{r.abort(),Cc.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e)),await Promise.resolve();try{return await globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},async s=>{if(s){clearTimeout(i),Cc.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,s.name);try{return await n()}finally{Cc.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,s.name)}}else{if(e===0)throw Cc.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new Vj(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(Cc.debug)try{const a=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(a,null," "))}catch(a){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",a)}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"),clearTimeout(i),await n()}})}catch(s){if(e>0&&clearTimeout(i),(s==null?void 0:s.name)==="AbortError"&&e>0){if(r.signal.aborted)return Cc.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",t),console.warn(`@supabase/gotrue-js: Lock "${t}" was not released within ${e}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,{mode:"exclusive",steal:!0},async a=>{if(a){Cc.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",t,a.name);try{return await n()}finally{Cc.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",t,a.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await n()}));throw Cc.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",t),new Vj(`Lock "${t}" was released because another request stole it`)}throw s}}function E0e(){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)}}function oH(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function A0e(t){return parseInt(t,16)}function P0e(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,r=>r.toString(16).padStart(2,"0")).join("")}function M0e(t){var e;const{chainId:n,domain:r,expirationTime:i,issuedAt:s=new Date,nonce:a,notBefore:o,requestId:l,resources:c,scheme:u,uri:d,version:f}=t;{if(!Number.isInteger(n))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${n}`);if(!r)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(a&&a.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${a}`);if(!d)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(f!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${f}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(` 479`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const h=oH(t.address),p=u?`${u}://${r}`:r,m=t.statement?`${t.statement} 480`:"",g=`${p} wants you to sign in with your Ethereum account: 481${h} 482 483${m}`;let v=`URI: ${d} 484Version: ${f} 485Chain ID: ${n}${a?` 486Nonce: ${a}`:""} 487Issued At: ${s.toISOString()}`;if(i&&(v+=` 488Expiration Time: ${i.toISOString()}`),o&&(v+=` 489Not Before: ${o.toISOString()}`),l&&(v+=` 490Request ID: ${l}`),c){let _=` 491Resources:`;for(const b of c){if(!b||typeof b!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${b}`);_+=` 492- ${b}`}v+=_}return`${g} 493${v}`}
493class Ri extends Error{constructor({message:e,code:n,cause:r,name:i}){var s;super(e,{cause:r}),this.__isWebAuthnError=!0,this.name=(s=i??(r instanceof Error?r.name:void 0))!==null&&s!==void 0?s:"Unknown Error",this.code=n}}class zk extends Ri{constructor(e,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:e}),this.name="WebAuthnUnknownError",this.originalError=n}}function N0e({error:t,options:e}){var n,r,i;const{publicKey:s}=e;if(!s)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Ri({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((n=s.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new Ri({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((r=s.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new Ri({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((i=s.authenticatorSelection)===null||i===void 0?void 0:i.userVerification)==="required")return new Ri({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new Ri({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new Ri({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return s.pubKeyCredParams.filter(o=>o.type==="public-key").length===0?new Ri({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new Ri({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const a=window.location.hostname;if(lH(a)){if(s.rp.id!==a)return new Ri({message:`The RP ID "${s.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Ri({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(s.user.id.byteLength<1||s.user.id.byteLength>64)return new Ri({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new Ri({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Ri({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function R0e({error:t,options:e}){const{publicKey:n}=e;if(!n)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Ri({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new Ri({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const r=window.location.hostname;if(lH(r)){if(n.rpId!==r)return new Ri({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Ri({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new Ri({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Ri({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class I0e{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const $M=new I0e;function qj(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:n,excludeCredentials:r}=t,i=mT(t,["challenge","user","excludeCredentials"]),s=Xg(e).buffer,a=Object.assign(Object.assign({},n),{id:Xg(n.id).buffer}),o=Object.assign(Object.assign({},i),{challenge:s,user:a});if(r&&r.length>0){o.excludeCredentials=new Array(r.length);for(let l=0;l<r.length;l++){const c=r[l];o.excludeCredentials[l]=Object.assign(Object.assign({}
493,c),{id:Xg(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return o}function Wj(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);const{challenge:e,allowCredentials:n}=t,r=mT(t,["challenge","allowCredentials"]),i=Xg(e).buffer,s=Object.assign(Object.assign({},r),{challenge:i});if(n&&n.length>0){s.allowCredentials=new Array(n.length);for(let a=0;a<n.length;a++){const o=n[a];s.allowCredentials[a]=Object.assign(Object.assign({},o),{id:Xg(o.id).buffer,type:o.type||"public-key",transports:o.transports})}}return s}function Gj(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const n=t;return{id:t.id,rawId:t.id,response:{attestationObject:fp(new Uint8Array(t.response.attestationObject)),clientDataJSON:fp(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=n.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Hj(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const n=t,r=t.getClientExtensionResults(),i=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:fp(new Uint8Array(i.authenticatorData)),clientDataJSON:fp(new Uint8Array(i.clientDataJSON)),signature:fp(new Uint8Array(i.signature)),userHandle:i.userHandle?fp(new Uint8Array(i.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(e=n.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function lH(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function $k(){var t,e;return!!(ws()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.get)=="function")}async function cH(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new zk("Browser returned unexpected credential type",e)}:{data:null,error:new zk("Empty credential response",e)}}catch(e){return{data:null,error:N0e({error:e,options:t})}}}async function uH(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new zk("Browser returned unexpected credential type",e)}:{data:null,error:new zk("Empty credential response",e)}}catch(e){return{data:null,error:R0e({error:e,options:t})}}}const L0e={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},O0e={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Vk(...t){const e=i=>i!==null&&typeof i=="object"&&!Array.isArray(i),n=i=>i instanceof ArrayBuffer||ArrayBuffer.isView(i),r={};for(const i of t)if(i)for(const s in i){const a=i[s];if(a!==void 0)if(Array.isArray(a))r[s]=a;else if(n(a))r[s]=a;else if(e(a)){const o=r[s];e(o)?r[s]=Vk(o,a):r[s]=Vk(a)}else r[s]=a}return r}function D0e(t,e){return Vk(L0e,t,e||{})}function F0e(t,e){return Vk(O0e,t,e||{})}class j0e{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:n,friendlyName:r,signal:i},s){var a;try{const{data:o,error:l}=await this.client.mfa.challenge({factorId:e,webauthn:n});if(!o)return{data:null,error:l};const c=i??$M.createNewAbortSignal();if(o.webauthn.type==="create"){const{user:u}=o.webauthn.credential_options.publicKey;if(!u.name){const d=r;if(d)u.name=`${u.id}:${d}`;else{const h=(await this.client.getUser()).data.user,p=((a=h==null?void 0:h.user_metadata)===null||a===void 0?void 0:a.name)||(h==null?void 0:h.email)||(h==null?void 0:h.id)||"User";u.name=`${u.id}:${p}`}}u.displayName||(u.displayName=u.name)}
493switch(o.webauthn.type){case"create":{const u=D0e(o.webauthn.credential_options.publicKey,s==null?void 0:s.create),{data:d,error:f}=await cH({publicKey:u,signal:c});return d?{data:{factorId:e,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:d}},error:null}:{data:null,error:f}}case"request":{const u=F0e(o.webauthn.credential_options.publicKey,s==null?void 0:s.request),{data:d,error:f}=await uH(Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:u,signal:c}));return d?{data:{factorId:e,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:d}},error:null}:{data:null,error:f}}}}catch(o){return it(o)?{data:null,error:o}:{data:null,error:new Bl("Unexpected error in challenge",o)}}}async _verify({challengeId:e,factorId:n,webauthn:r}){return this.client.mfa.verify({factorId:n,challengeId:e,webauthn:r})}async _authenticate({factorId:e,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:i}={}},s){if(!n)return{data:null,error:new xw("rpId is required for WebAuthn authentication")};try{if(!$k())return{data:null,error:new Bl("Browser does not support WebAuthn",null)};const{data:a,error:o}=await this.challenge({factorId:e,webauthn:{rpId:n,rpOrigins:r},signal:i},{request:s});if(!a)return{data:null,error:o};const{webauthn:l}=a;return this._verify({factorId:e,challengeId:a.challengeId,webauthn:{type:l.type,rpId:n,rpOrigins:r,credential_response:l.credential_response}})}catch(a){return it(a)?{data:null,error:a}:{data:null,error:new Bl("Unexpected error in authenticate",a)}}}async _register({friendlyName:e,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:i}={}},s){if(!n)return{data:null,error:new xw("rpId is required for WebAuthn registration")};try{if(!$k())return{data:null,error:new Bl("Browser does not support WebAuthn",null)};const{data:a,error:o}=await this._enroll({friendlyName:e});if(!a)return await this.client.mfa.listFactors().then(u=>{var d;return(d=u.data)===null||d===void 0?void 0:d.all.find(f=>f.factor_type==="webauthn"&&f.friendly_name===e&&f.status!=="unverified")}).then(u=>u?this.client.mfa.unenroll({factorId:u==null?void 0:u.id}):void 0),{data:null,error:o};const{data:l,error:c}=await this._challenge({factorId:a.id,friendlyName:a.friendly_name,webauthn:{rpId:n,rpOrigins:r},signal:i},{create:s});return l?this._verify({factorId:a.id,challengeId:l.challengeId,webauthn:{rpId:n,rpOrigins:r,type:l.webauthn.type,credential_response:l.webauthn.credential_response}}):{data:null,error:c}}catch(a){return it(a)?{data:null,error:a}:{data:null,error:new Bl("Unexpected error in register",a)}}}}E0e();const B0e={url:Vve,storageKey:qve,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Wve,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function Kj(t,e,n){return await n()}const Km={};class kw{get jwks(){var e,n;return(n=(e=Km[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(e){Km[this.storageKey]=Object.assign(Object.assign({},Km[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,n;return(n=(e=Km[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Km[this.storageKey]=Object.assign(Object.assign({},Km[this.storageKey]),{cachedAt:e})}constructor(e){var n,r,i,s;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=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;const a=Object.assign(Object.assign({},B0e),e);if(this.storageKey=a.storageKey,this.instanceID=(n=kw.nextInstanceID[this.storageKey])!==null&&n!==void 0?n:0,kw.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!a.debug,typeof a.debug=="function"&&(this.logger=a.debug),this.instanceID>0&&ws()){const o=`${this._logPrefix()} 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.`;console.warn(o),this.logDebugMessages&&console.trace(o)}if(this.persistSession=a.persistSession,this.autoRefreshToken=a.autoRefreshToken,this.experimental=(r=a.experimental)!==null&&r!==void 0?r:{},this.admin=new T0e({url:a.url,headers:a.headers,fetch:a.fetch,experimental:this.experimental}),this.url=a.url,this.headers=a.headers,this.fetch=sH(a.fetch),this.lock=a.lock||Kj,this.detectSessionInUrl=a.detectSessionInUrl,this.flowType=a.flowType,this.hasCustomAuthorizationHeader=a.hasCustomAuthorizationHeader,this.throwOnError=a.throwOnError,this.lockAcquireTimeout=a.lockAcquireTimeout,a.lock?this.lock=a.lock:this.persistSession&&ws()&&(!((i=globalThis==null?void 0:globalThis.navigator)===null||i===void 0)&&i.locks)?this.lock=C0e:this.lock=Kj,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),webauthn:new j0e(this)}
493,this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(a.storage?this.storage=a.storage:iH()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=$j(this.memoryStorage)),a.userStorage&&(this.userStorage=a.userStorage)):(this.memoryStorage={},this.storage=$j(this.memoryStorage)),ws()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(o){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",o)}(s=this.broadcastChannel)===null||s===void 0||s.addEventListener("message",async o=>{this._debug("received broadcast notification from other tab or client",o);try{await this._notifyAllSubscribers(o.data.event,o.data.session,!1)}catch(l){this._debug("#broadcastChannel","error",l)}})}a.skipAutoInitialize||this.initialize().catch(o=>{this._debug("#initialize()","error",o)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${tH}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{let n={},r="none";if(ws()&&(n=s0e(window.location.href),this._isImplicitGrantCallback(n)?r="implicit":await this._isPKCECallback(n)&&(r="pkce")),ws()&&this.detectSessionInUrl&&r!=="none"){const{data:i,error:s}=await this._getSessionFromURL(n,r);if(s){if(this._debug("#_initialize()","error detecting session from URL",s),Yve(s)){const l=(e=s.details)===null||e===void 0?void 0:e.code;if(l==="identity_already_exists"||l==="identity_not_found"||l==="single_identity_not_deletable")return{error:s}}return{error:s}}const{session:a,redirectType:o}=i;return this._debug("#_initialize()","detected session in URL",a,"redirect type",o),await this._saveSession(a),setTimeout(async()=>{o==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",a):await this._notifyAllSubscribers("SIGNED_IN",a)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return it(n)?this._returnResult({error:n}):this._returnResult({error:new Bl("Unexpected error during initialization",n)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var n,r,i;try{const s=await bt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(r=(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:(i=e==null?void 0:e.options)===null||i===void 0?void 0:i.captchaToken}},xform:zo}),{data:a,error:o}=s;if(o||!a)return this._returnResult({data:{user:null,session:null},error:o});const l=a.session,c=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(s){if(it(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signUp(e){var n,r,i;try{let s;if("email"in e){const{email:u,password:d,options:f}=e;let h=null,p=null;this.flowType==="pkce"&&([h,p]=await Hm(this.storage,this.storageKey)),s=await bt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:f==null?void 0:f.emailRedirectTo,body:{email:u,password:d,data:(n=f==null?void 0:f.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken},code_challenge:h,code_challenge_method:p},xform:zo})}else if("phone"in e){const{phone:u,password:d,options:f}=e;s=await bt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:d,data:(r=f==null?void 0:f.data)!==null&&r!==void 0?r:{},channel:(i=f==null?void 0:f.channel)!==null&&i!==void 0?i:"sms",gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken}},xform:zo})}else throw new Hb("You must provide either an email or phone number and a password");const{data:a,error:o}=s;
493if(o||!a)return await _s(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:o});const l=a.session,c=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(s){if(await _s(this.storage,`${this.storageKey}-code-verifier`),it(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithPassword(e){try{let n;if("email"in e){const{email:s,password:a,options:o}=e;n=await bt(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:a,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:Uj})}else if("phone"in e){const{phone:s,password:a,options:o}=e;n=await bt(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:a,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:Uj})}else throw new Hb("You must provide either an email or phone number and a password");const{data:r,error:i}=n;if(i)return this._returnResult({data:{user:null,session:null},error:i});if(!r||!r.session||!r.user){const s=new Gm;return this._returnResult({data:{user:null,session:null},error:s})}return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:i})}catch(n){if(it(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOAuth(e){var n,r,i,s;return await this._handleProviderSignIn(e.provider,{redirectTo:(n=e.options)===null||n===void 0?void 0:n.redirectTo,scopes:(r=e.options)===null||r===void 0?void 0:r.scopes,queryParams:(i=e.options)===null||i===void 0?void 0:i.queryParams,skipBrowserRedirect:(s=e.options)===null||s===void 0?void 0:s.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:n}=e;switch(n){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(e){var n,r,i,s,a,o,l,c,u,d,f;let h,p;if("message"in e)h=e.message,p=e.signature;else{const{chain:m,wallet:g,statement:v,options:_}=e;let b;if(ws())if(typeof g=="object")b=g;else{const M=window;if("ethereum"in M&&typeof M.ethereum=="object"&&"request"in M.ethereum&&typeof M.ethereum.request=="function")b=M.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) 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: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof g!="object"||!(_!=null&&_.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");b=g}const x=new URL((n=_==null?void 0:_.url)!==null&&n!==void 0?n:window.location.href),T=await b.request({method:"eth_requestAccounts"}).then(M=>M).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!T||T.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const N=oH(T[0]);let A=(r=_==null?void 0:_.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!A){const M=await b.request({method:"eth_chainId"});A=A0e(M)}const L={domain:x.host,address:N,statement:v,uri:x.href,version:"1",chainId:A,nonce:(i=_==null?void 0:_.signInWithEthereum)===null||i===void 0?void 0:i.nonce,issuedAt:(a=(s=_==null?void 0:_.signInWithEthereum)===null||s===void 0?void 0:s.issuedAt)!==null&&a!==void 0?a:new Date,expirationTime:(o=_==null?void 0:_.signInWithEthereum)===null||o===void 0?void 0:o.expirationTime,notBefore:(l=_==null?void 0:_.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(c=_==null?void 0:_.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(u=_==null?void 0:_.signInWithEthereum)===null||u===void 0?void 0:u.resources};h=M0e(L),p=await b.request({method:"personal_sign",params:[P0e(h),N]})}try{const{data:m,error:g}=await bt(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:h,signature:p},!((d=e.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(f=e.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:zo});if(g)throw g;if(!m||!m.session||!m.user){const v=new Gm;return this._returnResult({data:{user:null,session:null},error:v})}return m.session&&(await this._saveSession(m.session),await this._notifyAllSubscribers("SIGNED_IN",m.session)),this._returnResult({data:Object.assign({},m),error:g})}catch(m){if(it(m))return this._returnResult({data:{user:null,session:null},error:m});throw m}}async signInWithSolana(e){var n,r,i,s,a,o,l,c,u,d,f,h;let p,m;if("message"in e)p=e.message,m=e.signature;else{const{chain:g,wallet:v,statement:_,options:b}=e;let x;if(ws())if(typeof v=="object")x=v;else{const N=window;if("solana"in N&&typeof N.solana=="object"&&("signIn"in N.solana&&typeof N.solana.signIn=="function"||"signMessage"in N.solana&&typeof N.solana.signMessage=="function"))x=N.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 v!="object"||!(b!=null&&b.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");x=v}const T=new URL((n=b==null?void 0:b.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in x&&x.signIn){const N=await x.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},b==null?void 0:b.signInWithSolana),{version:"1",domain:T.host,uri:T.href}),_?{statement:_}:null));let A;if(Array.isArray(N)&&N[0]&&typeof N[0]=="object")A=N[0];else if(N&&typeof N=="object"&&"signedMessage"in N&&"signature"in N)A=N;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in A&&"signature"in A&&(typeof A.signedMessage=="string"||A.signedMessage instanceof Uint8Array)&&A.signature instanceof Uint8Array)p=typeof A.signedMessage=="string"?A.signedMessage:new TextDecoder().decode(A.signedMessage),m=A.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in x)||typeof x.signMessage!="function"||!("publicKey"in x)||typeof x!="object"||!x.publicKey||!("toBase58"in x.publicKey)||typeof x.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");p=[`${T.host} wants you to sign in with your Solana account:`,x.publicKey.toBase58(),..._?["",_,""]:[""],"Version: 1",`URI: ${T.href}`,`Issued At: ${(i=(r=b==null?void 0:b.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&i!==void 0?i:new Date().toISOString()}`,...!((s=b==null?void 0:b.signInWithSolana)===null||s===void 0)&&s.notBefore?[`Not Before: ${b.signInWithSolana.notBefore}`]:[],...!((a=b==null?void 0:b.signInWithSolana)===null||a===void 0)&&a.expirationTime?[`Expiration Time: ${b.signInWithSolana.expirationTime}`]:[],...!((o=b==null?void 0:b.signInWithSolana)===null||o===void 0)&&o.chainId?[`Chain ID: ${b.signInWithSolana.chainId}`]:[],...!((l=b==null?void 0:b.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${b.signInWithSolana.nonce}`]:[],...!((c=b==null?void 0:b.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${b.signInWithSolana.requestId}`]:[],...!((d=(u=b==null?void 0:b.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||d===void 0)&&d.length?["Resources",...b.signInWithSolana.resources.map(A=>`- ${A}`)]:[]].join(` 494`);const N=await x.signMessage(new TextEncoder().encode(p),"utf8");if(!N||!(N instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");m=N}}try{const{data:g,error:v}=await bt(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:p,signature:fp(m)},!((f=e.options)===null||f===void 0)&&f.captchaToken?{gotrue_meta_security:{captcha_token:(h=e.options)===null||h===void 0?void 0:h.captchaToken}}:null),xform:zo});if(v)throw v;if(!g||!g.session||!g.user){const _=new Gm;return this._returnResult({data:{user:null,session:null},error:_})}return g.session&&(await this._saveSession(g.session),await this._notifyAllSubscribers("SIGNED_IN",g.session)),this._returnResult({data:Object.assign({},g),error:v})}catch(g){if(it(g))return this._returnResult({data:{user:null,session:null},error:g});throw g}}async _exchangeCodeForSession(e){const n=await jf(this.storage,`${this.storageKey}-code-verifier`),[r,i]=(n??"").split("/");try{if(!r&&this.flowType==="pkce")throw new Xve;const{data:s,error:a}=await bt(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:zo});if(await _s(this.storage,`${this.storageKey}-code-verifier`),a)throw a;if(!s||!s.session||!s.user){const o=new Gm;return this._returnResult({data:{user:null,session:null,redirectType:null},error:o})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers(i==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",s.session)),this._returnResult({data:Object.assign(Object.assign({},s),{redirectType:i??null}),error:a})}catch(s){if(await _s(this.storage,`${this.storageKey}-code-verifier`),it(s))return this._returnResult({data:{user:null,session:null,redirectType:null},error:s});throw s}}async signInWithIdToken(e){try{const{options:n,provider:r,token:i,access_token:s,nonce:a}=e,o=await bt(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:i,access_token:s,nonce:a,gotrue_meta_security:{captcha_token:n==null?void 0:n.captchaToken}},xform:zo}),{data:l,error:c}=o;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l||!l.session||!l.user){const u=new Gm;return this._returnResult({data:{user:null,session:null},error:u})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),this._returnResult({data:l,error:c})}catch(n){if(it(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOtp(e){var n,r,i,s,a;try{if("email"in e){const{email:o,options:l}=e;let c=null,u=null;this.flowType==="pkce"&&([c,u]=await Hm(this.storage,this.storageKey));const{error:d}=await bt(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:o,data:(n=l==null?void 0:l.data)!==null&&n!==void 0?n:{},create_user:(r=l==null?void 0:l.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},code_challenge:c,code_challenge_method:u},redirectTo:l==null?void 0:l.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:d})}if("phone"in e){const{phone:o,options:l}=e,{data:c,error:u}=await bt(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:o,data:(i=l==null?void 0:l.data)!==null&&i!==void 0?i:{},create_user:(s=l==null?void 0:l.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},channel:(a=l==null?void 0:l.channel)!==null&&a!==void 0?a:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:c==null?void 0:c.message_id},error:u})}throw new Hb("You must provide either an email or phone number.")}catch(o){if(await _s(this.storage,`${this.storageKey}-code-verifier`),it(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async verifyOtp(e){var n,r;try{let i,s;"options"in e&&(i=(n=e.options)===null||n===void 0?void 0:n.redirectTo,s=(r=e.options)===null||r===void 0?void 0:r.captchaToken);const{data:a,error:o}=await bt(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:s}}),redirectTo:i,xform:zo});if(o)throw o;if(!a)throw new Error("An error occurred on token verification.");const l=a.session,c=a.user;return l!=null&&l.access_token&&(await this._saveSession(l),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(i){if(it(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithSSO(e){var n,r,i,s,a;try{let o=null,l=null;this.flowType==="pkce"&&([o,l]=await Hm(this.storage,this.storageKey));const c=await bt(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:(r=(n=e.options)===null||n===void 0?void 0:n.redirectTo)!==null&&r!==void 0?r:void 0}),!((i=e==null?void 0:e.options)===null||i===void 0)&&i.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}
494:null),{skip_http_redirect:!0,code_challenge:o,code_challenge_method:l}),headers:this.headers,xform:x0e});return!((s=c.data)===null||s===void 0)&&s.url&&ws()&&!(!((a=e.options)===null||a===void 0)&&a.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(o){if(await _s(this.storage,`${this.storageKey}-code-verifier`),it(o))return this._returnResult({data:null,error:o});throw o}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:n},error:r}=e;if(r)throw r;if(!n)throw new ns;const{error:i}=await bt(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return this._returnResult({data:{user:null,session:null},error:i})})}catch(e){if(it(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const n=`${this.url}/resend`;if("email"in e){const{email:r,type:i,options:s}=e,{error:a}=await bt(this.fetch,"POST",n,{headers:this.headers,body:{email:r,type:i,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken}},redirectTo:s==null?void 0:s.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:a})}else if("phone"in e){const{phone:r,type:i,options:s}=e,{data:a,error:o}=await bt(this.fetch,"POST",n,{headers:this.headers,body:{phone:r,type:i,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:a==null?void 0:a.message_id},error:o})}throw new Hb("You must provide either an email or phone number and a type")}catch(n){if(it(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async n=>n))}async _acquireLock(e,n){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),i=(async()=>(await r,await n()))();return this.pendingInLock.push((async()=>{try{await i}catch{}})()),i}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const r=n();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const i=[...this.pendingInLock];await Promise.all(i),this.pendingInLock.splice(0,i.length)}return await r}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 n=await this.__loadSession();return await e(n)}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 n=await jf(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?e=n:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const r=e.expires_at?e.expires_at*1e3-Date.now()<y5:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",e.expires_at),!r){if(this.userStorage){const a=await jf(this.userStorage,this.storageKey+"-user");a!=null&&a.user?e.user=a.user:e.user=w5()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const a={value:this.suppressGetSessionWarning};e.user=y0e(e.user,a),a.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:i,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{session:null},error:s}):this._returnResult({data:{session:i},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;const n=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return n.data.user&&(this.suppressGetSessionWarning=!0),n}async _getUser(e){try{return e?await bt(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:dh}):await this._useSession(async n=>{var r,i,s;const{data:a,error:o}=n;
494if(o)throw o;return!(!((r=a.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new ns}:await bt(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(s=(i=a.session)===null||i===void 0?void 0:i.access_token)!==null&&s!==void 0?s:void 0,xform:dh})})}catch(n){if(it(n))return Gb(n)&&(await this._removeSession(),await _s(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:n});throw n}}async updateUser(e,n={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,n))}async _updateUser(e,n={}){try{return await this._useSession(async r=>{const{data:i,error:s}=r;if(s)throw s;if(!i.session)throw new ns;const a=i.session;let o=null,l=null;this.flowType==="pkce"&&e.email!=null&&([o,l]=await Hm(this.storage,this.storageKey));const{data:c,error:u}=await bt(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n==null?void 0:n.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:o,code_challenge_method:l}),jwt:a.access_token,xform:dh});if(u)throw u;return a.user=c.user,await this._saveSession(a),await this._notifyAllSubscribers("USER_UPDATED",a),this._returnResult({data:{user:a.user},error:null})})}catch(r){if(await _s(this.storage,`${this.storageKey}-code-verifier`),it(r))return this._returnResult({data:{user:null},error:r});throw r}}async setSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new ns;const n=Date.now()/1e3;let r=n,i=!0,s=null;const{payload:a}=Jb(e.access_token);if(a.exp&&(r=a.exp,i=r<=n),i){const{data:o,error:l}=await this._callRefreshToken(e.refresh_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!o)return{data:{user:null,session:null},error:null};s=o}else{const{data:o,error:l}=await this._getUser(e.access_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});s={access_token:e.access_token,refresh_token:e.refresh_token,user:o.user,token_type:"bearer",expires_in:r-n,expires_at:r},await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)}return this._returnResult({data:{user:s.user,session:s},error:null})}catch(n){if(it(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async n=>{var r;if(!e){const{data:a,error:o}=n;if(o)throw o;e=(r=a.session)!==null&&r!==void 0?r:void 0}if(!(e!=null&&e.refresh_token))throw new ns;const{data:i,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{user:null,session:null},error:s}):i?this._returnResult({data:{user:i.user,session:i},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(n){if(it(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async _getSessionFromURL(e,n){var r;try{if(!ws())throw new Kb("No browser detected.");if(e.error||e.error_description||e.error_code)throw new Kb(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new Ij("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Kb("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new Ij("No code detected.");const{data:b,error:x}=await this._exchangeCodeForSession(e.code);if(x)throw x;const T=new URL(window.location.href);return T.searchParams.delete("code"),window.history.replaceState(window.history.state,"",T.toString()),{data:{session:b.session,redirectType:(r=b.redirectType)!==null&&r!==void 0?r:null},error:null}}const{provider_token:i,provider_refresh_token:s,access_token:a,refresh_token:o,expires_in:l,expires_at:c,token_type:u}=e;if(!a||!l||!o||!u)throw new Kb("No session defined in URL");const d=Math.round(Date.now()/1e3),f=parseInt(l);let h=d+f;c&&(h=parseInt(c));const p=h-d;
494p*1e3<=fg&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${p}s, should have been closer to ${f}s`);const m=h-f;d-m>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",m,h,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,h,d);const{data:g,error:v}=await this._getUser(a);if(v)throw v;const _={provider_token:i,provider_refresh_token:s,access_token:a,expires_in:f,expires_at:h,refresh_token:o,token_type:u,user:g.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:_,redirectType:e.type},error:null})}catch(i){if(it(i))return this._returnResult({data:{session:null,redirectType:null},error:i});throw i}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){const n=await jf(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&n)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async n=>{var r;const{data:i,error:s}=n;if(s&&!Gb(s))return this._returnResult({error:s});const a=(r=i.session)===null||r===void 0?void 0:r.access_token;if(a){const{error:o}=await this.admin.signOut(a,e);if(o&&!(Jve(o)&&(o.status===404||o.status===401||o.status===403)||Gb(o)))return this._returnResult({error:o})}return e!=="others"&&(await this._removeSession(),await _s(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const n=i0e(),r={id:n,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,r),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:r}}}async _emitInitialSession(e){return await this._useSession(async n=>{var r,i;try{const{data:{session:s},error:a}=n;if(a)throw a;await((r=this.stateChangeEmitters.get(e))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",s)),this._debug("INITIAL_SESSION","callback id",e,"session",s)}catch(s){await((i=this.stateChangeEmitters.get(e))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",s),Gb(s)?console.warn(s):console.error(s)}})}async resetPasswordForEmail(e,n={}){let r=null,i=null;this.flowType==="pkce"&&([r,i]=await Hm(this.storage,this.storageKey,!0));try{return await bt(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:i,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(s){if(await _s(this.storage,`${this.storageKey}-code-verifier`),it(s))return this._returnResult({data:null,error:s});throw s}}async getUserIdentities(){var e;try{const{data:n,error:r}=await this.getUser();if(r)throw r;return this._returnResult({data:{identities:(e=n.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(n){if(it(n))return this._returnResult({data:null,error:n});throw n}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var n;try{const{data:r,error:i}=await this._useSession(async s=>{var a,o,l,c,u;const{data:d,error:f}=s;if(f)throw f;const h=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(a=e.options)===null||a===void 0?void 0:a.redirectTo,scopes:(o=e.options)===null||o===void 0?void 0:o.scopes,queryParams:(l=e.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:!0});return await bt(this.fetch,"GET",h,{headers:this.headers,jwt:(u=(c=d.session)===null||c===void 0?void 0:c.access_token)!==null&&u!==void 0?u:void 0})});if(i)throw i;
494return ws()&&!(!((n=e.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(r==null?void 0:r.url),this._returnResult({data:{provider:e.provider,url:r==null?void 0:r.url},error:null})}catch(r){if(it(r))return this._returnResult({data:{provider:e.provider,url:null},error:r});throw r}}async linkIdentityIdToken(e){return await this._useSession(async n=>{var r;try{const{error:i,data:{session:s}}=n;if(i)throw i;const{options:a,provider:o,token:l,access_token:c,nonce:u}=e,d=await bt(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=s==null?void 0:s.access_token)!==null&&r!==void 0?r:void 0,body:{provider:o,id_token:l,access_token:c,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:zo}),{data:f,error:h}=d;return h?this._returnResult({data:{user:null,session:null},error:h}):!f||!f.session||!f.user?this._returnResult({data:{user:null,session:null},error:new Gm}):(f.session&&(await this._saveSession(f.session),await this._notifyAllSubscribers("USER_UPDATED",f.session)),this._returnResult({data:f,error:h}))}catch(i){if(await _s(this.storage,`${this.storageKey}-code-verifier`),it(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}})}async unlinkIdentity(e){try{return await this._useSession(async n=>{var r,i;const{data:s,error:a}=n;if(a)throw a;return await bt(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(i=(r=s.session)===null||r===void 0?void 0:r.access_token)!==null&&i!==void 0?i:void 0})})}catch(n){if(it(n))return this._returnResult({data:null,error:n});throw n}}async _refreshAccessToken(e){const n=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{const r=Date.now();return await l0e(async i=>(i>0&&await o0e(200*Math.pow(2,i-1)),this._debug(n,"refreshing attempt",i),await bt(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:zo})),(i,s)=>{const a=200*Math.pow(2,i);return s&&_5(s)&&Date.now()+a-r<fg})}catch(r){if(this._debug(n,"error",r),it(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}finally{this._debug(n,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,n){const r=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:n.redirectTo,scopes:n.scopes,queryParams:n.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",n,"url",r),ws()&&!n.skipBrowserRedirect&&window.location.assign(r),{data:{provider:e,url:r},error:null}}async _recoverAndRefresh(){var e,n;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const i=await jf(this.storage,this.storageKey);if(i&&this.userStorage){let a=await jf(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!a&&(a={user:i.user},await pg(this.userStorage,this.storageKey+"-user",a)),i.user=(e=a==null?void 0:a.user)!==null&&e!==void 0?e:w5()}else if(i&&!i.user&&!i.user){const a=await jf(this.storage,this.storageKey+"-user");a&&(a!=null&&a.user)?(i.user=a.user,await _s(this.storage,this.storageKey+"-user"),await pg(this.storage,this.storageKey,i)):i.user=w5()}if(this._debug(r,"session from storage",i),!this._isValidSession(i)){this._debug(r,"session is not valid"),i!==null&&await this._removeSession();return}const s=((n=i.expires_at)!==null&&n!==void 0?n:1/0)*1e3-Date.now()<y5;if(this._debug(r,`session has${s?"":" not"} expired with margin of ${y5}s`),s){if(this.autoRefreshToken&&i.refresh_token){const{error:a}=await this._callRefreshToken(i.refresh_token);a&&(console.error(a),_5(a)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",a),await this._removeSession()))}}else if(i.user&&i.user.__isUserNotAvailableProxy===!0)try{const{data:a,error:o}=await this._getUser(i.access_token);!o&&(a!=null&&a.user)?(i.user=a.user,await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(a){console.error("Error getting user data:",a),this._debug(r,"error getting user data, skipping SIGNED_IN notification",a)}else await this._notifyAllSubscribers("SIGNED_IN",i)}catch(i){this._debug(r,"error",i),console.error(i);return}finally{this._debug(r,"end")}}async _callRefreshToken(e){var n,r;if(!e)throw new ns;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const i=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(i,"begin");try{this.refreshingDeferred=new gT;const{data:s,error:a}=await this._refreshAccessToken(e);if(a)throw a;if(!s.session)throw new ns;await this._saveSession(s.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",s.session);const o={data:s.session,error:null};return this.refreshingDeferred.resolve(o),o}catch(s){if(this._debug(i,"error",s),it(s)){const a={data:null,error:s};return _5(s)||await this._removeSession(),(n=this.refreshingDeferred)===null||n===void 0||n.resolve(a),a}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(s),s}finally{this.refreshingDeferred=null,this._debug(i,"end")}}async _notifyAllSubscribers(e,n,r=!0){const i=`#_notifyAllSubscribers(${e})`;this._debug(i,"begin",n,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:n});const s=[],a=Array.from(this.stateChangeEmitters.values()).map(async o=>{try{await o.callback(e,n)}catch(l){s.push(l)}});if(await Promise.all(a),s.length>0){for(let o=0;o<s.length;o+=1)console.error(s[o]);throw s[0]}}finally{this._debug(i,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await _s(this.storage,`${this.storageKey}-code-verifier`);const n=Object.assign({},e),r=n.user&&n.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!r&&n.user&&await pg(this.userStorage,this.storageKey+"-user",{user:n.user});const i=Object.assign({},n);delete i.user;const s=jj(i);await pg(this.storage,this.storageKey,s)}else{const i=jj(n);await pg(this.storage,this.storageKey,i)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await _s(this.storage,this.storageKey),await _s(this.storage,this.storageKey+"-code-verifier"),await _s(this.storage,this.storageKey+"-user"),this.userStorage&&await _s(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&ws()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}
494catch(n){console.error("removing visibilitychange callback failed",n)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),fg);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e);const n=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=n,n&&typeof n=="object"&&typeof n.unref=="function"?n.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(n)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const n=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,n&&clearTimeout(n)}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 n=>{const{data:{session:r}}=n;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const i=Math.floor((r.expires_at*1e3-e)/fg);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${fg}ms, refresh threshold is ${jM} ticks`),i<=jM&&await this._callRefreshToken(r.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof aH)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!ws()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug("#visibilityChangedCallback","error",e)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const n=`#_onVisibilityChanged(${e})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(n,"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,n,r){const i=[`provider=${encodeURIComponent(n)}`];if(r!=null&&r.redirectTo&&i.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),r!=null&&r.scopes&&i.push(`scopes=${encodeURIComponent(r.scopes)}`),this.flowType==="pkce"){const[s,a]=await Hm(this.storage,this.storageKey),o=new URLSearchParams({code_challenge:`${encodeURIComponent(s)}`,code_challenge_method:`${encodeURIComponent(a)}`});i.push(o.toString())}if(r!=null&&r.queryParams){const s=new URLSearchParams(r.queryParams);i.push(s.toString())}return r!=null&&r.skipBrowserRedirect&&i.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${e}?${i.join("&")}`}async _unenroll(e){try{return await this._useSession(async n=>{var r;const{data:i,error:s}=n;return s?this._returnResult({data:null,error:s}):await bt(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token})})}catch(n){if(it(n))return this._returnResult({data:null,error:n});throw n}}async _enroll(e){try{return await this._useSession(async n=>{var r,i;const{data:s,error:a}=n;
494if(a)return this._returnResult({data:null,error:a});const o=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:l,error:c}=await bt(this.fetch,"POST",`${this.url}/factors`,{body:o,headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.access_token});return c?this._returnResult({data:null,error:c}):(e.factorType==="totp"&&l.type==="totp"&&(!((i=l==null?void 0:l.totp)===null||i===void 0)&&i.qr_code)&&(l.totp.qr_code=`data:image/svg+xml;utf-8,${l.totp.qr_code}`),this._returnResult({data:l,error:null}))})}catch(n){if(it(n))return this._returnResult({data:null,error:n});throw n}}async _verify(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var r;const{data:i,error:s}=n;if(s)return this._returnResult({data:null,error:s});const a=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?Gj(e.webauthn.credential_response):Hj(e.webauthn.credential_response)})}:{code:e.code}),{data:o,error:l}=await bt(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:a,headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token});return l?this._returnResult({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),this._returnResult({data:o,error:l}))})}catch(n){if(it(n))return this._returnResult({data:null,error:n});throw n}})}async _challenge(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var r;const{data:i,error:s}=n;if(s)return this._returnResult({data:null,error:s});const a=await bt(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token});if(a.error)return a;const{data:o}=a;if(o.type!=="webauthn")return{data:o,error:null};switch(o.webauthn.type){case"create":return{data:Object.assign(Object.assign({},o),{webauthn:Object.assign(Object.assign({},o.webauthn),{credential_options:Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:qj(o.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},o),{webauthn:Object.assign(Object.assign({},o.webauthn),{credential_options:Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:Wj(o.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(it(n))return this._returnResult({data:null,error:n});throw n}})}async _challengeAndVerify(e){const{data:n,error:r}=await this._challenge({factorId:e.factorId});return r?this._returnResult({data:null,error:r}):await this._verify({factorId:e.factorId,challengeId:n.id,code:e.code})}async _listFactors(){var e;const{data:{user:n},error:r}=await this.getUser();if(r)return{data:null,error:r};const i={all:[],phone:[],totp:[],webauthn:[]};for(const s of(e=n==null?void 0:n.factors)!==null&&e!==void 0?e:[])i.all.push(s),s.status==="verified"&&i[s.factor_type].push(s);return{data:i,error:null}}async _getAuthenticatorAssuranceLevel(e){var n,r,i,s;if(e)try{const{payload:h}=Jb(e);let p=null;h.aal&&(p=h.aal);let m=p;const{data:{user:g},error:v}=await this.getUser(e);if(v)return this._returnResult({data:null,error:v});((r=(n=g==null?void 0:g.factors)===null||n===void 0?void 0:n.filter(x=>x.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(m="aal2");const b=h.amr||[];return{data:{currentLevel:p,nextLevel:m,currentAuthenticationMethods:b},error:null}}catch(h){if(it(h))return this._returnResult({data:null,error:h});throw h}const{data:{session:a},error:o}
494=await this.getSession();if(o)return this._returnResult({data:null,error:o});if(!a)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:l}=Jb(a.access_token);let c=null;l.aal&&(c=l.aal);let u=c;((s=(i=a.user.factors)===null||i===void 0?void 0:i.filter(h=>h.status==="verified"))!==null&&s!==void 0?s:[]).length>0&&(u="aal2");const f=l.amr||[];return{data:{currentLevel:c,nextLevel:u,currentAuthenticationMethods:f},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async n=>{const{data:{session:r},error:i}=n;return i?this._returnResult({data:null,error:i}):r?await bt(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:r.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new ns})})}catch(n){if(it(n))return this._returnResult({data:null,error:n});throw n}}async _approveAuthorization(e,n){try{return await this._useSession(async r=>{const{data:{session:i},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!i)return this._returnResult({data:null,error:new ns});const a=await bt(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"approve"},xform:o=>({data:o,error:null})});return a.data&&a.data.redirect_url&&ws()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(r){if(it(r))return this._returnResult({data:null,error:r});throw r}}async _denyAuthorization(e,n){try{return await this._useSession(async r=>{const{data:{session:i},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!i)return this._returnResult({data:null,error:new ns});const a=await bt(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"deny"},xform:o=>({data:o,error:null})});return a.data&&a.data.redirect_url&&ws()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(r){if(it(r))return this._returnResult({data:null,error:r});throw r}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:n},error:r}=e;return r?this._returnResult({data:null,error:r}):n?await bt(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new ns})})}catch(e){if(it(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async n=>{const{data:{session:r},error:i}=n;return i?this._returnResult({data:null,error:i}):r?(await bt(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new ns})})}catch(n){if(it(n))return this._returnResult({data:null,error:n});throw n}}async fetchJwk(e,n={keys:[]}){let r=n.keys.find(o=>o.kid===e);if(r)return r;const i=Date.now();if(r=this.jwks.keys.find(o=>o.kid===e),r&&this.jwks_cached_at+Hve>i)return r;const{data:s,error:a}=await bt(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(a)throw a;return!s.keys||s.keys.length===0||(this.jwks=s,this.jwks_cached_at=i,r=s.keys.find(o=>o.kid===e),!r)?null:r}async getClaims(e,n={}){try{let r=e;if(!r){const{data:h,error:p}
494=await this.getSession();if(p||!h.session)return this._returnResult({data:null,error:p});r=h.session.access_token}const{header:i,payload:s,signature:a,raw:{header:o,payload:l}}=Jb(r);n!=null&&n.allowExpired||m0e(s.exp);const c=!i.alg||i.alg.startsWith("HS")||!i.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(i.kid,n!=null&&n.keys?{keys:n.keys}:n==null?void 0:n.jwks);if(!c){const{error:h}=await this.getUser(r);if(h)throw h;return{data:{claims:s,header:i,signature:a},error:null}}const u=g0e(i.alg),d=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,d,a,n0e(`${o}.${l}`)))throw new zM("Invalid JWT signature");return{data:{claims:s,header:i,signature:a},error:null}}catch(r){if(it(r))return this._returnResult({data:null,error:r});throw r}}async signInWithPasskey(e){var n,r,i;El(this.experimental);try{if(!$k())return this._returnResult({data:null,error:new Bl("Browser does not support WebAuthn",null)});const{data:s,error:a}=await this._startPasskeyAuthentication({options:{captchaToken:(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.captchaToken}});if(a||!s)return this._returnResult({data:null,error:a});const o=Wj(s.options),l=(i=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.signal)!==null&&i!==void 0?i:$M.createNewAbortSignal(),{data:c,error:u}=await uH({publicKey:o,signal:l});if(u||!c)return this._returnResult({data:null,error:u??new Bl("WebAuthn ceremony failed",null)});const d=Hj(c);return this._verifyPasskeyAuthentication({challengeId:s.challenge_id,credential:d})}catch(s){if(it(s))return this._returnResult({data:null,error:s});throw s}}async registerPasskey(e){var n,r;El(this.experimental);try{if(!$k())return this._returnResult({data:null,error:new Bl("Browser does not support WebAuthn",null)});const{data:i,error:s}=await this._startPasskeyRegistration();if(s||!i)return this._returnResult({data:null,error:s});const a=qj(i.options),o=(r=(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.signal)!==null&&r!==void 0?r:$M.createNewAbortSignal(),{data:l,error:c}=await cH({publicKey:a,signal:o});if(c||!l)return this._returnResult({data:null,error:c??new Bl("WebAuthn ceremony failed",null)});const u=Gj(l);return this._verifyPasskeyRegistration({challengeId:i.challenge_id,credential:u})}catch(i){if(it(i))return this._returnResult({data:null,error:i});throw i}}async _startPasskeyRegistration(){El(this.experimental);try{return await this._useSession(async e=>{const{data:{session:n},error:r}=e;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new ns});const{data:i,error:s}=await bt(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:n.access_token,body:{}});return s?this._returnResult({data:null,error:s}):this._returnResult({data:i,error:null})})}catch(e){if(it(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){El(this.experimental);try{return await this._useSession(async n=>{const{data:{session:r},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new ns});const{data:s,error:a}=await bt(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:r.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return a?this._returnResult({data:null,error:a}):this._returnResult({data:s,error:null})})}catch(n){if(it(n))return this._returnResult({data:null,error:n});throw n}}async _startPasskeyAuthentication(e){var n;El(this.experimental);try{const{data:r,error:i}=await bt(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.captchaToken}}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:r,error:null})}catch(r){if(it(r))return this._returnResult({data:null,error:r});throw r}}async _verifyPasskeyAuthentication(e){El(this.experimental);try{const{data:n,error:r}=await bt(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:zo});return r?this._returnResult({data:null,error:r}):(n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:n,error:null}))}catch(n){if(it(n))return this._returnResult({data:null,error:n});throw n}}async _listPasskeys(){El(this.experimental);try{return await this._useSession(async e=>{const{data:{session:n},error:r}=e;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new ns});const{data:i,error:s}=await bt(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:n.access_token,xform:a=>({data:a,error:null})});return s?this._returnResult({data:null,error:s}):this._returnResult({data:i,error:null})})}catch(e){if(it(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){El(this.experimental);try{return await this._useSession(async n=>{const{data:{session:r},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new ns});const{data:s,error:a}=await bt(this.fetch,"PATCH",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:r.access_token,body:{friendly_name:e.friendlyName}});return a?this._returnResult({data:null,error:a}):this._returnResult({data:s,error:null})})}catch(n){if(it(n))return this._returnResult({data:null,error:n});throw n}}async _deletePasskey(e){El(this.experimental);try{return await this._useSession(async n=>{const{data:{session:r},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new ns});const{error:s}
494=await bt(this.fetch,"DELETE",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:r.access_token,noResolveJson:!0});return s?this._returnResult({data:null,error:s}):this._returnResult({data:null,error:null})})}catch(n){if(it(n))return this._returnResult({data:null,error:n});throw n}}}kw.nextInstanceID={};const U0e=kw,z0e="2.105.1";let Zy="";typeof Deno<"u"?Zy="deno":typeof document<"u"?Zy="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Zy="react-native":Zy="node";const $0e={"X-Client-Info":`supabase-js-${Zy}/${z0e}`},V0e={headers:$0e},q0e={schema:"public"},W0e={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},G0e={};function Sw(t){"@babel/helpers - typeof";return Sw=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Sw(t)}function H0e(t,e){if(Sw(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(Sw(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function K0e(t){var e=H0e(t,"string");return Sw(e)=="symbol"?e:e+""}function J0e(t,e,n){return(e=K0e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Jj(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function fi(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Jj(Object(n),!0).forEach(function(r){J0e(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Jj(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}const Y0e=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),X0e=()=>Headers,Q0e=(t,e,n)=>{const r=Y0e(n),i=X0e();return async(s,a)=>{var o;const l=(o=await e())!==null&&o!==void 0?o:t;let c=new i(a==null?void 0:a.headers);return c.has("apikey")||c.set("apikey",t),c.has("Authorization")||c.set("Authorization",`Bearer ${l}`),r(s,fi(fi({},a),{},{headers:c}))}};function Z0e(t){return t.endsWith("/")?t:t+"/"}function eye(t,e){var n,r;const{db:i,auth:s,realtime:a,global:o}=t,{db:l,auth:c,realtime:u,global:d}=e,f={db:fi(fi({},l),i),auth:fi(fi({},c),s),realtime:fi(fi({},u),a),storage:{},global:fi(fi(fi({},d),o),{},{headers:fi(fi({},(n=d==null?void 0:d.headers)!==null&&n!==void 0?n:{}),(r=o==null?void 0:o.headers)!==null&&r!==void 0?r:{})}),accessToken:async()=>""};return t.accessToken?f.accessToken=t.accessToken:delete f.accessToken,f}function tye(t){const e=t==null?void 0:t.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(Z0e(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var nye=class extends U0e{constructor(t){super(t)}},rye=class{constructor(t,e,n){var r,i;this.supabaseUrl=t,this.supabaseKey=e;const s=tye(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",s),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",s),this.storageUrl=new URL("storage/v1",s),this.functionsUrl=new URL("functions/v1",s);const a=`sb-${s.hostname.split(".")[0]}-auth-token`,o={db:q0e,realtime:G0e,auth:fi(fi({},W0e),{},{storageKey:a}),global:V0e},l=eye(n??{},o);if(this.storageKey=(r=l.auth.storageKey)!==null&&r!==void 0?r:"",this.headers=(i=l.global.headers)!==null&&i!==void 0?i:{},l.accessToken)this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(u,d)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(d)} is not possible`)}});else{var c;this.auth=this._initSupabaseAuthClient((c=l.auth)!==null&&c!==void 0?c:{},this.headers,l.global.fetch)}this.fetch=Q0e(e,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(fi({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(u=>this.realtime.setAuth(u)).catch(u=>console.warn("Failed to set initial Realtime auth token:",u)),this.rest=new Nge(new URL("rest/v1",s).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch,timeout:l.db.timeout,urlLengthLimit:l.db.urlLengthLimit}),this.storage=new $ve(this.storageUrl.href,this.headers,this.fetch,n==null?void 0:n.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new bge(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,e={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,n)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t=this,e,n;if(t.accessToken)return await t.accessToken();const{data:r}=await t.auth.getSession();
494return(e=(n=r.session)===null||n===void 0?void 0:n.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:n,storage:r,userStorage:i,storageKey:s,flowType:a,lock:o,debug:l,throwOnError:c,experimental:u},d,f){const h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new nye({url:this.authUrl.href,headers:fi(fi({},h),d),storageKey:s,autoRefreshToken:t,persistSession:e,detectSessionInUrl:n,storage:r,userStorage:i,flowType:a,lock:o,debug:l,throwOnError:c,experimental:u,fetch:f,hasCustomAuthorizationHeader:Object.keys(this.headers).some(p=>p.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new dve(this.realtimeUrl.href,fi(fi({},t),{},{params:fi(fi({},{apikey:this.supabaseKey}),t==null?void 0:t.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e==null?void 0:e.access_token)})}_handleTokenChanged(t,e,n){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const iye=(t,e,n)=>new rye(t,e,n);function sye(){if(typeof window<"u")return!1;const t=globalThis.process;if(!t)return!1;const e=t.version;if(e==null)return!1;const n=e.match(/^v(\d+)\./);return n?parseInt(n[1],10)<=18:!1}sye()&&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 Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const aye="https://ysfqviecfzcxrnwaxfhh.supabase.co",oye="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InlzZnF2aWVjZnpjeHJud2F4ZmhoIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjU4MTEyMzEsImV4cCI6MjA4MTM4NzIzMX0.ynmJ3re3gAGlTddfrtexhbkjrTmaFWerR-dkFv_R6As",ba=iye(aye,oye,{auth:{storage:localStorage,persistSession:!0,autoRefreshToken:!0}}),vT="/assets/ocean-bg-BwynRHld.jpg",lye=()=>{const t=Zp(),{toast:e}=Xv(),[n,r]=I.useState(""),[i,s]=I.useState(""),[a,o]=I.useState(""),[l,c]=I.useState(!1),[u,d]=I.useState(!1),f=async h=>{if(h.preventDefault(),!/^\d{4}$/.test(n)){e({title:"Invalid Operator ID",description:"Operator ID must be exactly 4 digits.",variant:"destructive"});return}if(!/^[A-Za-z]{5}$/.test(i)){e({title:"Invalid Company ID",description:"Company ID must be exactly 5 letters (first 5 letters of your company name).",variant:"destructive"});return}if(a.length<6){e({title:"Invalid password",description:"Password must be at least 6 characters.",variant:"destructive"});return}d(!0);const p=i.toLowerCase(),m=`${n}@${p}.nautiq.local`,{error:g}=await ba.auth.signInWithPassword({email:m,password:a});if(g){e({title:"Login failed",description:g.message,variant:"destructive"}),d(!1);return}e({title:"Welcome back!",description:"Successfully logged in to NautIQ Technologies"}),d(!1),t("/dashboard")};return w.jsxs("div",{className:"min-h-screen flex items-center justify-center relative overflow-hidden",children:[w.jsx("div",{className:"absolute inset-0 bg-cover bg-center",style:{backgroundImage:`url(${vT})`}}),w.jsx("div",{className:"absolute inset-0 bg-background/80 backdrop-blur-sm"}),w.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:[1,2,3].map(h=>w.jsx(ar.div,{className:"absolute w-96 h-96 border border-primary/20 rounded-full",initial:{scale:0,opacity:.5},animate:{scale:3,opacity:0},transition:{duration:4,repeat:1/0,delay:h*1.3,ease:"easeOut"}},h))}),w.jsx(ar.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.6},className:"relative z-10 w-full max-w-md mx-4",children:w.jsxs("div",{className:"glass-card p-8 glow-border bg-primary-foreground text-primary",children:[w.jsx("div",{className:"flex justify-center mb-8",children:w.jsx(f1,{size:"lg"})}),w.jsxs("form",{onSubmit:f,className:"space-y-6",children:[w.jsxs("div",{className:"space-y-4",children:[w.jsxs("div",{className:"relative",children:[w.jsx(GV,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),w.jsx(kr,{type:"text",inputMode:"numeric",pattern:"\\d{4}",maxLength:4,placeholder:"Operator ID (4 digits)",value:n,onChange:h=>r(h.target.value.replace(/\D/g,"").slice(0,4)),className:"pl-10",required:!0})]}),w.jsxs("div",{className:"relative",children:[w.jsx(VV,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),w.jsx(kr,{type:"text",pattern:"[A-Za-z]{5}",maxLength:5,placeholder:"Company ID (first 5 letters of company name)",value:i,onChange:h=>s(h.target.value.replace(/[^A-Za-z]/g,"").slice(0,5)),className:"pl-10",required:!0})]}),w.jsxs("div",{className:"relative",children:[w.jsx(aw,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),w.jsx(kr,{type:l?"text":"password",placeholder:"Password",value:a,onChange:h=>o(h.target.value),className:"pl-10 pr-10",required:!0}),w.jsx("button",{type:"button",onClick:()=>c(!l),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",children:l?w.jsx(dR,{className:"w-4 h-4"}):w.jsx(hR,{className:"w-4 h-4"})})]})]}),w.jsx($t,{type:"submit",variant:"aqua",size:"xl",className:"w-full",disabled:u,children:u?w.jsx(ar.div,{className:"w-5 h-5 border-2 border-primary-foreground
494/30 border-t-primary-foreground rounded-full",animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"}}):w.jsxs(w.Fragment,{children:["Sign In",w.jsx(o1,{className:"w-4 h-4"})]})})]}),w.jsxs("div",{className:"mt-6 text-center text-sm text-muted-foreground",children:["Don't have an account?"," ",w.jsx(aT,{to:"/signup",className:"text-primary hover:text-primary/80 transition-colors font-medium",children:"Create account"})]}),w.jsxs("div",{className:"mt-8 pt-6 border-t border-border/50 text-center",children:[w.jsx("p",{className:"text-xs text-muted-foreground",children:"Marine Robotics & AI Solutions"}),w.jsx("p",{className:"text-xs text-muted-foreground/50 mt-1",children:"© 2025 NautIQ Technologies"})]})]})})]})},Yj="abcdefghijklmnopqrstuvwxyz",cye=(t,e)=>{const n=t.toLowerCase(),r=[],i=new Set,s=l=>{l.length===5&&/^[a-z]{5}$/.test(l)&&!i.has(l)&&!e.has(l)&&(i.add(l),r.push(l))};for(let l=0;l+5<=n.length&&r.length<10;l++)s(n.slice(l,l+5));const a=n.slice(0,4);for(const l of Yj){if(r.length>=10)break;s(a+l)}const o=n.slice(1,5);for(const l of Yj){if(r.length>=10)break;s(l+o)}return r.slice(0,3)},uye=()=>{const t=Zp(),{toast:e}=Xv(),[n,r]=I.useState(""),[i,s]=I.useState(""),[a,o]=I.useState(""),[l,c]=I.useState(""),[u,d]=I.useState(""),[f,h]=I.useState(""),[p,m]=I.useState(!1),[g,v]=I.useState(!1),[_,b]=I.useState([]),[x,T]=I.useState(""),N=l.replace(/[^A-Za-z]/g,""),A=N.slice(0,5).toLowerCase(),L=async M=>{if(M.preventDefault(),!/^\d{4}$/.test(a)){e({title:"Invalid Operator ID",description:"Operator ID must be exactly 4 digits.",variant:"destructive"});return}if(N.length<5){e({title:"Invalid Company name",description:"Enter a company name with at least 5 letters.",variant:"destructive"});return}if(u.length<6){e({title:"Password too short",description:"Password must be at least 6 characters.",variant:"destructive"});return}if(u!==f){e({title:"Passwords don't match",description:"Please make sure both passwords are the same.",variant:"destructive"});return}v(!0);const B=l.trim(),{data:R,error:j}=await ba.from("companies").select("company_id, name").ilike("name",B).maybeSingle();if(j){e({title:"Lookup failed",description:j.message,variant:"destructive"}),v(!1);return}let $,U=!1;if(R)$=R.company_id;else{const le=x||A,{data:V}=await ba.from("companies").select("company_id, name").ilike("company_id",le).maybeSingle();if(V){const{data:q}=await ba.from("companies").select("company_id"),se=new Set((q??[]).map(z=>z.company_id.toLowerCase())),he=cye(N,se);b(he),T(""),e({title:"Company ID already taken",description:`"${le}" is used by another company. Pick an alternative below.`,variant:"destructive"}),v(!1);return}$=le,U=!0}const te=`${a}@${$}.nautiq.local`,{error:ne}=await ba.auth.signUp({email:te,password:u,options:{data:{full_name:n,operator_id:a,company_name:B,company_id:$,recovery_email:i||null},emailRedirectTo:window.location.origin}});if(ne){const le=ne.message.toLowerCase();le.includes("already")||le.includes("registered")||le.includes("exists")?e({title:"Operator already registered",description:`Operator ${a} is already registered for company ID "${$}". Choose a different Operator ID.`,variant:"destructive"}):e({title:"Signup failed",description:ne.message,variant:"destructive"}),v(!1);return}U&&await ba.from("companies").insert({company_id:$,name:B}),e({title:"Account created!",description:`Operator ${a} @ ${$.toUpperCase()} ready to sign in.`}),v(!1),t("/login")};return w.jsxs("div",{className:"min-h-screen flex items-center justify-center relative overflow-hidden",children:[w.jsx("div",{className:"absolute inset-0 bg-cover bg-center",style:{backgroundImage:`url(${vT})`}}),w.jsx("div",{className:"absolute inset-0 bg-background/80 backdrop-blur-sm"}),w.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:[1,2,3].map(M=>w.jsx(ar.div,{className:"absolute w-96 h-96 border border-primary/20 rounded-full",initial:{scale:0,opacity:.5},animate:{scale:3,opacity:0},transition:{duration:4,repeat:1/0,delay:M*1.3,ease:"easeOut"}},M))}),w.jsx(ar.div,{initial:{opacity:0,y:20}
494,animate:{opacity:1,y:0},transition:{duration:.6},className:"relative z-10 w-full max-w-md mx-4",children:w.jsxs("div",{className:"glass-card p-8 glow-border bg-primary-foreground text-primary",children:[w.jsx("div",{className:"flex justify-center mb-8",children:w.jsx(f1,{size:"lg"})}),w.jsx("h2",{className:"text-xl font-semibold text-center mb-6 text-foreground",children:"Create Account"}),w.jsxs("form",{onSubmit:L,className:"space-y-4",children:[w.jsxs("div",{className:"relative",children:[w.jsx(_k,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),w.jsx(kr,{type:"text",placeholder:"Full name",value:n,onChange:M=>r(M.target.value),className:"pl-10",required:!0})]}),w.jsxs("div",{children:[w.jsxs("div",{className:"relative",children:[w.jsx(VV,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),w.jsx(kr,{type:"text",placeholder:"Company name (full)",value:l,maxLength:100,onChange:M=>{c(M.target.value),b([]),T("")},className:"pl-10",required:!0})]}),N.length>=5&&_.length===0&&w.jsxs("p",{className:"text-xs text-muted-foreground mt-1 ml-1",children:["Company ID:"," ",w.jsx("span",{className:"font-mono font-medium text-foreground",children:x||A})]}),_.length>0&&w.jsxs("div",{className:"mt-2 ml-1",children:[w.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Pick an available Company ID:"}),w.jsx("div",{className:"flex flex-wrap gap-2",children:_.map(M=>w.jsx("button",{type:"button",onClick:()=>T(M),className:`px-3 py-1.5 rounded-md text-xs font-mono border transition-colors ${x===M?"bg-primary text-primary-foreground border-primary":"bg-background border-border hover:border-primary/50"}`,children:M},M))})]})]}),w.jsxs("div",{className:"relative",children:[w.jsx(GV,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),w.jsx(kr,{type:"text",inputMode:"numeric",placeholder:"Operator ID (4 digits)",value:a,maxLength:4,onChange:M=>o(M.target.value.replace(/\D/g,"").slice(0,4)),className:"pl-10",required:!0})]}),w.jsxs("div",{className:"relative",children:[w.jsx(fR,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),w.jsx(kr,{type:"email",placeholder:"Recovery email (optional)",value:i,onChange:M=>s(M.target.value),className:"pl-10"})]}),w.jsxs("div",{className:"relative",children:[w.jsx(aw,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),w.jsx(kr,{type:p?"text":"password",placeholder:"Password",value:u,onChange:M=>d(M.target.value),className:"pl-10 pr-10",required:!0}),w.jsx("button",{type:"button",onClick:()=>m(!p),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",children:p?w.jsx(dR,{className:"w-4 h-4"}):w.jsx(hR,{className:"w-4 h-4"})})]}),w.jsxs("div",{className:"relative",children:[w.jsx(aw,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),w.jsx(kr,{type:p?"text":"password",placeholder:"Confirm password",value:f,onChange:M=>h(M.target.value),className:"pl-10",required:!0})]}),w.jsx($t,{type:"submit",variant:"aqua",size:"xl",className:"w-full",disabled:g,children:g?w.jsx(ar.div,{className:"w-5 h-5 border-2 border-primary-foreground/30 border-t-primary-foreground rounded-full",animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"}}):w.jsxs(w.Fragment,{children:["Create Account",w.jsx(o1,{className:"w-4 h-4"})]})})]}),w.jsxs("div",{className:"mt-6 text-center text-sm text-muted-foreground",children:["Already have an account?"," ",w.jsx(aT,{to:"/login",className:"text-primary hover:text-primary/80 transition-colors font-medium",children:"Sign in"})]}),w.jsxs("div",{className:"mt-8 pt-6 border-t border-border/50 text-center",children:[w.jsx("p",{className:"text-xs text-muted-foreground",children:"Marine Robotics & AI Solutions"}),w.jsx("p",{className:"text-xs text-muted-foreground/50 mt-1",children:"© 2025 NautIQ Technologies"})]})]})})]})},dye=()=>{const{toast:t}=Xv(),[e,n]=I.useState(""),[r,i]=I.useState(!1),[s,a]=I.useState(!1),o=async l=>{l.preventDefault(),i(!0);const{error:c}=await ba.auth.resetPasswordForEmail(e,{redirectTo:`${window.location.origin}/reset-password`});
494if(i(!1),c){t({title:"Reset failed",description:c.message,variant:"destructive"});return}a(!0),t({title:"Check your email",description:"We sent you a password reset link."})};return w.jsxs("div",{className:"min-h-screen flex items-center justify-center relative overflow-hidden",children:[w.jsx("div",{className:"absolute inset-0 bg-cover bg-center",style:{backgroundImage:`url(${vT})`}}),w.jsx("div",{className:"absolute inset-0 bg-background/80 backdrop-blur-sm"}),w.jsx(ar.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.6},className:"relative z-10 w-full max-w-md mx-4",children:w.jsxs("div",{className:"glass-card p-8 glow-border bg-primary-foreground text-primary",children:[w.jsx("div",{className:"flex justify-center mb-8",children:w.jsx(f1,{size:"lg"})}),w.jsx("h2",{className:"text-xl font-semibold text-center mb-2 text-foreground",children:"Forgot password?"}),w.jsx("p",{className:"text-sm text-muted-foreground text-center mb-6",children:"Enter your email and we'll send you a reset link."}),s?w.jsxs("div",{className:"text-center text-sm text-muted-foreground py-4",children:["If an account exists for ",w.jsx("span",{className:"text-foreground font-medium",children:e}),", a reset link is on its way."]}):w.jsxs("form",{onSubmit:o,className:"space-y-4",children:[w.jsxs("div",{className:"relative",children:[w.jsx(fR,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),w.jsx(kr,{type:"email",placeholder:"Email address",value:e,onChange:l=>n(l.target.value),className:"pl-10",required:!0})]}),w.jsx($t,{type:"submit",variant:"aqua",size:"xl",className:"w-full",disabled:r,children:r?w.jsx(ar.div,{className:"w-5 h-5 border-2 border-primary-foreground/30 border-t-primary-foreground rounded-full",animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"}}):w.jsxs(w.Fragment,{children:["Send reset link",w.jsx(o1,{className:"w-4 h-4"})]})})]}),w.jsx("div",{className:"mt-6 text-center text-sm",children:w.jsxs(aT,{to:"/login",className:"inline-flex items-center gap-1 text-primary hover:text-primary/80 transition-colors font-medium",children:[w.jsx(kae,{className:"w-3 h-3"}),"Back to sign in"]})})]})})]})},hye=()=>{const t=Zp(),{toast:e}=Xv(),[n,r]=I.useState(""),[i,s]=I.useState(""),[a,o]=I.useState(!1),[l,c]=I.useState(!1),[u,d]=I.useState(!1);I.useEffect(()=>{const{data:h}=ba.auth.onAuthStateChange(p=>{(p==="PASSWORD_RECOVERY"||p==="SIGNED_IN")&&d(!0)});return ba.auth.getSession().then(({data:p})=>{p.session&&d(!0)}),()=>h.subscription.unsubscribe()},[]);const f=async h=>{if(h.preventDefault(),n!==i){e({title:"Passwords don't match",variant:"destructive"});return}if(n.length<6){e({title:"Password too short",description:"Use at least 6 characters.",variant:"destructive"});return}c(!0);const{error:p}=await ba.auth.updateUser({password:n});if(c(!1),p){e({title:"Reset failed",description:p.message,variant:"destructive"});return}e({title:"Password updated",description:"You can now sign in with your new password."}),await ba.auth.signOut(),t("/login")};return w.jsxs("div",{className:"min-h-screen flex items-center justify-center relative overflow-hidden",children:[w.jsx("div",{className:"absolute inset-0 bg-cover bg-center",style:{backgroundImage:`url(${vT})`}}),w.jsx("div",{className:"absolute inset-0 bg-background/80 backdrop-blur-sm"}),w.jsx(ar.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.6},className:"relative z-10 w-full max-w-md mx-4",children:w.jsxs("div",{className:"glass-card p-8 glow-border bg-primary-foreground text-primary",children:[w.jsx("div",{className:"flex justify-center mb-8",children:w.jsx(f1,{size:"lg"})}),w.jsx("h2",{className:"text-xl font-semibold text-center mb-6 text-foreground",children:"Set a new password"}),u?w.jsxs("form",{onSubmit:f,className:"space-y-4",children:[w.jsxs("div",{className:"relative",children:[w.jsx(aw,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),w.jsx(kr,{type:a?"text":"password",placeholder:"New password",value:n,onChange:h=>r(h.target.value),className:"pl-10 pr-10",required:!0}),w.jsx("button",{type:"button",onClick:()=>o(!a),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",children:a?w.jsx(dR,{className:"w-4 h-4"}):w.jsx(hR,{className:"w-4 h-4"})})]}),w.jsxs("div",{className:"relative",children:[w.jsx(aw,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),w.jsx(kr,{type:a?"text":"password",placeholder:"Confirm new password",value:i,onChange:h=>s(h.target.value),className:"pl-10",required:!0})]}),w.jsx($t,{type:"submit",variant:"aqua",size:"xl",className:"w-full",disabled:l,children:l?w.jsx(ar.div,{className:"w-5 h-5 border-2 border-primary-foreground
494/30 border-t-primary-foreground rounded-full",animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"}}):w.jsxs(w.Fragment,{children:["Update password",w.jsx(o1,{className:"w-4 h-4"})]})})]}):w.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"Validating reset linkâ¦"})]})})]})},Wr=({title:t,icon:e,children:n,className:r,glowing:i=!1,delay:s=0})=>w.jsxs(ar.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:s},className:vt("glass-card p-5",i&&"glow-border",r),children:[w.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e&&w.jsx("div",{className:"p-2 rounded-lg bg-primary/10 text-primary",children:w.jsx(e,{className:"w-5 h-5"})}),w.jsx("h3",{className:"font-semibold text-foreground",children:t})]}),n]}),Sh=({status:t,label:e,size:n="md",showPulse:r=!0})=>{const i={online:"bg-success",offline:"bg-destructive",warning:"bg-warning",processing:"bg-info"},s={sm:"w-2 h-2",md:"w-3 h-3",lg:"w-4 h-4"},a={online:"shadow-[0_0_10px_hsl(160_70%_45%/0.6)]",offline:"shadow-[0_0_10px_hsl(0_75%_55%/0.6)]",warning:"shadow-[0_0_10px_hsl(40_90%_55%/0.6)]",processing:"shadow-[0_0_10px_hsl(200_80%_55%/0.6)]"};return w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsxs("div",{className:"relative",children:[w.jsx("div",{className:vt("rounded-full",s[n],i[t],a[t])}),r&&(t==="online"||t==="processing")&&w.jsx("div",{className:vt("absolute inset-0 rounded-full animate-ping",i[t],"opacity-40")})]}),e&&w.jsx("span",{className:"text-sm text-muted-foreground capitalize",children:e})]})},wo=({label:t,value:e,size:n="md"})=>{const r=s=>s>=80?"bg-success":s>=60?"bg-primary":s>=40?"bg-warning":"bg-destructive",i=s=>s>=80?"shadow-[0_0_15px_hsl(160_70%_45%/0.5)]":s>=60?"shadow-[0_0_15px_hsl(185_70%_45%/0.5)]":s>=40?"shadow-[0_0_15px_hsl(40_90%_55%/0.5)]":"shadow-[0_0_15px_hsl(0_75%_55%/0.5)]";return w.jsxs("div",{className:vt("space-y-2",n==="sm"?"text-xs":"text-sm"),children:[w.jsxs("div",{className:"flex justify-between items-center",children:[w.jsx("span",{className:"text-muted-foreground",children:t}),w.jsxs("span",{className:"font-medium text-foreground",children:[e,"%"]})]}),w.jsx("div",{className:"h-2 bg-muted rounded-full overflow-hidden",children:w.jsx(ar.div,{initial:{width:0},animate:{width:`${e}%`},transition:{duration:1,ease:"easeOut"},className:vt("h-full rounded-full",r(e),i(e))})})]})};/*! 495 * ONNX Runtime Web v1.26.0-dev.20260416-b7804b056c 496 * Copyright (c) Microsoft Corporation. All rights reserved. 497 * Licensed under the MIT License. 498 */var cI=Object.defineProperty,fye=Object.getOwnPropertyDescriptor,pye=Object.getOwnPropertyNames,mye=Object.prototype.hasOwnProperty,gye=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')}),Sn=(t,e)=>()=>(t&&(e=t(t=0)),e),m1=(t,e)=>{for(var n in e)cI(t,n,{get:e[n],enumerable:!0})},vye=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of pye(e))!mye.call(t,i)&&i!==n&&cI(t,i,{get:()=>e[i],enumerable:!(r=fye(e,i))||r.enumerable});return t},qk=t=>vye(cI({},"__esModule",{value:!0}),t),_y,Gd,pp,Xj,dH,hH=Sn(()=>{_y=new Map,Gd=[],pp=(t,e,n)=>{if(e&&typeof e.init=="function"&&typeof e.createInferenceSessionHandler=="function"){let r=_y.get(t);if(r===void 0)_y.set(t,{backend:e,priority:n});else{if(r.priority>n)return;if(r.priority===n&&r.backend!==e)throw new Error(`cannot register backend "${t}" using priority ${n}`)}if(n>=0){let i=Gd.indexOf(t);i!==-1&&Gd.splice(i,1);for(let s=0;s<Gd.length;s++)if(_y.get(Gd[s]).priority<=n){Gd.splice(s,0,t);return}Gd.push(t)}return}throw new TypeError("not a valid backend")},Xj=async t=>{let e=_y.get(t);if(!e)return"backend not found.";if(e.initialized)return e.backend;if(e.aborted)return e.error;{let n=!!e.initPromise;try{return n||(e.initPromise=e.backend.init(t)),await e.initPromise,e.initialized=!0,e.backend}catch(r){return n||(e.error=`${r}`,e.aborted=!0),e.error}finally{delete e.initPromise}}},dH=async t=>{let e=t.executionProviders||[],n=e.map(l=>typeof l=="string"?l:l.name),r=n.length===0?Gd:n,i,s=[],a=new Set;for(let l of r){let c=await Xj(l);typeof c=="string"?s.push({name:l,err:c}):(i||(i=c),i===c&&a.add(l))}if(!i)throw new Error(`no available backend found. ERR: ${s.map(l
498=>`[${l.name}] ${l.err}`).join(", ")}`);for(let{name:l,err:c}of s)n.includes(l)&&console.warn(`removing requested execution provider "${l}" from session options because it is not available: ${c}`);let o=e.filter(l=>a.has(typeof l=="string"?l:l.name));return[i,new Proxy(t,{get:(l,c)=>c==="executionProviders"?o:Reflect.get(l,c)})]}}),yye=Sn(()=>{hH()}),fH,_ye=Sn(()=>{fH="1.24.0-dev.20251116-b39e144322"}),x5,rs,pH=Sn(()=>{_ye(),x5="warning",rs={wasm:{},webgl:{},webgpu:{},versions:{common:fH},set logLevel(t){if(t!==void 0){if(typeof t!="string"||["verbose","info","warning","error","fatal"].indexOf(t)===-1)throw new Error(`Unsupported logging level: ${t}`);x5=t}},get logLevel(){return x5}},Object.defineProperty(rs,"logLevel",{enumerable:!0})}),zr,wye=Sn(()=>{pH(),zr=rs}),mH,gH,bye=Sn(()=>{mH=(t,e)=>{let n=typeof document<"u"?document.createElement("canvas"):new OffscreenCanvas(1,1);n.width=t.dims[3],n.height=t.dims[2];let r=n.getContext("2d");if(r!=null){let i,s;(e==null?void 0:e.tensorLayout)!==void 0&&e.tensorLayout==="NHWC"?(i=t.dims[2],s=t.dims[3]):(i=t.dims[3],s=t.dims[2]);let a=(e==null?void 0:e.format)!==void 0?e.format:"RGB",o=e==null?void 0:e.norm,l,c;o===void 0||o.mean===void 0?l=[255,255,255,255]:typeof o.mean=="number"?l=[o.mean,o.mean,o.mean,o.mean]:(l=[o.mean[0],o.mean[1],o.mean[2],0],o.mean[3]!==void 0&&(l[3]=o.mean[3])),o===void 0||o.bias===void 0?c=[0,0,0,0]:typeof o.bias=="number"?c=[o.bias,o.bias,o.bias,o.bias]:(c=[o.bias[0],o.bias[1],o.bias[2],0],o.bias[3]!==void 0&&(c[3]=o.bias[3]));let u=s*i,d=0,f=u,h=u*2,p=-1;a==="RGBA"?(d=0,f=u,h=u*2,p=u*3):a==="RGB"?(d=0,f=u,h=u*2):a==="RBG"&&(d=0,h=u,f=u*2);for(let m=0;m<s;m++)for(let g=0;g<i;g++){let v=(t.data[d++]-c[0])*l[0],_=(t.data[f++]-c[1])*l[1],b=(t.data[h++]-c[2])*l[2],x=p===-1?255:(t.data[p++]-c[3])*l[3];r.fillStyle="rgba("+v+","+_+","+b+","+x+")",r.fillRect(g,m,1,1)}if("toDataURL"in n)return n.toDataURL();throw new Error("toDataURL is not supported")}else throw new Error("Can not access image data")},gH=(t,e)=>{let n=typeof document<"u"?document.createElement("canvas").getContext("2d"):new OffscreenCanvas(1,1).getContext("2d"),r;if(n!=null){let i,s,a;(e==null?void 0:e.tensorLayout)!==void 0&&e.tensorLayout==="NHWC"?(i=t.dims[2],s=t.dims[1],a=t.dims[3]):(i=t.dims[3],s=t.dims[2],a=t.dims[1]);let o=e!==void 0&&e.format!==void 0?e.format:"RGB",l=e==null?void 0:e.norm,c,u;l===void 0||l.mean===void 0?c=[255,255,255,255]:typeof l.mean=="number"?c=[l.mean,l.mean,l.mean,l.mean]:(c=[l.mean[0],l.mean[1],l.mean[2],255],l.mean[3]!==void 0&&(c[3]=l.mean[3])),l===void 0||l.bias===void 0?u=[0,0,0,0]:typeof l.bias=="number"?u=[l.bias,l.bias,l.bias,l.bias]:(u=[l.bias[0],l.bias[1],l.bias[2],0],l.bias[3]!==void 0&&(u[3]=l.bias[3]));let d=s*i;if(e!==void 0&&(e.format!==void 0&&a===4&&e.format!=="RGBA"||a===3&&e.format!=="RGB"&&e.format!=="BGR"))throw new Error("Tensor format doesn't match input tensor dims");let f=4,h=0,p=1,m=2,g=3,v=0,_=d,b=d*2,x=-1;o==="RGBA"?(v=0,_=d,b=d*2,x=d*3):o==="RGB"?(v=0,_=d,b=d*2):o==="RBG"&&(v=0,b=d,_=d*2),r=n.createImageData(i,s);for(let T=0;T<s*i;h+=f,p+=f,m+=f,g+=f,T++)r.data[h]=(t.data[v++]-u[0])*c[0],r.data[p]=(t.data[_++]-u[1])*c[1],r.data[m]=(t.data[b++]-u[2])*c[2],r.data[g]=x===-1?255:(t.data[x++]-u[3])*c[3]}else throw new Error("Can not access image data");return r}}),Yb,vH,yH,_H,wH,bH,xye=Sn(()=>{uI(),Yb=(t,e)=>{if(t===void 0)throw new Error("Image buffer must be defined");if(e.height===void 0||e.width===void 0)throw new Error("Image height and width must be defined");if(e.tensorLayout==="NHWC")throw new Error("NHWC Tensor layout is not supported yet");let{height:n,width:r}=e,i=e.norm??{mean:255,bias:0},s,a;typeof i.mean=="number"?s=[i.mean,i.mean,i.mean,i.mean]:s=[i.mean[0],i.mean[1],i.mean[2],i.mean[3]??255],typeof i.bias=="number"?a=[i.bias,i.bias,i.bias,i.bias]:a=[i.bias[0],i.bias[1],i.bias[2],i.bias[3]??0];let o=e.format!==void 0?e.format:"RGBA",l=e.tensorFormat!==void 0&&e.tensorFormat!==void 0?e.tensorFormat:"RGB",c=n*r,u=l==="RGBA"?new Float32Array(c*4):new Float32Array(c*3),d=4,f=0,h=1,p=2,m=3,g=0,v=c,_=c*2,b=-1;o==="RGB"&&(d=3,f=0,h=1,p=2,m=-1),l==="RGBA"?b=c*3:l==="RBG"?(g=0,_=c,v=c*2):l==="BGR"&&(_=0,v=c,g=c*2);for(let x=0;x<c;x++,f+=d,p+=d,h+=d,m+=d)u[g++]=(t[f]+a[0])/s[0],u[v++]=(t[h]+a[1])/s[1],u[_++]=(t[p]+a[2])/s[2],b!==-1&&m!==-1&&(u[b++]=(t[m]+a[3])/s[3]);return l==="RGBA"?new vo("float32",u,[1,4,n,r]):new vo("float32",u,[1,3,n,r])},vH=async(t,e)=>{let n=typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement,r=typeof ImageData<"u"&&t instanceof ImageData,i=typeof ImageBitmap<"u"&&t instanceof ImageBitmap,s=typeof t=="string",a,o=e??{},l=()=>{if(typeof document<"u")return document.createElement("canvas");if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(1,1);throw new Error("Canvas is not supported")},c=u=>typeof HTMLCanvasElement<"u"&&u instanceof HTMLCanvasElement||u instanceof OffscreenCanvas?u.getContext("2d"):null;if(n){let u=l();u.width=t.width,u.height=t.height;let d=c(u);if(d!=null){let f=t.height,h=t.width;if(e!==void 0&&e.resizedHeight!==void 0&&e.resizedWidth!==void 0&&(f=e.resizedHeight,h=e.resizedWidth),e!==void 0){if(o=e,e.tensorFormat!==void 0)throw new Error("Image input config format must be RGBA for HTMLImageElement");o.tensorFormat="RGBA",o.height=f,o.width=h}else o.tensorFormat="RGBA",o.height=f,o.width=h;d.drawImage(t,0,0),a=d.getImageData(0,0,h,f).data}else throw new Error("Can not access image data")}else if(r){let u,d;if(e!==void 0&&e.resizedWidth!==void 0&&e.resizedHeight!==void 0?(u=e.resizedHeight,d=e.resizedWidth):(u=t.height,d=t.width),e!==void 0&&(o=e),o.format="RGBA",o.height=u,o.width=d,e!==void 0){let f=l();f.width=d,f.height=u;let h=c(f);if(h!=null)h.putImageData(t,0,0),a=h.getImageData(0,0,d,u).data;else throw new Error("Can not access image data")}else a=t.data}else if(i){if(e===void 0)throw new Error("Please provide image config with format for Imagebitmap");let u=l();u.width=t.width,u.height=t.height;let d=c(u);if(d!=null){let f=t.height,h=t.width;return d.drawImage(t,0,0,h,f),a=d.getImageData(0,0,h,f).data,o.height=f,o.width=h,Yb(a,o)}else throw new Error("Can not access image data")}else{if(s)return new Promise((u,d)=>{let f=l(),h=c(f);if(!t||!h)return d();let p=new Image;p.crossOrigin="Anonymous",p.src=t,p.onload=()=>{f.width=p.width,f.height=p.height,h.drawImage(p,0,0,f.width,f.height);let m=h.getImageData(0,0,f.width,f.height);o.height=f.height,o.width=f.width,u(Yb(m.data,o))}});throw new Error("Input data provided is not supported - aborted tensor creation")}if(a!==void 0)return Yb(a,o);throw new Error("Input data provided is not supported - aborted tensor creation")},yH=(t,e)=>{let{width:n,height:r,download:i,dispose:s}=e,a=[1,r,n,4];return new vo({location:"texture",type:"float32",texture:t,dims:a,download:i,dispose:s})},_H=(t,e)=>{let{dataType:n,dims:r,download:i,dispose:s}=e;return new vo({location:"gpu-buffer",type:n??"float32",gpuBuffer:t,dims:r,download:i,dispose:s})},wH=(t,e)=>{let{dataType:n,dims:r,download:i,dispose:s}=e;return new vo({location:"ml-tensor",type:n??"float32",mlTensor:t,dims:r,download:i,dispose:s})},bH=(t,e,n)=>new vo({location:"cpu-pinned",type:t,data:e,dims:n??[e.length]})}),ep,e_,k5,xH,kye=Sn(()=>{ep=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array
vendor: 8,285 bytes, line 498
498],["uint32",Uint32Array],["int4",Uint8Array],["uint4",Uint8Array]]),e_=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]),k5=!1,xH=()=>{if(!k5){k5=!0;let t=typeof BigInt64Array<"u"&&BigInt64Array.from,e=typeof BigUint64Array<"u"&&BigUint64Array.from,n=globalThis.Float16Array,r=typeof n<"u"&&n.from;t&&(ep.set("int64",BigInt64Array),e_.set(BigInt64Array,"int64")),e&&(ep.set("uint64",BigUint64Array),e_.set(BigUint64Array,"uint64")),r?(ep.set("float16",n),e_.set(n,"float16")):ep.set("float16",Uint16Array)}}}),kH,SH,Sye=Sn(()=>{uI(),kH=t=>{let e=1;for(let n=0;n<t.length;n++){let r=t[n];if(typeof r!="number"||!Number.isSafeInteger(r))throw new TypeError(`dims[${n}] must be an integer, got: ${r}`);if(r<0)throw new RangeError(`dims[${n}] must be a non-negative integer, got: ${r}`);e*=r}return e},SH=(t,e)=>{switch(t.location){case"cpu":return new vo(t.type,t.data,e);case"cpu-pinned":return new vo({location:"cpu-pinned",data:t.data,type:t.type,dims:e});case"texture":return new vo({location:"texture",texture:t.texture,type:t.type,dims:e});case"gpu-buffer":return new vo({location:"gpu-buffer",gpuBuffer:t.gpuBuffer,type:t.type,dims:e});case"ml-tensor":return new vo({location:"ml-tensor",mlTensor:t.mlTensor,type:t.type,dims:e});default:throw new Error(`tensorReshape: tensor location ${t.location} is not supported`)}}}),vo,uI=Sn(()=>{bye(),xye(),kye(),Sye(),vo=class{constructor(t,e,n){xH();let r,i;if(typeof t=="object"&&"location"in t)switch(this.dataLocation=t.location,r=t.type,i=t.dims,t.location){case"cpu-pinned":{let a=ep.get(r);if(!a)throw new TypeError(`unsupported type "${r}" to create tensor from pinned buffer`);if(!(t.data instanceof a))throw new TypeError(`buffer should be of type ${a.name}`);this.cpuData=t.data;break}case"texture":{if(r!=="float32")throw new TypeError(`unsupported type "${r}" to create tensor from texture`);this.gpuTextureData=t.texture,this.downloader=t.download,this.disposer=t.dispose;break}case"gpu-buffer":{if(r!=="float32"&&r!=="float16"&&r!=="int32"&&r!=="int64"&&r!=="uint32"&&r!=="uint8"&&r!=="bool"&&r!=="uint4"&&r!=="int4")throw new TypeError(`unsupported type "${r}" to create tensor from gpu buffer`);this.gpuBufferData=t.gpuBuffer,this.downloader=t.download,this.disposer=t.dispose;break}case"ml-tensor":{if(r!=="float32"&&r!=="float16"&&r!=="int32"&&r!=="int64"&&r!=="uint32"&&r!=="uint64"&&r!=="int8"&&r!=="uint8"&&r!=="bool"&&r!=="uint4"&&r!=="int4")throw new TypeError(`unsupported type "${r}" to create tensor from MLTensor`);this.mlTensorData=t.mlTensor,this.downloader=t.download,this.disposer=t.dispose;break}default:throw new Error(`Tensor constructor: unsupported location '${this.dataLocation}'`)}else{let a,o;if(typeof t=="string")if(r=t,o=n,t==="string"){if(!Array.isArray(e))throw new TypeError("A string tensor's data must be a string array.");a=e}else{let l=ep.get(t);if(l===void 0)throw new TypeError(`Unsupported tensor type: ${t}.`);if(Array.isArray(e)){if(t==="float16"&&l===Uint16Array||t==="uint4"||t==="int4")throw new TypeError(`Creating a ${t} tensor from number array is not supported. Please use ${l.name} as data.`);t==="uint64"||t==="int64"?a=l.from(e,BigInt):a=l.from(e)}else if(e instanceof l)a=e;else if(e instanceof Uint8ClampedArray)if(t==="uint8")a=Uint8Array.from(e);else throw new TypeError("A Uint8ClampedArray tensor's data must be type of uint8");else if(t==="float16"&&e instanceof Uint16Array&&l!==Uint16Array)a=new globalThis.Float16Array(e.buffer,e.byteOffset,e.length);else throw new TypeError(`A ${r} tensor's data must be type of ${l}`)}else if(o=e,Array.isArray(t)){if(t.length===0)throw new TypeError("Tensor type cannot be inferred from an empty array.");let l=typeof t[0];if(l==="string")r="string",a=t;else if(l==="boolean")r="bool",a=Uint8Array.from(t);else throw new TypeError(`Invalid element type of data array: ${l}.`)}else if(t instanceof Uint8ClampedArray)r="uint8",a=Uint8Array.from(t);else{let l=e_.get(t.constructor);if(l===void 0)throw new TypeError(`Unsupported type for tensor data: ${t.constructor}.`);r=l,a=t}if(o===void 0)o=[a.length];else if(!Array.isArray(o))throw new TypeError("A tensor's dims must be a number array");i=o,this.cpuData=a,this.dataLocation="cpu"}let s=kH(i);if(this.cpuData&&s!==this.cpuData.length&&!((r==="uint4"||r==="int4")&&Math.ceil(s/2)===this.cpuData.length))throw new Error(`Tensor's size(${s}) does not match data length(${this.cpuData.length}).`);this.type=r,this.dims=i,this.size=s}static async fromImage(t,e){return vH(t,e)}static fromTexture(t,e){return yH(t,e)}static fromGpuBuffer(t,e){return _H(t,e)}static fromMLTensor(t,e){return wH(t,e)}static fromPinnedBuffer(t,e,n){return bH(t,e,n)}toDataURL(t){return mH(this,t)}toImageData(t){return gH(this,t)}get data(){if(this.ensureValid(),!this.cpuData)throw new Error("The data is not on CPU. Use `getData()` to download GPU data to CPU, or use `texture` or `gpuBuffer` property to access the GPU data directly.");return this.cpuData}get location(){return this.dataLocation}get texture(){if(this.ensureValid(),!this.gpuTextureData)throw new Error("The data is not stored as a WebGL texture.");return this.gpuTextureData}get gpuBuffer(){if(this.ensureValid(),!this.gpuBufferData)throw new Error("The data is not stored as a WebGPU buffer.");return this.gpuBufferData}get mlTensor(){if(this.ensureValid(),!this.mlTensorData)throw new Error("The data is not stored as a WebNN MLTensor.");return this.mlTensorData}async getData(t){switch(this.ensureValid(),this.dataLocation){case"cpu":case"cpu-pinned":return this.data;case"texture":case"gpu-buffer":case"ml-tensor":{if(!this.downloader)throw new Error("The current tensor is not created with a specified data downloader.");if(this.isDownloading)throw new Error("The current tensor is being downloaded.");try{this.isDownloading=!0;let e=await this.downloader();return this.downloader=void 0,this.dataLocation="cpu",this.cpuData=e,t&&this.disposer&&(this.disposer(),this.disposer=void 0),e}finally{this.isDownloading=!1}}default:throw new Error(`cannot get data from location: ${this.dataLocation}`)}}dispose(){if(this.isDownloading)throw new Error("The current tensor is being downloaded.");this.disposer&&(this.disposer(),this.disposer=void 0),this.cpuData=void 0,this.gpuTextureData=void 0,this.gpuBufferData=void 0,this.mlTensorData=void 0,this.downloader=void 0,this.isDownloading=void 0,this.dataLocation="none"}ensureValid(){if(this.dataLocation==="none")throw new Error("The tensor is disposed.")}reshape(t){if(this.ensureValid(),this.downloader||this.disposer)throw new Error("Cannot reshape a tensor that owns GPU resource.");return SH(this,t)}}}),Ul,TH=Sn(()=>{uI(),Ul=vo}),Wk,S5,zp,$p,jh,Bh,CH=Sn(()=>{pH(),Wk=(t,e)=>{(typeof rs.trace>"u"?!rs.wasm.trace:!rs.trace)||console.timeStamp(`${t}::ORT::${e}`)},S5=(t,e)=>{var i;let n=((i=new Error().stack)==null?void 0:i.split(/\r\n|\r|\n/g))||[],r=!1;for(let s=0;s<n.length;s++){if(r&&!n[s].includes("TRACE_FUNC")){let a=`FUNC_${t}::${n[s].trim().split(" ")[1]}`;e&&(a+=`::${e}`),Wk("CPU",a);return}n[s].includes("TRACE_FUNC")&&(r=!0)}},zp=t=>{(typeof rs.trace>"u"?!rs.wasm.trace:!rs.trace)||S5("BEGIN",t)},$p=t=>{(typeof rs.trace>"u"?!rs.wasm.trace:!rs.trace)||S5("END",t)},jh=t=>{(typeof rs.trace>"u"?!rs.wasm.trace:!rs.trace)||console.time(`ORT::${t}`)},Bh=t=>{(typeof rs.trace>"u"?!rs.wasm.trace:!rs.trace)||console.timeEnd(`ORT::${t}`)}}),EH,Tye=Sn(()=>{hH(),TH(),CH(),EH=class AH{constructor(e){this.handler=e}async run(e,n,r){zp(),jh("InferenceSession.run");let i={},s={};if(typeof e!="object"||e===null||e instanceof Ul||Array.isArray(e))throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let a=!0;if(typeof n=="object"){if(n===null)throw new TypeError("Unexpected argument[1]: cannot be null.");if(n instanceof Ul)throw new TypeError("'fetches' cannot be a Tensor");if(Array.isArray(n)){if(n.length===0)throw new TypeError("'fetches' cannot be an empty array.");a=!1;for(let c of n){if(typeof c!="string")throw new TypeError("'fetches' must be a string array or an object.");if(this.outputNames.indexOf(c)===-1)throw new RangeError(`'fetches' contains invali
498d output name: ${c}.`);i[c]=null}if(typeof r=="object"&&r!==null)s=r;else if(typeof r<"u")throw new TypeError("'options' must be an object.")}else{let c=!1,u=Object.getOwnPropertyNames(n);for(let d of this.outputNames)if(u.indexOf(d)!==-1){let f=n[d];(f===null||f instanceof Ul)&&(c=!0,a=!1,i[d]=f)}if(c){if(typeof r=="object"&&r!==null)s=r;else if(typeof r<"u")throw new TypeError("'options' must be an object.")}else s=n}}else if(typeof n<"u")throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(let c of this.inputNames)if(typeof e[c]>"u")throw new Error(`input '${c}' is missing in 'feeds'.`);if(a)for(let c of this.outputNames)i[c]=null;let o=await this.handler.run(e,i,s),l={};for(let c in o)if(Object.hasOwnProperty.call(o,c)){let u=o[c];u instanceof Ul?l[c]=u:l[c]=new Ul(u.type,u.data,u.dims)}return Bh("InferenceSession.run"),$p(),l}async release(){return this.handler.dispose()}static async create(e,n,r,i){zp(),jh("InferenceSession.create");let s,a={};if(typeof e=="string"){if(s=e,typeof n=="object"&&n!==null)a=n;else if(typeof n<"u")throw new TypeError("'options' must be an object.")}else if(e instanceof Uint8Array){if(s=e,typeof n=="object"&&n!==null)a=n;else if(typeof n<"u")throw new TypeError("'options' must be an object.")}else if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer){let u=e,d=0,f=e.byteLength;if(typeof n=="object"&&n!==null)a=n;else if(typeof n=="number"){if(d=n,!Number.isSafeInteger(d))throw new RangeError("'byteOffset' must be an integer.");if(d<0||d>=u.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${u.byteLength}).`);if(f=e.byteLength-d,typeof r=="number"){if(f=r,!Number.isSafeInteger(f))throw new RangeError("'byteLength' must be an integer.");if(f<=0||d+f>u.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${u.byteLength-d}].`);if(typeof i=="object"&&i!==null)a=i;else if(typeof i<"u")throw new TypeError("'options' must be an object.")}else if(typeof r<"u")throw new TypeError("'byteLength' must be a number.")}else if(typeof n<"u")throw new TypeError("'options' must be an object.");s=new Uint8Array(u,d,f)}else throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");let[o,l]=await dH(a),c=await o.createInferenceSessionHandler(s,l);return Bh("InferenceSession.create"),$p(),new AH(c)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}get inputMetadata(){return this.handler.inputMetadata}get outputMetadata(){return this.handler.outputMetadata}}}),dI,Cye=Sn(()=>{Tye(),dI=EH}),Eye=Sn(()=>{}),Aye=Sn(()=>{}),Pye=Sn(()=>{}),Mye=Sn(()=>{}),PH={};m1(PH,{InferenceSession:()=>dI,TRACE:()=>Wk,TRACE_EVENT_BEGIN:()=>jh,TRACE_EVENT_END:()=>Bh,TRACE_FUNC_BEGIN:()=>zp,TRACE_FUNC_END:()=>$p,Tensor:()=>Ul,env:()=>zr,registerBackend:()=>pp});var em=Sn(()=>{yye(),wye(),Cye(),TH(),Eye(),Aye(),CH(),Pye(),Mye()}),hI=Sn(()=>{}),MH={};m1(MH,{default:()=>NH});var T5,C5,NH,Nye=Sn(()=>{var t;GH(),tm(),fI(),T5="ort-wasm-proxy-worker",C5=((t=globalThis.self)==null?void 0:t.name)===T5,C5&&(self.onmessage=e=>{let{type:n,in:r}=e.data;try{switch(n){case"init-wasm":pI(r.wasm).then(()=>{_I(r).then(()=>{postMessage({type:n})},i=>{postMessage({type:n,err:i})})},i=>{postMessage({type:n,err:i})});break;case"init-ep":{let{epName:i,env:s}=r;wI(s,i).then(()=>{postMessage({type:n})},a=>{postMessage({type:n,err:a})});break}case"copy-from":{let{buffer:i}=r,s=Kk(i);postMessage({type:n,out:s});break}case"create":{let{model:i,options:s}=r;bI(i,s).then(a=>{postMessage({type:n,out:a})},a=>{postMessage({type:n,err:a})});break}case"release":xI(r),postMessage({type:n});break;case"run":{let{sessionId:i,inputIndices:s,inputs:a,outputIndices:o,options:l}=r;kI(i,s,a,o,new Array(o.length).fill(null),l).then(c=>{c.some(u=>u[3]!=="cpu")?postMessage({type:n,err:"Proxy does not support non-cpu tensor location."}):postMessage({type:n,out:c},TI([...a,...c]))},c=>{postMessage({type:n,err:c})});break}case"end-profiling":SI(r),postMessage({type:n});break;default:}}catch(i){postMessage({type:n,err:i})}}),NH=C5?null:e=>new Worker(e??ho,{type:"module",name:T5})}),RH={};m1(RH,{default:()=>IH});async function Qj(t={}){var ub,Um;var e=t,n=!!globalThis.window,r=!!globalThis.WorkerGlobalScope,i=r&&((ub=self.name)==null?void 0:ub.startsWith("em-pthread"));e.mountExternalData=(S,E)=>{S.startsWith("./")&&(S=S.substring(2)),(e.Uc||(e.Uc=new Map)).set(S,E)},e.unmountExternalData=()=>{delete e.Uc},globalThis.SharedArrayBuffer??new WebAssembly.Memory({initial:0,maximum:0,shared:!0}).buffer.constructor;let s=()=>{let S=E=>(...D)=>{let F=Pt;return D=E(...D),Pt!=F?new Promise((Z,ue)=>{ro={resolve:Z,reject:ue}}):D};(()=>{for(let E of["_OrtAppendExecutionProvider","_OrtCreateSession","_OrtRun","_OrtRunWithBinding","_OrtBindInput"])e[E]=S(e[E])})(),typeof jsepRunAsync<"u"&&(e._OrtRun=jsepRunAsync(e._OrtRun),e._OrtRunWithBinding=jsepRunAsync(e._OrtRunWithBinding)),s=void 0};e.asyncInit=()=>{s==null||s()};var a,o,l=(S,E)=>{throw E},c=import.meta.url,u="";if(n||r){try{u=new URL(".",c).href}catch{}r&&(o=S=>{var E=new XMLHttpRequest;return E.open("GET",S,!1),E.responseType="arraybuffer",E.send(null),new Uint8Array(E.response)}),a=async S=>{if(N(S))return new Promise((D,F)=>{var Z=new XMLHttpRequest;Z.open("GET",S,!0),Z.responseType="arraybuffer",Z.onload=()=>{Z.status==200||Z.status==0&&Z.response?D(Z.response):F(Z.status)},Z.onerror=F,Z.send(null)});var E=await fetch(S,{credentials:"same-origin"});if(E.ok)return E.arrayBuffer();throw Error(E.status+" : "+E.url)}}var d,f,h,p,m,g,v=console.log.bind(console),_=console.error.bind(console),b=v,x=_,T=!1,N=S=>S.startsWith("file://");function A(){Kt.buffer!=M.buffer&&he()}if(i){let S=function(E){try{var D=E.data,F=D.Oc;if(F==="load"){let Z=[];self.onmessage=ue=>Z.push(ue),g=()=>{postMessage({Oc:"loaded"});for(let ue of Z)S(ue);self.onmessage=S}
vendor: 4,145 bytes, line 498
498;for(let ue of D.ce)e[ue]&&!e[ue].proxy||(e[ue]=(...we)=>{postMessage({Oc:"callHandler",be:ue,args:we})},ue=="print"&&(b=e[ue]),ue=="printErr"&&(x=e[ue]));Kt=D.ie,he(),f=D.je,de(),Bm()}else if(F==="run"){(function(Z){var ue=(A(),U)[Z+52>>>2>>>0];Z=(A(),U)[Z+56>>>2>>>0],ey(ue,ue-Z),Ft(ue)})(D.Nc),oa(D.Nc,0,0,1,0,0),Et(),gc(D.Nc),L||(Mm(),L=!0);try{At(D.ge,D.Wc)}catch(Z){if(Z!="unwind")throw Z}}else D.target!=="setimmediate"&&(F==="checkMailbox"?L&&dl():F&&(x(`worker: received unknown command ${F}`),x(D)))}catch(Z){throw jo(),Z}};var L=!1;self.onunhandledrejection=E=>{throw E.reason||E},self.onmessage=S}var M,B,R,j,$,U,te,ne,le,V,q,se=!1;function he(){var S=Kt.buffer;e.HEAP8=M=new Int8Array(S),R=new Int16Array(S),e.HEAPU8=B=new Uint8Array(S),j=new Uint16Array(S),e.HEAP32=$=new Int32Array(S),e.HEAPU32=U=new Uint32Array(S),te=new Float32Array(S),ne=new Float64Array(S),le=new BigInt64Array(S),V=new BigUint64Array(S)}function z(){se=!0,i?g():jt._b()}function J(S){throw x(S="Aborted("+S+")"),T=!0,S=new WebAssembly.RuntimeError(S+". Build with -sASSERTIONS for more info."),m==null||m(S),S}function Y(){return{a:{f:Ut,J:wr,k:Nt,p:Zn,l:It,sa:qt,b:lr,ca:rn,Ja:Mn,q:Dt,da:_i,Za:Mi,Fa:dr,Ha:Fr,_a:Cr,Xa:wi,Qa:Ni,Wa:mc,oa:ll,Ga:Ma,Xb:eo,Ya:Na,Yb:Ra,db:Ia,Da:R0,Sb:gf,Qb:cm,Ca:Ro,M:Td,I:I0,Rb:Io,ja:L0,Tb:O0,Ta:D0,Vb:_f,Ka:F0,Ob:j0,ka:vc,Sa:gc,ab:fm,U:Ad,n:_c,c:Is,rb:xf,w:gu,L:kf,z:Md,j:Sf,o:vu,sb:ym,G:fl,T:pl,h:_m,u:wm,m:bm,i:yu,Na:xm,Oa:pe,Pa:_e,La:Me,Ma:Be,Pb:Gt,eb:tn,cb:ii,Y:hr,qb:Er,la:Ar,bb:Tn,fb:Zi,$a:ml,Wb:Tf,N:gt,gb:_u,X:wu,Ub:wc,nb:kc,C:Sc,ra:Od,qa:Su,pb:ai,W:V0,v:Do,mb:io,lb:Tu,kb:Ef,ob:Af,jb:Dd,ib:Cu,hb:Eu,Ua:Au,Va:Ui,Ia:Ye,V:ao,na:tr,Ra:nr,ma:oi,Cb:jm,xa:lo,Db:iy,ya:fa,F:Jr,e:fr,s:nn,x:Kr,B:Wn,Fb:js,ba:da,D:jr,za:ha,$:Nu,ga:ua,Gb:ys,Hb:ca,Ba:Fs,Aa:xi,Ib:rr,wa:Fm,aa:cr,d:Cn,A:gs,r:zi,Bb:Of,t:vs,y:$i,H:ts,E:bi,K:oo,R:wl,ia:Br,_:Vi,Jb:qn,Kb:Nn,g:yl,a:Kt,Nb:Je,Eb:Pf,ha:Fd,O:Sm,pa:I1,Lb:L1,ta:O1,Q:D1,yb:Mf,zb:F1,ua:j1,ea:B1,P:U1,Ea:z1,va:$1,Z:V1,wb:q1,Zb:q0,S:Tm,Ab:sa,tb:Da,ub:Em,vb:W1,fa:Am,xb:Pm,Mb:W0}}}async function de(){function S(F,Z){var ue=jt=F.exports;F={};for(let[we,Te]of Object.entries(ue))typeof Te=="function"?(ue=B0(Te),F[we]=ue):F[we]=Te;return jt=F,jt=function(){var we=jt,Te=rt=>un=>rt(un)>>>0,qe=rt=>()=>rt()>>>0;return(we=Object.assign({},we)).$b=Te(we.$b),we.Cc=qe(we.Cc),we.Ec=Te(we.Ec),we.rd=(rt=>(un,at)=>rt(un,at)>>>0)(we.rd),we.wd=Te(we.wd),we.xd=qe(we.xd),we.Bd=Te(we.Bd),we}(),Ue.push(jt.id),G0=(F=jt).$b,Mm=F.ac,e._OrtInit=F.bc,e._OrtGetLastError=F.cc,e._OrtCreateSessionOptions=F.dc,e._OrtAppendExecutionProvider=F.ec,e._OrtAddFreeDimensionOverride=F.fc,e._OrtAddSessionConfigEntry=F.gc,e._OrtReleaseSessionOptions=F.hc,e._OrtCreateSession=F.ic,e._OrtReleaseSession=F.jc,e._OrtGetInputOutputCount=F.kc,e._OrtGetInputOutputMetadata=F.lc,e._OrtFree=F.mc,e._OrtCreateTensor=F.nc,e._OrtGetTensorData=F.oc,e._OrtReleaseTensor=F.pc,e._OrtCreateRunOptions=F.qc,e._OrtAddRunConfigEntry=F.rc,e._OrtReleaseRunOptions=F.sc,e._OrtCreateBinding=F.tc,e._OrtBindInput=F.uc,e._OrtBindOutput=F.vc,e._OrtClearBoundOutputs=F.wc,e._OrtReleaseBinding=F.xc,e._OrtRunWithBinding=F.yc,e._OrtRun=F.zc,e._OrtEndProfiling=F.Ac,Nf=e._OrtGetWebGpuDevice=F.Bc,Pu=F.Cc,aa=e._free=F.Dc,jd=e._malloc=F.Ec,G1=e._wgpuBufferRelease=F.Fc,H0=e._wgpuCreateInstance=F.Gc,H1=F.Hc,K1=F.Ic,J1=F.Jc,Y1=F.Kc,X1=F.Lc,Nm=F.Pc,Rm=F.Zc,Bd=F._c,Q1=F.$c,K0=F.bd,Im=F.cd,J0=F.dd,Y0=F.ed,Rf=F.fd,X0=F.gd,_l=F.hd,oa=F.kd,jo=F.ld,Z1=F.md,Q0=F.nd,Bo=F.od,la=F.pd,eb=F.qd,Z0=F.rd,dn=F.sd,Ud=F.td,ey=F.ud,Ft=F.vd,Lm=F.wd,Lt=F.xd,If=F.yd,Mu=F.zd,Om=F.Ad,ty=F.Bd,tb=F.Cd,Dm=F.Dd,nb=F.Ed,rb=F.Fd,ib=F.Gd,sb=F.Hd,ab=F.Id,ob=F.Jd,ny=F.Kd,Lf=F.Ld,lb=F.Md,cb=F.Nd,ry=F.Od,y=F.Pd,k=F.Qd,P=F.Rd,O=F.Td,G=F.Ud,H=F.Vd,K=F.Wd,Q=F.Yd,ee=F.Zd,ae=F._d,ge=F.$d,Se=F.ae,oe=F.oe,ve=F.pe,xe=F.qe,Ne=F.re,ke=F.se,Ie=F.te,Le=F.ue,Ge=F.ve,ze=F.we,Ct=F.xe,dt=F.ye,sn=F.Ye,yt=F.Ze,yn=F._e,li=F.$e,f=Z,jt}var E,D=Y();return e.instantiateWasm?new Promise(F=>{e.instantiateWasm(D,(Z,ue)=>{F(S(Z,ue))})}):i?S(new WebAssembly.Instance(f,Y()),f):(q??(q=e.locateFile?e.locateFile?e.locateFile("ort-wasm-simd-threaded.asyncify.wasm",u):u+"ort-wasm-simd-threaded.asyncify.wasm":new
vendor: 4,723 bytes, line 498
498URL("/assets/ort-wasm-simd-threaded.asyncify-DMmc6YqF.wasm",import.meta.url).href),E=await async function(F){var Z=q;if(!d&&!N(Z))try{var ue=fetch(Z,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(ue,F)}catch(we){x(`wasm streaming compile failed: ${we}`),x("falling back to ArrayBuffer instantiation")}return async function(we,Te){try{var qe=await async function(rt){if(!d)try{var un=await a(rt);return new Uint8Array(un)}catch{}if(rt==q&&d)rt=new Uint8Array(d);else{if(!o)throw"both async and sync fetching of the wasm failed";rt=o(rt)}return rt}(we);return await WebAssembly.instantiate(qe,Te)}catch(rt){x(`failed to asynchronously prepare wasm: ${rt}`),J(rt)}}(Z,F)}(D),S(E.instance,E.module))}class fe{constructor(E){X(this,"name","ExitStatus");this.message=`Program terminated with exit(${E})`,this.status=E}}var me=S=>{S.terminate(),S.onmessage=()=>{}},Ce=[],Ee=0,Ae=null,De=S=>{Mt.length==0&&(An(),mt(Mt[0]));var E=Mt.pop();if(!E)return 6;xt.push(E),St[S.Nc]=E,E.Nc=S.Nc;var D={Oc:"run",ge:S.fe,Wc:S.Wc,Nc:S.Nc};return E.postMessage(D,S.Yc),0},Fe=0,Re=(S,E,...D)=>{var F,Z=16*D.length,ue=Lt(),we=Lm(Z),Te=we>>>3;for(F of D)typeof F=="bigint"?((A(),le)[Te++>>>0]=1n,(A(),le)[Te++>>>0]=F):((A(),le)[Te++>>>0]=0n,(A(),ne)[Te++>>>0]=F);return S=Z1(S,0,Z,we,E),Ft(ue),S};function Je(S){if(i)return Re(0,1,S);if(h=S,!(0<Fe)){for(var E of xt)me(E);for(E of Mt)me(E);Mt=[],xt=[],St={},T=!0}l(0,new fe(S))}function re(S){if(i)return Re(1,0,S);Ye(S)}var Ye=S=>{if(h=S,i)throw re(S),"unwind";Je(S)},Mt=[],xt=[],Ue=[],St={},ot=S=>{var E=S.Nc;delete St[E],Mt.push(S),xt.splice(xt.indexOf(S),1),S.Nc=0,Q0(E)};function Et(){Ue.forEach(S=>S())}var mt=S=>new Promise(E=>{S.onmessage=Z=>{var ue=Z.data;if(Z=ue.Oc,ue.Vc&&ue.Vc!=Pu()){var we=St[ue.Vc];we?we.postMessage(ue,ue.Yc):x(`Internal error! Worker sent a message "${Z}" to target pthread ${ue.Vc}, but that thread no longer exists!`)}else Z==="checkMailbox"?dl():Z==="spawnThread"?De(ue):Z==="cleanupThread"?br(()=>{ot(St[ue.he])}):Z==="loaded"?(S.loaded=!0,E(S)):ue.target==="setimmediate"?S.postMessage(ue):Z==="uncaughtException"?S.onerror(ue.error):Z==="callHandler"?e[ue.be](...ue.args):Z&&x(`worker sent an unknown command ${Z}`)},S.onerror=Z=>{throw x(`worker sent an error! ${Z.filename}:${Z.lineno}: ${Z.message}`),Z};var D,F=[];for(D of[])e.propertyIsEnumerable(D)&&F.push(D);S.postMessage({Oc:"load",ce:F,ie:Kt,je:f})});function An(){var S=new Worker((()=>{let E=URL;return import.meta.url>"file:"&&import.meta.url<"file;"?new E("ort.webgpu.bundle.min.mjs",import.meta.url):new URL(import.meta.url)})(),{type:"module",workerData:"em-pthread",name:"em-pthread"});Mt.push(S)}var Kt,At=(S,E)=>{Fe=0,S=Dm(S,E),0<Fe?h=S:Bo(S)},Jt=[],ln=0,nt=S=>-9007199254740992>S||9007199254740992<S?NaN:Number(S);function Ut(S){var E=new Qt(S>>>=0);return(A(),M)[E.Qc+12>>>0]==0&&(pn(E,!0),ln--),zt(E,!1),Jt.push(E),ty(S)}var ht=0,wr=()=>{dn(0,0);var S=Jt.pop();If(S.Xc),ht=0};function pn(S,E){E=E?1:0,(A(),M)[S.Qc+12>>>0]=E}function zt(S,E){E=E?1:0,(A(),M)[S.Qc+13>>>0]=E}class Qt{constructor(E){this.Xc=E,this.Qc=E-24}}var Pn=S=>{var E=ht;if(!E)return Ud(0),0;var D=new Qt(E);(A(),U)[D.Qc+16>>>2>>>0]=E;var F=(A(),U)[D.Qc+4>>>2>>>0];if(!F)return Ud(0),E;for(var Z of S){if(Z===0||Z===F)break;if(Om(Z,F,D.Qc+16))return Ud(Z),E}return Ud(F),E};function Nt(){return Pn([])}function Zn(S){return Pn([S>>>0])}function It(S,E,D,F){return Pn([S>>>0,E>>>0,D>>>0,F>>>0])}var qt=()=>{var S=Jt.pop();S||J("no exception to throw");var E=S.Xc;throw(A(),M)[S.Qc+13>>>0]==0&&(Jt.push(S),zt(S,!0),pn(S,!1),ln++),Mu(E),ht=E};function lr(S,E,D){var F=new Qt(S>>>=0);throw E>>>=0,D>>>=0,(A(),U)[F.Qc+16>>>2>>>0]=0,(A(),U)[F.Qc+4>>>2>>>0]=E,(A(),U)[F.Qc+8>>>2>>>0]=D,Mu(S),ln++,ht=S}var rn=()=>ln;function Tt(S,E,D,F){return i?Re(2,1,S,E,D,F):Mn(S,E,D,F)}function Mn(S,E,D,F){if(S>>>=0,E>>>=0,D>>>=0,F>>>=0,!globalThis.SharedArrayBuffer)return 6;var Z=[];return i&&Z.length===0?Tt(S,E,D,F):(S={fe:D,Nc:S,Wc:F,Yc:Z},i?(S.Oc="spawnThread",postMessage(S,Z),0):De(S))}function Dt(S){throw ht||(ht=S>>>0),ht}var Wt=globalThis.TextDecoder&&new TextDecoder,_n=(S,E,D,F)=>{if(D=E+D,F)return D;for(;S[E]&&!(E>=D);)++E;return E},Tr=(S,E=0,D,F)=>{if(16<(D=_n(S,E>>>=0,D,F))-E&&S.buffer&&Wt)return Wt.decode(S.buffer instanceof ArrayBuffer?S.subarray(E,D):S.slice(E,D));for(F="";E<D;){var Z=S[E++];if(128&Z){var ue=63&S[E++];if((224&Z)==192)F+=String.fromCharCode((31&Z)<<6|ue);else{var we=63&S[E++];65536>(Z=(240&Z)==224?(15&Z)<<12|ue<<6|we:(7&Z)<<18|ue<<12|we<<6|63&S[E++])?F+=String.fromCharCode(Z):(Z-=65536,F+=String.fromCharCode(55296|Z>>10,56320|1023&Z))}}else F+=String.fromCharCode(Z)}return F},ct=(S,E,D)=>(S>>>=0)?Tr((A(),B),S,E,D):"";function _i(S,E,D){return i?Re(3,1,S,E,D):0}
vendor: 4,133 bytes, line 498
498function Mi(S,E){if(i)return Re(4,1,S,E)}function dr(S,E){if(i)return Re(5,1,S,E)}function Fr(S,E,D){if(i)return Re(6,1,S,E,D)}function Cr(S,E,D){return i?Re(7,1,S,E,D):0}function wi(S,E){if(i)return Re(8,1,S,E)}function Ni(S,E,D){if(i)return Re(9,1,S,E,D)}function mc(S,E,D,F){if(i)return Re(10,1,S,E,D,F)}function ll(S,E,D,F){if(i)return Re(11,1,S,E,D,F)}function Ma(S,E,D,F){if(i)return Re(12,1,S,E,D,F)}function eo(S){if(i)return Re(13,1,S)}function Na(S,E){if(i)return Re(14,1,S,E)}function Ra(S,E,D){if(i)return Re(15,1,S,E,D)}var Ia=()=>J(""),Xi=S=>{S>>>=0;for(var E="";;){var D=(A(),B)[S++>>>0];if(!D)return E;E+=String.fromCharCode(D)}},La={},cl={},to=class extends Error{constructor(S){super(S),this.name="BindingError"}};function Rs(S,E,D={}){return function(F,Z,ue={}){var we=Z.name;if(!F)throw new to(`type "${we}" must have a positive integer typeid pointer`);if(cl.hasOwnProperty(F)){if(ue.de)return;throw new to(`Cannot register type '${we}' twice`)}cl[F]=Z,La.hasOwnProperty(F)&&(Z=La[F],delete La[F],Z.forEach(Te=>Te()))}(S,E,D)}var hu=(S,E,D)=>{switch(E){case 1:return D?F=>(A(),M)[F>>>0]:F=>(A(),B)[F>>>0];case 2:return D?F=>(A(),R)[F>>>1>>>0]:F=>(A(),j)[F>>>1>>>0];case 4:return D?F=>(A(),$)[F>>>2>>>0]:F=>(A(),U)[F>>>2>>>0];case 8:return D?F=>(A(),le)[F>>>3>>>0]:F=>(A(),V)[F>>>3>>>0];default:throw new TypeError(`invalid integer width (${E}): ${S}`)}};function R0(S,E,D,F,Z){S>>>=0,D>>>=0,E=Xi(E>>>0);let ue=we=>we;if(F=F===0n){let we=8*D;ue=Te=>BigInt.asUintN(we,Te),Z=ue(Z)}Rs(S,{name:E,Mc:ue,Sc:(we,Te)=>(typeof Te=="number"&&(Te=BigInt(Te)),Te),Rc:hu(E,D,!F),Tc:null})}function gf(S,E,D,F){Rs(S>>>=0,{name:E=Xi(E>>>0),Mc:function(Z){return!!Z},Sc:function(Z,ue){return ue?D:F},Rc:function(Z){return this.Mc((A(),B)[Z>>>0])},Tc:null})}var vf=[],No=[0,1,,1,null,1,!0,1,!1,1];function Is(S){9<(S>>>=0)&&--No[S+1]==0&&(No[S]=void 0,vf.push(S))}var Qi=S=>{if(!S)throw new to(`Cannot use deleted val. handle = ${S}`);return No[S]},Ls=S=>{switch(S){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:let E=vf.pop()||No.length;return No[E]=S,No[E+1]=1,E}};function fu(S){return this.Mc((A(),U)[S>>>2>>>0])}var lm={name:"emscripten::val",Mc:S=>{var E=Qi(S);return Is(S),E},Sc:(S,E)=>Ls(E),Rc:fu,Tc:null};function cm(S){return Rs(S>>>0,lm)}var um=(S,E)=>{switch(E){case 4:return function(D){return this.Mc((A(),te)[D>>>2>>>0])};case 8:return function(D){return this.Mc((A(),ne)[D>>>3>>>0])};default:throw new TypeError(`invalid float width (${E}): ${S}`)}};function Ro(S,E,D){D>>>=0,Rs(S>>>=0,{name:E=Xi(E>>>0),Mc:F=>F,Sc:(F,Z)=>Z,Rc:um(E,D),Tc:null})}function Td(S,E,D,F,Z){S>>>=0,D>>>=0,E=Xi(E>>>0);let ue=Te=>Te;if(F===0){var we=32-8*D;ue=Te=>Te<<we>>>we,Z=ue(Z)}Rs(S,{name:E,Mc:ue,Sc:(Te,qe)=>qe,Rc:hu(E,D,F!==0),Tc:null})}function I0(S,E,D){function F(ue){var we=(A(),U)[ue>>>2>>>0];return ue=(A(),U)[ue+4>>>2>>>0],new Z((A(),M).buffer,ue,we)}var Z=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][E];Rs(S>>>=0,{name:D=Xi(D>>>0),Mc:F,Rc:F},{de:!0})}var er=(S,E,D)=>{var F=(A(),B);if(E>>>=0,0<D){var Z=E;D=E+D-1;for(var ue=0;ue<S.length;++ue){var we=S.codePointAt(ue);if(127>=we){if(E>=D)break;F[E++>>>0]=we}else if(2047>=we){if(E+1>=D)break;F[E++>>>0]=192|we>>6,F[E++>>>0]=128|63&we}else if(65535>=we){if(E+2>=D)break;F[E++>>>0]=224|we>>12,F[E++>>>0]=128|we>>6&63,F[E++>>>0]=128|63&we}else{if(E+3>=D)break;F[E++>>>0]=240|we>>18,F[E++>>>0]=128|we>>12&63,F[E++>>>0]=128|we>>6&63,F[E++>>>0]=128|63&we,ue++}}F[E>>>0]=0,S=E-Z}else S=0;return S},Oa=S=>{for(var E=0,D=0;D<S.length;++D){var F=S.charCodeAt(D);127>=F?E++:2047>=F?E+=2:55296<=F&&57343>=F?(E+=4,++D):E+=3}return E};function Io(S,E){Rs(S>>>=0,{name:E=Xi(E>>>0),Mc(D){var F=(A(),U)[D>>>2>>>0];return F=ct(D+4,F,!0),aa(D),F},Sc(D,F){F instanceof ArrayBuffer&&(F=new Uint8Array(F));var Z=typeof F=="string";if(!(Z||ArrayBuffer.isView(F)&&F.BYTES_PER_ELEMENT==1))throw new to("Cannot pass non-string to std::string");var ue=Z?Oa(F):F.length,we=jd(4+ue+1),Te=we+4;return(A(),U)[we>>>2>>>0]=ue,Z?er(F,Te,ue+1):(A(),B).set(F,Te>>>0),D!==null&&D.push(aa,we),we}
vendor: 9,897 bytes, lines 498-500
498,Rc:fu,Tc(D){aa(D)}})}var pu=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,yf=(S,E,D)=>{if(S>>>=1,16<(E=_n((A(),j),S,E/2,D))-S&&pu)return pu.decode((A(),j).slice(S,E));for(D="";S<E;++S){var F=(A(),j)[S>>>0];D+=String.fromCharCode(F)}return D},ia=(S,E,D)=>{if(D??(D=2147483647),2>D)return 0;var F=E;D=(D-=2)<2*S.length?D/2:S.length;for(var Z=0;Z<D;++Z){var ue=S.charCodeAt(Z);(A(),R)[E>>>1>>>0]=ue,E+=2}return(A(),R)[E>>>1>>>0]=0,E-F},Cd=S=>2*S.length,ul=(S,E,D)=>{var F="";S>>>=2;for(var Z=0;!(Z>=E/4);Z++){var ue=(A(),U)[S+Z>>>0];if(!ue&&!D)break;F+=String.fromCodePoint(ue)}return F},Bi=(S,E,D)=>{if(E>>>=0,D??(D=2147483647),4>D)return 0;var F=E;D=F+D-4;for(var Z=0;Z<S.length;++Z){var ue=S.codePointAt(Z);if(65535<ue&&Z++,(A(),$)[E>>>2>>>0]=ue,(E+=4)+4>D)break}return(A(),$)[E>>>2>>>0]=0,E-F},dm=S=>{for(var E=0,D=0;D<S.length;++D)65535<S.codePointAt(D)&&D++,E+=4;return E};function L0(S,E,D){if(S>>>=0,E>>>=0,D=Xi(D>>>=0),E===2)var F=yf,Z=ia,ue=Cd;else F=ul,Z=Bi,ue=dm;Rs(S,{name:D,Mc:we=>{var Te=(A(),U)[we>>>2>>>0];return Te=F(we+4,Te*E,!0),aa(we),Te},Sc:(we,Te)=>{if(typeof Te!="string")throw new to(`Cannot pass non-string to C++ string type ${D}`);var qe=ue(Te),rt=jd(4+qe+E);return(A(),U)[rt>>>2>>>0]=qe/E,Z(Te,rt+4,qe+E),we!==null&&we.push(aa,rt),rt},Rc:fu,Tc(we){aa(we)}})}function O0(S,E){Rs(S>>>=0,{ee:!0,name:E=Xi(E>>>0),Mc:()=>{},Sc:()=>{}})}function D0(S){oa(S>>>0,!r,1,!n,131072,!1),Et()}var br=S=>{if(!T)try{if(S(),!(0<Fe))try{i?Pu()&&Bo(h):Ye(h)}catch(E){E instanceof fe||E=="unwind"||l(0,E)}}catch(E){E instanceof fe||E=="unwind"||l(0,E)}},hm=!Atomics.waitAsync||((Um=globalThis.navigator)==null?void 0:Um.userAgent)&&91>Number((navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)||[])[2]);function gc(S){S>>>=0,hm||(Atomics.waitAsync((A(),$),S>>>2,S).value.then(dl),S+=128,Atomics.store((A(),$),S>>>2,1))}var dl=()=>br(()=>{var S=Pu();S&&(gc(S),eb())});function _f(S,E){(S>>>=0)==E>>>0?setTimeout(dl):i?postMessage({Vc:S,Oc:"checkMailbox"}):(S=St[S])&&S.postMessage({Oc:"checkMailbox"})}var wf=[];function F0(S,E,D,F,Z){for(E>>>=0,Z>>>=0,wf.length=0,D=Z>>>3,F=Z+F>>>3;D<F;){var ue;ue=(A(),le)[D++>>>0]?(A(),le)[D++>>>0]:(A(),ne)[D++>>>0],wf.push(ue)}return(E?et[E]:kt[S])(...wf)}var j0=()=>{Fe=0};function vc(S){S>>>=0,i?postMessage({Oc:"cleanupThread",he:S}):ot(St[S])}function fm(S){}var no=S=>{try{S()}catch(E){J(E)}};function B0(S){var E=(...D)=>{Ed.push(S);try{return S(...D)}finally{T||(Ed.pop(),Pt&&Os===1&&Ed.length===0&&(Os=0,Fe+=1,no(yt),typeof Fibers<"u"&&Fibers.Be()))}};return gm.set(S,E),E}var Os=0,Pt=null,pm=0,Ed=[],bf=new Map,mm=new Map,gm=new Map,hl=0,ro=null,U0=[],vm=S=>function(E){if(!T){if(Os===0){var D=!1,F=!1;E((Z=0)=>{if(!T&&(pm=Z,D=!0,F)){Os=2,no(()=>yn(Pt)),typeof MainLoop<"u"&&MainLoop.Xd&&MainLoop.resume(),Z=!1;try{var ue=function(){var qe=(A(),$)[Pt+8>>>2>>>0];return qe=mm.get(qe),qe=gm.get(qe),--Fe,qe()}()}catch(qe){ue=qe,Z=!0}var we=!1;if(!Pt){var Te=ro;Te&&(ro=null,(Z?Te.reject:Te.resolve)(ue),we=!0)}if(Z&&!we)throw ue}}),F=!0,D||(Os=1,Pt=function(){var Z=jd(65548),ue=Z+12;if((A(),U)[Z>>>2>>>0]=ue,(A(),U)[Z+4>>>2>>>0]=ue+65536,ue=Ed[0],!bf.has(ue)){var we=hl++;bf.set(ue,we),mm.set(we,ue)}return ue=bf.get(ue),(A(),$)[Z+8>>>2>>>0]=ue,Z}(),typeof MainLoop<"u"&&MainLoop.Xd&&MainLoop.pause(),no(()=>sn(Pt)))}else Os===2?(Os=0,no(li),aa(Pt),Pt=null,U0.forEach(br)):J(`invalid state: ${Os}`);return pm}}(E=>{S().then(E)});function Ad(S){return S>>>=0,vm(async()=>{var E=await Qi(S);return Ls(E)})}var mu=[],Lo=S=>{var E=mu.length;return mu.push(S),E},z0=(S,E)=>{for(var D=Array(S),F=0;F<S;++F){var Z=F,ue=(A(),U)[E+4*F>>>2>>>0],we=cl[ue];if(we===void 0)throw S=`parameter ${F}`,ue=G0(ue),E=Xi(ue),aa(ue),new to(`${S} has unknown type ${E}`);D[Z]=we}return D},Pd=(S,E,D)=>{var F=[];return S=S(F,D),F.length&&((A(),U)[E>>>2>>>0]=Ls(F)),S},$0={},yc=S=>{var E=$0[S];return E===void 0?Xi(S):E};function _c(S,E,D){var[F,...Z]=z0(S,E>>>0);E=F.Sc.bind(F);var ue=Z.map(qe=>qe.Rc.bind(qe));S--;var we={toValue:Qi};switch(S=ue.map((qe,rt)=>{var un=`argFromPtr${rt}`;return we[un]=qe,`${un}(args${rt?"+"+8*rt:""})`}),D){case 0:var Te="toValue(handle)";break;case 2:Te="new (toValue(handle))";break;case 3:Te="";break;case 1:we.getStringOrSymbol=yc,Te="toValue(handle)[getStringOrSymbol(methodName)]"}return Te+=`(${S})`,F.ee||(we.toReturnWire=E,we.emval_returnValue=Pd,Te=`return emval_returnValue(toReturnWire, destructorsRef, ${Te})`),Te=`return function (handle, methodName, destructorsRef, args) { 499 ${Te} 500 }`,D=new Function(Object.keys(we),Te)(...Object.values(we)),Te=`methodCaller<(${Z.map(qe=>qe.name)}) => ${F.name}>`,Lo(Object.defineProperty(D,"name",{value:Te}))}function xf(S,E){return E>>>=0,(S=Qi(S>>>0))==Qi(E)}function gu(S){return(S>>>=0)?(S=yc(S),Ls(globalThis[S])):Ls(globalThis)}function kf(S){return S=yc(S>>>0),Ls(e[S])}function Md(S,E){return E>>>=0,S=Qi(S>>>0),E=Qi(E),Ls(S[E])}function Sf(S){9<(S>>>=0)&&(No[S+1]+=1)}function vu(S,E,D,F,Z){return mu[S>>>0](E>>>0,D>>>0,F>>>0,Z>>>0)}function ym(S,E,D,F,Z){return vu(S>>>0,E>>>0,D>>>0,F>>>0,Z>>>0)}function fl(){return Ls([])}function pl(S){S=Qi(S>>>0);for(var E=Array(S.length),D=0;D<S.length;D++)E[D]=S[D];return Ls(E)}function _m(S){return Ls(yc(S>>>0))}function wm(){return Ls({})}function bm(S){for(var E=Qi(S>>>=0);E.length;){var D=E.pop();E.pop()(D)}Is(S)}function yu(S,E,D){E>>>=0,D>>>=0,S=Qi(S>>>0),E=Qi(E),D=Qi(D),S[E]=D}function xm(S,E){S=nt(S),E>>>=0,S=new Date(1e3*S),(A(),$)[E>>>2>>>0]=S.getUTCSeconds(),(A(),$)[E+4>>>2>>>0]=S.getUTCMinutes(),(A(),$)[E+8>>>2>>>0]=S.getUTCHours(),(A(),$)[E+12>>>2>>>0]=S.getUTCDate(),(A(),$)[E+16>>>2>>>0]=S.getUTCMonth(),(A(),$)[E+20>>>2>>>0]=S.getUTCFullYear()-1900,(A(),$)[E+24>>>2>>>0]=S.getUTCDay(),S=(S.getTime()-Date.UTC(S.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,(A(),$)[E+28>>>2>>>0]=S}var C=S=>S%4==0&&(S%100!=0||S%400==0),W=[0,31,60,91,121,152,182,213,244,274,305,335],ie=[0,31,59,90,120,151,181,212,243,273,304,334];function pe(S,E){S=nt(S),E>>>=0,S=new Date(1e3*S),(A(),$)[E>>>2>>>0]=S.getSeconds(),(A(),$)[E+4>>>2>>>0]=S.getMinutes(),(A(),$)[E+8>>>2>>>0]=S.getHours(),(A(),$)[E+12>>>2>>>0]=S.getDate(),(A(),$)[E+16>>>2>>>0]=S.getMonth(),(A(),$)[E+20>>>2>>>0]=S.getFullYear()-1900,(A(),$)[E+24>>>2>>>0]=S.getDay();var D=(C(S.getFullYear())?W:ie)[S.getMonth()]+S.getDate()-1|0;(A(),$)[E+28>>>2>>>0]=D,(A(),$)[E+36>>>2>>>0]=-60*S.getTimezoneOffset(),D=new Date(S.getFullYear(),6,1).getTimezoneOffset();var F=new Date(S.getFullYear(),0,1).getTimezoneOffset();S=0|(D!=F&&S.getTimezoneOffset()==Math.min(F,D)),(A(),$)[E+32>>>2>>>0]=S}function _e(S){S>>>=0;var E=new Date((A(),$)[S+20>>>2>>>0]+1900,(A(),$)[S+16>>>2>>>0],(A(),$)[S+12>>>2>>>0],(A(),$)[S+8>>>2>>>0],(A(),$)[S+4>>>2>>>0],(A(),$)[S>>>2>>>0],0),D=(A(),$)[S+32>>>2>>>0],F=E.getTimezoneOffset(),Z=new Date(E.getFullYear(),6,1).getTimezoneOffset(),ue=new Date(E.getFullYear(),0,1).getTimezoneOffset(),we=Math.min(ue,Z);return 0>D?(A(),$)[S+32>>>2>>>0]=+(Z!=ue&&we==F):0<D!=(we==F)&&(Z=Math.max(ue,Z),E.setTime(E.getTime()+6e4*((0<D?we:Z)-F))),(A(),$)[S+24>>>2>>>0]=E.getDay(),D=(C(E.getFullYear())?W:ie)[E.getMonth()]+E.getDate()-1|0,(A(),$)[S+28>>>2>>>0]=D,(A(),$)[S>>>2>>>0]=E.getSeconds(),(A(),$)[S+4>>>2>>>0]=E.getMinutes(),(A(),$)[S+8>>>2>>>0]=E.getHours(),(A(),$)[S+12>>>2>>>0]=E.getDate(),(A(),$)[S+16>>>2>>>0]=E.getMonth(),(A(),$)[S+20>>>2>>>0]=E.getYear(),S=E.getTime(),BigInt(isNaN(S)?-1:S/1e3)}function Me(S,E,D,F,Z,ue,we){return i?Re(16,1,S,E,D,F,Z,ue,we):-52}function Be(S,E,D,F,Z,ue){if(i)return Re(17,1,S,E,D,F,Z,ue)}var ut={},gt=()=>performance.timeOrigin+performance.now();function Gt(S,E){if(i)return Re(18,1,S,E);if(ut[S]&&(clearTimeout(ut[S].id),delete ut[S]),!E)return 0;var D=setTimeout(()=>{delete ut[S],br(()=>la(S,performance.timeOrigin+performance.now()))},E);return ut[S]={id:D,Ae:E},0}function tn(S,E,D,F){S>>>=0,E>>>=0,D>>>=0,F>>>=0;var Z=new Date().getFullYear(),ue=new Date(Z,0,1).getTimezoneOffset();Z=new Date(Z,6,1).getTimezoneOffset();var we=Math.max(ue,Z);(A(),U)[S>>>2>>>0]=60*we,(A(),$)[E>>>2>>>0]=+(ue!=Z),S=(E=Te=>{var qe=Math.abs(Te);return`UTC${0<=Te?"-":"+"}${String(Math.floor(qe/60)).padStart(2,"0")}${String(qe%60).padStart(2,"0")}`})(ue),E=E(Z),Z<ue?(er(S,D,17),er(E,F,17)):(er(S,F,17),er(E,D,17))}var Tn=()=>Date.now();function ii(S,E,D){return D>>>=0,0<=S&&3>=S?(S===0?S=Date.now():S=performance.timeOrigin+performance.now(),S=Math.round(1e6*S),(A(),le)[D>>>3>>>0]=BigInt(S),0):28}var $n=[],Vn=(S,E)=>{$n.length=0;for(var D;D=(A(),B)[S++>>>0];){var F=D!=105;E+=(F&=D!=112)&&E%8?4:0,$n.push(D==112?(A(),U)[E>>>2>>>0]:D==106?(A(),le)[E>>>3>>>0]:D==105?(A(),$)[E>>>2>>>0]:(A(),ne)[E>>>3>>>0]),E+=F?8:4}return $n};function hr(S,E,D){return S>>>=0,E=Vn(E>>>0,D>>>0),et[S](...E)}function Er(S,E,D){return S>>>=0,E=Vn(E>>>0,D>>>0),et[S](...E)}var Ar=()=>{};function Zi(S,E){return x(ct(S>>>0,E>>>0))}var ml=()=>{throw Fe+=1,"unwind"};function Tf(){return 4294901760}var _u=()=>1,wu=()=>navigator.hardwareConcurrency;function wc(S){S>>>=0;var E=(A(),B).length;if(S<=E||4294901760<S)return!1;for(var D=1;4>=D;D*=2){var F=E*(1+.2/D);F=Math.min(F,S+100663296);e:{F=(Math.min(4294901760,65536*Math.ceil(Math.max(S,F)/65536))-Kt.buffer.byteLength+65535)/65536|0;try{Kt.grow(F),he();var Z=1;break e}catch{}Z=void 0}if(Z)return!0}return!1}var es=S=>{var E=Oa(S)+1,D=Lm(E);return er(S,D,E),D},bc=(S,E)=>{(A(),U)[S>>>2>>>0]=E;var D=(A(),U)[S>>>2>>>0];(A(),U)[S+4>>>2>>>0]=(E-D)/4294967296},Oo=S=>(A(),U)[S>>>2>>>0]+4294967296*(A(),$)[S+4>>>2>>>0],Dn=[],bu=(S,E)=>{Dn[S>>>0]=E},fs=[],xc=[],ps=(S,E)=>{xc[S]=new Promise(D=>E.finally(()=>D(S)))},st=S=>{if(S)return Dn[S>>>0]},km=(S,E)=>{for(S=(A(),U)[S>>>2>>>0];S;S=(A(),U)[S>>>2>>>0])E[(A(),$)[S+4>>>2>>>0]](S)},gl=(S,E,D)=>{(A(),U)[S>>>2>>>0]=E,(A(),U)[S+4>>>2>>>0]=D},Cf=S=>{var E=(A(),U)[S>>>2>>>0];return S=(A(),U)[S+4>>>2>>>0],ct(E,S)},si=S=>{var E=(A(),U)[S>>>2>>>0];return S=(A(),U)[S+4>>>2>>>0],E?ct(E,S):S===0?"":void 0},xu=S=>{var E=si(S+4),D=(D=(A(),U)[S+12>>
500>2>>>0])?st(D):"auto";if(S+=16){var F=st((A(),U)[S+4>>>2>>>0]),Z=(A(),U)[S+16>>>2>>>0],ue=(A(),U)[S+20>>>2>>>0];if(Z){for(var we={},Te=0;Te<Z;++Te){var qe=ue+24*Te;we[Cf(qe+4)]=(A(),ne)[qe+16>>>3>>>0]}Z=we}else Z=void 0;S={module:F,constants:Z,entryPoint:si(S+8)}}else S=void 0;return{label:E,layout:D,compute:S}},Nd=(S,E)=>{function D(F,Z){F=S[F],(A(),U)[E+Z>>>2>>>0]=F}D("maxTextureDimension1D",4),D("maxTextureDimension2D",8),D("maxTextureDimension3D",12),D("maxTextureArrayLayers",16),D("maxBindGroups",20),D("maxBindGroupsPlusVertexBuffers",24),D("maxBindingsPerBindGroup",28),D("maxDynamicUniformBuffersPerPipelineLayout",32),D("maxDynamicStorageBuffersPerPipelineLayout",36),D("maxSampledTexturesPerShaderStage",40),D("maxSamplersPerShaderStage",44),D("maxStorageBuffersPerShaderStage",48),D("maxStorageTexturesPerShaderStage",52),D("maxUniformBuffersPerShaderStage",56),D("minUniformBufferOffsetAlignment",80),D("minStorageBufferOffsetAlignment",84),bc(E+64,S.maxUniformBufferBindingSize),bc(E+72,S.maxStorageBufferBindingSize),D("maxVertexBuffers",88),bc(E+96,S.maxBufferSize),D("maxVertexAttributes",104),D("maxVertexBufferArrayStride",108),D("maxInterStageShaderVariables",112),D("maxColorAttachments",116),D("maxColorAttachmentBytesPerSample",120),D("maxComputeWorkgroupStorageSize",124),D("maxComputeInvocationsPerWorkgroup",128),D("maxComputeWorkgroupSizeX",132),D("maxComputeWorkgroupSizeY",136),D("maxComputeWorkgroupSizeZ",140),D("maxComputeWorkgroupsPerDimension",144),S.ze!==void 0&&D("maxImmediateSize",148)},Rd=[,"validation","out-of-memory","internal"],ku=[,"compatibility","core"],Id={1:"core-features-and-limits",2:"depth-clip-control",3:"depth32float-stencil8",4:"texture-compression-bc",5:"texture-compression-bc-sliced-3d",6:"texture-compression-etc2",7:"texture-compression-astc",8:"texture-compression-astc-sliced-3d",9:"timestamp-query",10:"indirect-first-instance",11:"shader-f16",12:"rg11b10ufloat-renderable",13:"bgra8unorm-storage",14:"float32-filterable",15:"float32-blendable",16:"clip-distances",17:"dual-source-blending",18:"subgroups",19:"texture-formats-tier1",20:"texture-formats-tier2",21:"primitive-index",22:"texture-component-swizzle",327692:"chromium-experimental-unorm16-texture-formats",327729:"chromium-experimental-multi-draw-indirect"},ms=[,"low-power","high-performance"],Ds=[,"occlusion","timestamp"],Ld={undefined:1,unknown:1,destroyed:2};function kc(S,E,D,F,Z,ue){E=nt(E),D=nt(D),F>>>=0,Z>>>=0,ue>>>=0;var we=st(S>>>0);if(S={},ue){var Te=(A(),U)[ue+12>>>2>>>0];if(Te){var qe=(A(),U)[ue+16>>>2>>>0];S.requiredFeatures=Array.from((A(),U).subarray(qe>>>2>>>0,qe+4*Te>>>2>>>0),at=>Id[at])}var rt=(A(),U)[ue+20>>>2>>>0];if(rt){let at=function(jn,ki,Ru=!1){ki=rt+ki,(ki=(A(),U)[ki>>>2>>>0])==4294967295||Ru&&ki==0||(un[jn]=ki)},hn=function(jn,ki){ki=rt+ki;var Ru=(A(),U)[ki>>>2>>>0],Uo=(A(),U)[ki+4>>>2>>>0];Ru==4294967295&&Uo==4294967295||(un[jn]=Oo(ki))};var un={};at("maxTextureDimension1D",4),at("maxTextureDimension2D",8),at("maxTextureDimension3D",12),at("maxTextureArrayLayers",16),at("maxBindGroups",20),at("maxBindGroupsPlusVertexBuffers",24),at("maxDynamicUniformBuffersPerPipelineLayout",32),at("maxDynamicStorageBuffersPerPipelineLayout",36),at("maxSampledTexturesPerShaderStage",40),at("maxSamplersPerShaderStage",44),at("maxStorageBuffersPerShaderStage",48),at("maxStorageTexturesPerShaderStage",52),at("maxUniformBuffersPerShaderStage",56),at("minUniformBufferOffsetAlignment",80),at("minStorageBufferOffsetAlignment",84),hn("maxUniformBufferBindingSize",64),hn("maxStorageBufferBindingSize",72),at("maxVertexBuffers",88),hn("maxBufferSize",96),at("maxVertexAttributes",104),at("maxVertexBufferArrayStride",108),at("maxInterStageShaderVariables",112),at("maxColorAttachments",116),at("maxColorAttachmentBytesPerSample",120),at("maxComputeWorkgroupStorageSize",124),at("maxComputeInvocationsPerWorkgroup",128),at("maxComputeWorkgroupSizeX",132),at("maxComputeWorkgroupSizeY",136),at("maxComputeWorkgroupSizeZ",140),at("maxComputeWorkgroupsPerDimension",144),at("maxImmediateSize",148,!0),S.requiredLimits=un}(Te=(A(),U)[ue+24>>>2>>>
vendor: 4,215 bytes, line 500
5000])&&(Te={label:si(Te+4)},S.defaultQueue=Te),S.label=si(ue+4)}Fe+=1,ps(E,we.requestDevice(S).then(at=>{--Fe,br(()=>{Dn[Z>>>0]=at.queue,Dn[F>>>0]=at,Fe+=1,ps(D,at.lost.then(hn=>{br(()=>{at.onuncapturederror=()=>{};var jn=Lt(),ki=es(hn.message);Im(D,Ld[hn.reason],ki),Ft(jn)}),--Fe})),at.onuncapturederror=hn=>{var jn=5;hn.error instanceof GPUValidationError?jn=2:hn.error instanceof GPUOutOfMemoryError?jn=3:hn.error instanceof GPUInternalError&&(jn=4);var ki=Lt();hn=es(hn.error.message),_l(F,jn,hn),Ft(ki)},"adapterInfo"in at||(at.adapterInfo=we.info),X0(E,1,F,0)})},at=>{--Fe,br(()=>{var hn=Lt(),jn=es(at.message);X0(E,3,F,jn),D&&Im(D,4,jn),Ft(hn)})}))}function Sc(S){var E=st(S>>>=0),D=fs[S];if(D){for(var F=0;F<D.length;++F)D[F]();delete fs[S]}E.destroy()}function Od(S,E,D){D>>>=0;var F=st(S>>>=0);D==4294967295&&(D=void 0);try{var Z=F.getMappedRange(E>>>0,D)}catch{return 0}var ue=Z0(16,Z.byteLength);return(A(),B).set(new Uint8Array(Z),ue>>>0),fs[S].push(()=>aa(ue)),ue}function Su(S,E,D){D>>>=0;var F=st(S>>>=0);D==4294967295&&(D=void 0);try{var Z=F.getMappedRange(E>>>0,D)}catch{return 0}var ue=Z0(16,Z.byteLength);return(A(),B).fill(0,ue,Z.byteLength),fs[S].push(()=>{new Uint8Array(Z).set((A(),B).subarray(ue>>>0,ue+Z.byteLength>>>0)),aa(ue)}),ue}function ai(S,E,D,F,Z){S>>>=0,E=nt(E),D=nt(D),Z>>>=0;var ue=st(S);fs[S]=[],Z==4294967295&&(Z=void 0),Fe+=1,ps(E,ue.mapAsync(D,F>>>0,Z).then(()=>{--Fe,br(()=>{J0(E,1,0)})},we=>{--Fe,br(()=>{Lt();var Te=es(we.message);J0(E,we.name==="AbortError"?4:we.name==="OperationError"?3:0,Te),delete fs[S]})}))}function V0(S){var E=st(S>>>=0),D=fs[S];if(D){for(var F=0;F<D.length;++F)D[F]();delete fs[S],E.unmap()}}function Do(S){delete Dn[S>>>0]}function io(S,E,D){S>>>=0,E>>>=0,D>>>=0;var F=!!(A(),U)[E+32>>>2>>>0];E={label:si(E+4),usage:(A(),U)[E+16>>>2>>>0],size:Oo(E+24),mappedAtCreation:F},S=st(S);try{var Z=S.createBuffer(E)}catch{return!1}return Dn[D>>>0]=Z,F&&(fs[D]=[]),!0}function Tu(S,E,D,F){S>>>=0,E=nt(E),F>>>=0,D=xu(D>>>0),S=st(S),Fe+=1,ps(E,S.createComputePipelineAsync(D).then(Z=>{--Fe,br(()=>{Dn[F>>>0]=Z,K0(E,1,F,0)})},Z=>{--Fe,br(()=>{var ue=Lt(),we=es(Z.message);K0(E,Z.reason==="validation"?3:Z.reason==="internal"?4:0,F,we),Ft(ue)})}))}function Ef(S,E,D){S>>>=0,E>>>=0,D>>>=0;var F=(A(),U)[E>>>2>>>0],Z=(A(),$)[F+4>>>2>>>0];E={label:si(E+4),code:""},Z===2&&(E.code=Cf(F+8)),S=st(S).createShaderModule(E),Dn[D>>>0]=S}var Af=S=>{(S=st(S)).onuncapturederror=null,S.destroy()};function Dd(S,E){E=nt(E),S=st(S>>>0),Fe+=1,ps(E,S.popErrorScope().then(D=>{--Fe,br(()=>{var F=5;D?D instanceof GPUValidationError?F=2:D instanceof GPUOutOfMemoryError?F=3:D instanceof GPUInternalError&&(F=4):F=1;var Z=Lt(),ue=D?es(D.message):0;Y0(E,1,F,ue),Ft(Z)})},D=>{--Fe,br(()=>{var F=Lt(),Z=es(D.message);Y0(E,1,5,Z),Ft(F)})}))}function Cu(S,E,D,F){if(E=nt(E),F>>>=0,D>>>=0){var Z={featureLevel:ku[(A(),$)[D+4>>>2>>>0]],powerPreference:ms[(A(),$)[D+8>>>2>>>0]],forceFallbackAdapter:!!(A(),U)[D+12>>>2>>>0]};(S=(A(),U)[D>>>2>>>0])!==0&&(A(),Z.De=!!(A(),U)[S+8>>>2>>>0])}"gpu"in navigator?(Fe+=1,ps(E,navigator.gpu.requestAdapter(Z).then(ue=>{--Fe,br(()=>{if(ue)Dn[F>>>0]=ue,Rf(E,1,F,0);else{var we=Lt(),Te=es("WebGPU not available on this browser (requestAdapter returned null)");Rf(E,3,F,Te),Ft(we)}})},ue=>{--Fe,br(()=>{var we=Lt(),Te=es(ue.message);Rf(E,4,F,Te),Ft(we)})}))):(Z=Lt(),S=es("WebGPU not available on this browser (navigator.gpu is not available)"),Rf(E,3,F,S),Ft(Z))}function Eu(S,E,D){return S>>>=0,E>>>=0,D>>>=0,vm(async()=>{var F=[];if(D){var Z=(A(),$)[D>>>2>>>0];F.length=E+1,F[E]=new Promise(Te=>setTimeout(Te,Z,0))}else F.length=E;for(var ue=0;ue<E;++ue){var we=Oo(S+8*ue);if(!(we in xc))return we;F[ue]=xc[we]}return F=await Promise.race(F),delete xc[F],F})}var Fo,so={},vl=()=>{var F;if(!Fo){var S,E={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(((F=globalThis.navigator)==null?void 0:F.language)??"C").replace("-","_")+".UTF-8",_:"./this.program"};for(S in so)so[S]===void 0?delete E[S]:E[S]=so[S];var D=[];for(S in E)D.push(`${S}=${E[S]}`);Fo=D}return Fo};function Au(S,E){if(i)return Re(19,1,S,E);S>>>=0,E>>>=0;var D,F=0,Z=0;for(D of vl()){var ue=E+F;(A(),U)[S+Z>>>2>>>0]=ue,F+=er(D,ue,1/0)+1,Z+=4}return 0}
vendor: 34,263 bytes, lines 500-501
500function Ui(S,E){if(i)return Re(20,1,S,E);S>>>=0,E>>>=0;var D=vl();for(var F of((A(),U)[S>>>2>>>0]=D.length,S=0,D))S+=Oa(F)+1;return(A(),U)[E>>>2>>>0]=S,0}function ao(S){return i?Re(21,1,S):52}function tr(S,E,D,F){return i?Re(22,1,S,E,D,F):52}function nr(S,E,D,F){return i?Re(23,1,S,E,D,F):70}var Hr=[null,[],[]];function oi(S,E,D,F){if(i)return Re(24,1,S,E,D,F);E>>>=0,D>>>=0,F>>>=0;for(var Z=0,ue=0;ue<D;ue++){var we=(A(),U)[E>>>2>>>0],Te=(A(),U)[E+4>>>2>>>0];E+=8;for(var qe=0;qe<Te;qe++){var rt=S,un=(A(),B)[we+qe>>>0],at=Hr[rt];un===0||un===10?((rt===1?b:x)(Tr(at)),at.length=0):at.push(un)}Z+=Te}return(A(),U)[F>>>2>>>0]=Z,0}function yl(S){return S>>>0}function Pf(S,E){return Nd(st(S>>>0).limits,E>>>0),1}function Fd(S,E){return st(S>>>0).features.has(Id[E])}function Sm(S){return BigInt(st(S>>>0).size)}function I1(S){return BigInt(st(S>>>0).usage)}function L1(S,E){if(S>>>=0,E>>>=0){var D=si(E+4);D={label:D,timestampWrites:E=(E=(A(),U)[E+12>>>2>>>0])!==0?{querySet:st((A(),U)[E+4>>>2>>>0]),beginningOfPassWriteIndex:(A(),U)[E+8>>>2>>>0],endOfPassWriteIndex:(A(),U)[E+12>>>2>>>0]}:void 0}}return E=st(S),S=X1(0),D=E.beginComputePass(D),Dn[S>>>0]=D,S}function O1(S,E,D,F){D=nt(D),(F=nt(F))==-1&&(F=void 0),(S=st(S>>>0)).clearBuffer(st(E>>>0),D,F)}function D1(S,E,D,F,Z,ue){D=nt(D),Z=nt(Z),ue=nt(ue),st(S>>>0).copyBufferToBuffer(st(E>>>0),D,st(F>>>0),Z,ue)}function Mf(S){var E=st(S>>>0);return S=J1(0),E=E.finish(),Dn[S>>>0]=E,S}function F1(S,E,D,F,Z,ue){ue=nt(ue),st(S>>>0).resolveQuerySet(st(E>>>0),D,F,st(Z>>>0),ue)}function j1(S,E,D,F){st(S>>>0).dispatchWorkgroups(E,D,F)}function B1(S,E,D){D=nt(D),st(S>>>0).dispatchWorkgroupsIndirect(st(E>>>0),D)}function U1(S){st(S>>>0).end()}function z1(S,E,D,F,Z){F>>>=0,Z>>>=0,S=st(S>>>0),D=st(D>>>0),F==0?S.setBindGroup(E,D):S.setBindGroup(E,D,(A(),U),Z>>>2,F)}function $1(S,E){st(S>>>0).setPipeline(st(E>>>0))}function V1(S,E,D){st(S>>>0).Ce(st(E>>>0),D)}function q1(S,E){var D=st(S>>>0);return S=K1(0),E=D.getBindGroupLayout(E),Dn[S>>>0]=E,S}function q0(S,E){function D(Z){var ue=(A(),U)[Z+8>>>2>>>0],we=(A(),U)[Z+32>>>2>>>0],Te=(A(),U)[Z+36>>>2>>>0],qe=0;return km(Z,{327681:rt=>{qe=(A(),U)[rt+8>>>2>>>0]}}),ue?((we=Oo(Z+24))==-1&&(we=void 0),ue={buffer:st(ue),offset:Oo(Z+16),size:we}):ue=st(we||Te||qe),{binding:(A(),U)[Z+4>>>2>>>0],resource:ue}}S>>>=0,E={label:si(4+(E>>>=0)),layout:st((A(),U)[E+12>>>2>>>0]),entries:function(Z,ue){for(var we=[],Te=0;Te<Z;++Te)we.push(D(ue+40*Te));return we}((A(),U)[E+16>>>2>>>0],(A(),U)[E+20>>>2>>>0])},S=st(S);var F=H1(0);return bu(F,S.createBindGroup(E)),F}function Tm(S,E){var D;return S>>>=0,(E>>>=0)&&(D={label:si(E+4)}),E=st(S),S=Y1(0),D=E.createCommandEncoder(D),Dn[S>>>0]=D,S}function sa(S,E){S>>>=0,E>>>=0,E={type:Ds[(A(),$)[E+12>>>2>>>0]],count:(A(),U)[E+16>>>2>>>0]};var D=st(S);return S=Nm(0),E=D.createQuerySet(E),Dn[S>>>0]=E,S}function Da(S,E){S=st(S>>>0).adapterInfo,E>>>=0,(A(),U)[E+52>>>2>>>0]=S.subgroupMinSize,(A(),U)[E+56>>>2>>>0]=S.subgroupMaxSize;var D=S.vendor+S.architecture+S.device+S.description,F=Oa(D)+1,Z=jd(F);return Z&&er(D,Z,F),D=Z,F=Oa(S.vendor),gl(E+4,D,F),D+=F,F=Oa(S.architecture),gl(E+12,D,F),D+=F,F=Oa(S.device),gl(E+20,D,F),gl(E+28,D+F,Oa(S.description)),(A(),$)[E+36>>>2>>>0]=2,S=S.isFallbackAdapter?3:4,(A(),$)[E+40>>>2>>>0]=S,(A(),U)[E+44>>>2>>>0]=0,(A(),U)[E+48>>>2>>>0]=0,1}var Cm={"core-features-and-limits":1,"depth-clip-control":2,"depth32float-stencil8":3,"texture-compression-bc":4,"texture-compression-bc-sliced-3d":5,"texture-compression-etc2":6,"texture-compression-astc":7,"texture-compression-astc-sliced-3d":8,"timestamp-query":9,"indirect-first-instance":10,"shader-f16":11,"rg11b10ufloat-renderable":12,"bgra8unorm-storage":13,"float32-filterable":14,"float32-blendable":15,"clip-distances":16,"dual-source-blending":17,subgroups:18,"texture-formats-tier1":19,"texture-formats-tier2":20,"primitive-index":21,"texture-component-swizzle":22,"chromium-experimental-unorm16-texture-formats":327692,"chromium-experimental-multi-draw-indirect":327729};function Em(S,E){E>>>=0;var D=st(S>>>0);S=jd(4*D.features.size);var F=0,Z=0;for(let ue of D.features)0<=(D=Cm[ue])&&((A(),$)[S+F>>>2>>>0]=D,F+=4,Z++);(A(),U)[E+4>>>2>>>0]=S,(A(),U)[E>>>2>>>0]=Z}function W1(S,E){return Nd(st(S>>>0).limits,E>>>0),1}function Am(S,E){st(S>>>0).pushErrorScope(Rd[E])}function Pm(S,E,D){E>>>=0,D>>>=0,S=st(S>>>0),E=Array.from((A(),$).subarray(D>>>2>>>0,D+4*E>>>2>>>0),F=>st(F)),S.submit(E)}function W0(S,E,D,F,Z){D=nt(D),F>>>=0,Z>>>=0,S=st(S>>>0),E=st(E>>>0),F=(A(),B).subarray(F>>>0,F+Z>>>0),S.writeBuffer(E,D,F,0,Z)}i||function(){for(var S=e.numThreads-1;S--;)An();Ce.push(async()=>{var E=async function(){if(!i)return Promise.all(Mt.map(mt))}();Ee++,await E,--Ee==0&&Ae&&(E=Ae,Ae=null,E())})}(),i||(Kt=new WebAssembly.Memory({initial:256,maximum:65536,shared:!0}),he()),e.wasmBinary&&(d=e.wasmBinary),e.stackSave=()=>Lt(),e.stackRestore=S=>Ft(S),e.stackAlloc=S=>Lm(S),e.setValue=function(S,E,D="i8"){switch(D.endsWith("*")&&(D="*"),D){case"i1":case"i8":(A(),M)[S>>>0]=E;break;case"i16":(A(),R)[S>>>1>>>0]=E;break;case"i32":(A(),$)[S>>>2>>>0]=E;break;case"i64":(A(),le)[S>>>3>>>0]=BigInt(E);break;case"float":(A(),te)[S>>>2>>>0]=E;break;case"double":(A(),ne)[S>>>3>>>0]=E;break;case"*":(A(),U)[S>>>2>>>0]=E;break;default:J(`invalid type for setValue: ${D}`)}},e.getValue=function(S,E="i8"){switch(E.endsWith("*")&&(E="*"),E){case"i1":case"i8":return(A(),M)[S>>>0];case"i16":return(A(),R)[S>>>1>>>0];case"i32":return(A(),$)[S>>>2>>>0];case"i64":return(A(),le)[S>>>3>>>0];case"float":return(A(),te)[S>>>2>>>0];case"double":return(A(),ne)[S>>>3>>>0];case"*":return(A(),U)[S>>>2>>>0];default:J(`invalid type for getValue: ${E}`)}},e.UTF8ToString=ct,e.stringToUTF8=er,e.lengthBytesUTF8=Oa;var G0,Mm,Nf,Pu,aa,jd,G1,H0,H1,K1,J1,Y1,X1,Nm,Rm,Bd,Q1,K0,Im,J0,Y0,Rf,X0,_l,oa,jo,Z1,Q0,Bo,la,eb,Z0,dn,Ud,ey,Ft,Lm,Lt,If,Mu,Om,ty,tb,Dm,nb,rb,ib,sb,ab,ob,ny,Lf,lb,cb,ry,y,k,P,O,G,H,K,Q,ee,ae,ge,Se,oe,ve,xe,Ne,ke,Ie,Le,Ge,ze,Ct,dt,sn,yt,yn,li,jt,kt=[Je,re,Tt,_i,Mi,dr,Fr,Cr,wi,Ni,mc,ll,Ma,eo,Na,Ra,Me,Be,Gt,Au,Ui,ao,tr,nr,oi],et={970348:(S,E,D,F,Z)=>{if(e===void 0||!e.Uc)return 1;if((S=ct(Number(S>>>0))).startsWith("./")&&(S=S.substring(2)),!(S=e.Uc.get(S)))return 2;if(E=Number(E>>>0),D=Number(D>>>0),F=Number(F>>>0),E+D>S.byteLength)return 3;try{let ue=S.subarray(E,E+D);switch(Z){case 0:(A(),B).set(ue,F>>>0);break;case 1:e.ad?e.ad(F,ue):e.ne(F,ue);break;default:return 4}return 0}catch{return 4}},971172:(S,E,D)=>{e.Sd(S,(A(),B).subarray(E>>>0,E+D>>>0))},971236:()=>e.le(),971278:S=>{e.jd(S)},971315:()=>typeof wasmOffsetConverter<"u"};function Kr(S,E,D,F){var Z=Lt();try{return Lf(S,E,D,F)}catch(ue){if(Ft(Z),ue!==ue+0)throw ue;dn(1,0)}}function nn(S,E,D){var F=Lt();try{return ab(S,E,D)}catch(Z){if(Ft(F),Z!==Z+0)throw Z;dn(1,0)}}function Cn(S){var E=Lt();try{nb(S)}catch(D){if(Ft(E),D!==D+0)throw D;dn(1,0)}}function fr(S,E){var D=Lt();try{return Dm(S,E)}catch(F){if(Ft(D),F!==F+0)throw F;dn(1,0)}}function zi(S,E,D){var F=Lt();try{tb(S,E,D)}catch(Z){if(Ft(F),Z!==Z+0)throw Z;dn(1,0)}}function gs(S,E){var D=Lt();try{lb(S,E)}catch(F){if(Ft(D),F!==F+0)throw F;dn(1,0)}}function jr(S,E,D,F,Z,ue,we){var Te=Lt();try{return sb(S,E,D,F,Z,ue,we)}catch(qe){if(Ft(Te),qe!==qe+0)throw qe;dn(1,0)}}function ts(S,E,D,F,Z,ue){var we=Lt();try{rb(S,E,D,F,Z,ue)}catch(Te){if(Ft(we),Te!==Te+0)throw Te;dn(1,0)}}function vs(S,E,D,F){var Z=Lt();try{ny(S,E,D,F)}catch(ue){if(Ft(Z),ue!==ue+0)throw ue;dn(1,0)}}function bi(S,E,D,F,Z,ue,we){var Te=Lt();try{ry(S,E,D,F,Z,ue,we)}catch(qe){if(Ft(Te),qe!==qe+0)throw qe;dn(1,0)}}function Nn(S,E,D,F,Z,ue,we){var Te=Lt();try{y(S,E,D,F,Z,ue,we)}catch(qe){if(Ft(Te),qe!==qe+0)throw qe;dn(1,0)}}function qn(S,E,D,F,Z,ue,we,Te){var qe=Lt();try{ae(S,E,D,F,Z,ue,we,Te)}catch(rt){if(Ft(qe),rt!==rt+0)throw rt;dn(1,0)}}function Br(S,E,D,F,Z,ue,we,Te,qe,rt,un,at){var hn=Lt();try{k(S,E,D,F,Z,ue,we,Te,qe,rt,un,at)}catch(jn){if(Ft(hn),jn!==jn+0)throw jn;dn(1,0)}}function Wn(S,E,D,F,Z){var ue=Lt();try{return cb(S,E,D,F,Z)}catch(we){if(Ft(ue),we!==we+0)throw we;dn(1,0)}}function $i(S,E,D,F,Z){var ue=Lt();try{ib(S,E,D,F,Z)}catch(we){if(Ft(ue),we!==we+0)throw we;dn(1,0)}}function oo(S,E,D,F,Z,ue,we,Te){var qe=Lt();try{ob(S,E,D,F,Z,ue,we,Te)}catch(rt){if(Ft(qe),rt!==rt+0)throw rt;dn(1,0)}}function Jr(S){var E=Lt();try{return ge(S)}catch(D){if(Ft(E),D!==D+0)throw D;dn(1,0)}}function Fs(S,E,D){var F=Lt();try{return Se(S,E,D)}catch(Z){if(Ft(F),Z!==Z+0)throw Z;dn(1,0)}}function rr(S,E){var D=Lt();try{return dt(S,E)}catch(F){if(Ft(D),F!==F+0)throw F;return dn(1,0),0n}}function xi(S){var E=Lt();try{return P(S)}catch(D){if(Ft(E),D!==D+0)throw D;return dn(1,0),0n}}function ca(S,E,D,F){var Z=Lt();try{return oe(S,E,D,F)}catch(ue){if(Ft(Z),ue!==ue+0)throw ue;dn(1,0)}}function ys(S,E,D,F,Z){var ue=Lt();try{return ve(S,E,D,F,Z)}catch(we){if(Ft(ue),we!==we+0)throw we;dn(1,0)}}function ua(S,E,D,F,Z,ue){var we=Lt();try{return xe(S,E,D,F,Z,ue)}catch(Te){if(Ft(we),Te!==Te+0)throw Te;dn(1,0)}}function da(S,E,D,F,Z,ue){var we=Lt();try{return Q(S,E,D,F,Z,ue)}catch(Te){if(Ft(we),Te!==Te+0)throw Te;dn(1,0)}}function js(S,E,D,F,Z,ue){var we=Lt();try{return Ne(S,E,D,F,Z,ue)}catch(Te){if(Ft(we),Te!==Te+0)throw Te;dn(1,0)}}function ha(S,E,D,F,Z,ue,we,Te){var qe=Lt();try{return ee(S,E,D,F,Z,ue,we,Te)}catch(rt){if(Ft(qe),rt!==rt+0)throw rt;dn(1,0)}}function cr(S,E,D,F,Z){var ue=Lt();try{return ke(S,E,D,F,Z)}catch(we){if(Ft(ue),we!==we+0)throw we;return dn(1,0),0n}}function fa(S,E,D,F){var Z=Lt();try{return Ie(S,E,D,F)}catch(ue){if(Ft(Z),ue!==ue+0)throw ue;dn(1,0)}}function lo(S,E,D,F){var Z=Lt();try{return Le(S,E,D,F)}catch(ue){if(Ft(Z),ue!==ue+0)throw ue;dn(1,0)}}function Nu(S,E,D,F,Z,ue,we,Te,qe,rt,un,at){var hn=Lt();try{return Ge(S,E,D,F,Z,ue,we,Te,qe,rt,un,at)}catch(jn){if(Ft(hn),jn!==jn+0)throw jn;dn(1,0)}}function wl(S,E,D,F,Z,ue,we,Te,qe,rt,un){var at=Lt();try{ze(S,E,D,F,Z,ue,we,Te,qe,rt,un)}catch(hn){if(Ft(at),hn!==hn+0)throw hn;dn(1,0)}}function Vi(S,E,D,F,Z,ue,we,Te,qe,rt,un,at,hn,jn,ki,Ru){var Uo=Lt();try{Ct(S,E,D,F,Z,ue,we,Te,qe,rt,un,at,hn,jn,ki,Ru)}catch(zm){if(Ft(Uo),zm!==zm+0)throw zm;dn(1,0)}}function Fm(S,E,D){var F=Lt();try{return G(S,E,D)}catch(Z){if(Ft(F),Z!==Z+0)throw Z;return dn(1,0),0n}}function iy(S,E,D){var F=Lt();try{return O(S,E,D)}catch(Z){if(Ft(F),Z!==Z+0)throw Z;dn(1,0)}}function jm(S,E,D){var F=Lt();try{return H(S,E,D)}catch(Z){if(Ft(F),Z!==Z+0)throw Z;dn(1,0)}}function Of(S,E,D,F){var Z=Lt();try{K(S,E,D,F)}catch(ue){if(Ft(Z),ue!==ue+0)throw ue;dn(1,0)}}function Bm(){if(0<Ee)Ae=Bm;else if(i)p==null||p(e),z();else{for(var S=Ce;0<S.length;)S.shift()(e);0<Ee?Ae=Bm:(e.calledRun=!0,T||(z(),p==null||p(e)))}}return i||(jt=await de(),Bm()),e.PTR_SIZE=4,e.webgpuInit=S=>{let E=new WeakMap,D,F,Z=1;e.webgpuRegisterDevice=Te=>{if(F!==void 0)throw Error("another WebGPU EP inference session is being created.");if(Te){var qe=E.get(Te);if(!qe){let rt=((un,at=0)=>{var hn=Q1(at);return at=Bd(at,hn),Dn[hn>>>0]=un.queue,Dn[at>>>0]=un,at})(Te,qe=H0(0));qe=[Z++,qe,rt],E.set(Te,qe)}return D=Te,F=qe[0],qe}D=void 0,F=0};let ue=new Map;e.webgpuOnCreateSession=Te=>{if(F!==void 0){var qe=F;if(F=void 0,Te){let rt=Nf(qe);ue.set(Te,rt),qe===0&&S(D??st(rt))}D=void 0}},e.webgpuOnReleaseSession=Te=>{ue.delete(Te)};let we=Symbol("gpuBufferMetadata");e.webgpuRegisterBuffer=(Te,qe,rt)=>{if(rt)return Te[we]=[rt,NaN],rt;if(rt=Te[we])return rt[1]++,rt[0];if((qe=ue.get(qe))===void 0)throw Error("Invalid session handle passed to webgpuRegisterBuffer");return qe=((un,at=0)=>(un.mapState==="unmapped"||J(),at=Rm(at),Dn[at>>>0]=un,at))(Te,qe),Te[we]=[qe,1],qe},e.webgpuUnregisterBuffer=Te=>{let qe=Te[we];if(!qe)throw Error("Buffer is not registered");qe[1]--,qe[1]===0&&(G1(qe[0]),delete Te[we])},e.webgpuGetBuffer=Te=>st(Te),e.webgpuCreateDownloader=(Te,qe,rt)=>{if((rt=ue.get(rt))===void 0)throw Error("Invalid session handle passed to webgpuRegisterBuffer");let un=st(rt),at=16*Math.ceil(Number(qe)/16);return async()=>{let hn=un.createBuffer({size:at,usage:9});try{let jn=un.createCommandEncoder();return jn.copyBufferToBuffer(Te,0,hn,0,at),un.queue.submit([jn.finish()]),await hn.mapAsync(GPUMapMode.READ),hn.getMappedRange().slice(0,qe)}finally{hn.destroy()}}},e.ad=(Te,qe)=>{var rt=qe.buffer;let un=qe.byteOffset,at=qe.byteLength;if(qe=16*Math.ceil(Number(at)/16),Te=st(Te),!D){var hn=Nf(F);D=st(hn)}let jn=(hn=D.createBuffer({mappedAtCreation:!0,size:qe,usage:6})).getMappedRange();new Uint8Array(jn).set(new Uint8Array(rt,un,at)),hn.unmap(),(rt=D.createCommandEncoder()).copyBufferToBuffer(hn,0,Te,0,qe),D.queue.submit([rt.finish()]),hn.destroy()}},e.webnnInit=S=>{let E=S[0];[e.le,e.jd,e.webnnEnsureTensor,e.Sd,e.webnnDownloadTensor,e.ke,e.webnnEnableTraceEvent]=S.slice(1),e.webnnReleaseTensorId=e.jd,e.webnnUploadTensor=e.Sd,e.webnnRegisterMLContext=e.ke,e.webnnOnRunStart=D=>E.onRunStart(D),e.webnnOnRunEnd=E.onRunEnd.bind(E),e.webnnOnReleaseSession=D=>{E.onReleaseSession(D)},e.webnnCreateMLTensorDownloader=(D,F)=>E.createMLTensorDownloader(D,F),e.webnnRegisterMLTensor=(D,F,Z,ue)=>E.registerMLTensor(D,F,Z,ue),e.webnnCreateMLContext=D=>E.createMLContext(D),e.webnnRegisterMLConstant=(D,F,Z,ue,we,Te)=>E.registerMLConstant(D,F,Z,ue,we,e.Uc,Te),e.webnnRegisterGraphInput=E.registerGraphInput.bind(E),e.webnnIsGraphInput=E.isGraphInput.bind(E),e.webnnRegisterGraphOutput=E.registerGraphOutput.bind(E),e.webnnIsGraphOutput=E.isGraphOutput.bind(E),e.webnnCreateTemporaryTensor=E.createTemporaryTensor.bind(E),e.webnnIsGraphInputOutputTypeSupported=E.isGraphInputOutputTypeSupported.bind(E)},se?e:new Promise((S,E)=>{p=S,m=E})}var IH,Zj,Rye=Sn(()=>{var t,e;IH=Qj,Zj=(e=(t=globalThis.self)==null?void 0:t.name)==null?void 0:e.startsWith("em-pthread"),Zj&&Qj()}),E5,VM,e8,ho,LH,Xb,t8,n8,A5,r8,P5,OH,M5,DH,fI=Sn(()=>{hI(),E5=typeof location>"u"?void 0:location.origin,VM=import.meta.url>"file:"&&import.meta.url<"file;",e8=()=>{{if(VM){let t=URL;return new URL(new t("ort.webgpu.bundle.min.mjs",import.meta.url).href,E5).href}return import.meta.url}},ho=e8(),LH=()=>{if(ho&&!ho.startsWith("blob:"))return ho.substring(0,ho.lastIndexOf("/")+1)},Xb=(t,e)=>{try{let n=e??ho;return(n?new URL(t,n):new URL(t)).origin===E5}catch{return!1}},t8=(t,e)=>{let n=e??ho;try{return(n?new URL(t,n):new URL(t)).href}catch{return}},n8=(t,e)=>`${e??"./"}${t}`,A5=async t=>{let e=await(await fetch(t,{credentials:"same-origin"})).blob();return URL.createObjectURL(e)},r8=async t=>(await import(t)).default,P5=(Nye(),qk(MH)).default,OH=async()=>{if(!ho)throw new Error("Failed to load proxy worker: cannot determine the script source URL.");if(Xb(ho))return[void 0,P5()];let t=await A5(ho);return[t,P5(t)]},M5=(Rye(),qk(RH)).default,DH=async(t,e,n,r)=>{let i=M5&&!(t||e);if(i)if(ho)i=Xb(ho)||r&&!n;else if(r&&!n)i=!0;else throw new Error("cannot determine the script source URL.");if(i)return[void 0,M5];{let s="ort-wasm-simd-threaded.asyncify.mjs",a=t??t8(s,e),o=n&&a&&!Xb(a,e),l=o?await A5(a):a??n8(s,e);return[o?l:void 0,await r8(l)]}}}),N5,Qb,wy,R5,i8,s8,a8,pI,ir,tm=Sn(()=>{fI(),Qb=!1,wy=!1,R5=!1,i8=()=>{if(typeof SharedArrayBuffer>"u")return!1;try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]))}catch{return!1}},s8=()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,30,1,28,0,65,0,253,15,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,186,1,26,11]))}catch{return!1}},a8=()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,19,1,17,0,65,1,253,15,65,2,253,15,65,3,253,15,253,147,2,11]))}catch{return!1}},pI=async t=>{if(Qb)return Promise.resolve();if(wy)throw new Error("multiple calls to 'initializeWebAssembly()' detected.");if(R5)throw new Error("previous call to 'initializeWebAssembly()' failed.");wy=!0;let e=t.initTimeout,n=t.numThreads;if(t.simd!==!1){if(t.simd==="relaxed"){if(!a8())throw new Error("Relaxed WebAssembly SIMD is not supported in the current environment.")}else if(!s8())throw new Error("WebAssembly SIMD is not supported in the current environment.")}let r=i8();n>1&&!r&&(typeof self<"u"&&!self.crossOriginIsolated&&console.warn("env.wasm.numThreads is set to "+n+", but this will not work unless you enable crossOriginIsolated mode. See https://web.dev/cross-origin-isolation-guide/ for more info."),console.warn("WebAssembly multi-threading is not supported in the current environment. Falling back to single-threading."),t.numThreads=n=1);let i=t.wasmPaths,s=typeof i=="string"?i:void 0,a=i==null?void 0:i.mjs,o=(a==null?void 0:a.href)??a,l=i==null?void 0:i.wasm,c=(l==null?void 0:l.href)??l,u=t.wasmBinary,[d,f]=await DH(o,s,n>1,!!u||!!c),h=!1,p=[];if(e>0&&p.push(new Promise(m=>{setTimeout(()=>{h=!0,m()},e)})),p.push(new Promise((m,g)=>{let v={numThreads:n};if(u)v.wasmBinary=u,v.locateFile=_=>_;else if(c||s)v.locateFile=_=>c??s+_;else if(o&&o.indexOf("blob:")!==0)v.locateFile=_=>new URL(_,o).href;else if(d){let _=LH();_&&(v.locateFile=b=>_+b)}f(v).then(_=>{wy=!1,Qb=!0,N5=_,m(),d&&URL.revokeObjectURL(d)},_=>{wy=!1,R5=!0,g(_)})})),await Promise.race(p),h)throw new Error(`WebAssembly backend initializing failed due to timeout: ${e}ms`)},ir=()=>{if(Qb&&N5)return N5;throw new Error("WebAssembly is not initialized yet.")}}),mo,Gk,zn,mI=Sn(()=>{tm(),mo=(t,e)=>{let n=ir(),r=n.lengthBytesUTF8(t)+1,i=n._malloc(r);return n.stringToUTF8(t,i,r),e.push(i),i},Gk=(t,e,n,r)=>{if(typeof t=="object"&&t!==null){if(n.has(t))throw new Error("Circular reference in options");n.add(t)}Object.entries(t).forEach(([i,s])=>{let a=e?e+i:i;if(typeof s=="object")Gk(s,a+".",n,r);else if(typeof s=="string"||typeof s=="number")r(a,s.toString());else if(typeof s=="boolean")r(a,s?"1":"0");else throw new Error(`Can't handle extra config type: ${typeof s}`)})},zn=t=>{let e=ir(),n=e.stackSave();try{let r=e.PTR_SIZE,i=e.stackAlloc(2*r);e._OrtGetLastError(i,i+r);let s=Number(e.getValue(i,r===4?"i32":"i64")),a=e.getValue(i+r,"*"),o=a?e.UTF8ToString(a):"";throw new Error(`${t} ERROR_CODE: ${s}, ERROR_MESSAGE: ${o}`)}finally{e.stackRestore(n)}}}),FH,Iye=Sn(()=>{tm(),mI(),FH=t=>{let e=ir(),n=0,r=[],i=t||{};try{if((t==null?void 0:t.logSeverityLevel)===void 0)i.logSeverityLevel=2;else if(typeof t.logSeverityLevel!="number"||!Number.isInteger(t.logSeverityLevel)||t.logSeverityLevel<0||t.logSeverityLevel>4)throw new Error(`log severity level is not valid: ${t.logSeverityLevel}`);if((t==null?void 0:t.logVerbosityLevel)===void 0)i.logVerbosityLevel=0;else if(typeof t.logVerbosityLevel!="number"||!Number.isInteger(t.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${t.logVerbosityLevel}`);(t==null?void 0:t.terminate)===void 0&&(i.terminate=!1);let s=0;return(t==null?void 0:t.tag)!==void 0&&(s=mo(t.tag,r)),n=e._OrtCreateRunOptions(i.logSeverityLevel,i.logVerbosityLevel,!!i.terminate,s),n===0&&zn("Can't create run options."),(t==null?void 0:t.extra)!==void 0&&Gk(t.extra,"",new WeakSet,(a,o)=>{let l=mo(a,r),c=mo(o,r);e._OrtAddRunConfigEntry(n,l,c)!==0&&zn(`Can't set a run config entry: ${a} - ${o}.`)}),[n,r]}catch(s){throw n!==0&&e._OrtReleaseRunOptions(n),r.forEach(a=>e._free(a)),s}}}),o8,l8,c8,Zb,Hd,u8,jH,Lye=Sn(()=>{tm(),mI(),o8=t=>{switch(t){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"layout":return 3;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${t}`)}},l8=t=>{switch(t){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${t}`)}},c8=t=>{t.extra||(t.extra={}),t.extra.session||(t.extra.session={});let e=t.extra.session;e.use_ort_model_bytes_directly||(e.use_ort_model_bytes_directly="1"),t.executionProviders&&t.executionProviders.some(n=>(typeof n=="string"?n:n.name)==="webgpu")&&(t.enableMemPattern=!1)},Zb=(t,e,n,r)=>{let i=mo(e,r),s=mo(n,r);ir()._OrtAddSessionConfigEntry(t,i,s)!==0&&zn(`Can't set a session config entry: ${e} - ${n}.`)},Hd=(t,e,n,r)=>{let i=mo(e,r),s=mo(n,r);t.push([i,s])},u8=async(t,e,n)=>{let r=e.executionProviders;for(let i of r){let s=typeof i=="string"?i:i.name,a=[];switch(s){case"webnn":if(s="WEBNN",typeof i!="string"){let d=i==null?void 0:i.deviceType;d&&Zb(t,"deviceType",d,n)}break;case"webgpu":{s="WebGPU";let d;if(typeof i!="string"){let h=i;if(h.device)if(typeof GPUDevice<"u"&&h.device instanceof GPUDevice)d=h.device;else throw new Error("Invalid GPU device set in WebGPU EP options.");let{enableGraphCapture:p}=e;if(typeof p=="boolean"&&p&&Hd(a,"enableGraphCapture","1",n),typeof h.preferredLayout=="string"&&Hd(a,"preferredLayout",h.preferredLayout,n),h.forceCpuNodeNames){let m=Array.isArray(h.forceCpuNodeNames)?h.forceCpuNodeNames:[h.forceCpuNodeNames];Hd(a,"forceCpuNodeNames",m.join(` 501`),n)}h.validationMode&&Hd(a,"validationMode",h.validationMode,n)}let f=ir().webgpuRegisterDevice(d);if(f){let[h,p,m]=f;Hd(a,"deviceId",h.toString(),n),Hd(a,"webgpuInstance",p.toString(),n),Hd(a,"webgpuDevice",m.toString(),n)}}break;case"wasm":case"cpu":continue;default:throw new Error(`not supported execution provider: ${s}`)}let o=mo(s,n),l=a.length,c=0,u=0;if(l>0){c=ir()._malloc(l*ir().PTR_SIZE),n.push(c),u=ir()._malloc(l*ir().PTR_SIZE),n.push(u);for(let d=0;d<l;d++)ir().setValue(c+d*ir().PTR_SIZE,a[d][0],"*"),ir().setValue(u+d*ir().PTR_SIZE,a[d][1],"*")}await ir()._OrtAppendExecutionProvider(t,o,c,u,l)!==0&&zn(`Can't append execution provider: ${s}.`)}},jH=async t=>{let e=ir(),n=0,r=[],i=t||{};c8(i);try{let s=o8(i.graphOptimizationLevel??"all"),a=l8(i.executionMode??"sequential"),o=typeof i.logId=="string"?mo(i.logId,r):0,l=i.logSeverityLevel??2;if(!Number.isInteger(l)||l<0||l>4)throw new Error(`log severity level is not valid: ${l}`);let c=i.logVerbosityLevel??0;if(!Number.isInteger(c)||c<0||c>4)throw new Error(`log verbosity level is not valid: ${c}`);let u=typeof i.optimizedModelFilePath=="string"?mo(i.optimizedModelFilePath,r):0;if(n=e._OrtCreateSessionOptions(s,!!i.enableCpuMemArena,!!i.enableMemPattern,a,!!i.enableProfiling,0,o,l,c,u),n===0&&zn("Can't create session options."),i.executionProviders&&await u8(n,i,r),i.enableGraphCapture!==void 0){if(typeof i.enableGraphCapture!="boolean")throw new Error(`enableGraphCapture must be a boolean value: ${i.enableGraphCapture}`);Zb(n,"enableGraphCapture",i.enableGraphCapture.toString(),r)}if(i.freeDimensionOverrides)for(let[d,f]of Object.entries(i.freeDimensionOverrides)){if(typeof d!="string")throw new Error(`free dimension override name must be a string: ${d}`);if(typeof f!="number"||!Number.isInteger(f)||f<0)throw new Error(`free dimension override value must be a non-negative integer: ${f}`);let h=mo(d,r);e._OrtAddFreeDimensionOverride(n,h,f)!==0&&zn(`Can't set a free dimension override: ${d} - ${f}.`)}return i.extra!==void 0&&Gk(i.extra,"",new WeakSet,(d,f)=>{Zb(n,d,f,r)}),[n,r]}catch(s){throw n!==0&&e._OrtReleaseSessionOptions(n)!==0&&zn("Can't release session options."),r.forEach(a=>e._free(a)),s}}}),tp,mx,mg,Tw,Hk,gI,vI,qM,c0=Sn(()=>{tp=t=>{switch(t){case"int8":return 3;case"uint8":return 2;case"bool":return 9;case"int16":return 5;case"uint16":return 4;case"int32":return 6;case"uint32":return 12;case"float16":return 10;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;case"int4":return 22;case"uint4":return 21;default:throw new Error(`unsupported data type: ${t}`)}},mx=t=>{switch(t){case 3:return"int8";case 2:return"uint8";case 9:return"bool";case 5:return"int16";case 4:return"uint16";case 6:return"int32";case 12:return"uint32";case 10:return"float16";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";case 22:return"int4";case 21:return"uint4";default:throw new Error(`unsupported data type: ${t}`)}},mg=(t,e)=>{let n=[-1,4,1,1,2,2,4,8,-1,1,2,8,4,8,-1,-1,-1,-1,-1,-1,-1,.5,.5][t],r=typeof e=="number"?e:e.reduce((i,s)=>i*s,1);return n>0?Math.ceil(r*n):void 0},Tw=t=>{switch(t){case"float16":return typeof Float16Array<"u"&&Float16Array.from?Float16Array:Uint16Array;case"float32":return Float32Array;case"uint8":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"bool":return Uint8Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${t}`)}},Hk=t=>{switch(t){case"verbose":return 0;case"info":return 1;case"warning":return 2;case"error":return 3;case"fatal":return 4;default:throw new Error(`unsupported logging level: ${t}`)}},gI=t=>t==="float32"||t==="float16"||t==="int32"||t==="int64"||t==="uint32"||t==="uint8"||t==="bool"||t==="uint4"||t==="int4",vI=t=>t==="float32"||t==="float16"||t==="int32"||t==="int64"||t==="uint32"||t==="uint64"||t==="int8"||t==="uint8"||t==="bool"||t==="uint4"||t==="int4",qM=t=>{switch(t){case"none":return 0;case"cpu":return 1;case"cpu-pinned":return 2;case"texture":return 3;case"gpu-buffer":return 4;case"ml-tensor":return 5;default:throw new Error(`unsupported data location: ${t}`)}}}),yI,BH=Sn(()=>{hI(),yI=async t=>{if(typeof t=="string"){let e=await fetch(t);if(!e.ok)throw new Error(`failed to load external data file: ${t}`);let n=e.headers.get("Content-Length"),r=n?parseInt(n,10):0;if(r<1073741824)return new Uint8Array(await e.arrayBuffer());{if(!e.body)throw new Error(`failed to load external data file: ${t}, no response body.`);let i=e.body.getReader(),s;try{s=new ArrayBuffer(r)}catch(o){if(o instanceof RangeError){let l=Math.ceil(r/65536);s=new WebAssembly.Memory({initial:l,maximum:l}).buffer}else throw o}let a=0;for(;;){let{done:o,value:l}=await i.read();if(o)break;let c=l.byteLength;new Uint8Array(s,a,c).set(l),a+=c}return new Uint8Array(s,0,r)}}else return t instanceof Blob?new Uint8Array(await t.arrayBuffer()):t instanceof Uint8Array?t:new Uint8Array(t)}}),UH,Oye=Sn(()=>{c0(),UH=(t,e)=>new(Tw(e))(t)}),d8,h8,f8,p8,zH,m8,Js,$H=Sn(()=>{c0(),d8=["V","I","W","E","F"],h8=(t,e)=>{console.log(`[${d8[t]},${new Date().toISOString()}]${e}`)},zH=(t,e)=>{f8=t,p8=e},m8=(t,e)=>{let n=Hk(t),r=Hk(f8);n>=r&&h8(n,typeof e=="function"?e():e)},Js=(...t)=>{p8&&m8(...t)}}),I5,WM,L5,g8,O5,v8,D5,F5,j5,y8,VH,Dye=Sn(()=>{c0(),$H(),I5=new Map([["float32",32],["float16",16],["int32",32],["uint32",32],["int64",64],["uint64",64],["int8",8],["uint8",8],["int4",4],["uint4",4]]),WM=(t,e)=>{if(e==="int32")return t;let n=I5.get(e);if(!n)throw new Error(`WebNN backend does not support data type: ${e}`);let r=n/8;if(t.byteLength%r!==0)throw new Error(`Invalid Uint8Array length - must be a multiple of ${r}.`);let i=t.byteLength/r,s=new(Tw(e))(t.buffer,t.byteOffset,i);switch(e){case"int64":case"uint64":{let a=new Int32Array(i);for(let o=0;o<i;o++){let l=s[o];if(l>2147483647n||l<-2147483648n)throw new Error("Can not convert int64 data to int32 - value out of range.");a[o]=Number(l)}return new Uint8Array(a.buffer)}case"int8":case"uint8":case"uint32":{if(e==="uint32"&&s.some(o=>o>2147483647))throw new Error("Can not convert uint32 data to int32 - value out of range.");let a=Int32Array.from(s,Number);return new Uint8Array(a.buffer)}default:throw new Error(`Unsupported data conversion from ${e} to 'int32'`)}},L5=(t,e)=>{if(e==="int32")return t;if(t.byteLength%4!==0)throw new Error("Invalid Uint8Array length - must be a multiple of 4 (int32).");let n=t.byteLength/4,r=new Int32Array(t.buffer,t.byteOffset,n);switch(e){case"int64":{let i=BigInt64Array.from(r,BigInt);return new Uint8Array(i.buffer)}case"uint64":{if(r.some(s=>s<0))throw new Error("Can not convert int32 data to uin64 - negative value found.");let i=BigUint64Array.from(r,BigInt);return new Uint8Array(i.buffer)}case"int8":{if(r.some(s=>s<-128||s>127))throw new Error("Can not convert int32 data to int8 - value out of range.");let i=Int8Array.from(r,Number);return new Uint8Array(i.buffer)}case"uint8":{if(r.some(i=>i<0||i>255))throw new Error("Can not convert int32 data to uint8 - value out of range.");return Uint8Array.from(r,Number)}case"uint32":{if(r.some(s=>s<0))throw new Error("Can not convert int32 data to uint32 - negative value found.");let i=Uint32Array.from(r,Number);return new Uint8Array(i.buffer)}default:throw new Error(`Unsupported data conversion from 'int32' to ${e}`)}},g8=1,O5=()=>g8++,v8=new Map([["int8","int32"],["uint8","int32"],["uint32","int32"],["int64","int32"]]),D5=(t,e)=>{let n=I5.get(t);if(!n)throw new Error(`WebNN backend does not support data type: ${t}`);return e.length>0?Math.ceil(e.reduce((r,i)=>r*i)*n/8):0},F5=class{constructor(t){this.isDataConverted=!1;let{sessionId:e,context:n,tensor:r,dataType:i,shape:s,fallbackDataType:a}=t;this.sessionId=e,this.mlContext=n,this.mlTensor=r,this.dataType=i,this.tensorShape=s,this.fallbackDataType=a}get tensor(){return this.mlTensor}get type(){return this.dataType}get fallbackType(){return this.fallbackDataType}get shape(){return this.tensorShape}get byteLength(){return D5(this.dataType,this.tensorShape)}destroy(){Js("verbose",()=>"[WebNN] TensorWrapper.destroy"),this.mlTensor.destroy()}write(t){this.mlContext.writeTensor(this.mlTensor,t)}async read(t){if(this.fallbackDataType){let e=await this.mlContext.readTensor(this.mlTensor),n=L5(new Uint8Array(e),this.dataType);if(t){(t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)).set(n);return}else return n.buffer}else return t?this.mlContext.readTensor(this.mlTensor,t):this.mlContext.readTensor(this.mlTensor)}canReuseTensor(t,e,n){return this.mlContext===t&&this.dataType===e&&this.tensorShape.length===n.length&&this.tensorShape.every((r,i)=>r===n[i])}setIsDataConverted(t){this.isDataConverted=t}},j5=class{constructor(t,e){this.tensorManager=t,this.wrapper=e}get tensorWrapper(){return this.wrapper}releaseTensor(){this.tensorWrapper&&(this.tensorManager.releaseTensor(this.tensorWrapper),this.wrapper=void 0)}async ensureTensor(t,e,n,r){let i=this.tensorManager.getMLContext(t),s=this.tensorManager.getMLOpSupportLimits(t),a;if(!(s!=null&&s.input.dataTypes.includes(e))){if(a=v8.get(e),!a||(s==null?void 0:s.input.dataTypes.includes(a)))throw new Error(`WebNN backend does not support data type: ${e}`);Js("verbose",()=>`[WebNN] TensorIdTracker.ensureTensor: fallback dataType from ${e} to ${a}`)}if(this.wrapper){if(this.wrapper.canReuseTensor(i,e,n))return this.wrapper.tensor;if(r){if(this.wrapper.byteLength!==D5(e,n))throw new Error("Unable to copy data to tensor with different size.");this.activeUpload=new Uint8Array(await this.wrapper.read())}this.tensorManager.releaseTensor(this.wrapper)}let o=typeof MLTensorUsage>"u"?void 0:MLTensorUsage.READ|MLTensorUsage.WRITE;return this.wrapper=await this.tensorManager.getCachedTensor(t,e,n,o,!0,!0,a),r&&this.activeUpload&&(this.wrapper.write(this.activeUpload),this.activeUpload=void 0),this.wrapper.tensor}upload(t){let e=t;if(this.wrapper){if(this.wrapper.fallbackType)if(this.wrapper.fallbackType==="int32")e=WM(t,this.wrapper.type),this.wrapper.setIsDataConverted(!0);else throw new Error(`Unsupported fallback data type: ${this.wrapper.fallbackType}`);if(t.byteLength===this.wrapper.byteLength){this.wrapper.write(e);return}else Js("verbose",()=>"Data size does not match tensor size. Releasing tensor."),this.releaseTensor()}this.activeUpload?this.activeUpload.set(e):this.activeUpload=new Uint8Array(e)}async download(t){var e,n;if(this.activeUpload){let r=(e=this.wrapper)!=null&&e.isDataConverted?L5(this.activeUpload,(n=this.wrapper)==null?void 0:n.type):this.activeUpload;if(t){t instanceof ArrayBuffer?new Uint8Array(t).set(r):new Uint8Array(t.buffer,t.byteOffset,t.byteLength).set(r);return}else return r.buffer}if(!this.wrapper)throw new Error("Tensor has not been created.");return t?this.wrapper.read(t):this.wrapper.read()}},y8=class{constructor(t){this.backend=t,this.tensorTrackersById=new Map,this.freeTensors=[],this.externalTensors=new Set}getMLContext(t){let e=this.backend.getMLContext(t);if(!e)throw new Error("MLContext not found for session.");return e}getMLOpSupportLimits(t){return this.backend.getMLOpSupportLimits(t)}reserveTensorId(){let t=O5();return this.tensorTrackersById.set(t,new j5(this)),t}releaseTensorId(t){let e=this.tensorTrackersById.get(t);e&&(this.tensorTrackersById.delete(t),e.tensorWrapper&&this.releaseTensor(e.tensorWrapper))}async ensureTensor(t,e,n,r,i){Js("verbose",()=>`[WebNN] TensorManager.ensureTensor {tensorId: ${e}, dataType: ${n}, shape: ${r}, copyOld: ${i}}`);let s=this.tensorTrackersById.get(e);if(!s)throw new Error("Tensor not found.");return s.ensureTensor(t,n,r,i)}upload(t,e){let n=this.tensorTrackersById.get(t);if(!n)throw new Error("Tensor not found.");n.upload(e)}async download(t,e){Js("verbose",()=>`[WebNN] TensorManager.download {tensorId: ${t}, dstBuffer: ${e==null?void 0:e.byteLength}}`);let n=this.tensorTrackersById.get(t);if(!n)throw new Error("Tensor not found.");return n.download(e)}releaseTensorsForSession(t){for(let e of this.freeTensors)e.sessionId===t&&e.destroy();this.freeTensors=this.freeTensors.filter(e=>e.sessionId!==t)}registerTensor(t,e,n,r){let i=this.getMLContext(t),s=O5(),a=new F5({sessionId:t,context:i,tensor:e,dataType:n,shape:r});return this.tensorTrackersById.set(s,new j5(this,a)),this.externalTensors.add(a),s}async getCachedTensor(t,e,n,r,i,s,a){let o=this.getMLContext(t);for(let[c,u]of this.freeTensors.entries())if(u.canReuseTensor(o,e,n)){Js("verbose",()=>`[WebNN] Reusing tensor {dataType: ${e}, ${a?`fallbackDataType: ${a},`:""} shape: ${n}`);let d=this.freeTensors.splice(c,1)[0];return d.sessionId=t,d}Js("verbose",()=>`[WebNN] MLContext.createTensor {dataType: ${e}, ${a?`fallbackDataType: ${a},`:""} shape: ${n}}`);let l=await o.createTensor({dataType:a??e,shape:n,dimensions:n,usage:r,writable:i,readable:s});return new F5({sessionId:t,context:o,tensor:l,dataType:e,shape:n,fallbackDataType:a})}releaseTensor(t){this.externalTensors.has(t)&&this.externalTensors.delete(t),this.freeTensors.push(t)}},VH=(...t)=>new y8(...t)}),qH={};m1(qH,{WebNNBackend:()=>WH});var by,_8,WH,Fye=Sn(()=>{c0(),tm(),Oye(),Dye(),$H(),by=new Map([[1,"float32"],[10,"float16"],[6,"int32"],[12,"uint32"],[7,"int64"],[13,"uint64"],[22,"int4"],[21,"uint4"],[3,"int8"],[2,"uint8"],[9,"uint8"]]),_8=(t,e)=>{if(t===e)return!0;
501if(t===void 0||e===void 0)return!1;let n=Object.keys(t).sort(),r=Object.keys(e).sort();return n.length===r.length&&n.every((i,s)=>i===r[s]&&t[i]===e[i])},WH=class{constructor(t){this.tensorManager=VH(this),this.mlContextBySessionId=new Map,this.sessionIdsByMLContext=new Map,this.mlContextCache=[],this.sessionGraphInputs=new Map,this.sessionGraphOutputs=new Map,this.temporaryGraphInputs=[],this.temporaryGraphOutputs=[],this.temporarySessionTensorIds=new Map,this.mlOpSupportLimitsBySessionId=new Map,zH(t.logLevel,!!t.debug)}get currentSessionId(){if(this.activeSessionId===void 0)throw new Error("No active session");return this.activeSessionId}onRunStart(t){Js("verbose",()=>`[WebNN] onRunStart {sessionId: ${t}}`),this.activeSessionId=t}onRunEnd(t){Js("verbose",()=>`[WebNN] onRunEnd {sessionId: ${t}}`);let e=this.temporarySessionTensorIds.get(t);if(e){for(let n of e)Js("verbose",()=>`[WebNN] releasing temporary tensor {tensorId: ${n}}`),this.tensorManager.releaseTensorId(n);this.temporarySessionTensorIds.delete(t),this.activeSessionId=void 0}}async createMLContext(t){if(t instanceof GPUDevice){let n=this.mlContextCache.findIndex(r=>r.gpuDevice===t);if(n!==-1)return this.mlContextCache[n].mlContext;{let r=await navigator.ml.createContext(t);return this.mlContextCache.push({gpuDevice:t,mlContext:r}),r}}else if(t===void 0){let n=this.mlContextCache.findIndex(r=>r.options===void 0&&r.gpuDevice===void 0);if(n!==-1)return this.mlContextCache[n].mlContext;{let r=await navigator.ml.createContext();return this.mlContextCache.push({mlContext:r}),r}}let e=this.mlContextCache.findIndex(n=>_8(n.options,t));if(e!==-1)return this.mlContextCache[e].mlContext;{let n=await navigator.ml.createContext(t);return this.mlContextCache.push({options:t,mlContext:n}),n}}registerMLContext(t,e){this.mlContextBySessionId.set(t,e);let n=this.sessionIdsByMLContext.get(e);n||(n=new Set,this.sessionIdsByMLContext.set(e,n)),n.add(t),this.mlOpSupportLimitsBySessionId.has(t)||this.mlOpSupportLimitsBySessionId.set(t,e.opSupportLimits()),this.temporaryGraphInputs.length>0&&(this.sessionGraphInputs.set(t,this.temporaryGraphInputs),this.temporaryGraphInputs=[]),this.temporaryGraphOutputs.length>0&&(this.sessionGraphOutputs.set(t,this.temporaryGraphOutputs),this.temporaryGraphOutputs=[])}onReleaseSession(t){this.sessionGraphInputs.delete(t),this.sessionGraphOutputs.delete(t);let e=this.mlContextBySessionId.get(t);if(!e)return;this.tensorManager.releaseTensorsForSession(t),this.mlContextBySessionId.delete(t),this.mlOpSupportLimitsBySessionId.delete(t);let n=this.sessionIdsByMLContext.get(e);if(n.delete(t),n.size===0){this.sessionIdsByMLContext.delete(e);let r=this.mlContextCache.findIndex(i=>i.mlContext===e);r!==-1&&this.mlContextCache.splice(r,1)}}getMLContext(t){return this.mlContextBySessionId.get(t)}getMLOpSupportLimits(t){return this.mlOpSupportLimitsBySessionId.get(t)}reserveTensorId(){return this.tensorManager.reserveTensorId()}releaseTensorId(t){Js("verbose",()=>`[WebNN] releaseTensorId {tensorId: ${t}}`),this.tensorManager.releaseTensorId(t)}async ensureTensor(t,e,n,r,i){let s=by.get(n);if(!s)throw new Error(`Unsupported ONNX data type: ${n}`);return this.tensorManager.ensureTensor(t??this.currentSessionId,e,s,r,i)}async createTemporaryTensor(t,e,n){Js("verbose",()=>`[WebNN] createTemporaryTensor {onnxDataType: ${e}, shape: ${n}}`);let r=by.get(e);if(!r)throw new Error(`Unsupported ONNX data type: ${e}`);let i=this.tensorManager.reserveTensorId();await this.tensorManager.ensureTensor(t,i,r,n,!1);let s=this.temporarySessionTensorIds.get(t);return s?s.push(i):this.temporarySessionTensorIds.set(t,[i]),i}uploadTensor(t,e){if(!ir().shouldTransferToMLTensor)throw new Error("Trying to upload to a MLTensor while shouldTransferToMLTensor is false");Js("verbose",()=>`[WebNN] uploadTensor {tensorId: ${t}, data: ${e.byteLength}}`),this.tensorManager.upload(t,e)}async downloadTensor(t,e){return this.tensorManager.download(t,e)}createMLTensorDownloader(t,e){return async()=>{let n=await this.tensorManager.download(t);return UH(n,e)}}registerMLTensor(t,e,n,r){let i=by.get(n);if(!i)throw new Error(`Unsupported ONNX data type: ${n}`);let s=this.tensorManager.registerTensor(t,e,i,r);return Js("verbose",()=>`[WebNN] registerMLTensor {tensor: ${e}, dataType: ${i}, dimensions: ${r}} -> {tensorId: ${s}}`),s}registerMLConstant(t,e,n,r,i,s,a=!1){if(!s)throw new Error("External mounted files are not available.");let o=t;t.startsWith("./")&&(o=t.substring(2));let l=s.get(o);if(!l)throw new Error(`File with name ${o} not found in preloaded files.`);if(e+n>l.byteLength)throw new Error("Out of bounds: data offset and length exceed the external file data size.");let c=l.slice(e,e+n).buffer,u;switch(i.dataType){case"float32":u=new Float32Array(c);break;case"float16":u=typeof Float16Array<"u"&&Float16Array.from?new Float16Array(c):new Uint16Array(c);break;case"int32":u=new Int32Array(c);break;case"uint32":u=new Uint32Array(c);break;case"int64":if(a){let d=WM(new Uint8Array(c),"int64");u=new Int32Array(d.buffer),i.dataType="int32"}else u=new BigInt64Array(c);break;case"uint64":u=new BigUint64Array(c);break;case"int8":u=new Int8Array(c);break;case"int4":case"uint4":case"uint8":u=new Uint8Array(c);break;default:throw new Error(`Unsupported data type: ${i.dataType} in creating WebNN Constant from external data.`)}return Js("verbose",()=>`[WebNN] registerMLConstant {dataType: ${i.dataType}, shape: ${i.shape}}} ${a?"(Note: it was int64 data type and registered to int32 as workaround)":""}`),r.constant(i,u)}registerGraphInput(t){this.temporaryGraphInputs.push(t)}registerGraphOutput(t){this.temporaryGraphOutputs.push(t)}isGraphInput(t,e){let n=this.sessionGraphInputs.get(t);return n?n.includes(e):!1}isGraphOutput(t,e){let n=this.sessionGraphOutputs.get(t);return n?n.includes(e):!1}isGraphInputOutputTypeSupported(t,e,n=!0){let r=by.get(tp(e)),i=this.mlOpSupportLimitsBySessionId.get(t);return typeof r>"u"?!1:n?!!(i!=null&&i.input.dataTypes.includes(r)):!!(i!=null&&i.output.dataTypes.includes(r))}flush(){}}}),w8,_I,wI,Kd,b8,B5,Kk,bI,xI,U5,kI,SI,TI,GH=Sn(()=>{em(),Iye(),Lye(),c0(),tm(),mI(),BH(),w8=(t,e)=>{ir()._OrtInit(t,e)!==0&&zn("Can't initialize onnxruntime.")},_I=async t=>{w8(t.wasm.numThreads,Hk(t.logLevel))},wI=async(t,e)=>{var r,i;(i=(r=ir()).asyncInit)==null||i.call(r);let n=t.webgpu.adapter;if(e==="webgpu"){if(typeof navigator>"u"||!navigator.gpu)throw new Error("WebGPU is not supported in current environment");
vendor: 4,755 bytes, line 501
501if(n){if(typeof n.limits!="object"||typeof n.features!="object"||typeof n.requestDevice!="function")throw new Error("Invalid GPU adapter set in `env.webgpu.adapter`. It must be a GPUAdapter object.")}else{let s=t.webgpu.powerPreference;if(s!==void 0&&s!=="low-power"&&s!=="high-performance")throw new Error(`Invalid powerPreference setting: "${s}"`);let a=t.webgpu.forceFallbackAdapter;if(a!==void 0&&typeof a!="boolean")throw new Error(`Invalid forceFallbackAdapter setting: "${a}"`);if(n=await navigator.gpu.requestAdapter({powerPreference:s,forceFallbackAdapter:a}),!n)throw new Error('Failed to get GPU adapter. You may need to enable flag "--enable-unsafe-webgpu" if you are using Chrome.')}}if(e==="webnn"&&(typeof navigator>"u"||!navigator.ml))throw new Error("WebNN is not supported in current environment");if(e==="webgpu"&&ir().webgpuInit(s=>{t.webgpu.device=s}),e==="webnn"){let s=new(Fye(),qk(qH)).WebNNBackend(t);ir().webnnInit([s,()=>s.reserveTensorId(),a=>s.releaseTensorId(a),async(a,o,l,c,u)=>s.ensureTensor(a,o,l,c,u),(a,o)=>{s.uploadTensor(a,o)},async(a,o)=>s.downloadTensor(a,o),(a,o)=>s.registerMLContext(a,o),!!t.trace])}},Kd=new Map,b8=t=>{let e=ir(),n=e.stackSave();try{let r=e.PTR_SIZE,i=e.stackAlloc(2*r);e._OrtGetInputOutputCount(t,i,i+r)!==0&&zn("Can't get session input/output count.");let s=r===4?"i32":"i64";return[Number(e.getValue(i,s)),Number(e.getValue(i+r,s))]}finally{e.stackRestore(n)}},B5=(t,e)=>{let n=ir(),r=n.stackSave(),i=0;try{let s=n.PTR_SIZE,a=n.stackAlloc(2*s);n._OrtGetInputOutputMetadata(t,e,a,a+s)!==0&&zn("Can't get session input/output metadata.");let o=Number(n.getValue(a,"*"));i=Number(n.getValue(a+s,"*"));let l=n.HEAP32[i/4];if(l===0)return[o,0];let c=n.HEAPU32[i/4+1],u=[];for(let d=0;d<c;d++){let f=Number(n.getValue(i+8+d*s,"*"));u.push(f!==0?n.UTF8ToString(f):Number(n.getValue(i+8+(d+c)*s,"*")))}return[o,l,u]}finally{n.stackRestore(r),i!==0&&n._OrtFree(i)}},Kk=t=>{let e=ir(),n=e._malloc(t.byteLength);if(n===0)throw new Error(`Can't create a session. failed to allocate a buffer of size ${t.byteLength}.`);return e.HEAPU8.set(t,n),[n,t.byteLength]},bI=async(t,e)=>{var d,f,h,p;let n,r,i=ir();Array.isArray(t)?[n,r]=t:t.buffer===i.HEAPU8.buffer?[n,r]=[t.byteOffset,t.byteLength]:[n,r]=Kk(t);let s=0,a=0,o=0,l=[],c=[],u=[];try{if([a,l]=await jH(e),(e==null?void 0:e.externalData)&&i.mountExternalData){let L=[];for(let M of e.externalData){let B=typeof M=="string"?M:M.path;L.push(yI(typeof M=="string"?M:M.data).then(R=>{i.mountExternalData(B,R)}))}await Promise.all(L)}for(let L of(e==null?void 0:e.executionProviders)??[])if((typeof L=="string"?L:L.name)==="webnn"){if(i.shouldTransferToMLTensor=!1,typeof L!="string"){let M=L,B=M==null?void 0:M.context,R=M==null?void 0:M.gpuDevice,j=M==null?void 0:M.deviceType,$=M==null?void 0:M.powerPreference;B?i.currentContext=B:R?i.currentContext=await i.webnnCreateMLContext(R):i.currentContext=await i.webnnCreateMLContext({deviceType:j,powerPreference:$})}else i.currentContext=await i.webnnCreateMLContext();break}s=await i._OrtCreateSession(n,r,a),(d=i.webgpuOnCreateSession)==null||d.call(i,s),s===0&&zn("Can't create a session."),(f=i.jsepOnCreateSession)==null||f.call(i),i.currentContext&&(i.webnnRegisterMLContext(s,i.currentContext),i.currentContext=void 0,i.shouldTransferToMLTensor=!0);let[m,g]=b8(s),v=!!(e!=null&&e.enableGraphCapture),_=[],b=[],x=[],T=[],N=[];for(let L=0;L<m;L++){let[M,B,R]=B5(s,L);M===0&&zn("Can't get an input name."),c.push(M);let j=i.UTF8ToString(M);_.push(j),x.push(B===0?{name:j,isTensor:!1}:{name:j,isTensor:!0,type:mx(B),shape:R})}for(let L=0;L<g;L++){let[M,B,R]=B5(s,L+m);M===0&&zn("Can't get an output name."),u.push(M);let j=i.UTF8ToString(M);b.push(j),T.push(B===0?{name:j,isTensor:!1}:{name:j,isTensor:!0,type:mx(B),shape:R});{if(v&&(e==null?void 0:e.preferredOutputLocation)===void 0){N.push("gpu-buffer");continue}let $=typeof(e==null?void 0:e.preferredOutputLocation)=="string"?e.preferredOutputLocation:((h=e==null?void 0:e.preferredOutputLocation)==null?void 0:h[j])??"cpu",U=i.webnnIsGraphOutput;if($==="cpu"&&U&&U(s,j)){N.push("ml-tensor-cpu-output");continue}if($!=="cpu"&&$!=="cpu-pinned"&&$!=="gpu-buffer"&&$!=="ml-tensor")throw new Error(`Not supported preferred output location: ${$}.`);if(v&&$!=="gpu-buffer")throw new Error(`Not supported preferred output location: ${$}. Only 'gpu-buffer' location is supported when enableGraphCapture is true.`);N.push($)}}let A=null;return N.some(L=>L==="gpu-buffer"||L==="ml-tensor"||L==="ml-tensor-cpu-output")&&(o=i._OrtCreateBinding(s),o===0&&zn("Can't create IO binding."),A={handle:o,outputPreferredLocations:N,outputPreferredLocationsEncoded:N.map(L=>L==="ml-tensor-cpu-output"?"ml-tensor":L).map(L=>qM(L))}),Kd.set(s,[s,c,u,A,v,!1]),[s,_,b,x,T]}
vendor: 3,600 bytes, line 501
501catch(m){throw c.forEach(g=>i._OrtFree(g)),u.forEach(g=>i._OrtFree(g)),o!==0&&i._OrtReleaseBinding(o)!==0&&zn("Can't release IO binding."),s!==0&&i._OrtReleaseSession(s)!==0&&zn("Can't release session."),m}finally{i._free(n),a!==0&&i._OrtReleaseSessionOptions(a)!==0&&zn("Can't release session options."),l.forEach(m=>i._free(m)),(p=i.unmountExternalData)==null||p.call(i)}},xI=t=>{var l,c,u;let e=ir(),n=Kd.get(t);if(!n)throw new Error(`cannot release session. invalid session id: ${t}`);let[r,i,s,a,o]=n;a&&(o&&e._OrtClearBoundOutputs(a.handle)!==0&&zn("Can't clear bound outputs."),e._OrtReleaseBinding(a.handle)!==0&&zn("Can't release IO binding.")),(l=e.jsepOnReleaseSession)==null||l.call(e,t),(c=e.webnnOnReleaseSession)==null||c.call(e,t),(u=e.webgpuOnReleaseSession)==null||u.call(e,t),i.forEach(d=>e._OrtFree(d)),s.forEach(d=>e._OrtFree(d)),e._OrtReleaseSession(r)!==0&&zn("Can't release session."),Kd.delete(t)},U5=async(t,e,n,r,i,s,a=!1)=>{if(!t){e.push(0);return}let o=ir(),l=o.PTR_SIZE,c=t[0],u=t[1],d=t[3],f=d,h,p;if(c==="string"&&(d==="gpu-buffer"||d==="ml-tensor"))throw new Error("String tensor is not supported on GPU.");if(a&&d!=="gpu-buffer")throw new Error(`External buffer must be provided for input/output index ${s} when enableGraphCapture is true.`);if(d==="gpu-buffer"){let v=t[2].gpuBuffer;p=mg(tp(c),u);{let _=o.webgpuRegisterBuffer;if(!_)throw new Error('Tensor location "gpu-buffer" is not supported without using WebGPU.');h=_(v,r)}}else if(d==="ml-tensor"){let v=t[2].mlTensor;p=mg(tp(c),u);let _=o.webnnRegisterMLTensor;if(!_)throw new Error('Tensor location "ml-tensor" is not supported without using WebNN.');h=_(r,v,tp(c),u)}else{let v=t[2];if(Array.isArray(v)){p=l*v.length,h=o._malloc(p),n.push(h);for(let _=0;_<v.length;_++){if(typeof v[_]!="string")throw new TypeError(`tensor data at index ${_} is not a string`);o.setValue(h+_*l,mo(v[_],n),"*")}}else{let _=o.webnnIsGraphInput,b=o.webnnIsGraphOutput;if(c!=="string"&&_&&b){let x=o.UTF8ToString(i);if(_(r,x)||b(r,x)){let T=tp(c);p=mg(T,u),f="ml-tensor";let N=o.webnnCreateTemporaryTensor,A=o.webnnUploadTensor;if(!N||!A)throw new Error('Tensor location "ml-tensor" is not supported without using WebNN.');let L=await N(r,T,u);A(L,new Uint8Array(v.buffer,v.byteOffset,v.byteLength)),h=L}else p=v.byteLength,h=o._malloc(p),n.push(h),o.HEAPU8.set(new Uint8Array(v.buffer,v.byteOffset,p),h)}else p=v.byteLength,h=o._malloc(p),n.push(h),o.HEAPU8.set(new Uint8Array(v.buffer,v.byteOffset,p),h)}}let m=o.stackSave(),g=o.stackAlloc(4*u.length);try{u.forEach((_,b)=>o.setValue(g+b*l,_,l===4?"i32":"i64"));let v=o._OrtCreateTensor(tp(c),h,p,g,u.length,qM(f));v===0&&zn(`Can't create tensor for input/output. session=${r}, index=${s}.`),e.push(v)}finally{o.stackRestore(m)}},kI=async(t,e,n,r,i,s)=>{var j,$,U,te;let a=ir(),o=a.PTR_SIZE,l=Kd.get(t);if(!l)throw new Error(`cannot run inference. invalid session id: ${t}`);let c=l[0],u=l[1],d=l[2],f=l[3],h=l[4],p=l[5],m=e.length,g=r.length,v=0,_=[],b=[],x=[],T=[],N=[],A=a.stackSave(),L=a.stackAlloc(m*o),M=a.stackAlloc(m*o),B=a.stackAlloc(g*o),R=a.stackAlloc(g*o);try{[v,_]=FH(s),jh("wasm prepareInputOutputTensor");for(let q=0;q<m;q++)await U5(n[q],b,T,t,u[e[q]],e[q],h);for(let q=0;q<g;q++)await U5(i[q],x,T,t,d[r[q]],m+r[q],h);Bh("wasm prepareInputOutputTensor");for(let q=0;q<m;q++)a.setValue(L+q*o,b[q],"*"),a.setValue(M+q*o,u[e[q]],"*");for(let q=0;q<g;q++)a.setValue(B+q*o,x[q],"*"),a.setValue(R+q*o,d[r[q]],"*");if(f&&!p){let{handle:q,outputPreferredLocations:se,outputPreferredLocationsEncoded:he}=f;if(u.length!==m)throw new Error(`input count from feeds (${m}
501) is expected to be always equal to model's input count (${u.length}).`);jh("wasm bindInputsOutputs");for(let z=0;z<m;z++){let J=e[z];await a._OrtBindInput(q,u[J],b[z])!==0&&zn(`Can't bind input[${z}] for session=${t}.`)}for(let z=0;z<g;z++){let J=r[z];(j=i[z])!=null&&j[3]?(N.push(x[z]),a._OrtBindOutput(q,d[J],x[z],0)!==0&&zn(`Can't bind pre-allocated output[${z}] for session=${t}.`)):a._OrtBindOutput(q,d[J],0,he[J])!==0&&zn(`Can't bind output[${z}] to ${se[z]} for session=${t}.`)}Bh("wasm bindInputsOutputs"),Kd.set(t,[c,u,d,f,h,!0])}($=a.jsepOnRunStart)==null||$.call(a,c),(U=a.webnnOnRunStart)==null||U.call(a,c);let ne;f?ne=await a._OrtRunWithBinding(c,f.handle,g,B,v):ne=await a._OrtRun(c,M,L,m,R,g,B,v),ne!==0&&zn("failed to call OrtRun().");let le=[],V=[];jh("wasm ProcessOutputTensor");for(let q=0;q<g;q++){let se=Number(a.getValue(B+q*o,"*"));if(se===x[q]||N.includes(x[q])){le.push(i[q]),se!==x[q]&&a._OrtReleaseTensor(se)!==0&&zn("Can't release tensor.");continue}let he=a.stackSave(),z=a.stackAlloc(4*o),J=!1,Y,de=0;try{a._OrtGetTensorData(se,z,z+o,z+2*o,z+3*o)!==0&&zn(`Can't access output tensor data on index ${q}.`);let fe=o===4?"i32":"i64",me=Number(a.getValue(z,fe));de=a.getValue(z+o,"*");let Ce=a.getValue(z+o*2,"*"),Ee=Number(a.getValue(z+o*3,fe)),Ae=[];for(let Re=0;Re<Ee;Re++)Ae.push(Number(a.getValue(Ce+Re*o,fe)));a._OrtFree(Ce)!==0&&zn("Can't free memory for tensor dims.");let De=Ae.reduce((Re,Je)=>Re*Je,1);Y=mx(me);let Fe=f==null?void 0:f.outputPreferredLocations[r[q]];if(Y==="string"){if(Fe==="gpu-buffer"||Fe==="ml-tensor")throw new Error("String tensor is not supported on GPU.");let Re=[];for(let Je=0;Je<De;Je++){let re=a.getValue(de+Je*o,"*"),Ye=a.getValue(de+(Je+1)*o,"*"),Mt=Je===De-1?void 0:Ye-re;Re.push(a.UTF8ToString(re,Mt))}le.push([Y,Ae,Re,"cpu"])}else if(Fe==="gpu-buffer"&&De>0){let Re=a.webgpuGetBuffer;if(!Re)throw new Error('preferredLocation "gpu-buffer" is not supported without using WebGPU.');let Je=Re(de),re=mg(me,De);if(re===void 0||!gI(Y))throw new Error(`Unsupported data type: ${Y}`);J=!0;{a.webgpuRegisterBuffer(Je,t,de);let Ye=a.webgpuCreateDownloader(Je,re,t);le.push([Y,Ae,{gpuBuffer:Je,download:async()=>{let Mt=await Ye();return new(Tw(Y))(Mt)},dispose:()=>{a._OrtReleaseTensor(se)!==0&&zn("Can't release tensor.")}},"gpu-buffer"])}}else if(Fe==="ml-tensor"&&De>0){let Re=a.webnnEnsureTensor,Je=a.webnnIsGraphInputOutputTypeSupported;if(!Re||!Je)throw new Error('preferredLocation "ml-tensor" is not supported without using WebNN.');if(mg(me,De)===void 0||!vI(Y))throw new Error(`Unsupported data type: ${Y}`);if(!Je(t,Y,!1))throw new Error(`preferredLocation "ml-tensor" for ${Y} output is not supported by current WebNN Context.`);let re=await Re(t,de,me,Ae,!1);J=!0,le.push([Y,Ae,{mlTensor:re,download:a.webnnCreateMLTensorDownloader(de,Y),dispose:()=>{a.webnnReleaseTensorId(de),a._OrtReleaseTensor(se)}},"ml-tensor"])}else if(Fe==="ml-tensor-cpu-output"&&De>0){let Re=a.webnnCreateMLTensorDownloader(de,Y)(),Je=le.length;J=!0,V.push((async()=>{let re=[Je,await Re];return a.webnnReleaseTensorId(de),a._OrtReleaseTensor(se),re})()),le.push([Y,Ae,[],"cpu"])}else{let Re=Tw(Y),Je=new Re(De);new Uint8Array(Je.buffer,Je.byteOffset,Je.byteLength).set(a.HEAPU8.subarray(de,de+Je.byteLength)),le.push([Y,Ae,Je,"cpu"])}}finally{a.stackRestore(he),Y==="string"&&de&&a._free(de),J||a._OrtReleaseTensor(se)}}f&&!h&&(a._OrtClearBoundOutputs(f.handle)!==0&&zn("Can't clear bound outputs."),Kd.set(t,[c,u,d,f,h,!1]));for(let[q,se]of await Promise.all(V))le[q][2]=se;return Bh("wasm ProcessOutputTensor"),le}finally{(te=a.webnnOnRunEnd)==null||te.call(a,c),a.stackRestore(A),n.forEach(ne=>{ne&&ne[3]==="gpu-buffer"&&a.webgpuUnregisterBuffer(ne[2].gpuBuffer)}),i.forEach(ne=>{ne&&ne[3]==="gpu-buffer"&&a.webgpuUnregisterBuffer(ne[2].gpuBuffer)}),b.forEach(ne=>a._OrtReleaseTensor(ne)),x.forEach(ne=>a._OrtReleaseTensor(ne)),T.forEach(ne=>a._free(ne)),v!==0&&a._OrtReleaseRunOptions(v),_.forEach(ne=>a._free(ne))}},SI=t=>{let e=ir(),n=Kd.get(t);if(!n)throw new Error("invalid session id");let r=n[0],i=e._OrtEndProfiling(r);i===0&&zn("Can't get an profile file name."),e._OrtFree(i)},TI=t=>{let e=[];for(let n of t){let r=n[2];!Array.isArray(r)&&"buffer"in r&&e.push(r.buffer)}return e}}),Jd,ja,Jm,xy,ky,e2,z5,t2,Bf,Uf,x8,HH,KH,JH,YH,XH,QH,ZH,eK=Sn(()=>{em(),GH(),tm(),fI(),Jd=()=>!!zr.wasm.proxy&&typeof document<"u",Jm=!1,xy=!1,ky=!1,t2=new Map,Bf=(t,e)=>{let n=t2.get(t);n?n.push(e):t2.set(t,[e])},Uf=()=>{if(Jm||!xy||ky||!ja)throw new Error("worker not ready")},x8=t=>{switch(t.data.type){case"init-wasm":Jm=!1,t.data.err?(ky=!0,z5[1](t.data.err)):(xy=!0,z5[0]()),e2&&(URL.revokeObjectURL(e2),e2=void 0);break;case"init-ep":case"copy-from":case"create":case"release":case"run":case"end-profiling":{let e=t2.get(t.data.type);t.data.err?e.shift()[1](t.data.err):e.shift()[0](t.data.out);break}}},HH=async()=>
vendor: 4,935 bytes, line 501
501{if(!xy){if(Jm)throw new Error("multiple calls to 'initWasm()' detected.");if(ky)throw new Error("previous call to 'initWasm()' failed.");if(Jm=!0,Jd())return new Promise((t,e)=>{ja==null||ja.terminate(),OH().then(([n,r])=>{try{ja=r,ja.onerror=s=>e(s),ja.onmessage=x8,z5=[t,e];let i={type:"init-wasm",in:zr};!i.in.wasm.wasmPaths&&(n||VM)&&(i.in.wasm.wasmPaths={wasm:new URL("/assets/ort-wasm-simd-threaded.asyncify-DMmc6YqF.wasm",import.meta.url).href}),ja.postMessage(i),e2=n}catch(i){e(i)}},e)});try{await pI(zr.wasm),await _I(zr),xy=!0}catch(t){throw ky=!0,t}finally{Jm=!1}}},KH=async t=>{if(Jd())return Uf(),new Promise((e,n)=>{Bf("init-ep",[e,n]);let r={type:"init-ep",in:{epName:t,env:zr}};ja.postMessage(r)});await wI(zr,t)},JH=async t=>Jd()?(Uf(),new Promise((e,n)=>{Bf("copy-from",[e,n]);let r={type:"copy-from",in:{buffer:t}};ja.postMessage(r,[t.buffer])})):Kk(t),YH=async(t,e)=>{if(Jd()){if(e!=null&&e.preferredOutputLocation)throw new Error('session option "preferredOutputLocation" is not supported for proxy.');return Uf(),new Promise((n,r)=>{Bf("create",[n,r]);let i={type:"create",in:{model:t,options:{...e}}},s=[];t instanceof Uint8Array&&s.push(t.buffer),ja.postMessage(i,s)})}else return bI(t,e)},XH=async t=>{if(Jd())return Uf(),new Promise((e,n)=>{Bf("release",[e,n]);let r={type:"release",in:t};ja.postMessage(r)});xI(t)},QH=async(t,e,n,r,i,s)=>{if(Jd()){if(n.some(a=>a[3]!=="cpu"))throw new Error("input tensor on GPU is not supported for proxy.");if(i.some(a=>a))throw new Error("pre-allocated output tensor is not supported for proxy.");return Uf(),new Promise((a,o)=>{Bf("run",[a,o]);let l=n,c={type:"run",in:{sessionId:t,inputIndices:e,inputs:l,outputIndices:r,options:s}};ja.postMessage(c,TI(l))})}else return kI(t,e,n,r,i,s)},ZH=async t=>{if(Jd())return Uf(),new Promise((e,n)=>{Bf("end-profiling",[e,n]);let r={type:"end-profiling",in:t};ja.postMessage(r)});SI(t)}}),$5,k8,tK,jye=Sn(()=>{em(),eK(),c0(),hI(),BH(),$5=(t,e)=>{switch(t.location){case"cpu":return[t.type,t.dims,t.data,"cpu"];case"gpu-buffer":return[t.type,t.dims,{gpuBuffer:t.gpuBuffer},"gpu-buffer"];case"ml-tensor":return[t.type,t.dims,{mlTensor:t.mlTensor},"ml-tensor"];default:throw new Error(`invalid data location: ${t.location} for ${e()}`)}},k8=t=>{switch(t[3]){case"cpu":return new Ul(t[0],t[2],t[1]);case"gpu-buffer":{let e=t[0];if(!gI(e))throw new Error(`not supported data type: ${e} for deserializing GPU tensor`);let{gpuBuffer:n,download:r,dispose:i}=t[2];return Ul.fromGpuBuffer(n,{dataType:e,dims:t[1],download:r,dispose:i})}case"ml-tensor":{let e=t[0];if(!vI(e))throw new Error(`not supported data type: ${e} for deserializing MLTensor tensor`);let{mlTensor:n,download:r,dispose:i}=t[2];return Ul.fromMLTensor(n,{dataType:e,dims:t[1],download:r,dispose:i})}default:throw new Error(`invalid data location: ${t[3]}`)}},tK=class{async fetchModelAndCopyToWasmMemory(t){return JH(await yI(t))}async loadModel(t,e){zp();let n;typeof t=="string"?n=await this.fetchModelAndCopyToWasmMemory(t):n=t,[this.sessionId,this.inputNames,this.outputNames,this.inputMetadata,this.outputMetadata]=await YH(n,e),$p()}async dispose(){return XH(this.sessionId)}async run(t,e,n){zp();let r=[],i=[];Object.entries(t).forEach(d=>{let f=d[0],h=d[1],p=this.inputNames.indexOf(f);if(p===-1)throw new Error(`invalid input '${f}'`);r.push(h),i.push(p)});let s=[],a=[];Object.entries(e).forEach(d=>{let f=d[0],h=d[1],p=this.outputNames.indexOf(f);if(p===-1)throw new Error(`invalid output '${f}'`);s.push(h),a.push(p)});let o=r.map((d,f)=>$5(d,()=>`input "${this.inputNames[i[f]]}"`)),l=s.map((d,f)=>d?$5(d,()=>`output "${this.outputNames[a[f]]}"`):null),c=await QH(this.sessionId,i,o,a,l,n),u={};for(let d=0;d<c.length;d++)u[this.outputNames[a[d]]]=s[d]??k8(c[d]);return $p(),u}startProfiling(){}endProfiling(){ZH(this.sessionId)}}}),nK={};m1(nK,{OnnxruntimeWebAssemblyBackend:()=>HM,initializeFlags:()=>GM,wasmBackend:()=>rK});var GM,HM,rK,Bye=Sn(()=>{em(),eK(),jye(),GM=()=>{(typeof zr.wasm.initTimeout!="number"||zr.wasm.initTimeout<0)&&(zr.wasm.initTimeout=0);let t=zr.wasm.simd;if(typeof t!="boolean"&&t!==void 0&&t!=="fixed"&&t!=="relaxed"&&(console.warn(`Property "env.wasm.simd" is set to unknown value "${t}". Reset it to \`false\` and ignore SIMD feature checking.`),zr.wasm.simd=!1),typeof zr.wasm.proxy!="boolean"&&(zr.wasm.proxy=!1),typeof zr.wasm.trace!="boolean"&&(zr.wasm.trace=!1),typeof zr.wasm.numThreads!="number"||!Number.isInteger(zr.wasm.numThreads)||zr.wasm.numThreads<=0)if(typeof self<"u"&&!self.crossOriginIsolated)zr.wasm.numThreads=1;else{let e=typeof navigator>"u"?gye("node:os").cpus().length:navigator.hardwareConcurrency;zr.wasm.numThreads=Math.min(4,Math.ceil((e||1)/2))}},HM=class{async init(t){GM(),await HH(),await KH(t)}async createInferenceSessionHandler(t,e){let n=new tK;return await n.loadModel(t,e),n}},rK=new HM});em();em();em();var Uye="1.26.0-dev.20260416-b7804b056c",zye=PH;{let t=(Bye(),qk(nK)).wasmBackend;
501pp("webgpu",t,5),pp("webnn",t,5),pp("cpu",t,10),pp("wasm",t,10)}Object.defineProperty(zr.versions,"web",{value:Uye,enumerable:!0});const $ye=Object.freeze(Object.defineProperty({__proto__:null,get InferenceSession(){return dI},get TRACE(){return Wk},get TRACE_EVENT_BEGIN(){return jh},get TRACE_EVENT_END(){return Bh},get TRACE_FUNC_BEGIN(){return zp},get TRACE_FUNC_END(){return $p},get Tensor(){return Ul},default:zye,get env(){return zr},get registerBackend(){return pp}},Symbol.toStringTag,{value:"Module"})),Vye=(t,e)=>{const n=typeof document<"u"?document.createElement("canvas"):new OffscreenCanvas(1,1);n.width=t.dims[3],n.height=t.dims[2];const r=n.getContext("2d");if(r!=null){let i,s;(e==null?void 0:e.tensorLayout)!==void 0&&e.tensorLayout==="NHWC"?(i=t.dims[2],s=t.dims[3]):(i=t.dims[3],s=t.dims[2]);const a=(e==null?void 0:e.format)!==void 0?e.format:"RGB",o=e==null?void 0:e.norm;let l,c;o===void 0||o.mean===void 0?l=[255,255,255,255]:typeof o.mean=="number"?l=[o.mean,o.mean,o.mean,o.mean]:(l=[o.mean[0],o.mean[1],o.mean[2],0],o.mean[3]!==void 0&&(l[3]=o.mean[3])),o===void 0||o.bias===void 0?c=[0,0,0,0]:typeof o.bias=="number"?c=[o.bias,o.bias,o.bias,o.bias]:(c=[o.bias[0],o.bias[1],o.bias[2],0],o.bias[3]!==void 0&&(c[3]=o.bias[3]));const u=s*i;let d=0,f=u,h=u*2,p=-1;a==="RGBA"?(d=0,f=u,h=u*2,p=u*3):a==="RGB"?(d=0,f=u,h=u*2):a==="RBG"&&(d=0,h=u,f=u*2);for(let m=0;m<s;m++)for(let g=0;g<i;g++){const v=(t.data[d++]-c[0])*l[0],_=(t.data[f++]-c[1])*l[1],b=(t.data[h++]-c[2])*l[2],x=p===-1?255:(t.data[p++]-c[3])*l[3];r.fillStyle="rgba("+v+","+_+","+b+","+x+")",r.fillRect(g,m,1,1)}if("toDataURL"in n)return n.toDataURL();throw new Error("toDataURL is not supported")}else throw new Error("Can not access image data")},qye=(t,e)=>{const n=typeof document<"u"?document.createElement("canvas").getContext("2d"):new OffscreenCanvas(1,1).getContext("2d");let r;if(n!=null){let i,s,a;(e==null?void 0:e.tensorLayout)!==void 0&&e.tensorLayout==="NHWC"?(i=t.dims[2],s=t.dims[1],a=t.dims[3]):(i=t.dims[3],s=t.dims[2],a=t.dims[1]);const o=e!==void 0&&e.format!==void 0?e.format:"RGB",l=e==null?void 0:e.norm;let c,u;l===void 0||l.mean===void 0?c=[255,255,255,255]:typeof l.mean=="number"?c=[l.mean,l.mean,l.mean,l.mean]:(c=[l.mean[0],l.mean[1],l.mean[2],255],l.mean[3]!==void 0&&(c[3]=l.mean[3])),l===void 0||l.bias===void 0?u=[0,0,0,0]:typeof l.bias=="number"?u=[l.bias,l.bias,l.bias,l.bias]:(u=[l.bias[0],l.bias[1],l.bias[2],0],l.bias[3]!==void 0&&(u[3]=l.bias[3]));const d=s*i;if(e!==void 0&&(e.format!==void 0&&a===4&&e.format!=="RGBA"||a===3&&e.format!=="RGB"&&e.format!=="BGR"))throw new Error("Tensor format doesn't match input tensor dims");const f=4;let h=0,p=1,m=2,g=3,v=0,_=d,b=d*2,x=-1;o==="RGBA"?(v=0,_=d,b=d*2,x=d*3):o==="RGB"?(v=0,_=d,b=d*2):o==="RBG"&&(v=0,b=d,_=d*2),r=n.createImageData(i,s);for(let T=0;T<s*i;h+=f,p+=f,m+=f,g+=f,T++)r.data[h]=(t.data[v++]-u[0])*c[0],r.data[p]=(t.data[_++]-u[1])*c[1],r.data[m]=(t.data[b++]-u[2])*c[2],r.data[g]=x===-1?255:(t.data[x++]-u[3])*c[3]}else throw new Error("Can not access image data");return r},V5=(t,e)=>{if(t===void 0)throw new Error("Image buffer must be defined");if(e.height===void 0||e.width===void 0)throw new Error("Image height and width must be defined");if(e.tensorLayout==="NHWC")throw new Error("NHWC Tensor layout is not supported yet");const{height:n,width:r}=e,i=e.norm??{mean:255,bias:0};let s,a;typeof i.mean=="number"?s=[i.mean,i.mean,i.mean,i.mean]:s=[i.mean[0],i.mean[1],i.mean[2],i.mean[3]??255],typeof i.bias=="number"?a=[i.bias,i.bias,i.bias,i.bias]:a=[i.bias[0],i.bias[1],i.bias[2],i.bias[3]??0];const o=e.format!==void 0?e.format:"RGBA",l=e.tensorFormat!==void 0&&e.tensorFormat!==void 0?e.tensorFormat:"RGB",c=n*r,u=l==="RGBA"?new Float32Array(c*4):new Float32Array(c*3);let d=4,f=0,h=1,p=2,m=3,g=0,v=c,_=c*2,b=-1;o==="RGB"&&(d=3,f=0,h=1,p=2,m=-1),l==="RGBA"?b=c*3:l==="RBG"?(g=0,_=c,v=c*2):l==="BGR"&&(_=0,v=c,g=c*2);for(let T=0;T<c;T++,f+=d,p+=d,h+=d,m+=d)u[g++]=(t[f]+a[0])/s[0],u[v++]=(t[h]+a[1])/s[1],u[_++]=(t[p]+a[2])/s[2],b!==-1&&m!==-1&&(u[b++]=(t[m]+a[3])/s[3]);return l==="RGBA"?new Yo("float32",u,[1,4,n,r]):new Yo("float32",u,[1,3,n,r])},Wye=async(t,e)=>{const n=typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement,r=typeof ImageData<"u"&&t instanceof ImageData,i=typeof ImageBitmap<"u"&&t instanceof ImageBitmap,s=typeof t=="string";let a,o=e??{};const l=()=>{if(typeof document<"u")return document.createElement("canvas");if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(1,1);throw new Error("Canvas is not supported")},c=u=>typeof HTMLCanvasElement<"u"&&u instanceof HTMLCanvasElement||u instanceof OffscreenCanvas?u.getContext("2d"):null;if(n){const u=l();u.width=t.width,u.height=t.height;const d=c(u);if(d!=null){let f=t.height,h=t.width;if(e!==void 0&&e.resizedHeight!==void 0&&e.resizedWidth!==void 0&&(f=e.resizedHeight,h=e.resizedWidth),e!==void 0){if(o=e,e.tensorFormat!==void 0)throw new Error("Image input config format must be RGBA for HTMLImageElement");o.tensorFormat="RGBA",o.height=f,o.width=h}else o.tensorFormat="RGBA",o.height=f,o.width=h;d.drawImage(t,0,0),a=d.getImageData(0,0,h,f).data}else throw new Error("Can not access image data")}else if(r){let u,d;if(e!==void 0&&e.resizedWidth!==void 0&&e.resizedHeight!==void 0?(u=e.resizedHeight,d=e.resizedWidth):(u=t.height,d=t.width),e!==void 0&&(o=e),o.format="RGBA",o.height=u,o.width=d,e!==void 0){const f=l();f.width=d,f.height=u;const h=c(f);if(h!=null)h.putImageData(t,0,0),a=h.getImageData(0,0,d,u).data;else throw new Error("Can not access image data")}else a=t.data}else if(i){if(e===void 0)throw new Error("Please provide image config with format for Imagebitmap");const u=l();u.width=t.width,u.height=t.height;const d=c(u);if(d!=null){const f=t.height,h=t.width;return d.drawImage(t,0,0,h,f),a=d.getImageData(0,0,h,f).data,o.height=f,o.width=h,V5(a,o)}else throw new Error("Can not access image data")}else{if(s)return new Promise((u,d)=>{const f=l(),h=c(f);if(!t||!h)return d();const p=new Image;p.crossOrigin="Anonymous",p.src=t,p.onload=()=>{f.width=p.width,f.height=p.height,h.drawImage(p,0,0,f.width,f.height);const m=h.getImageData(0,0,f.width,f.height);o.height=f.height,o.width=f.width,u(V5(m.data,o))}});throw new Error("Input data provided is not supported - aborted tensor creation")}if(a!==void 0)return V5(a,o);throw new Error("Input data provided is not supported - aborted tensor creation")},Gye=(t,e)=>{const{width:n,height:r,download:i,dispose:s}=e,a=[1,r,n,4];return new Yo({location:"texture",type:"float32",texture:t,dims:a,download:i,dispose:s})},Hye=(t,e)=>{const{dataType:n,dims:r,download:i,dispose:s}=e;return new Yo({location:"gpu-buffer",type:n??"float32",gpuBuffer:t,dims:r,download:i,dispose:s})},Kye=(t,e)=>{const{dataType:n,dims:r,download:i,dispose:s}=e;return new Yo({location:"ml-tensor",type:n??"float32",mlTensor:t,dims:r,download:i,dispose:s})},Jye=(t,e,n)=>new Yo({location:"cpu-pinned",type:t,data:e,dims:n??[e.length]}),Og=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array
vendor: 6,922 bytes, line 501
501],["uint32",Uint32Array],["int4",Uint8Array],["uint4",Uint8Array]]),gx=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]);let S8=!1;const Yye=()=>{if(!S8){S8=!0;const t=typeof BigInt64Array<"u"&&BigInt64Array.from,e=typeof BigUint64Array<"u"&&BigUint64Array.from,n=globalThis.Float16Array,r=typeof n<"u"&&n.from;t&&(Og.set("int64",BigInt64Array),gx.set(BigInt64Array,"int64")),e&&(Og.set("uint64",BigUint64Array),gx.set(BigUint64Array,"uint64")),r?(Og.set("float16",n),gx.set(n,"float16")):Og.set("float16",Uint16Array)}},Xye=t=>{let e=1;for(let n=0;n<t.length;n++){const r=t[n];if(typeof r!="number"||!Number.isSafeInteger(r))throw new TypeError(`dims[${n}] must be an integer, got: ${r}`);if(r<0)throw new RangeError(`dims[${n}] must be a non-negative integer, got: ${r}`);e*=r}return e},Qye=(t,e)=>{switch(t.location){case"cpu":return new Yo(t.type,t.data,e);case"cpu-pinned":return new Yo({location:"cpu-pinned",data:t.data,type:t.type,dims:e});case"texture":return new Yo({location:"texture",texture:t.texture,type:t.type,dims:e});case"gpu-buffer":return new Yo({location:"gpu-buffer",gpuBuffer:t.gpuBuffer,type:t.type,dims:e});case"ml-tensor":return new Yo({location:"ml-tensor",mlTensor:t.mlTensor,type:t.type,dims:e});default:throw new Error(`tensorReshape: tensor location ${t.location} is not supported`)}};let Yo=class{constructor(e,n,r){Yye();let i,s;if(typeof e=="object"&&"location"in e)switch(this.dataLocation=e.location,i=e.type,s=e.dims,e.location){case"cpu-pinned":{const o=Og.get(i);if(!o)throw new TypeError(`unsupported type "${i}" to create tensor from pinned buffer`);if(!(e.data instanceof o))throw new TypeError(`buffer should be of type ${o.name}`);this.cpuData=e.data;break}case"texture":{if(i!=="float32")throw new TypeError(`unsupported type "${i}" to create tensor from texture`);this.gpuTextureData=e.texture,this.downloader=e.download,this.disposer=e.dispose;break}case"gpu-buffer":{if(i!=="float32"&&i!=="float16"&&i!=="int32"&&i!=="int64"&&i!=="uint32"&&i!=="uint8"&&i!=="bool"&&i!=="uint4"&&i!=="int4")throw new TypeError(`unsupported type "${i}" to create tensor from gpu buffer`);this.gpuBufferData=e.gpuBuffer,this.downloader=e.download,this.disposer=e.dispose;break}case"ml-tensor":{if(i!=="float32"&&i!=="float16"&&i!=="int32"&&i!=="int64"&&i!=="uint32"&&i!=="uint64"&&i!=="int8"&&i!=="uint8"&&i!=="bool"&&i!=="uint4"&&i!=="int4")throw new TypeError(`unsupported type "${i}" to create tensor from MLTensor`);this.mlTensorData=e.mlTensor,this.downloader=e.download,this.disposer=e.dispose;break}default:throw new Error(`Tensor constructor: unsupported location '${this.dataLocation}'`)}else{let o,l;if(typeof e=="string")if(i=e,l=r,e==="string"){if(!Array.isArray(n))throw new TypeError("A string tensor's data must be a string array.");o=n}else{const c=Og.get(e);if(c===void 0)throw new TypeError(`Unsupported tensor type: ${e}.`);if(Array.isArray(n)){if(e==="float16"&&c===Uint16Array||e==="uint4"||e==="int4")throw new TypeError(`Creating a ${e} tensor from number array is not supported. Please use ${c.name} as data.`);e==="uint64"||e==="int64"?o=c.from(n,BigInt):o=c.from(n)}else if(n instanceof c)o=n;else if(n instanceof Uint8ClampedArray)if(e==="uint8")o=Uint8Array.from(n);else throw new TypeError("A Uint8ClampedArray tensor's data must be type of uint8");else if(e==="float16"&&n instanceof Uint16Array&&c!==Uint16Array)o=new globalThis.Float16Array(n.buffer,n.byteOffset,n.length);else throw new TypeError(`A ${i} tensor's data must be type of ${c}`)}else if(l=n,Array.isArray(e)){if(e.length===0)throw new TypeError("Tensor type cannot be inferred from an empty array.");const c=typeof e[0];if(c==="string")i="string",o=e;else if(c==="boolean")i="bool",o=Uint8Array.from(e);else throw new TypeError(`Invalid element type of data array: ${c}.`)}else if(e instanceof Uint8ClampedArray)i="uint8",o=Uint8Array.from(e);else{const c=gx.get(e.constructor);if(c===void 0)throw new TypeError(`Unsupported type for tensor data: ${e.constructor}.`);i=c,o=e}if(l===void 0)l=[o.length];else if(!Array.isArray(l))throw new TypeError("A tensor's dims must be a number array");s=l,this.cpuData=o,this.dataLocation="cpu"}const a=Xye(s);if(this.cpuData&&a!==this.cpuData.length&&!((i==="uint4"||i==="int4")&&Math.ceil(a/2)===this.cpuData.length))throw new Error(`Tensor's size(${a}) does not match data length(${this.cpuData.length}).`);this.type=i,this.dims=s,this.size=a}static async fromImage(e,n){return Wye(e,n)}static fromTexture(e,n){return Gye(e,n)}static fromGpuBuffer(e,n){return Hye(e,n)}static fromMLTensor(e,n){return Kye(e,n)}static fromPinnedBuffer(e,n,r){return Jye(e,n,r)}toDataURL(e){return Vye(this,e)}toImageData(e){return qye(this,e)}get data(){if(this.ensureValid(),!this.cpuData)throw new Error("The data is not on CPU. Use `getData()` to download GPU data to CPU, or use `texture` or `gpuBuffer` property to access the GPU data directly.");return this.cpuData}get location(){return this.dataLocation}get texture(){if(this.ensureValid(),!this.gpuTextureData)throw new Error("The data is not stored as a WebGL texture.");return this.gpuTextureData}get gpuBuffer(){if(this.ensureValid(),!this.gpuBufferData)throw new Error("The data is not stored as a WebGPU buffer.");return this.gpuBufferData}get mlTensor(){if(this.ensureValid(),!this.mlTensorData)throw new Error("The data is not stored as a WebNN MLTensor.");return this.mlTensorData}async getData(e){switch(this.ensureValid(),this.dataLocation){case"cpu":case"cpu-pinned":return this.data;case"texture":case"gpu-buffer":case"ml-tensor":{if(!this.downloader)throw new Error("The current tensor is not created with a specified data downloader.");if(this.isDownloading)throw new Error("The current tensor is being downloaded.");try{this.isDownloading=!0;const n=await this.downloader();return this.downloader=void 0,this.dataLocation="cpu",this.cpuData=n,e&&this.disposer&&(this.disposer(),this.disposer=void 0),n}finally{this.isDownloading=!1}}default:throw new Error(`cannot get data from location: ${this.dataLocation}`)}}dispose(){if(this.isDownloading)throw new Error("The current tensor is being downloaded.");this.disposer&&(this.disposer(),this.disposer=void 0),this.cpuData=void 0,this.gpuTextureData=void 0,this.gpuBufferData=void 0,this.mlTensorData=void 0,this.downloader=void 0,this.isDownloading=void 0,this.dataLocation="none"}ensureValid(){if(this.dataLocation==="none")throw new Error("The tensor is disposed.")}reshape(e){if(this.ensureValid(),this.downloader||this.disposer)throw new Error("Cannot reshape a tensor that owns GPU resource.");return Qye(this,e)}};const Zye=Yo;var Du={},e_e=Object.defineProperty,u0=(t,e)=>{for(var n in e)e_e(t,n,{get:e[n],enumerable:!0})},yo={},Gc={},t_e={},n_e="4.2.0",CI=typeof self<"u",Qg=!oK(yo),iK=!oK(Gc),Jk=CI&&"cac
501hes"in self,r_e=typeof globalThis.Deno<"u",yT=r_e&&Jk&&!Qg,sK=typeof process<"u",Jz,aK=sK&&((Jz=process==null?void 0:process.release)==null?void 0:Jz.name)==="node"&&!yT,EI=typeof window<"u"&&typeof window.document<"u",Yz,AI=CI&&["DedicatedWorkerGlobalScope","ServiceWorkerGlobalScope","SharedWorkerGlobalScope"].includes((Yz=self.constructor)==null?void 0:Yz.name),i_e=EI||AI||yT,s_e=aK||typeof navigator<"u"&&"gpu"in navigator,a_e=typeof navigator<"u"&&"ml"in navigator,o_e=typeof crypto<"u"&&typeof crypto.getRandomValues=="function",l_e=typeof chrome<"u"&&typeof chrome.runtime<"u"&&typeof chrome.runtime.id=="string",c_e=typeof ServiceWorkerGlobalScope<"u"&&CI&&self instanceof ServiceWorkerGlobalScope,u_e=()=>{if(typeof navigator>"u")return!1;const t=navigator.userAgent,n=(navigator.vendor||"").indexOf("Apple")>-1,r=!t.match(/CriOS|FxiOS|EdgiOS|OPiOS|mercury|brave/i)&&!t.includes("Chrome")&&!t.includes("Android");return n&&r},d_e=u_e(),vn=Object.freeze({IS_BROWSER_ENV:EI,IS_WEBWORKER_ENV:AI,IS_WEB_ENV:i_e,IS_SERVICE_WORKER_ENV:c_e,IS_DENO_WEB_RUNTIME:yT,IS_WEB_CACHE_AVAILABLE:Jk,IS_WEBGPU_AVAILABLE:s_e,IS_WEBNN_AVAILABLE:a_e,IS_SAFARI:d_e,IS_PROCESS_AVAILABLE:sK,IS_NODE_ENV:aK,IS_FS_AVAILABLE:Qg,IS_PATH_AVAILABLE:iK,IS_CRYPTO_AVAILABLE:o_e,IS_CHROME_AVAILABLE:l_e}),PI=Qg&&iK,Yk="./";if(PI){const t=Object(import.meta).url;t?Yk=Gc.dirname(Gc.dirname(t_e.fileURLToPath(t))):typeof __dirname<"u"&&(Yk=Gc.dirname(__dirname))}var h_e=PI?Gc.join(Yk,"/.cache/"):null,T8="/models/",f_e=PI?Gc.join(Yk,T8):T8,p_e=typeof globalThis.fetch=="function"?globalThis.fetch.bind(globalThis):void 0,Hl=Object.freeze({DEBUG:10,INFO:20,WARNING:30,ERROR:40,NONE:50}),C8=Hl.WARNING,On={version:n_e,backends:{onnx:{}},get logLevel(){return C8},set logLevel(t){var e,n;C8=t,(n=(e=On.backends.onnx)==null?void 0:e.setLogLevel)==null||n.call(e,t)},allowRemoteModels:!0,remoteHost:"https://huggingface.co/",remotePathTemplate:"{model}/resolve/{revision}/",allowLocalModels:!(EI||AI||yT),localModelPath:f_e,useFS:Qg,useBrowserCache:Jk,useFSCache:Qg,cacheDir:h_e,useCustomCache:!1,customCache:null,useWasmCache:Jk||Qg,cacheKey:"transformers-cache",experimental_useCrossOriginStorage:!1,fetch:p_e};function oK(t){return Object.keys(t).length===0}var Qa=class{constructor(){let t=function(...e){return t._call(...e)};return Object.setPrototypeOf(t,new.target.prototype)}_call(...t){throw Error("Must implement _call method in subclass")}};function hh(t,e){t&&t(e)}var KM=class extends Qa{constructor(t,e){super(),this.callback=t,this.files_loading=e}_call(t){if(t.status==="progress"){this.files_loading[t.file]={loaded:t.loaded,total:t.total};const e=Object.values(this.files_loading).reduce((i,s)=>i+s.loaded,0),n=Object.values(this.files_loading).reduce((i,s)=>i+s.total,0),r=n>0?e/n*100:0;this.callback({status:"progress_total",name:t.name,progress:r,loaded:e,total:n,files:structuredClone(this.files_loading)})}this.callback(t)}};function m_e(t){return Number.isInteger(t)||typeof t=="bigint"}function E8(t){return t==null||t===-1}function A8(t){const e=[];let n=t;for(;Array.isArray(n);)e.push(n.length),n=n[0];return e}function Hc(...t){return Array.prototype.concat.apply([],t)}function g_e(...t){return t.reduce((e,n)=>e.flatMap(r=>n.map(i=>[r,i])))}function Xk(t,e){return Math.abs((t+e)%(2*e)-e)}function us(t,e){return Object.assign({},...e.map(n=>{if(t[n]!==void 0)return{[n]:t[n]}}))}function v_e(t,e){let n=0;for(const r of t)r===e&&++n;return n}var en={error(...t){On.logLevel<=Hl.ERROR&&console.error(...t)},warn(...t){On.logLevel<=Hl.WARNING&&console.warn(...t)},info(...t){On.logLevel<=Hl.INFO&&console.log(...t)},debug(...t){On.logLevel<=Hl.DEBUG&&console.log(...t)},log(...t){this.info(...t)}},y_e=class{constructor(t){this.trie=this._build_trie(t)}_build_trie(t){const e=Object.create(null);for(const n of t){let r=e;for(let i=0;i<n.length;++i){const s=n[i];r=r[s]??(r[s]=Object.create(null))}r.end=n}return e}split(t){const e=[],n=t.length;let r=0,i=0;for(;i<n;){let s=this.trie,a=null,o=i;for(;o<n&&(s=s[t[o]]);)s.end&&(a=s.end),++o;a?(i>r&&e.push(t.slice(r,i)),e.push(a),i+=a.length,r=i):++i}return r<n&&e.push(t.slice(r)),e}},P8=y_e,__e=class{constructor(t){this.content=t.content,this.id=t.id,this.single_word=t.single_word??!1,this.lstrip=t.lstrip??!1,this.rstrip=t.rstrip??!1,this.special=t.special??!1,this.normalized=t.normalized??!this.special}},w_e=__e,lK=(()=>{const t=[...Array.from({length:94},(i,s)=>s+33),...Array.from({length:12},(i,s)=>s+161),...Array.from({length:82},(i,s)=>s+174)],e=t.slice();let n=0;for(let i=0;i<256;++i)t.includes(i)||(t.push(i),e.push(256+n),n+=1);const r=e.map(i=>String.fromCharCode(i));return Object.fromEntries(t.map((i,s)=>[i,r[s]]))})(),b_e=t=>Object.fromEntries(Object.entries(t).map(([e,n])=>[n,e])),x_e=b_e(lK),M8=".,!?â¦ãï¼ãà¥¤ÛØ",k_e=new Map([["(?i:'s|'t|'re|'ve|'m|'ll|'d)","(?:'([sS]|[tT]|[rR][eE]|[vV][eE]|[mM]|[lL][lL]|[dD]))"],["(?i:[sdmt]|ll|ve|re)","(?:[sS]|[dD]|[mM]|[tT]|[lL][lL]|[v
501V][eE]|[rR][eE])"],["[^\\r\\n\\p{L}\\p{N}]?+","[^\\r\\n\\p{L}\\p{N}]?"],["[^\\s\\p{L}\\p{N}]++","[^\\s\\p{L}\\p{N}]+"],["(?>\\p{Nd}{510})","(?:\\p{Nd}{510})"],["\\p{Nd}{3}+","(?:\\p{Nd}{3})+"],["\\G",""],[` ?[^(\\s|[${M8}])]+`,` ?[^\\s${M8}]+`]]),Qk="\\p{P}\\u0021-\\u002F\\u003A-\\u0040\\u005B-\\u0060\\u007B-\\u007E",MI=t=>t.replace(/ \./g,".").replace(/ \?/g,"?").replace(/ \!/g,"!").replace(/ ,/g,",").replace(/ \' /g,"'").replace(/ n't/g,"n't").replace(/ 'm/g,"'m").replace(/ 's/g,"'s").replace(/ 've/g,"'ve").replace(/ 're/g,"'re"),_T=(t,e=!0)=>{if(t.Regex!==void 0){let n=t.Regex.replace(/\\([#&~])/g,"$1");n=n.replace(/\\A/g,"^").replace(/\\z/g,"$").replace(/\\Z/g,"(?=\\r?\\n?$)");for(const[r,i]of k_e)n=n.replaceAll(r,i);try{return new RegExp(n,"gu")}catch(r){if(!(r instanceof SyntaxError)||!r.message.toLowerCase().includes("invalid property name"))throw r;let i=!1;const s=n.replace(/(\\[pP])\{([^}=]+)\}/g,(a,o,l)=>{try{return new RegExp(`\\p{${l}}`,"u"),`${o}{${l}}`}catch{return i=!0,`${o}{Script=${l}}`}});if(!i)throw r;try{return new RegExp(s,"gu")}catch{throw r}}}else if(t.String!==void 0){const n=S_e(t.String);return new RegExp(e?n:`(${n})`,"gu")}else return console.warn("Unknown pattern type:",t),null},S_e=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),T_e=(t,e,n)=>{const r=[];let i=0;for(;i<t.length;){if(r.push(t[i]),(e.get(t[i])??n)!==n){++i;continue}for(;++i<t.length&&(e.get(t[i])??n)===n;)e.get(r.at(-1))!==n&&(r[r.length-1]+=t[i])}return r},C_e=t=>t>=19968&&t<=40959||t>=13312&&t<=19903||t>=131072&&t<=173791||t>=173824&&t<=177983||t>=177984&&t<=178207||t>=178208&&t<=183983||t>=63744&&t<=64255||t>=194560&&t<=195103,E_e=t=>Number.isInteger(t)||typeof t=="bigint",A_e=t=>{let e=0;for(const n of t)++e;return e},P_e=t=>cK(t.toLowerCase()),Kl=(...t)=>Array.prototype.concat.apply([],t),NI=t=>new Map(Object.entries(t)),M_e=(t,e)=>{const n=[];let r=0;for(const i of t.matchAll(e)){const s=i[0];r<i.index&&n.push(t.slice(r,i.index)),s.length>0&&n.push(s),r=i.index+s.length}return r<t.length&&n.push(t.slice(r)),n},cK=t=>t.replace(new RegExp("\\p{M}","gu"),""),N8=(t,e,n=[])=>{if(!t||Array.isArray(t)||typeof t!="object")return`${e} must be a valid object`;for(const r of n)if(!(r in t))return`${e} must contain a "${r}" property`;return null},N_e=t=>t.match(/\S+/g)||[],R_e=class{constructor(){const t=function(...e){return t._call(...e)};return Object.setPrototypeOf(t,new.target.prototype)}},g1=R_e,I_e=class extends g1{constructor(t){super(),this.config=t}_call(t){return this.normalize(t)}},kd=I_e,L_e=class extends kd{tokenize_chinese_chars(t){const e=[];for(let n=0;n<t.length;++n){const r=t[n],i=r.charCodeAt(0);C_e(i)?(e.push(" "),e.push(r),e.push(" ")):e.push(r)}return e.join("")}strip_accents(t){return t.normalize("NFD").replace(new RegExp("\\p{Mn}","gu"),"")}is_control(t){switch(t){case" ":case` 502`:case"\r":return!1;default:return new RegExp("^\\p{Cc}|\\p{Cf}|\\p{Co}|\\p{Cs}$","u").test(t)}}clean_text(t){const e=[];for(const n of t){const r=n.charCodeAt(0);r===0||r===65533||this.is_control(n)||(/^\s$/.test(n)?e.push(" "):e.push(n))}return e.join("")}normalize(t){return this.config.clean_text&&(t=this.clean_text(t)),this.config.handle_chinese_chars&&(t=this.tokenize_chinese_chars(t)),this.config.lowercase?(t=t.toLowerCase(),this.config.strip_accents!==!1&&(t=this.strip_accents(t))):this.config.strip_accents&&(t=this.strip_accents(t)),t}},O_e=L_e,D_e=class extends kd{constructor(t){super(t),this.charsmap=t.precompiled_charsmap??null}normalize(t){return t=t.replace(/[\u0001-\u0008\u000B\u000E-\u001F\u007F\u008F\u009F]/gm,""),t=t.replace(/[\u0009\u000A\u000C\u000D\u00A0\u1680\u2000-\u200F\u2028\u2029\u202F\u205F\u2581\u3000\uFEFF\uFFFD]/gm," "),t.includes("ï½")?t=t.split("ï½").map(n=>n.normalize("NFKC")).join("ï½"):t=t.normalize("NFKC"),t}},F_e=D_e,j_e=class extends kd{constructor(t){super(t),this.normalizers=(t.normalizers??[]).map(e=>uK(e))}normalize(t){return this.normalizers.reduce((e,n)=>n?n.normalize(e):e,t)}},B_e=j_e,U_e=class extends kd{normalize(t){const e=_T(this.config.pattern??{});return e===null?t:t.replaceAll(e,this.config.content??"")}},z_e=U_e,$_e=class extends kd{constructor(){super(...arguments),this.form="NFC"}normalize(t){return t=t.normalize(this.form),t}},wT=$_e,V_e=class extends wT{constructor(){super(...arguments),this.form="NFC"}},q_e=V_e,W_e=class extends wT{constructor(){super(...arguments),this.form="NFD"}},G_e=W_e,H_e=class extends wT{constructor(){super(...arguments),this.form="NFKC"}},K_e=H_e,J_e=class extends wT{constructor(){super(...arguments),this.form="NFKD"}},Y_e=J_e,X_e=class extends kd{normalize(t){return this.config.strip_left&&this.config.strip_right?t=t.trim():(this.config.strip_left&&(t=t.trimStart()),this.config.strip_right&&(t=t.trimEnd())),t}}
vendor: 18,964 bytes, line 502
502,Q_e=X_e,Z_e=class extends kd{normalize(t){return cK(t)}},ewe=Z_e,twe=class extends kd{normalize(t){return t.toLowerCase()}},nwe=twe,rwe=class extends kd{normalize(t){return t=this.config.prepend+t,t}},iwe=rwe;function swe(t){if(t===null)return null;switch(t.type){case"BertNormalizer":return new O_e(t);case"Precompiled":return new F_e(t);case"Sequence":return new B_e(t);case"Replace":return new z_e(t);case"NFC":return new q_e(t);case"NFD":return new G_e(t);case"NFKC":return new K_e(t);case"NFKD":return new Y_e(t);case"Strip":return new Q_e(t);case"StripAccents":return new ewe(t);case"Lowercase":return new nwe(t);case"Prepend":return new iwe(t);default:throw new Error(`Unknown Normalizer type: ${t.type}`)}}var uK=swe,awe=class extends g1{pre_tokenize(t,e){return(Array.isArray(t)?t.map(n=>this.pre_tokenize_text(n,e)):this.pre_tokenize_text(t,e)).flat()}_call(t,e){return this.pre_tokenize(t,e)}},oc=awe,owe=class extends oc{constructor(t){super(),this.config=t,this.add_prefix_space=this.config.add_prefix_space??!1,this.trim_offsets=this.config.trim_offsets??!1,this.use_regex=this.config.use_regex??!0,this.pattern=new RegExp("'s|'t|'re|'ve|'m|'ll|'d| ?\\p{L}+| ?\\p{N}+| ?[^\\s\\p{L}\\p{N}]+|\\s+(?!\\S)|\\s+","gu"),this.byte_encoder=lK,this.text_encoder=new TextEncoder}pre_tokenize_text(t,e){return this.add_prefix_space&&!t.startsWith(" ")&&(t=" "+t),(this.use_regex?t.match(this.pattern)||[]:[t]).map(r=>Array.from(this.text_encoder.encode(r),i=>this.byte_encoder[i]).join(""))}},lwe=owe,cwe=class extends oc{pre_tokenize_text(t,e){return t.match(/\w+|[^\w\s]+/g)||[]}},uwe=cwe,dwe=class extends oc{constructor(t){super(),this.replacement=t.replacement??"â",this.str_rep=t.str_rep||this.replacement,this.prepend_scheme=t.prepend_scheme??"always"}pre_tokenize_text(t,e){const{section_index:n=void 0}=e??{};let r=t.replaceAll(" ",this.str_rep);return!r.startsWith(this.replacement)&&(this.prepend_scheme==="always"||this.prepend_scheme==="first"&&n===0)&&(r=this.str_rep+r),[r]}},hwe=dwe,fwe=class extends oc{constructor(t){super(),this.config=t,this.pattern=_T(this.config.pattern??{},this.config.invert??!0)}pre_tokenize_text(t){var e;return this.pattern===null?[]:this.config.invert?t.match(this.pattern)||[]:((e=this.config.behavior)==null?void 0:e.toLowerCase())==="removed"?t.split(this.pattern).filter(n=>n):M_e(t,this.pattern)}},pwe=fwe,mwe=class extends oc{constructor(t){super(),this.config=t,this.pattern=new RegExp(`[^${Qk}]+|[${Qk}]+`,"gu")}pre_tokenize_text(t){return t.match(this.pattern)||[]}},gwe=mwe,vwe=class extends oc{constructor(t){super(),this.config=t;const e=`[^\\d]+|\\d${this.config.individual_digits?"":"+"}`;this.pattern=new RegExp(e,"gu")}pre_tokenize_text(t){return t.match(this.pattern)||[]}},ywe=vwe,_we=class extends oc{constructor(){super(),this.pattern=new RegExp(`[^\\s${Qk}]+|[${Qk}]`,"gu")}pre_tokenize_text(t,e){return t.trim().match(this.pattern)||[]}},wwe=_we,bwe=class extends oc{constructor(t){super(),this.config=t,this.pattern=_T(this.config.pattern??{}),this.content=this.config.content??""}pre_tokenize_text(t){return this.pattern===null?[t]:[t.replaceAll(this.pattern,this.config.content??"")]}},xwe=bwe,kwe=class extends oc{constructor(t){super(),this.tokenizers=(t.pretokenizers??[]).map(e=>dK(e))}pre_tokenize_text(t,e){return this.tokenizers.reduce((n,r)=>r?r.pre_tokenize(n,e):n,[t])}},Swe=kwe,Twe=class extends oc{pre_tokenize_text(t){return N_e(t)}},Cwe=Twe,Ewe=class extends oc{constructor(t){super(),this.config=t,this._length=t.length}pre_tokenize_text(t){const e=[];for(let n=0;n<t.length;n+=this._length)e.push(t.slice(n,n+this._length));return e}},Awe=Ewe;function Pwe(t){if(t===null)return null;switch(t.type){case"BertPreTokenizer":return new wwe;case"Sequence":return new Swe(t);case"Whitespace":return new uwe;case"WhitespaceSplit":return new Cwe;case"Metaspace":return new hwe(t);case"ByteLevel":return new lwe(t);case"Split":return new pwe(t);case"Punctuation":return new gwe(t);case"Digits":return new ywe(t);case"Replace":return new xwe(t);case"FixedLength":return new Awe(t);default:throw new Error(`Unknown PreTokenizer type: ${t.type}`)}}var dK=Pwe,Mwe=class extends g1{constructor(t){super(),this.config=t,this.vocab=[],this.tokens_to_ids=new Map,this.unk_token_id=void 0,this.unk_token=void 0,this.end_of_word_suffix=void 0,this.fuse_unk=this.config.fuse_unk??!1}_call(t){let e=this.encode(t);return this.fuse_unk&&(e=T_e(e,this.tokens_to_ids,this.unk_token_id)),e}},bT=Mwe,Nwe=class extends bT{constructor(t){super(t),this.max_input_chars_per_word=100,this.tokens_to_ids=NI(t.vocab),this.unk_token_id=this.tokens_to_ids.get(t.unk_token),this.unk_token=t.unk_token,this.max_input_chars_per_word=t.max_input_chars_per_word??100,this.vocab=new Array(this.tokens_to_ids.size);for(const[e,n]of this.tokens_to_ids)this.vocab[n]=e}encode(t){const e=[];for(const n of t){const r=[...n];if(r.length>this.max_input_chars_per_word){e.push(this.unk_token);continue}let i=!1,s=0;const a=[];for(;s<r.length;){let o=r.length,l=null;for(;s<o;){let c=r.slice(s,o).join("");if(s>0&&(c=this.config.continuing_subword_prefix+c),this.tokens_to_ids.has(c)){l=c;break}--o}if(l===null){i=!0;break}a.push(l),s=o}i?e.push(this.unk_token):e.push(...a)}return e}},R8=Nwe,I8=class hK{constructor(e,n){this.is_leaf=e,this.children=n}static default(){return new hK(!1,new Map)}},Rwe=class{constructor(){this.root=I8.default()}extend(t){for(const e of t)this.push(e)}push(t){let e=this.root;for(const n of t){let r=e.children.get(n);r===void 0&&(r=I8.default(),e.children.set(n,r)),e=r}e.is_leaf=!0}*common_prefix_search(t){let e=this.root;if(e===void 0)return;let n="";for(const r of t){if(n+=r,e=e.children.get(r),e===void 0)return;e.is_leaf&&(yield n)}}},Iwe=Rwe,q5=class fK{constructor(e,n,r,i,s){this.token_id=e,this.node_id=n,this.pos=r,this.length=i,this.score=s,this.prev=null,this.backtrace_score=0}clone(){const e=new fK(this.token_id,this.node_id,this.pos,this.length,this.score);return e.prev=this.prev,e.backtrace_score=this.backtrace_score,e}},Lwe=class{constructor(t,e,n){this.chars=Array.from(t),this.len=this.chars.length,this.bos_token_id=e,this.eos_token_id=n,this.nodes=[],this.begin_nodes=Array.from({length:this.len+1},()=>[]),this.end_nodes=Array.from({length:this.len+1},()=>[]);const r=new q5(this.bos_token_id??0,0,0,0,0),i=new q5(this.eos_token_id??0,1,this.len,0,0);this.nodes.push(r.clone()),this.nodes.push(i.clone()),this.begin_nodes[this.len].push(i),this.end_nodes[0].push(r)}insert(t,e,n,r){const i=this.nodes.length,s=new q5(r,i,t,e,n);this.begin_nodes[t].push(s),this.end_nodes[t+e].push(s),this.nodes.push(s)}viterbi(){const t=this.len;let e=0;for(;e<=t;){if(this.begin_nodes[e].length==0)return[];for(let a of this.begin_nodes[e]){a.prev=null;let o=0,l=null;for(let c of this.end_nodes[e]){const u=c.backtrace_score+a.score;(l===null||u>o)&&(l=c.clone(),o=u)}if(l!==null)a.prev=l,a.backtrace_score=o;else return[]}++e}const n=[],i=this.begin_nodes[t][0].prev;if(i===null)return[];let s=i.clone();for(;s.prev!==null;)n.push(s.clone()),s=s.clone().prev.clone();return n.reverse(),n}piece(t){return this.chars.slice(t.pos,t.pos+t.length).join("")}tokens(){return this.viterbi().map(e=>this.piece(e))}token_ids(){return this.viterbi().map(e=>e.token_id)}},Owe=Lwe;function Dwe(t){if(t.length===0)throw new Error("Array must not be empty");let e=t[0],n=0;for(let r=1;r<t.length;++r)t[r]<e&&(e=t[r],n=r);return[e,n]}var Fwe=class extends bT{constructor(t,e){super(t);const n=t.vocab.length;this.vocab=new Array(n),this.scores=new Array(n);for(let r=0;r<n;++r)[this.vocab[r],this.scores[r]]=t.vocab[r];this.unk_token_id=t.unk_id,this.unk_token=this.vocab[t.unk_id],this.tokens_to_ids=new Map(this.vocab.map((r,i)=>[r,i])),this.bos_token=" ",this.bos_token_id=this.tokens_to_ids.get(this.bos_token),this.eos_token=e,this.eos_token_id=this.tokens_to_ids.get(this.eos_token),this.unk_token=this.vocab[this.unk_token_id],this.min_score=Dwe(this.scores)[0],this.unk_score=this.min_score-10,this.scores[this.unk_token_id]=this.unk_score,this.trie=new Iwe,this.trie.extend(this.vocab),this.fuse_unk=!0}populate_nodes(t){const e=t.chars,n=1;let r=0;for(;r<e.length;){let i=!1;const s=e.slice(r).join(""),a=this.trie.common_prefix_search(s);for(const o of a){const l=this.tokens_to_ids.get(o),c=this.scores[l],u=A_e(o);t.insert(r,u,c,l),!i&&u===n&&(i=!0)}i||t.insert(r,n,this.unk_score,this.unk_token_id),r+=n}}tokenize(t){const e=new Owe(t,this.bos_token_id,this.eos_token_id);return this.populate_nodes(e),e.tokens()}encode(t){const e=[];for(const n of t){const r=this.tokenize(n);e.push(...r)}return e}},L8=Fwe,jwe=class{constructor(t=(n,r)=>n>r,e=1/0){this._heap=[],this._comparator=t,this._max_size=e}get size(){return this._heap.length}is_empty(){return this.size===0}peek(){return this._heap[0]}push(...t){return this.extend(t)}extend(t){for(const e of t)if(this.size<this._max_size)this._heap.push(e),this._sift_up();else{const n=this._smallest();this._comparator(e,this._heap[n])&&(this._heap[n]=e,this._sift_up_from(n))}return this.size}pop(){const t=this.peek(),e=this.size-1;return e>0&&this._swap(0,e),this._heap.pop(),this._sift_down(),t}replace(t){const e=this.peek();return this._heap[0]=t,this._sift_down(),e}_parent(t){return(t+1>>>1)-1}_left(t){return(t<<1)+1}_right(t){return t+1<<1}_greater(t,e){return this._comparator(this._heap[t],this._heap[e])}_swap(t,e){const n=this._heap[t];this._heap[t]=this._heap[e],this._heap[e]=n}_sift_up(){this._sift_up_from(this.size-1)}_sift_up_from(t){for(;t>0&&this._greater(t,this._parent(t));)this._swap(t,this._parent(t)),t=this._parent(t)}_sift_down(){let t=0;for(;this._left(t)<this.size&&this._greater(this._left(t),t)||this._right(t)<this.size&&this._greater(this._right(t),t);){const e=this._right(t)<this.size&&this._greater(this._right(t),this._left(t))?this._right(t):this._left(t);this._swap(t,e),t=e}}_smallest(){return 2**Math.floor(Math.log2(this.size))-1}},Bwe=jwe,Uwe=class{constructor(t){this.capacity=t,this.cache=new Map}get(t){if(!this.cache.has(t))return;const e=this.cache.get(t);return this.cache.delete(t),this.cache.set(t,e),e}put(t,e){this.cache.has(t)&&this.cache.delete(t),this.cache.set(t,e),this.cache.size>this.capacity&&this.cache.delete(this.cache.keys().next().value)}clear(){this.cache.clear()}},zwe=Uwe,$we=class extends bT{constructor(t){super(t),this.tokens_to_ids=NI(t.vocab),this.unk_token_id=this.tokens_to_ids.get(t.unk_token),this.unk_token=t.unk_token,this.vocab=new Array(this.tokens_to_ids.size);for(const[n,r]of this.tokens_to_ids)this.vocab[r]=n;const e=Array.isArray(t.merges[0]);this.merges=e?t.merges:t.merges.map(n=>n.split(" ",2)),this.bpe_ranks=new Map(this.merges.map((n,r)=>[JSON.stringify(n),r])),this.end_of_word_suffix=t.end_of_word_suffix,this.continuing_subword_suffix=t.continuing_subword_suffix??null,this.byte_fallback=this.config.byte_fallback??!1,this.byte_fallback&&(this.text_encoder=new TextEncoder),this.ignore_merges=this.config.ignore_merges??!1,this.max_length_to_cache=256,this.cache_capacity=1e4,this.cache=new zwe(this.cache_capacity)}clear_cache(){this.cache.clear()}bpe(t){if(t.length===0)return[];const e=this.cache.get(t);if(e!==void 0)return e;const n=Array.from(t);this.end_of_word_suffix&&(n[n.length-1]+=this.end_of_word_suffix);let r=[];if(n.length>1){const i=new Bwe((o,l)=>o.score<l.score);let s={token:n[0],bias:0,prev:null,next:null},a=s;for(let o=1;o<n.length;++o){const l={bias:o/n.length,token:n[o],prev:a,next:null};a.next=l,this.add_node(i,a),a=l}for(;!i.is_empty();){const o=i.pop();if(o.deleted||!o.next||o.next.deleted)continue;if(o.deleted=!0,o.next.deleted=!0,o.prev){const c={...o.prev};o.prev.deleted=!0,o.prev=c,c.prev?c.prev.next=c:s=c}const l={token:o.token+o.next.token,bias:o.bias,prev:o.prev,next:o.next.next};l.prev?(l.prev.next=l,this.add_node(i,l.prev)):s=l,l.next&&(l.next.prev=l,this.add_node(i,l))}for(let o=s;o!==null;o=o.next)r.push(o.token)}else r=n;if(this.continuing_subword_suffix)for(let i=0;i<r.length-1;++i)r[i]+=this.continuing_subword_suffix;return t.length<this.max_length_to_cache&&this.cache.put(t,r),r}add_node(t,e){const n=this.bpe_ranks.get(JSON.stringify([e.token,e.next.token]));n!==void 0&&(e.score=n+e.bias,t.push(e))}encode(t){const e=[];for(const n of t){if(this.ignore_merges&&this.tokens_to_ids.has(n)){e.push(n);continue}const r=this.bpe(n);for(const i of r)if(this.tokens_to_ids.has(i))e.push(i);else if(this.byte_fallback){const s=Array.from(this.text_encoder.encode(i)).map(a=>`<0x${a.toString(16).toUpperCase().padStart(2,"0")}>`);s.every(a=>this.tokens_to_ids.has(a))?e.push(...s):this.unk_token!=null&&e.push(this.unk_token)}else this.unk_token!=null&&e.push(this.unk_token)}return e}},O8=$we,Vwe=class extends bT{constructor(t,e){super(t);const n=t.vocab;this.tokens_to_ids=NI(e.target_lang?n[e.target_lang]:n),this.bos_token=e.bos_token,this.bos_token_id=this.tokens_to_ids.get(this.bos_token),this.eos_token=e.eos_token,this.eos_token_id=this.tokens_to_ids.get(this.eos_token),this.pad_token=e.pad_token,this.pad_token_id=this.tokens_to_ids.get(this.pad_token),this.unk_token=e.unk_token,this.unk_token_id=this.tokens_to_ids.get(this.unk_token),this.vocab=new Array(this.tokens_to_ids.size);for(const[r,i]of this.tokens_to_ids)this.vocab[i]=r}encode(t){return t}},qwe=Vwe;function Wwe(t,e){switch(t.type){case"WordPiece":return new R8(t);case"Unigram":return new L8(t,e.eos_token);case"BPE":return new O8(t);default:if(t.vocab)return Array.isArray(t.vocab)?new L8(t,e.eos_token):Object.hasOwn(t,"continuing_subword_prefix")&&Object.hasOwn(t,"unk_token")?Object.hasOwn(t,"merges")?new O8(t):new R8(t):new qwe(t,{target_lang:e.target_lang,bos_token:e.bos_token,eos_token:e.eos_token,pad_token:e.pad_token,unk_token:e.unk_token});throw new Error(`Unknown TokenizerModel type: ${t==null?void 0:t.type}`)}}var Gwe=Wwe,Hwe=class extends g1{constructor(t){super(),this.config=t}_call(t,...e){return this.post_process(t,...e)}},v1=Hwe,Kwe=class extends v1{post_process(t,e=null,n=!0){const r=e===null?this.config.single:this.config.pair;let i=[],s=[];for(const a of r)"SpecialToken"in a?n&&(i.push(a.SpecialToken.id),s.push(a.SpecialToken.type_id)):"Sequence"in a&&(a.Sequence.id==="A"?(i=Kl(i,t),s=Kl(s,new Array(t.length).fill(a.Sequence.type_id))):a.Sequence.id==="B"&&(i=Kl(i,e),s=Kl(s,new Array(e.length).fill(a.Sequence.type_id))));return{tokens:i,token_type_ids:s}}},Jwe=Kwe,Ywe=class extends v1{post_process(t,e=null){return{tokens:t,tokens_pair:e}}},Xwe=Ywe,Qwe=class extends v1{constructor(t){super(t),this.sep=t.sep,this.cls=t.cls}post_process(t,e=null,n=!0){n&&(t=Kl([this.cls[0]],t,[this.sep[0]]));let r=new Array(t.length).fill(0);if(e){const i=[],s=n?[this.sep[0]]:[];t=Kl(t,i,e,s),r=Kl(r,new Array(e.length+i.length+s.length).fill(1))}return{tokens:t,token_type_ids:r}}},Zwe=Qwe,e1e=class extends v1{constructor(t){super(t),this.sep=t.sep,this.cls=t.cls}post_process(t,e,n=!0){n&&(t=Kl([this.cls[0]],t,[this.sep[0]]));let r=new Array(t.length).fill(0);if(e){const i=n?[this.sep[0]]:[],s=n?[this.sep[0]]:[];t=Kl(t,i,e,s),r=Kl(r,new Array(e.length+i.length+s.length).fill(1))}return{tokens:t,token_type_ids:r}}},t1e=e1e,n1e=class extends v1{constructor(t){super(t),this.processors=(t.processors??[]).map(e=>pK(e))}post_process(t,e=null,n=!0){let r={tokens:t,tokens_pair:e};for(const i of this.processors)r=i.post_process(r.tokens,r.tokens_pair,n);return r}},r1e=n1e;function i1e(t){if(t===null)return null;switch(t.type){case"TemplateProcessing":return new Jwe(t);case"ByteLevel":return new Xwe(t);case"BertProcessing":return new Zwe(t);case"RobertaProcessing":return new t1e(t);case"Sequence":return new r1e(t);default:throw new Error(`Unknown PostProcessor type: ${t.type}`)}}var pK=i1e,s1e=class extends g1{constructor(t){super(),this.config=t,this.added_tokens=[],this.end_of_word_suffix=null,this.trim_offsets="trim_offsets"in t?t.trim_offsets:!1}_call(t){return this.decode(t)}decode(t){return this.decode_chain(t).join("")}},lc=s1e,a1e=class extends lc{constructor(t){super(t),this.byte_decoder=x_e,this.text_decoder=new TextDecoder("utf-8",{fatal:!1,ignoreBOM:!0}),this.end_of_word_suffix=null}convert_tokens_to_string(t){const e=t.join(""),n=new Uint8Array([...e].map(r=>this.byte_decoder[r]));return this.text_decoder.decode(n)}decode_chain(t){const e=[];let n=[];for(const r of t)this.added_tokens.find(i=>i.content===r)!==void 0?(n.length>0&&(e.push(this.convert_tokens_to_string(n)),n=[]),e.push(r)):n.push(r);return n.length>0&&e.push(this.convert_tokens_to_string(n)),e}},o1e=a1e,l1e=class extends lc{constructor(t){super(t),this.cleanup=t.cleanup}decode_chain(t){return t.map((e,n)=>{if(n!==0){const r=this.config.prefix;r&&e.startsWith(r)?e=e.replace(r,""):e=" "+e}return this.cleanup&&(e=MI(e)),e})}},c1e=l1e,u1e=class extends lc{constructor(t){super(t),this.replacement=t.replacement??"â"}decode_chain(t){const e=[];for(let n=0;n<t.length;++n){let r=t[n].replaceAll(this.replacement," ");n==0&&r.startsWith(" ")&&(r=r.substring(1)),e.push(r)}return e}},d1e=u1e,h1e=class extends lc{constructor(t){super(t),this.suffix=t.suffix??""}decode_chain(t){return t.map((e,n)=>e.replaceAll(this.suffix,n===t.length-1?"":" "))}},f1e=h1e,p1e=class extends lc{constructor(t){super(t),this.pad_token=t.pad_token??"",this.word_delimiter_token=t.word_delimiter_token??"",this.cleanup=t.cleanup}convert_tokens_to_string(t){if(t.length===0)return"";const e=[t[0]];for(let i=1;i<t.length;++i)t[i]!==e.at(-1)&&e.push(t[i]);let r=e.filter(i=>i!==this.pad_token).join("");return this.cleanup&&(r=MI(r).replaceAll(this.word_delimiter_token," ").trim()),r}decode_chain(t){return[this.convert_tokens_to_string(t)]}},m1e=p1e,g1e=class extends lc{constructor(t){super(t),this.decoders=(t.decoders??[]).map(e=>mK(e))}decode_chain(t){return this.decoders.reduce((e,n)=>n.decode_chain(e),t)}},v1e=g1e,y1e=class extends lc{decode_chain(t){const e=_T(this.config.pattern),n=this.config.content??"";return e===null?t:t.map(r=>r.replaceAll(e,n))}},_1e=y1e,w1e=class extends lc{decode_chain(t){return[t.join("")]}},b1e=w1e,x1e=class extends lc{constructor(t){super(t),this.content=t.content??"",this.start=t.start??0,this.stop=t.stop??0}decode_chain(t){return t.map(e=>{let n=0;for(let i=0;i<this.start&&e[i]===this.content;++i){n=i+1;continue}let r=e.length;for(let i=0;i<this.stop;++i){const s=e.length-i-1;if(e[s]===this.content){r=s;continue}else break}return e.slice(n,r)})}},k1e=x1e,S1e=class extends lc{constructor(t){super(t),this.text_decoder=new TextDecoder}decode_chain(t){const e=[];let n=[];for(const r of t){let i=null;if(r.length===6&&r.startsWith("<0x")&&r.endsWith(">")){const s=parseInt(r.slice(3,5),16);isNaN(s)||(i=s)}if(i!==null)n.push(i);else{if(n.length>0){const s=this.text_decoder.decode(Uint8Array.from(n));e.push(s),n=[]}e.push(r)}}if(n.length>0){const r=this.text_decoder.decode(Uint8Array.from(n));e.push(r),n=[]}return e}},T1e=S1e;function C1e(t){if(t===null)return null;switch(t.type){case"ByteLevel":return new o1e(t);case"WordPiece":return new c1e(t);
502case"Metaspace":return new d1e(t);case"BPEDecoder":return new f1e(t);case"CTC":return new m1e(t);case"Sequence":return new v1e(t);case"Replace":return new _1e(t);case"Fuse":return new b1e(t);case"Strip":return new k1e(t);case"ByteFallback":return new T1e(t);default:throw new Error(`Unknown Decoder type: ${t.type}`)}}var mK=C1e,E1e=class{constructor(t,e){const n=N8(t,"Tokenizer",["model","decoder","post_processor","pre_tokenizer","normalizer"]);if(n)throw new Error(n);const r=N8(e,"Config");if(r)throw new Error(r);this.tokenizer=t,this.config=e,this.normalizer=uK(this.tokenizer.normalizer),this.pre_tokenizer=dK(this.tokenizer.pre_tokenizer),this.model=Gwe(this.tokenizer.model,this.config),this.post_processor=pK(this.tokenizer.post_processor),this.decoder=mK(this.tokenizer.decoder),this.special_tokens=[],this.all_special_ids=[],this.added_tokens=[];const i=[],s=[];this.added_tokens_map=new Map;for(const a of this.tokenizer.added_tokens){const o=new w_e(a);if(this.added_tokens.push(o),this.model.tokens_to_ids.set(o.content,o.id),this.model.vocab[o.id]=o.content,o.special&&(this.special_tokens.push(o.content),this.all_special_ids.push(o.id)),this.added_tokens_map.set(o.content,o),o.normalized&&this.normalizer!==null){const l=this.normalizer(o.content);s.push(l),this.added_tokens_map.set(l,o)}else i.push(o.content)}(this.config.additional_special_tokens??[]).forEach(a=>{this.special_tokens.includes(a)||this.special_tokens.push(a)}),this.decoder&&(this.decoder.added_tokens=this.added_tokens,this.decoder.end_of_word_suffix=this.model.end_of_word_suffix),this.splitter_unnormalized=new P8(i),this.splitter_normalized=new P8(s),this.remove_space=this.config.remove_space,this.clean_up_tokenization_spaces=this.config.clean_up_tokenization_spaces??!0,this.do_lowercase_and_remove_accent=this.config.do_lowercase_and_remove_accent??!1}encode(t,{text_pair:e=null,add_special_tokens:n=!0,return_token_type_ids:r=null}={}){const{tokens:i,token_type_ids:s}=this.tokenize_helper(t,{text_pair:e,add_special_tokens:n}),a=i.map(l=>{var c;return((c=this.added_tokens_map.get(l))==null?void 0:c.id)??this.model.tokens_to_ids.get(l)??this.model.unk_token_id}),o={ids:a,tokens:i,attention_mask:new Array(a.length).fill(1)};return r&&s&&(o.token_type_ids=s),o}decode(t,e={}){if(!Array.isArray(t)||t.length===0||!E_e(t[0]))throw Error("token_ids must be a non-empty array of integers.");let n=t.map(i=>this.model.vocab[Number(i)]??this.model.unk_token);e.skip_special_tokens&&(n=n.filter(i=>!this.special_tokens.includes(i)));let r=this.decoder?this.decoder(n):n.join(" ");return this.decoder&&this.decoder.end_of_word_suffix&&(r=r.replaceAll(this.decoder.end_of_word_suffix," "),e.skip_special_tokens&&(r=r.trim())),(e.clean_up_tokenization_spaces??this.clean_up_tokenization_spaces)&&(r=MI(r)),r}tokenize(t,{text_pair:e=null,add_special_tokens:n=!1}={}){return this.tokenize_helper(t,{text_pair:e,add_special_tokens:n}).tokens}encode_text(t){if(t===null)return null;const e=this.splitter_unnormalized.split(t);return e.forEach((n,r)=>{const i=this.added_tokens_map.get(n);i&&(i.lstrip&&r>0&&(e[r-1]=e[r-1].trimEnd()),i.rstrip&&r<e.length-1&&(e[r+1]=e[r+1].trimStart()))}),e.flatMap((n,r)=>{if(n.length===0)return[];if(this.added_tokens_map.has(n))return[n];if(this.remove_space===!0&&(n=n.trim().split(/\s+/).join(" ")),this.do_lowercase_and_remove_accent&&(n=P_e(n)),this.normalizer!==null&&(n=this.normalizer(n)),n.length===0)return[];const i=this.splitter_normalized.split(n);return i.forEach((s,a)=>{const o=this.added_tokens_map.get(s);o&&(o.lstrip&&a>0&&(i[a-1]=i[a-1].trimEnd()),o.rstrip&&a<i.length-1&&(i[a+1]=i[a+1].trimStart()))}),i.flatMap(s=>{if(s.length===0)return[];if(this.added_tokens_map.has(s))return[s];const a=this.pre_tokenizer!==null?this.pre_tokenizer(s,{section_index:r}):[s];return this.model(a)})})}tokenize_helper(t,{text_pair:e=null,add_special_tokens:n=!0}){const r=this.encode_text(t),i=this.encode_text(e||null);return this.post_processor?this.post_processor(r,i,n):{tokens:Kl(r??[],i??[])}}token_to_id(t){return this.model.tokens_to_ids.get(t)}id_to_token(t){return this.model.vocab[t]}get_added_tokens_decoder(){const t=new Map;for(const e of this.added_tokens)t.set(e.id,e);return t}get_vocab(t=!0){const e=new Map;for(let n=0;n<this.model.vocab.length;++n){const r=this.model.vocab[n];(t||!this.added_tokens_map.has(r))&&e.set(r,n)}return e}},A1e=E1e,Oe=Object.freeze({Text:"Text",NumericLiteral:"NumericLiteral",StringLiteral
502:"StringLiteral",Identifier:"Identifier",Equals:"Equals",OpenParen:"OpenParen",CloseParen:"CloseParen",OpenStatement:"OpenStatement",CloseStatement:"CloseStatement",OpenExpression:"OpenExpression",CloseExpression:"CloseExpression",OpenSquareBracket:"OpenSquareBracket",CloseSquareBracket:"CloseSquareBracket",OpenCurlyBracket:"OpenCurlyBracket",CloseCurlyBracket:"CloseCurlyBracket",Comma:"Comma",Dot:"Dot",Colon:"Colon",Pipe:"Pipe",CallOperator:"CallOperator",AdditiveBinaryOperator:"AdditiveBinaryOperator",MultiplicativeBinaryOperator:"MultiplicativeBinaryOperator",ComparisonBinaryOperator:"ComparisonBinaryOperator",UnaryOperator:"UnaryOperator",Comment:"Comment"}),$o=class{constructor(t,e){this.value=t,this.type=e}};function D8(t){return/\w/.test(t)}function Sy(t){return/[0-9]/.test(t)}function F8(t){return/\s/.test(t)}var P1e=[["{%",Oe.OpenStatement],["%}",Oe.CloseStatement],["{{",Oe.OpenExpression],["}}",Oe.CloseExpression],["(",Oe.OpenParen],[")",Oe.CloseParen],["{",Oe.OpenCurlyBracket],["}",Oe.CloseCurlyBracket],["[",Oe.OpenSquareBracket],["]",Oe.CloseSquareBracket],[",",Oe.Comma],[".",Oe.Dot],[":",Oe.Colon],["|",Oe.Pipe],["<=",Oe.ComparisonBinaryOperator],[">=",Oe.ComparisonBinaryOperator],["==",Oe.ComparisonBinaryOperator],["!=",Oe.ComparisonBinaryOperator],["<",Oe.ComparisonBinaryOperator],[">",Oe.ComparisonBinaryOperator],["+",Oe.AdditiveBinaryOperator],["-",Oe.AdditiveBinaryOperator],["~",Oe.AdditiveBinaryOperator],["*",Oe.MultiplicativeBinaryOperator],["/",Oe.MultiplicativeBinaryOperator],["%",Oe.MultiplicativeBinaryOperator],["=",Oe.Equals]],M1e=new Map([["n",` 503`],["t"," "],["r","\r"],["b","\b"],["f","\f"],["v","\v"],["'","'"],['"','"'],["\\","\\"]]);function N1e(t,e={}){return t.endsWith(` 504`)&&(t=t.slice(0,-1)),e.lstrip_blocks&&(t=t.replace(/^[ \t]*({[#%-])/gm,"$1")),e.trim_blocks&&(t=t.replace(/([#%-]})\n/g,"$1")),t.replace(/{%\s*(end)?generation\s*%}/gs,"")}function R1e(t,e={}){var c,u;const n=[],r=N1e(t,e);let i=0,s=0;const a=d=>{let f="";for(;d(r[i]);){if(r[i]==="\\"){if(++i,i>=r.length)throw new SyntaxError("Unexpected end of input");const h=r[i++],p=M1e.get(h);if(p===void 0)throw new SyntaxError(`Unexpected escaped character: ${h}`);f+=p;continue}if(f+=r[i++],i>=r.length)throw new SyntaxError("Unexpected end of input")}return f},o=()=>{const d=n.at(-1);d&&d.type===Oe.Text&&(d.value=d.value.trimEnd(),d.value===""&&n.pop())},l=()=>{for(;i<r.length&&F8(r[i]);)++i};e:for(;i<r.length;){const d=(c=n.at(-1))==null?void 0:c.type;if(d===void 0||d===Oe.CloseStatement||d===Oe.CloseExpression||d===Oe.Comment){let h="";for(;i<r.length&&!(r[i]==="{"&&(r[i+1]==="%"||r[i+1]==="{"||r[i+1]==="#"));)h+=r[i++];if(h.length>0){n.push(new $o(h,Oe.Text));continue}}if(r[i]==="{"&&r[i+1]==="#"){i+=2;const h=r[i]==="-";h&&++i;let p="";for(;r[i]!=="#"||r[i+1]!=="}";){if(i+2>=r.length)throw new SyntaxError("Missing end of comment tag");p+=r[i++]}const m=p.endsWith("-");m&&(p=p.slice(0,-1)),h&&o(),n.push(new $o(p,Oe.Comment)),i+=2,m&&l();continue}if(r.slice(i,i+3)==="{%-"){o(),n.push(new $o("{%",Oe.OpenStatement)),i+=3;continue}if(r.slice(i,i+3)==="{{-"){o(),n.push(new $o("{{",Oe.OpenExpression)),s=0,i+=3;continue}if(a(F8),r.slice(i,i+3)==="-%}"){n.push(new $o("%}",Oe.CloseStatement)),i+=3,l();continue}if(r.slice(i,i+3)==="-}}"){n.push(new $o("}}",Oe.CloseExpression)),i+=3,l();continue}const f=r[i];if(f==="-"||f==="+"){const h=(u=n.at(-1))==null?void 0:u.type;if(h===Oe.Text||h===void 0)throw new SyntaxError(`Unexpected character: ${f}`);switch(h){case Oe.Identifier:case Oe.NumericLiteral:case Oe.StringLiteral:case Oe.CloseParen:case Oe.CloseSquareBracket:break;default:{++i;const p=a(Sy);n.push(new $o(`${f}${p}`,p.length>0?Oe.NumericLiteral:Oe.UnaryOperator));continue}}}for(const[h,p]of P1e){if(h==="}}"&&s>0)continue;if(r.slice(i,i+h.length)===h){n.push(new $o(h,p)),p===Oe.OpenExpression?s=0:p===Oe.OpenCurlyBracket?++s:p===Oe.CloseCurlyBracket&&--s,i+=h.length;continue e}}if(f==="'"||f==='"'){++i;const h=a(p=>p!==f);n.push(new $o(h,Oe.StringLiteral)),++i;continue}if(Sy(f)){let h=a(Sy);if(r[i]==="."&&Sy(r[i+1])){++i;const p=a(Sy);h=`${h}.${p}`}n.push(new $o(h,Oe.NumericLiteral));continue}if(D8(f)){const h=a(D8);n.push(new $o(h,Oe.Identifier));continue}throw new SyntaxError(`Unexpected character: ${f}`)}return n}var cc=class{constructor(){X(this,"type","Statement")}},I1e=class extends cc{constructor(e){super();X(this,"type","Program");this.body=e}},L1e=class extends cc{constructor(e,n,r){super();X(this,"type","If");this.test=e,this.body=n,this.alternate=r}},O1e=class extends cc{constructor(e,n,r,i){super();X(this,"type","For");this.loopvar=e,this.iterable=n,this.body=r,this.defaultBlock=i}},D1e=class extends cc{constructor(){super(...arguments);X(this,"type","Break")}},F1e=class extends cc{constructor(){super(...arguments);X(this,"type","Continue")}},j1e=class extends cc{constructor(e,n,r){super();X(this,"type","Set");this.assignee=e,this.value=n,this.body=r}},B1e=class extends cc{constructor(e,n,r){super();X(this,"type","Macro");this.name=e,this.args=n,this.body=r}},U1e=class extends cc{constructor(e){super();X(this,"type","Comment");this.value=e}},Mo=class extends cc{constructor(){super(...arguments);X(this,"type","Expression")}},z1e=class extends Mo{constructor(e,n,r){super();X(this,"type","MemberExpression");this.object=e,this.property=n,this.computed=r}},j8=class extends Mo{constructor(e,n){super();X(this,"type","CallExpression");this.callee=e,this.args=n}},Ym=class extends Mo{constructor(e){super();X(this,"type","Identifier");this.value=e}},d0=class extends Mo{constructor(e){super();X(this,"type","Literal");this.value=e}},$1e=class extends d0{constructor(){super(...arguments);X(this,"type","IntegerLiteral")}},V1e=class extends d0{constructor(){super(...arguments);X(this,"type","FloatLiteral")}},B8=class extends d0{constructor(){super(...arguments);X(this,"type","StringLiteral")}},q1e=class extends d0{constructor(){super(...arguments);X(this,"type","ArrayLiteral")}},U8=class extends d0{constructor(){super(...arguments);X(this,"type","TupleLiteral")}},W1e=class extends d0{constructor(){super(...arguments);X(this,"type","ObjectLiteral")}},Ty=class extends Mo{constructor(e,n,r){super();X(this,"type","BinaryExpression");this.operator=e,this.left=n,this.right=r}},G1e=class extends Mo{constructor(e,n){super();X(this,"type","FilterExpression");this.operand=e,this.filter=n}},H1e=class extends cc{constructor(e,n){super();X(this,"type","FilterStatement");this.filter=e,this.body=n}},K1e=class extends Mo{constructor(e,n){super();X(this,"type","SelectExpression");this.lhs=e,this.test=n}},J1e=class extends Mo{constructor(e,n,r){super();X(this,"type","TestExpression");this.operand=e,this.negate=n,this.test=r}},Y1e=class extends Mo{constructor(e,n){super();X(this,"type","UnaryExpression");this.operator=e,this.argument=n}},X1e=class extends Mo{constructor(e=void 0,n=void 0,r=void 0){super();X(this,"type","SliceExpression");this.start=e,this.stop=n,this.step=r}},Q1e=class extends Mo{constructor(e,n){super();X(this,"type","KeywordArgumentExpression");this.key=e,this.value=n}},Z1e=class extends Mo{constructor(e){super();X(this,"type","SpreadExpression");this.argument=e}},ebe=class extends cc{constructor(e,n,r){super();X(this,"type","CallStatement");this.call=e,this.callerArgs=n,this.body=r}},tbe=class extends Mo{constructor(e,n,r){super();X(this,"type","Ternary");this.condition=e,this.trueExpr=n,this.falseExpr=r}};function nbe(t){const e=new I1e([]);let n=0;function r(V,q){const se=t[n++];if(!se||se.type!==V)throw new Error(`Parser Error: ${q}. ${se.type} !== ${V}.`);return se}function i(V){if(!l(V))throw new SyntaxError(`Expected ${V}`);++n}function s(){switch(t[n].type){case Oe.Comment:return new U1e(t[n++].value);case Oe.Text:return c();case Oe.OpenStatement:return u();case Oe.OpenExpression:return d();default:throw new SyntaxError(`Unexpected token type: ${t[n].type}`)}}function a(...V){return n+V.length<=t.length&&V.every((q,se)=>q===t[n+se].type)}function o(...V){var q,se,he;return((q=t[n])==null?void 0:q.type)===Oe.OpenStatement&&((se=t[n+1])==null?void 0:se.type)===Oe.Identifier&&V.includes((he=t[n+1])==null?void 0:he.value)}function l(...V){return n+V.length<=t.length&&V.every((q,se)=>t[n+se].type==="Identifier"&&q===t[n+se].value)}function c(){return new B8(r(Oe.Text,"Expected text token").value)}function u(){if(r(Oe.OpenStatement,"Expected opening statement token"),t[n].type!==Oe.Identifier)throw new SyntaxError(`Unknown statement, got ${t[n].type}`);const V=t[n].value;let q;switch(V){case"set":++n,q=f();break;case"if":++n,q=h(),r(Oe.OpenStatement,"Expected {% token"),i("endif"),r(Oe.CloseStatement,"Expected %} token");break;case"macro":++n,q=p(),r(Oe.OpenStatement,"Expected {% token"),i("endmacro"),r(Oe.CloseStatement,"Expected %} token");break;case"for":++n,q=g(),r(Oe.OpenStatement,"Expected {% token"),i("endfor"),r(Oe.CloseStatement,"Expected %} token");break;case"call":{++n;let se=null;a(Oe.OpenParen)&&(se=B());const he=le();if(he.type!=="Identifier")throw new SyntaxError("Expected identifier following call statement");const z=B();r(Oe.CloseStatement,"Expected closing statement token");const J=[];for(;!o("endcall");)J.push(s());r(Oe.OpenStatement,"Expected '{%'"),i("endcall"),r(Oe.CloseStatement,"Expected closing statement token");const Y=new j8(he,z);q=new ebe(Y,se,J);break}case"break":++n,r(Oe.CloseStatement,"Expected closing statement token"),q=ne
504w D1e;break;case"continue":++n,r(Oe.CloseStatement,"Expected closing statement token"),q=new F1e;break;case"filter":{++n;let se=le();se instanceof Ym&&a(Oe.OpenParen)&&(se=M(se)),r(Oe.CloseStatement,"Expected closing statement token");const he=[];for(;!o("endfilter");)he.push(s());r(Oe.OpenStatement,"Expected '{%'"),i("endfilter"),r(Oe.CloseStatement,"Expected '%}'"),q=new H1e(se,he);break}default:throw new SyntaxError(`Unknown statement type: ${V}`)}return q}function d(){r(Oe.OpenExpression,"Expected opening expression token");const V=v();return r(Oe.CloseExpression,"Expected closing expression token"),V}function f(){const V=m();let q=null;const se=[];if(a(Oe.Equals))++n,q=m();else{for(r(Oe.CloseStatement,"Expected %} token");!o("endset");)se.push(s());r(Oe.OpenStatement,"Expected {% token"),i("endset")}return r(Oe.CloseStatement,"Expected closing statement token"),new j1e(V,q,se)}function h(){const V=v();r(Oe.CloseStatement,"Expected closing statement token");const q=[],se=[];for(;!o("elif","else","endif");)q.push(s());if(o("elif")){++n,++n;const he=h();se.push(he)}else if(o("else"))for(++n,++n,r(Oe.CloseStatement,"Expected closing statement token");!o("endif");)se.push(s());return new L1e(V,q,se)}function p(){const V=le();if(V.type!=="Identifier")throw new SyntaxError("Expected identifier following macro statement");const q=B();r(Oe.CloseStatement,"Expected closing statement token");const se=[];for(;!o("endmacro");)se.push(s());return new B1e(V,q,se)}function m(V=!1){const q=V?le:v,se=[q()],he=a(Oe.Comma);for(;he&&(++n,se.push(q()),!!a(Oe.Comma)););return he?new U8(se):se[0]}function g(){const V=m(!0);if(!(V instanceof Ym||V instanceof U8))throw new SyntaxError(`Expected identifier/tuple for the loop variable, got ${V.type} instead`);if(!l("in"))throw new SyntaxError("Expected `in` keyword following loop variable");++n;const q=v();r(Oe.CloseStatement,"Expected closing statement token");const se=[];for(;!o("endfor","else");)se.push(s());const he=[];if(o("else"))for(++n,++n,r(Oe.CloseStatement,"Expected closing statement token");!o("endfor");)he.push(s());return new O1e(V,q,se,he)}function v(){return _()}function _(){const V=b();if(l("if")){++n;const q=b();if(l("else")){++n;const se=_();return new tbe(q,V,se)}else return new K1e(V,q)}return V}function b(){let V=x();for(;l("or");){const q=t[n];++n;const se=x();V=new Ty(q,V,se)}return V}function x(){let V=T();for(;l("and");){const q=t[n];++n;const se=T();V=new Ty(q,V,se)}return V}function T(){let V;for(;l("not");){const q=t[n];++n;const se=T();V=new Y1e(q,se)}return V??N()}function N(){let V=A();for(;;){let q;if(l("not","in"))q=new $o("not in",Oe.Identifier),n+=2;else if(l("in"))q=t[n++];else if(a(Oe.ComparisonBinaryOperator))q=t[n++];else break;const se=A();V=new Ty(q,V,se)}return V}function A(){let V=U();for(;a(Oe.AdditiveBinaryOperator);){const q=t[n];++n;const se=U();V=new Ty(q,V,se)}return V}function L(){const V=$(le());return a(Oe.OpenParen)?M(V):V}function M(V){let q=new j8(V,B());return q=$(q),a(Oe.OpenParen)&&(q=M(q)),q}function B(){r(Oe.OpenParen,"Expected opening parenthesis for arguments list");const V=R();return r(Oe.CloseParen,"Expected closing parenthesis for arguments list"),V}function R(){const V=[];for(;!a(Oe.CloseParen);){let q;if(t[n].type===Oe.MultiplicativeBinaryOperator&&t[n].value==="*"){++n;const se=v();q=new Z1e(se)}else if(q=v(),a(Oe.Equals)){if(++n,!(q instanceof Ym))throw new SyntaxError("Expected identifier for keyword argument");const se=v();q=new Q1e(q,se)}V.push(q),a(Oe.Comma)&&++n}return V}function j(){const V=[];let q=!1;for(;!a(Oe.CloseSquareBracket);)a(Oe.Colon)?(V.push(void 0),++n,q=!0):(V.push(v()),a(Oe.Colon)&&(++n,q=!0));if(V.length===0)throw new SyntaxError("Expected at least one argument for member/slice expression");if(q){if(V.length>3)throw new SyntaxError("Expected 0-3 arguments for slice expression");return new X1e(...V)}return V[0]}function $(V){for(;a(Oe.Dot)||a(Oe.OpenSquareBracket);){const q=t[n];++n;let se;const he=q.type===Oe.OpenSquareBracket;if(he)se=j(),r(Oe.CloseSquareBracket,"Expected closing square bracket");else if(se=le(),se.type!=="Identifier")throw new SyntaxError("Expected identifier following dot operator");V=new z1e(V,se,he)}return V}function U(){let V=te();for(;a(Oe.MultiplicativeBinaryOperator);){const q=t[n++],se=te();V=new Ty(q,V,se)}return V}function te(){let V=ne();for(;l("is");){++n;const q=l("not");q&&++n;const se=le();if(!(se instanceof Ym))throw new SyntaxError("Expected identifier for the test");V=new J1e(V,q,se)}return V}function ne(){let V=L();for(;a(Oe.Pipe);){++n;let q=le();if(!(q instanceof Ym))throw new SyntaxError("Expected identifier for the filter");a(Oe.OpenParen)&&(q=M(q)),V=new G1e(V,q)}return V}function le(){const V=t[n++];switch(V.type){case Oe.NumericLiteral:{const q=V.value;return q.includes(".")?new V1e(Number(q)):new $1e(Number(q))}
504case Oe.StringLiteral:{let q=V.value;for(;a(Oe.StringLiteral);)q+=t[n++].value;return new B8(q)}case Oe.Identifier:return new Ym(V.value);case Oe.OpenParen:{const q=m();return r(Oe.CloseParen,"Expected closing parenthesis, got ${tokens[current].type} instead."),q}case Oe.OpenSquareBracket:{const q=[];for(;!a(Oe.CloseSquareBracket);)q.push(v()),a(Oe.Comma)&&++n;return++n,new q1e(q)}case Oe.OpenCurlyBracket:{const q=new Map;for(;!a(Oe.CloseCurlyBracket);){const se=v();r(Oe.Colon,"Expected colon between key and value in object literal");const he=v();q.set(se,he),a(Oe.Comma)&&++n}return++n,new W1e(q)}default:throw new SyntaxError(`Unexpected token: ${V.type}`)}}for(;n<t.length;)e.body.push(s());return e}function rbe(t,e,n=1){if(e===void 0&&(e=t,t=0),n===0)throw new Error("range() step must not be zero");const r=[];if(n>0)for(let i=t;i<e;i+=n)r.push(i);else for(let i=t;i>e;i+=n)r.push(i);return r}function z8(t,e,n,r=1){const i=Math.sign(r);i>=0?(e=(e??(e=0))<0?Math.max(t.length+e,0):Math.min(e,t.length),n=(n??(n=t.length))<0?Math.max(t.length+n,0):Math.min(n,t.length)):(e=(e??(e=t.length-1))<0?Math.max(t.length+e,-1):Math.min(e,t.length-1),n=(n??(n=-1))<-1?Math.max(t.length+n,-1):Math.min(n,t.length-1));const s=[];for(let a=e;i*a<i*n;a+=r)s.push(t[a]);return s}function ibe(t){return t.replace(/\b\w/g,e=>e.toUpperCase())}function sbe(t){return abe(new Date,t)}function abe(t,e){const n=new Intl.DateTimeFormat(void 0,{month:"long"}),r=new Intl.DateTimeFormat(void 0,{month:"short"}),i=s=>s<10?"0"+s:s.toString();return e.replace(/%[YmdbBHM%]/g,s=>{switch(s){case"%Y":return t.getFullYear().toString();case"%m":return i(t.getMonth()+1);case"%d":return i(t.getDate());case"%b":return r.format(t);case"%B":return n.format(t);case"%H":return i(t.getHours());case"%M":return i(t.getMinutes());case"%%":return"%";default:return s}})}function obe(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function lbe(t,e,n,r){if(r===0)return t;let i=r==null||r<0?1/0:r;const s=e.length===0?new RegExp("(?=)","gu"):new RegExp(obe(e),"gu");return t.replaceAll(s,a=>i>0?(--i,n):a)}var $8=class extends Error{},V8=class extends Error{},lu=class{constructor(t=void 0){X(this,"type","RuntimeValue");X(this,"value");X(this,"builtins",new Map);this.value=t}__bool__(){return new Ht(!!this.value)}toString(){return String(this.value)}},cn=class extends lu{constructor(){super(...arguments);X(this,"type","IntegerValue")}},ui=class extends lu{constructor(){super(...arguments);X(this,"type","FloatValue")}toString(){return this.value%1===0?this.value.toFixed(1):this.value.toString()}},ft=class extends lu{constructor(){super(...arguments);X(this,"type","StringValue");X(this,"builtins",new Map([["upper",new Rr(()=>new ft(this.value.toUpperCase()))],["lower",new Rr(()=>new ft(this.value.toLowerCase()))],["strip",new Rr(()=>new ft(this.value.trim()))],["title",new Rr(()=>new ft(ibe(this.value)))],["capitalize",new Rr(()=>new ft(this.value.charAt(0).toUpperCase()+this.value.slice(1)))],["length",new cn(this.value.length)],["rstrip",new Rr(()=>new ft(this.value.trimEnd()))],["lstrip",new Rr(()=>new ft(this.value.trimStart()))],["startswith",new Rr(e=>{if(e.length===0)throw new Error("startswith() requires at least one argument");const n=e[0];if(n instanceof ft)return new Ht(this.value.startsWith(n.value));if(n instanceof bn){for(const r of n.value){if(!(r instanceof ft))throw new Error("startswith() tuple elements must be strings");if(this.value.startsWith(r.value))return new Ht(!0)}return new Ht(!1)}throw new Error("startswith() argument must be a string or tuple of strings")})],["endswith",new Rr(e=>{if(e.length===0)throw new Error("endswith() requires at least one argument");const n=e[0];if(n instanceof ft)return new Ht(this.value.endsWith(n.value));if(n instanceof bn){for(const r of n.value){if(!(r instanceof ft))throw new Error("endswith() tuple elements must be strings");if(this.value.endsWith(r.value))return new Ht(!0)}return new Ht(!1)}throw new Error("endswith() argument must be a string or tuple of strings")})],["split",new Rr(e=>{const n=e[0]??new $r;if(!(n instanceof ft||n instanceof $r))throw new Error("sep argument must be a string or null");const r=e[1]??new cn(-1);if(!(r instanceof cn))throw new Error("maxsplit argument must be a number");let i=[];if(n instanceof $r){const s=this.value.trimStart();for(const{0:a,index:o}of s.matchAll(/\S+/g)){if(r.value!==-1&&i.length>=r.value&&o!==void 0){i.push(a+s.slice(o+a.length));break}i.push(a)}}else{if(n.value==="")throw new Error("empty separator");i=this.value.split(n.value),r.value!==-1&&i.length>r.value&&i.push(i.splice(r.value).join(n.value))}return new bn(i.map(s=>new ft(s)))})],["replace",new Rr(e=>{if(e.length<2)throw new Error("replace() requires at least two arguments");const n=e[0],r=e[1];if(!(n instanceof ft&&r instanceof ft))throw new Error("replace() arguments must be strings");let i;if(e.length>2?e[2].type==="KeywordArgumentsValue"?i=e[2].value.get("count")??new $r:i=e[2]:i=new $r,!(i instanceof cn||i instanceof $r))throw new Error("replace() count argument must be a number or null");
504return new ft(lbe(this.value,n.value,r.value,i.value))})]]))}},Ht=class extends lu{constructor(){super(...arguments);X(this,"type","BooleanValue")}},cbe=/[\x7f-\uffff]/g;function q8(t){return t.replace(cbe,e=>"\\u"+e.charCodeAt(0).toString(16).padStart(4,"0"))}function Mp(t,e={},n=0,r=!0){const{indent:i=null,ensureAscii:s=!1,separators:a=null,sortKeys:o=!1}=e;let l,c;switch(a?[l,c]=a:i?(l=",",c=": "):(l=", ",c=": "),t.type){case"NullValue":return"null";case"UndefinedValue":return r?"null":"undefined";case"IntegerValue":case"FloatValue":case"BooleanValue":return JSON.stringify(t.value);case"StringValue":{let u=JSON.stringify(t.value);return s&&(u=q8(u)),u}case"ArrayValue":case"ObjectValue":{const u=i?" ".repeat(i):"",d=` 505`+u.repeat(n),f=d+u;if(t.type==="ArrayValue"){const h=t.value.map(p=>Mp(p,e,n+1,r));return i?`[${f}${h.join(`${l}${f}`)}${d}]`:`[${h.join(l)}]`}else{let h=Array.from(t.value.entries());o&&(h=h.sort(([m],[g])=>m.localeCompare(g)));const p=h.map(([m,g])=>{let v=JSON.stringify(m);s&&(v=q8(v));const _=`${v}${c}${Mp(g,e,n+1,r)}`;return i?`${f}${_}`:_});return i?`{${p.join(l)}${d}}`:`{${p.join(l)}}`}}default:throw new Error(`Cannot convert to JSON: ${t.type}`)}}var is=class extends lu{constructor(){super(...arguments);X(this,"type","ObjectValue");X(this,"builtins",new Map([["get",new Rr(([e,n])=>{if(!(e instanceof ft))throw new Error(`Object key must be a string: got ${e.type}`);return this.value.get(e.value)??n??new $r})],["items",new Rr(()=>this.items())],["keys",new Rr(()=>this.keys())],["values",new Rr(()=>this.values())],["dictsort",new Rr(e=>{let n=new Map;const r=e.filter(l=>l instanceof t_?(n=l.value,!1):!0),i=r.at(0)??n.get("case_sensitive")??new Ht(!1);if(!(i instanceof Ht))throw new Error("case_sensitive must be a boolean");const s=r.at(1)??n.get("by")??new ft("key");if(!(s instanceof ft))throw new Error("by must be a string");if(!["key","value"].includes(s.value))throw new Error("by must be either 'key' or 'value'");const a=r.at(2)??n.get("reverse")??new Ht(!1);if(!(a instanceof Ht))throw new Error("reverse must be a boolean");const o=Array.from(this.value.entries()).map(([l,c])=>new bn([new ft(l),c])).sort((l,c)=>{const u=s.value==="key"?0:1,d=l.value[u],f=c.value[u],h=JM(d,f,i.value);return a.value?-h:h});return new bn(o)})]]))}__bool__(){return new Ht(this.value.size>0)}items(){return new bn(Array.from(this.value.entries()).map(([e,n])=>new bn([new ft(e),n])))}keys(){return new bn(Array.from(this.value.keys()).map(e=>new ft(e)))}
505values(){return new bn(Array.from(this.value.values()))}toString(){return Mp(this,{},0,!1)}},t_=class extends is{constructor(){super(...arguments);X(this,"type","KeywordArgumentsValue")}},bn=class extends lu{constructor(){super(...arguments);X(this,"type","ArrayValue");X(this,"builtins",new Map([["length",new cn(this.value.length)]]))}__bool__(){return new Ht(this.value.length>0)}toString(){return Mp(this,{},0,!1)}},W8=class extends bn{constructor(){super(...arguments);X(this,"type","TupleValue")}},Rr=class extends lu{constructor(){super(...arguments);X(this,"type","FunctionValue")}},$r=class extends lu{constructor(){super(...arguments);X(this,"type","NullValue")}},Nr=class extends lu{constructor(){super(...arguments);X(this,"type","UndefinedValue")}},Kf=class{constructor(t){X(this,"variables",new Map([["namespace",new Rr(t=>{if(t.length===0)return new is(new Map);if(t.length!==1||!(t[0]instanceof is))throw new Error("`namespace` expects either zero arguments or a single object argument");return t[0]})]]));X(this,"tests",new Map([["boolean",t=>t.type==="BooleanValue"],["callable",t=>t instanceof Rr],["odd",t=>{if(!(t instanceof cn))throw new Error(`cannot odd on ${t.type}`);return t.value%2!==0}],["even",t=>{if(!(t instanceof cn))throw new Error(`cannot even on ${t.type}`);return t.value%2===0}],["false",t=>t.type==="BooleanValue"&&!t.value],["true",t=>t.type==="BooleanValue"&&t.value],["none",t=>t.type==="NullValue"],["string",t=>t.type==="StringValue"],["number",t=>t instanceof cn||t instanceof ui],["integer",t=>t instanceof cn],["iterable",t=>t.type==="ArrayValue"||t.type==="StringValue"],["mapping",t=>t instanceof is],["sequence",t=>t instanceof bn||t instanceof is||t instanceof ft],["lower",t=>{const e=t.value;return t.type==="StringValue"&&e===e.toLowerCase()}],["upper",t=>{const e=t.value;return t.type==="StringValue"&&e===e.toUpperCase()}],["none",t=>t.type==="NullValue"],["defined",t=>t.type!=="UndefinedValue"],["undefined",t=>t.type==="UndefinedValue"],["equalto",(t,e)=>t.value===e.value],["eq",(t,e)=>t.value===e.value]]));this.parent=t}set(t,e){return this.declareVariable(t,vx(e))}declareVariable(t,e){if(this.variables.has(t))throw new SyntaxError(`Variable already declared: ${t}`);return this.variables.set(t,e),e}setVariable(t,e){return this.variables.set(t,e),e}resolve(t){if(this.variables.has(t))return this;if(this.parent)return this.parent.resolve(t);throw new Error(`Unknown variable: ${t}`)}lookupVariable(t){try{return this.resolve(t).variables.get(t)??new Nr}catch{return new Nr}}};function ube(t){t.set("false",!1),t.set("true",!0),t.set("none",null),t.set("raise_exception",e=>{throw new Error(e)}),t.set("range",rbe),t.set("strftime_now",sbe),t.set("True",!0),t.set("False",!1),t.set("None",null)}function G8(t,e){const n=e.split(".");let r=t;for(const i of n)if(r instanceof is)r=r.value.get(i)??new Nr;else if(r instanceof bn){const s=parseInt(i,10);if(!isNaN(s)&&s>=0&&s<r.value.length)r=r.value[s];else return new Nr}else return new Nr;return r}function JM(t,e,n=!1){if(t instanceof $r&&e instanceof $r)return 0;if(t instanceof $r||e instanceof $r)throw new Error(`Cannot compare ${t.type} with ${e.type}`);if(t instanceof Nr&&e instanceof Nr)return 0;if(t instanceof Nr||e instanceof Nr)throw new Error(`Cannot compare ${t.type} with ${e.type}`);const r=s=>s instanceof cn||s instanceof ui||s instanceof Ht,i=s=>s instanceof Ht?s.value?1:0:s.value;if(r(t)&&r(e)){const s=i(t),a=i(e);return s<a?-1:s>a?1:0}if(t.type!==e.type)throw new Error(`Cannot compare different types: ${t.type} and ${e.type}`);switch(t.type){case"StringValue":{let s=t.value,a=e.value;return n||(s=s.toLowerCase(),a=a.toLowerCase()),s<a?-1:s>a?1:0}default:throw new Error(`Cannot compare type: ${t.type}`)}}var dbe=class{constructor(t){X(this,"global");this.global=t??new Kf}run(t){return this.evaluate(t,this.global)}evaluateBinaryExpression(t,e){const n=this.evaluate(t.left,e);switch(t.operator.value){case"and":return n.__bool__().value?this.evaluate(t.right,e):n;case"or":return n.__bool__().value?n:this.evaluate(t.right,e)}const r=this.evaluate(t.right,e);switch(t.operator.value){case"==":return new Ht(n.value==r.value);case"!=":return new Ht(n.value!=r.value)}if(n instanceof Nr||r instanceof Nr){if(r instanceof Nr&&["in","not in"].includes(t.operator.value))return new Ht(t.operator.value==="not in");throw new Error(`Cannot perform operation ${t.operator.value} on undefined values`)}else{if(n instanceof $r||r instanceof $r)throw new Error("Cannot perform operation on null values");if(t.operator.value==="~")return new ft(n.value.toString()+r.value.toString());if((n instanceof cn||n instanceof ui)&&(r instanceof cn||r instanceof ui)){const i=n.value,s=r.value;switch(t.operator.value){case"+":case"-":case"*":{const a=t.operator.value==="+"?i+s:t.operator.value==="-"?i-s:i*s;return n instanceof ui||r instanceof ui?new ui(a):new cn(a)}case"/":return new ui(i/s);case"%":{const a=i%s;return n instanceof ui||r instanceof ui?new ui(a):new cn(a)}case"<":return new Ht(i<s);case">":return new Ht(i>s);case">=":return new Ht(i>=s);case"<=":return new Ht(i<=s)}}else if(n instanceof bn&&r instanceof bn)switch(t.operator.value){case"+":return new bn(n.value.concat(r.value))}else if(r instanceof bn){const i=r.value.find(s=>
505s.value===n.value)!==void 0;switch(t.operator.value){case"in":return new Ht(i);case"not in":return new Ht(!i)}}}if(n instanceof ft||r instanceof ft)switch(t.operator.value){case"+":return new ft(n.value.toString()+r.value.toString())}if(n instanceof ft&&r instanceof ft)switch(t.operator.value){case"in":return new Ht(r.value.includes(n.value));case"not in":return new Ht(!r.value.includes(n.value))}if(n instanceof ft&&r instanceof is)switch(t.operator.value){case"in":return new Ht(r.value.has(n.value));case"not in":return new Ht(!r.value.has(n.value))}throw new SyntaxError(`Unknown operator "${t.operator.value}" between ${n.type} and ${r.type}`)}evaluateArguments(t,e){const n=[],r=new Map;for(const i of t)if(i.type==="SpreadExpression"){const s=i,a=this.evaluate(s.argument,e);if(!(a instanceof bn))throw new Error(`Cannot unpack non-iterable type: ${a.type}`);for(const o of a.value)n.push(o)}else if(i.type==="KeywordArgumentExpression"){const s=i;r.set(s.key.value,this.evaluate(s.value,e))}else{if(r.size>0)throw new Error("Positional arguments must come before keyword arguments");n.push(this.evaluate(i,e))}return[n,r]}applyFilter(t,e,n){if(e.type==="Identifier"){const r=e;if(r.value==="safe")return t;if(r.value==="tojson")return new ft(Mp(t,{}));if(t instanceof bn)switch(r.value){case"list":return t;case"first":return t.value[0];case"last":return t.value[t.value.length-1];case"length":return new cn(t.value.length);case"reverse":return new bn(t.value.slice().reverse());case"sort":return new bn(t.value.slice().sort((i,s)=>JM(i,s,!1)));case"join":return new ft(t.value.map(i=>i.value).join(""));case"string":return new ft(Mp(t,{},0,!1));case"unique":{const i=new Set,s=[];for(const a of t.value)i.has(a.value)||(i.add(a.value),s.push(a));return new bn(s)}default:throw new Error(`Unknown ArrayValue filter: ${r.value}`)}else if(t instanceof ft)switch(r.value){case"length":case"upper":case"lower":case"title":case"capitalize":{const i=t.builtins.get(r.value);if(i instanceof Rr)return i.value([],n);if(i instanceof cn)return i;throw new Error(`Unknown StringValue filter: ${r.value}`)}case"trim":return new ft(t.value.trim());case"indent":return new ft(t.value.split(` 506`).map((i,s)=>s===0||i.length===0?i:" "+i).join(` 507`));case"join":case"string":return t;case"int":{const i=parseInt(t.value,10);return new cn(isNaN(i)?0:i)}case"float":{const i=parseFloat(t.value);return new ui(isNaN(i)?0:i)}default:throw new Error(`Unknown StringValue filter: ${r.value}`)}else if(t instanceof cn||t instanceof ui)switch(r.value){case"abs":return t instanceof cn?new cn(Math.abs(t.value)):new ui(Math.abs(t.value));case"int":return new cn(Math.floor(t.value));case"float":return new ui(t.value);case"string":return new ft(t.toString());default:throw new Error(`Unknown NumericValue filter: ${r.value}`)}else if(t instanceof is)switch(r.value){case"items":return new bn(Array.from(t.value.entries()).map(([i,s])=>new bn([new ft(i),s])));case"length":return new cn(t.value.size);default:{const i=t.builtins.get(r.value);if(i)return i instanceof Rr?i.value([],n):i;throw new Error(`Unknown ObjectValue filter: ${r.value}`)}}else if(t instanceof Ht)switch(r.value){case"bool":return new Ht(t.value);case"int":return new cn(t.value?1:0);case"float":return new ui(t.value?1:0);case"string":return new ft(t.value?"true":"false");default:throw new Error(`Unknown BooleanValue filter: ${r.value}`)}throw new Error(`Cannot apply filter "${r.value}" to type: ${t.type}`)}else if(e.type==="CallExpression"){const r=e;if(r.callee.type!=="Identifier")throw new Error(`Unknown filter: ${r.callee.type}`);const i=r.callee.value;if(i==="tojson"){const[,s]=this.evaluateArguments(r.args,n),a=s.get("indent")??new $r;if(!(a instanceof cn||a instanceof $r))throw new Error("If set, indent must be a number");const o=s.get("ensure_ascii")??new Ht(!1);if(!(o instanceof Ht))throw new Error("If set, ensure_ascii must be a boolean");const l=s.get("sort_keys")??new Ht(!1);if(!(l instanceof Ht))throw new Error("If set, sort_keys must be a boolean");const c=s.get("separators")??new $r;let u=null;if(c instanceof bn||c instanceof W8){if(c.value.length!==2)throw new Error("separators must be a tuple of two strings");const[d,f]=c.value;if(!(d instanceof ft)||!(f instanceof ft))throw new Error("separators must be a tuple of two strings");u=[d.value,f.value]}else if(!(c instanceof $r))throw new Error("If set, separators must be a tuple of two strings");return new ft(Mp(t,{indent:a.value,ensureAscii:o.value,sortKeys:l.value,separators:u}))}else if(i==="join"){let s;if(t instanceof ft)s=Array.from(t.value);else if(t instanceof bn)s=t.value.map(c=>c.value);else throw new Error(`Cannot apply filter "${i}" to type: ${t.type}`);const[a,o]=this.evaluateArguments(r.args,n),l=a.at(0)??o.get("separator")??new ft("");if(!(l instanceof ft))throw new Error("separator must be a string");return new ft(s.join(l.value))}else if(i==="int"||i==="float"){const[s,a]=this.evaluateArguments(r.args,n),o=s.at(0)??a.get("default")??(i==="int"?new cn(0):new ui(0));if(t instanceof ft){const l=i==="int"?parseInt(t.value,10):parseFloat(t.value);return isNaN(l)?o:i==="int"?new cn(l):new ui(l)}else{if(t instanceof cn||t instanceof ui)return t;if(t instanceof Ht)return i==="int"?new cn(t.value?1:0):new ui(t.value?1:0);throw new Error(`Cannot apply filter "${i}" to type: ${t.type}`)}}else if(i==="default"){const[s,a]=this.evaluateArguments(r.args,n),o=s[0]??new ft(""),l=s[1]??a.get("boolean")??new Ht(!1);if(!(l instanceof Ht))throw new Error("`default` filter flag must be a boolean");return t instanceof Nr||l.value&&!t.__bool__().value?o:t}if(t instanceof bn){switch(i){case"sort":{const[s,a]=this.evaluateArguments(r.args,n),o=s.at(0)??a.get("reverse")??new Ht(!1);if(!(o instanceof Ht))throw new Error("reverse must be a boolean");const l=s.at(1)??a.get("case_sensitive")??new Ht(!1);if(!(l instanceof Ht))throw new Error("case_sensitive must be a boolean");const c=s.at(2)??a.get("attribute")??new $r;if(!(c instanceof ft||c instanceof cn||c instanceof $r))throw new Error("attribute must be a string, integer, or null");const u=d=>{if(c instanceof $r)return d;const f=c instanceof cn?String(c.value):c.value;return G8(d,f)};return new bn(t.value.slice().sort((d,f)=>{const h=u(d),p=u(f),m=JM(h,p,l.value);return o.value?-m:m}))}case"selectattr":case"rejectattr":{const s=i==="selectattr";if(t.value.some(d=>!(d instanceof is)))throw new Error(`\`${i}\` can only be applied to array of objects`);if(r.args.some(d=>d.type!=="StringLiteral"))throw new Error(`arguments of \`${i}\` must be strings`);const[a,o,l]=r.args.map(d=>this.evaluate(d,n));let c;if(o){const d=n.tests.get(o.value);if(!d)throw new Error(`Unknown test: ${o.value}`);c=d}else c=(...d)=>d[0].__bool__().value;const u=t.value.filter(d=>{const f=d.value.get(a.value),h=f?c(f,l):!1;return s?h:!h});return new bn(u)}case"map":{const[,s]=this.evaluateArguments(r.args,n);if(s.has("attribute")){const a=s.get("attribute");if(!(a instanceof ft))throw new Error("attribute must be a string");const o=s.get("default"),l=t.value.map(c=>{if(!(c instanceof is))throw new Error("items in map must be an object");const u=G8(c,a.value);return u instanceof Nr?o??new Nr:u});return new bn(l)}else throw new Error("`map` expressions without `attribute` set are not currently supported.")}}throw new Error(`Unknown ArrayValue filter: ${i}`)}else if(t instanceof ft){switch(i){case"indent":{const[s,a]=this.evaluateArguments(r.args,n),o=s.at(0)??a.get("width")??new cn(4);if(!(o instanceof cn))throw new Error("width must be a number");const l=s.at(1)??a.get("first")??new Ht(!1),c=s.at(2)??a.get("blank")??new Ht(!1),u=t.value.split(` 508`),d=" ".repeat(o.value),f=u.map((h,p)=>!l.value&&p===0||!c.value&&h.length===0?h:d+h);return new ft(f.join(` 509`))}case"replace":{const s=t.builtins.get("replace");if(!(s instanceof Rr))throw new Error("replace filter not available");const[a,o]=this.evaluateArguments(r.args,n);return s.value([...a,new t_(o)],n)}}throw new Error(`Unknown StringValue filter: ${i}`)}else if(t instanceof is){const s=t.builtins.get(i);if(s&&s instanceof Rr){const[a,o]=this.evaluateArguments(r.args,n);return o.size>0&&a.push(new t_(o)),s.value(a,n)}throw new Error(`Unknown ObjectValue filter: ${i}`)}else throw new Error(`Cannot apply filter "${i}" to type: ${t.type}`)}throw new Error(`Unknown filter: ${e.type}`)}evaluateFilterExpression(t,e){const n=this.evaluate(t.operand,e);return this.applyFilter(n,t.filter,e)}evaluateTestExpression(t,e){const n=this.evaluate(t.operand,e),r=e.tests.get(t.test.value);if(!r)throw new Error(`Unknown test: ${t.test.value}`);const i=r(n);return new Ht(t.negate?!i:i)}evaluateSelectExpression(t,e){return this.evaluate(t.test,e).__bool__().value?this.evaluate(t.lhs,e):new Nr}evaluateUnaryExpression(t,e){const n=this.evaluate(t.argument,e);switch(t.operator.value){case"not":return new Ht(!n.value);default:throw new SyntaxError(`Unknown operator: ${t.operator.value}`)}}evaluateTernaryExpression(t,e){return this.evaluate(t.condition,e).__bool__().value?this.evaluate(t.trueExpr,e):this.evaluate(t.falseExpr,e)}evalProgram(t,e){return this.evaluateBlock(t.body,e)}evaluateBlock(t,e){let n="";for(const r of t){const i=this.evaluate(r,e);
509i.type!=="NullValue"&&i.type!=="UndefinedValue"&&(n+=i.toString())}return new ft(n)}evaluateIdentifier(t,e){return e.lookupVariable(t.value)}evaluateCallExpression(t,e){const[n,r]=this.evaluateArguments(t.args,e);r.size>0&&n.push(new t_(r));const i=this.evaluate(t.callee,e);if(i.type!=="FunctionValue")throw new Error(`Cannot call something that is not a function: got ${i.type}`);return i.value(n,e)}evaluateSliceExpression(t,e,n){if(!(t instanceof bn||t instanceof ft))throw new Error("Slice object must be an array or string");const r=this.evaluate(e.start,n),i=this.evaluate(e.stop,n),s=this.evaluate(e.step,n);if(!(r instanceof cn||r instanceof Nr))throw new Error("Slice start must be numeric or undefined");if(!(i instanceof cn||i instanceof Nr))throw new Error("Slice stop must be numeric or undefined");if(!(s instanceof cn||s instanceof Nr))throw new Error("Slice step must be numeric or undefined");return t instanceof bn?new bn(z8(t.value,r.value,i.value,s.value)):new ft(z8(Array.from(t.value),r.value,i.value,s.value).join(""))}evaluateMemberExpression(t,e){const n=this.evaluate(t.object,e);let r;if(t.computed){if(t.property.type==="SliceExpression")return this.evaluateSliceExpression(n,t.property,e);r=this.evaluate(t.property,e)}else r=new ft(t.property.value);let i;if(n instanceof is){if(!(r instanceof ft))throw new Error(`Cannot access property with non-string: got ${r.type}`);i=n.value.get(r.value)??n.builtins.get(r.value)}else if(n instanceof bn||n instanceof ft)if(r instanceof cn)i=n.value.at(r.value),n instanceof ft&&(i=new ft(n.value.at(r.value)));else if(r instanceof ft)i=n.builtins.get(r.value);else throw new Error(`Cannot access property with non-string/non-number: got ${r.type}`);else{if(!(r instanceof ft))throw new Error(`Cannot access property with non-string: got ${r.type}`);i=n.builtins.get(r.value)}return i instanceof lu?i:new Nr}evaluateSet(t,e){const n=t.value?this.evaluate(t.value,e):this.evaluateBlock(t.body,e);if(t.assignee.type==="Identifier"){const r=t.assignee.value;e.setVariable(r,n)}else if(t.assignee.type==="TupleLiteral"){const r=t.assignee;if(!(n instanceof bn))throw new Error(`Cannot unpack non-iterable type in set: ${n.type}`);const i=n.value;if(i.length!==r.value.length)throw new Error(`Too ${r.value.length>i.length?"few":"many"} items to unpack in set`);for(let s=0;s<r.value.length;++s){const a=r.value[s];if(a.type!=="Identifier")throw new Error(`Cannot unpack to non-identifier in set: ${a.type}`);e.setVariable(a.value,i[s])}}else if(t.assignee.type==="MemberExpression"){const r=t.assignee,i=this.evaluate(r.object,e);if(!(i instanceof is))throw new Error("Cannot assign to member of non-object");if(r.property.type!=="Identifier")throw new Error("Cannot assign to member with non-identifier property");i.value.set(r.property.value,n)}else throw new Error(`Invalid LHS inside assignment expression: ${JSON.stringify(t.assignee)}`);return new $r}evaluateIf(t,e){const n=this.evaluate(t.test,e);return this.evaluateBlock(n.__bool__().value?t.body:t.alternate,e)}evaluateFor(t,e){const n=new Kf(e);let r,i;if(t.iterable.type==="SelectExpression"){const c=t.iterable;i=this.evaluate(c.lhs,n),r=c.test}else i=this.evaluate(t.iterable,n);if(!(i instanceof bn||i instanceof is))throw new Error(`Expected iterable or object type in for loop: got ${i.type}`);i instanceof is&&(i=i.keys());const s=[],a=[];for(let c=0;c<i.value.length;++c){const u=new Kf(n),d=i.value[c];let f;if(t.loopvar.type==="Identifier")f=h=>h.setVariable(t.loopvar.value,d);else if(t.loopvar.type==="TupleLiteral"){const h=t.loopvar;if(d.type!=="ArrayValue")throw new Error(`Cannot unpack non-iterable type: ${d.type}`);const p=d;if(h.value.length!==p.value.length)throw new Error(`Too ${h.value.length>p.value.length?"few":"many"} items to unpack`);f=m=>{for(let g=0;g<h.value.length;++g){if(h.value[g].type!=="Identifier")throw new Error(`Cannot unpack non-identifier type: ${h.value[g].type}`);m.setVariable(h.value[g].value,p.value[g])}}}else throw new Error(`Invalid loop variable(s): ${t.loopvar.type}`);r&&(f(u),!this.evaluate(r,u).__bool__().value)||(s.push(d),a.push(f))}let o="",l=!0;for(let c=0;c<s.length;++c){const u=new Map([["index",new cn(c+1)],["index0",new cn(c)],["revindex",new cn(s.length-c)],["revindex0",new cn(s.length-c-1)],["first",new Ht(c===0)],["last",new Ht(c===s.length-1)],["length",new cn(s.length)],["previtem",c>0?s[c-1]:new Nr],["nextitem",c<s.length-1?s[c+1]:new Nr]]);n.setVariable("loop",new is(u)),a[c](n);try{const d=this.evaluateBlock(t.body,n);o+=d.value}catch(d){if(d instanceof V8)continue;if(d instanceof $8)break;throw d}l=!1}if(l){const c=this.evaluateBlock(t.defaultBlock,n);o+=c.value}return new ft(o)}evaluateMacro(t,e){return e.setVariable(t.name.value,new Rr((n,r)=>{var a;const i=new Kf(r);n=n.slice();let s;((a=n.at(-1))==null?void 0:a.type)==="KeywordArgumentsValue"&&(s=n.pop());for(let o=0;o<t.args.length;++o){const l=t.args[o],c=n[o];if(l.type==="Identifier"){const u=l;if(!c)throw new Error(`Missing positional argument: ${u.value}`);i.setVariable(u.value,c)}else if(l.type==="KeywordArgumentExpression"){const u=l,d=c??(s==null?void 0:s.value.get(u.key.value))??this.evaluate(u.value,i);i.setVariable(u.key.value,d)}else throw new Error(`Unknown argument type: ${l.type}`)}return this.evaluateBlock(t.body,i)})),new $r}
509evaluateCallStatement(t,e){const n=new Rr((o,l)=>{const c=new Kf(l);if(t.callerArgs)for(let u=0;u<t.callerArgs.length;++u){const d=t.callerArgs[u];if(d.type!=="Identifier")throw new Error(`Caller parameter must be an identifier, got ${d.type}`);c.setVariable(d.value,o[u]??new Nr)}return this.evaluateBlock(t.body,c)}),[r,i]=this.evaluateArguments(t.call.args,e);r.push(new t_(i));const s=this.evaluate(t.call.callee,e);if(s.type!=="FunctionValue")throw new Error(`Cannot call something that is not a function: got ${s.type}`);const a=new Kf(e);return a.setVariable("caller",n),s.value(r,a)}evaluateFilterStatement(t,e){const n=this.evaluateBlock(t.body,e);return this.applyFilter(n,t.filter,e)}evaluate(t,e){if(!t)return new Nr;switch(t.type){case"Program":return this.evalProgram(t,e);case"Set":return this.evaluateSet(t,e);case"If":return this.evaluateIf(t,e);case"For":return this.evaluateFor(t,e);case"Macro":return this.evaluateMacro(t,e);case"CallStatement":return this.evaluateCallStatement(t,e);case"Break":throw new $8;case"Continue":throw new V8;case"IntegerLiteral":return new cn(t.value);case"FloatLiteral":return new ui(t.value);case"StringLiteral":return new ft(t.value);case"ArrayLiteral":return new bn(t.value.map(n=>this.evaluate(n,e)));case"TupleLiteral":return new W8(t.value.map(n=>this.evaluate(n,e)));case"ObjectLiteral":{const n=new Map;for(const[r,i]of t.value){const s=this.evaluate(r,e);if(!(s instanceof ft))throw new Error(`Object keys must be strings: got ${s.type}`);n.set(s.value,this.evaluate(i,e))}return new is(n)}case"Identifier":return this.evaluateIdentifier(t,e);case"CallExpression":return this.evaluateCallExpression(t,e);case"MemberExpression":return this.evaluateMemberExpression(t,e);case"UnaryExpression":return this.evaluateUnaryExpression(t,e);case"BinaryExpression":return this.evaluateBinaryExpression(t,e);case"FilterExpression":return this.evaluateFilterExpression(t,e);case"FilterStatement":return this.evaluateFilterStatement(t,e);case"TestExpression":return this.evaluateTestExpression(t,e);case"SelectExpression":return this.evaluateSelectExpression(t,e);case"Ternary":return this.evaluateTernaryExpression(t,e);case"Comment":return new $r;default:throw new SyntaxError(`Unknown node type: ${t.type}`)}}};function vx(t){switch(typeof t){case"number":return Number.isInteger(t)?new cn(t):new ui(t);case"string":return new ft(t);case"boolean":return new Ht(t);case"undefined":return new Nr;case"object":return t===null?new $r:Array.isArray(t)?new bn(t.map(vx)):new is(new Map(Object.entries(t).map(([e,n])=>[e,vx(n)])));case"function":return new Rr((e,n)=>{const r=t(...e.map(i=>i.value))??null;return vx(r)});default:throw new Error(`Cannot convert to runtime value: ${t}`)}}var Hi=` 510`,hbe="{%- ",fbe=" -%}";function pbe(t){switch(t.operator.type){case"MultiplicativeBinaryOperator":return 4;case"AdditiveBinaryOperator":return 3;case"ComparisonBinaryOperator":return 2;case"Identifier":return t.operator.value==="and"?1:t.operator.value==="in"||t.operator.value==="not in"?2:0}return 0}function mbe(t,e=" "){const n=typeof e=="number"?" ".repeat(e):e;return ec(t.body,0,n).replace(/\n$/,"")}function Ts(...t){return hbe+t.join(" ")+fbe}function ec(t,e,n){return t.map(r=>gbe(r,e,n)).join(Hi)}function gbe(t,e,n){const r=n.repeat(e);switch(t.type){case"Program":return ec(t.body,e,n);case"If":return vbe(t,e,n);case"For":return ybe(t,e,n);case"Set":return _be(t,e,n);case"Macro":return wbe(t,e,n);case"Break":return r+Ts("break");case"Continue":return r+Ts("continue");case"CallStatement":return bbe(t,e,n);case"FilterStatement":return xbe(t,e,n);case"Comment":return r+"{# "+t.value+" #}";default:return r+"{{- "+En(t)+" -}}"}}function vbe(t,e,n){const r=n.repeat(e),i=[];let s=t;for(;s&&(i.push({test:s.test,body:s.body}),s.alternate.length===1&&s.alternate[0].type==="If");)s=s.alternate[0];let a=r+Ts("if",En(i[0].test))+Hi+ec(i[0].body,e+1,n);for(let o=1;o<i.length;++o)a+=Hi+r+Ts("elif",En(i[o].test))+Hi+ec(i[o].body,e+1,n);return s&&s.alternate.length>0&&(a+=Hi+r+Ts("else")+Hi+ec(s.alternate,e+1,n)),a+=Hi+r+Ts("endif"),a}function ybe(t,e,n){const r=n.repeat(e);let i="";if(t.iterable.type==="SelectExpression"){const a=t.iterable;i=`${En(a.lhs)} if ${En(a.test)}`}else i=En(t.iterable);let s=r+Ts("for",En(t.loopvar),"in",i)+Hi+ec(t.body,e+1,n);return t.defaultBlock.length>0&&(s+=Hi+r+Ts("else")+Hi+ec(t.defaultBlock,e+1,n)),s+=Hi+r+Ts("endfor"),s}function _be(t,e,n){const r=n.repeat(e),i=En(t.assignee),s=t.value?En(t.value):"",a=r+Ts("set",`${i}${t.value?" = "+s:""}`);return t.body.length===0?a:a+Hi+ec(t.body,e+1,n)+Hi+r+Ts("endset")}function wbe(t,e,n){const r=n.repeat(e),i=t.args.map(En).join(", ");return r+Ts("macro",`${t.name.value}(${i})`)+Hi+ec(t.body,e+1,n)+Hi+r+Ts("endmacro")}function bbe(t,e,n){const r=n.repeat(e),i=t.callerArgs&&t.callerArgs.length>0?`(${t.callerArgs.map(En).join(", ")})`:"",s=En(t.call);let a=r+Ts(`call${i}`,s)+Hi;return a+=ec(t.body,e+1,n)+Hi,a+=r+Ts("endcall"),a}function xbe(t,e,n){const r=n.repeat(e),i=t.filter.type==="Identifier"?t.filter.value:En(t.filter);let s=r+Ts("filter",i)+Hi;return s+=ec(t.body,e+1,n)+Hi,s+=r+Ts("endfilter"),s}function En(t,e=-1){switch(t.type){case"SpreadExpression":return`*${En(t.argument)}`;case"Identifier":return t.value;case"IntegerLiteral":return`${t.value}`;case"FloatLiteral":return`${t.value}`;case"StringLiteral":return JSON.stringify(t.value);case"BinaryExpression":{const n=t,r=pbe(n),i=En(n.left,r),s=En(n.right,r+1),a=`${i} ${n.operator.value} ${s}`;return r<e?`(${a})`:a}case"UnaryExpression":{const n=t;return n.operator.value+(n.operator.value==="not"?" ":"")+En(n.argument,1/0)}case"CallExpression":{const n=t,r=n.args.map(En).join(", ");return`${En(n.callee)}(${r})`}case"MemberExpression":{const n=t;let r=En(n.object);["Identifier","MemberExpression","CallExpression","StringLiteral","IntegerLiteral","FloatLiteral","ArrayLiteral","TupleLiteral","ObjectLiteral"].includes(n.object.type)||(r=`(${r})`);let i=En(n.property);return!n.computed&&n.property.type!=="Identifier"&&(i=`(${i})`),n.computed?`${r}[${i}]`:`${r}.${i}`}case"FilterExpression":{const n=t,r=En(n.operand,1/0);return n.filter.type==="CallExpression"?`${r} | ${En(n.filter)}`:`${r} | ${n.filter.value}`}case"SelectExpression":{const n=t;return`${En(n.lhs)} if ${En(n.test)}`}case"TestExpression":{const n=t;return`${En(n.operand)} is${n.negate?" not":""} ${n.test.value}`}case"ArrayLiteral":case"TupleLiteral":{const n=t.value.map(En),r=t.type==="ArrayLiteral"?"[]":"()";return`${r[0]}${n.join(", ")}${r[1]}`}case"ObjectLiteral":return`{${Array.from(t.value.entries()).map(([r,i])=>`${En(r)}: ${En(i)}`).join(", ")}}`;case"SliceExpression":{const n=t,r=n.start?En(n.start):"",i=n.stop?En(n.stop):"",s=n.step?`:${En(n.step)}`:"";return`${r}:${i}${s}`}case"KeywordArgumentExpression":{const n=t;return`${n.key.value}=${En(n.value)}`}
510case"Ternary":{const n=t,r=`${En(n.trueExpr)} if ${En(n.condition,0)} else ${En(n.falseExpr)}`;return e>-1?`(${r})`:r}default:throw new Error(`Unknown expression type: ${t.type}`)}}var kbe=class{constructor(t){X(this,"parsed");const e=R1e(t,{lstrip_blocks:!0,trim_blocks:!0});this.parsed=nbe(e)}render(t){const e=new Kf;if(ube(e),t)for(const[i,s]of Object.entries(t))e.set(i,s);return new dbe(e).run(this.parsed).value}format(t){return mbe(this.parsed,(t==null?void 0:t.indent)||" ")}},Sbe={txt:"text/plain",html:"text/html",css:"text/css",js:"text/javascript",json:"application/json",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif"},Zk=class gK{constructor(e){if(this.filePath=e,this.headers=new Headers,this.exists=yo.existsSync(e),this.exists){this.status=200,this.statusText="OK";let n=yo.statSync(e);this.headers.set("content-length",n.size.toString()),this.updateContentType();const r=yo.createReadStream(e);this.body=new ReadableStream({start(i){r.on("data",s=>i.enqueue(s)),r.on("end",()=>i.close()),r.on("error",s=>i.error(s))},cancel(){r.destroy()}})}else this.status=404,this.statusText="Not Found",this.body=null}updateContentType(){const e=this.filePath.toString().split(".").pop().toLowerCase();this.headers.set("content-type",Sbe[e]??"application/octet-stream")}clone(){let e=new gK(this.filePath);return e.exists=this.exists,e.status=this.status,e.statusText=this.statusText,e.headers=new Headers(this.headers),e}async arrayBuffer(){return(await yo.promises.readFile(this.filePath)).buffer}async blob(){const e=await yo.promises.readFile(this.filePath);return new Blob([e],{type:this.headers.get("content-type")})}async text(){return await yo.promises.readFile(this.filePath,"utf8")}async json(){return JSON.parse(await this.text())}},xT=class{constructor(t){this._mt=new Uint32Array(624),this._idx=625,this._gauss_next=null,this._random_fn=this.random.bind(this),this.seed(t)}seed(t){if(t==null)if(vn.IS_CRYPTO_AVAILABLE){const a=new Uint32Array(1);crypto.getRandomValues(a),t=a[0]}else t=Date.now()>>>0;const e=this._mt,n=(a,o)=>Math.imul(a,o)>>>0,r=[];for(let a=t||0;a>0;a=Math.floor(a/4294967296))r.push(a&4294967295);r.length||r.push(0),e[0]=19650218;for(let a=1;a<624;++a)e[a]=n(1812433253,e[a-1]^e[a-1]>>>30)+a>>>0;let i=1,s=0;for(let a=Math.max(624,r.length);a>0;--a,++i,++s)i>=624&&(e[0]=e[623],i=1),s>=r.length&&(s=0),e[i]=(e[i]^n(e[i-1]^e[i-1]>>>30,1664525))+r[s]+s>>>0;for(let a=623;a>0;--a,++i)i>=624&&(e[0]=e[623],i=1),e[i]=(e[i]^n(e[i-1]^e[i-1]>>>30,1566083941))-i>>>0;e[0]=2147483648,this._idx=624,this._gauss_next=null}_int32(){const t=this._mt;if(this._idx>=624){for(let n=0;n<624;++n){const r=t[n]&2147483648|t[(n+1)%624]&2147483647;t[n]=(t[(n+397)%624]^r>>>1^(r&1?2567483615:0))>>>0}this._idx=0}let e=t[this._idx++];return e^=e>>>11,e^=e<<7&2636928640,e^=e<<15&4022730752,e^=e>>>18,e>>>0}random(){return((this._int32()>>>5)*67108864+(this._int32()>>>6))/9007199254740992}gauss(t=0,e=1){let n=this._gauss_next;if(this._gauss_next=null,n===null){const r=this.random()*2*Math.PI,i=Math.sqrt(-2*Math.log(1-this.random()));n=Math.cos(r)*i,this._gauss_next=Math.sin(r)*i}return t+n*e}shuffle(t){for(let e=t.length-1;e>0;--e){const n=32-Math.clz32(e+1);let r=this._int32()>>>32-n;for(;r>e;)r=this._int32()>>>32-n;const i=t[e];t[e]=t[r],t[r]=i}}choices(t,e){return t[vK(this._random_fn,e)]}};function vK(t,e){let n=0;for(let i=0;i<e.length;++i)n+=e[i];let r=t()*n;for(let i=0;i<e.length;++i)if(r-=e[i],r<0)return i;return e.length-1}var Ec=new xT,RI=Object.freeze({Random:xT,seed:Ec.seed.bind(Ec),random:Ec.random.bind(Ec),gauss:Ec.gauss.bind(Ec),shuffle:Ec.shuffle.bind(Ec),choices:Ec.choices.bind(Ec)}),Tbe=t=>vK(RI.random,t),Cbe=new xT,yK=class{constructor(t){this.path=t}async match(t){let e=Gc.join(this.path,t),n=new Zk(e);if(n.exists)return n}async put(t,e,n=void 0){const r=Gc.join(this.path,t),i=vn.IS_PROCESS_AVAILABLE?process.pid:Date.now(),s=Cbe._int32().toString(36),a=r+`.tmp.${i}.${s}`;try{const o=e.headers.get("Content-Length"),l=parseInt(o??"0");let c=0;await yo.promises.mkdir(Gc.dirname(r),{recursive:!0});const u=yo.createWriteStream(a),d=e.body.getReader();for(;;){const{done:f,value:h}=await d.read();if(f)break;await new Promise((m,g)=>{u.write(h,v=>{if(v){g(v);return}m()})}),c+=h.length;const p=l?c/l*100:0;n==null||n({progress:p,loaded:c,total:l})}await new Promise((f,h)=>{u.close(p=>
510p?h(p):f())}),await yo.promises.rename(a,r)}catch(o){try{await yo.promises.unlink(a)}catch{}throw o}}async delete(t){let e=Gc.join(this.path,t);try{return await yo.promises.unlink(e),!0}catch{return!1}}},Ebe={400:"Bad request error occurred while trying to load file",401:"Unauthorized access to file",403:"Forbidden access to file",404:"Could not locate file",408:"Request timeout error occurred while trying to load file",500:"Internal server error error occurred while trying to load file",502:"Bad gateway error occurred while trying to load file",503:"Service unavailable error occurred while trying to load file",504:"Gateway timeout error occurred while trying to load file"},H8=100,Abe=/^(\b[\w\-.]+\b\/)?\b[\w\-.]{1,96}\b$/;function n2(...t){return t=t.map((e,n)=>(n&&(e=e.replace(new RegExp("^/"),"")),n!==t.length-1&&(e=e.replace(new RegExp("/$"),"")),e)),t.join("/")}function h0(t,e=null,n=null){let r;try{r=new URL(t)}catch{return!1}return!(e&&!e.includes(r.protocol)||n&&!n.includes(r.hostname))}function Pbe(t){return!(!Abe.test(t)||t.includes("..")||t.includes("--")||t.endsWith(".git")||t.endsWith(".ipynb"))}function Mbe(t,e,n){if(!n)return null;const r=Ebe[t]??`Error (${t}) occurred while trying to load file`;throw Error(`${r}: "${e}".`)}async function Nbe(t,e,n){const r=t.headers.get("Content-Length");let i=r?parseInt(r,10):n??0;r===null&&!n&&en.warn("Unable to determine content-length from response headers. Will expand buffer when needed.");let s=new Uint8Array(i),a=0;const o=t.body.getReader();async function l(){const{done:c,value:u}=await o.read();if(c)return;const d=a+u.length;if(d>i){i=d;const h=new Uint8Array(i);h.set(s),s=h}s.set(u,a),a=d;const f=a/i*100;return e({progress:f,loaded:a,total:i}),l()}return await l(),s}function K8(t){return h0(t,["blob:"])}function J8(t){let e;if(typeof location<"u"&&location.href)e=location.href;else if(typeof import.meta<"u"&&import.meta.url)e=import.meta.url;else return t;return new URL(t,e).href}var _K="SHA-256",Rbe="experimental_transformers-hash-cache",Y8=t=>({algorithm:_K,value:t}),Yw,uA,X8=(uA=class{constructor(){Rn(this,Yw,null);X(this,"_getHashCache",()=>(Pe(this,Yw)??Zt(this,Yw,caches.open(Rbe)),Pe(this,Yw)));X(this,"match",async t=>{const e=await this._getFileHash(t);if(e)try{const[n]=await navigator.crossOriginStorage.requestFileHandles([Y8(e)]),r=await n.getFile();return new Response(r,{headers:{"Content-Length":String(r.size)}})}catch{return}});X(this,"put",async(t,e)=>{const n=await this._getFileHash(t);if(n){const r=await e.blob();await this._storeBlobInCOS(r,n)}else this._processAndStore(t,e.body)});X(this,"_storeBlobInCOS",async(t,e)=>{const[n]=await navigator.crossOriginStorage.requestFileHandles([Y8(e)],{create:!0}),r=await n.createWritable();await r.write(t),await r.close()});X(this,"_processAndStore",async(t,e)=>{try{const n=[];for await(const s of e)n.push(s);const r=new Blob(n),i=await this._getBlobHash(r);await this._storeBlobInCOS(r,i);try{await(await this._getHashCache()).put(t,new Response(i))}catch{}}catch{}});X(this,"delete",async t=>{try{return await(await this._getHashCache()).delete(t)}catch{return!1}});X(this,"_getFileHash",async t=>{try{const e=await this._getHashCache(),n=await e.match(t);if(n)return n.text();const r=await this._getLfsFileHash(t);return r?(await e.put(t,new Response(r)),r):null}catch{return null}});X(this,"_getLfsFileHash",async t=>{if(!t.includes("/resolve/"))return null;const e=t.replace("/resolve/","/raw/");try{const r=(await fetch(e).then(i=>i.text())).match(/^oid sha256:([0-9a-f]+)$/m);return r?r[1]:null}catch{return null}});X(this,"_getBlobHash",async t=>{const e=await t.arrayBuffer(),n=await crypto.subtle.digest(_K,e);return Array.from(new Uint8Array(n)).map(i=>i.toString(16).padStart(2,"0")).join("")})}},Yw=new WeakMap,X(uA,"isAvailable",()=>typeof navigator<"u"&&"crossOriginStorage"in navigator),uA);async function II(t=null){let e=null;if(On.useCustomCache){if(!On.customCache)throw Error("`env.useCustomCache=true`, but `env.customCache` is not defined.");if(!On.customCache.match||!On.customCache.put)throw new Error("`env.customCache` must be an object which implements the `match` and `put` functions of the Web Cache API. For more information, see https://developer.mozilla.org/en-US/docs/Web/API/Cache");e=On.customCache}if(!e&&On.experimental_useCrossOriginStorage&&X8.isAvailable()&&(e=new X8),!e&&O
510n.useBrowserCache){if(typeof caches>"u")throw Error("Browser cache is not available in this environment.");try{e=await caches.open(On.cacheKey)}catch(n){en.warn("An error occurred while opening the browser cache:",n)}}if(!e&&On.useFSCache){if(!vn.IS_FS_AVAILABLE)throw Error("File System Cache is not available in this environment.");e=new yK(t??On.cacheDir)}return e}async function Ibe(t,...e){for(let n of e)try{let r=await t.match(n);if(r)return r}catch{continue}}var Xw,Ks,Xz,Lbe=(Xz=class{constructor(t){Rn(this,Xw);Rn(this,Ks);Zt(this,Xw,t),Zt(this,Ks,new Map)}get(t){if(!Pe(this,Ks).has(t))return;const e=Pe(this,Ks).get(t);return Pe(this,Ks).delete(t),Pe(this,Ks).set(t,e),e}put(t,e){Pe(this,Ks).has(t)&&Pe(this,Ks).delete(t),Pe(this,Ks).set(t,e),Pe(this,Ks).size>Pe(this,Xw)&&Pe(this,Ks).delete(Pe(this,Ks).keys().next().value)}delete(t){return Pe(this,Ks).delete(t)}clear(){Pe(this,Ks).clear()}},Xw=new WeakMap,Ks=new WeakMap,Xz),Obe=100,W5=new Lbe(Obe);function wK(t,e){const n=W5.get(t);if(n!==void 0)return n;const r=e().then(i=>i,i=>(W5.delete(t),Promise.reject(i)));return W5.put(t,r),r}async function Dbe(t){if(!h0(t,["http:","https:"]))return null;const e=bK(t);return e.set("Range","bytes=0-0"),On.fetch(t,{method:"GET",headers:e,cache:"no-store"})}function y1(t,e,n={}){const r=JSON.stringify([t,e,n==null?void 0:n.revision,n==null?void 0:n.cache_dir,n==null?void 0:n.local_files_only]);return wK(r,()=>Fbe(t,e,n))}async function Fbe(t,e,n){var c;const r=await II(n==null?void 0:n.cache_dir),{localPath:i,remoteURL:s,proposedCacheKey:a,validModelId:o}=xK(t,e,n,r),l=await kK(r,i,a);if(l!==void 0&&typeof l!="string"){const u=l.headers.get("content-length"),d=l.headers.get("content-type");return{exists:!0,size:u?parseInt(u,10):void 0,contentType:d||void 0,fromCache:!0}}if(On.allowLocalModels&&!h0(i,["http:","https:"]))try{const d=await Cw(i);if(typeof d!="string"&&d.status!==404){const f=d.headers.get("content-length"),h=d.headers.get("content-type");return{exists:!0,size:f?parseInt(f,10):void 0,contentType:h||void 0,fromCache:!1}}}catch{}if(On.allowRemoteModels&&!n.local_files_only&&o)try{const u=await Dbe(s);if(u&&u.status>=200&&u.status<300){let d;const f=u.headers.get("content-type");if(u.status===206){const h=u.headers.get("content-range");if(h){const p=h.match(/bytes \d+-\d+\/(\d+)/);
510p&&(d=parseInt(p[1],10))}}else if(u.status===200)try{await((c=u.body)==null?void 0:c.cancel())}catch{}if(d===void 0){const h=u.headers.get("content-length");d=h?parseInt(h,10):void 0}return{exists:!0,size:d,contentType:f||void 0,fromCache:!1}}}catch(u){en.warn(`Unable to fetch file metadata for "${s}": ${u}`)}return{exists:!1,fromCache:!1}}async function Cw(t){return On.useFS&&!h0(t,["http:","https:","blob:"])?new Zk(t instanceof URL?t.protocol==="file:"?t.pathname:t.toString():t):On.fetch(t,{headers:bK(t)})}function bK(t){var r;const e=typeof process<"u"&&((r=process==null?void 0:process.release)==null?void 0:r.name)==="node",n=new Headers;if(e){const i=!!(Du!=null&&Du.TESTING_REMOTELY),s=On.version;if(n.set("User-Agent",`transformers.js/${s}; is_ci/${i};`),h0(t,["http:","https:"],["huggingface.co","hf.co"])){const o=(Du==null?void 0:Du.HF_TOKEN)??(Du==null?void 0:Du.HF_ACCESS_TOKEN);o&&n.set("Authorization",`Bearer ${o}`)}}return n}function xK(t,e,n={},r=null){const i=n.revision??"main",s=n2(t,e),a=Pbe(t),o=a?n2(On.localModelPath,s):s,l=n2(On.remoteHost,On.remotePathTemplate.replaceAll("{model}",t).replaceAll("{revision}",encodeURIComponent(i)),e),c=r instanceof yK?i==="main"?s:n2(t,i,e):l;return{requestURL:s,localPath:o,remoteURL:l,proposedCacheKey:c,validModelId:a}}async function kK(t,e,n){if(t)return await Ibe(t,e,n)}async function jbe(t,e,n,r,i,s,a={}){if(await n.match(r)===void 0)if(s){if(typeof i!="string"){const o=new Headers(i.headers);o.set("content-length",s.byteLength.toString()),await n.put(r,new Response(s,{headers:o})).catch(l=>{en.warn(`Unable to add response to browser cache: ${l}.`)})}}else{const o=a.progress_callback?l=>hh(a.progress_callback,{status:"progress",name:t,file:e,...l}):void 0;await n.put(r,i,o)}}async function Bbe(t,e,n=!0,r={},i=!1,s=null){const{requestURL:a,localPath:o,remoteURL:l,proposedCacheKey:c,validModelId:u}=xK(t,e,r,s);let d,f=!1,h;h=await kK(s,o,c);const p=h!==void 0;if(p)d=c;else{if(On.allowLocalModels)if(h0(a,["http:","https:"])){if(r.local_files_only)throw new Error(`\`local_files_only=true\`, but attempted to load a remote file from: ${a}.`);if(!On.allowRemoteModels)throw new Error(`\`env.allowRemoteModels=false\`, but attempted to load a remote file from: ${a}.`)}else try{h=await Cw(o),d=o}catch(_){en.warn(`Unable to load from local path "${o}": "${_}"`)}if(h===void 0||typeof h!="string"&&h.status===404){if(r.local_files_only||!On.allowRemoteModels){if(n)throw Error(`\`local_files_only=true\` or \`env.allowRemoteModels=false\` and file was not found locally at "${o}".`);return null}if(!u)throw Error(`Local file missing at "${o}" and download aborted due to invalid model ID "${t}".`);if(h=await Cw(l),h.status!==200)return Mbe(h.status,l,n);d=c}f=s&&typeof Response<"u"&&h instanceof Response&&h.status===200}hh(r.progress_callback,{status:"download",name:t,file:e});let m;if(!(vn.IS_NODE_ENV&&i)){let v;if(typeof h!="string")if(!r.progress_callback)v=new Uint8Array(await h.arrayBuffer());else if(p&&typeof navigator<"u"&&/firefox/i.test(navigator.userAgent))v=new Uint8Array(await h.arrayBuffer()),hh(r.progress_callback,{status:"progress",name:t,file:e,progress:100,loaded:v.length,total:v.length});else{let _;const b=h.headers.get("content-length");if(b)_=parseInt(b,10);else try{const x=await y1(t,e,r);x.size&&(_=x.size)}catch{}v=await Nbe(h,x=>{hh(r.progress_callback,{status:"progress",name:t,file:e,...x})},_)}m=v}if(f&&d&&typeof h!="string"&&await jbe(t,e,s,d,h,m,r),vn.IS_NODE_ENV&&i&&r.progress_callback&&typeof h!="string"){const v=parseInt(h.headers.get("content-length"),10)||0;hh(r.progress_callback,{status:"progress",name:t,file:e,progress:100,loaded:v,total:v})}if(hh(r.progress_callback,{status:"done",name:t,file:e}),m){if(!vn.IS_NODE_ENV&&i)throw new Error("Cannot return path in a browser environment.");return m}if(h instanceof Zk)return h.filePath;const g=await(s==null?void 0:s.match(d));if(g instanceof Zk)return g.filePath;if(g instanceof Response)return new Uint8Array(await g.arrayBuffer());if(typeof g=="string")return g;throw new Error("Unable to get model file path or buffer.")}var r2=new Map;async function eS(t,e,n=!0,r={}
510,i=!1){if(!On.allowLocalModels){if(r.local_files_only)throw Error("Invalid configuration detected: local models are disabled (`env.allowLocalModels=false`) but you have requested to only use local models (`local_files_only=true`).");if(!On.allowRemoteModels)throw Error("Invalid configuration detected: both local and remote models are disabled. Fix by setting `env.allowLocalModels` or `env.allowRemoteModels` to `true`.")}hh(r.progress_callback,{status:"initiate",name:t,file:e});const s=`${t}::${e}`;let a=r2.get(s);if(!a){const o=await II(r==null?void 0:r.cache_dir);a=Bbe(t,e,n,r,i,o).then(l=>(r2.delete(s),l),l=>{throw r2.delete(s),l}),r2.set(s,a)}return await a}async function LI(t,e,n=!0,r={}){const i=await eS(t,e,n,r,!1);return i===null?null:new TextDecoder("utf-8").decode(i)}async function cu(t,e,n=!0,r={}){const i=await LI(t,e,n,r);return i===null?{}:JSON.parse(i)}function Ube(t,[e,n,r],[i,s],a="bilinear",o=!1){const l=s/r,c=i/n,u=new t.constructor(i*s*e),d=n*r,f=i*s;for(let h=0;h<i;++h)for(let p=0;p<s;++p){const m=h*s+p,g=(p+.5)/l-.5,v=(h+.5)/c-.5;let _=Math.floor(g),b=Math.floor(v);const x=Math.min(_+1,r-1),T=Math.min(b+1,n-1);_=Math.max(_,0),b=Math.max(b,0);const N=g-_,A=v-b,L=(1-N)*(1-A),M=N*(1-A),B=(1-N)*A,R=N*A,j=b*r,$=T*r,U=j+_,te=j+x,ne=$+_,le=$+x;for(let V=0;V<e;++V){const q=V*d;u[V*f+m]=L*t[q+U]+M*t[q+te]+B*t[q+ne]+R*t[q+le]}}return u}function zbe(t,e,n){const r=new Array(n.length),i=new Array(n.length);for(let o=n.length-1,l=1;o>=0;--o)i[o]=l,r[o]=e[n[o]],l*=r[o];const s=n.map((o,l)=>i[n.indexOf(l)]),a=new t.constructor(t.length);for(let o=0;o<t.length;++o){let l=0;for(let c=e.length-1,u=o;c>=0;--c)l+=u%e[c]*s[c],u=Math.floor(u/e[c]);a[l]=t[o]}return[a,r]}function Ms(t){const e=Pi(t)[0],n=t.map(s=>Math.exp(s-e)),r=n.reduce((s,a)=>s+a,0);return n.map(s=>s/r)}function $be(t){const e=Pi(t)[0];let n=0;for(let s=0;s<t.length;++s)n+=Math.exp(t[s]-e);const r=Math.log(n);return t.map(s=>s-e-r)}function YM(t){if(t.length===0)throw Error("Array must not be empty");let e=t[0],n=0;for(let r=1;r<t.length;++r)t[r]<e&&(e=t[r],n=r);return[e,n]}function Pi(t){if(t.length===0)throw Error("Array must not be empty");let e=t[0],n=0;for(let r=1;r<t.length;++r)t[r]>e&&(e=t[r],n=r);return[e,n]}function SK(t){return t>0&&(t&t-1)===0}var TK=class{constructor(t){if(this.size=t|0,this.size<=1||!SK(this.size))throw new Error("FFT size must be a power of two larger than 1");this._csize=t<<1,this.table=new Float64Array(this.size*2);for(let n=0;n<this.table.length;n+=2){const r=Math.PI*n/this.size;this.table[n]=Math.cos(r),this.table[n+1]=-Math.sin(r)}let e=0;for(let n=1;this.size>n;n<<=1)++e;this._width=e%2===0?e-1:e,this._bitrev=new Int32Array(1<<this._width);for(let n=0;n<this._bitrev.length;++n){this._bitrev[n]=0;for(let r=0;r<this._width;r+=2){const i=this._width-r-2;this._bitrev[n]|=(n>>>r&3)<<i}}}createComplexArray(){return new Float64Array(this._csize)}fromComplexArray(t,e){const n=e||new Array(t.length>>>1);for(let r=0;r<t.length;r+=2)n[r>>>1]=t[r];return n}toComplexArray(t,e){const n=e||this.createComplexArray();for(let r=0;r<n.length;r+=2)n[r]=t[r>>>1],n[r+1]=0;return n}transform(t,e){if(t===e)throw new Error("Input and output buffers must be different");this._transform4(t,e,1)}realTransform(t,e){if(t===e)throw new Error("Input and output buffers must be different");this._realTransform4(t,e,1)}inverseTransform(t,e){if(t===e)throw new Error("Input and output buffers must be different");this._transform4(t,e,-1);for(let n=0;n<t.length;++n)t[n]/=this.size}_transform4(t,e,n){const r=this._csize;let s=1<<this._width,a=r/s<<1,o,l;const c=this._bitrev;if(a===4)for(o=0,l=0;o<r;o+=a,++l){const d=c[l];this._singleTransform2(e,t,o,d,s)}else for(o=0,l=0;o<r;o+=a,++l){const d=c[l];this._singleTransform4(e,t,o,d,s,n)}const u=this.table;for(s>>=2;s>=2;s>>=2){a=r/s<<1;const d=a>>>2;for(o=0;o<r;o+=a){const f=o+d-1;for(let h=o,p=0;h<f;h+=2,p+=s){const m=h,g=m+d,v=g+d,_=v+d,b=t[m],x=t[m+1],T=t[g],N=t[g+1],A=t[v],L=t[v+1],M=t[_],B=t[_+1],R=u[p],j=n*u[p+1],$=T*R-N*j,U=T*j+N*R,te=u[2*p],ne=n*u[2*p+1],le=A*te-L*ne,V=A*ne+L*te,q=u[3*p],se=n*u[3*p+1],he=M*q-B*se,z=M*se+B*q,J=b+le,Y=x+V,de=b-le,fe=x-V,me=$+he,Ce=U+z,Ee=n*($-he),Ae=n*(U-z);
vendor: 4,095 bytes, line 510
510t[m]=J+me,t[m+1]=Y+Ce,t[g]=de+Ae,t[g+1]=fe-Ee,t[v]=J-me,t[v+1]=Y-Ce,t[_]=de-Ae,t[_+1]=fe+Ee}}}}_singleTransform2(t,e,n,r,i){const s=t[r],a=t[r+1],o=t[r+i],l=t[r+i+1];e[n]=s+o,e[n+1]=a+l,e[n+2]=s-o,e[n+3]=a-l}_singleTransform4(t,e,n,r,i,s){const a=i*2,o=i*3,l=t[r],c=t[r+1],u=t[r+i],d=t[r+i+1],f=t[r+a],h=t[r+a+1],p=t[r+o],m=t[r+o+1],g=l+f,v=c+h,_=l-f,b=c-h,x=u+p,T=d+m,N=s*(u-p),A=s*(d-m);e[n]=g+x,e[n+1]=v+T,e[n+2]=_+A,e[n+3]=b-N,e[n+4]=g-x,e[n+5]=v-T,e[n+6]=_-A,e[n+7]=b+N}_realTransform4(t,e,n){const r=this._csize;let s=1<<this._width,a=r/s<<1,o,l;const c=this._bitrev;if(a===4)for(o=0,l=0;o<r;o+=a,++l){const f=c[l];this._singleRealTransform2(e,t,o,f>>>1,s>>>1)}else for(o=0,l=0;o<r;o+=a,++l){const f=c[l];this._singleRealTransform4(e,t,o,f>>>1,s>>>1,n)}const u=this.table;for(s>>=2;s>=2;s>>=2){a=r/s<<1;const f=a>>>1,h=f>>>1,p=h>>>1;for(o=0;o<r;o+=a)for(let m=0,g=0;m<=p;m+=2,g+=s){const v=o+m,_=v+h,b=_+h,x=b+h,T=t[v],N=t[v+1],A=t[_],L=t[_+1],M=t[b],B=t[b+1],R=t[x],j=t[x+1],$=T,U=N,te=u[g],ne=n*u[g+1],le=A*te-L*ne,V=A*ne+L*te,q=u[2*g],se=n*u[2*g+1],he=M*q-B*se,z=M*se+B*q,J=u[3*g],Y=n*u[3*g+1],de=R*J-j*Y,fe=R*Y+j*J,me=$+he,Ce=U+z,Ee=$-he,Ae=U-z,De=le+de,Fe=V+fe,Re=n*(le-de),Je=n*(V-fe);if(t[v]=me+De,t[v+1]=Ce+Fe,t[_]=Ee+Je,t[_+1]=Ae-Re,m===0){t[b]=me-De,t[b+1]=Ce-Fe;continue}if(m===p)continue;const re=o+h-m,Ye=o+f-m;t[re]=Ee-n*Je,t[re+1]=-Ae-n*Re,t[Ye]=me-n*De,t[Ye+1]=-Ce+n*Fe}}const d=r>>>1;for(let f=2;f<d;f+=2)t[r-f]=t[f],t[r-f+1]=-t[f+1]}_singleRealTransform2(t,e,n,r,i){const s=t[r],a=t[r+i];e[n]=s+a,e[n+1]=0,e[n+2]=s-a,e[n+3]=0}_singleRealTransform4(t,e,n,r,i,s){const a=i*2,o=i*3,l=t[r],c=t[r+i],u=t[r+a],d=t[r+o],f=l+u,h=l-u,p=c+d,m=s*(c-d);e[n]=f+p,e[n+1]=0,e[n+2]=h,e[n+3]=-m,e[n+4]=f-p,e[n+5]=0,e[n+6]=h,e[n+7]=m}},Vbe=class{constructor(t){const e=2*(t-1),n=2*(2*t-1),r=2**Math.ceil(Math.log2(n));this.bufferSize=r,this._a=e;const i=new Float64Array(n),s=new Float64Array(r);this._chirpBuffer=new Float64Array(r),this._buffer1=new Float64Array(r),this._buffer2=new Float64Array(r),this._outBuffer1=new Float64Array(r),this._outBuffer2=new Float64Array(r);const a=-2*Math.PI/t,o=Math.cos(a),l=Math.sin(a);for(let c=0;c<n>>1;++c){const u=(c+1-t)**2/2,d=Math.sqrt(o**2+l**2)**u,f=u*Math.atan2(l,o),h=2*c;i[h]=d*Math.cos(f),i[h+1]=d*Math.sin(f),s[h]=i[h],s[h+1]=-i[h+1]}this._slicedChirpBuffer=i.subarray(e,n),this._f=new TK(r>>1),this._f.transform(this._chirpBuffer,s)}_transform(t,e,n){const r=this._buffer1,i=this._buffer2,s=this._outBuffer1,a=this._outBuffer2,o=this._chirpBuffer,l=this._slicedChirpBuffer,c=this._a;if(n)for(let u=0;u<l.length;u+=2){const d=u+1,f=u>>1,h=e[f];r[u]=h*l[u],r[d]=h*l[d]}else for(let u=0;u<l.length;u+=2){const d=u+1;r[u]=e[u]*l[u]-e[d]*l[d],r[d]=e[u]*l[d]+e[d]*l[u]}this._f.transform(s,r);for(let u=0;u<o.length;u+=2){const d=u+1;i[u]=s[u]*o[u]-s[d]*o[d],i[d]=s[u]*o[d]+s[d]*o[u]}this._f.inverseTransform(a,i);for(let u=0;u<a.length;u+=2){const d=a[u+c],f=a[u+c+1],h=l[u],p=l[u+1];t[u]=d*h-f*p,t[u+1]=d*p+f*h}}transform(t,e){this._transform(t,e,!1)}realTransform(t,e){this._transform(t,e,!0)}},qbe=class{constructor(t){this.fft_length=t,this.isPowerOfTwo=SK(t),this.isPowerOfTwo?(this.fft=new TK(t),this.outputBufferSize=2*t):(this.fft=new Vbe(t),this.outputBufferSize=this.fft.bufferSize)}realTransform(t,e){this.fft.realTransform(t,e)}transform(t,e){this.fft.transform(t,e)}};function Wbe(t,e){if(e%2===0||e<=0)throw new Error("Window size must be a positive odd number");const n=new t.constructor(t.length),r=new t.constructor(e),i=Math.floor(e/2);for(let s=0;s<t.length;++s){let a=0;for(let o=-i;o<=i;++o){let l=s+o;l<0?l=Math.abs(l):l>=t.length&&(l=2*(t.length-1)-l),r[a++]=t[l]}r.sort(),n[s]=r[i]}return n}function n_(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}function Gbe(t){const e=Math.round(t);return Math.abs(t)%1===.5?e%2===0?e:e-1:e}function Hbe(t){const e=t.length,n=t[0].length,r=[e+1,n+1],i=Array.from({length:r[0]},()=>Array(r[1]).fill(1/0));i[0][0]=0;const s=Array.from({length:r[0]},()=>Array(r[1]).fill(-1));for(let u=1;u<r[1];++u)for(let d=1;d<r[0];++d){const f=i[d-1][u-1],h=i[d-1][u],p=i[d][u-1];let m,g;
510f<h&&f<p?(m=f,g=0):h<f&&h<p?(m=h,g=1):(m=p,g=2),i[d][u]=t[d-1][u-1]+m,s[d][u]=g}for(let u=0;u<r[1];++u)s[0][u]=2;for(let u=0;u<r[0];++u)s[u][0]=1;let a=e,o=n,l=[],c=[];for(;a>0||o>0;)switch(l.push(a-1),c.push(o-1),s[a][o]){case 0:--a,--o;break;case 1:--a;break;case 2:--o;break;default:throw new Error(`Internal error in dynamic time warping. Unexpected trace[${a}, ${o}]. Please file a bug report.`)}return l.reverse(),c.reverse(),[l,c]}var Kbe=function(){let t=null;return function(e){if(!t){t=new Float32Array(65536);const s=new ArrayBuffer(4),a=new Uint32Array(s),o=new Float32Array(s);for(let l=0;l<t.length;++l){let c=0;const u=(l&32768)<<16,d=(l&31744)>>10;let f=l&1023;if(d===31)c=u|2139095040|f<<13;else if(d===0)if(f===0)c=u;else{let h=113;for(;!(f&1024);)f<<=1,--h;f&=-1025,c=u|h<<23|f<<13}else c=u|d+112<<23|f<<13;a[0]=c,t[l]=o[0]}}const n=e.length,r=t,i=new Float32Array(n);for(let s=0;s<n;++s)i[s]=r[e[s]];return i}}(),CK={};u0(CK,{default:()=>Jbe});var Jbe={};async function EK(t){const e=t.split("/").pop();let n;try{if(n=await II(),n){const i=await n.match(t);if(i)return i}}catch(i){en.warn(`Failed to load ${e} from cache:`,i)}const r=await On.fetch(t);if(!r.ok)throw new Error(`Failed to fetch ${e}: ${r.status} ${r.statusText}`);if(n)try{await n.put(t,r.clone())}catch(i){en.warn(`Failed to cache ${e}:`,i)}return r}async function Ybe(t){const e=await EK(t);if(!e||typeof e=="string")return null;try{return await e.arrayBuffer()}catch(n){return en.warn("Failed to read WASM binary:",n),null}}async function Xbe(t){if(vn.IS_SERVICE_WORKER_ENV||vn.IS_CHROME_AVAILABLE)return t;const e=await EK(t);if(!e||typeof e=="string")return null;try{let n=await e.text();n=n.replaceAll("globalThis.process?.versions?.node","false");const r=new Blob([n],{type:"text/javascript"});return URL.createObjectURL(r)}catch(n){return en.warn("Failed to read WASM factory:",n),null}}var Qbe=Object.freeze({auto:null,gpu:null,cpu:"cpu",wasm:"wasm",webgpu:"webgpu",cuda:"cuda",dml:"dml",coreml:"coreml",webnn:{name:"webnn",deviceType:"cpu"},"webnn-npu":{name:"webnn",deviceType:"npu"},"webnn-gpu":{name:"webnn",deviceType:"gpu"},"webnn-cpu":{name:"webnn",deviceType:"cpu"}});function AK(t){return t<=Hl.DEBUG?0:t<=Hl.INFO?2:t<=Hl.WARNING||t<=Hl.ERROR?3:4}var Zbe={0:"verbose",1:"info",2:"warning",3:"error",4:"fatal"},Ho=[],XM,Uh,Q8=Symbol.for("onnxruntime");if(Q8 in globalThis)Uh=globalThis[Q8];else if(vn.IS_NODE_ENV){switch(Uh=CK,process.platform){case"win32":Ho.push("dml");break;case"linux":process.arch==="x64"&&Ho.push("cuda");break;case"darwin":Ho.push("coreml");break}Ho.push("webgpu"),Ho.push("cpu"),XM=["cpu"]}else Uh=$ye,vn.IS_WEBNN_AVAILABLE&&Ho.push("webnn-npu","webnn-gpu","webnn-cpu","webnn"),vn.IS_WEBGPU_AVAILABLE&&Ho.push("webgpu"),Ho.push("wasm"),XM=["wasm"];var e2e=Uh.InferenceSession;function t2e(t=null){if(!t)return XM;switch(t){case"auto":return Ho;case"gpu":return Ho.filter(e=>["webgpu","cuda","dml","webnn-gpu"].includes(e))}if(Ho.includes(t))return[Qbe[t]??t];throw new Error(`Unsupported device: "${t}". Should be one of: ${Ho.join(", ")}.`)}var Z8=Promise.resolve(),Xm=null;async function n2e(){var e,n,r,i,s;if(Xm)return Xm;if(!(On.useWasmCache&&typeof((e=gr==null?void 0:gr.wasm)==null?void 0:e.wasmPaths)=="object"&&((r=(n=gr==null?void 0:gr.wasm)==null?void 0:n.wasmPaths)==null?void 0:r.wasm)&&((s=(i=gr==null?void 0:gr.wasm)==null?void 0:i.wasmPaths)==null?void 0:s.mjs))){if(vn.IS_DENO_WEB_RUNTIME)throw new Error("env.useWasmCache=false is not supported in Deno's web runtime. Remove the useWasmCache override.");return Xm=Promise.resolve(),Xm}return Xm=(async()=>{const a=gr.wasm.wasmPaths;let o=!1;await Promise.all([a.wasm&&!K8(a.wasm)?(async()=>{try{const l=await Ybe(J8(a.wasm));l&&(gr.wasm.wasmBinary=l,o=!0)}catch(l){en.warn("Failed to pre-load WASM binary:",l)}})():Promise.resolve(),a.mjs&&!K8(a.mjs)?(async()=>{try{const l=await Xbe(J8(a.mjs));l&&(gr.wasm.wasmPaths.mjs=l)}catch(l){en.warn("Failed to pre-load WASM factory:",l)}})():Promise.resolve()]),o||(gr.wasm.wasmPaths.mjs=a.mjs)})(),Xm}async function PK(t,e,n){await n2e();const r=AK(On.logLevel??Hl.WARNING),i=()=>e2e.create(t,{logSeverityLevel:r,...e}),s=await(vn.IS_WEB_ENV?Z8=Z8.then(i):i());return s.config=n,s}
510var eB=Promise.resolve();async function MK(t,e){const n=()=>t.run(e);return vn.IS_WEB_ENV?eB=eB.then(n):n()}function NK(t){return t instanceof Uh.Tensor}var gr=Uh==null?void 0:Uh.env;function OI(){var t;return(t=gr==null?void 0:gr.wasm)==null?void 0:t.proxy}var Qz;if(gr){let t=function(e){const n=AK(e);gr.logLevel=Zbe[n]};if(gr.wasm){if(!(typeof ServiceWorkerGlobalScope<"u"&&self instanceof ServiceWorkerGlobalScope)&&((Qz=gr.versions)!=null&&Qz.web)&&!gr.wasm.wasmPaths){const e=`https://cdn.jsdelivr.net/npm/onnxruntime-web@${gr.versions.web}/dist/`;gr.wasm.wasmPaths=vn.IS_SAFARI?{mjs:`${e}ort-wasm-simd-threaded.mjs`,wasm:`${e}ort-wasm-simd-threaded.wasm`}:{mjs:`${e}ort-wasm-simd-threaded.asyncify.mjs`,wasm:`${e}ort-wasm-simd-threaded.asyncify.wasm`}}gr.wasm.proxy=!1}gr.webgpu&&(gr.webgpu.powerPreference="high-performance"),t(On.logLevel??Hl.WARNING),On.backends.onnx={...gr,setLogLevel:t}}var Yd=async(t,e,n)=>{const r=await PK(new Uint8Array(t),e);return async i=>{const s=OI(),a=Object.fromEntries(Object.entries(i).map(([l,c])=>[l,(s?c.clone():c).ort_tensor])),o=await MK(r,a);return Array.isArray(n)?n.map(l=>new He(o[l])):new He(o[n])}},dA,Zg=(dA=class{static get nearest_interpolate_4d(){return this._nearest_interpolate_4d||(this._nearest_interpolate_4d=Yd([8,10,18,0,58,129,1,10,41,10,1,120,10,0,10,0,10,1,115,18,1,121,34,6,82,101,115,105,122,101,42,18,10,4,109,111,100,101,34,7,110,101,97,114,101,115,116,160,1,3,18,1,114,90,31,10,1,120,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,90,15,10,1,115,18,10,10,8,8,7,18,4,10,2,8,4,98,31,10,1,121,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,66,2,16,21],this.session_options,"y")),this._nearest_interpolate_4d}static get bilinear_interpolate_4d(){return this._bilinear_interpolate_4d||(this._bilinear_interpolate_4d=Yd([8,9,18,0,58,128,1,10,40,10,1,120,10,0,10,0,10,1,115,18,1,121,34,6,82,101,115,105,122,101,42,17,10,4,109,111,100,101,34,6,108,105,110,101,97,114,160,1,3,18,1,114,90,31,10,1,120,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,90,15,10,1,115,18,10,10,8,8,7,18,4,10,2,8,4,98,31,10,1,121,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,66,2,16,20],this.session_options,"y")),this._bilinear_interpolate_4d}static get bicubic_interpolate_4d(){return this._bicubic_interpolate_4d||(this._bicubic_interpolate_4d=Yd([8,9,18,0,58,127,10,39,10,1,120,10,0,10,0,10,1,115,18,1,121,34,6,82,101,115,105,122,101,42,16,10,4,109,111,100,101,34,5,99,117,98,105,99,160,1,3,18,1,114,90,31,10,1,120,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,90,15,10,1,115,18,10,10,8,8,7,18,4,10,2,8,4,98,31,10,1,121,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,66,2,16,20],this.session_options,"y")),this._bicubic_interpolate_4d}static get matmul(){return this._matmul||(this._matmul=Yd([8,9,18,0,58,55,10,17,10,1,97,10,1,98,18,1,99,34,6,77,97,116,77,117,108,18,1,114,90,9,10,1,97,18,4,10,2,8,1,90,9,10,1,98,18,4,10,2,8,1,98,9,10,1,99,18,4,10,2,8,1,66,2,16,20],this.session_options,"c")),this._matmul}static get stft(){return this._stft||(this._stft=Yd([8,7,18,0,58,148,1,10,38,10,1,115,10,1,106,10,1,119,10,1,108,18,1,111,34,4,83,84,70,84,42,15,10,8,111,110,101,115,105,100,101,100,24,1,160,1,2,18,1,115,90,26,10,1,115,18,21,10,19,8,1,18,15,10,3,18,1,98,10,3,18,1,115,10,3,18,1,99,90,11,10,1,106,18,6,10,4,8,7,18,0,90,16,10,1,119,18,11,10,9,8,1,18,5,10,3,18,1,119,90,11,10,1,108,18,6,10,4,8,7,18,0,98,31,10,1,111,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,102,10,3,18,1,100,10,3,18,1,99,66,2,16,17],this.session_options,"o")),this._stft}static get rfft(){return this._rfft||(this._rfft=Yd([8,9,18,0,58,97,10,33,10,1,120,10,0,10,1,97,18,1,121,34,3,68,70,84,42,15,10,8,111,110,101,115,105,100,101,100,24,1,160,1,2,18,1,100,90,21,10,1,120,18,16,10,14,8,1,18,10,10,3,18,1,115,10,3,18,1,99,90,11,10,1,97,18,6,10,4,8,7,18,0,98,21,10,1,121,18,16,10,14,8,1,18,10,10,3,18,1,115,10,3,18,1,99,66,2,16,20],this.session_options,"y")),this._rfft}static get top_k(){return this._top_k||(this._top_k=Yd([8,10,18,0,58,73,10,18,10,1,120,10,1,107,18,1,118,18,1,105,34,4,84,111,112,75,18,1,116,90,9,10,1,120,18,4,10,2,8,1,90,15,10,1,107,18,10,10,8,8,7,18,4,10,2,8,1,98,9,10,1,118,18,4,10,2,8,1,98,9,10,1,105,18,4,10,2,8,7,66,2,16,21],this.session_options,["v","i"])),this._top_k}static get slice(){return this._slice||(this._slice=Yd([8,7,18,0,58,96,10,25,10,1,120,10,1,115,10,1,101,10,1,97,10,1,116,18,1,121,34,5,83,108,105,99,101,18,1,114,90,9,10,1,120,18,4,10,2,8,1,90,9,10,1,115,18,4,10,2,8,7,90,9,10,1,101,18,4,10,2,8,7,90,9,10,1,97,18,4,10,2,8,7,90,9,10,1,116,18,4,10,2,8,7,98,9,10,1,121,18,4,10,2,8,1,66,2,16,13],this.session_options,"y")),this._slice}},X(dA,"session_options",{}),dA),r2e=Object.freeze({auto:"auto",gpu:"gpu",cpu:"cpu",wasm:"wasm",webgpu:"webgpu",cuda:"cuda",dml:"dml",coreml:"coreml",webnn:"webnn","webnn-npu":"webnn-npu","webnn-gpu":"webnn-gpu","webnn-cpu":"webnn-cpu"}),G5=vn.IS_NODE_ENV?"cpu":"wasm";function RK(t,e,{warn:n}={}){return t?typeof t=="string"?t:t.hasOwnProperty(e)?t[e]:(n&&n(`device not specified for "${e}". Using the default device (${G5}).`),G5):G5}var i2e=function(){let t;return async function(){if(t===void 0)if(!vn.IS_WEBGPU_AVAILABLE)t=!1;else try{t=(await navigator.gpu.requestAdapter()).features.has("shader-f16")}catch{t=!1}return t}}(),Ii=Object.freeze({auto:"auto",fp32:"fp32",fp16:"fp16",q8:"q8",int8:"int8",uint8:"uint8",q4:"q4",bnb4:"bnb4",q4f16:"q4f16",q2:"q2",q2f16:"q2f16",q1:"q1",q1f16:"q1f16"}),tB=Ii.fp32,nB=Object.freeze({[r2e.wasm]:Ii.q8}),QM=Object.freeze({[Ii.fp32]:"",[Ii.fp16]:"_fp16",[Ii.int8]:"_int8",[Ii.uint8]:"_uint8",[Ii.q8]:"_quantized",[Ii.q4]:"_q4",[Ii.q2]:"_q2",[Ii.q1]:"_q1",[Ii.q4f16]:"_q4f16",[Ii.q2f16]:"_q2f16",[Ii.q1f16]:"_q1f16",[Ii.bnb4]:"_bnb4"});function IK(t,e,n,{configDtype:r=null,warn:i}={}){let s,a=!1;t&&typeof t!="string"?t.hasOwnProperty(e)?s=t[e]:(s=null,a=!0):s=t;let o;if(s===Ii.auto){if(r){const l=typeof r=="string"?r:r==null?void 0:r[e];if(l&&l!==Ii.auto&&Ii.hasOwnProperty(l))return l}o=nB[n]??tB}else s&&Ii.hasOwnProperty(s)?o=s:o=nB[n]??tB;return a&&i&&i(`dtype not specified for "${e}". Using the default dtype (${o}) for this device (${n}).`),o}var Ew=Object.freeze({float32:Float32Array,float16:typeof Float16Array<"u"?Float16Array:Uint16Array,float64:Float64Array,string:Array,int8:
510Int8Array,uint8:Uint8Array,int16:Int16Array,uint16:Uint16Array,int32:Int32Array,uint32:Uint32Array,int64:BigInt64Array,uint64:BigUint64Array,bool:Uint8Array,uint4:Uint8Array,int4:Int8Array}),He=class ci{constructor(...e){X(this,"ort_tensor");return NK(e[0])?this.ort_tensor=e[0]:this.ort_tensor=new Zye(e[0],e[1],e[2]),new Proxy(this,{get:(n,r)=>{if(typeof r=="string"){let i=Number(r);if(Number.isInteger(i))return n._getitem(i)}return n[r]},set:(n,r,i)=>n[r]=i})}get dims(){return this.ort_tensor.dims}set dims(e){this.ort_tensor.dims=e}get type(){return this.ort_tensor.type}get data(){return this.ort_tensor.data}get size(){return this.ort_tensor.size}get location(){return this.ort_tensor.location}dispose(){this.ort_tensor.dispose()}*[Symbol.iterator](){const[e,...n]=this.dims;if(n.length>0){const r=n.reduce((i,s)=>i*s);for(let i=0;i<e;++i)yield this._subarray(i,r,n)}else yield*this.data}_getitem(e){const[n,...r]=this.dims;if(e=Vc(e,n),r.length>0){const i=r.reduce((s,a)=>s*a);return this._subarray(e,i,r)}else return new ci(this.type,[this.data[e]],r)}indexOf(e){const n=this.data;for(let r=0;r<n.length;++r)if(n[r]==e)return r;return-1}_subarray(e,n,r){const i=e*n,s=(e+1)*n,a="subarray"in this.data?this.data.subarray(i,s):this.data.slice(i,s);return new ci(this.type,a,r)}item(){const e=this.data;if(e.length!==1)throw new Error(`a Tensor with ${e.length} elements cannot be converted to Scalar`);return e[0]}tolist(){return s2e(this.data,this.dims)}sigmoid(){return this.clone().sigmoid_()}sigmoid_(){const e=this.data;for(let n=0;n<e.length;++n)e[n]=1/(1+Math.exp(-e[n]));return this}map(e){return this.clone().map_(e)}map_(e){const n=this.data;for(let r=0;r<n.length;++r)n[r]=e(n[r],r,n);return this}mul(e){return this.clone().mul_(e)}mul_(e){const n=this.data;for(let r=0;r<n.length;++r)n[r]*=e;return this}div(e){return this.clone().div_(e)}div_(e){const n=this.data;for(let r=0;r<n.length;++r)n[r]/=e;return this}add(e){return this.clone().add_(e)}add_(e){const n=this.data;for(let r=0;r<n.length;++r)n[r]+=e;return this}sub(e){return this.clone().sub_(e)}sub_(e){const n=this.data;for(let r=0;r<n.length;++r)n[r]-=e;return this}clone(){return new ci(this.type,this.data.slice(),this.dims.slice())}slice(...e){const n=[],r=[];for(let u=0;u<this.dims.length;++u){let d=e[u];if(d==null)r.push([0,this.dims[u]]),n.push(this.dims[u]);else if(typeof d=="number")d=Vc(d,this.dims[u],u),r.push([d,d+1]);else if(Array.isArray(d)&&d.length===2){let[f,h]=d;if(f=f===null?0:Vc(f,this.dims[u],u,!1),h=h===null?this.dims[u]:Vc(h,this.dims[u],u,!1),f>h)throw new Error(`Invalid slice: ${d}`);const p=[Math.max(f,0),Math.min(h,this.dims[u])];r.push(p),n.push(p[1]-p[0])}else throw new Error(`Invalid slice: ${d}`)}const i=r.map(([u,d])=>d-u),s=i.reduce((u,d)=>u*d),a=this.data,o=new a.constructor(s),l=this.stride();let c=!0;for(let u=1;u<i.length;++u)if(r[u][0]!==0||r[u][1]!==this.dims[u]){c=!1;break}
vendor: 17,680 bytes, line 510
510if(c){const u=r[0][0]*l[0],d=r[0][1]*l[0];if(ArrayBuffer.isView(a))o.set(a.subarray(u,d));else if(Array.isArray(a)){const f=a.slice(u,d);for(let h=0;h<f.length;++h)o[h]=f[h]}else throw new Error("Unsupported data type for slicing")}else for(let u=0;u<s;++u){let d=0;for(let f=i.length-1,h=u;f>=0;--f){const p=i[f];d+=(h%p+r[f][0])*l[f],h=Math.floor(h/p)}o[u]=a[d]}return new ci(this.type,o,n)}permute(...e){return a2e(this,e)}transpose(...e){return this.permute(...e)}sum(e=null,n=!1){return this.norm(1,e,n)}norm(e="fro",n=null,r=!1){if(e==="fro")e=2;else if(typeof e=="string")throw Error(`Unsupported norm: ${e}`);const i=this.data,s=i instanceof BigInt64Array||i instanceof BigUint64Array;if(s&&e!==1)throw Error(`Expected a floating point tensor as input. Got ${this.type}`);let a,o;if(s?(a=(d,f)=>d+f,o=0n):(a=(d,f)=>d+f**e,o=0),n===null){let d=i.reduce(a,o);return e!==1&&(d=d**(1/e)),new ci(this.type,[d],[])}const[l,c,u]=C_(a,this,n,r);if(e!==1)for(let d=0;d<c.length;++d)c[d]=c[d]**(1/e);return new ci(l,c,u)}normalize_(e=2,n=1){n=Vc(n,this.dims.length);const r=this.norm(e,n,!0),i=this.data,s=r.data;for(let a=0;a<i.length;++a){let o=0;for(let l=this.dims.length-1,c=a,u=1;l>=0;--l){const d=this.dims[l];if(l!==n){const f=c%d;o+=f*u,u*=this.dims[l]}c=Math.floor(c/d)}i[a]/=s[o]}return this}normalize(e=2,n=1){return this.clone().normalize_(e,n)}stride(){return H5(this.dims)}squeeze(e=null){return new ci(this.type,this.data,rB(this.dims,e))}squeeze_(e=null){return this.dims=rB(this.dims,e),this}unsqueeze(e){return new ci(this.type,this.data,iB(this.dims,e))}unsqueeze_(e){return this.dims=iB(this.dims,e),this}flatten_(e=0,n=-1){n=(n+this.dims.length)%this.dims.length;let r=this.dims.slice(0,e),i=this.dims.slice(e,n+1),s=this.dims.slice(n+1);return this.dims=[...r,i.reduce((a,o)=>a*o,1),...s],this}flatten(e=0,n=-1){return this.clone().flatten_(e,n)}view(...e){let n=-1;for(let i=0;i<e.length;++i)if(e[i]===-1){if(n!==-1)throw new Error("Only one dimension can be inferred");n=i}const r=this.data;if(n!==-1){const i=e.reduce((s,a,o)=>o!==n?s*a:s,1);e[n]=r.length/i}return new ci(this.type,r,e)}neg_(){const e=this.data;for(let n=0;n<e.length;++n)e[n]=-e[n];return this}neg(){return this.clone().neg_()}gt(e){const n=new Uint8Array(this.data.length),r=this.data;for(let i=0;i<r.length;++i)n[i]=r[i]>e?1:0;return new ci("bool",n,this.dims)}lt(e){const n=new Uint8Array(this.data.length),r=this.data;for(let i=0;i<r.length;++i)n[i]=r[i]<e?1:0;return new ci("bool",n,this.dims)}clamp_(e,n){const r=this.data;for(let i=0;i<r.length;++i)r[i]=Math.min(Math.max(r[i],e),n);return this}clamp(e,n){return this.clone().clamp_(e,n)}round_(){const e=this.data;for(let n=0;n<e.length;++n)e[n]=Math.round(e[n]);return this}round(){return this.clone().round_()}mean(e=null,n=!1){return DI(this,e,n)}min(e=null,n=!1){if(e===null){const a=YM(this.data)[0];return new ci(this.type,[a],[])}const[r,i,s]=C_((a,o)=>Math.min(a,o),this,e,n,1/0);return new ci(r,i,s)}max(e=null,n=!1){if(e===null){const a=Pi(this.data)[0];return new ci(this.type,[a],[])}const[r,i,s]=C_((a,o)=>Math.max(a,o),this,e,n,-1/0);return new ci(r,i,s)}argmin(e=null,n=!1){if(e!==null)throw new Error("`dim !== null` not yet implemented.");const r=YM(this.data)[1];return new ci("int64",[BigInt(r)],[])}argmax(e=null,n=!1){if(e!==null)throw new Error("`dim !== null` not yet implemented.");const r=Pi(this.data)[1];return new ci("int64",[BigInt(r)],[])}repeat(...e){if(e.length<this.dims.length)throw new Error(`Number of dimensions of repeat dims (${e.length}) cannot be smaller than number of dimensions of tensor (${this.dims.length})`);if(e.every(u=>u===1)){if(e.length===this.dims.length)return this.clone();const u=e.length-this.dims.length,d=Array(u).fill(1).concat(this.dims);return new ci(this.type,this.data.slice(),d)}const n=e.length-this.dims.length,r=Array(n).fill(1).concat(this.dims),i=r.map((u,d)=>u*e[d]),s=i.reduce((u,d)=>u*d,1),a=this.data,o=new a.constructor(s),l=H5(r),c=H5(i);for(let u=0;u<s;++u){let d=u,f=0;for(let h=0;h<i.length;++h){const p=Math.floor(d/c[h]);d=d%c[h];const m=p%r[h];f+=m*l[h]}o[u]=a[f]}return new ci(this.type,o,i)}tile(...e){if(e.length<this.dims.length){const n=this.dims.length-e.length;e=Array(n).fill(1).concat(e)}return this.repeat(...e)}to(e){if(this.type===e)return this;if(!Ew.hasOwnProperty(e))throw new Error(`Unsupported type: ${e}`);let n;const r=["int64","uint64"].includes(this.type),i=["int64","uint64"].includes(e);if(r&&!i)n=Number;else if(!r&&i)["float16","float32","float64"].includes(this.type)?n=s=>BigInt(Math.floor(s)):n=BigInt;else if(this.type==="float16"&&e=="float32"&&this.data instanceof Uint16Array)return new ci(e,Kbe(this.data),this.dims);return new ci(e,Ew[e].from(this.data,n),this.dims)}};function s2e(t,e){const n=t.length,r=e.reduce((s,a)=>s*a);if(n!==r)throw Error(`cannot reshape array of size ${n} into shape (${e})`);let i=t;for(let s=e.length-1;s>=0;s--)i=i.reduce((a,o)=>{let l=a[a.length-1];return l.length<e[s]?l.push(o):a.push([o]),a},[[]]);return i[0]}function a2e(t,e){const[n,r]=zbe(t.data,t.dims,e);return new He(t.type,n,r)}function LK(t,[e,n],r="bilinear",i=!1){const s=t.dims.at(-3)??1,a=t.dims.at(-2),o=t.dims.at(-1),l=Ube(t.data,[s,a,o],[e,n],r,i);return new He(t.type,l,[s,e,n])}async function tc(t,{size:e=null,mode:n="bilinear"}={}){if(t.dims.length!==4)throw new Error("`interpolate_4d` currently only supports 4D input.");if(!e)throw new Error("`interpolate_4d` requires a `size` argument.");let r;if(e.length===2)r=[...t.dims.slice(0,2),...e];else if(e.length===3)r=[t.dims[0],...e];else if(e.length===4)r=e;else throw new Error("`size` must be of length 2, 3, or 4.");let i;if(n==="nearest")i=await Zg.nearest_interpolate_4d;else if(n==="bilinear")i=await Zg.bilinear_interpolate_4d;else if(n==="bicubic")i=await Zg.bicubic_interpolate_4d;else throw new Error(`Unsupported mode: ${n}`);const s=new He("int64",new BigInt64Array(r.map(BigInt)),[r.length]);return await i({x:t,s})}async function o2e(t,e){return await(await Zg.matmul)({a:t,b:e})}async function f0(t,e){const n=await Zg.top_k;return e==null?e=t.dims.at(-1):e=Math.min(e,t.dims.at(-1)),await n({x:t,k:new He("int64",[BigInt(e)],[1])})}var i2=t=>new He("int64",t,[t.length]);async function OK(t,e,n,r,i){return await(await Zg.slice)({x:t,s:i2(e),e:i2(n),a:i2(r),t:i2(new Array(r.length).fill(1))})}function l2e(t,e){const n=t.data,r=e.data,i=[t.dims[0],t.dims[2]],s=new n.constructor(i[0]*i[1]),[a,o,l]=t.dims;let c=0;for(let u=0;u<a;++u){const d=u*l*o;for(let f=0;f<l;++f){let h=0,p=0;const m=u*o,g=d+f;for(let _=0;_<o;++_){const b=Number(r[m+_]);p+=b,h+=n[g+_*l]*b}const v=h/p;s[c++]=v}}return new He(t.type,s,i)}function rB(t,e){return t=t.slice(),e===null?t=t.filter(n=>n!==1):typeof e=="number"?t[e]===1&&t.splice(e,1):Array.isArray(e)&&(t=t.filter((n,r)=>n!==1||!e.includes(r))),t}function iB(t,e){return e=Vc(e,t.length+1),t=t.slice(),t.splice(e,0,1),t}function Vc(t,e,n=null,r=!0){if(t<-e||t>=e){if(r)throw new Error(`IndexError: index ${t} is out of bounds for dimension${n===null?"":" "+n} with size ${e}`);return t<-e?0:e}return t<0&&(t=(t%e+e)%e),t}function Lr(t,e=0){e=Vc(e,t[0].dims.length);const n=t[0].dims.slice();n[e]=t.reduce((a,o)=>a+o.dims[e],0);const r=n.reduce((a,o)=>a*o,1),i=new t[0].data.constructor(r),s=t[0].type;if(e===0){let a=0;for(const o of t){const l=o.data;i.set(l,a),a+=l.length}}else{let a=0;for(let o=0;o<t.length;++o){const{data:l,dims:c}=t[o];for(let u=0;u<l.length;++u){let d=0;for(let f=c.length-1,h=u,p=1;f>=0;--f){const m=c[f];let g=h%m;f===e&&(g+=a),d+=g*p,p*=n[f],h=Math.floor(h/m)}i[d]=l[u]}a+=c[e]}}return new He(s,i,n)}function gd(t,e=0){return Lr(t.map(n=>n.unsqueeze(e)),e)}function C_(t,e,n,r=!1,i=null){const s=e.data,a=e.dims;n=Vc(n,a.length);const o=a.slice();o[n]=1;const l=new s.constructor(s.length/a[n]);i!==null&&l.fill(i);for(let c=0;c<s.length;++c){let u=0;for(let d=a.length-1,f=c,h=1;d>=0;--d){const p=a[d];if(d!==n){const m=f%p;u+=m*h,h*=o[d]}f=Math.floor(f/p)}l[u]=t(l[u],s[c],c,u)}return r||o.splice(n,1),[e.type,l,o]}function c2e(t,e=null,n=1,r=!1){const i=t.data,s=t.dims;if(e===null){const h=i.reduce((v,_)=>v+_,0)/i.length,p=Math.sqrt(i.reduce((v,_)=>v+(_-h)**2,0)/(i.length-n)),m=new He(t.type,[h],[]);return[new He(t.type,[p],[]),m]}e=Vc(e,s.length);const a=DI(t,e,r),o=a.data,[l,c,u]=C_((f,h,p,m)=>f+(h-o[m])**2,t,e,r);for(let f=0;f<c.length;++f)c[f]=Math.sqrt(c[f]/(s[e]-n));return[new He(l,c,u),a]}function DI(t,e=null,n=!1){const r=t.dims,i=t.data;if(e===null){const l=i.reduce((c,u)=>c+u,0);return new He(t.type,[l/i.length],[])}e=Vc(e,r.length);const[s,a,o]=C_((l,c)=>l+c,t,e,n);if(r[e]!==1)for(let l=0;l<a.length;++l)a[l]/=r[e];return new He(s,a,o)}function H5(t){const e=new Array(t.length);for(let n=t.length-1,r=1;n>=0;--n)e[n]=r,r*=t[n];return e}function FI(t,e,n,r){const i=t.reduce((s,a)=>s*a,1);return new He(n,new r(i).fill(e),t)}function Qs(t,e){let n,r;if(typeof e=="number")n="float32",r=Float32Array;else if(typeof e=="bigint")n="int64",r=BigInt64Array;else if(typeof e=="boolean")n="bool",r=Uint8Array;else throw new Error(`Unsupported data type: ${typeof e}`);return FI(t,e,n,r)}function ZM(t,e){return Qs(t.dims,e)}function Ya(t){return FI(t,1n,"int64",BigInt64Array)}function DK(t){return Ya(t.dims)}function FK(t){return FI(t,0n,"int64",BigInt64Array)}function jK(t){return FK(t.dims)}function u2e(t){const e=t.reduce((n,r)=>n*r,1);return new He("float32",Float32Array.from({length:e},()=>RI.gauss()),t)}function d2e(t,e){if(t.dims.length!==2)throw new Error("The tensor must have 2 dimensions");if(t.dims.at(-1)%8!==0)throw new Error("The last dimension of the tensor must be a multiple of 8");if(!["binary","ubinary"].includes(e))throw new Error("The precision must be either 'binary' or 'ubinary'");const n=e==="binary",r=n?"int8":"uint8",i=n?Int8Array:Uint8Array,s=t.data,a=new i(s.length/8);for(let o=0;o<s.length;++o){const l=s[o]>0?1:0,c=Math.floor(o/8),u=o%8;a[c]|=l<<7-u,n&&u===0&&(a[c]-=128)}return new He(r,a,[t.dims[0],t.dims[1]/8])}async function BK(t){if(!t)throw new Error("modelId is required for get_tokenizer_files");return(await y1(t,"tokenizer_config.json",{})).exists?["tokenizer.json","tokenizer_config.json"]:[]}async function UK(t,e){const n=await BK(t);return await Promise.all(n.map(r=>cu(t,r,!0,e)))}function jI(t){const e=t.dims;switch(e.length){case 1:return t.tolist();case 2:if(e[0]!==1)throw new Error("Unable to decode tensor with `batch size !== 1`. Use `tokenizer.batch_decode(...)` for batched inputs.");return t.tolist()[0];default:throw new Error(`Expected tensor to have 1-2 dimensions, got ${e.length}.`)}}var h2e=["bos_token","eos_token","unk_token","sep_token","pad_token","cls_token","mask_token"];function f2e(t,e,n,r){for(const i of Object.keys(t)){const s=e-t[i].length,a=n(i),o=new Array(s).fill(a);t[i]=r==="right"?Hc(t[i],o):Hc(o,t[i])}}function p2e(t,e){for(const n of Object.keys(t))t[n].length=e}function zf(t,...e){for(const n of e){if(!Object.hasOwn(t,n))continue;const r=t[n];if(r)if(typeof r=="object"){if(r.__type==="AddedToken")return r.content;throw Error(`Unknown token: ${r}`)}else return r}return null}function m2e(t){const e=[];for(const n of t.get_added_tokens_decoder().values())n.special&&e.push(n);return e}var Xt=class extends Qa{constructor(e,n){super();X(this,"return_token_type_ids",!1);X(this,"padding_side","right");if(this._tokenizerJSON=e,this._tokenizerConfig=n,this._tokenizer=new A1e(e,n),this.config=n,this.padding_side=n.padding_side??this.padding_side,this.mask_token=zf(n,"mask_token"),this.mask_token_id=this._tokenizer.token_to_id(this.mask_token),this.pad_token=zf(n,"pad_token","eos_token"),this.pad_token_id=this._tokenizer.token_to_id(this.pad_token),this.sep_token=zf(n,"sep_token"),this.sep_token_id=this._tokenizer.token_to_id(this.sep_token),this.unk_token=zf(n,"unk_token"),this.unk_token_id=this._tokenizer.token_to_id(this.unk_token),this.bos_token=zf(n,"bos_token"),this.bos_token_id=this._tokenizer.token_to_id(this.bos_token),this.eos_token=zf(n,"eos_token"),this.eos_token_id=this._tokenizer.token_to_id(this.eos_token),this.chat_template=n.chat_template??null,Array.isArray(this.chat_template)){const i=Object.create(null);for(const{name:s,template:a}of this.chat_template){if(typeof s!="string"||typeof a!="string")throw new Error('Chat template must be a list of objects with "name" and "template" properties');i[s]=a}this.chat_template=i}this._compiled_template_cache=new Map;const r=m2e(this._tokenizer);this.all_special_ids=r.map(i=>i.id),this.all_special_tokens=r.map(i=>i.content)}static async from_pretrained(e,{progress_callback:n=null,config:r=null,cache_dir:i=null,local_files_only:s=!1,revision:a="main"}={}){const o=await UK(e,{progress_callback:n,config:r,cache_dir:i,local_files_only:s,revision:a});return new this(...o)}get_vocab(){return this._tokenizer.get_vocab()}get model_max_length(){return this._tokenizerConfig.model_max_length??1/0}get add_eos_token(){return this._tokenizerConfig.add_eos_token}get add_bos_token(){return this._tokenizerConfig.add_bos_token}convert_tokens_to_ids(e){return typeof e=="string"?this._tokenizer.token_to_id(e):e.map(n=>this._tokenizer.token_to_id(n))}_call(e,n={}){const{text_pair:r=null,add_special_tokens:i=!0,padding:s=!1,return_token_type_ids:a=null}=n;let{truncation:o=null,max_length:l=null}=n;const c=n.return_tensor??!0,u=Array.isArray(e);let d;if(u){if(e.length===0)throw Error("text array must be non-empty");if(r!==null){if(Array.isArray(r)){if(e.length!==r.length)throw Error("text and text_pair must have the same length")}else throw Error("text_pair must also be an array");d=e.map((h,p)=>this._encode_plus(h,{text_pair:r[p],add_special_tokens:i,return_token_type_ids:a}))}else d=e.map(h=>this._encode_plus(h,{add_special_tokens:i,return_token_type_ids:a}))}else{if(e==null)throw Error("text may not be null or undefined");if(Array.isArray(r))throw Error("When specifying `text_pair`, since `text` is a string, `text_pair` must also be a string (i.e., not an array).");d=[this._encode_plus(e,{text_pair:r,add_special_tokens:i,return_token_type_ids:a})]}if(l===null?l=this.model_max_length:o===null&&(s===!0?(en.warn("`max_length` is ignored when `padding: true` and there is no truncation strategy. To pad to max length, use `padding: 'max_length'`."),l=this.model_max_length):s===!1&&(en.warn("Truncation was not explicitly activated but `max_length` is provided a specific value, please use `truncation: true` to explicitly truncate examples to max length."),o=!0)),s===!0&&(l=Math.min(Pi(d.map(h=>h.input_ids.length))[0],l??1/0)),l=Math.min(l,this.model_max_length??1/0),s||o)for(let h=0;h<d.length;++h)d[h].input_ids.length!==l&&(d[h].input_ids.length>l?o&&p2e(d[h],l):s&&f2e(d[h],l,p=>p==="input_ids"?this.pad_token_id:0,this.padding_side));const f={};if(c){if(!(s&&o)&&d.some(p=>{var m;for(const g of Object.keys(p))if(p[g].length!==((m=d[0][g])==null?void 0:m.length))return!0;return!1}))throw Error("Unable to create tensor, you should probably activate truncation and/or padding with 'padding=true' and 'truncation=true' to have batched tensors with the same length.");const h=[d.length,d[0].input_ids.length];for(const p of Object.keys(d[0]))f[p]=new He("int64",BigInt64Array.from(d.flatMap(m=>m[p]).map(BigInt)),h)}else{for(const h of Object.keys(d[0]))f[h]=d.map(p=>p[h]);if(!u)for(const h of Object.keys(f))f[h]=f[h][0]}return f}_encode_text(e){return e===null?null:this._tokenizer.encode(e).tokens}_encode_plus(e,{text_pair:n=null,add_special_tokens:r=!0,return_token_type_ids:i=null}={}){const{ids:s,attention_mask:a,token_type_ids:o}=this._tokenizer.encode(e,{text_pair:n,add_special_tokens:r,return_token_type_ids:i??this.return_token_type_ids});return{input_ids:s,attention_mask:a,...o?{token_type_ids:o}:{}}}tokenize(e,{pair:n=null,add_special_tokens:r=!1}={}){return this._tokenizer.tokenize(e,{text_pair:n,add_special_tokens:r})}encode(e,{text_pair:n=null,add_special_tokens:r=!0,return_token_type_ids:i=null}={}){return this._tokenizer.encode(e,{text_pair:n,add_special_tokens:r,return_token_type_ids:i}).ids}batch_decode(e,n={}){return e instanceof He&&(e=e.tolist()),e.map(r=>this.decode(r,n))}decode(e,n={}){if(e instanceof He&&(e=jI(e)),!Array.isArray(e)||e.length===0||!m_e(e[0]))throw Error("token_ids must be a non-empty array of integers.");return this.decode_single(e,n)}decode_single(e,{skip_special_tokens:n=!1,clean_up_tokenization_spaces:r=null}){return this._tokenizer.decode(e,{skip_special_tokens:n,clean_up_tokenization_spaces:r})}get_chat_template({chat_template:e=null,tools:n=null}={}){if(this.chat_template&&typeof this.chat_template=="object"){const r=this.chat_template;if(e!==null&&Object.hasOwn(r,e))e=r[e];else if(e===null)if(n!==null&&"tool_use"in r)e=r.tool_use;else if("default"in r)e=r.default;else throw Error(`This model has multiple chat templates with no default specified! Please either pass a chat template or the name of the template you wish to use to the 'chat_template' argument. Available template names are ${Object.keys(r).sort()}.`)}else if(e===null)if(this.chat_template)e=this.chat_template;else throw Error("Cannot use apply_chat_template() because tokenizer.chat_template is not set and no template argument was passed! For information about writing templates and setting the tokenizer.chat_template attribute, please see the documentation at https://huggingface.co/docs/transformers/main/en/chat_templating");return e}apply_chat_template(e,n={}){let{tools:r=null,documents:i=null,chat_template:s=null,add_generation_prompt:a=!1,tokenize:o=!0,padding:l=!1,truncation:c=!1,max_length:u=null,return_tensor:d=!0,return_dict:f=!0,tokenizer_kwargs:h={},...p}=n;if(s=this.get_chat_template({chat_template:s,tools:r}
510),typeof s!="string")throw Error(`chat_template must be a string, but got ${typeof s}`);let m=this._compiled_template_cache.get(s);m===void 0&&(m=new kbe(s),this._compiled_template_cache.set(s,m));const g=Object.create(null);for(const _ of h2e){const b=zf(this.config,_);b&&(g[_]=b)}const v=m.render({messages:e,add_generation_prompt:a,tools:r,documents:i,...g,...p});if(o){const _=this._call(v,{add_special_tokens:!1,padding:l,truncation:c,max_length:u,return_tensor:d,...h});return f?_:_.input_ids}return v}};function BI(t,e,n,r){if(!("language_codes"in t)||!Array.isArray(t.language_codes))throw new Error("Tokenizer must have `language_codes` attribute set and it should be an array of language ids.");if(!("languageRegex"in t)||!(t.languageRegex instanceof RegExp))throw new Error("Tokenizer must have `languageRegex` attribute set and it should be a regular expression.");if(!("lang_to_token"in t)||typeof t.lang_to_token!="function")throw new Error("Tokenizer must have `lang_to_token` attribute set and it should be a function.");const i=r.src_lang,s=r.tgt_lang;if(!t.language_codes.includes(s))throw new Error(`Target language code "${s}" is not valid. Must be one of: {${t.language_codes.join(", ")}}`);if(i!==void 0){if(!t.language_codes.includes(i))throw new Error(`Source language code "${i}" is not valid. Must be one of: {${t.language_codes.join(", ")}}`);for(const a of t._tokenizer.post_processor.config.single)if("SpecialToken"in a&&t.languageRegex.test(a.SpecialToken.id)){a.SpecialToken.id=t.lang_to_token(i);break}}return r.forced_bos_token_id=t._tokenizer.token_to_id(t.lang_to_token(s)),t._call(e,n)}var zK={};u0(zK,{AlbertTokenizer:()=>g2e,AutoTokenizer:()=>Kn,BartTokenizer:()=>v2e,BertTokenizer:()=>y2e,BlenderbotSmallTokenizer:()=>_2e,BlenderbotTokenizer:()=>w2e,BloomTokenizer:()=>b2e,CLIPTokenizer:()=>k2e,CamembertTokenizer:()=>x2e,CodeGenTokenizer:()=>T2e,CodeLlamaTokenizer:()=>S2e,CohereAsrTokenizer:()=>E2e,CohereTokenizer:()=>C2e,ConvBertTokenizer:()=>A2e,DebertaTokenizer:()=>M2e,DebertaV2Tokenizer:()=>P2e,DistilBertTokenizer:()=>N2e,ElectraTokenizer:()=>R2e,EsmTokenizer:()=>I2e,FalconTokenizer:()=>L2e,GPT2Tokenizer:()=>F2e,GPTNeoXTokenizer:()=>D2e,GemmaTokenizer:()=>O2e,HerbertTokenizer:()=>j2e,LlamaTokenizer:()=>B2e,M2M100Tokenizer:()=>U2e,MBart50Tokenizer:()=>$2e,MBartTokenizer:()=>$K,MPNetTokenizer:()=>W2e,MarianTokenizer:()=>z2e,MgpstrTokenizer:()=>V2e,MobileBertTokenizer:()=>q2e,NllbTokenizer:()=>G2e,NougatTokenizer:()=>H2e,PreTrainedTokenizer:()=>Xt,Qwen2Tokenizer:()=>K2e,RoFormerTokenizer:()=>Y2e,RobertaTokenizer:()=>J2e,SiglipTokenizer:()=>X2e,SpeechT5Tokenizer:()=>Q2e,SqueezeBertTokenizer:()=>Z2e,T5Tokenizer:()=>exe,TokenizersBackend:()=>Xt,VitsTokenizer:()=>nxe,Wav2Vec2CTCTokenizer:()=>rxe,WhisperTokenizer:()=>lxe,XLMRobertaTokenizer:()=>cxe,XLMTokenizer:()=>uxe});var g2e=class extends Xt{constructor(){super(...arguments);X(this,"return_token_type_ids",!0)}},v2e=class extends Xt{},y2e=class extends Xt{constructor(){super(...arguments);X(this,"return_token_type_ids",!0)}},_2e=class extends Xt{},w2e=class extends Xt{},b2e=class extends Xt{},x2e=class extends Xt{},k2e=class extends Xt{},S2e=class extends Xt{},T2e=class extends Xt{},C2e=class extends Xt{},E2e=class extends Xt{},A2e=class extends Xt{constructor(){super(...arguments);X(this,"return_token_type_ids",!0)}},P2e=class extends Xt{constructor(){super(...arguments);X(this,"return_token_type_ids",!0)}},M2e=class extends Xt{constructor(){super(...arguments);X(this,"return_token_type_ids",!0)}},N2e=class extends Xt{},R2e=class extends Xt{constructor(){super(...arguments);X(this,"return_token_type_ids",!0)}},I2e=class extends Xt{},L2e=class extends Xt{},O2e=class extends Xt{},D2e=class extends Xt{},F2e=class extends Xt{},j2e=class extends Xt{constructor(){super(...arguments);X(this,"return_token_type_ids",!0)}},B2e=class extends Xt{constructor(){super(...arguments);X(this,"padding_side","left")}},U2e=class extends Xt{constructor(t,e){super(t,e),this.languageRegex=/^__[a-z]{2,3}__$/,this.language_codes=this.all_special_tokens.filter(n=>this.languageRegex.test(n)).map(n=>n.slice(2,-2)),this.lang_to_token=n=>`__${n}__`}_build_translation_inputs(t,e,n){return BI(this,t,e,n)}},z2e=class extends Xt{constructor(t,e){super(t,e),this.languageRegex=/^(>>\w+<<)\s*/g,this.supported_language_codes=Array.from(this.get_vocab().keys()).filter(n=>this.languageRegex.test(n)),en.warn('WARNING: `MarianTokenizer` is not yet supported by Hugging Face\'s "fast" tokenizers library. Therefore, you may experience slightly inaccurate results.')}_encode_text(t){if(t===null)return null;const[e,...n]=t.trim().split(this.languageRegex);if(n.length===0)return super._encode_text(e);if(n.length===2){const[r,i]=n;return this.supported_language_codes.includes(r)||en.warn(`Unsupported language code "${r}" detected, which may lead to unexpected behavior. Should be one of: ${JSON.stringify(this.supported_language_codes)}`),Hc([r],super._encode_text(i))}}},$K=class extends Xt{constructor(t,e){super(t,e),this.languageRegex=/^[a-z]{2}_[A-Z]{2}$/,this.language_codes=this.all_special_tokens.filter(n=>this.languageRegex.test(n)).map(n=>n),this.lang_to_token=n=>n}_build_translation_inputs(t,e,n){return BI(this,t,e,n)}},$2e=class extends $K{},V2e=class extends Xt{},q2e=class extends Xt{constructor(){super(...arguments);X(this,"return_token_type_ids",!0)}},W2e=class extends Xt{},G2e=class extends Xt{constructor(t,e){super(t,e),this.languageRegex=/^[a-z]{3}_[A-Z][a-z]{3}$/,this.language_codes=this.all_special_tokens.filter(n=>this.languageRegex.test(n)),this.lang_to_token=n=>n}_build_translation_inputs(t,e,n){return BI(this,t,e,n)}},H2e=class extends Xt{},K2e=class extends Xt{},J2e=class extends Xt{},Y2e=class extends Xt{constructor(){super(...arguments);X(this,"return_token_type_ids",!0)}},X2e=class extends Xt{},Q2e=class extends Xt{},Z2e=class extends Xt{constructor(){super(...arguments);X(this,"return_token_type_ids",!0)}},exe=class extends Xt{},txe=class extends lc{decode_chain(t){let e="";for(let n=1;n<t.length;n+=2)e+=t[n];return[e]}},nxe=class extends Xt{constructor(t,e){super(t,e),this._tokenizer.decoder=new txe({type:"VitsDecoder"})}},rxe=class extends Xt{},VK=[["en","english"],["zh","chinese"],["de","german"],["es","spanish"],["ru","russian"],["ko","korean"],["fr","french"],["ja","japanese"],["pt","portuguese"],["tr","turkish"],["pl","polish"],["ca","catalan"],["nl","dutch"],["ar","arabic"],["sv","swedis
510h"],["it","italian"],["id","indonesian"],["hi","hindi"],["fi","finnish"],["vi","vietnamese"],["he","hebrew"],["uk","ukrainian"],["el","greek"],["ms","malay"],["cs","czech"],["ro","romanian"],["da","danish"],["hu","hungarian"],["ta","tamil"],["no","norwegian"],["th","thai"],["ur","urdu"],["hr","croatian"],["bg","bulgarian"],["lt","lithuanian"],["la","latin"],["mi","maori"],["ml","malayalam"],["cy","welsh"],["sk","slovak"],["te","telugu"],["fa","persian"],["lv","latvian"],["bn","bengali"],["sr","serbian"],["az","azerbaijani"],["sl","slovenian"],["kn","kannada"],["et","estonian"],["mk","macedonian"],["br","breton"],["eu","basque"],["is","icelandic"],["hy","armenian"],["ne","nepali"],["mn","mongolian"],["bs","bosnian"],["kk","kazakh"],["sq","albanian"],["sw","swahili"],["gl","galician"],["mr","marathi"],["pa","punjabi"],["si","sinhala"],["km","khmer"],["sn","shona"],["yo","yoruba"],["so","somali"],["af","afrikaans"],["oc","occitan"],["ka","georgian"],["be","belarusian"],["tg","tajik"],["sd","sindhi"],["gu","gujarati"],["am","amharic"],["yi","yiddish"],["lo","lao"],["uz","uzbek"],["fo","faroese"],["ht","haitian creole"],["ps","pashto"],["tk","turkmen"],["nn","nynorsk"],["mt","maltese"],["sa","sanskrit"],["lb","luxembourgish"],["my","myanmar"],["bo","tibetan"],["tl","tagalog"],["mg","malagasy"],["as","assamese"],["tt","tatar"],["haw","hawaiian"],["ln","lingala"],["ha","hausa"],["ba","bashkir"],["jw","javanese"],["su","sundanese"]],yx=new Map(VK),ixe=new Map([...VK.map(([t,e])=>[e,t]),["burmese","my"],["valencian","ca"],["flemish","nl"],["haitian","ht"],["letzeburgesch","lb"],["pushto","ps"],["panjabi","pa"],["moldavian","ro"],["moldovan","ro"],["sinhalese","si"],["castilian","es"]]);function sxe(t){t=t.toLowerCase();let e=ixe.get(t);if(e===void 0){const n=t.match(/^<\|([a-z]{2})\|>$/);if(n&&(t=n[1]),yx.has(t))e=t;else{const i=t.length===2?yx.keys():yx.values();throw new Error(`Language "${t}" is not supported. Must be one of: ${JSON.stringify(Array.from(i))}`)}}return e}var axe="\\p{P}\\u0021-\\u002F\\u003A-\\u0040\\u005B-\\u0060\\u007B-\\u007E",sB=new RegExp(`^[${axe}]+$`,"gu"),oxe=.1,lxe=class extends Xt{get timestamp_begin(){return this._tokenizer.token_to_id("<|notimestamps|>")+1}_decode_asr(t,{return_timestamps:e=!1,return_language:n=!1,time_precision:r=null,force_full_sequences:i=!0}={}){if(r===null)throw Error("Must specify time_precision");let s=null;const a=e==="word";function o(){return{language:s,timestamp:[null,null],text:""}}const l=[];let c=o(),u=0;const d=this.timestamp_begin,h=d+1500;let p=[],m=[],g=!1,v=null;const _=new Set(this.all_special_ids);for(const T of t){const N=T.tokens,A=a?T.token_timestamps:null;let L=null,M=d;if("stride"in T){const[j,$,U]=T.stride;if(u-=$,v=j-U,$&&(M=$/r+d),U)for(let te=N.length-1;te>=0;--te){const ne=Number(N[te]);if(ne>=d){if(L!==null&&(ne-d)*r<v)break;L=ne}}}let B=[],R=[];for(let j=0;j<N.length;++j){const $=Number(N[j]);if(_.has($)){const U=this.decode([$]),te=yx.get(U.slice(2,-2));if(te!==void 0){if(s!==null&&te!==s&&!e){p.push(B);const ne=this.findLongestCommonSequence(p)[0],le=this.decode(ne);c.text=le,l.push(c),p=[],B=[],c=o()}s=c.language=te}}else if($>=d&&$<=h){const U=($-d)*r+u,te=n_(U,2);if(L!==null&&$>=L)g=!0;else if(g||p.length>0&&$<M)g=!1;else if(c.timestamp[0]===null)c.timestamp[0]=te;else if(te!==c.timestamp[0]){c.timestamp[1]=te,p.push(B),a&&m.push(R);const[ne,le]=this.findLongestCommonSequence(p,m),V=this.decode(ne);if(c.text=V,a&&(c.words=this.collateWordTimestamps(ne,le,s),c.words.length>0&&c.timestamp[1]!==null))for(const q of c.words)q.timestamp[1]>c.timestamp[1]&&c.timestamp[1]>=q.timestamp[0]&&(q.timestamp[1]=c.timestamp[1]);l.push(c),p=[],B=[],m=[],R=[],c=o()}}else if(B.push($),a){let U=n_(A[j]+u,2),te;if(j+1<A.length){te=n_(A[j+1]+u,2);const ne=this.decode([$]);sB.test(ne)&&(te=n_(Math.min(U+r,te),2))}else te=null;R.push([U,te])}}if("stride"in T){const[j,$,U]=T.stride;u+=j-U}B.length>0?(p.push(B),a&&m.push(R)):p.every(j=>j.length===0)&&(c=o(),p=[],B=[],m=[],R=[])}if(p.length>0){if(i&&e)throw new Error("Whisper did not predict an ending timestamp, which can happen if audio is cut off in the middle of a word. Also make sure WhisperTimeStampLogitsProcessor was used during generation.");const[T,N]=this.findLongestCommonSequence(p,m),A=this.decode(T);c.text=A,a&&(c.words=this.collateWordTimestamps(T,N,s)),l.push(c)}let b=Object.create(null);const x=l.map(T=>T.text).join("");if(e||n){for(let T=0;T<l.length;++T){const N=l[T];e||delete N.timestamp,n||delete N.language}if(a){const T=[];for(const N of l)for(const A of N.words)T.push(A);b={chunks:T}}else b={chunks:l}}return[x,b]}findLongestCommonSequence(t,e=null){let n=t[0],r=n.length,i=[];const s=Array.isArray(e)&&e.length>0;let a=s?[]:null,o=s?e[0]:null;for(let l=1;l<t.length;++l){const c=t[l];let u=0,d=[r,r,0,0];const f=c.length;for(let b=1;b<r+f;++b){const x=Math.max(0,r-b),T=Math.min(r,r+f-b),N=n.slice(x,T),A=Math.max(0,b-r),L=Math.min(f,b),M=c.slice(A,L);if(N.length!==M.length)throw new Error("There is a bug within whisper `decode_asr` function, please report it. Dropping to prevent bad inference.");let B;s?B=N.filter(($,U)=>$===M[U]&&o[x+U][0]-oxe<=e[l][A+U][0]).length:B=N.filter(($,U)=>$===M[U]).length;const R=b/1e4,j=B/b+R;B>1&&j>u&&(u=j,d=[x,T,A,L])}const[h,p,m,g]=d,v=Math.floor((p+h)/2);let _=Math.floor((g+m)/2);if(s&&u===0&&r>0){const b=o[r-1][0],x=e[l].findIndex(T=>T[0]>=b);_=x===-1?c.length:x}i.push(...n.slice(0,v)),n=c.slice(_),r=n.length,s&&(a.push(...o.slice(0,v)),o=e[l].slice(_))}return i.push(...n),s?(a.push(...o),[i,a]):[i,[]]}collateWordTimestamps(t,e,n){const[r,i,s]=this.combineTokensIntoWords(t,n),a=[];for(let o=0;o<r.length;++o){const l=s[o];
510a.push({text:r[o],timestamp:[e[l.at(0)][0],e[l.at(-1)][1]]})}return a}combineTokensIntoWords(t,e,n=`"'â¡¿([{-`,r=`"'.ã,ï¼!ï¼?ï¼:ï¼â)]}ã`){e=e??"english";let i,s,a;return["chinese","japanese","thai","lao","myanmar"].includes(e)?[i,s,a]=this.splitTokensOnUnicode(t):[i,s,a]=this.splitTokensOnSpaces(t),this.mergePunctuations(i,s,a,n,r)}decode(t,e){let n;return e!=null&&e.decode_with_timestamps?(t instanceof He&&(t=jI(t)),n=this.decodeWithTimestamps(t,e)):n=super.decode(t,e),n}decodeWithTimestamps(t,e){const n=(e==null?void 0:e.time_precision)??.02,r=this.all_special_ids.at(-1)+1;let i=[[]];for(let s of t)if(s=Number(s),s>=r){const a=((s-r)*n).toFixed(2);i.push(`<|${a}|>`),i.push([])}else i[i.length-1].push(s);return i=i.map(s=>typeof s=="string"?s:super.decode(s,e)),i.join("")}splitTokensOnUnicode(t){const e=this.decode(t,{decode_with_timestamps:!0}),n="�",r=[],i=[],s=[];let a=[],o=[],l=0;for(let c=0;c<t.length;++c){const u=t[c];a.push(u),o.push(c);const d=this.decode(a,{decode_with_timestamps:!0});(!d.includes(n)||e[l+d.indexOf(n)]===n)&&(r.push(d),i.push(a),s.push(o),a=[],o=[],l+=d.length)}return[r,i,s]}splitTokensOnSpaces(t){const[e,n,r]=this.splitTokensOnUnicode(t),i=[],s=[],a=[];for(let o=0;o<e.length;++o){const l=e[o],c=n[o],u=r[o],d=c[0]>=this._tokenizer.token_to_id("<|endoftext|>"),f=l.startsWith(" "),h=l.trim(),p=sB.test(h);if(d||f||p||i.length===0)i.push(l),s.push(c),a.push(u);else{const m=i.length-1;i[m]+=l,s[m].push(...c),a[m].push(...u)}}return[i,s,a]}mergePunctuations(t,e,n,r,i){const s=structuredClone(t),a=structuredClone(e),o=structuredClone(n);let l=s.length-2,c=s.length-1;for(;l>=0;)s[l].startsWith(" ")&&r.includes(s[l].trim())?(s[c]=s[l]+s[c],a[c]=Hc(a[l],a[c]),o[c]=Hc(o[l],o[c]),s[l]="",a[l]=[],o[l]=[]):c=l,--l;for(l=0,c=1;c<s.length;)!s[l].endsWith(" ")&&i.includes(s[c])?(s[l]+=s[c],a[l]=Hc(a[l],a[c]),o[l]=Hc(o[l],o[c]),s[c]="",a[c]=[],o[c]=[]):l=c,++c;return[s.filter(u=>u),a.filter(u=>u.length>0),o.filter(u=>u.length>0)]}},cxe=class extends Xt{},uxe=class extends Xt{constructor(e,n){super(e,n);X(this,"return_token_type_ids",!0);en.warn('WARNING: `XLMTokenizer` is not yet supported by Hugging Face\'s "fast" tokenizers library. Therefore, you may experience slightly inaccurate results.')}},Kn=class{static async from_pretrained(t,{progress_callback:e=null,config:n=null,cache_dir:r=null,local_files_only:i=!1,revision:s="main"}={}){var u;const[a,o]=await UK(t,{progress_callback:e,config:n,cache_dir:r,local_files_only:i,revision:s}),l=((u=o.tokenizer_class)==null?void 0:u.replace(/Fast$/,""))??"PreTrainedTokenizer";let c=zK[l];return c||(en.warn(`Unknown tokenizer class "${l}", attempting to construct from base class.`),c=Xt),new c(a,o)}},kT="https://github.com/huggingface/transformers.js/issues/new/choose",UI="preprocessor_config.json",Aw=UI,qK="processor_config.json",WK="chat_template.jinja",Oy,Yn=(Oy=class extends Qa{constructor(t,e,n){super(),this.config=t,this.components=e,this.chat_template=n}get image_processor(){return this.components.image_processor}get tokenizer(){return this.components.tokenizer}get feature_extractor(){return this.components.feature_extractor}apply_chat_template(t,e={}){if(!this.tokenizer)throw new Error("Unable to apply chat template without a tokenizer.");return this.tokenizer.apply_chat_template(t,{tokenize:!1,chat_template:this.chat_template??void 0,...e})}batch_decode(...t){if(!this.tokenizer)throw new Error("Unable to decode without a tokenizer.");return this.tokenizer.batch_decode(...t)}decode(...t){if(!this.tokenizer)throw new Error("Unable to decode without a tokenizer.");return this.tokenizer.decode(...t)}async _call(t,...e){for(const n of[this.image_processor,this.feature_extractor,this.tokenizer])if(n)return n(t,...e);throw new Error("No image processor, feature extractor, or tokenizer found.")}static async from_pretrained(t,e={}){const[n,r,i]=await Promise.all([this.uses_processor_config?cu(t,qK,!0,e):{},Promise.all(this.classes.filter(s=>s in this).map(async s=>{const a=await this[s].from_pretrained(t,e);return[s.replace(/_class$/,""),a]})).then(Object.fromEntries),this.uses_chat_template_file?LI(t,WK,!0,e):null]);return new this(n,r,i)}},X(Oy,"classes",["image_processor_class","tokenizer_class","feature_extractor_class"]),X(Oy,"uses_processor_config",!1),X(Oy,"uses_chat_template_file",!1),Oy),eN={};u0(eN,{ChatterboxProcessor:()=>Bxe,CohereAsrProcessor:()=>zxe,Florence2Processor:()=>$ke,Gemma3Processor:()=>Vke,Gemma3nProcessor:()=>qke,Gemma4Processor:()=>Wke,Glm46VProcessor:()=>Gke,GraniteSpeechProcessor:()=>Hke,GroundingDinoProcessor:()=>Jke,Idefics3Processor:()=>hB,JinaCLIPProcessor:()=>eSe,Lfm2VlProcessor:()=>tSe,LlavaProcessor:()=>nSe,MgpstrProcessor:()=>rSe,MoonshineProcessor:()=>iSe,OwlViTProcessor:()=>sSe,PaliGemmaProcessor:()=>oSe,Phi3VProcessor:()=>cSe,PixtralProcessor:()=>uSe,Processor:()=>Yn,PyAnnoteProcessor:()=>dSe,Qwen2VLProcessor:()=>GI,Qwen2_5_VLProcessor:()=>xJ,Qwen3VLProcessor:()=>hSe,Sam2Processor:()=>SJ,Sam2VideoProcessor:()=>fSe,SamProcessor:()=>kJ,SmolVLMProcessor:()=>hB,SpeechT5Processor:()=>pSe,UltravoxProcessor:()=>mSe,VLChatProcessor:()=>Zke,VoxtralProcessor:()=>_Se,VoxtralRealtimeProcessor:()=>xSe,Wav2Vec2Processor:()=>kSe,Wav2Vec2ProcessorWithLM:()=>SSe,WhisperProcessor:()=>TSe});var ta=class extends Qa{constructor(t){super(),this.config=t}static async from_pretrained(t,e={}){const n=await cu(t,UI,!0,e);return new this(n)}};function Ns(t,e){var n;if(!(t instanceof Float32Array||t instanceof Float64Array))throw new Error(`${e} expects input to be a Float32Array or a Float64Array, but got ${((n=t==null?void 0:t.constructor)==null?void 0:n.name)??typeof t} instead. If using the feature extractor directly, remember to use \`read_audio(url, sampling_rate)\` to obtain the raw audio data of the file/url.`)}var zI={};u0(zI,{ASTFeatureExtractor:()=>Txe,ChatterboxFeatureExtractor:()=>Cxe,ClapFeatureExtractor:()=>Exe,CohereAsrFeatureExtractor:()=>Pxe,DacFeatureExtractor:()=>XK,EncodecFeatureExtractor:()=>JK,FeatureExtractor:()=>ta,Gemma3nAudioFeatureExtractor:()=>QK,Gemma4AudioFeatureExtractor:()=>ZK,GraniteSpeechFeatureExtractor:()=>Mxe,MoonshineFeatureExtractor:()=>Nxe,ParakeetFeatureExtractor:()=>YK,PyAnnoteFeatureExtractor:()=>eJ,SeamlessM4TFeatureExtractor:()=>Rxe,SnacFeatureExtractor:()=>Ixe,SpeechT5FeatureExtractor:()=>Lxe,VoxtralRealtimeFeatureExtractor:()=>Fxe,Wav2Vec2FeatureExtractor:()=>Oxe,WeSpeakerFeatureExtractor:()=>Dxe,WhisperFeatureExtractor:()=>jxe});var dxe=()=>{},hxe=dxe;
510async function GK(t,e){if(vn.IS_BROWSER_ENV){if(vn.IS_WEBWORKER_ENV)throw new Error("Unable to save a file from a Web Worker.");const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,r.click(),r.remove(),URL.revokeObjectURL(n)}else if(vn.IS_FS_AVAILABLE)e.stream(),yo.createWriteStream(t),await hxe();else throw new Error("Unable to save because filesystem is disabled in this environment.")}async function fxe(t,e){if(typeof AudioContext>"u")throw Error("Unable to load audio from path/URL since `AudioContext` is not available in your environment. Instead, audio data should be passed directly to the pipeline/processor. For more information and some example code, see https://huggingface.co/docs/transformers.js/guides/node-audio-processing.");const n=await(await Cw(t)).arrayBuffer(),r=new AudioContext({sampleRate:e});typeof e>"u"&&en.warn(`No sampling rate provided, using default of ${r.sampleRate}Hz.`);const i=await r.decodeAudioData(n);let s;if(i.numberOfChannels===2){const a=Math.sqrt(2),o=i.getChannelData(0),l=i.getChannelData(1);s=new Float32Array(o.length);for(let c=0;c<i.length;++c)s[c]=a*(o[c]+l[c])/2}else s=i.getChannelData(0);return s}var pxe=fxe;function HK(t,e){if(t<1)return new Float64Array;if(t===1)return new Float64Array([1]);const n=1-e,r=2*Math.PI/(t-1),i=new Float64Array(t);for(let s=0;s<t;++s)i[s]=e-n*Math.cos(s*r);return i}function aB(t){return HK(t,.5)}function mxe(t){return HK(t,.54)}var gxe={htk:t=>2595*Math.log10(1+t/700),kaldi:t=>1127*Math.log(1+t/700),slaney:(t,e=1e3,n=15,r=27/Math.log(6.4))=>t>=e?n+Math.log(t/e)*r:3*t/200};function K5(t,e="htk"){const n=gxe[e];if(!n)throw new Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return typeof t=="number"?n(t):t.map(r=>n(r))}var vxe={htk:t=>700*(10**(t/2595)-1),kaldi:t=>700*(Math.exp(t/1127)-1),slaney:(t,e=1e3,n=15,r=Math.log(6.4)/27)=>t>=n?e*Math.exp(r*(t-n)):200*t/3};function yxe(t,e="htk"){const n=vxe[e];if(!n)throw new Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return typeof t=="number"?n(t):t.map(r=>n(r))}function _xe(t,e){const n=Float64Array.from({length:e.length-1},(a,o)=>e[o+1]-e[o]),r=Array.from({length:t.length},()=>new Array(e.length));for(let a=0;a<t.length;++a){const o=r[a];for(let l=0;l<e.length;++l)o[l]=e[l]-t[a]}const i=e.length-2,s=Array.from({length:i},()=>new Array(t.length));for(let a=0;a<t.length;++a){const o=r[a];for(let l=0;l<i;++l){const c=-o[l]/n[l],u=o[l+2]/n[l+1];s[l][a]=Math.max(0,Math.min(c,u))}}return s}function oB(t,e,n){const r=(e-t)/(n-1);return Float64Array.from({length:n},(i,s)=>t+r*s)}function iu(t,e,n,r,i,s=null,a="htk",o=!1){if(s!==null&&s!=="slaney")throw new Error('norm must be one of null or "slaney"');if(t<2)throw new Error(`Require num_frequency_bins: ${t} >= 2`);if(n>r)throw new Error(`Require min_frequency: ${n} <= max_frequency: ${r}`);const l=K5(n,a),c=K5(r,a),u=oB(l,c,e+2);let d=yxe(u,a),f;if(o){const p=i/((t-1)*2);f=K5(Float64Array.from({length:t},(m,g)=>g*p),a),d=u}else f=oB(0,Math.floor(i/2),t);const h=_xe(f,d);if(s!==null&&s==="slaney")for(let p=0;p<e;++p){const m=h[p],g=2/(d[p+2]-d[p]);for(let v=0;v<t;++v)m[v]*=g}return h}function wxe(t,e,n){const r=new t.constructor(t.length+e+n),i=t.length-1;for(let s=0;s<t.length;++s)r[e+s]=t[s];for(let s=1;s<=e;++s)r[e-s]=t[Xk(s,i)];for(let s=1;s<=n;++s)r[i+e+s]=t[Xk(i-s,i)];return r}function KK(t,e,n,r,i){if(n<=0)throw new Error("reference must be greater than zero");if(r<=0)throw new Error("min_value must be greater than zero");n=Math.max(r,n);const s=Math.log10(n);for(let a=0;a<t.length;++a)t[a]=e*Math.log10(Math.max(r,t[a])-s);if(i!==null){if(i<=0)throw new Error("db_range must be greater than zero");const a=Pi(t)[0]-i;for(let o=0;o<t.length;++o)t[o]=Math.max(t[o],a)}return t}function bxe(t,e=1,n=1e-5,r=null){return KK(t,20,e,n,r)}function xxe(t,e=1,n=1e-10,r=null){return KK(t,10,e,n,r)}async function uu(t,e,n,r,{fft_length:i=null,power:s=1,center:a=!0,pad_mode:o="reflect",onesided:l=!0,preemphasis:c=null,preemphasis_htk_flavor:u=!0,mel_filters:d=null,mel_floor:f=1e-10,log_mel:h=null,max_log_mel:p=null,reference:m=1,min_value:g=1e-10,db_range:v=null,remove_dc_offset:_=null,min_num_frames:b=null,max_num_frames:x=null,do_pad:T=!0,transpose:N=!1,mel_offset:A=0,mel_floor_mode:L="clamp"}={}){const M=e.length;if(i===null&&(i=n),n>i)throw Error(`frame_length (${n}) may not be larger than fft_length (${i})`);
510if(M!==n)throw new Error(`Length of the window (${M}) must equal frame_length (${n})`);if(r<=0)throw new Error("hop_length must be greater than zero");if(s===null&&d!==null)throw new Error("You have provided `mel_filters` but `power` is `None`. Mel spectrogram computation is not yet supported for complex-valued spectrogram. Specify `power` to fix this issue.");if(!u)throw new Error("`preemphasis_htk_flavor=false` is not currently supported.");if(a){const he=Math.floor(n/2);switch(o){case"reflect":{t=wxe(t,he,he);break}case"constant":{const z=new t.constructor(t.length+2*he);z.set(t,he),t=z;break}case"semicausal":{const z=new t.constructor(t.length+he);z.set(t,he),t=z;break}default:throw new Error(`pad_mode="${o}" not implemented yet.`)}}let B=Math.floor(1+Math.floor((t.length-n)/r));b!==null&&B<b&&(B=b);const R=l?Math.floor(i/2)+1:i;let j=B,$=B;x!==null&&(x>B?T&&($=x):$=j=x);const U=new qbe(i),te=new Float64Array(i),ne=new Float64Array(U.outputBufferSize),le=new Float32Array(R*$);for(let he=0;he<j;++he){const z=he*r,J=Math.min(t.length-z,n);J!==n&&te.fill(0,0,n);for(let Y=0;Y<J;++Y)te[Y]=t[z+Y];if(_){let Y=0;for(let fe=0;fe<J;++fe)Y+=te[fe];const de=Y/J;for(let fe=0;fe<J;++fe)te[fe]-=de}if(c!==null){for(let Y=J-1;Y>=1;--Y)te[Y]-=c*te[Y-1];te[0]*=1-c}for(let Y=0;Y<e.length;++Y)te[Y]*=e[Y];U.realTransform(ne,te);for(let Y=0;Y<R;++Y){const de=Y<<1;le[Y*$+he]=ne[de]**2+ne[de+1]**2}}if(s!==null&&s!==2){const he=s/2;for(let z=0;z<le.length;++z)le[z]**=he}const V=d.length;let q=await o2e(new He("float32",d.flat(),[V,R]),new He("float32",le,[R,$]));N&&(q=q.transpose(1,0));const se=q.data;if(L==="add")for(let he=0;he<se.length;++he)se[he]=A+se[he]+f;else for(let he=0;he<se.length;++he)se[he]=A+Math.max(f,se[he]);if(s!==null&&h!==null){const he=Math.min(se.length,j*V);switch(h){case"log":for(let z=0;z<he;++z)se[z]=Math.log(se[z]);break;case"log10":for(let z=0;z<he;++z)se[z]=Math.log10(se[z]);break;case"log10_max_norm":{for(let Y=0;Y<he;++Y)se[Y]=Math.log10(se[Y]);const J=(p??Pi(se)[0])-8;for(let Y=0;Y<he;++Y)se[Y]=(Math.max(se[Y],J)+4)/4;break}case"dB":if(s===1)bxe(se,m,g,v);else if(s===2)xxe(se,m,g,v);else throw new Error(`Cannot use log_mel option '${h}' with power ${s}`);break;default:throw new Error(`log_mel must be one of null, 'log', 'log10', 'log10_max_norm', or 'dB'. Got '${h}'`)}}return q}function Sd(t,e,{periodic:n=!0,frame_length:r=null,center:i=!0}={}){const s=n?t+1:t;let a;switch(e){case"boxcar":a=new Float64Array(s).fill(1);break;case"hann":case"hann_window":a=aB(s);break;case"hamming":a=mxe(s);break;case"povey":a=aB(s).map(c=>Math.pow(c,.85));break;default:throw new Error(`Unknown window type ${e}.`)}if(n&&(a=a.subarray(0,t)),r===null||t===r)return a;
510if(t>r)throw new Error(`Length of the window (${t}) may not be larger than frame_length (${r})`);const o=new Float64Array(r),l=i?Math.floor((r-t)/2):0;return o.set(a,l),o}function kxe(t,e){const n=t.reduce((s,a)=>s+a.length,0),r=new ArrayBuffer(44),i=new DataView(r);return s2(i,0,"RIFF"),i.setUint32(4,36+n*4,!0),s2(i,8,"WAVE"),s2(i,12,"fmt "),i.setUint32(16,16,!0),i.setUint16(20,3,!0),i.setUint16(22,1,!0),i.setUint32(24,e,!0),i.setUint32(28,e*4,!0),i.setUint16(32,4,!0),i.setUint16(34,32,!0),s2(i,36,"data"),i.setUint32(40,n*4,!0),new Blob([r,...t.map(s=>s.buffer)],{type:"audio/wav"})}function s2(t,e,n){for(let r=0;r<n.length;++r)t.setUint8(e+r,n.charCodeAt(r))}var Sxe=class{constructor(t,e){this.audio=t,this.sampling_rate=e}get data(){if(Array.isArray(this.audio)){if(this.audio.length===0)return new Float32Array(0);if(this.audio.length===1)return this.audio[0];const t=this.audio.reduce((r,i)=>r+i.length,0),e=new Float32Array(t);let n=0;for(const r of this.audio)e.set(r,n),n+=r.length;return e}else return this.audio}toBlob(){let t=this.audio;return t instanceof Float32Array&&(t=[t]),kxe(t,this.sampling_rate)}async save(t){return GK(t,this.toBlob())}},Txe=class extends ta{constructor(t){super(t);const e=this.config.sampling_rate,n=iu(257,this.config.num_mel_bins,20,Math.floor(e/2),e,null,"kaldi",!0);this.mel_filters=n,this.window=Sd(400,"hann",{periodic:!1}),this.mean=this.config.mean,this.std=this.config.std}async _extract_fbank_features(t,e){return uu(t,this.window,400,160,{fft_length:512,power:2,center:!1,preemphasis:.97,mel_filters:this.mel_filters,log_mel:"log",mel_floor:1192092955078125e-22,remove_dc_offset:!0,max_num_frames:e,transpose:!0})}async _call(t){Ns(t,"ASTFeatureExtractor");const e=await this._extract_fbank_features(t,this.config.max_length);if(this.config.do_normalize){const n=this.std*2,r=e.data;for(let i=0;i<r.length;++i)r[i]=(r[i]-this.mean)/n}return{input_values:e.unsqueeze_(0)}}},JK=class extends ta{async _call(t){Ns(t,"EncodecFeatureExtractor"),t instanceof Float64Array&&(t=new Float32Array(t));const e=this.config.feature_size;if(t.length%e!==0)throw new Error(`The length of the audio data must be a multiple of the number of channels (${e}).`);const n=[1,e,t.length/e];return{input_values:new He("float32",t,n)}}},Cxe=class extends ta{async _call(t){Ns(t,"ChatterboxFeatureExtractor"),t instanceof Float64Array&&(t=new Float32Array(t));const e=[1,t.length];return{input_values:new He("float32",t,e)}}},Exe=class extends ta{constructor(t){super(t),this.mel_filters=iu(this.config.nb_frequency_bins,this.config.feature_size,this.config.frequency_min,this.config.frequency_max,this.config.sampling_rate,null,"htk"),this.mel_filters_slaney=iu(this.config.nb_frequency_bins,this.config.feature_size,this.config.frequency_min,this.config.frequency_max,this.config.sampling_rate,"slaney","slaney"),this.window=Sd(this.config.fft_window_size,"hann")}async _get_input_mel(t,e,n,r){let i;const s=t.length-e;if(s>0)if(n==="rand_trunc"){const a=Math.floor(RI.random()*(s+1));t=t.subarray(a,a+e),i=await this._extract_fbank_features(t,this.mel_filters_slaney,this.config.nb_max_samples)}else throw new Error(`Truncation strategy "${n}" not implemented`);else{if(s<0){let a=new Float64Array(e);if(a.set(t),r==="repeat")for(let o=t.length;o<e;o+=t.length)a.set(t.subarray(0,Math.min(t.length,e-o)),o);else if(r==="repeatpad")for(let o=t.length;o<-s;o+=t.length)a.set(t,o);t=a}if(n==="fusion")throw new Error(`Truncation strategy "${n}" not implemented`);i=await this._extract_fbank_features(t,this.mel_filters_slaney,this.config.nb_max_samples)}return i.unsqueeze_(0)}async _extract_fbank_features(t,e,n=null){return uu(t,this.window,this.config.fft_window_size,this.config.hop_length,{power:2,mel_filters:e,log_mel:"dB",max_num_frames:n,do_pad:!1,transpose:!0})}async _call(t,{max_length:e=null}={}){return Ns(t,"ClapFeatureExtractor"),{input_features:(await this._get_input_mel(t,e??this.config.nb_max_samples,this.config.truncation,this.config.padding)).unsqueeze_(0)}}},Axe=1e-5,YK=class extends ta{constructor(t){var r;super(t),(r=this.config).mel_filters??(r.mel_filters=iu(Math.floor(1+this.config.n_fft/2),this.config.feature_size,0,this.config.sampling_rate/2,this.config.sampling_rate,"slaney","slaney"));const e=Sd(this.config.win_length,"hann",{periodic:!1});this.window=new Float64Array(this.config.n_fft);const n=Math.floor((this.config.n_fft-this.config.win_length)/2);this.window.set(e,n)}async _extract_fbank_features(t){const e=this.config.preemphasis;t=new Float64Array(t);for(let r=t.length-1;r>=1;--r)t[r]-=e*t[r-1];return await uu(t,this.window,this.window.length,this.config.hop_length,{fft_length:this.config.n_fft,power:2,mel_filters:this.config.mel_filters,log_mel:"log",mel_floor:-1/0,pad_mode:"constant",center:!0,transpose:!0,mel_offset:2**-24})}async _call(t){Ns(t,"ParakeetFeatureExtractor");const e=await this._extract_fbank_features(t),n=Math.floor((t.length+Math.floor(this.config.n_fft/2)*2-this.config.n_fft)/this.config.hop_length),r=e.data;r.fill(0,n*e.dims[1]);const[i,s]=e.dims,a=new Float64Array(s),o=new Float64Array(s);for(let u=0;u<n;++u){const d=u*s;for(let f=0;f<s;++f){const h=r[d+f];a[f]+=h,o[f]+=h*h}}const l=n>1?n-1:1;for(let u=0;u<s;++u){const d=a[u]/n,f=(o[u]-n*d*d)/l,p=1/(Math.sqrt(f)+Axe);for(let m=0;m<n;++m){const g=m*s+u;r[g]=(r[g]-d)*p}}const c=new BigInt64Array(i);return c.fill(1n,0,n),{input_features:e.unsqueeze_(0),attention_mask:new He("int64",c,[1,i])}}},Pxe=class extends YK{_apply_dither(t){const e=this.config.dither??0;if(e<=0)return t;const n=new xT(t.length);for(let r=0;r<t.length;++r)t[r]+=e*n.gauss();return t}split_audio(t){const e=this.config.max_audio_clip_s??35,n=this.config.overlap_chunk_second??5,r=this.config.min_energy_window_samples??1600,i=this.config.sampling_rate,s=Math.max(1,Math.round(e*i)),a=Math.max(1,Math.round(n*i));if(t.length<=s)return[t];const o=[];let l=0;const c=t.length;for(;l<c;){if(l+s>=c){o.push(t.slice(l,c));break}const u=Math.max(l,l+s-a),d=Math.min(l+s,c);let f;d<=u?f=l+s:f=this._find_split_point_energy(t,u,d,r),f=Math.max(l+1,Math.min(f,c)),o.push(t.slice(l,f)),l=f}return o}_find_split_point_energy(t,e,n,r){const i=n-e;if(i<=r)return Math.floor((e+n)/2);let s=1/0,a=e;const o=i-r;for(let l=0;l<=o;l+=r){let c=0;for(let u=0;u<r;++u){const d=t[e+l+u];
510c+=d*d}c=Math.sqrt(c/r),c<s&&(s=c,a=e+l)}return a}async _call(t){Ns(t,"CohereAsrFeatureExtractor");const e=new Float64Array(t);return this._apply_dither(e),super._call(e)}},XK=class extends JK{},QK=class extends ta{constructor(t){super(t);const{fft_length:e,feature_size:n,min_frequency:r,max_frequency:i,sampling_rate:s,frame_length:a}=this.config,o=iu(Math.floor(1+e/2),n,r,i,s,null,"htk",!1);this.mel_filters=o,this.window=Sd(a,"hann")}async _extract_fbank_features(t,e){return uu(t,this.window,this.config.frame_length,this.config.hop_length,{fft_length:this.config.fft_length,center:!1,onesided:!0,preemphasis:this.config.preemphasis,preemphasis_htk_flavor:this.config.preemphasis_htk_flavor,mel_filters:this.mel_filters,log_mel:"log",mel_floor:this.config.mel_floor,remove_dc_offset:!1,transpose:!0})}async _call(t,{max_length:e=48e4,truncation:n=!0,padding:r=!0,pad_to_multiple_of:i=128}={}){if(Ns(t,"Gemma3nAudioFeatureExtractor"),n&&t.length>e&&(t=t.slice(0,e)),r&&t.length%i!==0){const o=i-t.length%i,l=new Float64Array(t.length+o);l.set(t),this.config.padding_value!==0&&l.fill(this.config.padding_value,t.length),t=l}const s=await this._extract_fbank_features(t,this.config.max_length),a=Qs([1,s.dims[0]],!0);return{input_features:s.unsqueeze_(0),input_features_mask:a}}},ZK=class extends QK{async _extract_fbank_features(t,e){const{frame_length:n,hop_length:r,fft_length:i}=this.config,s=Math.floor(n/2),a=Math.floor((t.length+s-(n+1))/r)+1;return uu(t,this.window,n,r,{fft_length:i,center:!0,pad_mode:"semicausal",onesided:!0,preemphasis:this.config.preemphasis,preemphasis_htk_flavor:this.config.preemphasis_htk_flavor,mel_filters:this.mel_filters,log_mel:"log",mel_floor:this.config.mel_floor,mel_floor_mode:"add",remove_dc_offset:!1,transpose:!0,max_num_frames:a})}async _call(t,e={}){Ns(t,"Gemma4AudioFeatureExtractor");const n=t.length,r=await super._call(t,e),{input_features:i}=r,[,s,a]=i.dims,{frame_length:o,hop_length:l}=this.config,c=Math.floor(o/2),u=o+1,d=new Uint8Array(n+c+(e.pad_to_multiple_of??128));d.fill(1,c,c+n);const f=new Uint8Array(s);for(let p=0;p<s;++p)f[p]=d[p*l+u-1]?1:0;const h=i.data;for(let p=0;p<s;++p)f[p]||h.fill(0,p*a,(p+1)*a);return r.input_features_mask=new He("bool",f,[1,s]),r}},Mxe=class extends ta{constructor(t){super(t);const{n_fft:e,win_length:n,n_mels:r,sample_rate:i}=t.melspec_kwargs;this.mel_filters=iu(Math.floor(1+e/2),r,0,i/2,i,null,"htk");const s=Sd(n,"hann");this.window=new Float64Array(e);const a=Math.floor((e-n)/2);this.window.set(s,a)}async _call(t){Ns(t,"GraniteSpeechFeatureExtractor");const{n_fft:e,hop_length:n,n_mels:r}=this.config.melspec_kwargs,i=1+Math.floor((t.length-1)/n),s=i-i%2;return{input_features:(await uu(t,this.window,e,n,{power:2,mel_filters:this.mel_filters,log_mel:"log10_max_norm",transpose:!0,max_num_frames:s,do_pad:!1})).view(-1,2*r).unsqueeze_(0)}}},Nxe=class extends ta{async _call(t){Ns(t,"MoonshineFeatureExtractor"),t instanceof Float64Array&&(t=new Float32Array(t));const e=[1,t.length];return{input_values:new He("float32",t,e)}}},eJ=class extends ta{async _call(t){Ns(t,"PyAnnoteFeatureExtractor"),t instanceof Float64Array&&(t=new Float32Array(t));const e=[1,1,t.length];return{input_values:new He("float32",t,e)}}samples_to_frames(t){return(t-this.config.offset)/this.config.step}post_process_speaker_diarization(t,e){const n=e/this.samples_to_frames(e)/this.config.sampling_rate,r=[];for(const i of t.tolist()){const s=[];let a=-1;for(let o=0;o<i.length;++o){const l=Ms(i[o]),[c,u]=Pi(l),[d,f]=[o,o+1];u!==a?(a=u,s.push({id:u,start:d,end:f,score:c})):(s.at(-1).end=f,s.at(-1).score+=c)}r.push(s.map(({id:o,start:l,end:c,score:u})=>({id:o,start:l*n,end:c*n,confidence:u/(c-l)})))}return r}},Rxe=class extends ta{constructor(t){super(t);const e=this.config.sampling_rate,n=iu(257,this.config.num_mel_bins,20,Math.floor(e/2),e,null,"kaldi",!0);this.mel_filters=n,this.window=Sd(400,"povey",{periodic:!1})}async _extract_fbank_features(t,e){return t=t.map(n=>n*32768),uu(t,this.window,400,160,{fft_length:512,power:2,center:!1,preemphasis:.97,mel_filters:this.mel_filters,log_mel:"log",mel_floor:1192092955078125e-22,remove_dc_offset:!0,max_num_frames:e,transpose:!0})}async _call(t,{padding:e=!0,pad_to_multiple_of:n=2,do_normalize_per_mel_bins:r=!0,return_attention_mask:i=!0}={}){Ns(t,"SeamlessM4TFeatureExtractor");let s=await this._extract_fbank_features(t,this.config.max_length);if(r){const[h,p]=s.dims,m=s.data;for(let g=0;g<p;++g){let v=0;for(let T=0;T<h;++T)v+=m[T*p+g];const _=v/h;let b=0;for(let T=0;T<h;++T)b+=(m[T*p+g]-_)**2;b/=h-1;const x=Math.sqrt(b+1e-7);for(let T=0;T<h;++T){const N=T*p+g;m[N]=(m[N]-_)/x}}}let a;if(e){const[h,p]=s.dims,m=s.data,g=h%n;if(g>0){const v=new Float32Array(p*(h+g));v.set(m),v.fill(this.config.padding_value,m.length);const _=h+g;s=new He(s.type,v,[_,p]),i&&(a=new He("int64",new BigInt64Array(_),[1,_]),a.data.fill(1n,0,h))}}const[o,l]=s.dims,c=this.config.stride;if(o%c!==0)throw new Error(`The number of frames (${o}) must be a multiple of the stride (${c}).`);const d=s.view(1,Math.floor(o/c),l*c),f={input_features:d};if(i){const h=d.dims[1],p=new BigInt64Array(h);if(a){const m=a.data;for(let g=1,v=0;g<o;g+=c,++v)p[v]=m[g]}else p.fill(1n);f.attention_mask=new He("int64",p,[1,h])}return f}},Ixe=class extends XK{},Lxe=class extends ta{},Oxe=class extends ta{_zero_mean_unit_var_norm(t){const n=t.reduce((i,s)=>i+s,0)/t.length,r=t.reduce((i,s)=>i+(s-n)**2,0)/t.length;return t.map(i=>(i-n)/Math.sqrt(r+1e-7))}async _call(t){Ns(t,"Wav2Vec2FeatureExtractor"),t instanceof Float64Array&&(t=new Float32Array(t));let e=t;this.config.do_normalize&&(e=this._zero_mean_unit_var_norm(e));const n=[1,e.length];return{input_values:new He("float32",e,n),attention_mask:new He("int64",new BigInt64Array(e.length).fill(1n),n)}}},Dxe=class extends ta{constructor(t){super(t);const e=this.config.sampling_rate,n=iu(257,this.config.num_mel_bins,20,Math.floor(e/2),e,null,"kaldi",!0);this.mel_filters=n,this.window=Sd(400,"hamming",{periodic:!1}),this.min_num_frames=this.config.min_num_frames}async _extract_fbank_features(t){return t=t.map(e=>e*32768),uu(t,this.window,400,160,{fft_length:512,power:2,center:!1,preemphasis:.97,mel_filters:this.mel_filters,log_mel:"log",mel_floor:1192092955078125e-22,remove_dc_offset:!0,transpose:!0,min_num_frames:this.min_num_frames})}async _call(t){Ns(t,"WeSpeakerFeatureExtractor");const e=(await this._extract_fbank_features(t)).unsqueeze_(0);if(this.config.fbank_centering_span===null){const n=e.mean(1).data,r=e.data,[i,s,a]=e.dims;for(let o=0;o<i;++o){const l=o*s*a,c=o*a;for(let u=0;u<s;++u){const d=l+u*a;for(let f=0;f<a;++f)r[d+f]-=n[c+f]}}}return{input_features:e}}},Fxe=class extends ta{constructor(t){var e;super(t),(e=this.config).mel_filters??(e.mel_filters=iu(Math.floor(1+this.config.n_fft/2),this.config.feature_size,0,8e3,this.config.sampling_rate,"slaney","slaney")),this.window=Sd(this.config.n_fft,"hann")}async _extract_fbank_features(t,{center:e=!0}={}){const{n_fft:n,hop_length:r,mel_filters:i,global_log_mel_max:s}=this.config,a=Math.floor(e?t.length/r:(t.length-n)/r);return await uu(t,this.window,n,r,{power:2,mel_filters:i,log_mel:"log10_max_norm",max_log_mel:s,center:e,max_num_frames:a,do_pad:!1})}async _call(t,{center:e=!0}={}){return Ns(t,"VoxtralRealtimeFeatureExtractor"),{input_features:(await this._extract_fbank_features(t,{center:e})).unsqueeze_(0)}}},jxe=class extends ta{constructor(t){var e;super(t),(e=this.config).mel_filters??(e.mel_filters=iu(Math.floor(1+this.config.n_fft/2),this.config.feature_size,0,8e3,this.config.sampling_rate,"slaney","slaney")),this.window=Sd(this.config.n_fft,"hann")}async _extract_fbank_features(t){return await uu(t,this.window,this.config.n_fft,this.config.hop_length,{power:2,mel_filters:this.config.mel_filters,log_mel:"log10_max_norm",max_num_frames:Math.min(Math.floor(t.length/this.config.hop_length),this.config.nb_max_frames)})}async _call(t,{max_length:e=null}={}){Ns(t,"WhisperFeatureExtractor");let n;const r=e??this.config.n_samples;return t.length>r?(t.length>this.config.n_samples&&en.warn("Attempting to extract features for audio longer than 30 seconds. If using a pipeline to extract transcript from a long audio clip, remember to specify `chunk_length_s` and/or `stride_length_s`."),n=t.slice(0,r)):(n=new Float32Array(r),n.set(t)),{input_features:(await this._extract_fbank_features(n)).unsqueeze_(0)}}},sl=class{static async from_pretrained(t,e={}){const n=await cu(t,UI,!0,e),r=n.feature_extractor_type,i=zI[r];if(!i)throw new Error(`Unknown feature_extractor_type: '${r}'. Please report this at ${kT}.`);return new i(n)}},A2,Bxe=(A2=class extends Yn{async _call(t,e=null){const n=this.tokenizer(t),r=e?await this.feature_extractor(e):{};return{...n,...r}}},X(A2,"tokenizer_class",Kn),X(A2,"feature_extractor_class",sl),A2),U
vendor: 10,563 bytes, line 510
510xe=new Set(["ja","zh"]),Dy,zxe=(Dy=class extends Yn{get_decoder_prompt_ids(t="en"){const e=["â","<|startofcontext|>","<|startoftranscript|>","<|emo:undefined|>",`<|${t}|>`,`<|${t}|>`,"<|pnc|>","<|noitn|>","<|notimestamp|>","<|nodiarize|>"];return this.tokenizer.convert_tokens_to_ids(e)}static join_chunks(t,e="en"){const n=t.filter(s=>s&&s.trim());if(n.length===0)return"";const r=Uxe.has(e)?"":" ";return[n[0].trimEnd(),...n.slice(1).map(s=>s.trim())].join(r)}async _call(t){return await this.feature_extractor(t)}},X(Dy,"tokenizer_class",Kn),X(Dy,"feature_extractor_class",sl),X(Dy,"uses_processor_config",!0),Dy),tN={},Jf,tJ,oh;if(vn.IS_WEB_ENV)Jf=(t,e)=>{if(!self.OffscreenCanvas)throw new Error("OffscreenCanvas not supported by this environment.");return new self.OffscreenCanvas(t,e)},oh=self.createImageBitmap,tJ=self.ImageData;else if(tN)oh=async t=>{const n=(await t.metadata()).channels,{data:r,info:i}=await t.rotate().raw().toBuffer({resolveWithObject:!0}),s=new nc(new Uint8ClampedArray(r),i.width,i.height,i.channels);return n!==void 0&&n!==i.channels&&s.convert(n),s};else throw new Error("Unable to load image processing library.");var $xe={0:"nearest",1:"lanczos",2:"bilinear",3:"bicubic",4:"box",5:"hamming"},Vxe=new Map([["png","image/png"],["jpg","image/jpeg"],["jpeg","image/jpeg"],["gif","image/gif"]]),nc=class Mc{constructor(e,n,r,i){this.data=e,this.width=n,this.height=r,this.channels=i}get size(){return[this.width,this.height]}static async read(e){if(e instanceof Mc)return e;if(typeof e=="string"||e instanceof URL)return await this.fromURL(e);if(e instanceof Blob)return await this.fromBlob(e);if(typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas)return this.fromCanvas(e);throw new Error(`Unsupported input type: ${typeof e}`)}static fromCanvas(e){if(!vn.IS_WEB_ENV)throw new Error("fromCanvas() is only supported in browser environments.");const r=e.getContext("2d").getImageData(0,0,e.width,e.height).data;return new Mc(r,e.width,e.height,4)}static async fromURL(e){const n=await Cw(e);if(n.status!==200)throw new Error(`Unable to read image from "${e}" (${n.status} ${n.statusText})`);const r=await n.blob();return this.fromBlob(r)}static async fromBlob(e){if(vn.IS_WEB_ENV){const n=await oh(e),r=Jf(n.width,n.height).getContext("2d");return r.drawImage(n,0,0),new this(r.getImageData(0,0,n.width,n.height).data,n.width,n.height,4)}else{const n=tN(await e.arrayBuffer());return await oh(n)}}static fromTensor(e,n="CHW"){if(e.dims.length!==3)throw new Error(`Tensor should have 3 dimensions, but has ${e.dims.length} dimensions.`);if(n==="CHW")e=e.transpose(1,2,0);else if(n!=="HWC")throw new Error(`Unsupported channel format: ${n}`);if(!(e.data instanceof Uint8ClampedArray||e.data instanceof Uint8Array))throw new Error(`Unsupported tensor type: ${e.type}`);switch(e.dims[2]){case 1:case 2:case 3:case 4:return new Mc(e.data,e.dims[1],e.dims[0],e.dims[2]);default:throw new Error(`Unsupported number of channels: ${e.dims[2]}`)}}grayscale(){if(this.channels===1)return this;const e=new Uint8ClampedArray(this.width*this.height*1);switch(this.channels){case 3:case 4:for(let n=0,r=0;n<this.data.length;n+=this.channels){const i=this.data[n],s=this.data[n+1],a=this.data[n+2];e[r++]=Math.round(.2989*i+.587*s+.114*a)}break;default:throw new Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this._update(e,this.width,this.height,1)}rgb(){if(this.channels===3)return this;const e=new Uint8ClampedArray(this.width*this.height*3);switch(this.channels){case 1:for(let n=0,r=0;n<this.data.length;++n)e[r++]=this.data[n],e[r++]=this.data[n],e[r++]=this.data[n];break;case 4:for(let n=0,r=0;n<this.data.length;n+=4)e[r++]=this.data[n],e[r++]=this.data[n+1],e[r++]=this.data[n+2];break;default:throw new Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this._update(e,this.width,this.height,3)}rgba(){if(this.channels===4)return this;const e=new Uint8ClampedArray(this.width*this.height*4);switch(this.channels){case 1:for(let n=0,r=0;n<this.data.length;++n)e[r++]=this.data[n],e[r++]=this.data[n],e[r++]=this.data[n],e[r++]=255;break;case 3:for(let n=0,r=0;n<this.data.length;n+=3)e[r++]=this.data[n],e[r++]=this.data[n+1],e[r++]=this.data[n+2],e[r++]=255;break;default:throw new Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this._update(e,this.width,this.height,4)}putAlpha(e){if(e.width!==this.width||e.height!==this.height)throw new Error(`Expected mask size to be ${this.width}x${this.height}, but got ${e.width}x${e.height}`);if(e.channels!==1)throw new Error(`Expected mask to have 1 channel, but got ${e.channels}`);const n=this.data,r=e.data,i=this.width*this.height;if(this.channels===3){const s=new Uint8ClampedArray(i*4);for(let a=0,o=0,l=0;a<i;++a)s[l++]=n[o++],s[l++]=n[o++],s[l++]=n[o++],s[l++]=r[a];return this._update(s,this.width,this.height,4)}else if(this.channels===4){for(let s=0;s<i;++s)n[4*s+3]=r[s];return this}throw new Error(`Expected image to have 3 or 4 channels, but got ${this.channels}`)}async resize(e,n,{resample:r=2}={}){if(this.width===e&&this.height===n)return this;let i=$xe[r]??r;const s=E8(e),a=E8(n);if(s&&a)return this;if(s?e=n/this.height*this.width:a&&(n=e/this.width*this.height),vn.IS_WEB_ENV){const o=this.channels,l=this.toCanvas(),c=Jf(e,n).getContext("2d");return c.drawImage(l,0,0,e,n),new Mc(c.getImageData(0,0,e,n).data,e,n,4).convert(o)}else{let o=this.toSharp();switch(i){case"box":case"hamming":(i==="box"||i==="hamming")&&(en.warn(`Resampling method ${i} is not yet supported. Using bilinear instead.`),i="bilinear");case"nearest":case"bilinear":case"bicubic":o=o.affine([e/this.width,0,0,n/this.height],{interpolator:i});break;case"lanczos":o=o.resize({width:e,height:n,fit:"fill",kernel:"lanczos3"});break;default:throw new Error(`Resampling method ${i} is not supported.`)}return await oh(o)}}async pad([e,n,r,i]){if(e=Math.max(e,0),n=Math.max(n,0),r=Math.max(r,0),i=Math.max(i,0),e===0&&n===0&&r===0&&i===0)return this;if(vn.IS_WEB_ENV){const s=this.channels,a=this.toCanvas(),o=this.width+e+n,l=this.height+r+i,c=Jf(o,l).getContext("2d");return c.drawImage(a,0,0,this.width,this.height,e,r,this.width,this.height),new Mc(c.getImageData(0,0,o,l).data,o,l,4).convert(s)}else{const s=this.toSharp().extend({left:e,right:n,top:r,bottom:i});return await oh(s)}}async crop([e,n,r,i]){if(e=Math.max(e,0),n=Math.max(n,0),r=Math.min(r,this.width-1),i=Math.min(i,this.height-1),e===0&&n===0&&r===this.width-1&&i===this.height-1)return this;const s=r-e+1,a=i-n+1;if(vn.IS_WEB_ENV){const o=this.channels,l=this.toCanvas(),c=Jf(s,a).getContext("2d");return c.drawImage(l,e,n,s,a,0,0,s,a),new Mc(c.getImageData(0,0,s,a).data,s,a,4).convert(o)}else{const o=this.toSharp().extract({left:e,top:n,width:s,height:a});return await oh(o)}}async center_crop(e,n){if(this.width===e&&this.height===n)return this;const r=(this.width-e)/2,i=(this.height-n)/2;if(vn.IS_WEB_ENV){const s=this.channels,a=this.toCanvas(),o=Jf(e,n).getContext("2d");let l=0,c=0,u=0,d=0;return r>=0?l=r:u=-r,i>=0?c=i:d=-i,o.drawImage(a,l,c,e,n,u,d,e,n),new Mc(o.getImageData(0,0,e,n).data,e,n,4).convert(s)}else{let s=this.toSharp();if(r>=0&&i>=0)s=s.extract({left:Math.floor(r),top:Math.floor(i),width:e,height:n});else if(r<=0&&i<=0){const a=Math.floor(-i),o=Math.floor(-r);s=s.extend({top:a,left:o,right:e-this.width-o,bottom:n-this.height-a})}else{let a=[0,0],o=0;i<0?(a[0]=Math.floor(-i),a[1]=n-this.height-a[0]):o=Math.floor(i);let l=[0,0],c=0;r<0?(l[0]=Math.floor(-r),l[1]=e-this.width-l[0]):c=Math.floor(r),s=s.extend({top:a[0],bottom:a[1],left:l[0],right:l[1]}).extract({left:c,top:o,width:e,height:n})}return await oh(s)}}async toBlob(e="image/png",n=1){if(!vn.IS_WEB_ENV)throw new Error("toBlob() is only supported in browser environments.");return await this.toCanvas().convertToBlob({type:e,quality:n})}toTensor(e="CHW"){let n=new He("uint8",new Uint8Array(this.data),[this.height,this.width,this.channels]);if(e!=="HWC")if(e==="CHW")n=n.permute(2,0,1);else throw new Error(`Unsupported channel format: ${e}`);return n}toCanvas(){if(!vn.IS_WEB_ENV)throw new Error("toCanvas() is only supported in browser environments.");const e=this.clone().rgba(),n=Jf(e.width,e.height),r=new tJ(e.data,e.width,e.height);return n.getContext("2d").putImageData(r,0,0),n}split(){const{data:e,width:n,height:r,channels:i}=this,s=e.constructor,a=e.length/i,o=Array.from({length:i},()=>new s(a));for(let l=0;l<a;++l){const c=i*l;for(let u=0;u<i;++u)o[u][l]=e[c+u]}return o.map(l=>new Mc(l,n,r,1))}_update(e,n,r,i=null){return this.data=e,this.width=n,this.height=r,i!==null&&(this.channels=i),this}clone(){return new Mc(this.data.slice(),this.width,this.height,this.channels)}convert(e){if(this.channels===e)return this;switch(e){case 1:this.grayscale();break;case 3:this.rgb();break;case 4:this.rgba();break;default:throw new Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this}async save(e){if(vn.IS_WEB_ENV){if(vn.IS_WEBWORKER_ENV)throw new Error("Unable to save an image from a Web Worker.");const n=e.split(".").pop().toLowerCase(),r=Vxe.get(n)??"image/png",i=await this.toBlob(r);return GK(e,i)}else if(vn.IS_FS_AVAILABLE)await this.toSharp().toFile(e);else throw new Error("Unable to save the image because filesystem is disabled in this environment.")}toSharp(){if(vn.IS_WEB_ENV)throw new Error("toSharp() is only supported in server-side environments.");return tN(this.data,{raw:{width:this.width,height:this.height,channels:this.channels}})}};nc.read.bind(nc);function lB(t,e,n=0,r=null){const i=t/e;let s=Gbe(i)*e;return r!==null&&s>r&&(s=Math.floor(i)*e),s<n&&(s=Math.ceil(i)*e),s}function cB([t,e],n){return[Math.max(Math.floor(t/n),1)*n,Math.max(Math.floor(e/n),1)*n]}function nJ([t,e,n,r]){return[t-n/2,e-r/2,t+n/2,e+r/2]}function ST(t,e=.5,n=null,r=!1){const i=t.logits,s=t.pred_boxes,[a,o,l]=i.dims;if(n!==null&&n.length!==a)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let c=[];for(let u=0;u<a;++u){let d=n!==null?n[u]:null,f={boxes:[],classes:[],scores:[]},h=i[u],p=s[u];for(let m=0;m<o;++m){let g=h[m],v=[],_;if(r){_=g.sigmoid().data;for(let b=0;b<_.length;++b)_[b]>e&&v.push(b)}else{let b=Pi(g.data)[1];if(b===l-1||(_=Ms(g.data),_[b]<e))continue;v.push(b)}for(const b of v){let x=p[m].data;x=nJ(x),d!==null&&(x=x.map((T,N)=>T*d[(N+1)%2])),f.boxes.push(x),f.classes.push(b),f.scores.push(_[b])}}c.push(f)}return c}
510function rJ(t,e=null){const n=t.logits,r=n.dims[0];if(e!==null&&e.length!==r)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");const i=[];for(let s=0;s<r;++s){const a=e!==null?e[s]:null;let o=n[s];a!==null&&(o=LK(o,a,"bilinear",!1));const[l,c]=a??o.dims.slice(-2),u=new He("int32",new Int32Array(l*c),[l,c]),d=o[0].data,f=u.data;for(let m=1;m<o.dims[0];++m){const g=o[m].data;for(let v=0;v<g.length;++v)g[v]>d[v]&&(d[v]=g[v],f[v]=m)}const h=new Array(o.dims[0]);for(let m=0;m<f.length;++m){const g=f[m];h[g]=g}const p=h.filter(m=>m!==void 0);i.push({segmentation:u,labels:p})}return i}function qxe(t,e,n,r){const i=[],s=[],a=[];for(let o=0;o<t.dims[0];++o){const l=t[o],c=e[o],u=Pi(l.data)[1];if(u===r)continue;const f=Ms(l.data)[u];f>n&&(i.push(c),s.push(f),a.push(u))}return[i,s,a]}function Wxe(t,e,n,r=.5,i=.8){const s=[];let a=0,o=0;const l=e[n].data;for(let u=0;u<t.length;++u)t[u]===n&&(s.push(u),++a),l[u]>=r&&++o;let c=a>0&&o>0;return c&&(c=a/o>i),[c,s]}function Gxe(t,e,n,r,i,s=null,a=null){const[o,l]=a??t[0].dims,c=new He("int32",new Int32Array(o*l),[o,l]),u=[];if(a!==null)for(let m=0;m<t.length;++m)t[m]=LK(t[m],a,"bilinear",!1);const d=new Int32Array(t[0].data.length),f=new Float32Array(t[0].data.length);for(let m=0;m<t.length;++m){let g=e[m];const v=t[m].data;for(let _=0;_<v.length;++_)v[_]*=g,v[_]>f[_]&&(d[_]=m,f[_]=v[_])}let h=0;const p=c.data;for(let m=0;m<n.length;++m){const g=n[m],[v,_]=Wxe(d,t,m,r,i);if(v){++h;for(const b of _)p[b]=h;u.push({id:h,label_id:g,score:e[m]})}}return[c,u]}function $I(t,e,n=28,r=56*56,i=14*14*4*1280,s=1){if(t<n||e<n){const l=Math.max(n/t,n/e);t=Math.round(t*l),e=Math.round(e*l)}if(Math.max(t,e)/Math.min(t,e)>200)throw new Error(`absolute aspect ratio must be smaller than 200, got ${Math.max(t,e)/Math.min(t,e)}`);let a=Math.round(t/n)*n,o=Math.round(e/n)*n;if(s*a*o>i){const l=Math.sqrt(s*t*e/i);a=Math.max(n,Math.floor(t/l/n)*n),o=Math.max(n,Math.floor(e/l/n)*n)}else if(s*a*o<r){const l=Math.sqrt(r/(s*t*e));a=Math.ceil(t*l/n)*n,o=Math.ceil(e*l/n)*n}return[o,a]}function iJ(t,e=.5,n=.5,r=.8,i=null,s=null){i===null&&(en.warn("`label_ids_to_fuse` unset. No instance will be fused."),i=new Set);const a=t.class_queries_logits??t.logits,l=(t.masks_queries_logits??t.pred_masks).sigmoid();let[c,u,d]=a.dims;if(d-=1,s!==null&&s.length!==c)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let f=[];for(let h=0;h<c;++h){let p=s!==null?s[h]:null,m=a[h],g=l[h],[v,_,b]=qxe(m,g,e,d);if(b.length===0){let[N,A]=p??g.dims.slice(-2),L=new He("int32",new Int32Array(N*A).fill(-1),[N,A]);f.push({segmentation:L,segments_info:[]});continue}let[x,T]=Gxe(v,_,b,n,r,i,p);f.push({segmentation:x,segments_info:T})}return f}function sJ(t,e=.5,n=null){throw new Error("`post_process_instance_segmentation` is not yet implemented.")}var on=class extends Qa{constructor(t){super(),this.image_mean=t.image_mean??t.mean,this.image_std=t.image_std??t.std,this.resample=t.resample??2,this.do_rescale=t.do_rescale??!0,this.rescale_factor=t.rescale_factor??1/255,this.do_normalize=t.do_normalize,this.do_thumbnail=t.do_thumbnail,this.size=t.size??t.image_size,this.do_resize=t.do_resize??this.size!==void 0,this.size_divisibility=t.size_divisibility??t.size_divisor,this.do_center_crop=t.do_center_crop,this.crop_size=t.crop_size,this.do_convert_rgb=t.do_convert_rgb??!0,this.do_crop_margin=t.do_crop_margin,this.pad_size=t.pad_size,this.do_pad=t.do_pad,this.min_pixels=t.min_pixels,this.max_pixels=t.max_pixels,this.do_pad&&!this.pad_size&&!this.size_divisibility&&this.size&&this.size.width!==void 0&&this.size.height!==void 0&&(this.pad_size=this.size),this.do_flip_channel_order=t.do_flip_channel_order??!1,this.config=t}async thumbnail(t,e,n=2){const r=t.height,i=t.width,s=e.height,a=e.width;let o=Math.min(r,s),l=Math.min(i,a);return o===r&&l===i?t:(r>i?l=Math.floor(i*o/r):i>r&&(o=Math.floor(r*l/i)),await t.resize(l,o,{resample:n}))}async crop_margin(t,e=200){const n=t.clone().grayscale(),r=YM(n.data)[0],s=Pi(n.data)[0]-r;if(s===0)return t;const a=e/255;let o=n.width,l=n.height,c=0,u=0;const d=n.data;for(let f=0;f<n.height;++f){const h=f*n.width;for(let p=0;p<n.width;++p)(d[h+p]-r)/s<a&&(o=Math.min(o,p),l=Math.min(l,f),c=Math.max(c,p),u=Math.max(u,f))}return t=await t.crop([o,l,c,u]),t}pad_image(t,e,n,{mode:r="constant",center:i=!1,constant_values:s=0}={}){const[a,o,l]=e;let c,u;
vendor: 11,184 bytes, line 510
510if(typeof n=="number"?(c=n,u=n):n==="square"?c=u=Math.max(a,o):(c=n.width,u=n.height),c!==o||u!==a){const d=new Float32Array(c*u*l);if(Array.isArray(s))for(let p=0;p<d.length;++p)d[p]=s[p%l];else s!==0&&d.fill(s);const[f,h]=i?[Math.floor((c-o)/2),Math.floor((u-a)/2)]:[0,0];for(let p=0;p<a;++p){const m=(p+h)*c,g=p*o;for(let v=0;v<o;++v){const _=(m+v+f)*l,b=(g+v)*l;for(let x=0;x<l;++x)d[_+x]=t[b+x]}}if(r==="symmetric"){if(i)throw new Error("`center` padding is not supported when `mode` is set to `symmetric`.");const p=a-1,m=o-1;for(let g=0;g<u;++g){const v=g*c,_=Xk(g,p)*o;for(let b=0;b<c;++b){if(g<a&&b<o)continue;const x=(v+b)*l,T=(_+Xk(b,m))*l;for(let N=0;N<l;++N)d[x+N]=t[T+N]}}}t=d,e=[u,c,l]}return[t,e]}rescale(t){for(let e=0;e<t.length;++e)t[e]=this.rescale_factor*t[e]}get_resize_output_image_size(t,e){const[n,r]=t.size;let i,s;if(this.do_thumbnail){const{height:a,width:o}=e;i=Math.min(a,o)}else Number.isInteger(e)?(i=e,s=this.config.max_size??i):e!==void 0&&(i=e.shortest_edge,s=e.longest_edge);if(i!==void 0||s!==void 0){const a=i===void 0?1:Math.max(i/n,i/r),o=n*a,l=r*a,c=s===void 0?1:Math.min(s/o,s/l);let u=Math.floor(Number((o*c).toFixed(2))),d=Math.floor(Number((l*c).toFixed(2)));return this.size_divisibility!==void 0&&([u,d]=cB([u,d],this.size_divisibility)),[u,d]}else if(e!==void 0&&e.width!==void 0&&e.height!==void 0){let a=e.width,o=e.height;if(this.config.keep_aspect_ratio&&this.config.ensure_multiple_of){let l=o/r,c=a/n;Math.abs(1-c)<Math.abs(1-l)?l=c:c=l,o=lB(l*r,this.config.ensure_multiple_of),a=lB(c*n,this.config.ensure_multiple_of)}return[a,o]}else{if(this.size_divisibility!==void 0)return cB([n,r],this.size_divisibility);throw new Error(`Could not resize image due to unsupported \`this.size\` option in config: ${JSON.stringify(e)}`)}}async resize(t){const[e,n]=this.get_resize_output_image_size(t,this.size);return await t.resize(e,n,{resample:this.resample})}async preprocess(t,{do_normalize:e=null,do_pad:n=null,do_convert_rgb:r=null,do_convert_grayscale:i=null,do_flip_channel_order:s=null}={}){this.do_crop_margin&&(t=await this.crop_margin(t));const[a,o]=t.size;if(r??this.do_convert_rgb?t=t.rgb():i&&(t=t.grayscale()),this.do_resize&&(t=await this.resize(t)),this.do_thumbnail&&(t=await this.thumbnail(t,this.size,this.resample)),this.do_center_crop){let f,h;Number.isInteger(this.crop_size)?(f=this.crop_size,h=this.crop_size):(f=this.crop_size.width,h=this.crop_size.height),t=await t.center_crop(f,h)}const l=[t.height,t.width];let c=Float32Array.from(t.data),u=[t.height,t.width,t.channels];if(this.do_rescale&&this.rescale(c),e??this.do_normalize){let f=this.image_mean;Array.isArray(this.image_mean)||(f=new Array(t.channels).fill(f));let h=this.image_std;if(Array.isArray(this.image_std)||(h=new Array(t.channels).fill(h)),f.length!==t.channels||h.length!==t.channels)throw new Error(`When set to arrays, the length of \`image_mean\` (${f.length}) and \`image_std\` (${h.length}) must match the number of channels in the image (${t.channels}).`);for(let p=0;p<c.length;p+=t.channels)for(let m=0;m<t.channels;++m)c[p+m]=(c[p+m]-f[m])/h[m]}if(n??this.do_pad){if(this.pad_size)[c,u]=this.pad_image(c,[t.height,t.width,t.channels],this.pad_size);else if(this.size_divisibility){const f=Math.ceil(u[1]/this.size_divisibility)*this.size_divisibility,h=Math.ceil(u[0]/this.size_divisibility)*this.size_divisibility;[c,u]=this.pad_image(c,u,{width:f,height:h})}}if(s??this.do_flip_channel_order){if(u[2]!==3)throw new Error("Flipping channel order is only supported for RGB images.");for(let f=0;f<c.length;f+=3){const h=c[f];c[f]=c[f+2],c[f+2]=h}}const d=new He("float32",c,u).permute(2,0,1);return{original_size:[o,a],reshaped_input_size:l,pixel_values:d}}async _call(t,...e){Array.isArray(t)||(t=[t]);const n=await Promise.all(t.map(i=>this.preprocess(i)));return{pixel_values:gd(n.map(i=>i.pixel_values),0),original_sizes:n.map(i=>i.original_size),reshaped_input_sizes:n.map(i=>i.reshaped_input_size)}}static async from_pretrained(t,e={}){const n=await cu(t,Aw,!0,e);return new this(n)}},tS={};u0(tS,{BeitFeatureExtractor:()=>Hxe,BitImageProcessor:()=>Kxe,CHMv2ImageProcessor:()=>Yxe,CLIPFeatureExtractor:()=>Xxe,CLIPImageProcessor:()=>aJ,ChineseCLIPFeatureExtractor:()=>Jxe,ConvNextFeatureExtractor:()=>Qxe,ConvNextImageProcessor:()=>oJ,DINOv3ViTImageProcessor:()=>tke,DPTFeatureExtractor:()=>rke,DPTImageProcessor:()=>uJ,DeiTFeatureExtractor:()=>Zxe,DeiTImageProcessor:()=>lJ,DetrFeatureExtractor:()=>eke,DetrImageProcessor:()=>cJ,DonutFeatureExtractor:()=>nke,DonutImageProcessor:()=>VI,EfficientNetImageProcessor:()=>ike,GLPNFeatureExtractor:()=>cke,Gemma3ImageProcessor:()=>ske,Gemma4ImageProcessor:()=>dJ,Glm46VImageProcessor:()=>lke,GroundingDinoImageProcessor:()=>uke,Idefics3ImageProcessor:()=>uB,ImageFeatureExtractor:()=>on,ImageProcessor:()=>on,JinaCLIPImageProcessor:()=>hke,Lfm2VlImageProcessor:()=>vke,LlavaOnevisionImageProcessor:()=>yke,Mask2FormerImageProcessor:()=>wke,MaskFormerFeatureExtractor:()=>_ke,MaskFormerImageProcessor:()=>qI,MobileNetV1FeatureExtractor:()=>bke,MobileNetV1ImageProcessor:()=>fJ,MobileNetV2FeatureExtractor:()=>xke,MobileNetV2ImageProcessor:()=>pJ,MobileNetV3FeatureExtractor:()=>kke,MobileNetV3ImageProcessor:()=>mJ,MobileNetV4FeatureExtractor:()=>Ske,MobileNetV4ImageProcessor:()=>gJ,MobileViTFeatureExtractor:()=>Tke,MobileViTImageProcessor:()=>vJ,NougatImageProcessor:()=>Cke,OwlViTFeatureExtractor:()=>Eke,OwlViTImageProcessor:()=>WI,Owlv2ImageProcessor:()=>Ake,Phi3VImageProcessor:()=>Mke,PixtralImageProcessor:()=>Nke,PvtImageProcessor:()=>Rke,Qwen2VLImageProcessor:()=>hJ,RTDetrImageProcessor:()=>Ike,Sam2ImageProcessor:()=>X5,Sam3ImageProcessor:()=>X5,SamImageProcessor:()=>X5,SapiensFeatureExtractor:()=>Lke,SapiensImageProcessor:()=>yJ,SegformerFeatureExtractor:()=>Oke,SegformerImageProcessor:()=>_J,SiglipImageProcessor:()=>Dke,SmolVLMImageProcessor:()=>uB,Swin2SRImageProcessor:()=>Fke,VLMImageProcessor:()=>dke,ViTFeatureExtractor:()=>jke,ViTImageProcessor:()=>wJ,VitMatteImageProcessor:()=>Bke,VitPoseImageProcessor:()=>Uke,YolosFeatureExtractor:()=>zke,YolosImageProcessor:()=>bJ});var Hxe=class extends on{},Kxe=class extends on{},Jxe=class extends on{},Yxe=class extends on{},aJ=class extends on{},Xxe=class extends aJ{},oJ=class extends on{constructor(t){super(t),this.crop_pct=this.config.crop_pct??224/256}async resize(t){var n;const e=(n=this.size)==null?void 0:n.shortest_edge;if(e===void 0)throw new Error("Size dictionary must contain 'shortest_edge' key.");if(e<384){const r=Math.floor(e/this.crop_pct),[i,s]=this.get_resize_output_image_size(t,{shortest_edge:r});t=await t.resize(i,s,{resample:this.resample}),t=await t.center_crop(e,e)}else t=await t.resize(e,e,{resample:this.resample});return t}},Qxe=class extends oJ{},lJ=class extends on{},Zxe=class extends lJ{},cJ=class extends on{async _call(t){const e=await super._call(t),n=[e.pixel_values.dims[0],64,64],r=Qs(n,1n);return{...e,pixel_mask:r}}post_process_object_detection(...t){return ST(...t)}post_process_panoptic_segmentation(...t){return iJ(...t)}post_process_instance_segmentation(...t){return sJ(...t)}},eke=class extends cJ{},tke=class extends on{},VI=class extends on{pad_image(t,e,n,r={}){const[i,s,a]=e;let o=this.image_mean;Array.isArray(this.image_mean)||(o=new Array(a).fill(o));let l=this.image_std;Array.isArray(l)||(l=new Array(a).fill(o));const c=o.map((u,d)=>-u/l[d]);return super.pad_image(t,e,n,{center:!0,constant_values:c,...r})}},nke=class extends VI{},uJ=class extends on{},rke=class extends uJ{},ike=class extends on{constructor(t){super(t),this.include_top=this.config.include_top??!0,this.include_top&&(this.image_std=this.image_std.map(e=>e*e))}},ske=class extends on{};function ake(t,e,n,r,i){const s=r*n**2,a=Math.sqrt(s/(t*e)),o=i*n;let l=Math.floor(a*t/o)*o,c=Math.floor(a*e/o)*o;if(l===0&&c===0)throw new Error(`Attempting to resize to a 0 x 0 image. Resized height should be divisible by \`pooling_kernel_size * patch_size\`=${o}.`);const u=Math.floor(r/i**2)*o;return l===0?(l=o,c=Math.min(Math.floor(e/t)*o,u)):c===0&&(c=o,l=Math.min(Math.floor(t/e)*o,u)),[l,c]}function oke(t,e,n,r,i,s,a){const o=Math.floor(e/i),l=Math.floor(n/i),c=o*l,u=i*i*r,d=new Float32Array(s*u);let f=0;for(let m=0;m<o;++m)for(let g=0;g<l;++g)for(let v=0;v<i;++v){const _=(m*i+v)*n*r+g*i*r;for(let b=0;b<i;++b){const x=_+b*r;for(let T=0;T<r;++T)d[f++]=t[x+T]}}const h=new BigInt64Array(s*2).fill(-1n);let p=0;for(let m=0;m<o;++m)for(let g=0;g<l;++g)h[p++]=BigInt(g),h[p++]=BigInt(m);return{patches:new He("float32",d,[s,u]),positions:new He("int64",h,[s,2]),num_soft_tokens:Math.floor(c/a**2)}}var dJ=class extends Qa{constructor(t){super(),this.config=t,this.patch_size=t.patch_size??16,this.max_soft_tokens=t.max_soft_tokens??280,this.pooling_kernel_size=t.pooling_kernel_size??3,this.resample=t.resample??3,this.rescale_factor=t.rescale_factor??1/255,this.do_rescale=t.do_rescale??!0,this.do_resize=t.do_resize??!0,this.do_convert_rgb=t.do_convert_rgb??!0}async _call(t){Array.isArray(t)||(t=[t]);const{patch_size:e,pooling_kernel_size:n}=this,r=this.max_soft_tokens*n**2,i=[],s=[],a=[];for(let o of t){if(this.do_convert_rgb&&(o=o.rgb()),this.do_resize){const[f,h]=ake(o.height,o.width,e,r,n);(f!==o.height||h!==o.width)&&(o=await o.resize(h,f,{resample:this.resample}))}const l=Float32Array.from(o.data);if(this.do_rescale)for(let f=0;f<l.length;++f)l[f]*=this.rescale_factor;const{patches:c,positions:u,num_soft_tokens:d}=oke(l,o.height,o.width,o.channels,e,r,n);i.push(c),s.push(u),a.push(d)}return{pixel_values:gd(i,0),image_position_ids:gd(s,0),num_soft_tokens_per_image:a}}},hJ=class extends on{constructor(t){var e,n;super(t),this.min_pixels=t.min_pixels??((e=t.size)==null?void 0:e.shortest_edge),this.max_pixels=t.max_pixels??((n=t.size)==null?void 0:n.longest_edge),this.patch_size=t.patch_size,this.merge_size=t.merge_size}get_resize_output_image_size(t,e){const n=this.patch_size*this.merge_size;return $I(t.height,t.width,n,this.min_pixels,this.max_pixels)}async _call(t,...e){const{pixel_values:n,original_sizes:r,reshaped_input_sizes:i}=await super._call(t,...e);let s=n;const{temporal_patch_size:a,merge_size:o,patch_size:l}=this.config;s.dims[0]===1&&(s=Lr(Array.from({length:a},()=>s),0));const c=s.dims[0]/a,u=s.dims[1],d=Math.floor(s.dims[2]/l),f=Math.floor(s.dims[3]/l),h=s.view(c,a,u,Math.floor(d/o),o,l,Math.floor(f/o),o,l).permute(0,3,6,4,7,2,1,5,8).view(c*d*f,u*a*l*l),p=new He("int64",[c,d,f],[1,3]);return{pixel_values:h,image_grid_thw:p,original_sizes:r,reshaped_input_sizes:i}}},lke=class extends hJ{get_resize_output_image_size(t,e){const n=this.patch_size*this.merge_size,r=this.config.temporal_patch_size??2;return $I(t.height,t.width,n,this.min_pixels,this.max_pixels,r)}},cke=class extends on{},uke=class extends on{async _call(t){const e=await super._call(t),n=e.pixel_values.dims,r=Ya([n[0],n[2],n[3]]);return{...e,pixel_mask:r}}},uB=class extends on{constructor(t){super(t),this.do_image_splitting=t.do_image_splitting??!0,this.max_image_size=t.max_image_size}get_resize_for_vision_encoder(t,e){let[n,r]=t.dims.slice(-2);const i=r/n;return r>=n?(r=Math.ceil(r/e)*e,n=Math.floor(r/i),n=Math.ceil(n/e)*e):(n=Math.ceil(n/e)*e,r=Math.floor(n*i),r=M
510ath.ceil(r/e)*e),{height:n,width:r}}async _call(t,{do_image_splitting:e=null,return_row_col_info:n=!1}={}){let r;if(!Array.isArray(t))r=[[t]];else{if(t.length===0||!t[0])throw new Error("No images provided.");Array.isArray(t[0])?r=t:r=[t]}let i=[],s=[],a=[];const o=[],l=[];for(const g of r){let v=await Promise.all(g.map(x=>this.preprocess(x)));o.push(...v.map(x=>x.original_size)),l.push(...v.map(x=>x.reshaped_input_size)),v.forEach(x=>x.pixel_values.unsqueeze_(0));const{longest_edge:_}=this.max_image_size;let b;if(e??this.do_image_splitting){let x=new Array(v.length),T=new Array(v.length);b=await Promise.all(v.map(async(N,A)=>{const L=this.get_resize_for_vision_encoder(N.pixel_values,_),M=await tc(N.pixel_values,{size:[L.height,L.width]}),{frames:B,num_splits_h:R,num_splits_w:j}=await this.split_image(M,this.max_image_size);return x[A]=R,T[A]=j,Lr(B,0)})),s.push(x),a.push(T)}else{const x=[_,_];b=await Promise.all(v.map(T=>tc(T.pixel_values,{size:x}))),s.push(new Array(v.length).fill(0)),a.push(new Array(v.length).fill(0))}i.push(Lr(b,0))}const c=i.length,[u,d,f,h]=i[0].dims;let p,m;if(c===1)p=i[0].unsqueeze_(0),m=Qs([c,u,f,h],!0);else{const g=Math.max(...i.map(b=>b.dims.at(0)));m=Qs([c,g,f,h],!0);const v=m.data,_=g*f*h;for(let b=0;b<c;++b){const x=i[b].dims[0];if(x<g){i[b]=Lr([i[b],Qs([g-x,d,f,h],0)],0);const T=b*_+x*f*h,N=(b+1)*_;v.fill(!1,T,N)}}p=gd(i,0)}return{pixel_values:p,pixel_attention_mask:m,original_sizes:o,reshaped_input_sizes:l,...n?{rows:s,cols:a}:{}}}async split_image(t,{longest_edge:e}){const n=e,r=e,i=[],[s,a]=t.dims.slice(-2);let o=0,l=0;if(s>n||a>r){o=Math.ceil(s/n),l=Math.ceil(a/r);const c=Math.ceil(s/o),u=Math.ceil(a/l);for(let h=0;h<o;++h)for(let p=0;p<l;++p){let m,g,v,_;h===o-1?(g=s-c,_=s):(g=h*c,_=(h+1)*c),p===l-1?(m=a-u,v=a):(m=p*u,v=(p+1)*u);const T=await OK(t,[g,m],[_,v],[2,3]);i.push(T)}const d=n,f=r;(s!==d||a!==f)&&(t=await tc(t,{size:[d,f]}))}return i.push(t),{frames:i,num_splits_h:o,num_splits_w:l}}},dke=class extends on{constructor(t){super({do_pad:!0,pad_size:{width:t.image_size,height:t.image_size},...t}),this.constant_values=this.config.background_color.map(e=>e*this.rescale_factor)}pad_image(t,e,n,r){return super.pad_image(t,e,n,{constant_values:this.constant_values,center:!0,...r})}},hke=class extends on{constructor(t){const{resize_mode:e,fill_color:n,interpolation:r,size:i,...s}=t,a=e==="squash"?{width:i,height:i}:e==="shortest"?{shortest_edge:i}:{longest_edge:i},o=r==="bicubic"?3:2;super({...s,size:a,resample:o,do_center_crop:!0,crop_size:i,do_normalize:!0})}};function dB(t,e){return Math.round(t/e)*e}function fke(t,e,n,r,i){let s=1/0,a=[1,1];const o=n*r;for(const l of e){const c=Math.abs(t-l[0]/l[1]);c<s?(s=c,a=l):c===s&&o>.5*i*i*l[0]*l[1]&&(a=l)}return a}function pke(t,e){const n=[],r=new Set;for(let i=t;i<=e;++i)for(let s=1;s<=i;++s)for(let a=1;a<=i;++a){const o=s*a;if(o>=t&&o<=e){const l=s<<16|a;r.has(l)||(r.add(l),n.push([s,a]))}}return n.sort((i,s)=>i[0]*i[1]-s[0]*s[1])}function mke(t,e){const[n,r,i,s]=t.dims,a=Math.floor(i/e),o=Math.floor(s/e),l=e*e*r,c=t.data,u=new Float32Array(n*a*o*l),d=i*s;for(let f=0;f<n;++f){const h=f*r*d,p=f*a*o*l;for(let m=0;m<a;++m)for(let g=0;g<o;++g){let v=p+(m*o+g)*l;for(let _=0;_<e;++_){const b=(m*e+_)*s+g*e;for(let x=0;x<e;++x){const T=b+x;for(let N=0;N<r;++N)u[v++]=c[h+N*d+T]}}}}return new He("float32",u,[n,a*o,l])}function gke(t,e){const[,n,r]=t.dims,i=new BigInt64Array(e);i.fill(1n,0,n);let s=t;if(n<e){const a=new Float32Array(e*r);a.set(t.data),s=new He("float32",a,[1,e,r])}return{padded:s,mask:new He("int64",i,[e])}}var vke=class extends on{constructor(t){super(t),this.downsample_factor=t.downsample_factor??2,this.do_image_splitting=t.do_image_splitting??!0,this.min_tiles=t.min_tiles??2,this.max_tiles=t.max_tiles??10,this.use_thumbnail=t.use_thumbnail??!0,this.min_image_tokens=t.min_image_tokens??64,this.max_image_tokens=t.max_image_tokens??256,this.encoder_patch_size=t.encoder_patch_size??t.patch_size??16,this.tile_size=t.tile_size??512,this.max_pixels_tolerance=t.max_pixels_tolerance??2,this.return_row_col_info=t.return_row_col_info??!1;const e=this.max_image_tokens*this.downsample_factor**2,n=this.do_image_splitting?(this.tile_size/this.encoder_patch_size)**2:0;this.max_num_patches=Math.max(e,n)}_is_image_too_large(t,e){const n=this.encoder_patch_size*this.downsample_factor,r=Math.max(this.encoder_patch_size,dB(t,n)),i=Math.max(this.encoder_patch_size,dB(e,n));return r*i>this.max_image_tokens*(this.encoder_patch_size*this.downsample_factor)**2*this.max_pixels_tolerance}_get_grid_layout(t,e){const n=pke(this.min_tiles,this.max_tiles),[r,i]=fke(e/t,n,e,t,this.tile_size);return{grid_width:r,grid_height:i,target_width:this.tile_size*r,target_height:this.tile_size*i}}async _call(t,{return_row_col_info:e=null}={}){let n;Array.isArray(t)?Array.isArray(t[0])?n=t:n=[t]:n=[[t]];const r=[],i=[],s=[],a=[],o=[],l=[];for(const u of n){const d=await Promise.all(u.map(f=>this.preprocess(f,{do_pad:!1})));for(const{pixel_values:f}of d){const[,h,p]=f.dims,m=f.unsqueeze_(0),g=this.encoder_patch_size*this.downsample_factor,v=g**2,[_,b]=$I(Math.max(g,h),Math.max(g,p),g,this.min_image_tokens*v,this.max_image_tokens*v).map(M=>Math.max(g,M));let x,T=1,N=1;const A=this._is_image_too_large(h,p),L=this.do_image_splitting&&!(this.min_tiles===1&&this.max_tiles===1);if(A&&L){const{grid_width:M,grid_height:B,target_width:R,target_height:j}=this._get_grid_layout(h,p);T=B,N=M;const $=await tc(m,{size:[j,R]});x=[];for(let U=0;U<B;++U)for(let te=0;te<M;++te){const ne=U*this.tile_size,le=te*this.tile_size;x.push($.slice(null,null,[ne,ne+this.tile_size],[le,le+this.tile_size]))}this.use_thumbnail&&M*B!==1&&x.push(await tc(m,{size:[b,_]}))}else x=[await tc(m,{size:[b,_]})];for(const M of x){const[,,B,R]=M.dims,j=mke(M,this.encoder_patch_size),{padded:$,mask:U}=gke(j,this.max_num_patches);r.push($),i.push(U),s.push([Math.floor(B/this.encoder_patch_size),Math.floor(R/this.encoder_patch_size)])}a.push(T),o.push(N),l.push([b,_])}}const c={pixel_values:Lr(r,0),pixel_attention_mask:gd(i,0),spatial_shapes:new He("int64",BigInt64Array.from(s.flat(),BigInt),[s.length,2])};return(e??this.return_row_col_info)&&(c.image_rows=a,c.image_cols=o,c.image_sizes=l),c}},yke=class extends on{},qI=class extends on{post_process_panoptic_segmentation(...t){return iJ(...t)}post_process_instance_segmentation(...t){return sJ(...t)}},_ke=class extends qI{},wke=class extends qI{},fJ=class extends on{},bke=class extends fJ{},pJ=class extends on{},xke=class extends pJ{},mJ=class extends on{},kke=class extends mJ{},gJ=class extends on{},Ske=class extends gJ{},vJ=class extends on{},Tke=class extends vJ{},Cke=class extends VI{},WI=class extends on{post_process_object_detection(...t){return ST(...t)}}
510,Eke=class extends WI{},Ake=class extends WI{},co=336,Pke=[2,3],{ceil:J5,floor:Qm,sqrt:Y5}=Math,Mke=class extends on{constructor(t){super({...t,do_normalize:!0,do_pad:!0,pad_size:"custom",do_convert_rgb:!0,do_resize:!0}),this._num_crops=t.num_crops}calc_num_image_tokens_from_image_size(t,e){const{num_img_tokens:n}=this.config;return Qm((Qm(e/co)*Qm(t/co)+1)*n+1+(Qm(e/co)+1)*Y5(n))}get_resize_output_image_size(t,e){const n=this._num_crops,[r,i]=t.size;let s=r/i,a=1;for(;a*Math.ceil(a/s)<=n;)a+=1;a-=1;const o=Math.floor(a*336),l=Math.floor(o/s);return[o,l]}pad_image(t,e,n,r={}){const[i,s]=e,a=co*J5(i/co),o=co*J5(s/co),l=[1,1,1].map((c,u)=>(c-this.image_mean[u])/this.image_std[u]);return super.pad_image(t,e,{width:o,height:a},{center:!0,constant_values:l,...r})}async _call(t,{num_crops:e=null}={}){if(this._num_crops=e??(e=this.config.num_crops),e<4||Y5(e)%1!==0)throw new Error("num_crops must be a square number >= 4");Array.isArray(t)||(t=[t]);const n=t.length,r=await Promise.all(t.map(d=>this.preprocess(d))),i=r.map(d=>d.original_size),s=r.map(d=>d.reshaped_input_size),a=[];for(const{pixel_values:d}of r){d.unsqueeze_(0);const[f,h]=d.dims.slice(-2),p=await tc(d,{size:[co,co],mode:"bicubic"});if(e>0){const m=[],g=Y5(e),v=Qm(h/g),_=Qm(f/g);for(let x=0;x<g;++x)for(let T=0;T<g;++T){let N,A,L,M;x===g-1?(A=f-_,M=f):(A=x*_,M=(x+1)*_),T===g-1?(N=h-v,L=h):(N=T*v,L=(T+1)*v);const j=await OK(d,[A,N],[M,L],Pke);m.push(j)}const b=await tc(Lr(m,0),{size:[co,co],mode:"bicubic"});a.push(Lr([p,b],0))}else a.push(p)}const o=gd(a,0),l=s.map(d=>d.map(f=>co*J5(f/co))),c=new He("int64",l.flat(),[n,2]),u=l.map(([d,f])=>this.calc_num_image_tokens_from_image_size(f,d));return{pixel_values:o,original_sizes:i,reshaped_input_sizes:s,image_sizes:c,num_img_tokens:u}}},Nke=class extends on{get_resize_output_image_size(t,e){const{longest_edge:n}=e;if(n===void 0)throw new Error("size must contain 'longest_edge'");const[r,i]=t.size,s=Math.max(r,i)/n;let a=r,o=i;s>1&&(a=Math.floor(r/s),o=Math.floor(i/s));const{patch_size:l,spatial_merge_size:c}=this.config;if(!c)throw new Error("config must contain 'spatial_merge_size'");const u=l*c,d=Math.floor((a-1)/u)+1,f=Math.floor((o-1)/u)+1;return[d*u,f*u]}},Rke=class extends on{},Ike=class extends on{post_process_object_detection(...t){return ST(...t)}},X5=class extends on{reshape_input_points(t,e,n,r=!1){t=structuredClone(t);let i=A8(t);if(i.length===3)r||(i=[1,...i]),t=[t];else if(i.length!==4)throw Error("The input_points must be a 4D tensor of shape `batch_size`, `point_batch_size`, `nb_points_per_image`, `2`.");for(let s=0;s<t.length;++s){const[a,o]=e[s],[l,c]=n[s],u=[c/o,l/a];for(let d=0;d<t[s].length;++d)for(let f=0;f<t[s][d].length;++f)for(let h=0;h<t[s][d][f].length;++h)t[s][d][f][h]*=u[h%2]}return new He("float32",Float32Array.from(t.flat(1/0)),i)}add_input_labels(t,e){let n=A8(t);if(n.length===2)n=[1,...n],t=[t];else if(n.length!==3)throw Error("The input_points must be a 4D tensor of shape `batch_size`, `point_batch_size`, `nb_points_per_image`, `2`.");if(n.some((r,i)=>r!==e.dims[i]))throw Error(`The first ${n.length} dimensions of 'input_points' and 'input_labels' must be the same.`);return new He("int64",t.flat(1/0).map(BigInt),n)}async _call(t,{input_points:e=null,input_labels:n=null,input_boxes:r=null}={}){const i=await super._call(t);if(e&&(i.input_points=this.reshape_input_points(e,i.original_sizes,i.reshaped_input_sizes)),n){if(!i.input_points)throw Error("`input_points` must be provided if `input_labels` are provided.");i.input_labels=this.add_input_labels(n,i.input_points)}return r&&(i.input_boxes=this.reshape_input_points(r,i.original_sizes,i.reshaped_input_sizes,!0)),i}async post_process_masks(t,e,n,{mask_threshold:r=0,binarize:i=!0,pad_size:s=null}={}){const a=[];s=s??this.pad_size??this.size;const o=[s.height,s.width];for(let l=0;l<e.length;++l){const c=e[l],u=n[l];let d=await tc(t[l],{mode:"bilinear",size:o});if(d=d.slice(null,null,[0,u[0]],[0,u[1]]),d=await tc(d,{mode:"bilinear",size:c}),i){const f=d.data,h=new Uint8Array(f.length);for(let p=0;p<f.length;++p)f[p]>r&&(h[p]=1);d=new He("bool",h,d.dims)}a.push(d)}return a}generate_crop_boxes(t,e,{crop_n_layers:n=0,overlap_ratio:r=512/1500,points_per_crop:i=32,crop_n_points_downscale_factor:s=1}={}){}},yJ=class extends on{post_process_semantic_segmentation(...t){return rJ(...t)}},Lke=class extends yJ{},_J=class extends on{post_process_semantic_segmentation(...t){return rJ(...t)}},Oke=class extends _J{},Dke=class extends on{},Fke=class extends on{pad_image(t,e,n,r={}){const[i,s,a]=e;return super.pad_image(t,e,{width:s+(n-s%n)%n,height:i+(n-i%n)%n},{mode:"symmetric",center:!1,constant_values:-1,...r})}},wJ=class extends on{},jke=class extends wJ{},Bke=class extends on{async _call(t,e){Array.isArray(t)||(t=[t]),Array.isArray(e)||(e=[e]);const n=await Promise.all(t.map(s=>this.preprocess(s))),r=await Promise.all(e.map(s=>this.preprocess(s,{do_normalize:!1,do_convert_rgb:!1,do_convert_grayscale:!0})));return{pixel_values:gd(n.map((s,a)=>Lr([s.pixel_values,r[a].pixel_values],0)),0),original_sizes:n.map(s=>s.original_size),reshaped_input_sizes:n.map(s=>s.reshaped_input_size)}}},Uke=class extends on{post_process_pose_estimation(t,e,{threshold:n=null}={}){const r=t.tolist(),[i,s,a,o]=t.dims,l=[];for(let c=0;c<i;++c){const u=r[c],d=e[c],f=[];for(let h=0;h<d.length;++h){const p=d[h],m=[],g=[],v=[],_=p.at(-2)/o,b=p.at(-1)/a;for(let x=0;x<u.length;++x){let[T,N]=[0,0],A=0,L=-1/0;const M=u[x];for(let R=0;R<M.length;++R){const j=M[R];for(let $=0;$<j.length;++$){const U=j[$];A+=U,L=Math.max(L,U),T+=($+.5)*U,N+=R*U}}if(n!=null&&L<n)continue;const B=[_*T/A,b*N/A];
510m.push(B),v.push(x),g.push(L)}f.push({bbox:p,scores:g,labels:v,keypoints:m})}l.push(f)}return l}},bJ=class extends on{post_process_object_detection(...t){return ST(...t)}},zke=class extends bJ{},na=class{static async from_pretrained(t,e={}){const n=await cu(t,Aw,!0,e),r=n.image_processor_type??n.feature_extractor_type;let i=tS[r==null?void 0:r.replace(/Fast$/,"")];return i||(r!==void 0&&en.warn(`Image processor type '${r}' not found, assuming base ImageProcessor. Please report this at ${kT}.`),i=on),new i(n)}},P2,$ke=(P2=class extends Yn{constructor(t,e,n){super(t,e,n);const{tasks_answer_post_processing_type:r,task_prompts_without_inputs:i,task_prompts_with_input:s}=this.image_processor.config;this.tasks_answer_post_processing_type=new Map(Object.entries(r??{})),this.task_prompts_without_inputs=new Map(Object.entries(i??{})),this.task_prompts_with_input=new Map(Object.entries(s??{})),this.regexes={quad_boxes:/(.+?)<loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)>/gm,bboxes:/([^<]+)?<loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)>/gm},this.size_per_bin=1e3}construct_prompts(t){typeof t=="string"&&(t=[t]);const e=[];for(const n of t)if(this.task_prompts_without_inputs.has(n))e.push(this.task_prompts_without_inputs.get(n));else{for(const[r,i]of this.task_prompts_with_input)if(n.includes(r)){e.push(i.replaceAll("{input}",n).replaceAll(r,""));break}e.length!==t.length&&e.push(n)}return e}post_process_generation(t,e,n){const r=this.tasks_answer_post_processing_type.get(e)??"pure_text";t=t.replaceAll("<s>","").replaceAll("</s>","");let i;switch(r){case"pure_text":i=t;break;case"description_with_bboxes":case"bboxes":case"phrase_grounding":case"ocr":const s=r==="ocr"?"quad_boxes":"bboxes",a=t.matchAll(this.regexes[s]),o=[],l=[];for(const[c,u,...d]of a)o.push(u?u.trim():o.at(-1)??""),l.push(d.map((f,h)=>(Number(f)+.5)/this.size_per_bin*n[h%2]));i={labels:o,[s]:l};break;default:throw new Error(`Task "${e}" (of type "${r}") not yet implemented.`)}return{[e]:i}}async _call(t,e=null,n={}){if(!t&&!e)throw new Error("Either text or images must be provided");const r=await this.image_processor(t,n),i=e?this.tokenizer(this.construct_prompts(e),n):{};return{...r,...i}}},X(P2,"tokenizer_class",Kn),X(P2,"image_processor_class",na),P2),cg,Vke=(cg=class extends Yn{constructor(t,e,n){super(t,e,n),this.image_seq_length=this.config.image_seq_length;const{boi_token:r,image_token:i,eoi_token:s}=this.tokenizer.config;this.boi_token=r,this.image_token=i,this.eoi_token=s;const a=i.repeat(this.image_seq_length);this.full_image_sequence=` 511 512${r}${a}${s} 513 514`}async _call(t,e=null,n={}){typeof t=="string"&&(t=[t]);let r;return e&&(r=await this.image_processor(e,n),t=t.map(s=>s.replaceAll(this.boi_token,this.full_image_sequence))),{...this.tokenizer(t,n),...r}}},X(cg,"tokenizer_class",Kn),X(cg,"image_processor_class",na),X(cg,"uses_processor_config",!0),X(cg,"uses_chat_template_file",!0),cg),Vf,qke=(Vf=class extends Yn{constructor(t,e,n){super(t,e,n),this.audio_seq_length=this.config.audio_seq_length,this.image_seq_length=this.config.image_seq_length;const{audio_token_id:r,boa_token:i,audio_token:s,eoa_token:a,image_token_id:o,boi_token:l,image_token:c,eoi_token:u}=this.tokenizer.config;this.audio_token_id=r,this.boa_token=i,this.audio_token=s;const d=s.repeat(this.audio_seq_length);this.full_audio_sequence=` 515 516${i}${d}${a} 517 518`,this.image_token_id=o,this.boi_token=l,this.image_token=c;const f=c.repeat(this.image_seq_length);this.full_image_sequence=` 519 520${l}${f}${u} 521 522`}async _call(t,e=null,n=null,r={}){typeof t=="string"&&(t=[t]);let i;n&&(i=await this.feature_extractor(n,r),t=t.map(o=>o.replaceAll(this.audio_token,this.full_audio_sequence)));let s;return e&&(s=await this.image_processor(e,r),t=t.map(o=>o.replaceAll(this.image_token,this.full_image_sequence))),{...this.tokenizer(t,r),...s,...i}}},X(Vf,"image_processor_class",na),X(Vf,"feature_extractor_class",sl),X(Vf,"tokenizer_class",Kn),X(Vf,"uses_processor_config",!0),X(Vf,"uses_chat_template_file",!0),Vf),M2,Wke=(M2=class extends Yn{constructor(t,e,n){super(t,e,n),this.audio_ms_per_token=this.config.audio_ms_per_token??40,this.audio_seq_length=this.config.audio_seq_length??750,this.image_seq_length=this.config.image_seq_length??280;const{audio_token:r,boa_token:i,eoa_token:s,image_token:a,boi_token:o,eoi_token:l}=this.tokenizer.config;this.audio_token=r,this.boa_token=i,this.eoa_token=s,this.image_token=a,this.boi_token=o,this.eoi_token=l}static async from_pretrained(t,e={}){const[n,r,i]=await Promise.all([cu(t,qK,!0,e),Kn.from_pretrained(t,e),LI(t,WK,!1,e)]),s={tokenizer:r};return n.image_processor&&(s.image_processor=new dJ(n.image_processor)),n.feature_extractor&&(s.feature_extractor=new ZK(n.feature_extractor)),new this(n,s,i)}_compute_audio_num_tokens(t,e){const n=Math.round(e*20/1e3),r=Math.round(e*10/1e3),i=Math.floor(n/2);let s=Math.floor((t+i-n-1)/r)+1;if(s<=0)return 0;for(let a=0;a<2;++a)s=Math.floor((s-1)/2)+1;return Math.min(s,this.audio_seq_length)}async _call(t,e=null,n=null,r={}){typeof t=="string"&&(t=[t]);let i;if(e){i=await this.image_processor(e,r);const a=i.num_soft_tokens_per_image;let o=0;t=t.map(l=>l.replaceAll(this.image_token,()=>` 523 524${this.boi_token}${this.image_token.repeat(a[o++])}${this.eoi_token} 525 526`))}let s;if(n){const a=Array.isArray(n)?n:[n];s=await this.feature_extractor(a[0],r);const o=this.feature_extractor.config.sampling_rate??16e3;let l=0;t=t.map(c=>c.replaceAll(this.audio_token,()=>` 527 528${this.boa_token}${this.audio_token.repeat(this._compute_audio_num_tokens(a[l++].length,o))}${this.eoa_token} 529 530`))}return{...this.tokenizer(t,r),...i,...s}}},X(M2,"uses_processor_config",!0),X(M2,"uses_chat_template_file",!0),M2),Fy,GI=(Fy=class extends Yn{async _call(t,e=null,...n){Array.isArray(t)||(t=[t]);let r,i;if(e&&(r=await this.image_processor(e),i=r.image_grid_thw),i){let a=this.image_processor.config.merge_size**2,o=0;const l=this.constructor.image_token,c=i.tolist();t=t.map(u=>{for(;u.includes(l);){const d=Number(c[o++].reduce((f,h)=>f*h,1n));u=u.replace(l,"<|placeholder|>".repeat(Math.floor(d/a)))}return u.replaceAll("<|placeholder|>",l)})}return{...this.tokenizer(t),...r}}},X(Fy,"image_processor_class",na),X(Fy,"tokenizer_class",Kn),X(Fy,"image_token","<|image_pad|>"),Fy),hA,Gke=(hA=class extends GI{},X(hA,"image_token","<|image|>"),hA),jy,Hke=(jy=class extends Yn{_get_num_audio_features(t){const{hop_length:e}=this.feature_extractor.config.melspec_kwargs,{projector_window_size:n,projector_downsample_rate:r}=this.feature_extractor.config,i=Math.floor(n/r),s=Math.floor(t/e)+1,a=Math.floor(s/2);return Math.ceil(a/n)*i}async _call(t,e=null,n={}){if(Array.isArray(t))throw new Error("Batched inputs are not supported yet.");let r={};if(e){const{input_features:s}=await this.feature_extractor(e);r.input_features=s;const a=this._get_num_audio_features(e.length),o=new Uint8Array(a).fill(1);r.input_features_mask=new He("bool",o,[1,a]);const l=this.config.audio_token??"<|audio|>";if(!t.includes(l))throw new Error(`The input text does not contain the audio token ${l}.`);t=t.replaceAll(l,l.repeat(a))}return{...this.tokenizer(t,{add_special_tokens:!1,...n}),...r}}},X(jy,"tokenizer_class",Kn),X(jy,"feature_extractor_class",sl),X(jy,"uses_processor_config",!0),jy);function Kke(t,e){const r=t.dims.at(-1)-1,i=t.tolist();i.fill(!1,0,1),i.fill(!1,r);const s=e.tolist();return i.map((a,o)=>a?o:null).filter(a=>a!==null).map(a=>s[a])}var N2,Jke=(N2=class extends Yn{async _call(t,e,n={}){const r=t?await this.image_processor(t,n):{};return{...e?this.tokenizer(e,n):{},...r}}post_process_grounded_object_detection(t,e,{box_threshold:n=.25,text_threshold:r=.25,target_sizes:i=null}={}){const{logits:s,pred_boxes:a}=t,o=s.dims[0];if(i!==null&&i.length!==o)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");const l=s.dims.at(1),c=s.sigmoid(),u=c.max(-1).tolist(),d=a.tolist().map(h=>h.map(p=>nJ(p))),f=[];for(let h=0;h<o;++h){const p=i!==null?i[h]:null;p!==null&&(d[h]=d[h].map(b=>b.map((x,T)=>x*p[(T+1)%2])));const m=u[h],g=[],v=[],_=[];for(let b=0;b<l;++b){const x=m[b];if(x<=n)continue;const T=d[h][b],N=c[h][b];g.push(x),_.push(T);const A=Kke(N.gt(r),e[h]);v.push(A)}f.push({scores:g,boxes:_,labels:this.batch_decode(v)})}return f}},X(N2,"tokenizer_class",Kn),X(N2,"image_processor_class",na),N2);function Yke(t,e,n,r,i,s){let a="";for(let o=0;o<e;++o){for(let l=0;l<n;++l)a+=r+`<row_${o+1}_col_${l+1}>`+i.repeat(t);a+=` 531`}return a+=` 532${r}${s}`+i.repeat(t)+`${r}`,a}function Xke(t,e,n,r){return`${e}${r}`+n.repeat(t)+`${e}`}function Qke(t,e,n,r,i,s){return t===0&&e===0?Xke(n,r,i,s):Yke(n,t,e,r,i,s)}var By,hB=(By=class extends Yn{constructor(){super(...arguments);X(this,"fake_image_token","<fake_token_around_image>");X(this,"image_token","<image>");X(this,"global_img_token","<global-img>")}async _call(e,n=null,r={}){r.return_row_col_info??(r.return_row_col_info=!0);let i;n&&(i=await this.image_processor(n,r)),Array.isArray(e)||(e=[e]);const s=i.rows??[new Array(e.length).fill(0)],a=i.cols??[new Array(e.length).fill(0)],o=this.config.image_seq_len,l=[],c=[];for(let d=0;d<e.length;++d){const f=e[d],h=s[d],p=a[d];l.push(v_e(f,this.image_token));const m=h.map((_,b)=>Qke(_,p[b],o,this.fake_image_token,this.image_token,this.global_img_token)),g=f.split(this.image_token);if(g.length===0)throw new Error("The image token should be present in the text.");let v=g[0];for(let _=0;_<m.length;++_)v+=m[_]+g[_+1];c.push(v)}return{...this.tokenizer(c),...i}}},X(By,"image_processor_class",na),X(By,"tokenizer_class",Kn),X(By,"uses_processor_config",!0),By),Uy,Zke=(Uy=class extends Yn{constructor(t,e,n){super(t,e,n),this.image_tag=this.config.image_tag,this.image_start_tag=this.config.image_start_tag,this.image_end_tag=this.config.image_end_tag,this.num_image_tokens=this.config.num_image_tokens}async _call(t,{images:e=null,chat_template:n="default"}={}){e?Array.isArray(e)||(e=[e]):e=await Promise.all(t.filter(m=>m.images).flatMap(m=>m.images).map(m=>nc.read(m)));const r=this.tokenizer,i=r.apply_chat_template(t,{tokenize:!1,add_generation_prompt:!0,chat_template:n}),s=m=>r.encode(m,{add_special_tokens:!1}),a=i.split(this.image_tag),o=a.length-1;if(e.length!==o)throw new Error(`Number of images provided (${e.length}) does not match number of "${this.image_tag}" image tags (${o})`);const[l,c,u]=r.convert_tokens_to_ids([this.image_tag,this.image_start_tag,this.image_end_tag]);let d=s(a[0]),f=new Array(d.length).fill(!1);for(let m=1;m<a.length;++m){const g=new Array(this.num_image_tokens).fill(l),v=s(a[m]);d=Hc(d,[c],g,[u],v);const _=new Array(this.num_image_tokens).fill(!0);f=Hc(f,[!1],_,[!1],new Array(v.length).fill(!1))}const h=[1,d.length],p={input_ids:new He("int64",d,h),attention_mask:new He("int64",new Array(d.length).fill(1),h),images_seq_mask:new He("bool",f,h),images_emb_mask:new He("bool",new Array(o*this.num_image_tokens).fill(!0),[1,o,this.num_image_tokens])};if(e&&e.length>0){const m=await this.image_processor(e);return m.pixel_values.unsqueeze_(0),{...p,...m}}return p}},X(Uy,"image_processor_class",na),X(Uy,"tokenizer_class",Kn),X(Uy,"uses_processor_config",!0),Uy),R2,eSe=(R2=class extends Yn{async _call(t=null,e=null,n={}){if(!t&&!e)throw new Error("Either text or images must be provided");const r=t?this.tokenizer(t,n):{},i=e?await this.image_processor(e,n):{};return{...r,...i}}},X(R2,"tokenizer_class",Kn),X(R2,"image_processor_class",na),R2),I2,tSe=(I2=class extends Yn{async _call(t,e=null,n={}){const{image_rows:r,image_cols:i,image_sizes:s,...a}=await this.image_processor(t,{...n,return_row_col_info:!0});if(e){const o=this.config.image_token??"<image>",{tile_size:l=512,downsample_factor:c=2,encoder_patch_size:u=16,use_thumbnail:d=!0}=this.image_processor.config,f=_=>Math.ceil(Math.floor(_/u)/c),h=f(l)**2,p=this.config.image_start_token??"<|image_start|>",m=this.config.image_end_token??"<|image_end|>",g=this.config.image_thumbnail??"<|img_thumbnail|>";Array.isArray(e)||(e=[e]);let v=0;e=e.map(_=>{const b=_.split(o);return b[0]+b.slice(1).map(x=>{const T=v++,[N,A]=s[T],L=r[T],M=i[T],B=f(N)*f(A);let R=p;if(L>1||M>1){const j=o.repeat(h);for(let $=0;$<L;++$)for(let U=0;U<M;++U)R+=`<|img_row_${$+1}_col_${U+1}|>`+j;
532d&&(R+=g+o.repeat(B))}else R+=o.repeat(B);return R+m+x}).join("")})}return{...a,...e?this.tokenizer(e,n):{}}}},X(I2,"tokenizer_class",Kn),X(I2,"image_processor_class",na),I2),zy,nSe=(zy=class extends Yn{async _call(t,e=null,n={}){const r=await this.image_processor(t,n);if(e){const[s,a]=r.pixel_values.dims.slice(-2),{image_token:o,patch_size:l,num_additional_image_tokens:c}=this.config,u=Math.floor(s/l)*Math.floor(a/l)+c;e=structuredClone(e),Array.isArray(e)||(e=[e]);for(let d=0;d<e.length;++d)e[d]=e[d].replace(o,o.repeat(u))}const i=e?this.tokenizer(e,n):{};return{...r,...i}}},X(zy,"tokenizer_class",Kn),X(zy,"image_processor_class",na),X(zy,"uses_processor_config",!0),zy),fB={char:["char_decode",1],bpe:["bpe_decode",2],wp:["wp_decode",102]},L2,rSe=(L2=class extends Yn{get char_tokenizer(){return this.components.char_tokenizer}get bpe_tokenizer(){return this.components.bpe_tokenizer}get wp_tokenizer(){return this.components.wp_tokenizer}_decode_helper(t,e){if(!fB.hasOwnProperty(e))throw new Error(`Format ${e} is not supported.`);const[n,r]=fB[e],i=this[n].bind(this),[s,a]=t.dims,o=[],l=[],c=t.tolist();for(let d=0;d<s;++d){const f=c[d],h=[],p=[];for(let g=1;g<a;++g){const[v,_]=Pi(Ms(f[g]));if(p.push(v),_==r)break;h.push(_)}const m=p.length>0?p.reduce((g,v)=>g*v,1):0;l.push(h),o.push(m)}return[i(l),o]}char_decode(t){return this.char_tokenizer.batch_decode(t).map(e=>e.replaceAll(" ",""))}bpe_decode(t){return this.bpe_tokenizer.batch_decode(t)}wp_decode(t){return this.wp_tokenizer.batch_decode(t).map(e=>e.replaceAll(" ",""))}batch_decode([t,e,n]){const[r,i]=this._decode_helper(t,"char"),[s,a]=this._decode_helper(e,"bpe"),[o,l]=this._decode_helper(n,"wp"),c=[],u=[];for(let d=0;d<r.length;++d){const[f,h]=Pi([i[d],a[d],l[d]]);c.push([r[d],s[d],o[d]][h]),u.push(f)}return{generated_text:c,scores:u,char_preds:r,bpe_preds:s,wp_preds:o}}static async from_pretrained(...t){const e=await super.from_pretrained(...t),n=await Kn.from_pretrained("Xenova/gpt2"),r=await Kn.from_pretrained("Xenova/bert-base-uncased");return e.components={image_processor:e.image_processor,char_tokenizer:e.tokenizer,bpe_tokenizer:n,wp_tokenizer:r},e}async _call(t,e=null){const n=await this.image_processor(t);return e&&(n.labels=this.tokenizer(e).input_ids),n}},X(L2,"tokenizer_class",Kn),X(L2,"image_processor_class",na),L2),O2,iSe=(O2=class extends Yn{async _call(t){return await this.feature_extractor(t)}},X(O2,"tokenizer_class",Kn),X(O2,"feature_extractor_class",sl),O2),D2,sSe=(D2=class extends Yn{},X(D2,"tokenizer_class",Kn),X(D2,"image_processor_class",na),D2),Zm="<image>";function aSe(t,e,n,r,i){return`${r.repeat(n*i)}${e}${t} 533`}var $y,oSe=($y=class extends Yn{async _call(t,e=null,n={}){e||(en.warn("You are using PaliGemma without a text prefix. It will perform as a picture-captioning model."),e=""),Array.isArray(t)||(t=[t]),Array.isArray(e)||(e=[e]);const r=this.tokenizer.bos_token,i=this.image_processor.config.image_seq_length;let s;e.some(l=>l.includes(Zm))?s=e.map(l=>{const c=l.replaceAll(Zm,Zm.repeat(i)),u=c.lastIndexOf(Zm),d=u===-1?0:u+Zm.length;return c.slice(0,d)+r+c.slice(d)+` 534`}):(en.warn("You are passing both `text` and `images` to `PaliGemmaProcessor`. The processor expects special image tokens in the text, as many tokens as there are images per each text. It is recommended to add `<image>` tokens in the very beginning of your text. For this call, we will infer how many images each text has and add special tokens."),s=e.map(l=>aSe(l,r,i,Zm,t.length)));const a=this.tokenizer(s,n);return{...await this.image_processor(t,n),...a}}},X($y,"tokenizer_class",Kn),X($y,"image_processor_class",na),X($y,"uses_processor_config",!1),$y),pB="<|image|>",lSe=/<\|image_\d+\|>/g,F2,cSe=(F2=class extends Yn{async _call(t,e=null,{padding:n=!0,truncation:r=!0,num_crops:i=null}={}){Array.isArray(t)||(t=[t]);let s,a;if(e){a=await this.image_processor(e,{num_crops:i});const{num_img_tokens:o}=a,l=t.map((u,d)=>u.split(lSe).join(pB.repeat(o[d])));s=this.tokenizer(l,{padding:n,truncation:r});const c=this.tokenizer._tokenizer.token_to_id(pB);s.input_ids.map_(u=>u==c?-u:u)}else s=this.tokenizer(t);return{...s,...a}}},X(F2,"image_processor_class",na),X(F2,"tokenizer_class",Kn),F2),Vy,uSe=(Vy=class extends Yn{async _call(t,e=null,n={}){const r=await this.image_processor(t,n);if(e){const[s,a]=r.pixel_values.dims.slice(-2),{image_token:o,image_break_token:l,image_end_token:c,patch_size:u,spatial_merge_size:d}=this.config,f=u*d,h=Math.floor(s/f),p=Math.floor(a/f);e=structuredClone(e),Array.isArray(e)||(e=[e]);for(let m=0;m<e.length;++m){const g=o.repeat(p),v=g+l,_=g+c,b=v.repeat(h-1)+_;e[m]=e[m].replace(o,b)}}const i=e?this.tokenizer(e,n):{};return{...r,...i}}},X(Vy,"tokenizer_class",Kn),X(Vy,"image_processor_class",na),X(Vy,"uses_processor_config",!0),Vy),fA,dSe=(fA=class extends Yn{async _call(t){return await this.feature_extractor(t)}post_process_speaker_diarization(...t){return this.feature_extractor.post_process_speaker_diarization(...t)}get sampling_rate(){return this.feature_extractor.config.sampling_rate}},X(fA,"feature_extractor_class",eJ),fA),xJ=class extends GI{},hSe=class extends xJ{},pA,kJ=(pA=class extends Yn{async _call(...t){return await this.image_processor(...t)}post_process_masks(...t){return this.image_processor.post_process_masks(...t)}reshape_input_points(...t){return this.image_processor.reshape_input_points(...t)}},X(pA,"image_processor_class",na),pA),SJ=class extends kJ{},fSe=class extends SJ{},j2,pSe=(j2=class extends Yn{async _call(t){return await this.feature_extractor(t)}},X(j2,"tokenizer_class",Kn),X(j2,"feature_extractor_class",sl),j2),qy,mSe=(qy=class extends Yn{async _call(t,e=null,n={}){if(Array.isArray(t))throw new Error("Batched inputs are not supported yet.");let r={};if(e){const s=e.length,{input_features:a}=await this.feature_extractor(e,{...n,max_length:s}),o=Math.round(s/this.config.encoder_ds_factor+1e-4),l=1+Math.ceil(o/this.config.stack_factor);r.audio_token_len=[l],r.audio_values=a;const c=this.config.audio_placeholder;if(!t.includes(c))throw new Error(`The input text does not contain the image token ${c}.`);t=t.replaceAll(c,c.repeat(l))}return{...this.tokenizer(t,{add_special_tokens:!1,...n}),...r}}},X(qy,"tokenizer_class",Kn),X(qy,"feature_extractor_class",sl),X(q
534y,"uses_processor_config",!0),qy),a2="[AUDIO]",gSe="[BEGIN_AUDIO]",vSe=375;function ySe(t,e){const n=[];for(let r=0;r<t.length;r+=e)n.push(t.subarray(r,Math.min(r+e,t.length)));return n}var Wy,_Se=(Wy=class extends Yn{async _call(t,e=null,n={}){if(Array.isArray(t))throw new Error("Batched inputs are not supported yet.");const r={};if(e){if(!t.includes(a2))throw new Error(`The input text does not contain the audio token ${a2}.`);Array.isArray(e)||(e=[e]);const s=t.split(a2),a=s.length-1;if(a!==e.length)throw new Error(`The number of audio inputs (${e.length}) does not match the number of audio tokens in the text (${a}).`);const o=this.feature_extractor.config.n_samples,l=e.map(h=>ySe(h,o)),c=l.map(h=>h.length),u=l.flat(),d=(await Promise.all(u.map(h=>this.feature_extractor(h,n)))).map(h=>h.input_features);r.audio_values=d.length>1?Lr(d,0):d[0];let f=s[0];for(let h=0;h<c.length;++h){f+=gSe;for(let p=0;p<c[h];++p)f+=a2.repeat(vSe);f+=s[h+1]}t=f}return{...this.tokenizer(t,{add_special_tokens:!1,...n}),...r}}},X(Wy,"tokenizer_class",Kn),X(Wy,"feature_extractor_class",sl),X(Wy,"uses_processor_config",!1),Wy),mB=32,Q5=6,o2=8,wSe=10,bSe=32,Gy,xSe=(Gy=class extends Yn{get num_mel_frames_first_audio_chunk(){return(Q5+1)*o2}get num_samples_first_audio_chunk(){const{hop_length:t,n_fft:e}=this.feature_extractor.config;return(this.num_mel_frames_first_audio_chunk-1)*t+Math.floor(e/2)}get num_samples_per_audio_chunk(){const{hop_length:t,n_fft:e}=this.feature_extractor.config;return o2*t+e}get num_right_pad_tokens(){return Q5+1+wSe}get audio_length_per_tok(){return o2}get raw_audio_length_per_tok(){return o2*this.feature_extractor.config.hop_length}async _call(t,{is_streaming:e=!1,is_first_audio_chunk:n=!0}={}){if(Ns(t,"VoxtralRealtimeProcessor"),!e&&!n)throw new Error("In non-streaming mode (`is_streaming=false`), `is_first_audio_chunk` must be `true`.");if(n)if(e){const r=mB*this.raw_audio_length_per_tok,i=new Float32Array(r+t.length);i.set(t,r);const s=await this.feature_extractor(i,{center:!0}),o=1+(mB+Q5),l=new BigInt64Array(o).fill(BigInt(bSe));return l[0]=1n,{input_ids:new He("int64",l,[1,o]),...s}}else{const r=this.num_right_pad_tokens*this.raw_audio_length_per_tok,i=new Float32Array(t.length+r);return i.set(t),await this.feature_extractor(i,{center:!0})}else return await this.feature_extractor(t,{center:!1})}},X(Gy,"tokenizer_class",Kn),X(Gy,"feature_extractor_class",sl),X(Gy,"uses_processor_config",!1),Gy),B2,kSe=(B2=class extends Yn{async _call(t){return await this.feature_extractor(t)}},X(B2,"tokenizer_class",Kn),X(B2,"feature_extractor_class",sl),B2),U2,SSe=(U2=class extends Yn{async _call(t){return await this.feature_extractor(t)}},X(U2,"tokenizer_class",Kn),X(U2,"feature_extractor_class",sl),U2),z2,TSe=(z2=class extends Yn{async _call(t){return await this.feature_extractor(t)}},X(z2,"tokenizer_class",Kn),X(z2,"feature_extractor_class",sl),z2),CSe=class{static async from_pretrained(t,e={}){const n=await cu(t,Aw,!0,e),{image_processor_type:r,feature_extractor_type:i,processor_class:s}=n;if(s&&eN[s])return eN[s].from_pretrained(t,e);if(!r&&!i)throw new Error("No `image_processor_type` or `feature_extractor_type` found in the config.");const a={};if(r){const l=tS[r.replace(/Fast$/,"")];if(!l)throw new Error(`Unknown image_processor_type: '${r}'.`);a.image_processor=new l(n)}if(i){const l=tS[i];if(l)a.image_processor=new l(n);else{const c=zI[i];if(!c)throw new Error(`Unknown feature_extractor_type: '${i}'.`);a.feature_extractor=new c(n)}}const o={};return new Yn(o,a,null)}};async function ESe(t,e){return await cu(t,"config.json",!0,e)}function gg(t){const e={};let n={};switch(t.model_type){case"llava":case"paligemma":case"gemma3":case"florence2":case"llava_onevision":case"idefics3":case"granite_speech":case"ultravox":case"voxtral":case"voxtral_realtime":case"smolvlm":case"gemma3n":case"gemma4":case"lfm2_vl":case"chatterbox":case"lighton_ocr":case"glm_ocr":case"mistral3":case"qwen2_5_vl":case"qwen3_vl":case"qwen3_vl_moe":n=gg(t.text_config);break;case"moondream1":n=gg(t.phi_config);break;case"musicgen":n=gg(t.decoder);break;case"multi_modality":n=gg(t.language_config);break;case"gpt2":case"gptj":case"jais":case"codegen":case"gpt_bigcode":e.num_heads="n_head",e.num_layers="n_layer",e.hidden_size="n_embd";break;case"gpt_neox":case"stablelm":case"opt":case"falcon":case"modernbert-decoder":e.num_heads="num_attention_heads",e.num_layers="num_hidden_layers",e.hidden_size="hidden_size";break;case"gpt_oss":case"llama":case"llama4_text":case"nanochat":case"apertus":case"arcee":case"afmoe":case"lfm2":case"lfm2_moe":case"smollm3":case"olmo":case"olmo2":case"olmo3":case"mobilellm":case"granite":case"granitemoehybrid":case"cohere":case"cohere2":case"mistral":case"voxtral_realtime_text":case"voxtral_realtime_encoder":case"starcoder2":case"qwen2":case"qwen2_moe":case"qwen2_vl":case"qwen2_vl_text":case"qwen2_5_vl_text":case"qwen3_moe":case"qwen3_vl_text":case"qwen3_vl_moe_text":case"phi":case"phi3":case"phi3_v":case"llava_qwen2":e.num_heads="num_key_value_heads",e.num_layers="num_hidden_layers",e.hidden_size="hidden_size",e.num_attention_heads="num_attention_heads",e.dim_kv="head_dim";break;case"qwen3":case"solar_open":case"glm_ocr_text":case"gemma":case"gemma2":case"vaultgemma":case"gemma3_text":case"gemma3n_text":case"gemma4_text":case"glm":case"helium":case"ernie4_5":case"hunyuan_v1_dense":case"falcon_h1":case"nemotron_h":case"ministral":case"ministral3":e.num_heads="num_key_value_heads",e.num_layers="num_hidden_layers",e.dim_kv="head_dim";break;case"openelm":e.num_heads="num_kv_heads",e.num_layers="num_transformer_layers",e.dim_kv="head_dim";break;case"gpt_neo":case"donut-swin":e.num_heads="num_heads",e.num_layers="num_layers",e.hidden_size="hidden_size";break;case"bloom":e.num_heads="n_head",e.num_layers="n_layer",e.hidden_size="hidden_size";break;case"mpt":e.num_heads="n_heads",e.num_layers="n_layers",e.hidden_size="d_model";break;case"exaone":e.num_heads="num_key_value_heads",e.num_layers="num_layers",e.dim_kv="head_dim",e.num_attention_heads="num_attention_heads";break;case"youtu":case"deepseek_v3":case"glm_moe_dsa":case"mistral4":e.num_heads="num_key_value_heads",e.num_layers="num_hidden_layers",e.dim_kv="qk_head_dim",e.num_attention_heads="num_attention_heads";break;case"t5":case"mt5":case"longt5":e.num_decoder_layers="num_decoder_layers",e.num_decoder_heads="num_heads",e.decoder_dim_kv="d_kv",e.num_encoder_layers="num_layers",e.num_encoder_heads="num_heads",e.encoder_dim_kv="d_kv";break;case"bart":case"mbart":case"marian":case"whisper":case"lite-whisper":case"m2m_100":case"blenderbot":case"blenderbot-small":case"florence2_language":e.num_decoder_layers="decoder_layers",e.num_decoder_heads="decoder_attention_heads",e.decoder_hidden_size="d_model",e.num_encoder_layers="encoder_layers",e.num_encoder_heads="encoder_attention_heads",e.encoder_hidden_size="d_model";break;case"speecht5":e.num_decoder_layers="decoder_layers",e.num_decoder_heads="decoder_attention_heads",e.decoder_hidden_size="hidden_size",e.num_encoder_layers="encoder_layers",e.num_encoder_heads="encoder_attention_heads",e.encoder_hidden_size="hidden_size";break;case"trocr":e.num_encoder_layers=e.num_decoder_layers="decoder_layers",e.num_encoder_heads=e.num_decoder_heads="decoder_attention_heads",e.encoder_hidden_size=e.decoder_hidden_size="d_model";break;case"musicgen_decoder":e.num_encoder_layers=e.num_decoder_layers="num_hidden_layers",e.num_encoder_heads=e.num_decoder_heads="num_attention_heads",e.encoder_hidden_size=e.decoder_hidden_size="hidden_size";break;case"moonshine":e.num_decoder_layers="decoder_num_hidden_layers",e.num_decoder_heads="decoder_num_key_value_heads",e.num_encoder_layers="encoder_num_hidden_layers",e.num_encoder_heads="encoder_num_key_value_heads",e.encoder_hidden_size=e.decoder_hidden_size="hidden_size";break;case"cohere_asr":e.num_decoder_layers="num_hidden_layers",e.num_decoder_heads="num_key_value_heads",e.decoder_hidden_size="hidden_size",e.decoder_dim_kv="head_dim";const{num_hidden_layers:i,num_attention_heads:s,hidden_size:a}=t.encoder_config;n={num_encoder_layers:i,num_encoder_heads:s,encoder_hidden_size:a,encoder_dim_kv:t.head_dim};break;case"vision-encoder-decoder":const o=gg(t.decoder),l="num_decoder_layers"in o,c=us(t,["model_type","is_encoder_decoder"]);return l?(c.num_decoder_layers=o.num_decoder_layers,c.num_decoder_heads=o.num_decoder_heads,c.decoder_hidden_size=o.decoder_hidden_size,c.num_encoder_layers=o.num_encoder_layers,c.num_encoder_heads=o.num_encoder_heads,c.encoder_hidden_size=o.encoder_hidden_size):(c.num_layers=o.num_layers,c.num_heads=o.num_heads,c.hidden_size=o.hidden_size),c}const r={...n,...us(t,["model_type","multi_query","is_encoder_decoder"])};for(const i in e)r[i]=t[e[i]];return r}function TT(t,e){t instanceof nN||(t=new nN(t));const n=(e==null?void 0:e.prefix)??"past_key_values",r=n==="present"?"present":"past",i=new Set;if(["lfm2","lfm2_moe"].includes(t.model_type)){const{layer_types:s}=t;
534for(let a=0;a<s.length;++a)if(s[a]==="full_attention")i.add(`${n}.${a}.key`),i.add(`${n}.${a}.value`);else if(s[a]==="conv")i.add(`${r}_conv.${a}`);else throw new Error(`Unsupported layer type: ${s[a]}`);return i}else if(["granitemoehybrid","falcon_h1","nemotron_h"].includes(t.model_type)){const s=t,a=s.layer_types??s.layers_block_type,o=s.num_hidden_layers??(a==null?void 0:a.length);for(let l=0;l<o;++l)(!a||a[l]==="mamba")&&(i.add(`${r}_conv.${l}`),i.add(`${r}_ssm.${l}`)),(!a||a[l]==="attention")&&(i.add(`${n}.${l}.key`),i.add(`${n}.${l}.value`));return i}else if(["qwen3_next","qwen3_5_text","qwen3_5_moe_text","olmo_hybrid"].includes(t.model_type)){const{layer_types:s}=t;for(let a=0;a<s.length;++a)if(s[a]==="full_attention")i.add(`${n}.${a}.key`),i.add(`${n}.${a}.value`);else if(s[a]==="linear_attention")t.model_type==="olmo_hybrid"?(i.add(`${r}_conv.${a}.key`),i.add(`${r}_conv.${a}.value`),i.add(`${r}_conv.${a}.query`)):i.add(`${r}_conv.${a}`),i.add(`${r}_recurrent.${a}`);else throw new Error(`Unsupported layer type: ${s[a]}`);return i}else if(["gemma4","gemma4_text"].includes(t.model_type)){const s=t.model_type==="gemma4"?t.text_config:t,a=s.num_hidden_layers,o=s.num_kv_shared_layers??0,l=a-o;for(let c=0;c<l;++c)i.add(`${n}.${c}.key`),i.add(`${n}.${c}.value`);return i}else if(["lfm2_vl","qwen3_5","qwen3_5_moe","voxtral_realtime"].includes(t.model_type)){let s;return t.model_type==="voxtral_realtime"&&(e==null?void 0:e.session_name)==="audio_encoder"?s=t.audio_config:s=t.text_config,TT(s,e)}return ASe(t,{prefix:n})}function ASe(t,{prefix:e="past_key_values"}={}){const n=new Set,r=t.normalized_config;if(r.is_encoder_decoder&&"num_encoder_heads"in r&&"num_decoder_heads"in r)for(let i=0;i<r.num_decoder_layers;++i)n.add(`${e}.${i}.encoder.key`),n.add(`${e}.${i}.encoder.value`),n.add(`${e}.${i}.decoder.key`),n.add(`${e}.${i}.decoder.value`);else if(r.multi_query)for(let i=0;i<r.num_layers;++i)n.add(`${e}.${i}.key_value`);else for(let i=0;i<r.num_layers;++i)n.add(`${e}.${i}.key`),n.add(`${e}.${i}.value`);return n}var nN=class rN{constructor(e){X(this,"model_type",null);X(this,"is_encoder_decoder",!1);X(this,"max_position_embeddings");X(this,"transformers.js_config");Object.assign(this,e),this.normalized_config=gg(this)}static async from_pretrained(e,{progress_callback:n=null,config:r=null,cache_dir:i=null,local_files_only:s=!1,revision:a="main"}={}){r&&!(r instanceof rN)&&(r=new rN(r));const o=r??await ESe(e,{progress_callback:n,config:r,cache_dir:i,local_files_only:s,revision:a});return new this(o)}},Pw=class{static async from_pretrained(...t){return nN.from_pretrained(...t)}};function TJ(t,e,n){return t?typeof t=="object"&&t!==null?t.hasOwnProperty(e)?+t[e]:t.hasOwnProperty(n)?+t[n]:0:+t:0}function CJ(t,e){const n=[];for(let r=0;r<e;++r)n.push(`${t}_data${r===0?"":"_"+r}`);return n}async function PSe(t,e,n,r){const i=`${e}${r}.onnx`,s=`${n.subfolder??""}/${i}`;return await eS(t,s,!0,n,vn.IS_NODE_ENV)}async function MSe(t,e,n,r,i,s={}){const a=`${e}${n}.onnx`,o=vn.IS_NODE_ENV;let l=[];const c=TJ(i,a,e);if(c>0){if(c>H8)throw new Error(`The number of external data chunks (${c}) exceeds the maximum allowed value (${H8}).`);const u=CJ(a,c);for(const d of u){const f=`${r.subfolder??""}/${d}`;l.push(new Promise(async(h,p)=>{const m=await eS(t,f,!0,r,o);h(m instanceof Uint8Array?{path:d,data:m}:d)}))}}else s.externalData!==void 0&&(l=s.externalData.map(async u=>{if(typeof u.data=="string"){const d=await eS(t,u.data,!0,r);return{...u,data:d}}return u}));return Promise.all(l)}async function NSe(t,e,n,r=!1,i=void 0){var _;let s=((_=n.config)==null?void 0:_["transformers.js_config"])??{};const a=RK(n.device??s.device,e,{warn:b=>en.info(b)}),o=t2e(a),l=s.device_config??{};l.hasOwnProperty(a)&&(s={...s,...l[a]});const c=IK(n.dtype??s.dtype,e,a,{configDtype:s.dtype,warn:b=>en.info(b)});if(QM.hasOwnProperty(c)){if(a==="webgpu"&&!vn.IS_NODE_ENV&&c===Ii.fp16&&!await i2e())throw new Error(`The device (${a}) does not support fp16.`)}else throw new Error(`Invalid dtype: ${c}. Should be one of: ${Object.keys(Ii).join(", ")}`);const u=QM[c],d={...n.session_options};
534d.executionProviders??(d.executionProviders=o);const f=s.free_dimension_overrides;f?d.freeDimensionOverrides??(d.freeDimensionOverrides=f):a.startsWith("webnn")&&!d.freeDimensionOverrides&&en.warn(`WebNN does not currently support dynamic shapes and requires 'free_dimension_overrides' to be set in config.json, preferably as a field within config["transformers.js_config"]["device_config"]["${a}"]. When 'free_dimension_overrides' is not set, you may experience significant performance degradation.`);const h=PSe(t,e,n,u),p=n.use_external_data_format??s.use_external_data_format,m=await MSe(t,e,u,n,p,d);if(m.length>0&&(!vn.IS_NODE_ENV||m.some(b=>typeof b!="string"))&&(d.externalData=m),r&&a==="webgpu"){const b=TT(n.config,{prefix:"present",session_name:i});if(b.size>0&&!OI()){const x={};for(const T of b)x[T]="gpu-buffer";d.preferredOutputLocation=x}}return{buffer_or_path:await h,session_options:d,session_config:{dtype:c,device:a}}}async function RSe(t,e,n,r=void 0){return Object.fromEntries(await Promise.all(Object.keys(e).map(async i=>{const s=(r==null?void 0:r[i])??!1,{buffer_or_path:a,session_options:o,session_config:l}=await NSe(t,e[i],n,s,i),c=await PK(a,o,l);return[i,c]})))}function EJ(t){for(let e in t)NK(t[e])?t[e]=new He(t[e]):typeof t[e]=="object"&&EJ(t[e]);return t}async function Fn(t,e){const n=ISe(t,e);try{const r=Object.fromEntries(Object.entries(n).map(([s,a])=>{const o=a.ort_tensor;return vn.IS_NODE_ENV&&typeof Float16Array<"u"&&o.cpuData instanceof Float16Array&&(o.cpuData=new Uint16Array(o.cpuData.buffer)),[s,o]})),i=await MK(t,r);return EJ(i)}catch(r){const i=Object.fromEntries(Object.entries(n).map(([s,a])=>{const o={type:a.type,dims:a.dims,location:a.location};return o.location!=="gpu-buffer"&&(o.data=a.data),[s,o]}));throw en.error(`An error occurred during model execution: "${r}".`),en.error("Inputs given to model:",i),r}}function ISe(t,e){const n=Object.create(null),r=[];for(const a of t.inputNames){const o=e[a];if(!(o instanceof He)){r.push(a);continue}n[a]=OI()?o.clone():o}if(r.length>0)throw new Error(`An error occurred during model execution: "Missing the following inputs: ${r.join(", ")}.`);const i=Object.keys(e).length,s=t.inputNames.length;if(i>s){let a=Object.keys(e).filter(o=>!t.inputNames.includes(o));en.warn(`WARNING: Too many inputs were provided (${i} > ${s}). The following inputs will be ignored: "${a.join(", ")}".`)}return n}var Ji=class{},Vt=class extends Ji{constructor({logits:t,...e}){super(),this.logits=t;const n=Object.values(e);n.length>0&&(this.attentions=n)}},ji=class extends Ji{constructor({logits:t}){super(),this.logits=t}},Yi=class extends Ji{constructor({logits:t}){super(),this.logits=t}},ra=class extends Ji{constructor({start_logits:t,end_logits:e}){super(),this.start_logits=t,this.end_logits=e}},nm=class extends Ji{constructor({logits:t}){super(),this.logits=t}},LSe=class extends Ji{constructor({alphas:t}){super(),this.alphas=t}},uc=class extends Qa{_call(t,e){throw Error("`_call` should be implemented in a subclass")}},OSe=class extends Qa{_call(t,e){throw Error("`_call` should be implemented in a subclass")}},iN=class extends Qa{constructor(){super(),this.processors=[]}push(t){this.processors.push(t)}extend(t){this.processors.push(...t)}_call(t,e){let n=e;for(const r of this.processors)n=r(t,n);return n}[Symbol.iterator](){return this.processors.values()}},DSe=class extends uc{constructor(t){super(),this.bos_token_id=t}_call(t,e){for(let n=0;n<t.length;++n)if(t[n].length===1){const r=e[n].data;r.fill(-1/0),r[this.bos_token_id]=0}return e}},FSe=class extends uc{constructor(t,e){super(),this.max_length=t,this.eos_token_id=Array.isArray(e)?e:[e]}_call(t,e){for(let n=0;n<t.length;++n)if(t[n].length===this.max_length-1){const r=e[n].data;r.fill(-1/0);for(const i of this.eos_token_id)r[i]=0}return e}},jSe=class extends uc{constructor(t){super(),this.suppress_tokens=t}_call(t,e){for(let n=0;n<t.length;++n){const r=e[n].data;for(const i of this.suppress_tokens)r[i]=-1/0}return e}},AJ=class extends uc{constructor(t,e){super(),this.begin_suppress_tokens=t,this.begin_index=e}_call(t,e){for(let n=0;n<t.length;++n)if(t[n].length===this.begin_index){const r=e[n].data;for(const i of this.begin_suppress_tokens)r[i]=-1/0}return e}},BSe=class extends uc{constructor(t,e){super(),this.eos_token_id=Array.isArray(t.eos_token_id)?t.eos_token_id[0]:t.eos_token_id,this.no_timestamps_token_id=t.no_timestamps_token_id,this.timestamp_begin=this.no_timestamps_token_id+1,this.begin_index=e.length,e.at(-1)===this.no_timestamps_token_id&&(this.begin_index-=1),this.max_initial_timestamp_index=t.max_initial_timestamp_index}_call(t,e){for(let n=0;n<t.length;++n){const r=e[n].data;if(r[this.no_timestamps_token_id]=-1/0,t[n].length===this.begin_index){r.subarray(0,this.timestamp_begin).fill(-1/0);continue}const i=t[n].slice(this.begin_index),s=i.length>=1&&i[i.length-1]>=this.timestamp_begin,a=i.length<2||i[i.length-2]>=this.timestamp_begin;if(s&&(a?r.subarray(this.timestamp_begin).fill(-1/0):r.subarray(0,this.eos_token_id).fill(-1/0)),t[
534n].length===this.begin_index&&this.max_initial_timestamp_index!==null){const u=this.timestamp_begin+this.max_initial_timestamp_index;r.subarray(u+1).fill(-1/0)}const o=$be(r),l=Math.log(o.subarray(this.timestamp_begin).map(Math.exp).reduce((u,d)=>u+d)),c=Pi(o.subarray(0,this.timestamp_begin))[0];l>c&&r.subarray(0,this.timestamp_begin).fill(-1/0)}return e}},USe=class extends uc{constructor(t){super(),this.no_repeat_ngram_size=t}getNgrams(t){const e=t.length,n=[];for(let i=0;i<e+1-this.no_repeat_ngram_size;++i){const s=[];for(let a=0;a<this.no_repeat_ngram_size;++a)s.push(t[i+a]);n.push(s.map(Number))}const r=new Map;for(const i of n){const s=i.slice(0,i.length-1),a=JSON.stringify(s),o=r.get(a)??[];o.push(i[i.length-1]),r.set(a,o)}return r}getGeneratedNgrams(t,e){const n=e.slice(e.length+1-this.no_repeat_ngram_size,e.length);return t.get(JSON.stringify(n.map(Number)))??[]}calcBannedNgramTokens(t){const e=[];if(t.length+1<this.no_repeat_ngram_size)return e;{const n=this.getNgrams(t);return this.getGeneratedNgrams(n,t)}}_call(t,e){for(let n=0;n<t.length;++n){const r=e[n].data,i=this.calcBannedNgramTokens(t[n]);for(const s of i)r[s]=-1/0}return e}},zSe=class extends uc{constructor(t){super(),this.penalty=t}_call(t,e){for(let n=0;n<t.length;++n){const r=e[n].data;for(const i of new Set(t[n])){const s=Number(i);r[s]<0?r[s]*=this.penalty:r[s]/=this.penalty}}return e}},$Se=class extends uc{constructor(t,e){super(),this.min_length=t,this.eos_token_id=Array.isArray(e)?e:[e]}_call(t,e){for(let n=0;n<t.length;++n)if(t[n].length<this.min_length){const r=e[n].data;for(const i of this.eos_token_id)r[i]=-1/0}return e}},VSe=class extends uc{constructor(t,e,n){super(),this.prompt_length_to_skip=t,this.min_new_tokens=e,this.eos_token_id=Array.isArray(n)?n:[n]}_call(t,e){for(let n=0;n<t.length;++n)if(t[n].length-this.prompt_length_to_skip<this.min_new_tokens){const i=e[n].data;for(const s of this.eos_token_id)i[s]=-1/0}return e}},qSe=class extends uc{constructor(t,e){super(),this.bad_words_ids=t,this.eos_token_id=Array.isArray(e)?e:[e]}_call(t,e){for(let n=0;n<t.length;++n){const r=e[n].data,i=t[n];for(const s of this.bad_words_ids){if(i.length<s.length-1)continue;let a=!0;for(let o=1;o<=s.length-1;++o)if(s.at(-o-1)!=i.at(-o)){a=!1;break}a&&(r[s.at(-1)]=-1/0)}}return e}},WSe=class extends uc{constructor(t){if(super(),t<=1)throw new Error(`Require guidance scale >1 to use the classifier free guidance processor, got guidance scale ${t}.`);this.guidance_scale=t}_call(t,e){if(e.dims[0]!==2*t.length)throw new Error(`Logits should have twice the batch size of the input ids, the first half of batches corresponding to the conditional inputs, and the second half of batches corresponding to the unconditional inputs. Got batch size ${e.dims[0]} for the logits and ${t.length} for the input ids.`);const n=t.length,r=e.slice([0,n],null),i=e.slice([n,e.dims[0]],null);for(let s=0;s<i.data.length;++s)i.data[s]+=(r.data[s]-i.data[s])*this.guidance_scale;return i}},GSe=class extends OSe{constructor(t){super(),this.temperature=t}_call(t,e){const n=e.data;for(let r=0;r<n.length;++r)n[r]/=this.temperature;return e}},PJ=class{constructor(t){X(this,"max_length",20);X(this,"max_new_tokens",null);X(this,"min_length",0);X(this,"min_new_tokens",null);X(this,"early_stopping",!1);X(this,"max_time",null);X(this,"do_sample",!1);X(this,"num_beams",1);X(this,"num_beam_groups",1);X(this,"penalty_alpha",null);X(this,"use_cache",!0);X(this,"temperature",1);X(this,"top_k",50);X(this,"top_p",1);X(this,"typical_p",1);X(this,"epsilon_cutoff",0);X(this,"eta_cutoff",0);X(this,"diversity_penalty",0);X(this,"repetition_penalty",1);X(this,"encoder_repetition_penalty",1);X(this,"length_penalty",1);X(this,"no_repeat_ngram_size",0);X(this,"bad_words_ids",null);X(this,"force_words_ids",null);X(this,"renormalize_logits",!1);X(this,"constraints",null);X(this,"forced_bos_token_id",null);X(this,"forced_eos_token_id",null);X(this,"remove_invalid_values",!1);X(this,"exponential_decay_length_penalty",null);X(this,"suppress_tokens",null);X(this,"streamer",null);X(this,"begin_suppress_tokens",null);X(this,"forced_decoder_ids",null);X(this,"guidance_scale",null);X(this,"num_return_sequences",1);X(this,"output_attentions",!1);X(this,"output_hidden_states",!1);X(this,"output_scores",!1);X(this,"return_dict_in_generate",!1);X(this,"pad_token_id",null);X(this,"bos_token_id",null);X(this,"eos_token_id",null);X(this,"encoder_no_repeat_ngram_size",0);X(this,"decoder_start_token_id",null);X(this,"generation_kwargs",{});Object.assign(this,us(t,Object.getOwnPropertyNames(this)))}},CT=class extends Qa{_call(t,e){throw Error("StoppingCriteria needs to be subclassed")}},MJ=class NJ extends Qa{constructor(){super(),this.criteria=[]}push(e){this.criteria.push(e)}extend(e){e instanceof NJ?e=e.criteria:e instanceof CT&&(e=[e]),this.criteria.push(...e)}_call(e,n){const r=new Array(e.length).fill(!1);for(const i of this.criteria){const s=i(e,n);for(let a=0;a<r.length;++a)r[a]||(r[a]=s[a])}return r}[Symbol.iterator](){return this.criteria.values()}}
534,HSe=class extends CT{constructor(t,e=null){super(),this.max_length=t,this.max_position_embeddings=e}_call(t){return t.map(e=>e.length>=this.max_length)}},KSe=class extends CT{constructor(t){super(),Array.isArray(t)||(t=[t]),this.eos_token_id=t}_call(t,e){return t.map(n=>{const r=n.at(-1);return this.eos_token_id.some(i=>r==i)})}},ET=class extends Qa{constructor(t){super(),this.generation_config=t}async _call(t){return this.sample(t)}async sample(t){throw Error("sample should be implemented in subclasses.")}getLogits(t,e){let n=t.dims.at(-1),r=t.data;if(e===-1)r=r.slice(-n);else{let i=e*n;r=r.slice(i,i+n)}return r}randomSelect(t){return Tbe(t)}static getSampler(t){if(t.do_sample)return new YSe(t);if(t.num_beams>1)return new XSe(t);if(t.num_return_sequences>1)throw Error(`num_return_sequences has to be 1 when doing greedy search, but is ${t.num_return_sequences}.`);return new JSe(t)}},JSe=class extends ET{async sample(t){const e=Pi(t.data)[1];return[[BigInt(e),0]]}},YSe=class extends ET{async sample(t){let e=t.dims.at(-1);this.generation_config.top_k>0&&(e=Math.min(this.generation_config.top_k,e));const[n,r]=await f0(t,e),i=Ms(n.data);return Array.from({length:this.generation_config.num_beams},()=>{const s=this.randomSelect(i);return[r.data[s],Math.log(i[s])]})}},XSe=class extends ET{async sample(t){let e=t.dims.at(-1);this.generation_config.top_k>0&&(e=Math.min(this.generation_config.top_k,e));const[n,r]=await f0(t,e),i=Ms(n.data);return Array.from({length:this.generation_config.num_beams},(s,a)=>[r.data[a],Math.log(i[a])])}},QSe=class{constructor(t){if(t)for(const e in t){if(e in this)throw new TypeError(`Key "${e}" conflicts with an existing property on DynamicCache`);const n=t[e];if(!(n instanceof He))throw new TypeError(`Expected a Tensor for key "${e}", got ${typeof n}`);this[e]=n}}get_seq_length(){const t=this;if(Object.keys(t).length===0)return 0;for(const e in t)if(e.startsWith("past_key_values."))return t[e].dims.at(-2);throw new Error("Unable to determine sequence length from the cache.")}update(t){for(const e in t){const n=this[e],r=t[e];n&&n!==r&&n.location==="gpu-buffer"&&n.dispose(),this[e]=r}}async dispose(){const t=[];for(const e of Object.values(this))e.location==="gpu-buffer"&&t.push(e.dispose());await Promise.all(t)}},HI=QSe,Xe={EncoderOnly:0,EncoderDecoder:1,Seq2Seq:2,Vision2Seq:3,DecoderOnly:4,DecoderOnlyWithoutHead:5,MaskGeneration:6,ImageTextToText:7,Musicgen:8,MultiModality:9,Phi3V:10,AudioTextToText:11,AutoEncoder:12,ImageAudioTextToText:13,Supertonic:14,Chatterbox:15,VoxtralRealtime:16},id={[Xe.DecoderOnly]:{sessions:(t,e)=>({model:e.model_file_name??"model"}),cache_sessions:{model:!0},optional_configs:{generation_config:"generation_config.json"}},[Xe.DecoderOnlyWithoutHead]:{sessions:(t,e)=>({model:e.model_file_name??"model"})},[Xe.Seq2Seq]:{sessions:()=>({model:"encoder_model",decoder_model_merged:"decoder_model_merged"}),cache_sessions:{decoder_model_merged:!0},optional_configs:{generation_config:"generation_config.json"}},[Xe.Vision2Seq]:{sessions:()=>({model:"encoder_model",decoder_model_merged:"decoder_model_merged"}),cache_sessions:{decoder_model_merged:!0},optional_configs:{generation_config:"generation_config.json"}},[Xe.Musicgen]:{sessions:()=>({model:"text_encoder",decoder_model_merged:"decoder_model_merged",encodec_decode:"encodec_decode"}),cache_sessions:{decoder_model_merged:!0},optional_configs:{generation_config:"generation_config.json"}},[Xe.EncoderDecoder]:{sessions:()=>({model:"encoder_model",decoder_model_merged:"decoder_model_merged"}),cache_sessions:{decoder_model_merged:!0}},[Xe.MaskGeneration]:{sessions:()=>({model:"vision_encoder",prompt_encoder_mask_decoder:"prompt_encoder_mask_decoder"})},[Xe.ImageTextToText]:{text_only_sessions:{embed_tokens:"embed_tokens",decoder_model_merged:"decoder_model_merged"},sessions:(t,e,n)=>{const r={...id[Xe.ImageTextToText].text_only_sessions};return n||(r.vision_encoder="vision_encoder"),t.is_encoder_decoder&&(r.model="encoder_model"),r},cache_sessions:{decoder_model_merged:!0},optional_configs:{generation_config:"generation_config.json"}},[Xe.AudioTextToText]:{text_only_sessions:{embed_tokens:"embed_tokens",decoder_model_merged:"decoder_model_merged"},sessions:(t,e,n)=>{const r={...id[Xe.AudioTextToText].text_only_sessions};return n||(r.audio_encoder="audio_encoder"),r},cache_sessions:{decoder_model_merged:!0},optional_configs:{generation_config:"generation_config.json"}},[Xe.ImageAudioTextToText]:{text_only_sessions:{embed_tokens:"embed_tokens",decoder_model_merged:"decoder_model_merged"},sessions:(t,e,n)=>{const r={...id[Xe.ImageAudioTextToText].text_only_sessions};return n||(r.audio_encoder="audio_encoder",r.vision_encoder="vision_encoder"),r},optional_configs:{generation_config:"generation_config.json"}},[Xe.Phi3V]:{sessions:()=>({prepare_inputs_embeds:"prepare_inputs_embeds",model:"model",vision_encoder:"vision_encoder"}),cache_sessions:{model:!0},optional_configs:{generation_config:"generation_config.json"}},[Xe.MultiModality]:{sessions:()=>({prepare_inputs_embeds:"prepare_inputs_embeds",model:"language_model",lm_head:"lm_head",gen_head:"gen_head",gen_img_embeds:"gen_img_embeds",image_decode:"image_decode"}),cache_sessions:{model:!0},optional_configs:{generation_config:"generation_config.json"}},[Xe.AutoEncoder]:{sessions:()=>({encoder_model:"encoder_model",decoder_model:"decoder_model"})},[Xe.Supertonic]:{sessions:()=>({text_encoder:"text_encoder",latent_denoiser:"latent_denoiser",voice_decoder:"voice_decoder"})},[Xe.Chatterbox]:{sessions:()=>
534({embed_tokens:"embed_tokens",speech_encoder:"speech_encoder",model:"language_model",conditional_decoder:"conditional_decoder"}),cache_sessions:{model:!0},optional_configs:{generation_config:"generation_config.json"}},[Xe.VoxtralRealtime]:{text_only_sessions:{embed_tokens:"embed_tokens",decoder_model_merged:"decoder_model_merged"},sessions:(t,e,n)=>{const r={...id[Xe.VoxtralRealtime].text_only_sessions};return n||(r.audio_encoder="audio_encoder"),r},cache_sessions:{decoder_model_merged:!0,audio_encoder:!0},optional_configs:{generation_config:"generation_config.json"}},default:{sessions:(t,e)=>({model:e.model_file_name??"model"})}};function ZSe(t){const e=id[t];return(e==null?void 0:e.text_only_sessions)??null}function eTe(t,e,n={}){const r=id[t]??id.default;return{sessions:r.sessions(e,n,n.textOnly??!1),cache_sessions:r.cache_sessions,optional_configs:r.optional_configs}}function RJ(t,{warn:e=!0}={}){const n=t.architectures||[];for(const r of n){const i=ld.get(r);if(i!==void 0)return i}if(t.model_type){const r=ld.get(t.model_type);if(r!==void 0)return r;for(const i of Object.values(Dg))if(i.has(t.model_type)){const s=ld.get(i.get(t.model_type));if(s!==void 0)return s}}if(e){const r=n.length>0?n.join(", "):"(none)";en.warn(`[resolve_model_type] Architecture(s) not found in MODEL_TYPE_MAPPING: [${r}] for model type '${t.model_type}'. Falling back to EncoderOnly (single model.onnx file). If you encounter issues, please report at: ${kT}`)}return Xe.EncoderOnly}function IJ(t,{config:e=null,cache_dir:n=null,local_files_only:r=!1,revision:i="main"}={}){if(e!==null)return Pw.from_pretrained(t,{config:e,cache_dir:n,local_files_only:r,revision:i});const s=JSON.stringify([t,n,r,i]);return wK(s,()=>Pw.from_pretrained(t,{config:e,cache_dir:n,local_files_only:r,revision:i}))}async function LJ(t,{config:e=null,dtype:n=null,device:r=null,model_file_name:i=null}={}){e=await IJ(t,{config:e});const s=["config.json"],a=e["transformers.js_config"]??{},o=a.use_external_data_format,l="onnx",c=r??a.device;let u=n??a.dtype;const d=RJ(e),f=(m,g=null)=>{g=g??m;const v=RK(c,m),_=IK(u,m,v),b=QM[_]??"",x=`${g}${b}.onnx`,T=`${l}/${x}`;s.push(T);const N=TJ(o,x,m);for(const A of CJ(x,N)){const L=`${l}/${A}`;s.push(L)}},{sessions:h,optional_configs:p}=eTe(d,e,{model_file_name:i});for(const[m,g]of Object.entries(h))f(m,g);if(p)for(const m of Object.values(p))s.push(m);return s}var Dg=null;function tTe(t){Dg=t}function sN(t){if(t instanceof He)return t;if(t.length===0)throw Error("items must be non-empty");if(Array.isArray(t[0])){if(t.some(e=>e.length!==t[0].length))throw Error("Unable to create tensor, you should probably activate truncation and/or padding with 'padding=True' and/or 'truncation=True' to have batched tensors with the same length.");return new He("int64",BigInt64Array.from(t.flat().map(e=>BigInt(e))),[t.length,t[0].length])}else return new He("int64",BigInt64Array.from(t.map(e=>BigInt(e))),[1,t.length])}function OJ(t){return new He("bool",[t],[1])}var gB={[Xe.DecoderOnly]:{can_generate:!0,forward:vd,prepare_inputs:E_},[Xe.DecoderOnlyWithoutHead]:{can_generate:!1,forward:vd,prepare_inputs:E_},[Xe.Seq2Seq]:{can_generate:!0,forward:l2,prepare_inputs:nS},[Xe.Vision2Seq]:{can_generate:!0,forward:l2,prepare_inputs:nS},[Xe.Musicgen]:{can_generate:!0,forward:l2},[Xe.EncoderDecoder]:{can_generate:!1,forward:l2},[Xe.ImageTextToText]:{can_generate:!0,forward:sTe,prepare_inputs:c2},[Xe.AudioTextToText]:{can_generate:!0,forward:iTe,prepare_inputs:c2},[Xe.ImageAudioTextToText]:{can_generate:!0,prepare_inputs:c2},[Xe.Phi3V]:{can_generate:!0,prepare_inputs:c2},[Xe.MultiModality]:{can_generate:!0},[Xe.AutoEncoder]:{can_generate:!1,forward:nTe},[Xe.Chatterbox]:{can_generate:!0,forward:ef},[Xe.VoxtralRealtime]:{can_generate:!0,prepare_inputs:E_},default:{can_generate:!1,forward:ef}};function vB(t,e){var o;let n=ld.get(t),r=!1;const i=(o=e==null?void 0:e.architectures)==null?void 0:o[0];if(i&&i!==t&&(t!=null&&t.endsWith("ForCausalLM"))&&i.endsWith("ForConditionalGeneration")){const l=ld.get(i);l!==void 0&&(n=l,r=!0)}const s=gB[n]??gB.default,a=id[n]??id.default;return{typeConfig:{...s,...a},textOnly:r,modelType:n}}var ld=new Map,KI=new Map,ev=new Map,ye=class extends Qa{constructor(e,n,r){super();
534X(this,"main_input_name","input_ids");X(this,"forward_params",["input_ids","attention_mask"]);X(this,"_return_dict_in_generate_keys",null);this.config=e,this.sessions=n,this.configs=r;const i=ev.get(this.constructor),{typeConfig:s}=vB(i,e);this.can_generate=s.can_generate,this._forward=s.forward,this._prepare_inputs_for_generation=s.prepare_inputs,this.can_generate&&this.forward_params.push("past_key_values"),this.custom_config=this.config["transformers.js_config"]??{}}async dispose(){var n;const e=[];for(const r of Object.values(this.sessions))e.push((n=r.release)==null?void 0:n.call(r));return await Promise.all(e)}static async from_pretrained(e,{progress_callback:n=null,config:r=null,cache_dir:i=null,local_files_only:s=!1,revision:a="main",model_file_name:o=null,subfolder:l="onnx",device:c=null,dtype:u=null,use_external_data_format:d=null,session_options:f={}}={}){const h={progress_callback:n,config:r,cache_dir:i,local_files_only:s,revision:a,model_file_name:o,subfolder:l,device:c,dtype:u,use_external_data_format:d,session_options:f},p=ev.get(this);r=h.config=await Pw.from_pretrained(e,h);const{typeConfig:m,textOnly:g,modelType:v}=vB(p,r);if(v===void 0){const T=p??(r==null?void 0:r.model_type);T!=="custom"&&en.warn(`Model type for '${T}' not found, assuming encoder-only architecture. Please report this at ${kT}.`)}if(n&&!(n instanceof KM)){const T={};try{const N=await LJ(e,{config:r,dtype:u,device:c,model_file_name:o});(await Promise.all(N.map(L=>y1(e,L,h)))).forEach((L,M)=>{if(L.exists){const B=N[M]==="config.json";T[N[M]]={loaded:B?L.size??0:0,total:L.size??0}}})}catch(N){en.warn(`Unable to fetch model file metadata for total progress tracking: ${N}`)}Object.keys(T).length>0&&(h.progress_callback=new KM(n,T))}const _=m.sessions(r,h,g),b=[RSe(e,_,h,m.cache_sessions)];m.optional_configs&&b.push(oTe(e,m.optional_configs,h));const x=await Promise.all(b);return new this(r,...x)}async _call(e){return await this.forward(e)}async forward(e){return await this._forward(this,e)}get generation_config(){var e;return((e=this.configs)==null?void 0:e.generation_config)??null}_get_logits_processor(e,n,r=null){const i=new iN;if(e.repetition_penalty!==null&&e.repetition_penalty!==1&&i.push(new zSe(e.repetition_penalty)),e.no_repeat_ngram_size!==null&&e.no_repeat_ngram_size>0&&i.push(new USe(e.no_repeat_ngram_size)),e.bad_words_ids!==null&&i.push(new qSe(e.bad_words_ids,e.eos_token_id)),e.min_length!==null&&e.eos_token_id!==null&&e.min_length>0&&i.push(new $Se(e.min_length,e.eos_token_id)),e.min_new_tokens!==null&&e.eos_token_id!==null&&e.min_new_tokens>0&&i.push(new VSe(n,e.min_new_tokens,e.eos_token_id)),e.forced_bos_token_id!==null&&i.push(new DSe(e.forced_bos_token_id)),e.forced_eos_token_id!==null&&i.push(new FSe(e.max_length,e.forced_eos_token_id)),e.suppress_tokens!==null&&i.push(new jSe(e.suppress_tokens)),e.begin_suppress_tokens!==null){const s=n>1||e.forced_bos_token_id===null?n:n+1;i.push(new AJ(e.begin_suppress_tokens,s))}return e.guidance_scale!==null&&e.guidance_scale>1&&i.push(new WSe(e.guidance_scale)),e.temperature===0&&e.do_sample&&(en.warn("`do_sample` changed to false because `temperature: 0` implies greedy sampling (always selecting the most likely token), which is incompatible with `do_sample: true`."),e.do_sample=!1),e.do_sample&&e.temperature!==null&&e.temperature!==1&&i.push(new GSe(e.temperature)),r!==null&&i.extend(r),i}_prepare_generation_config(e,n,r=PJ){const i={...this.config};for(const a of["decoder","generator","text_config"])a in i&&Object.assign(i,i[a]);const s=new r(i);return Object.assign(s,this.generation_config??{}),e&&Object.assign(s,e),n&&Object.assign(s,us(n,Object.getOwnPropertyNames(s))),s}_get_stopping_criteria(e,n=null){const r=new MJ;return e.max_length!==null&&r.push(new HSe(e.max_length,this.config.max_position_embeddings??null)),e.eos_token_id!==null&&r.push(new KSe(e.eos_token_id)),n&&r.extend(n),r}_validate_model_class(){if(!this.can_generate){const e=[Dg.MODEL_FOR_CAUSAL_LM_MAPPING_NAMES,Dg.MODEL_FOR_VISION_2_SEQ_MAPPING_NAMES,Dg.MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING_NAMES,Dg.MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING_NAMES].filter(
vendor: 5,982 bytes, line 534
534Boolean),n=ev.get(this.constructor),r=new Set,i=this.config.model_type;for(const a of e){const o=a==null?void 0:a.get(i);o&&r.add(o)}let s=`The current model class (${n}) is not compatible with \`.generate()\`, as it doesn't have a language model head.`;throw r.size>0&&(s+=` Please use the following class instead: ${[...r].join(", ")}`),Error(s)}}prepare_inputs_for_generation(...e){if(!this._prepare_inputs_for_generation)throw new Error("prepare_inputs_for_generation is not implemented for this model.");return this._prepare_inputs_for_generation(this,...e)}_update_model_kwargs_for_generation({generated_input_ids:e,outputs:n,model_inputs:r,is_encoder_decoder:i}){return r.past_key_values=aN(n,r.past_key_values),r.input_ids=new He("int64",e.flat(),[e.length,1]),i?"decoder_attention_mask"in r&&(r.decoder_attention_mask=Lr([r.decoder_attention_mask,Ya([r.decoder_attention_mask.dims[0],1])],1)):r.attention_mask=Lr([r.attention_mask,Ya([r.attention_mask.dims[0],1])],1),r.position_ids=null,r}_prepare_model_inputs({inputs:e,bos_token_id:n,model_kwargs:r}){const i=us(r,this.forward_params),s=this.main_input_name;if(s in i){if(e)throw new Error("`inputs`: {inputs}` were passed alongside {input_name} which is not allowed. Make sure to either pass {inputs} or {input_name}=...")}else i[s]=e;return{inputs_tensor:i[s],model_inputs:i,model_input_name:s}}async _prepare_encoder_decoder_kwargs_for_generation({inputs_tensor:e,model_inputs:n,model_input_name:r,generation_config:i}){if(this.sessions.model.inputNames.includes("inputs_embeds")&&!n.inputs_embeds&&"_prepare_inputs_embeds"in this){const{input_ids:a,pixel_values:o,attention_mask:l,...c}=n,u=await this._prepare_inputs_embeds(n);n={...c,...us(u,["inputs_embeds","attention_mask"])}}let{last_hidden_state:s}=await ef(this,n);if(i.guidance_scale!==null&&i.guidance_scale>1)s=Lr([s,ZM(s,0)],0),"attention_mask"in n&&(n.attention_mask=Lr([n.attention_mask,jK(n.attention_mask)],0));else if(n.decoder_input_ids){const a=sN(n.decoder_input_ids).dims[0];if(a!==s.dims[0]){if(s.dims[0]!==1)throw new Error(`The encoder outputs have a different batch size (${s.dims[0]}) than the decoder inputs (${a}).`);s=Lr(Array.from({length:a},()=>s),0)}}return n.encoder_outputs=s,n}_prepare_decoder_input_ids_for_generation({batch_size:e,model_input_name:n,model_kwargs:r,decoder_start_token_id:i,bos_token_id:s,generation_config:a}){let{decoder_input_ids:o,...l}=r;if(!(o instanceof He)){if(o)Array.isArray(o[0])||(o=Array.from({length:e},()=>o));else if(i??(i=s),this.config.model_type==="musicgen")o=Array.from({length:e*this.config.decoder.num_codebooks},()=>[i]);else if(Array.isArray(i)){if(i.length!==e)throw new Error(`\`decoder_start_token_id\` expcted to have length ${e} but got ${i.length}`);o=i}else o=Array.from({length:e},()=>[i]);o=sN(o)}return l.decoder_attention_mask=DK(o),{input_ids:o,model_inputs:l}}async generate({inputs:e=null,generation_config:n=null,logits_processor:r=null,stopping_criteria:i=null,streamer:s=null,...a}){this._validate_model_class(),n=this._prepare_generation_config(n,a);let{inputs_tensor:o,model_inputs:l,model_input_name:c}=this._prepare_model_inputs({inputs:e,model_kwargs:a});const u=this.config.is_encoder_decoder;u&&("encoder_outputs"in l||(l=await this._prepare_encoder_decoder_kwargs_for_generation({inputs_tensor:o,model_inputs:l,model_input_name:c,generation_config:n})));let d;u?{input_ids:d,model_inputs:l}=this._prepare_decoder_input_ids_for_generation({batch_size:l[c].dims.at(0),model_input_name:c,model_kwargs:l,decoder_start_token_id:n.decoder_start_token_id,bos_token_id:n.bos_token_id,generation_config:n}):d=l[c];let f=d.dims.at(-1);n.max_new_tokens!==null&&(n.max_length=f+n.max_new_tokens);const h=this._get_logits_processor(n,f,r),p=this._get_stopping_criteria(n,i),m=l[c].dims.at(0),g=ET.getSampler(n),v=new Array(m).fill(0),_=d.tolist();s&&s.put(_);let b,x={},T={};for(;;){if(l=this.prepare_inputs_for_generation(_,l,n),b=await this.forward(l),n.return_dict_in_generate)if(n.output_attentions){const U=rTe(b);for(const te in U)te in x||(x[te]=[]),x[te].push(U[te])}else this._return_dict_in_generate_keys&&Object.assign(T,us(b,this._return_dict_in_generate_keys));const B=b.logits.slice(null,-1,null).to("float32"),R=h(_,B),j=[];for(let U=0;U<R.dims.at(0);++U){const te=R[U],ne=await g(te);for(const[le,V]of ne){const q=BigInt(le);v[U]+=V,_[U].push(q),j.push([q]);break}}if(s&&s.put(j),p(_).every(U=>U))break;l=this._update_model_kwargs_for_generation({generated_input_ids:j,outputs:b,model_inputs:l,is_encoder_decoder:u})}s&&s.end();const N=new He("int64",_.flat(),[_.length,_[0].length]),A=aN(b,l.past_key_values),L=new Set(Object.values(A));for(const B of Object.values(b))B.location==="gpu-buffer"&&!L.has(B)&&B.dispose();return"past_key_values"in a||n.return_dict_in_generate||await A.dispose(),n.return_dict_in_generate?{sequences:N,past_key_values:A,...x,...T}:N}async _encode_input(e,n,r){if(!Object.hasOwn(this.sessions,e))throw new Error(`Model does not have a ${e} session.`);const i=this.sessions[e];return(await Fn(i,us(n,i.inputNames)))[r]}async encode_image(e){return this._encode_input("vision_encoder",e,"image_features")}async encode_text(e){return this._encode_input("embed_tokens",e,"inputs_embeds")}async encode_audio(e){return this._encode_input("audio_encoder",e,"audio_features")}};async function l2(t,e){let{encoder_outputs:n,input_ids:r,decoder_input_ids:i,decoder_attention_mask:s,...a}=e;if(!n){const o=us(e,t.sessions.model.inputNames);n=(await ef(t,o)).last_hidden_state}return a.input_ids=i,a.encoder_hidden_states=n,t.sessions.decoder_model_merged.inputNames.includes("encoder_attention_mask")&&(a.encoder_attention_mask=e.attention_mask),s&&!a.attention_mask&&(a.attention_mask=s),await vd(t,a,!0)}async function ef(t,e){const n=t.sessions.model,r=us(e,n.inputNames);if(n.inputNames.includes("inputs_embeds")&&!r.inputs_embeds){if(!e.input_ids)throw new Error("Both `input_ids` and `inputs_embeds` are missing in the model inputs.");
534r.inputs_embeds=await t.encode_text({input_ids:e.input_ids})}if(n.inputNames.includes("token_type_ids")&&!r.token_type_ids){if(!r.input_ids)throw new Error("Both `input_ids` and `token_type_ids` are missing in the model inputs.");r.token_type_ids=jK(r.input_ids)}if(n.inputNames.includes("pixel_mask")&&!r.pixel_mask){if(!r.pixel_values)throw new Error("Both `pixel_values` and `pixel_mask` are missing in the model inputs.");const i=r.pixel_values.dims;r.pixel_mask=Ya([i[0],i[2],i[3]])}return await Fn(n,r)}async function nTe(t,e){const n=await t.encode(e);return await t.decode(n)}function aN(t,e){const n=Object.create(null);for(const r in t)if(r.startsWith("present")){const i=r.replace("present_ssm","past_ssm").replace("present_conv","past_conv").replace("present_recurrent","past_recurrent").replace("present","past_key_values");r.includes("encoder")&&e?n[i]=e[i]:n[i]=t[r]}return e?(e.update(n),e):new HI(n)}function rTe(t){const e={};for(const n of["cross_attentions","encoder_attentions","decoder_attentions"])for(const r in t)r.startsWith(n)&&(n in e||(e[n]=[]),e[n].push(t[r]));return e}function DJ(t,e){return t.map(n=>typeof n=="number"?n:e[n]??0)}function JI(t,e,n){var c,u,d,f;if(n&&Object.keys(n).length>0)return Object.assign(e,n),n;const r=t.sessions.decoder_model_merged??t.sessions.model,i=((u=(c=e[t.main_input_name]??e.attention_mask)==null?void 0:c.dims)==null?void 0:u[0])??1,s=TT(t.config),a=(f=(d=t.config)==null?void 0:d.normalized_config)==null?void 0:f.num_heads,o={batch_size:i};typeof a=="number"&&(o["batch_size x num_heads"]=i*a);const l=Object.create(null);for(const h of r.inputMetadata){if(!s.has(h.name))continue;const p=DJ(h.shape,o),m=p.reduce((_,b)=>_*b,1),g=Ew[h.type],v=new He(h.type,new g(m),p);e[h.name]=v,l[h.name]=v}return n?(n.update(l),n):new HI(l)}async function vd(t,e,n=!1){const r=t.sessions[n?"decoder_model_merged":"model"],{past_key_values:i,...s}=e;if(r.inputNames.includes("use_cache_branch")&&(s.use_cache_branch=OJ(i!=null&&Object.keys(i).length>0)),r.inputNames.includes("position_ids")&&s.attention_mask&&!s.position_ids){const o=["paligemma","gemma3_text","gemma3"].includes(t.config.model_type)?1:0;s.position_ids=aTe(s,i,o)}r.inputNames.includes("num_logits_to_keep")&&!s.num_logits_to_keep&&(s.num_logits_to_keep=new He("int64",[0n],[])),JI(t,s,i);const a=us(s,r.inputNames);return await Fn(r,a)}async function FJ(t,{encode_function:e,merge_function:n,modality_input_names:r,modality_output_name:i,input_ids:s=null,attention_mask:a=null,position_ids:o=null,inputs_embeds:l=null,past_key_values:c=null,generation_config:u=null,logits_processor:d=null,...f}){if(!l){l=await t.encode_text({input_ids:s,...f});const p=us(f,r);if(Object.keys(p).length>0){if(s.dims[1]!==1){const m=await e({...p,...f});({inputs_embeds:l,attention_mask:a}
534=n({[i]:m,inputs_embeds:l,input_ids:s,attention_mask:a}))}else if(c&&s.dims[1]===1){const m=s.dims[1],g=c.get_seq_length();a=Lr([Ya([s.dims[0],g]),a.slice(null,[a.dims[1]-m,a.dims[1]])],1)}}}if(!o&&["qwen2_vl","qwen2_vl_text","qwen2_5_vl","qwen2_5_vl_text","qwen3_vl","qwen3_vl_text","qwen3_vl_moe","qwen3_vl_moe_text","qwen3_5","qwen3_5_text","qwen3_5_moe","qwen3_5_moe_text","glm_ocr","glm_ocr_text"].includes(t.config.model_type)){const{image_grid_thw:p,video_grid_thw:m}=f;[o]=t.get_rope_index(s,p,m,a)}return await vd(t,{inputs_embeds:l,past_key_values:c,attention_mask:a,position_ids:o,generation_config:u,logits_processor:d},!0)}async function iTe(t,e){return await FJ(t,{...e,modality_input_names:["audio_values","input_features"],modality_output_name:"audio_features",encode_function:t.encode_audio.bind(t),merge_function:t._merge_input_ids_with_audio_features.bind(t)})}async function sTe(t,e){return await FJ(t,{...e,modality_input_names:["pixel_values"],modality_output_name:"image_features",encode_function:t.encode_image.bind(t),merge_function:t._merge_input_ids_with_image_features.bind(t)})}function jJ(t,e=0){const[n,r]=t.dims,i=t.data,s=new BigInt64Array(i.length);for(let a=0;a<n;++a){const o=a*r;let l=BigInt(e);for(let c=0;c<r;++c){const u=o+c;i[u]===0n?s[u]=BigInt(1):(s[u]=l,l+=i[u])}}return{data:s,dims:t.dims}}function aTe(t,e=null,n=0){const{input_ids:r,inputs_embeds:i,attention_mask:s}=t,{data:a,dims:o}=jJ(s,n);let l=new He("int64",a,o);if(e){const c=-(r??i).dims.at(1);l=l.slice(null,[c,null])}return l}function E_(t,e,n,r){const i=n.past_key_values?n.past_key_values.get_seq_length():0,s=t.sessions.decoder_model_merged??t.sessions.model;if(s!=null&&s.inputNames.includes("num_logits_to_keep")&&!n.num_logits_to_keep&&(n.num_logits_to_keep=new He("int64",[1n],[])),!n.attention_mask){let a;for(const o of["input_ids","inputs_embeds","position_ids"])if(n[o]){a=n[o].dims;break}if(!a)throw new Error("attention_mask is not provided, and unable to infer its shape from model inputs.");n.attention_mask=Ya([a[0],i+a[1]])}if(n.past_key_values){const{input_ids:a,attention_mask:o}=n;o&&o.dims[1]>a.dims[1]||i<a.dims[1]&&(n.input_ids=a.slice(null,[i,null]))}return n}function nS(t,e,n,r){return n.past_key_values&&(e=e.map(i=>[i.at(-1)])),{...n,decoder_input_ids:sN(e)}}function c2(t,...e){return t.config.is_encoder_decoder?nS(t,...e):E_(t,...e)}function BJ({modality_token_id:t,inputs_embeds:e,modality_features:n,input_ids:r,attention_mask:i}){const s=r.tolist().map(c=>c.reduce((u,d,f)=>(d==t&&u.push(f),u),[])),a=s.reduce((c,u)=>c+u.length,0),o=n.dims[0];if(a!==o)throw new Error(`Number of tokens and features do not match: tokens: ${a}, features ${o}`);let l=0;for(let c=0;c<s.length;++c){const u=s[c],d=e[c];for(let f=0;f<u.length;++f)d[u[f]].data.set(n[l++].data)}return{inputs_embeds:e,attention_mask:i}}function YI({image_token_id:t,inputs_embeds:e,image_features:n,input_ids:r,attention_mask:i}){return BJ({modality_token_id:t,inputs_embeds:e,modality_features:n,input_ids:r,attention_mask:i})}function UJ({audio_token_id:t,inputs_embeds:e,audio_features:n,input_ids:r,attention_mask:i}){return BJ({modality_token_id:t,inputs_embeds:e,modality_features:n,input_ids:r,attention_mask:i})}async function oTe(t,e,n){return Object.fromEntries(await Promise.all(Object.keys(e).map(async r=>{const i=await cu(t,e[r],!1,n);return[r,i]})))}var XI={};u0(XI,{ASTForAudioClassification:()=>_Te,ASTModel:()=>yTe,ASTPreTrainedModel:()=>tL,AfmoeForCausalLM:()=>mTe,AfmoeModel:()=>pTe,AfmoePreTrainedModel:()=>ZI,AlbertForMaskedLM:()=>dTe,AlbertForQuestionAnswering:()=>uTe,AlbertForSequenceClassification:()=>cTe,AlbertModel:()=>lTe,AlbertPreTrainedModel:()=>_1,ApertusForCausalLM:()=>fTe,ApertusModel:()=>hTe,ApertusPreTrainedModel:()=>QI,ArceeForCausalLM:()=>vTe,ArceeModel:()=>gTe,ArceePreTrainedModel:()=>eL,BartForConditionalGeneration:()=>bTe,BartForSequenceClassification:()=>xTe,BartModel:()=>wTe,BartPretrainedModel:()=>AT,BeitForImageClassification:()=>STe,BeitModel:()=>kTe,BeitPreTrainedModel:()=>nL,BertForMaskedLM:()=>CTe,BertForQuestionAnswering:()=>PTe,BertForSequenceClassification:()=>ETe,BertForTokenClassification:()=>ATe,BertModel:()=>TTe,BertPreTrainedModel:()=>p0,BlenderbotForConditionalGeneration:()=>NTe,BlenderbotModel:()=>MTe,BlenderbotPreTrainedModel:()=>rL,BlenderbotSmallForConditionalGeneration:()=>ITe,BlenderbotSmallModel:()=>RTe,BlenderbotSmallPreTrainedModel:()=>iL,BloomForCausalLM:()=>OTe,BloomModel:()=>LTe,BloomPreTrainedModel:()=>sL,CHMv2ForDepthEstimation:()=>VTe,CHMv2PreTrainedModel:()=>qJ,CLIPModel:()=>WTe,CLIPPreTrainedModel:()=>rm,CLIPSegForImageSegmentation:()=>YTe,CLIPSegModel:()=>JTe,CLIPSegPreTrainedModel:()=>aL,CLIPTextModel:()=>GTe,CLIPTextModelWithProjection:()=>HJ,CLIPVisionModel:()=>HTe,CLIPVisionModelWithProjection:()=>KTe,CamembertForMaskedLM:()=>FTe,CamembertForQuestionAnswering:()=>UTe,CamembertForSequenceClassification:()=>jTe,CamembertForTokenClassification:()=>BTe,CamembertModel:()=>DTe,CamembertPreTrainedModel:()=>m0,ChatterboxModel:()=>$J,ChatterboxPreTrainedModel:()=>zJ,ChineseCLIPModel:()=>$Te,ChineseCLIPPreTrainedModel:()=>VJ,ClapAudioModelWithProjection:()=>GJ,ClapModel:()=>qTe,ClapPreTrainedModel:()=>PT,ClapTextModelWithProjection:()=>WJ,CodeGenForCausalLM:()=>QTe,CodeGenModel:()=>XTe,CodeGenPreTrainedModel:()=>oL,Cohere2ForCausalLM:()=>nCe,Cohere2Model:()=>tCe,Cohere2PreTrainedModel:()=>cL,CohereAsrForConditionalGeneration:()=>iCe,CohereAsrModel:()=>rCe,CohereAsrPreTrainedModel:()=>uL,CohereForCausalLM:()=>eCe,CohereModel:()=>ZTe,CoherePreTrainedModel:()=>lL,ConvBertForMaskedLM:()=>aCe,ConvBertForQuestionAnswering:()=>cCe,ConvBertForSequenceClassification:()=>oCe,ConvBertForTokenClassification:()=>lCe,ConvBertModel:()=>sCe,ConvBertPreTrainedModel:()=>g0,ConvNextForImageClassification:()=>dCe,ConvNextModel:()=>uCe,ConvNextPreTrainedModel:()=>dL,ConvNextV2ForImageClassification:()=>fCe,ConvNextV2Model:()=>hCe,ConvNextV2PreTrainedModel:()=>hL,DFineForObjectDetection:()=>vCe,DFineModel:()=>gCe,DFinePreTrainedModel:()=>pL,DINOv3ConvNextModel:()=>VCe,DINOv3ConvNextPreTrainedModel:()=>nY,DINOv3ViTModel:()=>qCe,DINOv3ViTPreTrainedModel:()=>rY,DPTForDepthEstimation:()=>QCe,DPTModel:()=>XCe,DPTPreTrainedModel:()=>wL,DacDecoderModel:()=>XJ,DacDecoderOutput:()=>JJ,DacEncoderModel:()=>YJ,DacEncoderOutput:()=>KJ,DacModel:()=>yCe,DacPreTrainedModel:()=>MT,DebertaForMaskedLM:()=>wCe,DebertaForQuestionAnswering:()=>kCe,DebertaForSequenceClassification:()=>bCe,DebertaForTokenClassification:()=>xCe,DebertaModel:()=>_Ce,DebertaPreTrainedModel:()=>v0,DebertaV2ForMaskedLM:()=>ECe,DebertaV2ForQuestionAnswering:()=>MCe,DebertaV2ForSequenceClassification:()=>ACe,DebertaV2ForTokenClassification:()=>PCe,DebertaV2Model:()=>CCe,DebertaV2PreTrainedModel:()=>y0,DecisionTransformerModel:()=>NCe,DecisionTransformerPreTrainedModel:()=>QJ,DeepseekV3ForCausalLM:()=>TCe,DeepseekV3Model:()=>SCe,DeepseekV3PreTrainedModel:()=>mL,DeiTForImageClassification:()=>ICe,DeiTModel:()=>RCe,DeiTPreTrainedModel:()=>gL,DepthAnythingForDepthEstimation:()=>LCe,DepthAnythingPreTrainedModel:()=>ZJ,DepthProForDepthEstimation:()=>OCe,DepthProPreTrainedModel:()=>eY,DetrForObjectDetection:()=>FCe,DetrForSegmentation:()=>jCe,DetrModel:()=>DCe,DetrObjectDetectionOutput:()=>vL,DetrPreTrainedModel:()=>NT,DetrSegmentationOutput:()=>tY,Dinov2ForImageClassification:()=>UCe,Dinov2Model:()=>BCe,Dinov2PreTrainedModel:()=>yL,Dinov2WithRegistersForImageClassification:()=>$Ce,Dinov2WithRegistersModel:()=>zCe,Dinov2WithRegistersPreTrainedModel:()=>_L,DistilBertForMaskedLM:()=>JCe,DistilBertForQuestionAnswering:()=>KCe,DistilBertForSequenceClassification:()=>GCe,DistilBertForTokenClassification:()=>HCe,DistilBertModel:()=>WCe,DistilBertPreTrainedModel:()=>_0,DonutSwinModel:()=>YCe,DonutSwinPreTrainedModel:()=>iY,EdgeTamModel:()=>cMe,EfficientNetForImageClassification:()=>e5e,EfficientNetModel:()=>ZCe,EfficientNetPreTrainedModel:()=>
534bL,ElectraForMaskedLM:()=>n5e,ElectraForQuestionAnswering:()=>s5e,ElectraForSequenceClassification:()=>r5e,ElectraForTokenClassification:()=>i5e,ElectraModel:()=>t5e,ElectraPreTrainedModel:()=>w0,Ernie4_5ForCausalLM:()=>o5e,Ernie4_5Model:()=>a5e,Ernie4_5PretrainedModel:()=>xL,EsmForMaskedLM:()=>c5e,EsmForSequenceClassification:()=>u5e,EsmForTokenClassification:()=>d5e,EsmModel:()=>l5e,EsmPreTrainedModel:()=>b1,EuroBertForMaskedLM:()=>f5e,EuroBertForSequenceClassification:()=>p5e,EuroBertForTokenClassification:()=>m5e,EuroBertModel:()=>h5e,EuroBertPreTrainedModel:()=>x1,ExaoneForCausalLM:()=>v5e,ExaoneModel:()=>g5e,ExaonePreTrainedModel:()=>kL,FalconForCausalLM:()=>_5e,FalconH1ForCausalLM:()=>b5e,FalconH1Model:()=>w5e,FalconH1PreTrainedModel:()=>TL,FalconModel:()=>y5e,FalconPreTrainedModel:()=>SL,FastViTForImageClassification:()=>k5e,FastViTModel:()=>x5e,FastViTPreTrainedModel:()=>CL,Florence2ForConditionalGeneration:()=>S5e,Florence2PreTrainedModel:()=>sY,GLPNForDepthEstimation:()=>z5e,GLPNModel:()=>U5e,GLPNPreTrainedModel:()=>LL,GPT2LMHeadModel:()=>X5e,GPT2Model:()=>Y5e,GPT2PreTrainedModel:()=>BL,GPTBigCodeForCausalLM:()=>V5e,GPTBigCodeModel:()=>$5e,GPTBigCodePreTrainedModel:()=>OL,GPTJForCausalLM:()=>Z5e,GPTJModel:()=>Q5e,GPTJPreTrainedModel:()=>UL,GPTNeoForCausalLM:()=>W5e,GPTNeoModel:()=>q5e,GPTNeoPreTrainedModel:()=>DL,GPTNeoXForCausalLM:()=>H5e,GPTNeoXModel:()=>G5e,GPTNeoXPreTrainedModel:()=>FL,Gemma2ForCausalLM:()=>A5e,Gemma2Model:()=>E5e,Gemma2PreTrainedModel:()=>AL,Gemma3ForCausalLM:()=>R5e,Gemma3ForConditionalGeneration:()=>lY,Gemma3Model:()=>N5e,Gemma3PreTrainedModel:()=>oY,Gemma3nForCausalLM:()=>I5e,Gemma3nForConditionalGeneration:()=>RT,Gemma3nPreTrainedModel:()=>cY,Gemma4ForCausalLM:()=>L5e,Gemma4ForConditionalGeneration:()=>PL,GemmaForCausalLM:()=>C5e,GemmaModel:()=>T5e,GemmaPreTrainedModel:()=>EL,GlmForCausalLM:()=>D5e,GlmModel:()=>O5e,GlmMoeDsaForCausalLM:()=>j5e,GlmMoeDsaModel:()=>F5e,GlmMoeDsaPreTrainedModel:()=>NL,GlmOcrForConditionalGeneration:()=>B5e,GlmPreTrainedModel:()=>ML,GptOssForCausalLM:()=>J5e,GptOssModel:()=>K5e,GptOssPreTrainedModel:()=>jL,GraniteForCausalLM:()=>tEe,GraniteModel:()=>eEe,GraniteMoeHybridForCausalLM:()=>rEe,GraniteMoeHybridModel:()=>nEe,GraniteMoeHybridPreTrainedModel:()=>$L,GranitePreTrainedModel:()=>zL,GraniteSpeechForConditionalGeneration:()=>iEe,GroundingDinoForObjectDetection:()=>sEe,GroundingDinoPreTrainedModel:()=>pY,GroupViTModel:()=>aEe,GroupViTPreTrainedModel:()=>mY,HeliumForCausalLM:()=>lEe,HeliumModel:()=>oEe,HeliumPreTrainedModel:()=>qL,HieraForImageClassification:()=>uEe,HieraModel:()=>cEe,HieraPreTrainedModel:()=>WL,HubertForCTC:()=>vEe,HubertForSequenceClassification:()=>yEe,HubertModel:()=>gEe,HubertPreTrainedModel:()=>mEe,HunYuanDenseV1ForCausalLM:()=>wEe,HunYuanDenseV1Model:()=>_Ee,HunYuanDenseV1PreTrainedModel:()=>GL,IJepaForImageClassification:()=>xEe,IJepaModel:()=>bEe,IJepaPreTrainedModel:()=>HL,Idefics3ForConditionalGeneration:()=>gY,JAISLMHeadModel:()=>SEe,JAISModel:()=>kEe,JAISPreTrainedModel:()=>KL,JinaCLIPModel:()=>TEe,JinaCLIPPreTrainedModel:()=>IT,JinaCLIPTextModel:()=>vY,JinaCLIPVisionModel:()=>CEe,Lfm2ForCausalLM:()=>AEe,Lfm2Model:()=>EEe,Lfm2MoeForCausalLM:()=>NEe,Lfm2MoeModel:()=>MEe,Lfm2MoePreTrainedModel:()=>YL,Lfm2PreTrainedModel:()=>JL,Lfm2VlForConditionalGeneration:()=>REe,LightOnOcrForConditionalGeneration:()=>PEe,LiteWhisperForConditionalGeneration:()=>MNe,Llama4ForCausalLM:()=>OEe,Llama4PreTrainedModel:()=>yY,LlamaForCausalLM:()=>LEe,LlamaModel:()=>IEe,LlamaPreTrainedModel:()=>XL,LlavaForConditionalGeneration:()=>yd,LlavaOnevisionForConditionalGeneration:()=>yd,LlavaPreTrainedModel:()=>aY,LlavaQwen2ForCausalLM:()=>M5e,LongT5ForConditionalGeneration:()=>FEe,LongT5Model:()=>DEe,LongT5PreTrainedModel:()=>QL,M2M100ForConditionalGeneration:()=>BEe,M2M100Model:()=>jEe,M2M100PreTrainedModel:()=>ZL,MBartForCausalLM:()=>HEe,MBartForConditionalGeneration:()=>WEe,MBartForSequenceClassification:()=>GEe,MBartModel:()=>qEe,MBartPreTrainedModel:()=>k1,MPNetForMaskedLM:()=>IAe,MPNetForQuestionAnswering:()=>DAe,MPNetForSequenceClassification:()=>LAe,MPNetForTokenClassification:()=>OAe,MPNetModel:()=>RAe,MPNetPreTrainedModel:()=>b0,MT5ForConditionalGeneration:()=>UAe,MT5Model:()=>BAe,MT5PreTrainedModel:()=>u4,MarianMTModel:()=>zEe,MarianModel:()=>UEe,MarianPreTrainedModel:()=>e4,MaskFormerForInstanceSegmentation:()=>VEe,MaskFormerModel:()=>$Ee,MaskFormerPreTrainedModel:()=>t4,Metric3DForDepthEstimation:()=>KEe,Metric3DPreTrainedModel:()=>_Y,Metric3Dv2ForDepthEstimation:()=>JEe,Metric3Dv2PreTrainedModel:()=>wY,MgpstrForSceneTextRecognition:()=>YEe,MgpstrModelOutput:()=>bY,MgpstrPreTrainedModel:()=>xY,MimiDecoderModel:()=>CY,MimiDecoderOutput:()=>
534SY,MimiEncoderModel:()=>TY,MimiEncoderOutput:()=>kY,MimiModel:()=>XEe,MimiPreTrainedModel:()=>LT,Mistral4ForCausalLM:()=>tAe,Mistral4Model:()=>eAe,Mistral4PreTrainedModel:()=>r4,MistralForCausalLM:()=>ZEe,MistralModel:()=>QEe,MistralPreTrainedModel:()=>n4,MobileBertForMaskedLM:()=>rAe,MobileBertForQuestionAnswering:()=>sAe,MobileBertForSequenceClassification:()=>iAe,MobileBertModel:()=>nAe,MobileBertPreTrainedModel:()=>S1,MobileLLMForCausalLM:()=>oAe,MobileLLMModel:()=>aAe,MobileLLMPreTrainedModel:()=>i4,MobileNetV1ForImageClassification:()=>cAe,MobileNetV1ForSemanticSegmentation:()=>uAe,MobileNetV1Model:()=>lAe,MobileNetV1PreTrainedModel:()=>OT,MobileNetV2ForImageClassification:()=>hAe,MobileNetV2ForSemanticSegmentation:()=>fAe,MobileNetV2Model:()=>dAe,MobileNetV2PreTrainedModel:()=>DT,MobileNetV3ForImageClassification:()=>mAe,MobileNetV3ForSemanticSegmentation:()=>gAe,MobileNetV3Model:()=>pAe,MobileNetV3PreTrainedModel:()=>FT,MobileNetV4ForImageClassification:()=>yAe,MobileNetV4ForSemanticSegmentation:()=>_Ae,MobileNetV4Model:()=>vAe,MobileNetV4PreTrainedModel:()=>jT,MobileViTForImageClassification:()=>bAe,MobileViTModel:()=>wAe,MobileViTPreTrainedModel:()=>s4,MobileViTV2ForImageClassification:()=>kAe,MobileViTV2Model:()=>xAe,MobileViTV2PreTrainedModel:()=>a4,ModernBertDecoderForCausalLM:()=>PAe,ModernBertDecoderModel:()=>AAe,ModernBertDecoderPreTrainedModel:()=>o4,ModernBertForMaskedLM:()=>TAe,ModernBertForSequenceClassification:()=>CAe,ModernBertForTokenClassification:()=>EAe,ModernBertModel:()=>SAe,ModernBertPreTrainedModel:()=>T1,Moondream1ForConditionalGeneration:()=>P5e,MoonshineForConditionalGeneration:()=>NAe,MoonshineModel:()=>MAe,MoonshinePreTrainedModel:()=>l4,MptForCausalLM:()=>jAe,MptModel:()=>FAe,MptPreTrainedModel:()=>c4,MultiModalityCausalLM:()=>zAe,MultiModalityPreTrainedModel:()=>EY,MusicgenForCausalLM:()=>VAe,MusicgenForConditionalGeneration:()=>AY,MusicgenModel:()=>$Ae,MusicgenPreTrainedModel:()=>d4,NanoChatForCausalLM:()=>WAe,NanoChatModel:()=>qAe,NanoChatPreTrainedModel:()=>h4,NemotronHForCausalLM:()=>HAe,NemotronHModel:()=>GAe,NemotronHPreTrainedModel:()=>f4,NeoBertForMaskedLM:()=>JAe,NeoBertForQuestionAnswering:()=>QAe,NeoBertForSequenceClassification:()=>YAe,NeoBertForTokenClassification:()=>XAe,NeoBertModel:()=>KAe,NeoBertPreTrainedModel:()=>x0,NomicBertModel:()=>ZAe,NomicBertPreTrainedModel:()=>PY,OPTForCausalLM:()=>fPe,OPTModel:()=>hPe,OPTPreTrainedModel:()=>w4,Olmo2ForCausalLM:()=>rPe,Olmo2Model:()=>nPe,Olmo2PreTrainedModel:()=>m4,Olmo3ForCausalLM:()=>sPe,Olmo3Model:()=>iPe,Olmo3PreTrainedModel:()=>g4,OlmoForCausalLM:()=>tPe,OlmoHybridForCausalLM:()=>oPe,OlmoHybridModel:()=>aPe,OlmoHybridPreTrainedModel:()=>v4,OlmoModel:()=>ePe,OlmoPreTrainedModel:()=>p4,OpenAIPrivacyFilterForTokenClassification:()=>cPe,OpenAIPrivacyFilterModel:()=>lPe,OpenAIPrivacyFilterPreTrainedModel:()=>y4,OpenELMForCausalLM:()=>dPe,OpenELMModel:()=>uPe,OpenELMPreTrainedModel:()=>_4,OwlViTForObjectDetection:()=>vPe,OwlViTModel:()=>gPe,OwlViTPreTrainedModel:()=>x4,Owlv2ForObjectDetection:()=>mPe,Owlv2Model:()=>pPe,Owlv2PreTrainedModel:()=>b4,PaliGemmaForConditionalGeneration:()=>yPe,ParakeetForCTC:()=>_Pe,ParakeetPreTrainedModel:()=>MY,PatchTSMixerForPrediction:()=>bPe,PatchTSMixerModel:()=>wPe,PatchTSMixerPreTrainedModel:()=>k4,PatchTSTForPrediction:()=>kPe,PatchTSTModel:()=>xPe,PatchTSTPreTrainedModel:()=>S4,Phi3ForCausalLM:()=>EPe,Phi3Model:()=>CPe,Phi3PreTrainedModel:()=>C4,Phi3VForCausalLM:()=>RY,Phi3VPreTrainedModel:()=>NY,PhiForCausalLM:()=>TPe,PhiModel:()=>SPe,PhiPreTrainedModel:()=>T4,PreTrainedModel:()=>ye,PvtForImageClassification:()=>PPe,PvtModel:()=>APe,PvtPreTrainedModel:()=>E4,PyAnnoteForAudioFrameClassification:()=>NPe,PyAnnoteModel:()=>MPe,PyAnnotePreTrainedModel:()=>A4,Qwen2ForCausalLM:()=>IPe,Qwen2Model:()=>RPe,Qwen2MoeForCausalLM:()=>OPe,Qwen2MoeModel:()=>LPe,Qwen2MoePreTrainedModel:()=>M4,Qwen2PreTrainedModel:()=>P4,Qwen2VLForCausalLM:()=>dY,Qwen2VLForConditionalGeneration:()=>RL,Qwen2VLPreTrainedModel:()=>uY,Qwen2_5_VLForCausalLM:()=>hY,Qwen2_5_VLForConditionalGeneration:()=>IL,Qwen3ForCausalLM:()=>FPe,Qwen3Model:()=>DPe,Qwen3MoeForCausalLM:()=>BPe,Qwen3MoeModel:()=>jPe,Qwen3MoePreTrainedModel:()=>R4,Qwen3NextForCausalLM:()=>zPe,Qwen3NextModel:()=>UPe,Qwen3NextPreTrainedModel:()=>I4,Qwen3PreTrainedModel:()=>N4,Qwen3VLForCausalLM:()=>IY,Qwen3VLForConditionalGeneration:()=>L4,Qwen3VLMoeForCausalLM:()=>VPe,Qwen3VLMoeForConditionalGeneration:()=>$Pe,Qwen3_5ForCausalLM:()=>LY,Qwen3_5ForConditionalGeneration:()=>O4,Qwen3_5MoeForCausalLM:()=>WPe,Qwen3_5MoeForConditionalGeneration:()=>qPe,RFDetrForObjectDetection:()=>JPe,RFDetrModel:()=>KPe,RFDetrObjectDetectionOutput:()=>OY,RFDetrPreTrainedModel:()=>F4,RTDetrForObjectDetection:()=>mCe,RTDetrModel:()=>pCe,RTDetrObjectDetectionOutput:()=>w1,RTDetrPreTrainedModel:()=>
534fL,RTDetrV2ForObjectDetection:()=>oMe,RTDetrV2Model:()=>aMe,RTDetrV2ObjectDetectionOutput:()=>DY,RTDetrV2PreTrainedModel:()=>j4,ResNetForImageClassification:()=>HPe,ResNetModel:()=>GPe,ResNetPreTrainedModel:()=>D4,RoFormerForMaskedLM:()=>nMe,RoFormerForQuestionAnswering:()=>sMe,RoFormerForSequenceClassification:()=>rMe,RoFormerForTokenClassification:()=>iMe,RoFormerModel:()=>tMe,RoFormerPreTrainedModel:()=>S0,RobertaForMaskedLM:()=>XPe,RobertaForQuestionAnswering:()=>eMe,RobertaForSequenceClassification:()=>QPe,RobertaForTokenClassification:()=>ZPe,RobertaModel:()=>YPe,RobertaPreTrainedModel:()=>k0,Sam2ImageSegmentationOutput:()=>BY,Sam2Model:()=>B4,Sam2PreTrainedModel:()=>UY,Sam3TrackerModel:()=>uMe,SamImageSegmentationOutput:()=>FY,SamModel:()=>lMe,SamPreTrainedModel:()=>jY,SapiensForDepthEstimation:()=>hMe,SapiensForNormalEstimation:()=>fMe,SapiensForSemanticSegmentation:()=>dMe,SapiensPreTrainedModel:()=>BT,SegformerForImageClassification:()=>mMe,SegformerForSemanticSegmentation:()=>gMe,SegformerModel:()=>pMe,SegformerPreTrainedModel:()=>UT,SiglipModel:()=>vMe,SiglipPreTrainedModel:()=>U4,SiglipTextModel:()=>zY,SiglipVisionModel:()=>yMe,SmolLM3ForCausalLM:()=>wMe,SmolLM3Model:()=>_Me,SmolLM3PreTrainedModel:()=>z4,SmolVLMForConditionalGeneration:()=>bMe,SnacDecoderModel:()=>VY,SnacEncoderModel:()=>$Y,SnacModel:()=>xMe,SnacPreTrainedModel:()=>zT,SolarOpenForCausalLM:()=>SMe,SolarOpenModel:()=>kMe,SolarOpenPreTrainedModel:()=>$4,SpeechT5ForSpeechToText:()=>CMe,SpeechT5ForTextToSpeech:()=>EMe,SpeechT5HifiGan:()=>AMe,SpeechT5Model:()=>TMe,SpeechT5PreTrainedModel:()=>$T,SqueezeBertForMaskedLM:()=>MMe,SqueezeBertForQuestionAnswering:()=>RMe,SqueezeBertForSequenceClassification:()=>NMe,SqueezeBertModel:()=>PMe,SqueezeBertPreTrainedModel:()=>C1,StableLmForCausalLM:()=>LMe,StableLmModel:()=>IMe,StableLmPreTrainedModel:()=>V4,Starcoder2ForCausalLM:()=>DMe,Starcoder2Model:()=>OMe,Starcoder2PreTrainedModel:()=>q4,StyleTextToSpeech2Model:()=>FMe,StyleTextToSpeech2PreTrainedModel:()=>qY,SupertonicForConditionalGeneration:()=>GY,SupertonicPreTrainedModel:()=>WY,Swin2SRForImageSuperResolution:()=>$Me,Swin2SRModel:()=>zMe,Swin2SRPreTrainedModel:()=>W4,SwinForImageClassification:()=>BMe,SwinForSemanticSegmentation:()=>UMe,SwinModel:()=>jMe,SwinPreTrainedModel:()=>VT,T5ForConditionalGeneration:()=>qMe,T5Model:()=>VMe,T5PreTrainedModel:()=>G4,TableTransformerForObjectDetection:()=>GMe,TableTransformerModel:()=>WMe,TableTransformerObjectDetectionOutput:()=>HY,TableTransformerPreTrainedModel:()=>H4,TrOCRForCausalLM:()=>HMe,TrOCRPreTrainedModel:()=>KY,UltravoxModel:()=>VL,UltravoxPreTrainedModel:()=>fY,UniSpeechForCTC:()=>JMe,UniSpeechForSequenceClassification:()=>YMe,UniSpeechModel:()=>KMe,UniSpeechPreTrainedModel:()=>qT,UniSpeechSatForAudioFrameClassification:()=>eNe,UniSpeechSatForCTC:()=>QMe,UniSpeechSatForSequenceClassification:()=>ZMe,UniSpeechSatModel:()=>XMe,UniSpeechSatPreTrainedModel:()=>E1,VaultGemmaForCausalLM:()=>nNe,VaultGemmaModel:()=>tNe,VaultGemmaPreTrainedModel:()=>K4,ViTForImageClassification:()=>sNe,ViTMAEModel:()=>aNe,ViTMAEPreTrainedModel:()=>JY,ViTMSNForImageClassification:()=>lNe,ViTMSNModel:()=>oNe,ViTMSNPreTrainedModel:()=>Y4,ViTModel:()=>iNe,ViTPreTrainedModel:()=>J4,VisionEncoderDecoderModel:()=>rNe,VitMatteForImageMatting:()=>cNe,VitMattePreTrainedModel:()=>YY,VitPoseForPoseEstimation:()=>uNe,VitPosePreTrainedModel:()=>XY,VitsModel:()=>dNe,VitsModelOutput:()=>QY,VitsPreTrainedModel:()=>ZY,VoxtralForConditionalGeneration:()=>hNe,VoxtralRealtimeForConditionalGeneration:()=>tX,VoxtralRealtimePreTrainedModel:()=>eX,Wav2Vec2BertForCTC:()=>wNe,Wav2Vec2BertForSequenceClassification:()=>bNe,Wav2Vec2BertModel:()=>_Ne,Wav2Vec2BertPreTrainedModel:()=>WT,Wav2Vec2ForAudioFrameClassification:()=>pEe,Wav2Vec2ForCTC:()=>hEe,Wav2Vec2ForSequenceClassification:()=>fEe,Wav2Vec2Model:()=>dEe,Wav2Vec2PreTrainedModel:()=>df,WavLMForAudioFrameClassification:()=>CNe,WavLMForCTC:()=>kNe,WavLMForSequenceClassification:()=>SNe,WavLMForXVector:()=>TNe,WavLMModel:()=>xNe,WavLMPreTrainedModel:()=>T0,WeSpeakerResNetModel:()=>ENe,WeSpeakerResNetPreTrainedModel:()=>rX,WhisperForConditionalGeneration:()=>iX,WhisperModel:()=>PNe,WhisperPreTrainedModel:()=>X4,XLMForQuestionAnswering:()=>ONe,XLMForSequenceClassification:()=>INe,XLMForTokenClassification:()=>LNe,XLMModel:()=>NNe,XLMPreTrainedModel:()=>C0,XLMRobertaForMaskedLM:()=>FNe,XLMRobertaForQuestionAnswering:()=>UNe,XLMRobertaForSequenceClassification:()=>jNe,XLMRobertaForTokenClassification:()=>BNe,XLMRobertaModel:()=>DNe,XLMRobertaPreTrainedModel:()=>E0,XLMWithLMHeadModel:()=>RNe,XVectorOutput:()=>nX,YolosForObjectDetection:()=>$Ne,YolosModel:()=>zNe,YolosObjectDetectionOutput:()=>sX,YolosPreTrainedModel:()=>Q4,YoutuForCausalLM:()=>qNe,YoutuModel:()=>VNe,YoutuPreTrainedModel:()=>Z4});var _1=class extends ye{},lTe=class extends _1{},cTe=class extends _1{async _call(t){return new Vt(await super._call(t))}},uTe=class extends _1{async _call(t){return new ra(await super._call(t))}},dTe=class extends _1{async _call(t){return new Yi(await super._call(t))}},QI=class extends ye{},hTe=class extends QI{},fTe=class extends QI{},ZI=class extends ye{},pTe=class extends ZI{},mTe=class extends ZI{},eL=class extends ye{},gTe=class extends eL{},vTe=class extends eL{},tL=class extends ye{},yTe=class extends tL{},_Te=class extends tL{},AT=class extends ye{},wTe=class extends AT{},bTe=class extends AT{},xTe=class extends AT{async _call(t){return new Vt(await super._call(t))}},nL=class extends ye{},kTe=class extends nL{},STe=class extends nL{async _call(t){return new Vt(await super._call(t))}},p0=class extends ye{},TTe=class extends p0{},CTe=class extends p0{async _call(t){return new Yi(await super._call(t))}},ETe=class extends p0{async _call(t){return new Vt(await super._call(t))}},ATe=class extends p0{async _call(t){return new ji(await super._call(t))}},PTe=class extends p0{async _call(t){return new ra(await super._call(t))}},rL=class extends ye{},MTe=class extends rL{},NTe=class extends rL{},iL=class extends ye{},RTe=class extends iL{},ITe=class extends iL{},sL=class extends ye{},LTe=class extends sL{},OTe=class extends sL{},m0=class extends ye{},DTe=class extends m0{},FTe=class extends m0{async _call(t){return new Yi(await super._call(t))}},jTe=class extends m0{async _call(t){return new Vt(await super._call(t))}},BTe=class extends m0{async _call(t){return new ji(await super._call(t))}},UTe=class extends m0{async _call(t){return new ra(await super._call(t))}},zTe=4299n,yB=6561n,zJ=class extends ye{constructor(){super(...arguments);X(this,"forward_params",["input_ids","inputs_embeds","attention_mask","position_ids","audio_values","exaggeration","audio_features","audio_tokens","
534speaker_embeddings","speaker_features","past_key_values"]);X(this,"main_input_name","input_ids");X(this,"_return_dict_in_generate_keys",["audio_tokens","speaker_embeddings","speaker_features"])}},$J=class extends zJ{async encode_speech(t){return Fn(this.sessions.speech_encoder,{audio_values:t})}async forward({input_ids:t=null,attention_mask:e=null,audio_values:n=null,exaggeration:r=null,position_ids:i=null,inputs_embeds:s=null,past_key_values:a=null,generation_config:o=null,logits_processor:l=null,audio_features:c=null,audio_tokens:u=null,speaker_embeddings:d=null,speaker_features:f=null,...h}){let p;if(!s){const g=this.sessions.embed_tokens.inputNames,v={input_ids:t};if(g.includes("exaggeration")){if(!(r instanceof He)){const _=t.dims[0];if(r==null)r=Qs([_],.5);else if(typeof r=="number")r=Qs([_],r);else if(Array.isArray(r))r=new He("float32",r,[_]);else throw new Error("Unsupported type for `exaggeration` input")}v.exaggeration=r}if(g.includes("position_ids")&&(v.position_ids=i),{inputs_embeds:s}=await Fn(this.sessions.embed_tokens,v),c&&u&&d&&f&&(p={audio_features:c,audio_tokens:u,speaker_embeddings:d,speaker_features:f}),p||n)p??(p=await this.encode_speech(n)),s=Lr([p.audio_features,s],1),e=Ya([s.dims[0],s.dims[1]]);else{const _=s.dims[1];if(!a||_!==1)throw new Error("Incorrect state encountered during generation.");const b=a.get_seq_length();e=Ya([s.dims[0],b+_])}}return{...await vd(this,{inputs_embeds:s,past_key_values:a,attention_mask:e,generation_config:o,logits_processor:l},!1),...p}}prepare_inputs_for_generation(t,e,n){if(!e.position_ids&&this.sessions.embed_tokens.inputNames.includes("position_ids"))if(e.input_ids.dims[1]===1){const r=Array.from({length:t.length},(i,s)=>t[s].length-t[s].findLastIndex(a=>a==yB)-1);e.position_ids=new He("int64",r,[t.length,1])}else{const i=e.input_ids.tolist().map(s=>{let a=0;return s.map(o=>o>=yB?0:a++)});e.position_ids=new He("int64",i.flat(),e.input_ids.dims)}return e.input_ids.dims[1]===1&&(delete e.audio_values,delete e.audio_features,delete e.audio_tokens,delete e.speaker_embeddings,delete e.speaker_features),E_(this,t,e)}async generate(t){const{sequences:e,audio_tokens:n,speaker_embeddings:r,speaker_features:i}=await super.generate({...t,return_dict_in_generate:!0}),s=e.slice(null,[t.input_ids.dims[1],-1]),a=Qs([s.dims[0],3],zTe),o=Lr([n,s,a],1),{waveform:l}=await Fn(this.sessions.conditional_decoder,{speech_tokens:o,speaker_features:i,speaker_embeddings:r});return l}},VJ=class extends ye{},$Te=class extends VJ{},qJ=class extends ye{},VTe=class extends qJ{},PT=class extends ye{},qTe=class extends PT{},WJ=class extends PT{static async from_pretrained(t,e={}){return super.from_pretrained(t,{...e,model_file_name:e.model_file_name??"text_model"})}},GJ=class extends PT{static async from_pretrained(t,e={}){return super.from_pretrained(t,{...e,model_file_name:e.model_file_name??"audio_model"})}},rm=class extends ye{},WTe=class extends rm{},GTe=class extends rm{static async from_pretrained(t,e={}){return super.from_pretrained(t,{...e,model_file_name:e.model_file_name??"text_model"})}},HJ=class extends rm{static async from_pretrained(t,e={}){return super.from_pretrained(t,{...e,model_file_name:e.model_file_name??"text_model"})}},HTe=class extends rm{static async from_pretrained(t,e={}){return super.from_pretrained(t,{...e,model_file_name:e.model_file_name??"vision_model"})}},KTe=class extends rm{static async from_pretrained(t,e={}){return super.from_pretrained(t,{...e,model_file_name:e.model_file_name??"vision_model"})}},aL=class extends ye{},JTe=class extends aL{},YTe=class extends aL{},oL=class extends ye{},XTe=class extends oL{},QTe=class extends oL{},lL=class extends ye{},ZTe=class extends lL{},eCe=class extends lL{},cL=class extends ye{},tCe=class extends cL{},nCe=class extends cL{},uL=class extends ye{constructor(){super(...arguments);X(this,"requires_attention_mask",!1);X(this,"main_input_name","input_features");X(this,"forward_params",["input_features","decoder_input_ids","decoder_attention_mask","past_key_values"])}},rCe=class extends uL{},iCe=class extends uL{},g0=class extends ye{},sCe=class extends g0{},aCe=class extends g0{async _call(t){return new Yi(await super._call(t))}},oCe=class extends g0{async _call(t){return new Vt(await super._call(t))}},lCe=class extends g0{async _call(t){return new ji(await super._call(t))}},cCe=class extends g0{async _call(t){return new ra(await super._call(t))}},dL=class extends ye{},uCe=class extends dL{},dCe=class extends dL{async _call(t){return new Vt(await super._call(t))}},hL=class extends ye{},hCe=class extends hL{},fCe=class extends hL{async _call(t){return new Vt(await super._call(t))}},fL=class extends ye{},pCe=class extends fL{},mCe=class extends fL{async _call(t){return new w1(await super._call(t))}},w1=class extends Ji{constructor({logits:t,pred_boxes:e}){super(),this.logits=t,this.pred_boxes=e}},pL=class extends ye{},gCe=class extends pL{},vCe=class extends pL{async _call(t){return new w1(await super._call(t))}},KJ=class extends Ji{constructor({audio_codes:t}){super(),this.audio_codes=t}},JJ=class extends Ji{constructor({audio_values:t}){super(),this.audio_values=t}},MT=class extends ye{constructor(){super(...arguments);
vendor: 4,387 bytes, line 534
534X(this,"main_input_name","input_values");X(this,"forward_params",["input_values"])}},yCe=class extends MT{async encode(t){return new KJ(await Fn(this.sessions.encoder_model,t))}async decode(t){return new JJ(await Fn(this.sessions.decoder_model,t))}},YJ=class extends MT{static async from_pretrained(t,e={}){return super.from_pretrained(t,{...e,model_file_name:e.model_file_name??"encoder_model"})}},XJ=class extends MT{static async from_pretrained(t,e={}){return super.from_pretrained(t,{...e,model_file_name:e.model_file_name??"decoder_model"})}},v0=class extends ye{},_Ce=class extends v0{},wCe=class extends v0{async _call(t){return new Yi(await super._call(t))}},bCe=class extends v0{async _call(t){return new Vt(await super._call(t))}},xCe=class extends v0{async _call(t){return new ji(await super._call(t))}},kCe=class extends v0{async _call(t){return new ra(await super._call(t))}},mL=class extends ye{},SCe=class extends mL{},TCe=class extends mL{},y0=class extends ye{},CCe=class extends y0{},ECe=class extends y0{async _call(t){return new Yi(await super._call(t))}},ACe=class extends y0{async _call(t){return new Vt(await super._call(t))}},PCe=class extends y0{async _call(t){return new ji(await super._call(t))}},MCe=class extends y0{async _call(t){return new ra(await super._call(t))}},QJ=class extends ye{},NCe=class extends QJ{},gL=class extends ye{},RCe=class extends gL{},ICe=class extends gL{async _call(t){return new Vt(await super._call(t))}},ZJ=class extends ye{},LCe=class extends ZJ{},eY=class extends ye{},OCe=class extends eY{},NT=class extends ye{},DCe=class extends NT{},FCe=class extends NT{async _call(t){return new vL(await super._call(t))}},jCe=class extends NT{async _call(t){return new tY(await super._call(t))}},vL=class extends Ji{constructor({logits:t,pred_boxes:e}){super(),this.logits=t,this.pred_boxes=e}},tY=class extends Ji{constructor({logits:t,pred_boxes:e,pred_masks:n}){super(),this.logits=t,this.pred_boxes=e,this.pred_masks=n}},yL=class extends ye{},BCe=class extends yL{},UCe=class extends yL{async _call(t){return new Vt(await super._call(t))}},_L=class extends ye{},zCe=class extends _L{},$Ce=class extends _L{async _call(t){return new Vt(await super._call(t))}},nY=class extends ye{},VCe=class extends nY{},rY=class extends ye{},qCe=class extends rY{},_0=class extends ye{},WCe=class extends _0{},GCe=class extends _0{async _call(t){return new Vt(await super._call(t))}},HCe=class extends _0{async _call(t){return new ji(await super._call(t))}},KCe=class extends _0{async _call(t){return new ra(await super._call(t))}},JCe=class extends _0{async _call(t){return new Yi(await super._call(t))}},iY=class extends ye{},YCe=class extends iY{},wL=class extends ye{},XCe=class extends wL{},QCe=class extends wL{},bL=class extends ye{},ZCe=class extends bL{},e5e=class extends bL{async _call(t){return new Vt(await super._call(t))}},w0=class extends ye{},t5e=class extends w0{},n5e=class extends w0{async _call(t){return new Yi(await super._call(t))}},r5e=class extends w0{async _call(t){return new Vt(await super._call(t))}},i5e=class extends w0{async _call(t){return new ji(await super._call(t))}},s5e=class extends w0{async _call(t){return new ra(await super._call(t))}},xL=class extends ye{},a5e=class extends xL{},o5e=class extends xL{},b1=class extends ye{},l5e=class extends b1{},c5e=class extends b1{async _call(t){return new Yi(await super._call(t))}},u5e=class extends b1{async _call(t){return new Vt(await super._call(t))}},d5e=class extends b1{async _call(t){return new ji(await super._call(t))}},x1=class extends ye{},h5e=class extends x1{},f5e=class extends x1{async _call(t){return new Yi(await super._call(t))}},p5e=class extends x1{async _call(t){return new Vt(await super._call(t))}},m5e=class extends x1{async _call(t){return new ji(await super._call(t))}},kL=class extends ye{},g5e=class extends kL{},v5e=class extends kL{},SL=class extends ye{},y5e=class extends SL{},_5e=class extends SL{},TL=class extends ye{},w5e=class extends TL{},b5e=class extends TL{},CL=class extends ye{},x5e=class extends CL{},k5e=class extends CL{async _call(t){return new Vt(await super._call(t))}},sY=class extends ye{constructor(){super(...arguments);X(this,"forward_params",["input_ids","inputs_embeds","attention_mask","pixel_values","encoder_outputs","decoder_input_ids","decoder_inputs_embeds","decoder_attention_mask","past_key_values"]);
534X(this,"main_input_name","inputs_embeds")}},S5e=class extends sY{_merge_input_ids_with_image_features({inputs_embeds:t,image_features:e,input_ids:n,attention_mask:r}){return{inputs_embeds:Lr([e,t],1),attention_mask:Lr([Ya(e.dims.slice(0,2)),r],1)}}async _prepare_inputs_embeds({input_ids:t,pixel_values:e,inputs_embeds:n,attention_mask:r}){if(!t&&!e)throw new Error("Either `input_ids` or `pixel_values` should be provided.");let i,s;return t&&(i=await this.encode_text({input_ids:t})),e&&(s=await this.encode_image({pixel_values:e})),i&&s?{inputs_embeds:n,attention_mask:r}=this._merge_input_ids_with_image_features({inputs_embeds:i,image_features:s,input_ids:t,attention_mask:r}):n=i||s,{inputs_embeds:n,attention_mask:r}}async forward({input_ids:t,pixel_values:e,attention_mask:n,decoder_input_ids:r,decoder_attention_mask:i,encoder_outputs:s,past_key_values:a,inputs_embeds:o,decoder_inputs_embeds:l}){if(o||({inputs_embeds:o,attention_mask:n}=await this._prepare_inputs_embeds({input_ids:t,pixel_values:e,inputs_embeds:o,attention_mask:n})),!s){let{last_hidden_state:u}=await ef(this,{inputs_embeds:o,attention_mask:n});s=u}if(!l){if(!r)throw new Error("Either `decoder_input_ids` or `decoder_inputs_embeds` should be provided.");l=await this.encode_text({input_ids:r})}return await vd(this,{inputs_embeds:l,attention_mask:i,encoder_attention_mask:n,encoder_hidden_states:s,past_key_values:a},!0)}},EL=class extends ye{},T5e=class extends EL{},C5e=class extends EL{},AL=class extends ye{},E5e=class extends AL{},A5e=class extends AL{},aY=class extends ye{constructor(){super(...arguments);X(this,"forward_params",["input_ids","attention_mask","pixel_values","position_ids","past_key_values"])}},yd=class extends aY{_merge_input_ids_with_image_features(t){const e=t.image_features.dims.at(-1),n=t.image_features.view(-1,e);return YI({image_token_id:this.config.image_token_index??this.config.image_token_id,...t,image_features:n})}},P5e=class extends yd{},M5e=class extends yd{},oY=class extends ye{},N5e=class extends oY{},lY=class extends yd{},R5e=class extends lY{},cY=class extends ye{constructor(){super(...arguments);X(this,"forward_params",["input_ids","attention_mask","inputs_embeds","per_layer_inputs","position_ids","pixel_values","input_features","input_features_mask","past_key_values"])}},RT=class extends cY{async forward({input_ids:t=null,attention_mask:e=null,pixel_values:n=null,input_features:r=null,input_features_mask:i=null,position_ids:s=null,inputs_embeds:a=null,per_layer_inputs:o=null,past_key_values:l=null,generation_config:c=null,logits_processor:u=null,...d}){if((!a||!o)&&({inputs_embeds:a,per_layer_inputs:o}=await Fn(this.sessions.embed_tokens,{input_ids:t}),t.dims[1]!==1)){if(n){const{image_features:h}=await this._encode_vision({pixel_values:n,...d});({inputs_embeds:a,attention_mask:e}=this._merge_input_ids_with_image_features({image_features:h,inputs_embeds:a,input_ids:t,attention_mask:e}))}if(r){const{audio_features:h}=await Fn(this.sessions.audio_encoder,{input_features:r,input_features_mask:i});({inputs_embeds:a,attention_mask:e}=this._merge_input_ids_with_audio_features({audio_features:h,inputs_embeds:a,input_ids:t,attention_mask:e}))}}return await vd(this,{inputs_embeds:a,per_layer_inputs:o,past_key_values:l,attention_mask:e,position_ids:s,generation_config:c,logits_processor:u},!0)}_encode_vision(t){return Fn(this.sessions.vision_encoder,{pixel_values:t.pixel_values})}_merge_input_ids_with_image_features(t){const e=t.image_features.dims.at(-1),n=t.image_features.view(-1,e);return YI({image_token_id:this.config.image_token_id,...t,image_features:n})}_merge_input_ids_with_audio_features(t){const e=t.audio_features.dims.at(-1),n=t.audio_features.view(-1,e);return UJ({audio_token_id:this.config.audio_token_id,...t,audio_features:n})}},I5e=class extends RT{},PL=class extends RT{constructor(){super(...arguments);X(this,"forward_params",["input_ids","attention_mask","inputs_embeds","per_layer_inputs","position_ids","pixel_values","image_position_ids","input_features","input_features_mask","past_key_values"])}_encode_vision(e){return Fn(this.sessions.vision_encoder,{pixel_values:e.pixel_values,pixel_position_ids:e.image_position_ids})}},L5e=class extends PL{},ML=class extends ye{},O5e=class extends ML{},D5e=class extends ML{},NL=class extends ye{},F5e=class extends NL{},j5e=class extends NL{},uY=class extends ye{constructor(){super(...arguments);X(this,"forward_params",["input_ids","attention_mask","position_ids","past_key_values","pixel_values","image_grid_thw"])}},RL=class extends uY{constructor(){super(...arguments);X(this,"image_grid_thw_name","grid_thw")}_get_text_only_rope_index(e,n){if(n){const{data:r,dims:i}=jJ(n),s=BigInt64Array.from({length:3*r.length},(o,l)=>r[l%r.length]),a=Array.from({length:i[0]},(o,l)=>Pi(r.subarray(i[1]*l,i[1]*(l+1)))[0]+1n+BigInt(i[1]));return[new He("int64",s,[3,...i]),new He("int64",a,[a.length,1])]}else{const[r,i]=e.dims,s=BigInt64Array.from({length:3*r*i},(a,o)=>BigInt(Math.floor(o%i/r)));return[new He("int64",s,[3,...e.dims]),FK([r,1])]}}_reorder_and_write_positions(e,n,r,i){const s=e.reduce((c,u)=>c+u.length,0),a=new Array(s);let o=0;for(let c=0;c<3;++c)for(const u of e){const d=u.length/3;for(let f=c*d;
vendor: 4,437 bytes, line 534
534f<(c+1)*d;++f)a[o++]=u[f]}let l=0;for(let c=0;c<n.length;++c)if(n[c]==1){for(let u=0;u<3;++u)r[u][i][c]=a[u*s/3+l];++l}return a}_get_multimodal_rope_positions({filtered_ids:e,image_grid_thw_list:n,video_grid_thw_list:r,spatial_merge_size:i,state:s}){const{image_token_id:a,video_token_id:o,vision_start_token_id:l}=this.config,c=e,d=c.reduce((_,b,x)=>(b==l&&_.push(x),_),[]).map(_=>c[_+1]),f=d.filter(_=>_==a).length,h=d.filter(_=>_==o).length,p=[];let m=0,g=f,v=h;for(let _=0;_<d.length;++_){const b=c.findIndex((he,z)=>z>m&&he==a),x=c.findIndex((he,z)=>z>m&&he==o),T=g>0&&b!==-1?b:c.length+1,N=v>0&&x!==-1?x:c.length+1;let A,L,M,B;T<N?([L,M,B]=n[s.image_index],++s.image_index,--g,A=T):([L,M,B]=r[s.video_index],++s.video_index,--v,A=N);const[R,j,$]=[Number(L),Math.floor(Number(M)/i),Math.floor(Number(B)/i)],U=A-m,te=p.length>0?Pi(p.at(-1))[0]+1:0;p.push(Array.from({length:3*U},(he,z)=>te+z%U));const ne=U+te,le=R*j*$,V=Array.from({length:le},(he,z)=>ne+Math.floor(z/(j*$))),q=Array.from({length:le},(he,z)=>ne+Math.floor(z/$)%j),se=Array.from({length:le},(he,z)=>ne+z%$);p.push([V,q,se].flat()),m=A+le}if(m<c.length){const _=p.length>0?Pi(p.at(-1))[0]+1:0,b=c.length-m;p.push(Array.from({length:3*b},(x,T)=>_+T%b))}return p}get_rope_index(e,n,r,i){const{vision_config:s}=this.config,a=s.spatial_merge_size??2;if(n||r){const o=e.tolist();i||(i=DK(e));const l=i.tolist(),c=Array.from({length:3},()=>Array.from({length:e.dims[0]},()=>Array.from({length:e.dims[1]},()=>0))),u=n?n.tolist():[],d=r?r.tolist():[],f={image_index:0,video_index:0},h=[];for(let p=0;p<o.length;++p){const m=o[p].filter((_,b)=>l[p][b]==1),g=this._get_multimodal_rope_positions({filtered_ids:m,image_grid_thw_list:u,video_grid_thw_list:d,spatial_merge_size:a,state:f}),v=this._reorder_and_write_positions(g,l[p],c,p);h.push(Pi(v)[0]+1-o[p].length)}return[new He("int64",c.flat(1/0),[3,e.dims[0],e.dims[1]]),new He("int64",h,[h.length,1])]}else return this._get_text_only_rope_index(e,i)}async encode_image({pixel_values:e,image_grid_thw:n}){return(await Fn(this.sessions.vision_encoder,{pixel_values:e,[this.image_grid_thw_name]:n})).image_features}_merge_input_ids_with_image_features(e){return YI({image_token_id:this.config.image_token_id,...e})}prepare_inputs_for_generation(e,n,r){if(!n.attention_mask||n.position_ids||!(this.sessions.decoder_model_merged??this.sessions.model).inputNames.includes("position_ids"))return n;if(!n.past_key_values)[n.position_ids,n.rope_deltas]=this.get_rope_index(n.input_ids,n.image_grid_thw,n.video_grid_thw,n.attention_mask);else{n.pixel_values=null;const s=n.past_key_values.get_seq_length();if(s<n.input_ids.dims[1]){const[a,o]=this.get_rope_index(n.input_ids,n.image_grid_thw,n.video_grid_thw,n.attention_mask);n.rope_deltas=o,n.position_ids=a.slice(null,null,[s,null]),n.input_ids=n.input_ids.slice(null,[s,null])}else{n.rope_deltas||([,n.rope_deltas]=this.get_rope_index(n.input_ids,n.image_grid_thw,n.video_grid_thw,n.attention_mask));const a=BigInt(s),o=n.rope_deltas.map(l=>a+l);n.position_ids=gd([o,o,o],0)}}return n}},dY=class extends RL{},IL=class extends RL{constructor(){super(...arguments);X(this,"image_grid_thw_name","image_grid_thw")}},hY=class extends dY{constructor(){super(...arguments);X(this,"image_grid_thw_name","image_grid_thw")}},B5e=class extends IL{get_vision_position_ids(t,e,n,r){const i=Math.floor(e[0]/n),s=Math.floor(e[1]/r),a=Math.floor(e[2]/r),o=s*a*i,l=Array.from({length:o},()=>t),c=Array.from({length:o},(d,f)=>t+Math.floor(f/(a*i))),u=Array.from({length:o},(d,f)=>t+f%a);return[...l,...c,...u]}_get_multimodal_rope_positions({filtered_ids:t,image_grid_thw_list:e,video_grid_thw_list:n,spatial_merge_size:r,state:i}){const{image_token_id:s}=this.config,a=[];let o=0,l=t[0]==s?1:0;for(let d=1;d<=t.length;++d){const f=d<t.length?t[d]==s?1:0:-1;f!==l&&(a.push([l,o,d]),o=d,l=f)}let c=0;const u=[];for(const[d,f,h]of a)if(d===0){const p=h-f;u.push(Array.from({length:3*p},(m,g)=>c+g%p)),c+=p}else{const p=e[i.image_index++].map(Number),m=p[0];u.push(this.get_vision_position_ids(c,p,m,r)),c+=Math.max(p[1],p[2])/r}return u}},LL=class extends ye{},U5e=class extends LL{},z5e=class extends LL{},OL=class extends ye{},$5e=class extends OL{},V5e=class extends OL{},DL=class extends ye{},q5e=class extends DL{},W5e=class extends DL{},FL=class extends ye{},G5e=class extends FL{},H5e=class extends FL{},jL=class extends ye{},K5e=class extends jL{},J5e=class extends jL{},BL=class extends ye{}
534,Y5e=class extends BL{},X5e=class extends BL{},UL=class extends ye{},Q5e=class extends UL{},Z5e=class extends UL{},zL=class extends ye{},eEe=class extends zL{},tEe=class extends zL{},$L=class extends ye{},nEe=class extends $L{},rEe=class extends $L{},fY=class extends ye{constructor(){super(...arguments);X(this,"forward_params",["input_ids","attention_mask","position_ids","audio_values","past_key_values"])}},VL=class extends fY{_merge_input_ids_with_audio_features(t){const e=t.audio_features.dims.at(-1),n=t.audio_features.view(-1,e);return UJ({audio_token_id:this.config.ignore_index??this.config.audio_token_id??this.config.audio_token_index,...t,audio_features:n})}},iEe=class extends VL{constructor(){super(...arguments);X(this,"forward_params",["input_ids","attention_mask","input_features","past_key_values"])}},pY=class extends ye{},sEe=class extends pY{},mY=class extends ye{},aEe=class extends mY{},qL=class extends ye{},oEe=class extends qL{},lEe=class extends qL{},WL=class extends ye{},cEe=class extends WL{},uEe=class extends WL{async _call(t){return new Vt(await super._call(t))}},df=class extends ye{},dEe=class extends df{},hEe=class extends df{async _call(t){return new nm(await super._call(t))}},fEe=class extends df{async _call(t){return new Vt(await super._call(t))}},pEe=class extends df{async _call(t){return new ji(await super._call(t))}},mEe=class extends ye{},gEe=class extends df{},vEe=class extends df{async _call(t){return new nm(await super._call(t))}},yEe=class extends df{async _call(t){return new Vt(await super._call(t))}},GL=class extends ye{},_Ee=class extends GL{},wEe=class extends GL{},gY=class extends yd{constructor(){super(...arguments);X(this,"forward_params",["input_ids","attention_mask","pixel_values","pixel_attention_mask","position_ids","past_key_values"])}},HL=class extends ye{},bEe=class extends HL{},xEe=class extends HL{async _call(t){return new Vt(await super._call(t))}},KL=class extends ye{},kEe=class extends KL{},SEe=class extends KL{},IT=class extends ye{},TEe=class extends IT{async forward(t){const e=!t.input_ids,n=!t.pixel_values;if(e&&n)throw new Error("Either `input_ids` or `pixel_values` should be provided.");if(e&&(t.input_ids=Ya([t.pixel_values.dims[0],1])),n){const{image_size:l}=this.config.vision_config;t.pixel_values=Qs([0,3,l,l],0)}const{text_embeddings:r,image_embeddings:i,l2norm_text_embeddings:s,l2norm_image_embeddings:a}=await super.forward(t),o={};return e||(o.text_embeddings=r,o.l2norm_text_embeddings=s),n||(o.image_embeddings=i,o.l2norm_image_embeddings=a),o}},vY=class extends IT{static async from_pretrained(t,e={}){return super.from_pretrained(t,{...e,model_file_name:e.model_file_name??"text_model"})}},CEe=class extends IT{static async from_pretrained(t,e={}){return super.from_pretrained(t,{...e,model_file_name:e.model_file_name??"vision_model"})}},JL=class extends ye{},EEe=class extends JL{},AEe=class extends JL{},PEe=class extends yd{},YL=class extends ye{},MEe=class extends YL{},NEe=class extends YL{},REe=class extends yd{constructor(){super(...arguments);X(this,"forward_params",["input_ids","attention_mask","pixel_values","pixel_attention_mask","spatial_shapes","position_ids","past_key_values"])}},XL=class extends ye{},IEe=class extends XL{},LEe=class extends XL{},yY=class extends ye{},OEe=class extends yY{},QL=class extends ye{},DEe=class extends QL{},FEe=class extends QL{},ZL=class extends ye{},jEe=class extends ZL{},BEe=class extends ZL{},e4=class extends ye{},UEe=class extends e4{},zEe=class extends e4{},t4=class extends ye{},$Ee=class extends t4{},VEe=class extends t4{},k1=class extends ye{},qEe=class extends k1{},WEe=class extends k1{},GEe=class extends k1{async _call(t){return new Vt(await super._call(t))}},HEe=class extends k1{},_Y=class extends ye{},KEe=class extends _Y{},wY=class extends ye{},JEe=class extends wY{},bY=class extends Ji{constructor({char_logits:t,bpe_logits:e,wp_logits:n}){super(),this.char_logits=t,this.bpe_logits=e,this.wp_logits=n}get logits(){return[this.char_logits,this.bpe_logits,this.wp_logits]}},xY=class extends ye{},YEe=class extends xY{async _call(t){return new bY(await super._call(t))}},kY=class extends Ji{constructor({audio_codes:t}){super(),this.audio_codes=t}},SY=class extends Ji{constructor({audio_values:t}){super(),this.audio_values=t}},LT=class extends ye{constructor(){super(...arguments);
534X(this,"main_input_name","input_values");X(this,"forward_params",["input_values"])}},XEe=class extends LT{async encode(t){return new kY(await Fn(this.sessions.encoder_model,t))}async decode(t){return new SY(await Fn(this.sessions.decoder_model,t))}},TY=class extends LT{static async from_pretrained(t,e={}){return super.from_pretrained(t,{...e,model_file_name:e.model_file_name??"encoder_model"})}},CY=class extends LT{static async from_pretrained(t,e={}){return super.from_pretrained(t,{...e,model_file_name:e.model_file_name??"decoder_model"})}},n4=class extends ye{},QEe=class extends n4{},ZEe=class extends n4{},r4=class extends ye{},eAe=class extends r4{},tAe=class extends r4{},S1=class extends ye{},nAe=class extends S1{},rAe=class extends S1{async _call(t){return new Yi(await super._call(t))}},iAe=class extends S1{async _call(t){return new Vt(await super._call(t))}},sAe=class extends S1{async _call(t){return new ra(await super._call(t))}},i4=class extends ye{},aAe=class extends i4{},oAe=class extends i4{},OT=class extends ye{},lAe=class extends OT{},cAe=class extends OT{async _call(t){return new Vt(await super._call(t))}},uAe=class extends OT{},DT=class extends ye{},dAe=class extends DT{},hAe=class extends DT{async _call(t){return new Vt(await super._call(t))}},fAe=class extends DT{},FT=class extends ye{},pAe=class extends FT{},mAe=class extends FT{async _call(t){return new Vt(await super._call(t))}},gAe=class extends FT{},jT=class extends ye{},vAe=class extends jT{},yAe=class extends jT{async _call(t){return new Vt(await super._call(t))}},_Ae=class extends jT{},s4=class extends ye{},wAe=class extends s4{},bAe=class extends s4{async _call(t){return new Vt(await super._call(t))}},a4=class extends ye{},xAe=class extends a4{},kAe=class extends a4{async _call(t){return new Vt(await super._call(t))}},T1=class extends ye{},SAe=class extends T1{},TAe=class extends T1{async _call(t){return new Yi(await super._call(t))}},CAe=class extends T1{async _call(t){return new Vt(await super._call(t))}},EAe=class extends T1{async _call(t){return new ji(await super._call(t))}},o4=class extends ye{},AAe=class extends o4{},PAe=class extends o4{},l4=class extends ye{constructor(){super(...arguments);X(this,"requires_attention_mask",!1);X(this,"main_input_name","input_values");X(this,"forward_params",["input_values","decoder_input_ids","past_key_values"])}},MAe=class extends l4{},NAe=class extends l4{},b0=class extends ye{},RAe=class extends b0{},IAe=class extends b0{async _call(t){return new Yi(await super._call(t))}},LAe=class extends b0{async _call(t){return new Vt(await super._call(t))}},OAe=class extends b0{async _call(t){return new ji(await super._call(t))}},DAe=class extends b0{async _call(t){return new ra(await super._call(t))}},c4=class extends ye{},FAe=class extends c4{},jAe=class extends c4{},u4=class extends ye{},BAe=class extends u4{},UAe=class extends u4{},EY=class extends ye{},zAe=class extends EY{constructor(...e){super(...e);X(this,"forward_params",["input_ids","pixel_values","images_seq_mask","images_emb_mask","attention_mask","position_ids","past_key_values"]);this._generation_mode="text"}async forward(e){const n=this._generation_mode??"text";let r;if(n==="text"||!e.past_key_values){const l=this.sessions.prepare_inputs_embeds,c=us(e,l.inputNames);r=await Fn(l,c)}else{const l=this.sessions.gen_img_embeds,c=us({image_ids:e.input_ids},l.inputNames);r=await Fn(l,c)}const i={...e,...r},s=await vd(this,i),a=this.sessions[n==="text"?"lm_head":"gen_head"];if(!a)throw new Error(`Unable to find "${a}" generation head`);const o=await Fn(a,us(s,a.inputNames));return{...r,...s,...o}}prepare_inputs_for_generation(e,n,r){const i=!!n.past_key_values;return r.guidance_scale!==null&&r.guidance_scale>1&&(i?n.input_ids=Lr([n.input_ids,n.input_ids],0):(n.input_ids=Lr([n.input_ids,ZM(n.input_ids,BigInt(r.pad_token_id))],0),n.attention_mask=Lr([n.attention_mask,ZM(n.attention_mask,0n)],0))),(i||!n.pixel_values)&&(n.pixel_values=Qs([0,0,3,384,384],1)),i&&(n.images_seq_mask=new He("bool",new Array(1).fill(!0).fill(!1,0,1),[1,1]),n.images_emb_mask=new He("bool",new Array(0).fill(!1),[1,1,0])),n}async generate(e){return this._generation_mode="text",super.generate(e)}async generate_images(e){this._generation_mode="image";const n=(e.inputs??e[this.main_input_name]).dims[1],i=(await super.generate(e)).slice(null,[n,null]),s=this.sessions.image_decode,{decoded_image:a}=await Fn(s,{generated_tokens:i}),o=a.add_(1).mul_(255/2).clamp_(0,255).to("uint8"),l=[];for(const c of o){const u=nc.fromTensor(c);l.push(u)}return l}},d4=class extends ye{},$Ae=class extends d4{},VAe=class extends d4{},AY=class extends ye{constructor(){super(...arguments);X(this,"forward_params",["input_ids","attention_mask","encoder_outputs","decoder_input_ids","decoder_attention_mask","past_key_values"])}_apply_and_filter_by_delay_pattern_mask(e){const[n,r]=e.dims,i=this.config.decoder.num_codebooks,s=r-i;let a=0;for(let c=0;c<e.size;++c){if(e.data[c]==this.config.decoder.pad_token_id)continue;const u=c%r,d=Math.floor(c/r)%i,f=u-d;f>0&&f<=s&&(e.data[a++]=e.data[c])}const o=Math.floor(n/i),l=a/(o*i);return new He(e.type,e.data.slice(0,a),[o,i,l])}prepare_inputs_for_generation(e,n,r){const i=BigInt(this.config.decoder.pad_token_id);let s=structuredClone(e);for(let a=0;a<s.length;++a)for(let o=0;o<s[a].length;++o)a%this.config.decoder.num_codebooks>=o&&(s[a][o]=i);return r.guidance_scale!==null&&r.guidance_scale>1&&(s=s.concat(s)),nS(this,s,n)}async generate(e){const n=await super.generate(e),r=this._apply_and_filter_by_delay_pattern_mask(n).unsqueeze_(0),{audio_values:i}=await Fn(this.sessions.encodec_decode,{audio_codes:r});return i}},h4=class extends ye{},qAe=class extends h4{},WAe=class extends h4{},f4=class extends ye{},GAe=class extends f4{},HAe=class extends f4{},x0=class extends ye{},KAe=class extends x0{},JAe=class extends x0{async _call(t){return new Yi(await super._call(t))}},YAe=class extends x0{async _call(t){return new Vt(await super._call(t))}},XAe=class extends x0{async _call(t){return new ji(await super._call(t))}},QAe=class extends x0{async _call(t){return new ra(await super._call(t))}},PY=class extends ye{},ZAe=class extends PY{},p4=class extends ye{},ePe=class extends p4{},tPe=class extends p4{},m4=class extends ye{},nPe=class extends m4{},rPe=class extends m4{},g4=class extends ye{},iPe=class extends g4{},sPe=class extends g4{},v4=class extends ye{},aPe=class extends v4{},oPe=class extends v4{},y4=class extends ye{},lPe=class extends y4{},cPe=class extends y4{async _call(t){return new Vt(await super._call(t))}},_4=class extends ye{},uPe=class extends _4{},dPe=class extends _4{},w4=class extends ye{},hPe=class extends w4{},fPe=class extends w4{},b4=class extends ye{},pPe=class extends b4{},mPe=class extends b4{},x4=class extends ye{},gPe=class extends x4{},vPe=class extends x4{},yPe=class extends yd{},MY=class extends ye{},_Pe=class extends MY{async _call(t){return new nm(await super._call(t))}},k4=class extends ye{},wPe=class extends k4{},bPe=class extends k4{},S4=class extends ye{},xPe=class extends S4{},kPe=class extends S4{},T4=class extends ye{},SPe=class extends T4{},TPe=class extends T4{},C4=class extends ye{},CPe=class extends C4{},EPe=class extends C4{},NY=class extends ye{constructor(){super(...arguments);X(this,"forward_params",["input_ids","inputs_embeds","attention_mask","position_ids","pixel_values","image_sizes","past_key_values"])}},RY=class extends NY{async forward({input_ids:t=null,attention_mask:e=null,pixel_values:n=null,image_sizes:r=null,position_ids:i=null,inputs_embeds:s=null,past_key_values:a=null,generation_config:o=null,logits_processor:l=null,...c}){if(!s){let d;if(n&&t.dims[1]!==1){if(!r)throw new Error("`image_sizes` must be provided when `pixel_values` is provided.");({image_features:d}=await Fn(this.sessions.vision_encoder,{pixel_values:n,image_sizes:r}))}else{const f=this.config.normalized_config.hidden_size;d=new He("float32",[],[0,f])}({inputs_embeds:s}=await Fn(this.sessions.prepare_inputs_embeds,{input_ids:t,image_features:d}))}return await vd(this,{inputs_embeds:s,past_key_values:a,attention_mask:e,position_ids:i,generation_config:o,logits_processor:l},!1)}},E4=class extends ye{}
534,APe=class extends E4{},PPe=class extends E4{async _call(t){return new Vt(await super._call(t))}},A4=class extends ye{},MPe=class extends A4{},NPe=class extends A4{async _call(t){return new ji(await super._call(t))}},P4=class extends ye{},RPe=class extends P4{},IPe=class extends P4{},M4=class extends ye{},LPe=class extends M4{},OPe=class extends M4{},N4=class extends ye{},DPe=class extends N4{},FPe=class extends N4{},R4=class extends ye{},jPe=class extends R4{},BPe=class extends R4{},I4=class extends ye{},UPe=class extends I4{},zPe=class extends I4{},L4=class extends IL{},IY=class extends hY{},$Pe=class extends L4{},VPe=class extends IY{},O4=class extends L4{},LY=class extends O4{},qPe=class extends O4{},WPe=class extends LY{},D4=class extends ye{},GPe=class extends D4{},HPe=class extends D4{async _call(t){return new Vt(await super._call(t))}},F4=class extends ye{},KPe=class extends F4{},JPe=class extends F4{async _call(t){return new OY(await super._call(t))}},OY=class extends w1{},k0=class extends ye{},YPe=class extends k0{},XPe=class extends k0{async _call(t){return new Yi(await super._call(t))}},QPe=class extends k0{async _call(t){return new Vt(await super._call(t))}},ZPe=class extends k0{async _call(t){return new ji(await super._call(t))}},eMe=class extends k0{async _call(t){return new ra(await super._call(t))}},S0=class extends ye{},tMe=class extends S0{},nMe=class extends S0{async _call(t){return new Yi(await super._call(t))}},rMe=class extends S0{async _call(t){return new Vt(await super._call(t))}},iMe=class extends S0{async _call(t){return new ji(await super._call(t))}},sMe=class extends S0{async _call(t){return new ra(await super._call(t))}},j4=class extends ye{},aMe=class extends j4{},oMe=class extends j4{async _call(t){return new DY(await super._call(t))}},DY=class extends w1{},FY=class extends Ji{constructor({iou_scores:t,pred_masks:e}){super(),this.iou_scores=t,this.pred_masks=e}},jY=class extends ye{},lMe=class extends jY{async get_image_embeddings({pixel_values:t}){return await ef(this,{pixel_values:t})}async forward(t){!t.image_embeddings||!t.image_positional_embeddings?t={...t,...await this.get_image_embeddings(t)}:t={...t},t.input_labels??(t.input_labels=Ya(t.input_points.dims.slice(0,-1)));const e={image_embeddings:t.image_embeddings,image_positional_embeddings:t.image_positional_embeddings};return t.input_points&&(e.input_points=t.input_points),t.input_labels&&(e.input_labels=t.input_labels),t.input_boxes&&(e.input_boxes=t.input_boxes),await Fn(this.sessions.prompt_encoder_mask_decoder,e)}async _call(t){return new FY(await super._call(t))}},BY=class extends Ji{constructor({iou_scores:t,pred_masks:e,object_score_logits:n}){super(),this.iou_scores=t,this.pred_masks=e,this.object_score_logits=n}},UY=class extends ye{},B4=class extends UY{async get_image_embeddings({pixel_values:t}){return await ef(this,{pixel_values:t})}async forward(t){const{num_feature_levels:e}=this.config.vision_config;if(Array.from({length:e},(s,a)=>`image_embeddings.${a}`).some(s=>!t[s])?t={...t,...await this.get_image_embeddings(t)}:t={...t},t.input_points){if(t.input_boxes&&t.input_boxes.dims[1]!==1)throw new Error("When both `input_points` and `input_boxes` are provided, the number of boxes per image must be 1.");const s=t.input_points.dims;t.input_labels??(t.input_labels=Ya(s.slice(0,-1))),t.input_boxes??(t.input_boxes=Qs([s[0],0,4],0))}else if(t.input_boxes){const s=t.input_boxes.dims;t.input_labels=Qs([s[0],s[1],0],-1n),t.input_points=Qs([s[0],1,0,2],0)}else throw new Error("At least one of `input_points` or `input_boxes` must be provided.");const r=this.sessions.prompt_encoder_mask_decoder,i=us(t,r.inputNames);return await Fn(r,i)}async _call(t){return new BY(await super._call(t))}},cMe=class extends B4{},uMe=class extends B4{},BT=class extends ye{},dMe=class extends BT{},hMe=class extends BT{},fMe=class extends BT{},UT=class extends ye{},pMe=class extends UT{},mMe=class extends UT{},gMe=class extends UT{},U4=class extends ye{},vMe=class extends U4{},zY=class extends U4{static async from_pretrained(t,e={}){return super.from_pretrained(t,{...e,model_file_name:e.model_file_name??"text_model"})}},yMe=class extends rm{static async from_pretrained(t,e={}){return super.from_pretrained(t,{...e,model_file_name:e.model_file_name??"vision_model"})}},z4=class extends ye{},_Me=class extends z4{},wMe=class extends z4{},bMe=class extends gY{},zT=class extends ye{constructor(){super(...arguments);
534X(this,"main_input_name","input_values");X(this,"forward_params",["input_values"])}},xMe=class extends zT{async encode(t){return await Fn(this.sessions.encoder_model,t)}async decode(t){return await Fn(this.sessions.decoder_model,t)}},$Y=class extends zT{static async from_pretrained(t,e={}){return super.from_pretrained(t,{...e,model_file_name:e.model_file_name??"encoder_model"})}},VY=class extends zT{static async from_pretrained(t,e={}){return super.from_pretrained(t,{...e,model_file_name:e.model_file_name??"decoder_model"})}},$4=class extends ye{},kMe=class extends $4{},SMe=class extends $4{},$T=class extends ye{},TMe=class extends $T{},CMe=class extends $T{},EMe=class extends $T{async generate_speech(t,e,{threshold:n=.5,minlenratio:r=0,maxlenratio:i=20,vocoder:s=null}={}){const a={input_ids:t},{encoder_outputs:o,encoder_attention_mask:l}=await ef(this,a),c=o.dims[1]/this.config.reduction_factor,u=Math.floor(c*i),d=Math.floor(c*r),f=this.config.num_mel_bins;let h=[],p=null,m=null,g=0;for(;;){++g;const b=OJ(!!m);let x;m?x=m.output_sequence_out:x=new He("float32",new Float32Array(f),[1,1,f]);let T={use_cache_branch:b,output_sequence:x,encoder_attention_mask:l,speaker_embeddings:e,encoder_hidden_states:o};JI(this,T,p),m=await Fn(this.sessions.decoder_model_merged,T),p=aN(m,p);const{prob:N,spectrum:A}=m;if(h.push(A),g>=d&&(Array.from(N.data).filter(L=>L>=n).length>0||g>=u))break}const v=Lr(h),{waveform:_}=await Fn(s.sessions.model,{spectrogram:v});return{spectrogram:v,waveform:_}}},AMe=class extends ye{constructor(){super(...arguments);X(this,"main_input_name","spectrogram")}},C1=class extends ye{},PMe=class extends C1{},MMe=class extends C1{async _call(t){return new Yi(await super._call(t))}},NMe=class extends C1{async _call(t){return new Vt(await super._call(t))}},RMe=class extends C1{async _call(t){return new ra(await super._call(t))}},V4=class extends ye{},IMe=class extends V4{},LMe=class extends V4{},q4=class extends ye{},OMe=class extends q4{},DMe=class extends q4{},qY=class extends ye{},FMe=class extends qY{},WY=class extends ye{},GY=class extends WY{async generate_speech({input_ids:t,attention_mask:e,style:n,num_inference_steps:r=5,speed:i=1.05}){const{sampling_rate:s,chunk_compress_factor:a,base_chunk_size:o,latent_dim:l}=this.config,{last_hidden_state:c,durations:u}=await Fn(this.sessions.text_encoder,{input_ids:t,attention_mask:e,style:n}),d=u.div(i).mul_(s),f=o*a,h=d.data,p=Int32Array.from(h,M=>Math.ceil(M/f)),m=Math.max(...p),g=t.dims[0],v=new BigInt64Array(g*m);for(let M=0;M<g;++M)v.fill(1n,M*m,M*m+p[M]);const _=new He("int64",v,[g,m]),b=l*a,x=b*m;let T=u2e([g,b,m]);const N=T.data;for(let M=0;M<g;++M)if(p[M]!==m)for(let B=0;B<b;++B)N.fill(0,M*x+B*m+p[M],M*x+(B+1)*m);const A=Qs([g],r);for(let M=0;M<r;++M){const B=Qs([g],M);({denoised_latents:T}=await Fn(this.sessions.latent_denoiser,{style:n,noisy_latents:T,latent_mask:_,encoder_outputs:c,attention_mask:e,timestep:B,num_inference_steps:A}))}const{waveform:L}=await Fn(this.sessions.voice_decoder,{latents:T});return{waveform:L,durations:d}}},VT=class extends ye{},jMe=class extends VT{},BMe=class extends VT{async _call(t){return new Vt(await super._call(t))}},UMe=class extends VT{},W4=class extends ye{},zMe=class extends W4{},$Me=class extends W4{},G4=class extends ye{constructor(){super(...arguments);X(this,"forward_params",["input_ids","attention_mask","encoder_outputs","decoder_input_ids","decoder_attention_mask","past_key_values"])}},VMe=class extends G4{},qMe=class extends G4{},H4=class extends ye{},WMe=class extends H4{},GMe=class extends H4{async _call(t){return new HY(await super._call(t))}},HY=class extends vL{},KY=class extends ye{},HMe=class extends KY{},qT=class extends ye{},KMe=class extends qT{},JMe=class extends qT{async _call(t){return new nm(await super._call(t))}},YMe=class extends qT{async _call(t){return new Vt(await super._call(t))}},E1=class extends ye{},XMe=class extends E1{},QMe=class extends E1{async _call(t){return new nm(await super._call(t))}},ZMe=class extends E1{async _call(t){return new Vt(await super._call(t))}},eNe=class extends E1{async _call(t){return new ji(await super._call(t))}},K4=class extends ye{},tNe=class extends K4{},nNe=class extends K4{},rNe=class extends ye{constructor(){super(...arguments);X(this,"main_input_name","pixel_values");X(this,"forward_params",["pixel_values","decoder_input_ids","encoder_hidden_states","past_key_values"])}},J4=class extends ye{},iNe=class extends J4{},sNe=class extends J4{async _call(t){return new Vt(await super._call(t))}},JY=class extends ye{},aNe=class extends JY{},Y4=class extends ye{},oNe=class extends Y4{},lNe=class extends Y4{async _call(t){return new Vt(await super._call(t))}},YY=class extends ye{},cNe=class extends YY{async _call(t){return new LSe(await super._call(t))}},XY=class extends ye{},uNe=class extends XY{},QY=class extends Ji{constructor({waveform:t,spectrogram:e}){super(),this.waveform=t,this.spectrogram=e}},ZY=class extends ye{},dNe=class extends ZY{async _call(t){return new QY(await super._call(t))}},hNe=class extends VL{},_B=2,fNe=1,Z5=new WeakMap;function pNe(t,e){var m,g;const{text_config:n,audio_config:r}=t.config,i=t.sessions.audio_encoder,{num_mel_bins:s,hidden_size:a}=r,o=s+a,l=new HI,c=TT(r),u={batch_size:1};let d="float32";for(const v of i.inputMetadata){if(v.name==="past_padding_cache"){d=v.type;continue}if(!c.has(v.name))continue;const _=DJ(v.shape,u),b=_.reduce((T,N)=>T*N,1),x=Ew[v.type];l[v.name]=new He(v.type,new x(b),_)}const f=Ew[d],h=new He(d,new f(o*_B),[1,o,_B]),p=((m=e[Symbol.asyncIterator])==null?void 0:m.call(e))??((g=e[Symbol.iterator])==null?void 0:g.call(e));if(!p)throw new Error("input_features must be iterable or async iterable");return{encoder_session:i,enc_kv_cache:l,enc_padding_cache:h,enc_past_seq_len:0,audio_embed_queue:[],audio_embed_total_tokens:0,audio_queue_offset:0,audio_consumed:0,stream_exhausted:!1,chunks_iter:p,text_hidden_size:n.hidden_size}}async function mNe(t,e){const n=e.dims[2],r=Math.floor((fNe+n-3)/2)+1,i=new He("int64",BigInt64Array.from({length:r},(u,d)=>
534BigInt(t.enc_past_seq_len+d)),[1,r]),s=t.enc_past_seq_len+r,a=Ya([1,s]),{audio_embeds:o,present_padding_cache:l,...c}=await Fn(t.encoder_session,{input_features:e,attention_mask:a,position_ids:i,past_padding_cache:t.enc_padding_cache,...t.enc_kv_cache});t.enc_padding_cache.location==="gpu-buffer"&&t.enc_padding_cache.dispose(),t.enc_padding_cache=l;for(const u in c)if(u.startsWith("present.")){const d=u.replace("present","past_key_values"),f=t.enc_kv_cache[d];(f==null?void 0:f.location)==="gpu-buffer"&&f.dispose(),t.enc_kv_cache[d]=c[u]}return t.enc_past_seq_len=s,o}async function gNe(t,e){for(;t.audio_embed_total_tokens<e&&!t.stream_exhausted;){const n=await t.chunks_iter.next();if(n.done){t.stream_exhausted=!0;break}const r=await mNe(t,n.value);t.audio_embed_queue.push({data:r.data,tokens:r.dims[1]}),t.audio_embed_total_tokens+=r.dims[1]}}function vNe(t,e,n){if(t.audio_embed_queue.length===0)return;const r=e.data;let i=0,s=n;for(;s>0&&t.audio_embed_queue.length>0;){const a=t.audio_embed_queue[0],o=a.tokens-t.audio_queue_offset,l=Math.min(s,o),c=t.audio_queue_offset*t.text_hidden_size;for(let u=0;u<l*t.text_hidden_size;++u)r[i*t.text_hidden_size+u]+=a.data[c+u];i+=l,s-=l,t.audio_queue_offset+=l,t.audio_queue_offset>=a.tokens&&(t.audio_embed_queue.shift(),t.audio_queue_offset=0)}t.audio_consumed+=n-s}var yNe=class extends CT{constructor(t){super(),this._s=t}_call(t){const e=this._s.stream_exhausted&&this._s.audio_embed_queue.length===0;return t.map(()=>e)}},eX=class extends ye{constructor(){super(...arguments);X(this,"forward_params",["input_ids","attention_mask","position_ids","past_key_values"])}},tX=class extends eX{async forward({input_ids:t,past_key_values:e,...n}){const r=t.dims[1],i=Z5.get(this);i&&await gNe(i,i.audio_consumed+r);const{inputs_embeds:s}=await Fn(this.sessions.embed_tokens,{input_ids:t});i&&vNe(i,s,r);const a={inputs_embeds:s,...n};JI(this,a,e);const o=this.sessions.decoder_model_merged,l=us(a,o.inputNames);return await Fn(o,l)}async generate({input_features:t,stopping_criteria:e,...n}){if(!t)throw new Error("input_features (generator/iterable) must be provided");const r=pNe(this,t);Z5.set(this,r);const i=new MJ;i.push(new yNe(r)),e&&i.extend(e);try{return await super.generate({...n,stopping_criteria:i})}finally{r.enc_kv_cache.dispose(),Z5.delete(this)}}},WT=class extends ye{},_Ne=class extends WT{},wNe=class extends WT{async _call(t){return new nm(await super._call(t))}},bNe=class extends WT{async _call(t){return new Vt(await super._call(t))}},nX=class extends Ji{constructor({logits:t,embeddings:e}){super(),this.logits=t,this.embeddings=e}},T0=class extends ye{},xNe=class extends T0{},kNe=class extends T0{async _call(t){return new nm(await super._call(t))}},SNe=class extends T0{async _call(t){return new Vt(await super._call(t))}},TNe=class extends T0{async _call(t){return new nX(await super._call(t))}},CNe=class extends T0{async _call(t){return new ji(await super._call(t))}},rX=class extends ye{},ENe=class extends rX{},ANe=class extends PJ{constructor(){super(...arguments);X(this,"return_timestamps",null);X(this,"return_token_timestamps",null);X(this,"num_frames",null);X(this,"alignment_heads",null);X(this,"task",null);X(this,"language",null);X(this,"no_timestamps_token_id",null);X(this,"prompt_ids",null);X(this,"is_multilingual",null);X(this,"lang_to_id",null);X(this,"task_to_id",null);X(this,"max_initial_timestamp_index",1)}},X4=class extends ye{constructor(){super(...arguments);X(this,"requires_attention_mask",!1);X(this,"main_input_name","input_features");X(this,"forward_params",["input_features","attention_mask","decoder_input_ids","decoder_attention_mask","past_key_values"])}},PNe=class extends X4{},iX=class extends X4{_prepare_generation_config(t,e){return super._prepare_generation_config(t,e,ANe)}_retrieve_init_tokens(t){const e=[t.decoder_start_token_id];let n=t.language;const r=t.task;if(t.is_multilingual){n||(en.warn("No language specified - defaulting to English (en)."),n="en");const s=`<|${sxe(n)}|>`;e.push(t.lang_to_id[s]),e.push(t.task_to_id[r??"transcribe"])}else if(n||r)throw new Error("Cannot specify `task` or `language` for an English-only model. If the model is intended to be multilingual, pass `is_multilingual=true` to generate, or update the generation config.");return!t.return_timestamps&&t.no_timestamps_token_id&&e.at(-1)!==t.no_timestamps_token_id?e.push(t.no_timestamps_token_id):t.return_timestamps&&e.at(-1)===t.no_timestamps_token_id&&(en.warn("<|notimestamps|> prompt token is removed from generation_config since `return_timestamps` is set to `true`."),e.pop()),e.filter(i=>i!=null)}async generate({inputs:t=null,generation_config:e=null,logits_processor:n=null,stopping_criteria:r=null,...i}){e=this._prepare_generation_config(e,i);const s=i.decoder_input_ids instanceof He?jI(i.decoder_input_ids):i.decoder_input_ids??this._retrieve_init_tokens(e);if(e.return_timestamps&&(n??(n=new iN),n.push(new BSe(e,s))),e.begin_suppress_tokens&&(n??(n=new iN),n.push(new AJ(e.begin_suppress_tokens,s.length))),e.return_token_timestamps){if(!e.alignment_heads)throw new Error("Model generation config has no `alignment_heads`, token-level timestamps not available. See https://gist.github.com/hollance/42e32852f24243b748ae6bc1f985b13a on how to add this property to the generation config.");e.task==="translate"&&en.warn("Token-level timestamps may not be reliable for task 'translate'."),e.output_attentions=!0,e.return_dict_in_generate=!0}if(e.return_timestamps&&!i.max_new_tokens)return this._generate_with_seek({inputs:t,generation_config:e,logits_processor:n,init_tokens:s,kwargs:i});const a=await super.generate({inputs:t,generation_config:e,logits_processor:n,decoder_input_ids:s,...i});return e.return_token_timestamps&&(a.token_timestamps=this._extract_token_timestamps(a,e.alignment_heads,e.num_frames,.02,s.length)),a}async _generate_with_seek({inputs:t,generation_config:e,logits_processor:n,init_tokens:r,kwargs:i}){const s=e.no_timestamps_token_id+1,a=Array.isArray(e.eos_token_id)?e.eos_token_id[0]:e.eos_token_id,o=e.return_token_timestamps,l=t,c=l.dims[2],u=2,d=this.config.max_source_positions,f=u*d;let h=0;const p=[],m=[];for(;h<c;){const v=Math.min(h+f,c),_=l.slice(null,null,[h,v]);let b;const x=_.dims[2];if(x<f){const ne=l.dims[1],le=new Float32Array(ne*f),V=_.data;for(let q=0;q<ne;++q)le.set(V.subarray(q*x,(q+1)*x),q*f);b=new He("float32",le,[1,ne,f])}else b=_;if(n)for(const ne of n)"begin_index"in ne&&(ne.begin_index=r.length);const T=await super.generate({inputs:b,generation_config:e,logits_processor:n,decoder_input_ids:r,...i}),A=(o?T.sequences:T)[0].tolist().map(Number).slice(r.length);let L;if(o){T.token_timestamps=this._extract_token_timestamps(T,e.alignment_heads,Math.floor((v-h)/u),.02,r.length);const ne=h/u*.02;L=T.token_timestamps[0].tolist().slice(r.length).map(le=>le+ne)}if(A.length>0&&A.at(-1)===a&&A.pop(),A.length===0)break;const M=A.map(ne=>ne>=s),B=A.length>=2&&M[A.length-1]&&!M[A.length-2],R=[];for(let ne=0;ne<A.length-1;++ne)M[ne]&&M[ne+1]&&R.push(ne+1);let j,$=A.length;if(R.length>0)if(B)j=v-h;else{const ne=R.at(-1);j=(A[ne-1]-s)*u,$=ne}else j=v-h;const U=Math.floor(h/u),te=s+1500;for(let ne=0;ne<$;++ne)A[ne]>=s&&(A[ne]=Math.min(A[ne]+U,te));p.push(...A.slice(0,$)),L&&m.push(...L.slice(0,$)),h+=j}p.push(a);const g=[...r,...p];if(o){const v=new He("int64",g.map(BigInt),[1,g.length]),_=[...new Array(r.length).fill(0),...m,0],b=new He("float32",new Float32Array(_),[1,_.length]);return{sequences:v,token_timestamps:b}}return new He("int64",g.map(BigInt),[1,g.length])}_extract_token_timestamps(t,e,n=null,r=.02,i=0){if(!t.cross_attentions)throw new Error("Model outputs must contain cross attentions to extract timestamps. This is most likely because the model was not exported with `output_attentions=True`.");n==null&&en.warn("`num_frames` has not been set, meaning the entire audio will be analyzed. This may lead to inaccurate token-level timestamps for short audios (< 30 seconds).");let s=this.config.median_filter_width;s===void 0&&(en.warn("Model config has no `median_filter_width`, using default value of 7."),s=7);const a=t.cross_attentions,o=Array.from({length:this.config.decoder_layers},(g,v)=>Lr(a.map(_=>_[v]),2)),l=gd(e.map(([g,v])=>{if(g>=o.length)throw new Error(`Layer index ${g} is out of bounds for cross attentions (length ${o.length}).`);return n?o[g].slice(null,v,null,[0,n]):o[g].slice(null,v)})).transpose(1,0,2,3),[c,u]=c2e(l,-2,0,!0),d=l.clone();for(let g=0;g<d.dims[0];++g){const v=d[g];for(let _=0;_<v.dims[0];++_){const b=v[_],x=c[g][_][0].data,T=u[g][_][0].data;for(let N=0;N<b.dims[0];++N){let A=b[N].data;for(let L=0;L<A.length;++L)A[L]=(A[L]-T[L])/x[L];A.set(Wbe(A,s))}}}const f=i>0?d.slice(null,null,[i,d.dims[2]],null):d,h=[DI(f,1)],p=t.sequences.dims,m=new He("float32",new Float32Array(p[0]*p[1]),p);for(let g=0;g<p[0];++g){const v=h[g].neg().squeeze_(0),[_,b]=Hbe(v.tolist()),x=Array.from({length:_.length-1},(L,M)=>_[M+1]-_[M]),T=Hc([1],x).map(L=>!!L),N=[];for(let L=0;L<T.length;++L)T[L]&&N.push(b[L]*r);const A=new Array(i).fill(0);A.push(...N),N.length>0&&A.push(N.at(-1)),m[g].data.set(A)}return m}},MNe=class extends iX{},C0=class extends ye{},NNe=class extends C0{},RNe=class extends C0{async _call(t){return new Yi(await super._call(t))}},INe=class extends C0{async _call(t){return new Vt(await super._call(t))}},LNe=class extends C0{async _call(t){return new ji(await super._call(t))}},ONe=class extends C0{async _call(t){return new ra(await super._call(t))}},E0=class extends ye{}
534,DNe=class extends E0{},FNe=class extends E0{async _call(t){return new Yi(await super._call(t))}},jNe=class extends E0{async _call(t){return new Vt(await super._call(t))}},BNe=class extends E0{async _call(t){return new ji(await super._call(t))}},UNe=class extends E0{async _call(t){return new ra(await super._call(t))}},Q4=class extends ye{},zNe=class extends Q4{},$Ne=class extends Q4{async _call(t){return new sX(await super._call(t))}},sX=class extends Ji{constructor({logits:t,pred_boxes:e}){super(),this.logits=t,this.pred_boxes=e}},Z4=class extends ye{},VNe=class extends Z4{},qNe=class extends Z4{},WNe=new Map([["bert","BertModel"],["eurobert","EuroBertModel"],["neobert","NeoBertModel"],["modernbert","ModernBertModel"],["nomic_bert","NomicBertModel"],["roformer","RoFormerModel"],["electra","ElectraModel"],["esm","EsmModel"],["convbert","ConvBertModel"],["camembert","CamembertModel"],["deberta","DebertaModel"],["deberta-v2","DebertaV2Model"],["mpnet","MPNetModel"],["albert","AlbertModel"],["distilbert","DistilBertModel"],["roberta","RobertaModel"],["xlm","XLMModel"],["xlm-roberta","XLMRobertaModel"],["clap","ClapModel"],["clip","CLIPModel"],["clipseg","CLIPSegModel"],["chinese_clip","ChineseCLIPModel"],["siglip","SiglipModel"],["jina_clip","JinaCLIPModel"],["mobilebert","MobileBertModel"],["squeezebert","SqueezeBertModel"],["wav2vec2","Wav2Vec2Model"],["wav2vec2-bert","Wav2Vec2BertModel"],["unispeech","UniSpeechModel"],["unispeech-sat","UniSpeechSatModel"],["hubert","HubertModel"],["wavlm","WavLMModel"],["audio-spectrogram-transformer","ASTModel"],["vits","VitsModel"],["pyannote","PyAnnoteModel"],["wespeaker-resnet","WeSpeakerResNetModel"],["detr","DetrModel"],["rt_detr","RTDetrModel"],["rt_detr_v2","RTDetrV2Model"],["rf_detr","RFDetrModel"],["d_fine","DFineModel"],["table-transformer","TableTransformerModel"],["vit","ViTModel"],["ijepa","IJepaModel"],["pvt","PvtModel"],["vit_msn","ViTMSNModel"],["vit_mae","ViTMAEModel"],["groupvit","GroupViTModel"],["fastvit","FastViTModel"],["mobilevit","MobileViTModel"],["mobilevitv2","MobileViTV2Model"],["owlvit","OwlViTModel"],["owlv2","Owlv2Model"],["beit","BeitModel"],["deit","DeiTModel"],["hiera","HieraModel"],["convnext","ConvNextModel"],["convnextv2","ConvNextV2Model"],["dinov2","Dinov2Model"],["dinov2_with_registers","Dinov2WithRegistersModel"],["dinov3_vit","DINOv3ViTModel"],["dinov3_convnext","DINOv3ConvNextModel"],["resnet","ResNetModel"],["swin","SwinModel"],["swin2sr","Swin2SRModel"],["donut-swin","DonutSwinModel"],["yolos","YolosModel"],["dpt","DPTModel"],["glpn","GLPNModel"],["hifigan","SpeechT5HifiGan"],["efficientnet","EfficientNetModel"],["decision_transformer","DecisionTransformerModel"],["patchtst","PatchTSTModel"],["patchtsmixer","PatchTSMixerModel"],["mobilenet_v1","MobileNetV1Model"],["mobilenet_v2","MobileNetV2Model"],["mobilenet_v3","MobileNetV3Model"],["mobilenet_v4","MobileNetV4Model"],["maskformer","MaskFormerModel"],["mgp-str","MgpstrForSceneTextRecognition"],["style_text_to_speech_2","StyleTextToSpeech2Model"],["openai_privacy_filter","OpenAIPrivacyFilterModel"]]),GNe=new Map([["t5","T5Model"],["longt5","LongT5Model"],["mt5","MT5Model"],["bart","BartModel"],["mbart","MBartModel"],["marian","MarianModel"],["whisper","WhisperModel"],["cohere_asr","CohereAsrModel"],["m2m_100","M2M100Model"],["blenderbot","BlenderbotModel"],["blenderbot-small","BlenderbotSmallModel"]]),HNe=new Map([["mimi","MimiModel"],["dac","DacModel"],["snac","SnacModel"]]),KNe=new Map([["bloom","BloomModel"],["jais","JAISModel"],["gpt2","GPT2Model"],["gpt_oss","GptOssModel"],["gptj","GPTJModel"],["gpt_bigcode","GPTBigCodeModel"],["gpt_neo","GPTNeoModel"],["gpt_neox","GPTNeoXModel"],["codegen","CodeGenModel"],["llama","LlamaModel"],["apertus","ApertusModel"],["nanochat","NanoChatModel"],["arcee","ArceeModel"],["afmoe","AfmoeModel"],["lfm2","Lfm2Model"],["lfm2_moe","Lfm2MoeModel"],["smollm3","SmolLM3Model"],["exaone","ExaoneModel"],["olmo","OlmoModel"],["olmo2","Olmo2Model"],["olmo3","Olmo3Model"],["olmo_hybrid","OlmoHybridModel"],["mobilellm","MobileLLMModel"],["granite","GraniteModel"],["granitemoehybrid","GraniteMoeHybridModel"],["cohere","CohereModel"],["cohere2","Cohere2Model"],["gemma","GemmaModel"],["gemma2","Gemma2Model"],["vaultgemma","VaultGemmaModel"],["gemma3_text","Gemma3Model"],["helium","HeliumModel"],["glm","GlmModel"],["glm_moe_dsa","GlmMoeDsaModel"],["openelm","OpenELMModel"],["qwen2","Qwen2Model"],["qwen2_moe","Qwen2MoeModel"],["qwen3","Qwen3Model"],["qwen3_moe","Qwen3MoeModel"],["qwen3_next","Qwen3NextModel"],["phi","PhiModel"],["phi3","Phi3Model"],["mpt","MptModel"],["opt","OPTModel"],["mistral","MistralModel"],["mistral4","Mistral4Model"],["ministral","MinistralModel"],["ministral3","Ministral3Model"],["ernie4_5","Ernie4_5ForCausalLM"],["starcoder2","Starco
534der2Model"],["deepseek_v3","DeepseekV3Model"],["falcon","FalconModel"],["falcon_h1","FalconH1Model"],["nemotron_h","NemotronHModel"],["solar_open","SolarOpenModel"],["stablelm","StableLmModel"],["modernbert-decoder","ModernBertDecoderModel"],["hunyuan_v1_dense","HunYuanDenseV1Model"],["youtu","YoutuModel"]]),aX=new Map([["speecht5","SpeechT5ForSpeechToText"],["whisper","WhisperForConditionalGeneration"],["lite-whisper","LiteWhisperForConditionalGeneration"],["moonshine","MoonshineForConditionalGeneration"],["cohere_asr","CohereAsrForConditionalGeneration"]]),oX=new Map([["speecht5","SpeechT5ForTextToSpeech"]]),lX=new Map([["vits","VitsModel"],["musicgen","MusicgenForConditionalGeneration"],["supertonic","SupertonicForConditionalGeneration"]]),cX=new Map([["bert","BertForSequenceClassification"],["eurobert","EuroBertForSequenceClassification"],["neobert","NeoBertForSequenceClassification"],["modernbert","ModernBertForSequenceClassification"],["roformer","RoFormerForSequenceClassification"],["electra","ElectraForSequenceClassification"],["esm","EsmForSequenceClassification"],["convbert","ConvBertForSequenceClassification"],["camembert","CamembertForSequenceClassification"],["deberta","DebertaForSequenceClassification"],["deberta-v2","DebertaV2ForSequenceClassification"],["mpnet","MPNetForSequenceClassification"],["albert","AlbertForSequenceClassification"],["distilbert","DistilBertForSequenceClassification"],["roberta","RobertaForSequenceClassification"],["xlm","XLMForSequenceClassification"],["xlm-roberta","XLMRobertaForSequenceClassification"],["bart","BartForSequenceClassification"],["mbart","MBartForSequenceClassification"],["mobilebert","MobileBertForSequenceClassification"],["squeezebert","SqueezeBertForSequenceClassification"]]),uX=new Map([["bert","BertForTokenClassification"],["eurobert","EuroBertForTokenClassification"],["neobert","NeoBertForTokenClassification"],["modernbert","ModernBertForTokenClassification"],["roformer","RoFormerForTokenClassification"],["electra","ElectraForTokenClassification"],["esm","EsmForTokenClassification"],["convbert","ConvBertForTokenClassification"],["camembert","CamembertForTokenClassification"],["deberta","DebertaForTokenClassification"],["deberta-v2","DebertaV2ForTokenClassification"],["mpnet","MPNetForTokenClassification"],["distilbert","DistilBertForTokenClassification"],["roberta","RobertaForTokenClassification"],["xlm","XLMForTokenClassification"],["xlm-roberta","XLMRobertaForTokenClassification"],["openai_privacy_filter","OpenAIPrivacyFilterForTokenClassification"]]),dX=new Map([["t5","T5ForConditionalGeneration"],["longt5","LongT5ForConditionalGeneration"],["mt5","MT5ForConditionalGeneration"],["bart","BartForConditionalGeneration"],["mbart","MBartForConditionalGeneration"],["marian","MarianMTModel"],["m2m_100","M2M100ForConditionalGeneration"],["blenderbot","BlenderbotForConditionalGeneration"],["blenderbot-small","BlenderbotSmallForConditionalGeneration"]]),hX=new Map([["bloom","BloomForCausalLM"],["gpt2","GPT2LMHeadModel"],["gpt_oss","GptOssForCausalLM"],["jais","JAISLMHeadModel"],["gptj","GPTJForCausalLM"],["gpt_bigcode","GPTBigCodeForCausalLM"],["gpt_neo","GPTNeoForCausalLM"],["gpt_neox","GPTNeoXForCausalLM"],["codegen","CodeGenForCausalLM"],["llama","LlamaForCausalLM"],["nanochat","NanoChatForCausalLM"],["apertus","ApertusForCausalLM"],["llama4_text","Llama4ForCausalLM"],["arcee","ArceeForCausalLM"],["afmoe","AfmoeForCausalLM"],["lfm2","Lfm2ForCausalLM"],["lfm2_moe","Lfm2MoeForCausalLM"],["smollm3","SmolLM3ForCausalLM"],["exaone","ExaoneForCausalLM"],["olmo","OlmoForCausalLM"],["olmo2","Olmo2ForCausalLM"],["olmo3","Olmo3ForCausalLM"],["olmo_hybrid","OlmoHybridForCausalLM"],["mobilellm","MobileLLMForCausalLM"],["granite","GraniteForCausalLM"],["granitemoehybrid","GraniteMoeHybridForCausalLM"],["cohere","CohereForCausalLM"],["cohere2","Cohere2ForCausalLM"],["gemma","GemmaForCausalLM"],["gemma2","Gemma2ForCausalLM"],["vaultgemma","VaultGemmaForCausalLM"],["gemma3_text","Gemma3ForCausalLM"],["gemma3","Gemma3ForCausalLM"],["helium","HeliumForCausalLM"],["glm","GlmForCausalLM"],["glm_moe_dsa","GlmMoeDsaForCausalLM"],["openelm","OpenELMForCausalLM"],["qwen2","Qwen2ForCausalLM"],["qwen2_moe","Qwen2MoeForCausalLM"],["qwen3","Qwen3ForCausalLM"],["qwen3_moe","Qwen3MoeForCausalLM"],["qwen3_next","Qwen3NextForCausalLM"],["qwen2_vl","Qwen2VLForCausalLM"],["qwen2_5_vl","Qwen2_5_VLForCausalLM"],["qwen3_vl","Qwen3VLForCausalLM"],["qwen3_vl_moe","Qwen3VLMoeForCausalLM"],["qwen3_5","Qwen3_5ForCausalLM"],["qwen3_5_text","Qwen3_5ForCausalLM"],["qwen3_5_moe","Qwen3_5MoeForCausalLM"],["gemma3n","Gemma3nForCausalLM"],["gemma4","Gemma4ForCausalLM"],["phi","PhiForCausalLM"],["phi3","Phi3ForCausalLM"],["mpt","MptForCausalLM"],["opt","OPTForCausalLM"],["mbart","MBartForCausalLM"],["mistral","MistralForCausalLM"],["mistral4","Mistral4ForCausalLM"],["ministral","MinistralForCausalLM"],["ministral3","Ministral3ForCausalLM"],["ernie4_5","Ernie4_5ForCausalLM"],["starcoder2","Starco
534der2ForCausalLM"],["deepseek_v3","DeepseekV3ForCausalLM"],["falcon","FalconForCausalLM"],["falcon_h1","FalconH1ForCausalLM"],["nemotron_h","NemotronHForCausalLM"],["trocr","TrOCRForCausalLM"],["solar_open","SolarOpenForCausalLM"],["stablelm","StableLmForCausalLM"],["modernbert-decoder","ModernBertDecoderForCausalLM"],["hunyuan_v1_dense","HunYuanDenseV1ForCausalLM"],["youtu","YoutuForCausalLM"],["phi3_v","Phi3VForCausalLM"]]),JNe=new Map([["multi_modality","MultiModalityCausalLM"]]),fX=new Map([["bert","BertForMaskedLM"],["eurobert","EuroBertForMaskedLM"],["neobert","NeoBertForMaskedLM"],["modernbert","ModernBertForMaskedLM"],["roformer","RoFormerForMaskedLM"],["electra","ElectraForMaskedLM"],["esm","EsmForMaskedLM"],["convbert","ConvBertForMaskedLM"],["camembert","CamembertForMaskedLM"],["deberta","DebertaForMaskedLM"],["deberta-v2","DebertaV2ForMaskedLM"],["mpnet","MPNetForMaskedLM"],["albert","AlbertForMaskedLM"],["distilbert","DistilBertForMaskedLM"],["roberta","RobertaForMaskedLM"],["xlm","XLMWithLMHeadModel"],["xlm-roberta","XLMRobertaForMaskedLM"],["mobilebert","MobileBertForMaskedLM"],["squeezebert","SqueezeBertForMaskedLM"]]),pX=new Map([["bert","BertForQuestionAnswering"],["neobert","NeoBertForQuestionAnswering"],["roformer","RoFormerForQuestionAnswering"],["electra","ElectraForQuestionAnswering"],["convbert","ConvBertForQuestionAnswering"],["camembert","CamembertForQuestionAnswering"],["deberta","DebertaForQuestionAnswering"],["deberta-v2","DebertaV2ForQuestionAnswering"],["mpnet","MPNetForQuestionAnswering"],["albert","AlbertForQuestionAnswering"],["distilbert","DistilBertForQuestionAnswering"],["roberta","RobertaForQuestionAnswering"],["xlm","XLMForQuestionAnswering"],["xlm-roberta","XLMRobertaForQuestionAnswering"],["mobilebert","MobileBertForQuestionAnswering"],["squeezebert","SqueezeBertForQuestionAnswering"]]),mX=new Map([["vision-encoder-decoder","VisionEncoderDecoderModel"],["idefics3","Idefics3ForConditionalGeneration"],["smolvlm","SmolVLMForConditionalGeneration"]]),gX=new Map([["llava","LlavaForConditionalGeneration"],["llava_onevision","LlavaOnevisionForConditionalGeneration"],["moondream1","Moondream1ForConditionalGeneration"],["florence2","Florence2ForConditionalGeneration"],["qwen2_vl","Qwen2VLForConditionalGeneration"],["qwen2_5_vl","Qwen2_5_VLForConditionalGeneration"],["qwen3_vl","Qwen3VLForConditionalGeneration"],["qwen3_vl_moe","Qwen3VLMoeForConditionalGeneration"],["qwen3_5","Qwen3_5ForConditionalGeneration"],["qwen3_5_moe","Qwen3_5MoeForConditionalGeneration"],["lfm2_vl","Lfm2VlForConditionalGeneration"],["idefics3","Idefics3ForConditionalGeneration"],["smolvlm","SmolVLMForConditionalGeneration"],["paligemma","PaliGemmaForConditionalGeneration"],["llava_qwen2","LlavaQwen2ForCausalLM"],["gemma3","Gemma3ForConditionalGeneration"],["gemma3n","Gemma3nForConditionalGeneration"],["gemma4","Gemma4ForConditionalGeneration"],["mistral3","Mistral3ForConditionalGeneration"],["lighton_ocr","LightOnOcrForConditionalGeneration"],["glm_ocr","GlmOcrForConditionalGeneration"]]),vX=new Map([["granite_speech","GraniteSpeechForConditionalGeneration"],["ultravox","UltravoxModel"],["voxtral","VoxtralForConditionalGeneration"],["voxtral_realtime","VoxtralRealtimeForConditionalGeneration"]]),YNe=new Map([["vision-encoder-decoder","VisionEncoderDecoderModel"]]),yX=new Map([["vit","ViTForImageClassification"],["ijepa","IJepaForImageClassification"],["pvt","PvtForImageClassification"],["vit_msn","ViTMSNForImageClassification"],["fastvit","FastViTForImageClassification"],["mobilevit","MobileViTForImageClassification"],["mobilevitv2","MobileViTV2ForImageClassification"],["beit","BeitForImageClassification"],["deit","DeiTForImageClassification"],["hiera","HieraForImageClassification"],["convnext","ConvNextForImageClassification"],["convnextv2","ConvNextV2ForImageClassification"],["dinov2","Dinov2ForImageClassification"],["dinov2_with_registers","Dinov2WithRegistersForImageClassification"],["resnet","ResNetForImageClassification"],["swin","SwinForImageClassification"],["segformer","SegformerForImageClassification"],["efficie
534ntnet","EfficientNetForImageClassification"],["mobilenet_v1","MobileNetV1ForImageClassification"],["mobilenet_v2","MobileNetV2ForImageClassification"],["mobilenet_v3","MobileNetV3ForImageClassification"],["mobilenet_v4","MobileNetV4ForImageClassification"]]),_X=new Map([["detr","DetrForObjectDetection"],["rt_detr","RTDetrForObjectDetection"],["rt_detr_v2","RTDetrV2ForObjectDetection"],["rf_detr","RFDetrForObjectDetection"],["d_fine","DFineForObjectDetection"],["table-transformer","TableTransformerForObjectDetection"],["yolos","YolosForObjectDetection"]]),wX=new Map([["owlvit","OwlViTForObjectDetection"],["owlv2","Owlv2ForObjectDetection"],["grounding-dino","GroundingDinoForObjectDetection"]]),Fg=new Map([["detr","DetrForSegmentation"],["clipseg","CLIPSegForImageSegmentation"]]),bX=new Map([["segformer","SegformerForSemanticSegmentation"],["sapiens","SapiensForSemanticSegmentation"],["swin","SwinForSemanticSegmentation"],["mobilenet_v1","MobileNetV1ForSemanticSegmentation"],["mobilenet_v2","MobileNetV2ForSemanticSegmentation"],["mobilenet_v3","MobileNetV3ForSemanticSegmentation"],["mobilenet_v4","MobileNetV4ForSemanticSegmentation"]]),xX=new Map([["detr","DetrForSegmentation"],["maskformer","MaskFormerForInstanceSegmentation"]]),kX=new Map([["sam","SamModel"],["sam2","Sam2Model"],["edgetam","EdgeTamModel"],["sam3_tracker","Sam3TrackerModel"]]),SX=new Map([["wav2vec2","Wav2Vec2ForCTC"],["wav2vec2-bert","Wav2Vec2BertForCTC"],["unispeech","UniSpeechForCTC"],["unispeech-sat","UniSpeechSatForCTC"],["wavlm","WavLMForCTC"],["hubert","HubertForCTC"],["parakeet_ctc","ParakeetForCTC"]]),TX=new Map([["wav2vec2","Wav2Vec2ForSequenceClassification"],["wav2vec2-bert","Wav2Vec2BertForSequenceClassification"],["unispeech","UniSpeechForSequenceClassification"],["unispeech-sat","UniSpeechSatForSequenceClassification"],["wavlm","WavLMForSequenceClassification"],["hubert","HubertForSequenceClassification"],["audio-spectrogram-transformer","ASTForAudioClassification"]]),CX=new Map([["wavlm","WavLMForXVector"]]),EX=new Map([["unispeech-sat","UniSpeechSatForAudioFrameClassification"],["wavlm","WavLMForAudioFrameClassification"],["wav2vec2","Wav2Vec2ForAudioFrameClassification"],["pyannote","PyAnnoteForAudioFrameClassification"]]),AX=new Map([["vitmatte","VitMatteForImageMatting"]]),XNe=new Map([["patchtst","PatchTSTForPrediction"],["patchtsmixer","PatchTSMixerForPrediction"]]),PX=new Map([["swin2sr","Swin2SRForImageSuperResolution"]]),MX=new Map([["chmv2","CHMv2ForDepthEstimation"],["dpt","DPTForDepthEstimation"],["depth_anything","DepthAnythingForDepthEstimation"],["glpn","GLPNForDepthEstimation"],["sapiens","SapiensForDepthEstimation"],["depth_pro","DepthProForDepthEstimation"],["metric3d","Metric3DForDepthEstimation"],["metric3dv2","Metric3Dv2ForDepthEstimation"]]),NX=new Map([["sapiens","SapiensForNormalEstimation"]]),RX=new Map([["vitpose","VitPoseForPoseEstimation"]]),IX=new Map([["clip","CLIPVisionModelWithProjection"],["siglip","SiglipVisionModel"],["jina_clip","JinaCLIPVisionModel"]]),LX=[[WNe,Xe.EncoderOnly],[GNe,Xe.EncoderDecoder],[KNe,Xe.DecoderOnlyWithoutHead],[HNe,Xe.AutoEncoder],[cX,Xe.EncoderOnly],[uX,Xe.EncoderOnly],[dX,Xe.Seq2Seq],[aX,Xe.Seq2Seq],[hX,Xe.DecoderOnly],[JNe,Xe.MultiModality],[fX,Xe.EncoderOnly],[pX,Xe.EncoderOnly],[mX,Xe.Vision2Seq],[gX,Xe.ImageTextToText],[vX,Xe.AudioTextToText],[yX,Xe.EncoderOnly],[Fg,Xe.EncoderOnly],[xX,Xe.EncoderOnly],[bX,Xe.EncoderOnly],[AX,Xe.EncoderOnly],[XNe,Xe.EncoderOnly],[PX,Xe.EncoderOnly],[MX,Xe.EncoderOnly],[NX,Xe.EncoderOnly],[RX,Xe.EncoderOnly],[_X,Xe.EncoderOnly],[wX,Xe.EncoderOnly],[kX,Xe.MaskGeneration],[SX,Xe.EncoderOnly],[TX,Xe.EncoderOnly],[oX,Xe.Seq2Seq],[lX,Xe.EncoderOnly],[CX,Xe.EncoderOnly],[EX,Xe.EncoderOnly],[IX,Xe.EncoderOnly]];for(const[t,e]of LX)for(const n of t.values()){ld.set(n,e);const r=XI[n];ev.set(r,n),KI.set(n,r)}var QNe=[["MusicgenForConditionalGeneration",AY,Xe.Musicgen],["Phi3VForCausalLM",RY,Xe.Phi3V],["CLIPTextModelWithProjection",HJ,Xe.EncoderOnly],["SiglipTextModel",zY,Xe.EncoderOnly],["JinaCLIPTextModel",vY,Xe.EncoderOnly],["ClapTextModelWithProjection",WJ,Xe.EncoderOnly],["ClapAudioModelWithProjection",GJ,Xe.EncoderOnly],["DacEncoderModel",YJ,Xe.EncoderOnly],["DacDecoderModel",XJ,Xe.EncoderOnly],["MimiEncoderModel",TY,Xe.EncoderOnly],["MimiDecoderModel",CY,Xe.EncoderOnly],["SnacEncoderModel",$Y,Xe.EncoderOnly],["SnacDecoderModel",VY,Xe.EncoderOnly],["Gemma3nForConditionalGeneration",RT,Xe.ImageAudioTextToText],["Gemma4ForConditionalGeneration",PL,Xe.ImageAudioTextToText],["SupertonicForConditionalGeneration",GY,Xe.Supertonic],["ChatterboxModel",$J,Xe.Chatterbox],["VoxtralRealtimeForConditionalGeneration",tX,Xe.VoxtralRealtime]];for(const[t,e,n]of QNe)ld.set(t,n),ev.set(e,t),KI.set(t,e);var OX=new Map([["modnet",Fg],["birefnet",Fg],["isnet",Fg],["ben",Fg]]);for(const[t,e]of OX.entries())e.set(t,"PreTrainedModel"),ld.set(t,Xe.EncoderOnly),KI.set(t,ye);var ZNe=new Set(OX.keys());ld.set("PreTrainedModel",Xe.EncoderOnly);ev.set(ye,"PreTrainedModel");var Xn={MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING_NAMES:cX,MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING_NAMES:uX,MODEL_FOR_TEXT_TO_SPECTROGRAM_MAPPING_NAMES:oX,MODEL_FOR_TEXT_TO_WAVEFORM_MAPPING_NAMES:lX,MODEL_FOR_MASKED_LM_MAPPING_NAMES:fX,MODEL_FOR_QUESTION_ANSWERING_MAPPING_NAMES:pX,MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING_NAMES:yX,MODEL_FOR_IMAGE_SEGMENTATION_MAPPING_NAMES:Fg,MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPING_NAMES:bX,MODEL_FOR_UNIVERSAL_SEGMENTATION_MAPPING_NAMES:xX,MODEL_FOR_OBJECT_DETECTION_MAPPING_NAMES:_X,MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING_NAMES:wX,MODEL_FOR_MASK_GENERATION_MAPPING_NAMES:kX,MODEL_FOR_CTC_MAPPING_NAMES:SX,MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING_NAMES:TX,MODEL_FOR_AUDIO_XVECTOR_MAPPING_NAMES:CX,MODEL_FOR_AUDIO_FRAME_CLASSIFICATION_MAPPING_NAMES:EX,MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING_NAMES:YNe,MODEL_FOR_IMAGE_MATTING_MAPPING_NAMES:AX,MODEL_FOR_IMAGE_TO_IMAGE_MAPPING_NAMES:PX,MODEL_FOR_DEPTH_ESTIMATION_MAPPING_NAMES:MX,MODEL_FOR_NORMAL_ESTIMATION_MAPPING_NAMES:NX,MODEL_FOR_POSE_ESTIMATION_MAPPING_NAMES:RX,MODEL_FOR_IMAGE_FEATURE_EXTRACTION_MAPPING_NAMES:IX,MODEL_FOR_IMAGE_TEXT_TO_TEXT_MAPPING_NAMES:gX,MODEL_FOR_AUDIO_TEXT_TO_TEXT_MAPPING_NAMES:vX,MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING_NAMES:dX,MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING_NAMES:aX,MODEL_FOR_CAUSAL_LM_MAPPING_NAMES:hX,MODEL_FOR_VISION_2_SEQ_MAPPING_NAMES:mX};tTe(Xn);
534var $2,Qn=($2=class{static supports(t){if(!this.MODEL_CLASS_MAPPINGS)return!1;for(const e of this.MODEL_CLASS_MAPPINGS)if(e.has(t))return!0;return this.BASE_IF_FAIL}static async from_pretrained(t,{progress_callback:e=null,config:n=null,cache_dir:r=null,local_files_only:i=!1,revision:s="main",model_file_name:a=null,subfolder:o="onnx",device:l=null,dtype:c=null,use_external_data_format:u=null,session_options:d={}}={}){const f={progress_callback:e,config:n,cache_dir:r,local_files_only:i,revision:s,model_file_name:a,subfolder:o,device:l,dtype:c,use_external_data_format:u,session_options:d};if(f.config=await Pw.from_pretrained(t,f),!this.MODEL_CLASS_MAPPINGS)throw new Error("`MODEL_CLASS_MAPPINGS` not implemented for this type of `AutoClass`: "+this.name);const{model_type:h}=f.config;for(const p of this.MODEL_CLASS_MAPPINGS){let m=p.get(h);if(!m){for(const g of p.values())if(g[0]===h){m=g;break}if(!m)continue}return await XI[m].from_pretrained(t,f)}if(this.BASE_IF_FAIL)return ZNe.has(h)||en.warn(`Unknown model class "${h}", attempting to construct from base class.`),await ye.from_pretrained(t,f);throw Error(`Unsupported model type: ${h}`)}},X($2,"MODEL_CLASS_MAPPINGS",null),X($2,"BASE_IF_FAIL",!1),$2),V2,r_=(V2=class extends Qn{},X(V2,"MODEL_CLASS_MAPPINGS",LX.map(t=>t[0])),X(V2,"BASE_IF_FAIL",!0),V2),mA,wB=(mA=class extends Qn{},X(mA,"MODEL_CLASS_MAPPINGS",[Xn.MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING_NAMES]),mA),gA,e3e=(gA=class extends Qn{},X(gA,"MODEL_CLASS_MAPPINGS",[Xn.MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING_NAMES]),gA),vA,eE=(vA=class extends Qn{},X(vA,"MODEL_CLASS_MAPPINGS",[Xn.MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING_NAMES]),vA),yA,t3e=(yA=class extends Qn{},X(yA,"MODEL_CLASS_MAPPINGS",[Xn.MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING_NAMES]),yA),_A,n3e=(_A=class extends Qn{},X(_A,"MODEL_CLASS_MAPPINGS",[Xn.MODEL_FOR_TEXT_TO_SPECTROGRAM_MAPPING_NAMES]),_A),wA,r3e=(wA=class extends Qn{},X(wA,"MODEL_CLASS_MAPPINGS",[Xn.MODEL_FOR_TEXT_TO_WAVEFORM_MAPPING_NAMES]),wA),bA,i3e=(bA=class extends Qn{},X(bA,"MODEL_CLASS_MAPPINGS",[Xn.MODEL_FOR_CAUSAL_LM_MAPPING_NAMES]),bA),xA,s3e=(xA=class extends Qn{},X(xA,"MODEL_CLASS_MAPPINGS",[Xn.MODEL_FOR_MASKED_LM_MAPPING_NAMES]),xA),kA,a3e=(kA=class extends Qn{},X(kA,"MODEL_CLASS_MAPPINGS",[Xn.MODEL_FOR_QUESTION_ANSWERING_MAPPING_NAMES]),kA),SA,o3e=(SA=class extends Qn{},X(SA,"MODEL_CLASS_MAPPINGS",[Xn.MODEL_FOR_VISION_2_SEQ_MAPPING_NAMES]),SA),TA,l3e=(TA=class extends Qn{},X(TA,"MODEL_CLASS_MAPPINGS",[Xn.MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING_NAMES]),TA),CA,bB=(CA=class extends Qn{},X(CA,"MODEL_CLASS_MAPPINGS",[Xn.MODEL_FOR_IMAGE_SEGMENTATION_MAPPING_NAMES]),CA),EA,xB=(EA=class extends Qn{},X(EA,"MODEL_CLASS_MAPPINGS",[Xn.MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPING_NAMES]),EA),AA,kB=(AA=class extends Qn{},X(AA,"MODEL_CLASS_MAPPINGS",[Xn.MODEL_FOR_UNIVERSAL_SEGMENTATION_MAPPING_NAMES]),AA),PA,c3e=(PA=class extends Qn{},X(PA,"MODEL_CLASS_MAPPINGS",[Xn.MODEL_FOR_OBJECT_DETECTION_MAPPING_NAMES]),PA),MA,u3e=(MA=class extends Qn{},X(MA,"MODEL_CLASS_MAPPINGS",[Xn.MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING_NAMES]),MA),NA;NA=class extends Qn{},X(NA,"MODEL_CLASS_MAPPINGS",[Xn.MODEL_FOR_MASK_GENERATION_MAPPING_NAMES]);var RA,d3e=(RA=class extends Qn{},X(RA,"MODEL_CLASS_MAPPINGS",[Xn.MODEL_FOR_CTC_MAPPING_NAMES]),RA),IA,h3e=(IA=class extends Qn{},X(IA,"MODEL_CLASS_MAPPINGS",[Xn.MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING_NAMES]),IA),LA;LA=class extends Qn{},X(LA,"MODEL_CLASS_MAPPINGS",[Xn.MODEL_FOR_AUDIO_XVECTOR_MAPPING_NAMES]);var OA;OA=class extends Qn{},X(OA,"MODEL_CLASS_MAPPINGS",[Xn.MODEL_FOR_AUDIO_FRAME_CLASSIFICATION_MAPPING_NAMES]);var DA,f3e=(DA=class extends Qn{},X(DA,"MODEL_CLASS_MAPPINGS",[Xn.MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING_NAMES]),DA),FA;FA=class extends Qn{},X(FA,"MODEL_CLASS_MAPPINGS",[Xn.MODEL_FOR_IMAGE_MATTING_MAPPING_NAMES]);var jA,p3e=(jA=class extends Qn{},X(jA,"MODEL_CLASS_MAPPINGS",[Xn.MODEL_FOR_IMAGE_TO_IMAGE_MAPPING_NAMES]),jA),BA,m3e=(BA=class extends Qn{},X(BA,"MODEL_CLASS_MAPPINGS",[Xn.MODEL_FOR_DEPTH_ESTIMATION_MAPPING_NAMES]),BA),UA;UA=class extends Qn{},X(UA,"MODEL_CLASS_MAPPINGS",[Xn.MODEL_FOR_NORMAL_ESTIMATION_MAPPING_NAMES]);var zA;zA=class extends Qn{},X(zA,"MODEL_CLASS_MAPPINGS",[Xn.MODEL_FOR_POSE_ESTIMATION_MAPPING_NAMES]);var $A,g3e=($A=class extends Qn{},X($A,"MODEL_CLASS_MAPPINGS",[Xn.MODEL_FOR_IMAGE_FEATURE_EXTRACTION_MAPPING_NAMES]),$A),VA;VA=class extends Qn{},X(VA,"MODEL_CLASS_MAPPINGS",[Xn.MODEL_FOR_IMAGE_TEXT_TO_TEXT_MAPPING_NAMES]);var qA;qA=class extends Qn{},X(qA,"MODEL_CLASS_MAPPINGS",[Xn.MODEL_FOR_AUDIO_TEXT_TO_TEXT_MAPPING_NAMES]);async function dc(t){return Array.isArray(t)||(t=[t]),await Promise.all(t.map(e=>nc.read(e)))}async function jg(t,e){return Array.isArray(t)||(t=[t]),await Promise.all(t.map(n=>typeof n=="string"||n instanceof URL?pxe(n,e):n instanceof Float64Array?new Float32Array(n):n))}function oN(t,e){e&&(t=t.map(a=>a|0));const[n,r,i,s]=t;return{xmin:n,ymin:r,xmax:i,ymax:s}}var yi=class extends Qa{constructor({task:t,model:e,tokenizer:n=null,processor:r=null}){super(),this.task=t,this.model=e,this.tokenizer=n,this.processor=r}async dispose(){await this.model.dispose()}},v3e=class extends yi{async _call(t,{top_k:e=1}={}){const n=this.tokenizer(t,{padding:!0,truncation:!0}
534),r=await this.model(n),{problem_type:i,id2label:s}=this.model.config,a=i==="multi_label_classification"?l=>l.sigmoid():l=>new He("float32",Ms(l.data),l.dims),o=[];for(const l of r.logits){const c=a(l),u=await f0(c,e),d=u[0].tolist(),h=u[1].tolist().map((p,m)=>({label:s?s[p]:`LABEL_${p}`,score:d[m]}));e===1?o.push(...h):o.push(h)}return Array.isArray(t)||e===1?o:o[0]}},y3e=class extends yi{async _call(t,{ignore_labels:e=["O"],aggregation_strategy:n="none"}={}){if(n!=="none"&&n!=="simple")throw new Error(`Invalid aggregation_strategy: "${n}". Must be one of "none" or "simple".`);const r=Array.isArray(t),i=this.tokenizer(r?t:[t],{padding:!0,truncation:!0}),a=(await this.model(i)).logits,o=this.model.config.id2label,l=[];for(let c=0;c<a.dims[0];++c){const u=i.input_ids[c].tolist(),d=a[c],f=[];for(let h=0;h<d.dims[0];++h){const p=d[h],m=Pi(p.data)[1],g=o?o[m]:`LABEL_${m}`;if(e.includes(g))continue;const v=this.tokenizer.decode([u[h]],{skip_special_tokens:!0});if(v==="")continue;const _=Ms(p.data);f.push({entity:g,score:_[m],index:h,word:v})}l.push(n==="simple"?w3e(f,u,this.tokenizer):f)}return r?l:l[0]}};function _3e(t){const e=t[0];return t[1]==="-"&&(e==="B"||e==="I"||e==="E"||e==="S")?[e,t.slice(2)]:["I",t]}function w3e(t,e,n){const r=[];let i=null;for(let s=0;s<t.length;++s){const[a,o]=_3e(t[s].entity);i===o&&a!=="B"&&a!=="S"?(r[r.length-1].end=s+1,a==="E"&&(i=null)):(r.push({tag:o,start:s,end:s+1}),i=a==="S"?null:o)}return r.map(({tag:s,start:a,end:o})=>{let l=0;const c=[];for(let u=a;u<o;++u)l+=t[u].score,c.push(e[t[u].index]);return{entity_group:s,score:l/(o-a),word:n.decode(c,{skip_special_tokens:!0})}})}var b3e=class extends yi{async _call(t,e,{top_k:n=1}={}){const r=this.tokenizer(t,{text_pair:e,padding:!0,truncation:!0}),i=Array.isArray(t),{start_logits:s,end_logits:a}=await this.model(r),o=r.input_ids.tolist(),l=r.attention_mask.tolist(),{all_special_ids:c,sep_token_id:u}=this.tokenizer,d=[];for(let f=0;f<s.dims[0];++f){const h=o[f],p=h.findIndex(T=>T==u),m=s[f].tolist(),g=a[f].tolist();for(let T=1;T<m.length;++T)(l[f]==0||T<=p||c.findIndex(N=>N==h[T])!==-1)&&(m[T]=-1/0,g[T]=-1/0);const v=Ms(m).map((T,N)=>[T,N]),_=Ms(g).map((T,N)=>[T,N]);v[0][0]=0,_[0][0]=0;const b=g_e(v,_).filter(T=>T[0][1]<=T[1][1]).map(T=>[T[0][1],T[1][1],T[0][0]*T[1][0]]).sort((T,N)=>N[2]-T[2]),x=[];for(let T=0;T<Math.min(b.length,n);++T){const[N,A,L]=b[T],M=h.slice(N,A+1),B=this.tokenizer.decode(M,{skip_special_tokens:!0});x.push({answer:B,score:L})}n===1?d.push(...x):d.push(x)}return i?d:d[0]}},x3e=class extends yi{async _call(t,{top_k:e=5}={}){const{mask_token_id:n,mask_token:r}=this.tokenizer,i=this.tokenizer(t,{padding:!0,truncation:!0}),{logits:s}=await this.model(i),a=[],o=i.input_ids.tolist();for(let l=0;l<o.length;++l){const c=o[l],u=c.findIndex(m=>m==n);if(u===-1)throw Error(`Mask token (${r}) not found in text.`);const d=s[l][u],f=await f0(new He("float32",Ms(d.data),d.dims),e),h=f[0].tolist(),p=f[1].tolist();a.push(p.map((m,g)=>{const v=c.slice();return v[u]=m,{score:h[g],token:Number(m),token_str:this.tokenizer.decode([m]),sequence:this.tokenizer.decode(v,{skip_special_tokens:!0})}}))}return Array.isArray(t)?a:a[0]}},eO=class extends yi{constructor(){super(...arguments);X(this,"_default_generation_config",{max_new_tokens:256});X(this,"_key","generated_text")}async _call(e,n={}){Array.isArray(e)||(e=[e]),this.model.config.prefix&&(e=e.map(l=>this.model.config.prefix+l));const r=this.model.config.task_specific_params;r&&r[this.task]&&r[this.task].prefix&&(e=e.map(l=>r[this.task].prefix+l));const i=this.tokenizer,s={padding:!0,truncation:!0};let a;this.task==="translation"&&"_build_translation_inputs"in i?a=i._build_translation_inputs(e,s,n):a=i(e,s);const o=await this.model.generate({...a,...this._default_generation_config,...n});return i.batch_decode(o,{skip_special_tokens:!0}).map(l=>({[this._key]:l}))}},k3e=class extends eO{constructor(){super(...arguments);X(this,"_key","summary_text")}},S3e=class extends eO{constructor(){super(...arguments);X(this,"_key","translation_text")}};function SB(t){return Array.isArray(t)&&t.every(e=>"role"in e&&"content"in e)}var T3e=class extends yi{constructor(){super(...arguments);X(this,"_default_generation_config",{max_new_tokens:256})}async _call(e,n={}){const{add_special_tokens:r,return_full_text:i,tools:s,documents:a,chat_template:o,tokenizer_encode_kwargs:l,...c}=n;let u=!1,d=!1,f=r??(this.tokenizer.add_bos_token||this.tokenizer.add_eos_token)??!1,h=l,p;if(typeof e=="string")p=e=[e];else if(Array.isArray(e)&&e.every(T=>typeof T=="string"))u=!0,p=e;else{if(SB(e))e=[e];else if(Array.isArray(e)&&e.every(SB))u=!0;
534else throw new Error("Input must be a string, an array of strings, a Chat, or an array of Chats");d=!0;const T={tokenize:!1,add_generation_prompt:!0,...us({tools:s,documents:a,chat_template:o},["tools","documents","chat_template"]),...h};p=e.map(N=>this.tokenizer.apply_chat_template(N,T)),f=!1,h=void 0}const m=d?!1:i??!0;this.tokenizer.padding_side="left";const g=this.tokenizer(p,{add_special_tokens:f,padding:!0,truncation:!0,...h}),v=await this.model.generate({...g,...this._default_generation_config,...c}),_=this.tokenizer.batch_decode(v,{skip_special_tokens:!0});let b;!m&&g.input_ids.dims.at(-1)>0&&(b=this.tokenizer.batch_decode(g.input_ids,{skip_special_tokens:!0}).map(T=>T.length));const x=Array.from({length:e.length},T=>[]);for(let T=0;T<_.length;++T){const N=Math.floor(T/v.dims[0]*e.length);b&&(_[T]=_[T].slice(b[N])),x[N].push({generated_text:d?[...e[N],{role:"assistant",content:_[T]}]:_[T]})}return!u&&x.length===1?x[0]:x}},C3e=class extends yi{constructor(t){super(t),this.label2id=Object.fromEntries(Object.entries(this.model.config.label2id).map(([e,n])=>[e.toLowerCase(),n])),this.entailment_id=this.label2id.entailment,this.entailment_id===void 0&&(en.warn("Could not find 'entailment' in label2id mapping. Using 2 as entailment_id."),this.entailment_id=2),this.contradiction_id=this.label2id.contradiction??this.label2id.not_entailment,this.contradiction_id===void 0&&(en.warn("Could not find 'contradiction' in label2id mapping. Using 0 as contradiction_id."),this.contradiction_id=0)}async _call(t,e,{hypothesis_template:n="This example is {}.",multi_label:r=!1}={}){const i=Array.isArray(t);i||(t=[t]),Array.isArray(e)||(e=[e]);const s=e.map(l=>n.replace("{}",l)),a=r||e.length===1,o=[];for(const l of t){const c=[];for(const f of s){const h=this.tokenizer(l,{text_pair:f,padding:!0,truncation:!0}),p=await this.model(h);a?c.push([p.logits.data[this.contradiction_id],p.logits.data[this.entailment_id]]):c.push(p.logits.data[this.entailment_id])}const d=(a?c.map(f=>Ms(f)[1]):Ms(c)).map((f,h)=>[f,h]).sort((f,h)=>h[0]-f[0]);o.push({sequence:l,labels:d.map(f=>e[f[1]]),scores:d.map(f=>f[0])})}return i?o:o[0]}},E3e=class extends yi{async _call(t,{top_k:e=5}={}){const n=this.processor.feature_extractor.config.sampling_rate,r=await jg(t,n),i=this.model.config.id2label,s=[];for(const a of r){const o=await this.processor(a),c=(await this.model(o)).logits[0],u=await f0(new He("float32",Ms(c.data),c.dims),e),d=u[0].tolist(),h=u[1].tolist().map((p,m)=>({label:i?i[p]:`LABEL_${p}`,score:d[m]}));s.push(h)}return Array.isArray(t)?s:s[0]}},A3e=class extends yi{async _call(t,e,{hypothesis_template:n="This is a sound of {}."}={}){const r=!Array.isArray(t);r&&(t=[t]);const i=e.map(c=>n.replace("{}",c)),s=this.tokenizer(i,{padding:!0,truncation:!0}),a=this.processor.feature_extractor.config.sampling_rate,o=await jg(t,a),l=[];for(const c of o){const u=await this.processor(c),d=await this.model({...s,...u}),f=Ms(d.logits_per_audio.data);l.push([...f].map((h,p)=>({score:h,label:e[p]})))}return r?l[0]:l}},P3e=class extends yi{constructor(){super(...arguments);X(this,"_default_generation_config",{})}async _call(e,n={}){switch(n={...this._default_generation_config,...n},this.model.config.model_type){case"whisper":case"lite-whisper":return this._call_whisper(e,n);case"wav2vec2":case"wav2vec2-bert":case"unispeech":case"unispeech-sat":case"hubert":case"parakeet_ctc":return this._call_wav2vec2(e,n);case"moonshine":return this._call_moonshine(e,n);case"cohere_asr":return this._call_cohere_asr(e,n);default:throw new Error(`AutomaticSpeechRecognitionPipeline does not support model type '${this.model.config.model_type}'.`)}}async _call_wav2vec2(e,n){n.language&&en.warn('`language` parameter is not yet supported for `wav2vec2` models, defaulting to "English".'),n.task&&en.warn('`task` parameter is not yet supported for `wav2vec2` models, defaulting to "transcribe".');const r=!Array.isArray(e),i=r?[e]:e,s=this.processor.feature_extractor.config.sampling_rate,a=await jg(i,s),o=[];for(const l of a){const c=await this.processor(l),d=(await this.model(c)).logits[0],f=[];for(const p of d)f.push(Pi(p.data)[1]);const h=this.tokenizer.decode(f,{skip_special_tokens:!0}).trim();o.push({text:h})}return r?o[0]:o}async _call_whisper(e,n){const r=n.return_timestamps??!1,i=n.chunk_length_s??0,s=n.force_full_sequences??!1;let a=n.stride_length_s??null;const o={...n};r==="word"&&(o.return_token_timestamps=!0,o.return_timestamps=!0);const l=!Array.isArray(e),c=l?[e]:e,u=this.processor.feature_extractor.config,d=u.chunk_length/this.model.config.max_source_positions,f=u.hop_length,h=u.sampling_rate,p=await jg(c,h),m=[];for(const g of p){let v=[];
534if(i>0){if(a===null)a=i/6;else if(i<=a)throw Error("`chunk_length_s` must be larger than `stride_length_s`.");const x=h*i,T=h*a,N=x-2*T;let A=0;for(;;){const L=A+x,M=g.subarray(A,L),B=await this.processor(M),R=A===0,j=L>=g.length;if(v.push({stride:[M.length,R?0:T,j?0:T],input_features:B.input_features,is_last:j}),j)break;A+=N}}else v=[{stride:[g.length,0,0],input_features:(await this.processor(g)).input_features,is_last:!0}];for(const x of v){o.num_frames=Math.floor(x.stride[0]/f);const T=await this.model.generate({inputs:x.input_features,...o});if(r==="word"){const N=T.sequences.tolist()[0],A=T.token_timestamps.tolist()[0],L=this.tokenizer.timestamp_begin,M=Math.max(N.findIndex(B=>Number(B)>=L),0);x.tokens=N.slice(M),x.token_timestamps=A.slice(M).map(B=>n_(B,2))}else x.tokens=T[0].tolist();x.stride=x.stride.map(N=>N/h)}const[_,b]=this.tokenizer._decode_asr(v,{time_precision:d,return_timestamps:r,force_full_sequences:s});m.push({text:_,...b})}return l?m[0]:m}async _call_moonshine(e,n){const r=!Array.isArray(e),i=r?[e]:e,s=this.processor.feature_extractor.config.sampling_rate,a=await jg(i,s),o=[];for(const l of a){const c=await this.processor(l),u=Math.floor(l.length/s)*6,d=await this.model.generate({max_new_tokens:u,...n,...c}),f=this.processor.batch_decode(d,{skip_special_tokens:!0})[0];o.push({text:f})}return r?o[0]:o}async _call_cohere_asr(e,n){const r=!Array.isArray(e),i=r?[e]:e,s=this.processor.feature_extractor,a=s.config.sampling_rate,o=await jg(i,a),l=n.language??"en",c=this.processor.get_decoder_prompt_ids(l),u=[];for(const d of o){const f=s.split_audio(d),h=[];for(const m of f){const g=await this.processor(m),v=await this.model.generate({...g,decoder_input_ids:c,...n}),_=this.tokenizer.decode(v[0].tolist(),{skip_special_tokens:!0}).trim();h.push(_)}const p=this.processor.constructor.join_chunks(h,l);u.push({text:p})}return r?u[0]:u}},M3e=class extends yi{constructor(e){super(e);X(this,"DEFAULT_VOCODER_ID","Xenova/speecht5_hifigan");this.vocoder=e.vocoder??null}async _prepare_speaker_embeddings(e,n){if((typeof e=="string"||e instanceof URL)&&(e=new Float32Array(await(await On.fetch(e)).arrayBuffer())),e instanceof Float32Array)e=new He("float32",e,[e.length]);else if(!(e instanceof He))throw new Error("Speaker embeddings must be a `Tensor`, `Float32Array`, `string`, or `URL`.");if(n>1){if(e.dims[0]===1)e=e.repeat(n,1);else if(e.dims[0]!==n)throw new Error(`Expected speaker embeddings batch size to be 1 or ${n}, but got ${e.dims[0]}.`)}return e}_postprocess_waveform(e,n,r,i=null){const s=n.data,[a,o]=n.dims,l=i?i.data:null,c=[];for(let u=0;u<a;++u){const d=l?Math.min(Math.ceil(l[u]),o):o,f=u*o;c.push(new Sxe(s.slice(f,f+d),r))}return Array.isArray(e)?c:c[0]}async _call(e,n){return this.processor?this._call_text_to_spectrogram(e,n):this.model.config.model_type==="supertonic"?this._call_supertonic(e,n):this._call_text_to_waveform(e)}async _call_supertonic(e,{speaker_embeddings:n,num_inference_steps:r,speed:i}){if(!n)throw new Error("Speaker embeddings must be provided for Supertonic models.");const{sampling_rate:s,style_dim:a}=this.model.config,o=this.tokenizer(e,{padding:!0,truncation:!0}),l=o.input_ids.dims[0];n=await this._prepare_speaker_embeddings(n,l),n=n.view(l,-1,a);const{waveform:c,durations:u}=await this.model.generate_speech({...o,style:n,num_inference_steps:r,speed:i});return this._postprocess_waveform(e,c,s,u)}async _call_text_to_waveform(e){const n=this.tokenizer(e,{padding:!0,truncation:!0}),{waveform:r}=await this.model(n),i=this.model.config.sampling_rate;return this._postprocess_waveform(e,r,i)}async _call_text_to_spectrogram(e,{speaker_embeddings:n}){this.vocoder||(en.info("No vocoder specified, using default HifiGan vocoder."),this.vocoder=await r_.from_pretrained(this.DEFAULT_VOCODER_ID,{dtype:"fp32"}));const{input_ids:r}=this.tokenizer(e,{padding:!0,truncation:!0}),i=r.dims[0];n=await this._prepare_speaker_embeddings(n,i),n=n.view(i,-1);const{waveform:s}=await this.model.generate_speech(r,n,{vocoder:this.vocoder}),a=this.processor.feature_extractor.config.sampling_rate;return this._postprocess_waveform(e,s,a)}},N3e=class extends yi{async _call(t,e={}){const n=Array.isArray(t),r=await dc(t),{pixel_values:i}=await this.processor(r),s=[];for(const a of i){a.dims=[1,...a.dims];const o=await this.model.generate({inputs:a,...e}),l=this.tokenizer.batch_decode(o,{skip_special_tokens:!0}).map(c=>({generated_text:c.trim()}));s.push(l)}return n?s:s[0]}},R3e=class extends yi{async _call(t,{top_k:e=5}={}){const n=await dc(t),{pixel_values:r}=await this.processor(n),i=await this.model({pixel_values:r}),{id2label:s}=this.model.config,a=[];for(const o of i.logits){const l=await f0(new He("float32",Ms(o.data),o.dims),e),c=l[0].tolist(),d=l[1].tolist().map((f,h)=>({label:s?s[f]:`LABEL_${f}`,score:c[h]}));a.push(d)}return Array.isArray(t)?a:a[0]}},TB={panoptic:"post_process_panoptic_segmentation",instance:"post_process_instance_segmentation",semantic:"post_process_semantic_segmentation"},DX=class extends yi{async _call(t,{threshold:e=.5,mask_threshold:n=.5,overlap_mask_area_threshold:r=.8,label_ids_to_fuse:i=null,target_sizes:s=null,subtask:a=null}={}){if(Array.isArray(t)&&t.length!==1)throw Error("Image segmentation pipeline currently only supports a batch size of 1.");const l=await dc(t),c=l.map(v=>[v.height,v.width]),u=await this.processor(l),{inputNames:d,outputNames:f}=this.model.sessions.model;if(!d.includes("pixel_values")){if(d.length!==1)throw Error(`Expected a single input name, but got ${d.length}
534 inputs: ${d}.`);const v=d[0];if(v in u)throw Error(`Input name ${v} already exists in the inputs.`);u[v]=u.pixel_values}const h=await this.model(u);let p=null;if(a!==null)p=TB[a];else if(this.processor.image_processor){for(const[v,_]of Object.entries(TB))if(_ in this.processor.image_processor){p=this.processor.image_processor[_].bind(this.processor.image_processor),a=v;break}}const m=this.model.config.id2label,g=[];if(a)if(a==="panoptic"||a==="instance"){const v=p(h,e,n,r,i,s??c)[0],_=v.segmentation;for(const b of v.segments_info){const x=new Uint8ClampedArray(_.data.length);for(let N=0;N<_.data.length;++N)_.data[N]===b.id&&(x[N]=255);const T=new nc(x,_.dims[1],_.dims[0],1);g.push({score:b.score,label:m[b.label_id],mask:T})}}else if(a==="semantic"){const{segmentation:v,labels:_}=p(h,s??c)[0];for(const b of _){const x=new Uint8ClampedArray(v.data.length);for(let N=0;N<v.data.length;++N)v.data[N]===b&&(x[N]=255);const T=new nc(x,v.dims[1],v.dims[0],1);g.push({score:null,label:m[b],mask:T})}}else throw Error(`Subtask ${a} not supported.`);else{const _=h[f[0]];for(let b=0;b<c.length;++b){const x=c[b],T=_[b];T.data.some(A=>A<-1e-5||A>1+1e-5)&&T.sigmoid_();const N=await nc.fromTensor(T.mul_(255).to("uint8")).resize(x[1],x[0]);g.push({label:null,score:null,mask:N})}}return g}},I3e=class extends DX{async _call(t,e={}){const n=await dc(t),r=await super._call(t,e),i=n.map((s,a)=>{const o=s.clone();return o.putAlpha(r[a].mask),o});return Array.isArray(t)?i:i[0]}},L3e=class extends yi{async _call(t,e,{hypothesis_template:n="This is a photo of {}"}={}){const r=Array.isArray(t),i=await dc(t),s=e.map(d=>n.replace("{}",d)),a=this.tokenizer(s,{padding:this.model.config.model_type==="siglip"?"max_length":!0,truncation:!0}),{pixel_values:o}=await this.processor(i),l=await this.model({...a,pixel_values:o}),c=this.model.config.model_type==="siglip"?d=>d.sigmoid().data:d=>Ms(d.data),u=[];for(const d of l.logits_per_image){const h=[...c(d)].map((p,m)=>({score:p,label:e[m]}));h.sort((p,m)=>m.score-p.score),u.push(h)}return r?u:u[0]}},O3e=class extends yi{async _call(t,{threshold:e=.9,percentage:n=!1}={}){const r=Array.isArray(t);if(r&&t.length!==1)throw Error("Object detection pipeline currently only supports a batch size of 1.");const i=await dc(t),s=n?null:i.map(f=>[f.height,f.width]),{pixel_values:a,pixel_mask:o}=await this.processor(i),l=await this.model({pixel_values:a,pixel_mask:o}),c=this.processor.image_processor.post_process_object_detection(l,e,s),{id2label:u}=this.model.config,d=c.map(f=>f.boxes.map((h,p)=>({score:f.scores[p],label:u[f.classes[p]],box:oN(h,!n)})));return r?d:d[0]}},D3e=class extends yi{async _call(t,e,{threshold:n=.1,top_k:r=null,percentage:i=!1}={}){const s=Array.isArray(t),a=await dc(t),o=this.tokenizer(e,{padding:!0,truncation:!0}),l=await this.processor(a),c=[];for(let u=0;u<a.length;++u){const d=a[u],f=i?null:[[d.height,d.width]],h=l.pixel_values[u].unsqueeze_(0),p=await this.model({...o,pixel_values:h});let m;if("post_process_grounded_object_detection"in this.processor){const g=this.processor.post_process_grounded_object_detection(p,o.input_ids,{box_threshold:n,text_threshold:n,target_sizes:f})[0];m=g.boxes.map((v,_)=>({score:g.scores[_],label:g.labels[_],box:oN(v,!i)}))}else{const g=this.processor.image_processor.post_process_object_detection(p,n,f,!0)[0];m=g.boxes.map((v,_)=>({score:g.scores[_],label:e[g.classes[_]],box:oN(v,!i)}))}m.sort((g,v)=>v.score-g.score),r!==null&&(m=m.slice(0,r)),c.push(m)}return s?c:c[0]}},F3e=class extends yi{constructor(){super(...arguments);X(this,"_default_generation_config",{max_new_tokens:256})}async _call(e,n,r={}){if(Array.isArray(e)){if(e.length!==1)throw Error("Document Question Answering pipeline currently only supports a batch size of 1.");e=e[0]}const i=(await dc(e))[0],{pixel_values:s}=await this.processor(i),a=`<s_docvqa><s_question>${n}</s_question><s_answer>`,o=this.tokenizer(a,{add_special_tokens:!1,padding:!0,truncation:!0}).input_ids,l=await this.model.generate({inputs:s,max_length:this.model.config.decoder.max_position_embeddings,decoder_input_ids:o,...this._default_generation_config,...r}),u=this.tokenizer.batch_decode(l)[0].match(/<s_answer>(.*?)<\/s_answer>/);let d=null;return u&&u.length>=2&&(d=u[1].trim()),[{answer:d}]}},j3e=class extends yi{async _call(t){const e=await dc(t),n=await this.processor(e),r=await this.model(n),i=[];for(const s of r.reconstruction){const a=s.squeeze().clamp_(0,1).mul_(255).round_().to("uint8");i.push(nc.fromTensor(a))}return Array.isArray(t)?i:i[0]}},B3e=class extends yi{async _call(t){const e=await dc(t),n=await this.processor(e),{predicted_depth:r}=await this.model(n),i=[];for(let s=0;s<e.length;++s){const a=r[s],[o,l]=a.dims.slice(-2),[c,u]=e[s].size,d=(await tc(a.view(1,
5341,o,l),{size:[u,c],mode:"bilinear"})).view(u,c),f=d.min().item(),h=d.max().item(),p=d.sub(f).div_(h-f).mul_(255).to("uint8").unsqueeze(0),m=nc.fromTensor(p);i.push({predicted_depth:d,depth:m})}return Array.isArray(t)?i:i[0]}},U3e=class extends yi{async _call(t,{pooling:e="none",normalize:n=!1,quantize:r=!1,precision:i="binary"}={}){const s=this.tokenizer(t,{padding:!0,truncation:!0}),a=await this.model(s);let o=a.last_hidden_state??a.logits??a.token_embeddings;switch(e){case"none":break;case"mean":o=l2e(o,s.attention_mask);break;case"first_token":case"cls":o=o.slice(null,0);break;case"last_token":case"eos":o=o.slice(null,-1);break;default:throw Error(`Pooling method '${e}' not supported.`)}return n&&(o=o.normalize(2,-1)),r&&(o=d2e(o,i)),o}},z3e=class extends yi{async _call(t,{pool:e=null}={}){const n=await dc(t),{pixel_values:r}=await this.processor(n),i=await this.model({pixel_values:r});let s;if(e){if(!("pooler_output"in i))throw Error("No pooled output was returned. Make sure the model has a 'pooler' layer when using the 'pool' option.");s=i.pooler_output}else s=i.last_hidden_state??i.logits??i.image_embeds;return s}},rS=Object.freeze({"text-classification":{pipeline:v3e,model:wB,default:{model:"Xenova/distilbert-base-uncased-finetuned-sst-2-english"},type:"text"},"token-classification":{pipeline:y3e,model:e3e,default:{model:"Xenova/bert-base-multilingual-cased-ner-hrl"},type:"text"},"question-answering":{pipeline:b3e,model:a3e,default:{model:"Xenova/distilbert-base-cased-distilled-squad"},type:"text"},"fill-mask":{pipeline:x3e,model:s3e,default:{model:"onnx-community/ettin-encoder-32m-ONNX",dtype:"fp32"},type:"text"},summarization:{pipeline:k3e,model:eE,default:{model:"Xenova/distilbart-cnn-6-6"},type:"text"},translation:{pipeline:S3e,model:eE,default:{model:"Xenova/t5-small"},type:"text"},"text2text-generation":{pipeline:eO,model:eE,default:{model:"Xenova/flan-t5-small"},type:"text"},"text-generation":{pipeline:T3e,model:i3e,default:{model:"onnx-community/Qwen3-0.6B-ONNX",dtype:"q4"},type:"text"},"zero-shot-classification":{pipeline:C3e,model:wB,default:{model:"Xenova/distilbert-base-uncased-mnli"},type:"text"},"audio-classification":{pipeline:E3e,model:h3e,default:{model:"Xenova/wav2vec2-base-superb-ks"},type:"audio"},"zero-shot-audio-classification":{pipeline:A3e,model:r_,default:{model:"Xenova/clap-htsat-unfused"},type:"multimodal"},"automatic-speech-recognition":{pipeline:P3e,model:[t3e,d3e],default:{model:"Xenova/whisper-tiny.en"},type:"multimodal"},"text-to-audio":{pipeline:M3e,model:[r3e,n3e],default:{model:"onnx-community/Supertonic-TTS-ONNX",dtype:"fp32"},type:"text"},"image-to-text":{pipeline:N3e,model:o3e,default:{model:"Xenova/vit-gpt2-image-captioning"},type:"multimodal"},"image-classification":{pipeline:R3e,model:l3e,default:{model:"Xenova/vit-base-patch16-224"},type:"multimodal"},"image-segmentation":{pipeline:DX,model:[bB,xB,kB],default:{model:"Xenova/detr-resnet-50-panoptic"},type:"multimodal"},"background-removal":{pipeline:I3e,model:[bB,xB,kB],default:{model:"Xenova/modnet"},type:"image"},"zero-shot-image-classification":{pipeline:L3e,model:r_,default:{model:"Xenova/clip-vit-base-patch32"},type:"multimodal"},"object-detection":{pipeline:O3e,model:c3e,default:{model:"Xenova/detr-resnet-50"},type:"multimodal"},"zero-shot-object-detection":{pipeline:D3e,model:u3e,default:{model:"Xenova/owlvit-base-patch32"},type:"multimodal"},"document-question-answering":{pipeline:F3e,model:f3e,default:{model:"Xenova/donut-base-finetuned-docvqa"},type:"multimodal"},"image-to-image":{pipeline:j3e,model:p3e,default:{model:"Xenova/swin2SR-classical-sr-x2-64"},type:"image"},"depth-estimation":{pipeline:B3e,model:m3e,default:{model:"onnx-community/depth-anything-v2-small"},type:"image"},"feature-extraction":{pipeline:U3e,model:r_,default:{model:"onnx-community/all-MiniLM-L6-v2-ONNX",dtype:"fp32"},type:"text"},"image-feature-extraction":{pipeline:z3e,model:[g3e,r_],default:{model:"onnx-community/dinov3-vits16-pretrain-lvd1689m-ONNX",dtype:"fp32"},type:"image"}}),FX=Object.freeze({"sentiment-analysis":"text-classification",ner:"token-classification",asr:"automatic-speech-recognition","text-to-speech":"text-to-audio",embeddings:"feature-extraction"});async function $3e(t){if(!t)throw new Error("modelId is required");return(await y1(t,Aw,{})).exists?[Aw]:[]}async function V3e(t,{config:e=null,dtype:n=null,device:r=null,model_file_name:i=null,include_tokenizer:s=!0,include_processor:a=!0}={}){const o=await LJ(t,{config:e,dtype:n,device:r,model_file_name:i});if(s){const l=await BK(t);o.push(...l)}if(a){const l=await $3e(t);o.push(...l)}return o}async function q3e(t,e,n={}){t=FX[t]??t;const r=rS[t];if(!r)throw new Error(`Unsupported pipeline task: ${t}. Must be one of [${Object.keys(rS).join(", ")}]`);const{type:i}=r,o=await V3e(e,{...n,include_tokenizer:i!=="audio"&&i!=="image",include_processor:i!=="text"});if(t==="text-generation"){const l=await IJ(e,n),c=RJ(l),u=ZSe(c);if(u){const d=Object.values(u).map(f=>`onnx/${f}`);return o.filter(f=>!f.startsWith("onnx/")||d.some(h=>f.startsWith(h)))}}return o}async function CB(t,e=null,{progress_callback:n=null,config:r=null,cache_dir:i=null,local_files_only:s=!1,revision:a="main",device:o=null,dtype:l=null,subfolder:c="onnx",use_external_data_format:u=null,model_file_name:d=null,
534session_options:f={}}={}){t=FX[t]??t;const h=rS[t.split("_",1)[0]];if(!h)throw Error(`Unsupported pipeline: ${t}. Must be one of [${Object.keys(rS)}]`);e||(e=h.default.model,en.info(`No model specified. Using default model: "${e}".`),!l&&h.default.dtype&&(l=h.default.dtype));const p=await q3e(t,e,{device:o,dtype:l});let m={};n&&(await Promise.all(p.map(async R=>y1(e,R)))).forEach((R,j)=>{R.exists&&(m[p[j]]={loaded:0,total:R.size??0})});const g={progress_callback:n?new KM(n,m):void 0,config:r,cache_dir:i,local_files_only:s,revision:a,device:o,dtype:l,subfolder:c,use_external_data_format:u,model_file_name:d,session_options:f},v=p.includes("tokenizer.json"),_=p.includes("preprocessor_config.json"),b=h.model;let x;if(Array.isArray(b)){const B=r??await Pw.from_pretrained(e,g),{model_type:R}=B,j=b.find($=>$.supports(R));if(!j)throw Error(`Unsupported model type "${R}" for task "${t}". None of the candidate model classes support this type.`);x=j.from_pretrained(e,{...g,config:B})}else x=b.from_pretrained(e,g);const[T,N,A]=await Promise.all([v?Kn.from_pretrained(e,g):null,_?CSe.from_pretrained(e,g):null,x]),L={task:t,model:A};T&&(L.tokenizer=T),N&&(L.processor=N),hh(n,{status:"ready",task:t,model:e});const M=h.pipeline;return new M(L)}vn.IS_PROCESS_AVAILABLE;const jX=()=>{const[t,e]=I.useState(!1),[n,r]=I.useState(!1),[i,s]=I.useState(!1),[a,o]=I.useState([]),[l,c]=I.useState(null),u=I.useRef(null),d=I.useRef(null),f=I.useRef(null),h=I.useRef(null),p=I.useRef(null),m=I.useCallback(async()=>{if(!f.current){s(!0);try{f.current=await CB("object-detection","Xenova/detr-resnet-50",{device:"webgpu"}),console.log("Object detection model loaded")}catch(x){console.error("Failed to load model:",x);try{f.current=await CB("object-detection","Xenova/detr-resnet-50"),console.log("Object detection model loaded (CPU fallback)")}catch(T){console.error("Failed to load model on CPU:",T),c("Failed to load AI model")}}finally{s(!1)}}},[]),g=async()=>{r(!0),c(null);try{const x=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:640},height:{ideal:480},facingMode:"environment"}});h.current=x,u.current&&(u.current.srcObject=x,await u.current.play()),e(!0),await m(),_()}catch(x){console.error("Camera access error:",x),c("Unable to access camera")}finally{r(!1)}},v=()=>{h.current&&(h.current.getTracks().forEach(x=>x.stop()),h.current=null),p.current&&(cancelAnimationFrame(p.current),p.current=null),e(!1),o([])},_=I.useCallback(async()=>{if(!u.current||!f.current||!d.current){p.current=requestAnimationFrame(_);return}const x=u.current,T=d.current,N=T.getContext("2d");if(!N||x.readyState!==4){p.current=requestAnimationFrame(_);return}T.width=x.videoWidth,T.height=x.videoHeight,N.drawImage(x,0,0);try{const A=await f.current(T,{threshold:.7,percentage:!0});o(A)}catch(A){console.error("Detection error:",A)}setTimeout(()=>{p.current=requestAnimationFrame(_)},200)},[]);I.useEffect(()=>()=>{v()},[]);const b=()=>{t?v():g()};return w.jsxs("div",{className:"relative w-full aspect-video bg-navy-mid rounded-lg overflow-hidden border border-border/50",children:[w.jsx("video",{ref:u,className:`absolute inset-0 w-full h-full object-cover ${t?"block":"hidden"}`,playsInline:!0,muted:!0}),w.jsx("canvas",{ref:d,className:"hidden"}),t?w.jsxs(w.Fragment,{children:[a.map((x,T)=>w.jsx(ar.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:"absolute border-2 border-primary rounded",style:{left:`${x.box.xmin*100}%`,top:`${x.box.ymin*100}%`,width:`${(x.box.xmax-x.box.xmin)*100}
534%`,height:`${(x.box.ymax-x.box.ymin)*100}%`},children:w.jsxs("div",{className:"absolute -top-6 left-0 bg-primary px-2 py-0.5 rounded text-xs text-primary-foreground whitespace-nowrap",children:[x.label," (",Math.round(x.score*100),"%)"]})},`${x.label}-${T}`)),w.jsxs("div",{className:"absolute top-3 left-3 flex items-center gap-2 bg-background/80 px-2 py-1 rounded text-xs",children:[w.jsx(Sh,{status:"online",size:"sm",showPulse:!0}),w.jsx("span",{className:"text-foreground",children:"LIVE"}),i&&w.jsxs("span",{className:"text-muted-foreground flex items-center gap-1",children:[w.jsx(y_,{className:"w-3 h-3 animate-spin"}),"Loading AI..."]})]}),a.length>0&&w.jsxs("div",{className:"absolute top-3 left-1/2 -translate-x-1/2 bg-primary/90 px-3 py-1 rounded text-xs text-primary-foreground",children:[a.length," object",a.length!==1?"s":""," detected"]}),w.jsxs("div",{className:"absolute bottom-3 left-3 right-3 flex justify-between items-end",children:[w.jsxs("div",{className:"bg-background/80 px-2 py-1 rounded text-xs text-muted-foreground",children:[w.jsx("div",{children:"Live Camera - Object Detection"}),w.jsx("div",{className:"text-primary",children:"DETR ResNet-50"})]}),w.jsx("div",{className:"bg-background/80 px-2 py-1 rounded text-xs text-muted-foreground",children:new Date().toLocaleTimeString()})]})]}):w.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground",children:n?w.jsxs(w.Fragment,{children:[w.jsx(y_,{className:"w-12 h-12 mb-2 animate-spin text-primary"}),w.jsx("span",{className:"text-sm",children:"Starting camera..."})]}):l?w.jsxs(w.Fragment,{children:[w.jsx(EF,{className:"w-12 h-12 mb-2 text-destructive"}),w.jsx("span",{className:"text-sm text-destructive",children:l})]}):w.jsxs(w.Fragment,{children:[w.jsx(AF,{className:"w-12 h-12 mb-2"}),w.jsx("span",{className:"text-sm",children:"Click to start camera"}),w.jsx("span",{className:"text-xs mt-1 text-muted-foreground/70",children:"AI object detection enabled"})]})}),w.jsx($t,{variant:"ghost",size:"icon",className:"absolute top-3 right-3",onClick:b,disabled:n,children:n?w.jsx(y_,{className:"w-4 h-4 animate-spin"}):t?w.jsx(AF,{className:"w-4 h-4 text-primary"}):w.jsx(EF,{className:"w-4 h-4 text-muted-foreground"})})]})},BX=()=>{var r,i;const[t,e]=I.useState([]);I.useEffect(()=>{const s=()=>{const o=[];for(let l=0;l<20;l++)o.push({x:20+Math.random()*260,y:20+Math.random()*160});o.sort((l,c)=>l.x-c.x),e(o)};s();const a=setInterval(s,5e3);return()=>clearInterval(a)},[]);const n=t.length>0?`M ${t[0].x} ${t[0].y} ${t.slice(1).map(s=>`L ${s.x} ${s.y}`).join(" ")}`:"";return w.jsxs("div",{className:"relative w-full h-48 bg-muted/30 rounded-lg overflow-hidden tech-grid",children:[w.jsxs("svg",{viewBox:"0 0 300 200",className:"w-full h-full",preserveAspectRatio:"xMidYMid meet",children:[[0,50,100,150,200].map(s=>w.jsx("line",{x1:"0",y1:s,x2:"300",y2:s,stroke:"hsl(210 30% 20%)",strokeWidth:"0.5",strokeDasharray:"4 4"},`h-${s}`)),[0,60,120,180,240,300].map(s=>w.jsx("line",{x1:s,y1:"0",x2:s,y2:"200",stroke:"hsl(210 30% 20%)",strokeWidth:"0.5",strokeDasharray:"4 4"},`v-${s}`)),w.jsx(ar.path,{d:n,fill:"none",stroke:"url(#trajectoryGradient)",strokeWidth:"2",strokeLinecap:"round",initial:{pathLength:0},animate:{pathLength:1},transition:{duration:2,ease:"easeInOut"},style:{filter:"drop-shadow(0 0 4px hsl(185 70% 45% / 0.5))"}}),t.map((s,a)=>w.jsx(ar.circle,{cx:s.x,cy:s.y,r:"4",fill:"hsl(185 70% 45%)",initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},transition:{delay:a*.1,duration:.3},style:{filter:"drop-shadow(0 0 6px hsl(185 85% 55%))"}},a)),t.length>0&&w.jsx(ar.circle,{cx:((r=t[t.length-1])==null?void 0:r.x)||0,cy:((i=t[t.length-1])==null?void 0:i.y)||0,r:"8",fill:"none",stroke:"hsl(185 85% 55%)",strokeWidth:"2",initial:{scale:0},animate:{scale:[1,1.5,1]},transition:{duration:1.5,repeat:1/0}}),w.jsx("defs",{children:w.jsxs("linearGradient",{id:"trajectoryGradient",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[w.jsx("stop",{offset:"0%",stopColor:"hsl(185 50% 30%)"}),w.jsx("stop",{offset:"50%",stopColor:"hsl(185 70% 45%)"}),w.jsx("stop",{offset:"100%",stopColor:"hsl(185 85% 55%)"})]})})]}),w.jsx("div",{className:"absolute bottom-2 left-2 text-xs text-muted-foreground bg-background/80 px-2 py-1 rounded",children:"Live Trajectory Mapping"})]})},W3e=[{id:"1",date:"Dec 2, 2025",boatName:"Sea Breeze II",taskType:"Hull Sanding - Port Side",status:"completed",duration:"4h 23m",notes:"Completed with 120 grit followed by 180 grit finish"},{id:"2",date:"Dec 1, 2025",boatName:"Marina Star",taskType:"Deck Polishing",status:"completed",duration:"3h 15m",notes:"Applied marine-grade polish compound"},{id:"3",date:"Nov 30, 2025",boatName:"Ocean Quest",taskType:"Hull Inspection & Prep",status:"completed",duration:"2h 45m"},{id:"4",date:"Nov 29, 2025",boatName:"Windchaser",taskType:"Full Hull Service",status:"completed",duration:"6h 10m",notes:"Complete sanding and anti-fouling preparation"}],UX=()=>w.jsx("div",{className:"space-y-4 max-h-80 overflow-y-auto pr-2",children:W3e.map((t,e)=>w.jsxs(ar.div,{initial:{opacity:0,x:-20}
534,animate:{opacity:1,x:0},transition:{delay:e*.1},className:"relative pl-6 pb-4 border-l border-border/50 last:pb-0",children:[w.jsx("div",{className:vt("absolute left-0 top-0 -translate-x-1/2 w-3 h-3 rounded-full",t.status==="completed"?"bg-success shadow-[0_0_8px_hsl(160_70%_45%/0.5)]":"bg-warning shadow-[0_0_8px_hsl(40_90%_55%/0.5)]")}),w.jsxs("div",{className:"bg-muted/30 rounded-lg p-3 hover:bg-muted/50 transition-colors",children:[w.jsxs("div",{className:"flex items-start justify-between mb-2",children:[w.jsxs("div",{children:[w.jsx("h4",{className:"font-medium text-foreground",children:t.boatName}),w.jsx("p",{className:"text-sm text-muted-foreground",children:t.taskType})]}),w.jsx("span",{className:"text-xs text-muted-foreground",children:t.date})]}),w.jsxs("div",{className:"flex items-center gap-4 text-xs",children:[w.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[t.status==="completed"?w.jsx(Pae,{className:"w-3 h-3 text-success"}):w.jsx(Kg,{className:"w-3 h-3 text-warning"}),w.jsx("span",{className:"capitalize",children:t.status})]}),w.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[w.jsx(Kg,{className:"w-3 h-3"}),w.jsx("span",{children:t.duration})]}),w.jsxs("button",{className:"flex items-center gap-1 text-primary hover:text-primary/80 transition-colors",children:[w.jsx(HV,{className:"w-3 h-3"}),w.jsx("span",{children:"Photos"})]}),w.jsxs("button",{className:"flex items-center gap-1 text-primary hover:text-primary/80 transition-colors",children:[w.jsx(yk,{className:"w-3 h-3"}),w.jsx("span",{children:"Report"})]})]}),t.notes&&w.jsxs("p",{className:"text-xs text-muted-foreground mt-2 italic",children:['"',t.notes,'"']})]})]},t.id))}),tE=768;function G3e(){const[t,e]=I.useState(void 0);return I.useEffect(()=>{const n=window.matchMedia(`(max-width: ${tE-1}px)`),r=()=>{e(window.innerWidth<tE)};return n.addEventListener("change",r),e(window.innerWidth<tE),()=>n.removeEventListener("change",r)},[]),!!t}var H3e="Separator",EB="horizontal",K3e=["horizontal","vertical"],zX=I.forwardRef((t,e)=>{const{decorative:n,orientation:r=EB,...i}=t,s=J3e(r)?r:EB,o=n?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return w.jsx(Jn.div,{"data-orientation":s,...o,...i,ref:e})});zX.displayName=H3e;function J3e(t){return K3e.includes(t)}var $X=zX;const VX=I.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...r},i)=>w.jsx($X,{ref:i,decorative:n,orientation:e,className:vt("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...r}));VX.displayName=$X.displayName;var nE="focusScope.autoFocusOnMount",rE="focusScope.autoFocusOnUnmount",AB={bubbles:!1,cancelable:!0},Y3e="FocusScope",qX=I.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...a}=t,[o,l]=I.useState(null),c=tu(i),u=tu(s),d=I.useRef(null),f=ri(e,m=>l(m)),h=I.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;I.useEffect(()=>{if(r){let m=function(b){if(h.paused||!o)return;const x=b.target;o.contains(x)?d.current=x:ih(d.current,{select:!0})},g=function(b){if(h.paused||!o)return;const x=b.relatedTarget;x!==null&&(o.contains(x)||ih(d.current,{select:!0}))},v=function(b){if(document.activeElement===document.body)for(const T of b)T.removedNodes.length>0&&ih(o)};document.addEventListener("focusin",m),document.addEventListener("focusout",g);const _=new MutationObserver(v);return o&&_.observe(o,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",g),_.disconnect()}}},[r,o,h.paused]),I.useEffect(()=>{if(o){MB.add(h);const m=document.activeElement;if(!o.contains(m)){const v=new CustomEvent(nE,AB);o.addEventListener(nE,c),o.dispatchEvent(v),v.defaultPrevented||(X3e(nRe(WX(o)),{select:!0}),document.activeElement===m&&ih(o))}return()=>{o.removeEventListener(nE,c),setTimeout(()=>{const v=new CustomEvent(rE,AB);o.addEventListener(rE,u),o.dispatchEvent(v),v.defaultPrevented||ih(m??document.body,{select:!0}),o.removeEventListener(rE,u),MB.remove(h)}
vendor: 3,691 bytes, line 534
534,0)}}},[o,c,u,h]);const p=I.useCallback(m=>{if(!n&&!r||h.paused)return;const g=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,v=document.activeElement;if(g&&v){const _=m.currentTarget,[b,x]=Q3e(_);b&&x?!m.shiftKey&&v===x?(m.preventDefault(),n&&ih(b,{select:!0})):m.shiftKey&&v===b&&(m.preventDefault(),n&&ih(x,{select:!0})):v===_&&m.preventDefault()}},[n,r,h.paused]);return w.jsx(Jn.div,{tabIndex:-1,...a,ref:f,onKeyDown:p})});qX.displayName=Y3e;function X3e(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(ih(r,{select:e}),document.activeElement!==n)return}function Q3e(t){const e=WX(t),n=PB(e,t),r=PB(e.reverse(),t);return[n,r]}function WX(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function PB(t,e){for(const n of t)if(!Z3e(n,{upTo:e}))return n}function Z3e(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function eRe(t){return t instanceof HTMLInputElement&&"select"in t}function ih(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&eRe(t)&&e&&t.select()}}var MB=tRe();function tRe(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=NB(t,e),t.unshift(e)},remove(e){var n;t=NB(t,e),(n=t[0])==null||n.resume()}}}function NB(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function nRe(t){return t.filter(e=>e.tagName!=="A")}var iE=0;function rRe(){I.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??RB()),document.body.insertAdjacentElement("beforeend",t[1]??RB()),iE++,()=>{iE===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),iE--}},[])}function RB(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var qc=function(){return qc=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},qc.apply(this,arguments)};function GX(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function iRe(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))}var _x="right-scroll-bar-position",wx="width-before-scroll-bar",sRe="with-scroll-bars-hidden",aRe="--removed-body-scroll-bar-size";function sE(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function oRe(t,e){var n=I.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=e,n.facade}var lRe=typeof window<"u"?I.useLayoutEffect:I.useEffect,IB=new WeakMap;function cRe(t,e){var n=oRe(null,function(r){return t.forEach(function(i){return sE(i,r)})});return lRe(function(){var r=IB.get(n);if(r){var i=new Set(r),s=new Set(t),a=n.current;
vendor: 4,224 bytes, lines 534-549
534i.forEach(function(o){s.has(o)||sE(o,null)}),s.forEach(function(o){i.has(o)||sE(o,a)})}IB.set(n,t)},[t]),n}function uRe(t){return t}function dRe(t,e){e===void 0&&(e=uRe);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(s){var a=e(s,r);return n.push(a),function(){n=n.filter(function(o){return o!==a})}},assignSyncMedium:function(s){for(r=!0;n.length;){var a=n;n=[],a.forEach(s)}n={push:function(o){return s(o)},filter:function(){return n}}},assignMedium:function(s){r=!0;var a=[];if(n.length){var o=n;n=[],o.forEach(s),a=n}var l=function(){var u=a;a=[],u.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(u){a.push(u),c()},filter:function(u){return a=a.filter(u),n}}}};return i}function hRe(t){t===void 0&&(t={});var e=dRe(null);return e.options=qc({async:!0,ssr:!1},t),e}var HX=function(t){var e=t.sideCar,n=GX(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return I.createElement(r,qc({},n))};HX.isSideCarExport=!0;function fRe(t,e){return t.useMedium(e),HX}var KX=hRe(),aE=function(){},GT=I.forwardRef(function(t,e){var n=I.useRef(null),r=I.useState({onScrollCapture:aE,onWheelCapture:aE,onTouchMoveCapture:aE}),i=r[0],s=r[1],a=t.forwardProps,o=t.children,l=t.className,c=t.removeScrollBar,u=t.enabled,d=t.shards,f=t.sideCar,h=t.noRelative,p=t.noIsolation,m=t.inert,g=t.allowPinchZoom,v=t.as,_=v===void 0?"div":v,b=t.gapMode,x=GX(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),T=f,N=cRe([n,e]),A=qc(qc({},x),i);return I.createElement(I.Fragment,null,u&&I.createElement(T,{sideCar:KX,removeScrollBar:c,shards:d,noRelative:h,noIsolation:p,inert:m,setCallbacks:s,allowPinchZoom:!!g,lockRef:n,gapMode:b}),a?I.cloneElement(I.Children.only(o),qc(qc({},A),{ref:N})):I.createElement(_,qc({},A,{className:l,ref:N}),o))});GT.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};GT.classNames={fullWidth:wx,zeroRight:_x};var pRe=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function mRe(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=pRe();return e&&t.setAttribute("nonce",e),t}function gRe(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function vRe(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var yRe=function(){var t=0,e=null;return{add:function(n){t==0&&(e=mRe())&&(gRe(e,n),vRe(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},_Re=function(){var t=yRe();return function(e,n){I.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},JX=function(){var t=_Re(),e=function(n){var r=n.styles,i=n.dynamic;return t(r,i),null};return e},wRe={left:0,top:0,right:0,gap:0},oE=function(t){return parseInt(t||"",10)||0},bRe=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],i=e[t==="padding"?"paddingRight":"marginRight"];return[oE(n),oE(r),oE(i)]},xRe=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return wRe;var e=bRe(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},kRe=JX(),tv="data-scroll-locked",SRe=function(t,e,n,r){var i=t.left,s=t.top,a=t.right,o=t.gap;return n===void 0&&(n="margin"),` 535 .`.concat(sRe,` { 536 overflow: hidden `).concat(r,`; 537 padding-right: `).concat(o,"px ").concat(r,`; 538 } 539 body[`).concat(tv,`] { 540 overflow: hidden `).concat(r,`; 541 overscroll-behavior: contain; 542 `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&` 543 padding-left: `.concat(i,`px; 544 padding-top: `).concat(s,`px; 545 padding-right: `).concat(a,`px; 546 margin-left:0; 547 margin-top:0; 548 margin-right: `).concat(o,"px ").concat(r,`; 549 `),n==="padding"&&"padding-right: ".concat(o,"px ").concat(r,";
549")].filter(Boolean).join(""),` 550 } 551 552 .`).concat(_x,` { 553 right: `).concat(o,"px ").concat(r,`; 554 } 555 556 .`).concat(wx,` { 557 margin-right: `).concat(o,"px ").concat(r,`; 558 } 559 560 .`).concat(_x," .").concat(_x,` { 561 right: 0 `).concat(r,`; 562 } 563 564 .`).concat(wx," .").concat(wx,` { 565 margin-right: 0 `).concat(r,`; 566 } 567 568 body[`).concat(tv,`] { 569 `).concat(aRe,": ").concat(o,`px; 570 } 571`)},LB=function(){var t=parseInt(document.body.getAttribute(tv)||"0",10);return isFinite(t)?t:0},TRe=function(){I.useEffect(function(){return document.body.setAttribute(tv,(LB()+1).toString()),function(){var t=LB()-1;t<=0?document.body.removeAttribute(tv):document.body.setAttribute(tv,t.toString())}},[])},CRe=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;TRe();var s=I.useMemo(function(){return xRe(i)},[i]);return I.createElement(kRe,{styles:SRe(s,!e,i,n?"":"!important")})},lN=!1;if(typeof window<"u")try{var u2=Object.defineProperty({},"passive",{get:function(){return lN=!0,!0}});window.addEventListener("test",u2,u2),window.removeEventListener("test",u2,u2)}catch{lN=!1}var eg=lN?{passive:!1}:!1,ERe=function(t){return t.tagName==="TEXTAREA"},YX=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!ERe(t)&&n[e]==="visible")},ARe=function(t){return YX(t,"overflowY")},PRe=function(t){return YX(t,"overflowX")},OB=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=XX(t,r);if(i){var s=QX(t,r),a=s[1],o=s[2];if(a>o)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},MRe=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},NRe=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},XX=function(t,e){return t==="v"?ARe(e):PRe(e)},QX=function(t,e){return t==="v"?MRe(e):NRe(e)},RRe=function(t,e){return t==="h"&&e==="rtl"?-1:1},IRe=function(t,e,n,r,i){var s=RRe(t,window.getComputedStyle(e).direction),a=s*r,o=n.target,l=e.contains(o),c=!1,u=a>0,d=0,f=0;do{if(!o)break;var h=QX(t,o),p=h[0],m=h[1],g=h[2],v=m-g-s*p;(p||v)&&XX(t,o)&&(d+=v,f+=p);var _=o.parentNode;o=_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE?_.host:_}while(!l&&o!==document.body||l&&(e.contains(o)||e===o));return(u&&(Math.abs(d)<1||!i)||!u&&(Math.abs(f)<1||!i))&&(c=!0),c},d2=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},DB=function(t){return[t.deltaX,t.deltaY]},FB=function(t){return t&&"current"in t?t.current:t},LRe=function(t,e){return t[0]===e[0]&&t[1]===e[1]},ORe=function(t){return` 572 .block-interactivity-`.concat(t,` {pointer-events: none;} 573 .allow-interactivity-`).concat(t,` {pointer-events: all;} 574`)},DRe=0,tg=[];function FRe(t){var e=I.useRef([]),n=I.useRef([0,0]),r=I.useRef(),i=I.useState(DRe++)[0],s=I.useState(JX)[0],a=I.useRef(t);I.useEffect(function(){a.current=t},[t]),I.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var m=iRe([t.lockRef.current],(t.shards||[]).map(FB),!0).filter(Boolean);return m.forEach(function(g){return g.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),m.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var o=I.useCallback(function(m,g){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!a.current.allowPinchZoom;var v=d2(m),_=n.current,b="deltaX"in m?m.deltaX:_[0]-v[0],x="deltaY"in m?m.deltaY:_[1]-v[1],T,N=m.target,A=Math.abs(b)>Math.abs(x)?"h":"v";if("touches"in m&&A==="h"&&N.type==="range")return!1;var L=OB(A,N);if(!L)return!0;if(L?T=A:(T=A==="v"?"h":"v",L=OB(A,N)),!L)return!1;if(!r.current&&"changedTouches"in m&&(b||x)&&(r.current=T),!T)return!0;var M=r.current||T;return IRe(M,g,m,M==="h"?b:x,!0)},[]),l=I.useCallback(function(m){var g=m;if(!(!tg.length||tg[tg.length-1]!==s)){var v="deltaY"in g?DB(g):d2(g),_=e.current.filter(function(T){return T.name===g.type&&(T.target===g.target||g.target===T.shadowParent)&&LRe(T.delta,v)}
vendor: 4,570 bytes, line 574
574)[0];if(_&&_.should){g.cancelable&&g.preventDefault();return}if(!_){var b=(a.current.shards||[]).map(FB).filter(Boolean).filter(function(T){return T.contains(g.target)}),x=b.length>0?o(g,b[0]):!a.current.noIsolation;x&&g.cancelable&&g.preventDefault()}}},[]),c=I.useCallback(function(m,g,v,_){var b={name:m,delta:g,target:v,should:_,shadowParent:jRe(v)};e.current.push(b),setTimeout(function(){e.current=e.current.filter(function(x){return x!==b})},1)},[]),u=I.useCallback(function(m){n.current=d2(m),r.current=void 0},[]),d=I.useCallback(function(m){c(m.type,DB(m),m.target,o(m,t.lockRef.current))},[]),f=I.useCallback(function(m){c(m.type,d2(m),m.target,o(m,t.lockRef.current))},[]);I.useEffect(function(){return tg.push(s),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",l,eg),document.addEventListener("touchmove",l,eg),document.addEventListener("touchstart",u,eg),function(){tg=tg.filter(function(m){return m!==s}),document.removeEventListener("wheel",l,eg),document.removeEventListener("touchmove",l,eg),document.removeEventListener("touchstart",u,eg)}},[]);var h=t.removeScrollBar,p=t.inert;return I.createElement(I.Fragment,null,p?I.createElement(s,{styles:ORe(i)}):null,h?I.createElement(CRe,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function jRe(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const BRe=fRe(KX,FRe);var ZX=I.forwardRef(function(t,e){return I.createElement(GT,qc({},t,{ref:e,sideCar:BRe}))});ZX.classNames=GT.classNames;var URe=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},ng=new WeakMap,h2=new WeakMap,f2={},lE=0,eQ=function(t){return t&&(t.host||eQ(t.parentNode))},zRe=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=eQ(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},$Re=function(t,e,n,r){var i=zRe(e,Array.isArray(t)?t:[t]);f2[n]||(f2[n]=new WeakMap);var s=f2[n],a=[],o=new Set,l=new Set(i),c=function(d){!d||o.has(d)||(o.add(d),c(d.parentNode))};i.forEach(c);var u=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(f){if(o.has(f))u(f);else try{var h=f.getAttribute(r),p=h!==null&&h!=="false",m=(ng.get(f)||0)+1,g=(s.get(f)||0)+1;ng.set(f,m),s.set(f,g),a.push(f),m===1&&p&&h2.set(f,!0),g===1&&f.setAttribute(n,"true"),p||f.setAttribute(r,"true")}catch(v){console.error("aria-hidden: cannot operate on ",f,v)}})};return u(e),o.clear(),lE++,function(){a.forEach(function(d){var f=ng.get(d)-1,h=s.get(d)-1;ng.set(d,f),s.set(d,h),f||(h2.has(d)||d.removeAttribute(r),h2.delete(d)),h||d.removeAttribute(n)}),lE--,lE||(ng=new WeakMap,ng=new WeakMap,h2=new WeakMap,f2={})}},VRe=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=URe(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),$Re(r,i,n,"aria-hidden")):function(){return null}},HT="Dialog",[tQ,d7e]=lf(HT),[qRe,hc]=tQ(HT),nQ=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:a=!0}=t,o=I.useRef(null),l=I.useRef(null),[c,u]=i1({prop:r,defaultProp:i??!1,onChange:s,caller:HT});return w.jsx(qRe,{scope:e,triggerRef:o,contentRef:l,contentId:ix(),titleId:ix(),descriptionId:ix(),open:c,onOpenChange:u,onOpenToggle:I.useCallback(()=>u(d=>!d),[u]),modal:a,children:n})};nQ.displayName=HT;var rQ="DialogTrigger",WRe=I.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=hc(rQ,n),s=ri(e,i.triggerRef);return w.jsx(Jn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":rO(i.open),...r,ref:s,onClick:Hn(t.onClick,i.onOpenToggle)})});WRe.displayName=rQ;var tO="DialogPortal",[GRe,iQ]=tQ(tO,{forceMount:void 0}),sQ=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,s=hc(tO,e);return w.jsx(GRe,{scope:e,forceMount:n,children:I.Children.map(r,a=>w.jsx(Zv,{present:n||s.open,children:w.jsx(aR,{asChild:!0,container:i,children:a})}))})};sQ.displayName=tO;var iS="DialogOverlay",aQ=I.forwardRef((t,e)=>{const n=iQ(iS,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=hc(iS,t.__scopeDialog);return s.modal?w.jsx(Zv,{present:r||s.open,children:w.jsx(KRe,{...i,ref:e})}):null});aQ.displayName=iS;var HRe=iw("DialogOverlay.RemoveScroll"),KRe=I.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=hc(iS,n);return w.jsx(ZX,{as:HRe,allowPinchZoom:!0,shards:[i.contentRef],children:w.jsx(Jn.div,{"data-state":rO(i.open
vendor: 4,843 bytes, lines 574-578
574),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),Vp="DialogContent",oQ=I.forwardRef((t,e)=>{const n=iQ(Vp,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=hc(Vp,t.__scopeDialog);return w.jsx(Zv,{present:r||s.open,children:s.modal?w.jsx(JRe,{...i,ref:e}):w.jsx(YRe,{...i,ref:e})})});oQ.displayName=Vp;var JRe=I.forwardRef((t,e)=>{const n=hc(Vp,t.__scopeDialog),r=I.useRef(null),i=ri(e,n.contentRef,r);return I.useEffect(()=>{const s=r.current;if(s)return VRe(s)},[]),w.jsx(lQ,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Hn(t.onCloseAutoFocus,s=>{var a;s.preventDefault(),(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:Hn(t.onPointerDownOutside,s=>{const a=s.detail.originalEvent,o=a.button===0&&a.ctrlKey===!0;(a.button===2||o)&&s.preventDefault()}),onFocusOutside:Hn(t.onFocusOutside,s=>s.preventDefault())})}),YRe=I.forwardRef((t,e)=>{const n=hc(Vp,t.__scopeDialog),r=I.useRef(!1),i=I.useRef(!1);return w.jsx(lQ,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,o;(a=t.onCloseAutoFocus)==null||a.call(t,s),s.defaultPrevented||(r.current||(o=n.triggerRef.current)==null||o.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,c;(l=t.onInteractOutside)==null||l.call(t,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const a=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),lQ=I.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...a}=t,o=hc(Vp,n),l=I.useRef(null),c=ri(e,l);return rRe(),w.jsxs(w.Fragment,{children:[w.jsx(qX,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:w.jsx(GS,{role:"dialog",id:o.contentId,"aria-describedby":o.descriptionId,"aria-labelledby":o.titleId,"data-state":rO(o.open),...a,ref:c,onDismiss:()=>o.onOpenChange(!1)})}),w.jsxs(w.Fragment,{children:[w.jsx(XRe,{titleId:o.titleId}),w.jsx(ZRe,{contentRef:l,descriptionId:o.descriptionId})]})]})}),nO="DialogTitle",cQ=I.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=hc(nO,n);return w.jsx(Jn.h2,{id:i.titleId,...r,ref:e})});cQ.displayName=nO;var uQ="DialogDescription",dQ=I.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=hc(uQ,n);return w.jsx(Jn.p,{id:i.descriptionId,...r,ref:e})});dQ.displayName=uQ;var hQ="DialogClose",fQ=I.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=hc(hQ,n);return w.jsx(Jn.button,{type:"button",...r,ref:e,onClick:Hn(t.onClick,()=>i.onOpenChange(!1))})});fQ.displayName=hQ;function rO(t){return t?"open":"closed"}var pQ="DialogTitleWarning",[h7e,mQ]=Pse(pQ,{contentName:Vp,titleName:nO,docsSlug:"dialog"}),XRe=({titleId:t})=>{const e=mQ(pQ),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users. 575 576If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component. 577 578For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return I.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},QRe="DialogDescriptionWarning",ZRe=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${mQ(QRe).contentName}}.`;return I.useEffect(()=>{var s;const i=(s=t.current)==null?void 0:s.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},eIe=nQ,tIe=sQ,gQ=aQ,vQ=oQ,yQ=cQ,_Q=dQ,nIe=fQ;const rIe=eIe,iIe=tIe,wQ=I.forwardRef(({className:t,...e},n)=>w.jsx(gQ,{className:vt("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:n}));wQ.displayName=gQ.displayName;const sIe=a1("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),bQ=I.forwardRef(({side:t="right",className:e,children:n,...r},i)=>w.jsxs(iIe,{children:[w.jsx(wQ,{}),w.jsxs(vQ,{ref:i,className:vt(sIe({side:t}),e),...r,children:[n,w.jsxs(nIe,{className:"absolute right-4 top-4 roun
578ded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-secondary hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[w.jsx(vR,{className:"h-4 w-4"}),w.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));bQ.displayName=vQ.displayName;const aIe=I.forwardRef(({className:t,...e},n)=>w.jsx(yQ,{ref:n,className:vt("text-lg font-semibold text-foreground",t),...e}));aIe.displayName=yQ.displayName;const oIe=I.forwardRef(({className:t,...e},n)=>w.jsx(_Q,{ref:n,className:vt("text-sm text-muted-foreground",t),...e}));oIe.displayName=_Q.displayName;function jB({className:t,...e}){return w.jsx("div",{className:vt("animate-pulse rounded-md bg-muted",t),...e})}const lIe="sidebar:state",cIe=60*60*24*7,uIe="16rem",dIe="18rem",hIe="3rem",fIe="b",xQ=I.createContext(null);function A1(){const t=I.useContext(xQ);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}const hf=I.forwardRef(({defaultOpen:t=!0,open:e,onOpenChange:n,className:r,style:i,children:s,...a},o)=>{const l=G3e(),[c,u]=I.useState(!1),[d,f]=I.useState(t),h=e??d,p=I.useCallback(_=>{const b=typeof _=="function"?_(h):_;n?n(b):f(b),document.cookie=`${lIe}=${b}; path=/; max-age=${cIe}`},[n,h]),m=I.useCallback(()=>l?u(_=>!_):p(_=>!_),[l,p,u]);I.useEffect(()=>{const _=b=>{b.key===fIe&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),m())};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[m]);const g=h?"expanded":"collapsed",v=I.useMemo(()=>({state:g,open:h,setOpen:p,isMobile:l,openMobile:c,setOpenMobile:u,toggleSidebar:m}),[g,h,p,l,c,u,m]);return w.jsx(xQ.Provider,{value:v,children:w.jsx(jq,{delayDuration:0,children:w.jsx("div",{style:{"--sidebar-width":uIe,"--sidebar-width-icon":hIe,...i},className:vt("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar",r),ref:o,...a,children:s})})})});hf.displayName="SidebarProvider";const kQ=I.forwardRef(({side:t="left",variant:e="sidebar",collapsible:n="offcanvas",className:r,children:i,...s},a)=>{const{isMobile:o,state:l,openMobile:c,setOpenMobile:u}=A1();return n==="none"?w.jsx("div",{className:vt("flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",r),ref:a,...s,children:i}):o?w.jsx(rIe,{open:c,onOpenChange:u,...s,children:w.jsx(bQ,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":dIe},side:t,children:w.jsx("div",{className:"flex h-full w-full flex-col",children:i})})}):w.jsxs("div",{ref:a,className:"group peer hidden text-sidebar-foreground md:block","data-state":l,"data-collapsible":l==="collapsed"?n:"","data-variant":e,"data-side":t,children:[w.jsx("div",{className:vt("relative h-svh w-[--sidebar-width] bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",e==="floating"||e==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon]")}),w.jsx("div",{className:vt("fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] duration-200 ease-linear md:flex",t==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",e==="floating"||e==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",r),...s,children:w.jsx("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow",children:i})})]})});kQ.displayName="Sidebar";const pIe=I.forwardRef(({className:t,onClick:e,...n},r)=>{const{toggleSidebar:i}=A1();return w.jsxs($t,{ref:r,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:vt("h-7 w-7",t),onClick:s=>{e==null||e(s),i()},...n,children:[w.jsx(Uae,{}),w.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});pIe.displayName="SidebarTrigger";const mIe=I.forwardRef(({className:t,...e},n)=>{const{toggleSidebar:r}=A1();return w.jsx("button",{ref:n,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:r,title:"Toggle Sidebar",className:vt("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] group-data-[side=left]:-right-4 group-data-[side=right]:left-0 hover:after:bg-sidebar-border sm:flex","[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",t),...e})});mIe.displayName="SidebarRail";const gIe=I.forwardRef(({className:t,...e},n)=>w.jsx("main",{ref:n,className:vt("relative flex min-h-svh flex-1 flex-col bg-background","peer-data-[variant=inset]:min-
578h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",t),...e}));gIe.displayName="SidebarInset";const vIe=I.forwardRef(({className:t,...e},n)=>w.jsx(kr,{ref:n,"data-sidebar":"input",className:vt("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",t),...e}));vIe.displayName="SidebarInput";const SQ=I.forwardRef(({className:t,...e},n)=>w.jsx("div",{ref:n,"data-sidebar":"header",className:vt("flex flex-col gap-2 p-2",t),...e}));SQ.displayName="SidebarHeader";const TQ=I.forwardRef(({className:t,...e},n)=>w.jsx("div",{ref:n,"data-sidebar":"footer",className:vt("flex flex-col gap-2 p-2",t),...e}));TQ.displayName="SidebarFooter";const yIe=I.forwardRef(({className:t,...e},n)=>w.jsx(VX,{ref:n,"data-sidebar":"separator",className:vt("mx-2 w-auto bg-sidebar-border",t),...e}));yIe.displayName="SidebarSeparator";const CQ=I.forwardRef(({className:t,...e},n)=>w.jsx("div",{ref:n,"data-sidebar":"content",className:vt("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",t),...e}));CQ.displayName="SidebarContent";const bx=I.forwardRef(({className:t,...e},n)=>w.jsx("div",{ref:n,"data-sidebar":"group",className:vt("relative flex w-full min-w-0 flex-col p-2",t),...e}));bx.displayName="SidebarGroup";const xx=I.forwardRef(({className:t,asChild:e=!1,...n},r)=>{const i=e?Qv:"div";return w.jsx(i,{ref:r,"data-sidebar":"group-label",className:vt("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opa] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",t),...n})});xx.displayName="SidebarGroupLabel";const _Ie=I.forwardRef(({className:t,asChild:e=!1,...n},r)=>{const i=e?Qv:"button";return w.jsx(i,{ref:r,"data-sidebar":"group-action",className:vt("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",t),...n})});_Ie.displayName="SidebarGroupAction";const kx=I.forwardRef(({className:t,...e},n)=>w.jsx("div",{ref:n,"data-sidebar":"group-content",className:vt("w-full text-sm",t),...e}));kx.displayName="SidebarGroupContent";const Sx=I.forwardRef(({className:t,...e},n)=>w.jsx("ul",{ref:n,"data-sidebar":"menu",className:vt("flex w-full min-w-0 flex-col gap-1",t),...e}));Sx.displayName="SidebarMenu";const Tx=I.forwardRef(({className:t,...e},n)=>w.jsx("li",{ref:n,"data-sidebar":"menu-item",className:vt("group/menu-item relative",t),...e}));Tx.displayName="SidebarMenuItem";const wIe=a1("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"default",size:"default"}}),Cx=I.forwardRef(({asChild:t=!1,isActive:e=!1,variant:n="default",size:r="default",tooltip:i,className:s,...a},o)=>{const l=t?Qv:"button",{isMobile:c,state:u}=A1(),d=w.jsx(l,{ref:o,"data-sidebar":"menu-button","data-size":r,"data-active":e,className:vt(wIe({variant:n,size:r}),s),...a}
578);return i?(typeof i=="string"&&(i={children:i}),w.jsxs(zce,{children:[w.jsx($ce,{asChild:!0,children:d}),w.jsx(Bq,{side:"right",align:"center",hidden:u!=="collapsed"||c,...i})]})):d});Cx.displayName="SidebarMenuButton";const bIe=I.forwardRef(({className:t,asChild:e=!1,showOnHover:n=!1,...r},i)=>{const s=e?Qv:"button";return w.jsx(s,{ref:i,"data-sidebar":"menu-action",className:vt("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform peer-hover/menu-button:text-sidebar-accent-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",n&&"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",t),...r})});bIe.displayName="SidebarMenuAction";const xIe=I.forwardRef(({className:t,...e},n)=>w.jsx("div",{ref:n,"data-sidebar":"menu-badge",className:vt("pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",t),...e}));xIe.displayName="SidebarMenuBadge";const kIe=I.forwardRef(({className:t,showIcon:e=!1,...n},r)=>{const i=I.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return w.jsxs("div",{ref:r,"data-sidebar":"menu-skeleton",className:vt("flex h-8 items-center gap-2 rounded-md px-2",t),...n,children:[e&&w.jsx(jB,{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),w.jsx(jB,{className:"h-4 max-w-[--skeleton-width] flex-1","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":i}})]})});kIe.displayName="SidebarMenuSkeleton";const SIe=I.forwardRef(({className:t,...e},n)=>w.jsx("ul",{ref:n,"data-sidebar":"menu-sub",className:vt("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",t),...e}));SIe.displayName="SidebarMenuSub";const TIe=I.forwardRef(({...t},e)=>w.jsx("li",{ref:e,...t}));TIe.displayName="SidebarMenuSubItem";const CIe=I.forwardRef(({asChild:t=!1,size:e="md",isActive:n,className:r,...i},s)=>{const a=t?Qv:"a";return w.jsx(a,{ref:s,"data-sidebar":"menu-sub-button","data-size":e,"data-active":n,className:vt("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring aria-disabled:pointer-events-none aria-disabled:opacity-50 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",e==="sm"&&"text-xs",e==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",r),...i})});CIe.displayName="SidebarMenuSubButton";const cN=I.forwardRef(({className:t,activeClassName:e,pendingClassName:n,to:r,...i},s)=>w.jsx(fde,{ref:s,to:r,className:({isActive:a,isPending:o})=>vt(t,a&&e,o&&n),...i}));cN.displayName="NavLink";const EIe=[{title:"Dashboard",url:"/dashboard",icon:Dae},{title:"Operations",url:"/operations",icon:uR},{title:"AI Predictions",url:"/predictions",icon:WP},{title:"Machine Learning",url:"/ml",icon:zP},{title:"Job Reports",url:"/reports",icon:yk},{title:"Voice Assistant",url:"/voice-assistant",icon:KV}],AIe=[{title:"Settings",url:"/settings",icon:Vae},{title:"Profile",url:"/profile",icon:_k}];function im(){const{state:t,toggleSidebar:e}=A1(),n=t==="collapsed";return w.jsxs(kQ,{collapsible:"icon",className:"border-r border-border/50 bg-sidebar",children:[w.jsx(SQ,{className:"p-4 border-b border-border/30",children:w.jsx("div",{className:"flex items-center justify-between",children:n?w.jsx("img",{src:VG,alt:"NautIQ",className:"w-8 h-8 object-contain mx-auto"}):w.jsx(f1,{size:"sm"})})}),w.jsxs(CQ,{className:"px-2",children:[w.jsxs(bx,{children:[w.jsx(xx,{className:vt(n&&"sr-only"),children:"Main Navigation"}),w.jsx(kx,{children:w.jsx(Sx,{children:EIe.map(r=>w.jsx(Tx,{children:w.jsx(Cx,{asChild:!0,tooltip:r.title,children:w.jsxs(cN,{to:r.url,className:"flex items-center gap-3 px-3 py-2 rounded-lg text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground transition-all duration-200",activeClassName:"bg-primary/10 text-primary border-l-2 border-primary",children:[w.jsx(r.icon,{className:"w-5 h-5 shrink-0"}),!n&&w.jsx("span",{children:r.title})]})})},r.title))})})]}),w.jsxs(bx,{className:"mt-auto",children:[w.jsx(xx,{className:vt(n&&"sr-only"),children:"Account"}),w.jsx(kx,{children:w.jsx(Sx,{children:AIe.map(r=>w.jsx(Tx,{children:w.jsx(Cx,{asChild:!0,tooltip:r.title,children:w.jsxs(cN,{to:r.url,className:"flex items-center gap-3 px-3 py-2 rounded-lg text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground transition-all duration-200",activeClassName:"bg-primary/10 text-primary",children:[w.jsx(r.icon,{className:"w-5 h-5 shrink-0"}),!n&&w.jsx("span",{children:r.title})]})})},r.title))})})]}),w.jsxs(bx,{children:[w.jsx(xx,{className:vt(n&&"sr-only"),children:"Help"}),w.jsx(kx,{children:w.jsx(Sx,{children:w.jsx(Tx,{children:w.jsx(Cx,{asChild:!0,tooltip:"Support",children:w.jsxs("a",{href:"https://nautiqtechnologies.zendesk.com/hc/en-us/requests/new",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 px-3 py-2 rounded-lg text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground transition-all duration-200",children:[w.jsx(Mae,{className:"w-5 h-5 shrink-0"}),!n&&w.jsx("span",{children:"Support"})]})})})})})]})]}),w.jsx(TQ,{className:"p-2 border-t border-border/30",children:w.jsx($t,{variant:"ghost",size:"icon",onClick:e,className:"w-full flex justify-center",children:n?w.jsx(WV,{className:"w-4 h-4"}):w.jsx(Aae,{className:"w-4 h-4"})})})]})}const PIe=()=>{const[t,e]=I.useState(!0);return w.jsx(hf,{children:w.jsxs("div",{className:"min-h-screen flex w-full",children:[w.jsx(im,{}),w.jsxs("main",{className:"flex-1 overflow-auto",children:[w.jsx("header",{className:"sticky top-0 z-10 bg-background/80 backdrop-blur-xl border-b border-border/50 px-6 py-3",children:w.jsxs("div",{className:"flex items-center justify-between",children:[w.jsxs("div",{className:"flex items-center gap-6",children:[w.jsx("h1",{className:"text-xl font-semibold text-foreground",children:"System Dashboard"}),w.jsxs("div",{className:"flex items-center gap-4",children:[w.jsx(Sh,{status:t?"online":"offline",label:t?"Robot Connected":"Disconnected"}),w.jsx(Sh,{status:"online",label:"Data Link Active"})]})]}),w.jsx("div",{className:"flex items-center gap-3",children:w.jsx($t,{variant:t?"outline":"aqua",onClick:()=>e(!t),children:t?w.jsxs(w.Fragment,{children:[w.jsx(Kae,{className:"w-4 h-4"}),"Disconnect"]}):w.jsxs(w.Fragment,{children:[w.jsx(eq,{className:"w-4 h-4"}),"Connect to Robot"]})})})]})}),w.jsxs("div",{className:"p-6 space-y-6",children:[w.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[w.jsx(Wr,{title:"Live Camera Feed",icon:uR,className:"lg:col-span-2",glowing:!0,delay:0,children:w.jsx(jX,{})}),w.jsx(Wr,{title:"Robot Status",icon:xF,delay:.1,children:w.jsxs("div",{className:"space-y-4",children:[w.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/30 rounded-lg",children:[w.jsxs("div",{className:"flex items-center gap-3",children:[w.jsx(Jae,{className:"w-5 h-5 text-primary"}),w.jsx("span",{className:"text-sm",children:"Robot Arm"})]}),w.jsx(Sh,{status:"online",label:"Active",size:"sm"})]}),w.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/30 rounded-lg",children:[w.jsxs("div",{className:"flex items-center gap-3",children:[w.jsx(Sae,{className:"w-5 h-5 text-success"}),w.jsx("span",{className:"text-sm",children:"Power Level"})]}),w.jsx("span",{className:"text-sm font-medium text-success",children:"87%"})]}),w.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/30 rounded-lg",children:[w.jsxs("div",{className:"flex items-center gap-3",children:[w.jsx(Gae,{className:"w-5 h-5 text-warning"}),w.jsx("span",{className:"text-sm",children:"Temperature"})]}),w.jsx("span",{className:"text-sm font-medium text-warning",children:"42°C"})]}),w.jsxs("div",{className:"pt-3 border-t border-border/50",children:[w.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Available Attachments"}),w.jsx("div",{className:"flex flex-wrap gap-2",children:["Sander","Polisher","Brush","Vacuum"].map(n=>w.jsx("span",{className:"px-2 py-1 text-xs bg-primary/10 text-primary rounded",children:n},n))})]})]})})]}),w.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[w.jsx(Wr,{title:"AI Work Prediction",icon:xF,glowing:!0,delay:.2,children:w.jsxs("div",{className:"space-y-4",children:[w.jsxs("div",{className:"p-4 bg-muted/30 rounded-lg",children:[w.jsx("h4",{className:"text-sm font-medium text-foreground mb-3",children:"Current Surface Analysis"}),w.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[w.jsxs("div",{children:[w.jsx("span",{className:"text-muted-foreground",children:"Condition:"}),w.jsx("span",{className:"ml-2 text-warning font-medium",children:"Moderate Fouling"})]}),w.jsxs("div",{children:[w.jsx("span",{className:"text-muted-foreground",children:"Est. Time:"}),w.jsx("span",{className:"ml-2 text-foreground font-medium",children:"3h 45m"})]}),w.jsxs("div",{children:[w.jsx("span",{className:"text-muted-foreground",children:"Grit Start:"}),w.jsx("span",{className:"ml-2 text-foreground font-medium",children:"80"})]}),w.jsxs("div",{children:[w.jsx("span",{className:"text-muted-foreground",children:"Grit Final:"}),w.jsx("span",{className:"ml-2 text-foreground font-medium",children:"220"})]})]})]}),w.jsxs("div",{className:"space-y-3",children:[w.jsx(wo,{label:"Surface Analysis",value:94}),w.jsx(wo,{label:"Time Estimate",value:87}),w.jsx(wo,{label:"Grit Selection",value:91}),w.jsx(wo,{label:"Effort Prediction",value:78})]}),w.jsxs("div",{className:"flex gap-3 pt-2",children:[w.jsxs($t,{variant:"aqua",className:"flex-1",children:[w.jsx(vk,{className:"w-4 h-4"}),"Approve AI Plan"]}),w.jsxs($t,{variant:"outline",className:"flex-1",children:[w.jsx(pR,{className:"w-4 h-4"}),"Start Task"]})]})]})}),w.jsx(Wr,{title:"Machine Learning Module",icon:$P,delay:.3,children:w.jsxs("div",{className:"space-y-4",children:[w.jsx(BX,{}),w.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[w.jsxs($t,{variant:"navy",size:"sm",children:[w.jsx($P,{className:"w-4 h-4 text-destructive"}),"Record Movement"]}),w.jsxs($t,{variant:"navy",size:"sm",children:[w.jsx(ZV,{className:"w-4 h-4"}),"Upload Motion Data"]}),w.jsxs($t,{variant:"navy",size:"sm",children:[w.jsx(mR,{className:"w-4 h-4"}),"Simulate Motion"]}),w.jsxs($t,{variant:"navy",size:"sm",children:[w.jsx(YV,{className:"w-4 h-4"}),"Optimize Path"]})]}),w.jsxs("div",{className:"p-3 bg-muted/30 rounded-lg text-sm",children:[w.jsxs("div",{className:"flex items-center justify-between mb-2",children:[w.jsx("span",{className:"text-muted-foreground",children:"Model Status"}),w.jsx(Sh,{status:"online",label:"Ready",size:"sm"})]}),w.jsxs("div",{className:"flex items-center justify-between",children:[w.jsx("span",{className:"text-muted-foreground",children:"Training Samples"}),w.jsx("span",{className:"text-foreground font-medium",children:"2,847 motions"})]})]})]})})]}),w.jsx(Wr,{title:"Job Documentation & Service Records",icon:sw,delay:.4,children:w.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[w.jsx("div",{className:"lg:col-span-2",children:w.jsx(UX,{})}),w.jsxs("div",{className:"space-y-4",children:[w.jsxs("div",{className:"p-4 bg-muted/30 rounded-lg",children:[w.jsx("h4",{className:"text-sm font-medium text-foreground mb-3",children:"Qu
578ick Stats"}),w.jsxs("div",{className:"space-y-3 text-sm",children:[w.jsxs("div",{className:"flex justify-between",children:[w.jsx("span",{className:"text-muted-foreground",children:"Jobs This Month"}),w.jsx("span",{className:"font-medium text-foreground",children:"24"})]}),w.jsxs("div",{className:"flex justify-between",children:[w.jsx("span",{className:"text-muted-foreground",children:"Total Hours"}),w.jsx("span",{className:"font-medium text-foreground",children:"89.5h"})]}),w.jsxs("div",{className:"flex justify-between",children:[w.jsx("span",{className:"text-muted-foreground",children:"Boats Serviced"}),w.jsx("span",{className:"font-medium text-foreground",children:"18"})]})]})]}),w.jsxs($t,{variant:"aqua",className:"w-full",children:[w.jsx(sw,{className:"w-4 h-4"}),"Export Service Report"]}),w.jsxs($t,{variant:"outline",className:"w-full",children:[w.jsx(gR,{className:"w-4 h-4"}),"Generate Boat History"]})]})]})})]})]})]})})};function EQ(t,[e,n]){return Math.min(n,Math.max(e,t))}var MIe=I.createContext(void 0);function NIe(t){const e=I.useContext(MIe);return t||e||"ltr"}function AQ(t){const e=I.useRef({value:t,previous:t});return I.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var PQ=["PageUp","PageDown"],MQ=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],NQ={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},A0="Slider",[uN,RIe,IIe]=gV(A0),[RQ,f7e]=lf(A0,[IIe]),[LIe,KT]=RQ(A0),IQ=I.forwardRef((t,e)=>{const{name:n,min:r=0,max:i=100,step:s=1,orientation:a="horizontal",disabled:o=!1,minStepsBetweenThumbs:l=0,defaultValue:c=[r],value:u,onValueChange:d=()=>{},onValueCommit:f=()=>{},inverted:h=!1,form:p,...m}=t,g=I.useRef(new Set),v=I.useRef(0),b=a==="horizontal"?OIe:DIe,[x=[],T]=i1({prop:u,defaultProp:c,onChange:R=>{var $;($=[...g.current][v.current])==null||$.focus(),d(R)}}),N=I.useRef(x);function A(R){const j=zIe(x,R);B(R,j)}function L(R){B(R,v.current)}function M(){const R=N.current[v.current];x[v.current]!==R&&f(x)}function B(R,j,{commit:$}={commit:!1}){const U=WIe(s),te=GIe(Math.round((R-r)/s)*s+r,U),ne=EQ(te,[r,i]);T((le=[])=>{const V=BIe(le,ne,j);if(qIe(V,l*s)){v.current=V.indexOf(ne);const q=String(V)!==String(le);return q&&$&&f(V),q?V:le}else return le})}return w.jsx(LIe,{scope:t.__scopeSlider,name:n,disabled:o,min:r,max:i,valueIndexToChangeRef:v,thumbs:g.current,values:x,orientation:a,form:p,children:w.jsx(uN.Provider,{scope:t.__scopeSlider,children:w.jsx(uN.Slot,{scope:t.__scopeSlider,children:w.jsx(b,{"aria-disabled":o,"data-disabled":o?"":void 0,...m,ref:e,onPointerDown:Hn(m.onPointerDown,()=>{o||(N.current=x)}),min:r,max:i,inverted:h,onSlideStart:o?void 0:A,onSlideMove:o?void 0:L,onSlideEnd:o?void 0:M,onHomeKeyDown:()=>!o&&B(r,0,{commit:!0}),onEndKeyDown:()=>!o&&B(i,x.length-1,{commit:!0}),onStepKeyDown:({event:R,direction:j})=>{if(!o){const te=PQ.includes(R.key)||R.shiftKey&&MQ.includes(R.key)?10:1,ne=v.current,le=x[ne],V=s*te*j;B(le+V,ne,{commit:!0})}}})})})})});IQ.displayName=A0;var[LQ,OQ]=RQ(A0,{startEdge:"left",endEdge:"right",size:"width",direction:1}),OIe=I.forwardRef((t,e)=>{const{min:n,max:r,dir:i,inverted:s,onSlideStart:a,onSlideMove:o,onSlideEnd:l,onStepKeyDown:c,...u}=t,[d,f]=I.useState(null),h=ri(e,b=>f(b)),p=I.useRef(void 0),m=NIe(i),g=m==="ltr",v=g&&!s||!g&&s;function _(b){const x=p.current||d.getBoundingClientRect(),T=[0,x.width],A=iO(T,v?[n,r]:[r,n]);return p.current=x,A(b-x.left)}return w.jsx(LQ,{scope:t.__scopeSlider,startEdge:v?"left":"right",endEdge:v?"right":"left",direction:v?1:-1,size:"width",children:w.jsx(DQ,{dir:m,"data-orientation":"horizontal",...u,ref:h,style:{...u.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:b=>{const x=_(b.clientX);a==null||a(x)},onSlideMove:b=>{const x=_(b.clientX);o==null||o(x)},onSlideEnd:()=>{p.current=void 0,l==null||l()},onStepKeyDown:b=>{const T=NQ[v?"from-left":"from-right"].includes(b.key);c==null||c({event:b,direction:T?-1:1})}})})}),DIe=I.forwardRef((t,e)=>{const{min:n,max:r,inverted:i,onSlideStart:s,onSlideMove:a,onSlideEnd:o,onStepKeyDown:l,...c}=t,u=I.useRef(null),d=ri(e,u),f=I.useRef(void 0),h=!i;function p(m){const g=f.current||u.current.getBoundingClientRect(),v=[0,g.height],b=iO(v,h?[r,n]:[n,r]);return f.current=g,b(m-g.top)}return w.jsx(LQ,{scope:t.__scopeSlider,startEdge:h?"bottom":"top",endEdge:h?"top":"bottom",size:"height",direction:h?1:-1,children:w.jsx(DQ,{"data-orientation":"vertical",...c,ref:d,style:{...c.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:m=>{const g=p(m.clientY);s==null||s(g)},onSlideMove:m=>{const g=p(m.clientY);a==null||a(g)},onSlideEnd:()=>{f.current=void 0,o==null||o()},onStepKeyDown:m=>{const v=NQ[h?"from-bottom":"from-top"].includes(m.key);l==null||l({event:m,direction:v?-1:1})}})})}),DQ=I.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:s,onHomeKeyDown:a,onEndKeyDown:o,onStepKeyDown:l,...c}=t,u=KT(A0,n);return w.jsx(Jn.span,{...c,ref:e,onKeyDown:Hn(t.onKeyDown,d=>{d.key==="Home"?(a(d),d.preventDefault()):d.key==="End"?(o(d),d.preventDefault()):PQ.concat(MQ).includes(d.key)&&(l(d
578),d.preventDefault())}),onPointerDown:Hn(t.onPointerDown,d=>{const f=d.target;f.setPointerCapture(d.pointerId),d.preventDefault(),u.thumbs.has(f)?f.focus():r(d)}),onPointerMove:Hn(t.onPointerMove,d=>{d.target.hasPointerCapture(d.pointerId)&&i(d)}),onPointerUp:Hn(t.onPointerUp,d=>{const f=d.target;f.hasPointerCapture(d.pointerId)&&(f.releasePointerCapture(d.pointerId),s(d))})})}),FQ="SliderTrack",jQ=I.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,i=KT(FQ,n);return w.jsx(Jn.span,{"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation,...r,ref:e})});jQ.displayName=FQ;var dN="SliderRange",BQ=I.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,i=KT(dN,n),s=OQ(dN,n),a=I.useRef(null),o=ri(e,a),l=i.values.length,c=i.values.map(f=>$Q(f,i.min,i.max)),u=l>1?Math.min(...c):0,d=100-Math.max(...c);return w.jsx(Jn.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,...r,ref:o,style:{...t.style,[s.startEdge]:u+"%",[s.endEdge]:d+"%"}})});BQ.displayName=dN;var hN="SliderThumb",UQ=I.forwardRef((t,e)=>{const n=RIe(t.__scopeSlider),[r,i]=I.useState(null),s=ri(e,o=>i(o)),a=I.useMemo(()=>r?n().findIndex(o=>o.ref.current===r):-1,[n,r]);return w.jsx(FIe,{...t,ref:s,index:a})}),FIe=I.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:i,...s}=t,a=KT(hN,n),o=OQ(hN,n),[l,c]=I.useState(null),u=ri(e,_=>c(_)),d=l?a.form||!!l.closest("form"):!0,f=TR(l),h=a.values[r],p=h===void 0?0:$Q(h,a.min,a.max),m=UIe(r,a.values.length),g=f==null?void 0:f[o.size],v=g?$Ie(g,p,o.direction):0;return I.useEffect(()=>{if(l)return a.thumbs.add(l),()=>{a.thumbs.delete(l)}},[l,a.thumbs]),w.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[o.startEdge]:`calc(${p}% + ${v}px)`},children:[w.jsx(uN.ItemSlot,{scope:t.__scopeSlider,children:w.jsx(Jn.span,{role:"slider","aria-label":t["aria-label"]||m,"aria-valuemin":a.min,"aria-valuenow":h,"aria-valuemax":a.max,"aria-orientation":a.orientation,"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,tabIndex:a.disabled?void 0:0,...s,ref:u,style:h===void 0?{display:"none"}:t.style,onFocus:Hn(t.onFocus,()=>{a.valueIndexToChangeRef.current=r})})}),d&&w.jsx(zQ,{name:i??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:h},r)]})});UQ.displayName=hN;var jIe="RadioBubbleInput",zQ=I.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const i=I.useRef(null),s=ri(i,r),a=AQ(e);return I.useEffect(()=>{const o=i.current;if(!o)return;const l=window.HTMLInputElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(a!==e&&u){const d=new Event("input",{bubbles:!0});u.call(o,e),o.dispatchEvent(d)}},[a,e]),w.jsx(Jn.input,{style:{display:"none"},...n,ref:s,defaultValue:e})});zQ.displayName=jIe;function BIe(t=[],e,n){const r=[...t];return r[n]=e,r.sort((i,s)=>i-s)}function $Q(t,e,n){const s=100/(n-e)*(t-e);return EQ(s,[0,100])}function UIe(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function zIe(t,e){if(t.length===1)return 0;const n=t.map(i=>Math.abs(i-e)),r=Math.min(...n);return n.indexOf(r)}function $Ie(t,e,n){const r=t/2,s=iO([0,50],[0,r]);return(r-s(e)*n)*n}function VIe(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function qIe(t,e){if(e>0){const n=VIe(t);return Math.min(...n)>=e}return!0}function iO(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function WIe(t){return(String(t).split(".")[1]||"").length}function GIe(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var VQ=IQ,HIe=jQ,KIe=BQ,JIe=UQ;const fN=I.forwardRef(({className:t,...e},n)=>w.jsxs(VQ,{ref:n,className:vt("relative flex w-full touch-none select-none items-center",t),...e,children:[w.jsx(HIe,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:w.jsx(KIe,{className:"absolute h-full bg-primary"})}),w.jsx(JIe,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));fN.displayName=VQ.displayName;const YIe=()=>
578{const[t,e]=I.useState([50]),[n,r]=I.useState([30]),[i,s]=I.useState(!1);return w.jsx(hf,{children:w.jsxs("div",{className:"min-h-screen flex w-full",children:[w.jsx(im,{}),w.jsxs("main",{className:"flex-1 overflow-auto",children:[w.jsx("header",{className:"sticky top-0 z-10 bg-background/80 backdrop-blur-xl border-b border-border/50 px-6 py-3",children:w.jsxs("div",{className:"flex items-center justify-between",children:[w.jsx("h1",{className:"text-xl font-semibold text-foreground",children:"Robot Operations"}),w.jsxs("div",{className:"flex items-center gap-4",children:[w.jsx(Sh,{status:"online",label:"Robot Ready"}),w.jsx(Sh,{status:"processing",label:"Task Active"})]})]})}),w.jsxs("div",{className:"p-6 space-y-6",children:[w.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[w.jsxs(Wr,{title:"Primary Camera",icon:uR,className:"lg:col-span-2",glowing:!0,children:[w.jsx(jX,{}),w.jsxs("div",{className:"flex items-center justify-center gap-4 mt-4 pt-4 border-t border-border/50",children:[w.jsx($t,{variant:i?"destructive":"aqua",size:"lg",onClick:()=>s(!i),children:i?w.jsxs(w.Fragment,{children:[w.jsx(zae,{className:"w-5 h-5"}),"Pause Operation"]}):w.jsxs(w.Fragment,{children:[w.jsx(pR,{className:"w-5 h-5"}),"Start Operation"]})}),w.jsxs($t,{variant:"outline",size:"lg",children:[w.jsx(XV,{className:"w-5 h-5"}),"Stop"]}),w.jsxs($t,{variant:"navy",size:"lg",children:[w.jsx(qP,{className:"w-5 h-5"}),"Reset Position"]})]})]}),w.jsx(Wr,{title:"Manual Controls",icon:Wae,children:w.jsxs("div",{className:"space-y-6",children:[w.jsxs("div",{children:[w.jsx("h4",{className:"text-sm font-medium text-muted-foreground mb-3",children:"Arm Movement"}),w.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[w.jsx("div",{}),w.jsx($t,{variant:"navy",size:"icon",children:w.jsx(SF,{className:"w-4 h-4 rotate-180"})}),w.jsx("div",{}),w.jsx($t,{variant:"navy",size:"icon",children:w.jsx(kF,{className:"w-4 h-4 rotate-180"})}),w.jsx($t,{variant:"navy",size:"icon",children:w.jsx(Rae,{className:"w-4 h-4"})}),w.jsx($t,{variant:"navy",size:"icon",children:w.jsx(kF,{className:"w-4 h-4"})}),w.jsx("div",{}),w.jsx($t,{variant:"navy",size:"icon",children:w.jsx(SF,{className:"w-4 h-4"})}),w.jsx("div",{})]})]}),w.jsxs("div",{children:[w.jsx("h4",{className:"text-sm font-medium text-muted-foreground mb-3",children:"Rotation"}),w.jsxs("div",{className:"flex justify-center gap-4",children:[w.jsxs($t,{variant:"navy",children:[w.jsx(qP,{className:"w-4 h-4"}),"CCW"]}),w.jsxs($t,{variant:"navy",children:[w.jsx(mR,{className:"w-4 h-4"}),"CW"]})]})]}),w.jsxs("div",{children:[w.jsxs("div",{className:"flex items-center justify-between mb-3",children:[w.jsx("h4",{className:"text-sm font-medium text-muted-foreground",children:"Speed"}),w.jsxs("span",{className:"text-sm text-primary font-medium",children:[t[0],"%"]})]}),w.jsx(fN,{value:t,onValueChange:e,max:100,step:1,className:"w-full"})]}),w.jsxs("div",{children:[w.jsxs("div",{className:"flex items-center justify-between mb-3",children:[w.jsx("h4",{className:"text-sm font-medium text-muted-foreground",children:"Pressure"}),w.jsxs("span",{className:"text-sm text-primary font-medium",children:[n[0]," PSI"]})]}),w.jsx(fN,{value:n,onValueChange:r,max:60,step:1,className:"w-full"})]})]})})]}),w.jsx(Wr,{title:"Live Telemetry",icon:Lae,children:w.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4",children:[{label:"X Position",value:"1,245 mm",status:"normal"},{label:"Y Position",value:"892 mm",status:"normal"},{label:"Z Position",value:"156 mm",status:"normal"},{label:"Rotation",value:"45.2°",status:"normal"},{label:"Motor Load",value:"32%",status:"normal"},{label:"Vibration",value:"0.8 mm/s",status:"warning"}].map((a,o)=>w.jsxs(ar.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:o*.05},className:"p-4 bg-muted/30 rounded-lg text-center",children:[w.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:a.label}),w.jsx("p",{className:`text-lg font-semibold ${a.status==="warning"?"text-warning":"text-foreground"}`,children:a.value})]},a.label))})})]})]})]})})},XIe=[{id:1,area:"Port Hull - Section A",condition:"Heavy Fouling",severity:"high",estimatedTime:"2h 15m",gritStart:60,gritEnd:180,effort:"High",confidence:92},{id:2,area:"Port Hull - Section B",condition:"Moderate Buildup",severity:"medium",estimatedTime:"1h 30m",gritStart:80,gritEnd:220,effort:"Medium",confidence:88},{id:3,area:"Starboard Hull - Section A",condition:"Light Fouling",severity:"low",estimatedTime:"45m",gritStart:120,gritEnd:320,effort:"Low",confidence:95},{id:4,area:"Keel Section",condition:"Heavy Fouling",severity:"high",estimatedTime:"3h 00m",gritStart:40,gritEnd:180,effort:"Ver
578y High",confidence:84}],QIe=()=>{const t=e=>{switch(e){case"high":return"text-destructive bg-destructive/10";case"medium":return"text-warning bg-warning/10";case"low":return"text-success bg-success/10";default:return"text-muted-foreground bg-muted"}};return w.jsx(hf,{children:w.jsxs("div",{className:"min-h-screen flex w-full",children:[w.jsx(im,{}),w.jsxs("main",{className:"flex-1 overflow-auto",children:[w.jsx("header",{className:"sticky top-0 z-10 bg-background/80 backdrop-blur-xl border-b border-border/50 px-6 py-3",children:w.jsxs("div",{className:"flex items-center justify-between",children:[w.jsx("h1",{className:"text-xl font-semibold text-foreground",children:"AI Predictions"}),w.jsxs($t,{variant:"aqua",children:[w.jsx(WP,{className:"w-4 h-4"}),"Run Full Analysis"]})]})}),w.jsxs("div",{className:"p-6 space-y-6",children:[w.jsx("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[{icon:Kg,label:"Total Est. Time",value:"7h 30m",color:"text-primary"},{icon:Oae,label:"Grit Stages",value:"4 passes",color:"text-info"},{icon:CF,label:"Avg. Confidence",value:"89.7%",color:"text-success"},{icon:GP,label:"Efficiency Score",value:"92/100",color:"text-warning"}].map((e,n)=>w.jsxs(ar.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:n*.1},className:"glass-card p-4 flex items-center gap-4",children:[w.jsx("div",{className:`p-3 rounded-lg bg-muted/50 ${e.color}`,children:w.jsx(e.icon,{className:"w-5 h-5"})}),w.jsxs("div",{children:[w.jsx("p",{className:"text-sm text-muted-foreground",children:e.label}),w.jsx("p",{className:"text-xl font-semibold text-foreground",children:e.value})]})]},e.label))}),w.jsx(Wr,{title:"Surface Analysis by Section",icon:WP,glowing:!0,children:w.jsx("div",{className:"space-y-4",children:XIe.map((e,n)=>w.jsxs(ar.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:n*.1},className:"p-4 bg-muted/30 rounded-lg hover:bg-muted/50 transition-colors",children:[w.jsxs("div",{className:"flex items-start justify-between mb-4",children:[w.jsxs("div",{children:[w.jsx("h3",{className:"font-medium text-foreground",children:e.area}),w.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[w.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-medium ${t(e.severity)}`,children:e.condition}),w.jsxs("span",{className:"text-xs text-muted-foreground",children:["Est. ",e.estimatedTime]})]})]}),w.jsx("div",{className:"text-right",children:w.jsxs("div",{className:"flex items-center gap-1",children:[e.confidence>=90?w.jsx(vk,{className:"w-4 h-4 text-success"}):w.jsx(QV,{className:"w-4 h-4 text-warning"}),w.jsxs("span",{className:"text-sm font-medium text-foreground",children:[e.confidence,"% confidence"]})]})})]}),w.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[w.jsxs("div",{children:[w.jsx("span",{className:"text-muted-foreground",children:"Start Grit:"}),w.jsx("span",{className:"ml-2 text-foreground font-medium",children:e.gritStart})]}),w.jsxs("div",{children:[w.jsx("span",{className:"text-muted-foreground",children:"End Grit:"}),w.jsx("span",{className:"ml-2 text-foreground font-medium",children:e.gritEnd})]}),w.jsxs("div",{children:[w.jsx("span",{className:"text-muted-foreground",children:"Effort:"}),w.jsx("span",{className:"ml-2 text-foreground font-medium",children:e.effort})]}),w.jsx("div",{className:"flex justify-end",children:w.jsxs($t,{variant:"outline",size:"sm",children:["Details",w.jsx(o1,{className:"w-3 h-3"})]})})]})]},e.id))})}),w.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[w.jsx(Wr,{title:"Model Confidence Metrics",icon:CF,children:w.jsxs("div",{className:"space-y-4",children:[w.jsx(wo,{label:"Surface Detection Accuracy",value:96}),w.jsx(wo,{label:"Fouling Classification",value:91}),w.jsx(wo,{label:"Time Estimation",value:84}),w.jsx(wo,{label:"Grit Recommendation",value:93}),w.jsx(wo,{label:"Effort Prediction",value:78})]})}),w.jsxs(Wr,{title:"Recommended Action Plan",icon:GP,children:[w.jsx("div",{className:"space-y-3",children:[{step:1,action:"Begin with 60-grit on heavy fouling areas",status:"pending"},{step:2,action:"Progress to 80-grit for moderate sections",status:"pending"},{step:3,action:"Use 120-grit for light fouling zones",status:"pending"},{step:4,action:"Finish with 220-320 grit polish pass",status:"pending"}
578,{step:5,action:"Final inspection and touch-up",status:"pending"}].map(e=>w.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/30 rounded-lg",children:[w.jsx("div",{className:"w-6 h-6 rounded-full bg-primary/20 text-primary flex items-center justify-center text-sm font-medium",children:e.step}),w.jsx("span",{className:"text-sm text-foreground flex-1",children:e.action})]},e.step))}),w.jsxs($t,{variant:"aqua",className:"w-full mt-4",children:[w.jsx(vk,{className:"w-4 h-4"}),"Approve & Start Plan"]})]})]})]})]})]})})};var sO="Progress",aO=100,[ZIe,p7e]=lf(sO),[eLe,tLe]=ZIe(sO),qQ=I.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:i,getValueLabel:s=nLe,...a}=t;(i||i===0)&&!BB(i)&&console.error(rLe(`${i}`,"Progress"));const o=BB(i)?i:aO;r!==null&&!UB(r,o)&&console.error(iLe(`${r}`,"Progress"));const l=UB(r,o)?r:null,c=sS(l)?s(l,o):void 0;return w.jsx(eLe,{scope:n,value:l,max:o,children:w.jsx(Jn.div,{"aria-valuemax":o,"aria-valuemin":0,"aria-valuenow":sS(l)?l:void 0,"aria-valuetext":c,role:"progressbar","data-state":HQ(l,o),"data-value":l??void 0,"data-max":o,...a,ref:e})})});qQ.displayName=sO;var WQ="ProgressIndicator",GQ=I.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,i=tLe(WQ,n);return w.jsx(Jn.div,{"data-state":HQ(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...r,ref:e})});GQ.displayName=WQ;function nLe(t,e){return`${Math.round(t/e*100)}%`}function HQ(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function sS(t){return typeof t=="number"}function BB(t){return sS(t)&&!isNaN(t)&&t>0}function UB(t,e){return sS(t)&&!isNaN(t)&&t<=e&&t>=0}function rLe(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${aO}\`.`}function iLe(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be: 579 - a positive number 580 - less than the value passed to \`max\` (or ${aO} if no \`max\` prop is set) 581 - \`null\` or \`undefined\` if the progress is indeterminate. 582 583Defaulting to \`null\`.`}var KQ=qQ,sLe=GQ;const JQ=I.forwardRef(({className:t,value:e,...n},r)=>w.jsx(KQ,{ref:r,className:vt("relative h-4 w-full overflow-hidden rounded-full bg-secondary",t),...n,children:w.jsx(sLe,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));JQ.displayName=KQ.displayName;const aLe=()=>{const[t,e]=I.useState(!1),[n,r]=I.useState(!1),[i,s]=I.useState(0),a=()=>{r(!0),s(0);const o=setInterval(()=>{s(l=>l>=100?(clearInterval(o),r(!1),100):l+2)},100)};return w.jsx(hf,{children:w.jsxs("div",{className:"min-h-screen flex w-full",children:[w.jsx(im,{}),w.jsxs("main",{className:"flex-1 overflow-auto",children:[w.jsx("header",{className:"sticky top-0 z-10 bg-background/80 backdrop-blur-xl border-b border-border/50 px-6 py-3",children:w.jsxs("div",{className:"flex items-center justify-between",children:[w.jsx("h1",{className:"text-xl font-semibold text-foreground",children:"Machine Learning Module"}),w.jsx("div",{className:"flex items-center gap-4",children:w.jsx(Sh,{status:t?"processing":"online",label:t?"Recording...":"Model Ready"})})]})}),w.jsxs("div",{className:"p-6 space-y-6",children:[w.jsx("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[{icon:VP,label:"Training Samples",value:"2,847",color:"text-primary"},{icon:Nae,label:"Model Version",value:"v3.2.1",color:"text-info"},{icon:GP,label:"Accuracy",value:"94.2%",color:"text-success"},{icon:Yae,label:"Inference Time",value:"12ms",color:"text-warning"}].map((o,l)=>w.jsxs(ar.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:l*.1},className:"glass-card p-4 flex items-center gap-4",children:[w.jsx("div",{className:`p-3 rounded-lg bg-muted/50 ${o.color}`,children:w.jsx(o.icon,{className:"w-5 h-5"})}),w.jsxs("div",{children:[w.jsx("p",{className:"text-sm text-muted-foreground",children:o.label}),w.jsx("p",{className:"text-xl font-semibold text-foreground",children:o.value})]})]},o.label))}),w.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[w.jsxs(Wr,{title:"Trajectory Mapping",icon:YV,glowing:!0,children:[w.jsx(BX,{}),w.jsxs("div",{className:"grid grid-cols-2 gap-3 mt-4",children:[w.jsx($t,{variant:t?"destructive":"aqua",onClick:()=>e(!t),children:t?w.jsxs(w.Fragment,{children:[w.jsx(XV,{className:"w-4 h-4"}),"Stop Recording"]}):w.jsxs(w.Fragment,{children:[w.jsx($P,{className:"w-4 h-4 fill-current"}),"Record Movement"]})}),w.jsxs($t,{variant:"navy",children:[w.jsx(pR,{className:"w-4 h-4"}),"Simulate Motion"]})]})]}),w.jsx(Wr,{title:"Model Training",icon:zP,children:w.jsxs("div",{className:"space-y-6",children:[n&&w.jsxs("div",{className:"p-4 bg-muted/30 rounded-lg",children:[w.jsxs("div",{className:"flex items-center justify-between mb-2",children:[w.jsx("span",{className:"text-sm text-muted-foreground",children:"Training Progress"}),w.jsxs("span",{className:"text-sm font-medium text-primary",children:[i,"%"]})]}),w.jsx(JQ,{value:i,className:"h-2"}),w.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Processing batch 47/50 ⢠ETA: 23 seconds"})]}),w.jsxs("div",{className:"space-y-3",children:[w.jsx(wo,{label:"Path Accuracy",value:94}),w.jsx(wo,{label:"Motion Smoothness",value:89}),w.jsx(wo,{label:"Collision Avoidance",value:98}),w.jsx(wo,{label:"Energy Efficiency",value:82})]}),w.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[w.jsxs($t,{variant:"navy",children:[w.jsx(ZV,{className:"w-4 h-4"}),"Upload Data"]}),w.jsxs($t,{variant:"navy",children:[w.jsx(sw,{className:"w-4 h-4"}),"Export Model"]}),w.jsxs($t,{variant:"navy",children:[w.jsx(mR,{className:"w-4 h-4"}),"Optimize Path"]}),w.jsxs($t,{variant:"aqua",onClick:a,disabled:n,children:[w.jsx(zP,{className:"w-4 h-4"}),n?"Training...":"Train Model"]})]})]})})]}),w.jsx(Wr,{title:"Training History",icon:VP,children:w.jsx("div",{className:"overflow-x-auto",children:w.jsxs("table",{className:"w-full text-sm",children:[w.jsx("thead",{children:w.jsxs("tr",{className:"border-b border-border/50",children:[w.jsx("th",{className:"text-left py-3 px-4 text-muted-foreground font-medium",children:"Session"}),w.jsx("th",{className:"text-left py-3 px-4 text-muted-foreground font-medium",children:"Date"}),w.jsx("th",{className:"text-left py-3 px-4 text-muted-foreground font-medium",children:"Samples"}),w.jsx("th",{className:"text-left py-3 px-4 text-muted-foreground font-medium",children:"Accuracy"}),w.jsx("th",{className:"text-left py-3 px-4 text-muted-foreground font-medium",children:"Status"})]})}),w.jsx("tbody",{children:[{session:"Training #47",date:"Dec 3, 2025",samples:156,accuracy:"94.2%",status:"complete"},{session:"Training #46",date:"Dec 2, 2025",samples:203,accuracy:"93.8%",status:"complete"},{session:"Training #45",date:"Dec 1, 2025",samples:189,accuracy:"92.1%",status:"complete"},{session:"Training #44",date:"Nov 30, 2025",samples:167,accuracy:"91.5%",status:"complete"},{session:"Training #43",date:"Nov 29, 2025",samples:145,accuracy:"90.3%",status:"complete"}].map((o,l)=>w.jsxs(ar.tr,{initial:{opacity:0}
vendor: 4,043 bytes, line 583
583,animate:{opacity:1},transition:{delay:l*.05},className:"border-b border-border/30 hover:bg-muted/20",children:[w.jsx("td",{className:"py-3 px-4 font-medium text-foreground",children:o.session}),w.jsx("td",{className:"py-3 px-4 text-muted-foreground",children:o.date}),w.jsx("td",{className:"py-3 px-4 text-muted-foreground",children:o.samples}),w.jsx("td",{className:"py-3 px-4 text-success font-medium",children:o.accuracy}),w.jsx("td",{className:"py-3 px-4",children:w.jsx("span",{className:"px-2 py-1 bg-success/10 text-success text-xs rounded",children:o.status})})]},o.session))})]})})})]})]})]})})},oLe="modulepreload",lLe=function(t){return"/"+t},zB={},cE=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),o=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=Promise.allSettled(n.map(l=>{if(l=lLe(l),l in zB)return;zB[l]=!0;const c=l.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${u}`))return;const d=document.createElement("link");if(d.rel=c?"stylesheet":oLe,c||(d.as="script"),d.crossOrigin="",d.href=l,o&&d.setAttribute("nonce",o),document.head.appendChild(d),c)return new Promise((f,h)=>{d.addEventListener("load",f),d.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${l}`)))})}))}function s(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return i.then(a=>{for(const o of a||[])o.status==="rejected"&&s(o.reason);return e().catch(s)})};function sr(t){"@babel/helpers - typeof";return sr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},sr(t)}var ac=Uint8Array,xo=Uint16Array,oO=Int32Array,lO=new ac([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,0,0,0]),cO=new ac([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,0,0]),$B=new ac([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),YQ=function(t,e){for(var n=new xo(31),r=0;r<31;++r)n[r]=e+=1<<t[r-1];for(var i=new oO(n[30]),r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)i[s]=s-n[r]<<5|r;return{b:n,r:i}},XQ=YQ(lO,2),cLe=XQ.b,pN=XQ.r;cLe[28]=258,pN[258]=28;var uLe=YQ(cO,0),VB=uLe.r,mN=new xo(32768);for(var Or=0;Or<32768;++Or){var Xd=(Or&43690)>>1|(Or&21845)<<1;Xd=(Xd&52428)>>2|(Xd&13107)<<2,Xd=(Xd&61680)>>4|(Xd&3855)<<4,mN[Or]=((Xd&65280)>>8|(Xd&255)<<8)>>1}var A_=function(t,e,n){for(var r=t.length,i=0,s=new xo(e);i<r;++i)t[i]&&++s[t[i]-1];var a=new xo(e);for(i=1;i<e;++i)a[i]=a[i-1]+s[i-1]<<1;var o;if(n){o=new xo(1<<e);var l=15-e;for(i=0;i<r;++i)if(t[i])for(var c=i<<4|t[i],u=e-t[i],d=a[t[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)o[mN[d]>>l]=c}else for(o=new xo(r),i=0;i<r;++i)t[i]&&(o[i]=mN[a[t[i]-1]++]>>15-t[i]);return o},qp=new ac(288);for(var Or=0;Or<144;++Or)qp[Or]=8;for(var Or=144;Or<256;++Or)qp[Or]=9;for(var Or=256;Or<280;++Or)qp[Or]=7;for(var Or=280;Or<288;++Or)qp[Or]=8;var aS=new ac(32);for(var Or=0;Or<32;++Or)aS[Or]=5;var dLe=A_(qp,9,0),hLe=A_(aS,5,0),QQ=function(t){return(t+7)/8|0},fLe=function(t,e,n){return(n==null||n>t.length)&&(n=t.length),new ac(t.subarray(e,n))},Fu=function(t,e,n){n<<=e&7;var r=e/8|0;t[r]|=n,t[r+1]|=n>>8},Cy=function(t,e,n){n<<=e&7;var r=e/8|0;t[r]|=n,t[r+1]|=n>>8,t[r+2]|=n>>16},uE=function(t,e){for(var n=[],r=0;r<t.length;++r)t[r]&&n.push({s:r,f:t[r]});var i=n.length,s=n.slice();if(!i)return{t:eZ,l:0};if(i==1){var a=new ac(n[0].s+1);return a[n[0].s]=1,{t:a,l:1}}n.sort(function(T,N){return T.f-N.f}),n.push({s:-1,f:25001});var o=n[0],l=n[1],c=0,u=1,d=2;for(n[0]={s:-1,f:o.f+l.f,l:o,r:l};u!=i-1;)o=n[n[c].f<n[d].f?c++:d++],l=n[c!=u&&n[c].f<n[d].f?c++:d++],n[u++]={s:-1,f:o.f+l.f,l:o,r:l};for(var f=s[0].s,r=1;r<i;++r)s[r].s>f&&(f=s[r].s);var h=new xo(f+1),p=gN(n[u-1],h,0);if(p>e){var r=0,m=0,g=p-e,v=1<<g;for(s.sort(function(N,A){return h[A.s]-h[N.s]||N.f-A.f});r<i;++r){var _=s[r].s;if(h[_]>
vendor: 12,187 bytes, lines 583-584
583e)m+=v-(1<<p-h[_]),h[_]=e;else break}for(m>>=g;m>0;){var b=s[r].s;h[b]<e?m-=1<<e-h[b]++-1:++r}for(;r>=0&&m;--r){var x=s[r].s;h[x]==e&&(--h[x],++m)}p=e}return{t:new ac(h),l:p}},gN=function(t,e,n){return t.s==-1?Math.max(gN(t.l,e,n+1),gN(t.r,e,n+1)):e[t.s]=n},qB=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new xo(++e),r=0,i=t[0],s=1,a=function(l){n[r++]=l},o=1;o<=e;++o)if(t[o]==i&&o!=e)++s;else{if(!i&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(i),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(i);s=1,i=t[o]}return{c:n.subarray(0,r),n:e}},Ey=function(t,e){for(var n=0,r=0;r<e.length;++r)n+=t[r]*e[r];return n},ZQ=function(t,e,n){var r=n.length,i=QQ(e+2);t[i]=r&255,t[i+1]=r>>8,t[i+2]=t[i]^255,t[i+3]=t[i+1]^255;for(var s=0;s<r;++s)t[i+s+4]=n[s];return(i+4+r)*8},WB=function(t,e,n,r,i,s,a,o,l,c,u){Fu(e,u++,n),++i[256];for(var d=uE(i,15),f=d.t,h=d.l,p=uE(s,15),m=p.t,g=p.l,v=qB(f),_=v.c,b=v.n,x=qB(m),T=x.c,N=x.n,A=new xo(19),L=0;L<_.length;++L)++A[_[L]&31];for(var L=0;L<T.length;++L)++A[T[L]&31];for(var M=uE(A,7),B=M.t,R=M.l,j=19;j>4&&!B[$B[j-1]];--j);var $=c+5<<3,U=Ey(i,qp)+Ey(s,aS)+a,te=Ey(i,f)+Ey(s,m)+a+14+3*j+Ey(A,B)+2*A[16]+3*A[17]+7*A[18];if(l>=0&&$<=U&&$<=te)return ZQ(e,u,t.subarray(l,l+c));var ne,le,V,q;if(Fu(e,u,1+(te<U)),u+=2,te<U){ne=A_(f,h,0),le=f,V=A_(m,g,0),q=m;var se=A_(B,R,0);Fu(e,u,b-257),Fu(e,u+5,N-1),Fu(e,u+10,j-4),u+=14;for(var L=0;L<j;++L)Fu(e,u+3*L,B[$B[L]]);u+=3*j;for(var he=[_,T],z=0;z<2;++z)for(var J=he[z],L=0;L<J.length;++L){var Y=J[L]&31;Fu(e,u,se[Y]),u+=B[Y],Y>15&&(Fu(e,u,J[L]>>5&127),u+=J[L]>>12)}}else ne=dLe,le=qp,V=hLe,q=aS;for(var L=0;L<o;++L){var de=r[L];if(de>255){var Y=de>>18&31;Cy(e,u,ne[Y+257]),u+=le[Y+257],Y>7&&(Fu(e,u,de>>23&31),u+=lO[Y]);var fe=de&31;Cy(e,u,V[fe]),u+=q[fe],fe>3&&(Cy(e,u,de>>5&8191),u+=cO[fe])}else Cy(e,u,ne[de]),u+=le[de]}return Cy(e,u,ne[256]),u+le[256]},pLe=new oO([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),eZ=new ac(0),mLe=function(t,e,n,r,i,s){var a=s.z||t.length,o=new ac(r+a+5*(1+Math.ceil(a/7e3))+i),l=o.subarray(r,o.length-i),c=s.l,u=(s.r||0)&7;if(e){u&&(l[0]=s.r>>3);for(var d=pLe[e-1],f=d>>13,h=d&8191,p=(1<<n)-1,m=s.p||new xo(32768),g=s.h||new xo(p+1),v=Math.ceil(n/3),_=2*v,b=function(Je){return(t[Je]^t[Je+1]<<v^t[Je+2]<<_)&p},x=new oO(25e3),T=new xo(288),N=new xo(32),A=0,L=0,M=s.i||0,B=0,R=s.w||0,j=0;M+2<a;++M){var $=b(M),U=M&32767,te=g[$];if(m[U]=te,g[$]=U,R<=M){var ne=a-M;if((A>7e3||B>24576)&&(ne>423||!c)){u=WB(t,l,0,x,T,N,L,B,j,M-j,u),B=A=L=0,j=M;for(var le=0;le<286;++le)T[le]=0;for(var le=0;le<30;++le)N[le]=0}var V=2,q=0,se=h,he=U-te&32767;if(ne>2&&$==b(M-he))for(var z=Math.min(f,ne)-1,J=Math.min(32767,M),Y=Math.min(258,ne);he<=J&&--se&&U!=te;){if(t[M+V]==t[M+V-he]){for(var de=0;de<Y&&t[M+de]==t[M+de-he];++de);if(de>V){if(V=de,q=he,de>z)break;for(var fe=Math.min(he,de-2),me=0,le=0;le<fe;++le){var Ce=M-he+le&32767,Ee=m[Ce],Ae=Ce-Ee&32767;Ae>me&&(me=Ae,te=Ce)}}}U=te,te=m[U],he+=U-te&32767}if(q){x[B++]=268435456|pN[V]<<18|VB[q];var De=pN[V]&31,Fe=VB[q]&31;L+=lO[De]+cO[Fe],++T[257+De],++N[Fe],R=M+V,++A}else x[B++]=t[M],++T[t[M]]}}for(M=Math.max(M,R);M<a;++M)x[B++]=t[M],++T[t[M]];u=WB(t,l,c,x,T,N,L,B,j,M-j,u),c||(s.r=u&7|l[u/8|0]<<3,u-=7,s.h=g,s.p=m,s.i=M,s.w=R)}else{for(var M=s.w||0;M<a+c;M+=65535){var Re=M+65535;Re>=a&&(l[u/8|0]=c,Re=a),u=ZQ(l,u+1,t.subarray(M,Re))}s.i=a}return fLe(o,0,r+QQ(u)+i)},tZ=function(){var t=1,e=0;return{p:function(n){for(var r=t,i=e,s=n.length|0,a=0;a!=s;){for(var o=Math.min(a+2655,s);a<o;++a)i+=r+=n[a];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}t=r,e=i},d:function(){return t%=65521,e%=65521,(t&255)<<24|(t&65280)<<8|(e&255)<<8|e>>8}}},gLe=function(t,e,n,r,i){if(!i&&(i={l:1},e.dictionary)){var s=e.dictionary.subarray(-32768),a=new ac(s.length+t.length);a.set(s),a.set(t,s.length),t=a,i.w=s.length}return mLe(t,e.level==null?6:e.level,e.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(t.length)))*1.5):20:12+e.mem,n,r,i)},nZ=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8},vLe=function(t,e){var n=e.level,r=n==0?0:n<6?1:n==9?3:2;if(t[0]=120,t[1]=r<<6|(e.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,e.dictionary){var i=tZ();i.p(e.dictionary),nZ(t,2,i.d())}};function vN(t,e){e||(e={});var n=tZ();n.p(t);var r=gLe(t,e,e.dictionary?6:2,4);return vLe(r,e),nZ(r,r.length-4,n.d()),r}var yLe=typeof TextDecoder<"u"&&new TextDecoder,_Le=0;try{yLe.decode(eZ,{stream:!0}),_Le=1}catch{}function wLe(t){if(Array.isArray(t))return t}function bLe(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,o=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(u){c=!0,i=u}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function GB(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function xLe(t,e){if(t){if(typeof t=="string")return GB(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?GB(t,e):void 0}}function kLe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 584In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function HB(t,e){return wLe(t)||bLe(t,e)||xLe(t,e)||kLe()}function KB(t,e="utf8"){return new TextDecoder(e).decode(t)}const SLe=new TextEncoder;function TLe(t){return SLe.encode(t)}const CLe=1024*8,ELe=(()=>{const t=new Uint8Array(4),e=new Uint32Array(t.buffer);return!((e[0]=1)&t[0])})(),dE={int8:globalThis.Int8Array,uint8:globalThis.Uint8Array,int16:globalThis.Int16Array,uint16:globalThis.Uint16Array,int32:globalThis.Int32Array,uint32:globalThis.Uint32Array,uint64:globalThis.BigUint64Array,int64:globalThis.BigInt64Array,float32:globalThis.Float32Array,float64:globalThis.Float64Array};class uO{constructor(e=CLe,n={}){X(this,"buffer");X(this,"byteLength");X(this,"byteOffset");X(this,"length");X(this,"offset");X(this,"lastWrittenByte");X(this,"littleEndian");X(this,"_data");X(this,"_mark");X(this,"_marks");let r=!1;typeof e=="number"?e=new ArrayBuffer(e):(r=!0,this.lastWrittenByte=e.byteLength);const i=n.offset?n.offset>>>0:0,s=e.byteLength-i;let a=i;(ArrayBuffer.isView(e)||e instanceof uO)&&(e.byteLength!==e.buffer.byteLength&&(a=e.byteOffset+i),e=e.buffer),r?this.lastWrittenByte=s:this.lastWrittenByte=0,this.buffer=e,this.length=s,this.byteLength=s,this.byteOffset=a,this.offset=0,this.littleEndian=!0,this._data=new DataView(this.buffer,a,s),this._mark=0,this._marks=[]}available(e=1){return this.offset+e<=this.length}isLittleEndian(){return this.littleEndian}setLittleEndian(){return this.littleEndian=!0,this}isBigEndian(){return!this.littleEndian}setBigEndian(){return this.littleEndian=!1,this}skip(e=1){return this.offset+=e,this}back(e=1){return this.offset-=e,this}seek(e){return this.offset=e,this}mark(){return this._mark=this.offset,this}reset(){return this.offset=this._mark,this}pushMark(){return this._marks.push(this.offset),this}popMark(){const e=this._marks.pop();if(e===void 0)throw new Error("Mark stack empty");return this.seek(e),this}rewind(){return this.offset=0,this}ensureAvailable(e=1){if(!this.available(e)){const r=(this.offset+e)*2,i=new Uint8Array(r);i.set(new Uint8Array(this.buffer)),this.buffer=i.buffer,this.length=r,this.byteLength=r,this._data=new DataView(this.buffer)}return this}readBoolean(){return this.readUint8()!==0}readInt8(){return this._data.getInt8(this.offset++)}readUint8(){return this._data.getUint8(this.offset++)}readByte(){return this.readUint8()}readBytes(e=1){return this.readArray(e,"uint8")}readArray(e,n){const r=dE[n].BYTES_PER_ELEMENT*e,i=this.byteOffset+this.offset,s=this.buffer.slice(i,i+r);if(this.littleEndian===ELe&&n!=="uint8"&&n!=="int8"){const o=new Uint8Array(this.buffer.slice(i,i+r));o.reverse();const l=new dE[n](o.buffer);return this.offset+=r,l.reverse(),l}const a=new dE[n](s);return this.offset+=r,a}readInt16(){const e=this._data.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}readUint16(){const e=this._data.getUint16(this.offset,this.littleEndian);return this.offset+=2,e}readInt32(){const e=this._data.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}readUint32(){const e=this._data.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}readFloat32(){const e=this._data.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}readFloat64(){const e=this._data.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}readBigInt64(){const e=this._data.getBigInt64(this.offset,this.littleEndian);return this.offset+=8,e}readBigUint64(){const e=this._data.getBigUint64(this.offset,this.littleEndian);return this.offset+=8,e}readChar(){return String.fromCharCode(this.readInt8())}readChars(e=1){let n="";for(let r=0;r<e;r++)n+=this.readChar();return n}readUtf8(e=1){return KB(this.readBytes(e))}decodeText(e=1,n="utf8"){return KB(this.readBytes(e),n)}writeBoolean(e){return this.writeUint8(e?255:0),this}writeInt8(e){return this.ensureAvailable(1),this._data.setInt8(this.offset++,e),this._updateLastWrittenByte(),this}writeUint8(e){return this.ensureAvailable(1),this._data.setUint8(this.offset++,e),this._updateLastWrittenByte(),this}writeByte(e){return this.writeUint8(e)}writeBytes(e){this.ensureAvailable(e.length);for(let n=0;n<e.length;n++)this._data.setUint8(this.offset++,e[n]);return this._updateLastWrittenByte(),this}writeInt16(e){return this.ensureAvailable(2),this._data.setInt16(this.offset,e,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeUint16(e){return this.ensureAvailable(2),this._data.setUint16(this.offset,e,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeInt32(e){return this.ensureAvailable(4),this._data.setInt32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeUint32(e){return this.ensureAvailable(4),this._data.setUint32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat32(e){return this.ensureAvailable(4),this._data.setFloat32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat64(e){return this.ensureAvailable(8),this._data.setFloat64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigInt64(e){return this.ensureAvailable(8),this._data.setBigInt64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigUint64(e){return this.ensureAvailable(8),this._data.setBigUint64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeChar(e){return this.writeUint8(e.charCodeAt(0))}writeChars(e){for(let n=0;n<e.length;n++)this.writeUint8(e.charCodeAt(n));return this}writeUtf8(e){return this.writeBytes(TLe(e))}toArray(){return new Uint8Array(this.buffer,this.byteOffset,this.lastWrittenByte)}getWrittenByteLength(){return this.lastWrittenByte-this.byteOffset}_updateLastWrittenByte(){this.offset>this.lastWrittenByte&&(this.lastWrittenByte=this.offset)}}/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const ALe=4,JB=0,YB=1,PLe=2;function P0(t){let e=t.length;for(;--e>=0;)t[e]=0}const MLe=0,rZ=1,NLe=2,RLe=3,ILe=258,dO=29,P1=256,Mw=P1+1+dO,nv=30,hO=19,iZ=2*Mw+1,mp=15,hE=16,LLe=7,fO=256,sZ=16,aZ=17,oZ=18,yN=new Uint8Array([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]),Ex=new Uint8Array([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]),OLe=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),lZ=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),DLe=512,Ku=new Array((Mw+2)*2);P0(Ku);const P_=new Array(nv*2);P0(P_);const Nw=new Array(DLe);P0(Nw);const Rw=new Array(ILe-RLe+1);P0(Rw);const pO=new Array(dO);P0(pO);const oS=new Array(nv);P0(oS);function fE(t,e,n,r,i){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=t&&t.length}let cZ,uZ,dZ;function pE(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}
vendor: 27,119 bytes, line 584
584const hZ=t=>t<256?Nw[t]:Nw[256+(t>>>7)],Iw=(t,e)=>{t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255},qa=(t,e,n)=>{t.bi_valid>hE-n?(t.bi_buf|=e<<t.bi_valid&65535,Iw(t,t.bi_buf),t.bi_buf=e>>hE-t.bi_valid,t.bi_valid+=n-hE):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=n)},Wc=(t,e,n)=>{qa(t,n[e*2],n[e*2+1])},fZ=(t,e)=>{let n=0;do n|=t&1,t>>>=1,n<<=1;while(--e>0);return n>>>1},FLe=t=>{t.bi_valid===16?(Iw(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=t.bi_buf&255,t.bi_buf>>=8,t.bi_valid-=8)},jLe=(t,e)=>{const n=e.dyn_tree,r=e.max_code,i=e.stat_desc.static_tree,s=e.stat_desc.has_stree,a=e.stat_desc.extra_bits,o=e.stat_desc.extra_base,l=e.stat_desc.max_length;let c,u,d,f,h,p,m=0;for(f=0;f<=mp;f++)t.bl_count[f]=0;for(n[t.heap[t.heap_max]*2+1]=0,c=t.heap_max+1;c<iZ;c++)u=t.heap[c],f=n[n[u*2+1]*2+1]+1,f>l&&(f=l,m++),n[u*2+1]=f,!(u>r)&&(t.bl_count[f]++,h=0,u>=o&&(h=a[u-o]),p=n[u*2],t.opt_len+=p*(f+h),s&&(t.static_len+=p*(i[u*2+1]+h)));if(m!==0){do{for(f=l-1;t.bl_count[f]===0;)f--;t.bl_count[f]--,t.bl_count[f+1]+=2,t.bl_count[l]--,m-=2}while(m>0);for(f=l;f!==0;f--)for(u=t.bl_count[f];u!==0;)d=t.heap[--c],!(d>r)&&(n[d*2+1]!==f&&(t.opt_len+=(f-n[d*2+1])*n[d*2],n[d*2+1]=f),u--)}},pZ=(t,e,n)=>{const r=new Array(mp+1);let i=0,s,a;for(s=1;s<=mp;s++)i=i+n[s-1]<<1,r[s]=i;for(a=0;a<=e;a++){let o=t[a*2+1];o!==0&&(t[a*2]=fZ(r[o]++,o))}},BLe=()=>{let t,e,n,r,i;const s=new Array(mp+1);for(n=0,r=0;r<dO-1;r++)for(pO[r]=n,t=0;t<1<<yN[r];t++)Rw[n++]=r;for(Rw[n-1]=r,i=0,r=0;r<16;r++)for(oS[r]=i,t=0;t<1<<Ex[r];t++)Nw[i++]=r;for(i>>=7;r<nv;r++)for(oS[r]=i<<7,t=0;t<1<<Ex[r]-7;t++)Nw[256+i++]=r;for(e=0;e<=mp;e++)s[e]=0;for(t=0;t<=143;)Ku[t*2+1]=8,t++,s[8]++;for(;t<=255;)Ku[t*2+1]=9,t++,s[9]++;for(;t<=279;)Ku[t*2+1]=7,t++,s[7]++;for(;t<=287;)Ku[t*2+1]=8,t++,s[8]++;for(pZ(Ku,Mw+1,s),t=0;t<nv;t++)P_[t*2+1]=5,P_[t*2]=fZ(t,5);cZ=new fE(Ku,yN,P1+1,Mw,mp),uZ=new fE(P_,Ex,0,nv,mp),dZ=new fE(new Array(0),OLe,0,hO,LLe)},mZ=t=>{let e;for(e=0;e<Mw;e++)t.dyn_ltree[e*2]=0;for(e=0;e<nv;e++)t.dyn_dtree[e*2]=0;for(e=0;e<hO;e++)t.bl_tree[e*2]=0;t.dyn_ltree[fO*2]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},gZ=t=>{t.bi_valid>8?Iw(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},XB=(t,e,n,r)=>{const i=e*2,s=n*2;return t[i]<t[s]||t[i]===t[s]&&r[e]<=r[n]},mE=(t,e,n)=>{const r=t.heap[n];let i=n<<1;for(;i<=t.heap_len&&(i<t.heap_len&&XB(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!XB(e,r,t.heap[i],t.depth));)t.heap[n]=t.heap[i],n=i,i<<=1;t.heap[n]=r},QB=(t,e,n)=>{let r,i,s=0,a,o;if(t.sym_next!==0)do r=t.pending_buf[t.sym_buf+s++]&255,r+=(t.pending_buf[t.sym_buf+s++]&255)<<8,i=t.pending_buf[t.sym_buf+s++],r===0?Wc(t,i,e):(a=Rw[i],Wc(t,a+P1+1,e),o=yN[a],o!==0&&(i-=pO[a],qa(t,i,o)),r--,a=hZ(r),Wc(t,a,n),o=Ex[a],o!==0&&(r-=oS[a],qa(t,r,o)));while(s<t.sym_next);Wc(t,fO,e)},_N=(t,e)=>{const n=e.dyn_tree,r=e.stat_desc.static_tree,i=e.stat_desc.has_stree,s=e.stat_desc.elems;let a,o,l=-1,c;for(t.heap_len=0,t.heap_max=iZ,a=0;a<s;a++)n[a*2]!==0?(t.heap[++t.heap_len]=l=a,t.depth[a]=0):n[a*2+1]=0;for(;t.heap_len<2;)c=t.heap[++t.heap_len]=l<2?++l:0,n[c*2]=1,t.depth[c]=0,t.opt_len--,i&&(t.static_len-=r[c*2+1]);for(e.max_code=l,a=t.heap_len>>1;a>=1;a--)mE(t,n,a);c=s;do a=t.heap[1],t.heap[1]=t.heap[t.heap_len--],mE(t,n,1),o=t.heap[1],t.heap[--t.heap_max]=a,t.heap[--t.heap_max]=o,n[c*2]=n[a*2]+n[o*2],t.depth[c]=(t.depth[a]>=t.depth[o]?t.depth[a]:t.depth[o])+1,n[a*2+1]=n[o*2+1]=c,t.heap[1]=c++,mE(t,n,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],jLe(t,e),pZ(n,l,t.bl_count)},ZB=(t,e,n)=>{let r,i=-1,s,a=e[0*2+1],o=0,l=7,c=4;for(a===0&&(l=138,c=3),e[(n+1)*2+1]=65535,r=0;r<=n;r++)s=a,a=e[(r+1)*2+1],!(++o<l&&s===a)&&(o<c?t.bl_tree[s*2]+=o:s!==0?(s!==i&&t.bl_tree[s*2]++,t.bl_tree[sZ*2]++):o<=10?t.bl_tree[aZ*2]++:t.bl_tree[oZ*2]++,o=0,i=s,a===0?(l=138,c=3):s===a?(l=6,c=3):(l=7,c=4))},eU=(t,e,n)=>{let r,i=-1,s,a=e[0*2+1],o=0,l=7,c=4;for(a===0&&(l=138,c=3),r=0;r<=n;r++)if(s=a,a=e[(r+1)*2+1],!(++o<l&&s===a)){if(o<c)do Wc(t,s,t.bl_tree);while(--o!==0);else s!==0?(s!==i&&(Wc(t,s,t.bl_tree),o--),Wc(t,sZ,t.bl_tree),qa(t,o-3,2)):o<=10?(Wc(t,aZ,t.bl_tree),qa(t,o-3,3)):(Wc(t,oZ,t.bl_tree),qa(t,o-11,7));o=0,i=s,a===0?(l=138,c=3):s===a?(l=6,c=3):(l=7,c=4)}},ULe=t=>{let e;for(ZB(t,t.dyn_ltree,t.l_desc.max_code),ZB(t,t.dyn_dtree,t.d_desc.max_code),_N(t,t.bl_desc),e=hO-1;e>=3&&t.bl_tree[lZ[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e},zLe=(t,e,n,r)=>{let i;for(qa(t,e-257,5),qa(t,n-1,5),qa(t,r-4,4),i=0;i<r;i++)qa(t,t.bl_tree[lZ[i]*2+1],3);eU(t,t.dyn_ltree,e-1),eU(t,t.dyn_dtree,n-1)},$Le=t=>{let e=4093624447,n;for(n=0;n<=31;n++,e>>>=1)if(e&1&&t.dyn_ltree[n*2]!==0)return JB;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return YB;for(n=32;n<P1;n++)if(t.dyn_ltree[n*2]!==0)return YB;return JB};let tU=!1;const VLe=t=>{tU||(BLe(),tU=!0),t.l_desc=new pE(t.dyn_ltree,cZ),t.d_desc=new pE(t.dyn_dtree,uZ),t.bl_desc=new pE(t.bl_tree,dZ),t.bi_buf=0,t.bi_valid=0,mZ(t)},vZ=(t,e,n,r)=>{qa(t,(MLe<<1)+(r?1:0),3),gZ(t),Iw(t,n),Iw(t,~n),n&&t.pending_buf.set(t.window.subarray(e,e+n),t.pending),t.pending+=n},qLe=t=>{qa(t,rZ<<1,3),Wc(t,fO,Ku),FLe(t)},WLe=(t,e,n,r)=>{let i,s,a=0;t.level>0?(t.strm.data_type===PLe&&(t.strm.data_type=$Le(t)),_N(t,t.l_desc),_N(t,t.d_desc),a=ULe(t),i=t.opt_len+3+7>>>3,s=t.static_len+3+7>>>3,s<=i&&(i=s)):i=s=n+5,n+4<=i&&e!==-1?vZ(t,e,n,r):t.strategy===ALe||s===i?(qa(t,(rZ<<1)+(r?1:0),3),QB(t,Ku,P_)):(qa(t,(NLe<<1)+(r?1:0),3),zLe(t,t.l_desc.max_code+1,t.d_desc.max_code+1,a+1),QB(t,t.dyn_ltree,t.dyn_dtree)),mZ(t),r&&gZ(t)},GLe=(t,e,n)=>(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=n,e===0?t.dyn_ltree[n*2]++:(t.matches++,e--,t.dyn_ltree[(Rw[n]+P1+1)*2]++,t.dyn_dtree[hZ(e)*2]++),t.sym_next===t.sym_end);var HLe=VLe,KLe=vZ,JLe=WLe,YLe=GLe,XLe=qLe,QLe={_tr_init:HLe,_tr_stored_block:KLe,_tr_flush_block:JLe,_tr_tally:YLe,_tr_align:XLe};const ZLe=(t,e,n,r)=>{let i=t&65535|0,s=t>>>16&65535|0,a=0;for(;n!==0;){a=n>2e3?2e3:n,n-=a;do i=i+e[r++]|0,s=s+i|0;while(--a);i%=65521,s%=65521}return i|s<<16|0};var Lw=ZLe;const e4e=()=>{let t,e=[];for(var n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=t&1?3988292384^t>>>1:t>>>1;e[n]=t}return e},t4e=new Uint32Array(e4e()),n4e=(t,e,n,r)=>{const i=t4e,s=r+n;t^=-1;for(let a=r;a<s;a++)t=t>>>8^i[(t^e[a])&255];return t^-1};var ss=n4e,jv={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"},M1={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_MEM_ERROR:-4,Z_BUF_ERROR:-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};const{_tr_init:r4e,_tr_stored_block:wN,_tr_flush_block:i4e,_tr_tally:zh,_tr_align:s4e}=QLe,{Z_NO_FLUSH:$h,Z_PARTIAL_FLUSH:a4e,Z_FULL_FLUSH:o4e,Z_FINISH:Xo,Z_BLOCK:nU,Z_OK:xs,Z_STREAM_END:rU,Z_STREAM_ERROR:Qc,Z_DATA_ERROR:l4e,Z_BUF_ERROR:gE,Z_DEFAULT_COMPRESSION:c4e,Z_FILTERED:u4e,Z_HUFFMAN_ONLY:p2,Z_RLE:d4e,Z_FIXED:h4e,Z_DEFAULT_STRATEGY:f4e,Z_UNKNOWN:p4e,Z_DEFLATED:JT}=M1,m4e=9,g4e=15,v4e=8,y4e=29,_4e=256,bN=_4e+1+y4e,w4e=30,b4e=19,x4e=2*bN+1,k4e=15,Ln=3,Th=258,Zc=Th+Ln+1,S4e=32,Bv=42,mO=57,xN=69,kN=73,SN=91,TN=103,gp=113,i_=666,Sa=1,M0=2,Wp=3,N0=4,T4e=3,vp=(t,e)=>(t.msg=jv[e],e),iU=t=>t*2-(t>4?9:0),fh=t=>{let e=t.length;for(;--e>=0;)t[e]=0},C4e=t=>{let e,n,r,i=t.w_size;e=t.hash_size,r=e;do n=t.head[--r],t.head[r]=n>=i?n-i:0;while(--e);e=i,r=e;do n=t.prev[--r],t.prev[r]=n>=i?n-i:0;while(--e)};let E4e=(t,e,n)=>(e<<t.hash_shift^n)&t.hash_mask,Vh=E4e;const fo=t=>{const e=t.state;let n=e.pending;n>t.avail_out&&(n=t.avail_out),n!==0&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+n),t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,e.pending===0&&(e.pending_out=0))},ko=(t,e)=>{i4e(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,fo(t.strm)},Gn=(t,e)=>{t.pending_buf[t.pending++]=e},Ay=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255},CN=(t,e,n,r)=>{let i=t.avail_in;return i>r&&(i=r),i===0?0:(t.avail_in-=i,e.set(t.input.subarray(t.next_in,t.next_in+i),n),t.state.wrap===1?t.adler=Lw(t.adler,e,i,n):t.state.wrap===2&&(t.adler=ss(t.adler,e,i,n)),t.next_in+=i,t.total_in+=i,i)},yZ=(t,e)=>{let n=t.max_chain_length,r=t.strstart,i,s,a=t.prev_length,o=t.nice_match;const l=t.strstart>t.w_size-Zc?t.strstart-(t.w_size-Zc):0,c=t.window,u=t.w_mask,d=t.prev,f=t.strstart+Th;let h=c[r+a-1],p=c[r+a];t.prev_length>=t.good_match&&(n>>=2),o>t.lookahead&&(o=t.lookahead);do if(i=e,!(c[i+a]!==p||c[i+a-1]!==h||c[i]!==c[r]||c[++i]!==c[r+1])){r+=2,i++;do;while(c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&r<f);if(s=Th-(f-r),r=f-Th,s>a){if(t.match_start=e,a=s,s>=o)break;h=c[r+a-1],p=c[r+a]}}while((e=d[e&u])>l&&--n!==0);return a<=t.lookahead?a:t.lookahead},Uv=t=>{const e=t.w_size;let n,r,i;do{if(r=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Zc)&&(t.window.set(t.window.subarray(e,e+e-r),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),C4e(t),r+=e),t.strm.avail_in===0)break;if(n=CN(t.strm,t.window,t.strstart+t.lookahead,r),t.lookahead+=n,t.lookahead+t.insert>=Ln)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=Vh(t,t.ins_h,t.window[i+1]);t.insert&&(t.ins_h=Vh(t,t.ins_h,t.window[i+Ln-1]),t.prev[i&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=i,i++,t.insert--,!(t.lookahead+t.insert<Ln)););}while(t.lookahead<Zc&&t.strm.avail_in!==0)},_Z=(t,e)=>{let n=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,r,i,s,a=0,o=t.strm.avail_in;do{if(r=65535,s=t.bi_valid+42>>3,t.strm.avail_out<s||(s=t.strm.avail_out-s,i=t.strstart-t.block_start,r>i+t.strm.avail_in&&(r=i+t.strm.avail_in),r>s&&(r=s),r<n&&(r===0&&e!==Xo||e===$h||r!==i+t.strm.avail_in)))break;a=e===Xo&&r===i+t.strm.avail_in?1:0,wN(t,0,0,a),t.pending_buf[t.pending-4]=r,t.pending_buf[t.pending-3]=r>>8,t.pending_buf[t.pending-2]=~r,t.pending_buf[t.pending-1]=~r>>8,fo(t.strm),i&&(i>r&&(i=r),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+i),t.strm.next_out),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i,t.block_start+=i,r-=i),r&&(CN(t.strm,t.strm.output,t.strm.next_out,r),t.strm.next_out+=r,t.strm.avail_out-=r,t.strm.total_out+=r)}while(a===0);return o-=t.strm.avail_in,o&&(o>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=o&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-o,t.strm.next_in),t.strstart),t.strstart+=o,t.insert+=o>t.w_size-t.insert?t.w_size-t.insert:o),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),a?N0:e!==$h&&e!==Xo&&t.strm.avail_in===0&&t.strstart===t.block_start?M0:(s=t.window_size-t.strstart,t.strm.avail_in>s&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,s+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),s>t.strm.avail_in&&(s=t.strm.avail_in),s&&(CN(t.strm,t.window,t.strstart,s),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.high_water<t.strstart&&(t.high_water=t.strstart),s=t.bi_valid+42>>3,s=t.pending_buf_size-s>65535?65535:t.pending_buf_size-s,n=s>t.w_size?t.w_size:s,i=t.strstart-t.block_start,(i>=n||(i||e===Xo)&&e!==$h&&t.strm.avail_in===0&&i<=s)&&(r=i>s?s:i,a=e===Xo&&t.strm.avail_in===0&&r===i?1:0,wN(t,t.block_start,r,a),t.block_start+=r,fo(t.strm)),a?Wp:Sa)},vE=(t,e)=>{let n,r;for(;;){if(t.lookahead<Zc){if(Uv(t),t.lookahead<Zc&&e===$h)return Sa;if(t.lookahead===0)break}if(n=0,t.lookahead>=Ln&&(t.ins_h=Vh(t,t.ins_h,t.window[t.strstart+Ln-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),n!==0&&t.strstart-n<=t.w_size-Zc&&(t.match_length=yZ(t,n)),t.match_length>=Ln)if(r=zh(t,t.strstart-t.match_start,t.match_length-Ln),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=Ln){t.match_length--;do t.strstart++,t.ins_h=Vh(t,t.ins_h,t.window[t.strstart+Ln-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;while(--t.match_length!==0);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=Vh(t,t.ins_h,t.window[t.strstart+1]);else r=zh(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(r&&(ko(t,!1),t.strm.avail_out===0))return Sa}return t.insert=t.strstart<Ln-1?t.strstart:Ln-1,e===Xo?(ko(t,!0),t.strm.avail_out===0?Wp:N0):t.sym_next&&(ko(t,!1),t.strm.avail_out===0)?Sa:M0},rg=(t,e)=>{let n,r,i;for(;;){if(t.lookahead<Zc){if(Uv(t),t.lookahead<Zc&&e===$h)return Sa;if(t.lookahead===0)break}if(n=0,t.lookahead>=Ln&&(t.ins_h=Vh(t,t.ins_h,t.window[t.strstart+Ln-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=Ln-1,n!==0&&t.prev_length<t.max_lazy_match&&t.strstart-n<=t.w_size-Zc&&(t.match_length=yZ(t,n),t.match_length<=5&&(t.strategy===u4e||t.match_length===Ln&&t.strstart-t.match_start>4096)&&(t.match_length=Ln-1)),t.prev_length>=Ln&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-Ln,r=zh(t,t.strstart-1-t.prev_match,t.prev_length-Ln),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=i&&(t.ins_h=Vh(t,t.ins_h,t.window[t.strstart+Ln-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);while(--t.prev_length!==0);if(t.match_available=0,t.match_length=Ln-1,t.strstart++,r&&(ko(t,!1),t.strm.avail_out===0))return Sa}else if(t.match_available){if(r=zh(t,0,t.window[t.strstart-1]),r&&ko(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return Sa}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(r=zh(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<Ln-1?t.strstart:Ln-1,e===Xo?(ko(t,!0),t.strm.avail_out===0?Wp:N0):t.sym_next&&(ko(t,!1),t.strm.avail_out===0)?Sa:M0},A4e=(t,e)=>{let n,r,i,s;const a=t.window;for(;;){if(t.lookahead<=Th){if(Uv(t),t.lookahead<=Th&&e===$h)return Sa;if(t.lookahead===0)break}if(t.match_length=0,t.lookahead>=Ln&&t.strstart>0&&(i=t.strstart-1,r=a[i],r===a[++i]&&r===a[++i]&&r===a[++i])){s=t.strstart+Th;do;while(r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&i<s);t.match_length=Th-(s-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=Ln?(n=zh(t,1,t.match_length-Ln),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=zh(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(ko(t,!1),t.strm.avail_out===0))return Sa}return t.insert=0,e===Xo?(ko(t,!0),t.strm.avail_out===0?Wp:N0):t.sym_next&&(ko(t,!1),t.strm.avail_out===0)?Sa:M0},P4e=(t,e)=>{let n;for(;;){if(t.lookahead===0&&(Uv(t),t.lookahead===0)){if(e===$h)return Sa;break}if(t.match_length=0,n=zh(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(ko(t,!1),t.strm.avail_out===0))return Sa}return t.insert=0,e===Xo?(ko(t,!0),t.strm.avail_out===0?Wp:N0):t.sym_next&&(ko(t,!1),t.strm.avail_out===0)?Sa:M0};function Ac(t,e,n,r,i){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=r,this.func=i}const s_=[new Ac(0,0,0,0,_Z),new Ac(4,4,8,4,vE),new Ac(4,5,16,8,vE),new Ac(4,6,32,32,vE),new Ac(4,4,16,16,rg),new Ac(8,16,32,32,rg),new Ac(8,16,128,128,rg),new Ac(8,32,128,256,rg),new Ac(32,128,258,1024,rg),new Ac(32,258,258,4096,rg)],M4e=t=>{t.window_size=2*t.w_size,fh(t.head),t.max_lazy_match=s_[t.level].max_lazy,t.good_match=s_[t.level].good_length,t.nice_match=s_[t.level].nice_length,t.max_chain_length=s_[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=Ln-1,t.match_available=0,t.ins_h=0};function N4e(){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=JT,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 Uint16Array(x4e*2),this.dyn_dtree=new Uint16Array((2*w4e+1)*2),this.bl_tree=new Uint16Array((2*b4e+1)*2),fh(this.dyn_ltree),fh(this.dyn_dtree),fh(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(k4e+1),this.heap=new Uint16Array(2*bN+1),fh(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*bN+1),fh(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const N1=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Bv&&e.status!==mO&&e.status!==xN&&e.status!==kN&&e.status!==SN&&e.status!==TN&&e.status!==gp&&e.status!==i_?1:0},wZ=t=>{if(N1(t))return vp(t,Qc);t.total_in=t.total_out=0,t.data_type=p4e;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?mO:e.wrap?Bv:gp,t.adler=e.wrap===2?0:1,e.last_flush=-2,r4e(e),xs},bZ=t=>{const e=wZ(t);return e===xs&&M4e(t.state),e},R4e=(t,e)=>N1(t)||t.state.wrap!==2?Qc:(t.state.gzhead=e,xs),xZ=(t,e,n,r,i,s)=>{if(!t)return Qc;let a=1;if(e===c4e&&(e=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),i<1||i>m4e||n!==JT||r<8||r>15||e<0||e>9||s<0||s>h4e||r===8&&a!==1)return vp(t,Qc);r===8&&(r=9);const o=new N4e;return t.state=o,o.strm=t,o.status=Bv,o.wrap=a,o.gzhead=null,o.w_bits=r,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=i+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+Ln-1)/Ln),o.window=new Uint8Array(o.w_size*2),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<i+6,o.pending_buf_size=o.lit_bufsize*4,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=(o.lit_bufsize-1)*3,o.level=e,o.strategy=s,o.method=n,bZ(t)},I4e=(t,e)=>xZ(t,e,JT,g4e,v4e,f4e),L4e=(t,e)=>{if(N1(t)||e>nU||e<0)return t?vp(t,Qc):Qc;const n=t.state;if(!t.output||t.avail_in!==0&&!t.input||n.status===i_&&e!==Xo)return vp(t,t.avail_out===0?gE:Qc);const r=n.last_flush;if(n.last_flush=e,n.pending!==0){if(fo(t),t.avail_out===0)return n.last_flush=-1,xs}else if(t.avail_in===0&&iU(e)<=iU(r)&&e!==Xo)return vp(t,gE);if(n.status===i_&&t.avail_in!==0)return vp(t,gE);if(n.status===Bv&&n.wrap===0&&(n.status=gp),n.status===Bv){let i=JT+(n.w_bits-8<<4)<<8,s=-1;if(n.strategy>=p2||n.level<2?s=0:n.level<6?s=1:n.level===6?s=2:s=3,i|=s<<6,n.strstart!==0&&(i|=S4e),i+=31-i%31,Ay(n,i),n.strstart!==0&&(Ay(n,t.adler>>>16),Ay(n,t.adler&65535)),t.adler=1,n.status=gp,fo(t),n.pending!==0)return n.last_flush=-1,xs}if(n.status===mO){if(t.adler=0,Gn(n,31),Gn(n,139),Gn(n,8),n.gzhead)Gn(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Gn(n,n.gzhead.time&255),Gn(n,n.gzhead.time>>8&255),Gn(n,n.gzhead.time>>16&255),Gn(n,n.gzhead.time>>24&255),Gn(n,n.level===9?2:n.strategy>=p2||n.level<2?4:0),Gn(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(Gn(n,n.gzhead.extra.length&255),Gn(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=ss(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=xN;else if(Gn(n,0),Gn(n,0),Gn(n,0),Gn(n,0),Gn(n,0),Gn(n,n.level===9?2:n.strategy>=p2||n.level<2?4:0),Gn(n,T4e),n.status=gp,fo(t),n.pending!==0)return n.last_flush=-1,xs}if(n.status===xN){if(n.gzhead.extra){let i=n.pending,s=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+s>n.pending_buf_size;){let o=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+o),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>i&&(t.adler=ss(t.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=o,fo(t),n.pending!==0)return n.last_flush=-1,xs;i=0,s-=o}let a=new Uint8Array(n.gzhead.extra);n.pending_buf.set(a.subarray(n.gzindex,n.gzindex+s),n.pending),n.pending+=s,n.gzhead.hcrc&&n.pending>i&&(t.adler=ss(t.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=kN}if(n.status===kN){if(n.gzhead.name){let i=n.pending,s;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(t.adler=ss(t.adler,n.pending_buf,n.pending-i,i)),fo(t),n.pending!==0)return n.last_flush=-1,xs;i=0}n.gzindex<n.gzhead.name.length?s=n.gzhead.name.charCodeAt(n.gzindex++)&255:s=0,Gn(n,s)}while(s!==0);n.gzhead.hcrc&&n.pending>i&&(t.adler=ss(t.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=SN}if(n.status===SN){if(n.gzhead.comment){let i=n.pending,s;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(t.adler=ss(t.adler,n.pending_buf,n.pending-i,i)),fo(t),n.pending!==0)return n.last_flush=-1,xs;i=0}n.gzindex<n.gzhead.comment.length?s=n.gzhead.comment.charCodeAt(n.gzindex++)&255:s=0,Gn(n,s)}while(s!==0);n.gzhead.hcrc&&n.pending>i&&(t.adler=ss(t.adler,n.pending_buf,n.pending-i,i))}n.status=TN}if(n.status===TN){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(fo(t),n.pending!==0))return n.last_flush=-1,xs;Gn(n,t.adler&255),Gn(n,t.adler>>8&255),t.adler=0}if(n.status=gp,fo(t),n.pending!==0)return n.last_flush=-1,xs}if(t.avail_in!==0||n.lookahead!==0||e!==$h&&n.status!==i_){let i=n.level===0?_Z(n,e):n.strategy===p2?P4e(n,e):n.strategy===d4e?A4e(n,e):s_[n.level].func(n,e);if((i===Wp||i===N0)&&(n.status=i_),i===Sa||i===Wp)return t.avail_out===0&&(n.last_flush=-1),xs;if(i===M0&&(e===a4e?s4e(n):e!==nU&&(wN(n,0,0,!1),e===o4e&&(fh(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),fo(t),t.avail_out===0))return n.last_flush=-1,xs}return e!==Xo?xs:n.wrap<=0?rU:(n.wrap===2?(Gn(n,t.adler&255),Gn(n,t.adler>>8&255),Gn(n,t.adler>>16&255),Gn(n,t.adler>>24&255),Gn(n,t.total_in&255),Gn(n,t.total_in>>8&255),Gn(n,t.total_in>>16&255),Gn(n,t.total_in>>24&255)):(Ay(n,t.adler>>>16),Ay(n,t.adler&65535)),fo(t),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?xs:rU)},O4e=t=>{if(N1(t))return Qc;const e=t.state.status;return t.state=null,e===gp?vp(t,l4e):xs},D4e=(t,e)=>{let n=e.length;if(N1(t))return Qc;const r=t.state,i=r.wrap;if(i===2||i===1&&r.status!==Bv||r.lookahead)return Qc;if(i===1&&(t.adler=Lw(t.adler,e,n,0)),r.wrap=0,n>=r.w_size){i===0&&(fh(r.head),r.strstart=0,r.block_start=0,r.insert=0);let l=new Uint8Array(r.w_size);l.set(e.subarray(n-r.w_size,n),0),e=l,n=r.w_size}const s=t.avail_in,a=t.next_in,o=t.input;for(t.avail_in=n,t.next_in=0,t.input=e,Uv(r);r.lookahead>=Ln;){let l=r.strstart,c=r.lookahead-(Ln-1);do r.ins_h=Vh(r,r.ins_h,r.window[l+Ln-1]),r.prev[l&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=l,l++;while(--c);r.strstart=l,r.lookahead=Ln-1,Uv(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=Ln-1,r.match_available=0,t.next_in=a,t.input=o,t.avail_in=s,r.wrap=i,xs};var F4e=I4e,j4e=xZ,B4e=bZ,U4e=wZ,z4e=R4e,$4e=L4e,V4e=O4e,q4e=D4e,W4e="pako deflate (from Nodeca project)",M_={deflateInit:F4e,deflateInit2:j4e,deflateReset:B4e,deflateResetKeep:U4e,deflateSetHeader:z4e,deflate:$4e,deflateEnd:V4e,deflateSetDictionary:q4e,deflateInfo:W4e};const G4e=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var H4e=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const n=e.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const r in n)G4e(n,r)&&(t[r]=n[r])}}return t},K4e=t=>{let e=0;for(let r=0,i=t.length;r<i;r++)e+=t[r].length;const n=new Uint8Array(e);for(let r=0,i=0,s=t.length;r<s;r++){let a=t[r];n.set(a,i),i+=a.length}return n},YT={assign:H4e,flattenChunks:K4e};let kZ=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{kZ=!1}const Ow=new Uint8Array(256);for(let t=0;t<256;t++)Ow[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;Ow[254]=Ow[254]=1;var J4e=t=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(t);let e,n,r,i,s,a=t.length,o=0;for(i=0;i<a;i++)n=t.charCodeAt(i),(n&64512)===55296&&i+1<a&&(r=t.charCodeAt(i+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),o+=n<128?1:n<2048?2:n<65536?3:4;for(e=new Uint8Array(o),s=0,i=0;s<o;i++)n=t.charCodeAt(i),(n&64512)===55296&&i+1<a&&(r=t.charCodeAt(i+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),n<128?e[s++]=n:n<2048?(e[s++]=192|n>>>6,e[s++]=128|n&63):n<65536?(e[s++]=224|n>>>12,e[s++]=128|n>>>6&63,e[s++]=128|n&63):(e[s++]=240|n>>>18,e[s++]=128|n>>>12&63,e[s++]=128|n>>>6&63,e[s++]=128|n&63);return e};const Y4e=(t,e)=>{if(e<65534&&t.subarray&&kZ)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let n="";for(let r=0;r<e;r++)n+=String.fromCharCode(t[r]);return n};var X4e=(t,e)=>{const n=e||t.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(t.subarray(0,e));let r,i;const s=new Array(n*2);for(i=0,r=0;r<n;){let a=t[r++];if(a<128){s[i++]=a;continue}let o=Ow[a];if(o>4){s[i++]=65533,r+=o-1;continue}for(a&=o===2?31:o===3?15:7;o>1&&r<n;)a=a<<6|t[r++]&63,o--;if(o>1){s[i++]=65533;continue}a<65536?s[i++]=a:(a-=65536,s[i++]=55296|a>>10&1023,s[i++]=56320|a&1023)}return Y4e(s,i)},Q4e=(t,e)=>{e=e||t.length,e>t.length&&(e=t.length);let n=e-1;for(;n>=0&&(t[n]&192)===128;)n--;return n<0||n===0?e:n+Ow[t[n]]>e?n:e},Dw={string2buf:J4e,buf2string:X4e,utf8border:Q4e};function Z4e(){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}var SZ=Z4e;const TZ=Object.prototype.toString,{Z_NO_FLUSH:eOe,Z_SYNC_FLUSH:tOe,Z_FULL_FLUSH:nOe,Z_FINISH:rOe,Z_OK:lS,Z_STREAM_END:iOe,Z_DEFAULT_COMPRESSION:sOe,Z_DEFAULT_STRATEGY:aOe,Z_DEFLATED:oOe}=M1;function gO(t){this.options=YT.assign({level:sOe,method:oOe,chunkSize:16384,windowBits:15,memLevel:8,strategy:aOe},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new SZ,this.strm.avail_out=0;let n=M_.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(n!==lS)throw new Error(jv[n]);if(e.header&&M_.deflateSetHeader(this.strm,e.header),e.dictionary){let r;if(typeof e.dictionary=="string"?r=Dw.string2buf(e.dictionary):TZ.call(e.dictionary)==="[object ArrayBuffer]"?r=new
vendor: 1,476 bytes, line 584
584Uint8Array(e.dictionary):r=e.dictionary,n=M_.deflateSetDictionary(this.strm,r),n!==lS)throw new Error(jv[n]);this._dict_set=!0}}gO.prototype.push=function(t,e){const n=this.strm,r=this.options.chunkSize;let i,s;if(this.ended)return!1;for(e===~~e?s=e:s=e===!0?rOe:eOe,typeof t=="string"?n.input=Dw.string2buf(t):TZ.call(t)==="[object ArrayBuffer]"?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(s===tOe||s===nOe)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=M_.deflate(n,s),i===iOe)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=M_.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===lS;if(n.avail_out===0){this.onData(n.output);continue}if(s>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0};gO.prototype.onData=function(t){this.chunks.push(t)};gO.prototype.onEnd=function(t){t===lS&&(this.result=YT.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};const m2=16209,lOe=16191;var cOe=function(e,n){let r,i,s,a,o,l,c,u,d,f,h,p,m,g,v,_,b,x,T,N,A,L,M,B;const R=e.state;r=e.next_in,M=e.input,i=r+(e.avail_in-5),s=e.next_out,B=e.output,a=s-(n-e.avail_out),o=s+(e.avail_out-257),l=R.dmax,c=R.wsize,u=R.whave,d=R.wnext,f=R.window,h=R.hold,p=R.bits,m=R.lencode,g=R.distcode,v=(1<<R.lenbits)-1,_=(1<<R.distbits)-1;
vendor: 14,398 bytes, line 584
584e:do{p<15&&(h+=M[r++]<<p,p+=8,h+=M[r++]<<p,p+=8),b=m[h&v];t:for(;;){if(x=b>>>24,h>>>=x,p-=x,x=b>>>16&255,x===0)B[s++]=b&65535;else if(x&16){T=b&65535,x&=15,x&&(p<x&&(h+=M[r++]<<p,p+=8),T+=h&(1<<x)-1,h>>>=x,p-=x),p<15&&(h+=M[r++]<<p,p+=8,h+=M[r++]<<p,p+=8),b=g[h&_];n:for(;;){if(x=b>>>24,h>>>=x,p-=x,x=b>>>16&255,x&16){if(N=b&65535,x&=15,p<x&&(h+=M[r++]<<p,p+=8,p<x&&(h+=M[r++]<<p,p+=8)),N+=h&(1<<x)-1,N>l){e.msg="invalid distance too far back",R.mode=m2;break e}if(h>>>=x,p-=x,x=s-a,N>x){if(x=N-x,x>u&&R.sane){e.msg="invalid distance too far back",R.mode=m2;break e}if(A=0,L=f,d===0){if(A+=c-x,x<T){T-=x;do B[s++]=f[A++];while(--x);A=s-N,L=B}}else if(d<x){if(A+=c+d-x,x-=d,x<T){T-=x;do B[s++]=f[A++];while(--x);if(A=0,d<T){x=d,T-=x;do B[s++]=f[A++];while(--x);A=s-N,L=B}}}else if(A+=d-x,x<T){T-=x;do B[s++]=f[A++];while(--x);A=s-N,L=B}for(;T>2;)B[s++]=L[A++],B[s++]=L[A++],B[s++]=L[A++],T-=3;T&&(B[s++]=L[A++],T>1&&(B[s++]=L[A++]))}else{A=s-N;do B[s++]=B[A++],B[s++]=B[A++],B[s++]=B[A++],T-=3;while(T>2);T&&(B[s++]=B[A++],T>1&&(B[s++]=B[A++]))}}else if(x&64){e.msg="invalid distance code",R.mode=m2;break e}else{b=g[(b&65535)+(h&(1<<x)-1)];continue n}break}}else if(x&64)if(x&32){R.mode=lOe;break e}else{e.msg="invalid literal/length code",R.mode=m2;break e}else{b=m[(b&65535)+(h&(1<<x)-1)];continue t}break}}while(r<i&&s<o);T=p>>3,r-=T,p-=T<<3,h&=(1<<p)-1,e.next_in=r,e.next_out=s,e.avail_in=r<i?5+(i-r):5-(r-i),e.avail_out=s<o?257+(o-s):257-(s-o),R.hold=h,R.bits=p};const ig=15,sU=852,aU=592,oU=0,yE=1,lU=2,uOe=new Uint16Array([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]),dOe=new Uint8Array([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]),hOe=new Uint16Array([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]),fOe=new Uint8Array([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]),pOe=(t,e,n,r,i,s,a,o)=>{const l=o.bits;let c=0,u=0,d=0,f=0,h=0,p=0,m=0,g=0,v=0,_=0,b,x,T,N,A,L=null,M;const B=new Uint16Array(ig+1),R=new Uint16Array(ig+1);let j=null,$,U,te;for(c=0;c<=ig;c++)B[c]=0;for(u=0;u<r;u++)B[e[n+u]]++;for(h=l,f=ig;f>=1&&B[f]===0;f--);if(h>f&&(h=f),f===0)return i[s++]=1<<24|64<<16|0,i[s++]=1<<24|64<<16|0,o.bits=1,0;for(d=1;d<f&&B[d]===0;d++);for(h<d&&(h=d),g=1,c=1;c<=ig;c++)if(g<<=1,g-=B[c],g<0)return-1;if(g>0&&(t===oU||f!==1))return-1;for(R[1]=0,c=1;c<ig;c++)R[c+1]=R[c]+B[c];for(u=0;u<r;u++)e[n+u]!==0&&(a[R[e[n+u]]++]=u);if(t===oU?(L=j=a,M=20):t===yE?(L=uOe,j=dOe,M=257):(L=hOe,j=fOe,M=0),_=0,u=0,c=d,A=s,p=h,m=0,T=-1,v=1<<h,N=v-1,t===yE&&v>sU||t===lU&&v>aU)return 1;for(;;){$=c-m,a[u]+1<M?(U=0,te=a[u]):a[u]>=M?(U=j[a[u]-M],te=L[a[u]-M]):(U=96,te=0),b=1<<c-m,x=1<<p,d=x;do x-=b,i[A+(_>>m)+x]=$<<24|U<<16|te|0;while(x!==0);for(b=1<<c-1;_&b;)b>>=1;if(b!==0?(_&=b-1,_+=b):_=0,u++,--B[c]===0){if(c===f)break;c=e[n+a[u]]}if(c>h&&(_&N)!==T){for(m===0&&(m=h),A+=d,p=c-m,g=1<<p;p+m<f&&(g-=B[p+m],!(g<=0));)p++,g<<=1;if(v+=1<<p,t===yE&&v>sU||t===lU&&v>aU)return 1;T=_&N,i[T]=h<<24|p<<16|A-s|0}}return _!==0&&(i[A+_]=c-m<<24|64<<16|0),o.bits=h,0};var N_=pOe;const mOe=0,CZ=1,EZ=2,{Z_FINISH:cU,Z_BLOCK:gOe,Z_TREES:g2,Z_OK:Gp,Z_STREAM_END:vOe,Z_NEED_DICT:yOe,Z_STREAM_ERROR:il,Z_DATA_ERROR:AZ,Z_MEM_ERROR:PZ,Z_BUF_ERROR:_Oe,Z_DEFLATED:uU}=M1,XT=16180,dU=16181,hU=16182,fU=16183,pU=16184,mU=16185,gU=16186,vU=16187,yU=16188,_U=16189,cS=16190,ju=16191,_E=16192,wU=16193,wE=16194,bU=16195,xU=16196,kU=16197,SU=16198,v2=16199,y2=16200,TU=16201,CU=16202,EU=16203,AU=16204,PU=16205,bE=16206,MU=16207,NU=16208,Ur=16209,MZ=16210,NZ=16211,wOe=852,bOe=592,xOe=15,kOe=xOe,RU=t=>(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24);function SOe(){this.strm=null,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 Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const sm=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode<XT||e.mode>NZ?1:0},RZ=t=>{if(sm(t))return il;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=XT,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(wOe),e.distcode=e.distdyn=new Int32Array(bOe),e.sane=1,e.back=-1,Gp},IZ=t=>{if(sm(t))return il;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,RZ(t)},LZ=(t,e)=>{let n;if(sm(t))return il;const r=t.state;return e<0?(n=0,e=-e):(n=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?il:(r.window!==null&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,IZ(t))},OZ=(t,e)=>{if(!t)return il;const n=new SOe;t.state=n,n.strm=t,n.window=null,n.mode=XT;const r=LZ(t,e);return r!==Gp&&(t.state=null),r},TOe=t=>OZ(t,kOe);let IU=!0,xE,kE;const COe=t=>{if(IU){xE=new Int32Array(512),kE=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(N_(CZ,t.lens,0,288,xE,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;N_(EZ,t.lens,0,32,kE,0,t.work,{bits:5}),IU=!1}t.lencode=xE,t.lenbits=9,t.distcode=kE,t.distbits=5},DZ=(t,e,n,r)=>{let i;const s=t.state;return s.window===null&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),r>=s.wsize?(s.window.set(e.subarray(n-s.wsize,n),0),s.wnext=0,s.whave=s.wsize):(i=s.wsize-s.wnext,i>r&&(i=r),s.window.set(e.subarray(n-r,n-r+i),s.wnext),r-=i,r?(s.window.set(e.subarray(n-r,n),0),s.wnext=r,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=i))),0},EOe=(t,e)=>{let n,r,i,s,a,o,l,c,u,d,f,h,p,m,g=0,v,_,b,x,T,N,A,L;const M=new Uint8Array(4);let B,R;const j=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(sm(t)||!t.output||!t.input&&t.avail_in!==0)return il;n=t.state,n.mode===ju&&(n.mode=_E),a=t.next_out,i=t.output,l=t.avail_out,s=t.next_in,r=t.input,o=t.avail_in,c=n.hold,u=n.bits,d=o,f=l,L=Gp;e:for(;;)switch(n.mode){case XT:if(n.wrap===0){n.mode=_E;break}for(;u<16;){if(o===0)break e;o--,c+=r[s++]<<u,u+=8}if(n.wrap&2&&c===35615){n.wbits===0&&(n.wbits=15),n.check=0,M[0]=c&255,M[1]=c>>>8&255,n.check=ss(n.check,M,2,0),c=0,u=0,n.mode=dU;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((c&255)<<8)+(c>>8))%31){t.msg="incorrect header check",n.mode=Ur;break}if((c&15)!==uU){t.msg="unknown compression method",n.mode=Ur;break}if(c>>>=4,u-=4,A=(c&15)+8,n.wbits===0&&(n.wbits=A),A>15||A>n.wbits){t.msg="invalid window size",n.mode=Ur;break}n.dmax=1<<n.wbits,n.flags=0,t.adler=n.check=1,n.mode=c&512?_U:ju,c=0,u=0;break;case dU:for(;u<16;){if(o===0)break e;o--,c+=r[s++]<<u,u+=8}if(n.flags=c,(n.flags&255)!==uU){t.msg="unknown compression method",n.mode=Ur;break}if(n.flags&57344){t.msg="unknown header flags set",n.mode=Ur;break}n.head&&(n.head.text=c>>8&1),n.flags&512&&n.wrap&4&&(M[0]=c&255,M[1]=c>>>8&255,n.check=ss(n.check,M,2,0)),c=0,u=0,n.mode=hU;case hU:for(;u<32;){if(o===0)break e;o--,c+=r[s++]<<u,u+=8}n.head&&(n.head.time=c),n.flags&512&&n.wrap&4&&(M[0]=c&255,M[1]=c>>>8&255,M[2]=c>>>16&255,M[3]=c>>>24&255,n.check=ss(n.check,M,4,0)),c=0,u=0,n.mode=fU;case fU:for(;u<16;){if(o===0)break e;o--,c+=r[s++]<<u,u+=8}n.head&&(n.head.xflags=c&255,n.head.os=c>>8),n.flags&512&&n.wrap&4&&(M[0]=c&255,M[1]=c>>>8&255,n.check=ss(n.check,M,2,0)),c=0,u=0,n.mode=pU;case pU:if(n.flags&1024){for(;u<16;){if(o===0)break e;o--,c+=r[s++]<<u,u+=8}n.length=c,n.head&&(n.head.extra_len=c),n.flags&512&&n.wrap&4&&(M[0]=c&255,M[1]=c>>>8&255,n.check=ss(n.check,M,2,0)),c=0,u=0}else n.head&&(n.head.extra=null);n.mode=mU;case mU:if(n.flags&1024&&(h=n.length,h>o&&(h=o),h&&(n.head&&(A=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(s,s+h),A)),n.flags&512&&n.wrap&4&&(n.check=ss(n.check,r,h,s)),o-=h,s+=h,n.length-=h),n.length))break e;n.length=0,n.mode=gU;case gU:if(n.flags&2048){if(o===0)break e;h=0;do A=r[s+h++],n.head&&A&&n.length<65536&&(n.head.name+=String.fromCharCode(A));while(A&&h<o);if(n.flags&512&&n.wrap&4&&(n.check=ss(n.check,r,h,s)),o-=h,s+=h,A)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=vU;case vU:if(n.flags&4096){if(o===0)break e;h=0;do A=r[s+h++],n.head&&A&&n.length<65536&&(n.head.comment+=String.fromCharCode(A));while(A&&h<o);if(n.flags&512&&n.wrap&4&&(n.check=ss(n.check,r,h,s)),o-=h,s+=h,A)break e}else n.head&&(n.head.comment=null);n.mode=yU;case yU:if(n.flags&512){for(;u<16;){if(o===0)break e;o--,c+=r[s++]<<u,u+=8}if(n.wrap&4&&c!==(n.check&65535)){t.msg="header crc mismatch",n.mode=Ur;break}c=0,u=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=ju;break;case _U:for(;u<32;){if(o===0)break e;o--,c+=r[s++]<<u,u+=8}t.adler=n.check=RU(c),c=0,u=0,n.mode=cS;case cS:if(n.havedict===0)return t.next_out=a,t.avail_out=l,t.next_in=s,t.avail_in=o,n.hold=c,n.bits=u,yOe;t.adler=n.check=1,n.mode=ju;case ju:if(e===gOe||e===g2)break e;case _E:if(n.last){c>>>=u&7,u-=u&7,n.mode=bE;break}for(;u<3;){if(o===0)break e;o--,c+=r[s++]<<u,u+=8}switch(n.last=c&1,c>>>=1,u-=1,c&3){case 0:n.mode=wU;break;case 1:if(COe(n),n.mode=v2,e===g2){c>>>=2,u-=2;break e}break;case 2:n.mode=xU;break;case 3:t.msg="invalid block type",n.mode=Ur}c>>>=2,u-=2;break;case wU:for(c>>>=u&7,u-=u&7;u<32;){if(o===0)break e;o--,c+=r[s++]<<u,u+=8}if((c&65535)!==(c>>>16^65535)){t.msg="invalid stored block lengths",n.mode=Ur;break}if(n.length=c&65535,c=0,u=0,n.mode=wE,e===g2)break e;case wE:n.mode=bU;case bU:if(h=n.length,h){if(h>o&&(h=o),h>l&&(h=l),h===0)break e;i.set(r.subarray(s,s+h),a),o-=h,s+=h,l-=h,a+=h,n.length-=h;break}n.mode=ju;break;case xU:for(;u<14;){if(o===0)break e;o--,c+=r[s++]<<u,u+=8}if(n.nlen=(c&31)+257,c>>>=5,u-=5,n.ndist=(c&31)+1,c>>>=5,u-=5,n.ncode=(c&15)+4,c>>>=4,u-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=Ur;break}n.have=0,n.mode=kU;case kU:for(;n.have<n.ncode;){for(;u<3;){if(o===0)break e;o--,c+=r[s++]<<u,u+=8}n.lens[j[n.have++]]=c&7,c>>>=3,u-=3}for(;n.have<19;)n.lens[j[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,B={bits:n.lenbits},L=N_(mOe,n.lens,0,19,n.lencode,0,n.work,B),n.lenbits=B.bits,L){t.msg="invalid code lengths set",n.mode=Ur;break}n.have=0,n.mode=SU;case SU:for(;n.have<n.nlen+n.ndist;){for(;g=n.lencode[c&(1<<n.lenbits)-1],v=g>>>24,_=g>>>16&255,b=g&65535,!(v<=u);){if(o===0)break e;o--,c+=r[s++]<<u,u+=8}if(b<16)c>>>=v,u-=v,n.lens[n.have++]=b;else{if(b===16){for(R=v+2;u<R;){if(o===0)break e;o--,c+=r[s++]<<u,u+=8}if(c>>>=v,u-=v,n.have===0){t.msg="invalid bit length repeat",n.mode=Ur;break}A=n.lens[n.have-1],h=3+(c&3),c>>>=2,u-=2}else if(b===17){for(R=v+3;u<R;){if(o===0)break e;o--,c+=r[s++]<<u,u+=8}c>>>=v,u-=v,A=0,h=3+(c&7),c>>>=3,u-=3}else{for(R=v+7;u<R;){if(o===0)break e;o--,c+=r[s++]<<u,u+=8}c>>>=v,u-=v,A=0,h=11+(c&127),c>>>=7,u-=7}if(n.have+h>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=Ur;break}for(;h--;)n.lens[n.have++]=A}}if(n.mode===Ur)break;if(n.lens[256]===0){t.msg="invalid code -- missing end-of-block",n.mode=Ur;break}if(n.lenbits=9,B={bits:n.lenbits},L=N_(CZ,n.lens,0,n.nlen,n.lencode,0,n.work,B),n.lenbits=B.bits,L){t.msg="invalid literal/lengths set",n.mode=Ur;break}if(n.distbits=6,n.distcode=n.distdyn,B={bits:n.distbits},L=N_(EZ,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,B),n.distbits=B.bits,L){t.msg="invalid distances set",n.mode=Ur;break}if(n.mode=v2,e===g2)break e;case v2:n.mode=y2;case y2:if(o>=6&&l>=258){t.next_out=a,t.avail_out=l,t.next_in=s,t.avail_in=o,n.hold=c,n.bits=u,cOe(t,f),a=t.next_out,i=t.output,l=t.avail_out,s=t.next_in,r=t.input,o=t.avail_in,c=n.hold,u=n.bits,n.mode===ju&&(n.back=-1);break}for(n.back=0;g=n.lencode[c&(1<<n.lenbits)-1],v=g>>>24,_=g>>>16&255,b=g&65535,!(v<=u);){if(o===0)break e;o--,c+=r[s++]<<u,u+=8}if(_&&!(_&240)){for(x=v,T=_,N=b;g=n.lencode[N+((c&(1<<x+T)-1)>>x)],v=g>>>24,_=g>>>16&255,b=g&65535,!(x+v<=u);){if(o===0)break e;o--,c+=r[s++]<<u,u+=8}c>>>=x,u-=x,n.back+=x}if(c>>>=v,u-=v,n.back+=v,n.length=b,_===0){n.mode=PU;break}if(_&32){n.back=-1,n.mode=ju;break}if(_&64){t.msg="invalid literal/length code",n.mode=Ur;break}n.extra=_&15,n.mode=TU;case TU:if(n.extra){for(R=n.extra;u<R;){if(o===0)break e;o--,c+=r[s++]<<u,u+=8}n.length+=c&(1<<n.extra)-1,c>>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=CU;case CU:for(;g=n.distcode[c&(1<<n.distbits)-1],v=g>>>24,_=g>>>16&255,b=g&65535,!(v<=u);){if(o===0)break e;o--,c+=r[s++]<<u,u+=8}if(!(_&240)){for(x=v,T=_,N=b;g=n.distcode[N+((c&(1<<x+T)-1)>>x)],v=g>>>24,_=g>>>16&255,b=g&65535,!(x+v<=u);){if(o===0)break e;o--,c+=r[s++]<<u,u+=8}c>>>=x,u-=x,n.back+=x}if(c>>>=v,u-=v,n.back+=v,_&64){t.msg="invalid distance code",n.mode=Ur;break}n.offset=b,n.extra=_&15,n.mode=EU;case EU:if(n.extra){for(R=n.extra;u<R;){if(o===0)break e;o--,c+=r[s++]<<u,u+=8}n.offset+=c&(1<<n.extra)-1,c>>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=Ur;break}n.mode=AU;case AU:if(l===0)break e;if(h=f-l,n.offset>h){if(h=n.offset-h,h>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=Ur;break}h>n.wnext?(h-=n.wnext,p=n.wsize-h):p=n.wnext-h,h>n.length&&(h=n.length),m=n.window}else m=i,p=a-n.offset,h=n.length;h>l&&(h=l),l-=h,n.length-=h;do i[a++]=m[p++];while(--h);n.length===0&&(n.mode=y2);break;case PU:if(l===0)break e;i[a++]=n.length,l--,n.mode=y2;break;case bE:if(n.wrap){for(;u<32;){if(o===0)break e;o--,c|=r[s++]<<u,u+=8}if(f-=l,t.total_out+=f,n.total+=f,n.wrap&4&&f&&(t.adler=n.check=n.flags?ss(n.check,i,f,a-f):Lw(n.check,i,f,a-f)),f=l,n.wrap&4&&(n.flags?c:RU(c))!==n.check){t.msg="incorrect data check",n.mode=Ur;break}c=0,u=0}n.mode=MU;case MU:if(n.wrap&&n.flags){for(;u<32;){if(o===0)break e;o--,c+=r[s++]<<u,u+=8}if(n.wrap&4&&c!==(n.total&4294967295)){t.msg="incorrect length check",n.mode=Ur;break}c=0,u=0}n.mode=NU;case NU:L=vOe;break e;case Ur:L=AZ;break e;case MZ:return PZ;case NZ:default:return il}return t.next_out=a,t.avail_out=l,t.next_in=s,t.avail_in=o,n.hold=c,n.bits=u,(n.wsize||f!==t.avail_out&&n.mode<Ur&&(n.mode<bE||e!==cU))&&DZ(t,t.output,t.next_out,f-t.avail_out),d-=t.avail_in,f-=t.avail_out,t.total_in+=d,t.total_out+=f,n.total+=f,
vendor: 12,418 bytes, line 584
584n.wrap&4&&f&&(t.adler=n.check=n.flags?ss(n.check,i,f,t.next_out-f):Lw(n.check,i,f,t.next_out-f)),t.data_type=n.bits+(n.last?64:0)+(n.mode===ju?128:0)+(n.mode===v2||n.mode===wE?256:0),(d===0&&f===0||e===cU)&&L===Gp&&(L=_Oe),L},AOe=t=>{if(sm(t))return il;let e=t.state;return e.window&&(e.window=null),t.state=null,Gp},POe=(t,e)=>{if(sm(t))return il;const n=t.state;return n.wrap&2?(n.head=e,e.done=!1,Gp):il},MOe=(t,e)=>{const n=e.length;let r,i,s;return sm(t)||(r=t.state,r.wrap!==0&&r.mode!==cS)?il:r.mode===cS&&(i=1,i=Lw(i,e,n,0),i!==r.check)?AZ:(s=DZ(t,e,n,n),s?(r.mode=MZ,PZ):(r.havedict=1,Gp))};var NOe=IZ,ROe=LZ,IOe=RZ,LOe=TOe,OOe=OZ,DOe=EOe,FOe=AOe,jOe=POe,BOe=MOe,UOe="pako inflate (from Nodeca project)",Ju={inflateReset:NOe,inflateReset2:ROe,inflateResetKeep:IOe,inflateInit:LOe,inflateInit2:OOe,inflate:DOe,inflateEnd:FOe,inflateGetHeader:jOe,inflateSetDictionary:BOe,inflateInfo:UOe};function zOe(){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}var $Oe=zOe;const FZ=Object.prototype.toString,{Z_NO_FLUSH:VOe,Z_FINISH:qOe,Z_OK:Fw,Z_STREAM_END:SE,Z_NEED_DICT:TE,Z_STREAM_ERROR:WOe,Z_DATA_ERROR:LU,Z_MEM_ERROR:GOe}=M1;function R1(t){this.options=YT.assign({chunkSize:1024*64,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(t&&t.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15||(e.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new SZ,this.strm.avail_out=0;let n=Ju.inflateInit2(this.strm,e.windowBits);if(n!==Fw)throw new Error(jv[n]);if(this.header=new $Oe,Ju.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=Dw.string2buf(e.dictionary):FZ.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=Ju.inflateSetDictionary(this.strm,e.dictionary),n!==Fw)))throw new Error(jv[n])}R1.prototype.push=function(t,e){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let s,a,o;if(this.ended)return!1;for(e===~~e?a=e:a=e===!0?qOe:VOe,FZ.call(t)==="[object ArrayBuffer]"?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),s=Ju.inflate(n,a),s===TE&&i&&(s=Ju.inflateSetDictionary(n,i),s===Fw?s=Ju.inflate(n,a):s===LU&&(s=TE));n.avail_in>0&&s===SE&&n.state.wrap>0&&t[n.next_in]!==0;)Ju.inflateReset(n),s=Ju.inflate(n,a);switch(s){case WOe:case LU:case TE:case GOe:return this.onEnd(s),this.ended=!0,!1}if(o=n.avail_out,n.next_out&&(n.avail_out===0||s===SE))if(this.options.to==="string"){let l=Dw.utf8border(n.output,n.next_out),c=n.next_out-l,u=Dw.buf2string(n.output,l);n.next_out=c,n.avail_out=r-c,c&&n.output.set(n.output.subarray(l,l+c),0),this.onData(u)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(s===Fw&&o===0)){if(s===SE)return s=Ju.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};R1.prototype.onData=function(t){this.chunks.push(t)};R1.prototype.onEnd=function(t){t===Fw&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=YT.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function vO(t,e){const n=new R1(e);if(n.push(t),n.err)throw n.msg||jv[n.err];return n.result}function HOe(t,e){return e=e||{},e.raw=!0,vO(t,e)}var KOe=R1,JOe=vO,YOe=HOe,XOe=vO,QOe=M1,ZOe={Inflate:KOe,inflate:JOe,inflateRaw:YOe,ungzip:XOe,constants:QOe};const{Inflate:eDe,inflate:tDe,inflateRaw:m7e,ungzip:g7e}=ZOe;var OU=eDe,nDe=tDe;const jZ=[];for(let t=0;t<256;t++){let e=t;for(let n=0;n<8;n++)e&1?e=3988292384^e>>>1:e=e>>>1;jZ[t]=e}const DU=4294967295;function rDe(t,e,n){let r=t;for(let i=0;i<n;i++)r=jZ[(r^e[i])&255]^r>>>8;return r}function iDe(t,e){return(rDe(DU,t,e)^DU)>>>0}function FU(t,e,n){const r=t.readUint32(),i=iDe(new Uint8Array(t.buffer,t.byteOffset+t.offset-e-4,e),e);if(i!==r)throw new Error(`CRC mismatch for chunk ${n}. Expected ${r}, found ${i}`)}function BZ(t,e,n){for(let r=0;r<n;r++)e[r]=t[r]}function UZ(t,e,n,r){let i=0;for(;i<r;i++)e[i]=t[i];for(;i<n;i++)e[i]=t[i]+e[i-r]&255}function zZ(t,e,n,r){let i=0;if(n.length===0)for(;i<r;i++)e[i]=t[i];else for(;i<r;i++)e[i]=t[i]+n[i]&255}function $Z(t,e,n,r,i){let s=0;if(n.length===0){for(;s<i;s++)e[s]=t[s];for(;s<r;s++)e[s]=t[s]+(e[s-i]>>1)&255}else{for(;s<i;s++)e[s]=t[s]+(n[s]>>1)&255;for(;s<r;s++)e[s]=t[s]+(e[s-i]+n[s]>>1)&255}}function VZ(t,e,n,r,i){let s=0;if(n.length===0){for(;s<i;s++)e[s]=t[s];for(;s<r;s++)e[s]=t[s]+e[s-i]&255}else{for(;s<i;s++)e[s]=t[s]+n[s]&255;for(;s<r;s++)e[s]=t[s]+sDe(e[s-i],n[s],n[s-i])&255}}function sDe(t,e,n){const r=t+e-n,i=Math.abs(r-t),s=Math.abs(r-e),a=Math.abs(r-n);return i<=s&&i<=a?t:s<=a?e:n}function aDe(t,e,n,r,i,s){switch(t){case 0:BZ(e,n,i);break;case 1:UZ(e,n,i,s);break;case 2:zZ(e,n,r,i);break;case 3:$Z(e,n,r,i,s);break;case 4:VZ(e,n,r,i,s);break;default:throw new Error(`Unsupported filter: ${t}`)}}const oDe=new Uint16Array([255]),lDe=new Uint8Array(oDe.buffer),cDe=lDe[0]===255;function uDe(t){const{data:e,width:n,height:r,channels:i,depth:s}=t,a=[{x:0,y:0,xStep:8,yStep:8},{x:4,y:0,xStep:8,yStep:8},{x:0,y:4,xStep:4,yStep:8},{x:2,y:0,xStep:4,yStep:4},{x:0,y:2,xStep:2,yStep:4},{x:1,y:0,xStep:2,yStep:2},{x:0,y:1,xStep:1,yStep:2}],o=Math.ceil(s/8)*i,l=new Uint8Array(r*n*o);let c=0;for(let u=0;u<7;u++){const d=a[u],f=Math.ceil((n-d.x)/d.xStep),h=Math.ceil((r-d.y)/d.yStep);if(f<=0||h<=0)continue;const p=f*o,m=new Uint8Array(p);for(let g=0;g<h;g++){const v=e[c++],_=e.subarray(c,c+p);c+=p;const b=new Uint8Array(p);aDe(v,_,b,m,p,o),m.set(b);for(let x=0;x<f;x++){const T=d.x+x*d.xStep,N=d.y+g*d.yStep;if(!(T>=n||N>=r))for(let A=0;A<o;A++)l[(N*n+T)*o+A]=b[x*o+A]}}}if(s===16){const u=new Uint16Array(l.buffer);if(cDe)for(let d=0;d<u.length;d++)u[d]=dDe(u[d]);return u}else return l}function dDe(t){return(t&255)<<8|t>>8&255}const hDe=new Uint16Array([255]),fDe=new Uint8Array(hDe.buffer),pDe=fDe[0]===255,mDe=new Uint8Array(0);function jU(t){const{data:e,width:n,height:r,channels:i,depth:s}=t,a=Math.ceil(s/8)*i,o=Math.ceil(s/8*i*n),l=new Uint8Array(r*o);let c=mDe,u=0,d,f;for(let h=0;h<r;h++){switch(d=e.subarray(u+1,u+1+o),f=l.subarray(h*o,(h+1)*o),e[u]){case 0:BZ(d,f,o);break;case 1:UZ(d,f,o,a);break;case 2:zZ(d,f,c,o);break;case 3:$Z(d,f,c,o,a);break;case 4:VZ(d,f,c,o,a);break;default:throw new Error(`Unsupported filter: ${e[u]}`)}c=f,u+=o+1}if(s===16){const h=new Uint16Array(l.buffer);if(pDe)for(let p=0;p<h.length;p++)h[p]=gDe(h[p]);return h}else return l}function gDe(t){return(t&255)<<8|t>>8&255}const Ax=Uint8Array.of(137,80,78,71,13,10,26,10);function BU(t){if(!vDe(t.readBytes(Ax.length)))throw new Error("wrong PNG signature")}function vDe(t){if(t.length<Ax.length)return!1;for(let e=0;e<Ax.length;e++)if(t[e]!==Ax[e])return!1;return!0}const yDe="tEXt",_De=0,qZ=new TextDecoder("latin1");function wDe(t){if(xDe(t),t.length===0||t.length>79)throw new Error("keyword length must be between 1 and 79")}const bDe=/^[\u0000-\u00FF]*$/;function xDe(t){if(!bDe.test(t))throw new Error("invalid latin1 text")}function kDe(t,e,n){const r=WZ(e);t[r]=SDe(e,n-r.length-1)}function WZ(t){for(t.mark();t.readByte()!==_De;);const e=t.offset;t.reset();const n=qZ.decode(t.readBytes(e-t.offset-1));return t.skip(1),wDe(n),n}function SDe(t,e){return qZ.decode(t.readBytes(e))}const uo={UNKNOWN:-1,GREYSCALE:0,TRUECOLOUR:2,INDEXED_COLOUR:3,GREYSCALE_ALPHA:4,TRUECOLOUR_ALPHA:6},CE={UNKNOWN:-1,DEFLATE:0},UU={UNKNOWN:-1,ADAPTIVE:0},EE={UNKNOWN:-1,NO_INTERLACE:0,ADAM7:1},_2={NONE:0,BACKGROUND:1,PREVIOUS:2},AE={SOURCE:0,OVER:1};class TDe extends uO{constructor(n,r={}){super(n);X(this,"_checkCrc");X(this,"_inflator");X(this,"_png");X(this,"_apng");X(this,"_end");X(this,"_hasPalette");X(this,"_palette");X(this,"_hasTransparency");X(this,"_transparency");X(this,"_compressionMethod");X(this,"_filterMethod");X(this,"_interlaceMethod");X(this,"_colorType");X(this,"_isAnimated");X(this,"_numberOfFrames");X(this,"_numberOfPlays");X(this,"_frames");X(this,"_writingDataChunks");const{checkCrc:i=!1}=r;this._checkCrc=i,this._inflator=new OU,this._png={width:-1,height:-1,channels:-1,data:new Uint8Array(0),depth:1,text:{}},this._apng={width:-1,height:-1,channels:-1,depth:1,numberOfFrames:1,numberOfPlays:0,text:{},frames:[]},this._end=!1,this._hasPalette=!1,this._palette=[],this._hasTransparency=!1,this._transparency=new Uint16Array(0),this._compressionMethod=CE.UNKNOWN,this._filterMethod=UU.UNKNOWN,this._interlaceMethod=EE.UNKNOWN,this._colorType=uo.UNKNOWN,this._isAnimated=!1,this._numberOfFrames=1,this._numberOfPlays=0,this._frames=[],this._writingDataChunks=!1,this.setBigEndian()}decode(){for(BU(this);!this._end;){const n=this.readUint32(),r=this.readChars(4);this.decodeChunk(n,r)}return this.decodeImage(),this._png}decodeApng(){for(BU(this);!this._end;){const n=this.readUint32(),r=this.readChars(4);this.decodeApngChunk(n,r)}return this.decodeApngImage(),this._apng}decodeChunk(n,r){const i=this.offset;switch(r){case"IHDR":this.decodeIHDR();break;case"PLTE":this.decodePLTE(n);break;case"IDAT":this.decodeIDAT(n);break;case"IEND":this._end=!0;break;case"tRNS":this.decodetRNS(n);break;case"iCCP":this.decodeiCCP(n);break;case yDe:kDe(this._png.text,this,n);break;case"pHYs":this.decodepHYs();break;default:this.skip(n);break}if(this.offset-i!==n)throw new Error(`Length mismatch while decoding chunk ${r}`);this._checkCrc?FU(this,n+4,r):this.skip(4)}decodeApngChunk(n,r){const i=this.offset;switch(r!=="fdAT"&&r!=="IDAT"&&this._writingDataChunks&&this.pushDataToFrame(),r){case"acTL":this.decodeACTL();break;case"fcTL":this.decodeFCTL();break;case"fdAT":this.decodeFDAT(n);break;default:this.decodeChunk(n,r),this.offset=i+n;break}if(this.offset-i!==n)throw new Error(`Length mismatch while decoding chunk ${r}`);this._checkCrc?FU(this,n+4,r):this.skip(4)}decodeIHDR(){const n=this._png;n.width=this.readUint32(),n.height=this.readUint32(),n.depth=CDe(this.readUint8());const r=this.readUint8();this._colorType=r;let i;switch(r){case uo.GREYSCALE:i=1;break;case uo.TRUECOLOUR:i=3;break;case uo.INDEXED_COLOUR:i=1;break;case uo.GREYSCALE_ALPHA:i=2;break;case uo.TRUECOLOUR_ALPHA:i=4;break;case uo.UNKNOWN:default:throw new Error(`Unknown color type: ${r}`)}if(this._png.channels=i,this._compressionMethod=this.readUint8(),this._compressionMethod!==CE.DEFLATE)throw new Error(`Unsupported compression method: ${this._compressionMethod}`);this._filterMethod=this.readUint8(),this._interlaceMethod=this.readUint8()}decodeACTL(){this._numberOfFrames=this.readUint32(),this._numberOfPlays=this.readUint32(),this._isAnimated=!0}decodeFCTL(){const n={sequenceNumber:this.readUint32(),width:this.readUint32(),height:this.readUint32(),xOffset:this.readUint32(),yOffset:this.readUint32(),delayNumber:this.readUint16(),delayDenominator:this.readUint16(),disposeOp:this.readUint8(),blendOp:this.readUint8(),data:new Uint8Array(0)};this._frames.push(n)}decodePLTE(n){if(n%3!==0)throw new RangeError(`PLTE field length must be a multiple of 3. Got ${n}`);const r=n/3;this._hasPalette=!0;const i=[];this._palette=i;for(let s=0;s<r;s++)i.push([this.readUint8(),this.readUint8(),this.readUint8()])}decodeIDAT(n){this._writingDataChunks=!0;const r=n,i=this.offset+this.byteOffset;if(this._inflator.push(new Uint8Array(this.buffer,i,r)),this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);this.skip(n)}decodeFDAT(n){this._writingDataChunks=!0;let r=n,i=this.offset+this.byteOffset;if(i+=4,r-=4,this._inflator.push(new Uint8Array(this.buffer,i,r)),this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);this.skip(n)}decodetRNS(n){switch(this._colorType){case uo.GREYSCALE:case uo.TRUECOLOUR:{if(n%2!==0)throw new RangeError(`tRNS chunk length must be a multiple of 2. Got ${n}`);if(n/2>this._png.width*this._png.height)throw new Error(`tRNS chunk contains more alpha values than there are pixels (${n/2} vs ${this._png.width*this._png.height})`);this._hasTransparency=!0,this._transparency=new Uint16Array(n/2);for(let r=0;r<n/2;r++)this._transparency[r]=this.readUint16();break}case uo.INDEXED_COLOUR:{if(n>this._palette.length)throw new Error(`tRNS chunk contains more alph
584a values than there are palette colors (${n} vs ${this._palette.length})`);let r=0;for(;r<n;r++){const i=this.readByte();this._palette[r].push(i)}for(;r<this._palette.length;r++)this._palette[r].push(255);break}case uo.UNKNOWN:case uo.GREYSCALE_ALPHA:case uo.TRUECOLOUR_ALPHA:default:throw new Error(`tRNS chunk is not supported for color type ${this._colorType}`)}}decodeiCCP(n){const r=WZ(this),i=this.readUint8();if(i!==CE.DEFLATE)throw new Error(`Unsupported iCCP compression method: ${i}`);const s=this.readBytes(n-r.length-2);this._png.iccEmbeddedProfile={name:r,profile:nDe(s)}}decodepHYs(){const n=this.readUint32(),r=this.readUint32(),i=this.readByte();this._png.resolution={x:n,y:r,unit:i}}decodeApngImage(){this._apng.width=this._png.width,this._apng.height=this._png.height,this._apng.channels=this._png.channels,this._apng.depth=this._png.depth,this._apng.numberOfFrames=this._numberOfFrames,this._apng.numberOfPlays=this._numberOfPlays,this._apng.text=this._png.text,this._apng.resolution=this._png.resolution;for(let n=0;n<this._numberOfFrames;n++){const r={sequenceNumber:this._frames[n].sequenceNumber,delayNumber:this._frames[n].delayNumber,delayDenominator:this._frames[n].delayDenominator,data:this._apng.depth===8?new Uint8Array(this._apng.width*this._apng.height*this._apng.channels):new Uint16Array(this._apng.width*this._apng.height*this._apng.channels)},i=this._frames.at(n);if(i){if(i.data=jU({data:i.data,width:i.width,height:i.height,channels:this._apng.channels,depth:this._apng.depth}),this._hasPalette&&(this._apng.palette=this._palette),this._hasTransparency&&(this._apng.transparency=this._transparency),n===0||i.xOffset===0&&i.yOffset===0&&i.width===this._png.width&&i.height===this._png.height)r.data=i.data;else{const s=this._apng.frames.at(n-1);this.disposeFrame(i,s,r),this.addFrameDataToCanvas(r,i)}this._apng.frames.push(r)}}return this._apng}disposeFrame(n,r,i){switch(n.disposeOp){case _2.NONE:break;case _2.BACKGROUND:for(let s=0;s<this._png.height;s++)for(let a=0;a<this._png.width;a++){const o=(s*n.width+a)*this._png.channels;for(let l=0;l<this._png.channels;l++)i.data[o+l]=0}break;case _2.PREVIOUS:i.data.set(r.data);break;default:throw new Error("Unknown disposeOp")}}addFrameDataToCanvas(n,r){const i=1<<this._png.depth,s=(a,o)=>{const l=((a+r.yOffset)*this._png.width+r.xOffset+o)*this._png.channels,c=(a*r.width+o)*this._png.channels;return{index:l,frameIndex:c}};switch(r.blendOp){case AE.SOURCE:for(let a=0;a<r.height;a++)for(let o=0;o<r.width;o++){const{index:l,frameIndex:c}=s(a,o);for(let u=0;u<this._png.channels;u++)n.data[l+u]=r.data[c+u]}break;case AE.OVER:for(let a=0;a<r.height;a++)for(let o=0;o<r.width;o++){const{index:l,frameIndex:c}=s(a,o);for(let u=0;u<this._png.channels;u++){const d=r.data[c+this._png.channels-1]/i,f=u%(this._png.channels-1)===0?1:r.data[c+u],h=Math.floor(d*f+(1-d)*n.data[l+u]);n.data[l+u]+=h}}break;default:throw new Error("Unknown blendOp")}}decodeImage(){var r;if(this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);const n=this._isAnimated?((r=this._frames)==null?void 0:r.at(0)).data:this._inflator.result;if(this._filterMethod!==UU.ADAPTIVE)throw new Error(`Filter method ${this._filterMethod} not supported`);if(this._interlaceMethod===EE.NO_INTERLACE)this._png.data=jU({data:n,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else if(this._interlaceMethod===EE.ADAM7)this._png.data=uDe({data:n,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else throw new Error(`Interlace method ${this._interlaceMethod} not supported`);this._hasPalette&&(this._png.palette=this._palette),this._hasTransparency&&(this._png.transparency=this._transparency)}pushDataToFrame(){const n=this._inflator.result,r=this._frames.at(-1);r?r.data=n:this._frames.push({sequenceNumber:0,width:this._png.width,height:this._png.height,xOffset:0,yOffset:0,delayNumber:0,delayDenominator:0,disposeOp:_2.NONE,blendOp:AE.SOURCE,data:n}),this._inflator=new OU,this._writingDataChunks=!1}}function CDe(t){if(t!==1&&t!==2&&t!==4&&t!==8&&t!==16)throw new Error(`invalid bit depth: ${t}`);return t}var zU;(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.METRE=1]="METRE"})(zU||(zU={}));function EDe(t,e){return new TDe(t,e).decode()}var Yt=function(){return typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this}();function PE(){Yt.console&&typeof Yt.console.log=="function"&&Yt.console.log.apply(Yt.console,arguments)}var pr={log:PE,warn:function(t){Yt.console&&(typeof Yt.console.warn=="function"?Yt.console.warn.apply(Yt.console,arguments):PE.call(null,arguments))},error:function(t){Yt.console&&(typeof Yt.console.error=="function"?Yt.console.error.apply(Yt.console,arguments):PE(t))}};function ME(t,e,n){var r=new XMLHttpRequest;r.open("GET",t),r.responseType="blob",r.onload=function(){Yf(r.response,e,n)},r.onerror=function(){pr.error("could not download file")},r.send()}function $U(t){var e=new XMLHttpRequest;e.open("HEAD",t,!1);try{e.send()}catch{}return e.status>=200&&e.status<=299}function w2(t){try{t.dispatchEvent(new MouseEvent("click"))}catch{var e=document.createEvent("MouseEvents");
vendor: 3,407 bytes, lines 584-589
584e.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),t.dispatchEvent(e)}}var Yf=Yt.saveAs||((typeof window>"u"?"undefined":sr(window))!=="object"||window!==Yt?function(){}:typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype?function(t,e,n){var r=Yt.URL||Yt.webkitURL,i=document.createElement("a");e=e||t.name||"download",i.download=e,i.rel="noopener",typeof t=="string"?(i.href=t,i.origin!==location.origin?$U(i.href)?ME(t,e,n):w2(i,i.target="_blank"):w2(i)):(i.href=r.createObjectURL(t),setTimeout(function(){r.revokeObjectURL(i.href)},4e4),setTimeout(function(){w2(i)},0))}:"msSaveOrOpenBlob"in navigator?function(t,e,n){if(e=e||t.name||"download",typeof t=="string")if($U(t))ME(t,e,n);else{var r=document.createElement("a");r.href=t,r.target="_blank",setTimeout(function(){w2(r)})}else navigator.msSaveOrOpenBlob(function(i,s){return s===void 0?s={autoBom:!1}:sr(s)!=="object"&&(pr.warn("Deprecated: Expected third argument to be a object"),s={autoBom:!s}),s.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(i.type)?new Blob(["\uFEFF",i],{type:i.type}):i}(t,n),e)}:function(t,e,n,r){if((r=r||open("","_blank"))&&(r.document.title=r.document.body.innerText="downloading..."),typeof t=="string")return ME(t,e,n);var i=t.type==="application/octet-stream",s=/constructor/i.test(Yt.HTMLElement)||Yt.safari,a=/CriOS\/[\d]+/.test(navigator.userAgent);if((a||i&&s)&&(typeof FileReader>"u"?"undefined":sr(FileReader))==="object"){var o=new FileReader;o.onloadend=function(){var u=o.result;u=a?u:u.replace(/^data:[^;]*;/,"data:attachment/file;"),r?r.location.href=u:location=u,r=null},o.readAsDataURL(t)}else{var l=Yt.URL||Yt.webkitURL,c=l.createObjectURL(t);r?r.location=c:location.href=c,r=null,setTimeout(function(){l.revokeObjectURL(c)},4e4)}});/** 585 * A class to parse color values 586 * @author Stoyan Stefanov <[email protected]> 587 * {@link http://www.phpied.com/rgb-color-parser-in-javascript/} 588 * @license Use it if you like it 589 */function GZ(t){var e;t=t||"",this.ok=!1,t.charAt(0)=="#"&&(t=t.substr(1,6)),t={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee9
5890",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"}[t=(t=t.replace(/ /g,"")).toLowerCase()]||t;for(var n=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(o){return[parseInt(o[1]),parseInt(o[2]),parseInt(o[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(o){return[parseInt(o[1],16),parseInt(o[2],16),parseInt(o[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(o){return[parseInt(o[1]+o[1],16),parseInt(o[2]+o[2],16),parseInt(o[3]+o[3],16)]}}],r=0;r<n.length;r++){var i=n[r].re,s=n[r].process,a=i.exec(t);a&&(e=s(a),this.r=e[0],this.g=e[1],this.b=e[2],this.ok=!0)}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toHex=function(){var o=this.r.toString(16),l=this.g.toString(16),c=this.b.toString(16);return o.length==1&&(o="0"+o),l.length==1&&(l="0"+l),c.length==1&&(c="0"+c),"#"+o+l+c}}var Px=Yt.atob.bind(Yt),VU=Yt.btoa.bind(Yt);/** 590 * @license 591 * Joseph Myers does not specify a particular license for his work. 592 * 593 * Author: Joseph Myers 594 * Accessed from: http://www.myersdaily.org/joseph/javascript/md5.js 595 * 596 * Modified by: Owen Leong 597 */function NE(t,e){var n=t[0],r=t[1],i=t[2],s=t[3];n=$s(n,r,i,s,e[0],7,-680876936),s=$s(s,n,r,i,e[1],12,-389564586),i=$s(i,s,n,r,e[2],17,606105819),r=$s(r,i,s,n,e[3],22,-1044525330),n=$s(n,r,i,s,e[4],7,-176418897),s=$s(s,n,r,i,e[5],12,1200080426),i=$s(i,s,n,r,e[6],17,-1473231341),r=$s(r,i,s,n,e[7],22,-45705983),n=$s(n,r,i,s,e[8],7,1770035416),s=$s(s,n,r,i,e[9],12,-1958414417),i=$s(i,s,n,r,e[10],17,-42063),r=$s(r,i,s,n,e[11],22,-1990404162),n=$s(n,r,i,s,e[12],7,1804603682),s=$s(s,n,r,i,e[13],12,-40341101),i=$s(i,s,n,r,e[14],17,-1502002290),n=Vs(n,r=$s(r,i,s,n,e[15],22,1236535329),i,s,e[1],5,-165796510),s=Vs(s,n,r,i,e[6],9,-1069501632),i=Vs(i,s,n,r,e[11],14,643717713),r=Vs(r,i,s,n,e[0],20,-373897302),n=Vs(n,r,i,s,e[5],5,-701558691),s=Vs(s,n,r,i,e[10],9,38016083),i=Vs(i,s,n,r,e[15],14,-660478335),r=Vs(r,i,s,n,e[4],20,-405537848),n=Vs(n,r,i,s,e[9],5,568446438),s=Vs(s,n,r,i,e[14],9,-1019803690),i=Vs(i,s,n,r,e[3],14,-187363961),r=Vs(r,i,s,n,e[8],20,1163531501),n=Vs(n,r,i,s,e[13],5,-1444681467),s=Vs(s,n,r,i,e[2],9,-51403784),i=Vs(i,s,n,r,e[7],14,1735328473),n=qs(n,r=Vs(r,i,s,n,e[12],20,-1926607734),i,s,e[5],4,-378558),s=qs(s,n,r,i,e[8],11,-2022574463),i=qs(i,s,n,r,e[11],16,1839030562),r=qs(r,i,s,n,e[14],23,-35309556),n=qs(n,r,i,s,e[1],4,-1530992060),s=qs(s,n,r,i,e[4],11,1272893353),i=qs(i,s,n,r,e[7],16,-155497632),r=qs(r,i,s,n,e[10],23,-1094730640),n=qs(n,r,i,s,e[13],4,681279174),s=qs(s,n,r,i,e[0],11,-358537222),i=qs(i,s,n,r,e[3],16,-722521979),r=qs(r,i,s,n,e[6],23,76029189),n=qs(n,r,i,s,e[9],4,
vendor: 8,703 bytes, lines 597-614
597-640364487),s=qs(s,n,r,i,e[12],11,-421815835),i=qs(i,s,n,r,e[15],16,530742520),n=Ws(n,r=qs(r,i,s,n,e[2],23,-995338651),i,s,e[0],6,-198630844),s=Ws(s,n,r,i,e[7],10,1126891415),i=Ws(i,s,n,r,e[14],15,-1416354905),r=Ws(r,i,s,n,e[5],21,-57434055),n=Ws(n,r,i,s,e[12],6,1700485571),s=Ws(s,n,r,i,e[3],10,-1894986606),i=Ws(i,s,n,r,e[10],15,-1051523),r=Ws(r,i,s,n,e[1],21,-2054922799),n=Ws(n,r,i,s,e[8],6,1873313359),s=Ws(s,n,r,i,e[15],10,-30611744),i=Ws(i,s,n,r,e[6],15,-1560198380),r=Ws(r,i,s,n,e[13],21,1309151649),n=Ws(n,r,i,s,e[4],6,-145523070),s=Ws(s,n,r,i,e[11],10,-1120210379),i=Ws(i,s,n,r,e[2],15,718787259),r=Ws(r,i,s,n,e[9],21,-343485551),t[0]=Ch(n,t[0]),t[1]=Ch(r,t[1]),t[2]=Ch(i,t[2]),t[3]=Ch(s,t[3])}function QT(t,e,n,r,i,s){return e=Ch(Ch(e,t),Ch(r,s)),Ch(e<<i|e>>>32-i,n)}function $s(t,e,n,r,i,s,a){return QT(e&n|~e&r,t,e,i,s,a)}function Vs(t,e,n,r,i,s,a){return QT(e&r|n&~r,t,e,i,s,a)}function qs(t,e,n,r,i,s,a){return QT(e^n^r,t,e,i,s,a)}function Ws(t,e,n,r,i,s,a){return QT(n^(e|~r),t,e,i,s,a)}function HZ(t){var e,n=t.length,r=[1732584193,-271733879,-1732584194,271733878];for(e=64;e<=t.length;e+=64)NE(r,ADe(t.substring(e-64,e)));t=t.substring(e-64);var i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(e=0;e<t.length;e++)i[e>>2]|=t.charCodeAt(e)<<(e%4<<3);if(i[e>>2]|=128<<(e%4<<3),e>55)for(NE(r,i),e=0;e<16;e++)i[e]=0;return i[14]=8*n,NE(r,i),r}function ADe(t){var e,n=[];for(e=0;e<64;e+=4)n[e>>2]=t.charCodeAt(e)+(t.charCodeAt(e+1)<<8)+(t.charCodeAt(e+2)<<16)+(t.charCodeAt(e+3)<<24);return n}var qU="0123456789abcdef".split("");function PDe(t){for(var e="",n=0;n<4;n++)e+=qU[t>>8*n+4&15]+qU[t>>8*n&15];return e}function MDe(t){return String.fromCharCode(255&t,(65280&t)>>8,(16711680&t)>>16,(4278190080&t)>>24)}function EN(t){return HZ(t).map(MDe).join("")}var NDe=function(t){for(var e=0;e<t.length;e++)t[e]=PDe(t[e]);return t.join("")}(HZ("hello"))!="5d41402abc4b2a76b9719d911017c592";function Ch(t,e){if(NDe){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}return t+e&4294967295}/** 598 * @license 599 * FPDF is released under a permissive license: there is no usage restriction. 600 * You may embed it freely in your application (commercial or not), with or 601 * without modifications. 602 * 603 * Reference: http://www.fpdf.org/en/script/script37.php 604 */function AN(t,e){var n,r,i,s;if(t!==n){for(var a=(i=t,s=1+(256/t.length|0),new Array(s+1).join(i)),o=[],l=0;l<256;l++)o[l]=l;var c=0;for(l=0;l<256;l++){var u=o[l];c=(c+u+a.charCodeAt(l))%256,o[l]=o[c],o[c]=u}n=t,r=o}else o=r;var d=e.length,f=0,h=0,p="";for(l=0;l<d;l++)h=(h+(u=o[f=(f+1)%256]))%256,o[f]=o[h],o[h]=u,a=o[(o[f]+o[h])%256],p+=String.fromCharCode(e.charCodeAt(l)^a);return p}/** 605 * @license 606 * Licensed under the MIT License. 607 * http://opensource.org/licenses/mit-license 608 * Author: Owen Leong (@owenl131) 609 * Date: 15 Oct 2020 610 * References: 611 * https://www.cs.cmu.edu/~dst/Adobe/Gallery/anon21jul01-pdf-encryption.txt 612 * https://github.com/foliojs/pdfkit/blob/master/lib/security.js 613 * http://www.fpdf.org/en/script/script37.php 614 */var WU={print:4,modify:8,copy:16,"annot-forms":32};function vg(t,e,n,r){this.v=1,this.r=2;var i=192;t.forEach(function(o){if(WU.perm!==void 0)throw new Error("Invalid permission: "+o);i+=WU[o]}),this.padding="(¿N^NuÂAd\0NVÿú�\b..\0¶Ãh>Â/\f©þdSiz";var s=(e+this.padding).substr(0,32),a=(n+this.padding).substr(0,32);this.O=this.processOwnerPassword(s,a),this.P=-(1+(255^i)),this.encryptionKey=EN(s+this.O+this.lsbFirstWord(this.P)+this.hexToBytes(r)).substr(0,5),this.U=AN(this.encryptionKey,this.padding)}function yg(t){if(/[^\u0000-\u00ff]/.test(t))throw new Error("Invalid PDF Name Object: "+t+", Only accept ASCII characters.");for(var e="",n=t.length,r=0;r<n;r++){var i=t.charCodeAt(r);e+=i<33||i===35||i===37||i===40||i===41||i===47||i===60||i===62||i===91||i===93||i===123||i===125||i>126?"#"+("0"+i.toString(16)).slice(-2):t[r]}return e}function GU(t){if(sr(t)!=="object")throw new Error("Invalid Context passed to initialize PubSub (jsPDF-module)");var e={};this.subscribe=function(n,r,i){if(i=i||!1,typeof n!="string"||typeof r!="function"||typeof i!="boolean")throw new Error("Invalid arguments passed to PubSub.subscribe (jsPDF-module)");e.hasOwnProperty(n)||(e[n]={});var s=Math.random().toString(35);return e[n][s]=[r,!!i],s},this.unsubscribe=function(n){for(var r in e)if(e[r][n])return delete e[r][n],Object.keys(e[r]).length===0&&delete e[r],!0;return!1},this.publish=function(n){if(e.hasOwnProperty(n)){var r=Array.prototype.slice.call(arguments,1),i=[];for(var s in e[n]){var a=e[n][s];try{a[0].apply(t,r)}catch(o){Yt.console&&pr.error("jsPDF PubSub Error",o.message,o)}a[1]&&i.push(s)}i.length&&i.forEach(this.unsubscribe)}},this.getTopics=function(){return e}}function uS(t){if(!(this instanceof uS))return new uS(t);var e="opacity,stroke-opacity".split(",");for(var n in t)t.hasOwnProperty(n)&&e.indexOf(n)>=0&&(this[n]=t[n]);this.id="",this.objectNumber=-1}function KZ(t,e){this.gState=t,this.matrix=e,this.id="",this.objectNumber=-1}function np(t,e,n,r,i){if(!(this instanceof np))return new np(t,e,n,r,i);this.type=t==="axial"?2:3,this.coords=e,this.colors=n,KZ.call(this,r,i)}function Bg(t,e,n,r,i){if(!(this instanceof Bg))return new Bg(t,e,n,r,i);this.boundingBox=t,this.xStep=e,this.yStep=n,this.stream="",this.cloneIndex=0,KZ.call(this,r,i)}function Rt(t){var e,n=typeof arguments[0]=="string"?arguments[0]:"p",r=arguments[1],i=arguments[2],s=arguments[3],a=[],o=1,l=16,c="S",u=null;sr(t=t||{})==="object"&&(n=t.orientation,r=t.unit||r,i=t.format||i,s=t.compress||t.compressPdf||s,(u=t.encryption||null)!==null&&(u.userPassword=u.userPassword||"",u.ownerPassword=u.ownerPassword||"",u.userPermissions=u.userPermissions||[]),o=typeof t.userUnit=="number"?Math.abs(t.userUnit):1,t.precision!==void 0&&(e=t.precision),t.floatPrecision!==void 0&&(l=t.floatPrecision),c=t.defaultPathOperation||"S"),a=t.filters||(s===!0?["FlateEncode"]:a),r=r||"mm",n=(""+(n||"P")).toLowerCase();var d=t.putOnlyUsedFonts||!1,f={},h={internal:{},__private__:{}};h.__private__.PubSub=GU;var p="1.3",m=h.__private__.getPdfVersion=function(){return p};h.__private__.setPdfVersion=function(C){p=C};var g={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};h.__private__.getPageFormats=function(){return g};var v=h.__private__.getPageFormat=function(C){return g[C]};i=i||"a4";var _="compat",b="advanced",x=_;function T(){this.saveGraphicsState(),re(new ct(Ut,0,0,-Ut,0,yu()*Ut).toString()+" cm"),this.setFontSize(this.getFontSize()/Ut),c="n",x=b}function N(){this.restoreGraphicsState(),c="S",x=_}var A=h.__private__.combineFontStyleAndFontWeight=function(C,W){if(C=="bold"&&W=="normal"||C=="bold"&&W==400||C=="normal"&&W=="italic"||C=="bold"&&W=="italic")throw new Error("Invalid Combination of fontweight and fontstyle");return W&&(C=W==400||W==="normal"?C==="italic"?"italic":"normal":W!=700&&W!=="bold"||C!=="normal"?(W==700?"bold":W)+""+C:"bold"),C};h.advancedAPI=function(C){var W=x===_;return W&&T.call(this),typeof C!="function"||(C(this),W&&N.call(this)),this},h.compatAPI=function(C){var W=x===b;return W&&N.call(this),typeof C!="function"||(C(this),W&&T.call(this)),this},h.isAdvancedAPI=function(){return x===b};var L,M=function(C){if(x!==b)throw new Error(C+" is only available in 'advanced' API mode. You need to call advancedAPI() first.")},B=h.roundToPrecision=h.__private__.roundToPrecision=function(C,W){var ie=e||W;if(isNaN(C)||isNaN(ie))throw new Error("Invalid argument passed to jsPDF.roundToPrecision");return C.toFixed(ie).replace(/0+$/,"")};L=h.hpf=h.__private__.hpf=typeof l=="number"?function(C){if(isNaN(C))throw new Error("Invalid argument passed to jsPDF.hpf");return B(C,l)}:l==="smart"?function(C){if(isNaN(C))throw new Error("Invalid argument passed to jsPDF.hpf");return B(C,C>-1&&C<1?16:5)}:function(C){if(isNaN(C))throw new Error("Invalid argument passed to jsPDF.hpf");return B(C,16)};var R=h.f2=h.__private__.f2=function(C){if(isNaN(C))throw new Error("Invalid argument passed to
614jsPDF.f2");return B(C,2)},j=h.__private__.f3=function(C){if(isNaN(C))throw new Error("Invalid argument passed to jsPDF.f3");return B(C,3)},$=h.scale=h.__private__.scale=function(C){if(isNaN(C))throw new Error("Invalid argument passed to jsPDF.scale");return x===_?C*Ut:x===b?C:void 0},U=function(C){return $(function(W){return x===_?yu()-W:x===b?W:void 0}(C))};h.__private__.setPrecision=h.setPrecision=function(C){typeof parseInt(C,10)=="number"&&(e=parseInt(C,10))};var te,ne="00000000000000000000000000000000",le=h.__private__.getFileId=function(){return ne},V=h.__private__.setFileId=function(C){return ne=C!==void 0&&/^[a-fA-F0-9]{32}$/.test(C)?C.toUpperCase():ne.split("").map(function(){return"ABCDEF0123456789".charAt(Math.floor(16*Math.random()))}).join(""),u!==null&&(Bi=new vg(u.userPermissions,u.userPassword,u.ownerPassword,ne)),ne};h.setFileId=function(C){return V(C),this},h.getFileId=function(){return le()};var q=h.__private__.convertDateToPDFDate=function(C){var W=C.getTimezoneOffset(),ie=W<0?"+":"-",pe=Math.floor(Math.abs(W/60)),_e=Math.abs(W%60),Me=[ie,Y(pe),"'",Y(_e),"'"].join("");return["D:",C.getFullYear(),Y(C.getMonth()+1),Y(C.getDate()),Y(C.getHours()),Y(C.getMinutes()),Y(C.getSeconds()),Me].join("")},se=h.__private__.convertPDFDateToDate=function(C){var W=parseInt(C.substr(2,4),10),ie=parseInt(C.substr(6,2),10)-1,pe=parseInt(C.substr(8,2),10),_e=parseInt(C.substr(10,2),10),Me=parseInt(C.substr(12,2),10),Be=parseInt(C.substr(14,2),10);return new Date(W,ie,pe,_e,Me,Be,0)},he=h.__private__.setCreationDate=function(C){var W;if(C===void 0&&(C=new Date),C instanceof Date)W=q(C);else{if(!/^D:(20[0-2][0-9]|203[0-7]|19[7-9][0-9])(0[0-9]|1[0-2])([0-2][0-9]|3[0-1])(0[0-9]|1[0-9]|2[0-3])(0[0-9]|[1-5][0-9])(0[0-9]|[1-5][0-9])(\+0[0-9]|\+1[0-4]|-0[0-9]|-1[0-1])'(0[0-9]|[1-5][0-9])'?$/.test(C))throw new Error("Invalid argument passed to jsPDF.setCreationDate");W=C}return te=W},z=h.__private__.getCreationDate=function(C){var W=te;return C==="jsDate"&&(W=se(te)),W};h.setCreationDate=function(C){return he(C),this},h.getCreationDate=function(C){return z(C)};var J,Y=h.__private__.padd2=function(C){return("0"+parseInt(C)).slice(-2)},de=h.__private__.padd2Hex=function(C){return("00"+(C=C.toString())).substr(C.length)},fe=0,me=[],Ce=[],Ee=0,Ae=[],De=[],Fe=!1,Re=Ce;h.__private__.setCustomOutputDestination=function(C){Fe=!0,Re=C};var Je=function(C){Fe||(Re=C)};h.__private__.resetCustomOutputDestination=function(){Fe=!1,Re=Ce};var re=h.__private__.out=function(C){return C=C.toString(),Ee+=C.length+1,Re.push(C),Re},Ye=h.__private__.write=function(C){return re(arguments.length===1?C.toString():Array.prototype.join.call(arguments," "))},Mt=h.__private__.getArrayBuffer=function(C){for(var W=C.length,ie=new ArrayBuffer(W),pe=new Uint8Array(ie);W--;)pe[W]=C.charCodeAt(W);return ie},xt=[["Helvetica","helvetica","normal","WinAnsiEncoding"],["Helvetica-Bold","helvetica","bold","WinAnsiEncoding"],["Helvetica-Oblique","helvetica","italic","WinAnsiEncoding"],["Helvetica-BoldOblique","helvetica","bolditalic","WinAnsiEncoding"],["Courier","courier","normal","WinAnsiEncoding"],["Courier-Bold","courier","bold","WinAnsiEncoding"],["Courier-Oblique","courier","italic","WinAnsiEncoding"],["Courier-BoldOblique","courier","bolditalic","WinAnsiEncoding"],["Times-Roman","times","normal","WinAnsiEncoding"],["Times-Bold","times","bold","WinAnsiEncoding"],["Times-Italic","times","italic","WinAnsiEncoding"],["Times-BoldItalic","times","bolditalic","WinAnsiEncoding"],["ZapfDingbats","zapfdingbats","normal",null],["Symbol","symbol","normal",null]];h.__private__.getStandardFonts=function(){return xt};var Ue=t.fontSize||16;h.__private__.setFontSize=h.setFontSize=function(C){return Ue=x===b?C/Ut:C,this};var St,ot=h.__private__.getFontSize=h.getFontSize=function(){return x===_?Ue:Ue*Ut},Et=t.R2L||!1;h.__private__.setR2L=h.setR2L=function(C){return Et=C,this},h.__private__.getR2L=h.getR2L=function(){return Et};var mt,An=h.__private__.setZoomMode=function(C){if(/^(?:\d+\.\d*|\d*\.\d+|\d+)%$/.test(C))St=C;else if(isNaN(C)){if([void 0,null,"fullwidth","fullheight","fullpage","original"].indexOf(C)===-1)throw new Error('zoom must be Integer (e.g. 2), a percentage Value (e.g. 300%) or fullwidth, fullheight, fullpage, original. "'+C+'" is not recognized.');St=C}else St=parseInt(C,10)};h.__private__.getZoomMode=function(){return St};var Kt,At=h.__private__.setPageMode=function(C){if([void 0,null,"UseNone","UseOutlines","UseThumbs","FullScreen"].indexOf(C)==-1)throw new Error('Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen. "'+C+'" is not recognized.');mt=C};h.__private__.getPageMode=function(){return mt};var Jt=h.__private__.setLayoutMode=function(C){if([void 0,null,"continuous","single","twoleft","tworight","two"].indexOf(C)==-1)throw new Error('Layout mode must be one of continuous, single, twoleft, tworight. "'+C+'" is not recognized.');Kt=C};h.__private__.getLayoutMode=function(){return Kt},h.__private__.setDisplayMode=h.setDisplayMode=function(C,W,ie){return An(C),Jt(W),At(ie),this};var ln={title:"",subject:"",author:"",keywords:"",creator:""};h.__private__.getDocumentProperty=function(C){if(Object.keys(ln).indexOf(C)===-1)throw new Error("Invalid argument passed to
614jsPDF.getDocumentProperty");return ln[C]},h.__private__.getDocumentProperties=function(){return ln},h.__private__.setDocumentProperties=h.setProperties=h.setDocumentProperties=function(C){for(var W in ln)ln.hasOwnProperty(W)&&C[W]&&(ln[W]=C[W]);return this},h.__private__.setDocumentProperty=function(C,W){if(Object.keys(ln).indexOf(C)===-1)throw new Error("Invalid arguments passed to jsPDF.setDocumentProperty");return ln[C]=W};var nt,Ut,ht,wr,pn,zt={},Qt={},Pn=[],Nt={},Zn={},It={},qt={},lr=null,rn=0,Tt=[],Mn=new GU(h),Dt=t.hotfixes||[],Wt={},_n={},Tr=[],ct=function C(W,ie,pe,_e,Me,Be){if(!(this instanceof C))return new C(W,ie,pe,_e,Me,Be);isNaN(W)&&(W=1),isNaN(ie)&&(ie=0),isNaN(pe)&&(pe=0),isNaN(_e)&&(_e=1),isNaN(Me)&&(Me=0),isNaN(Be)&&(Be=0),this._matrix=[W,ie,pe,_e,Me,Be]};Object.defineProperty(ct.prototype,"sx",{get:function(){return this._matrix[0]},set:function(C){this._matrix[0]=C}}),Object.defineProperty(ct.prototype,"shy",{get:function(){return this._matrix[1]},set:function(C){this._matrix[1]=C}}),Object.defineProperty(ct.prototype,"shx",{get:function(){return this._matrix[2]},set:function(C){this._matrix[2]=C}}),Object.defineProperty(ct.prototype,"sy",{get:function(){return this._matrix[3]},set:function(C){this._matrix[3]=C}}),Object.defineProperty(ct.prototype,"tx",{get:function(){return this._matrix[4]},set:function(C){this._matrix[4]=C}}),Object.defineProperty(ct.prototype,"ty",{get:function(){return this._matrix[5]},set:function(C){this._matrix[5]=C}}),Object.defineProperty(ct.prototype,"a",{get:function(){return this._matrix[0]},set:function(C){this._matrix[0]=C}}),Object.defineProperty(ct.prototype,"b",{get:function(){return this._matrix[1]},set:function(C){this._matrix[1]=C}}),Object.defineProperty(ct.prototype,"c",{get:function(){return this._matrix[2]},set:function(C){this._matrix[2]=C}}),Object.defineProperty(ct.prototype,"d",{get:function(){return this._matrix[3]},set:function(C){this._matrix[3]=C}}),Object.defineProperty(ct.prototype,"e",{get:function(){return this._matrix[4]},set:function(C){this._matrix[4]=C}}),Object.defineProperty(ct.prototype,"f",{get:function(){return this._matrix[5]},set:function(C){this._matrix[5]=C}}),Object.defineProperty(ct.prototype,"rotation",{get:function(){return Math.atan2(this.shx,this.sx)}}),Object.defineProperty(ct.prototype,"scaleX",{get:function(){return this.decompose().scale.sx}}),Object.defineProperty(ct.prototype,"scaleY",{get:function(){return this.decompose().scale.sy}}),Object.defineProperty(ct.prototype,"isIdentity",{get:function(){return this.sx===1&&this.shy===0&&this.shx===0&&this.sy===1&&this.tx===0&&this.ty===0}}),ct.prototype.join=function(C){return[this.sx,this.shy,this.shx,this.sy,this.tx,this.ty].map(L).join(C)},ct.prototype.multiply=function(C){var W=C.sx*this.sx+C.shy*this.shx,ie=C.sx*this.shy+C.shy*this.sy,pe=C.shx*this.sx+C.sy*this.shx,_e=C.shx*this.shy+C.sy*this.sy,Me=C.tx*this.sx+C.ty*this.shx+this.tx,Be=C.tx*this.shy+C.ty*this.sy+this.ty;return new ct(W,ie,pe,_e,Me,Be)},ct.prototype.decompose=function(){var C=this.sx,W=this.shy,ie=this.shx,pe=this.sy,_e=this.tx,Me=this.ty,Be=Math.sqrt(C*C+W*W),ut=(C/=Be)*ie+(W/=Be)*pe;ie-=C*ut,pe-=W*ut;var gt=Math.sqrt(ie*ie+pe*pe);return ut/=gt,C*(pe/=gt)<W*(ie/=gt)&&(C=-C,W=-W,ut=-ut,Be=-Be),{scale:new ct(Be,0,0,gt,0,0),translate:new ct(1,0,0,1,_e,Me),rotate:new ct(C,W,-W,C,0,0),skew:new ct(1,0,ut,1,0,0)}},ct.prototype.toString=function(C){return this.join(" ")},ct.prototype.inversed=function(){var C=this.sx,W=this.shy,ie=this.shx,pe=this.sy,_e=this.tx,Me=this.ty,Be=1/(C*pe-W*ie),ut=pe*Be,gt=-W*Be,Gt=-ie*Be,tn=C*Be;return new ct(ut,gt,Gt,tn,-ut*_e-Gt*Me,-gt*_e-tn*Me)},ct.prototype.applyToPoint=function(C){var W=C.x*this.sx+C.y*this.shx+this.tx,ie=C.x*this.shy+C.y*this.sy+this.ty;return new gu(W,ie)},ct.prototype.applyToRectangle=function(C){var W=this.applyToPoint(C),ie=this.applyToPoint(new gu(C.x+C.w,C.y+C.h));return new kf(W.x,W.y,ie.x-W.x,ie.y-W.y)},ct.prototype.clone=function(){var C=this.sx,W=this.shy,ie=this.shx,pe=this.sy,_e=this.tx,Me=this.ty;return new ct(C,W,ie,pe,_e,Me)},h.Matrix=ct;var _i=h.matrixMult=function(C,W){return W.multiply(C)},Mi=new ct(1,0,0,1,0,0);h.unitMatrix=h.identityMatrix=Mi;var dr=function(C,W){if(!Zn[C]){var ie=(W instanceof np?"Sh":"P")+(Object.keys(Nt).length+1).toString(10);W.id=ie,Zn[C]=ie,Nt[ie]=W,Mn.publish("addPattern",W)}};h.ShadingPattern=np,h.TilingPattern=Bg,h.addShadingPattern=function(C,W){return M("addShadingPattern()"),dr(C,W),this},h.beginTilingPattern=function(C){M("beginTilingPattern()"),Sf(C.boundingBox[0],C.boundingBox[1],C.boundingBox[2]-C.boundingBox[0],C.boundingBox[3]-C.boundingBox[1],C.matrix)},h.endTilingPattern=function(C,W){M("endTilingPattern()"),W.stream=De[J].join(`
615`),dr(C,W),Mn.publish("endTilingPattern",W),Tr.pop().restore()};var Fr,Cr=h.__private__.newObject=function(){var C=wi();return Ni(C,!0),C},wi=h.__private__.newObjectDeferred=function(){return fe++,me[fe]=function(){return Ee},fe},Ni=function(C,W){return W=typeof W=="boolean"&&W,me[C]=Ee,W&&re(C+" 0 obj"),C},mc=h.__private__.newAdditionalObject=function(){var C={objId:wi(),content:""};return Ae.push(C),C},ll=wi(),Ma=wi(),eo=h.__private__.decodeColorString=function(C){var W=C.split(" ");if(W.length!==2||W[1]!=="g"&&W[1]!=="G")W.length!==5||W[4]!=="k"&&W[4]!=="K"||(W=[(1-W[0])*(1-W[3]),(1-W[1])*(1-W[3]),(1-W[2])*(1-W[3]),"r"]);else{var ie=parseFloat(W[0]);W=[ie,ie,ie,"r"]}for(var pe="#",_e=0;_e<3;_e++)pe+=("0"+Math.floor(255*parseFloat(W[_e])).toString(16)).slice(-2);return pe},Na=h.__private__.encodeColorString=function(C){var W;typeof C=="string"&&(C={ch1:C});var ie=C.ch1,pe=C.ch2,_e=C.ch3,Me=C.ch4,Be=C.pdfColorType==="draw"?["G","RG","K"]:["g","rg","k"];if(typeof ie=="string"&&ie.charAt(0)!=="#"){var ut=new GZ(ie);if(ut.ok)ie=ut.toHex();else if(!/^\d*\.?\d*$/.test(ie))throw new Error('Invalid color "'+ie+'" passed to jsPDF.encodeColorString.')}if(typeof ie=="string"&&/^#[0-9A-Fa-f]{3}$/.test(ie)&&(ie="#"+ie[1]+ie[1]+ie[2]+ie[2]+ie[3]+ie[3]),typeof ie=="string"&&/^#[0-9A-Fa-f]{6}$/.test(ie)){var gt=parseInt(ie.substr(1),16);ie=gt>>16&255,pe=gt>>8&255,_e=255>}if(pe===void 0||Me===void 0&&ie===pe&&pe===_e)W=typeof ie=="string"?ie+" "+Be[0]:C.precision===2?R(ie/255)+" "+Be[0]:j(ie/255)+" "+Be[0];else if(Me===void 0||sr(Me)==="object"){if(Me&&!isNaN(Me.a)&&Me.a===0)return["1.","1.","1.",Be[1]].join(" ");W=typeof ie=="string"?[ie,pe,_e,Be[1]].join(" "):C.precision===2?[R(ie/255),R(pe/255),R(_e/255),Be[1]].join(" "):[j(ie/255),j(pe/255),j(_e/255),Be[1]].join(" ")}else W=typeof ie=="string"?[ie,pe,_e,Me,Be[2]].join(" "):C.precision===2?[R(ie),R(pe),R(_e),R(Me),Be[2]].join(" "):[j(ie),j(pe),j(_e),j(Me),Be[2]].join(" ");return W},Ra=h.__private__.getFilters=function(){return a},Ia=h.__private__.putStream=function(C){var W=(C=C||{}).data||"",ie=C.filters||Ra(),pe=C.alreadyAppliedFilters||[],_e=C.addLength1||!1,Me=W.length,Be=C.objectId,ut=function(hr){return hr};if(u!==null&&Be===void 0)throw new Error("ObjectId must be passed to putStream for file encryption");u!==null&&(ut=Bi.encryptor(Be,0));var gt={};ie===!0&&(ie=["FlateEncode"]);var Gt=C.additionalKeyValues||[],tn=(gt=Rt.API.processDataByFilters!==void 0?Rt.API.processDataByFilters(W,ie):{data:W,reverseChain:[]}).reverseChain+(Array.isArray(pe)?pe.join(" "):pe.toString());if(gt.data.length!==0&&(Gt.push({key:"Length",value:gt.data.length}),_e===!0&&Gt.push({key:"Length1",value:Me})),tn.length!=0)if(tn.split("/").length-1==1)Gt.push({key:"Filter",value:tn});else{Gt.push({key:"Filter",value:"["+tn+"]"});for(var Tn=0;Tn<Gt.length;Tn+=1)if(Gt[Tn].key==="DecodeParms"){for(var ii=[],$n=0;$n<gt.reverseChain.split("/").length-1;$n+=1)ii.push("null");ii.push(Gt[Tn].value),Gt[Tn].value="["+ii.join(" ")+"]"}}re("<<");for(var Vn=0;Vn<Gt.length;Vn++)re("/"+Gt[Vn].key+" "+Gt[Vn].value);re(">>"),gt.data.length!==0&&(re("stream"),re(ut(gt.data)),re("endstream"))},Xi=h.__private__.putPage=function(C){var W=C.number,ie=C.data,pe=C.objId,_e=C.contentsObjId;Ni(pe,!0),re("<</Type /Page"),re("/Parent "+C.rootDictionaryObjId+" 0 R"),re("/Resources "+C.resourceDictionaryObjId+" 0 R"),re("/MediaBox ["+parseFloat(L(C.mediaBox.bottomLeftX))+" "+parseFloat(L(C.mediaBox.bottomLeftY))+" "+L(C.mediaBox.topRightX)+" "+L(C.mediaBox.topRightY)+"]"),C.cropBox!==null&&re("/CropBox ["+L(C.cropBox.bottomLeftX)+" "+L(C.cropBox.bottomLeftY)+" "+L(C.cropBox.topRightX)+" "+L(C.cropBox.topRightY)+"]"),C.bleedBox!==null&&re("/BleedBox ["+L(C.bleedBox.bottomLeftX)+" "+L(C.bleedBox.bottomLeftY)+" "+L(C.bleedBox.topRightX)+" "+L(C.bleedBox.topRightY)+"]"),C.trimBox!==null&&re("/TrimBox ["+L(C.trimBox.bottomLeftX)+" "+L(C.trimBox.bottomLeftY)+" "+L(C.trimBox.topRightX)+" "+L(C.trimBox.topRightY)+"]"),C.artBox!==null&&re("/ArtBox ["+L(C.artBox.bottomLeftX)+" "+L(C.artBox.bottomLeftY)+" "+L(C.artBox.topRightX)+" "+L(C.artBox.topRightY)+"]"),typeof C.userUnit=="number"&&C.userUnit!==1&&re("/UserUnit "+C.userUnit),Mn.publish("putPage",{objId:pe,pageContext:Tt[W],pageNumber:W,page:ie}),re("/Contents "+_e+" 0 R"),re(">>"),re("endobj");var Me=ie.join(` 616`);return x===b&&(Me+=` 617Q`),Ni(_e,!0),Ia({data:Me,filters:Ra(),objectId:_e}),re("endobj"),pe},La=h.__private__.putPages=function(){var C,W,ie=[];for(C=1;C<=rn;C++)Tt[C].objId=wi(),Tt[C].contentsObjId=wi();for(C=1;C<=rn;C++)ie.push(Xi({number:C,data:De[C],objId:Tt[C].objId,contentsObjId:Tt[C].contentsObjId,mediaBox:Tt[C].mediaBox,cropBox:Tt[C].cropBox,bleedBox:Tt[C].bleedBox,trimBox:Tt[C].trimBox,artBox:Tt[C].artBox,userUnit:Tt[C].userUnit,rootDictionaryObjId:ll,resourceDictionaryObjId:Ma}));Ni(ll,!0),re("<</Type /Pages");var pe="/Kids [";for(W=0;W<rn;W++)pe+=ie[W]+" 0 R ";re(pe+"]"),re("/Count "+rn),re(">>"),re("endobj"),Mn.publish("postPutPages")},cl=function(C){Mn.publish("putFont",{font:C,out:re,newObject:Cr,putStream:I
vendor: 26,352 bytes, lines 617-634
617a}),C.isAlreadyPutted!==!0&&(C.objectNumber=Cr(),re("<<"),re("/Type /Font"),re("/BaseFont /"+yg(C.postScriptName)),re("/Subtype /Type1"),typeof C.encoding=="string"&&re("/Encoding /"+C.encoding),re("/FirstChar 32"),re("/LastChar 255"),re(">>"),re("endobj"))},to=function(C){C.objectNumber=Cr();var W=[];W.push({key:"Type",value:"/XObject"}),W.push({key:"Subtype",value:"/Form"}),W.push({key:"BBox",value:"["+[L(C.x),L(C.y),L(C.x+C.width),L(C.y+C.height)].join(" ")+"]"}),W.push({key:"Matrix",value:"["+C.matrix.toString()+"]"});var ie=C.pages[1].join(` 618`);Ia({data:ie,additionalKeyValues:W,objectId:C.objectNumber}),re("endobj")},Rs=function(C,W){W||(W=21);var ie=Cr(),pe=function(Be,ut){var gt,Gt=[],tn=1/(ut-1);for(gt=0;gt<1;gt+=tn)Gt.push(gt);if(Gt.push(1),Be[0].offset!=0){var Tn={offset:0,color:Be[0].color};Be.unshift(Tn)}if(Be[Be.length-1].offset!=1){var ii={offset:1,color:Be[Be.length-1].color};Be.push(ii)}for(var $n="",Vn=0,hr=0;hr<Gt.length;hr++){for(gt=Gt[hr];gt>Be[Vn+1].offset;)Vn++;var Er=Be[Vn].offset,Ar=(gt-Er)/(Be[Vn+1].offset-Er),Zi=Be[Vn].color,ml=Be[Vn+1].color;$n+=de(Math.round((1-Ar)*Zi[0]+Ar*ml[0]).toString(16))+de(Math.round((1-Ar)*Zi[1]+Ar*ml[1]).toString(16))+de(Math.round((1-Ar)*Zi[2]+Ar*ml[2]).toString(16))}return $n.trim()}(C.colors,W),_e=[];_e.push({key:"FunctionType",value:"0"}),_e.push({key:"Domain",value:"[0.0 1.0]"}),_e.push({key:"Size",value:"["+W+"]"}),_e.push({key:"BitsPerSample",value:"8"}),_e.push({key:"Range",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),_e.push({key:"Decode",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),Ia({data:pe,additionalKeyValues:_e,alreadyAppliedFilters:["/ASCIIHexDecode"],objectId:ie}),re("endobj"),C.objectNumber=Cr(),re("<< /ShadingType "+C.type),re("/ColorSpace /DeviceRGB");var Me="/Coords ["+L(parseFloat(C.coords[0]))+" "+L(parseFloat(C.coords[1]))+" ";C.type===2?Me+=L(parseFloat(C.coords[2]))+" "+L(parseFloat(C.coords[3])):Me+=L(parseFloat(C.coords[2]))+" "+L(parseFloat(C.coords[3]))+" "+L(parseFloat(C.coords[4]))+" "+L(parseFloat(C.coords[5])),re(Me+="]"),C.matrix&&re("/Matrix ["+C.matrix.toString()+"]"),re("/Function "+ie+" 0 R"),re("/Extend [true true]"),re(">>"),re("endobj")},hu=function(C,W){var ie=wi(),pe=Cr();W.push({resourcesOid:ie,objectOid:pe}),C.objectNumber=pe;var _e=[];_e.push({key:"Type",value:"/Pattern"}),_e.push({key:"PatternType",value:"1"}),_e.push({key:"PaintType",value:"1"}),_e.push({key:"TilingType",value:"1"}),_e.push({key:"BBox",value:"["+C.boundingBox.map(L).join(" ")+"]"}),_e.push({key:"XStep",value:L(C.xStep)}),_e.push({key:"YStep",value:L(C.yStep)}),_e.push({key:"Resources",value:ie+" 0 R"}),C.matrix&&_e.push({key:"Matrix",value:"["+C.matrix.toString()+"]"}),Ia({data:C.stream,additionalKeyValues:_e,objectId:C.objectNumber}),re("endobj")},R0=function(C){for(var W in C.objectNumber=Cr(),re("<<"),C)switch(W){case"opacity":re("/ca "+R(C[W]));break;case"stroke-opacity":re("/CA "+R(C[W]))}re(">>"),re("endobj")},gf=function(C){Ni(C.resourcesOid,!0),re("<<"),re("/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]"),function(){for(var W in re("/Font <<"),zt)zt.hasOwnProperty(W)&&(d===!1||d===!0&&f.hasOwnProperty(W))&&re("/"+W+" "+zt[W].objectNumber+" 0 R");re(">>")}(),function(){if(Object.keys(Nt).length>0){for(var W in re("/Shading <<"),Nt)Nt.hasOwnProperty(W)&&Nt[W]instanceof np&&Nt[W].objectNumber>=0&&re("/"+W+" "+Nt[W].objectNumber+" 0 R");Mn.publish("putShadingPatternDict"),re(">>")}}(),function(W){if(Object.keys(Nt).length>0){for(var ie in re("/Pattern <<"),Nt)Nt.hasOwnProperty(ie)&&Nt[ie]instanceof h.TilingPattern&&Nt[ie].objectNumber>=0&&Nt[ie].objectNumber<W&&re("/"+ie+" "+Nt[ie].objectNumber+" 0 R");Mn.publish("putTilingPatternDict"),re(">>")}}(C.objectOid),function(){if(Object.keys(It).length>0){var W;for(W in re("/ExtGState <<"),It)It.hasOwnProperty(W)&&It[W].objectNumber>=0&&re("/"+W+" "+It[W].objectNumber+" 0 R");Mn.publish("putGStateDict"),re(">>")}}(),function(){for(var W in re("/XObject <<"),Wt)Wt.hasOwnProperty(W)&&Wt[W].objectNumber>=0&&re("/"+W+" "+Wt[W].objectNumber+" 0 R");Mn.publish("putXobjectDict"),re(">>")}(),re(">>"),re("endobj")},vf=function(C){Qt[C.fontName]=Qt[C.fontName]||{},Qt[C.fontName][C.fontStyle]=C.id},No=function(C,W,ie,pe,_e){var Me={id:"F"+(Object.keys(zt).length+1).toString(10),postScriptName:C,fontName:W,fontStyle:ie,encoding:pe,isStandardFont:_e||!1,metadata:{}};return Mn.publish("addFont",{font:Me,instance:this}),zt[Me.id]=Me,vf(Me),Me.id},Is=h.__private__.pdfEscape=h.pdfEscape=function(C,W){return function(ie,pe){var _e,Me,Be,ut,gt,Gt,tn,Tn,ii;if(Be=(pe=pe||{}).sourceEncoding||"Unicode",gt=pe.outputEncoding,(pe.autoencode||gt)&&zt[nt].metadata&&zt[nt].metadata[Be]&&zt[nt].metadata[Be].encoding&&(ut=zt[nt].metadata[Be].encoding,!gt&&zt[nt].encoding&&(gt=zt[nt].encoding),!gt&&ut.codePages&&(gt=ut.codePages[0]),typeof gt=="string"&&(gt=ut[gt]),gt)){for(tn=!1,Gt=[],_e=0,Me=ie.length;_e<Me;_e++)(Tn=gt[ie.charCodeAt(_e)])?Gt.push(String.fromCharCode(Tn)):Gt.push(ie[_e]),Gt[_e].charCodeAt(0)>>8&&(tn=!0);ie=Gt.join("")}for(_e=ie.length;tn===void 0&&_e!==0;)ie.charCodeAt(_e-1)>>8&&(tn=!0),_e--;if(!tn)return ie;for(Gt=pe.noBOM?[]:[254,255],_e=0,Me=ie.length;_e<Me;_e++){if((ii=(Tn=ie.charCodeAt(_e))>>8)>>8)throw new Error("Character at position "+_e+" of string '"+ie+"' exceeds 16bits. Cannot be encoded into UCS-2 BE");Gt.push(ii),Gt.push(Tn-(ii<<8))}return String.fromCharCode.apply(void 0,Gt)}(C,W).replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},Qi=h.__private__.beginPage=function(C){De[++rn]=[],Tt[rn]={objId:0,contentsObjId:0,userUnit:Number(o),artBox:null,bleedBox:null,cropBox:null,trimBox:null,mediaBox:{bottomLeftX:0,bottomLeftY:0,topRightX:Number(C[0]),topRightY:Number(C[1])}},lm(rn),Je(De[J])},Ls=function(C,W){var ie,pe,_e;switch(n=W||n,typeof C=="string"&&(ie=v(C.toLowerCase()),Array.isArray(ie)&&(pe=ie[0],_e=ie[1])),Array.isArray(C)&&(pe=C[0]*Ut,_e=C[1]*Ut),isNaN(pe)&&(pe=i[0],_e=i[1]),(pe>14400||_e>14400)&&(pr.warn("A page in a PDF can not be wider or taller than 14400 userUnit. jsPDF limits the width/height to 14400"),pe=Math.min(14400,pe),_e=Math.min(14400,_e)),i=[pe,_e],n.substr(0,1)){case"l":_e>pe&&(i=[_e,pe]);break;case"p":pe>_e&&(i=[_e,pe])}Qi(i),Ed(Pt),re(Ad),yc!==0&&re(yc+" J"),_c!==0&&re(_c+" j"),Mn.publish("addPage",{pageNumber:rn})},fu=function(C){C>0&&C<=rn&&(De.splice(C,1),Tt.splice(C,1),rn--,J>rn&&(J=rn),this.setPage(J))},lm=function(C){C>0&&C<=rn&&(J=C)},cm=h.__private__.getNumberOfPages=h.getNumberOfPages=function(){return De.length-1},um=function(C,W,ie){var pe,_e=void 0;return ie=ie||{},C=C!==void 0?C:zt[nt].fontName,W=W!==void 0?W:zt[nt].fontStyle,pe=C.toLowerCase(),Qt[pe]!==void 0&&Qt[pe][W]!==void 0?_e=Qt[pe][W]:Qt[C]!==void 0&&Qt[C][W]!==void 0?_e=Qt[C][W]:ie.disableWarning===!1&&pr.warn("Unable to look up font label for font '"+C+"', '"+W+"'. Refer to getFontList() for available fonts."),_e||ie.noFallback||(_e=Qt.times[W])==null&&(_e=Qt.times.normal),_e},Ro=h.__private__.putInfo=function(){var C=Cr(),W=function(pe){return pe};for(var ie in u!==null&&(W=Bi.encryptor(C,0)),re("<<"),re("/Producer ("+Is(W("jsPDF "+Rt.version))+")"),ln)ln.hasOwnProperty(ie)&&ln[ie]&&re("/"+ie.substr(0,1).toUpperCase()+ie.substr(1)+" ("+Is(W(ln[ie]))+")");re("/CreationDate ("+Is(W(te))+")"),re(">>"),re("endobj")},Td=h.__private__.putCatalog=function(C){var W=(C=C||{}).rootDictionaryObjId||ll;switch(Cr(),re("<<"),re("/Type /Catalog"),re("/Pages "+W+" 0 R"),St||(St="fullwidth"),St){case"fullwidth":re("/OpenAction [3 0 R /FitH null]");break;case"fullheight":re("/OpenAction [3 0 R /FitV null]");break;case"fullpage":re("/OpenAction [3 0 R /Fit]");break;case"original":re("/OpenAction [3 0 R /XYZ null null 1]");break;default:var ie=""+St;ie.substr(ie.length-1)==="%"&&(St=parseInt(St)/100),typeof St=="number"&&re("/OpenAction [3 0 R /XYZ null null "+R(St)+"]")}switch(Kt||(Kt="continuous"),Kt){case"continuous":re("/PageLayout /OneColumn");break;case"single":re("/PageLayout /SinglePage");break;case"two":case"twoleft":re("/PageLayout /TwoColumnLeft");break;case"tworight":re("/PageLayout /TwoColumnRight")}mt&&re("/PageMode /"+mt),Mn.publish("putCatalog"),re(">>"),re("endobj")},I0=h.__private__.putTrailer=function(){re("trailer"),re("<<"),re("/Size "+(fe+1)),re("/Root "+fe+" 0 R"),re("/Info "+(fe-1)+" 0 R"),u!==null&&re("/Encrypt "+Bi.oid+" 0 R"),re("/ID [ <"+ne+"> <"+ne+"> ]"),re(">>")},er=h.__private__.putHeader=function(){re("%PDF-"+p),re("%ºÃˆ ")},Oa=h.__private__.putXRef=function(){var C="0000000000";re("xref"),re("0 "+(fe+1)),re("0000000000 65535 f ");for(var W=1;W<=fe;W++)typeof me[W]=="function"?re((C+me[W]()).slice(-10)+" 00000 n "):me[W]!==void 0?re((C+me[W]).slice(-10)+" 00000 n "):re("0000000000 00000 n ")},Io=h.__private__.buildDocument=function(){var C;fe=0,Ee=0,Ce=[],me=[],Ae=[],ll=wi(),Ma=wi(),Je(Ce),Mn.publish("buildDocument"),er(),La(),function(){Mn.publish("putAdditionalObjects");for(var ie=0;ie<Ae.length;ie++){var pe=Ae[ie];Ni(pe.objId,!0),re(pe.content),re("endobj")}Mn.publish("postPutAdditionalObjects")}(),C=[],function(){for(var ie in zt)zt.hasOwnProperty(ie)&&(d===!1||d===!0&&f.hasOwnProperty(ie))&&cl(zt[ie])}(),function(){var ie;for(ie in It)It.hasOwnProperty(ie)&&R0(It[ie])}(),function(){for(var ie in Wt)Wt.hasOwnProperty(ie)&&to(Wt[ie])}(),function(ie){var pe;for(pe in Nt)Nt.hasOwnProperty(pe)&&(Nt[pe]instanceof np?Rs(Nt[pe]):Nt[pe]instanceof Bg&&hu(Nt[pe],ie))}(C),Mn.publish("putResources"),C.forEach(gf),gf({resourcesOid:Ma,objectOid:Number.MAX_SAFE_INTEGER}),Mn.publish("postPutResources"),u!==null&&(Bi.oid=Cr(),re("<<"),re("/Filter /Standard"),re("/V "+Bi.v),re("/R "+Bi.r),re("/U <"+Bi.toHexString(Bi.U)+">"),re("/O <"+Bi.toHexString(Bi.O)+">"),re("/P "+Bi.P),re(">>"),re("endobj")),Ro(),Td();var W=Ee;return Oa(),I0(),re("startxref"),re(""+W),re("%%EOF"),Je(De[J]),Ce.join(` 619`)},pu=h.__private__.getBlob=function(C){return new Blob([Mt(C)],{type:"application/pdf"})},yf=function(C){for(;C.firstChild;)C.removeChild(C.firstChild)},ia=function(C){var W,ie=C.document,pe=ie.documentElement,_e=ie.head,Me=ie.body;return _e||(_e=ie.createElement("head"),pe.appendChild(_e)),Me||(Me=ie.createElement("body"),pe.appendChild(Me)),yf(_e),yf(Me),(W=ie.createElement("style")).appendChild(ie.createTextNode("html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;}")),_e.appendChild(W),{document:ie,body:Me}},Cd=h.output=h.__private__.output=(Fr=function(C,W){switch(typeof(W=W||{})=="string"?W={filename:W}:W.filename=W.filename||"generated.pdf",C){case void 0:return Io();case"save":h.save(W.filename);break;case"arraybuffer":return Mt(Io());case"blob":return pu(Io());case"bloburi":case"bloburl":if(Yt.URL!==void 0&&typeof Yt.URL.createObjectURL=="function")return Yt.URL&&Yt.URL.createObjectURL(pu(Io()))||void 0;pr.warn("bloburl is not supported by your system, because URL.createObjectURL is not supported by your browser.");break;case"datauristring":case"dataurlstring":var ie="",pe=Io();try{ie=VU(pe)}catch{ie=VU(unescape(encodeURIComponent(pe)))}return"data:application/pdf;filename="+encodeURIComponent(W.filename)+";base64,"+ie;case"pdfobjectnewwindow":if(Object.prototype.toString.call(Yt)==="[object Window]"){var _e="https://cdnjs.cloudflare.com/ajax/libs/pdfobject/2.1.1/pdfobject.min.js",Me=!W.pdfObjectUrl;Me||(_e=W.pdfObjectUrl);var Be=Yt.open();if(Be!==null){var ut=ia(Be),gt=ut.document.createElement("script"),Gt=this;gt.src=_e,Me&&(gt.integrity="sha512-4ze/a9/4jqu+tX9dfOqJYSvyYd5M6qum/3HpCLr+/Jqf0whc37VUbkpNGHR7/8pSnCFw47T1fmIpwBV7UySh3g==",gt.crossOrigin="anonymous"),gt.onload=function(){Be.PDFObject.embed(Gt.output("dataurlstring"),W)},ut.body.appendChild(gt)}return Be}throw new Error("The option pdfobjectnewwindow just works in a browser-environment.");case"pdfjsnewwindow":if(Object.prototype.toString.call(Yt)==="[object Window]"){var tn=W.pdfJsUrl||"examples/PDF.js/web/viewer.html",Tn=Yt.open();if(Tn!==null){var ii=ia(Tn),$n=ii.document.createElement("iframe"),Vn=tn.indexOf("?")===-1?"?":"&";Gt=this,$n.id="pdfViewer",$n.width="500px",$n.height="400px",$n.src=tn+Vn+"file=&downloadName="+encodeURIComponent(W.filename),$n.onload=function(){Tn.document.title=W.filename,$n.contentWindow.PDFViewerApplication.open(Gt.output("bloburl"))},ii.body.appendChild($n)}return Tn}throw new Error("The option pdfjsnewwindow just works in a browser-environment.");case"dataurlnewwindow":if(Object.prototype.toString.call(Yt)!=="[object Window]")throw new Error("The option dataurlnewwindow just works in a browser-environment.");var hr=Yt.open();if(hr!==null){var Er=ia(hr),Ar=Er.document.createElement("iframe");Ar.src=this.output("datauristring",W),Er.body.appendChild(Ar),hr.document.title=W.filename}if(hr||typeof safari>"u")return hr;break;case"datauri":case"dataurl":return Yt.document.location.href=this.output("datauristring",W);default:return null}},Fr.foo=function(){try{return Fr.apply(this,arguments)}catch(ie){var C=ie.stack||"";~C.indexOf(" at ")&&(C=C.split(" at ")[1]);var W="Error in function "+C.split(` 620`)[0].split("<")[0]+": "+ie.message;if(!Yt.console)throw new Error(W);Yt.console.error(W,ie),Yt.alert&&alert(W)}},Fr.foo.bar=Fr,Fr.foo),ul=function(C){return Array.isArray(Dt)===!0&&Dt.indexOf(C)>-1};switch(r){case"pt":Ut=1;break;case"mm":Ut=72/25.4;break;case"cm":Ut=72/2.54;break;case"in":Ut=72;break;case"px":Ut=ul("px_scaling")==1?.75:96/72;break;case"pc":case"em":Ut=12;break;case"ex":Ut=6;break;default:if(typeof r!="number")throw new Error("Invalid unit: "+r);Ut=r}var Bi=null;he(),V();var dm=h.__private__.getPageInfo=h.getPageInfo=function(C){if(isNaN(C)||C%1!=0)throw new Error("Invalid argument passed to jsPDF.getPageInfo");return{objId:Tt[C].objId,pageNumber:C,pageContext:Tt[C]}},L0=h.__private__.getPageInfoByObjId=function(C){if(isNaN(C)||C%1!=0)throw new Error("Invalid argument passed to jsPDF.getPageInfoByObjId");for(var W in Tt)if(Tt[W].objId===C)break;return dm(W)},O0=h.__private__.getCurrentPageInfo=h.getCurrentPageInfo=function(){return{objId:Tt[J].objId,pageNumber:J,pageContext:Tt[J]}};h.addPage=function(){return Ls.apply(this,arguments),this},h.setPage=function(){return lm.apply(this,arguments),Je.call(this,De[J]),this},h.insertPage=function(C){return this.addPage(),this.movePage(J,C),this},h.movePage=function(C,W){var ie,pe;if(C>W){ie=De[C],pe=Tt[C];for(var _e=C;_e>W;_e--)De[_e]=De[_e-1],Tt[_e]=Tt[_e-1];De[W]=ie,Tt[W]=pe,this.setPage(W)}else if(C<W){ie=De[C],pe=Tt[C];for(var Me=C;Me<W;Me++)De[Me]=De[Me+1],Tt[Me]=Tt[Me+1];De[W]=ie,Tt[W]=pe,this.setPage(W)}return this},h.deletePage=function(){return fu.apply(this,arguments),this},h.__private__.text=h.text=function(C,W,ie,pe,_e){var Me,Be,ut,gt,Gt,tn,Tn,ii,$n,Vn=(pe=pe||{}).scope||this;if(typeof C=="number"&&typeof W=="number"&&(typeof ie=="string"||Array.isArray(ie))){var hr=ie;ie=W,W=C,C=hr}if(arguments[3]instanceof ct==0?(ut=arguments[4],gt=arguments[5],sr(Tn=arguments[3])==="object"&&Tn!==null||(typeof ut=="string"&&(gt=ut,ut=null),typeof Tn=="string"&&(gt=Tn,Tn=null),typeof Tn=="number"&&(ut=Tn,Tn=null),pe={flags:Tn,angle:ut,align:gt})):(M("The transform parameter of text() with a Matrix value"),$n=_e),isNaN(W)||isNaN(ie)||C==null)throw new Error("Invalid arguments passed to jsPDF.text");if(C.length===0)return Vn;var Er,Ar="",Zi=typeof pe.lineHeightFactor=="number"?pe.lineHeightFactor:Os,ml=Vn.internal.scaleFactor;function Tf(tr){return tr=tr.split(" ").join(Array(pe.TabLen||9).join(" ")),Is(tr,Tn)}function _u(tr){for(var nr,Hr=tr.concat(),oi=[],yl=Hr.length;yl--;)typeof(nr=Hr.shift())=="string"?oi.push(nr):Array.isArray(tr)&&(nr.length===1||nr[1]===void 0&&nr[2]===void 0)?oi.push(nr[0]):oi.push([nr[0],nr[1],nr[2]]);return oi}function wu(tr,nr){var Hr;if(typeof tr=="string")Hr=nr(tr)[0];else if(Array.isArray(tr)){for(var oi,yl,Pf=tr.concat(),Fd=[],Sm=Pf.length;Sm--;)typeof(oi=Pf.shift())=="string"?Fd.push(nr(oi)[0]):Array.isArray(oi)&&typeof oi[0]=="string"&&(yl=nr(oi[0],oi[1],oi[2]),Fd.push([yl[0],yl[1],yl[2]]));Hr=Fd}return Hr}var wc=!1,es=!0;if(typeof C=="string")wc=!0;else if(Array.isArray(C)){var bc=C.concat();Be=[];for(var Oo,Dn=bc.length;Dn--;)(typeof(Oo=bc.shift())!="string"||Array.isArray(Oo)&&typeof Oo[0]!="string")&&(es=!1);wc=es}if(wc===!1)throw new Error('Type of text must be string or Array. "'+C+'" is not recognized.');typeof C=="string"&&(C=C.match(/[\r?\n]/)?C.split(/\r\n|\r|\n/g):[C]);var bu=Ue/Vn.internal.scaleFactor,fs=bu*(Zi-1);switch(pe.baseline){case"bottom":ie-=fs;break;case"top":ie+=bu-fs;break;case"hanging":ie+=bu-2*fs;break;case"middle":ie+=bu/2-fs}if((tn=pe.maxWidth||0)>0&&(typeof C=="string"?C=Vn.splitTextToSize(C,tn):Object.prototype.toString.call(C)==="[object Array]"&&(C=C.reduce(function(tr,nr){return tr.concat(Vn.splitTextToSize(nr,tn))},[]))),Me={text:C,x:W,y:ie,options:pe,mutex:{pdfEscape:Is,activeFontKey:nt,fonts:zt,activeFontSize:Ue}},Mn.publish("preProcessText",Me),C=Me.text,ut=(pe=Me.options).angle,$n instanceof ct==0&&ut&&typeof ut=="number"){ut*=Math.PI/180,pe.rotationDirection===0&&(ut=-ut),x===b&&(ut=-ut);var xc=Math.cos(ut),ps=Math.sin(ut);$n=new ct(xc,ps,-ps,xc,0,0)}else ut&&ut instanceof ct&&($n=ut);x!==b||$n||($n=Mi),(Gt=pe.charSpace||Pd)!==void 0&&(Ar+=L($(Gt))+` Tc 621`,this.setCharSpace(this.getCharSpace()||0)),(ii=pe.horizontalScale)!==void 0&&(Ar+=L(100*ii)+` Tz 622`),pe.lang;var st=-1,km=pe.renderingMode!==void 0?pe.renderingMode:pe.stroke,gl=Vn.internal.getCurrentPageInfo().pageContext;switch(km){case 0:case!1:case"fill":st=0;break;case 1:case!0:case"stroke":st=1;break;case 2:case"fillThenStroke":st=2;break;case 3:case"invisible":st=3;break;case 4:case"fillAndAddForClipping":st=4;break;case 5:case"strokeAndAddPathForClipping":st=5;break;case 6:case"fillThenStrokeAndAddToPathForClipping":st=6;break;case 7:case"addToPathForClipping":st=7}var Cf=gl.usedRenderingMode!==void 0?gl.usedRenderingMode:-1;st!==-1?Ar+=st+` Tr 623`:Cf!==-1&&(Ar+=`0 Tr 624`),st!==-1&&(gl.usedRenderingMode=st),gt=pe.align||"left";var si,xu=Ue*Zi,Nd=Vn.internal.pageSize.getWidth(),Rd=zt[nt];Gt=pe.charSpace||Pd,tn=pe.maxWidth||0,Tn=Object.assign({autoencode:!0,noBOM:!0},pe.flags);var ku=[],Id=function(tr){return Vn.getStringUnitWidth(tr,{font:Rd,charSpace:Gt,fontSize:Ue,doKerning:!1})*Ue/ml};if(Object.prototype.toString.call(C)==="[object Array]"){var ms;Be=_u(C),gt!=="left"&&(si=Be.map(Id));var Ds,Ld=0;if(gt==="right"){W-=si[0],C=[],Dn=Be.length;for(var kc=0;kc<Dn;kc++)kc===0?(Ds=hl(W),ms=ro(ie)):(Ds=$(Ld-si[kc]),ms=-xu),C.push([Be[kc],Ds,ms]),Ld=si[kc]}else if(gt==="center"){W-=si[0]/2,C=[],Dn=Be.length;for(var Sc=0;Sc<Dn;Sc++)Sc===0?(Ds=hl(W),ms=ro(ie)):(Ds=$((Ld-si[Sc])/2),ms=-xu),C.push([Be[Sc],Ds,ms]),Ld=si[Sc]}else if(gt==="left"){C=[],Dn=Be.length;for(var Od=0;Od<Dn;Od++)C.push(Be[Od])}else if(gt==="justify"&&Rd.encoding==="Identity-H"){C=[],Dn=Be.length,tn=tn!==0?tn:Nd;for(var Su=0,ai=0;ai<Dn;ai++)if(ms=ai===0?ro(ie):-xu,Ds=ai===0?hl(W):Su,ai<Dn-1){var V0=$((tn-si[ai])/(Be[ai].split(" ").length-1)),Do=Be[ai].split(" ");C.push([Do[0]+" ",Ds,ms]),Su=0;for(var io=1;io<Do.length;io++){var Tu=(Id(Do[io-1]+" "+Do[io])-Id(Do[io]))*ml+V0;io==Do.length-1?C.push([Do[io],Tu,0]):C.push([Do[io]+" ",Tu,0]),Su-=Tu}}else C.push([Be[ai],Ds,ms]);C.push(["",Su,0])}else{if(gt!=="justify")throw new Error('Unrecognized alignment option, use "left", "center", "right" or "justify".');for(C=[],Dn=Be.length,tn=tn!==0?tn:Nd,ai=0;ai<Dn;ai++){ms=ai===0?ro(ie):-xu,Ds=ai===0?hl(W):0;var Ef=Be[ai].split(" ").length-1,Af=Ef>0?(tn-si[ai])/Ef:0;ai<Dn-1?ku.push(L($(Af))):ku.push(0),C.push([Be[ai],Ds,ms])}}}(typeof pe.R2L=="boolean"?pe.R2L:Et)===!0&&(C=wu(C,function(tr,nr,Hr){return[tr.split("").reverse().join(""),nr,Hr]})),Me={text:C,x:W,y:ie,options:pe,mutex:{pdfEscape:Is,activeFontKey:nt,fonts:zt,activeFontSize:Ue}},Mn.publish("postProcessText",Me),C=Me.text,Er=Me.mutex.isHex||!1;var Dd=zt[nt].encoding;Dd!=="WinAnsiEncoding"&&Dd!=="StandardEncoding"||(C=wu(C,function(tr,nr,Hr){return[Tf(tr),nr,Hr]})),Be=_u(C),C=[];for(var Cu,Eu,Fo,so=Array.isArray(Be[0])?1:0,vl="",Au=function(tr,nr,Hr){var oi="";return Hr instanceof ct?(Hr=typeof pe.angle=="number"?_i(Hr,new ct(1,0,0,1,tr,nr)):_i(new ct(1,0,0,1,tr,nr),Hr),x===b&&(Hr=_i(new ct(1,0,0,-1,0,0),Hr)),oi=Hr.join(" ")+` Tm 625`):oi=L(tr)+" "+L(nr)+` Td 626`,oi},Ui=0;Ui<Be.length;Ui++){switch(vl="",so){case 1:Fo=(Er?"<":"(")+Be[Ui][0]+(Er?">":")"),Cu=parseFloat(Be[Ui][1]),Eu=parseFloat(Be[Ui][2]);break;case 0:Fo=(Er?"<":"(")+Be[Ui]+(Er?">":")"),Cu=hl(W),Eu=ro(ie)}ku!==void 0&&ku[Ui]!==void 0&&(vl=ku[Ui]+` Tw 627`),Ui===0?C.push(vl+Au(Cu,Eu,$n)+Fo):so===0?C.push(vl+Fo):so===1&&C.push(vl+Au(Cu,Eu,$n)+Fo)}C=so===0?C.join(` Tj 628T* `):C.join(` Tj 629`),C+=` Tj 630`;var ao=`BT 631/`;return ao+=nt+" "+Ue+` Tf 632`,ao+=L(Ue*Zi)+` TL 633`,ao+=Lo+` 634`,ao+=Ar,ao+=C,re(ao+="ET"),f[nt]=!0,Vn};var D0=h.__private__.clip=h.clip=function(C){return re(C==="evenodd"?"W*":"W"),this};h.clipEvenOdd=function(){return D0("evenodd")},h.__private__.discardPath=h.discardPath=function(){return re("n"),this};var br=h.__private__.isValidStyle=function(C){var W=!1;return[void 0,null,"S","D","F","DF","FD","f","f*","B","B*","n"].indexOf(C)!==-1&&(W=!0),W};h.__private__.setDefaultPathOperation=h.setDefaultPathOperation=function(C){return br(C)&&(c=C),this};var hm=h.__private__.getStyle=h.getStyle=function(C){var W=c;switch(C){case"D":case"S":W="S";break;case"F":W="f";break;case"FD":case"DF":W="B";break;case"f":case"f*":case"B":case"B*":W=C}return W},gc=h.close=function(){return re("h"),this};h.stroke=function(){return re("S"),this},h.fill=function(C){return dl("f",C),this},h.fillEvenOdd=function(C){return dl("f*",C),this},h.fillStroke=function(C){return dl("B",C),this},h.fillStrokeEvenOdd=function(C){return dl("B*",C),this};var dl=function(C,W){sr(W)==="object"?F0(W,C):re(C)},_f=function(C){C===null||x===b&&C===void 0||(C=hm(C),re(C))};function wf(C,W,ie,pe,_e){var Me=new Bg(W||this.boundingBox,ie||this.xStep,pe||this.yStep,this.gState,_e||this.matrix);Me.stream=this.stream;var Be=C+"$$"+this.cloneIndex+++"$$";return dr(Be,Me),Me}var F0=function(C,W){var ie=Zn[C.key],pe=Nt[ie];if(pe instanceof np)re("q"),re(j0(W)),pe.gState&&h.setGState(pe.gState),re(C.matrix.toString()+" cm"),re("/"+ie+" sh"),re("Q");else if(pe instanceof Bg){var _e=new ct(1,0,0,-1,0,yu());C.matrix&&(_e=_e.multiply(C.matrix||Mi),ie=wf.call(pe,C.key,C.boundingBox,C.xStep,C.yStep,_e).id),re("q"),re("/Pattern cs"),re("/"+ie+" scn"),pe.gState&&h.setGState(pe.gState),re(W),re("Q")}},j0=function(C){switch(C){case"f":case"F":case"n":return"W n";case"f*":return"W* n";case"B":case"S":return"W S";case"B*":return"W* S"}},vc=h.moveTo=function(C,W){return re(L($(C))+" "+L(U(W))+" m"),this},fm=h.lineTo=function(C,W){return re(L($(C))+" "+L(U(W))+" l"),this},no=h.curveTo=function(C,W,ie,pe,_e,Me){return re([L($(C)),L(U(W)),L($(ie)),L(U(pe)),L($(_e)),L(U(Me)),"c"].join(" ")),this};h.__private__.line=h.line=function(C,W,ie,pe,_e){if(isNaN(C)||isNaN(W)||isNaN(ie)||isNaN(pe)||!br(_e))throw new Error("Invalid arguments passed to jsPDF.line");return x===_?this.lines([[ie-C,pe-W]],C,W,[1,1],_e||"S"):this.lines([[ie-C,pe-W]],C,W,[1,1]).stroke()},h.__private__.lines=h.lines=function(C,W,ie,pe,_e,Me){var Be,ut,gt,Gt,tn,Tn,ii,$n,Vn,hr,Er,Ar;if(typeof C=="number"&&(Ar=ie,ie=W,W=C,C=Ar),pe=pe||[1,1],Me=Me||!1,isNaN(W)||isNaN(ie)||!Array.isArray(C)||!Array.isArray(pe)||!br(_e)||typeof Me!="boolean")throw new Error("Invalid arguments passed to jsPDF.lines");for(vc(W,ie),Be=pe[0],ut=pe[1],Gt=C.length,hr=W,Er=ie,gt=0;gt<Gt;gt++)(tn=C[gt]).length===2?(hr=tn[0]*Be+hr,Er=tn[1]*ut+Er,fm(hr,Er)):(Tn=tn[0]*Be+hr,ii=tn[1]*ut+Er,$n=tn[2]*Be+hr,Vn=tn[3]*ut+Er,hr=tn[4]*Be+hr,Er=tn[5]*ut+Er,no(Tn,ii,$n,Vn,hr,Er));return Me&&gc(),_f(_e),this},h.path=function(C){for(var W=0;W<C.length;W++){var ie=C[W],pe=ie.c;switch(ie.op){case"m":vc(pe[0],pe[1]);break;case"l":fm(pe[0],pe[1]);break;case"c":no.apply(this,pe);break;case"h":gc()}}return this},h.__private__.rect=h.rect=function(C,W,ie,pe,_e){if(isNaN(C)||isNaN(W)||isNaN(ie)||isNaN(pe)||!br(_e))throw new Error("Invalid arguments passed to jsPDF.rect");return x===_&&(pe=-pe),re([L($(C)),L(U(W)),L($(ie)),L($(pe)),"re"].join(" ")),_f(_e),this},h.__private__.triangle=h.triangle=function(C,W,ie,pe,_e,Me,Be){if(isNaN(C)||isNaN(W)||isNaN(ie)||isNaN(pe)||isNaN(_e)||isNaN(Me)||!br(Be))throw new Error("Invalid arguments passed to jsPDF.triangle");return this.lines([[ie-C,pe-W],[_e-ie,Me-pe],[C-_e,W-Me]],C,W,[1,1],Be,!0),this},h.__private__.roundedRect=h.roundedRect=function(C,W,ie,pe,_e,Me,Be){if(isNaN(C)||isNaN(W)||isNaN(ie)||isNaN(pe)||isNaN(_e)||isNaN(Me)||!br(Be))throw new Error("Invalid arguments passed to jsPDF.roundedRect");var ut=4/3*(Math.SQRT2-1);return _e=Math.min(_e,.5*ie),Me=Math.min(Me,.5*pe),this.lines([[ie-2*_e,0],[_e*ut,0,_e,Me-Me*ut,_e,Me],[0,pe-2*Me],[0,Me*ut,-_e*ut,Me,-_e,Me],[2*_e-ie,0],[-_e*ut,0,-_e,-Me*ut,-_e,-Me],[0,2*Me-pe],[0,-Me*ut,_e*ut,-Me,_e,-Me]],C+_e,W,[1,1],Be,!0),this},h.__private__.ellipse=h.ellipse=function(C,W,ie,pe,_e){if(isNaN(C)||isNaN(W)||isNaN(ie)||isNaN(pe)||!br(_e))throw new Error("Invalid arguments passed to jsPDF.ellipse");var Me=4/3*(Math.SQRT2-1)*ie,Be=4/3*(Math.SQRT2-1)*pe;return vc(C+ie,W),no(C+ie,W-Be,C+Me,W-pe,C,W-pe),no(C-Me,W-pe,C-ie,W-Be,C-ie,W),no(C-ie,W+Be,C-Me,W+pe,C,W+pe),no(C+Me,W+pe,C+ie,W+Be,C+ie,W),_f(_e),this},h.__private__.circle=h.circle=function(C,W,ie,pe){if(isNaN(C)||isNaN(W)||isNaN(ie)||!br(pe))throw new Error("Invalid arguments passed to jsPDF.circle");return this.ellipse(C,W,ie,ie,pe)},h.setFont=function(C,W,ie){return ie&&(W=A(W,ie)),nt=um(C,W,{disableWarning:!1}),this};var B0=h.__private__.getFont=h.getFont=function(){return zt[um.apply(h,arguments)]};h.__private__.getFontList=h.getFontList=function(){var C,W,ie={};for(C in Qt)if(Qt.hasOwnProperty(C))for(W in ie[C]=[],Qt[C])Qt[C].hasOwnProperty(W)&&ie[C].push(W);return ie},h.addFont=function(C,W,ie,pe,_e){var Me=["StandardEncoding","MacRomanEncoding","Identity-H","WinAnsiEncoding"];return arguments[3]&&Me.indexOf(arguments[3])!==-1?_e=arguments[3]:arguments[3]&&Me.indexOf(arguments[3])==-1&&(ie=A(ie,pe)),No.call(this,C,W,ie,_e=_e||"Identity-H")};var Os,Pt=t.lineWidth||.200025,pm=h.__private__.getLineWidth=h.getLineWidth=function(){return Pt},Ed=h.__private__.setLineWidth=h.setLineWidth=function(C){return Pt=C,re(L($(C))+" w"),this};h.__private__.setLineDash=Rt.API.setLineDash=Rt.API.setLineDashPattern=function(C,W){if(C=C||[],W=W||0,isNaN(W)||!Array.isArray(C))throw new Error("Invalid arguments passed to
634jsPDF.setLineDash");return C=C.map(function(ie){return L($(ie))}).join(" "),W=L($(W)),re("["+C+"] "+W+" d"),this};var bf=h.__private__.getLineHeight=h.getLineHeight=function(){return Ue*Os};h.__private__.getLineHeight=h.getLineHeight=function(){return Ue*Os};var mm=h.__private__.setLineHeightFactor=h.setLineHeightFactor=function(C){return typeof(C=C||1.15)=="number"&&(Os=C),this},gm=h.__private__.getLineHeightFactor=h.getLineHeightFactor=function(){return Os};mm(t.lineHeight);var hl=h.__private__.getHorizontalCoordinate=function(C){return $(C)},ro=h.__private__.getVerticalCoordinate=function(C){return x===b?C:Tt[J].mediaBox.topRightY-Tt[J].mediaBox.bottomLeftY-$(C)},U0=h.__private__.getHorizontalCoordinateString=h.getHorizontalCoordinateString=function(C){return L(hl(C))},vm=h.__private__.getVerticalCoordinateString=h.getVerticalCoordinateString=function(C){return L(ro(C))},Ad=t.strokeColor||"0 G";h.__private__.getStrokeColor=h.getDrawColor=function(){return eo(Ad)},h.__private__.setStrokeColor=h.setDrawColor=function(C,W,ie,pe){return Ad=Na({ch1:C,ch2:W,ch3:ie,ch4:pe,pdfColorType:"draw",precision:2}),re(Ad),this};var mu=t.fillColor||"0 g";h.__private__.getFillColor=h.getFillColor=function(){return eo(mu)},h.__private__.setFillColor=h.setFillColor=function(C,W,ie,pe){return mu=Na({ch1:C,ch2:W,ch3:ie,ch4:pe,pdfColorType:"fill",precision:2}),re(mu),this};var Lo=t.textColor||"0 g",z0=h.__private__.getTextColor=h.getTextColor=function(){return eo(Lo)};h.__private__.setTextColor=h.setTextColor=function(C,W,ie,pe){return Lo=Na({ch1:C,ch2:W,ch3:ie,ch4:pe,pdfColorType:"text",precision:3}),this};var Pd=t.charSpace,$0=h.__private__.getCharSpace=h.getCharSpace=function(){return parseFloat(Pd||0)};h.__private__.setCharSpace=h.setCharSpace=function(C){if(isNaN(C))throw new Error("Invalid argument passed to jsPDF.setCharSpace");return Pd=C,this};var yc=0;h.CapJoinStyles={0:0,butt:0,but:0,miter:0,1:1,round:1,rounded:1,circle:1,2:2,projecting:2,project:2,square:2,bevel:2},h.__private__.setLineCap=h.setLineCap=function(C){var W=h.CapJoinStyles[C];if(W===void 0)throw new Error("Line cap style of '"+C+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return yc=W,re(W+" J"),this};var _c=0;h.__private__.setLineJoin=h.setLineJoin=function(C){var W=h.CapJoinStyles[C];if(W===void 0)throw new Error("Line join style of '"+C+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return _c=W,re(W+" j"),this},h.__private__.setLineMiterLimit=h.__private__.setMiterLimit=h.setLineMiterLimit=h.setMiterLimit=function(C){if(C=C||0,isNaN(C))throw new Error("Invalid argument passed to jsPDF.setLineMiterLimit");return re(L($(C))+" M"),this},h.GState=uS,h.setGState=function(C){(C=typeof C=="string"?It[qt[C]]:xf(null,C)).equals(lr)||(re("/"+C.id+" gs"),lr=C)};var xf=function(C,W){if(!C||!qt[C]){var ie=!1;for(var pe in It)if(It.hasOwnProperty(pe)&&It[pe].equals(W)){ie=!0;break}if(ie)W=It[pe];else{var _e="GS"+(Object.keys(It).length+1).toString(10);It[_e]=W,W.id=_e}return C&&(qt[C]=W.id),Mn.publish("addGState",W),W}};h.addGState=function(C,W){return xf(C,W),this},h.saveGraphicsState=function(){return re("q"),Pn.push({key:nt,size:Ue,color:Lo}),this},h.restoreGraphicsState=function(){re("Q");var C=Pn.pop();return nt=C.key,Ue=C.size,Lo=C.color,lr=null,this},h.setCurrentTransformationMatrix=function(C){return re(C.toString()+" cm"),this},h.comment=function(C){return re("#"+C),this};var gu=function(C,W){var ie=C||0;Object.defineProperty(this,"x",{enumerable:!0,get:function(){return ie},set:function(Me){isNaN(Me)||(ie=parseFloat(Me))}});var pe=W||0;Object.defineProperty(this,"y",{enumerable:!0,get:function(){return pe},set:function(Me){isNaN(Me)||(pe=parseFloat(Me))}});var _e="pt";return Object.defineProperty(this,"type",{enumerable:!0,get:function(){return _e},set:function(Me){_e=Me.toString()}}),this},kf=function(C,W,ie,pe){gu.call(this,C,W),this.type="rect";var _e=ie||0;Object.defineProperty(this,"w",{enumerable:!0,get:function(){return _e},set:function(Be){isNaN(Be)||(_e=parseFloat(Be))}});var Me=pe||0;return Object.defineProperty(this,"h",{enumerable:!0,get:function(){return Me},set:function(Be){isNaN(Be)||(Me=parseFloat(Be))}}),this},Md=function(){this.page=rn,this.currentPage=J,this.pages=De.slice(0),this.pagesContext=Tt.slice(0),this.x=ht,this.y=wr,this.matrix=pn,this.width=ym(J),this.height=pl(J),this.outputDestination=Re,this.id="",this.objectNumber=-1};Md.prototype.restore=function(){rn=this.page,J=this.currentPage,Tt=this.pagesContext,De=this.pages,ht=this.x,wr=this.y,pn=this.matrix,fl(J,this.width),_m(J,this.height),Re=this.outputDestination};var Sf=function(C,W,ie,pe,_e){Tr.push(new Md),rn=J=0,De=[],ht=C,wr=W,pn=_e,Qi([ie,pe])};for(var vu in h.beginFormObject=function(C,W,ie,pe,_e){return Sf(C,W,ie,pe,_e),this},h.endFormObject=function(C){return function(W){if(_n[W])Tr.pop().restore(
vendor: 11,358 bytes, lines 634-642
634);else{var ie=new Md,pe="Xo"+(Object.keys(Wt).length+1).toString(10);ie.id=pe,_n[W]=pe,Wt[pe]=ie,Mn.publish("addFormObject",ie),Tr.pop().restore()}}(C),this},h.doFormObject=function(C,W){var ie=Wt[_n[C]];return re("q"),re(W.toString()+" cm"),re("/"+ie.id+" Do"),re("Q"),this},h.getFormObject=function(C){var W=Wt[_n[C]];return{x:W.x,y:W.y,width:W.width,height:W.height,matrix:W.matrix}},h.save=function(C,W){return C=C||"generated.pdf",(W=W||{}).returnPromise=W.returnPromise||!1,W.returnPromise===!1?(Yf(pu(Io()),C),typeof Yf.unload=="function"&&Yt.setTimeout&&setTimeout(Yf.unload,911),this):new Promise(function(ie,pe){try{var _e=Yf(pu(Io()),C);typeof Yf.unload=="function"&&Yt.setTimeout&&setTimeout(Yf.unload,911),ie(_e)}catch(Me){pe(Me.message)}})},Rt.API)Rt.API.hasOwnProperty(vu)&&(vu==="events"&&Rt.API.events.length?function(C,W){var ie,pe,_e;for(_e=W.length-1;_e!==-1;_e--)ie=W[_e][0],pe=W[_e][1],C.subscribe.apply(C,[ie].concat(typeof pe=="function"?[pe]:pe))}(Mn,Rt.API.events):h[vu]=Rt.API[vu]);function ym(C){return Tt[C].mediaBox.topRightX-Tt[C].mediaBox.bottomLeftX}function fl(C,W){Tt[C].mediaBox.topRightX=W+Tt[C].mediaBox.bottomLeftX}function pl(C){return Tt[C].mediaBox.topRightY-Tt[C].mediaBox.bottomLeftY}function _m(C,W){Tt[C].mediaBox.topRightY=W+Tt[C].mediaBox.bottomLeftY}var wm=h.getPageWidth=function(C){return ym(C=C||J)/Ut},bm=h.setPageWidth=function(C,W){fl(C,W*Ut)},yu=h.getPageHeight=function(C){return pl(C=C||J)/Ut},xm=h.setPageHeight=function(C,W){_m(C,W*Ut)};return h.internal={pdfEscape:Is,getStyle:hm,getFont:B0,getFontSize:ot,getCharSpace:$0,getTextColor:z0,getLineHeight:bf,getLineHeightFactor:gm,getLineWidth:pm,write:Ye,getHorizontalCoordinate:hl,getVerticalCoordinate:ro,getCoordinateString:U0,getVerticalCoordinateString:vm,collections:{},newObject:Cr,newAdditionalObject:mc,newObjectDeferred:wi,newObjectDeferredBegin:Ni,getFilters:Ra,putStream:Ia,events:Mn,scaleFactor:Ut,pageSize:{getWidth:function(){return wm(J)},setWidth:function(C){bm(J,C)},getHeight:function(){return yu(J)},setHeight:function(C){xm(J,C)}},encryptionOptions:u,encryption:Bi,getEncryptor:function(C){return u!==null?Bi.encryptor(C,0):function(W){return W}},output:Cd,getNumberOfPages:cm,get pages(){return De},out:re,f2:R,f3:j,getPageInfo:dm,getPageInfoByObjId:L0,getCurrentPageInfo:O0,getPDFVersion:m,Point:gu,Rectangle:kf,Matrix:ct,hasHotfix:ul},Object.defineProperty(h.internal.pageSize,"width",{get:function(){return wm(J)},set:function(C){bm(J,C)},enumerable:!0,configurable:!0}),Object.defineProperty(h.internal.pageSize,"height",{get:function(){return yu(J)},set:function(C){xm(J,C)},enumerable:!0,configurable:!0}),(function(C){for(var W=0,ie=xt.length;W<ie;W++){var pe=No.call(this,C[W][0],C[W][1],C[W][2],xt[W][3],!0);d===!1&&(f[pe]=!0);var _e=C[W][0].split("-");vf({id:pe,fontName:_e[0],fontStyle:_e[1]||""})}Mn.publish("addFonts",{fonts:zt,dictionary:Qt})}).call(h,xt),nt="F1",Ls(i,n),Mn.publish("initialized"),h}vg.prototype.lsbFirstWord=function(t){return String.fromCharCode(255&t,t>>8&255,t>>16&255,t>>24&255)},vg.prototype.toHexString=function(t){return t.split("").map(function(e){return("0"+(255&e.charCodeAt(0)).toString(16)).slice(-2)}).join("")},vg.prototype.hexToBytes=function(t){for(var e=[],n=0;n<t.length;n+=2)e.push(String.fromCharCode(parseInt(t.substr(n,2),16)));return e.join("")},vg.prototype.processOwnerPassword=function(t,e){return AN(EN(e).substr(0,5),t)},vg.prototype.encryptor=function(t,e){var n=EN(this.encryptionKey+String.fromCharCode(255&t,t>>8&255,t>>16&255,255&e,e>>8&255)).substr(0,10);return function(r){return AN(n,r)}},uS.prototype.equals=function(t){var e,n="id,objectNumber,equals";if(!t||sr(t)!==sr(this))return!1;var r=0;for(e in this)if(!(n.indexOf(e)>=0)){if(this.hasOwnProperty(e)&&!t.hasOwnProperty(e)||this[e]!==t[e])return!1;r++}for(e in t)t.hasOwnProperty(e)&&n.indexOf(e)<0&&r--;return r===0},Rt.API={events:[]},Rt.version="4.2.1";var hi=Rt.API,yO=1,am=function(t){return t.replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},sg=function(t){return t.replace(/\\\\/g,"\\").replace(/\\\(/g,"(").replace(/\\\)/g,")")},Hp=function(t){return t.toString().replace(/#/g,"#23").replace(/[\s\n\r()<>[\]{}\/%]/g,function(e){var n=e.charCodeAt(0).toString(16).toUpperCase();return"#"+(n.length===1?"0"+n:n)})},an=function(t){return t.toFixed(2)},Qd=function(t){return t.toFixed(5)};hi.__acroform__={};var Za=function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t},HU=function(t){return t*yO},Nc=function(t){var e=new YZ,n=wt.internal.getHeight(t)||0,r=wt.internal.getWidth(t)||0;return e.BBox=[0,0,Number(an(r)),Number(an(n))],e},RDe=hi.__acroform__.setBit=function(t,e){if(t=t||0,e=e||0,isNaN(t)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.setBit");return t|1<<e},IDe=hi.__acroform__.clearBit=function(t,e){if(t=t||0,e=e||0,isNaN(t)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.clearBit");return t&~(1<<e)},LDe=hi.__acroform__.getBit=function(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.getBit");return t&1<<e?1:0},Ti=hi.__acroform__.getBitForPdf=function(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.getBitForPdf");return LDe(t,e-1)},Ci=hi.__acroform__.setBitForPdf=function(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.setBitForPdf");return RDe(t,e-1)},Ei=hi.__acroform__.clearBitForPdf=function(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.clearBitForPdf");return IDe(t,e-1)},ODe=hi.__acroform__.calculateCoordinates=function(t,e){var n=e.internal.getHorizontalCoordinate,r=e.internal.getVerticalCoordinate,i=t[0],s=t[1],a=t[2],o=t[3],l={};return l.lowerLeft_X=n(i)||0,l.lowerLeft_Y=r(s+o)||0,l.upperRight_X=n(i+a)||0,l.upperRight_Y=r(s)||0,[Number(an(l.lowerLeft_X)),Number(an(l.lowerLeft_Y)),Number(an(l.upperRight_X)),Number(an(l.upperRight_Y))]},DDe=function(t){if(t.appearanceStreamContent)return t.appearanceStreamContent;if(t.V||t.DV){var e=[],n=t._V||t.DV,r=PN(t,n),i=t.scope.internal.getFont(t.fontName,t.fontStyle).id;e.push("/Tx BMC"),e.push("q"),e.push("BT"),e.push(t.scope.__private__.encodeColorString(t.color)),e.push("/"+i+" "+an(r.fontSize)+" Tf"),e.push("1 0 0 1 0 0 Tm"),e.push(r.text),e.push("ET"),e.push("Q"),e.push("EMC");var s=Nc(t);return s.scope=t.scope,s.stream=e.join(` 635`),s}},PN=function(t,e){var n=t.fontSize===0?t.maxFontSize:t.fontSize,r={text:"",fontSize:""},i=(e=(e=e.substr(0,1)=="("?e.substr(1):e).substr(e.length-1)==")"?e.substr(0,e.length-1):e).split(" ");i=t.multiline?i.map(function(R){return R.split(` 636`)}):i.map(function(R){return[R]});var s=n,a=wt.internal.getHeight(t)||0;a=a<0?-a:a;var o=wt.internal.getWidth(t)||0;o=o<0?-o:o;var l=function(R,j,$){if(R+1<i.length){var U=j+" "+i[R+1][0];return b2(U,t,$).width<=o-4}return!1};s++;e:for(;s>0;){e="",s--;var c,u,d=b2("3",t,s).height,f=t.multiline?a-s:(a-d)/2,h=f+=2,p=0,m=0,g=0;if(s<=0){e=`(...) Tj 637`,e+="% Width of Text: "+b2(e,t,s=12).width+", FieldWidth:"+o+` 638`;break}for(var v="",_=0,b=0;b<i.length;b++)if(i.hasOwnProperty(b)){var x=!1;if(i[b].length!==1&&g!==i[b].length-1){if((d+2)*(_+2)+2>a)continue e;v+=i[b][g],x=!0,m=b,b--}else{v=(v+=i[b][g]+" ").substr(v.length-1)==" "?v.substr(0,v.length-1):v;var T=parseInt(b),N=l(T,v,s),A=b>=i.length-1;if(N&&!A){v+=" ",g=0;continue}if(N||A){if(A)m=T;else if(t.multiline&&(d+2)*(_+2)+2>a)continue e}else{if(!t.multiline||(d+2)*(_+2)+2>a)continue e;m=T}}for(var L="",M=p;M<=m;M++){var B=i[M];if(t.multiline){if(M===m){L+=B[g]+" ",g=(g+1)%B.length;continue}if(M===p){L+=B[B.length-1]+" ";continue}}L+=B[0]+" "}switch(L=L.substr(L.length-1)==" "?L.substr(0,L.length-1):L,u=b2(L,t,s).width,t.textAlign){case"right":c=o-u-2;break;case"center":c=(o-u)/2;break;default:c=2}e+=an(c)+" "+an(h)+` Td 639`,e+="("+am(L)+`) Tj 640`,e+=-an(c)+` 0 Td 641`,h=-(s+2),u=0,p=x?m:m+1,_++,v=""}break}return r.text=e,r.fontSize=s,r},b2=function(t,e,n){var r=e.scope.internal.getFont(e.fontName,e.fontStyle),i=e.scope.getStringUnitWidth(t,{font:r,fontSize:parseFloat(n),charSpace:0})*parseFloat(n);return{height:e.scope.getStringUnitWidth("3",{font:r,fontSize:parseFloat(n),charSpace:0})*parseFloat(n)*1.5,width:i}},FDe={fields:[],xForms:[],acroFormDictionaryRoot:null,printedOut:!1,internal:null,isInitialized:!1},jDe=function(t,e){var n={type:"reference",object:t};e.internal.getPageInfo(t.page).pageContext.annotations.find(function(r){return r.type===n.type&&r.object===n.object})===void 0&&e.internal.getPageInfo(t.page).pageContext.annotations.push(n)},BDe=function(t,e){if(e.scope=t,t.internal!==void 0&&(t.internal.acroformPlugin===void 0||t.internal.acroformPlugin.isInitialized===!1)){if(fc.FieldNum=0,t.internal.acroformPlugin=JSON.parse(JSON.stringify(FDe)),t.internal.acroformPlugin.acroFormDictionaryRoot)throw new Error("Exception while creating AcroformDictionary");yO=t.internal.scaleFactor,t.internal.acroformPlugin.acroFormDictionaryRoot=new XZ,t.internal.acroformPlugin.acroFormDictionaryRoot.scope=t,t.internal.acroformPlugin.acroFormDictionaryRoot._eventID=t.internal.events.subscribe("postPutResources",function(){(function(n){n.internal.events.unsubscribe(n.internal.acroformPlugin.acroFormDictionaryRoot._eventID),delete n.internal.acroformPlugin.acroFormDictionaryRoot._eventID,n.internal.acroformPlugin.printedOut=!0})(t)}),t.internal.events.subscribe("buildDocument",function(){(function(n){n.internal.acroformPlugin.acroFormDictionaryRoot.objId=void 0;var r=n.internal.acroformPlugin.acroFormDictionaryRoot.Fields;for(var i in r)if(r.hasOwnProperty(i)){var s=r[i];s.objId=void 0,s.hasAnnotation&&jDe(s,n)}})(t)}),t.internal.events.subscribe("putCatalog",function(){(function(n){if(n.internal.acroformPlugin.acroFormDictionaryRoot===void 0)throw new Error("putCatalogCallback: Root missing.");n.internal.write("/AcroForm "+n.internal.acroformPlugin.acroFormDictionaryRoot.objId+" 0 R")})(t)}),t.internal.events.subscribe("postPutPages",function(n){(function(r,i){var s=!r;for(var a in r||(i.internal.newObjectDeferredBegin(i.internal.acroformPlugin.acroFormDictionaryRoot.objId,!0),i.internal.acroformPlugin.acroFormDictionaryRoot.putStream()),r=r||i.internal.acroformPlugin.acroFormDictionaryRoot.Kids)if(r.hasOwnProperty(a)){var o=r[a],l=[],c=o.Rect;if(o.Rect&&(o.Rect=ODe(o.Rect,i)),i.internal.newObjectDeferredBegin(o.objId,!0),o.DA=wt.createDefaultAppearanceStream(o),sr(o)==="object"&&typeof o.getKeyValueListForStream=="function"&&(l=o.getKeyValueListForStream()),o.Rect=c,o.hasAppearanceStream&&!o.appearanceStreamContent){var u=DDe(o);l.push({key:"AP",value:"<</N "+u+">>"}),i.internal.acroformPlugin.xForms.push(u)}if(o.appearanceStreamContent){var d="";for(var f in o.appearanceStreamContent)if(o.appearanceStreamContent.hasOwnProperty(f)){var h=o.appearanceStreamContent[f];if(d+="/"+f+" ",d+="<<",Object.keys(h).length>=1||Array.isArray(h)){for(var a in h)if(h.hasOwnProperty(a)){var p=h[a];typeof p=="function"&&(p=p.call(i,o)),d+="/"+a+" "+p+" ",i.internal.acroformPlugin.xForms.indexOf(p)>=0||i.internal.acroformPlugin.xForms.push(p)}}else typeof(p=h)=="function"&&(p=p.call(i,o)),d+="/"+a+" "+p,i.internal.acroformPlugin.xForms.indexOf(p)>=0||i.internal.acroformPlugin.xForms.push(p);d+=">>"}l.push({key:"AP",value:`<< 642`+d+">>
642"})}i.internal.putStream({additionalKeyValues:l,objectId:o.objId}),i.internal.out("endobj")}s&&function(m,g){for(var v in m)if(m.hasOwnProperty(v)){var _=v,b=m[v];g.internal.newObjectDeferredBegin(b.objId,!0),sr(b)==="object"&&typeof b.putStream=="function"&&b.putStream(),delete m[_]}}(i.internal.acroformPlugin.xForms,i)})(n,t)}),t.internal.acroformPlugin.isInitialized=!0}},JZ=hi.__acroform__.arrayToPdfArray=function(t,e,n){var r=function(a){return a};if(Array.isArray(t)){for(var i="[",s=0;s<t.length;s++)switch(s!==0&&(i+=" "),sr(t[s])){case"boolean":case"number":case"object":i+=t[s].toString();break;case"string":t[s].substr(0,1)==="/"?i+="/"+Hp(t[s].substr(1)):(e!==void 0&&n&&(r=n.internal.getEncryptor(e)),i+="("+am(r(t[s].toString()))+")")}return i+"]"}throw new Error("Invalid argument passed to jsPDF.__acroform__.arrayToPdfArray")},RE=function(t,e,n){var r=function(i){return i};return e!==void 0&&n&&(r=n.internal.getEncryptor(e)),(t=t||"").toString(),"("+am(r(t))+")"},Kc=function(){this._objId=void 0,this._scope=void 0,Object.defineProperty(this,"objId",{get:function(){if(this._objId===void 0){if(this.scope===void 0)return;this._objId=this.scope.internal.newObjectDeferred()}return this._objId},set:function(t){this._objId=t}}),Object.defineProperty(this,"scope",{value:this._scope,writable:!0})};Kc.prototype.toString=function(){return this.objId+" 0 R"},Kc.prototype.putStream=function(){var t=this.getKeyValueListForStream();this.scope.internal.putStream({data:this.stream,additionalKeyValues:t,objectId:this.objId}),this.scope.internal.out("endobj")},Kc.prototype.getKeyValueListForStream=function(){var t=[],e=Object.getOwnPropertyNames(this).filter(function(s){return s!="content"&&s!="appearanceStreamContent"&&s!="scope"&&s!="objId"&&s.substring(0,1)!="_"});for(var n in e)if(Object.getOwnPropertyDescriptor(this,e[n]).configurable===!1){var r=e[n],i=this[r];i&&(Array.isArray(i)?t.push({key:r,value:JZ(i,this.objId,this.scope)}):i instanceof Kc?(i.scope=this.scope,t.push({key:r,value:i.objId+" 0 R"})):typeof i!="function"&&t.push({key:r,value:i}))}return t};var YZ=function(){Kc.call(this),Object.defineProperty(this,"Type",{value:"/XObject",configurable:!1,writable:!0}),Object.defineProperty(this,"Subtype",{value:"/Form",configurable:!1,writable:!0}),Object.defineProperty(this,"FormType",{value:1,configurable:!1,writable:!0});var t,e=[];Object.defineProperty(this,"BBox",{configurable:!1,get:function(){return e},set:function(n){e=n}}),Object.defineProperty(this,"Resources",{value:"2 0 R",configurable:!1,writable:!0}),Object.defineProperty(this,"stream",{enumerable:!1,configurable:!0,set:function(n){t=n.trim()},get:function(){return t||null}})};Za(YZ,Kc);var XZ=function(){Kc.call(this);var t,e=[];Object.defineProperty(this,"Kids",{enumerable:!1,configurable:!0,get:function(){return e.length>0?e:void 0}}),Object.defineProperty(this,"Fields",{enumerable:!1,configurable:!1,get:function(){return e}}),Object.defineProperty(this,"DA",{enumerable:!1,configurable:!1,get:function(){if(t){var n=function(r){return r};return this.scope&&(n=this.scope.internal.getEncryptor(this.objId)),"("+am(n(t))+")"}},set:function(n){t=n}})};Za(XZ,Kc);var fc=function t(){Kc.call(this);var e=4;Object.defineProperty(this,"F",{enumerable:!1,configurable:!1,get:function(){return e},set:function(v){if(isNaN(v))throw new Error('Invalid value "'+v+'" for attribute F supplied.');e=v}}),Object.defineProperty(this,"showWhenPrinted",{enumerable:!0,configurable:!0,get:function(){return!!Ti(e,3)},set:function(v){v?this.F=Ci(e,3):this.F=Ei(e,3)}});var n=0;Object.defineProperty(this,"Ff",{enumerable:!1,configurable:!1,get:function(){return n},set:function(v){if(isNaN(v))throw new Error('Invalid value "'+v+'" for attribute Ff supplied.');n=v}});var r=[];Object.defineProperty(this,"Rect",{enumerable:!1,configurable:!1,get:function(){if(r.length!==0)return r},set:function(v){r=v!==void 0?v:[]}}),Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[0])?0:r[0]},set:function(v){r[0]=v}}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[1])?0:r[1]},set:function(v){r[1]=v}}),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[2])?0:r[2]},set:function(v){r[2]=v}}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[3])?0:r[3]}
vendor: 18,205 bytes, lines 642-653
642,set:function(v){r[3]=v}});var i="";Object.defineProperty(this,"FT",{enumerable:!0,configurable:!1,get:function(){return i},set:function(v){switch(v){case"/Btn":case"/Tx":case"/Ch":case"/Sig":i=v;break;default:throw new Error('Invalid value "'+v+'" for attribute FT supplied.')}}});var s=null;Object.defineProperty(this,"T",{enumerable:!0,configurable:!1,get:function(){if(!s||s.length<1){if(this instanceof dS)return;s="FieldObject"+t.FieldNum++}var v=function(_){return _};return this.scope&&(v=this.scope.internal.getEncryptor(this.objId)),"("+am(v(s))+")"},set:function(v){s=v.toString()}}),Object.defineProperty(this,"fieldName",{configurable:!0,enumerable:!0,get:function(){return s},set:function(v){s=v}});var a="helvetica";Object.defineProperty(this,"fontName",{enumerable:!0,configurable:!0,get:function(){return a},set:function(v){a=v}});var o="normal";Object.defineProperty(this,"fontStyle",{enumerable:!0,configurable:!0,get:function(){return o},set:function(v){o=v}});var l=0;Object.defineProperty(this,"fontSize",{enumerable:!0,configurable:!0,get:function(){return l},set:function(v){l=v}});var c=void 0;Object.defineProperty(this,"maxFontSize",{enumerable:!0,configurable:!0,get:function(){return c===void 0?50/yO:c},set:function(v){c=v}});var u="black";Object.defineProperty(this,"color",{enumerable:!0,configurable:!0,get:function(){return u},set:function(v){u=v}});var d="/F1 0 Tf 0 g";Object.defineProperty(this,"DA",{enumerable:!0,configurable:!1,get:function(){if(!(!d||this instanceof dS||this instanceof Np))return RE(d,this.objId,this.scope)},set:function(v){v=v.toString(),d=v}});var f=null;Object.defineProperty(this,"DV",{enumerable:!1,configurable:!1,get:function(){if(f)return this instanceof os==0?RE(f,this.objId,this.scope):f},set:function(v){v=v.toString(),f=this instanceof os==0?v.substr(0,1)==="("?sg(v.substr(1,v.length-2)):sg(v):v}}),Object.defineProperty(this,"defaultValue",{enumerable:!0,configurable:!0,get:function(){return this instanceof os==1?sg(f.substr(1,f.length-1)):f},set:function(v){v=v.toString(),f=this instanceof os==1?"/"+Hp(v):v}});var h=null;Object.defineProperty(this,"_V",{enumerable:!1,configurable:!1,get:function(){if(h)return h},set:function(v){this.V=v}}),Object.defineProperty(this,"V",{enumerable:!1,configurable:!1,get:function(){if(h)return this instanceof os==0?RE(h,this.objId,this.scope):h},set:function(v){v=v.toString(),h=this instanceof os==0?v.substr(0,1)==="("?sg(v.substr(1,v.length-2)):sg(v):v}}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,get:function(){return this instanceof os==1?sg(h.substr(1,h.length-1)):h},set:function(v){v=v.toString(),h=this instanceof os==1?"/"+Hp(v):v}}),Object.defineProperty(this,"hasAnnotation",{enumerable:!0,configurable:!0,get:function(){return this.Rect}}),Object.defineProperty(this,"Type",{enumerable:!0,configurable:!1,get:function(){return this.hasAnnotation?"/Annot":null}}),Object.defineProperty(this,"Subtype",{enumerable:!0,configurable:!1,get:function(){return this.hasAnnotation?"/Widget":null}});var p,m=!1;Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return m},set:function(v){v=!!v,m=v}}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,get:function(){if(p)return p},set:function(v){p=v}}),Object.defineProperty(this,"readOnly",{enumerable:!0,configurable:!0,get:function(){return!!Ti(this.Ff,1)},set:function(v){v?this.Ff=Ci(this.Ff,1):this.Ff=Ei(this.Ff,1)}}),Object.defineProperty(this,"required",{enumerable:!0,configurable:!0,get:function(){return!!Ti(this.Ff,2)},set:function(v){v?this.Ff=Ci(this.Ff,2):this.Ff=Ei(this.Ff,2)}}),Object.defineProperty(this,"noExport",{enumerable:!0,configurable:!0,get:function(){return!!Ti(this.Ff,3)},set:function(v){v?this.Ff=Ci(this.Ff,3):this.Ff=Ei(this.Ff,3)}});var g=null;Object.defineProperty(this,"Q",{enumerable:!0,configurable:!1,get:function(){if(g!==null)return g},set:function(v){if([0,1,2].indexOf(v)===-1)throw new Error('Invalid value "'+v+'" for attribute Q supplied.');g=v}}),Object.defineProperty(this,"textAlign",{get:function(){var v;switch(g){case 0:default:v="left";break;case 1:v="center";break;case 2:v="right"}return v},configurable:!0,enumerable:!0,set:function(v){switch(v){case"right":case 2:g=2;break;case"center":case 1:g=1;break;default:g=0}}})};Za(fc,Kc);var rv=function(){fc.call(this),this.FT="/Ch",this.V="()",this.fontName="zapfdingbats";var t=0;Object.defineProperty(this,"TI",{enumerable:!0,configurable:!1,get:function(){return t},set:function(n){t=n}}),Object.defineProperty(this,"topIndex",{enumerable:!0,configurable:!0,get:function(){return t},set:function(n){t=n}});var e=[];Object.defineProperty(this,"Opt",{enumerable:!0,configurable:!1,get:function(){return JZ(e,this.objId,this.scope)},set:function(n){var r,i;i=[],typeof(r=n)=="string"&&(i=function(s,a,o){o||(o=1);for(var l,c=[];l=a.exec(s);)c.push(l[o]);return c}(r,/\((.*?)\)/g)),e=i}}),this.getOptions=function(){return e},this.setOptions=function(n){e=n,this.sort&&e.sort()},this.addOption=function(n){n=(n=n||"").toString(),e.push(n),this.sort&&e.sort()},this.removeOption=function(n,r){for(r=r||!1,n=(n=n||"").toString();e.indexOf(n)!==-1&&(e.splice(e.indexOf(n),1),r!==!1););},Object.defineProperty(this,"combo",{enumerable:!0,configurable:!0,get:function(){return!!Ti(this.Ff,18)},set:function(n){n?this.Ff=Ci(this.Ff,18):this.Ff=Ei(this.Ff,18)}}),Object.defineProperty(this,"edit",{enumerable:!0,configurable:!0,get:function(){return!!Ti(this.Ff,19)},set:function(n){this.combo===!0&&(n?this.Ff=Ci(this.Ff,19):this.Ff=Ei(this.Ff,19))}}),Object.defineProperty(this,"sort",{enumerable:!0,configurable:!0,get:function(){return!!Ti(this.Ff,20)},set:function(n){n?(this.Ff=Ci(this.Ff,20),e.sort()):this.Ff=Ei(this.Ff,20)}}),Object.defineProperty(this,"multiSelect",{enumerable:!0,configurable:!0,get:function(){return!!Ti(this.Ff,22)},set:function(n){n?this.Ff=Ci(this.Ff,22):this.Ff=Ei(this.Ff,22)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!Ti(this.Ff,23)},set:function(n){n?this.Ff=Ci(this.Ff,23):this.Ff=Ei(this.Ff,23)}}),Object.defineProperty(this,"commitOnSelChange",{enumerable:!0,configurable:!0,get:function(){return!!Ti(this.Ff,27)},set:function(n){n?this.Ff=Ci(this.Ff,27):this.Ff=Ei(this.Ff,27)}}),this.hasAppearanceStream=!1};Za(rv,fc);var iv=function(){rv.call(this),this.fontName="helvetica",this.combo=!1};Za(iv,rv);var sv=function(){iv.call(this),this.combo=!0};Za(sv,iv);var Mx=function(){sv.call(this),this.edit=!0};Za(Mx,sv);var os=function(){fc.call(this),this.FT="/Btn",Object.defineProperty(this,"noToggleToOff",{enumerable:!0,configurable:!0,get:function(){return!!Ti(this.Ff,15)},set:function(n){n?this.Ff=Ci(this.Ff,15):this.Ff=Ei(this.Ff,15)}}),Object.defineProperty(this,"radio",{enumerable:!0,configurable:!0,get:function(){return!!Ti(this.Ff,16)},set:function(n){n?this.Ff=Ci(this.Ff,16):this.Ff=Ei(this.Ff,16)}}),Object.defineProperty(this,"pushButton",{enumerable:!0,configurable:!0,get:function(){return!!Ti(this.Ff,17)},set:function(n){n?this.Ff=Ci(this.Ff,17):this.Ff=Ei(this.Ff,17)}}),Object.defineProperty(this,"radioIsUnison",{enumerable:!0,configurable:!0,get:function(){return!!Ti(this.Ff,26)},set:function(n){n?this.Ff=Ci(this.Ff,26):this.Ff=Ei(this.Ff,26)}});var t,e={};Object.defineProperty(this,"MK",{enumerable:!1,configurable:!1,get:function(){var n=function(s){return s};if(this.scope&&(n=this.scope.internal.getEncryptor(this.objId)),Object.keys(e).length!==0){var r,i=[];for(r in i.push("<<"),e)i.push("/"+r+" ("+am(n(e[r]))+")");return i.push(">>"),i.join(` 643`)}},set:function(n){sr(n)==="object"&&(e=n)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return e.CA||""},set:function(n){typeof n=="string"&&(e.CA=n)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return t},set:function(n){var r=n==null?"":n.toString();r.substr(0,1)==="/"&&(r=r.substr(1)),t="/"+Hp(r)}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return t.substr(1,t.length-1)},set:function(n){t="/"+Hp(n)}})};Za(os,fc);var Nx=function(){os.call(this),this.pushButton=!0};Za(Nx,os);var av=function(){os.call(this),this.radio=!0,this.pushButton=!1;var t=[];Object.defineProperty(this,"Kids",{enumerable:!0,configurable:!1,get:function(){return t},set:function(e){t=e!==void 0?e:[]}})};Za(av,os);var dS=function(){var t,e;fc.call(this),Object.defineProperty(this,"Parent",{enumerable:!1,configurable:!1,get:function(){return t},set:function(i){t=i}}),Object.defineProperty(this,"optionName",{enumerable:!1,configurable:!0,get:function(){return e},set:function(i){e=i}});var n,r={};Object.defineProperty(this,"MK",{enumerable:!1,configurable:!1,get:function(){var i=function(o){return o};this.scope&&(i=this.scope.internal.getEncryptor(this.objId));var s,a=[];for(s in a.push("<<"),r)a.push("/"+s+" ("+am(i(r[s]))+")");return a.push(">>"),a.join(` 644`)},set:function(i){sr(i)==="object"&&(r=i)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return r.CA||""},set:function(i){typeof i=="string"&&(r.CA=i)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return n},set:function(i){var s=i==null?"":i.toString();s.substr(0,1)==="/"&&(s=s.substr(1)),n="/"+Hp(s)}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return n.substr(1,n.length-1)},set:function(i){var s=i==null?"":i.toString();s.substr(0,1)==="/"&&(s=s.substr(1)),n="/"+Hp(s)}}),this.caption="l",this.appearanceState="Off",this._AppearanceType=wt.RadioButton.Circle,this.appearanceStreamContent=this._AppearanceType.createAppearanceStream(this.optionName)};Za(dS,fc),av.prototype.setAppearance=function(t){if(!("createAppearanceStream"in t)||!("getCA"in t))throw new Error("Couldn't assign Appearance to RadioButton. Appearance was Invalid!");for(var e in this.Kids)if(this.Kids.hasOwnProperty(e)){var n=this.Kids[e];n.appearanceStreamContent=t.createAppearanceStream(n.optionName),n.caption=t.getCA()}},av.prototype.createOption=function(t){var e=new dS;return e.Parent=this,e.optionName=t,this.Kids.push(e),UDe.call(this.scope,e),e};var Rx=function(){os.call(this),this.fontName="zapfdingbats",this.caption="3",this.appearanceState="On",this.value="On",this.textAlign="center",this.appearanceStreamContent=wt.CheckBox.createAppearanceStream()};Za(Rx,os);var Np=function(){fc.call(this),this.FT="/Tx",Object.defineProperty(this,"multiline",{enumerable:!0,configurable:!0,get:function(){return!!Ti(this.Ff,13)},set:function(e){e?this.Ff=Ci(this.Ff,13):this.Ff=Ei(this.Ff,13)}}),Object.defineProperty(this,"fileSelect",{enumerable:!0,configurable:!0,get:function(){return!!Ti(this.Ff,21)},set:function(e){e?this.Ff=Ci(this.Ff,21):this.Ff=Ei(this.Ff,21)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!Ti(this.Ff,23)},set:function(e){e?this.Ff=Ci(this.Ff,23):this.Ff=Ei(this.Ff,23)}}),Object.defineProperty(this,"doNotScroll",{enumerable:!0,configurable:!0,get:function(){return!!Ti(this.Ff,24)},set:function(e){e?this.Ff=Ci(this.Ff,24):this.Ff=Ei(this.Ff,24)}}),Object.defineProperty(this,"comb",{enumerable:!0,configurable:!0,get:function(){return!!Ti(this.Ff,25)},set:function(e){e?this.Ff=Ci(this.Ff,25):this.Ff=Ei(this.Ff,25)}}),Object.defineProperty(this,"richText",{enumerable:!0,configurable:!0,get:function(){return!!Ti(this.Ff,26)},set:function(e){e?this.Ff=Ci(this.Ff,26):this.Ff=Ei(this.Ff,26)}});var t=null;Object.defineProperty(this,"MaxLen",{enumerable:!0,configurable:!1,get:function(){return t},set:function(e){t=e}}),Object.defineProperty(this,"maxLength",{enumerable:!0,configurable:!0,get:function(){return t},set:function(e){Number.isInteger(e)&&(t=e)}}),Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return this.V||this.DV}})};Za(Np,fc);var Ix=function(){Np.call(this),Object.defineProperty(this,"password",{enumerable:!0,configurable:!0,get:function(){return!!Ti(this.Ff,14)},set:function(t){t?this.Ff=Ci(this.Ff,14):this.Ff=Ei(this.Ff,14)}}),this.password=!0};Za(Ix,Np);var wt={CheckBox:{createAppearanceStream:function(){return{N:{On:wt.CheckBox.YesNormal},D:{On:wt.CheckBox.YesPushDown,Off:wt.CheckBox.OffPushDown}}},YesPushDown:function(t){var e=Nc(t);e.scope=t.scope;var n=[],r=t.scope.internal.getFont(t.fontName,t.fontStyle).id,i=t.scope.__private__.encodeColorString(t.color),s=PN(t,t.caption);return n.push("0.749023 g"),n.push("0 0 "+an(wt.internal.getWidth(t))+" "+an(wt.internal.getHeight(t))+" re"),n.push("f"),n.push("BMC"),n.push("q"),n.push("0 0 1 rg"),n.push("/"+r+" "+an(s.fontSize)+" Tf "+i),n.push("BT"),n.push(s.text),n.push("ET"),n.push("Q"),n.push("EMC"),e.stream=n.join(` 645`),e},YesNormal:function(t){var e=Nc(t);e.scope=t.scope;var n=t.scope.internal.getFont(t.fontName,t.fontStyle).id,r=t.scope.__private__.encodeColorString(t.color),i=[],s=wt.internal.getHeight(t),a=wt.internal.getWidth(t),o=PN(t,t.caption);return i.push("1 g"),i.push("0 0 "+an(a)+" "+an(s)+" re"),i.push("f"),i.push("q"),i.push("0 0 1 rg"),i.push("0 0 "+an(a-1)+" "+an(s-1)+" re"),i.push("W"),i.push("n"),i.push("0 g"),i.push("BT"),i.push("/"+n+" "+an(o.fontSize)+" Tf "+r),i.push(o.text),i.push("ET"),i.push("Q"),e.stream=i.join(` 646`),e},OffPushDown:function(t){var e=Nc(t);e.scope=t.scope;var n=[];return n.push("0.749023 g"),n.push("0 0 "+an(wt.internal.getWidth(t))+" "+an(wt.internal.getHeight(t))+" re"),n.push("f"),e.stream=n.join(` 647`),e}},RadioButton:{Circle:{createAppearanceStream:function(t){var e={D:{Off:wt.RadioButton.Circle.OffPushDown},N:{}};return e.N[t]=wt.RadioButton.Circle.YesNormal,e.D[t]=wt.RadioButton.Circle.YesPushDown,e},getCA:function(){return"l"},YesNormal:function(t){var e=Nc(t);e.scope=t.scope;var n=[],r=wt.internal.getWidth(t)<=wt.internal.getHeight(t)?wt.internal.getWidth(t)/4:wt.internal.getHeight(t)/4;r=Number((.9*r).toFixed(5));var i=wt.internal.Bezier_C,s=Number((r*i).toFixed(5));return n.push("q"),n.push("1 0 0 1 "+Qd(wt.internal.getWidth(t)/2)+" "+Qd(wt.internal.getHeight(t)/2)+" cm"),n.push(r+" 0 m"),n.push(r+" "+s+" "+s+" "+r+" 0 "+r+" c"),n.push("-"+s+" "+r+" -"+r+" "+s+" -"+r+" 0 c"),n.push("-"+r+" -"+s+" -"+s+" -"+r+" 0 -"+r+" c"),n.push(s+" -"+r+" "+r+" -"+s+" "+r+" 0 c"),n.push("f"),n.push("Q"),e.stream=n.join(` 648`),e},YesPushDown:function(t){var e=Nc(t);e.scope=t.scope;var n=[],r=wt.internal.getWidth(t)<=wt.internal.getHeight(t)?wt.internal.getWidth(t)/4:wt.internal.getHeight(t)/4;r=Number((.9*r).toFixed(5));var i=Number((2*r).toFixed(5)),s=Number((i*wt.internal.Bezier_C).toFixed(5)),a=Number((r*wt.internal.Bezier_C).toFixed(5));return n.push("0.749023 g"),n.push("q"),n.push("1 0 0 1 "+Qd(wt.internal.getWidth(t)/2)+" "+Qd(wt.internal.getHeight(t)/2)+" cm"),n.push(i+" 0 m"),n.push(i+" "+s+" "+s+" "+i+" 0 "+i+" c"),n.push("-"+s+" "+i+" -"+i+" "+s+" -"+i+" 0 c"),n.push("-"+i+" -"+s+" -"+s+" -"+i+" 0 -"+i+" c"),n.push(s+" -"+i+" "+i+" -"+s+" "+i+" 0 c"),n.push("f"),n.push("Q"),n.push("0 g"),n.push("q"),n.push("1 0 0 1 "+Qd(wt.internal.getWidth(t)/2)+" "+Qd(wt.internal.getHeight(t)/2)+" cm"),n.push(r+" 0 m"),n.push(r+" "+a+" "+a+" "+r+" 0 "+r+" c"),n.push("-"+a+" "+r+" -"+r+" "+a+" -"+r+" 0 c"),n.push("-"+r+" -"+a+" -"+a+" -"+r+" 0 -"+r+" c"),n.push(a+" -"+r+" "+r+" -"+a+" "+r+" 0 c"),n.push("f"),n.push("Q"),e.stream=n.join(` 649`),e},OffPushDown:function(t){var e=Nc(t);e.scope=t.scope;var n=[],r=wt.internal.getWidth(t)<=wt.internal.getHeight(t)?wt.internal.getWidth(t)/4:wt.internal.getHeight(t)/4;r=Number((.9*r).toFixed(5));var i=Number((2*r).toFixed(5)),s=Number((i*wt.internal.Bezier_C).toFixed(5));return n.push("0.749023 g"),n.push("q"),n.push("1 0 0 1 "+Qd(wt.internal.getWidth(t)/2)+" "+Qd(wt.internal.getHeight(t)/2)+" cm"),n.push(i+" 0 m"),n.push(i+" "+s+" "+s+" "+i+" 0 "+i+" c"),n.push("-"+s+" "+i+" -"+i+" "+s+" -"+i+" 0 c"),n.push("-"+i+" -"+s+" -"+s+" -"+i+" 0 -"+i+" c"),n.push(s+" -"+i+" "+i+" -"+s+" "+i+" 0 c"),n.push("f"),n.push("Q"),e.stream=n.join(` 650`),e}},Cross:{createAppearanceStream:function(t){var e={D:{Off:wt.RadioButton.Cross.OffPushDown},N:{}};return e.N[t]=wt.RadioButton.Cross.YesNormal,e.D[t]=wt.RadioButton.Cross.YesPushDown,e},getCA:function(){return"8"},YesNormal:function(t){var e=Nc(t);e.scope=t.scope;var n=[],r=wt.internal.calculateCross(t);return n.push("q"),n.push("1 1 "+an(wt.internal.getWidth(t)-2)+" "+an(wt.internal.getHeight(t)-2)+" re"),n.push("W"),n.push("n"),n.push(an(r.x1.x)+" "+an(r.x1.y)+" m"),n.push(an(r.x2.x)+" "+an(r.x2.y)+" l"),n.push(an(r.x4.x)+" "+an(r.x4.y)+" m"),n.push(an(r.x3.x)+" "+an(r.x3.y)+" l"),n.push("s"),n.push("Q"),e.stream=n.join(` 651`),e},YesPushDown:function(t){var e=Nc(t);e.scope=t.scope;var n=wt.internal.calculateCross(t),r=[];return r.push("0.749023 g"),r.push("0 0 "+an(wt.internal.getWidth(t))+" "+an(wt.internal.getHeight(t))+" re"),r.push("f"),r.push("q"),r.push("1 1 "+an(wt.internal.getWidth(t)-2)+" "+an(wt.internal.getHeight(t)-2)+" re"),r.push("W"),r.push("n"),r.push(an(n.x1.x)+" "+an(n.x1.y)+" m"),r.push(an(n.x2.x)+" "+an(n.x2.y)+" l"),r.push(an(n.x4.x)+" "+an(n.x4.y)+" m"),r.push(an(n.x3.x)+" "+an(n.x3.y)+" l"),r.push("s"),r.push("Q"),e.stream=r.join(` 652`),e},OffPushDown:function(t){var e=Nc(t);e.scope=t.scope;var n=[];return n.push("0.749023 g"),n.push("0 0 "+an(wt.internal.getWidth(t))+" "+an(wt.internal.getHeight(t))+" re"),n.push("f"),e.stream=n.join(` 653`),e}}},createDefaultAppearanceStream:function(t){var e=t.scope.internal.getFont(t.fontName,t.fontStyle).id,n=t.scope.__private__.encodeColorString(t.color);return"/"+e+" "+t.fontSize+" Tf "+n}};wt.internal={Bezier_C:.551915024494,calculateCross:function(t){var e=wt.internal.getWidth(t),n=wt.internal.getHeight(t),r=Math.min(e,n);return{x1:{x:(e-r)/2,y:(n-r)/2+r},x2:{x:(e-r)/2+r,y:(n-r)/2},x3:{x:(e-r)/2,y:(n-r)/2},x4:{x:(e-r)/2+r,y:(n-r)/2+r}}}},wt.internal.getWidth=function(t){var e=0;return sr(t)==="object"&&(e=HU(t.Rect[2])),e},wt.internal.getHeight=function(t){var e=0;return sr(t)==="object"&&(e=HU(t.Rect[3])),e};var UDe=hi.addField=function(t){if(BDe(this,t),!(t instanceof fc))throw new Error("Invalid argument passed to
653jsPDF.addField.");var e;return(e=t).scope.internal.acroformPlugin.printedOut&&(e.scope.internal.acroformPlugin.printedOut=!1,e.scope.internal.acroformPlugin.acroFormDictionaryRoot=null),e.scope.internal.acroformPlugin.acroFormDictionaryRoot.Fields.push(e),t.page=t.scope.internal.getCurrentPageInfo().pageNumber,this};hi.AcroFormChoiceField=rv,hi.AcroFormListBox=iv,hi.AcroFormComboBox=sv,hi.AcroFormEditBox=Mx,hi.AcroFormButton=os,hi.AcroFormPushButton=Nx,hi.AcroFormRadioButton=av,hi.AcroFormCheckBox=Rx,hi.AcroFormTextField=Np,hi.AcroFormPasswordField=Ix,hi.AcroFormAppearance=wt,hi.AcroForm={ChoiceField:rv,ListBox:iv,ComboBox:sv,EditBox:Mx,Button:os,PushButton:Nx,RadioButton:av,CheckBox:Rx,TextField:Np,PasswordField:Ix,Appearance:wt},Rt.AcroForm={ChoiceField:rv,ListBox:iv,ComboBox:sv,EditBox:Mx,Button:os,PushButton:Nx,RadioButton:av,CheckBox:Rx,TextField:Np,PasswordField:Ix,Appearance:wt};function QZ(t){return t.reduce(function(e,n,r){return e[n]=r,e},{})}(function(t){var e="addImage_";t.__addimage__={};var n="UNKNOWN",r={PNG:[[137,80,78,71]],TIFF:[[77,77,0,42],[73,73,42,0]],JPEG:[[255,216,255,224,void 0,void 0,74,70,73,70,0],[255,216,255,225,void 0,void 0,69,120,105,102,0,0],[255,216,255,219],[255,216,255,238]],JPEG2000:[[0,0,0,12,106,80,32,32]],GIF87a:[[71,73,70,56,55,97]],GIF89a:[[71,73,70,56,57,97]],WEBP:[[82,73,70,70,void 0,void 0,void 0,void 0,87,69,66,80]],BMP:[[66,77],[66,65],[67,73],[67,80],[73,67],[80,84]]},i=t.__addimage__.getImageFileTypeByImageData=function(R,j){var $,U,te,ne,le,V=n;if((j=j||n)==="RGBA"||R.data!==void 0&&R.data instanceof Uint8ClampedArray&&"height"in R&&"width"in R)return"RGBA";if(N(R))for(le in r)for(te=r[le],$=0;$<te.length;$+=1){for(ne=!0,U=0;U<te[$].length;U+=1)if(te[$][U]!==void 0&&te[$][U]!==R[U]){ne=!1;break}if(ne===!0){V=le;break}}else for(le in r)for(te=r[le],$=0;$<te.length;$+=1){for(ne=!0,U=0;U<te[$].length;U+=1)if(te[$][U]!==void 0&&te[$][U]!==R.charCodeAt(U)){ne=!1;break}if(ne===!0){V=le;break}}return V===n&&j!==n&&(V=j),V},s=function R(j){for(var $=this.internal.write,U=this.internal.putStream,te=(0,this.internal.getFilters)();te.indexOf("FlateEncode")!==-1;)te.splice(te.indexOf("FlateEncode"),1);j.objectId=this.internal.newObject();var ne=[];if(ne.push({key:"Type",value:"/XObject"}),ne.push({key:"Subtype",value:"/Image"}),ne.push({key:"Width",value:j.width}),ne.push({key:"Height",value:j.height}
vendor: 11,777 bytes, line 653
653),j.colorSpace===v.INDEXED?ne.push({key:"ColorSpace",value:"[/Indexed /DeviceRGB "+(j.palette.length/3-1)+" "+("sMask"in j&&j.sMask!==void 0?j.objectId+2:j.objectId+1)+" 0 R]"}):(ne.push({key:"ColorSpace",value:"/"+j.colorSpace}),j.colorSpace===v.DEVICE_CMYK&&ne.push({key:"Decode",value:"[1 0 1 0 1 0 1 0]"})),ne.push({key:"BitsPerComponent",value:j.bitsPerComponent}),"decodeParameters"in j&&j.decodeParameters!==void 0&&ne.push({key:"DecodeParms",value:"<<"+j.decodeParameters+">>"}),"transparency"in j&&Array.isArray(j.transparency)&&j.transparency.length>0){for(var le="",V=0,q=j.transparency.length;V<q;V++)le+=j.transparency[V]+" "+j.transparency[V]+" ";ne.push({key:"Mask",value:"["+le+"]"})}j.sMask!==void 0&&ne.push({key:"SMask",value:j.objectId+1+" 0 R"});var se=j.filter!==void 0?["/"+j.filter]:void 0;if(U({data:j.data,additionalKeyValues:ne,alreadyAppliedFilters:se,objectId:j.objectId}),$("endobj"),"sMask"in j&&j.sMask!==void 0){var he,z=(he=j.sMaskBitsPerComponent)!==null&&he!==void 0?he:j.bitsPerComponent,J={width:j.width,height:j.height,colorSpace:"DeviceGray",bitsPerComponent:z,data:j.sMask};"filter"in j&&(J.decodeParameters="/Predictor ".concat(j.predictor," /Colors 1 /BitsPerComponent ").concat(z," /Columns ").concat(j.width),J.filter=j.filter),R.call(this,J)}if(j.colorSpace===v.INDEXED){var Y=this.internal.newObject();U({data:L(new Uint8Array(j.palette)),objectId:Y}),$("endobj")}},a=function(){var R=this.internal.collections[e+"images"];for(var j in R)s.call(this,R[j])},o=function(){var R,j=this.internal.collections[e+"images"],$=this.internal.write;for(var U in j)$("/I"+(R=j[U]).index,R.objectId,"0","R")},l=function(){this.internal.collections[e+"images"]||(this.internal.collections[e+"images"]={},this.internal.events.subscribe("putResources",a),this.internal.events.subscribe("putXobjectDict",o))},c=function(){var R=this.internal.collections[e+"images"];return l.call(this),R},u=function(){return Object.keys(this.internal.collections[e+"images"]).length},d=function(R){return typeof t["process"+R.toUpperCase()]=="function"},f=function(R){return sr(R)==="object"&&R.nodeType===1},h=function(R,j){if(R.nodeName==="IMG"&&R.hasAttribute("src")){var $=""+R.getAttribute("src");if($.indexOf("data:image/")===0)return Px(unescape($).split("base64,").pop());var U=t.loadFile($,!0);if(U!==void 0)return U}if(R.nodeName==="CANVAS"){if(R.width===0||R.height===0)throw new Error("Given canvas must have data. Canvas width: "+R.width+", height: "+R.height);var te;switch(j){case"PNG":te="image/png";break;case"WEBP":te="image/webp";break;default:te="image/jpeg"}return Px(R.toDataURL(te,1).split("base64,").pop())}},p=function(R){var j=this.internal.collections[e+"images"];if(j){for(var $ in j)if(R===j[$].alias)return j[$]}},m=function(R,j,$){return R||j||(R=-96,j=-96),R<0&&(R=-1*$.width*72/R/this.internal.scaleFactor),j<0&&(j=-1*$.height*72/j/this.internal.scaleFactor),R===0&&(R=j*$.width/$.height),j===0&&(j=R*$.height/$.width),[R,j]},g=function(R,j,$,U,te,ne){var le=m.call(this,$,U,te),V=this.internal.getCoordinateString,q=this.internal.getVerticalCoordinateString,se=c.call(this);if($=le[0],U=le[1],se[te.index]=te,ne){ne*=Math.PI/180;var he=Math.cos(ne),z=Math.sin(ne),J=function(de){return de.toFixed(4)},Y=[J(he),J(z),J(-1*z),J(he),0,0,"cm"]}this.internal.write("q"),ne?(this.internal.write([1,"0","0",1,V(R),q(j+U),"cm"].join(" ")),this.internal.write(Y.join(" ")),this.internal.write([V($),"0","0",V(U),"0","0","cm"].join(" "))):this.internal.write([V($),"0","0",V(U),V(R),q(j+U),"cm"].join(" ")),this.isAdvancedAPI()&&this.internal.write([1,0,0,-1,0,0,"cm"].join(" ")),this.internal.write("/I"+te.index+" Do"),this.internal.write("Q")},v=t.color_spaces={DEVICE_RGB:"DeviceRGB",DEVICE_GRAY:"DeviceGray",DEVICE_CMYK:"DeviceCMYK",CAL_GREY:"CalGray",CAL_RGB:"CalRGB",LAB:"Lab",ICC_BASED:"ICCBased",INDEXED:"Indexed",PATTERN:"Pattern",SEPARATION:"Separation",DEVICE_N:"DeviceN"};t.decode={DCT_DECODE:"DCTDecode",FLATE_DECODE:"FlateDecode",LZW_DECODE:"LZWDecode",JPX_DECODE:"JPXDecode",JBIG2_DECODE:"JBIG2Decode",ASCII85_DECODE:"ASCII85Decode",ASCII_HEX_DECODE:"ASCIIHexDecode",RUN_LENGTH_DECODE:"RunLengthDecode",CCITT_FAX_DECODE:"CCITTFaxDecode"};var _=t.image_compression={NONE:"NONE",FAST:"FAST",MEDIUM:"MEDIUM",SLOW:"SLOW"},b=t.__addimage__.sHashCode=function(R){var j,$,U=0;if(typeof R=="string")for($=R.length,j=0;j<$;j++)U=(U<<5)-U+R.charCodeAt(j),U|=0;else if(N(R))for($=R.byteLength/2,j=0;j<$;j++)U=(U<<5)-U+R[j],U|=0;return U},x=t.__addimage__.validateStringAsBase64=function(R){(R=R||"").toString().trim();var j=!0;return R.length===0&&(j=!1),R.length%4!=0&&(j=!1),/^[A-Za-z0-9+/]+$/.test(R.substr(0,R.length-2))===!1&&(j=!1),/^[A-Za-z0-9/][A-Za-z0-9+/]|[A-Za-z0-9+/]=|==$/.test(R.substr(-2))===!1&&(j=!1),j},T=t.__addimage__.extractImageFromDataUrl=function(R){if(R==null||!(R=R.trim()).startsWith("data:"))return null;var j=R.indexOf(",");return j<0?null:R.substring(0,j).trim().endsWith("base64")?R.substring(j+1):null};t.__addimage__.isArrayBuffer=function(R){return R instanceof ArrayBuffer};var N=t.__addimage__.isArrayBufferView=function(R){return R instanceof Int8Array||R instanceof Uint8Array||R instanceof Uint8ClampedArray||R instanceof Int16Array||R instanceof Uint16Array||R instanceof Int32Array||R instanceof Uint32Array||R instanceof Float32Array||R instanceof Float64Array},A=t.__addimage__.binaryStringToUint8Array=function(R){for(var j=R.length,$=new Uint8Array(j),U=0;U<j;U++)$[U]=R.charCodeAt(U);return $},L=t.__addimage__.arrayBufferToBinaryString=function(R){for(var j="",$=N(R)?R:new Uint8Array(R),U=0;U<$.length;U+=8192)j+=String.fromCharCode.apply(null,$.subarray(U,U+8192));return j};t.addImage=function(){var R,j,$,U,te,ne,le,V,q;if(typeof arguments[1]=="number"?(j=n,$=arguments[1],U=arguments[2],te=arguments[3],ne=arguments[4],le=arguments[5],V=arguments[6],q=arguments[7]):(j=arguments[1],$=arguments[2],U=arguments[3],te=arguments[4],ne=arguments[5],le=arguments[6],V=arguments[7],q=arguments[8]),sr(R=arguments[0])==="object"&&!f(R)&&"imageData"in R){var se=R;R=se.imageData,j=se.format||j||n,$=se.x||$||0,U=se.y||U||0,te=se.w||se.width||te,ne=se.h||se.height||ne,le=se.alias||le,V=se.compression||V,q=se.rotation||se.angle||q}var he=this.internal.getFilters();if(V===void 0&&he.indexOf("FlateEncode")!==-1&&(V="SLOW"),isNaN($)||isNaN(U))throw new Error("Invalid coordinates passed to jsPDF.addImage");l.call(this);var z=M.call(this,R,j,le,V);return g.call(this,$,U,te,ne,z,q),this};var M=function(R,j,$,U){var te,ne,le;if(typeof R=="string"&&i(R)===n){R=unescape(R);var V=B(R,!1);(V!==""||(V=t.loadFile(R,!0))!==void 0)&&(R=V)}if(f(R)&&(R=h(R,j)),j=i(R,j),!d(j))throw new Error("addImage does not support files of type '"+j+"', please ensure that a plugin for '"+j+"' support is added.");if(((le=$)==null||le.length===0)&&($=function(q){return typeof q=="string"||N(q)?b(q):N(q.data)?b(q.data):null}(R)),(te=p.call(this,$))||(R instanceof Uint8Array||j==="RGBA"||(ne=R,R=A(R)),te=this["process"+j.toUpperCase()](R,u.call(this),$,function(q){return q&&typeof q=="string"&&(q=q.toUpperCase()),q in t.image_compression?q:_.NONE}(U),ne)),!te)throw new Error("An unknown error occurred whilst processing the image.");return te},B=t.__addimage__.convertBase64ToBinaryString=function(R,j){j=typeof j!="boolean"||j;var $,U="";if(typeof R=="string"){var te;$=(te=T(R))!==null&&te!==void 0?te:R;try{U=Px($)}catch(ne){if(j)throw x($)?new Error("atob-Error in jsPDF.convertBase64ToBinaryString "+ne.message):new Error("Supplied Data is not a valid base64-String jsPDF.convertBase64ToBinaryString ")}}return U};t.getImageProperties=function(R){var j,$,U="";if(f(R)&&(R=h(R)),typeof R=="string"&&i(R)===n&&((U=B(R,!1))===""&&(U=t.loadFile(R)||""),R=U),$=i(R),!d($))throw new Error("addImage does not support files of type '"+$+"', please ensure that a plugin for '"+$+"' support is added.");if(R instanceof Uint8Array||(R=A(R)),!(j=this["process"+$.toUpperCase()](R)))throw new Error("An unknown error occurred whilst processing the image");return j.fileType=$,j}})(Rt.API),function(t){var e=function(n){if(n!==void 0&&n!="")return!0};Rt.API.events.push(["addPage",function(n){this.internal.getPageInfo(n.pageNumber).pageContext.annotations=[]}]),t.events.push(["putPage",function(n){for(var r,i,s,a=this.internal.getCoordinateString,o=this.internal.getVerticalCoordinateString,l=this.internal.getPageInfoByObjId(n.objId),c=n.pageContext.annotations,u=!1,d=0;d<c.length&&!u;d++)switch((r=c[d]).type){case"link":(e(r.options.url)||e(r.options.pageNumber))&&(u=!0);break;case"reference":case"text":case"freetext":u=!0}if(u!=0){this.internal.write("/Annots [");for(var f=0;f<c.length;f++){r=c[f];var h=this.internal.pdfEscape,p=this.internal.getEncryptor(n.objId);switch(r.type){case"reference":this.internal.write(" "+r.object.objId+" 0 R ");break;case"text":var m=this.internal.newAdditionalObject(),g=this.internal.newAdditionalObject(),v=this.internal.getEncryptor(m.objId),_=r.title||"Note";s="<</Type /Annot /Subtype /Text "+(i="/Rect ["+a(r.bounds.x)+" "+o(r.bounds.y+r.bounds.h)+" "+a(r.bounds.x+r.bounds.w)+" "+o(r.bounds.y)+"] ")+"/Contents ("+h(v(r.contents))+")",s+=" /Popup "+g.objId+" 0 R",s+=" /P "+l.objId+" 0 R",s+=" /T ("+h(v(_))+") >>",m.content=s;var b=m.objId+" 0 R";s="<</Type /Annot /Subtype /Popup "+(i="/Rect ["+a(r.bounds.x+30)+" "+o(r.bounds.y+r.bounds.h)+" "+a(r.bounds.x+r.bounds.w+30)+" "+o(r.bounds.y)+"] ")+" /Parent "+b,r.open&&(s+=" /Open true"),s+=" >>",g.content=s,this.internal.write(m.objId,"0 R",g.objId,"0 R");break;case"freetext":i="/Rect ["+a(r.bounds.x)+" "+o(r.bounds.y)+" "+a(r.bounds.x+r.bounds.w)+" "+o(r.bounds.y+r.bounds.h)+"] ";var x="font: Helvetica,sans-serif 12.0pt; text-align:left; color:#"+(r.color||"#000000");s="<</Type /Annot /Subtype /FreeText "+i+"/Contents ("+h(p(r.contents))+")",s+=" /DS("+h(p(x))+")",s+=" /Border [0 0 0]",s+=" >>",this.internal.write(s);break;case"link":if(r.options.name){var T=this.annotations._nameMap[r.options.name];r.options.pageNumber=T.page,r.options.top=T.y}else r.options.top||(r.options.top=0);if(i="/Rect ["+r.finalBounds.x+" "+r.finalBounds.y+" "+r.finalBounds.w+" "+r.finalBounds.h+"] ",s="",r.options.url)s="<</Type /Annot /Subtype /Link "+i+"/Border [0 0 0] /A <</S /URI /URI ("+h(p(r.options.url))+") >>";else if(r.options.pageNumber)switch(s="<</Type /Annot /Subtype /Link "+i+"/Border [0 0 0] /Dest ["+this.internal.getPageInfo(r.options.pageNumber).objId+" 0 R",r.options.magFactor=r.options.magFactor||"XYZ",r.options.magFactor){case"Fit":s+=" /Fit]";break;case"FitH":s+=" /FitH "+r.options.top+"]";break;case"FitV":r.options.left=r.options.left||0,s+=" /FitV "+r.options.left+"]";break;default:var N=o(r.options.top);r.options.left=r.options.left||0,r.options.zoom===void 0&&(r.options.zoom=0),s+=" /XYZ "+r.options.left+" "+N+" "+r.options.zoom+"]"}s!=""&&(s+=" >>",this.internal.write(s))}}this.internal.write("]")}}]),t.createAnnotation=function(n){var r=this.internal.getCurrentPageInfo();switch(n.type){case"link":this.link(n.bounds.x,n.bounds.y,n.bounds.w,n.bounds.h,n);break;case"text":case"freetext":r.pageContext.annotations.push(n)}},t.link=function(n,r,i,s,a){var o=this.internal.getCurrentPageInfo(),l=this.internal.getCoordinateString,c=this.internal.getVerticalCoordinateString;o.pageContext.annotations.push({finalBounds:{x:l(n),y:c(r),w:l(n+i),h:c(r+s)},options:a,type:"link"})},t.textWithLink=function(n,r,i,s){var a,o,l=this.getTextWidth(n),c=this.internal.getLineHeight()/this.internal.scaleFactor;if(s.maxWidth!==void 0){o=s.maxWidth;var u=this.splitTextToSize(n,o).length;a=Math.ceil(c*u)}else o=l,a=c;return this.text(n,r,i,s),i+=.2*c,s.align==="center"&&(r-=l/2),s.align==="right"&&(r-=l),this.link(r,i-c,o,a,s),l},t.getTextWidth=function(n){var r=this.internal.getFontSize();
653return this.getStringUnitWidth(n)*r/this.internal.scaleFactor}}(Rt.API),function(t){var e={1569:[65152],1570:[65153,65154],1571:[65155,65156],1572:[65157,65158],1573:[65159,65160],1574:[65161,65162,65163,65164],1575:[65165,65166],1576:[65167,65168,65169,65170],1577:[65171,65172],1578:[65173,65174,65175,65176],1579:[65177,65178,65179,65180],1580:[65181,65182,65183,65184],1581:[65185,65186,65187,65188],1582:[65189,65190,65191,65192],1583:[65193,65194],1584:[65195,65196],1585:[65197,65198],1586:[65199,65200],1587:[65201,65202,65203,65204],1588:[65205,65206,65207,65208],1589:[65209,65210,65211,65212],1590:[65213,65214,65215,65216],1591:[65217,65218,65219,65220],1592:[65221,65222,65223,65224],1593:[65225,65226,65227,65228],1594:[65229,65230,65231,65232],1601:[65233,65234,65235,65236],1602:[65237,65238,65239,65240],1603:[65241,65242,65243,65244],1604:[65245,65246,65247,65248],1605:[65249,65250,65251,65252],1606:[65253,65254,65255,65256],1607:[65257,65258,65259,65260],1608:[65261,65262],1609:[65263,65264,64488,64489],1610:[65265,65266,65267,65268],1649:[64336,64337],1655:[64477],1657:[64358,64359,64360,64361],1658:[64350,64351,64352,64353],1659:[64338,64339,64340,64341],1662:[64342,64343,64344,64345],1663:[64354,64355,64356,64357],1664:[64346,64347,64348,64349],1667:[64374,64375,64376,6437
vendor: 71,475 bytes, lines 653-690
6537],1668:[64370,64371,64372,64373],1670:[64378,64379,64380,64381],1671:[64382,64383,64384,64385],1672:[64392,64393],1676:[64388,64389],1677:[64386,64387],1678:[64390,64391],1681:[64396,64397],1688:[64394,64395],1700:[64362,64363,64364,64365],1702:[64366,64367,64368,64369],1705:[64398,64399,64400,64401],1709:[64467,64468,64469,64470],1711:[64402,64403,64404,64405],1713:[64410,64411,64412,64413],1715:[64406,64407,64408,64409],1722:[64414,64415],1723:[64416,64417,64418,64419],1726:[64426,64427,64428,64429],1728:[64420,64421],1729:[64422,64423,64424,64425],1733:[64480,64481],1734:[64473,64474],1735:[64471,64472],1736:[64475,64476],1737:[64482,64483],1739:[64478,64479],1740:[64508,64509,64510,64511],1744:[64484,64485,64486,64487],1746:[64430,64431],1747:[64432,64433]},n={65247:{65154:65269,65156:65271,65160:65273,65166:65275},65248:{65154:65270,65156:65272,65160:65274,65166:65276},65165:{65247:{65248:{65258:65010}}},1617:{1612:64606,1613:64607,1614:64608,1615:64609,1616:64610}},r={1612:64606,1613:64607,1614:64608,1615:64609,1616:64610},i=[1570,1571,1573,1575];t.__arabicParser__={};var s=t.__arabicParser__.isInArabicSubstitutionA=function(m){return e[m.charCodeAt(0)]!==void 0},a=t.__arabicParser__.isArabicLetter=function(m){return typeof m=="string"&&/^[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]+$/.test(m)},o=t.__arabicParser__.isArabicEndLetter=function(m){return a(m)&&s(m)&&e[m.charCodeAt(0)].length<=2},l=t.__arabicParser__.isArabicAlfLetter=function(m){return a(m)&&i.indexOf(m.charCodeAt(0))>=0};t.__arabicParser__.arabicLetterHasIsolatedForm=function(m){return a(m)&&s(m)&&e[m.charCodeAt(0)].length>=1};var c=t.__arabicParser__.arabicLetterHasFinalForm=function(m){return a(m)&&s(m)&&e[m.charCodeAt(0)].length>=2};t.__arabicParser__.arabicLetterHasInitialForm=function(m){return a(m)&&s(m)&&e[m.charCodeAt(0)].length>=3};var u=t.__arabicParser__.arabicLetterHasMedialForm=function(m){return a(m)&&s(m)&&e[m.charCodeAt(0)].length==4},d=t.__arabicParser__.resolveLigatures=function(m){var g=0,v=n,_="",b=0;for(g=0;g<m.length;g+=1)v[m.charCodeAt(g)]!==void 0?(b++,typeof(v=v[m.charCodeAt(g)])=="number"&&(_+=String.fromCharCode(v),v=n,b=0),g===m.length-1&&(v=n,_+=m.charAt(g-(b-1)),g-=b-1,b=0)):(v=n,_+=m.charAt(g-b),g-=b,b=0);return _};t.__arabicParser__.isArabicDiacritic=function(m){return m!==void 0&&r[m.charCodeAt(0)]!==void 0};var f=t.__arabicParser__.getCorrectForm=function(m,g,v){return a(m)?s(m)===!1?-1:!c(m)||!a(g)&&!a(v)||!a(v)&&o(g)||o(m)&&!a(g)||o(m)&&l(g)||o(m)&&o(g)?0:u(m)&&a(g)&&!o(g)&&a(v)&&c(v)?3:o(m)||!a(v)?1:2:-1},h=function(m){var g=0,v=0,_=0,b="",x="",T="",N=(m=m||"").split("\\s+"),A=[];for(g=0;g<N.length;g+=1){for(A.push(""),v=0;v<N[g].length;v+=1)b=N[g][v],x=N[g][v-1],T=N[g][v+1],a(b)?(_=f(b,x,T),A[g]+=_!==-1?String.fromCharCode(e[b.charCodeAt(0)][_]):b):A[g]+=b;A[g]=d(A[g])}return A.join(" ")},p=t.__arabicParser__.processArabic=t.processArabic=function(){var m,g=typeof arguments[0]=="string"?arguments[0]:arguments[0].text,v=[];if(Array.isArray(g)){var _=0;for(v=[],_=0;_<g.length;_+=1)Array.isArray(g[_])?v.push([h(g[_][0]),g[_][1],g[_][2]]):v.push([h(g[_])]);m=v}else m=h(g);return typeof arguments[0]=="string"?m:(arguments[0].text=m,arguments[0])};t.events.push(["preProcessText",p])}(Rt.API),Rt.API.autoPrint=function(t){var e;return(t=t||{}).variant=t.variant||"non-conform",t.variant==="javascript"?this.addJS("print({});"):(this.internal.events.subscribe("postPutResources",function(){e=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/S /Named"),this.internal.out("/Type /Action"),this.internal.out("/N /Print"),this.internal.out(">>"),this.internal.out("endobj")}),this.internal.events.subscribe("putCatalog",function(){this.internal.out("/OpenAction "+e+" 0 R")})),this},function(t){var e=function(){var n=void 0;Object.defineProperty(this,"pdf",{get:function(){return n},set:function(o){n=o}});var r=150;Object.defineProperty(this,"width",{get:function(){return r},set:function(o){r=isNaN(o)||Number.isInteger(o)===!1||o<0?150:o,this.getContext("2d").pageWrapXEnabled&&(this.getContext("2d").pageWrapX=r+1)}});var i=300;Object.defineProperty(this,"height",{get:function(){return i},set:function(o){i=isNaN(o)||Number.isInteger(o)===!1||o<0?300:o,this.getContext("2d").pageWrapYEnabled&&(this.getContext("2d").pageWrapY=i+1)}});var s=[];Object.defineProperty(this,"childNodes",{get:function(){return s},set:function(o){s=o}});var a={};Object.defineProperty(this,"style",{get:function(){return a},set:function(o){a=o}}),Object.defineProperty(this,"parentNode",{})};e.prototype.getContext=function(n,r){var i;if((n=n||"2d")!=="2d")return null;for(i in r)this.pdf.context2d.hasOwnProperty(i)&&(this.pdf.context2d[i]=r[i]);return this.pdf.context2d._canvas=this,this.pdf.context2d},e.prototype.toDataURL=function(){throw new Error("toDataURL is not implemented.")},t.events.push(["initialized",function(){this.canvas=new e,this.canvas.pdf=this}])}(Rt.API),function(t){var e={left:0,top:0,bottom:0,right:0},n=!1,r=function(){this.internal.__cell__===void 0&&(this.internal.__cell__={},this.internal.__cell__.padding=3,this.internal.__cell__.headerFunction=void 0,this.internal.__cell__.margins=Object.assign({},e),this.internal.__cell__.margins.width=this.getPageWidth(),i.call(this))},i=function(){this.internal.__cell__.lastCell=new s,this.internal.__cell__.pages=1},s=function(){var l=arguments[0];Object.defineProperty(this,"x",{enumerable:!0,get:function(){return l},set:function(m){l=m}});var c=arguments[1];Object.defineProperty(this,"y",{enumerable:!0,get:function(){return c},set:function(m){c=m}});var u=arguments[2];Object.defineProperty(this,"width",{enumerable:!0,get:function(){return u},set:function(m){u=m}});var d=arguments[3];Object.defineProperty(this,"height",{enumerable:!0,get:function(){return d},set:function(m){d=m}});var f=arguments[4];Object.defineProperty(this,"text",{enumerable:!0,get:function(){return f},set:function(m){f=m}});var h=arguments[5];Object.defineProperty(this,"lineNumber",{enumerable:!0,get:function(){return h},set:function(m){h=m}});var p=arguments[6];return Object.defineProperty(this,"align",{enumerable:!0,get:function(){return p},set:function(m){p=m}}),this};s.prototype.clone=function(){return new s(this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align)},s.prototype.toArray=function(){return[this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align]},t.setHeaderFunction=function(l){return r.call(this),this.internal.__cell__.headerFunction=typeof l=="function"?l:void 0,this},t.getTextDimensions=function(l,c){r.call(this);var u=(c=c||{}).fontSize||this.getFontSize(),d=c.font||this.getFont(),f=c.scaleFactor||this.internal.scaleFactor,h=0,p=0,m=0,g=this;if(!Array.isArray(l)&&typeof l!="string"){if(typeof l!="number")throw new Error("getTextDimensions expects text-parameter to be of type String or type Number or an Array of Strings.");l=String(l)}var v=c.maxWidth;v>0?typeof l=="string"?l=this.splitTextToSize(l,v):Object.prototype.toString.call(l)==="[object Array]"&&(l=l.reduce(function(b,x){return b.concat(g.splitTextToSize(x,v))},[])):l=Array.isArray(l)?l:[l];for(var _=0;_<l.length;_++)h<(m=this.getStringUnitWidth(l[_],{font:d})*u)&&(h=m);return h!==0&&(p=l.length),{w:h/=f,h:Math.max((p*u*this.getLineHeightFactor()-u*(this.getLineHeightFactor()-1))/f,0)}},t.cellAddPage=function(){r.call(this),this.addPage();var l=this.internal.__cell__.margins||e;return this.internal.__cell__.lastCell=new s(l.left,l.top,void 0,void 0),this.internal.__cell__.pages+=1,this};var a=t.cell=function(){var l;l=arguments[0]instanceof s?arguments[0]:new s(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5],arguments[6]),r.call(this);var c=this.internal.__cell__.lastCell,u=this.internal.__cell__.padding,d=this.internal.__cell__.margins||e,f=this.internal.__cell__.tableHeaderRow,h=this.internal.__cell__.printHeaders;return c.lineNumber!==void 0&&(c.lineNumber===l.lineNumber?(l.x=(c.x||0)+(c.width||0),l.y=c.y||0):c.y+c.height+l.height+d.bottom>this.getPageHeight()?(this.cellAddPage(),l.y=d.top,h&&f&&(this.printHeaderRow(l.lineNumber,!0),l.y+=f[0].height)):l.y=c.y+c.height||l.y),l.text[0]!==void 0&&(this.rect(l.x,l.y,l.width,l.height,n===!0?"FD":void 0),l.align==="right"?this.text(l.text,l.x+l.width-u,l.y+u,{align:"right",baseline:"top"}):l.align==="center"?this.text(l.text,l.x+l.width/2,l.y+u,{align:"center",baseline:"top",maxWidth:l.width-u-u}):this.text(l.text,l.x+u,l.y+u,{align:"left",baseline:"top",maxWidth:l.width-u-u})),this.internal.__cell__.lastCell=l,this};t.table=function(l,c,u,d,f){if(r.call(this),!u)throw new Error("No data for PDF table.");var h,p,m,g,v=[],_=[],b=[],x={},T={},N=[],A=[],L=(f=f||{}).autoSize||!1,M=f.printHeaders!==!1,B=f.css&&f.css["font-size"]!==void 0?16*f.css["font-size"]:f.fontSize||12,R=f.margins||Object.assign({width:this.getPageWidth()},e),j=typeof f.padding=="number"?f.padding:3,$=f.headerBackgroundColor||"#c8c8c8",U=f.headerTextColor||"#000";if(i.call(this),this.internal.__cell__.printHeaders=M,this.internal.__cell__.margins=R,this.internal.__cell__.table_font_size=B,this.internal.__cell__.padding=j,this.internal.__cell__.headerBackgroundColor=$,this.internal.__cell__.headerTextColor=U,this.setFontSize(B),d==null)_=v=Object.keys(u[0]),b=v.map(function(){return"left"});else if(Array.isArray(d)&&sr(d[0])==="object")for(v=d.map(function(se){return se.name}),_=d.map(function(se){return se.prompt||se.name||""}),b=d.map(function(se){return se.align||"left"}),h=0;h<d.length;h+=1)T[d[h].name]=.7499990551181103*d[h].width;else Array.isArray(d)&&typeof d[0]=="string"&&(_=v=d,b=v.map(function(){return"left"}));if(L||Array.isArray(d)&&typeof d[0]=="string")for(h=0;h<v.length;h+=1){for(x[g=v[h]]=u.map(function(se){return se[g]}),this.setFont(void 0,"bold"),N.push(this.getTextDimensions(_[h],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w),p=x[g],this.setFont(void 0,"normal"),m=0;m<p.length;m+=1)N.push(this.getTextDimensions(p[m],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w);T[g]=Math.max.apply(null,N)+j+j,N=[]}if(M){var te={};for(h=0;h<v.length;h+=1)te[v[h]]={},te[v[h]].text=_[h],te[v[h]].align=b[h];var ne=o.call(this,te,T);A=v.map(function(se){return new s(l,c,T[se],ne,te[se].text,void 0,te[se].align)}),this.setTableHeaderRow(A),this.printHeaderRow(1,!1)}var le=d.reduce(function(se,he){return se[he.name]=he.align,se},{});for(h=0;h<u.length;h+=1){"rowStart"in f&&f.rowStart instanceof Function&&f.rowStart({row:h,data:u[h]},this);var V=o.call(this,u[h],T);for(m=0;m<v.length;m+=1){var q=u[h][v[m]];"cellStart"in f&&f.cellStart instanceof Function&&f.cellStart({row:h,col:m,data:q},this),a.call(this,new s(l,c,T[v[m]],V,q,h+2,le[v[m]]))}}return this.internal.__cell__.table_x=l,this.internal.__cell__.table_y=c,this};var o=function(l,c){var u=this.internal.__cell__.padding,d=this.internal.__cell__.table_font_size,f=this.internal.scaleFactor;return Object.keys(l).map(function(h){var p=l[h];return this.splitTextToSize(p.hasOwnProperty("text")?p.text:p,c[h]-u-u)},this).map(function(h){return this.getLineHeightFactor()*h.length*d/f+u+u},this).reduce(function(h,p){return Math.max(h,p)},0)};t.setTableHeaderRow=function(l){r.call(this),this.internal.__cell__.tableHeaderRow=l},t.printHeaderRow=function(l,c){if(r.call(this),!this.internal.__cell__.tableHeaderRow)throw new Error("Property tableHeaderRow does not exist.");var u;if(n=!0,typeof this.internal.__cell__.headerFunction=="function"){var d=this.internal.__cell__.headerFunction(this,this.internal.__cell__.pages);this.internal.__cell__.lastCell=new s(d[0],d[1],d[2],d[3],void 0,-1)}this.setFont(void 0,"bold");for(var f=[],h=0;h<this.internal.__cell__.tableHeaderRow.length;h+=1){u=this.internal.__cell__.tableHeaderRow[h].clone(),c&&(u.y=this.internal.__cell__.margins.top||0,f.push(u)),u.lineNumber=l;var p=this.getTextColor();this.setTextColor(this.internal.__cell__.headerTextColor),this.setFillColor(this.internal.__cell__.headerBackgroundColor),a.call(this,u),this.setTextColor(p)}f.length>0&&this.setTableHeaderRow(f),this.setFont(void 0,"normal"),n=!1}}(Rt.API);var ZZ={italic:["italic","oblique","normal"],oblique:["oblique","italic","normal"],normal:["normal","oblique","italic"]},eee=["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"],MN=QZ(eee),tee=[100,200,300,400,500,600,700,800,900],zDe=QZ(tee);function IE(t){var e=t.family.replace(/"|'/g,"").toLowerCase(),n=function(s){return ZZ[s=s||"normal"]?s:"normal"}(t.style),r=function(s){return s?typeof s=="number"?s>=100&&s<=900&&s%100==0?s:400:/^\d00$/.test(s)?parseInt(s):s==="bold"?700:400:400}(t.weight),i=function(s){return typeof MN[s=s||"normal"]=="number"?s:"normal"}(t.stretch);return{family:e,style:n,weight:r,stretch:i,src:t.src||[],ref:t.ref||{name:e,style:[i,n,r].join(" ")}}}function KU(t,e,n,r){var i;for(i=n;i>=0&&i<e.length;i+=r)if(t[e[i]])return t[e[i]];for(i=n;i>=0&&i<e.length;i-=r)if(t[e[i]])return t[e[i]]}var $De={"sans-serif":"helvetica",fixed:"courier",monospace:"courier",terminal:"courier",cursive:"times",fantasy:"times",serif:"times"},JU={caption:"times",icon:"times",menu:"times","message-box":"times","small-caption":"times","status-bar":"times"};function YU(t){return[t.stretch,t.style,t.weight,t.family].join(" ")}function XU(t){return t.trimLeft()}function VDe(t,e){for(var n=0;n<t.length;){if(t.charAt(n)===e)return[t.substring(0,n),t.substring(n+1)];n+=1}return null}function qDe(t){var e=t.match(/^(-[a-z_]|[a-z_])[a-z0-9_-]*/i);return e===null?null:[e[0],t.substring(e[0].length)]}var ag,x2,QU,ZU,e7,LE=["times"];function t7(t,e,n,r,i){var s=4,a=r7;switch(i){case Rt.API.image_compression.FAST:s=1,a=n7;break;case Rt.API.image_compression.MEDIUM:s=6,a=i7;break;case Rt.API.image_compression.SLOW:s=9,a=s7}t=function(l,c,u,d){for(var f,h=l.length/c,p=new Uint8Array(l.length+h),m=[WDe,n7,r7,i7,s7],g=0;g<h;g+=1){var v=g*c,_=l.subarray(v,v+c);if(d)p.set(d(_,u,f),v+g);else{for(var b=m.length,x=[],T=0;T<b;T+=1)x[T]=m[T](_,u,f);var N=HDe(x.concat());p.set(x[N],v+g)}f=_}return p}(t,e,Math.ceil(n*r/8),a);var o=vN(t,{level:s});return Rt.API.__addimage__.arrayBufferToBinaryString(o)}function WDe(t){var e=Array.apply([],t);return e.unshift(0),e}function n7(t,e){var n=t.length,r=[];r[0]=1;for(var i=0;i<n;i+=1){var s=t[i-e]||0;r[i+1]=t[i]-s+256&255}return r}function r7(t,e,n){var r=t.length,i=[];i[0]=2;for(var s=0;s<r;s+=1){var a=n&&n[s]||0;i[s+1]=t[s]-a+256&255}return i}function i7(t,e,n){var r=t.length,i=[];i[0]=3;for(var s=0;s<r;s+=1){var a=t[s-e]||0,o=n&&n[s]||0;i[s+1]=t[s]+256-(a+o>>>1)&255}return i}function s7(t,e,n){var r=t.length,i=[];i[0]=4;for(var s=0;s<r;s+=1){var a=GDe(t[s-e]||0,n&&n[s]||0,n&&n[s-e]||0);i[s+1]=t[s]-a+256&255}return i}function GDe(t,e,n){if(t===e&&e===n)return t;var r=Math.abs(e-n),i=Math.abs(t-n),s=Math.abs(t+e-n-n);return r<=i&&r<=s?t:i<=s?e:n}function HDe(t){var e=t.map(function(n){return n.reduce(function(r,i){return r+Math.abs(i)},0)});return e.indexOf(Math.min.apply(null,e))}function OE(t,e,n){var r=e*n,i=Math.floor(r/8),s=16-(r-8*i+n),a=(1<<n)-1;return nee(t,i)>>s&a}function a7(t,e,n,r){var i=n*r,s=Math.floor(i/8),a=16-(i-8*s+r),o=(1<<r)-1,l=(e&o)<<a;(function(c,u,d){if(u+1<c.byteLength)c.setUint16(u,d,!1);else{var f=d>>8&255;c.setUint8(u,f)}})(t,s,nee(t,s)&~(o<<a)&65535|l)}function nee(t,e){return e+1<t.byteLength?t.getUint16(e,!1):t.getUint8(e)<<8}function KDe(t){var e=0;if(t[e++]!==71||t[e++]!==73||t[e++]!==70||t[e++]!==56||(t[e++]+1&253)!=56||t[e++]!==97)throw new Error("Invalid GIF 87a/89a header.");var n=t[e++]|t[e++]<<8,r=t[e++]|t[e++]<<8,i=t[e++],s=i>>7,a=1<<1+(7&i);t[e++],t[e++];var o=null,l=null;s&&(o=e,l=a,e+=3*a);var c=!0,u=[],d=0,f=null,h=0,p=null;for(this.width=n,this.height=r;c&&e<t.length;)switch(t[e++]){case 33:switch(t[e++]){case 255:if(t[e]!==11||t[e+1]==78&&t[e+2]==69&&t[e+3]==84&&t[e+4]==83&&t[e+5]==67&&t[e+6]==65&&t[e+7]==80&&t[e+8]==69&&t[e+9]==50&&t[e+10]==46&&t[e+11]==48&&t[e+12]==3&&t[e+13]==1&&t[e+16]==0)e+=14,p=t[e++]|t[e++]<<8,e++;else for(e+=12;;){if(!((R=t[e++])>=0))throw Error("Invalid block size");if(R===0)break;e+=R}break;case 249:if(t[e++]!==4||t[e+4]!==0)throw new Error("Invalid graphics extension block.");var m=t[e++];d=t[e++]|t[e++]<<8,f=t[e++],1&m||(f=null),h=m>>2&7,e++;break;case 254:for(;;){if(!((R=t[e++])>=0))throw Error("Invalid block size");if(R===0)break;e+=R}break;default:throw new Error("Unknown graphic control label: 0x"+t[e-1].toString(16))}break;case 44:var g=t[e++]|t[e++]<<8,v=t[e++]|t[e++]<<8,_=t[e++]|t[e++]<<8,b=t[e++]|t[e++]<<8,x=t[e++],T=x>>6&1,N=1<<1+(7&x),A=o,L=l,M=!1;x>>7&&(M=!0,A=e,L=N,e+=3*N);var B=e;for(e++;;){var R;if(!((R=t[e++])>=0))throw Error("Invalid block size");if(R===0)break;e+=R}u.push({x:g,y:v,width:_,height:b,has_local_palette:M,palette_offset:A,palette_size:L,data_offset:B,data_length:e-B,transparent_index:f,interlaced:!!T,delay:d,disposal:h});break;case 59:c=!1;break;default:throw new Error("Unknown gif block: 0x"+t[e-1].toString(16))}this.numFrames=function(){return u.length},this.loopCount=function(){return p},this.frameInfo=function(j){if(j<0||j>=u.length)throw new Error("Frame index out of range.");return u[j]},this.decodeAndBlitFrameBGRA=function(j,$){var U=this.frameInfo(j),te=U.width*U.height;if(te>536870912)throw new Error("Image dimensions exceed 512MB, which is too large.");var ne=new Uint8Array(te);o7(t,U.data_offset,ne,te);var le=U.palette_offset,V=U.transparent_index;V===null&&(V=256);var q=U.width,se=n-q,he=q,z=4*(U.y*n+U.x),J=4*((U.y+U.height)*n+U.x),Y=z,de=4*se;U.interlaced===!0&&(de+=4*n*7);for(var fe=8,me=0,Ce=ne.length;me<Ce;++me){var Ee=ne[me];if(he===0&&(he=q,(Y+=de)>=J&&(de=4*se+4*n*(fe-1),Y=z+(q+se)*(fe<<1),fe>>=1)),Ee===V)Y+=4;else{var Ae=t[le+3*Ee],De=t[le+3*Ee+1],Fe=t[le+3*Ee+2];$[Y++]=Fe,$[Y++]=De,$[Y++]=Ae,$[Y++]=255}--he}},this.decodeAndBlitFrameRGBA=function(j,$){var U=this.frameInfo(j),te=U.width*U.height;if(te>536870912)throw new Error("Image dimensions exceed 512MB, which is too large.");var ne=new Uint8Array(te);o7(t,U.data_offset,ne,te);var le=U.palette_offset,V=U.transparent_index;V===null&&(V=256);var q=U.width,se=n-q,he=q,z=4*(U.y*n+U.x),J=4*((U.y+U.height)*n+U.x),Y=z,de=4*se;U.interlaced===!0&&(de+=4*n*7);for(var fe=8,me=0,Ce=ne.length;me<Ce;++me){var Ee=ne[me];if(he===0&&(he=q,(Y+=de)>=J&&(de=4*se+4*n*(fe-1),Y=z+(q+se)*(fe<<1),fe>>=1)),Ee===V)Y+=4;else{var Ae=t[le+3*Ee],De=t[le+3*Ee+1],Fe=t[le+3*Ee+2];$[Y++]=Ae,$[Y++]=De,$[Y++]=Fe,$[Y++]=255}--he}}}function o7(t,e,n,r){for(var i=t[e++],s=1<<i,a=s+1,o=a+1,l=i+1,c=(1<<l)-1,u=0,d=0,f=0,h=t[e++],p=new Int32Array(4096),m=null;;){for(;u<16&&h!==0;)d|=t[e++]<<u,u+=8,h===1?h=t[e++]:--h;if(u<l)break;var g=d&c;if(d>>=l,u-=l,g!==s){if(g===a)break;for(var v=g<o?g:m,_=0,b=v;b>s;)b=p[b]>>8,++_;var x=b;if(f+_+(v!==g?1:0)>r)return void pr.log("Warning, gif stream longer than expected.");n[f++]=x;var T=f+=_;for(v!==g&&(n[f++]=x),b=v;_--;)b=p[b],n[--T]=255&b,b>>=8;m!==null&&o<4096&&(p[o++]=m<<8|x,o>=c+1&&l<12&&(++l,c=c<<1|1)),m=g}else o=a+1,c=(1<<(l=i+1))-1,m=null}return f!==r&&pr.log("Warning, gif stream shorter than expected."),n}/** 654 * @license 655 Copyright (c) 2008, Adobe Systems Incorporated 656 All rights reserved. 657 658 Redistribution and use in source and binary forms, with or without 659 modification, are permitted provided that the following conditions are 660 met: 661 662 * Redistributions of source code must retain the above copyright notice, 663 this list of conditions and the following disclaimer. 664 665 * Redistributions in binary form must reproduce the above copyright 666 notice, this list of conditions and the following disclaimer in the 667 documentation and/or other materials provided with the distribution. 668 669 * Neither the name of Adobe Systems Incorporated nor the names of its 670 contributors may be used to endorse or promote products derived from 671 this software without specific prior written permission. 672 673 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 674 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 675 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 676 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 677 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 678 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 679 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 680 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 681 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 682 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 683 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 684*/function DE(t){var e,n,r,i,s,a=Math.floor,o=new Array(64),l=new Array(64),c=new Array(64),u=new Array(64),d=new Array(65535),f=new Array(65535),h=new Array(64),p=new Array(64),m=[],g=0,v=7,_=new Array(64),b=new Array(64),x=new Array(64),T=new Array(256),N=new Array(2048),A=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],L=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],M=[0,1,2,3,4,5,6,7,8,9,10,11],B=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],R=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],j=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],$=[0,1,2,3,4,5,6,7,8,9,10,11],U=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],te=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function ne(z,J){for(var Y=0,de=0,fe=new Array,me=1;me<=16;me++){for(var Ce=1;Ce<=z[me];Ce++)fe[J[de]]=[],fe[J[de]][0]=Y,fe[J[de]][1]=me,de++,Y++;Y*=2}return fe}function le(z){for(var J=z[0],Y=z[1]-1;Y>=0;)J&1<<Y&&(g|=1<<v),Y--,--v<0&&(g==255?(V(255),V(0)):V(g),v=7,g=0)}function V(z){m.push(z)}function q(z){V(z>>8&255),V(255&z)}function se(z,J,Y,de,fe){for(var me,Ce=fe[0],Ee=fe[240],Ae=function(Ue,St){var ot,Et,mt,An,Kt,At,Jt,ln,nt,Ut,ht=0;for(nt=0;nt<8;++nt){ot=Ue[ht],Et=Ue[ht+1],mt=Ue[ht+2],An=Ue[ht+3],Kt=Ue[ht+4],At=Ue[ht+5],Jt=Ue[ht+6];var wr=ot+(ln=Ue[ht+7]),pn=ot-ln,zt=Et+Jt,Qt=Et-Jt,Pn=mt+At,Nt=mt-At,Zn=An+Kt,It=An-Kt,qt=wr+Zn,lr=wr-Zn,rn=zt+Pn,Tt=zt-Pn;Ue[ht]=qt+rn,Ue[ht+4]=qt-rn;var Mn=.707106781*(Tt+lr);Ue[ht+2]=lr+Mn,Ue[ht+6]=lr-Mn;var Dt=.382683433*((qt=It+Nt)-(Tt=Qt+pn)),Wt=.5411961*qt+Dt,_n=1.306562965*Tt+Dt,Tr=.707106781*(rn=Nt+Qt),ct=pn+Tr,_i=pn-Tr;Ue[ht+5]=_i+Wt,Ue[ht+3]=_i-Wt,Ue[ht+1]=ct+_n,Ue[ht+7]=ct-_n,ht+=8}for(ht=0,nt=0;nt<8;++nt){ot=Ue[ht],Et=Ue[ht+8],mt=Ue[ht+16],An=Ue[ht+24],Kt=Ue[ht+32],At=Ue[ht+40],Jt=Ue[ht+48];var Mi=ot+(ln=Ue[ht+56]),dr=ot-ln,Fr=Et+Jt,Cr=Et-Jt,wi=mt+At,Ni=mt-At,mc=An+Kt,ll=An-Kt,Ma=Mi+mc,eo=Mi-mc,Na=Fr+wi,Ra=Fr-wi;Ue[ht]=Ma+Na,Ue[ht+32]=Ma-Na;var Ia=.707106781*(Ra+eo);Ue[ht+16]=eo+Ia,Ue[ht+48]=eo-Ia;var Xi=.382683433*((Ma=ll+Ni)-(Ra=Cr+dr)),La=.5411961*Ma+Xi,cl=1.306562965*Ra+Xi,to=.707106781*(Na=Ni+Cr),Rs=dr+to,hu=dr-to;Ue[ht+40]=hu+La,Ue[ht+24]=hu-La,Ue[ht+8]=Rs+cl,Ue[ht+56]=Rs-cl,ht++}for(nt=0;nt<64;++nt)Ut=Ue[nt]*St[nt],h[nt]=Ut>0?Ut+.5|0:Ut-.5|0;return h}(z,J),De=0;De<64;++De)p[A[De]]=Ae[De];var Fe=p[0]-Y;Y=p[0],Fe==0?le(de[0]):(le(de[f[me=32767+Fe]]),le(d[me]));for(var Re=63;Re>0&&p[Re]==0;)Re--;if(Re==0)return le(Ce),Y;for(var Je,re=1;re<=Re;){for(var Ye=re;p[re]==0&&re<=Re;)++re;var Mt=re-Ye;if(Mt>=16){Je=Mt>>4;for(var xt=1;xt<=Je;++xt)le(Ee);Mt&=15}me=32767+p[re],le(fe[(Mt<<4)+f[me]]),le(d[me]),re++}return Re!=63&&le(Ce),Y}function he(z){z=Math.min(Math.max(z,1),100),s!=z&&(function(J){for(var Y=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],de=0;de<64;de++){var fe=a((Y[de]*J+50)/100);fe=Math.min(Math.max(fe,1),255),o[A[de]]=fe}for(var me=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],Ce=0;Ce<64;Ce++){var Ee=a((me[Ce]*J+50)/100);Ee=Math.min(Math.max(Ee,1),255),l[A[Ce]]=Ee}for(var Ae=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],De=0,Fe=0;Fe<8;Fe++)for(var Re=0;Re<8;Re++)c[De]=1/(o[A[De]]*Ae[Fe]*Ae[Re]*8),u[De]=1/(l[A[De]]*Ae[Fe]*Ae[Re]*8),De++}(z<50?Math.floor(5e3/z):Math.floor(200-2*z)),s=z)}this.encode=function(z,J){J&&he(J),m=new Array,g=0,v=7,q(65496),q(65504),q(16),V(74),V(70),V(73),V(70),V(0),V(1),V(1),V(0),q(1),q(1),V(0),V(0),function(){q(65499),q(132),V(0);for(var Et=0;Et<64;Et++)V(o[Et]);V(1);for(var mt=0;mt<64;mt++)V(l[mt])}(),function(Et,mt){q(65472),q(17),V(8),q(mt),q(Et),V(3),V(1),V(17),V(0),V(2),V(17),V(1),V(3),V(17),V(1)}(z.width,z.height),function(){q(65476),q(418),V(0);for(var Et=0;Et<16;Et++)V(L[Et+1]);for(var mt=0;mt<=11;mt++)V(M[mt]);V(16);for(var An=0;An<16;An++)V(B[An+1]);for(var Kt=0;Kt<=161;Kt++)V(R[Kt]);V(1);for(var At=0;At<16;At++)V(j[At+1]);for(var Jt=0;Jt<=11;Jt++)V($[Jt]);V(17);for(var ln=0;ln<16;ln++)V(U[ln+1]);for(var nt=0;nt<=161;nt++)V(te[nt])}(),q(65498),q(12),V(3),V(1),V(0),V(2),V(17),V(3),V(17),V(0),V(63),V(0);var Y=0,de=0,fe=0;g=0,v=7,this.encode.displayName="_encode_";for(var me,Ce,Ee,Ae,De,Fe,Re,Je,re,Ye=z.data,Mt=z.width,xt=z.height,Ue=4*Mt,St=0;St<xt;){for(me=0;me<Ue;){for(De=Ue*St+me,Re=-1,Je=0,re=0;re<64;re++)Fe=De+(Je=re>>3)*Ue+(Re=4*(7&re)),St+Je>=xt&&(Fe-=Ue*(St+1+Je-xt)),me+Re>=Ue&&(Fe-=me+Re-Ue+4),Ce=Ye[Fe++],Ee=Ye[Fe++],Ae=Ye[Fe++],_[re]=(N[Ce]+N[Ee+256|0]+N[Ae+512|0]>>16)-128,b[re]=(N[Ce+768|0]+N[Ee+1024|0]+N[Ae+1280|0]>>16)-128,x[re]=(N[Ce+1280|0]+N[Ee+1536|0]+N[Ae+1792|0]>>16)-128;Y=se(_,c,Y,e,r),de=se(b,u,de,n,i),fe=se(x,u,fe,n,i),me+=32}St+=8}if(v>=0){var ot=[];ot[1]=v+1,ot[0]=(1<<v+1)-1,le(ot)}return q(65497),new Uint8Array(m)},t=t||50,function(){for(var z=String.fromCharCode,J=0;J<256;J++)T[J]=z(J)}(),e=ne(L,M),n=ne(j,$),r=ne(B,R),i=ne(U,te),function(){for(var z=1,J=2,Y=1;Y<=15;Y++){for(var de=z;de<J;de++)f[32767+de]=Y,d[32767+de]=[],d[32767+de][1]=Y,d[32767+de][0]=de;for(var fe=-(J-1);fe<=-z;fe++)f[32767+fe]=Y,d[32767+fe]=[],d[32767+fe][1]=Y,d[32767+fe][0]=J-1+fe;z<<=1,J<<=1}}(),function(){for(var z=0;z<256;z++)N[z]=19595*z,N[z+256|0]=38470*z,N[z+512|0]=7471*z+32768,N[z+768|0]=-11059*z,N[z+1024|0]=-21709*z,N[z+1280|0]=32768*z+8421375,N[z+1536|0]=-27439*z,N[z+1792|0]=-5329*z}(),he(t)}/** 685 * @license 686 * Copyright (c) 2017 Aras Abbasi 687 * 688 * Licensed under the MIT License. 689 * http://opensource.org/licenses/mit-license 690 */function Sl(t,e){if(this.pos=0,this.buffer=t,this.datav=new DataView(t.buffer),this.is_with_alpha=!!e,this.bottom_up=!0,this.flag=String.fromCharCode(this.buffer[0])+String.fromCharCode(this.buffer[1]),this.pos+=2,["BM","BA","CI","CP","IC","PT"].indexOf(this.flag)===-1)throw new Error("Invalid BMP File");this.parseHeader(),this.parseBGR()}function l7(t){function e(M){if(!M)throw Error("assert :P")}function n(M,B,R){for(var j=0;4>j;j++)if(M[B+j]!=R.charCodeAt(j))return!0;return!1}function r(M,B,R,j,$){for(var U=0;U<$;U++)M[B+U]=R[j+U]}function i(M,B,R,j){for(var $=0;$<j;$++)M[B+$]=R}function s(M){return new Int32Array(M)}function a(M,B){for(var R=[],j=0;j<M;j++)R.push(new B);return R}function o(M,B){var R=[];return function j($,U,te){for(var ne=te[U],le=0;le<ne&&($.push(te.length>U+1?[]:new B),!(te.length<U+1));le++)j($[le],U+1,te)}(R,0,M),R}var l=function(){var M=this;function B(y,k){for(var P=1<<k-1>>>0;y&P;)P>>>=1;return P?(y&P-1)+P:y}function R(y,k,P,O,G){e(!(O%P));do y[k+(O-=P)]=G;while(0<O)}function j(y,k,P,O,G){if(e(2328>=G),512>=G)var H=s(512);else if((H=s(G))==null)return 0;return function(K,Q,ee,ae,ge,Se){var oe,ve,xe=Q,Ne=1<<ee,ke=s(16),Ie=s(16);for(e(ge!=0),e(ae!=null),e(K!=null),e(0<ee),ve=0;ve<ge;++ve){if(15<ae[ve])return 0;++ke[ae[ve]]}if(ke[0]==ge)return 0;for(Ie[1]=0,oe=1;15>oe;++oe){if(ke[oe]>1<<oe)return 0;Ie[oe+1]=Ie[oe]+ke[oe]}for(ve=0;ve<ge;++ve)oe=ae[ve],0<ae[ve]&&(Se[Ie[oe]++]=ve);if(Ie[15]==1)return(ae=new $).g=0,ae.value=Se[0],R(K,xe,1,Ne,ae),Ne;var Le,Ge=-1,ze=Ne-1,Ct=0,dt=1,sn=1,yt=1<<ee;for(ve=0,oe=1,ge=2;oe<=ee;++oe,ge<<=1){if(dt+=sn<<=1,0>(sn-=ke[oe]))return 0;for(;0<ke[oe];--ke[oe])(ae=new $).g=oe,ae.value=Se[ve++],R(K,xe+Ct,ge,yt,ae),Ct=B(Ct,oe)}for(oe=ee+1,ge=2;15>=oe;++oe,ge<<=1){if(dt+=sn<<=1,0>(sn-=ke[oe]))return 0;for(;0<ke[oe];--ke[oe]){if(ae=new $,(Ct&ze)!=Ge){for(xe+=yt,Le=1<<(Ge=oe)-ee;15>Ge&&!(0>=(Le-=ke[Ge]));)++Ge,Le<<=1;Ne+=yt=1<<(Le=Ge-ee),K[Q+(Ge=Ct&ze)].g=Le+ee,K[Q+Ge].value=xe-Q-Ge}ae.g=oe-ee,ae.value=Se[ve++],R(K,xe+(Ct>>ee),ge,yt,ae),Ct=B(Ct,oe)}}return dt!=2*Ie[15]-1?0:Ne}(y,k,P,O,G,H)}function $(){this.value=this.g=0}function U(){this.value=this.g=0}function te(){this.G=a(5,$),this.H=s(5),this.jc=this.Qb=this.qb=this.nd=0,this.pd=a(Rd,U)}function ne(y,k,P,O){e(y!=null),e(k!=null),e(2147483648>O),y.Ca=254,y.I=0,y.b=-8,y.Ka=0,y.oa=k,y.pa=P,y.Jd=k,y.Yc=P+O,y.Zc=4<=O?P+O-4+1:P,Ce(y)}function le(y,k){for(var P=0;0<k--;)P|=Ae(y,128)<<k;return P}function V(y,k){var P=le(y,k);return Ee(y)?-P:P}function q(y,k,P,O){var G,H=0;for(e(y!=null),e(k!=null),e(4294967288>O),y.Sb=O,y.Ra=0,y.u=0,y.h=0,4<O&&(O=4),G=0;G<O;++G)H+=k[P+G]<<8*G;y.Ra=H,y.bb=O,y.oa=k,y.pa=P}function se(y){for(;8<=y.u&&y.bb<y.Sb;)y.Ra>>>=8,y.Ra+=y.oa[y.pa+y.bb]<<ms-8>>>0,++y.bb,y.u-=8;de(y)&&(y.h=1,y.u=0)}function he(y,k){if(e(0<=k),!y.h&&k<=Id){var P=Y(y)&ku[k];return y.u+=k,se(y),P}return y.h=1,y.u=0}function z(){this.b=this.Ca=this.I=0,this.oa=[],this.pa=0,this.Jd=[],this.Yc=0,this.Zc=[],this.Ka=0}function J(){this.Ra=0,this.oa=[],this.h=this.u=this.bb=this.Sb=this.pa=0}function Y(y){return y.Ra>>>(y.u&ms-1)>>>0}function de(y){return e(y.bb<=y.Sb),y.h||y.bb==y.Sb&&y.u>ms}function fe(y,k){y.u=k,y.h=de(y)}function me(y){y.u>=Ds&&(e(y.u>=Ds),se(y))}function Ce(y){e(y!=null&&y.oa!=null),y.pa<y.Zc?(y.I=(y.oa[y.pa++]|y.I<<8)>>>0,y.b+=8):(e(y!=null&&y.oa!=null),y.pa<y.Yc?(y.b+=8,y.I=y.oa[y.pa++]|y.I<<8):y.Ka?y.b=0:(y.I<<=8,y.b+=8,y.Ka=1))}function Ee(y){return le(y,1)}function Ae(y,k){var P=y.Ca;0>y.b&&Ce(y);var O=y.b,G=P*k>>>8,H=(y.I>>>O>G)+0;for(H?(P-=G,y.I-=G+1<<O>>>0):P=G+1,O=P,G=0;256<=O;)G+=8,O>>=8;return O=7^G+Ld[O],y.b-=O,y.Ca=(P<<O)-1,H}function De(y,k,P){y[k+0]=P>>24&255,y[k+1]=P>>16&255,y[k+2]=P>>8&255,y[k+3]=255&P}function Fe(y,k){return y[k+0]|y[k+1]<<8}function Re(y,k){return Fe(y,k)|y[k+2]<<16}function Je(y,k){return Fe(y,k)|Fe(y,k+2)<<16}function re(y,k){var P=1<<k;return e(y!=null),e(0<k),y.X=s(P),y.X==null?0:(y.Mb=32-k,y.Xa=k,1)}function Ye(y,k){e(y!=null),e(k!=null),e(y.Xa==k.Xa),r(k.X,0,y.X,0,1<<k.Xa)}function Mt(){this.X=[],this.Xa=this.Mb=0}function xt(y,k,P,O){e(P!=null),e(O!=null);var G=P[0],H=O[0];return G==0&&(G=(y*H+k/2)/k),H==0&&(H=(k*G+y/2)/y),0>=G||0>=H?0:(P[0]=G,O[0]=H,1)}function Ue(y,k){return y+(1<<k)-1>>>k}function St(y,k){return((4278255360&y)+(4278255360&k)>>>0&4278255360)+((16711935&y)+(16711935&k)>>>0&16711935)>>>0}function ot(y,k){M[k]=function(P,O,G,H,K,Q,ee){var ae;for(ae=0;ae<K;++ae){var ge=M[y](Q[ee+ae-1],G,H+ae);Q[ee+ae]=St(P[O+ae],ge)}}}function Et(){this.ud=this.hd=this.jd=0}function mt(y,k){return((4278124286&(y^k))>>>1)+(y&k)>>>0}function An(y){return 0<=y&&256>y?y:0>y?0:255<y?255:void 0}function Kt(y,k){return An(y+(y-k+.5>>1))}function At(y,k,P){return Math.abs(k-P)-Math.abs(y-P)}function Jt(y,k,P,O,G,H,K){for(O=H[K-1],P=0;P<G;++P)H[K+P]=O=St(y[k+P],O)}function ln(y,k,P,O,G){var H;for(H=0;H<P;++H){var K=y[k+H],Q=K>>8&255,ee=16711935&(ee=(ee=16711935&K)+((Q<<16)+Q));O[G+H]=(4278255360&K)+ee>>>0}}function nt(y,k){k.jd=255&y,k.hd=y>>8&255,k.ud=y>>16&255}function Ut(y,k,P,O,G,H){var K;for(K=0;K<O;++K){var Q=k[P+K],ee=Q>>>8,ae=Q,ge=255&(ge=(ge=Q>>>16)+((y.jd<<24>>24)*(ee<<24>>24)>>>5));ae=255&(ae=(ae+=(y.hd<<24>>24)*(ee<<24>>24)>>>5)+((y.ud<<24>>24)*(ge<<24>>24)>>>5)),G[H+K]=(4278255360&Q)+(ge<<16)+ae}}function ht(y,k,P,O,G){M[k]=function(H,K,Q,ee,ae,ge,Se,oe,ve){for(ee=Se;ee<oe;++ee)for(Se=0;Se<ve;++Se)ae[ge++]=G(Q[O(H[K++])])},M[y]=function(H,K,Q,ee,ae,ge,Se){var oe=8>>H.b,ve=H.Ea,xe=H.K[0],Ne=H.w;if(8>oe)for(H=(1<<H.b)-1,Ne=(1<<oe)-1;K<Q;++K){var ke,Ie=0;for(ke=0;ke<ve;++ke)ke&H||(Ie=O(ee[ae++])),ge[Se++]=G(xe[Ie&Ne]),Ie>>=oe}else M["VP8LMapColor"+P](ee,ae,xe,Ne,ge,Se,K,Q,ve)}}function wr(y,k,P,O,G){for(P=k+P;k<P;){var H=y[k++];O[G++]=H>>16&255,O[G++]=H>>8&255,O[G++]=255&H}}function pn(y,k,P,O,G){for(P=k+P;k<P;){var H=y[k++];O[G++]=H>>16&255,O[G++]=H>>8&255,O[G++]=255&H,O[G++]=H>>24&255}}function zt(y,k,P,O,G){for(P=k+P;k<P;){var H=(K=y[k++])>>16&240|K>>12&15,K=240&K|K>>28&15;O[G++]=H,O[G++]=K}}function Qt(y,k,P,O,G){for(P=k+P;k<P;){var H=(K=y[k++])>>16&248|K>>13&7,K=K>>5&224|K>>3&31;O[G++]=H,O[G++]=K}}function Pn(y,k,P,O,G){for(P=k+P;k<P;){var H=y[k++];O[G++]=255&H,O[G++]=H>>8&255,O[G++]=H>>16&255}}function Nt(y,k,P,O,G,H){if(H==0)for(P=k+P;k<P;)De(O,((H=y[k++])[0]>>24|H[1]>>8&65280|H[2]<<8&16711680|H[3]<<24)>>>0),G+=32;else r(O,G,y,k,P)}function Zn(y,k){M[k][0]=M[y+"0"],M[k][1]=M[y+"1"],M[k][2]=M[y+"2"],M[k][3]=M[y+"3"],M[k][4]=M[y+"4"],M[k][5]=M[y+"5"],M[k][6]=M[y+"6"],M[k][7]=M[y+"7"],M[k][8]=M[y+"8"],M[k][9]=M[y+"9"],M[k][10]=M[y+"10"],M[k][11]=M[y+"11"],M[k][12]=M[y+"12"],M[k][13]=M[y+"13"],M[k][14]=M[y+"0"],M[k][15]=M[y+"0"]}function It(y){return y==Mm||y==Nf||y==Pu||y==aa}function qt(){this.eb=[],this.size=this.A=this.fb=0}function lr(){this.y=[],this.f=[],this.ea=[],this.F=[],this.Tc=this.Ed=this.Cd=this.Fd=this.lb=this.Db=this.Ab=this.fa=this.J=this.W=this.N=this.O=0}function rn(){this.Rd=this.height=this.width=this.S=0,this.f={},this.f.RGBA=new qt,this.f.kb=new lr,this.sd=null}function Tt(){this.width=[0],this.height=[0],this.Pd=[0],this.Qd=[0],this.format=[0]}function Mn(){this.Id=this.fd=this.Md=this.hb=this.ib=this.da=this.bd=this.cd=this.j=this.v=this.Da=this.Sd=this.ob=0}function Dt(y){return alert("todo:WebPSamplerProcessPlane"),y.T}function Wt(y,k){var P=y.T,O=k.ba.f.RGBA,G=O.eb,H=O.fb+y.ka*O.A,K=la[k.ba.S],Q=y.y,ee=y.O,ae=y.f,ge=y.N,Se=y.ea,oe=y.W,ve=k.cc,xe=k.dc,Ne=k.Mc,ke=k.Nc,Ie=y.ka,Le=y.ka+y.T,Ge=y.U,ze=Ge+1>>1;for(Ie==0?K(Q,ee,null,null,ae,ge,Se,oe,ae,ge,Se,oe,G,H,null,null,Ge):(K(k.ec,k.fc,Q,ee,ve,xe,Ne,ke,ae,ge,Se,oe,G,H-O.A,G,H,Ge),++P);Ie+2<Le;Ie+=2)ve=ae,xe=ge,Ne=Se,ke=oe,ge+=y.Rc,oe+=y.Rc,H+=2*O.A,K(Q,(ee+=2*y.fa)-y.fa,Q,ee,ve,xe,Ne,ke,ae,ge,Se,oe,G,H-O.A,G,H,Ge);return ee+=y.fa,y.j+Le<y.o?(r(k.ec,k.fc,Q,ee,Ge),r(k.cc,k.dc,ae,ge,ze),r(k.Mc,k.Nc,Se,oe,ze),P--):1&Le||K(Q,ee,null,null,ae,ge,Se,oe,ae,ge,Se,oe,G,H+O.A,null,null,Ge),P}function _n(y,k,P){var O=y.F,G=[y.J];if(O!=null){var H=y.U,K=k.ba.S,Q=K==Pm||K==Pu;k=k.ba.f.RGBA;var ee=[0],ae=y.ka;ee[0]=y.T,y.Kb&&(ae==0?--ee[0]:(--ae,G[0]-=y.width),y.j+y.ka+y.T==y.o&&(ee[0]=y.o-y.j-ae));var ge=k.eb;ae=k.fb+ae*k.A,y=j1(O,G[0],y.width,H,ee,ge,ae+(Q?0:3),k.A),e(P==ee),y&&It(K)&&Mf(ge,ae,Q,H,ee,k.A)}return 0}function Tr(y){var k=y.ma,P=k.ba.S,O=11>P,G=P==Em||P==Am||P==Pm||P==W0||P==12||It(P);if(k.memory=null,k.Ib=null,k.Jb=null,k.Nd=null,!si(k.Oa,y,G?11:12))return 0;if(G&&It(P)&&ml(),y.da)alert("todo:use_scaling");else{if(O){if(k.Ib=Dt,y.Kb){if(P=y.U+1>>1,k.memory=s(y.U+2*P),k.memory==null)return 0;k.ec=k.memory,k.fc=0,k.cc=k.ec,k.dc=k.fc+y.U,k.Mc=k.cc,k.Nc=k.dc+P,k.Ib=Wt,ml()}}else alert("todo:EmitYUV");G&&(k.Jb=_n,O&&Ar())}if(O&&!Dm){for(y=0;256>y;++y)nb[y]=89858*(y-128)+If>>Lt,sb[y]=-22014*(y-128)+If,ib[y]=-45773*(y-128),rb[y]=113618*(y-128)+If>>Lt;for(y=Mu;y<Om;++y)k=76283*(y-16)+If>>Lt,ab[y-Mu]=Ro(k,255),ob[y-Mu]=Ro(k+8>>4,15);Dm=1}return 1}function ct(y){var k=y.ma,P=y.U,O=y.T;return e(!(1&y.ka)),0>=P||0>=O?0:(P=k.Ib(y,k),k.Jb!=null&&k.Jb(y,k,P),k.Dc+=P,1)}function _i(y){y.ma.memory=null}function Mi(y,k,P,O){return he(y,8)!=47?0:(k[0]=he(y,14)+1,P[0]=he(y,14)+1,O[0]=he(y,1),he(y,3)!=0?0:!y.h)}function dr(y,k){if(4>y)return y+1;var P=y-2>>1;return(2+(1&y)<<P)+he(k,P)+1}function Fr(y,k){return 120<k?k-120:1<=(P=((P=J1[k-1])>>4)*y+(8-(15&P)))?P:1;var P}function Cr(y,k,P){var O=Y(P),G=y[k+=255&O].g-8;return 0<G&&(fe(P,P.u+8),O=Y(P),k+=y[k].value,k+=O&(1<<G)-1),fe(P,P.u+y[k].g),y[k].value}function wi(y,k,P){return P.g+=y.g,P.value+=y.value<<k>>>0,e(8>=P.g),y.g}function Ni(y,k,P){var O=y.xc;return e((k=O==0?0:y.vc[y.md*(P>>O)+(k>>O)])<y.Wb),y.Ya[k]}function mc(y,k,P,O){var G=y.ab,H=y.c*k,K=y.C;k=K+k;var Q=P,ee=O;for(O=y.Ta,P=y.Ua;0<G--;){var ae=y.gc[G],ge=K,Se=k,oe=Q,ve=ee,xe=(ee=O,Q=P,ae.Ea);switch(e(ge<Se),e(Se<=ae.nc),ae.hc){case 2:Od(oe,ve,(Se-ge)*xe,ee,Q);break;case 0:var Ne=ge,ke=Se,Ie=ee,Le=Q,Ge=(yt=ae).Ea;Ne==0&&(kc(oe,ve,null,null,1,Ie,Le),Jt(oe,ve+1,0,0,Ge-1,Ie,Le+1),ve+=Ge,Le+=Ge,++Ne);for(var ze=1<<yt.b,Ct=ze-1,dt=Ue(Ge,yt.b),sn=yt.K,yt=yt.w+(Ne>>yt.b)*dt;Ne<ke;){var yn=sn,li=yt,jt=1;for(Sc(oe,ve,Ie,Le-Ge,1,Ie,Le);jt<Ge;){var kt=(jt&~Ct)+ze;kt>Ge&&(kt=Ge),(0,io[yn[li++]>>8&15])(oe,ve+ +jt,Ie,Le+jt-Ge,kt-jt,Ie,Le+jt),jt=kt}ve+=Ge,Le+=Ge,++Ne&Ct||(yt+=dt)}Se!=ae.nc&&r(ee,Q-xe,ee,Q+(Se-ge-1)*xe,xe);break;case 1:for(xe=oe,ke=ve,Ge=(oe=ae.Ea)-(Le=oe&~(Ie=(ve=1<<ae.b)-1)),Ne=Ue(oe,ae.b),ze=ae.K,ae=ae.w+(ge>>ae.b)*Ne;ge<Se;){for(Ct=ze,dt=ae,sn=new Et,yt=ke+Le,yn=ke+oe;ke<yt;)nt(Ct[dt++],sn),Tu(sn,xe,ke,ve,ee,Q),ke+=ve,Q+=ve;ke<yn&&(nt(Ct[dt++],sn),Tu(sn,xe,ke,Ge,ee,Q),ke+=Ge,Q+=Ge),++ge&Ie||(ae+=Ne)}break;case 3:if(oe==ee&&ve==Q&&0<ae.b){for(ke=ee,oe=xe=Q+(Se-ge)*xe-(Le=(Se-ge)*Ue(ae.Ea,ae.b)),ve=ee,Ie=Q,Ne=[],Le=(Ge=Le)-1;0<=Le;--Le)Ne[Le]=ve[Ie+Le];for(Le=Ge-1;0<=Le;--Le)ke[oe+Le]=Ne[Le];Su(ae,ge,Se,ee,xe,ee,Q)}else Su(ae,ge,Se,oe,ve,ee,Q)}Q=O,ee=P}ee!=P&&r(O,P,Q,ee,H)}function ll(y,k){var P=y.V,O=y.Ba+y.c*y.C,G=k-y.C;if(e(k<=y.l.o),e(16>=G),0<G){var H=y.l,K=y.Ta,Q=y.Ua,ee=H.width;if(mc(y,G,P,O),G=Q=[Q],e((P=y.C)<(O=k)),e(H.v<H.va),O>H.o&&(O=H.o),P<H.j){var ae=H.j-P;P=H.j,G[0]+=ae*ee}if(P>=O?P=0:(G[0]+=4*H.v,H.ka=P-H.j,H.U=H.va-H.v,H.T=O-P,P=1),P){if(Q=Q[0],11>(P=y.ca).S){var ge=P.f.RGBA,Se=(O=P.S,G=H.U,H=H.T,ae=ge.eb,ge.A),oe=H;for(ge=ge.fb+y.Ma*ge.A;0<oe--;){var ve=K,xe=Q,Ne=G,ke=ae,Ie=ge;switch(O){case Cm:Ef(ve,xe,Ne,ke,Ie);break;case Em:Af(ve,xe,Ne,ke,Ie);break;case Mm:Af(ve,xe,Ne,ke,Ie),Mf(ke,Ie,0,Ne,1,0);break;case W1:Eu(ve,xe,Ne,ke,Ie);break;case Am:Nt(ve,xe,Ne,ke,Ie,1);break;case Nf:Nt(ve,xe,Ne,ke,Ie,1),Mf(ke,Ie,0,Ne,1,0);break;case Pm:Nt(ve,xe,Ne,ke,Ie,0);break;case Pu:Nt(ve,xe,Ne,ke,Ie,0),Mf(ke,Ie,1,Ne,1,0);break;case W0:Dd(ve,xe,Ne,ke,Ie);break;case aa:Dd(ve,xe,Ne,ke,Ie),F1(ke,Ie,Ne,1,0);break;case G0:Cu(ve,xe,Ne,ke,Ie);break;default:e(0)}Q+=ee,ge+=Se}y.Ma+=H}else alert("todo:EmitRescaledRowsYUVA");e(y.Ma<=P.height)}}y.C=k,e(y.C<=y.i)}function Ma(y){var k;if(0<y.ua)return 0;for(k=0;k<y.Wb;++k){var P=y.Ya[k].G,O=y.Ya[k].H;if(0<P[1][O[1]+0].g||0<P[2][O[2]+0].g||0<P[3][O[3]+0].g)return 0}return 1}function eo(y,k,P,O,G,H){if(y.Z!=0){var K=y.qd,Q=y.rd;for(e(Bo[y.Z]!=null);k<P;++k)Bo[y.Z](K,Q,O,G,O,G,H),K=O,Q=G,G+=H;y.qd=K,y.rd=Q}}function Na(y,k){var P=y.l.ma,O=P.Z==0||P.Z==1?y.l.j:y.C;if(O=y.C<O?O:y.C,e(k<=y.l.o),k>O){var G=y.l.width,H=P.ca,K=P.tb+G*O,Q=y.V,ee=y.Ba+y.c*O,ae=y.gc;e(y.ab==1),e(ae[0].hc==3),V0(ae[0],O,k,Q,ee,H,K),eo(P,O,k,H,K,G)}y.C=y.Ma=k}function Ra(y,k,P,O,G,H,K){var Q=y.$/O,ee=y.$%O,ae=y.m,ge=y.s,Se=P+y.$,oe=Se;G=P+O*G;var ve=P+O*H,xe=280+ge.ua,Ne=y.Pb?Q:16777216,ke=0<ge.ua?ge.Wa:null,Ie=ge.wc,Le=Se<ve?Ni(ge,ee,Q):null;e(y.C<H),e(ve<=G);var Ge=!1;e:for(;;){for(;Ge||Se<ve;){var ze=0;if(Q>=Ne){var Ct=Se-P;e((Ne=y).Pb),Ne.wd=Ne.m,Ne.xd=Ct,0<Ne.s.ua&&Ye(Ne.s.Wa,Ne.s.vb),Ne=Q+X1}if(ee&Ie||(Le=Ni(ge,ee,Q)),e(Le!=null),Le.Qb&&(k[Se]=Le.qb,Ge=!0),!Ge)if(me(ae),Le.jc){ze=ae,Ct=k;var dt=Se,sn=Le.pd[Y(ze)&Rd-1];e(Le.jc),256>sn.g?(fe(ze,ze.u+sn.g),Ct[dt]=sn.value,ze=0):(fe(ze,ze.u+sn.g-256),e(256<=sn.value),ze=sn.value),ze==0&&(Ge=!0)}else ze=Cr(Le.G[0],Le.H[0],ae);if(ae.h)break;if(Ge||256>ze){if(!Ge)if(Le.nd)k[Se]=(Le.qb|ze<<8)>>>0;else{if(me(ae),Ge=Cr(Le.G[1],Le.H[1],ae),me(ae),Ct=Cr(Le.G[2],Le.H[2],ae),dt=Cr(Le.G[3],Le.H[3],ae),ae.h)break;k[Se]=(dt<<24|Ge<<16|ze<<8|Ct)>>>0}if(Ge=!1,++Se,++ee>=O&&(ee=0,++Q,K!=null&&Q<=H&&!(Q%16)&&K(y,Q),ke!=null))for(;oe<Se;)ze=k[oe++],ke.X[(506832829*ze&4294967295)>>>ke.Mb]=ze}else if(280>ze){if(ze=dr(ze-256,ae),Ct=Cr(Le.G[4],Le.H[4],ae),me(ae),Ct=Fr(O,Ct=dr(Ct,ae)),ae.h)break;if(Se-P<Ct||G-Se<ze)break e;for(dt=0;dt<ze;++dt)k[Se+dt]=k[Se+dt-Ct];for(Se+=ze,ee+=ze;ee>=O;)ee-=O,++Q,K!=null&&Q<=H&&!(Q%16)&&K(y,Q);if(e(Se<=G),ee&Ie&&(Le=Ni(ge,ee,Q)),ke!=null)for(;oe<Se;)ze=k[oe++],ke.X[(506832829*ze&4294967295)>>>ke.Mb]=ze}else{if(!(ze<xe))break e;for(Ge=ze-280,e(ke!=null);oe<Se;)ze=k[oe++],ke.X[(506832829*ze&4294967295)>>>ke.Mb]=ze;ze=Se,e(!(Ge>>>(Ct=ke).Xa)),k[ze]=Ct.X[Ge],Ge=!0}Ge||e(ae.h==de(ae))}if(y.Pb&&ae.h&&Se<G)e(y.m.h),y.a=5,y.m=y.wd,y.$=y.xd,0<y.s.ua&&Ye(y.s.vb,y.s.Wa);else{if(ae.h)break e;K!=null&&K(y,Q>H?H:Q),y.a=0,y.$=Se-P}return 1}return y.a=3,0}function Ia(y){e(y!=null),y.vc=null,y.yc=null,y.Ya=null;var k=y.Wa;k!=null&&(k.X=null),y.vb=null,e(y!=null)}function Xi(){var y=new ut;return y==null?null:(y.a=0,y.xb=Q0,Zn("Predictor","VP8LPredictors"),Zn("Predictor","VP8LPredictors_C"),Zn("PredictorAdd","VP8LPredictorsAdd"),Zn("PredictorAdd","VP8LPredictorsAdd_C"),Od=ln,Tu=Ut,Ef=wr,Af=pn,Dd=zt,Cu=Qt,Eu=Pn,M.VP8LMapColor32b=ai,M.VP8LMapColor8b=Do,y)}function La(y,k,P,O,G){var H=1,K=[y],Q=[k],ee=O.m,ae=O.s,ge=null,Se=0;e:for(;;){if(P)for(;H&&he(ee,1);){var oe=K,ve=Q,xe=O,Ne=1,ke=xe.m,Ie=xe.gc[xe.ab],Le=he(ke,2);if(xe.Oc&1<<Le)H=0;else{switch(xe.Oc|=1<<Le,Ie.hc=Le,Ie.Ea=oe[0],Ie.nc=ve[0],Ie.K=[null],++xe.ab,e(4>=xe.ab),Le){case 0:case 1:Ie.b=he(ke,3)+2,Ne=La(Ue(Ie.Ea,Ie.b),Ue(Ie.nc,Ie.b),0,xe,Ie.K),Ie.K=Ie.K[0];break;case 3:var Ge,ze=he(ke,8)+1,Ct=16<ze?0:4<ze?1:2<ze?2:3;if(oe[0]=Ue(Ie.Ea,Ct),Ie.b=Ct,Ge=Ne=La(ze,1,0,xe,Ie.K)){var dt,sn=ze,yt=Ie,yn=1<<(8>>yt.b),li=s(yn);if(li==null)Ge=0;else{var jt=yt.K[0],kt=yt.w;for(li[0]=yt.K[0][0],dt=1;dt<1*sn;++dt)li[dt]=St(jt[kt+dt],li[dt-1]);for(;dt<4*yn;++dt)li[dt]=0;yt.K[0]=null,yt.K[0]=li,Ge=1}}Ne=Ge;break;case 2:break;default:e(0)}H=Ne}}if(K=K[0],Q=Q[0],H&&he(ee,1)&&!(H=1<=(Se=he(ee,4))&&11>=Se)){O.a=3;break e}var et;if(et=H)t:{var Kr,nn,Cn,fr=O,zi=K,gs=Q,jr=Se,ts=P,vs=fr.m,bi=fr.s,Nn=[null],qn=1,Br=0,Wn=Y1[jr];n:for(;;){if(ts&&he(vs,1)){var $i=he(vs,3)+2,oo=Ue(zi,$i),Jr=Ue(gs,$i),Fs=oo*Jr;if(!La(oo,Jr,0,fr,Nn))break n;for(Nn=Nn[0],bi.xc=$i,Kr=0;Kr<Fs;++Kr){var rr=Nn[Kr]>>8&65535;Nn[Kr]=rr,rr>=qn&&(qn=rr+1)}}if(vs.h)break n;for(nn=0;5>nn;++nn){var xi=H0[nn];!nn&&0<jr&&(xi+=1<<jr),Br<xi&&(Br=xi)}var ca=a(qn*Wn,$),ys=qn,ua=a(ys,te);if(ua==null)var da=null;else e(65536>=ys),da=ua;var js=s(Br);if(da==null||js==null||ca==null){fr.a=1;break n}var ha=ca;for(Kr=Cn=0;Kr<qn;++Kr){var cr=da[Kr],fa=cr.G,lo=cr.H,Nu=0,wl=1,Vi=0;for(nn=0;5>nn;++nn){xi=H0[nn],fa[nn]=ha,lo[nn]=Cn,!nn&&0<jr&&(xi+=1<<jr);i:{var Fm,iy=xi,jm=fr,Of=js,Bm=ha,ub=Cn,Um=0,S=jm.m,E=he(S,1);if(i(Of,0,0,iy),E){var D=he(S,1)+1,F=he(S,1),Z=he(S,F==0?1:8);Of[Z]=1,D==2&&(Of[Z=he(S,8)]=1);var ue=1}else{var we=s(19),Te=he(S,4)+4;if(19<Te){jm.a=3;var qe=0;break i}for(Fm=0;Fm<Te;++Fm)we[K1[Fm]]=he(S,3);var rt=void 0,un=void 0,at=jm,hn=we,jn=iy,ki=Of,Ru=0,Uo=at.m,zm=8,eD=a(128,$);r:for(;j(eD,0,7,hn,19);){if(he(Uo,1)){var Wne=2+2*he(Uo,3);if((rt=2+he(Uo,Wne))>jn)break r}else rt=jn;for(un=0;un<jn&&rt--;){me(Uo);var tD=eD[0+(127&Y(Uo))];fe(Uo,Uo.u+tD.g);var $m=tD.value;if(16>$m)ki[un++]=$m,$m!=0&&(zm=$m);else{var Gne=$m==16,nD=$m-16,Hne=G1[nD],rD=he(Uo,jd[nD])+Hne;if(un+rD>jn)break r;for(var Kne=Gne?zm:0;0<rD--;)ki[un++]=Kne}}Ru=1;break r}Ru||(at.a=3),ue=Ru}(ue=ue&&!S.h)&&(Um=j(Bm,ub,8,Of,iy)),ue&&Um!=0?qe=Um:(jm.a=3,qe=0)}if(qe==0)break n;if(wl&&H1[nn]==1&&(wl=ha[Cn].g==0),Nu+=ha[Cn].g,Cn+=qe,3>=nn){var sy,vC=js[0];for(sy=1;sy<xi;++sy)js[sy]>vC&&(vC=js[sy]);Vi+=vC}}if(cr.nd=wl,cr.Qb=0,wl&&(cr.qb=(fa[3][lo[3]+0].value<<24|fa[1][lo[1]+0].value<<16|fa[2][lo[2]+0].value)>>>0,Nu==0&&256>fa[0][lo[0]+0].value&&(cr.Qb=1,cr.qb+=fa[0][lo[0]+0].value<<8)),cr.jc=!cr.Qb&&6>Vi,cr.jc){var db,Iu=cr;for(db=0;db<Rd;++db){var zd=db,$d=Iu.pd[zd],hb=Iu.G[0][Iu.H[0]+zd];256<=hb.value?($d.g=hb.g+256,$d.value=hb.value):($d.g=0,$d.value=0,zd>>=wi(hb,8,$d),zd>>=wi(Iu.G[1][Iu.H[1]+zd],16,$d),zd>>=wi(Iu.G[2][Iu.H[2]+zd],0,$d),wi(Iu.G[3][Iu.H[3]+zd],24,$d))}}}bi.vc=Nn,bi.Wb=qn,bi.Ya=da,bi.yc=ca,et=1;break t}et=0}if(!(H=et)){O.a=3;break e}if(0<Se){if(ae.ua=1<<Se,!re(ae.Wa,Se)){O.a=1,H=0;break e}}else ae.ua=0;var yC=O,iD=K,Jne=Q,_C=yC.s,wC=_C.xc;if(yC.c=iD,yC.i=Jne,_C.md=Ue(iD,wC),_C.wc=wC==0?-1:(1<<wC)-1,P){O.xb=Z1;break e}if((ge=s(K*Q))==null){O.a=1,H=0;break e}H=(H=Ra(O,ge,0,K,Q,Q,null))&&!ee.h;break e}return H?(G!=null?G[0]=ge:(e(ge==null),e(P)),O.$=0,P||Ia(ae)):Ia(ae),H}function cl(y,k){var P=y.c*y.i,O=P+k+16*k;return e(y.c<=k),y.V=s(O),y.V==null?(y.Ta=null,y.Ua=0,y.a=1,0):(y.Ta=y.V,y.Ua=y.Ba+P+k,1)}function to(y,k){var P=y.C,O=k-P,G=y.V,H=y.Ba+y.c*P;for(e(k<=y.l.o);0<O;){var K=16<O?16:O,Q=y.l.ma,ee=y.l.width,ae=ee*K,ge=Q.ca,Se=Q.tb+ee*P,oe=y.Ta,ve=y.Ua;mc(y,K,G,H),B1(oe,ve,ge,Se,ae),eo(Q,P,P+K,ge,Se,ee),O-=K,G+=K*y.c,P+=K}e(P==k),y.C=y.Ma=k}function Rs(){this.ub=this.yd=this.td=this.Rb=0}function hu(){this.Kd=this.Ld=this.Ud=this.Td=this.i=this.c=0}function R0(){this.Fb=this.Bb=this.Cb=0,this.Zb=s(4),this.Lb=s(4)}function gf(){this.Yb=function(){var y=[];return function k(P,O,G){for(var H=G[O],K=0;K<H&&(P.push(G.length>O+1?[]:0),!(G.length<O+1));K++)k(P[K],O+1,G)}(y,0,[3,11]),y}()}function vf(){this.jb=s(3),this.Wc=o([4,8],gf),this.Xc=o([4,17],gf)}function No(){this.Pc=this.wb=this.Tb=this.zd=0,this.vd=new s(4),this.od=new s(4)}function Is(){this.ld=this.La=this.dd=this.tc=0}function Qi(){this.Na=this.la=0}function Ls(){this.Sc=[0,0],this.Eb=[0,0],this.Qc=[0,0],this.ia=this.lc=0}function fu(){this.ad=s(384),this.Za=0,this.Ob=s(16),this.$b=this.Ad=this.ia=this.Gc=this.Hc=this.Dd=0}function lm(){this.uc=this.M=this.Nb=0,this.wa=Array(new Is),this.Y=0,this.ya=Array(new fu),this.aa=0,this.l=new Td}function cm(){this.y=s(16),this.f=s(8),this.ea=s(8)}function um(){this.cb=this.a=0,this.sc="",this.m=new z,this.Od=new Rs,this.Kc=new hu,this.ed=new No,this.Qa=new R0,this.Ic=this.$c=this.Aa=0,this.D=new lm,this.Xb=this.Va=this.Hb=this.zb=this.yb=this.Ub=this.za=0,this.Jc=a(8,z),this.ia=0,this.pb=a(4,Ls),this.Pa=new vf,this.Bd=this.kc=0,this.Ac=[],this.Bc=0,this.zc=[0,0,0,0],this.Gd=Array(new cm),this.Hd=0,this.rb=Array(new Qi),this.sb=0,this.wa=Array(new Is),this.Y=0,this.oc=[],this.pc=0,this.sa=[],this.ta=0,this.qa=[],this.ra=0,this.Ha=[],this.B=this.R=this.Ia=0,this.Ec=[],this.M=this.ja=this.Vb=this.Fc=0,this.ya=Array(new fu),this.L=this.aa=0,this.gd=o([4,2],Is),this.ga=null,this.Fa=[],this.Cc=this.qc=this.P=0,this.Gb=[],this.Uc=0,this.mb=[],this.nb=0,this.rc=[],this.Ga=this.Vc=0}function Ro(y,k){return 0>y?0:y>k?k:y}function Td(){this.T=this.U=this.ka=this.height=this.width=0,this.y=[],this.f=[],this.ea=[],this.Rc=this.fa=this.W=this.N=this.O=0,this.ma="void",this.put="VP8IoPutHook",this.ac="VP8IoSetupHook",this.bc="VP8IoTeardownHook",this.ha=this.Kb=0,this.data=[],this.hb=this.ib=this.da=this.o=this.j=this.va=this.v=this.Da=this.ob=this.w=0,this.F=[],this.J=0}function I0(){var y=new um;return y!=null&&(y.a=0,y.sc="OK",y.cb=0,y.Xb=0,Bd||(Bd=pu)),y}function er(y,k,P){return y.a==0&&(y.a=k,y.sc=P,y.cb=0),0}function Oa(y,k,P){return 3<=P&&y[k+0]==157&&y[k+1]==1&&y[k+2]==42}function Io(y,k){if(y==null)return 0;if(y.a=0,y.sc="OK",k==null)return er(y,2,"null VP8Io passed to VP8GetHeaders()");var P=k.data,O=k.w,G=k.ha;if(4>G)return er(y,7,"Truncated header.");var H=P[O+0]|P[O+1]<<8|P[O+2]<<16,K=y.Od;if(K.Rb=!(1&H),K.td=H>>1&7,K.yd=H>>4&1,K.ub=H>>5,3<K.td)return er(y,3,"Incorrect keyframe parameters.");if(!K.yd)return er(y,4,"Frame not displayable.");O+=3,G-=3;var Q=y.Kc;if(K.Rb){if(7>G)return er(y,7,"cannot parse picture header");if(!Oa(P,O,G))return er(y,3,"Bad code word");Q.c=16383&(P[O+4]<<8|P[O+3]),Q.Td=P[O+4]>>6,Q.i=16383&(P[O+6]<<8|P[O+5]),Q.Ud=P[O+6]>>6,O+=7,G-=7,y.za=Q.c+15>>4,y.Ub=Q.i+15>>4,k.width=Q.c,k.height=Q.i,k.Da=0,k.j=0,k.v=0,k.va=k.width,k.o=k.height,k.da=0,k.ib=k.width,k.hb=k.height,k.U=k.width,k.T=k.height,i((H=y.Pa).jb,0,255,H.jb.length),e((H=y.Qa)!=null),H.Cb=0,H.Bb=0,H.Fb=1,i(H.Zb,0,0,H.Zb.length),i(H.Lb,0,0,H.Lb)}if(K.ub>G)return er(y,7,"bad partition length");ne(H=y.m,P,O,K.ub),O+=K.ub,G-=K.ub,K.Rb&&(Q.Ld=Ee(H),Q.Kd=Ee(H)),Q=y.Qa;var ee,ae=y.Pa;if(e(H!=null),e(Q!=null),Q.Cb=Ee(H),Q.Cb){if(Q.Bb=Ee(H),Ee(H)){for(Q.Fb=Ee(H),ee=0;4>ee;++ee)Q.Zb[ee]=Ee(H)?V(H,7):0;for(ee=0;4>ee;++ee)Q.Lb[ee]=Ee(H)?V(H,6):0}if(Q.Bb)for(ee=0;3>ee;++ee)ae.jb[ee]=Ee(H)?le(H,8):255}else Q.Bb=0;if(H.Ka)return er(y,3,"cannot parse segment header");if((Q=y.ed).zd=Ee(H),Q.Tb=le(H,6),Q.wb=le(H,3),Q.Pc=Ee(H),Q.Pc&&Ee(H)){for(ae=0;4>ae;++ae)Ee(H)&&(Q.vd[ae]=V(H,6));for(ae=0;4>ae;++ae)Ee(H)&&(Q.od[ae]=V(H,6))}if(y.L=Q.Tb==0?0:Q.zd?1:2,H.Ka)return er(y,3,"cannot parse filter header");var ge=G;if(G=ee=O,O=ee+ge,Q=ge,y.Xb=(1<<le(y.m,2))-1,ge<3*(ae=y.Xb))P=7;else{for(ee+=3*ae,Q-=3*ae,ge=0;ge<ae;++ge){var Se=P[G+0]|P[G+1]<<8|P[G+2]<<16;Se>Q&&(Se=Q),ne(y.Jc[+ge],P,ee,Se),ee+=Se,Q-=Se,G+=3}ne(y.Jc[+ae],P,ee,Q),P=ee<O?0:5}if(P!=0)return er(y,P,"cannot parse partitions");for(P=le(ee=y.m,7),G=Ee(ee)?V(ee,4):0,O=Ee(ee)?V(ee,4):0,Q=Ee(ee)?V(ee,4):0,ae=Ee(ee)?V(ee,4):0,ee=Ee(ee)?V(ee,4):0,ge=y.Qa,Se=0;4>Se;++Se){if(ge.Cb){var oe=ge.Zb[Se];ge.Fb||(oe+=P)}else{if(0<Se){y.pb[Se]=y.pb[0];continue}oe=P}var ve=y.pb[Se];ve.Sc[0]=Nm[Ro(oe+G,127)],ve.Sc[1]=Rm[Ro(oe+0,127)],ve.Eb[0]=2*Nm[Ro(oe+O,127)],ve.Eb[1]=101581*Rm[Ro(oe+Q,127)]>>16,8>ve.Eb[1]&&(ve.Eb[1]=8),ve.Qc[0]=Nm[Ro(oe+ae,117)],ve.Qc[1]=Rm[Ro(oe+ee,127)],ve.lc=oe+ee}if(!K.Rb)return er(y,4,"Not a key frame.");for(Ee(H),K=y.Pa,P=0;4>P;++P){for(G=0;8>G;++G)for(O=0;3>O;++O)for(Q=0;11>Q;++Q)ae=Ae(H,Rf[P][G][O][Q])?le(H,8):J0[P][G][O][Q],K.Wc[P][G].Yb[O][Q]=ae;for(G=0;17>G;++G)K.Xc[P][G]=K.Wc[P][X0[G]]}return y.kc=Ee(H),y.kc&&(y.Bd=le(H,8)),y.cb=1}function pu(y,k,P,O,G,H,K){var Q=k[G].Yb[P];for(P=0;16>G;++G){if(!Ae(y,Q[P+0]))return G;for(;!Ae(y,Q[P+1]);)if(Q=k[++G].Yb[0],P=0,G==16)return 16;var ee=k[G+1].Yb;if(Ae(y,Q[P+2])){var ae=y,ge=0;if(Ae(ae,(oe=Q)[(Se=P)+3]))if(Ae(ae,oe[Se+6])){for(Q=0,Se=2*(ge=Ae(ae,oe[Se+8]))+(oe=Ae(ae,oe[Se+9+ge])),ge=0,oe=Q1[Se];oe[Q];++Q)ge+=ge+Ae(ae,oe[Q]);ge+=3+(8<<Se)}else Ae(ae,oe[Se+7])?(ge=7+2*Ae(ae,165),ge+=Ae(ae,145)):ge=5+Ae(ae,159);else ge=Ae(ae,oe[Se+4])?3+Ae(ae,oe[Se+5]):2;Q=ee[2]}else ge=1,Q=ee[1];ee=K+K0[G],0>(ae=y).b&&Ce(ae);var Se,oe=ae.b,ve=(Se=ae.Ca>>1)-(ae.I>>oe)>>31;--ae.b,ae.Ca+=ve,ae.Ca|=1,ae.I-=(Se+1&ve)<<oe,H[ee]=((ge^ve)-ve)*O[(0<G)+0]}return 16}function yf(y){var k=y.rb[y.sb-1];k.la=0,k.Na=0,i(y.zc,0,0,y.zc.length),y.ja=0}function ia(y,k,P,O,G){G=y[k+P+32*O]+(G>>3),y[k+P+32*O]=-256&G?0>G?0:255:G}function Cd(y,k,P,O,G,H){ia(y,k,0,P,O+G),ia(y,k,1,P,O+H),ia(y,k,2,P,O-H),ia(y,k,3,P,O-G)}function ul(y){return(20091*y>>16)+y}function Bi(y,k,P,O){var G,H=0,K=s(16);for(G=0;4>G;++G){var Q=y[k+0]+y[k+8],ee=y[k+0]-y[k+8],ae=(35468*y[k+4]>>16)-ul(y[k+12]),ge=ul(y[k+4])+(35468*y[k+12]>>16);K[H+0]=Q+ge,K[H+1]=ee+ae,K[H+2]=ee-ae,K[H+3]=Q-ge,H+=4,k++}for(G=H=0;4>G;++G)Q=(y=K[H+0]+4)+K[H+8],ee=y-K[H+8],ae=(35468*K[H+4]>>16)-ul(K[H+12]),ia(P,O,0,0,Q+(ge=ul(K[H+4])+(35468*K[H+12]>>16))),ia(P,O,1,0,ee+ae),ia(P,O,2,0,ee-ae),ia(P,O,3,0,Q-ge),H++,O+=32}function dm(y,k,P,O){var G=y[k+0]+4,H=35468*y[k+4]>>16,K=ul(y[k+4]),Q=35468*y[k+1]>>16;Cd(P,O,0,G+K,y=ul(y[k+1]),Q),Cd(P,O,1,G+H,y,Q),Cd(P,O,2,G-H,y,Q),Cd(P,O,3,G-K,y,Q)}function L0(y,k,P,O,G){Bi(y,k,P,O),G&&Bi(y,k+16,P,O+4)}function O0(y,k,P,O){so(y,k+0,P,O,1),so(y,k+32,P,O+128,1)}function D0(y,k,P,O){var G;for(y=y[k+0]+4,G=0;4>G;++G)for(k=0;4>k;++k)ia(P,O,k,G,y)}function br(y,k,P,O){y[k+0]&&Ui(y,k+0,P,O),y[k+16]&&Ui(y,k+16,P,O+4),y[k+32]&&Ui(y,k+32,P,O+128),y[k+48]&&Ui(y,k+48,P,O+128+4)}function hm(y,k,P,O){var G,H=s(16);for(G=0;4>G;++G){var K=y[k+0+G]+y[k+12+G],Q=y[k+4+G]+y[k+8+G],ee=y[k+4+G]-y[k+8+G],ae=y[k+0+G]-y[k+12+G];H[0+G]=K+Q,H[8+G]=K-Q,H[4+G]=ae+ee,H[12+G]=ae-ee}for(G=0;4>G;++G)K=(y=H[0+4*G]+3)+H[3+4*G],Q=H[1+4*G]+H[2+4*G],ee=H[1+4*G]-H[2+4*G],ae=y-H[3+4*G],P[O+0]=K+Q>>3,P[O+16]=ae+ee>>3,P[O+32]=K-Q>>3,P[O+48]=ae-ee>>3,O+=64}function gc(y,k,P){var O,G=k-32,H=sa,K=255-y[G-1];for(O=0;O<P;++O){var Q,ee=H,ae=K+y[k-1];for(Q=0;Q<P;++Q)y[k+Q]=ee[ae+y[G+Q]];k+=32}}function dl(y,k){gc(y,k,4)}function _f(y,k){gc(y,k,8)}function wf(y,k){gc(y,k,16)}function F0(y,k){var P;for(P=0;16>P;++P)r(y,k+32*P,y,k-32,16)}function j0(y,k){var P;for(P=16;0<P;--P)i(y,k,y[k-1],16),k+=32}function vc(y,k,P){var O;for(O=0;16>O;++O)i(k,P+32*O,y,16)}function fm(y,k){var P,O=16;for(P=0;16>P;++P)O+=y[k-1+32*P]+y[k+P-32];vc(O>>5,y,k)}function no(y,k){var P,O=8;for(P=0;16>P;++P)O+=y[k-1+32*P];vc(O>>4,y,k)}function B0(y,k){var P,O=8;for(P=0;16>P;++P)O+=y[k+P-32];vc(O>>4,y,k)}function Os(y,k){vc(128,y,k)}function Pt(y,k,P){return y+2*k+P+2>>2}function pm(y,k){var P,O=k-32;for(O=new Uint8Array([Pt(y[O-1],y[O+0],y[O+1]),Pt(y[O+0],y[O+1],y[O+2]),Pt(y[O+1],y[O+2],y[O+3]),Pt(y[O+2],y[O+3],y[O+4])]),P=0;4>P;++P)r(y,k+32*P,O,0,O.length)}function Ed(y,k){var P=y[k-1],O=y[k-1+32],G=y[k-1+64],H=y[k-1+96];De(y,k+0,16843009*Pt(y[k-1-32],P,O)),De(y,k+32,16843009*Pt(P,O,G)),De(y,k+64,16843009*Pt(O,G,H)),De(y,k+96,16843009*Pt(G,H,H))}function bf(y,k){var P,O=4;for(P=0;4>P;++P)O+=y[k+P-32]+y[k-1+32*P];for(O>>=3,P=0;4>P;++P)i(y,k+32*P,O,4)}function mm(y,k){var P=y[k-1+0],O=y[k-1+32],G=y[k-1+64],H=y[k-1-32],K=y[k+0-32],Q=y[k+1-32],ee=y[k+2-32],ae=y[k+3-32];y[k+0+96]=Pt(O,G,y[k-1+96]),y[k+1+96]=y[k+0+64]=Pt(P,O,G),y[k+2+96]=y[k+1+64]=y[k+0+32]=Pt(H,P,O),y[k+3+96]=y[k+2+64]=y[k+1+32]=y[k+0+0]=Pt(K,H,P),y[k+3+64]=y[k+2+32]=y[k+1+0]=Pt(Q,K,H),y[k+3+32]=y[k+2+0]=Pt(ee,Q,K),y[k+3+0]=Pt(ae,ee,Q)}function gm(y,k){var P=y[k+1-32],O=y[k+2-32],G=y[k+3-32],H=y[k+4-32],K=y[k+5-32],Q=y[k+6-32],ee=y[k+7-32];y[k+0+0]=Pt(y[k+0-32],P,O),y[k+1+0]=y[k+0+32]=Pt(P,O,G),y[k+2+0]=y[k+1+32]=y[k+0+64]=Pt(O,G,H),y[k+3+0]=y[k+2+32]=y[k+1+64]=y[k+0+96]=Pt(G,H,K),y[k+3+32]=y[k+2+64]=y[k+1+96]=Pt(H,K,Q),y[k+3+64]=y[k+2+96]=Pt(K,Q,ee),y[k+3+96]=Pt(Q,ee,ee)}function hl(y,k){var P=y[k-1+0],O=y[k-1+32],G=y[k-1+64],H=y[k-1-32],K=y[k+0-32],Q=y[k+1-32],ee=y[k+2-32],ae=y[k+3-32];y[k+0+0]=y[k+1+64]=H+K+1>>1,y[k+1+0]=y[k+2+64]=K+Q+1>>1,y[k+2+0]=y[k+3+64]=Q+ee+1>>1,y[k+3+0]=ee+ae+1>>1,y[k+0+96]=Pt(G,O,P),y[k+0+64]=Pt(O,P,H),y[k+0+32]=y[k+1+96]=Pt(P,H,K),y[k+1+32]=y[k+2+96]=Pt(H,K,Q),y[k+2+32]=y[k+3+96]=Pt(K,Q,ee),y[k+3+32]=Pt(Q,ee,ae)}function ro(y,k){var P=y[k+0-32],O=y[k+1-32],G=y[k+2-32],H=y[k+3-32],K=y[k+4-32],Q=y[k+5-32],ee=y[k+6-32],ae=y[k+7-32];y[k+0+0]=P+O+1>>1,y[k+1+0]=y[k+0+64]=O+G+1>>1,y[k+2+0]=y[k+1+64]=G+H+1>>1,y[k+3+0]=y[k+2+64]=H+K+1>>1,y[k+0+32]=Pt(P,O,G),y[k+1+32]=y[k+0+96]=Pt(O,G,H),y[k+2+32]=y[k+1+96]=Pt(G,H,K),y[k+3+32]=y[k+2+96]=Pt(H,K,Q),y[k+3+64]=Pt(K,Q,ee),y[k+3+96]=Pt(Q,ee,ae)}function U0(y,k){var P=y[k-1+0],O=y[k-1+32],G=y[k-1+64],H=y[k-1+96];y[k+0+0]=P+O+1>>1,y[k+2+0]=y[k+0+32]=O+G+1>>1,y[k+2+32]=y[k+0+64]=G+H+1>>1,y[k+1+0]=Pt(P,O,G),y[k+3+0]=y[k+1+32]=Pt(O,G,H),y[k+3+32]=y[k+1+64]=Pt(G,H,H),y[k+3+64]=y[k+2+64]=y[k+0+96]=y[k+1+96]=y[k+2+96]=y[k+3+96]=H}function vm(y,k){var P=y[k-1+0],O=y[k-1+32],G=y[k-1+64],H=y[k-1+96],K=y[k-1-32],Q=y[k+0-32],ee=y[k+1-32],ae=y[k+2-32];y[k+0+0]=y[k+2+32]=P+K+1>>1,y[k+0+32]=y[k+2+64]=O+P+1>>1,y[k+0+64]=y[k+2+96]=G+O+1>>1,y[k+0+96]=H+G+1>>1,y[k+3+0]=Pt(Q,ee,ae),y[k+2+0]=Pt(K,Q,ee),y[k+1+0]=y[k+3+32]=Pt(P,K,Q),y[k+1+32]=y[k+3+64]=Pt(O,P,K),y[k+1+64]=y[k+3+96]=Pt(G,O,P),y[k+1+96]=Pt(H,G,O)}function Ad(y,k){var P;for(P=0;8>P;++P)r(y,k+32*P,y,k-32,8)}function mu(y,k){var P;for(P=0;8>P;++P)i(y,k,y[k-1],8),k+=32}function Lo(y,k,P){var O;for(O=0;8>O;++O)i(k,P+32*O,y,8)}function z0(y,k){var P,O=8;for(P=0;8>P;++P)O+=y[k+P-32]+y[k-1+32*P];Lo(O>>4,y,k)}function Pd(y,k){var P,O=4;for(P=0;8>P;++P)O+=y[k+P-32];Lo(O>>3,y,k)}function $0(y,k){var P,O=4;for(P=0;8>P;++P)O+=y[k-1+32*P];Lo(O>>3,y,k)}function yc(y,k){Lo(128,y,k)}function _c(y,k,P){var O=y[k-P],G=y[k+0],H=3*(G-O)+q0[1020+y[k-2*P]-y[k+P]],K=Tm[112+(H+4>>3)];y[k-P]=sa[255+O+Tm[112+(H+3>>3)]],y[k+0]=sa[255+G-K]}function xf(y,k,P,O){var G=y[k+0],H=y[k+P];return Da[255+y[k-2*P]-y[k-P]]>O||Da[255+H-G]>O}function gu(y,k,P,O){return 4*Da[255+y[k-P]-y[k+0]]+Da[255+y[k-2*P]-y[k+P]]<=O}function kf(y,k,P,O,G){var H=y[k-3*P],K=y[k-2*P],Q=y[k-P],ee=y[k+0],ae=y[k+P],ge=y[k+2*P],Se=y[k+3*P];return 4*Da[255+Q-ee]+Da[255+K-ae]>O?0:Da[255+y[k-4*P]-H]<=G&&Da[255+H-K]<=G&&Da[255+K-Q]<=G&&Da[255+Se-ge]<=G&&Da[255+ge-ae]<=G&&Da[255+ae-ee]<=G}function Md(y,k,P,O){var G=2*O+1;for(O=0;16>O;++O)gu(y,k+O,P,G)&&_c(y,k+O,P)}function Sf(y,k,P,O){var G=2*O+1;for(O=0;16>O;++O)gu(y,k+O*P,1,G)&&_c(y,k+O*P,1)}function vu(y,k,P,O){var G;for(G=3;0<G;--G)Md(y,k+=4*P,P,O)}function ym(y,k,P,O){var G;for(G=3;0<G;--G)Sf(y,k+=4,P,O)}function fl(y,k,P,O,G,H,K,Q){for(H=2*H+1;0<G--;){if(kf(y,k,P,H,K))if(xf(y,k,P,Q))_c(y,k,P);else{var ee=y,ae=k,ge=P,Se=ee[ae-2*ge],oe=ee[ae-ge],ve=ee[ae+0],xe=ee[ae+ge],Ne=ee[ae+2*ge],ke=27*(Le=q0[1020+3*(ve-oe)+q0[1020+Se-xe]])+63>>7,Ie=18*Le+63>>7,Le=9*Le+63>>7;ee[ae-3*ge]=sa[255+ee[ae-3*ge]+Le],ee[ae-2*ge]=sa[255+Se+Ie],ee[ae-ge]=sa[255+oe+ke],ee[ae+0]=sa[255+ve-ke],ee[ae+ge]=sa[255+xe-Ie],ee[ae+2*ge]=sa[255+Ne-Le]}k+=O}}function pl(y,k,P,O,G,H,K,Q){for(H=2*H+1;0<G--;){if(kf(y,k,P,H,K))if(xf(y,k,P,Q))_c(y,k,P);else{var ee=y,ae=k,ge=P,Se=ee[ae-ge],oe=ee[ae+0],ve=ee[ae+ge],xe=Tm[112+(4+(Ne=3*(oe-Se))>>3)],Ne=Tm[112+(Ne+3>>3)],ke=xe+1>>1;ee[ae-2*ge]=sa[255+ee[ae-2*ge]+ke],ee[ae-ge]=sa[255+Se+Ne],ee[ae+0]=sa[255+oe-xe],ee[ae+ge]=sa[255+ve-ke]}k+=O}}function _m(y,k,P,O,G,H){fl(y,k,P,1,16,O,G,H)}function wm(y,k,P,O,G,H){fl(y,k,1,P,16,O,G,H)}function bm(y,k,P,O,G,H){var K;for(K=3;0<K;--K)pl(y,k+=4*P,P,1,16,O,G,H)}function yu(y,k,P,O,G,H){var K;for(K=3;0<K;--K)pl(y,k+=4,1,P,16,O,G,H)}function xm(y,k,P,O,G,H,K,Q){fl(y,k,G,1,8,H,K,Q),fl(P,O,G,1,8,H,K,Q)}function C(y,k,P,O,G,H,K,Q){fl(y,k,1,G,8,H,K,Q),fl(P,O,1,G,8,H,K,Q)}function W(y,k,P,O,G,H,K,Q){pl(y,k+4*G,G,1,8,H,K,Q),pl(P,O+4*G,G,1,8,H,K,Q)}function ie(y,k,P,O,G,H,K,Q){pl(y,k+4,1,G,8,H,K,Q),pl(P,O+4,1,G,8,H,K,Q)}function pe(){this.ba=new rn,this.ec=[],this.cc=[],this.Mc=[],this.Dc=this.Nc=this.dc=this.fc=0,this.Oa=new Mn,this.memory=0,this.Ib="OutputFunc",this.Jb="OutputAlphaFunc",this.Nd="OutputRowFunc"}function _e(){this.data=[],this.offset=this.kd=this.ha=this.w=0,this.na=[],this.xa=this.gb=this.Ja=this.Sa=this.P=0}function Me(){this.nc=this.Ea=this.b=this.hc=0,this.K=[],this.w=0}function Be(){this.ua=0,this.Wa=new Mt,this.vb=new Mt,this.md=this.xc=this.wc=0,this.vc=[],this.Wb=0,this.Ya=new te,this.yc=new $}function ut(){this.xb=this.a=0,this.l=new Td,this.ca=new rn,this.V=[],this.Ba=0,this.Ta=[],this.Ua=0,this.m=new J,this.Pb=0,this.wd=new J,this.Ma=this.$=this.C=this.i=this.c=this.xd=0,this.s=new Be,this.ab=0,this.gc=a(4,Me),this.Oc=0}function gt(){this.Lc=this.Z=this.$a=this.i=this.c=0,this.l=new Td,this.ic=0,this.ca=[],this.tb=0,this.qd=null,this.rd=0}function Gt(y,k,P,O,G,H,K){for(y=y==null?0:y[k+0],k=0;k<K;++k)G[H+k]=y+P[O+k]&255,y=G[H+k]}function tn(y,k,P,O,G,H,K){var Q;if(y==null)Gt(null,null,P,O,G,H,K);else for(Q=0;Q<K;++Q)G[H+Q]=y[k+Q]+P[O+Q]&255}function Tn(y,k,P,O,G,H,K){if(y==null)Gt(null,null,P,O,G,H,K);else{var Q,ee=y[k+0],ae=ee,ge=ee;for(Q=0;Q<K;++Q)ae=ge+(ee=y[k+Q])-ae,ge=P[O+Q]+(-256&ae?0>ae?0:255:ae)&255,ae=ee,G[H+Q]=ge}}function ii(y,k,P,O){var G=k.width,H=k.o;if(e(y!=null&&k!=null),0>P||0>=O||P+O>H)return null;if(!y.Cc){if(y.ga==null){var K;if(y.ga=new gt,(K=y.ga==null)||(K=k.width*k.o,e(y.Gb.length==0),y.Gb=s(K),y.Uc=0,y.Gb==null?K=0:(y.mb=y.Gb,y.nb=y.Uc,y.rc=null,K=1),K=!K),!K){K=y.ga;var Q=y.Fa,ee=y.P,ae=y.qc,ge=y.mb,Se=y.nb,oe=ee+1,ve=ae-1,xe=K.l;if(e(Q!=null&&ge!=null&&k!=null),Bo[0]=null,Bo[1]=Gt,Bo[2]=tn,Bo[3]=Tn,K.ca=ge,K.tb=Se,K.c=k.width,K.i=k.height,e(0<K.c&&0<K.i),1>=ae)k=0;else if(K.$a=3&Q[ee+0],K.Z=Q[ee+0]>>2&3,K.Lc=Q[ee+0]>>4&3,ee=Q[ee+0]>>6&3,0>K.$a||1<K.$a||4<=K.Z||1<K.Lc||ee)k=0;else if(xe.put=ct,xe.ac=Tr,xe.bc=_i,xe.ma=K,xe.width=k.width,xe.height=k.height,xe.Da=k.Da,xe.v=k.v,xe.va=k.va,xe.j=k.j,xe.o=k.o,K.$a)e:{e(K.$a==1),k=Xi();t:for(;;){if(k==null){k=0;break e}if(e(K!=null),K.mc=k,k.c=K.c,k.i=K.i,k.l=K.l,k.l.ma=K,k.l.width=K.c,k.l.height=K.i,k.a=0,q(k.m,Q,oe,ve),!La(K.c,K.i,1,k,null)||(k.ab==1&&k.gc[0].hc==3&&Ma(k.s)?(K.ic=1,Q=k.c*k.i,k.Ta=null,k.Ua=0,k.V=s(Q),k.Ba=0,k.V==null?(k.a=1,k=0):k=1):(K.ic=0,k=cl(k,K.c)),!k))break t;k=1;break e}K.mc=null,k=0}else k=ve>=K.c*K.i;K=!k}if(K)return null;y.ga.Lc!=1?y.Ga=0:O=H-P}e(y.ga!=null),e(P+O<=H);e:{if(k=(Q=y.ga).c,H=Q.l.o,Q.$a==0){if(oe=y.rc,ve=y.Vc,xe=y.Fa,ee=y.P+1+P*k,ae=y.mb,ge=y.nb+P*k,e(ee<=y.P+y.qc),Q.Z!=0)for(e(Bo[Q.Z]!=null),K=0;K<O;++K)Bo[Q.Z](oe,ve,xe,ee,ae,ge,k),oe=ae,ve=ge,ge+=k,ee+=k;else for(K=0;K<O;++K)r(ae,ge,xe,ee,k),oe=ae,ve=ge,ge+=k,ee+=k;y.rc=oe,y.Vc=ve}else{if(e(Q.mc!=null),k=P+O,e((K=Q.mc)!=null),e(k<=K.i),K.C>=k)k=1;else if(Q.ic||Ar(),Q.ic){Q=K.V,oe=K.Ba,ve=K.c;var Ne=K.i,ke=(xe=1,ee=K.$/ve,ae=K.$%ve,ge=K.m,Se=K.s,K.$),Ie=ve*Ne,Le=ve*k,Ge=Se.wc,ze=ke<Le?Ni(Se,ae,ee):null;e(ke<=Ie),e(k<=Ne),e(Ma(Se));t:for(;;){for(;!ge.h&&ke<Le;){if(ae&Ge||(ze=Ni(Se,ae,ee)),e(ze!=null),me(ge),256>(Ne=Cr(ze.G[0],ze.H[0],ge)))Q[oe+ke]=Ne,++ke,++ae>=ve&&(ae=0,++ee<=k&&!(ee%16)&&Na(K,ee));else{if(!(280>Ne)){xe=0;break t}Ne=dr(Ne-256,ge);var Ct,dt=Cr(ze.G[4],ze.H[4],ge);if(me(ge),!(ke>=(dt=Fr(ve,dt=dr(dt,ge)))&&Ie-ke>=Ne)){xe=0;break t}for(Ct=0;Ct<Ne;++Ct)Q[oe+ke+Ct]=Q[oe+ke+Ct-dt];for(ke+=Ne,ae+=Ne;ae>=ve;)ae-=ve,++ee<=k&&!(ee%16)&&Na(K,ee);ke<Le&&ae&Ge&&(ze=Ni(Se,ae,ee))}e(ge.h==de(ge))}Na(K,ee>k?k:ee);break t}!xe||ge.h&&ke<Ie?(xe=0,K.a=ge.h?5:3):K.$=ke,k=xe}else k=Ra(K,K.V,K.Ba,K.c,K.i,k,to);if(!k){O=0;break e}}P+O>=H&&(y.Cc=1),O=1}if(!O)return null;if(y.Cc&&((O=y.ga)!=null&&(O.mc=null),y.ga=null,0<y.Ga))return alert("todo:WebPDequantizeLevels"),null}return y.nb+P*G}function $n(y,k,P,O,G,H){for(;0<G--;){var K,Q=y,ee=k+(P?1:0),ae=y,ge=k+(P?0:3);for(K=0;K<O;++K){var Se=ae[ge+4*K];Se!=255&&(Se*=32897,Q[ee+4*K+0]=Q[ee+4*K+0]*Se>>23,Q[ee+4*K+1]=Q[ee+4*K+1]*Se>>23,Q[ee+4*K+2]=Q[ee+4*K+2]*Se>>23)}k+=H}}function Vn(y,k,P,O,G){for(;0<O--;){var H;for(H=0;H<P;++H){var K=y[k+2*H+0],Q=15&(ae=y[k+2*H+1]),ee=4369*Q,ae=(240&ae|ae>>4)*ee>>16;y[k+2*H+0]=(240&K|K>>4)*ee>>16&240|(15&K|K<<4)*ee>>16>>4&15,y[k+2*H+1]=240&ae|Q}k+=G}}function hr(y,k,P,O,G,H,K,Q){var ee,ae,ge=255;for(ae=0;ae<G;++ae){for(ee=0;ee<O;++ee){var Se=y[k+ee];H[K+4*ee]=Se,ge&=Se}k+=P,K+=Q}return ge!=255}function Er(y,k,P,O,G){var H;for(H=0;H<G;++H)P[O+H]=y[k+H]>>8}function Ar(){Mf=$n,F1=Vn,j1=hr,B1=Er}function Zi(y,k,P){M[y]=function(O,G,H,K,Q,ee,ae,ge,Se,oe,ve,xe,Ne,ke,Ie,Le,Ge){var ze,Ct=Ge-1>>1,dt=Q[ee+0]|ae[ge+0]<<16,sn=Se[oe+0]|ve[xe+0]<<16;e(O!=null);var yt=3*dt+sn+131074>>2;for(k(O[G+0],255&yt,yt>>16,Ne,ke),H!=null&&(yt=3*sn+dt+131074>>2,k(H[K+0],255&yt,yt>>16,Ie,Le)),ze=1;ze<=Ct;++ze){var yn=Q[ee+ze]|ae[ge+ze]<<16,li=Se[oe+ze]|ve[xe+ze]<<16,jt=dt+yn+sn+li+524296,kt=jt+2*(yn+sn)>>3;yt=kt+dt>>1,dt=(jt=jt+2*(dt+li)>>3)+yn>>1,k(O[G+2*ze-1],255&yt,yt>>16,Ne,ke+(2*ze-1)*P),k(O[G+2*ze-0],255&dt,dt>>16,Ne,ke+(2*ze-0)*P),H!=null&&(yt=jt+sn>>1,dt=kt+li>>1,k(H[K+2*ze-1],255&yt,yt>>16,Ie,Le+(2*ze-1)*P),k(H[K+2*ze+0],255&dt,dt>>16,Ie,Le+(2*ze+0)*P)),dt=yn,sn=li}1&Ge||(yt=3*dt+sn+131074>>2,k(O[G+Ge-1],255&yt,yt>>16,Ne,ke+(Ge-1)*P),H!=null&&(yt=3*sn+dt+131074>>2,k(H[K+Ge-1],255&yt,yt>>16,Ie,Le+(Ge-1)*P)))}}function ml(){la[Cm]=eb,la[Em]=dn,la[W1]=Z0,la[Am]=Ud,la[Pm]=ey,la[W0]=Ft,la[G0]=Lm,la[Mm]=dn,la[Nf]=Ud,la[Pu]=ey,la[aa]=Ft}function Tf(y){return y&~tb?0>y?0:255:y>>ty}function _u(y,k){return Tf((19077*y>>8)+(26149*k>>8)-14234)}function wu(y,k,P){return Tf((19077*y>>8)-(6419*k>>8)-(13320*P>>8)+8708)}function wc(y,k){return Tf((19077*y>>8)+(33050*k>>8)-17685)}function es(y,k,P,O,G){O[G+0]=_u(y,P),O[G+1]=wu(y,k,P),O[G+2]=wc(y,k)}function bc(y,k,P,O,G){O[G+0]=wc(y,k),O[G+1]=wu(y,k,P),O[G+2]=_u(y,P)}function Oo(y,k,P,O,G){var H=wu(y,k,P);k=H<<3&224|wc(y,k)>>3,O[G+0]=248&_u(y,P)|H>>5,O[G+1]=k}function Dn(y,k,P,O,G){var H=240&wc(y,k)|15;O[G+0]=240&_u(y,P)|wu(y,k,P)>>4,O[G+1]=H}function bu(y,k,P,O,G){O[G+0]=255,es(y,k,P,O,G+1)}function fs(y,k,P,O,G){bc(y,k,P,O,G),O[G+3]=255}function xc(y,k,P,O,G){es(y,k,P,O,G),O[G+3]=255}function ps(y,k,P){M[y]=function(O,G,H,K,Q,ee,ae,ge,Se){for(var oe=ge+(-2&Se)*P;ge!=oe;)k(O[G+0],H[K+0],Q[ee+0],ae,ge),k(O[G+1],H[K+0],Q[ee+0],ae,ge+P),G+=2,++K,++ee,ge+=2*P;1&Se&&k(O[G+0],H[K+0],Q[ee+0],ae,ge)}}function st(y,k,P){return P==0?y==0?k==0?6:5:k==0?4:0:P}function km(y,k,P,O,G){switch(y>>>30){case 3:so(k,P,O,G,0);break;case 2:vl(k,P,O,G);break;case 1:Ui(k,P,O,G)}}function gl(y,k){var P,O,G=k.M,H=k.Nb,K=y.oc,Q=y.pc+40,ee=y.oc,ae=y.pc+584,ge=y.oc,Se=y.pc+600;for(P=0;16>P;++P)K[Q+32*P-1]=129;for(P=0;8>P;++P)ee[ae+32*P-1]=129,ge[Se+32*P-1]=129;for(0<G?K[Q-1-32]=ee[ae-1-32]=ge[Se-1-32]=129:(i(K,Q-32-1,127,21),i(ee,ae-32-1,127,9),i(ge,Se-32-1,127,9)),O=0;O<y.za;++O){var oe=k.ya[k.aa+O];if(0<O){for(P=-1;16>P;++P)r(K,Q+32*P-4,K,Q+32*P+12,4);for(P=-1;8>P;++P)r(ee,ae+32*P-4,ee,ae+32*P+4,4),r(ge,Se+32*P-4,ge,Se+32*P+4,4)}var ve=y.Gd,xe=y.Hd+O,Ne=oe.ad,ke=oe.Hc;if(0<G&&(r(K,Q-32,ve[xe].y,0,16),r(ee,ae-32,ve[xe].f,0,8),r(ge,Se-32,ve[xe].ea,0,8)),oe.Za){var Ie=K,Le=Q-32+16;for(0<G&&(O>=y.za-1?i(Ie,Le,ve[xe].y[15],4):r(Ie,Le,ve[xe+1].y,0,4)),P=0;4>P;P++)Ie[Le+128+P]=Ie[Le+256+P]=Ie[Le+384+P]=Ie[Le+0+P];for(P=0;16>P;++P,ke<<=2)Ie=K,Le=Q+ny[P],oa[oe.Ob[P]](Ie,Le),km(ke,Ne,16*+P,Ie,Le)}else if(Ie=st(O,G,oe.Ob[0]),_l[Ie](K,Q),ke!=0)for(P=0;16>P;++P,ke<<=2)km(ke,Ne,16*+P,K,Q+ny[P]);for(P=oe.Gc,Ie=st(O,G,oe.Dd),jo[Ie](ee,ae),jo[Ie](ge,Se),ke=Ne,Ie=ee,Le=ae,255&(oe=0|P)&&(170&oe?Au(ke,256,Ie,Le):ao(ke,256,Ie,Le)),oe=ge,ke=Se,255&(P>>=8)&&(170&P?Au(Ne,320,oe,ke):ao(Ne,320,oe,ke)),G<y.Ub-1&&(r(ve[xe].y,0,K,Q+480,16),r(ve[xe].f,0,ee,ae+224,8),r(ve[xe].ea,0,ge,Se+224,8)),P=8*H*y.B,ve=y.sa,xe=y.ta+16*O+16*H*y.R,Ne=y.qa,oe=y.ra+8*O+P,ke=y.Ha,Ie=y.Ia+8*O+P,P=0;16>P;++P)r(ve,xe+P*y.R,K,Q+32*P,16);for(P=0;8>P;++P)r(Ne,oe+P*y.B,ee,ae+32*P,8),r(ke,Ie+P*y.B,ge,Se+32*P,8)}}function Cf(y,k,P,O,G,H,K,Q,ee){var ae=[0],ge=[0],Se=0,oe=ee!=null?ee.kd:0,ve=ee??new _e;if(y==null||12>P)return 7;ve.data=y,ve.w=k,ve.ha=P,k=[k],P=[P],ve.gb=[ve.gb];e:{var xe=k,Ne=P,ke=ve.gb;if(e(y!=null),e(Ne!=null),e(ke!=null),ke[0]=0,12<=Ne[0]&&!n(y,xe[0],"RIFF")){if(n(y,xe[0]+8,"WEBP")){ke=3;break e}var Ie=Je(y,xe[0]+4);if(12>Ie||4294967286<Ie){ke=3;break e}if(oe&&Ie>Ne[0]-8){ke=7;break e}ke[0]=Ie,xe[0]+=12,Ne[0]-=12}ke=0}if(ke!=0)return ke;for(Ie=0<ve.gb[0],P=P[0];;){e:{var Le=y;Ne=k,ke=P;var Ge=ae,ze=ge,Ct=xe=[0];if((yt=Se=[Se])[0]=0,8>ke[0])ke=7;else{if(!n(Le,Ne[0],"VP8X")){if(Je(Le,Ne[0]+4)!=10){ke=3;break e}if(18>ke[0]){ke=7;break e}var dt=Je(Le,Ne[0]+8),sn=1+Re(Le,Ne[0]+12);if(2147483648<=sn*(Le=1+Re(Le,Ne[0]+15))){ke=3;break e}Ct!=null&&(Ct[0]=dt),Ge!=null&&(Ge[0]=sn),ze!=null&&(ze[0]=Le),Ne[0]+=18,ke[0]-=18,yt[0]=1}ke=0}}if(Se=Se[0],xe=xe[0],ke!=0)return ke;if(Ne=!!(2&xe),!Ie&&Se)return 3;if(H!=null&&(H[0]=!!(16&xe)),K!=null&&(K[0]=Ne),Q!=null&&(Q[0]=0),K=ae[0],xe=ge[0],Se&&Ne&&ee==null){ke=0;break}if(4>P){ke=7;break}if(Ie&&Se||!Ie&&!Se&&!n(y,k[0],"ALPH")){P=[P],ve.na=[ve.na],ve.P=[ve.P],ve.Sa=[ve.Sa];e:{dt=y,ke=k,Ie=P;var yt=ve.gb;Ge=ve.na,ze=ve.P,Ct=ve.Sa,sn=22,e(dt!=null),e(Ie!=null),Le=ke[0];var yn=Ie[0];for(e(Ge!=null),e(Ct!=null),Ge[0]=null,ze[0]=null,Ct[0]=0;;){if(ke[0]=Le,Ie[0]=yn,8>yn){ke=7;break e}var li=Je(dt,Le+4);if(4294967286<li){ke=3;break e}var jt=8+li+1&-2;if(sn+=jt,0<yt&&sn>yt){ke=3;break e}if(!n(dt,Le,"VP8 ")||!n(dt,Le,"VP8L")){ke=0;break e}if(yn[0]<jt){ke=7;break e}n(dt,Le,"ALPH")||(Ge[0]=dt,ze[0]=Le+8,Ct[0]=li),Le+=jt,yn-=jt}}if(P=P[0],ve.na=ve.na[0],ve.P=ve.P[0],ve.Sa=ve.Sa[0],ke!=0)break}P=[P],ve.Ja=[ve.Ja],ve.xa=[ve.xa];e:if(yt=y,ke=k,Ie=P,Ge=ve.gb[0],ze=ve.Ja,Ct=ve.xa,dt=ke[0],Le=!n(yt,dt,"VP8 "),sn=!n(yt,dt,"VP8L"),e(yt!=null),e(Ie!=null),e(ze!=null),e(Ct!=null),8>Ie[0])ke=7;else{if(Le||sn){if(yt=Je(yt,dt+4),12<=Ge&&yt>Ge-12){ke=3;break e}if(oe&&yt>Ie[0]-8){ke=7;break e}ze[0]=yt,ke[0]+=8,Ie[0]-=8,Ct[0]=sn}else Ct[0]=5<=Ie[0]&&yt[dt+0]==47&&!(yt[dt+4]>>5),ze[0]=Ie[0];ke=0}if(P=P[0],ve.Ja=ve.Ja[0],ve.xa=ve.xa[0],k=k[0],ke!=0)break;if(4294967286<ve.Ja)return 3;if(Q==null||Ne||(Q[0]=ve.xa?2:1),K=[K],xe=[xe],ve.xa){if(5>P){ke=7;break}Q=K,oe=xe,Ne=H,y==null||5>P?y=0:5<=P&&y[k+0]==47&&!(y[k+4]>>5)?(Ie=[0],yt=[0],Ge=[0],q(ze=new J,y,k,P),Mi(ze,Ie,yt,Ge)?(Q!=null&&(Q[0]=Ie[0]),oe!=null&&(oe[0]=yt[0]),Ne!=null&&(Ne[0]=Ge[0]),y=1):y=0):y=0}else{if(10>P){ke=7;break}Q=xe,y==null||10>P||!Oa(y,k+3,P-3)?y=0:(oe=y[k+0]|y[k+1]<<8|y[k+2]<<16,Ne=16383&(y[k+7]<<8|y[k+6]),y=16383&(y[k+9]<<8|y[k+8]),1&oe||3<(oe>>1&7)||!(oe>>4&1)||oe>>5>=ve.Ja||!Ne||!y?y=0:(K&&(K[0]=Ne),Q&&(Q[0]=y),y=1))}if(!y||(K=K[0],xe=xe[0],Se&&(ae[0]!=K||ge[0]!=xe)))return 3;ee!=null&&(ee[0]=ve,ee.offset=k-ee.w,e(4294967286>k-ee.w),e(ee.offset==ee.ha-P));break}return ke==0||ke==7&&Se&&ee==null?(H!=null&&(H[0]|=ve.na!=null&&0<ve.na.length),O!=null&&(O[0]=K),G!=null&&(G[0]=xe),0):ke}function si(y,k,P){var O=k.width,G=k.height,H=0,K=0,Q=O,ee=G;if(k.Da=y!=null&&0<y.Da,k.Da&&(Q=y.cd,ee=y.bd,H=y.v,K=y.j,11>P||(H&=-2,K&=-2),0>H||0>K||0>=Q||0>=ee||H+Q>O||K+ee>G))return 0;if(k.v=H,k.j=K,k.va=H+Q,k.o=K+ee,k.U=Q,k.T=ee,k.da=y!=null&&0<y.da,k.da){if(!xt(Q,ee,P=[y.ib],H=[y.hb]))return 0;k.ib=P[0],k.hb=H[0]}return k.ob=y!=null&&y.ob,k.Kb=y==null||!y.Sd,k.da&&(k.ob=k.ib<3*O/4&&k.hb<3*G/4,k.Kb=0),1}function xu(y){if(y==null)return 2;if(11>y.S){var k=y.f.RGBA;k.fb+=(y.height-1)*k.A,k.A=-k.A}else k=y.f.kb,y=y.height,k.O+=(y-1)*k.fa,k.fa=-k.fa,k.N+=(y-1>>1)*k.Ab,k.Ab=-k.Ab,k.W+=(y-1>>1)*k.Db,k.Db=-k.Db,k.F!=null&&(k.J+=(y-1)*k.lb,k.lb=-k.lb);return 0}function Nd(y,k,P,O){if(O==null||0>=y||0>=k)return 2;if(P!=null){if(P.Da){var G=P.cd,H=P.bd,K=-2&P.v,Q=-2&P.j;if(0>K||0>Q||0>=G||0>=H||K+G>y||Q+H>k)return 2;y=G,k=H}if(P.da){if(!xt(y,k,G=[P.ib],H=[P.hb]))return 2;y=G[0],k=H[0]}}O.width=y,O.height=k;e:{var ee=O.width,ae=O.height;if(y=O.S,0>=ee||0>=ae||!(y>=Cm&&13>y))y=2;else{if(0>=O.Rd&&O.sd==null){K=H=G=k=0;var ge=(Q=ee*ry[y])*ae;if(11>y||(H=(ae+1)/2*(k=(ee+1)/2),y==12&&(K=(G=ee)*ae)),(ae=s(ge+2*H+K))==null){y=1;break e}O.sd=ae,11>y?((ee=O.f.RGBA).eb=ae,ee.fb=0,ee.A=Q,ee.size=ge):((ee=O.f.kb).y=ae,ee.O=0,ee.fa=Q,ee.Fd=ge,ee.f=ae,ee.N=0+ge,ee.Ab=k,ee.Cd=H,ee.ea=ae,ee.W=0+ge+H,ee.Db=k,ee.Ed=H,y==12&&(ee.F=ae,ee.J=0+ge+2*H),ee.Tc=K,ee.lb=G)}if(k=1,G=O.S,H=O.width,K=O.height,G>=Cm&&13>G)if(11>G)y=O.f.RGBA,k&=(Q=Math.abs(y.A))*(K-1)+H<=y.size,k&=Q>=H*ry[G],k&=y.eb!=null;else{y=O.f.kb,Q=(H+1)/2,ge=(K+1)/2,ee=Math.abs(y.fa),ae=Math.abs(y.Ab);var Se=Math.abs(y.Db),oe=Math.abs(y.lb),ve=oe*(K-1)+H;k&=ee*(K-1)+H<=y.Fd,k&=ae*(ge-1)+Q<=y.Cd,k=(k&=Se*(ge-1)+Q<=y.Ed)&ee>=H&ae>=Q&Se>=Q,k&=y.y!=null,k&=y.f!=null,k&=y.ea!=null,G==12&&(k&=oe>=H,k&=ve<=y.Tc,k&=y.F!=null)}else k=0;y=k?0:2}}return y!=0||P!=null&&P.fd&&(y=xu(O)),y}var Rd=64,ku=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215],Id=24,ms=32,Ds=8,Ld=[0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
vendor: 4,755 bytes, line 690
6906,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7];ot("Predictor0","PredictorAdd0"),M.Predictor0=function(){return 4278190080},M.Predictor1=function(y){return y},M.Predictor2=function(y,k,P){return k[P+0]},M.Predictor3=function(y,k,P){return k[P+1]},M.Predictor4=function(y,k,P){return k[P-1]},M.Predictor5=function(y,k,P){return mt(mt(y,k[P+1]),k[P+0])},M.Predictor6=function(y,k,P){return mt(y,k[P-1])},M.Predictor7=function(y,k,P){return mt(y,k[P+0])},M.Predictor8=function(y,k,P){return mt(k[P-1],k[P+0])},M.Predictor9=function(y,k,P){return mt(k[P+0],k[P+1])},M.Predictor10=function(y,k,P){return mt(mt(y,k[P-1]),mt(k[P+0],k[P+1]))},M.Predictor11=function(y,k,P){var O=k[P+0];return 0>=At(O>>24&255,y>>24&255,(k=k[P-1])>>24&255)+At(O>>16&255,y>>16&255,k>>16&255)+At(O>>8&255,y>>8&255,k>>8&255)+At(255&O,255&y,255&k)?O:y},M.Predictor12=function(y,k,P){var O=k[P+0];return(An((y>>24&255)+(O>>24&255)-((k=k[P-1])>>24&255))<<24|An((y>>16&255)+(O>>16&255)-(k>>16&255))<<16|An((y>>8&255)+(O>>8&255)-(k>>8&255))<<8|An((255&y)+(255&O)-(255&k)))>>>0},M.Predictor13=function(y,k,P){var O=k[P-1];return(Kt((y=mt(y,k[P+0]))>>24&255,O>>24&255)<<24|Kt(y>>16&255,O>>16&255)<<16|Kt(y>>8&255,O>>8&255)<<8|Kt(255&y,255&O))>>>0};var kc=M.PredictorAdd0;M.PredictorAdd1=Jt,ot("Predictor2","PredictorAdd2"),ot("Predictor3","PredictorAdd3"),ot("Predictor4","PredictorAdd4"),ot("Predictor5","PredictorAdd5"),ot("Predictor6","PredictorAdd6"),ot("Predictor7","PredictorAdd7"),ot("Predictor8","PredictorAdd8"),ot("Predictor9","PredictorAdd9"),ot("Predictor10","PredictorAdd10"),ot("Predictor11","PredictorAdd11"),ot("Predictor12","PredictorAdd12"),ot("Predictor13","PredictorAdd13");var Sc=M.PredictorAdd2;ht("ColorIndexInverseTransform","MapARGB","32b",function(y){return y>>8&255},function(y){return y}),ht("VP8LColorIndexInverseTransformAlpha","MapAlpha","8b",function(y){return y},function(y){return y>>8&255});var Od,Su=M.ColorIndexInverseTransform,ai=M.MapARGB,V0=M.VP8LColorIndexInverseTransformAlpha,Do=M.MapAlpha,io=M.VP8LPredictorsAdd=[];io.length=16,(M.VP8LPredictors=[]).length=16,(M.VP8LPredictorsAdd_C=[]).length=16,(M.VP8LPredictors_C=[]).length=16;var Tu,Ef,Af,Dd,Cu,Eu,Fo,so,vl,Au,Ui,ao,tr,nr,Hr,oi,yl,Pf,Fd,Sm,I1,L1,O1,D1,Mf,F1,j1,B1,U1=s(511),z1=s(2041),$1=s(225),V1=s(767),q1=0,q0=z1,Tm=$1,sa=V1,Da=U1,Cm=0,Em=1,W1=2,Am=3,Pm=4,W0=5,G0=6,Mm=7,Nf=8,Pu=9,aa=10,jd=[2,3,7],G1=[3,3,11],H0=[280,256,256,256,40],H1=[0,1,1,1,0],K1=[17,18,0,1,2,3,4,5,16,6,7,8,9,10,11,12,13,14,15],J1=[24,7,23,25,40,6,39,41,22,26,38,42,56,5,55,57,21,27,54,58,37,43,72,4,71,73,20,28,53,59,70,74,36,44,88,69,75,52,60,3,87,89,19,29,86,90,35,45,68,76,85,91,51,61,104,2,103,105,18,30,102,106,34,46,84,92,67,77,101,107,50,62,120,1,119,121,83,93,17,31,100,108,66,78,118,122,33,47,117,123,49,63,99,109,82,94,0,116,124,65,79,16,32,98,110,48,115,125,81,95,64,114,126,97,111,80,113,127,96,112],Y1=[2954,2956,2958,2962,2970,2986,3018,3082,3212,3468,3980,5004],X1=8,Nm=[4,5,6,7,8,9,10,10,11,12,13,14,15,16,17,17,18,19,20,20,21,21,22,22,23,23,24,25,25,26,27,28,29,30,31,32,33,34,35,36,37,37,38,39,40,41,42,43,44,45,46,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,76,77,78,79,80,81,82,83,84,85,86,87,88,89,91,93,95,96,98,100,101,102,104,106,108,110,112,114,116,118,122,124,126,128,130,132,134,136,138,140,143,145,148,151,154,157],Rm=[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,167,170,173,177,181,185,189,193,197,201,205,209,213,217,221,225,229,234,239,245,249,254,259,264,269,274,279,284],Bd=null,Q1=[[173,148,140,0],[176,155,140,135,0],[180,157,141,134,130,0],[254,254,243,230,196,177,153,140,133,130,129,0]],K0=[0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15],Im=[-0,1,-1,2,-2,3,4,6,-3,5,-4,-5,-6,7,-7,8,-8,-9],J0=[[[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]],[[253,136,254,255,228,219,128,128,128,128,128],[189,129,242,255,227,213,255,219,128,128,128],[106,126,227,252,214,209,255,255,128,128,128]],[[1,98,248,255,236,226,255,255,128,128,128],[181,133,238,254,221,234,255,154,128,128,128],[78,134,202,247,198,180,255,219,128,128,128]],[[1,185,249,25
6905,243,255,128,128,128,128,128],[184,150,247,255,236,224,128,128,128,128,128],[77,110,216,255,236,230,128,128,128,128,128]],[[1,101,251,255,241,255,128,128,128,128,128],[170,139,241,252,236,209,255,255,128,128,128],[37,116,196,243,228,255,255,255,128,128,128]],[[1,204,254,255,245,255,128,128,128,128,128],[207,160,250,255,238,128,128,128,128,128,128],[102,103,231,255,211,171,128,128,128,128,128]],[[1,152,252,255,240,255,128,128,128,128,128],[177,135,243,255,234,225,128,128,128,128,128],[80,129,211,255,194,224,128,128,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[246,1,255,128,128,128,128,128,128,128,128],[255,128,128,128,128,128,128,128,128,128,128]]],[[[198,35,237,223,193,187,162,160,145,155,62],[131,45,198,221,172,176,220,157,252,221,1],[68,47,146,208,149,167,221,162,255,223,128]],[[1,149,241,255,221,224,255,255,128,128,128],[184,141,234,253,222,220,255,199,128,128,128],[81,99,181,242,176,190,249,202,255,255,128]],[[1,129,232,253,214,197,242,196,255,255,128],[99,121,210,250,201,198,255,202,128,128,128],[23,91,163,242,170,187,247,210,255,255,128]],[[1,200,246,255,234,255,128,128,128,128,128],[109,178,241,255,231,245,255,255,128,128,128],[44,130,201,253,205,192,255,255,128,128,128]],[[1,132,239,251,219,209,255,165,128,128,128],[94,136,225,251,218,190,255,255,128,128,128],[22,100,174,245,186,161,255,199,128,128,128]],[[1,182,249,255,232,235,128,128,128,128,128],[124,143,241,255,227,234,128,128,128,128,128],[35,77,181,251,193,211,255,205,128,128,128]],[[1,157,247,255,236,231,255,255,128,128,128],[121,141,235,255,225,227,255,255,128,128,128],[45,99,188,251,195,217,255,224,128,128,128]],[[1,1,251,255,213,255,128,128,128,128,128],[203,1,248,255,255,128,128,128,128,128,128],[137,1,177,255,224,255,128,128,128,128,128]]],[[[253,9,248,251,207,208,255,192,128,128,128],[175,13,224,243,193,185,249,198,255,255,128],[73,17,171,221,161,179,236,167,255,234,128]],[[1,95,247,253,212,183,255,255,128,128,128],[239,90,244,250,211,209,255,255,128,128,128],[155,77,195,248,188,195,255,255,128,128,128]],[[1,24,239,251,218,219,255,205,128,128,128],[201,51,219,255,196,186,128,128,128,128,128],[69,46,190,239,201,218,255,228,128,128,128]],[[1,191,251,255,255,128,128,128,128,128,128],[223,165,249,255,213,255,128,128,128,128,128],[141,124,248,255,255,128,128,128,128,128,128]],[[1,16,248,255,255,128,128,128,128,128,128],[190,36,230,255,236,255,128,128,128,128,128],[149,1,255,128,128,128,128,128,128,128,128]],[[1,226,255,128,128,128,128,128,128,128,128],[247,192,255,128,128,128,128,128,128,128,128],[240,128,255,128,128,128,128,128,128,128,128]],[[1,134,252,255,255,128,128,128,128,128,128],[213,62,250,255,255,128,128,128,128,128,128],[55,93,255,128,128,128,128,128,128,128,128]],[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]]],[[[202,24,213,235,186,191,220,160,240,175,255],[126,38,182,232,169,184,228,174,255,187,128],[61,46,138,219,151,178,240,170,255,216,128]],[[1,112,230,250,199,191,247,159,255,255,128],[166,109,228,252,211,215,255,174,128,128,128],[39,77,162,232,172,180,245,178,255,255,128]],[[1,52,220,246,198,199,249,220,255,255,128],[124,74,191,243,183,193,250,221,255,255,128],[24,71,130,219,154,170,243,182,255,255,128]],[[1,182,225,249,219,240,255,224,128,128,128],[149,150,226,252,216,205,255,171,128,128,128],[28,108,170,242,183,194,254,223,255,255,128]],[[1,81,230,252,204,203,255,192,128,128,128],[123,102,209,247,188,196,255,233,128,128,128],[20,95,153,243,164,173,255,203,128,128,128]],[[1,222,248,255,216,213,128,128,128,128,128],[168,175,246,252,235,205,255,255,128,128,128],[47,116,215,255,211,212,255,255,128,128,128]],[[1,121,236,253,212,214,255,255,128,128,128],[141,84,213,252,201,202,255,219,128,128,128],[42,80,160,240,162,185,255,205,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[244,1,255,128,128,128,128,128,128,128,128],[238,1,255,128,128,128,128,128,128,128,128]]]],Y0=[[[231,120,48,89,115,113,120,152,112],[152,179,64,126,170,118,46,70,95],[175,69,143,80,85,82,72,155,103],[56,58,10,171,218,189,17,13,152],[114,26,17,163,44,195,21,10,173],[121,24,80,195,26,62,44,64,85],[144,71,10,38,171,213,144,34,26],[170,46,55,19,136,160,33,206,71],[63,20,8,114,114,208,12,9,226],[81,40,11,96,182,84,29,16,36]],[[134,183,89,137,98,101,106,165,148],[72,187,100,130,157,111,32,75,80],[66,102,167,99,74,62,40,234,128],[41,53,9,178,241,141,26,8,107],[74,43,26,146,73,166,49,23,157],[65,38,105,160,51,52,31,115,128],[104,79,12,27,217,255,87,17,7],[87,68,71,44,114,51,15,186,23],[47,41,14,110,182,183,21,17,194],[66,45,25,102,197,189,23,18,22]],[[88,88,147,150,42,46,45,196,205],[43,97,183,117,85,38,35,179,61],[39,53,200,87,26,21,43,232,171],[56,34,51,104,114,102,29,93,77],[39,28,85,171,58,165,90,98,64],[34,22,116,206,23,34,43,166,73],[107,54,32,26,51,1,81,43,31],[68,25,106,22,64,171,36,225,114],[34,19,21,102,132,188,16,76,124],[62,18,78,95,85,57,50,48,51]],[[193,101,35,159,215,111,89,46,111],[60,148,31,172,219,228,21,18,111],[112,113,77,85,179,255,38,120,114],[40,42,1,196,245,209,10,25,109],[88,43,29,140,166,213,37,43,154],[61,63,30,155,67,45,68,1,209],[100,80,8,43,154,1,51,26,71],[142,78,78,16,255,128,34,197,171],[41,40,5,102,211,183,4,1,221],[51,50,17,168,209,192,23,25,82]],[[138,31,36,171,27,166,38,44,229],[67,87,58,169,82,115,26,59,179],[63,59,90,180,59,166,93,73,154],[40,40,21,116,143,209,34,39,175],[47,15,16,183,34,223,49,45,183],[46,17,33,183,6,98,15,32,183],[57,46,22,24,128,1,54,17,37],[65,32,73,115,28,128,23,128,205],[40,3,9,115,51,192,18,6,223],[87,37,9,115,59,77,64,21,47]],[[104,55,44,218,9,54,53,130,226],[64,90,70,205,40,41,23,26,57],[54,57,112,184,5,41,38,166,213],[30,34,26,133,152,116,10,32,134],[39,19,53,221,26,114,32,73,255],[31,9,65,234,2,15,1,118,73],[75,32,12,51,192,255,160,43,51],[88,31,35,67,102,85,55,186,85],[56,21,23,111,59,205,45,37,192],[55,38,70,124,73,102,1,34,98]],[[125,98,42,88,104,85,117,175,82],[95,84,53,89,128,100,113,101,45],[75,79,123,47,51,128,81,171,1],[57,17,5,71,102,57,53,41,49],[38,33,13,121,57,73,26,1,85],[41,10,67,138,77,110,90,47,114],[115,21,2,10,102,255,166,23,6],[101,29,16,10,85,128,101,196,26],[57,18,10,102,102,213,34,20,43],[117,20,15,36,163,128,68,1,26]],[[102,61,71,37,34,53,31,243,192],[69,60,71,38,73,119,28,222,37],[68,45,128,34,1,47,11,245,171],[62,17,19,70,146,85,55,62,70],[37,43,37,154,100,163,85,160,1],[63,9,92,136,28,64,32,201,85],[75,15,9,9,64,255,184,119,16],[86,6,28,5,64,25
6905,25,248,1],[56,8,17,132,137,255,55,116,128],[58,15,20,82,135,57,26,121,40]],[[164,50,31,137,154,133,25,35,218],[51,103,44,131,131,123,31,6,158],[86,40,64,135,148,224,45,183,128],[22,26,17,131,240,154,14,1,209],[45,16,21,91,64,222,7,1,197],[56,21,39,155,60,138,23,102,213],[83,12,13,54,192,255,68,47,28],[85,26,85,85,128,128,32,146,171],[18,11,7,63,144,171,4,4,246],[35,27,10,146,174,171,12,26,128]],[[190,80,35,99,180,80,126,54,45],[85,126,47,87,176,51,41,20,32],[101,75,128,139,118,146,116,128,85],[56,41,15,176,236,85,37,9,62],[71,30,17,119,118,255,17,18,138],[101,38,60,138,55,70,43,26,142],[146,36,19,30,171,255,97,27,20],[138,45,61,62,219,1,81,188,64],[32,41,20,117,151,142,20,21,163],[112,19,12,61,195,128,48,4,24]]],Rf=[[[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[176,246,255,255,255,255,255,255,255,255,255],[223,241,252,255,255,255,255,255,255,255,255],[249,253,253,255,255,255,255,255,255,255,255]],[[255,244,252,255,255,255,255,255,255,255,255],[234,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255]],[[255,246,254,255,255,255,255,255,255,255,255],[239,253,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[251,255,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[251,254,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,254,253,255,254,255,255,255,255,255,255],[250,255,254,255,254,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[217,255,255,255,255,255,255,255,255,255,255],[225,252,241,253,255,255,254,255,255,255,255],[234,250,241,250,253,255,253,254,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[223,254,254,255,255,255,255,255,255,255,255],[238,253,254,254,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[249,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,255,255,255,255,255,255,255,255,255],[247,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[252,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[186,251,250,255,255,255,255,255,255,255,255],[234,251,244,254,255,255,255,255,255,255,255],[251,251,243,253,254,255,254,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[236,253,254,255,255,255,255,255,255,255,255],[251,253,253,254,254,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[254,254,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[254,254,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[248,255,255,255,255,255,255,255,255,255,255],[250,254,252,254,255,255,255,255,255,255,255],[248,254,249,253,255,255,255,255,255,255,255]],[[255,253,253,255,255,255,255,255,255,255,255],[246,253,253,255,255,255,255,255,255,255,255],[252,254,251,254,254,255,255,255,255,255,255]],[[255,254,252,25
vendor: 23,975 bytes, lines 690-714
6905,255,255,255,255,255,255,255],[248,254,253,255,255,255,255,255,255,255,255],[253,255,254,254,255,255,255,255,255,255,255]],[[255,251,254,255,255,255,255,255,255,255,255],[245,251,254,255,255,255,255,255,255,255,255],[253,253,254,255,255,255,255,255,255,255,255]],[[255,251,253,255,255,255,255,255,255,255,255],[252,253,254,255,255,255,255,255,255,255,255],[255,254,255,255,255,255,255,255,255,255,255]],[[255,252,255,255,255,255,255,255,255,255,255],[249,255,254,255,255,255,255,255,255,255,255],[255,255,254,255,255,255,255,255,255,255,255]],[[255,255,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]]],X0=[0,1,2,3,6,4,5,6,6,6,6,6,6,6,6,7,0],_l=[],oa=[],jo=[],Z1=1,Q0=2,Bo=[],la=[];Zi("UpsampleRgbLinePair",es,3),Zi("UpsampleBgrLinePair",bc,3),Zi("UpsampleRgbaLinePair",xc,4),Zi("UpsampleBgraLinePair",fs,4),Zi("UpsampleArgbLinePair",bu,4),Zi("UpsampleRgba4444LinePair",Dn,2),Zi("UpsampleRgb565LinePair",Oo,2);var eb=M.UpsampleRgbLinePair,Z0=M.UpsampleBgrLinePair,dn=M.UpsampleRgbaLinePair,Ud=M.UpsampleBgraLinePair,ey=M.UpsampleArgbLinePair,Ft=M.UpsampleRgba4444LinePair,Lm=M.UpsampleRgb565LinePair,Lt=16,If=1<<Lt-1,Mu=-227,Om=482,ty=6,tb=(256<<ty)-1,Dm=0,nb=s(256),rb=s(256),ib=s(256),sb=s(256),ab=s(Om-Mu),ob=s(Om-Mu);ps("YuvToRgbRow",es,3),ps("YuvToBgrRow",bc,3),ps("YuvToRgbaRow",xc,4),ps("YuvToBgraRow",fs,4),ps("YuvToArgbRow",bu,4),ps("YuvToRgba4444Row",Dn,2),ps("YuvToRgb565Row",Oo,2);var ny=[0,4,8,12,128,132,136,140,256,260,264,268,384,388,392,396],Lf=[0,2,8],lb=[8,7,6,4,4,2,2,2,1,1,1,1],cb=1;this.WebPDecodeRGBA=function(y,k,P,O,G){var H=Em,K=new pe,Q=new rn;K.ba=Q,Q.S=H,Q.width=[Q.width],Q.height=[Q.height];var ee=Q.width,ae=Q.height,ge=new Tt;if(ge==null||y==null)var Se=2;else e(ge!=null),Se=Cf(y,k,P,ge.width,ge.height,ge.Pd,ge.Qd,ge.format,null);if(Se!=0?ee=0:(ee!=null&&(ee[0]=ge.width[0]),ae!=null&&(ae[0]=ge.height[0]),ee=1),ee){Q.width=Q.width[0],Q.height=Q.height[0],O!=null&&(O[0]=Q.width),G!=null&&(G[0]=Q.height);e:{if(O=new Td,(G=new _e).data=y,G.w=k,G.ha=P,G.kd=1,k=[0],e(G!=null),((y=Cf(G.data,G.w,G.ha,null,null,null,k,null,G))==0||y==7)&&k[0]&&(y=4),(k=y)==0){if(e(K!=null),O.data=G.data,O.w=G.w+G.offset,O.ha=G.ha-G.offset,O.put=ct,O.ac=Tr,O.bc=_i,O.ma=K,G.xa){if((y=Xi())==null){K=1;break e}if(function(oe,ve){var xe=[0],Ne=[0],ke=[0];t:for(;;){if(oe==null)return 0;if(ve==null)return oe.a=2,0;if(oe.l=ve,oe.a=0,q(oe.m,ve.data,ve.w,ve.ha),!Mi(oe.m,xe,Ne,ke)){oe.a=3;break t}if(oe.xb=Q0,ve.width=xe[0],ve.height=Ne[0],!La(xe[0],Ne[0],1,oe,null))break t;return 1}return e(oe.a!=0),0}(y,O)){if(O=(k=Nd(O.width,O.height,K.Oa,K.ba))==0){t:{O=y;n:for(;;){if(O==null){O=0;break t}if(e(O.s.yc!=null),e(O.s.Ya!=null),e(0<O.s.Wb),e((P=O.l)!=null),e((G=P.ma)!=null),O.xb!=0){if(O.ca=G.ba,O.tb=G.tb,e(O.ca!=null),!si(G.Oa,P,Am)){O.a=2;break n}if(!cl(O,P.width)||P.da)break n;if((P.da||It(O.ca.S))&&Ar(),11>O.ca.S||(alert("todo:WebPInitConvertARGBToYUV"),O.ca.f.kb.F!=null&&Ar()),O.Pb&&0<O.s.ua&&O.s.vb.X==null&&!re(O.s.vb,O.s.Wa.Xa)){O.a=1;break n}O.xb=0}if(!Ra(O,O.V,O.Ba,O.c,O.i,P.o,ll))break n;G.Dc=O.Ma,O=1;break t}e(O.a!=0),O=0}O=!O}O&&(k=y.a)}else k=y.a}else{if((y=new I0)==null){K=1;break e}if(y.Fa=G.na,y.P=G.P,y.qc=G.Sa,Io(y,O)){if((k=Nd(O.width,O.height,K.Oa,K.ba))==0){if(y.Aa=0,P=K.Oa,e((G=y)!=null),P!=null){if(0<(ee=0>(ee=P.Md)?0:100<ee?255:255*ee/100)){for(ae=ge=0;4>ae;++ae)12>(Se=G.pb[ae]).lc&&(Se.ia=ee*lb[0>Se.lc?0:Se.lc]>>3),ge|=Se.ia;ge&&(alert("todo:VP8InitRandom"),G.ia=1)}G.Ga=P.Id,100<G.Ga?G.Ga=100:0>G.Ga&&(G.Ga=0)}(function(oe,ve){if(oe==null)return 0;if(ve==null)return er(oe,2,"NULL VP8Io parameter in VP8Decode().");if(!oe.cb&&!Io(oe,ve))return 0;if(e(oe.cb),ve.ac==null||ve.ac(ve)){ve.ob&&(oe.L=0);var xe=Lf[oe.L];if(oe.L==2?(oe.yb=0,oe.zb=0):(oe.yb=ve.v-xe>>4,oe.zb=ve.j-xe>>4,0>oe.yb&&(oe.yb=0),0>oe.zb&&(oe.zb=0)),oe.Va=ve.o+15+xe>>4,oe.Hb=ve.va+15+xe>>4,oe.Hb>oe.za&&(oe.Hb=oe.za),oe.Va>oe.Ub&&(oe.Va=oe.Ub),0<oe.L){var Ne=oe.ed;for(xe=0;4>xe;++xe){var ke;if(oe.Qa.Cb){var Ie=oe.Qa.Lb[xe];oe.Qa.Fb||(Ie+=Ne.Tb)}else Ie=Ne.Tb;for(ke=0;1>=ke;++ke){var Le=oe.gd[xe][ke],Ge=Ie;if(Ne.Pc&&(Ge+=Ne.vd[0],ke&&(Ge+=Ne.od[0])),0<(Ge=0>Ge?0:63<Ge?63:Ge)){var ze=Ge;0<Ne.wb&&(ze=4<Ne.wb?ze>>2:ze>>1)>9-Ne.wb&&(ze=9-Ne.wb),1>ze&&(ze=1),Le.dd=ze,Le.tc=2*Ge+ze,Le.ld=40<=Ge?2:15<=Ge?1:0}else Le.tc=0;Le.La=ke}}}xe=0}else er(oe,6,"Frame setup failed"),xe=oe.a;if(xe=xe==0){if(xe){oe.$c=0,0<oe.Aa||(oe.Ic=cb);t:{xe=oe.Ic,Ne=4*(ze=oe.za);var Ct=32*ze,dt=ze+1,sn=0<oe.L?ze*(0<oe.Aa?2:1):0,yt=(oe.Aa==2?2:1)*ze;if((Le=Ne+832+(ke=3*(16*xe+Lf[oe.L])/2*Ct)+(Ie=oe.Fa!=null&&0<oe.Fa.length?oe.Kc.c*oe.Kc.i:0))!=Le)xe=0;else{if(Le>oe.Vb){if(oe.Vb=0,oe.Ec=s(Le),oe.Fc=0,oe.Ec==null){xe=er(oe,1,"no memory during frame initialization.");break t}oe.Vb=Le}Le=oe.Ec,Ge=oe.Fc,oe.Ac=Le,oe.Bc=Ge,Ge+=Ne,oe.Gd=a(Ct,cm),oe.Hd=0,oe.rb=a(dt+1,Qi),oe.sb=1,oe.wa=sn?a(sn,Is):null,oe.Y=0,oe.D.Nb=0,oe.D.wa=oe.wa,oe.D.Y=oe.Y,0<oe.Aa&&(oe.D.Y+=ze),e(!0),oe.oc=Le,oe.pc=Ge,Ge+=832,oe.ya=a(yt,fu),oe.aa=0,oe.D.ya=oe.ya,oe.D.aa=oe.aa,oe.Aa==2&&(oe.D.aa+=ze),oe.R=16*ze,oe.B=8*ze,ze=(Ct=Lf[oe.L])*oe.R,Ct=Ct/2*oe.B,oe.sa=Le,oe.ta=Ge+ze,oe.qa=oe.sa,oe.ra=oe.ta+16*xe*oe.R+Ct,oe.Ha=oe.qa,oe.Ia=oe.ra+8*xe*oe.B+Ct,oe.$c=0,Ge+=ke,oe.mb=Ie?Le:null,oe.nb=Ie?Ge:null,e(Ge+Ie<=oe.Fc+oe.Vb),yf(oe),i(oe.Ac,oe.Bc,0,Ne),xe=1}}if(xe){if(ve.ka=0,ve.y=oe.sa,ve.O=oe.ta,ve.f=oe.qa,ve.N=oe.ra,ve.ea=oe.Ha,ve.Vd=oe.Ia,ve.fa=oe.R,ve.Rc=oe.B,ve.F=null,ve.J=0,!q1){for(xe=-255;255>=xe;++xe)U1[255+xe]=0>xe?-xe:xe;for(xe=-1020;1020>=xe;++xe)z1[1020+xe]=-128>xe?-128:127<xe?127:xe;for(xe=-112;112>=xe;++xe)$1[112+xe]=-16>xe?-16:15<xe?15:xe;for(xe=-255;510>=xe;++xe)V1[255+xe]=0>xe?0:255<xe?255:xe;q1=1}Fo=hm,so=L0,Au=O0,Ui=D0,ao=br,vl=dm,tr=_m,nr=wm,Hr=xm,oi=C,yl=bm,Pf=yu,Fd=W,Sm=ie,I1=Md,L1=Sf,O1=vu,D1=ym,oa[0]=bf,oa[1]=dl,oa[2]=pm,oa[3]=Ed,oa[4]=mm,oa[5]=hl,oa[6]=gm,oa[7]=ro,oa[8]=vm,oa[9]=U0,_l[0]=fm,_l[1]=wf,_l[2]=F0,_l[3]=j0,_l[4]=no,_l[5]=B0,_l[6]=Os,jo[0]=z0,jo[1]=_f,jo[2]=Ad,jo[3]=mu,jo[4]=$0,jo[5]=Pd,jo[6]=yc,xe=1}else xe=0}xe&&(xe=function(yn,li){for(yn.M=0;yn.M<yn.Va;++yn.M){var jt,kt=yn.Jc[yn.M&yn.Xb],et=yn.m,Kr=yn;for(jt=0;jt<Kr.za;++jt){var nn=et,Cn=Kr,fr=Cn.Ac,zi=Cn.Bc+4*jt,gs=Cn.zc,jr=Cn.ya[Cn.aa+jt];if(Cn.Qa.Bb?jr.$b=Ae(nn,Cn.Pa.jb[0])?2+Ae(nn,Cn.Pa.jb[2]):Ae(nn,Cn.Pa.jb[1]):jr.$b=0,Cn.kc&&(jr.Ad=Ae(nn,Cn.Bd)),jr.Za=!Ae(nn,145)+0,jr.Za){var ts=jr.Ob,vs=0;for(Cn=0;4>Cn;++Cn){var bi,Nn=gs[0+Cn];for(bi=0;4>bi;++bi){Nn=Y0[fr[zi+bi]][Nn];for(var qn=Im[Ae(nn,Nn[0])];0<qn;)qn=Im[2*qn+Ae(nn,Nn[qn])];Nn=-qn,fr[zi+bi]=Nn}r(ts,vs,fr,zi,4),vs+=4,gs[0+Cn]=Nn}}else Nn=Ae(nn,156)?Ae(nn,128)?1:3:Ae(nn,163)?2:0,jr.Ob[0]=Nn,i(fr,zi,Nn,4),i(gs,0,Nn,4);jr.Dd=Ae(nn,142)?Ae(nn,114)?Ae(nn,183)?1:3:2:0}if(Kr.m.Ka)return er(yn,7,"Premature end-of-partition0 encountered.");for(;yn.ja<yn.za;++yn.ja){if(Kr=kt,nn=(et=yn).rb[et.sb-1],fr=et.rb[et.sb+et.ja],jt=et.ya[et.aa+et.ja],zi=et.kc?jt.Ad:0)nn.la=fr.la=0,jt.Za||(nn.Na=fr.Na=0),jt.Hc=0,jt.Gc=0,jt.ia=0;else{var Br,Wn;if(nn=fr,fr=Kr,zi=et.Pa.Xc,gs=et.ya[et.aa+et.ja],jr=et.pb[gs.$b],Cn=gs.ad,ts=0,vs=et.rb[et.sb-1],Nn=bi=0,i(Cn,ts,0,384),gs.Za)var $i=0,oo=zi[3];else{qn=s(16);var Jr=nn.Na+vs.Na;if(Jr=Bd(fr,zi[1],Jr,jr.Eb,0,qn,0),nn.Na=vs.Na=(0<Jr)+0,1<Jr)Fo(qn,0,Cn,ts);else{var Fs=qn[0]+3>>3;for(qn=0;256>qn;qn+=16)Cn[ts+qn]=Fs}$i=1,oo=zi[0]}var rr=15&nn.la,xi=15&vs.la;for(qn=0;4>qn;++qn){var ca=1ξfor(Fs=Wn=0;4>Fs;++Fs)rr=rr>>1|(ca=(Jr=Bd(fr,oo,Jr=ca+(1&rr),jr.Sc,$i,Cn,ts))>$i)<<7,Wn=Wn<<2|(3<Jr?3:1<Jr?2:Cn[ts+0]!=0),ts+=16;rr>>=4,xi=xi>>1|ca<<7,bi=(bi<<8|Wn)>>>0}for(oo=rr,$i=xi>>4,Br=0;4>Br;Br+=2){for(Wn=0,rr=nn.la>>4+Br,xi=vs.la>>4+Br,qn=0;2>qn;++qn){for(ca=1&xi,Fs=0;2>Fs;++Fs)Jr=ca+(1&rr),rr=rr>>1|(ca=0<(Jr=Bd(fr,zi[2],Jr,jr.Qc,0,Cn,ts)))<<3,Wn=Wn<<2|(3<Jr?3:1<Jr?2:Cn[ts+0]!=0),ts+=16;rr>>=2,xi=xi>>1|ca<<5}Nn|=Wn<<4*Br,oo|=rr<<4<<Br,$i|=(240&xi)<<Br}nn.la=oo,vs.la=$i,gs.Hc=bi,gs.Gc=Nn,gs.ia=43690&Nn?0:jr.ia,zi=!(bi|Nn)}if(0<et.L&&(et.wa[et.Y+et.ja]=et.gd[jt.$b][jt.Za],et.wa[et.Y+et.ja].La|=!zi),Kr.Ka)return er(yn,7,"Premature end-of-file encountered.")}if(yf(yn),et=li,Kr=1,jt=(kt=yn).D,nn=0<kt.L&&kt.M>=kt.zb&&kt.M<=kt.Va,kt.Aa==0)t:{if(jt.M=kt.M,jt.uc=nn,gl(kt,jt),Kr=1,jt=(Wn=kt.D).Nb,nn=(Nn=Lf[kt.L])*kt.R,fr=Nn/2*kt.B,qn=16*jt*kt.R,Fs=8*jt*kt.B,zi=kt.sa,gs=kt.ta-nn+qn,jr=kt.qa,Cn=kt.ra-fr+Fs,ts=kt.Ha,vs=kt.Ia-fr+Fs,xi=(rr=Wn.M)==0,bi=rr>=kt.Va-1,kt.Aa==2&&gl(kt,Wn),Wn.uc)for(ca=(Jr=kt).D.M,e(Jr.D.uc),Wn=Jr.yb;Wn<Jr.Hb;++Wn){$i=Wn,oo=ca;var ys=(ua=(Vi=Jr).D).Nb;Br=Vi.R;var ua=ua.wa[ua.Y+$i],da=Vi.sa,js=Vi.ta+16*ys*Br+16*$i,ha=ua.dd,cr=ua.tc;if(cr!=0)if(e(3<=cr),Vi.L==1)0<$i&&L1(da,js,Br,cr+4),ua.La&&D1(da,js,Br,cr),0<oo&&I1(da,js,Br,cr+4),ua.La&&O1(da,js,Br,cr);else{var fa=Vi.B,lo=Vi.qa,Nu=Vi.ra+8*ys*fa+8*$i,wl=Vi.Ha,Vi=Vi.Ia+8*ys*fa+8*$i;ys=ua.ld,0<$i&&(nr(da,js,Br,cr+4,ha,ys),oi(lo,Nu,wl,Vi,fa,cr+4,ha,ys)),ua.La&&(Pf(da,js,Br,cr,ha,ys),Sm(lo,Nu,wl,Vi,fa,cr,ha,ys)),0<oo&&(tr(da,js,Br,cr+4,ha,ys),Hr(lo,Nu,wl,Vi,fa,cr+4,ha,ys)),ua.La&&(yl(da,js,Br,cr,ha,ys),Fd(lo,Nu,wl,Vi,fa,cr,ha,ys))}}if(kt.ia&&alert("todo:DitherRow"),et.put!=null){if(Wn=16*rr,rr=16*(rr+1),xi?(et.y=kt.sa,et.O=kt.ta+qn,et.f=kt.qa,et.N=kt.ra+Fs,et.ea=kt.Ha,et.W=kt.Ia+Fs):(Wn-=Nn,et.y=zi,et.O=gs,et.f=jr,et.N=Cn,et.ea=ts,et.W=vs),bi||(rr-=Nn),rr>et.o&&(rr=et.o),et.F=null,et.J=null,kt.Fa!=null&&0<kt.Fa.length&&Wn<rr&&(et.J=ii(kt,et,Wn,rr-Wn),et.F=kt.mb,et.F==null&&et.F.length==0)){Kr=er(kt,3,"Could not decode alpha data.");break t}Wn<et.j&&(Nn=et.j-Wn,Wn=et.j,e(!(1&Nn)),et.O+=kt.R*Nn,et.N+=kt.B*(Nn>>1),et.W+=kt.B*(Nn>>1),et.F!=null&&(et.J+=et.width*Nn)),Wn<rr&&(et.O+=et.v,et.N+=et.v>>1,et.W+=et.v>>1,et.F!=null&&(et.J+=et.v),et.ka=Wn-et.j,et.U=et.va-et.v,et.T=rr-Wn,Kr=et.put(et))}jt+1!=kt.Ic||bi||(r(kt.sa,kt.ta-nn,zi,gs+16*kt.R,nn),r(kt.qa,kt.ra-fr,jr,Cn+8*kt.B,fr),r(kt.Ha,kt.Ia-fr,ts,vs+8*kt.B,fr))}if(!Kr)return er(yn,6,"Output aborted.")}return 1}(oe,ve)),ve.bc!=null&&ve.bc(ve),xe&=1}return xe?(oe.cb=0,xe):0})(y,O)||(k=y.a)}}else k=y.a}k==0&&K.Oa!=null&&K.Oa.fd&&(k=xu(K.ba))}K=k}H=K!=0?null:11>H?Q.f.RGBA.eb:Q.f.kb.y}else H=null;return H};var ry=[3,4,3,4,4,2,2,4,4,4,2,1,1]};function c(M,B){for(var R="",j=0;j<4;j++)R+=String.fromCharCode(M[B++]);return R}function u(M,B){return M[B+0]|M[B+1]<<8}function d(M,B){return(M[B+0]|M[B+1]<<8|M[B+2]<<16)>>>0}function f(M,B){return(M[B+0]|M[B+1]<<8|M[B+2]<<16|M[B+3]<<24)>>>0}new l;var h=[0],p=[0],m=[],g=new l,v=t,_=function(M,B){var R={},j=0,$=!1,U=0,te=0;if(R.frames=[],!function(z,J){for(var Y=0;Y<4;Y++)if(z[J+Y]!="RIFF".charCodeAt(Y))return!0;return!1}(M,B)){for(f(M,B+=4),B+=8;B<M.length;){var ne=c(M,B),le=f(M,B+=4);B+=4;var V=le+(1&le);switch(ne){case"VP8 ":case"VP8L":R.frames[j]===void 0&&(R.frames[j]={}),(he=R.frames[j]).src_off=$?te:B-8,he.src_size=U+le+8,j++,$&&($=!1,U=0,te=0);break;case"VP8X":(he=R.header={}).feature_flags=M[B];var q=B+4;he.canvas_width=1+d(M,q),q+=3,he.canvas_height=1+d(M,q),q+=3;break;case"ALPH":$=!0,U=V+8,te=B-8;break;case"ANIM":(he=R.header).bgcolor=f(M,B),q=B+4,he.loop_count=u(M,q),q+=2;break;case"ANMF":var se,he;(he=R.frames[j]={}).offset_x=2*d(M,B),B+=3,he.offset_y=2*d(M,B),B+=3,he.width=1+d(M,B),B+=3,he.height=1+d(M,B),B+=3,he.duration=d(M,B),B+=3,se=M[B++],he.dispose=1&se,he.blend=se>>1&1}ne!="ANMF"&&(B+=V)}return R}}(v,0);_.response=v,_.rgbaoutput=!0,_.dataurl=!1;var b=_.header?_.header:null,x=_.frames?_.frames:null;if(b){b.loop_counter=b.loop_count,h=[b.canvas_height],p=[b.canvas_width];for(var T=0;T<x.length&&x[T].blend!=0;T++);}var N=x[0],A=g.WebPDecodeRGBA(v,N.src_off,N.src_size,p,h);N.rgba=A,N.imgwidth=p[0],N.imgheight=h[0];for(var L=0;L<p[0]*h[0]*4;L++)m[L]=A[L];return this.width=p,this.height=h,this.data=m,this}/** ==================================================================== 691 * @license 692 * jsPDF XMP metadata plugin 693 * Copyright (c) 2016 Jussi Utunen, [email protected] 694 * 695 * Permission is hereby granted, free of charge, to any person obtaining 696 * a copy of this software and associated documentation files (the 697 * "Software"), to deal in the Software without restriction, including 698 * without limitation the rights to use, copy, modify, merge, publish, 699 * distribute, sublicense, and/or sell copies of the Software, and to 700 * permit persons to whom the Software is furnished to do so, subject to 701 * the following conditions: 702 * 703 * The above copyright notice and this permission notice shall be 704 * included in all copies or substantial portions of the Software. 705 * 706 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 707 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 708 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 709 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 710 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 711 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 712 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 713 * ==================================================================== 714 */function JDe(){var t,e=this.internal.__metadata__.metadata,n=unescape(encodeURIComponent(e));t=this.internal.__metadata__.rawXml?n:'<x:xmpmeta xmlns:x="adobe:ns:meta/"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about="" xmlns:jspdf="'+this.internal.__metadata__.namespaceUri+'"><jspdf:metadata>'+n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")+"</jspdf:metadata></rdf:Description></rdf:RDF></x:xmpmeta>",this.internal.__metadata__.metadataObjectNumber=this.internal.newObject(),this.internal.write("<< /Type /Metadata /Subtype /XML /Length "+t.length+" >>"),this.internal.write("stream"),this.internal.write(t),this.internal.write("endstream"),this.internal.write("endobj")}function YDe(){this.internal.__metadata__.metadataObjectNumber&&this.internal.write("/Metadata "+this.internal.__metadata__.metadataObjectNumber+" 0 R")}(function(t){var e,n,r,i,s,a,o,l,c,u=function(z){return z=z||{},this.isStrokeTransparent=z.isStrokeTransparent||!1,this.strokeOpacity=z.strokeOpacity||1,this.strokeStyle=z.strokeStyle||"#000000",this.fillStyle=z.fillStyle||"#000000",this.isFillTransparent=z.isFillTransparent||!1,this.fillOpacity=z.fillOpacity||1,this.font=z.font||"10px sans-serif",this.textBaseline=z.textBaseline||"alphabetic",this.textAlign=z.textAlign||"left",this.lineWidth=z.lineWidth||1,this.lineJoin=z.lineJoin||"miter",this.lineCap=z.lineCap||"butt",this.path=z.path||[],this.transform=z.transform!==void 0?z.transform.clone():new l,this.globalCompositeOperation=z.globalCompositeOperation||"normal",this.globalAlpha=z.globalAlpha||1,this.clip_path=z.clip_path||[],this.currentPoint=z.currentPoint||new a,this.miterLimit=z.miterLimit||10,this.lastPoint=z.lastPoint||new a,this.lineDashOffset=z.lineDashOffset||0,this.lineDash=z.lineDash||[],this.margin=z.margin||[0,0,0,0],this.prevPageLastElemOffset=z.prevPageLastElemOffset||0,this.ignoreClearRect=typeof z.ignoreClearRect!="boolean"||z.ignoreClearRect,this};t.events.push(["initialized",function(){this.context2d=new d(this),e=this.internal.f2,n=this.internal.getCoordinateString,r=this.internal.getVerticalCoordinateString,i=this.internal.getHorizontalCoordinate,s=this.internal.getVerticalCoordinate,a=this.internal.Point,o=this.internal.Rectangle,l=this.internal.Matrix,c=new u}]);var d=function(z){Object.defineProperty(this,"canvas",{get:function(){return{parentNode:!1,style:!1}}});var J=z;Object.defineProperty(this,"pdf",{get:function(){return J}});var Y=!1;Object.defineProperty(this,"pageWrapXEnabled",{get:function(){return Y},set:function(re){Y=!!re}});var de=!1;Object.defineProperty(this,"pageWrapYEnabled",{get:function(){return de},set:function(re){de=!!re}});var fe=0;Object.defineProperty(this,"posX",{get:function(){return fe},set:function(re){isNaN(re)||(fe=re)}});var me=0;Object.defineProperty(this,"posY",{get:function(){return me},set:function(re){isNaN(re)||(me=re)}}),Object.defineProperty(this,"margin",{get:function(){return c.margin},set:function(re){var Ye;typeof re=="number"?Ye=[re,re,re,re]:((Ye=new Array(4))[0]=re[0],Ye[1]=re.length>=2?re[1]:Ye[0],Ye[2]=re.length>=3?re[2]:Ye[0],Ye[3]=re.length>=4?re[3]:Ye[1]),c.margin=Ye}});var Ce=!1;Object.defineProperty(this,"autoPaging",{get:function(){return Ce},set:function(re){Ce=re}});var Ee=0;Object.defineProperty(this,"lastBreak",{get:function(){return Ee},set:function(re){Ee=re}});var Ae=[];Object.defineProperty(this,"pageBreaks",{get:function(){return Ae},set:function(re){Ae=re}}),Object.defineProperty(this,"ctx",{get:function(){return c},set:function(re){re instanceof u&&(c=re)}}),Object.defineProperty(this,"path",{get:function(){return c.path},set:function(re){c.path=re}});var De=[];Object.defineProperty(this,"ctxStack",{get:function(){return De},set:function(re){De=re}}),Object.defineProperty(this,"fillStyle",{get:function(){return this.ctx.fillStyle},set:function(re){var Ye;Ye=f(re),this.ctx.fillStyle=Ye.style,this.ctx.isFillTransparent=Ye.a===0,this.ctx.fillOpacity=Ye.a,this.pdf.setFillColor(Ye.r,Ye.g,Ye.b,{a:Ye.a}),this.pdf.setTextColor(Ye.r,Ye.g,Ye.b,{a:Ye.a})}}),Object.defineProperty(this,"strokeStyle",{get:function(){return this.ctx.strokeStyle},set:function(re){var Ye=f(re);this.ctx.strokeStyle=Ye.style,this.ctx.isStrokeTransparent=Ye.a===0,this.ctx.strokeOpacity=Ye.a,Ye.a===0?this.pdf.setDrawColor(255,255,255):(Ye.a,this.pdf.setDrawColor(Ye.r,Ye.g,Ye.b))}}),Object.defineProperty(this,"lineCap",{get:function(){return this.ctx.lineCap},set:function(re){["butt","round","square"].indexOf(re)!==-1&&(this.ctx.lineCap=re,this.pdf.setLineCap(re))}}),Object.defineProperty(this,"lineWidth",{get:function(){return this.ctx.lineWidth},set:function(re){isNaN(re)||(this.ctx.lineWidth=re,this.pdf.setLineWidth(re))}}),Object.defineProperty(this,"lineJoin",{get:function(){return this.ctx.lineJoin},set:function(re){["bevel","round","miter"].indexOf(re)!==-1&&(this.ctx.lineJoin=re,this.pdf.setLineJoin(re))}}),Object.defineProperty(this,"miterLimit",{get:function(){return this.ctx.miterLimit},set:function(re){isNaN(re)||(this.ctx.miterLimit=re,this.pdf.setMiterLimit(re))}}),Object.defineProperty(this,"textBaseline",{get:function(){return this.ctx.textBaseline},set:function(re){this.ctx.textBaseline=re}}),Object.defineProperty(this,"textAlign",{get:function(){return this.ctx.textAlign},set:function(re){["right","end","center","left","start"].indexOf(re)!==-1&&(this.ctx.textAlign=re)}});var Fe=null,Re=null,Je=null;Object.defineProperty(this,"fontFaces",{get:function(){return Je},set:function(re){Fe=null,Re=null,Je=re}}),Object.defineProperty(this,"font",{get:function(){return this.ctx.font},set:function(re){var Ye;if(this.ctx.font=re,(Ye=/^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:\%|in|[cem]m|ex|p[ctx]))(?:\s*\/\s*(normal|[.\d]+(?:\%|in|[cem]m|ex|p[ctx])))?\s*([-_,\"\'\sa-z0-9]+?)\s*$/i.exec(re))!==null){var Mt=Ye[1];Ye[2];var xt=Ye[3],Ue=Ye[4];Ye[5];var St=Ye[6],ot=/^([.\d]+)((?:%|in|[cem]m|ex|p[ctx]))$/i.exec(Ue)[2];Ue=Math.floor(ot==="px"?parseFloat(Ue)*this.pdf.internal.scaleFactor:ot==="em"?parseFloat(Ue)*this.pdf.getFontSize():parseFloat(Ue)*this.pdf.internal.scaleFactor),this.pdf.setFontSize(Ue);var Et=function(ht){var wr,pn,zt=[],Qt=ht.trim();if(Qt==="")return LE;if(Qt in JU)return[JU[Qt]];for(;Qt!=="";){switch(pn=null,wr=(Qt=XU(Qt)).charAt(0)){case'"':case"'":pn=VDe(Qt.substring(1),wr);break;default:pn=qDe(Qt)}if(pn===null||(zt.push(pn[0]),(Qt=XU(pn[1]))!==""&&Qt.charAt(0)!==","))return LE;Qt=Qt.replace(/^,/,"")}return zt}(St);if(this.fontFaces){var mt=function(ht,wr){var pn=ht.getFontList(),zt=JSON.stringify(pn);if(Fe===null||Re!==zt){var Qt=function(Pn){var Nt=[];return Object.keys(Pn).forEach(function(Zn){Pn[Zn].forEach(function(It){var qt=null;switch(It){case"bold":qt={family:Zn,weight:"bold"};break;case"italic":qt={family:Zn,style:"italic"};break;case"bolditalic":qt={family:Zn,weight:"bold",style:"italic"};break;case"":case"normal":qt={family:Zn}}qt!==null&&(qt.ref={name:Zn,style:It},Nt.push(qt))})}),Nt}(pn);Fe=function(Pn){for(var Nt={},Zn=0;Zn<Pn.length;++Zn){var It=IE(Pn[Zn]),qt=It.family,lr=It.stretch,rn=It.style,Tt=It.weight;Nt[qt]=Nt[qt]||{},Nt[qt][lr]=Nt[qt][lr]||{},Nt[qt][lr][rn]=Nt[qt][lr][rn]||{},Nt[qt][lr][rn][Tt]=It}return Nt}(Qt.concat(wr)),Re=zt}return Fe}(this.pdf,this.fontFaces),An=Et.map(function(ht){return{family:ht,stretch:"normal",weight:xt,style:Mt}}),Kt=function(ht,wr,pn){for(var zt=(pn=pn||{}).defaultFontFamily||"times",Qt=Object.assign({},$De,pn.genericFontFamilies||{}),Pn=null,Nt=null,Zn=0;Zn<wr.length;++Zn)if(Qt[(Pn=IE(wr[Zn])).family]&&(Pn.family=Qt[Pn.family]),ht.hasOwnProperty(Pn.family)){Nt=ht[Pn.family];break}if(!(Nt=Nt||ht[zt]))throw new Error("Could not find a font-family for the rule '"+YU(Pn)+"' and default family '"+zt+"'.");if(Nt=function(It,qt){if(qt[It])return qt[It];var lr=MN[It],rn=lr<=MN.normal?-1:1,Tt=KU(qt,eee,lr,rn);if(!Tt)throw new Error("Could not find a matching font-stretch value for "+It);return Tt}(Pn.stretch,Nt),Nt=function(It,qt){if(qt[It])return qt[It];for(var lr=ZZ[It],rn=0;rn<lr.length;++rn)if(qt[lr[rn]])return qt[lr[rn]];throw new Error("Could not find a matching font-style for "+It)}(Pn.style,Nt),!(Nt=function(It,qt){if(qt[It])return qt[It];if(It===400&&qt[500])return qt[500];if(It===500&&qt[400])return qt[400];var lr=zDe[It],rn=KU(qt,tee,lr,It<400?-1:1);if(!rn)throw new Error("Could not find a matching font-weight for value "+It);return rn}(Pn.weight,Nt)))throw new Error("Failed to resolve a font for the rule '"+YU(Pn)+"'.");return Nt}(mt,An);this.pdf.setFont(Kt.ref.name,Kt.ref.style)}else{var At="";(xt==="bold"||parseInt(xt,10)>=700||Mt==="bold")&&(At="bold"),Mt==="italic"&&(At+="italic"),At.length===0&&(At="normal");for(var Jt="",ln={arial:"Helvetica",Arial:"Helvetica",verdana:"Helvetica",Verdana:"Helvetica",helvetica:"Helvetica",Helvetica:"Helvetica","sans-serif":"Helvetica",fixed:"Courier",monospace:"Courier",terminal:"Courier",cursive:"Times",fantasy:"Times",serif:"Times"},nt=0;nt<Et.length;nt++){if(this.pdf.internal.getFont(Et[nt],At,{noFallback:!0,disableWarning:!0})!==void 0){Jt=Et[nt];break}if(At==="bolditalic"&&this.pdf.internal.getFont(Et[nt],"bold",{noFallback:!0,disableWarning:!0})!==void 0)Jt=Et[nt],At="bold";else if(this.pdf.internal.getFont(Et[nt],"normal",{noFallback:!0,disableWarning:!0})!==void 0){Jt=Et[nt],At="normal";break}}if(Jt===""){for(var Ut=0;Ut<Et.length;Ut++)if(ln[Et[Ut]]){Jt=ln[Et[Ut]];break}}Jt=Jt===""?"Times":Jt,this.pdf.setFont(Jt,At)}}}}),Object.defineProperty(this,"globalCompositeOperation",{get:function(){return this.ctx.globalCompositeOperation},set:function(re){this.ctx.globalCompositeOperation=re}}),Object.defineProperty(this,"globalAlpha",{get:function(){return this.ctx.globalAlpha},set:function(re){this.ctx.globalAlpha=re}}),Object.defineProperty(this,"lineDashOffset",{get:function(){return this.ctx.lineDashOffset},set:function(re){this.ctx.lineDashOffset=re,he.call(this)}}),Object.defineProperty(this,"lineDash",{get:function(){return this.ctx.lineDash},set:function(re){this.ctx.lineDash=re,he.call(this)}}),Object.defineProperty(this,"ignoreClearRect",{get:function(){return this.ctx.ignoreClearRect},set:function(re){this.ctx.ignoreClearRect=!!re}})};d.prototype.setLineDash=function(z){this.lineDash=z},d.prototype.getLineDash=function(){return this.lineDash.length%2?this.lineDash.concat(this.lineDash):this.lineDash.slice()},d.prototype.fill=function(){x.call(this,"fill",!1)},d.prototype.stroke=function(){x.call(this,"stroke",!1)},d.prototype.beginPath=function(){this.path=[{type:"begin"}]},d.prototype.moveTo=function(z,J){if(isNaN(z)||isNaN(J))throw pr.error("jsPDF.context2d.moveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to
714jsPDF.context2d.moveTo");var Y=this.ctx.transform.applyToPoint(new a(z,J));this.path.push({type:"mt",x:Y.x,y:Y.y}),this.ctx.lastPoint=new a(z,J)},d.prototype.closePath=function(){var z=new a(0,0),J=0;for(J=this.path.length-1;J!==-1;J--)if(this.path[J].type==="begin"&&sr(this.path[J+1])==="object"&&typeof this.path[J+1].x=="number"){z=new a(this.path[J+1].x,this.path[J+1].y);break}this.path.push({type:"close"}),this.ctx.lastPoint=new a(z.x,z.y)},d.prototype.lineTo=function(z,J){if(isNaN(z)||isNaN(J))throw pr.error("jsPDF.context2d.lineTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.lineTo");var Y=this.ctx.transform.applyToPoint(new a(z,J));this.path.push({type:"lt",x:Y.x,y:Y.y}),this.ctx.lastPoint=new a(Y.x,Y.y)},d.prototype.clip=function(){this.ctx.clip_path=JSON.parse(JSON.stringify(this.path)),x.call(this,null,!0)},d.prototype.quadraticCurveTo=function(z,J,Y,de){if(isNaN(Y)||isNaN(de)||isNaN(z)||isNaN(J))throw pr.error("jsPDF.context2d.quadraticCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.quadraticCurveTo");var fe=this.ctx.transform.applyToPoint(new a(Y,de)),me=this.ctx.transform.applyToPoint(new a(z,J));this.path.push({type:"qct",x1:me.x,y1:me.y,x:fe.x,y:fe.y}),this.ctx.lastPoint=new a(fe.x,fe.y)},d.prototype.bezierCurveTo=function(z,J,Y,de,fe,me){if(isNaN(fe)||isNaN(me)||isNaN(z)||isNaN(J)||isNaN(Y)||isNaN(de))throw pr.error("jsPDF.context2d.bezierCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.bezierCurveTo");var Ce=this.ctx.transform.applyToPoint(new a(fe,me)),Ee=this.ctx.transform.applyToPoint(new a(z,J)),Ae=this.ctx.transform.applyToPoint(new a(Y,de));this.path.push({type:"bct",x1:Ee.x,y1:Ee.y,x2:Ae.x,y2:Ae.y,x:Ce.x,y:Ce.y}),this.ctx.lastPoint=new a(Ce.x,Ce.y)},d.prototype.arc=function(z,J,Y,de,fe,me){if(isNaN(z)||isNaN(J)||isNaN(Y)||isNaN(de)||isNaN(fe))throw pr.error("jsPDF.context2d.arc: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.arc");if(me=!!me,!this.ctx.transform.isIdentity){var Ce=this.ctx.transform.applyToPoint(new a(z,J));z=Ce.x,J=Ce.y;var Ee=this.ctx.transform.applyToPoint(new a(0,Y)),Ae=this.ctx.transform.applyToPoint(new a(0,0));Y=Math.sqrt(Math.pow(Ee.x-Ae.x,2)+Math.pow(Ee.y-Ae.y,2))}Math.abs(fe-de)>=2*Math.PI&&(de=0,fe=2*Math.PI),this.path.push({type:"arc",x:z,y:J,radius:Y,startAngle:de,endAngle:fe,counterclockwise:me})},d.prototype.arcTo=function(z,J,Y,de,fe){throw new Error("arcTo not implemented.")},d.prototype.rect=function(z,J,Y,de){if(isNaN(z)||isNaN(J)||isNaN(Y)||isNaN(de))throw pr.error("jsPDF.context2d.rect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rect");this.moveTo(z,J),this.lineTo(z+Y,J),this.lineTo(z+Y,J+de),this.lineTo(z,J+de),this.lineTo(z,J),this.lineTo(z+Y,J),this.lineTo(z,J)},d.prototype.fillRect=function(z,J,Y,de){if(isNaN(z)||isNaN(J)||isNaN(Y)||isNaN(de))throw pr.error("jsPDF.context2d.fillRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.fillRect");if(!h.call(this)){var fe={};this.lineCap!=="butt"&&(fe.lineCap=this.lineCap,this.lineCap="butt"),this.lineJoin!=="miter"&&(fe.lineJoin=this.lineJoin,this.lineJoin="miter"),this.beginPath(),this.rect(z,J,Y,de),this.fill(),fe.hasOwnProperty("lineCap")&&(this.lineCap=fe.lineCap),fe.hasOwnProperty("lineJoin")&&(this.lineJoin=fe.lineJoin)}},d.prototype.strokeRect=function(z,J,Y,de){if(isNaN(z)||isNaN(J)||isNaN(Y)||isNaN(de))throw pr.error("jsPDF.context2d.strokeRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeRect");p.call(this)||(this.beginPath(),this.rect(z,J,Y,de),this.stroke())},d.prototype.clearRect=function(z,J,Y,de){if(isNaN(z)||isNaN(J)||isNaN(Y)||isNaN(de))throw pr.error("jsPDF.context2d.clearRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.clearRect");this.ignoreClearRect||(this.fillStyle="#ffffff",this.fillRect(z,J,Y,de))},d.prototype.save=function(z){z=typeof z!="boolean"||z;for(var J=this.pdf.internal.getCurrentPageInfo().pageNumber,Y=0;Y<this.pdf.internal.getNumberOfPages();Y++)this.pdf.setPage(Y+1),this.pdf.internal.out("q");
vendor: 4,190 bytes, line 714
714if(this.pdf.setPage(J),z){this.ctx.fontSize=this.pdf.internal.getFontSize();var de=new u(this.ctx);this.ctxStack.push(this.ctx),this.ctx=de}},d.prototype.restore=function(z){z=typeof z!="boolean"||z;for(var J=this.pdf.internal.getCurrentPageInfo().pageNumber,Y=0;Y<this.pdf.internal.getNumberOfPages();Y++)this.pdf.setPage(Y+1),this.pdf.internal.out("Q");this.pdf.setPage(J),z&&this.ctxStack.length!==0&&(this.ctx=this.ctxStack.pop(),this.fillStyle=this.ctx.fillStyle,this.strokeStyle=this.ctx.strokeStyle,this.font=this.ctx.font,this.lineCap=this.ctx.lineCap,this.lineWidth=this.ctx.lineWidth,this.lineJoin=this.ctx.lineJoin,this.lineDash=this.ctx.lineDash,this.lineDashOffset=this.ctx.lineDashOffset)},d.prototype.toDataURL=function(){throw new Error("toDataUrl not implemented.")};var f=function(z){var J,Y,de,fe;if(z.isCanvasGradient===!0&&(z=z.getColor()),!z)return{r:0,g:0,b:0,a:0,style:z};if(/transparent|rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*0+\s*\)/.test(z))J=0,Y=0,de=0,fe=0;else{var me=/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(z);if(me!==null)J=parseInt(me[1]),Y=parseInt(me[2]),de=parseInt(me[3]),fe=1;else if((me=/rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)/.exec(z))!==null)J=parseInt(me[1]),Y=parseInt(me[2]),de=parseInt(me[3]),fe=parseFloat(me[4]);else{if(fe=1,typeof z=="string"&&z.charAt(0)!=="#"){var Ce=new GZ(z);z=Ce.ok?Ce.toHex():"#000000"}z.length===4?(J=z.substring(1,2),J+=J,Y=z.substring(2,3),Y+=Y,de=z.substring(3,4),de+=de):(J=z.substring(1,3),Y=z.substring(3,5),de=z.substring(5,7)),J=parseInt(J,16),Y=parseInt(Y,16),de=parseInt(de,16)}}return{r:J,g:Y,b:de,a:fe,style:z}},h=function(){return this.ctx.isFillTransparent||this.globalAlpha==0},p=function(){return!!(this.ctx.isStrokeTransparent||this.globalAlpha==0)};d.prototype.fillText=function(z,J,Y,de){if(isNaN(J)||isNaN(Y)||typeof z!="string")throw pr.error("jsPDF.context2d.fillText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.fillText");if(de=isNaN(de)?void 0:de,!h.call(this)){var fe=V(this.ctx.transform.rotation),me=this.ctx.transform.scaleX;j.call(this,{text:z,x:J,y:Y,scale:me,angle:fe,align:this.textAlign,maxWidth:de})}},d.prototype.strokeText=function(z,J,Y,de){if(isNaN(J)||isNaN(Y)||typeof z!="string")throw pr.error("jsPDF.context2d.strokeText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeText");if(!p.call(this)){de=isNaN(de)?void 0:de;var fe=V(this.ctx.transform.rotation),me=this.ctx.transform.scaleX;j.call(this,{text:z,x:J,y:Y,scale:me,renderingMode:"stroke",angle:fe,align:this.textAlign,maxWidth:de})}},d.prototype.measureText=function(z){if(typeof z!="string")throw pr.error("jsPDF.context2d.measureText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.measureText");var J=this.pdf,Y=this.pdf.internal.scaleFactor,de=J.internal.getFontSize(),fe=J.getStringUnitWidth(z)*de/J.internal.scaleFactor;return new function(me){var Ce=(me=me||{}).width||0;return Object.defineProperty(this,"width",{get:function(){return Ce}}),this}({width:fe*=Math.round(96*Y/72*1e4)/1e4})},d.prototype.scale=function(z,J){if(isNaN(z)||isNaN(J))throw pr.error("jsPDF.context2d.scale: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.scale");var Y=new l(z,0,0,J,0,0);this.ctx.transform=this.ctx.transform.multiply(Y)},d.prototype.rotate=function(z){if(isNaN(z))throw pr.error("jsPDF.context2d.rotate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rotate");var J=new l(Math.cos(z),Math.sin(z),-Math.sin(z),Math.cos(z),0,0);this.ctx.transform=this.ctx.transform.multiply(J)},d.prototype.translate=function(z,J){if(isNaN(z)||isNaN(J))throw pr.error("jsPDF.context2d.translate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.translate");var Y=new l(1,0,0,1,z,J);this.ctx.transform=this.ctx.transform.multiply(Y)},d.prototype.transform=function(z,J,Y,de,fe,me){if(isNaN(z)||isNaN(J)||isNaN(Y)||isNaN(de)||isNaN(fe)||isNaN(me))throw pr.error("jsPDF.context2d.transform: Invalid arguments",arguments),new Error("Invalid arguments passed to
714jsPDF.context2d.transform");var Ce=new l(z,J,Y,de,fe,me);this.ctx.transform=this.ctx.transform.multiply(Ce)},d.prototype.setTransform=function(z,J,Y,de,fe,me){z=isNaN(z)?1:z,J=isNaN(J)?0:J,Y=isNaN(Y)?0:Y,de=isNaN(de)?1:de,fe=isNaN(fe)?0:fe,me=isNaN(me)?0:me,this.ctx.transform=new l(z,J,Y,de,fe,me)};var m=function(){return this.margin[0]>0||this.margin[1]>0||this.margin[2]>0||this.margin[3]>0};d.prototype.drawImage=function(z,J,Y,de,fe,me,Ce,Ee,Ae){var De=this.pdf.getImageProperties(z),Fe=1,Re=1,Je=1,re=1;de!==void 0&&Ee!==void 0&&(Je=Ee/de,re=Ae/fe,Fe=De.width/de*Ee/de,Re=De.height/fe*Ae/fe),me===void 0&&(me=J,Ce=Y,J=0,Y=0),de!==void 0&&Ee===void 0&&(Ee=de,Ae=fe),de===void 0&&Ee===void 0&&(Ee=De.width,Ae=De.height);var Ye=this.ctx.transform.decompose(),Mt=V(Ye.rotate.shx),xt=new l,Ue=(xt=(xt=(xt=xt.multiply(Ye.translate)).multiply(Ye.skew)).multiply(Ye.scale)).applyToRectangle(new o(me-J*Je,Ce-Y*re,de*Fe,fe*Re));if(this.autoPaging){for(var St,ot=g.call(this,Ue),Et=[],mt=0;mt<ot.length;mt+=1)Et.indexOf(ot[mt])===-1&&Et.push(ot[mt]);b(Et);for(var An=Et[0],Kt=Et[Et.length-1],At=An;At<Kt+1;At++){this.pdf.setPage(At);var Jt=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],ln=At===1?this.posY+this.margin[0]:this.margin[0],nt=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],Ut=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],ht=At===1?0:nt+(At-2)*Ut;if(this.ctx.clip_path.length!==0){var wr=this.path;St=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=_(St,this.posX+this.margin[3],-ht+ln+this.ctx.prevPageLastElemOffset),T.call(this,"fill",!0),this.path=wr}var pn=JSON.parse(JSON.stringify(Ue));pn=_([pn],this.posX+this.margin[3],-ht+ln+this.ctx.prevPageLastElemOffset)[0];var zt=(At>An||At<Kt)&&m.call(this);zt&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],Jt,Ut,null).clip().discardPath()),this.pdf.addImage(z,"JPEG",pn.x,pn.y,pn.w,pn.h,null,null,Mt),zt&&this.pdf.restoreGraphicsState()}}else this.pdf.addImage(z,"JPEG",Ue.x,Ue.y,Ue.w,Ue.h,null,null,Mt)};var g=function(z,J,Y){var de=[];J=J||this.pdf.internal.pageSize.width,Y=Y||this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2];var fe=this.posY+this.ctx.prevPageLastElemOffset;switch(z.type){default:case"mt":case"lt":de.push(Math.floor((z.y+fe)/Y)+1);break;case"arc":de.push(Math.floor((z.y+fe-z.radius)/Y)+1),de.push(Math.floor((z.y+fe+z.radius)/Y)+1);break;case"qct":var me=q(this.ctx.lastPoint.x,this.ctx.lastPoint.y,z.x1,z.y1,z.x,z.y);de.push(Math.floor((me.y+fe)/Y)+1),de.push(Math.floor((me.y+me.h+fe)/Y)+1);break;case"bct":var Ce=se(this.ctx.lastPoint.x,this.ctx.lastPoint.y,z.x1,z.y1,z.x2,z.y2,z.x,z.y);de.push(Math.floor((Ce.y+fe)/Y)+1),de.push(Math.floor((Ce.y+Ce.h+fe)/Y)+1);break;case"rect":de.push(Math.floor((z.y+fe)/Y)+1),de.push(Math.floor((z.y+z.h+fe)/Y)+1)}for(var Ee=0;Ee<de.length;Ee+=1)for(;this.pdf.internal.getNumberOfPages()<de[Ee];)v.call(this);return de},v=function(){var z=this.fillStyle,J=this.strokeStyle,Y=this.font,de=this.lineCap,fe=this.lineWidth,me=this.lineJoin;this.pdf.addPage(),this.fillStyle=z,this.strokeStyle=J,this.font=Y,this.lineCap=de,this.lineWidth=fe,this.lineJoin=me},_=function(z,J,Y){for(var de=0;de<z.length;de++)switch(z[de].type){case"bct":z[de].x2+=J,z[de].y2+=Y;case"qct":z[de].x1+=J,z[de].y1+=Y;default:z[de].x+=J,z[de].y+=Y}return z},b=function(z){return z.sort(function(J,Y){return J-Y})},x=function(z,J){var Y=this.fillStyle,de=this.strokeStyle,fe=this.lineCap,me=this.lineWidth,Ce=Math.abs(me*this.ctx.transform.scaleX),Ee=this.lineJoin;if(this.autoPaging){for(var Ae,De,Fe=JSON.parse(JSON.stringify(this.path)),Re=JSON.parse(JSON.stringify(this.path)),Je=[],re=0;re<Re.length;re++)if(Re[re].x!==void 0)for(var Ye=g.call(this,Re[re]),Mt=0;Mt<Ye.length;Mt+=1)Je.indexOf(Ye[Mt])===-1&&Je.push(Ye[Mt]);for(var xt=0;xt<Je.length;xt++)for(;this.pdf.internal.getNumberOfPages()<Je[xt];)v.call(this);b(Je);for(var Ue=Je[0],St=Je[Je.length-1],ot=Ue;ot<St+1;ot++){this.pdf.setPage(ot),this.fillStyle=Y,this.strokeStyle=de,this.lineCap=fe,this.lineWidth=Ce,this.lineJoin=Ee;var Et=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],mt=ot===1?this.posY+this.margin[0]:this.margin[0],An=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],Kt=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],At=ot===1?0:An+(ot-2)*Kt;if(this.ctx.clip_path.length!==0){var Jt=this.path;Ae=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=_(Ae,this.posX+this.margin[3],-At+mt+this.ctx.prevPageLastElemOffset),T.call(this,z,!0),this.path=Jt}if(De=JSON.parse(JSON.stringify(Fe)),this.path=_(De,this.posX+this.margin[3],-At+mt+this.ctx.prevPageLastElemOffset),J===!1||ot===0){var ln=(ot>Ue||ot<St)&&m.call(this);ln&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],Et,Kt,null).clip().discardPath()),T.call(this,z,J),ln&&this.pdf.restoreGraphicsState()}this.lineWidth=me}this.path=Fe}else this.lineWidth=Ce,T.call(this,z,J),this.lineWidth=me},T=function(z,J){if((z!=="stroke"||J||!p.call(this))&&(z==="stroke"||J||!h.call(this))){for(var Y,de,fe=[],me=this.path,Ce=0;Ce<me.length;Ce++){var Ee=me[Ce];switch(Ee.type){case"begin":fe.push({begin:!0}
vendor: 43,928 bytes, lines 714-722
714);break;case"close":fe.push({close:!0});break;case"mt":fe.push({start:Ee,deltas:[],abs:[]});break;case"lt":var Ae=fe.length;if(me[Ce-1]&&!isNaN(me[Ce-1].x)&&(Y=[Ee.x-me[Ce-1].x,Ee.y-me[Ce-1].y],Ae>0)){for(;Ae>=0;Ae--)if(fe[Ae-1].close!==!0&&fe[Ae-1].begin!==!0){fe[Ae-1].deltas.push(Y),fe[Ae-1].abs.push(Ee);break}}break;case"bct":Y=[Ee.x1-me[Ce-1].x,Ee.y1-me[Ce-1].y,Ee.x2-me[Ce-1].x,Ee.y2-me[Ce-1].y,Ee.x-me[Ce-1].x,Ee.y-me[Ce-1].y],fe[fe.length-1].deltas.push(Y);break;case"qct":var De=me[Ce-1].x+2/3*(Ee.x1-me[Ce-1].x),Fe=me[Ce-1].y+2/3*(Ee.y1-me[Ce-1].y),Re=Ee.x+2/3*(Ee.x1-Ee.x),Je=Ee.y+2/3*(Ee.y1-Ee.y),re=Ee.x,Ye=Ee.y;Y=[De-me[Ce-1].x,Fe-me[Ce-1].y,Re-me[Ce-1].x,Je-me[Ce-1].y,re-me[Ce-1].x,Ye-me[Ce-1].y],fe[fe.length-1].deltas.push(Y);break;case"arc":fe.push({deltas:[],abs:[],arc:!0}),Array.isArray(fe[fe.length-1].abs)&&fe[fe.length-1].abs.push(Ee)}}de=J?null:z==="stroke"?"stroke":"fill";for(var Mt=!1,xt=0;xt<fe.length;xt++)if(fe[xt].arc)for(var Ue=fe[xt].abs,St=0;St<Ue.length;St++){var ot=Ue[St];ot.type==="arc"?L.call(this,ot.x,ot.y,ot.radius,ot.startAngle,ot.endAngle,ot.counterclockwise,void 0,J,!Mt):$.call(this,ot.x,ot.y),Mt=!0}else if(fe[xt].close===!0)this.pdf.internal.out("h"),Mt=!1;else if(fe[xt].begin!==!0){var Et=fe[xt].start.x,mt=fe[xt].start.y;U.call(this,fe[xt].deltas,Et,mt),Mt=!0}de&&M.call(this,de),J&&B.call(this)}},N=function(z){var J=this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor,Y=J*(this.pdf.internal.getLineHeightFactor()-1);switch(this.ctx.textBaseline){case"bottom":return z-Y;case"top":return z+J-Y;case"hanging":return z+J-2*Y;case"middle":return z+J/2-Y;default:return z}},A=function(z){return z+this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor*(this.pdf.internal.getLineHeightFactor()-1)};d.prototype.createLinearGradient=function(){var z=function(){};return z.colorStops=[],z.addColorStop=function(J,Y){this.colorStops.push([J,Y])},z.getColor=function(){return this.colorStops.length===0?"#000000":this.colorStops[0][1]},z.isCanvasGradient=!0,z},d.prototype.createPattern=function(){return this.createLinearGradient()},d.prototype.createRadialGradient=function(){return this.createLinearGradient()};var L=function(z,J,Y,de,fe,me,Ce,Ee,Ae){for(var De=ne.call(this,Y,de,fe,me),Fe=0;Fe<De.length;Fe++){var Re=De[Fe];Fe===0&&(Ae?R.call(this,Re.x1+z,Re.y1+J):$.call(this,Re.x1+z,Re.y1+J)),te.call(this,z,J,Re.x2,Re.y2,Re.x3,Re.y3,Re.x4,Re.y4)}Ee?B.call(this):M.call(this,Ce)},M=function(z){switch(z){case"stroke":this.pdf.internal.out("S");break;case"fill":this.pdf.internal.out("f")}},B=function(){this.pdf.clip(),this.pdf.discardPath()},R=function(z,J){this.pdf.internal.out(n(z)+" "+r(J)+" m")},j=function(z){var J;switch(z.align){case"right":case"end":J="right";break;case"center":J="center";break;default:J="left"}var Y,de,fe,me=this.pdf.getTextDimensions(z.text),Ce=N.call(this,z.y),Ee=A.call(this,Ce)-me.h,Ae=this.ctx.transform.applyToPoint(new a(z.x,Ce));if(this.autoPaging){var De=this.ctx.transform.decompose(),Fe=new l;Fe=(Fe=(Fe=Fe.multiply(De.translate)).multiply(De.skew)).multiply(De.scale);for(var Re=this.ctx.transform.applyToRectangle(new o(z.x,Ce,me.w,me.h)),Je=Fe.applyToRectangle(new o(z.x,Ee,me.w,me.h)),re=g.call(this,Je),Ye=[],Mt=0;Mt<re.length;Mt+=1)Ye.indexOf(re[Mt])===-1&&Ye.push(re[Mt]);b(Ye);for(var xt=Ye[0],Ue=Ye[Ye.length-1],St=xt;St<Ue+1;St++){this.pdf.setPage(St);var ot=St===1?this.posY+this.margin[0]:this.margin[0],Et=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],mt=this.pdf.internal.pageSize.height-this.margin[2],An=mt-this.margin[0],Kt=this.pdf.internal.pageSize.width-this.margin[1],At=Kt-this.margin[3],Jt=St===1?0:Et+(St-2)*An;if(this.ctx.clip_path.length!==0){var ln=this.path;Y=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=_(Y,this.posX+this.margin[3],-1*Jt+ot),T.call(this,"fill",!0),this.path=ln}var nt=_([JSON.parse(JSON.stringify(Je))],this.posX+this.margin[3],-Jt+ot+this.ctx.prevPageLastElemOffset)[0];z.scale>=.01&&(de=this.pdf.internal.getFontSize(),this.pdf.setFontSize(de*z.scale),fe=this.lineWidth,this.lineWidth=fe*z.scale);var Ut=this.autoPaging!=="text";if(Ut||nt.y+nt.h<=mt){if(Ut||nt.y>=ot&&nt.x<=Kt){var ht=Ut?z.text:this.pdf.splitTextToSize(z.text,z.maxWidth||Kt-nt.x)[0],wr=_([JSON.parse(JSON.stringify(Re))],this.posX+this.margin[3],-Jt+ot+this.ctx.prevPageLastElemOffset)[0],pn=Ut&&(St>xt||St<Ue)&&m.call(this);pn&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],At,An,null).clip().discardPath()),this.pdf.text(ht,wr.x,wr.y,{angle:z.angle,align:J,renderingMode:z.renderingMode}),pn&&this.pdf.restoreGraphicsState()}}else nt.y<mt&&(this.ctx.prevPageLastElemOffset+=mt-nt.y);z.scale>=.01&&(this.pdf.setFontSize(de),this.lineWidth=fe)}}else z.scale>=.01&&(de=this.pdf.internal.getFontSize(),this.pdf.setFontSize(de*z.scale),fe=this.lineWidth,this.lineWidth=fe*z.scale),this.pdf.text(z.text,Ae.x+this.posX,Ae.y+this.posY,{angle:z.angle,align:J,renderingMode:z.renderingMode,maxWidth:z.maxWidth}),z.scale>=.01&&(this.pdf.setFontSize(de),this.lineWidth=fe)},$=function(z,J,Y,de){Y=Y||0,de=de||0,this.pdf.internal.out(n(z+Y)+" "+r(J+de)+" l")},U=function(z,J,Y){return this.pdf.lines(z,J,Y,null,null)},te=function(z,J,Y,de,fe,me,Ce,Ee){this.pdf.internal.out([e(i(Y+z)),e(s(de+J)),e(i(fe+z)),e(s(me+J)),e(i(Ce+z)),e(s(Ee+J)),"c"].join(" "))},ne=function(z,J,Y,de){for(var fe=2*Math.PI,me=Math.PI/2;J>Y;)J-=fe;var Ce=Math.abs(Y-J);Ce<fe&&de&&(Ce=fe-Ce);for(var Ee=[],Ae=de?-1:1,De=J;Ce>1e-5;){var Fe=De+Ae*Math.min(Ce,me);Ee.push(le.call(this,z,De,Fe)),Ce-=Math.abs(Fe-De),De=Fe}return Ee},le=function(z,J,Y){var de=(Y-J)/2,fe=z*Math.cos(de),me=z*Math.sin(de),Ce=fe,Ee=-me,Ae=Ce*Ce+Ee*Ee,De=Ae+Ce*fe+Ee*me,Fe=4/3*(Math.sqrt(2*Ae*De)-De)/(Ce*me-Ee*fe),Re=Ce-Fe*Ee,Je=Ee+Fe*Ce,re=Re,Ye=-Je,Mt=de+J,xt=Math.cos(Mt),Ue=Math.sin(Mt);return{x1:z*Math.cos(J),y1:z*Math.sin(J),x2:Re*xt-Je*Ue,y2:Re*Ue+Je*xt,x3:re*xt-Ye*Ue,y3:re*Ue+Ye*xt,x4:z*Math.cos(Y),y4:z*Math.sin(Y)}},V=function(z){return 180*z/Math.PI},q=function(z,J,Y,de,fe,me){var Ce=z+.5*(Y-z),Ee=J+.5*(de-J),Ae=fe+.5*(Y-fe),De=me+.5*(de-me),Fe=Math.min(z,fe,Ce,Ae),Re=Math.max(z,fe,Ce,Ae),Je=Math.min(J,me,Ee,De),re=Math.max(J,me,Ee,De);return new o(Fe,Je,Re-Fe,re-Je)},se=function(z,J,Y,de,fe,me,Ce,Ee){var Ae,De,Fe,Re,Je,re,Ye,Mt,xt,Ue,St,ot,Et,mt,An=Y-z,Kt=de-J,At=fe-Y,Jt=me-de,ln=Ce-fe,nt=Ee-me;for(De=0;De<41;De++)xt=(Ye=(Fe=z+(Ae=De/40)*An)+Ae*((Je=Y+Ae*At)-Fe))+Ae*(Je+Ae*(fe+Ae*ln-Je)-Ye),Ue=(Mt=(Re=J+Ae*Kt)+Ae*((re=de+Ae*Jt)-Re))+Ae*(re+Ae*(me+Ae*nt-re)-Mt),De==0?(St=xt,ot=Ue,Et=xt,mt=Ue):(St=Math.min(St,xt),ot=Math.min(ot,Ue),Et=Math.max(Et,xt),mt=Math.max(mt,Ue));return new o(Math.round(St),Math.round(ot),Math.round(Et-St),Math.round(mt-ot))},he=function(){if(this.prevLineDash||this.ctx.lineDash.length||this.ctx.lineDashOffset){var z,J,Y=(z=this.ctx.lineDash,J=this.ctx.lineDashOffset,JSON.stringify({lineDash:z,lineDashOffset:J}));this.prevLineDash!==Y&&(this.pdf.setLineDash(this.ctx.lineDash,this.ctx.lineDashOffset),this.prevLineDash=Y)}}})(Rt.API),function(t){var e=function(a){var o,l,c,u,d,f,h,p,m,g;for(l=[],c=0,u=(a+=o="\0\0\0\0".slice(a.length%4||4)).length;u>c;c+=4)(d=(a.charCodeAt(c)<<24)+(a.charCodeAt(c+1)<<16)+(a.charCodeAt(c+2)<<8)+a.charCodeAt(c+3))!==0?(f=(d=((d=((d=((d=(d-(g=d%85))/85)-(m=d%85))/85)-(p=d%85))/85)-(h=d%85))/85)%85,l.push(f+33,h+33,p+33,m+33,g+33)):l.push(122);return function(v,_){for(var b=_;b>0;b--)v.pop()}(l,o.length),String.fromCharCode.apply(String,l)+"~>"},n=function(a){var o,l,c,u,d,f=String,h="length",p=255,m="charCodeAt",g="slice",v="replace";for(a[g](-2),a=a[g](0,-2)[v](/\s/g,"")[v]("z","!!!!!"),c=[],u=0,d=(a+=o="uuuuu"[g](a[h]%5||5))[h];d>u;u+=5)l=52200625*(a[m](u)-33)+614125*(a[m](u+1)-33)+7225*(a[m](u+2)-33)+85*(a[m](u+3)-33)+(a[m](u+4)-33),c.push(p&l>>24,p&l>>16,p&l>>8,p&l);return function(_,b){for(var x=b;x>0;x--)_.pop()}(c,o[h]),f.fromCharCode.apply(f,c)},r=function(a){return a.split("").map(function(o){return("0"+o.charCodeAt().toString(16)).slice(-2)}).join("")+">"},i=function(a){var o=new RegExp(/^([0-9A-Fa-f]{2})+$/);if((a=a.replace(/\s/g,"")).indexOf(">")!==-1&&(a=a.substr(0,a.indexOf(">"))),a.length%2&&(a+="0"),o.test(a)===!1)return"";for(var l="",c=0;c<a.length;c+=2)l+=String.fromCharCode("0x"+(a[c]+a[c+1]));return l},s=function(a){for(var o=new Uint8Array(a.length),l=a.length;l--;)o[l]=a.charCodeAt(l);return(o=vN(o)).reduce(function(c,u){return c+String.fromCharCode(u)},"")};t.processDataByFilters=function(a,o){var l=0,c=a||"",u=[];for(typeof(o=o||[])=="string"&&(o=[o]),l=0;l<o.length;l+=1)switch(o[l]){case"ASCII85Decode":case"/ASCII85Decode":c=n(c),u.push("/ASCII85Encode");break;case"ASCII85Encode":case"/ASCII85Encode":c=e(c),u.push("/ASCII85Decode");break;case"ASCIIHexDecode":case"/ASCIIHexDecode":c=i(c),u.push("/ASCIIHexEncode");break;case"ASCIIHexEncode":case"/ASCIIHexEncode":c=r(c),u.push("/ASCIIHexDecode");break;case"FlateEncode":case"/FlateEncode":c=s(c),u.push("/FlateDecode");break;default:throw new Error('The filter: "'+o[l]+'" is not implemented')}return{data:c,reverseChain:u.reverse().join(" ")}}}(Rt.API),function(t){t.loadFile=function(e,n,r){return function(i,s,a){s=s!==!1,a=typeof a=="function"?a:function(){};var o=void 0;try{o=function(l,c,u){var d=new XMLHttpRequest,f=0,h=function(p){var m=p.length,g=[],v=String.fromCharCode;for(f=0;f<m;f+=1)g.push(v(255&p.charCodeAt(f)));return g.join("")};if(d.open("GET",l,!c),d.overrideMimeType("text/plain; charset=x-user-defined"),c===!1&&(d.onload=function(){d.status===200?u(h(this.responseText)):u(void 0)}),d.send(null),c&&d.status===200)return h(d.responseText)}(i,s,a)}catch{}return o}(e,n,r)},t.allowFsRead=void 0,t.loadImageFile=t.loadFile}(Rt.API),function(t){function e(){return(Yt.html2canvas?Promise.resolve(Yt.html2canvas):cE(()=>import("./html2canvas.esm-CBrSDip1.js"),[])).catch(function(o){return Promise.reject(new Error("Could not load html2canvas: "+o))}).then(function(o){return o.default?o.default:o})}function n(){return(Yt.DOMPurify?Promise.resolve(Yt.DOMPurify):cE(()=>import("./purify.es-dhnUglUx.js"),[])).catch(function(o){return Promise.reject(new Error("Could not load dompurify: "+o))}).then(function(o){return o.default?o.default:o})}var r=function(o){var l=sr(o);return l==="undefined"?"undefined":l==="string"||o instanceof String?"string":l==="number"||o instanceof Number?"number":l==="function"||o instanceof Function?"function":o&&o.constructor===Array?"array":o&&o.nodeType===1?"element":l==="object"?"object":"unknown"},i=function(o,l){var c=document.createElement(o);for(var u in l.className&&(c.className=l.className),l.innerHTML&&l.dompurify&&(c.innerHTML=l.dompurify.sanitize(l.innerHTML)),l.style)c.style[u]=l.style[u];return c},s=function o(l,c){for(var u=l.nodeType===3?document.createTextNode(l.nodeValue):l.cloneNode(!1),d=l.firstChild;d;d=d.nextSibling)c!==!0&&d.nodeType===1&&d.nodeName==="SCRIPT"||u.appendChild(o(d,c));return l.nodeType===1&&(l.nodeName==="CANVAS"?(u.width=l.width,u.height=l.height,u.getContext("2d").drawImage(l,0,0)):l.nodeName!=="TEXTAREA"&&l.nodeName!=="SELECT"||(u.value=l.value),u.addEventListener("load",function(){u.scrollTop=l.scrollTop,u.scrollLeft=l.scrollLeft},!0)),u},a=function o(l){var c=Object.assign(o.convert(Promise.resolve()),JSON.parse(JSON.stringify(o.template))),u=o.convert(Promise.resolve(),c);return(u=u.setProgress(1,o,1,[o])).set(l)};(a.prototype=Object.create(Promise.prototype)).constructor=a,a.convert=function(o,l){return o.__proto__=l||a.prototype,o},a.template={prop:{src:null,container:null,overlay:null,canvas:null,img:null,pdf:null,pageSize:null,callback:function(){}},progress:{val:0,state:null,n:0,stack:[]},opt:{filename:"file.pdf",margin:[0,0,0,0],enableLinks:!0,x:0,y:0,html2canvas:{},jsPDF:{},backgroundColor:"transparent"}},a.prototype.from=function(o,l){return this.then(function(){switch(l=l||function(c){switch(r(c)){case"string":return"string";case"element":return c.nodeName.toLowerCase()==="canvas"?"canvas":"element";default:return"unknown"}}(o),l){case"string":return this.then(n).then(function(c){return this.set({src:i("div",{innerHTML:o,dompurify:c})})});case"element":return this.set({src:o});case"canvas":return this.set({canvas:o});case"img":return this.set({img:o});default:return this.error("Unknown source type.")}})},a.prototype.to=function(o){switch(o){case"container":return this.toContainer();case"canvas":return this.toCanvas();case"img":return this.toImg();case"pdf":return this.toPdf();default:return this.error("Invalid target.")}},a.prototype.toContainer=function(){return this.thenList([function(){return this.prop.src||this.error("Cannot duplicate - no source HTML.")},function(){return this.prop.pageSize||this.setPageSize()}]).then(function(){var o={position:"relative",display:"inline-block",width:(typeof this.opt.width!="number"||isNaN(this.opt.width)||typeof this.opt.windowWidth!="number"||isNaN(this.opt.windowWidth)?Math.max(this.prop.src.clientWidth,this.prop.src.scrollWidth,this.prop.src.offsetWidth):this.opt.windowWidth)+"px",left:0,right:0,top:0,margin:"auto",backgroundColor:this.opt.backgroundColor},l=s(this.prop.src,this.opt.html2canvas.javascriptEnabled);l.tagName==="BODY"&&(o.height=Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)+"px"),this.prop.overlay=i("div",{className:"html2pdf__overlay",style:{position:"fixed",overflow:"hidden",zIndex:1e3,left:"-100000px",right:0,bottom:0,top:0}}),this.prop.container=i("div",{className:"html2pdf__container",style:o}),this.prop.container.appendChild(l),this.prop.container.firstChild.appendChild(i("div",{style:{clear:"both",border:"0 none transparent",margin:0,padding:0,height:0}})),this.prop.container.style.float="none",this.prop.overlay.appendChild(this.prop.container),document.body.appendChild(this.prop.overlay),this.prop.container.firstChild.style.position="relative",this.prop.container.height=Math.max(this.prop.container.firstChild.clientHeight,this.prop.container.firstChild.scrollHeight,this.prop.container.firstChild.offsetHeight)+"px"})},a.prototype.toCanvas=function(){var o=[function(){return document.body.contains(this.prop.container)||this.toContainer()}];return this.thenList(o).then(e).then(function(l){var c=Object.assign({},this.opt.html2canvas);return delete c.onrendered,l(this.prop.container,c)}).then(function(l){(this.opt.html2canvas.onrendered||function(){})(l),this.prop.canvas=l,document.body.removeChild(this.prop.overlay)})},a.prototype.toContext2d=function(){var o=[function(){return document.body.contains(this.prop.container)||this.toContainer()}];return this.thenList(o).then(e).then(function(l){var c=this.opt.jsPDF,u=this.opt.fontFaces,d=typeof this.opt.width!="number"||isNaN(this.opt.width)||typeof this.opt.windowWidth!="number"||isNaN(this.opt.windowWidth)?1:this.opt.width/this.opt.windowWidth,f=Object.assign({async:!0,allowTaint:!0,scale:d,scrollX:this.opt.scrollX||0,scrollY:this.opt.scrollY||0,backgroundColor:"#ffffff",imageTimeout:15e3,logging:!0,proxy:null,removeContainer:!0,foreignObjectRendering:!1,useCORS:!1},this.opt.html2canvas);if(delete f.onrendered,c.context2d.autoPaging=this.opt.autoPaging===void 0||this.opt.autoPaging,c.context2d.posX=this.opt.x,c.context2d.posY=this.opt.y,c.context2d.margin=this.opt.margin,c.context2d.fontFaces=u,u)for(var h=0;h<u.length;++h){var p=u[h],m=p.src.find(function(g){return g.format==="truetype"});m&&c.addFont(m.url,p.ref.name,p.ref.style)}return f.windowHeight=f.windowHeight||0,f.windowHeight=f.windowHeight==0?Math.max(this.prop.container.clientHeight,this.prop.container.scrollHeight,this.prop.container.offsetHeight):f.windowHeight,c.context2d.save(!0),l(this.prop.container,f)}).then(function(l){this.opt.jsPDF.context2d.restore(!0),(this.opt.html2canvas.onrendered||function(){})(l),this.prop.canvas=l,document.body.removeChild(this.prop.overlay)})},a.prototype.toImg=function(){return this.thenList([function(){return this.prop.canvas||this.toCanvas()}]).then(function(){var o=this.prop.canvas.toDataURL("image/"+this.opt.image.type,this.opt.image.quality);this.prop.img=document.createElement("img"),this.prop.img.src=o})},a.prototype.toPdf=function(){return this.thenList([function(){return this.toContext2d()}]).then(function(){this.prop.pdf=this.prop.pdf||this.opt.jsPDF})},a.prototype.output=function(o,l,c){return(c=c||"pdf").toLowerCase()==="img"||c.toLowerCase()==="image"?this.outputImg(o,l):this.outputPdf(o,l)},a.prototype.outputPdf=function(o,l){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then(function(){return this.prop.pdf.output(o,l)})},a.prototype.outputImg=function(o){return this.thenList([function(){return this.prop.img||this.toImg()}]).then(function(){switch(o){case void 0:case"img":return this.prop.img;case"datauristring":case"dataurlstring":return this.prop.img.src;case"datauri":case"dataurl":return document.location.href=this.prop.img.src;default:throw'Image output type "'+o+'" is not supported.'}})},a.prototype.save=function(o){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).set(o?{filename:o}:null).then(function(){this.prop.pdf.save(this.opt.filename)})},a.prototype.doCallback=function(){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then(function(){this.prop.callback(this.prop.pdf)})},a.prototype.set=function(o){if(r(o)!=="object")return this;var l=Object.keys(o||{}).map(function(c){if(c in a.template.prop)return function(){this.prop[c]=o[c]};switch(c){case"margin":return this.setMargin.bind(this,o.margin);case"jsPDF":return function(){return this.opt.jsPDF=o.jsPDF,this.setPageSize()};case"pageSize":return this.setPageSize.bind(this,o.pageSize);default:return function(){this.opt[c]=o[c]}}},this);return this.then(function(){return this.thenList(l)})},a.prototype.get=function(o,l){return this.then(function(){var c=o in a.template.prop?this.prop[o]:this.opt[o];return l?l(c):c})},a.prototype.setMargin=function(o){return this.then(function(){switch(r(o)){case"number":o=[o,o,o,o];case"array":if(o.length===2&&(o=[o[0],o[1],o[0],o[1]]),o.length===4)break;default:return this.error("Invalid margin array.")}this.opt.margin=o}).then(this.setPageSize)},a.prototype.setPageSize=function(o){function l(c,u){return Math.floor(c*u/72*96)}return this.then(function(){(o=o||Rt.getPageSize(this.opt.jsPDF)).hasOwnProperty("inner")||(o.inner={width:o.width-this.opt.margin[1]-this.opt.margin[3],height:o.height-this.opt.margin[0]-this.opt.margin[2]},o.inner.px={width:l(o.inner.width,o.k),height:l(o.inner.height,o.k)},o.inner.ratio=o.inner.height/o.inner.width),this.prop.pageSize=o})},a.prototype.setProgress=function(o,l,c,u){return o!=null&&(this.progress.val=o),l!=null&&(this.progress.state=l),c!=null&&(this.progress.n=c),u!=null&&(this.progress.stack=u),this.progress.ratio=this.progress.val/this.progress.state,this},a.prototype.updateProgress=function(o,l,c,u){return this.setProgress(o?this.progress.val+o:null,l||null,c?this.progress.n+c:null,u?this.progress.stack.concat(u):null)},a.prototype.then=function(o,l){var c=this;return this.thenCore(o,l,function(u,d){return c.updateProgress(null,null,1,[u]),Promise.prototype.then.call(this,function(f){return c.updateProgress(null,u),f}).then(u,d).then(function(f){return c.updateProgress(1),f})})},a.prototype.thenCore=function(o,l,c){c=c||Promise.prototype.then;var u=this;o&&(o=o.bind(u)),l&&(l=l.bind(u));var d=Promise.toString().indexOf("[native code]")!==-1&&Promise.name==="Promise"?u:a.convert(Object.assign({},u),Promise.prototype),f=c.call(d,o,l);return a.convert(f,u.__proto__)},a.prototype.thenExternal=function(o,l){return Promise.prototype.then.call(this,o,l)},a.prototype.thenList=function(o){var l=this;return o.forEach(function(c){l=l.thenCore(c)}),l},a.prototype.catch=function(o){o&&(o=o.bind(this));var l=Promise.prototype.catch.call(this,o);return a.convert(l,this)},a.prototype.catchExternal=function(o){return Promise.prototype.catch.call(this,o)},a.prototype.error=function(o){return this.then(function(){throw new Error(o)})},a.prototype.using=a.prototype.set,a.prototype.saveAs=a.prototype.save,a.prototype.export=a.prototype.output,a.prototype.run=a.prototype.then,Rt.getPageSize=function(o,l,c){if(sr(o)==="object"){var u=o;o=u.orientation,l=u.unit||l,c=u.format||c}l=l||"mm",c=c||"a4",o=(""+(o||"P")).toLowerCase();var d,f=(""+c).toLowerCase(),h={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};switch(l){case"pt":d=1;break;case"mm":d=72/25.4;break;case"cm":d=72/2.54;break;case"in":d=72;break;case"px":d=.75;break;case"pc":case"em":d=12;break;case"ex":d=6;break;default:throw"Invalid unit: "+l}var p,m=0,g=0;if(h.hasOwnProperty(f))m=h[f][1]/d,g=h[f][0]/d;else try{m=c[1],g=c[0]}catch{throw new Error("Invalid format: "+c)}if(o==="p"||o==="portrait")o="p",g>m&&(p=g,g=m,m=p);else{if(o!=="l"&&o!=="landscape")throw"Invalid orientation: "+o;o="l",m>g&&(p=g,g=m,m=p)}return{width:g,height:m,unit:l,k:d,orientation:o}},t.html=function(o,l){(l=l||{}).callback=l.callback||function(){},l.html2canvas=l.html2canvas||{},l.html2canvas.canvas=l.html2canvas.canvas||this.canvas,l.jsPDF=l.jsPDF||this,l.fontFaces=l.fontFaces?l.fontFaces.map(IE):null;var c=new a(l);return l.worker?c:c.from(o).doCallback()}}(Rt.API),Rt.API.addJS=function(t){var e,n,r=function(i){for(var s="",a=0;a<i.length;a++){var o=i[a];if(o==="("||o===")"){for(var l=0,c=a-1;c>=0&&i[c]==="\\";c--)l++;s+=l%2==0?"\\"+o:o}else s+=o}return s}(t);return this.internal.events.subscribe("postPutResources",function(){e=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/Names [(EmbeddedJS) "+(e+1)+" 0 R]"),this.internal.out(">>"),this.internal.out("endobj"),n=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/S /JavaScript"),this.internal.out("/JS ("+r+")"),this.internal.out(">>"),this.internal.out("endobj")}),this.internal.events.subscribe("putCatalog",function(){e!==void 0&&n!==void 0&&this.internal.out("/Names <</JavaScript "+e+" 0 R>>")}),this},function(t){var e;t.events.push(["postPutResources",function(){var n=this,r=/^(\d+) 0 obj$/;if(this.outline.root.children.length>0)for(var i=n.outline.render().split(/\r\n/),s=0;s<i.length;s++){var a=i[s],o=r.exec(a);if(o!=null){var l=o[1];n.internal.newObjectDeferredBegin(l,!1)}n.internal.write(a)}if(this.outline.createNamedDestinations){var c=this.internal.pages.length,u=[];for(s=0;s<c;s++){var d=n.internal.newObject();u.push(d);var f=n.internal.getPageInfo(s+1);n.internal.write("<< /D["+f.objId+" 0 R /XYZ null null null]>> endobj")}var h=n.internal.newObject();for(n.internal.write("<< /Names [ "),s=0;s<u.length;s++)n.internal.write("(page_"+(s+1)+")"+u[s]+" 0 R");n.internal.write(" ] >>","endobj"),e=n.internal.newObject(),n.internal.write("<< /Dests "+h+" 0 R"),n.internal.write(">>","endobj")}}]),t.events.push(["putCatalog",function(){var n=this;n.outline.root.children.length>0&&(n.internal.write("/Outlines",this.outline.makeRef(this.outline.root)),this.outline.createNamedDestinations&&n.internal.write("/Names "+e+" 0 R"))}]),t.events.push(["initialized",function(){var n=this;n.outline={createNamedDestinations:!1,root:{children:[]}},n.outline.add=function(r,i,s){var a={title:i,options:s,children:[]};return r==null&&(r=this.root),r.children.push(a),a},n.outline.render=function(){return this.ctx={},this.ctx.val="",this.ctx.pdf=n,this.genIds_r(this.root),this.renderRoot(this.root),this.renderItems(this.root),this.ctx.val},n.outline.genIds_r=function(r){r.id=n.internal.newObjectDeferred();for(var i=0;i<r.children.length;i++)this.genIds_r(r.children[i])},n.outline.renderRoot=function(r){this.objStart(r),this.line("/Type /Outlines"),r.children.length>0&&(this.line("/First "+this.makeRef(r.children[0])),this.line("/Last "+this.makeRef(r.children[r.children.length-1]))),this.line("/Count "+this.count_r({count:0},r)),this.objEnd()},n.outline.renderItems=function(r){for(var i=this.ctx.pdf.internal.getVerticalCoordinateString,s=0;s<r.children.length;s++){var a=r.children[s];this.objStart(a),this.line("/Title "+this.makeString(a.title)),this.line("/Parent "+this.makeRef(r)),s>0&&this.line("/Prev "+this.makeRef(r.children[s-1])),s<r.children.length-1&&this.line("/Next "+this.makeRef(r.children[s+1])),a.children.length>0&&(this.line("/First "+this.makeRef(a.children[0])),this.line("/Last "+this.makeRef(a.children[a.children.length-1])));var o=this.count=this.count_r({count:0},a);if(o>0&&this.line("/Count "+o),a.options&&a.options.pageNumber){var l=n.internal.getPageInfo(a.options.pageNumber);this.line("/Dest ["+l.objId+" 0 R /XYZ 0 "+i(0)+" 0]")}this.objEnd()}for(var c=0;c<r.children.length;c++)this.renderItems(r.children[c])},n.outline.line=function(r){this.ctx.val+=r+`\r 715`},n.outline.makeRef=function(r){return r.id+" 0 R"},n.outline.makeString=function(r){return"("+n.internal.pdfEscape(r)+")"},n.outline.objStart=function(r){this.ctx.val+=`\r 716`+r.id+` 0 obj\r 717<<\r 718`},n.outline.objEnd=function(){this.ctx.val+=`>> \r 719endobj\r 720`},n.outline.count_r=function(r,i){for(var s=0;s<i.children.length;s++)r.count++,this.count_r(r,i.children[s]);return r.count}}])}(Rt.API),function(t){var e=[192,193,194,195,196,197,198,199];t.processJPEG=function(n,r,i,s,a,o){var l,c=this.decode.DCT_DECODE,u=null;if(typeof n=="string"||this.__addimage__.isArrayBuffer(n)||this.__addimage__.isArrayBufferView(n)){switch(n=a||n,n=this.__addimage__.isArrayBuffer(n)?new Uint8Array(n):n,l=function(d){for(var f,h=256*d.charCodeAt(4)+d.charCodeAt(5),p=d.length,m={width:0,height:0,numcomponents:1},g=4;g<p;g+=2){if(g+=h,e.indexOf(d.charCodeAt(g+1))!==-1){f=256*d.charCodeAt(g+5)+d.charCodeAt(g+6),m={width:256*d.charCodeAt(g+7)+d.charCodeAt(g+8),height:f,numcomponents:d.charCodeAt(g+9)};break}h=256*d.charCodeAt(g+2)+d.charCodeAt(g+3)}return m}(n=this.__addimage__.isArrayBufferView(n)?this.__addimage__.arrayBufferToBinaryString(n):n),l.numcomponents){case 1:o=this.color_spaces.DEVICE_GRAY;break;case 4:o=this.color_spaces.DEVICE_CMYK;break;case 3:o=this.color_spaces.DEVICE_RGB}u={data:n,width:l.width,height:l.height,colorSpace:o,bitsPerComponent:8,filter:c,index:r,alias:i}}return u}}(Rt.API),Rt.API.processPNG=function(t,e,n,r){if(this.__addimage__.isArrayBuffer(t)&&(t=new Uint8Array(t)),this.__addimage__.isArrayBufferView(t)){var i,s=EDe(t,{checkCrc:!0}),a=s.width,o=s.height,l=s.channels,c=s.palette,u=s.depth;i=c&&l===1?function(L){for(var M=L.width,B=L.height,R=L.data,j=L.palette,$=L.depth,U=!1,te=[],ne=[],le=void 0,V=!1,q=0,se=0;se<j.length;se++){var he=HB(j[se],4),z=he[0],J=he[1],Y=he[2],de=he[3];te.push(z,J,Y),de!=null&&(de===0?(q++,ne.length<1&&ne.push(se)):de<255&&(V=!0))}if(V||q>1){U=!0,ne=void 0;var fe=M*B;le=new Uint8Array(fe);for(var me=new DataView(R.buffer),Ce=0;Ce<fe;Ce++){var Ee=OE(me,Ce,$),Ae=HB(j[Ee],4)[3];le[Ce]=Ae}}else q===0&&(ne=void 0);return{colorSpace:"Indexed",colorsPerPixel:1,sMaskBitsPerComponent:U?8:void 0,colorBytes:R,alphaBytes:le,needSMask:U,palette:te,mask:ne}}(s):l===2||l===4?function(L){for(var M=L.data,B=L.width,R=L.height,j=L.channels,$=L.depth,U=j===2?"DeviceGray":"DeviceRGB",te=j-1,ne=B*R,le=te,V=ne*le,q=1*ne,se=Math.ceil(V*$/8),he=Math.ceil(q*$/8),z=new Uint8Array(se),J=new Uint8Array(he),Y=new DataView(M.buffer),de=new DataView(z.buffer),fe=new DataView(J.buffer),me=!1,Ce=0;Ce<ne;Ce++){for(var Ee=Ce*j,Ae=0;Ae<le;Ae++)a7(de,OE(Y,Ee+Ae,$),Ce*le+Ae,$);var De=OE(Y,Ee+le,$);De<(1<<$)-1&&(me=!0),a7(fe,De,1*Ce,$)}return{colorSpace:U,colorsPerPixel:te,sMaskBitsPerComponent:me?$:void 0,colorBytes:z,alphaBytes:J,needSMask:me}}(s):function(L){var M=L.data,B=L.channels===1?"DeviceGray":"DeviceRGB";return{colorSpace:B,colorsPerPixel:B==="DeviceGray"?1:3,colorBytes:M instanceof Uint16Array?function(R){for(var j=R.length,$=new Uint8Array(2*j),U=new DataView($.buffer,$.byteOffset,$.byteLength),te=0;te<j;te++)U.setUint16(2*te,R[te],!1);return $}(M):M,needSMask:!1}}(s);var d,f,h,p=i,m=p.colorSpace,g=p.colorsPerPixel,v=p.sMaskBitsPerComponent,_=p.colorBytes,b=p.alphaBytes,x=p.needSMask,T=p.palette,N=p.mask,A=null;return r!==Rt.API.image_compression.NONE&&typeof vN=="function"?(A=function(L){var M;switch(L){case Rt.API.image_compression.FAST:M=11;break;case Rt.API.image_compression.MEDIUM:M=13;break;case Rt.API.image_compression.SLOW:M=14;break;default:M=12}return M}(r),d=this.decode.FLATE_DECODE,f="/Predictor ".concat(A," /Colors ").concat(g," /BitsPerComponent ").concat(u," /Columns ").concat(a),t=t7(_,Math.ceil(a*g*u/8),g,u,r),x&&(h=t7(b,Math.ceil(a*v/8),1,v,r))):(d=void 0,f=void 0,t=_,x&&(h=b)),(this.__addimage__.isArrayBuffer(t)||this.__addimage__.isArrayBufferView(t))&&(t=this.__addimage__.arrayBufferToBinaryString(t)),(h&&this.__addimage__.isArrayBuffer(h)||this.__addimage__.isArrayBufferView(h))&&(h=this.__addimage__.arrayBufferToBinaryString(h)),{alias:n,data:t,index:e,filter:d,decodeParameters:f,transparency:N,palette:T,sMask:h,predictor:A,width:a,height:o,bitsPerComponent:u,sMaskBitsPerComponent:v,colorSpace:m}}},function(t){t.processGIF89A=function(e,n,r,i){var s=new KDe(e),a=s.width,o=s.height,l=[];s.decodeAndBlitFrameRGBA(0,l);var c={data:l,width:a,height:o},u=new DE(100).encode(c,100);return t.processJPEG.call(this,u,n,r,i)},t.processGIF87A=t.processGIF89A}(Rt.API),Sl.prototype.parseHeader=function(){if(this.fileSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.reserved=this.datav.getUint32(this.pos,!0),this.pos+=4,this.offset=this.datav.getUint32(this.pos,!0),this.pos+=4,this.headerSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.width=this.datav.getUint32(this.pos,!0),this.pos+=4,this.height=this.datav.getInt32(this.pos,!0),this.pos+=4,this.planes=this.datav.getUint16(this.pos,!0),this.pos+=2,this.bitPP=this.datav.getUint16(this.pos,!0),this.pos+=2,this.compress=this.datav.getUint32(this.pos,!0),this.pos+=4,this.rawSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.hr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.vr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.colors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.importantColors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.bitPP===16&&this.is_with_alpha&&(this.bitPP=15),this.bitPP<15){var t=this.colors===0?1<<this.bitPP:this.colors;this.palette=new Array(t);for(var e=0;e<t;e++){var n=this.datav.getUint8(this.pos++,!0),r=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),s=this.datav.getUint8(this.pos++,!0);this.palette[e]={red:i,green:r,blue:n,quad:s}}}this.height<0&&(this.height*=-1,this.bottom_up=!1)},Sl.prototype.parseBGR=function(){this.pos=this.offset;var t="bit"+this.bitPP,e=this.width*this.height*4;if(e>536870912)throw new Error("Image dimensions exceed 512MB, which is too large.");this.data=new Uint8Array(e);try{this[t]()}catch(n){pr.log("bit decode error:"+n)}},Sl.prototype.bit1=function(){var t,e=Math.ceil(this.width/8),n=e%4;for(t=this.height-1;t>=0;t--){for(var r=this.bottom_up?t:this.height-1-t,i=0;i<e;i++)for(var s=this.datav.getUint8(this.pos++,!0),a=r*this.width*4+8*i*4,o=0;o<8&&8*i+o<this.width;o++){var l=this.palette[s>>7-o&1];this.data[a+4*o]=l.blue,this.data[a+4*o+1]=l.green,this.data[a+4*o+2]=l.red,this.data[a+4*o+3]=255}n!==0&&(this.pos+=4-n)}},Sl.prototype.bit4=function(){for(var t=Math.ceil(this.width/2),e=t%4,n=this.height-1;n>=0;n--){for(var r=this.bottom_up?n:this.height-1-n,i=0;i<t;i++){var s=this.datav.getUint8(this.pos++,!0),a=r*this.width*4+2*i*4,o=s>>4,l=15&s,c=this.palette[o];if(this.data[a]=c.blue,this.data[a+1]=c.green,this.data[a+2]=c.red,this.data[a+3]=255,2*i+1>=this.width)break;c=this.palette[l],this.data[a+4]=c.blue,this.data[a+4+1]=c.green,this.data[a+4+2]=c.red,this.data[a+4+3]=255}e!==0&&(this.pos+=4-e)}},Sl.prototype.bit8=function(){for(var t=this.width%4,e=this.height-1;e>=0;e--){for(var n=this.bottom_up?e:this.height-1-e,r=0;r<this.width;r++){var i=this.datav.getUint8(this.pos++,!0),s=n*this.width*4+4*r;if(i<this.palette.length){var a=this.palette[i];this.data[s]=a.red,this.data[s+1]=a.green,this.data[s+2]=a.blue,this.data[s+3]=255}else this.data[s]=255,this.data[s+1]=255,this.data[s+2]=255,this.data[s+3]=255}t!==0&&(this.pos+=4-t)}},Sl.prototype.bit15=function(){for(var t=this.width%3,e=parseInt("11111",2),n=this.height-1;n>=0;n--){for(var r=this.bottom_up?n:this.height-1-n,i=0;i<this.width;i++){var s=this.datav.getUint16(this.pos,!0);this.pos+=2;var a=(s&e)/e*255|0,o=(s>>5&e)/e*255|0,l=(s>>10&e)/e*255|0,c=s>>15?255:0,u=r*this.width*4+4*i;this.data[u]=l,this.data[u+1]=o,this.data[u+2]=a,this.data[u+3]=c}this.pos+=t}},Sl.prototype.bit16=function(){for(var t=this.width%3,e=parseInt("11111",2),n=parseInt("111111",2),r=this.height-1;r>=0;r--){for(var i=this.bottom_up?r:this.height-1-r,s=0;s<this.width;s++){var a=this.datav.getUint16(this.pos,!0);this.pos+=2;var o=(a&e)/e*255|0,l=(a>>5&n)/n*255|0,c=(a>>11)/e*255|0,u=i*this.width*4+4*s;this.data[u]=c,this.data[u+1]=l,this.data[u+2]=o,this.data[u+3]=255}this.pos+=t}},Sl.prototype.bit24=function(){for(var t=this.height-1;t>=0;t--){for(var e=this.bottom_up?t:this.height-1-t,n=0;n<this.width;n++){var r=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),s=this.datav.getUint8(this.pos++,!0),a=e*this.width*4+4*n;this.data[a]=s,this.data[a+1]=i,this.data[a+2]=r,this.data[a+3]=255}this.pos+=this.width%4}},Sl.prototype.bit32=function(){for(var t=this.height-1;t>=0;t--)for(var e=this.bottom_up?t:this.height-1-t,n=0;n<this.width;n++){var r=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),s=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0),o=e*this.width*4+4*n;this.data[o]=s,this.data[o+1]=i,this.data[o+2]=r,this.data[o+3]=a}},Sl.prototype.getData=function(){return this.data},function(t){t.processBMP=function(e,n,r,i){var s=new Sl(e,!1),a=s.width,o=s.height,l={data:s.getData(),width:a,height:o},c=new DE(100).encode(l,100);return t.processJPEG.call(this,c,n,r,i)}}(Rt.API),l7.prototype.getData=function(){return this.data},function(t){t.processWEBP=function(e,n,r,i){var s=new l7(e),a=s.width,o=s.height,l={data:s.getData(),width:a,height:o},c=new DE(100).encode(l,100);return t.processJPEG.call(this,c,n,r,i)}}(Rt.API),Rt.API.processRGBA=function(t,e,n){for(var r=t.data,i=r.length,s=new Uint8Array(i/4*3),a=new Uint8Array(i/4),o=0,l=0,c=0;c<i;c+=4){var u=r[c],d=r[c+1],f=r[c+2],h=r[c+3];s[o++]=u,s[o++]=d,s[o++]=f,a[l++]=h}var p=this.__addimage__.arrayBufferToBinaryString(s);return{alpha:this.__addimage__.arrayBufferToBinaryString(a),data:p,index:e,alias:n,colorSpace:"DeviceRGB",bitsPerComponent:8,width:t.width,height:t.height}},Rt.API.setLanguage=function(t){return this.internal.languageSettings===void 0&&(this.internal.languageSettings={},this.internal.languageSettings.isSubscribed=!1),{af:"Afrikaans",sq:"Albanian",ar:"Arabic (Standard)","ar-DZ":"Arabic (Algeria)","ar-BH":"Arabic (Bahrain)","ar-EG":"Arabic (Egypt)","ar-IQ":"Arabic (Iraq)","ar-JO":"Arabic (Jordan)","ar-KW":"Arabic (Kuwait)","ar-LB":"Arabic (Lebanon)","ar-LY":"Arabic (Libya)","ar-MA":"Arabic (Morocco)","ar-OM":"Arabic (Oman)","ar-QA":"Arabic (Qatar)","ar-SA":"Arabic (Saudi Arabia)","ar-SY":"Arabic (Syria)","ar-TN":"Arabic (Tunisia)","ar-AE":"Arabic (U.A.E.)","ar-YE":"Arabic (Yemen)",an:"Aragonese",hy:"Armenian",as:"Assamese",ast:"Asturian",az:"Azerbaijani",eu:"Basque",be:"Belarusian",bn:"Bengali",bs:"Bosnian",br:"Breton",bg:"Bulgarian",my:"Burmese",ca:"Catalan",ch:"Chamorro",ce:"Chechen",zh:"Chinese","zh-HK":"Chinese (Hong Kong)","zh-CN":"Chinese (PRC)","zh-SG":"Chinese (Singapore)","zh-TW":"Chinese (Taiwan)",cv:"Chuvash",co:"Corsican",cr:"Cree",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch (Standard)","nl-BE":"Dutch (Belgian)",en:"English","en-AU":"English (Australia)","en-BZ":"English (Belize)","en-CA":"English (Canada)","en-IE":"English (Ireland)","en-JM":"English (Jamaica)","en-NZ":"English (New Zealand)","en-PH":"English (Philippines)","en-ZA":"English (South Africa)","en-TT":"English (Trinidad & Tobago)","en-GB":"English (United Kingdom)","en-US":"English (United States)","en-ZW":"English (Zimbabwe)",eo:"Esperanto",et:"Estonian",fo:"Faeroese",fj:"Fijian",fi:"Finnish",fr:"French (Standard)","fr-BE":"French (Belgium)","fr-CA":"French (Canada)","fr-FR":"French (France)","fr-LU":"French (Luxembourg)","fr-MC":"French (Monaco)","fr-CH":"French (Switzerland)",fy:"Frisian",fur:"Friulian",gd:"Gaelic (Scots)","gd-IE":"Gaelic (Irish)",gl:"Galacian",ka:"Georgian",de:"German (Standard)","de-AT":"German (Austria)","de-DE":"German (Germany)","de-LI":"German (Liechtenstein)","de-LU":"German (Luxembourg)","de-CH":"German (Switzerland)",el:"Greek",gu:"Gujurati",ht:"Haitian",he:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",iu:"Inuktitut",ga:"Irish",it:"Italian (Standard)","it-CH":"Italian (Switzerland)",ja:"Japanese",kn:"Kannada",ks:"Kashmiri",kk:"Kazakh",km:"Khmer",ky:"Kirghiz",tlh:"Klingon",ko:"Korean","ko-KP":"Korean (North Korea)","ko-KR":"Korean (South Korea)",la:"Latin",lv:"Latvian",lt:"Lithuanian",lb:"Luxembourgish",mk:"North Macedonia",ms:"Malay",ml:"Malayalam",mt:"Maltese",mi:"Maori",mr:"Marathi",mo:"Moldavian",nv:"Navajo",ng:"Ndonga",ne:"Nepali",no:"Norwegian",nb:"Norwegian (Bokmal)",nn:"Norwegian (Nynorsk)",oc:"Occitan",or:"Oriya",om:"Oromo",fa:"Persian","fa-IR":"Persian/Iran",pl:"Polish",pt:"Portuguese","pt-BR":"Portuguese (Brazil)",pa:"Punjabi","pa-IN":"Punjabi (India)","pa-PK":"Punjabi (Pakistan)",qu:"Quechua",rm:"Rhaeto-Romanic",ro:"Romanian","ro-MO":"Romanian (Moldavia)",ru:"Russian","ru-MO":"Russian (Moldavia)",sz:"Sami (Lappish)",sg:"Sango",sa:"Sanskrit",sc:"Sardinian",sd:"Sindhi",si:"Singhalese",sr:"Serbian",sk:"Slovak",sl:"Slovenian",so:"Somani",sb:"Sorbian",es:"Spanish","es-AR":"Spanish (Argentina)","es-BO":"Spanish (Bolivia)","es-CL":"Spanish (Chile)","es-CO":"Spanish (Colombia)","es-CR":"Spanish (Costa Rica)","es-DO":"Spanish (Dominican Republic)","es-EC":"Spanish (Ecuador)","es-SV":"Spanish (El Salvador)","es-GT":"Spanish (Guatemala)","es-HN":"Spanish (Honduras)","es-MX":"Spanish (Mexico)","es-NI":"Spanish (Nicaragua)","es-PA":"Spanish (Panama)","es-PY":"Spanish (Paraguay)","es-PE":"Spanish (Peru)","es-PR":"Spanish (Puerto Rico)","es-ES":"Spanish (Spain)","es-UY":"Spanish (Uruguay)","es-VE":"Spanish (Venezuela)",sx:"Sutu",sw:"Swahili",sv:"Swedish","sv-FI":"Swedish (Finland)","sv-SV":"Swedish (Sweden)",ta:"Tamil",tt:"Tatar",te:"Teluga",th:"Thai",tig:"Tigre",ts:"Tsonga",tn:"Tswana",tr:"Turkish",tk:"Turkmen",uk:"Ukrainian",hsb:"Upper Sorbian",ur:"Urdu",ve:"Venda",vi:"Vietnamese",vo:"Volapuk",wa:"Walloon",cy:"Welsh",xh:"Xhosa",ji:"Yiddish",zu:"Zulu"}[t]!==void 0&&(this.internal.languageSettings.languageCode=t,this.internal.languageSettings.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){this.internal.write("/Lang ("+this.internal.languageSettings.languageCode+")")}),this.internal.languageSettings.isSubscribed=!0)),this},ag=Rt.API,x2=ag.getCharWidthsArray=function(t,e){var n,r,i=(e=e||{}).font||this.internal.getFont(),s=e.fontSize||this.internal.getFontSize(),a=e.charSpace||this.internal.getCharSpace(),o=e.widths?e.widths:i.metadata.Unicode.widths,l=o.fof?o.fof:1,c=e.kerning?e.kerning:i.metadata.Unicode.kerning,u=c.fof?c.fof:1,d=e.doKerning!==!1,f=0,h=t.length,p=0,m=o[0]||l,g=[];for(n=0;n<h;n++)r=t.charCodeAt(n),typeof i.metadata.widthOfString=="function"?g.push((i.metadata.widthOfGlyph(i.metadata.characterToGlyph(r))+a*(1e3/s)||0)/1e3):(f=d&&sr(c[r])==="object"&&!isNaN(parseInt(c[r][p],10))?c[r][p]/u:0,g.push((o[r]||m)/l+f)),p=r;return g},QU=ag.getStringUnitWidth=function(t,e){var n=(e=e||{}).fontSize||this.internal.getFontSize(),r=e.font||this.internal.getFont(),i=e.charSpace||this.internal.getCharSpace();return ag.processArabic&&(t=ag.processArabic(t)),typeof r.metadata.widthOfString=="function"?r.metadata.widthOfString(t,n,i)/n:x2.apply(this,arguments).reduce(function(s,a){return s+a},0)},ZU=function(t,e,n,r){for(var i=[],s=0,a=t.length,o=0;s!==a&&o+e[s]<n;)o+=e[s],s++;i.push(t.slice(0,s));var l=s;for(o=0;s!==a;)o+e[s]>r&&(i.push(t.slice(l,s)),o=0,l=s),o+=e[s],s++;return l!==s&&i.push(t.slice(l,s)),i},e7=function(t,e,n){n||(n={});var r,i,s,a,o,l,c,u=[],d=[u],f=n.textIndent||0,h=0,p=0,m=t.split(" "),g=x2.apply(this,[" ",n])[0];if(l=n.lineIndent===-1?m[0].length+2:n.lineIndent||0){var v=Array(l).join(" "),_=[];m.map(function(x){(x=x.split(/\s*\n/)).length>1?_=_.concat(x.map(function(T,N){return(N&&T.length?` 721`:"")+T})):_.push(x[0])}),m=_,l=QU.apply(this,[v,n])}for(s=0,a=m.length;s<a;s++){var b=0;if(r=m[s],l&&r[0]==` 722`&&(r=r.substr(1),b=1),f+h+(p=(i=x2.apply(this,[r,n])).reduce(function(x,T){return x+T},0))>e||b){if(p>e){for(o=ZU.apply(this,[r,i,e-(f+h),e]),u.push(o.shift()),u=[o.pop()];o.length;)d.push([o.shift()]);p=i.slice(r.length-(u[0]?u[0].length:0)).reduce(function(x,T){return x+T},0)}else u=[r];d.push(u),f=p+l,h=g}else u.push(r),f+=h+p,h=g}return c=l?function(x,T){return(T?v:"")+x.join(" ")}:function(x){return x.join(" ")},d.map(c)},ag.splitTextToSize=function(t,e,n){var r,i=(n=n||{}).fontSize||this.internal.getFontSize(),s=(function(u){if(u.widths&&u.kerning)return{widths:u.widths,kerning:u.kerning};var d=this.internal.getFont(u.fontName,u.fontStyle),f="Unicode";return d.metadata[f]?{widths:d.metadata[f].widths||{0:1},kerning:d.metadata[f].kerning||{}}:{font:d.metadata,fontSize:this.internal.getFontSize(),charSpace:this.internal.getCharSpace()}}).call(this,n);r=Array.isArray(t)?t:String(t).split(/\r?\n/);var a=1*this.internal.scaleFactor*e/i;s.textIndent=n.textIndent?1*n.textIndent*this.internal.scaleFactor/i:0,s.lineIndent=n.lineIndent;var o,l,c=[];for(o=0,l=r.length;o<l;o++)c=c.concat(e7.apply(this,[r[o],a,s]));return c},function(t){t.__fontmetrics__=t.__fontmetrics__||{};for(var e="0123456789abcdef",n="klmnopqrstuvwxyz",r={},i={},s=0;s<16;s++)r[n[s]]=e[s],i[e[s]]=n[s];var a=function(f){return"0x"+parseInt(f,10).toString(16)},o=t.__fontmetrics__.compress=function(f){var h,p,m,g,v=["{"];for(var _ in f){if(h=f[_],isNaN(parseInt(_,10))?p="'"+_+"'":(_=parseInt(_,10),p=(p=a(_).slice(2)).slice(0,-1)+i[p.slice(-1)]),typeof h=="number")h<0?(m=a(h).slice(3),g="-"):(m=a(h).slice(2),g=""),m=g+m.slice(0,-1)+i[m.slice(-1)];else{if(sr(h)!=="object")throw new Error("Don't know what to do with value type "+sr(h)+".");m=o(h)}v.push(p+m)}return v.push("}"),v.join("")},l=t.__fontmetrics__.uncompress=function(f){if(typeof f!="string")throw new Error("Invalid argument passed to uncompress.");for(var h,p,m,g,v={},_=1,b=v,x=[],T="",N="",A=f.length-1,L=1;L<A;L+=1)(g=f[L])=="'"?h?(m=h.join(""),h=void 0):h=[]:h?h.push(g):g=="{"?(x.push([b,m]),b={},m=void 0):g=="}"?((p=x.pop())[0][p[1]]=b,m=void 0,b=p[0]):g=="-"?_=-1:m===void 0?r.hasOwnProperty(g)?(T+=r[g],m=parseInt(T,16)*_,_=1,T=""):T+=g:r.hasOwnProperty(g)?(N+=r[g],b[m]=parseInt(N,16)*_,_=1,m=void 0,N=""):N+=g;return v},c={codePages:["WinAnsiEncoding"],WinAnsiEncoding:l("{19m8n201n9q201o9r201s9l201t9m201u8m201w9n201x9o201y8o202k8q202l8r202m9p202q8p20aw8k203k8t203t8v203u9v2cq8s212m9t15m8w15n9w2dw9s16k8u16l9u17s9z17x8y17y9y}")},u={Unicode:{Courier:c,"Courier-Bold":c,"Courier-BoldOblique":c,"Courier-Oblique":c,Helvetica:c,"Helvetica-Bold":c,"Helvetica-BoldOblique":c,"Helvetica-Oblique":c,"Times-Roman":c,"Times-Bold":c,"Times-BoldItalic":c,"Times-Italic":c}},d
vendor: 14,693 bytes, line 722
722={Unicode:{"Courier-Oblique":l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-BoldItalic":l("{'widths'{k3o2q4ycx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2r202m2n2n3m2o3m2p5n202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5n4l4m4m4m4n4m4o4s4p4m4q4m4r4s4s4y4t2r4u3m4v4m4w3x4x5t4y4s4z4s5k3x5l4s5m4m5n3r5o3x5p4s5q4m5r5t5s4m5t3x5u3x5v2l5w1w5x2l5y3t5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q2l6r3m6s3r6t1w6u1w6v3m6w1w6x4y6y3r6z3m7k3m7l3m7m2r7n2r7o1w7p3r7q2w7r4m7s3m7t2w7u2r7v2n7w1q7x2n7y3t202l3mcl4mal2ram3man3mao3map3mar3mas2lat4uau1uav3maw3way4uaz2lbk2sbl3t'fof'6obo2lbp3tbq3mbr1tbs2lbu1ybv3mbz3mck4m202k3mcm4mcn4mco4mcp4mcq5ycr4mcs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz2w203k6o212m6o2dw2l2cq2l3t3m3u2l17s3x19m3m}'kerning'{cl{4qu5kt5qt5rs17ss5ts}201s{201ss}201t{cks4lscmscnscoscpscls2wu2yu201ts}201x{2wu2yu}2k{201ts}2w{4qx5kx5ou5qx5rs17su5tu}2x{17su5tu5ou}2y{4qx5kx5ou5qx5rs17ss5ts}'fof'-6ofn{17sw5tw5ou5qw5rs}7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qs}3v{17su5tu5os5qs}7p{17su5tu}ck{4qu5kt5qt5rs17ss5ts}4l{4qu5kt5qt5rs17ss5ts}cm{4qu5kt5qt5rs17ss5ts}cn{4qu5kt5qt5rs17ss5ts}co{4qu5kt5qt5rs17ss5ts}cp{4qu5kt5qt5rs17ss5ts}6l{4qu5ou5qw5rt17su5tu}5q{ckuclucmucnucoucpu4lu}5r{ckuclucmucnucoucpu4lu}7q{cksclscmscnscoscps4ls}6p{4qu5ou5qw5rt17sw5tw}ek{4qu5ou5qw5rt17su5tu}el{4qu5ou5qw5rt17su5tu}em{4qu5ou5qw5rt17su5tu}en{4qu5ou5qw5rt17su5tu}eo{4qu5ou5qw5rt17su5tu}ep{4qu5ou5qw5rt17su5tu}es{17ss5ts5qs4qu}et{4qu5ou5qw5rt17sw5tw}eu{4qu5ou5qw5rt17ss5ts}ev{17ss5ts5qs4qu}6z{17sw5tw5ou5qw5rs}fm{17sw5tw5ou5qw5rs}7n{201ts}fo{17sw5tw5ou5qw5rs}fp{17sw5tw5ou5qw5rs}fq{17sw5tw5ou5qw5rs}7r{cksclscmscnscoscps4ls}fs{17sw5tw5ou5qw5rs}ft{17su5tu}fu{17su5tu}fv{17su5tu}fw{17su5tu}fz{cksclscmscnscoscps4ls}}}"),"Helvetica-Bold":l("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),Courier:l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-BoldOblique":l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Bold":l("{'widths'{k3q2q5ncx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2l202m2n2n3m2o3m2p6o202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5x4l4s4m4m4n4s4o4s4p4m4q3x4r4y4s4y4t2r4u3m4v4y4w4m4x5y4y4s4z4y5k3x5l4y5m4s5n3r5o4m5p4s5q4s5r6o5s4s5t4s5u4m5v2l5w1w5x2l5y3u5z3m6k2l6l3m6m3r6n2w6o3r6p2w6q2l6r3m6s3r6t1w6u2l6v3r6w1w6x5n6y3r6z3m7k3r7l3r7m2w7n2r7o2l7p3r7q3m7r4s7s3m7t3m7u2w7v2r7w1q7x2r7y3o202l3mcl4sal2lam3man3mao3map3mar3mas2lat4uau1yav3maw3tay4uaz2lbk2sbl3t'fof'6obo2lbp3rbr1tbs2lbu2lbv3mbz3mck4s202k3mcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3rek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3m3u2l17s4s19m3m}'kerning'{cl{4qt5ks5ot5qy5rw17sv5tv}201t{cks4lscmscnscoscpscls4wv}2k{201ts}2w{4qu5ku7mu5os5qx5ru17su5tu}2x{17su5tu5ou5qs}2y{4qv5kv7mu5ot5qz5ru17su5tu}'fof'-6o7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qu}3v{17su5tu5os5qu}fu{17su5tu5ou5qu}7p{17su5tu5ou5qu}ck{4qt5ks5ot5qy5rw17sv5tv}4l{4qt5ks5ot5qy5rw17sv5tv}cm{4qt5ks5ot5qy5rw17sv5tv}cn{4qt5ks5ot5qy5rw17sv5tv}co{4qt5ks5ot5qy5rw17sv5tv}cp{4qt5ks5ot5qy5rw17sv5tv}6l{17st5tt5ou5qu}17s{ckuclucmucnucoucpu4lu4wu}5o{ckuclucmucnucoucpu4lu4wu}5q{ckzclzcmzcnzcozcpz4lz4wu}5r{ckxclxcmxcnxcoxcpx4lx4wu}5t{ckuclucmucnucoucpu4lu4wu}7q{ckuclucmucnucoucpu4lu}6p{17sw5tw5ou5qu}ek{17st5tt5qu}el{17st5tt5ou5qu}em{17st5tt5qu}en{17st5tt5qu}eo{17st5tt5qu}ep{17st5tt5ou5qu}es{17ss5ts5qu}et{17sw5tw5ou5qu}eu{17sw5tw5ou5qu}ev{17ss5ts5qu}6z{17sw5tw5ou5qu5rs}fm{17sw5tw5ou5qu5rs}fn{17sw5tw5ou5qu5rs}fo{17sw5tw5ou5qu5rs}fp{17sw5tw5ou5qu5rs}fq{17sw5tw5ou5qu5rs}7r{cktcltcmtcntcotcpt4lt5os}fs{17sw5tw5ou5qu5rs}ft{17su5tu5ou5qu}7m{5os}fv{17su5tu5ou5qu}fw{17su5tu5ou5qu}fz{cksclscmscnscoscps4ls}}}"),Symbol:l("{'widths'{k3uaw4r19m3m2k1t2l2l202m2y2n3m2p5n202q6o3k3m2s2l2t2l2v3r2w1t3m3m2y1t2z1wbk2sbl3r'fof'6o3n3m3o3m3p3m3q3m3r3m3s3m3t3m3u1w3v1w3w3r3x3r3y3r3z2wbp3t3l3m5v2l5x2l5z3m2q4yfr3r7v3k7w1o7x3k}'kerning'{'fof'-6o}}"),Helvetica:l("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}"),"Helvetica-BoldOblique":l("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),ZapfDingbats:l("{'widths'{k4u2k1w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-Bold":l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Italic":l("{'widths'{k3n2q4ycx2l201n3m201o5t201s2l201t2l201u2l201w3r201x3r201y3r2k1t2l2l202m2n2n3m2o3m2p5n202q5t2r1p2s2l2t2l2u3m2v4n2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w4n3x4n3y4n3z3m4k5w4l3x4m3x4n4m4o4s4p3x4q3x4r4s4s4s4t2l4u2w4v4m4w3r4x5n4y4m4z4s5k3x5l4s5m3x5n3m5o3r5p4s5q3x5r5n5s3x5t3r5u3r5v2r5w1w5x2r5y2u5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q1w6r3m6s3m6t1w6u1w6v2w6w1w6x4s6y3m6z3m7k3m7l3m7m2r7n2r7o1w7p3m7q2w7r4m7s2w7t2w7u2r7v2s7w1v7x2s7y3q202l3mcl3xal2ram3man3mao3map3mar3mas2lat4wau1vav3maw4nay4waz2lbk2sbl4n'fof'6obo2lbp3mbq3obr1tbs2lbu1zbv3mbz3mck3x202k3mcm3xcn3xco3xcp3xcq5tcr4mcs3xct3xcu3xcv3xcw2l2m2ucy2lcz2ldl4mdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr4nfs3mft3mfu3mfv3mfw3mfz2w203k6o212m6m2dw2l2cq2l3t3m3u2l17s3r19m3m}'kerning'{cl{5kt4qw}201s{201sw}201t{201tw2wy2yy6q-t}201x{2wy2yy}2k{201tw}2w{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}2x{17ss5ts5os}2y{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}'fof'-6o6t{17ss5ts5qs}7t{5os}3v{5qs}7p{17su5tu5qs}ck{5kt4qw}4l{5kt4qw}cm{5kt4qw}cn{5kt4qw}co{5kt4qw}cp{5kt4qw}6l{4qs5ks5ou5qw5ru17su5tu}17s{2ks}5q{ckvclvcmvcnvcovcpv4lv}5r{ckuclucmucnucoucpu4lu}5t{2ks}6p{4qs5ks5ou5qw5ru17su5tu}ek{4qs5ks5ou5qw5ru17su5tu}el{4qs5ks5ou5qw5ru17su5tu}em{4qs5ks5ou5qw5ru17su5tu}en{4qs5ks5ou5qw5ru17su5tu}eo{4qs5ks5ou5qw5ru17su5tu}ep{4qs5ks5ou5qw5ru17su5tu}es{5ks5qs4qs}et{4qs5ks5ou5qw5ru17su5tu}eu{4qs5ks5qw5ru17su5tu}ev{5ks5qs4qs}ex{17ss5ts5qs}6z{4qv5ks5ou5qw5ru17su5tu}fm{4qv5ks5ou5qw5ru17su5tu}fn{4qv5ks5ou5qw5ru17su5tu}fo{4qv5ks5ou5qw5ru17su5tu}fp{4qv5ks5ou5qw5ru17su5tu}fq{4qv5ks5ou5qw5ru17su5tu}7r{5os}fs{4qv5ks5ou5qw5ru17su5tu}ft{17su5tu5qs}fu{17su5tu5qs}fv{17su5tu5qs}fw{17su5tu5qs}}}"),"Times-Roman":l("{'widths'{k3n2q4ycx2l201n3m201o6o201s2l201t2l201u2l201w2w201x2w201y2w2k1t2l2l202m2n2n3m2o3m2p5n202q6o2r1m2s2l2t2l2u3m2v3s2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v1w3w3s3x3s3y3s3z2w4k5w4l4s4m4m4n4m4o4s4p3x4q3r4r4s4s4s4t2l4u2r4v4s4w3x4x5t4y4s4z4s5k3r5l4s5m4m5n3r5o3x5p4s5q4s5r5y5s4s5t4s5u3x5v2l5w1w5x2l5y2z5z3m6k2l6l2w6m3m6n2w6o3m6p2w6q2l6r3m6s3m6t1w6u1w6v3m6w1w6x4y6y3m6z3m7k3m7l3m7m2l7n2r7o1w7p3m7q3m7r4s7s3m7t3m7u2w7v3k7w1o7x3k7y3q202l3mcl4sal2lam3man3mao3map3mar3mas2lat4wau1vav3maw3say4waz2lbk2sbl3s'fof'6obo2lbp3mbq2xbr1tbs2lbu1zbv3mbz2wck4s202k3mcm4scn4sco4scp4scq5tcr4mcs3xct3xcu3xcv3xcw2l2m2tcy2lcz2ldl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek2wel2wem2wen2weo2wep2weq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr3sfs3mft3mfu3mfv3mfw3mfz3m203k6o212m6m2dw2l2cq2l3t3m3u1w17s4s19m3m}'kerning'{cl{4qs5ku17sw5ou5qy5rw201ss5tw201ws}201s{201ss}201t{ckw4lwcmwcnwcowcpwclw4wu201ts}2k{201ts}2w{4qs5kw5os5qx5ru17sx5tx}2x{17sw5tw5ou5qu}2y{4qs5kw5os5qx5ru17sx5tx}'fof'-6o7t{ckuclucmucnucoucpu4lu5os5rs}3u{17su5tu5qs}3v{17su5tu5qs}7p{17sw5tw5qs}ck{4qs5ku17sw5ou5qy5rw201ss5tw201ws}4l{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cm{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cn{4qs5ku17sw5ou5qy5rw201ss5tw201ws}co{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cp{4qs5ku17sw5ou5qy5rw201ss5tw201ws}6l{17su5tu5os5qw5rs}17s{2ktclvcmvcnvcovcpv4lv4wuckv}5o{ckwclwcmwcnwcowcpw4lw4wu}5q{ckyclycmycnycoycpy4ly4wu5ms}5r{cktcltcmtcntcotcpt4lt4ws}5t{2ktclvcmvcnvcovcpv4lv4wuckv}7q{cksclscmscnscoscps4ls}6p{17su5tu5qw5rs}ek{5qs5rs}el{17su5tu5os5qw5rs}em{17su5tu5os5qs5rs}en{17su5qs5rs}eo{5qs5rs}ep{17su5tu5os5qw5rs}es{5qs}et{17su5tu5qw5rs}eu{17su5tu5qs5rs}ev{5qs}6z{17sv5tv5os5qx5rs}fm{5os5qt5rs}fn{17sv5tv5os5qx5rs}fo{17sv5tv5os5qx5rs}fp{5os5qt5rs}fq{5os5qt5rs}7r{ckuclucmucnucoucpu4lu5os}fs{17sv5tv5os5qx5rs}ft{17ss5ts5qs}fu{17sw5tw5qs}fv{17sw5tw5qs}fw{17ss5ts5qs}fz{ckuclucmucnucoucpu4lu5os5rs}}}"),"Helvetica-Oblique":l("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}")}};
vendor: 9,872 bytes, lines 722-750
722t.events.push(["addFont",function(f){var h=f.font,p=d.Unicode[h.postScriptName];p&&(h.metadata.Unicode={},h.metadata.Unicode.widths=p.widths,h.metadata.Unicode.kerning=p.kerning);var m=u.Unicode[h.postScriptName];m&&(h.metadata.Unicode.encoding=m,h.encoding=m.codePages[0])}])}(Rt.API),function(t){var e=function(n){for(var r=n.length,i=new Uint8Array(r),s=0;s<r;s++)i[s]=n.charCodeAt(s);return i};t.API.events.push(["addFont",function(n){var r=void 0,i=n.font,s=n.instance;if(!i.isStandardFont){if(s===void 0)throw new Error("Font does not exist in vFS, import fonts or remove declaration doc.addFont('"+i.postScriptName+"').");if(typeof(r=s.existsFileInVFS(i.postScriptName)===!1?s.loadFile(i.postScriptName):s.getFileFromVFS(i.postScriptName))!="string")throw new Error("Font is not stored as string-data in vFS, import fonts or remove declaration doc.addFont('"+i.postScriptName+"').");(function(a,o){o=/^\x00\x01\x00\x00/.test(o)?e(o):e(Px(o)),a.metadata=t.API.TTFFont.open(o),a.metadata.Unicode=a.metadata.Unicode||{encoding:{},kerning:{},widths:[]},a.metadata.glyIdsUsed=[0]})(i,r)}}])}(Rt),Rt.API.addSvgAsImage=function(t,e,n,r,i,s,a,o){if(isNaN(e)||isNaN(n))throw pr.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(r)||isNaN(i))throw pr.error("jsPDF.addSvgAsImage: Invalid measurements",arguments),new Error("Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage");var l=document.createElement("canvas");l.width=r,l.height=i;var c=l.getContext("2d");c.fillStyle="#fff",c.fillRect(0,0,l.width,l.height);var u={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},d=this;return(Yt.canvg?Promise.resolve(Yt.canvg):cE(()=>import("./index.es-d12DAP9F.js"),[])).catch(function(f){return Promise.reject(new Error("Could not load canvg: "+f))}).then(function(f){return f.default?f.default:f}).then(function(f){return f.fromString(c,t,u)},function(){return Promise.reject(new Error("Could not load canvg."))}).then(function(f){return f.render(u)}).then(function(){d.addImage(l.toDataURL("image/jpeg",1),e,n,r,i,a,o)})},Rt.API.putTotalPages=function(t){var e,n=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(e=new RegExp(t,"g"),n=this.internal.getNumberOfPages()):(e=new RegExp(this.pdfEscape16(t,this.internal.getFont()),"g"),n=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var r=1;r<=this.internal.getNumberOfPages();r++)for(var i=0;i<this.internal.pages[r].length;i++)this.internal.pages[r][i]=this.internal.pages[r][i].replace(e,n);return this},Rt.API.viewerPreferences=function(t,e){var n;t=t||{},e=e||!1;var r,i,s,a={HideToolbar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideMenubar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideWindowUI:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},FitWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},CenterWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},DisplayDocTitle:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.4},NonFullScreenPageMode:{defaultValue:"UseNone",value:"UseNone",type:"name",explicitSet:!1,valueSet:["UseNone","UseOutlines","UseThumbs","UseOC"],pdfVersion:1.3},Direction:{defaultValue:"L2R",value:"L2R",type:"name",explicitSet:!1,valueSet:["L2R","R2L"],pdfVersion:1.3},ViewArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},ViewClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintScaling:{defaultValue:"AppDefault",value:"AppDefault",type:"name",explicitSet:!1,valueSet:["AppDefault","None"],pdfVersion:1.6},Duplex:{defaultValue:"",value:"none",type:"name",explicitSet:!1,valueSet:["Simplex","DuplexFlipShortEdge","DuplexFlipLongEdge","none"],pdfVersion:1.7},PickTrayByPDFSize:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.7},PrintPageRange:{defaultValue:"",value:"",type:"array",explicitSet:!1,valueSet:null,pdfVersion:1.7},NumCopies:{defaultValue:1,value:1,type:"integer",explicitSet:!1,valueSet:null,pdfVersion:1.7}},o=Object.keys(a),l=[],c=0,u=0,d=0;function f(p,m){var g,v=!1;for(g=0;g<p.length;g+=1)p[g]===m&&(v=!0);return v}if(this.internal.viewerpreferences===void 0&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(a)),this.internal.viewerpreferences.isSubscribed=!1),n=this.internal.viewerpreferences.configuration,t==="reset"||e===!0){var h=o.length;for(d=0;d<h;d+=1)n[o[d]].value=n[o[d]].defaultValue,n[o[d]].explicitSet=!1}if(sr(t)==="object"){for(i in t)if(s=t[i],f(o,i)&&s!==void 0){if(n[i].type==="boolean"&&typeof s=="boolean")n[i].value=s;else if(n[i].type==="name"&&f(n[i].valueSet,s))n[i].value=s;else if(n[i].type==="integer"&&Number.isInteger(s))n[i].value=s;else if(n[i].type==="array"){for(c=0;c<s.length;c+=1)if(r=!0,s[c].length===1&&typeof s[c][0]=="number")l.push(String(s[c]-1));else if(s[c].length>1){for(u=0;u<s[c].length;u+=1)typeof s[c][u]!="number"&&(r=!1);r===!0&&l.push([s[c][0]-1,s[c][1]-1].join(" "))}n[i].value="["+l.join(" ")+"]"}else n[i].value=n[i].defaultValue;n[i].explicitSet=!0}}return this.internal.viewerpreferences.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){var p,m=[];for(p in n)n[p].explicitSet===!0&&(n[p].type==="name"?m.push("/"+p+" /"+n[p].value):m.push("/"+p+" "+n[p].value));m.length!==0&&this.internal.write(`/ViewerPreferences 723<< 724`+m.join(` 725`)+` 726>>`)}),this.internal.viewerpreferences.isSubscribed=!0),this.internal.viewerpreferences.configuration=n,this},Rt.API.addMetadata=function(t,e){return this.internal.__metadata__===void 0&&(this.internal.__metadata__={metadata:t,namespaceUri:e??"http://jspdf.default.namespaceuri/",rawXml:typeof e=="boolean"&&e},this.internal.events.subscribe("putCatalog",YDe),this.internal.events.subscribe("postPutResources",JDe)),this},function(t){var e=t.API,n=e.pdfEscape16=function(s,a){for(var o,l=a.metadata.Unicode.widths,c=["","0","00","000","0000"],u=[""],d=0,f=s.length;d<f;++d){if(o=a.metadata.characterToGlyph(s.charCodeAt(d)),a.metadata.glyIdsUsed.push(o),a.metadata.toUnicode[o]=s.charCodeAt(d),l.indexOf(o)==-1&&(l.push(o),l.push([parseInt(a.metadata.widthOfGlyph(o),10)])),o=="0")return u.join("");o=o.toString(16),u.push(c[4-o.length],o)}return u.join("")},r=function(s){var a,o,l,c,u,d,f;for(u=`/CIDInit /ProcSet findresource begin 72712 dict begin 728begincmap 729/CIDSystemInfo << 730 /Registry (Adobe) 731 /Ordering (UCS) 732 /Supplement 0 733>> def 734/CMapName /Adobe-Identity-UCS def 735/CMapType 2 def 7361 begincodespacerange 737<0000><ffff> 738endcodespacerange`,l=[],d=0,f=(o=Object.keys(s).sort(function(h,p){return h-p})).length;d<f;d++)a=o[d],l.length>=100&&(u+=` 739`+l.length+` beginbfchar 740`+l.join(` 741`)+` 742endbfchar`,l=[]),s[a]!==void 0&&s[a]!==null&&typeof s[a].toString=="function"&&(c=("0000"+s[a].toString(16)).slice(-4),a=("0000"+(+a).toString(16)).slice(-4),l.push("<"+a+"><"+c+">"));return l.length&&(u+=` 743`+l.length+` beginbfchar 744`+l.join(` 745`)+` 746endbfchar 747`),u+`endcmap 748CMapName currentdict /CMap defineresource pop 749end 750end`};e.events.push(["putFont",function(s){(function(a){var o=a.font,l=a.out,c=a.newObject,u=a.putStream;if(o.metadata instanceof t.API.TTFFont&&o.encoding==="Identity-H"){for(var d=o.metadata.Unicode.widths,f=o.metadata.subset.encode(o.metadata.glyIdsUsed,1),h="",p=0;p<f.length;p++)h+=String.fromCharCode(f[p]);var m=c();u({data:h,addLength1:!0,objectId:m}),l("endobj");var g=c();u({data:r(o.metadata.toUnicode),addLength1:!0,objectId:g}),l("endobj");var v=c();l("<<"),l("/Type /FontDescriptor"),l("/FontName /"+yg(o.fontName)),l("/FontFile2 "+m+" 0 R"),l("/FontBBox "+t.API.PDFObject.convert(o.metadata.bbox)),l("/Flags "+o.metadata.flags),l("/StemV "+o.metadata.stemV),l("/ItalicAngle "+o.metadata.italicAngle),l("/Ascent "+o.metadata.ascender),l("/Descent "+o.metadata.decender),l("/CapHeight "+o.metadata.capHeight),l(">>"),l("endobj");var _=c();l("<<"),l("/Type /Font"),l("/BaseFont /"+yg(o.fontName)),l("/FontDescriptor "+v+" 0 R"),l("/W "+t.API.PDFObject.convert(d)),l("/CIDToGIDMap /Identity"),l("/DW 1000"),l("/Subtype /CIDFontType2"),l("/CIDSystemInfo"),l("<<"),l("/Supplement 0"),l("/Registry (Adobe)"),l("/Ordering ("+o.encoding+")"),l(">>"),l(">>"),l("endobj"),o.objectNumber=c(),l("<<"),l("/Type /Font"),l("/Subtype /Type0"),l("/ToUnicode "+g+" 0 R"),l("/BaseFont /"+yg(o.fontName)),l("/Encoding /"+o.encoding),l("/DescendantFonts ["+_+" 0 R]"),l(">>"),l("endobj"),o.isAlreadyPutted=!0}})(s)}]),e.events.push(["putFont",function(s){(function(a){var o=a.font,l=a.out,c=a.newObject,u=a.putStream;if(o.metadata instanceof t.API.TTFFont&&o.encoding==="WinAnsiEncoding"){for(var d=o.metadata.rawData,f="",h=0;h<d.length;h++)f+=String.fromCharCode(d[h]);var p=c();u({data:f,addLength1:!0,objectId:p}),l("endobj");var m=c();u({data:r(o.metadata.toUnicode),addLength1:!0,objectId:m}),l("endobj");var g=c();l("<<"),l("/Descent "+o.metadata.decender),l("/CapHeight "+o.metadata.capHeight),l("/StemV "+o.metadata.stemV),l("/Type /FontDescriptor"),l("/FontFile2 "+p+" 0 R"),l("/Flags 96"),l("/FontBBox "+t.API.PDFObject.convert(o.metadata.bbox)),l("/FontName /"+yg(o.fontName)),l("/ItalicAngle "+o.metadata.italicAngle),l("/Asce
750nt "+o.metadata.ascender),l(">>"),l("endobj"),o.objectNumber=c();for(var v=0;v<o.metadata.hmtx.widths.length;v++)o.metadata.hmtx.widths[v]=parseInt(o.metadata.hmtx.widths[v]*(1e3/o.metadata.head.unitsPerEm));l("<</Subtype/TrueType/Type/Font/ToUnicode "+m+" 0 R/BaseFont/"+yg(o.fontName)+"/FontDescriptor "+g+" 0 R/Encoding/"+o.encoding+" /FirstChar 29 /LastChar 255 /Widths "+t.API.PDFObject.convert(o.metadata.hmtx.widths)+">>"),l("endobj"),o.isAlreadyPutted=!0}})(s)}]);var i=function(s){var a,o=s.text||"",l=s.x,c=s.y,u=s.options||{},d=s.mutex||{},f=d.pdfEscape,h=d.activeFontKey,p=d.fonts,m=h,g="",v=0,_="",b=p[m].encoding;if(p[m].encoding!=="Identity-H")return{text:o,x:l,y:c,options:u,mutex:d};for(_=o,m=h,Array.isArray(o)&&(_=o[0]),v=0;v<_.length;v+=1)p[m].metadata.hasOwnProperty("cmap")&&(a=p[m].metadata.cmap.unicode.codeMap[_[v].charCodeAt(0)]),a||_[v].charCodeAt(0)<256&&p[m].metadata.hasOwnProperty("Unicode")?g+=_[v]:g+="";var x="";return parseInt(m.slice(1))<14||b==="WinAnsiEncoding"?x=f(g,m).split("").map(function(T){return T.charCodeAt(0).toString(16)}).join(""):b==="Identity-H"&&(x=n(g,p[m])),d.isHex=!0,{text:x,x:l,y:c,options:u,mutex:d}};e.events.push(["postProcessText",function(s){var a=s.text||"",o=[],l={text:a,x:s.x,y:s.y,options:s.options,mutex:s.mutex};if(Array.isArray(a)){var c=0;for(c=0;c<a.length;c+=1)Array.isArray(a[c])&&a[c].length===3?o.push([i(Object.assign({},l,{text:a[c][0]})).text,a[c][1],a[c][2]]):o.push(i(Object.assign({},l,{text:a[c]})).text);s.text=o}else s.text=i(Object.assign({},l,{text:a})).text}])}(Rt),function(t){var e=function(){return this.internal.vFS===void 0&&(this.internal.vFS={}),!0};t.existsFileInVFS=function(n){return e.call(this),this.internal.vFS[n]!==void 0},t.addFileToVFS=function(n,r){return e.call(this),this.internal.vFS[n]=r,this},t.getFileFromVFS=function(n){return e.call(this),this.internal.vFS[n]!==void 0?this.internal.vFS[n]:null}}(Rt.API),function(t){t.__bidiEngine__=t.prototype.__bidiEngine__=function(r){var i,s,a,o,l,c,u,d=e,f=[[0,3,0,1,0,0,0],[0,3,0,1,2,2,0],[0,3,0,17,2,0,1],[0,3,5,5,4,1,0],[0,3,21,21,4,0,1],[0,3,5,5,4,2,0]],h=[[2,0,1,1,0,1,0],[2,0,1,1,0,2,0],[2,0,2,1,3,2,0],[2,0,2,33,3,1,1]],p={L:0,R:1,EN:2,AN:3,N:4,B:5,S:6},m={0:0,5:1,6:2,7:3,32:4,251:5,254:6,255:7},g=["(",")","(","<",">","<","[","]","[","{","}","{","«","»","«","â¹","âº","â¹","â
","â","â
","â½","â¾","â½","â","â","â","â¤","â¥","â¤","â©","âª","â©","ï¹","ï¹","ï¹","ï¹","ï¹","ï¹","ï¹","ï¹","ï¹","﹤","ï¹¥","﹤"],v=new RegExp(/^([1-4|9]|1[0-9]|2[0-9]|3[0168]|4[04589]|5[012]|7[78]|159|16[0-9]|17[0-2]|21[569]|22[03489]|250)$/),_=!1,b=0;this.__bidiEngine__={};var x=function(R){var j=R.charCodeAt(),$=j>>8,U=m[$];return U!==void 0?d[256*U+(255&j)]:$===252||$===253?"AL":v.test($)?"L":$===8?"R":"N"},T=function(R){for(var j,$=0;$<R.length;$++){if((j=x(R.charAt($)))==="L")return!1;if(j==="R")return!0}return!1},N=function(R,j,$,U){var te,ne,le,V,q=j[U];switch(q){case"L":case"R":case"LRE":case"RLE":case"LRO":case"RLO":case"PDF":_=!1;break;case"N":case"AN":break;case"EN":_&&(q="AN");break;case"AL":_=!0,q="R";break;case"WS":case"BN":q="N";break;case"CS":U<1||U+1>=j.length||(te=$[U-1])!=="EN"&&te!=="AN"||(ne=j[U+1])!=="EN"&&ne!=="AN"?q="N":_&&(ne="AN"),q=ne===te?ne:"N";break;case"ES":q=(te=U>0?$[U-1]:"B")==="EN"&&U+1<j.length&&j[U+1]==="EN"?"EN":"N";break;case"ET":if(U>0&&$[U-1]==="EN"){q="EN";break}if(_){q="N";break}for(le=U+1,V=j.length;le<V&&j[le]==="ET";)le++;q=le<V&&j[le]==="EN"?"EN":"N";break;case"NSM":if(a&&!o){for(V=j.length,le=U+1;le<V&&j[le]==="NSM";)le++;if(le<V){var se=R[U],he=se>=1425&&se<=2303||se===64286;if(te=j[le],he&&(te==="R"||te==="AL")){q="R";break}}}q=U<1||(te=j[U-1])==="B"?"N":$[U-1];break;case"B":_=!1,i=!0,q=b;break;case"S":s=!0,q="N"}return q},A=function(R,j,$){var U=R.split("");return $&&L(U,$,{hiLevel:b}),U.reverse(),j&&j.reverse(),U.join("")},L=function(R,j,$){var U,te,ne,le,V,q=-1,se=R.length,he=0,z=[],J=b?h:f,Y=[];for(_=!1,i=!1,s=!1,te=0;te<se;te++)Y[te]=x(R[te]);for(ne=0;ne<se;ne++){if(V=he,z[ne]=N(R,Y,z,ne),U=240&(he=J[V][p[z[ne]]]),he&=15,j[ne]=le=J[he][5],U>0)if(U===16){for(te=q;te<ne;te++)j[te]=1;q=-1}else q=-1;if(J[he][6])q===-1&&(q=ne);else if(q>-1){for(te=q;te<ne;te++)j[te]=le;q=-1}Y[ne]==="B"&&(j[ne]=0),$.hiLevel|=le}s&&function(de,fe,me){for(var Ce=0;Ce<me;Ce++)if(de[Ce]==="S"){fe[Ce]=b;
vendor: 30,808 bytes, line 750
750for(var Ee=Ce-1;Ee>=0&&de[Ee]==="WS";Ee--)fe[Ee]=b}}(Y,j,se)},M=function(R,j,$,U,te){if(!(te.hiLevel<R)){if(R===1&&b===1&&!i)return j.reverse(),void($&&$.reverse());for(var ne,le,V,q,se=j.length,he=0;he<se;){if(U[he]>=R){for(V=he+1;V<se&&U[V]>=R;)V++;for(q=he,le=V-1;q<le;q++,le--)ne=j[q],j[q]=j[le],j[le]=ne,$&&(ne=$[q],$[q]=$[le],$[le]=ne);he=V}he++}}},B=function(R,j,$){var U=R.split(""),te={hiLevel:b};return $||($=[]),L(U,$,te),function(ne,le,V){if(V.hiLevel!==0&&u)for(var q,se=0;se<ne.length;se++)le[se]===1&&(q=g.indexOf(ne[se]))>=0&&(ne[se]=g[q+1])}(U,$,te),M(2,U,j,$,te),M(1,U,j,$,te),U.join("")};return this.__bidiEngine__.doBidiReorder=function(R,j,$){if(function(te,ne){if(ne)for(var le=0;le<te.length;le++)ne[le]=le;o===void 0&&(o=T(te)),c===void 0&&(c=T(te))}(R,j),a||!l||c)if(a&&l&&o^c)b=o?1:0,R=A(R,j,$);else if(!a&&l&&c)b=o?1:0,R=B(R,j,$),R=A(R,j);else if(!a||o||l||c){if(a&&!l&&o^c)R=A(R,j),o?(b=0,R=B(R,j,$)):(b=1,R=B(R,j,$),R=A(R,j));else if(a&&o&&!l&&c)b=1,R=B(R,j,$),R=A(R,j);else if(!a&&!l&&o^c){var U=u;o?(b=1,R=B(R,j,$),b=0,u=!1,R=B(R,j,$),u=U):(b=0,R=B(R,j,$),R=A(R,j),b=1,u=!1,R=B(R,j,$),u=U,R=A(R,j))}}else b=0,R=B(R,j,$);else b=o?1:0,R=B(R,j,$);return R},this.__bidiEngine__.setOptions=function(R){R&&(a=R.isInputVisual,l=R.isOutputVisual,o=R.isInputRtl,c=R.isOutputRtl,u=R.isSymmetricSwapping)},this.__bidiEngine__.setOptions(r),this.__bidiEngine__};var e=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","N","ET","ET","ET","ET","N","N","N","N","L","N","N","BN","N","N","ET","ET","EN","EN","N","L","N","N","N","EN","L","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","N","N","N","N","N","ET","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","NSM","R","NSM","NSM","R","NSM","NSM","R","NSM","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","N","N","N","N","N","R","R","R","R","R","N","N","N","N","N","N","N","N","N","N","N","AN","AN","AN","AN","AN","AN","N","N","AL","ET","ET","AL","CS","AL","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","AN","AN","AN","AN","AN","AN","AN","AN","AN","ET","AN","AN","AL","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","N","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","NSM","NSM","N","NSM","NSM","NSM","NSM","AL","AL","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","R","N","N","N","N","R","N","N","N","N","N","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","BN","BN","BN","L","R","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","B","LRE","RLE","PDF","LRO","RLO","CS","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","BN","BN","BN","BN","BN","N","LRI","RLI","FSI","PDI","BN","BN","BN","BN","BN","BN","EN","L","N","N","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","L","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","N","N","N","N","N","R","NSM","R","R","R","R","R","R","R","R","R","R","ES","R","R","R","R","R","R","R","R","R","R","R","R","R","N","R","R","R","R","R","N","R","N","R","R","N","R","R","N","R","R","R","R","R","R","R","R","R","R","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","CS","N","N","CS","N","N","N","N","N","N","N","N","N","ET","N","N","ES","ES","N","N","N","N","N","ET","ET","N","N","N","N","N","AL","AL","AL","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","BN","N","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","N","N","N","ET","ET","N","N","N","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N"],n=new t.__bidiEngine__({isInputVisual:!0});t.API.events.push(["postProcessText",function(r){var i=r.text;r.x,r.y;var s=r.options||{};r.mutex,s.lang;var a=[];if(s.isInputVisual=typeof s.isInputVisual!="boolean"||s.isInputVisual,n.setOptions(s),Object.prototype.toString.call(i)==="[object Array]"){var o=0;for(a=[],o=0;o<i.length;o+=1)Object.prototype.toString.call(i[o])==="[object Array]"?a.push([n.doBidiReorder(i[o][0]),i[o][1],i[o][2]]):a.push([n.doBidiReorder(i[o])]);r.text=a}else r.text=n.doBidiReorder(i);n.setOptions({isInputVisual:!0})}])}(Rt),Rt.API.TTFFont=function(){function t(e){var n;if(this.rawData=e,n=this.contents=new tf(e),this.contents.pos=4,n.readString(4)==="ttcf")throw new Error("TTCF not supported.");n.pos=0,this.parse(),this.subset=new dFe(this),this.registerTTF()}return t.open=function(e){return new t(e)},t.prototype.parse=function(){return this.directory=new XDe(this.contents),this.head=new ZDe(this),this.name=new iFe(this),this.cmap=new ree(this),this.toUnicode={},this.hhea=new eFe(this),this.maxp=new sFe(this),this.hmtx=new aFe(this),this.post=new nFe(this),this.os2=new tFe(this),this.loca=new uFe(this),this.glyf=new oFe(this),this.ascender=this.os2.exists&&this.os2.ascender||this.hhea.ascender,this.decender=this.os2.exists&&this.os2.decender||this.hhea.decender,this.lineGap=this.os2.exists&&this.os2.lineGap||this.hhea.lineGap,this.bbox=[this.head.xMin,this.head.yMin,this.head.xMax,this.head.yMax]},t.prototype.registerTTF=function(){var e,n,r,i,s;if(this.scaleFactor=1e3/this.head.unitsPerEm,this.bbox=(function(){var a,o,l,c;for(c=[],a=0,o=(l=this.bbox).length;a<o;a++)e=l[a],c.push(Math.round(e*this.scaleFactor));return c}).call(this),this.stemV=0,this.post.exists?(r=255&(i=this.post.italic_angle),32768&(n=i>>16)&&(n=-(1+(65535^n))),this.italicAngle=+(n+"."+r)):this.italicAngle=0,this.ascender=Math.round(this.ascender*this.scaleFactor),this.decender=Math.round(this.decender*this.scaleFactor),this.lineGap=Math.round(this.lineGap*this.scaleFactor),this.capHeight=this.os2.exists&&this.os2.capHeight||this.ascender,this.xHeight=this.os2.exists&&this.os2.xHeight||0,this.familyClass=(this.os2.exists&&this.os2.familyClass||0)>>8,this.isSerif=(s=this.familyClass)===1||s===2||s===3||s===4||s===5||s===7,this.isScript=this.familyClass===10,this.flags=0,this.post.isFixedPitch&&(this.flags|=1),this.isSerif&&(this.flags|=2),this.isScript&&(this.flags|=8),this.italicAngle!==0&&(this.flags|=64),this.flags|=32,!this.cmap.unicode)throw new Error("No unicode cmap for font")},t.prototype.characterToGlyph=function(e){var n;return((n=this.cmap.unicode)!=null?n.codeMap[e]:void 0)||0},t.prototype.widthOfGlyph=function(e){var n;return n=1e3/this.head.unitsPerEm,this.hmtx.forGlyph(e).advance*n},t.prototype.widthOfString=function(e,n,r){var i,s,a,o;for(a=0,s=0,o=(e=""+e).length;0<=o?s<o:s>o;s=0<=o?++s:--s)i=e.charCodeAt(s),a+=this.widthOfGlyph(this.characterToGlyph(i))+r*(1e3/n)||0;return a*(n/1e3)},t.prototype.lineHeight=function(e,n){var r;return n==null&&(n=!1),r=n?this.lineGap:0,(this.ascender+r-this.decender)/1e3*e},t}();var pc,tf=function(){function t(e){this.data=e??[],this.pos=0,this.length=this.data.length}return t.prototype.readByte=function(){return this.data[this.pos++]},t.prototype.writeByte=function(e){return this.data[this.pos++]=e},t.prototype.readUInt32=function(){return 16777216*this.readByte()+(this.readByte()<<16)+(this.readByte()<<8)+this.readByte()},t.prototype.writeUInt32=function(e){return this.writeByte(e>>>24&255),this.writeByte(e>>16&255),this.writeByte(e>>8&255),this.writeByte(255&e)},t.prototype.readInt32=function(){var e;return(e=this.readUInt32())>=2147483648?e-4294967296:e},t.prototype.writeInt32=function(e){return e<0&&(e+=4294967296),this.writeUInt32(e)},t.prototype.readUInt16=function(){return this.readByte()<<8|this.readByte()},t.prototype.writeUInt16=function(e){return this.writeByte(e>>8&255),this.writeByte(255&e)},t.prototype.readInt16=function(){var e;return(e=this.readUInt16())>=32768?e-65536:e},t.prototype.writeInt16=function(e){return e<0&&(e+=65536),this.writeUInt16(e)},t.prototype.readString=function(e){var n,r;for(r=[],n=0;0<=e?n<e:n>e;n=0<=e?++n:--n)r[n]=String.fromCharCode(this.readByte());return r.join("")},t.prototype.writeString=function(e){var n,r,i;for(i=[],n=0,r=e.length;0<=r?n<r:n>r;n=0<=r?++n:--n)i.push(this.writeByte(e.charCodeAt(n)));return i},t.prototype.readShort=function(){return this.readInt16()},t.prototype.writeShort=function(e){return this.writeInt16(e)},t.prototype.readLongLong=function(){var e,n,r,i,s,a,o,l;return e=this.readByte(),n=this.readByte(),r=this.readByte(),i=this.readByte(),s=this.readByte(),a=this.readByte(),o=this.readByte(),l=this.readByte(),128&e?-1*(72057594037927940*(255^e)+281474976710656*(255^n)+1099511627776*(255^r)+4294967296*(255^i)+16777216*(255^s)+65536*(255^a)+256*(255^o)+(255^l)+1):72057594037927940*e+281474976710656*n+1099511627776*r+4294967296*i+16777216*s+65536*a+256*o+l},t.prototype.writeLongLong=function(e){var n,r;return n=Math.floor(e/4294967296),r=4294967295&e,this.writeByte(n>>24&255),this.writeByte(n>>16&255),this.writeByte(n>>8&255),this.writeByte(255&n),this.writeByte(r>>24&255),this.writeByte(r>>16&255),this.writeByte(r>>8&255),this.writeByte(255&r)},t.prototype.readInt=function(){return this.readInt32()},t.prototype.writeInt=function(e){return this.writeInt32(e)},t.prototype.read=function(e){var n,r;for(n=[],r=0;0<=e?r<e:r>e;r=0<=e?++r:--r)n.push(this.readByte());return n},t.prototype.write=function(e){var n,r,i,s;for(s=[],r=0,i=e.length;r<i;r++)n=e[r],s.push(this.writeByte(n));return s},t}(),XDe=function(){var t;function e(n){var r,i,s;for(this.scalarType=n.readInt(),this.tableCount=n.readShort(),this.searchRange=n.readShort(),this.entrySelector=n.readShort(),this.rangeShift=n.readShort(),this.tables={},i=0,s=this.tableCount;0<=s?i<s:i>s;i=0<=s?++i:--i)r={tag:n.readString(4),checksum:n.readInt(),offset:n.readInt(),length:n.readInt()},this.tables[r.tag]=r}return e.prototype.encode=function(n){var r,i,s,a,o,l,c,u,d,f,h,p,m;for(m in h=Object.keys(n).length,l=Math.log(2),d=16*Math.floor(Math.log(h)/l),a=Math.floor(d/l),u=16*h-d,(i=new tf).writeInt(this.scalarType),i.writeShort(h),i.writeShort(d),i.writeShort(a),i.writeShort(u),s=16*h,c=i.pos+s,o=null,p=[],n)for(f=n[m],i.writeString(m),i.writeInt(t(f)),i.writeInt(c),i.writeInt(f.length),p=p.concat(f),m==="head"&&(o=c),c+=f.length;c%4;)p.push(0),c++;return i.write(p),r=2981146554-t(i.data),i.pos=o+8,i.writeUInt32(r),i.data},t=function(n){var r,i,s,a;for(n=iee.call(n);n.length%4;)n.push(0);for(s=new tf(n),i=0,r=0,a=n.length;r<a;r=r+=4)i+=s.readUInt32();return 4294967295&i},e}(),QDe={}.hasOwnProperty,du=function(t,e){for(var n in e)QDe.call(e,n)&&(t[n]=e[n]);function r(){this.constructor=t}return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t};pc=function(){function t(e){var n;this.file=e,n=this.file.directory.tables[this.tag],this.exists=!!n,n&&(this.offset=n.offset,this.length=n.length,this.parse(this.file.contents))}return t.prototype.parse=function(){},t.prototype.encode=function(){},t.prototype.raw=function(){return this.exists?(this.file.contents.pos=this.offset,this.file.contents.read(this.length)):null},t}();var ZDe=function(){function t(){return t.__super__.constructor.apply(this,arguments)}return du(t,pc),t.prototype.tag="head",t.prototype.parse=function(e){return e.pos=this.offset,this.version=e.readInt(),this.revision=e.readInt(),this.checkSumAdjustment=e.readInt(),this.magicNumber=e.readInt(),this.flags=e.readShort(),this.unitsPerEm=e.readShort(),this.created=e.readLongLong(),this.modified=e.readLongLong(),this.xMin=e.readShort(),this.yMin=e.readShort(),this.xMax=e.readShort(),this.yMax=e.readShort(),this.macStyle=e.readShort(),this.lowestRecPPEM=e.readShort(),this.fontDirectionHint=e.readShort(),this.indexToLocFormat=e.readShort(),this.glyphDataFormat=e.readShort()},t.prototype.encode=function(e){var n;return(n=new tf).writeInt(this.version),n.writeInt(this.revision),n.writeInt(this.checkSumAdjustment),n.writeInt(this.magicNumber),n.writeShort(this.flags),n.writeShort(this.unitsPerEm),n.writeLongLong(this.created),n.writeLongLong(this.modified),n.writeShort(this.xMin),n.writeShort(this.yMin),n.writeShort(this.xMax),n.writeShort(this.yMax),n.writeShort(this.macStyle),n.writeShort(this.lowestRecPPEM),n.writeShort(this.fontDirectionHint),n.writeShort(e),n.writeShort(this.glyphDataFormat),n.data},t}(),c7=function(){function t(e,n){var r,i,s,a,o,l,c,u,d,f,h,p,m,g,v,_,b;switch(this.platformID=e.readUInt16(),this.encodingID=e.readShort(),this.offset=n+e.readInt(),d=e.pos,e.pos=this.offset,this.format=e.readUInt16(),this.length=e.readUInt16(),this.language=e.readUInt16(),this.isUnicode=this.platformID===3&&this.encodingID===1&&this.format===4||this.platformID===0&&this.format===4,this.codeMap={},this.format){case 0:for(l=0;l<256;++l)this.codeMap[l]=e.readByte();break;case 4:for(h=e.readUInt16(),f=h/2,e.pos+=6,s=function(){var x,T;for(T=[],l=x=0;0<=f?x<f:x>f;l=0<=f?++x:--x)T.push(e.readUInt16());return T}(),e.pos+=2,m=function(){var x,T;for(T=[],l=x=0;0<=f?x<f:x>f;l=0<=f?++x:--x)T.push(e.readUInt16());return T}(),c=function(){var x,T;for(T=[],l=x=0;0<=f?x<f:x>f;l=0<=f?++x:--x)T.push(e.readUInt16());return T}(),u=function(){var x,T;for(T=[],l=x=0;0<=f?x<f:x>f;l=0<=f?++x:--x)T.push(e.readUInt16());return T}(),i=(this.length-e.pos+this.offset)/2,o=function(){var x,T;for(T=[],l=x=0;0<=i?x<i:x>i;l=0<=i?++x:--x)T.push(e.readUInt16());return T}(),l=v=0,b=s.length;v<b;l=++v)for(g=s[l],r=_=p=m[l];p<=g?_<=g:_>=g;r=p<=g?++_:--_)u[l]===0?a=r+c[l]:(a=o[u[l]/2+(r-p)-(f-l)]||0)!==0&&(a+=c[l]),this.codeMap[r]=65535&a}e.pos=d}return t.encode=function(e,n){var r,i,s,a,o,l,c,u,d,f,h,p,m,g,v,_,b,x,T,N,A,L,M,B,R,j,$,U,te,ne,le,V,q,se,he,z,J,Y,de,fe,me,Ce,Ee,Ae,De,Fe;switch(U=new tf,a=Object.keys(e).sort(function(Re,Je){return Re-Je}),n){case"macroman":for(m=0,g=function(){var Re=[];for(p=0;p<256;++p)Re.push(0);return Re}(),_={0:0},s={},te=0,q=a.length;te<q;te++)_[Ee=e[i=a[te]]]==null&&(_[Ee]=++m),s[i]={old:e[i],new:_[e[i]]},g[i]=_[e[i]];return U.writeUInt16(1),U.writeUInt16(0),U.writeUInt32(12),U.writeUInt16(0),U.writeUInt16(262),U.writeUInt16(0),U.write(g),{charMap:s,subtable:U.data,maxGlyphID:m+1};case"unicode":for(j=[],d=[],b=0,_={},r={},v=c=null,ne=0,se=a.length;ne<se;ne++)_[T=e[i=a[ne]]]==null&&(_[T]=++b),r[i]={old:T,new:_[T]},o=_[T]-i,v!=null&&o===c||(v&&d.push(v),j.push(i),c=o),v=i;for(v&&d.push(v),d.push(65535),j.push(65535),B=2*(M=j.length),L=2*Math.pow(Math.log(M)/Math.LN2,2),f=Math.log(L/2)/Math.LN2,A=2*M-L,l=[],N=[],h=[],p=le=0,he=j.length;le<he;p=++le){if(R=j[p],u=d[p],R===65535){l.push(0),N.push(0);break}if(R-($=r[R].new)>=32768)for(l.push(0),N.push(2*(h.length+M-p)),i=V=R;R<=u?V<=u:V>=u;i=R<=u?++V:--V)h.push(r[i].new);else l.push($-R),N.push(0)}for(U.writeUInt16(3),U.writeUInt16(1),U.writeUInt32(12),U.writeUInt16(4),U.writeUInt16(16+8*M+2*h.length),U.writeUInt16(0),U.writeUInt16(B),U.writeUInt16(L),U.writeUInt16(f),U.writeUInt16(A),me=0,z=d.length;me<z;me++)i=d[me],U.writeUInt16(i);for(U.writeUInt16(0),Ce=0,J=j.length;Ce<J;Ce++)i=j[Ce],U.writeUInt16(i);for(Ae=0,Y=l.length;Ae<Y;Ae++)o=l[Ae],U.writeUInt16(o);for(De=0,de=N.length;De<de;De++)x=N[De],U.writeUInt16(x);for(Fe=0,fe=h.length;Fe<fe;Fe++)m=h[Fe],U.writeUInt16(m);return{charMap:r,subtable:U.data,maxGlyphID:b+1}}},t}(),ree=function(){function t(){return t.__super__.constructor.apply(this,arguments)}return du(t,pc),t.prototype.tag="cmap",t.prototype.parse=function(e){var n,r,i;for(e.pos=this.offset,this.version=e.readUInt16(),i=e.readUInt16(),this.tables=[],this.unicode=null,r=0;0<=i?r<i:r>i;r=0<=i?++r:--r)n=new c7(e,this.offset),this.tables.push(n),n.isUnicode&&this.unicode==null&&(this.unicode=n);return!0},t.encode=function(e,n){var r,i;return n==null&&(n="macroman"),r=c7.encode(e,n),(i=new tf).writeUInt16(0),i.writeUInt16(1),r.table=i.data.concat(r.subtable),r},t}(),eFe=function(){function t(){return t.__super__.constructor.apply(this,arguments)}return du(t,pc),t.prototype.tag="hhea",t.prototype.parse=function(e){return e.pos=this.offset,this.version=e.readInt(),this.ascender=e.readShort(),this.decender=e.readShort(),this.lineGap=e.readShort(),this.advanceWidthMax=e.readShort(),this.minLeftSideBearing=e.readShort(),this.minRightSideBearing=e.readShort(),this.xMaxExtent=e.readShort(),this.caretSlopeRise=e.readShort(),this.caretSlopeRun=e.readShort(),this.caretOffset=e.readShort(),e.pos+=8,this.metricDataFormat=e.readShort(),this.numberOfMetrics=e.readUInt16()},t}(),tFe=function(){function t(){return t.__super__.constructor.apply(this,arguments)}return du(t,pc),t.prototype.tag="OS/2",t.prototype.parse=function(e){if(e.pos=this.offset,this.version=e.readUInt16(),this.averageCharWidth=e.readShort(),this.weightClass=e.readUInt16(),this.widthClass=e.readUInt16(),this.type=e.readShort(),this.ySubscriptXSize=e.readShort(),this.ySubscriptYSize=e.readShort(),this.ySubscriptXOffset=e.readShort(),this.ySubscriptYOffset=e.readShort(),this.ySuperscriptXSize=e.readShort(),this.ySuperscriptYSize=e.readShort(),this.ySuperscriptXOffset=e.readShort(),this.ySuperscriptYOffset=e.readShort(),this.yStrikeoutSize=e.readShort(),this.yStrikeoutPosition=e.readShort(),this.familyClass=e.readShort(),this.panose=function(){var n,r;for(r=[],n=0;n<10;++n)r.push(e.readByte());return r}(),this.charRange=function(){var n,r;for(r=[],n=0;n<4;++n)r.push(e.readInt());return r}(),this.vendorID=e.readString(4),this.selection=e.readShort(),this.firstCharIndex=e.readShort(),this.lastCharIndex=e.readShort(),this.version>0&&(this.ascent=e.readShort(),this.descent=e.readShort(),this.lineGap=e.readShort(),this.winAscent=e.readShort(),this.winDescent=e.readShort(),this.codePageRange=function(){var n,r;for(r=[],n=0;n<2;n=++n)r.push(e.readInt());return r}(),this.version>1))return this.xHeight=e.readShort(),this.capHeight=e.readShort(),this.defaultChar=e.readShort(),this.breakChar=e.readShort(),this.maxContext=e.readShort()},t}(),nFe=function(){function t(){return t.__super__.constructor.apply(this,arguments)}return du(t,pc),t.prototype.tag="post",t.prototype.parse=function(e){var n,r,i;switch(e.pos=this.offset,this.format=e.readInt(),this.italicAngle=e.readInt(),this.underlinePosition=e.readShort(),this.underlineThickness=e.readShort(),this.isFixedPitch=e.readInt(),this.minMemType42=e.readInt(),this.maxMemType42=e.readInt(),this.minMemType1=e.readInt(),this.maxMemType1=e.readInt(),this.format){case 65536:case 196608:break;case 131072:var s;for(r=e.readUInt16(),this.glyphNameIndex=[],s=0;0<=r?s<r:s>r;s=0<=r?++s:--s)this.glyphNameIndex.push(e.readUInt16());for(this.names=[],i=[];e.pos<this.offset+this.length;)n=e.readByte(),i.push(this.names.push(e.readString(n)));return i;case 151552:return r=e.readUInt16(),this.offsets=e.read(r);case 262144:return this.map=(function(){var a,o,l;for(l=[],s=a=0,o=this.file.maxp.numGlyphs;0<=o?a<o:a>o;s=0<=o?++a:--a)l.push(e.readUInt32());return l}).call(this)}},t}(),rFe=function(t,e){this.raw=t,this.length=t.length,this.platformID=e.platformID,this.encodingID=e.encodingID,this.languageID=e.languageID},iFe=function(){function t(){return t.__super__.constructor.apply(this,arguments)}return du(t,pc),t.prototype.tag="name",t.prototype.parse=function(e){var n,r,i,s,a,o,l,c,u,d,f;for(e.pos=this.offset,e.readShort(),n=e.readShort(),o=e.readShort(),r=[],s=0;0<=n?s<n:s>n;s=0<=n?++s:--s)r.push({platformID:e.readShort(),encodingID:e.readShort(),languageID:e.readShort(),nameID:e.readShort(),length:e.readShort(),offset:this.offset+o+e.readShort()});for(l={},s=u=0,d=r.length;u<d;s=++u)i=r[s],e.pos=i.offset,c=e.readString(i.length),a=new rFe(c,i),l[f=i.nameID]==null&&(l[f]=[]),l[i.nameID].push(a);this.strings=l,this.copyright=l[0],this.fontFamily=l[1],this.fontSubfamily=l[2],this.uniqueSubfamily=l[3],this.fontName=l[4],this.version=l[5];try{this.postscriptName=l[6][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}catch{this.postscriptName=l[4][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}return this.trademark=l[7],this.manufacturer=l[8],this.designer=l[9],this.description=l[10],this.vendorUrl=l[11],this.designerUrl=l[12],this.license=l[13],this.licenseUrl=l[14],this.preferredFamily=l[15],this.preferredSubfamily=l[17],this.compatibleFull=l[18],this.sampleText=l[19]},t}(),sFe=function(){function t(){return t.__super__.constructor.apply(this,arguments)}return du(t,pc),t.prototype.tag="maxp",t.prototype.parse=function(e){return e.pos=this.offset,this.version=e.readInt(),this.numGlyphs=e.readUInt16(),this.maxPoints=e.readUInt16(),this.maxContours=e.readUInt16(),this.maxCompositePoints=e.readUInt16(),this.maxComponentContours=e.readUInt16(),this.maxZones=e.readUInt16(),this.maxTwilightPoints=e.readUInt16(),this.maxStorage=e.readUInt16(),this.maxFunctionDefs=e.readUInt16(),this.maxInstructionDefs=e.readUInt16(),this.maxStackElements=e.readUInt16(),this.maxSizeOfInstructions=e.readUInt16(),this.maxComponentElements=e.readUInt16(),this.maxComponentDepth=e.readUInt16()},t}(),aFe=function(){function t(){return t.__super__.constructor.apply(this,arguments)}return du(t,pc),t.prototype.tag="hmtx",t.prototype.parse=function(e){var n,r,i,s,a,o,l;for(e.pos=this.offset,this.metrics=[],n=0,o=this.file.hhea.numberOfMetrics;0<=o?n<o:n>o;n=0<=o?++n:--n)this.metrics.push({advance:e.readUInt16(),lsb:e.readInt16()});for(i=this.file.maxp.numGlyphs-this.file.hhea.numberOfMetrics,this.leftSideBearings=function(){var c,u;for(u=[],n=c=0;0<=i?c<i:c>i;n=0<=i?++c:--c)u.push(e.readInt16());return u}(),this.widths=(function(){var c,u,d,f;for(f=[],c=0,u=(d=this.metrics).length;c<u;c++)s=d[c],f.push(s.advance);return f}).call(this),r=this.widths[this.widths.length-1],l=[],n=a=0;0<=i?a<i:a>i;n=0<=i?++a:--a)l.push(this.widths.push(r));return l},t.prototype.forGlyph=function(e){return e in this.metrics?this.metrics[e]:{advance:this.metrics[this.metrics.length-1].advance,lsb:this.leftSideBearings[e-this.metrics.length]}},t}(),iee=[].slice,oFe=function(){function t(){return t.__super__.constructor.apply(this,arguments)}return du(t,pc),t.prototype.tag="glyf",t.prototype.parse=function(){return this.cache={}},t.prototype.glyphFor=function(e){var n,r,i,s,a,o,l,c,u,d;return e in this.cache?this.cache[e]:(s=this.file.loca,n=this.file.contents,r=s.indexOf(e),(i=s.lengthOf(e))===0?this.cache[e]=null:(n.pos=this.offset+r,a=(o=new tf(n.read(i))).readShort(),c=o.readShort(),d=o.readShort(),l=o.readShort(),u=o.readShort(),this.cache[e]=a===-1?new cFe(o,c,d,l,u):new lFe(o,a,c,d,l,u),this.cache[e]))},t.prototype.encode=function(e,n,r){var i,s,a,o,l;for(a=[],s=[],o=0,l=n.length;o<l;o++)i=e[n[o]],s.push(a.length),i&&(a=a.concat(i.encode(r)));return s.push(a.length),{table:a,offsets:s}},t}(),lFe=function(){function t(e,n,r,i,s,a){this.raw=e,this.numberOfContours=n,this.xMin=r,this.yMin=i,this.xMax=s,this.yMax=a,this.compound=!1}return t.prototype.encode=function(){return this.raw.data},t}(),cFe=function(){function t(e,n,r,i,s){var a,o;for(this.raw=e,this.xMin=n,this.yMin=r,this.xMax=i,this.yMax=s,this.compound=!0,this.glyphIDs=[],this.glyphOffsets=[],a=this.raw;o=a.readShort(),this.glyphOffsets.push(a.pos),this.glyphIDs.push(a.readUInt16()),32&o;)a.pos+=1&o?4:2,128&o?a.pos+=8:64&o?a.pos+=4:8&o&&(a.pos+=2)}return t.prototype.encode=function(){var e,n,r;for(n=new tf(iee.call(this.raw.data)),e=0,r=this.glyphIDs.length;e<r;++e)n.pos=this.glyphOffsets[e];return n.data},t}(),uFe=function(){function t(){return t.__super__.constructor.apply(this,arguments)}return du(t,pc),t.prototype.tag="loca",t.prototype.parse=function(e){var n,r;return e.pos=this.offset,n=this.file.head.indexToLocFormat,this.offsets=n===0?(function(){var i,s;for(s=[],r=0,i=this.length;r<i;r+=2)s.push(2*e.readUInt16());return s}).call(this):(function(){var i,s;for(s=[],r=0,i=this.length;r<i;r+=4)s.push(e.readUInt32());return s}).call(this)},t.prototype.indexOf=function(e){return this.offsets[e]},t.prototype.lengthOf=function(e){return this.offsets[e+1]-this.offsets[e]}
750,t.prototype.encode=function(e,n){for(var r=new Uint32Array(this.offsets.length),i=0,s=0,a=0;a<r.length;++a)if(r[a]=i,s<n.length&&n[s]==a){++s,r[a]=i;var o=this.offsets[a],l=this.offsets[a+1]-o;l>0&&(i+=l)}for(var c=new Array(4*r.length),u=0;u<r.length;++u)c[4*u+3]=255&r[u],c[4*u+2]=(65280&r[u])>>8,c[4*u+1]=(16711680&r[u])>>16,c[4*u]=(4278190080&r[u])>>24;return c},t}(),dFe=function(){function t(e){this.font=e,this.subset={},this.unicodes={},this.next=33}return t.prototype.generateCmap=function(){var e,n,r,i,s;for(n in i=this.font.cmap.tables[0].codeMap,e={},s=this.subset)r=s[n],e[n]=i[r];return e},t.prototype.glyphsFor=function(e){var n,r,i,s,a,o,l;for(i={},a=0,o=e.length;a<o;a++)i[s=e[a]]=this.font.glyf.glyphFor(s);for(s in n=[],i)(r=i[s])!=null&&r.compound&&n.push.apply(n,r.glyphIDs);if(n.length>0)for(s in l=this.glyphsFor(n))r=l[s],i[s]=r;return i},t.prototype.encode=function(e,n){var r,i,s,a,o,l,c,u,d,f,h,p,m,g,v;for(i in r=ree.encode(this.generateCmap(),"unicode"),a=this.glyphsFor(e),h={0:0},v=r.charMap)h[(l=v[i]).old]=l.new;for(p in f=r.maxGlyphID,a)p in h||(h[p]=f++);return u=function(_){var b,x;for(b in x={},_)x[_[b]]=b;return x}(h),d=Object.keys(u).sort(function(_,b){return _-b}),m=function(){var _,b,x;for(x=[],_=0,b=d.length;_<b;_++)o=d[_],x.push(u[o]);return x}(),s=this.font.glyf.encode(a,m,h),c=this.font.loca.encode(s.offsets,m),g={cmap:this.font.cmap.raw(),glyf:s.table,loca:c,hmtx:this.font.hmtx.raw(),hhea:this.font.hhea.raw(),maxp:this.font.maxp.raw(),post:this.font.post.raw(),name:this.font.name.raw(),head:this.font.head.encode(n)},this.font.os2.exists&&(g["OS/2"]=this.font.os2.raw()),this.font.directory.encode(g)},t}();Rt.API.PDFObject=function(){var t;function e(){}return t=function(n,r){return(Array(r+1).join("0")+n).slice(-r)},e.convert=function(n){var r,i,s,a;if(Array.isArray(n))return"["+function(){var o,l,c;for(c=[],o=0,l=n.length;o<l;o++)r=n[o],c.push(e.convert(r));return c}().join(" ")+"]";if(typeof n=="string")return"/"+n;if(n!=null&&n.isString)return"("+n+")";if(n instanceof Date)return"(D:"+t(n.getUTCFullYear(),4)+t(n.getUTCMonth(),2)+t(n.getUTCDate(),2)+t(n.getUTCHours(),2)+t(n.getUTCMinutes(),2)+t(n.getUTCSeconds(),2)+"Z)";if({}.toString.call(n)==="[object Object]"){for(i in s=["<<"],n)a=n[i],s.push("/"+i+" "+e.convert(a));return s.push(">>"),s.join(` 751`)}return""+n},e}();function see(t,e,n,r,i){r=r||{};var s=1.15,a=i.internal.scaleFactor,o=i.internal.getFontSize()/a,l=i.getLineHeightFactor?i.getLineHeightFactor():s,c=o*l,u=/\r\n|\r|\n/g,d="",f=1;if((r.valign==="middle"||r.valign==="bottom"||r.halign==="center"||r.halign==="right")&&(d=typeof t=="string"?t.split(u):t,f=d.length||1),n+=o*(2-s),r.valign==="middle"?n-=f/2*c:r.valign==="bottom"&&(n-=f*c),r.halign==="center"||r.halign==="right"){var h=o;if(r.halign==="center"&&(h*=.5),d&&f>=1){for(var p=0;p<d.length;p++)i.text(d[p],e-i.getStringUnitWidth(d[p])*h,n),n+=c;return i}e-=i.getStringUnitWidth(t)*h}return r.halign==="justify"?i.text(t,e,n,{maxWidth:r.maxWidth||100,align:"justify"}):i.text(t,e,n),i}var u7={},ov=function(){function t(e){this.jsPDFDocument=e,this.userStyles={textColor:e.getTextColor?this.jsPDFDocument.getTextColor():0,fontSize:e.internal.getFontSize(),fontStyle:e.internal.getFont().fontStyle,font:e.internal.getFont().fontName,lineWidth:e.getLineWidth?this.jsPDFDocument.getLineWidth():0,lineColor:e.getDrawColor?this.jsPDFDocument.getDrawColor():0}}
751return t.setDefaults=function(e,n){n===void 0&&(n=null),n?n.__autoTableDocumentDefaults=e:u7=e},t.unifyColor=function(e){return Array.isArray(e)?e:typeof e=="number"?[e,e,e]:typeof e=="string"?[e]:null},t.prototype.applyStyles=function(e,n){var r,i,s;n===void 0&&(n=!1),e.fontStyle&&this.jsPDFDocument.setFontStyle&&this.jsPDFDocument.setFontStyle(e.fontStyle);var a=this.jsPDFDocument.internal.getFont(),o=a.fontStyle,l=a.fontName;if(e.font&&(l=e.font),e.fontStyle){o=e.fontStyle;var c=this.getFontList()[l];c&&c.indexOf(o)===-1&&this.jsPDFDocument.setFontStyle&&(this.jsPDFDocument.setFontStyle(c[0]),o=c[0])}if(this.jsPDFDocument.setFont(l,o),e.fontSize&&this.jsPDFDocument.setFontSize(e.fontSize),!n){var u=t.unifyColor(e.fillColor);u&&(r=this.jsPDFDocument).setFillColor.apply(r,u),u=t.unifyColor(e.textColor),u&&(i=this.jsPDFDocument).setTextColor.apply(i,u),u=t.unifyColor(e.lineColor),u&&(s=this.jsPDFDocument).setDrawColor.apply(s,u),typeof e.lineWidth=="number"&&this.jsPDFDocument.setLineWidth(e.lineWidth)}},t.prototype.splitTextToSize=function(e,n,r){return this.jsPDFDocument.splitTextToSize(e,n,r)},t.prototype.rect=function(e,n,r,i,s){return this.jsPDFDocument.rect(e,n,r,i,s)},t.prototype.getLastAutoTable=function(){return this.jsPDFDocument.lastAutoTable||null},t.prototype.getTextWidth=function(e){return this.jsPDFDocument.getTextWidth(e)},t.prototype.getDocument=function(){return this.jsPDFDocument},t.prototype.setPage=function(e){this.jsPDFDocument.setPage(e)},t.prototype.addPage=function(){return this.jsPDFDocument.addPage()},t.prototype.getFontList=function(){return this.jsPDFDocument.getFontList()},t.prototype.getGlobalOptions=function(){return u7||{}},t.prototype.getDocumentOptions=function(){return this.jsPDFDocument.__autoTableDocumentDefaults||{}},t.prototype.pageSize=function(){var e=this.jsPDFDocument.internal.pageSize;return e.width==null&&(e={width:e.getWidth(),height:e.getHeight()}),e},t.prototype.scaleFactor=function(){return this.jsPDFDocument.internal.scaleFactor},t.prototype.getLineHeightFactor=function(){var e=this.jsPDFDocument;return e.getLineHeightFactor?e.getLineHeightFactor():1.15},t.prototype.getLineHeight=function(e){return e/this.scaleFactor()*this.getLineHeightFactor()},t.prototype.pageNumber=function(){var e=this.jsPDFDocument.internal.getCurrentPageInfo();return e?e.pageNumber:this.jsPDFDocument.internal.getNumberOfPages()},t}(),NN=function(t,e){return NN=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},NN(t,e)};function aee(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");NN(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var oee=function(t){aee(e,t);function e(n){var r=t.call(this)||this;return r._element=n,r}return e}(Array);function hFe(t){return{font:"helvetica",fontStyle:"normal",overflow:"linebreak",fillColor:!1,textColor:20,halign:"left",valign:"top",fontSize:10,cellPadding:5/t,lineColor:200,lineWidth:0,cellWidth:"auto",minCellHeight:0,minCellWidth:0}}function fFe(t){var e={striped:{table:{fillColor:255,textColor:80,fontStyle:"normal"},head:{textColor:255,fillColor:[41,128,185],fontStyle:"bold"},body:{},foot:{textColor:255,fillColor:[41,128,185],fontStyle:"bold"},alternateRow:{fillColor:245}},grid:{table:{fillColor:255,textColor:80,fontStyle:"normal",lineWidth:.1},head:{textColor:255,fillColor:[26,188,156],fontStyle:"bold",lineWidth:0},body:{},foot:{textColor:255,fillColor:[26,188,156],fontStyle:"bold",lineWidth:0},alternateRow:{}},plain:{head:{fontStyle:"bold"},foot:{fontStyle:"bold"}}};return e[t]}function hS(t,e,n){n.applyStyles(e,!0);var r=Array.isArray(t)?t:[t],i=r.map(function(s){return n.getTextWidth(s)}).reduce(function(s,a){return Math.max(s,a)},0);return i}function lee(t,e,n,r){var i=e.settings.tableLineWidth,s=e.settings.tableLineColor;t.applyStyles({lineWidth:i,lineColor:s});var a=cee(i,!1);a&&t.rect(n.x,n.y,e.getWidth(t.pageSize().width),r.y-n.y,a)}function cee(t,e){var n=t>0,r=e||e===0;return n&&r?"DF":n?"S":r?"F":null}function ZT(t,e){var n,r,i,s;if(t=t||e,Array.isArray(t)){if(t.length>=4)return{top:t[0],right:t[1],bottom:t[2],left:t[3]};if(t.length===3)return{top:t[0],right:t[1],bottom:t[2],left:t[1]};if(t.length===2)return{top:t[0],right:t[1],bottom:t[0],left:t[1]};t.length===1?t=t[0]:t=e}return typeof t=="object"?(typeof t.vertical=="number"&&(t.top=t.vertical,t.bottom=t.vertical),typeof t.horizontal=="number"&&(t.right=t.horizontal,t.left=t.horizontal),{left:(n=t.left)!==null&&n!==void 0?n:e,top:(r=t.top)!==null&&r!==void 0?r:e,right:(i=t.right)!==null&&i!==void 0?i:e,bottom:(s=t.bottom)!==null&&s!==void 0?s:e}):(typeof t!="number"&&(t=e),{top:t,right:t,bottom:t,left:t})}
751function uee(t,e){var n=ZT(e.settings.margin,0);return t.pageSize().width-(n.left+n.right)}function pFe(t,e,n,r,i){var s={},a=1.3333333333333333,o=FE(e,function(b){return i.getComputedStyle(b).backgroundColor});o!=null&&(s.fillColor=o);var l=FE(e,function(b){return i.getComputedStyle(b).color});l!=null&&(s.textColor=l);var c=gFe(r,n);c&&(s.cellPadding=c);var u="borderTopColor",d=a*n,f=r.borderTopWidth;if(r.borderBottomWidth===f&&r.borderRightWidth===f&&r.borderLeftWidth===f){var h=(parseFloat(f)||0)/d;h&&(s.lineWidth=h)}else s.lineWidth={top:(parseFloat(r.borderTopWidth)||0)/d,right:(parseFloat(r.borderRightWidth)||0)/d,bottom:(parseFloat(r.borderBottomWidth)||0)/d,left:(parseFloat(r.borderLeftWidth)||0)/d},s.lineWidth.top||(s.lineWidth.right?u="borderRightColor":s.lineWidth.bottom?u="borderBottomColor":s.lineWidth.left&&(u="borderLeftColor"));var p=FE(e,function(b){return i.getComputedStyle(b)[u]});p!=null&&(s.lineColor=p);var m=["left","right","center","justify"];m.indexOf(r.textAlign)!==-1&&(s.halign=r.textAlign),m=["middle","bottom","top"],m.indexOf(r.verticalAlign)!==-1&&(s.valign=r.verticalAlign);var g=parseInt(r.fontSize||"");isNaN(g)||(s.fontSize=g/a);var v=mFe(r);v&&(s.fontStyle=v);var _=(r.fontFamily||"").toLowerCase();return t.indexOf(_)!==-1&&(s.font=_),s}function mFe(t){var e="";return(t.fontWeight==="bold"||t.fontWeight==="bolder"||parseInt(t.fontWeight)>=700)&&(e="bold"),(t.fontStyle==="italic"||t.fontStyle==="oblique")&&(e+="italic"),e}function FE(t,e){var n=dee(t,e);if(!n)return null;var r=n.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d*\.?\d*))?\)$/);if(!r||!Array.isArray(r))return null;var i=[parseInt(r[1]),parseInt(r[2]),parseInt(r[3])],s=parseInt(r[4]);return s===0||isNaN(i[0])||isNaN(i[1])||isNaN(i[2])?null:i}function dee(t,e){var n=e(t);return n==="rgba(0, 0, 0, 0)"||n==="transparent"||n==="initial"||n==="inherit"?t.parentElement==null?null:dee(t.parentElement,e):n}function gFe(t,e){var n=[t.paddingTop,t.paddingRight,t.paddingBottom,t.paddingLeft],r=96/(72/e),i=(parseInt(t.lineHeight)-parseInt(t.fontSize))/e/2,s=n.map(function(o){return parseInt(o||"0")/r}),a=ZT(s,0);return i>a.top&&(a.top=i),i>a.bottom&&(a.bottom=i),a}function hee(t,e,n,r,i){var s,a;r===void 0&&(r=!1),i===void 0&&(i=!1);var o;typeof e=="string"?o=n.document.querySelector(e):o=e;var l=Object.keys(t.getFontList()),c=t.scaleFactor(),u=[],d=[],f=[];if(!o)return console.error("Html table could not be found with input: ",e),{head:u,body:d,foot:f};for(var h=0;h<o.rows.length;h++){var p=o.rows[h],m=(a=(s=p==null?void 0:p.parentElement)===null||s===void 0?void 0:s.tagName)===null||a===void 0?void 0:a.toLowerCase(),g=vFe(l,c,n,p,r,i);g&&(m==="thead"?u.push(g):m==="tfoot"?f.push(g):d.push(g))}return{head:u,body:d,foot:f}}function vFe(t,e,n,r,i,s){for(var a=new oee(r),o=0;o<r.cells.length;o++){var l=r.cells[o],c=n.getComputedStyle(l);if(i||c.display!=="none"){var u=void 0;s&&(u=pFe(t,l,e,c,n)),a.push({rowSpan:l.rowSpan,colSpan:l.colSpan,styles:u,_element:l,content:yFe(l)})}}var d=n.getComputedStyle(r);if(a.length>0&&(i||d.display!=="none"))return a}function yFe(t){var e=t.cloneNode(!0);return e.innerHTML=e.innerHTML.replace(/\n/g,"").replace(/ +/g," "),e.innerHTML=e.innerHTML.split(/<br.*?>/).map(function(n){return n.trim()}).join(` 752`),e.innerText||e.textContent||""}function _Fe(t,e,n){for(var r=0,i=[t,e,n];r<i.length;r++){var s=i[r];s&&typeof s!="object"&&console.error("The options parameter should be of type object, is: "+typeof s),s.startY&&typeof s.startY!="number"&&(console.error("Invalid value for startY option",s.startY),delete s.startY)}}function sd(t,e,n,r,i){if(t==null)throw new TypeError("Cannot convert undefined or null to object");for(var s=Object(t),a=1;a<arguments.length;a++){var o=arguments[a];if(o!=null)for(var l in o)Object.prototype.hasOwnProperty.call(o,l)&&(s[l]=o[l])}return s}function fee(t,e){var n=new ov(t),r=n.getDocumentOptions(),i=n.getGlobalOptions();_Fe(i,r,e);var s=sd({},i,r,e),a;typeof window<"u"&&(a=window);var o=wFe(i,r,e),l=bFe(i,r,e),c=xFe(n,s),u=SFe(n,s,a);return{id:e.tableId,content:u,hooks:l,styles:o,settings:c}}function wFe(t,e,n){for(var r={styles:{},headStyles:{},bodyStyles:{},footStyles:{},alternateRowStyles:{},columnStyles:{}},i=function(l){if(l==="columnStyles"){var c=t[l],u=e[l],d=n[l];r.columnStyles=sd({},c,u,d)}else{var f=[t,e,n],h=f.map(function(p){return p[l]||{}});r[l]=sd({},h[0],h[1],h[2])}},s=0,a=Object.keys(r);s<a.length;s++){var o=a[s];i(o)}return r}function bFe(t,e,n){for(var r=[t,e,n],i={didParseCell:[],willDrawCell:[],didDrawCell:[],willDrawPage:[],didDrawPage:[]},s=0,a=r;s<a.length;s++){var o=a[s];o.didParseCell&&i.didParseCell.push(o.didParseCell),o.willDrawCell&&i.willDrawCell.push(o.willDrawCell),o.didDrawCell&&i.didDrawCell.push(o.didDrawCell),o.willDrawPage&&i.willDrawPage.push(o.willDrawPage),o.didDrawPage&&i.didDrawPage.push(o.didDrawPage)}return i}function xFe(t,e){var n,r,i,s,a,o,l,c,u,d,f,h,p=ZT(e.margin,40/t.scaleFactor()),m=(n=kFe(t,e.startY))!==null&&n!==void 0?n:p.top,g;e.showFoot===!0?g="everyPage":e.showFoot===!1?g="never":g=(r=e.showFoot)!==null&&r!==void 0?r:"everyPage";var v;e.showHead===!0?v="everyPage":e.showHead===!1?v="never":v=(i=e.showHead)!==null&&i!==void 0?i:"everyPage";var _=(s=e.useCss)!==null&&s!==void 0?s:!1,b=e.theme||(_?"plain":"striped"),x=!!e.horizontalPageBreak,T=(a=e.horizontalPageBreakRepeat)!==null&&a!==void 0?a:null;return{includeHiddenHtml:(o=e.includeHiddenHtml)!==null&&o!==void 0?o:!1,useCss:_,theme:b,startY:m,margin:p,pageBreak:(l=e.pageBreak)!==null&&l!==void 0?l:"auto",rowPageBreak:(c=e.rowPageBreak)!==null&&c!==void 0?c:"auto",tableWidth:(u=e.tableWidth)!==null&&u!==void 0?u:"auto",showHead:v,showFoot:g,tableLineWidth:(d=e.tableLineWidth)!==null&&d!==void 0?d:0,tableLineColor:(f=e.tableLineColor)!==null&&f!==void 0?f:200,horizontalPageBreak:x,horizontalPageBreakRepeat:T,horizontalPageBreakBehaviour:(h=e.horizontalPageBreakBehaviour)!==null&&h!==void 0?h:"afterAllRows"}}function kFe(t,e){var n=t.getLastAutoTable(),r=t.scaleFactor(),i=t.pageNumber(),s=!1;if(n&&n.startPageNumber){var a=n.startPageNumber+n.pageNumber-1;s=a===i}return typeof e=="number"?e:(e==null||e===!1)&&s&&(n==null?void 0:n.finalY)!=null?n.finalY+20/r:null}function SFe(t,e,n){var r=e.head||[],i=e.body||[],s=e.foot||[];if(e.html){var a=e.includeHiddenHtml;if(n){var o=hee(t,e.html,n,a,e.useCss)||{};r=o.head||r,i=o.body||r,s=o.foot||r}else console.error("Cannot parse html in non browser environment")}var l=e.columns||TFe(r,i,s);return{columns:l,head:r,body:i,foot:s}}function TFe(t,e,n){var r=t[0]||e[0]||n[0]||[],i=[];return Object.keys(r).filter(function(s){return s!=="_element"}
752).forEach(function(s){var a=1,o;Array.isArray(r)?o=r[parseInt(s)]:o=r[s],typeof o=="object"&&!Array.isArray(o)&&(a=(o==null?void 0:o.colSpan)||1);for(var l=0;l<a;l++){var c=void 0;Array.isArray(r)?c=i.length:c=s+(l>0?"_".concat(l):"");var u={dataKey:c};i.push(u)}}),i}var RN=function(){function t(e,n,r){this.table=n,this.pageNumber=n.pageNumber,this.settings=n.settings,this.cursor=r,this.doc=e.getDocument()}return t}(),CFe=function(t){aee(e,t);function e(n,r,i,s,a,o){var l=t.call(this,n,r,o)||this;return l.cell=i,l.row=s,l.column=a,l.section=s.section,l}return e}(RN),EFe=function(){function t(e,n){this.pageNumber=1,this.id=e.id,this.settings=e.settings,this.styles=e.styles,this.hooks=e.hooks,this.columns=n.columns,this.head=n.head,this.body=n.body,this.foot=n.foot}return t.prototype.getHeadHeight=function(e){return this.head.reduce(function(n,r){return n+r.getMaxCellHeight(e)},0)},t.prototype.getFootHeight=function(e){return this.foot.reduce(function(n,r){return n+r.getMaxCellHeight(e)},0)},t.prototype.allRows=function(){return this.head.concat(this.body).concat(this.foot)},t.prototype.callCellHooks=function(e,n,r,i,s,a){for(var o=0,l=n;o<l.length;o++){var c=l[o],u=new CFe(e,this,r,i,s,a),d=c(u)===!1;if(r.text=Array.isArray(r.text)?r.text:[r.text],d)return!1}return!0},t.prototype.callEndPageHooks=function(e,n){e.applyStyles(e.userStyles);for(var r=0,i=this.hooks.didDrawPage;r<i.length;r++){var s=i[r];s(new RN(e,this,n))}},t.prototype.callWillDrawPageHooks=function(e,n){for(var r=0,i=this.hooks.willDrawPage;r<i.length;r++){var s=i[r];s(new RN(e,this,n))}},t.prototype.getWidth=function(e){if(typeof this.settings.tableWidth=="number")return this.settings.tableWidth;if(this.settings.tableWidth==="wrap"){var n=this.columns.reduce(function(i,s){return i+s.wrappedWidth},0);return n}else{var r=this.settings.margin;return e-r.left-r.right}},t}(),pee=function(){function t(e,n,r,i,s){s===void 0&&(s=!1),this.height=0,this.raw=e,e instanceof oee&&(this.raw=e._element,this.element=e._element),this.index=n,this.section=r,this.cells=i,this.spansMultiplePages=s}return t.prototype.getMaxCellHeight=function(e){var n=this;return e.reduce(function(r,i){var s;return Math.max(r,((s=n.cells[i.index])===null||s===void 0?void 0:s.height)||0)},0)},t.prototype.hasRowSpan=function(e){var n=this;return e.filter(function(r){var i=n.cells[r.index];return i?i.rowSpan>1:!1}).length>0},t.prototype.canEntireRowFit=function(e,n){return this.getMaxCellHeight(n)<=e},t.prototype.getMinimumRowHeight=function(e,n){var r=this;return e.reduce(function(i,s){var a=r.cells[s.index];if(!a)return 0;var o=n.getLineHeight(a.styles.fontSize),l=a.padding("vertical"),c=l+o;return c>i?c:i},0)},t}(),mee=function(){function t(e,n,r){var i;this.contentHeight=0,this.contentWidth=0,this.wrappedWidth=0,this.minReadableWidth=0,this.minWidth=0,this.width=0,this.height=0,this.x=0,this.y=0,this.styles=n,this.section=r,this.raw=e;var s=e;e!=null&&typeof e=="object"&&!Array.isArray(e)?(this.rowSpan=e.rowSpan||1,this.colSpan=e.colSpan||1,s=(i=e.content)!==null&&i!==void 0?i:e,e._element&&(this.raw=e._element)):(this.rowSpan=1,this.colSpan=1);var a=s!=null?""+s:"",o=/\r\n|\r|\n/g;this.text=a.split(o)}return t.prototype.getTextPos=function(){var e;if(this.styles.valign==="top")e=this.y+this.padding("top");else if(this.styles.valign==="bottom")e=this.y+this.height-this.padding("bottom");else{var n=this.height-this.padding("vertical");e=this.y+n/2+this.padding("top")}var r;if(this.styles.halign==="right")r=this.x+this.width-this.padding("right");else if(this.styles.halign==="center"){var i=this.width-this.padding("horizontal");r=this.x+i/2+this.padding("left")}else r=this.x+this.padding("left");return{x:r,y:e}}
752,t.prototype.getContentHeight=function(e,n){n===void 0&&(n=1.15);var r=Array.isArray(this.text)?this.text.length:1,i=this.styles.fontSize/e*n,s=r*i+this.padding("vertical");return Math.max(s,this.styles.minCellHeight)},t.prototype.padding=function(e){var n=ZT(this.styles.cellPadding,0);return e==="vertical"?n.top+n.bottom:e==="horizontal"?n.left+n.right:n[e]},t}(),AFe=function(){function t(e,n,r){this.wrappedWidth=0,this.minReadableWidth=0,this.minWidth=0,this.width=0,this.dataKey=e,this.raw=n,this.index=r}return t.prototype.getMaxCustomCellWidth=function(e){for(var n=0,r=0,i=e.allRows();r<i.length;r++){var s=i[r],a=s.cells[this.index];a&&typeof a.styles.cellWidth=="number"&&(n=Math.max(n,a.styles.cellWidth))}return n},t}();function PFe(t,e){MFe(t,e);var n=[],r=0;e.columns.forEach(function(s){var a=s.getMaxCustomCellWidth(e);a?s.width=a:(s.width=s.wrappedWidth,n.push(s)),r+=s.width});var i=e.getWidth(t.pageSize().width)-r;i&&(i=IN(n,i,function(s){return Math.max(s.minReadableWidth,s.minWidth)})),i&&(i=IN(n,i,function(s){return s.minWidth})),i=Math.abs(i),!e.settings.horizontalPageBreak&&i>.1/t.scaleFactor()&&(i=i<1?i:Math.round(i),console.log("Of the table content, ".concat(i," units width could not fit page"))),RFe(e),IFe(e,t),NFe(e)}function MFe(t,e){var n=t.scaleFactor(),r=e.settings.horizontalPageBreak,i=uee(t,e);e.allRows().forEach(function(s){for(var a=0,o=e.columns;a<o.length;a++){var l=o[a],c=s.cells[l.index];if(c){var u=e.hooks.didParseCell;e.callCellHooks(t,u,c,s,l,null);var d=c.padding("horizontal");c.contentWidth=hS(c.text,c.styles,t)+d;var f=hS(c.text.join(" ").split(/[^\S\u00A0]+/),c.styles,t);if(c.minReadableWidth=f+c.padding("horizontal"),typeof c.styles.cellWidth=="number")c.minWidth=c.styles.cellWidth,c.wrappedWidth=c.styles.cellWidth;else if(c.styles.cellWidth==="wrap"||r===!0)c.contentWidth>i?(c.minWidth=i,c.wrappedWidth=i):(c.minWidth=c.contentWidth,c.wrappedWidth=c.contentWidth);else{var h=10/n;c.minWidth=c.styles.minCellWidth||h,c.wrappedWidth=c.contentWidth,c.minWidth>c.wrappedWidth&&(c.wrappedWidth=c.minWidth)}}}}),e.allRows().forEach(function(s){for(var a=0,o=e.columns;a<o.length;a++){var l=o[a],c=s.cells[l.index];if(c&&c.colSpan===1)l.wrappedWidth=Math.max(l.wrappedWidth,c.wrappedWidth),l.minWidth=Math.max(l.minWidth,c.minWidth),l.minReadableWidth=Math.max(l.minReadableWidth,c.minReadableWidth);else{var u=e.styles.columnStyles[l.dataKey]||e.styles.columnStyles[l.index]||{},d=u.cellWidth||u.minCellWidth;d&&typeof d=="number"&&(l.minWidth=d,l.wrappedWidth=d)}c&&(c.colSpan>1&&!l.minWidth&&(l.minWidth=c.minWidth),c.colSpan>1&&!l.wrappedWidth&&(l.wrappedWidth=c.minWidth))}})}function IN(t,e,n){for(var r=e,i=t.reduce(function(h,p){return h+p.wrappedWidth},0),s=0;s<t.length;s++){var a=t[s],o=a.wrappedWidth/i,l=r*o,c=a.width+l,u=n(a),d=c<u?u:c;e-=d-a.width,a.width=d}if(e=Math.round(e*1e10)/1e10,e){var f=t.filter(function(h){return e<0?h.width>n(h):!0});f.length&&(e=IN(f,e,n))}return e}function NFe(t){for(var e={},n=1,r=t.allRows(),i=0;i<r.length;i++)for(var s=r[i],a=0,o=t.columns;a<o.length;a++){var l=o[a],c=e[l.index];if(n>1)n--,delete s.cells[l.index];else if(c)c.cell.height+=s.height,n=c.cell.colSpan,delete s.cells[l.index],c.left--,c.left<=1&&delete e[l.index];else{var u=s.cells[l.index];if(!u)continue;if(u.height=s.height,u.rowSpan>1){var d=r.length-i,f=u.rowSpan>d?d:u.rowSpan;e[l.index]={cell:u,left:f,row:s}}}}}function RFe(t){for(var e=t.allRows(),n=0;n<e.length;n++)for(var r=e[n],i=null,s=0,a=0,o=0;o<t.columns.length;o++){var l=t.columns[o];if(a-=1,a>1&&t.columns[o+1])s+=l.width,delete r.cells[l.index];else if(i){var c=i;delete r.cells[l.index],i=null,c.width=l.width+s}else{var c=r.cells[l.index];if(!c)continue;if(a=c.colSpan,s=0,c.colSpan>1){i=c,s+=l.width;continue}c.width=l.width+s}}}function IFe(t,e){for(var n={count:0,height:0},r=0,i=t.allRows();r<i.length;r++){for(var s=i[r],a=0,o=t.columns;a<o.length;a++){var l=o[a],c=s.cells[l.index];if(c){e.applyStyles(c.styles,!0);var u=c.width-c.padding("horizontal");if(c.styles.overflow==="linebreak")c.text=e.splitTextToSize(c.text,u+1/e.scaleFactor(),{fontSize:c.styles.fontSize});else if(c.styles.overflow==="ellipsize")c.text=d7(c.text,u,c.styles,e,"...");else if(c.styles.overflow==="hidden")c.text=d7(c.text,u,c.styles,e,"");else if(typeof c.styles.overflow=="function"){var d=c.styles.overflow(c.text,u);
752typeof d=="string"?c.text=[d]:c.text=d}c.contentHeight=c.getContentHeight(e.scaleFactor(),e.getLineHeightFactor());var f=c.contentHeight/c.rowSpan;c.rowSpan>1&&n.count*n.height<f*c.rowSpan?n={height:f,count:c.rowSpan}:n&&n.count>0&&n.height>f&&(f=n.height),f>s.height&&(s.height=f)}}n.count--}}function d7(t,e,n,r,i){return t.map(function(s){return LFe(s,e,n,r,i)})}function LFe(t,e,n,r,i){var s=1e4*r.scaleFactor();if(e=Math.ceil(e*s)/s,e>=hS(t,n,r))return t;for(;e<hS(t+i,n,r)&&!(t.length<=1);)t=t.substring(0,t.length-1);return t.trim()+i}function gee(t,e){var n=new ov(t),r=OFe(e,n.scaleFactor()),i=new EFe(e,r);return PFe(n,i),n.applyStyles(n.userStyles),i}function OFe(t,e){var n=t.content,r=FFe(n.columns);if(n.head.length===0){var i=h7(r,"head");i&&n.head.push(i)}if(n.foot.length===0){var i=h7(r,"foot");i&&n.foot.push(i)}var s=t.settings.theme,a=t.styles;return{columns:r,head:jE("head",n.head,r,a,s,e),body:jE("body",n.body,r,a,s,e),foot:jE("foot",n.foot,r,a,s,e)}}function jE(t,e,n,r,i,s){var a={},o=e.map(function(l,c){for(var u=0,d={},f=0,h=0,p=0,m=n;p<m.length;p++){var g=m[p];if(a[g.index]==null||a[g.index].left===0)if(h===0){var v=void 0;Array.isArray(l)?v=l[g.index-f-u]:v=l[g.dataKey];var _={};typeof v=="object"&&!Array.isArray(v)&&(_=(v==null?void 0:v.styles)||{});var b=jFe(t,g,c,i,r,s,_),x=new mee(v,b,t);d[g.dataKey]=x,d[g.index]=x,h=x.colSpan-1,a[g.index]={left:x.rowSpan-1,times:h}}else h--,f++;else a[g.index].left--,h=a[g.index].times,u++}return new pee(l,c,t,d)});return o}function h7(t,e){var n={};return t.forEach(function(r){if(r.raw!=null){var i=DFe(e,r.raw);i!=null&&(n[r.dataKey]=i)}}),Object.keys(n).length>0?n:null}function DFe(t,e){if(t==="head"){if(typeof e=="object")return e.header||null;if(typeof e=="string"||typeof e=="number")return e}else if(t==="foot"&&typeof e=="object")return e.footer;return null}function FFe(t){return t.map(function(e,n){var r,i;return typeof e=="object"?i=(r=e.dataKey)!==null&&r!==void 0?r:n:i=n,new AFe(i,e,n)})}function jFe(t,e,n,r,i,s,a){var o=fFe(r),l;t==="head"?l=i.headStyles:t==="body"?l=i.bodyStyles:t==="foot"&&(l=i.footStyles);var c=sd({},o.table,o[t],i.styles,l),u=i.columnStyles[e.dataKey]||i.columnStyles[e.index]||{},d=t==="body"?u:{},f=t==="body"&&n%2===0?sd({},o.alternateRow,i.alternateRowStyles):{},h=hFe(s),p=sd({},h,c,f,d);return sd(p,a)}function BFe(t,e,n){var r;n===void 0&&(n={});var i=uee(t,e),s=new Map,a=[],o=[],l=[];Array.isArray(e.settings.horizontalPageBreakRepeat)?l=e.settings.horizontalPageBreakRepeat:(typeof e.settings.horizontalPageBreakRepeat=="string"||typeof e.settings.horizontalPageBreakRepeat=="number")&&(l=[e.settings.horizontalPageBreakRepeat]),l.forEach(function(f){var h=e.columns.find(function(p){return p.dataKey===f||p.index===f});h&&!s.has(h.index)&&(s.set(h.index,!0),a.push(h.index),o.push(e.columns[h.index]),i-=h.wrappedWidth)});for(var c=!0,u=(r=n==null?void 0:n.start)!==null&&r!==void 0?r:0;u<e.columns.length;){if(s.has(u)){u++;continue}var d=e.columns[u].wrappedWidth;if(c||i>=d)c=!1,a.push(u),o.push(e.columns[u]),i-=d;else break;u++}return{colIndexes:a,columns:o,lastIndex:u-1}}function UFe(t,e){for(var n=[],r=0;r<e.columns.length;r++){var i=BFe(t,e,{start:r});i.columns.length&&(n.push(i),r=i.lastIndex)}return n}function vee(t,e){var n=e.settings,r=n.startY,i=n.margin,s={x:i.left,y:r},a=e.getHeadHeight(e.columns)+e.getFootHeight(e.columns),o=r+i.bottom+a;if(n.pageBreak==="avoid"){var l=e.body,c=l.reduce(function(f,h){return f+h.height},0);o+=c}var u=new ov(t);(n.pageBreak==="always"||n.startY!=null&&o>u.pageSize().height)&&(_ee(u),s.y=i.top),e.callWillDrawPageHooks(u,s);var d=sd({},s);e.startPageNumber=u.pageNumber(),n.horizontalPageBreak?zFe(u,e,d,s):(u.applyStyles(u.userStyles),(n.showHead==="firstPage"||n.showHead==="everyPage")&&e.head.forEac
vendor: 1,102 bytes, line 752
752h(function(f){return _d(u,e,f,s,e.columns)}),u.applyStyles(u.userStyles),e.body.forEach(function(f,h){var p=h===e.body.length-1;fS(u,e,f,p,d,s,e.columns)}),u.applyStyles(u.userStyles),(n.showFoot==="lastPage"||n.showFoot==="everyPage")&&e.foot.forEach(function(f){return _d(u,e,f,s,e.columns)})),lee(u,e,d,s),e.callEndPageHooks(u,s),e.finalY=s.y,t.lastAutoTable=e,u.applyStyles(u.userStyles)}function zFe(t,e,n,r){var i=UFe(t,e),s=e.settings;if(s.horizontalPageBreakBehaviour==="afterAllRows")i.forEach(function(c,u){t.applyStyles(t.userStyles),u>0?R_(t,e,n,r,c.columns,!0):f7(t,e,r,c.columns),$Fe(t,e,n,r,c.columns),BE(t,e,r,c.columns)});else for(var a=-1,o=i[0],l=function(){var c=a;if(o){t.applyStyles(t.userStyles);var u=o.columns;a>=0?R_(t,e,n,r,u,!0):f7(t,e,r,u),c=p7(t,e,a+1,r,u),BE(t,e,r,u)}var d=c-a;i.slice(1).forEach(function(f){t.applyStyles(t.userStyles),R_(t,e,n,r,f.columns,!0),p7(t,e,a+1,r,f.columns,d),BE(t,e,r,f.columns)}),a=c};a<e.body.length-1;)l()}function f7(t,e,n,r){var i=e.settings;t.applyStyles(t.userStyles),(i.showHead==="firstPage"||i.showHead==="everyPage")&&e.head.forEac
752h(function(s){return _d(t,e,s,n,r)})}function $Fe(t,e,n,r,i){t.applyStyles(t.userStyles),e.body.forEach(function(s,a){var o=a===e.body.length-1;fS(t,e,s,o,n,r,i)})}function p7(t,e,n,r,i,s){t.applyStyles(t.userStyles),s=s??e.body.length;var a=Math.min(n+s,e.body.length),o=-1;return e.body.slice(n,a).forEach(function(l,c){var u=n+c===e.body.length-1,d=yee(t,e,u,r);l.canEntireRowFit(d,i)&&(_d(t,e,l,r,i),o=n+c)}),o}function BE(t,e,n,r){var i=e.settings;t.applyStyles(t.userStyles),(i.showFoot==="lastPage"||i.showFoot==="everyPage")&&e.foot.forEach(function(s){return _d(t,e,s,n,r)})}function VFe(t,e,n){var r=n.getLineHeight(t.styles.fontSize),i=t.padding("vertical"),s=Math.floor((e-i)/r);return Math.max(0,s)}function qFe(t,e,n,r){var i={};t.spansMultiplePages=!0,t.height=0;for(var s=0,a=0,o=n.columns;a<o.length;a++){var l=o[a],c=t.cells[l.index];if(c){Array.isArray(c.text)||(c.text=[c.text]);var u=new mee(c.raw,c.styles,c.section);u=sd(u,c),u.text=[];var d=VFe(c,e,r);c.text.length>d&&(u.text=c.text.splice(d,c.text.length));var f=r.scaleFactor(),h=r.getLineHeightFactor();c.contentHeight=c.getContentHeight(f,h),c.contentHeight>=e&&(c.contentHeight=e,u.styles.minCellHeight-=e),c.contentHeight>t.height&&(t.height=c.contentHeight),u.contentHeight=u.getContentHeight(f,h),u.contentHeight>s&&(s=u.contentHeight),i[l.index]=u}}var p=new pee(t.raw,-1,t.section,i,!0);p.height=s;for(var m=0,g=n.columns;m<g.length;m++){var l=g[m],u=p.cells[l.index];u&&(u.height=p.height);var c=t.cells[l.index];c&&(c.height=t.height)}return p}function WFe(t,e,n,r){var i=t.pageSize().height,s=r.settings.margin,a=s.top+s.bottom,o=i-a;e.section==="body"&&(o-=r.getHeadHeight(r.columns)+r.getFootHeight(r.columns));var l=e.getMinimumRowHeight(r.columns,t),c=l<n;if(l>o)return console.log("Will not be able to print row ".concat(e.index," correctly since it's minimum height is larger than page height")),!0;if(!c)return!1;var u=e.hasRowSpan(r.columns),d=e.getMaxCellHeight(r.columns)>o;return d?(u&&console.log("The content of row ".concat(e.index," will not be drawn correctly since drawing rows with a height larger than the page height and has cells with rowspans is not supported.")),!0):!(u||r.settings.rowPageBreak==="avoid")}function fS(t,e,n,r,i,s,a){var o=yee(t,e,r,s);if(n.canEntireRowFit(o,a))_d(t,e,n,s,a);else if(WFe(t,n,o,e)){var l=qFe(n,o,e,t);_d(t,e,n,s,a),R_(t,e,i,s,a),fS(t,e,l,r,i,s,a)}else R_(t,e,i,s,a),fS(t,e,n,r,i,s,a)}function _d(t,e,n,r,i){r.x=e.settings.margin.left;for(var s=0,a=i;s<a.length;s++){var o=a[s],l=n.cells[o.index];if(!l){r.x+=o.width;continue}t.applyStyles(l.styles),l.x=r.x,l.y=r.y;var c=e.callCellHooks(t,e.hooks.willDrawCell,l,n,o,r);if(c===!1){r.x+=o.width;continue}GFe(t,l,r);var u=l.getTextPos();see(l.text,u.x,u.y,{halign:l.styles.halign,valign:l.styles.valign,maxWidth:Math.ceil(l.width-l.padding("left")-l.padding("right"))},t.getDocument()),e.callCellHooks(t,e.hooks.didDrawCell,l,n,o,r),r.x+=o.width}r.y+=n.height}function GFe(t,e,n){var r=e.styles;if(t.getDocument().setFillColor(t.getDocument().getFillColor()),typeof r.lineWidth=="number"){var i=cee(r.lineWidth,r.fillColor);i&&t.rect(e.x,n.y,e.width,e.height,i)}else typeof r.lineWidth=="object"&&(r.fillColor&&t.rect(e.x,n.y,e.width,e.height,"F"),HFe(t,e,n,r.lineWidth))}function HFe(t,e,n,r){var i,s,a,o;r.top&&(i=n.x,s=n.y,a=n.x+e.width,o=n.y,r.right&&(a+=.5*r.right),r.left&&(i-=.5*r.left),l(r.top,i,s,a,o)),r.bottom&&(i=n.x,s=n.y+e.height,a=n.x+e.width,o=n.y+e.height,r.right&&(a+=.5*r.right),r.left&&(i-=.5*r.left),l(r.bottom,i,s,a,o)),r.left&&(i=n.x,s=n.y,a=n.x,o=n.y+e.height,r.top&&(s-=.5*r.top),r.bottom&&(o+=.5*r.bottom),l(r.left,i,s,a,o)),r.right&&(i=n.x+e.width,s=n.y,a=n.x+e.width,o=n.y+e.height,r.top&&(s-=.5*r.top),r.bottom&&(o+=.5*r.bottom),l(r.right,i,s,a,o));function l(c,u,d,f,h){t.getDocument().setLineWidth(c),t.getDocument().line(u,d,f,h,"S")}}function yee(t,e,n,r){var i=e.settings.margin.bottom,s=e.settings.showFoot;return(s==="everyPage"||s==="lastPage"&&n)&&(i+=e.getFootHeight(e.columns)),t.pageSize().height-r.y-i}function R_(t,e,n,r,i,s){i===void 0&&(i=[]),s===void 0&&(s=!1),t.applyStyles(t.userStyles),e.settings.showFoot==="everyPage"&&!s&&e.foot.forEach(function(o){return _d(t,e,o,r,i)}),e.callEndPageHooks(t,r);var a=e.settings.margin;lee(t,e,n,r),_ee(t),e.pageNumber++,r.x=a.left,r.y=a.top,n.y=a.top,e.callWillDrawPageHooks(t,r),e.settings.showHead==="everyPage"&&(e.head.forEac
752h(function(o){return _d(t,e,o,r,i)}),t.applyStyles(t.userStyles))}function _ee(t){var e=t.pageNumber();t.setPage(e+1);var n=t.pageNumber();return n===e?(t.addPage(),!0):!1}function KFe(t){t.API.autoTable=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=e[0],i=fee(this,r),s=gee(this,i);return vee(this,s),this},t.API.lastAutoTable=!1,t.API.autoTableText=function(e,n,r,i){see(e,n,r,i,this)},t.API.autoTableSetDefaults=function(e){return ov.setDefaults(e,this),this},t.autoTableSetDefaults=function(e,n){ov.setDefaults(e,n)},t.API.autoTableHtmlToJson=function(e,n){var r;if(n===void 0&&(n=!1),typeof window>"u")return console.error("Cannot run autoTableHtmlToJson in non browser environment"),null;var i=new ov(this),s=hee(i,e,window,n,!1),a=s.head,o=s.body,l=((r=a[0])===null||r===void 0?void 0:r.map(function(c){return c.content}))||[];return{columns:l,rows:o,data:o}}}var UE;function zE(t,e){var n=fee(t,e),r=gee(t,n);vee(t,r)}try{if(typeof window<"u"&&window){var m7=window,g7=m7.jsPDF||((UE=m7.jspdf)===null||UE===void 0?void 0:UE.jsPDF);g7&&KFe(g7)}}catch(t){console.error("Could not apply autoTable plugin",t)}const $E="/assets/boattrax-logo-UF6AB3NS.png",$f=[{id:"RPT-2025-1203",boatName:"Sea Breeze II",date:"Dec 2, 2025",type:"Full Service Report",tasks:["Hull Sanding","Anti-fouling Prep","Polish"],duration:"6h 45m",status:"complete",photos:24,aiScore:94,notes:"Hull in excellent condition after service. Minor oxidation addressed."},{id:"RPT-2025-1201",boatName:"Marina Star",date:"Dec 1, 2025",type:"Maintenance Report",tasks:["Deck Polishing","Inspection"],duration:"4h 15m",status:"complete",photos:18,aiScore:88,notes:"Deck restored to showroom condition. Recommended follow-up in 3 months."},{id:"RPT-2025-1130",boatName:"Ocean Quest",date:"Nov 30, 2025",type:"Inspection Report",tasks:["Hull Inspection","Surface Analysis"],duration:"2h 30m",status:"complete",photos:12,aiScore:76,notes:"Some barnacle buildup detected. Full cleaning recommended within 2 weeks."},{id:"RPT-2025-1129",boatName:"Windchaser",date:"Nov 29, 2025",type:"Full Service Report",tasks:["Complete Hull Service","Buffing","Wax Application"],duration:"8h 20m",status:"complete",photos:32,aiScore:97,notes:"Premium service completed. Vessel in pristine condition."},{id:"RPT-2025-1115",boatName:"Sea Breeze II",date:"Nov 15, 2025",type:"Inspection Report",tasks:["Pre-Service Inspection","Photo Documentation"],duration:"1h 30m",status:"complete",photos:8,aiScore:72,notes:"Initial assessment before full service. Oxidation and minor scratches noted."},{id:"RPT-2025-1101",boatName:"Marina Star",date:"Nov 1, 2025",type:"Full Service Report",tasks:["Hull Cleaning","Bottom Paint Touch-up"],duration:"5h 45m",status:"complete",photos:22,aiScore:91,notes:"Thorough cleaning completed. Anti-fouling paint refreshed."}],JFe=()=>{const[t,e]=I.useState(""),[n,r]=I.useState(""),[i,s]=I.useState(null),[a,o]=I.useState(!1),l=[...new Set($f.map(h=>h.boatName))],c=l.filter(h=>h.toLowerCase().includes(n.toLowerCase())),u=i?$f.filter(h=>h.boatName===i):[],d=h=>{const p=$f.filter(_=>_.boatName===h),m=p.reduce((_,b)=>{const x=b.duration.match(/(\d+)h\s*(\d+)?m?/);return x?_+parseInt(x[1])+parseInt(x[2]||"0")/60:_},0),g=p.reduce((_,b)=>_+b.photos,0),v=Math.round(p.reduce((_,b)=>_+b.aiScore,0)/p.length);return{totalServices:p.length,totalHours:m.toFixed(1),totalPhotos:g,avgScore:v}},f=async h=>{const p=$f.filter(te=>te.boatName===h),m=d(h),g=new Rt,v=g.internal.pageSize.getWidth();g.setFillColor(10,35,66),g.rect(0,0,v,45,"F");try{const te=new Image;te.crossOrigin="anonymous",await new Promise((V,q)=>{te.onload=()=>V(),te.onerror=q,te.src=$E});const ne=document.createElement("canvas");ne.width=te.width,ne.height=te.height;const le=ne.getContext("2d");if(le){le.drawImage(te,0,0);const V=ne.toDataURL("image/png"),q=30,se=te.width/te.height*q;g.addImage(V,"PNG",15,5,se,q)}}catch{g.setTextColor(255,255,255),g.setFontSize(24),g.setFont("helvetica","bold"),g.text("BoatTrax",20,22)}g.setTextColor(255,255,255),g.setFontSize(12),g.setFont("helvetica","normal"),g.text("Complete Service History Report",20,38),g.setFontSize(16),g.text(h,v-20,22,{align:"right"}),g.setFontSize(10),g.text(`Generated: ${new Date().toLocaleDateString()}`,v-20,32,{align:"right"}),g.setTextColor(0,0,0),g.setFontSize(14),g.setFont("helvetica","bold"),g.text("Service Summary",20,60),g.setFontSize(10),g.setFont("helvetica","normal");const _=70,b=[["Total Services",m.totalServices.toString()],["Total Hours",`${m.totalHours}h`],["Photos Documented",m.totalPhotos.toString()],["Average AI Score",`${m.avgScore}%`]];zE(g,{startY:_,head:[["Metric","Value"]],body:b,theme:"grid",headStyles:{fillColor:[10,35,66],textColor:[255,255,255]}
752,styles:{fontSize:10,cellPadding:5},columnStyles:{0:{fontStyle:"bold"}},margin:{left:20,right:20}});const x=g.lastAutoTable.finalY+15;g.setFontSize(14),g.setFont("helvetica","bold"),g.text("Service History",20,x);const T=p.map(te=>[te.date,te.id,te.type,te.tasks.join(", "),te.duration,`${te.aiScore}%`]);zE(g,{startY:x+5,head:[["Date","Report ID","Type","Tasks Performed","Duration","AI Score"]],body:T,theme:"striped",headStyles:{fillColor:[10,35,66],textColor:[255,255,255]},styles:{fontSize:8,cellPadding:3},columnStyles:{0:{cellWidth:25},1:{cellWidth:30},2:{cellWidth:35},3:{cellWidth:50},4:{cellWidth:20},5:{cellWidth:20}},margin:{left:20,right:20}});const N=g.lastAutoTable.finalY+15;g.setFontSize(14),g.setFont("helvetica","bold"),g.text("Service Notes",20,N);const A=p.map(te=>[te.date,te.notes]);zE(g,{startY:N+5,head:[["Date","Notes"]],body:A,theme:"grid",headStyles:{fillColor:[10,35,66],textColor:[255,255,255]},styles:{fontSize:9,cellPadding:4},columnStyles:{0:{cellWidth:30},1:{cellWidth:140}},margin:{left:20,right:20}});let L=g.lastAutoTable.finalY+15;g.setFontSize(14),g.setFont("helvetica","bold"),g.setTextColor(0,0,0),g.text("Photo Documentation",20,L),L+=10;const M=25,B=5,R=6,j=g.internal.pageSize.getHeight();for(const te of p){L+40>j-60&&(g.addPage(),L=20),g.setFontSize(10),g.setFont("helvetica","bold"),g.setTextColor(10,35,66),g.text(`${te.date} - ${te.type}`,20,L),g.setFont("helvetica","normal"),g.setFontSize(8),g.setTextColor(100,100,100),g.text(`${te.photos} photos captured`,120,L),L+=5;const ne=Math.min(te.photos,R);for(let le=0;le<ne;le++){const V=20+le*(M+B);g.setFillColor(230,240,250),g.roundedRect(V,L,M,M,2,2,"F"),g.setFillColor(10,35,66),g.circle(V+M/2,L+M/2,5,"F"),g.setTextColor(255,255,255),g.setFontSize(6),g.text(`${le+1}`,V+M/2-2,L+M/2+2)}if(te.photos>R){const le=20+R*(M+B);g.setFillColor(10,35,66),g.roundedRect(le,L,M,M,2,2,"F"),g.setTextColor(255,255,255),g.setFontSize(8),g.text(`+${te.photos-R}`,le+5,L+M/2+3)}L+=M+10}let $=L+5;$+50>j-25&&(g.addPage(),$=20),g.setFillColor(255,243,205),g.roundedRect(20,$,v-40,25,3,3,"F"),g.setTextColor(133,100,4),g.setFontSize(11),g.setFont("helvetica","bold"),g.text("AI Recommendation",25,$+10),g.setFont("helvetica","normal"),g.setFontSize(9),g.text("Based on service history, next recommended maintenance: Hull inspection in 45 days",25,$+18);const U=$+45;g.setTextColor(128,128,128),g.setFontSize(8),g.text("Generated by NautIQ Technologies - BoatTrax System",v/2,U,{align:"center"}),g.text(`Report for ${h} | Page 1 of 1`,v/2,U+5,{align:"center"}),g.save(`BoatTrax_${h.replace(/\s+/g,"_")}_${new Date().toISOString().split("T")[0]}.pdf`)};return w.jsx(hf,{children:w.jsxs("div",{className:"min-h-screen flex w-full",children:[w.jsx(im,{}),w.jsxs("main",{className:"flex-1 overflow-auto",children:[w.jsx("header",{className:"sticky top-0 z-10 bg-background/80 backdrop-blur-xl border-b border-border/50 px-6 py-3",children:w.jsxs("div",{className:"flex items-center justify-between",children:[w.jsxs("div",{className:"flex items-center gap-3",children:[w.jsx("img",{src:$E,alt:"BoatTrax",className:"h-24 w-auto object-contain -my-6"}),w.jsx("span",{className:"text-xl font-semibold text-foreground",children:"Job Reports"})]}),w.jsxs($t,{variant:"aqua",children:[w.jsx(sw,{className:"w-4 h-4"}),"Export All Reports"]})]})}),w.jsxs("div",{className:"p-6 space-y-6",children:[w.jsxs("div",{className:"flex flex-col md:flex-row gap-4",children:[w.jsxs("div",{className:"relative flex-1",children:[w.jsx(TF,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),w.jsx(kr,{placeholder:"Search reports by boat name, ID, or task...",value:t,onChange:h=>e(h.target.value),className:"pl-10"})]}),w.jsxs("div",{className:"flex gap-2",children:[w.jsxs($t,{variant:"navy",children:[w.jsx(Eae,{className:"w-4 h-4"}),"Date Range"]}),w.jsxs($t,{variant:"navy",children:[w.jsx(Iae,{className:"w-4 h-4"}),"Filters"]})]})]}),w.jsx("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[{icon:yk,label:"Total Reports",value:"156",color:"text-primary"},{icon:py,label:"Boats Serviced",value:"42",color:"text-info"},{icon:Kg,label:"Total Hours",value:"523h",color:"text-success"},{icon:HV,label:"Photos Captured",value:"1,247",color:"text-warning"}].map((h,p)=>w.jsxs(ar.div,{initial:{opacity:0,y:20}
752,animate:{opacity:1,y:0},transition:{delay:p*.1},className:"glass-card p-4 flex items-center gap-4",children:[w.jsx("div",{className:`p-3 rounded-lg bg-muted/50 ${h.color}`,children:w.jsx(h.icon,{className:"w-5 h-5"})}),w.jsxs("div",{children:[w.jsx("p",{className:"text-sm text-muted-foreground",children:h.label}),w.jsx("p",{className:"text-xl font-semibold text-foreground",children:h.value})]})]},h.label))}),w.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[w.jsx("div",{className:"lg:col-span-2",children:w.jsx(Wr,{title:"Service Reports",icon:yk,glowing:!0,children:w.jsx("div",{className:"space-y-4",children:$f.map((h,p)=>w.jsxs(ar.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:p*.1},className:"p-4 bg-muted/30 rounded-lg hover:bg-muted/50 transition-colors cursor-pointer group",children:[w.jsxs("div",{className:"flex items-start justify-between mb-3",children:[w.jsxs("div",{children:[w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx("h3",{className:"font-medium text-foreground",children:h.boatName}),w.jsx("span",{className:"text-xs text-muted-foreground",children:h.id})]}),w.jsx("p",{className:"text-sm text-primary mt-1",children:h.type})]}),w.jsxs("div",{className:"text-right",children:[w.jsx("p",{className:"text-sm text-muted-foreground",children:h.date}),w.jsx("p",{className:"text-sm text-foreground font-medium",children:h.duration})]})]}),w.jsxs("div",{className:"flex items-center justify-between",children:[w.jsx("div",{className:"flex flex-wrap gap-2",children:h.tasks.map(m=>w.jsx("span",{className:"px-2 py-1 text-xs bg-primary/10 text-primary rounded",children:m},m))}),w.jsx(WV,{className:"w-5 h-5 text-muted-foreground group-hover:text-primary transition-colors"})]})]},h.id))})})}),w.jsx(Wr,{title:"Recent Activity",icon:Kg,children:w.jsx(UX,{})})]}),w.jsx(Wr,{title:w.jsxs("div",{className:"flex items-center gap-3",children:[w.jsx("img",{src:$E,alt:"BoatTrax",className:"h-24 w-auto object-contain -my-6"}),w.jsx("span",{})]}),icon:py,children:w.jsxs("div",{className:"space-y-4",children:[w.jsx("div",{className:"flex flex-col md:flex-row gap-3",children:w.jsxs("div",{className:"relative flex-1",children:[w.jsx(TF,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),w.jsx(kr,{placeholder:"Search boat by name...",value:n,onChange:h=>r(h.target.value),className:"pl-10"})]})}),n&&w.jsx("div",{className:"bg-muted/30 rounded-lg p-2 space-y-1",children:c.length>0?c.map(h=>w.jsxs("button",{onClick:()=>{s(h),r(""),o(!0)},className:"w-full text-left px-3 py-2 rounded hover:bg-primary/20 transition-colors flex items-center gap-2",children:[w.jsx(py,{className:"w-4 h-4 text-primary"}),w.jsx("span",{className:"text-foreground",children:h}),w.jsxs("span",{className:"text-xs text-muted-foreground ml-auto",children:[$f.filter(p=>p.boatName===h).length," reports"]})]},h)):w.jsxs("p",{className:"text-sm text-muted-foreground px-3 py-2",children:['No boats found matching "',n,'"']})}),!n&&!a&&w.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:l.map(h=>w.jsxs("button",{onClick:()=>{s(h),o(!0)},className:"p-3 bg-muted/30 rounded-lg hover:bg-primary/20 transition-colors text-left",children:[w.jsx(py,{className:"w-5 h-5 text-primary mb-2"}),w.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:h}),w.jsxs("p",{className:"text-xs text-muted-foreground",children:[$f.filter(p=>p.boatName===h).length," services"]})]},h))}),w.jsx(cme,{children:a&&i&&w.jsx(ar.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"overflow-hidden",children:w.jsxs("div",{className:"bg-muted/20 rounded-lg border border-border/50 overflow-hidden",children:[w.jsxs("div",{className:"bg-primary/10 p-4 flex items-center justify-between",children:[w.jsxs("div",{className:"flex items-center gap-3",children:[w.jsx("div",{className:"p-2 bg-primary/20 rounded-lg",children:w.jsx(py,{className:"w-6 h-6 text-primary"})}),w.jsxs("div",{children:[w.jsx("h3",{className:"text-lg font-semibold text-foreground",children:i}),w.jsx("p",{className:"text-sm text-muted-foreground",children:"Complete Service History Report"})]})]}),w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsxs($t,{variant:"aqua",size:"sm",onClick:()=>f(i),children:[w.jsx(sw,{className:"w-4 h-4"}),"Export PDF"]}),w.jsx($t,{variant:"ghost",size:"icon",onClick:()=>{o(!1),s(null)},children:w.jsx(vR,{className:"w-4 h-4"})})]})]}),w.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 p-4 border-b border-border/30",children:(()=>{const h=d(i);return w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"text-center",children:[w.jsx("p",{className:"text-2xl font-bold text-primary",children:h.totalServices}),w.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Services"})]}),w.jsxs("div",{className:"text-center",children:[w.jsxs("p",{className:"text-2xl font-bold text-info",children:[h.totalHours,"h"]}),w.jsx("p",{className:"text-xs text-muted-foreground",children:"Service Hours"})]}),w.jsxs("div",{className:"text-center",children:[w.jsx("p",{className:"text-2xl font-bold text-success",children:h.totalPhotos}),w.jsx("p",{className:"text-xs text-muted-foreground",children:"Photos Documented"})]}),w.jsxs("div",{className:"text-center",children:[w.jsxs("p",{className:"text-2xl font-bold text-warning",children:[h.avgScore,"%"]}),w.jsx("p",{className:"text-xs text-muted-foreground",children:"Avg AI Score"})]})]})})()}),w.jsxs("div",{className:"p-4 space-y-3",children:[w.jsx("h4",{className:"text-sm font-medium text-foreground mb-3",children:"Service Timeline"}),u.map((h,p)=>w.jsxs(ar.div,{initial:{opacity:0,x:-20}
752,animate:{opacity:1,x:0},transition:{delay:p*.1},className:"relative pl-6 pb-4 border-l-2 border-primary/30 last:border-l-0",children:[w.jsx("div",{className:"absolute left-[-5px] top-0 w-2 h-2 rounded-full bg-primary"}),w.jsxs("div",{className:"bg-muted/30 rounded-lg p-3",children:[w.jsxs("div",{className:"flex items-start justify-between mb-2",children:[w.jsxs("div",{children:[w.jsx("p",{className:"text-sm font-medium text-foreground",children:h.type}),w.jsxs("p",{className:"text-xs text-muted-foreground",children:[h.date," ⢠",h.id]})]}),w.jsx("div",{className:"flex items-center gap-2",children:w.jsxs("span",{className:`text-xs px-2 py-1 rounded ${h.aiScore>=90?"bg-success/20 text-success":h.aiScore>=80?"bg-info/20 text-info":"bg-warning/20 text-warning"}`,children:["AI: ",h.aiScore,"%"]})})]}),w.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:h.tasks.map(m=>w.jsx("span",{className:"text-xs px-2 py-0.5 bg-primary/10 text-primary rounded",children:m},m))}),w.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground mb-2",children:[w.jsxs("span",{className:"flex items-center gap-1",children:[w.jsx(Kg,{className:"w-3 h-3"})," ",h.duration]}),w.jsxs("span",{className:"flex items-center gap-1",children:[w.jsx(qV,{className:"w-3 h-3"})," ",h.photos," photos"]}),w.jsxs("span",{className:"flex items-center gap-1",children:[w.jsx(vk,{className:"w-3 h-3 text-success"})," Complete"]})]}),w.jsxs("p",{className:"text-xs text-muted-foreground italic",children:['"',h.notes,'"']})]})]},h.id))]}),w.jsx("div",{className:"p-4 bg-warning/5 border-t border-border/30",children:w.jsxs("div",{className:"flex items-start gap-2",children:[w.jsx(QV,{className:"w-4 h-4 text-warning mt-0.5"}),w.jsxs("div",{children:[w.jsx("p",{className:"text-sm font-medium text-foreground",children:"AI Recommendation"}),w.jsxs("p",{className:"text-xs text-muted-foreground",children:["Based on service history, next recommended maintenance:",w.jsx("span",{className:"text-primary font-medium",children:" Hull inspection in 45 days"})]})]})]})})]})})})]})})]})]})]})})};var eC="Switch",[YFe,v7e]=lf(eC),[XFe,QFe]=YFe(eC),wee=I.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:i,defaultChecked:s,required:a,disabled:o,value:l="on",onCheckedChange:c,form:u,...d}=t,[f,h]=I.useState(null),p=ri(e,b=>h(b)),m=I.useRef(!1),g=f?u||!!f.closest("form"):!0,[v,_]=i1({prop:i,defaultProp:s??!1,onChange:c,caller:eC});return w.jsxs(XFe,{scope:n,checked:v,disabled:o,children:[w.jsx(Jn.button,{type:"button",role:"switch","aria-checked":v,"aria-required":a,"data-state":See(v),"data-disabled":o?"":void 0,disabled:o,value:l,...d,ref:p,onClick:Hn(t.onClick,b=>{_(x=>!x),g&&(m.current=b.isPropagationStopped(),m.current||b.stopPropagation())})}),g&&w.jsx(kee,{control:f,bubbles:!m.current,name:r,value:l,checked:v,required:a,disabled:o,form:u,style:{transform:"translateX(-100%)"}})]})});wee.displayName=eC;var bee="SwitchThumb",xee=I.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,i=QFe(bee,n);return w.jsx(Jn.span,{"data-state":See(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:e})});xee.displayName=bee;var ZFe="SwitchBubbleInput",kee=I.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...i},s)=>{const a=I.useRef(null),o=ri(a,s),l=AQ(n),c=TR(e);return I.useEffect(()=>{const u=a.current;if(!u)return;const d=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(d,"checked").set;if(l!==n&&h){const p=new Event("click",{bubbles:r});h.call(u,n),u.dispatchEvent(p)}},[l,n,r]),w.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:o,style:{...i.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});kee.displayName=ZFe;function See(t){return t?"checked":"unchecked"}var Tee=wee,e6e=xee;const Xf=I.forwardRef(({className:t,...e},n)=>w.jsx(Tee,{className:vt("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",t),...e,ref:n,children:w.jsx(e6e,{className:vt("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}
752));Xf.displayName=Tee.displayName;var t6e="Label",Cee=I.forwardRef((t,e)=>w.jsx(Jn.label,{...t,ref:e,onMouseDown:n=>{var i;n.target.closest("button, input, select, textarea")||((i=t.onMouseDown)==null||i.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Cee.displayName=t6e;var Eee=Cee;const n6e=a1("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Rl=I.forwardRef(({className:t,...e},n)=>w.jsx(Eee,{ref:n,className:vt(n6e(),t),...e}));Rl.displayName=Eee.displayName;const r6e=()=>w.jsx(hf,{children:w.jsxs("div",{className:"min-h-screen flex w-full",children:[w.jsx(im,{}),w.jsxs("main",{className:"flex-1 overflow-auto",children:[w.jsx("header",{className:"sticky top-0 z-10 bg-background/80 backdrop-blur-xl border-b border-border/50 px-6 py-3",children:w.jsxs("div",{className:"flex items-center justify-between",children:[w.jsx("h1",{className:"text-xl font-semibold text-foreground",children:"Settings"}),w.jsxs("div",{className:"flex gap-2",children:[w.jsxs($t,{variant:"navy",children:[w.jsx(qP,{className:"w-4 h-4"}),"Reset to Defaults"]}),w.jsxs($t,{variant:"aqua",children:[w.jsx(gR,{className:"w-4 h-4"}),"Save Changes"]})]})]})}),w.jsxs("div",{className:"p-6 space-y-6 max-w-4xl",children:[w.jsx(Wr,{title:"Robot Connection",icon:eq,children:w.jsxs("div",{className:"space-y-4",children:[w.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[w.jsxs("div",{children:[w.jsx(Rl,{className:"text-sm text-muted-foreground",children:"Robot IP Address"}),w.jsx(kr,{placeholder:"192.168.1.100",defaultValue:"192.168.1.100",className:"mt-1"})]}),w.jsxs("div",{children:[w.jsx(Rl,{className:"text-sm text-muted-foreground",children:"Connection Port"}),w.jsx(kr,{placeholder:"8080",defaultValue:"8080",className:"mt-1"})]})]}),w.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/30 rounded-lg",children:[w.jsxs("div",{children:[w.jsx("p",{className:"text-sm font-medium text-foreground",children:"Auto-reconnect"}),w.jsx("p",{className:"text-xs text-muted-foreground",children:"Automatically reconnect when connection is lost"})]}),w.jsx(Xf,{defaultChecked:!0})]})]})}),w.jsx(Wr,{title:"Notifications",icon:Tae,children:w.jsx("div",{className:"space-y-3",children:[{title:"Task Completion Alerts",desc:"Get notified when a task is completed",checked:!0},{title:"System Warnings",desc:"Receive alerts for system issues",checked:!0},{title:"AI Predictions Ready",desc:"Notify when AI analysis is complete",checked:!0},{title:"Training Updates",desc:"Updates on ML model training progress",checked:!1}].map(t=>w.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/30 rounded-lg",children:[w.jsxs("div",{children:[w.jsx("p",{className:"text-sm font-medium text-foreground",children:t.title}),w.jsx("p",{className:"text-xs text-muted-foreground",children:t.desc})]}),w.jsx(Xf,{defaultChecked:t.checked})]},t.title))})}),w.jsx(Wr,{title:"Data & Storage",icon:VP,children:w.jsxs("div",{className:"space-y-4",children:[w.jsxs("div",{className:"p-4 bg-muted/30 rounded-lg",children:[w.jsxs("div",{className:"flex items-center justify-between mb-2",children:[w.jsx("span",{className:"text-sm text-muted-foreground",children:"Storage Used"}),w.jsx("span",{className:"text-sm font-medium text-foreground",children:"45.2 GB / 100 GB"})]}),w.jsx("div",{className:"h-2 bg-muted rounded-full overflow-hidden",children:w.jsx("div",{className:"h-full bg-primary rounded-full",style:{width:"45.2%"}})})]}),w.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/30 rounded-lg",children:[w.jsxs("div",{children:[w.jsx("p",{className:"text-sm font-medium text-foreground",children:"Auto-backup"}),w.jsx("p",{className:"text-xs text-muted-foreground",children:"Automatically backup data daily"})]}),w.jsx(Xf,{defaultChecked:!0})]}),w.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/30 rounded-lg",children:[w.jsxs("div",{children:[w.jsx("p",{className:"text-sm font-medium text-foreground",children:"Keep Motion Data"}),w.jsx("p",{className:"text-xs text-muted-foreground",children:"Retain recorded motion data for training"})]}),w.jsx(Xf,{defaultChecked:!0})]})]})}),w.jsx(Wr,{title:"Security",icon:qae,children:w.jsxs("div",{className:"space-y-4",children:[w.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/30 rounded-lg",children:[w.jsxs("div",{children:[w.jsx("p",{className:"text-sm font-medium text-foreground",children:"Two-Factor Authentication"}),w.jsx("p",{className:"text-xs text-muted-foreground",children:"Add an extra layer of security"})]}),w.jsx(Xf,{})]}),w.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/30 rounded-lg",children:[w.jsxs("div",{children:[w.jsx("p",{className:"text-sm font-medium text-foreground",children:"Session Timeout"}),w.jsx("p",{className:"text-xs text-muted-foreground",children:"Automatically log out after inactivity"})]}),w.jsx(Xf,{defaultChecked:!0})]}),w.jsx($t,{variant:"outline",className:"w-full",children:"Change Password"})]})})]})]})]})}),i6e=()=>{const t=Zp(),{toast:e}=Xv(),n=()=>{e({title:"Logged out",description:"You have been successfully logged out."}),t("/")};return w.jsx(hf,{children:w.jsxs("div",{className:"min-h-screen flex w-full",children:[w.jsx(im,{}),w.jsxs("main",{className:"flex-1 overflow-auto",children:[w.jsx("header",{className:"sticky top-0 z-10 bg-background/80 backdrop-blur-xl border-b border-border/50 px-6 py-3",children:w.jsxs("div",{className:"flex items-center justify-between",children:[w.jsx("h1",{className:"text-xl font-semibold text-foreground",children:"User Profile"}),w.jsxs("div",{className:"flex gap-2",children:[w.jsxs($t,{variant:"outline",onClick:n,children:[w.jsx(Fae,{className:"w-4 h-4"}),"Log Out"]}),w.jsxs($t,{variant:"aqua",children:[w.jsx(gR,{className:"w-4 h-4"}),"Save Changes"]})]})]})}),w.jsxs("div",{className:"p-6 space-y-6 max-w-4xl",children:[w.jsxs(ar.div,{initial:{opacity:0,y:20}
752,animate:{opacity:1,y:0},className:"glass-card p-6 flex flex-col md:flex-row items-center gap-6",children:[w.jsxs("div",{className:"relative",children:[w.jsx("div",{className:"w-24 h-24 rounded-full bg-gradient-to-br from-primary to-accent flex items-center justify-center text-primary-foreground text-3xl font-bold",children:"JD"}),w.jsx("button",{className:"absolute bottom-0 right-0 p-2 bg-primary rounded-full text-primary-foreground hover:bg-primary/90 transition-colors",children:w.jsx(qV,{className:"w-4 h-4"})})]}),w.jsxs("div",{className:"text-center md:text-left",children:[w.jsx("h2",{className:"text-2xl font-semibold text-foreground",children:"John Doe"}),w.jsx("p",{className:"text-muted-foreground",children:"Senior Operator"}),w.jsx("p",{className:"text-sm text-primary mt-1",children:"NautIQ Technologies"})]})]}),w.jsx(Wr,{title:"Personal Information",icon:_k,children:w.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[w.jsxs("div",{children:[w.jsx(Rl,{className:"text-sm text-muted-foreground",children:"First Name"}),w.jsx(kr,{defaultValue:"John",className:"mt-1"})]}),w.jsxs("div",{children:[w.jsx(Rl,{className:"text-sm text-muted-foreground",children:"Last Name"}),w.jsx(kr,{defaultValue:"Doe",className:"mt-1"})]}),w.jsxs("div",{children:[w.jsx(Rl,{className:"text-sm text-muted-foreground",children:"Email Address"}),w.jsxs("div",{className:"relative mt-1",children:[w.jsx(fR,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),w.jsx(kr,{defaultValue:"[email protected]",className:"pl-10"})]})]}),w.jsxs("div",{children:[w.jsx(Rl,{className:"text-sm text-muted-foreground",children:"Phone Number"}),w.jsxs("div",{className:"relative mt-1",children:[w.jsx(JV,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),w.jsx(kr,{defaultValue:"+1 (555) 123-4567",className:"pl-10"})]})]})]})}),w.jsx(Wr,{title:"Work Information",icon:Cae,children:w.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[w.jsxs("div",{children:[w.jsx(Rl,{className:"text-sm text-muted-foreground",children:"Department"}),w.jsx(kr,{defaultValue:"Marine Operations",className:"mt-1"})]}),w.jsxs("div",{children:[w.jsx(Rl,{className:"text-sm text-muted-foreground",children:"Role"}),w.jsx(kr,{defaultValue:"Senior Operator",className:"mt-1"})]}),w.jsxs("div",{children:[w.jsx(Rl,{className:"text-sm text-muted-foreground",children:"Employee ID"}),w.jsx(kr,{defaultValue:"NQ-2025-0042",className:"mt-1",disabled:!0})]}),w.jsxs("div",{children:[w.jsx(Rl,{className:"text-sm text-muted-foreground",children:"Location"}),w.jsxs("div",{className:"relative mt-1",children:[w.jsx(jae,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),w.jsx(kr,{defaultValue:"Miami, FL",className:"pl-10"})]})]})]})}),w.jsx(Wr,{title:"Your Statistics",icon:_k,children:w.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[{label:"Jobs Completed",value:"127"},{label:"Hours Logged",value:"523h"},{label:"Boats Serviced",value:"42"},{label:"Avg. Rating",value:"4.9"}].map((r,i)=>w.jsxs(ar.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:i*.1},className:"p-4 bg-muted/30 rounded-lg text-center",children:[w.jsx("p",{className:"text-2xl font-semibold text-primary",children:r.value}),w.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:r.label})]},r.label))})})]})]})]})})};var v7={};function s6e(t,e){return e.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(r){if(r!=="default"&&!(r in t)){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}})}),Object.freeze(t)}var a6e=Object.defineProperty,o6e=(t,e,n)=>e in t?a6e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,y7=(t,e,n)=>o6e(t,typeof e!="symbol"?e+"":e,n);let As=class{constructor(){y7(this,"_locking"),y7(this,"_locks"),this._locking=Promise.resolve(),this._locks=0}isLocked(){return this._locks>0}lock(){this._locks+=1;let e;const n=new Promise(i=>e=()=>{this._locks-=1,i()}),r=this._locking.then(()=>e);return this._locking=this._locking.then(()=>n),r}};function mi(t,e){if(!t)throw new Error(e)}const l6e=34028234663852886e22,c6e=-34028234663852886e22,u6e=4294967295,d6e=2147483647,h6e=-2147483648;function Lx(t){if(typeof t!="number")throw new Error("invalid int 32: "+typeof t);
vendor: 10,896 bytes, line 752
752if(!Number.isInteger(t)||t>d6e||t<h6e)throw new Error("invalid int 32: "+t)}function LN(t){if(typeof t!="number")throw new Error("invalid uint 32: "+typeof t);if(!Number.isInteger(t)||t>u6e||t<0)throw new Error("invalid uint 32: "+t)}function Aee(t){if(typeof t!="number")throw new Error("invalid float 32: "+typeof t);if(Number.isFinite(t)&&(t>l6e||t<c6e))throw new Error("invalid float 32: "+t)}const Pee=Symbol("@bufbuild/protobuf/enum-type");function f6e(t){const e=t[Pee];return mi(e,"missing enum type on enum object"),e}function Mee(t,e,n,r){t[Pee]=Nee(e,n.map(i=>({no:i.no,name:i.name,localName:t[i.no]})))}function Nee(t,e,n){const r=Object.create(null),i=Object.create(null),s=[];for(const a of e){const o=Ree(a);s.push(o),r[a.name]=o,i[a.no]=o}return{typeName:t,values:s,findName(a){return r[a]},findNumber(a){return i[a]}}}function p6e(t,e,n){const r={};for(const i of e){const s=Ree(i);r[s.localName]=s.no,r[s.no]=s.localName}return Mee(r,t,e),r}function Ree(t){return"localName"in t?t:Object.assign(Object.assign({},t),{localName:t.name})}class _O{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,n){const r=this.getType(),i=r.runtime.bin,s=i.makeReadOptions(n);return i.readMessage(this,s.readerFactory(e),e.byteLength,s),this}fromJson(e,n){const r=this.getType(),i=r.runtime.json,s=i.makeReadOptions(n);return i.readMessage(r,e,s,this),this}fromJsonString(e,n){let r;try{r=JSON.parse(e)}catch(i){throw new Error("cannot decode ".concat(this.getType().typeName," from JSON: ").concat(i instanceof Error?i.message:String(i)))}return this.fromJson(r,n)}toBinary(e){const n=this.getType(),r=n.runtime.bin,i=r.makeWriteOptions(e),s=i.writerFactory();return r.writeMessage(this,s,i),s.finish()}toJson(e){const n=this.getType(),r=n.runtime.json,i=r.makeWriteOptions(e);return r.writeMessage(this,i)}toJsonString(e){var n;const r=this.toJson(e);return JSON.stringify(r,null,(n=e==null?void 0:e.prettySpaces)!==null&&n!==void 0?n:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function m6e(t,e,n,r){var i;const s=(i=r==null?void 0:r.localName)!==null&&i!==void 0?i:e.substring(e.lastIndexOf(".")+1),a={[s]:function(o){t.util.initFields(this),t.util.initPartial(o,this)}}[s];return Object.setPrototypeOf(a.prototype,new _O),Object.assign(a,{runtime:t,typeName:e,fields:t.util.newFieldList(n),fromBinary(o,l){return new a().fromBinary(o,l)},fromJson(o,l){return new a().fromJson(o,l)},fromJsonString(o,l){return new a().fromJsonString(o,l)},equals(o,l){return t.util.equals(a,o,l)}}),a}function g6e(){let t=0,e=0;for(let r=0;r<28;r+=7){let i=this.buf[this.pos++];if(t|=(i&127)<<r,!(i&128))return this.assertBounds(),[t,e]}let n=this.buf[this.pos++];if(t|=(n&15)<<28,e=(n&112)>>4,!(n&128))return this.assertBounds(),[t,e];for(let r=3;r<=31;r+=7){let i=this.buf[this.pos++];if(e|=(i&127)<<r,!(i&128))return this.assertBounds(),[t,e]}throw new Error("invalid varint")}function VE(t,e,n){for(let s=0;s<28;s=s+7){const a=t>>>s,o=!(!(a>>>7)&&e==0),l=(o?a|128:a)&255;if(n.push(l),!o)return}const r=t>>>28&15|(e&7)<<4,i=!!(e>>3);if(n.push((i?r|128:r)&255),!!i){for(let s=3;s<31;s=s+7){const a=e>>>s,o=!!(a>>>7),l=(o?a|128:a)&255;if(n.push(l),!o)return}n.push(e>>>31&1)}}const Ox=4294967296;function _7(t){const e=t[0]==="-";e&&(t=t.slice(1));const n=1e6;let r=0,i=0;function s(a,o){const l=Number(t.slice(a,o));i*=n,r=r*n+l,r>=Ox&&(i=i+(r/Ox|0),r=r%Ox)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),e?Lee(r,i):wO(r,i)}function v6e(t,e){let n=wO(t,e);const r=n.hi&2147483648;r&&(n=Lee(n.lo,n.hi));const i=Iee(n.lo,n.hi);return r?"-"+i:i}function Iee(t,e){if({lo:t,hi:e}=y6e(t,e),e<=2097151)return String(Ox*e+t);const n=t&16777215,r=(t>>>24|e<<8)&16777215,i=e>>16&65535;let s=n+r*6777216+i*6710656,a=r+i*8147497,o=i*2;const l=1e7;return s>=l&&(a+=Math.floor(s/l),s%=l),a>=l&&(o+=Math.floor(a/l),a%=l),o.toString()+w7(a)+w7(s)}function y6e(t,e){return{lo:t>>>0,hi:e>>>0}}function wO(t,e){return{lo:t|0,hi:e|0}}function Lee(t,e){return e=~e,t?t=~t+1:e+=1,wO(t,e)}const w7=t=>{const e=String(t);return"0000000".slice(e.length)+e};function b7(t,e){if(t>=0){for(;t>127;)e.push(t&127|128),t=t>>>7;e.push(t)}else{for(let n=0;n<9;n++)e.push(t&127|128),t=t>>7;e.push(1)}}function _6e(){let t=this.buf[this.pos++],e=t&127;if(!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<7,!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<14,!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<21,!(t&128))return this.assertBounds(),e;t=this.buf[this.pos++],e|=(t&15)<<28;for(let n=5;t&128&&n<10;n++)t=this.buf[this.pos++];if(t&128)throw new Error("invalid varint");return this.assertBounds(),e>>>0}function w6e(){const t=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof t.getBigInt64=="function"&&typeof t.getBigUint64=="function"&&typeof t.setBigInt64=="function"&&typeof t.setBigUint64=="function"&&(typeof process!="object"||typeof v7!="object"||v7.BUF_BIGINT_DISABLE!=="1")){const i=BigInt("-9223372036854775808"),s=BigInt("9223372036854775807"),a=BigInt("0"),o=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(l){const c=typeof l=="bigint"?l:BigInt(l);if(c>s||c<i)throw new Error("int64 invalid: ".concat(l));return c},uParse(l){const c=typeof l=="bigint"?l:BigInt(l);if(c>o||c<a)throw new Error("uint64 invalid: ".concat(l));return c},enc(l){return t.setBigInt64(0,this.parse(l),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},uEnc(l){return t.setBigInt64(0,this.uParse(l),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},dec(l,c){return t.setInt32(0,l,!0),t.setInt32(4,c,!0),t.getBigInt64(0,!0)},uDec(l,c){return t.setInt32(0,l,!0),t.setInt32(4,c,!0),t.getBigUint64(0,!0)}}}const n=i=>mi(/^-?[0-9]+$/.test(i),"int64 invalid: ".concat(i)),r=i=>mi(/^[0-9]+$/.test(i),"uint64 invalid: ".concat(i));return{zero:"0",supported:!1,parse(i){return typeof i!="string"&&(i=i.toString()),n(i),i},uParse(i){return typeof i!="string"&&(i=i.toString()),r(i),i},enc(i){return typeof i!="string"&&(i=i.toString()),n(i),_7(i)},uEnc(i){return typeof i!="string"&&(i=i.toString()),r(i),_7(i)},dec(i,s){return v6e(i,s)},uDec(i,s){return Iee(i,s)}}}const Gr=w6e();var $e;(function(t){t[t.DOUBLE=1]="DOUBLE",t[t.FLOAT=2]="FLOAT",t[t.INT64=3]="INT64",t[t.UINT64=4]="UINT64",t[t.INT32=5]="INT32",t[t.FIXED64=6]="FIXED64",t[t.FIXED32=7]="FIXED32",t[t.BOOL=8]="BOOL",t[t.STRING=9]="STRING",t[t.BYTES=12]="BYTES",t[t.UINT32=13]="UINT32",t[t.SFIXED32=15]="SFIXED32",t[t.SFIXED64=16]="SFIXED64",t[t.SINT32=17]="SINT32",t[t.SINT64=18]="SINT64"})($e||($e={}));var nf;(function(t){t[t.BIGINT=0]="BIGINT",t[t.STRING=1]="STRING"})(nf||(nf={}));function Zd(t,e,n){if(e===n)return!0;if(t==$e.BYTES){if(!(e instanceof Uint8Array)||!(n instanceof Uint8Array)||e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==n[r])return!1;return!0}switch(t){case $e.UINT64:case $e.FIXED64:case $e.INT64:case $e.SFIXED64:case $e.SINT64:return e==n}return!1}function zv(t,e){switch(t){case $e.BOOL:return!1;case $e.UINT64:case $e.FIXED64:case $e.INT64:case $e.SFIXED64:case $e.SINT64:return e==0?Gr.zero:"0";case $e.DOUBLE:case $e.FLOAT:return 0;case $e.BYTES:return new Uint8Array(0);case $e.STRING:return"";default:return 0}}function Oee(t,e){switch(t){case $e.BOOL:return e===!1;case $e.STRING:return e==="";case $e.BYTES:return e instanceof Uint8Array&&!e.byteLength;default:return e==0}}var Ai;(function(t){t[t.Varint=0]="Varint",t[t.Bit64=1]="Bit64",t[t.LengthDelimited=2]="LengthDelimited",t[t.StartGroup=3]="StartGroup",t[t.EndGroup=4]="EndGroup",t[t.Bit32=5]="Bit32"})(Ai||(Ai={}));class b6e{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let i=0;i<this.chunks.length;i++)e+=this.chunks[i].length;let n=new Uint8Array(e),r=0;for(let i=0;i<this.chunks.length;i++)n.set(this.chunks[i],r),r+=this.chunks[i].length;return this.chunks=[],n}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),n=this.stack.pop();if(!n)throw new Error("invalid state, fork stack empty");return this.chunks=n.chunks,this.buf=n.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,n){return this.uint32((e<<3|n)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(LN(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return Lx(e),b7(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let n=this.textEncoder.encode(e);return this.uint32(n.byteLength),this.raw(n)}float(e){Aee(e);let n=new Uint8Array(4);return new DataView(n.buffer).setFloat32(0,e,!0),this.raw(n)}double(e){let n=new Uint8Array(8);return new DataView(n.buffer).setFloat64(0,e,!0),this.raw(n)}fixed32(e){LN(e);let n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,e,!0),this.raw(n)}sfixed32(e){Lx(e);let n=new Uint8Array(4);return new DataView(n.buffer).setInt32(0,e,!0),this.raw(n)}sint32(e){return Lx(e),e=(e<<1^e>>31)>>>0,b7(e,this.buf),this}sfixed64(e){let n=new Uint8Array(8),r=new DataView(n.buffer),i=Gr.enc(e);return r.setInt32(0,i.lo,!0),r.setInt32(4,i.hi,!0),this.raw(n)}fixed64(e){let n=new Uint8Array(8),r=new DataView(n.buffer),i=Gr.uEnc(e);return r.setInt32(0,i.lo,!0),r.setInt32(4,i.hi,!0),this.raw(n)}int64(e){let n=Gr.enc(e);return VE(n.lo,n.hi,this.buf),this}sint64(e){let n=Gr.enc(e),r=n.hi>>31,i=n.lo<<1^r,s=(n.hi<<1|n.lo>>>31)^r;return VE(i,s,this.buf),this}uint64(e){let n=Gr.uEnc(e);return VE(n.lo,n.hi,this.buf),this}}class x6e{constructor(e,n){this.varint64=g6e,this.uint32=_6e,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=n??new TextDecoder}tag(){let e=this.uint32(),n=e>>>3,r=e&7;if(n<=0||r<0||r>5)throw new Error("illegal tag: field no "+n+" wire type "+r);return[n,r]}skip(e,n){let r=this.pos;switch(e){case Ai.Varint:for(;this.buf[this.pos++]&128;);break;case Ai.Bit64:this.pos+=4;case Ai.Bit32:this.pos+=4;break;case Ai.LengthDelimited:let i=this.uint32();this.pos+=i;break;case Ai.StartGroup:for(;;){const[s,a]=this.tag();if(a===Ai.EndGroup){if(n!==void 0&&s!==n)throw new Error("invalid end group tag");break}this.skip(a,s)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(r,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return Gr.dec(...this.varint64())}uint64(){return Gr.uDec(...this.varint64())}sint64(){let[e,n]=this.varint64(),r=-(e&1);return e=(e>>>1|(n&1)<<31)^r,n=n>>>
vendor: 5,166 bytes, lines 752-753
7521^r,Gr.dec(e,n)}bool(){let[e,n]=this.varint64();return e!==0||n!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Gr.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Gr.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),n=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(n,n+e)}string(){return this.textDecoder.decode(this.bytes())}}function k6e(t,e,n,r){let i;return{typeName:e,extendee:n,get field(){if(!i){const s=typeof r=="function"?r():r;s.name=e.split(".").pop(),s.jsonName="[".concat(e,"]"),i=t.util.newFieldList([s]).list()[0]}return i},runtime:t}}function Dee(t){const e=t.field.localName,n=Object.create(null);return n[e]=S6e(t),[n,()=>n[e]]}function S6e(t){const e=t.field;if(e.repeated)return[];if(e.default!==void 0)return e.default;switch(e.kind){case"enum":return e.T.values[0].no;case"scalar":return zv(e.T,e.L);case"message":const n=e.T,r=new n;return n.fieldWrapper?n.fieldWrapper.unwrapField(r):r;case"map":throw"map fields are not allowed to be extensions"}}function T6e(t,e){if(!e.repeated&&(e.kind=="enum"||e.kind=="scalar")){for(let n=t.length-1;n>=0;--n)if(t[n].no==e.no)return[t[n]];return[]}return t.filter(n=>n.no===e.no)}let Zu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),tC=[];for(let t=0;t<Zu.length;t++)tC[Zu[t].charCodeAt(0)]=t;tC[45]=Zu.indexOf("+");tC[95]=Zu.indexOf("/");const Fee={dec(t){let e=t.length*3/4;t[t.length-2]=="="?e-=2:t[t.length-1]=="="&&(e-=1);let n=new Uint8Array(e),r=0,i=0,s,a=0;for(let o=0;o<t.length;o++){if(s=tC[t.charCodeAt(o)],s===void 0)switch(t[o]){case"=":i=0;case` 753`:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(i){case 0:a=s,i=1;break;case 1:n[r++]=a<<2|(s&48)>>4,a=s,i=2;break;case 2:n[r++]=(a&15)<<4|(s&60)>>2,a=s,i=3;break;case 3:n[r++]=(a&3)<<6|s,i=0;break}}if(i==1)throw Error("invalid base64 string.");return n.subarray(0,r)},enc(t){let e="",n=0,r,i=0;for(let s=0;s<t.length;s++)switch(r=t[s],n){case 0:e+=Zu[r>>2],i=(r&3)<<4,n=1;break;case 1:e+=Zu[i|r>>4],i=(r&15)<<2,n=2;break;case 2:e+=Zu[i|r>>6],e+=Zu[r&63],n=0;break}return n&&(e+=Zu[i],e+="=",n==1&&(e+="=")),e}};function C6e(t,e,n){Bee(e,t);const r=e.runtime.bin.makeReadOptions(n),i=T6e(t.getType().runtime.bin.listUnknownFields(t),e.field),[s,a]=Dee(e);for(const o of i)e.runtime.bin.readField(s,r.readerFactory(o.data),e.field,o.wireType,r);return a()}function E6e(t,e,n,r){Bee(e,t);const i=e.runtime.bin.makeReadOptions(r),s=e.runtime.bin.makeWriteOptions(r);if(jee(t,e)){const c=t.getType().runtime.bin.listUnknownFields(t).filter(u=>u.no!=e.field.no);t.getType().runtime.bin.discardUnknownFields(t);for(const u of c)t.getType().runtime.bin.onUnknownField(t,u.no,u.wireType,u.data)}const a=s.writerFactory();let o=e.field;!o.opt&&!o.repeated&&(o.kind=="enum"||o.kind=="scalar")&&(o=Object.assign(Object.assign({},e.field),{opt:!0})),e.runtime.bin.writeField(o,n,a,s);const l=i.readerFactory(a.finish());for(;l.pos<l.len;){const[c,u]=l.tag(),d=l.skip(u,c);t.getType().runtime.bin.onUnknownField(t,c,u,d)}}function jee(t,e){const n=t.getType();return e.extendee.typeName===n.typeName&&!!n.runtime.bin.listUnknownFields(t).find(r=>r.no==e.field.no)}function Bee(t,e){mi(t.extendee.typeName==e.getType().typeName,"extension ".concat(t.typeName," can only be applied to message ").concat(t.extendee.typeName))}function Uee(t,e){const n=t.localName;if(t.repeated)return e[n].length>0;if(t.oneof)return e[t.oneof.localName].case===n;switch(t.kind){case"enum":case"scalar":return t.opt||t.req?e[n]!==void 0:t.kind=="enum"?e[n]!==t.T.values[0].no:!Oee(t.T,e[n]);case"message":return e[n]!==void 0;case"map":return Object.keys(e[n]).length>0}}function x7(t,e){const n=t.localName,r=!t.opt&&!t.req;if(t.repeated)e[n]=[];else if(t.oneof)e[t.oneof.localName]={case:void 0};else switch(t.kind){case"map":e[n]={};break;case"enum":e[n]=r?t.T.values[0].no:void 0;break;case"scalar":e[n]=r?zv(t.T,t.L):void 0;break;case"message":e[n]=void 0;break}}function ed(t,e){if(t===null||typeof t!="object"||!Object.getOwnPropertyNames(_O.prototype).every(r=>r in t&&typeof t[r]=="function"))return!1;const n=t.getType();return n===null||typeof n!="function"||!("typeName"in n)||typeof n.typeName!="string"?!1:e===void 0?!0:n.typeName==e.typeName}function zee(t,e){return ed(e)||!t.fieldWrapper?e:t.fieldWrapper.wrapField(e)}$e.DOUBLE,$e.FLOAT,$e.INT64,$e.UINT64,$e.INT32,$e.UINT32,$e.BOOL,$e.STRING,$e.BYTES;const k7={ignoreUnknownFields:!1},S7={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function A6e(t){return t?Object.assign(Object.assign({},k7),t):k7}function P6e(t){return t?Object.assign(Object.assign({},S7),t):S7}const pS=Symbol(),Dx=Symbol();function M6e(){return{makeReadOptions:A6e,makeWriteOptions:P6e,readMessage(t,e,n,r){if(e==null||Array.isArray(e)||typeof e!="object")throw new Error("cannot decode message ".concat(t.typeName," from JSON: ").concat(Dc(e)));r=r??new t;const i=new Map,s=n.typeRegistry;
vendor: 19,144 bytes, line 753
753for(const[a,o]of Object.entries(e)){const l=t.fields.findJsonName(a);if(l){if(l.oneof){if(o===null&&l.kind=="scalar")continue;const c=i.get(l.oneof);if(c!==void 0)throw new Error("cannot decode message ".concat(t.typeName,' from JSON: multiple keys for oneof "').concat(l.oneof.name,'" present: "').concat(c,'", "').concat(a,'"'));i.set(l.oneof,a)}T7(r,o,l,n,t)}else{let c=!1;if(s!=null&&s.findExtension&&a.startsWith("[")&&a.endsWith("]")){const u=s.findExtension(a.substring(1,a.length-1));if(u&&u.extendee.typeName==t.typeName){c=!0;const[d,f]=Dee(u);T7(d,o,u.field,n,u),E6e(r,u,f(),n)}}if(!c&&!n.ignoreUnknownFields)throw new Error("cannot decode message ".concat(t.typeName,' from JSON: key "').concat(a,'" is unknown'))}}return r},writeMessage(t,e){const n=t.getType(),r={};let i;try{for(i of n.fields.byNumber()){if(!Uee(i,t)){if(i.req)throw"required field not set";if(!e.emitDefaultValues||!R6e(i))continue}const a=i.oneof?t[i.oneof.localName].value:t[i.localName],o=C7(i,a,e);o!==void 0&&(r[e.useProtoFieldName?i.name:i.jsonName]=o)}const s=e.typeRegistry;if(s!=null&&s.findExtensionFor)for(const a of n.runtime.bin.listUnknownFields(t)){const o=s.findExtensionFor(n.typeName,a.no);if(o&&jee(t,o)){const l=C6e(t,o,e),c=C7(o.field,l,e);c!==void 0&&(r[o.field.jsonName]=c)}}}catch(s){const a=i?"cannot encode field ".concat(n.typeName,".").concat(i.name," to JSON"):"cannot encode message ".concat(n.typeName," to JSON"),o=s instanceof Error?s.message:String(s);throw new Error(a+(o.length>0?": ".concat(o):""))}return r},readScalar(t,e,n){return I_(t,e,n??nf.BIGINT,!0)},writeScalar(t,e,n){if(e!==void 0&&(n||Oee(t,e)))return Fx(t,e)},debug:Dc}}function Dc(t){if(t===null)return"null";switch(typeof t){case"object":return Array.isArray(t)?"array":"object";case"string":return t.length>100?"string":'"'.concat(t.split('"').join('\\"'),'"');default:return String(t)}}function T7(t,e,n,r,i){let s=n.localName;if(n.repeated){if(mi(n.kind!="map"),e===null)return;if(!Array.isArray(e))throw new Error("cannot decode field ".concat(i.typeName,".").concat(n.name," from JSON: ").concat(Dc(e)));const a=t[s];for(const o of e){if(o===null)throw new Error("cannot decode field ".concat(i.typeName,".").concat(n.name," from JSON: ").concat(Dc(o)));switch(n.kind){case"message":a.push(n.T.fromJson(o,r));break;case"enum":const l=qE(n.T,o,r.ignoreUnknownFields,!0);l!==Dx&&a.push(l);break;case"scalar":try{a.push(I_(n.T,o,n.L,!0))}catch(c){let u="cannot decode field ".concat(i.typeName,".").concat(n.name," from JSON: ").concat(Dc(o));throw c instanceof Error&&c.message.length>0&&(u+=": ".concat(c.message)),new Error(u)}break}}}else if(n.kind=="map"){if(e===null)return;if(typeof e!="object"||Array.isArray(e))throw new Error("cannot decode field ".concat(i.typeName,".").concat(n.name," from JSON: ").concat(Dc(e)));const a=t[s];for(const[o,l]of Object.entries(e)){if(l===null)throw new Error("cannot decode field ".concat(i.typeName,".").concat(n.name," from JSON: map value null"));let c;try{c=N6e(n.K,o)}catch(u){let d="cannot decode map key for field ".concat(i.typeName,".").concat(n.name," from JSON: ").concat(Dc(e));throw u instanceof Error&&u.message.length>0&&(d+=": ".concat(u.message)),new Error(d)}switch(n.V.kind){case"message":a[c]=n.V.T.fromJson(l,r);break;case"enum":const u=qE(n.V.T,l,r.ignoreUnknownFields,!0);u!==Dx&&(a[c]=u);break;case"scalar":try{a[c]=I_(n.V.T,l,nf.BIGINT,!0)}catch(d){let f="cannot decode map value for field ".concat(i.typeName,".").concat(n.name," from JSON: ").concat(Dc(e));throw d instanceof Error&&d.message.length>0&&(f+=": ".concat(d.message)),new Error(f)}break}}}else switch(n.oneof&&(t=t[n.oneof.localName]={case:s},s="value"),n.kind){case"message":const a=n.T;if(e===null&&a.typeName!="google.protobuf.Value")return;let o=t[s];ed(o)?o.fromJson(e,r):(t[s]=o=a.fromJson(e,r),a.fieldWrapper&&!n.oneof&&(t[s]=a.fieldWrapper.unwrapField(o)));break;case"enum":const l=qE(n.T,e,r.ignoreUnknownFields,!1);switch(l){case pS:x7(n,t);break;case Dx:break;default:t[s]=l;break}break;case"scalar":try{const c=I_(n.T,e,n.L,!1);switch(c){case pS:x7(n,t);break;default:t[s]=c;break}}catch(c){let u="cannot decode field ".concat(i.typeName,".").concat(n.name," from JSON: ").concat(Dc(e));throw c instanceof Error&&c.message.length>0&&(u+=": ".concat(c.message)),new Error(u)}break}}function N6e(t,e){if(t===$e.BOOL)switch(e){case"true":e=!0;break;case"false":e=!1;break}return I_(t,e,nf.BIGINT,!0).toString()}function I_(t,e,n,r){if(e===null)return r?zv(t,n):pS;switch(t){case $e.DOUBLE:case $e.FLOAT:if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""||typeof e=="string"&&e.trim().length!==e.length||typeof e!="string"&&typeof e!="number")break;const i=Number(e);if(Number.isNaN(i)||!Number.isFinite(i))break;return t==$e.FLOAT&&Aee(i),i;case $e.INT32:case $e.FIXED32:case $e.SFIXED32:case $e.SINT32:case $e.UINT32:let s;if(typeof e=="number"?s=e:typeof e=="string"&&e.length>0&&e.trim().length===e.length&&(s=Number(e)),s===void 0)break;return t==$e.UINT32||t==$e.FIXED32?LN(s):Lx(s),s;case $e.INT64:case $e.SFIXED64:case $e.SINT64:if(typeof e!="number"&&typeof e!="string")break;const a=Gr.parse(e);return n?a.toString():a;case $e.FIXED64:case $e.UINT64:if(typeof e!="number"&&typeof e!="string")break;const o=Gr.uParse(e);return n?o.toString():o;case $e.BOOL:if(typeof e!="boolean")break;return e;case $e.STRING:if(typeof e!="string")break;try{encodeURIComponent(e)}catch{throw new Error("invalid UTF8")}return e;case $e.BYTES:if(e==="")return new Uint8Array(0);if(typeof e!="string")break;return Fee.dec(e)}throw new Error}function qE(t,e,n,r){if(e===null)return t.typeName=="google.protobuf.NullValue"?0:r?t.values[0].no:pS;switch(typeof e){case"number":if(Number.isInteger(e))return e;break;case"string":const i=t.findName(e);if(i!==void 0)return i.no;if(n)return Dx;break}throw new Error("cannot decode enum ".concat(t.typeName," from JSON: ").concat(Dc(e)))}function R6e(t){return t.repeated||t.kind=="map"?!0:!(t.oneof||t.kind=="message"||t.opt||t.req)}function C7(t,e,n){if(t.kind=="map"){mi(typeof e=="object"&&e!=null);const r={},i=Object.entries(e);switch(t.V.kind){case"scalar":for(const[a,o]of i)r[a.toString()]=Fx(t.V.T,o);break;case"message":for(const[a,o]of i)r[a.toString()]=o.toJson(n);break;case"enum":const s=t.V.T;for(const[a,o]of i)r[a.toString()]=WE(s,o,n.enumAsInteger);break}return n.emitDefaultValues||i.length>0?r:void 0}if(t.repeated){mi(Array.isArray(e));const r=[];switch(t.kind){case"scalar":for(let i=0;i<e.length;i++)r.push(Fx(t.T,e[i]));break;case"enum":for(let i=0;i<e.length;i++)r.push(WE(t.T,e[i],n.enumAsInteger));break;case"message":for(let i=0;i<e.length;i++)r.push(e[i].toJson(n));break}return n.emitDefaultValues||r.length>0?r:void 0}switch(t.kind){case"scalar":return Fx(t.T,e);case"enum":return WE(t.T,e,n.enumAsInteger);case"message":return zee(t.T,e).toJson(n)}}function WE(t,e,n){var r;if(mi(typeof e=="number"),t.typeName=="google.protobuf.NullValue")return null;if(n)return e;const i=t.findNumber(e);return(r=i==null?void 0:i.name)!==null&&r!==void 0?r:e}function Fx(t,e){switch(t){case $e.INT32:case $e.SFIXED32:case $e.SINT32:case $e.FIXED32:case $e.UINT32:return mi(typeof e=="number"),e;case $e.FLOAT:case $e.DOUBLE:return mi(typeof e=="number"),Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e;case $e.STRING:return mi(typeof e=="string"),e;case $e.BOOL:return mi(typeof e=="boolean"),e;case $e.UINT64:case $e.FIXED64:case $e.INT64:case $e.SFIXED64:case $e.SINT64:return mi(typeof e=="bigint"||typeof e=="string"||typeof e=="number"),e.toString();case $e.BYTES:return mi(e instanceof Uint8Array),Fee.enc(e)}}const og=Symbol("@bufbuild/protobuf/unknown-fields"),E7={readUnknownFields:!0,readerFactory:t=>new x6e(t)},A7={writeUnknownFields:!0,writerFactory:()=>new b6e};function I6e(t){return t?Object.assign(Object.assign({},E7),t):E7}function L6e(t){return t?Object.assign(Object.assign({},A7),t):A7}function O6e(){return{makeReadOptions:I6e,makeWriteOptions:L6e,listUnknownFields(t){var e;return(e=t[og])!==null&&e!==void 0?e:[]},discardUnknownFields(t){delete t[og]},writeUnknownFields(t,e){const r=t[og];if(r)for(const i of r)e.tag(i.no,i.wireType).raw(i.data)},onUnknownField(t,e,n,r){const i=t;Array.isArray(i[og])||(i[og]=[]),i[og].push({no:e,wireType:n,data:r})},readMessage(t,e,n,r,i){const s=t.getType(),a=i?e.len:e.pos+n;let o,l;for(;e.pos<a&&([o,l]=e.tag(),!(i===!0&&l==Ai.EndGroup));){const c=s.fields.find(o);if(!c){const u=e.skip(l,o);r.readUnknownFields&&this.onUnknownField(t,o,l,u);continue}P7(t,e,c,l,r)}if(i&&(l!=Ai.EndGroup||o!==n))throw new Error("invalid end group tag")},readField:P7,writeMessage(t,e,n){const r=t.getType();for(const i of r.fields.byNumber()){if(!Uee(i,t)){if(i.req)throw new Error("cannot encode field ".concat(r.typeName,".").concat(i.name," to binary: required field not set"));continue}const s=i.oneof?t[i.oneof.localName].value:t[i.localName];M7(i,s,e,n)}return n.writeUnknownFields&&this.writeUnknownFields(t,e),e},writeField(t,e,n,r){e!==void 0&&M7(t,e,n,r)}}}function P7(t,e,n,r,i){let{repeated:s,localName:a}=n;switch(n.oneof&&(t=t[n.oneof.localName],t.case!=a&&delete t.value,t.case=a,a="value"),n.kind){case"scalar":case"enum":const o=n.kind=="enum"?$e.INT32:n.T;let l=mS;if(n.kind=="scalar"&&n.L>0&&(l=F6e),s){let f=t[a];if(r==Ai.LengthDelimited&&o!=$e.STRING&&o!=$e.BYTES){let p=e.uint32()+e.pos;for(;e.pos<p;)f.push(l(e,o))}else f.push(l(e,o))}else t[a]=l(e,o);break;case"message":const c=n.T;s?t[a].push(jx(e,new c,i,n)):ed(t[a])?jx(e,t[a],i,n):(t[a]=jx(e,new c,i,n),c.fieldWrapper&&!n.oneof&&!n.repeated&&(t[a]=c.fieldWrapper.unwrapField(t[a])));break;case"map":let[u,d]=D6e(n,e,i);t[a][u]=d;break}}function jx(t,e,n,r){const i=e.getType().runtime.bin,s=r==null?void 0:r.delimited;return i.readMessage(e,t,s?r.no:t.uint32(),n,s),e}function D6e(t,e,n){const r=e.uint32(),i=e.pos+r;let s,a;for(;e.pos<i;){const[o]=e.tag();switch(o){case 1:s=mS(e,t.K);break;case 2:switch(t.V.kind){case"scalar":a=mS(e,t.V.T);break;case"enum":a=e.int32();break;case"message":a=jx(e,new t.V.T,n,void 0);break}break}}if(s===void 0&&(s=zv(t.K,nf.BIGINT)),typeof s!="string"&&typeof s!="number"&&(s=s.toString()),a===void 0)switch(t.V.kind){case"scalar":a=zv(t.V.T,nf.BIGINT);break;case"enum":a=t.V.T.values[0].no;break;case"message":a=new t.V.T;break}return[s,a]}function F6e(t,e){const n=mS(t,e);return typeof n=="bigint"?n.toString():n}function mS(t,e){switch(e){case $e.STRING:return t.string();case $e.BOOL:return t.bool();case $e.DOUBLE:return t.double();case $e.FLOAT:return t.float();case $e.INT32:return t.int32();case $e.INT64:return t.int64();case $e.UINT64:return t.uint64();case $e.FIXED64:return t.fixed64();case $e.BYTES:return t.bytes();case $e.FIXED32:return t.fixed32();case $e.SFIXED32:return t.sfixed32();case $e.SFIXED64:return t.sfixed64();case $e.SINT64:return t.sint64();case $e.UINT32:return t.uint32();case $e.SINT32:return t.sint32()}}function M7(t,e,n,r){mi(e!==void 0);const i=t.repeated;switch(t.kind){case"scalar":case"enum":let s=t.kind=="enum"?$e.INT32:t.T;if(i)if(mi(Array.isArray(e)),t.packed)B6e(n,s,t.no,e);else for(const a of e)L_(n,s,t.no,a);else L_(n,s,t.no,e);break;case"message":if(i){mi(Array.isArray(e));for(const a of e)N7(n,r,t,a)}else N7(n,r,t,e);break;case"map":mi(typeof e=="object"&&e!=null);for(const[a,o]of Object.entries(e))j6e(n,r,t,a,o);break}}function j6e(t,e,n,r,i){t.tag(n.no,Ai.LengthDelimited),t.fork();let s=r;switch(n.K){case $e.INT32:case $e.FIXED32:case $e.UINT32:case $e.SFIXED32:case $e.SINT32:s=Number.parseInt(r);break;case $e.BOOL:mi(r=="true"||r=="false"),s=r=="true";break}switch(L_(t,n.K,1,s),n.V.kind){case"scalar":L_(t,n.V.T,2,i);break;case"enum":L_(t,$e.INT32,2,i);break;case"message":mi(i!==void 0),t.tag(2,Ai.LengthDelimited).bytes(i.toBinary(e));break}t.join()}function N7(t,e,n,r){const i=zee(n.T,r);n.delimited?t.tag(n.no,Ai.StartGroup).raw(i.toBinary(e)).tag(n.no,Ai.EndGroup):t.tag(n.no,Ai.LengthDelimited).bytes(i.toBinary(e))}function L_(t,e,n,r){mi(r!==void 0);let[i,s]=$ee(e);t.tag(n,i)[s](r)}function B6e(t,e,n,r){if(!r.length)return;t.tag(n,Ai.LengthDelimited).fork();let[,i]=$ee(e);for(let s=0;s<r.length;s++)t[i](r[s]);t.join()}function $ee(t){let e=Ai.Varint;switch(t){case $e.BYTES:case $e.STRING:e=Ai.LengthDelimited;break;case $e.DOUBLE:case $e.FIXED64:case $e.SFIXED64:e=Ai.Bit64;break;case $e.FIXED32:case $e.SFIXED32:case $e.FLOAT:e=Ai.Bit32;break}const n=$e[t].toLowerCase();return[e,n]}function U6e(){return{setEnumType:Mee,initPartial(t,e){if(t===void 0)return;const n=e.getType();for(const r of n.fields.byMember()){const i=r.localName,s=e,a=t;if(a[i]!=null)switch(r.kind){case"oneof":const o=a[i].case;if(o===void 0)continue;const l=r.findField(o);let c=a[i].value;l&&l.kind=="message"&&!ed(c,l.T)?c=new l.T(c):l&&l.kind==="scalar"&&l.T===$e.BYTES&&(c=Py(c)),s[i]={case:o,value:c};break;case"scalar":case"enum":let u=a[i];r.T===$e.BYTES&&(u=r.repeated?u.map(Py):Py(u)),s[i]=u;break;case"map":switch(r.V.kind){case"scalar":case"enum":if(r.V.T===$e.BYTES)for(const[h,p]of Object.entries(a[i]))s[i][h]=Py(p);else Object.assign(s[i],a[i]);break;case"message":const f=r.V.T;for(const h of Object.keys(a[i])){let p=a[i][h];f.fieldWrapper||(p=new f(p)),s[i][h]=p}break}break;case"message":const d=r.T;if(r.repeated)s[i]=a[i].map(f=>ed(f,d)?f:new d(f));else{const f=a[i];d.fieldWrapper?d.typeName==="google.protobuf.BytesValue"?s[i]=Py(f):s[i]=f:s[i]=ed(f,d)?f:new d(f)}break}}},equals(t,e,n){return e===n?!0:!e||!n?!1:t.fields.byMember().every(r=>{const i=e[r.localName],s=n[r.localName];if(r.repeated){if(i.length!==s.length)return!1;switch(r.kind){case"message":return i.every((a,o)=>r.T.equals(a,s[o]));case"scalar":return i.every((a,o)=>Zd(r.T,a,s[o]));case"enum":return i.every((a,o)=>Zd($e.INT32,a,s[o]))}throw new Error("repeated cannot contain ".concat(r.kind))}switch(r.kind){case"message":let a=i,o=s;return r.T.fieldWrapper&&(a!==void 0&&!ed(a)&&(a=r.T.fieldWrapper.wrapField(a)),o!==void 0&&!ed(o)&&(o=r.T.fieldWrapper.wrapField(o))),r.T.equals(a,o);case"enum":return Zd($e.INT32,i,s);case"scalar":return Zd(r.T,i,s);case"oneof":if(i.case!==s.case)return!1;const l=r.findField(i.case);if(l===void 0)return!0;switch(l.kind){case"message":return l.T.equals(i.value,s.value);case"enum":return Zd($e.INT32,i.value,s.value);case"scalar":return Zd(l.T,i.value,s.value)}throw new Error("oneof cannot contain ".concat(l.kind));case"map":const c=Object.keys(i).concat(Object.keys(s));switch(r.V.kind){case"message":const u=r.V.T;return c.every(f=>u.equals(i[f],s[f]));case"enum":return c.every(f=>Zd($e.INT32,i[f],s[f]));case"scalar":const d=r.V.T;return c.every(f=>Zd(d,i[f],s[f]))}break}})},clone(t){const e=t.getType(),n=new e,r=n;for(const i of e.fields.byMember()){const s=t[i.localName];let a;if(i.repeated)a=s.map(k2);else if(i.kind=="map"){a=r[i.localName];for(const[o,l]of Object.entries(s))a[o]=k2(l)}else i.kind=="oneof"?a=i.findField(s.case)?{case:s.case,value:k2(s.value)}:{case:void 0}:a=k2(s);r[i.localName]=a}for(const i of e.runtime.bin.listUnknownFields(t))e.runtime.bin.onUnknownField(r,i.no,i.wireType,i.data);return n}}}function k2(t){if(t===void 0)return t;if(ed(t))return t.clone();if(t instanceof Uint8Array){const e=new Uint8Array(t.byteLength);return e.set(t),e}return t}function Py(t){return t instanceof Uint8Array?t:new Uint8Array(t)}function z6e(t,e,n){return{syntax:t,json:M6e(),bin:O6e(),util:Object.assign(Object.assign({},U6e()),{newFieldList:e,initFields:n}),makeMessageType(r,i,s){return m6e(this,r,i,s)},makeEnum:p6e,makeEnumType:Nee,getEnumType:f6e,makeExtension(r,i,s){return k6e(this,r,i,s)}}}class $6e{constructor(e,n){this._fields=e,this._normalizer=n}findJsonName(e){if(!this.jsonNames){const n={};for(const r of this.list())n[r.jsonName]=n[r.name]=r;this.jsonNames=n}return this.jsonNames[e]}find(e){if(!this.numbers){const n={};for(const r of this.list())n[r.no]=r;this.numbers=n}return this.numbers[e]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort((e,n)=>e.no-n.no)),this.numbersAsc}byMember(){if(!this.members){this.members=[];const e=this.members;let n;for(const r of this.list())r.oneof?r.oneof!==n&&(n=r.oneof,e.push(n)):e.push(r)}return this.members}}function Vee(t,e){const n=qee(t);return e?n:K6e(H6e(n))}function V6e(t){return Vee(t,!1)}const q6e=qee;function qee(t){let e=!1;const n=[];for(let r=0;r<t.length;r++){let i=t.charAt(r);switch(i){case"_":e=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n.push(i),e=!1;break;default:e&&(e=!1,i=i.toUpperCase()),n.push(i);break}}return n.join("")}const W6e=new Set(["constructor","toString","toJSON","valueOf"]),G6e=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),Wee=t=>"".concat(t,"$"),H6e=t=>G6e.has(t)?Wee(t):t,K6e=t=>W6e.has(t)?Wee(t):t;class J6e{constructor(e){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=e,this.localName=V6e(e)}addField(e){mi(e.oneof===this,"field ".concat(e.name," not one of ").concat(this.name)),this.fields.push(e)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let n=0;n<this.fields.length;n++)this._lookup[this.fields[n].localName]=this.fields[n]}return this._lookup[e]}}function Y6e(t,e){var n,r,i,s,a,o;const l=[];let c;for(const u of typeof t=="function"?t():t){const d=u;if(d.localName=Vee(u.name,u.oneof!==void 0),d.jsonName=(n=u.jsonName)!==null&&n!==void 0?n:q6e(u.name),d.repeated=(r=u.repeated)!==null&&r!==void 0?r:!1,u.kind=="scalar"&&(d.L=(i=u.L)!==null&&i!==void 0?i:nf.BIGINT),d.delimited=(s=u.delimited)!==null&&s!==void 0?s:!1,d.req=(a=u.req)!==null&&a!==void 0?a:!1,d.opt=(o=u.opt)!==null&&o!==void 0?o:!1,u.packed===void 0&&(d.packed=u.kind=="enum"||u.kind=="scalar"&&u.T!=$e.BYTES&&u.T!=$e.STRING),u.oneof!==void 0){const f=typeof u.oneof=="string"?u.oneof:u.oneof.name;(!c||c.name!=f)&&(c=new J6e(f)),d.oneof=c,c.addField(d)}l.push(d)}return l}const be=z6e("proto3",t=>new $6e(t,e=>Y6e(e)),t=>{for(const e of t.getType().fields.byMember()){if(e.opt)continue;const n=e.localName,r=t;if(e.repeated){r[n]=[];continue}switch(e.kind){case"oneof":r[n]={case:void 0};break;case"enum":r[n]=0;break;case"map":r[n]={};break;case"scalar":r[n]=zv(e.T,e.L);break}}});class $a extends _O{constructor(e){super(),this.seconds=Gr.zero,this.nanos=0,be.util.initPartial(e,this)}fromJson(e,n){if(typeof e!="string")throw new Error("cannot decode google.protobuf.Timestamp from JSON: ".concat(be.json.debug(e)));const r=e.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);if(!r)throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");const i=Date.parse(r[1]+"-"+r[2]+"-"+r[3]+"T"+r[4]+":"+r[5]+":"+r[6]+(r[8]?r[8]:"Z"));if(Number.isNaN(i))throw new Error("cannot decode google.protobuf.Timestamp from JSON: invali
753d RFC 3339 string");if(i<Date.parse("0001-01-01T00:00:00Z")||i>Date.parse("9999-12-31T23:59:59Z"))throw new Error("cannot decode message google.protobuf.Timestamp from JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive");return this.seconds=Gr.parse(i/1e3),this.nanos=0,r[7]&&(this.nanos=parseInt("1"+r[7]+"0".repeat(9-r[7].length))-1e9),this}toJson(e){const n=Number(this.seconds)*1e3;if(n<Date.parse("0001-01-01T00:00:00Z")||n>Date.parse("9999-12-31T23:59:59Z"))throw new Error("cannot encode google.protobuf.Timestamp to JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive");if(this.nanos<0)throw new Error("cannot encode google.protobuf.Timestamp to JSON: nanos must not be negative");let r="Z";if(this.nanos>0){const i=(this.nanos+1e9).toString().substring(1);i.substring(3)==="000000"?r="."+i.substring(0,3)+"Z":i.substring(6)==="000"?r="."+i.substring(0,6)+"Z":r="."+i+"Z"}return new Date(n).toISOString().replace(".000Z",r)}toDate(){return new Date(Number(this.seconds)*1e3+Math.ceil(this.nanos/1e6))}static now(){return $a.fromDate(new Date)}static fromDate(e){const n=e.getTime();return new $a({seconds:Gr.parse(Math.floor(n/1e3)),nanos:n%1e3*1e6})}static fromBinary(e,n){return new $a().fromBinary(e,n)}static fromJson(e,n){return new $a().fromJson(e,n)}static fromJsonString(e,n){return new $a().fromJsonString(e,n)}static equals(e,n){return be.util.equals($a,e,n)}}$a.runtime=be;$a.typeName="google.protobuf.Timestamp";$a.fields=be.util.newFieldList(()=>[{no:1,name:"seconds",kind:"scalar",T:3},{no:2,name:"nanos",kind:"scalar",T:5}]);const X6e=be.makeMessageType("livekit.MetricsBatch",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:$a},{no:3,name:"str_data",kind:"scalar",T:9,repeated:!0},{no:4,name:"time_series",kind:"message",T:Q6e,repeated:!0},{no:5,name:"events",kind:"message",T:eje,repeated:!0}]),Q6e=be.makeMessageType("livekit.TimeSeriesMetric",()=>[{no:1,name:"label",kind:"scalar",T:13},{no:2,name:"participant_identity",kind:"scalar",T:13},{no:3,name:"track_sid",kind:"scalar",T:13},{no:4,name:"samples",kind:"message",T:Z6e,repeated:!0},{no:5,name:"rid",kind:"scalar",T:13}]),Z6e=be.makeMessageType("livekit.MetricSample",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:$a},{no:3,name:"value",kind:"scalar",T:2}]),eje=be.makeMessageType("livekit.EventMetric",()=>[{no:1,name:"label",kind:"scalar",T:13},{no:2,name:"participant_identity",kind:"scalar",T:13},{no:3,name:"track_sid",kind:"scalar",T:13},{no:4,name:"start_timestamp_ms",kind:"scalar",T:3},{no:5,name:"end_timestamp_ms",kind:"scalar",T:3,opt:!0},{no:6,name:"normalized_start_timestamp",kind:"message",T:$a},{no:7,name:"normalized_end_timestamp",kind:"message",T:$a,opt:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"rid",kind:"scalar",T:13}]),Gee=be.makeEnum("livekit.BackupCodecPolicy",[{no:0,name:"PREFER_REGRESSION"},{no:1,name:"SIMULCAST"},{no:2,name:"REGRESSION"}]),zl=be.makeEnum("livekit.TrackType",[{no:0,name:"AUDIO"},{no:1,name:"VIDEO"},{no:2,name:"DATA"}]),Oi=be.makeEnum("livekit.TrackSource",[{no:0,name:"UNKNOWN"},{no:1,name:"CAMERA"},{no:2,name:"MICROPHONE"},{no:3,name:"SCREEN_SHARE"},{no:4,name:"SCREEN_SHARE_AUDIO"}]),bO=be.makeEnum("livekit.VideoQuality",[{no:0,name:"LOW"},{no:1,name:"MEDIUM"},{no:2,name:"HIGH"},{no:3,name:"OFF"}]),a_=be.makeEnum("livekit.ConnectionQuality",[{no:0,name:"POOR"},{no:1,name:"GOOD"},{no:2,name:"EXCELLENT"},{no:3,name:"LOST"}]),jw=be.makeEnum("livekit.ClientConfigSetting",[{no:0,name:"UNSET"},{no:1,name:"DISABLED"},{no:2,name:"ENABLED"}]),Jl=be.makeEnum("livekit.DisconnectReason",[{no:0,name:"UNKNOWN_REASON"},{no:1,name:"CLIENT_INITIATED"},{no:2,name:"DUPLICATE_IDENTITY"},{no:3,name:"SERVER_SHUTDOWN"},{no:4,name:"PARTICIPANT_REMOVED"},{no:5,name:"ROOM_DELETED"},{no:6,name:"STATE_MISMATCH"},{no:7,name:"JOIN_FAILURE"},{no:8,name:"MIGRATION"},{no:9,name:"SIGNAL_CLOSE"},{no:10,name:"ROOM_CLOSED"},{no:11,name:"USER_UNAVAILABLE"},{no:12,name:"USER_REJECTED"},{no:13,name:"SIP_TRUNK_FAILURE"},{no:14,name:"CONNECTION_TIMEOUT"},{no:15,name:"MEDIA_FAILURE"},{no:16,name:"AGENT_ERROR"}]),Qf=be.makeEnum("livekit.ReconnectReason",[{no:0,name:"RR_UNKNOWN"},{no:1,name:"RR_SIGNAL_DISCONNECTED"},{no:2,name:"RR_PUBLISHER_FAILED"},{no:3,name:"RR_SUBSCRIBER_FAILED"},{no:4,name:"RR_SWITCH_CANDIDATE"}]),tje=be.makeEnum("livekit.SubscriptionError",[{no:0,name:"SE_UNKNOWN"},{no:1,name:"SE_CODEC_UNSUPPORTED"},{no:2,name:"SE_TRACK_NOTFOUND"}]),ls=be.makeEnum("livekit.AudioTrackFeature",[{no:0,name:"TF_STEREO"},{no:1,name:"TF_NO_DTX"},{no:2,name:"TF_AUTO_GAIN_CONTROL"},{no:3,name:"TF_ECHO_CANCELLATION"},{no:4,name:"TF_NOISE_SUPPRESSION"},{no:5,name:"TF_ENHANCED_NOISE_CANCELLATION"},{no:6,name:"TF_PRECONNECT_BUFFER"}]),Hee=be.makeEnum("livekit.PacketTrailerFeature",[{no:0,name:"PTF_USER_TIMESTAMP"},{no:1,name:"PTF_FRAME_ID"}]),nC=be.makeMessageType("livekit.Room",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"empty_timeout",kind:"scalar",T:13},{no:14,name:"departure_timeout",kind:"scalar",T:13},{no:4,name:"max_participants",kind:"scalar",T:13},{no:5,name:"creation_time",kind:"scalar",T:3},{no:15,name:"creation_time_ms",kind:"scalar",T:3},{no:6,name:"turn_password",kind:"scalar",T:9},{no:7,name:"enabled_codecs",kind:"message",T:gS,repeated:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"num_participants",kind:"scalar",T:13},{no:11,name:"num_publishers",kind:"scalar",T:13},{no:10,name:"active_recording",kind:"scalar",T:8},{no:13,name:"version",kind:"message",T:ate}]),gS=be.makeMessageType("livekit.Codec",()=>[{no:1,name:"mime",kind:"scalar",T:9},{no:2,name:"fmtp_line",kind:"scalar",T:9}]),nje=be.makeMessageType("livekit.ParticipantPermission",()=>[{no:1,name:"can_subscribe",kind:"scalar",T:8},{no:2,name:"can_publish",kind:"scalar",T:8},{no:3,name:"can_publish_data",kind:"scalar",T:8},{no:9,name:"can_publish_sources",kind:"enum",T:be.getEnumType(Oi),repeated:!0},{no:7,name:"hidden",kind:"scalar",T:8},{no:8,name:"recorder",kind:"scalar",T:8},{no:10,name:"can_update_metadata",kind:"scalar",T:8},{no:11,name:"agent",kind:"scalar",T:8},{no:12,name:"can_subscribe_metrics",kind:"scalar",T:8},{no:13,name:"can_manage_agent_session",kind:"scalar",T:8}]),Kp=be.makeMessageType("livekit.ParticipantInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"identity",kind:"scalar",T:9},{no:3,name:"state",kind:"enum",T:be.getEnumType(lv)},{no:4,name:"tracks",kind:"message",T:Ug,repeated:!0},{no:5,name:"metadata",kind:"scalar",T:9},{no:6,name:"joined_at",kind:"scalar",T:3},{no:17,name:"joined_at_ms",kind:"scalar",T:3},{no:9,name:"name",kind:"scalar",T:9},{no:10,name:"version",kind:"scalar",T:13},{no:11,name:"permission",kind:"message",T:nje},{no:12,name:"region",kind:"scalar",T:9},{no:13,name:"is_publisher",kind:"scalar",T:8},{no:14,name:"kind",kind:"enum",T:be.getEnumType(Bw)},{no:15,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:16,name:"disconnect_reason",kind:"enum",T:be.getEnumType(Jl)},{no:18,name:"kind_details",kind:"enum",T:be.getEnumType(rje),repeated:!0},{no:19,name:"data_tracks",kind:"message",T:rC,repeated:!0},{no:20,name:"client_protocol",kind:"scalar",T:5}]),lv=be.makeEnum("livekit.ParticipantInfo.State",[{no:0,name:"JOINING"},{no:1,name:"JOINED"},{no:2,name:"ACTIVE"},{no:3,name:"DISCONNECTED"}]),Bw=be.makeEnum("livekit.ParticipantInfo.Kind",[{no:0,name:"STANDARD"},{no:1,name:"INGRESS"},{no:2,name:"EGRESS"},{no:3,name:"SIP"},{no:4,name:"AGENT"},{no:7,name:"CONNECTOR"},{no:8,name:"BRIDGE"}]),rje=be.makeEnum("livekit.ParticipantInfo.KindDetail",[{no:0,name:"CLOUD_AGENT"},{no:1,name:"FORWARDED"},{no:2,name:"CONNECTOR_WHATSAPP"},{no:3,name:"CONNECTOR_TWILIO"},{no:4,name:"BRIDGE_RTSP"}]),yr=be.makeEnum("livekit.Encryption.Type",[{no:0,name:"NONE"},{no:1,name:"GCM"},{no:2,name:"CUSTOM"}]),ije=be.makeMessageType("livekit.SimulcastCodecInfo",()=>[{no:1,name:"mime_type",kind:"scalar",T:9},{no:2,name:"mid",kind:"scalar",T:9},{no:3,name:"cid",kind:"scalar",T:9},{no:4,name:"layers",kind:"message",T:qh,repeated:!0},{no:5,name:"video_layer_mode",kind:"enum",T:be.getEnumType(Kee)},{no:6,name:"sdp_cid",kind:"scalar",T:9}]),Ug=be.makeMessageType("livekit.TrackInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:be.getEnumType(zl)},{no:3,name:"name",kind:"scalar",T:9},{no:4,name:"muted",kind:"scalar",T:8},{no:5,name:"width",kind:"scalar",T:13},{no:6,name:"height",kind:"scalar",T:13},{no:7,name:"simulcast",kind:"scalar",T:8},{no:8,name:"disable_dtx",kind:"scalar",T:8},{no:9,name:"source",kind:"enum",T:be.getEnumType(Oi)},{no:10,name:"layers",kind:"message",T:qh,repeated:!0},{no:11,name:"mime_type",kind:"scalar",T:9},{no:12,name:"mid",kind:"scalar",T:9},{no:13,name:"codecs",kind:"message",T:ije,repeated:!0},{no:14,name:"stereo",kind:"scalar",T:8},{no:15,name:"disable_red",kind:"scalar",T:8},{no:16,name:"encryption",kind:"enum",T:be.getEnumType(yr)},{no:17,name:"stream",kind:"scalar",T:9},{no:18,name:"version",kind:"message",T:ate},{no:19,name:"audio_features",kind:"enum",T:be.getEnumType(ls),repeated:!0},{no:20,name:"backup_codec_policy",kind:"enum",T:be.getEnumType(Gee)},{no:21,name:"packet_trailer_features",kind:"enum",T:be.getEnumType(Hee),repeated:!0}]),rC=be.makeMessageType("livekit.DataTrackInfo",()=>[{no:1,name:"pub_handle",kind:"scalar",T:13},{no:2,name:"sid",kind:"scalar",T:9},{no:3,name:"name",kind:"scalar",T:9},{no:4,name:"encryption",kind:"enum",T:be.getEnumType(yr)}]),sje=be.makeMessageType("livekit.DataTrackSubscriptionOptions",()=>[{no:1,name:"target_fps",kind:"scalar",T:13,opt:!0}]),qh=be.makeMessageType("livekit.VideoLayer",()=>[{no:1,name:"quality",kind:"enum",T:be.getEnumType(bO)},{no:2,name:"width",kind:"scalar",T:13},{no:3,name:"height",kind:"scalar",T:13},{no:4,name:"bitrate",kind:"scalar",T:13},{no:5,name:"ssrc",kind:"scalar",T:13},{no:6,name:"spatial_layer",kind:"scalar",T:5},{no:7,name:"rid",kind:"scalar",T:9},{no:8,name:"repair_ssrc",kind:"scalar",T:13}]),Kee=be.makeEnum("livekit.VideoLayer.Mode",[{no:0,name:"MODE_UNUSED"},{no:1,name:"ONE_SPATIAL_LAYER_PER_STREAM"},{no:2,name:"MULTIPLE_SPATIAL_LAYERS_PER_STREAM"},{no:3,name:"ONE_SPATIAL_LAYER_PER_STREAM_INCOMPLETE_RTCP_SR"}]),_a=be.makeMessageType("livekit.DataPacket",()=>[{no:1,name:"kind",kind:"enum",T:be.getEnumType(yp)},{no:4,name:"participant_identity",kind:"scalar",T:9},{no:5,name:"destination_identities",kind:"scalar",T:9,repeated:!0},{no:2,name:"user",kind:"message",T:xO,oneof:"value"},{no:3,name:"speaker",kind:"message",T:aje,oneof:"value"},{no:6,name:"sip_dtmf",kind:"message",T:Qee,oneof:"value"},{no:7,name:"transcription",kind:"message",T:oje,oneof:"value"},{no:8,name:"metrics",kind:"message",T:X6e,oneof:"value"},{no:9,name:"chat_message",kind:"message",T:vS,oneof:"value"},{no:10,name:"rpc_request",kind:"message",T:kO,oneof:"value"},{no:11,name:"rpc_ack",kind:"message",T:SO,oneof:"value"},{no:12,name:"rpc_response",kind:"message",T:TO,oneof:"value"},{no:13,name:"stream_header",kind:"message",T:yS,oneof:"value"},{no:14,name:"stream_chunk",kind:"message",T:_S,oneof:"value"},{no:15,name:"stream_trailer",kind:"message",T:wS,oneof:"value"},{no:18,name:"encrypted_packet",kind:"message",T:Jee,oneof:"value"},{no:16,name:"sequence",kind:"scalar",T:13},{no:17,name:"participant_sid",kind:"scalar",T:9}]),yp=be.makeEnum("livekit.DataPacket.Kind",[{no:0,name:"RELIABLE"},{no:1,name:"LOSSY"}]),Jee=be.makeMessageType("livekit.EncryptedPacket",()=>[{no:1,name:"encryption_type",kind:"enum",T:be.getEnumType(yr)},{no:2,name:"iv",kind:"scalar",T:12},{no:3,name:"key_index",kind:"scalar",T:13},{no:4,name:"encrypted_value",kind:"scalar",T:12}]),Yee=be.makeMessageType("livekit.EncryptedPacketPayload",()=>[{no:1,name:"user",kind:"message",T:xO,oneof:"value"},{no:3,name:"chat_message",kind:"message",T:vS,oneof:"value"},{no:4,name:"rpc_request",kind:"message",T:kO,oneof:"value"},{no:5,name:"rpc_ack",kind:"message",T:SO,oneof:"value"},{no:6,name:"rpc_response",kind:"message",T:TO,oneof:"value"},{no:7,name:"stream_header",kind:"message",T:yS,oneof:"value"},{no:8,name:"stream_chunk",kind:"message",T:_S,oneof:"value"},{no:9,name:"stream_trailer",kind:"message",T:wS,oneof:"value"}]),aje=be.makeMessageType("livekit.ActiveSpeakerUpdate",()=>[{no:1,name:"speakers",kind:"message",T:Xee,repeated:!0}]),Xee=be.makeMessageType("livekit.SpeakerInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"level",kind:"scalar",T:2},{no:3,name:"active",kind:"scalar",T:8}]),xO=be.makeMessageType("livekit.UserPacket",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:5,name:"participant_identity",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",T:12},{no:3,name:"destination_sids",kind:"scalar",T:9,repeated:!0},{no:6,name:"destination_identities",kind:"scalar",T:9,repeated:!0},{no:4,name:"topic",kind:"scalar",T:9,opt:!0},{no:8,name:"id",kind:"scalar",T:9,opt:!0},{no:9,name:"start_time",kind:"scalar",T:4,opt:!0},{no:10,name:"end_time",kind:"scalar",T:4,opt:!0},{no:11,name:"nonce",kind:"scalar",T:12}]),Qee=be.makeMessageType("livekit.SipDTMF",()=>[{no:3,name:"code",kind:"scalar",T:13},{no:4,name:"digit",kind:"scalar",T:9}]),oje=be.makeMessageType("livekit.Transcription",()=>[{no:2,name:"transcribed_participant_identity",kind:"scalar",T:9},{no:3,name:"track_id",kind:"scalar",T:9},{no:4,name:"segments",kind:"message",T:lje,repeated:!0}]),lje=be.makeMessageType("livekit.TranscriptionSegment",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"text",kind:"scalar",T:9},{no:3,name:"start_time",kind:"scalar",T:4},{no:4,name:"end_time",kind:"scalar",T:4},{no:5,name:"final",kind:"scalar",T:8},{no:6,name:"language",kind:"scalar",T:9}]),vS=be.makeMessageType("livekit.ChatMessage",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"timestamp",kind:"scalar",T:3},{no:3,name:"edit_timestamp",kind:"scalar",T:3,opt:!0},{no:4,name:"message",kind:"scalar",T:9},{no:5,name:"deleted",kind:"scalar",T:8},{no:6,name:"generated",kind:"scalar",T:8}]),kO=be.makeMessageType("livekit.RpcRequest",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"method",kind:"scalar",T:9},{no:3,name:"payload",kind:"scalar",T:9},{no:4,name:"response_timeout_ms",kind:"scalar",T:13},{no:5,name:"version",kind:"scalar",T:13},{no:6,name:"compressed_payload",kind:"scalar",T:12}]),SO=be.makeMessageType("livekit.RpcAck",()=>[{no:1,name:"request_id",kind:"scalar",T:9}]),TO=be.makeMessageType("livekit.RpcResponse",()=>[{no:1,name:"request_id",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",T:9,oneof:"value"},{no:3,name:"error",kind:"message",T:Zee,oneof:"value"},{no:4,name:"compressed_payload",kind:"scalar",T:12,oneof:"value"}]),Zee=be.makeMessageType("livekit.RpcError",()=>[{no:1,name:"code",kind:"scalar",T:13},{no:2,name:"message",kind:"scalar",T:9},{no:3,name:"data",kind:"scalar",T:9}]),ete=be.makeMessageType("livekit.ParticipantTracks",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sids",kind:"scalar",T:9,repeated:!0}]),tte=be.makeMessageType("livekit.ServerInfo",()=>[{no:1,name:"edition",kind:"enum",T:be.getEnumType(nte)},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"protocol",kind:"scalar",T:5},{no:4,name:"region",kind:"scalar",T:9},{no:5,name:"node_id",kind:"scalar",T:9},{no:6,name:"debug_info",kind:"scalar",T:9},{no:7,name:"agent_protocol",kind:"scalar",T:5}]),nte=be.makeEnum("livekit.ServerInfo.Edition",[{no:0,name:"Standard"},{no:1,name:"Cloud"}]),rte=be.makeMessageType("livekit.ClientInfo",()=>[{no:1,name:"sdk",kind:"enum",T:be.getEnumType(ite)},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"protocol",kind:"scalar",T:5},{no:4,name:"os",kind:"scalar",T:9},{no:5,name:"os_version",kind:"scalar",T:9},{no:6,name:"device_model",kind:"scalar",T:9},{no:7,name:"browser",kind:"scalar",T:9},{no:8,name:"browser_version",kind:"scalar",T:9},{no:9,name:"address",kind:"scalar",T:9},{no:10,name:"network",kind:"scalar",T:9},{no:11,name:"other_sdks",kind:"scalar",T:9},{no:12,name:"client_protocol",kind:"scalar",T:5}]),ite=be.makeEnum("livekit.ClientInfo.SDK",[{no:0,name:"UNKNOWN"},{no:1,name:"JS"},{no:2,name:"SWIFT"},{no:3,name:"ANDROID"},{no:4,name:"FLUTTER"},{no:5,name:"GO"},{no:6,name:"UNITY"},{no:7,name:"REACT_NATIVE"},{no:8,name:"RUST"},{no:9,name:"PYTHON"},{no:10,name:"CPP"},{no:11,name:"UNITY_WEB"},{no:12,name:"NODE"},{no:13,name:"UNREAL"},{no:14,name:"ESP32"}]),ste=b
vendor: 16,384 bytes, line 753
753e.makeMessageType("livekit.ClientConfiguration",()=>[{no:1,name:"video",kind:"message",T:R7},{no:2,name:"screen",kind:"message",T:R7},{no:3,name:"resume_connection",kind:"enum",T:be.getEnumType(jw)},{no:4,name:"disabled_codecs",kind:"message",T:cje},{no:5,name:"force_relay",kind:"enum",T:be.getEnumType(jw)}]),R7=be.makeMessageType("livekit.VideoConfiguration",()=>[{no:1,name:"hardware_encoder",kind:"enum",T:be.getEnumType(jw)}]),cje=be.makeMessageType("livekit.DisabledCodecs",()=>[{no:1,name:"codecs",kind:"message",T:gS,repeated:!0},{no:2,name:"publish",kind:"message",T:gS,repeated:!0}]),ate=be.makeMessageType("livekit.TimedVersion",()=>[{no:1,name:"unix_micro",kind:"scalar",T:3},{no:2,name:"ticks",kind:"scalar",T:5}]),ON=be.makeEnum("livekit.DataStream.OperationType",[{no:0,name:"CREATE"},{no:1,name:"UPDATE"},{no:2,name:"DELETE"},{no:3,name:"REACTION"}]),ote=be.makeMessageType("livekit.DataStream.TextHeader",()=>[{no:1,name:"operation_type",kind:"enum",T:be.getEnumType(ON)},{no:2,name:"version",kind:"scalar",T:5},{no:3,name:"reply_to_stream_id",kind:"scalar",T:9},{no:4,name:"attached_stream_ids",kind:"scalar",T:9,repeated:!0},{no:5,name:"generated",kind:"scalar",T:8}],{localName:"DataStream_TextHeader"}),lte=be.makeMessageType("livekit.DataStream.ByteHeader",()=>[{no:1,name:"name",kind:"scalar",T:9}],{localName:"DataStream_ByteHeader"}),yS=be.makeMessageType("livekit.DataStream.Header",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"timestamp",kind:"scalar",T:3},{no:3,name:"topic",kind:"scalar",T:9},{no:4,name:"mime_type",kind:"scalar",T:9},{no:5,name:"total_length",kind:"scalar",T:4,opt:!0},{no:7,name:"encryption_type",kind:"enum",T:be.getEnumType(yr)},{no:8,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:9,name:"text_header",kind:"message",T:ote,oneof:"content_header"},{no:10,name:"byte_header",kind:"message",T:lte,oneof:"content_header"}],{localName:"DataStream_Header"}),_S=be.makeMessageType("livekit.DataStream.Chunk",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"chunk_index",kind:"scalar",T:4},{no:3,name:"content",kind:"scalar",T:12},{no:4,name:"version",kind:"scalar",T:5},{no:5,name:"iv",kind:"scalar",T:12,opt:!0}],{localName:"DataStream_Chunk"}),wS=be.makeMessageType("livekit.DataStream.Trailer",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"reason",kind:"scalar",T:9},{no:3,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}}],{localName:"DataStream_Trailer"}),uje=be.makeMessageType("livekit.SubscribedAudioCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"enabled",kind:"scalar",T:8}]),$l=be.makeEnum("livekit.SignalTarget",[{no:0,name:"PUBLISHER"},{no:1,name:"SUBSCRIBER"}]),DN=be.makeEnum("livekit.StreamState",[{no:0,name:"ACTIVE"},{no:1,name:"PAUSED"}]),dje=be.makeEnum("livekit.CandidateProtocol",[{no:0,name:"UDP"},{no:1,name:"TCP"},{no:2,name:"TLS"}]),hje=be.makeMessageType("livekit.SignalRequest",()=>[{no:1,name:"offer",kind:"message",T:rf,oneof:"message"},{no:2,name:"answer",kind:"message",T:rf,oneof:"message"},{no:3,name:"trickle",kind:"message",T:iC,oneof:"message"},{no:4,name:"add_track",kind:"message",T:Uw,oneof:"message"},{no:5,name:"mute",kind:"message",T:sC,oneof:"message"},{no:6,name:"subscription",kind:"message",T:aC,oneof:"message"},{no:7,name:"track_setting",kind:"message",T:dte,oneof:"message"},{no:8,name:"leave",kind:"message",T:oC,oneof:"message"},{no:10,name:"update_layers",kind:"message",T:fte,oneof:"message"},{no:11,name:"subscription_permission",kind:"message",T:gte,oneof:"message"},{no:12,name:"sync_state",kind:"message",T:IO,oneof:"message"},{no:13,name:"simulate",kind:"message",T:Rc,oneof:"message"},{no:14,name:"ping",kind:"scalar",T:3,oneof:"message"},{no:15,name:"update_metadata",kind:"message",T:NO,oneof:"message"},{no:16,name:"ping_req",kind:"message",T:_te,oneof:"message"},{no:17,name:"update_audio_track",kind:"message",T:MO,oneof:"message"},{no:18,name:"update_video_track",kind:"message",T:hte,oneof:"message"},{no:19,name:"publish_data_track_request",kind:"message",T:CO,oneof:"message"},{no:20,name:"unpublish_data_track_request",kind:"message",T:AO,oneof:"message"},{no:21,name:"update_data_subscription",kind:"message",T:cte,oneof:"message"}]),I7=be.makeMessageType("livekit.SignalResponse",()=>[{no:1,name:"join",kind:"message",T:gje,oneof:"message"},{no:2,name:"answer",kind:"message",T:rf,oneof:"message"},{no:3,name:"offer",kind:"message",T:rf,oneof:"message"},{no:4,name:"trickle",kind:"message",T:iC,oneof:"message"},{no:5,name:"update",kind:"message",T:_je,oneof:"message"},{no:6,name:"track_published",kind:"message",T:PO,oneof:"message"},{no:8,name:"leave",kind:"message",T:oC,oneof:"message"},{no:9,name:"mute",kind:"message",T:sC,oneof:"message"},{no:10,name:"speakers_changed",kind:"message",T:wje,oneof:"message"},{no:11,name:"room_update",kind:"message",T:bje,oneof:"message"},{no:12,name:"connection_quality",kind:"message",T:kje,oneof:"message"},{no:13,name:"stream_state_update",kind:"message",T:Tje,oneof:"message"},{no:14,name:"subscribed_quality_update",kind:"message",T:Eje,oneof:"message"},{no:15,name:"subscription_permission_update",kind:"message",T:Pje,oneof:"message"},{no:16,name:"refresh_token",kind:"scalar",T:9,oneof:"message"},{no:17,name:"track_unpublished",kind:"message",T:yje,oneof:"message"},{no:18,name:"pong",kind:"scalar",T:3,oneof:"message"},{no:19,name:"reconnect",kind:"message",T:vje,oneof:"message"},{no:20,name:"pong_resp",kind:"message",T:Nje,oneof:"message"},{no:21,name:"subscription_response",kind:"message",T:Lje,oneof:"message"},{no:22,name:"request_response",kind:"message",T:Oje,oneof:"message"},{no:23,name:"track_subscribed",kind:"message",T:Dje,oneof:"message"},{no:24,name:"room_moved",kind:"message",T:Mje,oneof:"message"},{no:25,name:"media_sections_requirement",kind:"message",T:Bje,oneof:"message"},{no:26,name:"subscribed_audio_codec_update",kind:"message",T:Aje,oneof:"message"},{no:27,name:"publish_data_track_response",kind:"message",T:EO,oneof:"message"},{no:28,name:"unpublish_data_track_response",kind:"message",T:fje,oneof:"message"},{no:29,name:"data_track_subscriber_handles",kind:"message",T:pje,oneof:"message"}]),FN=be.makeMessageType("livekit.SimulcastCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"cid",kind:"scalar",T:9},{no:4,name:"layers",kind:"message",T:qh,repeated:!0},{no:5,name:"video_layer_mode",kind:"enum",T:be.getEnumType(Kee)}]),Uw=be.makeMessageType("livekit.AddTrackRequest",()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"type",kind:"enum",T:be.getEnumType(zl)},{no:4,name:"width",kind:"scalar",T:13},{no:5,name:"height",kind:"scalar",T:13},{no:6,name:"muted",kind:"scalar",T:8},{no:7,name:"disable_dtx",kind:"scalar",T:8},{no:8,name:"source",kind:"enum",T:be.getEnumType(Oi)},{no:9,name:"layers",kind:"message",T:qh,repeated:!0},{no:10,name:"simulcast_codecs",kind:"message",T:FN,repeated:!0},{no:11,name:"sid",kind:"scalar",T:9},{no:12,name:"stereo",kind:"scalar",T:8},{no:13,name:"disable_red",kind:"scalar",T:8},{no:14,name:"encryption",kind:"enum",T:be.getEnumType(yr)},{no:15,name:"stream",kind:"scalar",T:9},{no:16,name:"backup_codec_policy",kind:"enum",T:be.getEnumType(Gee)},{no:17,name:"audio_features",kind:"enum",T:be.getEnumType(ls),repeated:!0},{no:18,name:"packet_trailer_features",kind:"enum",T:be.getEnumType(Hee),repeated:!0}]),CO=be.makeMessageType("livekit.PublishDataTrackRequest",()=>[{no:1,name:"pub_handle",kind:"scalar",T:13},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"encryption",kind:"enum",T:be.getEnumType(yr)}]),EO=be.makeMessageType("livekit.PublishDataTrackResponse",()=>[{no:1,name:"info",kind:"message",T:rC}]),AO=be.makeMessageType("livekit.UnpublishDataTrackRequest",()=>[{no:1,name:"pub_handle",kind:"scalar",T:13}]),fje=be.makeMessageType("livekit.UnpublishDataTrackResponse",()=>[{no:1,name:"info",kind:"message",T:rC}]),pje=be.makeMessageType("livekit.DataTrackSubscriberHandles",()=>[{no:1,name:"sub_handles",kind:"map",K:13,V:{kind:"message",T:mje}}]),mje=be.makeMessageType("livekit.DataTrackSubscriberHandles.PublishedDataTrack",()=>[{no:1,name:"publisher_identity",kind:"scalar",T:9},{no:2,name:"publisher_sid",kind:"scalar",T:9},{no:3,name:"track_sid",kind:"scalar",T:9}],{localName:"DataTrackSubscriberHandles_PublishedDataTrack"}),iC=be.makeMessageType("livekit.TrickleRequest",()=>[{no:1,name:"candidateInit",kind:"scalar",T:9},{no:2,name:"target",kind:"enum",T:be.getEnumType($l)},{no:3,name:"final",kind:"scalar",T:8}]),sC=be.makeMessageType("livekit.MuteTrackRequest",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"muted",kind:"scalar",T:8}]),gje=be.makeMessageType("livekit.JoinResponse",()=>[{no:1,name:"room",kind:"message",T:nC},{no:2,name:"participant",kind:"message",T:Kp},{no:3,name:"other_participants",kind:"message",T:Kp,repeated:!0},{no:4,name:"server_version",kind:"scalar",T:9},{no:5,name:"ice_servers",kind:"message",T:pte,repeated:!0},{no:6,name:"subscriber_primary",kind:"scalar",T:8},{no:7,name:"alternative_url",kind:"scalar",T:9},{no:8,name:"client_configuration",kind:"message",T:ste},{no:9,name:"server_region",kind:"scalar",T:9},{no:10,name:"ping_timeout",kind:"scalar",T:5},{no:11,name:"ping_interval",kind:"scalar",T:5},{no:12,name:"server_info",kind:"message",T:tte},{no:13,name:"sif_trailer",kind:"scalar",T:12},{no:14,name:"enabled_publish_codecs",kind:"message",T:gS,repeated:!0},{no:15,name:"fast_publish",kind:"scalar",T:8}]),vje=be.makeMessageType("livekit.ReconnectResponse",()=>[{no:1,name:"ice_servers",kind:"message",T:pte,repeated:!0},{no:2,name:"client_configuration",kind:"message",T:ste},{no:3,name:"server_info",kind:"message",T:tte},{no:4,name:"last_message_seq",kind:"scalar",T:13}]),PO=be.makeMessageType("livekit.TrackPublishedResponse",()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"track",kind:"message",T:Ug}]),yje=be.makeMessageType("livekit.TrackUnpublishedResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]),rf=be.makeMessageType("livekit.SessionDescription",()=>[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"sdp",kind:"scalar",T:9},{no:3,name:"id",kind:"scalar",T:13},{no:4,name:"mid_to_track_id",kind:"map",K:9,V:{kind:"scalar",T:9}}]),_je=be.makeMessageType("livekit.ParticipantUpdate",()=>[{no:1,name:"participants",kind:"message",T:Kp,repeated:!0}]),aC=be.makeMessageType("livekit.UpdateSubscription",()=>[{no:1,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:2,name:"subscribe",kind:"scalar",T:8},{no:3,name:"participant_tracks",kind:"message",T:ete,repeated:!0}]),cte=be.makeMessageType("livekit.UpdateDataSubscription",()=>[{no:1,name:"updates",kind:"message",T:ute,repeated:!0}]),ute=be.makeMessageType("livekit.UpdateDataSubscription.Update",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribe",kind:"scalar",T:8},{no:3,name:"options",kind:"message",T:sje}],{localName:"UpdateDataSubscription_Update"}),dte=be.makeMessageType("livekit.UpdateTrackSettings",()=>[{no:1,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:3,name:"disabled",kind:"scalar",T:8},{no:4,name:"quality",kind:"enum",T:be.getEnumType(bO)},{no:5,name:"width",kind:"scalar",T:13},{no:6,name:"height",kind:"scalar",T:13},{no:7,name:"fps",kind:"scalar",T:13},{no:8,name:"priority",kind:"scalar",T:13}]),MO=be.makeMessageType("livekit.UpdateLocalAudioTrack",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"features",kind:"enum",T:be.getEnumType(ls),repeated:!0}]),hte=be.makeMessageType("livekit.UpdateLocalVideoTrack",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"width",kind:"scalar",T:13},{no:3,name:"height",kind:"scalar",T:13}]),oC=be.makeMessageType("livekit.LeaveRequest",()=>[{no:1,name:"can_reconnect",kind:"scalar",T:8},{no:2,name:"reason",kind:"enum",T:be.getEnumType(Jl)},{no:3,name:"action",kind:"enum",T:be.getEnumType(cv)},{no:4,name:"regions",kind:"message",T:Rje}]),cv=be.makeEnum("livekit.LeaveRequest.Action",[{no:0,name:"DISCONNECT"},{no:1,name:"RESUME"},{no:2,name:"RECONNECT"}]),fte=be.makeMessageType("livekit.UpdateVideoLayers",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"layers",kind:"message",T:qh,repeated:!0}]),NO=be.makeMessageType("livekit.UpdateParticipantMetadata",()=>[{no:1,name:"metadata",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:4,name:"request_id",kind:"scalar",T:13}]),pte=be.makeMessageType("livekit.ICEServer",()=>[{no:1,name:"urls",kind:"scalar",T:9,repeated:!0},{no:2,name:"username",kind:"scalar",T:9},{no:3,name:"credential",kind:"scalar",T:9}]),wje=be.makeMessageType("livekit.SpeakersChanged",()=>[{no:1,name:"speakers",kind:"message",T:Xee,repeated:!0}]),bje=be.makeMessageType("livekit.RoomUpdate",()=>[{no:1,name:"room",kind:"message",T:nC}]),xje=be.makeMessageType("livekit.ConnectionQualityInfo",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"quality",kind:"enum",T:be.getEnumType(a_)},{no:3,name:"score",kind:"scalar",T:2}]),kje=be.makeMessageType("livekit.ConnectionQualityUpdate",()=>[{no:1,name:"updates",kind:"message",T:xje,repeated:!0}]),Sje=be.makeMessageType("livekit.StreamStateInfo",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sid",kind:"scalar",T:9},{no:3,name:"state",kind:"enum",T:be.getEnumType(DN)}]),Tje=be.makeMessageType("livekit.StreamStateUpdate",()=>[{no:1,name:"stream_states",kind:"message",T:Sje,repeated:!0}]),RO=be.makeMessageType("livekit.SubscribedQuality",()=>[{no:1,name:"quality",kind:"enum",T:be.getEnumType(bO)},{no:2,name:"enabled",kind:"scalar",T:8}]),Cje=be.makeMessageType("livekit.SubscribedCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"qualities",kind:"message",T:RO,repeated:!0}]),Eje=be.makeMessageType("livekit.SubscribedQualityUpdate",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribed_qualities",kind:"message",T:RO,repeated:!0},{no:3,name:"subscribed_codecs",kind:"message",T:Cje,repeated:!0}]),Aje=be.makeMessageType("livekit.SubscribedAudioCodecUpdate",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribed_audio_codecs",kind:"message",T:uje,repeated:!0}]),mte=be.makeMessageType("livekit.TrackPermission",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"all_tracks",kind:"scalar",T:8},{no:3,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:4,name:"participant_identity",kind:"scalar",T:9}]),gte=be.makeMessageType("livekit.SubscriptionPermission",()=>[{no:1,name:"all_participants",kind:"scalar",T:8},{no:2,name:"track_permissions",kind:"message",T:mte,repeated:!0}]),Pje=be.makeMessageType("livekit.SubscriptionPermissionUpdate",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sid",kind:"scalar",T:9},{no:3,name:"allowed",kind:"scalar",T:8}]),Mje=be.makeMessageType("livekit.RoomMovedResponse",()=>[{no:1,name:"room",kind:"message",T:nC},{no:2,name:"token",kind:"scalar",T:9},{no:3,name:"participant",kind:"message",T:Kp},{no:4,name:"other_participants",kind:"message",T:Kp,repeated:!0}]),IO=be.makeMessageType("livekit.SyncState",()=>[{no:1,name:"answer",kind:"message",T:rf},{no:2,name:"subscription",kind:"message",T:aC},{no:3,name:"publish_tracks",kind:"message",T:PO,repeated:!0},{no:4,name:"data_channels",kind:"message",T:yte,repeated:!0},{no:5,name:"offer",kind:"message",T:rf},{no:6,name:"track_sids_disabled",kind:"scalar",T:9,repeated:!0},{no:7,name:"datachannel_receive_states",kind:"message",T:vte,repeated:!0},{no:8,name:"publish_data_tracks",kind:"message",T:EO,repeated:!0}]),vte=be.makeMessageType("livekit.DataChannelReceiveState",()=>[{no:1,name:"publisher_sid",kind:"scalar",T:9},{no:2,name:"last_seq",kind:"scalar",T:13}]),yte=be.makeMessageType("livekit.DataChannelInfo",()=>[{no:1,name:"label",kind:"scalar",T:9},{no:2,name:"id",kind:"scalar",T:13},{no:3,name:"target",kind:"enum",T:be.getEnumType($l)}]),Rc=be.makeMessageType("livekit.SimulateScenario",()=>[{no:1,name:"speaker_update",kind:"scalar",T:5,oneof:"scenario"},{no:2,name:"node_failure",kind:"scalar",T:8,oneof:"scenario"},{no:3,name:"migration",kind:"scalar",T:8,oneof:"scenario"},{no:4,name:"server_leave",kind:"scalar",T:8,oneof:"scenario"},{no:5,name:"switch_candidate_protocol",kind:"enum",T:be.getEnumType(dje),oneof:"scenario"},{no:6,name:"subscriber_bandwidth",kind:"scalar",T:3,oneof:"scenario"},{no:7,name:"disconnect_signal_on_resume",kind:"scalar",T:8,oneof:"scenario"},{
vendor: 67,621 bytes, lines 753-787
753no:8,name:"disconnect_signal_on_resume_no_messages",kind:"scalar",T:8,oneof:"scenario"},{no:9,name:"leave_request_full_reconnect",kind:"scalar",T:8,oneof:"scenario"}]),_te=be.makeMessageType("livekit.Ping",()=>[{no:1,name:"timestamp",kind:"scalar",T:3},{no:2,name:"rtt",kind:"scalar",T:3}]),Nje=be.makeMessageType("livekit.Pong",()=>[{no:1,name:"last_ping_timestamp",kind:"scalar",T:3},{no:2,name:"timestamp",kind:"scalar",T:3}]),Rje=be.makeMessageType("livekit.RegionSettings",()=>[{no:1,name:"regions",kind:"message",T:Ije,repeated:!0}]),Ije=be.makeMessageType("livekit.RegionInfo",()=>[{no:1,name:"region",kind:"scalar",T:9},{no:2,name:"url",kind:"scalar",T:9},{no:3,name:"distance",kind:"scalar",T:3}]),Lje=be.makeMessageType("livekit.SubscriptionResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"err",kind:"enum",T:be.getEnumType(tje)}]),Oje=be.makeMessageType("livekit.RequestResponse",()=>[{no:1,name:"request_id",kind:"scalar",T:13},{no:2,name:"reason",kind:"enum",T:be.getEnumType(rp)},{no:3,name:"message",kind:"scalar",T:9},{no:4,name:"trickle",kind:"message",T:iC,oneof:"request"},{no:5,name:"add_track",kind:"message",T:Uw,oneof:"request"},{no:6,name:"mute",kind:"message",T:sC,oneof:"request"},{no:7,name:"update_metadata",kind:"message",T:NO,oneof:"request"},{no:8,name:"update_audio_track",kind:"message",T:MO,oneof:"request"},{no:9,name:"update_video_track",kind:"message",T:hte,oneof:"request"},{no:10,name:"publish_data_track",kind:"message",T:CO,oneof:"request"},{no:11,name:"unpublish_data_track",kind:"message",T:AO,oneof:"request"}]),rp=be.makeEnum("livekit.RequestResponse.Reason",[{no:0,name:"OK"},{no:1,name:"NOT_FOUND"},{no:2,name:"NOT_ALLOWED"},{no:3,name:"LIMIT_EXCEEDED"},{no:4,name:"QUEUED"},{no:5,name:"UNSUPPORTED_TYPE"},{no:6,name:"UNCLASSIFIED_ERROR"},{no:7,name:"INVALID_HANDLE"},{no:8,name:"INVALID_NAME"},{no:9,name:"DUPLICATE_HANDLE"},{no:10,name:"DUPLICATE_NAME"}]),Dje=be.makeMessageType("livekit.TrackSubscribed",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]),wte=be.makeMessageType("livekit.ConnectionSettings",()=>[{no:1,name:"auto_subscribe",kind:"scalar",T:8},{no:2,name:"adaptive_stream",kind:"scalar",T:8},{no:3,name:"subscriber_allow_pause",kind:"scalar",T:8,opt:!0},{no:4,name:"disable_ice_lite",kind:"scalar",T:8},{no:5,name:"auto_subscribe_data_track",kind:"scalar",T:8,opt:!0}]),Fje=be.makeMessageType("livekit.JoinRequest",()=>[{no:1,name:"client_info",kind:"message",T:rte},{no:2,name:"connection_settings",kind:"message",T:wte},{no:3,name:"metadata",kind:"scalar",T:9},{no:4,name:"participant_attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:5,name:"add_track_requests",kind:"message",T:Uw,repeated:!0},{no:6,name:"publisher_offer",kind:"message",T:rf},{no:7,name:"reconnect",kind:"scalar",T:8},{no:8,name:"reconnect_reason",kind:"enum",T:be.getEnumType(Qf)},{no:9,name:"participant_sid",kind:"scalar",T:9},{no:10,name:"sync_state",kind:"message",T:IO}]),jje=be.makeMessageType("livekit.WrappedJoinRequest",()=>[{no:1,name:"compression",kind:"enum",T:be.getEnumType(jN)},{no:2,name:"join_request",kind:"scalar",T:12}]),jN=be.makeEnum("livekit.WrappedJoinRequest.Compression",[{no:0,name:"NONE"},{no:1,name:"GZIP"}]),Bje=be.makeMessageType("livekit.MediaSectionsRequirement",()=>[{no:1,name:"num_audios",kind:"scalar",T:13},{no:2,name:"num_videos",kind:"scalar",T:13}]);function Uje(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Bx={exports:{}},zje=Bx.exports,L7;function $je(){return L7||(L7=1,function(t){(function(e,n){t.exports?t.exports=n():e.log=n()})(zje,function(){var e=function(){},n="undefined",r=typeof window!==n&&typeof window.navigator!==n&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],s={},a=null;function o(m,g){var v=m[g];if(typeof v.bind=="function")return v.bind(m);try{return Function.prototype.bind.call(v,m)}catch{return function(){return Function.prototype.apply.apply(v,[m,arguments])}}}function l(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function c(m){return m==="debug"&&(m="log"),typeof console===n?!1:m==="trace"&&r?l:console[m]!==void 0?o(console,m):console.log!==void 0?o(console,"log"):e}function u(){for(var m=this.getLevel(),g=0;g<i.length;g++){var v=i[g];this[v]=g<m?e:this.methodFactory(v,m,this.name)}if(this.log=this.debug,typeof console===n&&m<this.levels.SILENT)return"No console available for logging"}function d(m){return function(){typeof console!==n&&(u.call(this),this[m].apply(this,arguments))}}function f(m,g,v){return c(m)||d.apply(this,arguments)}function h(m,g){var v=this,_,b,x,T="loglevel";typeof m=="string"?T+=":"+m:typeof m=="symbol"&&(T=void 0);function N(R){var j=(i[R]||"silent").toUpperCase();if(!(typeof window===n||!T)){try{window.localStorage[T]=j;return}catch{}try{window.document.cookie=encodeURIComponent(T)+"="+j+";"}catch{}}}function A(){var R;if(!(typeof window===n||!T)){try{R=window.localStorage[T]}catch{}if(typeof R===n)try{var j=window.document.cookie,$=encodeURIComponent(T),U=j.indexOf($+"=");U!==-1&&(R=/^([^;]+)/.exec(j.slice(U+$.length+1))[1])}catch{}return v.levels[R]===void 0&&(R=void 0),R}}function L(){if(!(typeof window===n||!T)){try{window.localStorage.removeItem(T)}catch{}try{window.document.cookie=encodeURIComponent(T)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function M(R){var j=R;if(typeof j=="string"&&v.levels[j.toUpperCase()]!==void 0&&(j=v.levels[j.toUpperCase()]),typeof j=="number"&&j>=0&&j<=v.levels.SILENT)return j;throw new TypeError("log.setLevel() called with invalid level: "+R)}v.name=m,v.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},v.methodFactory=g||f,v.getLevel=function(){return x??b??_},v.setLevel=function(R,j){return x=M(R),j!==!1&&N(x),u.call(v)},v.setDefaultLevel=function(R){b=M(R),A()||v.setLevel(R,!1)},v.resetLevel=function(){x=null,L(),u.call(v)},v.enableAll=function(R){v.setLevel(v.levels.TRACE,R)},v.disableAll=function(R){v.setLevel(v.levels.SILENT,R)},v.rebuild=function(){if(a!==v&&(_=M(a.getLevel())),u.call(v),a===v)for(var R in s)s[R].rebuild()},_=M(a?a.getLevel():"WARN");var B=A();B!=null&&(x=M(B)),u.call(v)}a=new h,a.getLogger=function(g){if(typeof g!="symbol"&&typeof g!="string"||g==="")throw new TypeError("You must supply a name when creating a logger.");var v=s[g];return v||(v=s[g]=new h(g,a.methodFactory)),v};var p=typeof window!==n?window.log:void 0;return a.noConflict=function(){return typeof window!==n&&window.log===a&&(window.log=p),a},a.getLoggers=function(){return s},a.default=a,a})}(Bx)),Bx.exports}var lC=$je(),BN;(function(t){t[t.trace=0]="trace",t[t.debug=1]="debug",t[t.info=2]="info",t[t.warn=3]="warn",t[t.error=4]="error",t[t.silent=5]="silent"})(BN||(BN={}));var hs;(function(t){t.Default="livekit",t.Room="livekit-room",t.TokenSource="livekit-token-source",t.Participant="livekit-participant",t.Track="livekit-track",t.Publication="livekit-track-publication",t.Engine="livekit-engine",t.Signal="livekit-signal",t.PCManager="livekit-pc-manager",t.PCTransport="livekit-pc-transport",t.E2EE="lk-e2ee",t.DataTracks="livekit-data-tracks"})(hs||(hs={}));let mn=lC.getLogger(hs.Default);Object.values(hs).map(t=>lC.getLogger(t));mn.setDefaultLevel(BN.info);function Xa(t,e){const n=lC.getLogger(t);return n.setDefaultLevel(mn.getLevel()),e?Vje(n,e):n}function Vje(t,e){const n=i=>(s,a)=>{const o=e(),l=o||a?Object.assign(Object.assign({},o),a):void 0;t[i](s,l)},r=Object.create(t);return r.trace=n("trace"),r.debug=n("debug"),r.info=n("info"),r.warn=n("warn"),r.error=n("error"),r}const qje=lC.getLogger(hs.E2EE),My=7e3,Wje=[0,300,2*2*300,3*3*300,4*4*300,My,My,My,My,My];class Gje{constructor(e){this._retryDelays=e!==void 0?[...e]:Wje}nextRetryDelayInMs(e){if(e.retryCount>=this._retryDelays.length)return null;const n=this._retryDelays[e.retryCount];return e.retryCount<=1?n:n+Math.random()*1e3}}function Hje(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function ce(t,e,n,r){function i(s){return s instanceof n?s:new n(function(a){a(s)})}return new(n||(n=Promise))(function(s,a){function o(u){try{c(r.next(u))}catch(d){a(d)}}function l(u){try{c(r.throw(u))}catch(d){a(d)}}function c(u){u.done?s(u.value):i(u.value).then(o,l)}c((r=r.apply(t,e||[])).next())})}function O7(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function $v(t){return this instanceof $v?(this.v=t,this):new $v(t)}function Kje(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),o("next"),o("throw"),o("return",a),i[Symbol.asyncIterator]=function(){return this},i;function a(h){return function(p){return Promise.resolve(p).then(h,d)}}function o(h,p){r[h]&&(i[h]=function(m){return new Promise(function(g,v){s.push([h,m,g,v])>1||l(h,m)})},p&&(i[h]=p(i[h])))}function l(h,p){try{c(r[h](p))}catch(m){f(s[0][3],m)}}function c(h){h.value instanceof $v?Promise.resolve(h.value.v).then(u,d):f(s[0][2],h)}function u(h){l("next",h)}function d(h){l("throw",h)}function f(h,p){h(p),s.shift(),s.length&&l(s[0][0],s[0][1])}}function Jje(t){var e,n;return e={},r("next"),r("throw",function(i){throw i}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(i,s){e[i]=t[i]?function(a){return(n=!n)?{value:$v(t[i](a)),done:!1}:s?s(a):a}:s}}function Vl(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof O7=="function"?O7(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=t[s]&&function(a){return new Promise(function(o,l){a=t[s](a),i(o,l,a.done,a.value)})}}function i(s,a,o,l){Promise.resolve(l).then(function(c){s({value:c,done:o})},a)}}var S2={exports:{}},D7;function Yje(){if(D7)return S2.exports;D7=1;var t=typeof Reflect=="object"?Reflect:null,e=t&&typeof t.apply=="function"?t.apply:function(T,N,A){return Function.prototype.apply.call(T,N,A)},n;t&&typeof t.ownKeys=="function"?n=t.ownKeys:Object.getOwnPropertySymbols?n=function(T){return Object.getOwnPropertyNames(T).concat(Object.getOwnPropertySymbols(T))}:n=function(T){return Object.getOwnPropertyNames(T)};function r(x){console&&console.warn&&console.warn(x)}var i=Number.isNaN||function(T){return T!==T};function s(){s.init.call(this)}S2.exports=s,S2.exports.once=v,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var a=10;function o(x){if(typeof x!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof x)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(x){if(typeof x!="number"||x<0||i(x))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+x+".");a=x}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(T){if(typeof T!="number"||T<0||i(T))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+T+".");return this._maxListeners=T,this};function l(x){return x._maxListeners===void 0?s.defaultMaxListeners:x._maxListeners}s.prototype.getMaxListeners=function(){return l(this)},s.prototype.emit=function(T){for(var N=[],A=1;A<arguments.length;A++)N.push(arguments[A]);var L=T==="error",M=this._events;if(M!==void 0)L=L&&M.error===void 0;else if(!L)return!1;if(L){var B;if(N.length>0&&(B=N[0]),B instanceof Error)throw B;var R=new Error("Unhandled error."+(B?" ("+B.message+")":""));throw R.context=B,R}var j=M[T];if(j===void 0)return!1;if(typeof j=="function")e(j,this,N);else for(var $=j.length,U=p(j,$),A=0;A<$;++A)e(U[A],this,N);return!0};function c(x,T,N,A){var L,M,B;if(o(N),M=x._events,M===void 0?(M=x._events=Object.create(null),x._eventsCount=0):(M.newListener!==void 0&&(x.emit("newListener",T,N.listener?N.listener:N),M=x._events),B=M[T]),B===void 0)B=M[T]=N,++x._eventsCount;else if(typeof B=="function"?B=M[T]=A?[N,B]:[B,N]:A?B.unshift(N):B.push(N),L=l(x),L>0&&B.length>L&&!B.warned){B.warned=!0;var R=new Error("Possible EventEmitter memory leak detected. "+B.length+" "+String(T)+" listeners added. Use emitter.setMaxListeners() to increase limit");R.name="MaxListenersExceededWarning",R.emitter=x,R.type=T,R.count=B.length,r(R)}return x}s.prototype.addListener=function(T,N){return c(this,T,N,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(T,N){return c(this,T,N,!0)};function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(x,T,N){var A={fired:!1,wrapFn:void 0,target:x,type:T,listener:N},L=u.bind(A);return L.listener=N,A.wrapFn=L,L}s.prototype.once=function(T,N){return o(N),this.on(T,d(this,T,N)),this},s.prototype.prependOnceListener=function(T,N){return o(N),this.prependListener(T,d(this,T,N)),this},s.prototype.removeListener=function(T,N){var A,L,M,B,R;if(o(N),L=this._events,L===void 0)return this;if(A=L[T],A===void 0)return this;if(A===N||A.listener===N)--this._eventsCount===0?this._events=Object.create(null):(delete L[T],L.removeListener&&this.emit("removeListener",T,A.listener||N));else if(typeof A!="function"){for(M=-1,B=A.length-1;B>=0;B--)if(A[B]===N||A[B].listener===N){R=A[B].listener,M=B;break}if(M<0)return this;M===0?A.shift():m(A,M),A.length===1&&(L[T]=A[0]),L.removeListener!==void 0&&this.emit("removeListener",T,R||N)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(T){var N,A,L;if(A=this._events,A===void 0)return this;if(A.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):A[T]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete A[T]),this;if(arguments.length===0){var M=Object.keys(A),B;for(L=0;L<M.length;++L)B=M[L],B!=="removeListener"&&this.removeAllListeners(B);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(N=A[T],typeof N=="function")this.removeListener(T,N);else if(N!==void 0)for(L=N.length-1;L>=0;L--)this.removeListener(T,N[L]);return this};function f(x,T,N){var A=x._events;if(A===void 0)return[];var L=A[T];return L===void 0?[]:typeof L=="function"?N?[L.listener||L]:[L]:N?g(L):p(L,L.length)}s.prototype.listeners=function(T){return f(this,T,!0)},s.prototype.rawListeners=function(T){return f(this,T,!1)},s.listenerCount=function(x,T){return typeof x.listenerCount=="function"?x.listenerCount(T):h.call(x,T)},s.prototype.listenerCount=h;function h(x){var T=this._events;if(T!==void 0){var N=T[x];if(typeof N=="function")return 1;if(N!==void 0)return N.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};function p(x,T){for(var N=new Array(T),A=0;A<T;++A)N[A]=x[A];return N}function m(x,T){for(;T+1<x.length;T++)x[T]=x[T+1];x.pop()}function g(x){for(var T=new Array(x.length),N=0;N<T.length;++N)T[N]=x[N].listener||x[N];return T}function v(x,T){return new Promise(function(N,A){function L(B){x.removeListener(T,M),A(B)}function M(){typeof x.removeListener=="function"&&x.removeListener("error",L),N([].slice.call(arguments))}b(x,T,M,{once:!0}),T!=="error"&&_(x,L,{once:!0})})}function _(x,T,N){typeof x.on=="function"&&b(x,"error",T,N)}function b(x,T,N,A){if(typeof x.on=="function")A.once?x.once(T,N):x.on(T,N);else if(typeof x.addEventListener=="function")x.addEventListener(T,function L(M){A.once&&x.removeEventListener(T,L),N(M)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof x)}return S2.exports}var al=Yje();let bte=!0,xte=!0;function o_(t,e,n){const r=t.match(e);return r&&r.length>=n&&parseFloat(r[n],10)}function om(t,e,n){if(!t.RTCPeerConnection)return;if(!Object.getOwnPropertyDescriptor(EventTarget.prototype,"addEventListener").writable){LO("Unable to polyfill events");return}const i=t.RTCPeerConnection.prototype,s=i.addEventListener;i.addEventListener=function(o,l){if(o!==e)return s.apply(this,arguments);const c=u=>{const d=n(u);d&&(l.handleEvent?l.handleEvent(d):l(d))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(l,c),s.apply(this,[o,c])};const a=i.removeEventListener;i.removeEventListener=function(o,l){if(o!==e||!this._eventMap||!this._eventMap[e])return a.apply(this,arguments);if(!this._eventMap[e].has(l))return a.apply(this,arguments);const c=this._eventMap[e].get(l);return this._eventMap[e].delete(l),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,a.apply(this,[o,c])},Object.defineProperty(i,"on"+e,{get(){return this["_on"+e]},set(o){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),o&&this.addEventListener(e,this["_on"+e]=o)},enumerable:!0,configurable:!0})}function Xje(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(bte=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function Qje(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(xte=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function LO(){if(typeof window=="object"){if(bte)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function OO(t,e){xte&&console.warn(t+" is deprecated, please use "+e+" instead.")}function Zje(t){const e={browser:null,version:null};if(typeof t>"u"||!t.navigator||!t.navigator.userAgent)return e.browser="Not a browser.",e;const{navigator:n}=t;if(n.userAgentData&&n.userAgentData.brands){const r=n.userAgentData.brands.find(i=>i.brand==="Chromium");if(r)return{browser:"chrome",version:parseInt(r.version,10)}}if(n.mozGetUserMedia)e.browser="firefox",e.version=parseInt(o_(n.userAgent,/Firefox\/(\d+)\./,1));else if(n.webkitGetUserMedia||t.isSecureContext===!1&&t.webkitRTCPeerConnection)e.browser="chrome",e.version=parseInt(o_(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2))||null;else if(t.RTCPeerConnection&&n.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=parseInt(o_(n.userAgent,/AppleWebKit\/(\d+)\./,1)),e.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype,e._safariVersion=o_(n.userAgent,/Version\/(\d+(\.?\d+))/,1);else return e.browser="Not a supported browser.",e;return e}function F7(t){return Object.prototype.toString.call(t)==="[object Object]"}function kte(t){return F7(t)?Object.keys(t).reduce(function(e,n){const r=F7(t[n]),i=r?kte(t[n]):t[n],s=r&&!Object.keys(i).length;return i===void 0||s?e:Object.assign(e,{[n]:i})},{}):t}function UN(t,e,n){!e||n.has(e.id)||(n.set(e.id,e),Object.keys(e).forEach(r=>{r.endsWith("Id")?UN(t,t.get(e[r]),n):r.endsWith("Ids")&&e[r].forEach(i=>{UN(t,t.get(i),n)})}))}function j7(t,e,n){const r=n?"outbound-rtp":"inbound-rtp",i=new Map;if(e===null)return i;const s=[];return t.forEach(a=>{a.type==="track"&&a.trackIdentifier===e.id&&s.push(a)}),s.forEach(a=>{t.forEach(o=>{o.type===r&&o.trackId===a.id&&UN(t,o,i)})}),i}const B7=LO;function Ste(t,e){const n=t&&t.navigator;if(!n.mediaDevices)return;const r=function(o){if(typeof o!="object"||o.mandatory||o.optional)return o;const l={};return Object.keys(o).forEach(c=>{if(c==="require"||c==="advanced"||c==="mediaSource")return;const u=typeof o[c]=="object"?o[c]:{ideal:o[c]};u.exact!==void 0&&typeof u.exact=="number"&&(u.min=u.max=u.exact);const d=function(f,h){return f?f+h.charAt(0).toUpperCase()+h.slice(1):h==="deviceId"?"sourceId":h};if(u.ideal!==void 0){l.optional=l.optional||[];let f={};typeof u.ideal=="number"?(f[d("min",c)]=u.ideal,l.optional.push(f),f={},f[d("max",c)]=u.ideal,l.optional.push(f)):(f[d("",c)]=u.ideal,l.optional.push(f))}u.exact!==void 0&&typeof u.exact!="number"?(l.mandatory=l.mandatory||{},l.mandatory[d("",c)]=u.exact):["min","max"].forEach(f=>{u[f]!==void 0&&(l.mandatory=l.mandatory||{},l.mandatory[d(f,c)]=u[f])})}),o.advanced&&(l.optional=(l.optional||[]).concat(o.advanced)),l},i=function(o,l){if(e.version>=61)return l(o);if(o=JSON.parse(JSON.stringify(o)),o&&typeof o.audio=="object"){const c=function(u,d,f){d in u&&!(f in u)&&(u[f]=u[d],delete u[d])};o=JSON.parse(JSON.stringify(o)),c(o.audio,"autoGainControl","googAutoGainControl"),c(o.audio,"noiseSuppression","googNoiseSuppression"),o.audio=r(o.audio)}if(o&&typeof o.video=="object"){let c=o.video.facingMode;c=c&&(typeof c=="object"?c:{ideal:c});const u=e.version<66;if(c&&(c.exact==="user"||c.exact==="environment"||c.ideal==="user"||c.ideal==="environment")&&!(n.mediaDevices.getSupportedConstraints&&n.mediaDevices.getSupportedConstraints().facingMode&&!u)){delete o.video.facingMode;let d;if(c.exact==="environment"||c.ideal==="environment"?d=["back","rear"]:(c.exact==="user"||c.ideal==="user")&&(d=["front"]),d)return n.mediaDevices.enumerateDevices().then(f=>{f=f.filter(p=>p.kind==="videoinput");let h=f.find(p=>d.some(m=>p.label.toLowerCase().includes(m)));return!h&&f.length&&d.includes("back")&&(h=f[f.length-1]),h&&(o.video.deviceId=c.exact?{exact:h.deviceId}:{ideal:h.deviceId}),o.video=r(o.video),B7("chrome: "+JSON.stringify(o)),l(o)})}o.video=r(o.video)}return B7("chrome: "+JSON.stringify(o)),l(o)},s=function(o){return e.version>=64?o:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[o.name]||o.name,message:o.message,constraint:o.constraint||o.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},a=function(o,l,c){i(o,u=>{n.webkitGetUserMedia(u,l,d=>{c&&c(s(d))})})};if(n.getUserMedia=a.bind(n),n.mediaDevices.getUserMedia){const o=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(l){return i(l,c=>o(c).then(u=>{if(c.audio&&!u.getAudioTracks().length||c.video&&!u.getVideoTracks().length)throw u.getTracks().forEach(d=>{d.stop()}),new DOMException("","NotFoundError");return u},u=>Promise.reject(s(u))))}}}function Tte(t){t.MediaStream=t.MediaStream||t.webkitMediaStream}function Cte(t,e){if(!(e.version>102))if(typeof t=="object"&&t.RTCPeerConnection&&!("ontrack"in t.RTCPeerConnection.prototype)){Object.defineProperty(t.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(r){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=r)},enumerable:!0,configurable:!0});const n=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=i=>{i.stream.addEventListener("addtrack",s=>{let a;t.RTCPeerConnection.prototype.getReceivers?a=this.getReceivers().find(l=>l.track&&l.track.id===s.track.id):a={track:s.track};const o=new Event("track");o.track=s.track,o.receiver=a,o.transceiver={receiver:a},o.streams=[i.stream],this.dispatchEvent(o)}),i.stream.getTracks().forEach(s=>{let a;t.RTCPeerConnection.prototype.getReceivers?a=this.getReceivers().find(l=>l.track&&l.track.id===s.id):a={track:s};const o=new Event("track");o.track=s,o.receiver=a,o.transceiver={receiver:a},o.streams=[i.stream],this.dispatchEvent(o)})},this.addEventListener("addstream",this._ontrackpoly)),n.apply(this,arguments)}}else om(t,"track",n=>(n.transceiver||Object.defineProperty(n,"transceiver",{value:{receiver:n.receiver}}),n))}function Ete(t){if(typeof t=="object"&&t.RTCPeerConnection&&!("getSenders"in t.RTCPeerConnection.prototype)&&"createDTMFSender"in t.RTCPeerConnection.prototype){const e=function(i,s){return{track:s,get dtmf(){return this._dtmf===void 0&&(s.kind==="audio"?this._dtmf=i.createDTMFSender(s):this._dtmf=null),this._dtmf},_pc:i}};if(!t.RTCPeerConnection.prototype.getSenders){t.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const i=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(o,l){let c=i.apply(this,arguments);return c||(c=e(this,o),this._senders.push(c)),c};const s=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(o){s.apply(this,arguments);const l=this._senders.indexOf(o);l!==-1&&this._senders.splice(l,1)}}const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(s){this._senders=this._senders||[],n.apply(this,[s]),s.getTracks().forEach(a=>{this._senders.push(e(this,a))})};const r=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(s){this._senders=this._senders||[],r.apply(this,[s]),s.getTracks().forEach(a=>{const o=this._senders.find(l=>l.track===a);o&&this._senders.splice(this._senders.indexOf(o),1)})}}else if(typeof t=="object"&&t.RTCPeerConnection&&"getSenders"in t.RTCPeerConnection.prototype&&"createDTMFSender"in t.RTCPeerConnection.prototype&&t.RTCRtpSender&&!("dtmf"in t.RTCRtpSender.prototype)){const e=t.RTCPeerConnection.prototype.getSenders;t.RTCPeerConnection.prototype.getSenders=function(){const r=e.apply(this,[]);return r.forEach(i=>i._pc=this),r},Object.defineProperty(t.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function Ate(t,e){if(e.version>=67||!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender&&t.RTCRtpReceiver))return;if(!("getStats"in t.RTCRtpSender.prototype)){const r=t.RTCPeerConnection.prototype.getSenders;r&&(t.RTCPeerConnection.prototype.getSenders=function(){const a=r.apply(this,[]);return a.forEach(o=>o._pc=this),a});const i=t.RTCPeerConnection.prototype.addTrack;i&&(t.RTCPeerConnection.prototype.addTrack=function(){const a=i.apply(this,arguments);return a._pc=this,a}),t.RTCRtpSender.prototype.getStats=function(){const a=this;return this._pc.getStats().then(o=>j7(o,a.track,!0))}}if(!("getStats"in t.RTCRtpReceiver.prototype)){const r=t.RTCPeerConnection.prototype.getReceivers;r&&(t.RTCPeerConnection.prototype.getReceivers=function(){const s=r.apply(this,[]);return s.forEach(a=>a._pc=this),s}),om(t,"track",i=>(i.receiver._pc=i.srcElement,i)),t.RTCRtpReceiver.prototype.getStats=function(){const s=this;return this._pc.getStats().then(a=>j7(a,s.track,!1))}}if(!("getStats"in t.RTCRtpSender.prototype&&"getStats"in t.RTCRtpReceiver.prototype))return;const n=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof t.MediaStreamTrack){const i=arguments[0];let s,a,o;return this.getSenders().forEach(l=>{l.track===i&&(s?o=!0:s=l)}),this.getReceivers().forEach(l=>(l.track===i&&(a?o=!0:a=l),l.track===i)),o||s&&a?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):s?s.getStats():a?a.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return n.apply(this,arguments)}}function Pte(t){t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(a=>this._shimmedLocalStreams[a][0])};const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(a,o){if(!o)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const l=e.apply(this,arguments);return this._shimmedLocalStreams[o.id]?this._shimmedLocalStreams[o.id].indexOf(l)===-1&&this._shimmedLocalStreams[o.id].push(l):this._shimmedLocalStreams[o.id]=[o,l],l};const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(a){this._shimmedLocalStreams=this._shimmedLocalStreams||{},a.getTracks().forEach(c=>{if(this.getSenders().find(d=>d.track===c))throw new DOMException("Track already exists.","InvalidAccessError")});const o=this.getSenders();n.apply(this,arguments);const l=this.getSenders().filter(c=>o.indexOf(c)===-1);this._shimmedLocalStreams[a.id]=[a].concat(l)};const r=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(a){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[a.id],r.apply(this,arguments)};const i=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(a){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},a&&Object.keys(this._shimmedLocalStreams).forEach(o=>{const l=this._shimmedLocalStreams[o].indexOf(a);l!==-1&&this._shimmedLocalStreams[o].splice(l,1),this._shimmedLocalStreams[o].length===1&&delete this._shimmedLocalStreams[o]}),i.apply(this,arguments)}}function Mte(t,e){if(!t.RTCPeerConnection)return;if(t.RTCPeerConnection.prototype.addTrack&&e.version>=65)return Pte(t);const n=t.RTCPeerConnection.prototype.getLocalStreams;t.RTCPeerConnection.prototype.getLocalStreams=function(){const u=n.apply(this);return this._reverseStreams=this._reverseStreams||{},u.map(d=>this._reverseStreams[d.id])};const r=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(u){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},u.getTracks().forEach(d=>{if(this.getSenders().find(h=>h.track===d))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[u.id]){const d=new t.MediaStream(u.getTracks());this._streams[u.id]=d,this._reverseStreams[d.id]=u,u=d}r.apply(this,[u])};const i=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(u){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[u.id]||u]),delete this._reverseStreams[this._streams[u.id]?this._streams[u.id].id:u.id],delete this._streams[u.id]},t.RTCPeerConnection.prototype.addTrack=function(u,d){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const f=[].slice.call(arguments,1);if(f.length!==1||!f[0].getTracks().find(m=>m===u))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(m=>m.track===u))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const p=this._streams[d.id];if(p)p.addTrack(u),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const m=new t.MediaStream([u]);this._streams[d.id]=m,this._reverseStreams[m.id]=d,this.addStream(m)}return this.getSenders().find(m=>m.track===u)};function s(c,u){let d=u.sdp;return Object.keys(c._reverseStreams||[]).forEach(f=>{const h=c._reverseStreams[f],p=c._streams[h.id];d=d.replace(new RegExp(p.id,"g"),h.id)}),new RTCSessionDescription({type:u.type,sdp:d})}function a(c,u){let d=u.sdp;return Object.keys(c._reverseStreams||[]).forEach(f=>{const h=c._reverseStreams[f],p=c._streams[h.id];d=d.replace(new RegExp(h.id,"g"),p.id)}),new RTCSessionDescription({type:u.type,sdp:d})}["createOffer","createAnswer"].forEach(function(c){const u=t.RTCPeerConnection.prototype[c],d={[c](){const f=arguments;return arguments.length&&typeof arguments[0]=="function"?u.apply(this,[p=>{const m=s(this,p);f[0].apply(null,[m])},p=>{f[1]&&f[1].apply(null,p)},arguments[2]]):u.apply(this,arguments).then(p=>s(this,p))}};t.RTCPeerConnection.prototype[c]=d[c]});const o=t.RTCPeerConnection.prototype.setLocalDescription;t.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?o.apply(this,arguments):(arguments[0]=a(this,arguments[0]),o.apply(this,arguments))};const l=Object.getOwnPropertyDescriptor(t.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(t.RTCPeerConnection.prototype,"localDescription",{get(){const c=l.get.apply(this);return c.type===""?c:s(this,c)}}),t.RTCPeerConnection.prototype.removeTrack=function(u){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!u._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(u._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let f;Object.keys(this._streams).forEach(h=>{this._streams[h].getTracks().find(m=>u.track===m)&&(f=this._streams[h])}),f&&(f.getTracks().length===1?this.removeStream(this._reverseStreams[f.id]):f.removeTrack(u.track),this.dispatchEvent(new Event("negotiationneeded")))}}function zN(t,e){!t.RTCPeerConnection&&t.webkitRTCPeerConnection&&(t.RTCPeerConnection=t.webkitRTCPeerConnection),t.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(n){const r=t.RTCPeerConnection.prototype[n],i={[n](){return arguments[0]=new(n==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};t.RTCPeerConnection.prototype[n]=i[n]})}function Nte(t,e){e.version>102||om(t,"negotiationneeded",n=>{const r=n.target;if(!((e.version<72||r.getConfiguration&&r.getConfiguration().sdpSemantics==="plan-b")&&r.signalingState!=="stable"))return n})}var U7=Object.freeze({__proto__:null,fixNegotiationNeeded:Nte,shimAddTrackRemoveTrack:Mte,shimAddTrackRemoveTrackWithNative:Pte,shimGetSendersWithDtmf:Ete,shimGetUserMedia:Ste,shimMediaStream:Tte,shimOnTrack:Cte,shimPeerConnection:zN,shimSenderReceiverGetStats:Ate});function Rte(t,e){const n=t&&t.navigator,r=t&&t.MediaStreamTrack;if(n.getUserMedia=function(i,s,a){OO("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(i).then(s,a)},!(e.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){const i=function(a,o,l){o in a&&!(l in a)&&(a[l]=a[o],delete a[o])},s=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(a){return typeof a=="object"&&typeof a.audio=="object"&&(a=JSON.parse(JSON.stringify(a)),i(a.audio,"autoGainControl","mozAutoGainControl"),i(a.audio,"noiseSuppression","mozNoiseSuppression")),s(a)},r&&r.prototype.getSettings){const a=r.prototype.getSettings;r.prototype.getSettings=function(){const o=a.apply(this,arguments);return i(o,"mozAutoGainControl","autoGainControl"),i(o,"mozNoiseSuppression","noiseSuppression"),o}}if(r&&r.prototype.applyConstraints){const a=r.prototype.applyConstraints;r.prototype.applyConstraints=function(o){return this.kind==="audio"&&typeof o=="object"&&(o=JSON.parse(JSON.stringify(o)),i(o,"autoGainControl","mozAutoGainControl"),i(o,"noiseSuppression","mozNoiseSuppression")),a.apply(this,[o])}}}}function e8e(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&(t.navigator.mediaDevices.getDisplayMedia=function(r){if(!(r&&r.video)){const i=new DOMException("getDisplayMedia without video constraints is undefined");return i.name="NotFoundError",i.code=8,Promise.reject(i)}return r.video===!0?r.video={mediaSource:e}:r.video.mediaSource=e,t.navigator.mediaDevices.getUserMedia(r)})}function Ite(t){typeof t=="object"&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function $N(t,e){typeof t!="object"||!(t.RTCPeerConnection||t.mozRTCPeerConnection)||(!t.RTCPeerConnection&&t.mozRTCPeerConnection&&(t.RTCPeerConnection=t.mozRTCPeerConnection),e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(n){const r=t.RTCPeerConnection.prototype[n],i={[n](){return arguments[0]=new(n==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};t.RTCPeerConnection.prototype[n]=i[n]}))}function Lte(t,e){if(typeof t!="object"||!(t.RTCPeerConnection||t.mozRTCPeerConnection)||e.version>=151)return;const n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){const[s,a,o]=arguments;return this.signalingState==="closed"?Promise.resolve(new Map):r.apply(this,[s||null]).then(l=>{if(e.version<53&&!a)try{l.forEach(c=>{c.type=n[c.type]||c.type})}catch(c){if(c.name!=="TypeError")throw c;l.forEach((u,d)=>{l.set(d,Object.assign({},u,{type:n[u.type]||u.type}))})}return l}).then(a,o)}}function Ote(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender)||t.RTCRtpSender&&"getStats"in t.RTCRtpSender.prototype)return;const e=t.RTCPeerConnection.prototype.getSenders;e&&(t.RTCPeerConnection.prototype.getSenders=function(){const i=e.apply(this,[]);return i.forEach(s=>s._pc=this),i});const n=t.RTCPeerConnection.prototype.addTrack;n&&(t.RTCPeerConnection.prototype.addTrack=function(){const i=n.apply(this,arguments);return i._pc=this,i}),t.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function Dte(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender)||t.RTCRtpSender&&"getStats"in t.RTCRtpReceiver.prototype)return;const e=t.RTCPeerConnection.prototype.getReceivers;e&&(t.RTCPeerConnection.prototype.getReceivers=function(){const r=e.apply(this,[]);return r.forEach(i=>i._pc=this),r}),om(t,"track",n=>(n.receiver._pc=n.srcElement,n)),t.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function Fte(t){!t.RTCPeerConnection||"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(n){OO("removeStream","removeTrack"),this.getSenders().forEach(r=>{r.track&&n.getTracks().includes(r.track)&&this.removeTrack(r)})})}function jte(t){t.DataChannel&&!t.RTCDataChannel&&(t.RTCDataChannel=t.DataChannel)}function Bte(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.addTransceiver;e&&(t.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let r=arguments[1]&&arguments[1].sendEncodings;r===void 0&&(r=[]),r=[...r];const i=r.length>0;i&&r.forEach(a=>{if("rid"in a&&!/^[a-z0-9]{0,16}$/i.test(a.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in a&&!(parseFloat(a.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in a&&!(parseFloat(a.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const s=e.apply(this,arguments);if(i){const{sender:a}=s,o=a.getParameters();(!("encodings"in o)||o.encodings.length===1&&Object.keys(o.encodings[0]).length===0)&&(o.encodings=r,a.sendEncodings=r,this.setParametersPromises.push(a.setParameters(o).then(()=>{delete a.sendEncodings}).catch(()=>{delete a.sendEncodings})))}return s})}function Ute(t){if(!(typeof t=="object"&&t.RTCRtpSender))return;const e=t.RTCRtpSender.prototype.getParameters;e&&(t.RTCRtpSender.prototype.getParameters=function(){const r=e.apply(this,arguments);return"encodings"in r||(r.encodings=[].concat(this.sendEncodings||[{}])),r})}function zte(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}function $te(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.createAnswer;t.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}var z7=Object.freeze({__proto__:null,shimAddTransceiver:Bte,shimCreateAnswer:$te,shimCreateOffer:zte,shimGetDisplayMedia:e8e,shimGetParameters:Ute,shimGetStats:Lte,shimGetUserMedia:Rte,shimOnTrack:Ite,shimPeerConnection:$N,shimRTCDataChannel:jte,shimReceiverGetStats:Dte,shimRemoveStream:Fte,shimSenderGetStats:Ote});function Vte(t){if(!(typeof t!="object"||!t.RTCPeerConnection)){if("getLocalStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in t.RTCPeerConnection.prototype)){const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addStream=function(r){this._localStreams||(this._localStreams=[]),this._localStreams.includes(r)||this._localStreams.push(r),r.getAudioTracks().forEach(i=>e.call(this,i,r)),r.getVideoTracks().forEach(i=>e.call(this,i,r))},t.RTCPeerConnection.prototype.addTrack=function(r){for(var i=arguments.length,s=new Array(i>1?i-1:0),a=1;a<i;a++)s[a-1]=arguments[a];return s&&s.forEach(o=>{this._localStreams?this._localStreams.includes(o)||this._localStreams.push(o):this._localStreams=[o]}),e.apply(this,arguments)}}"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(n){this._localStreams||(this._localStreams=[]);const r=this._localStreams.indexOf(n);if(r===-1)return;this._localStreams.splice(r,1);const i=n.getTracks();this.getSenders().forEach(s=>{i.includes(s.track)&&this.removeTrack(s)})})}}function qte(t){if(!(typeof t!="object"||!t.RTCPeerConnection)&&("getRemoteStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in t.RTCPeerConnection.prototype))){Object.defineProperty(t.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(n){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=n),this.addEventListener("track",this._onaddstreampoly=r=>{r.streams.forEach(i=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(i))return;this._remoteStreams.push(i);const s=new Event("addstream");s.stream=i,this.dispatchEvent(s)})})}});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){const r=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(i){i.streams.forEach(s=>{if(r._remoteStreams||(r._remoteStreams=[]),r._remoteStreams.indexOf(s)>=0)return;r._remoteStreams.push(s);const a=new Event("addstream");a.stream=s,r.dispatchEvent(a)})}),e.apply(r,arguments)}}}function Wte(t){if(typeof t!="object"||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype,n=e.createOffer,r=e.createAnswer,i=e.setLocalDescription,s=e.setRemoteDescription,a=e.addIceCandidate;e.createOffer=function(c,u){const d=arguments.length>=2?arguments[2]:arguments[0],f=n.apply(this,[d]);return u?(f.then(c,u),Promise.resolve()):f},e.createAnswer=function(c,u){const d=arguments.length>=2?arguments[2]:arguments[0],f=r.apply(this,[d]);return u?(f.then(c,u),Promise.resolve()):f};let o=function(l,c,u){const d=i.apply(this,[l]);return u?(d.then(c,u),Promise.resolve()):d};e.setLocalDescription=o,o=function(l,c,u){const d=s.apply(this,[l]);return u?(d.then(c,u),Promise.resolve()):d},e.setRemoteDescription=o,o=function(l,c,u){const d=a.apply(this,[l]);return u?(d.then(c,u),Promise.resolve()):d},e.addIceCandidate=o}function Gte(t){const e=t&&t.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){const n=e.mediaDevices,r=n.getUserMedia.bind(n);e.mediaDevices.getUserMedia=i=>r(Hte(i))}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=(function(r,i,s){e.mediaDevices.getUserMedia(r).then(i,s)}).bind(e))}function Hte(t){return t&&t.video!==void 0?Object.assign({},t,{video:kte(t.video)}):t}function Kte(t){if(!t.RTCPeerConnection)return;const e=t.RTCPeerConnection;t.RTCPeerConnection=function(r,i){if(r&&r.iceServers){const s=[];for(let a=0;a<r.iceServers.length;a++){let o=r.iceServers[a];o.urls===void 0&&o.url?(OO("RTCIceServer.url","RTCIceServer.urls"),o=JSON.parse(JSON.stringify(o)),o.urls=o.url,delete o.url,s.push(o)):s.push(r.iceServers[a])}r.iceServers=s}return new e(r,i)},t.RTCPeerConnection.prototype=e.prototype,"generateCertificate"in e&&Object.defineProperty(t.RTCPeerConnection,"generateCertificate",{get(){return e.generateCertificate}})}function Jte(t){typeof t=="object"&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Yte(t){const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(r){if(r){typeof r.offerToReceiveAudio<"u"&&(r.offerToReceiveAudio=!!r.offerToReceiveAudio);const i=this.getTransceivers().find(a=>a.receiver.track.kind==="audio");r.offerToReceiveAudio===!1&&i?i.direction==="sendrecv"?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":i.direction==="recvonly"&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):r.offerToReceiveAudio===!0&&!i&&this.addTransceiver("audio",{direction:"recvonly"}),typeof r.offerToReceiveVideo<"u"&&(r.offerToReceiveVideo=!!r.offerToReceiveVideo);const s=this.getTransceivers().find(a=>a.receiver.track.kind==="video");r.offerToReceiveVideo===!1&&s?s.direction==="sendrecv"?s.setDirection?s.setDirection("sendonly"):s.direction="sendonly":s.direction==="recvonly"&&(s.setDirection?s.setDirection("inactive"):s.direction="inactive"):r.offerToReceiveVideo===!0&&!s&&this.addTransceiver("video",{direction:"recvonly"})}return e.apply(this,arguments)}}function Xte(t){typeof t!="object"||t.AudioContext||(t.AudioContext=t.webkitAudioContext)}var $7=Object.freeze({__proto__:null,shimAudioContext:Xte,shimCallbacksAPI:Wte,shimConstraints:Hte,shimCreateOfferLegacy:Yte,shimGetUserMedia:Gte,shimLocalStreamsAPI:Vte,shimRTCIceServerUrls:Kte,shimRemoteStreamsAPI:qte,shimTrackEventTransceiver:Jte}),GE={exports:{}},V7;function t8e(){return V7||(V7=1,function(t){const e={};e.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},e.localCName=e.generateIdentifier(),e.splitLines=function(n){return n.trim().split(` 754`).map(r=>r.trim())},e.splitSections=function(n){return n.split(` 755m=`).map((i,s)=>(s>0?"m="+i:i).trim()+`\r 756`)},e.getDescription=function(n){const r=e.splitSections(n);return r&&r[0]},e.getMediaSections=function(n){const r=e.splitSections(n);return r.shift(),r},e.matchPrefix=function(n,r){return e.splitLines(n).filter(i=>i.indexOf(r)===0)},e.parseCandidate=function(n){let r;n.indexOf("a=candidate:")===0?r=n.substring(12).split(" "):r=n.substring(10).split(" ");const i={foundation:r[0],component:{1:"rtp",2:"rtcp"}[r[1]]||r[1],protocol:r[2].toLowerCase(),priority:parseInt(r[3],10),ip:r[4],address:r[4],port:parseInt(r[5],10),type:r[7]};for(let s=8;s<r.length;s+=2)switch(r[s]){case"raddr":i.relatedAddress=r[s+1];break;case"rport":i.relatedPort=parseInt(r[s+1],10);break;case"tcptype":i.tcpType=r[s+1];break;case"ufrag":i.ufrag=r[s+1],i.usernameFragment=r[s+1];break;default:i[r[s]]===void 0&&(i[r[s]]=r[s+1]);break}return i},e.writeCandidate=function(n){const r=[];r.push(n.foundation);const i=n.component;i==="rtp"?r.push(1):i==="rtcp"?r.push(2):r.push(i),r.push(n.protocol.toUpperCase()),r.push(n.priority),r.push(n.address||n.ip),r.push(n.port);const s=n.type;return r.push("typ"),r.push(s),s!=="host"&&n.relatedAddress&&n.relatedPort!==void 0&&(r.push("raddr"),r.push(n.relatedAddress),r.push("rport"),r.push(n.relatedPort)),n.tcpType&&n.protocol.toLowerCase()==="tcp"&&(r.push("tcptype"),r.push(n.tcpType)),(n.usernameFragment||n.ufrag)&&(r.push("ufrag"),r.push(n.usernameFragment||n.ufrag)),"candidate:"+r.join(" ")},e.parseIceOptions=function(n){return n.substring(14).split(" ")},e.parseRtpMap=function(n){let r=n.substring(9).split(" ");const i={payloadType:parseInt(r.shift(),10)};return r=r[0].split("/"),i.name=r[0],i.clockRate=parseInt(r[1],10),i.channels=r.length===3?parseInt(r[2],10):1,i.numChannels=i.channels,i},e.writeRtpMap=function(n){let r=n.payloadType;n.preferredPayloadType!==void 0&&(r=n.preferredPayloadType);const i=n.channels||n.numChannels||1;return"a=rtpmap:"+r+" "+n.name+"/"+n.clockRate+(i!==1?"/"+i:"")+`\r 757`},e.parseExtmap=function(n){const r=n.substring(9).split(" ");return{id:parseInt(r[0],10),direction:r[0].indexOf("/")>0?r[0].split("/")[1]:"sendrecv",uri:r[1],attributes:r.slice(2).join(" ")}},e.writeExtmap=function(n){return"a=extmap:"+(n.id||n.preferredId)+(n.direction&&n.direction!=="sendrecv"?"/"+n.direction:"")+" "+n.uri+(n.attributes?" "+n.attributes:"")+`\r 758`},e.parseFmtp=function(n){const r={};let i;const s=n.substring(n.indexOf(" ")+1).split(";");for(let a=0;a<s.length;a++)i=s[a].trim().split("="),r[i[0].trim()]=i[1];return r},e.writeFmtp=function(n){let r="",i=n.payloadType;if(n.preferredPayloadType!==void 0&&(i=n.preferredPayloadType),n.parameters&&Object.keys(n.parameters).length){const s=[];Object.keys(n.parameters).forEach(a=>{n.parameters[a]!==void 0?s.push(a+"="+n.parameters[a]):s.push(a)}),r+="a=fmtp:"+i+" "+s.join(";")+`\r 759`}return r},e.parseRtcpFb=function(n){const r=n.substring(n.indexOf(" ")+1).split(" ");return{type:r.shift(),parameter:r.join(" ")}},e.writeRtcpFb=function(n){let r="",i=n.payloadType;return n.preferredPayloadType!==void 0&&(i=n.preferredPayloadType),n.rtcpFeedback&&n.rtcpFeedback.length&&n.rtcpFeedback.forEach(s=>{r+="a=rtcp-fb:"+i+" "+s.type+(s.parameter&&s.parameter.length?" "+s.parameter:"")+`\r 760`}),r},e.parseSsrcMedia=function(n){const r=n.indexOf(" "),i={ssrc:parseInt(n.substring(7,r),10)},s=n.indexOf(":",r);return s>-1?(i.attribute=n.substring(r+1,s),i.value=n.substring(s+1)):i.attribute=n.substring(r+1),i},e.parseSsrcGroup=function(n){const r=n.substring(13).split(" ");return{semantics:r.shift(),ssrcs:r.map(i=>parseInt(i,10))}},e.getMid=function(n){const r=e.matchPrefix(n,"a=mid:")[0];if(r)return r.substring(6)},e.parseFingerprint=function(n){const r=n.substring(14).split(" ");return{algorithm:r[0].toLowerCase(),value:r[1].toUpperCase()}},e.getDtlsParameters=function(n,r){return{role:"auto",fingerprints:e.matchPrefix(n+r,"a=fingerprint:").map(e.parseFingerprint)}},e.writeDtlsParameters=function(n,r){let i="a=setup:"+r+`\r 761`;return n.fingerprints.forEach(s=>{i+="a=fingerprint:"+s.algorithm+" "+s.value+`\r 762`}),i},e.parseCryptoLine=function(n){const r=n.substring(9).split(" ");return{tag:parseInt(r[0],10),cryptoSuite:r[1],keyParams:r[2],sessionParams:r.slice(3)}},e.writeCryptoLine=function(n){return"a=crypto:"+n.tag+" "+n.cryptoSuite+" "+(typeof n.keyParams=="object"?e.writeCryptoKeyParams(n.keyParams):n.keyParams)+(n.sessionParams?" "+n.sessionParams.join(" "):"")+`\r 763`},e.parseCryptoKeyParams=function(n){if(n.indexOf("inline:")!==0)return null;const r=n.substring(7).split("|");return{keyMethod:"inline",keySalt:r[0],lifeTime:r[1],mkiValue:r[2]?r[2].split(":")[0]:void 0,mkiLength:r[2]?r[2].split(":")[1]:void 0}},e.writeCryptoKeyParams=function(n){return n.keyMethod+":"+n.keySalt+(n.lifeTime?"|"+n.lifeTime:"")+(n.mkiValue&&n.mkiLength?"|"+n.mkiValue+":"+n.mkiLength:"")},e.getCryptoParameters=function(n,r){return e.matchPrefix(n+r,"a=crypto:").map(e.parseCryptoLine)},e.getIceParameters=function(n,r){const i=e.matchPrefix(n+r,"a=ice-ufrag:")[0],s=e.matchPrefix(n+r,"a=ice-pwd:")[0];return i&&s?{usernameFragment:i.substring(12),password:s.substring(10)}:null},e.writeIceParameters=function(n){let r="a=ice-ufrag:"+n.usernameFragment+`\r 764a=ice-pwd:`+n.password+`\r 765`;return n.iceLite&&(r+=`a=ice-lite\r 766`),r},e.parseRtpParameters=function(n){const r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},s=e.splitLines(n)[0].split(" ");r.profile=s[2];for(let o=3;o<s.length;o++){const l=s[o],c=e.matchPrefix(n,"a=rtpmap:"+l+" ")[0];if(c){const u=e.parseRtpMap(c),d=e.matchPrefix(n,"a=fmtp:"+l+" ");switch(u.parameters=d.length?e.parseFmtp(d[0]):{},u.rtcpFeedback=e.matchPrefix(n,"a=rtcp-fb:"+l+" ").map(e.parseRtcpFb),r.codecs.push(u),u.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(u.name.toUpperCase());break}}}e.matchPrefix(n,"a=extmap:").forEach(o=>{r.headerExtensions.push(e.parseExtmap(o))});const a=e.matchPrefix(n,"a=rtcp-fb:* ").map(e.parseRtcpFb);return r.codecs.forEach(o=>{a.forEach(l=>{o.rtcpFeedback.find(u=>u.type===l.type&&u.parameter===l.parameter)||o.rtcpFeedback.push(l)})}),r},e.writeRtpDescription=function(n,r){let i="";i+="m="+n+" ",i+=r.codecs.length>0?"9":"0",i+=" "+(r.profile||"UDP/TLS/RTP/SAVPF")+" ",i+=r.codecs.map(a=>a.preferredPayloadType!==void 0?a.preferredPayloadType:a.payloadType).join(" ")+`\r 767`,i+=`c=IN IP4 0.0.0.0\r 768`,i+=`a=rtcp:9 IN IP4 0.0.0.0\r 769`,r.codecs.forEach(a=>{i+=e.writeRtpMap(a),i+=e.writeFmtp(a),i+=e.writeRtcpFb(a)});let s=0;return r.codecs.forEach(a=>{a.maxptime>s&&(s=a.maxptime)}),s>0&&(i+="a=maxptime:"+s+`\r 770`),r.headerExtensions&&r.headerExtensions.forEach(a=>{i+=e.writeExtmap(a)}),i},e.parseRtpEncodingParameters=function(n){const r=[],i=e.parseRtpParameters(n),s=i.fecMechanisms.indexOf("RED")!==-1,a=i.fecMechanisms.indexOf("ULPFEC")!==-1,o=e.matchPrefix(n,"a=ssrc:").map(f=>e.parseSsrcMedia(f)).filter(f=>f.attribute==="cname"),l=o.length>0&&o[0].ssrc;let c;const u=e.matchPrefix(n,"a=ssrc-group:FID").map(f=>f.substring(17).split(" ").map(p=>parseInt(p,10)));u.length>0&&u[0].length>1&&u[0][0]===l&&(c=u[0][1]),i.codecs.forEach(f=>{if(f.name.toUpperCase()==="RTX"&&f.parameters.apt){let h={ssrc:l,codecPayloadType:parseInt(f.parameters.apt,10)};l&&c&&(h.rtx={ssrc:c}),r.push(h),s&&(h=JSON.parse(JSON.stringify(h)),h.fec={ssrc:l,mechanism:a?"red+ulpfec":"red"},r.push(h))}}),r.length===0&&l&&r.push({ssrc:l});let d=e.matchPrefix(n,"b=");return d.length&&(d[0].indexOf("b=TIAS:")===0?d=parseInt(d[0].substring(7),10):d[0].indexOf("b=AS:")===0?d=parseInt(d[0].substring(5),10)*1e3*.95-50*40*8:d=void 0,r.forEach(f=>{f.maxBitrate=d})),r},e.parseRtcpParameters=function(n){const r={},i=e.matchPrefix(n,"a=ssrc:").map(o=>e.parseSsrcMedia(o)).filter(o=>o.attribute==="cname")[0];i&&(r.cname=i.value,r.ssrc=i.ssrc);const s=e.matchPrefix(n,"a=rtcp-rsize");r.reducedSize=s.length>0,r.compound=s.length===0;const a=e.matchPrefix(n,"a=rtcp-mux");return r.mux=a.length>0,r},e.writeRtcpParameters=function(n){let r="";return n.reducedSize&&(r+=`a=rtcp-rsize\r 771`),n.mux&&(r+=`a=rtcp-mux\r 772`),n.ssrc!==void 0&&n.cname&&(r+="a=ssrc:"+n.ssrc+" cname:"+n.cname+`\r 773`),r},e.parseMsid=function(n){let r;const i=e.matchPrefix(n,"a=msid:");if(i.length===1)return r=i[0].substring(7).split(" "),{stream:r[0],track:r[1]};const s=e.matchPrefix(n,"a=ssrc:").map(a=>e.parseSsrcMedia(a)).filter(a=>a.attribute==="msid");if(s.length>0)return r=s[0].value.split(" "),{stream:r[0],track:r[1]}},e.parseSctpDescription=function(n){const r=e.parseMLine(n),i=e.matchPrefix(n,"a=max-message-size:");let s;i.length>0&&(s=parseInt(i[0].substring(19),10)),isNaN(s)&&(s=65536);const a=e.matchPrefix(n,"a=sctp-port:");if(a.length>0)return{port:parseInt(a[0].substring(12),10),protocol:r.fmt,maxMessageSize:s};const o=e.matchPrefix(n,"a=sctpmap:");if(o.length>0){const l=o[0].substring(10).split(" ");return{port:parseInt(l[0],10),protocol:l[1],maxMessageSize:s}}},e.writeSctpDescription=function(n,r){let i=[];return n.protocol!=="DTLS/SCTP"?i=["m="+n.kind+" 9 "+n.protocol+" "+r.protocol+`\r 774`,`c=IN IP4 0.0.0.0\r 775`,"a=sctp-port:"+r.port+`\r 776`]:i=["m="+n.kind+" 9 "+n.protocol+" "+r.port+`\r 777`,`c=IN IP4 0.0.0.0\r 778`,"a=sctpmap:"+r.port+" "+r.protocol+` 65535\r 779`],r.maxMessageSize!==void 0&&i.push("a=max-message-size:"+r.maxMessageSize+`\r 780`),i.join("")},e.generateSessionId=function(){return Math.random().toString().substr(2,22)},e.writeSessionBoilerplate=function(n,r,i){let s;const a=r!==void 0?r:2;return n?s=n:s=e.generateSessionId(),`v=0\r 781o=`+(i||"thisisadapterortc")+" "+s+" "+a+` IN IP4 127.0.0.1\r 782s=-\r 783t=0 0\r 784`},e.getDirection=function(n,r){const i=e.splitLines(n);for(let s=0;s<i.length;s++)switch(i[s]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[s].substring(2)}return r?e.getDirection(r):"sendrecv"},e.getKind=function(n){return e.splitLines(n)[0].split(" ")[0].substring(2)},e.isRejected=function(n){return n.split(" ",2)[1]==="0"},e.parseMLine=function(n){const i=e.splitLines(n)[0].substring(2).split(" ");return{kind:i[0],port:parseInt(i[1],10),protocol:i[2],fmt:i.slice(3).join(" ")}},e.parseOLine=function(n){const i=e.matchPrefix(n,"o=")[0].substring(2).split(" ");return{username:i[0],sessionId:i[1],sessionVersion:parseInt(i[2],10),netType:i[3],addressType:i[4],address:i[5]}},e.isValidSDP=function(n){if(typeof n!="string"||n.length===0)return!1;const r=e.splitLines(n);for(let i=0;i<r.length;i++)if(r[i].length<2||r[i].charAt(1)!=="=")return!1;return!0},t.exports=e}(GE)),GE.exports}var Qte=t8e(),uv=Uje(Qte),n8e=s6e({__proto__:null,default:uv},[Qte]);function Ux(t){if(!t.RTCIceCandidate||t.RTCIceCandidate&&"foundation"in t.RTCIceCandidate.prototype)return;const e=t.RTCIceCandidate;t.RTCIceCandidate=function(r){if(typeof r=="object"&&r.candidate&&r.candidate.indexOf("a=")===0&&(r=JSON.parse(JSON.stringify(r)),r.candidate=r.candidate.substring(2)),r.candidate&&r.candidate.length){const i=new e(r),s=uv.parseCandidate(r.candidate);for(const a in s)a in i||Object.defineProperty(i,a,{value:s[a]});return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new e(r)},t.RTCIceCandidate.prototype=e.prototype,om(t,"icecandidate",n=>(n.candidate&&Object.defineProperty(n,"candidate",{value:new t.RTCIceCandidate(n.candidate),writable:"false"}),n))}function VN(t){!t.RTCIceCandidate||t.RTCIceCandidate&&"relayProtocol"in t.RTCIceCandidate.prototype||om(t,"icecandidate",e=>{if(e.candidate){const n=uv.parseCandidate(e.candidate.candidate);n.type==="relay"&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[n.priority>>24])}return e})}function zx(t,e){if(!t.RTCPeerConnection)return;"sctp"in t.RTCPeerConnection.prototype||Object.defineProperty(t.RTCPeerConnection.prototype,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp}});const n=function(o){if(!o||!o.sdp)return!1;const l=uv.splitSections(o.sdp);return l.shift(),l.some(c=>{const u=uv.parseMLine(c);return u&&u.kind==="application"&&u.protocol.indexOf("SCTP")!==-1})},r=function(o){const l=o.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(l===null||l.length<2)return-1;const c=parseInt(l[1],10);return c!==c?-1:c},i=function(o){let l=65536;return e.browser==="firefox"&&(e.version<57?o===-1?l=16384:l=2147483637:e.version<60?l=e.version===57?65535:65536:l=2147483637),l},s=function(o,l){let c=65536;e.browser==="firefox"&&e.version===57&&(c=65535);const u=uv.matchPrefix(o.sdp,"a=max-message-size:");return u.length>0?c=parseInt(u[0].substring(19),10):e.browser==="firefox"&&l!==-1&&(c=2147483637),c},a=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,e.browser==="chrome"&&e.version>=76){const{sdpSemantics:l}=this.getConfiguration();l==="plan-b"&&Object.defineProperty(this,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp},enumerable:!0,configurable:!0})}if(n(arguments[0])){const l=r(arguments[0]),c=i(l),u=s(arguments[0],l);let d;c===0&&u===0?d=Number.POSITIVE_INFINITY:c===0||u===0?d=Math.max(c,u):d=Math.min(c,u);const f={};Object.defineProperty(f,"maxMessageSize",{get(){return d}}),this._sctp=f}return a.apply(this,arguments)}}function $x(t,e){if(!(t.RTCPeerConnection&&"createDataChannel"in t.RTCPeerConnection.prototype)||e.browser==="chrome"&&e.version>149||e.browser==="firefox"&&e.version>60)return;function n(i,s){const a=i.send;i.send=function(){const l=arguments[0],c=l.length||l.size||l.byteLength;if(i.readyState==="open"&&s.sctp&&c>s.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+s.sctp.maxMessageSize+" bytes)");return a.apply(i,arguments)}}const r=t.RTCPeerConnection.prototype.createDataChannel;t.RTCPeerConnection.prototype.createDataChannel=function(){const s=r.apply(this,arguments);return n(s,this),s},om(t,"datachannel",i=>(n(i.channel,i.target),i))}function qN(t){if(!t.RTCPeerConnection||"connectionState"in t.RTCPeerConnection.prototype)return;const e=t.RTCPeerConnection.prototype;Object.defineProperty(e,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(e,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(n){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),n&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=n)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(n=>{const r=e[n];e[n]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=i=>{const s=i.target;if(s._lastConnectionState!==s.connectionState){s._lastConnectionState=s.connectionState;const a=new Event("connectionstatechange",i);s.dispatchEvent(a)}return i},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}})}function WN(t,e){if(!t.RTCPeerConnection||e.browser==="chrome"&&e.version>=71||e.browser==="safari"&&e._safariVersion>=13.1)return;const n=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(i){if(i&&i.sdp&&i.sdp.indexOf(` 785a=extmap-allow-mixed`)!==-1){const s=i.sdp.split(` 786`).filter(a=>a.trim()!=="a=extmap-allow-mixed").join(` 787`);t.RTCSessionDescription&&i instanceof t.RTCSessionDescription?arguments[0]=new t.RTCSessionDescription({type:i.type,sdp:s}):i.sdp=s}return n.apply(this,arguments)}}function Vx(t,e){if(!(t.RTCPeerConnection&&t.RTCPeerConnection.prototype))return;const n=t.RTCPeerConnection.prototype.addIceCandidate;!n||n.length===0||(t.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(e.browser==="chrome"&&e.version<78||e.browser==="firefox"&&e.version<68||e.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function qx(t,e){if(!(t.RTCPeerConnection&&t.RTCPeerConnection.prototype))return;const n=t.RTCPeerConnection.prototype.setLocalDescription;!n||n.length===0||(t.RTCPeerConnection.prototype.setLocalDescription=function(){let i=arguments[0]||{};if(typeof i!="object"||i.type&&i.sdp)return n.apply(this,arguments);if(i={type:i.type,sdp:i.sdp},!i.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":i.type="offer";break;default:i.type="answer";break}return i.sdp||i.type!=="offer"&&i.type!=="answer"?n.apply(this,[i]):(i.type==="offer"?this.createOffer:this.createAnswer).apply(this).then(a=>n.apply(this,[a]))})}var r8e=Object.freeze({__proto__:null,removeExtmapAllowMixed:WN,shimAddIceCandidateNullOrEmpty:Vx,shimConnectionState:qN,shimMaxMessageSize:zx,shimParameterlessSetLocalDescription:qx,shimRTCIceCandidate:Ux,shimRTCIceCandidateRelayProtocol:VN,shimSendThrowTypeError:$x});function i8e(){let{window:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0};const n=LO,r=Zje(t),i={browserDetails:r,commonShim:r8e,extractVersion:o_,disableLog:Xje,disableWarnings:Qje,sdp:n8e};switch(r.browser){case"chrome":if(!U7||!zN||!e.shimChrome)return n("Chrome shim is not included in this adapter release."),i;if(r.version===null)return n("Chrome shim can not determine version, not shimming."),i;n("adapter.js shimming chrome."),i.browserShim=U7,Vx(t,r),qx(t),Ste(t,r),Tte(t),zN(t,r),Cte(t,r),Mte(t,r),Ete(t),Ate(t,r),Nte(t,r),Ux(t),VN(t),qN(t),zx(t,r),$x(t,r),WN(t,r);break;case"firefox":if(!z7||!$N||!e.shimFirefox)return n("Firefox shim is not included in this adapter release."),i;n("adapter.js shimming firefox."),i.browserShim=z7,Vx(t,r),qx(t),Rte(t,r),$N(t,r),Lte(t,r),Ite(t),Fte(t),Ote(t),Dte(t),jte(t),Bte(t),Ute(t),zte(t),$te(t),Ux(t),qN(t),zx(t,r),$x(t,r);break;case"safari":if(!$7||!e.shimSafari)return n("Safari shim is not included in this adapter release."),i;n("adapter.js shimming safari."),i.browserShim=$7,Vx(t,r),qx(t),Kte(t),Yte(t),Wte(t),Vte(t),qte(t),Jte(t),Gte(t),Xte(t),Ux(t),VN(t),zx(t,r),$x(t,r),WN(t,r);break;default:n("Unsupported browser!");break}return i}i8e({window:typeof window>"u"?void 0:window});var GN,Zte;class Xs extends(Zte=Promise){constructor(e){super(e)}catch(e){return super.catch(e)}static reject(e){return super.reject(e)}static all(e){return super.all(e)}static race(e){return super.race(e)}}GN=Xs;Xs.resolve=t=>Reflect.get(Zte,"resolve",GN).call(GN,t);const s8e=/version\/(\d+(\.?_?\d+)+)/i;let HE;function Ca(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(typeof navigator>"u")return;const n=navigator.userAgent.toLowerCase();if(HE===void 0||e){const r=a8e.find(i=>{let{test:s}=i;return s.test(n)});HE=r==null?void 0:r.describe(n)}return HE}const a8e=[{test:/firefox|iceweasel|fxios/i,describe(t){return{name:"Firefox",version:Wx(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t),os:t.toLowerCase().includes("fxios")?"iOS":void 0,osVersion:KE(t)}}},{test:/chrom|crios|crmo/i,describe(t){return{name:"Chrome",version:Wx(/(?:chrome|chromium|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t),os:t.toLowerCase().includes("crios")?"iOS":void 0,osVersion:KE(t)}}},{test:/safari|applewebkit/i,describe(t){return{name:"Safari",version:Wx(s8e,t),os:t.includes("mobile/")?"iOS":"macOS",osVersion:KE(t)}}}];function Wx(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;const r=e.match(t);return r&&r.length>=n&&r[n]||""}function KE(t){return t.includes("mac os")?Wx(/\(.+?(\d+_\d+(:?_\d+)?)/,t,1).replace(/_/g,"."):void 0}var o8e="2.18.8";const l8e=o8e,c8e=16;
787class ff extends Error{constructor(e,n,r){super(n||"an error has occurred"),this.name="LiveKitError",this.code=e,typeof(r==null?void 0:r.cause)<"u"&&(this.cause=r==null?void 0:r.cause)}}class ol extends ff{}var vr;(function(t){t[t.NotAllowed=0]="NotAllowed",t[t.ServerUnreachable=1]="ServerUnreachable",t[t.InternalError=2]="InternalError",t[t.Cancelled=3]="Cancelled",t[t.LeaveRequest=4]="LeaveRequest",t[t.Timeout=5]="Timeout",t[t.WebSocket=6]="WebSocket",t[t.ServiceNotFound=7]="ServiceNotFound"})(vr||(vr={}));class Ot extends ol{constructor(e,n,r,i){super(1,e),this.name="ConnectionError",this.status=r,this.reason=n,this.context=i,this.reasonName=vr[n]}static notAllowed(e,n,r){return new Ot(e,vr.NotAllowed,n,r)}static timeout(e){return new Ot(e,vr.Timeout)}static leaveRequest(e,n){return new Ot(e,vr.LeaveRequest,void 0,n)}static internal(e,n){return new Ot(e,vr.InternalError,void 0,n)}static cancelled(e){return new Ot(e,vr.Cancelled)}static serverUnreachable(e,n){return new Ot(e,vr.ServerUnreachable,n)}static websocket(e,n,r){return new Ot(e,vr.WebSocket,n,r)}static serviceNotFound(e,n){return new Ot(e,vr.ServiceNotFound,void 0,n)}}class DO extends ff{constructor(e){super(21,e??"device is unsupported"),this.name="DeviceUnsupportedError"}}class td extends ff{constructor(e){super(20,e??"track is invalid"),this.name="TrackInvalidError"}}class u8e extends ff{constructor(e){super(10,e??"unsupported server"),this.name="UnsupportedServer"}}class Yr extends ff{constructor(e){super(12,e??"unexpected connection state"),this.name="UnexpectedConnectionState"}}class Rp extends ff{constructor(e){super(13,e??"unable to negotiate"),this.name="NegotiationError"}}class q7 extends ff{constructor(e,n){super(15,e),this.name="PublishTrackError",this.status=n}}class W7 extends ol{constructor(e,n){super(15,e),this.name="SignalRequestError",this.reason=n,this.reasonName=typeof n=="string"?n:rp[n]}}var va;(function(t){t[t.AlreadyOpened=0]="AlreadyOpened",t[t.AbnormalEnd=1]="AbnormalEnd",t[t.DecodeFailed=2]="DecodeFailed",t[t.LengthExceeded=3]="LengthExceeded",t[t.Incomplete=4]="Incomplete",t[t.HandlerAlreadyRegistered=7]="HandlerAlreadyRegistered",t[t.EncryptionTypeMismatch=8]="EncryptionTypeMismatch"})(va||(va={}));class Wo extends ol{constructor(e,n){super(16,e),this.name="DataStreamError",this.reason=n,this.reasonName=va[n]}}class lg extends ff{constructor(e){super(18,e),this.name="SignalReconnectError"}}var bS;(function(t){t.PermissionDenied="PermissionDenied",t.NotFound="NotFound",t.DeviceInUse="DeviceInUse",t.Other="Other"})(bS||(bS={}));(function(t){function e(n){if(n&&"name"in n)return n.name==="NotFoundError"||n.name==="DevicesNotFoundError"?t.NotFound:n.name==="NotAllowedError"||n.name==="PermissionDeniedError"?t.PermissionDenied:n.name==="NotReadableError"||n.name==="TrackStartError"?t.DeviceInUse:t.Other}t.getFailure=e})(bS||(bS={}));class Fi{}Fi.setTimeout=function(){return setTimeout(...arguments)};Fi.setInterval=function(){return setInterval(...arguments)};Fi.clearTimeout=function(){return clearTimeout(...arguments)};Fi.clearInterval=function(){return clearInterval(...arguments)};var Ve;(function(t){t.Connected="connected",t.Reconnecting="reconnecting",t.SignalReconnecting="signalReconnecting",t.Reconnected="reconnected",t.Disconnected="disconnected",t.ConnectionStateChanged="connectionStateChanged",t.Moved="moved",t.MediaDevicesChanged="mediaDevicesChanged",t.ParticipantConnected="participantConnected",t.ParticipantDisconnected="participantDisconnected",t.TrackPublished="trackPublished",t.TrackSubscribed="trackSubscribed",t.TrackSubscriptionFailed="trackSubscriptionFailed",t.TrackUnpublished="trackUnpublished",t.TrackUnsubscribed="trackUnsubscribed",t.TrackMuted="trackMuted",t.TrackUnmuted="trackUnmuted",t.LocalTrackPublished="localTrackPublished",t.LocalTrackUnpublished="localTrackUnpublished",t.LocalAudioSilenceDetected="localAudioSilenceDetected",t.ActiveSpeakersChanged="activeSpeakersChanged",t.ParticipantMetadataChanged="participantMetadataChanged",t.ParticipantNameChanged="participantNameChanged",t.ParticipantAttributesChanged="participantAttributesChanged",t.ParticipantActive="participantActive",t.RoomMetadataChanged="roomMetadataChanged",t.DataReceived="dataReceived",t.SipDTMFReceived="sipDTMFReceived",t.TranscriptionReceived="transcriptionReceived",t.ConnectionQualityChanged="connectionQualityChanged",t.TrackStreamStateChanged="trackStreamStateChanged",t.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",t.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",t.AudioPlaybackStatusChanged="audioPlaybackChanged",t.VideoPlaybackStatusChanged="videoPlaybackChanged",t.MediaDevicesError="mediaDevicesError",t.ParticipantPermissionsChanged="participantPermissionsChanged",t.SignalConnected="signalConnected",t.RecordingStatusChanged="recordingStatusChanged",t.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",t.EncryptionError="encryptionError",t.DCBufferStatusChanged="dcBufferStatusChanged",t.ActiveDeviceChanged="activeDeviceChanged",t.ChatMessage="chatMessage",t.LocalTrackSubscribed="localTrackSubscribed",t.MetricsReceived="metricsReceived",t.DataTrackPublished="dataTrackPublished",t.DataTrackUnpublished="dataTrackUnpublished",t.LocalDataTrackPublished="localDataTrackPublished",t.LocalDataTrackUnpublished="localDataTrackUnpublished"})(Ve||(Ve={}));var tt;(function(t){t.TrackPublished="trackPublished",t.TrackSubscribed="trackSubscribed",t.TrackSubscriptionFailed="trackSubscriptionFailed",t.TrackUnpublished="trackUnpublished",t.TrackUnsubscribed="trackUnsubscribed",t.TrackMuted="trackMuted",t.TrackUnmuted="trackUnmuted",t.LocalTrackPublished="localTrackPublished",t.LocalTrackUnpublished="localTrackUnpublished",t.LocalTrackCpuConstrained="localTrackCpuConstrained",t.LocalSenderCreated="localSenderCreated",t.ParticipantMetadataChanged="participantMetadataChanged",t.ParticipantNameChanged="participantNameChanged",t.DataReceived="dataReceived",t.SipDTMFReceived="sipDTMFReceived",t.TranscriptionReceived="transcriptionReceived",t.IsSpeakingChanged="isSpeakingChanged",t.ConnectionQualityChanged="connectionQualityChanged",t.TrackStreamStateChanged="trackStreamStateChanged",t.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",t.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",t.TrackCpuConstrained="trackCpuConstrained",t.MediaDevicesError="mediaDevicesError",t.AudioStreamAcquired="audioStreamAcquired",t.ParticipantPermissionsChanged="participantPermissionsChanged",t.PCTrackAdded="pcTrackAdded",t.AttributesChanged="attributesChanged",t.LocalTrackSubscribed="localTrackSubscribed",t.ChatMessage="chatMessage",t.Active="active"})(tt||(tt={}));var We;(function(t){t.TransportsCreated="transportsCreated",t.Connected="connected",t.Disconnected="disconnected",t.Resuming="resuming",t.Resumed="resumed",t.Restarting="restarting",t.Restarted="restarted",t.SignalResumed="signalResumed",t.SignalRestarted="signalRestarted",t.Closing="closing",t.MediaTrackAdded="mediaTrackAdded",t.ActiveSpeakersUpdate="activeSpeakersUpdate",t.DataPacketReceived="dataPacketReceived",t.RTPVideoMapUpdate="rtpVideoMapUpdate",t.DCBufferStatusChanged="dcBufferStatusChanged",t.ParticipantUpdate="participantUpdate",t.RoomUpdate="roomUpdate",t.SpeakersChanged="speakersChanged",t.StreamStateChanged="streamStateChanged",t.ConnectionQualityUpdate="connectionQualityUpdate",t.SubscriptionError="subscriptionError",t.SubscriptionPermissionUpdate="subscriptionPermissionUpdate",t.RemoteMute="remoteMute",t.SubscribedQualityUpdate="subscribedQualityUpdate",t.LocalTrackUnpublished="localTrackUnpublished",t.LocalTrackSubscribed="localTrackSubscribed",t.Offline="offline",t.SignalRequestResponse="signalRequestResponse",t.SignalConnected="signalConnected",t.RoomMoved="roomMoved",t.PublishDataTrackResponse="publishDataTrackResponse",t.UnPublishDataTrackResponse="unPublishDataTrackResponse",t.DataTrackSubscriberHandles="dataTrackSubscriberHandles",t.DataTrackPacketReceived="dataTrackPacketReceived",t.Joined="joined",t.TokenRefreshed="tokenRefreshed",t.ServerRegionsReported="serverRegionsReported"})(We||(We={}));var Qe;(function(t){t.Message="message",t.Muted="muted",t.Unmuted="unmuted",t.Restarted="restarted",t.Ended="ended",t.Subscribed="subscribed",t.Unsubscribed="unsubscribed",t.CpuConstrained="cpuConstrained",t.UpdateSettings="updateSettings",t.UpdateSubscription="updateSubscription",t.AudioPlaybackStarted="audioPlaybackStarted",t.AudioPlaybackFailed="audioPlaybackFailed",t.AudioSilenceDetected="audioSilenceDetected",t.VisibilityChanged="visibilityChanged",t.VideoDimensionsChanged="videoDimensionsChanged",t.VideoPlaybackStarted="videoPlaybackStarted",t.VideoPlaybackFailed="videoPlaybackFailed",t.ElementAttached="elementAttached",t.ElementDetached="elementDetached",t.UpstreamPaused="upstreamPaused",t.UpstreamResumed="upstreamResumed",t.SubscriptionPermissionChanged="subscriptionPermissionChanged",t.SubscriptionStatusChanged="subscriptionStatusChanged",t.SubscriptionFailed="subscriptionFailed",t.TrackProcessorUpdate="trackProcessorUpdate",t.AudioTrackFeatureUpdate="audioTrackFeatureUpdate",t.TranscriptionReceived="transcriptionReceived",t.TimeSyncUpdate="timeSyncUpdate",t.PreConnectBufferFlushed="preConnectBufferFlushed"})(Qe||(Qe={}));function d8e(t){return typeof t>"u"?t:typeof structuredClone=="function"?typeof t=="object"&&t!==null?structuredClone(Object.assign({},t)):structuredClone(t):JSON.parse(JSON.stringify(t))}class ur{constructor(e,n,r,i,s){if(typeof e=="object")this.width=e.width,this.height=e.height,this.aspectRatio=e.aspectRatio,this.encoding={maxBitrate:e.maxBitrate,maxFramerate:e.maxFramerate,priority:e.priority};else if(n!==void 0&&r!==void 0)this.width=e,this.height=n,this.aspectRatio=e/n,this.encoding={maxBitrate:r,maxFramerate:i,priority:s};else throw new TypeError("Unsupported options: provide at least width, height and maxBitrate")}get resolution(){return{width:this.width,height:this.height,frameRate:this.encoding.maxFramerate,aspectRatio:this.aspectRatio}}}const h8e=["vp8","h264"],f8e=["vp8","h264","vp9","av1","h265"];function ene(t){return!!h8e.find(e=>e===t)}const p8e=ene;var G7;(function(t){t[t.PREFER_REGRESSION=0]="PREFER_REGRESSION",t[t.SIMULCAST=1]="SIMULCAST",t[t.REGRESSION=2]="REGRESSION"})(G7||(G7={}));var HN;(function(t){t.telephone={maxBitrate:12e3}
vendor: 9,100 bytes, line 787
787,t.speech={maxBitrate:24e3},t.music={maxBitrate:48e3},t.musicStereo={maxBitrate:64e3},t.musicHighQuality={maxBitrate:96e3},t.musicHighQualityStereo={maxBitrate:128e3}})(HN||(HN={}));const zw={h90:new ur(160,90,9e4,20),h180:new ur(320,180,16e4,20),h216:new ur(384,216,18e4,20),h360:new ur(640,360,45e4,20),h540:new ur(960,540,8e5,25),h720:new ur(1280,720,17e5,30),h1080:new ur(1920,1080,3e6,30),h1440:new ur(2560,1440,5e6,30),h2160:new ur(3840,2160,8e6,30)},KN={h120:new ur(160,120,7e4,20),h180:new ur(240,180,125e3,20),h240:new ur(320,240,14e4,20),h360:new ur(480,360,33e4,20),h480:new ur(640,480,5e5,20),h540:new ur(720,540,6e5,25),h720:new ur(960,720,13e5,30),h1080:new ur(1440,1080,23e5,30),h1440:new ur(1920,1440,38e5,30)},FO={h360fps3:new ur(640,360,2e5,3,"medium"),h360fps15:new ur(640,360,4e5,15,"medium"),h720fps5:new ur(1280,720,8e5,5,"medium"),h720fps15:new ur(1280,720,15e5,15,"medium"),h720fps30:new ur(1280,720,2e6,30,"medium"),h1080fps15:new ur(1920,1080,25e5,15,"medium"),h1080fps30:new ur(1920,1080,5e6,30,"medium"),original:new ur(0,0,7e6,30,"medium")};function tne(t,e,n){var r,i,s,a;const{optionsWithoutProcessor:o,audioProcessor:l,videoProcessor:c}=ine(t??{}),u=e==null?void 0:e.processor,d=n==null?void 0:n.processor,f=o??{};return f.audio===!0&&(f.audio={}),f.video===!0&&(f.video={}),f.audio&&(JN(f.audio,e),(r=(s=f.audio).deviceId)!==null&&r!==void 0||(s.deviceId={ideal:"default"}),(l||u)&&(f.audio.processor=l??u)),f.video&&(JN(f.video,n),(i=(a=f.video).deviceId)!==null&&i!==void 0||(a.deviceId={ideal:"default"}),(c||d)&&(f.video.processor=c??d)),f}function JN(t,e){return Object.keys(e).forEach(n=>{t[n]===void 0&&(t[n]=e[n])}),t}function jO(t){var e,n,r,i;const s={};if(t.video)if(typeof t.video=="object"){const a={},o=a,l=t.video;Object.keys(l).forEach(c=>{switch(c){case"resolution":JN(o,l.resolution);break;default:o[c]=l[c]}}),s.video=a,(e=(r=s.video).deviceId)!==null&&e!==void 0||(r.deviceId={ideal:"default"})}else s.video=t.video?{deviceId:{ideal:"default"}}:!1;else s.video=!1;return t.audio?typeof t.audio=="object"?(s.audio=t.audio,(n=(i=s.audio).deviceId)!==null&&n!==void 0||(i.deviceId={ideal:"default"})):s.audio={deviceId:{ideal:"default"}}:s.audio=!1,s}function nne(t){return ce(this,arguments,void 0,function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:200;return function*(){const r=rne();if(r){const i=r.createAnalyser();i.fftSize=2048;const s=i.frequencyBinCount,a=new Uint8Array(s);r.createMediaStreamSource(new MediaStream([e.mediaStreamTrack])).connect(i),yield Zs(n),i.getByteTimeDomainData(a);const l=a.some(c=>c!==128&&c!==0);return r.close(),!l}return!1}()})}function rne(){var t;const e=typeof window<"u"&&(window.AudioContext||window.webkitAudioContext);if(e){const n=new e({latencyHint:"interactive"});if(n.state==="suspended"&&typeof window<"u"&&(!((t=window.document)===null||t===void 0)&&t.body)){const r=()=>ce(this,void 0,void 0,function*(){var i;try{n.state==="suspended"&&(yield n.resume())}catch(s){console.warn("Error trying to auto-resume audio context",s)}finally{(i=window.document.body)===null||i===void 0||i.removeEventListener("click",r)}});n.addEventListener("statechange",()=>{var i;n.state==="closed"&&((i=window.document.body)===null||i===void 0||i.removeEventListener("click",r))}),window.document.body.addEventListener("click",r)}return n}}function m8e(t){return t==="audioinput"?je.Source.Microphone:t==="videoinput"?je.Source.Camera:je.Source.Unknown}function YN(t){return t===je.Source.Microphone?"audioinput":t===je.Source.Camera?"videoinput":void 0}function g8e(t){var e,n;let r=(e=t.video)!==null&&e!==void 0?e:!0;return t.resolution&&t.resolution.width>0&&t.resolution.height>0&&(r=typeof r=="boolean"?{}:r,Jp()?r=Object.assign(Object.assign({},r),{width:{max:t.resolution.width},height:{max:t.resolution.height},frameRate:t.resolution.frameRate}):r=Object.assign(Object.assign({},r),{width:{ideal:t.resolution.width},height:{ideal:t.resolution.height},frameRate:t.resolution.frameRate})),{audio:(n=t.audio)!==null&&n!==void 0?n:!1,video:r,controller:t.controller,selfBrowserSurface:t.selfBrowserSurface,surfaceSwitching:t.surfaceSwitching,systemAudio:t.systemAudio,preferCurrentTab:t.preferCurrentTab}}function O_(t){return t.split("/")[1].toLowerCase()}function v8e(t){const e=[];return t.forEach(n=>{n.track!==void 0&&e.push(new PO({cid:n.track.mediaStreamID,track:n.trackInfo}))}),e}function wn(t){return"mediaStreamTrack"in t?{trackID:t.sid,source:t.source,muted:t.isMuted,enabled:t.mediaStreamTrack.enabled,kind:t.kind,streamID:t.mediaStreamID,streamTrackID:t.mediaStreamTrack.id}:{trackID:t.trackSid,enabled:t.isEnabled,muted:t.isMuted,trackInfo:Object.assign({mimeType:t.mimeType,name:t.trackName,encrypted:t.isEncrypted,kind:t.kind,source:t.source},t.track?wn(t.track):{})}}function y8e(){return typeof RTCRtpReceiver<"u"&&"getSynchronizationSources"in RTCRtpReceiver}function _8e(t,e){var n;t===void 0&&(t={}),e===void 0&&(e={});const r=[...Object.keys(e),...Object.keys(t)],i={};for(const s of r)t[s]!==e[s]&&(i[s]=(n=e[s])!==null&&n!==void 0?n:"");return i}function ine(t){const e=Object.assign({},t);let n,r;return typeof e.audio=="object"&&e.audio.processor&&(n=e.audio.processor,e.audio=Object.assign(Object.assign({},e.audio),{processor:void 0})),typeof e.video=="object"&&e.video.processor&&(r=e.video.processor,e.video=Object.assign(Object.assign({},e.video),{processor:void 0})),{audioProcessor:n,videoProcessor:r,optionsWithoutProcessor:d8e(e)}}function w8e(t){switch(t){case Oi.CAMERA:return je.Source.Camera;case Oi.MICROPHONE:return je.Source.Microphone;case Oi.SCREEN_SHARE:return je.Source.ScreenShare;case Oi.SCREEN_SHARE_AUDIO:return je.Source.ScreenShareAudio;default:return je.Source.Unknown}}function H7(t,e){return t.width*t.height<e.width*e.height}function b8e(t,e){var n;return(n=t.layers)===null||n===void 0?void 0:n.find(r=>r.quality===e)}const x8e=5e3,Ny=[];var So;(function(t){t[t.LOW=0]="LOW",t[t.MEDIUM=1]="MEDIUM",t[t.HIGH=2]="HIGH"})(So||(So={}));class je extends al.EventEmitter{get streamState(){return this._streamState}setStreamState(e){this._streamState=e}constructor(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var i;super(),this.attachedElements=[],this.isMuted=!1,this._streamState=je.StreamState.Active,this.isInBackground=!1,this._currentBitrate=0,this.log=mn,this.appVisibilityChangedListener=()=>{this.backgroundTimeout&&clearTimeout(this.backgroundTimeout),document.visibilityState==="hidden"?this.backgroundTimeout=setTimeout(()=>this.handleAppVisibilityChanged(),x8e):this.handleAppVisibilityChanged()},this.log=Xa((i=r.loggerName)!==null&&i!==void 0?i:hs.Track),this.loggerContextCb=r.loggerContextCb,this.setMaxListeners(100),this.kind=n,this._mediaStreamTrack=e,this._mediaStreamID=e.id,this.source=je.Source.Unknown}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),wn(this))}get currentBitrate(){return this._currentBitrate}get mediaStreamTrack(){return this._mediaStreamTrack}get mediaStreamID(){return this._mediaStreamID}attach(e){let n="audio";this.kind===je.Kind.Video&&(n="video"),this.attachedElements.length===0&&this.kind===je.Kind.Video&&this.addAppVisibilityListener(),e||(n==="audio"&&(Ny.forEach(s=>{s.parentElement===null&&!e&&(e=s)}),e&&Ny.splice(Ny.indexOf(e),1)),e||(e=document.createElement(n))),this.attachedElements.includes(e)||this.attachedElements.push(e),zg(this.mediaStreamTrack,e);const r=e.srcObject.getTracks(),i=r.some(s=>s.kind==="audio");return e.play().then(()=>{this.emit(i?Qe.AudioPlaybackStarted:Qe.VideoPlaybackStarted)}).catch(s=>{s.name==="NotAllowedError"?this.emit(i?Qe.AudioPlaybackFailed:Qe.VideoPlaybackFailed,s):s.name==="AbortError"?mn.debug("".concat(i?"audio":"video"," playback aborted, likely due to new play request")):mn.warn("could not playback ".concat(i?"audio":"video"),s),i&&e&&r.some(a=>a.kind==="video")&&s.name==="NotAllowedError"&&(e.muted=!0,e.play().catch(()=>{}))}),this.emit(Qe.ElementAttached,e),e}detach(e){try{if(e){dv(this.mediaStreamTrack,e);const r=this.attachedElements.indexOf(e);return r>=0&&(this.attachedElements.splice(r,1),this.recycleElement(e),this.emit(Qe.ElementDetached,e)),e}const n=[];return this.attachedElements.forEach(r=>{dv(this.mediaStreamTrack,r),n.push(r),this.recycleElement(r),this.emit(Qe.ElementDetached,r)}),this.attachedElements=[],n}finally{this.attachedElements.length===0&&this.removeAppVisibilityListener()}}stop(){this.stopMonitor(),this._mediaStreamTrack.stop()}enable(){this._mediaStreamTrack.enabled=!0}disable(){this._mediaStreamTrack.enabled=!1}stopMonitor(){this.monitorInterval&&clearInterval(this.monitorInterval),this.timeSyncHandle&&cancelAnimationFrame(this.timeSyncHandle)}updateLoggerOptions(e){e.loggerName&&(this.log=Xa(e.loggerName)),e.loggerContextCb&&(this.loggerContextCb=e.loggerContextCb)}recycleElement(e){if(e instanceof HTMLAudioElement){let n=!0;e.pause(),Ny.forEach(r=>{r.parentElement||(n=!1)}),n&&Ny.push(e)}}handleAppVisibilityChanged(){return ce(this,void 0,void 0,function*(){this.isInBackgroun
787d=document.visibilityState==="hidden",!this.isInBackground&&this.kind===je.Kind.Video&&setTimeout(()=>this.attachedElements.forEach(e=>e.play().catch(()=>{})),0)})}addAppVisibilityListener(){Wa()?(this.isInBackground=document.visibilityState==="hidden",document.addEventListener("visibilitychange",this.appVisibilityChangedListener)):this.isInBackground=!1}removeAppVisibilityListener(){Wa()&&document.removeEventListener("visibilitychange",this.appVisibilityChangedListener)}}function zg(t,e){let n;e.srcObject instanceof MediaStream?n=e.srcObject:n=new MediaStream;let r;t.kind==="audio"?r=n.getAudioTracks():r=n.getVideoTracks(),r.includes(t)||(r.forEach(i=>{n.removeTrack(i)}),n.addTrack(t)),(!Jp()||!(e instanceof HTMLVideoElement))&&(e.autoplay=!0),e.muted=n.getAudioTracks().length===0,e instanceof HTMLVideoElement&&(e.playsInline=!0),e.srcObject!==n&&(e.srcObject=n,(Jp()||Vv())&&e instanceof HTMLVideoElement&&setTimeout(()=>{e.srcObject=n,e.play().catch(()=>{})},0))}function dv(t,e){if(e.srcObject instanceof MediaStream){const n=e.srcObject;n.removeTrack(t),n.getTracks().length>0?e.srcObject=n:e.srcObject=null}}(function(t){let e;(function(c){c.Audio="audio",c.Video="video",c.Unknown="unknown"})(e=t.Kind||(t.Kind={}));let n;(function(c){c.Camera="camera",c.Microphone="microphone",c.ScreenShare="screen_share",c.ScreenShareAudio="screen_share_audio",c.Unknown="unknown"})(n=t.Source||(t.Source={}));let r;(function(c){c.Active="active",c.Paused="paused",c.Unknown="unknown"})(r=t.StreamState||(t.StreamState={}));function i(c){switch(c){case e.Audio:return zl.AUDIO;case e.Video:return zl.VIDEO;default:return zl.DATA}}t.kindToProto=i;function s(c){switch(c){case zl.AUDIO:return e.Audio;case zl.VIDEO:return e.Video;default:return e.Unknown}}t.kindFromProto=s;function a(c){switch(c){case n.Camera:return Oi.CAMERA;case n.Microphone:return Oi.MICROPHONE;case n.ScreenShare:return Oi.SCREEN_SHARE;case n.ScreenShareAudio:return Oi.SCREEN_SHARE_AUDIO;default:return Oi.UNKNOWN}}t.sourceToProto=a;function o(c){switch(c){case Oi.CAMERA:return n.Camera;case Oi.MICROPHONE:return n.Microphone;case Oi.SCREEN_SHARE:return n.ScreenShare;case Oi.SCREEN_SHARE_AUDIO:return n.ScreenShareAudio;default:return n.Unknown}}t.sourceFromProto=o;function l(c){switch(c){case DN.ACTIVE:return r.Active;case DN.PAUSED:return r.Paused;default:return r.Unknown}}t.streamStateFromProto=l})(je||(je={}));const k8e="|",K7="https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension";function S8e(t){const e=t.split(k8e);return e.length>1?[e[0],t.substr(e[0].length+1)]:[t,""]}function Zs(t){return new Xs(e=>Fi.setTimeout(e,t))}function XN(){return"addTransceiver"in RTCPeerConnection.prototype}function QN(){return"addTrack"in RTCPeerConnection.prototype}function T8e(){if(!("getCapabilities"in RTCRtpSender)||Jp()||Vv())return!1;const t=RTCRtpSender.getCapabilities("video");let e=!1;if(t){for(const n of t.codecs)if(n.mimeType.toLowerCase()==="video/av1"){e=!0;break}}return e}function C8e(){if(!("getCapabilities"in RTCRtpSender)||Vv())return!1;if(Jp()){const n=Ca();if(n!=null&&n.version&&au(n.version,"16")<0||(n==null?void 0:n.os)==="iOS"&&(n!=null&&n.osVersion)&&au(n.osVersion,"16")<0)return!1}const t=RTCRtpSender.getCapabilities("video");let e=!1;if(t){for(const n of t.codecs)if(n.mimeType.toLowerCase()==="video/vp9"){e=!0;break}}return e}function ql(t){return t==="av1"||t==="vp9"}function ZN(t){return!document||$w()?!1:(t||(t=document.createElement("audio")),"setSinkId"in t)}function E8e(){return typeof RTCPeerConnection>"u"?!1:XN()||QN()}function Vv(){var t;return((t=Ca())===null||t===void 0?void 0:t.name)==="Firefox"}function J7(){const t=Ca();return!!t&&t.name==="Chrome"&&t.os!=="iOS"}function Jp(){var t;return((t=Ca())===null||t===void 0?void 0:t.name)==="Safari"}function $w(){const t=Ca();return(t==null?void 0:t.name)==="Safari"||(t==null?void 0:t.os)==="iOS"}function A8e(){const t=Ca();return(t==null?void 0:t.name)==="Safari"&&t.version.startsWith("17.")||(t==null?void 0:t.os)==="iOS"&&!!(t!=null&&t.osVersion)&&au(t.osVersion,"17")>=0}function P8e(t){return t||(t=Ca()),(t==null?void 0:t.name)==="Safari"&&au(t.version,"18.3")>0||(t==null?void 0:t.os)==="iOS"&&!!(t!=null&&t.osVersion)&&au(t.osVersion,"18.3")>0}function sne(){var t,e;return Wa()?(e=(t=navigator.userAgentData)===null||t===void 0?void 0:t.mobile)!==null&&e!==void 0?e:/Tablet|iPad|Mobile|Android|BlackBerry/.test(navigator.userAgent):!1}function M8e(){const t=Ca(),e="17.2";if(t)return t.name!=="Safari"&&t.os!=="iOS"||t.os==="iOS"&&t.osVersion&&au(t.osVersion,e)>=0?!0:t.name==="Safari"&&au(t.version,e)>=0}function Wa(){return typeof document<"u"}function su(){return navigator.product=="ReactNative"}function qv(t){return t.hostname.endsWith(".livekit.cloud")||t.hostname.endsWith(".livekit.run")}function JE(t){return qv(t)?t.hostname.split(".")[0]:null}function ane(){if(global&&global.LiveKitReactNativeGlobal)return global.LiveKitReactNativeGlobal}function one(){if(!su())return;let t=ane();if(t)return t.platform}function Y7(){if(Wa())return window.devicePixelRatio;
vendor: 6,980 bytes, line 787
787if(su()){let t=ane();if(t)return t.devicePixelRatio}return 1}function au(t,e){const n=t.split("."),r=e.split("."),i=Math.min(n.length,r.length);for(let s=0;s<i;++s){const a=parseInt(n[s],10),o=parseInt(r[s],10);if(a>o)return 1;if(a<o)return-1;if(s===i-1&&a===o)return 0}return t===""&&e!==""?-1:e===""?1:n.length==r.length?0:n.length<r.length?-1:1}function N8e(t){for(const e of t)e.target.handleResize(e)}function R8e(t){for(const e of t)e.target.handleVisibilityChanged(e)}let YE=null;const X7=()=>(YE||(YE=new ResizeObserver(N8e)),YE);let XE=null;const Q7=()=>(XE||(XE=new IntersectionObserver(R8e,{root:null,rootMargin:"0px"})),XE);function I8e(){var t;const e=new rte({sdk:ite.JS,protocol:c8e,version:l8e});return su()&&(e.os=(t=one())!==null&&t!==void 0?t:""),e}function Z7(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:16,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:16,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;const i=document.createElement("canvas");i.width=t,i.height=e;const s=i.getContext("2d");s==null||s.fillRect(0,0,i.width,i.height),r&&s&&(s.beginPath(),s.arc(t/2,e/2,50,0,Math.PI*2,!0),s.closePath(),s.fillStyle="grey",s.fill());const a=i.captureStream(),[o]=a.getTracks();if(!o)throw Error("Could not get empty media stream video track");return o.enabled=n,o}let Ry;function QE(){if(!Ry){const t=new AudioContext,e=t.createOscillator(),n=t.createGain();n.gain.setValueAtTime(0,0);const r=t.createMediaStreamDestination();if(e.connect(n),n.connect(r),e.start(),[Ry]=r.stream.getAudioTracks(),!Ry)throw Error("Could not get empty media stream audio track");Ry.enabled=!1}return Ry.clone()}class Cs{get isResolved(){return this._isResolved}constructor(e,n){this._isResolved=!1,this.onFinally=n,this.promise=new Promise((r,i)=>ce(this,void 0,void 0,function*(){this.resolve=r,this.reject=i,e&&(yield e(r,i))})).finally(()=>{var r;this._isResolved=!0,(r=this.onFinally)===null||r===void 0||r.call(this)})}}function L8e(t){return f8e.includes(t)}function Ip(t){if(typeof t=="string"||typeof t=="number")return t;if(Array.isArray(t))return t[0];if(t.exact!==void 0)return Array.isArray(t.exact)?t.exact[0]:t.exact;if(t.ideal!==void 0)return Array.isArray(t.ideal)?t.ideal[0]:t.ideal;throw Error("could not unwrap constraint")}function O8e(t){return t.startsWith("http")?t.replace(/^(http)/,"ws"):t}function Vw(t){return t.startsWith("ws")?t.replace(/^(ws)/,"http"):t}function D8e(t,e){return t.segments.map(n=>{let{id:r,text:i,language:s,startTime:a,endTime:o,final:l}=n;var c;const u=(c=e.get(r))!==null&&c!==void 0?c:Date.now(),d=Date.now();return l?e.delete(r):e.set(r,u),{id:r,text:i,startTime:Number.parseInt(a.toString()),endTime:Number.parseInt(o.toString()),final:l,language:s,firstReceivedTime:u,lastReceivedTime:d}})}function F8e(t){const{id:e,timestamp:n,message:r,editTimestamp:i}=t;return{id:e,timestamp:Number.parseInt(n.toString()),editTimestamp:i?Number.parseInt(i.toString()):void 0,message:r}}function ez(t){switch(t.reason){case vr.LeaveRequest:return t.context;case vr.Cancelled:return Jl.CLIENT_INITIATED;case vr.NotAllowed:return Jl.USER_REJECTED;case vr.ServerUnreachable:return Jl.JOIN_FAILURE;default:return Jl.UNKNOWN_REASON}}function Gx(t){return t!==void 0?Number(t):void 0}function Zf(t){return t!==void 0?BigInt(t):void 0}function hv(t){return!!t&&!(t instanceof MediaStreamTrack)&&t.isLocal}function eu(t){return!!t&&t.kind==je.Kind.Audio}function pf(t){return!!t&&t.kind==je.Kind.Video}function Bu(t){return hv(t)&&pf(t)}function $u(t){return hv(t)&&eu(t)}function e3(t){return!!t&&!t.isLocal}function j8e(t){return!!t&&!t.isLocal}function ZE(t){return e3(t)&&pf(t)}function B8e(t){return t.isLocal}function U8e(t,e){const n=[];let r=new TextEncoder().encode(t);for(;r.length>e;){let i=e;for(;i>0;){const s=r[i];if(s!==void 0&&(s&192)!==128)break;i--}n.push(r.slice(0,i)),r=r.slice(i)}return r.length>0&&n.push(r),n}function z8e(t){var e;const n=t.get("Cache-Control");if(n){const r=(e=n.match(/(?:^|[,\s])max-age=(\d+)/))===null||e===void 0?void 0:e[1];if(r)return parseInt(r,10)}}function t3(){return typeof CompressionStream<"u"}function $8e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const r=V8e(t,e);return n?r:BO(r,"v1")}function V8e(t,e){const n=new URL(O8e(t));return e.forEach((r,i)=>{n.searchParams.set(i,r)}),BO(n,"rtc")}function q8e(t){const e=new URL(Vw(t));return BO(e,"validate")}function lne(t){return t.endsWith("/")?t:"".concat(t,"/")}function BO(t,e){return t.pathname="".concat(lne(t.pathname)).concat(e),t}function tz(t){if(typeof t=="string")return I7.fromJson(JSON.parse(t),{ignoreUnknownFields:!0});if(t instanceof ArrayBuffer)return I7.fromBinary(new Uint8Array(t));throw new Error("could not decode websocket message: ".concat(typeof t))}function W8e(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Unknown reason";if(!(t instanceof AbortSignal))return e;const n=t.reason;switch(typeof n){case"string":return n;case"object":return n instanceof Error?n.message:e;default:return"toString"in n?n.toString():e}}const G8e=10,Iy="lk_e2ee",H8e="LKFrameEncryptionKey",K8e={sharedKey:!1,ratchetSalt:H8e,ratchetWindowSize:8,failureTolerance:G8e,keyringSize:16,keySize:128};var Wh;(function(t){t.SetKey="setKey",t.RatchetRequest="ratchetRequest",t.KeyRatcheted="keyRatcheted"})(Wh||(Wh={}));var nz;(function(t){t.KeyRatcheted="keyRatcheted"})(nz||(nz={}));var Eh;(function(t){t.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",t.EncryptionError="encryptionError"})(Eh||(Eh={}));var rz;(function(t){t.Error="cryptorError"})(rz||(rz={}));function J8e(){return Y8e()||n3()}function n3(){return typeof window.RTCRtpScriptTransform<"u"}function Y8e(){return typeof window.RTCRtpSender<"u"&&typeof window.RTCRtpSender.prototype.createEncodedStreams<"u"}function X8e(t){var e,n,r,i,s;if(((e=t.value)===null||e===void 0?void 0:e.case)!=="sipDtmf"&&((n=t.value)===null||n===void 0?void 0:n.case)!=="metrics"&&((r=t.value)===null||r===void 0?void 0:r.case)!=="speaker"&&((i=t.value)===null||i===void 0?void 0:i.case)!=="transcription"&&((s=t.value)===null||s===void 0?void 0:s.case)!=="encryptedPacket")return new Yee({value:t.value})}class _7e extends al.EventEmitter{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),this.latestManuallySetKeyIndex=0,this.onKeyRatcheted=(n,r,i)=>{mn.debug("key ratcheted event received",{ratchetResult:n,participantId:r,keyIndex:i})},this.keyInfoMap=new Map,this.options=Object.assign(Object.assign({},K8e),e),this.on(Wh.KeyRatcheted,this.onKeyRatcheted)}onSetEncryptionKey(e,n,r){const i={key:e,participantIdentity:n,keyIndex:r};if(!this.options.sharedKey&&!n)throw new Error("participant identity needs to be passed for encryption key if sharedKey option is false");this.keyInfoMap.set("".concat(n??"shared","-").concat(r??0),i),r!==void 0&&(this.latestManuallySetKeyIndex=r),this.emit
787(Wh.SetKey,i,r!==void 0)}getKeys(){return Array.from(this.keyInfoMap.values())}getLatestManuallySetKeyIndex(){return this.latestManuallySetKeyIndex}getOptions(){return this.options}ratchetKey(e,n){this.emit(Wh.RatchetRequest,e,n)}}var iz;(function(t){t[t.InvalidKey=0]="InvalidKey",t[t.MissingKey=1]="MissingKey",t[t.InternalError=2]="InternalError"})(iz||(iz={}));class Q8e extends al.EventEmitter{constructor(e,n){super(),this.decryptDataRequests=new Map,this.encryptDataRequests=new Map,this.onWorkerMessage=r=>{var i,s;const{kind:a,data:o}=r.data;switch(a){case"error":if(mn.error(o.error.message),o.uuid){const u=this.decryptDataRequests.get(o.uuid);if(u!=null&&u.reject){u.reject(o.error);break}const d=this.encryptDataRequests.get(o.uuid);if(d!=null&&d.reject){d.reject(o.error);break}}this.emit(Eh.EncryptionError,o.error,o.participantIdentity);break;case"initAck":o.enabled&&this.keyProvider.getKeys().forEach(u=>{this.postKey(u,!1)});break;case"enable":if(o.enabled&&this.keyProvider.getKeys().forEach(u=>{this.postKey(u,!1)}),this.encryptionEnabled!==o.enabled&&o.participantIdentity===((i=this.room)===null||i===void 0?void 0:i.localParticipant.identity))this.emit(Eh.ParticipantEncryptionStatusChanged,o.enabled,this.room.localParticipant),this.encryptionEnabled=o.enabled;else if(o.participantIdentity){const u=(s=this.room)===null||s===void 0?void 0:s.getParticipantByIdentity(o.participantIdentity);if(!u)throw TypeError("couldn't set encryption status, participant not found".concat(o.participantIdentity));this.emit(Eh.ParticipantEncryptionStatusChanged,o.enabled,u)}break;case"ratchetKey":this.keyProvider.emit(Wh.KeyRatcheted,o.ratchetResult,o.participantIdentity,o.keyIndex);break;case"decryptDataResponse":const l=this.decryptDataRequests.get(o.uuid);l!=null&&l.resolve&&l.resolve(o);break;case"encryptDataResponse":const c=this.encryptDataRequests.get(o.uuid);c!=null&&c.resolve&&c.resolve(o);break}},this.onWorkerError=r=>{mn.error("e2ee worker encountered an error:",{error:r.error}),this.emit(Eh.EncryptionError,r.error,void 0)},this.keyProvider=e.keyProvider,this.worker=e.worker,this.encryptionEnabled=!1,this.dataChannelEncryptionEnabled=n}get isEnabled(){return this.encryptionEnabled}get isDataChannelEncryptionEnabled(){return this.isEnabled&&this.dataChannelEncryptionEnabled}
787setup(e){if(!J8e())throw new DO("tried to setup end-to-end encryption on an unsupported browser");if(mn.info("setting up e2ee"),e!==this.room){this.room=e,this.setupEventListeners(e,this.keyProvider);const n={kind:"init",data:{keyProviderOptions:this.keyProvider.getOptions(),loglevel:qje.getLevel()}};this.worker&&(mn.info("initializing worker",{worker:this.worker}),this.worker.onmessage=this.onWorkerMessage,this.worker.onerror=this.onWorkerError,this.worker.postMessage(n))}}setParticipantCryptorEnabled(e,n){mn.debug("set e2ee to ".concat(e," for participant ").concat(n)),this.postEnable(e,n)}setSifTrailer(e){!e||e.length===0?mn.warn("ignoring server sent trailer as it's empty"):this.postSifTrailer(e)}setupEngine(e){e.on(We.RTPVideoMapUpdate,n=>{this.postRTPMap(n)})}setupEventListeners(e,n){e.on(Ve.TrackPublished,(r,i)=>this.setParticipantCryptorEnabled(r.trackInfo.encryption!==yr.NONE,i.identity)),e.on(Ve.ConnectionStateChanged,r=>{r===Bn.Connected&&e.remoteParticipants.forEach(i=>{i.trackPublications.forEach(s=>{this.setParticipantCryptorEnabled(s.trackInfo.encryption!==yr.NONE,i.identity)})})}).on(Ve.TrackUnsubscribed,(r,i,s)=>{var a;const o={kind:"removeTransform",data:{participantIdentity:s.identity,trackId:r.mediaStreamID}};(a=this.worker)===null||a===void 0||a.postMessage(o)}).on(Ve.TrackSubscribed,(r,i,s)=>{this.setupE2EEReceiver(r,s.identity,i.trackInfo)}).on(Ve.SignalConnected,()=>{if(!this.room)throw new TypeError("expected room to be present on signal connect");const r=n.getLatestManuallySetKeyIndex();n.getKeys().forEach(i=>{var s;this.postKey(i,r===((s=i.keyIndex)!==null&&s!==void 0?s:0))}),this.setParticipantCryptorEnabled(this.room.localParticipant.isE2EEEnabled,this.room.localParticipant.identity)}),e.localParticipant.on(tt.LocalSenderCreated,(r,i)=>ce(this,void 0,void 0,function*(){this.setupE2EESender(i,r)})),e.localParticipant.on(tt.LocalTrackPublished,r=>{if(!pf(r.track)||!$w())return;const i={kind:"updateCodec",data:{trackId:r.track.mediaStreamID,codec:O_(r.trackInfo.codecs[0].mimeType),participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(i)}),n.on(Wh.SetKey,(r,i)=>this.postKey(r,i??!0)).on(Wh.RatchetRequest,(r,i)=>this.postRatchetRequest(r,i))}encryptData(e){return ce(this,void 0,void 0,function*(){if(!this.worker)throw Error("could not encrypt data, worker is missing");const n=crypto.randomUUID(),r={kind:"encryptDataRequest",data:{uuid:n,payload:e,participantIdentity:this.room.localParticipant.identity}},i=new Cs;return i.onFinally=()=>{this.encryptDataRequests.delete(n)},this.encryptDataRequests.set(n,i),this.worker.postMessage(r),i.promise})}handleEncryptedData(e,n,r,i){if(!this.worker)throw Error("could not handle encrypted data, worker is missing");const s=crypto.randomUUID(),a={kind:"decryptDataRequest",data:{uuid:s,payload:e,iv:n,participantIdentity:r,keyIndex:i}},o=new Cs;return o.onFinally=()=>{this.decryptDataRequests.delete(s)},this.decryptDataRequests.set(s,o),this.worker.postMessage(a),o.promise}postRatchetRequest(e,n){if(!this.worker)throw Error("could not ratchet key, worker is missing");const r={kind:"ratchetRequest",data:{participantIdentity:e,keyIndex:n}};this.worker.postMessage(r)}postKey(e,n){let{key:r,participantIdentity:i,keyIndex:s}=e;var a;if(!this.worker)throw Error("could not set key, worker is missing");const o={kind:"setKey",data:{participantIdentity:i,isPublisher:i===((a=this.room)===null||a===void 0?void 0:a.localParticipant.identity),key:r,keyIndex:s,updateCurrentKeyIndex:n}};this.worker.postMessage(o)}postEnable(e,n){if(this.worker){const r={kind:"enable",data:{enabled:e,participantIdentity:n}};this.worker.postMessage(r)}else throw new ReferenceError("failed to enable e2ee, worker is not ready")}postRTPMap(e){var n;if(!this.worker)throw TypeError("could not post rtp map, worker is missing");if(!(!((n=this.room)===null||n===void 0)&&n.localParticipant.identity))throw TypeError("could not post rtp map, local participant identity is missing");const r={kind:"setRTPMap",data:{map:e,participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(r)}postSifTrailer(e){if(!this.worker)throw Error("could not post SIF trailer, worker is missing");const n={kind:"setSifTrailer",data:{trailer:e}};this.worker.postMessage(n)}setupE2EEReceiver(e,n,r){if(e.receiver){if(!(r!=null&&r.mimeType)||r.mimeType==="")throw new TypeError("MimeType missing from trackInfo, cannot set up E2EE cryptor");this.handleReceiver(e.receiver,e.mediaStreamID,n,e.kind==="video"?O_(r.mimeType):void 0)}}setupE2EESender(e,n){if(!hv(e)||!n){n||mn.warn("early return because sender is not ready");return}this.handleSender(n,e.mediaStreamID,void 0)}handleReceiver(e,n,r,i){return ce(this,void 0,void 0,function*(){if(this.worker){if(n3()&&!J7()){const s={kind:"decode",participantIdentity:r,trackId:n,codec:i};e.transform=new RTCRtpScriptTransform(this.worker,s)}else{if(Iy in e&&i){const l={kind:"updateCodec",data:{trackId:n,codec:i,participantIdentity:r}};this.worker.postMessage(l);return}let s=e.writableStream,a=e.readableStream;if(!s||!a){const l=e.createEncodedStreams();e.writableStream=l.writable,s=l.writable,e.readableStream=l.readable,a=l.readable}const o={kind:"decode",data:{readableStream:a,writableStream:s,trackId:n,codec:i,participantIdentity:r,isReuse:Iy in e}};this.worker.postMessage(o,[a,s])}e[Iy]=!0}})}handleSender(e,n,r){var i;if(!(Iy in e||!this.worker)){if(!(!((i=this.room)===null||i===void 0)&&i.localParticipant.identity)||this.room.localParticipant.identity==="")throw TypeError("local identity needs to be known in order to set up encrypted sender");if(n3()&&!J7()){mn.info("initialize script transform");const s={kind:"encode",participantIdentity:this.room.localParticipant.identity,trackId:n,codec:r};e.transform=new RTCRtpScriptTransform(this.worker,s)}else{mn.info("initialize encoded streams");const s=e.createEncodedStreams(),a={kind:"encode",data:{readableStream:s.readable,writableStream:s.writable,codec:r,trackId:n,participantIdentity:this.room.localParticipant.identity,isReuse:!1}};
787this.worker.postMessage(a,[s.readable,s.writable])}e[Iy]=!0}}}const Z8e=500,eBe=15e3;class fv{constructor(){this.failedConnectionAttempts=new Map,this.backOffPromises=new Map}static getInstance(){return this._instance||(this._instance=new fv),this._instance}addFailedConnectionAttempt(e){var n;const r=new URL(e),i=JE(r);if(!i)return;let s=(n=this.failedConnectionAttempts.get(i))!==null&&n!==void 0?n:0;this.failedConnectionAttempts.set(i,s+1),this.backOffPromises.set(i,Zs(Math.min(Z8e*Math.pow(2,s),eBe)))}getBackOffPromise(e){const n=new URL(e),r=n&&JE(n);return r&&this.backOffPromises.get(r)||Promise.resolve()}resetFailedConnectionAttempts(e){const n=new URL(e),r=n&&JE(n);r&&(this.failedConnectionAttempts.set(r,0),this.backOffPromises.set(r,Promise.resolve()))}resetAll(){this.backOffPromises.clear(),this.failedConnectionAttempts.clear()}}fv._instance=null;const eA="default";class cs{constructor(){this._previousDevices=[]}static getInstance(){return this.instance===void 0&&(this.instance=new cs),this.instance}get previousDevices(){return this._previousDevices}getDevices(e){return ce(this,arguments,void 0,function(n){var r=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var s;if(((s=cs.userMediaPromiseMap)===null||s===void 0?void 0:s.size)>0){mn.debug("awaiting getUserMedia promise");try{n?yield cs.userMediaPromiseMap.get(n):yield Promise.all(cs.userMediaPromiseMap.values())}catch{mn.warn("error waiting for media permissons")}}let a=yield navigator.mediaDevices.enumerateDevices();if(i&&!(Jp()&&r.hasDeviceInUse(n))&&(a.filter(l=>l.kind===n).length===0||a.some(l=>{const c=l.label==="",u=n?l.kind===n:!0;return c&&u}))){const l={video:n!=="audioinput"&&n!=="audiooutput",audio:n!=="videoinput"&&{deviceId:{ideal:"default"}}},c=yield navigator.mediaDevices.getUserMedia(l);a=yield navigator.mediaDevices.enumerateDevices(),c.getTracks().forEach(u=>{u.stop()})}return r._previousDevices=a,n&&(a=a.filter(o=>o.kind===n)),a}()})}normalizeDeviceId(e,n,r){return ce(this,void 0,void 0,function*(){if(n!==eA)return n;const i=yield this.getDevices(e),s=i.find(o=>o.deviceId===eA);if(!s){mn.warn("could not reliably determine default device");return}const a=i.find(o=>o.deviceId!==eA&&o.groupId===(r??s.groupId));if(!a){mn.warn("could not reliably determine default device");return}return a==null?void 0:a.deviceId})}hasDeviceInUse(e){return e?cs.userMediaPromiseMap.has(e):cs.userMediaPromiseMap.size>0}}cs.mediaDeviceKinds=["audioinput","audiooutput","videoinput"];cs.userMediaPromiseMap=new Map;const UO=65535,cne=4294967295;class Yl{static u16(e){return new Yl(e,UO)}static u32(e){return new Yl(e,cne)}constructor(e,n){if(this.value=e,e<0)throw new Error("WrapAroundUnsignedInt: cannot faithfully represent an integer smaller than 0");if(n>Number.MAX_SAFE_INTEGER)throw new Error("WrapAroundUnsignedInt: cannot faithfully represent an integer bigger than MAX_SAFE_INTEGER.");this.maxSize=n,this.clamp()}clamp(){for(;this.value>this.maxSize;)this.value-=this.maxSize+1;for(;this.value<0;)this.value+=this.maxSize+1}clone(){return new Yl(this.value,this.maxSize)}update(e){this.value=e(this.value),this.clamp()}increment(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;this.update(n=>n+e)}decrement(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;this.update(n=>n-e)}getThenIncrement(){const e=this.value;return this.increment(),new Yl(e,this.maxSize)}isBefore(e){const n=this.value>>>0,i=(e.value>>>0)-n>>>0;return i!==0&&i<this.maxSize+1}}class pv{static fromRtpTicks(e){return new pv(e,9e4)}static rtpRandom(){const e=Math.round(Math.random()*cne);return pv.fromRtpTicks(e)}constructor(e,n){this.timestamp=Yl.u32(e),this.rateInHz=n}asTicks(){return this.timestamp.value}clone(){return new pv(this.timestamp.value,this.rateInHz)}wrappingAdd(e){this.timestamp.increment(e)}isBefore(e){return this.timestamp.isBefore(e.timestamp)}}class ip{constructor(e,n,r){this.epoch=n,this.base=r,this.previous=r.clone(),this.rateInHz=e}static startingNow(e,n){return new ip(n,new Date,e)}static startingAtTime(e,n,r){return new ip(r,e,n)}static rtpStartingNow(e){return ip.startingNow(e,9e4)}static rtpStartingAtTime(e,n){return ip.startingAtTime(e,n,9e4)}now(){return this.at(new Date)}at(e){let n=e.getTime()-this.epoch.getTime(),r=ip.durationInMsToTicks(n,this.rateInHz),i=this.base.clone();return i.wrappingAdd(r),i.isBefore(this.previous)&&(i=this.previous),this.previous=i.clone(),i.clone()}static durationInMsToTicks(e,n){let i=(e*1e6*n+5e8)/1e9;return Math.round(i)}}function zO(t){if(t instanceof DataView)return t;if(t instanceof ArrayBuffer)return new DataView(t);if(t instanceof Uint8Array)return new DataView(t.buffer,t.byteOffset,t.byteLength);throw new Error("Error coercing ".concat(t," to DataView - input was not DataView, ArrayBuffer, or Uint8Array."))}var Lp;(function(t){t[t.Reserved=0]="Reserved",t[t.TooLarge=1]="TooLarge"})(Lp||(Lp={}));class Wv extends ol{constructor(e,n){super(19,e),this.name="DataTrackHandleError",this.reason=n,this.reasonName=Lp[n]}isReason(e){return this.reason===e}static tooLarge(){return new Wv("Value too large to be a valid track handle",Lp.TooLarge)}static reserved(e){return new Wv("0x".concat(e.toString(16)," is a reserved value."),Lp.Reserved)}}const tBe={fromNumber(t){if(t===0)throw Wv.reserved(t);if(t>UO)throw Wv.tooLarge();return t}};
787class nBe{constructor(){this.value=0}get(){return this.value+=1,this.value>UO?null:this.value}reset(){this.value=0}}const xS={from(t){return{sid:t.sid,pubHandle:t.pubHandle,name:t.name,usesE2ee:t.encryption!==yr.NONE}},toProtobuf(t){return new rC({sid:t.sid,pubHandle:t.pubHandle,name:t.name,encryption:t.usesE2ee?yr.GCM:yr.NONE})}};var D_;(function(t){t[t.WAITING=0]="WAITING",t[t.RUNNING=1]="RUNNING",t[t.COMPLETED=2]="COMPLETED"})(D_||(D_={}));class rBe{constructor(){this.pendingTasks=new Map,this.taskMutex=new As,this.nextTaskIndex=0}run(e){return ce(this,void 0,void 0,function*(){const n={id:this.nextTaskIndex++,enqueuedAt:Date.now(),status:D_.WAITING};this.pendingTasks.set(n.id,n);const r=yield this.taskMutex.lock();try{return n.executedAt=Date.now(),n.status=D_.RUNNING,yield e()}finally{n.status=D_.COMPLETED,this.pendingTasks.delete(n.id),r()}})}flush(){return ce(this,void 0,void 0,function*(){return this.run(()=>ce(this,void 0,void 0,function*(){}))})}snapshot(){return Array.from(this.pendingTasks.values())}}class iBe{get readyState(){return this.ws.readyState}constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var r,i;if(!((r=n.signal)===null||r===void 0)&&r.aborted)throw new DOMException("This operation was aborted","AbortError");this.url=e;const s=new WebSocket(e,(i=n.protocols)!==null&&i!==void 0?i:[]);s.binaryType="arraybuffer",this.ws=s;const a=function(){let{closeCode:o,reason:l}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return s.close(o,l)};this.opened=new Xs((o,l)=>{const c=()=>{l(Ot.websocket("Encountered websocket error during connection establishment"))};s.onopen=()=>{o({readable:new ReadableStream({start(u){s.onmessage=d=>{let{data:f}=d;return u.enqueue(f)},s.onerror=d=>u.error(d)},cancel:a}),writable:new WritableStream({write(u){s.send(u)},abort(){s.close()},close:a}),protocol:s.protocol,extensions:s.extensions}),s.removeEventListener("error",c)},s.addEventListener("error",c)}),this.closed=new Xs((o,l)=>{const c=()=>ce(this,void 0,void 0,function*(){const u=new Xs(f=>{s.readyState!==WebSocket.CLOSED&&s.addEventListener("close",h=>{f(h)},{once:!0})}),d=yield Xs.race([Zs(250),u]);d?o(d):l(Ot.websocket("Encountered unspecified websocket error without a timely close event"))});s.onclose=u=>{let{code:d,reason:f}=u;o({closeCode:d,reason:f}),s.removeEventListener("error",c)},s.addEventListener("error",c)}),n.signal&&(n.signal.onabort=()=>s.close()),this.close=a}}const sBe=["syncState","trickle","offer","answer","simulate","leave"];function aBe(t){const e=sBe.indexOf(t.case)>=0;return mn.trace("request allowed to bypass queue:",{canPass:e,req:t}),e}var mr;(function(t){t[t.CONNECTING=0]="CONNECTING",t[t.CONNECTED=1]="CONNECTED",t[t.RECONNECTING=2]="RECONNECTING",t[t.DISCONNECTING=3]="DISCONNECTING",t[t.DISCONNECTED=4]="DISCONNECTED"})(mr||(mr={}));const oBe=250;class $O{get currentState(){return this.state}get isDisconnected(){return this.state===mr.DISCONNECTING||this.state===mr.DISCONNECTED}get isEstablishingConnection(){return this.state===mr.CONNECTING||this.state===mr.RECONNECTING}getNextRequestId(){return this._requestId+=1,this._requestId}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var r;this.rtt=0,this.state=mr.DISCONNECTED,this.log=mn,this._requestId=0,this.useV0SignalPath=!1,this.resetCallbacks=()=>{this.onAnswer=void 0,this.onLeave=void 0,this.onLocalTrackPublished=void 0,this.onLocalTrackUnpublished=void 0,this.onNegotiateRequested=void 0,this.onOffer=void 0,this.onRemoteMuteChanged=void 0,this.onSubscribedQualityUpdate=void 0,this.onTokenRefresh=void 0,this.onTrickle=void 0,this.onClose=void 0,this.onMediaSectionsRequirement=void 0},this.loggerContextCb=n.loggerContextCb,this.log=Xa((r=n.loggerName)!==null&&r!==void 0?r:hs.Signal,()=>this.logContext),this.useJSON=e,this.requestQueue=new rBe,this.queuedRequests=[],this.closingLock=new As,this.connectionLock=new As,this.state=mr.DISCONNECTED}get logContext(){var e,n;return(n=(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this))!==null&&n!==void 0?n:{}}join(e,n,r,i){return ce(this,arguments,void 0,function(s,a,o,l){var c=this;let u=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,d=arguments.length>5?arguments[5]:void 0;return function*(){return c.state=mr.CONNECTING,c.options=o,yield c.connect(s,a,o,l,u,d)}()})}reconnect(e,n,r,i){return ce(this,void 0,void 0,function*(){if(!this.options){this.log.warn("attempted to reconnect without signal options being set, ignoring");return}return this.state=mr.RECONNECTING,this.clearPingInterval(),yield this.connect(e,n,Object.assign(Object.assign({},this.options),{reconnect:!0,sid:r,reconnectReason:i}),void 0,this.useV0SignalPath)})}connect(e,n,r,i){return ce(this,arguments,void 0,function(s,a,o,l){var c=this;let u=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,d=arguments.length>5?arguments[5]:void 0;return function*(){const f=yield c.connectionLock.lock();c.connectOptions=o,c.useV0SignalPath=u;const h=I8e(),p=u?lBe(a,h,o):yield cBe(a,h,o,d),m=$8e(s,p,u).toString(),g=q8e(m).toString();return new Promise((v,_)=>ce(c,void 0,void 0,function*(){var b,x;try{let T=!1;const N=R=>ce(this,void 0,void 0,function*(){if(T)return;T=!0;const j=R instanceof Event?R.currentTarget:R,$=W8e(j,"Abort handler called");this.streamWriter&&!this.isDisconnected?this.sendLeave().then(()=>this.close($)).catch(U=>{this.log.error(U),this.close()}
787):this.close(),A(),_(Ot.cancelled($))});l==null||l.addEventListener("abort",N);const A=()=>{clearTimeout(L),l==null||l.removeEventListener("abort",N)},L=setTimeout(()=>{N(Ot.timeout("room connection has timed out (signal)"))},o.websocketTimeout),M=(R,j)=>{this.handleSignalConnected(R,L,j)},B=new URL(m);B.searchParams.has("access_token")&&B.searchParams.set("access_token","<redacted>"),this.log.info("signal connecting to ".concat(B),{reconnect:o.reconnect,reconnectReason:o.reconnectReason}),this.ws&&(yield this.close(!1)),this.ws=new iBe(m);try{this.ws.closed.then(le=>{var V;this.isEstablishingConnection&&_(Ot.internal("Websocket got closed during a (re)connection attempt: ".concat(le.reason))),le.closeCode!==1e3&&(this.log.warn("websocket closed",{reason:le.reason,code:le.closeCode,wasClean:le.closeCode===1e3,state:this.state}),this.state===mr.CONNECTED&&this.handleOnClose((V=le.reason)!==null&&V!==void 0?V:"Unexpected WS error"))}).catch(le=>{this.isEstablishingConnection&&_(Ot.internal("Websocket error during a (re)connection attempt: ".concat(le)))});const R=yield this.ws.opened.catch(le=>ce(this,void 0,void 0,function*(){if(this.state!==mr.CONNECTED){this.state=mr.DISCONNECTED,clearTimeout(L);const V=yield this.handleConnectionError(le,g);_(V);return}this.handleWSError(le),_(le)}));if(clearTimeout(L),!R)return;const j=R.readable.getReader();this.streamWriter=R.writable.getWriter();const $=yield j.read();if(j.releaseLock(),!$.value)throw Ot.internal("no message received as first message");const U=tz($.value),te=this.validateFirstMessage(U,(b=o.reconnect)!==null&&b!==void 0?b:!1);if(!te.isValid){_(te.error);return}((x=U.message)===null||x===void 0?void 0:x.case)==="join"&&(this.pingTimeoutDuration=U.message.value.pingTimeout,this.pingIntervalDuration=U.message.value.pingInterval,this.pingTimeoutDuration&&this.pingTimeoutDuration>0&&this.log.debug("ping config",{timeout:this.pingTimeoutDuration,interval:this.pingIntervalDuration}),this.onJoined&&this.onJoined(U.message.value));const ne=te.shouldProcessFirstMessage?U:void 0;M(R,ne),v(te.response)}catch(R){_(R)}finally{A()}}finally{f()}}))}()})}startReadingLoop(e,n){return ce(this,void 0,void 0,function*(){for(n&&this.handleSignalResponse(n);;){this.signalLatency&&(yield Zs(this.signalLatency));const{done:r,value:i}=yield e.read();if(r)break;const s=tz(i);this.handleSignalResponse(s)}})}close(){return ce(this,arguments,void 0,function(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Close method called on signal client";return function*(){if([mr.DISCONNECTING||mr.DISCONNECTED].includes(e.state)){e.log.debug("ignoring signal close as it's already in disconnecting state");return}const i=yield e.closingLock.lock();try{if(e.clearPingInterval(),n&&(e.state=mr.DISCONNECTING),e.ws){e.ws.close({closeCode:1e3,reason:r});const s=e.ws.closed;e.ws=void 0,e.streamWriter=void 0,yield Promise.race([s,Zs(oBe)])}}catch(s){e.log.debug("websocket error while closing",{error:s})}finally{n&&(e.state=mr.DISCONNECTED),i()}}()})}sendOffer(e,n){this.log.debug("sending offer",{offerSdp:e.sdp}),this.sendRequest({case:"offer",value:sp(e,n)})}sendAnswer(e,n){return this.log.debug("sending answer",{answerSdp:e.sdp}),this.sendRequest({case:"answer",value:sp(e,n)})}sendIceCandidate(e,n){return this.log.debug("sending ice candidate",{candidate:e}),this.sendRequest({case:"trickle",value:new iC({candidateInit:JSON.stringify(e),target:n})})}sendMuteTrack(e,n){return this.sendRequest({case:"mute",value:new sC({sid:e,muted:n})})}sendAddTrack(e){return this.sendRequest({case:"addTrack",value:e})}sendUpdateLocalMetadata(e,n){return ce(this,arguments,void 0,function(r,i){var s=this;let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){const o=s.getNextRequestId();return yield s.sendRequest({case:"updateMetadata",value:new NO({requestId:o,metadata:r,name:i,attributes:a})}),o}()})}sendUpdateTrackSettings(e){this.sendRequest({case:"trackSetting",value:e})}sendUpdateSubscription(e){return this.sendRequest({case:"subscription",value:e})}sendSyncState(e){return this.sendRequest({case:"syncState",value:e})}sendUpdateVideoLayers(e,n){return this.sendRequest({case:"updateLayers",value:new fte({trackSid:e,layers:n})})}sendUpdateSubscriptionPermissions(e,n){return this.sendRequest({case:"subscriptionPermission",value:new gte({allParticipants:e,trackPermissions:n})})}sendSimulateScenario(e){return this.sendRequest({case:"simulate",value:e})}sendPing(){return Promise.all([this.sendRequest({case:"ping",value:Gr.parse(Date.now())}),this.sendRequest({case:"pingReq",value:new _te({timestamp:Gr.parse(Date.now()),rtt:Gr.parse(this.rtt)})})])}sendUpdateLocalAudioTrack(e,n){return this.sendRequest({case:"updateAudioTrack",value:new MO({trackSid:e,features:n})})}sendLeave(){return this.sendRequest({case:"leave",value:new oC({reason:Jl.CLIENT_INITIATED,action:cv.DISCONNECT})})}sendPublishDataTrackRequest(e,n,r){return this.sendRequest({case:"publishDataTrackRequest",value:new CO({pubHandle:e,name:n,encryption:r?yr.GCM:yr.NONE})})}sendUnPublishDataTrackRequest(e){return this.sendRequest({case:"unpublishDataTrackRequest",value:new AO({pubHandle:e})})}sendUpdateDataSubscription(e,n){return this.sendRequest({case:"updateDataSubscription",value:new cte({updates:[new ute({trackSid:e,subscribe:n})]})})}sendRequest(e){return ce(this,arguments,void 0,function(n){var r=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return function*(){if(!i&&!aBe(n)&&r.state===mr.RECONNECTING){r.queuedRequests.push(()=>ce(r,void 0,void 0,function*(){yield this.sendRequest(n,!0)}));return}if(i||(yield r.requestQueue.flush()),r.signalLatency&&(yield Zs(r.signalLatency)),r.isDisconnected){r.log.debug("skipping signal request (type: ".concat(n.case,") - SignalClient disconnected"));return}if(!r.streamWriter){r.log.error("cannot send signal request before connected, type: ".concat(n==null?void 0:n.case));return}const a=new hje({message:n});try{r.useJSON?yield r.streamWriter.write(a.toJsonString()):yield r.streamWriter.write(a.toBinary())}catch(o){r.log.error("error sending signal message",{error:o})}}()})}handleSignalResponse(e){var n,r;const i=e.message;if(i==null){this.log.debug("received unsupported message");return}let s=!1;if(i.case==="answer"){const a=sz(i.value);this.onAnswer&&this.onAnswer(a,i.value.id,i.value.midToTrackId)}else if(i.case==="offer"){const a=sz(i.value);this.onOffer&&this.onOffer(a,i.value.id,i.value.midToTrackId)}else if(i.case==="trickle"){const a=JSON.parse(i.value.candidateInit);this.onTrickle&&this.onTrickle(a,i.value.target)}else i.case==="update"?this.onParticipantUpdate&&this.onParticipantUpdate((n=i.value.participants)!==null&&n!==void 0?n:[]):i.case==="trackPublished"?this.onLocalTrackPublished&&this.onLocalTrackPublished(i.value):i.case==="speakersChanged"?this.onSpeakersChanged&&this.onSpeakersChanged((r=i.value.speakers)!==null&&r!==void 0?r:[]):i.case==="leave"?this.onLeave&&this.onLeave(i.value):i.case==="mute"?this.onRemoteMuteChanged&&this.onRemoteMuteChanged(i.value.sid,i.value.muted):i.case==="roomUpdate"?this.onRoomUpdate&&i.value.room&&this.onRoomUpdate(i.value.room):i.case==="connectionQuality"?this.onConnectionQuality&&this.onConnectionQuality(i.value):i.case==="streamStateUpdate"?this.onStreamStateUpdate&&this.onStreamStateUpdate(i.value):i.case==="subscribedQualityUpdate"?this.onSubscribedQualityUpdate&&this.onSubscribedQualityUpdate(i.value):i.case==="subscriptionPermissionUpdate"?this.onSubscriptionPermissionUpdate&&this.onSubscriptionPermissionUpdate(i.value):i.case==="refreshToken"?this.onTokenRefresh&&this.onTokenRefresh(i.value):i.case==="trackUnpublished"?this.onLocalTrackUnpublished&&this.onLocalTrackUnpublished(i.value):i.case==="subscriptionResponse"?this.onSubscriptionError&&this.onSubscriptionError(i.value):i.case==="pong"||(i.case==="pongResp"?(this.rtt=Date.now()-Number.parseInt(i.value.lastPingTimestamp.toString()),this.resetPingTimeout(),s=!0):i.case==="requestResponse"?this.onRequestResponse&&this.onRequestResponse(i.value):i.case==="trackSubscribed"?this.onLocalTrackSubscribed&&this.onLocalTrackSubscribed(i.value.trackSid):i.case==="roomMoved"?(this.onTokenRefresh&&this.onTokenRefresh(i.value.token),this.onRoomMoved&&this.onRoomMoved(i.value)):i.case==="mediaSectionsRequirement"?this.onMediaSectionsRequirement&&this.onMediaSectionsRequirement
787(i.value):i.case==="publishDataTrackResponse"?this.onPublishDataTrackResponse&&this.onPublishDataTrackResponse(i.value):i.case==="unpublishDataTrackResponse"?this.onUnPublishDataTrackResponse&&this.onUnPublishDataTrackResponse(i.value):i.case==="dataTrackSubscriberHandles"?this.onDataTrackSubscriberHandles&&this.onDataTrackSubscriberHandles(i.value):this.log.debug("unsupported message",{msgCase:i.case}));s||this.resetPingTimeout()}setReconnected(){for(;this.queuedRequests.length>0;){const e=this.queuedRequests.shift();e&&this.requestQueue.run(e)}}handleOnClose(e){return ce(this,void 0,void 0,function*(){if(this.state===mr.DISCONNECTED)return;const n=this.onClose;yield this.close(void 0,e),this.log.info("websocket connection closed: ".concat(e),{reason:e}),n&&n(e)})}handleWSError(e){this.log.error("websocket error",{error:e})}resetPingTimeout(){if(this.clearPingTimeout(),!this.pingTimeoutDuration){this.log.warn("ping timeout duration not set");return}this.pingTimeout=Fi.setTimeout(()=>{this.log.warn("ping timeout triggered. last pong received at: ".concat(new Date(Date.now()-this.pingTimeoutDuration*1e3).toUTCString())),this.handleOnClose("ping timeout")},this.pingTimeoutDuration*1e3)}clearPingTimeout(){this.pingTimeout&&Fi.clearTimeout(this.pingTimeout)}startPingInterval(){if(this.clearPingInterval(),this.resetPingTimeout(),!this.pingIntervalDuration){this.log.warn("ping interval duration not set");return}this.log.debug("start ping interval"),this.pingInterval=Fi.setInterval(()=>{this.sendPing()},this.pingIntervalDuration*1e3)}clearPingInterval(){this.log.debug("clearing ping interval"),this.clearPingTimeout(),this.pingInterval&&Fi.clearInterval(this.pingInterval)}handleSignalConnected(e,n,r){this.state=mr.CONNECTED,this.log.info("signal connected"),clearTimeout(n),this.startPingInterval(),this.startReadingLoop(e.readable.getReader(),r)}validateFirstMessage(e,n){var r,i,s,a,o;return((r=e.message)===null||r===void 0?void 0:r.case)==="join"?{isValid:!0,response:e.message.value}:this.state===mr.RECONNECTING&&((i=e.message)===null||i===void 0?void 0:i.case)!=="leave"?((s=e.message)===null||s===void 0?void 0:s.case)==="reconnect"?{isValid:!0,response:e.message.value}:(this.log.debug("declaring signal reconnected without reconnect response received"),{isValid:!0,response:void 0,shouldProcessFirstMessage:!0}):this.isEstablishingConnection&&((a=e.message)===null||a===void 0?void 0:a.case)==="leave"?{isValid:!1,error:Ot.leaveRequest("Received leave request while trying to (re)connect",e.message.value.reason)}:n?{isValid:!1,error:Ot.internal("Unexpected first message")}:{isValid:!1,error:Ot.internal("did not receive join response, got ".concat((o=e.message)===null||o===void 0?void 0:o.case," instead"))}}handleConnectionError(e,n){return ce(this,void 0,void 0,function*(){try{const r=yield fetch(n);switch(r.status){case 404:const i=yield r.text();return i.includes("requested room does not exist")?Ot.notAllowed(i,r.status):Ot.serviceNotFound("v1 RTC path not found. Consider upgrading your LiveKit server version","v0-rtc");case 401:case 403:const s=yield r.text();return Ot.notAllowed(s,r.status);default:break}return e instanceof Ot?e:Ot.internal("Encountered unknown websocket error during connection: ".concat(e),{status:r.status,statusText:r.statusText})}catch(r){return r instanceof Ot?r:Ot.serverUnreachable(r instanceof Error?r.message:"server was not reachable")}})}}function sz(t){const e={type:"offer",sdp:t.sdp};switch(t.type){case"answer":case"offer":case"pranswer":case"rollback":e.type=t.type;break}return e}function sp(t,e){return new rf({sdp:t.sdp,type:t.type,id:e})}function lBe(t,e,n){var r;const i=new URLSearchParams;return i.set("access_token",t),n.reconnect&&(i.set("reconnect","1"),n.sid&&i.set("sid",n.sid)),i.set("auto_subscribe",n.autoSubscribe?"1":"0"),i.set("sdk",su()?"reactnative":"js"),i.set("version",e.version),i.set("protocol",e.protocol.toString()),e.deviceModel&&i.set("device_model",e.deviceModel),e.os&&i.set("os",e.os),e.osVersion&&i.set("os_version",e.osVersion),e.browser&&i.set("browser",e.browser),e.browserVersion&&i.set("browser_version",e.browserVersion),n.adaptiveStream&&i.set("adaptive_stream","1"),n.reconnectReason&&i.set("reconnect_reason",n.reconnectReason.toString()),!((r=navigator.connection)===null||r===void 0)&&r.type&&i.set("network",navigator.connection.type),i}function cBe(t,e,n,r){return ce(this,void 0,void 0,function*(){const i=new URLSearchParams;i.set("access_token",t);const s=new Fje({clientInfo:e,connectionSettings:new wte({autoSubscribe:!!n.autoSubscribe,adaptiveStream:!!n.adaptiveStream}),reconnect:!!n.reconnect,participantSid:n.sid?n.sid:void 0,publisherOffer:r});n.reconnectReason&&(s.reconnectReason=n.reconnectReason);const a=s.toBinary();let o,l;
787if(t3()){const f=new CompressionStream("gzip"),h=f.writable.getWriter();h.write(new Uint8Array(a)),h.close();const p=[],m=f.readable.getReader();for(;;){const{done:b,value:x}=yield m.read();if(b)break;p.push(x)}const g=p.reduce((b,x)=>b+x.length,0),v=new Uint8Array(g);let _=0;for(const b of p)v.set(b,_),_+=b.length;o=v,l=jN.GZIP}else o=a,l=jN.NONE;const u=new jje({joinRequest:o,compression:l}).toBinary(),d=f=>{const h=Array.from(f,p=>String.fromCodePoint(p)).join("");return btoa(h)};return i.set("join_request",d(u).replace(/\+/g,"-").replace(/\//g,"_")),i})}class az{constructor(){this.buffer=[],this._totalSize=0}push(e){this.buffer.push(e),this._totalSize+=e.data.byteLength}pop(){const e=this.buffer.shift();return e&&(this._totalSize-=e.data.byteLength),e}getAll(){return this.buffer.slice()}popToSequence(e){for(;this.buffer.length>0&&this.buffer[0].sequence<=e;)this.pop()}alignBufferedAmount(e){for(;this.buffer.length>0;){const n=this.buffer[0];if(this._totalSize-n.data.byteLength<=e)break;this.pop()}}get length(){return this.buffer.length}}class uBe{constructor(e){this._map=new Map,this._lastCleanup=0,this.ttl=e}set(e,n){const r=Date.now();r-this._lastCleanup>this.ttl/2&&this.cleanup();const i=r+this.ttl;return this._map.set(e,{value:n,expiresAt:i}),this}get(e){const n=this._map.get(e);if(n){if(n.expiresAt<Date.now()){this._map.delete(e);return}return n.value}}has(e){const n=this._map.get(e);return n?n.expiresAt<Date.now()?(this._map.delete(e),!1):!0:!1}delete(e){return this._map.delete(e)}clear(){this._map.clear()}cleanup(){const e=Date.now();for(const[n,r]of this._map.entries())r.expiresAt<e&&this._map.delete(n);this._lastCleanup=e}get size(){return this.cleanup(),this._map.size}forEach(e){this.cleanup();for(const[n,r]of this._map.entries())r.expiresAt>=Date.now()&&e(r.value,n,this.asValueMap())}map(e){this.cleanup();const n=[],r=this.asValueMap();for(const[i,s]of r.entries())n.push(e(s,i,r));return n}asValueMap(){const e=new Map;for(const[n,r]of this._map.entries())r.expiresAt>=Date.now()&&e.set(n,r.value);return e}}var Tl={},tA={},nA={exports:{}},oz;function VO(){if(oz)return nA.exports;oz=1;var t=nA.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return e.address!=null?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return e.subtype!=null?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return e.sessionConfig!=null?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var n="candidate:%s %d %s %d %s %d typ %s";return n+=e.raddr!=null?" raddr %s rport %d":"%v%v",n+=e.tcptype!=null?" tcptype %s":"%v",e.generation!=null&&(n+=" generation %d"),n+=e["network-id"]!=null?" network-id %d":"%v",n+=e["network-cost"]!=null?" network-cost %d":"%v",n}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var n="ssrc:%d";return e.attribute!=null&&(n+=" %s",e.value!=null&&(n+=":%s")),n}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","max
787MessageSize"],format:function(e){return e.maxMessageSize!=null?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(e.clksrcExt!=null?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var n="mediaclk:";return n+=e.id!=null?"id=%s %s":"%v%s",n+=e.mediaClockValue!=null?"=%s":"",n+=e.rateNumerator!=null?" rate=%s":"",n+=e.rateDenominator!=null?"/%s":"",n}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};return Object.keys(t).forEach(function(e){var n=t[e];n.forEach(function(r){r.reg||(r.reg=/(.*)/),r.format||(r.format="%s")})}),nA.exports}var lz;function dBe(){return lz||(lz=1,function(t){var e=function(o){return String(Number(o))===o?Number(o):o},n=function(o,l,c,u){if(u&&!c)l[u]=e(o[1]);else for(var d=0;d<c.length;d+=1)o[d+1]!=null&&(l[c[d]]=e(o[d+1]))},r=function(o,l,c){var u=o.name&&o.names;o.push&&!l[o.push]?l[o.push]=[]:u&&!l[o.name]&&(l[o.name]={});var d=o.push?{}:u?l[o.name]:l;n(c.match(o.reg),d,o.names,o.name),o.push&&l[o.push].push(d)},i=VO(),s=RegExp.prototype.test.bind(/^([a-z])=(.*)/);t.parse=function(o){var l={},c=[],u=l;return o.split(/(\r\n|\r|\n)/).filter(s).forEach(function(d){var f=d[0],h=d.slice(2);f==="m"&&(c.push({rtp:[],fmtp:[]}),u=c[c.length-1]);for(var p=0;p<(i[f]||[]).length;p+=1){var m=i[f][p];if(m.reg.test(h))return r(m,u,h)}}),l.media=c,l};var a=function(o,l){var c=l.split(/=(.+)/,2);return c.length===2?o[c[0]]=e(c[1]):c.length===1&&l.length>1&&(o[c[0]]=void 0),o};t.parseParams=function(o){return o.split(/;\s?/).reduce(a,{})},t.parseFmtpConfig=t.parseParams,t.parsePayloads=function(o){return o.toString().split(" ").map(Number)},t.parseRemoteCandidates=function(o){for(var l=[],c=o.split(" ").map(e),u=0;u<c.length;u+=3)l.push({component:c[u],ip:c[u+1],port:c[u+2]});return l},t.parseImageAttributes=function(o){return o.split(" ").map(function(l){return l.substring(1,l.length-1).split(",").reduce(a,{})})},t.parseSimulcastStreamList=function(o){return o.split(";").map(function(l){return l.split(",").map(function(c){var u,d=!1;return c[0]!=="~"?u=e(c):(u=e(c.substring(1,c.length)),d=!0),{scid:u,paused:d}})})}}(tA)),tA}var rA,cz;
vendor: 1,184 bytes, line 787
787function hBe(){if(cz)return rA;cz=1;var t=VO(),e=/%[sdv%]/g,n=function(a){var o=1,l=arguments,c=l.length;return a.replace(e,function(u){if(o>=c)return u;var d=l[o];switch(o+=1,u){case"%%":return"%";case"%s":return String(d);case"%d":return Number(d);case"%v":return""}})},r=function(a,o,l){var c=o.format instanceof Function?o.format(o.push?l:l[o.name]):o.format,u=[a+"="+c];if(o.names)for(var d=0;d<o.names.length;d+=1){var f=o.names[d];o.name?u.push(l[o.name][f]):u.push(l[o.names[d]])}else u.push(l[o.name]);return n.apply(null,u)},i=["v","o","s","i","u","e","p","c","b","t","r","z","a"],s=["i","c","b","a"];return rA=function(a,o){o=o||{},a.version==null&&(a.version=0),a.name==null&&(a.name=" "),a.media.forEach(function(d){d.payloads==null&&(d.payloads="")});var l=o.outerOrder||i,c=o.innerOrder||s,u=[];return l.forEach(function(d){t[d].forEach(function(f){f.name in a&&a[f.name]!=null?u.push(r(d,f,a)):f.push in a&&a[f.push]!=null&&a[f.push].forEach(function(h){u.push(r(d,f,h))})})}),a.media.forEach(function(d){u.push(r("m",t.m[0],d)),c.forEach(function(f){t[f].forEach(function(h){h.name in d&&d[h.name]!=null?u.push(r(f,h,d)):h.push in d&&d[h.push]!=null&&d[h.push].forEac
787h(function(p){u.push(r(f,h,p))})})})}),u.join(`\r 788`)+`\r 789`},rA}var uz;function fBe(){if(uz)return Tl;uz=1;var t=dBe(),e=hBe(),n=VO();return Tl.grammar=n,Tl.write=e,Tl.parse=t.parse,Tl.parseParams=t.parseParams,Tl.parseFmtpConfig=t.parseFmtpConfig,Tl.parsePayloads=t.parsePayloads,Tl.parseRemoteCandidates=t.parseRemoteCandidates,Tl.parseImageAttributes=t.parseImageAttributes,Tl.parseSimulcastStreamList=t.parseSimulcastStreamList,Tl}var Vo=fBe();function qO(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:50,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r,i;let s;const a=(r=n.isImmediate)!==null&&r!==void 0?r:!1,o=(i=n.callback)!==null&&i!==void 0?i:!1,l=n.maxWait;let c=Date.now(),u=[];function d(){if(l!==void 0){const h=Date.now()-c;if(h+e>=l)return l-h}return e}const f=function(){for(var h=arguments.length,p=new Array(h),m=0;m<h;m++)p[m]=arguments[m];const g=this;return new Promise((v,_)=>{const b=function(){if(s=void 0,c=Date.now(),!a){const T=t.apply(g,p);o&&o(T),u.forEach(N=>{let{resolve:A}=N;return A(T)}),u=[]}},x=a&&s===void 0;if(s!==void 0&&Fi.clearTimeout(s),s=Fi.setTimeout(b,d()),x){const T=t.apply(g,p);return o&&o(T),v(T)}u.push({resolve:v,reject:_})})};return f.cancel=function(h){s!==void 0&&Fi.clearTimeout(s),u.forEach(p=>{let{reject:m}=p;return m(h)}),u=[]},f}const pBe=.7,mBe=20,_p={NegotiationStarted:"negotiationStarted",NegotiationComplete:"negotiationComplete",OfferAnswered:"offerAnswered",RTPVideoPayloadTypes:"rtpVideoPayloadTypes"};class dz extends al.EventEmitter{get pc(){return this._pc||(this._pc=this.createPC()),this._pc}constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var r;super(),this.log=mn,this.ddExtID=0,this.latestOfferId=0,this.latestAcknowledgedOfferId=0,this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate=!1,this.trackBitrates=[],this.remoteStereoMids=[],this.remoteNackMids=[],this.negotiate=qO(i=>ce(this,void 0,void 0,function*(){this.emit(_p.NegotiationStarted);try{yield this.createAndSendOffer()}catch(s){if(i)i(s);else throw s}}),mBe),this.close=()=>{this._pc&&(this.pendingInitialOffer=void 0,this._pc.close(),this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.ondatachannel=null,this._pc.onnegotiationneeded=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ondatachannel=null,this._pc.ontrack=null,this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,this._pc=null)},this.log=Xa((r=n.loggerName)!==null&&r!==void 0?r:hs.PCTransport),this.loggerOptions=n,this.config=e,this._pc=this.createPC(),this.offerLock=new As}createPC(){const e=new RTCPeerConnection(this.config);return e.onicecandidate=n=>{var r;n.candidate&&((r=this.onIceCandidate)===null||r===void 0||r.call(this,n.candidate))},e.onicecandidateerror=n=>{var r;(r=this.onIceCandidateError)===null||r===void 0||r.call(this,n)},e.oniceconnectionstatechange=()=>{var n;(n=this.onIceConnectionStateChange)===null||n===void 0||n.call(this,e.iceConnectionState)},e.onsignalingstatechange=()=>{var n;(n=this.onSignalingStatechange)===null||n===void 0||n.call(this,e.signalingState)},e.onconnectionstatechange=()=>{var n;(n=this.onConnectionStateChange)===null||n===void 0||n.call(this,e.connectionState)},e.ondatachannel=n=>{var r;(r=this.onDataChannel)===null||r===void 0||r.call(this,n)},e.ontrack=n=>{var r;(r=this.onTrack)===null||r===void 0||r.call(this,n)},e}get logContext(){var e,n;return Object.assign({},(n=(e=this.loggerOptions).loggerContextCb)===null||n===void 0?void 0:n.call(e))}get isICEConnected(){return this._pc!==null&&(this.pc.iceConnectionState==="connected"||this.pc.iceConnectionState==="completed")}addIceCandidate(e){return ce(this,void 0,void 0,function*(){if(this.pc.remoteDescription&&!this.restartingIce)return this.pc.addIceCandidate(e);this.pendingCandidates.push(e)})}setRemoteDescription(e,n){return ce(this,void 0,void 0,function*(){var r,i;if(e.type==="answer"&&this.latestOfferId>0&&n>0&&n!==this.latestOfferId)return this.log.warn("ignoring answer for old offer",Object.assign(Object.assign({},this.logContext),{offerId:n,latestOfferId:this.latestOfferId})),!1;let s;if(e.type==="offer"){let{stereoMids:a,nackMids:o}=gBe(e);this.remoteStereoMids=a,this.remoteNackMids=o}else if(e.type==="answer"){if(this.pendingInitialOffer&&this._pc){const o=this.pendingInitialOffer;this.pendingInitialOffer=void 0;const l=Vo.parse((r=o.sdp)!==null&&r!==void 0?r:"");
789l.media.forEach(c=>{T2(c)}),this.log.debug("setting pending initial offer before processing answer",this.logContext),yield this.setMungedSDP(o,Vo.write(l))}const a=Vo.parse((i=e.sdp)!==null&&i!==void 0?i:"");a.media.forEach(o=>{const l=WO(o.mid);o.type==="audio"&&this.trackBitrates.some(c=>{if(!c.transceiver||l!=c.transceiver.mid)return!1;let u=0;if(o.rtp.some(f=>f.codec.toUpperCase()===c.codec.toUpperCase()?(u=f.payload,!0):!1),u===0)return!0;let d=!1;for(const f of o.fmtp)if(f.payload===u){f.config=f.config.split(";").filter(h=>!h.includes("maxaveragebitrate")).join(";"),c.maxbr>0&&(f.config+=";maxaveragebitrate=".concat(c.maxbr*1e3)),d=!0;break}return d||c.maxbr>0&&o.fmtp.push({payload:u,config:"maxaveragebitrate=".concat(c.maxbr*1e3)}),!0})}),s=Vo.write(a)}return yield this.setMungedSDP(e,s,!0),this.pendingCandidates.forEach(a=>{this.pc.addIceCandidate(a)}),this.pendingCandidates=[],this.restartingIce=!1,e.type==="answer"&&(this.latestAcknowledgedOfferId=n,this.emit(_p.OfferAnswered,n)),this.renegotiate?(this.renegotiate=!1,yield this.createAndSendOffer()):e.type==="answer"&&(this.emit
789(_p.NegotiationComplete),e.sdp&&Vo.parse(e.sdp).media.forEach(o=>{o.type==="video"&&this.emit(_p.RTPVideoPayloadTypes,o.rtp)})),!0})}createInitialOffer(){return ce(this,void 0,void 0,function*(){var e;const n=yield this.offerLock.lock();try{if(this.pc.signalingState!=="stable"){this.log.warn("signaling state is not stable, cannot create initial offer",this.logContext);return}const r=this.latestOfferId+1;this.latestOfferId=r;const i=yield this.pc.createOffer();this.pendingInitialOffer={sdp:i.sdp,type:i.type};const s=Vo.parse((e=i.sdp)!==null&&e!==void 0?e:"");return s.media.forEach(a=>{T2(a)}),i.sdp=Vo.write(s),{offer:i,offerId:r}}finally{n()}})}createAndSendOffer(e){return ce(this,void 0,void 0,function*(){var n;const r=yield this.offerLock.lock();try{if(this.onOffer===void 0)return;if(e!=null&&e.iceRestart&&(this.log.debug("restarting ICE",this.logContext),this.restartingIce=!0),this._pc&&(this._pc.signalingState==="have-local-offer"||this.pendingInitialOffer)){const o=this._pc.remoteDescription;if(e!=null&&e.iceRestart&&o)yield this._pc.setRemoteDescription(o);else{this.renegotiate=!0,this.log.debug("requesting renegotiation",Object.assign({},this.logContext));return}}else if(!this._pc||this._pc.signalingState==="closed"){this.log.warn("could not createOffer with closed peer connection",this.logContext);return}this.log.debug("starting to negotiate",this.logContext);const i=this.latestOfferId+1;this.latestOfferId=i;const s=yield this.pc.createOffer(e);this.log.debug("original offer",Object.assign({sdp:s.sdp},this.logContext));const a=Vo.parse((n=s.sdp)!==null&&n!==void 0?n:"");if(a.media.forEach(o=>{T2(o),o.type==="audio"?hz(o,["all"],[]):o.type==="video"&&this.trackBitrates.some(l=>{if(!o.msid||!l.cid||!o.msid.includes(l.cid))return!1;let c=0;if(o.rtp.some(d=>d.codec.toUpperCase()===l.codec.toUpperCase()?(c=d.payload,!0):!1),c===0||(ql(l.codec)&&!Jp()&&this.ensureVideoDDExtensionForSVC(o,a),!ql(l.codec)))return!0;const u=Math.round(l.maxbr*pBe);for(const d of o.fmtp)if(d.payload===c){d.config.includes("x-google-start-bitrate")||(d.config+=";x-google-start-bitrate=".concat(u));break}return!0})}),this.latestOfferId>i){this.log.warn("latestOfferId mismatch",Object.assign(Object.assign({},this.logContext),{latestOfferId:this.latestOfferId,offerId:i}));return}yield this.setMungedSDP(s,Vo.write(a)),this.onOffer(s,this.latestOfferId)}finally{r()}})}createAndSetAnswer(){return ce(this,void 0,void 0,function*(){var e;const n=yield this.pc.createAnswer(),r=Vo.parse((e=n.sdp)!==null&&e!==void 0?e:"");return r.media.forEach(i=>{T2(i),i.type==="audio"&&hz(i,this.remoteStereoMids,this.remoteNackMids)}),yield this.setMungedSDP(n,Vo.write(r)),n})}createDataChannel(e,n){return this.pc.createDataChannel(e,n)}addTransceiver(e,n){return this.pc.addTransceiver(e,n)}addTransceiverOfKind(e,n){return this.pc.addTransceiver(e,n)}addTrack(e){if(!this._pc)throw new Yr("PC closed, cannot add track");return this._pc.addTrack(e)}setTrackCodecBitrate(e){this.trackBitrates.push(e)}setConfiguration(e){var n;if(!this._pc)throw new Yr("PC closed, cannot configure");return(n=this._pc)===null||n===void 0?void 0:n.setConfiguration(e)}canRemoveTrack(){var e;return!!(!((e=this._pc)===null||e===void 0)&&e.removeTrack)}removeTrack(e){var n;return(n=this._pc)===null||n===void 0?void 0:n.removeTrack(e)}getConnectionState(){var e,n;return(n=(e=this._pc)===null||e===void 0?void 0:e.connectionState)!==null&&n!==void 0?n:"closed"}getICEConnectionState(){var e,n;return(n=(e=this._pc)===null||e===void 0?void 0:e.iceConnectionState)!==null&&n!==void 0?n:"closed"}getSignallingState(){var e,n;return(n=(e=this._pc)===null||e===void 0?void 0:e.signalingState)!==null&&n!==void 0?n:"closed"}getTransceivers(){var e,n;return(n=(e=this._pc)===null||e===void 0?void 0:e.getTransceivers())!==null&&n!==void 0?n:[]}getSenders(){var e,n;return(n=(e=this._pc)===null||e===void 0?void 0:e.getSenders())!==null&&n!==void 0?n:[]}getLocalDescription(){var e;return(e=this._pc)===null||e===void 0?void 0:e.localDescription}getRemoteDescription(){var e;return(e=this.pc)===null||e===void 0?void 0:e.remoteDescription}getStats(){return this.pc.getStats()}getConnectedAddress(){return ce(this,void 0,void 0,function*(){var e;if(!this._pc)return;let n="";const r=new Map,i=new Map;
789if((yield this._pc.getStats()).forEach(o=>{switch(o.type){case"transport":n=o.selectedCandidatePairId;break;case"candidate-pair":n===""&&o.selected&&(n=o.id),r.set(o.id,o);break;case"remote-candidate":i.set(o.id,"".concat(o.address,":").concat(o.port));break}}),n==="")return;const a=(e=r.get(n))===null||e===void 0?void 0:e.remoteCandidateId;if(a!==void 0)return i.get(a)})}setMungedSDP(e,n,r){return ce(this,void 0,void 0,function*(){var i,s;const a=e.sdp;if(n){e.sdp=n;try{this.log.debug("setting munged ".concat(r?"remote":"local"," description"),this.logContext),r?yield this.pc.setRemoteDescription(e):yield this.pc.setLocalDescription(e);return}catch(o){this.log.warn("not able to set ".concat(e.type,", falling back to unmodified sdp"),Object.assign(Object.assign({},this.logContext),{error:o,mungedSdp:n,originalSdp:a})),e.sdp=a}}try{r?yield(i=this._pc)===null||i===void 0?void 0:i.setRemoteDescription(e):yield(s=this._pc)===null||s===void 0?void 0:s.setLocalDescription(e)}catch(o){let l="unknown error";o instanceof Error?l=o.message:typeof o=="string"&&(l=o);const c={error:l,sdp:e.sdp};throw n&&n!==a&&(c.mungedSdp=n),!r&&this.pc.remoteDescription&&(c.remoteSdp=this.pc.remoteDescription),this.log.error("unable to set ".concat(e.type),Object.assign(Object.assign({},this.logContext),{fields:c})),new Rp(l)}})}ensureVideoDDExtensionForSVC(e,n){var r,i;if(!((r=e.ext)===null||r===void 0?void 0:r.some(a=>a.uri===K7))){if(this.ddExtID===0){let a=0;n.media.forEach(o=>{var l;(l=o.ext)===null||l===void 0||l.forEach(c=>{c.value>a&&(a=c.value)})}),this.ddExtID=a+1}(i=e.ext)===null||i===void 0||i.push({value:this.ddExtID,uri:K7})}}}function hz(t,e,n){const r=WO(t.mid);let i=0;t.rtp.some(s=>s.codec==="opus"?(i=s.payload,!0):!1),i>0&&(t.rtcpFb||(t.rtcpFb=[]),n.includes(r)&&!t.rtcpFb.some(s=>s.payload===i&&s.type==="nack")&&t.rtcpFb.push({payload:i,type:"nack"}),(e.includes(r)||e.length===1&&e[0]==="all")&&t.fmtp.some(s=>s.payload===i?(s.config.includes("stereo=1")||(s.config+=";stereo=1"),!0):!1))}function gBe(t){var e;const n=[],r=[],i=Vo.parse((e=t.sdp)!==null&&e!==void 0?e:"");let s=0;return i.media.forEach(a=>{var o;const l=WO(a.mid);a.type==="audio"&&(a.rtp.some(c=>c.codec==="opus"?(s=c.payload,!0):!1),!((o=a.rtcpFb)===null||o===void 0)&&o.some(c=>c.payload===s&&c.type==="nack")&&r.push(l),a.fmtp.some(c=>c.payload===s?(c.config.includes("sprop-stereo=1")&&n.push(l),!0):!1))}),{stereoMids:n,nackMids:r}}function T2(t){if(t.connection){const e=t.connection.ip.indexOf(":")>=0;(t.connection.version===4&&e||t.connection.version===6&&!e)&&(t.connection.ip="0.0.0.0",t.connection.version=4)}}function WO(t){return typeof t=="number"?t.toFixed(0):t}const r3="vp8",vBe={audioPreset:HN.music,dtx:!0,red:!0,forceStereo:!1,simulcast:!0,screenShareEncoding:FO.h1080fps15.encoding,stopMicTrackOnMute:!1,videoCodec:r3,backupCodec:!0,preConnectBuffer:!1},une={deviceId:{ideal:"default"},autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,voiceIsolation:!0},dne={deviceId:{ideal:"default"},resolution:zw.h720.resolution},yBe={adaptiveStream:!1,dynacast:!1,stopLocalTrackOnUnpublish:!0,reconnectPolicy:new Gje,disconnectOnPageLeave:!0,webAudioMix:!1,singlePeerConnection:!0},GO={autoSubscribe:!0,maxRetries:1,peerConnectionTimeout:15e3,websocketTimeout:15e3};var Qr;(function(t){t[t.NEW=0]="NEW",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED",t[t.FAILED=3]="FAILED",t[t.CLOSING=4]="CLOSING",t[t.CLOSED=5]="CLOSED"})(Qr||(Qr={}));class fz{get needsPublisher(){return this.isPublisherConnectionRequired}get needsSubscriber(){return this.isSubscriberConnectionRequired}get currentState(){return this.state}get mode(){return this._mode}constructor(e,n,r){var i;this.peerConnectionTimeout=GO.peerConnectionTimeout,this.log=mn,this.updateState=()=>{var s,a;const o=this.state,l=this.requiredTransports.map(c=>c.getConnectionState());l.every(c=>c==="connected")?this.state=Qr.CONNECTED:l.some(c=>c==="failed")?this.state=Qr.FAILED:l.some(c=>c==="connecting")?this.state=Qr.CONNECTING:l.every(c=>c==="closed")?this.state=Qr.CLOSED:l.some(c=>c==="closed")?this.state=Qr.CLOSING:l.every(c=>c==="new")&&(this.state=Qr.NEW),o!==this.state&&(this.log.debug("pc state change: from ".concat(Qr[o]," to ").concat(Qr[this.state]),this.logContext),(s=this.onStateChange)===null||s===void 0||s.call(this,this.state,this.publisher.getConnectionState(),(a=this.subscriber)===null||a===void 0?void 0:a.getConnectionState()))},this.log=Xa((i=n.loggerName)!==null&&i!==void 0?i:hs.PCManager),this.loggerOptions=n,this.isPublisherConnectionRequired=e!=="subscriber-primary",this.isSubscriberConnectionRequired=e==="subscriber-primary",this.publisher=new dz(r,n),this._mode=e,e!=="publisher-only"&&(this.subscriber=new dz(r,n),this.subscriber.onConnectionStateChange=this.updateState,this.subscriber.onIceConnectionStateChange=this.updateState,this.subscriber.onSignalingStatechange=this.updateState,this.subscriber.onIceCandidate=s=>{var a;(a=this.onIceCandidate)===null||a===void 0||a.call(this,s,$l.SUBSCRIBER)},this.subscriber.onDataChannel=s=>{var a;(a=this.onDataChannel)===null||a===void 0||a.call(this,s)},this.subscriber.onTrack=s=>{var a;(a=this.onTrack)===null||a===void 0||a.call(this,s)}),this.publisher.onConnectionStateChange=this.updateState,this.publisher.onIceConnectionStateChange=this.updateState,this.publisher.onSignalingStatechange=this.updateState,this.publisher.onIceCandidate=s=>{var a;(a=this.onIceCandidate)===null||a===void 0||a.call(this,s,$l.PUBLISHER)},this.publisher.onTrack=s=>{var a;(a=this.onTrack)===null||a===void 0||a.call(this,s)},this.publisher.onOffer=(s,a)=>{var o;(o=this.onPublisherOffer)===null||o===void 0||o.call(this,s,a)},this.state=Qr.NEW,this.connectionLock=new As,this.remoteOfferLock=new As}get logContext(){var e,n;return Object.assign({},(n=(e=this.loggerOptions).loggerContextCb)===null||n===void 0?void 0:n.call(e))}requirePublisher(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.isPublisherConnectionRequired=e,this.updateState()}createAndSendPublisherOffer(e){return this.publisher.createAndSendOffer(e)}setPublisherAnswer(e,n){return this.publisher.setRemoteDescription(e,n)}removeTrack(e){return this.publisher.removeTrack(e)}close(){return ce(this,void 0,void 0,function*(){var e;if(this.publisher&&this.publisher.getSignallingState()!=="closed"){const n=this.publisher;for(const r of n.getSenders())try{n.canRemoveTrack()&&n.removeTrack(r)}catch(i){this.log.warn("could not removeTrack",Object.assign(Object.assign({},this.logContext),{error:i}))}}yield Promise.all([this.publisher.close(),(e=this.subscriber)===null||e===void 0?void 0:e.close()]),this.updateState()})}triggerIceRestart(){return ce(this,void 0,void 0,function*(){this.subscriber&&(this.subscriber.restartingIce=!0),this.needsPublisher&&(yield this.createAndSendPublisherOffer({iceRestart:!0}))})}addIceCandidate(e,n){return ce(this,void 0,void 0,function*(){var r;n===$l.PUBLISHER?yield this.publisher.addIceCandidate(e):yield(r=this.subscriber)===null||r===void 0?void 0:r.addIceCandidate(e)})}createSubscriberAnswerFromOffer(e,n){return ce(this,void 0,void 0,function*(){var r,i,s;this.log.debug("received server offer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:e.type,sdp:e.sdp,signalingState:(r=this.subscriber)===null||r===void 0?void 0:r.getSignallingState().toString()}));const a=yield this.remoteOfferLock.lock();try{return(yield(i=this.subscriber)===null||i===void 0?void 0:i.setRemoteDescription(e,n))?yield(s=this.subscriber)===null||s===void 0?void 0:s.createAndSetAnswer():void 0}finally{a()}})}updateConfiguration(e,n){var r;this.publisher.setConfiguration(e),(r=this.subscriber)===null||r===void 0||r.setConfiguration(e),n&&this.triggerIceRestart()}ensurePCTransportConnection(e,n){return ce(this,void 0,void 0,function*(){var r;const i=yield this.connectionLock.lock();try{this.isPublisherConnectionRequired&&this.publisher.getConnectionState()!=="connected"&&this.publisher.getConnectionState()!=="connecting"&&(this.log.debug("negotiation required, start negotiating",this.logContext),this.publisher.negotiate()),yield Promise.all((r=this.requiredTransports)===null||r===void 0?void 0:r.map(s=>
789this.ensureTransportConnected(s,e,n)))}finally{i()}})}negotiate(e){return ce(this,void 0,void 0,function*(){return new Xs((n,r)=>{const i=this.publisher.latestOfferId;if(this.publisher.latestAcknowledgedOfferId>i){this.log.debug("negotiation already handled in more recent acknowledged offer",this.logContext),n();return}let s=!1;const a=()=>{s||(s=!0,clearTimeout(c),this.publisher.off(_p.OfferAnswered,o),e.signal.removeEventListener("abort",l))},o=u=>{u>i&&(a(),n())},l=()=>{a(),r(new Rp("negotiation aborted"))},c=setTimeout(()=>{a(),r(new Rp("negotiation timed out"))},this.peerConnectionTimeout);e.signal.addEventListener("abort",l),this.publisher.on(_p.OfferAnswered,o),this.publisher.negotiate(u=>{a(),u instanceof Error?r(u):r(new Error(String(u)))})})})}addPublisherTransceiver(e,n){return this.publisher.addTransceiver(e,n)}addPublisherTransceiverOfKind(e,n){return this.publisher.addTransceiverOfKind(e,n)}getMidForReceiver(e){const r=(this.subscriber?this.subscriber.getTransceivers():this.publisher.getTransceivers()).find(i=>i.receiver===e);return r==null?void 0:r.mid}addPublisherTrack(e){return this.publisher.addTrack(e)}createPublisherDataChannel(e,n){return this.publisher.createDataChannel(e,n)}getConnectedAddress(e){return e===$l.PUBLISHER?this.publisher.getConnectedAddress():e===$l.SUBSCRIBER?this.publisher.getConnectedAddress():this.requiredTransports[0].getConnectedAddress()}get requiredTransports(){const e=[];return this.isPublisherConnectionRequired&&e.push(this.publisher),this.isSubscriberConnectionRequired&&this.subscriber&&e.push(this.subscriber),e}ensureTransportConnected(e,n){return ce(this,arguments,void 0,function(r,i){var s=this;let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.peerConnectionTimeout;return function*(){if(r.getConnectionState()!=="connected")return new Promise((l,c)=>ce(s,void 0,void 0,function*(){const u=()=>{this.log.warn("abort transport connection",this.logContext),Fi.clearTimeout(d),c(Ot.cancelled("room connection has been cancelled"))};i!=null&&i.signal.aborted&&u(),i==null||i.signal.addEventListener("abort",u);const d=Fi.setTimeout(()=>{i==null||i.signal.removeEventListener("abort",u),c(Ot.internal("could not establish pc connection"))},a);for(;this.state!==Qr.CONNECTED;)if(yield Zs(50),i!=null&&i.signal.aborted){c(Ot.cancelled("room connection has been cancelled"));return}Fi.clearTimeout(d),i==null||i.signal.removeEventListener("abort",u),l()}))}()})}}class gi extends Error{constructor(e,n,r){super(n),this.code=e,this.message=pz(n,gi.MAX_MESSAGE_BYTES),this.data=r?pz(r,gi.MAX_DATA_BYTES):void 0}static fromProto(e){return new gi(e.code,e.message,e.data)}toProto(){return new Zee({code:this.code,message:this.message,data:this.data})}static builtIn(e,n){return new gi(gi.ErrorCode[e],gi.ErrorMessage[e],n)}}gi.MAX_MESSAGE_BYTES=256;gi.MAX_DATA_BYTES=15360;gi.ErrorCode={APPLICATION_ERROR:1500,CONNECTION_TIMEOUT:1501,RESPONSE_TIMEOUT:1502,RECIPIENT_DISCONNECTED:1503,RESPONSE_PAYLOAD_TOO_LARGE:1504,SEND_FAILED:1505,UNSUPPORTED_METHOD:1400,RECIPIENT_NOT_FOUND:1401,REQUEST_PAYLOAD_TOO_LARGE:1402,UNSUPPORTED_SERVER:1403,UNSUPPORTED_VERSION:1404};gi.ErrorMessage={APPLICATION_ERROR:"Application error in method handler",CONNECTION_TIMEOUT:"Connection timeout",RESPONSE_TIMEOUT:"Response timeout",RECIPIENT_DISCONNECTED:"Recipient disconnected",RESPONSE_PAYLOAD_TOO_LARGE:"Response payload too large",SEND_FAILED:"Failed to send",UNSUPPORTED_METHOD:"Method not supported at destination",RECIPIENT_NOT_FOUND:"Recipient not found",REQUEST_PAYLOAD_TOO_LARGE:"Request payload too large",UNSUPPORTED_SERVER:"RPC not supported by server",UNSUPPORTED_VERSION:"Unsupported RPC version"};const hne=15360;function HO(t){return new TextEncoder().encode(t).length}function pz(t,e){if(HO(t)<=e)return t;let n=0,r=t.length;const i=new TextEncoder;for(;n<r;){const s=Math.floor((n+r+1)/2);i.encode(t.slice(0,s)).length<=e?n=s:r=s-1}return t.slice(0,n)}const KO=2e3;function cC(t,e){if(!e)return 0;let n,r;return"bytesReceived"in t?(n=t.bytesReceived,r=e.bytesReceived):"bytesSent"in t&&(n=t.bytesSent,r=e.bytesSent),n===void 0||r===void 0||t.timestamp===void 0||e.timestamp===void 0?0:(n-r)*8*1e3/(t.timestamp-e.timestamp)}const JO=typeof MediaRecorder<"u";class _Be{constructor(){throw new Error("MediaRecorder is not available in this environment")}}const wBe=JO?MediaRecorder:_Be;class bBe extends wBe{constructor(e,n){if(!JO)throw new Error("MediaRecorder is not available in this environment");super(new MediaStream([e.mediaStreamTrack]),n);let r,i;const s=()=>i===void 0,a=()=>{this.removeEventListener("dataavailable",r),this.removeEventListener("stop",a),this.removeEventListener("error",o),i==null||i.close(),i=void 0},o=l=>{i==null||i.error(l),this.removeEventListener("dataavailable",r),this.removeEventListener("stop",a),this.removeEventListener("error",o),i=void 0};this.byteStream=new ReadableStream({start:l=>{i=l,r=c=>ce(this,void 0,void 0,function*(){let u;if(c.data.arrayBuffer){const d=yield c.data.arrayBuffer();u=new Uint8Array(d)}else if(c.data.byteArray)u=c.data.byteArray;else throw new Error("no data available!");s()||l.enqueue(u)}),this.addEventListener("dataavailable",r)},cancel:()=>{a()}}),this.addEventListener("stop",a),this.addEventListener("error",o)}}function xBe(){return JO}const kBe=1e3,SBe=1e4;class fne extends je{get sender(){return this._sender}set sender(e){this._sender=e}get constraints(){return this._constraints}get hasPreConnectBuffer(){return!!this.localTrackRecorder}constructor(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,s=arguments.length>4?arguments[4]:void 0;super(e,n,s),this.manuallyStopped=!1,this.pendingDeviceChange=!1,this._isUpstreamPaused=!1,this.handleTrackMuteEvent=()=>this.debouncedTrackMuteHandler().catch(()=>this.log.debug("track mute bounce got cancelled by an unmute event",this.logContext)),this.debouncedTrackMuteHandler=qO(()=>ce(this,void 0,void 0,function*(){yield this.pauseUpstream()}),5e3),this.handleTrackUnmuteEvent=()=>ce(this,void 0,void 0,function*(){this.debouncedTrackMuteHandler.cancel("unmute"),yield this.resumeUpstream()}),this.handleEnded=()=>
789{this.isInBackground&&(this.reacquireTrack=!0),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent),this.emit(Qe.Ended,this)},this.reacquireTrack=!1,this.providedByUser=i,this.muteLock=new As,this.pauseUpstreamLock=new As,this.trackChangeLock=new As,this.trackChangeLock.lock().then(a=>ce(this,void 0,void 0,function*(){try{yield this.setMediaStreamTrack(e,!0)}finally{a()}})),this._constraints=e.getConstraints(),r&&(this._constraints=r)}get id(){return this._mediaStreamTrack.id}get dimensions(){if(this.kind!==je.Kind.Video)return;const{width:e,height:n}=this._mediaStreamTrack.getSettings();if(e&&n)return{width:e,height:n}}get isUpstreamPaused(){return this._isUpstreamPaused}get isUserProvided(){return this.providedByUser}get mediaStreamTrack(){var e,n;return(n=(e=this.processor)===null||e===void 0?void 0:e.processedTrack)!==null&&n!==void 0?n:this._mediaStreamTrack}get isLocal(){return!0}getSourceTrackSettings(){return this._mediaStreamTrack.getSettings()}setMediaStreamTrack(e,n,r){return ce(this,void 0,void 0,function*(){var i;if(e===this._mediaStreamTrack&&!n)return;this._mediaStreamTrack&&(this.attachedElements.forEach(a=>{dv(this._mediaStreamTrack,a)}),this.debouncedTrackMuteHandler.cancel("new-track"),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent)),this.mediaStream=new MediaStream([e]),e&&(e.addEventListener("ended",this.handleEnded),e.addEventListener("mute",this.handleTrackMuteEvent),e.addEventListener("unmute",this.handleTrackUnmuteEvent),this._constraints=e.getConstraints());let s;if(this.processor&&e){if(this.log.debug("restarting processor",this.logContext),this.kind==="unknown")throw TypeError("cannot set processor on track of unknown kind");this.processorElement&&(zg(e,this.processorElement),this.processorElement.muted=!0),yield this.processor.restart({track:e,kind:this.kind,element:this.processorElement,localTrack:this}),s=this.processor.processedTrack}this.sender&&((i=this.sender.transport)===null||i===void 0?void 0:i.state)!=="closed"&&(yield this.sender.replaceTrack(s??e)),!this.providedByUser&&this._mediaStreamTrack!==e&&this._mediaStreamTrack.stop(),this._mediaStreamTrack=e,e&&(this._mediaStreamTrack.enabled=r?!0:!this.isMuted,yield this.resumeUpstream(),this.attachedElements.forEach(a=>{zg(s??e,a)}))})}waitForDimensions(){return ce(this,arguments,void 0,function(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:kBe;return function*(){var r;if(e.kind===je.Kind.Audio)throw new Error("cannot get dimensions for audio tracks");((r=Ca())===null||r===void 0?void 0:r.os)==="iOS"&&(yield Zs(10));const i=Date.now();for(;Date.now()-i<n;){const s=e.dimensions;if(s)return s;yield Zs(50)}throw new td("unable to get track dimensions after timeout")}()})}setDeviceId(e){return ce(this,void 0,void 0,function*(){return this._constraints.deviceId===e&&this._mediaStreamTrack.getSettings().deviceId===Ip(e)?!0:(this._constraints.deviceId=e,this.isMuted?(this.pendingDeviceChange=!0,!0):(yield this.restartTrack(),Ip(e)===this._mediaStreamTrack.getSettings().deviceId))})}getDeviceId(){return ce(this,arguments,void 0,function(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){if(e.source===je.Source.ScreenShare)return;const{deviceId:r,groupId:i}=e._mediaStreamTrack.getSettings(),s=e.kind===je.Kind.Audio?"audioinput":"videoinput";return n?cs.getInstance().normalizeDeviceId(s,r,i):r}()})}mute(){return ce(this,void 0,void 0,function*(){return this.setTrackMuted(!0),this})}unmute(){return ce(this,void 0,void 0,function*(){return this.setTrackMuted(!1),this})}replaceTrack(e,n){return ce(this,void 0,void 0,function*(){const r=yield this.trackChangeLock.lock();try{if(!this.sender)throw new td("unable to replace an unpublished track");let i,s;typeof n=="boolean"?i=n:n!==void 0&&(i=n.userProvidedTrack,s=n.stopProcessor),this.providedByUser=i??
vendor: 5,194 bytes, line 789
789!0,this.log.debug("replace MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(e),s&&this.processor&&(yield this.internalStopProcessor())}finally{r()}return yield this.onSenderTrackSwapped(),this})}onSenderTrackSwapped(){return ce(this,void 0,void 0,function*(){})}restart(e,n){return ce(this,void 0,void 0,function*(){this.manuallyStopped=!1;const r=yield this.trackChangeLock.lock();try{e||(e=this._constraints);const{deviceId:i,facingMode:s}=e,a=Hje(e,["deviceId","facingMode"]);this.log.debug("restarting track with constraints",Object.assign(Object.assign({},this.logContext),{constraints:e}));const o={audio:!1,video:!1};this.kind===je.Kind.Video?o.video=i||s?{deviceId:i,facingMode:s}:!0:o.audio=i?Object.assign({deviceId:i},a):!0,this.attachedElements.forEach(u=>{dv(this.mediaStreamTrack,u)}),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.stop();const c=(yield navigator.mediaDevices.getUserMedia(o)).getTracks()[0];return this.kind===je.Kind.Video&&(yield c.applyConstraints(a)),c.addEventListener("ended",this.handleEnded),this.log.debug("re-acquired MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(c,!1,n),this._constraints=e,this.pendingDeviceChange=!1,this.emit(Qe.Restarted,this),this.manuallyStopped&&(this.log.warn("track was stopped during a restart, stopping restarted track",this.logContext),this.stop()),this}finally{r()}})}setTrackMuted(e){this.log.debug("setting ".concat(this.kind," track ").concat(e?"muted":"unmuted"),this.logContext),!(this.isMuted===e&&this._mediaStreamTrack.enabled!==e)&&(this.isMuted=e,this._mediaStreamTrack.enabled=!e,this.emit(e?Qe.Muted:Qe.Unmuted,this))}get needsReAcquisition(){return this._mediaStreamTrack.readyState!=="live"||this._mediaStreamTrack.muted||!this._mediaStreamTrack.enabled||this.reacquireTrack}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return ce(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),sne()&&(this.log.debug("visibility changed, is in Background: ".concat(this.isInBackground),this.logContext),!this.isInBackground&&this.needsReAcquisition&&!this.isUserProvided&&!this.isMuted&&(this.log.debug("track needs to be reacquired, restarting ".concat(this.source),this.logContext),yield this.restart(),this.reacquireTrack=!1))})}stop(){var e;this.manuallyStopped=!0,super.stop(),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent),(e=this.processor)===null||e===void 0||e.destroy(),this.processor=void 0}pauseUpstream(){return ce(this,void 0,void 0,function*(){var e;const n=yield this.pauseUpstreamLock.lock();try{if(this._isUpstreamPaused===!0)return;if(!this.sender){this.log.warn("unable to pause upstream for an unpublished track",this.logContext);return}this._isUpstreamPaused=!0,this.emit(Qe.UpstreamPaused,this);const r=Ca();if((r==null?void 0:r.name)==="Safari"&&au(r.version,"12.0")<0)throw new DO("pauseUpstream is not supported on Safari < 12.");((e=this.sender.transport)===null||e===void 0?void 0:e.state)!=="closed"&&(yield this.sender.replaceTrack(null))}finally{n()}})}resumeUpstream(){return ce(this,void 0,void 0,function*(){var e;const n=yield this.pauseUpstreamLock.lock();try{if(this._isUpstreamPaused===!1)return;if(!this.sender){this.log.warn("unable to resume upstream for an unpublished track",this.logContext);return}this._isUpstreamPaused=!1,this.emit(Qe.UpstreamResumed,this),((e=this.sender.transport)===null||e===void 0?void 0:e.state)!=="closed"&&(yield this.sender.replaceTrack(this.mediaStreamTrack))}finally{n()}})}getRTCStatsReport(){return ce(this,void 0,void 0,function*(){var e;return!((e=this.sender)===null||e===void 0)&&e.getStats?yield this.sender.getStats():void 0})}setProcessor(e){return ce(this,arguments,void 0,function(n){var r=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var s;const a=yield r.trackChangeLock.lock();try{r.log.debug("setting up processor",r.logContext);const o=document.createElement(r.kind),l={kind:r.kind,track:r._mediaStreamTrack,element:o,audioContext:r.audioContext,localTrack:r};if(yield n.init(l),r.log.debug("processor initialized",r.logContext),r.processor&&(yield r.internalStopProcessor()),r.kind==="unknown")throw TypeError("cannot set processor on track of unknown kind");if(zg(r._mediaStreamTrack,o),o.muted=!0,o.play().catch(c=>{c instanceof DOMException&&c.name==="AbortError"?(r.log.warn("failed to play processor element, retrying",Object.assign(Object.assign({},r.logContext),{error:c})),setTimeout(()=>{o.play().catch(u=>{r.log.error("failed to play processor element",Object.assign(Object.assign({},r.logContext),{err:u}))})},100)):r.log.error("failed to play processor element",Object.assign(Object.assign({},r.logContext),{error:c}))}),r.processor=n,r.processorElement=o,r.processor.processedTrack){for(const c of r.attachedElements)c!==r.processorElement&&i&&(dv(r._mediaStreamTrack,c),zg(r.processor.processedTrack,
789c));yield(s=r.sender)===null||s===void 0?void 0:s.replaceTrack(r.processor.processedTrack)}r.emit(Qe.TrackProcessorUpdate,r.processor)}finally{a()}yield r.onSenderTrackSwapped()}()})}getProcessor(){return this.processor}stopProcessor(){return ce(this,arguments,void 0,function(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){const r=yield e.trackChangeLock.lock();try{yield e.internalStopProcessor(n)}finally{r()}yield e.onSenderTrackSwapped()}()})}internalStopProcessor(){return ce(this,arguments,void 0,function(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){var r,i;e.processor&&(e.log.debug("stopping processor",e.logContext),(r=e.processor.processedTrack)===null||r===void 0||r.stop(),yield e.processor.destroy(),e.processor=void 0,n||((i=e.processorElement)===null||i===void 0||i.remove(),e.processorElement=void 0),yield e._mediaStreamTrack.applyConstraints(e._constraints),yield e.setMediaStreamTrack(e._mediaStreamTrack,!0),e.emit(Qe.TrackProcessorUpdate))}()})}startPreConnectBuffer(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:100;if(!xBe()){this.log.warn("MediaRecorder is not available, cannot start preconnect buffer",this.logContext);return}if(this.localTrackRecorder){this.log.warn("preconnect buffer already started");return}else{let n="audio/webm;codecs=opus";MediaRecorder.isTypeSupported(n)||(n="video/mp4"),this.localTrackRecorder=new bBe(this,{mimeType:n})}this.localTrackRecorder.start(e),this.autoStopPreConnectBuffer=setTimeout(()=>{this.log.warn("preconnect buffer timed out, stopping recording automatically",this.logContext),this.stopPreConnectBuffer()},SBe)}stopPreConnectBuffer(){clearTimeout(this.autoStopPreConnectBuffer),this.localTrackRecorder&&(this.localTrackRecorder.stop(),this.localTrackRecorder=void 0)}getPreConnectBuffer(){var e;return(e=this.localTrackRecorder)===null||e===void 0?void 0:e.byteStream}getPreConnectBufferMimeType(){var e;return(e=this.localTrackRecorder)===null||e===void 0?void 0:e.mimeType}}class kS extends fne{get enhancedNoiseCancellation(){return this.isKrispNoiseFilterEnabled}constructor(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;super(e,je.Kind.Audio,n,r,s),this.stopOnMute=!1,this.isKrispNoiseFilterEnabled=!1,this.monitorSender=()=>ce(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let a;try{a=yield this.getSenderStats()}catch(o){this.log.error("could not get audio sender stats",Object.assign(Object.assign({},this.logContext),{error:o}));return}a&&this.prevStats&&(this._currentBitrate=cC(a,this.prevStats)),this.prevStats=a}),this.handleKrispNoiseFilterEnable=()=>{this.isKrispNoiseFilterEnabled=!0,this.log.debug("Krisp noise filter enabled",this.logContext),this.emit(Qe.AudioTrackFeatureUpdate,this,ls.TF_ENHANCED_NOISE_CANCELLATION,!0)},this.handleKrispNoiseFilterDisable=()=>{this.isKrispNoiseFilterEnabled=!1,this.log.debug("Krisp noise filter disabled",this.logContext),this.emit(Qe.AudioTrackFeatureUpdate,this,ls.TF_ENHANCED_NOISE_CANCELLATION,!1)},this.audioContext=i,this.checkForSilence()}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return ce(this,void 0,void 0,function*(){const n=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===je.Source.Microphone&&this.stopOnMute&&!this.isUserProvided&&(this.log.debug("stopping mic track",this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{n()}})}unmute(){const e=Object.create(null,{unmute:{get:()=>super.unmute}});return ce(this,void 0,void 0,function*(){const n=yield this.muteLock.lock();try{return this.isMuted?(this.source===je.Source.Microphone&&(this.stopOnMute||this._mediaStreamTrack.readyState==="ended"||this.pendingDeviceChange)&&!this.isUserProvided&&(this.log.debug("reacquiring mic track",this.logContext),yield this.restart(void 0,!0)),yield e.unmute.call(this),this):(this.log.debug("Track already unmuted",this.logContext),this)}finally{n()}})}restartTrack(e){return ce(this,void 0,void 0,function*(){let n;if(e){const r=jO({audio:e});typeof r.audio!="boolean"&&(n=r.audio)}yield this.restart(n)})}restart(e,n){const r=Object.create(null,{restart:{get:()=>super.restart}});return ce(this,void 0,void 0,function*(){const i=yield r.restart.call(this,e,n);return this.checkForSilence(),i})}startMonitor(){Wa()&&(this.monitorInterval||(this.monitorInterval=setInterval(()=>{this.monitorSender()},KO)))}setProcessor(e){return ce(this,void 0,void 0,function*(){var n;const r=yield this.trackChangeLock.lock();try{if(!su()&&!this.audioContext)throw Error("Audio context needs to be set on LocalAudioTrack in order to enable processors");this.processor&&(yield this.internalStopProcessor());const i={kind:this.kind,track:this._mediaStreamTrack,audioContext:this.audioContext,localTrack:this};this.log.debug("setting up audio processor ".concat(e.name),this.logContext),yield e.init(i),this.processor=e,this.processor.processedTrack&&(yield(n=this.sender)===null||n===void 0?void 0:n.replaceTrack(this.processor.processedTrack),this.processor.processedTrack.addEventListener("enable-lk-krisp-noise-filter",this.handleKrispNoiseFilterEnable),this.processor.processedTrack.addEventListener("disable-lk-krisp-noise-filter",this.handleKrispNoiseFilterDisable)),this.emit
vendor: 11,123 bytes, line 789
789(Qe.TrackProcessorUpdate,this.processor)}finally{r()}})}setAudioContext(e){this.audioContext=e}getSenderStats(){return ce(this,void 0,void 0,function*(){var e;if(!(!((e=this.sender)===null||e===void 0)&&e.getStats))return;const n=yield this.sender.getStats();let r;return n.forEach(i=>{i.type==="outbound-rtp"&&(r={type:"audio",streamId:i.id,packetsSent:i.packetsSent,packetsLost:i.packetsLost,bytesSent:i.bytesSent,timestamp:i.timestamp,roundTripTime:i.roundTripTime,jitter:i.jitter})}),r})}checkForSilence(){return ce(this,void 0,void 0,function*(){const e=yield nne(this);return e&&(this.isMuted||this.log.debug("silence detected on local audio track",this.logContext),this.emit(Qe.AudioSilenceDetected)),e})}}function TBe(t,e,n){switch(t.kind){case"audio":return new kS(t,e,!1,void 0,n);case"video":return new TS(t,e,!1,n);default:throw new td("unsupported track type: ".concat(t.kind))}}const CBe=Object.values(zw),EBe=Object.values(KN),ABe=Object.values(FO),PBe=[zw.h180,zw.h360],MBe=[KN.h180,KN.h360],NBe=t=>[{scaleResolutionDownBy:2,fps:t.encoding.maxFramerate}].map(n=>{var r,i;return new ur(Math.floor(t.width/n.scaleResolutionDownBy),Math.floor(t.height/n.scaleResolutionDownBy),Math.max(15e4,Math.floor(t.encoding.maxBitrate/(Math.pow(n.scaleResolutionDownBy,2)*(((r=t.encoding.maxFramerate)!==null&&r!==void 0?r:30)/((i=n.fps)!==null&&i!==void 0?i:30))))),n.fps,t.encoding.priority)}),i3=["q","h","f"];function SS(t,e,n,r){var i,s;let a=r==null?void 0:r.videoEncoding;t&&(a=r==null?void 0:r.screenShareEncoding);const o=r==null?void 0:r.simulcast,l=r==null?void 0:r.scalabilityMode,c=r==null?void 0:r.videoCodec;if(!a&&!o&&!l||!e||!n)return[{}];a||(a=RBe(t,e,n,c),mn.debug("using video encoding",a));const u=a.maxFramerate,d=new ur(e,n,a.maxBitrate,a.maxFramerate,a.priority);if(l&&ql(c)){const p=new mne(l),m=[];if(p.spatial>3)throw new Error("unsupported scalabilityMode: ".concat(l));const g=Ca();if($w()||su()||(g==null?void 0:g.name)==="Chrome"&&au(g==null?void 0:g.version,"113")<0){const v=p.suffix=="h"?2:3,_=P8e(g);for(let b=0;b<p.spatial;b+=1)m.push({rid:i3[2-b],maxBitrate:a.maxBitrate/Math.pow(v,b),maxFramerate:d.encoding.maxFramerate,scaleResolutionDownBy:_?Math.pow(2,b):void 0});m[0].scalabilityMode=l}else m.push({maxBitrate:a.maxBitrate,maxFramerate:d.encoding.maxFramerate,scalabilityMode:l});return d.encoding.priority&&(m[0].priority=d.encoding.priority,m[0].networkPriority=d.encoding.priority),mn.debug("using svc encoding",{encodings:m}),m}if(!o)return[a];let f=[];t?f=(i=gz(r==null?void 0:r.screenShareSimulcastLayers))!==null&&i!==void 0?i:mz(t,d):f=(s=gz(r==null?void 0:r.videoSimulcastLayers))!==null&&s!==void 0?s:mz(t,d);let h;if(f.length>0){const p=f[0];f.length>1&&([,h]=f);const m=Math.max(e,n);if(m>=960&&h)return iA(e,n,[p,h,d],u);if(m>=480)return iA(e,n,[p,d],u)}return iA(e,n,[d])}function pne(t,e,n){var r,i,s,a;if(!n.backupCodec||n.backupCodec===!0||n.backupCodec.codec===n.videoCodec)return;e!==n.backupCodec.codec&&mn.warn("requested a different codec than specified as backup",{serverRequested:e,backup:n.backupCodec.codec}),n.videoCodec=e,n.videoEncoding=n.backupCodec.encoding;const o=t.mediaStreamTrack.getSettings(),l=(r=o.width)!==null&&r!==void 0?r:(i=t.dimensions)===null||i===void 0?void 0:i.width,c=(s=o.height)!==null&&s!==void 0?s:(a=t.dimensions)===null||a===void 0?void 0:a.height;return t.source===je.Source.ScreenShare&&n.simulcast&&(n.simulcast=!1),SS(t.source===je.Source.ScreenShare,l,c,n)}function RBe(t,e,n,r){const i=IBe(t,e,n);let{encoding:s}=i[0];const a=Math.max(e,n);for(let o=0;o<i.length;o+=1){const l=i[o];if(s=l.encoding,l.width>=a)break}if(r)switch(r){case"av1":case"h265":s=Object.assign({},s),s.maxBitrate=s.maxBitrate*.7;break;case"vp9":s=Object.assign({},s),s.maxBitrate=s.maxBitrate*.85;break}return s}function IBe(t,e,n){if(t)return ABe;const r=e>n?e/n:n/e;return Math.abs(r-16/9)<Math.abs(r-4/3)?CBe:EBe}function mz(t,e){if(t)return NBe(e);const{width:n,height:r}=e,i=n>r?n/r:r/n;return Math.abs(i-16/9)<Math.abs(i-4/3)?PBe:MBe}function iA(t,e,n,r){const i=[];if(n.forEach((s,a)=>{if(a>=i3.length)return;const o=Math.min(t,e),c={rid:i3[a],scaleResolutionDownBy:Math.max(1,o/Math.min(s.width,s.height)),maxBitrate:s.encoding.maxBitrate},u=r&&s.encoding.maxFramerate?Math.min(r,s.encoding.maxFramerate):s.encoding.maxFramerate;u&&(c.maxFramerate=u);const d=Ca(),f=(d==null?void 0:d.name)==="Firefox"&&d.os!=="iOS"||a===0;s.encoding.priority&&f&&(c.priority=s.encoding.priority,c.networkPriority=s.encoding.priority),i.push(c)}),su()&&one()==="ios"){let s;i.forEach(o=>{s?o.maxFramerate&&o.maxFramerate>s&&(s=o.maxFramerate):s=o.maxFramerate});let a=!0;i.forEach(o=>{var l;o.maxFramerate!=s&&(a&&(a=!1,mn.info("Simulcast on iOS React-Native requires all encodings to share the same framerate.")),mn.info('Setting framerate of encoding "'.concat((l=o.rid)!==null&&l!==void 0?l:"",'" to ').concat(s)),o.maxFramerate=s)})}return i}function gz(t){if(t)return t.sort((e,n)=>{const{encoding:r}=e,{encoding:i}=n;return r.maxBitrate>i.maxBitrate?1:r.maxBitrate<i.maxBitrate?-1:r.maxBitrate===i.maxBitrate&&r.maxFramerate&&i.maxFramerate?r.maxFramerate>i.maxFramerate?1:-1:0})}class mne{constructor(e){const n=e.match(/^L(\d)T(\d)(h|_KEY|_KEY_SHIFT){0,1}$/);if(!n)throw new Error("invalid scalability mode");if(this.spatial=parseInt(n[1]),this.temporal=parseInt(n[2]),n.length>3)switch(n[3]){case"h":case"_KEY":case"_KEY_SHIFT":this.suffix=n[3]}}toString(){var e;return"L".concat(this.spatial,"T").concat(this.temporal).concat((e=this.suffix)!==null&&e!==void 0?e:"")}}function LBe(t){return t.source===je.Source.ScreenShare||t.constraints.height&&Ip(t.constraints.height)>=1080?"maintain-resolution":"balanced"}const OBe=5e3;class TS extends fne{get sender(){return this._sender}set sender(e){this._sender=e,this.degradationPreference&&this.setDegradationPreference(this.degradationPreference)}constructor(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3?arguments[3]:void 0;super(e,je.Kind.Video,n,r,i),this.simulcastCodecs=new Map,this.degradationPreference="balanced",this.isCpuConstrained=!1,this.optimizeForPerformance=!1,this.monitorSender=()=>ce(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let s;try{s=yield this.getSenderStats()}catch(l){this.log.error("could not get video sender stats",Object.assign(Object.assign({},this.logContext),{error:l}));return}const a=new Map(s.map(l=>[l.rid,l])),o=s.some(l=>l.qualityLimitationReason==="cpu");if(o!==this.isCpuConstrained&&(this.isCpuConstrained=o,this.isCpuConstrained&&this.emit(Qe.CpuConstrained)),this.prevStats){let l=0;a.forEach((c,u)=>{var d;const f=(d=this.prevStats)===null||d===void 0?void 0:d.get(u);l+=cC(c,f)}),this._currentBitrate=l}this.prevStats=a}),this.senderLock=new As}get isSimulcast(){return!!(this.sender&&this.sender.getParameters().encodings.length>1)}startMonitor(e){var n;if(this.signalClient=e,!Wa())return;const r=(n=this.sender)===null||n===void 0?void 0:n.getParameters();r&&(this.encodings=r.encodings),!this.monitorInterval&&(this.monitorInterval=setInterval(()=>{this.monitorSender()},KO))}stop(){this._mediaStreamTrack.getConstraints(),this.simulcastCodecs.forEach(e=>{e.mediaStreamTrack.stop()}),super.stop()}pauseUpstream(){const e=Object.create(null,{pauseUpstream:{get:()=>super.pauseUpstream}});return ce(this,void 0,void 0,function*(){var n,r,i,s,a;yield e.pauseUpstream.call(this);try{for(var o=!0,l=Vl(this.simulcastCodecs.values()),c;c=yield l.next(),n=c.done,!n;o=!0)s=c.value,o=!1,yield(a=s.sender)===null||a===void 0?void 0:a.replaceTrack(null)}catch(u){r={error:u}}finally{try{!o&&!n&&(i=l.return)&&(yield i.call(l))}finally{if(r)throw r.error}}})}resumeUpstream(){const e=Object.create(null,{resumeUpstream:{get:()=>super.resumeUpstream}});return ce(this,void 0,void 0,function*(){var n,r,i,s,a;yield e.resumeUpstream.call(this);try{for(var o=!0,l=Vl(this.simulcastCodecs.values()),c;c=yield l.next(),n=c.done,!n;o=!0){s=c.value,o=!1;const u=s;yield(a=u.sender)===null||a===void 0?void 0:a.replaceTrack(u.mediaStreamTrack)}}catch(u){r={error:u}}finally{try{!o&&!n&&(i=l.return)&&(yield i.call(l))}finally{if(r)throw r.error}}})}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return ce(this,void 0,void 0,function*(){const n=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===je.Source.Camera&&!this.isUserProvided&&(this.log.debug("stopping camera track",this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{n()}})}unmute(){const e=Object.create(null,{unmute:{get:()=>super.unmute}});return ce(this,void 0,void 0,function*(){const n=yield this.muteLock.lock();try{return this.isMuted?(this.source===je.Source.Camera&&!this.isUserProvided&&(this.log.debug("reacquiring camera track",this.logContext),yield this.restart(void 0,!0)),yield e.unmute.call(this),this):(this.log.debug("Track already unmuted",this.logContext),this)}finally{n()}})}setTrackMuted(e){super.setTrackMuted(e);for(const n of this.simulcastCodecs.values())n.mediaStreamTrack.enabled=!e}getSenderStats(){return ce(this,void 0,void 0,function*(){var e;if(!(!((e=this.sender)===null||e===void 0)&&e.getStats))return[];const n=[],r=yield this.sender.getStats();return r.forEach(i=>{var s;if(i.type==="outbound-rtp"){const a={type:"video",streamId:i.id,frameHeight:i.frameHeight,frameWidth:i.frameWidth,framesPerSecond:i.framesPerSecond,framesSent:i.framesSent,firCount:i.firCount,pliCount:i.pliCount,nackCount:i.nackCount,packetsSent:i.packetsSent,bytesSent:i.bytesSent,qualityLimitationReason:i.qualityLimitationReason,qualityLimitationDurations:i.qualityLimitationDurations,qualityLimitationResolutionChanges:i.qualityLimitationResolutionChanges,rid:(s=i.rid)!==null&&s!==void 0?s:i.id,retransmittedPacketsSent:i.retransmittedPacketsSent,targetBitrate:i.targetBitrate,timestamp:i.timestamp},o=r.get(i.remoteId);o&&(a.jitter=o.jitter,a.packetsLost=o.packetsLost,a.roundTripTime=o.roundTripTime),n.push(a)}}),n.sort((i,s)=>{var a,o;return((a=s.frameWidth)!==null&&a!==void 0?a:0)-((o=i.frameWidth)!==null&&o!==void 0?o:0)}),n})}setPublishingQuality(e){const n=[];for(let r=So.LOW;r<=So.HIGH;r+=1)n.push(new RO({quality:r,enabled:r<=e}));this.log.debug("setting publishing quality. max quality ".concat(e),this.logContext),this.setPublishingLayers(ql(this.codec),n)}restartTrack(e){return ce(this,void 0,void 0,function*(){var n,r,i,s,a;let o;if(e){const d=jO({video:e});typeof d.video!="boolean"&&(o=d.video)}yield this.restart(o),this.isCpuConstrained=!1;try{for(var l=!0,c=Vl(this.simulcastCodecs.values()),u;u=yield c.next(),n=u.done,!n;l=!0){s=u.value,l=!1;const d=s;d.sender&&((a=d.sender.transport)===null||a===void 0?void 0:a.state)!=="closed"&&(d.mediaStreamTrack=this.mediaStreamTrack.clone(),yield d.sender.replaceTrack(d.mediaStreamTrack))}}catch(d){r={error:d}}finally{try{!l&&!n&&(i=c.return)&&(yield i.call(c))}finally{if(r)throw r.error}}yield this.onSenderTrackSwapped()})}onSenderTrackSwapped(){return ce(this,void 0,void 0,function*(){yield this.refreshSen
789derEncodings()})}refreshSenderEncodings(){return ce(this,void 0,void 0,function*(){var e;if(!this.sender||!this.publishOptions||this.optimizeForPerformance)return;const n=yield this.senderLock.lock();try{let r;try{r=yield this.waitForDimensions()}catch(a){this.log.warn("could not determine new track dimensions, skipping encoding recompute",Object.assign(Object.assign({},this.logContext),{error:a}));return}if(this.lastEncodedDimensions&&this.lastEncodedDimensions.width===r.width&&this.lastEncodedDimensions.height===r.height)return;const i=this.source===je.Source.ScreenShare,s=SS(i,r.width,r.height,Object.assign({},this.publishOptions));yield this.applyEncodingsToSender(this.sender,s),this.encodings=s,this.lastEncodedDimensions=r;for(const[a,o]of this.simulcastCodecs){if(!o.sender||((e=o.sender.transport)===null||e===void 0?void 0:e.state)==="closed"||!ene(a))continue;const l=Object.assign({},this.publishOptions),c=pne(this,a,l);c&&(yield this.applyEncodingsToSender(o.sender,c),o.encodings=c)}}catch(r){this.log.warn("failed to apply recomputed encodings",Object.assign(Object.assign({},this.logContext),{error:r}))}finally{n()}})}applyEncodingsToSender(e,n){return ce(this,void 0,void 0,function*(){const r=e.getParameters();!r.encodings||r.encodings.length!==n.length||(r.encodings.forEac
789h((i,s)=>{if(i.active===!1)return;const a=n[s];a.scaleResolutionDownBy!==void 0&&(i.scaleResolutionDownBy=a.scaleResolutionDownBy),a.maxBitrate!==void 0&&(i.maxBitrate=a.maxBitrate),a.maxFramerate!==void 0&&(i.maxFramerate=a.maxFramerate),a.priority!==void 0&&(i.priority=a.priority,i.networkPriority=a.priority)}),this.log.debug("updating sender encodings after track restart",Object.assign(Object.assign({},this.logContext),{encodings:r.encodings})),yield e.setParameters(r))})}setProcessor(e){const n=Object.create(null,{setProcessor:{get:()=>super.setProcessor}});return ce(this,arguments,void 0,function(r){var i=this;let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var a,o,l,c,u,d;if(yield n.setProcessor.call(i,r,s),!((u=i.processor)===null||u===void 0)&&u.processedTrack)try{for(var f=!0,h=Vl(i.simulcastCodecs.values()),p;p=yield h.next(),a=p.done,!a;f=!0)c=p.value,f=!1,yield(d=c.sender)===null||d===void 0?void 0:d.replaceTrack(i.processor.processedTrack)}catch(m){o={error:m}}finally{try{!f&&!a&&(l=h.return)&&(yield l.call(h))}finally{if(o)throw o.error}}}()})}setDegradationPreference(e){return ce(this,void 0,void 0,function*(){if(this.degradationPreference=e,this.sender)try{this.log.debug("setting degradationPreference to ".concat(e),this.logContext);const n=this.sender.getParameters();n.degradationPreference=e,this.sender.setParameters(n)}catch(n){this.log.warn("failed to set degradationPreference",Object.assign({error:n},this.logContext))}})}addSimulcastTrack(e,n){if(this.simulcastCodecs.has(e)){this.log.error("".concat(e," already added, skipping adding simulcast codec"),this.logContext);return}const r={codec:e,mediaStreamTrack:this.mediaStreamTrack.clone(),sender:void 0,encodings:n};return this.simulcastCodecs.set(e,r),r}setSimulcastTrackSender(e,n){const r=this.simulcastCodecs.get(e);r&&(r.sender=n,setTimeout(()=>{this.subscribedCodecs&&this.setPublishingCodecs(this.subscribedCodecs)},OBe))}setPublishingCodecs(e){return ce(this,void 0,void 0,function*(){var n,r,i,s,a,o,l;if(this.log.debug("setting publishing codecs",Object.assign(Object.assign({},this.logContext),{codecs:e,currentCodec:this.codec})),!this.codec&&e.length>0)return yield this.setPublishingLayers(ql(e[0].codec),e[0].qualities),[];this.subscribedCodecs=e;const c=[];try{for(n=!0,r=Vl(e);i=yield r.next(),s=i.done,!s;n=!0){l=i.value,n=!1;const u=l;if(!this.codec||this.codec===u.codec)yield this.setPublishingLayers(ql(u.codec),u.qualities);else{const d=this.simulcastCodecs.get(u.codec);if(this.log.debug("try setPublishingCodec for ".concat(u.codec),Object.assign(Object.assign({},this.logContext),{simulcastCodecInfo:d})),!d||!d.sender){for(const f of u.qualities)if(f.enabled){c.push(u.codec);break}}else d.encodings&&(this.log.debug("try setPublishingLayersForSender ".concat(u.codec),this.logContext),yield vz(d.sender,d.encodings,u.qualities,this.senderLock,ql(u.codec),this.log,this.logContext))}}}catch(u){a={error:u}}finally{try{!n&&!s&&(o=r.return)&&(yield o.call(r))}finally{if(a)throw a.error}}return c})}setPublishingLayers(e,n){return ce(this,void 0,void 0,function*(){if(this.optimizeForPerformance){this.log.info("skipping setPublishingLayers due to optimized publishing performance",Object.assign(Object.assign({},this.logContext),{qualities:n}));return}this.log.debug("setting publishing layers",Object.assign(Object.assign({},this.logContext),{qualities:n})),!(!this.sender||!this.encodings)&&(yield vz(this.sender,this.encodings,n,this.senderLock,e,this.log,this.logContext))})}prioritizePerformance(){return ce(this,void 0,void 0,function*(){if(!this.sender)throw new Error("sender not found");const e=yield this.senderLock.lock();try{this.optimizeForPerformance=!0;const n=this.sender.getParameters();n.encodings=n.encodings.map((r,i)=>{var s;return Object.assign(Object.assign({},r),{active:i===0,scaleResolutionDownBy:Math.max(1,Math.ceil(((s=this.mediaStreamTrack.getSettings().height)!==null&&s!==void 0?s:360)/360)),scalabilityMode:i===0&&ql(this.codec)?"L1T3":void 0,maxFramerate:i===0?15:0,maxBitrate:i===0?r.maxBitrate:0})}),this.log.debug("setting performance optimised encodings",Object.assign(Object.assign({},this.logContext),{encodings:n.encodings})),this.encodings=n.encodings,yield this.sender.setParameters(n)}catch(n){this.log.error("failed to set performance optimised encodings",Object.assign(Object.assign({},this.logContext),{error:n})),this.optimizeForPerformance=!1}finally{e()}})}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return ce(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),sne()&&this.isInBackgroun
789d&&this.source===je.Source.Camera&&(this._mediaStreamTrack.enabled=!1)})}}function vz(t,e,n,r,i,s,a){return ce(this,void 0,void 0,function*(){const o=yield r.lock();s.debug("setPublishingLayersForSender",Object.assign(Object.assign({},a),{sender:t,qualities:n,senderEncodings:e}));try{const l=t.getParameters(),{encodings:c}=l;if(!c)return;if(c.length!==e.length){s.warn("cannot set publishing layers, encodings mismatch",Object.assign(Object.assign({},a),{encodings:c,senderEncodings:e}));return}let u=!1;!1&&c[0].scalabilityMode||(i&&n.some(h=>h.enabled)&&n.forEach(h=>h.enabled=!0),c.forEach((f,h)=>{var p;let m=(p=f.rid)!==null&&p!==void 0?p:"";m===""&&(m="q");const g=gne(m),v=n.find(_=>_.quality===g);v&&f.active!==v.enabled&&(u=!0,f.active=v.enabled,s.debug("setting layer ".concat(v.quality," to ").concat(f.active?"enabled":"disabled"),a),Vv()&&(v.enabled?(f.scaleResolutionDownBy=e[h].scaleResolutionDownBy,f.maxBitrate=e[h].maxBitrate,f.maxFrameRate=e[h].maxFrameRate):(f.scaleResolutionDownBy=4,f.maxBitrate=10,f.maxFrameRate=2)))})),u&&(l.encodings=c,s.debug("setting encodings",Object.assign(Object.assign({},a),{encodings:l.encodings})),yield t.setParameters(l))}finally{o()}})}function gne(t){switch(t){case"f":return So.HIGH;case"h":return So.MEDIUM;case"q":return So.LOW;default:return So.HIGH}}function yz(t,e,n,r){if(!n)return[new qh({quality:So.HIGH,width:t,height:e,bitrate:0,ssrc:0})];if(r){const i=n[0].scalabilityMode,s=new mne(i),a=[],o=s.suffix=="h"?1.5:2,l=s.suffix=="h"?2:3;for(let c=0;c<s.spatial;c+=1)a.push(new qh({quality:Math.min(So.HIGH,s.spatial-1)-c,width:Math.ceil(t/Math.pow(o,c)),height:Math.ceil(e/Math.pow(o,c)),bitrate:n[0].maxBitrate?Math.ceil(n[0].maxBitrate/Math.pow(l,c)):0,ssrc:0}));return a}return n.map(i=>{var s,a,o;const l=(s=i.scaleResolutionDownBy)!==null&&s!==void 0?s:1;let c=gne((a=i.rid)!==null&&a!==void 0?a:"");return new qh({quality:c,width:Math.ceil(t/l),height:Math.ceil(e/l),bitrate:(o=i.maxBitrate)!==null&&o!==void 0?o:0,ssrc:0})})}const _z="_lossy",wz="_reliable",bz="_data_track",DBe=2*1e3,sA="leave-reconnect",FBe=3e4,jBe=8*1024,BBe=256*1024,UBe=3,zBe=3;var qo;(function(t){t[t.New=0]="New",t[t.Connected=1]="Connected",t[t.Disconnected=2]="Disconnected",t[t.Reconnecting=3]="Reconnecting",t[t.Closed=4]="Closed"})(qo||(qo={}));var gn;(function(t){t[t.RELIABLE=0]="RELIABLE",t[t.LOSSY=1]="LOSSY",t[t.DATA_TRACK_LOSSY=2]="DATA_TRACK_LOSSY"})(gn||(gn={}));class $Be extends al.EventEmitter{get isClosed(){return this._isClosed}get isNewlyCreated(){return this._isNewlyCreated}get pendingReconnect(){return!!this.reconnectTimeout}constructor(e){var n;super(),this.options=e,this.rtcConfig={},this.peerConnectionTimeout=GO.peerConnectionTimeout,this.fullReconnectOnNext=!1,this.latestRemoteOfferId=0,this.subscriberPrimary=!1,this.pcState=qo.New,this._isClosed=!0,this._isNewlyCreated=!0,this.pendingTrackResolvers={},this.reconnectAttempts=0,this.reconnectStart=0,this.attemptingReconnect=!1,this.joinAttempts=0,this.maxJoinAttempts=1,this.shouldFailNext=!1,this.shouldFailOnV1Path=!1,this.log=mn,this.reliableDataSequence=1,this.reliableMessageBuffer=new az,this.reliableReceivedState=new uBe(FBe),this.lossyDataStatCurrentBytes=0,this.lossyDataStatByterate=0,this.lossyDataDropCount=0,this.midToTrackId={},this.isWaitingForNetworkReconnect=!1,this.bufferStatusLowClosingFuture=new Cs,this.handleDataChannel=r=>ce(this,[r],void 0,function(i){var s=this;let{channel:a}=i;return function*(){if(!a)return;let o;if(a.label===wz)s.reliableDCSub=a,o=s.handleDataMessage;else if(a.label===_z)s.lossyDCSub=a,o=s.handleDataMessage;else if(a.label===bz)s.dataTrackDCSub=a,o=s.handleDataTrackMessage;else return;s.log.debug("on data channel ".concat(a.id,", ").concat(a.label)),a.onmessage=o}()}),this.handleDataMessage=r=>ce(this,void 0,void 0,function*(){var i,s,a,o,l;const c=yield this.dataProcessLock.lock();try{let u;if(r.data instanceof ArrayBuffer)u=r.data;else if(r.data instanceof Blob)u=yield r.data.arrayBuffer();else{this.log.error("unsupported data type",{data:r.data});return}const d=_a.fromBinary(new Uint8Array(u));if(d.sequence>0&&d.participantSid!==""){const f=this.reliableReceivedState.get(d.participantSid);if(f&&d.sequence<=f)return;this.reliableReceivedState.set(d.participantSid,d.sequence)}if(((i=d.value)===null||i===void 0?void 0:i.case)==="speaker")this.emit
789(We.ActiveSpeakersUpdate,d.value.value.speakers);else if(((s=d.value)===null||s===void 0?void 0:s.case)==="encryptedPacket"){if(!this.e2eeManager){this.log.error("Received encrypted packet but E2EE not set up");return}const f=yield(a=this.e2eeManager)===null||a===void 0?void 0:a.handleEncryptedData(d.value.value.encryptedValue,d.value.value.iv,d.participantIdentity,d.value.value.keyIndex),h=Yee.fromBinary(f.payload),p=new _a({value:h.value,participantIdentity:d.participantIdentity,participantSid:d.participantSid});((o=p.value)===null||o===void 0?void 0:o.case)==="user"&&xz(p,p.value.value),this.emit(We.DataPacketReceived,p,d.value.value.encryptionType)}else((l=d.value)===null||l===void 0?void 0:l.case)==="user"&&xz(d,d.value.value),this.emit(We.DataPacketReceived,d,yr.NONE)}finally{c()}}),this.handleDataTrackMessage=r=>ce(this,void 0,void 0,function*(){let i;if(r.data instanceof ArrayBuffer)i=r.data;else if(r.data instanceof Blob)i=yield r.data.arrayBuffer();else{this.log.error("unsupported data type",{data:r.data});return}this.emit("dataTrackPacketReceived",new Uint8Array(i))}),this.handleDataError=r=>{const s=r.currentTarget.maxRetransmits===0?"lossy":"reliable";if(r instanceof ErrorEvent&&r.error){const{error:a}=r.error;this.log.error("DataChannel error on ".concat(s,": ").concat(r.message),{error:a})}else this.log.error("Unknown DataChannel error on ".concat(s),{event:r})},this.handleBufferedAmountLow=r=>{this.updateAndEmitDCBufferStatus(r)},this.handleDisconnect=(r,i)=>{if(this._isClosed)return;this.log.warn("".concat(r," disconnected")),this.reconnectAttempts===0&&(this.reconnectStart=Date.now());const s=l=>{this.log.warn("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(l,"ms. giving up")),this.emit(We.Disconnected),this.close()},a=Date.now()-this.reconnectStart;let o=this.getNextRetryDelay({elapsedMs:a,retryCount:this.reconnectAttempts});if(o===null){s(a);return}r===sA&&(o=0),this.log.debug("reconnecting in ".concat(o,"ms")),this.clearReconnectTimeout(),this.token&&this.emit(We.TokenRefreshed,this.token),this.reconnectTimeout=Fi.setTimeout(()=>this.attemptReconnect(i).finally(()=>this.reconnectTimeout=void 0),o)},this.waitForRestarted=()=>new Promise((r,i)=>{this.pcState===qo.Connected&&r();const s=()=>{this.off(We.Disconnected,a),r()},a=()=>{this.off(We.Restarted,s),i()};this.once(We.Restarted,s),this.once(We.Disconnected,a)}),this.updateAndEmitDCBufferStatus=r=>{if(r===gn.RELIABLE){const s=this.dataChannelForKind(r);s&&this.reliableMessageBuffer.alignBufferedAmount(s.bufferedAmount)}const i=this.isBufferStatusLow(r);typeof i<"u"&&i!==this.dcBufferStatus.get(r)&&(this.dcBufferStatus.set(r,i),this.emit(We.DCBufferStatusChanged,i,r))},this.isBufferStatusLow=r=>{const i=this.dataChannelForKind(r);if(i)return i.bufferedAmount<=i.bufferedAmountLowThreshold},this.handleBrowserOnLine=()=>ce(this,void 0,void 0,function*(){!this.url||!(yield fetch(Vw(this.url),{method:"HEAD"}).then(i=>i.ok).catch(()=>!1))||(this.log.info("detected network reconnected"),(this.client.currentState===mr.RECONNECTING||this.isWaitingForNetworkReconnect&&this.client.currentState===mr.CONNECTED)&&(this.clearReconnectTimeout(),this.attemptReconnect(Qf.RR_SIGNAL_DISCONNECTED),this.isWaitingForNetworkReconnect=!1))}),this.handleBrowserOffline=()=>ce(this,void 0,void 0,function*(){if(this.url)try{yield Promise.race([fetch(Vw(this.url),{method:"HEAD"}),Zs(4e3).then(()=>Promise.reject())])}catch{window.navigator.onLine===!1&&(this.log.info("detected network interruption"),this.isWaitingForNetworkReconnect=!0)}}),this.log=Xa((n=e.loggerName)!==null&&n!==void 0?n:hs.Engine,()=>this.logContext),this.loggerOptions={loggerName:e.loggerName,loggerContextCb:()=>this.logContext},this.client=new $O(void 0,this.loggerOptions),this.client.signalLatency=this.options.expSignalLatency,this.reconnectPolicy=this.options.reconnectPolicy,this.closingLock=new As,this.dataProcessLock=new As,this.dcBufferStatus=new Map([[gn.RELIABLE,!0],[gn.LOSSY,!0
789],[gn.DATA_TRACK_LOSSY,!0]]),this.client.onParticipantUpdate=r=>this.emit(We.ParticipantUpdate,r),this.client.onConnectionQuality=r=>this.emit(We.ConnectionQualityUpdate,r),this.client.onRoomUpdate=r=>this.emit(We.RoomUpdate,r),this.client.onSubscriptionError=r=>this.emit(We.SubscriptionError,r),this.client.onSubscriptionPermissionUpdate=r=>this.emit(We.SubscriptionPermissionUpdate,r),this.client.onSpeakersChanged=r=>this.emit(We.SpeakersChanged,r),this.client.onStreamStateUpdate=r=>this.emit(We.StreamStateChanged,r),this.client.onRequestResponse=r=>this.emit(We.SignalRequestResponse,r),this.client.onParticipantUpdate=r=>this.emit(We.ParticipantUpdate,r),this.client.onJoined=r=>this.emit(We.Joined,r),this.on(We.Closing,()=>{var r,i;(i=(r=this.bufferStatusLowClosingFuture).reject)===null||i===void 0||i.call(r,new Yr("engine closed"))}),this.bufferStatusLowClosingFuture.promise.catch(()=>{})}get logContext(){var e,n,r,i,s,a;return{room:(n=(e=this.latestJoinResponse)===null||e===void 0?void 0:e.room)===null||n===void 0?void 0:n.name,roomID:(i=(r=this.latestJoinResponse)===null||r===void 0?void 0:r.room)===null||i===void 0?void 0:i.sid,participant:(a=(s=this.latestJoinResponse)===null||s===void 0?void 0:s.participant)===null||a===void 0?void 0:a.identity,participantID:this.participantSid}}join(e,n,r,i){return ce(this,arguments,void 0,function(s,a,o,l){var c=this;let u=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;return function*(){var d,f,h;c._isNewlyCreated=!1,c.url=s,c.token=a,c.signalOpts=o,c.maxJoinAttempts=o.maxRetries;try{c.joinAttempts+=1,c.setupSignalClientCallbacks();let p;if(!u&&t3()){c.pcManager||(yield c.configure(),c.createDataChannels(),c.addMediaSections(UBe,zBe));const v=yield(d=c.pcManager)===null||d===void 0?void 0:d.publisher.createInitialOffer();v&&(p=sp(v.offer,v.offerId))}if(l!=null&&l.aborted)throw Ot.cancelled("Connection aborted");if(!u&&c.shouldFailOnV1Path)throw c.shouldFailOnV1Path=!1,Ot.serviceNotFound("Simulated v1 path failure","v0-rtc");const m=yield c.client.join(s,a,o,l,u,p);c._isClosed=!1,c.latestJoinResponse=m,c.participantSid=(f=m.participant)===null||f===void 0?void 0:f.sid,c.subscriberPrimary=m.subscriberPrimary,!u&&t3()?(h=c.pcManager)===null||h===void 0||h.updateConfiguration(c.makeRTCConfiguration(m)):(c.pcManager||(yield c.configure(m,!u)),(!c.subscriberPrimary||m.fastPublish)&&c.negotiate().catch(v=>{c.log.error(v)})),c.registerOnLineListener(),c.clientConfiguration=m.clientConfiguration,c.emit(We.SignalConnected,m);let g=m.serverInfo;return g||(g={version:m.serverVersion,region:m.serverRegion}),c.log.info("connected to Livekit Server ".concat(Object.entries(g).map(v=>{let[_,b]=v;return"".concat(_,": ").concat(b)}).join(", "))),{joinResponse:m,serverInfo:g}}catch(p){if(p instanceof Ot){if(p.reason===vr.ServerUnreachable){if(c.log.warn("Couldn't connect to server, attempt ".concat(c.joinAttempts," of ").concat(c.maxJoinAttempts)),c.joinAttempts<c.maxJoinAttempts)return c.join(s,a,o,l,u)}else if(p.reason===vr.ServiceNotFound)return c.log.warn("Initial connection failed: ".concat(p.message," â Retrying")),c.pcManager&&(c.pcManager.onStateChange=void 0,yield c.cleanupPeerConnections()),c.join(s,a,o,l,!0)}throw p}}()})}close(){return ce(this,void 0,void 0,function*(){const e=yield this.closingLock.lock();if(this.isClosed){e();return}try{this._isClosed=!0,this.joinAttempts=0,this.emit(We.Closing),this.removeAllListeners(),this.deregisterOnLineListener(),this.clearPendingReconnect(),this.cleanupLossyDataStats(),yield this.cleanupPeerConnections(),yield this.cleanupClient()}finally{e()}})}cleanupPeerConnections(){return ce(this,void 0,void 0,function*(){var e;yield(e=this.pcManager)===null||e===void 0?void 0:e.close(),this.pcManager=void 0;const n=r=>{r&&(r.close(),r.onbufferedamountlow=null,r.onclose=null,r.onclosing=null,r.onerror=null,r.onmessage=null,r.onopen=null)};n(this.lossyDC),n(this.lossyDCSub),n(this.reliableDC),n(this.reliableDCSub),n(this.dataTrackDC),n(this.dataTrackDCSub),this.lossyDC=void 0,this.lossyDCSub=void 0,this.reliableDC=void 0,this.reliableDCSub=void 0,this.dataTrackDC=void 0,this.dataTrackDCSub=void 0,this.reliableMessageBuffer=new az,this.reliableDataSequence=1,this.reliableReceivedState.clear()})}cleanupLossyDataStats(){this.lossyDataStatByterate=0,this.lossyDataStatCurrentBytes=0,this.lossyDataStatInterval&&(clearInterval(this.lossyDataStatInterval),this.lossyDataStatInterval=void 0),this.lossyDataDropCount=0}cleanupClient(){return ce(this,void 0,void 0,function*(){yield this.client.close(),this.client.resetCallbacks();for(const e of Object.keys(this.pendingTrackResolvers))this.pendingTrackResolvers[e].reject();this.pendingTrackResolvers={}})}addTrack(e){if(this.pendingTrackResolvers[e.cid])throw new td("a track with the same ID has already been published");return new Promise((n,r)=>{const i=setTimeout(()=>{delete this.pendingTrackResolvers[e.cid],r(Ot.timeout("publication of local track timed out, no response from server"))},1e4);this.pendingTrackResolvers[e.cid]={resolve:s=>{clearTimeout(i),n(s)},reject:()=>{clearTimeout(i),r(new Error("Cancelled publication by calling unpublish"))}},this.client.sendAddTrack(e)})}removeTrack(e){if(e.track&&this.pendingTrackResolvers[e.track.id]){const{reject:n}=this.pendingTrackResolvers[e.track.id];n&&n(),delete this.pendingTrackResolvers[e.track.id]}try{return this.pcManager.removeTrack(e),!0}catch(n){this.log.warn("failed to remove track",{error:n})}return!1}
789updateMuteStatus(e,n){this.client.sendMuteTrack(e,n)}get dataSubscriberReadyState(){var e;return(e=this.reliableDCSub)===null||e===void 0?void 0:e.readyState}getConnectedServerAddress(){return ce(this,void 0,void 0,function*(){var e;return(e=this.pcManager)===null||e===void 0?void 0:e.getConnectedAddress()})}setRegionStrategy(e){this.regionStrategy=e}configure(e,n){return ce(this,void 0,void 0,function*(){var r;if(!(this.pcManager&&this.pcManager.currentState!==Qr.NEW)){if(e){this.participantSid=(r=e.participant)===null||r===void 0?void 0:r.sid;const i=this.makeRTCConfiguration(e);this.pcManager=new fz(n?"publisher-only":e.subscriberPrimary?"subscriber-primary":"publisher-primary",this.loggerOptions,i)}else{const i=this.makeRTCConfiguration();this.pcManager=new fz("publisher-only",this.loggerOptions,i)}this.emit(We.TransportsCreated,this.pcManager.publisher,this.pcManager.subscriber),this.pcManager.onIceCandidate=(i,s)=>{this.client.sendIceCandidate(i,s)},this.pcManager.onPublisherOffer=(i,s)=>{this.client.sendOffer(i,s)},this.pcManager.onDataChannel=this.handleDataChannel,this.pcManager.onStateChange=(i,s,a)=>ce(this,void 0,void 0,function*(){if(this.log.debug("primary PC state changed ".concat(i)),["closed","disconnected","failed"].includes(s)&&(this.publisherConnectionPromise=void 0),i===Qr.CONNECTED){const c=this.pcState===qo.New;this.pcState=qo.Connected,c&&this.emit(We.Connected,this.latestJoinResponse)}else i===Qr.FAILED&&(this.pcState===qo.Connected||this.pcState===qo.Reconnecting)&&(this.pcState=qo.Disconnected,this.handleDisconnect("peerconnection failed",a==="failed"?Qf.RR_SUBSCRIBER_FAILED:Qf.RR_PUBLISHER_FAILED));const o=this.client.isDisconnected||this.client.currentState===mr.RECONNECTING,l=[Qr.FAILED,Qr.CLOSING,Qr.CLOSED].includes(i);o&&l&&!this._isClosed&&this.emit(We.Offline)}),this.pcManager.onTrack=i=>{i.streams.length!==0&&this.emit(We.MediaTrackAdded,i.track,i.streams[0],i.receiver)}}})}setupSignalClientCallbacks(){this.client.onAnswer=(e,n,r)=>ce(this,void 0,void 0,function*(){this.pcManager&&(this.log.debug("received server answer",{RTCSdpType:e.type,sdp:e.sdp,midToTrackId:r}),this.midToTrackId=r,yield this.pcManager.setPublisherAnswer(e,n))}),this.client.onTrickle=(e,n)=>{this.pcManager&&(this.log.debug("got ICE candidate from peer",{candidate:e,target:n}),this.pcManager.addIceCandidate(e,n))},this.client.onOffer=(e,n,r)=>ce(this,void 0,void 0,function*(){if(this.latestRemoteOfferId=n,!this.pcManager)return;this.midToTrackId=r;const i=yield this.pcManager.createSubscriberAnswerFromOffer(e,n);i&&this.client.sendAnswer(i,n)}),this.client.onLocalTrackPublished=e=>{var n;if(this.log.debug("received trackPublishedResponse",{cid:e.cid,track:(n=e.track)===null||n===void 0?void 0:n.sid}),!this.pendingTrackResolvers[e.cid]){this.log.error("missing track resolver for ".concat(e.cid),{cid:e.cid});return}const{resolve:r}=this.pendingTrackResolvers[e.cid];delete this.pendingTrackResolvers[e.cid],r(e.track)},this.client.onLocalTrackUnpublished=e=>{this.emit(We.LocalTrackUnpublished,e)},this.client.onLocalTrackSubscribed=e=>{this.emit(We.LocalTrackSubscribed,e)},this.client.onTokenRefresh=e=>{this.token=e,this.emit(We.TokenRefreshed,e)},this.client.onRemoteMuteChanged=(e,n)=>{this.emit(We.RemoteMute,e,n)},this.client.onSubscribedQualityUpdate=e=>{this.emit(We.SubscribedQualityUpdate,e)},this.client.onRoomMoved=e=>{var n;this.participantSid=(n=e.participant)===null||n===void 0?void 0:n.sid,this.latestJoinResponse&&(this.latestJoinResponse.room=e.room),this.emit(We.RoomMoved,e)},this.client.onMediaSectionsRequirement=e=>{this.addMediaSections(e.numAudios,e.numVideos),this.negotiate()},this.client.onPublishDataTrackResponse=e=>{this.emit(We.PublishDataTrackResponse,e)},this.client.onUnPublishDataTrackResponse=e=>{this.emit(We.UnPublishDataTrackResponse,e)},this.client.onDataTrackSubscriberHandles=e=>{this.emit(We.DataTrackSubscriberHandles,e)},this.client.onClose=()=>{this.handleDisconnect("signal",Qf.RR_SIGNAL_DISCONNECTED)},this.client.onLeave=e=>{switch(this.log.info("client leave request received (action=".concat(e==null?void 0:e.action,")"),{reason:e==null?void 0:e.reason}
789),e.regions&&(this.log.debug("updating regions"),this.emit(We.ServerRegionsReported,e.regions)),e.action){case cv.DISCONNECT:this.emit(We.Disconnected,e==null?void 0:e.reason),this.close();break;case cv.RECONNECT:this.fullReconnectOnNext=!0,this.handleDisconnect(sA);break;case cv.RESUME:this.handleDisconnect(sA)}}}makeRTCConfiguration(e){var n;const r=Object.assign({},this.rtcConfig);if(!((n=this.signalOpts)===null||n===void 0)&&n.e2eeEnabled&&(this.log.debug("E2EE - setting up transports with insertable streams"),r.encodedInsertableStreams=!0),r.sdpSemantics="unified-plan",r.continualGatheringPolicy="gather_continually",!e)return r;if(e.iceServers&&!r.iceServers){const i=[];e.iceServers.forEach(s=>{const a={urls:s.urls};s.username&&(a.username=s.username),s.credential&&(a.credential=s.credential),i.push(a)}),r.iceServers=i}return e.clientConfiguration&&e.clientConfiguration.forceRelay===jw.ENABLED&&(r.iceTransportPolicy="relay"),r}addMediaSections(e,n){var r,i;const s={direction:"recvonly"};for(let a=0;a<e;a++)(r=this.pcManager)===null||r===void 0||r.addPublisherTransceiverOfKind("audio",s);for(let a=0;a<n;a++)(i=this.pcManager)===null||i===void 0||i.addPublisherTransceiverOfKind("video",s)}createDataChannels(){this.pcManager&&(this.lossyDC&&(this.lossyDC.onmessage=null,this.lossyDC.onerror=null),this.reliableDC&&(this.reliableDC.onmessage=null,this.reliableDC.onerror=null),this.dataTrackDC&&(this.dataTrackDC.onmessage=null,this.dataTrackDC.onerror=null),this.lossyDC=this.pcManager.createPublisherDataChannel(_z,{ordered:!1,maxRetransmits:0}),this.reliableDC=this.pcManager.createPublisherDataChannel(wz,{ordered:!0}),this.dataTrackDC=this.pcManager.createPublisherDataChannel(bz,{ordered:!1,maxRetransmits:0}),this.lossyDC.onmessage=this.handleDataMessage,this.reliableDC.onmessage=this.handleDataMessage,this.dataTrackDC.onmessage=this.handleDataTrackMessage,this.lossyDC.onerror=this.handleDataError,this.reliableDC.onerror=this.handleDataError,this.dataTrackDC.onerror=this.handleDataError,this.lossyDC.bufferedAmountLowThreshold=65535,this.reliableDC.bufferedAmountLowThreshold=65535,this.dataTrackDC.bufferedAmountLowThreshold=65535,this.lossyDC.onbufferedamountlow=()=>this.handleBufferedAmountLow(gn.LOSSY),this.reliableDC.onbufferedamountlow=()=>this.handleBufferedAmountLow(gn.RELIABLE),this.dataTrackDC.onbufferedamountlow=()=>this.handleBufferedAmountLow(gn.DATA_TRACK_LOSSY),this.cleanupLossyDataStats(),this.lossyDataStatInterval=setInterval(()=>{this.lossyDataStatByterate=this.lossyDataStatCurrentBytes,this.lossyDataStatCurrentBytes=0;const e=this.dataChannelForKind(gn.LOSSY);if(e){const n=this.lossyDataStatByterate/10;e.bufferedAmountLowThreshold=Math.min(Math.max(n,jBe),BBe)}},1e3))}createSender(e,n,r){return ce(this,void 0,void 0,function*(){if(XN())return yield this.createTransceiverRTCRtpSender(e,n,r);if(QN())return this.log.warn("using add-track fallback"),yield this.createRTCRtpSender(e.mediaStreamTrack);throw new Yr("Required webRTC APIs not supported on this device")})}createSimulcastSender(e,n,r,i){return ce(this,void 0,void 0,function*(){if(XN())return this.createSimulcastTransceiverSender(e,n,r,i);if(QN())return this.log.debug("using add-track fallback"),this.createRTCRtpSender(e.mediaStreamTrack);throw new Yr("Cannot stream on this device")})}createTransceiverRTCRtpSender(e,n,r){return ce(this,void 0,void 0,function*(){if(!this.pcManager)throw new Yr("publisher is closed");const i=[];e.mediaStream&&i.push(e.mediaStream),pf(e)&&(e.codec=n.videoCodec);const s={direction:"sendonly",streams:i};return r&&(s.sendEncodings=r),(yield this.pcManager.addPublisherTransceiver(e.mediaStreamTrack,s)).sender})}createSimulcastTransceiverSender(e,n,r,i){return ce(this,void 0,void 0,function*(){if(!this.pcManager)throw new Yr("publisher is closed");const s={direction:"sendonly"};i&&(s.sendEncodings=i);const a=yield this.pcManager.addPublisherTransceiver(n.mediaStreamTrack,s);if(r.videoCodec)return e.setSimulcastTrackSender(r.videoCodec,a.sender),a.sender})}createRTCRtpSender(e){return ce(this,void 0,void 0,function*(){if(!this.pcManager)throw new Yr("publisher is closed");return this.pcManager.addPublisherTrack(e)})}attemptReconnect(e){return ce(this,void 0,void 0,function*(){var n,r,i;if(!this._isClosed){if(this.attemptingReconnect){this.log.warn("already attempting reconnect, returning early");return}(((n=this.clientConfiguration)===null||n===void 0?void 0:n.resumeConnection)===jw.DISABLED||((i=(r=this.pcManager)===null||r===void 0?void 0:r.currentState)!==null&&i!==void 0?i:Qr.NEW)===Qr.NEW)&&(this.fullReconnectOnNext=!0);try{this.attemptingReconnect=!0,this.fullReconnectOnNext?yield this.restartConnection():yield this.resumeConnection(e),this.clearPendingReconnect(),this.fullReconnectOnNext=!1}catch(s){this.reconnectAttempts+=1;let a=!0;s instanceof Yr?(this.log.debug("received unrecoverable error",{error:s}),a=!1):s instanceof lg||(this.fullReconnectOnNext=!0),a?this.handleDisconnect("reconnect",Qf.RR_UNKNOWN):(this.log.info("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(Date.now()-this.reconnectStart,"ms. giving up")),this.emit
vendor: 2,256 bytes, line 789
789(We.Disconnected),yield this.close())}finally{this.attemptingReconnect=!1}}})}getNextRetryDelay(e){try{return this.reconnectPolicy.nextRetryDelayInMs(e)}catch(n){this.log.warn("encountered error in reconnect policy",{error:n})}return null}restartConnection(e){return ce(this,void 0,void 0,function*(){var n,r,i;try{if(!this.url||!this.token)throw new Yr("could not reconnect, url or token not saved");this.log.info("reconnecting, attempt: ".concat(this.reconnectAttempts)),this.emit(We.Restarting),this.client.isDisconnected||(yield this.client.sendLeave()),yield this.cleanupPeerConnections(),yield this.cleanupClient();let s;try{if(!this.signalOpts)throw this.log.warn("attempted connection restart, without signal options present"),new lg;s=(yield this.join(e??this.url,this.token,this.signalOpts,void 0,!this.options.singlePeerConnection)).joinResponse}catch(a){throw a instanceof Ot&&a.reason===vr.NotAllowed?new Yr("could not reconnect, token might be expired"):new lg}if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(this.client.setReconnected(),this.emit(We.SignalRestarted,s),yield this.waitForPCReconnected(),this.client.currentState!==mr.CONNECTED)throw new lg("Signal connection got severed during reconnect");(n=this.regionStrategy)===null||n===void 0||n.resetAttempts(),this.emit(We.Restarted)}catch(s){const a=yield(r=this.regionStrategy)===null||r===void 0?void 0:r.getNextUrl();if(a){yield this.restartConnection(a);return}else throw(i=this.regionStrategy)===null||i===void 0||i.resetAttempts(),s}})}resumeConnection(e){return ce(this,void 0,void 0,function*(){var n;if(!this.url||!this.token)throw new Yr("could not reconnect, url or token not saved");if(!this.pcManager)throw new Yr("publisher and subscriber connections unset");this.log.info("resuming signal connection, attempt ".concat(this.reconnectAttempts)),this.emit(We.Resuming);let r;try{this.setupSignalClientCallbacks(),r=yield this.client.reconnect(this.url,this.token,this.participantSid,e)}catch(i){let s="";throw i instanceof Error&&(s=i.message,this.log.error(i.message,{error:i})),i instanceof Ot&&i.reason===vr.NotAllowed?new Yr("could not reconnect, token might be expired"):i instanceof Ot&&i.reason===vr.LeaveRequest?i:new lg(s)}
789if(this.emit(We.SignalResumed),r){const i=this.makeRTCConfiguration(r);this.pcManager.updateConfiguration(i),this.latestJoinResponse&&(this.latestJoinResponse.serverInfo=r.serverInfo)}else this.log.warn("Did not receive reconnect response");if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(yield this.pcManager.triggerIceRestart(),yield this.waitForPCReconnected(),this.client.currentState!==mr.CONNECTED)throw new lg("Signal connection got severed during reconnect");this.client.setReconnected(),((n=this.reliableDC)===null||n===void 0?void 0:n.readyState)==="open"&&this.reliableDC.id===null&&this.createDataChannels(),r!=null&&r.lastMessageSeq&&this.resendReliableMessagesForResume(r.lastMessageSeq),this.emit(We.Resumed)})}waitForPCInitialConnection(e,n){return ce(this,void 0,void 0,function*(){if(!this.pcManager)throw new Yr("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(n,e)})}waitForPCReconnected(){return ce(this,void 0,void 0,function*(){this.pcState=qo.Reconnecting,this.log.debug("waiting for peer connection to reconnect");try{if(yield Zs(DBe),!this.pcManager)throw new Yr("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(void 0,this.peerConnectionTimeout),this.pcState=qo.Connected}catch(e){throw this.pcState=qo.Disconnected,Ot.internal("could not establish PC connection, ".concat(e.message))}})}publishRpcResponse(e,n,r,i){return ce(this,void 0,void 0,function*(){const s=new _a({destinationIdentities:[e],kind:yp.RELIABLE,value:{case:"rpcResponse",value:new TO({requestId:n,value:i?{case:"error",value:i.toProto()}:{case:"payload",value:r??""}})}});yield this.sendDataPacket(s,gn.RELIABLE)})}publishRpcAck(e,n){return ce(this,void 0,void 0,function*(){const r=new _a({destinationIdentities:[e],kind:yp.RELIABLE,value:{case:"rpcAck",value:new SO({requestId:n})}});yield this.sendDataPacket(r,gn.RELIABLE)})}sendDataPacket(e,n){return ce(this,void 0,void 0,function*(){if(yield this.ensurePublisherConnected(n),this.e2eeManager&&this.e2eeManager.isDataChannelEncryptionEnabled){const i=X8e(e);if(i){const s=yield this.e2eeManager.encryptData(i.toBinary());e.value={case:"encryptedPacket",value:new Jee({encryptedValue:s.payload,iv:s.iv,keyIndex:s.keyIndex})}}}n===gn.RELIABLE&&(e.sequence=this.reliableDataSequence,this.reliableDataSequence+=1);const r=e.toBinary();switch(n){case gn.LOSSY:case gn.DATA_TRACK_LOSSY:return this.sendLossyBytes(r,n);case gn.RELIABLE:const i=this.dataChannelForKind(n);if(i){if(yield this.waitForBufferStatusLow(n),this.reliableMessageBuffer.push({data:r,sequence:e.sequence}),this.attemptingReconnect)return;i.send(r)}this.updateAndEmitDCBufferStatus(n);break}})}sendLossyBytes(e,n){return ce(this,arguments,void 0,function(r,i){var s=this;let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"drop";return function*(){yield s.ensurePublisherConnected(i);const o=s.dataChannelForKind(i);if(o){if(!s.isBufferStatusLow(i))switch(a){case"wait":yield s.waitForBufferStatusLow(i);break;case"drop":s.lossyDataDropCount+=1,s.lossyDataDropCount%100===0&&s.log.warn("dropping lossy data channel messages, total dropped: ".concat(s.lossyDataDropCount));return}if(s.lossyDataStatCurrentBytes+=r.byteLength,s.attemptingReconnect)return;o.send(r)}s.updateAndEmitDCBufferStatus(i)}()})}resendReliableMessagesForResume(e){return ce(this,void 0,void 0,function*(){yield this.ensurePublisherConnected(gn.RELIABLE);const n=this.dataChannelForKind(gn.RELIABLE);n&&(this.reliableMessageBuffer.popToSequence(e),this.reliableMessageBuffer.getAll().forEach(r=>{n.send(r.data)})),this.updateAndEmitDCBufferStatus(gn.RELIABLE)})}waitForBufferStatusLow(e){return ce(this,void 0,void 0,function*(){return new Xs((n,r)=>ce(this,void 0,void 0,function*(){if(this.isClosed&&r(new Yr("engine closed")),this.isBufferStatusLow(e))n();else{const i=this.dataChannelForKind(e);if(!i){r(new Yr("DataChannel not found, kind: ".concat(e)));return}this.bufferStatusLowClosingFuture.promise.catch(s=>r(s)),i.addEventListener("bufferedamountlow",()=>n(),{once:!0})}}))})}ensureDataTransportConnected(e){return ce(this,arguments,void 0,function(n){var r=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.subscriberPrimary;return function*(){var s;if(!r.pcManager)throw new Yr("PC manager is closed");const a=i?r.pcManager.subscriber:r.pcManager.publisher,o=i?"Subscriber":"Publisher";if(!a)throw Ot.internal("".concat(o," connection not set"));let l=!1;!i&&!r.dataChannelForKind(n,i)&&(r.createDataChannels(),l=!0),!l&&!i&&!r.pcManager.publisher.isICEConnected&&r.pcManager.publisher.getICEConnectionState()!=="checking"&&(l=!0),l&&r.negotiate().catch(d=>{r.log.error(d)});const c=r.dataChannelForKind(n,i);if((c==null?void 0:c.readyState)==="open")return;const u=new Date().getTime()+r.peerConnectionTimeout;for(;new Date().getTime()<u;){if(a.isICEConnected&&((s=r.dataChannelForKind(n,i))===null||s===void 0?void 0:s.readyState)==="open")return;yield Zs(50)}throw Ot.internal("could not establish ".concat(o," connection, state: ").concat(a.getICEConnectionState()))}()})}ensurePublisherConnected(e){return ce(this,void 0,void 0,function*(){this.publisherConnectionPromise||(this.publisherConnectionPromise=this.ensureDataTransportConnected(e,!1)),yield this.publisherConnectionPromise})}verifyTransport(){return!(!this.pcManager||![Qr.CONNECTING,Qr.CONNECTED].includes(this.pcManager.currentState)||!this.client.ws||this.client.ws.readyState===WebSocket.CLOSED)}negotiate(){return ce(this,void 0,void 0,function*(){return new Xs((e,n)=>ce(this,void 0,void 0,function*(){if(!this.pcManager){n(new Rp("PC manager is closed"));return}this.pcManager.requirePublisher(),this.pcManager.publisher.getTransceivers().length==0&&!this.lossyDC&&!this.reliableDC&&!this.dataTrackDC&&this.createDataChannels();const r=new AbortController,i=()=>{r.abort(),this.log.debug("engine disconnected while negotiation was ongoing"),e()};this.isClosed&&n(new Rp("cannot negotiate on closed engine")),this.on(We.Closing,i),this.on(We.Restarting,i),this.pcManager.publisher.once(_p.RTPVideoPayloadTypes,s=>{const a=new Map;
789s.forEach(o=>{const l=o.codec.toLowerCase();L8e(l)&&a.set(o.payload,l)}),this.emit(We.RTPVideoMapUpdate,a)});try{yield this.pcManager.negotiate(r),e()}catch(s){if(r.signal.aborted){e();return}s instanceof Rp&&(this.fullReconnectOnNext=!0),this.handleDisconnect("negotiation",Qf.RR_UNKNOWN),s instanceof Error?n(s):n(new Error(String(s)))}finally{this.off(We.Closing,i),this.off(We.Restarting,i)}}))})}dataChannelForKind(e,n){switch(e){case gn.RELIABLE:return n?this.reliableDCSub:this.reliableDC;case gn.LOSSY:return n?this.lossyDCSub:this.lossyDC;case gn.DATA_TRACK_LOSSY:return n?this.dataTrackDCSub:this.dataTrackDC}}sendSyncState(e,n,r){var i,s,a,o;if(!this.pcManager){this.log.warn("sync state cannot be sent without peer connection setup");return}const l=this.pcManager.publisher.getLocalDescription(),c=this.pcManager.publisher.getRemoteDescription(),u=(i=this.pcManager.subscriber)===null||i===void 0?void 0:i.getRemoteDescription(),d=(s=this.pcManager.subscriber)===null||s===void 0?void 0:s.getLocalDescription(),f=(o=(a=this.signalOpts)===null||a===void 0?void 0:a.autoSubscribe)!==null&&o!==void 0?o:!0,h=new Array,p=new Array;e.forEach(m=>{m.isDesired!==f&&h.push(m.trackSid),m.isEnabled||p.push(m.trackSid)}),this.client.sendSyncState(new IO({answer:this.pcManager.mode==="publisher-only"?c?sp({sdp:c.sdp,type:c.type}):void 0:d?sp({sdp:d.sdp,type:d.type}):void 0,offer:this.pcManager.mode==="publisher-only"?l?sp({sdp:l.sdp,type:l.type}):void 0:u?sp({sdp:u.sdp,type:u.type}):void 0,subscription:new aC({trackSids:h,subscribe:!f,participantTracks:[]}),publishTracks:v8e(n),dataChannels:this.dataChannelsInfo(),trackSidsDisabled:p,datachannelReceiveStates:this.reliableReceivedState.map((m,g)=>new vte({publisherSid:g,lastSeq:m})),publishDataTracks:r.map(m=>new EO({info:xS.toProtobuf(m)}))}))}failNext(){this.shouldFailNext=!0}failNextV1Path(){this.shouldFailOnV1Path=!0}dataChannelsInfo(){const e=[],n=(r,i)=>{(r==null?void 0:r.id)!==void 0&&r.id!==null&&e.push(new yte({label:r.label,id:r.id,target:i}))};return n(this.dataChannelForKind(gn.LOSSY),$l.PUBLISHER),n(this.dataChannelForKind(gn.RELIABLE),$l.PUBLISHER),n(this.dataChannelForKind(gn.LOSSY,!0),$l.SUBSCRIBER),n(this.dataChannelForKind(gn.RELIABLE,!0),$l.SUBSCRIBER),e}clearReconnectTimeout(){this.reconnectTimeout&&Fi.clearTimeout(this.reconnectTimeout)}clearPendingReconnect(){this.clearReconnectTimeout(),this.reconnectAttempts=0}registerOnLineListener(){Wa()&&(window.addEventListener("online",this.handleBrowserOnLine),window.addEventListener("offline",this.handleBrowserOffline))}deregisterOnLineListener(){Wa()&&(window.removeEventListener("online",this.handleBrowserOnLine),window.removeEventListener("offline",this.handleBrowserOffline))}getTrackIdForReceiver(e){var n;const r=(n=this.pcManager)===null||n===void 0?void 0:n.getMidForReceiver(e);if(r){const i=Object.entries(this.midToTrackId).find(s=>{let[a]=s;return a===r});if(i)return i[1]}}}function xz(t,e){const n=t.participantIdentity?t.participantIdentity:e.participantIdentity;t.participantIdentity=n,e.participantIdentity=n;const r=t.destinationIdentities.length!==0?t.destinationIdentities:e.destinationIdentities;t.destinationIdentities=r,e.destinationIdentities=r}const s3=5e3,VBe=3e4;class In{static fetchRegionSettings(e,n,r){return ce(this,void 0,void 0,function*(){const i=yield In.fetchLock.lock();try{const s=yield fetch("".concat(qBe(e),"/regions"),{headers:{authorization:"Bearer ".concat(n)},signal:r});if(s.ok){const a=z8e(s.headers),o=a?a*1e3:s3;return{regionSettings:yield s.json(),updatedAtInMs:Date.now(),maxAgeInMs:o}}else throw s.status===401?Ot.notAllowed("Could not fetch region settings: ".concat(s.statusText),s.status):Ot.internal("Could not fetch region settings: ".concat(s.statusText))}catch(s){throw s instanceof Ot?s:r!=null&&r.aborted?Ot.cancelled("Region fetching was aborted"):Ot.serverUnreachable("Could not fetch region settings, ".concat(s instanceof Error?"".concat(s.name,": ").concat(s.message):s))}finally{i()}})}static scheduleRefetch(e,n,r){return ce(this,void 0,void 0,function*(){const i=In.settingsTimeouts.get(e.hostname);clearTimeout(i),In.settingsTimeouts.set(e.hostname,setTimeout(()=>ce(this,void 0,void 0,function*(){try{const s=yield In.fetchRegionSettings(e,n
789);In.updateCachedRegionSettings(e,n,s)}catch(s){if(s instanceof Ot&&s.reason===vr.NotAllowed){mn.debug("token is not valid, cancelling auto region refresh");return}mn.debug("auto refetching of region settings failed",{error:s}),In.scheduleRefetch(e,n,r)}}),r))})}static updateCachedRegionSettings(e,n,r){In.cache.set(e.hostname,r),In.scheduleRefetch(e,n,r.maxAgeInMs)}static stopRefetch(e){const n=In.settingsTimeouts.get(e);n&&(clearTimeout(n),In.settingsTimeouts.delete(e))}static scheduleCleanup(e){let n=In.connectionTrackers.get(e);n&&(n.cleanupTimeout&&clearTimeout(n.cleanupTimeout),n.cleanupTimeout=setTimeout(()=>{const r=In.connectionTrackers.get(e);r&&r.connectionCount===0&&(mn.debug("stopping region refetch after disconnect delay",{hostname:e}),In.stopRefetch(e)),r&&(r.cleanupTimeout=void 0)},VBe))}static cancelCleanup(e){const n=In.connectionTrackers.get(e);n!=null&&n.cleanupTimeout&&(clearTimeout(n.cleanupTimeout),n.cleanupTimeout=void 0)}notifyConnected(){const e=this.serverUrl.hostname;let n=In.connectionTrackers.get(e);n||(n={connectionCount:0},In.connectionTrackers.set(e,n)),n.connectionCount++,In.cancelCleanup(e)}notifyDisconnected(){const e=this.serverUrl.hostname,n=In.connectionTrackers.get(e);n&&(n.connectionCount=Math.max(0,n.connectionCount-1),n.connectionCount===0&&In.scheduleCleanup(e))}constructor(e,n){this.attemptedRegions=[],this.serverUrl=new URL(e),this.token=n}updateToken(e){var n;this.token=e;const r=this.getServerUrl(),i=In.cache.get(r.hostname);In.scheduleRefetch(this.serverUrl,this.token,(n=i==null?void 0:i.maxAgeInMs)!==null&&n!==void 0?n:s3)}isCloud(){return qv(this.serverUrl)}getServerUrl(){return this.serverUrl}fetchRegionSettings(e){return ce(this,void 0,void 0,function*(){return In.fetchRegionSettings(this.serverUrl,this.token,e)})}getNextBestRegionUrl(e){return ce(this,void 0,void 0,function*(){if(!this.isCloud())throw Error("region availability is only supported for LiveKit Cloud domains");let n=In.cache.get(this.serverUrl.hostname);(!n||Date.now()-n.updatedAtInMs>n.maxAgeInMs)&&(n=yield this.fetchRegionSettings(e),In.updateCachedRegionSettings(this.serverUrl,this.token,n));const r=n.regionSettings.regions.filter(i=>!this.attemptedRegions.find(s=>s.url===i.url));if(r.length>0){const i=r[0];return this.attemptedRegions.push(i),mn.debug("next region: ".concat(i.region)),i.url}else return null})}resetAttempts(){this.attemptedRegions=[]}setServerReportedRegions(e){In.updateCachedRegionSettings(this.serverUrl,this.token,e)}}In.cache=new Map;In.settingsTimeouts=new Map;In.connectionTrackers=new Map;In.fetchLock=new As;function qBe(t){return"".concat(t.protocol.replace("ws","http"),"//").concat(t.host,"/settings")}class vne{get info(){return this._info}validateBytesReceived(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(!(typeof this.totalByteSize!="number"||this.totalByteSize===0)){if(e&&this.bytesReceived<this.totalByteSize)throw new Wo("Not enough chunk(s) received - expected ".concat(this.totalByteSize," bytes of data total, only received ").concat(this.bytesReceived," bytes"),va.Incomplete);if(this.bytesReceived>this.totalByteSize)throw new Wo("Extra chunk(s) received - expected ".concat(this.totalByteSize," bytes of data total, received ").concat(this.bytesReceived," bytes"),va.LengthExceeded)}}constructor(e,n,r){this.reader=n,this.totalByteSize=r,this._info=e,this.bytesReceived=0}}class WBe extends vne{handleChunkReceived(e){var n;this.bytesReceived+=e.content.byteLength,this.validateBytesReceived();const r=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(n=this.onProgress)===null||n===void 0||n.call(this,r)}[Symbol.asyncIterator](){const e=this.reader.getReader();e.closed.catch(()=>{});const n=()=>{e.releaseLock(),this.signal=void 0};return{next:()=>ce(this,void 0,void 0,function*(){try{const r=this.signal;if(r!=null&&r.aborted)throw r.reason;const i=yield new Promise((s,a)=>{if(r){const o=()=>a(r.reason);r.addEventListener("abort",o,{once:!0}),e.read().then(s,a).finally(()=>{r.removeEventListener("abort",o)})}else e.read().then(s,a)});return i.done?(this.validateBytesReceived(!0),{done:!0,value:void 0}):(this.handleChunkReceived(i.value),{done:!1,value:i.value.content})}catch(r){throw n(),r}}),return(){return ce(this,void 0,void 0,function*(){return n(),{done:!0,value:void 0}})}}}withAbortSignal(e){return this.signal=e,this}readAll(){return ce(this,arguments,void 0,function(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return function*(){var r,i,s,a;let o=new Set;const l=n.signal?e.withAbortSignal(n.signal):e;try{for(var c=!0,u=Vl(l),d;d=yield u.next(),r=d.done,!r;c=!0){a=d.value,c=!1;const f=a;o.add(f)}}catch(f){i={error:f}}finally{try{!c&&!r&&(s=u.return)&&(yield s.call(u))}finally{if(i)throw i.error}}return Array.from(o)}()})}}class GBe extends vne{constructor(e,n,r){super(e,n,r),this.receivedChunks=new Map}handleChunkReceived(e){var n;const r=Gx(e.chunkIndex),i=this.receivedChunks.get(r);if(i&&i.version>e.version)return;this.receivedChunks.set(r,e),this.bytesReceived+=e.content.byteLength,this.validateBytesReceived();const s=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(n=this.onProgress)===null||n===void 0||n.call(this,s)}[Symbol.asyncIterator](){const e=this.reader.getReader();e.closed.catch(()=>{});const n=new TextDecoder("utf-8",{fatal:!0}),r=this.signal,i=()=>{e.releaseLock(),this.signal=void 0};return{next:()=>ce(this,void 0,void 0,function*(){try{if(r!=null&&r.aborted)throw r.reason;const s=yield new Promise((a,o)=>
789{if(r){const l=()=>o(r.reason);r.addEventListener("abort",l,{once:!0}),e.read().then(a,o).finally(()=>{r.removeEventListener("abort",l)})}else e.read().then(a,o)});if(s.done)return this.validateBytesReceived(!0),{done:!0,value:void 0};{this.handleChunkReceived(s.value);let a;try{a=n.decode(s.value.content)}catch(o){throw new Wo("Cannot decode datastream chunk ".concat(s.value.chunkIndex," as text: ").concat(o),va.DecodeFailed)}return{done:!1,value:a}}}catch(s){throw i(),s}}),return(){return ce(this,void 0,void 0,function*(){return i(),{done:!0,value:void 0}})}}}withAbortSignal(e){return this.signal=e,this}readAll(){return ce(this,arguments,void 0,function(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return function*(){var r,i,s,a;let o="";const l=n.signal?e.withAbortSignal(n.signal):e;try{for(var c=!0,u=Vl(l),d;d=yield u.next(),r=d.done,!r;c=!0)a=d.value,c=!1,o+=a}catch(f){i={error:f}}finally{try{!c&&!r&&(s=u.return)&&(yield s.call(u))}finally{if(i)throw i.error}}return o}()})}}class HBe{constructor(){this.log=mn,this.byteStreamControllers=new Map,this.textStreamControllers=new Map,this.byteStreamHandlers=new Map,this.textStreamHandlers=new Map,this.isConnected=!1,this.bufferedPackets=[]}setConnected(e){this.isConnected=e,e&&this.flushBufferedPackets()}flushBufferedPackets(){const e=this.bufferedPackets;this.bufferedPackets=[];for(const{packet:n,encryptionType:r}of e)this.handleDataStreamPacket(n,r)}registerTextStreamHandler(e,n){if(this.textStreamHandlers.has(e))throw new Wo('A text stream handler for topic "'.concat(e,'" has already been set.'),va.HandlerAlreadyRegistered);this.textStreamHandlers.set(e,n)}unregisterTextStreamHandler(e){this.textStreamHandlers.delete(e)}registerByteStreamHandler(e,n){if(this.byteStreamHandlers.has(e))throw new Wo('A byte stream handler for topic "'.concat(e,'" has already been set.'),va.HandlerAlreadyRegistered);this.byteStreamHandlers.set(e,n)}unregisterByteStreamHandler(e){this.byteStreamHandlers.delete(e)}clearControllers(){this.byteStreamControllers.clear(),this.textStreamControllers.clear(),this.bufferedPackets=[]}validateParticipantHasNoActiveDataStreams(e){const n=Array.from(this.textStreamControllers.entries()).filter(i=>i[1].sendingParticipantIdentity===e),r=Array.from(this.byteStreamControllers.entries()).filter(i=>i[1].sendingParticipantIdentity===e);if(n.length>0||r.length>0){const i=new Wo("Participant ".concat(e," unexpectedly disconnected in the middle of sending data"),va.AbnormalEnd);for(const[s,a]of r)a.controller.error(i),this.byteStreamControllers.delete(s);for(const[s,a]of n)a.controller.error(i),this.textStreamControllers.delete(s)}}handleDataStreamPacket(e,n){if(!this.isConnected){this.bufferedPackets.push({packet:e,encryptionType:n});return}switch(e.value.case){case"streamHeader":return this.handleStreamHeader(e.value.value,e.participantIdentity,n);case"streamChunk":return this.handleStreamChunk(e.value.value,n);case"streamTrailer":return this.handleStreamTrailer(e.value.value,n);default:throw new Error('DataPacket of value "'.concat(e.value.case,'" is not data stream related!'))}}handleStreamHeader(e,n,r){var i;if(e.contentHeader.case==="byteHeader"){const s=this.byteStreamHandlers.get(e.topic);if(!s){this.log.debug("ignoring incoming byte stream due to no handler for topic",e.topic);return}let a;const o={id:e.streamId,name:(i=e.contentHeader.value.name)!==null&&i!==void 0?i:"unknown",mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:Gx(e.timestamp),attributes:e.attributes,encryptionType:r},l=new ReadableStream({start:c=>{if(a=c,this.textStreamControllers.has(e.streamId))throw new Wo("A data stream read is already in progress for a stream with id ".concat(e.streamId,"."),va.AlreadyOpened);this.byteStreamControllers.set(e.streamId,{info:o,controller:a,startTime:Date.now(),sendingParticipantIdentity:n})}});s(new WBe(o,l,Gx(e.totalLength)),{identity:n})}else if(e.contentHeader.case==="textHeader"){const s=this.textStreamHandlers.get(e.topic);if(!s){this.log.debug("ignoring incoming text stream due to no handler for topic",e.topic);return}let a;const o={id:e.streamId,mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:Number(e.timestamp),attributes:e.attributes,encryptionType:r,attachedStreamIds:e.contentHeader.value.attachedStreamIds},l=new ReadableStream({start:c=>{if(a=c,this.textStreamControllers.has(e.streamId))throw new Wo("A data stream read is already in progress for a stream with i
789d ".concat(e.streamId,"."),va.AlreadyOpened);this.textStreamControllers.set(e.streamId,{info:o,controller:a,startTime:Date.now(),sendingParticipantIdentity:n})}});s(new GBe(o,l,Gx(e.totalLength)),{identity:n})}}handleStreamChunk(e,n){const r=this.byteStreamControllers.get(e.streamId);r&&(r.info.encryptionType!==n?(r.controller.error(new Wo("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(n,", got ").concat(r.info.encryptionType),va.EncryptionTypeMismatch)),this.byteStreamControllers.delete(e.streamId)):e.content.length>0&&r.controller.enqueue(e));const i=this.textStreamControllers.get(e.streamId);i&&(i.info.encryptionType!==n?(i.controller.error(new Wo("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(n,", got ").concat(i.info.encryptionType),va.EncryptionTypeMismatch)),this.textStreamControllers.delete(e.streamId)):e.content.length>0&&i.controller.enqueue(e))}handleStreamTrailer(e,n){const r=this.textStreamControllers.get(e.streamId);r&&(r.info.encryptionType!==n?r.controller.error(new Wo("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(n,", got ").concat(r.info.encryptionType),va.EncryptionTypeMismatch)):(r.info.attributes=Object.assign(Object.assign({},r.info.attributes),e.attributes),r.controller.close(),this.textStreamControllers.delete(e.streamId)));const i=this.byteStreamControllers.get(e.streamId);i&&(i.info.encryptionType!==n?i.controller.error(new Wo("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(n,", got ").concat(i.info.encryptionType),va.EncryptionTypeMismatch)):(i.info.attributes=Object.assign(Object.assign({},i.info.attributes),e.attributes),i.controller.close()),this.byteStreamControllers.delete(e.streamId))}}class yne{constructor(e,n,r){this.writableStream=e,this.defaultWriter=e.getWriter(),this.onClose=r,this.info=n}write(e){return this.defaultWriter.write(e)}close(){return ce(this,void 0,void 0,function*(){var e;yield this.defaultWriter.close(),this.defaultWriter.releaseLock(),(e=this.onClose)===null||e===void 0||e.call(this)})}}class KBe extends yne{}class JBe extends yne{}const kz=15e3;class YBe{constructor(e,n){this.engine=e,this.log=n}setupEngine(e){this.engine=e}sendText(e,n){return ce(this,void 0,void 0,function*(){var r;const i=crypto.randomUUID(),a=new TextEncoder().encode(e).byteLength,o=(r=n==null?void 0:n.attachments)===null||r===void 0?void 0:r.map(()=>crypto.randomUUID()),l=new Array(o?o.length+1:1).fill(0),c=(d,f)=>{var h;l[f]=d;const p=l.reduce((m,g)=>m+g,0);(h=n==null?void 0:n.onProgress)===null||h===void 0||h.call(n,p)},u=yield this.streamText({streamId:i,totalSize:a,destinationIdentities:n==null?void 0:n.destinationIdentities,topic:n==null?void 0:n.topic,attachedStreamIds:o,attributes:n==null?void 0:n.attributes});return yield u.write(e),c(1,0),yield u.close(),n!=null&&n.attachments&&o&&(yield Promise.all(n.attachments.map((d,f)=>ce(this,void 0,void 0,function*(){return this._sendFile(o[f],d,{topic:n.topic,mimeType:d.type,onProgress:h=>{c(h,f+1)}})})))),u.info})}streamText(e){return ce(this,void 0,void 0,function*(){var n,r,i;const s=(n=e==null?void 0:e.streamId)!==null&&n!==void 0?n:crypto.randomUUID(),a={id:s,mimeType:"text/plain",timestamp:Date.now(),topic:(r=e==null?void 0:e.topic)!==null&&r!==void 0?r:"",size:e==null?void 0:e.totalSize,attributes:e==null?void 0:e.attributes,encryptionType:!((i=this.engine.e2eeManager)===null||i===void 0)&&i.isDataChannelEncryptionEnabled?yr.GCM:yr.NONE,attachedStreamIds:e==null?void 0:e.attachedStreamIds},o=new yS({streamId:s,mimeType:a.mimeType,topic:a.topic,timestamp:Zf(a.timestamp),totalLength:Zf(a.size),attributes:a.attributes,contentHeader:{case:"textHeader",value:new ote({version:e==null?void 0:e.version,attachedStreamIds:a.attachedStreamIds,replyToStreamId:e==null?void 0:e.replyToStreamId,operationType:(e==null?void 0:e.type)==="update"?ON.UPDATE:ON.CREATE})}}),l=e==null?void 0:e.destinationIdentities,c=new _a({destinationIdentities:l,value:{case:"streamHeader",value:o}});yield this.engine.sendDataPacket(c,gn.RELIABLE);let u=0;const d=this.engine,f=new WritableStream({write(m){return ce(this,void 0,void 0,function*(){for(const g of U8e(m,kz)){const v=new _S({content:g,streamId:s,chunkIndex:Zf(u)}),_=new _a({destinationIdentities:l,value:{case:"streamChunk",value:v}});yield d.sendDataPacket(_,gn.RELIABLE),u+=1}})},close(){return ce(this,void 0,void 0,function*(){const m=new wS({streamId:s}),g=new _a({destinationIdentities:l,value:{case:"streamTrailer",value:m}});yield d.sendDataPacket(g,gn.RELIABLE)})},abort(m){console.log("Sink error:",m)}});let h=()=>ce(this,void 0,void 0,function*(){yield p.close()});d.once(We.Closing,h);const p=new KBe(f,a,()=>this.engine.off(We.Closing,h));return p})}sendFile(e,n){return ce(this,void 0,void 0,function*(){const r=crypto.randomUUID();return yield this._sendFile(r,e,n),{id:r}})}_sendFile(e,n,r){return ce(this,void 0,void 0,function*(){var i;const s=yield this.streamBytes({streamId:e,totalSize:n.size,name:n.name,mimeType:(i=r==null?void 0:r.mimeType)!==null&&i!==void 0?i:n.type,topic:r==null?void 0:r.topic,destinationIdentities:r==null?void 0:r.destinationIdentities}),a=n.stream().getReader();for(;;){const{done:o,value:l}=yield a.read();if(o)break;yield s.write(l)}return yield s.close(),s.info})}streamBytes(e){return ce(this,void 0,void 0,function*(){var n,r,i,s,a;const o=(n=e==null?void 0:e.streamId)!==null&&n!==void 0?n:crypto.randomUUID(),l=e==null?void 0:e.destinationIdentities,c={id:o,mimeType:(r=e==null?void 0:e.mimeType)!==null&&r!==void 0?r:"application/octet-stream",topic:(i=e==null?void 0:e.topic)!==null&&i!==void 0?i:"",timestamp:Date.now(),attributes:e==null?void 0:e.attributes,size:e==null?void 0:e.totalSize,name:(s=e==null?void 0:e.name)!==null&&s!==void 0?s:"unknown",encryptionType:!((a=this.engine.e2eeManager)===null||a===void 0)&&a.isDataChannelEncryptionEnabled?yr.GCM:yr.NONE}
789,u=new yS({totalLength:Zf(c.size),mimeType:c.mimeType,streamId:o,topic:c.topic,timestamp:Zf(Date.now()),attributes:c.attributes,contentHeader:{case:"byteHeader",value:new lte({name:c.name})}}),d=new _a({destinationIdentities:l,value:{case:"streamHeader",value:u}});yield this.engine.sendDataPacket(d,gn.RELIABLE);let f=0;const h=new As,p=this.engine,m=this.log,g=new WritableStream({write(_){return ce(this,void 0,void 0,function*(){const b=yield h.lock();let x=0;try{for(;x<_.byteLength;){const T=_.slice(x,x+kz),N=new _a({destinationIdentities:l,value:{case:"streamChunk",value:new _S({content:T,streamId:o,chunkIndex:Zf(f)})}});yield p.sendDataPacket(N,gn.RELIABLE),f+=1,x+=T.byteLength}}finally{b()}})},close(){return ce(this,void 0,void 0,function*(){const _=new wS({streamId:o}),b=new _a({destinationIdentities:l,value:{case:"streamTrailer",value:_}});yield p.sendDataPacket(b,gn.RELIABLE)})},abort(_){m.error("Sink error:",_)}});return new JBe(g,c)})}}function _ne(t){if(t.length===0)return new AbortController().signal;if(t.length===1)return t[0];for(const i of t)if(i.aborted)return i;const e=new AbortController,n=Array(t.length),r=()=>{for(const i of n)i()};return t.forEach((i,s)=>{const a=()=>{e.abort(i.reason),r()};i.addEventListener("abort",a),n[s]=()=>i.removeEventListener("abort",a)}),e.signal}function wne(t){const e=new AbortController;return setTimeout(()=>{e.abort(new DOMException("signal timed out after ".concat(t," ms"),"TimeoutError"))},t),e.signal}const vi=1,Uu=2,Sz=4,XBe=8,Tz=0,Cz=12,Ez=5,QBe=7,Az=3,ZBe=3,Pz=2,Mz=1,Nz=0,Rz=3,C2=2,Iz=2,eUe=1,tUe=0;var Gu;(function(t){t[t.TooShort=0]="TooShort",t[t.HeaderOverrun=1]="HeaderOverrun",t[t.MissingExtWords=2]="MissingExtWords",t[t.UnsupportedVersion=3]="UnsupportedVersion",t[t.InvalidHandle=4]="InvalidHandle",t[t.MalformedExt=5]="MalformedExt"})(Gu||(Gu={}));class wa extends ol{constructor(e,n,r){super(19,e,r),this.name="DataTrackDeserializeError",this.reason=n,this.reasonName=Gu[n]}static tooShort(){return new wa("Too short to contain a valid header",Gu.TooShort)}static headerOverrun(){return new wa("Header exceeds total packet length",Gu.HeaderOverrun)}static missingExtWords(){return new wa("Extension word indicator is missing",Gu.MissingExtWords)}static unsupportedVersion(e){return new wa("Unsupported version ".concat(e),Gu.UnsupportedVersion)}static invalidHandle(e){return new wa("invalid track handle: ".concat(e.message),Gu.InvalidHandle,{cause:e})}static malformedExt(e){return new wa("Extension with tag ".concat(e," is malformed"),Gu.MalformedExt)}}var F_;(function(t){t[t.TooSmallForHeader=0]="TooSmallForHeader",t[t.TooSmallForPayload=1]="TooSmallForPayload"})(F_||(F_={}));class qw extends ol{constructor(e,n,r){super(19,e,r),this.name="DataTrackSerializeError",this.reason=n,this.reasonName=F_[n]}static tooSmallForHeader(){return new qw("Buffer cannot fit header",F_.TooSmallForHeader)}static tooSmallForPayload(){return new qw("Buffer cannot fit payload",F_.TooSmallForPayload)}}class uC{toBinary(){const e=this.toBinaryLengthBytes(),n=new ArrayBuffer(e),r=new DataView(n),i=this.toBinaryInto(r);if(e!==i)throw new Error("".concat(this.constructor.name,".toBinary: written bytes (").concat(i," bytes) not equal to allocated array buffer length (").concat(e," bytes)."));return new Uint8Array(n)}}var Gv;(function(t){t[t.UserTimestamp=2]="UserTimestamp",t[t.E2ee=1]="E2ee"})(Gv||(Gv={}));class bne extends uC{}class Wl extends bne{constructor(e){super(),this.timestamp=e}toBinaryLengthBytes(){return vi+vi+Wl.lengthBytes}toBinaryInto(e){let n=0;e.setUint8(n,Wl.tag),n+=vi,e.setUint8(n,Wl.lengthBytes),n+=vi,e.setBigUint64(n,this.timestamp),n+=XBe;const r=this.toBinaryLengthBytes();if(n!==r)throw new Error("DataTrackUserTimestampExtension.toBinaryInto: Wrote ".concat(n," bytes but expected length was ").concat(r," bytes"));return n}toJSON(){return{tag:Wl.tag,lengthBytes:Wl.lengthBytes,timestamp:this.timestamp}}}Wl.tag=Gv.UserTimestamp;Wl.lengthBytes=8;class Gl extends bne{constructor(e,n){super(),this.keyIndex=e,this.iv=n}toBinaryLengthBytes(){return vi+vi+Gl.lengthBytes}toBinaryInto(e){let n=0;e.setUint8(n,Gl.tag),n+=vi,e.setUint8(n,Gl.lengthBytes),n+=vi,e.setUint8(n,this.keyIndex),n+=vi;for(let i=0;i<this.iv.length;i+=1)e.setUint8(n,this.iv[i]),n+=vi;const r=this.toBinaryLengthBytes();if(n!==r)throw new Error("DataTrackE2eeExtension.toBinaryInto: Wrote ".concat(n," bytes but expected length
789was ").concat(r," bytes"));return n}toJSON(){return{tag:Gl.tag,lengthBytes:Gl.lengthBytes,keyIndex:this.keyIndex,iv:this.iv}}}Gl.tag=Gv.E2ee;Gl.lengthBytes=13;class mv extends uC{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),this.userTimestamp=e.userTimestamp,this.e2ee=e.e2ee}toBinaryLengthBytes(){let e=0;return this.userTimestamp&&(e+=this.userTimestamp.toBinaryLengthBytes()),this.e2ee&&(e+=this.e2ee.toBinaryLengthBytes()),e}toBinaryInto(e){let n=0;if(this.e2ee){const i=this.e2ee.toBinaryInto(e);n+=i}if(this.userTimestamp){const i=this.userTimestamp.toBinaryInto(new DataView(e.buffer,e.byteOffset+n));n+=i}const r=this.toBinaryLengthBytes();if(n!==r)throw new Error("DataTrackExtensions.toBinaryInto: Wrote ".concat(n," bytes but expected length was ").concat(r," bytes"));return n}static fromBinary(e){const n=zO(e);let r,i,s=0;for(;n.byteLength-s>=vi+vi;){const a=n.getUint8(s);s+=vi;const o=n.getUint8(s);if(s+=vi,a!==tUe)switch(a){case Gv.UserTimestamp:if(n.byteLength-s<Wl.lengthBytes)throw wa.malformedExt(a);r=new Wl(n.getBigUint64(s)),s+=o;break;case Gv.E2ee:if(n.byteLength-s<Gl.lengthBytes)throw wa.malformedExt(a);const l=n.getUint8(s),c=new Uint8Array(12);for(let u=0;u<c.length;u+=1){let d=s;d+=vi,d+=u*vi,c[u]=n.getUint8(d)}i=new Gl(l,c),s+=o;break;default:if(n.byteLength-s<o)throw wa.malformedExt(a);s+=o;break}}return[new mv({userTimestamp:r,e2ee:i}),n.byteLength]}toJSON(){var e,n,r,i;return{userTimestamp:(n=(e=this.userTimestamp)===null||e===void 0?void 0:e.toJSON())!==null&&n!==void 0?n:null,e2ee:(i=(r=this.e2ee)===null||r===void 0?void 0:r.toJSON())!==null&&i!==void 0?i:null}}}const xne={from(t){return{payload:t.payload,extensions:new mv({userTimestamp:t.userTimestamp?new Wl(t.userTimestamp):void 0})}},lossyIntoFrame(t){var e;return{payload:t.payload,userTimestamp:(e=t.extensions.userTimestamp)===null||e===void 0?void 0:e.timestamp}}},kne=Symbol.for("lk.track"),Sne=Symbol.for("lk.data-track");class Tne{constructor(e,n,r){this.trackSymbol=kne,this.isLocal=!1,this.typeSymbol=Sne,this.info=e,this.manager=n,this.publisherIdentity=r.publisherIdentity}subscribe(e){try{const[n,r]=this.manager.openSubscriptionStream(this.info.sid,e==null?void 0:e.signal,e==null?void 0:e.bufferSize);return r.catch(()=>{}),n}catch(n){throw n}}}class Ww extends uC{constructor(e){var n;super(),this.marker=e.marker,this.trackHandle=e.trackHandle,this.sequence=e.sequence,this.frameNumber=e.frameNumber,this.timestamp=e.timestamp,this.extensions=(n=e.extensions)!==null&&n!==void 0?n:new mv}extensionsMetrics(){const e=this.extensions.toBinaryLengthBytes(),n=Math.ceil((C2+e)/4),r=n*4-C2-e;return{lengthBytes:e,lengthWords:n,paddingLengthBytes:r}}toBinaryLengthBytes(){const{lengthBytes:e,paddingLengthBytes:n}=this.extensionsMetrics();let r=Cz;return e>0&&(r+=C2+e+n),r}toBinaryInto(e){if(e.byteLength<this.toBinaryLengthBytes())throw qw.tooSmallForHeader();let n=Tz<<Ez,r;switch(this.marker){case Vr.Inter:r=Nz;break;case Vr.Final:r=Mz;break;case Vr.Start:r=Pz;break;case Vr.Single:r=Rz;break}n|=r<<Az;const{lengthBytes:i,lengthWords:s,paddingLengthBytes:a}=this.extensionsMetrics();i>0&&(n|=1<<Iz);let o=0;if(e.setUint8(o,n),o+=vi,e.setUint8(o,0),o+=vi,e.setUint16(o,this.trackHandle),o+=Uu,e.setUint16(o,this.sequence.value),o+=Uu,e.setUint16(o,this.frameNumber.value),o+=Uu,e.setUint32(o,this.timestamp.asTicks()),o+=Sz,i>0){const c=s-1;e.setUint16(o,c),o+=Uu;const u=this.extensions.toBinaryInto(new DataView(e.buffer,e.byteOffset+o));o+=u;for(let d=0;d<a;d+=1)e.setUint8(o,0),o+=vi}const l=this.toBinaryLengthBytes();if(o!==l)throw new Error("DataTrackPacketHeader.toBinaryInto: Wrote ".concat(o," bytes but expected length was ").concat(l," bytes"));return l}static fromBinary(e){const n=zO(e);if(n.byteLength<Cz)throw wa.tooShort();let r=0;const i=n.getUint8(r);r+=vi;const s=i>>Ez&QBe;if(s>Tz)throw wa.unsupportedVersion(s);let a;switch(i>>Az&ZBe){case Pz:a=Vr.Start;break;case Mz:a=Vr.Final;break;case Rz:a=Vr.Single;break;case Nz:default:a=Vr.Inter;break}const o=(i>>Iz&eUe)>0;r+=vi;let l;try{l=tBe.fromNumber(n.getUint16(r))}catch(h){throw h instanceof Wv&&(h.isReason(Lp.Reserved)||h.isReason(Lp.TooLarge))?w
789a.invalidHandle(h):h}r+=Uu;const c=Yl.u16(n.getUint16(r));r+=Uu;const u=Yl.u16(n.getUint16(r));r+=Uu;const d=pv.fromRtpTicks(n.getUint32(r));r+=Sz;let f=new mv;if(o){if(n.byteLength-r<Uu)throw wa.missingExtWords();let h=n.getUint16(r);r+=Uu;let m=4*(h+1)-C2;if(r+m>n.byteLength)throw wa.headerOverrun();let g=new DataView(n.buffer,n.byteOffset+r,m);const[v,_]=mv.fromBinary(g);f=v,r+=_}return[new Ww({marker:a,trackHandle:l,sequence:c,frameNumber:u,timestamp:d,extensions:f}),r]}toJSON(){return{marker:this.marker,trackHandle:this.trackHandle,sequence:this.sequence.value,frameNumber:this.frameNumber.value,timestamp:this.timestamp.asTicks(),extensions:this.extensions.toJSON()}}}var Vr;(function(t){t[t.Start=0]="Start",t[t.Inter=1]="Inter",t[t.Final=2]="Final",t[t.Single=3]="Single"})(Vr||(Vr={}));class dC extends uC{constructor(e,n){super(),this.header=e,this.payload=n}toBinaryLengthBytes(){return this.header.toBinaryLengthBytes()+this.payload.byteLength}toBinaryInto(e){let n=0;const r=this.header.toBinaryInto(e);if(n+=r,e.byteLength-n<this.payload.byteLength)throw qw.tooSmallForPayload();for(let s=0;s<this.payload.length;s+=1)e.setUint8(n,this.payload[s]),n+=vi;const i=this.toBinaryLengthBytes();if(n!==i)throw new Error("DataTrackPacket.toBinaryInto: Wrote ".concat(n," bytes but expected length was ").concat(i," bytes"));return i}static fromBinary(e){const n=zO(e),[r,i]=Ww.fromBinary(n),s=n.buffer.slice(n.byteOffset+i,n.byteOffset+n.byteLength);return[new dC(r,new Uint8Array(s)),n.byteLength]}toJSON(){return{header:this.header.toJSON(),payload:this.payload}}}const aA=Xa(hs.DataTracks);class jl extends ol{constructor(e,n,r,i){super(19,"Frame ".concat(r," dropped: ").concat(e),i),this.name="DataTrackDepacketizerDropError",this.reason=n,this.reasonName=ap[n],this.frameNumber=r}static interrupted(e,n){return new jl("Interrupted by the start of a new frame ".concat(n),ap.Interrupted,e)}static unknownFrame(e){return new jl("Initial packet was never received.",ap.UnknownFrame,e)}static bufferFull(e){return new jl("Reorder buffer is full.",ap.BufferFull,e)}static incomplete(e,n,r){return new jl("Not all packets received before final packet. Received ".concat(n," packets, expected ").concat(r," packets."),ap.Incomplete,e)}}var ap;(function(t){t[t.Interrupted=0]="Interrupted",t[t.UnknownFrame=1]="UnknownFrame",t[t.BufferFull=2]="BufferFull",t[t.Incomplete=3]="Incomplete"})(ap||(ap={}));class hC{constructor(){this.partial=null}push(e,n){switch(e.header.marker){case Vr.Single:return this.frameFromSingle(e,n);case Vr.Start:return this.beginPartial(e,n);case Vr.Inter:case Vr.Final:return this.pushToPartial(e)}}reset(){this.partial=null}frameFromSingle(e,n){if(e.header.marker!==Vr.Single)throw new Error("Depacketizer.frameFromSingle: packet.header.marker was not FrameMarker.Single, found ".concat(e.header.marker,"."));if(this.partial)if(n!=null&&n.errorOnPartialFrames){const r=this.partial.frameNumber;throw this.reset(),jl.interrupted(r,e.header.frameNumber.value)}else aA.warn("Data track frame ".concat(this.partial.frameNumber," was interrupted by the start of a new frame, dropping."));return this.reset(),{payload:e.payload,extensions:e.header.extensions}}beginPartial(e,n){if(e.header.marker!==Vr.Start)throw new Error("Depacketizer.beginPartial: packet.header.marker was not FrameMarker.Start, found ".concat(e.header.marker,"."));if(this.partial)if(n!=null&&n.errorOnPartialFrames){const i=this.partial.frameNumber;throw this.reset(),jl.interrupted(i,e.header.frameNumber.value)}else aA.warn("Data track frame ".concat(this.partial.frameNumber," was interrupted by the start of a new frame ").concat(e.header.frameNumber.value,", dropping."));this.reset();const r=e.header.sequence;return this.partial={frameNumber:e.header.frameNumber.value,startSequence:r,extensions:e.header.extensions,payloads:new Map([[r.value,e.payload]])},null}pushToPartial(e){if(e.header.marker!==Vr.Inter&&e.header.marker!==Vr.Final)throw new Error("Depacketizer.pushToPartial: packet.header.marker was not FrameMarker.Inter or FrameMarker.Final, found ".concat(e.header.marker,"."));if(!this.partial)throw this.reset(),jl.unknownFrame(e.header.frameNumber.value);if(e.header.frameNumber.value!==this.partial.frameNumber){const n=this.partial.frameNumber;throw this.reset(),jl.interrupted(n,e.header.frameNumber.value)}if(this.partial.payloads.size>=hC.MAX_BUFFER_PACKETS){const n=this.partial.frameNumber;throw this.reset(),jl.bufferFull(n)}return this.partial.payloads.has(e.header.sequence.value)&&aA.warn("Data track frame ".concat(this.partial.frameNumber," received duplicate packet for sequence ").concat(e.header.sequence.value,", so replacing with newly received packet.")),this.partial.payloads.set(e.header.sequence.value,e.payload),e.header.marker===Vr.Final?this.finalize(this.partial,e.header.sequence.value):null}finalize(e,n){const r=e.payloads.size;let i=0;for(const l of e.payloads.values())i+=l.length;const s=new Uint8Array(i);let a=e.startSequence.clone(),o=0;for(;;){const l=e.payloads.get(a.value);if(!l)break;e.payloads.delete(a.value);const c=s.length-o;if(l.length>c)throw new Error("Depacketizer.finalize: Expected at least ".concat(l.length," more bytes left in the payload buffer, only got ").concat(c," bytes."));if(s.set(l,o),o+=l.length,a.value!=n){a.increment();continue}return this.reset(),{payload:s,extensions:e.extensions}}throw this.reset(),jl.incomplete(e.frameNumber,r,n-e.startSequence.value+1)}}hC.MAX_BUFFER_PACKETS=128;var op;(function(t){t[t.Unpublished=0]="Unpublished",t[t.Timeout=1]="Timeout",t[t.Disconnected=2]="Disconnected",t[t.Cancelled=4]="Cancelled"})(op||(op={}));class Ua extends ol{constructor(e,n,r){super(22,e,r),this.name="DataTrackSubscribeError",this.reason=n,this.reasonName=op[n]}static unpublished(){return new Ua("The track has been unpublished and is no longer available",op.Unpublished)}static timeout(){return new Ua("Request to subscribe to data track t
789imed-out",op.Timeout)}static disconnected(){return new Ua("Cannot subscribe to data track when disconnected",op.Disconnected)}static cancelled(){return new Ua("Subscription to data track cancelled by caller",op.Cancelled)}}const oA=Xa(hs.DataTracks);class nUe{constructor(e){var n;const r=e.e2eeManager!==null;if(e.info.usesE2ee!==r)throw new Error("IncomingDataTrackPipeline: DataTrackInfo.usesE2ee must match presence of decryptionProvider");const i=new hC;this.publisherIdentity=e.publisherIdentity,this.e2eeManager=(n=e.e2eeManager)!==null&&n!==void 0?n:null,this.depacketizer=i}updateE2eeManager(e){this.e2eeManager=e}processPacket(e){return ce(this,void 0,void 0,function*(){const n=this.depacketize(e);if(!n)return null;const r=yield this.decryptIfNeeded(n);return r||null})}depacketize(e){let n;try{n=this.depacketizer.push(e)}catch(r){return oA.warn("Data frame depacketize error: ".concat(r)),null}return n}decryptIfNeeded(e){return ce(this,void 0,void 0,function*(){var n,r;const i=this.e2eeManager;if(!i)return e;const s=(r=(n=e.extensions)===null||n===void 0?void 0:n.e2ee)!==null&&r!==void 0?r:null;if(!s)return oA.error("Missing E2EE meta"),null;let a;try{a=yield i.handleEncryptedData(e.payload,s.iv,this.publisherIdentity,s.keyIndex)}catch(o){return oA.error("Error decrypting packet: ".concat(o)),null}return e.payload=a.payload,e})}}const Gs=Xa(hs.DataTracks),rUe=1e4,iUe=16;class sUe extends al.EventEmitter{constructor(e){var n;super(),this.descriptors=new Map,this.subscriptionHandles=new Map,this.e2eeManager=(n=e==null?void 0:e.e2eeManager)!==null&&n!==void 0?n:null}updateE2eeManager(e){this.e2eeManager=e;for(const n of this.descriptors.values())n.subscription.type==="active"&&n.subscription.pipeline.updateE2eeManager(e)}openSubscriptionStream(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:iUe,i=null;const s=new Cs,a=()=>{n==null||n.removeEventListener("abort",l)},o=()=>{if(a(),!i){Gs.warn("ReadableStream subscribed to ".concat(e," was not started."));return}const u=this.descriptors.get(e);if(!u){Gs.warn("Unknown track ".concat(e,", skipping cancel..."));return}if(u.subscription.type!=="active"){Gs.warn("Subscription for track ".concat(e," is not active, skipping cancel..."));return}u.subscription.streamControllers.delete(i),u.subscription.streamControllers.size===0&&this.unSubscribeRequest(u.info.sid)},l=()=>{var u;if(!i)return;const d=this.descriptors.get(e);(d==null?void 0:d.subscription.type)==="active"&&d.subscription.streamControllers.delete(i),i.error(Ua.cancelled()),(u=s.reject)===null||u===void 0||u.call(s,Ua.cancelled()),o()};return[new ReadableStream({start:u=>{i=u,this.subscribeRequest(e,n).then(()=>ce(this,void 0,void 0,function*(){var d,f,h;const p=this.descriptors.get(e);if(!p){Gs.error("Unknown track ".concat(e));const m=Ua.disconnected();u.error(m),(d=s.reject)===null||d===void 0||d.call(s,m);return}if(p.subscription.type!=="active"){Gs.error("Subscription for track ".concat(e," is not active"));const m=Ua.disconnected();u.error(m),(f=s.reject)===null||f===void 0||f.call(s,m);return}if(n!=null&&n.aborted){l();return}n==null||n.addEventListener("abort",l),p.subscription.streamControllers.set(u,a),(h=s.resolve)===null||h===void 0||h.call(s)})).catch(d=>{var f;u.error(d),(f=s.reject)===null||f===void 0||f.call(s,d)})},cancel:()=>{o()}},new CountQueuingStrategy({highWaterMark:r})),s.promise]}subscribeRequest(e,n){return ce(this,void 0,void 0,function*(){const r=this.descriptors.get(e);if(!r)throw new Error("Cannot subscribe to unknown track");const i=(s,a,o)=>ce(this,void 0,void 0,function*(){if(s.subscription.type==="active")return;if(s.subscription.type!=="pending")throw new Error("Descriptor for track ".concat(e," is not pending, found ").concat(s.subscription.type));const l=_ne([a,o].filter(d=>typeof d<"u")),c=new Cs;s.subscription.completionFuture.promise.then(()=>{var d;return(d=c.resolve)===null||d===void 0?void 0:d.call(c)}).catch(d=>{var f;return(f=c.reject)===null||f===void 0?void 0:f.call(c,d)});const u=()=>{var d;if(s.subscription.type==="pending"){if(s.subscription.pendingRequestCount-=1,o!=null&&o.aborted){s.subscription.cancel();return}if(s.subscription.pendingRequestCount<=0){s.subscription.cancel();return}(d=c.reject)===null||d===void 0||d.call(c,Ua.cancelled())}};l.aborted&&u(),l.addEventListener("abort",u),yield c.promise,l.removeEventListener("abort",u)});switch(r.subscription.type){case"none":{r.subscription={type:"pending",completionFuture:new Cs,pendingRequestCount:1,cancel:()=>{var a,o;const l=r.subscription;r.subscription={type:"none"}
789,this.emit("sfuUpdateSubscription",{sid:e,subscribe:!1}),l.type==="pending"&&((o=(a=l.completionFuture).reject)===null||o===void 0||o.call(a,s.aborted?Ua.timeout():Ua.cancelled()))}},this.emit("sfuUpdateSubscription",{sid:e,subscribe:!0});const s=wne(rUe);yield i(r,n,s);return}case"pending":{r.subscription.pendingRequestCount+=1,yield i(r,n);return}case"active":return}})}querySubscribed(){return ce(this,void 0,void 0,function*(){return Array.from(this.descriptors.values()).filter(n=>n.subscription.type==="active").map(n=>[n.info,n.publisherIdentity])})}unSubscribeRequest(e){var n;const r=this.descriptors.get(e);if(!r)throw new Error("Cannot subscribe to unknown track");if(r.subscription.type!=="active"){Gs.warn("Unexpected descriptor state in unSubscribeRequest, expected active, found ".concat((n=r.subscription)===null||n===void 0?void 0:n.type));return}this.closeStreamControllers(r.subscription.streamControllers,e);const i=r.subscription;r.subscription={type:"none"},this.subscriptionHandles.delete(i.subcriptionHandle),this.emit("sfuUpdateSubscription",{sid:e,subscribe:!1})}closeStreamControllers(e,n){for(const[r,i]of e){i();try{r.close()}catch(s){Gs.warn("Failed to close readable stream for track ".concat(n,": ").concat(s))}}}receiveSfuPublicationUpdates(e){return ce(this,void 0,void 0,function*(){if(e.size===0)return;const n=new Map;for(const[r,i]of e.entries()){const s=new Set;for(const a of i)s.add(a.sid),!this.descriptors.has(a.sid)&&(yield this.handleTrackPublished(r,a));n.set(r,s)}for(const[r,i]of n.entries()){let a=Array.from(this.descriptors.entries()).filter(o=>{let[l,c]=o;return c.publisherIdentity===r}).map(o=>{let[l]=o;return l}).filter(o=>!i.has(o));for(const o of a)this.handleTrackUnpublished(o)}})}queryPublications(){return ce(this,void 0,void 0,function*(){return Array.from(this.descriptors.values()).map(e=>e.info)})}handleTrackPublished(e,n){return ce(this,void 0,void 0,function*(){if(this.descriptors.has(n.sid)){Gs.error("Existing descriptor for track ".concat(n.sid));return}let r={info:n,publisherIdentity:e,subscription:{type:"none"}};this.descriptors.set(r.info.sid,r);const i=new Tne(r.info,this,{publisherIdentity:e});this.emit("trackPublished",{track:i})})}handleTrackUnpublished(e){const n=this.descriptors.get(e);if(!n){Gs.error("Unknown track ".concat(e));return}this.descriptors.delete(e),n.subscription.type==="active"&&(this.closeStreamControllers(n.subscription.streamControllers,e),this.subscriptionHandles.delete(n.subscription.subcriptionHandle)),this.emit("trackUnpublished",{sid:e,publisherIdentity:n.publisherIdentity})}receivedSfuSubscriberHandles(e){for(const[n,r]of e.entries())this.registerSubscriberHandle(n,r)}registerSubscriberHandle(e,n){var r,i;const s=this.descriptors.get(n);if(!s){Gs.error("Unknown track ".concat(n));return}switch(s.subscription.type){case"none":{Gs.warn("No subscription for ".concat(n));return}case"active":{s.subscription.subcriptionHandle=e,this.subscriptionHandles.set(e,n);return}case"pending":{const a=new nUe({info:s.info,publisherIdentity:s.publisherIdentity,e2eeManager:this.e2eeManager}),o=s.subscription;s.subscription={type:"active",subcriptionHandle:e,pipeline:a,streamControllers:new Map},this.subscriptionHandles.set(e,n),(i=(r=o.completionFuture).resolve)===null||i===void 0||i.call(r)}}}packetReceived(e){return ce(this,void 0,void 0,function*(){let n;try{[n]=dC.fromBinary(e)}catch(a){Gs.error("Failed to deserialize packet: ".concat(a));return}const r=this.subscriptionHandles.get(n.header.trackHandle);if(!r){Gs.warn("Unknown subscriber handle ".concat(n.header.trackHandle));return}const i=this.descriptors.get(r);if(!i){Gs.error("Missing descriptor for track ".concat(r));return}if(i.subscription.type!=="active"){Gs.warn("Received packet for track ".concat(r," without active subscription"));return}const s=yield i.subscription.pipeline.processPacket(n);if(s)for(const a of i.subscription.streamControllers.keys()){if(a.desiredSize!==null&&a.desiredSize<=0){Gs.warn("Cannot send frame to subscribers: readable stream is full (desiredSize is ".concat(a.desiredSize,"). To increase this threshold, set a higher 'options.highWaterMark' when calling .subscribe()."));continue}const o=xne.lossyIntoFrame(s);a.enqueue(o)}})}resendSubscriptionUpdates(){for(const[e,n]of this.descriptors)n.subscription.type!=="none"&&this.emit
789("sfuUpdateSubscription",{sid:e,subscribe:!0})}handleRemoteParticipantDisconnected(e){var n,r;for(const i of this.descriptors.values())if(i.publisherIdentity===e)switch(i.subscription.type){case"none":break;case"pending":(r=(n=i.subscription.completionFuture).reject)===null||r===void 0||r.call(n,Ua.disconnected());break;case"active":this.unSubscribeRequest(i.info.sid);break}}reset(){var e,n;for(const r of this.descriptors.values())this.emit("trackUnpublished",{sid:r.info.sid,publisherIdentity:r.publisherIdentity}),r.subscription.type==="pending"&&((n=(e=r.subscription.completionFuture).reject)===null||n===void 0||n.call(e,Ua.disconnected())),r.subscription.type==="active"&&this.closeStreamControllers(r.subscription.streamControllers,r.info.sid);this.descriptors.clear(),this.subscriptionHandles.clear()}}class fC extends ol{constructor(e,n,r){super(19,e,r),this.name="DataTrackPacketizerError",this.reason=n,this.reasonName=CS[n]}static mtuTooShort(){return new fC("MTU is too short to send frame",CS.MtuTooShort)}}var CS;(function(t){t[t.MtuTooShort=0]="MtuTooShort"})(CS||(CS={}));class YO{constructor(e,n){this.sequence=Yl.u16(0),this.frameNumber=Yl.u16(0),this.clock=ip.rtpStartingNow(pv.rtpRandom()),this.handle=e,this.mtuSizeBytes=n}static computeFrameMarker(e,n){return n<=1?Vr.Single:e===0?Vr.Start:e===n-1?Vr.Final:Vr.Inter}*packetize(e,n){var r;const i=this.frameNumber.getThenIncrement(),s={marker:Vr.Inter,trackHandle:this.handle,sequence:Yl.u16(0),frameNumber:i,timestamp:(r=n==null?void 0:n.now)!==null&&r!==void 0?r:this.clock.now(),extensions:e.extensions},a=new Ww(s).toBinaryLengthBytes();if(a>=this.mtuSizeBytes)throw fC.mtuTooShort();const o=this.mtuSizeBytes-a,l=Math.ceil(e.payload.byteLength/o);for(let c=0,u=0;u<e.payload.byteLength;[c,u]=[c+1,u+o]){const d=this.sequence.getThenIncrement(),f=new Ww(Object.assign(Object.assign({},s),{marker:YO.computeFrameMarker(c,l),sequence:d})),h=Math.min(o,e.payload.byteLength-u),p=new Uint8Array(e.payload.buffer,e.payload.byteOffset+u,h);yield new dC(f,p)}}}var Al;(function(t){t[t.NotAllowed=0]="NotAllowed",t[t.DuplicateName=1]="DuplicateName",t[t.Timeout=2]="Timeout",t[t.LimitReached=3]="LimitReached",t[t.Disconnected=4]="Disconnected",t[t.Cancelled=5]="Cancelled",t[t.InvalidName=6]="InvalidName",t[t.Unknown=7]="Unknown"})(Al||(Al={}));class Gi extends ol{constructor(e,n,r){super(21,e,r),this.name="DataTrackPublishError",this.reason=n,this.reasonName=Al[n],this.rawMessage=r==null?void 0:r.rawMessage}static notAllowed(e){return new Gi("Data track publishing unauthorized",Al.NotAllowed,{rawMessage:e})}static duplicateName(e){return new Gi("Track name already taken",Al.DuplicateName,{rawMessage:e})}static invalidName(e){return new Gi("Track name is invalid",Al.InvalidName,{rawMessage:e})}static timeout(){return new Gi("Publish data track timed-out. Does the LiveKit server support data tracks?",Al.Timeout)}static limitReached(e){return new Gi("Data track publication limit reached",Al.LimitReached,{rawMessage:e})}static unknown(e,n){return new Gi("Received RequestResponse for publishDataTrack, but reason was unrecognised (".concat(e,", ").concat(n,")"),Al.Unknown)}static disconnected(){return new Gi("Room disconnected",Al.Disconnected)}static cancelled(){return new Gi("Publish data track cancelled by caller",Al.Cancelled)}}var j_;(function(t){t[t.TrackUnpublished=0]="TrackUnpublished",t[t.Dropped=1]="Dropped"})(j_||(j_={}));class Ah extends ol{constructor(e,n,r){super(22,e,r),this.name="DataTrackPushFrameError",this.reason=n,this.reasonName=j_[n]}static trackUnpublished(){return new Ah("Track is no longer published",j_.TrackUnpublished)}static dropped(e){return new Ah("Frame was dropped",j_.Dropped,{cause:e})}}var B_;(function(t){t[t.Packetizer=0]="Packetizer",t[t.Encryption=1]="Encryption"})(B_||(B_={}));class Gw extends ol{constructor(e,n,r){super(21,e,r),this.name="DataTrackOutgoingPipelineError",this.reason=n,this.reasonName=B_[n]}static packetizer(e){return new Gw("Error packetizing frame",B_.Packetizer,{cause:e})}static encryption(e){return new Gw("Error encrypting frame",B_.Encryption,{cause:e})}}
789class pC{constructor(e,n){this.trackSymbol=kne,this.isLocal=!0,this.typeSymbol=Sne,this.handle=null,this.log=mn,this.flushedFuture=new Cs,this.handleManagerReset=()=>{this.handleManagerPacketsFlushed(),this.manager.off("packetsFlushed",this.handleManagerReset),this.manager.off("reset",this.handleManagerReset)},this.handleManagerPacketsFlushed=()=>{var r,i;(i=(r=this.flushedFuture).resolve)===null||i===void 0||i.call(r),this.flushedFuture=new Cs},this.options=e,this.manager=n,this.log=Xa(hs.DataTracks),this.manager.on("packetsFlushed",this.handleManagerPacketsFlushed),this.manager.on("reset",this.handleManagerReset)}static withExplicitHandle(e,n,r){const i=new pC(e,n);return i.handle=r,i}get info(){const e=this.descriptor;if((e==null?void 0:e.type)==="active")return e.info}get descriptor(){return this.handle?this.manager.getDescriptor(this.handle):null}publish(e){return ce(this,void 0,void 0,function*(){try{this.handle=yield this.manager.publishRequest(this.options,e)}catch(n){throw n}})}isPublished(){var e;return((e=this.descriptor)===null||e===void 0?void 0:e.type)==="active"&&this.descriptor.publishState!=="unpublished"}tryPush(e){if(!this.handle)throw Ah.trackUnpublished();const n=xne.from(e);try{return this.manager.tryProcessAndSend(this.handle,n)}catch(r){throw r}}flush(){return ce(this,void 0,void 0,function*(){return this.flushedFuture.promise})}unpublish(){return ce(this,void 0,void 0,function*(){if(!this.handle){mn.warn('Data track "'.concat(this.options.name,'" is not published, so unpublishing has no effect.'));return}try{yield this.manager.unpublishRequest(this.handle)}catch(e){throw e}})}}class mC{constructor(e){this.e2eeManager=e.e2eeManager,this.packetizer=new YO(e.info.pubHandle,mC.TRANSPORT_MTU_BYTES)}updateE2eeManager(e){this.e2eeManager=e}processFrame(e){return Kje(this,arguments,function*(){const r=yield $v(this.encryptIfNeeded(e));try{yield $v(yield*Jje(Vl(this.packetizer.packetize(r))))}catch(i){throw i instanceof fC?Gw.packetizer(i):i}})}encryptIfNeeded(e){return ce(this,void 0,void 0,function*(){if(!this.e2eeManager)return e;let n;try{n=yield this.e2eeManager.encryptData(e.payload)}catch(r){throw Gw.encryption(r)}return e.payload=n.payload,e.extensions.e2ee=new Gl(n.keyIndex,n.iv),e})}}mC.TRANSPORT_MTU_BYTES=16e3;const Pc=Xa(hs.DataTracks),Lz={pending(){return{type:"pending",completionFuture:new Cs}},active(t,e){return{type:"active",info:t,publishState:"published",pipeline:new mC({info:t,e2eeManager:e}),unpublishingFuture:new Cs}}},aUe=1e4;class XO extends al.EventEmitter{constructor(e){var n;super(),this.handleAllocator=new nBe,this.descriptors=new Map,this.inFlightPacketCounter=new Map,this.e2eeManager=(n=e==null?void 0:e.e2eeManager)!==null&&n!==void 0?n:null}static withDescriptors(e){const n=new XO;return n.descriptors=e,n}updateE2eeManager(e){this.e2eeManager=e;for(const n of this.descriptors.values())n.type==="active"&&n.pipeline.updateE2eeManager(e)}getDescriptor(e){var n;return(n=this.descriptors.get(e))!==null&&n!==void 0?n:null}tryProcessAndSend(e,n){return ce(this,void 0,void 0,function*(){var r,i,s,a,o;const l=this.getDescriptor(e);if((l==null?void 0:l.type)!=="active"||l.publishState==="unpublished")throw Ah.trackUnpublished();if(l.publishState==="republishing")throw Ah.dropped("Data track republishing");try{try{for(var c=!0,u=Vl(l.pipeline.processFrame(n)),d;d=yield u.next(),r=d.done,!r;c=!0){a=d.value,c=!1;const f=a,h=(o=this.inFlightPacketCounter.get(e))!==null&&o!==void 0?o:0;this.inFlightPacketCounter.set(e,h+1),this.emit("packetAvailable",{handle:e,bytes:f.toBinary()})}}catch(f){i={error:f}}finally{try{!c&&!r&&(s=u.return)&&(yield s.call(u))}finally{if(i)throw i.error}}}catch(f){throw Ah.dropped(f)}})}handlePacketSendComplete(e){var n;let i=((n=this.inFlightPacketCounter.get(e))!==null&&n!==void 0?n:0)-1;i<0&&(Pc.warn("OutgoingDataTrackManager.handlePacketSendComplete: inFlightPacketCounter was decremented below 0 (got ".concat(this.inFlightPacketCounter," - resetting to 0. Were more packets send than were emitted?")),i=0),this.inFlightPacketCounter.set(e,i),i===0&&this.emit("packetsFlushed",{handle:e})}publishRequest(e,n){return ce(this,void 0,void 0,function*(){const r=this.handleAllocator.get();if(!r)throw Gi.limitReached();const i=wne(aUe),s=n?_ne([n,i]):i;
789if(this.descriptors.has(r))throw new Error("Descriptor for handle already exists");const a=Lz.pending();this.descriptors.set(r,a);const o=()=>{var l,c;const u=this.descriptors.get(r);if(!u){Pc.warn("No descriptor for ".concat(r));return}this.descriptors.delete(r),this.emit("sfuUnpublishRequest",{handle:r}),u.type==="pending"&&((c=(l=u.completionFuture).reject)===null||c===void 0||c.call(l,i.aborted?Gi.timeout():Gi.cancelled()))};return s.aborted?(o(),a.completionFuture.promise.then(()=>r)):(s.addEventListener("abort",o),this.emit("sfuPublishRequest",{handle:r,name:e.name,usesE2ee:this.e2eeManager!==null}),yield a.completionFuture.promise,s.removeEventListener("abort",o),this.emit("trackPublished",{track:pC.withExplicitHandle(e,this,r)}),r)})}queryPublished(){return Array.from(this.descriptors.values()).filter(n=>n.type==="active").map(n=>n.info)}unpublishRequest(e){return ce(this,void 0,void 0,function*(){const n=this.descriptors.get(e);if(!n){Pc.warn("No descriptor for ".concat(e));return}if(n.type!=="active"){Pc.warn("Track ".concat(e," not active"));return}this.emit("sfuUnpublishRequest",{handle:e}),yield n.unpublishingFuture.promise,this.inFlightPacketCounter.delete(e),this.emit("trackUnpublished",{sid:n.info.sid})})}receivedSfuPublishResponse(e,n){var r,i,s,a;const o=this.descriptors.get(e);if(!o){Pc.warn("No descriptor for ".concat(e));return}switch(this.descriptors.delete(e),o.type){case"pending":{if(n.type==="ok"){const l=n.data,c=l.usesE2ee?this.e2eeManager:null;this.descriptors.set(l.pubHandle,Lz.active(l,c)),(i=(r=o.completionFuture).resolve)===null||i===void 0||i.call(r)}else(a=(s=o.completionFuture).reject)===null||a===void 0||a.call(s,n.error);return}case"active":{if(o.publishState!=="republishing"){Pc.warn("Track ".concat(e," already active"));return}if(n.type==="error"){Pc.warn("Republish failed for track ".concat(e));return}Pc.debug("Track ".concat(e," republished")),o.info.sid=n.data.sid,o.publishState="published",this.descriptors.set(o.info.pubHandle,o)}}}receivedSfuUnpublishResponse(e){var n,r;const i=this.descriptors.get(e);if(!i){Pc.warn("No descriptor for ".concat(e));return}if(this.descriptors.delete(e),i.type!=="active"){Pc.warn("Track ".concat(e," not active"));return}i.publishState="unpublished",(r=(n=i.unpublishingFuture).resolve)===null||r===void 0||r.call(n)}sfuWillRepublishTracks(){var e,n;for(const[r,i]of this.descriptors.entries())switch(i.type){case"pending":this.descriptors.delete(r),(n=(e=i.completionFuture).reject)===null||n===void 0||n.call(e,Gi.disconnected());break;case"active":i.publishState="republishing",this.emit("sfuPublishRequest",{handle:i.info.pubHandle,name:i.info.name,usesE2ee:i.info.usesE2ee})}}reset(){return ce(this,void 0,void 0,function*(){var e,n,r,i;this.handleAllocator.reset();for(const s of this.descriptors.values())switch(s.type){case"pending":(n=(e=s.completionFuture).reject)===null||n===void 0||n.call(e,Gi.disconnected());break;case"active":(i=(r=s.unpublishingFuture).resolve)===null||i===void 0||i.call(r),yield this.unpublishRequest(s.info.pubHandle);break}this.descriptors.clear(),this.inFlightPacketCounter.clear(),this.emit("reset")})}}class Cne extends je{constructor(e,n,r,i,s){super(e,r,s),this.sid=n,this.receiver=i}get isLocal(){return!1}setMuted(e){this.isMuted!==e&&(this.isMuted=e,this._mediaStreamTrack.enabled=!e,this.emit(e?Qe.Muted:Qe.Unmuted,this))}setMediaStream(e){this.mediaStream=e;const n=r=>{r.track===this._mediaStreamTrack&&(e.removeEventListener("removetrack",n),this.receiver&&"playoutDelayHint"in this.receiver&&(this.receiver.playoutDelayHint=void 0),this.receiver=void 0,this._currentBitrate=0,this.emit(Qe.Ended,this))};e.addEventListener("removetrack",n)}start(){this.startMonitor(),super.enable()}stop(){this.stopMonitor(),super.disable()}getRTCStatsReport(){return ce(this,void 0,void 0,function*(){var e;return!((e=this.receiver)===null||e===void 0)&&e.getStats?yield this.receiver.getStats():void 0})}setPlayoutDelay(e){this.receiver?"playoutDelayHint"in this.receiver?this.receiver.playoutDelayHint=e:this.log.warn("Playout delay not supported in this browser"):this.log.warn("Cannot set playout delay, track already ended")}getPlayoutDelay(){if(this.receiver){if("playoutDelayHint"in this.receiver)return this.receiver.playoutDelayHint;this.log.warn("Playout delay not supported in this browser")}else this.log.warn("Cannot get playout delay, track already ended");return 0}startMonitor(){this.monitorInterval||(this.monitorInterval=setInterval(()=>this.monitorReceiver(),KO)),y8e()&&this.registerTimeSyncUpdate()}registerTimeSyncUpdate(){const e=()=>{var n;this.timeSyncHandle=requestAnimationFrame(()=>e());const r=(n=this.receiver)===null||n===void 0?void 0:n.getSynchronizationSources()[0];if(r){const{timestamp:i,rtpTimestamp:s}=r;
vendor: 15,481 bytes, line 789
789s&&this.rtpTimestamp!==s&&(this.emit(Qe.TimeSyncUpdate,{timestamp:i,rtpTimestamp:s}),this.rtpTimestamp=s)}};e()}}class oUe extends Cne{constructor(e,n,r,i,s,a){super(e,n,je.Kind.Audio,r,a),this.monitorReceiver=()=>ce(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}const o=yield this.getReceiverStats();o&&this.prevStats&&this.receiver&&(this._currentBitrate=cC(o,this.prevStats)),this.prevStats=o}),this.audioContext=i,this.webAudioPluginNodes=[],s&&(this.sinkId=s.deviceId)}setVolume(e){var n;for(const r of this.attachedElements)this.audioContext?(n=this.gainNode)===null||n===void 0||n.gain.setTargetAtTime(e,0,.1):r.volume=e;su()&&this._mediaStreamTrack._setVolume(e),this.elementVolume=e}getVolume(){if(this.elementVolume)return this.elementVolume;if(su())return 1;let e=0;return this.attachedElements.forEach(n=>{n.volume>e&&(e=n.volume)}),e}setSinkId(e){return ce(this,void 0,void 0,function*(){this.sinkId=e,yield Promise.all(this.attachedElements.map(n=>{if(ZN(n))return n.setSinkId(e)}))})}attach(e){const n=this.attachedElements.length===0;return e?super.attach(e):e=super.attach(),this.sinkId&&ZN(e)&&e.setSinkId(this.sinkId).catch(r=>{this.log.error("Failed to set sink id on remote audio track",r,this.logContext)}),this.audioContext&&n&&(this.log.debug("using audio context mapping",this.logContext),this.connectWebAudio(this.audioContext,e),e.volume=0,e.muted=!0),this.elementVolume&&this.setVolume(this.elementVolume),e}detach(e){let n;return e?(n=super.detach(e),this.audioContext&&(this.attachedElements.length>0?this.connectWebAudio(this.audioContext,this.attachedElements[0]):this.disconnectWebAudio())):(n=super.detach(),this.disconnectWebAudio()),n}setAudioContext(e){this.audioContext=e,e&&this.attachedElements.length>0?this.connectWebAudio(e,this.attachedElements[0]):e||this.disconnectWebAudio()}setWebAudioPlugins(e){this.webAudioPluginNodes=e,this.attachedElements.length>0&&this.audioContext&&this.connectWebAudio(this.audioContext,this.attachedElements[0])}connectWebAudio(e,n){this.disconnectWebAudio(),this.sourceNode=e.createMediaStreamSource(n.srcObject);let r=this.sourceNode;this.webAudioPluginNodes.forEach(i=>{r.connect(i),r=i}),this.gainNode=e.createGain(),r.connect(this.gainNode),this.gainNode.connect(e.destination),this.elementVolume&&this.gainNode.gain.setTargetAtTime(this.elementVolume,0,.1),e.state!=="running"&&e.resume().then(()=>{e.state!=="running"&&this.emit(Qe.AudioPlaybackFailed,new Error("Audio Context couldn't be started automatically"))}).catch(i=>{this.emit(Qe.AudioPlaybackFailed,i)})}disconnectWebAudio(){var e,n;(e=this.gainNode)===null||e===void 0||e.disconnect(),(n=this.sourceNode)===null||n===void 0||n.disconnect(),this.gainNode=void 0,this.sourceNode=void 0}getReceiverStats(){return ce(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const e=yield this.receiver.getStats();let n;return e.forEach(r=>{r.type==="inbound-rtp"&&(n={type:"audio",streamId:r.id,timestamp:r.timestamp,jitter:r.jitter,bytesReceived:r.bytesReceived,concealedSamples:r.concealedSamples,concealmentEvents:r.concealmentEvents,silentConcealedSamples:r.silentConcealedSamples,silentConcealmentEvents:r.silentConcealmentEvents,totalAudioEnergy:r.totalAudioEnergy,totalSamplesDuration:r.totalSamplesDuration})}),n})}}const lA=100;class lUe extends Cne{constructor(e,n,r,i,s){super(e,n,je.Kind.Video,r,s),this.elementInfos=[],this.monitorReceiver=()=>ce(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}const a=yield this.getReceiverStats();a&&this.prevStats&&this.receiver&&(this._currentBitrate=cC(a,this.prevStats)),this.prevStats=a}),this.debouncedHandleResize=qO(()=>{this.updateDimensions()},lA),this.adaptiveStreamSettings=i}get isAdaptiveStream(){return this.adaptiveStreamSettings!==void 0}setStreamState(e){super.setStreamState(e),this.log.debug("setStreamState",e),this.isAdaptiveStream&&e===je.StreamState.Active&&this.updateVisibility()}get mediaStreamTrack(){return this._mediaStreamTrack}setMuted(e){super.setMuted(e),this.attachedElements.forEach(n=>{e?dv(this._mediaStreamTrack,n):zg(this._mediaStreamTrack,n)})}attach(e){if(e?super.attach(e):e=super.attach(),this.adaptiveStreamSettings&&this.elementInfos.find(n=>n.element===e)===void 0){const n=new cUe(e);this.observeElementInfo(n)}return e}observeElementInfo(e){this.adaptiveStreamSettings&&this.elementInfos.find(n=>n===e)===void 0?(e.handleResize=()=>{this.debouncedHandleResize()},e.handleVisibilityChanged=()=>{this.updateVisibility()},this.elementInfos.push(e),e.observe(),this.debouncedHandleResize(),this.updateVisibility()):this.log.warn("visibility resize observer not triggered",this.logContext)}stopObservingElementInfo(e){if(!this.isAdaptiveStream){this.log.warn("stopObservingElementInfo ignored",this.logContext);return}const n=this.elementInfos.filter(r=>r===e);for(const r of n)r.stopObserving();this.elementInfos=this.elementInfos.filter(r=>r!==e),this.updateVisibility(),this.debouncedHandleResize()}detach(e){let n=[];if(e)return this.stopObservingElement(e),super.detach(e);n=super.detach();for(const r of n)this.stopObservingElement(r);return n}getDecoderImplementation(){var e;return(e=this.prevStats)===null||e===void 0?void 0:e.decoderImplementation}getReceiverStats(){return ce(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const e=yield this.receiver.getStats();let n,r="",i=new Map;return e.forEach(s=>{s.type==="inbound-rtp"?(r=s.codecId,n={type:"video",streamId:s.id,framesDecoded:s.framesDecoded,framesDropped:s.framesDropped,framesReceived:s.framesReceived,packetsReceived:s.packetsReceived,packetsLost:s.packetsLost,frameWidth:s.frameWidth,frameHeight:s.frameHeight,pliCount:s.pliCount,firCount:s.firCount,nackCount:s.nackCount,jitter:s.jitter,timestamp:s.timestamp,bytesReceived:s.bytesReceived,decoderImplementation:s.decoderImplementation}):s.type==="codec"&&i.set(s.id,s)}),n&&r!==""&&i.get(r)&&(n.mimeType=i.get(r).mimeType),n})}stopObservingElement(e){const n=this.elementInfos.filter(r=>r.element===e);for(const r of n)this.stopObservingElementInfo(r)}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return ce(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),this.isAdaptiveStream&&this.updateVisibility()})}updateVisibility(e){var n,r;const i=this.elementInfos.reduce((l,c)=>Math.max(l,c.visibilityChangedAt||0),0),s=!((r=(n=this.adaptiveStreamSettings)===null||n===void 0?void 0:n.pauseVideoInBackground)!==null&&r!==void 0)||r?this.isInBackground:!1,a=this.elementInfos.some(l=>l.pictureInPicture),o=this.elementInfos.some(l=>l.visible)&&!s||a;if(!(this.lastVisible===o&&!e)){if(!o&&Date.now()-i<lA){Fi.setTimeout(()=>{this.updateVisibility()},lA);return}this.lastVisible=o,this.emit(Qe.VisibilityChanged,o,this)}}updateDimensions(){var e,n;let r=0,i=0;const s=this.getPixelDensity();for(const a of this.elementInfos){const o=a.width()*s,l=a.height()*s;o+l>r+i&&(r=o,i=l)}((e=this.lastDimensions)===null||e===void 0?void 0:e.width)===r&&((n=this.lastDimensions)===null||n===void 0?void 0:n.height)===i||(this.lastDimensions={width:r,height:i},this.emit(Qe.VideoDimensionsChanged,this.lastDimensions,this))}getPixelDensity(){var e;const n=(e=this.adaptiveStreamSettings)===null||e===void 0?void 0:e.pixelDensity;return n==="screen"?Y7():n||(Y7()>2?2:1)}}class cUe{get visible(){return this.isPiP||this.isIntersecting}get pictureInPicture(){return this.isPiP}constructor(e,n){this.onVisibilityChanged=r=>{var i;const{target:s,isIntersecting:a}=r;s===this.element&&(this.isIntersecting=a,this.isPiP=Ly(this.element),this.visibilityChangedAt=Date.now(),(i=this.handleVisibilityChanged)===null||i===void 0||i.call(this))},this.onEnterPiP=()=>{var r,i;(i=(r=window.documentPictureInPicture)===null||r===void 0?void 0:r.window)===null||i===void 0||i.addEventListener("pagehide",this.onLeavePiP),queueMicrotask(()=>{requestAnimationFrame(()=>{var s;this.isPiP=Ly(this.element),(s=this.handleVisibilityChanged)===null||s===void 0||s.call(this)})})},this.onLeavePiP=()=>{var r;this.isPiP=Ly(this.element),(r=this.handleVisibilityChanged)===null||r===void 0||r.call(this)},this.element=e,this.isIntersecting=n??a3(e),this.isPiP=Wa()&&Ly(e),this.visibilityChangedAt=0}width(){return this.element.clientWidth}height(){return this.element.clientHeight}observe(){var e,n,r;this.isIntersecting=a3(this.element),this.isPiP=Ly(this.element),this.element.handleResize=()=>{var i;(i=this.handleResize)===null||i===void 0||i.call(this)},this.element.handleVisibilityChanged=this.onVisibilityChanged,Q7().observe(this.element),X7().observe(this.element),this.element.addEventListener("enterpictureinpicture",this.onEnterPiP),this.element.addEventListener("leavepictureinpicture",this.onLeavePiP),(e=window.documentPictureInPicture)===null||e===void 0||e.addEventListener("enter",this.onEnterPiP),(r=(n=window.documentPictureInPicture)===null||n===void 0?void 0:n.window)===null||r===void 0||r.addEventListener("pagehide",this.onLeavePiP)}stopObserving(){var e,n,r,i,s;(e=Q7())===null||e===void 0||e.unobserve(this.element),(n=X7())===null||n===void 0||n.unobserve(this.element),this.element.removeEventListener("enterpictureinpicture",this.onEnterPiP),this.element.removeEventListener("leavepictureinpicture",this.onLeavePiP),(r=window.documentPictureInPicture)===null||r===void 0||r.removeEventListener("enter",this.onEnterPiP),(s=(i=window.documentPictureInPicture)===null||i===void 0?void 0:i.window)===null||s===void 0||s.removeEventListener("pagehide",this.onLeavePiP)}}function Ly(t){var e,n;return document.pictureInPictureElement===t?!0:!((e=window.documentPictureInPicture)===null||e===void 0)&&e.window?a3(t,(n=window.documentPictureInPicture)===null||n===void 0?void 0:n.window):!1}function a3(t,e){const n=e||window;let r=t.offsetTop,i=t.offsetLeft;const s=t.offsetWidth,a=t.offsetHeight,{hidden:o}=t,{display:l}=getComputedStyle(t);for(;t.offsetParent;)t=t.offsetParent,r+=t.offsetTop,i+=t.offsetLeft;return r<n.pageYOffset+n.innerHeight&&i<n.pageXOffset+n.innerWidth&&r+a>n.pageYOffset&&i+s>n.pageXOffset&&!o&&l!=="none"}class Yu extends al.EventEmitter{constructor(e,n,r,i){var s;super(),this.metadataMuted=!1,this.encryption=yr.NONE,this.log=mn,this.handleMuted=()=>{this.emit(Qe.Muted)},this.handleUnmuted=()=>{this.emit(Qe.Unmuted)},this.log=Xa((s=i==null?void 0:i.loggerName)!==null&&s!==void 0?s:hs.Publication),this.loggerContextCb=this.loggerContextCb,this.setMaxListeners(100),this.kind=e,this.trackSid=n,this.trackName=r,this.source=je.Source.Unknown}setTrack(e){this.track&&(this.track.off(Qe.Muted,this.handleMuted),this.track.off(Qe.Unmuted,this.handleUnmuted)),this.track=e,e&&(e.on(Qe.Muted,this.handleMuted),e.on(Qe.Unmuted,this.handleUnmuted))}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),wn(this))}get isMuted(){return this.metadataMuted}get isEnabled(){return!0}get isSubscribed(){return this.track!==void 0}get isEncrypted(){return this.encryption!==yr.NONE}get audioTrack(){if(eu(this.track))return this.track}get videoTrack(){if(pf(this.track))return this.track}updateInfo(e){this.trackSid=e.sid,this.trackName=e.name,this.source=je.sourceFromProto(e.source),this.mimeType=e.mimeType,this.kind===je.Kind.Video&&e.width>0&&(this.dimensions={width:e.width,height:e.height},this.simulcasted=e.simulcast),this.encryption=e.encryption,this.trackInfo=e,this.log.debug("update publication info",Object.assign(Object.assign({},this.logContext),{info:e}))}}(function(t){(function(e){e.Desired="desired",e.Subscribed="subscribed",e.Unsubscribed="unsubscribed"})(t.SubscriptionStatus||(t.SubscriptionStatus={})),function(e){e.Allowed="allowed",e.NotAllowed="not_allowed"}(t.PermissionStatus||(t.PermissionStatus={}))})(Yu||(Yu={}));class o3 extends Yu{get isUpstreamPaused(){var e;return(e=this.track)===null||e===void 0?void 0:e.isUpstreamPaused}constructor(e,n,r,i){super(e,n.sid,n.name,i),this.track=void 0,this.handleTrackEnded=()=>{this.emit(Qe.Ended)},this.handleCpuConstrained=()=>{this.track&&pf(this.track)&&this.emit(Qe.CpuConstrained,this.track)},this.updateInfo(n),this.setTrack(r)}setTrack(e){this.track&&(this.track.off(Qe.Ended,this.handleTrackEnded),this.track.off(Qe.CpuConstrained,this.handleCpuConstrained)),super.setTrack(e),e&&(e.on(Qe.Ended,this.handleTrackEnded),e.on(Qe.CpuConstrained,this.handleCpuConstrained))}get isMuted(){return this.track?this.track.isMuted:super.isMuted}get audioTrack(){return super.audioTrack}get videoTrack(){return super.videoTrack}get isLocal(){return!0}mute(){return ce(this,void 0,void 0,function*(){var e;return(e=this.track)===null||e===void 0?void 0:e.mute()})}unmute(){return ce(this,void 0,void 0,function*(){var e;return(e=this.track)===null||e===void 0?void 0:e.unmute()})}pauseUpstream(){return ce(this,void 0,void 0,function*(){var e;yield(e=this.track)===null||e===void 0?void 0:e.pauseUpstream()})}resumeUpstream(){return ce(this,void 0,void 0,function*(){var e;yield(e=this.track)===null||e===void 0?void 0:e.resumeUpstream()})}getTrackFeatures(){var e;if(eu(this.track)){const n=this.track.getSourceTrackSettings(),r=new Set;return n.autoGainControl&&r.add(ls.TF_AUTO_GAIN_CONTROL),n.echoCancellation&&r.add(ls.TF_ECHO_CANCELLATION),n.noiseSuppression&&r.add(ls.TF_NOISE_SUPPRESSION),n.channelCount&&n.channelCount>1&&r.add(ls.TF_STEREO),!((e=this.options)===null||e===void 0)&&e.dtx||r.add(ls.TF_NO_DTX),this.track.enhancedNoiseCancellation&&r.add(ls.TF_ENHANCED_NOISE_CANCELLATION),Array.from(r.values())}else return[]}}function gC(t,e){return ce(this,void 0,void 0,function*(){t??(t={});let n=!1;const{audioProcessor:r,videoProcessor:i,optionsWithoutProcessor:s}=ine(t);let a=s.audio,o=s.video;if(r&&typeof s.audio=="object"&&(s.audio.processor=r),i&&typeof s.video=="object"&&(s.video.processor=i),t.audio&&typeof s.audio=="object"&&typeof s.audio.deviceId=="string"){const d=s.audio.deviceId;s.audio.deviceId={exact:d},n=!0,a=Object.assign(Object.assign({},s.audio),{deviceId:{ideal:d}})}if(s.video&&typeof s.video=="object"&&typeof s.video.deviceId=="string"){const d=s.video.deviceId;s.video.deviceId={exact:d},n=!0,o=Object.assign(Object.assign({},s.video),{deviceId:{ideal:d}})}s.audio===!0?s.audio={deviceId:"default"}:typeof s.audio=="object"&&s.audio!==null&&(s.audio=Object.assign(Object.assign({},s.audio),{deviceId:s.audio.deviceId||"default"})),s.video===!0?s.video={deviceId:"default"}:typeof s.video=="object"&&!s.video.deviceId&&(s.video.deviceId="default");const l=tne(s,une,dne),c=jO(l),u=navigator.mediaDevices.getUserMedia(c);s.audio&&(cs.userMediaPromiseMap.set("audioinput",u),u.catch(()=>cs.userMediaPromiseMap.delete("audioinput"))),s.video&&(cs.userMediaPromiseMap.set("videoinput",u),u.catch(()=>cs.userMediaPromiseMap.delete("videoinput")));try{const d=yield u;return yield Promise.all(d.getTracks().map(f=>ce(this,void 0,void 0,function*(){const h=f.kind==="audio";let p=h?l.audio:l.video;(typeof p=="boolean"||!p)&&(p={});let m;const g=h?c.audio:c.video;typeof g!="boolean"&&(m=g);const v=f.getSettings().deviceId;m!=null&&m.deviceId&&Ip(m.deviceId)!==v?m.deviceId=v:m||(m={deviceId:v});const _=TBe(f,m,e);return _.kind===je.Kind.Video?_.source=je.Source.Camera:_.kind===je.Kind.Audio&&(_.source=je.Source.Microphone),_.mediaStream=d,eu(_)&&r?yield _.setProcessor(r):pf(_)&&i&&(yield _.setProcessor(i)),_}
789)))}catch(d){if(!n)throw d;return gC(Object.assign(Object.assign({},t),{audio:a,video:o}),e)}})}function uUe(t){return ce(this,void 0,void 0,function*(){return(yield gC({audio:!1,video:!0}))[0]})}function Ene(t){return ce(this,void 0,void 0,function*(){return(yield gC({audio:t??!0,video:!1}))[0]})}var ph;(function(t){t.Excellent="excellent",t.Good="good",t.Poor="poor",t.Lost="lost",t.Unknown="unknown"})(ph||(ph={}));function dUe(t){switch(t){case a_.EXCELLENT:return ph.Excellent;case a_.GOOD:return ph.Good;case a_.POOR:return ph.Poor;case a_.LOST:return ph.Lost;default:return ph.Unknown}}class Ane extends al.EventEmitter{get logContext(){var e,n;return Object.assign({},(n=(e=this.loggerOptions)===null||e===void 0?void 0:e.loggerContextCb)===null||n===void 0?void 0:n.call(e))}get isEncrypted(){return this.trackPublications.size>0&&Array.from(this.trackPublications.values()).every(e=>e.isEncrypted)}get isAgent(){var e;return((e=this.permissions)===null||e===void 0?void 0:e.agent)||this.kind===Bw.AGENT}get isActive(){var e;return((e=this.participantInfo)===null||e===void 0?void 0:e.state)===lv.ACTIVE}get kind(){return this._kind}get attributes(){return Object.freeze(Object.assign({},this._attributes))}constructor(e,n,r,i,s,a){let o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:Bw.STANDARD;var l;super(),this.audioLevel=0,this.isSpeaking=!1,this._connectionQuality=ph.Unknown,this.log=mn,this.loggerOptions=a,this.log=Xa((l=a==null?void 0:a.loggerName)!==null&&l!==void 0?l:hs.Participant,()=>this.logContext),this.setMaxListeners(100),this.sid=e,this.identity=n,this.name=r,this.metadata=i,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this._kind=o,this._attributes=s??{}}getTrackPublications(){return Array.from(this.trackPublications.values())}getTrackPublication(e){for(const[,n]of this.trackPublications)if(n.source===e)return n}getTrackPublicationByName(e){for(const[,n]of this.trackPublications)if(n.trackName===e)return n}waitUntilActive(){return this.isActive?Promise.resolve():this.activeFuture?this.activeFuture.promise:(this.activeFuture=new Cs,this.once(tt.Active,()=>{var e,n;(n=(e=this.activeFuture)===null||e===void 0?void 0:e.resolve)===null||n===void 0||n.call(e),this.activeFuture=void 0}),this.activeFuture.promise)}get connectionQuality(){return this._connectionQuality}get isCameraEnabled(){var e;const n=this.getTrackPublication(je.Source.Camera);return!(!((e=n==null?void 0:n.isMuted)!==null&&e!==void 0)||e)}get isMicrophoneEnabled(){var e;const n=this.getTrackPublication(je.Source.Microphone);return!(!((e=n==null?void 0:n.isMuted)!==null&&e!==void 0)||e)}get isScreenShareEnabled(){return!!this.getTrackPublication(je.Source.ScreenShare)}get isLocal(){return!1}get joinedAt(){return this.participantInfo?new Date(Number.parseInt(this.participantInfo.joinedAt.toString())*1e3):new Date}updateInfo(e){var n;return this.participantInfo&&this.participantInfo.sid===e.sid&&this.participantInfo.version>e.version?!1:(this.identity=e.identity,this.sid=e.sid,this._setName(e.name),this._setMetadata(e.metadata),this._setAttributes(e.attributes),e.state===lv.ACTIVE&&((n=this.participantInfo)===null||n===void 0?void 0:n.state)!==lv.ACTIVE&&this.emit(tt.Active),e.permission&&this.setPermissions(e.permission),this.participantInfo=e,!0)}_setMetadata(e){const n=this.metadata!==e,r=this.metadata;this.metadata=e,n&&this.emit(tt.ParticipantMetadataChanged,r)}_setName(e){const n=this.name!==e;this.name=e,n&&this.emit(tt.ParticipantNameChanged,e)}_setAttributes(e){const n=_8e(this.attributes,e);this._attributes=e,Object.keys(n).length>0&&this.emit(tt.AttributesChanged,n)}setPermissions(e){var n,r,i,s,a,o;const l=this.permissions,c=e.canPublish!==((n=this.permissions)===null||n===void 0?void 0:n.canPublish)||e.canSubscribe!==((r=this.permissions)===null||r===void 0?void 0:r.canSubscribe)||e.canPublishData!==((i=this.permissions)===null||i===void 0?void 0:i.canPublishData)||e.hidden!==((s=this.permissions)===null||s===void 0?void 0:s.hidden)||e.recorder!==((a=this.permissions)===null||a===void 0?void 0:a.recorder)||e.canPublishSources.length!==this.permissions.canPublishSources.length||e.canPublishSources.some((u,d)=>{var f;return u!==((f=this.permissions)===null||f===void 0?void 0:f.canPublishSources[d])})||e.canSubscribeMetrics!==((o=this.permissions)===null||o===void 0?void 0:o.canSubscribeMetrics);
789return this.permissions=e,c&&this.emit(tt.ParticipantPermissionsChanged,l),c}setIsSpeaking(e){e!==this.isSpeaking&&(this.isSpeaking=e,e&&(this.lastSpokeAt=new Date),this.emit(tt.IsSpeakingChanged,e))}setConnectionQuality(e){const n=this._connectionQuality;this._connectionQuality=dUe(e),n!==this._connectionQuality&&this.emit(tt.ConnectionQualityChanged,this._connectionQuality)}setDisconnected(){var e,n;this.activeFuture&&((n=(e=this.activeFuture).reject)===null||n===void 0||n.call(e,new Error("Participant disconnected")),this.activeFuture=void 0)}setAudioContext(e){this.audioContext=e,this.audioTrackPublications.forEach(n=>eu(n.track)&&n.track.setAudioContext(e))}addTrackPublication(e){e.on(Qe.Muted,()=>{this.emit(tt.TrackMuted,e)}),e.on(Qe.Unmuted,()=>{this.emit(tt.TrackUnmuted,e)});const n=e;switch(n.track&&(n.track.sid=e.trackSid),this.trackPublications.set(e.trackSid,e),e.kind){case je.Kind.Audio:this.audioTrackPublications.set(e.trackSid,e);break;case je.Kind.Video:this.videoTrackPublications.set(e.trackSid,e);break}}}function hUe(t){var e,n,r;if(!t.participantSid&&!t.participantIdentity)throw new Error("Invalid track permission, must provide at least one of participantIdentity and participantSid");return new mte({participantIdentity:(e=t.participantIdentity)!==null&&e!==void 0?e:"",participantSid:(n=t.participantSid)!==null&&n!==void 0?n:"",allTracks:(r=t.allowAll)!==null&&r!==void 0?r:!1,trackSids:t.allowedTrackSids||[]})}class fUe extends Ane{constructor(e,n,r,i,s,a,o){super(e,n,void 0,void 0,void 0,{loggerName:i.loggerName,loggerContextCb:()=>this.engine.logContext}),this.pendingPublishing=new Set,this.pendingPublishPromises=new Map,this.participantTrackPermissions=[],this.allParticipantsAllowedToSubscribe=!0,this.encryptionType=yr.NONE,this.e2eeStateMutex=new As,this.enabledPublishVideoCodecs=[],this.pendingAcks=new Map,this.pendingResponses=new Map,this.handleReconnecting=()=>{this.reconnectFuture||(this.reconnectFuture=new Cs)},this.handleReconnected=()=>{var l,c;(c=(l=this.reconnectFuture)===null||l===void 0?void 0:l.resolve)===null||c===void 0||c.call(l),this.reconnectFuture=void 0,this.updateTrackSubscriptionPermissions()},this.handleClosing=()=>{var l,c,u,d,f,h;this.reconnectFuture&&(this.reconnectFuture.promise.catch(p=>this.log.warn(p.message)),(c=(l=this.reconnectFuture)===null||l===void 0?void 0:l.reject)===null||c===void 0||c.call(l,new Error("Got disconnected during reconnection attempt")),this.reconnectFuture=void 0),this.signalConnectedFuture&&((d=(u=this.signalConnectedFuture).reject)===null||d===void 0||d.call(u,new Error("Got disconnected without signal connected")),this.signalConnectedFuture=void 0),(h=(f=this.activeAgentFuture)===null||f===void 0?void 0:f.reject)===null||h===void 0||h.call(f,new Error("Got disconnected without active agent present")),this.activeAgentFuture=void 0,this.firstActiveAgent=void 0},this.handleSignalConnected=l=>{var c,u;l.participant&&this.updateInfo(l.participant),this.signalConnectedFuture||(this.signalConnectedFuture=new Cs),(u=(c=this.signalConnectedFuture).resolve)===null||u===void 0||u.call(c)},this.handleSignalRequestResponse=l=>{const{requestId:c,reason:u,message:d}=l,f=this.pendingSignalRequests.get(c);switch(f&&(u!==rp.OK&&f.reject(new W7(d,u)),this.pendingSignalRequests.delete(c)),l.request.case){case"publishDataTrack":{let h;switch(l.reason){case rp.NOT_ALLOWED:h=Gi.notAllowed(l.message);break;case rp.DUPLICATE_NAME:h=Gi.duplicateName(l.message);break;case rp.INVALID_NAME:h=Gi.invalidName(l.message);break;case rp.LIMIT_EXCEEDED:h=Gi.limitReached(l.message);break;default:h=Gi.unknown(l.reason,l.message);return}this.roomOutgoingDataTrackManager.receivedSfuPublishResponse(l.request.value.pubHandle,{type:"error",error:h});break}}},this.handleDataPacket=l=>{switch(l.value.case){case"rpcResponse":let c=l.value.value,u=null,d=null;c.value.case==="payload"?u=c.value.value:c.value.case==="error"&&(d=gi.fromProto(c.value.value)),this.handleIncomingRpcResponse(c.requestId,u,d);break;case"rpcAck":let f=l.value.value;this.handleIncomingRpcAck(f.requestId);break}},this.updateTrackSubscriptionPermissions=()=>{this.log.debug("updating track subscription permissions",{allParticipantsAllowed:this.allParticipantsAllowedToSubscribe,participantTrackPermissions:this.participantTrackPermissions}),this.engine.client.sendUpdateSubscriptionPermissions(this.allParticipantsAllowedToSubscribe,this.participantTrackPermissions.map(l=>hUe(l)))},this.onTrackUnmuted=l=>{this.onTrackMuted(l,l.isUpstreamPaused)},this.onTrackMuted=(l,c)=>{if(c===void 0&&(c=!0),!l.sid){this.log.error("could not update mute status for unpublished track",wn(l));return}this.engine.updateMuteStatus(l.sid,c)},this.onTrackUpstreamPaused=l=>{this.log.debug("upstream paused",wn(l)),this.onTrackMuted(l,!0)},this.onTrackUpstreamResumed=l=>{this.log.debug("upstream resumed",wn(l)),this.onTrackMuted(l,l.isMuted)},this.onTrackFeatureUpdate=l=>{const c=this.audioTrackPublications.get(l.sid);if(!c){this.log.warn("Could not update local audio track settings, missing publication for track ".concat(l.sid));return}this.engine.client.sendUpdateLocalAudioTrack(c.trackSid,c.getTrackFeatures())},this.onTrackCpuConstrained=(l,c)=>
vendor: 6,118 bytes, line 789
789{this.log.debug("track cpu constrained",wn(c)),this.emit(tt.LocalTrackCpuConstrained,l,c)},this.handleSubscribedQualityUpdate=l=>ce(this,void 0,void 0,function*(){var c,u,d,f,h;if(!(!((h=this.roomOptions)===null||h===void 0)&&h.dynacast))return;const p=this.videoTrackPublications.get(l.trackSid);if(!p){this.log.warn("received subscribed quality update for unknown track",{trackSid:l.trackSid});return}if(!p.videoTrack)return;const m=yield p.videoTrack.setPublishingCodecs(l.subscribedCodecs);try{for(var g=!0,v=Vl(m),_;_=yield v.next(),c=_.done,!c;g=!0){f=_.value,g=!1;const b=f;p8e(b)&&(this.log.debug("publish ".concat(b," for ").concat(p.videoTrack.sid),wn(p)),yield this.publishAdditionalCodecForTrack(p.videoTrack,b,p.options))}}catch(b){u={error:b}}finally{try{!g&&!c&&(d=v.return)&&(yield d.call(v))}finally{if(u)throw u.error}}}),this.handleLocalTrackUnpublished=l=>{const c=this.trackPublications.get(l.trackSid);if(!c){this.log.warn("received unpublished event for unknown track",{trackSid:l.trackSid});return}this.unpublishTrack(c.track)},this.handleTrackEnded=l=>ce(this,void 0,void 0,function*(){if(l.source===je.Source.ScreenShare||l.source===je.Source.ScreenShareAudio)this.log.debug("unpublishing local track due to TrackEnded",wn(l)),this.unpublishTrack(l);else if(l.isUserProvided)yield l.mute();else if($u(l)||Bu(l))try{if(Wa())try{const c=yield navigator==null?void 0:navigator.permissions.query({name:l.source===je.Source.Camera?"camera":"microphone"});if(c&&c.state==="denied")throw this.log.warn("user has revoked access to ".concat(l.source),wn(l)),c.onchange=()=>{c.state!=="denied"&&(l.isMuted||l.restartTrack(),c.onchange=null)},new Error("GetUserMedia Permission denied")}catch{}l.isMuted||(this.log.debug("track ended, attempting to use a different device",wn(l)),$u(l)?yield l.restartTrack({deviceId:"default"}):yield l.restartTrack())}catch{this.log.warn("could not restart track, muting instead",wn(l)),yield l.mute()}}),this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this.engine=r,this.roomOptions=i,this.setupEngine(r),this.activeDeviceMap=new Map([["audioinput","default"],["videoinput","default"],["audiooutput","default"]]),this.pendingSignalRequests=new Map,this.rpcHandlers=s,this.roomOutgoingDataStreamManager=a,this.roomOutgoingDataTrackManager=o}get lastCameraError(){return this.cameraError}get lastMicrophoneError(){return this.microphoneError}get isE2EEEnabled(){return this.encryptionType!==yr.NONE}getTrackPublication(e){const n=super.getTrackPublication(e);if(n)return n}getTrackPublicationByName(e){const n=super.getTrackPublicationByName(e);if(n)return n}setupEngine(e){var n;this.engine=e,this.engine.on(We.RemoteMute,(r,i)=>{const s=this.trackPublications.get(r);!s||!s.track||(i?s.mute():s.unmute())}),!((n=this.signalConnectedFuture)===null||n===void 0)&&n.isResolved&&(this.signalConnectedFuture=void 0),this.engine.on(We.Connected,this.handleReconnected).on(We.SignalConnected,this.handleSignalConnected).on(We.SignalRestarted,this.handleReconnected).on(We.SignalResumed,this.handleReconnected).on(We.Restarting,this.handleReconnecting).on(We.Resuming,this.handleReconnecting).on(We.LocalTrackUnpublished,this.handleLocalTrackUnpublished).on(We.SubscribedQualityUpdate,this.handleSubscribedQualityUpdate).on(We.Closing,this.handleClosing).on(We.SignalRequestResponse,this.handleSignalRequestResponse).on(We.DataPacketReceived,this.handleDataPacket)}setMetadata(e){return ce(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({metadata:e})})}setName(e){return ce(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({name:e})})}setAttributes(e){return ce(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({attributes:e})})}requestMetadataUpdate(e){return ce(this,arguments,void 0,function(n){var r=this;let{metadata:i,name:s,attributes:a}=n;return function*(){return new Xs((o,l)=>ce(r,void 0,void 0,function*(){var c,u;try{let d=!1;const f=yield this.engine.client.sendUpdateLocalMetadata((c=i??this.metadata)!==null&&c!==void 0?c:"",(u=s??this.name)!==null&&u!==void 0?u:"",a),h=performance.now();for(this.pendingSignalRequests.set(f,{resolve:o,reject:p=>{l(p),d=!0},values:{name:s,metadata:i,attributes:a}});performance.now()-h<5e3&&!d;){if((!s||this.name===s)&&(!i||this.metadata===i)&&(!a||Object.entries(a).every(p=>{let[m,g]=p;return this.attributes[m]===g||g===""&&!this.attributes[m]}))){this.pendingSignalRequests.delete(f),o();return}yield Zs(50)}l(new W7("Request to update local metadata timed out","TimeoutError"))}catch(d){d instanceof Error?l(d):l(new Error(String(d)))}}))}()})}setCameraEnabled(e,n,r){return this.setTrackEnabled(je.Source.Camera,e,n,r)}setMicrophoneEnabled(e,n,r){return this.setTrackEnabled(je.Source.Microphone,e,n,r)}setScreenShareEnabled(e,n,r){return this.setTrackEnabled(je.Source.ScreenShare,e,n,r)}setE2EEEnabled(e){return ce(this,void 0,void 0,function*(){const n=yield this.e2eeStateMutex.lock();try{if(this.encryptionType=e?yr.GCM:yr.NONE,yield Promise.all(this.pendingPublishPromises.values()),this.trackPublications.size===0||Array.from(this.trackPublications.values()).every(r=>r.isEncrypted===e))return;yield this.republishAllTracks(void 0,!1)}finally{n()}})}setTrackEnabled(e,n,r,i){return ce(this,void 0,void 0,function*(){var s,a;this.log.debug("setTrackEnabled",{source:e,enabled:n}),this.republishPromise&&(yield this.republishPromise);let o=this.getTrackPublication(e);if(n)if(o)yield o.unmute();else{let l;if(this.pendingPublishing.has(e)){const c=yield this.waitForPendingPublicationOfSource(e);return c||this.log.info("waiting for pending publication promise timed out",{source:e}),yield c==null?void 0:c.unmute(),c}this.pendingPublishing.add(e);try{switch(e){case je.Source.Camera:l=yield this.createTracks({video:(s=r)!==null&&s!==void 0?s:!0});break;case je.Source.Microphone:l=yield this.createTracks({audio:(a=r)!==null&&a!==void 0?a:!0});break;case je.Source.ScreenShare:l=yield this.createScreenTracks(Object.assign({},r));break;default:throw new td(e)}}catch(c){throw l==null||l.forEach(u=>{u.stop()}
789),c instanceof Error&&this.emit(tt.MediaDevicesError,c,YN(e)),this.pendingPublishing.delete(e),c}for(const c of l){const u=Object.assign(Object.assign({},this.roomOptions.publishDefaults),r);e===je.Source.Microphone&&eu(c)&&u.preConnectBuffer&&(this.log.info("starting preconnect buffer for microphone"),c.startPreConnectBuffer())}try{const c=[];for(const d of l)this.log.info("publishing track",wn(d)),c.push(this.publishTrack(d,i));[o]=yield Promise.all(c)}catch(c){throw l==null||l.forEach(u=>{u.stop()}),c}finally{this.pendingPublishing.delete(e)}}else if(!(o!=null&&o.track)&&this.pendingPublishing.has(e)&&(o=yield this.waitForPendingPublicationOfSource(e),o||this.log.info("waiting for pending publication promise timed out",{source:e})),o&&o.track)if(e===je.Source.ScreenShare){const l=[this.unpublishTrack(o.track)],c=this.getTrackPublication(je.Source.ScreenShareAudio);c&&c.track&&l.push(this.unpublishTrack(c.track)),[o]=yield Promise.all(l)}else yield o.mute();return o})}enableCameraAndMicrophone(){return ce(this,void 0,void 0,function*(){if(!(this.pendingPublishing.has(je.Source.Camera)||this.pendingPublishing.has(je.Source.Microphone))){this.pendingPublishing.add(je.Source.Camera),this.pendingPublishing.add(je.Source.Microphone);try{const e=yield this.createTracks({audio:!0,video:!0});yield Promise.all(e.map(n=>this.publishTrack(n)))}finally{this.pendingPublishing.delete(je.Source.Camera),this.pendingPublishing.delete(je.Source.Microphone)}}})}createTracks(e){return ce(this,void 0,void 0,function*(){var n,r;e??(e={});const i=tne(e,(n=this.roomOptions)===null||n===void 0?void 0:n.audioCaptureDefaults,(r=this.roomOptions)===null||r===void 0?void 0:r.videoCaptureDefaults);try{return(yield gC(i,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext})).map(o=>(eu(o)&&(this.microphoneError=void 0,o.setAudioContext(this.audioContext),o.source=je.Source.Microphone,this.emit(tt.AudioStreamAcquired)),pf(o)&&(this.cameraError=void 0,o.source=je.Source.Camera),o))}catch(s){throw s instanceof Error&&(e.audio&&(this.microphoneError=s),e.video&&(this.cameraError=s)),s}})}createScreenTracks(e){return ce(this,void 0,void 0,function*(){if(e===void 0&&(e={}),navigator.mediaDevices.getDisplayMedia===void 0)throw new DO("getDisplayMedia not supported");e.resolution===void 0&&!A8e()&&(e.resolution=FO.h1080fps30.resolution);const n=g8e(e),r=yield navigator.mediaDevices.getDisplayMedia(n),i=r.getVideoTracks();if(i.length===0)throw new td("no video track found");const s=new TS(i[0],void 0,!1,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});s.source=je.Source.ScreenShare,e.contentHint&&(s.mediaStreamTrack.contentHint=e.contentHint);const a=[s];if(r.getAudioTracks().length>0){this.emit(tt.AudioStreamAcquired);const o=new kS(r.getAudioTracks()[0],void 0,!1,this.audioContext,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});o.source=je.Source.ScreenShareAudio,a.push(o)}return a})}publishTrack(e,n){return ce(this,void 0,void 0,function*(){return this.publishOrRepublishTrack(e,n)})}waitForNextEngineRestart(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:15e3;return new Promise((n,r)=>{const i=()=>{clearTimeout(o),this.engine.off(We.Restarted,s),this.engine.off(We.Closing,a)},s=()=>{i(),n()},a=()=>{i(),r(new Error("engine closed before restart completed"))},o=setTimeout(()=>{i(),r(new Error("timed out waiting for engine restart"))},e);this.engine.once(We.Restarted,s),this.engine.once(We.Closing,a)})}publishOrRepublishTrack(e,n){return ce(this,arguments,void 0,function(r,i){var s=this;let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;return function*(){var l,c,u,d;$u(r)&&r.setAudioContext(s.audioContext),yield(l=s.reconnectFuture)===null||l===void 0?void 0:l.promise,s.republishPromise&&!a&&(yield s.republishPromise),hv(r)&&s.pendingPublishPromises.has(r)&&(yield s.pendingPublishPromises.get(r));let f;if(r instanceof MediaStreamTrack)f=r.getConstraints();else{f=r.constraints;let _;switch(r.source){case je.Source.Microphone:_="audioinput";break;case je.Source.Camera:_="videoinput"}_&&s.activeDeviceMap.has(_)&&(f=Object.assign(Object.assign({},f),{deviceId:s.activeDeviceMap.get(_)}))}if(r instanceof MediaStreamTrack)switch(r.kind){case"audio":r=new kS(r,f,!0,s.audioContext,{loggerName:s.roomOptions.loggerName,loggerContextCb:()=>s.logContext});break;case"video":r=new TS(r,f,!0,{loggerName:s.roomOptions.loggerName,loggerContextCb:()=>s.logContext});break;default:throw new td("unsupported MediaStreamTrack kind ".concat(r.kind))}else r.updateLoggerOptions({loggerName:s.roomOptions.loggerName,loggerContextCb:()=>s.logContext});let h;if(s.trackPublications.forEach(_=>{_.track&&_.track===r&&(h=_)}),h)return s.log.warn("track has already been published, skipping",wn(h)),h;const p=Object.assign(Object.assign({},s.roomOptions.publishDefaults),i),m="channelCount"in r.mediaStreamTrack.getSettings()&&r.mediaStreamTrack.getSettings().channelCount===2||r.mediaStreamTrack.getConstraints().channelCount===2,g=(c=p.forceStereo)!==null&&c!==void 0?c:m;g&&(p.dtx===void 0&&s.log.debug("Opus DTX will be disabled for stereo tracks by default. Enable them explicitly to make it work.",wn(r)),p.red===void 0&&s.log.debug("Opus RED will be disabled for stereo tracks by default. Enable them explicitly to make it work."),(u=p.dtx)!==null&&u!==void 0||(p.dtx=!1),(d=p.red)!==null&&d!==void 0||(p.red=!1)),!M8e()&&s.roomOptions.e2ee&&(s.log.info("End-to-end encryption is set up, simulcast publishing will be disabled on Safari versions and iOS browsers running iOS < v17.2"),p.simulcast=!1),p.source&&(r.source=p.source);const v=new Promise((_,b)=>ce(s,void 0,void 0,function*(){try{if(this.engine.client.currentState!==mr.CONNECTED){this.log.debug("deferring track publication until signal is connected",{track:wn(r)});let x=!1;const T=setTimeout(()=>{x=!0,r.stop(),b(new q7("publishing rejected as engine not connected within timeout",408))},15e3);if(yield this.waitUntilEngineConnected(),clearTimeout(T),x)return;const N=yield this.publish(r,p,g);_(N)}else try{const x=yield this.publish(r,p,g);_(x)}catch(x){b(x)}}catch(x){b(x)}}));s.pendingPublishPromises.set(r,v);try{return yield v}catch(_){if(!o&&_ instanceof Rp)return s.log.warn("negotiation due to track publish failed, retrying after reconnect",{error:_}),s.pendingPublishPromises.delete(r),yield s.waitForNextEngineRestart(),yield s.publishOrRepublishTrack(r,i,a,!0);throw _}finally{s.pendingPublishPromises.delete(r)}}()})}waitUntilEngineConnected(){return this.signalConnectedFuture||(this.signalConnectedFuture=new Cs),this.signalConnectedFuture.promise}hasPermissionsToPublish(e){if(!this.permissions)return this.log.warn("no permissions present for publishing track",wn(e)),!1;const{canPublish:n,canPublishSources:r}=this.permissions;return n&&(r.length===0||r.map(i=>
789w8e(i)).includes(e.source))?!0:(this.log.warn("insufficient permissions to publish",wn(e)),!1)}publish(e,n,r){return ce(this,void 0,void 0,function*(){var i,s,a,o,l,c,u,d,f,h;if(!this.hasPermissionsToPublish(e))throw new q7("failed to publish track, insufficient permissions",403);Array.from(this.trackPublications.values()).find(M=>hv(e)&&M.source===e.source)&&e.source!==je.Source.Unknown&&this.log.info("publishing a second track with the same source: ".concat(e.source),wn(e)),n.stopMicTrackOnMute&&eu(e)&&(e.stopOnMute=!0),e.source===je.Source.ScreenShare&&Vv()&&(n.simulcast=!1),n.videoCodec==="av1"&&!T8e()&&(n.videoCodec=void 0),n.videoCodec==="vp9"&&!C8e()&&(n.videoCodec=void 0),n.videoCodec===void 0&&(n.videoCodec=r3),this.enabledPublishVideoCodecs.length>0&&(this.enabledPublishVideoCodecs.some(M=>n.videoCodec===O_(M.mime))||(n.videoCodec=O_(this.enabledPublishVideoCodecs[0].mime)));const m=n.videoCodec;e.on(Qe.Muted,this.onTrackMuted),e.on(Qe.Unmuted,this.onTrackUnmuted),e.on(Qe.Ended,this.handleTrackEnded),e.on(Qe.UpstreamPaused,this.onTrackUpstreamPaused),e.on(Qe.UpstreamResumed,this.onTrackUpstreamResumed),e.on(Qe.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate);const g=[],v=!(!((i=n.dtx)!==null&&i!==void 0)||i),_=e.getSourceTrackSettings();_.autoGainControl&&g.push(ls.TF_AUTO_GAIN_CONTROL),_.echoCancellation&&g.push(ls.TF_ECHO_CANCELLATION),_.noiseSuppression&&g.push(ls.TF_NOISE_SUPPRESSION),_.channelCount&&_.channelCount>1&&g.push(ls.TF_STEREO),v&&g.push(ls.TF_NO_DTX),$u(e)&&e.hasPreConnectBuffer&&g.push(ls.TF_PRECONNECT_BUFFER);const b=new Uw({cid:e.mediaStreamTrack.id,name:n.name,type:je.kindToProto(e.kind),muted:e.isMuted,source:je.sourceToProto(e.source),disableDtx:v,encryption:this.encryptionType,stereo:r,disableRed:this.isE2EEEnabled||!(!((s=n.red)!==null&&s!==void 0)||s),stream:n==null?void 0:n.stream,backupCodecPolicy:n==null?void 0:n.backupCodecPolicy,audioFeatures:g});let x;if(e.kind===je.Kind.Video){let M={width:0,height:0};try{M=yield e.waitForDimensions()}catch{const R=(o=(a=this.roomOptions.videoCaptureDefaults)===null||a===void 0?void 0:a.resolution)!==null&&o!==void 0?o:zw.h720.resolution;M={width:R.width,height:R.height},this.log.error("could not determine track dimensions, using defaults",Object.assign(Object.assign({},wn(e)),{dims:M}))}b.width=M.width,b.height=M.height,Bu(e)&&(ql(m)&&(e.source===je.Source.ScreenShare&&(n.scalabilityMode="L1T3","contentHint"in e.mediaStreamTrack&&(e.mediaStreamTrack.contentHint="motion",this.log.debug("forcing contentHint to motion for screenshare with SVC codecs",wn(e)))),n.scalabilityMode=(l=n.scalabilityMode)!==null&&l!==void 0?l:"L3T3_KEY"),b.simulcastCodecs=[new FN({codec:m,cid:e.mediaStreamTrack.id})],n.backupCodec===!0&&(n.backupCodec={codec:r3}),n.backupCodec&&m!==n.backupCodec.codec&&b.encryption===yr.NONE&&(this.roomOptions.dynacast||(this.roomOptions.dynacast=!0),b.simulcastCodecs.push(new FN({codec:n.backupCodec.codec,cid:""})))),x=SS(e.source===je.Source.ScreenShare,b.width,b.height,n),b.layers=yz(b.width,b.height,x,ql(n.videoCodec))}else e.kind===je.Kind.Audio&&(x=[{maxBitrate:(c=n.audioPreset)===null||c===void 0?void 0:c.maxBitrate,priority:(d=(u=n.audioPreset)===null||u===void 0?void 0:u.priority)!==null&&d!==void 0?d:"high",networkPriority:(h=(f=n.audioPreset)===null||f===void 0?void 0:f.priority)!==null&&h!==void 0?h:"high"}]);if(!this.engine||this.engine.isClosed)throw new Yr("cannot publish track when not connected");const T=()=>ce(this,void 0,void 0,function*(){var M,B,R;if(!this.engine.pcManager)throw new Yr("pcManager is not ready");if(e.sender=yield this.engine.createSender(e,n,x),this.emit(tt.LocalSenderCreated,e.sender,e),Bu(e)&&((M=n.degradationPreference)!==null&&M!==void 0||(n.degradationPreference=LBe(e)),e.setDegradationPreference(n.degradationPreference)),x)if(Vv()&&e.kind===je.Kind.Audio){let j;for(const $ of this.engine.pcManager.publisher.getTransceivers())if($.sender===e.sender){j=$;break}j&&this.engine.pcManager.publisher.setTrackCodecBitrate({transceiver:j,codec:"opus",maxbr:!((B=x[0])===null||B===void 0)&&B.maxBitrate?x[0].maxBitrate/1e3:0}
789)}else e.codec&&ql(e.codec)&&(!((R=x[0])===null||R===void 0)&&R.maxBitrate)&&this.engine.pcManager.publisher.setTrackCodecBitrate({cid:b.cid,codec:e.codec,maxbr:x[0].maxBitrate/1e3});yield this.engine.negotiate()});let N;const A=new Promise((M,B)=>ce(this,void 0,void 0,function*(){var R;try{N=yield this.engine.addTrack(b),M(N)}catch(j){if(e.sender&&(!((R=this.engine.pcManager)===null||R===void 0)&&R.publisher)){try{this.engine.pcManager.publisher.removeTrack(e.sender)}catch($){this.log.error($)}yield this.engine.negotiate().catch($=>{this.log.error("failed to negotiate after removing track due to failed add track request",Object.assign(Object.assign({},wn(e)),{error:$}))})}B(j)}}));if(this.enabledPublishVideoCodecs.length>0)N=(yield Promise.all([A,T()]))[0];else{N=yield A;let M;if(N.codecs.forEach(B=>{M===void 0&&(M=B.mimeType)}),M&&e.kind===je.Kind.Video){const B=O_(M);B!==m&&(this.log.debug("falling back to server selected codec",Object.assign(Object.assign({},wn(e)),{codec:B})),n.videoCodec=B,x=SS(e.source===je.Source.ScreenShare,b.width,b.height,n))}yield T()}const L=new o3(e.kind,N,e,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});if(L.on(Qe.CpuConstrained,M=>this.onTrackCpuConstrained(M,L)),L.options=n,e.sid=N.sid,Bu(e)&&(e.publishOptions=n,b.width&&b.height&&(e.lastEncodedDimensions={width:b.width,height:b.height})),this.log.debug("publishing ".concat(e.kind," with encodings"),{encodings:x,trackInfo:N}),Bu(e)?e.startMonitor(this.engine.client):$u(e)&&e.startMonitor(),this.addTrackPublication(L),this.emit(tt.LocalTrackPublished,L),$u(e)&&N.audioFeatures.includes(ls.TF_PRECONNECT_BUFFER)){const M=e.getPreConnectBuffer(),B=e.getPreConnectBufferMimeType();this.on(tt.LocalTrackSubscribed,R=>{if(R.trackSid===N.sid){if(!e.hasPreConnectBuffer){this.log.warn("subscribe event came to late, buffer already closed");return}this.log.debug("finished recording preconnect buffer",wn(e)),e.stopPreConnectBuffer()}}),M&&new Promise((j,$)=>ce(this,void 0,void 0,function*(){var U,te,ne,le,V,q;try{this.log.debug("waiting for agent",wn(e));const J=setTimeout(()=>{$(new Error("agent not active within 10 seconds"))},1e4),Y=yield this.waitUntilActiveAgentPresent();clearTimeout(J),this.log.debug("sending preconnect buffer",wn(e));const de=yield this.streamBytes({name:"preconnect-buffer",mimeType:B,topic:"lk.agent.pre-connect-audio-buffer",destinationIdentities:[Y.identity],attributes:{trackId:L.trackSid,sampleRate:String((V=_.sampleRate)!==null&&V!==void 0?V:"48000"),channels:String((q=_.channelCount)!==null&&q!==void 0?q:"1")}});try{for(var se=!0,he=Vl(M),z;z=yield he.next(),U=z.done,!U;se=!0){le=z.value,se=!1;const fe=le;yield de.write(fe)}}catch(fe){te={error:fe}}finally{try{!se&&!U&&(ne=he.return)&&(yield ne.call(he))}finally{if(te)throw te.error}}yield de.close(),j()}catch(J){$(J)}})).then(()=>{this.log.debug("preconnect buffer sent successfully",wn(e))}).catch(j=>{this.log.error("error sending preconnect buffer",Object.assign(Object.assign({},wn(e)),{error:j}))})}return L})}get isLocal(){return!0}publishAdditionalCodecForTrack(e,n,r){return ce(this,void 0,void 0,function*(){var i;if(this.encryptionType!==yr.NONE)return;let s;if(this.trackPublications.forEach(h=>{h.track&&h.track===e&&(s=h)}),!s)throw new td("track is not published");if(!Bu(e))throw new td("track is not a video track");const a=Object.assign(Object.assign({},(i=this.roomOptions)===null||i===void 0?void 0:i.publishDefaults),r),o=pne(e,n,a);if(!o){this.log.info("backup codec has been disabled, ignoring request to add additional codec for track",wn(e));return}const l=e.addSimulcastTrack(n,o);if(!l)return;const c=new Uw({cid:l.mediaStreamTrack.id,type:je.kindToProto(e.kind),muted:e.isMuted,source:je.sourceToProto(e.source),sid:e.sid,simulcastCodecs:[{codec:a.videoCodec,cid:l.mediaStreamTrack.id}]});if(c.layers=yz(c.width,c.height,o),!this.engine||this.engine.isClosed)throw new Yr("cannot publish track when not connected");const u=()=>ce(this,void 0,void 0,function*(){yield this.engine.createSimulcastSender(e,l,a,o),yield this.engine.negotiate()}),f=(yield Promise.all([this.engine.addTrack(c),u()]))[0];this.log.debug("published ".concat(n," for track ").concat(e.sid),{encodings:o,trackInfo:f})})}unpublishTrack(e,n){return ce(this,void 0,void 0,function*(){var r,i;if(hv(e)){const c=this.pendingPublishPromises.get(e);c&&(this.log.debug("awaiting publish promise before attempting to unpublish",wn(e)),yield c)}const s=this.getPublicationForTrack(e),a=s?wn(s):void 0;if(this.log.info("unpublishing track",a),!s||!s.track){this.log.warn("track was not unpublished because no publication was found",a);return}e=s.track,e.off(Qe.Muted,this.onTrackMuted),e.off(Qe.Unmuted,this.onTrackUnmuted),e.off(Qe.Ended,this.handleTrackEnded),e.off(Qe.UpstreamPaused,this.onTrackUpstreamPaused),e.off(Qe.UpstreamResumed,this.onTrackUpstreamResumed),e.off(Qe.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate),n===void 0&&(n=(i=(r=this.roomOptions)===null||r===void 0?void 0:r.stopLocalTrackOnUnpublish)!==null&&i!==void 0?i:!0),n?e.stop():e.stopMonitor();let o=!1;const l=e.sender;if(e.sender=void 0,this.engine.pcManager&&this.engine.pcManager.currentState<Qr.FAILED&&l)try{for(const c of this.engine.pcManager.publisher.getTransceivers())c.sender===l&&(c.direction="inactive",o=!0);try{o=this.engine.removeTrack(l)}catch(c){this.log.warn(c),o=!0}if(Bu(e)){for(const[,c]of e.simulcastCodecs)if(c.sender){try{o=this.engine.removeTrack(c.sender)}catch(u){this.log.warn(u),o=!0}
vendor: 4,503 bytes, line 789
789c.sender=void 0}e.simulcastCodecs.clear()}}catch(c){this.log.warn("failed to unpublish track",Object.assign(Object.assign({},a),{error:c}))}switch(this.trackPublications.delete(s.trackSid),s.kind){case je.Kind.Audio:this.audioTrackPublications.delete(s.trackSid);break;case je.Kind.Video:this.videoTrackPublications.delete(s.trackSid);break}return this.emit(tt.LocalTrackUnpublished,s),s.setTrack(void 0),o&&(yield this.engine.negotiate()),s})}unpublishTracks(e){return ce(this,void 0,void 0,function*(){return(yield Promise.all(e.map(r=>this.unpublishTrack(r)))).filter(r=>!!r)})}republishAllTracks(e){return ce(this,arguments,void 0,function(n){var r=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){r.republishPromise&&(yield r.republishPromise),r.republishPromise=new Xs((s,a)=>ce(r,void 0,void 0,function*(){try{const o=[];this.trackPublications.forEach(l=>{l.track&&(n&&(l.options=Object.assign(Object.assign({},l.options),n)),o.push(l))}),yield Promise.all(o.map(l=>ce(this,void 0,void 0,function*(){const c=l.track;yield this.unpublishTrack(c,!1),i&&!c.isMuted&&c.source!==je.Source.ScreenShare&&c.source!==je.Source.ScreenShareAudio&&($u(c)||Bu(c))&&!c.isUserProvided&&(this.log.debug("restarting existing track",{track:l.trackSid}),yield c.restartTrack()),yield this.publishOrRepublishTrack(c,l.options,!0)}))),s()}catch(o){o instanceof Error?a(o):a(new Error(String(o)))}finally{this.republishPromise=void 0}})),yield r.republishPromise}()})}publishData(e){return ce(this,arguments,void 0,function(n){var r=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){const s=i.reliable?gn.RELIABLE:gn.LOSSY,a=i.reliable?yp.RELIABLE:yp.LOSSY,o=i.destinationIdentities,l=i.topic;let c=new xO({participantIdentity:r.identity,payload:n,destinationIdentities:o,topic:l});const u=new _a({kind:a,value:{case:"user",value:c}});yield r.engine.sendDataPacket(u,s)}()})}publishDtmf(e,n){return ce(this,void 0,void 0,function*(){const r=new _a({kind:yp.RELIABLE,value:{case:"sipDtmf",value:new Qee({code:e,digit:n})}});yield this.engine.sendDataPacket(r,gn.RELIABLE)})}sendChatMessage(e,n){return ce(this,void 0,void 0,function*(){const r={id:crypto.randomUUID(),message:e,timestamp:Date.now(),attachedFiles:n==null?void 0:n.attachments},i=new _a({value:{case:"chatMessage",value:new vS(Object.assign(Object.assign({},r),{timestamp:Gr.parse(r.timestamp)}))}});return yield this.engine.sendDataPacket(i,gn.RELIABLE),this.emit(tt.ChatMessage,r),r})}editChatMessage(e,n){return ce(this,void 0,void 0,function*(){const r=Object.assign(Object.assign({},n),{message:e,editTimestamp:Date.now()}),i=new _a({value:{case:"chatMessage",value:new vS(Object.assign(Object.assign({},r),{timestamp:Gr.parse(r.timestamp),editTimestamp:Gr.parse(r.editTimestamp)}))}});return yield this.engine.sendDataPacket(i,gn.RELIABLE),this.emit(tt.ChatMessage,r),r})}sendText(e,n){return ce(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.sendText(e,n)})}streamText(e){return ce(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.streamText(e)})}sendFile(e,n){return ce(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.sendFile(e,n)})}streamBytes(e){return ce(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.streamBytes(e)})}performRpc(e){let{destinationIdentity:n,method:r,payload:i,responseTimeout:s=15e3}=e;const a=7e3,o=a+1e3;return new Xs((l,c)=>ce(this,void 0,void 0,function*(){var u,d,f,h;if(HO(i)>hne){c(gi.builtIn("REQUEST_PAYLOAD_TOO_LARGE"));return}if(!((d=(u=this.engine.latestJoinResponse)===null||u===void 0?void 0:u.serverInfo)===null||d===void 0)&&d.version&&au((h=(f=this.engine.latestJoinResponse)===null||f===void 0?void 0:f.serverInfo)===null||h===void 0?void 0:h.version,"1.8.0")<0){c(gi.builtIn("UNSUPPORTED_SERVER"));return}const p=Math.max(s,o),m=crypto.randomUUID();yield this.publishRpcRequest(n,m,r,i,p);const g=setTimeout(()=>{this.pendingAcks.delete(m),c(gi.builtIn("CONNECTION_TIMEOUT")),this.pendingResponses.delete(m),clearTimeout(v)},a);this.pendingAcks.set(m,{resolve:()=>{clearTimeout(g)},participantIdentity:n});const v=setTimeout(()=>{this.pendingResponses.delete(m),c(gi.builtIn("RESPONSE_TIMEOUT"))},s);this.pendingResponses.set(m,{resolve:(_,b)=>{clearTimeout(v),this.pendingAcks.has(m)&&(this.log.warn("RPC response received before ack",m),this.pendingAcks.delete(m),clearTimeout(g)),b?c(b):l(_??"")},participantIdentity:n})}))}
789registerRpcMethod(e,n){this.rpcHandlers.has(e)&&this.log.warn("you're overriding the RPC handler for method ".concat(e,", in the future this will throw an error")),this.rpcHandlers.set(e,n)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}setTrackSubscriptionPermissions(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];this.participantTrackPermissions=n,this.allParticipantsAllowedToSubscribe=e,this.engine.client.isDisconnected||this.updateTrackSubscriptionPermissions()}handleIncomingRpcAck(e){const n=this.pendingAcks.get(e);n?(n.resolve(),this.pendingAcks.delete(e)):console.error("Ack received for unexpected RPC request",e)}handleIncomingRpcResponse(e,n,r){const i=this.pendingResponses.get(e);i?(i.resolve(n,r),this.pendingResponses.delete(e)):console.error("Response received for unexpected RPC request",e)}publishRpcRequest(e,n,r,i,s){return ce(this,void 0,void 0,function*(){const a=new _a({destinationIdentities:[e],kind:yp.RELIABLE,value:{case:"rpcRequest",value:new kO({id:n,method:r,payload:i,responseTimeoutMs:s,version:1})}});yield this.engine.sendDataPacket(a,gn.RELIABLE)})}handleParticipantDisconnected(e){for(const[n,{participantIdentity:r}]of this.pendingAcks)r===e&&this.pendingAcks.delete(n);for(const[n,{participantIdentity:r,resolve:i}]of this.pendingResponses)r===e&&(i(null,gi.builtIn("RECIPIENT_DISCONNECTED")),this.pendingResponses.delete(n))}setEnabledPublishCodecs(e){this.enabledPublishVideoCodecs=e.filter(n=>n.mime.split("/")[0].toLowerCase()==="video")}updateInfo(e){return super.updateInfo(e)?(e.tracks.forEach(n=>{var r,i;const s=this.trackPublications.get(n.sid);if(s){const a=s.isMuted||((i=(r=s.track)===null||r===void 0?void 0:r.isUpstreamPaused)!==null&&i!==void 0?i:!1);a!==n.muted&&(this.log.debug("updating server mute state after reconcile",Object.assign(Object.assign({},wn(s)),{mutedOnServer:a})),this.engine.client.sendMuteTrack(n.sid,a))}}),!0):!1}setActiveAgent(e){var n,r,i,s;this.firstActiveAgent=e,e&&!this.firstActiveAgent&&(this.firstActiveAgent=e),e?(r=(n=this.activeAgentFuture)===null||n===void 0?void 0:n.resolve)===null||r===void 0||r.call(n,e):(s=(i=this.activeAgentFuture)===null||i===void 0?void 0:i.reject)===null||s===void 0||s.call(i,new Error("Agent disconnected")),this.activeAgentFuture=void 0}waitUntilActiveAgentPresent(){return this.firstActiveAgent?Promise.resolve(this.firstActiveAgent):(this.activeAgentFuture||(this.activeAgentFuture=new Cs),this.activeAgentFuture.promise)}getPublicationForTrack(e){let n;return this.trackPublications.forEach(r=>{const i=r.track;i&&(e instanceof MediaStreamTrack?($u(i)||Bu(i))&&i.mediaStreamTrack===e&&(n=r):e===i&&(n=r))}),n}waitForPendingPublicationOfSource(e){return ce(this,void 0,void 0,function*(){const r=Date.now();for(;Date.now()<r+1e4;){const i=Array.from(this.pendingPublishPromises.entries()).find(s=>{let[a]=s;return a.source===e});if(i)return i[1];yield Zs(20)}})}publishDataTrack(e){return ce(this,void 0,void 0,function*(){const n=new pC(e,this.roomOutgoingDataTrackManager);return yield n.publish(),n})}}class Oz extends DOMException{constructor(e,n){super(e,"AbortError"),this.reason=n}}class pUe extends Map{constructor(){super(...arguments),this.pending=new Map}set(e,n){var r,i;super.set(e,n);const s=(r=this.pending)===null||r===void 0?void 0:r.get(e);if(s){for(const a of s)a.isResolved||(i=a.resolve)===null||i===void 0||i.call(a,n);this.pending.delete(e)}return this}get[Symbol.toStringTag](){return"DeferrableMap"}getDeferred(e,n){return ce(this,void 0,void 0,function*(){const r=this.get(e);if(typeof r<"u")return r;if(n!=null&&n.aborted)throw new Oz("The operation was aborted.",n.reason);const i=new Cs(void 0,()=>{const a=this.pending.get(e);if(!a)return;const o=a.indexOf(i);o!==-1&&a.splice(o,1),a.length===0&&this.pending.delete(e)}),s=this.pending.get(e);if(s?s.push(i):this.pending.set(e,[i]),n){const a=()=>{var o;i.isResolved||(o=i.reject)===null||o===void 0||o.call(i,new Oz("The operation was aborted.",n.reason))};n.addEventListener("abort",a,{once:!0}),i.promise.finally(()=>{n.removeEventListener("abort",a)})}return i.promise})}}class mUe extends Yu{constructor(e,n,r,i){super(e,n.sid,n.name,i),this.track=void 0,this.allowed=!0,this.requestedDisabled=void 0,this.visible=!0,this.handleEnded=s=>
789{this.setTrack(void 0),this.emit(Qe.Ended,s)},this.handleVisibilityChange=s=>{this.log.debug("adaptivestream video visibility ".concat(this.trackSid,", visible=").concat(s),this.logContext),this.visible=s,this.emitTrackUpdate()},this.handleVideoDimensionsChange=s=>{this.log.debug("adaptivestream video dimensions ".concat(s.width,"x").concat(s.height),this.logContext),this.videoDimensionsAdaptiveStream=s,this.emitTrackUpdate()},this.subscribed=r,this.updateInfo(n)}setSubscribed(e){const n=this.subscriptionStatus,r=this.permissionStatus;this.subscribed=e,e&&(this.allowed=!0);const i=new aC({trackSids:[this.trackSid],subscribe:this.subscribed,participantTracks:[new ete({participantSid:"",trackSids:[this.trackSid]})]});this.emit(Qe.UpdateSubscription,i),this.emitSubscriptionUpdateIfChanged(n),this.emitPermissionUpdateIfChanged(r)}get subscriptionStatus(){return this.subscribed===!1?Yu.SubscriptionStatus.Unsubscribed:super.isSubscribed?Yu.SubscriptionStatus.Subscribed:Yu.SubscriptionStatus.Desired}get permissionStatus(){return this.allowed?Yu.PermissionStatus.Allowed:Yu.PermissionStatus.NotAllowed}get isSubscribed(){return this.subscribed===!1?!1:super.isSubscribed}get isDesired(){return this.subscribed!==!1}get isEnabled(){return this.requestedDisabled!==void 0?!this.requestedDisabled:this.isAdaptiveStream?this.visible:!0}get isLocal(){return!1}setEnabled(e){!this.isManualOperationAllowed()||this.requestedDisabled===!e||(this.requestedDisabled=!e,this.emitTrackUpdate())}setVideoQuality(e){!this.isManualOperationAllowed()||this.requestedMaxQuality===e||(this.requestedMaxQuality=e,this.requestedVideoDimensions=void 0,this.emitTrackUpdate())}setVideoDimensions(e){var n,r;this.isManualOperationAllowed()&&(((n=this.requestedVideoDimensions)===null||n===void 0?void 0:n.width)===e.width&&((r=this.requestedVideoDimensions)===null||r===void 0?void 0:r.height)===e.height||(ZE(this.track)&&(this.requestedVideoDimensions=e),this.requestedMaxQuality=void 0,this.emitTrackUpdate()))}setVideoFPS(e){this.isManualOperationAllowed()&&ZE(this.track)&&this.fps!==e&&(this.fps=e,this.emitTrackUpdate())}get videoQuality(){var e;return(e=this.requestedMaxQuality)!==null&&e!==void 0?e:So.HIGH}setTrack(e){const n=this.subscriptionStatus,r=this.permissionStatus,i=this.track;i!==e&&(i&&(i.off(Qe.VideoDimensionsChanged,this.handleVideoDimensionsChange),i.off(Qe.VisibilityChanged,this.handleVisibilityChange),i.off(Qe.Ended,this.handleEnded),i.detach(),i.stopMonitor(),this.emit(Qe.Unsubscribed,i)),super.setTrack(e),e&&(e.sid=this.trackSid,e.on(Qe.VideoDimensionsChanged,this.handleVideoDimensionsChange),e.on(Qe.VisibilityChanged,this.handleVisibilityChange),e.on(Qe.Ended,this.handleEnded),this.emit(Qe.Subscribed,e)),this.emitPermissionUpdateIfChanged(r),this.emitSubscriptionUpdateIfChanged(n))}setAllowed(e){const n=this.subscriptionStatus,r=this.permissionStatus;this.allowed=e,this.emitPermissionUpdateIfChanged(r),this.emitSubscriptionUpdateIfChanged(n)}setSubscriptionError(e){this.emit(Qe.SubscriptionFailed,e)}updateInfo(e){super.updateInfo(e);const n=this.metadataMuted;this.metadataMuted=e.muted,this.track?this.track.setMuted(e.muted):n!==e.muted&&this.emit(e.muted?Qe.Muted:Qe.Unmuted)}emitSubscriptionUpdateIfChanged(e){const n=this.subscriptionStatus;e!==n&&this.emit(Qe.SubscriptionStatusChanged,n,e)}emitPermissionUpdateIfChanged(e){this.permissionStatus!==e&&this.emit(Qe.SubscriptionPermissionChanged,this.permissionStatus,e)}isManualOperationAllowed(){return this.isDesired?!0:(this.log.warn("cannot update track settings when not subscribed",this.logContext),!1)}get isAdaptiveStream(){return ZE(this.track)&&this.track.isAdaptiveStream}emitTrackUpdate(){const e=new dte({trackSids:[this.trackSid],disabled:!this.isEnabled,fps:this.fps});if(this.kind===je.Kind.Video){let n=this.requestedVideoDimensions;if(this.videoDimensionsAdaptiveStream!==void 0)if(n)H7(this.videoDimensionsAdaptiveStream,n)&&(this.log.debug("using adaptive stream dimensions instead of requested",Object.assign(Object.assign({},this.logContext),this.videoDimensionsAdaptiveStream)),n=this.videoDimensionsAdaptiveStream);else if(this.requestedMaxQuality!==void 0&&this.trackInfo){const r=b8e(this.trackInfo,this.requestedMaxQuality);r&&H7(this.videoDimensionsAdaptiveStream,r)&&(this.log.debug("using adaptive stream dimensions instead of max quality layer",Object.assign(Object.assign({},this.logContext),this.videoDimensionsAdaptiveStream)),n=this.videoDimensionsAdaptiveStream)}else this.log.debug("using adaptive stream dimensions",Object.assign(Object.assign({},this.logContext),this.videoDimensionsAdaptiveStream)),n=this.videoDimensionsAdaptiveStream;n?(e.width=Math.ceil(n.width),e.height=Math.ceil(n.height)):this.requestedMaxQuality!==void 0?(this.log.debug("using requested max quality",Object.assign(Object.assign({},this.logContext),{quality:this.requestedMaxQuality})),e.quality=this.requestedMaxQuality):(this.log.debug("using default qual
789ity",Object.assign(Object.assign({},this.logContext),{quality:So.HIGH})),e.quality=So.HIGH)}this.emit(Qe.UpdateSettings,e)}}class ES extends Ane{static fromParticipantInfo(e,n,r,i){return new ES(e,n.sid,n.identity,n.name,n.metadata,n.attributes,r,n.kind,n.dataTracks.map(s=>{const a=xS.from(s);return new Tne(a,i,{publisherIdentity:n.identity})}))}get logContext(){return Object.assign(Object.assign({},super.logContext),{remoteParticipantID:this.sid,remoteParticipant:this.identity})}constructor(e,n,r,i,s,a,o){let l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:Bw.STANDARD,c=arguments.length>8&&arguments[8]!==void 0?arguments[8]:[];super(n,r||"",i,s,a,o,l),this.signalClient=e,this.trackPublications=new Map,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.dataTracks=new pUe(c.map(u=>[u.info.name,u])),this.volumeMap=new Map}addTrackPublication(e){super.addTrackPublication(e),e.on(Qe.UpdateSettings,n=>{this.log.debug("send update settings",Object.assign(Object.assign(Object.assign({},this.logContext),wn(e)),{settings:n})),this.signalClient.sendUpdateTrackSettings(n)}),e.on(Qe.UpdateSubscription,n=>{n.participantTracks.forEach(r=>{r.participantSid=this.sid}),this.signalClient.sendUpdateSubscription(n)}),e.on(Qe.SubscriptionPermissionChanged,n=>{this.emit(tt.TrackSubscriptionPermissionChanged,e,n)}),e.on(Qe.SubscriptionStatusChanged,n=>{this.emit(tt.TrackSubscriptionStatusChanged,e,n)}),e.on(Qe.Subscribed,n=>{this.emit(tt.TrackSubscribed,n,e)}),e.on(Qe.Unsubscribed,n=>{this.emit(tt.TrackUnsubscribed,n,e)}),e.on(Qe.SubscriptionFailed,n=>{this.emit(tt.TrackSubscriptionFailed,e.trackSid,n)})}getTrackPublication(e){const n=super.getTrackPublication(e);if(n)return n}getTrackPublicationByName(e){const n=super.getTrackPublicationByName(e);if(n)return n}setVolume(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:je.Source.Microphone;this.volumeMap.set(n,e);const r=this.getTrackPublication(n);r&&r.track&&r.track.setVolume(e)}getVolume(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:je.Source.Microphone;const n=this.getTrackPublication(e);return n&&n.track?n.track.getVolume():this.volumeMap.get(e)}addSubscribedMediaTrack(e,n,r,i,s,a){let o=this.getTrackPublicationBySid(n);if(o||n.startsWith("TR")||this.trackPublications.forEach(u=>{!o&&e.kind===u.kind.toString()&&(o=u)}),!o){if(a===0){this.log.error("could not find published track",Object.assign(Object.assign({},this.logContext),{trackSid:n})),this.emit(tt.TrackSubscriptionFailed,n);return}a===void 0&&(a=20),setTimeout(()=>{this.addSubscribedMediaTrack(e,n,r,i,s,a-1)},150);return}if(e.readyState==="ended"){this.log.error("unable to subscribe because MediaStreamTrack is ended. Do not call MediaStreamTrack.stop()",Object.assign(Object.assign({},this.logContext),wn(o))),this.emit(tt.TrackSubscriptionFailed,n);return}const l=e.kind==="video";let c;return l?c=new lUe(e,n,i,s):c=new oUe(e,n,i,this.audioContext,this.audioOutput),c.source=o.source,c.isMuted=o.isMuted,c.setMediaStream(r),c.start(),o.setTrack(c),this.volumeMap.has(o.source)&&e3(c)&&eu(c)&&c.setVolume(this.volumeMap.get(o.source)),o}get hasMetadata(){return!!this.participantInfo}getTrackPublicationBySid(e){return this.trackPublications.get(e)}updateInfo(e){if(!super.updateInfo(e))return!1;const n=new Map,r=new Map;return e.tracks.forEach(i=>{var s,a;let o=this.getTrackPublicationBySid(i.sid);if(o)o.updateInfo(i);else{const l=je.kindFromProto(i.type);if(!l)return;o=new mUe(l,i,(s=this.signalClient.connectOptions)===null||s===void 0?void 0:s.autoSubscribe,{loggerContextCb:()=>this.logContext,loggerName:(a=this.loggerOptions)===null||a===void 0?void 0:a.loggerName}),o.updateInfo(i),r.set(i.sid,o);const c=Array.from(this.trackPublications.values()).find(u=>u.source===(o==null?void 0:o.source));c&&o.source!==je.Source.Unknown&&this.log.debug("received a second track publication for ".concat(this.identity," with the same source: ").concat(o.source),Object.assign(Object.assign({},this.logContext),{oldTrack:wn(c),newTrack:wn(o)})),this.addTrackPublication(o)}n.set(i.sid,o)}),this.trackPublications.forEach(i=>
789{n.has(i.trackSid)||(this.log.trace("detected removed track on remote participant, unpublishing",Object.assign(Object.assign({},this.logContext),wn(i))),this.unpublishTrack(i.trackSid,!0))}),r.forEach(i=>{this.emit(tt.TrackPublished,i)}),!0}unpublishTrack(e,n){const r=this.trackPublications.get(e);if(!r)return;const{track:i}=r;switch(i&&(i.stop(),r.setTrack(void 0)),this.trackPublications.delete(e),r.kind){case je.Kind.Audio:this.audioTrackPublications.delete(e);break;case je.Kind.Video:this.videoTrackPublications.delete(e);break}n&&this.emit(tt.TrackUnpublished,r)}setAudioOutput(e){return ce(this,void 0,void 0,function*(){this.audioOutput=e;const n=[];this.audioTrackPublications.forEach(r=>{var i;eu(r.track)&&e3(r.track)&&n.push(r.track.setSinkId((i=e.deviceId)!==null&&i!==void 0?i:"default"))}),yield Promise.all(n)})}addRemoteDataTrack(e){this.dataTracks.set(e.info.name,e)}removeRemoteDataTrack(e){for(const[n,r]of this.dataTracks.entries())e===r.info.sid&&this.dataTracks.delete(n)}emit(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return this.log.trace("participant event",Object.assign(Object.assign({},this.logContext),{event:e,args:r})),super.emit(e,...r)}}var Bn;(function(t){t.Disconnected="disconnected",t.Connecting="connecting",t.Connected="connected",t.Reconnecting="reconnecting",t.SignalReconnecting="signalReconnecting"})(Bn||(Bn={}));const gUe=4*1e3;class Hv extends al.EventEmitter{get hasE2EESetup(){return this.e2eeManager!==void 0}constructor(e){var n,r,i,s,a,o,l;if(super(),n=this,this.state=Bn.Disconnected,this.activeSpeakers=[],this.isE2EEEnabled=!1,this.audioEnabled=!0,this.e2eeStateMutex=new As,this.isVideoPlaybackBlocked=!1,this.log=mn,this.bufferedEvents=[],this.isResuming=!1,this.rpcHandlers=new Map,this.connect=(c,u,d)=>ce(this,void 0,void 0,function*(){var f;if(!E8e())throw su()?Error("WebRTC isn't detected, have you called registerGlobals?"):Error("LiveKit doesn't seem to be supported on this browser. Try to update your browser and make sure no browser extensions are disabling webRTC.");const h=yield this.disconnectLock.lock();if(this.state===Bn.Connected)return this.log.info("already connected to room ".concat(this.name)),h(),Promise.resolve();if(this.connectFuture)return h(),this.connectFuture.promise;this.setAndEmitConnectionState(Bn.Connecting),((f=this.regionUrlProvider)===null||f===void 0?void 0:f.getServerUrl().toString())!==lne(c)&&(this.regionUrl=void 0,this.regionUrlProvider=void 0),qv(new URL(c))&&(this.regionUrlProvider===void 0?this.regionUrlProvider=new In(c,u):this.regionUrlProvider.updateToken(u),this.regionUrlProvider.fetchRegionSettings().then(g=>{var v;(v=this.regionUrlProvider)===null||v===void 0||v.setServerReportedRegions(g)}).catch(g=>{this.log.warn("could not fetch region settings",{error:g})}));const p=(g,v,_)=>ce(this,void 0,void 0,function*(){var b,x;this.abortController&&this.abortController.abort();const T=new AbortController;this.abortController=T,h==null||h();try{if(yield fv.getInstance().getBackOffPromise(c),T.signal.aborted)throw Ot.cancelled("Connection attempt aborted");yield this.attemptConnection(_??c,u,d,T),this.abortController=void 0,g()}catch(N){if(this.regionUrlProvider&&N instanceof Ot&&N.reason!==vr.Cancelled&&N.reason!==vr.NotAllowed){let A=null;try{this.log.debug("Fetching next region"),A=yield this.regionUrlProvider.getNextBestRegionUrl((b=this.abortController)===null||b===void 0?void 0:b.signal)}catch(L){if(L instanceof Ot&&(L.status===401||L.reason===vr.Cancelled)){this.handleDisconnect(this.options.stopLocalTrackOnUnpublish),v(L);return}}[vr.InternalError,vr.ServerUnreachable,vr.Timeout].includes(N.reason)&&(this.log.debug("Adding failed connection attempt to back off"),fv.getInstance().addFailedConnectionAttempt(c)),A&&!(!((x=this.abortController)===null||x===void 0)&&x.signal.aborted)?(this.log.info("Initial connection failed with ConnectionError: ".concat(N.message,". Retrying with another region: ").concat(A)),this.recreateEngine(!0),yield p(g,v,A)):(this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,ez(N)),v(N))}else{let A=Jl.UNKNOWN_REASON;N instanceof Ot&&(A=ez(N)),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,A),v(N)}}}),m=this.regionUrl;return this.regionUrl=void 0,this.connectFuture=new Cs((g,v)=>{p(g,v,m)},()=>{this.clearConnectionFutures()}),this.connectFuture.promise}),this.connectSignal=(c,u,d,f,h,p)=>ce(this,void 0,void 0,function*(){const{joinResponse:m,serverInfo:g}=yield d.join(c,u,{autoSubscribe:f.autoSubscribe,adaptiveStream:typeof h.adaptiveStream=="object"?!0:
789h.adaptiveStream,maxRetries:f.maxRetries,e2eeEnabled:!!this.e2eeManager,websocketTimeout:f.websocketTimeout},p.signal,!h.singlePeerConnection);if(this.serverInfo=g,!g.version)throw new u8e("unknown server version");return g.version==="0.15.1"&&this.options.dynacast&&(this.log.debug("disabling dynacast due to server version"),h.dynacast=!1),m}),this.applyJoinResponse=c=>{const u=c.participant;if(this.localParticipant.sid=u.sid,this.localParticipant.identity=u.identity,this.localParticipant.setEnabledPublishCodecs(c.enabledPublishCodecs),this.e2eeManager)try{this.e2eeManager.setSifTrailer(c.sifTrailer)}catch(d){this.log.error(d instanceof Error?d.message:"Could not set SifTrailer",{error:d})}this.handleParticipantUpdates([u,...c.otherParticipants]),c.room&&this.handleRoomUpdate(c.room)},this.attemptConnection=(c,u,d,f)=>ce(this,void 0,void 0,function*(){var h,p;this.state===Bn.Reconnecting||this.isResuming||!((h=this.engine)===null||h===void 0)&&h.pendingReconnect?(this.log.info("Reconnection attempt replaced by new connection attempt"),this.recreateEngine(!0)):this.maybeCreateEngine(),!((p=this.regionUrlProvider)===null||p===void 0)&&p.isCloud()&&this.engine.setRegionStrategy(this.createRegionStrategy()),this.acquireAudioContext(),this.connOptions=Object.assign(Object.assign({},GO),d),this.connOptions.rtcConfig&&(this.engine.rtcConfig=this.connOptions.rtcConfig),this.connOptions.peerConnectionTimeout&&(this.engine.peerConnectionTimeout=this.connOptions.peerConnectionTimeout);try{const m=yield this.connectSignal(c,u,this.engine,this.connOptions,this.options,f);this.applyJoinResponse(m),this.setupLocalParticipantEvents(),this.emit(Ve.SignalConnected)}catch(m){yield this.engine.close(),this.recreateEngine();const g=f.signal.aborted?Ot.cancelled("Signal connection aborted"):Ot.serverUnreachable("could not establish signal connection");throw m instanceof Error&&(g.message="".concat(g.message,": ").concat(m.message)),m instanceof Ot&&(g.reason=m.reason,g.status=m.status),this.log.debug("error trying to establish signal connection",{error:m}),g}if(f.signal.aborted)throw yield this.engine.close(),this.recreateEngine(),Ot.cancelled("Connection attempt aborted");try{yield this.engine.waitForPCInitialConnection(this.connOptions.peerConnectionTimeout,f)}catch(m){throw yield this.engine.close(),this.recreateEngine(),m}Wa()&&this.options.disconnectOnPageLeave&&(window.addEventListener("pagehide",this.onPageLeave),window.addEventListener("beforeunload",this.onPageLeave)),Wa()&&window.addEventListener("freeze",this.onPageLeave),this.setAndEmitConnectionState(Bn.Connected),this.emit(Ve.Connected),fv.getInstance().resetFailedConnectionAttempts(c),this.registerConnectionReconcile(),this.regionUrlProvider&&this.regionUrlProvider.notifyConnected()}),this.disconnect=function(){for(var c=arguments.length,u=new Array(c),d=0;d<c;d++)u[d]=arguments[d];return ce(n,[...u],void 0,function(){var f=this;let h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){var p,m,g;const v=yield f.disconnectLock.lock();try{if(f.state===Bn.Disconnected){f.log.debug("already disconnected");return}if(f.log.info("disconnect from room"),f.state===Bn.Connecting||f.state===Bn.Reconnecting||f.isResuming){const _="Abort connection attempt due to user initiated disconnect";f.log.warn(_),(p=f.abortController)===null||p===void 0||p.abort(_),(g=(m=f.connectFuture)===null||m===void 0?void 0:m.reject)===null||g===void 0||g.call(m,Ot.cancelled("Client initiated disconnect")),f.connectFuture=void 0}f.engine&&(f.engine.client.isDisconnected||(yield f.engine.client.sendLeave()),yield f.engine.close()),f.handleDisconnect(h,Jl.CLIENT_INITIATED),f.engine=void 0}finally{v()}}()})},this.onPageLeave=()=>ce(this,void 0,void 0,function*(){this.log.info("Page leave detected, disconnecting"),yield this.disconnect()}),this.startAudio=()=>ce(this,void 0,void 0,function*(){const c=[],u=Ca();if(u&&u.os==="iOS"){const d="livekit-dummy-audio-el";let f=document.getElementById(d);if(!f){f=document.createElement("audio"),f.id=d,f.autoplay=!0,f.hidden=!0;const h=QE();h.enabled=!0;const p=new MediaStream([h]);f.srcObject=p,document.addEventListener("visibilitychange",()=>{f&&(f.srcObject=document.hidden?null:p,document.hidden||(this.log.debug("page visible again, triggering startAudio to resume playback and update playback status"),this.startAudio()))}),document.body.append(f),this.once(Ve.Disconnected,()=>{f==null||f.remove(),f=null})}c.push(f)}
789this.remoteParticipants.forEach(d=>{d.audioTrackPublications.forEach(f=>{f.track&&f.track.attachedElements.forEach(h=>{c.push(h)})})});try{yield Promise.all([this.acquireAudioContext(),...c.map(d=>(d.muted=!1,d.play()))]),this.handleAudioPlaybackStarted()}catch(d){throw this.handleAudioPlaybackFailed(d),d}}),this.startVideo=()=>ce(this,void 0,void 0,function*(){const c=[];for(const u of this.remoteParticipants.values())u.videoTrackPublications.forEach(d=>{var f;(f=d.track)===null||f===void 0||f.attachedElements.forEach(h=>{c.includes(h)||c.push(h)})});yield Promise.all(c.map(u=>u.play())).then(()=>{this.handleVideoPlaybackStarted()}).catch(u=>{u.name==="NotAllowedError"?this.handleVideoPlaybackFailed():this.log.warn("Resuming video playback failed, make sure you call `startVideo` directly in a user gesture handler")})}),this.handleRestarting=()=>{this.clearConnectionReconcile(),this.isResuming=!1;for(const c of this.remoteParticipants.values())this.handleParticipantDisconnected(c.identity,c);this.setAndEmitConnectionState(Bn.Reconnecting)&&this.emit(Ve.Reconnecting)},this.handleRestarted=()=>{this.outgoingDataTrackManager.sfuWillRepublishTracks(),this.incomingDataTrackManager.resendSubscriptionUpdates()},this.handleSignalRestarted=c=>ce(this,void 0,void 0,function*(){this.log.debug("signal reconnected to server, region ".concat(c.serverRegion),{region:c.serverRegion}),this.bufferedEvents=[],this.applyJoinResponse(c);try{yield this.localParticipant.republishAllTracks(void 0,!0)}catch(u){this.log.error("error trying to re-publish tracks after reconnection",{error:u})}try{yield this.engine.waitForRestarted(),this.log.debug("fully reconnected to server",{region:c.serverRegion})}catch{return}this.setAndEmitConnectionState(Bn.Connected),this.emit(Ve.Reconnected),this.registerConnectionReconcile(),this.emitBufferedEvents()}),this.handleParticipantUpdates=c=>{var u;for(const f of c){if(f.identity===this.localParticipant.identity){this.localParticipant.updateInfo(f);continue}f.identity===""&&(f.identity=(u=this.sidToIdentity.get(f.sid))!==null&&u!==void 0?u:"");let h=this.remoteParticipants.get(f.identity);f.state===lv.DISCONNECTED?this.handleParticipantDisconnected(f.identity,h):h=this.getOrCreateParticipant(f.identity,f)}const d=new Map(c.filter(f=>f.identity!==this.localParticipant.identity).map(f=>[f.identity,f.dataTracks.map(h=>xS.from(h))]));this.incomingDataTrackManager.receiveSfuPublicationUpdates(d)},this.handleActiveSpeakersUpdate=c=>{const u=[],d={};c.forEach(f=>{if(d[f.sid]=!0,f.sid===this.localParticipant.sid)this.localParticipant.audioLevel=f.level,this.localParticipant.setIsSpeaking(!0),u.push(this.localParticipant);else{const h=this.getRemoteParticipantBySid(f.sid);h&&(h.audioLevel=f.level,h.setIsSpeaking(!0),u.push(h))}}),d[this.localParticipant.sid]||(this.localParticipant.audioLevel=0,this.localParticipant.setIsSpeaking(!1)),this.remoteParticipants.forEac
vendor: 4,254 bytes, line 789
789h(f=>{d[f.sid]||(f.audioLevel=0,f.setIsSpeaking(!1))}),this.activeSpeakers=u,this.emitWhenConnected(Ve.ActiveSpeakersChanged,u)},this.handleSpeakersChanged=c=>{const u=new Map;this.activeSpeakers.forEach(f=>{const h=this.remoteParticipants.get(f.identity);h&&h.sid!==f.sid||u.set(f.sid,f)}),c.forEach(f=>{let h=this.getRemoteParticipantBySid(f.sid);f.sid===this.localParticipant.sid&&(h=this.localParticipant),h&&(h.audioLevel=f.level,h.setIsSpeaking(f.active),f.active?u.set(f.sid,h):u.delete(f.sid))});const d=Array.from(u.values());d.sort((f,h)=>h.audioLevel-f.audioLevel),this.activeSpeakers=d,this.emitWhenConnected(Ve.ActiveSpeakersChanged,d)},this.handleStreamStateUpdate=c=>{c.streamStates.forEach(u=>{const d=this.getRemoteParticipantBySid(u.participantSid);if(!d)return;const f=d.getTrackPublicationBySid(u.trackSid);if(!f||!f.track)return;const h=je.streamStateFromProto(u.state);f.track.setStreamState(h),h!==f.track.streamState&&(d.emit(tt.TrackStreamStateChanged,f,f.track.streamState),this.emitWhenConnected(Ve.TrackStreamStateChanged,f,f.track.streamState,d))})},this.handleSubscriptionPermissionUpdate=c=>{const u=this.getRemoteParticipantBySid(c.participantSid);if(!u)return;const d=u.getTrackPublicationBySid(c.trackSid);d&&d.setAllowed(c.allowed)},this.handleSubscriptionError=c=>{const u=Array.from(this.remoteParticipants.values()).find(f=>f.trackPublications.has(c.trackSid));if(!u)return;const d=u.getTrackPublicationBySid(c.trackSid);d&&d.setSubscriptionError(c.err)},this.handleDataPacket=(c,u)=>{const d=this.remoteParticipants.get(c.participantIdentity);if(c.value.case==="user")this.handleUserPacket(d,c.value.value,c.kind,u);else if(c.value.case==="transcription")this.handleTranscription(d,c.value.value);else if(c.value.case==="sipDtmf")this.handleSipDtmf(d,c.value.value);else if(c.value.case==="chatMessage")this.handleChatMessage(d,c.value.value);else if(c.value.case==="metrics")this.handleMetrics(c.value.value,d);else if(c.value.case==="streamHeader"||c.value.case==="streamChunk"||c.value.case==="streamTrailer")this.handleDataStream(c,u);else if(c.value.case==="rpcRequest"){const f=c.value.value;this.handleIncomingRpcRequest(c.participantIdentity,f.id,f.method,f.payload,f.responseTimeoutMs,f.version)}},this.handleUserPacket=(c,u,d,f)=>{this.emit(Ve.DataReceived,u.payload,c,d,u.topic,f),c==null||c.emit(tt.DataReceived,u.payload,d,f)},this.handleSipDtmf=(c,u)=>{this.emit(Ve.SipDTMFReceived,u,c),c==null||c.emit(tt.SipDTMFReceived,u)},this.handleTranscription=(c,u)=>{const d=u.transcribedParticipantIdentity===this.localParticipant.identity?this.localParticipant:this.getParticipantByIdentity(u.transcribedParticipantIdentity),f=d==null?void 0:d.trackPublications.get(u.trackId),h=D8e(u,this.transcriptionReceivedTimes);f==null||f.emit(Qe.TranscriptionReceived,h),d==null||d.emit(tt.TranscriptionReceived,h,f),this.emit(Ve.TranscriptionReceived,h,d,f)},this.handleChatMessage=(c,u)=>{const d=F8e(u);this.emit(Ve.ChatMessage,d,c)},this.handleMetrics=(c,u)=>{this.emit(Ve.MetricsReceived,c,u)},this.handleDataStream=(c,u)=>{this.incomingDataStreamManager.handleDataStreamPacket(c,u)},this.bufferedSegments=new Map,this.handleAudioPlaybackStarted=()=>{this.canPlaybackAudio||(this.audioEnabled=!0,this.emit(Ve.AudioPlaybackStatusChanged,!0))},this.handleAudioPlaybackFailed=c=>{this.log.warn("could not playback audio",{error:c}),this.canPlaybackAudio&&(this.audioEnabled=!1,this.emit(Ve.AudioPlaybackStatusChanged,!1))},this.handleVideoPlaybackStarted=()=>{this.isVideoPlaybackBlocked&&(this.isVideoPlaybackBlocked=!1,this.emit(Ve.VideoPlaybackStatusChanged,!0))},this.handleVideoPlaybackFailed=()=>{this.isVideoPlaybackBlocked||(this.isVideoPlaybackBlocked=!0,this.emit(Ve.VideoPlaybackStatusChanged,!1))},this.handleDeviceChange=()=>ce(this,void 0,void 0,function*(){var c;((c=Ca())===null||c===void 0?void 0:c.os)!=="iOS"&&(yield this.selectDefaultDevices()),this.emit(Ve.MediaDevicesChanged)}),this.handleRoomUpdate=c=>{const u=this.roomInfo;this.roomInfo=c,u&&u.metadata!==c.metadata&&this.emitWhenConnected(Ve.RoomMetadataChanged,c.metadata),(u==null?void 0:u.activeRecording)!==c.activeRecording&&this.emitWhenConnected(Ve.RecordingStatusChanged,c.activeRecording)},this.handleConnectionQualityUpdate=c=>
789{c.updates.forEach(u=>{if(u.participantSid===this.localParticipant.sid){this.localParticipant.setConnectionQuality(u.quality);return}const d=this.getRemoteParticipantBySid(u.participantSid);d&&d.setConnectionQuality(u.quality)})},this.onLocalParticipantMetadataChanged=c=>{this.emit(Ve.ParticipantMetadataChanged,c,this.localParticipant)},this.onLocalParticipantNameChanged=c=>{this.emit(Ve.ParticipantNameChanged,c,this.localParticipant)},this.onLocalAttributesChanged=c=>{this.emit(Ve.ParticipantAttributesChanged,c,this.localParticipant)},this.onLocalTrackMuted=c=>{this.emit(Ve.TrackMuted,c,this.localParticipant)},this.onLocalTrackUnmuted=c=>{this.emit(Ve.TrackUnmuted,c,this.localParticipant)},this.onTrackProcessorUpdate=c=>{var u;(u=c==null?void 0:c.onPublish)===null||u===void 0||u.call(c,this)},this.onLocalTrackPublished=c=>ce(this,void 0,void 0,function*(){var u,d,f,h,p,m;(u=c.track)===null||u===void 0||u.on(Qe.TrackProcessorUpdate,this.onTrackProcessorUpdate),(d=c.track)===null||d===void 0||d.on(Qe.Restarted,this.onLocalTrackRestarted),(p=(h=(f=c.track)===null||f===void 0?void 0:f.getProcessor())===null||h===void 0?void 0:h.onPublish)===null||p===void 0||p.call(h,this),this.emit(Ve.LocalTrackPublished,c,this.localParticipant),$u(c.track)&&(yield c.track.checkForSilence())&&this.emit(Ve.LocalAudioSilenceDetected,c);const g=yield(m=c.track)===null||m===void 0?void 0:m.getDeviceId(!1),v=YN(c.source);v&&g&&g!==this.localParticipant.activeDeviceMap.get(v)&&(this.localParticipant.activeDeviceMap.set(v,g),this.emit(Ve.ActiveDeviceChanged,v,g))}),this.onLocalTrackUnpublished=c=>{var u,d;(u=c.track)===null||u===void 0||u.off(Qe.TrackProcessorUpdate,this.onTrackProcessorUpdate),(d=c.track)===null||d===void 0||d.off(Qe.Restarted,this.onLocalTrackRestarted),this.emit(Ve.LocalTrackUnpublished,c,this.localParticipant)},this.onLocalTrackRestarted=c=>ce(this,void 0,void 0,function*(){const u=yield c.getDeviceId(!1),d=YN(c.source);d&&u&&u!==this.localParticipant.activeDeviceMap.get(d)&&(this.log.debug("local track restarted, setting ".concat(d," ").concat(u," active")),this.localParticipant.activeDeviceMap.set(d,u),this.emit(Ve.ActiveDeviceChanged,d,u))}),this.onLocalConnectionQualityChanged=c=>{this.emit(Ve.ConnectionQualityChanged,c,this.localParticipant)},this.onMediaDevicesError=(c,u)=>{this.emit(Ve.MediaDevicesError,c,u)},this.onLocalParticipantPermissionsChanged=c=>{this.emit(Ve.ParticipantPermissionsChanged,c,this.localParticipant)},this.onLocalChatMessageSent=c=>{this.emit(Ve.ChatMessage,c,this.localParticipant)},this.setMaxListeners(100),this.remoteParticipants=new Map,this.sidToIdentity=new Map,this.options=Object.assign(Object.assign({},yBe),e),this.log=Xa((r=this.options.loggerName)!==null&&r!==void 0?r:hs.Room,()=>this.logContext),this.transcriptionReceivedTimes=new Map,this.options.audioCaptureDefaults=Object.assign(Object.assign({},une),e==null?void 0:e.audioCaptureDefaults),this.options.videoCaptureDefaults=Object.assign(Object.assign({},dne),e==null?void 0:e.videoCaptureDefaults),this.options.publishDefaults=Object.assign(Object.assign({},vBe),e==null?void 0:e.publishDefaults),this.maybeCreateEngine(),this.incomingDataStreamManager=new HBe,this.outgoingDataStreamManager=new YBe(this.engine,this.log),this.incomingDataTrackManager=new sUe({e2eeManager:this.e2eeManager}),this.incomingDataTrackManager.on("sfuUpdateSubscription",c=>{this.engine.client.sendUpdateDataSubscription(c.sid,c.subscribe)}).on("trackPublished",c=>{var u;c.track.publisherIdentity!==this.localParticipant.identity&&(this.emit(Ve.DataTrackPublished,c.track),(u=this.remoteParticipants.get(c.track.publisherIdentity))===null||u===void 0||u.addRemoteDataTrack(c.track))}).on("trackUnpublished",c=>{var u;c.publisherIdentity!==this.localParticipant.identity&&(this.emit(Ve.DataTrackUnpublished,c.sid),(u=this.remoteParticipants.get(c.publisherIdentity))===null||u===void 0||u.removeRemoteDataTrack(c.sid))}),this.outgoingDataTrackManager=new XO({e2eeManager:this.e2eeManager}),this.outgoingDataTrackManager.on("sfuPublishRequest",c=>{this.engine.client.sendPublishDataTrackRequest(c.handle,c.name,c.usesE2ee)}).on("sfuUnpublishRequest",c=>{this.engine.client.sendUnPublishDataTrackRequest(c.handle)}).on("trackPublished",c=>
789{this.emit(Ve.LocalDataTrackPublished,c.track)}).on("trackUnpublished",c=>{this.emit(Ve.LocalDataTrackUnpublished,c.sid)}).on("packetAvailable",c=>{let{handle:u,bytes:d}=c;this.engine.sendLossyBytes(d,gn.DATA_TRACK_LOSSY,"wait").finally(()=>this.outgoingDataTrackManager.handlePacketSendComplete(u))}),this.disconnectLock=new As,this.localParticipant=new fUe("","",this.engine,this.options,this.rpcHandlers,this.outgoingDataStreamManager,this.outgoingDataTrackManager),(this.options.e2ee||this.options.encryption)&&this.setupE2EE(),this.engine.e2eeManager=this.e2eeManager,this.incomingDataTrackManager.updateE2eeManager((i=this.e2eeManager)!==null&&i!==void 0?i:null),this.outgoingDataTrackManager.updateE2eeManager((s=this.e2eeManager)!==null&&s!==void 0?s:null),this.options.videoCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("videoinput",Ip(this.options.videoCaptureDefaults.deviceId)),this.options.audioCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("audioinput",Ip(this.options.audioCaptureDefaults.deviceId)),!((a=this.options.audioOutput)===null||a===void 0)&&a.deviceId&&this.switchActiveDevice("audiooutput",Ip(this.options.audioOutput.deviceId)).catch(c=>this.log.warn("Could not set audio output: ".concat(c.message))),Wa()){const c=new AbortController;(l=(o=navigator.mediaDevices)===null||o===void 0?void 0:o.addEventListener)===null||l===void 0||l.call(o,"devicechange",this.handleDeviceChange,{signal:c.signal}),Hv.cleanupRegistry&&Hv.cleanupRegistry.register(this,()=>{c.abort()})}}registerTextStreamHandler(e,n){return this.incomingDataStreamManager.registerTextStreamHandler(e,n)}unregisterTextStreamHandler(e){return this.incomingDataStreamManager.unregisterTextStreamHandler(e)}registerByteStreamHandler(e,n){return this.incomingDataStreamManager.registerByteStreamHandler(e,n)}unregisterByteStreamHandler(e){return this.incomingDataStreamManager.unregisterByteStreamHandler(e)}registerRpcMethod(e,n){if(this.rpcHandlers.has(e))throw Error("RPC handler already registered for method ".concat(e,", unregisterRpcMethod before trying to register again"));this.rpcHandlers.set(e,n)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}setE2EEEnabled(e){return ce(this,void 0,void 0,function*(){const n=yield this.e2eeStateMutex.lock();try{if(this.e2eeManager)this.isE2EEEnabled!==e&&(yield this.localParticipant.setE2EEEnabled(e),this.localParticipant.identity!==""&&this.e2eeManager.setParticipantCryptorEnabled(e,this.localParticipant.identity));else throw Error("e2ee not configured, please set e2ee settings within the room options")}finally{n()}})}setupE2EE(){var e,n;const r=!!this.options.encryption,i=this.options.encryption||this.options.e2ee;i&&("e2eeManager"in i?(this.e2eeManager=i.e2eeManager,this.e2eeManager.isDataChannelEncryptionEnabled=r):this.e2eeManager=new Q8e(i,r),this.e2eeManager.on(Eh.ParticipantEncryptionStatusChanged,(s,a)=>{B8e(a)&&(this.isE2EEEnabled=s),this.emit(Ve.ParticipantEncryptionStatusChanged,s,a)}),this.e2eeManager.on(Eh.EncryptionError,(s,a)=>{const o=a?this.getParticipantByIdentity(a):void 0;this.emit(Ve.EncryptionError,s,o)}),(e=this.e2eeManager)===null||e===void 0||e.setup(this),(n=this.e2eeManager)===null||n===void 0||n.setupEngine(this.engine))}get logContext(){var e,n,r;return{room:this.name,roomID:(e=this.roomInfo)===null||e===void 0?void 0:e.sid,participant:(n=this.localParticipant)===null||n===void 0?void 0:n.identity,participantID:(r=this.localParticipant)===null||r===void 0?void 0:r.sid}}get isRecording(){var e,n;return(n=(e=this.roomInfo)===null||e===void 0?void 0:e.activeRecording)!==null&&n!==void 0?n:!1}getSid(){return this.state===Bn.Disconnected?Xs.resolve(""):this.roomInfo&&this.roomInfo.sid!==""?Xs.resolve(this.roomInfo.sid):new Xs((e,n)=>{const r=i=>{i.sid!==""&&(this.engine.off(We.RoomUpdate,r),e(i.sid))};this.engine.on(We.RoomUpdate,r),this.once(Ve.Disconnected,()=>{this.engine.off(We.RoomUpdate,r),n(new Yr("Room disconnected before room server id was available"))})})}get name(){var e,n;return(n=(e=this.roomInfo)===null||e===void 0?void 0:e.name)!==null&&n!==void 0?n:""}get metadata(){var e;return(e=this.roomInfo)===null||e===void 0?void 0:e.metadata}get numParticipants(){var e,n;return(n=(e=this.roomInfo)===null||e===void 0?void 0:e.numParticipants)!==null&&n!==void 0?n:0}get numPublishers(){var e,n;return(n=(e=this.roomInfo)===null||e===void 0?void 0:e.numPublishers)!==null&&n!==void 0?n:0}maybeCreateEngine(){this.engine&&(this.engine.isNewlyCreated||!this.engine.isClosed)||(this.engine=new $Be(this.options),this.engine.e2eeManager=this.e2eeManager,this.engine.on(We.ParticipantUpdate,this.handleParticipantUpdates).on(We.RoomUpdate,this.handleRoomUpdate).on(We.SpeakersChanged,this.handleSpeakersChanged).on(We.StreamStateChanged,this.handleStreamStateUpdate).on(We.ConnectionQualityUpdate,this.handleConnectionQualityUpdate).on(We.SubscriptionError,this.handleSubscriptionError).on(We.SubscriptionPermissionUpdate,this.handleSubscriptionPermissionUpdate).on(We.MediaTrackAdded,(e,n,r)=>{this.onTrackAdded(e,n,r)}).on(We.Disconnected,e=>{this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,e)}).on(We.ActiveSpeakersUpdate,this.handleActiveSpeakersUpdate).on(We.DataPacketReceived,this.handleDataPacket).on(We.Resuming,()=>{this.clearConnectionReconcile(),this.isResuming=!0,this.log.debug("Resuming signal connection"),this.setAndEmitConnectionState(Bn.SignalReconnecting)&&this.emit
vendor: 6,313 bytes, line 789
789(Ve.SignalReconnecting)}).on(We.Resumed,()=>{this.registerConnectionReconcile(),this.isResuming=!1,this.log.debug("Resumed signal connection"),this.updateSubscriptions(),this.emitBufferedEvents(),this.setAndEmitConnectionState(Bn.Connected)&&this.emit(Ve.Reconnected)}).on(We.SignalResumed,()=>{this.bufferedEvents=[],(this.state===Bn.Reconnecting||this.isResuming)&&this.sendSyncState()}).on(We.Restarting,this.handleRestarting).on(We.Restarted,this.handleRestarted).on(We.SignalRestarted,this.handleSignalRestarted).on(We.Offline,()=>{this.setAndEmitConnectionState(Bn.Reconnecting)&&this.emit(Ve.Reconnecting)}).on(We.DCBufferStatusChanged,(e,n)=>{this.emit(Ve.DCBufferStatusChanged,e,n)}).on(We.LocalTrackSubscribed,e=>{this.handleLocalTrackSubscribed(e)}).on(We.RoomMoved,e=>{this.log.debug("room moved",e),e.room&&this.handleRoomUpdate(e.room),this.remoteParticipants.forEach((n,r)=>{this.handleParticipantDisconnected(r,n)}),this.emit(Ve.Moved,e.room.name),e.participant?this.handleParticipantUpdates([e.participant,...e.otherParticipants]):this.handleParticipantUpdates(e.otherParticipants)}).on(We.PublishDataTrackResponse,e=>{if(!e.info){this.log.warn("received PublishDataTrackResponse, but event.info was ".concat(e.info,", so skipping."));return}this.outgoingDataTrackManager.receivedSfuPublishResponse(e.info.pubHandle,{type:"ok",data:{sid:e.info.sid,pubHandle:e.info.pubHandle,name:e.info.name,usesE2ee:e.info.encryption!==yr.NONE}})}).on(We.UnPublishDataTrackResponse,e=>{if(!e.info){this.log.warn("received UnPublishDataTrackResponse, but event.info was ".concat(e.info,", so skipping."));return}this.outgoingDataTrackManager.receivedSfuUnpublishResponse(e.info.pubHandle)}).on(We.DataTrackSubscriberHandles,e=>{const n=new Map(Object.entries(e.subHandles).map(r=>{let[i,s]=r;return[parseInt(i,10),s.trackSid]}));this.incomingDataTrackManager.receivedSfuSubscriberHandles(n)}).on(We.DataTrackPacketReceived,e=>{try{this.incomingDataTrackManager.packetReceived(e)}catch(n){throw n}}).on(We.Joined,e=>{const n=new Map(e.otherParticipants.map(r=>[r.identity,r.dataTracks.map(i=>xS.from(i))]));this.incomingDataTrackManager.receiveSfuPublicationUpdates(n)}).on(We.TokenRefreshed,e=>{var n;(n=this.regionUrlProvider)===null||n===void 0||n.updateToken(e)}).on(We.ServerRegionsReported,e=>{var n;(n=this.regionUrlProvider)===null||n===void 0||n.setServerReportedRegions({regionSettings:e,updatedAtInMs:Date.now(),maxAgeInMs:s3})}),this.localParticipant&&this.localParticipant.setupEngine(this.engine),this.e2eeManager&&this.e2eeManager.setupEngine(this.engine),this.outgoingDataStreamManager&&this.outgoingDataStreamManager.setupEngine(this.engine))}createRegionStrategy(){return{getNextUrl:e=>ce(this,void 0,void 0,function*(){return this.regionUrlProvider?this.regionUrlProvider.getNextBestRegionUrl(e):null}),resetAttempts:()=>{var e;return(e=this.regionUrlProvider)===null||e===void 0?void 0:e.resetAttempts()}}}static getLocalDevices(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return cs.getInstance().getDevices(e,n)}prepareConnection(e,n){return ce(this,void 0,void 0,function*(){if(this.state===Bn.Disconnected){this.log.debug("prepareConnection to ".concat(e));try{if(qv(new URL(e))&&n){this.regionUrlProvider=new In(e,n);const r=yield this.regionUrlProvider.getNextBestRegionUrl();r&&this.state===Bn.Disconnected&&(this.regionUrl=r,yield fetch(Vw(r),{method:"HEAD"}),this.log.debug("prepared connection to ".concat(r)))}else yield fetch(Vw(e),{method:"HEAD"})}catch(r){this.log.warn("could not prepare connection",{error:r})}}})}getParticipantByIdentity(e){return this.localParticipant.identity===e?this.localParticipant:this.remoteParticipants.get(e)}clearConnectionFutures(){this.connectFuture=void 0}simulateScenario(e,n){return ce(this,void 0,void 0,function*(){let r=()=>ce(this,void 0,void 0,function*(){}),i;switch(e){case"signal-reconnect":yield this.engine.client.handleOnClose("simulate disconnect");break;case"fail-on-v1-path":this.engine.failNextV1Path();break;case"speaker":i=new Rc({scenario:{case:"speakerUpdate",value:3}});break;case"node-failure":i=new Rc({scenario:{case:"nodeFailure",value:!0}});break;case"server-leave":i=new Rc({scenario:{case:"serverLeave",value:!0}});break;case"migration":i=new Rc({scenario:{case:"migration",value:!0}});break;case"resume-reconnect":this.engine.failNext(),yield this.engine.client.handleOnClose("simulate resume-disconnect");break;case"disconnect-signal-on-resume":r=()=>ce(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),i=new Rc({scenario:{case:"disconnectSignalOnResume",value:!0}});break;case"disconnect-signal-on-resume-no-messages":r=()=>ce(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),i=new Rc({scenario:{case:"disconnectSignalOnResumeNoMessages",value:!0}});break;case"full-reconnect":this.engine.fullReconnectOnNext=!0,yield this.engine.client.handleOnClose("simulate full-reconnect");break;case"force-tcp":case"force-tls":i=new Rc({scenario:{case:"switchCandidateProtocol",value:e==="force-tls"?2:1}}),r=()=>ce(this,void 0,void 0,function*(){const s=this.engine.client.onLeave;s&&s(new oC({reason:Jl.CLIENT_INITIATED,action:cv.RECONNECT}))});break;case"subscriber-bandwidth":if(n===void 0||typeof n!="number")throw new Error("subscriber-bandwidth requires a number as argument");i=new Rc({scenario:{case:"subscriberBandwidth",value:Zf(n)}});break;case"leave-full-reconnect":i=new Rc({scenario:{case:"leaveRequestFullReconnect",value:!0}})}i&&(yield this.engine.client.sendSimulateScenario(i),yield r())})}get canPlaybackAudio(){return this.audioEnabled}get canPlaybackVideo(){return!this.isVideoPlaybackBlocked}getActiveDevice(e){return this.localParticipant.activeDeviceMap.get(e)}switchActiveDevice(e,n){return ce(this,arguments,void 0,function(r,i){var s=this;let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return function*(){var o,l,c,u,d,f,h;let p=!0,m=!1;const g=a?{exact:i}:i;if(r==="audioinput"){m=s.localParticipant.audioTrackPublications.size===0;const v=(o=s.getActiveDevice(r))!==null&&o!==void 0?o:s.options.audioCaptureDefaults.deviceId;s.options.audioCaptureDefaults.deviceId=g;const _=Array.from(s.localParticipant.audioTrackPublications.values()).filter(x=>
789x.source===je.Source.Microphone);try{p=(yield Promise.all(_.map(x=>{var T;return(T=x.audioTrack)===null||T===void 0?void 0:T.setDeviceId(g)}))).every(x=>x===!0)}catch(x){throw s.options.audioCaptureDefaults.deviceId=v,x}const b=_.some(x=>{var T,N;return(N=(T=x.track)===null||T===void 0?void 0:T.isMuted)!==null&&N!==void 0?N:!1});p&&b&&(m=!0)}else if(r==="videoinput"){m=s.localParticipant.videoTrackPublications.size===0;const v=(l=s.getActiveDevice(r))!==null&&l!==void 0?l:s.options.videoCaptureDefaults.deviceId;s.options.videoCaptureDefaults.deviceId=g;const _=Array.from(s.localParticipant.videoTrackPublications.values()).filter(x=>x.source===je.Source.Camera);try{p=(yield Promise.all(_.map(x=>{var T;return(T=x.videoTrack)===null||T===void 0?void 0:T.setDeviceId(g)}))).every(x=>x===!0)}catch(x){throw s.options.videoCaptureDefaults.deviceId=v,x}const b=_.some(x=>{var T,N;return(N=(T=x.track)===null||T===void 0?void 0:T.isMuted)!==null&&N!==void 0?N:!1});p&&b&&(m=!0)}else if(r==="audiooutput"){if(m=!0,!ZN()&&!s.options.webAudioMix||s.options.webAudioMix&&s.audioContext&&!("setSinkId"in s.audioContext))throw new Error("cannot switch audio output, the current browser does not support it");s.options.webAudioMix&&(i=(c=yield cs.getInstance().normalizeDeviceId("audiooutput",i))!==null&&c!==void 0?c:""),(u=(h=s.options).audioOutput)!==null&&u!==void 0||(h.audioOutput={});const v=(d=s.getActiveDevice(r))!==null&&d!==void 0?d:s.options.audioOutput.deviceId;s.options.audioOutput.deviceId=i;try{s.options.webAudioMix&&((f=s.audioContext)===null||f===void 0||f.setSinkId(i)),yield Promise.all(Array.from(s.remoteParticipants.values()).map(_=>_.setAudioOutput({deviceId:i})))}catch(_){throw s.options.audioOutput.deviceId=v,_}}return m&&(s.localParticipant.activeDeviceMap.set(r,i),s.emit(Ve.ActiveDeviceChanged,r,i)),p}()})}setupLocalParticipantEvents(){this.localParticipant.on(tt.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).on(tt.ParticipantNameChanged,this.onLocalParticipantNameChanged).on(tt.AttributesChanged,this.onLocalAttributesChanged).on(tt.TrackMuted,this.onLocalTrackMuted).on(tt.TrackUnmuted,this.onLocalTrackUnmuted).on(tt.LocalTrackPublished,this.onLocalTrackPublished).on(tt.LocalTrackUnpublished,this.onLocalTrackUnpublished).on(tt.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).on(tt.MediaDevicesError,this.onMediaDevicesError).on(tt.AudioStreamAcquired,this.startAudio).on(tt.ChatMessage,this.onLocalChatMessageSent).on(tt.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged)}recreateEngine(e){const n=this.engine;e&&n&&!n.client.isDisconnected?n.client.sendLeave().finally(()=>n.close()):n==null||n.close(),this.engine=void 0,this.isResuming=!1,this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.bufferedEvents=[],this.maybeCreateEngine()}onTrackAdded(e,n,r){if(this.state===Bn.Connecting||this.state===Bn.Reconnecting){const d=()=>{this.log.debug("deferring on track for later",{mediaTrackId:e.id,mediaStreamId:n.id,tracksInStream:n.getTracks().map(h=>h.id)}),this.onTrackAdded(e,n,r),f()},f=()=>{this.off(Ve.Reconnected,d),this.off(Ve.Connected,d),this.off(Ve.Disconnected,f)};this.once(Ve.Reconnected,d),this.once(Ve.Connected,d),this.once(Ve.Disconnected,f);return}if(this.state===Bn.Disconnected){this.log.warn("skipping incoming track after Room disconnected");return}if(e.readyState==="ended"){this.log.debug("skipping incoming track as it already ended");return}const i=S8e(n.id),s=i[0];let a=i[1],o=e.id;if(a&&a.startsWith("TR")&&(o=a),s===this.localParticipant.sid){this.log.warn("tried to create RemoteParticipant for local participant");return}const l=Array.from(this.remoteParticipants.values()).find(d=>d.sid===s);if(!l){s.startsWith("PA")&&this.log.error("Tried to add a track for a participant, that's not present. Sid: ".concat(s));return}if(!o.startsWith("TR")){const d=this.engine.getTrackIdForReceiver(r);if(!d){this.log.error("Tried to add a track whose 'sid' could not be found for a participant, that's not present. Sid: ".concat(s));return}o=d}o.startsWith("TR")||this.log.warn("Tried to add a track whose 'sid' could not be determined for a participant, that's not present. Sid: ".concat(s,", streamId: ").concat(a,", trackId: ").concat(o),{remoteParticipantID:s,streamId:a,trackId:o});let c;this.options.adaptiveStream&&(typeof this.options.adaptiveStream=="object"?c=this.options.adaptiveStream:c={});const u=l.addSubscribedMediaTrack(e,o,n,r,c);
789u!=null&&u.isEncrypted&&!this.e2eeManager&&this.emit(Ve.EncryptionError,new Error("Encrypted ".concat(u.source," track received from participant ").concat(l.sid,", but room does not have encryption enabled!")))}handleLocalTrackSubscribed(e){const n=()=>this.localParticipant.getTrackPublications().find(l=>{let{trackSid:c}=l;return c===e}),r=n();if(r){this.emitLocalTrackSubscribed(r);return}this.log.debug("deferring LocalTrackSubscribed, publication not yet available",{subscribedSid:e});const i=1e4;let s;const a=l=>{l.trackSid===e&&(o(),this.emitLocalTrackSubscribed(l))},o=()=>{clearTimeout(s),this.localParticipant.off(tt.LocalTrackPublished,a),this.off(Ve.Disconnected,o)};this.localParticipant.on(tt.LocalTrackPublished,a),this.once(Ve.Disconnected,o),s=setTimeout(()=>{o();const l=n();l?this.emitLocalTrackSubscribed(l):this.log.warn("could not find local track publication for LocalTrackSubscribed event after timeout",{subscribedSid:e})},i)}emitLocalTrackSubscribed(e){this.localParticipant.emit(tt.LocalTrackSubscribed,e),this.emitWhenConnected(Ve.LocalTrackSubscribed,e,this.localParticipant)}handleDisconnect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,n=arguments.length>1?arguments[1]:void 0;var r,i;if(this.clearConnectionReconcile(),this.isResuming=!1,this.bufferedEvents=[],this.transcriptionReceivedTimes.clear(),this.incomingDataStreamManager.clearControllers(),this.incomingDataTrackManager.reset(),this.outgoingDataTrackManager.reset(),this.state!==Bn.Disconnected){this.regionUrl=void 0,this.regionUrlProvider&&this.regionUrlProvider.notifyDisconnected();
vendor: 24,730 bytes, line 789
789try{this.remoteParticipants.forEach(s=>{s.trackPublications.forEach(a=>{s.unpublishTrack(a.trackSid)})}),this.localParticipant.trackPublications.forEach(s=>{var a,o,l;s.track&&this.localParticipant.unpublishTrack(s.track,e),e?((a=s.track)===null||a===void 0||a.detach(),(o=s.track)===null||o===void 0||o.stop()):(l=s.track)===null||l===void 0||l.stopMonitor()}),this.localParticipant.off(tt.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).off(tt.ParticipantNameChanged,this.onLocalParticipantNameChanged).off(tt.AttributesChanged,this.onLocalAttributesChanged).off(tt.TrackMuted,this.onLocalTrackMuted).off(tt.TrackUnmuted,this.onLocalTrackUnmuted).off(tt.LocalTrackPublished,this.onLocalTrackPublished).off(tt.LocalTrackUnpublished,this.onLocalTrackUnpublished).off(tt.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).off(tt.MediaDevicesError,this.onMediaDevicesError).off(tt.AudioStreamAcquired,this.startAudio).off(tt.ChatMessage,this.onLocalChatMessageSent).off(tt.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged),this.localParticipant.trackPublications.clear(),this.localParticipant.videoTrackPublications.clear(),this.localParticipant.audioTrackPublications.clear(),this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.activeSpeakers=[],this.audioContext&&typeof this.options.webAudioMix=="boolean"&&(this.audioContext.close(),this.audioContext=void 0),Wa()&&(window.removeEventListener("beforeunload",this.onPageLeave),window.removeEventListener("pagehide",this.onPageLeave),window.removeEventListener("freeze",this.onPageLeave),(i=(r=navigator.mediaDevices)===null||r===void 0?void 0:r.removeEventListener)===null||i===void 0||i.call(r,"devicechange",this.handleDeviceChange))}finally{this.setAndEmitConnectionState(Bn.Disconnected),this.emit(Ve.Disconnected,n)}}}handleParticipantDisconnected(e,n){var r;this.remoteParticipants.delete(e),n&&(this.incomingDataStreamManager.validateParticipantHasNoActiveDataStreams(e),this.incomingDataTrackManager.handleRemoteParticipantDisconnected(e),n.trackPublications.forEach(i=>{n.unpublishTrack(i.trackSid,!0)}),this.emit(Ve.ParticipantDisconnected,n),n.setDisconnected(),(r=this.localParticipant)===null||r===void 0||r.handleParticipantDisconnected(n.identity))}handleIncomingRpcRequest(e,n,r,i,s,a){return ce(this,void 0,void 0,function*(){if(yield this.engine.publishRpcAck(e,n),a!==1){yield this.engine.publishRpcResponse(e,n,null,gi.builtIn("UNSUPPORTED_VERSION"));return}const o=this.rpcHandlers.get(r);if(!o){yield this.engine.publishRpcResponse(e,n,null,gi.builtIn("UNSUPPORTED_METHOD"));return}let l=null,c=null;try{const u=yield o({requestId:n,callerIdentity:e,payload:i,responseTimeout:s});HO(u)>hne?(l=gi.builtIn("RESPONSE_PAYLOAD_TOO_LARGE"),this.log.warn("RPC Response payload too large for ".concat(r))):c=u}catch(u){u instanceof gi?l=u:(this.log.warn("Uncaught error returned by RPC handler for ".concat(r,". Returning APPLICATION_ERROR instead."),u),l=gi.builtIn("APPLICATION_ERROR"))}yield this.engine.publishRpcResponse(e,n,c,l)})}selectDefaultDevices(){return ce(this,void 0,void 0,function*(){var e,n,r;const i=cs.getInstance().previousDevices,s=yield cs.getInstance().getDevices(void 0,!1),a=Ca();if((a==null?void 0:a.name)==="Chrome"&&a.os!=="iOS")for(let l of s){const c=i.find(u=>u.deviceId===l.deviceId);c&&c.label!==""&&c.kind===l.kind&&c.label!==l.label&&this.getActiveDevice(l.kind)==="default"&&this.emit(Ve.ActiveDeviceChanged,l.kind,l.deviceId)}const o=["audiooutput","audioinput","videoinput"];for(let l of o){const c=m8e(l),u=this.localParticipant.getTrackPublication(c);if(u&&(!((e=u.track)===null||e===void 0)&&e.isUserProvided))continue;const d=s.filter(h=>h.kind===l),f=this.getActiveDevice(l);if(f===((n=i.filter(h=>h.kind===l)[0])===null||n===void 0?void 0:n.deviceId)&&d.length>0&&((r=d[0])===null||r===void 0?void 0:r.deviceId)!==f){yield this.switchActiveDevice(l,d[0].deviceId);continue}l==="audioinput"&&!$w()||l==="videoinput"||d.length>0&&!d.find(h=>h.deviceId===this.getActiveDevice(l))&&(l!=="audiooutput"||!$w())&&(yield this.switchActiveDevice(l,d[0].deviceId))}})}acquireAudioContext(){return ce(this,void 0,void 0,function*(){var e,n;if(typeof this.options.webAudioMix!="boolean"&&this.options.webAudioMix.audioContext?this.audioContext=this.options.webAudioMix.audioContext:(!this.audioContext||this.audioContext.state==="closed")&&(this.audioContext=(e=rne())!==null&&e!==void 0?e:void 0),this.options.webAudioMix&&this.remoteParticipants.forEach(i=>i.setAudioContext(this.audioContext)),this.localParticipant.setAudioContext(this.audioContext),this.audioContext&&this.audioContext.state==="suspended")try{yield Promise.race([this.audioContext.resume(),Zs(200)])}catch(i){this.log.warn("Could not resume audio context",{error:i})}const r=((n=this.audioContext)===null||n===void 0?void 0:n.state)==="running";r!==this.canPlaybackAudio&&(this.audioEnabled=r,this.emit(Ve.AudioPlaybackStatusChanged,r))})}createParticipant(e,n){var r;let i;return n?i=ES.fromParticipantInfo(this.engine.client,n,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName},this.incomingDataTrackManager):i=new ES(this.engine.client,"",e,void 0,void 0,void 0,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}),this.options.webAudioMix&&i.setAudioContext(this.audioContext),!((r=this.options.audioOutput)===null||r===void 0)&&r.deviceId&&i.setAudioOutput(this.options.audioOutput).catch(s=>this.log.warn("Could not set audio output: ".concat(s.message))),i}getOrCreateParticipant(e,n){if(this.remoteParticipants.has(e)){const i=this.remoteParticipants.get(e);return n&&i.updateInfo(n)&&this.sidToIdentity.set(n.sid,n.identity),i}const r=this.createParticipant(e,n);return this.remoteParticipants.set(e,r),this.sidToIdentity.set(n.sid,n.identity),this.emitWhenConnected(Ve.ParticipantConnected,r),r.on(tt.TrackPublished,i=>{this.emitWhenConnected(Ve.TrackPublished,i,r)}).on(tt.TrackSubscribed,(i,s)=>{i.kind===je.Kind.Audio?(i.on(Qe.AudioPlaybackStarted,this.handleAudioPlaybackStarted),i.on(Qe.AudioPlaybackFailed,this.handleAudioPlaybackFailed)):i.kind===je.Kind.Video&&(i.on(Qe.VideoPlaybackFailed,this.handleVideoPlaybackFailed),i.on(Qe.VideoPlaybackStarted,this.handleVideoPlaybackStarted)),this.emitWhenConnected(Ve.TrackSubscribed,i,s,r)}).on(tt.TrackUnpublished,i=>{this.emit(Ve.TrackUnpublished,i,r)}).on(tt.TrackUnsubscribed,(i,s)=>{this.emit(Ve.TrackUnsubscribed,i,s,r)}).on(tt.TrackMuted,i=>{this.emitWhenConnected(Ve.TrackMuted,i,r)}).on(tt.TrackUnmuted,i=>{this.emitWhenConnected(Ve.TrackUnmuted,i,r)}).on(tt.ParticipantMetadataChanged,i=>{this.emitWhenConnected(Ve.ParticipantMetadataChanged,i,r)}).on(tt.ParticipantNameChanged,i=>{this.emitWhenConnected(Ve.ParticipantNameChanged,i,r)}).on(tt.AttributesChanged,i=>{this.emitWhenConnected(Ve.ParticipantAttributesChanged,i,r)}).on(tt.ConnectionQualityChanged,i=>{this.emitWhenConnected(Ve.ConnectionQualityChanged,i,r)}).on(tt.ParticipantPermissionsChanged,i=>{this.emitWhenConnected(Ve.ParticipantPermissionsChanged,i,r)}).on(tt.TrackSubscriptionStatusChanged,(i,s)=>{this.emitWhenConnected(Ve.TrackSubscriptionStatusChanged,i,s,r)}).on(tt.TrackSubscriptionFailed,(i,s)=>{this.emit(Ve.TrackSubscriptionFailed,i,r,s)}).on(tt.TrackSubscriptionPermissionChanged,(i,s)=>{this.emitWhenConnected(Ve.TrackSubscriptionPermissionChanged,i,s,r)}).on(tt.Active,()=>{this.emitWhenConnected(Ve.ParticipantActive,r),r.kind===Bw.AGENT&&this.localParticipant.setActiveAgent(r)}),n&&r.updateInfo(n),r}sendSyncState(){const e=Array.from(this.remoteParticipants.values()).reduce((i,s)=>(i.push(...s.getTrackPublications()),i),[]),n=this.localParticipant.getTrackPublications(),r=this.outgoingDataTrackManager.queryPublished();this.engine.sendSyncState(e,n,r)}updateSubscriptions(){for(const e of this.remoteParticipants.values())for(const n of e.videoTrackPublications.values())n.isSubscribed&&j8e(n)&&n.emitTrackUpdate()}getRemoteParticipantBySid(e){const n=this.sidToIdentity.get(e);if(n)return this.remoteParticipants.get(n)}registerConnectionReconcile(){this.clearConnectionReconcile();let e=0;this.connectionReconcileInterval=Fi.setInterval(()=>{!this.engine||this.engine.isClosed||!this.engine.verifyTransport()?(e++,this.log.warn("detected connection state mismatch",{numFailures:e,engine:this.engine?{closed:this.engine.isClosed,transportsConnectedOrConnecting:this.engine.verifyTransport()}:void 0}),e>=3&&(this.recreateEngine(),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,Jl.STATE_MISMATCH))):e=0},gUe)}clearConnectionReconcile(){this.connectionReconcileInterval&&Fi.clearInterval(this.connectionReconcileInterval)}setAndEmitConnectionState(e){return e===this.state?!1:(this.log.info("connection state changed: ".concat(this.state," -> ").concat(e)),this.state=e,this.incomingDataStreamManager.setConnected(e===Bn.Connected),this.emit(Ve.ConnectionStateChanged,this.state),!0)}emitBufferedEvents(){this.bufferedEvents.forEach(e=>{let[n,r]=e;this.emit(n,...r)}),this.bufferedEvents=[]}emitWhenConnected(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];if(this.state===Bn.Reconnecting||this.isResuming||!this.engine||this.engine.pendingReconnect)this.bufferedEvents.push([e,r]);else if(this.state===Bn.Connected)return this.emit(e,...r);return!1}simulateParticipants(e){return ce(this,void 0,void 0,function*(){var n,r,i,s;const a=Object.assign({audio:!0,video:!0,useRealTracks:!1},e.publish),o=Object.assign({count:9,audio:!1,video:!0,aspectRatios:[1.66,1.7,1.3]},e.participants);if(this.handleDisconnect(),this.roomInfo=new nC({sid:"RM_SIMULATED",name:"simulated-room",emptyTimeout:0,maxParticipants:0,creationTime:Gr.parse(new Date().getTime()),metadata:"",numParticipants:1,numPublishers:1,turnPassword:"",enabledCodecs:[],activeRecording:!1}),this.localParticipant.updateInfo(new Kp({identity:"simulated-local",name:"local-name"})),this.setupLocalParticipantEvents(),this.emit(Ve.SignalConnected),this.emit(Ve.Connected),this.setAndEmitConnectionState(Bn.Connected),a.video){const l=new o3(je.Kind.Video,new Ug({source:Oi.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:zl.AUDIO,name:"video-dummy"}),new TS(a.useRealTracks&&(!((n=window.navigator.mediaDevices)===null||n===void 0)&&n.getUserMedia)?(yield window.navigator.mediaDevices.getUserMedia({video:!0})).getVideoTracks()[0]:Z7(160*((r=o.aspectRatios[0])!==null&&r!==void 0?r:1),160,!0,!0),void 0,!1,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(l),this.localParticipant.emit(tt.LocalTrackPublished,l)}if(a.audio){const l=new o3(je.Kind.Audio,new Ug({source:Oi.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:zl.AUDIO}),new kS(a.useRealTracks&&(!((i=navigator.mediaDevices)===null||i===void 0)&&i.getUserMedia)?(yield navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0]:QE(),void 0,!1,this.audioContext,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(l),this.localParticipant.emit(tt.LocalTrackPublished,l)}for(let l=0;l<o.count-1;l+=1){let c=new Kp({sid:Math.floor(Math.random()*1e4).toString(),identity:"simulated-".concat(l),state:lv.ACTIVE,tracks:[],joinedAt:Gr.parse(Date.now())});const u=this.getOrCreateParticipant(c.identity,c);if(o.video){const d=Z7(160*((s=o.aspectRatios[l%o.aspectRatios.length])!==null&&s!==void 0?s:1),160,!1,!0),f=new Ug({source:Oi.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:zl.AUDIO});u.addSubscribedMediaTrack(d,f.sid,new MediaStream([d]),new RTCRtpReceiver),c.tracks=[...c.tracks,f]}if(o.audio){const d=QE(),f=new Ug({source:Oi.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:zl.AUDIO});u.addSubscribedMediaTrack(d,f.sid,new MediaStream([d]),new RTCRtpReceiver),c.tracks=[...c.tracks,f]}u.updateInfo(c)}})}emit(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];if(e!==Ve.ActiveSpeakersChanged&&e!==Ve.TranscriptionReceived){const s=Pne(r).filter(a=>a!==void 0);(e===Ve.TrackSubscribed||e===Ve.TrackUnsubscribed)&&this.log.trace("subscribe trace: ".concat(e),{event:e,args:s}),this.log.debug("room event ".concat(e),{event:e,args:s})}return super.emit(e,...r)}}Hv.cleanupRegistry=typeof FinalizationRegistry<"u"&&new FinalizationRegistry(t=>{t()});function Pne(t){return t.map(e=>{if(e)return Array.isArray(e)?Pne(e):typeof e=="object"?"logContext"in e?e.logContext:void 0:e})}var Dl;(function(t){t[t.IDLE=0]="IDLE",t[t.RUNNING=1]="RUNNING",t[t.SKIPPED=2]="SKIPPED",t[t.SUCCESS=3]="SUCCESS",t[t.FAILED=4]="FAILED"})(Dl||(Dl={}));class mf extends al.EventEmitter{constructor(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.status=Dl.IDLE,this.logs=[],this.options={},this.url=e,this.token=n,this.name=this.constructor.name,this.room=new Hv(r.roomOptions),this.connectOptions=r.connectOptions,this.options=r}run(e){return ce(this,void 0,void 0,function*(){if(this.status!==Dl.IDLE)throw Error("check is running already");this.setStatus(Dl.RUNNING);try{yield this.perform()}catch(n){n instanceof Error&&(this.options.errorsAsWarnings?this.appendWarning(n.message):this.appendError(n.message))}return yield this.disconnect(),yield new Promise(n=>setTimeout(n,500)),this.status!==Dl.SKIPPED&&this.setStatus(this.isSuccess()?Dl.SUCCESS:Dl.FAILED),e&&e(),this.getInfo()})}isSuccess(){return!this.logs.some(e=>e.level==="error")}connect(e){return ce(this,void 0,void 0,function*(){return this.room.state===Bn.Connected?this.room:(e||(e=this.url),yield this.room.connect(e,this.token,this.connectOptions),this.room)})}disconnect(){return ce(this,void 0,void 0,function*(){this.room&&this.room.state!==Bn.Disconnected&&(yield this.room.disconnect(),yield new Promise(e=>setTimeout(e,500)))})}skip(){this.setStatus(Dl.SKIPPED)}switchProtocol(e){return ce(this,void 0,void 0,function*(){let n=!1,r=!1;if(this.room.on(Ve.Reconnecting,()=>{n=!0}),this.room.once(Ve.Reconnected,()=>{r=!0}),this.room.simulateScenario("force-".concat(e)),yield new Promise(s=>setTimeout(s,1e3)),!n)return;const i=Date.now()+1e4;for(;Date.now()<i;){if(r)return;yield Zs(100)}throw new Error("Could not reconnect using ".concat(e," protocol after 10 seconds"))})}appendMessage(e){this.logs.push({level:"info",message:e}),this.emit("update",this.getInfo())}appendWarning(e){this.logs.push({level:"warning",message:e}),this.emit("update",this.getInfo())}appendError(e){this.logs.push({level:"error",message:e}),this.emit("update",this.getInfo())}setStatus(e){this.status=e,this.emit("update",this.getInfo())}get engine(){var e;return(e=this.room)===null||e===void 0?void 0:e.engine}getInfo(){return{logs:this.logs,name:this.name,status:this.status,description:this.description}}}class vUe extends mf{get description(){return"Cloud regions"}perform(){return ce(this,void 0,void 0,function*(){const e=new In(this.url,this.token);if(!e.isCloud()){this.skip();return}const n=[],r=new Set;for(let s=0;s<3;s++){const a=yield e.getNextBestRegionUrl();if(!a)break;if(r.has(a))continue;r.add(a);const o=yield this.checkCloudRegion(a);this.appendMessage("".concat(o.region," RTT: ").concat(o.rtt,"ms, duration: ").concat(o.duration,"ms")),n.push(o)}n.sort((s,a)=>(s.duration-a.duration)*.5+(s.rtt-a.rtt)*.5);const i=n[0];this.bestStats=i,this.appendMessage("best Cloud region: ".concat(i.region))})}getInfo(){const e=super.getInfo();return e.data=this.bestStats,e}checkCloudRegion(e){return ce(this,void 0,void 0,function*(){var n,r;yield this.connect(e),this.options.protocol==="tcp"&&(yield this.switchProtocol("tcp"));const i=(n=this.room.serverInfo)===null||n===void 0?void 0:n.region;if(!i)throw new Error("Region not found");const s=yield this.room.localParticipant.streamText({topic:"test"}),a=1e3,l=1e6/a,c="A".repeat(a),u=Date.now();for(let p=0;p<l;p++)yield s.write(c);yield s.close();const d=Date.now(),f=yield(r=this.room.engine.pcManager)===null||r===void 0?void 0:r.publisher.getStats(),h={region:i,rtt:1e4,duration:d-u};return f==null||f.forEach(p=>{p.type==="candidate-pair"&&p.nominated&&(h.rtt=p.currentRoundTripTime*1e3)}),yield this.disconnect(),h})}}const cA=1e4;class yUe extends mf{get description(){return"Connection via UDP vs TCP"}perform(){return ce(this,void 0,void 0,function*(){const e=yield this.checkConnectionProtocol("udp"),n=yield this.checkConnectionProtocol("tcp");this.bestStats=e,e.qualityLimitationDurations.bandwidth-n.qualityLimitationDurations.bandwidth>.5||(e.packetsLost-n.packetsLost)/e.packetsSent>.01?(this.appendMessage("best connection quality via tcp"),this.bestStats=n):this.appendMessage("best connection quality via udp");const r=this.bestStats;this.appendMessage("upstream bitrate: ".concat((r.bitrateTotal/r.count/1e3/1e3).toFixed(2)," mbps")),this.appendMessage("RTT: ".concat((r.rttTotal/r.count*1e3).toFixed(2)," ms")),this.appendMessage("jitter: ".concat((r.jitterTotal/r.count*1e3).toFixed(2)," ms")),r.packetsLost>0&&this.appendWarning("packets lost: ".concat((r.packetsLost/r.packetsSent*100).toFixed(2),"%")),r.qualityLimitationDurations.bandwidth>1&&this.appendWarning("bandwidth limited ".concat((r.qualityLimitationDurations.bandwidth/(cA/1e3)*100).toFixed(2),"%")),r.qualityLimitationDurations.cpu>0&&this.appendWarning("cpu limited ".concat((r.qualityLimitationDurations.cpu/(cA/1e3)*100).toFixed(2),"%"))})}getInfo(){const e=super.getInfo();return e.data=this.bestStats,e}checkConnectionProtocol(e){return ce(this,void 0,void 0,function*(){yield this.connect(),e==="tcp"?yield this.switchProtocol("tcp"):yield this.switchProtocol("udp");const n=document.createElement("canvas");n.width=1280,n.height=720;const r=n.getContext("2d");if(!r)throw new Error("Could not get canvas context");let i=0;const s=()=>{i=(i+1)%360,r.fillStyle="hsl(".concat(i,", 100%, 50%)"),r.fillRect(0,0,n.width,n.height),requestAnimationFrame(s)};s();const o=n.captureStream(30).getVideoTracks()[0],c=(yield this.room.localParticipant.publishTrack(o,{simulcast:!1,degradationPreference:"maintain-resolution",videoEncoding:{maxBitrate:2e6}})).track,u={protocol:e,packetsLost:0,packetsSent:0,qualityLimitationDurations:{},rttTotal:0,jitterTotal:0,bitrateTotal:0,count:0},d=setInterval(()=>ce(this,void 0,void 0,function*(){const f=yield c.getRTCStatsReport();f==null||f.forEach(h=>{h.type==="outbound-rtp"?(u.packetsSent=h.packetsSent,u.qualityLimitationDurations=h.qualityLimitationDurations,u.bitrateTotal+=h.targetBitrate,u.count++):h.type==="remote-inbound-rtp"&&(u.packetsLost=h.packetsLost,u.rttTotal+=h.roundTripTime,u.jitterTotal+=h.jitter)})}),1e3);return yield new Promise(f=>setTimeout(f,cA)),clearInterval(d),o.stop(),n.remove(),yield this.disconnect(),u})}}class _Ue extends mf{get description(){return"Can publish audio"}perform(){return ce(this,void 0,void 0,function*(){var e;const n=yield this.connect(),r=yield Ene();if(yield nne(r,1e3))throw new Error("unable to detect audio from microphone");this.appendMessage("detected audio from microphone"),n.localParticipant.publishTrack(r),yield new Promise(o=>setTimeout(o,3e3));const s=yield(e=r.sender)===null||e===void 0?void 0:e.getStats();if(!s)throw new Error("Could not get RTCStats");let a=0;if(s.forEach(o=>{o.type==="outbound-rtp"&&(o.kind==="audio"||!o.kind&&o.mediaType==="audio")&&(a=o.packetsSent)}),a===0)throw new Error("Could not determine packets are sent");this.appendMessage("published ".concat(a," audio packets"))})}}class wUe extends mf{get description(){return"Can publish video"}perform(){return ce(this,void 0,void 0,function*(){var e;const n=yield this.connect(),r=yield uUe();yield this.checkForVideo(r.mediaStreamTrack),n.localParticipant.publishTrack(r),yield new Promise(a=>setTimeout(a,5e3));const i=yield(e=r.sender)===null||e===void 0?void 0:e.getStats();if(!i)throw new Error("Could not get RTCStats");let s=0;if(i.forEach(a=>{a.type==="outbound-rtp"&&(a.kind==="video"||!a.kind&&a.mediaType==="video")&&(s+=a.packetsSent)}),s===0)throw new Error("Could not determine packets are sent");this.appendMessage("published ".concat(s," video packets"))})}checkForVideo(e){return ce(this,void 0,void 0,function*(){const n=new MediaStream;n.addTrack(e.clone());const r=document.createElement("video");r.srcObject=n,r.muted=!0,r.autoplay=!0,r.playsInline=!0,r.setAttribute("playsinline","true"),document.body.appendChild(r),yield new Promise(i=>{r.onplay=()=>{setTimeout(()=>{var s,a,o,l;const c=document.createElement("canvas"),u=e.getSettings(),d=(a=(s=u.width)!==null&&s!==void 0?s:r.videoWidth)!==null&&a!==void 0?a:1280,f=(l=(o=u.height)!==null&&o!==void 0?o:r.videoHeight)!==null&&l!==void 0?l:720;c.width=d,c.height=f;const h=c.getContext("2d");h.drawImage(r,0,0);const m=h.getImageData(0,0,c.width,c.height).data;let g=!0;for(let v=0;v<m.length;v+=4)if(m[v]!==0||m[v+1]!==0||m[v+2]!==0){g=!1;break}g?this.appendError("camera appears to be producing only black frames"):this.appendMessage("received video frames"),i()},1e3)},r.play()}),n.getTracks().forEach(i=>i.stop()),r.remove()})}}class bUe extends mf{get description(){return"Resuming connection after interruption"}perform(){return ce(this,void 0,void 0,function*(){var e;const n=yield this.connect();let r=!1,i=!1,s;const a=new Promise(c=>{setTimeout(c,5e3),s=c}),o=()=>{r=!0};n.on(Ve.SignalReconnecting,o).on(Ve.Reconnecting,o).on(Ve.Reconnected,()=>{i=!0,s(!0)}),(e=n.engine.client.ws)===null||e===void 0||e.close();const l=n.engine.client.onClose;if(l&&l(""),yield a,r){if(!i||n.state!==Bn.Connected)throw this.appendWarning("reconnection is only possible in Redis-based configurations"),new Error("Not able to reconnect")}else throw new Error("Did not attempt to reconnect")})}}class xUe extends mf{get description(){return"Can connect via TURN"}perform(){return ce(this,void 0,void 0,function*(){var e,n,r;qv(new URL(this.url))&&(this.appendMessage("Using region specific url"),this.url=(e=yield new In(this.url,this.token).getNextBestRegionUrl())!==null&&e!==void 0?e:this.url);const i=new $O,s=yield i.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3},void 0,!0);let a=!1,o=!1,l=!1;for(let c of s.iceServers)for(let u of c.urls)u.startsWith("turn:")?(o=!0,l=!0):u.startsWith("turns:")&&(o=!0,l=!0,a=!0),u.startsWith("stun:")&&(l=!0);l?o&&!a&&this.appendWarning("TURN is configured server side, but TURN/TLS is unavailable."):this.appendWarning("No STUN servers configured on server side."),yield i.close(),!((r=(n=this.connectOptions)===null||n===void 0?void 0:n.rtcConfig)===null||r===void 0)&&r.iceServers||o?yield this.room.connect(this.url,this.token,{rtcConfig:{iceTransportPolicy:"relay"}}):(this.appendWarning("No TURN servers configured."),this.skip(),yield new Promise(c=>setTimeout(c,0)))})}}class kUe extends mf{get description(){return"Establishing WebRTC connection"}perform(){return ce(this,void 0,void 0,function*(){let e=!1,n=!1;this.room.on(Ve.SignalConnected,()=>{var r;const i=this.room.engine.client.onTrickle;this.room.engine.client.onTrickle=(s,a)=>{if(s.candidate){const o=new RTCIceCandidate(s);let l="".concat(o.protocol," ").concat(o.address,":").concat(o.port," ").concat(o.type);o.address&&(SUe(o.address)?l+=" (private)":o.protocol==="tcp"&&o.tcpType==="passive"?(e=!0,l+=" (passive)"):o.protocol==="udp"&&(n=!0)),this.appendMessage(l)}i&&i(s,a)},!((r=this.room.engine.pcManager)===null||r===void 0)&&r.subscriber&&(this.room.engine.pcManager.subscriber.onIceCandidateError=s=>{s instanceof RTCPeerConnectionIceErrorEvent&&this.appendWarning("error with ICE candidate: ".concat(s.errorCode," ").concat(s.errorText," ").concat(s.url))})});try{yield this.connect(),mn.info("now the room is connected")}catch(r){throw this.appendWarning("ports need to be open on firewall in order to connect."),r}e||this.appendWarning("Server is not configured for ICE/TCP"),n||this.appendWarning("No public IPv4 UDP candidates were found. Your server is likely not configured correctly")})}}function SUe(t){const e=t.split(".");if(e.length===4){if(e[0]==="10")return!0;if(e[0]==="192"&&e[1]==="168")return!0;if(e[0]==="172"){const n=parseInt(e[1],10);if(n>=16&&n<=31)return!0}}return!1}class TUe extends mf{get description(){return"Connecting to signal connection via WebSocket"}perform(){return ce(this,void 0,void 0,function*(){var e,n,r;(this.url.startsWith("ws:")||this.url.startsWith("http:"))&&this.appendWarning("Server is insecure, clients may block connections to it");let i=new $O,s;try{s=yield i.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3},void 0,!0)}
789catch(a){if(qv(new URL(this.url))){this.appendMessage("Initial connection failed with error ".concat(a.message,". Retrying with region fallback"));const l=yield new In(this.url,this.token).getNextBestRegionUrl();l&&(s=yield i.join(l,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3},void 0,!0),this.appendMessage("Fallback to region worked. To avoid initial connections failing, ensure you're calling room.prepareConnection() ahead of time"))}}s?(this.appendMessage("Connected to server, version ".concat(s.serverVersion,".")),((e=s.serverInfo)===null||e===void 0?void 0:e.edition)===nte.Cloud&&(!((n=s.serverInfo)===null||n===void 0)&&n.region)&&this.appendMessage("LiveKit Cloud: ".concat((r=s.serverInfo)===null||r===void 0?void 0:r.region))):this.appendError("Websocket connection could not be established"),yield i.close()})}}class w7e extends al.EventEmitter{constructor(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.options={},this.checkResults=new Map,this.url=e,this.token=n,this.options=r}getNextCheckId(){const e=this.checkResults.size;return this.checkResults.set(e,{logs:[],status:Dl.IDLE,name:"",description:""}),e}updateCheck(e,n){this.checkResults.set(e,n),this.emit("checkUpdate",e,n)}isSuccess(){return Array.from(this.checkResults.values()).every(e=>e.status!==Dl.FAILED)}getResults(){return Array.from(this.checkResults.values())}createAndRunCheck(e){return ce(this,void 0,void 0,function*(){const n=this.getNextCheckId(),r=new e(this.url,this.token,this.options),i=a=>{this.updateCheck(n,a)};r.on("update",i);const s=yield r.run();return r.off("update",i),s})}checkWebsocket(){return ce(this,void 0,void 0,function*(){return this.createAndRunCheck(TUe)})}checkWebRTC(){return ce(this,void 0,void 0,function*(){return this.createAndRunCheck(kUe)})}checkTURN(){return ce(this,void 0,void 0,function*(){return this.createAndRunCheck(xUe)})}checkReconnect(){return ce(this,void 0,void 0,function*(){return this.createAndRunCheck(bUe)})}checkPublishAudio(){return ce(this,void 0,void 0,function*(){return this.createAndRunCheck(_Ue)})}checkPublishVideo(){return ce(this,void 0,void 0,function*(){return this.createAndRunCheck(wUe)})}checkConnectionProtocol(){return ce(this,void 0,void 0,function*(){const e=yield this.createAndRunCheck(yUe);if(e.data&&"protocol"in e.data){const n=e.data;this.options.protocol=n.protocol}return e})}checkCloudRegion(){return ce(this,void 0,void 0,function*(){return this.createAndRunCheck(vUe)})}}function xn(t,e,n){return(e=EUe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function CUe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function EUe(t){var e=CUe(t,"string");return typeof e=="symbol"?e:e+""}new TextEncoder;new TextDecoder;class Pa extends Error{constructor(e,n){var r;super(e,n),xn(this,"code","ERR_JOSE_GENERIC"),this.name=this.constructor.name,(r=Error.captureStackTrace)===null||r===void 0||r.call(Error,this,this.constructor)}}xn(Pa,"code","ERR_JOSE_GENERIC");class AUe extends Pa{constructor(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"unspecified",i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"unspecified";super(e,{cause:{claim:r,reason:i,payload:n}}),xn(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),xn(this,"claim",void 0),xn(this,"reason",void 0),xn(this,"payload",void 0),this.claim=r,this.reason=i,this.payload=n}}xn(AUe,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class PUe extends Pa{constructor(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"unspecified",i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"unspecified";super(e,{cause:{claim:r,reason:i,payload:n}}),xn(this,"code","ERR_JWT_EXPIRED"),xn(this,"claim",void 0),xn(this,"reason",void 0),xn(this,"payload",void 0),this.claim=r,this.reason=i,this.payload=n}}
789xn(PUe,"code","ERR_JWT_EXPIRED");class MUe extends Pa{constructor(){super(...arguments),xn(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}xn(MUe,"code","ERR_JOSE_ALG_NOT_ALLOWED");class NUe extends Pa{constructor(){super(...arguments),xn(this,"code","ERR_JOSE_NOT_SUPPORTED")}}xn(NUe,"code","ERR_JOSE_NOT_SUPPORTED");class RUe extends Pa{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"decryption operation failed",n=arguments.length>1?arguments[1]:void 0;super(e,n),xn(this,"code","ERR_JWE_DECRYPTION_FAILED")}}xn(RUe,"code","ERR_JWE_DECRYPTION_FAILED");class IUe extends Pa{constructor(){super(...arguments),xn(this,"code","ERR_JWE_INVALID")}}xn(IUe,"code","ERR_JWE_INVALID");class LUe extends Pa{constructor(){super(...arguments),xn(this,"code","ERR_JWS_INVALID")}}xn(LUe,"code","ERR_JWS_INVALID");class OUe extends Pa{constructor(){super(...arguments),xn(this,"code","ERR_JWT_INVALID")}}xn(OUe,"code","ERR_JWT_INVALID");class DUe extends Pa{constructor(){super(...arguments),xn(this,"code","ERR_JWK_INVALID")}}xn(DUe,"code","ERR_JWK_INVALID");class FUe extends Pa{constructor(){super(...arguments),xn(this,"code","ERR_JWKS_INVALID")}}xn(FUe,"code","ERR_JWKS_INVALID");class jUe extends Pa{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"no applicable key found in the JSON Web Key Set",n=arguments.length>1?arguments[1]:void 0;super(e,n),xn(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}xn(jUe,"code","ERR_JWKS_NO_MATCHING_KEY");class BUe extends Pa{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"multiple matching keys found in the JSON Web Key Set",n=arguments.length>1?arguments[1]:void 0;super(e,n),xn(this,Symbol.asyncIterator,void 0),xn(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}xn(BUe,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class UUe extends Pa{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"request timed out",n=arguments.length>1?arguments[1]:void 0;super(e,n),xn(this,"code","ERR_JWKS_TIMEOUT")}}xn(UUe,"code","ERR_JWKS_TIMEOUT");class zUe extends Pa{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"signature verification failed",n=arguments.length>1?arguments[1]:void 0;super(e,n),xn(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}
vendor: 5,441 bytes, line 789
789xn(zUe,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");function ad(){return ad=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ad.apply(null,arguments)}const Dz=new Uint8Array(0);class Hw{static getFullOptions(e){return ad({clientTools:{},onConnect:()=>{},onDebug:()=>{},onDisconnect:()=>{},onError:()=>{},onMessage:()=>{},onAudio:()=>{},onModeChange:()=>{},onStatusChange:()=>{},onCanSendFeedbackChange:()=>{},onInterruption:()=>{}},e)}constructor(e,n){var r=this;this.options=void 0,this.connection=void 0,this.lastInterruptTimestamp=0,this.mode="listening",this.status="connecting",this.volume=1,this.currentEventId=1,this.lastFeedbackEventId=0,this.canSendFeedback=!1,this.endSessionWithDetails=async function(i){r.status!=="connected"&&r.status!=="connecting"||(r.updateStatus("disconnecting"),await r.handleEndSession(),r.updateStatus("disconnected"),r.options.onDisconnect&&r.options.onDisconnect(i))},this.onMessage=async function(i){switch(i.type){case"interruption":return void r.handleInterruption(i);case"agent_response":return void r.handleAgentResponse(i);case"user_transcript":return void r.handleUserTranscript(i);case"internal_tentative_agent_response":return void r.handleTentativeAgentResponse(i);case"client_tool_call":try{await r.handleClientToolCall(i)}catch(s){r.onError(`Unexpected error in client tool call handling: ${s instanceof Error?s.message:String(s)}`,{clientToolName:i.client_tool_call.tool_name,toolCallId:i.client_tool_call.tool_call_id})}return;case"audio":return void r.handleAudio(i);case"vad_score":return void r.handleVadScore(i);case"ping":return void r.connection.sendMessage({type:"pong",event_id:i.ping_event.event_id});case"mcp_tool_call":return void r.handleMCPToolCall(i);case"mcp_connection_status":return void r.handleMCPConnectionStatus(i);case"agent_tool_request":return void r.handleAgentToolRequest(i);case"agent_tool_response":return void r.handleAgentToolResponse(i);case"conversation_initiation_metadata":return void r.handleConversationMetadata(i);case"asr_initiation_metadata":return void r.handleAsrInitiationMetadata(i);case"agent_chat_response_part":return void r.handleAgentChatResponsePart(i);case"error":return void r.handleErrorEvent(i);default:return void(r.options.onDebug&&r.options.onDebug(i))}},this.setVolume=({volume:i})=>{this.volume=i},this.options=e,this.connection=n,this.options.onConnect&&this.options.onConnect({conversationId:n.conversationId}),this.connection.onMessage(this.onMessage),this.connection.onDisconnect(this.endSessionWithDetails),this.connection.onModeChange(i=>this.updateMode(i)),this.updateStatus("connected")}endSession(){return this.endSessionWithDetails({reason:"user"})}async handleEndSession(){this.connection.close()}updateMode(e){e!==this.mode&&(this.mode=e,this.options.onModeChange&&this.options.onModeChange({mode:e}))}updateStatus(e){e!==this.status&&(this.status=e,this.options.onStatusChange&&this.options.onStatusChange({status:e}))}updateCanSendFeedback(){const e=this.currentEventId!==this.lastFeedbackEventId;this.canSendFeedback!==e&&(this.canSendFeedback=e,this.options.onCanSendFeedbackChange&&this.options.onCanSendFeedbackChange({canSendFeedback:e}))}handleInterruption(e){e.interruption_event&&(this.lastInterruptTimestamp=e.interruption_event.event_id,this.options.onInterruption&&this.options.onInterruption({event_id:e.interruption_event.event_id}))}handleAgentResponse(e){this.options.onMessage&&this.options.onMessage({source:"ai",role:"agent",message:e.agent_response_event.agent_response})}handleUserTranscript(e){this.options.onMessage&&this.options.onMessage({source:"user",role:"user",message:e.user_transcription_event.user_transcript})}handleTentativeAgentResponse(e){this.options.onDebug&&this.options.onDebug({type:"tentative_agent_response",response:e.tentative_agent_response_internal_event.tentative_agent_response})}handleVadScore(e){this.options.onVadScore&&this.options.onVadScore({vadScore:e.vad_score_event.vad_score})}async handleClientToolCall(e){if(Object.prototype.hasOwnProperty.call(this.options.clientTools,e.client_tool_call.tool_name))try{var n;const r=(n=await this.options.clientTools[e.client_tool_call.tool_name](e.client_tool_call.parameters))!=null?n:"Client tool execution successful.",i=typeof r=="object"?JSON.stringify(r):String(r);this.connection.sendMessage({type:"client_tool_result",tool_call_id:e.client_tool_call.tool_call_id,result:i,is_error:!1})}catch(r){this.onError(`Client tool execution failed with following error: ${r==null?void 0:r.message}`,{clientToolName:e.client_tool_call.tool_name}),this.connection.sendMessage({type:"client_tool_result",tool_call_id:e.client_tool_call.tool_call_id,result:`Client tool execution failed: ${r==null?void 0:r.message}`,is_error:!0})}else{if(this.options.onUnhandledClientToolCall)return void this.options.onUnhandledClientToolCall(e.client_tool_call);this.onError(`Client tool with name ${e.client_tool_call.tool_name} is not defined on client`,{clientToolName:e.client_tool_call.tool_name}),this.connection.sendMessage({type:"client_tool_result",tool_call_id:e.client_tool_call.tool_call_id,result:`Client tool with name ${e.client_tool_call.tool_name} is not defined on client`,is_error:!0})}}handleAudio(e){}handleMCPToolCall(e){this.options.onMCPToolCall&&this.options.onMCPToolCall(e.mcp_tool_call)}
789handleMCPConnectionStatus(e){this.options.onMCPConnectionStatus&&this.options.onMCPConnectionStatus(e.mcp_connection_status)}handleAgentToolRequest(e){this.options.onAgentToolRequest&&this.options.onAgentToolRequest(e.agent_tool_request)}handleAgentToolResponse(e){e.agent_tool_response.tool_name==="end_call"&&this.endSessionWithDetails({reason:"agent",context:new CloseEvent("end_call",{reason:"Agent ended the call"})}),this.options.onAgentToolResponse&&this.options.onAgentToolResponse(e.agent_tool_response)}handleConversationMetadata(e){this.options.onConversationMetadata&&this.options.onConversationMetadata(e.conversation_initiation_metadata_event)}handleAsrInitiationMetadata(e){this.options.onAsrInitiationMetadata&&this.options.onAsrInitiationMetadata(e.asr_initiation_metadata_event)}handleAgentChatResponsePart(e){this.options.onAgentChatResponsePart&&this.options.onAgentChatResponsePart(e.text_response_part)}handleErrorEvent(e){const n=e.error_event.error_type,r=e.error_event.message||e.error_event.reason||"Unknown error";n!=="max_duration_exceeded"?this.onError(`Server error: ${r}`,{errorType:n,code:e.error_event.code,debugMessage:e.error_event.debug_message,details:e.error_event.details}):this.endSessionWithDetails({reason:"error",message:r,context:new Event("max_duration_exceeded")})}onError(e,n){console.error(e,n),this.options.onError&&this.options.onError(e,n)}getId(){return this.connection.conversationId}isOpen(){return this.status==="connected"}setMicMuted(e){this.connection.setMicMuted(e)}getInputByteFrequencyData(){return Dz}getOutputByteFrequencyData(){return Dz}getInputVolume(){return 0}getOutputVolume(){return 0}sendFeedback(e){this.canSendFeedback?(this.connection.sendMessage({type:"feedback",score:e?"like":"dislike",event_id:this.currentEventId}),this.lastFeedbackEventId=this.currentEventId,this.updateCanSendFeedback()):console.warn(this.lastFeedbackEventId===0?"Cannot send feedback: the conversation has not started yet.":"Cannot send feedback: feedback has already been sent for the current response.")}sendContextualUpdate(e){this.connection.sendMessage({type:"contextual_update",text:e})}sendUserMessage(e){this.connection.sendMessage({type:"user_message",text:e})}sendUserActivity(){this.connection.sendMessage({type:"user_activity"})}sendMCPToolApprovalResult(e,n){this.connection.sendMessage({type:"mcp_tool_approval_result",tool_call_id:e,is_approved:n})}}let Mne=class{constructor(e={}){this.queue=[],this.disconnectionDetails=null,this.onDisconnectCallback=null,this.onMessageCallback=null,this.onModeChangeCallback=null,this.onDebug=void 0,this.onDebug=e.onDebug}debug(e){this.onDebug&&this.onDebug(e)}onMessage(e){this.onMessageCallback=e;const n=this.queue;this.queue=[],n.length>0&&queueMicrotask(()=>{n.forEach(e)})}onDisconnect(e){this.onDisconnectCallback=e;const n=this.disconnectionDetails;n&&queueMicrotask(()=>{e(n)})}onModeChange(e){this.onModeChangeCallback=e}updateMode(e){var n;(n=this.onModeChangeCallback)==null||n.call(this,e)}disconnect(e){var n;this.disconnectionDetails||(this.disconnectionDetails=e,(n=this.onDisconnectCallback)==null||n.call(this,e))}handleMessage(e){this.onMessageCallback?this.onMessageCallback(e):this.queue.push(e)}};function AS(t){const[e,n]=t.split("_");if(!["pcm","ulaw"].includes(e))throw new Error(`Invalid format: ${t}`);const r=Number.parseInt(n);if(Number.isNaN(r))throw new Error(`Invalid sample rate: ${n}`);return{format:e,sampleRate:r}}const Nne="0.12.2";function l3(t){return!!t.type}const Rne="conversation_initiation_client_data";function Ine(t){var e;const n={type:Rne};var r,i,s,a,o,l;return t.overrides&&(n.conversation_config_override={agent:{prompt:(r=t.overrides.agent)==null?void 0:r.prompt,first_message:(i=t.overrides.agent)==null?void 0:i.firstMessage,language:(s=t.overrides.agent)==null?void 0:s.language},tts:{voice_id:(a=t.overrides.tts)==null?void 0:a.voiceId,speed:(o=t.overrides.tts)==null?void 0:o.speed},conversation:{text_only:(l=t.overrides.conversation)==null?void 0:l.textOnly}}),t.customLlmExtraBody&&(n.custom_llm_extra_body=t.customLlmExtraBody),t.dynamicVariables&&(n.dynamic_variables=t.dynamicVariables),t.userId&&(n.user_id=t.userId),(e=t.overrides)!=null&&e.client&&(n.source_info={source:t.overrides.client.source,version:t.overrides.client.version}),n}let c3=class Lne extends Mne{constructor(e,n,r,i){super(),this.socket=void 0,this.conversationId=void 0,this.inputFormat=void 0,this.outputFormat=void 0,this.socket=e,this.conversationId=n,this.inputFormat=r,this.outputFormat=i,this.socket.addEventListener("error",s=>{setTimeout(()=>this.disconnect({reason:"error",message:"The connection was closed due to a socket error.",context:s}),0)}),this.socket.addEventListener("close",s=>{this.disconnect(s.code===1e3?{reason:"agent",context:s}:{reason:"error",message:s.reason||"The connection was closed by the server.",context:s})}),this.socket.addEventListener("message",s=>{try{const a=JSON.parse(s.data);if(!l3(a))return void this.debug({type:"invalid_event",message:"Received invali
789d socket event",data:s.data});this.handleMessage(a)}catch(a){this.debug({type:"parsing_error",message:"Failed to parse socket message",error:a instanceof Error?a.message:String(a),data:s.data})}})}static async create(e){let n=null;try{var r,i,s;const o=(r=e.origin)!=null?r:"wss://api.elevenlabs.io";let l;const c=((i=e.overrides)==null||(i=i.client)==null?void 0:i.version)||Nne,u=((s=e.overrides)==null||(s=s.client)==null?void 0:s.source)||"js_sdk";if(e.signedUrl){const _=e.signedUrl.includes("?")?"&":"?";l=`${e.signedUrl}${_}source=${u}&version=${c}`}else l=`${o}/v1/convai/conversation?agent_id=${e.agentId}&source=${u}&version=${c}`;const d=["convai"];e.authorization&&d.push(`bearer.${e.authorization}`),n=new WebSocket(l,d);const f=await new Promise((_,b)=>{n.addEventListener("open",()=>{var x;const T=Ine(e);(x=n)==null||x.send(JSON.stringify(T))},{once:!0}),n.addEventListener("error",x=>{setTimeout(()=>b(x),0)}),n.addEventListener("close",b),n.addEventListener("message",x=>{const T=JSON.parse(x.data);l3(T)&&(T.type==="conversation_initiation_metadata"?_(T.conversation_initiation_metadata_event):console.warn("First received message is not conversation metadata."))},{once:!0})}),{conversation_id:h,agent_output_audio_format:p,user_input_audio_format:m}=f,g=AS(m??"pcm_16000"),v=AS(p);return new Lne(n,h,g,v)}catch(o){var a;throw(a=n)==null||a.close(),o}}close(){this.socket.close(1e3,"User ended conversation")}sendMessage(e){this.socket.send(JSON.stringify(e))}async setMicMuted(e){console.warn(`WebSocket connection setMicMuted called with ${e}, but this is handled by VoiceConversation`)}};function One(t){const e=new Uint8Array(t);return window.btoa(String.fromCharCode(...e))}function $Ue(t){const e=window.atob(t),n=e.length,r=new Uint8Array(n);for(let i=0;i<n;i++)r[i]=e.charCodeAt(i);return r.buffer}const E2=new Map;function Dne(t,e){return async(n,r)=>{const i=E2.get(t);if(i)return n.addModule(i);if(r)try{return await n.addModule(r),void E2.set(t,r)}catch(o){throw new Error(`Failed to load the ${t} worklet module from path: ${r}. Error: ${o}`)}const s=new Blob([e],{type:"application/javascript"}),a=URL.createObjectURL(s);try{return await n.addModule(a),void E2.set(t,a)}catch{URL.revokeObjectURL(a)}try{const o=`data:application/javascript;base64,${btoa(e)}`;await n.addModule(o),E2.set(t,o)}catch{throw new Error(`Failed to load the ${t} worklet module. Make sure the browser supports AudioWorklets. If you are using a strict CSP, you may need to self-host the worklet files.`)}}}const Fne=Dne("rawAudioProcessor",`/* 790 * ulaw encoding logic taken from the wavefile library 791 * https://github.com/rochars/wavefile/blob/master/lib/codecs/mulaw.js 792 * USED BY @elevenlabs/client 793 */ 794 795const BIAS = 0x84; 796const CLIP = 32635; 797const encodeTable = [ 798 0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3, 799 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, 800 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 801 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 802 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 803 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 804 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 805 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 806 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 807 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 808 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 809 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 810 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 811 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 812 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 813 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 814]; 815 816function encodeSample(sample) { 817 let sign; 818 let exponent; 819 let mantissa; 820 let muLawSample; 821 sign = (sample >> 8) & 0x80; 822 if (sign !== 0) sample = -sample; 823 sample = sample + BIAS; 824 if (sample > CLIP) sample = CLIP; 825 exponent = encodeTable[(sample>>7) & 0xFF]; 826 mantissa = (sample >> (exponent+3)) & 0x0F; 827 muLawSample = ~(sign | (exponent << 4) | mantissa); 828 829 return muLawSample; 830} 831 832class RawAudioProcessor extends AudioWorkletProcessor { 833 constructor() { 834 super(); 835 836 this.port.onmessage = ({ data }) => { 837 switch (data.type) { 838 case "setFormat": 839 this.isMuted = false; 840 this.buffer = []; // Initialize an empty buffer 841 this.bufferSize = data.sampleRate / 4; 842 this.format = data.format; 843 844 if (globalThis.LibSampleRate && sampleRate !== data.sampleRate) { 845 globalThis.LibSampleRate.create(1, sampleRate, data.sampleRate).then(resampler => { 846 this.resampler = resampler; 847 }); 848 } 849 break; 850 case "setMuted": 851 this.isMuted = data.isMuted; 852 break; 853 } 854 }; 855 } 856 process(inputs) { 857 if (!this.buffer) { 858 return true; 859 } 860 861 const input = inputs[0]; // Get the first input node 862 if (input.length > 0) { 863 let channelData = input[0]; // Get the first channel's data 864 865 // Resample the audio if necessary 866 if (this.resampler) { 867 channelData = this.resampler.full(channelData); 868 } 869 870 // Add channel data to the buffer 871 this.buffer.push(...channelData); 872 // Get max volume 873 let sum = 0.0; 874 for (let i = 0; i < channelData.length; i++) { 875 sum += channelData[i] * channelData[i]; 876 } 877 const maxVolume = Math.sqrt(sum / channelData.length); 878 // Check if buffer size has reached or exceeded the threshold 879 if (this.buffer.length >= this.bufferSize) { 880 const float32Array = this.isMuted 881 ? new Float32Array(this.buffer.length) 882 : new Float32Array(this.buffer); 883 884 let encodedArray = this.format === "ulaw" 885 ? new Uint8Array(float32Array.length) 886 : new Int16Array(float32Array.length); 887 888 // Iterate through the Float32Array and convert each sample to PCM16 889 for (let i = 0; i < float32Array.length; i++) { 890 // Clamp the value to the range [-1, 1] 891 let sample = Math.max(-1, Math.min(1, float32Array[i])); 892 893 // Scale the sample to the range [-32768, 32767] 894 let value = sample < 0 ? sample * 32768 : sample * 32767; 895 if (this.format === "ulaw") { 896 value = encodeSample(Math.round(value)); 897 } 898 899 encodedArray[i] = value; 900 } 901 902 // Send the buffered data to the main script 903 this.port.postMessage([encodedArray, maxVolume]); 904 905 // Clear the buffer after sending 906 this.buffer = []; 907 } 908 } 909 return true; // Continue processing 910 } 911} 912registerProcessor("rawAudioProcessor", RawAudioProcessor); 913`);class Xu extends Mne{constructor(e,n,r,i,s={}){super(s),this.conversationId=void 0,this.inputFormat=void 0,this.outputFormat=void 0,this.room=void 0,this.isConnected=!1,this.audioEventId=1,this.audioCaptureContext=null,this.audioElements=[],this.outputDeviceId=null,this.outputAnalyser=null,this.outputFrequencyData=null,this.room=e,this.conversationId=n,this.inputFormat=r,this.outputFormat=i,this.setupRoomEventListeners()}static async create(e){let n;if("conversationToken"in e&&e.conversationToken)n=e.conversationToken;else{if(!("agentId"in e)||!e.agentId)throw new Error("Either conversationToken or agentId is required for WebRTC connection");try{var r,i,s;const c=((r=e.overrides)==null||(r=r.client)==null?void 0:r.version)||Nne,u=((i=e.overrides)==null||(i=i.client)==null?void 0:i.source)||"js_s
913dk",d=`${a=(s=e.origin)!=null?s:"https://api.elevenlabs.io",a.replace(/^wss:\/\//,"https://")}/v1/convai/conversation/token?agent_id=${e.agentId}&source=${u}&version=${c}`,f=await fetch(d);if(!f.ok)throw new Error(`ElevenLabs API returned ${f.status} ${f.statusText}`);if(n=(await f.json()).token,!n)throw new Error("No conversation token received from API")}catch(c){let u=c instanceof Error?c.message:String(c);throw c instanceof Error&&c.message.includes("401")&&(u="Your agent has authentication enabled, but no signed URL or conversation token was provided."),new Error(`Failed to fetch conversation token for agent ${e.agentId}: ${u}`)}}var a;const o=new Hv;try{const c=`room_${Date.now()}`,u=AS("pcm_48000"),d=AS("pcm_48000"),f=new Xu(o,c,u,d,e),h=e.livekitUrl||"wss://livekit.rtc.elevenlabs.io";var l;await o.connect(h,n),await new Promise(m=>{if(f.isConnected)m();else{const g=()=>{o.off(Ve.Connected,g),m()};o.on(Ve.Connected,g)}}),o.name&&(f.conversationId=((l=o.name.match(/(conv_[a-zA-Z0-9]+)/))==null?void 0:l[0])||o.name),await o.localParticipant.setMicrophoneEnabled(!0);const p=Ine(e);return f.debug({type:Rne,message:p}),await f.sendMessage(p),f}catch(c){throw await o.disconnect(),c}}setupRoomEventListeners(){var e=this;this.room.on(Ve.Connected,async function(){e.isConnected=!0,console.info("WebRTC room connected")}),this.room.on(Ve.Disconnected,n=>{this.isConnected=!1,this.disconnect({reason:"agent",context:new CloseEvent("close",{reason:n==null?void 0:n.toString()})})}),this.room.on(Ve.ConnectionStateChanged,n=>{n===Bn.Disconnected&&(this.isConnected=!1,this.disconnect({reason:"error",message:`LiveKit connection state changed to ${n}`,context:new Event("connection_state_changed")}))}),this.room.on(Ve.DataReceived,(n,r)=>{try{const i=JSON.parse(new TextDecoder().decode(n));if(i.type==="audio")return;l3(i)?this.handleMessage(i):console.warn("Invalid socket event received:",i)}catch(i){console.warn("Failed to parse incoming data message:",i),console.warn("Raw payload:",new TextDecoder().decode(n))}}),this.room.on(Ve.TrackSubscribed,async function(n,r,i){if(n.kind===je.Kind.Audio&&i.identity.includes("agent")){const s=n,a=s.attach();if(a.autoplay=!0,a.controls=!1,e.outputDeviceId&&a.setSinkId)try{await a.setSinkId(e.outputDeviceId)}catch(o){console.warn("Failed to set output device for new audio element:",o)}a.style.display="none",document.body.appendChild(a),e.audioElements.push(a),e.audioElements.length===1&&(e.onDebug==null||e.onDebug({type:"audio_element_ready"})),await e.setupAudioCapture(s)}}),this.room.on(Ve.ActiveSpeakersChanged,async function(n){e.updateMode(n.length>0&&n[0].identity.startsWith("agent")?"speaking":"listening")}),this.room.on(Ve.ParticipantDisconnected,n=>{var r;(r=n.identity)!=null&&r.startsWith("agent")&&this.disconnect({reason:"agent",context:new CloseEvent("close",{reason:"agent disconnected"})})})}close(){if(this.isConnected){try{this.room.localParticipant.audioTrackPublications.forEach(e=>{e.track&&e.track.stop()})}catch(e){console.warn("Error stopping local tracks:",e)}this.audioCaptureContext&&(this.audioCaptureContext.close().catch(e=>{console.warn("Error closing audio capture context:",e)}),this.audioCaptureContext=null),this.audioElements.forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)}),this.audioElements=[],this.room.disconnect()}}async sendMessage(e){if(this.isConnected&&this.room.localParticipant){if(!("user_audio_chunk"in e))try{const n=new TextEncoder().encode(JSON.stringify(e));await this.room.localParticipant.publishData(n,{reliable:!0})}catch(n){this.debug({type:"send_message_error",message:{message:e,error:n}}),console.error("Failed to send message via WebRTC:",n)}}else console.warn("Cannot send message: room not connected or no local participant")}getRoom(){return this.room}async setMicMuted(e){if(!this.isConnected||!this.room.localParticipant)return void console.warn("Cannot set microphone muted: room not connected or no local participant");const n=this.room.localParticipant.getTrackPublication(je.Source.Microphone);if(n!=null&&n.track)try{e?await n.track.mute():await n.track.unmute()}catch{await this.room.localParticipant.setMicrophoneEnabled(!e)}else await this.room.localParticipant.setMicrophoneEnabled(!e)}async setupAudioCapture(e){try{const n=new AudioContext;this.audioCaptureContext=n,this.outputAnalyser=n.createAnalyser(),this.outputAnalyser.fftSize=2048,this.outputAnalyser.smoothingTimeConstant=.8;const r=new MediaStream([e.mediaStreamTrack]),i=n.createMediaStreamSource(r);i.connect(this.outputAnalyser),await Fne(n.audioWorklet);const s=new AudioWorkletNode(n,"rawAudioProcessor");this.outputAnalyser.connect(s),s.port.postMessage({type:"setFormat",format:this.outputFormat.format,sampleRate:this.outputFormat.sampleRate}),s.port.onmessage=a=>{const[o,l]=a.data;if(l>.01){const c=One(o.buffer),u=this.audioEventId++;this.handleMessage({type:"audio",audio_event:{audio_base_64:c,event_id:u}})}},i.connect(s)}catch(n){console.warn("Failed to set up audio capture:",n)}}
913setAudioVolume(e){this.audioElements.forEach(n=>{n.volume=e})}async setAudioOutputDevice(e){if(!("setSinkId"in HTMLAudioElement.prototype))throw new Error("setSinkId is not supported in this browser");const n=this.audioElements.map(async function(r){try{await r.setSinkId(e)}catch(i){throw console.error("Failed to set sink ID for audio element:",i),i}});await Promise.all(n),this.outputDeviceId=e}async setAudioInputDevice(e){if(!this.isConnected||!this.room.localParticipant)throw new Error("Cannot change input device: room not connected or no local participant");try{const n=this.room.localParticipant.getTrackPublication(je.Source.Microphone);n!=null&&n.track&&(await n.track.stop(),await this.room.localParticipant.unpublishTrack(n.track));const r={deviceId:{exact:e},echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,channelCount:{ideal:1}},i=await Ene(r);await this.room.localParticipant.publishTrack(i,{name:"microphone",source:je.Source.Microphone})}catch(n){console.error("Failed to change input device:",n);try{await this.room.localParticipant.setMicrophoneEnabled(!0)}catch(r){console.error("Failed to recover microphone after device switch error:",r)}throw n}}getOutputByteFrequencyData(){return this.outputAnalyser?(this.outputFrequencyData!=null||(this.outputFrequencyData=new Uint8Array(this.outputAnalyser.frequencyBinCount)),this.outputAnalyser.getByteFrequencyData(this.outputFrequencyData),this.outputFrequencyData):null}}async function jne(t){const e=function(n){return n.connectionType?n.connectionType:"conversationToken"in n&&n.conversationToken?"webrtc":"websocket"}(t);switch(e){case"websocket":return c3.create(t);case"webrtc":return Xu.create(t);default:throw new Error(`Unknown connection type: ${e}`)}}function u3(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}async function Bne(t={default:0,android:3e3}){let e=t.default;var n;if(/android/i.test(navigator.userAgent))e=(n=t.android)!=null?n:e;else if(u3()){var r;e=(r=t.ios)!=null?r:e}e>0&&await new Promise(i=>setTimeout(i,e))}class QO extends Hw{static async startSession(e){const n=Hw.getFullOptions(e);n.onStatusChange&&n.onStatusChange({status:"connecting"}),n.onCanSendFeedbackChange&&n.onCanSendFeedbackChange({canSendFeedback:!1}),n.onModeChange&&n.onModeChange({mode:"listening"}),n.onCanSendFeedbackChange&&n.onCanSendFeedbackChange({canSendFeedback:!1});let r=null;try{return await Bne(n.connectionDelay),r=await jne(e),new QO(n,r)}catch(s){var i;throw n.onStatusChange&&n.onStatusChange({status:"disconnected"}),(i=r)==null||i.close(),s}}}const Fz={echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,channelCount:{ideal:1}};class gv{static async create({sampleRate:e,format:n,preferHeadphonesForIosDevices:r,inputDeviceId:i,workletPaths:s,libsampleratePath:a}){let o=null,l=null;try{const d=ad({sampleRate:{ideal:e}},Fz);if(u3()&&r){const v=(await window.navigator.mediaDevices.enumerateDevices()).find(_=>_.kind==="audioinput"&&["airpod","headphone","earphone"].find(b=>_.label.toLowerCase().includes(b)));v&&(d.deviceId={ideal:v.deviceId})}i&&(d.deviceId=gv.getDeviceIdConstraint(i));const f=navigator.mediaDevices.getSupportedConstraints().sampleRate;o=new window.AudioContext(f?{sampleRate:e}:{});const h=o.createAnalyser();if(!f){const v=a||"https://cdn.jsdelivr.net/npm/@alexanderolsen/[email protected]/dist/libsamplerate.worklet.js";await o.audioWorklet.addModule(v)}await Fne(o.audioWorklet,s==null?void 0:s.rawAudioProcessor);const p=ad({voiceIsolation:!0},d);l=await navigator.mediaDevices.getUserMedia({audio:p});const m=o.createMediaStreamSource(l),g=new AudioWorkletNode(o,"rawAudioProcessor");return g.port.postMessage({type:"setFormat",format:n,sampleRate:e}),m.connect(h),h.connect(g),await o.resume(),new gv(o,h,g,l,m)}catch(d){var c,u;throw(c=l)==null||c.getTracks().forEach(f=>{f.stop()}),(u=o)==null||u.close(),d}}static getDeviceIdConstraint(e){if(e)return u3()?{ideal:e}:{exact:e}}constructor(e,n,r,i,s){this.context=void 0,this.analyser=void 0,this.worklet=void 0,this.inputStream=void 0,this.mediaStreamSource=void 0,this.context=e,this.analyser=n,this.worklet=r,this.inputStream=i,this.mediaStreamSource=s}
913async close(){this.inputStream.getTracks().forEach(e=>{e.stop()}),this.mediaStreamSource.disconnect(),await this.context.close()}setMuted(e){this.worklet.port.postMessage({type:"setMuted",isMuted:e})}async setInputDevice(e){try{const n=ad({},Fz);e&&(n.deviceId=gv.getDeviceIdConstraint(e));const r=ad({voiceIsolation:!0},n),i=await navigator.mediaDevices.getUserMedia({audio:r});this.inputStream.getTracks().forEach(s=>{s.stop()}),this.mediaStreamSource.disconnect(),this.inputStream=i,this.mediaStreamSource=this.context.createMediaStreamSource(i),this.mediaStreamSource.connect(this.analyser)}catch(n){throw console.error("Failed to switch input device:",n),n}}}const VUe=Dne("audioConcatProcessor",`/* 914 * ulaw decoding logic taken from the wavefile library 915 * https://github.com/rochars/wavefile/blob/master/lib/codecs/mulaw.js 916 * USED BY @elevenlabs/client 917 */ 918 919const decodeTable = [0,132,396,924,1980,4092,8316,16764]; 920 921function decodeSample(muLawSample) { 922 let sign; 923 let exponent; 924 let mantissa; 925 let sample; 926 muLawSample = ~muLawSample; 927 sign = (muLawSample & 0x80); 928 exponent = (muLawSample >> 4) & 0x07; 929 mantissa = muLawSample & 0x0F; 930 sample = decodeTable[exponent] + (mantissa << (exponent+3)); 931 if (sign !== 0) sample = -sample; 932 933 return sample; 934} 935 936class AudioConcatProcessor extends AudioWorkletProcessor { 937 constructor() { 938 super(); 939 this.buffers = []; // Initialize an empty buffer 940 this.cursor = 0; 941 this.currentBuffer = null; 942 this.wasInterrupted = false; 943 this.finished = false; 944 945 this.port.onmessage = ({ data }) => { 946 switch (data.type) { 947 case "setFormat": 948 this.format = data.format; 949 break; 950 case "buffer": 951 this.wasInterrupted = false; 952 this.buffers.push( 953 this.format === "ulaw" 954 ? new Uint8Array(data.buffer) 955 : new Int16Array(data.buffer) 956 ); 957 break; 958 case "interrupt": 959 this.wasInterrupted = true; 960 break; 961 case "clearInterrupted": 962 if (this.wasInterrupted) { 963 this.wasInterrupted = false; 964 this.buffers = []; 965 this.currentBuffer = null; 966 } 967 } 968 }; 969 } 970 process(_, outputs) { 971 let finished = false; 972 const output = outputs[0][0]; 973 for (let i = 0; i < output.length; i++) { 974 if (!this.currentBuffer) { 975 if (this.buffers.length === 0) { 976 finished = true; 977 break; 978 } 979 this.currentBuffer = this.buffers.shift(); 980 this.cursor = 0; 981 } 982 983 let value = this.currentBuffer[this.cursor]; 984 if (this.format === "ulaw") { 985 value = decodeSample(value); 986 } 987 output[i] = value / 32768; 988 this.cursor++; 989 990 if (this.cursor >= this.currentBuffer.length) { 991 this.currentBuffer = null; 992 } 993 } 994 995 if (this.finished !== finished) { 996 this.finished = finished; 997 this.port.postMessage({ type: "process", finished }); 998 } 999 1000 return true; // Continue processing 1001 } 1002} 1003 1004registerProcessor("audioConcatProcessor", AudioConcatProcessor); 1005`);class PS{static async create({sampleRate:e,format:n,outputDeviceId:r,workletPaths:i}){let s=null,a=null;try{s=new AudioContext({sampleRate:e});const c=s.createAnalyser(),u=s.createGain();a=new Audio,a.src="",a.load(),a.autoplay=!0,a.style.display="none",document.body.appendChild(a);const d=s.createMediaStreamDestination();a.srcObject=d.stream,u.connect(c),c.connect(d),await VUe(s.audioWorklet,i==null?void 0:i.audioConcatProcessor);const f=new AudioWorkletNode(s,"audioConcatProcessor");return f.port.postMessage({type:"setFormat",format:n}),f.connect(u),await s.resume(),r&&a.setSinkId&&await a.setSinkId(r),new PS(s,c,u,f,a)}catch(c){var o,l;throw(o=a)!=null&&o.parentNode&&a.parentNode.removeChild(a),(l=a)==null||l.pause(),s&&s.state!=="closed"&&await s.close(),c}}constructor(e,n,r,i,s){this.context=void 0,this.analyser=void 0,this.gain=void 0,this.worklet=void 0,this.audioElement=void 0,this.context=e,this.analyser=n,this.gain=r,this.worklet=i,this.audioElement=s}async setOutputDevice(e){if(!("setSinkId"in HTMLAudioElement.prototype))throw new Error("setSinkId is not supported in this browser");await this.audioElement.setSinkId(e||"")}async close(){this.audioElement.parentNode&&this.audioElement.parentNode.removeChild(this.audioElement),this.audioElement.pause(),await this.context.close()}}class ZO extends Hw{static async startSession(e){var n;const r=Hw.getFullOptions(e);r.onStatusChange&&r.onStatusChange({status:"connecting"}),r.onCanSendFeedbackChange&&r.onCanSendFeedbackChange({canSendFeedback:!1});let i=null,s=null,a=null,o=null,l=null;if((n=e.useWakeLock)==null||n)try{l=await navigator.wakeLock.request("screen")}catch{}try{var c;return o=await navigator.mediaDevices.getUserMedia({audio:!0}),await Bne(r.connectionDelay),s=await jne(e),[i,a]=await Promise.all([gv.create(ad({},s.inputFormat,{preferHeadphonesForIosDevices:e.preferHeadphonesForIosDevices,inputDeviceId:e.inputDeviceId,workletPaths:e.workletPaths,libsampleratePath:e.libsampleratePath})),PS.create(ad({},s.outputFormat,{outputDeviceId:e.outputDeviceId,workletPaths:e.workletPaths}
1005))]),(c=o)==null||c.getTracks().forEach(m=>{m.stop()}),o=null,new ZO(r,s,i,a,l)}catch(m){var u,d,f,h;r.onStatusChange&&r.onStatusChange({status:"disconnected"}),(u=o)==null||u.getTracks().forEach(g=>{g.stop()}),(d=s)==null||d.close(),await((f=i)==null?void 0:f.close()),await((h=a)==null?void 0:h.close());try{var p;await((p=l)==null?void 0:p.release()),l=null}catch{}throw m}}constructor(e,n,r,i,s){super(e,n),this.input=void 0,this.output=void 0,this.wakeLock=void 0,this.inputFrequencyData=void 0,this.outputFrequencyData=void 0,this.onInputWorkletMessage=a=>{this.status==="connected"&&this.connection.sendMessage({user_audio_chunk:One(a.data[0].buffer)})},this.onOutputWorkletMessage=({data:a})=>{a.type==="process"&&this.updateMode(a.finished?"listening":"speaking")},this.addAudioBase64Chunk=a=>{this.output.gain.gain.cancelScheduledValues(this.output.context.currentTime),this.output.gain.gain.value=this.volume,this.output.worklet.port.postMessage({type:"clearInterrupted"}),this.output.worklet.port.postMessage({type:"buffer",buffer:$Ue(a)})},this.fadeOutAudio=()=>{this.updateMode("listening"),this.output.worklet.port.postMessage({type:"interrupt"}),this.output.gain.gain.exponentialRampToValueAtTime(1e-4,this.output.context.currentTime+2),setTimeout(()=>{this.output.gain.gain.value=this.volume,this.output.worklet.port.postMessage({type:"clearInterrupted"})},2e3)},this.calculateVolume=a=>{if(a.length===0)return 0;let o=0;for(let l=0;l<a.length;l++)o+=a[l]/255;return o/=a.length,o<0?0:o>1?1:o},this.setVolume=({volume:a})=>{const o=Number.isFinite(a)?Math.min(1,Math.max(0,a)):1;this.volume=o,this.connection instanceof Xu?this.connection.setAudioVolume(o):this.output.gain.gain.value=o},this.input=r,this.output=i,this.wakeLock=s,this.input.worklet.port.onmessage=this.onInputWorkletMessage,this.output.worklet.port.onmessage=this.onOutputWorkletMessage}async handleEndSession(){await super.handleEndSession();try{var e;await((e=this.wakeLock)==null?void 0:e.release()),this.wakeLock=null}catch{}await this.input.close(),await this.output.close()}handleInterruption(e){super.handleInterruption(e),this.fadeOutAudio()}handleAudio(e){var n,r;this.lastInterruptTimestamp<=e.audio_event.event_id&&((n=(r=this.options).onAudio)==null||n.call(r,e.audio_event.audio_base_64),this.connection instanceof Xu||this.addAudioBase64Chunk(e.audio_event.audio_base_64),this.currentEventId=e.audio_event.event_id,this.updateCanSendFeedback(),this.updateMode("speaking"))}setMicMuted(e){this.connection instanceof Xu?this.connection.setMicMuted(e):this.input.setMuted(e)}getInputByteFrequencyData(){return this.inputFrequencyData!=null||(this.inputFrequencyData=new Uint8Array(this.input.analyser.frequencyBinCount)),this.input.analyser.getByteFrequencyData(this.inputFrequencyData),this.inputFrequencyData}getOutputByteFrequencyData(){return this.connection instanceof Xu?this.connection.getOutputByteFrequencyData()||new Uint8Array(1024):(this.outputFrequencyData!=null||(this.outputFrequencyData=new Uint8Array(this.output.analyser.frequencyBinCount)),this.output.analyser.getByteFrequencyData(this.outputFrequencyData),this.outputFrequencyData)}getInputVolume(){return this.calculateVolume(this.getInputByteFrequencyData())}getOutputVolume(){return this.calculateVolume(this.getOutputByteFrequencyData())}async changeInputDevice({sampleRate:e,format:n,preferHeadphonesForIosDevices:r,inputDeviceId:i}){try{if(this.connection instanceof c3)try{return await this.input.setInputDevice(i),this.input}catch(a){console.warn("Failed to change device on existing input, recreating:",a)}this.connection instanceof Xu&&await this.connection.setAudioInputDevice(i||""),await this.input.close();const s=await gv.create({sampleRate:e??this.connection.inputFormat.sampleRate,format:n??this.connection.inputFormat.format,preferHeadphonesForIosDevices:r,inputDeviceId:i,workletPaths:this.options.workletPaths,libsampleratePath:this.options.libsampleratePath});return this.input=s,this.input.worklet.port.onmessage=this.onInputWorkletMessage,this.input}catch(s){throw console.error("Error changing input device",s),s}}async changeOutputDevice({sampleRate:e,format:n,outputDeviceId:r}){try{if(this.connection instanceof c3)try{return await this.output.setOutputDevice(r),this.output}catch(s){console.warn("Failed to change device on existing output, recreating:",s)}this.connection instanceof Xu&&await this.connection.setAudioOutputDevice(r||""),await this.output.close();const i=await PS.create({sampleRate:e??this.connection.outputFormat.sampleRate,format:n??this.connection.outputFormat.format,outputDeviceId:r,workletPaths:this.options.workletPaths});return this.output=i,this.output}catch(i){throw console.error("Error changing output device",i),i}}}var jz;(function(t){t.SESSION_STARTED="session_started",t.PARTIAL_TRANSCRIPT="partial_transcript",t.COMMITTED_TRANSCRIPT="committed_transcript",t.COMMITTED_TRANSCRIPT_WITH_TIMESTAMPS="committed_transcript_with_timestamps",t.AUTH_ERROR="auth_error",t.ERROR="error",t.OPEN="open",t.CLOSE="close",t.QUOTA_EXCEEDED="quota_exceeded",t.COMMIT_THROTTLED="commit_throttled",t.TRANSCRIBER_ERROR="transcriber_error",t.UNACCEPTED_TERMS="unaccepted_terms",t.RATE_LIMITED="rate_limited",t.INPUT_ERROR="input_error",t.QUEUE_OVERFLOW="queue_overflow",t.RESOURCE_EXHAUSTED="resource_exhausted",t.SESSION_TIME_LIMIT_EXCEEDED="session_time_limit_exceeded",t.CHUNK_SIZE_EXCEEDED="chunk_size_exceeded",t.INSUFFICIENT_AU
1005DIO_ACTIVITY="insufficient_audio_activity"})(jz||(jz={}));var Bz,Uz;(function(t){t.PCM_8000="pcm_8000",t.PCM_16000="pcm_16000",t.PCM_22050="pcm_22050",t.PCM_24000="pcm_24000",t.PCM_44100="pcm_44100",t.PCM_48000="pcm_48000",t.ULAW_8000="ulaw_8000"})(Bz||(Bz={})),function(t){t.MANUAL="manual",t.VAD="vad"}(Uz||(Uz={}));class qUe extends Hw{static startSession(e){return e.textOnly?QO.startSession(e):ZO.startSession(e)}}function U_(){return U_=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},U_.apply(null,arguments)}const WUe=["micMuted","volume","serverLocation"];function GUe(t="us"){switch(t){case"eu-residency":case"in-residency":case"us":case"global":return t;default:return console.warn(`[ConversationalAI] Invalid server-location: ${t}. Defaulting to "us"`),"us"}}function HUe(t){return{us:"wss://api.elevenlabs.io","eu-residency":"wss://api.eu.residency.elevenlabs.io","in-residency":"wss://api.in.residency.elevenlabs.io",global:"wss://api.elevenlabs.io"}[t]}function KUe(t){return{us:"wss://livekit.rtc.elevenlabs.io","eu-residency":"wss://livekit.rtc.eu.residency.elevenlabs.io","in-residency":"wss://livekit.rtc.in.residency.elevenlabs.io",global:"wss://livekit.rtc.elevenlabs.io"}[t]}function JUe(t={}){const{micMuted:e,volume:n,serverLocation:r}=t,i=function(g,v){if(g==null)return{};var _={};for(var b in g)if({}.hasOwnProperty.call(g,b)){if(v.indexOf(b)!==-1)continue;_[b]=g[b]}return _}(t,WUe),s=I.useRef(null),a=I.useRef(null),o=I.useRef(!1),[l,c]=I.useState("disconnected"),[u,d]=I.useState(!1),[f,h]=I.useState("listening"),p=I.useRef(e),m=I.useRef(n);return p.current=e,m.current=n,I.useEffect(()=>{var g;e!==void 0&&(s==null||(g=s.current)==null||g.setMicMuted(e))},[e]),I.useEffect(()=>{var g;n!==void 0&&(s==null||(g=s.current)==null||g.setVolume({volume:n}))},[n]),I.useEffect(()=>()=>{var g;o.current=!0,a.current?a.current.then(v=>v.endSession()):(g=s.current)==null||g.endSession()},[]),{startSession:async g=>{var v;if((v=s.current)!=null&&v.isOpen())return s.current.getId();if(a.current)return(await a.current).getId();o.current=!1;try{var _,b,x,T,N,A,L,M,B,R;const j=GUe((g==null?void 0:g.serverLocation)||r),$=HUe(j),U=KUe(j);if(a.current=qUe.startSession(U_({},i??{},g??{},{origin:$,livekitUrl:(g==null?void 0:g.livekitUrl)||(i==null?void 0:i.livekitUrl)||U,overrides:U_({},(_=i==null?void 0:i.overrides)!=null?_:{},(b=g==null?void 0:g.overrides)!=null?b:{},{client:U_({},(x=i==null||(T=i.overrides)==null?void 0:T.client)!=null?x:{},(N=g==null||(A=g.overrides)==null?void 0:A.client)!=null?N:{},{source:(g==null||(L=g.overrides)==null||(L=L.client)==null?void 0:L.source)||(i==null||(M=i.overrides)==null||(M=M.client)==null?void 0:M.source)||"react_sdk",version:(g==null||(B=g.overrides)==null||(B=B.client)==null?void 0:B.version)||(i==null||(R=i.overrides)==null||(R=R.client)==null?void 0:R.version)||"0.12.3"})}),onConnect:(g==null?void 0:g.onConnect)||(i==null?void 0:i.onConnect),onDisconnect:(g==null?void 0:g.onDisconnect)||(i==null?void 0:i.onDisconnect),onError:(g==null?void 0:g.onError)||(i==null?void 0:i.onError),onMessage:(g==null?void 0:g.onMessage)||(i==null?void 0:i.onMessage),onAudio:(g==null?void 0:g.onAudio)||(i==null?void 0:i.onAudio),onDebug:(g==null?void 0:g.onDebug)||(i==null?void 0:i.onDebug),onUnhandledClientToolCall:(g==null?void 0:g.onUnhandledClientToolCall)||(i==null?void 0:i.onUnhandledClientToolCall),onVadScore:(g==null?void 0:g.onVadScore)||(i==null?void 0:i.onVadScore),onInterruption:(g==null?void 0:g.onInterruption)||(i==null?void 0:i.onInterruption),onAgentToolRequest:(g==null?void 0:g.onAgentToolRequest)||(i==null?void 0:i.onAgentToolRequest),onAgentToolResponse:(g==null?void 0:g.onAgentToolResponse)||(i==null?void 0:i.onAgentToolResponse),onConversationMetadata:(g==null?void 0:g.onConversationMetadata)||(i==null?void 0:i.onConversationMetadata),onMCPToolCall:(g==null?void 0:g.onMCPToolCall)||(i==null?void 0:i.onMCPToolCall),onMCPConnectionStatus:(g==null?void 0:g.onMCPConnectionStatus)||(i==null?void 0:i.onMCP
1005ConnectionStatus),onAsrInitiationMetadata:(g==null?void 0:g.onAsrInitiationMetadata)||(i==null?void 0:i.onAsrInitiationMetadata),onAgentChatResponsePart:(g==null?void 0:g.onAgentChatResponsePart)||(i==null?void 0:i.onAgentChatResponsePart),onModeChange:({mode:te})=>{var ne;h(te),(ne=(g==null?void 0:g.onModeChange)||(i==null?void 0:i.onModeChange))==null||ne({mode:te})},onStatusChange:({status:te})=>{var ne;c(te),(ne=(g==null?void 0:g.onStatusChange)||(i==null?void 0:i.onStatusChange))==null||ne({status:te})},onCanSendFeedbackChange:({canSendFeedback:te})=>{var ne;d(te),(ne=(g==null?void 0:g.onCanSendFeedbackChange)||(i==null?void 0:i.onCanSendFeedbackChange))==null||ne({canSendFeedback:te})}})),s.current=await a.current,o.current)throw await s.current.endSession(),s.current=null,a.current=null,new Error("Session cancelled during connection");return p.current!==void 0&&s.current.setMicMuted(p.current),m.current!==void 0&&s.current.setVolume({volume:m.current}),s.current.getId()}finally{a.current=null}},endSession:async()=>{o.current=!0;const g=a.current,v=s.current;s.current=null,g?await(await g).endSession():await(v==null?void 0:v.endSession())},setVolume:({volume:g})=>{var v;(v=s.current)==null||v.setVolume({volume:g})},getInputByteFrequencyData:()=>{var g;return(g=s.current)==null?void 0:g.getInputByteFrequencyData()},getOutputByteFrequencyData:()=>{var g;return(g=s.current)==null?void 0:g.getOutputByteFrequencyData()},getInputVolume:()=>{var g,v;return(g=(v=s.current)==null?void 0:v.getInputVolume())!=null?g:0},getOutputVolume:()=>{var g,v;return(g=(v=s.current)==null?void 0:v.getOutputVolume())!=null?g:0},sendFeedback:g=>{var v;(v=s.current)==null||v.sendFeedback(g)},getId:()=>{var g;return(g=s.current)==null?void 0:g.getId()},sendContextualUpdate:g=>{var v;(v=s.current)==null||v.sendContextualUpdate(g)},sendUserMessage:g=>{var v;(v=s.current)==null||v.sendUserMessage(g)},sendUserActivity:()=>{var g;(g=s.current)==null||g.sendUserActivity()},sendMCPToolApprovalResult:(g,v)=>{var _;(_=s.current)==null||_.sendMCPToolApprovalResult(g,v)},changeInputDevice:async g=>{if(s.current&&"changeInputDevice"in s.current)return await s.current.changeInputDevice(g);throw new Error("Device switching is only available for voice conversations")},changeOutputDevice:async g=>{if(s.current&&"changeOutputDevice"in s.current)return await s.current.changeOutputDevice(g);throw new Error("Device switching is only available for voice conversations")},status:l,canSendFeedback:u,micMuted:e,isSpeaking:f==="speaking"}}const Une=I.forwardRef(({className:t,...e},n)=>w.jsx("div",{ref:n,className:vt("rounded-lg border bg-card text-card-foreground shadow-sm",t),...e}));Une.displayName="Card";const zne=I.forwardRef(({className:t,...e},n)=>w.jsx("div",{ref:n,className:vt("flex flex-col space-y-1.5 p-6",t),...e}));zne.displayName="CardHeader";const $ne=I.forwardRef(({className:t,...e},n)=>w.jsx("h3",{ref:n,className:vt("text-2xl font-semibold leading-none tracking-tight",t),...e}));$ne.displayName="CardTitle";const Vne=I.forwardRef(({className:t,...e},n)=>w.jsx("p",{ref:n,className:vt("text-sm text-muted-foreground",t),...e}));Vne.displayName="CardDescription";const qne=I.forwardRef(({className:t,...e},n)=>w.jsx("div",{ref:n,className:vt("p-6 pt-0",t),...e}));qne.displayName="CardContent";const YUe=I.forwardRef(({className:t,...e},n)=>w.jsx("div",{ref:n,className:vt("flex items-center p-6 pt-0",t),...e}));YUe.displayName="CardFooter";function XUe(){const[t,e]=I.useState(!1),[n,r]=I.useState(!1),[i,s]=I.useState([]),a=JUe({onConnect:()=>{console.log("Connected to voice agent"),Ib.success("Connected to NautIQ Voice Assistant")},onDisconnect:()=>{console.log("Disconnected from voice agent"),Ib.info("Voice call ended")},onMessage:f=>{console.log("Message:",f),s(h=>[...h,{role:f.role,text:f.message}])},onError:f=>{console.error("Conversation error:",f),Ib.error("Voice connection error. Please try again."),e(!1)}}),o=I.useCallback(async()=>{e(!0);try{const{data:{session:f}}=await ba.auth.getSession();if(!f)throw new Error("Please log in to use the voice assistant");await navigator.mediaDevices.getUserMedia({audio:!0});const{data:h,error:p}=await ba.functions.invoke("elevenlabs-conversation-token");if(p||!(h!=null&&h.token))throw new Error((p==null?void 0:p.message)||"Failed to get conversation token");await a.startSession({conversationToken:h.token,connectionType:"webrtc"})}catch(f){console.error("Failed to start conversation:",f),Ib.error(f instanceof Error?f.message:"Failed to start voice call")}finally{e(!1)}},[a]),l=I.useCallback(async()=>{await a.endSession(),s([])},[a]),c=I.useCallback(async()=>{const f=!n;r(f),await a.setVolume({volume:f?0:1})},[a,n]),u=a.status==="connected",d=a.isSpeaking;return w.jsxs(Une,{className:"w-full max-w-2xl mx-auto bg-card/80 backdrop-blur-sm border-border/50",children:[w.jsxs(zne,{className:"text-center",children:[w.jsx($ne,{className:"text-2xl font-bold text-foreground",children:"NautIQ Voice Assistant"}),w.jsx(Vne,{children:"Talk to your AI-powered marine operations assistant"})]}),w.jsxs(qne,{className:"space-y-6",children:[w.jsx("div",{className:"flex items-center justify-center",children:w.jsxs("div",{className:vt("relative w-32 h-32 rounded-full flex items-center justify-center transition-all duration-500",u?d?"bg-primary/20 animate-pulse":"bg-green-500/20":"bg-muted"),children:[w.jsx("div",{className:vt("absolute inset-2 rounded-full transition-all duration-300",u?d?"bg-primary/30 animate-ping":"bg-green-500/30":"bg-muted/50")}),w.jsx("div",{className:vt("relative w-20 h-20 rounded-full flex items-center justify-center transition-all duration-300",u?d?"bg-primary shadow-lg shadow-primary/30":"bg-green-500 shadow-lg shadow-green-500/30":"bg-muted-foreground
1005/20"),children:t?w.jsx(y_,{className:"w-8 h-8 text-primary-foreground animate-spin"}):u?d?w.jsx(PF,{className:"w-8 h-8 text-primary-foreground"}):w.jsx(KV,{className:"w-8 h-8 text-primary-foreground animate-pulse"}):w.jsx(Bae,{className:"w-8 h-8 text-muted-foreground"})})]})}),w.jsx("p",{className:"text-center text-sm text-muted-foreground",children:t?"Connecting to voice assistant...":u?d?"Assistant is speaking...":"Listening... Speak now":"Click to start a voice conversation"}),i.length>0&&w.jsx("div",{className:"max-h-48 overflow-y-auto space-y-2 p-4 bg-muted/30 rounded-lg border border-border/30",children:i.map((f,h)=>w.jsxs("div",{className:vt("p-2 rounded-lg text-sm",f.role==="user"?"bg-primary/10 text-foreground ml-8":"bg-secondary/50 text-foreground mr-8"),children:[w.jsxs("span",{className:"font-medium text-xs text-muted-foreground",children:[f.role==="user"?"You":"NautIQ",":"]}),w.jsx("p",{className:"mt-1",children:f.text})]},h))}),w.jsx("div",{className:"flex items-center justify-center gap-4",children:u?w.jsxs(w.Fragment,{children:[w.jsx($t,{onClick:c,variant:"outline",size:"icon",className:vt("w-12 h-12 rounded-full",n&&"bg-destructive/10 text-destructive"),children:n?w.jsx(Hae,{className:"w-5 h-5"}):w.jsx(PF,{className:"w-5 h-5"})}),w.jsxs($t,{onClick:l,variant:"destructive",size:"lg",className:"gap-2",children:[w.jsx($ae,{className:"w-5 h-5"}),"End Call"]})]}):w.jsx($t,{onClick:o,disabled:t,size:"lg",className:"gap-2 bg-primary hover:bg-primary/90",children:t?w.jsxs(w.Fragment,{children:[w.jsx(y_,{className:"w-5 h-5 animate-spin"}),"Connecting..."]}):w.jsxs(w.Fragment,{children:[w.jsx(JV,{className:"w-5 h-5"}),"Start Voice Call"]})})})]})]})}const QUe=()=>w.jsx("div",{className:"min-h-screen p-6 bg-background",children:w.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[w.jsxs("div",{className:"text-center space-y-2",children:[w.jsx("h1",{className:"text-3xl font-bold text-foreground",children:"Voice Assistant"}),w.jsx("p",{className:"text-muted-foreground",children:"Interact with NautIQ using natural voice conversations"})]}),w.jsx(XUe,{}),w.jsx("div",{className:"text-center text-sm text-muted-foreground max-w-md mx-auto",children:w.jsx("p",{children:"Ask about vessel operations, maintenance schedules, AI predictions, or any other marine-related questions."})})]})}),ZUe=()=>{const t=Qp();return I.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",t.pathname)},[t.pathname]),w.jsx("div",{className:"flex min-h-screen items-center justify-center bg-muted",children:w.jsxs("div",{className:"text-center",children:[w.jsx("h1",{className:"mb-4 text-4xl font-bold",children:"404"}),w.jsx("p",{className:"mb-4 text-xl text-muted-foreground",children:"Oops! Page not found"}),w.jsx("a",{href:"/",className:"text-primary underline hover:text-primary/90",children:"Return to Home"})]})})},eh=({children:t})=>{const[e,n]=I.useState(!0),[r,i]=I.useState(null);return I.useEffect(()=>{const{data:{subscription:s}}=ba.auth.onAuthStateChange((a,o)=>{i((o==null?void 0:o.user)??null),n(!1)});return ba.auth.getSession().then(({data:{session:a}})=>{i((a==null?void 0:a.user)??null),n(!1)}),()=>s.unsubscribe()},[]),e?w.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background text-foreground",children:"Loading..."}):r?w.jsx(w.Fragment,{children:t}):w.jsx(ede,{to:"/login",replace:!0})},e7e=new due,t7e=()=>w.jsx(fue,{client:e7e,children:w.jsxs(jq,{children:[w.jsx(Roe,{}),w.jsx(ule,{}),w.jsx(ude,{children:w.jsxs(nde,{children:[w.jsx(pa,{path:"/",element:w.jsx(vde,{})}),w.jsx(pa,{path:"/login",element:w.jsx(lye,{})}),w.jsx(pa,{path:"/signup",element:w.jsx(uye,{})}),w.jsx(pa,{path:"/forgot-password",element:w.jsx(dye,{})}),w.jsx(pa,{path:"/reset-password",element:w.jsx(hye,{})}),w.jsx(pa,{path:"/dashboard",element:w.jsx(eh,{children:w.jsx(PIe,{})})}),w.jsx(pa,{path:"/operations",element:w.jsx(eh,{children:w.jsx(YIe,{})})}),w.jsx(pa,{path:"/predictions",element:w.jsx(eh,{children:w.jsx(QIe,{})})}),w.jsx(pa,{path:"/ml",element:w.jsx(eh,{children:w.jsx(aLe,{})})}),w.jsx(pa,{path:"/reports",element:w.jsx(eh,{children:w.jsx(JFe,{})})}),w.jsx(pa,{path:"/settings",element:w.jsx(eh,{children:w.jsx(r6e,{})})}),w.jsx(pa,{path:"/profile",element:w.jsx(eh,{children:w.jsx(i6e,{})})}),w.jsx(pa,{path:"/voice-assistant",element:w.jsx(eh,{children:w.jsx(QUe,{})})}),w.jsx(pa,{path:"*",element:w.jsx(ZUe,{})})]})})]})});fV(document.getElementById("root")).render(w.jsx(t7e,{}));export{sr as _,r7e as c,Zz as g};
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.