UNPKG

@ipscape/chat-client-js

Version:
2 lines 333 kB
(function(Ye,Ze){typeof exports=="object"&&typeof module<"u"?Ze(exports):typeof define=="function"&&define.amd?define(["exports"],Ze):(Ye=typeof globalThis<"u"?globalThis:Ye||self,Ze(Ye["ipscape-chat-client"]={}))})(this,function(Ye){"use strict";var Ze=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function yt(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function r(){var i=!1;try{i=this instanceof r}catch{}return i?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var vt={exports:{}},Wn;function qo(){if(Wn)return vt.exports;Wn=1;var e=typeof Reflect=="object"?Reflect:null,t=e&&typeof e.apply=="function"?e.apply:function(V,Y,ie){return Function.prototype.apply.call(V,Y,ie)},n;e&&typeof e.ownKeys=="function"?n=e.ownKeys:Object.getOwnPropertySymbols?n=function(V){return Object.getOwnPropertyNames(V).concat(Object.getOwnPropertySymbols(V))}:n=function(V){return Object.getOwnPropertyNames(V)};function r(F){console&&console.warn&&console.warn(F)}var i=Number.isNaN||function(V){return V!==V};function o(){o.init.call(this)}vt.exports=o,vt.exports.once=fe,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function l(F){if(typeof F!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof F)}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(F){if(typeof F!="number"||F<0||i(F))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+F+".");s=F}}),o.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(V){if(typeof V!="number"||V<0||i(V))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+V+".");return this._maxListeners=V,this};function f(F){return F._maxListeners===void 0?o.defaultMaxListeners:F._maxListeners}o.prototype.getMaxListeners=function(){return f(this)},o.prototype.emit=function(V){for(var Y=[],ie=1;ie<arguments.length;ie++)Y.push(arguments[ie]);var ce=V==="error",pe=this._events;if(pe!==void 0)ce=ce&&pe.error===void 0;else if(!ce)return!1;if(ce){var le;if(Y.length>0&&(le=Y[0]),le instanceof Error)throw le;var De=new Error("Unhandled error."+(le?" ("+le.message+")":""));throw De.context=le,De}var Qe=pe[V];if(Qe===void 0)return!1;if(typeof Qe=="function")t(Qe,this,Y);else for(var Te=Qe.length,re=W(Qe,Te),ie=0;ie<Te;++ie)t(re[ie],this,Y);return!0};function y(F,V,Y,ie){var ce,pe,le;if(l(Y),pe=F._events,pe===void 0?(pe=F._events=Object.create(null),F._eventsCount=0):(pe.newListener!==void 0&&(F.emit("newListener",V,Y.listener?Y.listener:Y),pe=F._events),le=pe[V]),le===void 0)le=pe[V]=Y,++F._eventsCount;else if(typeof le=="function"?le=pe[V]=ie?[Y,le]:[le,Y]:ie?le.unshift(Y):le.push(Y),ce=f(F),ce>0&&le.length>ce&&!le.warned){le.warned=!0;var De=new Error("Possible EventEmitter memory leak detected. "+le.length+" "+String(V)+" listeners added. Use emitter.setMaxListeners() to increase limit");De.name="MaxListenersExceededWarning",De.emitter=F,De.type=V,De.count=le.length,r(De)}return F}o.prototype.addListener=function(V,Y){return y(this,V,Y,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(V,Y){return y(this,V,Y,!0)};function b(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function $(F,V,Y){var ie={fired:!1,wrapFn:void 0,target:F,type:V,listener:Y},ce=b.bind(ie);return ce.listener=Y,ie.wrapFn=ce,ce}o.prototype.once=function(V,Y){return l(Y),this.on(V,$(this,V,Y)),this},o.prototype.prependOnceListener=function(V,Y){return l(Y),this.prependListener(V,$(this,V,Y)),this},o.prototype.removeListener=function(V,Y){var ie,ce,pe,le,De;if(l(Y),ce=this._events,ce===void 0)return this;if(ie=ce[V],ie===void 0)return this;if(ie===Y||ie.listener===Y)--this._eventsCount===0?this._events=Object.create(null):(delete ce[V],ce.removeListener&&this.emit("removeListener",V,ie.listener||Y));else if(typeof ie!="function"){for(pe=-1,le=ie.length-1;le>=0;le--)if(ie[le]===Y||ie[le].listener===Y){De=ie[le].listener,pe=le;break}if(pe<0)return this;pe===0?ie.shift():Z(ie,pe),ie.length===1&&(ce[V]=ie[0]),ce.removeListener!==void 0&&this.emit("removeListener",V,De||Y)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(V){var Y,ie,ce;if(ie=this._events,ie===void 0)return this;if(ie.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):ie[V]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete ie[V]),this;if(arguments.length===0){var pe=Object.keys(ie),le;for(ce=0;ce<pe.length;++ce)le=pe[ce],le!=="removeListener"&&this.removeAllListeners(le);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(Y=ie[V],typeof Y=="function")this.removeListener(V,Y);else if(Y!==void 0)for(ce=Y.length-1;ce>=0;ce--)this.removeListener(V,Y[ce]);return this};function L(F,V,Y){var ie=F._events;if(ie===void 0)return[];var ce=ie[V];return ce===void 0?[]:typeof ce=="function"?Y?[ce.listener||ce]:[ce]:Y?oe(ce):W(ce,ce.length)}o.prototype.listeners=function(V){return L(this,V,!0)},o.prototype.rawListeners=function(V){return L(this,V,!1)},o.listenerCount=function(F,V){return typeof F.listenerCount=="function"?F.listenerCount(V):H.call(F,V)},o.prototype.listenerCount=H;function H(F){var V=this._events;if(V!==void 0){var Y=V[F];if(typeof Y=="function")return 1;if(Y!==void 0)return Y.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};function W(F,V){for(var Y=new Array(V),ie=0;ie<V;++ie)Y[ie]=F[ie];return Y}function Z(F,V){for(;V+1<F.length;V++)F[V]=F[V+1];F.pop()}function oe(F){for(var V=new Array(F.length),Y=0;Y<V.length;++Y)V[Y]=F[Y].listener||F[Y];return V}function fe(F,V){return new Promise(function(Y,ie){function ce(le){F.removeListener(V,pe),ie(le)}function pe(){typeof F.removeListener=="function"&&F.removeListener("error",ce),Y([].slice.call(arguments))}ye(F,V,pe,{once:!0}),V!=="error"&&ae(F,ce,{once:!0})})}function ae(F,V,Y){typeof F.on=="function"&&ye(F,"error",V,Y)}function ye(F,V,Y,ie){if(typeof F.on=="function")ie.once?F.once(V,Y):F.on(V,Y);else if(typeof F.addEventListener=="function")F.addEventListener(V,function ce(pe){ie.once&&F.removeEventListener(V,ce),Y(pe)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof F)}return vt.exports}var Jn=qo();function je(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Gn(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function me(e){return this instanceof me?(this.v=e,this):new me(e)}function Be(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(H){return function(W){return Promise.resolve(W).then(H,$)}}function l(H,W){r[H]&&(i[H]=function(Z){return new Promise(function(oe,fe){o.push([H,Z,oe,fe])>1||f(H,Z)})},W&&(i[H]=W(i[H])))}function f(H,W){try{y(r[H](W))}catch(Z){L(o[0][3],Z)}}function y(H){H.value instanceof me?Promise.resolve(H.value.v).then(b,$):L(o[0][2],H)}function b(H){f("next",H)}function $(H){f("throw",H)}function L(H,W){H(W),o.shift(),o.length&&f(o[0][0],o[0][1])}}function Tt(e){var t,n;return t={},r("next"),r("throw",function(i){throw i}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(i,o){t[i]=e[i]?function(s){return(n=!n)?{value:me(e[i](s)),done:!1}:o?o(s):s}:o}}function He(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof Gn=="function"?Gn(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=e[o]&&function(s){return new Promise(function(l,f){s=e[o](s),i(l,f,s.done,s.value)})}}function i(o,s,l,f){Promise.resolve(f).then(function(y){o({value:y,done:l})},s)}}typeof SuppressedError=="function"&&SuppressedError;var Ft={exports:{}},bt,Bo=new Uint8Array(16);function Kn(){if(!bt&&(bt=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!bt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return bt(Bo)}const Ho=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function wt(e){return typeof e=="string"&&Ho.test(e)}for(var ke=[],Vt=0;Vt<256;++Vt)ke.push((Vt+256).toString(16).substr(1));function St(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(ke[e[t+0]]+ke[e[t+1]]+ke[e[t+2]]+ke[e[t+3]]+"-"+ke[e[t+4]]+ke[e[t+5]]+"-"+ke[e[t+6]]+ke[e[t+7]]+"-"+ke[e[t+8]]+ke[e[t+9]]+"-"+ke[e[t+10]]+ke[e[t+11]]+ke[e[t+12]]+ke[e[t+13]]+ke[e[t+14]]+ke[e[t+15]]).toLowerCase();if(!wt(n))throw TypeError("Stringified UUID is invalid");return n}var Xn,Wt,Jt=0,Gt=0;function zo(e,t,n){var r=t&&n||0,i=t||new Array(16);e=e||{};var o=e.node||Xn,s=e.clockseq!==void 0?e.clockseq:Wt;if(o==null||s==null){var l=e.random||(e.rng||Kn)();o==null&&(o=Xn=[l[0]|1,l[1],l[2],l[3],l[4],l[5]]),s==null&&(s=Wt=(l[6]<<8|l[7])&16383)}var f=e.msecs!==void 0?e.msecs:Date.now(),y=e.nsecs!==void 0?e.nsecs:Gt+1,b=f-Jt+(y-Gt)/1e4;if(b<0&&e.clockseq===void 0&&(s=s+1&16383),(b<0||f>Jt)&&e.nsecs===void 0&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Jt=f,Gt=y,Wt=s,f+=122192928e5;var $=((f&268435455)*1e4+y)%4294967296;i[r++]=$>>>24&255,i[r++]=$>>>16&255,i[r++]=$>>>8&255,i[r++]=$&255;var L=f/4294967296*1e4&268435455;i[r++]=L>>>8&255,i[r++]=L&255,i[r++]=L>>>24&15|16,i[r++]=L>>>16&255,i[r++]=s>>>8|128,i[r++]=s&255;for(var H=0;H<6;++H)i[r+H]=o[H];return t||St(i)}function Qn(e){if(!wt(e))throw TypeError("Invalid UUID");var t,n=new Uint8Array(16);return n[0]=(t=parseInt(e.slice(0,8),16))>>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=t&255,n[4]=(t=parseInt(e.slice(9,13),16))>>>8,n[5]=t&255,n[6]=(t=parseInt(e.slice(14,18),16))>>>8,n[7]=t&255,n[8]=(t=parseInt(e.slice(19,23),16))>>>8,n[9]=t&255,n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=t&255,n}function Fo(e){e=unescape(encodeURIComponent(e));for(var t=[],n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t}var Vo="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Wo="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Yn(e,t,n){function r(i,o,s,l){if(typeof i=="string"&&(i=Fo(i)),typeof o=="string"&&(o=Qn(o)),o.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var f=new Uint8Array(16+i.length);if(f.set(o),f.set(i,o.length),f=n(f),f[6]=f[6]&15|t,f[8]=f[8]&63|128,s){l=l||0;for(var y=0;y<16;++y)s[l+y]=f[y];return s}return St(f)}try{r.name=e}catch{}return r.DNS=Vo,r.URL=Wo,r}function Jo(e){if(typeof e=="string"){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var n=0;n<t.length;++n)e[n]=t.charCodeAt(n)}return Go(Ko(Xo(e),e.length*8))}function Go(e){for(var t=[],n=e.length*32,r="0123456789abcdef",i=0;i<n;i+=8){var o=e[i>>5]>>>i%32&255,s=parseInt(r.charAt(o>>>4&15)+r.charAt(o&15),16);t.push(s)}return t}function Zn(e){return(e+64>>>9<<4)+14+1}function Ko(e,t){e[t>>5]|=128<<t%32,e[Zn(t)-1]=t;for(var n=1732584193,r=-271733879,i=-1732584194,o=271733878,s=0;s<e.length;s+=16){var l=n,f=r,y=i,b=o;n=Pe(n,r,i,o,e[s],7,-680876936),o=Pe(o,n,r,i,e[s+1],12,-389564586),i=Pe(i,o,n,r,e[s+2],17,606105819),r=Pe(r,i,o,n,e[s+3],22,-1044525330),n=Pe(n,r,i,o,e[s+4],7,-176418897),o=Pe(o,n,r,i,e[s+5],12,1200080426),i=Pe(i,o,n,r,e[s+6],17,-1473231341),r=Pe(r,i,o,n,e[s+7],22,-45705983),n=Pe(n,r,i,o,e[s+8],7,1770035416),o=Pe(o,n,r,i,e[s+9],12,-1958414417),i=Pe(i,o,n,r,e[s+10],17,-42063),r=Pe(r,i,o,n,e[s+11],22,-1990404162),n=Pe(n,r,i,o,e[s+12],7,1804603682),o=Pe(o,n,r,i,e[s+13],12,-40341101),i=Pe(i,o,n,r,e[s+14],17,-1502002290),r=Pe(r,i,o,n,e[s+15],22,1236535329),n=Ae(n,r,i,o,e[s+1],5,-165796510),o=Ae(o,n,r,i,e[s+6],9,-1069501632),i=Ae(i,o,n,r,e[s+11],14,643717713),r=Ae(r,i,o,n,e[s],20,-373897302),n=Ae(n,r,i,o,e[s+5],5,-701558691),o=Ae(o,n,r,i,e[s+10],9,38016083),i=Ae(i,o,n,r,e[s+15],14,-660478335),r=Ae(r,i,o,n,e[s+4],20,-405537848),n=Ae(n,r,i,o,e[s+9],5,568446438),o=Ae(o,n,r,i,e[s+14],9,-1019803690),i=Ae(i,o,n,r,e[s+3],14,-187363961),r=Ae(r,i,o,n,e[s+8],20,1163531501),n=Ae(n,r,i,o,e[s+13],5,-1444681467),o=Ae(o,n,r,i,e[s+2],9,-51403784),i=Ae(i,o,n,r,e[s+7],14,1735328473),r=Ae(r,i,o,n,e[s+12],20,-1926607734),n=Ie(n,r,i,o,e[s+5],4,-378558),o=Ie(o,n,r,i,e[s+8],11,-2022574463),i=Ie(i,o,n,r,e[s+11],16,1839030562),r=Ie(r,i,o,n,e[s+14],23,-35309556),n=Ie(n,r,i,o,e[s+1],4,-1530992060),o=Ie(o,n,r,i,e[s+4],11,1272893353),i=Ie(i,o,n,r,e[s+7],16,-155497632),r=Ie(r,i,o,n,e[s+10],23,-1094730640),n=Ie(n,r,i,o,e[s+13],4,681279174),o=Ie(o,n,r,i,e[s],11,-358537222),i=Ie(i,o,n,r,e[s+3],16,-722521979),r=Ie(r,i,o,n,e[s+6],23,76029189),n=Ie(n,r,i,o,e[s+9],4,-640364487),o=Ie(o,n,r,i,e[s+12],11,-421815835),i=Ie(i,o,n,r,e[s+15],16,530742520),r=Ie(r,i,o,n,e[s+2],23,-995338651),n=Oe(n,r,i,o,e[s],6,-198630844),o=Oe(o,n,r,i,e[s+7],10,1126891415),i=Oe(i,o,n,r,e[s+14],15,-1416354905),r=Oe(r,i,o,n,e[s+5],21,-57434055),n=Oe(n,r,i,o,e[s+12],6,1700485571),o=Oe(o,n,r,i,e[s+3],10,-1894986606),i=Oe(i,o,n,r,e[s+10],15,-1051523),r=Oe(r,i,o,n,e[s+1],21,-2054922799),n=Oe(n,r,i,o,e[s+8],6,1873313359),o=Oe(o,n,r,i,e[s+15],10,-30611744),i=Oe(i,o,n,r,e[s+6],15,-1560198380),r=Oe(r,i,o,n,e[s+13],21,1309151649),n=Oe(n,r,i,o,e[s+4],6,-145523070),o=Oe(o,n,r,i,e[s+11],10,-1120210379),i=Oe(i,o,n,r,e[s+2],15,718787259),r=Oe(r,i,o,n,e[s+9],21,-343485551),n=ze(n,l),r=ze(r,f),i=ze(i,y),o=ze(o,b)}return[n,r,i,o]}function Xo(e){if(e.length===0)return[];for(var t=e.length*8,n=new Uint32Array(Zn(t)),r=0;r<t;r+=8)n[r>>5]|=(e[r/8]&255)<<r%32;return n}function ze(e,t){var n=(e&65535)+(t&65535),r=(e>>16)+(t>>16)+(n>>16);return r<<16|n&65535}function Qo(e,t){return e<<t|e>>>32-t}function Ct(e,t,n,r,i,o){return ze(Qo(ze(ze(t,e),ze(r,o)),i),n)}function Pe(e,t,n,r,i,o,s){return Ct(t&n|~t&r,e,t,i,o,s)}function Ae(e,t,n,r,i,o,s){return Ct(t&r|n&~r,e,t,i,o,s)}function Ie(e,t,n,r,i,o,s){return Ct(t^n^r,e,t,i,o,s)}function Oe(e,t,n,r,i,o,s){return Ct(n^(t|~r),e,t,i,o,s)}var Yo=Yn("v3",48,Jo);function Zo(e,t,n){e=e||{};var r=e.random||(e.rng||Kn)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=r[i];return t}return St(r)}function es(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:return t^n^r;case 2:return t&n^t&r^n&r;case 3:return t^n^r}}function Kt(e,t){return e<<t|e>>>32-t}function ts(e){var t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof e=="string"){var r=unescape(encodeURIComponent(e));e=[];for(var i=0;i<r.length;++i)e.push(r.charCodeAt(i))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var o=e.length/4+2,s=Math.ceil(o/16),l=new Array(s),f=0;f<s;++f){for(var y=new Uint32Array(16),b=0;b<16;++b)y[b]=e[f*64+b*4]<<24|e[f*64+b*4+1]<<16|e[f*64+b*4+2]<<8|e[f*64+b*4+3];l[f]=y}l[s-1][14]=(e.length-1)*8/Math.pow(2,32),l[s-1][14]=Math.floor(l[s-1][14]),l[s-1][15]=(e.length-1)*8&4294967295;for(var $=0;$<s;++$){for(var L=new Uint32Array(80),H=0;H<16;++H)L[H]=l[$][H];for(var W=16;W<80;++W)L[W]=Kt(L[W-3]^L[W-8]^L[W-14]^L[W-16],1);for(var Z=n[0],oe=n[1],fe=n[2],ae=n[3],ye=n[4],F=0;F<80;++F){var V=Math.floor(F/20),Y=Kt(Z,5)+es(V,oe,fe,ae)+ye+t[V]+L[F]>>>0;ye=ae,ae=fe,fe=Kt(oe,30)>>>0,oe=Z,Z=Y}n[0]=n[0]+Z>>>0,n[1]=n[1]+oe>>>0,n[2]=n[2]+fe>>>0,n[3]=n[3]+ae>>>0,n[4]=n[4]+ye>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,n[0]&255,n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,n[1]&255,n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,n[2]&255,n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,n[3]&255,n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,n[4]&255]}var ns=Yn("v5",80,ts);const rs="00000000-0000-0000-0000-000000000000";function is(e){if(!wt(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)}const os=yt(Object.freeze(Object.defineProperty({__proto__:null,NIL:rs,parse:Qn,stringify:St,v1:zo,v3:Yo,v4:Zo,v5:ns,validate:wt,version:is},Symbol.toStringTag,{value:"Module"})));function er(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e}function tr(e,t){const n=t.retryDelayInMs*Math.pow(2,e),r=Math.min(t.maxRetryDelayInMs,n);return{retryAfterInMs:r/2+er(0,r/2)}}function Xt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function Qt(e){if(Xt(e)){const t=typeof e.name=="string",n=typeof e.message=="string";return t&&n}return!1}function Rt(e,t){switch(t){case"utf-8":return as(e);case"base64":return nr(e);case"base64url":return ss(e);case"hex":return cs(e)}}function Le(e,t){switch(t){case"utf-8":return us(e);case"base64":return rr(e);case"base64url":return ls(e);case"hex":return ds(e)}}function nr(e){return btoa([...e].map(t=>String.fromCharCode(t)).join(""))}function ss(e){return nr(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function as(e){return new TextDecoder().decode(e)}function cs(e){return[...e].map(t=>t.toString(16).padStart(2,"0")).join("")}function us(e){return new TextEncoder().encode(e)}function rr(e){return new Uint8Array([...atob(e)].map(t=>t.charCodeAt(0)))}function ls(e){const t=e.replace(/-/g,"+").replace(/_/g,"/");return rr(t)}const ir=new Set("0123456789abcdefABCDEF");function ds(e){const t=new Uint8Array(e.length/2);for(let n=0;n<e.length/2;++n){const r=e[2*n],i=e[2*n+1];if(!ir.has(r)||!ir.has(i))return t.slice(0,n);t[n]=parseInt(`${r}${i}`,16)}return t}let kt;function or(){if(kt)return kt;if(!self.crypto||!self.crypto.subtle)throw new Error("Your browser environment does not support cryptography functions.");return kt=self.crypto.subtle,kt}async function hs(e,t,n){const r=or(),i=Le(e,"base64"),o=Le(t,"utf-8"),s=await r.importKey("raw",i,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),l=await r.sign({name:"HMAC",hash:{name:"SHA-256"}},s,o);return Rt(new Uint8Array(l),n)}async function ps(e,t){const n=Le(e,"utf-8"),r=await or().digest({name:"SHA-256"},n);return Rt(new Uint8Array(r),t)}function fs(){let e="";for(let t=0;t<32;t++){const n=Math.floor(Math.random()*16);t===12?e+="4":t===16?e+=n&3|8:e+=n.toString(16),(t===7||t===11||t===15||t===19)&&(e+="-")}return e}var Yt;const gs=typeof((Yt=globalThis?.crypto)===null||Yt===void 0?void 0:Yt.randomUUID)=="function"?globalThis.crypto.randomUUID.bind(globalThis.crypto):fs;function Zt(){return gs()}var en,tn,nn,rn;const ms=typeof window<"u"&&typeof window.document<"u",ys=typeof self=="object"&&typeof self?.importScripts=="function"&&(((en=self.constructor)===null||en===void 0?void 0:en.name)==="DedicatedWorkerGlobalScope"||((tn=self.constructor)===null||tn===void 0?void 0:tn.name)==="ServiceWorkerGlobalScope"||((nn=self.constructor)===null||nn===void 0?void 0:nn.name)==="SharedWorkerGlobalScope"),sr=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u",ar=typeof Bun<"u"&&typeof Bun.version<"u",Fe=typeof globalThis.process<"u"&&!!globalThis.process.version&&!!(!((rn=globalThis.process.versions)===null||rn===void 0)&&rn.node),vs=Fe&&!ar&&!sr,Ts=typeof navigator<"u"&&navigator?.product==="ReactNative",on="REDACTED",bs=["x-ms-client-request-id","x-ms-return-client-request-id","x-ms-useragent","x-ms-correlation-request-id","x-ms-request-id","client-request-id","ms-cv","return-client-request-id","traceparent","Access-Control-Allow-Credentials","Access-Control-Allow-Headers","Access-Control-Allow-Methods","Access-Control-Allow-Origin","Access-Control-Expose-Headers","Access-Control-Max-Age","Access-Control-Request-Headers","Access-Control-Request-Method","Origin","Accept","Accept-Encoding","Cache-Control","Connection","Content-Length","Content-Type","Date","ETag","Expires","If-Match","If-Modified-Since","If-None-Match","If-Unmodified-Since","Last-Modified","Pragma","Request-Id","Retry-After","Server","Transfer-Encoding","User-Agent","WWW-Authenticate"],ws=["api-version"];class sn{constructor({additionalAllowedHeaderNames:t=[],additionalAllowedQueryParameters:n=[]}={}){t=bs.concat(t),n=ws.concat(n),this.allowedHeaderNames=new Set(t.map(r=>r.toLowerCase())),this.allowedQueryParameters=new Set(n.map(r=>r.toLowerCase()))}sanitize(t){const n=new Set;return JSON.stringify(t,(r,i)=>{if(i instanceof Error)return Object.assign(Object.assign({},i),{name:i.name,message:i.message});if(r==="headers")return this.sanitizeHeaders(i);if(r==="url")return this.sanitizeUrl(i);if(r==="query")return this.sanitizeQuery(i);if(r==="body")return;if(r==="response")return;if(r==="operationSpec")return;if(Array.isArray(i)||Xt(i)){if(n.has(i))return"[Circular]";n.add(i)}return i},2)}sanitizeUrl(t){if(typeof t!="string"||t===null||t==="")return t;const n=new URL(t);if(!n.search)return t;for(const[r]of n.searchParams)this.allowedQueryParameters.has(r.toLowerCase())||n.searchParams.set(r,on);return n.toString()}sanitizeHeaders(t){const n={};for(const r of Object.keys(t))this.allowedHeaderNames.has(r.toLowerCase())?n[r]=t[r]:n[r]=on;return n}sanitizeQuery(t){if(typeof t!="object"||t===null)return t;const n={};for(const r of Object.keys(t))this.allowedQueryParameters.has(r.toLowerCase())?n[r]=t[r]:n[r]=on;return n}}async function Ss(e,t){var n,r;const i=new AbortController;function o(){i.abort()}(n=t?.abortSignal)===null||n===void 0||n.addEventListener("abort",o);try{return await Promise.race(e.map(s=>s({abortSignal:i.signal})))}finally{i.abort(),(r=t?.abortSignal)===null||r===void 0||r.removeEventListener("abort",o)}}let Cs=class extends Error{constructor(t){super(t),this.name="AbortError"}};function cr(e,t){const{cleanupBeforeAbort:n,abortSignal:r,abortErrorMsg:i}=t??{};return new Promise((o,s)=>{function l(){s(new Cs(i??"The operation was aborted."))}function f(){r?.removeEventListener("abort",y)}function y(){n?.(),f(),l()}if(r?.aborted)return l();try{e(b=>{f(),o(b)},b=>{f(),s(b)})}catch(b){s(b)}r?.addEventListener("abort",y)})}const Rs="The delay was aborted.";function ur(e,t){let n;const{abortSignal:r,abortErrorMsg:i}=t??{};return cr(o=>{n=setTimeout(o,e)},{cleanupBeforeAbort:()=>clearTimeout(n),abortSignal:r,abortErrorMsg:i??Rs})}function ct(e){if(Qt(e))return e.message;{let t;try{typeof e=="object"&&e?t=JSON.stringify(e):t=String(e)}catch{t="[unable to stringify input]"}return`Unknown error ${t}`}}function an(e){return typeof e<"u"&&e!==null}function ks(e,t){if(!an(e)||typeof e!="object")return!1;for(const n of t)if(!lr(e,n))return!1;return!0}function lr(e,t){return an(e)&&typeof e=="object"&&t in e}function Es(e,t){return tr(e,t)}function Ps(e,t){return ps(e,t)}function As(e,t,n){return hs(e,t,n)}function Is(e,t){return er(e,t)}function dr(e){return Qt(e)}function Os(e){return Xt(e)}function hr(){return Zt()}const Ms=ms,Ns=ar,_s=sr,Us=Fe,Et=Fe,xs=vs,Ds=Ts,Ls=ys;function $s(e,t){return Rt(e,t)}function js(e,t){return Le(e,t)}const qs=yt(Object.freeze(Object.defineProperty({__proto__:null,calculateRetryDelay:Es,cancelablePromiseRace:Ss,computeSha256Hash:Ps,computeSha256Hmac:As,createAbortablePromise:cr,delay:ur,getErrorMessage:ct,getRandomIntegerInclusive:Is,isBrowser:Ms,isBun:Ns,isDefined:an,isDeno:_s,isError:dr,isNode:Us,isNodeLike:Et,isNodeRuntime:xs,isObject:Os,isObjectWithProperties:ks,isReactNative:Ds,isWebWorker:Ls,objectHasProperty:lr,randomUUID:hr,stringToUint8Array:js,uint8ArrayToString:$s},Symbol.toStringTag,{value:"Module"})));function pr(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function fr(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function Bs(e){return atob(e)}const Re="$",et="_";function Hs(e,t){return t!=="Composite"&&t!=="Dictionary"&&(typeof e=="string"||typeof e=="number"||typeof e=="boolean"||t?.match(/^(Date|DateTime|DateTimeRfc1123|UnixTime|ByteArray|Base64Url)$/i)!==null||e===void 0||e===null)}const zs=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Fs(e){return zs.test(e)}const Vs=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/i;function Ws(e){return Vs.test(e)}function Js(e){const t=Object.assign(Object.assign({},e.headers),e.body);return e.hasNullableType&&Object.getOwnPropertyNames(t).length===0?e.shouldWrapBody?{body:null}:null:e.shouldWrapBody?Object.assign(Object.assign({},e.headers),{body:e.body}):t}function gr(e,t){var n,r;const i=e.parsedHeaders;if(e.request.method==="HEAD")return Object.assign(Object.assign({},i),{body:e.parsedBody});const o=t&&t.bodyMapper,s=!!o?.nullable,l=o?.type.name;if(l==="Stream")return Object.assign(Object.assign({},i),{blobBody:e.blobBody,readableStreamBody:e.readableStreamBody});const f=l==="Composite"&&o.type.modelProperties||{},y=Object.keys(f).some(b=>f[b].serializedName==="");if(l==="Sequence"||y){const b=(n=e.parsedBody)!==null&&n!==void 0?n:[];for(const $ of Object.keys(f))f[$].serializedName&&(b[$]=(r=e.parsedBody)===null||r===void 0?void 0:r[$]);if(i)for(const $ of Object.keys(i))b[$]=i[$];return s&&!e.parsedBody&&!i&&Object.getOwnPropertyNames(f).length===0?null:b}return Js({body:e.parsedBody,headers:i,hasNullableType:s,shouldWrapBody:Hs(e.parsedBody,l)})}class Gs{constructor(t={},n=!1){this.modelMappers=t,this.isXML=n}validateConstraints(t,n,r){const i=(o,s)=>{throw new Error(`"${r}" with value "${n}" should satisfy the constraint "${o}": ${s}.`)};if(t.constraints&&n!==void 0&&n!==null){const{ExclusiveMaximum:o,ExclusiveMinimum:s,InclusiveMaximum:l,InclusiveMinimum:f,MaxItems:y,MaxLength:b,MinItems:$,MinLength:L,MultipleOf:H,Pattern:W,UniqueItems:Z}=t.constraints;if(o!==void 0&&n>=o&&i("ExclusiveMaximum",o),s!==void 0&&n<=s&&i("ExclusiveMinimum",s),l!==void 0&&n>l&&i("InclusiveMaximum",l),f!==void 0&&n<f&&i("InclusiveMinimum",f),y!==void 0&&n.length>y&&i("MaxItems",y),b!==void 0&&n.length>b&&i("MaxLength",b),$!==void 0&&n.length<$&&i("MinItems",$),L!==void 0&&n.length<L&&i("MinLength",L),H!==void 0&&n%H!==0&&i("MultipleOf",H),W){const oe=typeof W=="string"?new RegExp(W):W;(typeof n!="string"||n.match(oe)===null)&&i("Pattern",W)}Z&&n.some((oe,fe,ae)=>ae.indexOf(oe)!==fe)&&i("UniqueItems",Z)}}serialize(t,n,r,i={xml:{}}){var o,s,l;const f={xml:{rootName:(o=i.xml.rootName)!==null&&o!==void 0?o:"",includeRoot:(s=i.xml.includeRoot)!==null&&s!==void 0?s:!1,xmlCharKey:(l=i.xml.xmlCharKey)!==null&&l!==void 0?l:et}};let y={};const b=t.type.name;r||(r=t.serializedName),b.match(/^Sequence$/i)!==null&&(y=[]),t.isConstant&&(n=t.defaultValue);const{required:$,nullable:L}=t;if($&&L&&n===void 0)throw new Error(`${r} cannot be undefined.`);if($&&!L&&n==null)throw new Error(`${r} cannot be null or undefined.`);if(!$&&L===!1&&n===null)throw new Error(`${r} cannot be null.`);return n==null||b.match(/^any$/i)!==null?y=n:b.match(/^(Number|String|Boolean|Object|Stream|Uuid)$/i)!==null?y=ea(b,r,n):b.match(/^Enum$/i)!==null?y=ta(r,t.type.allowedValues,n):b.match(/^(Date|DateTime|TimeSpan|DateTimeRfc1123|UnixTime)$/i)!==null?y=ia(b,n,r):b.match(/^ByteArray$/i)!==null?y=na(r,n):b.match(/^Base64Url$/i)!==null?y=ra(r,n):b.match(/^Sequence$/i)!==null?y=oa(this,t,n,r,!!this.isXML,f):b.match(/^Dictionary$/i)!==null?y=sa(this,t,n,r,!!this.isXML,f):b.match(/^Composite$/i)!==null&&(y=ca(this,t,n,r,!!this.isXML,f)),y}deserialize(t,n,r,i={xml:{}}){var o,s,l,f;const y={xml:{rootName:(o=i.xml.rootName)!==null&&o!==void 0?o:"",includeRoot:(s=i.xml.includeRoot)!==null&&s!==void 0?s:!1,xmlCharKey:(l=i.xml.xmlCharKey)!==null&&l!==void 0?l:et},ignoreUnknownProperties:(f=i.ignoreUnknownProperties)!==null&&f!==void 0?f:!1};if(n==null)return this.isXML&&t.type.name==="Sequence"&&!t.xmlIsWrapped&&(n=[]),t.defaultValue!==void 0&&(n=t.defaultValue),n;let b;const $=t.type.name;if(r||(r=t.serializedName),$.match(/^Composite$/i)!==null)b=la(this,t,n,r,y);else{if(this.isXML){const L=y.xml.xmlCharKey;n[Re]!==void 0&&n[L]!==void 0&&(n=n[L])}$.match(/^Number$/i)!==null?(b=parseFloat(n),isNaN(b)&&(b=n)):$.match(/^Boolean$/i)!==null?n==="true"?b=!0:n==="false"?b=!1:b=n:$.match(/^(String|Enum|Object|Stream|Uuid|TimeSpan|any)$/i)!==null?b=n:$.match(/^(Date|DateTime|DateTimeRfc1123)$/i)!==null?b=new Date(n):$.match(/^UnixTime$/i)!==null?b=Zs(n):$.match(/^ByteArray$/i)!==null?b=fr(n):$.match(/^Base64Url$/i)!==null?b=Qs(n):$.match(/^Sequence$/i)!==null?b=ha(this,t,n,r,y):$.match(/^Dictionary$/i)!==null&&(b=da(this,t,n,r,y))}return t.isConstant&&(b=t.defaultValue),b}}function cn(e={},t=!1){return new Gs(e,t)}function Ks(e,t){let n=e.length;for(;n-1>=0&&e[n-1]===t;)--n;return e.substr(0,n)}function Xs(e){if(!e)return;if(!(e instanceof Uint8Array))throw new Error("Please provide an input of type Uint8Array for converting to Base64Url.");const t=pr(e);return Ks(t,"=").replace(/\+/g,"-").replace(/\//g,"_")}function Qs(e){if(e){if(e&&typeof e.valueOf()!="string")throw new Error("Please provide an input of type string for converting to Uint8Array");return e=e.replace(/-/g,"+").replace(/_/g,"/"),fr(e)}}function un(e){const t=[];let n="";if(e){const r=e.split(".");for(const i of r)i.charAt(i.length-1)==="\\"?n+=i.substr(0,i.length-1)+".":(n+=i,t.push(n),n="")}return t}function Ys(e){if(e)return typeof e.valueOf()=="string"&&(e=new Date(e)),Math.floor(e.getTime()/1e3)}function Zs(e){if(e)return new Date(e*1e3)}function ea(e,t,n){if(n!=null){if(e.match(/^Number$/i)!==null){if(typeof n!="number")throw new Error(`${t} with value ${n} must be of type number.`)}else if(e.match(/^String$/i)!==null){if(typeof n.valueOf()!="string")throw new Error(`${t} with value "${n}" must be of type string.`)}else if(e.match(/^Uuid$/i)!==null){if(!(typeof n.valueOf()=="string"&&Ws(n)))throw new Error(`${t} with value "${n}" must be of type string and a valid uuid.`)}else if(e.match(/^Boolean$/i)!==null){if(typeof n!="boolean")throw new Error(`${t} with value ${n} must be of type boolean.`)}else if(e.match(/^Stream$/i)!==null){const r=typeof n;if(r!=="string"&&typeof n.pipe!="function"&&typeof n.tee!="function"&&!(n instanceof ArrayBuffer)&&!ArrayBuffer.isView(n)&&!((typeof Blob=="function"||typeof Blob=="object")&&n instanceof Blob)&&r!=="function")throw new Error(`${t} must be a string, Blob, ArrayBuffer, ArrayBufferView, ReadableStream, or () => ReadableStream.`)}}return n}function ta(e,t,n){if(!t)throw new Error(`Please provide a set of allowedValues to validate ${e} as an Enum Type.`);if(!t.some(i=>typeof i.valueOf()=="string"?i.toLowerCase()===n.toLowerCase():i===n))throw new Error(`${n} is not a valid value for ${e}. The valid values are: ${JSON.stringify(t)}.`);return n}function na(e,t){if(t!=null){if(!(t instanceof Uint8Array))throw new Error(`${e} must be of type Uint8Array.`);t=pr(t)}return t}function ra(e,t){if(t!=null){if(!(t instanceof Uint8Array))throw new Error(`${e} must be of type Uint8Array.`);t=Xs(t)}return t}function ia(e,t,n){if(t!=null){if(e.match(/^Date$/i)!==null){if(!(t instanceof Date||typeof t.valueOf()=="string"&&!isNaN(Date.parse(t))))throw new Error(`${n} must be an instanceof Date or a string in ISO8601 format.`);t=t instanceof Date?t.toISOString().substring(0,10):new Date(t).toISOString().substring(0,10)}else if(e.match(/^DateTime$/i)!==null){if(!(t instanceof Date||typeof t.valueOf()=="string"&&!isNaN(Date.parse(t))))throw new Error(`${n} must be an instanceof Date or a string in ISO8601 format.`);t=t instanceof Date?t.toISOString():new Date(t).toISOString()}else if(e.match(/^DateTimeRfc1123$/i)!==null){if(!(t instanceof Date||typeof t.valueOf()=="string"&&!isNaN(Date.parse(t))))throw new Error(`${n} must be an instanceof Date or a string in RFC-1123 format.`);t=t instanceof Date?t.toUTCString():new Date(t).toUTCString()}else if(e.match(/^UnixTime$/i)!==null){if(!(t instanceof Date||typeof t.valueOf()=="string"&&!isNaN(Date.parse(t))))throw new Error(`${n} must be an instanceof Date or a string in RFC-1123/ISO8601 format for it to be serialized in UnixTime/Epoch format.`);t=Ys(t)}else if(e.match(/^TimeSpan$/i)!==null&&!Fs(t))throw new Error(`${n} must be a string in ISO 8601 format. Instead was "${t}".`)}return t}function oa(e,t,n,r,i,o){var s;if(!Array.isArray(n))throw new Error(`${r} must be of type Array.`);let l=t.type.element;if(!l||typeof l!="object")throw new Error(`element" metadata for an Array must be defined in the mapper and it must of type "object" in ${r}.`);l.type.name==="Composite"&&l.type.className&&(l=(s=e.modelMappers[l.type.className])!==null&&s!==void 0?s:l);const f=[];for(let y=0;y<n.length;y++){const b=e.serialize(l,n[y],r,o);if(i&&l.xmlNamespace){const $=l.xmlNamespacePrefix?`xmlns:${l.xmlNamespacePrefix}`:"xmlns";l.type.name==="Composite"?(f[y]=Object.assign({},b),f[y][Re]={[$]:l.xmlNamespace}):(f[y]={},f[y][o.xml.xmlCharKey]=b,f[y][Re]={[$]:l.xmlNamespace})}else f[y]=b}return f}function sa(e,t,n,r,i,o){if(typeof n!="object")throw new Error(`${r} must be of type object.`);const s=t.type.value;if(!s||typeof s!="object")throw new Error(`"value" metadata for a Dictionary must be defined in the mapper and it must of type "object" in ${r}.`);const l={};for(const f of Object.keys(n)){const y=e.serialize(s,n[f],r,o);l[f]=vr(s,y,i,o)}if(i&&t.xmlNamespace){const f=t.xmlNamespacePrefix?`xmlns:${t.xmlNamespacePrefix}`:"xmlns",y=l;return y[Re]={[f]:t.xmlNamespace},y}return l}function aa(e,t,n){const r=t.type.additionalProperties;if(!r&&t.type.className){const i=mr(e,t,n);return i?.type.additionalProperties}return r}function mr(e,t,n){const r=t.type.className;if(!r)throw new Error(`Class name for model "${n}" is not provided in the mapper "${JSON.stringify(t,void 0,2)}".`);return e.modelMappers[r]}function yr(e,t,n){let r=t.type.modelProperties;if(!r){const i=mr(e,t,n);if(!i)throw new Error(`mapper() cannot be null or undefined for model "${t.type.className}".`);if(r=i?.type.modelProperties,!r)throw new Error(`modelProperties cannot be null or undefined in the mapper "${JSON.stringify(i)}" of type "${t.type.className}" for object "${n}".`)}return r}function ca(e,t,n,r,i,o){if(Pt(e,t)&&(t=Tr(e,t,n,"clientName")),n!=null){const s={},l=yr(e,t,r);for(const y of Object.keys(l)){const b=l[y];if(b.readOnly)continue;let $,L=s;if(e.isXML)b.xmlIsWrapped?$=b.xmlName:$=b.xmlElementName||b.xmlName;else{const H=un(b.serializedName);$=H.pop();for(const W of H){const Z=L[W];Z==null&&(n[y]!==void 0&&n[y]!==null||b.defaultValue!==void 0)&&(L[W]={}),L=L[W]}}if(L!=null){if(i&&t.xmlNamespace){const fe=t.xmlNamespacePrefix?`xmlns:${t.xmlNamespacePrefix}`:"xmlns";L[Re]=Object.assign(Object.assign({},L[Re]),{[fe]:t.xmlNamespace})}const H=b.serializedName!==""?r+"."+b.serializedName:r;let W=n[y];const Z=Pt(e,t);Z&&Z.clientName===y&&W==null&&(W=t.serializedName);const oe=e.serialize(b,W,H,o);if(oe!==void 0&&$!==void 0&&$!==null){const fe=vr(b,oe,i,o);i&&b.xmlIsAttribute?(L[Re]=L[Re]||{},L[Re][$]=oe):i&&b.xmlIsWrapped?L[$]={[b.xmlElementName]:fe}:L[$]=fe}}}const f=aa(e,t,r);if(f){const y=Object.keys(l);for(const b in n)y.every(L=>L!==b)&&(s[b]=e.serialize(f,n[b],r+'["'+b+'"]',o))}return s}return n}function vr(e,t,n,r){if(!n||!e.xmlNamespace)return t;const o={[e.xmlNamespacePrefix?`xmlns:${e.xmlNamespacePrefix}`:"xmlns"]:e.xmlNamespace};if(["Composite"].includes(e.type.name)){if(t[Re])return t;{const l=Object.assign({},t);return l[Re]=o,l}}const s={};return s[r.xml.xmlCharKey]=t,s[Re]=o,s}function ua(e,t){return[Re,t.xml.xmlCharKey].includes(e)}function la(e,t,n,r,i){var o,s;const l=(o=i.xml.xmlCharKey)!==null&&o!==void 0?o:et;Pt(e,t)&&(t=Tr(e,t,n,"serializedName"));const f=yr(e,t,r);let y={};const b=[];for(const L of Object.keys(f)){const H=f[L],W=un(f[L].serializedName);b.push(W[0]);const{serializedName:Z,xmlName:oe,xmlElementName:fe}=H;let ae=r;Z!==""&&Z!==void 0&&(ae=r+"."+Z);const ye=H.headerCollectionPrefix;if(ye){const F={};for(const V of Object.keys(n))V.startsWith(ye)&&(F[V.substring(ye.length)]=e.deserialize(H.type.value,n[V],ae,i)),b.push(V);y[L]=F}else if(e.isXML)if(H.xmlIsAttribute&&n[Re])y[L]=e.deserialize(H,n[Re][oe],ae,i);else if(H.xmlIsMsText)n[l]!==void 0?y[L]=n[l]:typeof n=="string"&&(y[L]=n);else{const F=fe||oe||Z;if(H.xmlIsWrapped){const V=n[oe],Y=(s=V?.[fe])!==null&&s!==void 0?s:[];y[L]=e.deserialize(H,Y,ae,i),b.push(oe)}else{const V=n[F];y[L]=e.deserialize(H,V,ae,i),b.push(F)}}else{let F,V=n,Y=0;for(const pe of W){if(!V)break;Y++,V=V[pe]}V===null&&Y<W.length&&(V=void 0),F=V;const ie=t.type.polymorphicDiscriminator;ie&&L===ie.clientName&&F==null&&(F=t.serializedName);let ce;if(Array.isArray(n[L])&&f[L].serializedName===""){F=n[L];const pe=e.deserialize(H,F,ae,i);for(const[le,De]of Object.entries(y))Object.prototype.hasOwnProperty.call(pe,le)||(pe[le]=De);y=pe}else(F!==void 0||H.defaultValue!==void 0)&&(ce=e.deserialize(H,F,ae,i),y[L]=ce)}}const $=t.type.additionalProperties;if($){const L=H=>{for(const W in f)if(un(f[W].serializedName)[0]===H)return!1;return!0};for(const H in n)L(H)&&(y[H]=e.deserialize($,n[H],r+'["'+H+'"]',i))}else if(n&&!i.ignoreUnknownProperties)for(const L of Object.keys(n))y[L]===void 0&&!b.includes(L)&&!ua(L,i)&&(y[L]=n[L]);return y}function da(e,t,n,r,i){const o=t.type.value;if(!o||typeof o!="object")throw new Error(`"value" metadata for a Dictionary must be defined in the mapper and it must of type "object" in ${r}`);if(n){const s={};for(const l of Object.keys(n))s[l]=e.deserialize(o,n[l],r,i);return s}return n}function ha(e,t,n,r,i){var o;let s=t.type.element;if(!s||typeof s!="object")throw new Error(`element" metadata for an Array must be defined in the mapper and it must of type "object" in ${r}`);if(n){Array.isArray(n)||(n=[n]),s.type.name==="Composite"&&s.type.className&&(s=(o=e.modelMappers[s.type.className])!==null&&o!==void 0?o:s);const l=[];for(let f=0;f<n.length;f++)l[f]=e.deserialize(s,n[f],`${r}[${f}]`,i);return l}return n}function pa(e,t,n){const r=[n];for(;r.length;){const i=r.shift(),o=t===i?t:i+"."+t;if(Object.prototype.hasOwnProperty.call(e,o))return e[o];for(const[s,l]of Object.entries(e))s.startsWith(i+".")&&l.type.uberParent===i&&l.type.className&&r.push(l.type.className)}}function Tr(e,t,n,r){var i;const o=Pt(e,t);if(o){let s=o[r];if(s){r==="serializedName"&&(s=s.replace(/\\/gi,""));const l=n[s],f=(i=t.type.uberParent)!==null&&i!==void 0?i:t.type.className;if(typeof l=="string"&&f){const y=pa(e.modelMappers.discriminators,l,f);y&&(t=y)}}}return t}function Pt(e,t){return t.type.polymorphicDiscriminator||br(e,t.type.uberParent)||br(e,t.type.className)}function br(e,t){return t&&e.modelMappers[t]&&e.modelMappers[t].type.polymorphicDiscriminator}const Ge={Base64Url:"Base64Url",Boolean:"Boolean",ByteArray:"ByteArray",Composite:"Composite",Date:"Date",DateTime:"DateTime",DateTimeRfc1123:"DateTimeRfc1123",Dictionary:"Dictionary",Enum:"Enum",Number:"Number",Object:"Object",Sequence:"Sequence",String:"String",Stream:"Stream",TimeSpan:"TimeSpan",UnixTime:"UnixTime"};class ln extends Error{constructor(t){super(t),this.name="AbortError"}}function fa(...e){if(e.length>0){const t=String(e[0]);t.includes(":error")?console.error(...e):t.includes(":warning")?console.warn(...e):t.includes(":info")?console.info(...e):t.includes(":verbose")?console.debug(...e):console.debug(...e)}}const wr=typeof process<"u"&&process.env&&process.env.DEBUG||void 0;let Sr,dn=[],hn=[];const At=[];wr&&pn(wr);const tt=Object.assign(e=>Cr(e),{enable:pn,enabled:fn,disable:ga,log:fa});function pn(e){Sr=e,dn=[],hn=[];const t=/\*/g,n=e.split(",").map(r=>r.trim().replace(t,".*?"));for(const r of n)r.startsWith("-")?hn.push(new RegExp(`^${r.substr(1)}$`)):dn.push(new RegExp(`^${r}$`));for(const r of At)r.enabled=fn(r.namespace)}function fn(e){if(e.endsWith("*"))return!0;for(const t of hn)if(t.test(e))return!1;for(const t of dn)if(t.test(e))return!0;return!1}function ga(){const e=Sr||"";return pn(""),e}function Cr(e){const t=Object.assign(n,{enabled:fn(e),destroy:ma,log:tt.log,namespace:e,extend:ya});function n(...r){t.enabled&&(r.length>0&&(r[0]=`${e} ${r[0]}`),t.log(...r))}return At.push(t),t}function ma(){const e=At.indexOf(this);return e>=0?(At.splice(e,1),!0):!1}function ya(e){const t=Cr(`${this.namespace}:${e}`);return t.log=this.log,t}const gn=["verbose","info","warning","error"],Rr={verbose:400,info:300,warning:200,error:100};function kr(e,t){t.log=(...n)=>{e.log(...n)}}function Er(e){return gn.includes(e)}function va(e){const t=new Set,n=typeof process<"u"&&process.env&&process.env[e.logLevelEnvVarName]||void 0;let r;const i=tt(e.namespace);i.log=(...b)=>{tt.log(...b)};function o(b){if(b&&!Er(b))throw new Error(`Unknown log level '${b}'. Acceptable values: ${gn.join(",")}`);r=b;const $=[];for(const L of t)s(L)&&$.push(L.namespace);tt.enable($.join(","))}n&&(Er(n)?o(n):console.error(`${e.logLevelEnvVarName} set to unknown log level '${n}'; logging is not enabled. Acceptable values: ${gn.join(", ")}.`));function s(b){return!!(r&&Rr[b.level]<=Rr[r])}function l(b,$){const L=Object.assign(b.extend($),{level:$});if(kr(b,L),s(L)){const H=tt.disable();tt.enable(H+","+L.namespace)}return t.add(L),L}function f(){return r}function y(b){const $=i.extend(b);return kr(i,$),{error:l($,"error"),warning:l($,"warning"),info:l($,"info"),verbose:l($,"verbose")}}return{setLogLevel:o,getLogLevel:f,createClientLogger:y,logger:i}}const Ta=va({logLevelEnvVarName:"TYPESPEC_RUNTIME_LOG_LEVEL",namespace:"typeSpecRuntime"});function Pr(e){return Ta.createClientLogger(e)}function It(e){return e.toLowerCase()}function*ba(e){for(const t of e.values())yield[t.name,t.value]}class wa{constructor(t){if(this._headersMap=new Map,t)for(const n of Object.keys(t))this.set(n,t[n])}set(t,n){this._headersMap.set(It(t),{name:t,value:String(n).trim()})}get(t){var n;return(n=this._headersMap.get(It(t)))===null||n===void 0?void 0:n.value}has(t){return this._headersMap.has(It(t))}delete(t){this._headersMap.delete(It(t))}toJSON(t={}){const n={};if(t.preserveCase)for(const r of this._headersMap.values())n[r.name]=r.value;else for(const[r,i]of this._headersMap)n[r]=i.value;return n}toString(){return JSON.stringify(this.toJSON({preserveCase:!0}))}[Symbol.iterator](){return ba(this._headersMap)}}function Ke(e){return new wa(e)}class Sa{constructor(t){var n,r,i,o,s,l,f;this.url=t.url,this.body=t.body,this.headers=(n=t.headers)!==null&&n!==void 0?n:Ke(),this.method=(r=t.method)!==null&&r!==void 0?r:"GET",this.timeout=(i=t.timeout)!==null&&i!==void 0?i:0,this.multipartBody=t.multipartBody,this.formData=t.formData,this.disableKeepAlive=(o=t.disableKeepAlive)!==null&&o!==void 0?o:!1,this.proxySettings=t.proxySettings,this.streamResponseStatusCodes=t.streamResponseStatusCodes,this.withCredentials=(s=t.withCredentials)!==null&&s!==void 0?s:!1,this.abortSignal=t.abortSignal,this.onUploadProgress=t.onUploadProgress,this.onDownloadProgress=t.onDownloadProgress,this.requestId=t.requestId||Zt(),this.allowInsecureConnection=(l=t.allowInsecureConnection)!==null&&l!==void 0?l:!1,this.enableBrowserStreams=(f=t.enableBrowserStreams)!==null&&f!==void 0?f:!1,this.requestOverrides=t.requestOverrides,this.authSchemes=t.authSchemes}}function Ar(e){return new Sa(e)}const Ir=new Set(["Deserialize","Serialize","Retry","Sign"]);class Ot{constructor(t){var n;this._policies=[],this._policies=(n=t?.slice(0))!==null&&n!==void 0?n:[],this._orderedPolicies=void 0}addPolicy(t,n={}){if(n.phase&&n.afterPhase)throw new Error("Policies inside a phase cannot specify afterPhase.");if(n.phase&&!Ir.has(n.phase))throw new Error(`Invalid phase name: ${n.phase}`);if(n.afterPhase&&!Ir.has(n.afterPhase))throw new Error(`Invalid afterPhase name: ${n.afterPhase}`);this._policies.push({policy:t,options:n}),this._orderedPolicies=void 0}removePolicy(t){const n=[];return this._policies=this._policies.filter(r=>t.name&&r.policy.name===t.name||t.phase&&r.options.phase===t.phase?(n.push(r.policy),!1):!0),this._orderedPolicies=void 0,n}sendRequest(t,n){return this.getOrderedPolicies().reduceRight((o,s)=>l=>s.sendRequest(l,o),o=>t.sendRequest(o))(n)}getOrderedPolicies(){return this._orderedPolicies||(this._orderedPolicies=this.orderPolicies()),this._orderedPolicies}clone(){return new Ot(this._policies)}static create(){return new Ot}orderPolicies(){const t=[],n=new Map;function r(W){return{name:W,policies:new Set,hasRun:!1,hasAfterPolicies:!1}}const i=r("Serialize"),o=r("None"),s=r("Deserialize"),l=r("Retry"),f=r("Sign"),y=[i,o,s,l,f];function b(W){return W==="Retry"?l:W==="Serialize"?i:W==="Deserialize"?s:W==="Sign"?f:o}for(const W of this._policies){const Z=W.policy,oe=W.options,fe=Z.name;if(n.has(fe))throw new Error("Duplicate policy names not allowed in pipeline");const ae={policy:Z,dependsOn:new Set,dependants:new Set};oe.afterPhase&&(ae.afterPhase=b(oe.afterPhase),ae.afterPhase.hasAfterPolicies=!0),n.set(fe,ae),b(oe.phase).policies.add(ae)}for(const W of this._policies){const{policy:Z,options:oe}=W,fe=Z.name,ae=n.get(fe);if(!ae)throw new Error(`Missing node for policy ${fe}`);if(oe.afterPolicies)for(const ye of oe.afterPolicies){const F=n.get(ye);F&&(ae.dependsOn.add(F),F.dependants.add(ae))}if(oe.beforePolicies)for(const ye of oe.beforePolicies){const F=n.get(ye);F&&(F.dependsOn.add(ae),ae.dependants.add(F))}}function $(W){W.hasRun=!0;for(const Z of W.policies)if(!(Z.afterPhase&&(!Z.afterPhase.hasRun||Z.afterPhase.policies.size))&&Z.dependsOn.size===0){t.push(Z.policy);for(const oe of Z.dependants)oe.dependsOn.delete(Z);n.delete(Z.policy.name),W.policies.delete(Z)}}function L(){for(const W of y){if($(W),W.policies.size>0&&W!==o){o.hasRun||$(o);return}W.hasAfterPolicies&&$(o)}}let H=0;for(;n.size>0;){H++;const W=t.length;if(L(),t.length<=W&&H>1)throw new Error("Cannot satisfy policy dependencies due to requirements cycle.")}return t}}function Or(){return Ot.create()}const Ca=Symbol(),Ra=new sn;let qe=class jo extends Error{constructor(t,n={}){super(t),this.name="RestError",this.code=n.code,this.statusCode=n.statusCode,Object.defineProperty(this,"request",{value:n.request,enumerable:!1}),Object.defineProperty(this,"response",{value:n.response,enumerable:!1}),Object.defineProperty(this,Ca,{value:()=>`RestError: ${this.message} ${Ra.sanitize(Object.assign(Object.assign({},this),{request:this.request,response:this.response}))}`,enumerable:!1}),Object.setPrototypeOf(this,jo.prototype)}};qe.REQUEST_SEND_ERROR="REQUEST_SEND_ERROR",qe.PARSE_ERROR="PARSE_ERROR";function Mr(e){return e instanceof qe?!0:Qt(e)&&e.name==="RestError"}function Nr(e){return!!(e&&typeof e.pipe=="function")}function Mt(e){return!!(e&&typeof e.getReader=="function"&&typeof e.tee=="function")}function _r(e){return e!==void 0&&(e instanceof Uint8Array||Ur(e)||typeof e=="function"||e instanceof Blob)}function Ur(e){return Nr(e)||Mt(e)}function ka(e){return typeof e.stream=="function"}function Ea(e){return(typeof Blob=="function"||typeof Blob=="object")&&e instanceof Blob}class Pa{async sendRequest(t){if(new URL(t.url).protocol!=="https:"&&!t.allowInsecureConnection)throw new Error(`Cannot connect to ${t.url} while allowInsecureConnection is false.`);if(t.proxySettings)throw new Error("HTTP proxy is not supported in browser environment");try{return await Aa(t)}catch(i){throw Ma(i,t)}}}async function Aa(e){const{abortController:t,abortControllerCleanup:n}=Oa(e);try{const r=Na(e.headers),{streaming:i,body:o}=Ua(e),s=Object.assign(Object.assign({body:o,method:e.method,headers:r,signal:t.signal},"credentials"in Request.prototype?{credentials:e.withCredentials?"include":"same-origin"}:{}),"cache"in Request.prototype?{cache:"no-store"}:{});i&&(s.duplex="half");const l=await fetch(e.url,Object.assign(Object.assign({},s),e.requestOverrides));return Ea(e.body)&&e.onUploadProgress&&e.onUploadProgress({loadedBytes:e.body.size}),Ia(l,e,n)}catch(r){throw n?.(),r}}async function Ia(e,t,n){var r,i;const o=_a(e),s={request:t,headers:o,status:e.status},l=Mt(e.body)?xr(e.body,{onProgress:t.onDownloadProgress,onEnd:n}):e.body;if(!((r=t.streamResponseStatusCodes)===null||r===void 0)&&r.has(Number.POSITIVE_INFINITY)||!((i=t.streamResponseStatusCodes)===null||i===void 0)&&i.has(s.status))if(t.enableBrowserStreams)s.browserStreamBody=l??void 0;else{const f=new Response(l);s.blobBody=f.blob(),n?.()}else{const f=new Response(l);s.bodyAsText=await f.text(),n?.()}return s}function Oa(e){const t=new AbortController;let n,r;if(e.abortSignal){if(e.abortSignal.aborted)throw new ln("The operation was aborted. Request has already been canceled.");r=i=>{i.type==="abort"&&t.abort()},e.abortSignal.addEventListener("abort",r),n=()=>{var i;r&&((i=e.abortSignal)===null||i===void 0||i.removeEventListener("abort",r))}}return e.timeout>0&&setTimeout(()=>{t.abort()},