@scanupload/qr-code-generator 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("react");function Qt(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var be={exports:{}},pe={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -14,110 +14,110 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var et;function
|
|
17
|
+
*/var et;function Xt(){return et||(et=1,process.env.NODE_ENV!=="production"&&(function(){function r(u){if(u==null)return null;if(typeof u=="function")return u.$$typeof===Y?null:u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case j:return"Fragment";case B:return"Profiler";case k:return"StrictMode";case V:return"Suspense";case Z:return"SuspenseList";case G:return"Activity"}if(typeof u=="object")switch(typeof u.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),u.$$typeof){case p:return"Portal";case N:return u.displayName||"Context";case M:return(u._context.displayName||"Context")+".Consumer";case y:var b=u.render;return u=u.displayName,u||(u=b.displayName||b.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case ne:return b=u.displayName||null,b!==null?b:r(u.type)||"Memo";case J:b=u._payload,u=u._init;try{return r(u(b))}catch{}}return null}function e(u){return""+u}function t(u){try{e(u);var b=!1}catch{b=!0}if(b){b=console;var T=b.error,x=typeof Symbol=="function"&&Symbol.toStringTag&&u[Symbol.toStringTag]||u.constructor.name||"Object";return T.call(b,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",x),e(u)}}function n(u){if(u===j)return"<>";if(typeof u=="object"&&u!==null&&u.$$typeof===J)return"<...>";try{var b=r(u);return b?"<"+b+">":"<...>"}catch{return"<...>"}}function s(){var u=ee.A;return u===null?null:u.getOwner()}function o(){return Error("react-stack-top-frame")}function i(u){if(K.call(u,"key")){var b=Object.getOwnPropertyDescriptor(u,"key").get;if(b&&b.isReactWarning)return!1}return u.key!==void 0}function a(u,b){function T(){H||(H=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",b))}T.isReactWarning=!0,Object.defineProperty(u,"key",{get:T,configurable:!0})}function c(){var u=r(this.type);return oe[u]||(oe[u]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),u=this.props.ref,u!==void 0?u:null}function l(u,b,T,x,D,I){var v=T.ref;return u={$$typeof:w,type:u,key:b,props:T,_owner:x},(v!==void 0?v:null)!==null?Object.defineProperty(u,"ref",{enumerable:!1,get:c}):Object.defineProperty(u,"ref",{enumerable:!1,value:null}),u._store={},Object.defineProperty(u._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(u,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(u,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:D}),Object.defineProperty(u,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:I}),Object.freeze&&(Object.freeze(u.props),Object.freeze(u)),u}function h(u,b,T,x,D,I){var v=b.children;if(v!==void 0)if(x)if(Q(v)){for(x=0;x<v.length;x++)f(v[x]);Object.freeze&&Object.freeze(v)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else f(v);if(K.call(b,"key")){v=r(u);var C=Object.keys(b).filter(function(R){return R!=="key"});x=0<C.length?"{key: someKey, "+C.join(": ..., ")+": ...}":"{key: someKey}",_[v+x]||(C=0<C.length?"{"+C.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,
|
|
22
|
+
<%s key={someKey} {...props} />`,x,v,C,v),_[v+x]=!0)}if(v=null,T!==void 0&&(t(T),v=""+T),i(b)&&(t(b.key),v=""+b.key),"key"in b){T={};for(var P in b)P!=="key"&&(T[P]=b[P])}else T=b;return v&&a(T,typeof u=="function"?u.displayName||u.name||"Unknown":u),l(u,v,T,s(),D,I)}function f(u){g(u)?u._store&&(u._store.validated=1):typeof u=="object"&&u!==null&&u.$$typeof===J&&(u._payload.status==="fulfilled"?g(u._payload.value)&&u._payload.value._store&&(u._payload.value._store.validated=1):u._store&&(u._store.validated=1))}function g(u){return typeof u=="object"&&u!==null&&u.$$typeof===w}var E=O,w=Symbol.for("react.transitional.element"),p=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),B=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),N=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),V=Symbol.for("react.suspense"),Z=Symbol.for("react.suspense_list"),ne=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),Y=Symbol.for("react.client.reference"),ee=E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=Object.prototype.hasOwnProperty,Q=Array.isArray,te=console.createTask?console.createTask:function(){return null};E={react_stack_bottom_frame:function(u){return u()}};var H,oe={},ce=E.react_stack_bottom_frame.bind(E,o)(),le=te(n(o)),_={};_e.Fragment=j,_e.jsx=function(u,b,T){var x=1e4>ee.recentlyCreatedOwnerStacks++;return h(u,b,T,!1,x?Error("react-stack-top-frame"):ce,x?te(n(u)):le)},_e.jsxs=function(u,b,T){var x=1e4>ee.recentlyCreatedOwnerStacks++;return h(u,b,T,!0,x?Error("react-stack-top-frame"):ce,x?te(n(u)):le)}})()),_e}var tt;function Gt(){return tt||(tt=1,process.env.NODE_ENV==="production"?be.exports=Jt():be.exports=Xt()),be.exports}var m=Gt(),de={},Se={exports:{}},Ee={exports:{}},$={};/** @license React v16.13.1
|
|
23
23
|
* react-is.production.min.js
|
|
24
24
|
*
|
|
25
25
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
26
26
|
*
|
|
27
27
|
* This source code is licensed under the MIT license found in the
|
|
28
28
|
* LICENSE file in the root directory of this source tree.
|
|
29
|
-
*/var rt;function Kt(){if(rt)return $;rt=1;var r=typeof Symbol=="function"&&Symbol.for,e=r?Symbol.for("react.element"):60103,t=r?Symbol.for("react.portal"):60106,n=r?Symbol.for("react.fragment"):60107,s=r?Symbol.for("react.strict_mode"):60108,o=r?Symbol.for("react.profiler"):60114,i=r?Symbol.for("react.provider"):60109,a=r?Symbol.for("react.context"):60110,c=r?Symbol.for("react.async_mode"):60111,l=r?Symbol.for("react.concurrent_mode"):60111,h=r?Symbol.for("react.forward_ref"):60112,f=r?Symbol.for("react.suspense"):60113,g=r?Symbol.for("react.suspense_list"):60120,
|
|
29
|
+
*/var rt;function Kt(){if(rt)return $;rt=1;var r=typeof Symbol=="function"&&Symbol.for,e=r?Symbol.for("react.element"):60103,t=r?Symbol.for("react.portal"):60106,n=r?Symbol.for("react.fragment"):60107,s=r?Symbol.for("react.strict_mode"):60108,o=r?Symbol.for("react.profiler"):60114,i=r?Symbol.for("react.provider"):60109,a=r?Symbol.for("react.context"):60110,c=r?Symbol.for("react.async_mode"):60111,l=r?Symbol.for("react.concurrent_mode"):60111,h=r?Symbol.for("react.forward_ref"):60112,f=r?Symbol.for("react.suspense"):60113,g=r?Symbol.for("react.suspense_list"):60120,E=r?Symbol.for("react.memo"):60115,w=r?Symbol.for("react.lazy"):60116,p=r?Symbol.for("react.block"):60121,j=r?Symbol.for("react.fundamental"):60117,k=r?Symbol.for("react.responder"):60118,B=r?Symbol.for("react.scope"):60119;function M(y){if(typeof y=="object"&&y!==null){var V=y.$$typeof;switch(V){case e:switch(y=y.type,y){case c:case l:case n:case o:case s:case f:return y;default:switch(y=y&&y.$$typeof,y){case a:case h:case w:case E:case i:return y;default:return V}}case t:return V}}}function N(y){return M(y)===l}return $.AsyncMode=c,$.ConcurrentMode=l,$.ContextConsumer=a,$.ContextProvider=i,$.Element=e,$.ForwardRef=h,$.Fragment=n,$.Lazy=w,$.Memo=E,$.Portal=t,$.Profiler=o,$.StrictMode=s,$.Suspense=f,$.isAsyncMode=function(y){return N(y)||M(y)===c},$.isConcurrentMode=N,$.isContextConsumer=function(y){return M(y)===a},$.isContextProvider=function(y){return M(y)===i},$.isElement=function(y){return typeof y=="object"&&y!==null&&y.$$typeof===e},$.isForwardRef=function(y){return M(y)===h},$.isFragment=function(y){return M(y)===n},$.isLazy=function(y){return M(y)===w},$.isMemo=function(y){return M(y)===E},$.isPortal=function(y){return M(y)===t},$.isProfiler=function(y){return M(y)===o},$.isStrictMode=function(y){return M(y)===s},$.isSuspense=function(y){return M(y)===f},$.isValidElementType=function(y){return typeof y=="string"||typeof y=="function"||y===n||y===l||y===o||y===s||y===f||y===g||typeof y=="object"&&y!==null&&(y.$$typeof===w||y.$$typeof===E||y.$$typeof===i||y.$$typeof===a||y.$$typeof===h||y.$$typeof===j||y.$$typeof===k||y.$$typeof===B||y.$$typeof===p)},$.typeOf=M,$}var L={};/** @license React v16.13.1
|
|
30
30
|
* react-is.development.js
|
|
31
31
|
*
|
|
32
32
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
33
33
|
*
|
|
34
34
|
* This source code is licensed under the MIT license found in the
|
|
35
35
|
* LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/var nt;function Zt(){return nt||(nt=1,process.env.NODE_ENV!=="production"&&(function(){var r=typeof Symbol=="function"&&Symbol.for,e=r?Symbol.for("react.element"):60103,t=r?Symbol.for("react.portal"):60106,n=r?Symbol.for("react.fragment"):60107,s=r?Symbol.for("react.strict_mode"):60108,o=r?Symbol.for("react.profiler"):60114,i=r?Symbol.for("react.provider"):60109,a=r?Symbol.for("react.context"):60110,c=r?Symbol.for("react.async_mode"):60111,l=r?Symbol.for("react.concurrent_mode"):60111,h=r?Symbol.for("react.forward_ref"):60112,f=r?Symbol.for("react.suspense"):60113,g=r?Symbol.for("react.suspense_list"):60120,
|
|
36
|
+
*/var nt;function Zt(){return nt||(nt=1,process.env.NODE_ENV!=="production"&&(function(){var r=typeof Symbol=="function"&&Symbol.for,e=r?Symbol.for("react.element"):60103,t=r?Symbol.for("react.portal"):60106,n=r?Symbol.for("react.fragment"):60107,s=r?Symbol.for("react.strict_mode"):60108,o=r?Symbol.for("react.profiler"):60114,i=r?Symbol.for("react.provider"):60109,a=r?Symbol.for("react.context"):60110,c=r?Symbol.for("react.async_mode"):60111,l=r?Symbol.for("react.concurrent_mode"):60111,h=r?Symbol.for("react.forward_ref"):60112,f=r?Symbol.for("react.suspense"):60113,g=r?Symbol.for("react.suspense_list"):60120,E=r?Symbol.for("react.memo"):60115,w=r?Symbol.for("react.lazy"):60116,p=r?Symbol.for("react.block"):60121,j=r?Symbol.for("react.fundamental"):60117,k=r?Symbol.for("react.responder"):60118,B=r?Symbol.for("react.scope"):60119;function M(S){return typeof S=="string"||typeof S=="function"||S===n||S===l||S===o||S===s||S===f||S===g||typeof S=="object"&&S!==null&&(S.$$typeof===w||S.$$typeof===E||S.$$typeof===i||S.$$typeof===a||S.$$typeof===h||S.$$typeof===j||S.$$typeof===k||S.$$typeof===B||S.$$typeof===p)}function N(S){if(typeof S=="object"&&S!==null){var ae=S.$$typeof;switch(ae){case e:var we=S.type;switch(we){case c:case l:case n:case o:case s:case f:return we;default:var Ke=we&&we.$$typeof;switch(Ke){case a:case h:case w:case E:case i:return Ke;default:return ae}}case t:return ae}}}var y=c,V=l,Z=a,ne=i,J=e,G=h,Y=n,ee=w,K=E,Q=t,te=o,H=s,oe=f,ce=!1;function le(S){return ce||(ce=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),_(S)||N(S)===c}function _(S){return N(S)===l}function u(S){return N(S)===a}function b(S){return N(S)===i}function T(S){return typeof S=="object"&&S!==null&&S.$$typeof===e}function x(S){return N(S)===h}function D(S){return N(S)===n}function I(S){return N(S)===w}function v(S){return N(S)===E}function C(S){return N(S)===t}function P(S){return N(S)===o}function R(S){return N(S)===s}function z(S){return N(S)===f}L.AsyncMode=y,L.ConcurrentMode=V,L.ContextConsumer=Z,L.ContextProvider=ne,L.Element=J,L.ForwardRef=G,L.Fragment=Y,L.Lazy=ee,L.Memo=K,L.Portal=Q,L.Profiler=te,L.StrictMode=H,L.Suspense=oe,L.isAsyncMode=le,L.isConcurrentMode=_,L.isContextConsumer=u,L.isContextProvider=b,L.isElement=T,L.isForwardRef=x,L.isFragment=D,L.isLazy=I,L.isMemo=v,L.isPortal=C,L.isProfiler=P,L.isStrictMode=R,L.isSuspense=z,L.isValidElementType=M,L.typeOf=N})()),L}var ot;function Nt(){return ot||(ot=1,process.env.NODE_ENV==="production"?Ee.exports=Kt():Ee.exports=Zt()),Ee.exports}/*
|
|
37
37
|
object-assign
|
|
38
38
|
(c) Sindre Sorhus
|
|
39
39
|
@license MIT
|
|
40
|
-
*/var
|
|
41
|
-
Valid keys: `+JSON.stringify(Object.keys(p),null," "));var w=F(k,I,C,D,R+"."+I,t);if(w)return w}return null}return O(u)}function ee(p){switch(typeof p){case"number":case"string":case"undefined":return!0;case"boolean":return!p;case"object":if(Array.isArray(p))return p.every(ee);if(p===null||a(p))return!0;var u=f(p);if(u){var b=u.call(p),T;if(u!==p.entries){for(;!(T=b.next()).done;)if(!ee(T.value))return!1}else for(;!(T=b.next()).done;){var C=T.value;if(C&&!ee(C[1]))return!1}}else return!1;return!0;default:return!1}}function X(p,u){return p==="symbol"?!0:u?u["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&u instanceof Symbol:!1}function W(p){var u=typeof p;return Array.isArray(p)?"array":p instanceof RegExp?"object":X(u,p)?"symbol":u}function re(p){if(typeof p>"u"||p===null)return""+p;var u=W(p);if(u==="object"){if(p instanceof Date)return"date";if(p instanceof RegExp)return"regexp"}return u}function K(p){var u=re(p);switch(u){case"array":case"object":return"an "+u;case"boolean":case"date":case"regexp":return"a "+u;default:return u}}function le(p){return!p.constructor||!p.constructor.name?g:p.constructor.name}return S.checkPropTypes=s,S.resetWarningCache=s.resetWarningCache,S.PropTypes=S,S},Me}var Ne,ut;function nr(){if(ut)return Ne;ut=1;var r=Qe();function e(){}function t(){}return t.resetWarningCache=e,Ne=function(){function n(i,a,c,l,h,f){if(f!==r){var g=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw g.name="Invariant Violation",g}}n.isRequired=n;function s(){return n}var o={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:s,element:n,elementType:n,instanceOf:s,node:n,objectOf:s,oneOf:s,oneOfType:s,shape:s,exact:s,checkPropTypes:t,resetWarningCache:e};return o.PropTypes=o,o},Ne}var ht;function Lt(){if(ht)return we.exports;if(ht=1,process.env.NODE_ENV!=="production"){var r=Nt(),e=!0;we.exports=rr()(r.isElement,e)}else we.exports=nr()();return we.exports}var $e,ft;function Bt(){return ft||(ft=1,$e={L:1,M:0,Q:3,H:2}),$e}var Le,dt;function zt(){return dt||(dt=1,Le={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}),Le}var Be,gt;function or(){if(gt)return Be;gt=1;var r=zt();function e(t){this.mode=r.MODE_8BIT_BYTE,this.data=t}return e.prototype={getLength:function(t){return this.data.length},write:function(t){for(var n=0;n<this.data.length;n++)t.put(this.data.charCodeAt(n),8)}},Be=e,Be}var ze,pt;function sr(){if(pt)return ze;pt=1;var r=Bt();function e(t,n){this.totalCount=t,this.dataCount=n}return e.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],e.getRSBlocks=function(t,n){var s=e.getRsBlockTable(t,n);if(s==null)throw new Error("bad rs block @ typeNumber:"+t+"/errorCorrectLevel:"+n);for(var o=s.length/3,i=new Array,a=0;a<o;a++)for(var c=s[a*3+0],l=s[a*3+1],h=s[a*3+2],f=0;f<c;f++)i.push(new e(l,h));return i},e.getRsBlockTable=function(t,n){switch(n){case r.L:return e.RS_BLOCK_TABLE[(t-1)*4+0];case r.M:return e.RS_BLOCK_TABLE[(t-1)*4+1];case r.Q:return e.RS_BLOCK_TABLE[(t-1)*4+2];case r.H:return e.RS_BLOCK_TABLE[(t-1)*4+3];default:return}},ze=e,ze}var He,_t;function ir(){if(_t)return He;_t=1;function r(){this.buffer=new Array,this.length=0}return r.prototype={get:function(e){var t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(var n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},He=r,He}var Ue,mt;function Ht(){if(mt)return Ue;mt=1;for(var r={glog:function(t){if(t<1)throw new Error("glog("+t+")");return r.LOG_TABLE[t]},gexp:function(t){for(;t<0;)t+=255;for(;t>=256;)t-=255;return r.EXP_TABLE[t]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},e=0;e<8;e++)r.EXP_TABLE[e]=1<<e;for(var e=8;e<256;e++)r.EXP_TABLE[e]=r.EXP_TABLE[e-4]^r.EXP_TABLE[e-5]^r.EXP_TABLE[e-6]^r.EXP_TABLE[e-8];for(var e=0;e<255;e++)r.LOG_TABLE[r.EXP_TABLE[e]]=e;return Ue=r,Ue}var We,vt;function Ut(){if(vt)return We;vt=1;var r=Ht();function e(t,n){if(t.length==null)throw new Error(t.length+"/"+n);for(var s=0;s<t.length&&t[s]==0;)s++;this.num=new Array(t.length-s+n);for(var o=0;o<t.length-s;o++)this.num[o]=t[o+s]}return e.prototype={get:function(t){return this.num[t]},getLength:function(){return this.num.length},multiply:function(t){for(var n=new Array(this.getLength()+t.getLength()-1),s=0;s<this.getLength();s++)for(var o=0;o<t.getLength();o++)n[s+o]^=r.gexp(r.glog(this.get(s))+r.glog(t.get(o)));return new e(n,0)},mod:function(t){if(this.getLength()-t.getLength()<0)return this;for(var n=r.glog(this.get(0))-r.glog(t.get(0)),s=new Array(this.getLength()),o=0;o<this.getLength();o++)s[o]=this.get(o);for(var o=0;o<t.getLength();o++)s[o]^=r.gexp(r.glog(t.get(o))+n);return new e(s,0).mod(t)}},We=e,We}var Fe,yt;function ar(){if(yt)return Fe;yt=1;var r=zt(),e=Ut(),t=Ht(),n={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},s={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(o){for(var i=o<<10;s.getBCHDigit(i)-s.getBCHDigit(s.G15)>=0;)i^=s.G15<<s.getBCHDigit(i)-s.getBCHDigit(s.G15);return(o<<10|i)^s.G15_MASK},getBCHTypeNumber:function(o){for(var i=o<<12;s.getBCHDigit(i)-s.getBCHDigit(s.G18)>=0;)i^=s.G18<<s.getBCHDigit(i)-s.getBCHDigit(s.G18);return o<<12|i},getBCHDigit:function(o){for(var i=0;o!=0;)i++,o>>>=1;return i},getPatternPosition:function(o){return s.PATTERN_POSITION_TABLE[o-1]},getMask:function(o,i,a){switch(o){case n.PATTERN000:return(i+a)%2==0;case n.PATTERN001:return i%2==0;case n.PATTERN010:return a%3==0;case n.PATTERN011:return(i+a)%3==0;case n.PATTERN100:return(Math.floor(i/2)+Math.floor(a/3))%2==0;case n.PATTERN101:return i*a%2+i*a%3==0;case n.PATTERN110:return(i*a%2+i*a%3)%2==0;case n.PATTERN111:return(i*a%3+(i+a)%2)%2==0;default:throw new Error("bad maskPattern:"+o)}},getErrorCorrectPolynomial:function(o){for(var i=new e([1],0),a=0;a<o;a++)i=i.multiply(new e([1,t.gexp(a)],0));return i},getLengthInBits:function(o,i){if(1<=i&&i<10)switch(o){case r.MODE_NUMBER:return 10;case r.MODE_ALPHA_NUM:return 9;case r.MODE_8BIT_BYTE:return 8;case r.MODE_KANJI:return 8;default:throw new Error("mode:"+o)}else if(i<27)switch(o){case r.MODE_NUMBER:return 12;case r.MODE_ALPHA_NUM:return 11;case r.MODE_8BIT_BYTE:return 16;case r.MODE_KANJI:return 10;default:throw new Error("mode:"+o)}else if(i<41)switch(o){case r.MODE_NUMBER:return 14;case r.MODE_ALPHA_NUM:return 13;case r.MODE_8BIT_BYTE:return 16;case r.MODE_KANJI:return 12;default:throw new Error("mode:"+o)}else throw new Error("type:"+i)},getLostPoint:function(o){for(var i=o.getModuleCount(),a=0,c=0;c<i;c++)for(var l=0;l<i;l++){for(var h=0,f=o.isDark(c,l),g=-1;g<=1;g++)if(!(c+g<0||i<=c+g))for(var S=-1;S<=1;S++)l+S<0||i<=l+S||g==0&&S==0||f==o.isDark(c+g,l+S)&&h++;h>5&&(a+=3+h-5)}for(var c=0;c<i-1;c++)for(var l=0;l<i-1;l++){var y=0;o.isDark(c,l)&&y++,o.isDark(c+1,l)&&y++,o.isDark(c,l+1)&&y++,o.isDark(c+1,l+1)&&y++,(y==0||y==4)&&(a+=3)}for(var c=0;c<i;c++)for(var l=0;l<i-6;l++)o.isDark(c,l)&&!o.isDark(c,l+1)&&o.isDark(c,l+2)&&o.isDark(c,l+3)&&o.isDark(c,l+4)&&!o.isDark(c,l+5)&&o.isDark(c,l+6)&&(a+=40);for(var l=0;l<i;l++)for(var c=0;c<i-6;c++)o.isDark(c,l)&&!o.isDark(c+1,l)&&o.isDark(c+2,l)&&o.isDark(c+3,l)&&o.isDark(c+4,l)&&!o.isDark(c+5,l)&&o.isDark(c+6,l)&&(a+=40);for(var _=0,l=0;l<i;l++)for(var c=0;c<i;c++)o.isDark(c,l)&&_++;var O=Math.abs(100*_/i/i-50)/5;return a+=O*10,a}};return Fe=s,Fe}var qe,bt;function cr(){if(bt)return qe;bt=1;var r=or(),e=sr(),t=ir(),n=ar(),s=Ut();function o(a,c){this.typeNumber=a,this.errorCorrectLevel=c,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var i=o.prototype;return i.addData=function(a){var c=new r(a);this.dataList.push(c),this.dataCache=null},i.isDark=function(a,c){if(a<0||this.moduleCount<=a||c<0||this.moduleCount<=c)throw new Error(a+","+c);return this.modules[a][c]},i.getModuleCount=function(){return this.moduleCount},i.make=function(){if(this.typeNumber<1){var a=1;for(a=1;a<40;a++){for(var c=e.getRSBlocks(a,this.errorCorrectLevel),l=new t,h=0,f=0;f<c.length;f++)h+=c[f].dataCount;for(var f=0;f<this.dataList.length;f++){var g=this.dataList[f];l.put(g.mode,4),l.put(g.getLength(),n.getLengthInBits(g.mode,a)),g.write(l)}if(l.getLengthInBits()<=h*8)break}this.typeNumber=a}this.makeImpl(!1,this.getBestMaskPattern())},i.makeImpl=function(a,c){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var l=0;l<this.moduleCount;l++){this.modules[l]=new Array(this.moduleCount);for(var h=0;h<this.moduleCount;h++)this.modules[l][h]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(a,c),this.typeNumber>=7&&this.setupTypeNumber(a),this.dataCache==null&&(this.dataCache=o.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,c)},i.setupPositionProbePattern=function(a,c){for(var l=-1;l<=7;l++)if(!(a+l<=-1||this.moduleCount<=a+l))for(var h=-1;h<=7;h++)c+h<=-1||this.moduleCount<=c+h||(0<=l&&l<=6&&(h==0||h==6)||0<=h&&h<=6&&(l==0||l==6)||2<=l&&l<=4&&2<=h&&h<=4?this.modules[a+l][c+h]=!0:this.modules[a+l][c+h]=!1)},i.getBestMaskPattern=function(){for(var a=0,c=0,l=0;l<8;l++){this.makeImpl(!0,l);var h=n.getLostPoint(this);(l==0||a>h)&&(a=h,c=l)}return c},i.createMovieClip=function(a,c,l){var h=a.createEmptyMovieClip(c,l),f=1;this.make();for(var g=0;g<this.modules.length;g++)for(var S=g*f,y=0;y<this.modules[g].length;y++){var _=y*f,O=this.modules[g][y];O&&(h.beginFill(0,100),h.moveTo(_,S),h.lineTo(_+f,S),h.lineTo(_+f,S+f),h.lineTo(_,S+f),h.endFill())}return h},i.setupTimingPattern=function(){for(var a=8;a<this.moduleCount-8;a++)this.modules[a][6]==null&&(this.modules[a][6]=a%2==0);for(var c=8;c<this.moduleCount-8;c++)this.modules[6][c]==null&&(this.modules[6][c]=c%2==0)},i.setupPositionAdjustPattern=function(){for(var a=n.getPatternPosition(this.typeNumber),c=0;c<a.length;c++)for(var l=0;l<a.length;l++){var h=a[c],f=a[l];if(this.modules[h][f]==null)for(var g=-2;g<=2;g++)for(var S=-2;S<=2;S++)g==-2||g==2||S==-2||S==2||g==0&&S==0?this.modules[h+g][f+S]=!0:this.modules[h+g][f+S]=!1}},i.setupTypeNumber=function(a){for(var c=n.getBCHTypeNumber(this.typeNumber),l=0;l<18;l++){var h=!a&&(c>>l&1)==1;this.modules[Math.floor(l/3)][l%3+this.moduleCount-8-3]=h}for(var l=0;l<18;l++){var h=!a&&(c>>l&1)==1;this.modules[l%3+this.moduleCount-8-3][Math.floor(l/3)]=h}},i.setupTypeInfo=function(a,c){for(var l=this.errorCorrectLevel<<3|c,h=n.getBCHTypeInfo(l),f=0;f<15;f++){var g=!a&&(h>>f&1)==1;f<6?this.modules[f][8]=g:f<8?this.modules[f+1][8]=g:this.modules[this.moduleCount-15+f][8]=g}for(var f=0;f<15;f++){var g=!a&&(h>>f&1)==1;f<8?this.modules[8][this.moduleCount-f-1]=g:f<9?this.modules[8][15-f-1+1]=g:this.modules[8][15-f-1]=g}this.modules[this.moduleCount-8][8]=!a},i.mapData=function(a,c){for(var l=-1,h=this.moduleCount-1,f=7,g=0,S=this.moduleCount-1;S>0;S-=2)for(S==6&&S--;;){for(var y=0;y<2;y++)if(this.modules[h][S-y]==null){var _=!1;g<a.length&&(_=(a[g]>>>f&1)==1);var O=n.getMask(c,h,S-y);O&&(_=!_),this.modules[h][S-y]=_,f--,f==-1&&(g++,f=7)}if(h+=l,h<0||this.moduleCount<=h){h-=l,l=-l;break}}},o.PAD0=236,o.PAD1=17,o.createData=function(a,c,l){for(var h=e.getRSBlocks(a,c),f=new t,g=0;g<l.length;g++){var S=l[g];f.put(S.mode,4),f.put(S.getLength(),n.getLengthInBits(S.mode,a)),S.write(f)}for(var y=0,g=0;g<h.length;g++)y+=h[g].dataCount;if(f.getLengthInBits()>y*8)throw new Error("code length overflow. ("+f.getLengthInBits()+">"+y*8+")");for(f.getLengthInBits()+4<=y*8&&f.put(0,4);f.getLengthInBits()%8!=0;)f.putBit(!1);for(;!(f.getLengthInBits()>=y*8||(f.put(o.PAD0,8),f.getLengthInBits()>=y*8));)f.put(o.PAD1,8);return o.createBytes(f,h)},o.createBytes=function(a,c){for(var l=0,h=0,f=0,g=new Array(c.length),S=new Array(c.length),y=0;y<c.length;y++){var _=c[y].dataCount,O=c[y].totalCount-_;h=Math.max(h,_),f=Math.max(f,O),g[y]=new Array(_);for(var P=0;P<g[y].length;P++)g[y][P]=255&a.buffer[P+l];l+=_;var z=n.getErrorCorrectPolynomial(O),M=new s(g[y],z.getLength()-1),B=M.mod(z);S[y]=new Array(z.getLength()-1);for(var P=0;P<S[y].length;P++){var v=P+B.getLength()-S[y].length;S[y][P]=v>=0?B.get(v):0}}for(var Y=0,P=0;P<c.length;P++)Y+=c[P].totalCount;for(var Q=new Array(Y),te=0,P=0;P<h;P++)for(var y=0;y<c.length;y++)P<g[y].length&&(Q[te++]=g[y][P]);for(var P=0;P<f;P++)for(var y=0;y<c.length;y++)P<S[y].length&&(Q[te++]=S[y][P]);return Q},qe=o,qe}var Ee={},wt;function lr(){if(wt)return Ee;wt=1,Object.defineProperty(Ee,"__esModule",{value:!0});var r=Object.assign||function(l){for(var h=1;h<arguments.length;h++){var f=arguments[h];for(var g in f)Object.prototype.hasOwnProperty.call(f,g)&&(l[g]=f[g])}return l},e=Lt(),t=o(e),n=j,s=o(n);function o(l){return l&&l.__esModule?l:{default:l}}function i(l,h){var f={};for(var g in l)h.indexOf(g)>=0||Object.prototype.hasOwnProperty.call(l,g)&&(f[g]=l[g]);return f}var a={bgColor:t.default.oneOfType([t.default.object,t.default.string]).isRequired,bgD:t.default.string.isRequired,fgColor:t.default.oneOfType([t.default.object,t.default.string]).isRequired,fgD:t.default.string.isRequired,size:t.default.number.isRequired,title:t.default.string,viewBoxSize:t.default.number.isRequired,xmlns:t.default.string},c=(0,n.forwardRef)(function(l,h){var f=l.bgColor,g=l.bgD,S=l.fgD,y=l.fgColor,_=l.size,O=l.title,P=l.viewBoxSize,z=l.xmlns,M=z===void 0?"http://www.w3.org/2000/svg":z,B=i(l,["bgColor","bgD","fgD","fgColor","size","title","viewBoxSize","xmlns"]);return s.default.createElement("svg",r({},B,{height:_,ref:h,viewBox:"0 0 "+P+" "+P,width:_,xmlns:M}),O?s.default.createElement("title",null,O):null,s.default.createElement("path",{d:g,fill:f}),s.default.createElement("path",{d:S,fill:y}))});return c.displayName="QRCodeSvg",c.propTypes=a,Ee.default=c,Ee}var St;function ur(){if(St)return de;St=1,Object.defineProperty(de,"__esModule",{value:!0}),de.QRCode=void 0;var r=Object.assign||function(_){for(var O=1;O<arguments.length;O++){var P=arguments[O];for(var z in P)Object.prototype.hasOwnProperty.call(P,z)&&(_[z]=P[z])}return _},e=Lt(),t=f(e),n=Bt(),s=f(n),o=cr(),i=f(o),a=j,c=f(a),l=lr(),h=f(l);function f(_){return _&&_.__esModule?_:{default:_}}function g(_,O){var P={};for(var z in _)O.indexOf(z)>=0||Object.prototype.hasOwnProperty.call(_,z)&&(P[z]=_[z]);return P}var S={bgColor:t.default.oneOfType([t.default.object,t.default.string]),fgColor:t.default.oneOfType([t.default.object,t.default.string]),level:t.default.string,size:t.default.number,value:t.default.string.isRequired},y=(0,a.forwardRef)(function(_,O){var P=_.bgColor,z=P===void 0?"#FFFFFF":P,M=_.fgColor,B=M===void 0?"#000000":M,v=_.level,Y=v===void 0?"L":v,Q=_.size,te=Q===void 0?256:Q,se=_.value,ce=g(_,["bgColor","fgColor","level","size","value"]),J=new i.default(-1,s.default[Y]);J.addData(se),J.make();var N=J.modules;return c.default.createElement(h.default,r({},ce,{bgColor:z,bgD:N.map(function(G,ee){return G.map(function(X,W){return X?"":"M "+W+" "+ee+" l 1 0 0 1 -1 0 Z"}).join(" ")}).join(" "),fgColor:B,fgD:N.map(function(G,ee){return G.map(function(X,W){return X?"M "+W+" "+ee+" l 1 0 0 1 -1 0 Z":""}).join(" ")}).join(" "),ref:O,size:te,viewBoxSize:N.length}))});return de.QRCode=y,y.displayName="QRCode",y.propTypes=S,de.default=y,de}var hr=ur();const fr=Qt(hr);var Wt={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Et=j.createContext&&j.createContext(Wt),dr=["attr","size","title"];function gr(r,e){if(r==null)return{};var t=pr(r,e),n,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);for(s=0;s<o.length;s++)n=o[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}function pr(r,e){if(r==null)return{};var t={};for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n)){if(e.indexOf(n)>=0)continue;t[n]=r[n]}return t}function Te(){return Te=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},Te.apply(this,arguments)}function Ct(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(r,s).enumerable})),t.push.apply(t,n)}return t}function ke(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ct(Object(t),!0).forEach(function(n){_r(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ct(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function _r(r,e,t){return e=mr(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function mr(r){var e=vr(r,"string");return typeof e=="symbol"?e:e+""}function vr(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Ft(r){return r&&r.map((e,t)=>j.createElement(e.tag,ke({key:t},e.attr),Ft(e.child)))}function Re(r){return e=>j.createElement(yr,Te({attr:ke({},r.attr)},e),Ft(r.child))}function yr(r){var e=t=>{var{attr:n,size:s,title:o}=r,i=gr(r,dr),a=s||t.size||"1em",c;return t.className&&(c=t.className),r.className&&(c=(c?c+" ":"")+r.className),j.createElement("svg",Te({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,n,i,{className:c,style:ke(ke({color:r.color||t.color},t.style),r.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),o&&j.createElement("title",null,o),r.children)};return Et!==void 0?j.createElement(Et.Consumer,null,t=>e(t)):e(Wt)}function br(r){return Re({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M9.5 6.5v3h-3v-3h3M11 5H5v6h6V5zm-1.5 9.5v3h-3v-3h3M11 13H5v6h6v-6zm6.5-6.5v3h-3v-3h3M19 5h-6v6h6V5zm-6 8h1.5v1.5H13V13zm1.5 1.5H16V16h-1.5v-1.5zM16 13h1.5v1.5H16V13zm-3 3h1.5v1.5H13V16zm1.5 1.5H16V19h-1.5v-1.5zM16 16h1.5v1.5H16V16zm1.5-1.5H19V16h-1.5v-1.5zm0 3H19V19h-1.5v-1.5zM22 7h-2V4h-3V2h5v5zm0 15v-5h-2v3h-3v2h5zM2 22h5v-2H4v-3H2v5zM2 2v5h2V4h3V2H2z"},child:[]}]})(r)}const wr=({logoBackgroundCss:r="bg-gradient-to-br rounded-xl flex items-center justify-center flex-col",logoCss:e="text-white",size:t="small",isConnected:n=!1})=>{const[s,o]=j.useState("w-2 h-2"),[i,a]=j.useState("w-4 h-4"),[c,l]=j.useState(n?"from-green-200 to-green-600":"from-red-600 to-red-800");return j.useEffect(()=>{switch(t){case"small":a("w-2 h-2"),o("w-1 h-1");break;case"medium":a("w-6 h-6"),o("w-4 h-4");break;case"large":a("w-8 h-8"),o("w-6 h-6");break;case"xlarge":a("w-10 h-10"),o("w-8 h-8");break}return()=>{}},[t]),j.useEffect(()=>{l(n?"bg-gradient-to-r from-green-200 to-green-500":" bg-gradient-to-r from-red-600 to-red-800")},[n]),m.jsx("div",{className:"flex items-center space-x-2",children:m.jsx(br,{className:`${s} ${e} ${c} rounded-2xl p-1`})})};class Ve extends Error{constructor(e,t,n){super(`HTTP ${e}: ${t}`),this.status=e,this.statusText=t,this.response=n,this.name="ApiError"}}async function xt(r,e,t){const n=new AbortController,s=n.signal;t?.timeout&&setTimeout(()=>n.abort(),t.timeout);const o=t?.signal||s;try{const i=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",...t?.headers},body:e?JSON.stringify(e):void 0,signal:o});if(!i.ok){let c;try{c=await i.json()}catch{c=await i.text()}throw new Ve(i.status,i.statusText,c)}return i.headers.get("content-type")?.includes("application/json")?await i.json():await i.text()}catch(i){throw i instanceof Ve?(console.error("API Error:",i.status,i.message),i):i instanceof Ve&&i.name==="AbortError"?(console.error("Request was aborted"),new Error("Request timeout")):(console.error("Network error:",i),new Error("Network error occurred"))}}function Sr(r){return!r||r.trim().length===0}function Er(r,e){let t=null;return(...n)=>new Promise((s,o)=>{t&&clearTimeout(t),t=setTimeout(()=>{Promise.resolve(r(...n)).then(s).catch(o)},e)})}function Cr(r,e=30){if(!r)return!0;try{const n=JSON.parse(atob(r.split(".")[1])).exp;return n?Date.now()/1e3>=n-e:!0}catch{return!0}}function Tt(r){return Re({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M500.33 0h-47.41a12 12 0 0 0-12 12.57l4 82.76A247.42 247.42 0 0 0 256 8C119.34 8 7.9 119.53 8 256.19 8.1 393.07 119.1 504 256 504a247.1 247.1 0 0 0 166.18-63.91 12 12 0 0 0 .48-17.43l-34-34a12 12 0 0 0-16.38-.55A176 176 0 1 1 402.1 157.8l-101.53-4.87a12 12 0 0 0-12.57 12v47.41a12 12 0 0 0 12 12h200.33a12 12 0 0 0 12-12V12a12 12 0 0 0-12-12z"},child:[]}]})(r)}function xr(r,e){try{localStorage.setItem(r,JSON.stringify(e))}catch(t){console.error("Error saving to localStorage",t)}}function Tr(r){try{const e=localStorage.getItem(r);return e?JSON.parse(e):void 0}catch(e){console.error("Error reading from localStorage",e)}}const kr=(r,e)=>{const[t,n]=j.useState(()=>Tr(r)??e);return j.useEffect(()=>{xr(r,t),n(t)},[r,t]),j.useEffect(()=>{const s=o=>{o.key===r&&n(o.newValue?JSON.parse(o.newValue):e)};return window.addEventListener("storage",s),()=>window.removeEventListener("storage",s)},[r,e]),[t,n]};class ue extends Error{constructor(e,t){const n=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=n}}class Je extends Error{constructor(e="A timeout occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class ie extends Error{constructor(e="An abort occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class Pr extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=n}}class Rr extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=n}}class Ir extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=n}}class kt extends Error{constructor(e){const t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}}class Ar extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=n}}class qt{constructor(e,t,n){this.statusCode=e,this.statusText=t,this.content=n}}class Ie{get(e,t){return this.send({...t,method:"GET",url:e})}post(e,t){return this.send({...t,method:"POST",url:e})}delete(e,t){return this.send({...t,method:"DELETE",url:e})}getCookieString(e){return""}}var d;(function(r){r[r.Trace=0]="Trace",r[r.Debug=1]="Debug",r[r.Information=2]="Information",r[r.Warning=3]="Warning",r[r.Error=4]="Error",r[r.Critical=5]="Critical",r[r.None=6]="None"})(d||(d={}));class me{constructor(){}log(e,t){}}me.instance=new me;const jr="10.0.0";class q{static isRequired(e,t){if(e==null)throw new Error(`The '${t}' argument is required.`)}static isNotEmpty(e,t){if(!e||e.match(/^\s*$/))throw new Error(`The '${t}' argument should not be empty.`)}static isIn(e,t,n){if(!(e in t))throw new Error(`Unknown ${n} value: ${e}.`)}}class U{static get isBrowser(){return!U.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!U.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!U.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}}function ve(r,e){let t="";return fe(r)?(t=`Binary data of length ${r.byteLength}`,e&&(t+=`. Content: '${Or(r)}'`)):typeof r=="string"&&(t=`String data of length ${r.length}`,e&&(t+=`. Content: '${r}'`)),t}function Or(r){const e=new Uint8Array(r);let t="";return e.forEach(n=>{const s=n<16?"0":"";t+=`0x${s}${n.toString(16)} `}),t.substring(0,t.length-1)}function fe(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}async function Vt(r,e,t,n,s,o){const i={},[a,c]=ge();i[a]=c,r.log(d.Trace,`(${e} transport) sending data. ${ve(s,o.logMessageContent)}.`);const l=fe(s)?"arraybuffer":"text",h=await t.post(n,{content:s,headers:{...i,...o.headers},responseType:l,timeout:o.timeout,withCredentials:o.withCredentials});r.log(d.Trace,`(${e} transport) request complete. Response status: ${h.statusCode}.`)}function Dr(r){return r===void 0?new Pe(d.Information):r===null?me.instance:r.log!==void 0?r:new Pe(r)}class Mr{constructor(e,t){this._subject=e,this._observer=t}dispose(){const e=this._subject.observers.indexOf(this._observer);e>-1&&this._subject.observers.splice(e,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(t=>{})}}class Pe{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){const n=`[${new Date().toISOString()}] ${d[e]}: ${t}`;switch(e){case d.Critical:case d.Error:this.out.error(n);break;case d.Warning:this.out.warn(n);break;case d.Information:this.out.info(n);break;default:this.out.log(n);break}}}}function ge(){let r="X-SignalR-User-Agent";return U.isNode&&(r="User-Agent"),[r,Nr(jr,$r(),Br(),Lr())]}function Nr(r,e,t,n){let s="Microsoft SignalR/";const o=r.split(".");return s+=`${o[0]}.${o[1]}`,s+=` (${r}; `,e&&e!==""?s+=`${e}; `:s+="Unknown OS; ",s+=`${t}`,n?s+=`; ${n}`:s+="; Unknown Runtime Version",s+=")",s}function $r(){if(U.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function Lr(){if(U.isNode)return process.versions.node}function Br(){return U.isNode?"NodeJS":"Browser"}function Ye(r){return r.stack?r.stack:r.message?r.message:`${r}`}function zr(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}class Hr extends Ie{constructor(e){if(super(),this._logger=e,typeof fetch>"u"||U.isNode){const t=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._jar=new(t("tough-cookie")).CookieJar,typeof fetch>"u"?this._fetchType=t("node-fetch"):this._fetchType=fetch,this._fetchType=t("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(zr());if(typeof AbortController>"u"){const t=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._abortControllerType=t("abort-controller")}else this._abortControllerType=AbortController}async send(e){if(e.abortSignal&&e.abortSignal.aborted)throw new ie;if(!e.method)throw new Error("No method defined.");if(!e.url)throw new Error("No url defined.");const t=new this._abortControllerType;let n;e.abortSignal&&(e.abortSignal.onabort=()=>{t.abort(),n=new ie});let s=null;if(e.timeout){const c=e.timeout;s=setTimeout(()=>{t.abort(),this._logger.log(d.Warning,"Timeout from HTTP request."),n=new Je},c)}e.content===""&&(e.content=void 0),e.content&&(e.headers=e.headers||{},fe(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");let o;try{o=await this._fetchType(e.url,{body:e.content,cache:"no-cache",credentials:e.withCredentials===!0?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...e.headers},method:e.method,mode:"cors",redirect:"follow",signal:t.signal})}catch(c){throw n||(this._logger.log(d.Warning,`Error from HTTP request. ${c}.`),c)}finally{s&&clearTimeout(s),e.abortSignal&&(e.abortSignal.onabort=null)}if(!o.ok){const c=await Pt(o,"text");throw new ue(c||o.statusText,o.status)}const a=await Pt(o,e.responseType);return new qt(o.status,o.statusText,a)}getCookieString(e){let t="";return U.isNode&&this._jar&&this._jar.getCookies(e,(n,s)=>t=s.join("; ")),t}}function Pt(r,e){let t;switch(e){case"arraybuffer":t=r.arrayBuffer();break;case"text":t=r.text();break;case"blob":case"document":case"json":throw new Error(`${e} is not supported.`);default:t=r.text();break}return t}class Ur extends Ie{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new ie):e.method?e.url?new Promise((t,n)=>{const s=new XMLHttpRequest;s.open(e.method,e.url,!0),s.withCredentials=e.withCredentials===void 0?!0:e.withCredentials,s.setRequestHeader("X-Requested-With","XMLHttpRequest"),e.content===""&&(e.content=void 0),e.content&&(fe(e.content)?s.setRequestHeader("Content-Type","application/octet-stream"):s.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const o=e.headers;o&&Object.keys(o).forEach(i=>{s.setRequestHeader(i,o[i])}),e.responseType&&(s.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{s.abort(),n(new ie)}),e.timeout&&(s.timeout=e.timeout),s.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),s.status>=200&&s.status<300?t(new qt(s.status,s.statusText,s.response||s.responseText)):n(new ue(s.response||s.responseText||s.statusText,s.status))},s.onerror=()=>{this._logger.log(d.Warning,`Error from HTTP request. ${s.status}: ${s.statusText}.`),n(new ue(s.statusText,s.status))},s.ontimeout=()=>{this._logger.log(d.Warning,"Timeout from HTTP request."),n(new Je)},s.send(e.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class Wr extends Ie{constructor(e){if(super(),typeof fetch<"u"||U.isNode)this._httpClient=new Hr(e);else if(typeof XMLHttpRequest<"u")this._httpClient=new Ur(e);else throw new Error("No usable HttpClient found.")}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new ie):e.method?e.url?this._httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(e){return this._httpClient.getCookieString(e)}}class ne{static write(e){return`${e}${ne.RecordSeparator}`}static parse(e){if(e[e.length-1]!==ne.RecordSeparator)throw new Error("Message is incomplete.");const t=e.split(ne.RecordSeparator);return t.pop(),t}}ne.RecordSeparatorCode=30;ne.RecordSeparator=String.fromCharCode(ne.RecordSeparatorCode);class Fr{writeHandshakeRequest(e){return ne.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,n;if(fe(e)){const a=new Uint8Array(e),c=a.indexOf(ne.RecordSeparatorCode);if(c===-1)throw new Error("Message is incomplete.");const l=c+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(a.slice(0,l))),n=a.byteLength>l?a.slice(l).buffer:null}else{const a=e,c=a.indexOf(ne.RecordSeparator);if(c===-1)throw new Error("Message is incomplete.");const l=c+1;t=a.substring(0,l),n=a.length>l?a.substring(l):null}const s=ne.parse(t),o=JSON.parse(s[0]);if(o.type)throw new Error("Expected a handshake response from the server.");return[n,o]}}var A;(function(r){r[r.Invocation=1]="Invocation",r[r.StreamItem=2]="StreamItem",r[r.Completion=3]="Completion",r[r.StreamInvocation=4]="StreamInvocation",r[r.CancelInvocation=5]="CancelInvocation",r[r.Ping=6]="Ping",r[r.Close=7]="Close",r[r.Ack=8]="Ack",r[r.Sequence=9]="Sequence"})(A||(A={}));class qr{constructor(){this.observers=[]}next(e){for(const t of this.observers)t.next(e)}error(e){for(const t of this.observers)t.error&&t.error(e)}complete(){for(const e of this.observers)e.complete&&e.complete()}subscribe(e){return this.observers.push(e),new Mr(this,e)}}class Vr{constructor(e,t,n){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=e,this._connection=t,this._bufferSize=n}async _send(e){const t=this._protocol.writeMessage(e);let n=Promise.resolve();if(this._isInvocationMessage(e)){this._totalMessageCount++;let s=()=>{},o=()=>{};fe(t)?this._bufferedByteCount+=t.byteLength:this._bufferedByteCount+=t.length,this._bufferedByteCount>=this._bufferSize&&(n=new Promise((i,a)=>{s=i,o=a})),this._messages.push(new Yr(t,this._totalMessageCount,s,o))}try{this._reconnectInProgress||await this._connection.send(t)}catch{this._disconnected()}await n}_ack(e){let t=-1;for(let n=0;n<this._messages.length;n++){const s=this._messages[n];if(s._id<=e.sequenceId)t=n,fe(s._message)?this._bufferedByteCount-=s._message.byteLength:this._bufferedByteCount-=s._message.length,s._resolver();else if(this._bufferedByteCount<this._bufferSize)s._resolver();else break}t!==-1&&(this._messages=this._messages.slice(t+1))}_shouldProcessMessage(e){if(this._waitForSequenceMessage)return e.type!==A.Sequence?!1:(this._waitForSequenceMessage=!1,!0);if(!this._isInvocationMessage(e))return!0;const t=this._nextReceivingSequenceId;return this._nextReceivingSequenceId++,t<=this._latestReceivedSequenceId?(t===this._latestReceivedSequenceId&&this._ackTimer(),!1):(this._latestReceivedSequenceId=t,this._ackTimer(),!0)}_resetSequence(e){if(e.sequenceId>this._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=e.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){const e=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:A.Sequence,sequenceId:e}));const t=this._messages;for(const n of t)await this._connection.send(n._message);this._reconnectInProgress=!1}_dispose(e){e??(e=new Error("Unable to reconnect to server."));for(const t of this._messages)t._rejector(e)}_isInvocationMessage(e){switch(e.type){case A.Invocation:case A.StreamItem:case A.Completion:case A.StreamInvocation:case A.CancelInvocation:return!0;case A.Close:case A.Sequence:case A.Ping:case A.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:A.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0},1e3))}}class Yr{constructor(e,t,n,s){this._message=e,this._id=t,this._resolver=n,this._rejector=s}}const Qr=30*1e3,Jr=15*1e3,Gr=1e5;var H;(function(r){r.Disconnected="Disconnected",r.Connecting="Connecting",r.Connected="Connected",r.Disconnecting="Disconnecting",r.Reconnecting="Reconnecting"})(H||(H={}));class Ge{static create(e,t,n,s,o,i,a){return new Ge(e,t,n,s,o,i,a)}constructor(e,t,n,s,o,i,a){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(d.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},q.isRequired(e,"connection"),q.isRequired(t,"logger"),q.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=o??Qr,this.keepAliveIntervalInMilliseconds=i??Jr,this._statefulReconnectBufferSize=a??Gr,this._logger=t,this._protocol=n,this.connection=e,this._reconnectPolicy=s,this._handshakeProtocol=new Fr,this.connection.onreceive=c=>this._processIncomingData(c),this.connection.onclose=c=>this._connectionClosed(c),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=H.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:A.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(e){if(this._connectionState!==H.Disconnected&&this._connectionState!==H.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!e)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=e}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}async _startWithStateTransitions(){if(this._connectionState!==H.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=H.Connecting,this._logger.log(d.Debug,"Starting HubConnection.");try{await this._startInternal(),U.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=H.Connected,this._connectionStarted=!0,this._logger.log(d.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=H.Disconnected,this._logger.log(d.Debug,`HubConnection failed to start successfully because of error '${e}'.`),Promise.reject(e)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;const e=new Promise((t,n)=>{this._handshakeResolver=t,this._handshakeRejecter=n});await this.connection.start(this._protocol.transferFormat);try{let t=this._protocol.version;this.connection.features.reconnect||(t=1);const n={protocol:this._protocol.name,version:t};if(this._logger.log(d.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(n)),this._logger.log(d.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await e,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new Vr(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(t){throw this._logger.log(d.Debug,`Hub handshake failed with error '${t}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(t),t}}async stop(){const e=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await e}catch{}}_stopInternal(e){if(this._connectionState===H.Disconnected)return this._logger.log(d.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===H.Disconnecting)return this._logger.log(d.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;const t=this._connectionState;return this._connectionState=H.Disconnecting,this._logger.log(d.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(d.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(t===H.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new ie("The connection was stopped before the hub handshake could complete."),this.connection.stop(e))}async _sendCloseMessage(){try{await this._sendWithProtocol(this._createCloseMessage())}catch{}}stream(e,...t){const[n,s]=this._replaceStreamingParams(t),o=this._createStreamInvocation(e,t,s);let i;const a=new qr;return a.cancelCallback=()=>{const c=this._createCancelInvocation(o.invocationId);return delete this._callbacks[o.invocationId],i.then(()=>this._sendWithProtocol(c))},this._callbacks[o.invocationId]=(c,l)=>{if(l){a.error(l);return}else c&&(c.type===A.Completion?c.error?a.error(new Error(c.error)):a.complete():a.next(c.item))},i=this._sendWithProtocol(o).catch(c=>{a.error(c),delete this._callbacks[o.invocationId]}),this._launchStreams(n,i),a}_sendMessage(e){return this._resetKeepAliveInterval(),this.connection.send(e)}_sendWithProtocol(e){return this._messageBuffer?this._messageBuffer._send(e):this._sendMessage(this._protocol.writeMessage(e))}send(e,...t){const[n,s]=this._replaceStreamingParams(t),o=this._sendWithProtocol(this._createInvocation(e,t,!0,s));return this._launchStreams(n,o),o}invoke(e,...t){const[n,s]=this._replaceStreamingParams(t),o=this._createInvocation(e,t,!1,s);return new Promise((a,c)=>{this._callbacks[o.invocationId]=(h,f)=>{if(f){c(f);return}else h&&(h.type===A.Completion?h.error?c(new Error(h.error)):a(h.result):c(new Error(`Unexpected message type: ${h.type}`)))};const l=this._sendWithProtocol(o).catch(h=>{c(h),delete this._callbacks[o.invocationId]});this._launchStreams(n,l)})}on(e,t){!e||!t||(e=e.toLowerCase(),this._methods[e]||(this._methods[e]=[]),this._methods[e].indexOf(t)===-1&&this._methods[e].push(t))}off(e,t){if(!e)return;e=e.toLowerCase();const n=this._methods[e];if(n)if(t){const s=n.indexOf(t);s!==-1&&(n.splice(s,1),n.length===0&&delete this._methods[e])}else delete this._methods[e]}onclose(e){e&&this._closedCallbacks.push(e)}onreconnecting(e){e&&this._reconnectingCallbacks.push(e)}onreconnected(e){e&&this._reconnectedCallbacks.push(e)}_processIncomingData(e){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(e=this._processHandshakeResponse(e),this._receivedHandshakeResponse=!0),e){const t=this._protocol.parseMessages(e,this._logger);for(const n of t)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(n)))switch(n.type){case A.Invocation:this._invokeClientMethod(n).catch(s=>{this._logger.log(d.Error,`Invoke client method threw error: ${Ye(s)}`)});break;case A.StreamItem:case A.Completion:{const s=this._callbacks[n.invocationId];if(s){n.type===A.Completion&&delete this._callbacks[n.invocationId];try{s(n)}catch(o){this._logger.log(d.Error,`Stream callback threw error: ${Ye(o)}`)}}break}case A.Ping:break;case A.Close:{this._logger.log(d.Information,"Close message received from server.");const s=n.error?new Error("Server returned an error on close: "+n.error):void 0;n.allowReconnect===!0?this.connection.stop(s):this._stopPromise=this._stopInternal(s);break}case A.Ack:this._messageBuffer&&this._messageBuffer._ack(n);break;case A.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(n);break;default:this._logger.log(d.Warning,`Invalid message type: ${n.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(e){let t,n;try{[n,t]=this._handshakeProtocol.parseHandshakeResponse(e)}catch(s){const o="Error parsing handshake response: "+s;this._logger.log(d.Error,o);const i=new Error(o);throw this._handshakeRejecter(i),i}if(t.error){const s="Server returned handshake error: "+t.error;this._logger.log(d.Error,s);const o=new Error(s);throw this._handshakeRejecter(o),o}else this._logger.log(d.Debug,"Server handshake complete.");return this._handshakeResolver(),n}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if(!this.connection.features||!this.connection.features.inherentKeepAlive){this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds);let e=this._nextKeepAlive-new Date().getTime();if(e<0){this._connectionState===H.Connected&&this._trySendPingMessage();return}this._pingServerHandle===void 0&&(e<0&&(e=0),this._pingServerHandle=setTimeout(async()=>{this._connectionState===H.Connected&&await this._trySendPingMessage()},e))}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(e){const t=e.target.toLowerCase(),n=this._methods[t];if(!n){this._logger.log(d.Warning,`No client method with the name '${t}' found.`),e.invocationId&&(this._logger.log(d.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)));return}const s=n.slice(),o=!!e.invocationId;let i,a,c;for(const l of s)try{const h=i;i=await l.apply(this,e.arguments),o&&i&&h&&(this._logger.log(d.Error,`Multiple results provided for '${t}'. Sending error to server.`),c=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),a=void 0}catch(h){a=h,this._logger.log(d.Error,`A callback for the method '${t}' threw error '${h}'.`)}c?await this._sendWithProtocol(c):o?(a?c=this._createCompletionMessage(e.invocationId,`${a}`,null):i!==void 0?c=this._createCompletionMessage(e.invocationId,null,i):(this._logger.log(d.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),c=this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(c)):i&&this._logger.log(d.Error,`Result given for '${t}' method but server is not expecting a result.`)}_connectionClosed(e){this._logger.log(d.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new ie("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(e||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===H.Disconnecting?this._completeClose(e):this._connectionState===H.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===H.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=H.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(e??new Error("Connection closed.")),this._messageBuffer=void 0),U.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(t=>t.apply(this,[e]))}catch(t){this._logger.log(d.Error,`An onclose callback called with error '${e}' threw error '${t}'.`)}}}async _reconnect(e){const t=Date.now();let n=0,s=e!==void 0?e:new Error("Attempting to reconnect due to a unknown error."),o=this._getNextRetryDelay(n,0,s);if(o===null){this._logger.log(d.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(e);return}if(this._connectionState=H.Reconnecting,e?this._logger.log(d.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(d.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(i=>i.apply(this,[e]))}catch(i){this._logger.log(d.Error,`An onreconnecting callback called with error '${e}' threw error '${i}'.`)}if(this._connectionState!==H.Reconnecting){this._logger.log(d.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;o!==null;){if(this._logger.log(d.Information,`Reconnect attempt number ${n+1} will start in ${o} ms.`),await new Promise(i=>{this._reconnectDelayHandle=setTimeout(i,o)}),this._reconnectDelayHandle=void 0,this._connectionState!==H.Reconnecting){this._logger.log(d.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(await this._startInternal(),this._connectionState=H.Connected,this._logger.log(d.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(i=>i.apply(this,[this.connection.connectionId]))}catch(i){this._logger.log(d.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${i}'.`)}return}catch(i){if(this._logger.log(d.Information,`Reconnect attempt failed because of error '${i}'.`),this._connectionState!==H.Reconnecting){this._logger.log(d.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===H.Disconnecting&&this._completeClose();return}n++,s=i instanceof Error?i:new Error(i.toString()),o=this._getNextRetryDelay(n,Date.now()-t,s)}}this._logger.log(d.Information,`Reconnect retries have been exhausted after ${Date.now()-t} ms and ${n} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(e,t,n){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:t,previousRetryCount:e,retryReason:n})}catch(s){return this._logger.log(d.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${e}, ${t}) threw error '${s}'.`),null}}_cancelCallbacksWithError(e){const t=this._callbacks;this._callbacks={},Object.keys(t).forEach(n=>{const s=t[n];try{s(null,e)}catch(o){this._logger.log(d.Error,`Stream 'error' callback called with '${e}' threw error: ${Ye(o)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(e,t,n,s){if(n)return s.length!==0?{target:e,arguments:t,streamIds:s,type:A.Invocation}:{target:e,arguments:t,type:A.Invocation};{const o=this._invocationId;return this._invocationId++,s.length!==0?{target:e,arguments:t,invocationId:o.toString(),streamIds:s,type:A.Invocation}:{target:e,arguments:t,invocationId:o.toString(),type:A.Invocation}}}_launchStreams(e,t){if(e.length!==0){t||(t=Promise.resolve());for(const n in e)e[n].subscribe({complete:()=>{t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(n)))},error:s=>{let o;s instanceof Error?o=s.message:s&&s.toString?o=s.toString():o="Unknown error",t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(n,o)))},next:s=>{t=t.then(()=>this._sendWithProtocol(this._createStreamItemMessage(n,s)))}})}}_replaceStreamingParams(e){const t=[],n=[];for(let s=0;s<e.length;s++){const o=e[s];if(this._isObservable(o)){const i=this._invocationId;this._invocationId++,t[i]=o,n.push(i.toString()),e.splice(s,1)}}return[t,n]}_isObservable(e){return e&&e.subscribe&&typeof e.subscribe=="function"}_createStreamInvocation(e,t,n){const s=this._invocationId;return this._invocationId++,n.length!==0?{target:e,arguments:t,invocationId:s.toString(),streamIds:n,type:A.StreamInvocation}:{target:e,arguments:t,invocationId:s.toString(),type:A.StreamInvocation}}_createCancelInvocation(e){return{invocationId:e,type:A.CancelInvocation}}_createStreamItemMessage(e,t){return{invocationId:e,item:t,type:A.StreamItem}}_createCompletionMessage(e,t,n){return t?{error:t,invocationId:e,type:A.Completion}:{invocationId:e,result:n,type:A.Completion}}_createCloseMessage(){return{type:A.Close}}async _trySendPingMessage(){try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}}}const Xr=[0,2e3,1e4,3e4,null];class Rt{constructor(e){this._retryDelays=e!==void 0?[...e,null]:Xr}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}}class he{}he.Authorization="Authorization";he.Cookie="Cookie";class Kr extends Ie{constructor(e,t){super(),this._innerClient=e,this._accessTokenFactory=t}async send(e){let t=!0;this._accessTokenFactory&&(!this._accessToken||e.url&&e.url.indexOf("/negotiate?")>0)&&(t=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(e);const n=await this._innerClient.send(e);return t&&n.statusCode===401&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(e),await this._innerClient.send(e)):n}_setAuthorizationHeader(e){e.headers||(e.headers={}),this._accessToken?e.headers[he.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[he.Authorization]&&delete e.headers[he.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}}var V;(function(r){r[r.None=0]="None",r[r.WebSockets=1]="WebSockets",r[r.ServerSentEvents=2]="ServerSentEvents",r[r.LongPolling=4]="LongPolling"})(V||(V={}));var Z;(function(r){r[r.Text=1]="Text",r[r.Binary=2]="Binary"})(Z||(Z={}));let Zr=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};class It{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,n){this._httpClient=e,this._logger=t,this._pollAbort=new Zr,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}async connect(e,t){if(q.isRequired(e,"url"),q.isRequired(t,"transferFormat"),q.isIn(t,Z,"transferFormat"),this._url=e,this._logger.log(d.Trace,"(LongPolling transport) Connecting."),t===Z.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[n,s]=ge(),o={[n]:s,...this._options.headers},i={abortSignal:this._pollAbort.signal,headers:o,timeout:1e5,withCredentials:this._options.withCredentials};t===Z.Binary&&(i.responseType="arraybuffer");const a=`${e}&_=${Date.now()}`;this._logger.log(d.Trace,`(LongPolling transport) polling: ${a}.`);const c=await this._httpClient.get(a,i);c.statusCode!==200?(this._logger.log(d.Error,`(LongPolling transport) Unexpected response code: ${c.statusCode}.`),this._closeError=new ue(c.statusText||"",c.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,i)}async _poll(e,t){try{for(;this._running;)try{const n=`${e}&_=${Date.now()}`;this._logger.log(d.Trace,`(LongPolling transport) polling: ${n}.`);const s=await this._httpClient.get(n,t);s.statusCode===204?(this._logger.log(d.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):s.statusCode!==200?(this._logger.log(d.Error,`(LongPolling transport) Unexpected response code: ${s.statusCode}.`),this._closeError=new ue(s.statusText||"",s.statusCode),this._running=!1):s.content?(this._logger.log(d.Trace,`(LongPolling transport) data received. ${ve(s.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(s.content)):this._logger.log(d.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(n){this._running?n instanceof Je?this._logger.log(d.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=n,this._running=!1):this._logger.log(d.Trace,`(LongPolling transport) Poll errored after shutdown: ${n.message}`)}}finally{this._logger.log(d.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(e){return this._running?Vt(this._logger,"LongPolling",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(d.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(d.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[t,n]=ge();e[t]=n;const s={headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};let o;try{await this._httpClient.delete(this._url,s)}catch(i){o=i}o?o instanceof ue&&(o.statusCode===404?this._logger.log(d.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(d.Trace,`(LongPolling transport) Error sending a DELETE request: ${o}`)):this._logger.log(d.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(d.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let e="(LongPolling transport) Firing onclose event.";this._closeError&&(e+=" Error: "+this._closeError),this._logger.log(d.Trace,e),this.onclose(this._closeError)}}}class en{constructor(e,t,n,s){this._httpClient=e,this._accessToken=t,this._logger=n,this._options=s,this.onreceive=null,this.onclose=null}async connect(e,t){return q.isRequired(e,"url"),q.isRequired(t,"transferFormat"),q.isIn(t,Z,"transferFormat"),this._logger.log(d.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((n,s)=>{let o=!1;if(t!==Z.Text){s(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let i;if(U.isBrowser||U.isWebWorker)i=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{const a=this._httpClient.getCookieString(e),c={};c.Cookie=a;const[l,h]=ge();c[l]=h,i=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:{...c,...this._options.headers}})}try{i.onmessage=a=>{if(this.onreceive)try{this._logger.log(d.Trace,`(SSE transport) data received. ${ve(a.data,this._options.logMessageContent)}.`),this.onreceive(a.data)}catch(c){this._close(c);return}},i.onerror=a=>{o?this._close():s(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},i.onopen=()=>{this._logger.log(d.Information,`SSE connected to ${this._url}`),this._eventSource=i,o=!0,n()}}catch(a){s(a);return}})}async send(e){return this._eventSource?Vt(this._logger,"SSE",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(e){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(e))}}class tn{constructor(e,t,n,s,o,i){this._logger=n,this._accessTokenFactory=t,this._logMessageContent=s,this._webSocketConstructor=o,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=i}async connect(e,t){q.isRequired(e,"url"),q.isRequired(t,"transferFormat"),q.isIn(t,Z,"transferFormat"),this._logger.log(d.Trace,"(WebSockets transport) Connecting.");let n;return this._accessTokenFactory&&(n=await this._accessTokenFactory()),new Promise((s,o)=>{e=e.replace(/^http/,"ws");let i;const a=this._httpClient.getCookieString(e);let c=!1;if(U.isNode||U.isReactNative){const l={},[h,f]=ge();l[h]=f,n&&(l[he.Authorization]=`Bearer ${n}`),a&&(l[he.Cookie]=a),i=new this._webSocketConstructor(e,void 0,{headers:{...l,...this._headers}})}else n&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(n)}`);i||(i=new this._webSocketConstructor(e)),t===Z.Binary&&(i.binaryType="arraybuffer"),i.onopen=l=>{this._logger.log(d.Information,`WebSocket connected to ${e}.`),this._webSocket=i,c=!0,s()},i.onerror=l=>{let h=null;typeof ErrorEvent<"u"&&l instanceof ErrorEvent?h=l.error:h="There was an error with the transport",this._logger.log(d.Information,`(WebSockets transport) ${h}.`)},i.onmessage=l=>{if(this._logger.log(d.Trace,`(WebSockets transport) data received. ${ve(l.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(l.data)}catch(h){this._close(h);return}},i.onclose=l=>{if(c)this._close(l);else{let h=null;typeof ErrorEvent<"u"&&l instanceof ErrorEvent?h=l.error:h="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",o(new Error(h))}}})}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(d.Trace,`(WebSockets transport) sending data. ${ve(e,this._logMessageContent)}.`),this._webSocket.send(e),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(e){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(d.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(e)&&(e.wasClean===!1||e.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${e.code} (${e.reason||"no reason given"}).`)):e instanceof Error?this.onclose(e):this.onclose())}_isCloseEvent(e){return e&&typeof e.wasClean=="boolean"&&typeof e.code=="number"}}const At=100;class rn{constructor(e,t={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,q.isRequired(e,"url"),this._logger=Dr(t.logger),this.baseUrl=this._resolveUrl(e),t=t||{},t.logMessageContent=t.logMessageContent===void 0?!1:t.logMessageContent,typeof t.withCredentials=="boolean"||t.withCredentials===void 0)t.withCredentials=t.withCredentials===void 0?!0:t.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");t.timeout=t.timeout===void 0?100*1e3:t.timeout;let n=null,s=null;if(U.isNode&&typeof require<"u"){const o=typeof __webpack_require__=="function"?__non_webpack_require__:require;n=o("ws"),s=o("eventsource")}!U.isNode&&typeof WebSocket<"u"&&!t.WebSocket?t.WebSocket=WebSocket:U.isNode&&!t.WebSocket&&n&&(t.WebSocket=n),!U.isNode&&typeof EventSource<"u"&&!t.EventSource?t.EventSource=EventSource:U.isNode&&!t.EventSource&&typeof s<"u"&&(t.EventSource=s),this._httpClient=new Kr(t.httpClient||new Wr(this._logger),t.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=t,this.onreceive=null,this.onclose=null}async start(e){if(e=e||Z.Binary,q.isIn(e,Z,"transferFormat"),this._logger.log(d.Debug,`Starting connection with transfer format '${Z[e]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(e),await this._startInternalPromise,this._connectionState==="Disconnecting"){const t="Failed to start the HttpConnection before stop() was called.";return this._logger.log(d.Error,t),await this._stopPromise,Promise.reject(new ie(t))}else if(this._connectionState!=="Connected"){const t="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(d.Error,t),Promise.reject(new ie(t))}this._connectionStarted=!0}send(e){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new Xe(this.transport)),this._sendQueue.send(e))}async stop(e){if(this._connectionState==="Disconnected")return this._logger.log(d.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(d.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(t=>{this._stopPromiseResolver=t}),await this._stopInternal(e),await this._stopPromise}async _stopInternal(e){this._stopError=e;try{await this._startInternalPromise}catch{}if(this.transport){try{await this.transport.stop()}catch(t){this._logger.log(d.Error,`HttpConnection.transport.stop() threw error '${t}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(d.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(e){let t=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===V.WebSockets)this.transport=this._constructTransport(V.WebSockets),await this._startTransport(t,e);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let n=null,s=0;do{if(n=await this._getNegotiationResponse(t),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new ie("The connection was stopped during negotiation.");if(n.error)throw new Error(n.error);if(n.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(n.url&&(t=n.url),n.accessToken){const o=n.accessToken;this._accessTokenFactory=()=>o,this._httpClient._accessToken=o,this._httpClient._accessTokenFactory=void 0}s++}while(n.url&&s<At);if(s===At&&n.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(t,this._options.transport,n,e)}this.transport instanceof It&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(d.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(n){return this._logger.log(d.Error,"Failed to start the connection: "+n),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(n)}}async _getNegotiationResponse(e){const t={},[n,s]=ge();t[n]=s;const o=this._resolveNegotiateUrl(e);this._logger.log(d.Debug,`Sending negotiation request: ${o}.`);try{const i=await this._httpClient.post(o,{content:"",headers:{...t,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(i.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${i.statusCode}'`));const a=JSON.parse(i.content);return(!a.negotiateVersion||a.negotiateVersion<1)&&(a.connectionToken=a.connectionId),a.useStatefulReconnect&&this._options._useStatefulReconnect!==!0?Promise.reject(new kt("Client didn't negotiate Stateful Reconnect but the server did.")):a}catch(i){let a="Failed to complete negotiation with the server: "+i;return i instanceof ue&&i.statusCode===404&&(a=a+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(d.Error,a),Promise.reject(new kt(a))}}_createConnectUrl(e,t){return t?e+(e.indexOf("?")===-1?"?":"&")+`id=${t}`:e}async _createTransport(e,t,n,s){let o=this._createConnectUrl(e,n.connectionToken);if(this._isITransport(t)){this._logger.log(d.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=t,await this._startTransport(o,s),this.connectionId=n.connectionId;return}const i=[],a=n.availableTransports||[];let c=n;for(const l of a){const h=this._resolveTransportOrError(l,t,s,c?.useStatefulReconnect===!0);if(h instanceof Error)i.push(`${l.transport} failed:`),i.push(h);else if(this._isITransport(h)){if(this.transport=h,!c){try{c=await this._getNegotiationResponse(e)}catch(f){return Promise.reject(f)}o=this._createConnectUrl(e,c.connectionToken)}try{await this._startTransport(o,s),this.connectionId=c.connectionId;return}catch(f){if(this._logger.log(d.Error,`Failed to start the transport '${l.transport}': ${f}`),c=void 0,i.push(new Ir(`${l.transport} failed: ${f}`,V[l.transport])),this._connectionState!=="Connecting"){const g="Failed to select transport before stop() was called.";return this._logger.log(d.Debug,g),Promise.reject(new ie(g))}}}}return i.length>0?Promise.reject(new Ar(`Unable to connect to the server with any of the available transports. ${i.join(" ")}`,i)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(e){switch(e){case V.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new tn(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case V.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new en(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case V.LongPolling:return new It(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async n=>{let s=!1;if(this.features.reconnect)try{this.features.disconnected(),await this.transport.connect(e,t),await this.features.resend()}catch{s=!0}else{this._stopConnection(n);return}s&&this._stopConnection(n)}:this.transport.onclose=n=>this._stopConnection(n),this.transport.connect(e,t)}_resolveTransportOrError(e,t,n,s){const o=V[e.transport];if(o==null)return this._logger.log(d.Debug,`Skipping transport '${e.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${e.transport}' because it is not supported by this client.`);if(nn(t,o))if(e.transferFormats.map(a=>Z[a]).indexOf(n)>=0){if(o===V.WebSockets&&!this._options.WebSocket||o===V.ServerSentEvents&&!this._options.EventSource)return this._logger.log(d.Debug,`Skipping transport '${V[o]}' because it is not supported in your environment.'`),new Pr(`'${V[o]}' is not supported in your environment.`,o);this._logger.log(d.Debug,`Selecting transport '${V[o]}'.`);try{return this.features.reconnect=o===V.WebSockets?s:void 0,this._constructTransport(o)}catch(a){return a}}else return this._logger.log(d.Debug,`Skipping transport '${V[o]}' because it does not support the requested transfer format '${Z[n]}'.`),new Error(`'${V[o]}' does not support ${Z[n]}.`);else return this._logger.log(d.Debug,`Skipping transport '${V[o]}' because it was disabled by the client.`),new Rr(`'${V[o]}' is disabled by the client.`,o)}_isITransport(e){return e&&typeof e=="object"&&"connect"in e}_stopConnection(e){if(this._logger.log(d.Debug,`HttpConnection.stopConnection(${e}) called while in state ${this._connectionState}.`),this.transport=void 0,e=this._stopError||e,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(d.Debug,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(d.Warning,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${e}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),e?this._logger.log(d.Error,`Connection disconnected with error '${e}'.`):this._logger.log(d.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(t=>{this._logger.log(d.Error,`TransportSendQueue.stop() threw error '${t}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(e)}catch(t){this._logger.log(d.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}_resolveUrl(e){if(e.lastIndexOf("https://",0)===0||e.lastIndexOf("http://",0)===0)return e;if(!U.isBrowser)throw new Error(`Cannot resolve '${e}'.`);const t=window.document.createElement("a");return t.href=e,this._logger.log(d.Information,`Normalizing '${e}' to '${t.href}'.`),t.href}_resolveNegotiateUrl(e){const t=new URL(e);t.pathname.endsWith("/")?t.pathname+="negotiate":t.pathname+="/negotiate";const n=new URLSearchParams(t.searchParams);return n.has("negotiateVersion")||n.append("negotiateVersion",this._negotiateVersion.toString()),n.has("useStatefulReconnect")?n.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&n.append("useStatefulReconnect","true"),t.search=n.toString(),t.toString()}}function nn(r,e){return!r||(e&r)!==0}class Xe{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new Ce,this._transportResult=new Ce,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new Ce),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(e){if(this._buffer.length&&typeof this._buffer[0]!=typeof e)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof e}`);this._buffer.push(e),this._sendBufferedData.resolve()}async _sendLoop(){for(;;){if(await this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new Ce;const e=this._transportResult;this._transportResult=void 0;const t=typeof this._buffer[0]=="string"?this._buffer.join(""):Xe._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(t),e.resolve()}catch(n){e.reject(n)}}}static _concatBuffers(e){const t=e.map(o=>o.byteLength).reduce((o,i)=>o+i),n=new Uint8Array(t);let s=0;for(const o of e)n.set(new Uint8Array(o),s),s+=o.byteLength;return n.buffer}}class Ce{constructor(){this.promise=new Promise((e,t)=>[this._resolver,this._rejecter]=[e,t])}resolve(){this._resolver()}reject(e){this._rejecter(e)}}const on="json";class sn{constructor(){this.name=on,this.version=2,this.transferFormat=Z.Text}parseMessages(e,t){if(typeof e!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!e)return[];t===null&&(t=me.instance);const n=ne.parse(e),s=[];for(const o of n){const i=JSON.parse(o);if(typeof i.type!="number")throw new Error("Invalid payload.");switch(i.type){case A.Invocation:this._isInvocationMessage(i);break;case A.StreamItem:this._isStreamItemMessage(i);break;case A.Completion:this._isCompletionMessage(i);break;case A.Ping:break;case A.Close:break;case A.Ack:this._isAckMessage(i);break;case A.Sequence:this._isSequenceMessage(i);break;default:t.log(d.Information,"Unknown message type '"+i.type+"' ignored.");continue}s.push(i)}return s}writeMessage(e){return ne.write(JSON.stringify(e))}_isInvocationMessage(e){this._assertNotEmptyString(e.target,"Invalid payload for Invocation message."),e.invocationId!==void 0&&this._assertNotEmptyString(e.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(e){if(this._assertNotEmptyString(e.invocationId,"Invalid payload for StreamItem message."),e.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(e){if(e.result&&e.error)throw new Error("Invalid payload for Completion message.");!e.result&&e.error&&this._assertNotEmptyString(e.error,"Invalid payload for Completion message."),this._assertNotEmptyString(e.invocationId,"Invalid payload for Completion message.")}_isAckMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(e,t){if(typeof e!="string"||e==="")throw new Error(t)}}const an={trace:d.Trace,debug:d.Debug,info:d.Information,information:d.Information,warn:d.Warning,warning:d.Warning,error:d.Error,critical:d.Critical,none:d.None};function cn(r){const e=an[r.toLowerCase()];if(typeof e<"u")return e;throw new Error(`Unknown log level: ${r}`)}class ln{configureLogging(e){if(q.isRequired(e,"logging"),un(e))this.logger=e;else if(typeof e=="string"){const t=cn(e);this.logger=new Pe(t)}else this.logger=new Pe(e);return this}withUrl(e,t){return q.isRequired(e,"url"),q.isNotEmpty(e,"url"),this.url=e,typeof t=="object"?this.httpConnectionOptions={...this.httpConnectionOptions,...t}:this.httpConnectionOptions={...this.httpConnectionOptions,transport:t},this}withHubProtocol(e){return q.isRequired(e,"protocol"),this.protocol=e,this}withAutomaticReconnect(e){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return e?Array.isArray(e)?this.reconnectPolicy=new Rt(e):this.reconnectPolicy=e:this.reconnectPolicy=new Rt,this}withServerTimeout(e){return q.isRequired(e,"milliseconds"),this._serverTimeoutInMilliseconds=e,this}withKeepAliveInterval(e){return q.isRequired(e,"milliseconds"),this._keepAliveIntervalInMilliseconds=e,this}withStatefulReconnect(e){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=e?.bufferSize,this}build(){const e=this.httpConnectionOptions||{};if(e.logger===void 0&&(e.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const t=new rn(this.url,e);return Ge.create(t,this.logger||me.instance,this.protocol||new sn,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}}function un(r){return r.log!==void 0}/**
|
|
40
|
+
*/var je,st;function er(){if(st)return je;st=1;var r=Object.getOwnPropertySymbols,e=Object.prototype.hasOwnProperty,t=Object.prototype.propertyIsEnumerable;function n(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function s(){try{if(!Object.assign)return!1;var o=new String("abc");if(o[5]="de",Object.getOwnPropertyNames(o)[0]==="5")return!1;for(var i={},a=0;a<10;a++)i["_"+String.fromCharCode(a)]=a;var c=Object.getOwnPropertyNames(i).map(function(h){return i[h]});if(c.join("")!=="0123456789")return!1;var l={};return"abcdefghijklmnopqrst".split("").forEach(function(h){l[h]=h}),Object.keys(Object.assign({},l)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return je=s()?Object.assign:function(o,i){for(var a,c=n(o),l,h=1;h<arguments.length;h++){a=Object(arguments[h]);for(var f in a)e.call(a,f)&&(c[f]=a[f]);if(r){l=r(a);for(var g=0;g<l.length;g++)t.call(a,l[g])&&(c[l[g]]=a[l[g]])}}return c},je}var Oe,it;function Qe(){if(it)return Oe;it=1;var r="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Oe=r,Oe}var De,at;function $t(){return at||(at=1,De=Function.call.bind(Object.prototype.hasOwnProperty)),De}var Me,ct;function tr(){if(ct)return Me;ct=1;var r=function(){};if(process.env.NODE_ENV!=="production"){var e=Qe(),t={},n=$t();r=function(o){var i="Warning: "+o;typeof console<"u"&&console.error(i);try{throw new Error(i)}catch{}}}function s(o,i,a,c,l){if(process.env.NODE_ENV!=="production"){for(var h in o)if(n(o,h)){var f;try{if(typeof o[h]!="function"){var g=Error((c||"React class")+": "+a+" type `"+h+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[h]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw g.name="Invariant Violation",g}f=o[h](i,h,c,a,null,e)}catch(w){f=w}if(f&&!(f instanceof Error)&&r((c||"React class")+": type specification of "+a+" `"+h+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof f+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),f instanceof Error&&!(f.message in t)){t[f.message]=!0;var E=l?l():"";r("Failed "+a+" type: "+f.message+(E??""))}}}}return s.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(t={})},Me=s,Me}var Ne,lt;function rr(){if(lt)return Ne;lt=1;var r=Nt(),e=er(),t=Qe(),n=$t(),s=tr(),o=function(){};process.env.NODE_ENV!=="production"&&(o=function(a){var c="Warning: "+a;typeof console<"u"&&console.error(c);try{throw new Error(c)}catch{}});function i(){return null}return Ne=function(a,c){var l=typeof Symbol=="function"&&Symbol.iterator,h="@@iterator";function f(_){var u=_&&(l&&_[l]||_[h]);if(typeof u=="function")return u}var g="<<anonymous>>",E={array:k("array"),bigint:k("bigint"),bool:k("boolean"),func:k("function"),number:k("number"),object:k("object"),string:k("string"),symbol:k("symbol"),any:B(),arrayOf:M,element:N(),elementType:y(),instanceOf:V,node:G(),objectOf:ne,oneOf:Z,oneOfType:J,shape:ee,exact:K};function w(_,u){return _===u?_!==0||1/_===1/u:_!==_&&u!==u}function p(_,u){this.message=_,this.data=u&&typeof u=="object"?u:{},this.stack=""}p.prototype=Error.prototype;function j(_){if(process.env.NODE_ENV!=="production")var u={},b=0;function T(D,I,v,C,P,R,z){if(C=C||g,R=R||v,z!==t){if(c){var S=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw S.name="Invariant Violation",S}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ae=C+":"+v;!u[ae]&&b<3&&(o("You are manually calling a React.PropTypes validation function for the `"+R+"` prop on `"+C+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),u[ae]=!0,b++)}}return I[v]==null?D?I[v]===null?new p("The "+P+" `"+R+"` is marked as required "+("in `"+C+"`, but its value is `null`.")):new p("The "+P+" `"+R+"` is marked as required in "+("`"+C+"`, but its value is `undefined`.")):null:_(I,v,C,P,R)}var x=T.bind(null,!1);return x.isRequired=T.bind(null,!0),x}function k(_){function u(b,T,x,D,I,v){var C=b[T],P=H(C);if(P!==_){var R=oe(C);return new p("Invalid "+D+" `"+I+"` of type "+("`"+R+"` supplied to `"+x+"`, expected ")+("`"+_+"`."),{expectedType:_})}return null}return j(u)}function B(){return j(i)}function M(_){function u(b,T,x,D,I){if(typeof _!="function")return new p("Property `"+I+"` of component `"+x+"` has invalid PropType notation inside arrayOf.");var v=b[T];if(!Array.isArray(v)){var C=H(v);return new p("Invalid "+D+" `"+I+"` of type "+("`"+C+"` supplied to `"+x+"`, expected an array."))}for(var P=0;P<v.length;P++){var R=_(v,P,x,D,I+"["+P+"]",t);if(R instanceof Error)return R}return null}return j(u)}function N(){function _(u,b,T,x,D){var I=u[b];if(!a(I)){var v=H(I);return new p("Invalid "+x+" `"+D+"` of type "+("`"+v+"` supplied to `"+T+"`, expected a single ReactElement."))}return null}return j(_)}function y(){function _(u,b,T,x,D){var I=u[b];if(!r.isValidElementType(I)){var v=H(I);return new p("Invalid "+x+" `"+D+"` of type "+("`"+v+"` supplied to `"+T+"`, expected a single ReactElement type."))}return null}return j(_)}function V(_){function u(b,T,x,D,I){if(!(b[T]instanceof _)){var v=_.name||g,C=le(b[T]);return new p("Invalid "+D+" `"+I+"` of type "+("`"+C+"` supplied to `"+x+"`, expected ")+("instance of `"+v+"`."))}return null}return j(u)}function Z(_){if(!Array.isArray(_))return process.env.NODE_ENV!=="production"&&(arguments.length>1?o("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):o("Invalid argument supplied to oneOf, expected an array.")),i;function u(b,T,x,D,I){for(var v=b[T],C=0;C<_.length;C++)if(w(v,_[C]))return null;var P=JSON.stringify(_,function(z,S){var ae=oe(S);return ae==="symbol"?String(S):S});return new p("Invalid "+D+" `"+I+"` of value `"+String(v)+"` "+("supplied to `"+x+"`, expected one of "+P+"."))}return j(u)}function ne(_){function u(b,T,x,D,I){if(typeof _!="function")return new p("Property `"+I+"` of component `"+x+"` has invalid PropType notation inside objectOf.");var v=b[T],C=H(v);if(C!=="object")return new p("Invalid "+D+" `"+I+"` of type "+("`"+C+"` supplied to `"+x+"`, expected an object."));for(var P in v)if(n(v,P)){var R=_(v,P,x,D,I+"."+P,t);if(R instanceof Error)return R}return null}return j(u)}function J(_){if(!Array.isArray(_))return process.env.NODE_ENV!=="production"&&o("Invalid argument supplied to oneOfType, expected an instance of array."),i;for(var u=0;u<_.length;u++){var b=_[u];if(typeof b!="function")return o("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+ce(b)+" at index "+u+"."),i}function T(x,D,I,v,C){for(var P=[],R=0;R<_.length;R++){var z=_[R],S=z(x,D,I,v,C,t);if(S==null)return null;S.data&&n(S.data,"expectedType")&&P.push(S.data.expectedType)}var ae=P.length>0?", expected one of type ["+P.join(", ")+"]":"";return new p("Invalid "+v+" `"+C+"` supplied to "+("`"+I+"`"+ae+"."))}return j(T)}function G(){function _(u,b,T,x,D){return Q(u[b])?null:new p("Invalid "+x+" `"+D+"` supplied to "+("`"+T+"`, expected a ReactNode."))}return j(_)}function Y(_,u,b,T,x){return new p((_||"React class")+": "+u+" type `"+b+"."+T+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+x+"`.")}function ee(_){function u(b,T,x,D,I){var v=b[T],C=H(v);if(C!=="object")return new p("Invalid "+D+" `"+I+"` of type `"+C+"` "+("supplied to `"+x+"`, expected `object`."));for(var P in _){var R=_[P];if(typeof R!="function")return Y(x,D,I,P,oe(R));var z=R(v,P,x,D,I+"."+P,t);if(z)return z}return null}return j(u)}function K(_){function u(b,T,x,D,I){var v=b[T],C=H(v);if(C!=="object")return new p("Invalid "+D+" `"+I+"` of type `"+C+"` "+("supplied to `"+x+"`, expected `object`."));var P=e({},b[T],_);for(var R in P){var z=_[R];if(n(_,R)&&typeof z!="function")return Y(x,D,I,R,oe(z));if(!z)return new p("Invalid "+D+" `"+I+"` key `"+R+"` supplied to `"+x+"`.\nBad object: "+JSON.stringify(b[T],null," ")+`
|
|
41
|
+
Valid keys: `+JSON.stringify(Object.keys(_),null," "));var S=z(v,R,x,D,I+"."+R,t);if(S)return S}return null}return j(u)}function Q(_){switch(typeof _){case"number":case"string":case"undefined":return!0;case"boolean":return!_;case"object":if(Array.isArray(_))return _.every(Q);if(_===null||a(_))return!0;var u=f(_);if(u){var b=u.call(_),T;if(u!==_.entries){for(;!(T=b.next()).done;)if(!Q(T.value))return!1}else for(;!(T=b.next()).done;){var x=T.value;if(x&&!Q(x[1]))return!1}}else return!1;return!0;default:return!1}}function te(_,u){return _==="symbol"?!0:u?u["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&u instanceof Symbol:!1}function H(_){var u=typeof _;return Array.isArray(_)?"array":_ instanceof RegExp?"object":te(u,_)?"symbol":u}function oe(_){if(typeof _>"u"||_===null)return""+_;var u=H(_);if(u==="object"){if(_ instanceof Date)return"date";if(_ instanceof RegExp)return"regexp"}return u}function ce(_){var u=oe(_);switch(u){case"array":case"object":return"an "+u;case"boolean":case"date":case"regexp":return"a "+u;default:return u}}function le(_){return!_.constructor||!_.constructor.name?g:_.constructor.name}return E.checkPropTypes=s,E.resetWarningCache=s.resetWarningCache,E.PropTypes=E,E},Ne}var $e,ut;function nr(){if(ut)return $e;ut=1;var r=Qe();function e(){}function t(){}return t.resetWarningCache=e,$e=function(){function n(i,a,c,l,h,f){if(f!==r){var g=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw g.name="Invariant Violation",g}}n.isRequired=n;function s(){return n}var o={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:s,element:n,elementType:n,instanceOf:s,node:n,objectOf:s,oneOf:s,oneOfType:s,shape:s,exact:s,checkPropTypes:t,resetWarningCache:e};return o.PropTypes=o,o},$e}var ht;function Lt(){if(ht)return Se.exports;if(ht=1,process.env.NODE_ENV!=="production"){var r=Nt(),e=!0;Se.exports=rr()(r.isElement,e)}else Se.exports=nr()();return Se.exports}var Le,ft;function Bt(){return ft||(ft=1,Le={L:1,M:0,Q:3,H:2}),Le}var Be,dt;function zt(){return dt||(dt=1,Be={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}),Be}var ze,gt;function or(){if(gt)return ze;gt=1;var r=zt();function e(t){this.mode=r.MODE_8BIT_BYTE,this.data=t}return e.prototype={getLength:function(t){return this.data.length},write:function(t){for(var n=0;n<this.data.length;n++)t.put(this.data.charCodeAt(n),8)}},ze=e,ze}var He,pt;function sr(){if(pt)return He;pt=1;var r=Bt();function e(t,n){this.totalCount=t,this.dataCount=n}return e.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],e.getRSBlocks=function(t,n){var s=e.getRsBlockTable(t,n);if(s==null)throw new Error("bad rs block @ typeNumber:"+t+"/errorCorrectLevel:"+n);for(var o=s.length/3,i=new Array,a=0;a<o;a++)for(var c=s[a*3+0],l=s[a*3+1],h=s[a*3+2],f=0;f<c;f++)i.push(new e(l,h));return i},e.getRsBlockTable=function(t,n){switch(n){case r.L:return e.RS_BLOCK_TABLE[(t-1)*4+0];case r.M:return e.RS_BLOCK_TABLE[(t-1)*4+1];case r.Q:return e.RS_BLOCK_TABLE[(t-1)*4+2];case r.H:return e.RS_BLOCK_TABLE[(t-1)*4+3];default:return}},He=e,He}var We,_t;function ir(){if(_t)return We;_t=1;function r(){this.buffer=new Array,this.length=0}return r.prototype={get:function(e){var t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(var n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},We=r,We}var Ue,mt;function Ht(){if(mt)return Ue;mt=1;for(var r={glog:function(t){if(t<1)throw new Error("glog("+t+")");return r.LOG_TABLE[t]},gexp:function(t){for(;t<0;)t+=255;for(;t>=256;)t-=255;return r.EXP_TABLE[t]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},e=0;e<8;e++)r.EXP_TABLE[e]=1<<e;for(var e=8;e<256;e++)r.EXP_TABLE[e]=r.EXP_TABLE[e-4]^r.EXP_TABLE[e-5]^r.EXP_TABLE[e-6]^r.EXP_TABLE[e-8];for(var e=0;e<255;e++)r.LOG_TABLE[r.EXP_TABLE[e]]=e;return Ue=r,Ue}var Fe,vt;function Wt(){if(vt)return Fe;vt=1;var r=Ht();function e(t,n){if(t.length==null)throw new Error(t.length+"/"+n);for(var s=0;s<t.length&&t[s]==0;)s++;this.num=new Array(t.length-s+n);for(var o=0;o<t.length-s;o++)this.num[o]=t[o+s]}return e.prototype={get:function(t){return this.num[t]},getLength:function(){return this.num.length},multiply:function(t){for(var n=new Array(this.getLength()+t.getLength()-1),s=0;s<this.getLength();s++)for(var o=0;o<t.getLength();o++)n[s+o]^=r.gexp(r.glog(this.get(s))+r.glog(t.get(o)));return new e(n,0)},mod:function(t){if(this.getLength()-t.getLength()<0)return this;for(var n=r.glog(this.get(0))-r.glog(t.get(0)),s=new Array(this.getLength()),o=0;o<this.getLength();o++)s[o]=this.get(o);for(var o=0;o<t.getLength();o++)s[o]^=r.gexp(r.glog(t.get(o))+n);return new e(s,0).mod(t)}},Fe=e,Fe}var qe,yt;function ar(){if(yt)return qe;yt=1;var r=zt(),e=Wt(),t=Ht(),n={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},s={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(o){for(var i=o<<10;s.getBCHDigit(i)-s.getBCHDigit(s.G15)>=0;)i^=s.G15<<s.getBCHDigit(i)-s.getBCHDigit(s.G15);return(o<<10|i)^s.G15_MASK},getBCHTypeNumber:function(o){for(var i=o<<12;s.getBCHDigit(i)-s.getBCHDigit(s.G18)>=0;)i^=s.G18<<s.getBCHDigit(i)-s.getBCHDigit(s.G18);return o<<12|i},getBCHDigit:function(o){for(var i=0;o!=0;)i++,o>>>=1;return i},getPatternPosition:function(o){return s.PATTERN_POSITION_TABLE[o-1]},getMask:function(o,i,a){switch(o){case n.PATTERN000:return(i+a)%2==0;case n.PATTERN001:return i%2==0;case n.PATTERN010:return a%3==0;case n.PATTERN011:return(i+a)%3==0;case n.PATTERN100:return(Math.floor(i/2)+Math.floor(a/3))%2==0;case n.PATTERN101:return i*a%2+i*a%3==0;case n.PATTERN110:return(i*a%2+i*a%3)%2==0;case n.PATTERN111:return(i*a%3+(i+a)%2)%2==0;default:throw new Error("bad maskPattern:"+o)}},getErrorCorrectPolynomial:function(o){for(var i=new e([1],0),a=0;a<o;a++)i=i.multiply(new e([1,t.gexp(a)],0));return i},getLengthInBits:function(o,i){if(1<=i&&i<10)switch(o){case r.MODE_NUMBER:return 10;case r.MODE_ALPHA_NUM:return 9;case r.MODE_8BIT_BYTE:return 8;case r.MODE_KANJI:return 8;default:throw new Error("mode:"+o)}else if(i<27)switch(o){case r.MODE_NUMBER:return 12;case r.MODE_ALPHA_NUM:return 11;case r.MODE_8BIT_BYTE:return 16;case r.MODE_KANJI:return 10;default:throw new Error("mode:"+o)}else if(i<41)switch(o){case r.MODE_NUMBER:return 14;case r.MODE_ALPHA_NUM:return 13;case r.MODE_8BIT_BYTE:return 16;case r.MODE_KANJI:return 12;default:throw new Error("mode:"+o)}else throw new Error("type:"+i)},getLostPoint:function(o){for(var i=o.getModuleCount(),a=0,c=0;c<i;c++)for(var l=0;l<i;l++){for(var h=0,f=o.isDark(c,l),g=-1;g<=1;g++)if(!(c+g<0||i<=c+g))for(var E=-1;E<=1;E++)l+E<0||i<=l+E||g==0&&E==0||f==o.isDark(c+g,l+E)&&h++;h>5&&(a+=3+h-5)}for(var c=0;c<i-1;c++)for(var l=0;l<i-1;l++){var w=0;o.isDark(c,l)&&w++,o.isDark(c+1,l)&&w++,o.isDark(c,l+1)&&w++,o.isDark(c+1,l+1)&&w++,(w==0||w==4)&&(a+=3)}for(var c=0;c<i;c++)for(var l=0;l<i-6;l++)o.isDark(c,l)&&!o.isDark(c,l+1)&&o.isDark(c,l+2)&&o.isDark(c,l+3)&&o.isDark(c,l+4)&&!o.isDark(c,l+5)&&o.isDark(c,l+6)&&(a+=40);for(var l=0;l<i;l++)for(var c=0;c<i-6;c++)o.isDark(c,l)&&!o.isDark(c+1,l)&&o.isDark(c+2,l)&&o.isDark(c+3,l)&&o.isDark(c+4,l)&&!o.isDark(c+5,l)&&o.isDark(c+6,l)&&(a+=40);for(var p=0,l=0;l<i;l++)for(var c=0;c<i;c++)o.isDark(c,l)&&p++;var j=Math.abs(100*p/i/i-50)/5;return a+=j*10,a}};return qe=s,qe}var Ve,wt;function cr(){if(wt)return Ve;wt=1;var r=or(),e=sr(),t=ir(),n=ar(),s=Wt();function o(a,c){this.typeNumber=a,this.errorCorrectLevel=c,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var i=o.prototype;return i.addData=function(a){var c=new r(a);this.dataList.push(c),this.dataCache=null},i.isDark=function(a,c){if(a<0||this.moduleCount<=a||c<0||this.moduleCount<=c)throw new Error(a+","+c);return this.modules[a][c]},i.getModuleCount=function(){return this.moduleCount},i.make=function(){if(this.typeNumber<1){var a=1;for(a=1;a<40;a++){for(var c=e.getRSBlocks(a,this.errorCorrectLevel),l=new t,h=0,f=0;f<c.length;f++)h+=c[f].dataCount;for(var f=0;f<this.dataList.length;f++){var g=this.dataList[f];l.put(g.mode,4),l.put(g.getLength(),n.getLengthInBits(g.mode,a)),g.write(l)}if(l.getLengthInBits()<=h*8)break}this.typeNumber=a}this.makeImpl(!1,this.getBestMaskPattern())},i.makeImpl=function(a,c){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var l=0;l<this.moduleCount;l++){this.modules[l]=new Array(this.moduleCount);for(var h=0;h<this.moduleCount;h++)this.modules[l][h]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(a,c),this.typeNumber>=7&&this.setupTypeNumber(a),this.dataCache==null&&(this.dataCache=o.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,c)},i.setupPositionProbePattern=function(a,c){for(var l=-1;l<=7;l++)if(!(a+l<=-1||this.moduleCount<=a+l))for(var h=-1;h<=7;h++)c+h<=-1||this.moduleCount<=c+h||(0<=l&&l<=6&&(h==0||h==6)||0<=h&&h<=6&&(l==0||l==6)||2<=l&&l<=4&&2<=h&&h<=4?this.modules[a+l][c+h]=!0:this.modules[a+l][c+h]=!1)},i.getBestMaskPattern=function(){for(var a=0,c=0,l=0;l<8;l++){this.makeImpl(!0,l);var h=n.getLostPoint(this);(l==0||a>h)&&(a=h,c=l)}return c},i.createMovieClip=function(a,c,l){var h=a.createEmptyMovieClip(c,l),f=1;this.make();for(var g=0;g<this.modules.length;g++)for(var E=g*f,w=0;w<this.modules[g].length;w++){var p=w*f,j=this.modules[g][w];j&&(h.beginFill(0,100),h.moveTo(p,E),h.lineTo(p+f,E),h.lineTo(p+f,E+f),h.lineTo(p,E+f),h.endFill())}return h},i.setupTimingPattern=function(){for(var a=8;a<this.moduleCount-8;a++)this.modules[a][6]==null&&(this.modules[a][6]=a%2==0);for(var c=8;c<this.moduleCount-8;c++)this.modules[6][c]==null&&(this.modules[6][c]=c%2==0)},i.setupPositionAdjustPattern=function(){for(var a=n.getPatternPosition(this.typeNumber),c=0;c<a.length;c++)for(var l=0;l<a.length;l++){var h=a[c],f=a[l];if(this.modules[h][f]==null)for(var g=-2;g<=2;g++)for(var E=-2;E<=2;E++)g==-2||g==2||E==-2||E==2||g==0&&E==0?this.modules[h+g][f+E]=!0:this.modules[h+g][f+E]=!1}},i.setupTypeNumber=function(a){for(var c=n.getBCHTypeNumber(this.typeNumber),l=0;l<18;l++){var h=!a&&(c>>l&1)==1;this.modules[Math.floor(l/3)][l%3+this.moduleCount-8-3]=h}for(var l=0;l<18;l++){var h=!a&&(c>>l&1)==1;this.modules[l%3+this.moduleCount-8-3][Math.floor(l/3)]=h}},i.setupTypeInfo=function(a,c){for(var l=this.errorCorrectLevel<<3|c,h=n.getBCHTypeInfo(l),f=0;f<15;f++){var g=!a&&(h>>f&1)==1;f<6?this.modules[f][8]=g:f<8?this.modules[f+1][8]=g:this.modules[this.moduleCount-15+f][8]=g}for(var f=0;f<15;f++){var g=!a&&(h>>f&1)==1;f<8?this.modules[8][this.moduleCount-f-1]=g:f<9?this.modules[8][15-f-1+1]=g:this.modules[8][15-f-1]=g}this.modules[this.moduleCount-8][8]=!a},i.mapData=function(a,c){for(var l=-1,h=this.moduleCount-1,f=7,g=0,E=this.moduleCount-1;E>0;E-=2)for(E==6&&E--;;){for(var w=0;w<2;w++)if(this.modules[h][E-w]==null){var p=!1;g<a.length&&(p=(a[g]>>>f&1)==1);var j=n.getMask(c,h,E-w);j&&(p=!p),this.modules[h][E-w]=p,f--,f==-1&&(g++,f=7)}if(h+=l,h<0||this.moduleCount<=h){h-=l,l=-l;break}}},o.PAD0=236,o.PAD1=17,o.createData=function(a,c,l){for(var h=e.getRSBlocks(a,c),f=new t,g=0;g<l.length;g++){var E=l[g];f.put(E.mode,4),f.put(E.getLength(),n.getLengthInBits(E.mode,a)),E.write(f)}for(var w=0,g=0;g<h.length;g++)w+=h[g].dataCount;if(f.getLengthInBits()>w*8)throw new Error("code length overflow. ("+f.getLengthInBits()+">"+w*8+")");for(f.getLengthInBits()+4<=w*8&&f.put(0,4);f.getLengthInBits()%8!=0;)f.putBit(!1);for(;!(f.getLengthInBits()>=w*8||(f.put(o.PAD0,8),f.getLengthInBits()>=w*8));)f.put(o.PAD1,8);return o.createBytes(f,h)},o.createBytes=function(a,c){for(var l=0,h=0,f=0,g=new Array(c.length),E=new Array(c.length),w=0;w<c.length;w++){var p=c[w].dataCount,j=c[w].totalCount-p;h=Math.max(h,p),f=Math.max(f,j),g[w]=new Array(p);for(var k=0;k<g[w].length;k++)g[w][k]=255&a.buffer[k+l];l+=p;var B=n.getErrorCorrectPolynomial(j),M=new s(g[w],B.getLength()-1),N=M.mod(B);E[w]=new Array(B.getLength()-1);for(var k=0;k<E[w].length;k++){var y=k+N.getLength()-E[w].length;E[w][k]=y>=0?N.get(y):0}}for(var V=0,k=0;k<c.length;k++)V+=c[k].totalCount;for(var Z=new Array(V),ne=0,k=0;k<h;k++)for(var w=0;w<c.length;w++)k<g[w].length&&(Z[ne++]=g[w][k]);for(var k=0;k<f;k++)for(var w=0;w<c.length;w++)k<E[w].length&&(Z[ne++]=E[w][k]);return Z},Ve=o,Ve}var Ce={},bt;function lr(){if(bt)return Ce;bt=1,Object.defineProperty(Ce,"__esModule",{value:!0});var r=Object.assign||function(l){for(var h=1;h<arguments.length;h++){var f=arguments[h];for(var g in f)Object.prototype.hasOwnProperty.call(f,g)&&(l[g]=f[g])}return l},e=Lt(),t=o(e),n=O,s=o(n);function o(l){return l&&l.__esModule?l:{default:l}}function i(l,h){var f={};for(var g in l)h.indexOf(g)>=0||Object.prototype.hasOwnProperty.call(l,g)&&(f[g]=l[g]);return f}var a={bgColor:t.default.oneOfType([t.default.object,t.default.string]).isRequired,bgD:t.default.string.isRequired,fgColor:t.default.oneOfType([t.default.object,t.default.string]).isRequired,fgD:t.default.string.isRequired,size:t.default.number.isRequired,title:t.default.string,viewBoxSize:t.default.number.isRequired,xmlns:t.default.string},c=(0,n.forwardRef)(function(l,h){var f=l.bgColor,g=l.bgD,E=l.fgD,w=l.fgColor,p=l.size,j=l.title,k=l.viewBoxSize,B=l.xmlns,M=B===void 0?"http://www.w3.org/2000/svg":B,N=i(l,["bgColor","bgD","fgD","fgColor","size","title","viewBoxSize","xmlns"]);return s.default.createElement("svg",r({},N,{height:p,ref:h,viewBox:"0 0 "+k+" "+k,width:p,xmlns:M}),j?s.default.createElement("title",null,j):null,s.default.createElement("path",{d:g,fill:f}),s.default.createElement("path",{d:E,fill:w}))});return c.displayName="QRCodeSvg",c.propTypes=a,Ce.default=c,Ce}var St;function ur(){if(St)return de;St=1,Object.defineProperty(de,"__esModule",{value:!0}),de.QRCode=void 0;var r=Object.assign||function(p){for(var j=1;j<arguments.length;j++){var k=arguments[j];for(var B in k)Object.prototype.hasOwnProperty.call(k,B)&&(p[B]=k[B])}return p},e=Lt(),t=f(e),n=Bt(),s=f(n),o=cr(),i=f(o),a=O,c=f(a),l=lr(),h=f(l);function f(p){return p&&p.__esModule?p:{default:p}}function g(p,j){var k={};for(var B in p)j.indexOf(B)>=0||Object.prototype.hasOwnProperty.call(p,B)&&(k[B]=p[B]);return k}var E={bgColor:t.default.oneOfType([t.default.object,t.default.string]),fgColor:t.default.oneOfType([t.default.object,t.default.string]),level:t.default.string,size:t.default.number,value:t.default.string.isRequired},w=(0,a.forwardRef)(function(p,j){var k=p.bgColor,B=k===void 0?"#FFFFFF":k,M=p.fgColor,N=M===void 0?"#000000":M,y=p.level,V=y===void 0?"L":y,Z=p.size,ne=Z===void 0?256:Z,J=p.value,G=g(p,["bgColor","fgColor","level","size","value"]),Y=new i.default(-1,s.default[V]);Y.addData(J),Y.make();var ee=Y.modules;return c.default.createElement(h.default,r({},G,{bgColor:B,bgD:ee.map(function(K,Q){return K.map(function(te,H){return te?"":"M "+H+" "+Q+" l 1 0 0 1 -1 0 Z"}).join(" ")}).join(" "),fgColor:N,fgD:ee.map(function(K,Q){return K.map(function(te,H){return te?"M "+H+" "+Q+" l 1 0 0 1 -1 0 Z":""}).join(" ")}).join(" "),ref:j,size:ne,viewBoxSize:ee.length}))});return de.QRCode=w,w.displayName="QRCode",w.propTypes=E,de.default=w,de}var hr=ur();const fr=Qt(hr);var Ut={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Et=O.createContext&&O.createContext(Ut),dr=["attr","size","title"];function gr(r,e){if(r==null)return{};var t=pr(r,e),n,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);for(s=0;s<o.length;s++)n=o[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}function pr(r,e){if(r==null)return{};var t={};for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n)){if(e.indexOf(n)>=0)continue;t[n]=r[n]}return t}function ke(){return ke=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},ke.apply(this,arguments)}function Ct(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(r,s).enumerable})),t.push.apply(t,n)}return t}function Pe(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ct(Object(t),!0).forEach(function(n){_r(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ct(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function _r(r,e,t){return e=mr(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function mr(r){var e=vr(r,"string");return typeof e=="symbol"?e:e+""}function vr(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Ft(r){return r&&r.map((e,t)=>O.createElement(e.tag,Pe({key:t},e.attr),Ft(e.child)))}function Ie(r){return e=>O.createElement(yr,ke({attr:Pe({},r.attr)},e),Ft(r.child))}function yr(r){var e=t=>{var{attr:n,size:s,title:o}=r,i=gr(r,dr),a=s||t.size||"1em",c;return t.className&&(c=t.className),r.className&&(c=(c?c+" ":"")+r.className),O.createElement("svg",ke({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,n,i,{className:c,style:Pe(Pe({color:r.color||t.color},t.style),r.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),o&&O.createElement("title",null,o),r.children)};return Et!==void 0?O.createElement(Et.Consumer,null,t=>e(t)):e(Ut)}function wr(r){return Ie({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M9.5 6.5v3h-3v-3h3M11 5H5v6h6V5zm-1.5 9.5v3h-3v-3h3M11 13H5v6h6v-6zm6.5-6.5v3h-3v-3h3M19 5h-6v6h6V5zm-6 8h1.5v1.5H13V13zm1.5 1.5H16V16h-1.5v-1.5zM16 13h1.5v1.5H16V13zm-3 3h1.5v1.5H13V16zm1.5 1.5H16V19h-1.5v-1.5zM16 16h1.5v1.5H16V16zm1.5-1.5H19V16h-1.5v-1.5zm0 3H19V19h-1.5v-1.5zM22 7h-2V4h-3V2h5v5zm0 15v-5h-2v3h-3v2h5zM2 22h5v-2H4v-3H2v5zM2 2v5h2V4h3V2H2z"},child:[]}]})(r)}const br=({logoBackgroundCss:r="bg-gradient-to-br rounded-xl flex items-center justify-center flex-col",logoCss:e="text-white",size:t="small",isConnected:n=!1})=>{const[s,o]=O.useState("w-2 h-2"),[i,a]=O.useState("w-4 h-4"),[c,l]=O.useState(n?"from-green-200 to-green-600":"from-red-600 to-red-800");return O.useEffect(()=>{switch(t){case"small":a("w-2 h-2"),o("w-1 h-1");break;case"medium":a("w-6 h-6"),o("w-4 h-4");break;case"large":a("w-8 h-8"),o("w-6 h-6");break;case"xlarge":a("w-10 h-10"),o("w-8 h-8");break}return()=>{}},[t]),O.useEffect(()=>{l(n?"bg-gradient-to-r from-green-200 to-green-500":" bg-gradient-to-r from-red-600 to-red-800")},[n]),m.jsx("div",{className:"flex items-center space-x-2",children:m.jsx(wr,{className:`${s} ${e} ${c} rounded-2xl p-1`})})};class me extends Error{constructor(e,t,n){super(`HTTP ${e}: ${t}`),this.status=e,this.statusText=t,this.response=n,this.name="ApiError"}}async function xt(r,e,t){const n=new AbortController,s=n.signal;t?.timeout&&setTimeout(()=>n.abort(),t.timeout);const o=t?.signal||s;try{const i=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",...t?.headers},body:e?JSON.stringify(e):void 0,signal:o});if(!i.ok){let c;try{c=await i.json()}catch{c=await i.text()}throw new me(i.status,i.statusText,c)}return i.headers.get("content-type")?.includes("application/json")?await i.json():await i.text()}catch(i){throw i instanceof me?(console.error("API Error:",i.status,i.message),i):i instanceof me&&i.name==="AbortError"?(console.error("Request was aborted"),new Error("Request timeout")):(console.error("Network error:",i),new Error("Network error occurred"))}}async function Sr(r,e){const s=new AbortController().signal;try{const o=await fetch(r,{method:"DELETE",headers:{"Content-Type":"application/json",...e?.headers},signal:s});if(!o.ok){let i;try{i=await o.json()}catch{i=await o.text()}throw new me(o.status,o.statusText,i)}return}catch(o){throw o instanceof me?(console.error("API Error:",o.status,o.message),o):o instanceof Error&&o.name==="AbortError"?(console.error("Request was aborted"),new Error("Request timeout")):(console.error("Network error:",o),new Error("Network error occurred"))}}function Er(r){return!r||r.trim().length===0}function Cr(r,e){let t=null;return(...n)=>new Promise((s,o)=>{t&&clearTimeout(t),t=setTimeout(()=>{Promise.resolve(r(...n)).then(s).catch(o)},e)})}function xr(r,e=30){if(!r)return!0;try{const n=JSON.parse(atob(r.split(".")[1])).exp;return n?Date.now()/1e3>=n-e:!0}catch{return!0}}function Tt(r){return Ie({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M500.33 0h-47.41a12 12 0 0 0-12 12.57l4 82.76A247.42 247.42 0 0 0 256 8C119.34 8 7.9 119.53 8 256.19 8.1 393.07 119.1 504 256 504a247.1 247.1 0 0 0 166.18-63.91 12 12 0 0 0 .48-17.43l-34-34a12 12 0 0 0-16.38-.55A176 176 0 1 1 402.1 157.8l-101.53-4.87a12 12 0 0 0-12.57 12v47.41a12 12 0 0 0 12 12h200.33a12 12 0 0 0 12-12V12a12 12 0 0 0-12-12z"},child:[]}]})(r)}function Tr(r,e){try{localStorage.setItem(r,JSON.stringify(e))}catch(t){console.error("Error saving to localStorage",t)}}function kr(r){try{const e=localStorage.getItem(r);return e?JSON.parse(e):void 0}catch(e){console.error("Error reading from localStorage",e)}}const Pr=(r,e)=>{const[t,n]=O.useState(()=>kr(r)??e);return O.useEffect(()=>{Tr(r,t),n(t)},[r,t]),O.useEffect(()=>{const s=o=>{o.key===r&&n(o.newValue?JSON.parse(o.newValue):e)};return window.addEventListener("storage",s),()=>window.removeEventListener("storage",s)},[r,e]),[t,n]};class ue extends Error{constructor(e,t){const n=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=n}}class Je extends Error{constructor(e="A timeout occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class ie extends Error{constructor(e="An abort occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class Rr extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=n}}class Ir extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=n}}class Ar extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=n}}class kt extends Error{constructor(e){const t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}}class jr extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=n}}class qt{constructor(e,t,n){this.statusCode=e,this.statusText=t,this.content=n}}class Ae{get(e,t){return this.send({...t,method:"GET",url:e})}post(e,t){return this.send({...t,method:"POST",url:e})}delete(e,t){return this.send({...t,method:"DELETE",url:e})}getCookieString(e){return""}}var d;(function(r){r[r.Trace=0]="Trace",r[r.Debug=1]="Debug",r[r.Information=2]="Information",r[r.Warning=3]="Warning",r[r.Error=4]="Error",r[r.Critical=5]="Critical",r[r.None=6]="None"})(d||(d={}));class ve{constructor(){}log(e,t){}}ve.instance=new ve;const Or="10.0.0";class F{static isRequired(e,t){if(e==null)throw new Error(`The '${t}' argument is required.`)}static isNotEmpty(e,t){if(!e||e.match(/^\s*$/))throw new Error(`The '${t}' argument should not be empty.`)}static isIn(e,t,n){if(!(e in t))throw new Error(`Unknown ${n} value: ${e}.`)}}class U{static get isBrowser(){return!U.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!U.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!U.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}}function ye(r,e){let t="";return fe(r)?(t=`Binary data of length ${r.byteLength}`,e&&(t+=`. Content: '${Dr(r)}'`)):typeof r=="string"&&(t=`String data of length ${r.length}`,e&&(t+=`. Content: '${r}'`)),t}function Dr(r){const e=new Uint8Array(r);let t="";return e.forEach(n=>{const s=n<16?"0":"";t+=`0x${s}${n.toString(16)} `}),t.substring(0,t.length-1)}function fe(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}async function Vt(r,e,t,n,s,o){const i={},[a,c]=ge();i[a]=c,r.log(d.Trace,`(${e} transport) sending data. ${ye(s,o.logMessageContent)}.`);const l=fe(s)?"arraybuffer":"text",h=await t.post(n,{content:s,headers:{...i,...o.headers},responseType:l,timeout:o.timeout,withCredentials:o.withCredentials});r.log(d.Trace,`(${e} transport) request complete. Response status: ${h.statusCode}.`)}function Mr(r){return r===void 0?new Re(d.Information):r===null?ve.instance:r.log!==void 0?r:new Re(r)}class Nr{constructor(e,t){this._subject=e,this._observer=t}dispose(){const e=this._subject.observers.indexOf(this._observer);e>-1&&this._subject.observers.splice(e,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(t=>{})}}class Re{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){const n=`[${new Date().toISOString()}] ${d[e]}: ${t}`;switch(e){case d.Critical:case d.Error:this.out.error(n);break;case d.Warning:this.out.warn(n);break;case d.Information:this.out.info(n);break;default:this.out.log(n);break}}}}function ge(){let r="X-SignalR-User-Agent";return U.isNode&&(r="User-Agent"),[r,$r(Or,Lr(),zr(),Br())]}function $r(r,e,t,n){let s="Microsoft SignalR/";const o=r.split(".");return s+=`${o[0]}.${o[1]}`,s+=` (${r}; `,e&&e!==""?s+=`${e}; `:s+="Unknown OS; ",s+=`${t}`,n?s+=`; ${n}`:s+="; Unknown Runtime Version",s+=")",s}function Lr(){if(U.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function Br(){if(U.isNode)return process.versions.node}function zr(){return U.isNode?"NodeJS":"Browser"}function Ye(r){return r.stack?r.stack:r.message?r.message:`${r}`}function Hr(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}class Wr extends Ae{constructor(e){if(super(),this._logger=e,typeof fetch>"u"||U.isNode){const t=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._jar=new(t("tough-cookie")).CookieJar,typeof fetch>"u"?this._fetchType=t("node-fetch"):this._fetchType=fetch,this._fetchType=t("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(Hr());if(typeof AbortController>"u"){const t=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._abortControllerType=t("abort-controller")}else this._abortControllerType=AbortController}async send(e){if(e.abortSignal&&e.abortSignal.aborted)throw new ie;if(!e.method)throw new Error("No method defined.");if(!e.url)throw new Error("No url defined.");const t=new this._abortControllerType;let n;e.abortSignal&&(e.abortSignal.onabort=()=>{t.abort(),n=new ie});let s=null;if(e.timeout){const c=e.timeout;s=setTimeout(()=>{t.abort(),this._logger.log(d.Warning,"Timeout from HTTP request."),n=new Je},c)}e.content===""&&(e.content=void 0),e.content&&(e.headers=e.headers||{},fe(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");let o;try{o=await this._fetchType(e.url,{body:e.content,cache:"no-cache",credentials:e.withCredentials===!0?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...e.headers},method:e.method,mode:"cors",redirect:"follow",signal:t.signal})}catch(c){throw n||(this._logger.log(d.Warning,`Error from HTTP request. ${c}.`),c)}finally{s&&clearTimeout(s),e.abortSignal&&(e.abortSignal.onabort=null)}if(!o.ok){const c=await Pt(o,"text");throw new ue(c||o.statusText,o.status)}const a=await Pt(o,e.responseType);return new qt(o.status,o.statusText,a)}getCookieString(e){let t="";return U.isNode&&this._jar&&this._jar.getCookies(e,(n,s)=>t=s.join("; ")),t}}function Pt(r,e){let t;switch(e){case"arraybuffer":t=r.arrayBuffer();break;case"text":t=r.text();break;case"blob":case"document":case"json":throw new Error(`${e} is not supported.`);default:t=r.text();break}return t}class Ur extends Ae{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new ie):e.method?e.url?new Promise((t,n)=>{const s=new XMLHttpRequest;s.open(e.method,e.url,!0),s.withCredentials=e.withCredentials===void 0?!0:e.withCredentials,s.setRequestHeader("X-Requested-With","XMLHttpRequest"),e.content===""&&(e.content=void 0),e.content&&(fe(e.content)?s.setRequestHeader("Content-Type","application/octet-stream"):s.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const o=e.headers;o&&Object.keys(o).forEach(i=>{s.setRequestHeader(i,o[i])}),e.responseType&&(s.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{s.abort(),n(new ie)}),e.timeout&&(s.timeout=e.timeout),s.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),s.status>=200&&s.status<300?t(new qt(s.status,s.statusText,s.response||s.responseText)):n(new ue(s.response||s.responseText||s.statusText,s.status))},s.onerror=()=>{this._logger.log(d.Warning,`Error from HTTP request. ${s.status}: ${s.statusText}.`),n(new ue(s.statusText,s.status))},s.ontimeout=()=>{this._logger.log(d.Warning,"Timeout from HTTP request."),n(new Je)},s.send(e.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class Fr extends Ae{constructor(e){if(super(),typeof fetch<"u"||U.isNode)this._httpClient=new Wr(e);else if(typeof XMLHttpRequest<"u")this._httpClient=new Ur(e);else throw new Error("No usable HttpClient found.")}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new ie):e.method?e.url?this._httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(e){return this._httpClient.getCookieString(e)}}class re{static write(e){return`${e}${re.RecordSeparator}`}static parse(e){if(e[e.length-1]!==re.RecordSeparator)throw new Error("Message is incomplete.");const t=e.split(re.RecordSeparator);return t.pop(),t}}re.RecordSeparatorCode=30;re.RecordSeparator=String.fromCharCode(re.RecordSeparatorCode);class qr{writeHandshakeRequest(e){return re.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,n;if(fe(e)){const a=new Uint8Array(e),c=a.indexOf(re.RecordSeparatorCode);if(c===-1)throw new Error("Message is incomplete.");const l=c+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(a.slice(0,l))),n=a.byteLength>l?a.slice(l).buffer:null}else{const a=e,c=a.indexOf(re.RecordSeparator);if(c===-1)throw new Error("Message is incomplete.");const l=c+1;t=a.substring(0,l),n=a.length>l?a.substring(l):null}const s=re.parse(t),o=JSON.parse(s[0]);if(o.type)throw new Error("Expected a handshake response from the server.");return[n,o]}}var A;(function(r){r[r.Invocation=1]="Invocation",r[r.StreamItem=2]="StreamItem",r[r.Completion=3]="Completion",r[r.StreamInvocation=4]="StreamInvocation",r[r.CancelInvocation=5]="CancelInvocation",r[r.Ping=6]="Ping",r[r.Close=7]="Close",r[r.Ack=8]="Ack",r[r.Sequence=9]="Sequence"})(A||(A={}));class Vr{constructor(){this.observers=[]}next(e){for(const t of this.observers)t.next(e)}error(e){for(const t of this.observers)t.error&&t.error(e)}complete(){for(const e of this.observers)e.complete&&e.complete()}subscribe(e){return this.observers.push(e),new Nr(this,e)}}class Yr{constructor(e,t,n){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=e,this._connection=t,this._bufferSize=n}async _send(e){const t=this._protocol.writeMessage(e);let n=Promise.resolve();if(this._isInvocationMessage(e)){this._totalMessageCount++;let s=()=>{},o=()=>{};fe(t)?this._bufferedByteCount+=t.byteLength:this._bufferedByteCount+=t.length,this._bufferedByteCount>=this._bufferSize&&(n=new Promise((i,a)=>{s=i,o=a})),this._messages.push(new Qr(t,this._totalMessageCount,s,o))}try{this._reconnectInProgress||await this._connection.send(t)}catch{this._disconnected()}await n}_ack(e){let t=-1;for(let n=0;n<this._messages.length;n++){const s=this._messages[n];if(s._id<=e.sequenceId)t=n,fe(s._message)?this._bufferedByteCount-=s._message.byteLength:this._bufferedByteCount-=s._message.length,s._resolver();else if(this._bufferedByteCount<this._bufferSize)s._resolver();else break}t!==-1&&(this._messages=this._messages.slice(t+1))}_shouldProcessMessage(e){if(this._waitForSequenceMessage)return e.type!==A.Sequence?!1:(this._waitForSequenceMessage=!1,!0);if(!this._isInvocationMessage(e))return!0;const t=this._nextReceivingSequenceId;return this._nextReceivingSequenceId++,t<=this._latestReceivedSequenceId?(t===this._latestReceivedSequenceId&&this._ackTimer(),!1):(this._latestReceivedSequenceId=t,this._ackTimer(),!0)}_resetSequence(e){if(e.sequenceId>this._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=e.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){const e=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:A.Sequence,sequenceId:e}));const t=this._messages;for(const n of t)await this._connection.send(n._message);this._reconnectInProgress=!1}_dispose(e){e??(e=new Error("Unable to reconnect to server."));for(const t of this._messages)t._rejector(e)}_isInvocationMessage(e){switch(e.type){case A.Invocation:case A.StreamItem:case A.Completion:case A.StreamInvocation:case A.CancelInvocation:return!0;case A.Close:case A.Sequence:case A.Ping:case A.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:A.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0},1e3))}}class Qr{constructor(e,t,n,s){this._message=e,this._id=t,this._resolver=n,this._rejector=s}}const Jr=30*1e3,Xr=15*1e3,Gr=1e5;var W;(function(r){r.Disconnected="Disconnected",r.Connecting="Connecting",r.Connected="Connected",r.Disconnecting="Disconnecting",r.Reconnecting="Reconnecting"})(W||(W={}));class Xe{static create(e,t,n,s,o,i,a){return new Xe(e,t,n,s,o,i,a)}constructor(e,t,n,s,o,i,a){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(d.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},F.isRequired(e,"connection"),F.isRequired(t,"logger"),F.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=o??Jr,this.keepAliveIntervalInMilliseconds=i??Xr,this._statefulReconnectBufferSize=a??Gr,this._logger=t,this._protocol=n,this.connection=e,this._reconnectPolicy=s,this._handshakeProtocol=new qr,this.connection.onreceive=c=>this._processIncomingData(c),this.connection.onclose=c=>this._connectionClosed(c),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=W.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:A.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(e){if(this._connectionState!==W.Disconnected&&this._connectionState!==W.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!e)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=e}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}async _startWithStateTransitions(){if(this._connectionState!==W.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=W.Connecting,this._logger.log(d.Debug,"Starting HubConnection.");try{await this._startInternal(),U.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=W.Connected,this._connectionStarted=!0,this._logger.log(d.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=W.Disconnected,this._logger.log(d.Debug,`HubConnection failed to start successfully because of error '${e}'.`),Promise.reject(e)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;const e=new Promise((t,n)=>{this._handshakeResolver=t,this._handshakeRejecter=n});await this.connection.start(this._protocol.transferFormat);try{let t=this._protocol.version;this.connection.features.reconnect||(t=1);const n={protocol:this._protocol.name,version:t};if(this._logger.log(d.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(n)),this._logger.log(d.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await e,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new Yr(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(t){throw this._logger.log(d.Debug,`Hub handshake failed with error '${t}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(t),t}}async stop(){const e=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await e}catch{}}_stopInternal(e){if(this._connectionState===W.Disconnected)return this._logger.log(d.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===W.Disconnecting)return this._logger.log(d.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;const t=this._connectionState;return this._connectionState=W.Disconnecting,this._logger.log(d.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(d.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(t===W.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new ie("The connection was stopped before the hub handshake could complete."),this.connection.stop(e))}async _sendCloseMessage(){try{await this._sendWithProtocol(this._createCloseMessage())}catch{}}stream(e,...t){const[n,s]=this._replaceStreamingParams(t),o=this._createStreamInvocation(e,t,s);let i;const a=new Vr;return a.cancelCallback=()=>{const c=this._createCancelInvocation(o.invocationId);return delete this._callbacks[o.invocationId],i.then(()=>this._sendWithProtocol(c))},this._callbacks[o.invocationId]=(c,l)=>{if(l){a.error(l);return}else c&&(c.type===A.Completion?c.error?a.error(new Error(c.error)):a.complete():a.next(c.item))},i=this._sendWithProtocol(o).catch(c=>{a.error(c),delete this._callbacks[o.invocationId]}),this._launchStreams(n,i),a}_sendMessage(e){return this._resetKeepAliveInterval(),this.connection.send(e)}_sendWithProtocol(e){return this._messageBuffer?this._messageBuffer._send(e):this._sendMessage(this._protocol.writeMessage(e))}send(e,...t){const[n,s]=this._replaceStreamingParams(t),o=this._sendWithProtocol(this._createInvocation(e,t,!0,s));return this._launchStreams(n,o),o}invoke(e,...t){const[n,s]=this._replaceStreamingParams(t),o=this._createInvocation(e,t,!1,s);return new Promise((a,c)=>{this._callbacks[o.invocationId]=(h,f)=>{if(f){c(f);return}else h&&(h.type===A.Completion?h.error?c(new Error(h.error)):a(h.result):c(new Error(`Unexpected message type: ${h.type}`)))};const l=this._sendWithProtocol(o).catch(h=>{c(h),delete this._callbacks[o.invocationId]});this._launchStreams(n,l)})}on(e,t){!e||!t||(e=e.toLowerCase(),this._methods[e]||(this._methods[e]=[]),this._methods[e].indexOf(t)===-1&&this._methods[e].push(t))}off(e,t){if(!e)return;e=e.toLowerCase();const n=this._methods[e];if(n)if(t){const s=n.indexOf(t);s!==-1&&(n.splice(s,1),n.length===0&&delete this._methods[e])}else delete this._methods[e]}onclose(e){e&&this._closedCallbacks.push(e)}onreconnecting(e){e&&this._reconnectingCallbacks.push(e)}onreconnected(e){e&&this._reconnectedCallbacks.push(e)}_processIncomingData(e){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(e=this._processHandshakeResponse(e),this._receivedHandshakeResponse=!0),e){const t=this._protocol.parseMessages(e,this._logger);for(const n of t)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(n)))switch(n.type){case A.Invocation:this._invokeClientMethod(n).catch(s=>{this._logger.log(d.Error,`Invoke client method threw error: ${Ye(s)}`)});break;case A.StreamItem:case A.Completion:{const s=this._callbacks[n.invocationId];if(s){n.type===A.Completion&&delete this._callbacks[n.invocationId];try{s(n)}catch(o){this._logger.log(d.Error,`Stream callback threw error: ${Ye(o)}`)}}break}case A.Ping:break;case A.Close:{this._logger.log(d.Information,"Close message received from server.");const s=n.error?new Error("Server returned an error on close: "+n.error):void 0;n.allowReconnect===!0?this.connection.stop(s):this._stopPromise=this._stopInternal(s);break}case A.Ack:this._messageBuffer&&this._messageBuffer._ack(n);break;case A.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(n);break;default:this._logger.log(d.Warning,`Invalid message type: ${n.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(e){let t,n;try{[n,t]=this._handshakeProtocol.parseHandshakeResponse(e)}catch(s){const o="Error parsing handshake response: "+s;this._logger.log(d.Error,o);const i=new Error(o);throw this._handshakeRejecter(i),i}if(t.error){const s="Server returned handshake error: "+t.error;this._logger.log(d.Error,s);const o=new Error(s);throw this._handshakeRejecter(o),o}else this._logger.log(d.Debug,"Server handshake complete.");return this._handshakeResolver(),n}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if(!this.connection.features||!this.connection.features.inherentKeepAlive){this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds);let e=this._nextKeepAlive-new Date().getTime();if(e<0){this._connectionState===W.Connected&&this._trySendPingMessage();return}this._pingServerHandle===void 0&&(e<0&&(e=0),this._pingServerHandle=setTimeout(async()=>{this._connectionState===W.Connected&&await this._trySendPingMessage()},e))}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(e){const t=e.target.toLowerCase(),n=this._methods[t];if(!n){this._logger.log(d.Warning,`No client method with the name '${t}' found.`),e.invocationId&&(this._logger.log(d.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)));return}const s=n.slice(),o=!!e.invocationId;let i,a,c;for(const l of s)try{const h=i;i=await l.apply(this,e.arguments),o&&i&&h&&(this._logger.log(d.Error,`Multiple results provided for '${t}'. Sending error to server.`),c=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),a=void 0}catch(h){a=h,this._logger.log(d.Error,`A callback for the method '${t}' threw error '${h}'.`)}c?await this._sendWithProtocol(c):o?(a?c=this._createCompletionMessage(e.invocationId,`${a}`,null):i!==void 0?c=this._createCompletionMessage(e.invocationId,null,i):(this._logger.log(d.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),c=this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(c)):i&&this._logger.log(d.Error,`Result given for '${t}' method but server is not expecting a result.`)}_connectionClosed(e){this._logger.log(d.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new ie("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(e||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===W.Disconnecting?this._completeClose(e):this._connectionState===W.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===W.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=W.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(e??new Error("Connection closed.")),this._messageBuffer=void 0),U.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(t=>t.apply(this,[e]))}catch(t){this._logger.log(d.Error,`An onclose callback called with error '${e}' threw error '${t}'.`)}}}async _reconnect(e){const t=Date.now();let n=0,s=e!==void 0?e:new Error("Attempting to reconnect due to a unknown error."),o=this._getNextRetryDelay(n,0,s);if(o===null){this._logger.log(d.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(e);return}if(this._connectionState=W.Reconnecting,e?this._logger.log(d.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(d.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(i=>i.apply(this,[e]))}catch(i){this._logger.log(d.Error,`An onreconnecting callback called with error '${e}' threw error '${i}'.`)}if(this._connectionState!==W.Reconnecting){this._logger.log(d.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;o!==null;){if(this._logger.log(d.Information,`Reconnect attempt number ${n+1} will start in ${o} ms.`),await new Promise(i=>{this._reconnectDelayHandle=setTimeout(i,o)}),this._reconnectDelayHandle=void 0,this._connectionState!==W.Reconnecting){this._logger.log(d.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(await this._startInternal(),this._connectionState=W.Connected,this._logger.log(d.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(i=>i.apply(this,[this.connection.connectionId]))}catch(i){this._logger.log(d.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${i}'.`)}return}catch(i){if(this._logger.log(d.Information,`Reconnect attempt failed because of error '${i}'.`),this._connectionState!==W.Reconnecting){this._logger.log(d.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===W.Disconnecting&&this._completeClose();return}n++,s=i instanceof Error?i:new Error(i.toString()),o=this._getNextRetryDelay(n,Date.now()-t,s)}}this._logger.log(d.Information,`Reconnect retries have been exhausted after ${Date.now()-t} ms and ${n} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(e,t,n){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:t,previousRetryCount:e,retryReason:n})}catch(s){return this._logger.log(d.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${e}, ${t}) threw error '${s}'.`),null}}_cancelCallbacksWithError(e){const t=this._callbacks;this._callbacks={},Object.keys(t).forEach(n=>{const s=t[n];try{s(null,e)}catch(o){this._logger.log(d.Error,`Stream 'error' callback called with '${e}' threw error: ${Ye(o)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(e,t,n,s){if(n)return s.length!==0?{target:e,arguments:t,streamIds:s,type:A.Invocation}:{target:e,arguments:t,type:A.Invocation};{const o=this._invocationId;return this._invocationId++,s.length!==0?{target:e,arguments:t,invocationId:o.toString(),streamIds:s,type:A.Invocation}:{target:e,arguments:t,invocationId:o.toString(),type:A.Invocation}}}_launchStreams(e,t){if(e.length!==0){t||(t=Promise.resolve());for(const n in e)e[n].subscribe({complete:()=>{t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(n)))},error:s=>{let o;s instanceof Error?o=s.message:s&&s.toString?o=s.toString():o="Unknown error",t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(n,o)))},next:s=>{t=t.then(()=>this._sendWithProtocol(this._createStreamItemMessage(n,s)))}})}}_replaceStreamingParams(e){const t=[],n=[];for(let s=0;s<e.length;s++){const o=e[s];if(this._isObservable(o)){const i=this._invocationId;this._invocationId++,t[i]=o,n.push(i.toString()),e.splice(s,1)}}return[t,n]}_isObservable(e){return e&&e.subscribe&&typeof e.subscribe=="function"}_createStreamInvocation(e,t,n){const s=this._invocationId;return this._invocationId++,n.length!==0?{target:e,arguments:t,invocationId:s.toString(),streamIds:n,type:A.StreamInvocation}:{target:e,arguments:t,invocationId:s.toString(),type:A.StreamInvocation}}_createCancelInvocation(e){return{invocationId:e,type:A.CancelInvocation}}_createStreamItemMessage(e,t){return{invocationId:e,item:t,type:A.StreamItem}}_createCompletionMessage(e,t,n){return t?{error:t,invocationId:e,type:A.Completion}:{invocationId:e,result:n,type:A.Completion}}_createCloseMessage(){return{type:A.Close}}async _trySendPingMessage(){try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}}}const Kr=[0,2e3,1e4,3e4,null];class Rt{constructor(e){this._retryDelays=e!==void 0?[...e,null]:Kr}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}}class he{}he.Authorization="Authorization";he.Cookie="Cookie";class Zr extends Ae{constructor(e,t){super(),this._innerClient=e,this._accessTokenFactory=t}async send(e){let t=!0;this._accessTokenFactory&&(!this._accessToken||e.url&&e.url.indexOf("/negotiate?")>0)&&(t=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(e);const n=await this._innerClient.send(e);return t&&n.statusCode===401&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(e),await this._innerClient.send(e)):n}_setAuthorizationHeader(e){e.headers||(e.headers={}),this._accessToken?e.headers[he.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[he.Authorization]&&delete e.headers[he.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}}var q;(function(r){r[r.None=0]="None",r[r.WebSockets=1]="WebSockets",r[r.ServerSentEvents=2]="ServerSentEvents",r[r.LongPolling=4]="LongPolling"})(q||(q={}));var X;(function(r){r[r.Text=1]="Text",r[r.Binary=2]="Binary"})(X||(X={}));let en=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};class It{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,n){this._httpClient=e,this._logger=t,this._pollAbort=new en,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}async connect(e,t){if(F.isRequired(e,"url"),F.isRequired(t,"transferFormat"),F.isIn(t,X,"transferFormat"),this._url=e,this._logger.log(d.Trace,"(LongPolling transport) Connecting."),t===X.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[n,s]=ge(),o={[n]:s,...this._options.headers},i={abortSignal:this._pollAbort.signal,headers:o,timeout:1e5,withCredentials:this._options.withCredentials};t===X.Binary&&(i.responseType="arraybuffer");const a=`${e}&_=${Date.now()}`;this._logger.log(d.Trace,`(LongPolling transport) polling: ${a}.`);const c=await this._httpClient.get(a,i);c.statusCode!==200?(this._logger.log(d.Error,`(LongPolling transport) Unexpected response code: ${c.statusCode}.`),this._closeError=new ue(c.statusText||"",c.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,i)}async _poll(e,t){try{for(;this._running;)try{const n=`${e}&_=${Date.now()}`;this._logger.log(d.Trace,`(LongPolling transport) polling: ${n}.`);const s=await this._httpClient.get(n,t);s.statusCode===204?(this._logger.log(d.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):s.statusCode!==200?(this._logger.log(d.Error,`(LongPolling transport) Unexpected response code: ${s.statusCode}.`),this._closeError=new ue(s.statusText||"",s.statusCode),this._running=!1):s.content?(this._logger.log(d.Trace,`(LongPolling transport) data received. ${ye(s.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(s.content)):this._logger.log(d.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(n){this._running?n instanceof Je?this._logger.log(d.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=n,this._running=!1):this._logger.log(d.Trace,`(LongPolling transport) Poll errored after shutdown: ${n.message}`)}}finally{this._logger.log(d.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(e){return this._running?Vt(this._logger,"LongPolling",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(d.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(d.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[t,n]=ge();e[t]=n;const s={headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};let o;try{await this._httpClient.delete(this._url,s)}catch(i){o=i}o?o instanceof ue&&(o.statusCode===404?this._logger.log(d.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(d.Trace,`(LongPolling transport) Error sending a DELETE request: ${o}`)):this._logger.log(d.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(d.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let e="(LongPolling transport) Firing onclose event.";this._closeError&&(e+=" Error: "+this._closeError),this._logger.log(d.Trace,e),this.onclose(this._closeError)}}}class tn{constructor(e,t,n,s){this._httpClient=e,this._accessToken=t,this._logger=n,this._options=s,this.onreceive=null,this.onclose=null}async connect(e,t){return F.isRequired(e,"url"),F.isRequired(t,"transferFormat"),F.isIn(t,X,"transferFormat"),this._logger.log(d.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((n,s)=>{let o=!1;if(t!==X.Text){s(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let i;if(U.isBrowser||U.isWebWorker)i=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{const a=this._httpClient.getCookieString(e),c={};c.Cookie=a;const[l,h]=ge();c[l]=h,i=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:{...c,...this._options.headers}})}try{i.onmessage=a=>{if(this.onreceive)try{this._logger.log(d.Trace,`(SSE transport) data received. ${ye(a.data,this._options.logMessageContent)}.`),this.onreceive(a.data)}catch(c){this._close(c);return}},i.onerror=a=>{o?this._close():s(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},i.onopen=()=>{this._logger.log(d.Information,`SSE connected to ${this._url}`),this._eventSource=i,o=!0,n()}}catch(a){s(a);return}})}async send(e){return this._eventSource?Vt(this._logger,"SSE",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(e){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(e))}}class rn{constructor(e,t,n,s,o,i){this._logger=n,this._accessTokenFactory=t,this._logMessageContent=s,this._webSocketConstructor=o,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=i}async connect(e,t){F.isRequired(e,"url"),F.isRequired(t,"transferFormat"),F.isIn(t,X,"transferFormat"),this._logger.log(d.Trace,"(WebSockets transport) Connecting.");let n;return this._accessTokenFactory&&(n=await this._accessTokenFactory()),new Promise((s,o)=>{e=e.replace(/^http/,"ws");let i;const a=this._httpClient.getCookieString(e);let c=!1;if(U.isNode||U.isReactNative){const l={},[h,f]=ge();l[h]=f,n&&(l[he.Authorization]=`Bearer ${n}`),a&&(l[he.Cookie]=a),i=new this._webSocketConstructor(e,void 0,{headers:{...l,...this._headers}})}else n&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(n)}`);i||(i=new this._webSocketConstructor(e)),t===X.Binary&&(i.binaryType="arraybuffer"),i.onopen=l=>{this._logger.log(d.Information,`WebSocket connected to ${e}.`),this._webSocket=i,c=!0,s()},i.onerror=l=>{let h=null;typeof ErrorEvent<"u"&&l instanceof ErrorEvent?h=l.error:h="There was an error with the transport",this._logger.log(d.Information,`(WebSockets transport) ${h}.`)},i.onmessage=l=>{if(this._logger.log(d.Trace,`(WebSockets transport) data received. ${ye(l.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(l.data)}catch(h){this._close(h);return}},i.onclose=l=>{if(c)this._close(l);else{let h=null;typeof ErrorEvent<"u"&&l instanceof ErrorEvent?h=l.error:h="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",o(new Error(h))}}})}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(d.Trace,`(WebSockets transport) sending data. ${ye(e,this._logMessageContent)}.`),this._webSocket.send(e),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(e){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(d.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(e)&&(e.wasClean===!1||e.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${e.code} (${e.reason||"no reason given"}).`)):e instanceof Error?this.onclose(e):this.onclose())}_isCloseEvent(e){return e&&typeof e.wasClean=="boolean"&&typeof e.code=="number"}}const At=100;class nn{constructor(e,t={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,F.isRequired(e,"url"),this._logger=Mr(t.logger),this.baseUrl=this._resolveUrl(e),t=t||{},t.logMessageContent=t.logMessageContent===void 0?!1:t.logMessageContent,typeof t.withCredentials=="boolean"||t.withCredentials===void 0)t.withCredentials=t.withCredentials===void 0?!0:t.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");t.timeout=t.timeout===void 0?100*1e3:t.timeout;let n=null,s=null;if(U.isNode&&typeof require<"u"){const o=typeof __webpack_require__=="function"?__non_webpack_require__:require;n=o("ws"),s=o("eventsource")}!U.isNode&&typeof WebSocket<"u"&&!t.WebSocket?t.WebSocket=WebSocket:U.isNode&&!t.WebSocket&&n&&(t.WebSocket=n),!U.isNode&&typeof EventSource<"u"&&!t.EventSource?t.EventSource=EventSource:U.isNode&&!t.EventSource&&typeof s<"u"&&(t.EventSource=s),this._httpClient=new Zr(t.httpClient||new Fr(this._logger),t.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=t,this.onreceive=null,this.onclose=null}async start(e){if(e=e||X.Binary,F.isIn(e,X,"transferFormat"),this._logger.log(d.Debug,`Starting connection with transfer format '${X[e]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(e),await this._startInternalPromise,this._connectionState==="Disconnecting"){const t="Failed to start the HttpConnection before stop() was called.";return this._logger.log(d.Error,t),await this._stopPromise,Promise.reject(new ie(t))}else if(this._connectionState!=="Connected"){const t="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(d.Error,t),Promise.reject(new ie(t))}this._connectionStarted=!0}send(e){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new Ge(this.transport)),this._sendQueue.send(e))}async stop(e){if(this._connectionState==="Disconnected")return this._logger.log(d.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(d.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(t=>{this._stopPromiseResolver=t}),await this._stopInternal(e),await this._stopPromise}async _stopInternal(e){this._stopError=e;try{await this._startInternalPromise}catch{}if(this.transport){try{await this.transport.stop()}catch(t){this._logger.log(d.Error,`HttpConnection.transport.stop() threw error '${t}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(d.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(e){let t=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===q.WebSockets)this.transport=this._constructTransport(q.WebSockets),await this._startTransport(t,e);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let n=null,s=0;do{if(n=await this._getNegotiationResponse(t),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new ie("The connection was stopped during negotiation.");if(n.error)throw new Error(n.error);if(n.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(n.url&&(t=n.url),n.accessToken){const o=n.accessToken;this._accessTokenFactory=()=>o,this._httpClient._accessToken=o,this._httpClient._accessTokenFactory=void 0}s++}while(n.url&&s<At);if(s===At&&n.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(t,this._options.transport,n,e)}this.transport instanceof It&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(d.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(n){return this._logger.log(d.Error,"Failed to start the connection: "+n),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(n)}}async _getNegotiationResponse(e){const t={},[n,s]=ge();t[n]=s;const o=this._resolveNegotiateUrl(e);this._logger.log(d.Debug,`Sending negotiation request: ${o}.`);try{const i=await this._httpClient.post(o,{content:"",headers:{...t,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(i.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${i.statusCode}'`));const a=JSON.parse(i.content);return(!a.negotiateVersion||a.negotiateVersion<1)&&(a.connectionToken=a.connectionId),a.useStatefulReconnect&&this._options._useStatefulReconnect!==!0?Promise.reject(new kt("Client didn't negotiate Stateful Reconnect but the server did.")):a}catch(i){let a="Failed to complete negotiation with the server: "+i;return i instanceof ue&&i.statusCode===404&&(a=a+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(d.Error,a),Promise.reject(new kt(a))}}_createConnectUrl(e,t){return t?e+(e.indexOf("?")===-1?"?":"&")+`id=${t}`:e}async _createTransport(e,t,n,s){let o=this._createConnectUrl(e,n.connectionToken);if(this._isITransport(t)){this._logger.log(d.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=t,await this._startTransport(o,s),this.connectionId=n.connectionId;return}const i=[],a=n.availableTransports||[];let c=n;for(const l of a){const h=this._resolveTransportOrError(l,t,s,c?.useStatefulReconnect===!0);if(h instanceof Error)i.push(`${l.transport} failed:`),i.push(h);else if(this._isITransport(h)){if(this.transport=h,!c){try{c=await this._getNegotiationResponse(e)}catch(f){return Promise.reject(f)}o=this._createConnectUrl(e,c.connectionToken)}try{await this._startTransport(o,s),this.connectionId=c.connectionId;return}catch(f){if(this._logger.log(d.Error,`Failed to start the transport '${l.transport}': ${f}`),c=void 0,i.push(new Ar(`${l.transport} failed: ${f}`,q[l.transport])),this._connectionState!=="Connecting"){const g="Failed to select transport before stop() was called.";return this._logger.log(d.Debug,g),Promise.reject(new ie(g))}}}}return i.length>0?Promise.reject(new jr(`Unable to connect to the server with any of the available transports. ${i.join(" ")}`,i)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(e){switch(e){case q.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new rn(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case q.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new tn(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case q.LongPolling:return new It(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async n=>{let s=!1;if(this.features.reconnect)try{this.features.disconnected(),await this.transport.connect(e,t),await this.features.resend()}catch{s=!0}else{this._stopConnection(n);return}s&&this._stopConnection(n)}:this.transport.onclose=n=>this._stopConnection(n),this.transport.connect(e,t)}_resolveTransportOrError(e,t,n,s){const o=q[e.transport];if(o==null)return this._logger.log(d.Debug,`Skipping transport '${e.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${e.transport}' because it is not supported by this client.`);if(on(t,o))if(e.transferFormats.map(a=>X[a]).indexOf(n)>=0){if(o===q.WebSockets&&!this._options.WebSocket||o===q.ServerSentEvents&&!this._options.EventSource)return this._logger.log(d.Debug,`Skipping transport '${q[o]}' because it is not supported in your environment.'`),new Rr(`'${q[o]}' is not supported in your environment.`,o);this._logger.log(d.Debug,`Selecting transport '${q[o]}'.`);try{return this.features.reconnect=o===q.WebSockets?s:void 0,this._constructTransport(o)}catch(a){return a}}else return this._logger.log(d.Debug,`Skipping transport '${q[o]}' because it does not support the requested transfer format '${X[n]}'.`),new Error(`'${q[o]}' does not support ${X[n]}.`);else return this._logger.log(d.Debug,`Skipping transport '${q[o]}' because it was disabled by the client.`),new Ir(`'${q[o]}' is disabled by the client.`,o)}_isITransport(e){return e&&typeof e=="object"&&"connect"in e}_stopConnection(e){if(this._logger.log(d.Debug,`HttpConnection.stopConnection(${e}) called while in state ${this._connectionState}.`),this.transport=void 0,e=this._stopError||e,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(d.Debug,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(d.Warning,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${e}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),e?this._logger.log(d.Error,`Connection disconnected with error '${e}'.`):this._logger.log(d.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(t=>{this._logger.log(d.Error,`TransportSendQueue.stop() threw error '${t}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(e)}catch(t){this._logger.log(d.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}_resolveUrl(e){if(e.lastIndexOf("https://",0)===0||e.lastIndexOf("http://",0)===0)return e;if(!U.isBrowser)throw new Error(`Cannot resolve '${e}'.`);const t=window.document.createElement("a");return t.href=e,this._logger.log(d.Information,`Normalizing '${e}' to '${t.href}'.`),t.href}_resolveNegotiateUrl(e){const t=new URL(e);t.pathname.endsWith("/")?t.pathname+="negotiate":t.pathname+="/negotiate";const n=new URLSearchParams(t.searchParams);return n.has("negotiateVersion")||n.append("negotiateVersion",this._negotiateVersion.toString()),n.has("useStatefulReconnect")?n.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&n.append("useStatefulReconnect","true"),t.search=n.toString(),t.toString()}}function on(r,e){return!r||(e&r)!==0}class Ge{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new xe,this._transportResult=new xe,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new xe),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(e){if(this._buffer.length&&typeof this._buffer[0]!=typeof e)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof e}`);this._buffer.push(e),this._sendBufferedData.resolve()}async _sendLoop(){for(;;){if(await this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new xe;const e=this._transportResult;this._transportResult=void 0;const t=typeof this._buffer[0]=="string"?this._buffer.join(""):Ge._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(t),e.resolve()}catch(n){e.reject(n)}}}static _concatBuffers(e){const t=e.map(o=>o.byteLength).reduce((o,i)=>o+i),n=new Uint8Array(t);let s=0;for(const o of e)n.set(new Uint8Array(o),s),s+=o.byteLength;return n.buffer}}class xe{constructor(){this.promise=new Promise((e,t)=>[this._resolver,this._rejecter]=[e,t])}resolve(){this._resolver()}reject(e){this._rejecter(e)}}const sn="json";class an{constructor(){this.name=sn,this.version=2,this.transferFormat=X.Text}parseMessages(e,t){if(typeof e!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!e)return[];t===null&&(t=ve.instance);const n=re.parse(e),s=[];for(const o of n){const i=JSON.parse(o);if(typeof i.type!="number")throw new Error("Invalid payload.");switch(i.type){case A.Invocation:this._isInvocationMessage(i);break;case A.StreamItem:this._isStreamItemMessage(i);break;case A.Completion:this._isCompletionMessage(i);break;case A.Ping:break;case A.Close:break;case A.Ack:this._isAckMessage(i);break;case A.Sequence:this._isSequenceMessage(i);break;default:t.log(d.Information,"Unknown message type '"+i.type+"' ignored.");continue}s.push(i)}return s}writeMessage(e){return re.write(JSON.stringify(e))}_isInvocationMessage(e){this._assertNotEmptyString(e.target,"Invalid payload for Invocation message."),e.invocationId!==void 0&&this._assertNotEmptyString(e.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(e){if(this._assertNotEmptyString(e.invocationId,"Invalid payload for StreamItem message."),e.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(e){if(e.result&&e.error)throw new Error("Invalid payload for Completion message.");!e.result&&e.error&&this._assertNotEmptyString(e.error,"Invalid payload for Completion message."),this._assertNotEmptyString(e.invocationId,"Invalid payload for Completion message.")}_isAckMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(e,t){if(typeof e!="string"||e==="")throw new Error(t)}}const cn={trace:d.Trace,debug:d.Debug,info:d.Information,information:d.Information,warn:d.Warning,warning:d.Warning,error:d.Error,critical:d.Critical,none:d.None};function ln(r){const e=cn[r.toLowerCase()];if(typeof e<"u")return e;throw new Error(`Unknown log level: ${r}`)}class un{configureLogging(e){if(F.isRequired(e,"logging"),hn(e))this.logger=e;else if(typeof e=="string"){const t=ln(e);this.logger=new Re(t)}else this.logger=new Re(e);return this}withUrl(e,t){return F.isRequired(e,"url"),F.isNotEmpty(e,"url"),this.url=e,typeof t=="object"?this.httpConnectionOptions={...this.httpConnectionOptions,...t}:this.httpConnectionOptions={...this.httpConnectionOptions,transport:t},this}withHubProtocol(e){return F.isRequired(e,"protocol"),this.protocol=e,this}withAutomaticReconnect(e){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return e?Array.isArray(e)?this.reconnectPolicy=new Rt(e):this.reconnectPolicy=e:this.reconnectPolicy=new Rt,this}withServerTimeout(e){return F.isRequired(e,"milliseconds"),this._serverTimeoutInMilliseconds=e,this}withKeepAliveInterval(e){return F.isRequired(e,"milliseconds"),this._keepAliveIntervalInMilliseconds=e,this}withStatefulReconnect(e){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=e?.bufferSize,this}build(){const e=this.httpConnectionOptions||{};if(e.logger===void 0&&(e.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const t=new nn(this.url,e);return Xe.create(t,this.logger||ve.instance,this.protocol||new an,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}}function hn(r){return r.log!==void 0}/**
|
|
42
42
|
* @license lucide-react v0.562.0 - ISC
|
|
43
43
|
*
|
|
44
44
|
* This source code is licensed under the ISC license.
|
|
45
45
|
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
-
*/const
|
|
46
|
+
*/const fn=r=>r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),dn=r=>r.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),jt=r=>{const e=dn(r);return e.charAt(0).toUpperCase()+e.slice(1)},Yt=(...r)=>r.filter((e,t,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===t).join(" ").trim(),gn=r=>{for(const e in r)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/**
|
|
47
47
|
* @license lucide-react v0.562.0 - ISC
|
|
48
48
|
*
|
|
49
49
|
* This source code is licensed under the ISC license.
|
|
50
50
|
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
-
*/var
|
|
51
|
+
*/var pn={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"};/**
|
|
52
52
|
* @license lucide-react v0.562.0 - ISC
|
|
53
53
|
*
|
|
54
54
|
* This source code is licensed under the ISC license.
|
|
55
55
|
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
-
*/const
|
|
56
|
+
*/const _n=O.forwardRef(({color:r="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:n,className:s="",children:o,iconNode:i,...a},c)=>O.createElement("svg",{ref:c,...pn,width:e,height:e,stroke:r,strokeWidth:n?Number(t)*24/Number(e):t,className:Yt("lucide",s),...!o&&!gn(a)&&{"aria-hidden":"true"},...a},[...i.map(([l,h])=>O.createElement(l,h)),...Array.isArray(o)?o:[o]]));/**
|
|
57
57
|
* @license lucide-react v0.562.0 - ISC
|
|
58
58
|
*
|
|
59
59
|
* This source code is licensed under the ISC license.
|
|
60
60
|
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
-
*/const
|
|
61
|
+
*/const se=(r,e)=>{const t=O.forwardRef(({className:n,...s},o)=>O.createElement(_n,{ref:o,iconNode:e,className:Yt(`lucide-${fn(jt(r))}`,`lucide-${r}`,n),...s}));return t.displayName=jt(r),t};/**
|
|
62
62
|
* @license lucide-react v0.562.0 - ISC
|
|
63
63
|
*
|
|
64
64
|
* This source code is licensed under the ISC license.
|
|
65
65
|
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
-
*/const
|
|
66
|
+
*/const mn=[["path",{d:"M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5",key:"4pqfef"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 12v-1",key:"1ej8lb"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["path",{d:"M8 7V6",key:"1nbb54"}],["circle",{cx:"8",cy:"20",r:"2",key:"ckkr5m"}]],vn=se("file-archive",mn);/**
|
|
67
67
|
* @license lucide-react v0.562.0 - ISC
|
|
68
68
|
*
|
|
69
69
|
* This source code is licensed under the ISC license.
|
|
70
70
|
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
-
*/const
|
|
71
|
+
*/const yn=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],wn=se("file-braces",yn);/**
|
|
72
72
|
* @license lucide-react v0.562.0 - ISC
|
|
73
73
|
*
|
|
74
74
|
* This source code is licensed under the ISC license.
|
|
75
75
|
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
-
*/const bn=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],
|
|
76
|
+
*/const bn=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],Te=se("file-code",bn);/**
|
|
77
77
|
* @license lucide-react v0.562.0 - ISC
|
|
78
78
|
*
|
|
79
79
|
* This source code is licensed under the ISC license.
|
|
80
80
|
* See the LICENSE file in the root directory of this source tree.
|
|
81
|
-
*/const
|
|
81
|
+
*/const Sn=[["path",{d:"M4 12V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2",key:"jrl274"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 16h2v6",key:"1bxocy"}],["path",{d:"M10 22h4",key:"ceow96"}],["rect",{x:"2",y:"16",width:"4",height:"6",rx:"2",key:"r45zd0"}]],En=se("file-digit",Sn);/**
|
|
82
82
|
* @license lucide-react v0.562.0 - ISC
|
|
83
83
|
*
|
|
84
84
|
* This source code is licensed under the ISC license.
|
|
85
85
|
* See the LICENSE file in the root directory of this source tree.
|
|
86
|
-
*/const
|
|
86
|
+
*/const Cn=[["path",{d:"M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343",key:"1vfytu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0",key:"1etmh7"}]],xn=se("file-headphone",Cn);/**
|
|
87
87
|
* @license lucide-react v0.562.0 - ISC
|
|
88
88
|
*
|
|
89
89
|
* This source code is licensed under the ISC license.
|
|
90
90
|
* See the LICENSE file in the root directory of this source tree.
|
|
91
|
-
*/const
|
|
91
|
+
*/const Tn=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]],kn=se("file-image",Tn);/**
|
|
92
92
|
* @license lucide-react v0.562.0 - ISC
|
|
93
93
|
*
|
|
94
94
|
* This source code is licensed under the ISC license.
|
|
95
95
|
* See the LICENSE file in the root directory of this source tree.
|
|
96
|
-
*/const
|
|
96
|
+
*/const Pn=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z",key:"1tzo1f"}]],Rn=se("file-play",Pn);/**
|
|
97
97
|
* @license lucide-react v0.562.0 - ISC
|
|
98
98
|
*
|
|
99
99
|
* This source code is licensed under the ISC license.
|
|
100
100
|
* See the LICENSE file in the root directory of this source tree.
|
|
101
|
-
*/const
|
|
101
|
+
*/const In=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]],Ot=se("file-spreadsheet",In);/**
|
|
102
102
|
* @license lucide-react v0.562.0 - ISC
|
|
103
103
|
*
|
|
104
104
|
* This source code is licensed under the ISC license.
|
|
105
105
|
* See the LICENSE file in the root directory of this source tree.
|
|
106
|
-
*/const
|
|
106
|
+
*/const An=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Dt=se("file-text",An);/**
|
|
107
107
|
* @license lucide-react v0.562.0 - ISC
|
|
108
108
|
*
|
|
109
109
|
* This source code is licensed under the ISC license.
|
|
110
110
|
* See the LICENSE file in the root directory of this source tree.
|
|
111
|
-
*/const
|
|
111
|
+
*/const jn=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M11 18h2",key:"12mj7e"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5",key:"qbrxap"}]],On=se("file-type",jn);/**
|
|
112
112
|
* @license lucide-react v0.562.0 - ISC
|
|
113
113
|
*
|
|
114
114
|
* This source code is licensed under the ISC license.
|
|
115
115
|
* See the LICENSE file in the root directory of this source tree.
|
|
116
|
-
*/const
|
|
116
|
+
*/const Dn=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],Mt=se("file",Dn);/**
|
|
117
117
|
* @license lucide-react v0.562.0 - ISC
|
|
118
118
|
*
|
|
119
119
|
* This source code is licensed under the ISC license.
|
|
120
120
|
* See the LICENSE file in the root directory of this source tree.
|
|
121
|
-
*/const Dn=[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]],Mn=oe("presentation",Dn);function Nn(r){return Re({attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{id:"Square_Remove"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{d:"M18.437,20.937H5.563a2.5,2.5,0,0,1-2.5-2.5V5.563a2.5,2.5,0,0,1,2.5-2.5H18.437a2.5,2.5,0,0,1,2.5,2.5V18.437A2.5,2.5,0,0,1,18.437,20.937ZM5.563,4.063a1.5,1.5,0,0,0-1.5,1.5V18.437a1.5,1.5,0,0,0,1.5,1.5H18.437a1.5,1.5,0,0,0,1.5-1.5V5.563a1.5,1.5,0,0,0-1.5-1.5Z"},child:[]},{tag:"path",attr:{d:"M13.767,14.477a.5.5,0,0,0,.71-.71L12.707,12l1.77-1.77a.5.5,0,0,0-.71-.7L12,11.3l-1.77-1.77a.5.5,0,0,0-.7.7c.59.59,1.17,1.18,1.77,1.77l-1.77,1.77c-.46.45.25,1.16.7.71L12,12.707Z"},child:[]}]}]}]})(r)}const $n=({progress:r=0})=>m.jsxs("div",{className:"mt-3 w-full",children:[m.jsxs("div",{className:"mb-2 flex justify-between",children:[m.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-500",children:"Uploading..."}),m.jsxs("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-500",children:[Math.round(r||0),"%"]})]}),m.jsx("div",{className:"h-2.5 w-full rounded-full bg-gray-200 dark:bg-gray-200",children:m.jsx("div",{className:"h-2.5 rounded-full bg-emerald-500 shadow-[0_0_8px_rgba(16,185,129,0.4)] transition-all duration-300 ease-out",style:{width:`${r||0}%`}})})]}),Ln=({file:r,size:e="md",className:t="",showExtension:n=!0,showRemoveButton:s=!1,removeFileMethod:o=()=>{}})=>{const i=y=>{const _=y.split(".");return _.length>1?_.pop().toLowerCase():""},a=y=>{const _={className:"text-gray-600"};switch(y){case"pdf":return m.jsx(Mt,{..._,className:"text-red-500"});case"doc":case"docx":return m.jsx(Dt,{..._,className:"text-blue-500"});case"xls":case"xlsx":return m.jsx(Ot,{..._,className:"text-green-600"});case"csv":return m.jsx(Ot,{..._,className:"text-green-500"});case"ppt":case"pptx":return m.jsx(Mn,{..._,className:"text-orange-500"});case"txt":case"rtf":return m.jsx(Dt,{..._,className:"text-gray-600"});case"md":return m.jsx(Sn,{..._});case"jpg":case"jpeg":case"png":case"gif":case"svg":case"bmp":case"webp":case"ico":return m.jsx(Tn,{..._,className:"text-purple-500"});case"mp4":case"avi":case"mov":case"wmv":case"flv":case"webm":case"mkv":return m.jsx(Pn,{..._,className:"text-purple-600"});case"mp3":case"wav":case"ogg":case"flac":case"m4a":case"aac":return m.jsx(Cn,{..._,className:"text-pink-500"});case"zip":case"rar":case"7z":case"tar":case"gz":case"bz2":return m.jsx(mn,{..._,className:"text-yellow-600"});case"js":case"jsx":return m.jsx(xe,{..._,className:"text-yellow-500"});case"ts":case"tsx":return m.jsx(jn,{..._,className:"text-blue-600"});case"html":case"htm":return m.jsx(xe,{..._,className:"text-orange-600"});case"css":return m.jsx(xe,{..._,className:"text-blue-400"});case"json":return m.jsx(yn,{..._,className:"text-gray-700"});case"xml":case"yml":case"yaml":return m.jsx(xe,{..._,className:"text-gray-600"});default:return m.jsx(Mt,{..._})}},c={sm:{iconSize:20,textSize:"text-xs",containerSize:"w-full max-w-40 h-auto",filenameSize:"text-xs",textTruncateSize:"90px",previewSize:"h-12 w-20"},md:{iconSize:32,textSize:"text-sm",containerSize:"w-full max-w-52 h-auto",filenameSize:"text-xs",textTruncateSize:"100px",previewSize:"h-16 w-20"},lg:{iconSize:45,textSize:"text-base",containerSize:"w-full max-w-60 h-auto",filenameSize:"text-xs",textTruncateSize:"100px",previewSize:"h-20 w-20"},xlg:{iconSize:56,textSize:"text-base",containerSize:"w-full max-w-70 h-auto",filenameSize:"text-xs",textTruncateSize:"100px",previewSize:"h-23 w-24"}},{iconSize:l,textSize:h,previewSize:f}=c[e],g=i(r.name),S=a(g);return m.jsx("div",{className:`flex flex-col items-center ${t} mt-2 gap-1`,children:m.jsxs("div",{className:"group flex max-w-[160px] cursor-default flex-col items-center justify-center rounded-lg border border-gray-200 bg-white p-3 shadow-sm transition-colors duration-200 hover:bg-gray-50 hover:shadow-md sm:max-w-[180px] md:max-w-[200px]",children:[r.thumbnailBase64?m.jsx("div",{className:`${f} w-20 transform overflow-hidden rounded transition-transform duration-200 group-hover:scale-110`,children:m.jsx("img",{src:`data:${r.type};base64,${r.thumbnailBase64}`,className:"h-full w-full object-cover"})}):m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"mb-2 transform transition-transform duration-200 group-hover:scale-110",children:j.cloneElement(S,{size:l})}),n&&g&&m.jsx("div",{className:`${h} px-1 text-center font-medium break-all`,children:m.jsx("span",{className:"inline-block rounded bg-gray-100 px-2 py-0.5 text-gray-700",children:g.toUpperCase()})})]}),m.jsxs("div",{className:"flex flex-row items-center justify-between gap-1 p-2",children:[m.jsxs("div",{className:"mt-1",children:[m.jsx("p",{className:"w-25 truncate text-start text-xs font-medium text-gray-800",children:r.name}),m.jsxs("p",{className:"text-start text-xs text-gray-500",children:["(",(r.size/1024).toFixed(1)," KB)"]})]}),s&&m.jsx("button",{className:"h-6 w-6 rounded-md p-0 text-gray-400 transition hover:bg-gray-100 hover:text-gray-700","aria-label":"Remove File",onClick:()=>o(r.id),children:m.jsx(Nn,{className:"h-10 w-10 text-gray-400"})})]}),m.jsx($n,{progress:r.progress})]})})};function Bn(r){return Re({attr:{fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"},child:[]}]})(r)}const zn=({files:r})=>m.jsx("div",{className:"flex flex-col divide-y divide-gray-200 rounded-lg border border-gray-200 bg-white",children:r.map(e=>m.jsxs("div",{className:"flex items-center gap-2 p-2",children:[m.jsx("div",{className:"h-12 w-12 flex-shrink-0 overflow-hidden rounded bg-gray-100",children:e.thumbnailBase64?m.jsx("img",{src:`data:${e.type};base64,${e.thumbnailBase64}`,className:"h-full w-full object-cover"}):m.jsx("div",{className:"flex h-full w-full items-center justify-center text-gray-500",children:m.jsx(Bn,{size:24})})}),m.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[m.jsx("span",{className:"text-xs font-medium text-gray-800 truncate w-60",children:e.name}),m.jsxs("span",{className:"text-xs text-gray-500",children:[(e.size/1024).toFixed(1)," KB"]})]})]},e.id))}),Hn=({sessionUrl:r,refreshTokenUrl:e,header:t,showHeader:n=!1,showLogo:s=!0,clickQrCodeToReload:o=!1,size:i="large",filePreviewMode:a="grid"})=>{const[c,l]=j.useState(!0),[h,f]=j.useState(160),[g,S]=j.useState(""),[y,_]=j.useState(""),[O,P]=j.useState("w-32 h-32 md:w-40 md:h-40"),[z,M]=j.useState("w-2 h-2"),[B,v]=j.useState("sm"),[Y,Q]=j.useState(!1),[te,se]=kr("qrcode-last-session-ids",[]),[ce,J]=j.useState(!1),N=j.useRef(null),G=j.useRef(null),ee=j.useRef(te),X=j.useRef(""),W=j.useRef(0),[re,K]=j.useState([]);j.useEffect(()=>{const E=[...new Set(te)];ee.current=E},[te]);async function le(){try{if(!X.current||Cr(X.current,60)){const E=await xt(e,{timeout:16e4});X.current=E.access_token}return X.current}catch(E){throw console.error("Error fetching access token:",E),E}finally{}}const p=async()=>{if(!G.current){l(!0);try{const E=await xt(r,{lastSessionIds:ee.current},{timeout:3e5});G.current=E;const x=k(E);console.log("Generated Device login URL:",x),S(x),_(E.hubUrl),se([E.sessionId])}catch{Y||(console.log("Enabling retry button..."),Q(!0),l(!1))}finally{}}},u=async()=>{G.current&&(J(!1),Q(!1),K([]),G.current=null,N.current=null)};function b(E){return typeof E=="string"&&E.trim().length===0}const T=async E=>{if(b(E)){console.log("Hub URL is empty, cannot create connection.");return}try{N.current=new ln().withUrl(E,{withCredentials:!1,transport:1,accessTokenFactory:()=>le()}).configureLogging(d.Information).withAutomaticReconnect({nextRetryDelayInMilliseconds:x=>Math.min(16e3,Math.pow(2,x.previousRetryCount)*1e3)}).build(),N.current.on("FileAdded",x=>{console.log(x),K(I=>I.some(F=>F.name===x.name)?I:[...I,x])}),N.current.on("FileRemoved",x=>{K(I=>I.some(F=>F.name===x.name)?I.filter(F=>F.name!==x.name):I)}),N.current.on("FileProgress",(x,I)=>{console.log(x,I),K(F=>F.map(w=>w.id===x?{...w,progress:I}:w))}),N.current.on("FilesCleared",()=>{console.log("Files cleared"),K([])}),N.current.on("sessionDisconnected",x=>{console.log("Session disconnected:",x),u()}),N.current.on("sessionReset",x=>{console.log("Session reset:",x),K([])}),N.current.onreconnecting(x=>{console.log("Connection lost, attempting to reconnect...",x),W.current>=2?J(!1):W.current+=1,console.log("Retry count:",W.current)}),N.current.onreconnected(x=>{console.log("Connection re-established:",x),J(!0),W.current=0}),N.current.onclose(x=>{console.log("Connection closed",x),J(!1),K([])}),N.current.serverTimeoutInMilliseconds=3e4,N.current.keepAliveIntervalInMilliseconds=15e3,await N.current.start(),J(!0),l(!1),Q(!1),console.log("SignalR Connected successfully")}catch(x){console.error("SignalR Connection failed:",x),l(!1),Q(!0)}finally{}},C=async()=>{await p(),await T(G.current.hubUrl??"")},D=j.useCallback(Er(C,1e3),[]);j.useEffect(()=>{if(Sr(r)){console.log("No sessionUrl provided, skipping session creation.");return}return(async()=>await C())(),()=>{N.current&&(N.current.off("FileAdded",E=>{}),N.current.off("FileRemoved",E=>{}),N.current.stop().catch(console.error))}},[]);const R=async()=>{K([]),await u(),await D()};function k(E){return new URL(E.deviceLoginUrl).toString()}return j.useEffect(()=>{switch(i){case"small":P("w-16 h-16 md:w-20 md:h-20"),M("w-2 h-2"),f(200),v("xlg");break;case"medium":P("w-24 h-24 md:w-30 md:h-30"),M("w-2 h-2"),f(200),v("xlg");break;case"large":P("w-32 h-32 md:w-40 md:h-40"),M("w-2 h-2"),f(200),v("xlg");break;case"xlarge":P("w-40 h-40 md:w-48 md:h-48"),M("w-2 h-2"),f(200),v("xlg");break}return()=>{}},[i]),m.jsxs("section",{className:"p-2",children:[c&&m.jsx("div",{className:"absolute inset-0 bg-white/90 flex items-center justify-center rounded-md z-10",children:m.jsxs("div",{className:"flex flex-col items-center text-center mt-0 gap-2",children:[m.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-t-2 border-blue-800 border-dashed"}),m.jsx("div",{className:"text-center h-10 w-10",children:m.jsx("p",{className:"text-gray-900",children:"Loading..."})})]})}),!c&&Y&&m.jsx("div",{className:"absolute inset-0 bg-white/90 flex items-center justify-center rounded-md z-10",children:m.jsxs("div",{className:"flex flex-col items-center text-center mt-5 gap-2",children:[m.jsx("div",{className:"text-center text-xs",children:m.jsx("p",{className:"text-gray-900",children:"Cannot create session"})}),m.jsx("button",{onClick:async()=>{await R()},className:"bg-blue-300 text-white py-1 px-2 rounded-md hover:bg-blue-500 transition-colors",children:m.jsx(Tt,{className:"h-4 w-4"})})]})}),m.jsxs("div",{className:"flex flex-col items-center text-center",children:[n&&m.jsx(m.Fragment,{children:m.jsx("header",{className:"mb-2",children:m.jsx("h1",{className:"text-xl font-semibold text-gray-600",children:t})})}),m.jsxs("div",{"aria-label":"QR Code for file upload",onClick:async()=>{o&&await R()},className:`bg-white p-2 rounded-2xl border-2 border-dashed ${O} flex
|
|
122
|
-
border-gray-300 items-center justify-center transition-all duration-300 hover:shadow-lg hover:scale-105`,children:[m.jsxs("div",{className:"relative inline-block",children:[m.jsx(fr,{value:g,size:h,className:"w-full h-full"}),s&&m.jsx(m.Fragment,{children:m.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:m.jsx("div",{className:`bg-white ${
|
|
121
|
+
*/const Mn=[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]],Nn=se("presentation",Mn);function $n(r){return Ie({attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{id:"Square_Remove"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{d:"M18.437,20.937H5.563a2.5,2.5,0,0,1-2.5-2.5V5.563a2.5,2.5,0,0,1,2.5-2.5H18.437a2.5,2.5,0,0,1,2.5,2.5V18.437A2.5,2.5,0,0,1,18.437,20.937ZM5.563,4.063a1.5,1.5,0,0,0-1.5,1.5V18.437a1.5,1.5,0,0,0,1.5,1.5H18.437a1.5,1.5,0,0,0,1.5-1.5V5.563a1.5,1.5,0,0,0-1.5-1.5Z"},child:[]},{tag:"path",attr:{d:"M13.767,14.477a.5.5,0,0,0,.71-.71L12.707,12l1.77-1.77a.5.5,0,0,0-.71-.7L12,11.3l-1.77-1.77a.5.5,0,0,0-.7.7c.59.59,1.17,1.18,1.77,1.77l-1.77,1.77c-.46.45.25,1.16.7.71L12,12.707Z"},child:[]}]}]}]})(r)}const Ln=({progress:r=0})=>m.jsxs("div",{className:"mt-3 w-full",children:[m.jsxs("div",{className:"mb-2 flex justify-between",children:[m.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-500",children:"Uploading..."}),m.jsxs("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-500",children:[Math.round(r||0),"%"]})]}),m.jsx("div",{className:"h-2.5 w-full rounded-full bg-gray-200 dark:bg-gray-200",children:m.jsx("div",{className:"h-2.5 rounded-full bg-emerald-500 shadow-[0_0_8px_rgba(16,185,129,0.4)] transition-all duration-300 ease-out",style:{width:`${r||0}%`}})})]}),Bn=({file:r,size:e="md",className:t="",showExtension:n=!0,showRemoveButton:s=!1,removeFileMethod:o=()=>{}})=>{const i=w=>{const p=w.split(".");return p.length>1?p.pop().toLowerCase():""},a=w=>{const p={className:"text-gray-600"};switch(w){case"pdf":return m.jsx(Mt,{...p,className:"text-red-500"});case"doc":case"docx":return m.jsx(Dt,{...p,className:"text-blue-500"});case"xls":case"xlsx":return m.jsx(Ot,{...p,className:"text-green-600"});case"csv":return m.jsx(Ot,{...p,className:"text-green-500"});case"ppt":case"pptx":return m.jsx(Nn,{...p,className:"text-orange-500"});case"txt":case"rtf":return m.jsx(Dt,{...p,className:"text-gray-600"});case"md":return m.jsx(En,{...p});case"jpg":case"jpeg":case"png":case"gif":case"svg":case"bmp":case"webp":case"ico":return m.jsx(kn,{...p,className:"text-purple-500"});case"mp4":case"avi":case"mov":case"wmv":case"flv":case"webm":case"mkv":return m.jsx(Rn,{...p,className:"text-purple-600"});case"mp3":case"wav":case"ogg":case"flac":case"m4a":case"aac":return m.jsx(xn,{...p,className:"text-pink-500"});case"zip":case"rar":case"7z":case"tar":case"gz":case"bz2":return m.jsx(vn,{...p,className:"text-yellow-600"});case"js":case"jsx":return m.jsx(Te,{...p,className:"text-yellow-500"});case"ts":case"tsx":return m.jsx(On,{...p,className:"text-blue-600"});case"html":case"htm":return m.jsx(Te,{...p,className:"text-orange-600"});case"css":return m.jsx(Te,{...p,className:"text-blue-400"});case"json":return m.jsx(wn,{...p,className:"text-gray-700"});case"xml":case"yml":case"yaml":return m.jsx(Te,{...p,className:"text-gray-600"});default:return m.jsx(Mt,{...p})}},c={sm:{iconSize:20,textSize:"text-xs",containerSize:"w-full max-w-40 h-auto",filenameSize:"text-xs",textTruncateSize:"90px",previewSize:"h-12 w-20"},md:{iconSize:32,textSize:"text-sm",containerSize:"w-full max-w-52 h-auto",filenameSize:"text-xs",textTruncateSize:"100px",previewSize:"h-16 w-20"},lg:{iconSize:45,textSize:"text-base",containerSize:"w-full max-w-60 h-auto",filenameSize:"text-xs",textTruncateSize:"100px",previewSize:"h-20 w-20"},xlg:{iconSize:56,textSize:"text-base",containerSize:"w-full max-w-70 h-auto",filenameSize:"text-xs",textTruncateSize:"100px",previewSize:"h-23 w-24"}},{iconSize:l,textSize:h,previewSize:f}=c[e],g=i(r.name),E=a(g);return m.jsx("div",{className:`flex flex-col items-center ${t} mt-2 gap-1`,children:m.jsxs("div",{className:"group flex max-w-[160px] cursor-default flex-col items-center justify-center rounded-lg border border-gray-200 bg-white p-3 shadow-sm transition-colors duration-200 hover:bg-gray-50 hover:shadow-md sm:max-w-[180px] md:max-w-[200px]",children:[r.thumbnailBase64?m.jsx("div",{className:`${f} w-20 transform overflow-hidden rounded transition-transform duration-200 group-hover:scale-110`,children:m.jsx("img",{src:`data:${r.type};base64,${r.thumbnailBase64}`,className:"h-full w-full object-cover"})}):m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"mb-2 transform transition-transform duration-200 group-hover:scale-110",children:O.cloneElement(E,{size:l})}),n&&g&&m.jsx("div",{className:`${h} px-1 text-center font-medium break-all`,children:m.jsx("span",{className:"inline-block rounded bg-gray-100 px-2 py-0.5 text-gray-700",children:g.toUpperCase()})})]}),m.jsxs("div",{className:"flex flex-row items-center justify-between gap-1 p-2",children:[m.jsxs("div",{className:"mt-1",children:[m.jsx("p",{className:"w-25 truncate text-start text-xs font-medium text-gray-800",children:r.name}),m.jsxs("p",{className:"text-start text-xs text-gray-500",children:["(",(r.size/1024).toFixed(1)," KB)"]})]}),s&&m.jsx("button",{className:"h-6 w-6 rounded-md p-0 text-gray-400 transition hover:bg-gray-100 hover:text-gray-700","aria-label":"Remove File",onClick:()=>o(r.id),children:m.jsx($n,{className:"h-10 w-10 text-gray-400"})})]}),m.jsx(Ln,{progress:r.progress})]})})};function zn(r){return Ie({attr:{fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"},child:[]}]})(r)}const Hn=({files:r})=>m.jsx("div",{className:"flex flex-col divide-y divide-gray-200 rounded-lg border border-gray-200 bg-white",children:r.map(e=>m.jsxs("div",{className:"flex items-center gap-2 p-2",children:[m.jsx("div",{className:"h-12 w-12 flex-shrink-0 overflow-hidden rounded bg-gray-100",children:e.thumbnailBase64?m.jsx("img",{src:`data:${e.type};base64,${e.thumbnailBase64}`,className:"h-full w-full object-cover"}):m.jsx("div",{className:"flex h-full w-full items-center justify-center text-gray-500",children:m.jsx(zn,{size:24})})}),m.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[m.jsx("span",{className:"text-xs font-medium text-gray-800 truncate w-60",children:e.name}),m.jsxs("span",{className:"text-xs text-gray-500",children:[(e.size/1024).toFixed(1)," KB"]})]})]},e.id))}),Wn=({sessionUrl:r,refreshTokenUrl:e,header:t,showHeader:n=!1,showLogo:s=!0,clickQrCodeToReload:o=!1,size:i="large",filePreviewMode:a="grid"})=>{const[c,l]=O.useState(!0),[h,f]=O.useState(160),[g,E]=O.useState(""),[w,p]=O.useState("w-32 h-32 md:w-40 md:h-40"),[j,k]=O.useState("w-2 h-2"),[B,M]=O.useState("sm"),[N,y]=O.useState(!1),[V,Z]=Pr("qrcode-last-session-ids",[]),[ne,J]=O.useState(!1),G=O.useRef(null),Y=O.useRef(null),ee=O.useRef(V),K=O.useRef(""),Q=O.useRef(0),[te,H]=O.useState([]);O.useEffect(()=>{const v=[...new Set(V)];ee.current=v},[V]),O.useEffect(()=>{if(Er(r))return;let v=!1,C=null;return(async()=>{const R=await b();if(v)return;const z=await u(R);try{if(await z?.start(),v){await z?.stop();return}C=z,G.current=z,J(!0),l(!1),y(!1),console.log("SignalR Connected successfully")}catch(S){v||console.error(S)}})(),()=>{v=!0,C&&C.stop().catch(console.error),G.current===C&&(G.current=null)}},[r]),O.useEffect(()=>{switch(i){case"small":p("w-16 h-16 md:w-20 md:h-20"),k("w-2 h-2"),f(200),M("xlg");break;case"medium":p("w-24 h-24 md:w-30 md:h-30"),k("w-2 h-2"),f(200),M("xlg");break;case"large":p("w-32 h-32 md:w-40 md:h-40"),k("w-2 h-2"),f(200),M("xlg");break;case"xlarge":p("w-40 h-40 md:w-48 md:h-48"),k("w-2 h-2"),f(200),M("xlg");break}return()=>{}},[i]);async function oe(){try{if(!K.current||xr(K.current,60)){const v=await xt(e,{timeout:16e4});K.current=v.access_token}return K.current}catch(v){throw console.error("Error fetching access token:",v),v}finally{}}const ce=async()=>{if(!Y.current){l(!0);try{const v=await xt(r,{lastSessionIds:ee.current},{timeout:3e5});Y.current=v;const C=I(v);E(C),Z([v.sessionId])}catch{N||(y(!0),l(!1))}finally{}}},le=async()=>{Y.current&&(await Sr(`${r}?session_id=${Y.current.sessionId}`),J(!1),y(!1),H([]),Y.current=null,G.current?.stop(),G.current=null)};function _(v){return typeof v=="string"&&v.trim().length===0}const u=async v=>{if(_(v)){console.log("Hub URL is empty, cannot create connection.");return}let C;try{C=new un().withUrl(v,{withCredentials:!1,transport:1,accessTokenFactory:()=>oe()}).configureLogging(d.Information).withAutomaticReconnect({nextRetryDelayInMilliseconds:P=>Math.min(16e3,Math.pow(2,P.previousRetryCount)*1e3)}).build(),C.on("FileAdded",P=>{H(R=>R.some(z=>z.name===P.name)?R:[...R,P])}),C.on("FileRemoved",P=>{H(R=>R.some(z=>z.name===P.name)?R.filter(z=>z.name!==P.name):R)}),C.on("FileProgress",(P,R)=>{H(z=>z.map(S=>S.id===P?{...S,progress:R}:S))}),C.on("FilesCleared",()=>{H([])}),C.on("sessionDisconnected",P=>{le()}),C.on("sessionReset",P=>{H([])}),C.onreconnecting(P=>{console.log("Connection lost, attempting to reconnect...",P),Q.current>=2?J(!1):Q.current+=1,console.log("Retry count:",Q.current)}),C.onreconnected(P=>{console.log("Connection re-established:",P),J(!0),l(!1),y(!1),Q.current=0}),C.onclose(P=>{console.log("Connection closed",P),J(!1),H([])}),C.serverTimeoutInMilliseconds=3e4,C.keepAliveIntervalInMilliseconds=15e3}catch(P){console.error("SignalR Connection failed:",P),l(!1),y(!0)}finally{}return C},b=async()=>(await ce(),Y.current.hubUrl),T=async()=>{var v=await b(),C=await u(v);return C},x=O.useCallback(Cr(T,1e3),[]),D=async()=>{H([]),await le(),G.current=await x(),G.current?.start(),J(!0),l(!1),y(!1)};function I(v){return new URL(v.deviceLoginUrl).toString()}return m.jsxs("section",{className:"p-2",children:[c&&m.jsx("div",{className:"absolute inset-0 bg-white/90 flex items-center justify-center rounded-md z-10",children:m.jsxs("div",{className:"flex flex-col items-center text-center mt-0 gap-2",children:[m.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-t-2 border-blue-800 border-dashed"}),m.jsx("div",{className:"text-center h-10 w-10",children:m.jsx("p",{className:"text-gray-900",children:"Loading..."})})]})}),!c&&N&&m.jsx("div",{className:"absolute inset-0 bg-white/90 flex items-center justify-center rounded-md z-10",children:m.jsxs("div",{className:"flex flex-col items-center text-center mt-5 gap-2",children:[m.jsx("div",{className:"text-center text-xs",children:m.jsx("p",{className:"text-gray-900",children:"Cannot create session"})}),m.jsx("button",{onClick:async()=>{await D()},className:"bg-blue-300 text-white py-1 px-2 rounded-md hover:bg-blue-500 transition-colors",children:m.jsx(Tt,{className:"h-4 w-4"})})]})}),m.jsxs("div",{className:"flex flex-col items-center text-center",children:[n&&m.jsx(m.Fragment,{children:m.jsx("header",{className:"mb-2",children:m.jsx("h1",{className:"text-xl font-semibold text-gray-600",children:t})})}),m.jsxs("div",{"aria-label":"QR Code for file upload",onClick:async()=>{o&&await D()},className:`bg-white p-2 rounded-2xl border-2 border-dashed ${w} flex
|
|
122
|
+
border-gray-300 items-center justify-center transition-all duration-300 hover:shadow-lg hover:scale-105`,children:[m.jsxs("div",{className:"relative inline-block",children:[m.jsx(fr,{value:g,size:h,className:"w-full h-full"}),s&&m.jsx(m.Fragment,{children:m.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:m.jsx("div",{className:`bg-white ${j} rounded flex items-center justify-center`,children:m.jsx("span",{className:"text-xs font-bold",children:m.jsx(br,{size:i,isConnected:ne})})})})})]}),m.jsxs("p",{className:"sr-only",children:["QR Code that allows uploads from ",g]})]}),o?m.jsx("div",{className:"flex flex-row mt-3",children:m.jsx("p",{className:"text-gray-500",children:"Click QR code to reload"})}):m.jsx("div",{className:"flex flex-row mt-3",children:m.jsxs("button",{onClick:async()=>{await D()},className:"bg-gray-500 text-white py-2 px-4 rounded-md hover:bg-blue-800 transition-colors flex flex-row items-center",children:[m.jsx(Tt,{className:"h-4 w-4"})," ",m.jsx("span",{className:"ml-3",children:"Reload"})]})}),m.jsx("div",{className:"flex flex-row justify-center gap-1 flex-wrap",children:a==="grid"?te.map((v,C)=>m.jsx(Bn,{file:v,size:B},C)):m.jsx(Hn,{files:te})})]})]})};exports.QrCodeGenerator=Wn;
|
|
123
123
|
//# sourceMappingURL=qr-code-generator.cjs.js.map
|